Skip to content

Commit

Permalink
wil6210: limit MTU
Browse files Browse the repository at this point in the history
Obey 802.11 spec that defines max. data size 7920 bytes

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Vladimir Kondratiev authored and John W. Linville committed May 29, 2014
1 parent 60ccc10 commit d87bac1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/net/wireless/ath/wil6210/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,26 @@ static int wil_stop(struct net_device *ndev)
return wil_down(wil);
}

static int wil_change_mtu(struct net_device *ndev, int new_mtu)
{
struct wil6210_priv *wil = ndev_to_wil(ndev);

if (new_mtu < 68 || new_mtu > IEEE80211_MAX_DATA_LEN_DMG)
return -EINVAL;

wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu);
ndev->mtu = new_mtu;

return 0;
}

static const struct net_device_ops wil_netdev_ops = {
.ndo_open = wil_open,
.ndo_stop = wil_stop,
.ndo_start_xmit = wil_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = wil_change_mtu,
};

static int wil6210_netdev_poll_rx(struct napi_struct *napi, int budget)
Expand Down

0 comments on commit d87bac1

Please sign in to comment.