711-3.3-gbe-fixes.patch 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. --- a/Embedded/src/GbE/kcompat.h
  2. +++ b/Embedded/src/GbE/kcompat.h
  3. @@ -590,6 +590,10 @@ static inline void _kc_synchronize_irq()
  4. #define ETHTOOL_OPS_COMPAT
  5. #endif
  6. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
  7. +#define HAVE_NETIF_MSG 1
  8. +#endif
  9. +
  10. #ifndef HAVE_NETIF_MSG
  11. #define HAVE_NETIF_MSG 1
  12. enum {
  13. --- a/Embedded/src/GbE/iegbe_main.c
  14. +++ b/Embedded/src/GbE/iegbe_main.c
  15. @@ -159,9 +159,9 @@ static void iegbe_smartspeed(struct iegb
  16. static inline int iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter,
  17. struct sk_buff *skb);
  18. -static void iegbe_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
  19. -static void iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
  20. -static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
  21. +static bool iegbe_vlan_used(struct iegbe_adapter *adapter);
  22. +static int iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
  23. +static int iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
  24. static void iegbe_restore_vlan(struct iegbe_adapter *adapter);
  25. static int iegbe_notify_reboot(struct notifier_block *,
  26. @@ -324,8 +324,8 @@ static void iegbe_update_mng_vlan(struct
  27. struct net_device *netdev = adapter->netdev;
  28. u16 vid = hw->mng_cookie.vlan_id;
  29. u16 old_vid = adapter->mng_vlan_id;
  30. - if (adapter->vlgrp) {
  31. - if (!vlan_group_get_device(adapter->vlgrp, vid)) {
  32. + if (iegbe_vlan_used(adapter)) {
  33. + if (!test_bit(old_vid, adapter->active_vlans)) {
  34. if (hw->mng_cookie.status &
  35. E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
  36. iegbe_vlan_rx_add_vid(netdev, vid);
  37. @@ -335,7 +335,7 @@ static void iegbe_update_mng_vlan(struct
  38. if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
  39. (vid != old_vid) &&
  40. - !vlan_group_get_device(adapter->vlgrp, old_vid))
  41. + !test_bit(old_vid, adapter->active_vlans))
  42. iegbe_vlan_rx_kill_vid(netdev, old_vid);
  43. } else
  44. adapter->mng_vlan_id = vid;
  45. @@ -736,7 +736,6 @@ static const struct net_device_ops iegbe
  46. .ndo_do_ioctl = iegbe_ioctl,
  47. .ndo_validate_addr = eth_validate_addr,
  48. - .ndo_vlan_rx_register = iegbe_vlan_rx_register,
  49. .ndo_vlan_rx_add_vid = iegbe_vlan_rx_add_vid,
  50. .ndo_vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid,
  51. #ifdef CONFIG_NET_POLL_CONTROLLER
  52. @@ -767,7 +766,6 @@ static int __devinit iegbe_probe(struct
  53. u16 eeprom_data = 0;
  54. u16 eeprom_apme_mask = E1000_EEPROM_APME;
  55. int bars;
  56. - DECLARE_MAC_BUF(mac);
  57. bars = pci_select_bars(pdev, IORESOURCE_MEM);
  58. err = pci_enable_device(pdev);
  59. @@ -1247,8 +1245,7 @@ static int iegbe_close(struct net_device
  60. if ((hw->mng_cookie.status &
  61. E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
  62. - !(adapter->vlgrp &&
  63. - vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
  64. + !test_bit(adapter->mng_vlan_id, adapter->active_vlans)) {
  65. iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
  66. }
  67. return 0;
  68. @@ -2163,11 +2160,13 @@ static void iegbe_set_rx_mode(struct net
  69. struct iegbe_hw *hw = &adapter->hw;
  70. struct netdev_hw_addr *ha;
  71. bool use_uc = false;
  72. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  73. struct dev_addr_list *mc_ptr;
  74. - u32 rctl;
  75. u32 hash_value;
  76. - int i, rar_entries = E1000_RAR_ENTRIES;
  77. int mta_reg_count = E1000_NUM_MTA_REGISTERS;
  78. +#endif
  79. + u32 rctl;
  80. + int i, rar_entries = E1000_RAR_ENTRIES;
  81. /* reserve RAR[14] for LAA over-write work-around */
  82. if (hw->mac_type == iegbe_82571)
  83. @@ -2220,6 +2219,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
  84. WARN_ON(i == rar_entries);
  85. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  86. mc_ptr = netdev->mc_list;
  87. for (; i < rar_entries; i++) {
  88. @@ -2247,6 +2247,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
  89. hash_value = iegbe_hash_mc_addr(hw, mc_ptr->da_addr);
  90. iegbe_mta_set(hw, hash_value);
  91. }
  92. +#endif
  93. if (hw->mac_type == iegbe_82542_rev2_0)
  94. iegbe_leave_82542_rst(adapter);
  95. @@ -2821,14 +2822,14 @@ static int iegbe_tx_map(struct iegbe_ada
  96. * Avoid terminating buffers within evenly-aligned
  97. * dwords. */
  98. if(unlikely(adapter->pcix_82544 &&
  99. - !((unsigned long)(frag->page+offset+size-1) & 4) &&
  100. + !((unsigned long)(frag->page.p+offset+size-1) & 4) &&
  101. size > 4))
  102. size -= 4;
  103. buffer_info->length = size;
  104. buffer_info->dma =
  105. pci_map_page(adapter->pdev,
  106. - frag->page,
  107. + frag->page.p,
  108. offset,
  109. size,
  110. PCI_DMA_TODEVICE);
  111. @@ -3131,7 +3132,7 @@ static int iegbe_xmit_frame(struct sk_bu
  112. }
  113. }
  114. - if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
  115. + if (unlikely(iegbe_vlan_used(adapter) && vlan_tx_tag_present(skb))) {
  116. tx_flags |= E1000_TX_FLAGS_VLAN;
  117. tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
  118. }
  119. @@ -3832,10 +3833,12 @@ static bool iegbe_clean_rx_irq(struct ie
  120. skb->protocol = eth_type_trans(skb, netdev);
  121. - if (unlikely(adapter->vlgrp &&
  122. + if (unlikely(iegbe_vlan_used(adapter) &&
  123. (status & E1000_RXD_STAT_VP))) {
  124. - vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
  125. - le16_to_cpu(rx_desc->special));
  126. + u16 vid;
  127. +
  128. + vid = le16_to_cpu(rx_desc->special);
  129. + __vlan_hwaccel_put_tag(skb, vid);
  130. } else {
  131. netif_receive_skb(skb);
  132. }
  133. @@ -3986,9 +3989,10 @@ copydone:
  134. cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
  135. adapter->rx_hdr_split++;
  136. - if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
  137. - vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
  138. - le16_to_cpu(rx_desc->wb.middle.vlan));
  139. + if(unlikely(iegbe_vlan_used(adapter) && (staterr & E1000_RXD_STAT_VP))) {
  140. + u16 vid;
  141. + vid = le16_to_cpu(rx_desc->wb.middle.vlan);
  142. + __vlan_hwaccel_put_tag(skb, vid);
  143. } else {
  144. netif_receive_skb(skb);
  145. }
  146. @@ -4496,17 +4500,25 @@ iegbe_io_write(struct iegbe_hw *hw, unsi
  147. outl(value, port);
  148. }
  149. -static void iegbe_vlan_rx_register(struct net_device *netdev,
  150. - struct vlan_group *grp)
  151. +static bool iegbe_vlan_used(struct iegbe_adapter *adapter)
  152. +{
  153. + u16 vid;
  154. +
  155. + for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
  156. + return true;
  157. +
  158. + return false;
  159. +}
  160. +
  161. +static void iegbe_vlan_mode(struct net_device *netdev, bool vlan_on)
  162. {
  163. struct iegbe_adapter *adapter = netdev_priv(netdev);
  164. uint32_t ctrl, rctl;
  165. if (!test_bit(__E1000_DOWN, &adapter->flags))
  166. iegbe_irq_disable(adapter);
  167. - adapter->vlgrp = grp;
  168. - if(grp) {
  169. + if(vlan_on) {
  170. /* enable VLAN tag insert/strip */
  171. ctrl = E1000_READ_REG(&adapter->hw, CTRL);
  172. ctrl |= E1000_CTRL_VME;
  173. @@ -4538,30 +4550,37 @@ static void iegbe_vlan_rx_register(struc
  174. iegbe_irq_enable(adapter);
  175. }
  176. -static void iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
  177. +static int iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
  178. {
  179. struct iegbe_adapter *adapter = netdev_priv(netdev);
  180. uint32_t vfta, index;
  181. if((adapter->hw.mng_cookie.status &
  182. E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
  183. (vid == adapter->mng_vlan_id)) {
  184. - return;
  185. + return 0;
  186. }
  187. +
  188. + if (!iegbe_vlan_used(adapter))
  189. + iegbe_vlan_mode(netdev, true);
  190. +
  191. /* add VID to filter table */
  192. index = (vid >> 0x5) & 0x7F;
  193. vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
  194. vfta |= (0x1 << (vid & 0x1F));
  195. iegbe_write_vfta(&adapter->hw, index, vfta);
  196. +
  197. + set_bit(vid, adapter->active_vlans);
  198. +
  199. + return 0;
  200. }
  201. -static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
  202. +static int iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
  203. {
  204. struct iegbe_adapter *adapter = netdev_priv(netdev);
  205. u32 vfta, index;
  206. if (!test_bit(__E1000_DOWN, &adapter->flags))
  207. iegbe_irq_disable(adapter);
  208. - vlan_group_set_device(adapter->vlgrp, vid, NULL);
  209. if (!test_bit(__E1000_DOWN, &adapter->flags))
  210. iegbe_irq_enable(adapter);
  211. @@ -4570,21 +4589,26 @@ static void iegbe_vlan_rx_kill_vid(struc
  212. vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
  213. vfta &= ~(0x1 << (vid & 0x1F));
  214. iegbe_write_vfta(&adapter->hw, index, vfta);
  215. +
  216. + clear_bit(vid, adapter->active_vlans);
  217. +
  218. + if (!iegbe_vlan_used(adapter))
  219. + iegbe_vlan_mode(netdev, false);
  220. +
  221. + return 0;
  222. }
  223. static void iegbe_restore_vlan(struct iegbe_adapter *adapter)
  224. {
  225. - iegbe_vlan_rx_register(adapter->netdev, adapter->vlgrp);
  226. -
  227. - if (adapter->vlgrp) {
  228. u16 vid;
  229. - for (vid = 0x0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
  230. - if (!vlan_group_get_device(adapter->vlgrp, vid))
  231. - continue;
  232. +
  233. + if (!iegbe_vlan_used(adapter))
  234. + return;
  235. +
  236. + iegbe_vlan_mode(adapter->netdev, true);
  237. + for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
  238. iegbe_vlan_rx_add_vid(adapter->netdev, vid);
  239. }
  240. - }
  241. -}
  242. int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, u16 spddplx)
  243. @@ -4864,10 +4888,11 @@ iegbe_resume(struct pci_dev *pdev)
  244. default:
  245. break;
  246. }
  247. -#endif
  248. return 0x0;
  249. }
  250. +#endif
  251. +
  252. #ifdef CONFIG_NET_POLL_CONTROLLER
  253. /*
  254. --- a/Embedded/src/GbE/iegbe_ethtool.c
  255. +++ b/Embedded/src/GbE/iegbe_ethtool.c
  256. @@ -327,6 +327,7 @@ iegbe_set_pauseparam(struct net_device *
  257. return 0;
  258. }
  259. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  260. static uint32_t
  261. iegbe_get_rx_csum(struct net_device *netdev)
  262. {
  263. @@ -392,6 +393,7 @@ iegbe_set_tso(struct net_device *netdev,
  264. return 0;
  265. }
  266. #endif /* NETIF_F_TSO */
  267. +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
  268. static uint32_t
  269. iegbe_get_msglevel(struct net_device *netdev)
  270. @@ -807,6 +809,7 @@ err_setup_rx:
  271. E1000_82542_##R : E1000_##R; \
  272. return 1; } }
  273. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  274. static int
  275. iegbe_reg_test(struct iegbe_adapter *adapter, uint64_t *data)
  276. {
  277. @@ -1710,6 +1713,7 @@ iegbe_diag_test(struct net_device *netde
  278. }
  279. msleep_interruptible(0xfa0);
  280. }
  281. +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
  282. static void
  283. iegbe_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
  284. @@ -1812,6 +1816,7 @@ iegbe_set_wol(struct net_device *netdev,
  285. /* bit defines for adapter->led_status */
  286. #define E1000_LED_ON 0
  287. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  288. static void
  289. iegbe_led_blink_callback(unsigned long data)
  290. {
  291. @@ -1864,6 +1869,7 @@ iegbe_phys_id(struct net_device *netdev,
  292. return 0;
  293. }
  294. +#endif
  295. static int
  296. iegbe_nway_reset(struct net_device *netdev)
  297. @@ -1876,11 +1882,13 @@ iegbe_nway_reset(struct net_device *netd
  298. return 0;
  299. }
  300. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  301. static int
  302. iegbe_get_stats_count(struct net_device *netdev)
  303. {
  304. return E1000_STATS_LEN;
  305. }
  306. +#endif
  307. static void
  308. iegbe_get_ethtool_stats(struct net_device *netdev,
  309. @@ -1936,6 +1944,8 @@ struct ethtool_ops iegbe_ethtool_ops = {
  310. .set_ringparam = iegbe_set_ringparam,
  311. .get_pauseparam = iegbe_get_pauseparam,
  312. .set_pauseparam = iegbe_set_pauseparam,
  313. +
  314. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
  315. .get_rx_csum = iegbe_get_rx_csum,
  316. .set_rx_csum = iegbe_set_rx_csum,
  317. .get_tx_csum = iegbe_get_tx_csum,
  318. @@ -1946,11 +1956,13 @@ struct ethtool_ops iegbe_ethtool_ops = {
  319. .get_tso = ethtool_op_get_tso,
  320. .set_tso = iegbe_set_tso,
  321. #endif
  322. +
  323. .self_test_count = iegbe_diag_test_count,
  324. .self_test = iegbe_diag_test,
  325. - .get_strings = iegbe_get_strings,
  326. .phys_id = iegbe_phys_id,
  327. .get_stats_count = iegbe_get_stats_count,
  328. +#endif
  329. + .get_strings = iegbe_get_strings,
  330. .get_ethtool_stats = iegbe_get_ethtool_stats,
  331. };
  332. --- a/Embedded/src/GbE/gcu_main.c
  333. +++ b/Embedded/src/GbE/gcu_main.c
  334. @@ -93,7 +93,7 @@ static struct pci_driver gcu_driver = {
  335. };
  336. static struct gcu_adapter *global_adapter = 0;
  337. -static spinlock_t global_adapter_spinlock = SPIN_LOCK_UNLOCKED;
  338. +static DEFINE_SPINLOCK(global_adapter_spinlock);
  339. static unsigned long g_intflags = 0;
  340. MODULE_AUTHOR("Intel(R) Corporation");
  341. --- a/Embedded/src/GbE/iegbe.h
  342. +++ b/Embedded/src/GbE/iegbe.h
  343. @@ -257,7 +257,7 @@ struct iegbe_adapter {
  344. struct timer_list tx_fifo_stall_timer;
  345. struct timer_list watchdog_timer;
  346. struct timer_list phy_info_timer;
  347. - struct vlan_group *vlgrp;
  348. + unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
  349. uint16_t mng_vlan_id;
  350. uint32_t bd_number;
  351. uint32_t rx_buffer_len;