History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next

Pull networking changes from David Miller: 1) GRE now works over ipv6, from Dmitry Kozlov. 2) Make SCTP more network namespace aware, from Eric Biederman. 3) TEAM driver now works with non-ethernet devices, from Jiri Pirko. 4) Make openvswitch network namespace aware, from Pravin B Shelar. 5) IPV6 NAT implementation, from Patrick McHardy. 6) Server side support for TCP Fast Open, from Jerry Chu and others. 7) Packet BPF filter supports MOD and XOR, from Eric Dumazet and Daniel Borkmann. 8) Increate the loopback default MTU to 64K, from Eric Dumazet. 9) Use a per-task rather than per-socket page fragment allocator for outgoing networking traffic. This benefits processes that have very many mostly idle sockets, which is quite common. From Eric Dumazet. 10) Use up to 32K for page fragment allocations, with fallbacks to smaller sizes when higher order page allocations fail. Benefits are a) less segments for driver to process b) less calls to page allocator c) less waste of space. From Eric Dumazet. 11) Allow GRO to be used on GRE tunnels, from Eric Dumazet. 12) VXLAN device driver, one way to handle VLAN issues such as the limitation of 4096 VLAN IDs yet still have some level of isolation. From Stephen Hemminger. 13) As usual there is a large boatload of driver changes, with the scale perhaps tilted towards the wireless side this time around. Fix up various fairly trivial conflicts, mostly caused by the user namespace changes. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1012 commits) hyperv: Add buffer for extended info after the RNDIS response message. hyperv: Report actual status in receive completion packet hyperv: Remove extra allocated space for recv_pkt_list elements hyperv: Fix page buffer handling in rndis_filter_send_request() hyperv: Fix the missing return value in rndis_filter_set_packet_filter() hyperv: Fix the max_xfer_size in RNDIS initialization vxlan: put UDP socket in correct namespace vxlan: Depend on CONFIG_INET sfc: Fix the reported priorities of different filter types sfc: Remove EFX_FILTER_FLAG_RX_OVERRIDE_IP sfc: Fix loopback self-test with separate_tx_channels=1 sfc: Fix MCDI structure field lookup sfc: Add parentheses around use of bitfield macro arguments sfc: Fix null function pointer in efx_sriov_channel_type vxlan: virtual extensible lan igmp: export symbol ip_mc_leave_group netlink: add attributes to fdb interface tg3: unconditionally select HWMON support when tg3 is enabled. Revert "net: ti cpsw ethernet: allow reading phy interface mode from DT" gre: fix sparse warning ...

Linus Torvalds committed 14 years ago

Commit aecdc332 parents a20acf9 a3a6cab967 files · +42705 −21877Browse files

Unified · Split

967 files
  1. Documentation/ABI/testing/sysfs-ptp +5 −1
  2. Documentation/devicetree/bindings/net/can/c_can.txt +49 −0
  3. Documentation/devicetree/bindings/net/cpsw.txt +109 −0
  4. Documentation/devicetree/bindings/net/davinci-mdio.txt +33 −0
  5. Documentation/devicetree/bindings/net/mdio-mux-mmioreg.txt +75 −0
  6. Documentation/filesystems/nfs/nfsroot.txt +9 −1
  7. Documentation/infiniband/ipoib.txt +3 −0
  8. Documentation/networking/batman-adv.txt +4 −3
  9. Documentation/networking/bonding.txt +25 −5
  10. Documentation/networking/ip-sysctl.txt +28 −9
  11. Documentation/networking/stmmac.txt +0 −5
  12. Documentation/networking/vxlan.txt +47 −0
  13. MAINTAINERS +1 −0
  14. arch/m68k/configs/amiga_defconfig +0 −1
  15. arch/m68k/configs/apollo_defconfig +0 −1
  16. arch/m68k/configs/atari_defconfig +0 −1
  17. arch/m68k/configs/bvme6000_defconfig +0 −1
  18. arch/m68k/configs/hp300_defconfig +0 −1
  19. arch/m68k/configs/mac_defconfig +0 −1
  20. arch/m68k/configs/multi_defconfig +0 −1
  21. arch/m68k/configs/mvme147_defconfig +0 −1
  22. arch/m68k/configs/mvme16x_defconfig +0 −1
  23. arch/m68k/configs/q40_defconfig +0 −1
  24. arch/m68k/configs/sun3_defconfig +0 −1
  25. arch/m68k/configs/sun3x_defconfig +0 −1
  26. arch/mips/configs/ar7_defconfig +0 −1
  27. arch/mips/configs/bcm47xx_defconfig +0 −1
  28. arch/mips/configs/ip22_defconfig +0 −1
  29. arch/mips/configs/jazz_defconfig +0 −1
  30. arch/mips/configs/malta_defconfig +0 −1
  31. arch/mips/configs/markeins_defconfig +0 −1
  32. arch/mips/configs/nlm_xlp_defconfig +0 −1
  33. arch/mips/configs/nlm_xlr_defconfig +0 −1
  34. arch/mips/configs/rm200_defconfig +0 −1
  35. arch/powerpc/configs/pmac32_defconfig +0 −1
  36. arch/powerpc/configs/ppc64_defconfig +0 −1
  37. arch/powerpc/configs/ppc64e_defconfig +0 −1
  38. arch/powerpc/configs/ppc6xx_defconfig +0 −1
  39. arch/sparc/net/bpf_jit_comp.c +4 −0
  40. arch/tile/configs/tilegx_defconfig +0 −1
  41. arch/tile/configs/tilepro_defconfig +0 −1
  42. arch/x86/net/bpf_jit_comp.c +34 −0
  43. crypto/crypto_user.c +3 −4
  44. drivers/Makefile +0 −1
  45. drivers/bcma/Kconfig +2 −2
  46. drivers/bcma/bcma_private.h +2 −0
  47. drivers/bcma/core.c +1 −1
  48. drivers/bcma/driver_chipcommon_nflash.c +25 −3
  49. drivers/bcma/driver_chipcommon_pmu.c +6 −3
  50. drivers/bcma/driver_chipcommon_sflash.c +120 −3
  51. drivers/bcma/driver_pci.c +3 −3
  52. drivers/bcma/driver_pci_host.c +4 −4
  53. drivers/bcma/host_pci.c +7 −5
  54. drivers/bcma/host_soc.c +1 −1
  55. drivers/bcma/main.c +27 −0
  56. drivers/bcma/sprom.c +2 −0
  57. drivers/bluetooth/bcm203x.c +1 −7
  58. drivers/bluetooth/bfusb.c +4 −8
  59. drivers/bluetooth/bluecard_cs.c +2 −5
  60. drivers/bluetooth/bpa10x.c +2 −6
  61. drivers/bluetooth/bt3c_cs.c +1 −4
  62. drivers/bluetooth/btmrvl_sdio.c +5 −13
  63. drivers/bluetooth/btsdio.c +2 −6
  64. drivers/bluetooth/btuart_cs.c +2 −5
  65. drivers/bluetooth/btusb.c +5 −11
  66. drivers/bluetooth/btwilink.c +3 −21
  67. drivers/bluetooth/dtl1_cs.c +1 −2
  68. drivers/bluetooth/hci_ldisc.c +1 −1
  69. drivers/bluetooth/hci_ll.c +1 −1
  70. drivers/bluetooth/hci_vhci.c +1 −1
  71. drivers/connector/connector.c +1 −2
  72. drivers/infiniband/core/netlink.c +1 −1
  73. drivers/infiniband/hw/cxgb4/qp.c +1 −1
  74. drivers/infiniband/ulp/ipoib/Makefile +2 −1
  75. drivers/infiniband/ulp/ipoib/ipoib.h +16 −0
  76. drivers/infiniband/ulp/ipoib/ipoib_cm.c +24 −10
  77. drivers/infiniband/ulp/ipoib/ipoib_main.c +31 −10
  78. drivers/infiniband/ulp/ipoib/ipoib_netlink.c +172 −0
  79. drivers/infiniband/ulp/ipoib/ipoib_vlan.c +70 −54
  80. drivers/isdn/gigaset/common.c +0 −1
  81. drivers/net/Kconfig +15 −2
  82. drivers/net/Makefile +2 −0
  83. drivers/net/bonding/bond_main.c +93 −47
  84. drivers/net/can/c_can/c_can.c +125 −5
  85. drivers/net/can/c_can/c_can.h +12 −2
  86. drivers/net/can/c_can/c_can_pci.c +3 −3
  87. drivers/net/can/c_can/c_can_platform.c +108 −15
  88. drivers/net/can/flexcan.c +19 −10
  89. drivers/net/can/mscan/mpc5xxx_can.c +2 −2
  90. drivers/net/can/sja1000/sja1000.c +24 −7
  91. drivers/net/can/usb/peak_usb/pcan_usb_core.c +4 −4
  92. drivers/net/can/usb/peak_usb/pcan_usb_core.h +1 −1
  93. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +4 −4
  94. drivers/net/ethernet/Kconfig +0 −9
  95. drivers/net/ethernet/Makefile +0 −1
  96. drivers/net/ethernet/broadcom/Kconfig +1 −0
  97. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 −2
  98. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +16 −8
  99. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +13 −3
  100. drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +4 −8
  101. drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +32 −26
  102. drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h +0 −3
  103. drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +81 −28
  104. drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +1 −1
  105. drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +828 −873
  106. drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +5 −2
  107. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +22 −12
  108. drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +11 −3
  109. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +2 −3
  110. drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +30 −5
  111. drivers/net/ethernet/broadcom/cnic.c +86 −30
  112. drivers/net/ethernet/broadcom/cnic.h +5 −0
  113. drivers/net/ethernet/broadcom/cnic_defs.h +1 −1
  114. drivers/net/ethernet/broadcom/cnic_if.h +2 −2
  115. drivers/net/ethernet/broadcom/tg3.c +356 −178
  116. drivers/net/ethernet/broadcom/tg3.h +8 −1
  117. drivers/net/ethernet/brocade/bna/bnad.c +1 −0
  118. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +46 −5
  119. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +838 −116
  120. drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +2 −0
  121. drivers/net/ethernet/chelsio/cxgb4/sge.c +277 −64
  122. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +705 −29
  123. drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +80 −0
  124. drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +141 −44
  125. drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +77 −20
  126. drivers/net/ethernet/chelsio/cxgb4vf/sge.c +3 −2
  127. drivers/net/ethernet/emulex/benet/be.h +1 −1
  128. drivers/net/ethernet/emulex/benet/be_cmds.c +39 −16
  129. drivers/net/ethernet/emulex/benet/be_cmds.h +3 −3
  130. drivers/net/ethernet/emulex/benet/be_ethtool.c +12 −45
  131. drivers/net/ethernet/emulex/benet/be_main.c +58 −38
  132. drivers/net/ethernet/freescale/Kconfig +7 −0
  133. drivers/net/ethernet/freescale/Makefile +1 −0
  134. drivers/net/ethernet/freescale/fsl_pq_mdio.c +292 −257
  135. drivers/net/ethernet/freescale/fsl_pq_mdio.h +0 −52
  136. drivers/net/ethernet/freescale/gianfar.c +10 −2
  137. drivers/net/ethernet/freescale/gianfar.h +10 −1
  138. drivers/net/ethernet/freescale/gianfar_ptp.c +1 −1
  139. drivers/net/ethernet/freescale/ucc_geth.c +0 −1
  140. drivers/net/ethernet/freescale/xgmac_mdio.c +274 −0
  141. drivers/net/ethernet/i825xx/Kconfig +1 −1
  142. drivers/net/ethernet/i825xx/znet.c +2 −2
  143. drivers/net/ethernet/intel/e1000/e1000_ethtool.c +39 −0
  144. drivers/net/ethernet/intel/e1000/e1000_main.c +14 −0
  145. drivers/net/ethernet/intel/e1000e/82571.c +2 −2
  146. drivers/net/ethernet/intel/e1000e/ethtool.c +41 −3
  147. drivers/net/ethernet/intel/e1000e/netdev.c +13 −6
  148. drivers/net/ethernet/intel/e1000e/phy.c +29 −2
  149. drivers/net/ethernet/intel/igb/e1000_82575.c +13 −4
  150. drivers/net/ethernet/intel/igb/e1000_defines.h +10 −1
  151. drivers/net/ethernet/intel/igb/e1000_phy.c +27 −2
  152. drivers/net/ethernet/intel/igb/e1000_phy.h +3 −2
  153. drivers/net/ethernet/intel/igb/e1000_regs.h +3 −0
  154. drivers/net/ethernet/intel/igb/igb.h +24 −17
  155. drivers/net/ethernet/intel/igb/igb_ethtool.c +125 −73
  156. drivers/net/ethernet/intel/igb/igb_main.c +198 −513
  157. drivers/net/ethernet/intel/igb/igb_ptp.c +561 −116
  158. drivers/net/ethernet/intel/ixgbe/Makefile +1 −1
  159. drivers/net/ethernet/intel/ixgbe/ixgbe.h +28 −7
  160. drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c +300 −0
  161. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +310 −263
  162. drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +2 −1
  163. drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +64 −41
  164. drivers/net/ethernet/intel/ixgbevf/defines.h +1 −0
  165. drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +8 −1
  166. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +194 −78
  167. drivers/net/ethernet/intel/ixgbevf/mbx.c +11 −4
  168. drivers/net/ethernet/intel/ixgbevf/mbx.h +19 −2
  169. drivers/net/ethernet/intel/ixgbevf/vf.c +108 −14
  170. drivers/net/ethernet/intel/ixgbevf/vf.h +4 −0
  171. drivers/net/ethernet/mellanox/mlx4/en_tx.c +0 −4
  172. drivers/net/ethernet/mipsnet.c +0 −345
  173. drivers/net/ethernet/nvidia/forcedeth.c +13 −4
  174. drivers/net/ethernet/realtek/r8169.c +3 −1
  175. drivers/net/ethernet/sfc/Kconfig +7 −0
  176. drivers/net/ethernet/sfc/Makefile +1 −0
  177. drivers/net/ethernet/sfc/bitfield.h +11 −11
  178. drivers/net/ethernet/sfc/efx.c +148 −102
  179. drivers/net/ethernet/sfc/efx.h +1 −0
  180. drivers/net/ethernet/sfc/ethtool.c +6 −10
  181. drivers/net/ethernet/sfc/falcon_boards.c +1 −1
  182. drivers/net/ethernet/sfc/filter.c +53 −55
  183. drivers/net/ethernet/sfc/filter.h +1 −6
  184. drivers/net/ethernet/sfc/mcdi.c +39 −10
  185. drivers/net/ethernet/sfc/mcdi.h +10 −2
  186. drivers/net/ethernet/sfc/mcdi_pcol.h +15 −14
  187. drivers/net/ethernet/sfc/mtd.c +5 −2
  188. drivers/net/ethernet/sfc/net_driver.h +52 −26
  189. drivers/net/ethernet/sfc/nic.c +4 −2
  190. drivers/net/ethernet/sfc/nic.h +36 −0
  191. drivers/net/ethernet/sfc/ptp.c +1484 −0
  192. drivers/net/ethernet/sfc/rx.c +16 −4
  193. drivers/net/ethernet/sfc/selftest.c +2 −1
  194. drivers/net/ethernet/sfc/siena.c +1 −0
  195. drivers/net/ethernet/sfc/siena_sriov.c +8 −0
  196. drivers/net/ethernet/sfc/tx.c +251 −376
  197. drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +6 −5
  198. drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +0 −1
  199. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +8 −31
  200. drivers/net/ethernet/sun/sunbmac.c +0 −1
  201. drivers/net/ethernet/ti/Kconfig +2 −2
  202. drivers/net/ethernet/ti/cpsw.c +173 −6
  203. drivers/net/ethernet/ti/davinci_mdio.c +37 −4
  204. drivers/net/ethernet/tundra/tsi108_eth.c +0 −1
  205. drivers/net/ethernet/wiznet/w5100.c +1 −2
  206. drivers/net/ethernet/wiznet/w5300.c +1 −2
  207. drivers/net/hyperv/hyperv_net.h +2 −2
  208. drivers/net/hyperv/netvsc.c +13 −9
  209. drivers/net/hyperv/netvsc_drv.c +3 −1
  210. drivers/net/hyperv/rndis_filter.c +45 −15
  211. drivers/net/ieee802154/Kconfig +11 −0
  212. drivers/net/ieee802154/Makefile +1 −0
  213. drivers/net/ieee802154/at86rf230.c +1 −11
  214. drivers/net/ieee802154/fakehard.c +0 −1
  215. drivers/net/ieee802154/fakelb.c +0 −0
  216. drivers/net/ieee802154/mrf24j40.c +767 −0
  217. drivers/net/loopback.c +2 −1
  218. drivers/net/macvlan.c +3 −3
  219. drivers/net/phy/Kconfig +13 −0
  220. drivers/net/phy/Makefile +1 −0
  221. drivers/net/phy/dp83640.c +1 −1
  222. drivers/net/phy/lxt.c +127 −0
  223. drivers/net/phy/mdio-gpio.c +40 −92
  224. drivers/net/phy/mdio-mux-mmioreg.c +171 −0
  225. drivers/net/phy/phy.c +7 −67
  226. drivers/net/ppp/ppp_generic.c +48 −10
  227. drivers/net/team/Kconfig +2 −2
  228. drivers/net/team/team.c +295 −47
  229. drivers/net/team/team_mode_broadcast.c +4 −4
  230. drivers/net/team/team_mode_roundrobin.c +4 −4
  231. drivers/net/usb/asix_devices.c +24 −16
  232. drivers/net/usb/catc.c +32 −23
  233. drivers/net/usb/cx82310_eth.c +1 −10
  234. drivers/net/usb/gl620a.c +7 −3
  235. drivers/net/usb/kaweth.c +67 −67
  236. drivers/net/usb/net1080.c +23 −28
  237. drivers/net/usb/qmi_wwan.c +17 −30
  238. drivers/net/usb/rtl8150.c +3 −3
  239. drivers/net/usb/sierra_net.c +8 −17
  240. drivers/net/usb/smsc75xx.c +237 −3
  241. drivers/net/usb/smsc95xx.c +355 −205
  242. drivers/net/usb/smsc95xx.h +11 −1
  243. drivers/net/veth.c +3 −0
  244. drivers/net/virtio_net.c +1 −1
  245. drivers/net/vxlan.c +1219 −0
  246. drivers/net/wimax/i2400m/driver.c +1 −2
  247. drivers/net/wireless/adm8211.c +3 −1
  248. drivers/net/wireless/airo.c +2 −5
  249. drivers/net/wireless/at76c50x-usb.c +15 −43
  250. drivers/net/wireless/ath/ath.h +1 −0
  251. drivers/net/wireless/ath/ath5k/ath5k.h +1 −1
  252. drivers/net/wireless/ath/ath5k/base.c +4 −2
  253. drivers/net/wireless/ath/ath5k/mac80211-ops.c +8 −4
  254. drivers/net/wireless/ath/ath5k/phy.c +34 −11
  255. drivers/net/wireless/ath/ath6kl/cfg80211.c +2 −2
  256. drivers/net/wireless/ath/ath6kl/cfg80211.h +1 −1
  257. drivers/net/wireless/ath/ath9k/ani.c +1 −1
  258. drivers/net/wireless/ath/ath9k/antenna.c +69 −48
  259. drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +175 −113
  260. drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +2 −1
  261. drivers/net/wireless/ath/ath9k/ar9003_hw.c +52 −5
  262. drivers/net/wireless/ath/ath9k/ar9003_mac.c +19 −2
  263. drivers/net/wireless/ath/ath9k/ar9003_mci.c +26 −17
  264. drivers/net/wireless/ath/ath9k/ar9003_mci.h +7 −7
  265. drivers/net/wireless/ath/ath9k/ar9003_phy.c +156 −41
  266. drivers/net/wireless/ath/ath9k/ar9003_phy.h +68 −27
  267. drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h +1 −1
  268. drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h +1231 −0
  269. drivers/net/wireless/ath/ath9k/ath9k.h +8 −4
  270. drivers/net/wireless/ath/ath9k/btcoex.c +34 −31
  271. drivers/net/wireless/ath/ath9k/btcoex.h +2 −1
  272. drivers/net/wireless/ath/ath9k/debug.c +56 −2
  273. drivers/net/wireless/ath/ath9k/debug.h +3 −1
  274. drivers/net/wireless/ath/ath9k/eeprom.h +2 −1
  275. drivers/net/wireless/ath/ath9k/gpio.c +45 −27
  276. drivers/net/wireless/ath/ath9k/hif_usb.c +25 −13
  277. drivers/net/wireless/ath/ath9k/hif_usb.h +3 −1
  278. drivers/net/wireless/ath/ath9k/htc.h +1 −0
  279. drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +1 −1
  280. drivers/net/wireless/ath/ath9k/htc_drv_gpio.c +11 −2
  281. drivers/net/wireless/ath/ath9k/htc_drv_init.c +5 −0
  282. drivers/net/wireless/ath/ath9k/htc_drv_main.c +39 −12
  283. drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +1 −1
  284. drivers/net/wireless/ath/ath9k/hw-ops.h +7 −0
  285. drivers/net/wireless/ath/ath9k/hw.c +40 −17
  286. drivers/net/wireless/ath/ath9k/hw.h +3 −1
  287. drivers/net/wireless/ath/ath9k/init.c +14 −1
  288. drivers/net/wireless/ath/ath9k/main.c +16 −50
  289. drivers/net/wireless/ath/ath9k/mci.c +64 −30
  290. drivers/net/wireless/ath/ath9k/pci.c +3 −1
  291. drivers/net/wireless/ath/ath9k/rc.c +347 −472
  292. drivers/net/wireless/ath/ath9k/rc.h +0 −4
  293. drivers/net/wireless/ath/ath9k/recv.c +2 −2
  294. drivers/net/wireless/ath/ath9k/reg.h +9 −0
  295. drivers/net/wireless/ath/ath9k/wow.c +1 −1
  296. drivers/net/wireless/ath/ath9k/xmit.c +10 −5
  297. drivers/net/wireless/ath/carl9170/carl9170.h +4 −1
  298. drivers/net/wireless/ath/carl9170/fw.c +1 −0
  299. drivers/net/wireless/ath/carl9170/mac.c +3 −2
  300. drivers/net/wireless/ath/carl9170/main.c +5 −1
  301. drivers/net/wireless/ath/carl9170/rx.c +12 −4
  302. drivers/net/wireless/ath/carl9170/tx.c +8 −8
  303. drivers/net/wireless/b43/Makefile +1 −0
  304. drivers/net/wireless/b43/b43.h +7 −3
  305. drivers/net/wireless/b43/main.c +42 −12
  306. drivers/net/wireless/b43/phy_common.c +16 −1
  307. drivers/net/wireless/b43/phy_common.h +6 −0
  308. drivers/net/wireless/b43/phy_n.c +629 −39
  309. drivers/net/wireless/b43/phy_n.h +1 −0
  310. drivers/net/wireless/b43/radio_2057.c +141 −0
  311. drivers/net/wireless/b43/radio_2057.h +430 −0
  312. drivers/net/wireless/b43/tables_nphy.c +75 −0
  313. drivers/net/wireless/b43/tables_nphy.h +10 −0
  314. drivers/net/wireless/b43legacy/main.c +4 −1
  315. drivers/net/wireless/brcm80211/Kconfig +8 −0
  316. drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +33 −6
  317. drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +2 −25
  318. drivers/net/wireless/brcm80211/brcmfmac/dhd.h +57 −5
  319. drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +1 −1
  320. drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +61 −12
  321. drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h +2 −0
  322. drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +34 −31
  323. drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +403 −644
  324. drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +17 −0
  325. drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h +2 −0
  326. drivers/net/wireless/brcm80211/brcmfmac/usb.c +164 −189
  327. drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +2551 −874
  328. drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +222 −74
  329. drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +0 −3
  330. drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +11 −4
  331. drivers/net/wireless/brcm80211/brcmsmac/main.c +4 −9
  332. drivers/net/wireless/brcm80211/include/brcm_hw_ids.h +1 −0
  333. drivers/net/wireless/brcm80211/include/brcmu_wifi.h +0 −5
  334. drivers/net/wireless/hostap/hostap_info.c +2 −2
  335. drivers/net/wireless/hostap/hostap_ioctl.c +5 −10
  336. drivers/net/wireless/hostap/hostap_main.c +1 −1
  337. drivers/net/wireless/ipw2x00/ipw2100.c +2 −9
  338. drivers/net/wireless/ipw2x00/ipw2200.c +2 −9
  339. drivers/net/wireless/ipw2x00/libipw_wx.c +1 −1
  340. drivers/net/wireless/iwlegacy/3945-mac.c +8 −4
  341. drivers/net/wireless/iwlegacy/4965-mac.c +15 −11
  342. drivers/net/wireless/iwlegacy/4965.h +6 −2
  343. drivers/net/wireless/iwlegacy/common.c +5 −14
  344. drivers/net/wireless/iwlegacy/common.h +0 −2
  345. drivers/net/wireless/iwlwifi/dvm/agn.h +6 −7
  346. drivers/net/wireless/iwlwifi/dvm/commands.h +2 −1
  347. drivers/net/wireless/iwlwifi/dvm/debugfs.c +28 −28
  348. drivers/net/wireless/iwlwifi/dvm/dev.h +1 −0
  349. drivers/net/wireless/iwlwifi/dvm/mac80211.c +5 −3
  350. drivers/net/wireless/iwlwifi/dvm/main.c +16 −8
  351. drivers/net/wireless/iwlwifi/dvm/rx.c +11 −0
  352. drivers/net/wireless/iwlwifi/dvm/scan.c +2 −2
  353. drivers/net/wireless/iwlwifi/dvm/sta.c +5 −4
  354. drivers/net/wireless/iwlwifi/dvm/tx.c +10 −8
  355. drivers/net/wireless/iwlwifi/dvm/ucode.c +2 −2
  356. drivers/net/wireless/iwlwifi/iwl-devtrace.h +21 −13
  357. drivers/net/wireless/iwlwifi/iwl-drv.c +133 −34
  358. drivers/net/wireless/iwlwifi/iwl-drv.h +3 −3
  359. drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h +0 −2
  360. drivers/net/wireless/iwlwifi/iwl-fw.h +1 −2
  361. drivers/net/wireless/iwlwifi/iwl-op-mode.h +2 −1
  362. drivers/net/wireless/iwlwifi/iwl-trans.h +10 −2
  363. drivers/net/wireless/iwlwifi/pcie/drv.c +6 −13
  364. drivers/net/wireless/iwlwifi/pcie/internal.h +2 −1
  365. drivers/net/wireless/iwlwifi/pcie/rx.c +57 −34
  366. drivers/net/wireless/iwlwifi/pcie/trans.c +71 −41
  367. drivers/net/wireless/iwlwifi/pcie/tx.c +23 −28
  368. drivers/net/wireless/libertas/cmd.c +16 −0
  369. drivers/net/wireless/libertas/cmd.h +1 −0
  370. drivers/net/wireless/libertas/main.c +3 −1
  371. drivers/net/wireless/libertas_tf/main.c +3 −1
  372. drivers/net/wireless/mac80211_hwsim.c +30 −29
  373. drivers/net/wireless/mwifiex/11n.c +26 −38
  374. drivers/net/wireless/mwifiex/11n.h +15 −5
  375. drivers/net/wireless/mwifiex/11n_aggr.c +5 −9
  376. drivers/net/wireless/mwifiex/11n_rxreorder.c +97 −18
  377. drivers/net/wireless/mwifiex/11n_rxreorder.h +10 −0
  378. drivers/net/wireless/mwifiex/Makefile +2 −0
  379. drivers/net/wireless/mwifiex/cfg80211.c +432 −28
  380. drivers/net/wireless/mwifiex/cmdevt.c +6 −1
  381. drivers/net/wireless/mwifiex/decl.h +8 −1
  382. drivers/net/wireless/mwifiex/fw.h +88 −5
  383. drivers/net/wireless/mwifiex/ie.c +55 −33
  384. drivers/net/wireless/mwifiex/init.c +80 −46
  385. drivers/net/wireless/mwifiex/ioctl.h +11 −3
  386. drivers/net/wireless/mwifiex/main.c +29 −10
  387. drivers/net/wireless/mwifiex/main.h +79 −8
  388. drivers/net/wireless/mwifiex/scan.c +7 −8
  389. drivers/net/wireless/mwifiex/sta_cmd.c +105 −45
  390. drivers/net/wireless/mwifiex/sta_cmdresp.c +55 −22
  391. drivers/net/wireless/mwifiex/sta_event.c +23 −51
  392. drivers/net/wireless/mwifiex/sta_ioctl.c +121 −3
  393. drivers/net/wireless/mwifiex/sta_rx.c +24 −20
  394. drivers/net/wireless/mwifiex/sta_tx.c +11 −1
  395. drivers/net/wireless/mwifiex/txrx.c +10 −1
  396. drivers/net/wireless/mwifiex/uap_cmd.c +61 −1
  397. drivers/net/wireless/mwifiex/uap_event.c +290 −0
  398. drivers/net/wireless/mwifiex/uap_txrx.c +340 −0
  399. drivers/net/wireless/mwifiex/util.c +40 −0
  400. drivers/net/wireless/mwifiex/wmm.c +63 −14
  401. drivers/net/wireless/mwl8k.c +10 −7
  402. drivers/net/wireless/orinoco/wext.c +3 −4
  403. drivers/net/wireless/p54/eeprom.c +84 −24
  404. drivers/net/wireless/p54/eeprom.h +12 −0
  405. drivers/net/wireless/p54/lmac.h +3 −1
  406. drivers/net/wireless/p54/main.c +14 −1
  407. drivers/net/wireless/p54/p54pci.c +62 −26
  408. drivers/net/wireless/p54/p54pci.h +1 −0
  409. drivers/net/wireless/p54/txrx.c +9 −6
  410. drivers/net/wireless/rndis_wlan.c +0 −3
  411. drivers/net/wireless/rt2x00/rt2400pci.c +2 −3
  412. drivers/net/wireless/rt2x00/rt2400pci.h +18 −9
  413. drivers/net/wireless/rt2x00/rt2500pci.c +1 −2
  414. drivers/net/wireless/rt2x00/rt2500pci.h +10 −8
  415. drivers/net/wireless/rt2x00/rt2500usb.c +2 −3
  416. drivers/net/wireless/rt2x00/rt2500usb.h +18 −9
  417. drivers/net/wireless/rt2x00/rt2800.h +32 −20
  418. drivers/net/wireless/rt2x00/rt2800lib.c +326 −71
  419. drivers/net/wireless/rt2x00/rt2800lib.h +19 −3
  420. drivers/net/wireless/rt2x00/rt2800pci.c +9 −74
  421. drivers/net/wireless/rt2x00/rt2800usb.c +11 −51
  422. drivers/net/wireless/rt2x00/rt2x00.h +18 −2
  423. drivers/net/wireless/rt2x00/rt2x00dev.c +34 −1
  424. drivers/net/wireless/rt2x00/rt2x00mac.c +3 −41
  425. drivers/net/wireless/rt2x00/rt2x00queue.c +11 −9
  426. drivers/net/wireless/rt2x00/rt61pci.c +6 −7
  427. drivers/net/wireless/rt2x00/rt61pci.h +14 −14
  428. drivers/net/wireless/rt2x00/rt73usb.c +2 −3
  429. drivers/net/wireless/rt2x00/rt73usb.h +18 −16
  430. drivers/net/wireless/rtl818x/rtl8180/dev.c +4 −2
  431. drivers/net/wireless/rtl818x/rtl8187/dev.c +4 −2
  432. drivers/net/wireless/rtlwifi/Kconfig +4 −4
  433. drivers/net/wireless/rtlwifi/base.c +1 −2
  434. drivers/net/wireless/rtlwifi/core.c +5 −3
  435. drivers/net/wireless/rtlwifi/pci.c +8 −8
  436. drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +18 −23
  437. drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c +1 −2
  438. drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +2 −2
  439. drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +1 −1
  440. drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +3 −2
  441. drivers/net/wireless/rtlwifi/rtl8192ce/trx.h +1 −0
  442. drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +4 −3
  443. drivers/net/wireless/rtlwifi/rtl8192cu/trx.h +3 −1
  444. drivers/net/wireless/rtlwifi/rtl8192de/dm.c +5 −5
  445. drivers/net/wireless/rtlwifi/rtl8192de/fw.c +1 −2
  446. drivers/net/wireless/rtlwifi/rtl8192de/phy.c +1 −1
  447. drivers/net/wireless/rtlwifi/rtl8192de/trx.c +3 −2
  448. drivers/net/wireless/rtlwifi/rtl8192de/trx.h +1 −0
  449. drivers/net/wireless/rtlwifi/rtl8192se/trx.c +6 −5
  450. drivers/net/wireless/rtlwifi/rtl8192se/trx.h +1 −0
  451. drivers/net/wireless/rtlwifi/usb.c +11 −6
  452. drivers/net/wireless/rtlwifi/wifi.h +108 −13
  453. drivers/net/wireless/ti/wl1251/main.c +3 −1
  454. drivers/net/wireless/ti/wl12xx/main.c +48 −31
  455. drivers/net/wireless/ti/wl12xx/wl12xx.h +7 −0
  456. drivers/net/wireless/ti/wl18xx/debugfs.c +1 −1
  457. drivers/net/wireless/ti/wl18xx/main.c +60 −69
  458. drivers/net/wireless/ti/wl18xx/wl18xx.h +7 −0
  459. drivers/net/wireless/ti/wlcore/cmd.c +19 −2
  460. drivers/net/wireless/ti/wlcore/cmd.h +0 −5
  461. drivers/net/wireless/ti/wlcore/conf.h +1 −2
  462. drivers/net/wireless/ti/wlcore/debug.h +13 −3
  463. drivers/net/wireless/ti/wlcore/debugfs.c +20 −12
  464. drivers/net/wireless/ti/wlcore/init.c +2 −10
  465. drivers/net/wireless/ti/wlcore/io.h +2 −2
  466. drivers/net/wireless/ti/wlcore/main.c +215 −157
  467. drivers/net/wireless/ti/wlcore/ps.c +3 −7
  468. drivers/net/wireless/ti/wlcore/rx.c +1 −1
  469. drivers/net/wireless/ti/wlcore/scan.c +8 −12
  470. drivers/net/wireless/ti/wlcore/spi.c +8 −2
  471. drivers/net/wireless/ti/wlcore/testmode.c +2 −2
  472. drivers/net/wireless/ti/wlcore/tx.c +67 −45
  473. drivers/net/wireless/ti/wlcore/tx.h +1 −3
  474. drivers/net/wireless/ti/wlcore/wlcore.h +20 −3
  475. drivers/net/wireless/ti/wlcore/wlcore_i.h +8 −5
  476. drivers/net/wireless/wl3501_cs.c +1 −2
  477. drivers/net/wireless/zd1211rw/zd_mac.c +6 −3
  478. drivers/net/xen-netfront.c +1 −1
  479. drivers/nfc/Kconfig +1 −13
  480. drivers/nfc/Makefile +0 −1
  481. drivers/nfc/nfcwilink.c +3 −17
  482. drivers/nfc/pn533.c +87 −20
  483. drivers/nfc/pn544.c +0 −893
  484. drivers/nfc/pn544_hci.c +120 −57
  485. drivers/ptp/ptp_clock.c +12 −4
  486. drivers/ptp/ptp_ixp46x.c +1 −1
  487. drivers/ptp/ptp_pch.c +1 −1
  488. drivers/ptp/ptp_private.h +1 −0
  489. drivers/s390/net/ctcm_fsms.c +1 −1
  490. drivers/s390/net/ctcm_main.c +1 −1
  491. drivers/s390/net/lcs.c +1 −1
  492. drivers/s390/net/qeth_core_main.c +43 −35
  493. drivers/s390/net/qeth_l3_main.c +2 −0
  494. drivers/scsi/scsi_netlink.c +16 −541
  495. drivers/scsi/scsi_transport_iscsi.c +3 −4
  496. drivers/ssb/driver_mipscore.c +21 −7
  497. drivers/staging/gdm72xx/netlink_k.c +2 −2
  498. drivers/staging/winbond/wbusb.c +3 −1
  499. firmware/Makefile +0 −1
  500. firmware/cxgb3/t3fw-7.10.0.bin.ihex +0 −1935
  501. fs/dlm/netlink.c +4 −4
  502. include/linux/Kbuild +2 −0
  503. include/linux/bcma/bcma_driver_chipcommon.h +111 −0
  504. include/linux/bcma/bcma_regs.h +4 −0
  505. include/linux/etherdevice.h +11 −0
  506. include/linux/ethtool.h +11 −6
  507. include/linux/filter.h +7 −0
  508. include/linux/hash.h +10 −0
  509. include/linux/ieee80211.h +0 −80
  510. include/linux/if_arp.h +1 −0
  511. include/linux/if_link.h +34 −0
  512. include/linux/if_team.h +9 −2
  513. include/linux/if_tunnel.h +3 −0
  514. include/linux/if_vlan.h +7 −2
  515. include/linux/inetdevice.h +9 −2
  516. include/linux/ip6_tunnel.h +17 −0
  517. include/linux/ipv6.h +1 −0
  518. include/linux/jiffies.h +6 −0
  519. include/linux/mdio.h +83 −0
  520. include/linux/netdevice.h +27 −24
  521. include/linux/netfilter.h +6 −8
  522. include/linux/netfilter/ipset/ip_set.h +13 −2
  523. include/linux/netfilter/ipset/ip_set_ahash.h +56 −50
  524. include/linux/netfilter/nf_conntrack_amanda.h +1 −0
  525. include/linux/netfilter/nf_conntrack_ftp.h +6 −1
  526. include/linux/netfilter/nf_conntrack_h323.h +10 −5
  527. include/linux/netfilter/nf_conntrack_irc.h +1 −0
  528. include/linux/netfilter/nf_conntrack_pptp.h +2 −0
  529. include/linux/netfilter/nf_conntrack_sip.h +14 −7
  530. include/linux/netfilter/nf_nat.h +8 −0
  531. include/linux/netfilter/nfnetlink_conntrack.h +6 −2
  532. include/linux/netfilter/nfnetlink_queue.h +1 −0
  533. include/linux/netfilter/xt_time.h +5 −0
  534. include/linux/netfilter_ipv4.h +0 −1
  535. include/linux/netfilter_ipv6/Kbuild +1 −0
  536. include/linux/netfilter_ipv6/ip6t_NPT.h +16 −0
  537. include/linux/netlink.h +23 −16
  538. include/linux/nfc.h +11 −0
  539. include/linux/nl80211.h +50 −4
  540. include/linux/of_mdio.h +33 −0
  541. include/linux/packet_diag.h +72 −0
  542. include/linux/pps_kernel.h +9 −0
  543. include/linux/ptp_clock_kernel.h +16 −5
  544. include/linux/rfkill.h +31 −0
  545. include/linux/sched.h +3 −0
  546. include/linux/skbuff.h +6 −3
  547. include/linux/snmp.h +11 −5
  548. include/linux/ssb/ssb_driver_chipcommon.h +3 −1
  549. include/linux/stmmac.h +0 −1
  550. include/linux/tcp.h +46 −3
  551. include/linux/tcp_metrics.h +54 −0
  552. include/linux/tipc_config.h +4 −4
  553. include/net/addrconf.h +1 −1
  554. include/net/arp.h +2 −1
  555. include/net/bluetooth/bluetooth.h +10 −0
  556. include/net/bluetooth/hci.h +32 −0
  557. include/net/bluetooth/hci_core.h +20 −28
  558. include/net/bluetooth/l2cap.h +3 −17
  559. include/net/bluetooth/mgmt.h +16 −0
  560. include/net/bluetooth/smp.h +4 −4
  561. include/net/cfg80211.h +61 −7
  562. include/net/checksum.h +3 −0
  563. include/net/dst.h +7 −3
  564. include/net/genetlink.h +17 −17
  565. include/net/gro_cells.h +103 −0
  566. include/net/ieee80211_radiotap.h +11 −0
  567. include/net/inet_ecn.h +76 −0
  568. include/net/inet_frag.h +3 −1
  569. include/net/inet_sock.h +1 −3
  570. include/net/ip.h +2 −0
  571. include/net/ip6_fib.h +1 −0
  572. include/net/ip6_tunnel.h +39 −2
  573. include/net/ip_vs.h +13 −3
  574. include/net/ipip.h +3 −0
  575. include/net/ipv6.h +31 −2
  576. include/net/llc.h +0 −1
  577. include/net/mac80211.h +78 −21
  578. include/net/ndisc.h +2 −1
  579. include/net/neighbour.h +9 −5
  580. include/net/net_namespace.h +15 −0
  581. include/net/netfilter/nf_conntrack_ecache.h +16 −16
  582. include/net/netfilter/nf_conntrack_expect.h +1 −1
  583. include/net/netfilter/nf_conntrack_timeout.h +20 −0
  584. include/net/netfilter/nf_nat.h +4 −2
  585. include/net/netfilter/nf_nat_core.h +1 −4
  586. include/net/netfilter/nf_nat_helper.h +8 −3
  587. include/net/netfilter/nf_nat_l3proto.h +52 −0
  588. include/net/netfilter/nf_nat_l4proto.h +72 −0
  589. include/net/netfilter/nf_nat_protocol.h +0 −67
  590. include/net/netfilter/nf_nat_rule.h +0 −15
  591. include/net/netlink.h +111 −13
  592. include/net/netns/conntrack.h +4 −0
  593. include/net/netns/ipv4.h +0 −2
  594. include/net/netns/ipv6.h +9 −0
  595. include/net/netns/packet.h +2 −2
  596. include/net/netns/sctp.h +131 −0
  597. include/net/nfc/hci.h +17 −4
  598. include/net/nfc/llc.h +54 −0
  599. include/net/nfc/nci.h +29 −0
  600. include/net/nfc/nci_core.h +5 −0
  601. include/net/nfc/nfc.h +2 −2
  602. include/net/nfc/shdlc.h +0 −107
  603. include/net/request_sock.h +36 −13
  604. include/net/scm.h +20 −5
  605. include/net/sctp/sctp.h +35 −34
  606. include/net/sctp/sm.h +5 −3
  607. include/net/sctp/structs.h +10 −144
  608. include/net/snmp.h +6 −4
  609. include/net/sock.h +15 −14
  610. include/net/tcp.h +75 −15
  611. include/net/xfrm.h +4 −4
  612. include/scsi/scsi_netlink.h +0 −24
  613. kernel/audit.c +12 −13
  614. kernel/exit.c +3 −0
  615. kernel/fork.c +1 −0
  616. kernel/taskstats.c +2 −2
  617. lib/kobject_uevent.c +2 −3
  618. lib/nlattr.c +4 −0
  619. net/8021q/vlan_core.c +6 −0
  620. net/Kconfig +2 −0
  621. net/atm/resources.c +1 −1
  622. net/batman-adv/bat_iv_ogm.c +52 −34
  623. net/batman-adv/bridge_loop_avoidance.c +142 −72
  624. net/batman-adv/bridge_loop_avoidance.h +9 −2
  625. net/batman-adv/debugfs.c +12 −0
  626. net/batman-adv/gateway_client.c +29 −24
  627. net/batman-adv/hard-interface.c +10 −3
  628. net/batman-adv/main.c +12 −15
  629. net/batman-adv/main.h +15 −14
  630. net/batman-adv/packet.h +18 −17
  631. net/batman-adv/routing.c +37 −48
  632. net/batman-adv/send.c +4 −4
  633. net/batman-adv/soft-interface.c +51 −28
  634. net/batman-adv/soft-interface.h +3 −2
  635. net/batman-adv/translation-table.c +256 −160
  636. net/batman-adv/translation-table.h +3 −1
  637. net/batman-adv/types.h +74 −46
  638. net/batman-adv/unicast.c +9 −7
  639. net/batman-adv/vis.c +73 −71
  640. net/batman-adv/vis.h +1 −1
  641. net/bluetooth/a2mp.c +10 −6
  642. net/bluetooth/af_bluetooth.c +139 −0
  643. net/bluetooth/bnep/sock.c +20 −2
  644. net/bluetooth/cmtp/sock.c +21 −2
  645. net/bluetooth/hci_conn.c +62 −38
  646. net/bluetooth/hci_core.c +8 −4
  647. net/bluetooth/hci_event.c +130 −60
  648. net/bluetooth/hci_sock.c +11 −2
  649. net/bluetooth/hidp/sock.c +21 −1
  650. net/bluetooth/l2cap_core.c +29 −8
  651. net/bluetooth/l2cap_sock.c +19 −3
  652. net/bluetooth/mgmt.c +48 −14
  653. net/bluetooth/rfcomm/sock.c +12 −2
  654. net/bluetooth/sco.c +11 −5
  655. net/bridge/br_fdb.c +9 −8
  656. net/bridge/br_netlink.c +1 −1
  657. net/bridge/br_private.h +3 −3
  658. net/bridge/br_stp_timer.c +1 −1
  659. net/bridge/netfilter/ebt_ulog.c +1 −2
  660. net/bridge/netfilter/ebtable_filter.c +1 −3
  661. net/bridge/netfilter/ebtable_nat.c +1 −3
  662. net/can/gw.c +1 −1
  663. net/core/dev.c +74 −35
  664. net/core/dev_addr_lists.c +21 −19
  665. net/core/dst.c +1 −1
  666. net/core/ethtool.c +0 −12
  667. net/core/fib_rules.c +3 −3
  668. net/core/filter.c +24 −3
  669. net/core/link_watch.c +8 −0
  670. net/core/neighbour.c +4 −4
  671. net/core/net-sysfs.c +15 −3
  672. net/core/netpoll.c +3 −2
  673. net/core/netprio_cgroup.c +4 −37
  674. net/core/request_sock.c +95 −0
  675. net/core/rtnetlink.c +21 −17
  676. net/core/scm.c +11 −6
  677. net/core/secure_seq.c +1 −0
  678. net/core/skbuff.c +40 −46
  679. net/core/sock.c +48 −16
  680. net/core/sock_diag.c +1 −2
  681. net/core/utils.c +20 −0
  682. net/dcb/dcbnl.c +9 −9
  683. net/decnet/af_decnet.c +2 −2
  684. net/decnet/dn_dev.c +3 −3
  685. net/decnet/dn_route.c +8 −8
  686. net/decnet/dn_table.c +6 −6
  687. net/decnet/netfilter/dn_rtmsg.c +1 −2
  688. net/ieee802154/6lowpan.c +45 −8
  689. net/ieee802154/nl-mac.c +3 −3
  690. net/ieee802154/nl-phy.c +3 −3
  691. net/ipv4/af_inet.c +24 −3
  692. net/ipv4/devinet.c +32 −35
  693. net/ipv4/fib_frontend.c +11 −14
  694. net/ipv4/fib_semantics.c +4 −4
  695. net/ipv4/fib_trie.c +9 −6
  696. net/ipv4/igmp.c +25 −13
  697. net/ipv4/inet_connection_sock.c +51 −6
  698. net/ipv4/inet_diag.c +16 −16
  699. net/ipv4/inet_fragment.c +7 −2
  700. net/ipv4/ip_fragment.c +9 −4
  701. net/ipv4/ip_gre.c +86 −42
  702. net/ipv4/ip_output.c +31 −43
  703. net/ipv4/ip_vti.c +0 −5
  704. net/ipv4/ipconfig.c +38 −5
  705. net/ipv4/ipip.c +26 −25
  706. net/ipv4/ipmr.c +6 −6
  707. net/ipv4/netfilter.c +2 −39
  708. net/ipv4/netfilter/Kconfig +22 −68
  709. net/ipv4/netfilter/Makefile +3 −15
  710. net/ipv4/netfilter/ipt_MASQUERADE.c +11 −7
  711. net/ipv4/netfilter/ipt_NETMAP.c +0 −98
  712. net/ipv4/netfilter/ipt_REDIRECT.c +0 −110
  713. net/ipv4/netfilter/ipt_ULOG.c +1 −2
  714. net/ipv4/netfilter/ipt_rpfilter.c +1 −1
  715. net/ipv4/netfilter/iptable_filter.c +2 −8
  716. net/ipv4/netfilter/iptable_mangle.c +2 −8
  717. net/ipv4/netfilter/iptable_nat.c +129 −135
  718. net/ipv4/netfilter/iptable_raw.c +2 −8
  719. net/ipv4/netfilter/iptable_security.c +1 −4
  720. net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +2 −6
  721. net/ipv4/netfilter/nf_nat_h323.c +38 −33
  722. net/ipv4/netfilter/nf_nat_l3proto_ipv4.c +281 −0
  723. net/ipv4/netfilter/nf_nat_pptp.c +11 −10
  724. net/ipv4/netfilter/nf_nat_proto_gre.c +15 −15
  725. net/ipv4/netfilter/nf_nat_proto_icmp.c +12 −12
  726. net/ipv4/netfilter/nf_nat_rule.c +0 −214
  727. net/ipv4/proc.c +4 −0
  728. net/ipv4/route.c +15 −15
  729. net/ipv4/syncookies.c +1 −0
  730. net/ipv4/sysctl_net_ipv4.c +45 −0
  731. net/ipv4/tcp.c +71 −64
  732. net/ipv4/tcp_fastopen.c +82 −1
  733. net/ipv4/tcp_input.c +148 −133
  734. net/ipv4/tcp_ipv4.c +284 −42
  735. net/ipv4/tcp_metrics.c +341 −13
  736. net/ipv4/tcp_minisocks.c +60 −15
  737. net/ipv4/tcp_output.c +19 −8
  738. net/ipv4/tcp_timer.c +38 −1
  739. net/ipv4/udp_diag.c +3 −3
  740. net/ipv6/Kconfig +16 −0
  741. net/ipv6/Makefile +1 −0
  742. net/ipv6/addrconf.c +38 −45
  743. net/ipv6/addrlabel.c +18 −6
  744. net/ipv6/ip6_fib.c +6 −14
  745. net/ipv6/ip6_gre.c +1770 −0
  746. net/ipv6/ip6_output.c +32 −53
  747. net/ipv6/ip6_tunnel.c +67 −24
  748. net/ipv6/ip6mr.c +5 −5
  749. net/ipv6/netfilter.c +8 −0
  750. net/ipv6/netfilter/Kconfig +36 −1
  751. net/ipv6/netfilter/Makefile +6 −0
  752. net/ipv6/netfilter/ip6t_MASQUERADE.c +135 −0
  753. net/ipv6/netfilter/ip6t_NPT.c +165 −0
  754. net/ipv6/netfilter/ip6table_filter.c +1 −3
  755. net/ipv6/netfilter/ip6table_mangle.c +1 −3
  756. net/ipv6/netfilter/ip6table_nat.c +321 −0
  757. net/ipv6/netfilter/ip6table_raw.c +1 −3
  758. net/ipv6/netfilter/ip6table_security.c +1 −4
  759. net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +71 −66
  760. net/ipv6/netfilter/nf_conntrack_reasm.c +123 −95
  761. net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +288 −0
  762. net/ipv6/netfilter/nf_nat_proto_icmpv6.c +90 −0
  763. net/ipv6/reassembly.c +24 −65
  764. net/ipv6/route.c +56 −40
  765. net/ipv6/sit.c +0 −6
  766. net/ipv6/syncookies.c +1 −0
  767. net/ipv6/tcp_ipv6.c +25 −15
  768. net/irda/irnetlink.c +1 −1
  769. net/key/af_key.c +21 −18
  770. net/l2tp/Kconfig +1 −0
  771. net/l2tp/l2tp_eth.c +2 −1
  772. net/l2tp/l2tp_netlink.c +12 −12
  773. net/llc/llc_station.c +9 −591
  774. net/llc/sysctl_net_llc.c +0 −7
  775. net/mac80211/aes_cmac.c +1 −5
  776. net/mac80211/agg-tx.c +1 −1
  777. net/mac80211/cfg.c +80 −23
  778. net/mac80211/chan.c +48 −19
  779. net/mac80211/debugfs.c +4 −32
  780. net/mac80211/driver-ops.h +8 −3
  781. net/mac80211/ibss.c +42 −8
  782. net/mac80211/ieee80211_i.h +28 −25
  783. net/mac80211/iface.c +196 −120
  784. net/mac80211/key.c +1 −1
  785. net/mac80211/main.c +17 −14
  786. net/mac80211/mesh.c +32 −17
  787. net/mac80211/mesh.h +4 −1
  788. net/mac80211/mesh_hwmp.c +0 −2
  789. net/mac80211/mesh_pathtbl.c +20 −24
  790. net/mac80211/mesh_plink.c +48 −37
  791. net/mac80211/mlme.c +270 −173
  792. net/mac80211/offchannel.c +7 −2
  793. net/mac80211/rate.h +1 −1
  794. net/mac80211/rx.c +54 −6
  795. net/mac80211/scan.c +21 −32
  796. net/mac80211/sta_info.c +68 −55
  797. net/mac80211/sta_info.h +2 −0
  798. net/mac80211/status.c +31 −11
  799. net/mac80211/trace.h +7 −4
  800. net/mac80211/tx.c +30 −43
  801. net/mac80211/util.c +85 −23
  802. net/netfilter/Kconfig +70 −13
  803. net/netfilter/Makefile +20 −1
  804. net/netfilter/core.c +12 −9
  805. net/netfilter/ipset/ip_set_bitmap_ip.c +12 −7
  806. net/netfilter/ipset/ip_set_bitmap_ipmac.c +11 −7
  807. net/netfilter/ipset/ip_set_bitmap_port.c +6 −3
  808. net/netfilter/ipset/ip_set_core.c +24 −15
  809. net/netfilter/ipset/ip_set_hash_ip.c +9 −6
  810. net/netfilter/ipset/ip_set_hash_ipport.c +14 −10
  811. net/netfilter/ipset/ip_set_hash_ipportip.c +14 −10
  812. net/netfilter/ipset/ip_set_hash_ipportnet.c +27 −20
  813. net/netfilter/ipset/ip_set_hash_net.c +14 −11
  814. net/netfilter/ipset/ip_set_hash_netiface.c +34 −32
  815. net/netfilter/ipset/ip_set_hash_netport.c +20 −16
  816. net/netfilter/ipset/ip_set_list_set.c +6 −3
  817. net/netfilter/ipvs/Kconfig +2 −1
  818. net/netfilter/ipvs/ip_vs_app.c +42 −16
  819. net/netfilter/ipvs/ip_vs_core.c +73 −3
  820. net/netfilter/ipvs/ip_vs_ctl.c +16 −9
  821. net/netfilter/ipvs/ip_vs_ftp.c +6 −16
  822. net/netfilter/ipvs/ip_vs_xmit.c +79 −32
  823. net/netfilter/nf_conntrack_amanda.c +3 −2
  824. net/netfilter/nf_conntrack_core.c +9 −6
  825. net/netfilter/nf_conntrack_ecache.c +1 −1
  826. net/netfilter/nf_conntrack_ftp.c +23 −1
  827. net/netfilter/nf_conntrack_h323_main.c +148 −84
  828. net/netfilter/nf_conntrack_irc.c +2 −1
  829. net/netfilter/nf_conntrack_netlink.c +67 −47
  830. net/netfilter/nf_conntrack_pptp.c +10 −8
  831. net/netfilter/nf_conntrack_proto.c +0 −5
  832. net/netfilter/nf_conntrack_proto_tcp.c +4 −4
  833. net/netfilter/nf_conntrack_sip.c +85 −58
  834. net/netfilter/nf_internals.h +2 −2
  835. net/netfilter/nf_nat_amanda.c +2 −2
  836. net/netfilter/nf_nat_core.c +386 −293
  837. net/netfilter/nf_nat_ftp.c +20 −14
  838. net/netfilter/nf_nat_helper.c +43 −66
  839. net/netfilter/nf_nat_irc.c +2 −8
  840. net/netfilter/nf_nat_proto_common.c +26 −28
  841. net/netfilter/nf_nat_proto_dccp.c +33 −23
  842. net/netfilter/nf_nat_proto_sctp.c +30 −23
  843. net/netfilter/nf_nat_proto_tcp.c +17 −23
  844. net/netfilter/nf_nat_proto_udp.c +18 −24
  845. net/netfilter/nf_nat_proto_udplite.c +33 −25
  846. net/netfilter/nf_nat_proto_unknown.c +9 −7
  847. net/netfilter/nf_nat_sip.c +155 −115
  848. net/netfilter/nf_nat_tftp.c +0 −1
  849. net/netfilter/nf_queue.c +5 −5
  850. net/netfilter/nfnetlink.c +1 −1
  851. net/netfilter/nfnetlink_acct.c +8 −8
  852. net/netfilter/nfnetlink_cthelper.c +10 −7
  853. net/netfilter/nfnetlink_cttimeout.c +6 −6
  854. net/netfilter/nfnetlink_log.c +9 −9
  855. net/netfilter/nfnetlink_queue_core.c +29 −21
  856. net/netfilter/xt_CT.c +126 −136
  857. net/netfilter/xt_NETMAP.c +165 −0
  858. net/netfilter/xt_NFQUEUE.c +5 −3
  859. net/netfilter/xt_NOTRACK.c +0 −53
  860. net/netfilter/xt_REDIRECT.c +190 −0
  861. net/netfilter/xt_nat.c +170 −0
  862. net/netfilter/xt_osf.c +1 −1
  863. net/netfilter/xt_set.c +22 −0
  864. net/netfilter/xt_socket.c +6 −6
  865. net/netfilter/xt_time.c +23 −1
  866. net/netlabel/netlabel_cipso_v4.c +1 −1
  867. net/netlabel/netlabel_mgmt.c +2 −2
  868. net/netlabel/netlabel_unlabeled.c +1 −1
  869. net/netlink/af_netlink.c +103 −107
  870. net/netlink/genetlink.c +23 −25
  871. net/nfc/core.c +2 −11
  872. net/nfc/hci/Makefile +2 −2
  873. net/nfc/hci/command.c +41 −4
  874. net/nfc/hci/core.c +186 −150
  875. net/nfc/hci/hci.h +4 −11
  876. net/nfc/hci/hcp.c +3 −3
  877. net/nfc/hci/llc.c +170 −0
  878. net/nfc/hci/llc.h +69 −0
  879. net/nfc/hci/llc_nop.c +99 −0
  880. net/nfc/hci/llc_shdlc.c +225 −319
  881. net/nfc/llcp/commands.c +2 −0
  882. net/nfc/llcp/llcp.c +70 −61
  883. net/nfc/llcp/llcp.h +3 −3
  884. net/nfc/llcp/sock.c +86 −7
  885. net/nfc/nci/core.c +90 −1
  886. net/nfc/nci/ntf.c +52 −0
  887. net/nfc/nci/rsp.c +14 −0
  888. net/nfc/netlink.c +50 −18
  889. net/openvswitch/actions.c +3 −3
  890. net/openvswitch/datapath.c +276 −177
  891. net/openvswitch/datapath.h +43 −9
  892. net/openvswitch/dp_notify.c +5 −3
  893. net/openvswitch/flow.c +5 −16
  894. net/openvswitch/flow.h +2 −1
  895. net/openvswitch/vport-internal_dev.c +6 −1
  896. net/openvswitch/vport-netdev.c +1 −1
  897. net/openvswitch/vport.c +17 −10
  898. net/openvswitch/vport.h +7 −6
  899. net/packet/Kconfig +8 −0
  900. net/packet/Makefile +2 −0
  901. net/packet/af_packet.c +19 −124
  902. net/packet/diag.c +242 −0
  903. net/packet/internal.h +121 −0
  904. net/phonet/pn_netlink.c +7 −7
  905. net/rds/tcp_connect.c +2 −2
  906. net/rds/tcp_listen.c +2 −2
  907. net/rds/tcp_recv.c +2 −2
  908. net/rds/tcp_send.c +2 −2
  909. net/rfkill/core.c +21 −1
  910. net/sched/act_api.c +26 −26
  911. net/sched/cls_api.c +7 −7
  912. net/sched/em_meta.c +1 −1
  913. net/sched/sch_api.c +22 −22
  914. net/sched/sch_drr.c +1 −1
  915. net/sched/sch_generic.c +8 −19
  916. net/sched/sch_qfq.c +1 −1
  917. net/sctp/associola.c +16 −9
  918. net/sctp/auth.c +16 −4
  919. net/sctp/bind_addr.c +10 −10
  920. net/sctp/chunk.c +1 −1
  921. net/sctp/endpointola.c +16 −9
  922. net/sctp/input.c +69 −46
  923. net/sctp/ipv6.c +19 −17
  924. net/sctp/objcnt.c +4 −4
  925. net/sctp/output.c +1 −1
  926. net/sctp/outqueue.c +14 −14
  927. net/sctp/primitive.c +2 −2
  928. net/sctp/proc.c +34 −21
  929. net/sctp/protocol.c +232 −222
  930. net/sctp/sm_make_chunk.c +33 −28
  931. net/sctp/sm_sideeffect.c +17 −9
  932. net/sctp/sm_statefuns.c +416 −309
  933. net/sctp/sm_statetable.c +10 −7
  934. net/sctp/socket.c +72 −47
  935. net/sctp/sysctl.c +112 −86
  936. net/sctp/transport.c +13 −10
  937. net/sctp/ulpqueue.c +12 −6
  938. net/socket.c +78 −11
  939. net/tipc/bearer.c +2 −19
  940. net/tipc/config.c +5 −43
  941. net/tipc/core.c +7 −15
  942. net/tipc/core.h +8 −10
  943. net/tipc/eth_media.c +25 −4
  944. net/tipc/handler.c +1 −1
  945. net/tipc/link.c +1 −3
  946. net/tipc/name_table.c +8 −8
  947. net/tipc/net.c +1 −2
  948. net/tipc/net.h +1 −1
  949. net/tipc/netlink.c +1 −1
  950. net/tipc/subscr.c +2 −2
  951. net/unix/af_unix.c +9 −8
  952. net/unix/diag.c +7 −7
  953. net/wireless/chan.c +6 −1
  954. net/wireless/core.c +51 −2
  955. net/wireless/core.h +1 −1
  956. net/wireless/mlme.c +26 −11
  957. net/wireless/nl80211.c +205 −61
  958. net/wireless/nl80211.h +5 −0
  959. net/wireless/radiotap.c +2 −0
  960. net/wireless/reg.c +17 −28
  961. net/wireless/scan.c +1 −1
  962. net/wireless/util.c +19 −17
  963. net/wireless/wext-core.c +4 −4
  964. net/xfrm/xfrm_policy.c +44 −39
  965. net/xfrm/xfrm_state.c +6 −6
  966. net/xfrm/xfrm_user.c +38 −39
  967. security/selinux/netlink.c +2 −3
Documentation/ABI/testing/sysfs-ptp+5−1
@@ -19,7 +19,11 @@ Date: September 2010 · 18 unmodified lines
1919 Contact: Richard Cochran <richardcochran@gmail.com>
2020 Description:
2121 This file contains the name of the PTP hardware clock
22− as a human readable string.
22+ as a human readable string. The purpose of this
23+ attribute is to provide the user with a "friendly
24+ name" and to help distinguish PHY based devices from
25+ MAC based ones. The string does not necessarily have
26+ to be any kind of unique id.
2327
2428 What: /sys/class/ptp/ptpN/max_adjustment
2529 Date: September 2010
Documentation/devicetree/bindings/net/can/c_can.txt+49−0
@@ -0,0 +1,49 @@
1+Bosch C_CAN/D_CAN controller Device Tree Bindings
2+-------------------------------------------------
3+
4+Required properties:
5+- compatible : Should be "bosch,c_can" for C_CAN controllers and
6+ "bosch,d_can" for D_CAN controllers.
7+- reg : physical base address and size of the C_CAN/D_CAN
8+ registers map
9+- interrupts : property with a value describing the interrupt
10+ number
11+
12+Optional properties:
13+- ti,hwmods : Must be "d_can<n>" or "c_can<n>", n being the
14+ instance number
15+
16+Note: "ti,hwmods" field is used to fetch the base address and irq
17+resources from TI, omap hwmod data base during device registration.
18+Future plan is to migrate hwmod data base contents into device tree
19+blob so that, all the required data will be used from device tree dts
20+file.
21+
22+Example:
23+
24+Step1: SoC common .dtsi file
25+
26+ dcan1: d_can@481d0000 {
27+ compatible = "bosch,d_can";
28+ reg = <0x481d0000 0x2000>;
29+ interrupts = <55>;
30+ interrupt-parent = <&intc>;
31+ status = "disabled";
32+ };
33+
34+(or)
35+
36+ dcan1: d_can@481d0000 {
37+ compatible = "bosch,d_can";
38+ ti,hwmods = "d_can1";
39+ reg = <0x481d0000 0x2000>;
40+ interrupts = <55>;
41+ interrupt-parent = <&intc>;
42+ status = "disabled";
43+ };
44+
45+Step 2: board specific .dts file
46+
47+ &dcan1 {
48+ status = "okay";
49+ };
Documentation/devicetree/bindings/net/cpsw.txt+109−0
@@ -0,0 +1,109 @@
1+TI SoC Ethernet Switch Controller Device Tree Bindings
2+------------------------------------------------------
3+
4+Required properties:
5+- compatible : Should be "ti,cpsw"
6+- reg : physical base address and size of the cpsw
7+ registers map
8+- interrupts : property with a value describing the interrupt
9+ number
10+- interrupt-parent : The parent interrupt controller
11+- cpdma_channels : Specifies number of channels in CPDMA
12+- host_port_no : Specifies host port shift
13+- cpdma_reg_ofs : Specifies CPDMA submodule register offset
14+- cpdma_sram_ofs : Specifies CPDMA SRAM offset
15+- ale_reg_ofs : Specifies ALE submodule register offset
16+- ale_entries : Specifies No of entries ALE can hold
17+- host_port_reg_ofs : Specifies host port register offset
18+- hw_stats_reg_ofs : Specifies hardware statistics register offset
19+- bd_ram_ofs : Specifies internal desciptor RAM offset
20+- bd_ram_size : Specifies internal descriptor RAM size
21+- rx_descs : Specifies number of Rx descriptors
22+- mac_control : Specifies Default MAC control register content
23+ for the specific platform
24+- slaves : Specifies number for slaves
25+- slave_reg_ofs : Specifies slave register offset
26+- sliver_reg_ofs : Specifies slave sliver register offset
27+- phy_id : Specifies slave phy id
28+- mac-address : Specifies slave MAC address
29+
30+Optional properties:
31+- ti,hwmods : Must be "cpgmac0"
32+- no_bd_ram : Must be 0 or 1
33+
34+Note: "ti,hwmods" field is used to fetch the base address and irq
35+resources from TI, omap hwmod data base during device registration.
36+Future plan is to migrate hwmod data base contents into device tree
37+blob so that, all the required data will be used from device tree dts
38+file.
39+
40+Examples:
41+
42+ mac: ethernet@4A100000 {
43+ compatible = "ti,cpsw";
44+ reg = <0x4A100000 0x1000>;
45+ interrupts = <55 0x4>;
46+ interrupt-parent = <&intc>;
47+ cpdma_channels = <8>;
48+ host_port_no = <0>;
49+ cpdma_reg_ofs = <0x800>;
50+ cpdma_sram_ofs = <0xa00>;
51+ ale_reg_ofs = <0xd00>;
52+ ale_entries = <1024>;
53+ host_port_reg_ofs = <0x108>;
54+ hw_stats_reg_ofs = <0x900>;
55+ bd_ram_ofs = <0x2000>;
56+ bd_ram_size = <0x2000>;
57+ no_bd_ram = <0>;
58+ rx_descs = <64>;
59+ mac_control = <0x20>;
60+ slaves = <2>;
61+ cpsw_emac0: slave@0 {
62+ slave_reg_ofs = <0x208>;
63+ sliver_reg_ofs = <0xd80>;
64+ phy_id = "davinci_mdio.16:00";
65+ /* Filled in by U-Boot */
66+ mac-address = [ 00 00 00 00 00 00 ];
67+ };
68+ cpsw_emac1: slave@1 {
69+ slave_reg_ofs = <0x308>;
70+ sliver_reg_ofs = <0xdc0>;
71+ phy_id = "davinci_mdio.16:01";
72+ /* Filled in by U-Boot */
73+ mac-address = [ 00 00 00 00 00 00 ];
74+ };
75+ };
76+
77+(or)
78+ mac: ethernet@4A100000 {
79+ compatible = "ti,cpsw";
80+ ti,hwmods = "cpgmac0";
81+ cpdma_channels = <8>;
82+ host_port_no = <0>;
83+ cpdma_reg_ofs = <0x800>;
84+ cpdma_sram_ofs = <0xa00>;
85+ ale_reg_ofs = <0xd00>;
86+ ale_entries = <1024>;
87+ host_port_reg_ofs = <0x108>;
88+ hw_stats_reg_ofs = <0x900>;
89+ bd_ram_ofs = <0x2000>;
90+ bd_ram_size = <0x2000>;
91+ no_bd_ram = <0>;
92+ rx_descs = <64>;
93+ mac_control = <0x20>;
94+ slaves = <2>;
95+ cpsw_emac0: slave@0 {
96+ slave_reg_ofs = <0x208>;
97+ sliver_reg_ofs = <0xd80>;
98+ phy_id = "davinci_mdio.16:00";
99+ /* Filled in by U-Boot */
100+ mac-address = [ 00 00 00 00 00 00 ];
101+ };
102+ cpsw_emac1: slave@1 {
103+ slave_reg_ofs = <0x308>;
104+ sliver_reg_ofs = <0xdc0>;
105+ phy_id = "davinci_mdio.16:01";
106+ /* Filled in by U-Boot */
107+ mac-address = [ 00 00 00 00 00 00 ];
108+ };
109+ };
Documentation/devicetree/bindings/net/davinci-mdio.txt+33−0
@@ -0,0 +1,33 @@
1+TI SoC Davinci MDIO Controller Device Tree Bindings
2+---------------------------------------------------
3+
4+Required properties:
5+- compatible : Should be "ti,davinci_mdio"
6+- reg : physical base address and size of the davinci mdio
7+ registers map
8+- bus_freq : Mdio Bus frequency
9+
10+Optional properties:
11+- ti,hwmods : Must be "davinci_mdio"
12+
13+Note: "ti,hwmods" field is used to fetch the base address and irq
14+resources from TI, omap hwmod data base during device registration.
15+Future plan is to migrate hwmod data base contents into device tree
16+blob so that, all the required data will be used from device tree dts
17+file.
18+
19+Examples:
20+
21+ mdio: davinci_mdio@4A101000 {
22+ compatible = "ti,cpsw";
23+ reg = <0x4A101000 0x1000>;
24+ bus_freq = <1000000>;
25+ };
26+
27+(or)
28+
29+ mdio: davinci_mdio@4A101000 {
30+ compatible = "ti,cpsw";
31+ ti,hwmods = "davinci_mdio";
32+ bus_freq = <1000000>;
33+ };
Documentation/devicetree/bindings/net/mdio-mux-mmioreg.txt+75−0
@@ -0,0 +1,75 @@
1+Properties for an MDIO bus multiplexer controlled by a memory-mapped device
2+
3+This is a special case of a MDIO bus multiplexer. A memory-mapped device,
4+like an FPGA, is used to control which child bus is connected. The mdio-mux
5+node must be a child of the memory-mapped device. The driver currently only
6+supports devices with eight-bit registers.
7+
8+Required properties in addition to the generic multiplexer properties:
9+
10+- compatible : string, must contain "mdio-mux-mmioreg"
11+
12+- reg : integer, contains the offset of the register that controls the bus
13+ multiplexer. The size field in the 'reg' property is the size of
14+ register, and must therefore be 1.
15+
16+- mux-mask : integer, contains an eight-bit mask that specifies which
17+ bits in the register control the actual bus multiplexer. The
18+ 'reg' property of each child mdio-mux node must be constrained by
19+ this mask.
20+
21+Example:
22+
23+The FPGA node defines a memory-mapped FPGA with a register space of 0x30 bytes.
24+For the "EMI2" MDIO bus, register 9 (BRDCFG1) controls the mux on that bus.
25+A bitmask of 0x6 means that bits 1 and 2 (bit 0 is lsb) are the bits on
26+BRDCFG1 that control the actual mux.
27+
28+ /* The FPGA node */
29+ fpga: board-control@3,0 {
30+ #address-cells = <1>;
31+ #size-cells = <1>;
32+ compatible = "fsl,p5020ds-fpga", "fsl,fpga-ngpixis";
33+ reg = <3 0 0x30>;
34+ ranges = <0 3 0 0x30>;
35+
36+ mdio-mux-emi2 {
37+ compatible = "mdio-mux-mmioreg", "mdio-mux";
38+ mdio-parent-bus = <&xmdio0>;
39+ #address-cells = <1>;
40+ #size-cells = <0>;
41+ reg = <9 1>; // BRDCFG1
42+ mux-mask = <0x6>; // EMI2
43+
44+ emi2_slot1: mdio@0 { // Slot 1 XAUI (FM2)
45+ reg = <0>;
46+ #address-cells = <1>;
47+ #size-cells = <0>;
48+
49+ phy_xgmii_slot1: ethernet-phy@0 {
50+ compatible = "ethernet-phy-ieee802.3-c45";
51+ reg = <4>;
52+ };
53+ };
54+
55+ emi2_slot2: mdio@2 { // Slot 2 XAUI (FM1)
56+ reg = <2>;
57+ #address-cells = <1>;
58+ #size-cells = <0>;
59+
60+ phy_xgmii_slot2: ethernet-phy@4 {
61+ compatible = "ethernet-phy-ieee802.3-c45";
62+ reg = <0>;
63+ };
64+ };
65+ };
66+ };
67+
68+ /* The parent MDIO bus. */
69+ xmdio0: mdio@f1000 {
70+ #address-cells = <1>;
71+ #size-cells = <0>;
72+ compatible = "fsl,fman-xmdio";
73+ reg = <0xf1000 0x1000>;
74+ interrupts = <100 1 0 0>;
75+ };
Documentation/filesystems/nfs/nfsroot.txt+9−1
@@ -78,7 +78,8 @@ nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>] · 77 unmodified lines
7878 flags = hard, nointr, noposix, cto, ac
7979
8080
81−ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
81+ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:
82+ <dns0-ip>:<dns1-ip>
8283
8384 This parameter tells the kernel how to configure IP addresses of devices
8485 and also how to set up the IP routing table. It was originally called
@@ -158,6 +159,13 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> · 73 unmodified lines
158159
159160 Default: any
160161
162+ <dns0-ip> IP address of first nameserver.
163+ Value gets exported by /proc/net/pnp which is often linked
164+ on embedded systems by /etc/resolv.conf.
165+
166+ <dns1-ip> IP address of secound nameserver.
167+ Same as above.
168+
161169
162170 nfsrootdebug
163171
Documentation/infiniband/ipoib.txt+3−0
@@ -24,6 +24,9 @@ Partitions and P_Keys · 23 unmodified lines
2424 The P_Key for any interface is given by the "pkey" file, and the
2525 main interface for a subinterface is in "parent."
2626
27+ Child interface create/delete can also be done using IPoIB's
28+ rtnl_link_ops, where childs created using either way behave the same.
29+
2730 Datagram vs Connected modes
2831
2932 The IPoIB driver supports two modes of operation: datagram and
Documentation/networking/batman-adv.txt+4−3
@@ -75,9 +75,10 @@ folder: · 74 unmodified lines
7575
7676 There is a special folder for debugging information:
7777
78−# ls /sys/kernel/debug/batman_adv/bat0/
79−# bla_claim_table log socket transtable_local
80−# gateways originators transtable_global vis_data
78+# ls /sys/kernel/debug/batman_adv/bat0/
79+# bla_backbone_table log transtable_global
80+# bla_claim_table originators transtable_local
81+# gateways socket vis_data
8182
8283 Some of the files contain all sort of status information regard-
8384 ing the mesh network. For example, you can view the table of
Documentation/networking/bonding.txt+25−5
@@ -752,12 +752,22 @@ xmit_hash_policy · 751 unmodified lines
752752 protocol information to generate the hash.
753753
754754 Uses XOR of hardware MAC addresses and IP addresses to
755− generate the hash. The formula is
755+ generate the hash. The IPv4 formula is
756756
757757 (((source IP XOR dest IP) AND 0xffff) XOR
758758 ( source MAC XOR destination MAC ))
759759 modulo slave count
760760
761+ The IPv6 formula is
762+
763+ hash = (source ip quad 2 XOR dest IP quad 2) XOR
764+ (source ip quad 3 XOR dest IP quad 3) XOR
765+ (source ip quad 4 XOR dest IP quad 4)
766+
767+ (((hash >> 24) XOR (hash >> 16) XOR (hash >> 8) XOR hash)
768+ XOR (source MAC XOR destination MAC))
769+ modulo slave count
770+
761771 This algorithm will place all traffic to a particular
762772 network peer on the same slave. For non-IP traffic,
763773 the formula is the same as for the layer2 transmit
@@ -778,19 +788,29 @@ xmit_hash_policy · 14 unmodified lines
778788 slaves, although a single connection will not span
779789 multiple slaves.
780790
781− The formula for unfragmented TCP and UDP packets is
791+ The formula for unfragmented IPv4 TCP and UDP packets is
782792
783793 ((source port XOR dest port) XOR
784794 ((source IP XOR dest IP) AND 0xffff)
785795 modulo slave count
786796
787− For fragmented TCP or UDP packets and all other IP
788− protocol traffic, the source and destination port
797+ The formula for unfragmented IPv6 TCP and UDP packets is
798+
799+ hash = (source port XOR dest port) XOR
800+ ((source ip quad 2 XOR dest IP quad 2) XOR
801+ (source ip quad 3 XOR dest IP quad 3) XOR
802+ (source ip quad 4 XOR dest IP quad 4))
803+
804+ ((hash >> 24) XOR (hash >> 16) XOR (hash >> 8) XOR hash)
805+ modulo slave count
806+
807+ For fragmented TCP or UDP packets and all other IPv4 and
808+ IPv6 protocol traffic, the source and destination port
789809 information is omitted. For non-IP traffic, the
790810 formula is the same as for the layer2 transmit hash
791811 policy.
792812
793− This policy is intended to mimic the behavior of
813+ The IPv4 policy is intended to mimic the behavior of
794814 certain switches, notably Cisco switches with PFC2 as
795815 well as some Foundry and IBM products.
796816
Documentation/networking/ip-sysctl.txt+28−9
@@ -439,7 +439,9 @@ tcp_stdurg - BOOLEAN · 438 unmodified lines
439439 tcp_synack_retries - INTEGER
440440 Number of times SYNACKs for a passive TCP connection attempt will
441441 be retransmitted. Should not be higher than 255. Default value
442− is 5, which corresponds to ~180seconds.
442+ is 5, which corresponds to 31seconds till the last retransmission
443+ with the current initial RTO of 1second. With this the final timeout
444+ for a passive TCP connection will happen after 63seconds.
443445
444446 tcp_syncookies - BOOLEAN
445447 Only valid when the kernel was compiled with CONFIG_SYNCOOKIES
@@ -465,20 +467,37 @@ tcp_syncookies - BOOLEAN · 19 unmodified lines
465467 tcp_fastopen - INTEGER
466468 Enable TCP Fast Open feature (draft-ietf-tcpm-fastopen) to send data
467469 in the opening SYN packet. To use this feature, the client application
468− must not use connect(). Instead, it should use sendmsg() or sendto()
469− with MSG_FASTOPEN flag which performs a TCP handshake automatically.
470−
471− The values (bitmap) are:
472− 1: Enables sending data in the opening SYN on the client
473− 5: Enables sending data in the opening SYN on the client regardless
474− of cookie availability.
470+ must use sendmsg() or sendto() with MSG_FASTOPEN flag rather than
471+ connect() to perform a TCP handshake automatically.
472+
473+ The values (bitmap) are
474+ 1: Enables sending data in the opening SYN on the client.
475+ 2: Enables TCP Fast Open on the server side, i.e., allowing data in
476+ a SYN packet to be accepted and passed to the application before
477+ 3-way hand shake finishes.
478+ 4: Send data in the opening SYN regardless of cookie availability and
479+ without a cookie option.
480+ 0x100: Accept SYN data w/o validating the cookie.
481+ 0x200: Accept data-in-SYN w/o any cookie option present.
482+ 0x400/0x800: Enable Fast Open on all listeners regardless of the
483+ TCP_FASTOPEN socket option. The two different flags designate two
484+ different ways of setting max_qlen without the TCP_FASTOPEN socket
485+ option.
475486
476487 Default: 0
477488
489+ Note that the client & server side Fast Open flags (1 and 2
490+ respectively) must be also enabled before the rest of flags can take
491+ effect.
492+
493+ See include/net/tcp.h and the code for more details.
494+
478495 tcp_syn_retries - INTEGER
479496 Number of times initial SYNs for an active TCP connection attempt
480497 will be retransmitted. Should not be higher than 255. Default value
481− is 5, which corresponds to ~180seconds.
498+ is 6, which corresponds to 63seconds till the last restransmission
499+ with the current initial RTO of 1second. With this the final timeout
500+ for an active TCP connection attempt will happen after 127seconds.
482501
483502 tcp_timestamps - BOOLEAN
484503 Enable timestamps as defined in RFC1323.
Documentation/networking/stmmac.txt+0−5
@@ -173,7 +173,6 @@ Where: · 172 unmodified lines
173173 For MDIO bus The we have:
174174
175175 struct stmmac_mdio_bus_data {
176− int bus_id;
177176 int (*phy_reset)(void *priv);
178177 unsigned int phy_mask;
179178 int *irqs;
@@ -181,7 +180,6 @@ For MDIO bus The we have: · 1 unmodified line
181180 };
182181
183182 Where:
184− o bus_id: bus identifier;
185183 o phy_reset: hook to reset the phy device attached to the bus.
186184 o phy_mask: phy mask passed when register the MDIO bus within the driver.
187185 o irqs: list of IRQs, one per PHY.
@@ -230,9 +228,6 @@ there are two MAC cores: one MAC is for MDIO Bus/PHY emulation · 42 unmodified lines
230228 with fixed_link support.
231229
232230 static struct stmmac_mdio_bus_data stmmac1_mdio_bus = {
233− .bus_id = 1,
234− |
235− |-> phy device on the bus_id 1
236231 .phy_reset = phy_reset;
237232 |
238233 |-> function to provide the phy_reset on this board
Documentation/networking/vxlan.txt+47−0
@@ -0,0 +1,47 @@
1+Virtual eXtensible Local Area Networking documentation
2+======================================================
3+
4+The VXLAN protocol is a tunnelling protocol that is designed to
5+solve the problem of limited number of available VLAN's (4096).
6+With VXLAN identifier is expanded to 24 bits.
7+
8+It is a draft RFC standard, that is implemented by Cisco Nexus,
9+Vmware and Brocade. The protocol runs over UDP using a single
10+destination port (still not standardized by IANA).
11+This document describes the Linux kernel tunnel device,
12+there is also an implantation of VXLAN for Openvswitch.
13+
14+Unlike most tunnels, a VXLAN is a 1 to N network, not just point
15+to point. A VXLAN device can either dynamically learn the IP address
16+of the other end, in a manner similar to a learning bridge, or the
17+forwarding entries can be configured statically.
18+
19+The management of vxlan is done in a similar fashion to it's
20+too closest neighbors GRE and VLAN. Configuring VXLAN requires
21+the version of iproute2 that matches the kernel release
22+where VXLAN was first merged upstream.
23+
24+1. Create vxlan device
25+ # ip li add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1
26+
27+This creates a new device (vxlan0). The device uses the
28+the multicast group 239.1.1.1 over eth1 to handle packets where
29+no entry is in the forwarding table.
30+
31+2. Delete vxlan device
32+ # ip link delete vxlan0
33+
34+3. Show vxlan info
35+ # ip -d show vxlan0
36+
37+It is possible to create, destroy and display the vxlan
38+forwarding table using the new bridge command.
39+
40+1. Create forwarding table entry
41+ # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0
42+
43+2. Delete forwarding table entry
44+ # bridge fdb delete 00:17:42:8a:b4:05
45+
46+3. Show forwarding table
47+ # bridge fdb show dev vxlan0
MAINTAINERS+1−0
@@ -4806,6 +4806,7 @@ M: Lauro Ramos Venancio <lauro.venancio@openbossa.org> · 4805 unmodified lines
48064806 M: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
48074807 M: Samuel Ortiz <sameo@linux.intel.com>
48084808 L: linux-wireless@vger.kernel.org
4809+L: linux-nfc@lists.01.org (moderated for non-subscribers)
48094810 S: Maintained
48104811 F: net/nfc/
48114812 F: include/linux/nfc.h
arch/m68k/configs/amiga_defconfig+0−1
@@ -67,7 +67,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 66 unmodified lines
6767 CONFIG_NETFILTER_XT_TARGET_MARK=m
6868 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6969 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
70−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
7170 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7271 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7372 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/apollo_defconfig+0−1
@@ -67,7 +67,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 66 unmodified lines
6767 CONFIG_NETFILTER_XT_TARGET_MARK=m
6868 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6969 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
70−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
7170 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7271 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7372 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/atari_defconfig+0−1
@@ -65,7 +65,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 64 unmodified lines
6565 CONFIG_NETFILTER_XT_TARGET_MARK=m
6666 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6767 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
68−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6968 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7069 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7170 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/bvme6000_defconfig+0−1
@@ -65,7 +65,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 64 unmodified lines
6565 CONFIG_NETFILTER_XT_TARGET_MARK=m
6666 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6767 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
68−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6968 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7069 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7170 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/hp300_defconfig+0−1
@@ -66,7 +66,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 65 unmodified lines
6666 CONFIG_NETFILTER_XT_TARGET_MARK=m
6767 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6868 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
69−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
7069 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7170 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7271 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/mac_defconfig+0−1
@@ -61,7 +61,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 60 unmodified lines
6161 CONFIG_NETFILTER_XT_TARGET_MARK=m
6262 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6363 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
64−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6564 CONFIG_NETFILTER_XT_TARGET_TRACE=m
6665 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6766 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/multi_defconfig+0−1
@@ -80,7 +80,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 79 unmodified lines
8080 CONFIG_NETFILTER_XT_TARGET_MARK=m
8181 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
8282 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
83−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
8483 CONFIG_NETFILTER_XT_TARGET_TRACE=m
8584 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
8685 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/mvme147_defconfig+0−1
@@ -64,7 +64,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 63 unmodified lines
6464 CONFIG_NETFILTER_XT_TARGET_MARK=m
6565 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6666 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
67−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6867 CONFIG_NETFILTER_XT_TARGET_TRACE=m
6968 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7069 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/mvme16x_defconfig+0−1
@@ -65,7 +65,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 64 unmodified lines
6565 CONFIG_NETFILTER_XT_TARGET_MARK=m
6666 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6767 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
68−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6968 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7069 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7170 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/q40_defconfig+0−1
@@ -61,7 +61,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 60 unmodified lines
6161 CONFIG_NETFILTER_XT_TARGET_MARK=m
6262 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6363 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
64−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6564 CONFIG_NETFILTER_XT_TARGET_TRACE=m
6665 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6766 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/sun3_defconfig+0−1
@@ -62,7 +62,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 61 unmodified lines
6262 CONFIG_NETFILTER_XT_TARGET_MARK=m
6363 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6464 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
65−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6665 CONFIG_NETFILTER_XT_TARGET_TRACE=m
6766 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6867 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/m68k/configs/sun3x_defconfig+0−1
@@ -62,7 +62,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 61 unmodified lines
6262 CONFIG_NETFILTER_XT_TARGET_MARK=m
6363 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6464 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
65−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6665 CONFIG_NETFILTER_XT_TARGET_TRACE=m
6766 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6867 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/mips/configs/ar7_defconfig+0−1
@@ -56,7 +56,6 @@ CONFIG_NF_CONNTRACK_MARK=y · 55 unmodified lines
5656 CONFIG_NF_CONNTRACK_FTP=m
5757 CONFIG_NF_CONNTRACK_IRC=m
5858 CONFIG_NF_CONNTRACK_TFTP=m
59−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6059 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6160 CONFIG_NETFILTER_XT_MATCH_LIMIT=m
6261 CONFIG_NETFILTER_XT_MATCH_MAC=m
arch/mips/configs/bcm47xx_defconfig+0−1
@@ -96,7 +96,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 95 unmodified lines
9696 CONFIG_NETFILTER_XT_TARGET_MARK=m
9797 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
9898 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
99−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
10099 CONFIG_NETFILTER_XT_TARGET_TRACE=m
101100 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
102101 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
arch/mips/configs/ip22_defconfig+0−1
@@ -87,7 +87,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 86 unmodified lines
8787 CONFIG_NETFILTER_XT_TARGET_MARK=m
8888 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
8989 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
90−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
9190 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
9291 CONFIG_NETFILTER_XT_TARGET_TRACE=m
9392 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
arch/mips/configs/jazz_defconfig+0−1
@@ -60,7 +60,6 @@ CONFIG_NETFILTER_XT_TARGET_CONNMARK=m · 59 unmodified lines
6060 CONFIG_NETFILTER_XT_TARGET_MARK=m
6161 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6262 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
63−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6463 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
6564 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6665 CONFIG_NETFILTER_XT_MATCH_COMMENT=m
arch/mips/configs/malta_defconfig+0−1
@@ -86,7 +86,6 @@ CONFIG_NETFILTER_XT_TARGET_CONNMARK=m · 85 unmodified lines
8686 CONFIG_NETFILTER_XT_TARGET_MARK=m
8787 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
8888 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
89−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
9089 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
9190 CONFIG_NETFILTER_XT_TARGET_TRACE=m
9291 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
arch/mips/configs/markeins_defconfig+0−1
@@ -59,7 +59,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 58 unmodified lines
5959 CONFIG_NETFILTER_XT_TARGET_MARK=m
6060 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6161 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
62−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
6362 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
6463 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6564 CONFIG_NETFILTER_XT_MATCH_COMMENT=m
arch/mips/configs/nlm_xlp_defconfig+0−1
@@ -108,7 +108,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 107 unmodified lines
108108 CONFIG_NETFILTER_XT_TARGET_MARK=m
109109 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
110110 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
111−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
112111 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
113112 CONFIG_NETFILTER_XT_TARGET_TRACE=m
114113 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
arch/mips/configs/nlm_xlr_defconfig+0−1
@@ -109,7 +109,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 108 unmodified lines
109109 CONFIG_NETFILTER_XT_TARGET_MARK=m
110110 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
111111 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
112−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
113112 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
114113 CONFIG_NETFILTER_XT_TARGET_TRACE=m
115114 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
arch/mips/configs/rm200_defconfig+0−1
@@ -68,7 +68,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 67 unmodified lines
6868 CONFIG_NETFILTER_XT_TARGET_MARK=m
6969 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
7070 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
71−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
7271 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
7372 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
7473 CONFIG_NETFILTER_XT_MATCH_COMMENT=m
arch/powerpc/configs/pmac32_defconfig+0−1
@@ -55,7 +55,6 @@ CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m · 54 unmodified lines
5555 CONFIG_NETFILTER_XT_TARGET_MARK=m
5656 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
5757 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
58−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
5958 CONFIG_NETFILTER_XT_TARGET_TRACE=m
6059 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
6160 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/powerpc/configs/ppc64_defconfig+0−1
@@ -92,7 +92,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 91 unmodified lines
9292 CONFIG_NETFILTER_XT_TARGET_MARK=m
9393 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
9494 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
95−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
9695 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
9796 CONFIG_NETFILTER_XT_TARGET_TRACE=m
9897 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
arch/powerpc/configs/ppc64e_defconfig+0−1
@@ -66,7 +66,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 65 unmodified lines
6666 CONFIG_NETFILTER_XT_TARGET_MARK=m
6767 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
6868 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
69−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
7069 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
7170 CONFIG_NETFILTER_XT_TARGET_TRACE=m
7271 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
arch/powerpc/configs/ppc6xx_defconfig+0−1
@@ -167,7 +167,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 166 unmodified lines
167167 CONFIG_NETFILTER_XT_TARGET_MARK=m
168168 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
169169 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
170−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
171170 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
172171 CONFIG_NETFILTER_XT_TARGET_TRACE=m
173172 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
arch/sparc/net/bpf_jit_comp.c+4−0
@@ -464,8 +464,12 @@ void bpf_jit_compile(struct sk_filter *fp) · 463 unmodified lines
464464 emit_alu_K(OR, K);
465465 break;
466466 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
467+ case BPF_S_ALU_XOR_X:
467468 emit_alu_X(XOR);
468469 break;
470+ case BPF_S_ALU_XOR_K: /* A ^= K */
471+ emit_alu_K(XOR, K);
472+ break;
469473 case BPF_S_ALU_LSH_X: /* A <<= X */
470474 emit_alu_X(SLL);
471475 break;
arch/tile/configs/tilegx_defconfig+0−1
@@ -134,7 +134,6 @@ CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m · 133 unmodified lines
134134 CONFIG_NETFILTER_XT_TARGET_MARK=m
135135 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
136136 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
137−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
138137 CONFIG_NETFILTER_XT_TARGET_TEE=m
139138 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
140139 CONFIG_NETFILTER_XT_TARGET_TRACE=m
arch/tile/configs/tilepro_defconfig+0−1
@@ -132,7 +132,6 @@ CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m · 131 unmodified lines
132132 CONFIG_NETFILTER_XT_TARGET_MARK=m
133133 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
134134 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
135−CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
136135 CONFIG_NETFILTER_XT_TARGET_TEE=m
137136 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
138137 CONFIG_NETFILTER_XT_TARGET_TRACE=m
arch/x86/net/bpf_jit_comp.c+34−0
@@ -280,6 +280,31 @@ void bpf_jit_compile(struct sk_filter *fp) · 279 unmodified lines
280280 }
281281 EMIT4(0x31, 0xd2, 0xf7, 0xf3); /* xor %edx,%edx; div %ebx */
282282 break;
283+ case BPF_S_ALU_MOD_X: /* A %= X; */
284+ seen |= SEEN_XREG;
285+ EMIT2(0x85, 0xdb); /* test %ebx,%ebx */
286+ if (pc_ret0 > 0) {
287+ /* addrs[pc_ret0 - 1] is start address of target
288+ * (addrs[i] - 6) is the address following this jmp
289+ * ("xor %edx,%edx; div %ebx;mov %edx,%eax" being 6 bytes long)
290+ */
291+ EMIT_COND_JMP(X86_JE, addrs[pc_ret0 - 1] -
292+ (addrs[i] - 6));
293+ } else {
294+ EMIT_COND_JMP(X86_JNE, 2 + 5);
295+ CLEAR_A();
296+ EMIT1_off32(0xe9, cleanup_addr - (addrs[i] - 6)); /* jmp .+off32 */
297+ }
298+ EMIT2(0x31, 0xd2); /* xor %edx,%edx */
299+ EMIT2(0xf7, 0xf3); /* div %ebx */
300+ EMIT2(0x89, 0xd0); /* mov %edx,%eax */
301+ break;
302+ case BPF_S_ALU_MOD_K: /* A %= K; */
303+ EMIT2(0x31, 0xd2); /* xor %edx,%edx */
304+ EMIT1(0xb9);EMIT(K, 4); /* mov imm32,%ecx */
305+ EMIT2(0xf7, 0xf1); /* div %ecx */
306+ EMIT2(0x89, 0xd0); /* mov %edx,%eax */
307+ break;
283308 case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K); */
284309 EMIT3(0x48, 0x69, 0xc0); /* imul imm32,%rax,%rax */
285310 EMIT(K, 4);
@@ -310,9 +335,18 @@ void bpf_jit_compile(struct sk_filter *fp) · 24 unmodified lines
310335 EMIT1_off32(0x0d, K); /* or imm32,%eax */
311336 break;
312337 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
338+ case BPF_S_ALU_XOR_X:
313339 seen |= SEEN_XREG;
314340 EMIT2(0x31, 0xd8); /* xor %ebx,%eax */
315341 break;
342+ case BPF_S_ALU_XOR_K: /* A ^= K; */
343+ if (K == 0)
344+ break;
345+ if (is_imm8(K))
346+ EMIT3(0x83, 0xf0, K); /* xor imm8,%eax */
347+ else
348+ EMIT1_off32(0x35, K); /* xor imm32,%eax */
349+ break;
316350 case BPF_S_ALU_LSH_X: /* A <<= X; */
317351 seen |= SEEN_XREG;
318352 EMIT4(0x89, 0xd9, 0xd3, 0xe0); /* mov %ebx,%ecx; shl %cl,%eax */
crypto/crypto_user.c+3−4
@@ -166,7 +166,7 @@ static int crypto_report_alg(struct crypto_alg *alg, · 165 unmodified lines
166166 struct crypto_user_alg *ualg;
167167 int err = 0;
168168
169− nlh = nlmsg_put(skb, NETLINK_CB(in_skb).pid, info->nlmsg_seq,
169+ nlh = nlmsg_put(skb, NETLINK_CB(in_skb).portid, info->nlmsg_seq,
170170 CRYPTO_MSG_GETALG, sizeof(*ualg), info->nlmsg_flags);
171171 if (!nlh) {
172172 err = -EMSGSIZE;
@@ -216,7 +216,7 @@ static int crypto_report(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, · 43 unmodified lines
216216 if (err)
217217 return err;
218218
219− return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).pid);
219+ return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid);
220220 }
221221
222222 static int crypto_dump_report(struct sk_buff *skb, struct netlink_callback *cb)
@@ -500,8 +500,7 @@ static int __init crypto_user_init(void) · 277 unmodified lines
500500 .input = crypto_netlink_rcv,
501501 };
502502
503− crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO,
504− THIS_MODULE, &cfg);
503+ crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, &cfg);
505504 if (!crypto_nlsk)
506505 return -ENOMEM;
507506
drivers/Makefile+0−1
@@ -123,7 +123,6 @@ obj-$(CONFIG_VHOST_NET) += vhost/ · 122 unmodified lines
123123 obj-$(CONFIG_VLYNQ) += vlynq/
124124 obj-$(CONFIG_STAGING) += staging/
125125 obj-y += platform/
126−obj-y += ieee802154/
127126 #common clk code
128127 obj-y += clk/
129128
drivers/bcma/Kconfig+2−2
@@ -48,12 +48,12 @@ config BCMA_DRIVER_MIPS · 47 unmodified lines
4848
4949 config BCMA_SFLASH
5050 bool
51− depends on BCMA_DRIVER_MIPS && BROKEN
51+ depends on BCMA_DRIVER_MIPS
5252 default y
5353
5454 config BCMA_NFLASH
5555 bool
56− depends on BCMA_DRIVER_MIPS && BROKEN
56+ depends on BCMA_DRIVER_MIPS
5757 default y
5858
5959 config BCMA_DRIVER_GMAC_CMN
drivers/bcma/bcma_private.h+2−0
@@ -54,6 +54,7 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); · 53 unmodified lines
5454 #ifdef CONFIG_BCMA_SFLASH
5555 /* driver_chipcommon_sflash.c */
5656 int bcma_sflash_init(struct bcma_drv_cc *cc);
57+extern struct platform_device bcma_sflash_dev;
5758 #else
5859 static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
5960 {
@@ -65,6 +66,7 @@ static inline int bcma_sflash_init(struct bcma_drv_cc *cc) · 5 unmodified lines
6566 #ifdef CONFIG_BCMA_NFLASH
6667 /* driver_chipcommon_nflash.c */
6768 int bcma_nflash_init(struct bcma_drv_cc *cc);
69+extern struct platform_device bcma_nflash_dev;
6870 #else
6971 static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
7072 {
drivers/bcma/core.c+1−1
@@ -65,7 +65,7 @@ void bcma_core_set_clockmode(struct bcma_device *core, · 64 unmodified lines
6565 switch (clkmode) {
6666 case BCMA_CLKMODE_FAST:
6767 bcma_set32(core, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
68− udelay(64);
68+ usleep_range(64, 300);
6969 for (i = 0; i < 1500; i++) {
7070 if (bcma_read32(core, BCMA_CLKCTLST) &
7171 BCMA_CLKCTLST_HAVEHT) {
drivers/bcma/driver_chipcommon_nflash.c+25−3
@@ -5,15 +5,37 @@ · 4 unmodified lines
55 * Licensed under the GNU/GPL. See COPYING for details.
66 */
77
8+#include <linux/platform_device.h>
89 #include <linux/bcma/bcma.h>
9−#include <linux/bcma/bcma_driver_chipcommon.h>
10−#include <linux/delay.h>
1110
1211 #include "bcma_private.h"
1312
13+struct platform_device bcma_nflash_dev = {
14+ .name = "bcma_nflash",
15+ .num_resources = 0,
16+};
17+
1418 /* Initialize NAND flash access */
1519 int bcma_nflash_init(struct bcma_drv_cc *cc)
1620 {
17− bcma_err(cc->core->bus, "NAND flash support is broken\n");
21+ struct bcma_bus *bus = cc->core->bus;
22+
23+ if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 &&
24+ cc->core->id.rev != 0x38) {
25+ bcma_err(bus, "NAND flash on unsupported board!\n");
26+ return -ENOTSUPP;
27+ }
28+
29+ if (!(cc->capabilities & BCMA_CC_CAP_NFLASH)) {
30+ bcma_err(bus, "NAND flash not present according to ChipCommon\n");
31+ return -ENODEV;
32+ }
33+
34+ cc->nflash.present = true;
35+
36+ /* Prepare platform device, but don't register it yet. It's too early,
37+ * malloc (required by device_private_init) is not available yet. */
38+ bcma_nflash_dev.dev.platform_data = &cc->nflash;
39+
1840 return 0;
1941 }
drivers/bcma/driver_chipcommon_pmu.c+6−3
@@ -76,7 +76,10 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc) · 75 unmodified lines
7676 if (max_msk)
7777 bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
7878
79− /* Add some delay; allow resources to come up and settle. */
79+ /*
80+ * Add some delay; allow resources to come up and settle.
81+ * Delay is required for SoC (early init).
82+ */
8083 mdelay(2);
8184 }
8285
@@ -101,7 +104,7 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable) · 18 unmodified lines
101104 bcma_cc_write32(cc, BCMA_CC_CHIPCTL, val);
102105 }
103106
104−void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
107+static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
105108 {
106109 struct bcma_bus *bus = cc->core->bus;
107110
@@ -257,7 +260,7 @@ static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) · 149 unmodified lines
257260 }
258261
259262 /* query bus clock frequency for PMU-enabled chipcommon */
260−u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
263+static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
261264 {
262265 struct bcma_bus *bus = cc->core->bus;
263266
drivers/bcma/driver_chipcommon_sflash.c+120−3
@@ -5,15 +5,132 @@ · 4 unmodified lines
55 * Licensed under the GNU/GPL. See COPYING for details.
66 */
77
8+#include <linux/platform_device.h>
89 #include <linux/bcma/bcma.h>
9−#include <linux/bcma/bcma_driver_chipcommon.h>
10−#include <linux/delay.h>
1110
1211 #include "bcma_private.h"
1312
13+static struct resource bcma_sflash_resource = {
14+ .name = "bcma_sflash",
15+ .start = BCMA_SFLASH,
16+ .end = 0,
17+ .flags = IORESOURCE_MEM | IORESOURCE_READONLY,
18+};
19+
20+struct platform_device bcma_sflash_dev = {
21+ .name = "bcma_sflash",
22+ .resource = &bcma_sflash_resource,
23+ .num_resources = 1,
24+};
25+
26+struct bcma_sflash_tbl_e {
27+ char *name;
28+ u32 id;
29+ u32 blocksize;
30+ u16 numblocks;
31+};
32+
33+static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = {
34+ { "", 0x14, 0x10000, 32, },
35+ { 0 },
36+};
37+
38+static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = {
39+ { 0 },
40+};
41+
42+static struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = {
43+ { 0 },
44+};
45+
46+static void bcma_sflash_cmd(struct bcma_drv_cc *cc, u32 opcode)
47+{
48+ int i;
49+ bcma_cc_write32(cc, BCMA_CC_FLASHCTL,
50+ BCMA_CC_FLASHCTL_START | opcode);
51+ for (i = 0; i < 1000; i++) {
52+ if (!(bcma_cc_read32(cc, BCMA_CC_FLASHCTL) &
53+ BCMA_CC_FLASHCTL_BUSY))
54+ return;
55+ cpu_relax();
56+ }
57+ bcma_err(cc->core->bus, "SFLASH control command failed (timeout)!\n");
58+}
59+
1460 /* Initialize serial flash access */
1561 int bcma_sflash_init(struct bcma_drv_cc *cc)
1662 {
17− bcma_err(cc->core->bus, "Serial flash support is broken\n");
63+ struct bcma_bus *bus = cc->core->bus;
64+ struct bcma_sflash *sflash = &cc->sflash;
65+ struct bcma_sflash_tbl_e *e;
66+ u32 id, id2;
67+
68+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
69+ case BCMA_CC_FLASHT_STSER:
70+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_DP);
71+
72+ bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 0);
73+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES);
74+ id = bcma_cc_read32(cc, BCMA_CC_FLASHDATA);
75+
76+ bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 1);
77+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES);
78+ id2 = bcma_cc_read32(cc, BCMA_CC_FLASHDATA);
79+
80+ switch (id) {
81+ case 0xbf:
82+ for (e = bcma_sflash_sst_tbl; e->name; e++) {
83+ if (e->id == id2)
84+ break;
85+ }
86+ break;
87+ default:
88+ for (e = bcma_sflash_st_tbl; e->name; e++) {
89+ if (e->id == id)
90+ break;
91+ }
92+ break;
93+ }
94+ if (!e->name) {
95+ bcma_err(bus, "Unsupported ST serial flash (id: 0x%X, id2: 0x%X)\n", id, id2);
96+ return -ENOTSUPP;
97+ }
98+
99+ break;
100+ case BCMA_CC_FLASHT_ATSER:
101+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_AT_STATUS);
102+ id = bcma_cc_read32(cc, BCMA_CC_FLASHDATA) & 0x3c;
103+
104+ for (e = bcma_sflash_at_tbl; e->name; e++) {
105+ if (e->id == id)
106+ break;
107+ }
108+ if (!e->name) {
109+ bcma_err(bus, "Unsupported Atmel serial flash (id: 0x%X)\n", id);
110+ return -ENOTSUPP;
111+ }
112+
113+ break;
114+ default:
115+ bcma_err(bus, "Unsupported flash type\n");
116+ return -ENOTSUPP;
117+ }
118+
119+ sflash->window = BCMA_SFLASH;
120+ sflash->blocksize = e->blocksize;
121+ sflash->numblocks = e->numblocks;
122+ sflash->size = sflash->blocksize * sflash->numblocks;
123+ sflash->present = true;
124+
125+ bcma_info(bus, "Found %s serial flash (size: %dKiB, blocksize: 0x%X, blocks: %d)\n",
126+ e->name, sflash->size / 1024, sflash->blocksize,
127+ sflash->numblocks);
128+
129+ /* Prepare platform device, but don't register it yet. It's too early,
130+ * malloc (required by device_private_init) is not available yet. */
131+ bcma_sflash_dev.resource[0].end = bcma_sflash_dev.resource[0].start +
132+ sflash->size;
133+ bcma_sflash_dev.dev.platform_data = sflash;
134+
18135 return 0;
19136 }
drivers/bcma/driver_pci.c+3−3
@@ -51,7 +51,7 @@ static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) · 50 unmodified lines
5151 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
5252 if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)
5353 break;
54− msleep(1);
54+ usleep_range(1000, 2000);
5555 }
5656 }
5757
@@ -92,7 +92,7 @@ static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address) · 34 unmodified lines
9292 ret = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_DATA);
9393 break;
9494 }
95− msleep(1);
95+ usleep_range(1000, 2000);
9696 }
9797 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
9898 return ret;
@@ -132,7 +132,7 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, · 33 unmodified lines
132132 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
133133 if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)
134134 break;
135− msleep(1);
135+ usleep_range(1000, 2000);
136136 }
137137 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
138138 }
drivers/bcma/driver_pci_host.c+4−4
@@ -425,9 +425,9 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 424 unmodified lines
425425 pc_host->io_resource.flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED;
426426
427427 /* Reset RC */
428− udelay(3000);
428+ usleep_range(3000, 5000);
429429 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST_OE);
430− udelay(1000);
430+ usleep_range(1000, 2000);
431431 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST |
432432 BCMA_CORE_PCI_CTL_RST_OE);
433433
@@ -481,7 +481,7 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 47 unmodified lines
481481 * before issuing configuration requests to PCI Express
482482 * devices.
483483 */
484− udelay(100000);
484+ msleep(100);
485485
486486 bcma_core_pci_enable_crs(pc);
487487
@@ -501,7 +501,7 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 13 unmodified lines
501501 set_io_port_base(pc_host->pci_controller.io_map_base);
502502 /* Give some time to the PCI controller to configure itself with the new
503503 * values. Not waiting at this point causes crashes of the machine. */
504− mdelay(10);
504+ usleep_range(10000, 15000);
505505 register_pci_controller(&pc_host->pci_controller);
506506 return;
507507 }
drivers/bcma/host_pci.c+7−5
@@ -77,8 +77,8 @@ static void bcma_host_pci_write32(struct bcma_device *core, u16 offset, · 76 unmodified lines
7777 }
7878
7979 #ifdef CONFIG_BCMA_BLOCKIO
80−void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,
81− size_t count, u16 offset, u8 reg_width)
80+static void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,
81+ size_t count, u16 offset, u8 reg_width)
8282 {
8383 void __iomem *addr = core->bus->mmio + offset;
8484 if (core->bus->mapped_core != core)
@@ -100,8 +100,9 @@ void bcma_host_pci_block_read(struct bcma_device *core, void *buffer, · 15 unmodified lines
100100 }
101101 }
102102
103−void bcma_host_pci_block_write(struct bcma_device *core, const void *buffer,
104− size_t count, u16 offset, u8 reg_width)
103+static void bcma_host_pci_block_write(struct bcma_device *core,
104+ const void *buffer, size_t count,
105+ u16 offset, u8 reg_width)
105106 {
106107 void __iomem *addr = core->bus->mmio + offset;
107108 if (core->bus->mapped_core != core)
@@ -139,7 +140,7 @@ static void bcma_host_pci_awrite32(struct bcma_device *core, u16 offset, · 31 unmodified lines
139140 iowrite32(value, core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset);
140141 }
141142
142−const struct bcma_host_ops bcma_host_pci_ops = {
143+static const struct bcma_host_ops bcma_host_pci_ops = {
143144 .read8 = bcma_host_pci_read8,
144145 .read16 = bcma_host_pci_read16,
145146 .read32 = bcma_host_pci_read32,
@@ -272,6 +273,7 @@ static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { · 126 unmodified lines
272273 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
273274 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },
274275 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
276+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
275277 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
276278 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
277279 { 0, },
drivers/bcma/host_soc.c+1−1
@@ -143,7 +143,7 @@ static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset, · 142 unmodified lines
143143 writel(value, core->io_wrap + offset);
144144 }
145145
146−const struct bcma_host_ops bcma_host_soc_ops = {
146+static const struct bcma_host_ops bcma_host_soc_ops = {
147147 .read8 = bcma_host_soc_read8,
148148 .read16 = bcma_host_soc_read16,
149149 .read32 = bcma_host_soc_read32,
drivers/bcma/main.c+27−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77
88 #include "bcma_private.h"
99 #include <linux/module.h>
10+#include <linux/platform_device.h>
1011 #include <linux/bcma/bcma.h>
1112 #include <linux/slab.h>
1213
@@ -136,6 +137,22 @@ static int bcma_register_cores(struct bcma_bus *bus) · 123 unmodified lines
136137 dev_id++;
137138 }
138139
140+#ifdef CONFIG_BCMA_SFLASH
141+ if (bus->drv_cc.sflash.present) {
142+ err = platform_device_register(&bcma_sflash_dev);
143+ if (err)
144+ bcma_err(bus, "Error registering serial flash\n");
145+ }
146+#endif
147+
148+#ifdef CONFIG_BCMA_NFLASH
149+ if (bus->drv_cc.nflash.present) {
150+ err = platform_device_register(&bcma_nflash_dev);
151+ if (err)
152+ bcma_err(bus, "Error registering NAND flash\n");
153+ }
154+#endif
155+
139156 return 0;
140157 }
141158
@@ -210,7 +227,17 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) · 68 unmodified lines
210227
211228 void bcma_bus_unregister(struct bcma_bus *bus)
212229 {
230+ struct bcma_device *cores[3];
231+
232+ cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
233+ cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE);
234+ cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
235+
213236 bcma_unregister_cores(bus);
237+
238+ kfree(cores[2]);
239+ kfree(cores[1]);
240+ kfree(cores[0]);
214241 }
215242
216243 int __init bcma_bus_early_register(struct bcma_bus *bus,
drivers/bcma/sprom.c+2−0
@@ -507,7 +507,9 @@ static bool bcma_sprom_onchip_available(struct bcma_bus *bus) · 506 unmodified lines
507507 /* for these chips OTP is always available */
508508 present = true;
509509 break;
510+ case BCMA_CHIP_ID_BCM43227:
510511 case BCMA_CHIP_ID_BCM43228:
512+ case BCMA_CHIP_ID_BCM43428:
511513 present = chip_status & BCMA_CC_CHIPST_43228_OTP_PRESENT;
512514 break;
513515 default:
drivers/bluetooth/bcm203x.c+1−7
@@ -177,7 +177,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 176 unmodified lines
177177 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
178178 return -ENODEV;
179179
180− data = kzalloc(sizeof(*data), GFP_KERNEL);
180+ data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
181181 if (!data) {
182182 BT_ERR("Can't allocate memory for data structure");
183183 return -ENOMEM;
@@ -189,14 +189,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 5 unmodified lines
189189 data->urb = usb_alloc_urb(0, GFP_KERNEL);
190190 if (!data->urb) {
191191 BT_ERR("Can't allocate URB");
192− kfree(data);
193192 return -ENOMEM;
194193 }
195194
196195 if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) {
197196 BT_ERR("Mini driver request failed");
198197 usb_free_urb(data->urb);
199− kfree(data);
200198 return -EIO;
201199 }
202200
@@ -209,7 +207,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 6 unmodified lines
209207 BT_ERR("Can't allocate memory for mini driver");
210208 release_firmware(firmware);
211209 usb_free_urb(data->urb);
212− kfree(data);
213210 return -ENOMEM;
214211 }
215212
@@ -224,7 +221,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 8 unmodified lines
224221 BT_ERR("Firmware request failed");
225222 usb_free_urb(data->urb);
226223 kfree(data->buffer);
227− kfree(data);
228224 return -EIO;
229225 }
230226
@@ -236,7 +232,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 5 unmodified lines
236232 release_firmware(firmware);
237233 usb_free_urb(data->urb);
238234 kfree(data->buffer);
239− kfree(data);
240235 return -ENOMEM;
241236 }
242237
@@ -271,7 +266,6 @@ static void bcm203x_disconnect(struct usb_interface *intf) · 28 unmodified lines
271266 usb_free_urb(data->urb);
272267 kfree(data->fw_data);
273268 kfree(data->buffer);
274− kfree(data);
275269 }
276270
277271 static struct usb_driver bcm203x_driver = {
drivers/bluetooth/bfusb.c+4−8
@@ -653,7 +653,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 652 unmodified lines
653653 }
654654
655655 /* Initialize control structure and load firmware */
656− data = kzalloc(sizeof(struct bfusb_data), GFP_KERNEL);
656+ data = devm_kzalloc(&intf->dev, sizeof(struct bfusb_data), GFP_KERNEL);
657657 if (!data) {
658658 BT_ERR("Can't allocate memory for control structure");
659659 goto done;
@@ -674,7 +674,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 14 unmodified lines
674674
675675 if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) {
676676 BT_ERR("Firmware request failed");
677− goto error;
677+ goto done;
678678 }
679679
680680 BT_DBG("firmware data %p size %zu", firmware->data, firmware->size);
@@ -690,7 +690,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 9 unmodified lines
690690 hdev = hci_alloc_dev();
691691 if (!hdev) {
692692 BT_ERR("Can't allocate HCI device");
693− goto error;
693+ goto done;
694694 }
695695
696696 data->hdev = hdev;
@@ -708,7 +708,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 11 unmodified lines
708708 if (hci_register_dev(hdev) < 0) {
709709 BT_ERR("Can't register HCI device");
710710 hci_free_dev(hdev);
711− goto error;
711+ goto done;
712712 }
713713
714714 usb_set_intfdata(intf, data);
@@ -718,9 +718,6 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 3 unmodified lines
718718 release:
719719 release_firmware(firmware);
720720
721−error:
722− kfree(data);
723−
724721 done:
725722 return -EIO;
726723 }
@@ -741,7 +738,6 @@ static void bfusb_disconnect(struct usb_interface *intf) · 14 unmodified lines
741738
742739 hci_unregister_dev(hdev);
743740 hci_free_dev(hdev);
744− kfree(data);
745741 }
746742
747743 static struct usb_driver bfusb_driver = {
drivers/bluetooth/bluecard_cs.c+2−5
@@ -681,7 +681,7 @@ static int bluecard_hci_send_frame(struct sk_buff *skb) · 680 unmodified lines
681681 case HCI_SCODATA_PKT:
682682 hdev->stat.sco_tx++;
683683 break;
684− };
684+ }
685685
686686 /* Prepend skb with frame type */
687687 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
@@ -849,7 +849,7 @@ static int bluecard_probe(struct pcmcia_device *link) · 161 unmodified lines
849849 bluecard_info_t *info;
850850
851851 /* Create new info device */
852− info = kzalloc(sizeof(*info), GFP_KERNEL);
852+ info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
853853 if (!info)
854854 return -ENOMEM;
855855
@@ -864,10 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link) · 8 unmodified lines
864864
865865 static void bluecard_detach(struct pcmcia_device *link)
866866 {
867− bluecard_info_t *info = link->priv;
868−
869867 bluecard_release(link);
870− kfree(info);
871868 }
872869
873870
drivers/bluetooth/bpa10x.c+2−6
@@ -443,7 +443,7 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * · 442 unmodified lines
443443 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
444444 return -ENODEV;
445445
446− data = kzalloc(sizeof(*data), GFP_KERNEL);
446+ data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
447447 if (!data)
448448 return -ENOMEM;
449449
@@ -453,10 +453,8 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * · 3 unmodified lines
453453 init_usb_anchor(&data->rx_anchor);
454454
455455 hdev = hci_alloc_dev();
456− if (!hdev) {
457− kfree(data);
456+ if (!hdev)
458457 return -ENOMEM;
459− }
460458
461459 hdev->bus = HCI_USB;
462460 hci_set_drvdata(hdev, data);
@@ -475,7 +473,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * · 12 unmodified lines
475473 err = hci_register_dev(hdev);
476474 if (err < 0) {
477475 hci_free_dev(hdev);
478− kfree(data);
479476 return err;
480477 }
481478
@@ -500,7 +497,6 @@ static void bpa10x_disconnect(struct usb_interface *intf) · 18 unmodified lines
500497 hci_free_dev(data->hdev);
501498 kfree_skb(data->rx_skb[0]);
502499 kfree_skb(data->rx_skb[1]);
503− kfree(data);
504500 }
505501
506502 static struct usb_driver bpa10x_driver = {
drivers/bluetooth/bt3c_cs.c+1−4
@@ -638,7 +638,7 @@ static int bt3c_probe(struct pcmcia_device *link) · 637 unmodified lines
638638 bt3c_info_t *info;
639639
640640 /* Create new info device */
641− info = kzalloc(sizeof(*info), GFP_KERNEL);
641+ info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
642642 if (!info)
643643 return -ENOMEM;
644644
@@ -654,10 +654,7 @@ static int bt3c_probe(struct pcmcia_device *link) · 9 unmodified lines
654654
655655 static void bt3c_detach(struct pcmcia_device *link)
656656 {
657− bt3c_info_t *info = link->priv;
658−
659657 bt3c_release(link);
660− kfree(info);
661658 }
662659
663660 static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
drivers/bluetooth/btmrvl_sdio.c+5−13
@@ -600,8 +600,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) · 599 unmodified lines
600600 exit:
601601 if (ret) {
602602 hdev->stat.err_rx++;
603− if (skb)
604− kfree_skb(skb);
603+ kfree_skb(skb);
605604 }
606605
607606 return ret;
@@ -956,11 +955,9 @@ static int btmrvl_sdio_probe(struct sdio_func *func, · 348 unmodified lines
956955 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
957956 id->vendor, id->device, id->class, func->num);
958957
959− card = kzalloc(sizeof(*card), GFP_KERNEL);
960− if (!card) {
961− ret = -ENOMEM;
962− goto done;
963− }
958+ card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL);
959+ if (!card)
960+ return -ENOMEM;
964961
965962 card->func = func;
966963
@@ -974,8 +971,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func, · 7 unmodified lines
974971
975972 if (btmrvl_sdio_register_dev(card) < 0) {
976973 BT_ERR("Failed to register BT device!");
977− ret = -ENODEV;
978− goto free_card;
974+ return -ENODEV;
979975 }
980976
981977 /* Disable the interrupts on the card */
@@ -1023,9 +1019,6 @@ disable_host_int: · 41 unmodified lines
10231019 btmrvl_sdio_disable_host_int(card);
10241020 unreg_dev:
10251021 btmrvl_sdio_unregister_dev(card);
1026−free_card:
1027− kfree(card);
1028−done:
10291022 return ret;
10301023 }
10311024
@@ -1047,7 +1040,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func) · 15 unmodified lines
10471040 BT_DBG("unregester dev");
10481041 btmrvl_sdio_unregister_dev(card);
10491042 btmrvl_remove_card(card->priv);
1050− kfree(card);
10511043 }
10521044 }
10531045 }
drivers/bluetooth/btsdio.c+2−6
@@ -304,7 +304,7 @@ static int btsdio_probe(struct sdio_func *func, · 303 unmodified lines
304304 tuple = tuple->next;
305305 }
306306
307− data = kzalloc(sizeof(*data), GFP_KERNEL);
307+ data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL);
308308 if (!data)
309309 return -ENOMEM;
310310
@@ -315,10 +315,8 @@ static int btsdio_probe(struct sdio_func *func, · 4 unmodified lines
315315 skb_queue_head_init(&data->txq);
316316
317317 hdev = hci_alloc_dev();
318− if (!hdev) {
319− kfree(data);
318+ if (!hdev)
320319 return -ENOMEM;
321− }
322320
323321 hdev->bus = HCI_SDIO;
324322 hci_set_drvdata(hdev, data);
@@ -340,7 +338,6 @@ static int btsdio_probe(struct sdio_func *func, · 15 unmodified lines
340338 err = hci_register_dev(hdev);
341339 if (err < 0) {
342340 hci_free_dev(hdev);
343− kfree(data);
344341 return err;
345342 }
346343
@@ -366,7 +363,6 @@ static void btsdio_remove(struct sdio_func *func) · 19 unmodified lines
366363 hci_unregister_dev(hdev);
367364
368365 hci_free_dev(hdev);
369− kfree(data);
370366 }
371367
372368 static struct sdio_driver btsdio_driver = {
drivers/bluetooth/btuart_cs.c+2−5
@@ -446,7 +446,7 @@ static int btuart_hci_send_frame(struct sk_buff *skb) · 445 unmodified lines
446446 case HCI_SCODATA_PKT:
447447 hdev->stat.sco_tx++;
448448 break;
449− };
449+ }
450450
451451 /* Prepend skb with frame type */
452452 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
@@ -567,7 +567,7 @@ static int btuart_probe(struct pcmcia_device *link) · 114 unmodified lines
567567 btuart_info_t *info;
568568
569569 /* Create new info device */
570− info = kzalloc(sizeof(*info), GFP_KERNEL);
570+ info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
571571 if (!info)
572572 return -ENOMEM;
573573
@@ -583,10 +583,7 @@ static int btuart_probe(struct pcmcia_device *link) · 9 unmodified lines
583583
584584 static void btuart_detach(struct pcmcia_device *link)
585585 {
586− btuart_info_t *info = link->priv;
587−
588586 btuart_release(link);
589− kfree(info);
590587 }
591588
592589 static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
drivers/bluetooth/btusb.c+5−11
@@ -96,11 +96,12 @@ static struct usb_device_id btusb_table[] = { · 95 unmodified lines
9696 { USB_DEVICE(0x0c10, 0x0000) },
9797
9898 /* Broadcom BCM20702A0 */
99+ { USB_DEVICE(0x04ca, 0x2003) },
99100 { USB_DEVICE(0x0489, 0xe042) },
100101 { USB_DEVICE(0x413c, 0x8197) },
101102
102103 /* Foxconn - Hon Hai */
103− { USB_DEVICE(0x0489, 0xe033) },
104+ { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01) },
104105
105106 /*Broadcom devices with vendor specific id */
106107 { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
@@ -956,7 +957,7 @@ static int btusb_probe(struct usb_interface *intf, · 849 unmodified lines
956957 return -ENODEV;
957958 }
958959
959− data = kzalloc(sizeof(*data), GFP_KERNEL);
960+ data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
960961 if (!data)
961962 return -ENOMEM;
962963
@@ -979,10 +980,8 @@ static int btusb_probe(struct usb_interface *intf, · 16 unmodified lines
979980 }
980981 }
981982
982− if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) {
983− kfree(data);
983+ if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep)
984984 return -ENODEV;
985− }
986985
987986 data->cmdreq_type = USB_TYPE_CLASS;
988987
@@ -1002,10 +1001,8 @@ static int btusb_probe(struct usb_interface *intf, · 13 unmodified lines
10021001 init_usb_anchor(&data->deferred);
10031002
10041003 hdev = hci_alloc_dev();
1005− if (!hdev) {
1006− kfree(data);
1004+ if (!hdev)
10071005 return -ENOMEM;
1008− }
10091006
10101007 hdev->bus = HCI_USB;
10111008 hci_set_drvdata(hdev, data);
@@ -1073,7 +1070,6 @@ static int btusb_probe(struct usb_interface *intf, · 61 unmodified lines
10731070 data->isoc, data);
10741071 if (err < 0) {
10751072 hci_free_dev(hdev);
1076− kfree(data);
10771073 return err;
10781074 }
10791075 }
@@ -1081,7 +1077,6 @@ static int btusb_probe(struct usb_interface *intf, · 1 unmodified line
10811077 err = hci_register_dev(hdev);
10821078 if (err < 0) {
10831079 hci_free_dev(hdev);
1084− kfree(data);
10851080 return err;
10861081 }
10871082
@@ -1114,7 +1109,6 @@ static void btusb_disconnect(struct usb_interface *intf) · 26 unmodified lines
11141109 usb_driver_release_interface(&btusb_driver, data->isoc);
11151110
11161111 hci_free_dev(hdev);
1117− kfree(data);
11181112 }
11191113
11201114 #ifdef CONFIG_PM
drivers/bluetooth/btwilink.c+3−21
@@ -297,16 +297,14 @@ static int bt_ti_probe(struct platform_device *pdev) · 296 unmodified lines
297297 struct hci_dev *hdev;
298298 int err;
299299
300− hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL);
300+ hst = devm_kzalloc(&pdev->dev, sizeof(struct ti_st), GFP_KERNEL);
301301 if (!hst)
302302 return -ENOMEM;
303303
304304 /* Expose "hciX" device to user space */
305305 hdev = hci_alloc_dev();
306− if (!hdev) {
307− kfree(hst);
306+ if (!hdev)
308307 return -ENOMEM;
309− }
310308
311309 BT_DBG("hdev %p", hdev);
312310
@@ -321,7 +319,6 @@ static int bt_ti_probe(struct platform_device *pdev) · 8 unmodified lines
321319 err = hci_register_dev(hdev);
322320 if (err < 0) {
323321 BT_ERR("Can't register HCI device error %d", err);
324− kfree(hst);
325322 hci_free_dev(hdev);
326323 return err;
327324 }
@@ -347,7 +344,6 @@ static int bt_ti_remove(struct platform_device *pdev) · 19 unmodified lines
347344 hci_unregister_dev(hdev);
348345
349346 hci_free_dev(hdev);
350− kfree(hst);
351347
352348 dev_set_drvdata(&pdev->dev, NULL);
353349 return 0;
@@ -362,21 +358,7 @@ static struct platform_driver btwilink_driver = { · 8 unmodified lines
362358 },
363359 };
364360
365−/* ------- Module Init/Exit interfaces ------ */
366−static int __init btwilink_init(void)
367−{
368− BT_INFO("Bluetooth Driver for TI WiLink - Version %s", VERSION);
369−
370− return platform_driver_register(&btwilink_driver);
371−}
372−
373−static void __exit btwilink_exit(void)
374−{
375− platform_driver_unregister(&btwilink_driver);
376−}
377−
378−module_init(btwilink_init);
379−module_exit(btwilink_exit);
361+module_platform_driver(btwilink_driver);
380362
381363 /* ------ Module Info ------ */
382364
drivers/bluetooth/dtl1_cs.c+1−2
@@ -550,7 +550,7 @@ static int dtl1_probe(struct pcmcia_device *link) · 549 unmodified lines
550550 dtl1_info_t *info;
551551
552552 /* Create new info device */
553− info = kzalloc(sizeof(*info), GFP_KERNEL);
553+ info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
554554 if (!info)
555555 return -ENOMEM;
556556
@@ -569,7 +569,6 @@ static void dtl1_detach(struct pcmcia_device *link) · 12 unmodified lines
569569
570570 dtl1_close(info);
571571 pcmcia_disable_device(link);
572− kfree(info);
573572 }
574573
575574 static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
drivers/bluetooth/hci_ldisc.c+1−1
@@ -531,7 +531,7 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file * file, · 530 unmodified lines
531531 default:
532532 err = n_tty_ioctl_helper(tty, file, cmd, arg);
533533 break;
534− };
534+ }
535535
536536 return err;
537537 }
drivers/bluetooth/hci_ll.c+1−1
@@ -481,7 +481,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count) · 480 unmodified lines
481481 hu->hdev->stat.err_rx++;
482482 ptr++; count--;
483483 continue;
484− };
484+ }
485485
486486 ptr++; count--;
487487
drivers/bluetooth/hci_vhci.c+1−1
@@ -156,7 +156,7 @@ static inline ssize_t vhci_put_user(struct vhci_data *data, · 155 unmodified lines
156156 case HCI_SCODATA_PKT:
157157 data->hdev->stat.sco_tx++;
158158 break;
159− };
159+ }
160160
161161 return total;
162162 }
drivers/connector/connector.c+1−2
@@ -264,8 +264,7 @@ static int __devinit cn_init(void) · 263 unmodified lines
264264 .input = dev->input,
265265 };
266266
267− dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR,
268− THIS_MODULE, &cfg);
267+ dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, &cfg);
269268 if (!dev->nls)
270269 return -EIO;
271270
drivers/infiniband/core/netlink.c+1−1
@@ -177,7 +177,7 @@ int __init ibnl_init(void) · 176 unmodified lines
177177 .input = ibnl_rcv,
178178 };
179179
180− nls = netlink_kernel_create(&init_net, NETLINK_RDMA, THIS_MODULE, &cfg);
180+ nls = netlink_kernel_create(&init_net, NETLINK_RDMA, &cfg);
181181 if (!nls) {
182182 pr_warn("Failed to create netlink socket\n");
183183 return -ENOMEM;
drivers/infiniband/hw/cxgb4/qp.c+1−1
@@ -1155,7 +1155,7 @@ static int ring_kernel_db(struct c4iw_qp *qhp, u32 qid, u16 inc) · 1154 unmodified lines
11551155 */
11561156 if (cxgb4_dbfifo_count(qhp->rhp->rdev.lldi.ports[0], 1) <
11571157 (qhp->rhp->rdev.lldi.dbfifo_int_thresh << 5)) {
1158− writel(V_QID(qid) | V_PIDX(inc), qhp->wq.db);
1158+ writel(QID(qid) | PIDX(inc), qhp->wq.db);
11591159 break;
11601160 }
11611161 set_current_state(TASK_UNINTERRUPTIBLE);
drivers/infiniband/ulp/ipoib/Makefile+2−1
@@ -5,7 +5,8 @@ ib_ipoib-y := ipoib_main.o \ · 4 unmodified lines
55 ipoib_multicast.o \
66 ipoib_verbs.o \
77 ipoib_vlan.o \
8− ipoib_ethtool.o
8+ ipoib_ethtool.o \
9+ ipoib_netlink.o
910 ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_CM) += ipoib_cm.o
1011 ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_DEBUG) += ipoib_fs.o
1112
drivers/infiniband/ulp/ipoib/ipoib.h+16−0
@@ -104,6 +104,10 @@ enum { · 103 unmodified lines
104104
105105 MAX_SEND_CQE = 16,
106106 IPOIB_CM_COPYBREAK = 256,
107+
108+ IPOIB_NON_CHILD = 0,
109+ IPOIB_LEGACY_CHILD = 1,
110+ IPOIB_RTNL_CHILD = 2,
107111 };
108112
109113 #define IPOIB_OP_RECV (1ul << 31)
@@ -353,6 +357,7 @@ struct ipoib_dev_priv { · 243 unmodified lines
353357 struct net_device *parent;
354358 struct list_head child_intfs;
355359 struct list_head list;
360+ int child_type;
356361
357362 #ifdef CONFIG_INFINIBAND_IPOIB_CM
358363 struct ipoib_cm_dev_priv cm;
@@ -512,6 +517,17 @@ void ipoib_event(struct ib_event_handler *handler, · 153 unmodified lines
512517 int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey);
513518 int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);
514519
520+int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
521+ u16 pkey, int child_type);
522+
523+int __init ipoib_netlink_init(void);
524+void __exit ipoib_netlink_fini(void);
525+
526+void ipoib_set_umcast(struct net_device *ndev, int umcast_val);
527+int ipoib_set_mode(struct net_device *dev, const char *buf);
528+
529+void ipoib_setup(struct net_device *dev);
530+
515531 void ipoib_pkey_poll(struct work_struct *work);
516532 int ipoib_pkey_dev_delay_open(struct net_device *dev);
517533 void ipoib_drain_cq(struct net_device *dev);
drivers/infiniband/ulp/ipoib/ipoib_cm.c+24−10
@@ -1448,15 +1448,10 @@ static ssize_t show_mode(struct device *d, struct device_attribute *attr, · 1447 unmodified lines
14481448 return sprintf(buf, "datagram\n");
14491449 }
14501450
1451−static ssize_t set_mode(struct device *d, struct device_attribute *attr,
1452− const char *buf, size_t count)
1451+int ipoib_set_mode(struct net_device *dev, const char *buf)
14531452 {
1454− struct net_device *dev = to_net_dev(d);
14551453 struct ipoib_dev_priv *priv = netdev_priv(dev);
14561454
1457− if (!rtnl_trylock())
1458− return restart_syscall();
1459−
14601455 /* flush paths if we switch modes so that connections are restarted */
14611456 if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) {
14621457 set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
@@ -1467,7 +1462,8 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, · 4 unmodified lines
14671462 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
14681463
14691464 ipoib_flush_paths(dev);
1470− return count;
1465+ rtnl_lock();
1466+ return 0;
14711467 }
14721468
14731469 if (!strcmp(buf, "datagram\n")) {
@@ -1476,14 +1472,32 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, · 2 unmodified lines
14761472 dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
14771473 rtnl_unlock();
14781474 ipoib_flush_paths(dev);
1479−
1480− return count;
1475+ rtnl_lock();
1476+ return 0;
14811477 }
1482− rtnl_unlock();
14831478
14841479 return -EINVAL;
14851480 }
14861481
1482+static ssize_t set_mode(struct device *d, struct device_attribute *attr,
1483+ const char *buf, size_t count)
1484+{
1485+ struct net_device *dev = to_net_dev(d);
1486+ int ret;
1487+
1488+ if (!rtnl_trylock())
1489+ return restart_syscall();
1490+
1491+ ret = ipoib_set_mode(dev, buf);
1492+
1493+ rtnl_unlock();
1494+
1495+ if (!ret)
1496+ return count;
1497+
1498+ return ret;
1499+}
1500+
14871501 static DEVICE_ATTR(mode, S_IWUSR | S_IRUGO, show_mode, set_mode);
14881502
14891503 int ipoib_cm_add_mode_attr(struct net_device *dev)
drivers/infiniband/ulp/ipoib/ipoib_main.c+31−10
@@ -173,6 +173,11 @@ static int ipoib_stop(struct net_device *dev) · 172 unmodified lines
173173 return 0;
174174 }
175175
176+static void ipoib_uninit(struct net_device *dev)
177+{
178+ ipoib_dev_cleanup(dev);
179+}
180+
176181 static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features)
177182 {
178183 struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -1257,6 +1262,9 @@ out: · 1078 unmodified lines
12571262 void ipoib_dev_cleanup(struct net_device *dev)
12581263 {
12591264 struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv;
1265+ LIST_HEAD(head);
1266+
1267+ ASSERT_RTNL();
12601268
12611269 ipoib_delete_debug_files(dev);
12621270
@@ -1265,10 +1273,9 @@ void ipoib_dev_cleanup(struct net_device *dev) · 2 unmodified lines
12651273 /* Stop GC on child */
12661274 set_bit(IPOIB_STOP_NEIGH_GC, &cpriv->flags);
12671275 cancel_delayed_work(&cpriv->neigh_reap_task);
1268− unregister_netdev(cpriv->dev);
1269− ipoib_dev_cleanup(cpriv->dev);
1270− free_netdev(cpriv->dev);
1276+ unregister_netdevice_queue(cpriv->dev, &head);
12711277 }
1278+ unregister_netdevice_many(&head);
12721279
12731280 ipoib_ib_dev_cleanup(dev);
12741281
@@ -1286,6 +1293,7 @@ static const struct header_ops ipoib_header_ops = { · 11 unmodified lines
12861293 };
12871294
12881295 static const struct net_device_ops ipoib_netdev_ops = {
1296+ .ndo_uninit = ipoib_uninit,
12891297 .ndo_open = ipoib_open,
12901298 .ndo_stop = ipoib_stop,
12911299 .ndo_change_mtu = ipoib_change_mtu,
@@ -1295,7 +1303,7 @@ static const struct net_device_ops ipoib_netdev_ops = { · 3 unmodified lines
12951303 .ndo_set_rx_mode = ipoib_set_mcast_list,
12961304 };
12971305
1298−static void ipoib_setup(struct net_device *dev)
1306+void ipoib_setup(struct net_device *dev)
12991307 {
13001308 struct ipoib_dev_priv *priv = netdev_priv(dev);
13011309
@@ -1373,12 +1381,9 @@ static ssize_t show_umcast(struct device *dev, · 71 unmodified lines
13731381 return sprintf(buf, "%d\n", test_bit(IPOIB_FLAG_UMCAST, &priv->flags));
13741382 }
13751383
1376−static ssize_t set_umcast(struct device *dev,
1377− struct device_attribute *attr,
1378− const char *buf, size_t count)
1384+void ipoib_set_umcast(struct net_device *ndev, int umcast_val)
13791385 {
1380− struct ipoib_dev_priv *priv = netdev_priv(to_net_dev(dev));
1381− unsigned long umcast_val = simple_strtoul(buf, NULL, 0);
1386+ struct ipoib_dev_priv *priv = netdev_priv(ndev);
13821387
13831388 if (umcast_val > 0) {
13841389 set_bit(IPOIB_FLAG_UMCAST, &priv->flags);
@@ -1386,6 +1391,15 @@ static ssize_t set_umcast(struct device *dev, · 1 unmodified line
13861391 "by userspace\n");
13871392 } else
13881393 clear_bit(IPOIB_FLAG_UMCAST, &priv->flags);
1394+}
1395+
1396+static ssize_t set_umcast(struct device *dev,
1397+ struct device_attribute *attr,
1398+ const char *buf, size_t count)
1399+{
1400+ unsigned long umcast_val = simple_strtoul(buf, NULL, 0);
1401+
1402+ ipoib_set_umcast(to_net_dev(dev), umcast_val);
13891403
13901404 return count;
13911405 }
@@ -1657,7 +1671,6 @@ static void ipoib_remove_one(struct ib_device *device) · 265 unmodified lines
16571671 flush_workqueue(ipoib_workqueue);
16581672
16591673 unregister_netdev(priv->dev);
1660− ipoib_dev_cleanup(priv->dev);
16611674 free_netdev(priv->dev);
16621675 }
16631676
@@ -1709,8 +1722,15 @@ static int __init ipoib_init_module(void) · 45 unmodified lines
17091722 if (ret)
17101723 goto err_sa;
17111724
1725+ ret = ipoib_netlink_init();
1726+ if (ret)
1727+ goto err_client;
1728+
17121729 return 0;
17131730
1731+err_client:
1732+ ib_unregister_client(&ipoib_client);
1733+
17141734 err_sa:
17151735 ib_sa_unregister_client(&ipoib_sa_client);
17161736 destroy_workqueue(ipoib_workqueue);
@@ -1723,6 +1743,7 @@ err_fs: · 6 unmodified lines
17231743
17241744 static void __exit ipoib_cleanup_module(void)
17251745 {
1746+ ipoib_netlink_fini();
17261747 ib_unregister_client(&ipoib_client);
17271748 ib_sa_unregister_client(&ipoib_sa_client);
17281749 ipoib_unregister_debugfs();
drivers/infiniband/ulp/ipoib/ipoib_netlink.c+172−0
@@ -0,0 +1,172 @@
1+/*
2+ * Copyright (c) 2012 Mellanox Technologies. - All rights reserved.
3+ *
4+ * This software is available to you under a choice of one of two
5+ * licenses. You may choose to be licensed under the terms of the GNU
6+ * General Public License (GPL) Version 2, available from the file
7+ * COPYING in the main directory of this source tree, or the
8+ * OpenIB.org BSD license below:
9+ *
10+ * Redistribution and use in source and binary forms, with or
11+ * without modification, are permitted provided that the following
12+ * conditions are met:
13+ *
14+ * - Redistributions of source code must retain the above
15+ * copyright notice, this list of conditions and the following
16+ * disclaimer.
17+ *
18+ * - Redistributions in binary form must reproduce the above
19+ * copyright notice, this list of conditions and the following
20+ * disclaimer in the documentation and/or other materials
21+ * provided with the distribution.
22+ *
23+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30+ * SOFTWARE.
31+ */
32+
33+#include <linux/netdevice.h>
34+#include <linux/module.h>
35+#include <net/rtnetlink.h>
36+#include "ipoib.h"
37+
38+static const struct nla_policy ipoib_policy[IFLA_IPOIB_MAX + 1] = {
39+ [IFLA_IPOIB_PKEY] = { .type = NLA_U16 },
40+ [IFLA_IPOIB_MODE] = { .type = NLA_U16 },
41+ [IFLA_IPOIB_UMCAST] = { .type = NLA_U16 },
42+};
43+
44+static int ipoib_fill_info(struct sk_buff *skb, const struct net_device *dev)
45+{
46+ struct ipoib_dev_priv *priv = netdev_priv(dev);
47+ u16 val;
48+
49+ if (nla_put_u16(skb, IFLA_IPOIB_PKEY, priv->pkey))
50+ goto nla_put_failure;
51+
52+ val = test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
53+ if (nla_put_u16(skb, IFLA_IPOIB_MODE, val))
54+ goto nla_put_failure;
55+
56+ val = test_bit(IPOIB_FLAG_UMCAST, &priv->flags);
57+ if (nla_put_u16(skb, IFLA_IPOIB_UMCAST, val))
58+ goto nla_put_failure;
59+
60+ return 0;
61+
62+nla_put_failure:
63+ return -EMSGSIZE;
64+}
65+
66+static int ipoib_changelink(struct net_device *dev,
67+ struct nlattr *tb[], struct nlattr *data[])
68+{
69+ u16 mode, umcast;
70+ int ret = 0;
71+
72+ if (data[IFLA_IPOIB_MODE]) {
73+ mode = nla_get_u16(data[IFLA_IPOIB_MODE]);
74+ if (mode == IPOIB_MODE_DATAGRAM)
75+ ret = ipoib_set_mode(dev, "datagram\n");
76+ else if (mode == IPOIB_MODE_CONNECTED)
77+ ret = ipoib_set_mode(dev, "connected\n");
78+ else
79+ ret = -EINVAL;
80+
81+ if (ret < 0)
82+ goto out_err;
83+ }
84+
85+ if (data[IFLA_IPOIB_UMCAST]) {
86+ umcast = nla_get_u16(data[IFLA_IPOIB_UMCAST]);
87+ ipoib_set_umcast(dev, umcast);
88+ }
89+
90+out_err:
91+ return ret;
92+}
93+
94+static int ipoib_new_child_link(struct net *src_net, struct net_device *dev,
95+ struct nlattr *tb[], struct nlattr *data[])
96+{
97+ struct net_device *pdev;
98+ struct ipoib_dev_priv *ppriv;
99+ u16 child_pkey;
100+ int err;
101+
102+ if (!tb[IFLA_LINK])
103+ return -EINVAL;
104+
105+ pdev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
106+ if (!pdev)
107+ return -ENODEV;
108+
109+ ppriv = netdev_priv(pdev);
110+
111+ if (test_bit(IPOIB_FLAG_SUBINTERFACE, &ppriv->flags)) {
112+ ipoib_warn(ppriv, "child creation disallowed for child devices\n");
113+ return -EINVAL;
114+ }
115+
116+ if (!data || !data[IFLA_IPOIB_PKEY]) {
117+ ipoib_dbg(ppriv, "no pkey specified, using parent pkey\n");
118+ child_pkey = ppriv->pkey;
119+ } else
120+ child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]);
121+
122+ err = __ipoib_vlan_add(ppriv, netdev_priv(dev), child_pkey, IPOIB_RTNL_CHILD);
123+
124+ if (!err && data)
125+ err = ipoib_changelink(dev, tb, data);
126+ return err;
127+}
128+
129+static void ipoib_unregister_child_dev(struct net_device *dev, struct list_head *head)
130+{
131+ struct ipoib_dev_priv *priv, *ppriv;
132+
133+ priv = netdev_priv(dev);
134+ ppriv = netdev_priv(priv->parent);
135+
136+ mutex_lock(&ppriv->vlan_mutex);
137+ unregister_netdevice_queue(dev, head);
138+ list_del(&priv->list);
139+ mutex_unlock(&ppriv->vlan_mutex);
140+}
141+
142+static size_t ipoib_get_size(const struct net_device *dev)
143+{
144+ return nla_total_size(2) + /* IFLA_IPOIB_PKEY */
145+ nla_total_size(2) + /* IFLA_IPOIB_MODE */
146+ nla_total_size(2); /* IFLA_IPOIB_UMCAST */
147+}
148+
149+static struct rtnl_link_ops ipoib_link_ops __read_mostly = {
150+ .kind = "ipoib",
151+ .maxtype = IFLA_IPOIB_MAX,
152+ .policy = ipoib_policy,
153+ .priv_size = sizeof(struct ipoib_dev_priv),
154+ .setup = ipoib_setup,
155+ .newlink = ipoib_new_child_link,
156+ .changelink = ipoib_changelink,
157+ .dellink = ipoib_unregister_child_dev,
158+ .get_size = ipoib_get_size,
159+ .fill_info = ipoib_fill_info,
160+};
161+
162+int __init ipoib_netlink_init(void)
163+{
164+ return rtnl_link_register(&ipoib_link_ops);
165+}
166+
167+void __exit ipoib_netlink_fini(void)
168+{
169+ rtnl_link_unregister(&ipoib_link_ops);
170+}
171+
172+MODULE_ALIAS_RTNL_LINK("ipoib");
drivers/infiniband/ulp/ipoib/ipoib_vlan.c+70−54
@@ -49,47 +49,11 @@ static ssize_t show_parent(struct device *d, struct device_attribute *attr, · 48 unmodified lines
4949 }
5050 static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
5151
52−int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
52+int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
53+ u16 pkey, int type)
5354 {
54− struct ipoib_dev_priv *ppriv, *priv;
55− char intf_name[IFNAMSIZ];
5655 int result;
5756
58− if (!capable(CAP_NET_ADMIN))
59− return -EPERM;
60−
61− ppriv = netdev_priv(pdev);
62−
63− if (!rtnl_trylock())
64− return restart_syscall();
65− mutex_lock(&ppriv->vlan_mutex);
66−
67− /*
68− * First ensure this isn't a duplicate. We check the parent device and
69− * then all of the child interfaces to make sure the Pkey doesn't match.
70− */
71− if (ppriv->pkey == pkey) {
72− result = -ENOTUNIQ;
73− priv = NULL;
74− goto err;
75− }
76−
77− list_for_each_entry(priv, &ppriv->child_intfs, list) {
78− if (priv->pkey == pkey) {
79− result = -ENOTUNIQ;
80− priv = NULL;
81− goto err;
82− }
83− }
84−
85− snprintf(intf_name, sizeof intf_name, "%s.%04x",
86− ppriv->dev->name, pkey);
87− priv = ipoib_intf_alloc(intf_name);
88− if (!priv) {
89− result = -ENOMEM;
90− goto err;
91− }
92−
9357 priv->max_ib_mtu = ppriv->max_ib_mtu;
9458 /* MTU will be reset when mcast join happens */
9559 priv->dev->mtu = IPOIB_UD_MTU(priv->max_ib_mtu);
@@ -124,24 +88,27 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) · 28 unmodified lines
12488
12589 ipoib_create_debug_files(priv->dev);
12690
127− if (ipoib_cm_add_mode_attr(priv->dev))
128− goto sysfs_failed;
129− if (ipoib_add_pkey_attr(priv->dev))
130− goto sysfs_failed;
131− if (ipoib_add_umcast_attr(priv->dev))
132− goto sysfs_failed;
133−
134− if (device_create_file(&priv->dev->dev, &dev_attr_parent))
135− goto sysfs_failed;
91+ /* RTNL childs don't need proprietary sysfs entries */
92+ if (type == IPOIB_LEGACY_CHILD) {
93+ if (ipoib_cm_add_mode_attr(priv->dev))
94+ goto sysfs_failed;
95+ if (ipoib_add_pkey_attr(priv->dev))
96+ goto sysfs_failed;
97+ if (ipoib_add_umcast_attr(priv->dev))
98+ goto sysfs_failed;
99+
100+ if (device_create_file(&priv->dev->dev, &dev_attr_parent))
101+ goto sysfs_failed;
102+ }
136103
104+ priv->child_type = type;
105+ priv->dev->iflink = ppriv->dev->ifindex;
137106 list_add_tail(&priv->list, &ppriv->child_intfs);
138107
139− mutex_unlock(&ppriv->vlan_mutex);
140− rtnl_unlock();
141−
142108 return 0;
143109
144110 sysfs_failed:
111+ result = -ENOMEM;
145112 ipoib_delete_debug_files(priv->dev);
146113 unregister_netdevice(priv->dev);
147114
@@ -149,11 +116,60 @@ register_failed: · 1 unmodified line
149116 ipoib_dev_cleanup(priv->dev);
150117
151118 err:
119+ return result;
120+}
121+
122+int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
123+{
124+ struct ipoib_dev_priv *ppriv, *priv;
125+ char intf_name[IFNAMSIZ];
126+ struct ipoib_dev_priv *tpriv;
127+ int result;
128+
129+ if (!capable(CAP_NET_ADMIN))
130+ return -EPERM;
131+
132+ ppriv = netdev_priv(pdev);
133+
134+ snprintf(intf_name, sizeof intf_name, "%s.%04x",
135+ ppriv->dev->name, pkey);
136+ priv = ipoib_intf_alloc(intf_name);
137+ if (!priv)
138+ return -ENOMEM;
139+
140+ if (!rtnl_trylock())
141+ return restart_syscall();
142+
143+ mutex_lock(&ppriv->vlan_mutex);
144+
145+ /*
146+ * First ensure this isn't a duplicate. We check the parent device and
147+ * then all of the legacy child interfaces to make sure the Pkey
148+ * doesn't match.
149+ */
150+ if (ppriv->pkey == pkey) {
151+ result = -ENOTUNIQ;
152+ goto out;
153+ }
154+
155+ list_for_each_entry(tpriv, &ppriv->child_intfs, list) {
156+ if (tpriv->pkey == pkey &&
157+ tpriv->child_type == IPOIB_LEGACY_CHILD) {
158+ result = -ENOTUNIQ;
159+ goto out;
160+ }
161+ }
162+
163+ result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD);
164+
165+out:
152166 mutex_unlock(&ppriv->vlan_mutex);
153− rtnl_unlock();
154− if (priv)
167+
168+ if (result)
155169 free_netdev(priv->dev);
156170
171+ rtnl_unlock();
172+
157173 return result;
158174 }
159175
@@ -171,9 +187,9 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) · 11 unmodified lines
171187 return restart_syscall();
172188 mutex_lock(&ppriv->vlan_mutex);
173189 list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
174− if (priv->pkey == pkey) {
190+ if (priv->pkey == pkey &&
191+ priv->child_type == IPOIB_LEGACY_CHILD) {
175192 unregister_netdevice(priv->dev);
176− ipoib_dev_cleanup(priv->dev);
177193 list_del(&priv->list);
178194 dev = priv->dev;
179195 break;
drivers/isdn/gigaset/common.c+0−1
@@ -1123,7 +1123,6 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, · 1122 unmodified lines
11231123 return drv;
11241124
11251125 error:
1126− kfree(drv->cs);
11271126 kfree(drv);
11281127 return NULL;
11291128 }
drivers/net/Kconfig+15−2
@@ -107,8 +107,6 @@ config MII · 106 unmodified lines
107107 or internal device. It is safe to say Y or M here even if your
108108 ethernet card lacks MII.
109109
110−source "drivers/ieee802154/Kconfig"
111−
112110 config IFB
113111 tristate "Intermediate Functional Block support"
114112 depends on NET_CLS_ACT
@@ -151,6 +149,19 @@ config MACVTAP · 36 unmodified lines
151149 To compile this driver as a module, choose M here: the module
152150 will be called macvtap.
153151
152+config VXLAN
153+ tristate "Virtual eXtensible Local Area Network (VXLAN)"
154+ depends on EXPERIMENTAL && INET
155+ ---help---
156+ This allows one to create vxlan virtual interfaces that provide
157+ Layer 2 Networks over Layer 3 Networks. VXLAN is often used
158+ to tunnel virtual network infrastructure in virtualized environments.
159+ For more information see:
160+ http://tools.ietf.org/html/draft-mahalingam-dutt-dcops-vxlan-02
161+
162+ To compile this driver as a module, choose M here: the module
163+ will be called vxlan.
164+
154165 config NETCONSOLE
155166 tristate "Network console logging support"
156167 ---help---
@@ -290,6 +301,8 @@ source "drivers/net/wimax/Kconfig" · 133 unmodified lines
290301
291302 source "drivers/net/wan/Kconfig"
292303
304+source "drivers/net/ieee802154/Kconfig"
305+
293306 config XEN_NETDEV_FRONTEND
294307 tristate "Xen network device frontend driver"
295308 depends on XEN
drivers/net/Makefile+2−0
@@ -21,6 +21,7 @@ obj-$(CONFIG_NET_TEAM) += team/ · 20 unmodified lines
2121 obj-$(CONFIG_TUN) += tun.o
2222 obj-$(CONFIG_VETH) += veth.o
2323 obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
24+obj-$(CONFIG_VXLAN) += vxlan.o
2425
2526 #
2627 # Networking Drivers
@@ -53,6 +54,7 @@ obj-$(CONFIG_SUNGEM_PHY) += sungem_phy.o · 26 unmodified lines
5354 obj-$(CONFIG_WAN) += wan/
5455 obj-$(CONFIG_WLAN) += wireless/
5556 obj-$(CONFIG_WIMAX) += wimax/
57+obj-$(CONFIG_IEEE802154) += ieee802154/
5658
5759 obj-$(CONFIG_VMXNET3) += vmxnet3/
5860 obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
drivers/net/bonding/bond_main.c+93−47
@@ -1120,10 +1120,10 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) · 1119 unmodified lines
11201120 write_unlock_bh(&bond->curr_slave_lock);
11211121 read_unlock(&bond->lock);
11221122
1123− netdev_bonding_change(bond->dev, NETDEV_BONDING_FAILOVER);
1123+ call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev);
11241124 if (should_notify_peers)
1125− netdev_bonding_change(bond->dev,
1126− NETDEV_NOTIFY_PEERS);
1125+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS,
1126+ bond->dev);
11271127
11281128 read_lock(&bond->lock);
11291129 write_lock_bh(&bond->curr_slave_lock);
@@ -1558,8 +1558,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 428 unmodified lines
15581558 bond_dev->name,
15591559 bond_dev->type, slave_dev->type);
15601560
1561− res = netdev_bonding_change(bond_dev,
1562− NETDEV_PRE_TYPE_CHANGE);
1561+ res = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
1562+ bond_dev);
15631563 res = notifier_to_errno(res);
15641564 if (res) {
15651565 pr_err("%s: refused to change device type\n",
@@ -1579,8 +1579,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 13 unmodified lines
15791579 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
15801580 }
15811581
1582− netdev_bonding_change(bond_dev,
1583− NETDEV_POST_TYPE_CHANGE);
1582+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
1583+ bond_dev);
15841584 }
15851585 } else if (bond_dev->type != slave_dev->type) {
15861586 pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n",
@@ -1941,7 +1941,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) · 354 unmodified lines
19411941 }
19421942
19431943 block_netpoll_tx();
1944− netdev_bonding_change(bond_dev, NETDEV_RELEASE);
1944+ call_netdevice_notifiers(NETDEV_RELEASE, bond_dev);
19451945 write_lock_bh(&bond->lock);
19461946
19471947 slave = bond_get_slave_by_dev(bond, slave_dev);
@@ -2584,7 +2584,7 @@ re_arm: · 636 unmodified lines
25842584 read_unlock(&bond->lock);
25852585 return;
25862586 }
2587− netdev_bonding_change(bond->dev, NETDEV_NOTIFY_PEERS);
2587+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
25882588 rtnl_unlock();
25892589 }
25902590 }
@@ -2811,12 +2811,13 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 220 unmodified lines
28112811 arp_work.work);
28122812 struct slave *slave, *oldcurrent;
28132813 int do_failover = 0;
2814− int delta_in_ticks;
2814+ int delta_in_ticks, extra_ticks;
28152815 int i;
28162816
28172817 read_lock(&bond->lock);
28182818
28192819 delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);
2820+ extra_ticks = delta_in_ticks / 2;
28202821
28212822 if (bond->slave_cnt == 0)
28222823 goto re_arm;
@@ -2839,10 +2840,10 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 16 unmodified lines
28392840 if (slave->link != BOND_LINK_UP) {
28402841 if (time_in_range(jiffies,
28412842 trans_start - delta_in_ticks,
2842− trans_start + delta_in_ticks) &&
2843+ trans_start + delta_in_ticks + extra_ticks) &&
28432844 time_in_range(jiffies,
28442845 slave->dev->last_rx - delta_in_ticks,
2845− slave->dev->last_rx + delta_in_ticks)) {
2846+ slave->dev->last_rx + delta_in_ticks + extra_ticks)) {
28462847
28472848 slave->link = BOND_LINK_UP;
28482849 bond_set_active_slave(slave);
@@ -2872,10 +2873,10 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 23 unmodified lines
28722873 */
28732874 if (!time_in_range(jiffies,
28742875 trans_start - delta_in_ticks,
2875− trans_start + 2 * delta_in_ticks) ||
2876+ trans_start + 2 * delta_in_ticks + extra_ticks) ||
28762877 !time_in_range(jiffies,
28772878 slave->dev->last_rx - delta_in_ticks,
2878− slave->dev->last_rx + 2 * delta_in_ticks)) {
2879+ slave->dev->last_rx + 2 * delta_in_ticks + extra_ticks)) {
28792880
28802881 slave->link = BOND_LINK_DOWN;
28812882 bond_set_backup_slave(slave);
@@ -2933,6 +2934,14 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 51 unmodified lines
29332934 struct slave *slave;
29342935 int i, commit = 0;
29352936 unsigned long trans_start;
2937+ int extra_ticks;
2938+
2939+ /* All the time comparisons below need some extra time. Otherwise, on
2940+ * fast networks the ARP probe/reply may arrive within the same jiffy
2941+ * as it was sent. Then, the next time the ARP monitor is run, one
2942+ * arp_interval will already have passed in the comparisons.
2943+ */
2944+ extra_ticks = delta_in_ticks / 2;
29362945
29372946 bond_for_each_slave(bond, slave, i) {
29382947 slave->new_link = BOND_LINK_NOCHANGE;
@@ -2940,7 +2949,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 1 unmodified line
29402949 if (slave->link != BOND_LINK_UP) {
29412950 if (time_in_range(jiffies,
29422951 slave_last_rx(bond, slave) - delta_in_ticks,
2943− slave_last_rx(bond, slave) + delta_in_ticks)) {
2952+ slave_last_rx(bond, slave) + delta_in_ticks + extra_ticks)) {
29442953
29452954 slave->new_link = BOND_LINK_UP;
29462955 commit++;
@@ -2956,7 +2965,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 9 unmodified lines
29562965 */
29572966 if (time_in_range(jiffies,
29582967 slave->jiffies - delta_in_ticks,
2959− slave->jiffies + 2 * delta_in_ticks))
2968+ slave->jiffies + 2 * delta_in_ticks + extra_ticks))
29602969 continue;
29612970
29622971 /*
@@ -2976,7 +2985,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 13 unmodified lines
29762985 !bond->current_arp_slave &&
29772986 !time_in_range(jiffies,
29782987 slave_last_rx(bond, slave) - delta_in_ticks,
2979− slave_last_rx(bond, slave) + 3 * delta_in_ticks)) {
2988+ slave_last_rx(bond, slave) + 3 * delta_in_ticks + extra_ticks)) {
29802989
29812990 slave->new_link = BOND_LINK_DOWN;
29822991 commit++;
@@ -2992,10 +3001,10 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 9 unmodified lines
29923001 if (bond_is_active_slave(slave) &&
29933002 (!time_in_range(jiffies,
29943003 trans_start - delta_in_ticks,
2995− trans_start + 2 * delta_in_ticks) ||
3004+ trans_start + 2 * delta_in_ticks + extra_ticks) ||
29963005 !time_in_range(jiffies,
29973006 slave_last_rx(bond, slave) - delta_in_ticks,
2998− slave_last_rx(bond, slave) + 2 * delta_in_ticks))) {
3007+ slave_last_rx(bond, slave) + 2 * delta_in_ticks + extra_ticks))) {
29993008
30003009 slave->new_link = BOND_LINK_DOWN;
30013010 commit++;
@@ -3027,7 +3036,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) · 25 unmodified lines
30273036 if ((!bond->curr_active_slave &&
30283037 time_in_range(jiffies,
30293038 trans_start - delta_in_ticks,
3030− trans_start + delta_in_ticks)) ||
3039+ trans_start + delta_in_ticks + delta_in_ticks / 2)) ||
30313040 bond->curr_active_slave != slave) {
30323041 slave->link = BOND_LINK_UP;
30333042 if (bond->current_arp_slave) {
@@ -3203,7 +3212,7 @@ re_arm: · 169 unmodified lines
32033212 read_unlock(&bond->lock);
32043213 return;
32053214 }
3206− netdev_bonding_change(bond->dev, NETDEV_NOTIFY_PEERS);
3215+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
32073216 rtnl_unlock();
32083217 }
32093218 }
@@ -3351,57 +3360,94 @@ static struct notifier_block bond_netdev_notifier = { · 141 unmodified lines
33513360
33523361 /*---------------------------- Hashing Policies -----------------------------*/
33533362
3363+/*
3364+ * Hash for the output device based upon layer 2 data
3365+ */
3366+static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
3367+{
3368+ struct ethhdr *data = (struct ethhdr *)skb->data;
3369+
3370+ if (skb_headlen(skb) >= offsetof(struct ethhdr, h_proto))
3371+ return (data->h_dest[5] ^ data->h_source[5]) % count;
3372+
3373+ return 0;
3374+}
3375+
33543376 /*
33553377 * Hash for the output device based upon layer 2 and layer 3 data. If
3356− * the packet is not IP mimic bond_xmit_hash_policy_l2()
3378+ * the packet is not IP, fall back on bond_xmit_hash_policy_l2()
33573379 */
33583380 static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
33593381 {
33603382 struct ethhdr *data = (struct ethhdr *)skb->data;
3361− struct iphdr *iph = ip_hdr(skb);
3362−
3363− if (skb->protocol == htons(ETH_P_IP)) {
3383+ struct iphdr *iph;
3384+ struct ipv6hdr *ipv6h;
3385+ u32 v6hash;
3386+ __be32 *s, *d;
3387+
3388+ if (skb->protocol == htons(ETH_P_IP) &&
3389+ skb_network_header_len(skb) >= sizeof(*iph)) {
3390+ iph = ip_hdr(skb);
33643391 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
33653392 (data->h_dest[5] ^ data->h_source[5])) % count;
3393+ } else if (skb->protocol == htons(ETH_P_IPV6) &&
3394+ skb_network_header_len(skb) >= sizeof(*ipv6h)) {
3395+ ipv6h = ipv6_hdr(skb);
3396+ s = &ipv6h->saddr.s6_addr32[0];
3397+ d = &ipv6h->daddr.s6_addr32[0];
3398+ v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
3399+ v6hash ^= (v6hash >> 24) ^ (v6hash >> 16) ^ (v6hash >> 8);
3400+ return (v6hash ^ data->h_dest[5] ^ data->h_source[5]) % count;
33663401 }
33673402
3368− return (data->h_dest[5] ^ data->h_source[5]) % count;
3403+ return bond_xmit_hash_policy_l2(skb, count);
33693404 }
33703405
33713406 /*
33723407 * Hash for the output device based upon layer 3 and layer 4 data. If
33733408 * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is
3374− * altogether not IP, mimic bond_xmit_hash_policy_l2()
3409+ * altogether not IP, fall back on bond_xmit_hash_policy_l2()
33753410 */
33763411 static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
33773412 {
3378− struct ethhdr *data = (struct ethhdr *)skb->data;
3379− struct iphdr *iph = ip_hdr(skb);
3380− __be16 *layer4hdr = (__be16 *)((u32 *)iph + iph->ihl);
3381− int layer4_xor = 0;
3382−
3383− if (skb->protocol == htons(ETH_P_IP)) {
3413+ u32 layer4_xor = 0;
3414+ struct iphdr *iph;
3415+ struct ipv6hdr *ipv6h;
3416+ __be32 *s, *d;
3417+ __be16 *layer4hdr;
3418+
3419+ if (skb->protocol == htons(ETH_P_IP) &&
3420+ skb_network_header_len(skb) >= sizeof(*iph)) {
3421+ iph = ip_hdr(skb);
33843422 if (!ip_is_fragment(iph) &&
33853423 (iph->protocol == IPPROTO_TCP ||
3386− iph->protocol == IPPROTO_UDP)) {
3387− layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1)));
3424+ iph->protocol == IPPROTO_UDP) &&
3425+ (skb_headlen(skb) - skb_network_offset(skb) >=
3426+ iph->ihl * sizeof(u32) + sizeof(*layer4hdr) * 2)) {
3427+ layer4hdr = (__be16 *)((u32 *)iph + iph->ihl);
3428+ layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1));
33883429 }
33893430 return (layer4_xor ^
33903431 ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count;
3391−
3432+ } else if (skb->protocol == htons(ETH_P_IPV6) &&
3433+ skb_network_header_len(skb) >= sizeof(*ipv6h)) {
3434+ ipv6h = ipv6_hdr(skb);
3435+ if ((ipv6h->nexthdr == IPPROTO_TCP ||
3436+ ipv6h->nexthdr == IPPROTO_UDP) &&
3437+ (skb_headlen(skb) - skb_network_offset(skb) >=
3438+ sizeof(*ipv6h) + sizeof(*layer4hdr) * 2)) {
3439+ layer4hdr = (__be16 *)(ipv6h + 1);
3440+ layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1));
3441+ }
3442+ s = &ipv6h->saddr.s6_addr32[0];
3443+ d = &ipv6h->daddr.s6_addr32[0];
3444+ layer4_xor ^= (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
3445+ layer4_xor ^= (layer4_xor >> 24) ^ (layer4_xor >> 16) ^
3446+ (layer4_xor >> 8);
3447+ return layer4_xor % count;
33923448 }
33933449
3394− return (data->h_dest[5] ^ data->h_source[5]) % count;
3395−}
3396−
3397−/*
3398− * Hash for the output device based upon layer 2 data
3399− */
3400−static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
3401−{
3402− struct ethhdr *data = (struct ethhdr *)skb->data;
3403−
3404− return (data->h_dest[5] ^ data->h_source[5]) % count;
3450+ return bond_xmit_hash_policy_l2(skb, count);
34053451 }
34063452
34073453 /*-------------------------- Device entry points ----------------------------*/
drivers/net/can/c_can/c_can.c+125−5
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <linux/if_ether.h>
3535 #include <linux/list.h>
3636 #include <linux/io.h>
37+#include <linux/pm_runtime.h>
3738
3839 #include <linux/can.h>
3940 #include <linux/can/dev.h>
@@ -45,6 +46,9 @@ · 5 unmodified lines
4546 #define IF_ENUM_REG_LEN 11
4647 #define C_CAN_IFACE(reg, iface) (C_CAN_IF1_##reg + (iface) * IF_ENUM_REG_LEN)
4748
49+/* control extension register D_CAN specific */
50+#define CONTROL_EX_PDR BIT(8)
51+
4852 /* control register */
4953 #define CONTROL_TEST BIT(7)
5054 #define CONTROL_CCE BIT(6)
@@ -64,6 +68,7 @@ · 13 unmodified lines
6468 #define TEST_BASIC BIT(2)
6569
6670 /* status register */
71+#define STATUS_PDA BIT(10)
6772 #define STATUS_BOFF BIT(7)
6873 #define STATUS_EWARN BIT(6)
6974 #define STATUS_EPASS BIT(5)
@@ -163,6 +168,9 @@ · 93 unmodified lines
163168 /* minimum timeout for checking BUSY status */
164169 #define MIN_TIMEOUT_VALUE 6
165170
171+/* Wait for ~1 sec for INIT bit */
172+#define INIT_WAIT_MS 1000
173+
166174 /* napi related */
167175 #define C_CAN_NAPI_WEIGHT C_CAN_MSG_OBJ_RX_NUM
168176
@@ -201,6 +209,30 @@ static const struct can_bittiming_const c_can_bittiming_const = { · 32 unmodified lines
201209 .brp_inc = 1,
202210 };
203211
212+static inline void c_can_pm_runtime_enable(const struct c_can_priv *priv)
213+{
214+ if (priv->device)
215+ pm_runtime_enable(priv->device);
216+}
217+
218+static inline void c_can_pm_runtime_disable(const struct c_can_priv *priv)
219+{
220+ if (priv->device)
221+ pm_runtime_disable(priv->device);
222+}
223+
224+static inline void c_can_pm_runtime_get_sync(const struct c_can_priv *priv)
225+{
226+ if (priv->device)
227+ pm_runtime_get_sync(priv->device);
228+}
229+
230+static inline void c_can_pm_runtime_put_sync(const struct c_can_priv *priv)
231+{
232+ if (priv->device)
233+ pm_runtime_put_sync(priv->device);
234+}
235+
204236 static inline int get_tx_next_msg_obj(const struct c_can_priv *priv)
205237 {
206238 return (priv->tx_next & C_CAN_NEXT_MSG_OBJ_MASK) +
@@ -673,11 +705,15 @@ static int c_can_get_berr_counter(const struct net_device *dev, · 466 unmodified lines
673705 unsigned int reg_err_counter;
674706 struct c_can_priv *priv = netdev_priv(dev);
675707
708+ c_can_pm_runtime_get_sync(priv);
709+
676710 reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG);
677711 bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >>
678712 ERR_CNT_REC_SHIFT;
679713 bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK;
680714
715+ c_can_pm_runtime_put_sync(priv);
716+
681717 return 0;
682718 }
683719
@@ -1053,11 +1089,13 @@ static int c_can_open(struct net_device *dev) · 369 unmodified lines
10531089 int err;
10541090 struct c_can_priv *priv = netdev_priv(dev);
10551091
1092+ c_can_pm_runtime_get_sync(priv);
1093+
10561094 /* open the can device */
10571095 err = open_candev(dev);
10581096 if (err) {
10591097 netdev_err(dev, "failed to open can device\n");
1060− return err;
1098+ goto exit_open_fail;
10611099 }
10621100
10631101 /* register interrupt handler */
@@ -1079,6 +1117,8 @@ static int c_can_open(struct net_device *dev) · 15 unmodified lines
10791117
10801118 exit_irq_fail:
10811119 close_candev(dev);
1120+exit_open_fail:
1121+ c_can_pm_runtime_put_sync(priv);
10821122 return err;
10831123 }
10841124
@@ -1091,6 +1131,7 @@ static int c_can_close(struct net_device *dev) · 6 unmodified lines
10911131 c_can_stop(dev);
10921132 free_irq(dev->irq, dev);
10931133 close_candev(dev);
1134+ c_can_pm_runtime_put_sync(priv);
10941135
10951136 return 0;
10961137 }
@@ -1119,6 +1160,77 @@ struct net_device *alloc_c_can_dev(void) · 22 unmodified lines
11191160 }
11201161 EXPORT_SYMBOL_GPL(alloc_c_can_dev);
11211162
1163+#ifdef CONFIG_PM
1164+int c_can_power_down(struct net_device *dev)
1165+{
1166+ u32 val;
1167+ unsigned long time_out;
1168+ struct c_can_priv *priv = netdev_priv(dev);
1169+
1170+ if (!(dev->flags & IFF_UP))
1171+ return 0;
1172+
1173+ WARN_ON(priv->type != BOSCH_D_CAN);
1174+
1175+ /* set PDR value so the device goes to power down mode */
1176+ val = priv->read_reg(priv, C_CAN_CTRL_EX_REG);
1177+ val |= CONTROL_EX_PDR;
1178+ priv->write_reg(priv, C_CAN_CTRL_EX_REG, val);
1179+
1180+ /* Wait for the PDA bit to get set */
1181+ time_out = jiffies + msecs_to_jiffies(INIT_WAIT_MS);
1182+ while (!(priv->read_reg(priv, C_CAN_STS_REG) & STATUS_PDA) &&
1183+ time_after(time_out, jiffies))
1184+ cpu_relax();
1185+
1186+ if (time_after(jiffies, time_out))
1187+ return -ETIMEDOUT;
1188+
1189+ c_can_stop(dev);
1190+
1191+ c_can_pm_runtime_put_sync(priv);
1192+
1193+ return 0;
1194+}
1195+EXPORT_SYMBOL_GPL(c_can_power_down);
1196+
1197+int c_can_power_up(struct net_device *dev)
1198+{
1199+ u32 val;
1200+ unsigned long time_out;
1201+ struct c_can_priv *priv = netdev_priv(dev);
1202+
1203+ if (!(dev->flags & IFF_UP))
1204+ return 0;
1205+
1206+ WARN_ON(priv->type != BOSCH_D_CAN);
1207+
1208+ c_can_pm_runtime_get_sync(priv);
1209+
1210+ /* Clear PDR and INIT bits */
1211+ val = priv->read_reg(priv, C_CAN_CTRL_EX_REG);
1212+ val &= ~CONTROL_EX_PDR;
1213+ priv->write_reg(priv, C_CAN_CTRL_EX_REG, val);
1214+ val = priv->read_reg(priv, C_CAN_CTRL_REG);
1215+ val &= ~CONTROL_INIT;
1216+ priv->write_reg(priv, C_CAN_CTRL_REG, val);
1217+
1218+ /* Wait for the PDA bit to get clear */
1219+ time_out = jiffies + msecs_to_jiffies(INIT_WAIT_MS);
1220+ while ((priv->read_reg(priv, C_CAN_STS_REG) & STATUS_PDA) &&
1221+ time_after(time_out, jiffies))
1222+ cpu_relax();
1223+
1224+ if (time_after(jiffies, time_out))
1225+ return -ETIMEDOUT;
1226+
1227+ c_can_start(dev);
1228+
1229+ return 0;
1230+}
1231+EXPORT_SYMBOL_GPL(c_can_power_up);
1232+#endif
1233+
11221234 void free_c_can_dev(struct net_device *dev)
11231235 {
11241236 free_candev(dev);
@@ -1133,10 +1245,19 @@ static const struct net_device_ops c_can_netdev_ops = { · 8 unmodified lines
11331245
11341246 int register_c_can_dev(struct net_device *dev)
11351247 {
1248+ struct c_can_priv *priv = netdev_priv(dev);
1249+ int err;
1250+
1251+ c_can_pm_runtime_enable(priv);
1252+
11361253 dev->flags |= IFF_ECHO; /* we support local echo */
11371254 dev->netdev_ops = &c_can_netdev_ops;
11381255
1139− return register_candev(dev);
1256+ err = register_candev(dev);
1257+ if (err)
1258+ c_can_pm_runtime_disable(priv);
1259+
1260+ return err;
11401261 }
11411262 EXPORT_SYMBOL_GPL(register_c_can_dev);
11421263
@@ -1144,10 +1265,9 @@ void unregister_c_can_dev(struct net_device *dev) · 1 unmodified line
11441265 {
11451266 struct c_can_priv *priv = netdev_priv(dev);
11461267
1147− /* disable all interrupts */
1148− c_can_enable_all_interrupts(priv, DISABLE_ALL_INTERRUPTS);
1149−
11501268 unregister_candev(dev);
1269+
1270+ c_can_pm_runtime_disable(priv);
11511271 }
11521272 EXPORT_SYMBOL_GPL(unregister_c_can_dev);
11531273
drivers/net/can/c_can/c_can.h+12−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424
2525 enum reg {
2626 C_CAN_CTRL_REG = 0,
27+ C_CAN_CTRL_EX_REG,
2728 C_CAN_STS_REG,
2829 C_CAN_ERR_CNT_REG,
2930 C_CAN_BTR_REG,
@@ -104,6 +105,7 @@ static const u16 reg_map_c_can[] = { · 74 unmodified lines
104105
105106 static const u16 reg_map_d_can[] = {
106107 [C_CAN_CTRL_REG] = 0x00,
108+ [C_CAN_CTRL_EX_REG] = 0x02,
107109 [C_CAN_STS_REG] = 0x04,
108110 [C_CAN_ERR_CNT_REG] = 0x08,
109111 [C_CAN_BTR_REG] = 0x0C,
@@ -143,8 +145,9 @@ static const u16 reg_map_d_can[] = { · 33 unmodified lines
143145 };
144146
145147 enum c_can_dev_id {
146− C_CAN_DEVTYPE,
147− D_CAN_DEVTYPE,
148+ BOSCH_C_CAN_PLATFORM,
149+ BOSCH_C_CAN,
150+ BOSCH_D_CAN,
148151 };
149152
150153 /* c_can private data structure */
@@ -152,6 +155,7 @@ struct c_can_priv { · 1 unmodified line
152155 struct can_priv can; /* must be the first member */
153156 struct napi_struct napi;
154157 struct net_device *dev;
158+ struct device *device;
155159 int tx_object;
156160 int current_status;
157161 int last_status;
@@ -164,6 +168,7 @@ struct c_can_priv { · 6 unmodified lines
164168 unsigned int tx_echo;
165169 void *priv; /* for board-specific data */
166170 u16 irqstatus;
171+ enum c_can_dev_id type;
167172 };
168173
169174 struct net_device *alloc_c_can_dev(void);
@@ -171,4 +176,9 @@ void free_c_can_dev(struct net_device *dev); · 1 unmodified line
171176 int register_c_can_dev(struct net_device *dev);
172177 void unregister_c_can_dev(struct net_device *dev);
173178
179+#ifdef CONFIG_PM
180+int c_can_power_up(struct net_device *dev);
181+int c_can_power_down(struct net_device *dev);
182+#endif
183+
174184 #endif /* C_CAN_H */
drivers/net/can/c_can/c_can_pci.c+3−3
@@ -120,10 +120,10 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev, · 119 unmodified lines
120120
121121 /* Configure CAN type */
122122 switch (c_can_pci_data->type) {
123− case C_CAN_DEVTYPE:
123+ case BOSCH_C_CAN:
124124 priv->regs = reg_map_c_can;
125125 break;
126− case D_CAN_DEVTYPE:
126+ case BOSCH_D_CAN:
127127 priv->regs = reg_map_d_can;
128128 priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
129129 break;
@@ -192,7 +192,7 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev) · 62 unmodified lines
192192 }
193193
194194 static struct c_can_pci_data c_can_sta2x11= {
195− .type = C_CAN_DEVTYPE,
195+ .type = BOSCH_C_CAN,
196196 .reg_align = C_CAN_REG_ALIGN_32,
197197 .freq = 52000000, /* 52 Mhz */
198198 };
drivers/net/can/c_can/c_can_platform.c+108−15
@@ -30,6 +30,9 @@ · 29 unmodified lines
3030 #include <linux/io.h>
3131 #include <linux/platform_device.h>
3232 #include <linux/clk.h>
33+#include <linux/of.h>
34+#include <linux/of_device.h>
35+#include <linux/pinctrl/consumer.h>
3336
3437 #include <linux/can/dev.h>
3538
@@ -65,17 +68,58 @@ static void c_can_plat_write_reg_aligned_to_32bit(struct c_can_priv *priv, · 29 unmodified lines
6568 writew(val, priv->base + 2 * priv->regs[index]);
6669 }
6770
71+static struct platform_device_id c_can_id_table[] = {
72+ [BOSCH_C_CAN_PLATFORM] = {
73+ .name = KBUILD_MODNAME,
74+ .driver_data = BOSCH_C_CAN,
75+ },
76+ [BOSCH_C_CAN] = {
77+ .name = "c_can",
78+ .driver_data = BOSCH_C_CAN,
79+ },
80+ [BOSCH_D_CAN] = {
81+ .name = "d_can",
82+ .driver_data = BOSCH_D_CAN,
83+ }, {
84+ }
85+};
86+
87+static const struct of_device_id c_can_of_table[] = {
88+ { .compatible = "bosch,c_can", .data = &c_can_id_table[BOSCH_C_CAN] },
89+ { .compatible = "bosch,d_can", .data = &c_can_id_table[BOSCH_D_CAN] },
90+ { /* sentinel */ },
91+};
92+
6893 static int __devinit c_can_plat_probe(struct platform_device *pdev)
6994 {
7095 int ret;
7196 void __iomem *addr;
7297 struct net_device *dev;
7398 struct c_can_priv *priv;
99+ const struct of_device_id *match;
74100 const struct platform_device_id *id;
101+ struct pinctrl *pinctrl;
75102 struct resource *mem;
76103 int irq;
77104 struct clk *clk;
78105
106+ if (pdev->dev.of_node) {
107+ match = of_match_device(c_can_of_table, &pdev->dev);
108+ if (!match) {
109+ dev_err(&pdev->dev, "Failed to find matching dt id\n");
110+ ret = -EINVAL;
111+ goto exit;
112+ }
113+ id = match->data;
114+ } else {
115+ id = platform_get_device_id(pdev);
116+ }
117+
118+ pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
119+ if (IS_ERR(pinctrl))
120+ dev_warn(&pdev->dev,
121+ "failed to configure pins from driver\n");
122+
79123 /* get the appropriate clk */
80124 clk = clk_get(&pdev->dev, NULL);
81125 if (IS_ERR(clk)) {
@@ -114,9 +158,8 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 32 unmodified lines
114158 }
115159
116160 priv = netdev_priv(dev);
117− id = platform_get_device_id(pdev);
118161 switch (id->driver_data) {
119− case C_CAN_DEVTYPE:
162+ case BOSCH_C_CAN:
120163 priv->regs = reg_map_c_can;
121164 switch (mem->flags & IORESOURCE_MEM_TYPE_MASK) {
122165 case IORESOURCE_MEM_32BIT:
@@ -130,7 +173,7 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 7 unmodified lines
130173 break;
131174 }
132175 break;
133− case D_CAN_DEVTYPE:
176+ case BOSCH_D_CAN:
134177 priv->regs = reg_map_d_can;
135178 priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
136179 priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
@@ -143,8 +186,10 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 6 unmodified lines
143186
144187 dev->irq = irq;
145188 priv->base = addr;
189+ priv->device = &pdev->dev;
146190 priv->can.clock.freq = clk_get_rate(clk);
147191 priv->priv = clk;
192+ priv->type = id->driver_data;
148193
149194 platform_set_drvdata(pdev, dev);
150195 SET_NETDEV_DEV(dev, &pdev->dev);
@@ -195,27 +240,75 @@ static int __devexit c_can_plat_remove(struct platform_device *pdev) · 44 unmodified lines
195240 return 0;
196241 }
197242
198−static const struct platform_device_id c_can_id_table[] = {
199− {
200− .name = KBUILD_MODNAME,
201− .driver_data = C_CAN_DEVTYPE,
202− }, {
203− .name = "c_can",
204− .driver_data = C_CAN_DEVTYPE,
205− }, {
206− .name = "d_can",
207− .driver_data = D_CAN_DEVTYPE,
208− }, {
243+#ifdef CONFIG_PM
244+static int c_can_suspend(struct platform_device *pdev, pm_message_t state)
245+{
246+ int ret;
247+ struct net_device *ndev = platform_get_drvdata(pdev);
248+ struct c_can_priv *priv = netdev_priv(ndev);
249+
250+ if (priv->type != BOSCH_D_CAN) {
251+ dev_warn(&pdev->dev, "Not supported\n");
252+ return 0;
209253 }
210−};
254+
255+ if (netif_running(ndev)) {
256+ netif_stop_queue(ndev);
257+ netif_device_detach(ndev);
258+ }
259+
260+ ret = c_can_power_down(ndev);
261+ if (ret) {
262+ netdev_err(ndev, "failed to enter power down mode\n");
263+ return ret;
264+ }
265+
266+ priv->can.state = CAN_STATE_SLEEPING;
267+
268+ return 0;
269+}
270+
271+static int c_can_resume(struct platform_device *pdev)
272+{
273+ int ret;
274+ struct net_device *ndev = platform_get_drvdata(pdev);
275+ struct c_can_priv *priv = netdev_priv(ndev);
276+
277+ if (priv->type != BOSCH_D_CAN) {
278+ dev_warn(&pdev->dev, "Not supported\n");
279+ return 0;
280+ }
281+
282+ ret = c_can_power_up(ndev);
283+ if (ret) {
284+ netdev_err(ndev, "Still in power down mode\n");
285+ return ret;
286+ }
287+
288+ priv->can.state = CAN_STATE_ERROR_ACTIVE;
289+
290+ if (netif_running(ndev)) {
291+ netif_device_attach(ndev);
292+ netif_start_queue(ndev);
293+ }
294+
295+ return 0;
296+}
297+#else
298+#define c_can_suspend NULL
299+#define c_can_resume NULL
300+#endif
211301
212302 static struct platform_driver c_can_plat_driver = {
213303 .driver = {
214304 .name = KBUILD_MODNAME,
215305 .owner = THIS_MODULE,
306+ .of_match_table = of_match_ptr(c_can_of_table),
216307 },
217308 .probe = c_can_plat_probe,
218309 .remove = __devexit_p(c_can_plat_remove),
310+ .suspend = c_can_suspend,
311+ .resume = c_can_resume,
219312 .id_table = c_can_id_table,
220313 };
221314
drivers/net/can/flexcan.c+19−10
@@ -144,6 +144,10 @@ · 143 unmodified lines
144144
145145 #define FLEXCAN_MB_CODE_MASK (0xf0ffffff)
146146
147+/* FLEXCAN hardware feature flags */
148+#define FLEXCAN_HAS_V10_FEATURES BIT(1) /* For core version >= 10 */
149+#define FLEXCAN_HAS_BROKEN_ERR_STATE BIT(2) /* Broken error state handling */
150+
147151 /* Structure of the message buffer */
148152 struct flexcan_mb {
149153 u32 can_ctrl;
@@ -178,7 +182,7 @@ struct flexcan_regs { · 28 unmodified lines
178182 };
179183
180184 struct flexcan_devtype_data {
181− u32 hw_ver; /* hardware controller version */
185+ u32 features; /* hardware controller features */
182186 };
183187
184188 struct flexcan_priv {
@@ -197,11 +201,11 @@ struct flexcan_priv { · 12 unmodified lines
197201 };
198202
199203 static struct flexcan_devtype_data fsl_p1010_devtype_data = {
200− .hw_ver = 3,
204+ .features = FLEXCAN_HAS_BROKEN_ERR_STATE,
201205 };
202−
206+static struct flexcan_devtype_data fsl_imx28_devtype_data;
203207 static struct flexcan_devtype_data fsl_imx6q_devtype_data = {
204− .hw_ver = 10,
208+ .features = FLEXCAN_HAS_V10_FEATURES | FLEXCAN_HAS_BROKEN_ERR_STATE,
205209 };
206210
207211 static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -741,15 +745,19 @@ static int flexcan_chip_start(struct net_device *dev) · 533 unmodified lines
741745 * enable tx and rx warning interrupt
742746 * enable bus off interrupt
743747 * (== FLEXCAN_CTRL_ERR_STATE)
744− *
745− * _note_: we enable the "error interrupt"
746− * (FLEXCAN_CTRL_ERR_MSK), too. Otherwise we don't get any
747− * warning or bus passive interrupts.
748748 */
749749 reg_ctrl = flexcan_read(&regs->ctrl);
750750 reg_ctrl &= ~FLEXCAN_CTRL_TSYN;
751751 reg_ctrl |= FLEXCAN_CTRL_BOFF_REC | FLEXCAN_CTRL_LBUF |
752− FLEXCAN_CTRL_ERR_STATE | FLEXCAN_CTRL_ERR_MSK;
752+ FLEXCAN_CTRL_ERR_STATE;
753+ /*
754+ * enable the "error interrupt" (FLEXCAN_CTRL_ERR_MSK),
755+ * on most Flexcan cores, too. Otherwise we don't get
756+ * any error warning or passive interrupts.
757+ */
758+ if (priv->devtype_data->features & FLEXCAN_HAS_BROKEN_ERR_STATE ||
759+ priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
760+ reg_ctrl |= FLEXCAN_CTRL_ERR_MSK;
753761
754762 /* save for later use */
755763 priv->reg_ctrl_default = reg_ctrl;
@@ -772,7 +780,7 @@ static int flexcan_chip_start(struct net_device *dev) · 16 unmodified lines
772780 flexcan_write(0x0, &regs->rx14mask);
773781 flexcan_write(0x0, &regs->rx15mask);
774782
775− if (priv->devtype_data->hw_ver >= 10)
783+ if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES)
776784 flexcan_write(0x0, &regs->rxfgmask);
777785
778786 flexcan_transceiver_switch(priv, 1);
@@ -954,6 +962,7 @@ static void __devexit unregister_flexcandev(struct net_device *dev) · 175 unmodified lines
954962
955963 static const struct of_device_id flexcan_of_match[] = {
956964 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
965+ { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
957966 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
958967 { /* sentinel */ },
959968 };
drivers/net/can/mscan/mpc5xxx_can.c+2−2
@@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, · 180 unmodified lines
181181
182182 if (!clock_name || !strcmp(clock_name, "sys")) {
183183 sys_clk = clk_get(&ofdev->dev, "sys_clk");
184− if (!sys_clk) {
184+ if (IS_ERR(sys_clk)) {
185185 dev_err(&ofdev->dev, "couldn't get sys_clk\n");
186186 goto exit_unmap;
187187 }
@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, · 16 unmodified lines
204204
205205 if (clocksrc < 0) {
206206 ref_clk = clk_get(&ofdev->dev, "ref_clk");
207− if (!ref_clk) {
207+ if (IS_ERR(ref_clk)) {
208208 dev_err(&ofdev->dev, "couldn't get ref_clk\n");
209209 goto exit_unmap;
210210 }
drivers/net/can/sja1000/sja1000.c+24−7
@@ -156,8 +156,13 @@ static void set_normal_mode(struct net_device *dev) · 155 unmodified lines
156156 }
157157
158158 /* set chip to normal mode */
159− priv->write_reg(priv, REG_MOD, 0x00);
159+ if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
160+ priv->write_reg(priv, REG_MOD, MOD_LOM);
161+ else
162+ priv->write_reg(priv, REG_MOD, 0x00);
163+
160164 udelay(10);
165+
161166 status = priv->read_reg(priv, REG_MOD);
162167 }
163168
@@ -310,7 +315,10 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, · 146 unmodified lines
310315
311316 can_put_echo_skb(skb, dev, 0);
312317
313− sja1000_write_cmdreg(priv, CMD_TR);
318+ if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
319+ sja1000_write_cmdreg(priv, CMD_TR | CMD_AT);
320+ else
321+ sja1000_write_cmdreg(priv, CMD_TR);
314322
315323 return NETDEV_TX_OK;
316324 }
@@ -505,10 +513,18 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) · 188 unmodified lines
505513 netdev_warn(dev, "wakeup interrupt\n");
506514
507515 if (isrc & IRQ_TI) {
508− /* transmission complete interrupt */
509− stats->tx_bytes += priv->read_reg(priv, REG_FI) & 0xf;
510− stats->tx_packets++;
511− can_get_echo_skb(dev, 0);
516+ /* transmission buffer released */
517+ if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT &&
518+ !(status & SR_TCS)) {
519+ stats->tx_errors++;
520+ can_free_echo_skb(dev, 0);
521+ } else {
522+ /* transmission complete */
523+ stats->tx_bytes +=
524+ priv->read_reg(priv, REG_FI) & 0xf;
525+ stats->tx_packets++;
526+ can_get_echo_skb(dev, 0);
527+ }
512528 netif_wake_queue(dev);
513529 }
514530 if (isrc & IRQ_RI) {
@@ -605,7 +621,8 @@ struct net_device *alloc_sja1000dev(int sizeof_priv) · 90 unmodified lines
605621 priv->can.do_set_mode = sja1000_set_mode;
606622 priv->can.do_get_berr_counter = sja1000_get_berr_counter;
607623 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
608− CAN_CTRLMODE_BERR_REPORTING;
624+ CAN_CTRLMODE_BERR_REPORTING | CAN_CTRLMODE_LISTENONLY |
625+ CAN_CTRLMODE_ONE_SHOT;
609626
610627 spin_lock_init(&priv->cmdreg_lock);
611628
drivers/net/can/usb/peak_usb/pcan_usb_core.c+4−4
@@ -53,7 +53,7 @@ static struct peak_usb_adapter *peak_usb_adapters_list[] = { · 52 unmodified lines
5353 * dump memory
5454 */
5555 #define DUMP_WIDTH 16
56−void dump_mem(char *prompt, void *p, int l)
56+void pcan_dump_mem(char *prompt, void *p, int l)
5757 {
5858 pr_info("%s dumping %s (%d bytes):\n",
5959 PCAN_USB_DRIVER_NAME, prompt ? prompt : "memory", l);
@@ -203,9 +203,9 @@ static void peak_usb_read_bulk_callback(struct urb *urb) · 143 unmodified lines
203203 if (dev->state & PCAN_USB_STATE_STARTED) {
204204 err = dev->adapter->dev_decode_buf(dev, urb);
205205 if (err)
206− dump_mem("received usb message",
207− urb->transfer_buffer,
208− urb->transfer_buffer_length);
206+ pcan_dump_mem("received usb message",
207+ urb->transfer_buffer,
208+ urb->transfer_buffer_length);
209209 }
210210 }
211211
drivers/net/can/usb/peak_usb/pcan_usb_core.h+1−1
@@ -131,7 +131,7 @@ struct peak_usb_device { · 130 unmodified lines
131131 struct peak_usb_device *next_siblings;
132132 };
133133
134−void dump_mem(char *prompt, void *p, int l);
134+void pcan_dump_mem(char *prompt, void *p, int l);
135135
136136 /* common timestamp management */
137137 void peak_usb_init_time_ref(struct peak_time_ref *time_ref,
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+4−4
@@ -292,8 +292,8 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev, · 291 unmodified lines
292292 if (!rec_len) {
293293 netdev_err(dev->netdev,
294294 "got unprocessed record in msg\n");
295− dump_mem("rcvd rsp msg", pum->u.rec_buffer,
296− actual_length);
295+ pcan_dump_mem("rcvd rsp msg", pum->u.rec_buffer,
296+ actual_length);
297297 break;
298298 }
299299
@@ -756,8 +756,8 @@ static int pcan_usb_pro_decode_buf(struct peak_usb_device *dev, struct urb *urb) · 456 unmodified lines
756756
757757 fail:
758758 if (err)
759− dump_mem("received msg",
760− urb->transfer_buffer, urb->actual_length);
759+ pcan_dump_mem("received msg",
760+ urb->transfer_buffer, urb->actual_length);
761761
762762 return err;
763763 }
drivers/net/ethernet/Kconfig+0−9
@@ -89,15 +89,6 @@ source "drivers/net/ethernet/marvell/Kconfig" · 88 unmodified lines
8989 source "drivers/net/ethernet/mellanox/Kconfig"
9090 source "drivers/net/ethernet/micrel/Kconfig"
9191 source "drivers/net/ethernet/microchip/Kconfig"
92−
93−config MIPS_SIM_NET
94− tristate "MIPS simulator Network device"
95− depends on MIPS_SIM
96− ---help---
97− The MIPSNET device is a simple Ethernet network device which is
98− emulated by the MIPS Simulator.
99− If you are not using a MIPSsim or are unsure, say N.
100−
10192 source "drivers/net/ethernet/myricom/Kconfig"
10293
10394 config FEALNX
drivers/net/ethernet/Makefile+0−1
@@ -40,7 +40,6 @@ obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ · 39 unmodified lines
4040 obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/
4141 obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/
4242 obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/
43−obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
4443 obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/
4544 obj-$(CONFIG_FEALNX) += fealnx.o
4645 obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/
drivers/net/ethernet/broadcom/Kconfig+1−0
@@ -101,6 +101,7 @@ config TIGON3 · 100 unmodified lines
101101 tristate "Broadcom Tigon3 support"
102102 depends on PCI
103103 select PHYLIB
104+ select HWMON
104105 ---help---
105106 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
106107
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+2−2
@@ -23,8 +23,8 @@ · 22 unmodified lines
2323 * (you will need to reboot afterwards) */
2424 /* #define BNX2X_STOP_ON_ERROR */
2525
26−#define DRV_MODULE_VERSION "1.72.51-0"
27−#define DRV_MODULE_RELDATE "2012/06/18"
26+#define DRV_MODULE_VERSION "1.78.00-0"
27+#define DRV_MODULE_RELDATE "2012/09/27"
2828 #define BNX2X_BC_VER 0x040200
2929
3030 #if defined(CONFIG_DCB)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+16−8
@@ -2285,7 +2285,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 2284 unmodified lines
22852285 /* Wait for all pending SP commands to complete */
22862286 if (!bnx2x_wait_sp_comp(bp, ~0x0UL)) {
22872287 BNX2X_ERR("Timeout waiting for SP elements to complete\n");
2288− bnx2x_nic_unload(bp, UNLOAD_CLOSE);
2288+ bnx2x_nic_unload(bp, UNLOAD_CLOSE, false);
22892289 return -EBUSY;
22902290 }
22912291
@@ -2333,7 +2333,7 @@ load_error0: · 41 unmodified lines
23332333 }
23342334
23352335 /* must be called with rtnl_lock */
2336−int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
2336+int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
23372337 {
23382338 int i;
23392339 bool global = false;
@@ -2395,7 +2395,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) · 55 unmodified lines
23952395
23962396 /* Cleanup the chip if needed */
23972397 if (unload_mode != UNLOAD_RECOVERY)
2398− bnx2x_chip_cleanup(bp, unload_mode);
2398+ bnx2x_chip_cleanup(bp, unload_mode, keep_link);
23992399 else {
24002400 /* Send the UNLOAD_REQUEST to the MCP */
24012401 bnx2x_send_unload_req(bp, unload_mode);
@@ -2419,7 +2419,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) · 17 unmodified lines
24192419 bnx2x_free_irq(bp);
24202420
24212421 /* Report UNLOAD_DONE to MCP */
2422− bnx2x_send_unload_done(bp);
2422+ bnx2x_send_unload_done(bp, false);
24232423 }
24242424
24252425 /*
@@ -3026,8 +3026,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 600 unmodified lines
30263026 first_bd = tx_start_bd;
30273027
30283028 tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
3029− SET_FLAG(tx_start_bd->general_data, ETH_TX_START_BD_ETH_ADDR_TYPE,
3030− mac_type);
3029+ SET_FLAG(tx_start_bd->general_data,
3030+ ETH_TX_START_BD_PARSE_NBDS,
3031+ 0);
30313032
30323033 /* header nbd */
30333034 SET_FLAG(tx_start_bd->general_data, ETH_TX_START_BD_HDR_NBDS, 1);
@@ -3077,13 +3078,20 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 43 unmodified lines
30773078 &pbd_e2->dst_mac_addr_lo,
30783079 eth->h_dest);
30793080 }
3081+
3082+ SET_FLAG(pbd_e2_parsing_data,
3083+ ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE, mac_type);
30803084 } else {
3085+ u16 global_data = 0;
30813086 pbd_e1x = &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;
30823087 memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));
30833088 /* Set PBD in checksum offload case */
30843089 if (xmit_type & XMIT_CSUM)
30853090 hlen = bnx2x_set_pbd_csum(bp, skb, pbd_e1x, xmit_type);
30863091
3092+ SET_FLAG(global_data,
3093+ ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE, mac_type);
3094+ pbd_e1x->global_data |= cpu_to_le16(global_data);
30873095 }
30883096
30893097 /* Setup the data pointer of the first BD of the packet */
@@ -3770,7 +3778,7 @@ int bnx2x_reload_if_running(struct net_device *dev) · 680 unmodified lines
37703778 if (unlikely(!netif_running(dev)))
37713779 return 0;
37723780
3773− bnx2x_nic_unload(bp, UNLOAD_NORMAL);
3781+ bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
37743782 return bnx2x_nic_load(bp, LOAD_NORMAL);
37753783 }
37763784
@@ -3967,7 +3975,7 @@ int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state) · 190 unmodified lines
39673975
39683976 netif_device_detach(dev);
39693977
3970− bnx2x_nic_unload(bp, UNLOAD_CLOSE);
3978+ bnx2x_nic_unload(bp, UNLOAD_CLOSE, false);
39713979
39723980 bnx2x_set_power_state(bp, pci_choose_state(pdev, state));
39733981
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h+13−3
@@ -83,8 +83,9 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode); · 82 unmodified lines
8383 * bnx2x_send_unload_done - send UNLOAD_DONE command to the MCP.
8484 *
8585 * @bp: driver handle
86+ * @keep_link: true iff link should be kept up
8687 */
87−void bnx2x_send_unload_done(struct bnx2x *bp);
88+void bnx2x_send_unload_done(struct bnx2x *bp, bool keep_link);
8889
8990 /**
9091 * bnx2x_config_rss_pf - configure RSS parameters in a PF.
@@ -152,6 +153,14 @@ u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode); · 61 unmodified lines
152153 */
153154 void bnx2x_link_set(struct bnx2x *bp);
154155
156+/**
157+ * bnx2x_force_link_reset - Forces link reset, and put the PHY
158+ * in reset as well.
159+ *
160+ * @bp: driver handle
161+ */
162+void bnx2x_force_link_reset(struct bnx2x *bp);
163+
155164 /**
156165 * bnx2x_link_test - query link status.
157166 *
@@ -312,12 +321,13 @@ void bnx2x_set_num_queues(struct bnx2x *bp); · 154 unmodified lines
312321 *
313322 * @bp: driver handle
314323 * @unload_mode: COMMON, PORT, FUNCTION
324+ * @keep_link: true iff link should be kept up.
315325 *
316326 * - Cleanup MAC configuration.
317327 * - Closes clients.
318328 * - etc.
319329 */
320−void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode);
330+void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link);
321331
322332 /**
323333 * bnx2x_acquire_hw_lock - acquire HW lock.
@@ -446,7 +456,7 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl); · 122 unmodified lines
446456 bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err);
447457
448458 /* dev_close main block */
449−int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode);
459+int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link);
450460
451461 /* dev_open main block */
452462 int bnx2x_nic_load(struct bnx2x *bp, int load_mode);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c+4−8
@@ -91,25 +91,21 @@ static void bnx2x_pfc_set(struct bnx2x *bp) · 90 unmodified lines
9191 /*
9292 * Rx COS configuration
9393 * Changing PFC RX configuration .
94− * In RX COS0 will always be configured to lossy and COS1 to lossless
94+ * In RX COS0 will always be configured to lossless and COS1 to lossy
9595 */
9696 for (i = 0 ; i < MAX_PFC_PRIORITIES ; i++) {
9797 pri_bit = 1 << i;
9898
99− if (pri_bit & DCBX_PFC_PRI_PAUSE_MASK(bp))
99+ if (!(pri_bit & DCBX_PFC_PRI_PAUSE_MASK(bp)))
100100 val |= 1 << (i * 4);
101101 }
102102
103103 pfc_params.pkt_priority_to_cos = val;
104104
105105 /* RX COS0 */
106− pfc_params.llfc_low_priority_classes = 0;
106+ pfc_params.llfc_low_priority_classes = DCBX_PFC_PRI_PAUSE_MASK(bp);
107107 /* RX COS1 */
108− pfc_params.llfc_high_priority_classes = DCBX_PFC_PRI_PAUSE_MASK(bp);
109−
110− /* BRB configuration */
111− pfc_params.cos0_pauseable = false;
112− pfc_params.cos1_pauseable = true;
108+ pfc_params.llfc_high_priority_classes = 0;
113109
114110 bnx2x_acquire_phy_lock(bp);
115111 bp->link_params.feature_config_flags |= FEATURE_CONFIG_PFC_ENABLED;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c+32−26
@@ -905,6 +905,7 @@ static int bnx2x_nway_reset(struct net_device *dev) · 904 unmodified lines
905905
906906 if (netif_running(dev)) {
907907 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
908+ bnx2x_force_link_reset(bp);
908909 bnx2x_link_set(bp);
909910 }
910911
@@ -1606,7 +1607,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev, · 695 unmodified lines
16061607 return 0;
16071608 }
16081609
1609−static char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
1610+static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] = {
16101611 "register_test (offline) ",
16111612 "memory_test (offline) ",
16121613 "int_loopback_test (offline)",
@@ -1653,7 +1654,7 @@ static int bnx2x_get_eee(struct net_device *dev, struct ethtool_eee *edata) · 40 unmodified lines
16531654 return -EOPNOTSUPP;
16541655 }
16551656
1656− eee_cfg = SHMEM2_RD(bp, eee_status[BP_PORT(bp)]);
1657+ eee_cfg = bp->link_vars.eee_status;
16571658
16581659 edata->supported =
16591660 bnx2x_eee_to_adv((eee_cfg & SHMEM_EEE_SUPPORTED_MASK) >>
@@ -1690,7 +1691,7 @@ static int bnx2x_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 30 unmodified lines
16901691 return -EOPNOTSUPP;
16911692 }
16921693
1693− eee_cfg = SHMEM2_RD(bp, eee_status[BP_PORT(bp)]);
1694+ eee_cfg = bp->link_vars.eee_status;
16941695
16951696 if (!(eee_cfg & SHMEM_EEE_SUPPORTED_MASK)) {
16961697 DP(BNX2X_MSG_ETHTOOL, "Board does not support EEE!\n");
@@ -1739,6 +1740,7 @@ static int bnx2x_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 42 unmodified lines
17391740 /* Restart link to propogate changes */
17401741 if (netif_running(dev)) {
17411742 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
1743+ bnx2x_force_link_reset(bp);
17421744 bnx2x_link_set(bp);
17431745 }
17441746
@@ -2038,8 +2040,6 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode) · 293 unmodified lines
20382040 u16 pkt_prod, bd_prod;
20392041 struct sw_tx_bd *tx_buf;
20402042 struct eth_tx_start_bd *tx_start_bd;
2041− struct eth_tx_parse_bd_e1x *pbd_e1x = NULL;
2042− struct eth_tx_parse_bd_e2 *pbd_e2 = NULL;
20432043 dma_addr_t mapping;
20442044 union eth_rx_cqe *cqe;
20452045 u8 cqe_fp_flags, cqe_fp_type;
@@ -2130,22 +2130,33 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode) · 84 unmodified lines
21302130 tx_start_bd->nbytes = cpu_to_le16(skb_headlen(skb));
21312131 tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
21322132 tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
2133− SET_FLAG(tx_start_bd->general_data,
2134− ETH_TX_START_BD_ETH_ADDR_TYPE,
2135− UNICAST_ADDRESS);
21362133 SET_FLAG(tx_start_bd->general_data,
21372134 ETH_TX_START_BD_HDR_NBDS,
21382135 1);
2136+ SET_FLAG(tx_start_bd->general_data,
2137+ ETH_TX_START_BD_PARSE_NBDS,
2138+ 0);
21392139
21402140 /* turn on parsing and get a BD */
21412141 bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
21422142
2143− pbd_e1x = &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;
2144− pbd_e2 = &txdata->tx_desc_ring[bd_prod].parse_bd_e2;
2145−
2146− memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2));
2147− memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));
2148−
2143+ if (CHIP_IS_E1x(bp)) {
2144+ u16 global_data = 0;
2145+ struct eth_tx_parse_bd_e1x *pbd_e1x =
2146+ &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;
2147+ memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));
2148+ SET_FLAG(global_data,
2149+ ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE, UNICAST_ADDRESS);
2150+ pbd_e1x->global_data = cpu_to_le16(global_data);
2151+ } else {
2152+ u32 parsing_data = 0;
2153+ struct eth_tx_parse_bd_e2 *pbd_e2 =
2154+ &txdata->tx_desc_ring[bd_prod].parse_bd_e2;
2155+ memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2));
2156+ SET_FLAG(parsing_data,
2157+ ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE, UNICAST_ADDRESS);
2158+ pbd_e2->parsing_data = cpu_to_le32(parsing_data);
2159+ }
21492160 wmb();
21502161
21512162 txdata->tx_db.data.prod += 2;
@@ -2263,7 +2274,7 @@ static int bnx2x_test_ext_loopback(struct bnx2x *bp) · 111 unmodified lines
22632274 if (!netif_running(bp->dev))
22642275 return BNX2X_EXT_LOOPBACK_FAILED;
22652276
2266− bnx2x_nic_unload(bp, UNLOAD_NORMAL);
2277+ bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
22672278 rc = bnx2x_nic_load(bp, LOAD_LOOPBACK_EXT);
22682279 if (rc) {
22692280 DP(BNX2X_MSG_ETHTOOL,
@@ -2414,7 +2425,7 @@ static void bnx2x_self_test(struct net_device *dev, · 144 unmodified lines
24142425
24152426 link_up = bp->link_vars.link_up;
24162427
2417− bnx2x_nic_unload(bp, UNLOAD_NORMAL);
2428+ bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
24182429 rc = bnx2x_nic_load(bp, LOAD_DIAG);
24192430 if (rc) {
24202431 etest->flags |= ETH_TEST_FL_FAILED;
@@ -2446,7 +2457,7 @@ static void bnx2x_self_test(struct net_device *dev, · 25 unmodified lines
24462457 etest->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE;
24472458 }
24482459
2449− bnx2x_nic_unload(bp, UNLOAD_NORMAL);
2460+ bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
24502461
24512462 /* restore input for TX port IF */
24522463 REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, val);
@@ -2534,7 +2545,7 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset) · 81 unmodified lines
25342545 static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
25352546 {
25362547 struct bnx2x *bp = netdev_priv(dev);
2537− int i, j, k, offset, start;
2548+ int i, j, k, start;
25382549 char queue_name[MAX_QUEUE_NAME_LEN+1];
25392550
25402551 switch (stringset) {
@@ -2570,13 +2581,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) · 29 unmodified lines
25702581 start = 0;
25712582 else
25722583 start = 4;
2573− for (i = 0, j = start; j < (start + BNX2X_NUM_TESTS(bp));
2574− i++, j++) {
2575− offset = sprintf(buf+32*i, "%s",
2576− bnx2x_tests_str_arr[j]);
2577− *(buf+offset) = '\0';
2578− }
2579− break;
2584+ memcpy(buf, bnx2x_tests_str_arr + start,
2585+ ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp));
25802586 }
25812587 }
25822588
@@ -2940,7 +2946,7 @@ static int bnx2x_set_channels(struct net_device *dev, · 357 unmodified lines
29402946 bnx2x_change_num_queues(bp, channels->combined_count);
29412947 return 0;
29422948 }
2943− bnx2x_nic_unload(bp, UNLOAD_NORMAL);
2949+ bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
29442950 bnx2x_change_num_queues(bp, channels->combined_count);
29452951 return bnx2x_nic_load(bp, LOAD_NORMAL);
29462952 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h+0−3
@@ -88,9 +88,6 @@ · 87 unmodified lines
8888 #define TSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[102].base)
8989 #define TSTORM_ASSERT_LIST_OFFSET(assertListEntry) \
9090 (IRO[101].base + ((assertListEntry) * IRO[101].m1))
91−#define TSTORM_COMMON_SAFC_WORKAROUND_ENABLE_OFFSET (IRO[107].base)
92−#define TSTORM_COMMON_SAFC_WORKAROUND_TIMEOUT_10USEC_OFFSET \
93− (IRO[108].base)
9491 #define TSTORM_FUNCTION_COMMON_CONFIG_OFFSET(pfId) \
9592 (IRO[201].base + ((pfId) * IRO[201].m1))
9693 #define TSTORM_FUNC_EN_OFFSET(funcId) \
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h+81−28
@@ -1286,6 +1286,9 @@ struct drv_func_mb { · 1285 unmodified lines
12861286 #define DRV_MSG_CODE_SET_MF_BW_MIN_MASK 0x00ff0000
12871287 #define DRV_MSG_CODE_SET_MF_BW_MAX_MASK 0xff000000
12881288
1289+ #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002
1290+
1291+ #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a
12891292 u32 fw_mb_header;
12901293 #define FW_MSG_CODE_MASK 0xffff0000
12911294 #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000
@@ -1909,6 +1912,54 @@ struct lldp_local_mib { · 617 unmodified lines
19091912 };
19101913 /***END OF DCBX STRUCTURES DECLARATIONS***/
19111914
1915+/***********************************************************/
1916+/* Elink section */
1917+/***********************************************************/
1918+#define SHMEM_LINK_CONFIG_SIZE 2
1919+struct shmem_lfa {
1920+ u32 req_duplex;
1921+ #define REQ_DUPLEX_PHY0_MASK 0x0000ffff
1922+ #define REQ_DUPLEX_PHY0_SHIFT 0
1923+ #define REQ_DUPLEX_PHY1_MASK 0xffff0000
1924+ #define REQ_DUPLEX_PHY1_SHIFT 16
1925+ u32 req_flow_ctrl;
1926+ #define REQ_FLOW_CTRL_PHY0_MASK 0x0000ffff
1927+ #define REQ_FLOW_CTRL_PHY0_SHIFT 0
1928+ #define REQ_FLOW_CTRL_PHY1_MASK 0xffff0000
1929+ #define REQ_FLOW_CTRL_PHY1_SHIFT 16
1930+ u32 req_line_speed; /* Also determine AutoNeg */
1931+ #define REQ_LINE_SPD_PHY0_MASK 0x0000ffff
1932+ #define REQ_LINE_SPD_PHY0_SHIFT 0
1933+ #define REQ_LINE_SPD_PHY1_MASK 0xffff0000
1934+ #define REQ_LINE_SPD_PHY1_SHIFT 16
1935+ u32 speed_cap_mask[SHMEM_LINK_CONFIG_SIZE];
1936+ u32 additional_config;
1937+ #define REQ_FC_AUTO_ADV_MASK 0x0000ffff
1938+ #define REQ_FC_AUTO_ADV0_SHIFT 0
1939+ #define NO_LFA_DUE_TO_DCC_MASK 0x00010000
1940+ u32 lfa_sts;
1941+ #define LFA_LINK_FLAP_REASON_OFFSET 0
1942+ #define LFA_LINK_FLAP_REASON_MASK 0x000000ff
1943+ #define LFA_LINK_DOWN 0x1
1944+ #define LFA_LOOPBACK_ENABLED 0x2
1945+ #define LFA_DUPLEX_MISMATCH 0x3
1946+ #define LFA_MFW_IS_TOO_OLD 0x4
1947+ #define LFA_LINK_SPEED_MISMATCH 0x5
1948+ #define LFA_FLOW_CTRL_MISMATCH 0x6
1949+ #define LFA_SPEED_CAP_MISMATCH 0x7
1950+ #define LFA_DCC_LFA_DISABLED 0x8
1951+ #define LFA_EEE_MISMATCH 0x9
1952+
1953+ #define LINK_FLAP_AVOIDANCE_COUNT_OFFSET 8
1954+ #define LINK_FLAP_AVOIDANCE_COUNT_MASK 0x0000ff00
1955+
1956+ #define LINK_FLAP_COUNT_OFFSET 16
1957+ #define LINK_FLAP_COUNT_MASK 0x00ff0000
1958+
1959+ #define LFA_FLAGS_MASK 0xff000000
1960+ #define SHMEM_LFA_DONT_CLEAR_STAT (1<<24)
1961+};
1962+
19121963 struct ncsi_oem_fcoe_features {
19131964 u32 fcoe_features1;
19141965 #define FCOE_FEATURES1_IOS_PER_CONNECTION_MASK 0x0000FFFF
@@ -2738,8 +2789,8 @@ struct afex_stats { · 823 unmodified lines
27382789 };
27392790
27402791 #define BCM_5710_FW_MAJOR_VERSION 7
2741−#define BCM_5710_FW_MINOR_VERSION 2
2742−#define BCM_5710_FW_REVISION_VERSION 51
2792+#define BCM_5710_FW_MINOR_VERSION 8
2793+#define BCM_5710_FW_REVISION_VERSION 2
27432794 #define BCM_5710_FW_ENGINEERING_VERSION 0
27442795 #define BCM_5710_FW_COMPILE_FLAGS 1
27452796
@@ -3861,10 +3912,8 @@ struct eth_rss_update_ramrod_data { · 1115 unmodified lines
38613912 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY_SHIFT 4
38623913 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY (0x1<<5)
38633914 #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY_SHIFT 5
3864−#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<6)
3865−#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 6
3866−#define __ETH_RSS_UPDATE_RAMROD_DATA_RESERVED0 (0x1<<7)
3867−#define __ETH_RSS_UPDATE_RAMROD_DATA_RESERVED0_SHIFT 7
3915+#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<7)
3916+#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 7
38683917 u8 rss_result_mask;
38693918 u8 rss_mode;
38703919 __le32 __reserved2;
@@ -4080,27 +4129,29 @@ struct eth_tx_start_bd { · 209 unmodified lines
40804129 #define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
40814130 #define ETH_TX_START_BD_FORCE_VLAN_MODE (0x1<<4)
40824131 #define ETH_TX_START_BD_FORCE_VLAN_MODE_SHIFT 4
4083−#define ETH_TX_START_BD_RESREVED (0x1<<5)
4084−#define ETH_TX_START_BD_RESREVED_SHIFT 5
4085−#define ETH_TX_START_BD_ETH_ADDR_TYPE (0x3<<6)
4086−#define ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT 6
4132+#define ETH_TX_START_BD_PARSE_NBDS (0x3<<5)
4133+#define ETH_TX_START_BD_PARSE_NBDS_SHIFT 5
4134+#define ETH_TX_START_BD_RESREVED (0x1<<7)
4135+#define ETH_TX_START_BD_RESREVED_SHIFT 7
40874136 };
40884137
40894138 /*
40904139 * Tx parsing BD structure for ETH E1/E1h
40914140 */
40924141 struct eth_tx_parse_bd_e1x {
4093− u8 global_data;
4142+ __le16 global_data;
40944143 #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)
40954144 #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 0
4096−#define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x1<<4)
4097−#define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 4
4098−#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<5)
4099−#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 5
4100−#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<6)
4101−#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 6
4102−#define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<7)
4103−#define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 7
4145+#define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE (0x3<<4)
4146+#define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE_SHIFT 4
4147+#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<6)
4148+#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 6
4149+#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<7)
4150+#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 7
4151+#define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<8)
4152+#define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 8
4153+#define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x7F<<9)
4154+#define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 9
41044155 u8 tcp_flags;
41054156 #define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)
41064157 #define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 0
@@ -4119,7 +4170,6 @@ struct eth_tx_parse_bd_e1x { · 12 unmodified lines
41194170 #define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)
41204171 #define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 7
41214172 u8 ip_hlen_w;
4122− s8 reserved;
41234173 __le16 total_hlen_w;
41244174 __le16 tcp_pseudo_csum;
41254175 __le16 lso_mss;
@@ -4138,14 +4188,16 @@ struct eth_tx_parse_bd_e2 { · 12 unmodified lines
41384188 __le16 src_mac_addr_mid;
41394189 __le16 src_mac_addr_hi;
41404190 __le32 parsing_data;
4141−#define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W (0x1FFF<<0)
4191+#define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W (0x7FF<<0)
41424192 #define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT 0
4143−#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<13)
4144−#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 13
4145−#define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<17)
4146−#define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 17
4147−#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<31)
4148−#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 31
4193+#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<11)
4194+#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 11
4195+#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<15)
4196+#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 15
4197+#define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<16)
4198+#define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 16
4199+#define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE (0x3<<30)
4200+#define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT 30
41494201 };
41504202
41514203 /*
@@ -4913,7 +4965,8 @@ struct flow_control_configuration { · 761 unmodified lines
49134965 *
49144966 */
49154967 struct function_start_data {
4916− __le16 function_mode;
4968+ u8 function_mode;
4969+ u8 reserved;
49174970 __le16 sd_vlan_tag;
49184971 __le16 vif_id;
49194972 u8 path_id;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h+1−1
@@ -566,7 +566,7 @@ static const struct { · 565 unmodified lines
566566 u32 e2; /* 57712 */
567567 u32 e3; /* 578xx */
568568 } reg_mask; /* Register mask (all valid bits) */
569− char name[7]; /* Block's longest name is 6 characters long
569+ char name[8]; /* Block's longest name is 7 characters long
570570 * (name + suffix)
571571 */
572572 } bnx2x_blocks_parity_data[] = {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c+828−873
@@ -161,120 +161,6 @@ · 160 unmodified lines
161161 #define EDC_MODE_LIMITING 0x0044
162162 #define EDC_MODE_PASSIVE_DAC 0x0055
163163
164−/* BRB default for class 0 E2 */
165−#define DEFAULT0_E2_BRB_MAC_PAUSE_XOFF_THR 170
166−#define DEFAULT0_E2_BRB_MAC_PAUSE_XON_THR 250
167−#define DEFAULT0_E2_BRB_MAC_FULL_XOFF_THR 10
168−#define DEFAULT0_E2_BRB_MAC_FULL_XON_THR 50
169−
170−/* BRB thresholds for E2*/
171−#define PFC_E2_BRB_MAC_PAUSE_XOFF_THR_PAUSE 170
172−#define PFC_E2_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE 0
173−
174−#define PFC_E2_BRB_MAC_PAUSE_XON_THR_PAUSE 250
175−#define PFC_E2_BRB_MAC_PAUSE_XON_THR_NON_PAUSE 0
176−
177−#define PFC_E2_BRB_MAC_FULL_XOFF_THR_PAUSE 10
178−#define PFC_E2_BRB_MAC_FULL_XOFF_THR_NON_PAUSE 90
179−
180−#define PFC_E2_BRB_MAC_FULL_XON_THR_PAUSE 50
181−#define PFC_E2_BRB_MAC_FULL_XON_THR_NON_PAUSE 250
182−
183−/* BRB default for class 0 E3A0 */
184−#define DEFAULT0_E3A0_BRB_MAC_PAUSE_XOFF_THR 290
185−#define DEFAULT0_E3A0_BRB_MAC_PAUSE_XON_THR 410
186−#define DEFAULT0_E3A0_BRB_MAC_FULL_XOFF_THR 10
187−#define DEFAULT0_E3A0_BRB_MAC_FULL_XON_THR 50
188−
189−/* BRB thresholds for E3A0 */
190−#define PFC_E3A0_BRB_MAC_PAUSE_XOFF_THR_PAUSE 290
191−#define PFC_E3A0_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE 0
192−
193−#define PFC_E3A0_BRB_MAC_PAUSE_XON_THR_PAUSE 410
194−#define PFC_E3A0_BRB_MAC_PAUSE_XON_THR_NON_PAUSE 0
195−
196−#define PFC_E3A0_BRB_MAC_FULL_XOFF_THR_PAUSE 10
197−#define PFC_E3A0_BRB_MAC_FULL_XOFF_THR_NON_PAUSE 170
198−
199−#define PFC_E3A0_BRB_MAC_FULL_XON_THR_PAUSE 50
200−#define PFC_E3A0_BRB_MAC_FULL_XON_THR_NON_PAUSE 410
201−
202−/* BRB default for E3B0 */
203−#define DEFAULT0_E3B0_BRB_MAC_PAUSE_XOFF_THR 330
204−#define DEFAULT0_E3B0_BRB_MAC_PAUSE_XON_THR 490
205−#define DEFAULT0_E3B0_BRB_MAC_FULL_XOFF_THR 15
206−#define DEFAULT0_E3B0_BRB_MAC_FULL_XON_THR 55
207−
208−/* BRB thresholds for E3B0 2 port mode*/
209−#define PFC_E3B0_2P_BRB_MAC_PAUSE_XOFF_THR_PAUSE 1025
210−#define PFC_E3B0_2P_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE 0
211−
212−#define PFC_E3B0_2P_BRB_MAC_PAUSE_XON_THR_PAUSE 1025
213−#define PFC_E3B0_2P_BRB_MAC_PAUSE_XON_THR_NON_PAUSE 0
214−
215−#define PFC_E3B0_2P_BRB_MAC_FULL_XOFF_THR_PAUSE 10
216−#define PFC_E3B0_2P_BRB_MAC_FULL_XOFF_THR_NON_PAUSE 1025
217−
218−#define PFC_E3B0_2P_BRB_MAC_FULL_XON_THR_PAUSE 50
219−#define PFC_E3B0_2P_BRB_MAC_FULL_XON_THR_NON_PAUSE 1025
220−
221−/* only for E3B0*/
222−#define PFC_E3B0_2P_BRB_FULL_LB_XOFF_THR 1025
223−#define PFC_E3B0_2P_BRB_FULL_LB_XON_THR 1025
224−
225−/* Lossy +Lossless GUARANTIED == GUART */
226−#define PFC_E3B0_2P_MIX_PAUSE_LB_GUART 284
227−/* Lossless +Lossless*/
228−#define PFC_E3B0_2P_PAUSE_LB_GUART 236
229−/* Lossy +Lossy*/
230−#define PFC_E3B0_2P_NON_PAUSE_LB_GUART 342
231−
232−/* Lossy +Lossless*/
233−#define PFC_E3B0_2P_MIX_PAUSE_MAC_0_CLASS_T_GUART 284
234−/* Lossless +Lossless*/
235−#define PFC_E3B0_2P_PAUSE_MAC_0_CLASS_T_GUART 236
236−/* Lossy +Lossy*/
237−#define PFC_E3B0_2P_NON_PAUSE_MAC_0_CLASS_T_GUART 336
238−#define PFC_E3B0_2P_BRB_MAC_0_CLASS_T_GUART_HYST 80
239−
240−#define PFC_E3B0_2P_BRB_MAC_1_CLASS_T_GUART 0
241−#define PFC_E3B0_2P_BRB_MAC_1_CLASS_T_GUART_HYST 0
242−
243−/* BRB thresholds for E3B0 4 port mode */
244−#define PFC_E3B0_4P_BRB_MAC_PAUSE_XOFF_THR_PAUSE 304
245−#define PFC_E3B0_4P_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE 0
246−
247−#define PFC_E3B0_4P_BRB_MAC_PAUSE_XON_THR_PAUSE 384
248−#define PFC_E3B0_4P_BRB_MAC_PAUSE_XON_THR_NON_PAUSE 0
249−
250−#define PFC_E3B0_4P_BRB_MAC_FULL_XOFF_THR_PAUSE 10
251−#define PFC_E3B0_4P_BRB_MAC_FULL_XOFF_THR_NON_PAUSE 304
252−
253−#define PFC_E3B0_4P_BRB_MAC_FULL_XON_THR_PAUSE 50
254−#define PFC_E3B0_4P_BRB_MAC_FULL_XON_THR_NON_PAUSE 384
255−
256−/* only for E3B0*/
257−#define PFC_E3B0_4P_BRB_FULL_LB_XOFF_THR 304
258−#define PFC_E3B0_4P_BRB_FULL_LB_XON_THR 384
259−#define PFC_E3B0_4P_LB_GUART 120
260−
261−#define PFC_E3B0_4P_BRB_MAC_0_CLASS_T_GUART 120
262−#define PFC_E3B0_4P_BRB_MAC_0_CLASS_T_GUART_HYST 80
263−
264−#define PFC_E3B0_4P_BRB_MAC_1_CLASS_T_GUART 80
265−#define PFC_E3B0_4P_BRB_MAC_1_CLASS_T_GUART_HYST 120
266−
267−/* Pause defines*/
268−#define DEFAULT_E3B0_BRB_FULL_LB_XOFF_THR 330
269−#define DEFAULT_E3B0_BRB_FULL_LB_XON_THR 490
270−#define DEFAULT_E3B0_LB_GUART 40
271−
272−#define DEFAULT_E3B0_BRB_MAC_0_CLASS_T_GUART 40
273−#define DEFAULT_E3B0_BRB_MAC_0_CLASS_T_GUART_HYST 0
274−
275−#define DEFAULT_E3B0_BRB_MAC_1_CLASS_T_GUART 40
276−#define DEFAULT_E3B0_BRB_MAC_1_CLASS_T_GUART_HYST 0
277−
278164 /* ETS defines*/
279165 #define DCBX_INVALID_COS (0xFF)
280166
@@ -321,6 +207,127 @@ static u32 bnx2x_bits_dis(struct bnx2x *bp, u32 reg, u32 bits) · 40 unmodified lines
321207 return val;
322208 }
323209
210+/*
211+ * bnx2x_check_lfa - This function checks if link reinitialization is required,
212+ * or link flap can be avoided.
213+ *
214+ * @params: link parameters
215+ * Returns 0 if Link Flap Avoidance conditions are met otherwise, the failed
216+ * condition code.
217+ */
218+static int bnx2x_check_lfa(struct link_params *params)
219+{
220+ u32 link_status, cfg_idx, lfa_mask, cfg_size;
221+ u32 cur_speed_cap_mask, cur_req_fc_auto_adv, additional_config;
222+ u32 saved_val, req_val, eee_status;
223+ struct bnx2x *bp = params->bp;
224+
225+ additional_config =
226+ REG_RD(bp, params->lfa_base +
227+ offsetof(struct shmem_lfa, additional_config));
228+
229+ /* NOTE: must be first condition checked -
230+ * to verify DCC bit is cleared in any case!
231+ */
232+ if (additional_config & NO_LFA_DUE_TO_DCC_MASK) {
233+ DP(NETIF_MSG_LINK, "No LFA due to DCC flap after clp exit\n");
234+ REG_WR(bp, params->lfa_base +
235+ offsetof(struct shmem_lfa, additional_config),
236+ additional_config & ~NO_LFA_DUE_TO_DCC_MASK);
237+ return LFA_DCC_LFA_DISABLED;
238+ }
239+
240+ /* Verify that link is up */
241+ link_status = REG_RD(bp, params->shmem_base +
242+ offsetof(struct shmem_region,
243+ port_mb[params->port].link_status));
244+ if (!(link_status & LINK_STATUS_LINK_UP))
245+ return LFA_LINK_DOWN;
246+
247+ /* Verify that loopback mode is not set */
248+ if (params->loopback_mode)
249+ return LFA_LOOPBACK_ENABLED;
250+
251+ /* Verify that MFW supports LFA */
252+ if (!params->lfa_base)
253+ return LFA_MFW_IS_TOO_OLD;
254+
255+ if (params->num_phys == 3) {
256+ cfg_size = 2;
257+ lfa_mask = 0xffffffff;
258+ } else {
259+ cfg_size = 1;
260+ lfa_mask = 0xffff;
261+ }
262+
263+ /* Compare Duplex */
264+ saved_val = REG_RD(bp, params->lfa_base +
265+ offsetof(struct shmem_lfa, req_duplex));
266+ req_val = params->req_duplex[0] | (params->req_duplex[1] << 16);
267+ if ((saved_val & lfa_mask) != (req_val & lfa_mask)) {
268+ DP(NETIF_MSG_LINK, "Duplex mismatch %x vs. %x\n",
269+ (saved_val & lfa_mask), (req_val & lfa_mask));
270+ return LFA_DUPLEX_MISMATCH;
271+ }
272+ /* Compare Flow Control */
273+ saved_val = REG_RD(bp, params->lfa_base +
274+ offsetof(struct shmem_lfa, req_flow_ctrl));
275+ req_val = params->req_flow_ctrl[0] | (params->req_flow_ctrl[1] << 16);
276+ if ((saved_val & lfa_mask) != (req_val & lfa_mask)) {
277+ DP(NETIF_MSG_LINK, "Flow control mismatch %x vs. %x\n",
278+ (saved_val & lfa_mask), (req_val & lfa_mask));
279+ return LFA_FLOW_CTRL_MISMATCH;
280+ }
281+ /* Compare Link Speed */
282+ saved_val = REG_RD(bp, params->lfa_base +
283+ offsetof(struct shmem_lfa, req_line_speed));
284+ req_val = params->req_line_speed[0] | (params->req_line_speed[1] << 16);
285+ if ((saved_val & lfa_mask) != (req_val & lfa_mask)) {
286+ DP(NETIF_MSG_LINK, "Link speed mismatch %x vs. %x\n",
287+ (saved_val & lfa_mask), (req_val & lfa_mask));
288+ return LFA_LINK_SPEED_MISMATCH;
289+ }
290+
291+ for (cfg_idx = 0; cfg_idx < cfg_size; cfg_idx++) {
292+ cur_speed_cap_mask = REG_RD(bp, params->lfa_base +
293+ offsetof(struct shmem_lfa,
294+ speed_cap_mask[cfg_idx]));
295+
296+ if (cur_speed_cap_mask != params->speed_cap_mask[cfg_idx]) {
297+ DP(NETIF_MSG_LINK, "Speed Cap mismatch %x vs. %x\n",
298+ cur_speed_cap_mask,
299+ params->speed_cap_mask[cfg_idx]);
300+ return LFA_SPEED_CAP_MISMATCH;
301+ }
302+ }
303+
304+ cur_req_fc_auto_adv =
305+ REG_RD(bp, params->lfa_base +
306+ offsetof(struct shmem_lfa, additional_config)) &
307+ REQ_FC_AUTO_ADV_MASK;
308+
309+ if ((u16)cur_req_fc_auto_adv != params->req_fc_auto_adv) {
310+ DP(NETIF_MSG_LINK, "Flow Ctrl AN mismatch %x vs. %x\n",
311+ cur_req_fc_auto_adv, params->req_fc_auto_adv);
312+ return LFA_FLOW_CTRL_MISMATCH;
313+ }
314+
315+ eee_status = REG_RD(bp, params->shmem2_base +
316+ offsetof(struct shmem2_region,
317+ eee_status[params->port]));
318+
319+ if (((eee_status & SHMEM_EEE_LPI_REQUESTED_BIT) ^
320+ (params->eee_mode & EEE_MODE_ENABLE_LPI)) ||
321+ ((eee_status & SHMEM_EEE_REQUESTED_BIT) ^
322+ (params->eee_mode & EEE_MODE_ADV_LPI))) {
323+ DP(NETIF_MSG_LINK, "EEE mismatch %x vs. %x\n", params->eee_mode,
324+ eee_status);
325+ return LFA_EEE_MISMATCH;
326+ }
327+
328+ /* LFA conditions are met */
329+ return 0;
330+}
324331 /******************************************************************/
325332 /* EPIO/GPIO section */
326333 /******************************************************************/
@@ -1306,93 +1313,6 @@ int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) · 979 unmodified lines
13061313 return 0;
13071314 }
13081315
1309−/******************************************************************/
1310−/* EEE section */
1311−/******************************************************************/
1312−static u8 bnx2x_eee_has_cap(struct link_params *params)
1313−{
1314− struct bnx2x *bp = params->bp;
1315−
1316− if (REG_RD(bp, params->shmem2_base) <=
1317− offsetof(struct shmem2_region, eee_status[params->port]))
1318− return 0;
1319−
1320− return 1;
1321−}
1322−
1323−static int bnx2x_eee_nvram_to_time(u32 nvram_mode, u32 *idle_timer)
1324−{
1325− switch (nvram_mode) {
1326− case PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED:
1327− *idle_timer = EEE_MODE_NVRAM_BALANCED_TIME;
1328− break;
1329− case PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE:
1330− *idle_timer = EEE_MODE_NVRAM_AGGRESSIVE_TIME;
1331− break;
1332− case PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY:
1333− *idle_timer = EEE_MODE_NVRAM_LATENCY_TIME;
1334− break;
1335− default:
1336− *idle_timer = 0;
1337− break;
1338− }
1339−
1340− return 0;
1341−}
1342−
1343−static int bnx2x_eee_time_to_nvram(u32 idle_timer, u32 *nvram_mode)
1344−{
1345− switch (idle_timer) {
1346− case EEE_MODE_NVRAM_BALANCED_TIME:
1347− *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED;
1348− break;
1349− case EEE_MODE_NVRAM_AGGRESSIVE_TIME:
1350− *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE;
1351− break;
1352− case EEE_MODE_NVRAM_LATENCY_TIME:
1353− *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY;
1354− break;
1355− default:
1356− *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED;
1357− break;
1358− }
1359−
1360− return 0;
1361−}
1362−
1363−static u32 bnx2x_eee_calc_timer(struct link_params *params)
1364−{
1365− u32 eee_mode, eee_idle;
1366− struct bnx2x *bp = params->bp;
1367−
1368− if (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) {
1369− if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
1370− /* time value in eee_mode --> used directly*/
1371− eee_idle = params->eee_mode & EEE_MODE_TIMER_MASK;
1372− } else {
1373− /* hsi value in eee_mode --> time */
1374− if (bnx2x_eee_nvram_to_time(params->eee_mode &
1375− EEE_MODE_NVRAM_MASK,
1376− &eee_idle))
1377− return 0;
1378− }
1379− } else {
1380− /* hsi values in nvram --> time*/
1381− eee_mode = ((REG_RD(bp, params->shmem_base +
1382− offsetof(struct shmem_region, dev_info.
1383− port_feature_config[params->port].
1384− eee_power_mode)) &
1385− PORT_FEAT_CFG_EEE_POWER_MODE_MASK) >>
1386− PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT);
1387−
1388− if (bnx2x_eee_nvram_to_time(eee_mode, &eee_idle))
1389− return 0;
1390− }
1391−
1392− return eee_idle;
1393−}
1394−
1395−
13961316 /******************************************************************/
13971317 /* PFC section */
13981318 /******************************************************************/
@@ -1606,16 +1526,23 @@ static void bnx2x_set_xumac_nig(struct link_params *params, · 207 unmodified lines
16061526 NIG_REG_P0_MAC_PAUSE_OUT_EN, tx_pause_en);
16071527 }
16081528
1609−static void bnx2x_umac_disable(struct link_params *params)
1529+static void bnx2x_set_umac_rxtx(struct link_params *params, u8 en)
16101530 {
16111531 u32 umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0;
1532+ u32 val;
16121533 struct bnx2x *bp = params->bp;
16131534 if (!(REG_RD(bp, MISC_REG_RESET_REG_2) &
16141535 (MISC_REGISTERS_RESET_REG_2_UMAC0 << params->port)))
16151536 return;
1616−
1537+ val = REG_RD(bp, umac_base + UMAC_REG_COMMAND_CONFIG);
1538+ if (en)
1539+ val |= (UMAC_COMMAND_CONFIG_REG_TX_ENA |
1540+ UMAC_COMMAND_CONFIG_REG_RX_ENA);
1541+ else
1542+ val &= ~(UMAC_COMMAND_CONFIG_REG_TX_ENA |
1543+ UMAC_COMMAND_CONFIG_REG_RX_ENA);
16171544 /* Disable RX and TX */
1618− REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, 0);
1545+ REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val);
16191546 }
16201547
16211548 static void bnx2x_umac_enable(struct link_params *params,
@@ -1671,6 +1598,16 @@ static void bnx2x_umac_enable(struct link_params *params, · 49 unmodified lines
16711598 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val);
16721599 udelay(50);
16731600
1601+ /* Configure UMAC for EEE */
1602+ if (vars->eee_status & SHMEM_EEE_ADV_STATUS_MASK) {
1603+ DP(NETIF_MSG_LINK, "configured UMAC for EEE\n");
1604+ REG_WR(bp, umac_base + UMAC_REG_UMAC_EEE_CTRL,
1605+ UMAC_UMAC_EEE_CTRL_REG_EEE_EN);
1606+ REG_WR(bp, umac_base + UMAC_REG_EEE_WAKE_TIMER, 0x11);
1607+ } else {
1608+ REG_WR(bp, umac_base + UMAC_REG_UMAC_EEE_CTRL, 0x0);
1609+ }
1610+
16741611 /* Set MAC address for source TX Pause/PFC frames (under SW reset) */
16751612 REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR0,
16761613 ((params->mac_addr[2] << 24) |
@@ -1766,11 +1703,12 @@ static void bnx2x_xmac_init(struct link_params *params, u32 max_speed) · 89 unmodified lines
17661703
17671704 }
17681705
1769−static void bnx2x_xmac_disable(struct link_params *params)
1706+static void bnx2x_set_xmac_rxtx(struct link_params *params, u8 en)
17701707 {
17711708 u8 port = params->port;
17721709 struct bnx2x *bp = params->bp;
17731710 u32 pfc_ctrl, xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
1711+ u32 val;
17741712
17751713 if (REG_RD(bp, MISC_REG_RESET_REG_2) &
17761714 MISC_REGISTERS_RESET_REG_2_XMAC) {
@@ -1784,7 +1722,12 @@ static void bnx2x_xmac_disable(struct link_params *params) · 7 unmodified lines
17841722 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,
17851723 (pfc_ctrl | (1<<1)));
17861724 DP(NETIF_MSG_LINK, "Disable XMAC on port %x\n", port);
1787− REG_WR(bp, xmac_base + XMAC_REG_CTRL, 0);
1725+ val = REG_RD(bp, xmac_base + XMAC_REG_CTRL);
1726+ if (en)
1727+ val |= (XMAC_CTRL_REG_TX_EN | XMAC_CTRL_REG_RX_EN);
1728+ else
1729+ val &= ~(XMAC_CTRL_REG_TX_EN | XMAC_CTRL_REG_RX_EN);
1730+ REG_WR(bp, xmac_base + XMAC_REG_CTRL, val);
17881731 }
17891732 }
17901733
@@ -2087,391 +2030,6 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, · 296 unmodified lines
20872030 REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, wb_data, 2);
20882031 }
20892032
2090−/* PFC BRB internal port configuration params */
2091−struct bnx2x_pfc_brb_threshold_val {
2092− u32 pause_xoff;
2093− u32 pause_xon;
2094− u32 full_xoff;
2095− u32 full_xon;
2096−};
2097−
2098−struct bnx2x_pfc_brb_e3b0_val {
2099− u32 per_class_guaranty_mode;
2100− u32 lb_guarantied_hyst;
2101− u32 full_lb_xoff_th;
2102− u32 full_lb_xon_threshold;
2103− u32 lb_guarantied;
2104− u32 mac_0_class_t_guarantied;
2105− u32 mac_0_class_t_guarantied_hyst;
2106− u32 mac_1_class_t_guarantied;
2107− u32 mac_1_class_t_guarantied_hyst;
2108−};
2109−
2110−struct bnx2x_pfc_brb_th_val {
2111− struct bnx2x_pfc_brb_threshold_val pauseable_th;
2112− struct bnx2x_pfc_brb_threshold_val non_pauseable_th;
2113− struct bnx2x_pfc_brb_threshold_val default_class0;
2114− struct bnx2x_pfc_brb_threshold_val default_class1;
2115−
2116−};
2117−static int bnx2x_pfc_brb_get_config_params(
2118− struct link_params *params,
2119− struct bnx2x_pfc_brb_th_val *config_val)
2120−{
2121− struct bnx2x *bp = params->bp;
2122− DP(NETIF_MSG_LINK, "Setting PFC BRB configuration\n");
2123−
2124− config_val->default_class1.pause_xoff = 0;
2125− config_val->default_class1.pause_xon = 0;
2126− config_val->default_class1.full_xoff = 0;
2127− config_val->default_class1.full_xon = 0;
2128−
2129− if (CHIP_IS_E2(bp)) {
2130− /* Class0 defaults */
2131− config_val->default_class0.pause_xoff =
2132− DEFAULT0_E2_BRB_MAC_PAUSE_XOFF_THR;
2133− config_val->default_class0.pause_xon =
2134− DEFAULT0_E2_BRB_MAC_PAUSE_XON_THR;
2135− config_val->default_class0.full_xoff =
2136− DEFAULT0_E2_BRB_MAC_FULL_XOFF_THR;
2137− config_val->default_class0.full_xon =
2138− DEFAULT0_E2_BRB_MAC_FULL_XON_THR;
2139− /* Pause able*/
2140− config_val->pauseable_th.pause_xoff =
2141− PFC_E2_BRB_MAC_PAUSE_XOFF_THR_PAUSE;
2142− config_val->pauseable_th.pause_xon =
2143− PFC_E2_BRB_MAC_PAUSE_XON_THR_PAUSE;
2144− config_val->pauseable_th.full_xoff =
2145− PFC_E2_BRB_MAC_FULL_XOFF_THR_PAUSE;
2146− config_val->pauseable_th.full_xon =
2147− PFC_E2_BRB_MAC_FULL_XON_THR_PAUSE;
2148− /* Non pause able*/
2149− config_val->non_pauseable_th.pause_xoff =
2150− PFC_E2_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE;
2151− config_val->non_pauseable_th.pause_xon =
2152− PFC_E2_BRB_MAC_PAUSE_XON_THR_NON_PAUSE;
2153− config_val->non_pauseable_th.full_xoff =
2154− PFC_E2_BRB_MAC_FULL_XOFF_THR_NON_PAUSE;
2155− config_val->non_pauseable_th.full_xon =
2156− PFC_E2_BRB_MAC_FULL_XON_THR_NON_PAUSE;
2157− } else if (CHIP_IS_E3A0(bp)) {
2158− /* Class0 defaults */
2159− config_val->default_class0.pause_xoff =
2160− DEFAULT0_E3A0_BRB_MAC_PAUSE_XOFF_THR;
2161− config_val->default_class0.pause_xon =
2162− DEFAULT0_E3A0_BRB_MAC_PAUSE_XON_THR;
2163− config_val->default_class0.full_xoff =
2164− DEFAULT0_E3A0_BRB_MAC_FULL_XOFF_THR;
2165− config_val->default_class0.full_xon =
2166− DEFAULT0_E3A0_BRB_MAC_FULL_XON_THR;
2167− /* Pause able */
2168− config_val->pauseable_th.pause_xoff =
2169− PFC_E3A0_BRB_MAC_PAUSE_XOFF_THR_PAUSE;
2170− config_val->pauseable_th.pause_xon =
2171− PFC_E3A0_BRB_MAC_PAUSE_XON_THR_PAUSE;
2172− config_val->pauseable_th.full_xoff =
2173− PFC_E3A0_BRB_MAC_FULL_XOFF_THR_PAUSE;
2174− config_val->pauseable_th.full_xon =
2175− PFC_E3A0_BRB_MAC_FULL_XON_THR_PAUSE;
2176− /* Non pause able*/
2177− config_val->non_pauseable_th.pause_xoff =
2178− PFC_E3A0_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE;
2179− config_val->non_pauseable_th.pause_xon =
2180− PFC_E3A0_BRB_MAC_PAUSE_XON_THR_NON_PAUSE;
2181− config_val->non_pauseable_th.full_xoff =
2182− PFC_E3A0_BRB_MAC_FULL_XOFF_THR_NON_PAUSE;
2183− config_val->non_pauseable_th.full_xon =
2184− PFC_E3A0_BRB_MAC_FULL_XON_THR_NON_PAUSE;
2185− } else if (CHIP_IS_E3B0(bp)) {
2186− /* Class0 defaults */
2187− config_val->default_class0.pause_xoff =
2188− DEFAULT0_E3B0_BRB_MAC_PAUSE_XOFF_THR;
2189− config_val->default_class0.pause_xon =
2190− DEFAULT0_E3B0_BRB_MAC_PAUSE_XON_THR;
2191− config_val->default_class0.full_xoff =
2192− DEFAULT0_E3B0_BRB_MAC_FULL_XOFF_THR;
2193− config_val->default_class0.full_xon =
2194− DEFAULT0_E3B0_BRB_MAC_FULL_XON_THR;
2195−
2196− if (params->phy[INT_PHY].flags &
2197− FLAGS_4_PORT_MODE) {
2198− config_val->pauseable_th.pause_xoff =
2199− PFC_E3B0_4P_BRB_MAC_PAUSE_XOFF_THR_PAUSE;
2200− config_val->pauseable_th.pause_xon =
2201− PFC_E3B0_4P_BRB_MAC_PAUSE_XON_THR_PAUSE;
2202− config_val->pauseable_th.full_xoff =
2203− PFC_E3B0_4P_BRB_MAC_FULL_XOFF_THR_PAUSE;
2204− config_val->pauseable_th.full_xon =
2205− PFC_E3B0_4P_BRB_MAC_FULL_XON_THR_PAUSE;
2206− /* Non pause able*/
2207− config_val->non_pauseable_th.pause_xoff =
2208− PFC_E3B0_4P_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE;
2209− config_val->non_pauseable_th.pause_xon =
2210− PFC_E3B0_4P_BRB_MAC_PAUSE_XON_THR_NON_PAUSE;
2211− config_val->non_pauseable_th.full_xoff =
2212− PFC_E3B0_4P_BRB_MAC_FULL_XOFF_THR_NON_PAUSE;
2213− config_val->non_pauseable_th.full_xon =
2214− PFC_E3B0_4P_BRB_MAC_FULL_XON_THR_NON_PAUSE;
2215− } else {
2216− config_val->pauseable_th.pause_xoff =
2217− PFC_E3B0_2P_BRB_MAC_PAUSE_XOFF_THR_PAUSE;
2218− config_val->pauseable_th.pause_xon =
2219− PFC_E3B0_2P_BRB_MAC_PAUSE_XON_THR_PAUSE;
2220− config_val->pauseable_th.full_xoff =
2221− PFC_E3B0_2P_BRB_MAC_FULL_XOFF_THR_PAUSE;
2222− config_val->pauseable_th.full_xon =
2223− PFC_E3B0_2P_BRB_MAC_FULL_XON_THR_PAUSE;
2224− /* Non pause able*/
2225− config_val->non_pauseable_th.pause_xoff =
2226− PFC_E3B0_2P_BRB_MAC_PAUSE_XOFF_THR_NON_PAUSE;
2227− config_val->non_pauseable_th.pause_xon =
2228− PFC_E3B0_2P_BRB_MAC_PAUSE_XON_THR_NON_PAUSE;
2229− config_val->non_pauseable_th.full_xoff =
2230− PFC_E3B0_2P_BRB_MAC_FULL_XOFF_THR_NON_PAUSE;
2231− config_val->non_pauseable_th.full_xon =
2232− PFC_E3B0_2P_BRB_MAC_FULL_XON_THR_NON_PAUSE;
2233− }
2234− } else
2235− return -EINVAL;
2236−
2237− return 0;
2238−}
2239−
2240−static void bnx2x_pfc_brb_get_e3b0_config_params(
2241− struct link_params *params,
2242− struct bnx2x_pfc_brb_e3b0_val
2243− *e3b0_val,
2244− struct bnx2x_nig_brb_pfc_port_params *pfc_params,
2245− const u8 pfc_enabled)
2246−{
2247− if (pfc_enabled && pfc_params) {
2248− e3b0_val->per_class_guaranty_mode = 1;
2249− e3b0_val->lb_guarantied_hyst = 80;
2250−
2251− if (params->phy[INT_PHY].flags &
2252− FLAGS_4_PORT_MODE) {
2253− e3b0_val->full_lb_xoff_th =
2254− PFC_E3B0_4P_BRB_FULL_LB_XOFF_THR;
2255− e3b0_val->full_lb_xon_threshold =
2256− PFC_E3B0_4P_BRB_FULL_LB_XON_THR;
2257− e3b0_val->lb_guarantied =
2258− PFC_E3B0_4P_LB_GUART;
2259− e3b0_val->mac_0_class_t_guarantied =
2260− PFC_E3B0_4P_BRB_MAC_0_CLASS_T_GUART;
2261− e3b0_val->mac_0_class_t_guarantied_hyst =
2262− PFC_E3B0_4P_BRB_MAC_0_CLASS_T_GUART_HYST;
2263− e3b0_val->mac_1_class_t_guarantied =
2264− PFC_E3B0_4P_BRB_MAC_1_CLASS_T_GUART;
2265− e3b0_val->mac_1_class_t_guarantied_hyst =
2266− PFC_E3B0_4P_BRB_MAC_1_CLASS_T_GUART_HYST;
2267− } else {
2268− e3b0_val->full_lb_xoff_th =
2269− PFC_E3B0_2P_BRB_FULL_LB_XOFF_THR;
2270− e3b0_val->full_lb_xon_threshold =
2271− PFC_E3B0_2P_BRB_FULL_LB_XON_THR;
2272− e3b0_val->mac_0_class_t_guarantied_hyst =
2273− PFC_E3B0_2P_BRB_MAC_0_CLASS_T_GUART_HYST;
2274− e3b0_val->mac_1_class_t_guarantied =
2275− PFC_E3B0_2P_BRB_MAC_1_CLASS_T_GUART;
2276− e3b0_val->mac_1_class_t_guarantied_hyst =
2277− PFC_E3B0_2P_BRB_MAC_1_CLASS_T_GUART_HYST;
2278−
2279− if (pfc_params->cos0_pauseable !=
2280− pfc_params->cos1_pauseable) {
2281− /* Nonpauseable= Lossy + pauseable = Lossless*/
2282− e3b0_val->lb_guarantied =
2283− PFC_E3B0_2P_MIX_PAUSE_LB_GUART;
2284− e3b0_val->mac_0_class_t_guarantied =
2285− PFC_E3B0_2P_MIX_PAUSE_MAC_0_CLASS_T_GUART;
2286− } else if (pfc_params->cos0_pauseable) {
2287− /* Lossless +Lossless*/
2288− e3b0_val->lb_guarantied =
2289− PFC_E3B0_2P_PAUSE_LB_GUART;
2290− e3b0_val->mac_0_class_t_guarantied =
2291− PFC_E3B0_2P_PAUSE_MAC_0_CLASS_T_GUART;
2292− } else {
2293− /* Lossy +Lossy*/
2294− e3b0_val->lb_guarantied =
2295− PFC_E3B0_2P_NON_PAUSE_LB_GUART;
2296− e3b0_val->mac_0_class_t_guarantied =
2297− PFC_E3B0_2P_NON_PAUSE_MAC_0_CLASS_T_GUART;
2298− }
2299− }
2300− } else {
2301− e3b0_val->per_class_guaranty_mode = 0;
2302− e3b0_val->lb_guarantied_hyst = 0;
2303− e3b0_val->full_lb_xoff_th =
2304− DEFAULT_E3B0_BRB_FULL_LB_XOFF_THR;
2305− e3b0_val->full_lb_xon_threshold =
2306− DEFAULT_E3B0_BRB_FULL_LB_XON_THR;
2307− e3b0_val->lb_guarantied =
2308− DEFAULT_E3B0_LB_GUART;
2309− e3b0_val->mac_0_class_t_guarantied =
2310− DEFAULT_E3B0_BRB_MAC_0_CLASS_T_GUART;
2311− e3b0_val->mac_0_class_t_guarantied_hyst =
2312− DEFAULT_E3B0_BRB_MAC_0_CLASS_T_GUART_HYST;
2313− e3b0_val->mac_1_class_t_guarantied =
2314− DEFAULT_E3B0_BRB_MAC_1_CLASS_T_GUART;
2315− e3b0_val->mac_1_class_t_guarantied_hyst =
2316− DEFAULT_E3B0_BRB_MAC_1_CLASS_T_GUART_HYST;
2317− }
2318−}
2319−static int bnx2x_update_pfc_brb(struct link_params *params,
2320− struct link_vars *vars,
2321− struct bnx2x_nig_brb_pfc_port_params
2322− *pfc_params)
2323−{
2324− struct bnx2x *bp = params->bp;
2325− struct bnx2x_pfc_brb_th_val config_val = { {0} };
2326− struct bnx2x_pfc_brb_threshold_val *reg_th_config =
2327− &config_val.pauseable_th;
2328− struct bnx2x_pfc_brb_e3b0_val e3b0_val = {0};
2329− const int set_pfc = params->feature_config_flags &
2330− FEATURE_CONFIG_PFC_ENABLED;
2331− const u8 pfc_enabled = (set_pfc && pfc_params);
2332− int bnx2x_status = 0;
2333− u8 port = params->port;
2334−
2335− /* default - pause configuration */
2336− reg_th_config = &config_val.pauseable_th;
2337− bnx2x_status = bnx2x_pfc_brb_get_config_params(params, &config_val);
2338− if (bnx2x_status)
2339− return bnx2x_status;
2340−
2341− if (pfc_enabled) {
2342− /* First COS */
2343− if (pfc_params->cos0_pauseable)
2344− reg_th_config = &config_val.pauseable_th;
2345− else
2346− reg_th_config = &config_val.non_pauseable_th;
2347− } else
2348− reg_th_config = &config_val.default_class0;
2349− /* The number of free blocks below which the pause signal to class 0
2350− * of MAC #n is asserted. n=0,1
2351− */
2352− REG_WR(bp, (port) ? BRB1_REG_PAUSE_0_XOFF_THRESHOLD_1 :
2353− BRB1_REG_PAUSE_0_XOFF_THRESHOLD_0 ,
2354− reg_th_config->pause_xoff);
2355− /* The number of free blocks above which the pause signal to class 0
2356− * of MAC #n is de-asserted. n=0,1
2357− */
2358− REG_WR(bp, (port) ? BRB1_REG_PAUSE_0_XON_THRESHOLD_1 :
2359− BRB1_REG_PAUSE_0_XON_THRESHOLD_0 , reg_th_config->pause_xon);
2360− /* The number of free blocks below which the full signal to class 0
2361− * of MAC #n is asserted. n=0,1
2362− */
2363− REG_WR(bp, (port) ? BRB1_REG_FULL_0_XOFF_THRESHOLD_1 :
2364− BRB1_REG_FULL_0_XOFF_THRESHOLD_0 , reg_th_config->full_xoff);
2365− /* The number of free blocks above which the full signal to class 0
2366− * of MAC #n is de-asserted. n=0,1
2367− */
2368− REG_WR(bp, (port) ? BRB1_REG_FULL_0_XON_THRESHOLD_1 :
2369− BRB1_REG_FULL_0_XON_THRESHOLD_0 , reg_th_config->full_xon);
2370−
2371− if (pfc_enabled) {
2372− /* Second COS */
2373− if (pfc_params->cos1_pauseable)
2374− reg_th_config = &config_val.pauseable_th;
2375− else
2376− reg_th_config = &config_val.non_pauseable_th;
2377− } else
2378− reg_th_config = &config_val.default_class1;
2379− /* The number of free blocks below which the pause signal to
2380− * class 1 of MAC #n is asserted. n=0,1
2381− */
2382− REG_WR(bp, (port) ? BRB1_REG_PAUSE_1_XOFF_THRESHOLD_1 :
2383− BRB1_REG_PAUSE_1_XOFF_THRESHOLD_0,
2384− reg_th_config->pause_xoff);
2385−
2386− /* The number of free blocks above which the pause signal to
2387− * class 1 of MAC #n is de-asserted. n=0,1
2388− */
2389− REG_WR(bp, (port) ? BRB1_REG_PAUSE_1_XON_THRESHOLD_1 :
2390− BRB1_REG_PAUSE_1_XON_THRESHOLD_0,
2391− reg_th_config->pause_xon);
2392− /* The number of free blocks below which the full signal to
2393− * class 1 of MAC #n is asserted. n=0,1
2394− */
2395− REG_WR(bp, (port) ? BRB1_REG_FULL_1_XOFF_THRESHOLD_1 :
2396− BRB1_REG_FULL_1_XOFF_THRESHOLD_0,
2397− reg_th_config->full_xoff);
2398− /* The number of free blocks above which the full signal to
2399− * class 1 of MAC #n is de-asserted. n=0,1
2400− */
2401− REG_WR(bp, (port) ? BRB1_REG_FULL_1_XON_THRESHOLD_1 :
2402− BRB1_REG_FULL_1_XON_THRESHOLD_0,
2403− reg_th_config->full_xon);
2404−
2405− if (CHIP_IS_E3B0(bp)) {
2406− bnx2x_pfc_brb_get_e3b0_config_params(
2407− params,
2408− &e3b0_val,
2409− pfc_params,
2410− pfc_enabled);
2411−
2412− REG_WR(bp, BRB1_REG_PER_CLASS_GUARANTY_MODE,
2413− e3b0_val.per_class_guaranty_mode);
2414−
2415− /* The hysteresis on the guarantied buffer space for the Lb
2416− * port before signaling XON.
2417− */
2418− REG_WR(bp, BRB1_REG_LB_GUARANTIED_HYST,
2419− e3b0_val.lb_guarantied_hyst);
2420−
2421− /* The number of free blocks below which the full signal to the
2422− * LB port is asserted.
2423− */
2424− REG_WR(bp, BRB1_REG_FULL_LB_XOFF_THRESHOLD,
2425− e3b0_val.full_lb_xoff_th);
2426− /* The number of free blocks above which the full signal to the
2427− * LB port is de-asserted.
2428− */
2429− REG_WR(bp, BRB1_REG_FULL_LB_XON_THRESHOLD,
2430− e3b0_val.full_lb_xon_threshold);
2431− /* The number of blocks guarantied for the MAC #n port. n=0,1
2432− */
2433−
2434− /* The number of blocks guarantied for the LB port. */
2435− REG_WR(bp, BRB1_REG_LB_GUARANTIED,
2436− e3b0_val.lb_guarantied);
2437−
2438− /* The number of blocks guarantied for the MAC #n port. */
2439− REG_WR(bp, BRB1_REG_MAC_GUARANTIED_0,
2440− 2 * e3b0_val.mac_0_class_t_guarantied);
2441− REG_WR(bp, BRB1_REG_MAC_GUARANTIED_1,
2442− 2 * e3b0_val.mac_1_class_t_guarantied);
2443− /* The number of blocks guarantied for class #t in MAC0. t=0,1
2444− */
2445− REG_WR(bp, BRB1_REG_MAC_0_CLASS_0_GUARANTIED,
2446− e3b0_val.mac_0_class_t_guarantied);
2447− REG_WR(bp, BRB1_REG_MAC_0_CLASS_1_GUARANTIED,
2448− e3b0_val.mac_0_class_t_guarantied);
2449− /* The hysteresis on the guarantied buffer space for class in
2450− * MAC0. t=0,1
2451− */
2452− REG_WR(bp, BRB1_REG_MAC_0_CLASS_0_GUARANTIED_HYST,
2453− e3b0_val.mac_0_class_t_guarantied_hyst);
2454− REG_WR(bp, BRB1_REG_MAC_0_CLASS_1_GUARANTIED_HYST,
2455− e3b0_val.mac_0_class_t_guarantied_hyst);
2456−
2457− /* The number of blocks guarantied for class #t in MAC1.t=0,1
2458− */
2459− REG_WR(bp, BRB1_REG_MAC_1_CLASS_0_GUARANTIED,
2460− e3b0_val.mac_1_class_t_guarantied);
2461− REG_WR(bp, BRB1_REG_MAC_1_CLASS_1_GUARANTIED,
2462− e3b0_val.mac_1_class_t_guarantied);
2463− /* The hysteresis on the guarantied buffer space for class #t
2464− * in MAC1. t=0,1
2465− */
2466− REG_WR(bp, BRB1_REG_MAC_1_CLASS_0_GUARANTIED_HYST,
2467− e3b0_val.mac_1_class_t_guarantied_hyst);
2468− REG_WR(bp, BRB1_REG_MAC_1_CLASS_1_GUARANTIED_HYST,
2469− e3b0_val.mac_1_class_t_guarantied_hyst);
2470− }
2471−
2472− return bnx2x_status;
2473−}
2474−
24752033 /******************************************************************************
24762034 * Description:
24772035 * This function is needed because NIG ARB_CREDIT_WEIGHT_X are
@@ -2529,16 +2087,6 @@ static void bnx2x_update_mng(struct link_params *params, u32 link_status) · 51 unmodified lines
25292087 port_mb[params->port].link_status), link_status);
25302088 }
25312089
2532−static void bnx2x_update_mng_eee(struct link_params *params, u32 eee_status)
2533−{
2534− struct bnx2x *bp = params->bp;
2535−
2536− if (bnx2x_eee_has_cap(params))
2537− REG_WR(bp, params->shmem2_base +
2538− offsetof(struct shmem2_region,
2539− eee_status[params->port]), eee_status);
2540−}
2541−
25422090 static void bnx2x_update_pfc_nig(struct link_params *params,
25432091 struct link_vars *vars,
25442092 struct bnx2x_nig_brb_pfc_port_params *nig_params)
@@ -2658,11 +2206,6 @@ int bnx2x_update_pfc(struct link_params *params, · 113 unmodified lines
26582206 /* Update NIG params */
26592207 bnx2x_update_pfc_nig(params, vars, pfc_params);
26602208
2661− /* Update BRB params */
2662− bnx2x_status = bnx2x_update_pfc_brb(params, vars, pfc_params);
2663− if (bnx2x_status)
2664− return bnx2x_status;
2665−
26662209 if (!vars->link_up)
26672210 return bnx2x_status;
26682211
@@ -2827,16 +2370,18 @@ static int bnx2x_bmac2_enable(struct link_params *params, · 158 unmodified lines
28272370
28282371 static int bnx2x_bmac_enable(struct link_params *params,
28292372 struct link_vars *vars,
2830− u8 is_lb)
2373+ u8 is_lb, u8 reset_bmac)
28312374 {
28322375 int rc = 0;
28332376 u8 port = params->port;
28342377 struct bnx2x *bp = params->bp;
28352378 u32 val;
28362379 /* Reset and unreset the BigMac */
2837− REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,
2838− (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
2839− usleep_range(1000, 2000);
2380+ if (reset_bmac) {
2381+ REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,
2382+ (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
2383+ usleep_range(1000, 2000);
2384+ }
28402385
28412386 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,
28422387 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
@@ -2868,37 +2413,28 @@ static int bnx2x_bmac_enable(struct link_params *params, · 25 unmodified lines
28682413 return rc;
28692414 }
28702415
2871−static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port)
2416+static void bnx2x_set_bmac_rx(struct bnx2x *bp, u32 chip_id, u8 port, u8 en)
28722417 {
28732418 u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM :
28742419 NIG_REG_INGRESS_BMAC0_MEM;
28752420 u32 wb_data[2];
28762421 u32 nig_bmac_enable = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4);
28772422
2423+ if (CHIP_IS_E2(bp))
2424+ bmac_addr += BIGMAC2_REGISTER_BMAC_CONTROL;
2425+ else
2426+ bmac_addr += BIGMAC_REGISTER_BMAC_CONTROL;
28782427 /* Only if the bmac is out of reset */
28792428 if (REG_RD(bp, MISC_REG_RESET_REG_2) &
28802429 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port) &&
28812430 nig_bmac_enable) {
2882−
2883− if (CHIP_IS_E2(bp)) {
2884− /* Clear Rx Enable bit in BMAC_CONTROL register */
2885− REG_RD_DMAE(bp, bmac_addr +
2886− BIGMAC2_REGISTER_BMAC_CONTROL,
2887− wb_data, 2);
2888− wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
2889− REG_WR_DMAE(bp, bmac_addr +
2890− BIGMAC2_REGISTER_BMAC_CONTROL,
2891− wb_data, 2);
2892− } else {
2893− /* Clear Rx Enable bit in BMAC_CONTROL register */
2894− REG_RD_DMAE(bp, bmac_addr +
2895− BIGMAC_REGISTER_BMAC_CONTROL,
2896− wb_data, 2);
2431+ /* Clear Rx Enable bit in BMAC_CONTROL register */
2432+ REG_RD_DMAE(bp, bmac_addr, wb_data, 2);
2433+ if (en)
2434+ wb_data[0] |= BMAC_CONTROL_RX_ENABLE;
2435+ else
28972436 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
2898− REG_WR_DMAE(bp, bmac_addr +
2899− BIGMAC_REGISTER_BMAC_CONTROL,
2900− wb_data, 2);
2901− }
2437+ REG_WR_DMAE(bp, bmac_addr, wb_data, 2);
29022438 usleep_range(1000, 2000);
29032439 }
29042440 }
@@ -3233,6 +2769,245 @@ static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, · 328 unmodified lines
32332769 EMAC_MDIO_STATUS_10MB);
32342770 return rc;
32352771 }
2772+
2773+/******************************************************************/
2774+/* EEE section */
2775+/******************************************************************/
2776+static u8 bnx2x_eee_has_cap(struct link_params *params)
2777+{
2778+ struct bnx2x *bp = params->bp;
2779+
2780+ if (REG_RD(bp, params->shmem2_base) <=
2781+ offsetof(struct shmem2_region, eee_status[params->port]))
2782+ return 0;
2783+
2784+ return 1;
2785+}
2786+
2787+static int bnx2x_eee_nvram_to_time(u32 nvram_mode, u32 *idle_timer)
2788+{
2789+ switch (nvram_mode) {
2790+ case PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED:
2791+ *idle_timer = EEE_MODE_NVRAM_BALANCED_TIME;
2792+ break;
2793+ case PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE:
2794+ *idle_timer = EEE_MODE_NVRAM_AGGRESSIVE_TIME;
2795+ break;
2796+ case PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY:
2797+ *idle_timer = EEE_MODE_NVRAM_LATENCY_TIME;
2798+ break;
2799+ default:
2800+ *idle_timer = 0;
2801+ break;
2802+ }
2803+
2804+ return 0;
2805+}
2806+
2807+static int bnx2x_eee_time_to_nvram(u32 idle_timer, u32 *nvram_mode)
2808+{
2809+ switch (idle_timer) {
2810+ case EEE_MODE_NVRAM_BALANCED_TIME:
2811+ *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED;
2812+ break;
2813+ case EEE_MODE_NVRAM_AGGRESSIVE_TIME:
2814+ *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE;
2815+ break;
2816+ case EEE_MODE_NVRAM_LATENCY_TIME:
2817+ *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY;
2818+ break;
2819+ default:
2820+ *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED;
2821+ break;
2822+ }
2823+
2824+ return 0;
2825+}
2826+
2827+static u32 bnx2x_eee_calc_timer(struct link_params *params)
2828+{
2829+ u32 eee_mode, eee_idle;
2830+ struct bnx2x *bp = params->bp;
2831+
2832+ if (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) {
2833+ if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
2834+ /* time value in eee_mode --> used directly*/
2835+ eee_idle = params->eee_mode & EEE_MODE_TIMER_MASK;
2836+ } else {
2837+ /* hsi value in eee_mode --> time */
2838+ if (bnx2x_eee_nvram_to_time(params->eee_mode &
2839+ EEE_MODE_NVRAM_MASK,
2840+ &eee_idle))
2841+ return 0;
2842+ }
2843+ } else {
2844+ /* hsi values in nvram --> time*/
2845+ eee_mode = ((REG_RD(bp, params->shmem_base +
2846+ offsetof(struct shmem_region, dev_info.
2847+ port_feature_config[params->port].
2848+ eee_power_mode)) &
2849+ PORT_FEAT_CFG_EEE_POWER_MODE_MASK) >>
2850+ PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT);
2851+
2852+ if (bnx2x_eee_nvram_to_time(eee_mode, &eee_idle))
2853+ return 0;
2854+ }
2855+
2856+ return eee_idle;
2857+}
2858+
2859+static int bnx2x_eee_set_timers(struct link_params *params,
2860+ struct link_vars *vars)
2861+{
2862+ u32 eee_idle = 0, eee_mode;
2863+ struct bnx2x *bp = params->bp;
2864+
2865+ eee_idle = bnx2x_eee_calc_timer(params);
2866+
2867+ if (eee_idle) {
2868+ REG_WR(bp, MISC_REG_CPMU_LP_IDLE_THR_P0 + (params->port << 2),
2869+ eee_idle);
2870+ } else if ((params->eee_mode & EEE_MODE_ENABLE_LPI) &&
2871+ (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) &&
2872+ (params->eee_mode & EEE_MODE_OUTPUT_TIME)) {
2873+ DP(NETIF_MSG_LINK, "Error: Tx LPI is enabled with timer 0\n");
2874+ return -EINVAL;
2875+ }
2876+
2877+ vars->eee_status &= ~(SHMEM_EEE_TIMER_MASK | SHMEM_EEE_TIME_OUTPUT_BIT);
2878+ if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
2879+ /* eee_idle in 1u --> eee_status in 16u */
2880+ eee_idle >>= 4;
2881+ vars->eee_status |= (eee_idle & SHMEM_EEE_TIMER_MASK) |
2882+ SHMEM_EEE_TIME_OUTPUT_BIT;
2883+ } else {
2884+ if (bnx2x_eee_time_to_nvram(eee_idle, &eee_mode))
2885+ return -EINVAL;
2886+ vars->eee_status |= eee_mode;
2887+ }
2888+
2889+ return 0;
2890+}
2891+
2892+static int bnx2x_eee_initial_config(struct link_params *params,
2893+ struct link_vars *vars, u8 mode)
2894+{
2895+ vars->eee_status |= ((u32) mode) << SHMEM_EEE_SUPPORTED_SHIFT;
2896+
2897+ /* Propogate params' bits --> vars (for migration exposure) */
2898+ if (params->eee_mode & EEE_MODE_ENABLE_LPI)
2899+ vars->eee_status |= SHMEM_EEE_LPI_REQUESTED_BIT;
2900+ else
2901+ vars->eee_status &= ~SHMEM_EEE_LPI_REQUESTED_BIT;
2902+
2903+ if (params->eee_mode & EEE_MODE_ADV_LPI)
2904+ vars->eee_status |= SHMEM_EEE_REQUESTED_BIT;
2905+ else
2906+ vars->eee_status &= ~SHMEM_EEE_REQUESTED_BIT;
2907+
2908+ return bnx2x_eee_set_timers(params, vars);
2909+}
2910+
2911+static int bnx2x_eee_disable(struct bnx2x_phy *phy,
2912+ struct link_params *params,
2913+ struct link_vars *vars)
2914+{
2915+ struct bnx2x *bp = params->bp;
2916+
2917+ /* Make Certain LPI is disabled */
2918+ REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2), 0);
2919+
2920+ bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0x0);
2921+
2922+ vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
2923+
2924+ return 0;
2925+}
2926+
2927+static int bnx2x_eee_advertise(struct bnx2x_phy *phy,
2928+ struct link_params *params,
2929+ struct link_vars *vars, u8 modes)
2930+{
2931+ struct bnx2x *bp = params->bp;
2932+ u16 val = 0;
2933+
2934+ /* Mask events preventing LPI generation */
2935+ REG_WR(bp, MISC_REG_CPMU_LP_MASK_EXT_P0 + (params->port << 2), 0xfc20);
2936+
2937+ if (modes & SHMEM_EEE_10G_ADV) {
2938+ DP(NETIF_MSG_LINK, "Advertise 10GBase-T EEE\n");
2939+ val |= 0x8;
2940+ }
2941+ if (modes & SHMEM_EEE_1G_ADV) {
2942+ DP(NETIF_MSG_LINK, "Advertise 1GBase-T EEE\n");
2943+ val |= 0x4;
2944+ }
2945+
2946+ bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, val);
2947+
2948+ vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
2949+ vars->eee_status |= (modes << SHMEM_EEE_ADV_STATUS_SHIFT);
2950+
2951+ return 0;
2952+}
2953+
2954+static void bnx2x_update_mng_eee(struct link_params *params, u32 eee_status)
2955+{
2956+ struct bnx2x *bp = params->bp;
2957+
2958+ if (bnx2x_eee_has_cap(params))
2959+ REG_WR(bp, params->shmem2_base +
2960+ offsetof(struct shmem2_region,
2961+ eee_status[params->port]), eee_status);
2962+}
2963+
2964+static void bnx2x_eee_an_resolve(struct bnx2x_phy *phy,
2965+ struct link_params *params,
2966+ struct link_vars *vars)
2967+{
2968+ struct bnx2x *bp = params->bp;
2969+ u16 adv = 0, lp = 0;
2970+ u32 lp_adv = 0;
2971+ u8 neg = 0;
2972+
2973+ bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, &adv);
2974+ bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_LP_EEE_ADV, &lp);
2975+
2976+ if (lp & 0x2) {
2977+ lp_adv |= SHMEM_EEE_100M_ADV;
2978+ if (adv & 0x2) {
2979+ if (vars->line_speed == SPEED_100)
2980+ neg = 1;
2981+ DP(NETIF_MSG_LINK, "EEE negotiated - 100M\n");
2982+ }
2983+ }
2984+ if (lp & 0x14) {
2985+ lp_adv |= SHMEM_EEE_1G_ADV;
2986+ if (adv & 0x14) {
2987+ if (vars->line_speed == SPEED_1000)
2988+ neg = 1;
2989+ DP(NETIF_MSG_LINK, "EEE negotiated - 1G\n");
2990+ }
2991+ }
2992+ if (lp & 0x68) {
2993+ lp_adv |= SHMEM_EEE_10G_ADV;
2994+ if (adv & 0x68) {
2995+ if (vars->line_speed == SPEED_10000)
2996+ neg = 1;
2997+ DP(NETIF_MSG_LINK, "EEE negotiated - 10G\n");
2998+ }
2999+ }
3000+
3001+ vars->eee_status &= ~SHMEM_EEE_LP_ADV_STATUS_MASK;
3002+ vars->eee_status |= (lp_adv << SHMEM_EEE_LP_ADV_STATUS_SHIFT);
3003+
3004+ if (neg) {
3005+ DP(NETIF_MSG_LINK, "EEE is active\n");
3006+ vars->eee_status |= SHMEM_EEE_ACTIVE_BIT;
3007+ }
3008+
3009+}
3010+
32363011 /******************************************************************/
32373012 /* BSC access functions from E3 */
32383013 /******************************************************************/
@@ -3754,6 +3529,19 @@ static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy, · 515 unmodified lines
37543529 * init configuration, and set/clear SGMII flag. Internal
37553530 * phy init is done purely in phy_init stage.
37563531 */
3532+
3533+static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy,
3534+ struct link_params *params)
3535+{
3536+ struct bnx2x *bp = params->bp;
3537+
3538+ DP(NETIF_MSG_LINK, "Configure WC for LPI pass through\n");
3539+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3540+ MDIO_WC_REG_EEE_COMBO_CONTROL0, 0x7c);
3541+ bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
3542+ MDIO_WC_REG_DIGITAL4_MISC5, 0xc000);
3543+}
3544+
37573545 static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
37583546 struct link_params *params,
37593547 struct link_vars *vars) {
@@ -4013,13 +3801,7 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, · 253 unmodified lines
40133801 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
40143802 MDIO_WC_REG_DIGITAL4_MISC3, 0x8080);
40153803
4016− /* Enable LPI pass through */
4017− DP(NETIF_MSG_LINK, "Configure WC for LPI pass through\n");
4018− bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
4019− MDIO_WC_REG_EEE_COMBO_CONTROL0,
4020− 0x7c);
4021− bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
4022− MDIO_WC_REG_DIGITAL4_MISC5, 0xc000);
3804+ bnx2x_warpcore_set_lpi_passthrough(phy, params);
40233805
40243806 /* 10G XFI Full Duplex */
40253807 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
@@ -4116,6 +3898,8 @@ static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy, · 90 unmodified lines
41163898 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
41173899 MDIO_WC_REG_RX66_CONTROL, val16 & ~(3<<13));
41183900
3901+ bnx2x_warpcore_set_lpi_passthrough(phy, params);
3902+
41193903 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) {
41203904 /* SGMII Autoneg */
41213905 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
@@ -4409,7 +4193,7 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, · 287 unmodified lines
44094193 "serdes_net_if = 0x%x\n",
44104194 vars->line_speed, serdes_net_if);
44114195 bnx2x_set_aer_mmd(params, phy);
4412−
4196+ bnx2x_warpcore_reset_lane(bp, phy, 1);
44134197 vars->phy_flags |= PHY_XGXS_FLAG;
44144198 if ((serdes_net_if == PORT_HW_CFG_NET_SERDES_IF_SGMII) ||
44154199 (phy->req_line_speed &&
@@ -4718,6 +4502,10 @@ void bnx2x_link_status_update(struct link_params *params, · 302 unmodified lines
47184502 vars->link_status = REG_RD(bp, params->shmem_base +
47194503 offsetof(struct shmem_region,
47204504 port_mb[port].link_status));
4505+ if (bnx2x_eee_has_cap(params))
4506+ vars->eee_status = REG_RD(bp, params->shmem2_base +
4507+ offsetof(struct shmem2_region,
4508+ eee_status[params->port]));
47214509
47224510 vars->phy_flags = PHY_XGXS_FLAG;
47234511 bnx2x_sync_link(params, vars);
@@ -6530,25 +6318,21 @@ static int bnx2x_update_link_down(struct link_params *params, · 1806 unmodified lines
65306318 usleep_range(10000, 20000);
65316319 /* Reset BigMac/Xmac */
65326320 if (CHIP_IS_E1x(bp) ||
6533− CHIP_IS_E2(bp)) {
6534− bnx2x_bmac_rx_disable(bp, params->port);
6535− REG_WR(bp, GRCBASE_MISC +
6536− MISC_REGISTERS_RESET_REG_2_CLEAR,
6537− (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
6538− }
6321+ CHIP_IS_E2(bp))
6322+ bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 0);
6323+
65396324 if (CHIP_IS_E3(bp)) {
65406325 /* Prevent LPI Generation by chip */
65416326 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2),
65426327 0);
6543− REG_WR(bp, MISC_REG_CPMU_LP_DR_ENABLE, 0);
65446328 REG_WR(bp, MISC_REG_CPMU_LP_MASK_ENT_P0 + (params->port << 2),
65456329 0);
65466330 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK |
65476331 SHMEM_EEE_ACTIVE_BIT);
65486332
65496333 bnx2x_update_mng_eee(params, vars->eee_status);
6550− bnx2x_xmac_disable(params);
6551− bnx2x_umac_disable(params);
6334+ bnx2x_set_xmac_rxtx(params, 0);
6335+ bnx2x_set_umac_rxtx(params, 0);
65526336 }
65536337
65546338 return 0;
@@ -6600,7 +6384,7 @@ static int bnx2x_update_link_up(struct link_params *params, · 45 unmodified lines
66006384 if ((CHIP_IS_E1x(bp) ||
66016385 CHIP_IS_E2(bp))) {
66026386 if (link_10g) {
6603− if (bnx2x_bmac_enable(params, vars, 0) ==
6387+ if (bnx2x_bmac_enable(params, vars, 0, 1) ==
66046388 -ESRCH) {
66056389 DP(NETIF_MSG_LINK, "Found errors on BMAC\n");
66066390 vars->link_up = 0;
@@ -7207,6 +6991,22 @@ static void bnx2x_8073_set_pause_cl37(struct link_params *params, · 600 unmodified lines
72076991 msleep(500);
72086992 }
72096993
6994+static void bnx2x_8073_specific_func(struct bnx2x_phy *phy,
6995+ struct link_params *params,
6996+ u32 action)
6997+{
6998+ struct bnx2x *bp = params->bp;
6999+ switch (action) {
7000+ case PHY_INIT:
7001+ /* Enable LASI */
7002+ bnx2x_cl45_write(bp, phy,
7003+ MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, (1<<2));
7004+ bnx2x_cl45_write(bp, phy,
7005+ MDIO_PMA_DEVAD, MDIO_PMA_LASI_CTRL, 0x0004);
7006+ break;
7007+ }
7008+}
7009+
72107010 static int bnx2x_8073_config_init(struct bnx2x_phy *phy,
72117011 struct link_params *params,
72127012 struct link_vars *vars)
@@ -7227,12 +7027,7 @@ static int bnx2x_8073_config_init(struct bnx2x_phy *phy, · 14 unmodified lines
72277027 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,
72287028 MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port);
72297029
7230− /* Enable LASI */
7231− bnx2x_cl45_write(bp, phy,
7232− MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, (1<<2));
7233− bnx2x_cl45_write(bp, phy,
7234− MDIO_PMA_DEVAD, MDIO_PMA_LASI_CTRL, 0x0004);
7235−
7030+ bnx2x_8073_specific_func(phy, params, PHY_INIT);
72367031 bnx2x_8073_set_pause_cl37(params, phy, vars);
72377032
72387033 bnx2x_cl45_read(bp, phy,
@@ -8267,7 +8062,7 @@ static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, · 1028 unmodified lines
82678062 u32 action)
82688063 {
82698064 struct bnx2x *bp = params->bp;
8270−
8065+ u16 val;
82718066 switch (action) {
82728067 case DISABLE_TX:
82738068 bnx2x_sfp_set_transmitter(params, phy, 0);
@@ -8276,6 +8071,40 @@ static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, · 2 unmodified lines
82768071 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED))
82778072 bnx2x_sfp_set_transmitter(params, phy, 1);
82788073 break;
8074+ case PHY_INIT:
8075+ bnx2x_cl45_write(bp, phy,
8076+ MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL,
8077+ (1<<2) | (1<<5));
8078+ bnx2x_cl45_write(bp, phy,
8079+ MDIO_PMA_DEVAD, MDIO_PMA_LASI_TXCTRL,
8080+ 0);
8081+ bnx2x_cl45_write(bp, phy,
8082+ MDIO_PMA_DEVAD, MDIO_PMA_LASI_CTRL, 0x0006);
8083+ /* Make MOD_ABS give interrupt on change */
8084+ bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD,
8085+ MDIO_PMA_REG_8727_PCS_OPT_CTRL,
8086+ &val);
8087+ val |= (1<<12);
8088+ if (phy->flags & FLAGS_NOC)
8089+ val |= (3<<5);
8090+ /* Set 8727 GPIOs to input to allow reading from the 8727 GPIO0
8091+ * status which reflect SFP+ module over-current
8092+ */
8093+ if (!(phy->flags & FLAGS_NOC))
8094+ val &= 0xff8f; /* Reset bits 4-6 */
8095+ bnx2x_cl45_write(bp, phy,
8096+ MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_PCS_OPT_CTRL,
8097+ val);
8098+
8099+ /* Set 2-wire transfer rate of SFP+ module EEPROM
8100+ * to 100Khz since some DACs(direct attached cables) do
8101+ * not work at 400Khz.
8102+ */
8103+ bnx2x_cl45_write(bp, phy,
8104+ MDIO_PMA_DEVAD,
8105+ MDIO_PMA_REG_8727_TWO_WIRE_SLAVE_ADDR,
8106+ 0xa001);
8107+ break;
82798108 default:
82808109 DP(NETIF_MSG_LINK, "Function 0x%x not supported by 8727\n",
82818110 action);
@@ -9058,28 +8887,15 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, · 776 unmodified lines
90588887 struct link_vars *vars)
90598888 {
90608889 u32 tx_en_mode;
9061− u16 tmp1, val, mod_abs, tmp2;
9062− u16 rx_alarm_ctrl_val;
9063− u16 lasi_ctrl_val;
8890+ u16 tmp1, mod_abs, tmp2;
90648891 struct bnx2x *bp = params->bp;
90658892 /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */
90668893
90678894 bnx2x_wait_reset_complete(bp, phy, params);
9068− rx_alarm_ctrl_val = (1<<2) | (1<<5) ;
9069− /* Should be 0x6 to enable XS on Tx side. */
9070− lasi_ctrl_val = 0x0006;
90718895
90728896 DP(NETIF_MSG_LINK, "Initializing BCM8727\n");
9073− /* Enable LASI */
9074− bnx2x_cl45_write(bp, phy,
9075− MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL,
9076− rx_alarm_ctrl_val);
9077− bnx2x_cl45_write(bp, phy,
9078− MDIO_PMA_DEVAD, MDIO_PMA_LASI_TXCTRL,
9079− 0);
9080− bnx2x_cl45_write(bp, phy,
9081− MDIO_PMA_DEVAD, MDIO_PMA_LASI_CTRL, lasi_ctrl_val);
90828897
8898+ bnx2x_8727_specific_func(phy, params, PHY_INIT);
90838899 /* Initially configure MOD_ABS to interrupt when module is
90848900 * presence( bit 8)
90858901 */
@@ -9095,25 +8911,9 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, · 9 unmodified lines
90958911 bnx2x_cl45_write(bp, phy,
90968912 MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs);
90978913
9098−
90998914 /* Enable/Disable PHY transmitter output */
91008915 bnx2x_set_disable_pmd_transmit(params, phy, 0);
91018916
9102− /* Make MOD_ABS give interrupt on change */
9103− bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_PCS_OPT_CTRL,
9104− &val);
9105− val |= (1<<12);
9106− if (phy->flags & FLAGS_NOC)
9107− val |= (3<<5);
9108−
9109− /* Set 8727 GPIOs to input to allow reading from the 8727 GPIO0
9110− * status which reflect SFP+ module over-current
9111− */
9112− if (!(phy->flags & FLAGS_NOC))
9113− val &= 0xff8f; /* Reset bits 4-6 */
9114− bnx2x_cl45_write(bp, phy,
9115− MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_PCS_OPT_CTRL, val);
9116−
91178917 bnx2x_8727_power_module(bp, phy, 1);
91188918
91198919 bnx2x_cl45_read(bp, phy,
@@ -9123,13 +8923,7 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, · 3 unmodified lines
91238923 MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXSTAT, &tmp1);
91248924
91258925 bnx2x_8727_config_speed(phy, params);
9126− /* Set 2-wire transfer rate of SFP+ module EEPROM
9127− * to 100Khz since some DACs(direct attached cables) do
9128− * not work at 400Khz.
9129− */
9130− bnx2x_cl45_write(bp, phy,
9131− MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_TWO_WIRE_SLAVE_ADDR,
9132− 0xa001);
8926+
91338927
91348928 /* Set TX PreEmphasis if needed */
91358929 if ((params->feature_config_flags &
@@ -9558,6 +9352,29 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp, · 422 unmodified lines
95589352 0xFFFB, 0xFFFD);
95599353 }
95609354
9355+static void bnx2x_848xx_specific_func(struct bnx2x_phy *phy,
9356+ struct link_params *params,
9357+ u32 action)
9358+{
9359+ struct bnx2x *bp = params->bp;
9360+ switch (action) {
9361+ case PHY_INIT:
9362+ if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) {
9363+ /* Save spirom version */
9364+ bnx2x_save_848xx_spirom_version(phy, bp, params->port);
9365+ }
9366+ /* This phy uses the NIG latch mechanism since link indication
9367+ * arrives through its LED4 and not via its LASI signal, so we
9368+ * get steady signal instead of clear on read
9369+ */
9370+ bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4,
9371+ 1 << NIG_LATCH_BC_ENABLE_MI_INT);
9372+
9373+ bnx2x_848xx_set_led(bp, phy);
9374+ break;
9375+ }
9376+}
9377+
95619378 static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
95629379 struct link_params *params,
95639380 struct link_vars *vars)
@@ -9565,22 +9382,10 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, · 1 unmodified line
95659382 struct bnx2x *bp = params->bp;
95669383 u16 autoneg_val, an_1000_val, an_10_100_val, an_10g_val;
95679384
9568− if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) {
9569− /* Save spirom version */
9570− bnx2x_save_848xx_spirom_version(phy, bp, params->port);
9571− }
9572− /* This phy uses the NIG latch mechanism since link indication
9573− * arrives through its LED4 and not via its LASI signal, so we
9574− * get steady signal instead of clear on read
9575− */
9576− bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4,
9577− 1 << NIG_LATCH_BC_ENABLE_MI_INT);
9578−
9385+ bnx2x_848xx_specific_func(phy, params, PHY_INIT);
95799386 bnx2x_cl45_write(bp, phy,
95809387 MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0x0000);
95819388
9582− bnx2x_848xx_set_led(bp, phy);
9583−
95849389 /* set 1000 speed advertisement */
95859390 bnx2x_cl45_read(bp, phy,
95869391 MDIO_AN_DEVAD, MDIO_AN_REG_8481_1000T_CTRL,
@@ -9887,39 +9692,6 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, · 300 unmodified lines
98879692 return 0;
98889693 }
98899694
9890−static int bnx2x_8483x_eee_timers(struct link_params *params,
9891− struct link_vars *vars)
9892−{
9893− u32 eee_idle = 0, eee_mode;
9894− struct bnx2x *bp = params->bp;
9895−
9896− eee_idle = bnx2x_eee_calc_timer(params);
9897−
9898− if (eee_idle) {
9899− REG_WR(bp, MISC_REG_CPMU_LP_IDLE_THR_P0 + (params->port << 2),
9900− eee_idle);
9901− } else if ((params->eee_mode & EEE_MODE_ENABLE_LPI) &&
9902− (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) &&
9903− (params->eee_mode & EEE_MODE_OUTPUT_TIME)) {
9904− DP(NETIF_MSG_LINK, "Error: Tx LPI is enabled with timer 0\n");
9905− return -EINVAL;
9906− }
9907−
9908− vars->eee_status &= ~(SHMEM_EEE_TIMER_MASK | SHMEM_EEE_TIME_OUTPUT_BIT);
9909− if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
9910− /* eee_idle in 1u --> eee_status in 16u */
9911− eee_idle >>= 4;
9912− vars->eee_status |= (eee_idle & SHMEM_EEE_TIMER_MASK) |
9913− SHMEM_EEE_TIME_OUTPUT_BIT;
9914− } else {
9915− if (bnx2x_eee_time_to_nvram(eee_idle, &eee_mode))
9916− return -EINVAL;
9917− vars->eee_status |= eee_mode;
9918− }
9919−
9920− return 0;
9921−}
9922−
99239695 static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,
99249696 struct link_params *params,
99259697 struct link_vars *vars)
@@ -9930,10 +9702,6 @@ static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy, · 4 unmodified lines
99309702
99319703 DP(NETIF_MSG_LINK, "Don't Advertise 10GBase-T EEE\n");
99329704
9933− /* Make Certain LPI is disabled */
9934− REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2), 0);
9935− REG_WR(bp, MISC_REG_CPMU_LP_DR_ENABLE, 0);
9936−
99379705 /* Prevent Phy from working in EEE and advertising it */
99389706 rc = bnx2x_84833_cmd_hdlr(phy, params,
99399707 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);
@@ -9942,10 +9710,7 @@ static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy, · 2 unmodified lines
99429710 return rc;
99439711 }
99449712
9945− bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0);
9946− vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
9947−
9948− return 0;
9713+ return bnx2x_eee_disable(phy, params, vars);
99499714 }
99509715
99519716 static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy,
@@ -9956,8 +9721,6 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy, · 4 unmodified lines
99569721 struct bnx2x *bp = params->bp;
99579722 u16 cmd_args = 1;
99589723
9959− DP(NETIF_MSG_LINK, "Advertise 10GBase-T EEE\n");
9960−
99619724 rc = bnx2x_84833_cmd_hdlr(phy, params,
99629725 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);
99639726 if (rc) {
@@ -9965,15 +9728,7 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy, · 1 unmodified line
99659728 return rc;
99669729 }
99679730
9968− bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0x8);
9969−
9970− /* Mask events preventing LPI generation */
9971− REG_WR(bp, MISC_REG_CPMU_LP_MASK_EXT_P0 + (params->port << 2), 0xfc20);
9972−
9973− vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
9974− vars->eee_status |= (SHMEM_EEE_10G_ADV << SHMEM_EEE_ADV_STATUS_SHIFT);
9975−
9976− return 0;
9731+ return bnx2x_eee_advertise(phy, params, vars, SHMEM_EEE_10G_ADV);
99779732 }
99789733
99799734 #define PHY84833_CONSTANT_LATENCY 1193
@@ -10105,22 +9860,10 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 125 unmodified lines
101059860 MDIO_84833_TOP_CFG_FW_REV, &val);
101069861
101079862 /* Configure EEE support */
10108− if ((val >= MDIO_84833_TOP_CFG_FW_EEE) && bnx2x_eee_has_cap(params)) {
10109− phy->flags |= FLAGS_EEE_10GBT;
10110− vars->eee_status |= SHMEM_EEE_10G_ADV <<
10111− SHMEM_EEE_SUPPORTED_SHIFT;
10112− /* Propogate params' bits --> vars (for migration exposure) */
10113− if (params->eee_mode & EEE_MODE_ENABLE_LPI)
10114− vars->eee_status |= SHMEM_EEE_LPI_REQUESTED_BIT;
10115− else
10116− vars->eee_status &= ~SHMEM_EEE_LPI_REQUESTED_BIT;
10117−
10118− if (params->eee_mode & EEE_MODE_ADV_LPI)
10119− vars->eee_status |= SHMEM_EEE_REQUESTED_BIT;
10120− else
10121− vars->eee_status &= ~SHMEM_EEE_REQUESTED_BIT;
10122−
10123− rc = bnx2x_8483x_eee_timers(params, vars);
9863+ if ((val >= MDIO_84833_TOP_CFG_FW_EEE) &&
9864+ (val != MDIO_84833_TOP_CFG_FW_NO_EEE) &&
9865+ bnx2x_eee_has_cap(params)) {
9866+ rc = bnx2x_eee_initial_config(params, vars, SHMEM_EEE_10G_ADV);
101249867 if (rc) {
101259868 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n");
101269869 bnx2x_8483x_disable_eee(phy, params, vars);
@@ -10139,7 +9882,6 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 12 unmodified lines
101399882 return rc;
101409883 }
101419884 } else {
10142− phy->flags &= ~FLAGS_EEE_10GBT;
101439885 vars->eee_status &= ~SHMEM_EEE_SUPPORTED_MASK;
101449886 }
101459887
@@ -10278,29 +10020,8 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, · 132 unmodified lines
1027810020 LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE;
1027910021
1028010022 /* Determine if EEE was negotiated */
10281− if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) {
10282− u32 eee_shmem = 0;
10283−
10284− bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
10285− MDIO_AN_REG_EEE_ADV, &val1);
10286− bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
10287− MDIO_AN_REG_LP_EEE_ADV, &val2);
10288− if ((val1 & val2) & 0x8) {
10289− DP(NETIF_MSG_LINK, "EEE negotiated\n");
10290− vars->eee_status |= SHMEM_EEE_ACTIVE_BIT;
10291− }
10292−
10293− if (val2 & 0x12)
10294− eee_shmem |= SHMEM_EEE_100M_ADV;
10295− if (val2 & 0x4)
10296− eee_shmem |= SHMEM_EEE_1G_ADV;
10297− if (val2 & 0x68)
10298− eee_shmem |= SHMEM_EEE_10G_ADV;
10299−
10300− vars->eee_status &= ~SHMEM_EEE_LP_ADV_STATUS_MASK;
10301− vars->eee_status |= (eee_shmem <<
10302− SHMEM_EEE_LP_ADV_STATUS_SHIFT);
10303− }
10023+ if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833)
10024+ bnx2x_eee_an_resolve(phy, params, vars);
1030410025 }
1030510026
1030610027 return link_up;
@@ -10569,6 +10290,35 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, · 262 unmodified lines
1056910290 /******************************************************************/
1057010291 /* 54618SE PHY SECTION */
1057110292 /******************************************************************/
10293+static void bnx2x_54618se_specific_func(struct bnx2x_phy *phy,
10294+ struct link_params *params,
10295+ u32 action)
10296+{
10297+ struct bnx2x *bp = params->bp;
10298+ u16 temp;
10299+ switch (action) {
10300+ case PHY_INIT:
10301+ /* Configure LED4: set to INTR (0x6). */
10302+ /* Accessing shadow register 0xe. */
10303+ bnx2x_cl22_write(bp, phy,
10304+ MDIO_REG_GPHY_SHADOW,
10305+ MDIO_REG_GPHY_SHADOW_LED_SEL2);
10306+ bnx2x_cl22_read(bp, phy,
10307+ MDIO_REG_GPHY_SHADOW,
10308+ &temp);
10309+ temp &= ~(0xf << 4);
10310+ temp |= (0x6 << 4);
10311+ bnx2x_cl22_write(bp, phy,
10312+ MDIO_REG_GPHY_SHADOW,
10313+ MDIO_REG_GPHY_SHADOW_WR_ENA | temp);
10314+ /* Configure INTR based on link status change. */
10315+ bnx2x_cl22_write(bp, phy,
10316+ MDIO_REG_INTR_MASK,
10317+ ~MDIO_REG_INTR_MASK_LINK_STATUS);
10318+ break;
10319+ }
10320+}
10321+
1057210322 static int bnx2x_54618se_config_init(struct bnx2x_phy *phy,
1057310323 struct link_params *params,
1057410324 struct link_vars *vars)
@@ -10606,24 +10356,8 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, · 31 unmodified lines
1060610356 /* Wait for GPHY to reset */
1060710357 msleep(50);
1060810358
10609− /* Configure LED4: set to INTR (0x6). */
10610− /* Accessing shadow register 0xe. */
10611− bnx2x_cl22_write(bp, phy,
10612− MDIO_REG_GPHY_SHADOW,
10613− MDIO_REG_GPHY_SHADOW_LED_SEL2);
10614− bnx2x_cl22_read(bp, phy,
10615− MDIO_REG_GPHY_SHADOW,
10616− &temp);
10617− temp &= ~(0xf << 4);
10618− temp |= (0x6 << 4);
10619− bnx2x_cl22_write(bp, phy,
10620− MDIO_REG_GPHY_SHADOW,
10621− MDIO_REG_GPHY_SHADOW_WR_ENA | temp);
10622− /* Configure INTR based on link status change. */
10623− bnx2x_cl22_write(bp, phy,
10624− MDIO_REG_INTR_MASK,
10625− ~MDIO_REG_INTR_MASK_LINK_STATUS);
1062610359
10360+ bnx2x_54618se_specific_func(phy, params, PHY_INIT);
1062710361 /* Flip the signal detect polarity (set 0x1c.0x1e[8]). */
1062810362 bnx2x_cl22_write(bp, phy,
1062910363 MDIO_REG_GPHY_SHADOW,
@@ -10728,28 +10462,52 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, · 98 unmodified lines
1072810462 DP(NETIF_MSG_LINK, "Setting 10M force\n");
1072910463 }
1073010464
10731− /* Check if we should turn on Auto-GrEEEn */
10732− bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_PHYID_LSB, &temp);
10733− if (temp == MDIO_REG_GPHY_ID_54618SE) {
10734− if (params->feature_config_flags &
10735− FEATURE_CONFIG_AUTOGREEEN_ENABLED) {
10736− temp = 6;
10737− DP(NETIF_MSG_LINK, "Enabling Auto-GrEEEn\n");
10465+ if ((phy->flags & FLAGS_EEE) && bnx2x_eee_has_cap(params)) {
10466+ int rc;
10467+
10468+ bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS,
10469+ MDIO_REG_GPHY_EXP_ACCESS_TOP |
10470+ MDIO_REG_GPHY_EXP_TOP_2K_BUF);
10471+ bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_EXP_ACCESS_GATE, &temp);
10472+ temp &= 0xfffe;
10473+ bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS_GATE, temp);
10474+
10475+ rc = bnx2x_eee_initial_config(params, vars, SHMEM_EEE_1G_ADV);
10476+ if (rc) {
10477+ DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n");
10478+ bnx2x_eee_disable(phy, params, vars);
10479+ } else if ((params->eee_mode & EEE_MODE_ADV_LPI) &&
10480+ (phy->req_duplex == DUPLEX_FULL) &&
10481+ (bnx2x_eee_calc_timer(params) ||
10482+ !(params->eee_mode & EEE_MODE_ENABLE_LPI))) {
10483+ /* Need to advertise EEE only when requested,
10484+ * and either no LPI assertion was requested,
10485+ * or it was requested and a valid timer was set.
10486+ * Also notice full duplex is required for EEE.
10487+ */
10488+ bnx2x_eee_advertise(phy, params, vars,
10489+ SHMEM_EEE_1G_ADV);
1073810490 } else {
10739− temp = 0;
10740− DP(NETIF_MSG_LINK, "Disabling Auto-GrEEEn\n");
10491+ DP(NETIF_MSG_LINK, "Don't Advertise 1GBase-T EEE\n");
10492+ bnx2x_eee_disable(phy, params, vars);
10493+ }
10494+ } else {
10495+ vars->eee_status &= ~SHMEM_EEE_1G_ADV <<
10496+ SHMEM_EEE_SUPPORTED_SHIFT;
10497+
10498+ if (phy->flags & FLAGS_EEE) {
10499+ /* Handle legacy auto-grEEEn */
10500+ if (params->feature_config_flags &
10501+ FEATURE_CONFIG_AUTOGREEEN_ENABLED) {
10502+ temp = 6;
10503+ DP(NETIF_MSG_LINK, "Enabling Auto-GrEEEn\n");
10504+ } else {
10505+ temp = 0;
10506+ DP(NETIF_MSG_LINK, "Don't Adv. EEE\n");
10507+ }
10508+ bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
10509+ MDIO_AN_REG_EEE_ADV, temp);
1074110510 }
10742− bnx2x_cl22_write(bp, phy,
10743− MDIO_REG_GPHY_CL45_ADDR_REG, MDIO_AN_DEVAD);
10744− bnx2x_cl22_write(bp, phy,
10745− MDIO_REG_GPHY_CL45_DATA_REG,
10746− MDIO_REG_GPHY_EEE_ADV);
10747− bnx2x_cl22_write(bp, phy,
10748− MDIO_REG_GPHY_CL45_ADDR_REG,
10749− (0x1 << 14) | MDIO_AN_DEVAD);
10750− bnx2x_cl22_write(bp, phy,
10751− MDIO_REG_GPHY_CL45_DATA_REG,
10752− temp);
1075310511 }
1075410512
1075510513 bnx2x_cl22_write(bp, phy,
@@ -10896,29 +10654,6 @@ static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy, · 140 unmodified lines
1089610654 DP(NETIF_MSG_LINK, "BCM54618SE: link speed is %d\n",
1089710655 vars->line_speed);
1089810656
10899− /* Report whether EEE is resolved. */
10900− bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_PHYID_LSB, &val);
10901− if (val == MDIO_REG_GPHY_ID_54618SE) {
10902− if (vars->link_status &
10903− LINK_STATUS_AUTO_NEGOTIATE_COMPLETE)
10904− val = 0;
10905− else {
10906− bnx2x_cl22_write(bp, phy,
10907− MDIO_REG_GPHY_CL45_ADDR_REG,
10908− MDIO_AN_DEVAD);
10909− bnx2x_cl22_write(bp, phy,
10910− MDIO_REG_GPHY_CL45_DATA_REG,
10911− MDIO_REG_GPHY_EEE_RESOLVED);
10912− bnx2x_cl22_write(bp, phy,
10913− MDIO_REG_GPHY_CL45_ADDR_REG,
10914− (0x1 << 14) | MDIO_AN_DEVAD);
10915− bnx2x_cl22_read(bp, phy,
10916− MDIO_REG_GPHY_CL45_DATA_REG,
10917− &val);
10918− }
10919− DP(NETIF_MSG_LINK, "EEE resolution: 0x%x\n", val);
10920− }
10921−
1092210657 bnx2x_ext_phy_resolve_fc(phy, params, vars);
1092310658
1092410659 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) {
@@ -10948,6 +10683,10 @@ static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy, · 23 unmodified lines
1094810683 if (val & (1<<11))
1094910684 vars->link_status |=
1095010685 LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE;
10686+
10687+ if ((phy->flags & FLAGS_EEE) &&
10688+ bnx2x_eee_has_cap(params))
10689+ bnx2x_eee_an_resolve(phy, params, vars);
1095110690 }
1095210691 }
1095310692 return link_up;
@@ -11353,7 +11092,7 @@ static struct bnx2x_phy phy_8073 = { · 399 unmodified lines
1135311092 .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver,
1135411093 .hw_reset = (hw_reset_t)NULL,
1135511094 .set_link_led = (set_link_led_t)NULL,
11356− .phy_specific_func = (phy_specific_func_t)NULL
11095+ .phy_specific_func = (phy_specific_func_t)bnx2x_8073_specific_func
1135711096 };
1135811097 static struct bnx2x_phy phy_8705 = {
1135911098 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705,
@@ -11546,7 +11285,7 @@ static struct bnx2x_phy phy_84823 = { · 186 unmodified lines
1154611285 .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver,
1154711286 .hw_reset = (hw_reset_t)NULL,
1154811287 .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led,
11549− .phy_specific_func = (phy_specific_func_t)NULL
11288+ .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func
1155011289 };
1155111290
1155211291 static struct bnx2x_phy phy_84833 = {
@@ -11555,8 +11294,7 @@ static struct bnx2x_phy phy_84833 = { · 2 unmodified lines
1155511294 .def_md_devad = 0,
1155611295 .flags = (FLAGS_FAN_FAILURE_DET_REQ |
1155711296 FLAGS_REARM_LATCH_SIGNAL |
11558− FLAGS_TX_ERROR_CHECK |
11559− FLAGS_EEE_10GBT),
11297+ FLAGS_TX_ERROR_CHECK),
1156011298 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
1156111299 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
1156211300 .mdio_ctrl = 0,
@@ -11582,7 +11320,7 @@ static struct bnx2x_phy phy_84833 = { · 19 unmodified lines
1158211320 .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver,
1158311321 .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy,
1158411322 .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led,
11585− .phy_specific_func = (phy_specific_func_t)NULL
11323+ .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func
1158611324 };
1158711325
1158811326 static struct bnx2x_phy phy_54618se = {
@@ -11616,7 +11354,7 @@ static struct bnx2x_phy phy_54618se = { · 27 unmodified lines
1161611354 .format_fw_ver = (format_fw_ver_t)NULL,
1161711355 .hw_reset = (hw_reset_t)NULL,
1161811356 .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led,
11619− .phy_specific_func = (phy_specific_func_t)NULL
11357+ .phy_specific_func = (phy_specific_func_t)bnx2x_54618se_specific_func
1162011358 };
1162111359 /*****************************************************************/
1162211360 /* */
@@ -11862,6 +11600,8 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp, · 239 unmodified lines
1186211600 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616:
1186311601 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE:
1186411602 *phy = phy_54618se;
11603+ if (phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE)
11604+ phy->flags |= FLAGS_EEE;
1186511605 break;
1186611606 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
1186711607 *phy = phy_7101;
@@ -12141,7 +11881,7 @@ void bnx2x_init_bmac_loopback(struct link_params *params, · 273 unmodified lines
1214111881 bnx2x_xgxs_deassert(params);
1214211882
1214311883 /* set bmac loopback */
12144− bnx2x_bmac_enable(params, vars, 1);
11884+ bnx2x_bmac_enable(params, vars, 1, 1);
1214511885
1214611886 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);
1214711887 }
@@ -12233,7 +11973,7 @@ void bnx2x_init_xgxs_loopback(struct link_params *params, · 85 unmodified lines
1223311973 if (USES_WARPCORE(bp))
1223411974 bnx2x_xmac_enable(params, vars, 0);
1223511975 else
12236− bnx2x_bmac_enable(params, vars, 0);
11976+ bnx2x_bmac_enable(params, vars, 0, 1);
1223711977 }
1223811978
1223911979 if (params->loopback_mode == LOOPBACK_XGXS) {
@@ -12258,8 +11998,161 @@ void bnx2x_init_xgxs_loopback(struct link_params *params, · 18 unmodified lines
1225811998 bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed);
1225911999 }
1226012000
12001+static void bnx2x_set_rx_filter(struct link_params *params, u8 en)
12002+{
12003+ struct bnx2x *bp = params->bp;
12004+ u8 val = en * 0x1F;
12005+
12006+ /* Open the gate between the NIG to the BRB */
12007+ if (!CHIP_IS_E1x(bp))
12008+ val |= en * 0x20;
12009+ REG_WR(bp, NIG_REG_LLH0_BRB1_DRV_MASK + params->port*4, val);
12010+
12011+ if (!CHIP_IS_E1(bp)) {
12012+ REG_WR(bp, NIG_REG_LLH0_BRB1_DRV_MASK_MF + params->port*4,
12013+ en*0x3);
12014+ }
12015+
12016+ REG_WR(bp, (params->port ? NIG_REG_LLH1_BRB1_NOT_MCP :
12017+ NIG_REG_LLH0_BRB1_NOT_MCP), en);
12018+}
12019+static int bnx2x_avoid_link_flap(struct link_params *params,
12020+ struct link_vars *vars)
12021+{
12022+ u32 phy_idx;
12023+ u32 dont_clear_stat, lfa_sts;
12024+ struct bnx2x *bp = params->bp;
12025+
12026+ /* Sync the link parameters */
12027+ bnx2x_link_status_update(params, vars);
12028+
12029+ /*
12030+ * The module verification was already done by previous link owner,
12031+ * so this call is meant only to get warning message
12032+ */
12033+
12034+ for (phy_idx = INT_PHY; phy_idx < params->num_phys; phy_idx++) {
12035+ struct bnx2x_phy *phy = &params->phy[phy_idx];
12036+ if (phy->phy_specific_func) {
12037+ DP(NETIF_MSG_LINK, "Calling PHY specific func\n");
12038+ phy->phy_specific_func(phy, params, PHY_INIT);
12039+ }
12040+ if ((phy->media_type == ETH_PHY_SFPP_10G_FIBER) ||
12041+ (phy->media_type == ETH_PHY_SFP_1G_FIBER) ||
12042+ (phy->media_type == ETH_PHY_DA_TWINAX))
12043+ bnx2x_verify_sfp_module(phy, params);
12044+ }
12045+ lfa_sts = REG_RD(bp, params->lfa_base +
12046+ offsetof(struct shmem_lfa,
12047+ lfa_sts));
12048+
12049+ dont_clear_stat = lfa_sts & SHMEM_LFA_DONT_CLEAR_STAT;
12050+
12051+ /* Re-enable the NIG/MAC */
12052+ if (CHIP_IS_E3(bp)) {
12053+ if (!dont_clear_stat) {
12054+ REG_WR(bp, GRCBASE_MISC +
12055+ MISC_REGISTERS_RESET_REG_2_CLEAR,
12056+ (MISC_REGISTERS_RESET_REG_2_MSTAT0 <<
12057+ params->port));
12058+ REG_WR(bp, GRCBASE_MISC +
12059+ MISC_REGISTERS_RESET_REG_2_SET,
12060+ (MISC_REGISTERS_RESET_REG_2_MSTAT0 <<
12061+ params->port));
12062+ }
12063+ if (vars->line_speed < SPEED_10000)
12064+ bnx2x_umac_enable(params, vars, 0);
12065+ else
12066+ bnx2x_xmac_enable(params, vars, 0);
12067+ } else {
12068+ if (vars->line_speed < SPEED_10000)
12069+ bnx2x_emac_enable(params, vars, 0);
12070+ else
12071+ bnx2x_bmac_enable(params, vars, 0, !dont_clear_stat);
12072+ }
12073+
12074+ /* Increment LFA count */
12075+ lfa_sts = ((lfa_sts & ~LINK_FLAP_AVOIDANCE_COUNT_MASK) |
12076+ (((((lfa_sts & LINK_FLAP_AVOIDANCE_COUNT_MASK) >>
12077+ LINK_FLAP_AVOIDANCE_COUNT_OFFSET) + 1) & 0xff)
12078+ << LINK_FLAP_AVOIDANCE_COUNT_OFFSET));
12079+ /* Clear link flap reason */
12080+ lfa_sts &= ~LFA_LINK_FLAP_REASON_MASK;
12081+
12082+ REG_WR(bp, params->lfa_base +
12083+ offsetof(struct shmem_lfa, lfa_sts), lfa_sts);
12084+
12085+ /* Disable NIG DRAIN */
12086+ REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);
12087+
12088+ /* Enable interrupts */
12089+ bnx2x_link_int_enable(params);
12090+ return 0;
12091+}
12092+
12093+static void bnx2x_cannot_avoid_link_flap(struct link_params *params,
12094+ struct link_vars *vars,
12095+ int lfa_status)
12096+{
12097+ u32 lfa_sts, cfg_idx, tmp_val;
12098+ struct bnx2x *bp = params->bp;
12099+
12100+ bnx2x_link_reset(params, vars, 1);
12101+
12102+ if (!params->lfa_base)
12103+ return;
12104+ /* Store the new link parameters */
12105+ REG_WR(bp, params->lfa_base +
12106+ offsetof(struct shmem_lfa, req_duplex),
12107+ params->req_duplex[0] | (params->req_duplex[1] << 16));
12108+
12109+ REG_WR(bp, params->lfa_base +
12110+ offsetof(struct shmem_lfa, req_flow_ctrl),
12111+ params->req_flow_ctrl[0] | (params->req_flow_ctrl[1] << 16));
12112+
12113+ REG_WR(bp, params->lfa_base +
12114+ offsetof(struct shmem_lfa, req_line_speed),
12115+ params->req_line_speed[0] | (params->req_line_speed[1] << 16));
12116+
12117+ for (cfg_idx = 0; cfg_idx < SHMEM_LINK_CONFIG_SIZE; cfg_idx++) {
12118+ REG_WR(bp, params->lfa_base +
12119+ offsetof(struct shmem_lfa,
12120+ speed_cap_mask[cfg_idx]),
12121+ params->speed_cap_mask[cfg_idx]);
12122+ }
12123+
12124+ tmp_val = REG_RD(bp, params->lfa_base +
12125+ offsetof(struct shmem_lfa, additional_config));
12126+ tmp_val &= ~REQ_FC_AUTO_ADV_MASK;
12127+ tmp_val |= params->req_fc_auto_adv;
12128+
12129+ REG_WR(bp, params->lfa_base +
12130+ offsetof(struct shmem_lfa, additional_config), tmp_val);
12131+
12132+ lfa_sts = REG_RD(bp, params->lfa_base +
12133+ offsetof(struct shmem_lfa, lfa_sts));
12134+
12135+ /* Clear the "Don't Clear Statistics" bit, and set reason */
12136+ lfa_sts &= ~SHMEM_LFA_DONT_CLEAR_STAT;
12137+
12138+ /* Set link flap reason */
12139+ lfa_sts &= ~LFA_LINK_FLAP_REASON_MASK;
12140+ lfa_sts |= ((lfa_status & LFA_LINK_FLAP_REASON_MASK) <<
12141+ LFA_LINK_FLAP_REASON_OFFSET);
12142+
12143+ /* Increment link flap counter */
12144+ lfa_sts = ((lfa_sts & ~LINK_FLAP_COUNT_MASK) |
12145+ (((((lfa_sts & LINK_FLAP_COUNT_MASK) >>
12146+ LINK_FLAP_COUNT_OFFSET) + 1) & 0xff)
12147+ << LINK_FLAP_COUNT_OFFSET));
12148+ REG_WR(bp, params->lfa_base +
12149+ offsetof(struct shmem_lfa, lfa_sts), lfa_sts);
12150+ /* Proceed with regular link initialization */
12151+}
12152+
1226112153 int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
1226212154 {
12155+ int lfa_status;
1226312156 struct bnx2x *bp = params->bp;
1226412157 DP(NETIF_MSG_LINK, "Phy Initialization started\n");
1226512158 DP(NETIF_MSG_LINK, "(1) req_speed %d, req_flowctrl %d\n",
@@ -12274,6 +12167,19 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars) · 8 unmodified lines
1227412167 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE;
1227512168 vars->mac_type = MAC_TYPE_NONE;
1227612169 vars->phy_flags = 0;
12170+ /* Driver opens NIG-BRB filters */
12171+ bnx2x_set_rx_filter(params, 1);
12172+ /* Check if link flap can be avoided */
12173+ lfa_status = bnx2x_check_lfa(params);
12174+
12175+ if (lfa_status == 0) {
12176+ DP(NETIF_MSG_LINK, "Link Flap Avoidance in progress\n");
12177+ return bnx2x_avoid_link_flap(params, vars);
12178+ }
12179+
12180+ DP(NETIF_MSG_LINK, "Cannot avoid link flap lfa_sta=0x%x\n",
12181+ lfa_status);
12182+ bnx2x_cannot_avoid_link_flap(params, vars, lfa_status);
1227712183
1227812184 /* Disable attentions */
1227912185 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4,
@@ -12356,13 +12262,12 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars, · 76 unmodified lines
1235612262 REG_WR(bp, NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0);
1235712263 }
1235812264
12359− /* Stop BigMac rx */
12360− if (!CHIP_IS_E3(bp))
12361− bnx2x_bmac_rx_disable(bp, port);
12362− else {
12363− bnx2x_xmac_disable(params);
12364− bnx2x_umac_disable(params);
12365− }
12265+ if (!CHIP_IS_E3(bp)) {
12266+ bnx2x_set_bmac_rx(bp, params->chip_id, port, 0);
12267+ } else {
12268+ bnx2x_set_xmac_rxtx(params, 0);
12269+ bnx2x_set_umac_rxtx(params, 0);
12270+ }
1236612271 /* Disable emac */
1236712272 if (!CHIP_IS_E3(bp))
1236812273 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0);
@@ -12420,6 +12325,56 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars, · 51 unmodified lines
1242012325 vars->phy_flags = 0;
1242112326 return 0;
1242212327 }
12328+int bnx2x_lfa_reset(struct link_params *params,
12329+ struct link_vars *vars)
12330+{
12331+ struct bnx2x *bp = params->bp;
12332+ vars->link_up = 0;
12333+ vars->phy_flags = 0;
12334+ if (!params->lfa_base)
12335+ return bnx2x_link_reset(params, vars, 1);
12336+ /*
12337+ * Activate NIG drain so that during this time the device won't send
12338+ * anything while it is unable to response.
12339+ */
12340+ REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 1);
12341+
12342+ /*
12343+ * Close gracefully the gate from BMAC to NIG such that no half packets
12344+ * are passed.
12345+ */
12346+ if (!CHIP_IS_E3(bp))
12347+ bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 0);
12348+
12349+ if (CHIP_IS_E3(bp)) {
12350+ bnx2x_set_xmac_rxtx(params, 0);
12351+ bnx2x_set_umac_rxtx(params, 0);
12352+ }
12353+ /* Wait 10ms for the pipe to clean up*/
12354+ usleep_range(10000, 20000);
12355+
12356+ /* Clean the NIG-BRB using the network filters in a way that will
12357+ * not cut a packet in the middle.
12358+ */
12359+ bnx2x_set_rx_filter(params, 0);
12360+
12361+ /*
12362+ * Re-open the gate between the BMAC and the NIG, after verifying the
12363+ * gate to the BRB is closed, otherwise packets may arrive to the
12364+ * firmware before driver had initialized it. The target is to achieve
12365+ * minimum management protocol down time.
12366+ */
12367+ if (!CHIP_IS_E3(bp))
12368+ bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 1);
12369+
12370+ if (CHIP_IS_E3(bp)) {
12371+ bnx2x_set_xmac_rxtx(params, 1);
12372+ bnx2x_set_umac_rxtx(params, 1);
12373+ }
12374+ /* Disable NIG drain */
12375+ REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);
12376+ return 0;
12377+}
1242312378
1242412379 /****************************************************************************/
1242512380 /* Common function */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h+5−2
@@ -155,7 +155,7 @@ struct bnx2x_phy { · 154 unmodified lines
155155 #define FLAGS_DUMMY_READ (1<<9)
156156 #define FLAGS_MDC_MDIO_WA_B0 (1<<10)
157157 #define FLAGS_TX_ERROR_CHECK (1<<12)
158−#define FLAGS_EEE_10GBT (1<<13)
158+#define FLAGS_EEE (1<<13)
159159
160160 /* preemphasis values for the rx side */
161161 u16 rx_preemphasis[4];
@@ -216,6 +216,7 @@ struct bnx2x_phy { · 54 unmodified lines
216216 phy_specific_func_t phy_specific_func;
217217 #define DISABLE_TX 1
218218 #define ENABLE_TX 2
219+#define PHY_INIT 3
219220 };
220221
221222 /* Inputs parameters to the CLC */
@@ -304,6 +305,8 @@ struct link_params { · 82 unmodified lines
304305 struct bnx2x *bp;
305306 u16 req_fc_auto_adv; /* Should be set to TX / BOTH when
306307 req_flow_ctrl is set to AUTO */
308+ u16 rsrv1;
309+ u32 lfa_base;
307310 };
308311
309312 /* Output parameters */
@@ -356,7 +359,7 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars); · 46 unmodified lines
356359 to 0 */
357360 int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
358361 u8 reset_ext_phy);
359−
362+int bnx2x_lfa_reset(struct link_params *params, struct link_vars *vars);
360363 /* bnx2x_link_update should be called upon link interrupt */
361364 int bnx2x_link_update(struct link_params *params, struct link_vars *vars);
362365
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+22−12
@@ -2166,7 +2166,6 @@ void bnx2x_link_set(struct bnx2x *bp) · 2165 unmodified lines
21662166 {
21672167 if (!BP_NOMCP(bp)) {
21682168 bnx2x_acquire_phy_lock(bp);
2169− bnx2x_link_reset(&bp->link_params, &bp->link_vars, 1);
21702169 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
21712170 bnx2x_release_phy_lock(bp);
21722171
@@ -2179,12 +2178,19 @@ static void bnx2x__link_reset(struct bnx2x *bp) · 6 unmodified lines
21792178 {
21802179 if (!BP_NOMCP(bp)) {
21812180 bnx2x_acquire_phy_lock(bp);
2182− bnx2x_link_reset(&bp->link_params, &bp->link_vars, 1);
2181+ bnx2x_lfa_reset(&bp->link_params, &bp->link_vars);
21832182 bnx2x_release_phy_lock(bp);
21842183 } else
21852184 BNX2X_ERR("Bootcode is missing - can not reset link\n");
21862185 }
21872186
2187+void bnx2x_force_link_reset(struct bnx2x *bp)
2188+{
2189+ bnx2x_acquire_phy_lock(bp);
2190+ bnx2x_link_reset(&bp->link_params, &bp->link_vars, 1);
2191+ bnx2x_release_phy_lock(bp);
2192+}
2193+
21882194 u8 bnx2x_link_test(struct bnx2x *bp, u8 is_serdes)
21892195 {
21902196 u8 rc = 0;
@@ -6751,7 +6757,6 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 4560 unmodified lines
67516757 u32 low, high;
67526758 u32 val;
67536759
6754− bnx2x__link_reset(bp);
67556760
67566761 DP(NETIF_MSG_HW, "starting port init port %d\n", port);
67576762
@@ -8244,12 +8249,15 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) · 1486 unmodified lines
82448249 * bnx2x_send_unload_done - send UNLOAD_DONE command to the MCP.
82458250 *
82468251 * @bp: driver handle
8252+ * @keep_link: true iff link should be kept up
82478253 */
8248−void bnx2x_send_unload_done(struct bnx2x *bp)
8254+void bnx2x_send_unload_done(struct bnx2x *bp, bool keep_link)
82498255 {
8256+ u32 reset_param = keep_link ? DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET : 0;
8257+
82508258 /* Report UNLOAD_DONE to MCP */
82518259 if (!BP_NOMCP(bp))
8252− bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0);
8260+ bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, reset_param);
82538261 }
82548262
82558263 static int bnx2x_func_wait_started(struct bnx2x *bp)
@@ -8318,7 +8326,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp) · 62 unmodified lines
83188326 return 0;
83198327 }
83208328
8321−void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode)
8329+void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
83228330 {
83238331 int port = BP_PORT(bp);
83248332 int i, rc = 0;
@@ -8440,7 +8448,7 @@ unload_error: · 115 unmodified lines
84408448
84418449
84428450 /* Report UNLOAD_DONE to MCP */
8443− bnx2x_send_unload_done(bp);
8451+ bnx2x_send_unload_done(bp, keep_link);
84448452 }
84458453
84468454 void bnx2x_disable_close_the_gate(struct bnx2x *bp)
@@ -8852,7 +8860,8 @@ int bnx2x_leader_reset(struct bnx2x *bp) · 405 unmodified lines
88528860 * driver is owner of the HW
88538861 */
88548862 if (!global && !BP_NOMCP(bp)) {
8855− load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, 0);
8863+ load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ,
8864+ DRV_MSG_CODE_LOAD_REQ_WITH_LFA);
88568865 if (!load_code) {
88578866 BNX2X_ERR("MCP response failure, aborting\n");
88588867 rc = -EAGAIN;
@@ -8958,7 +8967,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp) · 99 unmodified lines
89588967
89598968 /* Stop the driver */
89608969 /* If interface has been removed - break */
8961− if (bnx2x_nic_unload(bp, UNLOAD_RECOVERY))
8970+ if (bnx2x_nic_unload(bp, UNLOAD_RECOVERY, false))
89628971 return;
89638972
89648973 bp->recovery_state = BNX2X_RECOVERY_WAIT;
@@ -9124,7 +9133,7 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work) · 159 unmodified lines
91249133 bp->sp_rtnl_state = 0;
91259134 smp_mb();
91269135
9127− bnx2x_nic_unload(bp, UNLOAD_NORMAL);
9136+ bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
91289137 bnx2x_nic_load(bp, LOAD_NORMAL);
91299138
91309139 goto sp_rtnl_exit;
@@ -9310,7 +9319,8 @@ static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, · 179 unmodified lines
93109319
93119320 static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp)
93129321 {
9313− u32 rc = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0);
9322+ u32 rc = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE,
9323+ DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET);
93149324 if (!rc) {
93159325 BNX2X_ERR("MCP response failure, aborting\n");
93169326 return -EBUSY;
@@ -11000,7 +11010,7 @@ static int bnx2x_close(struct net_device *dev) · 1683 unmodified lines
1100011010 struct bnx2x *bp = netdev_priv(dev);
1100111011
1100211012 /* Unload the driver, release IRQs */
11003− bnx2x_nic_unload(bp, UNLOAD_CLOSE);
11013+ bnx2x_nic_unload(bp, UNLOAD_CLOSE, false);
1100411014
1100511015 /* Power off */
1100611016 bnx2x_set_power_state(bp, PCI_D3hot);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h+11−3
@@ -4949,6 +4949,10 @@ · 4948 unmodified lines
49494949 #define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13)
49504950 #define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0)
49514951 #define UMAC_REG_COMMAND_CONFIG 0x8
4952+/* [RW 16] This is the duration for which MAC must wait to go back to ACTIVE
4953+ * state from LPI state when it receives packet for transmission. The
4954+ * decrement unit is 1 micro-second. */
4955+#define UMAC_REG_EEE_WAKE_TIMER 0x6c
49524956 /* [RW 32] Register Bit 0 refers to Bit 16 of the MAC address; Bit 1 refers
49534957 * to bit 17 of the MAC address etc. */
49544958 #define UMAC_REG_MAC_ADDR0 0xc
@@ -4958,6 +4962,8 @@ · 3 unmodified lines
49584962 /* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive
49594963 * logic to check frames. */
49604964 #define UMAC_REG_MAXFR 0x14
4965+#define UMAC_REG_UMAC_EEE_CTRL 0x64
4966+#define UMAC_UMAC_EEE_CTRL_REG_EEE_EN (0x1<<3)
49614967 /* [RW 8] The event id for aggregated interrupt 0 */
49624968 #define USDM_REG_AGG_INT_EVENT_0 0xc4038
49634969 #define USDM_REG_AGG_INT_EVENT_1 0xc403c
@@ -6992,6 +6998,7 @@ Theotherbitsarereservedandshouldbezero*/ · 2028 unmodified lines
69926998 /* BCM84833 only */
69936999 #define MDIO_84833_TOP_CFG_FW_REV 0x400f
69947000 #define MDIO_84833_TOP_CFG_FW_EEE 0x10b1
7001+#define MDIO_84833_TOP_CFG_FW_NO_EEE 0x1f81
69957002 #define MDIO_84833_TOP_CFG_XGPHY_STRAP1 0x401a
69967003 #define MDIO_84833_SUPER_ISOLATE 0x8000
69977004 /* These are mailbox register set used by 84833. */
@@ -7160,10 +7167,11 @@ Theotherbitsarereservedandshouldbezero*/ · 162 unmodified lines
71607167 #define MDIO_REG_GPHY_ID_54618SE 0x5cd5
71617168 #define MDIO_REG_GPHY_CL45_ADDR_REG 0xd
71627169 #define MDIO_REG_GPHY_CL45_DATA_REG 0xe
7163−#define MDIO_REG_GPHY_EEE_ADV 0x3c
7164−#define MDIO_REG_GPHY_EEE_1G (0x1 << 2)
7165−#define MDIO_REG_GPHY_EEE_100 (0x1 << 1)
71667170 #define MDIO_REG_GPHY_EEE_RESOLVED 0x803e
7171+#define MDIO_REG_GPHY_EXP_ACCESS_GATE 0x15
7172+#define MDIO_REG_GPHY_EXP_ACCESS 0x17
7173+#define MDIO_REG_GPHY_EXP_ACCESS_TOP 0xd00
7174+#define MDIO_REG_GPHY_EXP_TOP_2K_BUF 0x40
71677175 #define MDIO_REG_GPHY_AUX_STATUS 0x19
71687176 #define MDIO_REG_INTR_STATUS 0x1a
71697177 #define MDIO_REG_INTR_MASK 0x1b
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c+2−3
@@ -229,8 +229,7 @@ static inline int bnx2x_exe_queue_step(struct bnx2x *bp, · 228 unmodified lines
229229 */
230230 list_add_tail(&spacer.link, &o->pending_comp);
231231 mb();
232− list_del(&elem->link);
233− list_add_tail(&elem->link, &o->pending_comp);
232+ list_move_tail(&elem->link, &o->pending_comp);
234233 list_del(&spacer.link);
235234 } else
236235 break;
@@ -5620,7 +5619,7 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp, · 5383 unmodified lines
56205619 memset(rdata, 0, sizeof(*rdata));
56215620
56225621 /* Fill the ramrod data with provided parameters */
5623− rdata->function_mode = cpu_to_le16(start_params->mf_mode);
5622+ rdata->function_mode = (u8)start_params->mf_mode;
56245623 rdata->sd_vlan_tag = cpu_to_le16(start_params->sd_vlan_tag);
56255624 rdata->path_id = BP_PATH(bp);
56265625 rdata->network_cos_mode = start_params->network_cos_mode;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c+30−5
@@ -39,14 +39,39 @@ static inline long bnx2x_hilo(u32 *hiref) · 38 unmodified lines
3939 #endif
4040 }
4141
42−static u16 bnx2x_get_port_stats_dma_len(struct bnx2x *bp)
42+static inline u16 bnx2x_get_port_stats_dma_len(struct bnx2x *bp)
4343 {
44− u16 res = sizeof(struct host_port_stats) >> 2;
44+ u16 res = 0;
4545
46− /* if PFC stats are not supported by the MFW, don't DMA them */
47− if (!(bp->flags & BC_SUPPORTS_PFC_STATS))
48− res -= (sizeof(u32)*4) >> 2;
46+ /* 'newest' convention - shmem2 cotains the size of the port stats */
47+ if (SHMEM2_HAS(bp, sizeof_port_stats)) {
48+ u32 size = SHMEM2_RD(bp, sizeof_port_stats);
49+ if (size)
50+ res = size;
4951
52+ /* prevent newer BC from causing buffer overflow */
53+ if (res > sizeof(struct host_port_stats))
54+ res = sizeof(struct host_port_stats);
55+ }
56+
57+ /* Older convention - all BCs support the port stats' fields up until
58+ * the 'not_used' field
59+ */
60+ if (!res) {
61+ res = offsetof(struct host_port_stats, not_used) + 4;
62+
63+ /* if PFC stats are supported by the MFW, DMA them as well */
64+ if (bp->flags & BC_SUPPORTS_PFC_STATS) {
65+ res += offsetof(struct host_port_stats,
66+ pfc_frames_rx_lo) -
67+ offsetof(struct host_port_stats,
68+ pfc_frames_tx_hi) + 4 ;
69+ }
70+ }
71+
72+ res >>= 2;
73+
74+ WARN_ON(res > 2 * DMAE_LEN32_RD_MAX);
5075 return res;
5176 }
5277
drivers/net/ethernet/broadcom/cnic.c+86−30
@@ -823,10 +823,8 @@ static void cnic_free_context(struct cnic_dev *dev) · 822 unmodified lines
823823 }
824824 }
825825
826−static void __cnic_free_uio(struct cnic_uio_dev *udev)
826+static void __cnic_free_uio_rings(struct cnic_uio_dev *udev)
827827 {
828− uio_unregister_device(&udev->cnic_uinfo);
829−
830828 if (udev->l2_buf) {
831829 dma_free_coherent(&udev->pdev->dev, udev->l2_buf_size,
832830 udev->l2_buf, udev->l2_buf_map);
@@ -839,6 +837,14 @@ static void __cnic_free_uio(struct cnic_uio_dev *udev) · 6 unmodified lines
839837 udev->l2_ring = NULL;
840838 }
841839
840+}
841+
842+static void __cnic_free_uio(struct cnic_uio_dev *udev)
843+{
844+ uio_unregister_device(&udev->cnic_uinfo);
845+
846+ __cnic_free_uio_rings(udev);
847+
842848 pci_dev_put(udev->pdev);
843849 kfree(udev);
844850 }
@@ -862,6 +868,8 @@ static void cnic_free_resc(struct cnic_dev *dev) · 17 unmodified lines
862868 if (udev) {
863869 udev->dev = NULL;
864870 cp->udev = NULL;
871+ if (udev->uio_dev == -1)
872+ __cnic_free_uio_rings(udev);
865873 }
866874
867875 cnic_free_context(dev);
@@ -996,6 +1004,34 @@ static int cnic_alloc_kcq(struct cnic_dev *dev, struct kcq_info *info, · 128 unmodified lines
9961004 return 0;
9971005 }
9981006
1007+static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages)
1008+{
1009+ struct cnic_local *cp = udev->dev->cnic_priv;
1010+
1011+ if (udev->l2_ring)
1012+ return 0;
1013+
1014+ udev->l2_ring_size = pages * BCM_PAGE_SIZE;
1015+ udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size,
1016+ &udev->l2_ring_map,
1017+ GFP_KERNEL | __GFP_COMP);
1018+ if (!udev->l2_ring)
1019+ return -ENOMEM;
1020+
1021+ udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;
1022+ udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size);
1023+ udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size,
1024+ &udev->l2_buf_map,
1025+ GFP_KERNEL | __GFP_COMP);
1026+ if (!udev->l2_buf) {
1027+ __cnic_free_uio_rings(udev);
1028+ return -ENOMEM;
1029+ }
1030+
1031+ return 0;
1032+
1033+}
1034+
9991035 static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
10001036 {
10011037 struct cnic_local *cp = dev->cnic_priv;
@@ -1005,6 +1041,11 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) · 3 unmodified lines
10051041 list_for_each_entry(udev, &cnic_udev_list, list) {
10061042 if (udev->pdev == dev->pcidev) {
10071043 udev->dev = dev;
1044+ if (__cnic_alloc_uio_rings(udev, pages)) {
1045+ udev->dev = NULL;
1046+ read_unlock(&cnic_dev_lock);
1047+ return -ENOMEM;
1048+ }
10081049 cp->udev = udev;
10091050 read_unlock(&cnic_dev_lock);
10101051 return 0;
@@ -1020,20 +1061,9 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) · 9 unmodified lines
10201061
10211062 udev->dev = dev;
10221063 udev->pdev = dev->pcidev;
1023− udev->l2_ring_size = pages * BCM_PAGE_SIZE;
1024− udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size,
1025− &udev->l2_ring_map,
1026− GFP_KERNEL | __GFP_COMP);
1027− if (!udev->l2_ring)
1028− goto err_udev;
10291064
1030− udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;
1031− udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size);
1032− udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size,
1033− &udev->l2_buf_map,
1034− GFP_KERNEL | __GFP_COMP);
1035− if (!udev->l2_buf)
1036− goto err_dma;
1065+ if (__cnic_alloc_uio_rings(udev, pages))
1066+ goto err_udev;
10371067
10381068 write_lock(&cnic_dev_lock);
10391069 list_add(&udev->list, &cnic_udev_list);
@@ -1044,9 +1074,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) · 4 unmodified lines
10441074 cp->udev = udev;
10451075
10461076 return 0;
1047− err_dma:
1048− dma_free_coherent(&udev->pdev->dev, udev->l2_ring_size,
1049− udev->l2_ring, udev->l2_ring_map);
1077+
10501078 err_udev:
10511079 kfree(udev);
10521080 return -ENOMEM;
@@ -1260,7 +1288,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) · 207 unmodified lines
12601288 if (ret)
12611289 goto error;
12621290
1263− if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
1291+ if (CNIC_SUPPORTS_FCOE(cp)) {
12641292 ret = cnic_alloc_kcq(dev, &cp->kcq2, true);
12651293 if (ret)
12661294 goto error;
@@ -1275,6 +1303,9 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) · 8 unmodified lines
12751303 if (ret)
12761304 goto error;
12771305
1306+ if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)
1307+ return 0;
1308+
12781309 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk;
12791310
12801311 cp->l2_rx_ring_size = 15;
@@ -3050,6 +3081,22 @@ static void cnic_ack_bnx2x_e2_msix(struct cnic_dev *dev) · 1769 unmodified lines
30503081 IGU_INT_DISABLE, 0);
30513082 }
30523083
3084+static void cnic_arm_bnx2x_msix(struct cnic_dev *dev, u32 idx)
3085+{
3086+ struct cnic_local *cp = dev->cnic_priv;
3087+
3088+ cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, CSTORM_ID, idx,
3089+ IGU_INT_ENABLE, 1);
3090+}
3091+
3092+static void cnic_arm_bnx2x_e2_msix(struct cnic_dev *dev, u32 idx)
3093+{
3094+ struct cnic_local *cp = dev->cnic_priv;
3095+
3096+ cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, idx,
3097+ IGU_INT_ENABLE, 1);
3098+}
3099+
30533100 static u32 cnic_service_bnx2x_kcq(struct cnic_dev *dev, struct kcq_info *info)
30543101 {
30553102 u32 last_status = *info->status_idx_ptr;
@@ -3086,9 +3133,8 @@ static void cnic_service_bnx2x_bh(unsigned long data) · 30 unmodified lines
30863133 CNIC_WR16(dev, cp->kcq1.io_addr,
30873134 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);
30883135
3089− if (!BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
3090− cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID,
3091− status_idx, IGU_INT_ENABLE, 1);
3136+ if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE) {
3137+ cp->arm_int(dev, status_idx);
30923138 break;
30933139 }
30943140
@@ -4845,6 +4891,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, · 1750 unmodified lines
48454891 buf_map = udev->l2_buf_map;
48464892 for (i = 0; i < MAX_TX_DESC_CNT; i += 3, txbd += 3) {
48474893 struct eth_tx_start_bd *start_bd = &txbd->start_bd;
4894+ struct eth_tx_parse_bd_e1x *pbd_e1x =
4895+ &((txbd + 1)->parse_bd_e1x);
4896+ struct eth_tx_parse_bd_e2 *pbd_e2 = &((txbd + 1)->parse_bd_e2);
48484897 struct eth_tx_bd *reg_bd = &((txbd + 2)->reg_bd);
48494898
48504899 start_bd->addr_hi = cpu_to_le32((u64) buf_map >> 32);
@@ -4854,10 +4903,15 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, · 3 unmodified lines
48544903 start_bd->nbytes = cpu_to_le16(0x10);
48554904 start_bd->nbd = cpu_to_le16(3);
48564905 start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
4857− start_bd->general_data = (UNICAST_ADDRESS <<
4858− ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT);
4906+ start_bd->general_data &= ~ETH_TX_START_BD_PARSE_NBDS;
48594907 start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT);
48604908
4909+ if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id))
4910+ pbd_e2->parsing_data = (UNICAST_ADDRESS <<
4911+ ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT);
4912+ else
4913+ pbd_e1x->global_data = (UNICAST_ADDRESS <<
4914+ ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE_SHIFT);
48614915 }
48624916
48634917 val = (u64) ring_map >> 32;
@@ -5308,7 +5362,7 @@ static void cnic_stop_hw(struct cnic_dev *dev) · 444 unmodified lines
53085362 /* Need to wait for the ring shutdown event to complete
53095363 * before clearing the CNIC_UP flag.
53105364 */
5311− while (cp->udev->uio_dev != -1 && i < 15) {
5365+ while (cp->udev && cp->udev->uio_dev != -1 && i < 15) {
53125366 msleep(100);
53135367 i++;
53145368 }
@@ -5473,8 +5527,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) · 158 unmodified lines
54735527
54745528 if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI))
54755529 cdev->max_iscsi_conn = ethdev->max_iscsi_conn;
5476− if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) &&
5477− !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE))
5530+ if (CNIC_SUPPORTS_FCOE(cp))
54785531 cdev->max_fcoe_conn = ethdev->max_fcoe_conn;
54795532
54805533 if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
@@ -5492,10 +5545,13 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) · 11 unmodified lines
54925545 cp->stop_cm = cnic_cm_stop_bnx2x_hw;
54935546 cp->enable_int = cnic_enable_bnx2x_int;
54945547 cp->disable_int_sync = cnic_disable_bnx2x_int_sync;
5495− if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id))
5548+ if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
54965549 cp->ack_int = cnic_ack_bnx2x_e2_msix;
5497− else
5550+ cp->arm_int = cnic_arm_bnx2x_e2_msix;
5551+ } else {
54985552 cp->ack_int = cnic_ack_bnx2x_msix;
5553+ cp->arm_int = cnic_arm_bnx2x_msix;
5554+ }
54995555 cp->close_conn = cnic_close_bnx2x_conn;
55005556 return cdev;
55015557 }
drivers/net/ethernet/broadcom/cnic.h+5−0
@@ -334,6 +334,7 @@ struct cnic_local { · 333 unmodified lines
334334 void (*enable_int)(struct cnic_dev *);
335335 void (*disable_int_sync)(struct cnic_dev *);
336336 void (*ack_int)(struct cnic_dev *);
337+ void (*arm_int)(struct cnic_dev *, u32 index);
337338 void (*close_conn)(struct cnic_sock *, u32 opcode);
338339 };
339340
@@ -474,6 +475,10 @@ struct bnx2x_bd_chain_next { · 134 unmodified lines
474475 MAX_STAT_COUNTER_ID_E1))
475476 #endif
476477
478+#define CNIC_SUPPORTS_FCOE(cp) \
479+ (BNX2X_CHIP_IS_E2_PLUS((cp)->chip_id) && \
480+ !((cp)->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE))
481+
477482 #define CNIC_RAMROD_TMO (HZ / 4)
478483
479484 #endif
drivers/net/ethernet/broadcom/cnic_defs.h+1−1
@@ -896,7 +896,7 @@ struct tstorm_tcp_tcp_ag_context_section { · 895 unmodified lines
896896 u32 snd_nxt;
897897 u32 rtt_seq;
898898 u32 rtt_time;
899− u32 __reserved66;
899+ u32 wnd_right_edge_local;
900900 u32 wnd_right_edge;
901901 u32 tcp_agg_vars1;
902902 #define TSTORM_TCP_TCP_AG_CONTEXT_SECTION_FIN_SENT_FLAG (0x1<<0)
drivers/net/ethernet/broadcom/cnic_if.h+2−2
@@ -14,8 +14,8 @@ · 13 unmodified lines
1414
1515 #include "bnx2x/bnx2x_mfw_req.h"
1616
17−#define CNIC_MODULE_VERSION "2.5.12"
18−#define CNIC_MODULE_RELDATE "June 29, 2012"
17+#define CNIC_MODULE_VERSION "2.5.14"
18+#define CNIC_MODULE_RELDATE "Sep 30, 2012"
1919
2020 #define CNIC_ULP_RDMA 0
2121 #define CNIC_ULP_ISCSI 1
drivers/net/ethernet/broadcom/tg3.c+356−178
@@ -44,10 +44,8 @@ · 43 unmodified lines
4444 #include <linux/prefetch.h>
4545 #include <linux/dma-mapping.h>
4646 #include <linux/firmware.h>
47−#if IS_ENABLED(CONFIG_HWMON)
4847 #include <linux/hwmon.h>
4948 #include <linux/hwmon-sysfs.h>
50−#endif
5149
5250 #include <net/checksum.h>
5351 #include <net/ip.h>
@@ -92,10 +90,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) · 38 unmodified lines
9290
9391 #define DRV_MODULE_NAME "tg3"
9492 #define TG3_MAJ_NUM 3
95−#define TG3_MIN_NUM 124
93+#define TG3_MIN_NUM 125
9694 #define DRV_MODULE_VERSION \
9795 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
98−#define DRV_MODULE_RELDATE "March 21, 2012"
96+#define DRV_MODULE_RELDATE "September 26, 2012"
9997
10098 #define RESET_KIND_SHUTDOWN 0
10199 #define RESET_KIND_INIT 1
@@ -6263,7 +6261,7 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) · 6161 unmodified lines
62636261 u32 jmb_prod_idx = dpr->rx_jmb_prod_idx;
62646262
62656263 tp->rx_refill = false;
6266− for (i = 1; i < tp->irq_cnt; i++)
6264+ for (i = 1; i <= tp->rxq_cnt; i++)
62676265 err |= tg3_rx_prodring_xfer(tp, dpr,
62686266 &tp->napi[i].prodring);
62696267
@@ -7592,15 +7590,11 @@ static int tg3_init_rings(struct tg3 *tp) · 1322 unmodified lines
75927590 return 0;
75937591 }
75947592
7595−/*
7596− * Must not be invoked with interrupt sources disabled and
7597− * the hardware shutdown down.
7598− */
7599−static void tg3_free_consistent(struct tg3 *tp)
7593+static void tg3_mem_tx_release(struct tg3 *tp)
76007594 {
76017595 int i;
76027596
7603− for (i = 0; i < tp->irq_cnt; i++) {
7597+ for (i = 0; i < tp->irq_max; i++) {
76047598 struct tg3_napi *tnapi = &tp->napi[i];
76057599
76067600 if (tnapi->tx_ring) {
@@ -7611,17 +7605,114 @@ static void tg3_free_consistent(struct tg3 *tp) · 4 unmodified lines
76117605
76127606 kfree(tnapi->tx_buffers);
76137607 tnapi->tx_buffers = NULL;
7608+ }
7609+}
76147610
7615− if (tnapi->rx_rcb) {
7616− dma_free_coherent(&tp->pdev->dev,
7617− TG3_RX_RCB_RING_BYTES(tp),
7618− tnapi->rx_rcb,
7619− tnapi->rx_rcb_mapping);
7620− tnapi->rx_rcb = NULL;
7621− }
7611+static int tg3_mem_tx_acquire(struct tg3 *tp)
7612+{
7613+ int i;
7614+ struct tg3_napi *tnapi = &tp->napi[0];
7615+
7616+ /* If multivector TSS is enabled, vector 0 does not handle
7617+ * tx interrupts. Don't allocate any resources for it.
7618+ */
7619+ if (tg3_flag(tp, ENABLE_TSS))
7620+ tnapi++;
7621+
7622+ for (i = 0; i < tp->txq_cnt; i++, tnapi++) {
7623+ tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) *
7624+ TG3_TX_RING_SIZE, GFP_KERNEL);
7625+ if (!tnapi->tx_buffers)
7626+ goto err_out;
7627+
7628+ tnapi->tx_ring = dma_alloc_coherent(&tp->pdev->dev,
7629+ TG3_TX_RING_BYTES,
7630+ &tnapi->tx_desc_mapping,
7631+ GFP_KERNEL);
7632+ if (!tnapi->tx_ring)
7633+ goto err_out;
7634+ }
7635+
7636+ return 0;
7637+
7638+err_out:
7639+ tg3_mem_tx_release(tp);
7640+ return -ENOMEM;
7641+}
7642+
7643+static void tg3_mem_rx_release(struct tg3 *tp)
7644+{
7645+ int i;
7646+
7647+ for (i = 0; i < tp->irq_max; i++) {
7648+ struct tg3_napi *tnapi = &tp->napi[i];
76227649
76237650 tg3_rx_prodring_fini(tp, &tnapi->prodring);
76247651
7652+ if (!tnapi->rx_rcb)
7653+ continue;
7654+
7655+ dma_free_coherent(&tp->pdev->dev,
7656+ TG3_RX_RCB_RING_BYTES(tp),
7657+ tnapi->rx_rcb,
7658+ tnapi->rx_rcb_mapping);
7659+ tnapi->rx_rcb = NULL;
7660+ }
7661+}
7662+
7663+static int tg3_mem_rx_acquire(struct tg3 *tp)
7664+{
7665+ unsigned int i, limit;
7666+
7667+ limit = tp->rxq_cnt;
7668+
7669+ /* If RSS is enabled, we need a (dummy) producer ring
7670+ * set on vector zero. This is the true hw prodring.
7671+ */
7672+ if (tg3_flag(tp, ENABLE_RSS))
7673+ limit++;
7674+
7675+ for (i = 0; i < limit; i++) {
7676+ struct tg3_napi *tnapi = &tp->napi[i];
7677+
7678+ if (tg3_rx_prodring_init(tp, &tnapi->prodring))
7679+ goto err_out;
7680+
7681+ /* If multivector RSS is enabled, vector 0
7682+ * does not handle rx or tx interrupts.
7683+ * Don't allocate any resources for it.
7684+ */
7685+ if (!i && tg3_flag(tp, ENABLE_RSS))
7686+ continue;
7687+
7688+ tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev,
7689+ TG3_RX_RCB_RING_BYTES(tp),
7690+ &tnapi->rx_rcb_mapping,
7691+ GFP_KERNEL);
7692+ if (!tnapi->rx_rcb)
7693+ goto err_out;
7694+
7695+ memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
7696+ }
7697+
7698+ return 0;
7699+
7700+err_out:
7701+ tg3_mem_rx_release(tp);
7702+ return -ENOMEM;
7703+}
7704+
7705+/*
7706+ * Must not be invoked with interrupt sources disabled and
7707+ * the hardware shutdown down.
7708+ */
7709+static void tg3_free_consistent(struct tg3 *tp)
7710+{
7711+ int i;
7712+
7713+ for (i = 0; i < tp->irq_cnt; i++) {
7714+ struct tg3_napi *tnapi = &tp->napi[i];
7715+
76257716 if (tnapi->hw_status) {
76267717 dma_free_coherent(&tp->pdev->dev, TG3_HW_STATUS_SIZE,
76277718 tnapi->hw_status,
@@ -7630,6 +7721,9 @@ static void tg3_free_consistent(struct tg3 *tp) · 2 unmodified lines
76307721 }
76317722 }
76327723
7724+ tg3_mem_rx_release(tp);
7725+ tg3_mem_tx_release(tp);
7726+
76337727 if (tp->hw_stats) {
76347728 dma_free_coherent(&tp->pdev->dev, sizeof(struct tg3_hw_stats),
76357729 tp->hw_stats, tp->stats_mapping);
@@ -7668,72 +7762,38 @@ static int tg3_alloc_consistent(struct tg3 *tp) · 32 unmodified lines
76687762 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
76697763 sblk = tnapi->hw_status;
76707764
7671− if (tg3_rx_prodring_init(tp, &tnapi->prodring))
7672− goto err_out;
7765+ if (tg3_flag(tp, ENABLE_RSS)) {
7766+ u16 *prodptr = 0;
76737767
7674− /* If multivector TSS is enabled, vector 0 does not handle
7675− * tx interrupts. Don't allocate any resources for it.
7676− */
7677− if ((!i && !tg3_flag(tp, ENABLE_TSS)) ||
7678− (i && tg3_flag(tp, ENABLE_TSS))) {
7679− tnapi->tx_buffers = kzalloc(
7680− sizeof(struct tg3_tx_ring_info) *
7681− TG3_TX_RING_SIZE, GFP_KERNEL);
7682− if (!tnapi->tx_buffers)
7683− goto err_out;
7684−
7685− tnapi->tx_ring = dma_alloc_coherent(&tp->pdev->dev,
7686− TG3_TX_RING_BYTES,
7687− &tnapi->tx_desc_mapping,
7688− GFP_KERNEL);
7689− if (!tnapi->tx_ring)
7690− goto err_out;
7691− }
7692−
7693− /*
7694− * When RSS is enabled, the status block format changes
7695− * slightly. The "rx_jumbo_consumer", "reserved",
7696− * and "rx_mini_consumer" members get mapped to the
7697− * other three rx return ring producer indexes.
7698− */
7699− switch (i) {
7700− default:
7701− if (tg3_flag(tp, ENABLE_RSS)) {
7702− tnapi->rx_rcb_prod_idx = NULL;
7768+ /*
7769+ * When RSS is enabled, the status block format changes
7770+ * slightly. The "rx_jumbo_consumer", "reserved",
7771+ * and "rx_mini_consumer" members get mapped to the
7772+ * other three rx return ring producer indexes.
7773+ */
7774+ switch (i) {
7775+ case 1:
7776+ prodptr = &sblk->idx[0].rx_producer;
7777+ break;
7778+ case 2:
7779+ prodptr = &sblk->rx_jumbo_consumer;
7780+ break;
7781+ case 3:
7782+ prodptr = &sblk->reserved;
7783+ break;
7784+ case 4:
7785+ prodptr = &sblk->rx_mini_consumer;
77037786 break;
77047787 }
7705− /* Fall through */
7706− case 1:
7788+ tnapi->rx_rcb_prod_idx = prodptr;
7789+ } else {
77077790 tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;
7708− break;
7709− case 2:
7710− tnapi->rx_rcb_prod_idx = &sblk->rx_jumbo_consumer;
7711− break;
7712− case 3:
7713− tnapi->rx_rcb_prod_idx = &sblk->reserved;
7714− break;
7715− case 4:
7716− tnapi->rx_rcb_prod_idx = &sblk->rx_mini_consumer;
7717− break;
77187791 }
7719−
7720− /*
7721− * If multivector RSS is enabled, vector 0 does not handle
7722− * rx or tx interrupts. Don't allocate any resources for it.
7723− */
7724− if (!i && tg3_flag(tp, ENABLE_RSS))
7725− continue;
7726−
7727− tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev,
7728− TG3_RX_RCB_RING_BYTES(tp),
7729− &tnapi->rx_rcb_mapping,
7730− GFP_KERNEL);
7731− if (!tnapi->rx_rcb)
7732− goto err_out;
7733−
7734− memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
77357792 }
77367793
7794+ if (tg3_mem_tx_acquire(tp) || tg3_mem_rx_acquire(tp))
7795+ goto err_out;
7796+
77377797 return 0;
77387798
77397799 err_out:
@@ -8247,9 +8307,10 @@ static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr, · 507 unmodified lines
82478307 nic_addr);
82488308 }
82498309
8250−static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)
8310+
8311+static void tg3_coal_tx_init(struct tg3 *tp, struct ethtool_coalesce *ec)
82518312 {
8252− int i;
8313+ int i = 0;
82538314
82548315 if (!tg3_flag(tp, ENABLE_TSS)) {
82558316 tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs);
@@ -8259,31 +8320,43 @@ static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) · 3 unmodified lines
82598320 tw32(HOSTCC_TXCOL_TICKS, 0);
82608321 tw32(HOSTCC_TXMAX_FRAMES, 0);
82618322 tw32(HOSTCC_TXCOAL_MAXF_INT, 0);
8323+
8324+ for (; i < tp->txq_cnt; i++) {
8325+ u32 reg;
8326+
8327+ reg = HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18;
8328+ tw32(reg, ec->tx_coalesce_usecs);
8329+ reg = HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18;
8330+ tw32(reg, ec->tx_max_coalesced_frames);
8331+ reg = HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18;
8332+ tw32(reg, ec->tx_max_coalesced_frames_irq);
8333+ }
82628334 }
82638335
8336+ for (; i < tp->irq_max - 1; i++) {
8337+ tw32(HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18, 0);
8338+ tw32(HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18, 0);
8339+ tw32(HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);
8340+ }
8341+}
8342+
8343+static void tg3_coal_rx_init(struct tg3 *tp, struct ethtool_coalesce *ec)
8344+{
8345+ int i = 0;
8346+ u32 limit = tp->rxq_cnt;
8347+
82648348 if (!tg3_flag(tp, ENABLE_RSS)) {
82658349 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs);
82668350 tw32(HOSTCC_RXMAX_FRAMES, ec->rx_max_coalesced_frames);
82678351 tw32(HOSTCC_RXCOAL_MAXF_INT, ec->rx_max_coalesced_frames_irq);
8352+ limit--;
82688353 } else {
82698354 tw32(HOSTCC_RXCOL_TICKS, 0);
82708355 tw32(HOSTCC_RXMAX_FRAMES, 0);
82718356 tw32(HOSTCC_RXCOAL_MAXF_INT, 0);
82728357 }
82738358
8274− if (!tg3_flag(tp, 5705_PLUS)) {
8275− u32 val = ec->stats_block_coalesce_usecs;
8276−
8277− tw32(HOSTCC_RXCOAL_TICK_INT, ec->rx_coalesce_usecs_irq);
8278− tw32(HOSTCC_TXCOAL_TICK_INT, ec->tx_coalesce_usecs_irq);
8279−
8280− if (!netif_carrier_ok(tp->dev))
8281− val = 0;
8282−
8283− tw32(HOSTCC_STAT_COAL_TICKS, val);
8284− }
8285−
8286− for (i = 0; i < tp->irq_cnt - 1; i++) {
8359+ for (; i < limit; i++) {
82878360 u32 reg;
82888361
82898362 reg = HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18;
@@ -8292,27 +8365,30 @@ static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) · 2 unmodified lines
82928365 tw32(reg, ec->rx_max_coalesced_frames);
82938366 reg = HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18;
82948367 tw32(reg, ec->rx_max_coalesced_frames_irq);
8295−
8296− if (tg3_flag(tp, ENABLE_TSS)) {
8297− reg = HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18;
8298− tw32(reg, ec->tx_coalesce_usecs);
8299− reg = HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18;
8300− tw32(reg, ec->tx_max_coalesced_frames);
8301− reg = HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18;
8302− tw32(reg, ec->tx_max_coalesced_frames_irq);
8303− }
83048368 }
83058369
83068370 for (; i < tp->irq_max - 1; i++) {
83078371 tw32(HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18, 0);
83088372 tw32(HOSTCC_RXMAX_FRAMES_VEC1 + i * 0x18, 0);
83098373 tw32(HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);
8374+ }
8375+}
83108376
8311− if (tg3_flag(tp, ENABLE_TSS)) {
8312− tw32(HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18, 0);
8313− tw32(HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18, 0);
8314− tw32(HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);
8315− }
8377+static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)
8378+{
8379+ tg3_coal_tx_init(tp, ec);
8380+ tg3_coal_rx_init(tp, ec);
8381+
8382+ if (!tg3_flag(tp, 5705_PLUS)) {
8383+ u32 val = ec->stats_block_coalesce_usecs;
8384+
8385+ tw32(HOSTCC_RXCOAL_TICK_INT, ec->rx_coalesce_usecs_irq);
8386+ tw32(HOSTCC_TXCOAL_TICK_INT, ec->tx_coalesce_usecs_irq);
8387+
8388+ if (!netif_carrier_ok(tp->dev))
8389+ val = 0;
8390+
8391+ tw32(HOSTCC_STAT_COAL_TICKS, val);
83168392 }
83178393 }
83188394
@@ -8570,13 +8646,12 @@ static void __tg3_set_rx_mode(struct net_device *dev) · 251 unmodified lines
85708646 }
85718647 }
85728648
8573−static void tg3_rss_init_dflt_indir_tbl(struct tg3 *tp)
8649+static void tg3_rss_init_dflt_indir_tbl(struct tg3 *tp, u32 qcnt)
85748650 {
85758651 int i;
85768652
85778653 for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++)
8578− tp->rss_ind_tbl[i] =
8579− ethtool_rxfh_indir_default(i, tp->irq_cnt - 1);
8654+ tp->rss_ind_tbl[i] = ethtool_rxfh_indir_default(i, qcnt);
85808655 }
85818656
85828657 static void tg3_rss_check_indir_tbl(struct tg3 *tp)
@@ -8598,7 +8673,7 @@ static void tg3_rss_check_indir_tbl(struct tg3 *tp) · 15 unmodified lines
85988673 }
85998674
86008675 if (i != TG3_RSS_INDIR_TBL_SIZE)
8601− tg3_rss_init_dflt_indir_tbl(tp);
8676+ tg3_rss_init_dflt_indir_tbl(tp, tp->rxq_cnt);
86028677 }
86038678
86048679 static void tg3_rss_write_indir_tbl(struct tg3 *tp)
@@ -9495,7 +9570,6 @@ static int tg3_init_hw(struct tg3 *tp, int reset_phy) · 890 unmodified lines
94959570 return tg3_reset_hw(tp, reset_phy);
94969571 }
94979572
9498−#if IS_ENABLED(CONFIG_HWMON)
94999573 static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
95009574 {
95019575 int i;
@@ -9548,22 +9622,17 @@ static const struct attribute_group tg3_group = { · 46 unmodified lines
95489622 .attrs = tg3_attributes,
95499623 };
95509624
9551−#endif
9552−
95539625 static void tg3_hwmon_close(struct tg3 *tp)
95549626 {
9555−#if IS_ENABLED(CONFIG_HWMON)
95569627 if (tp->hwmon_dev) {
95579628 hwmon_device_unregister(tp->hwmon_dev);
95589629 tp->hwmon_dev = NULL;
95599630 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
95609631 }
9561−#endif
95629632 }
95639633
95649634 static void tg3_hwmon_open(struct tg3 *tp)
95659635 {
9566−#if IS_ENABLED(CONFIG_HWMON)
95679636 int i, err;
95689637 u32 size = 0;
95699638 struct pci_dev *pdev = tp->pdev;
@@ -9595,7 +9664,6 @@ static void tg3_hwmon_open(struct tg3 *tp) · 25 unmodified lines
95959664 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
95969665 sysfs_remove_group(&pdev->dev.kobj, &tg3_group);
95979666 }
9598−#endif
95999667 }
96009668
96019669
@@ -10119,21 +10187,43 @@ static int tg3_request_firmware(struct tg3 *tp) · 517 unmodified lines
1011910187 return 0;
1012010188 }
1012110189
10122−static bool tg3_enable_msix(struct tg3 *tp)
10190+static u32 tg3_irq_count(struct tg3 *tp)
1012310191 {
10124− int i, rc;
10125− struct msix_entry msix_ent[tp->irq_max];
10192+ u32 irq_cnt = max(tp->rxq_cnt, tp->txq_cnt);
1012610193
10127− tp->irq_cnt = netif_get_num_default_rss_queues();
10128− if (tp->irq_cnt > 1) {
10194+ if (irq_cnt > 1) {
1012910195 /* We want as many rx rings enabled as there are cpus.
1013010196 * In multiqueue MSI-X mode, the first MSI-X vector
1013110197 * only deals with link interrupts, etc, so we add
1013210198 * one to the number of vectors we are requesting.
1013310199 */
10134− tp->irq_cnt = min_t(unsigned, tp->irq_cnt + 1, tp->irq_max);
10200+ irq_cnt = min_t(unsigned, irq_cnt + 1, tp->irq_max);
1013510201 }
1013610202
10203+ return irq_cnt;
10204+}
10205+
10206+static bool tg3_enable_msix(struct tg3 *tp)
10207+{
10208+ int i, rc;
10209+ struct msix_entry msix_ent[tp->irq_max];
10210+
10211+ tp->txq_cnt = tp->txq_req;
10212+ tp->rxq_cnt = tp->rxq_req;
10213+ if (!tp->rxq_cnt)
10214+ tp->rxq_cnt = netif_get_num_default_rss_queues();
10215+ if (tp->rxq_cnt > tp->rxq_max)
10216+ tp->rxq_cnt = tp->rxq_max;
10217+
10218+ /* Disable multiple TX rings by default. Simple round-robin hardware
10219+ * scheduling of the TX rings can cause starvation of rings with
10220+ * small packets when other rings have TSO or jumbo packets.
10221+ */
10222+ if (!tp->txq_req)
10223+ tp->txq_cnt = 1;
10224+
10225+ tp->irq_cnt = tg3_irq_count(tp);
10226+
1013710227 for (i = 0; i < tp->irq_max; i++) {
1013810228 msix_ent[i].entry = i;
1013910229 msix_ent[i].vector = 0;
@@ -10148,27 +10238,28 @@ static bool tg3_enable_msix(struct tg3 *tp) · 8 unmodified lines
1014810238 netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",
1014910239 tp->irq_cnt, rc);
1015010240 tp->irq_cnt = rc;
10241+ tp->rxq_cnt = max(rc - 1, 1);
10242+ if (tp->txq_cnt)
10243+ tp->txq_cnt = min(tp->rxq_cnt, tp->txq_max);
1015110244 }
1015210245
1015310246 for (i = 0; i < tp->irq_max; i++)
1015410247 tp->napi[i].irq_vec = msix_ent[i].vector;
1015510248
10156− netif_set_real_num_tx_queues(tp->dev, 1);
10157− rc = tp->irq_cnt > 1 ? tp->irq_cnt - 1 : 1;
10158− if (netif_set_real_num_rx_queues(tp->dev, rc)) {
10249+ if (netif_set_real_num_rx_queues(tp->dev, tp->rxq_cnt)) {
1015910250 pci_disable_msix(tp->pdev);
1016010251 return false;
1016110252 }
1016210253
10163− if (tp->irq_cnt > 1) {
10164− tg3_flag_set(tp, ENABLE_RSS);
10254+ if (tp->irq_cnt == 1)
10255+ return true;
1016510256
10166− if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
10167− GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
10168− tg3_flag_set(tp, ENABLE_TSS);
10169− netif_set_real_num_tx_queues(tp->dev, tp->irq_cnt - 1);
10170− }
10171− }
10257+ tg3_flag_set(tp, ENABLE_RSS);
10258+
10259+ if (tp->txq_cnt > 1)
10260+ tg3_flag_set(tp, ENABLE_TSS);
10261+
10262+ netif_set_real_num_tx_queues(tp->dev, tp->txq_cnt);
1017210263
1017310264 return true;
1017410265 }
@@ -10202,6 +10293,11 @@ defcfg: · 27 unmodified lines
1020210293 if (!tg3_flag(tp, USING_MSIX)) {
1020310294 tp->irq_cnt = 1;
1020410295 tp->napi[0].irq_vec = tp->pdev->irq;
10296+ }
10297+
10298+ if (tp->irq_cnt == 1) {
10299+ tp->txq_cnt = 1;
10300+ tp->rxq_cnt = 1;
1020510301 netif_set_real_num_tx_queues(tp->dev, 1);
1020610302 netif_set_real_num_rx_queues(tp->dev, 1);
1020710303 }
@@ -10219,38 +10315,11 @@ static void tg3_ints_fini(struct tg3 *tp) · 11 unmodified lines
1021910315 tg3_flag_clear(tp, ENABLE_TSS);
1022010316 }
1022110317
10222−static int tg3_open(struct net_device *dev)
10318+static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq)
1022310319 {
10224− struct tg3 *tp = netdev_priv(dev);
10320+ struct net_device *dev = tp->dev;
1022510321 int i, err;
1022610322
10227− if (tp->fw_needed) {
10228− err = tg3_request_firmware(tp);
10229− if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
10230− if (err)
10231− return err;
10232− } else if (err) {
10233− netdev_warn(tp->dev, "TSO capability disabled\n");
10234− tg3_flag_clear(tp, TSO_CAPABLE);
10235− } else if (!tg3_flag(tp, TSO_CAPABLE)) {
10236− netdev_notice(tp->dev, "TSO capability restored\n");
10237− tg3_flag_set(tp, TSO_CAPABLE);
10238− }
10239− }
10240−
10241− netif_carrier_off(tp->dev);
10242−
10243− err = tg3_power_up(tp);
10244− if (err)
10245− return err;
10246−
10247− tg3_full_lock(tp, 0);
10248−
10249− tg3_disable_ints(tp);
10250− tg3_flag_clear(tp, INIT_COMPLETE);
10251−
10252− tg3_full_unlock(tp);
10253−
1025410323 /*
1025510324 * Setup interrupts first so we know how
1025610325 * many NAPI resources to allocate
@@ -10284,7 +10353,7 @@ static int tg3_open(struct net_device *dev) · 27 unmodified lines
1028410353
1028510354 tg3_full_lock(tp, 0);
1028610355
10287− err = tg3_init_hw(tp, 1);
10356+ err = tg3_init_hw(tp, reset_phy);
1028810357 if (err) {
1028910358 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
1029010359 tg3_free_rings(tp);
@@ -10295,7 +10364,7 @@ static int tg3_open(struct net_device *dev) · 4 unmodified lines
1029510364 if (err)
1029610365 goto err_out3;
1029710366
10298− if (tg3_flag(tp, USING_MSI)) {
10367+ if (test_irq && tg3_flag(tp, USING_MSI)) {
1029910368 err = tg3_test_msi(tp);
1030010369
1030110370 if (err) {
@@ -10351,20 +10420,18 @@ err_out2: · 49 unmodified lines
1035110420
1035210421 err_out1:
1035310422 tg3_ints_fini(tp);
10354− tg3_frob_aux_power(tp, false);
10355− pci_set_power_state(tp->pdev, PCI_D3hot);
10423+
1035610424 return err;
1035710425 }
1035810426
10359−static int tg3_close(struct net_device *dev)
10427+static void tg3_stop(struct tg3 *tp)
1036010428 {
1036110429 int i;
10362− struct tg3 *tp = netdev_priv(dev);
1036310430
1036410431 tg3_napi_disable(tp);
1036510432 tg3_reset_task_cancel(tp);
1036610433
10367− netif_tx_stop_all_queues(dev);
10434+ netif_tx_disable(tp->dev);
1036810435
1036910436 tg3_timer_stop(tp);
1037010437
@@ -10389,13 +10456,60 @@ static int tg3_close(struct net_device *dev) · 18 unmodified lines
1038910456
1039010457 tg3_ints_fini(tp);
1039110458
10392− /* Clear stats across close / open calls */
10393− memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev));
10394− memset(&tp->estats_prev, 0, sizeof(tp->estats_prev));
10395−
1039610459 tg3_napi_fini(tp);
1039710460
1039810461 tg3_free_consistent(tp);
10462+}
10463+
10464+static int tg3_open(struct net_device *dev)
10465+{
10466+ struct tg3 *tp = netdev_priv(dev);
10467+ int err;
10468+
10469+ if (tp->fw_needed) {
10470+ err = tg3_request_firmware(tp);
10471+ if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
10472+ if (err)
10473+ return err;
10474+ } else if (err) {
10475+ netdev_warn(tp->dev, "TSO capability disabled\n");
10476+ tg3_flag_clear(tp, TSO_CAPABLE);
10477+ } else if (!tg3_flag(tp, TSO_CAPABLE)) {
10478+ netdev_notice(tp->dev, "TSO capability restored\n");
10479+ tg3_flag_set(tp, TSO_CAPABLE);
10480+ }
10481+ }
10482+
10483+ netif_carrier_off(tp->dev);
10484+
10485+ err = tg3_power_up(tp);
10486+ if (err)
10487+ return err;
10488+
10489+ tg3_full_lock(tp, 0);
10490+
10491+ tg3_disable_ints(tp);
10492+ tg3_flag_clear(tp, INIT_COMPLETE);
10493+
10494+ tg3_full_unlock(tp);
10495+
10496+ err = tg3_start(tp, true, true);
10497+ if (err) {
10498+ tg3_frob_aux_power(tp, false);
10499+ pci_set_power_state(tp->pdev, PCI_D3hot);
10500+ }
10501+ return err;
10502+}
10503+
10504+static int tg3_close(struct net_device *dev)
10505+{
10506+ struct tg3 *tp = netdev_priv(dev);
10507+
10508+ tg3_stop(tp);
10509+
10510+ /* Clear stats across close / open calls */
10511+ memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev));
10512+ memset(&tp->estats_prev, 0, sizeof(tp->estats_prev));
1039910513
1040010514 tg3_power_down(tp);
1040110515
@@ -11185,11 +11299,11 @@ static int tg3_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 783 unmodified lines
1118511299 switch (info->cmd) {
1118611300 case ETHTOOL_GRXRINGS:
1118711301 if (netif_running(tp->dev))
11188− info->data = tp->irq_cnt;
11302+ info->data = tp->rxq_cnt;
1118911303 else {
1119011304 info->data = num_online_cpus();
11191− if (info->data > TG3_IRQ_MAX_VECS_RSS)
11192− info->data = TG3_IRQ_MAX_VECS_RSS;
11305+ if (info->data > TG3_RSS_MAX_NUM_QS)
11306+ info->data = TG3_RSS_MAX_NUM_QS;
1119311307 }
1119411308
1119511309 /* The first interrupt vector only
@@ -11246,6 +11360,58 @@ static int tg3_set_rxfh_indir(struct net_device *dev, const u32 *indir) · 50 unmodified lines
1124611360 return 0;
1124711361 }
1124811362
11363+static void tg3_get_channels(struct net_device *dev,
11364+ struct ethtool_channels *channel)
11365+{
11366+ struct tg3 *tp = netdev_priv(dev);
11367+ u32 deflt_qs = netif_get_num_default_rss_queues();
11368+
11369+ channel->max_rx = tp->rxq_max;
11370+ channel->max_tx = tp->txq_max;
11371+
11372+ if (netif_running(dev)) {
11373+ channel->rx_count = tp->rxq_cnt;
11374+ channel->tx_count = tp->txq_cnt;
11375+ } else {
11376+ if (tp->rxq_req)
11377+ channel->rx_count = tp->rxq_req;
11378+ else
11379+ channel->rx_count = min(deflt_qs, tp->rxq_max);
11380+
11381+ if (tp->txq_req)
11382+ channel->tx_count = tp->txq_req;
11383+ else
11384+ channel->tx_count = min(deflt_qs, tp->txq_max);
11385+ }
11386+}
11387+
11388+static int tg3_set_channels(struct net_device *dev,
11389+ struct ethtool_channels *channel)
11390+{
11391+ struct tg3 *tp = netdev_priv(dev);
11392+
11393+ if (!tg3_flag(tp, SUPPORT_MSIX))
11394+ return -EOPNOTSUPP;
11395+
11396+ if (channel->rx_count > tp->rxq_max ||
11397+ channel->tx_count > tp->txq_max)
11398+ return -EINVAL;
11399+
11400+ tp->rxq_req = channel->rx_count;
11401+ tp->txq_req = channel->tx_count;
11402+
11403+ if (!netif_running(dev))
11404+ return 0;
11405+
11406+ tg3_stop(tp);
11407+
11408+ netif_carrier_off(dev);
11409+
11410+ tg3_start(tp, true, false);
11411+
11412+ return 0;
11413+}
11414+
1124911415 static void tg3_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
1125011416 {
1125111417 switch (stringset) {
@@ -12494,6 +12660,8 @@ static const struct ethtool_ops tg3_ethtool_ops = { · 1242 unmodified lines
1249412660 .get_rxfh_indir_size = tg3_get_rxfh_indir_size,
1249512661 .get_rxfh_indir = tg3_get_rxfh_indir,
1249612662 .set_rxfh_indir = tg3_set_rxfh_indir,
12663+ .get_channels = tg3_get_channels,
12664+ .set_channels = tg3_set_channels,
1249712665 .get_ts_info = ethtool_op_get_ts_info,
1249812666 };
1249912667
@@ -14510,10 +14678,20 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) · 2010 unmodified lines
1451014678 if (tg3_flag(tp, 57765_PLUS)) {
1451114679 tg3_flag_set(tp, SUPPORT_MSIX);
1451214680 tp->irq_max = TG3_IRQ_MAX_VECS;
14513− tg3_rss_init_dflt_indir_tbl(tp);
1451414681 }
1451514682 }
1451614683
14684+ tp->txq_max = 1;
14685+ tp->rxq_max = 1;
14686+ if (tp->irq_max > 1) {
14687+ tp->rxq_max = TG3_RSS_MAX_NUM_QS;
14688+ tg3_rss_init_dflt_indir_tbl(tp, TG3_RSS_MAX_NUM_QS);
14689+
14690+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
14691+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
14692+ tp->txq_max = tp->irq_max - 1;
14693+ }
14694+
1451714695 if (tg3_flag(tp, 5755_PLUS) ||
1451814696 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
1451914697 tg3_flag_set(tp, SHORT_DMA_BUG);
drivers/net/ethernet/broadcom/tg3.h+8−1
@@ -2860,7 +2860,8 @@ struct tg3_rx_prodring_set { · 2859 unmodified lines
28602860 dma_addr_t rx_jmb_mapping;
28612861 };
28622862
2863−#define TG3_IRQ_MAX_VECS_RSS 5
2863+#define TG3_RSS_MAX_NUM_QS 4
2864+#define TG3_IRQ_MAX_VECS_RSS (TG3_RSS_MAX_NUM_QS + 1)
28642865 #define TG3_IRQ_MAX_VECS TG3_IRQ_MAX_VECS_RSS
28652866
28662867 struct tg3_napi {
@@ -3037,6 +3038,9 @@ struct tg3 { · 170 unmodified lines
30373038 void (*write32_tx_mbox) (struct tg3 *, u32,
30383039 u32);
30393040 u32 dma_limit;
3041+ u32 txq_req;
3042+ u32 txq_cnt;
3043+ u32 txq_max;
30403044
30413045 /* begin "rx thread" cacheline section */
30423046 struct tg3_napi napi[TG3_IRQ_MAX_VECS];
@@ -3051,6 +3055,9 @@ struct tg3 { · 8 unmodified lines
30513055 u32 rx_std_max_post;
30523056 u32 rx_offset;
30533057 u32 rx_pkt_map_sz;
3058+ u32 rxq_req;
3059+ u32 rxq_cnt;
3060+ u32 rxq_max;
30543061 bool rx_refill;
30553062
30563063
drivers/net/ethernet/brocade/bna/bnad.c+1−0
@@ -3268,6 +3268,7 @@ bnad_pci_probe(struct pci_dev *pdev, · 3267 unmodified lines
32683268 * Output : using_dac = 1 for 64 bit DMA
32693269 * = 0 for 32 bit DMA
32703270 */
3271+ using_dac = false;
32713272 err = bnad_pci_init(bnad, pdev, &using_dac);
32723273 if (err)
32733274 goto unlock_mutex;
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+46−5
@@ -67,12 +67,12 @@ enum { · 66 unmodified lines
6767 };
6868
6969 enum {
70− MEMWIN0_APERTURE = 65536,
71− MEMWIN0_BASE = 0x30000,
70+ MEMWIN0_APERTURE = 2048,
71+ MEMWIN0_BASE = 0x1b800,
7272 MEMWIN1_APERTURE = 32768,
7373 MEMWIN1_BASE = 0x28000,
74− MEMWIN2_APERTURE = 2048,
75− MEMWIN2_BASE = 0x1b800,
74+ MEMWIN2_APERTURE = 65536,
75+ MEMWIN2_BASE = 0x30000,
7676 };
7777
7878 enum dev_master {
@@ -211,6 +211,9 @@ struct tp_err_stats { · 132 unmodified lines
211211 struct tp_params {
212212 unsigned int ntxchan; /* # of Tx channels */
213213 unsigned int tre; /* log2 of core clocks per TP tick */
214+
215+ uint32_t dack_re; /* DACK timer resolution */
216+ unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */
214217 };
215218
216219 struct vpd_params {
@@ -315,6 +318,10 @@ enum { /* adapter flags */ · 98 unmodified lines
315318 USING_MSI = (1 << 1),
316319 USING_MSIX = (1 << 2),
317320 FW_OK = (1 << 4),
321+ RSS_TNLALLLOOKUP = (1 << 5),
322+ USING_SOFT_PARAMS = (1 << 6),
323+ MASTER_PF = (1 << 7),
324+ FW_OFLD_CONN = (1 << 9),
318325 };
319326
320327 struct rx_sw_desc;
@@ -467,6 +474,11 @@ struct sge { · 146 unmodified lines
467474 u16 rdma_rxq[NCHAN];
468475 u16 timer_val[SGE_NTIMERS];
469476 u8 counter_val[SGE_NCOUNTERS];
477+ u32 fl_pg_order; /* large page allocation size */
478+ u32 stat_len; /* length of status page at ring end */
479+ u32 pktshift; /* padding between CPL & packet data */
480+ u32 fl_align; /* response queue message alignment */
481+ u32 fl_starve_thres; /* Free List starvation threshold */
470482 unsigned int starve_thres;
471483 u8 idma_state[2];
472484 unsigned int egr_start;
@@ -511,6 +523,8 @@ struct adapter { · 38 unmodified lines
511523 struct net_device *port[MAX_NPORTS];
512524 u8 chan_map[NCHAN]; /* channel -> port map */
513525
526+ unsigned int l2t_start;
527+ unsigned int l2t_end;
514528 struct l2t_data *l2t;
515529 void *uld_handle[CXGB4_ULD_MAX];
516530 struct list_head list_node;
@@ -619,7 +633,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, · 102 unmodified lines
619633 int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
620634 struct net_device *dev, unsigned int iqid);
621635 irqreturn_t t4_sge_intr_msix(int irq, void *cookie);
622−void t4_sge_init(struct adapter *adap);
636+int t4_sge_init(struct adapter *adap);
623637 void t4_sge_start(struct adapter *adap);
624638 void t4_sge_stop(struct adapter *adap);
625639 extern int dbfifo_int_thresh;
@@ -638,6 +652,14 @@ static inline unsigned int us_to_core_ticks(const struct adapter *adap, · 12 unmodified lines
638652 return (us * adap->params.vpd.cclk) / 1000;
639653 }
640654
655+static inline unsigned int core_ticks_to_us(const struct adapter *adapter,
656+ unsigned int ticks)
657+{
658+ /* add Core Clock / 2 to round ticks to nearest uS */
659+ return ((ticks * 1000 + adapter->params.vpd.cclk/2) /
660+ adapter->params.vpd.cclk);
661+}
662+
641663 void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,
642664 u32 val);
643665
@@ -656,6 +678,9 @@ static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, · 12 unmodified lines
656678 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);
657679 }
658680
681+void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
682+ unsigned int data_reg, const u32 *vals,
683+ unsigned int nregs, unsigned int start_idx);
659684 void t4_intr_enable(struct adapter *adapter);
660685 void t4_intr_disable(struct adapter *adapter);
661686 int t4_slow_intr_handler(struct adapter *adapter);
@@ -664,8 +689,12 @@ int t4_wait_dev_ready(struct adapter *adap); · 2 unmodified lines
664689 int t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port,
665690 struct link_config *lc);
666691 int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);
692+int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
693+ __be32 *buf);
667694 int t4_seeprom_wp(struct adapter *adapter, bool enable);
695+int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
668696 int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
697+unsigned int t4_flash_cfg_addr(struct adapter *adapter);
669698 int t4_check_fw_version(struct adapter *adapter);
670699 int t4_prep_adapter(struct adapter *adapter);
671700 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
@@ -680,6 +709,8 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, · 8 unmodified lines
680709
681710 void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
682711 void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
712+void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
713+ unsigned int mask, unsigned int val);
683714 void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
684715 struct tp_tcp_stats *v6);
685716 void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
@@ -695,6 +726,16 @@ int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, · 9 unmodified lines
695726 int t4_fw_bye(struct adapter *adap, unsigned int mbox);
696727 int t4_early_init(struct adapter *adap, unsigned int mbox);
697728 int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
729+int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force);
730+int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset);
731+int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
732+ const u8 *fw_data, unsigned int size, int force);
733+int t4_fw_config_file(struct adapter *adap, unsigned int mbox,
734+ unsigned int mtype, unsigned int maddr,
735+ u32 *finiver, u32 *finicsum, u32 *cfcsum);
736+int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
737+ unsigned int cache_line_size);
738+int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
698739 int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
699740 unsigned int vf, unsigned int nparams, const u32 *params,
700741 u32 *val);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+838−116
@@ -78,28 +78,45 @@ · 77 unmodified lines
7878 */
7979 #define MAX_SGE_TIMERVAL 200U
8080
81−#ifdef CONFIG_PCI_IOV
82−/*
83− * Virtual Function provisioning constants. We need two extra Ingress Queues
84− * with Interrupt capability to serve as the VF's Firmware Event Queue and
85− * Forwarded Interrupt Queue (when using MSI mode) -- neither will have Free
86− * Lists associated with them). For each Ethernet/Control Egress Queue and
87− * for each Free List, we need an Egress Context.
88− */
8981 enum {
82+ /*
83+ * Physical Function provisioning constants.
84+ */
85+ PFRES_NVI = 4, /* # of Virtual Interfaces */
86+ PFRES_NETHCTRL = 128, /* # of EQs used for ETH or CTRL Qs */
87+ PFRES_NIQFLINT = 128, /* # of ingress Qs/w Free List(s)/intr
88+ */
89+ PFRES_NEQ = 256, /* # of egress queues */
90+ PFRES_NIQ = 0, /* # of ingress queues */
91+ PFRES_TC = 0, /* PCI-E traffic class */
92+ PFRES_NEXACTF = 128, /* # of exact MPS filters */
93+
94+ PFRES_R_CAPS = FW_CMD_CAP_PF,
95+ PFRES_WX_CAPS = FW_CMD_CAP_PF,
96+
97+#ifdef CONFIG_PCI_IOV
98+ /*
99+ * Virtual Function provisioning constants. We need two extra Ingress
100+ * Queues with Interrupt capability to serve as the VF's Firmware
101+ * Event Queue and Forwarded Interrupt Queue (when using MSI mode) --
102+ * neither will have Free Lists associated with them). For each
103+ * Ethernet/Control Egress Queue and for each Free List, we need an
104+ * Egress Context.
105+ */
90106 VFRES_NPORTS = 1, /* # of "ports" per VF */
91107 VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */
92108
93109 VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */
94110 VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */
95111 VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */
96− VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
97112 VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */
113+ VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
98114 VFRES_TC = 0, /* PCI-E traffic class */
99115 VFRES_NEXACTF = 16, /* # of exact MPS filters */
100116
101117 VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT,
102118 VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF,
119+#endif
103120 };
104121
105122 /*
@@ -146,7 +163,6 @@ static unsigned int pfvfres_pmask(struct adapter *adapter, · 40 unmodified lines
146163 }
147164 /*NOTREACHED*/
148165 }
149−#endif
150166
151167 enum {
152168 MAX_TXQ_ENTRIES = 16384,
@@ -193,6 +209,7 @@ static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { · 40 unmodified lines
193209 };
194210
195211 #define FW_FNAME "cxgb4/t4fw.bin"
212+#define FW_CFNAME "cxgb4/t4-config.txt"
196213
197214 MODULE_DESCRIPTION(DRV_DESC);
198215 MODULE_AUTHOR("Chelsio Communications");
@@ -201,6 +218,28 @@ MODULE_VERSION(DRV_VERSION); · 2 unmodified lines
201218 MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl);
202219 MODULE_FIRMWARE(FW_FNAME);
203220
221+/*
222+ * Normally we're willing to become the firmware's Master PF but will be happy
223+ * if another PF has already become the Master and initialized the adapter.
224+ * Setting "force_init" will cause this driver to forcibly establish itself as
225+ * the Master PF and initialize the adapter.
226+ */
227+static uint force_init;
228+
229+module_param(force_init, uint, 0644);
230+MODULE_PARM_DESC(force_init, "Forcibly become Master PF and initialize adapter");
231+
232+/*
233+ * Normally if the firmware we connect to has Configuration File support, we
234+ * use that and only fall back to the old Driver-based initialization if the
235+ * Configuration File fails for some reason. If force_old_init is set, then
236+ * we'll always use the old Driver-based initialization sequence.
237+ */
238+static uint force_old_init;
239+
240+module_param(force_old_init, uint, 0644);
241+MODULE_PARM_DESC(force_old_init, "Force old initialization sequence");
242+
204243 static int dflt_msg_enable = DFLT_MSG_ENABLE;
205244
206245 module_param(dflt_msg_enable, int, 0644);
@@ -236,6 +275,20 @@ module_param_array(intr_cnt, uint, NULL, 0644); · 29 unmodified lines
236275 MODULE_PARM_DESC(intr_cnt,
237276 "thresholds 1..3 for queue interrupt packet counters");
238277
278+/*
279+ * Normally we tell the chip to deliver Ingress Packets into our DMA buffers
280+ * offset by 2 bytes in order to have the IP headers line up on 4-byte
281+ * boundaries. This is a requirement for many architectures which will throw
282+ * a machine check fault if an attempt is made to access one of the 4-byte IP
283+ * header fields on a non-4-byte boundary. And it's a major performance issue
284+ * even on some architectures which allow it like some implementations of the
285+ * x86 ISA. However, some architectures don't mind this and for some very
286+ * edge-case performance sensitive applications (like forwarding large volumes
287+ * of small packets), setting this DMA offset to 0 will decrease the number of
288+ * PCI-E Bus transfers enough to measurably affect performance.
289+ */
290+static int rx_dma_offset = 2;
291+
239292 static bool vf_acls;
240293
241294 #ifdef CONFIG_PCI_IOV
@@ -248,6 +301,30 @@ module_param_array(num_vf, uint, NULL, 0644); · 6 unmodified lines
248301 MODULE_PARM_DESC(num_vf, "number of VFs for each of PFs 0-3");
249302 #endif
250303
304+/*
305+ * The filter TCAM has a fixed portion and a variable portion. The fixed
306+ * portion can match on source/destination IP IPv4/IPv6 addresses and TCP/UDP
307+ * ports. The variable portion is 36 bits which can include things like Exact
308+ * Match MAC Index (9 bits), Ether Type (16 bits), IP Protocol (8 bits),
309+ * [Inner] VLAN Tag (17 bits), etc. which, if all were somehow selected, would
310+ * far exceed the 36-bit budget for this "compressed" header portion of the
311+ * filter. Thus, we have a scarce resource which must be carefully managed.
312+ *
313+ * By default we set this up to mostly match the set of filter matching
314+ * capabilities of T3 but with accommodations for some of T4's more
315+ * interesting features:
316+ *
317+ * { IP Fragment (1), MPS Match Type (3), IP Protocol (8),
318+ * [Inner] VLAN (17), Port (3), FCoE (1) }
319+ */
320+enum {
321+ TP_VLAN_PRI_MAP_DEFAULT = HW_TPL_FR_MT_PR_IV_P_FC,
322+ TP_VLAN_PRI_MAP_FIRST = FCOE_SHIFT,
323+ TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_SHIFT,
324+};
325+
326+static unsigned int tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
327+
251328 static struct dentry *cxgb4_debugfs_root;
252329
253330 static LIST_HEAD(adapter_list);
@@ -852,11 +929,25 @@ static int upgrade_fw(struct adapter *adap) · 598 unmodified lines
852929 */
853930 if (FW_HDR_FW_VER_MAJOR_GET(adap->params.fw_vers) != FW_VERSION_MAJOR ||
854931 vers > adap->params.fw_vers) {
855− ret = -t4_load_fw(adap, fw->data, fw->size);
932+ dev_info(dev, "upgrading firmware ...\n");
933+ ret = t4_fw_upgrade(adap, adap->mbox, fw->data, fw->size,
934+ /*force=*/false);
856935 if (!ret)
857− dev_info(dev, "firmware upgraded to version %pI4 from "
858− FW_FNAME "\n", &hdr->fw_ver);
936+ dev_info(dev, "firmware successfully upgraded to "
937+ FW_FNAME " (%d.%d.%d.%d)\n",
938+ FW_HDR_FW_VER_MAJOR_GET(vers),
939+ FW_HDR_FW_VER_MINOR_GET(vers),
940+ FW_HDR_FW_VER_MICRO_GET(vers),
941+ FW_HDR_FW_VER_BUILD_GET(vers));
942+ else
943+ dev_err(dev, "firmware upgrade failed! err=%d\n", -ret);
944+ } else {
945+ /*
946+ * Tell our caller that we didn't upgrade the firmware.
947+ */
948+ ret = -EINVAL;
859949 }
950+
860951 out: release_firmware(fw);
861952 return ret;
862953 }
@@ -2470,8 +2561,8 @@ int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, · 1607 unmodified lines
24702561 else
24712562 delta = size - hw_pidx + pidx;
24722563 wmb();
2473− t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),
2474− V_QID(qid) | V_PIDX(delta));
2564+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
2565+ QID(qid) | PIDX(delta));
24752566 }
24762567 out:
24772568 return ret;
@@ -2579,8 +2670,8 @@ static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) · 101 unmodified lines
25792670 else
25802671 delta = q->size - hw_pidx + q->db_pidx;
25812672 wmb();
2582− t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),
2583− V_QID(q->cntxt_id) | V_PIDX(delta));
2673+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
2674+ QID(q->cntxt_id) | PIDX(delta));
25842675 }
25852676 out:
25862677 q->db_disabled = 0;
@@ -2617,9 +2708,9 @@ static void process_db_full(struct work_struct *work) · 30 unmodified lines
26172708
26182709 notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL);
26192710 drain_db_fifo(adap, dbfifo_drain_delay);
2620− t4_set_reg_field(adap, A_SGE_INT_ENABLE3,
2621− F_DBFIFO_HP_INT | F_DBFIFO_LP_INT,
2622− F_DBFIFO_HP_INT | F_DBFIFO_LP_INT);
2711+ t4_set_reg_field(adap, SGE_INT_ENABLE3,
2712+ DBFIFO_HP_INT | DBFIFO_LP_INT,
2713+ DBFIFO_HP_INT | DBFIFO_LP_INT);
26232714 notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY);
26242715 }
26252716
@@ -2639,8 +2730,8 @@ static void process_db_drop(struct work_struct *work) · 13 unmodified lines
26392730
26402731 void t4_db_full(struct adapter *adap)
26412732 {
2642− t4_set_reg_field(adap, A_SGE_INT_ENABLE3,
2643− F_DBFIFO_HP_INT | F_DBFIFO_LP_INT, 0);
2733+ t4_set_reg_field(adap, SGE_INT_ENABLE3,
2734+ DBFIFO_HP_INT | DBFIFO_LP_INT, 0);
26442735 queue_work(workq, &adap->db_full_task);
26452736 }
26462737
@@ -3076,6 +3167,10 @@ static void setup_memwin(struct adapter *adap) · 429 unmodified lines
30763167 t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2),
30773168 (bar0 + MEMWIN2_BASE) | BIR(0) |
30783169 WINDOW(ilog2(MEMWIN2_APERTURE) - 10));
3170+}
3171+
3172+static void setup_memwin_rdma(struct adapter *adap)
3173+{
30793174 if (adap->vres.ocq.size) {
30803175 unsigned int start, sz_kb;
30813176
@@ -3153,6 +3248,488 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) · 71 unmodified lines
31533248 */
31543249 #define MAX_ATIDS 8192U
31553250
3251+/*
3252+ * Phase 0 of initialization: contact FW, obtain config, perform basic init.
3253+ *
3254+ * If the firmware we're dealing with has Configuration File support, then
3255+ * we use that to perform all configuration
3256+ */
3257+
3258+/*
3259+ * Tweak configuration based on module parameters, etc. Most of these have
3260+ * defaults assigned to them by Firmware Configuration Files (if we're using
3261+ * them) but need to be explicitly set if we're using hard-coded
3262+ * initialization. But even in the case of using Firmware Configuration
3263+ * Files, we'd like to expose the ability to change these via module
3264+ * parameters so these are essentially common tweaks/settings for
3265+ * Configuration Files and hard-coded initialization ...
3266+ */
3267+static int adap_init0_tweaks(struct adapter *adapter)
3268+{
3269+ /*
3270+ * Fix up various Host-Dependent Parameters like Page Size, Cache
3271+ * Line Size, etc. The firmware default is for a 4KB Page Size and
3272+ * 64B Cache Line Size ...
3273+ */
3274+ t4_fixup_host_params(adapter, PAGE_SIZE, L1_CACHE_BYTES);
3275+
3276+ /*
3277+ * Process module parameters which affect early initialization.
3278+ */
3279+ if (rx_dma_offset != 2 && rx_dma_offset != 0) {
3280+ dev_err(&adapter->pdev->dev,
3281+ "Ignoring illegal rx_dma_offset=%d, using 2\n",
3282+ rx_dma_offset);
3283+ rx_dma_offset = 2;
3284+ }
3285+ t4_set_reg_field(adapter, SGE_CONTROL,
3286+ PKTSHIFT_MASK,
3287+ PKTSHIFT(rx_dma_offset));
3288+
3289+ /*
3290+ * Don't include the "IP Pseudo Header" in CPL_RX_PKT checksums: Linux
3291+ * adds the pseudo header itself.
3292+ */
3293+ t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG,
3294+ CSUM_HAS_PSEUDO_HDR, 0);
3295+
3296+ return 0;
3297+}
3298+
3299+/*
3300+ * Attempt to initialize the adapter via a Firmware Configuration File.
3301+ */
3302+static int adap_init0_config(struct adapter *adapter, int reset)
3303+{
3304+ struct fw_caps_config_cmd caps_cmd;
3305+ const struct firmware *cf;
3306+ unsigned long mtype = 0, maddr = 0;
3307+ u32 finiver, finicsum, cfcsum;
3308+ int ret, using_flash;
3309+
3310+ /*
3311+ * Reset device if necessary.
3312+ */
3313+ if (reset) {
3314+ ret = t4_fw_reset(adapter, adapter->mbox,
3315+ PIORSTMODE | PIORST);
3316+ if (ret < 0)
3317+ goto bye;
3318+ }
3319+
3320+ /*
3321+ * If we have a T4 configuration file under /lib/firmware/cxgb4/,
3322+ * then use that. Otherwise, use the configuration file stored
3323+ * in the adapter flash ...
3324+ */
3325+ ret = request_firmware(&cf, FW_CFNAME, adapter->pdev_dev);
3326+ if (ret < 0) {
3327+ using_flash = 1;
3328+ mtype = FW_MEMTYPE_CF_FLASH;
3329+ maddr = t4_flash_cfg_addr(adapter);
3330+ } else {
3331+ u32 params[7], val[7];
3332+
3333+ using_flash = 0;
3334+ if (cf->size >= FLASH_CFG_MAX_SIZE)
3335+ ret = -ENOMEM;
3336+ else {
3337+ params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
3338+ FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_CF));
3339+ ret = t4_query_params(adapter, adapter->mbox,
3340+ adapter->fn, 0, 1, params, val);
3341+ if (ret == 0) {
3342+ /*
3343+ * For t4_memory_write() below addresses and
3344+ * sizes have to be in terms of multiples of 4
3345+ * bytes. So, if the Configuration File isn't
3346+ * a multiple of 4 bytes in length we'll have
3347+ * to write that out separately since we can't
3348+ * guarantee that the bytes following the
3349+ * residual byte in the buffer returned by
3350+ * request_firmware() are zeroed out ...
3351+ */
3352+ size_t resid = cf->size & 0x3;
3353+ size_t size = cf->size & ~0x3;
3354+ __be32 *data = (__be32 *)cf->data;
3355+
3356+ mtype = FW_PARAMS_PARAM_Y_GET(val[0]);
3357+ maddr = FW_PARAMS_PARAM_Z_GET(val[0]) << 16;
3358+
3359+ ret = t4_memory_write(adapter, mtype, maddr,
3360+ size, data);
3361+ if (ret == 0 && resid != 0) {
3362+ union {
3363+ __be32 word;
3364+ char buf[4];
3365+ } last;
3366+ int i;
3367+
3368+ last.word = data[size >> 2];
3369+ for (i = resid; i < 4; i++)
3370+ last.buf[i] = 0;
3371+ ret = t4_memory_write(adapter, mtype,
3372+ maddr + size,
3373+ 4, &last.word);
3374+ }
3375+ }
3376+ }
3377+
3378+ release_firmware(cf);
3379+ if (ret)
3380+ goto bye;
3381+ }
3382+
3383+ /*
3384+ * Issue a Capability Configuration command to the firmware to get it
3385+ * to parse the Configuration File. We don't use t4_fw_config_file()
3386+ * because we want the ability to modify various features after we've
3387+ * processed the configuration file ...
3388+ */
3389+ memset(&caps_cmd, 0, sizeof(caps_cmd));
3390+ caps_cmd.op_to_write =
3391+ htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3392+ FW_CMD_REQUEST |
3393+ FW_CMD_READ);
3394+ caps_cmd.retval_len16 =
3395+ htonl(FW_CAPS_CONFIG_CMD_CFVALID |
3396+ FW_CAPS_CONFIG_CMD_MEMTYPE_CF(mtype) |
3397+ FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(maddr >> 16) |
3398+ FW_LEN16(caps_cmd));
3399+ ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
3400+ &caps_cmd);
3401+ if (ret < 0)
3402+ goto bye;
3403+
3404+ finiver = ntohl(caps_cmd.finiver);
3405+ finicsum = ntohl(caps_cmd.finicsum);
3406+ cfcsum = ntohl(caps_cmd.cfcsum);
3407+ if (finicsum != cfcsum)
3408+ dev_warn(adapter->pdev_dev, "Configuration File checksum "\
3409+ "mismatch: [fini] csum=%#x, computed csum=%#x\n",
3410+ finicsum, cfcsum);
3411+
3412+ /*
3413+ * If we're a pure NIC driver then disable all offloading facilities.
3414+ * This will allow the firmware to optimize aspects of the hardware
3415+ * configuration which will result in improved performance.
3416+ */
3417+ caps_cmd.ofldcaps = 0;
3418+ caps_cmd.iscsicaps = 0;
3419+ caps_cmd.rdmacaps = 0;
3420+ caps_cmd.fcoecaps = 0;
3421+
3422+ /*
3423+ * And now tell the firmware to use the configuration we just loaded.
3424+ */
3425+ caps_cmd.op_to_write =
3426+ htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3427+ FW_CMD_REQUEST |
3428+ FW_CMD_WRITE);
3429+ caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd));
3430+ ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
3431+ NULL);
3432+ if (ret < 0)
3433+ goto bye;
3434+
3435+ /*
3436+ * Tweak configuration based on system architecture, module
3437+ * parameters, etc.
3438+ */
3439+ ret = adap_init0_tweaks(adapter);
3440+ if (ret < 0)
3441+ goto bye;
3442+
3443+ /*
3444+ * And finally tell the firmware to initialize itself using the
3445+ * parameters from the Configuration File.
3446+ */
3447+ ret = t4_fw_initialize(adapter, adapter->mbox);
3448+ if (ret < 0)
3449+ goto bye;
3450+
3451+ /*
3452+ * Return successfully and note that we're operating with parameters
3453+ * not supplied by the driver, rather than from hard-wired
3454+ * initialization constants burried in the driver.
3455+ */
3456+ adapter->flags |= USING_SOFT_PARAMS;
3457+ dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\
3458+ "Configuration File %s, version %#x, computed checksum %#x\n",
3459+ (using_flash
3460+ ? "in device FLASH"
3461+ : "/lib/firmware/" FW_CFNAME),
3462+ finiver, cfcsum);
3463+ return 0;
3464+
3465+ /*
3466+ * Something bad happened. Return the error ... (If the "error"
3467+ * is that there's no Configuration File on the adapter we don't
3468+ * want to issue a warning since this is fairly common.)
3469+ */
3470+bye:
3471+ if (ret != -ENOENT)
3472+ dev_warn(adapter->pdev_dev, "Configuration file error %d\n",
3473+ -ret);
3474+ return ret;
3475+}
3476+
3477+/*
3478+ * Attempt to initialize the adapter via hard-coded, driver supplied
3479+ * parameters ...
3480+ */
3481+static int adap_init0_no_config(struct adapter *adapter, int reset)
3482+{
3483+ struct sge *s = &adapter->sge;
3484+ struct fw_caps_config_cmd caps_cmd;
3485+ u32 v;
3486+ int i, ret;
3487+
3488+ /*
3489+ * Reset device if necessary
3490+ */
3491+ if (reset) {
3492+ ret = t4_fw_reset(adapter, adapter->mbox,
3493+ PIORSTMODE | PIORST);
3494+ if (ret < 0)
3495+ goto bye;
3496+ }
3497+
3498+ /*
3499+ * Get device capabilities and select which we'll be using.
3500+ */
3501+ memset(&caps_cmd, 0, sizeof(caps_cmd));
3502+ caps_cmd.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3503+ FW_CMD_REQUEST | FW_CMD_READ);
3504+ caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd));
3505+ ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
3506+ &caps_cmd);
3507+ if (ret < 0)
3508+ goto bye;
3509+
3510+#ifndef CONFIG_CHELSIO_T4_OFFLOAD
3511+ /*
3512+ * If we're a pure NIC driver then disable all offloading facilities.
3513+ * This will allow the firmware to optimize aspects of the hardware
3514+ * configuration which will result in improved performance.
3515+ */
3516+ caps_cmd.ofldcaps = 0;
3517+ caps_cmd.iscsicaps = 0;
3518+ caps_cmd.rdmacaps = 0;
3519+ caps_cmd.fcoecaps = 0;
3520+#endif
3521+
3522+ if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) {
3523+ if (!vf_acls)
3524+ caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM);
3525+ else
3526+ caps_cmd.niccaps = htons(FW_CAPS_CONFIG_NIC_VM);
3527+ } else if (vf_acls) {
3528+ dev_err(adapter->pdev_dev, "virtualization ACLs not supported");
3529+ goto bye;
3530+ }
3531+ caps_cmd.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3532+ FW_CMD_REQUEST | FW_CMD_WRITE);
3533+ ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
3534+ NULL);
3535+ if (ret < 0)
3536+ goto bye;
3537+
3538+ /*
3539+ * Tweak configuration based on system architecture, module
3540+ * parameters, etc.
3541+ */
3542+ ret = adap_init0_tweaks(adapter);
3543+ if (ret < 0)
3544+ goto bye;
3545+
3546+ /*
3547+ * Select RSS Global Mode we want to use. We use "Basic Virtual"
3548+ * mode which maps each Virtual Interface to its own section of
3549+ * the RSS Table and we turn on all map and hash enables ...
3550+ */
3551+ adapter->flags |= RSS_TNLALLLOOKUP;
3552+ ret = t4_config_glbl_rss(adapter, adapter->mbox,
3553+ FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL,
3554+ FW_RSS_GLB_CONFIG_CMD_TNLMAPEN |
3555+ FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ |
3556+ ((adapter->flags & RSS_TNLALLLOOKUP) ?
3557+ FW_RSS_GLB_CONFIG_CMD_TNLALLLKP : 0));
3558+ if (ret < 0)
3559+ goto bye;
3560+
3561+ /*
3562+ * Set up our own fundamental resource provisioning ...
3563+ */
3564+ ret = t4_cfg_pfvf(adapter, adapter->mbox, adapter->fn, 0,
3565+ PFRES_NEQ, PFRES_NETHCTRL,
3566+ PFRES_NIQFLINT, PFRES_NIQ,
3567+ PFRES_TC, PFRES_NVI,
3568+ FW_PFVF_CMD_CMASK_MASK,
3569+ pfvfres_pmask(adapter, adapter->fn, 0),
3570+ PFRES_NEXACTF,
3571+ PFRES_R_CAPS, PFRES_WX_CAPS);
3572+ if (ret < 0)
3573+ goto bye;
3574+
3575+ /*
3576+ * Perform low level SGE initialization. We need to do this before we
3577+ * send the firmware the INITIALIZE command because that will cause
3578+ * any other PF Drivers which are waiting for the Master
3579+ * Initialization to proceed forward.
3580+ */
3581+ for (i = 0; i < SGE_NTIMERS - 1; i++)
3582+ s->timer_val[i] = min(intr_holdoff[i], MAX_SGE_TIMERVAL);
3583+ s->timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL;
3584+ s->counter_val[0] = 1;
3585+ for (i = 1; i < SGE_NCOUNTERS; i++)
3586+ s->counter_val[i] = min(intr_cnt[i - 1],
3587+ THRESHOLD_0_GET(THRESHOLD_0_MASK));
3588+ t4_sge_init(adapter);
3589+
3590+#ifdef CONFIG_PCI_IOV
3591+ /*
3592+ * Provision resource limits for Virtual Functions. We currently
3593+ * grant them all the same static resource limits except for the Port
3594+ * Access Rights Mask which we're assigning based on the PF. All of
3595+ * the static provisioning stuff for both the PF and VF really needs
3596+ * to be managed in a persistent manner for each device which the
3597+ * firmware controls.
3598+ */
3599+ {
3600+ int pf, vf;
3601+
3602+ for (pf = 0; pf < ARRAY_SIZE(num_vf); pf++) {
3603+ if (num_vf[pf] <= 0)
3604+ continue;
3605+
3606+ /* VF numbering starts at 1! */
3607+ for (vf = 1; vf <= num_vf[pf]; vf++) {
3608+ ret = t4_cfg_pfvf(adapter, adapter->mbox,
3609+ pf, vf,
3610+ VFRES_NEQ, VFRES_NETHCTRL,
3611+ VFRES_NIQFLINT, VFRES_NIQ,
3612+ VFRES_TC, VFRES_NVI,
3613+ FW_PFVF_CMD_CMASK_GET(
3614+ FW_PFVF_CMD_CMASK_MASK),
3615+ pfvfres_pmask(
3616+ adapter, pf, vf),
3617+ VFRES_NEXACTF,
3618+ VFRES_R_CAPS, VFRES_WX_CAPS);
3619+ if (ret < 0)
3620+ dev_warn(adapter->pdev_dev,
3621+ "failed to "\
3622+ "provision pf/vf=%d/%d; "
3623+ "err=%d\n", pf, vf, ret);
3624+ }
3625+ }
3626+ }
3627+#endif
3628+
3629+ /*
3630+ * Set up the default filter mode. Later we'll want to implement this
3631+ * via a firmware command, etc. ... This needs to be done before the
3632+ * firmare initialization command ... If the selected set of fields
3633+ * isn't equal to the default value, we'll need to make sure that the
3634+ * field selections will fit in the 36-bit budget.
3635+ */
3636+ if (tp_vlan_pri_map != TP_VLAN_PRI_MAP_DEFAULT) {
3637+ int i, bits = 0;
3638+
3639+ for (i = TP_VLAN_PRI_MAP_FIRST; i <= TP_VLAN_PRI_MAP_LAST; i++)
3640+ switch (tp_vlan_pri_map & (1 << i)) {
3641+ case 0:
3642+ /* compressed filter field not enabled */
3643+ break;
3644+ case FCOE_MASK:
3645+ bits += 1;
3646+ break;
3647+ case PORT_MASK:
3648+ bits += 3;
3649+ break;
3650+ case VNIC_ID_MASK:
3651+ bits += 17;
3652+ break;
3653+ case VLAN_MASK:
3654+ bits += 17;
3655+ break;
3656+ case TOS_MASK:
3657+ bits += 8;
3658+ break;
3659+ case PROTOCOL_MASK:
3660+ bits += 8;
3661+ break;
3662+ case ETHERTYPE_MASK:
3663+ bits += 16;
3664+ break;
3665+ case MACMATCH_MASK:
3666+ bits += 9;
3667+ break;
3668+ case MPSHITTYPE_MASK:
3669+ bits += 3;
3670+ break;
3671+ case FRAGMENTATION_MASK:
3672+ bits += 1;
3673+ break;
3674+ }
3675+
3676+ if (bits > 36) {
3677+ dev_err(adapter->pdev_dev,
3678+ "tp_vlan_pri_map=%#x needs %d bits > 36;"\
3679+ " using %#x\n", tp_vlan_pri_map, bits,
3680+ TP_VLAN_PRI_MAP_DEFAULT);
3681+ tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
3682+ }
3683+ }
3684+ v = tp_vlan_pri_map;
3685+ t4_write_indirect(adapter, TP_PIO_ADDR, TP_PIO_DATA,
3686+ &v, 1, TP_VLAN_PRI_MAP);
3687+
3688+ /*
3689+ * We need Five Tuple Lookup mode to be set in TP_GLOBAL_CONFIG order
3690+ * to support any of the compressed filter fields above. Newer
3691+ * versions of the firmware do this automatically but it doesn't hurt
3692+ * to set it here. Meanwhile, we do _not_ need to set Lookup Every
3693+ * Packet in TP_INGRESS_CONFIG to support matching non-TCP packets
3694+ * since the firmware automatically turns this on and off when we have
3695+ * a non-zero number of filters active (since it does have a
3696+ * performance impact).
3697+ */
3698+ if (tp_vlan_pri_map)
3699+ t4_set_reg_field(adapter, TP_GLOBAL_CONFIG,
3700+ FIVETUPLELOOKUP_MASK,
3701+ FIVETUPLELOOKUP_MASK);
3702+
3703+ /*
3704+ * Tweak some settings.
3705+ */
3706+ t4_write_reg(adapter, TP_SHIFT_CNT, SYNSHIFTMAX(6) |
3707+ RXTSHIFTMAXR1(4) | RXTSHIFTMAXR2(15) |
3708+ PERSHIFTBACKOFFMAX(8) | PERSHIFTMAX(8) |
3709+ KEEPALIVEMAXR1(4) | KEEPALIVEMAXR2(9));
3710+
3711+ /*
3712+ * Get basic stuff going by issuing the Firmware Initialize command.
3713+ * Note that this _must_ be after all PFVF commands ...
3714+ */
3715+ ret = t4_fw_initialize(adapter, adapter->mbox);
3716+ if (ret < 0)
3717+ goto bye;
3718+
3719+ /*
3720+ * Return successfully!
3721+ */
3722+ dev_info(adapter->pdev_dev, "Successfully configured using built-in "\
3723+ "driver parameters\n");
3724+ return 0;
3725+
3726+ /*
3727+ * Something bad happened. Return the error ...
3728+ */
3729+bye:
3730+ return ret;
3731+}
3732+
31563733 /*
31573734 * Phase 0 of initialization: contact FW, obtain config, perform basic init.
31583735 */
@@ -3162,72 +3739,216 @@ static int adap_init0(struct adapter *adap) · 3 unmodified lines
31623739 u32 v, port_vec;
31633740 enum dev_state state;
31643741 u32 params[7], val[7];
3165− struct fw_caps_config_cmd c;
3166−
3167− ret = t4_check_fw_version(adap);
3168− if (ret == -EINVAL || ret > 0) {
3169− if (upgrade_fw(adap) >= 0) /* recache FW version */
3170− ret = t4_check_fw_version(adap);
3171− }
3172− if (ret < 0)
3173− return ret;
3742+ int reset = 1, j;
31743743
3175− /* contact FW, request master */
3176− ret = t4_fw_hello(adap, adap->fn, adap->fn, MASTER_MUST, &state);
3744+ /*
3745+ * Contact FW, advertising Master capability (and potentially forcing
3746+ * ourselves as the Master PF if our module parameter force_init is
3747+ * set).
3748+ */
3749+ ret = t4_fw_hello(adap, adap->mbox, adap->fn,
3750+ force_init ? MASTER_MUST : MASTER_MAY,
3751+ &state);
31773752 if (ret < 0) {
31783753 dev_err(adap->pdev_dev, "could not connect to FW, error %d\n",
31793754 ret);
31803755 return ret;
31813756 }
3757+ if (ret == adap->mbox)
3758+ adap->flags |= MASTER_PF;
3759+ if (force_init && state == DEV_STATE_INIT)
3760+ state = DEV_STATE_UNINIT;
31823761
3183− /* reset device */
3184− ret = t4_fw_reset(adap, adap->fn, PIORSTMODE | PIORST);
3185− if (ret < 0)
3186− goto bye;
3187−
3188− for (v = 0; v < SGE_NTIMERS - 1; v++)
3189− adap->sge.timer_val[v] = min(intr_holdoff[v], MAX_SGE_TIMERVAL);
3190− adap->sge.timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL;
3191− adap->sge.counter_val[0] = 1;
3192− for (v = 1; v < SGE_NCOUNTERS; v++)
3193− adap->sge.counter_val[v] = min(intr_cnt[v - 1],
3194− THRESHOLD_3_MASK);
3195−#define FW_PARAM_DEV(param) \
3196− (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \
3197− FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
3762+ /*
3763+ * If we're the Master PF Driver and the device is uninitialized,
3764+ * then let's consider upgrading the firmware ... (We always want
3765+ * to check the firmware version number in order to A. get it for
3766+ * later reporting and B. to warn if the currently loaded firmware
3767+ * is excessively mismatched relative to the driver.)
3768+ */
3769+ ret = t4_check_fw_version(adap);
3770+ if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) {
3771+ if (ret == -EINVAL || ret > 0) {
3772+ if (upgrade_fw(adap) >= 0) {
3773+ /*
3774+ * Note that the chip was reset as part of the
3775+ * firmware upgrade so we don't reset it again
3776+ * below and grab the new firmware version.
3777+ */
3778+ reset = 0;
3779+ ret = t4_check_fw_version(adap);
3780+ }
3781+ }
3782+ if (ret < 0)
3783+ return ret;
3784+ }
31983785
3199− params[0] = FW_PARAM_DEV(CCLK);
3200− ret = t4_query_params(adap, adap->fn, adap->fn, 0, 1, params, val);
3786+ /*
3787+ * Grab VPD parameters. This should be done after we establish a
3788+ * connection to the firmware since some of the VPD parameters
3789+ * (notably the Core Clock frequency) are retrieved via requests to
3790+ * the firmware. On the other hand, we need these fairly early on
3791+ * so we do this right after getting ahold of the firmware.
3792+ */
3793+ ret = get_vpd_params(adap, &adap->params.vpd);
32013794 if (ret < 0)
32023795 goto bye;
3203− adap->params.vpd.cclk = val[0];
32043796
3205− ret = adap_init1(adap, &c);
3797+ /*
3798+ * Find out what ports are available to us. Note that we need to do
3799+ * this before calling adap_init0_no_config() since it needs nports
3800+ * and portvec ...
3801+ */
3802+ v =
3803+ FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
3804+ FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_PORTVEC);
3805+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1, &v, &port_vec);
32063806 if (ret < 0)
32073807 goto bye;
32083808
3809+ adap->params.nports = hweight32(port_vec);
3810+ adap->params.portvec = port_vec;
3811+
3812+ /*
3813+ * If the firmware is initialized already (and we're not forcing a
3814+ * master initialization), note that we're living with existing
3815+ * adapter parameters. Otherwise, it's time to try initializing the
3816+ * adapter ...
3817+ */
3818+ if (state == DEV_STATE_INIT) {
3819+ dev_info(adap->pdev_dev, "Coming up as %s: "\
3820+ "Adapter already initialized\n",
3821+ adap->flags & MASTER_PF ? "MASTER" : "SLAVE");
3822+ adap->flags |= USING_SOFT_PARAMS;
3823+ } else {
3824+ dev_info(adap->pdev_dev, "Coming up as MASTER: "\
3825+ "Initializing adapter\n");
3826+
3827+ /*
3828+ * If the firmware doesn't support Configuration
3829+ * Files warn user and exit,
3830+ */
3831+ if (ret < 0)
3832+ dev_warn(adap->pdev_dev, "Firmware doesn't support "
3833+ "configuration file.\n");
3834+ if (force_old_init)
3835+ ret = adap_init0_no_config(adap, reset);
3836+ else {
3837+ /*
3838+ * Find out whether we're dealing with a version of
3839+ * the firmware which has configuration file support.
3840+ */
3841+ params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
3842+ FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_CF));
3843+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1,
3844+ params, val);
3845+
3846+ /*
3847+ * If the firmware doesn't support Configuration
3848+ * Files, use the old Driver-based, hard-wired
3849+ * initialization. Otherwise, try using the
3850+ * Configuration File support and fall back to the
3851+ * Driver-based initialization if there's no
3852+ * Configuration File found.
3853+ */
3854+ if (ret < 0)
3855+ ret = adap_init0_no_config(adap, reset);
3856+ else {
3857+ /*
3858+ * The firmware provides us with a memory
3859+ * buffer where we can load a Configuration
3860+ * File from the host if we want to override
3861+ * the Configuration File in flash.
3862+ */
3863+
3864+ ret = adap_init0_config(adap, reset);
3865+ if (ret == -ENOENT) {
3866+ dev_info(adap->pdev_dev,
3867+ "No Configuration File present "
3868+ "on adapter. Using hard-wired "
3869+ "configuration parameters.\n");
3870+ ret = adap_init0_no_config(adap, reset);
3871+ }
3872+ }
3873+ }
3874+ if (ret < 0) {
3875+ dev_err(adap->pdev_dev,
3876+ "could not initialize adapter, error %d\n",
3877+ -ret);
3878+ goto bye;
3879+ }
3880+ }
3881+
3882+ /*
3883+ * If we're living with non-hard-coded parameters (either from a
3884+ * Firmware Configuration File or values programmed by a different PF
3885+ * Driver), give the SGE code a chance to pull in anything that it
3886+ * needs ... Note that this must be called after we retrieve our VPD
3887+ * parameters in order to know how to convert core ticks to seconds.
3888+ */
3889+ if (adap->flags & USING_SOFT_PARAMS) {
3890+ ret = t4_sge_init(adap);
3891+ if (ret < 0)
3892+ goto bye;
3893+ }
3894+
3895+ /*
3896+ * Grab some of our basic fundamental operating parameters.
3897+ */
3898+#define FW_PARAM_DEV(param) \
3899+ (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \
3900+ FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
3901+
32093902 #define FW_PARAM_PFVF(param) \
3210− (FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
3211− FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param) | \
3212− FW_PARAMS_PARAM_Y(adap->fn))
3903+ FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
3904+ FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param)| \
3905+ FW_PARAMS_PARAM_Y(0) | \
3906+ FW_PARAMS_PARAM_Z(0)
32133907
3214− params[0] = FW_PARAM_DEV(PORTVEC);
3908+ params[0] = FW_PARAM_PFVF(EQ_START);
32153909 params[1] = FW_PARAM_PFVF(L2T_START);
32163910 params[2] = FW_PARAM_PFVF(L2T_END);
32173911 params[3] = FW_PARAM_PFVF(FILTER_START);
32183912 params[4] = FW_PARAM_PFVF(FILTER_END);
32193913 params[5] = FW_PARAM_PFVF(IQFLINT_START);
3220− params[6] = FW_PARAM_PFVF(EQ_START);
3221− ret = t4_query_params(adap, adap->fn, adap->fn, 0, 7, params, val);
3914+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6, params, val);
32223915 if (ret < 0)
32233916 goto bye;
3224− port_vec = val[0];
3917+ adap->sge.egr_start = val[0];
3918+ adap->l2t_start = val[1];
3919+ adap->l2t_end = val[2];
32253920 adap->tids.ftid_base = val[3];
32263921 adap->tids.nftids = val[4] - val[3] + 1;
32273922 adap->sge.ingr_start = val[5];
3228− adap->sge.egr_start = val[6];
32293923
3230− if (c.ofldcaps) {
3924+ /* query params related to active filter region */
3925+ params[0] = FW_PARAM_PFVF(ACTIVE_FILTER_START);
3926+ params[1] = FW_PARAM_PFVF(ACTIVE_FILTER_END);
3927+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, val);
3928+ /* If Active filter size is set we enable establishing
3929+ * offload connection through firmware work request
3930+ */
3931+ if ((val[0] != val[1]) && (ret >= 0)) {
3932+ adap->flags |= FW_OFLD_CONN;
3933+ adap->tids.aftid_base = val[0];
3934+ adap->tids.aftid_end = val[1];
3935+ }
3936+
3937+#ifdef CONFIG_CHELSIO_T4_OFFLOAD
3938+ /*
3939+ * Get device capabilities so we can determine what resources we need
3940+ * to manage.
3941+ */
3942+ memset(&caps_cmd, 0, sizeof(caps_cmd));
3943+ caps_cmd.op_to_write = htonl(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3944+ FW_CMD_REQUEST | FW_CMD_READ);
3945+ caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd));
3946+ ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd),
3947+ &caps_cmd);
3948+ if (ret < 0)
3949+ goto bye;
3950+
3951+ if (caps_cmd.ofldcaps) {
32313952 /* query offload-related parameters */
32323953 params[0] = FW_PARAM_DEV(NTID);
32333954 params[1] = FW_PARAM_PFVF(SERVER_START);
@@ -3235,28 +3956,55 @@ static int adap_init0(struct adapter *adap) · 1 unmodified line
32353956 params[3] = FW_PARAM_PFVF(TDDP_START);
32363957 params[4] = FW_PARAM_PFVF(TDDP_END);
32373958 params[5] = FW_PARAM_DEV(FLOWC_BUFFIFO_SZ);
3238− ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,
3239− val);
3959+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6,
3960+ params, val);
32403961 if (ret < 0)
32413962 goto bye;
32423963 adap->tids.ntids = val[0];
32433964 adap->tids.natids = min(adap->tids.ntids / 2, MAX_ATIDS);
32443965 adap->tids.stid_base = val[1];
32453966 adap->tids.nstids = val[2] - val[1] + 1;
3967+ /*
3968+ * Setup server filter region. Divide the availble filter
3969+ * region into two parts. Regular filters get 1/3rd and server
3970+ * filters get 2/3rd part. This is only enabled if workarond
3971+ * path is enabled.
3972+ * 1. For regular filters.
3973+ * 2. Server filter: This are special filters which are used
3974+ * to redirect SYN packets to offload queue.
3975+ */
3976+ if (adap->flags & FW_OFLD_CONN && !is_bypass(adap)) {
3977+ adap->tids.sftid_base = adap->tids.ftid_base +
3978+ DIV_ROUND_UP(adap->tids.nftids, 3);
3979+ adap->tids.nsftids = adap->tids.nftids -
3980+ DIV_ROUND_UP(adap->tids.nftids, 3);
3981+ adap->tids.nftids = adap->tids.sftid_base -
3982+ adap->tids.ftid_base;
3983+ }
32463984 adap->vres.ddp.start = val[3];
32473985 adap->vres.ddp.size = val[4] - val[3] + 1;
32483986 adap->params.ofldq_wr_cred = val[5];
3987+
3988+ params[0] = FW_PARAM_PFVF(ETHOFLD_START);
3989+ params[1] = FW_PARAM_PFVF(ETHOFLD_END);
3990+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2,
3991+ params, val);
3992+ if ((val[0] != val[1]) && (ret >= 0)) {
3993+ adap->tids.uotid_base = val[0];
3994+ adap->tids.nuotids = val[1] - val[0] + 1;
3995+ }
3996+
32493997 adap->params.offload = 1;
32503998 }
3251− if (c.rdmacaps) {
3999+ if (caps_cmd.rdmacaps) {
32524000 params[0] = FW_PARAM_PFVF(STAG_START);
32534001 params[1] = FW_PARAM_PFVF(STAG_END);
32544002 params[2] = FW_PARAM_PFVF(RQ_START);
32554003 params[3] = FW_PARAM_PFVF(RQ_END);
32564004 params[4] = FW_PARAM_PFVF(PBL_START);
32574005 params[5] = FW_PARAM_PFVF(PBL_END);
3258− ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,
3259− val);
4006+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6,
4007+ params, val);
32604008 if (ret < 0)
32614009 goto bye;
32624010 adap->vres.stag.start = val[0];
@@ -3272,8 +4020,7 @@ static int adap_init0(struct adapter *adap) · 9 unmodified lines
32724020 params[3] = FW_PARAM_PFVF(CQ_END);
32734021 params[4] = FW_PARAM_PFVF(OCQ_START);
32744022 params[5] = FW_PARAM_PFVF(OCQ_END);
3275− ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,
3276− val);
4023+ ret = t4_query_params(adap, 0, 0, 0, 6, params, val);
32774024 if (ret < 0)
32784025 goto bye;
32794026 adap->vres.qp.start = val[0];
@@ -3283,11 +4030,11 @@ static int adap_init0(struct adapter *adap) · 3 unmodified lines
32834030 adap->vres.ocq.start = val[4];
32844031 adap->vres.ocq.size = val[5] - val[4] + 1;
32854032 }
3286− if (c.iscsicaps) {
4033+ if (caps_cmd.iscsicaps) {
32874034 params[0] = FW_PARAM_PFVF(ISCSI_START);
32884035 params[1] = FW_PARAM_PFVF(ISCSI_END);
3289− ret = t4_query_params(adap, adap->fn, adap->fn, 0, 2, params,
3290− val);
4036+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2,
4037+ params, val);
32914038 if (ret < 0)
32924039 goto bye;
32934040 adap->vres.iscsi.start = val[0];
@@ -3295,63 +4042,33 @@ static int adap_init0(struct adapter *adap) · 1 unmodified line
32954042 }
32964043 #undef FW_PARAM_PFVF
32974044 #undef FW_PARAM_DEV
4045+#endif /* CONFIG_CHELSIO_T4_OFFLOAD */
32984046
3299− adap->params.nports = hweight32(port_vec);
3300− adap->params.portvec = port_vec;
3301− adap->flags |= FW_OK;
3302−
3303− /* These are finalized by FW initialization, load their values now */
4047+ /*
4048+ * These are finalized by FW initialization, load their values now.
4049+ */
33044050 v = t4_read_reg(adap, TP_TIMER_RESOLUTION);
33054051 adap->params.tp.tre = TIMERRESOLUTION_GET(v);
4052+ adap->params.tp.dack_re = DELAYEDACKRESOLUTION_GET(v);
33064053 t4_read_mtu_tbl(adap, adap->params.mtus, NULL);
33074054 t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd,
33084055 adap->params.b_wnd);
33094056
3310−#ifdef CONFIG_PCI_IOV
3311− /*
3312− * Provision resource limits for Virtual Functions. We currently
3313− * grant them all the same static resource limits except for the Port
3314− * Access Rights Mask which we're assigning based on the PF. All of
3315− * the static provisioning stuff for both the PF and VF really needs
3316− * to be managed in a persistent manner for each device which the
3317− * firmware controls.
3318− */
3319− {
3320− int pf, vf;
3321−
3322− for (pf = 0; pf < ARRAY_SIZE(num_vf); pf++) {
3323− if (num_vf[pf] <= 0)
3324− continue;
4057+ /* MODQ_REQ_MAP defaults to setting queues 0-3 to chan 0-3 */
4058+ for (j = 0; j < NCHAN; j++)
4059+ adap->params.tp.tx_modq[j] = j;
33254060
3326− /* VF numbering starts at 1! */
3327− for (vf = 1; vf <= num_vf[pf]; vf++) {
3328− ret = t4_cfg_pfvf(adap, adap->fn, pf, vf,
3329− VFRES_NEQ, VFRES_NETHCTRL,
3330− VFRES_NIQFLINT, VFRES_NIQ,
3331− VFRES_TC, VFRES_NVI,
3332− FW_PFVF_CMD_CMASK_MASK,
3333− pfvfres_pmask(adap, pf, vf),
3334− VFRES_NEXACTF,
3335− VFRES_R_CAPS, VFRES_WX_CAPS);
3336− if (ret < 0)
3337− dev_warn(adap->pdev_dev, "failed to "
3338− "provision pf/vf=%d/%d; "
3339− "err=%d\n", pf, vf, ret);
3340− }
3341− }
3342− }
3343−#endif
3344−
3345− setup_memwin(adap);
4061+ adap->flags |= FW_OK;
33464062 return 0;
33474063
33484064 /*
3349− * If a command timed out or failed with EIO FW does not operate within
3350− * its spec or something catastrophic happened to HW/FW, stop issuing
3351− * commands.
4065+ * Something bad happened. If a command timed out or failed with EIO
4066+ * FW does not operate within its spec or something catastrophic
4067+ * happened to HW/FW, stop issuing commands.
33524068 */
3353−bye: if (ret != -ETIMEDOUT && ret != -EIO)
3354− t4_fw_bye(adap, adap->fn);
4069+bye:
4070+ if (ret != -ETIMEDOUT && ret != -EIO)
4071+ t4_fw_bye(adap, adap->mbox);
33554072 return ret;
33564073 }
33574074
@@ -3806,7 +4523,9 @@ static int __devinit init_one(struct pci_dev *pdev, · 448 unmodified lines
38064523 err = t4_prep_adapter(adapter);
38074524 if (err)
38084525 goto out_unmap_bar;
4526+ setup_memwin(adapter);
38094527 err = adap_init0(adapter);
4528+ setup_memwin_rdma(adapter);
38104529 if (err)
38114530 goto out_unmap_bar;
38124531
@@ -3948,8 +4667,11 @@ static void __devexit remove_one(struct pci_dev *pdev) · 135 unmodified lines
39484667 {
39494668 struct adapter *adapter = pci_get_drvdata(pdev);
39504669
4670+#ifdef CONFIG_PCI_IOV
39514671 pci_disable_sriov(pdev);
39524672
4673+#endif
4674+
39534675 if (adapter) {
39544676 int i;
39554677
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h+2−0
@@ -100,6 +100,8 @@ struct tid_info { · 99 unmodified lines
100100
101101 unsigned int nftids;
102102 unsigned int ftid_base;
103+ unsigned int aftid_base;
104+ unsigned int aftid_end;
103105
104106 spinlock_t atid_lock ____cacheline_aligned_in_smp;
105107 union aopen_entry *afree;
drivers/net/ethernet/chelsio/cxgb4/sge.c+277−64
@@ -68,9 +68,6 @@ · 67 unmodified lines
6868 */
6969 #define RX_PKT_SKB_LEN 512
7070
71−/* Ethernet header padding prepended to RX_PKTs */
72−#define RX_PKT_PAD 2
73−
7471 /*
7572 * Max number of Tx descriptors we clean up at a time. Should be modest as
7673 * freeing skbs isn't cheap and it happens while holding locks. We just need
@@ -137,13 +134,6 @@ · 60 unmodified lines
137134 */
138135 #define MAX_CTRL_WR_LEN SGE_MAX_WR_LEN
139136
140−enum {
141− /* packet alignment in FL buffers */
142− FL_ALIGN = L1_CACHE_BYTES < 32 ? 32 : L1_CACHE_BYTES,
143− /* egress status entry size */
144− STAT_LEN = L1_CACHE_BYTES > 64 ? 128 : 64
145−};
146−
147137 struct tx_sw_desc { /* SW state per Tx descriptor */
148138 struct sk_buff *skb;
149139 struct ulptx_sgl *sgl;
@@ -155,16 +145,57 @@ struct rx_sw_desc { /* SW state per Rx descriptor */ · 5 unmodified lines
155145 };
156146
157147 /*
158− * The low bits of rx_sw_desc.dma_addr have special meaning.
148+ * Rx buffer sizes for "useskbs" Free List buffers (one ingress packet pe skb
149+ * buffer). We currently only support two sizes for 1500- and 9000-byte MTUs.
150+ * We could easily support more but there doesn't seem to be much need for
151+ * that ...
152+ */
153+#define FL_MTU_SMALL 1500
154+#define FL_MTU_LARGE 9000
155+
156+static inline unsigned int fl_mtu_bufsize(struct adapter *adapter,
157+ unsigned int mtu)
158+{
159+ struct sge *s = &adapter->sge;
160+
161+ return ALIGN(s->pktshift + ETH_HLEN + VLAN_HLEN + mtu, s->fl_align);
162+}
163+
164+#define FL_MTU_SMALL_BUFSIZE(adapter) fl_mtu_bufsize(adapter, FL_MTU_SMALL)
165+#define FL_MTU_LARGE_BUFSIZE(adapter) fl_mtu_bufsize(adapter, FL_MTU_LARGE)
166+
167+/*
168+ * Bits 0..3 of rx_sw_desc.dma_addr have special meaning. The hardware uses
169+ * these to specify the buffer size as an index into the SGE Free List Buffer
170+ * Size register array. We also use bit 4, when the buffer has been unmapped
171+ * for DMA, but this is of course never sent to the hardware and is only used
172+ * to prevent double unmappings. All of the above requires that the Free List
173+ * Buffers which we allocate have the bottom 5 bits free (0) -- i.e. are
174+ * 32-byte or or a power of 2 greater in alignment. Since the SGE's minimal
175+ * Free List Buffer alignment is 32 bytes, this works out for us ...
159176 */
160177 enum {
161− RX_LARGE_BUF = 1 << 0, /* buffer is larger than PAGE_SIZE */
162− RX_UNMAPPED_BUF = 1 << 1, /* buffer is not mapped */
178+ RX_BUF_FLAGS = 0x1f, /* bottom five bits are special */
179+ RX_BUF_SIZE = 0x0f, /* bottom three bits are for buf sizes */
180+ RX_UNMAPPED_BUF = 0x10, /* buffer is not mapped */
181+
182+ /*
183+ * XXX We shouldn't depend on being able to use these indices.
184+ * XXX Especially when some other Master PF has initialized the
185+ * XXX adapter or we use the Firmware Configuration File. We
186+ * XXX should really search through the Host Buffer Size register
187+ * XXX array for the appropriately sized buffer indices.
188+ */
189+ RX_SMALL_PG_BUF = 0x0, /* small (PAGE_SIZE) page buffer */
190+ RX_LARGE_PG_BUF = 0x1, /* buffer large (FL_PG_ORDER) page buffer */
191+
192+ RX_SMALL_MTU_BUF = 0x2, /* small MTU buffer */
193+ RX_LARGE_MTU_BUF = 0x3, /* large MTU buffer */
163194 };
164195
165196 static inline dma_addr_t get_buf_addr(const struct rx_sw_desc *d)
166197 {
167− return d->dma_addr & ~(dma_addr_t)(RX_LARGE_BUF | RX_UNMAPPED_BUF);
198+ return d->dma_addr & ~(dma_addr_t)RX_BUF_FLAGS;
168199 }
169200
170201 static inline bool is_buf_mapped(const struct rx_sw_desc *d)
@@ -392,14 +423,35 @@ static inline void reclaim_completed_tx(struct adapter *adap, struct sge_txq *q, · 221 unmodified lines
392423 }
393424 }
394425
395−static inline int get_buf_size(const struct rx_sw_desc *d)
426+static inline int get_buf_size(struct adapter *adapter,
427+ const struct rx_sw_desc *d)
396428 {
397−#if FL_PG_ORDER > 0
398− return (d->dma_addr & RX_LARGE_BUF) ? (PAGE_SIZE << FL_PG_ORDER) :
399− PAGE_SIZE;
400−#else
401− return PAGE_SIZE;
402−#endif
429+ struct sge *s = &adapter->sge;
430+ unsigned int rx_buf_size_idx = d->dma_addr & RX_BUF_SIZE;
431+ int buf_size;
432+
433+ switch (rx_buf_size_idx) {
434+ case RX_SMALL_PG_BUF:
435+ buf_size = PAGE_SIZE;
436+ break;
437+
438+ case RX_LARGE_PG_BUF:
439+ buf_size = PAGE_SIZE << s->fl_pg_order;
440+ break;
441+
442+ case RX_SMALL_MTU_BUF:
443+ buf_size = FL_MTU_SMALL_BUFSIZE(adapter);
444+ break;
445+
446+ case RX_LARGE_MTU_BUF:
447+ buf_size = FL_MTU_LARGE_BUFSIZE(adapter);
448+ break;
449+
450+ default:
451+ BUG_ON(1);
452+ }
453+
454+ return buf_size;
403455 }
404456
405457 /**
@@ -418,7 +470,8 @@ static void free_rx_bufs(struct adapter *adap, struct sge_fl *q, int n) · 12 unmodified lines
418470
419471 if (is_buf_mapped(d))
420472 dma_unmap_page(adap->pdev_dev, get_buf_addr(d),
421− get_buf_size(d), PCI_DMA_FROMDEVICE);
473+ get_buf_size(adap, d),
474+ PCI_DMA_FROMDEVICE);
422475 put_page(d->page);
423476 d->page = NULL;
424477 if (++q->cidx == q->size)
@@ -444,7 +497,7 @@ static void unmap_rx_buf(struct adapter *adap, struct sge_fl *q) · 19 unmodified lines
444497
445498 if (is_buf_mapped(d))
446499 dma_unmap_page(adap->pdev_dev, get_buf_addr(d),
447− get_buf_size(d), PCI_DMA_FROMDEVICE);
500+ get_buf_size(adap, d), PCI_DMA_FROMDEVICE);
448501 d->page = NULL;
449502 if (++q->cidx == q->size)
450503 q->cidx = 0;
@@ -485,6 +538,7 @@ static inline void set_rx_sw_desc(struct rx_sw_desc *sd, struct page *pg, · 34 unmodified lines
485538 static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n,
486539 gfp_t gfp)
487540 {
541+ struct sge *s = &adap->sge;
488542 struct page *pg;
489543 dma_addr_t mapping;
490544 unsigned int cred = q->avail;
@@ -493,25 +547,27 @@ static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n, · 2 unmodified lines
493547
494548 gfp |= __GFP_NOWARN | __GFP_COLD;
495549
496−#if FL_PG_ORDER > 0
550+ if (s->fl_pg_order == 0)
551+ goto alloc_small_pages;
552+
497553 /*
498554 * Prefer large buffers
499555 */
500556 while (n) {
501− pg = alloc_pages(gfp | __GFP_COMP, FL_PG_ORDER);
557+ pg = alloc_pages(gfp | __GFP_COMP, s->fl_pg_order);
502558 if (unlikely(!pg)) {
503559 q->large_alloc_failed++;
504560 break; /* fall back to single pages */
505561 }
506562
507563 mapping = dma_map_page(adap->pdev_dev, pg, 0,
508− PAGE_SIZE << FL_PG_ORDER,
564+ PAGE_SIZE << s->fl_pg_order,
509565 PCI_DMA_FROMDEVICE);
510566 if (unlikely(dma_mapping_error(adap->pdev_dev, mapping))) {
511− __free_pages(pg, FL_PG_ORDER);
567+ __free_pages(pg, s->fl_pg_order);
512568 goto out; /* do not try small pages for this error */
513569 }
514− mapping |= RX_LARGE_BUF;
570+ mapping |= RX_LARGE_PG_BUF;
515571 *d++ = cpu_to_be64(mapping);
516572
517573 set_rx_sw_desc(sd, pg, mapping);
@@ -525,8 +581,8 @@ static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n, · 7 unmodified lines
525581 }
526582 n--;
527583 }
528−#endif
529584
585+alloc_small_pages:
530586 while (n--) {
531587 pg = __skb_alloc_page(gfp, NULL);
532588 if (unlikely(!pg)) {
@@ -769,8 +825,8 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 236 unmodified lines
769825 wmb(); /* write descriptors before telling HW */
770826 spin_lock(&q->db_lock);
771827 if (!q->db_disabled) {
772− t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),
773− V_QID(q->cntxt_id) | V_PIDX(n));
828+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
829+ QID(q->cntxt_id) | PIDX(n));
774830 }
775831 q->db_pidx = q->pidx;
776832 spin_unlock(&q->db_lock);
@@ -1519,6 +1575,8 @@ static noinline int handle_trace_pkt(struct adapter *adap, · 742 unmodified lines
15191575 static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
15201576 const struct cpl_rx_pkt *pkt)
15211577 {
1578+ struct adapter *adapter = rxq->rspq.adap;
1579+ struct sge *s = &adapter->sge;
15221580 int ret;
15231581 struct sk_buff *skb;
15241582
@@ -1529,8 +1587,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, · 4 unmodified lines
15291587 return;
15301588 }
15311589
1532− copy_frags(skb, gl, RX_PKT_PAD);
1533− skb->len = gl->tot_len - RX_PKT_PAD;
1590+ copy_frags(skb, gl, s->pktshift);
1591+ skb->len = gl->tot_len - s->pktshift;
15341592 skb->data_len = skb->len;
15351593 skb->truesize += skb->data_len;
15361594 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -1566,6 +1624,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 29 unmodified lines
15661624 struct sk_buff *skb;
15671625 const struct cpl_rx_pkt *pkt;
15681626 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
1627+ struct sge *s = &q->adap->sge;
15691628
15701629 if (unlikely(*(u8 *)rsp == CPL_TRACE_PKT))
15711630 return handle_trace_pkt(q->adap, si);
@@ -1585,7 +1644,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 13 unmodified lines
15851644 return 0;
15861645 }
15871646
1588− __skb_pull(skb, RX_PKT_PAD); /* remove ethernet header padding */
1647+ __skb_pull(skb, s->pktshift); /* remove ethernet header padding */
15891648 skb->protocol = eth_type_trans(skb, q->netdev);
15901649 skb_record_rx_queue(skb, q->idx);
15911650 if (skb->dev->features & NETIF_F_RXHASH)
@@ -1696,6 +1755,8 @@ static int process_responses(struct sge_rspq *q, int budget) · 104 unmodified lines
16961755 int budget_left = budget;
16971756 const struct rsp_ctrl *rc;
16981757 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
1758+ struct adapter *adapter = q->adap;
1759+ struct sge *s = &adapter->sge;
16991760
17001761 while (likely(budget_left)) {
17011762 rc = (void *)q->cur_desc + (q->iqe_len - sizeof(*rc));
@@ -1722,7 +1783,7 @@ static int process_responses(struct sge_rspq *q, int budget) · 20 unmodified lines
17221783 /* gather packet fragments */
17231784 for (frags = 0, fp = si.frags; ; frags++, fp++) {
17241785 rsd = &rxq->fl.sdesc[rxq->fl.cidx];
1725− bufsz = get_buf_size(rsd);
1786+ bufsz = get_buf_size(adapter, rsd);
17261787 fp->page = rsd->page;
17271788 fp->offset = q->offset;
17281789 fp->size = min(bufsz, len);
@@ -1747,7 +1808,7 @@ static int process_responses(struct sge_rspq *q, int budget) · 18 unmodified lines
17471808 si.nfrags = frags + 1;
17481809 ret = q->handler(q, q->cur_desc, &si);
17491810 if (likely(ret == 0))
1750− q->offset += ALIGN(fp->size, FL_ALIGN);
1811+ q->offset += ALIGN(fp->size, s->fl_align);
17511812 else
17521813 restore_rx_bufs(&si, &rxq->fl, frags);
17531814 } else if (likely(rsp_type == RSP_TYPE_CPL)) {
@@ -1983,6 +2044,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, · 229 unmodified lines
19832044 {
19842045 int ret, flsz = 0;
19852046 struct fw_iq_cmd c;
2047+ struct sge *s = &adap->sge;
19862048 struct port_info *pi = netdev_priv(dev);
19872049
19882050 /* Size needs to be multiple of 16, including status entry. */
@@ -2015,11 +2077,11 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, · 26 unmodified lines
20152077 fl->size = roundup(fl->size, 8);
20162078 fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64),
20172079 sizeof(struct rx_sw_desc), &fl->addr,
2018− &fl->sdesc, STAT_LEN, NUMA_NO_NODE);
2080+ &fl->sdesc, s->stat_len, NUMA_NO_NODE);
20192081 if (!fl->desc)
20202082 goto fl_nomem;
20212083
2022− flsz = fl->size / 8 + STAT_LEN / sizeof(struct tx_desc);
2084+ flsz = fl->size / 8 + s->stat_len / sizeof(struct tx_desc);
20232085 c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN |
20242086 FW_IQ_CMD_FL0FETCHRO(1) |
20252087 FW_IQ_CMD_FL0DATARO(1) |
@@ -2096,14 +2158,15 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, · 70 unmodified lines
20962158 {
20972159 int ret, nentries;
20982160 struct fw_eq_eth_cmd c;
2161+ struct sge *s = &adap->sge;
20992162 struct port_info *pi = netdev_priv(dev);
21002163
21012164 /* Add status entries */
2102− nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc);
2165+ nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
21032166
21042167 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
21052168 sizeof(struct tx_desc), sizeof(struct tx_sw_desc),
2106− &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN,
2169+ &txq->q.phys_addr, &txq->q.sdesc, s->stat_len,
21072170 netdev_queue_numa_node_read(netdevq));
21082171 if (!txq->q.desc)
21092172 return -ENOMEM;
@@ -2149,10 +2212,11 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, · 39 unmodified lines
21492212 {
21502213 int ret, nentries;
21512214 struct fw_eq_ctrl_cmd c;
2215+ struct sge *s = &adap->sge;
21522216 struct port_info *pi = netdev_priv(dev);
21532217
21542218 /* Add status entries */
2155− nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc);
2219+ nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
21562220
21572221 txq->q.desc = alloc_ring(adap->pdev_dev, nentries,
21582222 sizeof(struct tx_desc), 0, &txq->q.phys_addr,
@@ -2200,14 +2264,15 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, · 41 unmodified lines
22002264 {
22012265 int ret, nentries;
22022266 struct fw_eq_ofld_cmd c;
2267+ struct sge *s = &adap->sge;
22032268 struct port_info *pi = netdev_priv(dev);
22042269
22052270 /* Add status entries */
2206− nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc);
2271+ nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
22072272
22082273 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
22092274 sizeof(struct tx_desc), sizeof(struct tx_sw_desc),
2210− &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN,
2275+ &txq->q.phys_addr, &txq->q.sdesc, s->stat_len,
22112276 NUMA_NO_NODE);
22122277 if (!txq->q.desc)
22132278 return -ENOMEM;
@@ -2251,8 +2316,10 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, · 37 unmodified lines
22512316
22522317 static void free_txq(struct adapter *adap, struct sge_txq *q)
22532318 {
2319+ struct sge *s = &adap->sge;
2320+
22542321 dma_free_coherent(adap->pdev_dev,
2255− q->size * sizeof(struct tx_desc) + STAT_LEN,
2322+ q->size * sizeof(struct tx_desc) + s->stat_len,
22562323 q->desc, q->phys_addr);
22572324 q->cntxt_id = 0;
22582325 q->sdesc = NULL;
@@ -2262,6 +2329,7 @@ static void free_txq(struct adapter *adap, struct sge_txq *q) · 3 unmodified lines
22622329 static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq,
22632330 struct sge_fl *fl)
22642331 {
2332+ struct sge *s = &adap->sge;
22652333 unsigned int fl_id = fl ? fl->cntxt_id : 0xffff;
22662334
22672335 adap->sge.ingr_map[rq->cntxt_id - adap->sge.ingr_start] = NULL;
@@ -2276,7 +2344,7 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, · 8 unmodified lines
22762344
22772345 if (fl) {
22782346 free_rx_bufs(adap, fl, fl->avail);
2279− dma_free_coherent(adap->pdev_dev, fl->size * 8 + STAT_LEN,
2347+ dma_free_coherent(adap->pdev_dev, fl->size * 8 + s->stat_len,
22802348 fl->desc, fl->addr);
22812349 kfree(fl->sdesc);
22822350 fl->sdesc = NULL;
@@ -2408,18 +2476,112 @@ void t4_sge_stop(struct adapter *adap) · 125 unmodified lines
24082476 * Performs SGE initialization needed every time after a chip reset.
24092477 * We do not initialize any of the queues here, instead the driver
24102478 * top-level must request them individually.
2479+ *
2480+ * Called in two different modes:
2481+ *
2482+ * 1. Perform actual hardware initialization and record hard-coded
2483+ * parameters which were used. This gets used when we're the
2484+ * Master PF and the Firmware Configuration File support didn't
2485+ * work for some reason.
2486+ *
2487+ * 2. We're not the Master PF or initialization was performed with
2488+ * a Firmware Configuration File. In this case we need to grab
2489+ * any of the SGE operating parameters that we need to have in
2490+ * order to do our job and make sure we can live with them ...
24112491 */
2412−void t4_sge_init(struct adapter *adap)
2492+
2493+static int t4_sge_init_soft(struct adapter *adap)
24132494 {
2414− unsigned int i, v;
24152495 struct sge *s = &adap->sge;
2416− unsigned int fl_align_log = ilog2(FL_ALIGN);
2496+ u32 fl_small_pg, fl_large_pg, fl_small_mtu, fl_large_mtu;
2497+ u32 timer_value_0_and_1, timer_value_2_and_3, timer_value_4_and_5;
2498+ u32 ingress_rx_threshold;
24172499
2418− t4_set_reg_field(adap, SGE_CONTROL, PKTSHIFT_MASK |
2419− INGPADBOUNDARY_MASK | EGRSTATUSPAGESIZE,
2420− INGPADBOUNDARY(fl_align_log - 5) | PKTSHIFT(2) |
2421− RXPKTCPLMODE |
2422− (STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0));
2500+ /*
2501+ * Verify that CPL messages are going to the Ingress Queue for
2502+ * process_responses() and that only packet data is going to the
2503+ * Free Lists.
2504+ */
2505+ if ((t4_read_reg(adap, SGE_CONTROL) & RXPKTCPLMODE_MASK) !=
2506+ RXPKTCPLMODE(X_RXPKTCPLMODE_SPLIT)) {
2507+ dev_err(adap->pdev_dev, "bad SGE CPL MODE\n");
2508+ return -EINVAL;
2509+ }
2510+
2511+ /*
2512+ * Validate the Host Buffer Register Array indices that we want to
2513+ * use ...
2514+ *
2515+ * XXX Note that we should really read through the Host Buffer Size
2516+ * XXX register array and find the indices of the Buffer Sizes which
2517+ * XXX meet our needs!
2518+ */
2519+ #define READ_FL_BUF(x) \
2520+ t4_read_reg(adap, SGE_FL_BUFFER_SIZE0+(x)*sizeof(u32))
2521+
2522+ fl_small_pg = READ_FL_BUF(RX_SMALL_PG_BUF);
2523+ fl_large_pg = READ_FL_BUF(RX_LARGE_PG_BUF);
2524+ fl_small_mtu = READ_FL_BUF(RX_SMALL_MTU_BUF);
2525+ fl_large_mtu = READ_FL_BUF(RX_LARGE_MTU_BUF);
2526+
2527+ #undef READ_FL_BUF
2528+
2529+ if (fl_small_pg != PAGE_SIZE ||
2530+ (fl_large_pg != 0 && (fl_large_pg <= fl_small_pg ||
2531+ (fl_large_pg & (fl_large_pg-1)) != 0))) {
2532+ dev_err(adap->pdev_dev, "bad SGE FL page buffer sizes [%d, %d]\n",
2533+ fl_small_pg, fl_large_pg);
2534+ return -EINVAL;
2535+ }
2536+ if (fl_large_pg)
2537+ s->fl_pg_order = ilog2(fl_large_pg) - PAGE_SHIFT;
2538+
2539+ if (fl_small_mtu < FL_MTU_SMALL_BUFSIZE(adap) ||
2540+ fl_large_mtu < FL_MTU_LARGE_BUFSIZE(adap)) {
2541+ dev_err(adap->pdev_dev, "bad SGE FL MTU sizes [%d, %d]\n",
2542+ fl_small_mtu, fl_large_mtu);
2543+ return -EINVAL;
2544+ }
2545+
2546+ /*
2547+ * Retrieve our RX interrupt holdoff timer values and counter
2548+ * threshold values from the SGE parameters.
2549+ */
2550+ timer_value_0_and_1 = t4_read_reg(adap, SGE_TIMER_VALUE_0_AND_1);
2551+ timer_value_2_and_3 = t4_read_reg(adap, SGE_TIMER_VALUE_2_AND_3);
2552+ timer_value_4_and_5 = t4_read_reg(adap, SGE_TIMER_VALUE_4_AND_5);
2553+ s->timer_val[0] = core_ticks_to_us(adap,
2554+ TIMERVALUE0_GET(timer_value_0_and_1));
2555+ s->timer_val[1] = core_ticks_to_us(adap,
2556+ TIMERVALUE1_GET(timer_value_0_and_1));
2557+ s->timer_val[2] = core_ticks_to_us(adap,
2558+ TIMERVALUE2_GET(timer_value_2_and_3));
2559+ s->timer_val[3] = core_ticks_to_us(adap,
2560+ TIMERVALUE3_GET(timer_value_2_and_3));
2561+ s->timer_val[4] = core_ticks_to_us(adap,
2562+ TIMERVALUE4_GET(timer_value_4_and_5));
2563+ s->timer_val[5] = core_ticks_to_us(adap,
2564+ TIMERVALUE5_GET(timer_value_4_and_5));
2565+
2566+ ingress_rx_threshold = t4_read_reg(adap, SGE_INGRESS_RX_THRESHOLD);
2567+ s->counter_val[0] = THRESHOLD_0_GET(ingress_rx_threshold);
2568+ s->counter_val[1] = THRESHOLD_1_GET(ingress_rx_threshold);
2569+ s->counter_val[2] = THRESHOLD_2_GET(ingress_rx_threshold);
2570+ s->counter_val[3] = THRESHOLD_3_GET(ingress_rx_threshold);
2571+
2572+ return 0;
2573+}
2574+
2575+static int t4_sge_init_hard(struct adapter *adap)
2576+{
2577+ struct sge *s = &adap->sge;
2578+
2579+ /*
2580+ * Set up our basic SGE mode to deliver CPL messages to our Ingress
2581+ * Queue and Packet Date to the Free List.
2582+ */
2583+ t4_set_reg_field(adap, SGE_CONTROL, RXPKTCPLMODE_MASK,
2584+ RXPKTCPLMODE_MASK);
24232585
24242586 /*
24252587 * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows
@@ -2433,13 +2595,24 @@ void t4_sge_init(struct adapter *adap) · 7 unmodified lines
24332595 t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_ENABLE_DROP,
24342596 F_ENABLE_DROP);
24352597
2436− for (i = v = 0; i < 32; i += 4)
2437− v |= (PAGE_SHIFT - 10) << i;
2438− t4_write_reg(adap, SGE_HOST_PAGE_SIZE, v);
2439− t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, PAGE_SIZE);
2440−#if FL_PG_ORDER > 0
2441− t4_write_reg(adap, SGE_FL_BUFFER_SIZE1, PAGE_SIZE << FL_PG_ORDER);
2442−#endif
2598+ /*
2599+ * SGE_FL_BUFFER_SIZE0 (RX_SMALL_PG_BUF) is set up by
2600+ * t4_fixup_host_params().
2601+ */
2602+ s->fl_pg_order = FL_PG_ORDER;
2603+ if (s->fl_pg_order)
2604+ t4_write_reg(adap,
2605+ SGE_FL_BUFFER_SIZE0+RX_LARGE_PG_BUF*sizeof(u32),
2606+ PAGE_SIZE << FL_PG_ORDER);
2607+ t4_write_reg(adap, SGE_FL_BUFFER_SIZE0+RX_SMALL_MTU_BUF*sizeof(u32),
2608+ FL_MTU_SMALL_BUFSIZE(adap));
2609+ t4_write_reg(adap, SGE_FL_BUFFER_SIZE0+RX_LARGE_MTU_BUF*sizeof(u32),
2610+ FL_MTU_LARGE_BUFSIZE(adap));
2611+
2612+ /*
2613+ * Note that the SGE Ingress Packet Count Interrupt Threshold and
2614+ * Timer Holdoff values must be supplied by our caller.
2615+ */
24432616 t4_write_reg(adap, SGE_INGRESS_RX_THRESHOLD,
24442617 THRESHOLD_0(s->counter_val[0]) |
24452618 THRESHOLD_1(s->counter_val[1]) |
@@ -2449,14 +2622,54 @@ void t4_sge_init(struct adapter *adap) · 3 unmodified lines
24492622 TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[0])) |
24502623 TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[1])));
24512624 t4_write_reg(adap, SGE_TIMER_VALUE_2_AND_3,
2452− TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[2])) |
2453− TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[3])));
2625+ TIMERVALUE2(us_to_core_ticks(adap, s->timer_val[2])) |
2626+ TIMERVALUE3(us_to_core_ticks(adap, s->timer_val[3])));
24542627 t4_write_reg(adap, SGE_TIMER_VALUE_4_AND_5,
2455− TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[4])) |
2456− TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[5])));
2628+ TIMERVALUE4(us_to_core_ticks(adap, s->timer_val[4])) |
2629+ TIMERVALUE5(us_to_core_ticks(adap, s->timer_val[5])));
2630+
2631+ return 0;
2632+}
2633+
2634+int t4_sge_init(struct adapter *adap)
2635+{
2636+ struct sge *s = &adap->sge;
2637+ u32 sge_control;
2638+ int ret;
2639+
2640+ /*
2641+ * Ingress Padding Boundary and Egress Status Page Size are set up by
2642+ * t4_fixup_host_params().
2643+ */
2644+ sge_control = t4_read_reg(adap, SGE_CONTROL);
2645+ s->pktshift = PKTSHIFT_GET(sge_control);
2646+ s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64;
2647+ s->fl_align = 1 << (INGPADBOUNDARY_GET(sge_control) +
2648+ X_INGPADBOUNDARY_SHIFT);
2649+
2650+ if (adap->flags & USING_SOFT_PARAMS)
2651+ ret = t4_sge_init_soft(adap);
2652+ else
2653+ ret = t4_sge_init_hard(adap);
2654+ if (ret < 0)
2655+ return ret;
2656+
2657+ /*
2658+ * A FL with <= fl_starve_thres buffers is starving and a periodic
2659+ * timer will attempt to refill it. This needs to be larger than the
2660+ * SGE's Egress Congestion Threshold. If it isn't, then we can get
2661+ * stuck waiting for new packets while the SGE is waiting for us to
2662+ * give it more Free List entries. (Note that the SGE's Egress
2663+ * Congestion Threshold is in units of 2 Free List pointers.)
2664+ */
2665+ s->fl_starve_thres
2666+ = EGRTHRESHOLD_GET(t4_read_reg(adap, SGE_CONM_CTRL))*2 + 1;
2667+
24572668 setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap);
24582669 setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adap);
24592670 s->starve_thres = core_ticks_per_usec(adap) * 1000000; /* 1 s */
24602671 s->idma_state[0] = s->idma_state[1] = 0;
24612672 spin_lock_init(&s->intrq_lock);
2673+
2674+ return 0;
24622675 }
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+705−29
@@ -120,6 +120,28 @@ static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, · 119 unmodified lines
120120 }
121121 }
122122
123+/**
124+ * t4_write_indirect - write indirectly addressed registers
125+ * @adap: the adapter
126+ * @addr_reg: register holding the indirect addresses
127+ * @data_reg: register holding the value for the indirect registers
128+ * @vals: values to write
129+ * @nregs: how many indirect registers to write
130+ * @start_idx: address of first indirect register to write
131+ *
132+ * Writes a sequential block of registers that are accessed indirectly
133+ * through an address/data register pair.
134+ */
135+void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
136+ unsigned int data_reg, const u32 *vals,
137+ unsigned int nregs, unsigned int start_idx)
138+{
139+ while (nregs--) {
140+ t4_write_reg(adap, addr_reg, start_idx++);
141+ t4_write_reg(adap, data_reg, *vals++);
142+ }
143+}
144+
123145 /*
124146 * Get the reply to a mailbox command and store it in @rpl in big-endian order.
125147 */
@@ -330,6 +352,143 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) · 204 unmodified lines
330352 return 0;
331353 }
332354
355+/*
356+ * t4_mem_win_rw - read/write memory through PCIE memory window
357+ * @adap: the adapter
358+ * @addr: address of first byte requested
359+ * @data: MEMWIN0_APERTURE bytes of data containing the requested address
360+ * @dir: direction of transfer 1 => read, 0 => write
361+ *
362+ * Read/write MEMWIN0_APERTURE bytes of data from MC starting at a
363+ * MEMWIN0_APERTURE-byte-aligned address that covers the requested
364+ * address @addr.
365+ */
366+static int t4_mem_win_rw(struct adapter *adap, u32 addr, __be32 *data, int dir)
367+{
368+ int i;
369+
370+ /*
371+ * Setup offset into PCIE memory window. Address must be a
372+ * MEMWIN0_APERTURE-byte-aligned address. (Read back MA register to
373+ * ensure that changes propagate before we attempt to use the new
374+ * values.)
375+ */
376+ t4_write_reg(adap, PCIE_MEM_ACCESS_OFFSET,
377+ addr & ~(MEMWIN0_APERTURE - 1));
378+ t4_read_reg(adap, PCIE_MEM_ACCESS_OFFSET);
379+
380+ /* Collecting data 4 bytes at a time upto MEMWIN0_APERTURE */
381+ for (i = 0; i < MEMWIN0_APERTURE; i = i+0x4) {
382+ if (dir)
383+ *data++ = t4_read_reg(adap, (MEMWIN0_BASE + i));
384+ else
385+ t4_write_reg(adap, (MEMWIN0_BASE + i), *data++);
386+ }
387+
388+ return 0;
389+}
390+
391+/**
392+ * t4_memory_rw - read/write EDC 0, EDC 1 or MC via PCIE memory window
393+ * @adap: the adapter
394+ * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC
395+ * @addr: address within indicated memory type
396+ * @len: amount of memory to transfer
397+ * @buf: host memory buffer
398+ * @dir: direction of transfer 1 => read, 0 => write
399+ *
400+ * Reads/writes an [almost] arbitrary memory region in the firmware: the
401+ * firmware memory address, length and host buffer must be aligned on
402+ * 32-bit boudaries. The memory is transferred as a raw byte sequence
403+ * from/to the firmware's memory. If this memory contains data
404+ * structures which contain multi-byte integers, it's the callers
405+ * responsibility to perform appropriate byte order conversions.
406+ */
407+static int t4_memory_rw(struct adapter *adap, int mtype, u32 addr, u32 len,
408+ __be32 *buf, int dir)
409+{
410+ u32 pos, start, end, offset, memoffset;
411+ int ret;
412+
413+ /*
414+ * Argument sanity checks ...
415+ */
416+ if ((addr & 0x3) || (len & 0x3))
417+ return -EINVAL;
418+
419+ /*
420+ * Offset into the region of memory which is being accessed
421+ * MEM_EDC0 = 0
422+ * MEM_EDC1 = 1
423+ * MEM_MC = 2
424+ */
425+ memoffset = (mtype * (5 * 1024 * 1024));
426+
427+ /* Determine the PCIE_MEM_ACCESS_OFFSET */
428+ addr = addr + memoffset;
429+
430+ /*
431+ * The underlaying EDC/MC read routines read MEMWIN0_APERTURE bytes
432+ * at a time so we need to round down the start and round up the end.
433+ * We'll start copying out of the first line at (addr - start) a word
434+ * at a time.
435+ */
436+ start = addr & ~(MEMWIN0_APERTURE-1);
437+ end = (addr + len + MEMWIN0_APERTURE-1) & ~(MEMWIN0_APERTURE-1);
438+ offset = (addr - start)/sizeof(__be32);
439+
440+ for (pos = start; pos < end; pos += MEMWIN0_APERTURE, offset = 0) {
441+ __be32 data[MEMWIN0_APERTURE/sizeof(__be32)];
442+
443+ /*
444+ * If we're writing, copy the data from the caller's memory
445+ * buffer
446+ */
447+ if (!dir) {
448+ /*
449+ * If we're doing a partial write, then we need to do
450+ * a read-modify-write ...
451+ */
452+ if (offset || len < MEMWIN0_APERTURE) {
453+ ret = t4_mem_win_rw(adap, pos, data, 1);
454+ if (ret)
455+ return ret;
456+ }
457+ while (offset < (MEMWIN0_APERTURE/sizeof(__be32)) &&
458+ len > 0) {
459+ data[offset++] = *buf++;
460+ len -= sizeof(__be32);
461+ }
462+ }
463+
464+ /*
465+ * Transfer a block of memory and bail if there's an error.
466+ */
467+ ret = t4_mem_win_rw(adap, pos, data, dir);
468+ if (ret)
469+ return ret;
470+
471+ /*
472+ * If we're reading, copy the data into the caller's memory
473+ * buffer.
474+ */
475+ if (dir)
476+ while (offset < (MEMWIN0_APERTURE/sizeof(__be32)) &&
477+ len > 0) {
478+ *buf++ = data[offset++];
479+ len -= sizeof(__be32);
480+ }
481+ }
482+
483+ return 0;
484+}
485+
486+int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
487+ __be32 *buf)
488+{
489+ return t4_memory_rw(adap, mtype, addr, len, buf, 0);
490+}
491+
333492 #define EEPROM_STAT_ADDR 0x7bfc
334493 #define VPD_BASE 0
335494 #define VPD_LEN 512
@@ -355,8 +514,9 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) · 19 unmodified lines
355514 *
356515 * Reads card parameters stored in VPD EEPROM.
357516 */
358−static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
517+int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
359518 {
519+ u32 cclk_param, cclk_val;
360520 int i, ret;
361521 int ec, sn;
362522 u8 vpd[VPD_LEN], csum;
@@ -418,6 +578,19 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) · 55 unmodified lines
418578 i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE);
419579 memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN));
420580 strim(p->sn);
581+
582+ /*
583+ * Ask firmware for the Core Clock since it knows how to translate the
584+ * Reference Clock ('V2') VPD field into a Core Clock value ...
585+ */
586+ cclk_param = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
587+ FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_CCLK));
588+ ret = t4_query_params(adapter, adapter->mbox, 0, 0,
589+ 1, &cclk_param, &cclk_val);
590+ if (ret)
591+ return ret;
592+ p->cclk = cclk_val;
593+
421594 return 0;
422595 }
423596
@@ -717,6 +890,77 @@ static int t4_flash_erase_sectors(struct adapter *adapter, int start, int end) · 293 unmodified lines
717890 return ret;
718891 }
719892
893+/**
894+ * t4_flash_cfg_addr - return the address of the flash configuration file
895+ * @adapter: the adapter
896+ *
897+ * Return the address within the flash where the Firmware Configuration
898+ * File is stored.
899+ */
900+unsigned int t4_flash_cfg_addr(struct adapter *adapter)
901+{
902+ if (adapter->params.sf_size == 0x100000)
903+ return FLASH_FPGA_CFG_START;
904+ else
905+ return FLASH_CFG_START;
906+}
907+
908+/**
909+ * t4_load_cfg - download config file
910+ * @adap: the adapter
911+ * @cfg_data: the cfg text file to write
912+ * @size: text file size
913+ *
914+ * Write the supplied config text file to the card's serial flash.
915+ */
916+int t4_load_cfg(struct adapter *adap, const u8 *cfg_data, unsigned int size)
917+{
918+ int ret, i, n;
919+ unsigned int addr;
920+ unsigned int flash_cfg_start_sec;
921+ unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec;
922+
923+ addr = t4_flash_cfg_addr(adap);
924+ flash_cfg_start_sec = addr / SF_SEC_SIZE;
925+
926+ if (size > FLASH_CFG_MAX_SIZE) {
927+ dev_err(adap->pdev_dev, "cfg file too large, max is %u bytes\n",
928+ FLASH_CFG_MAX_SIZE);
929+ return -EFBIG;
930+ }
931+
932+ i = DIV_ROUND_UP(FLASH_CFG_MAX_SIZE, /* # of sectors spanned */
933+ sf_sec_size);
934+ ret = t4_flash_erase_sectors(adap, flash_cfg_start_sec,
935+ flash_cfg_start_sec + i - 1);
936+ /*
937+ * If size == 0 then we're simply erasing the FLASH sectors associated
938+ * with the on-adapter Firmware Configuration File.
939+ */
940+ if (ret || size == 0)
941+ goto out;
942+
943+ /* this will write to the flash up to SF_PAGE_SIZE at a time */
944+ for (i = 0; i < size; i += SF_PAGE_SIZE) {
945+ if ((size - i) < SF_PAGE_SIZE)
946+ n = size - i;
947+ else
948+ n = SF_PAGE_SIZE;
949+ ret = t4_write_flash(adap, addr, n, cfg_data);
950+ if (ret)
951+ goto out;
952+
953+ addr += SF_PAGE_SIZE;
954+ cfg_data += SF_PAGE_SIZE;
955+ }
956+
957+out:
958+ if (ret)
959+ dev_err(adap->pdev_dev, "config file %s failed %d\n",
960+ (size == 0 ? "clear" : "download"), ret);
961+ return ret;
962+}
963+
720964 /**
721965 * t4_load_fw - download firmware
722966 * @adap: the adapter
@@ -1018,9 +1262,9 @@ static void sge_intr_handler(struct adapter *adapter) · 295 unmodified lines
10181262 { ERR_INVALID_CIDX_INC,
10191263 "SGE GTS CIDX increment too large", -1, 0 },
10201264 { ERR_CPL_OPCODE_0, "SGE received 0-length CPL", -1, 0 },
1021− { F_DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },
1022− { F_DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },
1023− { F_ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },
1265+ { DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },
1266+ { DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },
1267+ { ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },
10241268 { ERR_DATA_CPL_ON_HIGH_QID1 | ERR_DATA_CPL_ON_HIGH_QID0,
10251269 "SGE IQID > 1023 received CPL for FL", -1, 0 },
10261270 { ERR_BAD_DB_PIDX3, "SGE DBP 3 pidx increment too large", -1,
@@ -1520,7 +1764,7 @@ void t4_intr_enable(struct adapter *adapter) · 493 unmodified lines
15201764 ERR_BAD_DB_PIDX2 | ERR_BAD_DB_PIDX1 |
15211765 ERR_BAD_DB_PIDX0 | ERR_ING_CTXT_PRIO |
15221766 ERR_EGR_CTXT_PRIO | INGRESS_SIZE_ERR |
1523− F_DBFIFO_HP_INT | F_DBFIFO_LP_INT |
1767+ DBFIFO_HP_INT | DBFIFO_LP_INT |
15241768 EGRESS_SIZE_ERR);
15251769 t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE), PF_INTR_MASK);
15261770 t4_set_reg_field(adapter, PL_INT_MAP0, 0, 1 << pf);
@@ -1716,6 +1960,23 @@ void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log) · 189 unmodified lines
17161960 }
17171961 }
17181962
1963+/**
1964+ * t4_tp_wr_bits_indirect - set/clear bits in an indirect TP register
1965+ * @adap: the adapter
1966+ * @addr: the indirect TP register address
1967+ * @mask: specifies the field within the register to modify
1968+ * @val: new value for the field
1969+ *
1970+ * Sets a field of an indirect TP register to the given value.
1971+ */
1972+void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
1973+ unsigned int mask, unsigned int val)
1974+{
1975+ t4_write_reg(adap, TP_PIO_ADDR, addr);
1976+ val |= t4_read_reg(adap, TP_PIO_DATA) & ~mask;
1977+ t4_write_reg(adap, TP_PIO_DATA, val);
1978+}
1979+
17191980 /**
17201981 * init_cong_ctrl - initialize congestion control parameters
17211982 * @a: the alpha values for congestion control
@@ -2000,9 +2261,9 @@ int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, · 278 unmodified lines
20002261 struct fw_ldst_cmd c;
20012262
20022263 memset(&c, 0, sizeof(c));
2003− c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST |
2004− F_FW_CMD_WRITE |
2005− V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FIRMWARE));
2264+ c.op_to_addrspace = htonl(FW_CMD_OP(FW_LDST_CMD) | FW_CMD_REQUEST |
2265+ FW_CMD_WRITE |
2266+ FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FIRMWARE));
20062267 c.cycles_to_len16 = htonl(FW_LEN16(c));
20072268 c.u.addrval.addr = htonl(addr);
20082269 c.u.addrval.val = htonl(val);
@@ -2033,8 +2294,8 @@ int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len) · 24 unmodified lines
20332294 if ((addr & 3) || (len + off) > MEMWIN0_APERTURE)
20342295 return -EINVAL;
20352296
2036− t4_write_reg(adap, A_PCIE_MEM_ACCESS_OFFSET, addr & ~15);
2037− t4_read_reg(adap, A_PCIE_MEM_ACCESS_OFFSET);
2297+ t4_write_reg(adap, PCIE_MEM_ACCESS_OFFSET, addr & ~15);
2298+ t4_read_reg(adap, PCIE_MEM_ACCESS_OFFSET);
20382299
20392300 for (i = 0; i < len; i += 4)
20402301 *data++ = t4_read_reg(adap, (MEMWIN0_BASE + off + i));
@@ -2102,39 +2363,129 @@ int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, · 61 unmodified lines
21022363 }
21032364
21042365 /**
2105− * t4_fw_hello - establish communication with FW
2106− * @adap: the adapter
2107− * @mbox: mailbox to use for the FW command
2108− * @evt_mbox: mailbox to receive async FW events
2109− * @master: specifies the caller's willingness to be the device master
2110− * @state: returns the current device state
2366+ * t4_fw_hello - establish communication with FW
2367+ * @adap: the adapter
2368+ * @mbox: mailbox to use for the FW command
2369+ * @evt_mbox: mailbox to receive async FW events
2370+ * @master: specifies the caller's willingness to be the device master
2371+ * @state: returns the current device state (if non-NULL)
21112372 *
2112− * Issues a command to establish communication with FW.
2373+ * Issues a command to establish communication with FW. Returns either
2374+ * an error (negative integer) or the mailbox of the Master PF.
21132375 */
21142376 int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,
21152377 enum dev_master master, enum dev_state *state)
21162378 {
21172379 int ret;
21182380 struct fw_hello_cmd c;
2381+ u32 v;
2382+ unsigned int master_mbox;
2383+ int retries = FW_CMD_HELLO_RETRIES;
21192384
2385+retry:
2386+ memset(&c, 0, sizeof(c));
21202387 INIT_CMD(c, HELLO, WRITE);
21212388 c.err_to_mbasyncnot = htonl(
21222389 FW_HELLO_CMD_MASTERDIS(master == MASTER_CANT) |
21232390 FW_HELLO_CMD_MASTERFORCE(master == MASTER_MUST) |
2124− FW_HELLO_CMD_MBMASTER(master == MASTER_MUST ? mbox : 0xff) |
2125− FW_HELLO_CMD_MBASYNCNOT(evt_mbox));
2391+ FW_HELLO_CMD_MBMASTER(master == MASTER_MUST ? mbox :
2392+ FW_HELLO_CMD_MBMASTER_MASK) |
2393+ FW_HELLO_CMD_MBASYNCNOT(evt_mbox) |
2394+ FW_HELLO_CMD_STAGE(fw_hello_cmd_stage_os) |
2395+ FW_HELLO_CMD_CLEARINIT);
21262396
2397+ /*
2398+ * Issue the HELLO command to the firmware. If it's not successful
2399+ * but indicates that we got a "busy" or "timeout" condition, retry
2400+ * the HELLO until we exhaust our retry limit.
2401+ */
21272402 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
2128− if (ret == 0 && state) {
2129− u32 v = ntohl(c.err_to_mbasyncnot);
2130− if (v & FW_HELLO_CMD_INIT)
2131− *state = DEV_STATE_INIT;
2132− else if (v & FW_HELLO_CMD_ERR)
2403+ if (ret < 0) {
2404+ if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0)
2405+ goto retry;
2406+ return ret;
2407+ }
2408+
2409+ v = ntohl(c.err_to_mbasyncnot);
2410+ master_mbox = FW_HELLO_CMD_MBMASTER_GET(v);
2411+ if (state) {
2412+ if (v & FW_HELLO_CMD_ERR)
21332413 *state = DEV_STATE_ERR;
2414+ else if (v & FW_HELLO_CMD_INIT)
2415+ *state = DEV_STATE_INIT;
21342416 else
21352417 *state = DEV_STATE_UNINIT;
21362418 }
2137− return ret;
2419+
2420+ /*
2421+ * If we're not the Master PF then we need to wait around for the
2422+ * Master PF Driver to finish setting up the adapter.
2423+ *
2424+ * Note that we also do this wait if we're a non-Master-capable PF and
2425+ * there is no current Master PF; a Master PF may show up momentarily
2426+ * and we wouldn't want to fail pointlessly. (This can happen when an
2427+ * OS loads lots of different drivers rapidly at the same time). In
2428+ * this case, the Master PF returned by the firmware will be
2429+ * FW_PCIE_FW_MASTER_MASK so the test below will work ...
2430+ */
2431+ if ((v & (FW_HELLO_CMD_ERR|FW_HELLO_CMD_INIT)) == 0 &&
2432+ master_mbox != mbox) {
2433+ int waiting = FW_CMD_HELLO_TIMEOUT;
2434+
2435+ /*
2436+ * Wait for the firmware to either indicate an error or
2437+ * initialized state. If we see either of these we bail out
2438+ * and report the issue to the caller. If we exhaust the
2439+ * "hello timeout" and we haven't exhausted our retries, try
2440+ * again. Otherwise bail with a timeout error.
2441+ */
2442+ for (;;) {
2443+ u32 pcie_fw;
2444+
2445+ msleep(50);
2446+ waiting -= 50;
2447+
2448+ /*
2449+ * If neither Error nor Initialialized are indicated
2450+ * by the firmware keep waiting till we exaust our
2451+ * timeout ... and then retry if we haven't exhausted
2452+ * our retries ...
2453+ */
2454+ pcie_fw = t4_read_reg(adap, MA_PCIE_FW);
2455+ if (!(pcie_fw & (FW_PCIE_FW_ERR|FW_PCIE_FW_INIT))) {
2456+ if (waiting <= 0) {
2457+ if (retries-- > 0)
2458+ goto retry;
2459+
2460+ return -ETIMEDOUT;
2461+ }
2462+ continue;
2463+ }
2464+
2465+ /*
2466+ * We either have an Error or Initialized condition
2467+ * report errors preferentially.
2468+ */
2469+ if (state) {
2470+ if (pcie_fw & FW_PCIE_FW_ERR)
2471+ *state = DEV_STATE_ERR;
2472+ else if (pcie_fw & FW_PCIE_FW_INIT)
2473+ *state = DEV_STATE_INIT;
2474+ }
2475+
2476+ /*
2477+ * If we arrived before a Master PF was selected and
2478+ * there's not a valid Master PF, grab its identity
2479+ * for our caller.
2480+ */
2481+ if (master_mbox == FW_PCIE_FW_MASTER_MASK &&
2482+ (pcie_fw & FW_PCIE_FW_MASTER_VLD))
2483+ master_mbox = FW_PCIE_FW_MASTER_GET(pcie_fw);
2484+ break;
2485+ }
2486+ }
2487+
2488+ return master_mbox;
21382489 }
21392490
21402491 /**
@@ -2185,6 +2536,334 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset) · 44 unmodified lines
21852536 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
21862537 }
21872538
2539+/**
2540+ * t4_fw_halt - issue a reset/halt to FW and put uP into RESET
2541+ * @adap: the adapter
2542+ * @mbox: mailbox to use for the FW RESET command (if desired)
2543+ * @force: force uP into RESET even if FW RESET command fails
2544+ *
2545+ * Issues a RESET command to firmware (if desired) with a HALT indication
2546+ * and then puts the microprocessor into RESET state. The RESET command
2547+ * will only be issued if a legitimate mailbox is provided (mbox <=
2548+ * FW_PCIE_FW_MASTER_MASK).
2549+ *
2550+ * This is generally used in order for the host to safely manipulate the
2551+ * adapter without fear of conflicting with whatever the firmware might
2552+ * be doing. The only way out of this state is to RESTART the firmware
2553+ * ...
2554+ */
2555+int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force)
2556+{
2557+ int ret = 0;
2558+
2559+ /*
2560+ * If a legitimate mailbox is provided, issue a RESET command
2561+ * with a HALT indication.
2562+ */
2563+ if (mbox <= FW_PCIE_FW_MASTER_MASK) {
2564+ struct fw_reset_cmd c;
2565+
2566+ memset(&c, 0, sizeof(c));
2567+ INIT_CMD(c, RESET, WRITE);
2568+ c.val = htonl(PIORST | PIORSTMODE);
2569+ c.halt_pkd = htonl(FW_RESET_CMD_HALT(1U));
2570+ ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
2571+ }
2572+
2573+ /*
2574+ * Normally we won't complete the operation if the firmware RESET
2575+ * command fails but if our caller insists we'll go ahead and put the
2576+ * uP into RESET. This can be useful if the firmware is hung or even
2577+ * missing ... We'll have to take the risk of putting the uP into
2578+ * RESET without the cooperation of firmware in that case.
2579+ *
2580+ * We also force the firmware's HALT flag to be on in case we bypassed
2581+ * the firmware RESET command above or we're dealing with old firmware
2582+ * which doesn't have the HALT capability. This will serve as a flag
2583+ * for the incoming firmware to know that it's coming out of a HALT
2584+ * rather than a RESET ... if it's new enough to understand that ...
2585+ */
2586+ if (ret == 0 || force) {
2587+ t4_set_reg_field(adap, CIM_BOOT_CFG, UPCRST, UPCRST);
2588+ t4_set_reg_field(adap, PCIE_FW, FW_PCIE_FW_HALT,
2589+ FW_PCIE_FW_HALT);
2590+ }
2591+
2592+ /*
2593+ * And we always return the result of the firmware RESET command
2594+ * even when we force the uP into RESET ...
2595+ */
2596+ return ret;
2597+}
2598+
2599+/**
2600+ * t4_fw_restart - restart the firmware by taking the uP out of RESET
2601+ * @adap: the adapter
2602+ * @reset: if we want to do a RESET to restart things
2603+ *
2604+ * Restart firmware previously halted by t4_fw_halt(). On successful
2605+ * return the previous PF Master remains as the new PF Master and there
2606+ * is no need to issue a new HELLO command, etc.
2607+ *
2608+ * We do this in two ways:
2609+ *
2610+ * 1. If we're dealing with newer firmware we'll simply want to take
2611+ * the chip's microprocessor out of RESET. This will cause the
2612+ * firmware to start up from its start vector. And then we'll loop
2613+ * until the firmware indicates it's started again (PCIE_FW.HALT
2614+ * reset to 0) or we timeout.
2615+ *
2616+ * 2. If we're dealing with older firmware then we'll need to RESET
2617+ * the chip since older firmware won't recognize the PCIE_FW.HALT
2618+ * flag and automatically RESET itself on startup.
2619+ */
2620+int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset)
2621+{
2622+ if (reset) {
2623+ /*
2624+ * Since we're directing the RESET instead of the firmware
2625+ * doing it automatically, we need to clear the PCIE_FW.HALT
2626+ * bit.
2627+ */
2628+ t4_set_reg_field(adap, PCIE_FW, FW_PCIE_FW_HALT, 0);
2629+
2630+ /*
2631+ * If we've been given a valid mailbox, first try to get the
2632+ * firmware to do the RESET. If that works, great and we can
2633+ * return success. Otherwise, if we haven't been given a
2634+ * valid mailbox or the RESET command failed, fall back to
2635+ * hitting the chip with a hammer.
2636+ */
2637+ if (mbox <= FW_PCIE_FW_MASTER_MASK) {
2638+ t4_set_reg_field(adap, CIM_BOOT_CFG, UPCRST, 0);
2639+ msleep(100);
2640+ if (t4_fw_reset(adap, mbox,
2641+ PIORST | PIORSTMODE) == 0)
2642+ return 0;
2643+ }
2644+
2645+ t4_write_reg(adap, PL_RST, PIORST | PIORSTMODE);
2646+ msleep(2000);
2647+ } else {
2648+ int ms;
2649+
2650+ t4_set_reg_field(adap, CIM_BOOT_CFG, UPCRST, 0);
2651+ for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) {
2652+ if (!(t4_read_reg(adap, PCIE_FW) & FW_PCIE_FW_HALT))
2653+ return 0;
2654+ msleep(100);
2655+ ms += 100;
2656+ }
2657+ return -ETIMEDOUT;
2658+ }
2659+ return 0;
2660+}
2661+
2662+/**
2663+ * t4_fw_upgrade - perform all of the steps necessary to upgrade FW
2664+ * @adap: the adapter
2665+ * @mbox: mailbox to use for the FW RESET command (if desired)
2666+ * @fw_data: the firmware image to write
2667+ * @size: image size
2668+ * @force: force upgrade even if firmware doesn't cooperate
2669+ *
2670+ * Perform all of the steps necessary for upgrading an adapter's
2671+ * firmware image. Normally this requires the cooperation of the
2672+ * existing firmware in order to halt all existing activities
2673+ * but if an invalid mailbox token is passed in we skip that step
2674+ * (though we'll still put the adapter microprocessor into RESET in
2675+ * that case).
2676+ *
2677+ * On successful return the new firmware will have been loaded and
2678+ * the adapter will have been fully RESET losing all previous setup
2679+ * state. On unsuccessful return the adapter may be completely hosed ...
2680+ * positive errno indicates that the adapter is ~probably~ intact, a
2681+ * negative errno indicates that things are looking bad ...
2682+ */
2683+int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
2684+ const u8 *fw_data, unsigned int size, int force)
2685+{
2686+ const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data;
2687+ int reset, ret;
2688+
2689+ ret = t4_fw_halt(adap, mbox, force);
2690+ if (ret < 0 && !force)
2691+ return ret;
2692+
2693+ ret = t4_load_fw(adap, fw_data, size);
2694+ if (ret < 0)
2695+ return ret;
2696+
2697+ /*
2698+ * Older versions of the firmware don't understand the new
2699+ * PCIE_FW.HALT flag and so won't know to perform a RESET when they
2700+ * restart. So for newly loaded older firmware we'll have to do the
2701+ * RESET for it so it starts up on a clean slate. We can tell if
2702+ * the newly loaded firmware will handle this right by checking
2703+ * its header flags to see if it advertises the capability.
2704+ */
2705+ reset = ((ntohl(fw_hdr->flags) & FW_HDR_FLAGS_RESET_HALT) == 0);
2706+ return t4_fw_restart(adap, mbox, reset);
2707+}
2708+
2709+
2710+/**
2711+ * t4_fw_config_file - setup an adapter via a Configuration File
2712+ * @adap: the adapter
2713+ * @mbox: mailbox to use for the FW command
2714+ * @mtype: the memory type where the Configuration File is located
2715+ * @maddr: the memory address where the Configuration File is located
2716+ * @finiver: return value for CF [fini] version
2717+ * @finicsum: return value for CF [fini] checksum
2718+ * @cfcsum: return value for CF computed checksum
2719+ *
2720+ * Issue a command to get the firmware to process the Configuration
2721+ * File located at the specified mtype/maddress. If the Configuration
2722+ * File is processed successfully and return value pointers are
2723+ * provided, the Configuration File "[fini] section version and
2724+ * checksum values will be returned along with the computed checksum.
2725+ * It's up to the caller to decide how it wants to respond to the
2726+ * checksums not matching but it recommended that a prominant warning
2727+ * be emitted in order to help people rapidly identify changed or
2728+ * corrupted Configuration Files.
2729+ *
2730+ * Also note that it's possible to modify things like "niccaps",
2731+ * "toecaps",etc. between processing the Configuration File and telling
2732+ * the firmware to use the new configuration. Callers which want to
2733+ * do this will need to "hand-roll" their own CAPS_CONFIGS commands for
2734+ * Configuration Files if they want to do this.
2735+ */
2736+int t4_fw_config_file(struct adapter *adap, unsigned int mbox,
2737+ unsigned int mtype, unsigned int maddr,
2738+ u32 *finiver, u32 *finicsum, u32 *cfcsum)
2739+{
2740+ struct fw_caps_config_cmd caps_cmd;
2741+ int ret;
2742+
2743+ /*
2744+ * Tell the firmware to process the indicated Configuration File.
2745+ * If there are no errors and the caller has provided return value
2746+ * pointers for the [fini] section version, checksum and computed
2747+ * checksum, pass those back to the caller.
2748+ */
2749+ memset(&caps_cmd, 0, sizeof(caps_cmd));
2750+ caps_cmd.op_to_write =
2751+ htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
2752+ FW_CMD_REQUEST |
2753+ FW_CMD_READ);
2754+ caps_cmd.retval_len16 =
2755+ htonl(FW_CAPS_CONFIG_CMD_CFVALID |
2756+ FW_CAPS_CONFIG_CMD_MEMTYPE_CF(mtype) |
2757+ FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(maddr >> 16) |
2758+ FW_LEN16(caps_cmd));
2759+ ret = t4_wr_mbox(adap, mbox, &caps_cmd, sizeof(caps_cmd), &caps_cmd);
2760+ if (ret < 0)
2761+ return ret;
2762+
2763+ if (finiver)
2764+ *finiver = ntohl(caps_cmd.finiver);
2765+ if (finicsum)
2766+ *finicsum = ntohl(caps_cmd.finicsum);
2767+ if (cfcsum)
2768+ *cfcsum = ntohl(caps_cmd.cfcsum);
2769+
2770+ /*
2771+ * And now tell the firmware to use the configuration we just loaded.
2772+ */
2773+ caps_cmd.op_to_write =
2774+ htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
2775+ FW_CMD_REQUEST |
2776+ FW_CMD_WRITE);
2777+ caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd));
2778+ return t4_wr_mbox(adap, mbox, &caps_cmd, sizeof(caps_cmd), NULL);
2779+}
2780+
2781+/**
2782+ * t4_fixup_host_params - fix up host-dependent parameters
2783+ * @adap: the adapter
2784+ * @page_size: the host's Base Page Size
2785+ * @cache_line_size: the host's Cache Line Size
2786+ *
2787+ * Various registers in T4 contain values which are dependent on the
2788+ * host's Base Page and Cache Line Sizes. This function will fix all of
2789+ * those registers with the appropriate values as passed in ...
2790+ */
2791+int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
2792+ unsigned int cache_line_size)
2793+{
2794+ unsigned int page_shift = fls(page_size) - 1;
2795+ unsigned int sge_hps = page_shift - 10;
2796+ unsigned int stat_len = cache_line_size > 64 ? 128 : 64;
2797+ unsigned int fl_align = cache_line_size < 32 ? 32 : cache_line_size;
2798+ unsigned int fl_align_log = fls(fl_align) - 1;
2799+
2800+ t4_write_reg(adap, SGE_HOST_PAGE_SIZE,
2801+ HOSTPAGESIZEPF0(sge_hps) |
2802+ HOSTPAGESIZEPF1(sge_hps) |
2803+ HOSTPAGESIZEPF2(sge_hps) |
2804+ HOSTPAGESIZEPF3(sge_hps) |
2805+ HOSTPAGESIZEPF4(sge_hps) |
2806+ HOSTPAGESIZEPF5(sge_hps) |
2807+ HOSTPAGESIZEPF6(sge_hps) |
2808+ HOSTPAGESIZEPF7(sge_hps));
2809+
2810+ t4_set_reg_field(adap, SGE_CONTROL,
2811+ INGPADBOUNDARY(INGPADBOUNDARY_MASK) |
2812+ EGRSTATUSPAGESIZE_MASK,
2813+ INGPADBOUNDARY(fl_align_log - 5) |
2814+ EGRSTATUSPAGESIZE(stat_len != 64));
2815+
2816+ /*
2817+ * Adjust various SGE Free List Host Buffer Sizes.
2818+ *
2819+ * This is something of a crock since we're using fixed indices into
2820+ * the array which are also known by the sge.c code and the T4
2821+ * Firmware Configuration File. We need to come up with a much better
2822+ * approach to managing this array. For now, the first four entries
2823+ * are:
2824+ *
2825+ * 0: Host Page Size
2826+ * 1: 64KB
2827+ * 2: Buffer size corresponding to 1500 byte MTU (unpacked mode)
2828+ * 3: Buffer size corresponding to 9000 byte MTU (unpacked mode)
2829+ *
2830+ * For the single-MTU buffers in unpacked mode we need to include
2831+ * space for the SGE Control Packet Shift, 14 byte Ethernet header,
2832+ * possible 4 byte VLAN tag, all rounded up to the next Ingress Packet
2833+ * Padding boundry. All of these are accommodated in the Factory
2834+ * Default Firmware Configuration File but we need to adjust it for
2835+ * this host's cache line size.
2836+ */
2837+ t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, page_size);
2838+ t4_write_reg(adap, SGE_FL_BUFFER_SIZE2,
2839+ (t4_read_reg(adap, SGE_FL_BUFFER_SIZE2) + fl_align-1)
2840+ & ~(fl_align-1));
2841+ t4_write_reg(adap, SGE_FL_BUFFER_SIZE3,
2842+ (t4_read_reg(adap, SGE_FL_BUFFER_SIZE3) + fl_align-1)
2843+ & ~(fl_align-1));
2844+
2845+ t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(page_shift - 12));
2846+
2847+ return 0;
2848+}
2849+
2850+/**
2851+ * t4_fw_initialize - ask FW to initialize the device
2852+ * @adap: the adapter
2853+ * @mbox: mailbox to use for the FW command
2854+ *
2855+ * Issues a command to FW to partially initialize the device. This
2856+ * performs initialization that generally doesn't depend on user input.
2857+ */
2858+int t4_fw_initialize(struct adapter *adap, unsigned int mbox)
2859+{
2860+ struct fw_initialize_cmd c;
2861+
2862+ memset(&c, 0, sizeof(c));
2863+ INIT_CMD(c, INITIALIZE, WRITE);
2864+ return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
2865+}
2866+
21882867 /**
21892868 * t4_query_params - query FW or device parameters
21902869 * @adap: the adapter
@@ -2835,10 +3514,6 @@ int __devinit t4_prep_adapter(struct adapter *adapter) · 644 unmodified lines
28353514 return ret;
28363515 }
28373516
2838− ret = get_vpd_params(adapter, &adapter->params.vpd);
2839− if (ret < 0)
2840− return ret;
2841−
28423517 init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd);
28433518
28443519 /*
@@ -2846,6 +3521,7 @@ int __devinit t4_prep_adapter(struct adapter *adapter) · 1 unmodified line
28463521 */
28473522 adapter->params.nports = 1;
28483523 adapter->params.portvec = 1;
3524+ adapter->params.vpd.cclk = 50000;
28493525 return 0;
28503526 }
28513527
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h+80−0
@@ -58,6 +58,7 @@ enum { · 57 unmodified lines
5858
5959 enum {
6060 SF_PAGE_SIZE = 256, /* serial flash page size */
61+ SF_SEC_SIZE = 64 * 1024, /* serial flash sector size */
6162 };
6263
6364 enum { RSP_TYPE_FLBUF, RSP_TYPE_CPL, RSP_TYPE_INTR }; /* response entry types */
@@ -137,4 +138,83 @@ struct rsp_ctrl { · 73 unmodified lines
137138 #define QINTR_CNT_EN 0x1
138139 #define QINTR_TIMER_IDX(x) ((x) << 1)
139140 #define QINTR_TIMER_IDX_GET(x) (((x) >> 1) & 0x7)
141+
142+/*
143+ * Flash layout.
144+ */
145+#define FLASH_START(start) ((start) * SF_SEC_SIZE)
146+#define FLASH_MAX_SIZE(nsecs) ((nsecs) * SF_SEC_SIZE)
147+
148+enum {
149+ /*
150+ * Various Expansion-ROM boot images, etc.
151+ */
152+ FLASH_EXP_ROM_START_SEC = 0,
153+ FLASH_EXP_ROM_NSECS = 6,
154+ FLASH_EXP_ROM_START = FLASH_START(FLASH_EXP_ROM_START_SEC),
155+ FLASH_EXP_ROM_MAX_SIZE = FLASH_MAX_SIZE(FLASH_EXP_ROM_NSECS),
156+
157+ /*
158+ * iSCSI Boot Firmware Table (iBFT) and other driver-related
159+ * parameters ...
160+ */
161+ FLASH_IBFT_START_SEC = 6,
162+ FLASH_IBFT_NSECS = 1,
163+ FLASH_IBFT_START = FLASH_START(FLASH_IBFT_START_SEC),
164+ FLASH_IBFT_MAX_SIZE = FLASH_MAX_SIZE(FLASH_IBFT_NSECS),
165+
166+ /*
167+ * Boot configuration data.
168+ */
169+ FLASH_BOOTCFG_START_SEC = 7,
170+ FLASH_BOOTCFG_NSECS = 1,
171+ FLASH_BOOTCFG_START = FLASH_START(FLASH_BOOTCFG_START_SEC),
172+ FLASH_BOOTCFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_BOOTCFG_NSECS),
173+
174+ /*
175+ * Location of firmware image in FLASH.
176+ */
177+ FLASH_FW_START_SEC = 8,
178+ FLASH_FW_NSECS = 8,
179+ FLASH_FW_START = FLASH_START(FLASH_FW_START_SEC),
180+ FLASH_FW_MAX_SIZE = FLASH_MAX_SIZE(FLASH_FW_NSECS),
181+
182+ /*
183+ * iSCSI persistent/crash information.
184+ */
185+ FLASH_ISCSI_CRASH_START_SEC = 29,
186+ FLASH_ISCSI_CRASH_NSECS = 1,
187+ FLASH_ISCSI_CRASH_START = FLASH_START(FLASH_ISCSI_CRASH_START_SEC),
188+ FLASH_ISCSI_CRASH_MAX_SIZE = FLASH_MAX_SIZE(FLASH_ISCSI_CRASH_NSECS),
189+
190+ /*
191+ * FCoE persistent/crash information.
192+ */
193+ FLASH_FCOE_CRASH_START_SEC = 30,
194+ FLASH_FCOE_CRASH_NSECS = 1,
195+ FLASH_FCOE_CRASH_START = FLASH_START(FLASH_FCOE_CRASH_START_SEC),
196+ FLASH_FCOE_CRASH_MAX_SIZE = FLASH_MAX_SIZE(FLASH_FCOE_CRASH_NSECS),
197+
198+ /*
199+ * Location of Firmware Configuration File in FLASH. Since the FPGA
200+ * "FLASH" is smaller we need to store the Configuration File in a
201+ * different location -- which will overlap the end of the firmware
202+ * image if firmware ever gets that large ...
203+ */
204+ FLASH_CFG_START_SEC = 31,
205+ FLASH_CFG_NSECS = 1,
206+ FLASH_CFG_START = FLASH_START(FLASH_CFG_START_SEC),
207+ FLASH_CFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_CFG_NSECS),
208+
209+ FLASH_FPGA_CFG_START_SEC = 15,
210+ FLASH_FPGA_CFG_START = FLASH_START(FLASH_FPGA_CFG_START_SEC),
211+
212+ /*
213+ * Sectors 32-63 are reserved for FLASH failover.
214+ */
215+};
216+
217+#undef FLASH_START
218+#undef FLASH_MAX_SIZE
219+
140220 #endif /* __T4_HW_H */
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h+141−44
@@ -86,10 +86,17 @@ · 85 unmodified lines
8686 #define CIDXINC_SHIFT 0
8787 #define CIDXINC(x) ((x) << CIDXINC_SHIFT)
8888
89+#define X_RXPKTCPLMODE_SPLIT 1
90+#define X_INGPADBOUNDARY_SHIFT 5
91+
8992 #define SGE_CONTROL 0x1008
9093 #define DCASYSTYPE 0x00080000U
91−#define RXPKTCPLMODE 0x00040000U
92−#define EGRSTATUSPAGESIZE 0x00020000U
94+#define RXPKTCPLMODE_MASK 0x00040000U
95+#define RXPKTCPLMODE_SHIFT 18
96+#define RXPKTCPLMODE(x) ((x) << RXPKTCPLMODE_SHIFT)
97+#define EGRSTATUSPAGESIZE_MASK 0x00020000U
98+#define EGRSTATUSPAGESIZE_SHIFT 17
99+#define EGRSTATUSPAGESIZE(x) ((x) << EGRSTATUSPAGESIZE_SHIFT)
93100 #define PKTSHIFT_MASK 0x00001c00U
94101 #define PKTSHIFT_SHIFT 10
95102 #define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT)
@@ -108,6 +115,35 @@ · 12 unmodified lines
108115 #define GLOBALENABLE 0x00000001U
109116
110117 #define SGE_HOST_PAGE_SIZE 0x100c
118+
119+#define HOSTPAGESIZEPF7_MASK 0x0000000fU
120+#define HOSTPAGESIZEPF7_SHIFT 28
121+#define HOSTPAGESIZEPF7(x) ((x) << HOSTPAGESIZEPF7_SHIFT)
122+
123+#define HOSTPAGESIZEPF6_MASK 0x0000000fU
124+#define HOSTPAGESIZEPF6_SHIFT 24
125+#define HOSTPAGESIZEPF6(x) ((x) << HOSTPAGESIZEPF6_SHIFT)
126+
127+#define HOSTPAGESIZEPF5_MASK 0x0000000fU
128+#define HOSTPAGESIZEPF5_SHIFT 20
129+#define HOSTPAGESIZEPF5(x) ((x) << HOSTPAGESIZEPF5_SHIFT)
130+
131+#define HOSTPAGESIZEPF4_MASK 0x0000000fU
132+#define HOSTPAGESIZEPF4_SHIFT 16
133+#define HOSTPAGESIZEPF4(x) ((x) << HOSTPAGESIZEPF4_SHIFT)
134+
135+#define HOSTPAGESIZEPF3_MASK 0x0000000fU
136+#define HOSTPAGESIZEPF3_SHIFT 12
137+#define HOSTPAGESIZEPF3(x) ((x) << HOSTPAGESIZEPF3_SHIFT)
138+
139+#define HOSTPAGESIZEPF2_MASK 0x0000000fU
140+#define HOSTPAGESIZEPF2_SHIFT 8
141+#define HOSTPAGESIZEPF2(x) ((x) << HOSTPAGESIZEPF2_SHIFT)
142+
143+#define HOSTPAGESIZEPF1_MASK 0x0000000fU
144+#define HOSTPAGESIZEPF1_SHIFT 4
145+#define HOSTPAGESIZEPF1(x) ((x) << HOSTPAGESIZEPF1_SHIFT)
146+
111147 #define HOSTPAGESIZEPF0_MASK 0x0000000fU
112148 #define HOSTPAGESIZEPF0_SHIFT 0
113149 #define HOSTPAGESIZEPF0(x) ((x) << HOSTPAGESIZEPF0_SHIFT)
@@ -155,6 +191,8 @@ · 41 unmodified lines
155191 #define SGE_INT_ENABLE3 0x1040
156192 #define SGE_FL_BUFFER_SIZE0 0x1044
157193 #define SGE_FL_BUFFER_SIZE1 0x1048
194+#define SGE_FL_BUFFER_SIZE2 0x104c
195+#define SGE_FL_BUFFER_SIZE3 0x1050
158196 #define SGE_INGRESS_RX_THRESHOLD 0x10a0
159197 #define THRESHOLD_0_MASK 0x3f000000U
160198 #define THRESHOLD_0_SHIFT 24
@@ -173,6 +211,12 @@ · 12 unmodified lines
173211 #define THRESHOLD_3(x) ((x) << THRESHOLD_3_SHIFT)
174212 #define THRESHOLD_3_GET(x) (((x) & THRESHOLD_3_MASK) >> THRESHOLD_3_SHIFT)
175213
214+#define SGE_CONM_CTRL 0x1094
215+#define EGRTHRESHOLD_MASK 0x00003f00U
216+#define EGRTHRESHOLDshift 8
217+#define EGRTHRESHOLD(x) ((x) << EGRTHRESHOLDshift)
218+#define EGRTHRESHOLD_GET(x) (((x) & EGRTHRESHOLD_MASK) >> EGRTHRESHOLDshift)
219+
176220 #define SGE_TIMER_VALUE_0_AND_1 0x10b8
177221 #define TIMERVALUE0_MASK 0xffff0000U
178222 #define TIMERVALUE0_SHIFT 16
@@ -184,64 +228,54 @@ · 5 unmodified lines
184228 #define TIMERVALUE1_GET(x) (((x) & TIMERVALUE1_MASK) >> TIMERVALUE1_SHIFT)
185229
186230 #define SGE_TIMER_VALUE_2_AND_3 0x10bc
231+#define TIMERVALUE2_MASK 0xffff0000U
232+#define TIMERVALUE2_SHIFT 16
233+#define TIMERVALUE2(x) ((x) << TIMERVALUE2_SHIFT)
234+#define TIMERVALUE2_GET(x) (((x) & TIMERVALUE2_MASK) >> TIMERVALUE2_SHIFT)
235+#define TIMERVALUE3_MASK 0x0000ffffU
236+#define TIMERVALUE3_SHIFT 0
237+#define TIMERVALUE3(x) ((x) << TIMERVALUE3_SHIFT)
238+#define TIMERVALUE3_GET(x) (((x) & TIMERVALUE3_MASK) >> TIMERVALUE3_SHIFT)
239+
187240 #define SGE_TIMER_VALUE_4_AND_5 0x10c0
241+#define TIMERVALUE4_MASK 0xffff0000U
242+#define TIMERVALUE4_SHIFT 16
243+#define TIMERVALUE4(x) ((x) << TIMERVALUE4_SHIFT)
244+#define TIMERVALUE4_GET(x) (((x) & TIMERVALUE4_MASK) >> TIMERVALUE4_SHIFT)
245+#define TIMERVALUE5_MASK 0x0000ffffU
246+#define TIMERVALUE5_SHIFT 0
247+#define TIMERVALUE5(x) ((x) << TIMERVALUE5_SHIFT)
248+#define TIMERVALUE5_GET(x) (((x) & TIMERVALUE5_MASK) >> TIMERVALUE5_SHIFT)
249+
188250 #define SGE_DEBUG_INDEX 0x10cc
189251 #define SGE_DEBUG_DATA_HIGH 0x10d0
190252 #define SGE_DEBUG_DATA_LOW 0x10d4
191253 #define SGE_INGRESS_QUEUES_PER_PAGE_PF 0x10f4
192254
193−#define S_LP_INT_THRESH 12
194−#define V_LP_INT_THRESH(x) ((x) << S_LP_INT_THRESH)
195255 #define S_HP_INT_THRESH 28
256+#define M_HP_INT_THRESH 0xfU
196257 #define V_HP_INT_THRESH(x) ((x) << S_HP_INT_THRESH)
258+#define M_HP_COUNT 0x7ffU
259+#define S_HP_COUNT 16
260+#define G_HP_COUNT(x) (((x) >> S_HP_COUNT) & M_HP_COUNT)
261+#define S_LP_INT_THRESH 12
262+#define M_LP_INT_THRESH 0xfU
263+#define V_LP_INT_THRESH(x) ((x) << S_LP_INT_THRESH)
264+#define M_LP_COUNT 0x7ffU
265+#define S_LP_COUNT 0
266+#define G_LP_COUNT(x) (((x) >> S_LP_COUNT) & M_LP_COUNT)
197267 #define A_SGE_DBFIFO_STATUS 0x10a4
198268
199269 #define S_ENABLE_DROP 13
200270 #define V_ENABLE_DROP(x) ((x) << S_ENABLE_DROP)
201271 #define F_ENABLE_DROP V_ENABLE_DROP(1U)
202−#define A_SGE_DOORBELL_CONTROL 0x10a8
203−
204−#define A_SGE_CTXT_CMD 0x11fc
205−#define A_SGE_DBQ_CTXT_BADDR 0x1084
206−
207−#define A_SGE_PF_KDOORBELL 0x0
208−
209−#define S_QID 15
210−#define V_QID(x) ((x) << S_QID)
211−
212−#define S_PIDX 0
213−#define V_PIDX(x) ((x) << S_PIDX)
214−
215−#define M_LP_COUNT 0x7ffU
216−#define S_LP_COUNT 0
217−#define G_LP_COUNT(x) (((x) >> S_LP_COUNT) & M_LP_COUNT)
218−
219−#define M_HP_COUNT 0x7ffU
220−#define S_HP_COUNT 16
221−#define G_HP_COUNT(x) (((x) >> S_HP_COUNT) & M_HP_COUNT)
222−
223−#define A_SGE_INT_ENABLE3 0x1040
224−
225−#define S_DBFIFO_HP_INT 8
226−#define V_DBFIFO_HP_INT(x) ((x) << S_DBFIFO_HP_INT)
227−#define F_DBFIFO_HP_INT V_DBFIFO_HP_INT(1U)
228−
229−#define S_DBFIFO_LP_INT 7
230−#define V_DBFIFO_LP_INT(x) ((x) << S_DBFIFO_LP_INT)
231−#define F_DBFIFO_LP_INT V_DBFIFO_LP_INT(1U)
232−
233272 #define S_DROPPED_DB 0
234273 #define V_DROPPED_DB(x) ((x) << S_DROPPED_DB)
235274 #define F_DROPPED_DB V_DROPPED_DB(1U)
275+#define A_SGE_DOORBELL_CONTROL 0x10a8
236276
237−#define S_ERR_DROPPED_DB 18
238−#define V_ERR_DROPPED_DB(x) ((x) << S_ERR_DROPPED_DB)
239−#define F_ERR_DROPPED_DB V_ERR_DROPPED_DB(1U)
240−
241−#define A_PCIE_MEM_ACCESS_OFFSET 0x306c
242−
243−#define M_HP_INT_THRESH 0xfU
244−#define M_LP_INT_THRESH 0xfU
277+#define A_SGE_CTXT_CMD 0x11fc
278+#define A_SGE_DBQ_CTXT_BADDR 0x1084
245279
246280 #define PCIE_PF_CLI 0x44
247281 #define PCIE_INT_CAUSE 0x3004
@@ -287,6 +321,8 @@ · 39 unmodified lines
287321 #define WINDOW(x) ((x) << WINDOW_SHIFT)
288322 #define PCIE_MEM_ACCESS_OFFSET 0x306c
289323
324+#define PCIE_FW 0x30b8
325+
290326 #define PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS 0x5908
291327 #define RNPP 0x80000000U
292328 #define RPCP 0x20000000U
@@ -364,7 +400,7 @@ · 71 unmodified lines
364400 #define MEM_WRAP_CLIENT_NUM_MASK 0x0000000fU
365401 #define MEM_WRAP_CLIENT_NUM_SHIFT 0
366402 #define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT)
367−
403+#define MA_PCIE_FW 0x30b8
368404 #define MA_PARITY_ERROR_STATUS 0x77f4
369405
370406 #define EDC_0_BASE_ADDR 0x7900
@@ -385,6 +421,7 @@ · 14 unmodified lines
385421
386422 #define CIM_BOOT_CFG 0x7b00
387423 #define BOOTADDR_MASK 0xffffff00U
424+#define UPCRST 0x1U
388425
389426 #define CIM_PF_MAILBOX_DATA 0x240
390427 #define CIM_PF_MAILBOX_CTRL 0x280
@@ -457,6 +494,13 @@ · 66 unmodified lines
457494 #define VLANEXTENABLE_MASK 0x0000f000U
458495 #define VLANEXTENABLE_SHIFT 12
459496
497+#define TP_GLOBAL_CONFIG 0x7d08
498+#define FIVETUPLELOOKUP_SHIFT 17
499+#define FIVETUPLELOOKUP_MASK 0x00060000U
500+#define FIVETUPLELOOKUP(x) ((x) << FIVETUPLELOOKUP_SHIFT)
501+#define FIVETUPLELOOKUP_GET(x) (((x) & FIVETUPLELOOKUP_MASK) >> \
502+ FIVETUPLELOOKUP_SHIFT)
503+
460504 #define TP_PARA_REG2 0x7d68
461505 #define MAXRXDATA_MASK 0xffff0000U
462506 #define MAXRXDATA_SHIFT 16
@@ -466,8 +510,47 @@ · 3 unmodified lines
466510 #define TIMERRESOLUTION_MASK 0x00ff0000U
467511 #define TIMERRESOLUTION_SHIFT 16
468512 #define TIMERRESOLUTION_GET(x) (((x) & TIMERRESOLUTION_MASK) >> TIMERRESOLUTION_SHIFT)
513+#define DELAYEDACKRESOLUTION_MASK 0x000000ffU
514+#define DELAYEDACKRESOLUTION_SHIFT 0
515+#define DELAYEDACKRESOLUTION_GET(x) \
516+ (((x) & DELAYEDACKRESOLUTION_MASK) >> DELAYEDACKRESOLUTION_SHIFT)
469517
470518 #define TP_SHIFT_CNT 0x7dc0
519+#define SYNSHIFTMAX_SHIFT 24
520+#define SYNSHIFTMAX_MASK 0xff000000U
521+#define SYNSHIFTMAX(x) ((x) << SYNSHIFTMAX_SHIFT)
522+#define SYNSHIFTMAX_GET(x) (((x) & SYNSHIFTMAX_MASK) >> \
523+ SYNSHIFTMAX_SHIFT)
524+#define RXTSHIFTMAXR1_SHIFT 20
525+#define RXTSHIFTMAXR1_MASK 0x00f00000U
526+#define RXTSHIFTMAXR1(x) ((x) << RXTSHIFTMAXR1_SHIFT)
527+#define RXTSHIFTMAXR1_GET(x) (((x) & RXTSHIFTMAXR1_MASK) >> \
528+ RXTSHIFTMAXR1_SHIFT)
529+#define RXTSHIFTMAXR2_SHIFT 16
530+#define RXTSHIFTMAXR2_MASK 0x000f0000U
531+#define RXTSHIFTMAXR2(x) ((x) << RXTSHIFTMAXR2_SHIFT)
532+#define RXTSHIFTMAXR2_GET(x) (((x) & RXTSHIFTMAXR2_MASK) >> \
533+ RXTSHIFTMAXR2_SHIFT)
534+#define PERSHIFTBACKOFFMAX_SHIFT 12
535+#define PERSHIFTBACKOFFMAX_MASK 0x0000f000U
536+#define PERSHIFTBACKOFFMAX(x) ((x) << PERSHIFTBACKOFFMAX_SHIFT)
537+#define PERSHIFTBACKOFFMAX_GET(x) (((x) & PERSHIFTBACKOFFMAX_MASK) >> \
538+ PERSHIFTBACKOFFMAX_SHIFT)
539+#define PERSHIFTMAX_SHIFT 8
540+#define PERSHIFTMAX_MASK 0x00000f00U
541+#define PERSHIFTMAX(x) ((x) << PERSHIFTMAX_SHIFT)
542+#define PERSHIFTMAX_GET(x) (((x) & PERSHIFTMAX_MASK) >> \
543+ PERSHIFTMAX_SHIFT)
544+#define KEEPALIVEMAXR1_SHIFT 4
545+#define KEEPALIVEMAXR1_MASK 0x000000f0U
546+#define KEEPALIVEMAXR1(x) ((x) << KEEPALIVEMAXR1_SHIFT)
547+#define KEEPALIVEMAXR1_GET(x) (((x) & KEEPALIVEMAXR1_MASK) >> \
548+ KEEPALIVEMAXR1_SHIFT)
549+#define KEEPALIVEMAXR2_SHIFT 0
550+#define KEEPALIVEMAXR2_MASK 0x0000000fU
551+#define KEEPALIVEMAXR2(x) ((x) << KEEPALIVEMAXR2_SHIFT)
552+#define KEEPALIVEMAXR2_GET(x) (((x) & KEEPALIVEMAXR2_MASK) >> \
553+ KEEPALIVEMAXR2_SHIFT)
471554
472555 #define TP_CCTRL_TABLE 0x7ddc
473556 #define TP_MTU_TABLE 0x7de4
@@ -501,6 +584,20 @@ · 27 unmodified lines
501584 #define TP_INT_CAUSE 0x7e74
502585 #define FLMTXFLSTEMPTY 0x40000000U
503586
587+#define TP_VLAN_PRI_MAP 0x140
588+#define FRAGMENTATION_SHIFT 9
589+#define FRAGMENTATION_MASK 0x00000200U
590+#define MPSHITTYPE_MASK 0x00000100U
591+#define MACMATCH_MASK 0x00000080U
592+#define ETHERTYPE_MASK 0x00000040U
593+#define PROTOCOL_MASK 0x00000020U
594+#define TOS_MASK 0x00000010U
595+#define VLAN_MASK 0x00000008U
596+#define VNIC_ID_MASK 0x00000004U
597+#define PORT_MASK 0x00000002U
598+#define FCOE_SHIFT 0
599+#define FCOE_MASK 0x00000001U
600+
504601 #define TP_INGRESS_CONFIG 0x141
505602 #define VNIC 0x00000800U
506603 #define CSUM_HAS_PSEUDO_HDR 0x00000400U
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h+77−20
@@ -79,6 +79,8 @@ struct fw_wr_hdr { · 78 unmodified lines
7979 #define FW_WR_FLOWID(x) ((x) << 8)
8080 #define FW_WR_LEN16(x) ((x) << 0)
8181
82+#define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
83+
8284 struct fw_ulptx_wr {
8385 __be32 op_to_compl;
8486 __be32 flowid_len16;
@@ -155,6 +157,17 @@ struct fw_eth_tx_pkt_vm_wr { · 70 unmodified lines
155157
156158 #define FW_CMD_MAX_TIMEOUT 3000
157159
160+/*
161+ * If a host driver does a HELLO and discovers that there's already a MASTER
162+ * selected, we may have to wait for that MASTER to finish issuing RESET,
163+ * configuration and INITIALIZE commands. Also, there's a possibility that
164+ * our own HELLO may get lost if it happens right as the MASTER is issuign a
165+ * RESET command, so we need to be willing to make a few retries of our HELLO.
166+ */
167+#define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
168+#define FW_CMD_HELLO_RETRIES 3
169+
170+
158171 enum fw_cmd_opcodes {
159172 FW_LDST_CMD = 0x01,
160173 FW_RESET_CMD = 0x03,
@@ -304,7 +317,17 @@ struct fw_reset_cmd { · 143 unmodified lines
304317 __be32 op_to_write;
305318 __be32 retval_len16;
306319 __be32 val;
307− __be32 r3;
320+ __be32 halt_pkd;
321+};
322+
323+#define FW_RESET_CMD_HALT_SHIFT 31
324+#define FW_RESET_CMD_HALT_MASK 0x1
325+#define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
326+#define FW_RESET_CMD_HALT_GET(x) \
327+ (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
328+
329+enum fw_hellow_cmd {
330+ fw_hello_cmd_stage_os = 0x0
308331 };
309332
310333 struct fw_hello_cmd {
@@ -315,8 +338,14 @@ struct fw_hello_cmd { · 4 unmodified lines
315338 #define FW_HELLO_CMD_INIT (1U << 30)
316339 #define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
317340 #define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
318−#define FW_HELLO_CMD_MBMASTER(x) ((x) << 24)
341+#define FW_HELLO_CMD_MBMASTER_MASK 0xfU
342+#define FW_HELLO_CMD_MBMASTER_SHIFT 24
343+#define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
344+#define FW_HELLO_CMD_MBMASTER_GET(x) \
345+ (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
319346 #define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
347+#define FW_HELLO_CMD_STAGE(x) ((x) << 17)
348+#define FW_HELLO_CMD_CLEARINIT (1U << 16)
320349 __be32 fwrev;
321350 };
322351
@@ -401,6 +430,14 @@ enum fw_caps_config_fcoe { · 78 unmodified lines
401430 FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
402431 };
403432
433+enum fw_memtype_cf {
434+ FW_MEMTYPE_CF_EDC0 = 0x0,
435+ FW_MEMTYPE_CF_EDC1 = 0x1,
436+ FW_MEMTYPE_CF_EXTMEM = 0x2,
437+ FW_MEMTYPE_CF_FLASH = 0x4,
438+ FW_MEMTYPE_CF_INTERNAL = 0x5,
439+};
440+
404441 struct fw_caps_config_cmd {
405442 __be32 op_to_write;
406443 __be32 retval_len16;
@@ -416,10 +453,15 @@ struct fw_caps_config_cmd { · 9 unmodified lines
416453 __be16 r4;
417454 __be16 iscsicaps;
418455 __be16 fcoecaps;
419− __be32 r5;
420− __be64 r6;
456+ __be32 cfcsum;
457+ __be32 finiver;
458+ __be32 finicsum;
421459 };
422460
461+#define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
462+#define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
463+#define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
464+
423465 /*
424466 * params command mnemonics
425467 */
@@ -451,6 +493,7 @@ enum fw_params_param_dev { · 25 unmodified lines
451493 FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
452494 FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
453495 FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
496+ FW_PARAMS_PARAM_DEV_CF = 0x0D,
454497 };
455498
456499 /*
@@ -492,6 +535,8 @@ enum fw_params_param_pfvf { · 35 unmodified lines
492535 FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
493536 FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
494537 FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
538+ FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
539+ FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E
495540 };
496541
497542 /*
@@ -507,8 +552,16 @@ enum fw_params_param_dmaq { · 9 unmodified lines
507552
508553 #define FW_PARAMS_MNEM(x) ((x) << 24)
509554 #define FW_PARAMS_PARAM_X(x) ((x) << 16)
510−#define FW_PARAMS_PARAM_Y(x) ((x) << 8)
511−#define FW_PARAMS_PARAM_Z(x) ((x) << 0)
555+#define FW_PARAMS_PARAM_Y_SHIFT 8
556+#define FW_PARAMS_PARAM_Y_MASK 0xffU
557+#define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
558+#define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
559+ FW_PARAMS_PARAM_Y_MASK)
560+#define FW_PARAMS_PARAM_Z_SHIFT 0
561+#define FW_PARAMS_PARAM_Z_MASK 0xffu
562+#define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
563+#define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
564+ FW_PARAMS_PARAM_Z_MASK)
512565 #define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
513566 #define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
514567
@@ -1599,6 +1652,16 @@ struct fw_debug_cmd { · 1084 unmodified lines
15991652 } u;
16001653 };
16011654
1655+#define FW_PCIE_FW_ERR (1U << 31)
1656+#define FW_PCIE_FW_INIT (1U << 30)
1657+#define FW_PCIE_FW_HALT (1U << 29)
1658+#define FW_PCIE_FW_MASTER_VLD (1U << 15)
1659+#define FW_PCIE_FW_MASTER_MASK 0x7
1660+#define FW_PCIE_FW_MASTER_SHIFT 12
1661+#define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
1662+#define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
1663+ FW_PCIE_FW_MASTER_MASK)
1664+
16021665 struct fw_hdr {
16031666 u8 ver;
16041667 u8 reserved1;
@@ -1613,7 +1676,11 @@ struct fw_hdr { · 8 unmodified lines
16131676 u8 intfver_iscsi;
16141677 u8 intfver_fcoe;
16151678 u8 reserved2;
1616− __be32 reserved3[27];
1679+ __u32 reserved3;
1680+ __u32 reserved4;
1681+ __u32 reserved5;
1682+ __be32 flags;
1683+ __be32 reserved6[23];
16171684 };
16181685
16191686 #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
@@ -1621,18 +1688,8 @@ struct fw_hdr { · 1 unmodified line
16211688 #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
16221689 #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
16231690
1624−#define S_FW_CMD_OP 24
1625−#define V_FW_CMD_OP(x) ((x) << S_FW_CMD_OP)
1626−
1627−#define S_FW_CMD_REQUEST 23
1628−#define V_FW_CMD_REQUEST(x) ((x) << S_FW_CMD_REQUEST)
1629−#define F_FW_CMD_REQUEST V_FW_CMD_REQUEST(1U)
1630−
1631−#define S_FW_CMD_WRITE 21
1632−#define V_FW_CMD_WRITE(x) ((x) << S_FW_CMD_WRITE)
1633−#define F_FW_CMD_WRITE V_FW_CMD_WRITE(1U)
1634−
1635−#define S_FW_LDST_CMD_ADDRSPACE 0
1636−#define V_FW_LDST_CMD_ADDRSPACE(x) ((x) << S_FW_LDST_CMD_ADDRSPACE)
1691+enum fw_hdr_flags {
1692+ FW_HDR_FLAGS_RESET_HALT = 0x00000001,
1693+};
16371694
16381695 #endif /* _T4FW_INTERFACE_H_ */
drivers/net/ethernet/chelsio/cxgb4vf/sge.c+3−2
@@ -2421,7 +2421,7 @@ int t4vf_sge_init(struct adapter *adapter) · 2420 unmodified lines
24212421 fl0, fl1);
24222422 return -EINVAL;
24232423 }
2424− if ((sge_params->sge_control & RXPKTCPLMODE) == 0) {
2424+ if ((sge_params->sge_control & RXPKTCPLMODE_MASK) == 0) {
24252425 dev_err(adapter->pdev_dev, "bad SGE CPL MODE\n");
24262426 return -EINVAL;
24272427 }
@@ -2431,7 +2431,8 @@ int t4vf_sge_init(struct adapter *adapter) · 3 unmodified lines
24312431 */
24322432 if (fl1)
24332433 FL_PG_ORDER = ilog2(fl1) - PAGE_SHIFT;
2434− STAT_LEN = ((sge_params->sge_control & EGRSTATUSPAGESIZE) ? 128 : 64);
2434+ STAT_LEN = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK)
2435+ ? 128 : 64);
24352436 PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control);
24362437 FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) +
24372438 SGE_INGPADBOUNDARY_SHIFT);
drivers/net/ethernet/emulex/benet/be.h+1−1
@@ -110,6 +110,7 @@ static inline char *nic_name(struct pci_dev *pdev) · 109 unmodified lines
110110 #define MAX_RX_POST BE_NAPI_WEIGHT /* Frags posted at a time */
111111 #define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST)
112112
113+#define MAX_VFS 30 /* Max VFs supported by BE3 FW */
113114 #define FW_VER_LEN 32
114115
115116 struct be_dma_mem {
@@ -336,7 +337,6 @@ struct phy_info { · 220 unmodified lines
336337 u16 auto_speeds_supported;
337338 u16 fixed_speeds_supported;
338339 int link_speed;
339− int forced_port_speed;
340340 u32 dac_cable_len;
341341 u32 advertising;
342342 u32 supported;
drivers/net/ethernet/emulex/benet/be_cmds.c+39−16
@@ -120,7 +120,7 @@ static int be_mcc_compl_process(struct be_adapter *adapter, · 119 unmodified lines
120120
121121 if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) {
122122 dev_warn(&adapter->pdev->dev,
123− "opcode %d-%d is not permitted\n",
123+ "VF is not privileged to issue opcode %d-%d\n",
124124 opcode, subsystem);
125125 } else {
126126 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
@@ -165,14 +165,13 @@ static void be_async_grp5_cos_priority_process(struct be_adapter *adapter, · 38 unmodified lines
165165 }
166166 }
167167
168−/* Grp5 QOS Speed evt */
168+/* Grp5 QOS Speed evt: qos_link_speed is in units of 10 Mbps */
169169 static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
170170 struct be_async_event_grp5_qos_link_speed *evt)
171171 {
172− if (evt->physical_port == adapter->port_num) {
173− /* qos_link_speed is in units of 10 Mbps */
174− adapter->phy.link_speed = evt->qos_link_speed * 10;
175− }
172+ if (adapter->phy.link_speed >= 0 &&
173+ evt->physical_port == adapter->port_num)
174+ adapter->phy.link_speed = le16_to_cpu(evt->qos_link_speed) * 10;
176175 }
177176
178177 /*Grp5 PVID evt*/
@@ -717,7 +716,7 @@ int be_cmd_eq_create(struct be_adapter *adapter, · 538 unmodified lines
717716
718717 /* Use MCC */
719718 int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
720− u8 type, bool permanent, u32 if_handle, u32 pmac_id)
719+ bool permanent, u32 if_handle, u32 pmac_id)
721720 {
722721 struct be_mcc_wrb *wrb;
723722 struct be_cmd_req_mac_query *req;
@@ -734,7 +733,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, · 10 unmodified lines
734733
735734 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
736735 OPCODE_COMMON_NTWK_MAC_QUERY, sizeof(*req), wrb, NULL);
737− req->type = type;
736+ req->type = MAC_ADDRESS_TYPE_NETWORK;
738737 if (permanent) {
739738 req->permanent = 1;
740739 } else {
@@ -1326,9 +1325,28 @@ err: · 585 unmodified lines
13261325 return status;
13271326 }
13281327
1329−/* Uses synchronous mcc */
1330−int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,
1331− u16 *link_speed, u8 *link_status, u32 dom)
1328+static int be_mac_to_link_speed(int mac_speed)
1329+{
1330+ switch (mac_speed) {
1331+ case PHY_LINK_SPEED_ZERO:
1332+ return 0;
1333+ case PHY_LINK_SPEED_10MBPS:
1334+ return 10;
1335+ case PHY_LINK_SPEED_100MBPS:
1336+ return 100;
1337+ case PHY_LINK_SPEED_1GBPS:
1338+ return 1000;
1339+ case PHY_LINK_SPEED_10GBPS:
1340+ return 10000;
1341+ }
1342+ return 0;
1343+}
1344+
1345+/* Uses synchronous mcc
1346+ * Returns link_speed in Mbps
1347+ */
1348+int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
1349+ u8 *link_status, u32 dom)
13321350 {
13331351 struct be_mcc_wrb *wrb;
13341352 struct be_cmd_req_link_status *req;
@@ -1357,11 +1375,13 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed, · 22 unmodified lines
13571375 status = be_mcc_notify_wait(adapter);
13581376 if (!status) {
13591377 struct be_cmd_resp_link_status *resp = embedded_payload(wrb);
1360− if (resp->mac_speed != PHY_LINK_SPEED_ZERO) {
1361− if (link_speed)
1362− *link_speed = le16_to_cpu(resp->link_speed);
1363− if (mac_speed)
1364− *mac_speed = resp->mac_speed;
1378+ if (link_speed) {
1379+ *link_speed = resp->link_speed ?
1380+ le16_to_cpu(resp->link_speed) * 10 :
1381+ be_mac_to_link_speed(resp->mac_speed);
1382+
1383+ if (!resp->logical_link_status)
1384+ *link_speed = 0;
13651385 }
13661386 if (link_status)
13671387 *link_status = resp->logical_link_status;
@@ -2405,6 +2425,9 @@ int be_cmd_req_native_mode(struct be_adapter *adapter) · 1037 unmodified lines
24052425 struct be_cmd_resp_set_func_cap *resp = embedded_payload(wrb);
24062426 adapter->be3_native = le32_to_cpu(resp->cap_flags) &
24072427 CAPABILITY_BE3_NATIVE_ERX_API;
2428+ if (!adapter->be3_native)
2429+ dev_warn(&adapter->pdev->dev,
2430+ "adapter not in advanced mode\n");
24082431 }
24092432 err:
24102433 mutex_unlock(&adapter->mbox_lock);
drivers/net/ethernet/emulex/benet/be_cmds.h+3−3
@@ -1687,7 +1687,7 @@ struct be_cmd_req_set_ext_fat_caps { · 1686 unmodified lines
16871687 extern int be_pci_fnum_get(struct be_adapter *adapter);
16881688 extern int be_fw_wait_ready(struct be_adapter *adapter);
16891689 extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
1690− u8 type, bool permanent, u32 if_handle, u32 pmac_id);
1690+ bool permanent, u32 if_handle, u32 pmac_id);
16911691 extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
16921692 u32 if_id, u32 *pmac_id, u32 domain);
16931693 extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id,
@@ -1714,8 +1714,8 @@ extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, · 20 unmodified lines
17141714 int type);
17151715 extern int be_cmd_rxq_destroy(struct be_adapter *adapter,
17161716 struct be_queue_info *q);
1717−extern int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,
1718− u16 *link_speed, u8 *link_status, u32 dom);
1717+extern int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
1718+ u8 *link_status, u32 dom);
17191719 extern int be_cmd_reset(struct be_adapter *adapter);
17201720 extern int be_cmd_get_stats(struct be_adapter *adapter,
17211721 struct be_dma_mem *nonemb_cmd);
drivers/net/ethernet/emulex/benet/be_ethtool.c+12−45
@@ -512,28 +512,6 @@ static u32 convert_to_et_setting(u32 if_type, u32 if_speeds) · 511 unmodified lines
512512 return val;
513513 }
514514
515−static int convert_to_et_speed(u32 be_speed)
516−{
517− int et_speed = SPEED_10000;
518−
519− switch (be_speed) {
520− case PHY_LINK_SPEED_10MBPS:
521− et_speed = SPEED_10;
522− break;
523− case PHY_LINK_SPEED_100MBPS:
524− et_speed = SPEED_100;
525− break;
526− case PHY_LINK_SPEED_1GBPS:
527− et_speed = SPEED_1000;
528− break;
529− case PHY_LINK_SPEED_10GBPS:
530− et_speed = SPEED_10000;
531− break;
532− }
533−
534− return et_speed;
535−}
536−
537515 bool be_pause_supported(struct be_adapter *adapter)
538516 {
539517 return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB ||
@@ -544,27 +522,16 @@ bool be_pause_supported(struct be_adapter *adapter) · 4 unmodified lines
544522 static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
545523 {
546524 struct be_adapter *adapter = netdev_priv(netdev);
547− u8 port_speed = 0;
548− u16 link_speed = 0;
549525 u8 link_status;
550− u32 et_speed = 0;
526+ u16 link_speed = 0;
551527 int status;
552528
553− if (adapter->phy.link_speed < 0 || !(netdev->flags & IFF_UP)) {
554− if (adapter->phy.forced_port_speed < 0) {
555− status = be_cmd_link_status_query(adapter, &port_speed,
556− &link_speed, &link_status, 0);
557− if (!status)
558− be_link_status_update(adapter, link_status);
559− if (link_speed)
560− et_speed = link_speed * 10;
561− else if (link_status)
562− et_speed = convert_to_et_speed(port_speed);
563− } else {
564− et_speed = adapter->phy.forced_port_speed;
565− }
566−
567− ethtool_cmd_speed_set(ecmd, et_speed);
529+ if (adapter->phy.link_speed < 0) {
530+ status = be_cmd_link_status_query(adapter, &link_speed,
531+ &link_status, 0);
532+ if (!status)
533+ be_link_status_update(adapter, link_status);
534+ ethtool_cmd_speed_set(ecmd, link_speed);
568535
569536 status = be_cmd_get_phy_info(adapter);
570537 if (status)
@@ -773,8 +740,8 @@ static void · 202 unmodified lines
773740 be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
774741 {
775742 struct be_adapter *adapter = netdev_priv(netdev);
776− u8 mac_speed = 0;
777− u16 qos_link_speed = 0;
743+ int status;
744+ u8 link_status = 0;
778745
779746 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
780747
@@ -798,11 +765,11 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) · 17 unmodified lines
798765 test->flags |= ETH_TEST_FL_FAILED;
799766 }
800767
801− if (be_cmd_link_status_query(adapter, &mac_speed,
802− &qos_link_speed, NULL, 0) != 0) {
768+ status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
769+ if (status) {
803770 test->flags |= ETH_TEST_FL_FAILED;
804771 data[4] = -1;
805− } else if (!mac_speed) {
772+ } else if (!link_status) {
806773 test->flags |= ETH_TEST_FL_FAILED;
807774 data[4] = 1;
808775 }
drivers/net/ethernet/emulex/benet/be_main.c+58−38
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include "be.h"
2121 #include "be_cmds.h"
2222 #include <asm/div64.h>
23+#include <linux/aer.h>
2324
2425 MODULE_VERSION(DRV_VER);
2526 MODULE_DEVICE_TABLE(pci, be_dev_ids);
@@ -240,9 +241,8 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) · 214 unmodified lines
240241 if (!is_valid_ether_addr(addr->sa_data))
241242 return -EADDRNOTAVAIL;
242243
243− status = be_cmd_mac_addr_query(adapter, current_mac,
244− MAC_ADDRESS_TYPE_NETWORK, false,
245− adapter->if_handle, 0);
244+ status = be_cmd_mac_addr_query(adapter, current_mac, false,
245+ adapter->if_handle, 0);
246246 if (status)
247247 goto err;
248248
@@ -1075,7 +1075,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, · 826 unmodified lines
10751075 static int be_find_vfs(struct be_adapter *adapter, int vf_state)
10761076 {
10771077 struct pci_dev *dev, *pdev = adapter->pdev;
1078− int vfs = 0, assigned_vfs = 0, pos, vf_fn;
1078+ int vfs = 0, assigned_vfs = 0, pos;
10791079 u16 offset, stride;
10801080
10811081 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
@@ -1086,9 +1086,7 @@ static int be_find_vfs(struct be_adapter *adapter, int vf_state) · 4 unmodified lines
10861086
10871087 dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);
10881088 while (dev) {
1089− vf_fn = (pdev->devfn + offset + stride * vfs) & 0xFFFF;
1090− if (dev->is_virtfn && dev->devfn == vf_fn &&
1091− dev->bus->number == pdev->bus->number) {
1089+ if (dev->is_virtfn && pci_physfn(dev) == pdev) {
10921090 vfs++;
10931091 if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
10941092 assigned_vfs++;
@@ -1896,6 +1894,8 @@ static int be_tx_qs_create(struct be_adapter *adapter) · 801 unmodified lines
18961894 return status;
18971895 }
18981896
1897+ dev_info(&adapter->pdev->dev, "created %d TX queue(s)\n",
1898+ adapter->num_tx_qs);
18991899 return 0;
19001900 }
19011901
@@ -1946,10 +1946,9 @@ static int be_rx_cqs_create(struct be_adapter *adapter) · 44 unmodified lines
19461946 return rc;
19471947 }
19481948
1949− if (adapter->num_rx_qs != MAX_RX_QS)
1950− dev_info(&adapter->pdev->dev,
1951− "Created only %d receive queues\n", adapter->num_rx_qs);
1952−
1949+ dev_info(&adapter->pdev->dev,
1950+ "created %d RSS queue(s) and 1 default RX queue\n",
1951+ adapter->num_rx_qs - 1);
19531952 return 0;
19541953 }
19551954
@@ -2176,8 +2175,7 @@ static uint be_num_rss_want(struct be_adapter *adapter) · 220 unmodified lines
21762175 {
21772176 u32 num = 0;
21782177 if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) &&
2179− !sriov_want(adapter) && be_physfn(adapter) &&
2180− !be_is_mc(adapter)) {
2178+ !sriov_want(adapter) && be_physfn(adapter)) {
21812179 num = (adapter->be3_native) ? BE3_MAX_RSS_QS : BE2_MAX_RSS_QS;
21822180 num = min_t(u32, num, (u32)netif_get_num_default_rss_queues());
21832181 }
@@ -2188,6 +2186,7 @@ static void be_msix_enable(struct be_adapter *adapter) · 4 unmodified lines
21882186 {
21892187 #define BE_MIN_MSIX_VECTORS 1
21902188 int i, status, num_vec, num_roce_vec = 0;
2189+ struct device *dev = &adapter->pdev->dev;
21912190
21922191 /* If RSS queues are not used, need a vec for default RX Q */
21932192 num_vec = min(be_num_rss_want(adapter), num_online_cpus());
@@ -2212,6 +2211,8 @@ static void be_msix_enable(struct be_adapter *adapter) · 18 unmodified lines
22122211 num_vec) == 0)
22132212 goto done;
22142213 }
2214+
2215+ dev_warn(dev, "MSIx enable failed\n");
22152216 return;
22162217 done:
22172218 if (be_roce_supported(adapter)) {
@@ -2225,6 +2226,7 @@ done: · 7 unmodified lines
22252226 }
22262227 } else
22272228 adapter->num_msix_vec = num_vec;
2229+ dev_info(dev, "enabled %d MSI-x vector(s)\n", adapter->num_msix_vec);
22282230 return;
22292231 }
22302232
@@ -2441,8 +2443,7 @@ static int be_open(struct net_device *netdev) · 210 unmodified lines
24412443 be_eq_notify(adapter, eqo->q.id, true, false, 0);
24422444 }
24432445
2444− status = be_cmd_link_status_query(adapter, NULL, NULL,
2445− &link_status, 0);
2446+ status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
24462447 if (!status)
24472448 be_link_status_update(adapter, link_status);
24482449
@@ -2646,8 +2647,8 @@ static int be_vf_setup(struct be_adapter *adapter) · 197 unmodified lines
26462647 }
26472648
26482649 for_all_vfs(adapter, vf_cfg, vf) {
2649− status = be_cmd_link_status_query(adapter, NULL, &lnk_speed,
2650− NULL, vf + 1);
2650+ lnk_speed = 1000;
2651+ status = be_cmd_set_qos(adapter, lnk_speed, vf + 1);
26512652 if (status)
26522653 goto err;
26532654 vf_cfg->tx_rate = lnk_speed * 10;
@@ -2671,7 +2672,6 @@ static void be_setup_init(struct be_adapter *adapter) · 17 unmodified lines
26712672 adapter->be3_native = false;
26722673 adapter->promiscuous = false;
26732674 adapter->eq_next_idx = 0;
2674− adapter->phy.forced_port_speed = -1;
26752675 }
26762676
26772677 static int be_get_mac_addr(struct be_adapter *adapter, u8 *mac, u32 if_handle,
@@ -2693,21 +2693,16 @@ static int be_get_mac_addr(struct be_adapter *adapter, u8 *mac, u32 if_handle, · 15 unmodified lines
26932693 status = be_cmd_get_mac_from_list(adapter, mac,
26942694 active_mac, pmac_id, 0);
26952695 if (*active_mac) {
2696− status = be_cmd_mac_addr_query(adapter, mac,
2697− MAC_ADDRESS_TYPE_NETWORK,
2698− false, if_handle,
2699− *pmac_id);
2696+ status = be_cmd_mac_addr_query(adapter, mac, false,
2697+ if_handle, *pmac_id);
27002698 }
27012699 } else if (be_physfn(adapter)) {
27022700 /* For BE3, for PF get permanent MAC */
2703− status = be_cmd_mac_addr_query(adapter, mac,
2704− MAC_ADDRESS_TYPE_NETWORK, true,
2705− 0, 0);
2701+ status = be_cmd_mac_addr_query(adapter, mac, true, 0, 0);
27062702 *active_mac = false;
27072703 } else {
27082704 /* For BE3, for VF get soft MAC assigned by PF*/
2709− status = be_cmd_mac_addr_query(adapter, mac,
2710− MAC_ADDRESS_TYPE_NETWORK, false,
2705+ status = be_cmd_mac_addr_query(adapter, mac, false,
27112706 if_handle, 0);
27122707 *active_mac = true;
27132708 }
@@ -2724,6 +2719,8 @@ static int be_get_config(struct be_adapter *adapter) · 10 unmodified lines
27242719 if (pos) {
27252720 pci_read_config_word(adapter->pdev, pos + PCI_SRIOV_TOTAL_VF,
27262721 &dev_num_vfs);
2722+ if (!lancer_chip(adapter))
2723+ dev_num_vfs = min_t(u16, dev_num_vfs, MAX_VFS);
27272724 adapter->dev_num_vfs = dev_num_vfs;
27282725 }
27292726 return 0;
@@ -3437,6 +3434,7 @@ static void be_ctrl_cleanup(struct be_adapter *adapter) · 707 unmodified lines
34373434 if (mem->va)
34383435 dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
34393436 mem->dma);
3437+ kfree(adapter->pmac_id);
34403438 }
34413439
34423440 static int be_ctrl_init(struct be_adapter *adapter)
@@ -3473,6 +3471,12 @@ static int be_ctrl_init(struct be_adapter *adapter) · 30 unmodified lines
34733471 }
34743472 memset(rx_filter->va, 0, rx_filter->size);
34753473
3474+ /* primary mac needs 1 pmac entry */
3475+ adapter->pmac_id = kcalloc(adapter->max_pmac_cnt + 1,
3476+ sizeof(*adapter->pmac_id), GFP_KERNEL);
3477+ if (!adapter->pmac_id)
3478+ return -ENOMEM;
3479+
34763480 mutex_init(&adapter->mbox_lock);
34773481 spin_lock_init(&adapter->mcc_lock);
34783482 spin_lock_init(&adapter->mcc_cq_lock);
@@ -3543,6 +3547,8 @@ static void __devexit be_remove(struct pci_dev *pdev) · 64 unmodified lines
35433547
35443548 be_ctrl_cleanup(adapter);
35453549
3550+ pci_disable_pcie_error_reporting(pdev);
3551+
35463552 pci_set_drvdata(pdev, NULL);
35473553 pci_release_regions(pdev);
35483554 pci_disable_device(pdev);
@@ -3609,12 +3615,6 @@ static int be_get_initial_config(struct be_adapter *adapter) · 60 unmodified lines
36093615 else
36103616 adapter->max_pmac_cnt = BE_VF_UC_PMAC_COUNT;
36113617
3612− /* primary mac needs 1 pmac entry */
3613− adapter->pmac_id = kcalloc(adapter->max_pmac_cnt + 1,
3614− sizeof(u32), GFP_KERNEL);
3615− if (!adapter->pmac_id)
3616− return -ENOMEM;
3617−
36183618 status = be_cmd_get_cntl_attributes(adapter);
36193619 if (status)
36203620 return status;
@@ -3800,6 +3800,23 @@ static bool be_reset_required(struct be_adapter *adapter) · 179 unmodified lines
38003800 return be_find_vfs(adapter, ENABLED) > 0 ? false : true;
38013801 }
38023802
3803+static char *mc_name(struct be_adapter *adapter)
3804+{
3805+ if (adapter->function_mode & FLEX10_MODE)
3806+ return "FLEX10";
3807+ else if (adapter->function_mode & VNIC_MODE)
3808+ return "vNIC";
3809+ else if (adapter->function_mode & UMC_ENABLED)
3810+ return "UMC";
3811+ else
3812+ return "";
3813+}
3814+
3815+static inline char *func_name(struct be_adapter *adapter)
3816+{
3817+ return be_physfn(adapter) ? "PF" : "VF";
3818+}
3819+
38033820 static int __devinit be_probe(struct pci_dev *pdev,
38043821 const struct pci_device_id *pdev_id)
38053822 {
@@ -3844,6 +3861,10 @@ static int __devinit be_probe(struct pci_dev *pdev, · 38 unmodified lines
38443861 }
38453862 }
38463863
3864+ status = pci_enable_pcie_error_reporting(pdev);
3865+ if (status)
3866+ dev_err(&pdev->dev, "Could not use PCIe error reporting\n");
3867+
38473868 status = be_ctrl_init(adapter);
38483869 if (status)
38493870 goto free_netdev;
@@ -3886,7 +3907,7 @@ static int __devinit be_probe(struct pci_dev *pdev, · 36 unmodified lines
38863907
38873908 status = be_setup(adapter);
38883909 if (status)
3889− goto msix_disable;
3910+ goto stats_clean;
38903911
38913912 be_netdev_init(netdev);
38923913 status = register_netdev(netdev);
@@ -3900,15 +3921,13 @@ static int __devinit be_probe(struct pci_dev *pdev, · 7 unmodified lines
39003921
39013922 be_cmd_query_port_name(adapter, &port_name);
39023923
3903− dev_info(&pdev->dev, "%s: %s port %c\n", netdev->name, nic_name(pdev),
3904− port_name);
3924+ dev_info(&pdev->dev, "%s: %s %s port %c\n", nic_name(pdev),
3925+ func_name(adapter), mc_name(adapter), port_name);
39053926
39063927 return 0;
39073928
39083929 unsetup:
39093930 be_clear(adapter);
3910−msix_disable:
3911− be_msix_disable(adapter);
39123931 stats_clean:
39133932 be_stats_cleanup(adapter);
39143933 ctrl_clean:
@@ -4066,6 +4085,7 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) · 151 unmodified lines
40664085 if (status)
40674086 return PCI_ERS_RESULT_DISCONNECT;
40684087
4088+ pci_cleanup_aer_uncorrect_error_status(pdev);
40694089 return PCI_ERS_RESULT_RECOVERED;
40704090 }
40714091
drivers/net/ethernet/freescale/Kconfig+7−0
@@ -62,6 +62,13 @@ config FSL_PQ_MDIO · 61 unmodified lines
6262 ---help---
6363 This driver supports the MDIO bus used by the gianfar and UCC drivers.
6464
65+config FSL_XGMAC_MDIO
66+ tristate "Freescale XGMAC MDIO"
67+ depends on FSL_SOC
68+ select PHYLIB
69+ ---help---
70+ This driver supports the MDIO bus on the Fman 10G Ethernet MACs.
71+
6572 config UCC_GETH
6673 tristate "Freescale QE Gigabit Ethernet"
6774 depends on QUICC_ENGINE
drivers/net/ethernet/freescale/Makefile+1−0
@@ -9,6 +9,7 @@ ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y) · 8 unmodified lines
99 endif
1010 obj-$(CONFIG_FS_ENET) += fs_enet/
1111 obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
12+obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
1213 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
1314 obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o
1415 gianfar_driver-objs := gianfar.o \
drivers/net/ethernet/freescale/fsl_pq_mdio.c+292−257
@@ -19,54 +19,90 @@ · 18 unmodified lines
1919 #include <linux/kernel.h>
2020 #include <linux/string.h>
2121 #include <linux/errno.h>
22−#include <linux/unistd.h>
2322 #include <linux/slab.h>
24−#include <linux/interrupt.h>
2523 #include <linux/init.h>
2624 #include <linux/delay.h>
27−#include <linux/netdevice.h>
28−#include <linux/etherdevice.h>
29−#include <linux/skbuff.h>
30−#include <linux/spinlock.h>
31−#include <linux/mm.h>
3225 #include <linux/module.h>
33−#include <linux/platform_device.h>
34−#include <linux/crc32.h>
3526 #include <linux/mii.h>
36−#include <linux/phy.h>
37−#include <linux/of.h>
3827 #include <linux/of_address.h>
3928 #include <linux/of_mdio.h>
40−#include <linux/of_platform.h>
29+#include <linux/of_device.h>
4130
4231 #include <asm/io.h>
43−#include <asm/irq.h>
44−#include <asm/uaccess.h>
45−#include <asm/ucc.h>
32+#include <asm/ucc.h> /* for ucc_set_qe_mux_mii_mng() */
4633
4734 #include "gianfar.h"
48−#include "fsl_pq_mdio.h"
35+
36+#define MIIMIND_BUSY 0x00000001
37+#define MIIMIND_NOTVALID 0x00000004
38+#define MIIMCFG_INIT_VALUE 0x00000007
39+#define MIIMCFG_RESET 0x80000000
40+
41+#define MII_READ_COMMAND 0x00000001
42+
43+struct fsl_pq_mii {
44+ u32 miimcfg; /* MII management configuration reg */
45+ u32 miimcom; /* MII management command reg */
46+ u32 miimadd; /* MII management address reg */
47+ u32 miimcon; /* MII management control reg */
48+ u32 miimstat; /* MII management status reg */
49+ u32 miimind; /* MII management indication reg */
50+};
51+
52+struct fsl_pq_mdio {
53+ u8 res1[16];
54+ u32 ieventm; /* MDIO Interrupt event register (for etsec2)*/
55+ u32 imaskm; /* MDIO Interrupt mask register (for etsec2)*/
56+ u8 res2[4];
57+ u32 emapm; /* MDIO Event mapping register (for etsec2)*/
58+ u8 res3[1280];
59+ struct fsl_pq_mii mii;
60+ u8 res4[28];
61+ u32 utbipar; /* TBI phy address reg (only on UCC) */
62+ u8 res5[2728];
63+} __packed;
4964
5065 /* Number of microseconds to wait for an MII register to respond */
5166 #define MII_TIMEOUT 1000
5267
5368 struct fsl_pq_mdio_priv {
5469 void __iomem *map;
55− struct fsl_pq_mdio __iomem *regs;
70+ struct fsl_pq_mii __iomem *regs;
71+ int irqs[PHY_MAX_ADDR];
72+};
73+
74+/*
75+ * Per-device-type data. Each type of device tree node that we support gets
76+ * one of these.
77+ *
78+ * @mii_offset: the offset of the MII registers within the memory map of the
79+ * node. Some nodes define only the MII registers, and some define the whole
80+ * MAC (which includes the MII registers).
81+ *
82+ * @get_tbipa: determines the address of the TBIPA register
83+ *
84+ * @ucc_configure: a special function for extra QE configuration
85+ */
86+struct fsl_pq_mdio_data {
87+ unsigned int mii_offset; /* offset of the MII registers */
88+ uint32_t __iomem * (*get_tbipa)(void __iomem *p);
89+ void (*ucc_configure)(phys_addr_t start, phys_addr_t end);
5690 };
5791
5892 /*
59− * Write value to the PHY at mii_id at register regnum,
60− * on the bus attached to the local interface, which may be different from the
61− * generic mdio bus (tied to a single interface), waiting until the write is
62− * done before returning. This is helpful in programming interfaces like
63− * the TBI which control interfaces like onchip SERDES and are always tied to
64− * the local mdio pins, which may not be the same as system mdio bus, used for
93+ * Write value to the PHY at mii_id at register regnum, on the bus attached
94+ * to the local interface, which may be different from the generic mdio bus
95+ * (tied to a single interface), waiting until the write is done before
96+ * returning. This is helpful in programming interfaces like the TBI which
97+ * control interfaces like onchip SERDES and are always tied to the local
98+ * mdio pins, which may not be the same as system mdio bus, used for
6599 * controlling the external PHYs, for example.
66100 */
67−int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,
68− int regnum, u16 value)
101+static int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
102+ u16 value)
69103 {
104+ struct fsl_pq_mdio_priv *priv = bus->priv;
105+ struct fsl_pq_mii __iomem *regs = priv->regs;
70106 u32 status;
71107
72108 /* Set the PHY address and the register address we want to write */
@@ -83,20 +119,21 @@ int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id, · 10 unmodified lines
83119 }
84120
85121 /*
86− * Read the bus for PHY at addr mii_id, register regnum, and
87− * return the value. Clears miimcom first. All PHY operation
88− * done on the bus attached to the local interface,
89− * which may be different from the generic mdio bus
90− * This is helpful in programming interfaces like
91− * the TBI which, in turn, control interfaces like onchip SERDES
92− * and are always tied to the local mdio pins, which may not be the
122+ * Read the bus for PHY at addr mii_id, register regnum, and return the value.
123+ * Clears miimcom first.
124+ *
125+ * All PHY operation done on the bus attached to the local interface, which
126+ * may be different from the generic mdio bus. This is helpful in programming
127+ * interfaces like the TBI which, in turn, control interfaces like on-chip
128+ * SERDES and are always tied to the local mdio pins, which may not be the
93129 * same as system mdio bus, used for controlling the external PHYs, for eg.
94130 */
95−int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,
96− int mii_id, int regnum)
131+static int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
97132 {
98− u16 value;
133+ struct fsl_pq_mdio_priv *priv = bus->priv;
134+ struct fsl_pq_mii __iomem *regs = priv->regs;
99135 u32 status;
136+ u16 value;
100137
101138 /* Set the PHY address and the register address we want to read */
102139 out_be32(&regs->miimadd, (mii_id << 8) | regnum);
@@ -115,44 +152,15 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs, · 12 unmodified lines
115152 /* Grab the value of the register from miimstat */
116153 value = in_be32(&regs->miimstat);
117154
155+ dev_dbg(&bus->dev, "read %04x from address %x/%x\n", value, mii_id, regnum);
118156 return value;
119157 }
120158
121−static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus)
122−{
123− struct fsl_pq_mdio_priv *priv = bus->priv;
124−
125− return priv->regs;
126−}
127−
128−/*
129− * Write value to the PHY at mii_id at register regnum,
130− * on the bus, waiting until the write is done before returning.
131− */
132−int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
133−{
134− struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
135−
136− /* Write to the local MII regs */
137− return fsl_pq_local_mdio_write(regs, mii_id, regnum, value);
138−}
139−
140−/*
141− * Read the bus for PHY at addr mii_id, register regnum, and
142− * return the value. Clears miimcom first.
143− */
144−int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
145−{
146− struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
147−
148− /* Read the local MII regs */
149− return fsl_pq_local_mdio_read(regs, mii_id, regnum);
150−}
151−
152159 /* Reset the MIIM registers, and wait for the bus to free */
153160 static int fsl_pq_mdio_reset(struct mii_bus *bus)
154161 {
155− struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
162+ struct fsl_pq_mdio_priv *priv = bus->priv;
163+ struct fsl_pq_mii __iomem *regs = priv->regs;
156164 u32 status;
157165
158166 mutex_lock(&bus->mdio_lock);
@@ -170,234 +178,291 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus) · 11 unmodified lines
170178 mutex_unlock(&bus->mdio_lock);
171179
172180 if (!status) {
173− printk(KERN_ERR "%s: The MII Bus is stuck!\n",
174− bus->name);
181+ dev_err(&bus->dev, "timeout waiting for MII bus\n");
175182 return -EBUSY;
176183 }
177184
178185 return 0;
179186 }
180187
181−void fsl_pq_mdio_bus_name(char *name, struct device_node *np)
188+#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
189+/*
190+ * This is mildly evil, but so is our hardware for doing this.
191+ * Also, we have to cast back to struct gfar because of
192+ * definition weirdness done in gianfar.h.
193+ */
194+static uint32_t __iomem *get_gfar_tbipa(void __iomem *p)
182195 {
183− const u32 *addr;
184− u64 taddr = OF_BAD_ADDR;
185−
186− addr = of_get_address(np, 0, NULL, NULL);
187− if (addr)
188− taddr = of_translate_address(np, addr);
196+ struct gfar __iomem *enet_regs = p;
189197
190− snprintf(name, MII_BUS_ID_SIZE, "%s@%llx", np->name,
191− (unsigned long long)taddr);
198+ return &enet_regs->tbipa;
192199 }
193−EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);
194200
201+/*
202+ * Return the TBIPAR address for an eTSEC2 node
203+ */
204+static uint32_t __iomem *get_etsec_tbipa(void __iomem *p)
205+{
206+ return p;
207+}
208+#endif
195209
196−static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np)
210+#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
211+/*
212+ * Return the TBIPAR address for a QE MDIO node
213+ */
214+static uint32_t __iomem *get_ucc_tbipa(void __iomem *p)
197215 {
198−#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
199− struct gfar __iomem *enet_regs;
216+ struct fsl_pq_mdio __iomem *mdio = p;
200217
201− /*
202− * This is mildly evil, but so is our hardware for doing this.
203− * Also, we have to cast back to struct gfar because of
204− * definition weirdness done in gianfar.h.
205− */
206− if(of_device_is_compatible(np, "fsl,gianfar-mdio") ||
207− of_device_is_compatible(np, "fsl,gianfar-tbi") ||
208− of_device_is_compatible(np, "gianfar")) {
209− enet_regs = (struct gfar __iomem *)regs;
210− return &enet_regs->tbipa;
211− } else if (of_device_is_compatible(np, "fsl,etsec2-mdio") ||
212− of_device_is_compatible(np, "fsl,etsec2-tbi")) {
213− return of_iomap(np, 1);
214− }
215−#endif
216− return NULL;
218+ return &mdio->utbipar;
217219 }
218220
219−
220−static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
221+/*
222+ * Find the UCC node that controls the given MDIO node
223+ *
224+ * For some reason, the QE MDIO nodes are not children of the UCC devices
225+ * that control them. Therefore, we need to scan all UCC nodes looking for
226+ * the one that encompases the given MDIO node. We do this by comparing
227+ * physical addresses. The 'start' and 'end' addresses of the MDIO node are
228+ * passed, and the correct UCC node will cover the entire address range.
229+ *
230+ * This assumes that there is only one QE MDIO node in the entire device tree.
231+ */
232+static void ucc_configure(phys_addr_t start, phys_addr_t end)
221233 {
222−#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
234+ static bool found_mii_master;
223235 struct device_node *np = NULL;
224− int err = 0;
225236
226− for_each_compatible_node(np, NULL, "ucc_geth") {
227− struct resource tempres;
237+ if (found_mii_master)
238+ return;
228239
229− err = of_address_to_resource(np, 0, &tempres);
230− if (err)
240+ for_each_compatible_node(np, NULL, "ucc_geth") {
241+ struct resource res;
242+ const uint32_t *iprop;
243+ uint32_t id;
244+ int ret;
245+
246+ ret = of_address_to_resource(np, 0, &res);
247+ if (ret < 0) {
248+ pr_debug("fsl-pq-mdio: no address range in node %s\n",
249+ np->full_name);
231250 continue;
251+ }
232252
233253 /* if our mdio regs fall within this UCC regs range */
234− if ((start >= tempres.start) && (end <= tempres.end)) {
235− /* Find the id of the UCC */
236− const u32 *id;
237−
238− id = of_get_property(np, "cell-index", NULL);
239− if (!id) {
240− id = of_get_property(np, "device-id", NULL);
241− if (!id)
242− continue;
254+ if ((start < res.start) || (end > res.end))
255+ continue;
256+
257+ iprop = of_get_property(np, "cell-index", NULL);
258+ if (!iprop) {
259+ iprop = of_get_property(np, "device-id", NULL);
260+ if (!iprop) {
261+ pr_debug("fsl-pq-mdio: no UCC ID in node %s\n",
262+ np->full_name);
263+ continue;
243264 }
265+ }
244266
245− *ucc_id = *id;
267+ id = be32_to_cpup(iprop);
246268
247− return 0;
269+ /*
270+ * cell-index and device-id for QE nodes are
271+ * numbered from 1, not 0.
272+ */
273+ if (ucc_set_qe_mux_mii_mng(id - 1) < 0) {
274+ pr_debug("fsl-pq-mdio: invalid UCC ID in node %s\n",
275+ np->full_name);
276+ continue;
248277 }
278+
279+ pr_debug("fsl-pq-mdio: setting node UCC%u to MII master\n", id);
280+ found_mii_master = true;
249281 }
282+}
250283
251− if (err)
252− return err;
253− else
254− return -EINVAL;
255−#else
256− return -ENODEV;
257284 #endif
258−}
259285
260−static int fsl_pq_mdio_probe(struct platform_device *ofdev)
286+static struct of_device_id fsl_pq_mdio_match[] = {
287+#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
288+ {
289+ .compatible = "fsl,gianfar-tbi",
290+ .data = &(struct fsl_pq_mdio_data) {
291+ .mii_offset = 0,
292+ .get_tbipa = get_gfar_tbipa,
293+ },
294+ },
295+ {
296+ .compatible = "fsl,gianfar-mdio",
297+ .data = &(struct fsl_pq_mdio_data) {
298+ .mii_offset = 0,
299+ .get_tbipa = get_gfar_tbipa,
300+ },
301+ },
302+ {
303+ .type = "mdio",
304+ .compatible = "gianfar",
305+ .data = &(struct fsl_pq_mdio_data) {
306+ .mii_offset = offsetof(struct fsl_pq_mdio, mii),
307+ .get_tbipa = get_gfar_tbipa,
308+ },
309+ },
310+ {
311+ .compatible = "fsl,etsec2-tbi",
312+ .data = &(struct fsl_pq_mdio_data) {
313+ .mii_offset = offsetof(struct fsl_pq_mdio, mii),
314+ .get_tbipa = get_etsec_tbipa,
315+ },
316+ },
317+ {
318+ .compatible = "fsl,etsec2-mdio",
319+ .data = &(struct fsl_pq_mdio_data) {
320+ .mii_offset = offsetof(struct fsl_pq_mdio, mii),
321+ .get_tbipa = get_etsec_tbipa,
322+ },
323+ },
324+#endif
325+#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
326+ {
327+ .compatible = "fsl,ucc-mdio",
328+ .data = &(struct fsl_pq_mdio_data) {
329+ .mii_offset = 0,
330+ .get_tbipa = get_ucc_tbipa,
331+ .ucc_configure = ucc_configure,
332+ },
333+ },
334+ {
335+ /* Legacy UCC MDIO node */
336+ .type = "mdio",
337+ .compatible = "ucc_geth_phy",
338+ .data = &(struct fsl_pq_mdio_data) {
339+ .mii_offset = 0,
340+ .get_tbipa = get_ucc_tbipa,
341+ .ucc_configure = ucc_configure,
342+ },
343+ },
344+#endif
345+ /* No Kconfig option for Fman support yet */
346+ {
347+ .compatible = "fsl,fman-mdio",
348+ .data = &(struct fsl_pq_mdio_data) {
349+ .mii_offset = 0,
350+ /* Fman TBI operations are handled elsewhere */
351+ },
352+ },
353+
354+ {},
355+};
356+MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
357+
358+static int fsl_pq_mdio_probe(struct platform_device *pdev)
261359 {
262− struct device_node *np = ofdev->dev.of_node;
360+ const struct of_device_id *id =
361+ of_match_device(fsl_pq_mdio_match, &pdev->dev);
362+ const struct fsl_pq_mdio_data *data = id->data;
363+ struct device_node *np = pdev->dev.of_node;
364+ struct resource res;
263365 struct device_node *tbi;
264366 struct fsl_pq_mdio_priv *priv;
265− struct fsl_pq_mdio __iomem *regs = NULL;
266− void __iomem *map;
267− u32 __iomem *tbipa;
268367 struct mii_bus *new_bus;
269− int tbiaddr = -1;
270− const u32 *addrp;
271− u64 addr = 0, size = 0;
272368 int err;
273369
274− priv = kzalloc(sizeof(*priv), GFP_KERNEL);
275− if (!priv)
276− return -ENOMEM;
370+ dev_dbg(&pdev->dev, "found %s compatible node\n", id->compatible);
277371
278− new_bus = mdiobus_alloc();
279− if (!new_bus) {
280− err = -ENOMEM;
281− goto err_free_priv;
282− }
372+ new_bus = mdiobus_alloc_size(sizeof(*priv));
373+ if (!new_bus)
374+ return -ENOMEM;
283375
376+ priv = new_bus->priv;
284377 new_bus->name = "Freescale PowerQUICC MII Bus",
285− new_bus->read = &fsl_pq_mdio_read,
286− new_bus->write = &fsl_pq_mdio_write,
287− new_bus->reset = &fsl_pq_mdio_reset,
288− new_bus->priv = priv;
289− fsl_pq_mdio_bus_name(new_bus->id, np);
290−
291− addrp = of_get_address(np, 0, &size, NULL);
292− if (!addrp) {
293− err = -EINVAL;
294− goto err_free_bus;
378+ new_bus->read = &fsl_pq_mdio_read;
379+ new_bus->write = &fsl_pq_mdio_write;
380+ new_bus->reset = &fsl_pq_mdio_reset;
381+ new_bus->irq = priv->irqs;
382+
383+ err = of_address_to_resource(np, 0, &res);
384+ if (err < 0) {
385+ dev_err(&pdev->dev, "could not obtain address information\n");
386+ goto error;
295387 }
296388
297− /* Set the PHY base address */
298− addr = of_translate_address(np, addrp);
299− if (addr == OF_BAD_ADDR) {
300− err = -EINVAL;
301− goto err_free_bus;
302− }
389+ snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s@%llx", np->name,
390+ (unsigned long long)res.start);
303391
304− map = ioremap(addr, size);
305− if (!map) {
392+ priv->map = of_iomap(np, 0);
393+ if (!priv->map) {
306394 err = -ENOMEM;
307− goto err_free_bus;
395+ goto error;
308396 }
309− priv->map = map;
310−
311− if (of_device_is_compatible(np, "fsl,gianfar-mdio") ||
312− of_device_is_compatible(np, "fsl,gianfar-tbi") ||
313− of_device_is_compatible(np, "fsl,ucc-mdio") ||
314− of_device_is_compatible(np, "ucc_geth_phy"))
315− map -= offsetof(struct fsl_pq_mdio, miimcfg);
316− regs = map;
317− priv->regs = regs;
318−
319− new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
320397
321− if (NULL == new_bus->irq) {
322− err = -ENOMEM;
323− goto err_unmap_regs;
398+ /*
399+ * Some device tree nodes represent only the MII registers, and
400+ * others represent the MAC and MII registers. The 'mii_offset' field
401+ * contains the offset of the MII registers inside the mapped register
402+ * space.
403+ */
404+ if (data->mii_offset > resource_size(&res)) {
405+ dev_err(&pdev->dev, "invalid register map\n");
406+ err = -EINVAL;
407+ goto error;
324408 }
409+ priv->regs = priv->map + data->mii_offset;
325410
326− new_bus->parent = &ofdev->dev;
327− dev_set_drvdata(&ofdev->dev, new_bus);
328−
329− if (of_device_is_compatible(np, "fsl,gianfar-mdio") ||
330− of_device_is_compatible(np, "fsl,gianfar-tbi") ||
331− of_device_is_compatible(np, "fsl,etsec2-mdio") ||
332− of_device_is_compatible(np, "fsl,etsec2-tbi") ||
333− of_device_is_compatible(np, "gianfar")) {
334− tbipa = get_gfar_tbipa(regs, np);
335− if (!tbipa) {
336− err = -EINVAL;
337− goto err_free_irqs;
338− }
339− } else if (of_device_is_compatible(np, "fsl,ucc-mdio") ||
340− of_device_is_compatible(np, "ucc_geth_phy")) {
341− u32 id;
342− static u32 mii_mng_master;
343−
344− tbipa = &regs->utbipar;
345−
346− if ((err = get_ucc_id_for_range(addr, addr + size, &id)))
347− goto err_free_irqs;
411+ new_bus->parent = &pdev->dev;
412+ dev_set_drvdata(&pdev->dev, new_bus);
348413
349− if (!mii_mng_master) {
350− mii_mng_master = id;
351− ucc_set_qe_mux_mii_mng(id - 1);
414+ if (data->get_tbipa) {
415+ for_each_child_of_node(np, tbi) {
416+ if (strcmp(tbi->type, "tbi-phy") == 0) {
417+ dev_dbg(&pdev->dev, "found TBI PHY node %s\n",
418+ strrchr(tbi->full_name, '/') + 1);
419+ break;
420+ }
352421 }
353− } else {
354− err = -ENODEV;
355− goto err_free_irqs;
356− }
357422
358− for_each_child_of_node(np, tbi) {
359− if (!strncmp(tbi->type, "tbi-phy", 8))
360− break;
361− }
423+ if (tbi) {
424+ const u32 *prop = of_get_property(tbi, "reg", NULL);
425+ uint32_t __iomem *tbipa;
362426
363− if (tbi) {
364− const u32 *prop = of_get_property(tbi, "reg", NULL);
427+ if (!prop) {
428+ dev_err(&pdev->dev,
429+ "missing 'reg' property in node %s\n",
430+ tbi->full_name);
431+ err = -EBUSY;
432+ goto error;
433+ }
365434
366− if (prop)
367− tbiaddr = *prop;
435+ tbipa = data->get_tbipa(priv->map);
368436
369− if (tbiaddr == -1) {
370− err = -EBUSY;
371− goto err_free_irqs;
372− } else {
373− out_be32(tbipa, tbiaddr);
437+ out_be32(tbipa, be32_to_cpup(prop));
374438 }
375439 }
376440
441+ if (data->ucc_configure)
442+ data->ucc_configure(res.start, res.end);
443+
377444 err = of_mdiobus_register(new_bus, np);
378445 if (err) {
379− printk (KERN_ERR "%s: Cannot register as MDIO bus\n",
380− new_bus->name);
381− goto err_free_irqs;
446+ dev_err(&pdev->dev, "cannot register %s as MDIO bus\n",
447+ new_bus->name);
448+ goto error;
382449 }
383450
384451 return 0;
385452
386−err_free_irqs:
387− kfree(new_bus->irq);
388−err_unmap_regs:
389− iounmap(priv->map);
390−err_free_bus:
453+error:
454+ if (priv->map)
455+ iounmap(priv->map);
456+
391457 kfree(new_bus);
392−err_free_priv:
393− kfree(priv);
458+
394459 return err;
395460 }
396461
397462
398−static int fsl_pq_mdio_remove(struct platform_device *ofdev)
463+static int fsl_pq_mdio_remove(struct platform_device *pdev)
399464 {
400− struct device *device = &ofdev->dev;
465+ struct device *device = &pdev->dev;
401466 struct mii_bus *bus = dev_get_drvdata(device);
402467 struct fsl_pq_mdio_priv *priv = bus->priv;
403468
@@ -406,41 +471,11 @@ static int fsl_pq_mdio_remove(struct platform_device *ofdev) · 2 unmodified lines
406471 dev_set_drvdata(device, NULL);
407472
408473 iounmap(priv->map);
409− bus->priv = NULL;
410474 mdiobus_free(bus);
411− kfree(priv);
412475
413476 return 0;
414477 }
415478
416−static struct of_device_id fsl_pq_mdio_match[] = {
417− {
418− .type = "mdio",
419− .compatible = "ucc_geth_phy",
420− },
421− {
422− .type = "mdio",
423− .compatible = "gianfar",
424− },
425− {
426− .compatible = "fsl,ucc-mdio",
427− },
428− {
429− .compatible = "fsl,gianfar-tbi",
430− },
431− {
432− .compatible = "fsl,gianfar-mdio",
433− },
434− {
435− .compatible = "fsl,etsec2-tbi",
436− },
437− {
438− .compatible = "fsl,etsec2-mdio",
439− },
440− {},
441−};
442−MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
443−
444479 static struct platform_driver fsl_pq_mdio_driver = {
445480 .driver = {
446481 .name = "fsl-pq_mdio",
drivers/net/ethernet/freescale/fsl_pq_mdio.h+0−52
@@ -1,52 +0,0 @@
1−/*
2− * Freescale PowerQUICC MDIO Driver -- MII Management Bus Implementation
3− * Driver for the MDIO bus controller on Freescale PowerQUICC processors
4− *
5− * Author: Andy Fleming
6− * Modifier: Sandeep Gopalpet
7− *
8− * Copyright 2002-2004, 2008-2009 Freescale Semiconductor, Inc.
9− *
10− * This program is free software; you can redistribute it and/or modify it
11− * under the terms of the GNU General Public License as published by the
12− * Free Software Foundation; either version 2 of the License, or (at your
13− * option) any later version.
14− *
15− */
16−#ifndef __FSL_PQ_MDIO_H
17−#define __FSL_PQ_MDIO_H
18−
19−#define MIIMIND_BUSY 0x00000001
20−#define MIIMIND_NOTVALID 0x00000004
21−#define MIIMCFG_INIT_VALUE 0x00000007
22−#define MIIMCFG_RESET 0x80000000
23−
24−#define MII_READ_COMMAND 0x00000001
25−
26−struct fsl_pq_mdio {
27− u8 res1[16];
28− u32 ieventm; /* MDIO Interrupt event register (for etsec2)*/
29− u32 imaskm; /* MDIO Interrupt mask register (for etsec2)*/
30− u8 res2[4];
31− u32 emapm; /* MDIO Event mapping register (for etsec2)*/
32− u8 res3[1280];
33− u32 miimcfg; /* MII management configuration reg */
34− u32 miimcom; /* MII management command reg */
35− u32 miimadd; /* MII management address reg */
36− u32 miimcon; /* MII management control reg */
37− u32 miimstat; /* MII management status reg */
38− u32 miimind; /* MII management indication reg */
39− u8 reserved[28]; /* Space holder */
40− u32 utbipar; /* TBI phy address reg (only on UCC) */
41− u8 res4[2728];
42−} __packed;
43−
44−int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
45−int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
46−int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,
47− int regnum, u16 value);
48−int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs, int mii_id, int regnum);
49−int __init fsl_pq_mdio_init(void);
50−void fsl_pq_mdio_exit(void);
51−void fsl_pq_mdio_bus_name(char *name, struct device_node *np);
52−#endif /* FSL_PQ_MDIO_H */
drivers/net/ethernet/freescale/gianfar.c+10−2
@@ -100,7 +100,6 @@ · 99 unmodified lines
100100 #include <linux/of_net.h>
101101
102102 #include "gianfar.h"
103−#include "fsl_pq_mdio.h"
104103
105104 #define TX_TIMEOUT (1*HZ)
106105
@@ -395,7 +394,13 @@ static void gfar_init_mac(struct net_device *ndev) · 288 unmodified lines
395394 if (ndev->features & NETIF_F_IP_CSUM)
396395 tctrl |= TCTRL_INIT_CSUM;
397396
398− tctrl |= TCTRL_TXSCHED_PRIO;
397+ if (priv->prio_sched_en)
398+ tctrl |= TCTRL_TXSCHED_PRIO;
399+ else {
400+ tctrl |= TCTRL_TXSCHED_WRRS;
401+ gfar_write(&regs->tr03wt, DEFAULT_WRRS_WEIGHT);
402+ gfar_write(&regs->tr47wt, DEFAULT_WRRS_WEIGHT);
403+ }
399404
400405 gfar_write(&regs->tctrl, tctrl);
401406
@@ -1161,6 +1166,9 @@ static int gfar_probe(struct platform_device *ofdev) · 759 unmodified lines
11611166 priv->rx_filer_enable = 1;
11621167 /* Enable most messages by default */
11631168 priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
1169+ /* use pritority h/w tx queue scheduling for single queue devices */
1170+ if (priv->num_tx_queues == 1)
1171+ priv->prio_sched_en = 1;
11641172
11651173 /* Carrier starts down, phylib will bring it up */
11661174 netif_carrier_off(dev);
drivers/net/ethernet/freescale/gianfar.h+10−1
@@ -301,8 +301,16 @@ extern const char gfar_driver_version[]; · 300 unmodified lines
301301 #define TCTRL_TFCPAUSE 0x00000008
302302 #define TCTRL_TXSCHED_MASK 0x00000006
303303 #define TCTRL_TXSCHED_INIT 0x00000000
304+/* priority scheduling */
304305 #define TCTRL_TXSCHED_PRIO 0x00000002
306+/* weighted round-robin scheduling (WRRS) */
305307 #define TCTRL_TXSCHED_WRRS 0x00000004
308+/* default WRRS weight and policy setting,
309+ * tailored to the tr03wt and tr47wt registers:
310+ * equal weight for all Tx Qs, measured in 64byte units
311+ */
312+#define DEFAULT_WRRS_WEIGHT 0x18181818
313+
306314 #define TCTRL_INIT_CSUM (TCTRL_TUCSEN | TCTRL_IPCSEN)
307315
308316 #define IEVENT_INIT_CLEAR 0xffffffff
@@ -1098,7 +1106,8 @@ struct gfar_private { · 789 unmodified lines
10981106 extended_hash:1,
10991107 bd_stash_en:1,
11001108 rx_filer_enable:1,
1101− wol_en:1; /* Wake-on-LAN enabled */
1109+ wol_en:1, /* Wake-on-LAN enabled */
1110+ prio_sched_en:1; /* Enable priorty based Tx scheduling in Hw */
11021111 unsigned short padding;
11031112
11041113 /* PHY stuff */
drivers/net/ethernet/freescale/gianfar_ptp.c+1−1
@@ -510,7 +510,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) · 509 unmodified lines
510510
511511 spin_unlock_irqrestore(&etsects->lock, flags);
512512
513− etsects->clock = ptp_clock_register(&etsects->caps);
513+ etsects->clock = ptp_clock_register(&etsects->caps, &dev->dev);
514514 if (IS_ERR(etsects->clock)) {
515515 err = PTR_ERR(etsects->clock);
516516 goto no_clock;
drivers/net/ethernet/freescale/ucc_geth.c+0−1
@@ -42,7 +42,6 @@ · 41 unmodified lines
4242 #include <asm/machdep.h>
4343
4444 #include "ucc_geth.h"
45−#include "fsl_pq_mdio.h"
4645
4746 #undef DEBUG
4847
drivers/net/ethernet/freescale/xgmac_mdio.c+274−0
@@ -0,0 +1,274 @@
1+/*
2+ * QorIQ 10G MDIO Controller
3+ *
4+ * Copyright 2012 Freescale Semiconductor, Inc.
5+ *
6+ * Authors: Andy Fleming <afleming@freescale.com>
7+ * Timur Tabi <timur@freescale.com>
8+ *
9+ * This file is licensed under the terms of the GNU General Public License
10+ * version 2. This program is licensed "as is" without any warranty of any
11+ * kind, whether express or implied.
12+ */
13+
14+#include <linux/kernel.h>
15+#include <linux/slab.h>
16+#include <linux/interrupt.h>
17+#include <linux/module.h>
18+#include <linux/phy.h>
19+#include <linux/mdio.h>
20+#include <linux/of_platform.h>
21+#include <linux/of_mdio.h>
22+
23+/* Number of microseconds to wait for a register to respond */
24+#define TIMEOUT 1000
25+
26+struct tgec_mdio_controller {
27+ __be32 reserved[12];
28+ __be32 mdio_stat; /* MDIO configuration and status */
29+ __be32 mdio_ctl; /* MDIO control */
30+ __be32 mdio_data; /* MDIO data */
31+ __be32 mdio_addr; /* MDIO address */
32+} __packed;
33+
34+#define MDIO_STAT_CLKDIV(x) (((x>>1) & 0xff) << 8)
35+#define MDIO_STAT_BSY (1 << 0)
36+#define MDIO_STAT_RD_ER (1 << 1)
37+#define MDIO_CTL_DEV_ADDR(x) (x & 0x1f)
38+#define MDIO_CTL_PORT_ADDR(x) ((x & 0x1f) << 5)
39+#define MDIO_CTL_PRE_DIS (1 << 10)
40+#define MDIO_CTL_SCAN_EN (1 << 11)
41+#define MDIO_CTL_POST_INC (1 << 14)
42+#define MDIO_CTL_READ (1 << 15)
43+
44+#define MDIO_DATA(x) (x & 0xffff)
45+#define MDIO_DATA_BSY (1 << 31)
46+
47+/*
48+ * Wait untill the MDIO bus is free
49+ */
50+static int xgmac_wait_until_free(struct device *dev,
51+ struct tgec_mdio_controller __iomem *regs)
52+{
53+ uint32_t status;
54+
55+ /* Wait till the bus is free */
56+ status = spin_event_timeout(
57+ !((in_be32(&regs->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);
58+ if (!status) {
59+ dev_err(dev, "timeout waiting for bus to be free\n");
60+ return -ETIMEDOUT;
61+ }
62+
63+ return 0;
64+}
65+
66+/*
67+ * Wait till the MDIO read or write operation is complete
68+ */
69+static int xgmac_wait_until_done(struct device *dev,
70+ struct tgec_mdio_controller __iomem *regs)
71+{
72+ uint32_t status;
73+
74+ /* Wait till the MDIO write is complete */
75+ status = spin_event_timeout(
76+ !((in_be32(&regs->mdio_data)) & MDIO_DATA_BSY), TIMEOUT, 0);
77+ if (!status) {
78+ dev_err(dev, "timeout waiting for operation to complete\n");
79+ return -ETIMEDOUT;
80+ }
81+
82+ return 0;
83+}
84+
85+/*
86+ * Write value to the PHY for this device to the register at regnum,waiting
87+ * until the write is done before it returns. All PHY configuration has to be
88+ * done through the TSEC1 MIIM regs.
89+ */
90+static int xgmac_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value)
91+{
92+ struct tgec_mdio_controller __iomem *regs = bus->priv;
93+ uint16_t dev_addr = regnum >> 16;
94+ int ret;
95+
96+ /* Setup the MII Mgmt clock speed */
97+ out_be32(&regs->mdio_stat, MDIO_STAT_CLKDIV(100));
98+
99+ ret = xgmac_wait_until_free(&bus->dev, regs);
100+ if (ret)
101+ return ret;
102+
103+ /* Set the port and dev addr */
104+ out_be32(&regs->mdio_ctl,
105+ MDIO_CTL_PORT_ADDR(phy_id) | MDIO_CTL_DEV_ADDR(dev_addr));
106+
107+ /* Set the register address */
108+ out_be32(&regs->mdio_addr, regnum & 0xffff);
109+
110+ ret = xgmac_wait_until_free(&bus->dev, regs);
111+ if (ret)
112+ return ret;
113+
114+ /* Write the value to the register */
115+ out_be32(&regs->mdio_data, MDIO_DATA(value));
116+
117+ ret = xgmac_wait_until_done(&bus->dev, regs);
118+ if (ret)
119+ return ret;
120+
121+ return 0;
122+}
123+
124+/*
125+ * Reads from register regnum in the PHY for device dev, returning the value.
126+ * Clears miimcom first. All PHY configuration has to be done through the
127+ * TSEC1 MIIM regs.
128+ */
129+static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
130+{
131+ struct tgec_mdio_controller __iomem *regs = bus->priv;
132+ uint16_t dev_addr = regnum >> 16;
133+ uint32_t mdio_ctl;
134+ uint16_t value;
135+ int ret;
136+
137+ /* Setup the MII Mgmt clock speed */
138+ out_be32(&regs->mdio_stat, MDIO_STAT_CLKDIV(100));
139+
140+ ret = xgmac_wait_until_free(&bus->dev, regs);
141+ if (ret)
142+ return ret;
143+
144+ /* Set the Port and Device Addrs */
145+ mdio_ctl = MDIO_CTL_PORT_ADDR(phy_id) | MDIO_CTL_DEV_ADDR(dev_addr);
146+ out_be32(&regs->mdio_ctl, mdio_ctl);
147+
148+ /* Set the register address */
149+ out_be32(&regs->mdio_addr, regnum & 0xffff);
150+
151+ ret = xgmac_wait_until_free(&bus->dev, regs);
152+ if (ret)
153+ return ret;
154+
155+ /* Initiate the read */
156+ out_be32(&regs->mdio_ctl, mdio_ctl | MDIO_CTL_READ);
157+
158+ ret = xgmac_wait_until_done(&bus->dev, regs);
159+ if (ret)
160+ return ret;
161+
162+ /* Return all Fs if nothing was there */
163+ if (in_be32(&regs->mdio_stat) & MDIO_STAT_RD_ER) {
164+ dev_err(&bus->dev, "MDIO read error\n");
165+ return 0xffff;
166+ }
167+
168+ value = in_be32(&regs->mdio_data) & 0xffff;
169+ dev_dbg(&bus->dev, "read %04x\n", value);
170+
171+ return value;
172+}
173+
174+/* Reset the MIIM registers, and wait for the bus to free */
175+static int xgmac_mdio_reset(struct mii_bus *bus)
176+{
177+ struct tgec_mdio_controller __iomem *regs = bus->priv;
178+ int ret;
179+
180+ mutex_lock(&bus->mdio_lock);
181+
182+ /* Setup the MII Mgmt clock speed */
183+ out_be32(&regs->mdio_stat, MDIO_STAT_CLKDIV(100));
184+
185+ ret = xgmac_wait_until_free(&bus->dev, regs);
186+
187+ mutex_unlock(&bus->mdio_lock);
188+
189+ return ret;
190+}
191+
192+static int __devinit xgmac_mdio_probe(struct platform_device *pdev)
193+{
194+ struct device_node *np = pdev->dev.of_node;
195+ struct mii_bus *bus;
196+ struct resource res;
197+ int ret;
198+
199+ ret = of_address_to_resource(np, 0, &res);
200+ if (ret) {
201+ dev_err(&pdev->dev, "could not obtain address\n");
202+ return ret;
203+ }
204+
205+ bus = mdiobus_alloc_size(PHY_MAX_ADDR * sizeof(int));
206+ if (!bus)
207+ return -ENOMEM;
208+
209+ bus->name = "Freescale XGMAC MDIO Bus";
210+ bus->read = xgmac_mdio_read;
211+ bus->write = xgmac_mdio_write;
212+ bus->reset = xgmac_mdio_reset;
213+ bus->irq = bus->priv;
214+ bus->parent = &pdev->dev;
215+ snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start);
216+
217+ /* Set the PHY base address */
218+ bus->priv = of_iomap(np, 0);
219+ if (!bus->priv) {
220+ ret = -ENOMEM;
221+ goto err_ioremap;
222+ }
223+
224+ ret = of_mdiobus_register(bus, np);
225+ if (ret) {
226+ dev_err(&pdev->dev, "cannot register MDIO bus\n");
227+ goto err_registration;
228+ }
229+
230+ dev_set_drvdata(&pdev->dev, bus);
231+
232+ return 0;
233+
234+err_registration:
235+ iounmap(bus->priv);
236+
237+err_ioremap:
238+ mdiobus_free(bus);
239+
240+ return ret;
241+}
242+
243+static int __devexit xgmac_mdio_remove(struct platform_device *pdev)
244+{
245+ struct mii_bus *bus = dev_get_drvdata(&pdev->dev);
246+
247+ mdiobus_unregister(bus);
248+ iounmap(bus->priv);
249+ mdiobus_free(bus);
250+
251+ return 0;
252+}
253+
254+static struct of_device_id xgmac_mdio_match[] = {
255+ {
256+ .compatible = "fsl,fman-xmdio",
257+ },
258+ {},
259+};
260+MODULE_DEVICE_TABLE(of, xgmac_mdio_match);
261+
262+static struct platform_driver xgmac_mdio_driver = {
263+ .driver = {
264+ .name = "fsl-fman_xmdio",
265+ .of_match_table = xgmac_mdio_match,
266+ },
267+ .probe = xgmac_mdio_probe,
268+ .remove = xgmac_mdio_remove,
269+};
270+
271+module_platform_driver(xgmac_mdio_driver);
272+
273+MODULE_DESCRIPTION("Freescale QorIQ 10G MDIO Controller");
274+MODULE_LICENSE("GPL v2");
drivers/net/ethernet/i825xx/Kconfig+1−1
@@ -150,7 +150,7 @@ config SUN3_82586 · 149 unmodified lines
150150
151151 config ZNET
152152 tristate "Zenith Z-Note support (EXPERIMENTAL)"
153− depends on EXPERIMENTAL && ISA_DMA_API
153+ depends on EXPERIMENTAL && ISA_DMA_API && X86
154154 ---help---
155155 The Zenith Z-Note notebook computer has a built-in network
156156 (Ethernet) card, and this is the Linux driver for it. Note that the
drivers/net/ethernet/i825xx/znet.c+2−2
@@ -865,14 +865,14 @@ static void hardware_init(struct net_device *dev) · 864 unmodified lines
865865 disable_dma(znet->rx_dma); /* reset by an interrupting task. */
866866 clear_dma_ff(znet->rx_dma);
867867 set_dma_mode(znet->rx_dma, DMA_RX_MODE);
868− set_dma_addr(znet->rx_dma, (unsigned int) znet->rx_start);
868+ set_dma_addr(znet->rx_dma, isa_virt_to_bus(znet->rx_start));
869869 set_dma_count(znet->rx_dma, RX_BUF_SIZE);
870870 enable_dma(znet->rx_dma);
871871 /* Now set up the Tx channel. */
872872 disable_dma(znet->tx_dma);
873873 clear_dma_ff(znet->tx_dma);
874874 set_dma_mode(znet->tx_dma, DMA_TX_MODE);
875− set_dma_addr(znet->tx_dma, (unsigned int) znet->tx_start);
875+ set_dma_addr(znet->tx_dma, isa_virt_to_bus(znet->tx_start));
876876 set_dma_count(znet->tx_dma, znet->tx_buf_len<<1);
877877 enable_dma(znet->tx_dma);
878878 release_dma_lock(flags);
drivers/net/ethernet/intel/e1000/e1000_ethtool.c+39−0
@@ -174,6 +174,20 @@ static int e1000_get_settings(struct net_device *netdev, · 173 unmodified lines
174174
175175 ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||
176176 hw->autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
177+
178+ /* MDI-X => 1; MDI => 0 */
179+ if ((hw->media_type == e1000_media_type_copper) &&
180+ netif_carrier_ok(netdev))
181+ ecmd->eth_tp_mdix = (!!adapter->phy_info.mdix_mode ?
182+ ETH_TP_MDI_X :
183+ ETH_TP_MDI);
184+ else
185+ ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
186+
187+ if (hw->mdix == AUTO_ALL_MODES)
188+ ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
189+ else
190+ ecmd->eth_tp_mdix_ctrl = hw->mdix;
177191 return 0;
178192 }
179193
@@ -183,6 +197,22 @@ static int e1000_set_settings(struct net_device *netdev, · 3 unmodified lines
183197 struct e1000_adapter *adapter = netdev_priv(netdev);
184198 struct e1000_hw *hw = &adapter->hw;
185199
200+ /*
201+ * MDI setting is only allowed when autoneg enabled because
202+ * some hardware doesn't allow MDI setting when speed or
203+ * duplex is forced.
204+ */
205+ if (ecmd->eth_tp_mdix_ctrl) {
206+ if (hw->media_type != e1000_media_type_copper)
207+ return -EOPNOTSUPP;
208+
209+ if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
210+ (ecmd->autoneg != AUTONEG_ENABLE)) {
211+ e_err(drv, "forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
212+ return -EINVAL;
213+ }
214+ }
215+
186216 while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
187217 msleep(1);
188218
@@ -199,12 +229,21 @@ static int e1000_set_settings(struct net_device *netdev, · 10 unmodified lines
199229 ecmd->advertising = hw->autoneg_advertised;
200230 } else {
201231 u32 speed = ethtool_cmd_speed(ecmd);
232+ /* calling this overrides forced MDI setting */
202233 if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
203234 clear_bit(__E1000_RESETTING, &adapter->flags);
204235 return -EINVAL;
205236 }
206237 }
207238
239+ /* MDI-X => 2; MDI => 1; Auto => 3 */
240+ if (ecmd->eth_tp_mdix_ctrl) {
241+ if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
242+ hw->mdix = AUTO_ALL_MODES;
243+ else
244+ hw->mdix = ecmd->eth_tp_mdix_ctrl;
245+ }
246+
208247 /* reset the link */
209248
210249 if (netif_running(adapter->netdev)) {
drivers/net/ethernet/intel/e1000/e1000_main.c+14−0
@@ -2014,6 +2014,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter, · 2013 unmodified lines
20142014 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
20152015 }
20162016
2017+ netdev_reset_queue(adapter->netdev);
20172018 size = sizeof(struct e1000_buffer) * tx_ring->count;
20182019 memset(tx_ring->buffer_info, 0, size);
20192020
@@ -3273,6 +3274,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 1253 unmodified lines
32733274 nr_frags, mss);
32743275
32753276 if (count) {
3277+ netdev_sent_queue(netdev, skb->len);
32763278 skb_tx_timestamp(skb);
32773279
32783280 e1000_tx_queue(adapter, tx_ring, tx_flags, count);
@@ -3860,6 +3862,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, · 581 unmodified lines
38603862 unsigned int i, eop;
38613863 unsigned int count = 0;
38623864 unsigned int total_tx_bytes=0, total_tx_packets=0;
3865+ unsigned int bytes_compl = 0, pkts_compl = 0;
38633866
38643867 i = tx_ring->next_to_clean;
38653868 eop = tx_ring->buffer_info[i].next_to_watch;
@@ -3877,6 +3880,11 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, · 11 unmodified lines
38773880 if (cleaned) {
38783881 total_tx_packets += buffer_info->segs;
38793882 total_tx_bytes += buffer_info->bytecount;
3883+ if (buffer_info->skb) {
3884+ bytes_compl += buffer_info->skb->len;
3885+ pkts_compl++;
3886+ }
3887+
38803888 }
38813889 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
38823890 tx_desc->upper.data = 0;
@@ -3890,6 +3898,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, · 7 unmodified lines
38903898
38913899 tx_ring->next_to_clean = i;
38923900
3901+ netdev_completed_queue(netdev, pkts_compl, bytes_compl);
3902+
38933903 #define TX_WAKE_THRESHOLD 32
38943904 if (unlikely(count && netif_carrier_ok(netdev) &&
38953905 E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) {
@@ -4950,6 +4960,10 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx) · 1054 unmodified lines
49504960 default:
49514961 goto err_inval;
49524962 }
4963+
4964+ /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
4965+ hw->mdix = AUTO_ALL_MODES;
4966+
49534967 return 0;
49544968
49554969 err_inval:
drivers/net/ethernet/intel/e1000e/82571.c+2−2
@@ -653,7 +653,7 @@ static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) · 652 unmodified lines
653653 **/
654654 static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active)
655655 {
656− u16 data = er32(POEMB);
656+ u32 data = er32(POEMB);
657657
658658 if (active)
659659 data |= E1000_PHY_CTRL_D0A_LPLU;
@@ -677,7 +677,7 @@ static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) · 17 unmodified lines
677677 **/
678678 static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active)
679679 {
680− u16 data = er32(POEMB);
680+ u32 data = er32(POEMB);
681681
682682 if (!active) {
683683 data &= ~E1000_PHY_CTRL_NOND0A_LPLU;
drivers/net/ethernet/intel/e1000e/ethtool.c+41−3
@@ -199,6 +199,11 @@ static int e1000_get_settings(struct net_device *netdev, · 198 unmodified lines
199199 else
200200 ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
201201
202+ if (hw->phy.mdix == AUTO_ALL_MODES)
203+ ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
204+ else
205+ ecmd->eth_tp_mdix_ctrl = hw->phy.mdix;
206+
202207 return 0;
203208 }
204209
@@ -241,6 +246,10 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx) · 36 unmodified lines
241246 default:
242247 goto err_inval;
243248 }
249+
250+ /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
251+ adapter->hw.phy.mdix = AUTO_ALL_MODES;
252+
244253 return 0;
245254
246255 err_inval:
@@ -264,6 +273,22 @@ static int e1000_set_settings(struct net_device *netdev, · 17 unmodified lines
264273 return -EINVAL;
265274 }
266275
276+ /*
277+ * MDI setting is only allowed when autoneg enabled because
278+ * some hardware doesn't allow MDI setting when speed or
279+ * duplex is forced.
280+ */
281+ if (ecmd->eth_tp_mdix_ctrl) {
282+ if (hw->phy.media_type != e1000_media_type_copper)
283+ return -EOPNOTSUPP;
284+
285+ if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
286+ (ecmd->autoneg != AUTONEG_ENABLE)) {
287+ e_err("forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
288+ return -EINVAL;
289+ }
290+ }
291+
267292 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
268293 usleep_range(1000, 2000);
269294
@@ -282,20 +307,32 @@ static int e1000_set_settings(struct net_device *netdev, · 12 unmodified lines
282307 hw->fc.requested_mode = e1000_fc_default;
283308 } else {
284309 u32 speed = ethtool_cmd_speed(ecmd);
310+ /* calling this overrides forced MDI setting */
285311 if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
286312 clear_bit(__E1000_RESETTING, &adapter->state);
287313 return -EINVAL;
288314 }
289315 }
290316
317+ /* MDI-X => 2; MDI => 1; Auto => 3 */
318+ if (ecmd->eth_tp_mdix_ctrl) {
319+ /*
320+ * fix up the value for auto (3 => 0) as zero is mapped
321+ * internally to auto
322+ */
323+ if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
324+ hw->phy.mdix = AUTO_ALL_MODES;
325+ else
326+ hw->phy.mdix = ecmd->eth_tp_mdix_ctrl;
327+ }
328+
291329 /* reset the link */
292330
293331 if (netif_running(adapter->netdev)) {
294332 e1000e_down(adapter);
295333 e1000e_up(adapter);
296− } else {
334+ } else
297335 e1000e_reset(adapter);
298− }
299336
300337 clear_bit(__E1000_RESETTING, &adapter->state);
301338 return 0;
@@ -1905,7 +1942,8 @@ static int e1000_set_coalesce(struct net_device *netdev, · 1603 unmodified lines
19051942 return -EINVAL;
19061943
19071944 if (ec->rx_coalesce_usecs == 4) {
1908− adapter->itr = adapter->itr_setting = 4;
1945+ adapter->itr_setting = 4;
1946+ adapter->itr = adapter->itr_setting;
19091947 } else if (ec->rx_coalesce_usecs <= 3) {
19101948 adapter->itr = 20000;
19111949 adapter->itr_setting = ec->rx_coalesce_usecs;
drivers/net/ethernet/intel/e1000e/netdev.c+13−6
@@ -56,7 +56,7 @@ · 55 unmodified lines
5656
5757 #define DRV_EXTRAVERSION "-k"
5858
59−#define DRV_VERSION "2.0.0" DRV_EXTRAVERSION
59+#define DRV_VERSION "2.1.4" DRV_EXTRAVERSION
6060 char e1000e_driver_name[] = "e1000e";
6161 const char e1000e_driver_version[] = DRV_VERSION;
6262
@@ -3446,7 +3446,7 @@ void e1000e_reset(struct e1000_adapter *adapter) · 3383 unmodified lines
34463446
34473447 /*
34483448 * if short on Rx space, Rx wins and must trump Tx
3449− * adjustment or use Early Receive if available
3449+ * adjustment
34503450 */
34513451 if (pba < min_rx_space)
34523452 pba = min_rx_space;
@@ -3755,6 +3755,10 @@ static irqreturn_t e1000_intr_msi_test(int irq, void *data) · 302 unmodified lines
37553755 e_dbg("icr is %08X\n", icr);
37563756 if (icr & E1000_ICR_RXSEQ) {
37573757 adapter->flags &= ~FLAG_MSI_TEST_FAILED;
3758+ /*
3759+ * Force memory writes to complete before acknowledging the
3760+ * interrupt is handled.
3761+ */
37583762 wmb();
37593763 }
37603764
@@ -3796,6 +3800,10 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) · 35 unmodified lines
37963800 goto msi_test_failed;
37973801 }
37983802
3803+ /*
3804+ * Force memory writes to complete before enabling and firing an
3805+ * interrupt.
3806+ */
37993807 wmb();
38003808
38013809 e1000_irq_enable(adapter);
@@ -3807,7 +3815,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) · 5 unmodified lines
38073815
38083816 e1000_irq_disable(adapter);
38093817
3810− rmb();
3818+ rmb(); /* read flags after interrupt has been fired */
38113819
38123820 if (adapter->flags & FLAG_MSI_TEST_FAILED) {
38133821 adapter->int_mode = E1000E_INT_MODE_LEGACY;
@@ -4670,7 +4678,7 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) · 856 unmodified lines
46704678 struct e1000_buffer *buffer_info;
46714679 unsigned int i;
46724680 u32 cmd_length = 0;
4673− u16 ipcse = 0, tucse, mss;
4681+ u16 ipcse = 0, mss;
46744682 u8 ipcss, ipcso, tucss, tucso, hdr_len;
46754683
46764684 if (!skb_is_gso(skb))
@@ -4704,7 +4712,6 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) · 27 unmodified lines
47044712 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
47054713 tucss = skb_transport_offset(skb);
47064714 tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;
4707− tucse = 0;
47084715
47094716 cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
47104717 E1000_TXD_CMD_TCP | (skb->len - (hdr_len)));
@@ -4718,7 +4725,7 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) · 7 unmodified lines
47184725 context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse);
47194726 context_desc->upper_setup.tcp_fields.tucss = tucss;
47204727 context_desc->upper_setup.tcp_fields.tucso = tucso;
4721− context_desc->upper_setup.tcp_fields.tucse = cpu_to_le16(tucse);
4728+ context_desc->upper_setup.tcp_fields.tucse = 0;
47224729 context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss);
47234730 context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
47244731 context_desc->cmd_and_length = cpu_to_le32(cmd_length);
drivers/net/ethernet/intel/e1000e/phy.c+29−2
@@ -84,8 +84,9 @@ static const u16 e1000_igp_2_cable_length_table[] = { · 83 unmodified lines
8484 #define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200
8585
8686 /* I82577 PHY Control 2 */
87−#define I82577_PHY_CTRL2_AUTO_MDIX 0x0400
88−#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
87+#define I82577_PHY_CTRL2_MANUAL_MDIX 0x0200
88+#define I82577_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
89+#define I82577_PHY_CTRL2_MDIX_CFG_MASK 0x0600
8990
9091 /* I82577 PHY Diagnostics Status */
9192 #define I82577_DSTATUS_CABLE_LENGTH 0x03FC
@@ -702,6 +703,32 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) · 610 unmodified lines
702703 if (ret_val)
703704 return ret_val;
704705
706+ /* Set MDI/MDIX mode */
707+ ret_val = e1e_rphy(hw, I82577_PHY_CTRL_2, &phy_data);
708+ if (ret_val)
709+ return ret_val;
710+ phy_data &= ~I82577_PHY_CTRL2_MDIX_CFG_MASK;
711+ /*
712+ * Options:
713+ * 0 - Auto (default)
714+ * 1 - MDI mode
715+ * 2 - MDI-X mode
716+ */
717+ switch (hw->phy.mdix) {
718+ case 1:
719+ break;
720+ case 2:
721+ phy_data |= I82577_PHY_CTRL2_MANUAL_MDIX;
722+ break;
723+ case 0:
724+ default:
725+ phy_data |= I82577_PHY_CTRL2_AUTO_MDI_MDIX;
726+ break;
727+ }
728+ ret_val = e1e_wphy(hw, I82577_PHY_CTRL_2, phy_data);
729+ if (ret_val)
730+ return ret_val;
731+
705732 return e1000_set_master_slave_mode(hw);
706733 }
707734
drivers/net/ethernet/intel/igb/e1000_82575.c+13−4
@@ -2223,11 +2223,10 @@ out: · 2222 unmodified lines
22232223 s32 igb_set_eee_i350(struct e1000_hw *hw)
22242224 {
22252225 s32 ret_val = 0;
2226− u32 ipcnfg, eeer, ctrl_ext;
2226+ u32 ipcnfg, eeer;
22272227
2228− ctrl_ext = rd32(E1000_CTRL_EXT);
2229− if ((hw->mac.type != e1000_i350) ||
2230− (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK))
2228+ if ((hw->mac.type < e1000_i350) ||
2229+ (hw->phy.media_type != e1000_media_type_copper))
22312230 goto out;
22322231 ipcnfg = rd32(E1000_IPCNFG);
22332232 eeer = rd32(E1000_EEER);
@@ -2240,6 +2239,14 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) · 6 unmodified lines
22402239 E1000_EEER_RX_LPI_EN |
22412240 E1000_EEER_LPI_FC);
22422241
2242+ /* keep the LPI clock running before EEE is enabled */
2243+ if (hw->mac.type == e1000_i210 || hw->mac.type == e1000_i211) {
2244+ u32 eee_su;
2245+ eee_su = rd32(E1000_EEE_SU);
2246+ eee_su &= ~E1000_EEE_SU_LPI_CLK_STP;
2247+ wr32(E1000_EEE_SU, eee_su);
2248+ }
2249+
22432250 } else {
22442251 ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN |
22452252 E1000_IPCNFG_EEE_100M_AN);
@@ -2249,6 +2256,8 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) · 3 unmodified lines
22492256 }
22502257 wr32(E1000_IPCNFG, ipcnfg);
22512258 wr32(E1000_EEER, eeer);
2259+ rd32(E1000_IPCNFG);
2260+ rd32(E1000_EEER);
22522261 out:
22532262
22542263 return ret_val;
drivers/net/ethernet/intel/igb/e1000_defines.h+10−1
@@ -322,6 +322,9 @@ · 321 unmodified lines
322322 #define E1000_FCRTC_RTH_COAL_SHIFT 4
323323 #define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision */
324324
325+/* Timestamp in Rx buffer */
326+#define E1000_RXPBS_CFG_TS_EN 0x80000000
327+
325328 /* SerDes Control */
326329 #define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400
327330
@@ -360,6 +363,7 @@ · 32 unmodified lines
360363 #define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */
361364 #define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */
362365 #define E1000_ICR_VMMB 0x00000100 /* VM MB event */
366+#define E1000_ICR_TS 0x00080000 /* Time Sync Interrupt */
363367 #define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */
364368 /* If this bit asserted, the driver should claim the interrupt */
365369 #define E1000_ICR_INT_ASSERTED 0x80000000
@@ -399,6 +403,7 @@ · 33 unmodified lines
399403 #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
400404 #define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */
401405 #define E1000_IMS_VMMB E1000_ICR_VMMB /* Mail box activity */
406+#define E1000_IMS_TS E1000_ICR_TS /* Time Sync Interrupt */
402407 #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
403408 #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
404409 #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */
@@ -510,6 +515,9 @@ · 105 unmodified lines
510515
511516 #define E1000_TIMINCA_16NS_SHIFT 24
512517
518+#define E1000_TSICR_TXTS 0x00000002
519+#define E1000_TSIM_TXTS 0x00000002
520+
513521 #define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */
514522 #define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */
515523 #define E1000_MDICNFG_PHY_MASK 0x03E00000
@@ -849,8 +857,9 @@ · 333 unmodified lines
849857 #define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */
850858 #define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */
851859 #define E1000_EEER_RX_LPI_EN 0x00020000 /* EEE Rx LPI Enable */
852−#define E1000_EEER_FRC_AN 0x10000000 /* Enable EEE in loopback */
860+#define E1000_EEER_FRC_AN 0x10000000 /* Enable EEE in loopback */
853861 #define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */
862+#define E1000_EEE_SU_LPI_CLK_STP 0X00800000 /* EEE LPI Clock Stop */
854863
855864 /* SerDes Control */
856865 #define E1000_GEN_CTL_READY 0x80000000
drivers/net/ethernet/intel/igb/e1000_phy.c+27−2
@@ -464,6 +464,32 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw) · 463 unmodified lines
464464 phy_data |= I82580_CFG_ENABLE_DOWNSHIFT;
465465
466466 ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data);
467+ if (ret_val)
468+ goto out;
469+
470+ /* Set MDI/MDIX mode */
471+ ret_val = phy->ops.read_reg(hw, I82580_PHY_CTRL_2, &phy_data);
472+ if (ret_val)
473+ goto out;
474+ phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK;
475+ /*
476+ * Options:
477+ * 0 - Auto (default)
478+ * 1 - MDI mode
479+ * 2 - MDI-X mode
480+ */
481+ switch (hw->phy.mdix) {
482+ case 1:
483+ break;
484+ case 2:
485+ phy_data |= I82580_PHY_CTRL2_MANUAL_MDIX;
486+ break;
487+ case 0:
488+ default:
489+ phy_data |= I82580_PHY_CTRL2_AUTO_MDI_MDIX;
490+ break;
491+ }
492+ ret_val = hw->phy.ops.write_reg(hw, I82580_PHY_CTRL_2, phy_data);
467493
468494 out:
469495 return ret_val;
@@ -2246,8 +2272,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw) · 1776 unmodified lines
22462272 if (ret_val)
22472273 goto out;
22482274
2249− phy_data &= ~I82580_PHY_CTRL2_AUTO_MDIX;
2250− phy_data &= ~I82580_PHY_CTRL2_FORCE_MDI_MDIX;
2275+ phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK;
22512276
22522277 ret_val = phy->ops.write_reg(hw, I82580_PHY_CTRL_2, phy_data);
22532278 if (ret_val)
drivers/net/ethernet/intel/igb/e1000_phy.h+3−2
@@ -111,8 +111,9 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw); · 110 unmodified lines
111111 #define I82580_PHY_STATUS2_SPEED_100MBPS 0x0100
112112
113113 /* I82580 PHY Control 2 */
114−#define I82580_PHY_CTRL2_AUTO_MDIX 0x0400
115−#define I82580_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
114+#define I82580_PHY_CTRL2_MANUAL_MDIX 0x0200
115+#define I82580_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
116+#define I82580_PHY_CTRL2_MDIX_CFG_MASK 0x0600
116117
117118 /* I82580 PHY Diagnostics Status */
118119 #define I82580_DSTATUS_CABLE_LENGTH 0x03FC
drivers/net/ethernet/intel/igb/e1000_regs.h+3−0
@@ -91,6 +91,8 @@ · 90 unmodified lines
9191 #define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */
9292 #define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */
9393 #define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */
94+#define E1000_TSICR 0x0B66C /* Interrupt Cause Register */
95+#define E1000_TSIM 0x0B674 /* Interrupt Mask Register */
9496
9597 /* Filtering Registers */
9698 #define E1000_SAQF(_n) (0x5980 + 4 * (_n))
@@ -347,6 +349,7 @@ · 250 unmodified lines
347349 /* Energy Efficient Ethernet "EEE" register */
348350 #define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */
349351 #define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */
352+#define E1000_EEE_SU 0X0E34 /* EEE Setup */
350353
351354 /* Thermal Sensor Register */
352355 #define E1000_THSTAT 0x08110 /* Thermal Sensor Status */
drivers/net/ethernet/intel/igb/igb.h+24−17
@@ -34,9 +34,11 @@ · 33 unmodified lines
3434 #include "e1000_mac.h"
3535 #include "e1000_82575.h"
3636
37+#ifdef CONFIG_IGB_PTP
3738 #include <linux/clocksource.h>
3839 #include <linux/net_tstamp.h>
3940 #include <linux/ptp_clock_kernel.h>
41+#endif /* CONFIG_IGB_PTP */
4042 #include <linux/bitops.h>
4143 #include <linux/if_vlan.h>
4244
@@ -99,7 +101,6 @@ struct vf_data_storage { · 56 unmodified lines
99101 u16 pf_vlan; /* When set, guest VLAN config not allowed. */
100102 u16 pf_qos;
101103 u16 tx_rate;
102− struct pci_dev *vfdev;
103104 };
104105
105106 #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */
@@ -131,9 +132,9 @@ struct vf_data_storage { · 25 unmodified lines
131132 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
132133
133134 /* Supported Rx Buffer Sizes */
134−#define IGB_RXBUFFER_512 512
135+#define IGB_RXBUFFER_256 256
135136 #define IGB_RXBUFFER_16384 16384
136−#define IGB_RX_HDR_LEN IGB_RXBUFFER_512
137+#define IGB_RX_HDR_LEN IGB_RXBUFFER_256
137138
138139 /* How many Tx Descriptors do we need to call netif_wake_queue ? */
139140 #define IGB_TX_QUEUE_WAKE 16
@@ -167,8 +168,8 @@ struct igb_tx_buffer { · 27 unmodified lines
167168 unsigned int bytecount;
168169 u16 gso_segs;
169170 __be16 protocol;
170− dma_addr_t dma;
171− u32 length;
171+ DEFINE_DMA_UNMAP_ADDR(dma);
172+ DEFINE_DMA_UNMAP_LEN(len);
172173 u32 tx_flags;
173174 };
174175
@@ -212,7 +213,6 @@ struct igb_q_vector { · 37 unmodified lines
212213 struct igb_ring_container rx, tx;
213214
214215 struct napi_struct napi;
215− int numa_node;
216216
217217 u16 itr_val;
218218 u8 set_itr;
@@ -257,7 +257,6 @@ struct igb_ring { · 38 unmodified lines
257257 };
258258 /* Items past this point are only used during ring alloc / free */
259259 dma_addr_t dma; /* phys address of the ring */
260− int numa_node; /* node to alloc ring memory on */
261260 };
262261
263262 enum e1000_ring_flags_t {
@@ -342,7 +341,6 @@ struct igb_adapter { · 78 unmodified lines
342341
343342 /* OS defined structs */
344343 struct pci_dev *pdev;
345− struct hwtstamp_config hwtstamp_config;
346344
347345 spinlock_t stats64_lock;
348346 struct rtnl_link_stats64 stats64;
@@ -373,15 +371,19 @@ struct igb_adapter { · 24 unmodified lines
373371 int vf_rate_link_speed;
374372 u32 rss_queues;
375373 u32 wvbr;
376− int node;
377374 u32 *shadow_vfta;
378375
376+#ifdef CONFIG_IGB_PTP
379377 struct ptp_clock *ptp_clock;
380− struct ptp_clock_info caps;
381− struct delayed_work overflow_work;
378+ struct ptp_clock_info ptp_caps;
379+ struct delayed_work ptp_overflow_work;
380+ struct work_struct ptp_tx_work;
381+ struct sk_buff *ptp_tx_skb;
382382 spinlock_t tmreg_lock;
383383 struct cyclecounter cc;
384384 struct timecounter tc;
385+#endif /* CONFIG_IGB_PTP */
386+
385387 char fw_version[32];
386388 };
387389
@@ -390,6 +392,7 @@ struct igb_adapter { · 2 unmodified lines
390392 #define IGB_FLAG_QUAD_PORT_A (1 << 2)
391393 #define IGB_FLAG_QUEUE_PAIRS (1 << 3)
392394 #define IGB_FLAG_DMAC (1 << 4)
395+#define IGB_FLAG_PTP (1 << 5)
393396
394397 /* DMA Coalescing defines */
395398 #define IGB_MIN_TXPBSIZE 20408
@@ -435,13 +438,17 @@ extern void igb_power_up_link(struct igb_adapter *); · 39 unmodified lines
435438 extern void igb_set_fw_version(struct igb_adapter *);
436439 #ifdef CONFIG_IGB_PTP
437440 extern void igb_ptp_init(struct igb_adapter *adapter);
438−extern void igb_ptp_remove(struct igb_adapter *adapter);
439−
440−extern void igb_systim_to_hwtstamp(struct igb_adapter *adapter,
441− struct skb_shared_hwtstamps *hwtstamps,
442− u64 systim);
441+extern void igb_ptp_stop(struct igb_adapter *adapter);
442+extern void igb_ptp_reset(struct igb_adapter *adapter);
443+extern void igb_ptp_tx_work(struct work_struct *work);
444+extern void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
445+extern void igb_ptp_rx_hwtstamp(struct igb_q_vector *q_vector,
446+ union e1000_adv_rx_desc *rx_desc,
447+ struct sk_buff *skb);
448+extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
449+ struct ifreq *ifr, int cmd);
450+#endif /* CONFIG_IGB_PTP */
443451
444−#endif
445452 static inline s32 igb_reset_phy(struct e1000_hw *hw)
446453 {
447454 if (hw->phy.ops.reset)
drivers/net/ethernet/intel/igb/igb_ethtool.c+125−73
@@ -148,9 +148,9 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 147 unmodified lines
148148 SUPPORTED_100baseT_Full |
149149 SUPPORTED_1000baseT_Full|
150150 SUPPORTED_Autoneg |
151− SUPPORTED_TP);
152− ecmd->advertising = (ADVERTISED_TP |
153− ADVERTISED_Pause);
151+ SUPPORTED_TP |
152+ SUPPORTED_Pause);
153+ ecmd->advertising = ADVERTISED_TP;
154154
155155 if (hw->mac.autoneg == 1) {
156156 ecmd->advertising |= ADVERTISED_Autoneg;
@@ -158,6 +158,21 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 1 unmodified line
158158 ecmd->advertising |= hw->phy.autoneg_advertised;
159159 }
160160
161+ if (hw->mac.autoneg != 1)
162+ ecmd->advertising &= ~(ADVERTISED_Pause |
163+ ADVERTISED_Asym_Pause);
164+
165+ if (hw->fc.requested_mode == e1000_fc_full)
166+ ecmd->advertising |= ADVERTISED_Pause;
167+ else if (hw->fc.requested_mode == e1000_fc_rx_pause)
168+ ecmd->advertising |= (ADVERTISED_Pause |
169+ ADVERTISED_Asym_Pause);
170+ else if (hw->fc.requested_mode == e1000_fc_tx_pause)
171+ ecmd->advertising |= ADVERTISED_Asym_Pause;
172+ else
173+ ecmd->advertising &= ~(ADVERTISED_Pause |
174+ ADVERTISED_Asym_Pause);
175+
161176 ecmd->port = PORT_TP;
162177 ecmd->phy_address = hw->phy.addr;
163178 } else {
@@ -198,6 +213,19 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 34 unmodified lines
198213 }
199214
200215 ecmd->autoneg = hw->mac.autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE;
216+
217+ /* MDI-X => 2; MDI =>1; Invalid =>0 */
218+ if (hw->phy.media_type == e1000_media_type_copper)
219+ ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X :
220+ ETH_TP_MDI;
221+ else
222+ ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
223+
224+ if (hw->phy.mdix == AUTO_ALL_MODES)
225+ ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
226+ else
227+ ecmd->eth_tp_mdix_ctrl = hw->phy.mdix;
228+
201229 return 0;
202230 }
203231
@@ -214,6 +242,22 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 10 unmodified lines
214242 return -EINVAL;
215243 }
216244
245+ /*
246+ * MDI setting is only allowed when autoneg enabled because
247+ * some hardware doesn't allow MDI setting when speed or
248+ * duplex is forced.
249+ */
250+ if (ecmd->eth_tp_mdix_ctrl) {
251+ if (hw->phy.media_type != e1000_media_type_copper)
252+ return -EOPNOTSUPP;
253+
254+ if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) &&
255+ (ecmd->autoneg != AUTONEG_ENABLE)) {
256+ dev_err(&adapter->pdev->dev, "forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");
257+ return -EINVAL;
258+ }
259+ }
260+
217261 while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
218262 msleep(1);
219263
@@ -227,12 +271,25 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 7 unmodified lines
227271 hw->fc.requested_mode = e1000_fc_default;
228272 } else {
229273 u32 speed = ethtool_cmd_speed(ecmd);
274+ /* calling this overrides forced MDI setting */
230275 if (igb_set_spd_dplx(adapter, speed, ecmd->duplex)) {
231276 clear_bit(__IGB_RESETTING, &adapter->state);
232277 return -EINVAL;
233278 }
234279 }
235280
281+ /* MDI-X => 2; MDI => 1; Auto => 3 */
282+ if (ecmd->eth_tp_mdix_ctrl) {
283+ /*
284+ * fix up the value for auto (3 => 0) as zero is mapped
285+ * internally to auto
286+ */
287+ if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
288+ hw->phy.mdix = AUTO_ALL_MODES;
289+ else
290+ hw->phy.mdix = ecmd->eth_tp_mdix_ctrl;
291+ }
292+
236293 /* reset the link */
237294 if (netif_running(adapter->netdev)) {
238295 igb_down(adapter);
@@ -1469,33 +1526,22 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) · 1230 unmodified lines
14691526 {
14701527 struct e1000_hw *hw = &adapter->hw;
14711528 u32 ctrl_reg = 0;
1472− u16 phy_reg = 0;
14731529
14741530 hw->mac.autoneg = false;
14751531
1476− switch (hw->phy.type) {
1477− case e1000_phy_m88:
1478− /* Auto-MDI/MDIX Off */
1479− igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
1480− /* reset to update Auto-MDI/MDIX */
1481− igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);
1482− /* autoneg off */
1483− igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);
1484− break;
1485− case e1000_phy_82580:
1486− /* enable MII loopback */
1487− igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041);
1488− break;
1489− case e1000_phy_i210:
1490− /* set loopback speed in PHY */
1491− igb_read_phy_reg(hw, (GS40G_PAGE_SELECT & GS40G_PAGE_2),
1492− &phy_reg);
1493− phy_reg |= GS40G_MAC_SPEED_1G;
1494− igb_write_phy_reg(hw, (GS40G_PAGE_SELECT & GS40G_PAGE_2),
1495− phy_reg);
1496− ctrl_reg = rd32(E1000_CTRL_EXT);
1497− default:
1498− break;
1532+ if (hw->phy.type == e1000_phy_m88) {
1533+ if (hw->phy.id != I210_I_PHY_ID) {
1534+ /* Auto-MDI/MDIX Off */
1535+ igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
1536+ /* reset to update Auto-MDI/MDIX */
1537+ igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);
1538+ /* autoneg off */
1539+ igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);
1540+ } else {
1541+ /* force 1000, set loopback */
1542+ igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0);
1543+ igb_write_phy_reg(hw, PHY_CONTROL, 0x4140);
1544+ }
14991545 }
15001546
15011547 /* add small delay to avoid loopback test failure */
@@ -1513,7 +1559,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) · 11 unmodified lines
15131559 E1000_CTRL_FD | /* Force Duplex to FULL */
15141560 E1000_CTRL_SLU); /* Set link up enable bit */
15151561
1516− if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210))
1562+ if (hw->phy.type == e1000_phy_m88)
15171563 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
15181564
15191565 wr32(E1000_CTRL, ctrl_reg);
@@ -1521,11 +1567,10 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) · 1 unmodified line
15211567 /* Disable the receiver on the PHY so when a cable is plugged in, the
15221568 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
15231569 */
1524− if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210))
1570+ if (hw->phy.type == e1000_phy_m88)
15251571 igb_phy_disable_receiver(adapter);
15261572
1527− udelay(500);
1528−
1573+ mdelay(500);
15291574 return 0;
15301575 }
15311576
@@ -1785,13 +1830,6 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data) · 253 unmodified lines
17851830 *data = 0;
17861831 goto out;
17871832 }
1788− if ((adapter->hw.mac.type == e1000_i210)
1789− || (adapter->hw.mac.type == e1000_i211)) {
1790− dev_err(&adapter->pdev->dev,
1791− "Loopback test not supported on this part at this time.\n");
1792− *data = 0;
1793− goto out;
1794− }
17951833 *data = igb_setup_desc_rings(adapter);
17961834 if (*data)
17971835 goto out;
@@ -2257,6 +2295,54 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · 459 unmodified lines
22572295 }
22582296 }
22592297
2298+static int igb_get_ts_info(struct net_device *dev,
2299+ struct ethtool_ts_info *info)
2300+{
2301+ struct igb_adapter *adapter = netdev_priv(dev);
2302+
2303+ switch (adapter->hw.mac.type) {
2304+#ifdef CONFIG_IGB_PTP
2305+ case e1000_82576:
2306+ case e1000_82580:
2307+ case e1000_i350:
2308+ case e1000_i210:
2309+ case e1000_i211:
2310+ info->so_timestamping =
2311+ SOF_TIMESTAMPING_TX_HARDWARE |
2312+ SOF_TIMESTAMPING_RX_HARDWARE |
2313+ SOF_TIMESTAMPING_RAW_HARDWARE;
2314+
2315+ if (adapter->ptp_clock)
2316+ info->phc_index = ptp_clock_index(adapter->ptp_clock);
2317+ else
2318+ info->phc_index = -1;
2319+
2320+ info->tx_types =
2321+ (1 << HWTSTAMP_TX_OFF) |
2322+ (1 << HWTSTAMP_TX_ON);
2323+
2324+ info->rx_filters = 1 << HWTSTAMP_FILTER_NONE;
2325+
2326+ /* 82576 does not support timestamping all packets. */
2327+ if (adapter->hw.mac.type >= e1000_82580)
2328+ info->rx_filters |= 1 << HWTSTAMP_FILTER_ALL;
2329+ else
2330+ info->rx_filters |=
2331+ (1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
2332+ (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
2333+ (1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
2334+ (1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
2335+ (1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
2336+ (1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
2337+ (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
2338+
2339+ return 0;
2340+#endif /* CONFIG_IGB_PTP */
2341+ default:
2342+ return -EOPNOTSUPP;
2343+ }
2344+}
2345+
22602346 static int igb_ethtool_begin(struct net_device *netdev)
22612347 {
22622348 struct igb_adapter *adapter = netdev_priv(netdev);
@@ -2270,38 +2356,6 @@ static void igb_ethtool_complete(struct net_device *netdev) · 7 unmodified lines
22702356 pm_runtime_put(&adapter->pdev->dev);
22712357 }
22722358
2273−#ifdef CONFIG_IGB_PTP
2274−static int igb_ethtool_get_ts_info(struct net_device *dev,
2275− struct ethtool_ts_info *info)
2276−{
2277− struct igb_adapter *adapter = netdev_priv(dev);
2278−
2279− info->so_timestamping =
2280− SOF_TIMESTAMPING_TX_HARDWARE |
2281− SOF_TIMESTAMPING_RX_HARDWARE |
2282− SOF_TIMESTAMPING_RAW_HARDWARE;
2283−
2284− if (adapter->ptp_clock)
2285− info->phc_index = ptp_clock_index(adapter->ptp_clock);
2286− else
2287− info->phc_index = -1;
2288−
2289− info->tx_types =
2290− (1 << HWTSTAMP_TX_OFF) |
2291− (1 << HWTSTAMP_TX_ON);
2292−
2293− info->rx_filters =
2294− (1 << HWTSTAMP_FILTER_NONE) |
2295− (1 << HWTSTAMP_FILTER_ALL) |
2296− (1 << HWTSTAMP_FILTER_SOME) |
2297− (1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
2298− (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
2299− (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
2300−
2301− return 0;
2302−}
2303−
2304−#endif
23052359 static const struct ethtool_ops igb_ethtool_ops = {
23062360 .get_settings = igb_get_settings,
23072361 .set_settings = igb_set_settings,
@@ -2328,11 +2382,9 @@ static const struct ethtool_ops igb_ethtool_ops = { · 20 unmodified lines
23282382 .get_ethtool_stats = igb_get_ethtool_stats,
23292383 .get_coalesce = igb_get_coalesce,
23302384 .set_coalesce = igb_set_coalesce,
2385+ .get_ts_info = igb_get_ts_info,
23312386 .begin = igb_ethtool_begin,
23322387 .complete = igb_ethtool_complete,
2333−#ifdef CONFIG_IGB_PTP
2334− .get_ts_info = igb_ethtool_get_ts_info,
2335−#endif
23362388 };
23372389
23382390 void igb_set_ethtool_ops(struct net_device *netdev)
drivers/net/ethernet/intel/igb/igb_main.c+198−513
@@ -172,8 +172,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *); · 171 unmodified lines
172172
173173 #ifdef CONFIG_PCI_IOV
174174 static int igb_vf_configure(struct igb_adapter *adapter, int vf);
175−static int igb_find_enabled_vfs(struct igb_adapter *adapter);
176−static int igb_check_vf_assignment(struct igb_adapter *adapter);
175+static bool igb_vfs_are_assigned(struct igb_adapter *adapter);
177176 #endif
178177
179178 #ifdef CONFIG_PM
@@ -404,8 +403,8 @@ static void igb_dump(struct igb_adapter *adapter) · 224 unmodified lines
404403 buffer_info = &tx_ring->tx_buffer_info[tx_ring->next_to_clean];
405404 pr_info(" %5d %5X %5X %016llX %04X %p %016llX\n",
406405 n, tx_ring->next_to_use, tx_ring->next_to_clean,
407− (u64)buffer_info->dma,
408− buffer_info->length,
406+ (u64)dma_unmap_addr(buffer_info, dma),
407+ dma_unmap_len(buffer_info, len),
409408 buffer_info->next_to_watch,
410409 (u64)buffer_info->time_stamp);
411410 }
@@ -456,8 +455,8 @@ static void igb_dump(struct igb_adapter *adapter) · 44 unmodified lines
456455 " %04X %p %016llX %p%s\n", i,
457456 le64_to_cpu(u0->a),
458457 le64_to_cpu(u0->b),
459− (u64)buffer_info->dma,
460− buffer_info->length,
458+ (u64)dma_unmap_addr(buffer_info, dma),
459+ dma_unmap_len(buffer_info, len),
461460 buffer_info->next_to_watch,
462461 (u64)buffer_info->time_stamp,
463462 buffer_info->skb, next_desc);
@@ -466,7 +465,8 @@ static void igb_dump(struct igb_adapter *adapter) · 2 unmodified lines
466465 print_hex_dump(KERN_INFO, "",
467466 DUMP_PREFIX_ADDRESS,
468467 16, 1, buffer_info->skb->data,
469− buffer_info->length, true);
468+ dma_unmap_len(buffer_info, len),
469+ true);
470470 }
471471 }
472472
@@ -683,52 +683,29 @@ static int igb_alloc_queues(struct igb_adapter *adapter) · 210 unmodified lines
683683 {
684684 struct igb_ring *ring;
685685 int i;
686− int orig_node = adapter->node;
687686
688687 for (i = 0; i < adapter->num_tx_queues; i++) {
689− if (orig_node == -1) {
690− int cur_node = next_online_node(adapter->node);
691− if (cur_node == MAX_NUMNODES)
692− cur_node = first_online_node;
693− adapter->node = cur_node;
694− }
695− ring = kzalloc_node(sizeof(struct igb_ring), GFP_KERNEL,
696− adapter->node);
697− if (!ring)
698− ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
688+ ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
699689 if (!ring)
700690 goto err;
701691 ring->count = adapter->tx_ring_count;
702692 ring->queue_index = i;
703693 ring->dev = &adapter->pdev->dev;
704694 ring->netdev = adapter->netdev;
705− ring->numa_node = adapter->node;
706695 /* For 82575, context index must be unique per ring. */
707696 if (adapter->hw.mac.type == e1000_82575)
708697 set_bit(IGB_RING_FLAG_TX_CTX_IDX, &ring->flags);
709698 adapter->tx_ring[i] = ring;
710699 }
711− /* Restore the adapter's original node */
712− adapter->node = orig_node;
713700
714701 for (i = 0; i < adapter->num_rx_queues; i++) {
715− if (orig_node == -1) {
716− int cur_node = next_online_node(adapter->node);
717− if (cur_node == MAX_NUMNODES)
718− cur_node = first_online_node;
719− adapter->node = cur_node;
720− }
721− ring = kzalloc_node(sizeof(struct igb_ring), GFP_KERNEL,
722− adapter->node);
723− if (!ring)
724− ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
702+ ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
725703 if (!ring)
726704 goto err;
727705 ring->count = adapter->rx_ring_count;
728706 ring->queue_index = i;
729707 ring->dev = &adapter->pdev->dev;
730708 ring->netdev = adapter->netdev;
731− ring->numa_node = adapter->node;
732709 /* set flag indicating ring supports SCTP checksum offload */
733710 if (adapter->hw.mac.type >= e1000_82576)
734711 set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags);
@@ -742,16 +719,12 @@ static int igb_alloc_queues(struct igb_adapter *adapter) · 7 unmodified lines
742719
743720 adapter->rx_ring[i] = ring;
744721 }
745− /* Restore the adapter's original node */
746− adapter->node = orig_node;
747722
748723 igb_cache_ring_register(adapter);
749724
750725 return 0;
751726
752727 err:
753− /* Restore the adapter's original node */
754− adapter->node = orig_node;
755728 igb_free_queues(adapter);
756729
757730 return -ENOMEM;
@@ -1117,24 +1090,10 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter) · 359 unmodified lines
11171090 struct igb_q_vector *q_vector;
11181091 struct e1000_hw *hw = &adapter->hw;
11191092 int v_idx;
1120− int orig_node = adapter->node;
11211093
11221094 for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) {
1123− if ((adapter->num_q_vectors == (adapter->num_rx_queues +
1124− adapter->num_tx_queues)) &&
1125− (adapter->num_rx_queues == v_idx))
1126− adapter->node = orig_node;
1127− if (orig_node == -1) {
1128− int cur_node = next_online_node(adapter->node);
1129− if (cur_node == MAX_NUMNODES)
1130− cur_node = first_online_node;
1131− adapter->node = cur_node;
1132− }
1133− q_vector = kzalloc_node(sizeof(struct igb_q_vector), GFP_KERNEL,
1134− adapter->node);
1135− if (!q_vector)
1136− q_vector = kzalloc(sizeof(struct igb_q_vector),
1137− GFP_KERNEL);
1095+ q_vector = kzalloc(sizeof(struct igb_q_vector),
1096+ GFP_KERNEL);
11381097 if (!q_vector)
11391098 goto err_out;
11401099 q_vector->adapter = adapter;
@@ -1143,14 +1102,10 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter) · 2 unmodified lines
11431102 netif_napi_add(adapter->netdev, &q_vector->napi, igb_poll, 64);
11441103 adapter->q_vector[v_idx] = q_vector;
11451104 }
1146− /* Restore the adapter's original node */
1147− adapter->node = orig_node;
11481105
11491106 return 0;
11501107
11511108 err_out:
1152− /* Restore the adapter's original node */
1153− adapter->node = orig_node;
11541109 igb_free_q_vectors(adapter);
11551110 return -ENOMEM;
11561111 }
@@ -1751,6 +1706,11 @@ void igb_reset(struct igb_adapter *adapter) · 594 unmodified lines
17511706 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
17521707 wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE);
17531708
1709+#ifdef CONFIG_IGB_PTP
1710+ /* Re-enable PTP, where applicable. */
1711+ igb_ptp_reset(adapter);
1712+#endif /* CONFIG_IGB_PTP */
1713+
17541714 igb_get_phy_info(hw);
17551715 }
17561716
@@ -2180,11 +2140,12 @@ static int __devinit igb_probe(struct pci_dev *pdev, · 423 unmodified lines
21802140 }
21812141
21822142 #endif
2143+
21832144 #ifdef CONFIG_IGB_PTP
21842145 /* do hw tstamp init after resetting */
21852146 igb_ptp_init(adapter);
2147+#endif /* CONFIG_IGB_PTP */
21862148
2187−#endif
21882149 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
21892150 /* print bus type/speed/width info */
21902151 dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n",
@@ -2259,9 +2220,9 @@ static void __devexit igb_remove(struct pci_dev *pdev) · 68 unmodified lines
22592220
22602221 pm_runtime_get_noresume(&pdev->dev);
22612222 #ifdef CONFIG_IGB_PTP
2262− igb_ptp_remove(adapter);
2223+ igb_ptp_stop(adapter);
2224+#endif /* CONFIG_IGB_PTP */
22632225
2264−#endif
22652226 /*
22662227 * The watchdog timer may be rescheduled, so explicitly
22672228 * disable watchdog from being rescheduled.
@@ -2294,11 +2255,11 @@ static void __devexit igb_remove(struct pci_dev *pdev) · 26 unmodified lines
22942255 /* reclaim resources allocated to VFs */
22952256 if (adapter->vf_data) {
22962257 /* disable iov and allow time for transactions to clear */
2297− if (!igb_check_vf_assignment(adapter)) {
2258+ if (igb_vfs_are_assigned(adapter)) {
2259+ dev_info(&pdev->dev, "Unloading driver while VFs are assigned - VFs will not be deallocated\n");
2260+ } else {
22982261 pci_disable_sriov(pdev);
22992262 msleep(500);
2300− } else {
2301− dev_info(&pdev->dev, "VF(s) assigned to guests!\n");
23022263 }
23032264
23042265 kfree(adapter->vf_data);
@@ -2338,7 +2299,7 @@ static void __devinit igb_probe_vfs(struct igb_adapter * adapter) · 33 unmodified lines
23382299 #ifdef CONFIG_PCI_IOV
23392300 struct pci_dev *pdev = adapter->pdev;
23402301 struct e1000_hw *hw = &adapter->hw;
2341− int old_vfs = igb_find_enabled_vfs(adapter);
2302+ int old_vfs = pci_num_vf(adapter->pdev);
23422303 int i;
23432304
23442305 /* Virtualization features not supported on i210 family. */
@@ -2418,8 +2379,6 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) · 73 unmodified lines
24182379 VLAN_HLEN;
24192380 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
24202381
2421− adapter->node = -1;
2422−
24232382 spin_lock_init(&adapter->stats64_lock);
24242383 #ifdef CONFIG_PCI_IOV
24252384 switch (hw->mac.type) {
@@ -2666,13 +2625,11 @@ static int igb_close(struct net_device *netdev) · 240 unmodified lines
26662625 int igb_setup_tx_resources(struct igb_ring *tx_ring)
26672626 {
26682627 struct device *dev = tx_ring->dev;
2669− int orig_node = dev_to_node(dev);
26702628 int size;
26712629
26722630 size = sizeof(struct igb_tx_buffer) * tx_ring->count;
2673− tx_ring->tx_buffer_info = vzalloc_node(size, tx_ring->numa_node);
2674− if (!tx_ring->tx_buffer_info)
2675− tx_ring->tx_buffer_info = vzalloc(size);
2631+
2632+ tx_ring->tx_buffer_info = vzalloc(size);
26762633 if (!tx_ring->tx_buffer_info)
26772634 goto err;
26782635
@@ -2680,18 +2637,10 @@ int igb_setup_tx_resources(struct igb_ring *tx_ring) · 1 unmodified line
26802637 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
26812638 tx_ring->size = ALIGN(tx_ring->size, 4096);
26822639
2683− set_dev_node(dev, tx_ring->numa_node);
26842640 tx_ring->desc = dma_alloc_coherent(dev,
26852641 tx_ring->size,
26862642 &tx_ring->dma,
26872643 GFP_KERNEL);
2688− set_dev_node(dev, orig_node);
2689− if (!tx_ring->desc)
2690− tx_ring->desc = dma_alloc_coherent(dev,
2691− tx_ring->size,
2692− &tx_ring->dma,
2693− GFP_KERNEL);
2694−
26952644 if (!tx_ring->desc)
26962645 goto err;
26972646
@@ -2702,8 +2651,8 @@ int igb_setup_tx_resources(struct igb_ring *tx_ring) · 4 unmodified lines
27022651
27032652 err:
27042653 vfree(tx_ring->tx_buffer_info);
2705− dev_err(dev,
2706− "Unable to allocate memory for the transmit descriptor ring\n");
2654+ tx_ring->tx_buffer_info = NULL;
2655+ dev_err(dev, "Unable to allocate memory for the Tx descriptor ring\n");
27072656 return -ENOMEM;
27082657 }
27092658
@@ -2820,34 +2769,23 @@ static void igb_configure_tx(struct igb_adapter *adapter) · 110 unmodified lines
28202769 int igb_setup_rx_resources(struct igb_ring *rx_ring)
28212770 {
28222771 struct device *dev = rx_ring->dev;
2823− int orig_node = dev_to_node(dev);
2824− int size, desc_len;
2772+ int size;
28252773
28262774 size = sizeof(struct igb_rx_buffer) * rx_ring->count;
2827− rx_ring->rx_buffer_info = vzalloc_node(size, rx_ring->numa_node);
2828− if (!rx_ring->rx_buffer_info)
2829− rx_ring->rx_buffer_info = vzalloc(size);
2775+
2776+ rx_ring->rx_buffer_info = vzalloc(size);
28302777 if (!rx_ring->rx_buffer_info)
28312778 goto err;
28322779
2833− desc_len = sizeof(union e1000_adv_rx_desc);
28342780
28352781 /* Round up to nearest 4K */
2836− rx_ring->size = rx_ring->count * desc_len;
2782+ rx_ring->size = rx_ring->count * sizeof(union e1000_adv_rx_desc);
28372783 rx_ring->size = ALIGN(rx_ring->size, 4096);
28382784
2839− set_dev_node(dev, rx_ring->numa_node);
28402785 rx_ring->desc = dma_alloc_coherent(dev,
28412786 rx_ring->size,
28422787 &rx_ring->dma,
28432788 GFP_KERNEL);
2844− set_dev_node(dev, orig_node);
2845− if (!rx_ring->desc)
2846− rx_ring->desc = dma_alloc_coherent(dev,
2847− rx_ring->size,
2848− &rx_ring->dma,
2849− GFP_KERNEL);
2850−
28512789 if (!rx_ring->desc)
28522790 goto err;
28532791
@@ -2859,8 +2797,7 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) · 5 unmodified lines
28592797 err:
28602798 vfree(rx_ring->rx_buffer_info);
28612799 rx_ring->rx_buffer_info = NULL;
2862− dev_err(dev, "Unable to allocate memory for the receive descriptor"
2863− " ring\n");
2800+ dev_err(dev, "Unable to allocate memory for the Rx descriptor ring\n");
28642801 return -ENOMEM;
28652802 }
28662803
@@ -2898,57 +2835,48 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) · 31 unmodified lines
28982835 {
28992836 struct e1000_hw *hw = &adapter->hw;
29002837 u32 mrqc, rxcsum;
2901− u32 j, num_rx_queues, shift = 0, shift2 = 0;
2902− union e1000_reta {
2903− u32 dword;
2904− u8 bytes[4];
2905− } reta;
2906− static const u8 rsshash[40] = {
2907− 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, 0x41, 0x67,
2908− 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, 0xd0, 0xca, 0x2b, 0xcb,
2909− 0xae, 0x7b, 0x30, 0xb4, 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30,
2910− 0xf2, 0x0c, 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa };
2838+ u32 j, num_rx_queues, shift = 0;
2839+ static const u32 rsskey[10] = { 0xDA565A6D, 0xC20E5B25, 0x3D256741,
2840+ 0xB08FA343, 0xCB2BCAD0, 0xB4307BAE,
2841+ 0xA32DCB77, 0x0CF23080, 0x3BB7426A,
2842+ 0xFA01ACBE };
29112843
29122844 /* Fill out hash function seeds */
2913− for (j = 0; j < 10; j++) {
2914− u32 rsskey = rsshash[(j * 4)];
2915− rsskey |= rsshash[(j * 4) + 1] << 8;
2916− rsskey |= rsshash[(j * 4) + 2] << 16;
2917− rsskey |= rsshash[(j * 4) + 3] << 24;
2918− array_wr32(E1000_RSSRK(0), j, rsskey);
2919− }
2845+ for (j = 0; j < 10; j++)
2846+ wr32(E1000_RSSRK(j), rsskey[j]);
29202847
29212848 num_rx_queues = adapter->rss_queues;
29222849
2923− if (adapter->vfs_allocated_count) {
2924− /* 82575 and 82576 supports 2 RSS queues for VMDq */
2925− switch (hw->mac.type) {
2926− case e1000_i350:
2927− case e1000_82580:
2928− num_rx_queues = 1;
2929− shift = 0;
2930− break;
2931− case e1000_82576:
2850+ switch (hw->mac.type) {
2851+ case e1000_82575:
2852+ shift = 6;
2853+ break;
2854+ case e1000_82576:
2855+ /* 82576 supports 2 RSS queues for SR-IOV */
2856+ if (adapter->vfs_allocated_count) {
29322857 shift = 3;
29332858 num_rx_queues = 2;
2934− break;
2935− case e1000_82575:
2936− shift = 2;
2937− shift2 = 6;
2938− default:
2939− break;
29402859 }
2941− } else {
2942− if (hw->mac.type == e1000_82575)
2943− shift = 6;
2860+ break;
2861+ default:
2862+ break;
29442863 }
29452864
2946− for (j = 0; j < (32 * 4); j++) {
2947− reta.bytes[j & 3] = (j % num_rx_queues) << shift;
2948− if (shift2)
2949− reta.bytes[j & 3] |= num_rx_queues << shift2;
2950− if ((j & 3) == 3)
2951− wr32(E1000_RETA(j >> 2), reta.dword);
2865+ /*
2866+ * Populate the indirection table 4 entries at a time. To do this
2867+ * we are generating the results for n and n+2 and then interleaving
2868+ * those with the results with n+1 and n+3.
2869+ */
2870+ for (j = 0; j < 32; j++) {
2871+ /* first pass generates n and n+2 */
2872+ u32 base = ((j * 0x00040004) + 0x00020000) * num_rx_queues;
2873+ u32 reta = (base & 0x07800780) >> (7 - shift);
2874+
2875+ /* second pass generates n+1 and n+3 */
2876+ base += 0x00010001 * num_rx_queues;
2877+ reta |= (base & 0x07800780) << (1 + shift);
2878+
2879+ wr32(E1000_RETA(j), reta);
29522880 }
29532881
29542882 /*
@@ -3184,8 +3112,10 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, · 229 unmodified lines
31843112 srrctl |= (PAGE_SIZE / 2) >> E1000_SRRCTL_BSIZEPKT_SHIFT;
31853113 #endif
31863114 srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
3115+#ifdef CONFIG_IGB_PTP
31873116 if (hw->mac.type >= e1000_82580)
31883117 srrctl |= E1000_SRRCTL_TIMESTAMP;
3118+#endif /* CONFIG_IGB_PTP */
31893119 /* Only set Drop Enable if we are supporting multiple queues */
31903120 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)
31913121 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -3269,20 +3199,20 @@ void igb_unmap_and_free_tx_resource(struct igb_ring *ring, · 77 unmodified lines
32693199 {
32703200 if (tx_buffer->skb) {
32713201 dev_kfree_skb_any(tx_buffer->skb);
3272− if (tx_buffer->dma)
3202+ if (dma_unmap_len(tx_buffer, len))
32733203 dma_unmap_single(ring->dev,
3274− tx_buffer->dma,
3275− tx_buffer->length,
3204+ dma_unmap_addr(tx_buffer, dma),
3205+ dma_unmap_len(tx_buffer, len),
32763206 DMA_TO_DEVICE);
3277− } else if (tx_buffer->dma) {
3207+ } else if (dma_unmap_len(tx_buffer, len)) {
32783208 dma_unmap_page(ring->dev,
3279− tx_buffer->dma,
3280− tx_buffer->length,
3209+ dma_unmap_addr(tx_buffer, dma),
3210+ dma_unmap_len(tx_buffer, len),
32813211 DMA_TO_DEVICE);
32823212 }
32833213 tx_buffer->next_to_watch = NULL;
32843214 tx_buffer->skb = NULL;
3285− tx_buffer->dma = 0;
3215+ dma_unmap_len_set(tx_buffer, len, 0);
32863216 /* buffer_info must be completely set up in the transmit path */
32873217 }
32883218
@@ -4229,9 +4159,11 @@ static __le32 igb_tx_cmd_type(u32 tx_flags) · 940 unmodified lines
42294159 if (tx_flags & IGB_TX_FLAGS_VLAN)
42304160 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE);
42314161
4162+#ifdef CONFIG_IGB_PTP
42324163 /* set timestamp bit if present */
4233− if (tx_flags & IGB_TX_FLAGS_TSTAMP)
4164+ if (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP))
42344165 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP);
4166+#endif /* CONFIG_IGB_PTP */
42354167
42364168 /* set segmentation bits for TSO */
42374169 if (tx_flags & IGB_TX_FLAGS_TSO)
@@ -4275,7 +4207,7 @@ static void igb_tx_map(struct igb_ring *tx_ring, · 37 unmodified lines
42754207 const u8 hdr_len)
42764208 {
42774209 struct sk_buff *skb = first->skb;
4278− struct igb_tx_buffer *tx_buffer_info;
4210+ struct igb_tx_buffer *tx_buffer;
42794211 union e1000_adv_tx_desc *tx_desc;
42804212 dma_addr_t dma;
42814213 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
@@ -4296,8 +4228,8 @@ static void igb_tx_map(struct igb_ring *tx_ring, · 14 unmodified lines
42964228 goto dma_error;
42974229
42984230 /* record length, and DMA address */
4299− first->length = size;
4300− first->dma = dma;
4231+ dma_unmap_len_set(first, len, size);
4232+ dma_unmap_addr_set(first, dma, dma);
43014233 tx_desc->read.buffer_addr = cpu_to_le64(dma);
43024234
43034235 for (;;) {
@@ -4339,9 +4271,9 @@ static void igb_tx_map(struct igb_ring *tx_ring, · 35 unmodified lines
43394271 if (dma_mapping_error(tx_ring->dev, dma))
43404272 goto dma_error;
43414273
4342− tx_buffer_info = &tx_ring->tx_buffer_info[i];
4343− tx_buffer_info->length = size;
4344− tx_buffer_info->dma = dma;
4274+ tx_buffer = &tx_ring->tx_buffer_info[i];
4275+ dma_unmap_len_set(tx_buffer, len, size);
4276+ dma_unmap_addr_set(tx_buffer, dma, dma);
43454277
43464278 tx_desc->read.olinfo_status = 0;
43474279 tx_desc->read.buffer_addr = cpu_to_le64(dma);
@@ -4392,9 +4324,9 @@ dma_error: · 44 unmodified lines
43924324
43934325 /* clear dma mappings for failed tx_buffer_info map */
43944326 for (;;) {
4395− tx_buffer_info = &tx_ring->tx_buffer_info[i];
4396− igb_unmap_and_free_tx_resource(tx_ring, tx_buffer_info);
4397− if (tx_buffer_info == first)
4327+ tx_buffer = &tx_ring->tx_buffer_info[i];
4328+ igb_unmap_and_free_tx_resource(tx_ring, tx_buffer);
4329+ if (tx_buffer == first)
43984330 break;
43994331 if (i == 0)
44004332 i = tx_ring->count;
@@ -4440,6 +4372,9 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) · 39 unmodified lines
44404372 netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
44414373 struct igb_ring *tx_ring)
44424374 {
4375+#ifdef CONFIG_IGB_PTP
4376+ struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
4377+#endif /* CONFIG_IGB_PTP */
44434378 struct igb_tx_buffer *first;
44444379 int tso;
44454380 u32 tx_flags = 0;
@@ -4462,10 +4397,17 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, · 16 unmodified lines
44624397 first->bytecount = skb->len;
44634398 first->gso_segs = 1;
44644399
4465− if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
4400+#ifdef CONFIG_IGB_PTP
4401+ if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
4402+ !(adapter->ptp_tx_skb))) {
44664403 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
44674404 tx_flags |= IGB_TX_FLAGS_TSTAMP;
4405+
4406+ adapter->ptp_tx_skb = skb_get(skb);
4407+ if (adapter->hw.mac.type == e1000_82576)
4408+ schedule_work(&adapter->ptp_tx_work);
44684409 }
4410+#endif /* CONFIG_IGB_PTP */
44694411
44704412 if (vlan_tx_tag_present(skb)) {
44714413 tx_flags |= IGB_TX_FLAGS_VLAN;
@@ -4661,11 +4603,13 @@ void igb_update_stats(struct igb_adapter *adapter, · 189 unmodified lines
46614603 bytes = 0;
46624604 packets = 0;
46634605 for (i = 0; i < adapter->num_rx_queues; i++) {
4664− u32 rqdpc_tmp = rd32(E1000_RQDPC(i)) & 0x0FFF;
4606+ u32 rqdpc = rd32(E1000_RQDPC(i));
46654607 struct igb_ring *ring = adapter->rx_ring[i];
46664608
4667− ring->rx_stats.drops += rqdpc_tmp;
4668− net_stats->rx_fifo_errors += rqdpc_tmp;
4609+ if (rqdpc) {
4610+ ring->rx_stats.drops += rqdpc;
4611+ net_stats->rx_fifo_errors += rqdpc;
4612+ }
46694613
46704614 do {
46714615 start = u64_stats_fetch_begin_bh(&ring->rx_syncp);
@@ -4755,7 +4699,11 @@ void igb_update_stats(struct igb_adapter *adapter, · 83 unmodified lines
47554699 reg = rd32(E1000_CTRL_EXT);
47564700 if (!(reg & E1000_CTRL_EXT_LINK_MODE_MASK)) {
47574701 adapter->stats.rxerrc += rd32(E1000_RXERRC);
4758− adapter->stats.tncrs += rd32(E1000_TNCRS);
4702+
4703+ /* this stat has invalid values on i210/i211 */
4704+ if ((hw->mac.type != e1000_i210) &&
4705+ (hw->mac.type != e1000_i211))
4706+ adapter->stats.tncrs += rd32(E1000_TNCRS);
47594707 }
47604708
47614709 adapter->stats.tsctc += rd32(E1000_TSCTC);
@@ -4852,6 +4800,19 @@ static irqreturn_t igb_msix_other(int irq, void *data) · 90 unmodified lines
48524800 mod_timer(&adapter->watchdog_timer, jiffies + 1);
48534801 }
48544802
4803+#ifdef CONFIG_IGB_PTP
4804+ if (icr & E1000_ICR_TS) {
4805+ u32 tsicr = rd32(E1000_TSICR);
4806+
4807+ if (tsicr & E1000_TSICR_TXTS) {
4808+ /* acknowledge the interrupt */
4809+ wr32(E1000_TSICR, E1000_TSICR_TXTS);
4810+ /* retrieve hardware timestamp */
4811+ schedule_work(&adapter->ptp_tx_work);
4812+ }
4813+ }
4814+#endif /* CONFIG_IGB_PTP */
4815+
48554816 wr32(E1000_EIMS, adapter->eims_other);
48564817
48574818 return IRQ_HANDLED;
@@ -5002,102 +4963,43 @@ static int igb_notify_dca(struct notifier_block *nb, unsigned long event, · 144 unmodified lines
50024963 static int igb_vf_configure(struct igb_adapter *adapter, int vf)
50034964 {
50044965 unsigned char mac_addr[ETH_ALEN];
5005− struct pci_dev *pdev = adapter->pdev;
5006− struct e1000_hw *hw = &adapter->hw;
5007− struct pci_dev *pvfdev;
5008− unsigned int device_id;
5009− u16 thisvf_devfn;
50104966
50114967 eth_random_addr(mac_addr);
50124968 igb_set_vf_mac(adapter, vf, mac_addr);
50134969
5014− switch (adapter->hw.mac.type) {
5015− case e1000_82576:
5016− device_id = IGB_82576_VF_DEV_ID;
5017− /* VF Stride for 82576 is 2 */
5018− thisvf_devfn = (pdev->devfn + 0x80 + (vf << 1)) |
5019− (pdev->devfn & 1);
5020− break;
5021− case e1000_i350:
5022− device_id = IGB_I350_VF_DEV_ID;
5023− /* VF Stride for I350 is 4 */
5024− thisvf_devfn = (pdev->devfn + 0x80 + (vf << 2)) |
5025− (pdev->devfn & 3);
5026− break;
5027− default:
5028− device_id = 0;
5029− thisvf_devfn = 0;
5030− break;
5031− }
5032−
5033− pvfdev = pci_get_device(hw->vendor_id, device_id, NULL);
5034− while (pvfdev) {
5035− if (pvfdev->devfn == thisvf_devfn)
5036− break;
5037− pvfdev = pci_get_device(hw->vendor_id,
5038− device_id, pvfdev);
5039− }
5040−
5041− if (pvfdev)
5042− adapter->vf_data[vf].vfdev = pvfdev;
5043− else
5044− dev_err(&pdev->dev,
5045− "Couldn't find pci dev ptr for VF %4.4x\n",
5046− thisvf_devfn);
5047− return pvfdev != NULL;
4970+ return 0;
50484971 }
50494972
5050−static int igb_find_enabled_vfs(struct igb_adapter *adapter)
4973+static bool igb_vfs_are_assigned(struct igb_adapter *adapter)
50514974 {
5052− struct e1000_hw *hw = &adapter->hw;
50534975 struct pci_dev *pdev = adapter->pdev;
5054− struct pci_dev *pvfdev;
5055− u16 vf_devfn = 0;
5056− u16 vf_stride;
5057− unsigned int device_id;
5058− int vfs_found = 0;
4976+ struct pci_dev *vfdev;
4977+ int dev_id;
50594978
50604979 switch (adapter->hw.mac.type) {
50614980 case e1000_82576:
5062− device_id = IGB_82576_VF_DEV_ID;
5063− /* VF Stride for 82576 is 2 */
5064− vf_stride = 2;
4981+ dev_id = IGB_82576_VF_DEV_ID;
50654982 break;
50664983 case e1000_i350:
5067− device_id = IGB_I350_VF_DEV_ID;
5068− /* VF Stride for I350 is 4 */
5069− vf_stride = 4;
4984+ dev_id = IGB_I350_VF_DEV_ID;
50704985 break;
50714986 default:
5072− device_id = 0;
5073− vf_stride = 0;
5074− break;
5075− }
5076−
5077− vf_devfn = pdev->devfn + 0x80;
5078− pvfdev = pci_get_device(hw->vendor_id, device_id, NULL);
5079− while (pvfdev) {
5080− if (pvfdev->devfn == vf_devfn &&
5081− (pvfdev->bus->number >= pdev->bus->number))
5082− vfs_found++;
5083− vf_devfn += vf_stride;
5084− pvfdev = pci_get_device(hw->vendor_id,
5085− device_id, pvfdev);
4987+ return false;
50864988 }
50874989
5088− return vfs_found;
5089−}
5090−
5091−static int igb_check_vf_assignment(struct igb_adapter *adapter)
5092−{
5093− int i;
5094− for (i = 0; i < adapter->vfs_allocated_count; i++) {
5095− if (adapter->vf_data[i].vfdev) {
5096− if (adapter->vf_data[i].vfdev->dev_flags &
5097− PCI_DEV_FLAGS_ASSIGNED)
4990+ /* loop through all the VFs to see if we own any that are assigned */
4991+ vfdev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL);
4992+ while (vfdev) {
4993+ /* if we don't own it we don't care */
4994+ if (vfdev->is_virtfn && vfdev->physfn == pdev) {
4995+ /* if it is assigned we cannot release it */
4996+ if (vfdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
50984997 return true;
50994998 }
4999+
5000+ vfdev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, vfdev);
51005001 }
5002+
51015003 return false;
51025004 }
51035005
@@ -5643,6 +5545,19 @@ static irqreturn_t igb_intr_msi(int irq, void *data) · 539 unmodified lines
56435545 mod_timer(&adapter->watchdog_timer, jiffies + 1);
56445546 }
56455547
5548+#ifdef CONFIG_IGB_PTP
5549+ if (icr & E1000_ICR_TS) {
5550+ u32 tsicr = rd32(E1000_TSICR);
5551+
5552+ if (tsicr & E1000_TSICR_TXTS) {
5553+ /* acknowledge the interrupt */
5554+ wr32(E1000_TSICR, E1000_TSICR_TXTS);
5555+ /* retrieve hardware timestamp */
5556+ schedule_work(&adapter->ptp_tx_work);
5557+ }
5558+ }
5559+#endif /* CONFIG_IGB_PTP */
5560+
56465561 napi_schedule(&q_vector->napi);
56475562
56485563 return IRQ_HANDLED;
@@ -5684,6 +5599,19 @@ static irqreturn_t igb_intr(int irq, void *data) · 35 unmodified lines
56845599 mod_timer(&adapter->watchdog_timer, jiffies + 1);
56855600 }
56865601
5602+#ifdef CONFIG_IGB_PTP
5603+ if (icr & E1000_ICR_TS) {
5604+ u32 tsicr = rd32(E1000_TSICR);
5605+
5606+ if (tsicr & E1000_TSICR_TXTS) {
5607+ /* acknowledge the interrupt */
5608+ wr32(E1000_TSICR, E1000_TSICR_TXTS);
5609+ /* retrieve hardware timestamp */
5610+ schedule_work(&adapter->ptp_tx_work);
5611+ }
5612+ }
5613+#endif /* CONFIG_IGB_PTP */
5614+
56875615 napi_schedule(&q_vector->napi);
56885616
56895617 return IRQ_HANDLED;
@@ -5743,37 +5671,6 @@ static int igb_poll(struct napi_struct *napi, int budget) · 53 unmodified lines
57435671 return 0;
57445672 }
57455673
5746−#ifdef CONFIG_IGB_PTP
5747−/**
5748− * igb_tx_hwtstamp - utility function which checks for TX time stamp
5749− * @q_vector: pointer to q_vector containing needed info
5750− * @buffer: pointer to igb_tx_buffer structure
5751− *
5752− * If we were asked to do hardware stamping and such a time stamp is
5753− * available, then it must have been for this skb here because we only
5754− * allow only one such packet into the queue.
5755− */
5756−static void igb_tx_hwtstamp(struct igb_q_vector *q_vector,
5757− struct igb_tx_buffer *buffer_info)
5758−{
5759− struct igb_adapter *adapter = q_vector->adapter;
5760− struct e1000_hw *hw = &adapter->hw;
5761− struct skb_shared_hwtstamps shhwtstamps;
5762− u64 regval;
5763−
5764− /* if skb does not support hw timestamp or TX stamp not valid exit */
5765− if (likely(!(buffer_info->tx_flags & IGB_TX_FLAGS_TSTAMP)) ||
5766− !(rd32(E1000_TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID))
5767− return;
5768−
5769− regval = rd32(E1000_TXSTMPL);
5770− regval |= (u64)rd32(E1000_TXSTMPH) << 32;
5771−
5772− igb_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
5773− skb_tstamp_tx(buffer_info->skb, &shhwtstamps);
5774−}
5775−
5776−#endif
57775674 /**
57785675 * igb_clean_tx_irq - Reclaim resources after transmit completes
57795676 * @q_vector: pointer to q_vector containing needed info
@@ -5785,7 +5682,7 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 5 unmodified lines
57855682 struct igb_adapter *adapter = q_vector->adapter;
57865683 struct igb_ring *tx_ring = q_vector->tx.ring;
57875684 struct igb_tx_buffer *tx_buffer;
5788− union e1000_adv_tx_desc *tx_desc, *eop_desc;
5685+ union e1000_adv_tx_desc *tx_desc;
57895686 unsigned int total_bytes = 0, total_packets = 0;
57905687 unsigned int budget = q_vector->tx.work_limit;
57915688 unsigned int i = tx_ring->next_to_clean;
@@ -5797,16 +5694,16 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 5 unmodified lines
57975694 tx_desc = IGB_TX_DESC(tx_ring, i);
57985695 i -= tx_ring->count;
57995696
5800− for (; budget; budget--) {
5801− eop_desc = tx_buffer->next_to_watch;
5802−
5803− /* prevent any other reads prior to eop_desc */
5804− rmb();
5697+ do {
5698+ union e1000_adv_tx_desc *eop_desc = tx_buffer->next_to_watch;
58055699
58065700 /* if next_to_watch is not set then there is no work pending */
58075701 if (!eop_desc)
58085702 break;
58095703
5704+ /* prevent any other reads prior to eop_desc */
5705+ rmb();
5706+
58105707 /* if DD is not set pending work has not been completed */
58115708 if (!(eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)))
58125709 break;
@@ -5818,25 +5715,21 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 5 unmodified lines
58185715 total_bytes += tx_buffer->bytecount;
58195716 total_packets += tx_buffer->gso_segs;
58205717
5821−#ifdef CONFIG_IGB_PTP
5822− /* retrieve hardware timestamp */
5823− igb_tx_hwtstamp(q_vector, tx_buffer);
5824−
5825−#endif
58265718 /* free the skb */
58275719 dev_kfree_skb_any(tx_buffer->skb);
5828− tx_buffer->skb = NULL;
58295720
58305721 /* unmap skb header data */
58315722 dma_unmap_single(tx_ring->dev,
5832− tx_buffer->dma,
5833− tx_buffer->length,
5723+ dma_unmap_addr(tx_buffer, dma),
5724+ dma_unmap_len(tx_buffer, len),
58345725 DMA_TO_DEVICE);
58355726
5727+ /* clear tx_buffer data */
5728+ tx_buffer->skb = NULL;
5729+ dma_unmap_len_set(tx_buffer, len, 0);
5730+
58365731 /* clear last DMA location and unmap remaining buffers */
58375732 while (tx_desc != eop_desc) {
5838− tx_buffer->dma = 0;
5839−
58405733 tx_buffer++;
58415734 tx_desc++;
58425735 i++;
@@ -5847,17 +5740,15 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 4 unmodified lines
58475740 }
58485741
58495742 /* unmap any remaining paged data */
5850− if (tx_buffer->dma) {
5743+ if (dma_unmap_len(tx_buffer, len)) {
58515744 dma_unmap_page(tx_ring->dev,
5852− tx_buffer->dma,
5853− tx_buffer->length,
5745+ dma_unmap_addr(tx_buffer, dma),
5746+ dma_unmap_len(tx_buffer, len),
58545747 DMA_TO_DEVICE);
5748+ dma_unmap_len_set(tx_buffer, len, 0);
58555749 }
58565750 }
58575751
5858− /* clear last DMA location */
5859− tx_buffer->dma = 0;
5860−
58615752 /* move us one more past the eop_desc for start of next pkt */
58625753 tx_buffer++;
58635754 tx_desc++;
@@ -5867,7 +5758,13 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 3 unmodified lines
58675758 tx_buffer = tx_ring->tx_buffer_info;
58685759 tx_desc = IGB_TX_DESC(tx_ring, 0);
58695760 }
5870− }
5761+
5762+ /* issue prefetch for next Tx descriptor */
5763+ prefetch(tx_desc);
5764+
5765+ /* update budget accounting */
5766+ budget--;
5767+ } while (likely(budget));
58715768
58725769 netdev_tx_completed_queue(txring_txq(tx_ring),
58735770 total_packets, total_bytes);
@@ -5883,12 +5780,10 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 9 unmodified lines
58835780 if (test_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags)) {
58845781 struct e1000_hw *hw = &adapter->hw;
58855782
5886− eop_desc = tx_buffer->next_to_watch;
5887−
58885783 /* Detect a transmit hang in hardware, this serializes the
58895784 * check with the clearing of time_stamp and movement of i */
58905785 clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
5891− if (eop_desc &&
5786+ if (tx_buffer->next_to_watch &&
58925787 time_after(jiffies, tx_buffer->time_stamp +
58935788 (adapter->tx_timeout_factor * HZ)) &&
58945789 !(rd32(E1000_STATUS) & E1000_STATUS_TXOFF)) {
@@ -5912,9 +5807,9 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 17 unmodified lines
59125807 tx_ring->next_to_use,
59135808 tx_ring->next_to_clean,
59145809 tx_buffer->time_stamp,
5915− eop_desc,
5810+ tx_buffer->next_to_watch,
59165811 jiffies,
5917− eop_desc->wb.status);
5812+ tx_buffer->next_to_watch->wb.status);
59185813 netif_stop_subqueue(tx_ring->netdev,
59195814 tx_ring->queue_index);
59205815
@@ -5994,47 +5889,6 @@ static inline void igb_rx_hash(struct igb_ring *ring, · 73 unmodified lines
59945889 skb->rxhash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);
59955890 }
59965891
5997−#ifdef CONFIG_IGB_PTP
5998−static void igb_rx_hwtstamp(struct igb_q_vector *q_vector,
5999− union e1000_adv_rx_desc *rx_desc,
6000− struct sk_buff *skb)
6001−{
6002− struct igb_adapter *adapter = q_vector->adapter;
6003− struct e1000_hw *hw = &adapter->hw;
6004− u64 regval;
6005−
6006− if (!igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP |
6007− E1000_RXDADV_STAT_TS))
6008− return;
6009−
6010− /*
6011− * If this bit is set, then the RX registers contain the time stamp. No
6012− * other packet will be time stamped until we read these registers, so
6013− * read the registers to make them available again. Because only one
6014− * packet can be time stamped at a time, we know that the register
6015− * values must belong to this one here and therefore we don't need to
6016− * compare any of the additional attributes stored for it.
6017− *
6018− * If nothing went wrong, then it should have a shared tx_flags that we
6019− * can turn into a skb_shared_hwtstamps.
6020− */
6021− if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
6022− u32 *stamp = (u32 *)skb->data;
6023− regval = le32_to_cpu(*(stamp + 2));
6024− regval |= (u64)le32_to_cpu(*(stamp + 3)) << 32;
6025− skb_pull(skb, IGB_TS_HDR_LEN);
6026− } else {
6027− if(!(rd32(E1000_TSYNCRXCTL) & E1000_TSYNCRXCTL_VALID))
6028− return;
6029−
6030− regval = rd32(E1000_RXSTMPL);
6031− regval |= (u64)rd32(E1000_RXSTMPH) << 32;
6032− }
6033−
6034− igb_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
6035−}
6036−
6037−#endif
60385892 static void igb_rx_vlan(struct igb_ring *ring,
60395893 union e1000_adv_rx_desc *rx_desc,
60405894 struct sk_buff *skb)
@@ -6146,8 +6000,8 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, int budget) · 105 unmodified lines
61466000 }
61476001
61486002 #ifdef CONFIG_IGB_PTP
6149− igb_rx_hwtstamp(q_vector, rx_desc, skb);
6150−#endif
6003+ igb_ptp_rx_hwtstamp(q_vector, rx_desc, skb);
6004+#endif /* CONFIG_IGB_PTP */
61516005 igb_rx_hash(rx_ring, rx_desc, skb);
61526006 igb_rx_checksum(rx_ring, rx_desc, skb);
61536007 igb_rx_vlan(rx_ring, rx_desc, skb);
@@ -6340,181 +6194,6 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) · 186 unmodified lines
63406194 return 0;
63416195 }
63426196
6343−/**
6344− * igb_hwtstamp_ioctl - control hardware time stamping
6345− * @netdev:
6346− * @ifreq:
6347− * @cmd:
6348− *
6349− * Outgoing time stamping can be enabled and disabled. Play nice and
6350− * disable it when requested, although it shouldn't case any overhead
6351− * when no packet needs it. At most one packet in the queue may be
6352− * marked for time stamping, otherwise it would be impossible to tell
6353− * for sure to which packet the hardware time stamp belongs.
6354− *
6355− * Incoming time stamping has to be configured via the hardware
6356− * filters. Not all combinations are supported, in particular event
6357− * type has to be specified. Matching the kind of event packet is
6358− * not supported, with the exception of "all V2 events regardless of
6359− * level 2 or 4".
6360− *
6361− **/
6362−static int igb_hwtstamp_ioctl(struct net_device *netdev,
6363− struct ifreq *ifr, int cmd)
6364−{
6365− struct igb_adapter *adapter = netdev_priv(netdev);
6366− struct e1000_hw *hw = &adapter->hw;
6367− struct hwtstamp_config config;
6368− u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
6369− u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
6370− u32 tsync_rx_cfg = 0;
6371− bool is_l4 = false;
6372− bool is_l2 = false;
6373− u32 regval;
6374−
6375− if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
6376− return -EFAULT;
6377−
6378− /* reserved for future extensions */
6379− if (config.flags)
6380− return -EINVAL;
6381−
6382− switch (config.tx_type) {
6383− case HWTSTAMP_TX_OFF:
6384− tsync_tx_ctl = 0;
6385− case HWTSTAMP_TX_ON:
6386− break;
6387− default:
6388− return -ERANGE;
6389− }
6390−
6391− switch (config.rx_filter) {
6392− case HWTSTAMP_FILTER_NONE:
6393− tsync_rx_ctl = 0;
6394− break;
6395− case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
6396− case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
6397− case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
6398− case HWTSTAMP_FILTER_ALL:
6399− /*
6400− * register TSYNCRXCFG must be set, therefore it is not
6401− * possible to time stamp both Sync and Delay_Req messages
6402− * => fall back to time stamping all packets
6403− */
6404− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
6405− config.rx_filter = HWTSTAMP_FILTER_ALL;
6406− break;
6407− case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
6408− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L4_V1;
6409− tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE;
6410− is_l4 = true;
6411− break;
6412− case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
6413− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L4_V1;
6414− tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE;
6415− is_l4 = true;
6416− break;
6417− case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
6418− case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
6419− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
6420− tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE;
6421− is_l2 = true;
6422− is_l4 = true;
6423− config.rx_filter = HWTSTAMP_FILTER_SOME;
6424− break;
6425− case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
6426− case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
6427− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
6428− tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE;
6429− is_l2 = true;
6430− is_l4 = true;
6431− config.rx_filter = HWTSTAMP_FILTER_SOME;
6432− break;
6433− case HWTSTAMP_FILTER_PTP_V2_EVENT:
6434− case HWTSTAMP_FILTER_PTP_V2_SYNC:
6435− case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
6436− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2;
6437− config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
6438− is_l2 = true;
6439− is_l4 = true;
6440− break;
6441− default:
6442− return -ERANGE;
6443− }
6444−
6445− if (hw->mac.type == e1000_82575) {
6446− if (tsync_rx_ctl | tsync_tx_ctl)
6447− return -EINVAL;
6448− return 0;
6449− }
6450−
6451− /*
6452− * Per-packet timestamping only works if all packets are
6453− * timestamped, so enable timestamping in all packets as
6454− * long as one rx filter was configured.
6455− */
6456− if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) {
6457− tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
6458− tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
6459− }
6460−
6461− /* enable/disable TX */
6462− regval = rd32(E1000_TSYNCTXCTL);
6463− regval &= ~E1000_TSYNCTXCTL_ENABLED;
6464− regval |= tsync_tx_ctl;
6465− wr32(E1000_TSYNCTXCTL, regval);
6466−
6467− /* enable/disable RX */
6468− regval = rd32(E1000_TSYNCRXCTL);
6469− regval &= ~(E1000_TSYNCRXCTL_ENABLED | E1000_TSYNCRXCTL_TYPE_MASK);
6470− regval |= tsync_rx_ctl;
6471− wr32(E1000_TSYNCRXCTL, regval);
6472−
6473− /* define which PTP packets are time stamped */
6474− wr32(E1000_TSYNCRXCFG, tsync_rx_cfg);
6475−
6476− /* define ethertype filter for timestamped packets */
6477− if (is_l2)
6478− wr32(E1000_ETQF(3),
6479− (E1000_ETQF_FILTER_ENABLE | /* enable filter */
6480− E1000_ETQF_1588 | /* enable timestamping */
6481− ETH_P_1588)); /* 1588 eth protocol type */
6482− else
6483− wr32(E1000_ETQF(3), 0);
6484−
6485−#define PTP_PORT 319
6486− /* L4 Queue Filter[3]: filter by destination port and protocol */
6487− if (is_l4) {
6488− u32 ftqf = (IPPROTO_UDP /* UDP */
6489− | E1000_FTQF_VF_BP /* VF not compared */
6490− | E1000_FTQF_1588_TIME_STAMP /* Enable Timestamping */
6491− | E1000_FTQF_MASK); /* mask all inputs */
6492− ftqf &= ~E1000_FTQF_MASK_PROTO_BP; /* enable protocol check */
6493−
6494− wr32(E1000_IMIR(3), htons(PTP_PORT));
6495− wr32(E1000_IMIREXT(3),
6496− (E1000_IMIREXT_SIZE_BP | E1000_IMIREXT_CTRL_BP));
6497− if (hw->mac.type == e1000_82576) {
6498− /* enable source port check */
6499− wr32(E1000_SPQF(3), htons(PTP_PORT));
6500− ftqf &= ~E1000_FTQF_MASK_SOURCE_PORT_BP;
6501− }
6502− wr32(E1000_FTQF(3), ftqf);
6503− } else {
6504− wr32(E1000_FTQF(3), E1000_FTQF_MASK);
6505− }
6506− wrfl();
6507−
6508− adapter->hwtstamp_config = config;
6509−
6510− /* clear TX/RX time stamp registers, just to be sure */
6511− regval = rd32(E1000_TXSTMPH);
6512− regval = rd32(E1000_RXSTMPH);
6513−
6514− return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
6515− -EFAULT : 0;
6516−}
6517−
65186197 /**
65196198 * igb_ioctl -
65206199 * @netdev:
@@ -6528,8 +6207,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) · 7 unmodified lines
65286207 case SIOCGMIIREG:
65296208 case SIOCSMIIREG:
65306209 return igb_mii_ioctl(netdev, ifr, cmd);
6210+#ifdef CONFIG_IGB_PTP
65316211 case SIOCSHWTSTAMP:
6532− return igb_hwtstamp_ioctl(netdev, ifr, cmd);
6212+ return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd);
6213+#endif /* CONFIG_IGB_PTP */
65336214 default:
65346215 return -EOPNOTSUPP;
65356216 }
@@ -6667,6 +6348,10 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx) · 131 unmodified lines
66676348 default:
66686349 goto err_inval;
66696350 }
6351+
6352+ /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
6353+ adapter->hw.phy.mdix = AUTO_ALL_MODES;
6354+
66706355 return 0;
66716356
66726357 err_inval:
drivers/net/ethernet/intel/igb/igb_ptp.c+561−116
@@ -69,22 +69,22 @@ · 68 unmodified lines
6969 * 2^40 * 10^-9 / 60 = 18.3 minutes.
7070 */
7171
72−#define IGB_OVERFLOW_PERIOD (HZ * 60 * 9)
73−#define INCPERIOD_82576 (1 << E1000_TIMINCA_16NS_SHIFT)
74−#define INCVALUE_82576_MASK ((1 << E1000_TIMINCA_16NS_SHIFT) - 1)
75−#define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
76−#define IGB_NBITS_82580 40
72+#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 9)
73+#define INCPERIOD_82576 (1 << E1000_TIMINCA_16NS_SHIFT)
74+#define INCVALUE_82576_MASK ((1 << E1000_TIMINCA_16NS_SHIFT) - 1)
75+#define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
76+#define IGB_NBITS_82580 40
7777
7878 /*
7979 * SYSTIM read access for the 82576
8080 */
8181
82−static cycle_t igb_82576_systim_read(const struct cyclecounter *cc)
82+static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
8383 {
84− u64 val;
85− u32 lo, hi;
8684 struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
8785 struct e1000_hw *hw = &igb->hw;
86+ u64 val;
87+ u32 lo, hi;
8888
8989 lo = rd32(E1000_SYSTIML);
9090 hi = rd32(E1000_SYSTIMH);
@@ -99,12 +99,12 @@ static cycle_t igb_82576_systim_read(const struct cyclecounter *cc) · 8 unmodified lines
9999 * SYSTIM read access for the 82580
100100 */
101101
102−static cycle_t igb_82580_systim_read(const struct cyclecounter *cc)
102+static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
103103 {
104− u64 val;
105− u32 lo, hi, jk;
106104 struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
107105 struct e1000_hw *hw = &igb->hw;
106+ u64 val;
107+ u32 lo, hi, jk;
108108
109109 /*
110110 * The timestamp latches on lowest register read. For the 82580
@@ -121,17 +121,102 @@ static cycle_t igb_82580_systim_read(const struct cyclecounter *cc) · 10 unmodified lines
121121 return val;
122122 }
123123
124+/*
125+ * SYSTIM read access for I210/I211
126+ */
127+
128+static void igb_ptp_read_i210(struct igb_adapter *adapter, struct timespec *ts)
129+{
130+ struct e1000_hw *hw = &adapter->hw;
131+ u32 sec, nsec, jk;
132+
133+ /*
134+ * The timestamp latches on lowest register read. For I210/I211, the
135+ * lowest register is SYSTIMR. Since we only need to provide nanosecond
136+ * resolution, we can ignore it.
137+ */
138+ jk = rd32(E1000_SYSTIMR);
139+ nsec = rd32(E1000_SYSTIML);
140+ sec = rd32(E1000_SYSTIMH);
141+
142+ ts->tv_sec = sec;
143+ ts->tv_nsec = nsec;
144+}
145+
146+static void igb_ptp_write_i210(struct igb_adapter *adapter,
147+ const struct timespec *ts)
148+{
149+ struct e1000_hw *hw = &adapter->hw;
150+
151+ /*
152+ * Writing the SYSTIMR register is not necessary as it only provides
153+ * sub-nanosecond resolution.
154+ */
155+ wr32(E1000_SYSTIML, ts->tv_nsec);
156+ wr32(E1000_SYSTIMH, ts->tv_sec);
157+}
158+
159+/**
160+ * igb_ptp_systim_to_hwtstamp - convert system time value to hw timestamp
161+ * @adapter: board private structure
162+ * @hwtstamps: timestamp structure to update
163+ * @systim: unsigned 64bit system time value.
164+ *
165+ * We need to convert the system time value stored in the RX/TXSTMP registers
166+ * into a hwtstamp which can be used by the upper level timestamping functions.
167+ *
168+ * The 'tmreg_lock' spinlock is used to protect the consistency of the
169+ * system time value. This is needed because reading the 64 bit time
170+ * value involves reading two (or three) 32 bit registers. The first
171+ * read latches the value. Ditto for writing.
172+ *
173+ * In addition, here have extended the system time with an overflow
174+ * counter in software.
175+ **/
176+static void igb_ptp_systim_to_hwtstamp(struct igb_adapter *adapter,
177+ struct skb_shared_hwtstamps *hwtstamps,
178+ u64 systim)
179+{
180+ unsigned long flags;
181+ u64 ns;
182+
183+ switch (adapter->hw.mac.type) {
184+ case e1000_82576:
185+ case e1000_82580:
186+ case e1000_i350:
187+ spin_lock_irqsave(&adapter->tmreg_lock, flags);
188+
189+ ns = timecounter_cyc2time(&adapter->tc, systim);
190+
191+ spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
192+
193+ memset(hwtstamps, 0, sizeof(*hwtstamps));
194+ hwtstamps->hwtstamp = ns_to_ktime(ns);
195+ break;
196+ case e1000_i210:
197+ case e1000_i211:
198+ memset(hwtstamps, 0, sizeof(*hwtstamps));
199+ /* Upper 32 bits contain s, lower 32 bits contain ns. */
200+ hwtstamps->hwtstamp = ktime_set(systim >> 32,
201+ systim & 0xFFFFFFFF);
202+ break;
203+ default:
204+ break;
205+ }
206+}
207+
124208 /*
125209 * PTP clock operations
126210 */
127211
128−static int ptp_82576_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
212+static int igb_ptp_adjfreq_82576(struct ptp_clock_info *ptp, s32 ppb)
129213 {
214+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
215+ ptp_caps);
216+ struct e1000_hw *hw = &igb->hw;
217+ int neg_adj = 0;
130218 u64 rate;
131219 u32 incvalue;
132− int neg_adj = 0;
133− struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);
134− struct e1000_hw *hw = &igb->hw;
135220
136221 if (ppb < 0) {
137222 neg_adj = 1;
@@ -153,13 +238,14 @@ static int ptp_82576_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 15 unmodified lines
153238 return 0;
154239 }
155240
156−static int ptp_82580_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
241+static int igb_ptp_adjfreq_82580(struct ptp_clock_info *ptp, s32 ppb)
157242 {
243+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
244+ ptp_caps);
245+ struct e1000_hw *hw = &igb->hw;
246+ int neg_adj = 0;
158247 u64 rate;
159248 u32 inca;
160− int neg_adj = 0;
161− struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);
162− struct e1000_hw *hw = &igb->hw;
163249
164250 if (ppb < 0) {
165251 neg_adj = 1;
@@ -178,11 +264,12 @@ static int ptp_82580_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 12 unmodified lines
178264 return 0;
179265 }
180266
181−static int igb_adjtime(struct ptp_clock_info *ptp, s64 delta)
267+static int igb_ptp_adjtime_82576(struct ptp_clock_info *ptp, s64 delta)
182268 {
183− s64 now;
269+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
270+ ptp_caps);
184271 unsigned long flags;
185− struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);
272+ s64 now;
186273
187274 spin_lock_irqsave(&igb->tmreg_lock, flags);
188275
@@ -195,12 +282,32 @@ static int igb_adjtime(struct ptp_clock_info *ptp, s64 delta) · 6 unmodified lines
195282 return 0;
196283 }
197284
198−static int igb_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
285+static int igb_ptp_adjtime_i210(struct ptp_clock_info *ptp, s64 delta)
199286 {
287+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
288+ ptp_caps);
289+ unsigned long flags;
290+ struct timespec now, then = ns_to_timespec(delta);
291+
292+ spin_lock_irqsave(&igb->tmreg_lock, flags);
293+
294+ igb_ptp_read_i210(igb, &now);
295+ now = timespec_add(now, then);
296+ igb_ptp_write_i210(igb, (const struct timespec *)&now);
297+
298+ spin_unlock_irqrestore(&igb->tmreg_lock, flags);
299+
300+ return 0;
301+}
302+
303+static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp,
304+ struct timespec *ts)
305+{
306+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
307+ ptp_caps);
308+ unsigned long flags;
200309 u64 ns;
201310 u32 remainder;
202− unsigned long flags;
203− struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);
204311
205312 spin_lock_irqsave(&igb->tmreg_lock, flags);
206313
@@ -214,11 +321,29 @@ static int igb_gettime(struct ptp_clock_info *ptp, struct timespec *ts) · 7 unmodified lines
214321 return 0;
215322 }
216323
217−static int igb_settime(struct ptp_clock_info *ptp, const struct timespec *ts)
324+static int igb_ptp_gettime_i210(struct ptp_clock_info *ptp,
325+ struct timespec *ts)
218326 {
219− u64 ns;
327+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
328+ ptp_caps);
220329 unsigned long flags;
221− struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);
330+
331+ spin_lock_irqsave(&igb->tmreg_lock, flags);
332+
333+ igb_ptp_read_i210(igb, ts);
334+
335+ spin_unlock_irqrestore(&igb->tmreg_lock, flags);
336+
337+ return 0;
338+}
339+
340+static int igb_ptp_settime_82576(struct ptp_clock_info *ptp,
341+ const struct timespec *ts)
342+{
343+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
344+ ptp_caps);
345+ unsigned long flags;
346+ u64 ns;
222347
223348 ns = ts->tv_sec * 1000000000ULL;
224349 ns += ts->tv_nsec;
@@ -232,77 +357,369 @@ static int igb_settime(struct ptp_clock_info *ptp, const struct timespec *ts) · 7 unmodified lines
232357 return 0;
233358 }
234359
235−static int ptp_82576_enable(struct ptp_clock_info *ptp,
236− struct ptp_clock_request *rq, int on)
360+static int igb_ptp_settime_i210(struct ptp_clock_info *ptp,
361+ const struct timespec *ts)
237362 {
238− return -EOPNOTSUPP;
363+ struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
364+ ptp_caps);
365+ unsigned long flags;
366+
367+ spin_lock_irqsave(&igb->tmreg_lock, flags);
368+
369+ igb_ptp_write_i210(igb, ts);
370+
371+ spin_unlock_irqrestore(&igb->tmreg_lock, flags);
372+
373+ return 0;
239374 }
240375
241−static int ptp_82580_enable(struct ptp_clock_info *ptp,
242− struct ptp_clock_request *rq, int on)
376+static int igb_ptp_enable(struct ptp_clock_info *ptp,
377+ struct ptp_clock_request *rq, int on)
243378 {
244379 return -EOPNOTSUPP;
245380 }
246381
247−static void igb_overflow_check(struct work_struct *work)
382+/**
383+ * igb_ptp_tx_work
384+ * @work: pointer to work struct
385+ *
386+ * This work function polls the TSYNCTXCTL valid bit to determine when a
387+ * timestamp has been taken for the current stored skb.
388+ */
389+void igb_ptp_tx_work(struct work_struct *work)
390+{
391+ struct igb_adapter *adapter = container_of(work, struct igb_adapter,
392+ ptp_tx_work);
393+ struct e1000_hw *hw = &adapter->hw;
394+ u32 tsynctxctl;
395+
396+ if (!adapter->ptp_tx_skb)
397+ return;
398+
399+ tsynctxctl = rd32(E1000_TSYNCTXCTL);
400+ if (tsynctxctl & E1000_TSYNCTXCTL_VALID)
401+ igb_ptp_tx_hwtstamp(adapter);
402+ else
403+ /* reschedule to check later */
404+ schedule_work(&adapter->ptp_tx_work);
405+}
406+
407+static void igb_ptp_overflow_check(struct work_struct *work)
248408 {
249− struct timespec ts;
250409 struct igb_adapter *igb =
251− container_of(work, struct igb_adapter, overflow_work.work);
410+ container_of(work, struct igb_adapter, ptp_overflow_work.work);
411+ struct timespec ts;
252412
253− igb_gettime(&igb->caps, &ts);
413+ igb->ptp_caps.gettime(&igb->ptp_caps, &ts);
254414
255415 pr_debug("igb overflow check at %ld.%09lu\n", ts.tv_sec, ts.tv_nsec);
256416
257− schedule_delayed_work(&igb->overflow_work, IGB_OVERFLOW_PERIOD);
417+ schedule_delayed_work(&igb->ptp_overflow_work,
418+ IGB_SYSTIM_OVERFLOW_PERIOD);
419+}
420+
421+/**
422+ * igb_ptp_tx_hwtstamp - utility function which checks for TX time stamp
423+ * @adapter: Board private structure.
424+ *
425+ * If we were asked to do hardware stamping and such a time stamp is
426+ * available, then it must have been for this skb here because we only
427+ * allow only one such packet into the queue.
428+ */
429+void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
430+{
431+ struct e1000_hw *hw = &adapter->hw;
432+ struct skb_shared_hwtstamps shhwtstamps;
433+ u64 regval;
434+
435+ regval = rd32(E1000_TXSTMPL);
436+ regval |= (u64)rd32(E1000_TXSTMPH) << 32;
437+
438+ igb_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
439+ skb_tstamp_tx(adapter->ptp_tx_skb, &shhwtstamps);
440+ dev_kfree_skb_any(adapter->ptp_tx_skb);
441+ adapter->ptp_tx_skb = NULL;
442+}
443+
444+void igb_ptp_rx_hwtstamp(struct igb_q_vector *q_vector,
445+ union e1000_adv_rx_desc *rx_desc,
446+ struct sk_buff *skb)
447+{
448+ struct igb_adapter *adapter = q_vector->adapter;
449+ struct e1000_hw *hw = &adapter->hw;
450+ u64 regval;
451+
452+ if (!igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP |
453+ E1000_RXDADV_STAT_TS))
454+ return;
455+
456+ /*
457+ * If this bit is set, then the RX registers contain the time stamp. No
458+ * other packet will be time stamped until we read these registers, so
459+ * read the registers to make them available again. Because only one
460+ * packet can be time stamped at a time, we know that the register
461+ * values must belong to this one here and therefore we don't need to
462+ * compare any of the additional attributes stored for it.
463+ *
464+ * If nothing went wrong, then it should have a shared tx_flags that we
465+ * can turn into a skb_shared_hwtstamps.
466+ */
467+ if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
468+ u32 *stamp = (u32 *)skb->data;
469+ regval = le32_to_cpu(*(stamp + 2));
470+ regval |= (u64)le32_to_cpu(*(stamp + 3)) << 32;
471+ skb_pull(skb, IGB_TS_HDR_LEN);
472+ } else {
473+ if (!(rd32(E1000_TSYNCRXCTL) & E1000_TSYNCRXCTL_VALID))
474+ return;
475+
476+ regval = rd32(E1000_RXSTMPL);
477+ regval |= (u64)rd32(E1000_RXSTMPH) << 32;
478+ }
479+
480+ igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
481+}
482+
483+/**
484+ * igb_ptp_hwtstamp_ioctl - control hardware time stamping
485+ * @netdev:
486+ * @ifreq:
487+ * @cmd:
488+ *
489+ * Outgoing time stamping can be enabled and disabled. Play nice and
490+ * disable it when requested, although it shouldn't case any overhead
491+ * when no packet needs it. At most one packet in the queue may be
492+ * marked for time stamping, otherwise it would be impossible to tell
493+ * for sure to which packet the hardware time stamp belongs.
494+ *
495+ * Incoming time stamping has to be configured via the hardware
496+ * filters. Not all combinations are supported, in particular event
497+ * type has to be specified. Matching the kind of event packet is
498+ * not supported, with the exception of "all V2 events regardless of
499+ * level 2 or 4".
500+ *
501+ **/
502+int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
503+ struct ifreq *ifr, int cmd)
504+{
505+ struct igb_adapter *adapter = netdev_priv(netdev);
506+ struct e1000_hw *hw = &adapter->hw;
507+ struct hwtstamp_config config;
508+ u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
509+ u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
510+ u32 tsync_rx_cfg = 0;
511+ bool is_l4 = false;
512+ bool is_l2 = false;
513+ u32 regval;
514+
515+ if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
516+ return -EFAULT;
517+
518+ /* reserved for future extensions */
519+ if (config.flags)
520+ return -EINVAL;
521+
522+ switch (config.tx_type) {
523+ case HWTSTAMP_TX_OFF:
524+ tsync_tx_ctl = 0;
525+ case HWTSTAMP_TX_ON:
526+ break;
527+ default:
528+ return -ERANGE;
529+ }
530+
531+ switch (config.rx_filter) {
532+ case HWTSTAMP_FILTER_NONE:
533+ tsync_rx_ctl = 0;
534+ break;
535+ case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
536+ case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
537+ case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
538+ case HWTSTAMP_FILTER_ALL:
539+ /*
540+ * register TSYNCRXCFG must be set, therefore it is not
541+ * possible to time stamp both Sync and Delay_Req messages
542+ * => fall back to time stamping all packets
543+ */
544+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
545+ config.rx_filter = HWTSTAMP_FILTER_ALL;
546+ break;
547+ case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
548+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L4_V1;
549+ tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE;
550+ is_l4 = true;
551+ break;
552+ case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
553+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L4_V1;
554+ tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE;
555+ is_l4 = true;
556+ break;
557+ case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
558+ case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
559+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
560+ tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE;
561+ is_l2 = true;
562+ is_l4 = true;
563+ config.rx_filter = HWTSTAMP_FILTER_SOME;
564+ break;
565+ case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
566+ case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
567+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
568+ tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE;
569+ is_l2 = true;
570+ is_l4 = true;
571+ config.rx_filter = HWTSTAMP_FILTER_SOME;
572+ break;
573+ case HWTSTAMP_FILTER_PTP_V2_EVENT:
574+ case HWTSTAMP_FILTER_PTP_V2_SYNC:
575+ case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
576+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2;
577+ config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
578+ is_l2 = true;
579+ is_l4 = true;
580+ break;
581+ default:
582+ return -ERANGE;
583+ }
584+
585+ if (hw->mac.type == e1000_82575) {
586+ if (tsync_rx_ctl | tsync_tx_ctl)
587+ return -EINVAL;
588+ return 0;
589+ }
590+
591+ /*
592+ * Per-packet timestamping only works if all packets are
593+ * timestamped, so enable timestamping in all packets as
594+ * long as one rx filter was configured.
595+ */
596+ if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) {
597+ tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
598+ tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
599+
600+ if ((hw->mac.type == e1000_i210) ||
601+ (hw->mac.type == e1000_i211)) {
602+ regval = rd32(E1000_RXPBS);
603+ regval |= E1000_RXPBS_CFG_TS_EN;
604+ wr32(E1000_RXPBS, regval);
605+ }
606+ }
607+
608+ /* enable/disable TX */
609+ regval = rd32(E1000_TSYNCTXCTL);
610+ regval &= ~E1000_TSYNCTXCTL_ENABLED;
611+ regval |= tsync_tx_ctl;
612+ wr32(E1000_TSYNCTXCTL, regval);
613+
614+ /* enable/disable RX */
615+ regval = rd32(E1000_TSYNCRXCTL);
616+ regval &= ~(E1000_TSYNCRXCTL_ENABLED | E1000_TSYNCRXCTL_TYPE_MASK);
617+ regval |= tsync_rx_ctl;
618+ wr32(E1000_TSYNCRXCTL, regval);
619+
620+ /* define which PTP packets are time stamped */
621+ wr32(E1000_TSYNCRXCFG, tsync_rx_cfg);
622+
623+ /* define ethertype filter for timestamped packets */
624+ if (is_l2)
625+ wr32(E1000_ETQF(3),
626+ (E1000_ETQF_FILTER_ENABLE | /* enable filter */
627+ E1000_ETQF_1588 | /* enable timestamping */
628+ ETH_P_1588)); /* 1588 eth protocol type */
629+ else
630+ wr32(E1000_ETQF(3), 0);
631+
632+#define PTP_PORT 319
633+ /* L4 Queue Filter[3]: filter by destination port and protocol */
634+ if (is_l4) {
635+ u32 ftqf = (IPPROTO_UDP /* UDP */
636+ | E1000_FTQF_VF_BP /* VF not compared */
637+ | E1000_FTQF_1588_TIME_STAMP /* Enable Timestamping */
638+ | E1000_FTQF_MASK); /* mask all inputs */
639+ ftqf &= ~E1000_FTQF_MASK_PROTO_BP; /* enable protocol check */
640+
641+ wr32(E1000_IMIR(3), htons(PTP_PORT));
642+ wr32(E1000_IMIREXT(3),
643+ (E1000_IMIREXT_SIZE_BP | E1000_IMIREXT_CTRL_BP));
644+ if (hw->mac.type == e1000_82576) {
645+ /* enable source port check */
646+ wr32(E1000_SPQF(3), htons(PTP_PORT));
647+ ftqf &= ~E1000_FTQF_MASK_SOURCE_PORT_BP;
648+ }
649+ wr32(E1000_FTQF(3), ftqf);
650+ } else {
651+ wr32(E1000_FTQF(3), E1000_FTQF_MASK);
652+ }
653+ wrfl();
654+
655+ /* clear TX/RX time stamp registers, just to be sure */
656+ regval = rd32(E1000_TXSTMPL);
657+ regval = rd32(E1000_TXSTMPH);
658+ regval = rd32(E1000_RXSTMPL);
659+ regval = rd32(E1000_RXSTMPH);
660+
661+ return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
662+ -EFAULT : 0;
258663 }
259664
260665 void igb_ptp_init(struct igb_adapter *adapter)
261666 {
262667 struct e1000_hw *hw = &adapter->hw;
668+ struct net_device *netdev = adapter->netdev;
263669
264670 switch (hw->mac.type) {
265− case e1000_i210:
266− case e1000_i211:
267− case e1000_i350:
671+ case e1000_82576:
672+ snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
673+ adapter->ptp_caps.owner = THIS_MODULE;
674+ adapter->ptp_caps.max_adj = 1000000000;
675+ adapter->ptp_caps.n_ext_ts = 0;
676+ adapter->ptp_caps.pps = 0;
677+ adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576;
678+ adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576;
679+ adapter->ptp_caps.gettime = igb_ptp_gettime_82576;
680+ adapter->ptp_caps.settime = igb_ptp_settime_82576;
681+ adapter->ptp_caps.enable = igb_ptp_enable;
682+ adapter->cc.read = igb_ptp_read_82576;
683+ adapter->cc.mask = CLOCKSOURCE_MASK(64);
684+ adapter->cc.mult = 1;
685+ adapter->cc.shift = IGB_82576_TSYNC_SHIFT;
686+ /* Dial the nominal frequency. */
687+ wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576);
688+ break;
268689 case e1000_82580:
269− adapter->caps.owner = THIS_MODULE;
270− strcpy(adapter->caps.name, "igb-82580");
271− adapter->caps.max_adj = 62499999;
272− adapter->caps.n_ext_ts = 0;
273− adapter->caps.pps = 0;
274− adapter->caps.adjfreq = ptp_82580_adjfreq;
275− adapter->caps.adjtime = igb_adjtime;
276− adapter->caps.gettime = igb_gettime;
277− adapter->caps.settime = igb_settime;
278− adapter->caps.enable = ptp_82580_enable;
279− adapter->cc.read = igb_82580_systim_read;
280− adapter->cc.mask = CLOCKSOURCE_MASK(IGB_NBITS_82580);
281− adapter->cc.mult = 1;
282− adapter->cc.shift = 0;
690+ case e1000_i350:
691+ snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
692+ adapter->ptp_caps.owner = THIS_MODULE;
693+ adapter->ptp_caps.max_adj = 62499999;
694+ adapter->ptp_caps.n_ext_ts = 0;
695+ adapter->ptp_caps.pps = 0;
696+ adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580;
697+ adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576;
698+ adapter->ptp_caps.gettime = igb_ptp_gettime_82576;
699+ adapter->ptp_caps.settime = igb_ptp_settime_82576;
700+ adapter->ptp_caps.enable = igb_ptp_enable;
701+ adapter->cc.read = igb_ptp_read_82580;
702+ adapter->cc.mask = CLOCKSOURCE_MASK(IGB_NBITS_82580);
703+ adapter->cc.mult = 1;
704+ adapter->cc.shift = 0;
283705 /* Enable the timer functions by clearing bit 31. */
284706 wr32(E1000_TSAUXC, 0x0);
285707 break;
286−
287− case e1000_82576:
288− adapter->caps.owner = THIS_MODULE;
289− strcpy(adapter->caps.name, "igb-82576");
290− adapter->caps.max_adj = 1000000000;
291− adapter->caps.n_ext_ts = 0;
292− adapter->caps.pps = 0;
293− adapter->caps.adjfreq = ptp_82576_adjfreq;
294− adapter->caps.adjtime = igb_adjtime;
295− adapter->caps.gettime = igb_gettime;
296− adapter->caps.settime = igb_settime;
297− adapter->caps.enable = ptp_82576_enable;
298− adapter->cc.read = igb_82576_systim_read;
299− adapter->cc.mask = CLOCKSOURCE_MASK(64);
300− adapter->cc.mult = 1;
301− adapter->cc.shift = IGB_82576_TSYNC_SHIFT;
302− /* Dial the nominal frequency. */
303− wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576);
708+ case e1000_i210:
709+ case e1000_i211:
710+ snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
711+ adapter->ptp_caps.owner = THIS_MODULE;
712+ adapter->ptp_caps.max_adj = 62499999;
713+ adapter->ptp_caps.n_ext_ts = 0;
714+ adapter->ptp_caps.pps = 0;
715+ adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580;
716+ adapter->ptp_caps.adjtime = igb_ptp_adjtime_i210;
717+ adapter->ptp_caps.gettime = igb_ptp_gettime_i210;
718+ adapter->ptp_caps.settime = igb_ptp_settime_i210;
719+ adapter->ptp_caps.enable = igb_ptp_enable;
720+ /* Enable the timer functions by clearing bit 31. */
721+ wr32(E1000_TSAUXC, 0x0);
304722 break;
305−
306723 default:
307724 adapter->ptp_clock = NULL;
308725 return;
@@ -310,86 +727,114 @@ void igb_ptp_init(struct igb_adapter *adapter) · 1 unmodified line
310727
311728 wrfl();
312729
313− timecounter_init(&adapter->tc, &adapter->cc,
314− ktime_to_ns(ktime_get_real()));
730+ spin_lock_init(&adapter->tmreg_lock);
731+ INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
732+
733+ /* Initialize the clock and overflow work for devices that need it. */
734+ if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
735+ struct timespec ts = ktime_to_timespec(ktime_get_real());
315736
316− INIT_DELAYED_WORK(&adapter->overflow_work, igb_overflow_check);
737+ igb_ptp_settime_i210(&adapter->ptp_caps, &ts);
738+ } else {
739+ timecounter_init(&adapter->tc, &adapter->cc,
740+ ktime_to_ns(ktime_get_real()));
317741
318− spin_lock_init(&adapter->tmreg_lock);
742+ INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
743+ igb_ptp_overflow_check);
319744
320− schedule_delayed_work(&adapter->overflow_work, IGB_OVERFLOW_PERIOD);
745+ schedule_delayed_work(&adapter->ptp_overflow_work,
746+ IGB_SYSTIM_OVERFLOW_PERIOD);
747+ }
748+
749+ /* Initialize the time sync interrupts for devices that support it. */
750+ if (hw->mac.type >= e1000_82580) {
751+ wr32(E1000_TSIM, E1000_TSIM_TXTS);
752+ wr32(E1000_IMS, E1000_IMS_TS);
753+ }
321754
322− adapter->ptp_clock = ptp_clock_register(&adapter->caps);
755+ adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
756+ &adapter->pdev->dev);
323757 if (IS_ERR(adapter->ptp_clock)) {
324758 adapter->ptp_clock = NULL;
325759 dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n");
326− } else
760+ } else {
327761 dev_info(&adapter->pdev->dev, "added PHC on %s\n",
328762 adapter->netdev->name);
763+ adapter->flags |= IGB_FLAG_PTP;
764+ }
329765 }
330766
331−void igb_ptp_remove(struct igb_adapter *adapter)
767+/**
768+ * igb_ptp_stop - Disable PTP device and stop the overflow check.
769+ * @adapter: Board private structure.
770+ *
771+ * This function stops the PTP support and cancels the delayed work.
772+ **/
773+void igb_ptp_stop(struct igb_adapter *adapter)
332774 {
333775 switch (adapter->hw.mac.type) {
334− case e1000_i211:
335− case e1000_i210:
336− case e1000_i350:
337− case e1000_82580:
338776 case e1000_82576:
339− cancel_delayed_work_sync(&adapter->overflow_work);
777+ case e1000_82580:
778+ case e1000_i350:
779+ cancel_delayed_work_sync(&adapter->ptp_overflow_work);
780+ break;
781+ case e1000_i210:
782+ case e1000_i211:
783+ /* No delayed work to cancel. */
340784 break;
341785 default:
342786 return;
343787 }
344788
789+ cancel_work_sync(&adapter->ptp_tx_work);
790+
345791 if (adapter->ptp_clock) {
346792 ptp_clock_unregister(adapter->ptp_clock);
347793 dev_info(&adapter->pdev->dev, "removed PHC on %s\n",
348794 adapter->netdev->name);
795+ adapter->flags &= ~IGB_FLAG_PTP;
349796 }
350797 }
351798
352799 /**
353− * igb_systim_to_hwtstamp - convert system time value to hw timestamp
354− * @adapter: board private structure
355− * @hwtstamps: timestamp structure to update
356− * @systim: unsigned 64bit system time value.
357− *
358− * We need to convert the system time value stored in the RX/TXSTMP registers
359− * into a hwtstamp which can be used by the upper level timestamping functions.
800+ * igb_ptp_reset - Re-enable the adapter for PTP following a reset.
801+ * @adapter: Board private structure.
360802 *
361− * The 'tmreg_lock' spinlock is used to protect the consistency of the
362− * system time value. This is needed because reading the 64 bit time
363− * value involves reading two (or three) 32 bit registers. The first
364− * read latches the value. Ditto for writing.
365− *
366− * In addition, here have extended the system time with an overflow
367− * counter in software.
803+ * This function handles the reset work required to re-enable the PTP device.
368804 **/
369−void igb_systim_to_hwtstamp(struct igb_adapter *adapter,
370− struct skb_shared_hwtstamps *hwtstamps,
371− u64 systim)
805+void igb_ptp_reset(struct igb_adapter *adapter)
372806 {
373− u64 ns;
374− unsigned long flags;
807+ struct e1000_hw *hw = &adapter->hw;
808+
809+ if (!(adapter->flags & IGB_FLAG_PTP))
810+ return;
375811
376812 switch (adapter->hw.mac.type) {
813+ case e1000_82576:
814+ /* Dial the nominal frequency. */
815+ wr32(E1000_TIMINCA, INCPERIOD_82576 | INCVALUE_82576);
816+ break;
817+ case e1000_82580:
818+ case e1000_i350:
377819 case e1000_i210:
378820 case e1000_i211:
379− case e1000_i350:
380− case e1000_82580:
381− case e1000_82576:
821+ /* Enable the timer functions and interrupts. */
822+ wr32(E1000_TSAUXC, 0x0);
823+ wr32(E1000_TSIM, E1000_TSIM_TXTS);
824+ wr32(E1000_IMS, E1000_IMS_TS);
382825 break;
383826 default:
827+ /* No work to do. */
384828 return;
385829 }
386830
387− spin_lock_irqsave(&adapter->tmreg_lock, flags);
831+ /* Re-initialize the timer. */
832+ if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
833+ struct timespec ts = ktime_to_timespec(ktime_get_real());
388834
389− ns = timecounter_cyc2time(&adapter->tc, systim);
390−
391− spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
392−
393− memset(hwtstamps, 0, sizeof(*hwtstamps));
394− hwtstamps->hwtstamp = ns_to_ktime(ns);
835+ igb_ptp_settime_i210(&adapter->ptp_caps, &ts);
836+ } else {
837+ timecounter_init(&adapter->tc, &adapter->cc,
838+ ktime_to_ns(ktime_get_real()));
839+ }
395840 }
drivers/net/ethernet/intel/ixgbe/Makefile+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232
3333 obj-$(CONFIG_IXGBE) += ixgbe.o
3434
35−ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \
35+ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\
3636 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
3737 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o
3838
drivers/net/ethernet/intel/ixgbe/ixgbe.h+28−7
@@ -78,6 +78,9 @@ · 77 unmodified lines
7878
7979 /* Supported Rx Buffer Sizes */
8080 #define IXGBE_RXBUFFER_256 256 /* Used for skb receive header */
81+#define IXGBE_RXBUFFER_2K 2048
82+#define IXGBE_RXBUFFER_3K 3072
83+#define IXGBE_RXBUFFER_4K 4096
8184 #define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */
8285
8386 /*
@@ -104,6 +107,7 @@ · 20 unmodified lines
104107 #define IXGBE_TX_FLAGS_FSO (u32)(1 << 6)
105108 #define IXGBE_TX_FLAGS_TXSW (u32)(1 << 7)
106109 #define IXGBE_TX_FLAGS_TSTAMP (u32)(1 << 8)
110+#define IXGBE_TX_FLAGS_NO_IFCS (u32)(1 << 9)
107111 #define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000
108112 #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
109113 #define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29
@@ -293,16 +297,25 @@ struct ixgbe_ring_feature { · 183 unmodified lines
293297 * this is twice the size of a half page we need to double the page order
294298 * for FCoE enabled Rx queues.
295299 */
296−#if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192)
297−static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
300+static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring)
298301 {
299− return test_bit(__IXGBE_RX_FCOE, &ring->state) ? 1 : 0;
302+#ifdef IXGBE_FCOE
303+ if (test_bit(__IXGBE_RX_FCOE, &ring->state))
304+ return (PAGE_SIZE < 8192) ? IXGBE_RXBUFFER_4K :
305+ IXGBE_RXBUFFER_3K;
306+#endif
307+ return IXGBE_RXBUFFER_2K;
300308 }
301−#else
302−#define ixgbe_rx_pg_order(_ring) 0
309+
310+static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
311+{
312+#ifdef IXGBE_FCOE
313+ if (test_bit(__IXGBE_RX_FCOE, &ring->state))
314+ return (PAGE_SIZE < 8192) ? 1 : 0;
303315 #endif
316+ return 0;
317+}
304318 #define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring))
305−#define ixgbe_rx_bufsz(_ring) ((PAGE_SIZE / 2) << ixgbe_rx_pg_order(_ring))
306319
307320 struct ixgbe_ring_container {
308321 struct ixgbe_ring *ring; /* pointer to linked list of rings */
@@ -584,6 +597,9 @@ struct ixgbe_adapter { · 275 unmodified lines
584597 #ifdef CONFIG_IXGBE_HWMON
585598 struct hwmon_buff ixgbe_hwmon_buff;
586599 #endif /* CONFIG_IXGBE_HWMON */
600+#ifdef CONFIG_DEBUG_FS
601+ struct dentry *ixgbe_dbg_adapter;
602+#endif /*CONFIG_DEBUG_FS*/
587603 };
588604
589605 struct ixgbe_fdir_filter {
@@ -712,7 +728,12 @@ extern int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, · 122 unmodified lines
712728 struct netdev_fcoe_hbainfo *info);
713729 extern u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter);
714730 #endif /* IXGBE_FCOE */
715−
731+#ifdef CONFIG_DEBUG_FS
732+extern void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter);
733+extern void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter);
734+extern void ixgbe_dbg_init(void);
735+extern void ixgbe_dbg_exit(void);
736+#endif /* CONFIG_DEBUG_FS */
716737 static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
717738 {
718739 return netdev_get_tx_queue(ring->netdev, ring->queue_index);
drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c+300−0
@@ -0,0 +1,300 @@
1+/*******************************************************************************
2+
3+ Intel 10 Gigabit PCI Express Linux driver
4+ Copyright(c) 1999 - 2012 Intel Corporation.
5+
6+ This program is free software; you can redistribute it and/or modify it
7+ under the terms and conditions of the GNU General Public License,
8+ version 2, as published by the Free Software Foundation.
9+
10+ This program is distributed in the hope it will be useful, but WITHOUT
11+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13+ more details.
14+
15+ You should have received a copy of the GNU General Public License along with
16+ this program; if not, write to the Free Software Foundation, Inc.,
17+ 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18+
19+ The full GNU General Public License is included in this distribution in
20+ the file called "COPYING".
21+
22+ Contact Information:
23+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25+
26+*******************************************************************************/
27+
28+#ifdef CONFIG_DEBUG_FS
29+
30+#include <linux/debugfs.h>
31+#include <linux/module.h>
32+
33+#include "ixgbe.h"
34+
35+static struct dentry *ixgbe_dbg_root;
36+
37+static char ixgbe_dbg_reg_ops_buf[256] = "";
38+
39+/**
40+ * ixgbe_dbg_reg_ops_open - prep the debugfs pokee data item when opened
41+ * @inode: inode that was opened
42+ * @filp: file info
43+ *
44+ * Stash the adapter pointer hiding in the inode into the file pointer where
45+ * we can find it later in the read and write calls
46+ **/
47+static int ixgbe_dbg_reg_ops_open(struct inode *inode, struct file *filp)
48+{
49+ filp->private_data = inode->i_private;
50+ return 0;
51+}
52+
53+/**
54+ * ixgbe_dbg_reg_ops_read - read for reg_ops datum
55+ * @filp: the opened file
56+ * @buffer: where to write the data for the user to read
57+ * @count: the size of the user's buffer
58+ * @ppos: file position offset
59+ **/
60+static ssize_t ixgbe_dbg_reg_ops_read(struct file *filp, char __user *buffer,
61+ size_t count, loff_t *ppos)
62+{
63+ struct ixgbe_adapter *adapter = filp->private_data;
64+ char buf[256];
65+ int bytes_not_copied;
66+ int len;
67+
68+ /* don't allow partial reads */
69+ if (*ppos != 0)
70+ return 0;
71+
72+ len = snprintf(buf, sizeof(buf), "%s: %s\n",
73+ adapter->netdev->name, ixgbe_dbg_reg_ops_buf);
74+ if (count < len)
75+ return -ENOSPC;
76+ bytes_not_copied = copy_to_user(buffer, buf, len);
77+ if (bytes_not_copied < 0)
78+ return bytes_not_copied;
79+
80+ *ppos = len;
81+ return len;
82+}
83+
84+/**
85+ * ixgbe_dbg_reg_ops_write - write into reg_ops datum
86+ * @filp: the opened file
87+ * @buffer: where to find the user's data
88+ * @count: the length of the user's data
89+ * @ppos: file position offset
90+ **/
91+static ssize_t ixgbe_dbg_reg_ops_write(struct file *filp,
92+ const char __user *buffer,
93+ size_t count, loff_t *ppos)
94+{
95+ struct ixgbe_adapter *adapter = filp->private_data;
96+ int bytes_not_copied;
97+
98+ /* don't allow partial writes */
99+ if (*ppos != 0)
100+ return 0;
101+ if (count >= sizeof(ixgbe_dbg_reg_ops_buf))
102+ return -ENOSPC;
103+
104+ bytes_not_copied = copy_from_user(ixgbe_dbg_reg_ops_buf, buffer, count);
105+ if (bytes_not_copied < 0)
106+ return bytes_not_copied;
107+ else if (bytes_not_copied < count)
108+ count -= bytes_not_copied;
109+ else
110+ return -ENOSPC;
111+ ixgbe_dbg_reg_ops_buf[count] = '\0';
112+
113+ if (strncmp(ixgbe_dbg_reg_ops_buf, "write", 5) == 0) {
114+ u32 reg, value;
115+ int cnt;
116+ cnt = sscanf(&ixgbe_dbg_reg_ops_buf[5], "%x %x", &reg, &value);
117+ if (cnt == 2) {
118+ IXGBE_WRITE_REG(&adapter->hw, reg, value);
119+ value = IXGBE_READ_REG(&adapter->hw, reg);
120+ e_dev_info("write: 0x%08x = 0x%08x\n", reg, value);
121+ } else {
122+ e_dev_info("write <reg> <value>\n");
123+ }
124+ } else if (strncmp(ixgbe_dbg_reg_ops_buf, "read", 4) == 0) {
125+ u32 reg, value;
126+ int cnt;
127+ cnt = sscanf(&ixgbe_dbg_reg_ops_buf[4], "%x", &reg);
128+ if (cnt == 1) {
129+ value = IXGBE_READ_REG(&adapter->hw, reg);
130+ e_dev_info("read 0x%08x = 0x%08x\n", reg, value);
131+ } else {
132+ e_dev_info("read <reg>\n");
133+ }
134+ } else {
135+ e_dev_info("Unknown command %s\n", ixgbe_dbg_reg_ops_buf);
136+ e_dev_info("Available commands:\n");
137+ e_dev_info(" read <reg>\n");
138+ e_dev_info(" write <reg> <value>\n");
139+ }
140+ return count;
141+}
142+
143+static const struct file_operations ixgbe_dbg_reg_ops_fops = {
144+ .owner = THIS_MODULE,
145+ .open = ixgbe_dbg_reg_ops_open,
146+ .read = ixgbe_dbg_reg_ops_read,
147+ .write = ixgbe_dbg_reg_ops_write,
148+};
149+
150+static char ixgbe_dbg_netdev_ops_buf[256] = "";
151+
152+/**
153+ * ixgbe_dbg_netdev_ops_open - prep the debugfs netdev_ops data item
154+ * @inode: inode that was opened
155+ * @filp: file info
156+ *
157+ * Stash the adapter pointer hiding in the inode into the file pointer
158+ * where we can find it later in the read and write calls
159+ **/
160+static int ixgbe_dbg_netdev_ops_open(struct inode *inode, struct file *filp)
161+{
162+ filp->private_data = inode->i_private;
163+ return 0;
164+}
165+
166+/**
167+ * ixgbe_dbg_netdev_ops_read - read for netdev_ops datum
168+ * @filp: the opened file
169+ * @buffer: where to write the data for the user to read
170+ * @count: the size of the user's buffer
171+ * @ppos: file position offset
172+ **/
173+static ssize_t ixgbe_dbg_netdev_ops_read(struct file *filp,
174+ char __user *buffer,
175+ size_t count, loff_t *ppos)
176+{
177+ struct ixgbe_adapter *adapter = filp->private_data;
178+ char buf[256];
179+ int bytes_not_copied;
180+ int len;
181+
182+ /* don't allow partial reads */
183+ if (*ppos != 0)
184+ return 0;
185+
186+ len = snprintf(buf, sizeof(buf), "%s: %s\n",
187+ adapter->netdev->name, ixgbe_dbg_netdev_ops_buf);
188+ if (count < len)
189+ return -ENOSPC;
190+ bytes_not_copied = copy_to_user(buffer, buf, len);
191+ if (bytes_not_copied < 0)
192+ return bytes_not_copied;
193+
194+ *ppos = len;
195+ return len;
196+}
197+
198+/**
199+ * ixgbe_dbg_netdev_ops_write - write into netdev_ops datum
200+ * @filp: the opened file
201+ * @buffer: where to find the user's data
202+ * @count: the length of the user's data
203+ * @ppos: file position offset
204+ **/
205+static ssize_t ixgbe_dbg_netdev_ops_write(struct file *filp,
206+ const char __user *buffer,
207+ size_t count, loff_t *ppos)
208+{
209+ struct ixgbe_adapter *adapter = filp->private_data;
210+ int bytes_not_copied;
211+
212+ /* don't allow partial writes */
213+ if (*ppos != 0)
214+ return 0;
215+ if (count >= sizeof(ixgbe_dbg_netdev_ops_buf))
216+ return -ENOSPC;
217+
218+ bytes_not_copied = copy_from_user(ixgbe_dbg_netdev_ops_buf,
219+ buffer, count);
220+ if (bytes_not_copied < 0)
221+ return bytes_not_copied;
222+ else if (bytes_not_copied < count)
223+ count -= bytes_not_copied;
224+ else
225+ return -ENOSPC;
226+ ixgbe_dbg_netdev_ops_buf[count] = '\0';
227+
228+ if (strncmp(ixgbe_dbg_netdev_ops_buf, "tx_timeout", 10) == 0) {
229+ adapter->netdev->netdev_ops->ndo_tx_timeout(adapter->netdev);
230+ e_dev_info("tx_timeout called\n");
231+ } else {
232+ e_dev_info("Unknown command: %s\n", ixgbe_dbg_netdev_ops_buf);
233+ e_dev_info("Available commands:\n");
234+ e_dev_info(" tx_timeout\n");
235+ }
236+ return count;
237+}
238+
239+static const struct file_operations ixgbe_dbg_netdev_ops_fops = {
240+ .owner = THIS_MODULE,
241+ .open = ixgbe_dbg_netdev_ops_open,
242+ .read = ixgbe_dbg_netdev_ops_read,
243+ .write = ixgbe_dbg_netdev_ops_write,
244+};
245+
246+/**
247+ * ixgbe_dbg_adapter_init - setup the debugfs directory for the adapter
248+ * @adapter: the adapter that is starting up
249+ **/
250+void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter)
251+{
252+ const char *name = pci_name(adapter->pdev);
253+ struct dentry *pfile;
254+ adapter->ixgbe_dbg_adapter = debugfs_create_dir(name, ixgbe_dbg_root);
255+ if (adapter->ixgbe_dbg_adapter) {
256+ pfile = debugfs_create_file("reg_ops", 0600,
257+ adapter->ixgbe_dbg_adapter, adapter,
258+ &ixgbe_dbg_reg_ops_fops);
259+ if (!pfile)
260+ e_dev_err("debugfs reg_ops for %s failed\n", name);
261+ pfile = debugfs_create_file("netdev_ops", 0600,
262+ adapter->ixgbe_dbg_adapter, adapter,
263+ &ixgbe_dbg_netdev_ops_fops);
264+ if (!pfile)
265+ e_dev_err("debugfs netdev_ops for %s failed\n", name);
266+ } else {
267+ e_dev_err("debugfs entry for %s failed\n", name);
268+ }
269+}
270+
271+/**
272+ * ixgbe_dbg_adapter_exit - clear out the adapter's debugfs entries
273+ * @pf: the pf that is stopping
274+ **/
275+void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter)
276+{
277+ if (adapter->ixgbe_dbg_adapter)
278+ debugfs_remove_recursive(adapter->ixgbe_dbg_adapter);
279+ adapter->ixgbe_dbg_adapter = NULL;
280+}
281+
282+/**
283+ * ixgbe_dbg_init - start up debugfs for the driver
284+ **/
285+void ixgbe_dbg_init(void)
286+{
287+ ixgbe_dbg_root = debugfs_create_dir(ixgbe_driver_name, NULL);
288+ if (ixgbe_dbg_root == NULL)
289+ pr_err("init of debugfs failed\n");
290+}
291+
292+/**
293+ * ixgbe_dbg_exit - clean out the driver's debugfs entries
294+ **/
295+void ixgbe_dbg_exit(void)
296+{
297+ debugfs_remove_recursive(ixgbe_dbg_root);
298+}
299+
300+#endif /* CONFIG_DEBUG_FS */
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+310−263
@@ -1167,7 +1167,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring, · 1166 unmodified lines
11671167 }
11681168
11691169 bi->dma = dma;
1170− bi->page_offset ^= ixgbe_rx_bufsz(rx_ring);
1170+ bi->page_offset = 0;
11711171
11721172 return true;
11731173 }
@@ -1320,29 +1320,6 @@ static unsigned int ixgbe_get_headlen(unsigned char *data, · 146 unmodified lines
13201320 return max_len;
13211321 }
13221322
1323−static void ixgbe_get_rsc_cnt(struct ixgbe_ring *rx_ring,
1324− union ixgbe_adv_rx_desc *rx_desc,
1325− struct sk_buff *skb)
1326−{
1327− __le32 rsc_enabled;
1328− u32 rsc_cnt;
1329−
1330− if (!ring_is_rsc_enabled(rx_ring))
1331− return;
1332−
1333− rsc_enabled = rx_desc->wb.lower.lo_dword.data &
1334− cpu_to_le32(IXGBE_RXDADV_RSCCNT_MASK);
1335−
1336− /* If this is an RSC frame rsc_cnt should be non-zero */
1337− if (!rsc_enabled)
1338− return;
1339−
1340− rsc_cnt = le32_to_cpu(rsc_enabled);
1341− rsc_cnt >>= IXGBE_RXDADV_RSCCNT_SHIFT;
1342−
1343− IXGBE_CB(skb)->append_cnt += rsc_cnt - 1;
1344−}
1345−
13461323 static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
13471324 struct sk_buff *skb)
13481325 {
@@ -1440,16 +1417,28 @@ static bool ixgbe_is_non_eop(struct ixgbe_ring *rx_ring, · 91 unmodified lines
14401417
14411418 prefetch(IXGBE_RX_DESC(rx_ring, ntc));
14421419
1443− if (likely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)))
1444− return false;
1420+ /* update RSC append count if present */
1421+ if (ring_is_rsc_enabled(rx_ring)) {
1422+ __le32 rsc_enabled = rx_desc->wb.lower.lo_dword.data &
1423+ cpu_to_le32(IXGBE_RXDADV_RSCCNT_MASK);
1424+
1425+ if (unlikely(rsc_enabled)) {
1426+ u32 rsc_cnt = le32_to_cpu(rsc_enabled);
1427+
1428+ rsc_cnt >>= IXGBE_RXDADV_RSCCNT_SHIFT;
1429+ IXGBE_CB(skb)->append_cnt += rsc_cnt - 1;
14451430
1446− /* append_cnt indicates packet is RSC, if so fetch nextp */
1447− if (IXGBE_CB(skb)->append_cnt) {
1448− ntc = le32_to_cpu(rx_desc->wb.upper.status_error);
1449− ntc &= IXGBE_RXDADV_NEXTP_MASK;
1450− ntc >>= IXGBE_RXDADV_NEXTP_SHIFT;
1431+ /* update ntc based on RSC value */
1432+ ntc = le32_to_cpu(rx_desc->wb.upper.status_error);
1433+ ntc &= IXGBE_RXDADV_NEXTP_MASK;
1434+ ntc >>= IXGBE_RXDADV_NEXTP_SHIFT;
1435+ }
14511436 }
14521437
1438+ /* if we are the last buffer then there is nothing else to do */
1439+ if (likely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)))
1440+ return false;
1441+
14531442 /* place skb in next buffer to be received */
14541443 rx_ring->rx_buffer_info[ntc].skb = skb;
14551444 rx_ring->rx_stats.non_eop_descs++;
@@ -1457,6 +1446,78 @@ static bool ixgbe_is_non_eop(struct ixgbe_ring *rx_ring, · 1 unmodified line
14571446 return true;
14581447 }
14591448
1449+/**
1450+ * ixgbe_pull_tail - ixgbe specific version of skb_pull_tail
1451+ * @rx_ring: rx descriptor ring packet is being transacted on
1452+ * @skb: pointer to current skb being adjusted
1453+ *
1454+ * This function is an ixgbe specific version of __pskb_pull_tail. The
1455+ * main difference between this version and the original function is that
1456+ * this function can make several assumptions about the state of things
1457+ * that allow for significant optimizations versus the standard function.
1458+ * As a result we can do things like drop a frag and maintain an accurate
1459+ * truesize for the skb.
1460+ */
1461+static void ixgbe_pull_tail(struct ixgbe_ring *rx_ring,
1462+ struct sk_buff *skb)
1463+{
1464+ struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
1465+ unsigned char *va;
1466+ unsigned int pull_len;
1467+
1468+ /*
1469+ * it is valid to use page_address instead of kmap since we are
1470+ * working with pages allocated out of the lomem pool per
1471+ * alloc_page(GFP_ATOMIC)
1472+ */
1473+ va = skb_frag_address(frag);
1474+
1475+ /*
1476+ * we need the header to contain the greater of either ETH_HLEN or
1477+ * 60 bytes if the skb->len is less than 60 for skb_pad.
1478+ */
1479+ pull_len = ixgbe_get_headlen(va, IXGBE_RX_HDR_SIZE);
1480+
1481+ /* align pull length to size of long to optimize memcpy performance */
1482+ skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
1483+
1484+ /* update all of the pointers */
1485+ skb_frag_size_sub(frag, pull_len);
1486+ frag->page_offset += pull_len;
1487+ skb->data_len -= pull_len;
1488+ skb->tail += pull_len;
1489+}
1490+
1491+/**
1492+ * ixgbe_dma_sync_frag - perform DMA sync for first frag of SKB
1493+ * @rx_ring: rx descriptor ring packet is being transacted on
1494+ * @skb: pointer to current skb being updated
1495+ *
1496+ * This function provides a basic DMA sync up for the first fragment of an
1497+ * skb. The reason for doing this is that the first fragment cannot be
1498+ * unmapped until we have reached the end of packet descriptor for a buffer
1499+ * chain.
1500+ */
1501+static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring,
1502+ struct sk_buff *skb)
1503+{
1504+ /* if the page was released unmap it, else just sync our portion */
1505+ if (unlikely(IXGBE_CB(skb)->page_released)) {
1506+ dma_unmap_page(rx_ring->dev, IXGBE_CB(skb)->dma,
1507+ ixgbe_rx_pg_size(rx_ring), DMA_FROM_DEVICE);
1508+ IXGBE_CB(skb)->page_released = false;
1509+ } else {
1510+ struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
1511+
1512+ dma_sync_single_range_for_cpu(rx_ring->dev,
1513+ IXGBE_CB(skb)->dma,
1514+ frag->page_offset,
1515+ ixgbe_rx_bufsz(rx_ring),
1516+ DMA_FROM_DEVICE);
1517+ }
1518+ IXGBE_CB(skb)->dma = 0;
1519+}
1520+
14601521 /**
14611522 * ixgbe_cleanup_headers - Correct corrupted or empty headers
14621523 * @rx_ring: rx descriptor ring packet is being transacted on
@@ -1479,24 +1540,7 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, · 16 unmodified lines
14791540 union ixgbe_adv_rx_desc *rx_desc,
14801541 struct sk_buff *skb)
14811542 {
1482− struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
14831543 struct net_device *netdev = rx_ring->netdev;
1484− unsigned char *va;
1485− unsigned int pull_len;
1486−
1487− /* if the page was released unmap it, else just sync our portion */
1488− if (unlikely(IXGBE_CB(skb)->page_released)) {
1489− dma_unmap_page(rx_ring->dev, IXGBE_CB(skb)->dma,
1490− ixgbe_rx_pg_size(rx_ring), DMA_FROM_DEVICE);
1491− IXGBE_CB(skb)->page_released = false;
1492− } else {
1493− dma_sync_single_range_for_cpu(rx_ring->dev,
1494− IXGBE_CB(skb)->dma,
1495− frag->page_offset,
1496− ixgbe_rx_bufsz(rx_ring),
1497− DMA_FROM_DEVICE);
1498− }
1499− IXGBE_CB(skb)->dma = 0;
15001544
15011545 /* verify that the packet does not have any known errors */
15021546 if (unlikely(ixgbe_test_staterr(rx_desc,
@@ -1506,40 +1550,9 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, · 3 unmodified lines
15061550 return true;
15071551 }
15081552
1509− /*
1510− * it is valid to use page_address instead of kmap since we are
1511− * working with pages allocated out of the lomem pool per
1512− * alloc_page(GFP_ATOMIC)
1513− */
1514− va = skb_frag_address(frag);
1515−
1516− /*
1517− * we need the header to contain the greater of either ETH_HLEN or
1518− * 60 bytes if the skb->len is less than 60 for skb_pad.
1519− */
1520− pull_len = skb_frag_size(frag);
1521− if (pull_len > IXGBE_RX_HDR_SIZE)
1522− pull_len = ixgbe_get_headlen(va, IXGBE_RX_HDR_SIZE);
1523−
1524− /* align pull length to size of long to optimize memcpy performance */
1525− skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
1526−
1527− /* update all of the pointers */
1528− skb_frag_size_sub(frag, pull_len);
1529− frag->page_offset += pull_len;
1530− skb->data_len -= pull_len;
1531− skb->tail += pull_len;
1532−
1533− /*
1534− * if we sucked the frag empty then we should free it,
1535− * if there are other frags here something is screwed up in hardware
1536− */
1537− if (skb_frag_size(frag) == 0) {
1538− BUG_ON(skb_shinfo(skb)->nr_frags != 1);
1539− skb_shinfo(skb)->nr_frags = 0;
1540− __skb_frag_unref(frag);
1541− skb->truesize -= ixgbe_rx_bufsz(rx_ring);
1542− }
1553+ /* place header in linear portion of buffer */
1554+ if (skb_is_nonlinear(skb))
1555+ ixgbe_pull_tail(rx_ring, skb);
15431556
15441557 #ifdef IXGBE_FCOE
15451558 /* do not attempt to pad FCoE Frames as this will disrupt DDP */
@@ -1559,34 +1572,18 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, · 13 unmodified lines
15591572 return false;
15601573 }
15611574
1562−/**
1563− * ixgbe_can_reuse_page - determine if we can reuse a page
1564− * @rx_buffer: pointer to rx_buffer containing the page we want to reuse
1565− *
1566− * Returns true if page can be reused in another Rx buffer
1567− **/
1568−static inline bool ixgbe_can_reuse_page(struct ixgbe_rx_buffer *rx_buffer)
1569−{
1570− struct page *page = rx_buffer->page;
1571−
1572− /* if we are only owner of page and it is local we can reuse it */
1573− return likely(page_count(page) == 1) &&
1574− likely(page_to_nid(page) == numa_node_id());
1575−}
1576−
15771575 /**
15781576 * ixgbe_reuse_rx_page - page flip buffer and store it back on the ring
15791577 * @rx_ring: rx descriptor ring to store buffers on
15801578 * @old_buff: donor buffer to have page reused
15811579 *
1582− * Syncronizes page for reuse by the adapter
1580+ * Synchronizes page for reuse by the adapter
15831581 **/
15841582 static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring,
15851583 struct ixgbe_rx_buffer *old_buff)
15861584 {
15871585 struct ixgbe_rx_buffer *new_buff;
15881586 u16 nta = rx_ring->next_to_alloc;
1589− u16 bufsz = ixgbe_rx_bufsz(rx_ring);
15901587
15911588 new_buff = &rx_ring->rx_buffer_info[nta];
15921589
@@ -1597,17 +1594,13 @@ static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring, · 4 unmodified lines
15971594 /* transfer page from old buffer to new buffer */
15981595 new_buff->page = old_buff->page;
15991596 new_buff->dma = old_buff->dma;
1600−
1601− /* flip page offset to other buffer and store to new_buff */
1602− new_buff->page_offset = old_buff->page_offset ^ bufsz;
1597+ new_buff->page_offset = old_buff->page_offset;
16031598
16041599 /* sync the buffer for use by the device */
16051600 dma_sync_single_range_for_device(rx_ring->dev, new_buff->dma,
1606− new_buff->page_offset, bufsz,
1601+ new_buff->page_offset,
1602+ ixgbe_rx_bufsz(rx_ring),
16071603 DMA_FROM_DEVICE);
1608−
1609− /* bump ref count on page before it is given to the stack */
1610− get_page(new_buff->page);
16111604 }
16121605
16131606 /**
@@ -1617,20 +1610,159 @@ static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring, · 3 unmodified lines
16171610 * @rx_desc: descriptor containing length of buffer written by hardware
16181611 * @skb: sk_buff to place the data into
16191612 *
1620− * This function is based on skb_add_rx_frag. I would have used that
1621− * function however it doesn't handle the truesize case correctly since we
1622− * are allocating more memory than might be used for a single receive.
1613+ * This function will add the data contained in rx_buffer->page to the skb.
1614+ * This is done either through a direct copy if the data in the buffer is
1615+ * less than the skb header size, otherwise it will just attach the page as
1616+ * a frag to the skb.
1617+ *
1618+ * The function will then update the page offset if necessary and return
1619+ * true if the buffer can be reused by the adapter.
16231620 **/
1624−static void ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring,
1621+static bool ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring,
16251622 struct ixgbe_rx_buffer *rx_buffer,
1626− struct sk_buff *skb, int size)
1623+ union ixgbe_adv_rx_desc *rx_desc,
1624+ struct sk_buff *skb)
16271625 {
1628− skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags,
1629− rx_buffer->page, rx_buffer->page_offset,
1630− size);
1631− skb->len += size;
1632− skb->data_len += size;
1633− skb->truesize += ixgbe_rx_bufsz(rx_ring);
1626+ struct page *page = rx_buffer->page;
1627+ unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
1628+#if (PAGE_SIZE < 8192)
1629+ unsigned int truesize = ixgbe_rx_bufsz(rx_ring);
1630+#else
1631+ unsigned int truesize = ALIGN(size, L1_CACHE_BYTES);
1632+ unsigned int last_offset = ixgbe_rx_pg_size(rx_ring) -
1633+ ixgbe_rx_bufsz(rx_ring);
1634+#endif
1635+
1636+ if ((size <= IXGBE_RX_HDR_SIZE) && !skb_is_nonlinear(skb)) {
1637+ unsigned char *va = page_address(page) + rx_buffer->page_offset;
1638+
1639+ memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));
1640+
1641+ /* we can reuse buffer as-is, just make sure it is local */
1642+ if (likely(page_to_nid(page) == numa_node_id()))
1643+ return true;
1644+
1645+ /* this page cannot be reused so discard it */
1646+ put_page(page);
1647+ return false;
1648+ }
1649+
1650+ skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
1651+ rx_buffer->page_offset, size, truesize);
1652+
1653+ /* avoid re-using remote pages */
1654+ if (unlikely(page_to_nid(page) != numa_node_id()))
1655+ return false;
1656+
1657+#if (PAGE_SIZE < 8192)
1658+ /* if we are only owner of page we can reuse it */
1659+ if (unlikely(page_count(page) != 1))
1660+ return false;
1661+
1662+ /* flip page offset to other buffer */
1663+ rx_buffer->page_offset ^= truesize;
1664+
1665+ /*
1666+ * since we are the only owner of the page and we need to
1667+ * increment it, just set the value to 2 in order to avoid
1668+ * an unecessary locked operation
1669+ */
1670+ atomic_set(&page->_count, 2);
1671+#else
1672+ /* move offset up to the next cache line */
1673+ rx_buffer->page_offset += truesize;
1674+
1675+ if (rx_buffer->page_offset > last_offset)
1676+ return false;
1677+
1678+ /* bump ref count on page before it is given to the stack */
1679+ get_page(page);
1680+#endif
1681+
1682+ return true;
1683+}
1684+
1685+static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring,
1686+ union ixgbe_adv_rx_desc *rx_desc)
1687+{
1688+ struct ixgbe_rx_buffer *rx_buffer;
1689+ struct sk_buff *skb;
1690+ struct page *page;
1691+
1692+ rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];
1693+ page = rx_buffer->page;
1694+ prefetchw(page);
1695+
1696+ skb = rx_buffer->skb;
1697+
1698+ if (likely(!skb)) {
1699+ void *page_addr = page_address(page) +
1700+ rx_buffer->page_offset;
1701+
1702+ /* prefetch first cache line of first page */
1703+ prefetch(page_addr);
1704+#if L1_CACHE_BYTES < 128
1705+ prefetch(page_addr + L1_CACHE_BYTES);
1706+#endif
1707+
1708+ /* allocate a skb to store the frags */
1709+ skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
1710+ IXGBE_RX_HDR_SIZE);
1711+ if (unlikely(!skb)) {
1712+ rx_ring->rx_stats.alloc_rx_buff_failed++;
1713+ return NULL;
1714+ }
1715+
1716+ /*
1717+ * we will be copying header into skb->data in
1718+ * pskb_may_pull so it is in our interest to prefetch
1719+ * it now to avoid a possible cache miss
1720+ */
1721+ prefetchw(skb->data);
1722+
1723+ /*
1724+ * Delay unmapping of the first packet. It carries the
1725+ * header information, HW may still access the header
1726+ * after the writeback. Only unmap it when EOP is
1727+ * reached
1728+ */
1729+ if (likely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)))
1730+ goto dma_sync;
1731+
1732+ IXGBE_CB(skb)->dma = rx_buffer->dma;
1733+ } else {
1734+ if (ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP))
1735+ ixgbe_dma_sync_frag(rx_ring, skb);
1736+
1737+dma_sync:
1738+ /* we are reusing so sync this buffer for CPU use */
1739+ dma_sync_single_range_for_cpu(rx_ring->dev,
1740+ rx_buffer->dma,
1741+ rx_buffer->page_offset,
1742+ ixgbe_rx_bufsz(rx_ring),
1743+ DMA_FROM_DEVICE);
1744+ }
1745+
1746+ /* pull page into skb */
1747+ if (ixgbe_add_rx_frag(rx_ring, rx_buffer, rx_desc, skb)) {
1748+ /* hand second half of page back to the ring */
1749+ ixgbe_reuse_rx_page(rx_ring, rx_buffer);
1750+ } else if (IXGBE_CB(skb)->dma == rx_buffer->dma) {
1751+ /* the page has been released from the ring */
1752+ IXGBE_CB(skb)->page_released = true;
1753+ } else {
1754+ /* we are not reusing the buffer so unmap it */
1755+ dma_unmap_page(rx_ring->dev, rx_buffer->dma,
1756+ ixgbe_rx_pg_size(rx_ring),
1757+ DMA_FROM_DEVICE);
1758+ }
1759+
1760+ /* clear contents of buffer_info */
1761+ rx_buffer->skb = NULL;
1762+ rx_buffer->dma = 0;
1763+ rx_buffer->page = NULL;
1764+
1765+ return skb;
16341766 }
16351767
16361768 /**
@@ -1653,16 +1785,14 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 16 unmodified lines
16531785 unsigned int total_rx_bytes = 0, total_rx_packets = 0;
16541786 #ifdef IXGBE_FCOE
16551787 struct ixgbe_adapter *adapter = q_vector->adapter;
1656− int ddp_bytes = 0;
1788+ int ddp_bytes;
1789+ unsigned int mss = 0;
16571790 #endif /* IXGBE_FCOE */
16581791 u16 cleaned_count = ixgbe_desc_unused(rx_ring);
16591792
16601793 do {
1661− struct ixgbe_rx_buffer *rx_buffer;
16621794 union ixgbe_adv_rx_desc *rx_desc;
16631795 struct sk_buff *skb;
1664− struct page *page;
1665− u16 ntc;
16661796
16671797 /* return some buffers to hardware, one at a time is too slow */
16681798 if (cleaned_count >= IXGBE_RX_BUFFER_WRITE) {
@@ -1670,9 +1800,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 1 unmodified line
16701800 cleaned_count = 0;
16711801 }
16721802
1673− ntc = rx_ring->next_to_clean;
1674− rx_desc = IXGBE_RX_DESC(rx_ring, ntc);
1675− rx_buffer = &rx_ring->rx_buffer_info[ntc];
1803+ rx_desc = IXGBE_RX_DESC(rx_ring, rx_ring->next_to_clean);
16761804
16771805 if (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_DD))
16781806 break;
@@ -1684,75 +1812,12 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 5 unmodified lines
16841812 */
16851813 rmb();
16861814
1687− page = rx_buffer->page;
1688− prefetchw(page);
1689−
1690− skb = rx_buffer->skb;
1691−
1692− if (likely(!skb)) {
1693− void *page_addr = page_address(page) +
1694− rx_buffer->page_offset;
1695−
1696− /* prefetch first cache line of first page */
1697− prefetch(page_addr);
1698−#if L1_CACHE_BYTES < 128
1699− prefetch(page_addr + L1_CACHE_BYTES);
1700−#endif
1815+ /* retrieve a buffer from the ring */
1816+ skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);
17011817
1702− /* allocate a skb to store the frags */
1703− skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
1704− IXGBE_RX_HDR_SIZE);
1705− if (unlikely(!skb)) {
1706− rx_ring->rx_stats.alloc_rx_buff_failed++;
1707− break;
1708− }
1709−
1710− /*
1711− * we will be copying header into skb->data in
1712− * pskb_may_pull so it is in our interest to prefetch
1713− * it now to avoid a possible cache miss
1714− */
1715− prefetchw(skb->data);
1716−
1717− /*
1718− * Delay unmapping of the first packet. It carries the
1719− * header information, HW may still access the header
1720− * after the writeback. Only unmap it when EOP is
1721− * reached
1722− */
1723− IXGBE_CB(skb)->dma = rx_buffer->dma;
1724− } else {
1725− /* we are reusing so sync this buffer for CPU use */
1726− dma_sync_single_range_for_cpu(rx_ring->dev,
1727− rx_buffer->dma,
1728− rx_buffer->page_offset,
1729− ixgbe_rx_bufsz(rx_ring),
1730− DMA_FROM_DEVICE);
1731− }
1732−
1733− /* pull page into skb */
1734− ixgbe_add_rx_frag(rx_ring, rx_buffer, skb,
1735− le16_to_cpu(rx_desc->wb.upper.length));
1736−
1737− if (ixgbe_can_reuse_page(rx_buffer)) {
1738− /* hand second half of page back to the ring */
1739− ixgbe_reuse_rx_page(rx_ring, rx_buffer);
1740− } else if (IXGBE_CB(skb)->dma == rx_buffer->dma) {
1741− /* the page has been released from the ring */
1742− IXGBE_CB(skb)->page_released = true;
1743− } else {
1744− /* we are not reusing the buffer so unmap it */
1745− dma_unmap_page(rx_ring->dev, rx_buffer->dma,
1746− ixgbe_rx_pg_size(rx_ring),
1747− DMA_FROM_DEVICE);
1748− }
1749−
1750− /* clear contents of buffer_info */
1751− rx_buffer->skb = NULL;
1752− rx_buffer->dma = 0;
1753− rx_buffer->page = NULL;
1754−
1755− ixgbe_get_rsc_cnt(rx_ring, rx_desc, skb);
1818+ /* exit if we failed to retrieve a buffer */
1819+ if (!skb)
1820+ break;
17561821
17571822 cleaned_count++;
17581823
@@ -1775,6 +1840,20 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 16 unmodified lines
17751840 /* if ddp, not passing to ULD unless for FCP_RSP or error */
17761841 if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) {
17771842 ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb);
1843+ /* include DDPed FCoE data */
1844+ if (ddp_bytes > 0) {
1845+ if (!mss) {
1846+ mss = rx_ring->netdev->mtu -
1847+ sizeof(struct fcoe_hdr) -
1848+ sizeof(struct fc_frame_header) -
1849+ sizeof(struct fcoe_crc_eof);
1850+ if (mss > 512)
1851+ mss &= ~511;
1852+ }
1853+ total_rx_bytes += ddp_bytes;
1854+ total_rx_packets += DIV_ROUND_UP(ddp_bytes,
1855+ mss);
1856+ }
17781857 if (!ddp_bytes) {
17791858 dev_kfree_skb_any(skb);
17801859 continue;
@@ -1788,21 +1867,6 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 7 unmodified lines
17881867 budget--;
17891868 } while (likely(budget));
17901869
1791−#ifdef IXGBE_FCOE
1792− /* include DDPed FCoE data */
1793− if (ddp_bytes > 0) {
1794− unsigned int mss;
1795−
1796− mss = rx_ring->netdev->mtu - sizeof(struct fcoe_hdr) -
1797− sizeof(struct fc_frame_header) -
1798− sizeof(struct fcoe_crc_eof);
1799− if (mss > 512)
1800− mss &= ~511;
1801− total_rx_bytes += ddp_bytes;
1802− total_rx_packets += DIV_ROUND_UP(ddp_bytes, mss);
1803− }
1804−
1805−#endif /* IXGBE_FCOE */
18061870 u64_stats_update_begin(&rx_ring->syncp);
18071871 rx_ring->stats.packets += total_rx_packets;
18081872 rx_ring->stats.bytes += total_rx_bytes;
@@ -2868,11 +2932,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, · 1059 unmodified lines
28682932 srrctl = IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT;
28692933
28702934 /* configure the packet buffer length */
2871−#if PAGE_SIZE > IXGBE_MAX_RXBUFFER
2872− srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
2873−#else
28742935 srrctl |= ixgbe_rx_bufsz(rx_ring) >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
2875−#endif
28762936
28772937 /* configure descriptor type */
28782938 srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
@@ -2980,13 +3040,7 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, · 101 unmodified lines
29803040 * total size of max desc * buf_len is not greater
29813041 * than 65536
29823042 */
2983−#if (PAGE_SIZE <= 8192)
29843043 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2985−#elif (PAGE_SIZE <= 16384)
2986− rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2987−#else
2988− rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
2989−#endif
29903044 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(reg_idx), rscctrl);
29913045 }
29923046
@@ -3606,8 +3660,6 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) · 613 unmodified lines
36063660 if (hw->mac.type == ixgbe_mac_82598EB)
36073661 netif_set_gso_max_size(adapter->netdev, 32768);
36083662
3609− hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true);
3610−
36113663 #ifdef IXGBE_FCOE
36123664 if (adapter->netdev->features & NETIF_F_FCOE_MTU)
36133665 max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
@@ -3807,6 +3859,11 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter) · 193 unmodified lines
38073859 #ifdef CONFIG_IXGBE_DCB
38083860 ixgbe_configure_dcb(adapter);
38093861 #endif
3862+ /*
3863+ * We must restore virtualization before VLANs or else
3864+ * the VLVF registers will not be populated
3865+ */
3866+ ixgbe_configure_virtualization(adapter);
38103867
38113868 ixgbe_set_rx_mode(adapter->netdev);
38123869 ixgbe_restore_vlan(adapter);
@@ -3838,8 +3895,6 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter) · 25 unmodified lines
38383895 break;
38393896 }
38403897
3841− ixgbe_configure_virtualization(adapter);
3842−
38433898 #ifdef IXGBE_FCOE
38443899 /* configure FCoE L2 filters, redirection table, and Rx control */
38453900 ixgbe_configure_fcoe(adapter);
@@ -4129,27 +4184,6 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) · 283 unmodified lines
41294184 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
41304185 }
41314186
4132−/**
4133− * ixgbe_init_rx_page_offset - initialize page offset values for Rx buffers
4134− * @rx_ring: ring to setup
4135− *
4136− * On many IA platforms the L1 cache has a critical stride of 4K, this
4137− * results in each receive buffer starting in the same cache set. To help
4138− * reduce the pressure on this cache set we can interleave the offsets so
4139− * that only every other buffer will be in the same cache set.
4140− **/
4141−static void ixgbe_init_rx_page_offset(struct ixgbe_ring *rx_ring)
4142−{
4143− struct ixgbe_rx_buffer *rx_buffer = rx_ring->rx_buffer_info;
4144− u16 i;
4145−
4146− for (i = 0; i < rx_ring->count; i += 2) {
4147− rx_buffer[0].page_offset = 0;
4148− rx_buffer[1].page_offset = ixgbe_rx_bufsz(rx_ring);
4149− rx_buffer = &rx_buffer[2];
4150− }
4151−}
4152−
41534187 /**
41544188 * ixgbe_clean_rx_ring - Free Rx Buffers per Queue
41554189 * @rx_ring: ring to free buffers from
@@ -4195,8 +4229,6 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring) · 39 unmodified lines
41954229 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
41964230 memset(rx_ring->rx_buffer_info, 0, size);
41974231
4198− ixgbe_init_rx_page_offset(rx_ring);
4199−
42004232 /* Zero out the descriptor ring */
42014233 memset(rx_ring->desc, 0, rx_ring->size);
42024234
@@ -4646,8 +4678,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring) · 443 unmodified lines
46464678 rx_ring->next_to_clean = 0;
46474679 rx_ring->next_to_use = 0;
46484680
4649− ixgbe_init_rx_page_offset(rx_ring);
4650−
46514681 return 0;
46524682 err:
46534683 vfree(rx_ring->rx_buffer_info);
@@ -5530,8 +5560,9 @@ static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) · 876 unmodified lines
55305560 {
55315561 u32 ssvpc;
55325562
5533− /* Do not perform spoof check for 82598 */
5534− if (adapter->hw.mac.type == ixgbe_mac_82598EB)
5563+ /* Do not perform spoof check for 82598 or if not in IOV mode */
5564+ if (adapter->hw.mac.type == ixgbe_mac_82598EB ||
5565+ adapter->num_vfs == 0)
55355566 return;
55365567
55375568 ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC);
@@ -5543,7 +5574,7 @@ static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) · 5 unmodified lines
55435574 if (!ssvpc)
55445575 return;
55455576
5546− e_warn(drv, "%d Spoofed packets detected\n", ssvpc);
5577+ e_warn(drv, "%u Spoofed packets detected\n", ssvpc);
55475578 }
55485579
55495580 /**
@@ -5874,9 +5905,12 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring, · 324 unmodified lines
58745905 u32 type_tucmd = 0;
58755906
58765907 if (skb->ip_summed != CHECKSUM_PARTIAL) {
5877− if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN) &&
5878− !(first->tx_flags & IXGBE_TX_FLAGS_TXSW))
5879− return;
5908+ if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN)) {
5909+ if (unlikely(skb->no_fcs))
5910+ first->tx_flags |= IXGBE_TX_FLAGS_NO_IFCS;
5911+ if (!(first->tx_flags & IXGBE_TX_FLAGS_TXSW))
5912+ return;
5913+ }
58805914 } else {
58815915 u8 l4_hdr = 0;
58825916 switch (first->protocol) {
@@ -5938,7 +5972,6 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags) · 55 unmodified lines
59385972 {
59395973 /* set type for advanced descriptor with frame checksum insertion */
59405974 __le32 cmd_type = cpu_to_le32(IXGBE_ADVTXD_DTYP_DATA |
5941− IXGBE_ADVTXD_DCMD_IFCS |
59425975 IXGBE_ADVTXD_DCMD_DEXT);
59435976
59445977 /* set HW vlan bit if vlan is present */
@@ -5958,6 +5991,10 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags) · 13 unmodified lines
59585991 #endif
59595992 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_TSE);
59605993
5994+ /* insert frame checksum */
5995+ if (!(tx_flags & IXGBE_TX_FLAGS_NO_IFCS))
5996+ cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_IFCS);
5997+
59615998 return cmd_type;
59625999 }
59636000
@@ -6063,8 +6100,6 @@ static void ixgbe_tx_map(struct ixgbe_ring *tx_ring, · 99 unmodified lines
60636100 if (likely(!data_len))
60646101 break;
60656102
6066− if (unlikely(skb->no_fcs))
6067− cmd_type &= ~(cpu_to_le32(IXGBE_ADVTXD_DCMD_IFCS));
60686103 tx_desc->read.cmd_type_len = cmd_type | cpu_to_le32(size);
60696104
60706105 i++;
@@ -6854,9 +6889,9 @@ static int ixgbe_set_features(struct net_device *netdev, · 783 unmodified lines
68546889 return 0;
68556890 }
68566891
6857−static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
6892+static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
68586893 struct net_device *dev,
6859− unsigned char *addr,
6894+ const unsigned char *addr,
68606895 u16 flags)
68616896 {
68626897 struct ixgbe_adapter *adapter = netdev_priv(dev);
@@ -6893,7 +6928,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, · 30 unmodified lines
68936928
68946929 static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,
68956930 struct net_device *dev,
6896− unsigned char *addr)
6931+ const unsigned char *addr)
68976932 {
68986933 struct ixgbe_adapter *adapter = netdev_priv(dev);
68996934 int err = -EOPNOTSUPP;
@@ -7136,11 +7171,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, · 236 unmodified lines
71367171 goto err_ioremap;
71377172 }
71387173
7139− for (i = 1; i <= 5; i++) {
7140− if (pci_resource_len(pdev, i) == 0)
7141− continue;
7142− }
7143−
71447174 netdev->netdev_ops = &ixgbe_netdev_ops;
71457175 ixgbe_set_ethtool_ops(netdev);
71467176 netdev->watchdog_timeo = 5 * HZ;
@@ -7419,6 +7449,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, · 272 unmodified lines
74197449 e_err(probe, "failed to allocate sysfs resources\n");
74207450 #endif /* CONFIG_IXGBE_HWMON */
74217451
7452+#ifdef CONFIG_DEBUG_FS
7453+ ixgbe_dbg_adapter_init(adapter);
7454+#endif /* CONFIG_DEBUG_FS */
7455+
74227456 return 0;
74237457
74247458 err_register:
@@ -7453,6 +7487,10 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) · 28 unmodified lines
74537487 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
74547488 struct net_device *netdev = adapter->netdev;
74557489
7490+#ifdef CONFIG_DEBUG_FS
7491+ ixgbe_dbg_adapter_exit(adapter);
7492+#endif /*CONFIG_DEBUG_FS */
7493+
74567494 set_bit(__IXGBE_DOWN, &adapter->state);
74577495 cancel_work_sync(&adapter->service_task);
74587496
@@ -7708,6 +7746,10 @@ static int __init ixgbe_init_module(void) · 249 unmodified lines
77087746 pr_info("%s - version %s\n", ixgbe_driver_string, ixgbe_driver_version);
77097747 pr_info("%s\n", ixgbe_copyright);
77107748
7749+#ifdef CONFIG_DEBUG_FS
7750+ ixgbe_dbg_init();
7751+#endif /* CONFIG_DEBUG_FS */
7752+
77117753 #ifdef CONFIG_IXGBE_DCA
77127754 dca_register_notify(&dca_notifier);
77137755 #endif
@@ -7730,6 +7772,11 @@ static void __exit ixgbe_exit_module(void) · 16 unmodified lines
77307772 dca_unregister_notify(&dca_notifier);
77317773 #endif
77327774 pci_unregister_driver(&ixgbe_driver);
7775+
7776+#ifdef CONFIG_DEBUG_FS
7777+ ixgbe_dbg_exit();
7778+#endif /* CONFIG_DEBUG_FS */
7779+
77337780 rcu_barrier(); /* Wait for completion of call_rcu()'s */
77347781 }
77357782
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c+2−1
@@ -960,7 +960,8 @@ void ixgbe_ptp_init(struct ixgbe_adapter *adapter) · 959 unmodified lines
960960 /* (Re)start the overflow check */
961961 adapter->flags2 |= IXGBE_FLAG2_OVERFLOW_CHECK_ENABLED;
962962
963− adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps);
963+ adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
964+ &adapter->pdev->dev);
964965 if (IS_ERR(adapter->ptp_clock)) {
965966 adapter->ptp_clock = NULL;
966967 e_dev_err("ptp_clock_register failed\n");
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c+64−41
@@ -346,6 +346,10 @@ void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter) · 345 unmodified lines
346346 static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid,
347347 u32 vf)
348348 {
349+ /* VLAN 0 is a special case, don't allow it to be removed */
350+ if (!vid && !add)
351+ return 0;
352+
349353 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add);
350354 }
351355
@@ -414,6 +418,7 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) · 62 unmodified lines
414418 VLAN_PRIO_SHIFT)), vf);
415419 ixgbe_set_vmolr(hw, vf, false);
416420 } else {
421+ ixgbe_set_vf_vlan(adapter, true, 0, vf);
417422 ixgbe_set_vmvir(adapter, 0, vf);
418423 ixgbe_set_vmolr(hw, vf, true);
419424 }
@@ -810,9 +815,9 @@ out: · 390 unmodified lines
810815 return err;
811816 }
812817
813−static int ixgbe_link_mbps(int internal_link_speed)
818+static int ixgbe_link_mbps(struct ixgbe_adapter *adapter)
814819 {
815− switch (internal_link_speed) {
820+ switch (adapter->link_speed) {
816821 case IXGBE_LINK_SPEED_100_FULL:
817822 return 100;
818823 case IXGBE_LINK_SPEED_1GB_FULL:
@@ -824,27 +829,30 @@ static int ixgbe_link_mbps(int internal_link_speed) · 5 unmodified lines
824829 }
825830 }
826831
827−static void ixgbe_set_vf_rate_limit(struct ixgbe_hw *hw, int vf, int tx_rate,
828− int link_speed)
832+static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf)
829833 {
830− int rf_dec, rf_int;
831− u32 bcnrc_val;
834+ struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
835+ struct ixgbe_hw *hw = &adapter->hw;
836+ u32 bcnrc_val = 0;
837+ u16 queue, queues_per_pool;
838+ u16 tx_rate = adapter->vfinfo[vf].tx_rate;
839+
840+ if (tx_rate) {
841+ /* start with base link speed value */
842+ bcnrc_val = adapter->vf_rate_link_speed;
832843
833− if (tx_rate != 0) {
834844 /* Calculate the rate factor values to set */
835− rf_int = link_speed / tx_rate;
836− rf_dec = (link_speed - (rf_int * tx_rate));
837− rf_dec = (rf_dec * (1<<IXGBE_RTTBCNRC_RF_INT_SHIFT)) / tx_rate;
838−
839− bcnrc_val = IXGBE_RTTBCNRC_RS_ENA;
840− bcnrc_val |= ((rf_int<<IXGBE_RTTBCNRC_RF_INT_SHIFT) &
841− IXGBE_RTTBCNRC_RF_INT_MASK);
842− bcnrc_val |= (rf_dec & IXGBE_RTTBCNRC_RF_DEC_MASK);
843− } else {
844− bcnrc_val = 0;
845+ bcnrc_val <<= IXGBE_RTTBCNRC_RF_INT_SHIFT;
846+ bcnrc_val /= tx_rate;
847+
848+ /* clear everything but the rate factor */
849+ bcnrc_val &= IXGBE_RTTBCNRC_RF_INT_MASK |
850+ IXGBE_RTTBCNRC_RF_DEC_MASK;
851+
852+ /* enable the rate scheduler */
853+ bcnrc_val |= IXGBE_RTTBCNRC_RS_ENA;
845854 }
846855
847− IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, 2*vf); /* vf Y uses queue 2*Y */
848856 /*
849857 * Set global transmit compensation time to the MMW_SIZE in RTTBCNRM
850858 * register. Typically MMW_SIZE=0x014 if 9728-byte jumbo is supported
@@ -861,53 +869,68 @@ static void ixgbe_set_vf_rate_limit(struct ixgbe_hw *hw, int vf, int tx_rate, · 10 unmodified lines
861869 break;
862870 }
863871
864− IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, bcnrc_val);
872+ /* determine how many queues per pool based on VMDq mask */
873+ queues_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
874+
875+ /* write value for all Tx queues belonging to VF */
876+ for (queue = 0; queue < queues_per_pool; queue++) {
877+ unsigned int reg_idx = (vf * queues_per_pool) + queue;
878+
879+ IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, reg_idx);
880+ IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, bcnrc_val);
881+ }
865882 }
866883
867884 void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter)
868885 {
869− int actual_link_speed, i;
870− bool reset_rate = false;
886+ int i;
871887
872888 /* VF Tx rate limit was not set */
873− if (adapter->vf_rate_link_speed == 0)
889+ if (!adapter->vf_rate_link_speed)
874890 return;
875891
876− actual_link_speed = ixgbe_link_mbps(adapter->link_speed);
877− if (actual_link_speed != adapter->vf_rate_link_speed) {
878− reset_rate = true;
892+ if (ixgbe_link_mbps(adapter) != adapter->vf_rate_link_speed) {
879893 adapter->vf_rate_link_speed = 0;
880894 dev_info(&adapter->pdev->dev,
881− "Link speed has been changed. VF Transmit rate "
882− "is disabled\n");
895+ "Link speed has been changed. VF Transmit rate is disabled\n");
883896 }
884897
885898 for (i = 0; i < adapter->num_vfs; i++) {
886− if (reset_rate)
899+ if (!adapter->vf_rate_link_speed)
887900 adapter->vfinfo[i].tx_rate = 0;
888901
889− ixgbe_set_vf_rate_limit(&adapter->hw, i,
890− adapter->vfinfo[i].tx_rate,
891− actual_link_speed);
902+ ixgbe_set_vf_rate_limit(adapter, i);
892903 }
893904 }
894905
895906 int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate)
896907 {
897908 struct ixgbe_adapter *adapter = netdev_priv(netdev);
898− struct ixgbe_hw *hw = &adapter->hw;
899− int actual_link_speed;
909+ int link_speed;
910+
911+ /* verify VF is active */
912+ if (vf >= adapter->num_vfs)
913+ return -EINVAL;
900914
901− actual_link_speed = ixgbe_link_mbps(adapter->link_speed);
902− if ((vf >= adapter->num_vfs) || (!adapter->link_up) ||
903− (tx_rate > actual_link_speed) || (actual_link_speed != 10000) ||
904− ((tx_rate != 0) && (tx_rate <= 10)))
905− /* rate limit cannot be set to 10Mb or less in 10Gb adapters */
915+ /* verify link is up */
916+ if (!adapter->link_up)
906917 return -EINVAL;
907918
908− adapter->vf_rate_link_speed = actual_link_speed;
909− adapter->vfinfo[vf].tx_rate = (u16)tx_rate;
910− ixgbe_set_vf_rate_limit(hw, vf, tx_rate, actual_link_speed);
919+ /* verify we are linked at 10Gbps */
920+ link_speed = ixgbe_link_mbps(adapter);
921+ if (link_speed != 10000)
922+ return -EINVAL;
923+
924+ /* rate limit cannot be less than 10Mbs or greater than link speed */
925+ if (tx_rate && ((tx_rate <= 10) || (tx_rate > link_speed)))
926+ return -EINVAL;
927+
928+ /* store values */
929+ adapter->vf_rate_link_speed = link_speed;
930+ adapter->vfinfo[vf].tx_rate = tx_rate;
931+
932+ /* update hardware configuration */
933+ ixgbe_set_vf_rate_limit(adapter, vf);
911934
912935 return 0;
913936 }
drivers/net/ethernet/intel/ixgbevf/defines.h+1−0
@@ -272,5 +272,6 @@ struct ixgbe_adv_tx_context_desc { · 271 unmodified lines
272272 /* Error Codes */
273273 #define IXGBE_ERR_INVALID_MAC_ADDR -1
274274 #define IXGBE_ERR_RESET_FAILED -2
275+#define IXGBE_ERR_INVALID_ARGUMENT -3
275276
276277 #endif /* _IXGBEVF_DEFINES_H_ */
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h+8−1
@@ -101,7 +101,9 @@ struct ixgbevf_ring { · 100 unmodified lines
101101
102102 /* Supported Rx Buffer Sizes */
103103 #define IXGBEVF_RXBUFFER_256 256 /* Used for packet split */
104−#define IXGBEVF_RXBUFFER_2048 2048
104+#define IXGBEVF_RXBUFFER_3K 3072
105+#define IXGBEVF_RXBUFFER_7K 7168
106+#define IXGBEVF_RXBUFFER_15K 15360
105107 #define IXGBEVF_MAX_RXBUFFER 16384 /* largest size for single descriptor */
106108
107109 #define IXGBEVF_RX_HDR_SIZE IXGBEVF_RXBUFFER_256
@@ -259,6 +261,11 @@ enum ixbgevf_state_t { · 151 unmodified lines
259261 __IXGBEVF_DOWN
260262 };
261263
264+struct ixgbevf_cb {
265+ struct sk_buff *prev;
266+};
267+#define IXGBE_CB(skb) ((struct ixgbevf_cb *)(skb)->cb)
268+
262269 enum ixgbevf_boards {
263270 board_82599_vf,
264271 board_X540_vf,
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+194−78
@@ -263,6 +263,8 @@ cont_loop: · 262 unmodified lines
263263 tx_ring->total_bytes += total_bytes;
264264 tx_ring->total_packets += total_packets;
265265 u64_stats_update_end(&tx_ring->syncp);
266+ q_vector->tx.total_bytes += total_bytes;
267+ q_vector->tx.total_packets += total_packets;
266268
267269 return count < tx_ring->count;
268270 }
@@ -272,12 +274,10 @@ cont_loop: · 3 unmodified lines
272274 * @q_vector: structure containing interrupt and ring information
273275 * @skb: packet to send up
274276 * @status: hardware indication of status of receive
275− * @rx_ring: rx descriptor ring (for a specific queue) to setup
276277 * @rx_desc: rx descriptor
277278 **/
278279 static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector,
279280 struct sk_buff *skb, u8 status,
280− struct ixgbevf_ring *ring,
281281 union ixgbe_adv_rx_desc *rx_desc)
282282 {
283283 struct ixgbevf_adapter *adapter = q_vector->adapter;
@@ -433,11 +433,21 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, · 149 unmodified lines
433433
434434 if (!(staterr & IXGBE_RXD_STAT_EOP)) {
435435 skb->next = next_buffer->skb;
436− skb->next->prev = skb;
436+ IXGBE_CB(skb->next)->prev = skb;
437437 adapter->non_eop_descs++;
438438 goto next_desc;
439439 }
440440
441+ /* we should not be chaining buffers, if we did drop the skb */
442+ if (IXGBE_CB(skb)->prev) {
443+ do {
444+ struct sk_buff *this = skb;
445+ skb = IXGBE_CB(skb)->prev;
446+ dev_kfree_skb(this);
447+ } while (skb);
448+ goto next_desc;
449+ }
450+
441451 /* ERR_MASK will only have valid bits if EOP set */
442452 if (unlikely(staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK)) {
443453 dev_kfree_skb_irq(skb);
@@ -461,7 +471,7 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, · 17 unmodified lines
461471 }
462472 skb->protocol = eth_type_trans(skb, rx_ring->netdev);
463473
464− ixgbevf_receive_skb(q_vector, skb, staterr, rx_ring, rx_desc);
474+ ixgbevf_receive_skb(q_vector, skb, staterr, rx_desc);
465475
466476 next_desc:
467477 rx_desc->wb.upper.status_error = 0;
@@ -490,6 +500,8 @@ next_desc: · 22 unmodified lines
490500 rx_ring->total_packets += total_rx_packets;
491501 rx_ring->total_bytes += total_rx_bytes;
492502 u64_stats_update_end(&rx_ring->syncp);
503+ q_vector->rx.total_packets += total_rx_packets;
504+ q_vector->rx.total_bytes += total_rx_bytes;
493505
494506 return !!budget;
495507 }
@@ -716,40 +728,15 @@ static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector) · 220 unmodified lines
716728 }
717729 }
718730
719−static irqreturn_t ixgbevf_msix_mbx(int irq, void *data)
731+static irqreturn_t ixgbevf_msix_other(int irq, void *data)
720732 {
721733 struct ixgbevf_adapter *adapter = data;
722734 struct ixgbe_hw *hw = &adapter->hw;
723− u32 msg;
724− bool got_ack = false;
725−
726− if (!hw->mbx.ops.check_for_ack(hw))
727− got_ack = true;
728735
729− if (!hw->mbx.ops.check_for_msg(hw)) {
730− hw->mbx.ops.read(hw, &msg, 1);
736+ hw->mac.get_link_status = 1;
731737
732− if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG)
733− mod_timer(&adapter->watchdog_timer,
734− round_jiffies(jiffies + 1));
735−
736− if (msg & IXGBE_VT_MSGTYPE_NACK)
737− pr_warn("Last Request of type %2.2x to PF Nacked\n",
738− msg & 0xFF);
739− /*
740− * Restore the PFSTS bit in case someone is polling for a
741− * return message from the PF
742− */
743− hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFSTS;
744− }
745−
746− /*
747− * checking for the ack clears the PFACK bit. Place
748− * it back in the v2p_mailbox cache so that anyone
749− * polling for an ack will not miss it
750− */
751− if (got_ack)
752− hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFACK;
738+ if (!test_bit(__IXGBEVF_DOWN, &adapter->state))
739+ mod_timer(&adapter->watchdog_timer, jiffies);
753740
754741 IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, adapter->eims_other);
755742
@@ -899,10 +886,10 @@ static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter) · 143 unmodified lines
899886 }
900887
901888 err = request_irq(adapter->msix_entries[vector].vector,
902− &ixgbevf_msix_mbx, 0, netdev->name, adapter);
889+ &ixgbevf_msix_other, 0, netdev->name, adapter);
903890 if (err) {
904891 hw_dbg(&adapter->hw,
905− "request_irq for msix_mbx failed: %d\n", err);
892+ "request_irq for msix_other failed: %d\n", err);
906893 goto free_queue_irqs;
907894 }
908895
@@ -1057,15 +1044,46 @@ static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index) · 148 unmodified lines
10571044
10581045 srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
10591046
1060− if (rx_ring->rx_buf_len == MAXIMUM_ETHERNET_VLAN_SIZE)
1061− srrctl |= IXGBEVF_RXBUFFER_2048 >>
1062− IXGBE_SRRCTL_BSIZEPKT_SHIFT;
1063− else
1064− srrctl |= rx_ring->rx_buf_len >>
1065− IXGBE_SRRCTL_BSIZEPKT_SHIFT;
1047+ srrctl |= ALIGN(rx_ring->rx_buf_len, 1024) >>
1048+ IXGBE_SRRCTL_BSIZEPKT_SHIFT;
1049+
10661050 IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(index), srrctl);
10671051 }
10681052
1053+static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter)
1054+{
1055+ struct ixgbe_hw *hw = &adapter->hw;
1056+ struct net_device *netdev = adapter->netdev;
1057+ int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
1058+ int i;
1059+ u16 rx_buf_len;
1060+
1061+ /* notify the PF of our intent to use this size of frame */
1062+ ixgbevf_rlpml_set_vf(hw, max_frame);
1063+
1064+ /* PF will allow an extra 4 bytes past for vlan tagged frames */
1065+ max_frame += VLAN_HLEN;
1066+
1067+ /*
1068+ * Make best use of allocation by using all but 1K of a
1069+ * power of 2 allocation that will be used for skb->head.
1070+ */
1071+ if ((hw->mac.type == ixgbe_mac_X540_vf) &&
1072+ (max_frame <= MAXIMUM_ETHERNET_VLAN_SIZE))
1073+ rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE;
1074+ else if (max_frame <= IXGBEVF_RXBUFFER_3K)
1075+ rx_buf_len = IXGBEVF_RXBUFFER_3K;
1076+ else if (max_frame <= IXGBEVF_RXBUFFER_7K)
1077+ rx_buf_len = IXGBEVF_RXBUFFER_7K;
1078+ else if (max_frame <= IXGBEVF_RXBUFFER_15K)
1079+ rx_buf_len = IXGBEVF_RXBUFFER_15K;
1080+ else
1081+ rx_buf_len = IXGBEVF_MAX_RXBUFFER;
1082+
1083+ for (i = 0; i < adapter->num_rx_queues; i++)
1084+ adapter->rx_ring[i].rx_buf_len = rx_buf_len;
1085+}
1086+
10691087 /**
10701088 * ixgbevf_configure_rx - Configure 82599 VF Receive Unit after Reset
10711089 * @adapter: board private structure
@@ -1076,18 +1094,14 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter) · 4 unmodified lines
10761094 {
10771095 u64 rdba;
10781096 struct ixgbe_hw *hw = &adapter->hw;
1079− struct net_device *netdev = adapter->netdev;
1080− int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
10811097 int i, j;
10821098 u32 rdlen;
1083− int rx_buf_len;
10841099
10851100 /* PSRTYPE must be initialized in 82599 */
10861101 IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);
1087− if (netdev->mtu <= ETH_DATA_LEN)
1088− rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE;
1089− else
1090− rx_buf_len = ALIGN(max_frame, 1024);
1102+
1103+ /* set_rx_buffer_len must be called before ring initialization */
1104+ ixgbevf_set_rx_buffer_len(adapter);
10911105
10921106 rdlen = adapter->rx_ring[0].count * sizeof(union ixgbe_adv_rx_desc);
10931107 /* Setup the HW Rx Head and Tail Descriptor Pointers and
@@ -1103,7 +1117,6 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter) · 9 unmodified lines
11031117 IXGBE_WRITE_REG(hw, IXGBE_VFRDT(j), 0);
11041118 adapter->rx_ring[i].head = IXGBE_VFRDH(j);
11051119 adapter->rx_ring[i].tail = IXGBE_VFRDT(j);
1106− adapter->rx_ring[i].rx_buf_len = rx_buf_len;
11071120
11081121 ixgbevf_configure_srrctl(adapter, j);
11091122 }
@@ -1113,36 +1126,47 @@ static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) · 3 unmodified lines
11131126 {
11141127 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
11151128 struct ixgbe_hw *hw = &adapter->hw;
1129+ int err;
1130+
1131+ if (!hw->mac.ops.set_vfta)
1132+ return -EOPNOTSUPP;
11161133
11171134 spin_lock(&adapter->mbx_lock);
11181135
11191136 /* add VID to filter table */
1120− if (hw->mac.ops.set_vfta)
1121− hw->mac.ops.set_vfta(hw, vid, 0, true);
1137+ err = hw->mac.ops.set_vfta(hw, vid, 0, true);
11221138
11231139 spin_unlock(&adapter->mbx_lock);
11241140
1141+ /* translate error return types so error makes sense */
1142+ if (err == IXGBE_ERR_MBX)
1143+ return -EIO;
1144+
1145+ if (err == IXGBE_ERR_INVALID_ARGUMENT)
1146+ return -EACCES;
1147+
11251148 set_bit(vid, adapter->active_vlans);
11261149
1127− return 0;
1150+ return err;
11281151 }
11291152
11301153 static int ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
11311154 {
11321155 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
11331156 struct ixgbe_hw *hw = &adapter->hw;
1157+ int err = -EOPNOTSUPP;
11341158
11351159 spin_lock(&adapter->mbx_lock);
11361160
11371161 /* remove VID from filter table */
11381162 if (hw->mac.ops.set_vfta)
1139− hw->mac.ops.set_vfta(hw, vid, 0, false);
1163+ err = hw->mac.ops.set_vfta(hw, vid, 0, false);
11401164
11411165 spin_unlock(&adapter->mbx_lock);
11421166
11431167 clear_bit(vid, adapter->active_vlans);
11441168
1145− return 0;
1169+ return err;
11461170 }
11471171
11481172 static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter)
@@ -1308,6 +1332,25 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter) · 159 unmodified lines
13081332 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc;
13091333 }
13101334
1335+static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)
1336+{
1337+ struct ixgbe_hw *hw = &adapter->hw;
1338+ int api[] = { ixgbe_mbox_api_10,
1339+ ixgbe_mbox_api_unknown };
1340+ int err = 0, idx = 0;
1341+
1342+ spin_lock(&adapter->mbx_lock);
1343+
1344+ while (api[idx] != ixgbe_mbox_api_unknown) {
1345+ err = ixgbevf_negotiate_api_version(hw, api[idx]);
1346+ if (!err)
1347+ break;
1348+ idx++;
1349+ }
1350+
1351+ spin_unlock(&adapter->mbx_lock);
1352+}
1353+
13111354 static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
13121355 {
13131356 struct net_device *netdev = adapter->netdev;
@@ -1315,7 +1358,6 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) · 1 unmodified line
13151358 int i, j = 0;
13161359 int num_rx_rings = adapter->num_rx_queues;
13171360 u32 txdctl, rxdctl;
1318− u32 msg[2];
13191361
13201362 for (i = 0; i < adapter->num_tx_queues; i++) {
13211363 j = adapter->tx_ring[i].reg_idx;
@@ -1356,10 +1398,6 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) · 34 unmodified lines
13561398 hw->mac.ops.set_rar(hw, 0, hw->mac.perm_addr, 0);
13571399 }
13581400
1359− msg[0] = IXGBE_VF_SET_LPE;
1360− msg[1] = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
1361− hw->mbx.ops.write_posted(hw, msg, 2);
1362−
13631401 spin_unlock(&adapter->mbx_lock);
13641402
13651403 clear_bit(__IXGBEVF_DOWN, &adapter->state);
@@ -1371,6 +1409,7 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) · 5 unmodified lines
13711409 ixgbevf_save_reset_stats(adapter);
13721410 ixgbevf_init_last_counter_stats(adapter);
13731411
1412+ hw->mac.get_link_status = 1;
13741413 mod_timer(&adapter->watchdog_timer, jiffies);
13751414 }
13761415
@@ -1378,6 +1417,8 @@ void ixgbevf_up(struct ixgbevf_adapter *adapter) · 1 unmodified line
13781417 {
13791418 struct ixgbe_hw *hw = &adapter->hw;
13801419
1420+ ixgbevf_negotiate_api(adapter);
1421+
13811422 ixgbevf_configure(adapter);
13821423
13831424 ixgbevf_up_complete(adapter);
@@ -1419,7 +1460,7 @@ static void ixgbevf_clean_rx_ring(struct ixgbevf_adapter *adapter, · 35 unmodified lines
14191460 rx_buffer_info->skb = NULL;
14201461 do {
14211462 struct sk_buff *this = skb;
1422− skb = skb->prev;
1463+ skb = IXGBE_CB(skb)->prev;
14231464 dev_kfree_skb(this);
14241465 } while (skb);
14251466 }
@@ -1547,8 +1588,6 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter) · 121 unmodified lines
15471588
15481589 void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter)
15491590 {
1550− struct ixgbe_hw *hw = &adapter->hw;
1551−
15521591 WARN_ON(in_interrupt());
15531592
15541593 while (test_and_set_bit(__IXGBEVF_RESETTING, &adapter->state))
@@ -1561,10 +1600,8 @@ void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter) · 6 unmodified lines
15611600 * watchdog task will continue to schedule reset tasks until
15621601 * the PF is up and running.
15631602 */
1564− if (!hw->mac.ops.reset_hw(hw)) {
1565− ixgbevf_down(adapter);
1566− ixgbevf_up(adapter);
1567− }
1603+ ixgbevf_down(adapter);
1604+ ixgbevf_up(adapter);
15681605
15691606 clear_bit(__IXGBEVF_RESETTING, &adapter->state);
15701607 }
@@ -1866,6 +1903,22 @@ err_set_interrupt: · 295 unmodified lines
18661903 return err;
18671904 }
18681905
1906+/**
1907+ * ixgbevf_clear_interrupt_scheme - Clear the current interrupt scheme settings
1908+ * @adapter: board private structure to clear interrupt scheme on
1909+ *
1910+ * We go through and clear interrupt specific resources and reset the structure
1911+ * to pre-load conditions
1912+ **/
1913+static void ixgbevf_clear_interrupt_scheme(struct ixgbevf_adapter *adapter)
1914+{
1915+ adapter->num_tx_queues = 0;
1916+ adapter->num_rx_queues = 0;
1917+
1918+ ixgbevf_free_q_vectors(adapter);
1919+ ixgbevf_reset_interrupt_capability(adapter);
1920+}
1921+
18691922 /**
18701923 * ixgbevf_sw_init - Initialize general software structures
18711924 * (struct ixgbevf_adapter)
@@ -2351,6 +2404,8 @@ static int ixgbevf_open(struct net_device *netdev) · 479 unmodified lines
23512404 }
23522405 }
23532406
2407+ ixgbevf_negotiate_api(adapter);
2408+
23542409 /* allocate transmit descriptors */
23552410 err = ixgbevf_setup_all_tx_resources(adapter);
23562411 if (err)
@@ -2860,10 +2915,8 @@ static int ixgbevf_set_mac(struct net_device *netdev, void *p) · 503 unmodified lines
28602915 static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
28612916 {
28622917 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
2863− struct ixgbe_hw *hw = &adapter->hw;
28642918 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
28652919 int max_possible_frame = MAXIMUM_ETHERNET_VLAN_SIZE;
2866− u32 msg[2];
28672920
28682921 if (adapter->hw.mac.type == ixgbe_mac_X540_vf)
28692922 max_possible_frame = IXGBE_MAX_JUMBO_FRAME_SIZE;
@@ -2877,35 +2930,91 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu) · 7 unmodified lines
28772930 /* must set new MTU before calling down or up */
28782931 netdev->mtu = new_mtu;
28792932
2880− if (!netif_running(netdev)) {
2881− msg[0] = IXGBE_VF_SET_LPE;
2882− msg[1] = max_frame;
2883− hw->mbx.ops.write_posted(hw, msg, 2);
2884− }
2885−
28862933 if (netif_running(netdev))
28872934 ixgbevf_reinit_locked(adapter);
28882935
28892936 return 0;
28902937 }
28912938
2892−static void ixgbevf_shutdown(struct pci_dev *pdev)
2939+static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
28932940 {
28942941 struct net_device *netdev = pci_get_drvdata(pdev);
28952942 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
2943+#ifdef CONFIG_PM
2944+ int retval = 0;
2945+#endif
28962946
28972947 netif_device_detach(netdev);
28982948
28992949 if (netif_running(netdev)) {
2950+ rtnl_lock();
29002951 ixgbevf_down(adapter);
29012952 ixgbevf_free_irq(adapter);
29022953 ixgbevf_free_all_tx_resources(adapter);
29032954 ixgbevf_free_all_rx_resources(adapter);
2955+ rtnl_unlock();
29042956 }
29052957
2906− pci_save_state(pdev);
2958+ ixgbevf_clear_interrupt_scheme(adapter);
29072959
2960+#ifdef CONFIG_PM
2961+ retval = pci_save_state(pdev);
2962+ if (retval)
2963+ return retval;
2964+
2965+#endif
29082966 pci_disable_device(pdev);
2967+
2968+ return 0;
2969+}
2970+
2971+#ifdef CONFIG_PM
2972+static int ixgbevf_resume(struct pci_dev *pdev)
2973+{
2974+ struct ixgbevf_adapter *adapter = pci_get_drvdata(pdev);
2975+ struct net_device *netdev = adapter->netdev;
2976+ u32 err;
2977+
2978+ pci_set_power_state(pdev, PCI_D0);
2979+ pci_restore_state(pdev);
2980+ /*
2981+ * pci_restore_state clears dev->state_saved so call
2982+ * pci_save_state to restore it.
2983+ */
2984+ pci_save_state(pdev);
2985+
2986+ err = pci_enable_device_mem(pdev);
2987+ if (err) {
2988+ dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n");
2989+ return err;
2990+ }
2991+ pci_set_master(pdev);
2992+
2993+ rtnl_lock();
2994+ err = ixgbevf_init_interrupt_scheme(adapter);
2995+ rtnl_unlock();
2996+ if (err) {
2997+ dev_err(&pdev->dev, "Cannot initialize interrupts\n");
2998+ return err;
2999+ }
3000+
3001+ ixgbevf_reset(adapter);
3002+
3003+ if (netif_running(netdev)) {
3004+ err = ixgbevf_open(netdev);
3005+ if (err)
3006+ return err;
3007+ }
3008+
3009+ netif_device_attach(netdev);
3010+
3011+ return err;
3012+}
3013+
3014+#endif /* CONFIG_PM */
3015+static void ixgbevf_shutdown(struct pci_dev *pdev)
3016+{
3017+ ixgbevf_suspend(pdev, PMSG_SUSPEND);
29093018 }
29103019
29113020 static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev,
@@ -2946,7 +3055,7 @@ static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev, · 34 unmodified lines
29463055 return stats;
29473056 }
29483057
2949−static const struct net_device_ops ixgbe_netdev_ops = {
3058+static const struct net_device_ops ixgbevf_netdev_ops = {
29503059 .ndo_open = ixgbevf_open,
29513060 .ndo_stop = ixgbevf_close,
29523061 .ndo_start_xmit = ixgbevf_xmit_frame,
@@ -2962,7 +3071,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { · 9 unmodified lines
29623071
29633072 static void ixgbevf_assign_netdev_ops(struct net_device *dev)
29643073 {
2965− dev->netdev_ops = &ixgbe_netdev_ops;
3074+ dev->netdev_ops = &ixgbevf_netdev_ops;
29663075 ixgbevf_set_ethtool_ops(dev);
29673076 dev->watchdog_timeo = 5 * HZ;
29683077 }
@@ -3131,6 +3240,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, · 162 unmodified lines
31313240 return 0;
31323241
31333242 err_register:
3243+ ixgbevf_clear_interrupt_scheme(adapter);
31343244 err_sw_init:
31353245 ixgbevf_reset_interrupt_capability(adapter);
31363246 iounmap(hw->hw_addr);
@@ -3168,6 +3278,7 @@ static void __devexit ixgbevf_remove(struct pci_dev *pdev) · 31 unmodified lines
31683278 if (netdev->reg_state == NETREG_REGISTERED)
31693279 unregister_netdev(netdev);
31703280
3281+ ixgbevf_clear_interrupt_scheme(adapter);
31713282 ixgbevf_reset_interrupt_capability(adapter);
31723283
31733284 iounmap(adapter->hw.hw_addr);
@@ -3267,6 +3378,11 @@ static struct pci_driver ixgbevf_driver = { · 93 unmodified lines
32673378 .id_table = ixgbevf_pci_tbl,
32683379 .probe = ixgbevf_probe,
32693380 .remove = __devexit_p(ixgbevf_remove),
3381+#ifdef CONFIG_PM
3382+ /* Power Management Hooks */
3383+ .suspend = ixgbevf_suspend,
3384+ .resume = ixgbevf_resume,
3385+#endif
32703386 .shutdown = ixgbevf_shutdown,
32713387 .err_handler = &ixgbevf_err_handler
32723388 };
drivers/net/ethernet/intel/ixgbevf/mbx.c+11−4
@@ -86,14 +86,17 @@ static s32 ixgbevf_poll_for_ack(struct ixgbe_hw *hw) · 85 unmodified lines
8686 static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)
8787 {
8888 struct ixgbe_mbx_info *mbx = &hw->mbx;
89− s32 ret_val = IXGBE_ERR_MBX;
89+ s32 ret_val = -IXGBE_ERR_MBX;
90+
91+ if (!mbx->ops.read)
92+ goto out;
9093
9194 ret_val = ixgbevf_poll_for_msg(hw);
9295
9396 /* if ack received read message, otherwise we timed out */
9497 if (!ret_val)
9598 ret_val = mbx->ops.read(hw, msg, size);
96−
99+out:
97100 return ret_val;
98101 }
99102
@@ -109,7 +112,11 @@ static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) · 9 unmodified lines
109112 static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)
110113 {
111114 struct ixgbe_mbx_info *mbx = &hw->mbx;
112− s32 ret_val;
115+ s32 ret_val = -IXGBE_ERR_MBX;
116+
117+ /* exit if either we can't write or there isn't a defined timeout */
118+ if (!mbx->ops.write || !mbx->timeout)
119+ goto out;
113120
114121 /* send msg */
115122 ret_val = mbx->ops.write(hw, msg, size);
@@ -117,7 +124,7 @@ static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) · 1 unmodified line
117124 /* if msg sent wait until we receive an ack */
118125 if (!ret_val)
119126 ret_val = ixgbevf_poll_for_ack(hw);
120−
127+out:
121128 return ret_val;
122129 }
123130
drivers/net/ethernet/intel/ixgbevf/mbx.h+19−2
@@ -76,12 +76,29 @@ · 75 unmodified lines
7676 /* bits 23:16 are used for exra info for certain messages */
7777 #define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT)
7878
79+/* definitions to support mailbox API version negotiation */
80+
81+/*
82+ * each element denotes a version of the API; existing numbers may not
83+ * change; any additions must go at the end
84+ */
85+enum ixgbe_pfvf_api_rev {
86+ ixgbe_mbox_api_10, /* API version 1.0, linux/freebsd VF driver */
87+ ixgbe_mbox_api_20, /* API version 2.0, solaris Phase1 VF driver */
88+ /* This value should always be last */
89+ ixgbe_mbox_api_unknown, /* indicates that API version is not known */
90+};
91+
92+/* mailbox API, legacy requests */
7993 #define IXGBE_VF_RESET 0x01 /* VF requests reset */
8094 #define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
8195 #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */
8296 #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */
83−#define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */
84−#define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */
97+
98+/* mailbox API, version 1.0 VF requests */
99+#define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */
100+#define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */
101+#define IXGBE_VF_API_NEGOTIATE 0x08 /* negotiate API version */
85102
86103 /* length of permanent address message returned from PF */
87104 #define IXGBE_VF_PERMADDR_MSG_LEN 4
drivers/net/ethernet/intel/ixgbevf/vf.c+108−14
@@ -79,6 +79,9 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) · 78 unmodified lines
7979 /* Call adapter stop to disable tx/rx and clear interrupts */
8080 hw->mac.ops.stop_adapter(hw);
8181
82+ /* reset the api version */
83+ hw->api_version = ixgbe_mbox_api_10;
84+
8285 IXGBE_WRITE_REG(hw, IXGBE_VFCTRL, IXGBE_CTRL_RST);
8386 IXGBE_WRITE_FLUSH(hw);
8487
@@ -97,7 +100,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) · 12 unmodified lines
97100 msgbuf[0] = IXGBE_VF_RESET;
98101 mbx->ops.write_posted(hw, msgbuf, 1);
99102
100− msleep(10);
103+ mdelay(10);
101104
102105 /* set our "perm_addr" based on info provided by PF */
103106 /* also set up the mc_filter_type which is piggy backed
@@ -346,16 +349,32 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, · 242 unmodified lines
346349 static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
347350 bool vlan_on)
348351 {
352+ struct ixgbe_mbx_info *mbx = &hw->mbx;
349353 u32 msgbuf[2];
354+ s32 err;
350355
351356 msgbuf[0] = IXGBE_VF_SET_VLAN;
352357 msgbuf[1] = vlan;
353358 /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
354359 msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
355360
356− ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
361+ err = mbx->ops.write_posted(hw, msgbuf, 2);
362+ if (err)
363+ goto mbx_err;
357364
358− return 0;
365+ err = mbx->ops.read_posted(hw, msgbuf, 2);
366+ if (err)
367+ goto mbx_err;
368+
369+ /* remove extra bits from the message */
370+ msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
371+ msgbuf[0] &= ~(0xFF << IXGBE_VT_MSGINFO_SHIFT);
372+
373+ if (msgbuf[0] != (IXGBE_VF_SET_VLAN | IXGBE_VT_MSGTYPE_ACK))
374+ err = IXGBE_ERR_INVALID_ARGUMENT;
375+
376+mbx_err:
377+ return err;
359378 }
360379
361380 /**
@@ -389,20 +408,23 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw, · 27 unmodified lines
389408 bool *link_up,
390409 bool autoneg_wait_to_complete)
391410 {
411+ struct ixgbe_mbx_info *mbx = &hw->mbx;
412+ struct ixgbe_mac_info *mac = &hw->mac;
413+ s32 ret_val = 0;
392414 u32 links_reg;
415+ u32 in_msg = 0;
393416
394− if (!(hw->mbx.ops.check_for_rst(hw))) {
395− *link_up = false;
396− *speed = 0;
397− return -1;
398− }
417+ /* If we were hit with a reset drop the link */
418+ if (!mbx->ops.check_for_rst(hw) || !mbx->timeout)
419+ mac->get_link_status = true;
399420
400− links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
421+ if (!mac->get_link_status)
422+ goto out;
401423
402− if (links_reg & IXGBE_LINKS_UP)
403− *link_up = true;
404− else
405− *link_up = false;
424+ /* if link status is down no point in checking to see if pf is up */
425+ links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
426+ if (!(links_reg & IXGBE_LINKS_UP))
427+ goto out;
406428
407429 switch (links_reg & IXGBE_LINKS_SPEED_82599) {
408430 case IXGBE_LINKS_SPEED_10G_82599:
@@ -416,7 +438,79 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw, · 7 unmodified lines
416438 break;
417439 }
418440
419− return 0;
441+ /* if the read failed it could just be a mailbox collision, best wait
442+ * until we are called again and don't report an error */
443+ if (mbx->ops.read(hw, &in_msg, 1))
444+ goto out;
445+
446+ if (!(in_msg & IXGBE_VT_MSGTYPE_CTS)) {
447+ /* msg is not CTS and is NACK we must have lost CTS status */
448+ if (in_msg & IXGBE_VT_MSGTYPE_NACK)
449+ ret_val = -1;
450+ goto out;
451+ }
452+
453+ /* the pf is talking, if we timed out in the past we reinit */
454+ if (!mbx->timeout) {
455+ ret_val = -1;
456+ goto out;
457+ }
458+
459+ /* if we passed all the tests above then the link is up and we no
460+ * longer need to check for link */
461+ mac->get_link_status = false;
462+
463+out:
464+ *link_up = !mac->get_link_status;
465+ return ret_val;
466+}
467+
468+/**
469+ * ixgbevf_rlpml_set_vf - Set the maximum receive packet length
470+ * @hw: pointer to the HW structure
471+ * @max_size: value to assign to max frame size
472+ **/
473+void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
474+{
475+ u32 msgbuf[2];
476+
477+ msgbuf[0] = IXGBE_VF_SET_LPE;
478+ msgbuf[1] = max_size;
479+ ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
480+}
481+
482+/**
483+ * ixgbevf_negotiate_api_version - Negotiate supported API version
484+ * @hw: pointer to the HW structure
485+ * @api: integer containing requested API version
486+ **/
487+int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api)
488+{
489+ int err;
490+ u32 msg[3];
491+
492+ /* Negotiate the mailbox API version */
493+ msg[0] = IXGBE_VF_API_NEGOTIATE;
494+ msg[1] = api;
495+ msg[2] = 0;
496+ err = hw->mbx.ops.write_posted(hw, msg, 3);
497+
498+ if (!err)
499+ err = hw->mbx.ops.read_posted(hw, msg, 3);
500+
501+ if (!err) {
502+ msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
503+
504+ /* Store value and return 0 on success */
505+ if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_ACK)) {
506+ hw->api_version = api;
507+ return 0;
508+ }
509+
510+ err = IXGBE_ERR_INVALID_ARGUMENT;
511+ }
512+
513+ return err;
420514 }
421515
422516 static const struct ixgbe_mac_operations ixgbevf_mac_ops = {
drivers/net/ethernet/intel/ixgbevf/vf.h+4−0
@@ -137,6 +137,8 @@ struct ixgbe_hw { · 136 unmodified lines
137137
138138 u8 revision_id;
139139 bool adapter_stopped;
140+
141+ int api_version;
140142 };
141143
142144 struct ixgbevf_hw_stats {
@@ -170,5 +172,7 @@ struct ixgbevf_info { · 27 unmodified lines
170172 const struct ixgbe_mac_operations *mac_ops;
171173 };
172174
175+void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
176+int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
173177 #endif /* __IXGBE_VF_H__ */
174178
drivers/net/ethernet/mellanox/mlx4/en_tx.c+0−4
@@ -712,10 +712,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 711 unmodified lines
712712 if (bounce)
713713 tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size);
714714
715− /* Run destructor before passing skb to HW */
716− if (likely(!skb_shared(skb)))
717− skb_orphan(skb);
718−
719715 if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) {
720716 *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);
721717 op_own |= htonl((bf_index & 0xffff) << 8);
drivers/net/ethernet/mipsnet.c+0−345
@@ -1,345 +0,0 @@
1−/*
2− * This file is subject to the terms and conditions of the GNU General Public
3− * License. See the file "COPYING" in the main directory of this archive
4− * for more details.
5− */
6−
7−#include <linux/init.h>
8−#include <linux/interrupt.h>
9−#include <linux/io.h>
10−#include <linux/kernel.h>
11−#include <linux/module.h>
12−#include <linux/netdevice.h>
13−#include <linux/etherdevice.h>
14−#include <linux/platform_device.h>
15−#include <asm/mips-boards/simint.h>
16−
17−#define MIPSNET_VERSION "2007-11-17"
18−
19−/*
20− * Net status/control block as seen by sw in the core.
21− */
22−struct mipsnet_regs {
23− /*
24− * Device info for probing, reads as MIPSNET%d where %d is some
25− * form of version.
26− */
27− u64 devId; /*0x00 */
28−
29− /*
30− * read only busy flag.
31− * Set and cleared by the Net Device to indicate that an rx or a tx
32− * is in progress.
33− */
34− u32 busy; /*0x08 */
35−
36− /*
37− * Set by the Net Device.
38− * The device will set it once data has been received.
39− * The value is the number of bytes that should be read from
40− * rxDataBuffer. The value will decrease till 0 until all the data
41− * from rxDataBuffer has been read.
42− */
43− u32 rxDataCount; /*0x0c */
44−#define MIPSNET_MAX_RXTX_DATACOUNT (1 << 16)
45−
46− /*
47− * Settable from the MIPS core, cleared by the Net Device.
48− * The core should set the number of bytes it wants to send,
49− * then it should write those bytes of data to txDataBuffer.
50− * The device will clear txDataCount has been processed (not
51− * necessarily sent).
52− */
53− u32 txDataCount; /*0x10 */
54−
55− /*
56− * Interrupt control
57− *
58− * Used to clear the interrupted generated by this dev.
59− * Write a 1 to clear the interrupt. (except bit31).
60− *
61− * Bit0 is set if it was a tx-done interrupt.
62− * Bit1 is set when new rx-data is available.
63− * Until this bit is cleared there will be no other RXs.
64− *
65− * Bit31 is used for testing, it clears after a read.
66− * Writing 1 to this bit will cause an interrupt to be generated.
67− * To clear the test interrupt, write 0 to this register.
68− */
69− u32 interruptControl; /*0x14 */
70−#define MIPSNET_INTCTL_TXDONE (1u << 0)
71−#define MIPSNET_INTCTL_RXDONE (1u << 1)
72−#define MIPSNET_INTCTL_TESTBIT (1u << 31)
73−
74− /*
75− * Readonly core-specific interrupt info for the device to signal
76− * the core. The meaning of the contents of this field might change.
77− */
78− /* XXX: the whole memIntf interrupt scheme is messy: the device
79− * should have no control what so ever of what VPE/register set is
80− * being used.
81− * The MemIntf should only expose interrupt lines, and something in
82− * the config should be responsible for the line<->core/vpe bindings.
83− */
84− u32 interruptInfo; /*0x18 */
85−
86− /*
87− * This is where the received data is read out.
88− * There is more data to read until rxDataReady is 0.
89− * Only 1 byte at this regs offset is used.
90− */
91− u32 rxDataBuffer; /*0x1c */
92−
93− /*
94− * This is where the data to transmit is written.
95− * Data should be written for the amount specified in the
96− * txDataCount register.
97− * Only 1 byte at this regs offset is used.
98− */
99− u32 txDataBuffer; /*0x20 */
100−};
101−
102−#define regaddr(dev, field) \
103− (dev->base_addr + offsetof(struct mipsnet_regs, field))
104−
105−static char mipsnet_string[] = "mipsnet";
106−
107−/*
108− * Copy data from the MIPSNET rx data port
109− */
110−static int ioiocpy_frommipsnet(struct net_device *dev, unsigned char *kdata,
111− int len)
112−{
113− for (; len > 0; len--, kdata++)
114− *kdata = inb(regaddr(dev, rxDataBuffer));
115−
116− return inl(regaddr(dev, rxDataCount));
117−}
118−
119−static inline void mipsnet_put_todevice(struct net_device *dev,
120− struct sk_buff *skb)
121−{
122− int count_to_go = skb->len;
123− char *buf_ptr = skb->data;
124−
125− outl(skb->len, regaddr(dev, txDataCount));
126−
127− for (; count_to_go; buf_ptr++, count_to_go--)
128− outb(*buf_ptr, regaddr(dev, txDataBuffer));
129−
130− dev->stats.tx_packets++;
131− dev->stats.tx_bytes += skb->len;
132−
133− dev_kfree_skb(skb);
134−}
135−
136−static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev)
137−{
138− /*
139− * Only one packet at a time. Once TXDONE interrupt is serviced, the
140− * queue will be restarted.
141− */
142− netif_stop_queue(dev);
143− mipsnet_put_todevice(dev, skb);
144−
145− return NETDEV_TX_OK;
146−}
147−
148−static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t len)
149−{
150− struct sk_buff *skb;
151−
152− if (!len)
153− return len;
154−
155− skb = netdev_alloc_skb(dev, len + NET_IP_ALIGN);
156− if (!skb) {
157− dev->stats.rx_dropped++;
158− return -ENOMEM;
159− }
160−
161− skb_reserve(skb, NET_IP_ALIGN);
162− if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len))
163− return -EFAULT;
164−
165− skb->protocol = eth_type_trans(skb, dev);
166− skb->ip_summed = CHECKSUM_UNNECESSARY;
167−
168− netif_rx(skb);
169−
170− dev->stats.rx_packets++;
171− dev->stats.rx_bytes += len;
172−
173− return len;
174−}
175−
176−static irqreturn_t mipsnet_interrupt(int irq, void *dev_id)
177−{
178− struct net_device *dev = dev_id;
179− u32 int_flags;
180− irqreturn_t ret = IRQ_NONE;
181−
182− if (irq != dev->irq)
183− goto out_badirq;
184−
185− /* TESTBIT is cleared on read. */
186− int_flags = inl(regaddr(dev, interruptControl));
187− if (int_flags & MIPSNET_INTCTL_TESTBIT) {
188− /* TESTBIT takes effect after a write with 0. */
189− outl(0, regaddr(dev, interruptControl));
190− ret = IRQ_HANDLED;
191− } else if (int_flags & MIPSNET_INTCTL_TXDONE) {
192− /* Only one packet at a time, we are done. */
193− dev->stats.tx_packets++;
194− netif_wake_queue(dev);
195− outl(MIPSNET_INTCTL_TXDONE,
196− regaddr(dev, interruptControl));
197− ret = IRQ_HANDLED;
198− } else if (int_flags & MIPSNET_INTCTL_RXDONE) {
199− mipsnet_get_fromdev(dev, inl(regaddr(dev, rxDataCount)));
200− outl(MIPSNET_INTCTL_RXDONE, regaddr(dev, interruptControl));
201− ret = IRQ_HANDLED;
202− }
203− return ret;
204−
205−out_badirq:
206− printk(KERN_INFO "%s: %s(): irq %d for unknown device\n",
207− dev->name, __func__, irq);
208− return ret;
209−}
210−
211−static int mipsnet_open(struct net_device *dev)
212−{
213− int err;
214−
215− err = request_irq(dev->irq, mipsnet_interrupt,
216− IRQF_SHARED, dev->name, (void *) dev);
217− if (err) {
218− release_region(dev->base_addr, sizeof(struct mipsnet_regs));
219− return err;
220− }
221−
222− netif_start_queue(dev);
223−
224− /* test interrupt handler */
225− outl(MIPSNET_INTCTL_TESTBIT, regaddr(dev, interruptControl));
226−
227− return 0;
228−}
229−
230−static int mipsnet_close(struct net_device *dev)
231−{
232− netif_stop_queue(dev);
233− free_irq(dev->irq, dev);
234− return 0;
235−}
236−
237−static void mipsnet_set_mclist(struct net_device *dev)
238−{
239−}
240−
241−static const struct net_device_ops mipsnet_netdev_ops = {
242− .ndo_open = mipsnet_open,
243− .ndo_stop = mipsnet_close,
244− .ndo_start_xmit = mipsnet_xmit,
245− .ndo_set_rx_mode = mipsnet_set_mclist,
246− .ndo_change_mtu = eth_change_mtu,
247− .ndo_validate_addr = eth_validate_addr,
248− .ndo_set_mac_address = eth_mac_addr,
249−};
250−
251−static int __devinit mipsnet_probe(struct platform_device *dev)
252−{
253− struct net_device *netdev;
254− int err;
255−
256− netdev = alloc_etherdev(0);
257− if (!netdev) {
258− err = -ENOMEM;
259− goto out;
260− }
261−
262− platform_set_drvdata(dev, netdev);
263−
264− netdev->netdev_ops = &mipsnet_netdev_ops;
265−
266− /*
267− * TODO: probe for these or load them from PARAM
268− */
269− netdev->base_addr = 0x4200;
270− netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 +
271− inl(regaddr(netdev, interruptInfo));
272−
273− /* Get the io region now, get irq on open() */
274− if (!request_region(netdev->base_addr, sizeof(struct mipsnet_regs),
275− "mipsnet")) {
276− err = -EBUSY;
277− goto out_free_netdev;
278− }
279−
280− /*
281− * Lacking any better mechanism to allocate a MAC address we use a
282− * random one ...
283− */
284− eth_hw_addr_random(netdev);
285−
286− err = register_netdev(netdev);
287− if (err) {
288− printk(KERN_ERR "MIPSNet: failed to register netdev.\n");
289− goto out_free_region;
290− }
291−
292− return 0;
293−
294−out_free_region:
295− release_region(netdev->base_addr, sizeof(struct mipsnet_regs));
296−
297−out_free_netdev:
298− free_netdev(netdev);
299−
300−out:
301− return err;
302−}
303−
304−static int __devexit mipsnet_device_remove(struct platform_device *device)
305−{
306− struct net_device *dev = platform_get_drvdata(device);
307−
308− unregister_netdev(dev);
309− release_region(dev->base_addr, sizeof(struct mipsnet_regs));
310− free_netdev(dev);
311− platform_set_drvdata(device, NULL);
312−
313− return 0;
314−}
315−
316−static struct platform_driver mipsnet_driver = {
317− .driver = {
318− .name = mipsnet_string,
319− .owner = THIS_MODULE,
320− },
321− .probe = mipsnet_probe,
322− .remove = __devexit_p(mipsnet_device_remove),
323−};
324−
325−static int __init mipsnet_init_module(void)
326−{
327− int err;
328−
329− printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. "
330− "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION);
331−
332− err = platform_driver_register(&mipsnet_driver);
333− if (err)
334− printk(KERN_ERR "Driver registration failed\n");
335−
336− return err;
337−}
338−
339−static void __exit mipsnet_exit_module(void)
340−{
341− platform_driver_unregister(&mipsnet_driver);
342−}
343−
344−module_init(mipsnet_init_module);
345−module_exit(mipsnet_exit_module);
drivers/net/ethernet/nvidia/forcedeth.c+13−4
@@ -3409,7 +3409,7 @@ set_speed: · 3408 unmodified lines
34093409
34103410 pause_flags = 0;
34113411 /* setup pause frame */
3412− if (np->duplex != 0) {
3412+ if (netif_running(dev) && (np->duplex != 0)) {
34133413 if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) {
34143414 adv_pause = adv & (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
34153415 lpa_pause = lpa & (LPA_PAUSE_CAP | LPA_PAUSE_ASYM);
@@ -4435,7 +4435,7 @@ static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void · 1019 unmodified lines
44354435
44364436 regs->version = FORCEDETH_REGS_VER;
44374437 spin_lock_irq(&np->lock);
4438− for (i = 0; i <= np->register_size/sizeof(u32); i++)
4438+ for (i = 0; i < np->register_size/sizeof(u32); i++)
44394439 rbuf[i] = readl(base + i*sizeof(u32));
44404440 spin_unlock_irq(&np->lock);
44414441 }
@@ -5455,6 +5455,7 @@ static int nv_close(struct net_device *dev) · 1013 unmodified lines
54555455
54565456 netif_stop_queue(dev);
54575457 spin_lock_irq(&np->lock);
5458+ nv_update_pause(dev, 0); /* otherwise stop_tx bricks NIC */
54585459 nv_stop_rxtx(dev);
54595460 nv_txrx_reset(dev);
54605461
@@ -5904,11 +5905,19 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i · 443 unmodified lines
59045905 goto out_error;
59055906 }
59065907
5908+ netif_carrier_off(dev);
5909+
5910+ /* Some NICs freeze when TX pause is enabled while NIC is
5911+ * down, and this stays across warm reboots. The sequence
5912+ * below should be enough to recover from that state.
5913+ */
5914+ nv_update_pause(dev, 0);
5915+ nv_start_tx(dev);
5916+ nv_stop_tx(dev);
5917+
59075918 if (id->driver_data & DEV_HAS_VLAN)
59085919 nv_vlan_mode(dev, dev->features);
59095920
5910− netif_carrier_off(dev);
5911−
59125921 dev_info(&pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, addr %pM\n",
59135922 dev->name, np->phy_oui, np->phyaddr, dev->dev_addr);
59145923
drivers/net/ethernet/realtek/r8169.c+3−1
@@ -77,7 +77,7 @@ · 76 unmodified lines
7777 static const int multicast_filter_limit = 32;
7878
7979 #define MAX_READ_REQUEST_SHIFT 12
80−#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
80+#define TX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */
8181 #define SafeMtu 0x1c20 /* ... actually life sucks beyond ~7k */
8282 #define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
8383
@@ -287,6 +287,8 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8169_pci_tbl) = { · 203 unmodified lines
287287 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 },
288288 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 },
289289 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 },
290+ { PCI_VENDOR_ID_DLINK, 0x4300,
291+ PCI_VENDOR_ID_DLINK, 0x4b10, 0, 0, RTL_CFG_1 },
290292 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 },
291293 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4302), 0, 0, RTL_CFG_0 },
292294 { PCI_DEVICE(PCI_VENDOR_ID_AT, 0xc107), 0, 0, RTL_CFG_0 },
drivers/net/ethernet/sfc/Kconfig+7−0
@@ -34,3 +34,10 @@ config SFC_SRIOV · 33 unmodified lines
3434 This enables support for the SFC9000 I/O Virtualization
3535 features, allowing accelerated network performance in
3636 virtualized environments.
37+config SFC_PTP
38+ bool "Solarflare SFC9000-family PTP support"
39+ depends on SFC && PTP_1588_CLOCK && !(SFC=y && PTP_1588_CLOCK=m)
40+ default y
41+ ---help---
42+ This enables support for the Precision Time Protocol (PTP)
43+ on SFC9000-family NICs
drivers/net/ethernet/sfc/Makefile+1−0
@@ -5,5 +5,6 @@ sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \ · 4 unmodified lines
55 mcdi.o mcdi_phy.o mcdi_mon.o
66 sfc-$(CONFIG_SFC_MTD) += mtd.o
77 sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o
8+sfc-$(CONFIG_SFC_PTP) += ptp.o
89
910 obj-$(CONFIG_SFC) += sfc.o
drivers/net/ethernet/sfc/bitfield.h+11−11
@@ -120,10 +120,10 @@ typedef union efx_oword { · 119 unmodified lines
120120 * [0,high-low), with garbage in bits [high-low+1,...).
121121 */
122122 #define EFX_EXTRACT_NATIVE(native_element, min, max, low, high) \
123− (((low > max) || (high < min)) ? 0 : \
124− ((low > min) ? \
125− ((native_element) >> (low - min)) : \
126− ((native_element) << (min - low))))
123+ ((low) > (max) || (high) < (min) ? 0 : \
124+ (low) > (min) ? \
125+ (native_element) >> ((low) - (min)) : \
126+ (native_element) << ((min) - (low)))
127127
128128 /*
129129 * Extract bit field portion [low,high) from the 64-bit little-endian
@@ -142,27 +142,27 @@ typedef union efx_oword { · 12 unmodified lines
142142 #define EFX_EXTRACT_OWORD64(oword, low, high) \
143143 ((EFX_EXTRACT64((oword).u64[0], 0, 63, low, high) | \
144144 EFX_EXTRACT64((oword).u64[1], 64, 127, low, high)) & \
145− EFX_MASK64(high + 1 - low))
145+ EFX_MASK64((high) + 1 - (low)))
146146
147147 #define EFX_EXTRACT_QWORD64(qword, low, high) \
148148 (EFX_EXTRACT64((qword).u64[0], 0, 63, low, high) & \
149− EFX_MASK64(high + 1 - low))
149+ EFX_MASK64((high) + 1 - (low)))
150150
151151 #define EFX_EXTRACT_OWORD32(oword, low, high) \
152152 ((EFX_EXTRACT32((oword).u32[0], 0, 31, low, high) | \
153153 EFX_EXTRACT32((oword).u32[1], 32, 63, low, high) | \
154154 EFX_EXTRACT32((oword).u32[2], 64, 95, low, high) | \
155155 EFX_EXTRACT32((oword).u32[3], 96, 127, low, high)) & \
156− EFX_MASK32(high + 1 - low))
156+ EFX_MASK32((high) + 1 - (low)))
157157
158158 #define EFX_EXTRACT_QWORD32(qword, low, high) \
159159 ((EFX_EXTRACT32((qword).u32[0], 0, 31, low, high) | \
160160 EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) & \
161− EFX_MASK32(high + 1 - low))
161+ EFX_MASK32((high) + 1 - (low)))
162162
163163 #define EFX_EXTRACT_DWORD(dword, low, high) \
164164 (EFX_EXTRACT32((dword).u32[0], 0, 31, low, high) & \
165− EFX_MASK32(high + 1 - low))
165+ EFX_MASK32((high) + 1 - (low)))
166166
167167 #define EFX_OWORD_FIELD64(oword, field) \
168168 EFX_EXTRACT_OWORD64(oword, EFX_LOW_BIT(field), \
@@ -442,10 +442,10 @@ typedef union efx_oword { · 273 unmodified lines
442442 cpu_to_le32(EFX_INSERT_NATIVE(min, max, low, high, value))
443443
444444 #define EFX_INPLACE_MASK64(min, max, low, high) \
445− EFX_INSERT64(min, max, low, high, EFX_MASK64(high + 1 - low))
445+ EFX_INSERT64(min, max, low, high, EFX_MASK64((high) + 1 - (low)))
446446
447447 #define EFX_INPLACE_MASK32(min, max, low, high) \
448− EFX_INSERT32(min, max, low, high, EFX_MASK32(high + 1 - low))
448+ EFX_INSERT32(min, max, low, high, EFX_MASK32((high) + 1 - (low)))
449449
450450 #define EFX_SET_OWORD64(oword, low, high, value) do { \
451451 (oword).u64[0] = (((oword).u64[0] \
drivers/net/ethernet/sfc/efx.c+148−102
@@ -202,11 +202,21 @@ static void efx_stop_all(struct efx_nic *efx); · 201 unmodified lines
202202
203203 #define EFX_ASSERT_RESET_SERIALISED(efx) \
204204 do { \
205− if ((efx->state == STATE_RUNNING) || \
205+ if ((efx->state == STATE_READY) || \
206206 (efx->state == STATE_DISABLED)) \
207207 ASSERT_RTNL(); \
208208 } while (0)
209209
210+static int efx_check_disabled(struct efx_nic *efx)
211+{
212+ if (efx->state == STATE_DISABLED) {
213+ netif_err(efx, drv, efx->net_dev,
214+ "device is disabled due to earlier errors\n");
215+ return -EIO;
216+ }
217+ return 0;
218+}
219+
210220 /**************************************************************************
211221 *
212222 * Event queue processing
@@ -630,6 +640,16 @@ static void efx_start_datapath(struct efx_nic *efx) · 417 unmodified lines
630640 efx->rx_buffer_order = get_order(efx->rx_buffer_len +
631641 sizeof(struct efx_rx_page_state));
632642
643+ /* We must keep at least one descriptor in a TX ring empty.
644+ * We could avoid this when the queue size does not exactly
645+ * match the hardware ring size, but it's not that important.
646+ * Therefore we stop the queue when one more skb might fill
647+ * the ring completely. We wake it when half way back to
648+ * empty.
649+ */
650+ efx->txq_stop_thresh = efx->txq_entries - efx_tx_max_skb_descs(efx);
651+ efx->txq_wake_thresh = efx->txq_stop_thresh / 2;
652+
633653 /* Initialise the channels */
634654 efx_for_each_channel(channel, efx) {
635655 efx_for_each_channel_tx_queue(tx_queue, channel)
@@ -714,6 +734,7 @@ static void efx_remove_channel(struct efx_channel *channel) · 78 unmodified lines
714734 efx_for_each_possible_channel_tx_queue(tx_queue, channel)
715735 efx_remove_tx_queue(tx_queue);
716736 efx_remove_eventq(channel);
737+ channel->type->post_remove(channel);
717738 }
718739
719740 static void efx_remove_channels(struct efx_nic *efx)
@@ -730,7 +751,11 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) · 10 unmodified lines
730751 struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel;
731752 u32 old_rxq_entries, old_txq_entries;
732753 unsigned i, next_buffer_table = 0;
733− int rc = 0;
754+ int rc;
755+
756+ rc = efx_check_disabled(efx);
757+ if (rc)
758+ return rc;
734759
735760 /* Not all channels should be reallocated. We must avoid
736761 * reallocating their buffer table entries.
@@ -828,6 +853,7 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue) · 91 unmodified lines
828853
829854 static const struct efx_channel_type efx_default_channel_type = {
830855 .pre_probe = efx_channel_dummy_op_int,
856+ .post_remove = efx_channel_dummy_op_void,
831857 .get_name = efx_get_channel_name,
832858 .copy = efx_copy_channel,
833859 .keep_eventq = false,
@@ -838,6 +864,10 @@ int efx_channel_dummy_op_int(struct efx_channel *channel) · 4 unmodified lines
838864 return 0;
839865 }
840866
867+void efx_channel_dummy_op_void(struct efx_channel *channel)
868+{
869+}
870+
841871 /**************************************************************************
842872 *
843873 * Port handling
@@ -1365,6 +1395,8 @@ static void efx_start_interrupts(struct efx_nic *efx, bool may_keep_eventq) · 521 unmodified lines
13651395 {
13661396 struct efx_channel *channel;
13671397
1398+ BUG_ON(efx->state == STATE_DISABLED);
1399+
13681400 if (efx->legacy_irq)
13691401 efx->legacy_irq_enabled = true;
13701402 efx_nic_enable_interrupts(efx);
@@ -1382,6 +1414,9 @@ static void efx_stop_interrupts(struct efx_nic *efx, bool may_keep_eventq) · 11 unmodified lines
13821414 {
13831415 struct efx_channel *channel;
13841416
1417+ if (efx->state == STATE_DISABLED)
1418+ return;
1419+
13851420 efx_mcdi_mode_poll(efx);
13861421
13871422 efx_nic_disable_interrupts(efx);
@@ -1422,10 +1457,16 @@ static void efx_set_channels(struct efx_nic *efx) · 34 unmodified lines
14221457 efx->tx_channel_offset =
14231458 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;
14241459
1425− /* We need to adjust the TX queue numbers if we have separate
1460+ /* We need to mark which channels really have RX and TX
1461+ * queues, and adjust the TX queue numbers if we have separate
14261462 * RX-only and TX-only channels.
14271463 */
14281464 efx_for_each_channel(channel, efx) {
1465+ if (channel->channel < efx->n_rx_channels)
1466+ channel->rx_queue.core_index = channel->channel;
1467+ else
1468+ channel->rx_queue.core_index = -1;
1469+
14291470 efx_for_each_channel_tx_queue(tx_queue, channel)
14301471 tx_queue->queue -= (efx->tx_channel_offset *
14311472 EFX_TXQ_TYPES);
@@ -1533,22 +1574,21 @@ static int efx_probe_all(struct efx_nic *efx) · 101 unmodified lines
15331574 return rc;
15341575 }
15351576
1536−/* Called after previous invocation(s) of efx_stop_all, restarts the port,
1537− * kernel transmit queues and NAPI processing, and ensures that the port is
1538− * scheduled to be reconfigured. This function is safe to call multiple
1539− * times when the NIC is in any state.
1577+/* If the interface is supposed to be running but is not, start
1578+ * the hardware and software data path, regular activity for the port
1579+ * (MAC statistics, link polling, etc.) and schedule the port to be
1580+ * reconfigured. Interrupts must already be enabled. This function
1581+ * is safe to call multiple times, so long as the NIC is not disabled.
1582+ * Requires the RTNL lock.
15401583 */
15411584 static void efx_start_all(struct efx_nic *efx)
15421585 {
15431586 EFX_ASSERT_RESET_SERIALISED(efx);
1587+ BUG_ON(efx->state == STATE_DISABLED);
15441588
15451589 /* Check that it is appropriate to restart the interface. All
15461590 * of these flags are safe to read under just the rtnl lock */
1547− if (efx->port_enabled)
1548− return;
1549− if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT))
1550− return;
1551− if (!netif_running(efx->net_dev))
1591+ if (efx->port_enabled || !netif_running(efx->net_dev))
15521592 return;
15531593
15541594 efx_start_port(efx);
@@ -1582,11 +1622,11 @@ static void efx_flush_all(struct efx_nic *efx) · 27 unmodified lines
15821622 cancel_work_sync(&efx->mac_work);
15831623 }
15841624
1585−/* Quiesce hardware and software without bringing the link down.
1586− * Safe to call multiple times, when the nic and interface is in any
1587− * state. The caller is guaranteed to subsequently be in a position
1588− * to modify any hardware and software state they see fit without
1589− * taking locks. */
1625+/* Quiesce the hardware and software data path, and regular activity
1626+ * for the port without bringing the link down. Safe to call multiple
1627+ * times with the NIC in almost any state, but interrupts should be
1628+ * enabled. Requires the RTNL lock.
1629+ */
15901630 static void efx_stop_all(struct efx_nic *efx)
15911631 {
15921632 EFX_ASSERT_RESET_SERIALISED(efx);
@@ -1739,7 +1779,8 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) · 146 unmodified lines
17391779 struct efx_nic *efx = netdev_priv(net_dev);
17401780 struct mii_ioctl_data *data = if_mii(ifr);
17411781
1742− EFX_ASSERT_RESET_SERIALISED(efx);
1782+ if (cmd == SIOCSHWTSTAMP)
1783+ return efx_ptp_ioctl(efx, ifr, cmd);
17431784
17441785 /* Convert phy_id from older PRTAD/DEVAD format */
17451786 if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
@@ -1820,13 +1861,14 @@ static void efx_netpoll(struct net_device *net_dev) · 74 unmodified lines
18201861 static int efx_net_open(struct net_device *net_dev)
18211862 {
18221863 struct efx_nic *efx = netdev_priv(net_dev);
1823− EFX_ASSERT_RESET_SERIALISED(efx);
1864+ int rc;
18241865
18251866 netif_dbg(efx, ifup, efx->net_dev, "opening device on CPU %d\n",
18261867 raw_smp_processor_id());
18271868
1828− if (efx->state == STATE_DISABLED)
1829− return -EIO;
1869+ rc = efx_check_disabled(efx);
1870+ if (rc)
1871+ return rc;
18301872 if (efx->phy_mode & PHY_MODE_SPECIAL)
18311873 return -EBUSY;
18321874 if (efx_mcdi_poll_reboot(efx) && efx_reset(efx, RESET_TYPE_ALL))
@@ -1852,10 +1894,8 @@ static int efx_net_stop(struct net_device *net_dev) · 19 unmodified lines
18521894 netif_dbg(efx, ifdown, efx->net_dev, "closing on CPU %d\n",
18531895 raw_smp_processor_id());
18541896
1855− if (efx->state != STATE_DISABLED) {
1856− /* Stop the device and flush all the channels */
1857− efx_stop_all(efx);
1858− }
1897+ /* Stop the device and flush all the channels */
1898+ efx_stop_all(efx);
18591899
18601900 return 0;
18611901 }
@@ -1915,9 +1955,11 @@ static void efx_watchdog(struct net_device *net_dev) · 53 unmodified lines
19151955 static int efx_change_mtu(struct net_device *net_dev, int new_mtu)
19161956 {
19171957 struct efx_nic *efx = netdev_priv(net_dev);
1958+ int rc;
19181959
1919− EFX_ASSERT_RESET_SERIALISED(efx);
1920−
1960+ rc = efx_check_disabled(efx);
1961+ if (rc)
1962+ return rc;
19211963 if (new_mtu > EFX_MAX_MTU)
19221964 return -EINVAL;
19231965
@@ -1926,8 +1968,6 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) · 2 unmodified lines
19261968 netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu);
19271969
19281970 mutex_lock(&efx->mac_lock);
1929− /* Reconfigure the MAC before enabling the dma queues so that
1930− * the RX buffers don't overflow */
19311971 net_dev->mtu = new_mtu;
19321972 efx->type->reconfigure_mac(efx);
19331973 mutex_unlock(&efx->mac_lock);
@@ -1942,8 +1982,6 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data) · 8 unmodified lines
19421982 struct sockaddr *addr = data;
19431983 char *new_addr = addr->sa_data;
19441984
1945− EFX_ASSERT_RESET_SERIALISED(efx);
1946−
19471985 if (!is_valid_ether_addr(new_addr)) {
19481986 netif_err(efx, drv, efx->net_dev,
19491987 "invalid ethernet MAC address requested: %pM\n",
@@ -2079,11 +2117,27 @@ static int efx_register_netdev(struct efx_nic *efx) · 129 unmodified lines
20792117
20802118 rtnl_lock();
20812119
2120+ /* Enable resets to be scheduled and check whether any were
2121+ * already requested. If so, the NIC is probably hosed so we
2122+ * abort.
2123+ */
2124+ efx->state = STATE_READY;
2125+ smp_mb(); /* ensure we change state before checking reset_pending */
2126+ if (efx->reset_pending) {
2127+ netif_err(efx, probe, efx->net_dev,
2128+ "aborting probe due to scheduled reset\n");
2129+ rc = -EIO;
2130+ goto fail_locked;
2131+ }
2132+
20822133 rc = dev_alloc_name(net_dev, net_dev->name);
20832134 if (rc < 0)
20842135 goto fail_locked;
20852136 efx_update_name(efx);
20862137
2138+ /* Always start with carrier off; PHY events will detect the link */
2139+ netif_carrier_off(net_dev);
2140+
20872141 rc = register_netdevice(net_dev);
20882142 if (rc)
20892143 goto fail_locked;
@@ -2094,9 +2148,6 @@ static int efx_register_netdev(struct efx_nic *efx) · 4 unmodified lines
20942148 efx_init_tx_queue_core_txq(tx_queue);
20952149 }
20962150
2097− /* Always start with carrier off; PHY events will detect the link */
2098− netif_carrier_off(net_dev);
2099−
21002151 rtnl_unlock();
21012152
21022153 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type);
@@ -2108,14 +2159,14 @@ static int efx_register_netdev(struct efx_nic *efx) · 5 unmodified lines
21082159
21092160 return 0;
21102161
2162+fail_registered:
2163+ rtnl_lock();
2164+ unregister_netdevice(net_dev);
21112165 fail_locked:
2166+ efx->state = STATE_UNINIT;
21122167 rtnl_unlock();
21132168 netif_err(efx, drv, efx->net_dev, "could not register net dev\n");
21142169 return rc;
2115−
2116−fail_registered:
2117− unregister_netdev(net_dev);
2118− return rc;
21192170 }
21202171
21212172 static void efx_unregister_netdev(struct efx_nic *efx)
@@ -2138,7 +2189,11 @@ static void efx_unregister_netdev(struct efx_nic *efx) · 16 unmodified lines
21382189
21392190 strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name));
21402191 device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_type);
2141− unregister_netdev(efx->net_dev);
2192+
2193+ rtnl_lock();
2194+ unregister_netdevice(efx->net_dev);
2195+ efx->state = STATE_UNINIT;
2196+ rtnl_unlock();
21422197 }
21432198
21442199 /**************************************************************************
@@ -2154,9 +2209,9 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method) · 9 unmodified lines
21542209 EFX_ASSERT_RESET_SERIALISED(efx);
21552210
21562211 efx_stop_all(efx);
2157− mutex_lock(&efx->mac_lock);
2158−
21592212 efx_stop_interrupts(efx, false);
2213+
2214+ mutex_lock(&efx->mac_lock);
21602215 if (efx->port_initialized && method != RESET_TYPE_INVISIBLE)
21612216 efx->phy_op->fini(efx);
21622217 efx->type->fini(efx);
@@ -2276,16 +2331,15 @@ static void efx_reset_work(struct work_struct *data) · 113 unmodified lines
22762331 if (!pending)
22772332 return;
22782333
2279− /* If we're not RUNNING then don't reset. Leave the reset_pending
2280− * flags set so that efx_pci_probe_main will be retried */
2281− if (efx->state != STATE_RUNNING) {
2282− netif_info(efx, drv, efx->net_dev,
2283− "scheduled reset quenched. NIC not RUNNING\n");
2284− return;
2285− }
2286−
22872334 rtnl_lock();
2288− (void)efx_reset(efx, fls(pending) - 1);
2335+
2336+ /* We checked the state in efx_schedule_reset() but it may
2337+ * have changed by now. Now that we have the RTNL lock,
2338+ * it cannot change again.
2339+ */
2340+ if (efx->state == STATE_READY)
2341+ (void)efx_reset(efx, fls(pending) - 1);
2342+
22892343 rtnl_unlock();
22902344 }
22912345
@@ -2311,6 +2365,13 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) · 19 unmodified lines
23112365 }
23122366
23132367 set_bit(method, &efx->reset_pending);
2368+ smp_mb(); /* ensure we change reset_pending before checking state */
2369+
2370+ /* If we're not READY then just leave the flags set as the cue
2371+ * to abort probing or reschedule the reset later.
2372+ */
2373+ if (ACCESS_ONCE(efx->state) != STATE_READY)
2374+ return;
23142375
23152376 /* efx_process_channel() will no longer read events once a
23162377 * reset is scheduled. So switch back to poll'd MCDI completions. */
@@ -2376,13 +2437,12 @@ static const struct efx_phy_operations efx_dummy_phy_operations = { · 59 unmodified lines
23762437 /* This zeroes out and then fills in the invariants in a struct
23772438 * efx_nic (including all sub-structures).
23782439 */
2379−static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,
2440+static int efx_init_struct(struct efx_nic *efx,
23802441 struct pci_dev *pci_dev, struct net_device *net_dev)
23812442 {
23822443 int i;
23832444
23842445 /* Initialise common structures */
2385− memset(efx, 0, sizeof(*efx));
23862446 spin_lock_init(&efx->biu_lock);
23872447 #ifdef CONFIG_SFC_MTD
23882448 INIT_LIST_HEAD(&efx->mtd_list);
@@ -2392,7 +2452,7 @@ static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type, · 3 unmodified lines
23922452 INIT_DELAYED_WORK(&efx->selftest_work, efx_selftest_async_work);
23932453 efx->pci_dev = pci_dev;
23942454 efx->msg_enable = debug;
2395− efx->state = STATE_INIT;
2455+ efx->state = STATE_UNINIT;
23962456 strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
23972457
23982458 efx->net_dev = net_dev;
@@ -2409,8 +2469,6 @@ static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type, · 10 unmodified lines
24092469 goto fail;
24102470 }
24112471
2412− efx->type = type;
2413−
24142472 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS);
24152473
24162474 /* Higher numbered interrupt modes are less capable! */
@@ -2455,6 +2513,12 @@ static void efx_fini_struct(struct efx_nic *efx) · 38 unmodified lines
24552513 */
24562514 static void efx_pci_remove_main(struct efx_nic *efx)
24572515 {
2516+ /* Flush reset_work. It can no longer be scheduled since we
2517+ * are not READY.
2518+ */
2519+ BUG_ON(efx->state == STATE_READY);
2520+ cancel_work_sync(&efx->reset_work);
2521+
24582522 #ifdef CONFIG_RFS_ACCEL
24592523 free_irq_cpu_rmap(efx->net_dev->rx_cpu_rmap);
24602524 efx->net_dev->rx_cpu_rmap = NULL;
@@ -2480,24 +2544,15 @@ static void efx_pci_remove(struct pci_dev *pci_dev) · 19 unmodified lines
24802544
24812545 /* Mark the NIC as fini, then stop the interface */
24822546 rtnl_lock();
2483− efx->state = STATE_FINI;
24842547 dev_close(efx->net_dev);
2485−
2486− /* Allow any queued efx_resets() to complete */
2548+ efx_stop_interrupts(efx, false);
24872549 rtnl_unlock();
24882550
2489− efx_stop_interrupts(efx, false);
24902551 efx_sriov_fini(efx);
24912552 efx_unregister_netdev(efx);
24922553
24932554 efx_mtd_remove(efx);
24942555
2495− /* Wait for any scheduled resets to complete. No more will be
2496− * scheduled from this point because efx_stop_all() has been
2497− * called, we are no longer registered with driverlink, and
2498− * the net_device's have been removed. */
2499− cancel_work_sync(&efx->reset_work);
2500−
25012556 efx_pci_remove_main(efx);
25022557
25032558 efx_fini_io(efx);
@@ -2617,7 +2672,6 @@ static int efx_pci_probe_main(struct efx_nic *efx) · 113 unmodified lines
26172672 static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
26182673 const struct pci_device_id *entry)
26192674 {
2620− const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data;
26212675 struct net_device *net_dev;
26222676 struct efx_nic *efx;
26232677 int rc;
@@ -2627,10 +2681,12 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, · 3 unmodified lines
26272681 EFX_MAX_RX_QUEUES);
26282682 if (!net_dev)
26292683 return -ENOMEM;
2630− net_dev->features |= (type->offload_features | NETIF_F_SG |
2684+ efx = netdev_priv(net_dev);
2685+ efx->type = (const struct efx_nic_type *) entry->driver_data;
2686+ net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
26312687 NETIF_F_HIGHDMA | NETIF_F_TSO |
26322688 NETIF_F_RXCSUM);
2633− if (type->offload_features & NETIF_F_V6_CSUM)
2689+ if (efx->type->offload_features & NETIF_F_V6_CSUM)
26342690 net_dev->features |= NETIF_F_TSO6;
26352691 /* Mask for features that also apply to VLAN devices */
26362692 net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG |
@@ -2638,10 +2694,9 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, · 1 unmodified line
26382694 NETIF_F_RXCSUM);
26392695 /* All offloads can be toggled */
26402696 net_dev->hw_features = net_dev->features & ~NETIF_F_HIGHDMA;
2641− efx = netdev_priv(net_dev);
26422697 pci_set_drvdata(pci_dev, efx);
26432698 SET_NETDEV_DEV(net_dev, &pci_dev->dev);
2644− rc = efx_init_struct(efx, type, pci_dev, net_dev);
2699+ rc = efx_init_struct(efx, pci_dev, net_dev);
26452700 if (rc)
26462701 goto fail1;
26472702
@@ -2656,28 +2711,9 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, · 8 unmodified lines
26562711 goto fail2;
26572712
26582713 rc = efx_pci_probe_main(efx);
2659−
2660− /* Serialise against efx_reset(). No more resets will be
2661− * scheduled since efx_stop_all() has been called, and we have
2662− * not and never have been registered.
2663− */
2664− cancel_work_sync(&efx->reset_work);
2665−
26662714 if (rc)
26672715 goto fail3;
26682716
2669− /* If there was a scheduled reset during probe, the NIC is
2670− * probably hosed anyway.
2671− */
2672− if (efx->reset_pending) {
2673− rc = -EIO;
2674− goto fail4;
2675− }
2676−
2677− /* Switch to the running state before we expose the device to the OS,
2678− * so that dev_open()|efx_start_all() will actually start the device */
2679− efx->state = STATE_RUNNING;
2680−
26812717 rc = efx_register_netdev(efx);
26822718 if (rc)
26832719 goto fail4;
@@ -2717,12 +2753,18 @@ static int efx_pm_freeze(struct device *dev) · 33 unmodified lines
27172753 {
27182754 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
27192755
2720− efx->state = STATE_FINI;
2756+ rtnl_lock();
27212757
2722− netif_device_detach(efx->net_dev);
2758+ if (efx->state != STATE_DISABLED) {
2759+ efx->state = STATE_UNINIT;
27232760
2724− efx_stop_all(efx);
2725− efx_stop_interrupts(efx, false);
2761+ netif_device_detach(efx->net_dev);
2762+
2763+ efx_stop_all(efx);
2764+ efx_stop_interrupts(efx, false);
2765+ }
2766+
2767+ rtnl_unlock();
27262768
27272769 return 0;
27282770 }
@@ -2731,21 +2773,25 @@ static int efx_pm_thaw(struct device *dev) · 2 unmodified lines
27312773 {
27322774 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
27332775
2734− efx->state = STATE_INIT;
2776+ rtnl_lock();
27352777
2736− efx_start_interrupts(efx, false);
2778+ if (efx->state != STATE_DISABLED) {
2779+ efx_start_interrupts(efx, false);
27372780
2738− mutex_lock(&efx->mac_lock);
2739− efx->phy_op->reconfigure(efx);
2740− mutex_unlock(&efx->mac_lock);
2781+ mutex_lock(&efx->mac_lock);
2782+ efx->phy_op->reconfigure(efx);
2783+ mutex_unlock(&efx->mac_lock);
27412784
2742− efx_start_all(efx);
2785+ efx_start_all(efx);
27432786
2744− netif_device_attach(efx->net_dev);
2787+ netif_device_attach(efx->net_dev);
27452788
2746− efx->state = STATE_RUNNING;
2789+ efx->state = STATE_READY;
27472790
2748− efx->type->resume_wol(efx);
2791+ efx->type->resume_wol(efx);
2792+ }
2793+
2794+ rtnl_unlock();
27492795
27502796 /* Reschedule any quenched resets scheduled during efx_pm_freeze() */
27512797 queue_work(reset_workqueue, &efx->reset_work);
drivers/net/ethernet/sfc/efx.h+1−0
@@ -102,6 +102,7 @@ static inline void efx_filter_rfs_expire(struct efx_channel *channel) {} · 101 unmodified lines
102102
103103 /* Channels */
104104 extern int efx_channel_dummy_op_int(struct efx_channel *channel);
105+extern void efx_channel_dummy_op_void(struct efx_channel *channel);
105106 extern void efx_process_channel_now(struct efx_channel *channel);
106107 extern int
107108 efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries);
drivers/net/ethernet/sfc/ethtool.c+6−10
@@ -337,7 +337,8 @@ static int efx_fill_loopback_test(struct efx_nic *efx, · 336 unmodified lines
337337 unsigned int test_index,
338338 struct ethtool_string *strings, u64 *data)
339339 {
340− struct efx_channel *channel = efx_get_channel(efx, 0);
340+ struct efx_channel *channel =
341+ efx_get_channel(efx, efx->tx_channel_offset);
341342 struct efx_tx_queue *tx_queue;
342343
343344 efx_for_each_channel_tx_queue(tx_queue, channel) {
@@ -529,9 +530,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev, · 185 unmodified lines
529530 if (!efx_tests)
530531 goto fail;
531532
532−
533− ASSERT_RTNL();
534− if (efx->state != STATE_RUNNING) {
533+ if (efx->state != STATE_READY) {
535534 rc = -EIO;
536535 goto fail1;
537536 }
@@ -962,9 +961,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, · 424 unmodified lines
962961 int rc;
963962
964963 /* Check that user wants us to choose the location */
965− if (rule->location != RX_CLS_LOC_ANY &&
966− rule->location != RX_CLS_LOC_FIRST &&
967− rule->location != RX_CLS_LOC_LAST)
964+ if (rule->location != RX_CLS_LOC_ANY)
968965 return -EINVAL;
969966
970967 /* Range-check ring_cookie */
@@ -978,9 +975,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, · 7 unmodified lines
978975 rule->m_ext.data[1]))
979976 return -EINVAL;
980977
981− efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL,
982− (rule->location == RX_CLS_LOC_FIRST) ?
983− EFX_FILTER_FLAG_RX_OVERRIDE_IP : 0,
978+ efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, 0,
984979 (rule->ring_cookie == RX_CLS_FLOW_DISC) ?
985980 0xfff : rule->ring_cookie);
986981
@@ -1176,6 +1171,7 @@ const struct ethtool_ops efx_ethtool_ops = { · 189 unmodified lines
11761171 .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
11771172 .get_rxfh_indir = efx_ethtool_get_rxfh_indir,
11781173 .set_rxfh_indir = efx_ethtool_set_rxfh_indir,
1174+ .get_ts_info = efx_ptp_get_ts_info,
11791175 .get_module_info = efx_ethtool_get_module_info,
11801176 .get_module_eeprom = efx_ethtool_get_module_eeprom,
11811177 };
drivers/net/ethernet/sfc/falcon_boards.c+1−1
@@ -380,7 +380,7 @@ static ssize_t set_phy_flash_cfg(struct device *dev, · 379 unmodified lines
380380 new_mode = PHY_MODE_SPECIAL;
381381 if (!((old_mode ^ new_mode) & PHY_MODE_SPECIAL)) {
382382 err = 0;
383− } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) {
383+ } else if (efx->state != STATE_READY || netif_running(efx->net_dev)) {
384384 err = -EBUSY;
385385 } else {
386386 /* Reset the PHY, reconfigure the MAC and enable/disable
drivers/net/ethernet/sfc/filter.c+53−55
@@ -161,10 +161,6 @@ static void efx_filter_push_rx_config(struct efx_nic *efx) · 160 unmodified lines
161161 filter_ctl, FRF_CZ_UNICAST_NOMATCH_RSS_ENABLED,
162162 !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags &
163163 EFX_FILTER_FLAG_RX_RSS));
164− EFX_SET_OWORD_FIELD(
165− filter_ctl, FRF_CZ_UNICAST_NOMATCH_IP_OVERRIDE,
166− !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags &
167− EFX_FILTER_FLAG_RX_OVERRIDE_IP));
168164 EFX_SET_OWORD_FIELD(
169165 filter_ctl, FRF_CZ_MULTICAST_NOMATCH_Q_ID,
170166 table->spec[EFX_FILTER_INDEX_MC_DEF].dmaq_id);
@@ -172,10 +168,6 @@ static void efx_filter_push_rx_config(struct efx_nic *efx) · 1 unmodified line
172168 filter_ctl, FRF_CZ_MULTICAST_NOMATCH_RSS_ENABLED,
173169 !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags &
174170 EFX_FILTER_FLAG_RX_RSS));
175− EFX_SET_OWORD_FIELD(
176− filter_ctl, FRF_CZ_MULTICAST_NOMATCH_IP_OVERRIDE,
177− !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags &
178− EFX_FILTER_FLAG_RX_OVERRIDE_IP));
179171 }
180172
181173 efx_writeo(efx, &filter_ctl, FR_BZ_RX_FILTER_CTL);
@@ -480,14 +472,12 @@ static u32 efx_filter_build(efx_oword_t *filter, struct efx_filter_spec *spec) · 298 unmodified lines
480472
481473 case EFX_FILTER_TABLE_RX_MAC: {
482474 bool is_wild = spec->type == EFX_FILTER_MAC_WILD;
483− EFX_POPULATE_OWORD_8(
475+ EFX_POPULATE_OWORD_7(
484476 *filter,
485477 FRF_CZ_RMFT_RSS_EN,
486478 !!(spec->flags & EFX_FILTER_FLAG_RX_RSS),
487479 FRF_CZ_RMFT_SCATTER_EN,
488480 !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER),
489− FRF_CZ_RMFT_IP_OVERRIDE,
490− !!(spec->flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP),
491481 FRF_CZ_RMFT_RXQ_ID, spec->dmaq_id,
492482 FRF_CZ_RMFT_WILDCARD_MATCH, is_wild,
493483 FRF_CZ_RMFT_DEST_MAC_HI, spec->data[2],
@@ -567,49 +557,62 @@ static int efx_filter_search(struct efx_filter_table *table, · 73 unmodified lines
567557 }
568558
569559 /*
570− * Construct/deconstruct external filter IDs. These must be ordered
571− * by matching priority, for RX NFC semantics.
560+ * Construct/deconstruct external filter IDs. At least the RX filter
561+ * IDs must be ordered by matching priority, for RX NFC semantics.
572562 *
573− * Each RX MAC filter entry has a flag for whether it can override an
574− * RX IP filter that also matches. So we assign locations for MAC
575− * filters with overriding behaviour, then for IP filters, then for
576− * MAC filters without overriding behaviour.
563+ * Deconstruction needs to be robust against invalid IDs so that
564+ * efx_filter_remove_id_safe() and efx_filter_get_filter_safe() can
565+ * accept user-provided IDs.
577566 */
578567
579−#define EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP 0
580−#define EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP 1
581−#define EFX_FILTER_MATCH_PRI_NORMAL_BASE 2
568+#define EFX_FILTER_MATCH_PRI_COUNT 5
569+
570+static const u8 efx_filter_type_match_pri[EFX_FILTER_TYPE_COUNT] = {
571+ [EFX_FILTER_TCP_FULL] = 0,
572+ [EFX_FILTER_UDP_FULL] = 0,
573+ [EFX_FILTER_TCP_WILD] = 1,
574+ [EFX_FILTER_UDP_WILD] = 1,
575+ [EFX_FILTER_MAC_FULL] = 2,
576+ [EFX_FILTER_MAC_WILD] = 3,
577+ [EFX_FILTER_UC_DEF] = 4,
578+ [EFX_FILTER_MC_DEF] = 4,
579+};
580+
581+static const enum efx_filter_table_id efx_filter_range_table[] = {
582+ EFX_FILTER_TABLE_RX_IP, /* RX match pri 0 */
583+ EFX_FILTER_TABLE_RX_IP,
584+ EFX_FILTER_TABLE_RX_MAC,
585+ EFX_FILTER_TABLE_RX_MAC,
586+ EFX_FILTER_TABLE_RX_DEF, /* RX match pri 4 */
587+ EFX_FILTER_TABLE_COUNT, /* TX match pri 0; invalid */
588+ EFX_FILTER_TABLE_COUNT, /* invalid */
589+ EFX_FILTER_TABLE_TX_MAC,
590+ EFX_FILTER_TABLE_TX_MAC, /* TX match pri 3 */
591+};
582592
583593 #define EFX_FILTER_INDEX_WIDTH 13
584594 #define EFX_FILTER_INDEX_MASK ((1 << EFX_FILTER_INDEX_WIDTH) - 1)
585595
586−static inline u32 efx_filter_make_id(enum efx_filter_table_id table_id,
587− unsigned int index, u8 flags)
596+static inline u32
597+efx_filter_make_id(const struct efx_filter_spec *spec, unsigned int index)
588598 {
589− unsigned int match_pri = EFX_FILTER_MATCH_PRI_NORMAL_BASE + table_id;
599+ unsigned int range;
590600
591− if (flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP) {
592− if (table_id == EFX_FILTER_TABLE_RX_MAC)
593− match_pri = EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP;
594− else if (table_id == EFX_FILTER_TABLE_RX_DEF)
595− match_pri = EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP;
596− }
601+ range = efx_filter_type_match_pri[spec->type];
602+ if (!(spec->flags & EFX_FILTER_FLAG_RX))
603+ range += EFX_FILTER_MATCH_PRI_COUNT;
597604
598− return match_pri << EFX_FILTER_INDEX_WIDTH | index;
605+ return range << EFX_FILTER_INDEX_WIDTH | index;
599606 }
600607
601608 static inline enum efx_filter_table_id efx_filter_id_table_id(u32 id)
602609 {
603− unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH;
610+ unsigned int range = id >> EFX_FILTER_INDEX_WIDTH;
604611
605− switch (match_pri) {
606− case EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP:
607− return EFX_FILTER_TABLE_RX_MAC;
608− case EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP:
609− return EFX_FILTER_TABLE_RX_DEF;
610− default:
611− return match_pri - EFX_FILTER_MATCH_PRI_NORMAL_BASE;
612− }
612+ if (range < ARRAY_SIZE(efx_filter_range_table))
613+ return efx_filter_range_table[range];
614+ else
615+ return EFX_FILTER_TABLE_COUNT; /* invalid */
613616 }
614617
615618 static inline unsigned int efx_filter_id_index(u32 id)
@@ -619,12 +622,9 @@ static inline unsigned int efx_filter_id_index(u32 id) · 3 unmodified lines
619622
620623 static inline u8 efx_filter_id_flags(u32 id)
621624 {
622− unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH;
625+ unsigned int range = id >> EFX_FILTER_INDEX_WIDTH;
623626
624− if (match_pri < EFX_FILTER_MATCH_PRI_NORMAL_BASE)
625− return EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_RX_OVERRIDE_IP;
626− else if (match_pri <=
627− EFX_FILTER_MATCH_PRI_NORMAL_BASE + EFX_FILTER_TABLE_RX_DEF)
627+ if (range < EFX_FILTER_MATCH_PRI_COUNT)
628628 return EFX_FILTER_FLAG_RX;
629629 else
630630 return EFX_FILTER_FLAG_TX;
@@ -633,14 +633,15 @@ static inline u8 efx_filter_id_flags(u32 id) · 2 unmodified lines
633633 u32 efx_filter_get_rx_id_limit(struct efx_nic *efx)
634634 {
635635 struct efx_filter_state *state = efx->filter_state;
636− unsigned int table_id = EFX_FILTER_TABLE_RX_DEF;
636+ unsigned int range = EFX_FILTER_MATCH_PRI_COUNT - 1;
637+ enum efx_filter_table_id table_id;
637638
638639 do {
640+ table_id = efx_filter_range_table[range];
639641 if (state->table[table_id].size != 0)
640− return ((EFX_FILTER_MATCH_PRI_NORMAL_BASE + table_id)
641− << EFX_FILTER_INDEX_WIDTH) +
642+ return range << EFX_FILTER_INDEX_WIDTH |
642643 state->table[table_id].size;
643− } while (table_id--);
644+ } while (range--);
644645
645646 return 0;
646647 }
@@ -718,7 +719,7 @@ s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, · 71 unmodified lines
718719 netif_vdbg(efx, hw, efx->net_dev,
719720 "%s: filter type %d index %d rxq %u set",
720721 __func__, spec->type, filter_idx, spec->dmaq_id);
721− rc = efx_filter_make_id(table->id, filter_idx, spec->flags);
722+ rc = efx_filter_make_id(spec, filter_idx);
722723
723724 out:
724725 spin_unlock_bh(&state->lock);
@@ -781,8 +782,7 @@ int efx_filter_remove_id_safe(struct efx_nic *efx, · 56 unmodified lines
781782 spin_lock_bh(&state->lock);
782783
783784 if (test_bit(filter_idx, table->used_bitmap) &&
784− spec->priority == priority &&
785− !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) {
785+ spec->priority == priority) {
786786 efx_filter_table_clear_entry(efx, table, filter_idx);
787787 if (table->used == 0)
788788 efx_filter_table_reset_search_depth(table);
@@ -833,8 +833,7 @@ int efx_filter_get_filter_safe(struct efx_nic *efx, · 44 unmodified lines
833833 spin_lock_bh(&state->lock);
834834
835835 if (test_bit(filter_idx, table->used_bitmap) &&
836− spec->priority == priority &&
837− !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) {
836+ spec->priority == priority) {
838837 *spec_buf = *spec;
839838 rc = 0;
840839 } else {
@@ -927,8 +926,7 @@ s32 efx_filter_get_rx_ids(struct efx_nic *efx, · 86 unmodified lines
927926 goto out;
928927 }
929928 buf[count++] = efx_filter_make_id(
930− table_id, filter_idx,
931− table->spec[filter_idx].flags);
929+ &table->spec[filter_idx], filter_idx);
932930 }
933931 }
934932 }
drivers/net/ethernet/sfc/filter.h+1−6
@@ -61,16 +61,12 @@ enum efx_filter_priority { · 60 unmodified lines
6161 * according to the indirection table.
6262 * @EFX_FILTER_FLAG_RX_SCATTER: Enable DMA scatter on the receiving
6363 * queue.
64− * @EFX_FILTER_FLAG_RX_OVERRIDE_IP: Enables a MAC filter to override
65− * any IP filter that matches the same packet. By default, IP
66− * filters take precedence.
6764 * @EFX_FILTER_FLAG_RX: Filter is for RX
6865 * @EFX_FILTER_FLAG_TX: Filter is for TX
6966 */
7067 enum efx_filter_flags {
7168 EFX_FILTER_FLAG_RX_RSS = 0x01,
7269 EFX_FILTER_FLAG_RX_SCATTER = 0x02,
73− EFX_FILTER_FLAG_RX_OVERRIDE_IP = 0x04,
7470 EFX_FILTER_FLAG_RX = 0x08,
7571 EFX_FILTER_FLAG_TX = 0x10,
7672 };
@@ -88,8 +84,7 @@ enum efx_filter_flags { · 11 unmodified lines
8884 *
8985 * The @priority field is used by software to determine whether a new
9086 * filter may replace an old one. The hardware priority of a filter
91− * depends on the filter type and %EFX_FILTER_FLAG_RX_OVERRIDE_IP
92− * flag.
87+ * depends on the filter type.
9388 */
9489 struct efx_filter_spec {
9590 u8 type:4;
drivers/net/ethernet/sfc/mcdi.c+39−10
@@ -320,14 +320,20 @@ static void efx_mcdi_ev_cpl(struct efx_nic *efx, unsigned int seqno, · 319 unmodified lines
320320 efx_mcdi_complete(mcdi);
321321 }
322322
323−/* Issue the given command by writing the data into the shared memory PDU,
324− * ring the doorbell and wait for completion. Copyout the result. */
325323 int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
326324 const u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen,
327325 size_t *outlen_actual)
326+{
327+ efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
328+ return efx_mcdi_rpc_finish(efx, cmd, inlen,
329+ outbuf, outlen, outlen_actual);
330+}
331+
332+void efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, const u8 *inbuf,
333+ size_t inlen)
328334 {
329335 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
330− int rc;
336+
331337 BUG_ON(efx_nic_rev(efx) < EFX_REV_SIENA_A0);
332338
333339 efx_mcdi_acquire(mcdi);
@@ -338,6 +344,15 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, · 4 unmodified lines
338344 spin_unlock_bh(&mcdi->iface_lock);
339345
340346 efx_mcdi_copyin(efx, cmd, inbuf, inlen);
347+}
348+
349+int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
350+ u8 *outbuf, size_t outlen, size_t *outlen_actual)
351+{
352+ struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
353+ int rc;
354+
355+ BUG_ON(efx_nic_rev(efx) < EFX_REV_SIENA_A0);
341356
342357 if (mcdi->mode == MCDI_MODE_POLL)
343358 rc = efx_mcdi_poll(efx);
@@ -563,6 +578,11 @@ void efx_mcdi_process_event(struct efx_channel *channel, · 219 unmodified lines
563578 case MCDI_EVENT_CODE_FLR:
564579 efx_sriov_flr(efx, MCDI_EVENT_FIELD(*event, FLR_VF));
565580 break;
581+ case MCDI_EVENT_CODE_PTP_RX:
582+ case MCDI_EVENT_CODE_PTP_FAULT:
583+ case MCDI_EVENT_CODE_PTP_PPS:
584+ efx_ptp_event(efx, event);
585+ break;
566586
567587 default:
568588 netif_err(efx, hw, efx->net_dev, "Unknown MCDI event 0x%x\n",
@@ -641,9 +661,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, · 72 unmodified lines
641661 u16 *fw_subtype_list, u32 *capabilities)
642662 {
643663 uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
644− size_t outlen;
664+ size_t outlen, offset, i;
645665 int port_num = efx_port_num(efx);
646− int offset;
647666 int rc;
648667
649668 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);
@@ -663,11 +682,18 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, · 13 unmodified lines
663682 : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;
664683 if (mac_address)
665684 memcpy(mac_address, outbuf + offset, ETH_ALEN);
666− if (fw_subtype_list)
667− memcpy(fw_subtype_list,
668− outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST,
669− MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM *
670− sizeof(fw_subtype_list[0]));
685+ if (fw_subtype_list) {
686+ /* Byte-swap and truncate or zero-pad as necessary */
687+ offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
688+ for (i = 0;
689+ i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM;
690+ i++) {
691+ fw_subtype_list[i] =
692+ (offset + 2 <= outlen) ?
693+ le16_to_cpup((__le16 *)(outbuf + offset)) : 0;
694+ offset += 2;
695+ }
696+ }
671697 if (capabilities) {
672698 if (port_num)
673699 *capabilities = MCDI_DWORD(outbuf,
@@ -1169,6 +1195,9 @@ int efx_mcdi_flush_rxqs(struct efx_nic *efx) · 495 unmodified lines
11691195 __le32 *qid;
11701196 int rc, count;
11711197
1198+ BUILD_BUG_ON(EFX_MAX_CHANNELS >
1199+ MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM);
1200+
11721201 qid = kmalloc(EFX_MAX_CHANNELS * sizeof(*qid), GFP_KERNEL);
11731202 if (qid == NULL)
11741203 return -ENOMEM;
drivers/net/ethernet/sfc/mcdi.h+10−2
@@ -71,6 +71,12 @@ extern int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const u8 *inbuf, · 70 unmodified lines
7171 size_t inlen, u8 *outbuf, size_t outlen,
7272 size_t *outlen_actual);
7373
74+extern void efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
75+ const u8 *inbuf, size_t inlen);
76+extern int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
77+ u8 *outbuf, size_t outlen,
78+ size_t *outlen_actual);
79+
7480 extern int efx_mcdi_poll_reboot(struct efx_nic *efx);
7581 extern void efx_mcdi_mode_poll(struct efx_nic *efx);
7682 extern void efx_mcdi_mode_event(struct efx_nic *efx);
@@ -107,11 +113,13 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); · 30 unmodified lines
107113 #define MCDI_EVENT_FIELD(_ev, _field) \
108114 EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
109115 #define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2) \
110− EFX_DWORD_FIELD( \
116+ EFX_EXTRACT_DWORD( \
111117 *((efx_dword_t *) \
112118 (MCDI_ARRAY_PTR(_buf, _field1, _type, _index) + \
113119 (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _OFST & ~3))), \
114− MC_CMD_ ## _type ## _TYPEDEF_ ## _field2)
120+ MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _LBN & 0x1f, \
121+ (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _LBN & 0x1f) + \
122+ MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _WIDTH - 1)
115123
116124 extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);
117125 extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
drivers/net/ethernet/sfc/mcdi_pcol.h+15−14
@@ -289,6 +289,7 @@ · 288 unmodified lines
289289 #define MCDI_EVENT_CODE_TX_FLUSH 0xc /* enum */
290290 #define MCDI_EVENT_CODE_PTP_RX 0xd /* enum */
291291 #define MCDI_EVENT_CODE_PTP_FAULT 0xe /* enum */
292+#define MCDI_EVENT_CODE_PTP_PPS 0xf /* enum */
292293 #define MCDI_EVENT_CMDDONE_DATA_OFST 0
293294 #define MCDI_EVENT_CMDDONE_DATA_LBN 0
294295 #define MCDI_EVENT_CMDDONE_DATA_WIDTH 32
@@ -491,12 +492,12 @@ · 196 unmodified lines
491492
492493 /* MC_CMD_GET_FPGAREG_OUT msgresponse */
493494 #define MC_CMD_GET_FPGAREG_OUT_LENMIN 1
494−#define MC_CMD_GET_FPGAREG_OUT_LENMAX 255
495+#define MC_CMD_GET_FPGAREG_OUT_LENMAX 252
495496 #define MC_CMD_GET_FPGAREG_OUT_LEN(num) (0+1*(num))
496497 #define MC_CMD_GET_FPGAREG_OUT_BUFFER_OFST 0
497498 #define MC_CMD_GET_FPGAREG_OUT_BUFFER_LEN 1
498499 #define MC_CMD_GET_FPGAREG_OUT_BUFFER_MINNUM 1
499−#define MC_CMD_GET_FPGAREG_OUT_BUFFER_MAXNUM 255
500+#define MC_CMD_GET_FPGAREG_OUT_BUFFER_MAXNUM 252
500501
501502
502503 /***********************************/
@@ -507,13 +508,13 @@ · 4 unmodified lines
507508
508509 /* MC_CMD_PUT_FPGAREG_IN msgrequest */
509510 #define MC_CMD_PUT_FPGAREG_IN_LENMIN 5
510−#define MC_CMD_PUT_FPGAREG_IN_LENMAX 255
511+#define MC_CMD_PUT_FPGAREG_IN_LENMAX 252
511512 #define MC_CMD_PUT_FPGAREG_IN_LEN(num) (4+1*(num))
512513 #define MC_CMD_PUT_FPGAREG_IN_ADDR_OFST 0
513514 #define MC_CMD_PUT_FPGAREG_IN_BUFFER_OFST 4
514515 #define MC_CMD_PUT_FPGAREG_IN_BUFFER_LEN 1
515516 #define MC_CMD_PUT_FPGAREG_IN_BUFFER_MINNUM 1
516−#define MC_CMD_PUT_FPGAREG_IN_BUFFER_MAXNUM 251
517+#define MC_CMD_PUT_FPGAREG_IN_BUFFER_MAXNUM 248
517518
518519 /* MC_CMD_PUT_FPGAREG_OUT msgresponse */
519520 #define MC_CMD_PUT_FPGAREG_OUT_LEN 0
@@ -560,7 +561,7 @@ · 40 unmodified lines
560561
561562 /* MC_CMD_PTP_IN_TRANSMIT msgrequest */
562563 #define MC_CMD_PTP_IN_TRANSMIT_LENMIN 13
563−#define MC_CMD_PTP_IN_TRANSMIT_LENMAX 255
564+#define MC_CMD_PTP_IN_TRANSMIT_LENMAX 252
564565 #define MC_CMD_PTP_IN_TRANSMIT_LEN(num) (12+1*(num))
565566 /* MC_CMD_PTP_IN_CMD_OFST 0 */
566567 /* MC_CMD_PTP_IN_PERIPH_ID_OFST 4 */
@@ -568,7 +569,7 @@ · 1 unmodified line
568569 #define MC_CMD_PTP_IN_TRANSMIT_PACKET_OFST 12
569570 #define MC_CMD_PTP_IN_TRANSMIT_PACKET_LEN 1
570571 #define MC_CMD_PTP_IN_TRANSMIT_PACKET_MINNUM 1
571−#define MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM 243
572+#define MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM 240
572573
573574 /* MC_CMD_PTP_IN_READ_NIC_TIME msgrequest */
574575 #define MC_CMD_PTP_IN_READ_NIC_TIME_LEN 8
@@ -1145,7 +1146,7 @@ · 570 unmodified lines
11451146
11461147 /* MC_CMD_PUTS_IN msgrequest */
11471148 #define MC_CMD_PUTS_IN_LENMIN 13
1148−#define MC_CMD_PUTS_IN_LENMAX 255
1149+#define MC_CMD_PUTS_IN_LENMAX 252
11491150 #define MC_CMD_PUTS_IN_LEN(num) (12+1*(num))
11501151 #define MC_CMD_PUTS_IN_DEST_OFST 0
11511152 #define MC_CMD_PUTS_IN_UART_LBN 0
@@ -1157,7 +1158,7 @@ · 5 unmodified lines
11571158 #define MC_CMD_PUTS_IN_STRING_OFST 12
11581159 #define MC_CMD_PUTS_IN_STRING_LEN 1
11591160 #define MC_CMD_PUTS_IN_STRING_MINNUM 1
1160−#define MC_CMD_PUTS_IN_STRING_MAXNUM 243
1161+#define MC_CMD_PUTS_IN_STRING_MAXNUM 240
11611162
11621163 /* MC_CMD_PUTS_OUT msgresponse */
11631164 #define MC_CMD_PUTS_OUT_LEN 0
@@ -1947,12 +1948,12 @@ · 783 unmodified lines
19471948
19481949 /* MC_CMD_NVRAM_READ_OUT msgresponse */
19491950 #define MC_CMD_NVRAM_READ_OUT_LENMIN 1
1950−#define MC_CMD_NVRAM_READ_OUT_LENMAX 255
1951+#define MC_CMD_NVRAM_READ_OUT_LENMAX 252
19511952 #define MC_CMD_NVRAM_READ_OUT_LEN(num) (0+1*(num))
19521953 #define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_OFST 0
19531954 #define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_LEN 1
19541955 #define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MINNUM 1
1955−#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MAXNUM 255
1956+#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MAXNUM 252
19561957
19571958
19581959 /***********************************/
@@ -1963,7 +1964,7 @@ · 4 unmodified lines
19631964
19641965 /* MC_CMD_NVRAM_WRITE_IN msgrequest */
19651966 #define MC_CMD_NVRAM_WRITE_IN_LENMIN 13
1966−#define MC_CMD_NVRAM_WRITE_IN_LENMAX 255
1967+#define MC_CMD_NVRAM_WRITE_IN_LENMAX 252
19671968 #define MC_CMD_NVRAM_WRITE_IN_LEN(num) (12+1*(num))
19681969 #define MC_CMD_NVRAM_WRITE_IN_TYPE_OFST 0
19691970 /* Enum values, see field(s): */
@@ -1973,7 +1974,7 @@ · 3 unmodified lines
19731974 #define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_OFST 12
19741975 #define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_LEN 1
19751976 #define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MINNUM 1
1976−#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MAXNUM 243
1977+#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MAXNUM 240
19771978
19781979 /* MC_CMD_NVRAM_WRITE_OUT msgresponse */
19791980 #define MC_CMD_NVRAM_WRITE_OUT_LEN 0
@@ -2305,13 +2306,13 @@ · 325 unmodified lines
23052306
23062307 /* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */
23072308 #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 5
2308−#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 255
2309+#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 252
23092310 #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LEN(num) (4+1*(num))
23102311 #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATALEN_OFST 0
23112312 #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_OFST 4
23122313 #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_LEN 1
23132314 #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MINNUM 1
2314−#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MAXNUM 251
2315+#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MAXNUM 248
23152316
23162317
23172318 /***********************************/
drivers/net/ethernet/sfc/mtd.c+5−2
@@ -585,6 +585,7 @@ static const struct siena_nvram_type_info siena_nvram_types[] = { · 584 unmodified lines
585585 [MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT1] = { 1, "sfc_exp_rom_cfg" },
586586 [MC_CMD_NVRAM_TYPE_PHY_PORT0] = { 0, "sfc_phy_fw" },
587587 [MC_CMD_NVRAM_TYPE_PHY_PORT1] = { 1, "sfc_phy_fw" },
588+ [MC_CMD_NVRAM_TYPE_FPGA] = { 0, "sfc_fpga" },
588589 };
589590
590591 static int siena_mtd_probe_partition(struct efx_nic *efx,
@@ -598,7 +599,8 @@ static int siena_mtd_probe_partition(struct efx_nic *efx, · 7 unmodified lines
598599 bool protected;
599600 int rc;
600601
601− if (type >= ARRAY_SIZE(siena_nvram_types))
602+ if (type >= ARRAY_SIZE(siena_nvram_types) ||
603+ siena_nvram_types[type].name == NULL)
602604 return -ENODEV;
603605
604606 info = &siena_nvram_types[type];
@@ -627,7 +629,8 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, · 22 unmodified lines
627629 struct efx_mtd *efx_mtd)
628630 {
629631 struct efx_mtd_partition *part;
630− uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM];
632+ uint16_t fw_subtype_list[
633+ MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM];
631634 int rc;
632635
633636 rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL);
drivers/net/ethernet/sfc/net_driver.h+52−26
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737 *
3838 **************************************************************************/
3939
40−#define EFX_DRIVER_VERSION "3.1"
40+#define EFX_DRIVER_VERSION "3.2"
4141
4242 #ifdef DEBUG
4343 #define EFX_BUG_ON_PARANOID(x) BUG_ON(x)
@@ -56,7 +56,8 @@ · 12 unmodified lines
5656 #define EFX_MAX_CHANNELS 32U
5757 #define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS
5858 #define EFX_EXTRA_CHANNEL_IOV 0
59−#define EFX_MAX_EXTRA_CHANNELS 1U
59+#define EFX_EXTRA_CHANNEL_PTP 1
60+#define EFX_MAX_EXTRA_CHANNELS 2U
6061
6162 /* Checksum generation is a per-queue option in hardware, so each
6263 * queue visible to the networking core is backed by two hardware TX
@@ -68,6 +69,9 @@ · 5 unmodified lines
6869 #define EFX_TXQ_TYPES 4
6970 #define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)
7071
72+/* Forward declare Precision Time Protocol (PTP) support structure. */
73+struct efx_ptp_data;
74+
7175 struct efx_self_tests;
7276
7377 /**
@@ -91,29 +95,31 @@ struct efx_special_buffer { · 17 unmodified lines
9195 };
9296
9397 /**
94− * struct efx_tx_buffer - An Efx TX buffer
95− * @skb: The associated socket buffer.
96− * Set only on the final fragment of a packet; %NULL for all other
97− * fragments. When this fragment completes, then we can free this
98− * skb.
99− * @tsoh: The associated TSO header structure, or %NULL if this
100− * buffer is not a TSO header.
98+ * struct efx_tx_buffer - buffer state for a TX descriptor
99+ * @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
100+ * freed when descriptor completes
101+ * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be
102+ * freed when descriptor completes.
101103 * @dma_addr: DMA address of the fragment.
104+ * @flags: Flags for allocation and DMA mapping type
102105 * @len: Length of this fragment.
103106 * This field is zero when the queue slot is empty.
104− * @continuation: True if this fragment is not the end of a packet.
105− * @unmap_single: True if dma_unmap_single should be used.
106107 * @unmap_len: Length of this fragment to unmap
107108 */
108109 struct efx_tx_buffer {
109− const struct sk_buff *skb;
110− struct efx_tso_header *tsoh;
110+ union {
111+ const struct sk_buff *skb;
112+ void *heap_buf;
113+ };
111114 dma_addr_t dma_addr;
115+ unsigned short flags;
112116 unsigned short len;
113− bool continuation;
114− bool unmap_single;
115117 unsigned short unmap_len;
116118 };
119+#define EFX_TX_BUF_CONT 1 /* not last descriptor of packet */
120+#define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */
121+#define EFX_TX_BUF_HEAP 4 /* buffer was allocated with kmalloc() */
122+#define EFX_TX_BUF_MAP_SINGLE 8 /* buffer was mapped with dma_map_single() */
117123
118124 /**
119125 * struct efx_tx_queue - An Efx TX queue
@@ -133,6 +139,7 @@ struct efx_tx_buffer { · 13 unmodified lines
133139 * @channel: The associated channel
134140 * @core_txq: The networking core TX queue structure
135141 * @buffer: The software buffer ring
142+ * @tsoh_page: Array of pages of TSO header buffers
136143 * @txd: The hardware descriptor ring
137144 * @ptr_mask: The size of the ring minus 1.
138145 * @initialised: Has hardware queue been initialised?
@@ -156,9 +163,6 @@ struct efx_tx_buffer { · 17 unmodified lines
156163 * variable indicates that the queue is full. This is to
157164 * avoid cache-line ping-pong between the xmit path and the
158165 * completion path.
159− * @tso_headers_free: A list of TSO headers allocated for this TX queue
160− * that are not in use, and so available for new TSO sends. The list
161− * is protected by the TX queue lock.
162166 * @tso_bursts: Number of times TSO xmit invoked by kernel
163167 * @tso_long_headers: Number of packets with headers too long for standard
164168 * blocks
@@ -175,6 +179,7 @@ struct efx_tx_queue { · 10 unmodified lines
175179 struct efx_channel *channel;
176180 struct netdev_queue *core_txq;
177181 struct efx_tx_buffer *buffer;
182+ struct efx_buffer *tsoh_page;
178183 struct efx_special_buffer txd;
179184 unsigned int ptr_mask;
180185 bool initialised;
@@ -187,7 +192,6 @@ struct efx_tx_queue { · 6 unmodified lines
187192 unsigned int insert_count ____cacheline_aligned_in_smp;
188193 unsigned int write_count;
189194 unsigned int old_read_count;
190− struct efx_tso_header *tso_headers_free;
191195 unsigned int tso_bursts;
192196 unsigned int tso_long_headers;
193197 unsigned int tso_packets;
@@ -242,6 +246,8 @@ struct efx_rx_page_state { · 48 unmodified lines
242246 /**
243247 * struct efx_rx_queue - An Efx RX queue
244248 * @efx: The associated Efx NIC
249+ * @core_index: Index of network core RX queue. Will be >= 0 iff this
250+ * is associated with a real RX queue.
245251 * @buffer: The software buffer ring
246252 * @rxd: The hardware descriptor ring
247253 * @ptr_mask: The size of the ring minus 1.
@@ -263,6 +269,7 @@ struct efx_rx_page_state { · 15 unmodified lines
263269 */
264270 struct efx_rx_queue {
265271 struct efx_nic *efx;
272+ int core_index;
266273 struct efx_rx_buffer *buffer;
267274 struct efx_special_buffer rxd;
268275 unsigned int ptr_mask;
@@ -390,14 +397,17 @@ struct efx_channel { · 121 unmodified lines
390397 * @get_name: Generate the channel's name (used for its IRQ handler)
391398 * @copy: Copy the channel state prior to reallocation. May be %NULL if
392399 * reallocation is not supported.
400+ * @receive_skb: Handle an skb ready to be passed to netif_receive_skb()
393401 * @keep_eventq: Flag for whether event queue should be kept initialised
394402 * while the device is stopped
395403 */
396404 struct efx_channel_type {
397405 void (*handle_no_channel)(struct efx_nic *);
398406 int (*pre_probe)(struct efx_channel *);
407+ void (*post_remove)(struct efx_channel *);
399408 void (*get_name)(struct efx_channel *, char *buf, size_t len);
400409 struct efx_channel *(*copy)(const struct efx_channel *);
410+ void (*receive_skb)(struct efx_channel *, struct sk_buff *);
401411 bool keep_eventq;
402412 };
403413
@@ -430,11 +440,9 @@ enum efx_int_mode { · 26 unmodified lines
430440 #define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
431441
432442 enum nic_state {
433− STATE_INIT = 0,
434− STATE_RUNNING = 1,
435− STATE_FINI = 2,
436− STATE_DISABLED = 3,
437− STATE_MAX,
443+ STATE_UNINIT = 0, /* device being probed/removed or is frozen */
444+ STATE_READY = 1, /* hardware ready and netdev registered */
445+ STATE_DISABLED = 2, /* device disabled due to hardware errors */
438446 };
439447
440448 /*
@@ -654,7 +662,7 @@ struct vfdi_status; · 213 unmodified lines
654662 * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
655663 * @irq_rx_moderation: IRQ moderation time for RX event queues
656664 * @msg_enable: Log message enable flags
657− * @state: Device state flag. Serialised by the rtnl_lock.
665+ * @state: Device state number (%STATE_*). Serialised by the rtnl_lock.
658666 * @reset_pending: Bitmask for pending resets
659667 * @tx_queue: TX DMA queues
660668 * @rx_queue: RX DMA queues
@@ -664,6 +672,8 @@ struct vfdi_status; · 3 unmodified lines
664672 * should be allocated for this NIC
665673 * @rxq_entries: Size of receive queues requested by user.
666674 * @txq_entries: Size of transmit queues requested by user.
675+ * @txq_stop_thresh: TX queue fill level at or above which we stop it.
676+ * @txq_wake_thresh: TX queue fill level at or below which we wake it.
667677 * @tx_dc_base: Base qword address in SRAM of TX queue descriptor caches
668678 * @rx_dc_base: Base qword address in SRAM of RX queue descriptor caches
669679 * @sram_lim_qw: Qword address limit of SRAM
@@ -730,6 +740,7 @@ struct vfdi_status; · 60 unmodified lines
730740 * %local_addr_list. Protected by %local_lock.
731741 * @local_lock: Mutex protecting %local_addr_list and %local_page_list.
732742 * @peer_work: Work item to broadcast peer addresses to VMs.
743+ * @ptp_data: PTP state data
733744 * @monitor_work: Hardware monitor workitem
734745 * @biu_lock: BIU (bus interface unit) lock
735746 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
@@ -774,6 +785,9 @@ struct efx_nic { · 38 unmodified lines
774785
775786 unsigned rxq_entries;
776787 unsigned txq_entries;
788+ unsigned int txq_stop_thresh;
789+ unsigned int txq_wake_thresh;
790+
777791 unsigned tx_dc_base;
778792 unsigned rx_dc_base;
779793 unsigned sram_lim_qw;
@@ -854,6 +868,10 @@ struct efx_nic { · 74 unmodified lines
854868 struct work_struct peer_work;
855869 #endif
856870
871+#ifdef CONFIG_SFC_PTP
872+ struct efx_ptp_data *ptp_data;
873+#endif
874+
857875 /* The following fields may be written more often */
858876
859877 struct delayed_work monitor_work ____cacheline_aligned_in_smp;
@@ -1044,7 +1062,7 @@ static inline bool efx_tx_queue_used(struct efx_tx_queue *tx_queue) · 184 unmodified lines
10441062
10451063 static inline bool efx_channel_has_rx_queue(struct efx_channel *channel)
10461064 {
1047− return channel->channel < channel->efx->n_rx_channels;
1065+ return channel->rx_queue.core_index >= 0;
10481066 }
10491067
10501068 static inline struct efx_rx_queue *
@@ -1116,5 +1134,13 @@ static inline void clear_bit_le(unsigned nr, unsigned char *addr) · 65 unmodified lines
11161134 #define EFX_MAX_FRAME_LEN(mtu) \
11171135 ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */ + 7) & ~7) + 16)
11181136
1137+static inline bool efx_xmit_with_hwtstamp(struct sk_buff *skb)
1138+{
1139+ return skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP;
1140+}
1141+static inline void efx_xmit_hwtstamp_pending(struct sk_buff *skb)
1142+{
1143+ skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1144+}
11191145
11201146 #endif /* EFX_NET_DRIVER_H */
drivers/net/ethernet/sfc/nic.c+4−2
@@ -298,7 +298,7 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer) · 297 unmodified lines
298298 /**************************************************************************
299299 *
300300 * Generic buffer handling
301− * These buffers are used for interrupt status and MAC stats
301+ * These buffers are used for interrupt status, MAC stats, etc.
302302 *
303303 **************************************************************************/
304304
@@ -401,8 +401,10 @@ void efx_nic_push_buffers(struct efx_tx_queue *tx_queue) · 96 unmodified lines
401401 ++tx_queue->write_count;
402402
403403 /* Create TX descriptor ring entry */
404+ BUILD_BUG_ON(EFX_TX_BUF_CONT != 1);
404405 EFX_POPULATE_QWORD_4(*txd,
405− FSF_AZ_TX_KER_CONT, buffer->continuation,
406+ FSF_AZ_TX_KER_CONT,
407+ buffer->flags & EFX_TX_BUF_CONT,
406408 FSF_AZ_TX_KER_BYTE_COUNT, buffer->len,
407409 FSF_AZ_TX_KER_BUF_REGION, 0,
408410 FSF_AZ_TX_KER_BUF_ADDR, buffer->dma_addr);
drivers/net/ethernet/sfc/nic.h+36−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #ifndef EFX_NIC_H
1212 #define EFX_NIC_H
1313
14+#include <linux/net_tstamp.h>
1415 #include <linux/i2c-algo-bit.h>
1516 #include "net_driver.h"
1617 #include "efx.h"
@@ -250,6 +251,41 @@ extern int efx_sriov_get_vf_config(struct net_device *dev, int vf, · 233 unmodified lines
250251 extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf,
251252 bool spoofchk);
252253
254+struct ethtool_ts_info;
255+#ifdef CONFIG_SFC_PTP
256+extern void efx_ptp_probe(struct efx_nic *efx);
257+extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd);
258+extern int efx_ptp_get_ts_info(struct net_device *net_dev,
259+ struct ethtool_ts_info *ts_info);
260+extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
261+extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
262+extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
263+#else
264+static inline void efx_ptp_probe(struct efx_nic *efx) {}
265+static inline int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd)
266+{
267+ return -EOPNOTSUPP;
268+}
269+static inline int efx_ptp_get_ts_info(struct net_device *net_dev,
270+ struct ethtool_ts_info *ts_info)
271+{
272+ ts_info->so_timestamping = (SOF_TIMESTAMPING_SOFTWARE |
273+ SOF_TIMESTAMPING_RX_SOFTWARE);
274+ ts_info->phc_index = -1;
275+
276+ return 0;
277+}
278+static inline bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb)
279+{
280+ return false;
281+}
282+static inline int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb)
283+{
284+ return NETDEV_TX_OK;
285+}
286+static inline void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) {}
287+#endif
288+
253289 extern const struct efx_nic_type falcon_a1_nic_type;
254290 extern const struct efx_nic_type falcon_b0_nic_type;
255291 extern const struct efx_nic_type siena_a0_nic_type;
drivers/net/ethernet/sfc/ptp.c+1484−0
@@ -0,0 +1,1484 @@
1+/****************************************************************************
2+ * Driver for Solarflare Solarstorm network controllers and boards
3+ * Copyright 2011 Solarflare Communications Inc.
4+ *
5+ * This program is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 as published
7+ * by the Free Software Foundation, incorporated herein by reference.
8+ */
9+
10+/* Theory of operation:
11+ *
12+ * PTP support is assisted by firmware running on the MC, which provides
13+ * the hardware timestamping capabilities. Both transmitted and received
14+ * PTP event packets are queued onto internal queues for subsequent processing;
15+ * this is because the MC operations are relatively long and would block
16+ * block NAPI/interrupt operation.
17+ *
18+ * Receive event processing:
19+ * The event contains the packet's UUID and sequence number, together
20+ * with the hardware timestamp. The PTP receive packet queue is searched
21+ * for this UUID/sequence number and, if found, put on a pending queue.
22+ * Packets not matching are delivered without timestamps (MCDI events will
23+ * always arrive after the actual packet).
24+ * It is important for the operation of the PTP protocol that the ordering
25+ * of packets between the event and general port is maintained.
26+ *
27+ * Work queue processing:
28+ * If work waiting, synchronise host/hardware time
29+ *
30+ * Transmit: send packet through MC, which returns the transmission time
31+ * that is converted to an appropriate timestamp.
32+ *
33+ * Receive: the packet's reception time is converted to an appropriate
34+ * timestamp.
35+ */
36+#include <linux/ip.h>
37+#include <linux/udp.h>
38+#include <linux/time.h>
39+#include <linux/ktime.h>
40+#include <linux/module.h>
41+#include <linux/net_tstamp.h>
42+#include <linux/pps_kernel.h>
43+#include <linux/ptp_clock_kernel.h>
44+#include "net_driver.h"
45+#include "efx.h"
46+#include "mcdi.h"
47+#include "mcdi_pcol.h"
48+#include "io.h"
49+#include "regs.h"
50+#include "nic.h"
51+
52+/* Maximum number of events expected to make up a PTP event */
53+#define MAX_EVENT_FRAGS 3
54+
55+/* Maximum delay, ms, to begin synchronisation */
56+#define MAX_SYNCHRONISE_WAIT_MS 2
57+
58+/* How long, at most, to spend synchronising */
59+#define SYNCHRONISE_PERIOD_NS 250000
60+
61+/* How often to update the shared memory time */
62+#define SYNCHRONISATION_GRANULARITY_NS 200
63+
64+/* Minimum permitted length of a (corrected) synchronisation time */
65+#define MIN_SYNCHRONISATION_NS 120
66+
67+/* Maximum permitted length of a (corrected) synchronisation time */
68+#define MAX_SYNCHRONISATION_NS 1000
69+
70+/* How many (MC) receive events that can be queued */
71+#define MAX_RECEIVE_EVENTS 8
72+
73+/* Length of (modified) moving average. */
74+#define AVERAGE_LENGTH 16
75+
76+/* How long an unmatched event or packet can be held */
77+#define PKT_EVENT_LIFETIME_MS 10
78+
79+/* Offsets into PTP packet for identification. These offsets are from the
80+ * start of the IP header, not the MAC header. Note that neither PTP V1 nor
81+ * PTP V2 permit the use of IPV4 options.
82+ */
83+#define PTP_DPORT_OFFSET 22
84+
85+#define PTP_V1_VERSION_LENGTH 2
86+#define PTP_V1_VERSION_OFFSET 28
87+
88+#define PTP_V1_UUID_LENGTH 6
89+#define PTP_V1_UUID_OFFSET 50
90+
91+#define PTP_V1_SEQUENCE_LENGTH 2
92+#define PTP_V1_SEQUENCE_OFFSET 58
93+
94+/* The minimum length of a PTP V1 packet for offsets, etc. to be valid:
95+ * includes IP header.
96+ */
97+#define PTP_V1_MIN_LENGTH 64
98+
99+#define PTP_V2_VERSION_LENGTH 1
100+#define PTP_V2_VERSION_OFFSET 29
101+
102+/* Although PTP V2 UUIDs are comprised a ClockIdentity (8) and PortNumber (2),
103+ * the MC only captures the last six bytes of the clock identity. These values
104+ * reflect those, not the ones used in the standard. The standard permits
105+ * mapping of V1 UUIDs to V2 UUIDs with these same values.
106+ */
107+#define PTP_V2_MC_UUID_LENGTH 6
108+#define PTP_V2_MC_UUID_OFFSET 50
109+
110+#define PTP_V2_SEQUENCE_LENGTH 2
111+#define PTP_V2_SEQUENCE_OFFSET 58
112+
113+/* The minimum length of a PTP V2 packet for offsets, etc. to be valid:
114+ * includes IP header.
115+ */
116+#define PTP_V2_MIN_LENGTH 63
117+
118+#define PTP_MIN_LENGTH 63
119+
120+#define PTP_ADDRESS 0xe0000181 /* 224.0.1.129 */
121+#define PTP_EVENT_PORT 319
122+#define PTP_GENERAL_PORT 320
123+
124+/* Annoyingly the format of the version numbers are different between
125+ * versions 1 and 2 so it isn't possible to simply look for 1 or 2.
126+ */
127+#define PTP_VERSION_V1 1
128+
129+#define PTP_VERSION_V2 2
130+#define PTP_VERSION_V2_MASK 0x0f
131+
132+enum ptp_packet_state {
133+ PTP_PACKET_STATE_UNMATCHED = 0,
134+ PTP_PACKET_STATE_MATCHED,
135+ PTP_PACKET_STATE_TIMED_OUT,
136+ PTP_PACKET_STATE_MATCH_UNWANTED
137+};
138+
139+/* NIC synchronised with single word of time only comprising
140+ * partial seconds and full nanoseconds: 10^9 ~ 2^30 so 2 bits for seconds.
141+ */
142+#define MC_NANOSECOND_BITS 30
143+#define MC_NANOSECOND_MASK ((1 << MC_NANOSECOND_BITS) - 1)
144+#define MC_SECOND_MASK ((1 << (32 - MC_NANOSECOND_BITS)) - 1)
145+
146+/* Maximum parts-per-billion adjustment that is acceptable */
147+#define MAX_PPB 1000000
148+
149+/* Number of bits required to hold the above */
150+#define MAX_PPB_BITS 20
151+
152+/* Number of extra bits allowed when calculating fractional ns.
153+ * EXTRA_BITS + MC_CMD_PTP_IN_ADJUST_BITS + MAX_PPB_BITS should
154+ * be less than 63.
155+ */
156+#define PPB_EXTRA_BITS 2
157+
158+/* Precalculate scale word to avoid long long division at runtime */
159+#define PPB_SCALE_WORD ((1LL << (PPB_EXTRA_BITS + MC_CMD_PTP_IN_ADJUST_BITS +\
160+ MAX_PPB_BITS)) / 1000000000LL)
161+
162+#define PTP_SYNC_ATTEMPTS 4
163+
164+/**
165+ * struct efx_ptp_match - Matching structure, stored in sk_buff's cb area.
166+ * @words: UUID and (partial) sequence number
167+ * @expiry: Time after which the packet should be delivered irrespective of
168+ * event arrival.
169+ * @state: The state of the packet - whether it is ready for processing or
170+ * whether that is of no interest.
171+ */
172+struct efx_ptp_match {
173+ u32 words[DIV_ROUND_UP(PTP_V1_UUID_LENGTH, 4)];
174+ unsigned long expiry;
175+ enum ptp_packet_state state;
176+};
177+
178+/**
179+ * struct efx_ptp_event_rx - A PTP receive event (from MC)
180+ * @seq0: First part of (PTP) UUID
181+ * @seq1: Second part of (PTP) UUID and sequence number
182+ * @hwtimestamp: Event timestamp
183+ */
184+struct efx_ptp_event_rx {
185+ struct list_head link;
186+ u32 seq0;
187+ u32 seq1;
188+ ktime_t hwtimestamp;
189+ unsigned long expiry;
190+};
191+
192+/**
193+ * struct efx_ptp_timeset - Synchronisation between host and MC
194+ * @host_start: Host time immediately before hardware timestamp taken
195+ * @seconds: Hardware timestamp, seconds
196+ * @nanoseconds: Hardware timestamp, nanoseconds
197+ * @host_end: Host time immediately after hardware timestamp taken
198+ * @waitns: Number of nanoseconds between hardware timestamp being read and
199+ * host end time being seen
200+ * @window: Difference of host_end and host_start
201+ * @valid: Whether this timeset is valid
202+ */
203+struct efx_ptp_timeset {
204+ u32 host_start;
205+ u32 seconds;
206+ u32 nanoseconds;
207+ u32 host_end;
208+ u32 waitns;
209+ u32 window; /* Derived: end - start, allowing for wrap */
210+};
211+
212+/**
213+ * struct efx_ptp_data - Precision Time Protocol (PTP) state
214+ * @channel: The PTP channel
215+ * @rxq: Receive queue (awaiting timestamps)
216+ * @txq: Transmit queue
217+ * @evt_list: List of MC receive events awaiting packets
218+ * @evt_free_list: List of free events
219+ * @evt_lock: Lock for manipulating evt_list and evt_free_list
220+ * @rx_evts: Instantiated events (on evt_list and evt_free_list)
221+ * @workwq: Work queue for processing pending PTP operations
222+ * @work: Work task
223+ * @reset_required: A serious error has occurred and the PTP task needs to be
224+ * reset (disable, enable).
225+ * @rxfilter_event: Receive filter when operating
226+ * @rxfilter_general: Receive filter when operating
227+ * @config: Current timestamp configuration
228+ * @enabled: PTP operation enabled
229+ * @mode: Mode in which PTP operating (PTP version)
230+ * @evt_frags: Partly assembled PTP events
231+ * @evt_frag_idx: Current fragment number
232+ * @evt_code: Last event code
233+ * @start: Address at which MC indicates ready for synchronisation
234+ * @host_time_pps: Host time at last PPS
235+ * @last_sync_ns: Last number of nanoseconds between readings when synchronising
236+ * @base_sync_ns: Number of nanoseconds for last synchronisation.
237+ * @base_sync_valid: Whether base_sync_time is valid.
238+ * @current_adjfreq: Current ppb adjustment.
239+ * @phc_clock: Pointer to registered phc device
240+ * @phc_clock_info: Registration structure for phc device
241+ * @pps_work: pps work task for handling pps events
242+ * @pps_workwq: pps work queue
243+ * @nic_ts_enabled: Flag indicating if NIC generated TS events are handled
244+ * @txbuf: Buffer for use when transmitting (PTP) packets to MC (avoids
245+ * allocations in main data path).
246+ * @debug_ptp_dir: PTP debugfs directory
247+ * @missed_rx_sync: Number of packets received without syncrhonisation.
248+ * @good_syncs: Number of successful synchronisations.
249+ * @no_time_syncs: Number of synchronisations with no good times.
250+ * @bad_sync_durations: Number of synchronisations with bad durations.
251+ * @bad_syncs: Number of failed synchronisations.
252+ * @last_sync_time: Number of nanoseconds for last synchronisation.
253+ * @sync_timeouts: Number of synchronisation timeouts
254+ * @fast_syncs: Number of synchronisations requiring short delay
255+ * @min_sync_delta: Minimum time between event and synchronisation
256+ * @max_sync_delta: Maximum time between event and synchronisation
257+ * @average_sync_delta: Average time between event and synchronisation.
258+ * Modified moving average.
259+ * @last_sync_delta: Last time between event and synchronisation
260+ * @mc_stats: Context value for MC statistics
261+ * @timeset: Last set of synchronisation statistics.
262+ */
263+struct efx_ptp_data {
264+ struct efx_channel *channel;
265+ struct sk_buff_head rxq;
266+ struct sk_buff_head txq;
267+ struct list_head evt_list;
268+ struct list_head evt_free_list;
269+ spinlock_t evt_lock;
270+ struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS];
271+ struct workqueue_struct *workwq;
272+ struct work_struct work;
273+ bool reset_required;
274+ u32 rxfilter_event;
275+ u32 rxfilter_general;
276+ bool rxfilter_installed;
277+ struct hwtstamp_config config;
278+ bool enabled;
279+ unsigned int mode;
280+ efx_qword_t evt_frags[MAX_EVENT_FRAGS];
281+ int evt_frag_idx;
282+ int evt_code;
283+ struct efx_buffer start;
284+ struct pps_event_time host_time_pps;
285+ unsigned last_sync_ns;
286+ unsigned base_sync_ns;
287+ bool base_sync_valid;
288+ s64 current_adjfreq;
289+ struct ptp_clock *phc_clock;
290+ struct ptp_clock_info phc_clock_info;
291+ struct work_struct pps_work;
292+ struct workqueue_struct *pps_workwq;
293+ bool nic_ts_enabled;
294+ u8 txbuf[ALIGN(MC_CMD_PTP_IN_TRANSMIT_LEN(
295+ MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM), 4)];
296+ struct efx_ptp_timeset
297+ timeset[MC_CMD_PTP_OUT_SYNCHRONIZE_TIMESET_MAXNUM];
298+};
299+
300+static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta);
301+static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta);
302+static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts);
303+static int efx_phc_settime(struct ptp_clock_info *ptp,
304+ const struct timespec *e_ts);
305+static int efx_phc_enable(struct ptp_clock_info *ptp,
306+ struct ptp_clock_request *request, int on);
307+
308+/* Enable MCDI PTP support. */
309+static int efx_ptp_enable(struct efx_nic *efx)
310+{
311+ u8 inbuf[MC_CMD_PTP_IN_ENABLE_LEN];
312+
313+ MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ENABLE);
314+ MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_QUEUE,
315+ efx->ptp_data->channel->channel);
316+ MCDI_SET_DWORD(inbuf, PTP_IN_ENABLE_MODE, efx->ptp_data->mode);
317+
318+ return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf),
319+ NULL, 0, NULL);
320+}
321+
322+/* Disable MCDI PTP support.
323+ *
324+ * Note that this function should never rely on the presence of ptp_data -
325+ * may be called before that exists.
326+ */
327+static int efx_ptp_disable(struct efx_nic *efx)
328+{
329+ u8 inbuf[MC_CMD_PTP_IN_DISABLE_LEN];
330+
331+ MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_DISABLE);
332+ return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf),
333+ NULL, 0, NULL);
334+}
335+
336+static void efx_ptp_deliver_rx_queue(struct sk_buff_head *q)
337+{
338+ struct sk_buff *skb;
339+
340+ while ((skb = skb_dequeue(q))) {
341+ local_bh_disable();
342+ netif_receive_skb(skb);
343+ local_bh_enable();
344+ }
345+}
346+
347+static void efx_ptp_handle_no_channel(struct efx_nic *efx)
348+{
349+ netif_err(efx, drv, efx->net_dev,
350+ "ERROR: PTP requires MSI-X and 1 additional interrupt"
351+ "vector. PTP disabled\n");
352+}
353+
354+/* Repeatedly send the host time to the MC which will capture the hardware
355+ * time.
356+ */
357+static void efx_ptp_send_times(struct efx_nic *efx,
358+ struct pps_event_time *last_time)
359+{
360+ struct pps_event_time now;
361+ struct timespec limit;
362+ struct efx_ptp_data *ptp = efx->ptp_data;
363+ struct timespec start;
364+ int *mc_running = ptp->start.addr;
365+
366+ pps_get_ts(&now);
367+ start = now.ts_real;
368+ limit = now.ts_real;
369+ timespec_add_ns(&limit, SYNCHRONISE_PERIOD_NS);
370+
371+ /* Write host time for specified period or until MC is done */
372+ while ((timespec_compare(&now.ts_real, &limit) < 0) &&
373+ ACCESS_ONCE(*mc_running)) {
374+ struct timespec update_time;
375+ unsigned int host_time;
376+
377+ /* Don't update continuously to avoid saturating the PCIe bus */
378+ update_time = now.ts_real;
379+ timespec_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS);
380+ do {
381+ pps_get_ts(&now);
382+ } while ((timespec_compare(&now.ts_real, &update_time) < 0) &&
383+ ACCESS_ONCE(*mc_running));
384+
385+ /* Synchronise NIC with single word of time only */
386+ host_time = (now.ts_real.tv_sec << MC_NANOSECOND_BITS |
387+ now.ts_real.tv_nsec);
388+ /* Update host time in NIC memory */
389+ _efx_writed(efx, cpu_to_le32(host_time),
390+ FR_CZ_MC_TREG_SMEM + MC_SMEM_P0_PTP_TIME_OFST);
391+ }
392+ *last_time = now;
393+}
394+
395+/* Read a timeset from the MC's results and partial process. */
396+static void efx_ptp_read_timeset(u8 *data, struct efx_ptp_timeset *timeset)
397+{
398+ unsigned start_ns, end_ns;
399+
400+ timeset->host_start = MCDI_DWORD(data, PTP_OUT_SYNCHRONIZE_HOSTSTART);
401+ timeset->seconds = MCDI_DWORD(data, PTP_OUT_SYNCHRONIZE_SECONDS);
402+ timeset->nanoseconds = MCDI_DWORD(data,
403+ PTP_OUT_SYNCHRONIZE_NANOSECONDS);
404+ timeset->host_end = MCDI_DWORD(data, PTP_OUT_SYNCHRONIZE_HOSTEND),
405+ timeset->waitns = MCDI_DWORD(data, PTP_OUT_SYNCHRONIZE_WAITNS);
406+
407+ /* Ignore seconds */
408+ start_ns = timeset->host_start & MC_NANOSECOND_MASK;
409+ end_ns = timeset->host_end & MC_NANOSECOND_MASK;
410+ /* Allow for rollover */
411+ if (end_ns < start_ns)
412+ end_ns += NSEC_PER_SEC;
413+ /* Determine duration of operation */
414+ timeset->window = end_ns - start_ns;
415+}
416+
417+/* Process times received from MC.
418+ *
419+ * Extract times from returned results, and establish the minimum value
420+ * seen. The minimum value represents the "best" possible time and events
421+ * too much greater than this are rejected - the machine is, perhaps, too
422+ * busy. A number of readings are taken so that, hopefully, at least one good
423+ * synchronisation will be seen in the results.
424+ */
425+static int efx_ptp_process_times(struct efx_nic *efx, u8 *synch_buf,
426+ size_t response_length,
427+ const struct pps_event_time *last_time)
428+{
429+ unsigned number_readings = (response_length /
430+ MC_CMD_PTP_OUT_SYNCHRONIZE_TIMESET_LEN);
431+ unsigned i;
432+ unsigned min;
433+ unsigned min_set = 0;
434+ unsigned total;
435+ unsigned ngood = 0;
436+ unsigned last_good = 0;
437+ struct efx_ptp_data *ptp = efx->ptp_data;
438+ bool min_valid = false;
439+ u32 last_sec;
440+ u32 start_sec;
441+ struct timespec delta;
442+
443+ if (number_readings == 0)
444+ return -EAGAIN;
445+
446+ /* Find minimum value in this set of results, discarding clearly
447+ * erroneous results.
448+ */
449+ for (i = 0; i < number_readings; i++) {

1035 more lines aren’t shown here.

drivers/net/ethernet/sfc/rx.c+16−4

This diff is large: its 54 lines aren’t shown here.

drivers/net/ethernet/sfc/selftest.c+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/net/ethernet/sfc/siena.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/ethernet/sfc/siena_sriov.c+8−0

This diff is large: its 36 lines aren’t shown here.

drivers/net/ethernet/sfc/tx.c+251−376

This diff is large: its 1083 lines aren’t shown here.

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c+6−5

This diff is large: its 34 lines aren’t shown here.

drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+8−31

This diff is large: its 107 lines aren’t shown here.

drivers/net/ethernet/sun/sunbmac.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/net/ethernet/ti/Kconfig+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/ethernet/ti/cpsw.c+173−6

This diff is large: its 232 lines aren’t shown here.

drivers/net/ethernet/ti/davinci_mdio.c+37−4

This diff is large: its 87 lines aren’t shown here.

drivers/net/ethernet/tundra/tsi108_eth.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/net/ethernet/wiznet/w5100.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/net/ethernet/wiznet/w5300.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/net/hyperv/hyperv_net.h+2−2

This diff is large: its 25 lines aren’t shown here.

drivers/net/hyperv/netvsc.c+13−9

This diff is large: its 92 lines aren’t shown here.

drivers/net/hyperv/netvsc_drv.c+3−1

This diff is large: its 25 lines aren’t shown here.

drivers/net/hyperv/rndis_filter.c+45−15

This diff is large: its 133 lines aren’t shown here.

drivers/net/ieee802154/Kconfigrenamed from drivers/ieee802154/Kconfig+11−0

This diff is large: its 15 lines aren’t shown here.

drivers/net/ieee802154/Makefilerenamed from drivers/ieee802154/Makefile+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/net/ieee802154/at86rf230.crenamed from drivers/ieee802154/at86rf230.c+1−11

This diff is large: its 19 lines aren’t shown here.

drivers/net/ieee802154/fakehard.crenamed from drivers/ieee802154/fakehard.c+0−1

This diff is large: its 5 lines aren’t shown here.

drivers/net/ieee802154/fakelb.crenamed from drivers/ieee802154/fakelb.c+0−0

File renamed without changes.

drivers/net/ieee802154/mrf24j40.c+767−0

This diff is large: its 768 lines aren’t shown here.

drivers/net/loopback.c+2−1

This diff is large: its 17 lines aren’t shown here.

drivers/net/macvlan.c+3−3

This diff is large: its 21 lines aren’t shown here.

drivers/net/phy/Kconfig+13−0

This diff is large: its 20 lines aren’t shown here.

drivers/net/phy/Makefile+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/net/phy/dp83640.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/phy/lxt.c+127−0

This diff is large: its 141 lines aren’t shown here.

drivers/net/phy/mdio-gpio.c+40−92

This diff is large: its 190 lines aren’t shown here.

drivers/net/phy/mdio-mux-mmioreg.c+171−0

This diff is large: its 172 lines aren’t shown here.

drivers/net/phy/phy.c+7−67

This diff is large: its 121 lines aren’t shown here.

drivers/net/ppp/ppp_generic.c+48−10

This diff is large: its 103 lines aren’t shown here.

drivers/net/team/Kconfig+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/team/team.c+295−47

This diff is large: its 637 lines aren’t shown here.

drivers/net/team/team_mode_broadcast.c+4−4

This diff is large: its 23 lines aren’t shown here.

drivers/net/team/team_mode_roundrobin.c+4−4

This diff is large: its 23 lines aren’t shown here.

drivers/net/usb/asix_devices.c+24−16

This diff is large: its 149 lines aren’t shown here.

drivers/net/usb/catc.c+32−23

This diff is large: its 191 lines aren’t shown here.

drivers/net/usb/cx82310_eth.c+1−10

This diff is large: its 20 lines aren’t shown here.

drivers/net/usb/gl620a.c+7−3

This diff is large: its 31 lines aren’t shown here.

drivers/net/usb/kaweth.c+67−67

This diff is large: its 397 lines aren’t shown here.

drivers/net/usb/net1080.c+23−28

This diff is large: its 142 lines aren’t shown here.

drivers/net/usb/qmi_wwan.c+17−30

This diff is large: its 111 lines aren’t shown here.

drivers/net/usb/rtl8150.c+3−3

This diff is large: its 24 lines aren’t shown here.

drivers/net/usb/sierra_net.c+8−17

This diff is large: its 82 lines aren’t shown here.

drivers/net/usb/smsc75xx.c+237−3

This diff is large: its 303 lines aren’t shown here.

drivers/net/usb/smsc95xx.c+355−205

This diff is large: its 941 lines aren’t shown here.

drivers/net/usb/smsc95xx.h+11−1

This diff is large: its 38 lines aren’t shown here.

drivers/net/veth.c+3−0

This diff is large: its 10 lines aren’t shown here.

drivers/net/virtio_net.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/vxlan.c+1219−0

This diff is large: its 1220 lines aren’t shown here.

drivers/net/wimax/i2400m/driver.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/net/wireless/adm8211.c+3−1

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/airo.c+2−5

This diff is large: its 24 lines aren’t shown here.

drivers/net/wireless/at76c50x-usb.c+15−43

This diff is large: its 126 lines aren’t shown here.

drivers/net/wireless/ath/ath.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/ath/ath5k/ath5k.h+1−1

This diff is large: its 16 lines aren’t shown here.

drivers/net/wireless/ath/ath5k/base.c+4−2

This diff is large: its 27 lines aren’t shown here.

drivers/net/wireless/ath/ath5k/mac80211-ops.c+8−4

This diff is large: its 40 lines aren’t shown here.

drivers/net/wireless/ath/ath5k/phy.c+34−11

This diff is large: its 94 lines aren’t shown here.

drivers/net/wireless/ath/ath6kl/cfg80211.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/wireless/ath/ath6kl/cfg80211.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ani.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/antenna.c+69−48

This diff is large: its 248 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_eeprom.c+175−113

This diff is large: its 428 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_eeprom.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_hw.c+52−5

This diff is large: its 127 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_mac.c+19−2

This diff is large: its 49 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_mci.c+26−17

This diff is large: its 130 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_mci.h+7−7

This diff is large: its 49 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_phy.c+156−41

This diff is large: its 335 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9003_phy.h+68−27

This diff is large: its 177 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h+1231−0

This diff is large: its 1232 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/ath9k.h+8−4

This diff is large: its 61 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/btcoex.c+34−31

This diff is large: its 124 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/btcoex.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/debug.c+56−2

This diff is large: its 90 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/debug.h+3−1

This diff is large: its 25 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/eeprom.h+2−1

This diff is large: its 17 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/gpio.c+45−27

This diff is large: its 130 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/hif_usb.c+25−13

This diff is large: its 111 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/hif_usb.h+3−1

This diff is large: its 16 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/htc.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/htc_drv_beacon.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/htc_drv_gpio.c+11−2

This diff is large: its 37 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/htc_drv_init.c+5−0

This diff is large: its 19 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/htc_drv_main.c+39−12

This diff is large: its 102 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/htc_drv_txrx.c+1−1

This diff is large: its 14 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/hw-ops.h+7−0

This diff is large: its 14 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/hw.c+40−17

This diff is large: its 198 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/hw.h+3−1

This diff is large: its 25 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/init.c+14−1

This diff is large: its 43 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/main.c+16−50

This diff is large: its 151 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/mci.c+64−30

This diff is large: its 219 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/pci.c+3−1

This diff is large: its 18 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/rc.c+347−472

This diff is large: its 1342 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/rc.h+0−4

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/recv.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/reg.h+9−0

This diff is large: its 23 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/wow.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ath/ath9k/xmit.c+10−5

This diff is large: its 57 lines aren’t shown here.

drivers/net/wireless/ath/carl9170/carl9170.h+4−1

This diff is large: its 19 lines aren’t shown here.

drivers/net/wireless/ath/carl9170/fw.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/ath/carl9170/mac.c+3−2

This diff is large: its 22 lines aren’t shown here.

drivers/net/wireless/ath/carl9170/main.c+5−1

This diff is large: its 30 lines aren’t shown here.

drivers/net/wireless/ath/carl9170/rx.c+12−4

This diff is large: its 72 lines aren’t shown here.

drivers/net/wireless/ath/carl9170/tx.c+8−8

This diff is large: its 53 lines aren’t shown here.

drivers/net/wireless/b43/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/b43/b43.h+7−3

This diff is large: its 31 lines aren’t shown here.

drivers/net/wireless/b43/main.c+42−12

This diff is large: its 93 lines aren’t shown here.

drivers/net/wireless/b43/phy_common.c+16−1

This diff is large: its 31 lines aren’t shown here.

drivers/net/wireless/b43/phy_common.h+6−0

This diff is large: its 13 lines aren’t shown here.

drivers/net/wireless/b43/phy_n.c+629−39

This diff is large: its 861 lines aren’t shown here.

drivers/net/wireless/b43/phy_n.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/b43/radio_2057.c+141−0

This diff is large: its 142 lines aren’t shown here.

drivers/net/wireless/b43/radio_2057.h+430−0

This diff is large: its 431 lines aren’t shown here.

drivers/net/wireless/b43/tables_nphy.c+75−0

This diff is large: its 86 lines aren’t shown here.

drivers/net/wireless/b43/tables_nphy.h+10−0

This diff is large: its 23 lines aren’t shown here.

drivers/net/wireless/b43legacy/main.c+4−1

This diff is large: its 26 lines aren’t shown here.

drivers/net/wireless/brcm80211/Kconfig+8−0

This diff is large: its 15 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c+33−6

This diff is large: its 134 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c+2−25

This diff is large: its 125 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/dhd.h+57−5

This diff is large: its 130 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c+61−12

This diff is large: its 112 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h+2−0

This diff is large: its 16 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c+34−31

This diff is large: its 100 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c+403−644

This diff is large: its 1530 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c+17−0

This diff is large: its 24 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h+2−0

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/usb.c+164−189

This diff is large: its 757 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c+2551−874

This diff is large: its 4927 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h+222−74

This diff is large: its 374 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmsmac/aiutils.c+0−3

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c+11−4

This diff is large: its 43 lines aren’t shown here.

drivers/net/wireless/brcm80211/brcmsmac/main.c+4−9

This diff is large: its 20 lines aren’t shown here.

drivers/net/wireless/brcm80211/include/brcm_hw_ids.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/brcm80211/include/brcmu_wifi.h+0−5

This diff is large: its 12 lines aren’t shown here.

drivers/net/wireless/hostap/hostap_info.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/wireless/hostap/hostap_ioctl.c+5−10

This diff is large: its 50 lines aren’t shown here.

drivers/net/wireless/hostap/hostap_main.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ipw2x00/ipw2100.c+2−9

This diff is large: its 25 lines aren’t shown here.

drivers/net/wireless/ipw2x00/ipw2200.c+2−9

This diff is large: its 21 lines aren’t shown here.

drivers/net/wireless/ipw2x00/libipw_wx.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/iwlegacy/3945-mac.c+8−4

This diff is large: its 40 lines aren’t shown here.

drivers/net/wireless/iwlegacy/4965-mac.c+15−11

This diff is large: its 78 lines aren’t shown here.

drivers/net/wireless/iwlegacy/4965.h+6−2

This diff is large: its 22 lines aren’t shown here.

drivers/net/wireless/iwlegacy/common.c+5−14

This diff is large: its 50 lines aren’t shown here.

drivers/net/wireless/iwlegacy/common.h+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/agn.h+6−7

This diff is large: its 31 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/commands.h+2−1

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/debugfs.c+28−28

This diff is large: its 79 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/dev.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/mac80211.c+5−3

This diff is large: its 28 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/main.c+16−8

This diff is large: its 63 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/rx.c+11−0

This diff is large: its 25 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/scan.c+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/sta.c+5−4

This diff is large: its 24 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/tx.c+10−8

This diff is large: its 67 lines aren’t shown here.

drivers/net/wireless/iwlwifi/dvm/ucode.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-devtrace.h+21−13

This diff is large: its 56 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-drv.c+133−34

This diff is large: its 297 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-drv.h+3−3

This diff is large: its 13 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-fw.h+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-op-mode.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/iwlwifi/iwl-trans.h+10−2

This diff is large: its 32 lines aren’t shown here.

drivers/net/wireless/iwlwifi/pcie/drv.c+6−13

This diff is large: its 49 lines aren’t shown here.

drivers/net/wireless/iwlwifi/pcie/internal.h+2−1

This diff is large: its 17 lines aren’t shown here.

drivers/net/wireless/iwlwifi/pcie/rx.c+57−34

This diff is large: its 207 lines aren’t shown here.

drivers/net/wireless/iwlwifi/pcie/trans.c+71−41

This diff is large: its 232 lines aren’t shown here.

drivers/net/wireless/iwlwifi/pcie/tx.c+23−28

This diff is large: its 90 lines aren’t shown here.

drivers/net/wireless/libertas/cmd.c+16−0

This diff is large: its 23 lines aren’t shown here.

drivers/net/wireless/libertas/cmd.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/libertas/main.c+3−1

This diff is large: its 12 lines aren’t shown here.

drivers/net/wireless/libertas_tf/main.c+3−1

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/mac80211_hwsim.c+30−29

This diff is large: its 187 lines aren’t shown here.

drivers/net/wireless/mwifiex/11n.c+26−38

This diff is large: its 82 lines aren’t shown here.

drivers/net/wireless/mwifiex/11n.h+15−5

This diff is large: its 45 lines aren’t shown here.

drivers/net/wireless/mwifiex/11n_aggr.c+5−9

This diff is large: its 28 lines aren’t shown here.

drivers/net/wireless/mwifiex/11n_rxreorder.c+97−18

This diff is large: its 192 lines aren’t shown here.

drivers/net/wireless/mwifiex/11n_rxreorder.h+10−0

This diff is large: its 23 lines aren’t shown here.

drivers/net/wireless/mwifiex/Makefile+2−0

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/mwifiex/cfg80211.c+432−28

This diff is large: its 711 lines aren’t shown here.

drivers/net/wireless/mwifiex/cmdevt.c+6−1

This diff is large: its 21 lines aren’t shown here.

drivers/net/wireless/mwifiex/decl.h+8−1

This diff is large: its 31 lines aren’t shown here.

drivers/net/wireless/mwifiex/fw.h+88−5

This diff is large: its 220 lines aren’t shown here.

drivers/net/wireless/mwifiex/ie.c+55−33

This diff is large: its 125 lines aren’t shown here.

drivers/net/wireless/mwifiex/init.c+80−46

This diff is large: its 191 lines aren’t shown here.

drivers/net/wireless/mwifiex/ioctl.h+11−3

This diff is large: its 42 lines aren’t shown here.

drivers/net/wireless/mwifiex/main.c+29−10

This diff is large: its 67 lines aren’t shown here.

drivers/net/wireless/mwifiex/main.h+79−8

This diff is large: its 234 lines aren’t shown here.

drivers/net/wireless/mwifiex/scan.c+7−8

This diff is large: its 51 lines aren’t shown here.

drivers/net/wireless/mwifiex/sta_cmd.c+105−45

This diff is large: its 284 lines aren’t shown here.

drivers/net/wireless/mwifiex/sta_cmdresp.c+55−22

This diff is large: its 161 lines aren’t shown here.

drivers/net/wireless/mwifiex/sta_event.c+23−51

This diff is large: its 109 lines aren’t shown here.

drivers/net/wireless/mwifiex/sta_ioctl.c+121−3

This diff is large: its 177 lines aren’t shown here.

drivers/net/wireless/mwifiex/sta_rx.c+24−20

This diff is large: its 98 lines aren’t shown here.

drivers/net/wireless/mwifiex/sta_tx.c+11−1

This diff is large: its 33 lines aren’t shown here.

drivers/net/wireless/mwifiex/txrx.c+10−1

This diff is large: its 32 lines aren’t shown here.

drivers/net/wireless/mwifiex/uap_cmd.c+61−1

This diff is large: its 99 lines aren’t shown here.

drivers/net/wireless/mwifiex/uap_event.c+290−0

This diff is large: its 291 lines aren’t shown here.

drivers/net/wireless/mwifiex/uap_txrx.c+340−0

This diff is large: its 341 lines aren’t shown here.

drivers/net/wireless/mwifiex/util.c+40−0

This diff is large: its 47 lines aren’t shown here.

drivers/net/wireless/mwifiex/wmm.c+63−14

This diff is large: its 175 lines aren’t shown here.

drivers/net/wireless/mwl8k.c+10−7

This diff is large: its 56 lines aren’t shown here.

drivers/net/wireless/orinoco/wext.c+3−4

This diff is large: its 26 lines aren’t shown here.

drivers/net/wireless/p54/eeprom.c+84−24

This diff is large: its 180 lines aren’t shown here.

drivers/net/wireless/p54/eeprom.h+12−0

This diff is large: its 19 lines aren’t shown here.

drivers/net/wireless/p54/lmac.h+3−1

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/p54/main.c+14−1

This diff is large: its 43 lines aren’t shown here.

drivers/net/wireless/p54/p54pci.c+62−26

This diff is large: its 132 lines aren’t shown here.

drivers/net/wireless/p54/p54pci.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/p54/txrx.c+9−6

This diff is large: its 43 lines aren’t shown here.

drivers/net/wireless/rndis_wlan.c+0−3

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2400pci.c+2−3

This diff is large: its 26 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2400pci.h+18−9

This diff is large: its 36 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2500pci.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2500pci.h+10−8

This diff is large: its 27 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2500usb.c+2−3

This diff is large: its 26 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2500usb.h+18−9

This diff is large: its 36 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2800.h+32−20

This diff is large: its 66 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2800lib.c+326−71

This diff is large: its 705 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2800lib.h+19−3

This diff is large: its 43 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2800pci.c+9−74

This diff is large: its 125 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2800usb.c+11−51

This diff is large: its 107 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2x00.h+18−2

This diff is large: its 55 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2x00dev.c+34−1

This diff is large: its 56 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2x00mac.c+3−41

This diff is large: its 58 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt2x00queue.c+11−9

This diff is large: its 71 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt61pci.c+6−7

This diff is large: its 42 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt61pci.h+14−14

This diff is large: its 37 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt73usb.c+2−3

This diff is large: its 26 lines aren’t shown here.

drivers/net/wireless/rt2x00/rt73usb.h+18−16

This diff is large: its 43 lines aren’t shown here.

drivers/net/wireless/rtl818x/rtl8180/dev.c+4−2

This diff is large: its 20 lines aren’t shown here.

drivers/net/wireless/rtl818x/rtl8187/dev.c+4−2

This diff is large: its 20 lines aren’t shown here.

drivers/net/wireless/rtlwifi/Kconfig+4−4

This diff is large: its 35 lines aren’t shown here.

drivers/net/wireless/rtlwifi/base.c+1−2

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/rtlwifi/core.c+5−3

This diff is large: its 22 lines aren’t shown here.

drivers/net/wireless/rtlwifi/pci.c+8−8

This diff is large: its 58 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c+18−23

This diff is large: its 110 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192ce/hw.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192ce/sw.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192ce/trx.c+3−2

This diff is large: its 19 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192ce/trx.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192cu/trx.c+4−3

This diff is large: its 25 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192cu/trx.h+3−1

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192de/dm.c+5−5

This diff is large: its 39 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192de/fw.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192de/phy.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192de/trx.c+3−2

This diff is large: its 19 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192de/trx.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192se/trx.c+6−5

This diff is large: its 45 lines aren’t shown here.

drivers/net/wireless/rtlwifi/rtl8192se/trx.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/net/wireless/rtlwifi/usb.c+11−6

This diff is large: its 59 lines aren’t shown here.

drivers/net/wireless/rtlwifi/wifi.h+108−13

This diff is large: its 331 lines aren’t shown here.

drivers/net/wireless/ti/wl1251/main.c+3−1

This diff is large: its 11 lines aren’t shown here.

drivers/net/wireless/ti/wl12xx/main.c+48−31

This diff is large: its 127 lines aren’t shown here.

drivers/net/wireless/ti/wl12xx/wl12xx.h+7−0

This diff is large: its 14 lines aren’t shown here.

drivers/net/wireless/ti/wl18xx/debugfs.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ti/wl18xx/main.c+60−69

This diff is large: its 265 lines aren’t shown here.

drivers/net/wireless/ti/wl18xx/wl18xx.h+7−0

This diff is large: its 14 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/cmd.c+19−2

This diff is large: its 59 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/cmd.h+0−5

This diff is large: its 12 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/conf.h+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/debug.h+13−3

This diff is large: its 33 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/debugfs.c+20−12

This diff is large: its 93 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/init.c+2−10

This diff is large: its 26 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/io.h+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/main.c+215−157

This diff is large: its 931 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/ps.c+3−7

This diff is large: its 31 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/rx.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/scan.c+8−12

This diff is large: its 76 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/spi.c+8−2

This diff is large: its 24 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/testmode.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/tx.c+67−45

This diff is large: its 300 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/tx.h+1−3

This diff is large: its 12 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/wlcore.h+20−3

This diff is large: its 88 lines aren’t shown here.

drivers/net/wireless/ti/wlcore/wlcore_i.h+8−5

This diff is large: its 41 lines aren’t shown here.

drivers/net/wireless/wl3501_cs.c+1−2

This diff is large: its 15 lines aren’t shown here.

drivers/net/wireless/zd1211rw/zd_mac.c+6−3

This diff is large: its 30 lines aren’t shown here.

drivers/net/xen-netfront.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/nfc/Kconfig+1−13

This diff is large: its 23 lines aren’t shown here.

drivers/nfc/Makefile+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/nfc/nfcwilink.c+3−17

This diff is large: its 41 lines aren’t shown here.

drivers/nfc/pn533.c+87−20

This diff is large: its 214 lines aren’t shown here.

drivers/nfc/pn544.c+0−893

This diff is large: its 894 lines aren’t shown here.

drivers/nfc/pn544_hci.c+120−57

This diff is large: its 356 lines aren’t shown here.

drivers/ptp/ptp_clock.c+12−4

This diff is large: its 46 lines aren’t shown here.

drivers/ptp/ptp_ixp46x.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/ptp/ptp_pch.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/ptp/ptp_private.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/s390/net/ctcm_fsms.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/s390/net/ctcm_main.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/s390/net/lcs.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/s390/net/qeth_core_main.c+43−35

This diff is large: its 122 lines aren’t shown here.

drivers/s390/net/qeth_l3_main.c+2−0

This diff is large: its 16 lines aren’t shown here.

drivers/scsi/scsi_netlink.c+16−541

This diff is large: its 618 lines aren’t shown here.

drivers/scsi/scsi_transport_iscsi.c+3−4

This diff is large: its 28 lines aren’t shown here.

drivers/ssb/driver_mipscore.c+21−7

This diff is large: its 38 lines aren’t shown here.

drivers/staging/gdm72xx/netlink_k.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/winbond/wbusb.c+3−1

This diff is large: its 11 lines aren’t shown here.

firmware/Makefile+0−1

This diff is large: its 8 lines aren’t shown here.

firmware/cxgb3/t3fw-7.10.0.bin.ihex+0−1935

This diff is large: its 1936 lines aren’t shown here.

fs/dlm/netlink.c+4−4

This diff is large: its 26 lines aren’t shown here.

include/linux/Kbuild+2−0

This diff is large: its 16 lines aren’t shown here.

include/linux/bcma/bcma_driver_chipcommon.h+111−0

This diff is large: its 153 lines aren’t shown here.

include/linux/bcma/bcma_regs.h+4−0

This diff is large: its 21 lines aren’t shown here.

include/linux/etherdevice.h+11−0

This diff is large: its 18 lines aren’t shown here.

include/linux/ethtool.h+11−6

This diff is large: its 31 lines aren’t shown here.

include/linux/filter.h+7−0

This diff is large: its 25 lines aren’t shown here.

include/linux/hash.h+10−0

This diff is large: its 15 lines aren’t shown here.

include/linux/ieee80211.h+0−80

This diff is large: its 94 lines aren’t shown here.

include/linux/if_arp.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/if_link.h+34−0

This diff is large: its 46 lines aren’t shown here.

include/linux/if_team.h+9−2

This diff is large: its 53 lines aren’t shown here.

include/linux/if_tunnel.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/if_vlan.h+7−2

This diff is large: its 30 lines aren’t shown here.

include/linux/inetdevice.h+9−2

This diff is large: its 26 lines aren’t shown here.

include/linux/ip6_tunnel.h+17−0

This diff is large: its 22 lines aren’t shown here.

include/linux/ipv6.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/jiffies.h+6−0

This diff is large: its 14 lines aren’t shown here.

include/linux/mdio.h+83−0

This diff is large: its 89 lines aren’t shown here.

include/linux/netdevice.h+27−24

This diff is large: its 149 lines aren’t shown here.

include/linux/netfilter.h+6−8

This diff is large: its 28 lines aren’t shown here.

include/linux/netfilter/ipset/ip_set.h+13−2

This diff is large: its 60 lines aren’t shown here.

include/linux/netfilter/ipset/ip_set_ahash.h+56−50

This diff is large: its 258 lines aren’t shown here.

include/linux/netfilter/nf_conntrack_amanda.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/netfilter/nf_conntrack_ftp.h+6−1

This diff is large: its 27 lines aren’t shown here.

include/linux/netfilter/nf_conntrack_h323.h+10−5

This diff is large: its 64 lines aren’t shown here.

include/linux/netfilter/nf_conntrack_irc.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/netfilter/nf_conntrack_pptp.h+2−0

This diff is large: its 15 lines aren’t shown here.

include/linux/netfilter/nf_conntrack_sip.h+14−7

This diff is large: its 72 lines aren’t shown here.

include/linux/netfilter/nf_nat.h+8−0

This diff is large: its 13 lines aren’t shown here.

include/linux/netfilter/nfnetlink_conntrack.h+6−2

This diff is large: its 16 lines aren’t shown here.

include/linux/netfilter/nfnetlink_queue.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/netfilter/xt_time.h+5−0

This diff is large: its 17 lines aren’t shown here.

include/linux/netfilter_ipv4.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/linux/netfilter_ipv6/Kbuild+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/netfilter_ipv6/ip6t_NPT.h+16−0

This diff is large: its 17 lines aren’t shown here.

include/linux/netlink.h+23−16

This diff is large: its 97 lines aren’t shown here.

include/linux/nfc.h+11−0

This diff is large: its 16 lines aren’t shown here.

include/linux/nl80211.h+50−4

This diff is large: its 110 lines aren’t shown here.

include/linux/of_mdio.h+33−0

This diff is large: its 45 lines aren’t shown here.

include/linux/packet_diag.h+72−0

This diff is large: its 73 lines aren’t shown here.

include/linux/pps_kernel.h+9−0

This diff is large: its 15 lines aren’t shown here.

include/linux/ptp_clock_kernel.h+16−5

This diff is large: its 63 lines aren’t shown here.

include/linux/rfkill.h+31−0

This diff is large: its 38 lines aren’t shown here.

include/linux/sched.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/skbuff.h+6−3

This diff is large: its 20 lines aren’t shown here.

include/linux/snmp.h+11−5

This diff is large: its 45 lines aren’t shown here.

include/linux/ssb/ssb_driver_chipcommon.h+3−1

This diff is large: its 11 lines aren’t shown here.

include/linux/stmmac.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/linux/tcp.h+46−3

This diff is large: its 92 lines aren’t shown here.

include/linux/tcp_metrics.h+54−0

This diff is large: its 55 lines aren’t shown here.

include/linux/tipc_config.h+4−4

This diff is large: its 22 lines aren’t shown here.

include/net/addrconf.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/net/arp.h+2−1

This diff is large: its 17 lines aren’t shown here.

include/net/bluetooth/bluetooth.h+10−0

This diff is large: its 31 lines aren’t shown here.

include/net/bluetooth/hci.h+32−0

This diff is large: its 62 lines aren’t shown here.

include/net/bluetooth/hci_core.h+20−28

This diff is large: its 144 lines aren’t shown here.

include/net/bluetooth/l2cap.h+3−17

This diff is large: its 44 lines aren’t shown here.

include/net/bluetooth/mgmt.h+16−0

This diff is large: its 28 lines aren’t shown here.

include/net/bluetooth/smp.h+4−4

This diff is large: its 22 lines aren’t shown here.

include/net/cfg80211.h+61−7

This diff is large: its 152 lines aren’t shown here.

include/net/checksum.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/net/dst.h+7−3

This diff is large: its 19 lines aren’t shown here.

include/net/genetlink.h+17−17

This diff is large: its 110 lines aren’t shown here.

include/net/gro_cells.h+103−0

This diff is large: its 104 lines aren’t shown here.

include/net/ieee80211_radiotap.h+11−0

This diff is large: its 32 lines aren’t shown here.

include/net/inet_ecn.h+76−0

This diff is large: its 88 lines aren’t shown here.

include/net/inet_frag.h+3−1

This diff is large: its 18 lines aren’t shown here.

include/net/inet_sock.h+1−3

This diff is large: its 12 lines aren’t shown here.

include/net/ip.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/net/ip6_fib.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/net/ip6_tunnel.h+39−2

This diff is large: its 67 lines aren’t shown here.

include/net/ip_vs.h+13−3

This diff is large: its 51 lines aren’t shown here.

include/net/ipip.h+3−0

This diff is large: its 17 lines aren’t shown here.

include/net/ipv6.h+31−2

This diff is large: its 54 lines aren’t shown here.

include/net/llc.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/net/mac80211.h+78−21

This diff is large: its 233 lines aren’t shown here.

include/net/ndisc.h+2−1

This diff is large: its 17 lines aren’t shown here.

include/net/neighbour.h+9−5

This diff is large: its 28 lines aren’t shown here.

include/net/net_namespace.h+15−0

This diff is large: its 50 lines aren’t shown here.

include/net/netfilter/nf_conntrack_ecache.h+16−16

This diff is large: its 119 lines aren’t shown here.

include/net/netfilter/nf_conntrack_expect.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/net/netfilter/nf_conntrack_timeout.h+20−0

This diff is large: its 27 lines aren’t shown here.

include/net/netfilter/nf_nat.h+4−2

This diff is large: its 19 lines aren’t shown here.

include/net/netfilter/nf_nat_core.h+1−4

This diff is large: its 12 lines aren’t shown here.

include/net/netfilter/nf_nat_helper.h+8−3

This diff is large: its 46 lines aren’t shown here.

include/net/netfilter/nf_nat_l3proto.h+52−0

This diff is large: its 53 lines aren’t shown here.

include/net/netfilter/nf_nat_l4proto.h+72−0

This diff is large: its 73 lines aren’t shown here.

include/net/netfilter/nf_nat_protocol.h+0−67

This diff is large: its 68 lines aren’t shown here.

include/net/netfilter/nf_nat_rule.h+0−15

This diff is large: its 16 lines aren’t shown here.

include/net/netlink.h+111−13

This diff is large: its 236 lines aren’t shown here.

include/net/netns/conntrack.h+4−0

This diff is large: its 11 lines aren’t shown here.

include/net/netns/ipv4.h+0−2

This diff is large: its 9 lines aren’t shown here.

include/net/netns/ipv6.h+9−0

This diff is large: its 21 lines aren’t shown here.

include/net/netns/packet.h+2−2

This diff is large: its 13 lines aren’t shown here.

include/net/netns/sctp.h+131−0

This diff is large: its 132 lines aren’t shown here.

include/net/nfc/hci.h+17−4

This diff is large: its 75 lines aren’t shown here.

include/net/nfc/llc.h+54−0

This diff is large: its 55 lines aren’t shown here.

include/net/nfc/nci.h+29−0

This diff is large: its 71 lines aren’t shown here.

include/net/nfc/nci_core.h+5−0

This diff is large: its 19 lines aren’t shown here.

include/net/nfc/nfc.h+2−2

This diff is large: its 25 lines aren’t shown here.

include/net/nfc/shdlc.h+0−107

This diff is large: its 108 lines aren’t shown here.

include/net/request_sock.h+36−13

This diff is large: its 77 lines aren’t shown here.

include/net/scm.h+20−5

This diff is large: its 60 lines aren’t shown here.

include/net/sctp/sctp.h+35−34

This diff is large: its 153 lines aren’t shown here.

include/net/sctp/sm.h+5−3

This diff is large: its 29 lines aren’t shown here.

include/net/sctp/structs.h+10−144

This diff is large: its 225 lines aren’t shown here.

include/net/snmp.h+6−4

This diff is large: its 20 lines aren’t shown here.

include/net/sock.h+15−14

This diff is large: its 62 lines aren’t shown here.

include/net/tcp.h+75−15

This diff is large: its 185 lines aren’t shown here.

include/net/xfrm.h+4−4

This diff is large: its 36 lines aren’t shown here.

include/scsi/scsi_netlink.h+0−24

This diff is large: its 30 lines aren’t shown here.

kernel/audit.c+12−13

This diff is large: its 97 lines aren’t shown here.

kernel/exit.c+3−0

This diff is large: its 10 lines aren’t shown here.

kernel/fork.c+1−0

This diff is large: its 8 lines aren’t shown here.

kernel/taskstats.c+2−2

This diff is large: its 18 lines aren’t shown here.

lib/kobject_uevent.c+2−3

This diff is large: its 25 lines aren’t shown here.

lib/nlattr.c+4−0

This diff is large: its 11 lines aren’t shown here.

net/8021q/vlan_core.c+6−0

This diff is large: its 10 lines aren’t shown here.

net/Kconfig+2−0

This diff is large: its 9 lines aren’t shown here.

net/atm/resources.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/batman-adv/bat_iv_ogm.c+52−34

This diff is large: its 219 lines aren’t shown here.

net/batman-adv/bridge_loop_avoidance.c+142−72

This diff is large: its 545 lines aren’t shown here.

net/batman-adv/bridge_loop_avoidance.h+9−2

This diff is large: its 32 lines aren’t shown here.

net/batman-adv/debugfs.c+12−0

This diff is large: its 33 lines aren’t shown here.

net/batman-adv/gateway_client.c+29−24

This diff is large: its 164 lines aren’t shown here.

net/batman-adv/hard-interface.c+10−3

This diff is large: its 32 lines aren’t shown here.

net/batman-adv/main.c+12−15

This diff is large: its 51 lines aren’t shown here.

net/batman-adv/main.h+15−14

This diff is large: its 68 lines aren’t shown here.

net/batman-adv/packet.h+18−17

This diff is large: its 65 lines aren’t shown here.

net/batman-adv/routing.c+37−48

This diff is large: its 153 lines aren’t shown here.

net/batman-adv/send.c+4−4

This diff is large: its 30 lines aren’t shown here.

net/batman-adv/soft-interface.c+51−28

This diff is large: its 176 lines aren’t shown here.

net/batman-adv/soft-interface.h+3−2

This diff is large: its 12 lines aren’t shown here.

net/batman-adv/translation-table.c+256−160

This diff is large: its 993 lines aren’t shown here.

net/batman-adv/translation-table.h+3−1

This diff is large: its 10 lines aren’t shown here.

net/batman-adv/types.h+74−46

This diff is large: its 167 lines aren’t shown here.

net/batman-adv/unicast.c+9−7

This diff is large: its 58 lines aren’t shown here.

net/batman-adv/vis.c+73−71

This diff is large: its 385 lines aren’t shown here.

net/batman-adv/vis.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/bluetooth/a2mp.c+10−6

This diff is large: its 52 lines aren’t shown here.

net/bluetooth/af_bluetooth.c+139−0

This diff is large: its 153 lines aren’t shown here.

net/bluetooth/bnep/sock.c+20−2

This diff is large: its 61 lines aren’t shown here.

net/bluetooth/cmtp/sock.c+21−2

This diff is large: its 62 lines aren’t shown here.

net/bluetooth/hci_conn.c+62−38

This diff is large: its 193 lines aren’t shown here.

net/bluetooth/hci_core.c+8−4

This diff is large: its 54 lines aren’t shown here.

net/bluetooth/hci_event.c+130−60

This diff is large: its 334 lines aren’t shown here.

net/bluetooth/hci_sock.c+11−2

This diff is large: its 33 lines aren’t shown here.

net/bluetooth/hidp/sock.c+21−1

This diff is large: its 58 lines aren’t shown here.

net/bluetooth/l2cap_core.c+29−8

This diff is large: its 95 lines aren’t shown here.

net/bluetooth/l2cap_sock.c+19−3

This diff is large: its 70 lines aren’t shown here.

net/bluetooth/mgmt.c+48−14

This diff is large: its 182 lines aren’t shown here.

net/bluetooth/rfcomm/sock.c+12−2

This diff is large: its 35 lines aren’t shown here.

net/bluetooth/sco.c+11−5

This diff is large: its 50 lines aren’t shown here.

net/bridge/br_fdb.c+9−8

This diff is large: its 65 lines aren’t shown here.

net/bridge/br_netlink.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/bridge/br_private.h+3−3

This diff is large: its 14 lines aren’t shown here.

net/bridge/br_stp_timer.c+1−1

This diff is large: its 7 lines aren’t shown here.

net/bridge/netfilter/ebt_ulog.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/bridge/netfilter/ebtable_filter.c+1−3

This diff is large: its 11 lines aren’t shown here.

net/bridge/netfilter/ebtable_nat.c+1−3

This diff is large: its 11 lines aren’t shown here.

net/can/gw.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/dev.c+74−35

This diff is large: its 291 lines aren’t shown here.

net/core/dev_addr_lists.c+21−19

This diff is large: its 155 lines aren’t shown here.

net/core/dst.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/ethtool.c+0−12

This diff is large: its 19 lines aren’t shown here.

net/core/fib_rules.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/core/filter.c+24−3

This diff is large: its 66 lines aren’t shown here.

net/core/link_watch.c+8−0

This diff is large: its 15 lines aren’t shown here.

net/core/neighbour.c+4−4

This diff is large: its 36 lines aren’t shown here.

net/core/net-sysfs.c+15−3

This diff is large: its 25 lines aren’t shown here.

net/core/netpoll.c+3−2

This diff is large: its 26 lines aren’t shown here.

net/core/netprio_cgroup.c+4−37

This diff is large: its 69 lines aren’t shown here.

net/core/request_sock.c+95−0

This diff is large: its 106 lines aren’t shown here.

net/core/rtnetlink.c+21−17

This diff is large: its 132 lines aren’t shown here.

net/core/scm.c+11−6

This diff is large: its 43 lines aren’t shown here.

net/core/secure_seq.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/core/skbuff.c+40−46

This diff is large: its 132 lines aren’t shown here.

net/core/sock.c+48−16

This diff is large: its 99 lines aren’t shown here.

net/core/sock_diag.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/core/utils.c+20−0

This diff is large: its 27 lines aren’t shown here.

net/dcb/dcbnl.c+9−9

This diff is large: its 66 lines aren’t shown here.

net/decnet/af_decnet.c+2−2

This diff is large: its 13 lines aren’t shown here.

net/decnet/dn_dev.c+3−3

This diff is large: its 24 lines aren’t shown here.

net/decnet/dn_route.c+8−8

This diff is large: its 72 lines aren’t shown here.

net/decnet/dn_table.c+6−6

This diff is large: its 52 lines aren’t shown here.

net/decnet/netfilter/dn_rtmsg.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/ieee802154/6lowpan.c+45−8

This diff is large: its 102 lines aren’t shown here.

net/ieee802154/nl-mac.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/ieee802154/nl-phy.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/ipv4/af_inet.c+24−3

This diff is large: its 62 lines aren’t shown here.

net/ipv4/devinet.c+32−35

This diff is large: its 227 lines aren’t shown here.

net/ipv4/fib_frontend.c+11−14

This diff is large: its 88 lines aren’t shown here.

net/ipv4/fib_semantics.c+4−4

This diff is large: its 35 lines aren’t shown here.

net/ipv4/fib_trie.c+9−6

This diff is large: its 43 lines aren’t shown here.

net/ipv4/igmp.c+25−13

This diff is large: its 146 lines aren’t shown here.

net/ipv4/inet_connection_sock.c+51−6

This diff is large: its 118 lines aren’t shown here.

net/ipv4/inet_diag.c+16−16

This diff is large: its 125 lines aren’t shown here.

net/ipv4/inet_fragment.c+7−2

This diff is large: its 27 lines aren’t shown here.

net/ipv4/ip_fragment.c+9−4

This diff is large: its 43 lines aren’t shown here.

net/ipv4/ip_gre.c+86−42

This diff is large: its 305 lines aren’t shown here.

net/ipv4/ip_output.c+31−43

This diff is large: its 126 lines aren’t shown here.

net/ipv4/ip_vti.c+0−5

This diff is large: its 35 lines aren’t shown here.

net/ipv4/ipconfig.c+38−5

This diff is large: its 85 lines aren’t shown here.

net/ipv4/ipip.c+26−25

This diff is large: its 102 lines aren’t shown here.

net/ipv4/ipmr.c+6−6

This diff is large: its 51 lines aren’t shown here.

net/ipv4/netfilter.c+2−39

This diff is large: its 59 lines aren’t shown here.

net/ipv4/netfilter/Kconfig+22−68

This diff is large: its 141 lines aren’t shown here.

net/ipv4/netfilter/Makefile+3−15

This diff is large: its 53 lines aren’t shown here.

net/ipv4/netfilter/ipt_MASQUERADE.c+11−7

This diff is large: its 48 lines aren’t shown here.

net/ipv4/netfilter/ipt_NETMAP.c+0−98

This diff is large: its 99 lines aren’t shown here.

net/ipv4/netfilter/ipt_REDIRECT.c+0−110

This diff is large: its 111 lines aren’t shown here.

net/ipv4/netfilter/ipt_ULOG.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/ipv4/netfilter/ipt_rpfilter.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/netfilter/iptable_filter.c+2−8

This diff is large: its 27 lines aren’t shown here.

net/ipv4/netfilter/iptable_mangle.c+2−8

This diff is large: its 27 lines aren’t shown here.

net/ipv4/netfilter/iptable_nat.crenamed from net/ipv4/netfilter/nf_nat_standalone.c+129−135

This diff is large: its 412 lines aren’t shown here.

net/ipv4/netfilter/iptable_raw.c+2−8

This diff is large: its 27 lines aren’t shown here.

net/ipv4/netfilter/iptable_security.c+1−4

This diff is large: its 12 lines aren’t shown here.

net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c+2−6

This diff is large: its 22 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_h323.c+38−33

This diff is large: its 268 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_l3proto_ipv4.c+281−0

This diff is large: its 282 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_pptp.c+11−10

This diff is large: its 79 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_proto_gre.c+15−15

This diff is large: its 82 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_proto_icmp.c+12−12

This diff is large: its 71 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_rule.c+0−214

This diff is large: its 215 lines aren’t shown here.

net/ipv4/proc.c+4−0

This diff is large: its 11 lines aren’t shown here.

net/ipv4/route.c+15−15

This diff is large: its 91 lines aren’t shown here.

net/ipv4/syncookies.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv4/sysctl_net_ipv4.c+45−0

This diff is large: its 59 lines aren’t shown here.

net/ipv4/tcp.c+71−64

This diff is large: its 223 lines aren’t shown here.

net/ipv4/tcp_fastopen.c+82−1

This diff is large: its 93 lines aren’t shown here.

net/ipv4/tcp_input.c+148−133

This diff is large: its 493 lines aren’t shown here.

net/ipv4/tcp_ipv4.c+284−42

This diff is large: its 528 lines aren’t shown here.

net/ipv4/tcp_metrics.c+341−13

This diff is large: its 391 lines aren’t shown here.

net/ipv4/tcp_minisocks.c+60−15

This diff is large: its 169 lines aren’t shown here.

net/ipv4/tcp_output.c+19−8

This diff is large: its 78 lines aren’t shown here.

net/ipv4/tcp_timer.c+38−1

This diff is large: its 53 lines aren’t shown here.

net/ipv4/udp_diag.c+3−3

This diff is large: its 26 lines aren’t shown here.

net/ipv6/Kconfig+16−0

This diff is large: its 23 lines aren’t shown here.

net/ipv6/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/addrconf.c+38−45

This diff is large: its 271 lines aren’t shown here.

net/ipv6/addrlabel.c+18−6

This diff is large: its 81 lines aren’t shown here.

net/ipv6/ip6_fib.c+6−14

This diff is large: its 69 lines aren’t shown here.

net/ipv6/ip6_gre.c+1770−0

This diff is large: its 1771 lines aren’t shown here.

net/ipv6/ip6_output.c+32−53

This diff is large: its 156 lines aren’t shown here.

net/ipv6/ip6_tunnel.c+67−24

This diff is large: its 274 lines aren’t shown here.

net/ipv6/ip6mr.c+5−5

This diff is large: its 42 lines aren’t shown here.

net/ipv6/netfilter.c+8−0

This diff is large: its 22 lines aren’t shown here.

net/ipv6/netfilter/Kconfig+36−1

This diff is large: its 46 lines aren’t shown here.

net/ipv6/netfilter/Makefile+6−0

This diff is large: its 25 lines aren’t shown here.

net/ipv6/netfilter/ip6t_MASQUERADE.c+135−0

This diff is large: its 136 lines aren’t shown here.

net/ipv6/netfilter/ip6t_NPT.c+165−0

This diff is large: its 166 lines aren’t shown here.

net/ipv6/netfilter/ip6table_filter.c+1−3

This diff is large: its 11 lines aren’t shown here.

net/ipv6/netfilter/ip6table_mangle.c+1−3

This diff is large: its 11 lines aren’t shown here.

net/ipv6/netfilter/ip6table_nat.c+321−0

This diff is large: its 322 lines aren’t shown here.

net/ipv6/netfilter/ip6table_raw.c+1−3

This diff is large: its 11 lines aren’t shown here.

net/ipv6/netfilter/ip6table_security.c+1−4

This diff is large: its 12 lines aren’t shown here.

net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c+71−66

This diff is large: its 222 lines aren’t shown here.

net/ipv6/netfilter/nf_conntrack_reasm.c+123−95

This diff is large: its 414 lines aren’t shown here.

net/ipv6/netfilter/nf_nat_l3proto_ipv6.c+288−0

This diff is large: its 289 lines aren’t shown here.

net/ipv6/netfilter/nf_nat_proto_icmpv6.c+90−0

This diff is large: its 91 lines aren’t shown here.

net/ipv6/reassembly.c+24−65

This diff is large: its 156 lines aren’t shown here.

net/ipv6/route.c+56−40

This diff is large: its 306 lines aren’t shown here.

net/ipv6/sit.c+0−6

This diff is large: its 45 lines aren’t shown here.

net/ipv6/syncookies.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/tcp_ipv6.c+25−15

This diff is large: its 112 lines aren’t shown here.

net/irda/irnetlink.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/key/af_key.c+21−18

This diff is large: its 172 lines aren’t shown here.

net/l2tp/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

net/l2tp/l2tp_eth.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/l2tp/l2tp_netlink.c+12−12

This diff is large: its 102 lines aren’t shown here.

net/llc/llc_station.c+9−591

This diff is large: its 657 lines aren’t shown here.

net/llc/sysctl_net_llc.c+0−7

This diff is large: its 14 lines aren’t shown here.

net/mac80211/aes_cmac.c+1−5

This diff is large: its 16 lines aren’t shown here.

net/mac80211/agg-tx.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/mac80211/cfg.c+80−23

This diff is large: its 249 lines aren’t shown here.

net/mac80211/chan.c+48−19

This diff is large: its 105 lines aren’t shown here.

net/mac80211/debugfs.c+4−32

This diff is large: its 75 lines aren’t shown here.

net/mac80211/driver-ops.h+8−3

This diff is large: its 33 lines aren’t shown here.

net/mac80211/ibss.c+42−8

This diff is large: its 128 lines aren’t shown here.

net/mac80211/ieee80211_i.h+28−25

This diff is large: its 188 lines aren’t shown here.

net/mac80211/iface.c+196−120

This diff is large: its 637 lines aren’t shown here.

net/mac80211/key.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/mac80211/main.c+17−14

This diff is large: its 76 lines aren’t shown here.

net/mac80211/mesh.c+32−17

This diff is large: its 144 lines aren’t shown here.

net/mac80211/mesh.h+4−1

This diff is large: its 19 lines aren’t shown here.

net/mac80211/mesh_hwmp.c+0−2

This diff is large: its 9 lines aren’t shown here.

net/mac80211/mesh_pathtbl.c+20−24

This diff is large: its 93 lines aren’t shown here.

net/mac80211/mesh_plink.c+48−37

This diff is large: its 255 lines aren’t shown here.

net/mac80211/mlme.c+270−173

This diff is large: its 802 lines aren’t shown here.

net/mac80211/offchannel.c+7−2

This diff is large: its 30 lines aren’t shown here.

net/mac80211/rate.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/mac80211/rx.c+54−6

This diff is large: its 107 lines aren’t shown here.

net/mac80211/scan.c+21−32

This diff is large: its 129 lines aren’t shown here.

net/mac80211/sta_info.c+68−55

This diff is large: its 165 lines aren’t shown here.

net/mac80211/sta_info.h+2−0

This diff is large: its 16 lines aren’t shown here.

net/mac80211/status.c+31−11

This diff is large: its 53 lines aren’t shown here.

net/mac80211/trace.h+7−4

This diff is large: its 25 lines aren’t shown here.

net/mac80211/tx.c+30−43

This diff is large: its 269 lines aren’t shown here.

net/mac80211/util.c+85−23

This diff is large: its 272 lines aren’t shown here.

net/netfilter/Kconfig+70−13

This diff is large: its 111 lines aren’t shown here.

net/netfilter/Makefile+20−1

This diff is large: its 45 lines aren’t shown here.

net/netfilter/core.c+12−9

This diff is large: its 65 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_ip.c+12−7

This diff is large: its 63 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_ipmac.c+11−7

This diff is large: its 58 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_port.c+6−3

This diff is large: its 25 lines aren’t shown here.

net/netfilter/ipset/ip_set_core.c+24−15

This diff is large: its 149 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_ip.c+9−6

This diff is large: its 52 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_ipport.c+14−10

This diff is large: its 76 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_ipportip.c+14−10

This diff is large: its 76 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_ipportnet.c+27−20

This diff is large: its 122 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_net.c+14−11

This diff is large: its 75 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_netiface.c+34−32

This diff is large: its 239 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_netport.c+20−16

This diff is large: its 104 lines aren’t shown here.

net/netfilter/ipset/ip_set_list_set.c+6−3

This diff is large: its 25 lines aren’t shown here.

net/netfilter/ipvs/Kconfig+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_app.c+42−16

This diff is large: its 92 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_core.c+73−3

This diff is large: its 107 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_ctl.c+16−9

This diff is large: its 88 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_ftp.c+6−16

This diff is large: its 51 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_xmit.c+79−32

This diff is large: its 217 lines aren’t shown here.

net/netfilter/nf_conntrack_amanda.c+3−2

This diff is large: its 19 lines aren’t shown here.

net/netfilter/nf_conntrack_core.c+9−6

This diff is large: its 43 lines aren’t shown here.

net/netfilter/nf_conntrack_ecache.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/nf_conntrack_ftp.c+23−1

This diff is large: its 66 lines aren’t shown here.

net/netfilter/nf_conntrack_h323_main.c+148−84

This diff is large: its 858 lines aren’t shown here.

net/netfilter/nf_conntrack_irc.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/netfilter/nf_conntrack_netlink.c+67−47

This diff is large: its 415 lines aren’t shown here.

net/netfilter/nf_conntrack_pptp.c+10−8

This diff is large: its 69 lines aren’t shown here.

net/netfilter/nf_conntrack_proto.c+0−5

This diff is large: its 28 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_tcp.c+4−4

This diff is large: its 23 lines aren’t shown here.

net/netfilter/nf_conntrack_sip.c+85−58

This diff is large: its 419 lines aren’t shown here.

net/netfilter/nf_internals.h+2−2

This diff is large: its 16 lines aren’t shown here.

net/netfilter/nf_nat_amanda.crenamed from net/ipv4/netfilter/nf_nat_amanda.c+2−2

This diff is large: its 25 lines aren’t shown here.

net/netfilter/nf_nat_core.crenamed from net/ipv4/netfilter/nf_nat_core.c+386−293

This diff is large: its 1013 lines aren’t shown here.

net/netfilter/nf_nat_ftp.crenamed from net/ipv4/netfilter/nf_nat_ftp.c+20−14

This diff is large: its 92 lines aren’t shown here.

net/netfilter/nf_nat_helper.crenamed from net/ipv4/netfilter/nf_nat_helper.c+43−66

This diff is large: its 257 lines aren’t shown here.

net/netfilter/nf_nat_irc.crenamed from net/ipv4/netfilter/nf_nat_irc.c+2−8

This diff is large: its 37 lines aren’t shown here.

net/netfilter/nf_nat_proto_common.crenamed from net/ipv4/netfilter/nf_nat_proto_common.c+26−28

This diff is large: its 100 lines aren’t shown here.

net/netfilter/nf_nat_proto_dccp.crenamed from net/ipv4/netfilter/nf_nat_proto_dccp.c+33−23

This diff is large: its 126 lines aren’t shown here.

net/netfilter/nf_nat_proto_sctp.crenamed from net/ipv4/netfilter/nf_nat_proto_sctp.c+30−23

This diff is large: its 109 lines aren’t shown here.

net/netfilter/nf_nat_proto_tcp.crenamed from net/ipv4/netfilter/nf_nat_proto_tcp.c+17−23

This diff is large: its 93 lines aren’t shown here.

net/netfilter/nf_nat_proto_udp.crenamed from net/ipv4/netfilter/nf_nat_proto_udp.c+18−24

This diff is large: its 91 lines aren’t shown here.

net/netfilter/nf_nat_proto_udplite.crenamed from net/ipv4/netfilter/nf_nat_proto_udplite.c+33−25

This diff is large: its 118 lines aren’t shown here.

net/netfilter/nf_nat_proto_unknown.crenamed from net/ipv4/netfilter/nf_nat_proto_unknown.c+9−7

This diff is large: its 45 lines aren’t shown here.

net/netfilter/nf_nat_sip.crenamed from net/ipv4/netfilter/nf_nat_sip.c+155−115

This diff is large: its 572 lines aren’t shown here.

net/netfilter/nf_nat_tftp.crenamed from net/ipv4/netfilter/nf_nat_tftp.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/netfilter/nf_queue.c+5−5

This diff is large: its 45 lines aren’t shown here.

net/netfilter/nfnetlink.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/nfnetlink_acct.c+8−8

This diff is large: its 61 lines aren’t shown here.

net/netfilter/nfnetlink_cthelper.c+10−7

This diff is large: its 66 lines aren’t shown here.

net/netfilter/nfnetlink_cttimeout.c+6−6

This diff is large: its 47 lines aren’t shown here.

net/netfilter/nfnetlink_log.c+9−9

This diff is large: its 81 lines aren’t shown here.

net/netfilter/nfnetlink_queue_core.c+29−21

This diff is large: its 187 lines aren’t shown here.

net/netfilter/xt_CT.c+126−136

This diff is large: its 332 lines aren’t shown here.

net/netfilter/xt_NETMAP.c+165−0

This diff is large: its 166 lines aren’t shown here.

net/netfilter/xt_NFQUEUE.c+5−3

This diff is large: its 29 lines aren’t shown here.

net/netfilter/xt_NOTRACK.c+0−53

This diff is large: its 54 lines aren’t shown here.

net/netfilter/xt_REDIRECT.c+190−0

This diff is large: its 191 lines aren’t shown here.

net/netfilter/xt_nat.c+170−0

This diff is large: its 171 lines aren’t shown here.

net/netfilter/xt_osf.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/xt_set.c+22−0

This diff is large: its 36 lines aren’t shown here.

net/netfilter/xt_socket.c+6−6

This diff is large: its 26 lines aren’t shown here.

net/netfilter/xt_time.c+23−1

This diff is large: its 52 lines aren’t shown here.

net/netlabel/netlabel_cipso_v4.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netlabel/netlabel_mgmt.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/netlabel/netlabel_unlabeled.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netlink/af_netlink.c+103−107

This diff is large: its 704 lines aren’t shown here.

net/netlink/genetlink.c+23−25

This diff is large: its 195 lines aren’t shown here.

net/nfc/core.c+2−11

This diff is large: its 39 lines aren’t shown here.

net/nfc/hci/Makefile+2−2

This diff is large: its 8 lines aren’t shown here.

net/nfc/hci/command.c+41−4

This diff is large: its 67 lines aren’t shown here.

net/nfc/hci/core.c+186−150

This diff is large: its 531 lines aren’t shown here.

net/nfc/hci/hci.h+4−11

This diff is large: its 43 lines aren’t shown here.

net/nfc/hci/hcp.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/nfc/hci/llc.c+170−0

This diff is large: its 171 lines aren’t shown here.

net/nfc/hci/llc.h+69−0

This diff is large: its 70 lines aren’t shown here.

net/nfc/hci/llc_nop.c+99−0

This diff is large: its 100 lines aren’t shown here.

net/nfc/hci/llc_shdlc.crenamed from net/nfc/hci/shdlc.c+225−319

This diff is large: its 1000 lines aren’t shown here.

net/nfc/llcp/commands.c+2−0

This diff is large: its 9 lines aren’t shown here.

net/nfc/llcp/llcp.c+70−61

This diff is large: its 276 lines aren’t shown here.

net/nfc/llcp/llcp.h+3−3

This diff is large: its 30 lines aren’t shown here.

net/nfc/llcp/sock.c+86−7

This diff is large: its 137 lines aren’t shown here.

net/nfc/nci/core.c+90−1

This diff is large: its 133 lines aren’t shown here.

net/nfc/nci/ntf.c+52−0

This diff is large: its 80 lines aren’t shown here.

net/nfc/nci/rsp.c+14−0

This diff is large: its 28 lines aren’t shown here.

net/nfc/netlink.c+50−18

This diff is large: its 157 lines aren’t shown here.

net/openvswitch/actions.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/openvswitch/datapath.c+276−177

This diff is large: its 1090 lines aren’t shown here.

net/openvswitch/datapath.h+43−9

This diff is large: its 90 lines aren’t shown here.

net/openvswitch/dp_notify.c+5−3

This diff is large: its 25 lines aren’t shown here.

net/openvswitch/flow.c+5−16

This diff is large: its 60 lines aren’t shown here.

net/openvswitch/flow.h+2−1

This diff is large: its 17 lines aren’t shown here.

net/openvswitch/vport-internal_dev.c+6−1

This diff is large: its 24 lines aren’t shown here.

net/openvswitch/vport-netdev.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/openvswitch/vport.c+17−10

This diff is large: its 93 lines aren’t shown here.

net/openvswitch/vport.h+7−6

This diff is large: its 52 lines aren’t shown here.

net/packet/Kconfig+8−0

This diff is large: its 12 lines aren’t shown here.

net/packet/Makefile+2−0

This diff is large: its 6 lines aren’t shown here.

net/packet/af_packet.c+19−124

This diff is large: its 234 lines aren’t shown here.

net/packet/diag.c+242−0

This diff is large: its 243 lines aren’t shown here.

net/packet/internal.h+121−0

This diff is large: its 122 lines aren’t shown here.

net/phonet/pn_netlink.c+7−7

This diff is large: its 57 lines aren’t shown here.

net/rds/tcp_connect.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/rds/tcp_listen.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/rds/tcp_recv.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/rds/tcp_send.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/rfkill/core.c+21−1

This diff is large: its 53 lines aren’t shown here.

net/sched/act_api.c+26−26

This diff is large: its 219 lines aren’t shown here.

net/sched/cls_api.c+7−7

This diff is large: its 56 lines aren’t shown here.

net/sched/em_meta.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_api.c+22−22

This diff is large: its 167 lines aren’t shown here.

net/sched/sch_drr.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_generic.c+8−19

This diff is large: its 60 lines aren’t shown here.

net/sched/sch_qfq.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sctp/associola.c+16−9

This diff is large: its 120 lines aren’t shown here.

net/sctp/auth.c+16−4

This diff is large: its 58 lines aren’t shown here.

net/sctp/bind_addr.c+10−10

This diff is large: its 76 lines aren’t shown here.

net/sctp/chunk.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sctp/endpointola.c+16−9

This diff is large: its 115 lines aren’t shown here.

net/sctp/input.c+69−46

This diff is large: its 438 lines aren’t shown here.

net/sctp/ipv6.c+19−17

This diff is large: its 113 lines aren’t shown here.

net/sctp/objcnt.c+4−4

This diff is large: its 25 lines aren’t shown here.

net/sctp/output.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sctp/outqueue.c+14−14

This diff is large: its 92 lines aren’t shown here.

net/sctp/primitive.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/sctp/proc.c+34−21

This diff is large: its 184 lines aren’t shown here.

net/sctp/protocol.c+232−222

This diff is large: its 800 lines aren’t shown here.

net/sctp/sm_make_chunk.c+33−28

This diff is large: its 268 lines aren’t shown here.

net/sctp/sm_sideeffect.c+17−9

This diff is large: its 122 lines aren’t shown here.

net/sctp/sm_statefuns.c+416−309

This diff is large: its 2661 lines aren’t shown here.

net/sctp/sm_statetable.c+10−7

This diff is large: its 61 lines aren’t shown here.

net/sctp/socket.c+72−47

This diff is large: its 486 lines aren’t shown here.

net/sctp/sysctl.c+112−86

This diff is large: its 333 lines aren’t shown here.

net/sctp/transport.c+13−10

This diff is large: its 72 lines aren’t shown here.

net/sctp/ulpqueue.c+12−6

This diff is large: its 60 lines aren’t shown here.

net/socket.c+78−11

This diff is large: its 157 lines aren’t shown here.

net/tipc/bearer.c+2−19

This diff is large: its 42 lines aren’t shown here.

net/tipc/config.c+5−43

This diff is large: its 83 lines aren’t shown here.

net/tipc/core.c+7−15

This diff is large: its 45 lines aren’t shown here.

net/tipc/core.h+8−10

This diff is large: its 36 lines aren’t shown here.

net/tipc/eth_media.c+25−4

This diff is large: its 69 lines aren’t shown here.

net/tipc/handler.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/tipc/link.c+1−3

This diff is large: its 11 lines aren’t shown here.

net/tipc/name_table.c+8−8

This diff is large: its 66 lines aren’t shown here.

net/tipc/net.c+1−2

This diff is large: its 17 lines aren’t shown here.

net/tipc/net.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/tipc/netlink.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/tipc/subscr.c+2−2

This diff is large: its 12 lines aren’t shown here.

net/unix/af_unix.c+9−8

This diff is large: its 45 lines aren’t shown here.

net/unix/diag.c+7−7

This diff is large: its 60 lines aren’t shown here.

net/wireless/chan.c+6−1

This diff is large: its 21 lines aren’t shown here.

net/wireless/core.c+51−2

This diff is large: its 75 lines aren’t shown here.

net/wireless/core.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/wireless/mlme.c+26−11

This diff is large: its 117 lines aren’t shown here.

net/wireless/nl80211.c+205−61

This diff is large: its 677 lines aren’t shown here.

net/wireless/nl80211.h+5−0

This diff is large: its 12 lines aren’t shown here.

net/wireless/radiotap.c+2−0

This diff is large: its 9 lines aren’t shown here.

net/wireless/reg.c+17−28

This diff is large: its 88 lines aren’t shown here.

net/wireless/scan.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/wireless/util.c+19−17

This diff is large: its 65 lines aren’t shown here.

net/wireless/wext-core.c+4−4

This diff is large: its 18 lines aren’t shown here.

net/xfrm/xfrm_policy.c+44−39

This diff is large: its 139 lines aren’t shown here.

net/xfrm/xfrm_state.c+6−6

This diff is large: its 50 lines aren’t shown here.

net/xfrm/xfrm_user.c+38−39

This diff is large: its 327 lines aren’t shown here.

security/selinux/netlink.c+2−3

This diff is large: its 16 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t