009-revert-mtu-changes.patch 11 KB

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