mac80211: update to wireless-testing 2017-01-31
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / 009-revert-mtu-changes.patch
1 --- a/net/mac80211/iface.c
2 +++ b/net/mac80211/iface.c
3 @@ -151,6 +151,15 @@ void ieee80211_recalc_idle(struct ieee80
4                 ieee80211_hw_config(local, change);
5  }
6  
7 +static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
8 +{
9 +       if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN)
10 +               return -EINVAL;
11 +
12 +       dev->mtu = new_mtu;
13 +       return 0;
14 +}
15 +
16  static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr,
17                                 bool check_dup)
18  {
19 @@ -1168,6 +1177,7 @@ static const struct net_device_ops ieee8
20         .ndo_uninit             = ieee80211_uninit,
21         .ndo_start_xmit         = ieee80211_subif_start_xmit,
22         .ndo_set_rx_mode        = ieee80211_set_multicast_list,
23 +       .ndo_change_mtu         = ieee80211_change_mtu,
24         .ndo_set_mac_address    = ieee80211_change_mac,
25         .ndo_select_queue       = ieee80211_netdev_select_queue,
26         .ndo_get_stats64        = ieee80211_get_stats64,
27 @@ -1211,6 +1221,7 @@ static const struct net_device_ops ieee8
28         .ndo_uninit             = ieee80211_uninit,
29         .ndo_start_xmit         = ieee80211_monitor_start_xmit,
30         .ndo_set_rx_mode        = ieee80211_set_multicast_list,
31 +       .ndo_change_mtu         = ieee80211_change_mtu,
32         .ndo_set_mac_address    = ieee80211_change_mac,
33         .ndo_select_queue       = ieee80211_monitor_select_queue,
34         .ndo_get_stats64        = ieee80211_get_stats64,
35 @@ -1919,10 +1930,6 @@ int ieee80211_if_add(struct ieee80211_lo
36  
37                 netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
38  
39 -               /* MTU range: 256 - 2304 */
40 -               ndev->min_mtu = 256;
41 -               ndev->max_mtu = IEEE80211_MAX_DATA_LEN;
42 -
43                 ret = register_netdevice(ndev);
44                 if (ret) {
45                         ieee80211_if_free(ndev);
46 --- a/drivers/net/wireless/ath/wil6210/netdev.c
47 +++ b/drivers/net/wireless/ath/wil6210/netdev.c
48 @@ -42,6 +42,21 @@ static int wil_stop(struct net_device *n
49         return wil_down(wil);
50  }
51  
52 +static int wil_change_mtu(struct net_device *ndev, int new_mtu)
53 +{
54 +       struct wil6210_priv *wil = ndev_to_wil(ndev);
55 +
56 +       if (new_mtu < 68 || new_mtu > mtu_max) {
57 +               wil_err(wil, "invalid MTU %d\n", new_mtu);
58 +               return -EINVAL;
59 +       }
60 +
61 +       wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu);
62 +       ndev->mtu = new_mtu;
63 +
64 +       return 0;
65 +}
66 +
67  static int wil_do_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
68  {
69         struct wil6210_priv *wil = ndev_to_wil(ndev);
70 @@ -55,6 +70,7 @@ static const struct net_device_ops wil_n
71         .ndo_start_xmit         = wil_start_xmit,
72         .ndo_set_mac_address    = eth_mac_addr,
73         .ndo_validate_addr      = eth_validate_addr,
74 +       .ndo_change_mtu         = wil_change_mtu,
75         .ndo_do_ioctl           = wil_do_ioctl,
76  };
77  
78 @@ -111,7 +127,6 @@ static int wil6210_netdev_poll_tx(struct
79  static void wil_dev_setup(struct net_device *dev)
80  {
81         ether_setup(dev);
82 -       dev->max_mtu = mtu_max;
83         dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT;
84  }
85  
86 --- a/drivers/net/wireless/atmel/atmel.c
87 +++ b/drivers/net/wireless/atmel/atmel.c
88 @@ -1295,6 +1295,14 @@ static struct iw_statistics *atmel_get_w
89         return &priv->wstats;
90  }
91  
92 +static int atmel_change_mtu(struct net_device *dev, int new_mtu)
93 +{
94 +       if ((new_mtu < 68) || (new_mtu > 2312))
95 +               return -EINVAL;
96 +       dev->mtu = new_mtu;
97 +       return 0;
98 +}
99 +
100  static int atmel_set_mac_address(struct net_device *dev, void *p)
101  {
102         struct sockaddr *addr = p;
103 @@ -1498,6 +1506,7 @@ static const struct file_operations atme
104  static const struct net_device_ops atmel_netdev_ops = {
105         .ndo_open               = atmel_open,
106         .ndo_stop               = atmel_close,
107 +       .ndo_change_mtu         = atmel_change_mtu,
108         .ndo_set_mac_address    = atmel_set_mac_address,
109         .ndo_start_xmit         = start_tx,
110         .ndo_do_ioctl           = atmel_ioctl,
111 @@ -1591,10 +1600,6 @@ struct net_device *init_atmel_card(unsig
112         dev->irq = irq;
113         dev->base_addr = port;
114  
115 -       /* MTU range: 68 - 2312 */
116 -       dev->min_mtu = 68;
117 -       dev->max_mtu = MAX_WIRELESS_BODY - ETH_FCS_LEN;
118 -
119         SET_NETDEV_DEV(dev, sys_dev);
120  
121         if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) {
122 --- a/drivers/net/wireless/cisco/airo.c
123 +++ b/drivers/net/wireless/cisco/airo.c
124 @@ -2329,6 +2329,14 @@ static int airo_set_mac_address(struct n
125         return 0;
126  }
127  
128 +static int airo_change_mtu(struct net_device *dev, int new_mtu)
129 +{
130 +       if ((new_mtu < 68) || (new_mtu > 2400))
131 +               return -EINVAL;
132 +       dev->mtu = new_mtu;
133 +       return 0;
134 +}
135 +
136  static LIST_HEAD(airo_devices);
137  
138  static void add_airo_dev(struct airo_info *ai)
139 @@ -2648,6 +2656,7 @@ static const struct net_device_ops airo1
140         .ndo_get_stats          = airo_get_stats,
141         .ndo_set_mac_address    = airo_set_mac_address,
142         .ndo_do_ioctl           = airo_ioctl,
143 +       .ndo_change_mtu         = airo_change_mtu,
144  };
145  
146  static void wifi_setup(struct net_device *dev)
147 @@ -2659,8 +2668,6 @@ static void wifi_setup(struct net_device
148         dev->type               = ARPHRD_IEEE80211;
149         dev->hard_header_len    = ETH_HLEN;
150         dev->mtu                = AIRO_DEF_MTU;
151 -       dev->min_mtu            = 68;
152 -       dev->max_mtu            = MIC_MSGLEN_MAX;
153         dev->addr_len           = ETH_ALEN;
154         dev->tx_queue_len       = 100; 
155  
156 @@ -2747,6 +2754,7 @@ static const struct net_device_ops airo_
157         .ndo_set_rx_mode        = airo_set_multicast_list,
158         .ndo_set_mac_address    = airo_set_mac_address,
159         .ndo_do_ioctl           = airo_ioctl,
160 +       .ndo_change_mtu         = airo_change_mtu,
161         .ndo_validate_addr      = eth_validate_addr,
162  };
163  
164 @@ -2758,6 +2766,7 @@ static const struct net_device_ops mpi_n
165         .ndo_set_rx_mode        = airo_set_multicast_list,
166         .ndo_set_mac_address    = airo_set_mac_address,
167         .ndo_do_ioctl           = airo_ioctl,
168 +       .ndo_change_mtu         = airo_change_mtu,
169         .ndo_validate_addr      = eth_validate_addr,
170  };
171  
172 @@ -2813,7 +2822,6 @@ static struct net_device *_init_airo_car
173         dev->irq = irq;
174         dev->base_addr = port;
175         dev->priv_flags &= ~IFF_TX_SKB_SHARING;
176 -       dev->max_mtu = MIC_MSGLEN_MAX;
177  
178         SET_NETDEV_DEV(dev, dmdev);
179  
180 --- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c
181 +++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
182 @@ -6039,6 +6039,7 @@ static const struct net_device_ops ipw21
183         .ndo_open               = ipw2100_open,
184         .ndo_stop               = ipw2100_close,
185         .ndo_start_xmit         = libipw_xmit,
186 +       .ndo_change_mtu         = libipw_change_mtu,
187         .ndo_tx_timeout         = ipw2100_tx_timeout,
188         .ndo_set_mac_address    = ipw2100_set_address,
189         .ndo_validate_addr      = eth_validate_addr,
190 @@ -6074,8 +6075,6 @@ static struct net_device *ipw2100_alloc_
191         dev->wireless_data = &priv->wireless_data;
192         dev->watchdog_timeo = 3 * HZ;
193         dev->irq = 0;
194 -       dev->min_mtu = 68;
195 -       dev->max_mtu = LIBIPW_DATA_LEN;
196  
197         /* NOTE: We don't use the wireless_handlers hook
198          * in dev as the system will start throwing WX requests
199 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
200 +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
201 @@ -11561,6 +11561,7 @@ static const struct net_device_ops ipw_p
202         .ndo_open               = ipw_prom_open,
203         .ndo_stop               = ipw_prom_stop,
204         .ndo_start_xmit         = ipw_prom_hard_start_xmit,
205 +       .ndo_change_mtu         = libipw_change_mtu,
206         .ndo_set_mac_address    = eth_mac_addr,
207         .ndo_validate_addr      = eth_validate_addr,
208  };
209 @@ -11586,9 +11587,6 @@ static int ipw_prom_alloc(struct ipw_pri
210         priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
211         priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
212  
213 -       priv->prom_net_dev->min_mtu = 68;
214 -       priv->prom_net_dev->max_mtu = LIBIPW_DATA_LEN;
215 -
216         priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
217         SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
218  
219 @@ -11621,6 +11619,7 @@ static const struct net_device_ops ipw_n
220         .ndo_set_rx_mode        = ipw_net_set_multicast_list,
221         .ndo_set_mac_address    = ipw_net_set_mac_address,
222         .ndo_start_xmit         = libipw_xmit,
223 +       .ndo_change_mtu         = libipw_change_mtu,
224         .ndo_validate_addr      = eth_validate_addr,
225  };
226  
227 @@ -11730,9 +11729,6 @@ static int ipw_pci_probe(struct pci_dev
228         net_dev->wireless_handlers = &ipw_wx_handler_def;
229         net_dev->ethtool_ops = &ipw_ethtool_ops;
230  
231 -       net_dev->min_mtu = 68;
232 -       net_dev->max_mtu = LIBIPW_DATA_LEN;
233 -
234         err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group);
235         if (err) {
236                 IPW_ERROR("failed to create sysfs device attributes\n");
237 --- a/drivers/net/wireless/intel/ipw2x00/libipw.h
238 +++ b/drivers/net/wireless/intel/ipw2x00/libipw.h
239 @@ -948,6 +948,7 @@ static inline int libipw_is_cck_rate(u8
240  /* libipw.c */
241  void free_libipw(struct net_device *dev, int monitor);
242  struct net_device *alloc_libipw(int sizeof_priv, int monitor);
243 +int libipw_change_mtu(struct net_device *dev, int new_mtu);
244  
245  void libipw_networks_age(struct libipw_device *ieee, unsigned long age_secs);
246  
247 --- a/drivers/net/wireless/intel/ipw2x00/libipw_module.c
248 +++ b/drivers/net/wireless/intel/ipw2x00/libipw_module.c
249 @@ -118,6 +118,15 @@ static void libipw_networks_initialize(s
250                               &ieee->network_free_list);
251  }
252  
253 +int libipw_change_mtu(struct net_device *dev, int new_mtu)
254 +{
255 +       if ((new_mtu < 68) || (new_mtu > LIBIPW_DATA_LEN))
256 +               return -EINVAL;
257 +       dev->mtu = new_mtu;
258 +       return 0;
259 +}
260 +EXPORT_SYMBOL(libipw_change_mtu);
261 +
262  struct net_device *alloc_libipw(int sizeof_priv, int monitor)
263  {
264         struct libipw_device *ieee;
265 --- a/drivers/net/wireless/intersil/hostap/hostap_main.c
266 +++ b/drivers/net/wireless/intersil/hostap/hostap_main.c
267 @@ -765,6 +765,16 @@ static void hostap_set_multicast_list(st
268  }
269  
270  
271 +static int prism2_change_mtu(struct net_device *dev, int new_mtu)
272 +{
273 +       if (new_mtu < PRISM2_MIN_MTU || new_mtu > PRISM2_MAX_MTU)
274 +               return -EINVAL;
275 +
276 +       dev->mtu = new_mtu;
277 +       return 0;
278 +}
279 +
280 +
281  static void prism2_tx_timeout(struct net_device *dev)
282  {
283         struct hostap_interface *iface;
284 @@ -803,6 +813,7 @@ static const struct net_device_ops hosta
285         .ndo_do_ioctl           = hostap_ioctl,
286         .ndo_set_mac_address    = prism2_set_mac_address,
287         .ndo_set_rx_mode        = hostap_set_multicast_list,
288 +       .ndo_change_mtu         = prism2_change_mtu,
289         .ndo_tx_timeout         = prism2_tx_timeout,
290         .ndo_validate_addr      = eth_validate_addr,
291  };
292 @@ -815,6 +826,7 @@ static const struct net_device_ops hosta
293         .ndo_do_ioctl           = hostap_ioctl,
294         .ndo_set_mac_address    = prism2_set_mac_address,
295         .ndo_set_rx_mode        = hostap_set_multicast_list,
296 +       .ndo_change_mtu         = prism2_change_mtu,
297         .ndo_tx_timeout         = prism2_tx_timeout,
298         .ndo_validate_addr      = eth_validate_addr,
299  };
300 @@ -827,6 +839,7 @@ static const struct net_device_ops hosta
301         .ndo_do_ioctl           = hostap_ioctl,
302         .ndo_set_mac_address    = prism2_set_mac_address,
303         .ndo_set_rx_mode        = hostap_set_multicast_list,
304 +       .ndo_change_mtu         = prism2_change_mtu,
305         .ndo_tx_timeout         = prism2_tx_timeout,
306         .ndo_validate_addr      = eth_validate_addr,
307  };
308 @@ -838,8 +851,6 @@ void hostap_setup_dev(struct net_device
309  
310         iface = netdev_priv(dev);
311         ether_setup(dev);
312 -       dev->min_mtu = PRISM2_MIN_MTU;
313 -       dev->max_mtu = PRISM2_MAX_MTU;
314         dev->priv_flags &= ~IFF_TX_SKB_SHARING;
315  
316         /* kernel callbacks */
317 --- a/drivers/net/wireless/intersil/orinoco/main.c
318 +++ b/drivers/net/wireless/intersil/orinoco/main.c
319 @@ -322,6 +322,9 @@ int orinoco_change_mtu(struct net_device
320  {
321         struct orinoco_private *priv = ndev_priv(dev);
322  
323 +       if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU))
324 +               return -EINVAL;
325 +
326         /* MTU + encapsulation + header length */
327         if ((new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
328              (priv->nicbuf_size - ETH_HLEN))
329 @@ -2285,9 +2288,6 @@ int orinoco_if_add(struct orinoco_privat
330         dev->base_addr = base_addr;
331         dev->irq = irq;
332  
333 -       dev->min_mtu = ORINOCO_MIN_MTU;
334 -       dev->max_mtu = ORINOCO_MAX_MTU;
335 -
336         SET_NETDEV_DEV(dev, priv->dev);
337         ret = register_netdev(dev);
338         if (ret)