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
19Contact: Richard Cochran <richardcochran@gmail.com>19Contact: Richard Cochran <richardcochran@gmail.com>
20Description:20Description:
21 This file contains the name of the PTP hardware clock21 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.
23 27
24What: /sys/class/ptp/ptpN/max_adjustment28What: /sys/class/ptp/ptpN/max_adjustment
25Date: September 201029Date: September 2010
Documentation/devicetree/bindings/net/can/c_can.txt+49−0
@@ -0,0 +1,49 @@
1Bosch C_CAN/D_CAN controller Device Tree Bindings
2-------------------------------------------------
3
4Required 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
12Optional properties:
13- ti,hwmods : Must be "d_can<n>" or "c_can<n>", n being the
14 instance number
15
16Note: "ti,hwmods" field is used to fetch the base address and irq
17resources from TI, omap hwmod data base during device registration.
18Future plan is to migrate hwmod data base contents into device tree
19blob so that, all the required data will be used from device tree dts
20file.
21
22Example:
23
24Step1: 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
45Step 2: board specific .dts file
46
47 &dcan1 {
48 status = "okay";
49 };
Documentation/devicetree/bindings/net/cpsw.txt+109−0
@@ -0,0 +1,109 @@
1TI SoC Ethernet Switch Controller Device Tree Bindings
2------------------------------------------------------
3
4Required 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
30Optional properties:
31- ti,hwmods : Must be "cpgmac0"
32- no_bd_ram : Must be 0 or 1
33
34Note: "ti,hwmods" field is used to fetch the base address and irq
35resources from TI, omap hwmod data base during device registration.
36Future plan is to migrate hwmod data base contents into device tree
37blob so that, all the required data will be used from device tree dts
38file.
39
40Examples:
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 @@
1TI SoC Davinci MDIO Controller Device Tree Bindings
2---------------------------------------------------
3
4Required 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
10Optional properties:
11- ti,hwmods : Must be "davinci_mdio"
12
13Note: "ti,hwmods" field is used to fetch the base address and irq
14resources from TI, omap hwmod data base during device registration.
15Future plan is to migrate hwmod data base contents into device tree
16blob so that, all the required data will be used from device tree dts
17file.
18
19Examples:
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 @@
1Properties for an MDIO bus multiplexer controlled by a memory-mapped device
2
3This is a special case of a MDIO bus multiplexer. A memory-mapped device,
4like an FPGA, is used to control which child bus is connected. The mdio-mux
5node must be a child of the memory-mapped device. The driver currently only
6supports devices with eight-bit registers.
7
8Required 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
21Example:
22
23The FPGA node defines a memory-mapped FPGA with a register space of 0x30 bytes.
24For the "EMI2" MDIO bus, register 9 (BRDCFG1) controls the mux on that bus.
25A bitmask of 0x6 means that bits 1 and 2 (bit 0 is lsb) are the bits on
26BRDCFG1 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
78 flags = hard, nointr, noposix, cto, ac78 flags = hard, nointr, noposix, cto, ac
79 79
80 80
81ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>81ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:
82 <dns0-ip>:<dns1-ip>
82 83
83 This parameter tells the kernel how to configure IP addresses of devices84 This parameter tells the kernel how to configure IP addresses of devices
84 and also how to set up the IP routing table. It was originally called85 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
158 159
159 Default: any160 Default: any
160 161
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
161 169
162nfsrootdebug170nfsrootdebug
163 171
Documentation/infiniband/ipoib.txt+3−0
@@ -24,6 +24,9 @@ Partitions and P_Keys · 23 unmodified lines
24 The P_Key for any interface is given by the "pkey" file, and the24 The P_Key for any interface is given by the "pkey" file, and the
25 main interface for a subinterface is in "parent."25 main interface for a subinterface is in "parent."
26 26
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
27Datagram vs Connected modes30Datagram vs Connected modes
28 31
29 The IPoIB driver supports two modes of operation: datagram and32 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
75 75
76There is a special folder for debugging information:76There is a special folder for debugging information:
77 77
78# ls /sys/kernel/debug/batman_adv/bat0/78# ls /sys/kernel/debug/batman_adv/bat0/
79# bla_claim_table log socket transtable_local79# bla_backbone_table log transtable_global
80# gateways originators transtable_global vis_data80# bla_claim_table originators transtable_local
81# gateways socket vis_data
81 82
82Some of the files contain all sort of status information regard-83Some of the files contain all sort of status information regard-
83ing the mesh network. For example, you can view the table of84ing 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
752 protocol information to generate the hash.752 protocol information to generate the hash.
753 753
754 Uses XOR of hardware MAC addresses and IP addresses to754 Uses XOR of hardware MAC addresses and IP addresses to
755 generate the hash. The formula is755 generate the hash. The IPv4 formula is
756 756
757 (((source IP XOR dest IP) AND 0xffff) XOR757 (((source IP XOR dest IP) AND 0xffff) XOR
758 ( source MAC XOR destination MAC ))758 ( source MAC XOR destination MAC ))
759 modulo slave count759 modulo slave count
760 760
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
761 This algorithm will place all traffic to a particular771 This algorithm will place all traffic to a particular
762 network peer on the same slave. For non-IP traffic,772 network peer on the same slave. For non-IP traffic,
763 the formula is the same as for the layer2 transmit773 the formula is the same as for the layer2 transmit
@@ -778,19 +788,29 @@ xmit_hash_policy · 14 unmodified lines
778 slaves, although a single connection will not span788 slaves, although a single connection will not span
779 multiple slaves.789 multiple slaves.
780 790
781 The formula for unfragmented TCP and UDP packets is791 The formula for unfragmented IPv4 TCP and UDP packets is
782 792
783 ((source port XOR dest port) XOR793 ((source port XOR dest port) XOR
784 ((source IP XOR dest IP) AND 0xffff)794 ((source IP XOR dest IP) AND 0xffff)
785 modulo slave count795 modulo slave count
786 796
787 For fragmented TCP or UDP packets and all other IP797 The formula for unfragmented IPv6 TCP and UDP packets is
788 protocol traffic, the source and destination port798
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
789 information is omitted. For non-IP traffic, the809 information is omitted. For non-IP traffic, the
790 formula is the same as for the layer2 transmit hash810 formula is the same as for the layer2 transmit hash
791 policy.811 policy.
792 812
793 This policy is intended to mimic the behavior of813 The IPv4 policy is intended to mimic the behavior of
794 certain switches, notably Cisco switches with PFC2 as814 certain switches, notably Cisco switches with PFC2 as
795 well as some Foundry and IBM products.815 well as some Foundry and IBM products.
796 816
Documentation/networking/ip-sysctl.txt+28−9
@@ -439,7 +439,9 @@ tcp_stdurg - BOOLEAN · 438 unmodified lines
439tcp_synack_retries - INTEGER439tcp_synack_retries - INTEGER
440 Number of times SYNACKs for a passive TCP connection attempt will440 Number of times SYNACKs for a passive TCP connection attempt will
441 be retransmitted. Should not be higher than 255. Default value441 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.
443 445
444tcp_syncookies - BOOLEAN446tcp_syncookies - BOOLEAN
445 Only valid when the kernel was compiled with CONFIG_SYNCOOKIES447 Only valid when the kernel was compiled with CONFIG_SYNCOOKIES
@@ -465,20 +467,37 @@ tcp_syncookies - BOOLEAN · 19 unmodified lines
465tcp_fastopen - INTEGER467tcp_fastopen - INTEGER
466 Enable TCP Fast Open feature (draft-ietf-tcpm-fastopen) to send data468 Enable TCP Fast Open feature (draft-ietf-tcpm-fastopen) to send data
467 in the opening SYN packet. To use this feature, the client application469 in the opening SYN packet. To use this feature, the client application
468 must not use connect(). Instead, it should use sendmsg() or sendto()470 must use sendmsg() or sendto() with MSG_FASTOPEN flag rather than
469 with MSG_FASTOPEN flag which performs a TCP handshake automatically.471 connect() to perform a TCP handshake automatically.
470 472
471 The values (bitmap) are:473 The values (bitmap) are
472 1: Enables sending data in the opening SYN on the client474 1: Enables sending data in the opening SYN on the client.
473 5: Enables sending data in the opening SYN on the client regardless475 2: Enables TCP Fast Open on the server side, i.e., allowing data in
474 of cookie availability.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.
475 486
476 Default: 0487 Default: 0
477 488
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
478tcp_syn_retries - INTEGER495tcp_syn_retries - INTEGER
479 Number of times initial SYNs for an active TCP connection attempt496 Number of times initial SYNs for an active TCP connection attempt
480 will be retransmitted. Should not be higher than 255. Default value497 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.
482 501
483tcp_timestamps - BOOLEAN502tcp_timestamps - BOOLEAN
484 Enable timestamps as defined in RFC1323.503 Enable timestamps as defined in RFC1323.
Documentation/networking/stmmac.txt+0−5
@@ -173,7 +173,6 @@ Where: · 172 unmodified lines
173For MDIO bus The we have:173For MDIO bus The we have:
174 174
175 struct stmmac_mdio_bus_data {175 struct stmmac_mdio_bus_data {
176 int bus_id;
177 int (*phy_reset)(void *priv);176 int (*phy_reset)(void *priv);
178 unsigned int phy_mask;177 unsigned int phy_mask;
179 int *irqs;178 int *irqs;
@@ -181,7 +180,6 @@ For MDIO bus The we have: · 1 unmodified line
181 };180 };
182 181
183Where:182Where:
184 o bus_id: bus identifier;
185 o phy_reset: hook to reset the phy device attached to the bus.183 o phy_reset: hook to reset the phy device attached to the bus.
186 o phy_mask: phy mask passed when register the MDIO bus within the driver.184 o phy_mask: phy mask passed when register the MDIO bus within the driver.
187 o irqs: list of IRQs, one per PHY.185 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
230with fixed_link support.228with fixed_link support.
231 229
232static struct stmmac_mdio_bus_data stmmac1_mdio_bus = {230static struct stmmac_mdio_bus_data stmmac1_mdio_bus = {
233 .bus_id = 1,
234 |
235 |-> phy device on the bus_id 1
236 .phy_reset = phy_reset;231 .phy_reset = phy_reset;
237 |232 |
238 |-> function to provide the phy_reset on this board233 |-> function to provide the phy_reset on this board
Documentation/networking/vxlan.txt+47−0
@@ -0,0 +1,47 @@
1Virtual eXtensible Local Area Networking documentation
2======================================================
3
4The VXLAN protocol is a tunnelling protocol that is designed to
5solve the problem of limited number of available VLAN's (4096).
6With VXLAN identifier is expanded to 24 bits.
7
8It is a draft RFC standard, that is implemented by Cisco Nexus,
9Vmware and Brocade. The protocol runs over UDP using a single
10destination port (still not standardized by IANA).
11This document describes the Linux kernel tunnel device,
12there is also an implantation of VXLAN for Openvswitch.
13
14Unlike most tunnels, a VXLAN is a 1 to N network, not just point
15to point. A VXLAN device can either dynamically learn the IP address
16of the other end, in a manner similar to a learning bridge, or the
17forwarding entries can be configured statically.
18
19The management of vxlan is done in a similar fashion to it's
20too closest neighbors GRE and VLAN. Configuring VXLAN requires
21the version of iproute2 that matches the kernel release
22where VXLAN was first merged upstream.
23
241. Create vxlan device
25 # ip li add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1
26
27This creates a new device (vxlan0). The device uses the
28the multicast group 239.1.1.1 over eth1 to handle packets where
29no entry is in the forwarding table.
30
312. Delete vxlan device
32 # ip link delete vxlan0
33
343. Show vxlan info
35 # ip -d show vxlan0
36
37It is possible to create, destroy and display the vxlan
38forwarding table using the new bridge command.
39
401. Create forwarding table entry
41 # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0
42
432. Delete forwarding table entry
44 # bridge fdb delete 00:17:42:8a:b4:05
45
463. 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
4806M: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>4806M: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
4807M: Samuel Ortiz <sameo@linux.intel.com>4807M: Samuel Ortiz <sameo@linux.intel.com>
4808L: linux-wireless@vger.kernel.org4808L: linux-wireless@vger.kernel.org
4809L: linux-nfc@lists.01.org (moderated for non-subscribers)
4809S: Maintained4810S: Maintained
4810F: net/nfc/4811F: net/nfc/
4811F: include/linux/nfc.h4812F: include/linux/nfc.h
arch/m68k/configs/amiga_defconfig+0−1
@@ -67,7 +67,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m · 66 unmodified lines
67CONFIG_NETFILTER_XT_TARGET_MARK=m67CONFIG_NETFILTER_XT_TARGET_MARK=m
68CONFIG_NETFILTER_XT_TARGET_NFLOG=m68CONFIG_NETFILTER_XT_TARGET_NFLOG=m
69CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m69CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
70CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
71CONFIG_NETFILTER_XT_TARGET_TRACE=m70CONFIG_NETFILTER_XT_TARGET_TRACE=m
72CONFIG_NETFILTER_XT_TARGET_TCPMSS=m71CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
73CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m72CONFIG_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
67CONFIG_NETFILTER_XT_TARGET_MARK=m67CONFIG_NETFILTER_XT_TARGET_MARK=m
68CONFIG_NETFILTER_XT_TARGET_NFLOG=m68CONFIG_NETFILTER_XT_TARGET_NFLOG=m
69CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m69CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
70CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
71CONFIG_NETFILTER_XT_TARGET_TRACE=m70CONFIG_NETFILTER_XT_TARGET_TRACE=m
72CONFIG_NETFILTER_XT_TARGET_TCPMSS=m71CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
73CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m72CONFIG_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
65CONFIG_NETFILTER_XT_TARGET_MARK=m65CONFIG_NETFILTER_XT_TARGET_MARK=m
66CONFIG_NETFILTER_XT_TARGET_NFLOG=m66CONFIG_NETFILTER_XT_TARGET_NFLOG=m
67CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m67CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
68CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
69CONFIG_NETFILTER_XT_TARGET_TRACE=m68CONFIG_NETFILTER_XT_TARGET_TRACE=m
70CONFIG_NETFILTER_XT_TARGET_TCPMSS=m69CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
71CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m70CONFIG_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
65CONFIG_NETFILTER_XT_TARGET_MARK=m65CONFIG_NETFILTER_XT_TARGET_MARK=m
66CONFIG_NETFILTER_XT_TARGET_NFLOG=m66CONFIG_NETFILTER_XT_TARGET_NFLOG=m
67CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m67CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
68CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
69CONFIG_NETFILTER_XT_TARGET_TRACE=m68CONFIG_NETFILTER_XT_TARGET_TRACE=m
70CONFIG_NETFILTER_XT_TARGET_TCPMSS=m69CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
71CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m70CONFIG_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
66CONFIG_NETFILTER_XT_TARGET_MARK=m66CONFIG_NETFILTER_XT_TARGET_MARK=m
67CONFIG_NETFILTER_XT_TARGET_NFLOG=m67CONFIG_NETFILTER_XT_TARGET_NFLOG=m
68CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m68CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
69CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
70CONFIG_NETFILTER_XT_TARGET_TRACE=m69CONFIG_NETFILTER_XT_TARGET_TRACE=m
71CONFIG_NETFILTER_XT_TARGET_TCPMSS=m70CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
72CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m71CONFIG_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
61CONFIG_NETFILTER_XT_TARGET_MARK=m61CONFIG_NETFILTER_XT_TARGET_MARK=m
62CONFIG_NETFILTER_XT_TARGET_NFLOG=m62CONFIG_NETFILTER_XT_TARGET_NFLOG=m
63CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m63CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
64CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
65CONFIG_NETFILTER_XT_TARGET_TRACE=m64CONFIG_NETFILTER_XT_TARGET_TRACE=m
66CONFIG_NETFILTER_XT_TARGET_TCPMSS=m65CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
67CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m66CONFIG_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
80CONFIG_NETFILTER_XT_TARGET_MARK=m80CONFIG_NETFILTER_XT_TARGET_MARK=m
81CONFIG_NETFILTER_XT_TARGET_NFLOG=m81CONFIG_NETFILTER_XT_TARGET_NFLOG=m
82CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m82CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
83CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
84CONFIG_NETFILTER_XT_TARGET_TRACE=m83CONFIG_NETFILTER_XT_TARGET_TRACE=m
85CONFIG_NETFILTER_XT_TARGET_TCPMSS=m84CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
86CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m85CONFIG_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
64CONFIG_NETFILTER_XT_TARGET_MARK=m64CONFIG_NETFILTER_XT_TARGET_MARK=m
65CONFIG_NETFILTER_XT_TARGET_NFLOG=m65CONFIG_NETFILTER_XT_TARGET_NFLOG=m
66CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m66CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
67CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
68CONFIG_NETFILTER_XT_TARGET_TRACE=m67CONFIG_NETFILTER_XT_TARGET_TRACE=m
69CONFIG_NETFILTER_XT_TARGET_TCPMSS=m68CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
70CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m69CONFIG_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
65CONFIG_NETFILTER_XT_TARGET_MARK=m65CONFIG_NETFILTER_XT_TARGET_MARK=m
66CONFIG_NETFILTER_XT_TARGET_NFLOG=m66CONFIG_NETFILTER_XT_TARGET_NFLOG=m
67CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m67CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
68CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
69CONFIG_NETFILTER_XT_TARGET_TRACE=m68CONFIG_NETFILTER_XT_TARGET_TRACE=m
70CONFIG_NETFILTER_XT_TARGET_TCPMSS=m69CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
71CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m70CONFIG_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
61CONFIG_NETFILTER_XT_TARGET_MARK=m61CONFIG_NETFILTER_XT_TARGET_MARK=m
62CONFIG_NETFILTER_XT_TARGET_NFLOG=m62CONFIG_NETFILTER_XT_TARGET_NFLOG=m
63CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m63CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
64CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
65CONFIG_NETFILTER_XT_TARGET_TRACE=m64CONFIG_NETFILTER_XT_TARGET_TRACE=m
66CONFIG_NETFILTER_XT_TARGET_TCPMSS=m65CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
67CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m66CONFIG_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
62CONFIG_NETFILTER_XT_TARGET_MARK=m62CONFIG_NETFILTER_XT_TARGET_MARK=m
63CONFIG_NETFILTER_XT_TARGET_NFLOG=m63CONFIG_NETFILTER_XT_TARGET_NFLOG=m
64CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m64CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
65CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
66CONFIG_NETFILTER_XT_TARGET_TRACE=m65CONFIG_NETFILTER_XT_TARGET_TRACE=m
67CONFIG_NETFILTER_XT_TARGET_TCPMSS=m66CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
68CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m67CONFIG_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
62CONFIG_NETFILTER_XT_TARGET_MARK=m62CONFIG_NETFILTER_XT_TARGET_MARK=m
63CONFIG_NETFILTER_XT_TARGET_NFLOG=m63CONFIG_NETFILTER_XT_TARGET_NFLOG=m
64CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m64CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
65CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
66CONFIG_NETFILTER_XT_TARGET_TRACE=m65CONFIG_NETFILTER_XT_TARGET_TRACE=m
67CONFIG_NETFILTER_XT_TARGET_TCPMSS=m66CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
68CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m67CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
arch/mips/configs/ar7_defconfig+0−1
@@ -56,7 +56,6 @@ CONFIG_NF_CONNTRACK_MARK=y · 55 unmodified lines
56CONFIG_NF_CONNTRACK_FTP=m56CONFIG_NF_CONNTRACK_FTP=m
57CONFIG_NF_CONNTRACK_IRC=m57CONFIG_NF_CONNTRACK_IRC=m
58CONFIG_NF_CONNTRACK_TFTP=m58CONFIG_NF_CONNTRACK_TFTP=m
59CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
60CONFIG_NETFILTER_XT_TARGET_TCPMSS=m59CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
61CONFIG_NETFILTER_XT_MATCH_LIMIT=m60CONFIG_NETFILTER_XT_MATCH_LIMIT=m
62CONFIG_NETFILTER_XT_MATCH_MAC=m61CONFIG_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
96CONFIG_NETFILTER_XT_TARGET_MARK=m96CONFIG_NETFILTER_XT_TARGET_MARK=m
97CONFIG_NETFILTER_XT_TARGET_NFLOG=m97CONFIG_NETFILTER_XT_TARGET_NFLOG=m
98CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m98CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
99CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
100CONFIG_NETFILTER_XT_TARGET_TRACE=m99CONFIG_NETFILTER_XT_TARGET_TRACE=m
101CONFIG_NETFILTER_XT_TARGET_SECMARK=m100CONFIG_NETFILTER_XT_TARGET_SECMARK=m
102CONFIG_NETFILTER_XT_TARGET_TCPMSS=m101CONFIG_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
87CONFIG_NETFILTER_XT_TARGET_MARK=m87CONFIG_NETFILTER_XT_TARGET_MARK=m
88CONFIG_NETFILTER_XT_TARGET_NFLOG=m88CONFIG_NETFILTER_XT_TARGET_NFLOG=m
89CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m89CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
90CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
91CONFIG_NETFILTER_XT_TARGET_TPROXY=m90CONFIG_NETFILTER_XT_TARGET_TPROXY=m
92CONFIG_NETFILTER_XT_TARGET_TRACE=m91CONFIG_NETFILTER_XT_TARGET_TRACE=m
93CONFIG_NETFILTER_XT_TARGET_SECMARK=m92CONFIG_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
60CONFIG_NETFILTER_XT_TARGET_MARK=m60CONFIG_NETFILTER_XT_TARGET_MARK=m
61CONFIG_NETFILTER_XT_TARGET_NFLOG=m61CONFIG_NETFILTER_XT_TARGET_NFLOG=m
62CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m62CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
63CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
64CONFIG_NETFILTER_XT_TARGET_SECMARK=m63CONFIG_NETFILTER_XT_TARGET_SECMARK=m
65CONFIG_NETFILTER_XT_TARGET_TCPMSS=m64CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
66CONFIG_NETFILTER_XT_MATCH_COMMENT=m65CONFIG_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
86CONFIG_NETFILTER_XT_TARGET_MARK=m86CONFIG_NETFILTER_XT_TARGET_MARK=m
87CONFIG_NETFILTER_XT_TARGET_NFLOG=m87CONFIG_NETFILTER_XT_TARGET_NFLOG=m
88CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m88CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
89CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
90CONFIG_NETFILTER_XT_TARGET_TPROXY=m89CONFIG_NETFILTER_XT_TARGET_TPROXY=m
91CONFIG_NETFILTER_XT_TARGET_TRACE=m90CONFIG_NETFILTER_XT_TARGET_TRACE=m
92CONFIG_NETFILTER_XT_TARGET_SECMARK=m91CONFIG_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
59CONFIG_NETFILTER_XT_TARGET_MARK=m59CONFIG_NETFILTER_XT_TARGET_MARK=m
60CONFIG_NETFILTER_XT_TARGET_NFLOG=m60CONFIG_NETFILTER_XT_TARGET_NFLOG=m
61CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m61CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
62CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
63CONFIG_NETFILTER_XT_TARGET_SECMARK=m62CONFIG_NETFILTER_XT_TARGET_SECMARK=m
64CONFIG_NETFILTER_XT_TARGET_TCPMSS=m63CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
65CONFIG_NETFILTER_XT_MATCH_COMMENT=m64CONFIG_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
108CONFIG_NETFILTER_XT_TARGET_MARK=m108CONFIG_NETFILTER_XT_TARGET_MARK=m
109CONFIG_NETFILTER_XT_TARGET_NFLOG=m109CONFIG_NETFILTER_XT_TARGET_NFLOG=m
110CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m110CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
111CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
112CONFIG_NETFILTER_XT_TARGET_TPROXY=m111CONFIG_NETFILTER_XT_TARGET_TPROXY=m
113CONFIG_NETFILTER_XT_TARGET_TRACE=m112CONFIG_NETFILTER_XT_TARGET_TRACE=m
114CONFIG_NETFILTER_XT_TARGET_SECMARK=m113CONFIG_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
109CONFIG_NETFILTER_XT_TARGET_MARK=m109CONFIG_NETFILTER_XT_TARGET_MARK=m
110CONFIG_NETFILTER_XT_TARGET_NFLOG=m110CONFIG_NETFILTER_XT_TARGET_NFLOG=m
111CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m111CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
112CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
113CONFIG_NETFILTER_XT_TARGET_TPROXY=m112CONFIG_NETFILTER_XT_TARGET_TPROXY=m
114CONFIG_NETFILTER_XT_TARGET_TRACE=m113CONFIG_NETFILTER_XT_TARGET_TRACE=m
115CONFIG_NETFILTER_XT_TARGET_SECMARK=m114CONFIG_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
68CONFIG_NETFILTER_XT_TARGET_MARK=m68CONFIG_NETFILTER_XT_TARGET_MARK=m
69CONFIG_NETFILTER_XT_TARGET_NFLOG=m69CONFIG_NETFILTER_XT_TARGET_NFLOG=m
70CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m70CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
71CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
72CONFIG_NETFILTER_XT_TARGET_SECMARK=m71CONFIG_NETFILTER_XT_TARGET_SECMARK=m
73CONFIG_NETFILTER_XT_TARGET_TCPMSS=m72CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
74CONFIG_NETFILTER_XT_MATCH_COMMENT=m73CONFIG_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
55CONFIG_NETFILTER_XT_TARGET_MARK=m55CONFIG_NETFILTER_XT_TARGET_MARK=m
56CONFIG_NETFILTER_XT_TARGET_NFLOG=m56CONFIG_NETFILTER_XT_TARGET_NFLOG=m
57CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m57CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
58CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
59CONFIG_NETFILTER_XT_TARGET_TRACE=m58CONFIG_NETFILTER_XT_TARGET_TRACE=m
60CONFIG_NETFILTER_XT_TARGET_TCPMSS=m59CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
61CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m60CONFIG_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
92CONFIG_NETFILTER_XT_TARGET_MARK=m92CONFIG_NETFILTER_XT_TARGET_MARK=m
93CONFIG_NETFILTER_XT_TARGET_NFLOG=m93CONFIG_NETFILTER_XT_TARGET_NFLOG=m
94CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m94CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
95CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
96CONFIG_NETFILTER_XT_TARGET_TPROXY=m95CONFIG_NETFILTER_XT_TARGET_TPROXY=m
97CONFIG_NETFILTER_XT_TARGET_TRACE=m96CONFIG_NETFILTER_XT_TARGET_TRACE=m
98CONFIG_NETFILTER_XT_TARGET_TCPMSS=m97CONFIG_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
66CONFIG_NETFILTER_XT_TARGET_MARK=m66CONFIG_NETFILTER_XT_TARGET_MARK=m
67CONFIG_NETFILTER_XT_TARGET_NFLOG=m67CONFIG_NETFILTER_XT_TARGET_NFLOG=m
68CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m68CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
69CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
70CONFIG_NETFILTER_XT_TARGET_TPROXY=m69CONFIG_NETFILTER_XT_TARGET_TPROXY=m
71CONFIG_NETFILTER_XT_TARGET_TRACE=m70CONFIG_NETFILTER_XT_TARGET_TRACE=m
72CONFIG_NETFILTER_XT_TARGET_TCPMSS=m71CONFIG_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
167CONFIG_NETFILTER_XT_TARGET_MARK=m167CONFIG_NETFILTER_XT_TARGET_MARK=m
168CONFIG_NETFILTER_XT_TARGET_NFLOG=m168CONFIG_NETFILTER_XT_TARGET_NFLOG=m
169CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m169CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
170CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
171CONFIG_NETFILTER_XT_TARGET_TPROXY=m170CONFIG_NETFILTER_XT_TARGET_TPROXY=m
172CONFIG_NETFILTER_XT_TARGET_TRACE=m171CONFIG_NETFILTER_XT_TARGET_TRACE=m
173CONFIG_NETFILTER_XT_TARGET_SECMARK=m172CONFIG_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
464 emit_alu_K(OR, K);464 emit_alu_K(OR, K);
465 break;465 break;
466 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */466 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
467 case BPF_S_ALU_XOR_X:
467 emit_alu_X(XOR);468 emit_alu_X(XOR);
468 break;469 break;
470 case BPF_S_ALU_XOR_K: /* A ^= K */
471 emit_alu_K(XOR, K);
472 break;
469 case BPF_S_ALU_LSH_X: /* A <<= X */473 case BPF_S_ALU_LSH_X: /* A <<= X */
470 emit_alu_X(SLL);474 emit_alu_X(SLL);
471 break;475 break;
arch/tile/configs/tilegx_defconfig+0−1
@@ -134,7 +134,6 @@ CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m · 133 unmodified lines
134CONFIG_NETFILTER_XT_TARGET_MARK=m134CONFIG_NETFILTER_XT_TARGET_MARK=m
135CONFIG_NETFILTER_XT_TARGET_NFLOG=m135CONFIG_NETFILTER_XT_TARGET_NFLOG=m
136CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m136CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
137CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
138CONFIG_NETFILTER_XT_TARGET_TEE=m137CONFIG_NETFILTER_XT_TARGET_TEE=m
139CONFIG_NETFILTER_XT_TARGET_TPROXY=m138CONFIG_NETFILTER_XT_TARGET_TPROXY=m
140CONFIG_NETFILTER_XT_TARGET_TRACE=m139CONFIG_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
132CONFIG_NETFILTER_XT_TARGET_MARK=m132CONFIG_NETFILTER_XT_TARGET_MARK=m
133CONFIG_NETFILTER_XT_TARGET_NFLOG=m133CONFIG_NETFILTER_XT_TARGET_NFLOG=m
134CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m134CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
135CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
136CONFIG_NETFILTER_XT_TARGET_TEE=m135CONFIG_NETFILTER_XT_TARGET_TEE=m
137CONFIG_NETFILTER_XT_TARGET_TPROXY=m136CONFIG_NETFILTER_XT_TARGET_TPROXY=m
138CONFIG_NETFILTER_XT_TARGET_TRACE=m137CONFIG_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
280 }280 }
281 EMIT4(0x31, 0xd2, 0xf7, 0xf3); /* xor %edx,%edx; div %ebx */281 EMIT4(0x31, 0xd2, 0xf7, 0xf3); /* xor %edx,%edx; div %ebx */
282 break;282 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;
283 case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K); */308 case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K); */
284 EMIT3(0x48, 0x69, 0xc0); /* imul imm32,%rax,%rax */309 EMIT3(0x48, 0x69, 0xc0); /* imul imm32,%rax,%rax */
285 EMIT(K, 4);310 EMIT(K, 4);
@@ -310,9 +335,18 @@ void bpf_jit_compile(struct sk_filter *fp) · 24 unmodified lines
310 EMIT1_off32(0x0d, K); /* or imm32,%eax */335 EMIT1_off32(0x0d, K); /* or imm32,%eax */
311 break;336 break;
312 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */337 case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
338 case BPF_S_ALU_XOR_X:
313 seen |= SEEN_XREG;339 seen |= SEEN_XREG;
314 EMIT2(0x31, 0xd8); /* xor %ebx,%eax */340 EMIT2(0x31, 0xd8); /* xor %ebx,%eax */
315 break;341 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;
316 case BPF_S_ALU_LSH_X: /* A <<= X; */350 case BPF_S_ALU_LSH_X: /* A <<= X; */
317 seen |= SEEN_XREG;351 seen |= SEEN_XREG;
318 EMIT4(0x89, 0xd9, 0xd3, 0xe0); /* mov %ebx,%ecx; shl %cl,%eax */352 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
166 struct crypto_user_alg *ualg;166 struct crypto_user_alg *ualg;
167 int err = 0;167 int err = 0;
168 168
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,
170 CRYPTO_MSG_GETALG, sizeof(*ualg), info->nlmsg_flags);170 CRYPTO_MSG_GETALG, sizeof(*ualg), info->nlmsg_flags);
171 if (!nlh) {171 if (!nlh) {
172 err = -EMSGSIZE;172 err = -EMSGSIZE;
@@ -216,7 +216,7 @@ static int crypto_report(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, · 43 unmodified lines
216 if (err)216 if (err)
217 return err;217 return err;
218 218
219 return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).pid);219 return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid);
220}220}
221 221
222static int crypto_dump_report(struct sk_buff *skb, struct netlink_callback *cb)222static 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
500 .input = crypto_netlink_rcv,500 .input = crypto_netlink_rcv,
501 };501 };
502 502
503 crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO,503 crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, &cfg);
504 THIS_MODULE, &cfg);
505 if (!crypto_nlsk)504 if (!crypto_nlsk)
506 return -ENOMEM;505 return -ENOMEM;
507 506
drivers/Makefile+0−1
@@ -123,7 +123,6 @@ obj-$(CONFIG_VHOST_NET) += vhost/ · 122 unmodified lines
123obj-$(CONFIG_VLYNQ) += vlynq/123obj-$(CONFIG_VLYNQ) += vlynq/
124obj-$(CONFIG_STAGING) += staging/124obj-$(CONFIG_STAGING) += staging/
125obj-y += platform/125obj-y += platform/
126obj-y += ieee802154/
127#common clk code126#common clk code
128obj-y += clk/127obj-y += clk/
129 128
drivers/bcma/Kconfig+2−2
@@ -48,12 +48,12 @@ config BCMA_DRIVER_MIPS · 47 unmodified lines
48 48
49config BCMA_SFLASH49config BCMA_SFLASH
50 bool50 bool
51 depends on BCMA_DRIVER_MIPS && BROKEN51 depends on BCMA_DRIVER_MIPS
52 default y52 default y
53 53
54config BCMA_NFLASH54config BCMA_NFLASH
55 bool55 bool
56 depends on BCMA_DRIVER_MIPS && BROKEN56 depends on BCMA_DRIVER_MIPS
57 default y57 default y
58 58
59config BCMA_DRIVER_GMAC_CMN59config 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
54#ifdef CONFIG_BCMA_SFLASH54#ifdef CONFIG_BCMA_SFLASH
55/* driver_chipcommon_sflash.c */55/* driver_chipcommon_sflash.c */
56int bcma_sflash_init(struct bcma_drv_cc *cc);56int bcma_sflash_init(struct bcma_drv_cc *cc);
57extern struct platform_device bcma_sflash_dev;
57#else58#else
58static inline int bcma_sflash_init(struct bcma_drv_cc *cc)59static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
59{60{
@@ -65,6 +66,7 @@ static inline int bcma_sflash_init(struct bcma_drv_cc *cc) · 5 unmodified lines
65#ifdef CONFIG_BCMA_NFLASH66#ifdef CONFIG_BCMA_NFLASH
66/* driver_chipcommon_nflash.c */67/* driver_chipcommon_nflash.c */
67int bcma_nflash_init(struct bcma_drv_cc *cc);68int bcma_nflash_init(struct bcma_drv_cc *cc);
69extern struct platform_device bcma_nflash_dev;
68#else70#else
69static inline int bcma_nflash_init(struct bcma_drv_cc *cc)71static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
70{72{
drivers/bcma/core.c+1−1
@@ -65,7 +65,7 @@ void bcma_core_set_clockmode(struct bcma_device *core, · 64 unmodified lines
65 switch (clkmode) {65 switch (clkmode) {
66 case BCMA_CLKMODE_FAST:66 case BCMA_CLKMODE_FAST:
67 bcma_set32(core, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);67 bcma_set32(core, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
68 udelay(64);68 usleep_range(64, 300);
69 for (i = 0; i < 1500; i++) {69 for (i = 0; i < 1500; i++) {
70 if (bcma_read32(core, BCMA_CLKCTLST) &70 if (bcma_read32(core, BCMA_CLKCTLST) &
71 BCMA_CLKCTLST_HAVEHT) {71 BCMA_CLKCTLST_HAVEHT) {
drivers/bcma/driver_chipcommon_nflash.c+25−3
@@ -5,15 +5,37 @@ · 4 unmodified lines
5 * Licensed under the GNU/GPL. See COPYING for details.5 * Licensed under the GNU/GPL. See COPYING for details.
6 */6 */
7 7
8#include <linux/platform_device.h>
8#include <linux/bcma/bcma.h>9#include <linux/bcma/bcma.h>
9#include <linux/bcma/bcma_driver_chipcommon.h>
10#include <linux/delay.h>
11 10
12#include "bcma_private.h"11#include "bcma_private.h"
13 12
13struct platform_device bcma_nflash_dev = {
14 .name = "bcma_nflash",
15 .num_resources = 0,
16};
17
14/* Initialize NAND flash access */18/* Initialize NAND flash access */
15int bcma_nflash_init(struct bcma_drv_cc *cc)19int bcma_nflash_init(struct bcma_drv_cc *cc)
16{20{
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
18 return 0;40 return 0;
19}41}
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
76 if (max_msk)76 if (max_msk)
77 bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);77 bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
78 78
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 */
80 mdelay(2);83 mdelay(2);
81}84}
82 85
@@ -101,7 +104,7 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable) · 18 unmodified lines
101 bcma_cc_write32(cc, BCMA_CC_CHIPCTL, val);104 bcma_cc_write32(cc, BCMA_CC_CHIPCTL, val);
102}105}
103 106
104void bcma_pmu_workarounds(struct bcma_drv_cc *cc)107static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
105{108{
106 struct bcma_bus *bus = cc->core->bus;109 struct bcma_bus *bus = cc->core->bus;
107 110
@@ -257,7 +260,7 @@ static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) · 149 unmodified lines
257}260}
258 261
259/* query bus clock frequency for PMU-enabled chipcommon */262/* query bus clock frequency for PMU-enabled chipcommon */
260u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)263static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
261{264{
262 struct bcma_bus *bus = cc->core->bus;265 struct bcma_bus *bus = cc->core->bus;
263 266
drivers/bcma/driver_chipcommon_sflash.c+120−3
@@ -5,15 +5,132 @@ · 4 unmodified lines
5 * Licensed under the GNU/GPL. See COPYING for details.5 * Licensed under the GNU/GPL. See COPYING for details.
6 */6 */
7 7
8#include <linux/platform_device.h>
8#include <linux/bcma/bcma.h>9#include <linux/bcma/bcma.h>
9#include <linux/bcma/bcma_driver_chipcommon.h>
10#include <linux/delay.h>
11 10
12#include "bcma_private.h"11#include "bcma_private.h"
13 12
13static struct resource bcma_sflash_resource = {
14 .name = "bcma_sflash",
15 .start = BCMA_SFLASH,
16 .end = 0,
17 .flags = IORESOURCE_MEM | IORESOURCE_READONLY,
18};
19
20struct platform_device bcma_sflash_dev = {
21 .name = "bcma_sflash",
22 .resource = &bcma_sflash_resource,
23 .num_resources = 1,
24};
25
26struct bcma_sflash_tbl_e {
27 char *name;
28 u32 id;
29 u32 blocksize;
30 u16 numblocks;
31};
32
33static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = {
34 { "", 0x14, 0x10000, 32, },
35 { 0 },
36};
37
38static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = {
39 { 0 },
40};
41
42static struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = {
43 { 0 },
44};
45
46static 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
14/* Initialize serial flash access */60/* Initialize serial flash access */
15int bcma_sflash_init(struct bcma_drv_cc *cc)61int bcma_sflash_init(struct bcma_drv_cc *cc)
16{62{
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
18 return 0;135 return 0;
19}136}
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
51 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);51 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
52 if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)52 if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)
53 break;53 break;
54 msleep(1);54 usleep_range(1000, 2000);
55 }55 }
56}56}
57 57
@@ -92,7 +92,7 @@ static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address) · 34 unmodified lines
92 ret = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_DATA);92 ret = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_DATA);
93 break;93 break;
94 }94 }
95 msleep(1);95 usleep_range(1000, 2000);
96 }96 }
97 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);97 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
98 return ret;98 return ret;
@@ -132,7 +132,7 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device, · 33 unmodified lines
132 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);132 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
133 if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)133 if (v & BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE)
134 break;134 break;
135 msleep(1);135 usleep_range(1000, 2000);
136 }136 }
137 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);137 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
138}138}
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
425 pc_host->io_resource.flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED;425 pc_host->io_resource.flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED;
426 426
427 /* Reset RC */427 /* Reset RC */
428 udelay(3000);428 usleep_range(3000, 5000);
429 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST_OE);429 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST_OE);
430 udelay(1000);430 usleep_range(1000, 2000);
431 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST |431 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST |
432 BCMA_CORE_PCI_CTL_RST_OE);432 BCMA_CORE_PCI_CTL_RST_OE);
433 433
@@ -481,7 +481,7 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 47 unmodified lines
481 * before issuing configuration requests to PCI Express481 * before issuing configuration requests to PCI Express
482 * devices.482 * devices.
483 */483 */
484 udelay(100000);484 msleep(100);
485 485
486 bcma_core_pci_enable_crs(pc);486 bcma_core_pci_enable_crs(pc);
487 487
@@ -501,7 +501,7 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 13 unmodified lines
501 set_io_port_base(pc_host->pci_controller.io_map_base);501 set_io_port_base(pc_host->pci_controller.io_map_base);
502 /* Give some time to the PCI controller to configure itself with the new502 /* Give some time to the PCI controller to configure itself with the new
503 * values. Not waiting at this point causes crashes of the machine. */503 * values. Not waiting at this point causes crashes of the machine. */
504 mdelay(10);504 usleep_range(10000, 15000);
505 register_pci_controller(&pc_host->pci_controller);505 register_pci_controller(&pc_host->pci_controller);
506 return;506 return;
507}507}
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
77}77}
78 78
79#ifdef CONFIG_BCMA_BLOCKIO79#ifdef CONFIG_BCMA_BLOCKIO
80void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,80static void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,
81 size_t count, u16 offset, u8 reg_width)81 size_t count, u16 offset, u8 reg_width)
82{82{
83 void __iomem *addr = core->bus->mmio + offset;83 void __iomem *addr = core->bus->mmio + offset;
84 if (core->bus->mapped_core != core)84 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
100 }100 }
101}101}
102 102
103void bcma_host_pci_block_write(struct bcma_device *core, const void *buffer,103static void bcma_host_pci_block_write(struct bcma_device *core,
104 size_t count, u16 offset, u8 reg_width)104 const void *buffer, size_t count,
105 u16 offset, u8 reg_width)
105{106{
106 void __iomem *addr = core->bus->mmio + offset;107 void __iomem *addr = core->bus->mmio + offset;
107 if (core->bus->mapped_core != core)108 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
139 iowrite32(value, core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset);140 iowrite32(value, core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset);
140}141}
141 142
142const struct bcma_host_ops bcma_host_pci_ops = {143static const struct bcma_host_ops bcma_host_pci_ops = {
143 .read8 = bcma_host_pci_read8,144 .read8 = bcma_host_pci_read8,
144 .read16 = bcma_host_pci_read16,145 .read16 = bcma_host_pci_read16,
145 .read32 = bcma_host_pci_read32,146 .read32 = bcma_host_pci_read32,
@@ -272,6 +273,7 @@ static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { · 126 unmodified lines
272 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },273 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
273 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },274 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },
274 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },275 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
276 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
275 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },277 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
276 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },278 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
277 { 0, },279 { 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
143 writel(value, core->io_wrap + offset);143 writel(value, core->io_wrap + offset);
144}144}
145 145
146const struct bcma_host_ops bcma_host_soc_ops = {146static const struct bcma_host_ops bcma_host_soc_ops = {
147 .read8 = bcma_host_soc_read8,147 .read8 = bcma_host_soc_read8,
148 .read16 = bcma_host_soc_read16,148 .read16 = bcma_host_soc_read16,
149 .read32 = bcma_host_soc_read32,149 .read32 = bcma_host_soc_read32,
drivers/bcma/main.c+27−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7 7
8#include "bcma_private.h"8#include "bcma_private.h"
9#include <linux/module.h>9#include <linux/module.h>
10#include <linux/platform_device.h>
10#include <linux/bcma/bcma.h>11#include <linux/bcma/bcma.h>
11#include <linux/slab.h>12#include <linux/slab.h>
12 13
@@ -136,6 +137,22 @@ static int bcma_register_cores(struct bcma_bus *bus) · 123 unmodified lines
136 dev_id++;137 dev_id++;
137 }138 }
138 139
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
139 return 0;156 return 0;
140}157}
141 158
@@ -210,7 +227,17 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) · 68 unmodified lines
210 227
211void bcma_bus_unregister(struct bcma_bus *bus)228void bcma_bus_unregister(struct bcma_bus *bus)
212{229{
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
213 bcma_unregister_cores(bus);236 bcma_unregister_cores(bus);
237
238 kfree(cores[2]);
239 kfree(cores[1]);
240 kfree(cores[0]);
214}241}
215 242
216int __init bcma_bus_early_register(struct bcma_bus *bus,243int __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
507 /* for these chips OTP is always available */507 /* for these chips OTP is always available */
508 present = true;508 present = true;
509 break;509 break;
510 case BCMA_CHIP_ID_BCM43227:
510 case BCMA_CHIP_ID_BCM43228:511 case BCMA_CHIP_ID_BCM43228:
512 case BCMA_CHIP_ID_BCM43428:
511 present = chip_status & BCMA_CC_CHIPST_43228_OTP_PRESENT;513 present = chip_status & BCMA_CC_CHIPST_43228_OTP_PRESENT;
512 break;514 break;
513 default:515 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
177 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)177 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
178 return -ENODEV;178 return -ENODEV;
179 179
180 data = kzalloc(sizeof(*data), GFP_KERNEL);180 data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
181 if (!data) {181 if (!data) {
182 BT_ERR("Can't allocate memory for data structure");182 BT_ERR("Can't allocate memory for data structure");
183 return -ENOMEM;183 return -ENOMEM;
@@ -189,14 +189,12 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 5 unmodified lines
189 data->urb = usb_alloc_urb(0, GFP_KERNEL);189 data->urb = usb_alloc_urb(0, GFP_KERNEL);
190 if (!data->urb) {190 if (!data->urb) {
191 BT_ERR("Can't allocate URB");191 BT_ERR("Can't allocate URB");
192 kfree(data);
193 return -ENOMEM;192 return -ENOMEM;
194 }193 }
195 194
196 if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) {195 if (request_firmware(&firmware, "BCM2033-MD.hex", &udev->dev) < 0) {
197 BT_ERR("Mini driver request failed");196 BT_ERR("Mini driver request failed");
198 usb_free_urb(data->urb);197 usb_free_urb(data->urb);
199 kfree(data);
200 return -EIO;198 return -EIO;
201 }199 }
202 200
@@ -209,7 +207,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 6 unmodified lines
209 BT_ERR("Can't allocate memory for mini driver");207 BT_ERR("Can't allocate memory for mini driver");
210 release_firmware(firmware);208 release_firmware(firmware);
211 usb_free_urb(data->urb);209 usb_free_urb(data->urb);
212 kfree(data);
213 return -ENOMEM;210 return -ENOMEM;
214 }211 }
215 212
@@ -224,7 +221,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 8 unmodified lines
224 BT_ERR("Firmware request failed");221 BT_ERR("Firmware request failed");
225 usb_free_urb(data->urb);222 usb_free_urb(data->urb);
226 kfree(data->buffer);223 kfree(data->buffer);
227 kfree(data);
228 return -EIO;224 return -EIO;
229 }225 }
230 226
@@ -236,7 +232,6 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id · 5 unmodified lines
236 release_firmware(firmware);232 release_firmware(firmware);
237 usb_free_urb(data->urb);233 usb_free_urb(data->urb);
238 kfree(data->buffer);234 kfree(data->buffer);
239 kfree(data);
240 return -ENOMEM;235 return -ENOMEM;
241 }236 }
242 237
@@ -271,7 +266,6 @@ static void bcm203x_disconnect(struct usb_interface *intf) · 28 unmodified lines
271 usb_free_urb(data->urb);266 usb_free_urb(data->urb);
272 kfree(data->fw_data);267 kfree(data->fw_data);
273 kfree(data->buffer);268 kfree(data->buffer);
274 kfree(data);
275}269}
276 270
277static struct usb_driver bcm203x_driver = {271static 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
653 }653 }
654 654
655 /* Initialize control structure and load firmware */655 /* 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);
657 if (!data) {657 if (!data) {
658 BT_ERR("Can't allocate memory for control structure");658 BT_ERR("Can't allocate memory for control structure");
659 goto done;659 goto done;
@@ -674,7 +674,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 14 unmodified lines
674 674
675 if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) {675 if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) {
676 BT_ERR("Firmware request failed");676 BT_ERR("Firmware request failed");
677 goto error;677 goto done;
678 }678 }
679 679
680 BT_DBG("firmware data %p size %zu", firmware->data, firmware->size);680 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
690 hdev = hci_alloc_dev();690 hdev = hci_alloc_dev();
691 if (!hdev) {691 if (!hdev) {
692 BT_ERR("Can't allocate HCI device");692 BT_ERR("Can't allocate HCI device");
693 goto error;693 goto done;
694 }694 }
695 695
696 data->hdev = hdev;696 data->hdev = hdev;
@@ -708,7 +708,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 11 unmodified lines
708 if (hci_register_dev(hdev) < 0) {708 if (hci_register_dev(hdev) < 0) {
709 BT_ERR("Can't register HCI device");709 BT_ERR("Can't register HCI device");
710 hci_free_dev(hdev);710 hci_free_dev(hdev);
711 goto error;711 goto done;
712 }712 }
713 713
714 usb_set_intfdata(intf, data);714 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
718release:718release:
719 release_firmware(firmware);719 release_firmware(firmware);
720 720
721error:
722 kfree(data);
723
724done:721done:
725 return -EIO;722 return -EIO;
726}723}
@@ -741,7 +738,6 @@ static void bfusb_disconnect(struct usb_interface *intf) · 14 unmodified lines
741 738
742 hci_unregister_dev(hdev);739 hci_unregister_dev(hdev);
743 hci_free_dev(hdev);740 hci_free_dev(hdev);
744 kfree(data);
745}741}
746 742
747static struct usb_driver bfusb_driver = {743static 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
681 case HCI_SCODATA_PKT:681 case HCI_SCODATA_PKT:
682 hdev->stat.sco_tx++;682 hdev->stat.sco_tx++;
683 break;683 break;
684 };684 }
685 685
686 /* Prepend skb with frame type */686 /* Prepend skb with frame type */
687 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);687 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
849 bluecard_info_t *info;849 bluecard_info_t *info;
850 850
851 /* Create new info device */851 /* Create new info device */
852 info = kzalloc(sizeof(*info), GFP_KERNEL);852 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
853 if (!info)853 if (!info)
854 return -ENOMEM;854 return -ENOMEM;
855 855
@@ -864,10 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link) · 8 unmodified lines
864 864
865static void bluecard_detach(struct pcmcia_device *link)865static void bluecard_detach(struct pcmcia_device *link)
866{866{
867 bluecard_info_t *info = link->priv;
868
869 bluecard_release(link);867 bluecard_release(link);
870 kfree(info);
871}868}
872 869
873 870
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
443 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)443 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
444 return -ENODEV;444 return -ENODEV;
445 445
446 data = kzalloc(sizeof(*data), GFP_KERNEL);446 data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
447 if (!data)447 if (!data)
448 return -ENOMEM;448 return -ENOMEM;
449 449
@@ -453,10 +453,8 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * · 3 unmodified lines
453 init_usb_anchor(&data->rx_anchor);453 init_usb_anchor(&data->rx_anchor);
454 454
455 hdev = hci_alloc_dev();455 hdev = hci_alloc_dev();
456 if (!hdev) {456 if (!hdev)
457 kfree(data);
458 return -ENOMEM;457 return -ENOMEM;
459 }
460 458
461 hdev->bus = HCI_USB;459 hdev->bus = HCI_USB;
462 hci_set_drvdata(hdev, data);460 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
475 err = hci_register_dev(hdev);473 err = hci_register_dev(hdev);
476 if (err < 0) {474 if (err < 0) {
477 hci_free_dev(hdev);475 hci_free_dev(hdev);
478 kfree(data);
479 return err;476 return err;
480 }477 }
481 478
@@ -500,7 +497,6 @@ static void bpa10x_disconnect(struct usb_interface *intf) · 18 unmodified lines
500 hci_free_dev(data->hdev);497 hci_free_dev(data->hdev);
501 kfree_skb(data->rx_skb[0]);498 kfree_skb(data->rx_skb[0]);
502 kfree_skb(data->rx_skb[1]);499 kfree_skb(data->rx_skb[1]);
503 kfree(data);
504}500}
505 501
506static struct usb_driver bpa10x_driver = {502static 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
638 bt3c_info_t *info;638 bt3c_info_t *info;
639 639
640 /* Create new info device */640 /* Create new info device */
641 info = kzalloc(sizeof(*info), GFP_KERNEL);641 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
642 if (!info)642 if (!info)
643 return -ENOMEM;643 return -ENOMEM;
644 644
@@ -654,10 +654,7 @@ static int bt3c_probe(struct pcmcia_device *link) · 9 unmodified lines
654 654
655static void bt3c_detach(struct pcmcia_device *link)655static void bt3c_detach(struct pcmcia_device *link)
656{656{
657 bt3c_info_t *info = link->priv;
658
659 bt3c_release(link);657 bt3c_release(link);
660 kfree(info);
661}658}
662 659
663static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)660static 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
600exit:600exit:
601 if (ret) {601 if (ret) {
602 hdev->stat.err_rx++;602 hdev->stat.err_rx++;
603 if (skb)603 kfree_skb(skb);
604 kfree_skb(skb);
605 }604 }
606 605
607 return ret;606 return ret;
@@ -956,11 +955,9 @@ static int btmrvl_sdio_probe(struct sdio_func *func, · 348 unmodified lines
956 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",955 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
957 id->vendor, id->device, id->class, func->num);956 id->vendor, id->device, id->class, func->num);
958 957
959 card = kzalloc(sizeof(*card), GFP_KERNEL);958 card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL);
960 if (!card) {959 if (!card)
961 ret = -ENOMEM;960 return -ENOMEM;
962 goto done;
963 }
964 961
965 card->func = func;962 card->func = func;
966 963
@@ -974,8 +971,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func, · 7 unmodified lines
974 971
975 if (btmrvl_sdio_register_dev(card) < 0) {972 if (btmrvl_sdio_register_dev(card) < 0) {
976 BT_ERR("Failed to register BT device!");973 BT_ERR("Failed to register BT device!");
977 ret = -ENODEV;974 return -ENODEV;
978 goto free_card;
979 }975 }
980 976
981 /* Disable the interrupts on the card */977 /* Disable the interrupts on the card */
@@ -1023,9 +1019,6 @@ disable_host_int: · 41 unmodified lines
1023 btmrvl_sdio_disable_host_int(card);1019 btmrvl_sdio_disable_host_int(card);
1024unreg_dev:1020unreg_dev:
1025 btmrvl_sdio_unregister_dev(card);1021 btmrvl_sdio_unregister_dev(card);
1026free_card:
1027 kfree(card);
1028done:
1029 return ret;1022 return ret;
1030}1023}
1031 1024
@@ -1047,7 +1040,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func) · 15 unmodified lines
1047 BT_DBG("unregester dev");1040 BT_DBG("unregester dev");
1048 btmrvl_sdio_unregister_dev(card);1041 btmrvl_sdio_unregister_dev(card);
1049 btmrvl_remove_card(card->priv);1042 btmrvl_remove_card(card->priv);
1050 kfree(card);
1051 }1043 }
1052 }1044 }
1053}1045}
drivers/bluetooth/btsdio.c+2−6
@@ -304,7 +304,7 @@ static int btsdio_probe(struct sdio_func *func, · 303 unmodified lines
304 tuple = tuple->next;304 tuple = tuple->next;
305 }305 }
306 306
307 data = kzalloc(sizeof(*data), GFP_KERNEL);307 data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL);
308 if (!data)308 if (!data)
309 return -ENOMEM;309 return -ENOMEM;
310 310
@@ -315,10 +315,8 @@ static int btsdio_probe(struct sdio_func *func, · 4 unmodified lines
315 skb_queue_head_init(&data->txq);315 skb_queue_head_init(&data->txq);
316 316
317 hdev = hci_alloc_dev();317 hdev = hci_alloc_dev();
318 if (!hdev) {318 if (!hdev)
319 kfree(data);
320 return -ENOMEM;319 return -ENOMEM;
321 }
322 320
323 hdev->bus = HCI_SDIO;321 hdev->bus = HCI_SDIO;
324 hci_set_drvdata(hdev, data);322 hci_set_drvdata(hdev, data);
@@ -340,7 +338,6 @@ static int btsdio_probe(struct sdio_func *func, · 15 unmodified lines
340 err = hci_register_dev(hdev);338 err = hci_register_dev(hdev);
341 if (err < 0) {339 if (err < 0) {
342 hci_free_dev(hdev);340 hci_free_dev(hdev);
343 kfree(data);
344 return err;341 return err;
345 }342 }
346 343
@@ -366,7 +363,6 @@ static void btsdio_remove(struct sdio_func *func) · 19 unmodified lines
366 hci_unregister_dev(hdev);363 hci_unregister_dev(hdev);
367 364
368 hci_free_dev(hdev);365 hci_free_dev(hdev);
369 kfree(data);
370}366}
371 367
372static struct sdio_driver btsdio_driver = {368static 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
446 case HCI_SCODATA_PKT:446 case HCI_SCODATA_PKT:
447 hdev->stat.sco_tx++;447 hdev->stat.sco_tx++;
448 break;448 break;
449 };449 }
450 450
451 /* Prepend skb with frame type */451 /* Prepend skb with frame type */
452 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);452 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
567 btuart_info_t *info;567 btuart_info_t *info;
568 568
569 /* Create new info device */569 /* Create new info device */
570 info = kzalloc(sizeof(*info), GFP_KERNEL);570 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
571 if (!info)571 if (!info)
572 return -ENOMEM;572 return -ENOMEM;
573 573
@@ -583,10 +583,7 @@ static int btuart_probe(struct pcmcia_device *link) · 9 unmodified lines
583 583
584static void btuart_detach(struct pcmcia_device *link)584static void btuart_detach(struct pcmcia_device *link)
585{585{
586 btuart_info_t *info = link->priv;
587
588 btuart_release(link);586 btuart_release(link);
589 kfree(info);
590}587}
591 588
592static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)589static 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
96 { USB_DEVICE(0x0c10, 0x0000) },96 { USB_DEVICE(0x0c10, 0x0000) },
97 97
98 /* Broadcom BCM20702A0 */98 /* Broadcom BCM20702A0 */
99 { USB_DEVICE(0x04ca, 0x2003) },
99 { USB_DEVICE(0x0489, 0xe042) },100 { USB_DEVICE(0x0489, 0xe042) },
100 { USB_DEVICE(0x413c, 0x8197) },101 { USB_DEVICE(0x413c, 0x8197) },
101 102
102 /* Foxconn - Hon Hai */103 /* Foxconn - Hon Hai */
103 { USB_DEVICE(0x0489, 0xe033) },104 { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01) },
104 105
105 /*Broadcom devices with vendor specific id */106 /*Broadcom devices with vendor specific id */
106 { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },107 { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
@@ -956,7 +957,7 @@ static int btusb_probe(struct usb_interface *intf, · 849 unmodified lines
956 return -ENODEV;957 return -ENODEV;
957 }958 }
958 959
959 data = kzalloc(sizeof(*data), GFP_KERNEL);960 data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
960 if (!data)961 if (!data)
961 return -ENOMEM;962 return -ENOMEM;
962 963
@@ -979,10 +980,8 @@ static int btusb_probe(struct usb_interface *intf, · 16 unmodified lines
979 }980 }
980 }981 }
981 982
982 if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) {983 if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep)
983 kfree(data);
984 return -ENODEV;984 return -ENODEV;
985 }
986 985
987 data->cmdreq_type = USB_TYPE_CLASS;986 data->cmdreq_type = USB_TYPE_CLASS;
988 987
@@ -1002,10 +1001,8 @@ static int btusb_probe(struct usb_interface *intf, · 13 unmodified lines
1002 init_usb_anchor(&data->deferred);1001 init_usb_anchor(&data->deferred);
1003 1002
1004 hdev = hci_alloc_dev();1003 hdev = hci_alloc_dev();
1005 if (!hdev) {1004 if (!hdev)
1006 kfree(data);
1007 return -ENOMEM;1005 return -ENOMEM;
1008 }
1009 1006
1010 hdev->bus = HCI_USB;1007 hdev->bus = HCI_USB;
1011 hci_set_drvdata(hdev, data);1008 hci_set_drvdata(hdev, data);
@@ -1073,7 +1070,6 @@ static int btusb_probe(struct usb_interface *intf, · 61 unmodified lines
1073 data->isoc, data);1070 data->isoc, data);
1074 if (err < 0) {1071 if (err < 0) {
1075 hci_free_dev(hdev);1072 hci_free_dev(hdev);
1076 kfree(data);
1077 return err;1073 return err;
1078 }1074 }
1079 }1075 }
@@ -1081,7 +1077,6 @@ static int btusb_probe(struct usb_interface *intf, · 1 unmodified line
1081 err = hci_register_dev(hdev);1077 err = hci_register_dev(hdev);
1082 if (err < 0) {1078 if (err < 0) {
1083 hci_free_dev(hdev);1079 hci_free_dev(hdev);
1084 kfree(data);
1085 return err;1080 return err;
1086 }1081 }
1087 1082
@@ -1114,7 +1109,6 @@ static void btusb_disconnect(struct usb_interface *intf) · 26 unmodified lines
1114 usb_driver_release_interface(&btusb_driver, data->isoc);1109 usb_driver_release_interface(&btusb_driver, data->isoc);
1115 1110
1116 hci_free_dev(hdev);1111 hci_free_dev(hdev);
1117 kfree(data);
1118}1112}
1119 1113
1120#ifdef CONFIG_PM1114#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
297 struct hci_dev *hdev;297 struct hci_dev *hdev;
298 int err;298 int err;
299 299
300 hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL);300 hst = devm_kzalloc(&pdev->dev, sizeof(struct ti_st), GFP_KERNEL);
301 if (!hst)301 if (!hst)
302 return -ENOMEM;302 return -ENOMEM;
303 303
304 /* Expose "hciX" device to user space */304 /* Expose "hciX" device to user space */
305 hdev = hci_alloc_dev();305 hdev = hci_alloc_dev();
306 if (!hdev) {306 if (!hdev)
307 kfree(hst);
308 return -ENOMEM;307 return -ENOMEM;
309 }
310 308
311 BT_DBG("hdev %p", hdev);309 BT_DBG("hdev %p", hdev);
312 310
@@ -321,7 +319,6 @@ static int bt_ti_probe(struct platform_device *pdev) · 8 unmodified lines
321 err = hci_register_dev(hdev);319 err = hci_register_dev(hdev);
322 if (err < 0) {320 if (err < 0) {
323 BT_ERR("Can't register HCI device error %d", err);321 BT_ERR("Can't register HCI device error %d", err);
324 kfree(hst);
325 hci_free_dev(hdev);322 hci_free_dev(hdev);
326 return err;323 return err;
327 }324 }
@@ -347,7 +344,6 @@ static int bt_ti_remove(struct platform_device *pdev) · 19 unmodified lines
347 hci_unregister_dev(hdev);344 hci_unregister_dev(hdev);
348 345
349 hci_free_dev(hdev);346 hci_free_dev(hdev);
350 kfree(hst);
351 347
352 dev_set_drvdata(&pdev->dev, NULL);348 dev_set_drvdata(&pdev->dev, NULL);
353 return 0;349 return 0;
@@ -362,21 +358,7 @@ static struct platform_driver btwilink_driver = { · 8 unmodified lines
362 },358 },
363};359};
364 360
365/* ------- Module Init/Exit interfaces ------ */361module_platform_driver(btwilink_driver);
366static 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
373static void __exit btwilink_exit(void)
374{
375 platform_driver_unregister(&btwilink_driver);
376}
377
378module_init(btwilink_init);
379module_exit(btwilink_exit);
380 362
381/* ------ Module Info ------ */363/* ------ Module Info ------ */
382 364
drivers/bluetooth/dtl1_cs.c+1−2
@@ -550,7 +550,7 @@ static int dtl1_probe(struct pcmcia_device *link) · 549 unmodified lines
550 dtl1_info_t *info;550 dtl1_info_t *info;
551 551
552 /* Create new info device */552 /* Create new info device */
553 info = kzalloc(sizeof(*info), GFP_KERNEL);553 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
554 if (!info)554 if (!info)
555 return -ENOMEM;555 return -ENOMEM;
556 556
@@ -569,7 +569,6 @@ static void dtl1_detach(struct pcmcia_device *link) · 12 unmodified lines
569 569
570 dtl1_close(info);570 dtl1_close(info);
571 pcmcia_disable_device(link);571 pcmcia_disable_device(link);
572 kfree(info);
573}572}
574 573
575static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)574static 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
531 default:531 default:
532 err = n_tty_ioctl_helper(tty, file, cmd, arg);532 err = n_tty_ioctl_helper(tty, file, cmd, arg);
533 break;533 break;
534 };534 }
535 535
536 return err;536 return err;
537}537}
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
481 hu->hdev->stat.err_rx++;481 hu->hdev->stat.err_rx++;
482 ptr++; count--;482 ptr++; count--;
483 continue;483 continue;
484 };484 }
485 485
486 ptr++; count--;486 ptr++; count--;
487 487
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
156 case HCI_SCODATA_PKT:156 case HCI_SCODATA_PKT:
157 data->hdev->stat.sco_tx++;157 data->hdev->stat.sco_tx++;
158 break;158 break;
159 };159 }
160 160
161 return total;161 return total;
162}162}
drivers/connector/connector.c+1−2
@@ -264,8 +264,7 @@ static int __devinit cn_init(void) · 263 unmodified lines
264 .input = dev->input,264 .input = dev->input,
265 };265 };
266 266
267 dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR,267 dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, &cfg);
268 THIS_MODULE, &cfg);
269 if (!dev->nls)268 if (!dev->nls)
270 return -EIO;269 return -EIO;
271 270
drivers/infiniband/core/netlink.c+1−1
@@ -177,7 +177,7 @@ int __init ibnl_init(void) · 176 unmodified lines
177 .input = ibnl_rcv,177 .input = ibnl_rcv,
178 };178 };
179 179
180 nls = netlink_kernel_create(&init_net, NETLINK_RDMA, THIS_MODULE, &cfg);180 nls = netlink_kernel_create(&init_net, NETLINK_RDMA, &cfg);
181 if (!nls) {181 if (!nls) {
182 pr_warn("Failed to create netlink socket\n");182 pr_warn("Failed to create netlink socket\n");
183 return -ENOMEM;183 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
1155 */1155 */
1156 if (cxgb4_dbfifo_count(qhp->rhp->rdev.lldi.ports[0], 1) <1156 if (cxgb4_dbfifo_count(qhp->rhp->rdev.lldi.ports[0], 1) <
1157 (qhp->rhp->rdev.lldi.dbfifo_int_thresh << 5)) {1157 (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);
1159 break;1159 break;
1160 }1160 }
1161 set_current_state(TASK_UNINTERRUPTIBLE);1161 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
5 ipoib_multicast.o \5 ipoib_multicast.o \
6 ipoib_verbs.o \6 ipoib_verbs.o \
7 ipoib_vlan.o \7 ipoib_vlan.o \
8 ipoib_ethtool.o8 ipoib_ethtool.o \
9 ipoib_netlink.o
9ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_CM) += ipoib_cm.o10ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_CM) += ipoib_cm.o
10ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_DEBUG) += ipoib_fs.o11ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_DEBUG) += ipoib_fs.o
11 12
drivers/infiniband/ulp/ipoib/ipoib.h+16−0
@@ -104,6 +104,10 @@ enum { · 103 unmodified lines
104 104
105 MAX_SEND_CQE = 16,105 MAX_SEND_CQE = 16,
106 IPOIB_CM_COPYBREAK = 256,106 IPOIB_CM_COPYBREAK = 256,
107
108 IPOIB_NON_CHILD = 0,
109 IPOIB_LEGACY_CHILD = 1,
110 IPOIB_RTNL_CHILD = 2,
107};111};
108 112
109#define IPOIB_OP_RECV (1ul << 31)113#define IPOIB_OP_RECV (1ul << 31)
@@ -353,6 +357,7 @@ struct ipoib_dev_priv { · 243 unmodified lines
353 struct net_device *parent;357 struct net_device *parent;
354 struct list_head child_intfs;358 struct list_head child_intfs;
355 struct list_head list;359 struct list_head list;
360 int child_type;
356 361
357#ifdef CONFIG_INFINIBAND_IPOIB_CM362#ifdef CONFIG_INFINIBAND_IPOIB_CM
358 struct ipoib_cm_dev_priv cm;363 struct ipoib_cm_dev_priv cm;
@@ -512,6 +517,17 @@ void ipoib_event(struct ib_event_handler *handler, · 153 unmodified lines
512int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey);517int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey);
513int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);518int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);
514 519
520int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
521 u16 pkey, int child_type);
522
523int __init ipoib_netlink_init(void);
524void __exit ipoib_netlink_fini(void);
525
526void ipoib_set_umcast(struct net_device *ndev, int umcast_val);
527int ipoib_set_mode(struct net_device *dev, const char *buf);
528
529void ipoib_setup(struct net_device *dev);
530
515void ipoib_pkey_poll(struct work_struct *work);531void ipoib_pkey_poll(struct work_struct *work);
516int ipoib_pkey_dev_delay_open(struct net_device *dev);532int ipoib_pkey_dev_delay_open(struct net_device *dev);
517void ipoib_drain_cq(struct net_device *dev);533void 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
1448 return sprintf(buf, "datagram\n");1448 return sprintf(buf, "datagram\n");
1449}1449}
1450 1450
1451static ssize_t set_mode(struct device *d, struct device_attribute *attr,1451int ipoib_set_mode(struct net_device *dev, const char *buf)
1452 const char *buf, size_t count)
1453{1452{
1454 struct net_device *dev = to_net_dev(d);
1455 struct ipoib_dev_priv *priv = netdev_priv(dev);1453 struct ipoib_dev_priv *priv = netdev_priv(dev);
1456 1454
1457 if (!rtnl_trylock())
1458 return restart_syscall();
1459
1460 /* flush paths if we switch modes so that connections are restarted */1455 /* flush paths if we switch modes so that connections are restarted */
1461 if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) {1456 if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) {
1462 set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);1457 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
1467 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;1462 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
1468 1463
1469 ipoib_flush_paths(dev);1464 ipoib_flush_paths(dev);
1470 return count;1465 rtnl_lock();
1466 return 0;
1471 }1467 }
1472 1468
1473 if (!strcmp(buf, "datagram\n")) {1469 if (!strcmp(buf, "datagram\n")) {
@@ -1476,14 +1472,32 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, · 2 unmodified lines
1476 dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));1472 dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
1477 rtnl_unlock();1473 rtnl_unlock();
1478 ipoib_flush_paths(dev);1474 ipoib_flush_paths(dev);
1479 1475 rtnl_lock();
1480 return count;1476 return 0;
1481 }1477 }
1482 rtnl_unlock();
1483 1478
1484 return -EINVAL;1479 return -EINVAL;
1485}1480}
1486 1481
1482static 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
1487static DEVICE_ATTR(mode, S_IWUSR | S_IRUGO, show_mode, set_mode);1501static DEVICE_ATTR(mode, S_IWUSR | S_IRUGO, show_mode, set_mode);
1488 1502
1489int ipoib_cm_add_mode_attr(struct net_device *dev)1503int 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
173 return 0;173 return 0;
174}174}
175 175
176static void ipoib_uninit(struct net_device *dev)
177{
178 ipoib_dev_cleanup(dev);
179}
180
176static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features)181static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features)
177{182{
178 struct ipoib_dev_priv *priv = netdev_priv(dev);183 struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -1257,6 +1262,9 @@ out: · 1078 unmodified lines
1257void ipoib_dev_cleanup(struct net_device *dev)1262void ipoib_dev_cleanup(struct net_device *dev)
1258{1263{
1259 struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv;1264 struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv;
1265 LIST_HEAD(head);
1266
1267 ASSERT_RTNL();
1260 1268
1261 ipoib_delete_debug_files(dev);1269 ipoib_delete_debug_files(dev);
1262 1270
@@ -1265,10 +1273,9 @@ void ipoib_dev_cleanup(struct net_device *dev) · 2 unmodified lines
1265 /* Stop GC on child */1273 /* Stop GC on child */
1266 set_bit(IPOIB_STOP_NEIGH_GC, &cpriv->flags);1274 set_bit(IPOIB_STOP_NEIGH_GC, &cpriv->flags);
1267 cancel_delayed_work(&cpriv->neigh_reap_task);1275 cancel_delayed_work(&cpriv->neigh_reap_task);
1268 unregister_netdev(cpriv->dev);1276 unregister_netdevice_queue(cpriv->dev, &head);
1269 ipoib_dev_cleanup(cpriv->dev);
1270 free_netdev(cpriv->dev);
1271 }1277 }
1278 unregister_netdevice_many(&head);
1272 1279
1273 ipoib_ib_dev_cleanup(dev);1280 ipoib_ib_dev_cleanup(dev);
1274 1281
@@ -1286,6 +1293,7 @@ static const struct header_ops ipoib_header_ops = { · 11 unmodified lines
1286};1293};
1287 1294
1288static const struct net_device_ops ipoib_netdev_ops = {1295static const struct net_device_ops ipoib_netdev_ops = {
1296 .ndo_uninit = ipoib_uninit,
1289 .ndo_open = ipoib_open,1297 .ndo_open = ipoib_open,
1290 .ndo_stop = ipoib_stop,1298 .ndo_stop = ipoib_stop,
1291 .ndo_change_mtu = ipoib_change_mtu,1299 .ndo_change_mtu = ipoib_change_mtu,
@@ -1295,7 +1303,7 @@ static const struct net_device_ops ipoib_netdev_ops = { · 3 unmodified lines
1295 .ndo_set_rx_mode = ipoib_set_mcast_list,1303 .ndo_set_rx_mode = ipoib_set_mcast_list,
1296};1304};
1297 1305
1298static void ipoib_setup(struct net_device *dev)1306void ipoib_setup(struct net_device *dev)
1299{1307{
1300 struct ipoib_dev_priv *priv = netdev_priv(dev);1308 struct ipoib_dev_priv *priv = netdev_priv(dev);
1301 1309
@@ -1373,12 +1381,9 @@ static ssize_t show_umcast(struct device *dev, · 71 unmodified lines
1373 return sprintf(buf, "%d\n", test_bit(IPOIB_FLAG_UMCAST, &priv->flags));1381 return sprintf(buf, "%d\n", test_bit(IPOIB_FLAG_UMCAST, &priv->flags));
1374}1382}
1375 1383
1376static ssize_t set_umcast(struct device *dev,1384void ipoib_set_umcast(struct net_device *ndev, int umcast_val)
1377 struct device_attribute *attr,
1378 const char *buf, size_t count)
1379{1385{
1380 struct ipoib_dev_priv *priv = netdev_priv(to_net_dev(dev));1386 struct ipoib_dev_priv *priv = netdev_priv(ndev);
1381 unsigned long umcast_val = simple_strtoul(buf, NULL, 0);
1382 1387
1383 if (umcast_val > 0) {1388 if (umcast_val > 0) {
1384 set_bit(IPOIB_FLAG_UMCAST, &priv->flags);1389 set_bit(IPOIB_FLAG_UMCAST, &priv->flags);
@@ -1386,6 +1391,15 @@ static ssize_t set_umcast(struct device *dev, · 1 unmodified line
1386 "by userspace\n");1391 "by userspace\n");
1387 } else1392 } else
1388 clear_bit(IPOIB_FLAG_UMCAST, &priv->flags);1393 clear_bit(IPOIB_FLAG_UMCAST, &priv->flags);
1394}
1395
1396static 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);
1389 1403
1390 return count;1404 return count;
1391}1405}
@@ -1657,7 +1671,6 @@ static void ipoib_remove_one(struct ib_device *device) · 265 unmodified lines
1657 flush_workqueue(ipoib_workqueue);1671 flush_workqueue(ipoib_workqueue);
1658 1672
1659 unregister_netdev(priv->dev);1673 unregister_netdev(priv->dev);
1660 ipoib_dev_cleanup(priv->dev);
1661 free_netdev(priv->dev);1674 free_netdev(priv->dev);
1662 }1675 }
1663 1676
@@ -1709,8 +1722,15 @@ static int __init ipoib_init_module(void) · 45 unmodified lines
1709 if (ret)1722 if (ret)
1710 goto err_sa;1723 goto err_sa;
1711 1724
1725 ret = ipoib_netlink_init();
1726 if (ret)
1727 goto err_client;
1728
1712 return 0;1729 return 0;
1713 1730
1731err_client:
1732 ib_unregister_client(&ipoib_client);
1733
1714err_sa:1734err_sa:
1715 ib_sa_unregister_client(&ipoib_sa_client);1735 ib_sa_unregister_client(&ipoib_sa_client);
1716 destroy_workqueue(ipoib_workqueue);1736 destroy_workqueue(ipoib_workqueue);
@@ -1723,6 +1743,7 @@ err_fs: · 6 unmodified lines
1723 1743
1724static void __exit ipoib_cleanup_module(void)1744static void __exit ipoib_cleanup_module(void)
1725{1745{
1746 ipoib_netlink_fini();
1726 ib_unregister_client(&ipoib_client);1747 ib_unregister_client(&ipoib_client);
1727 ib_sa_unregister_client(&ipoib_sa_client);1748 ib_sa_unregister_client(&ipoib_sa_client);
1728 ipoib_unregister_debugfs();1749 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
38static 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
44static 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
62nla_put_failure:
63 return -EMSGSIZE;
64}
65
66static 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
90out_err:
91 return ret;
92}
93
94static 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
129static 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
142static 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
149static 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
162int __init ipoib_netlink_init(void)
163{
164 return rtnl_link_register(&ipoib_link_ops);
165}
166
167void __exit ipoib_netlink_fini(void)
168{
169 rtnl_link_unregister(&ipoib_link_ops);
170}
171
172MODULE_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
49}49}
50static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);50static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
51 51
52int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)52int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
53 u16 pkey, int type)
53{54{
54 struct ipoib_dev_priv *ppriv, *priv;
55 char intf_name[IFNAMSIZ];
56 int result;55 int result;
57 56
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
93 priv->max_ib_mtu = ppriv->max_ib_mtu;57 priv->max_ib_mtu = ppriv->max_ib_mtu;
94 /* MTU will be reset when mcast join happens */58 /* MTU will be reset when mcast join happens */
95 priv->dev->mtu = IPOIB_UD_MTU(priv->max_ib_mtu);59 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
124 88
125 ipoib_create_debug_files(priv->dev);89 ipoib_create_debug_files(priv->dev);
126 90
127 if (ipoib_cm_add_mode_attr(priv->dev))91 /* RTNL childs don't need proprietary sysfs entries */
128 goto sysfs_failed;92 if (type == IPOIB_LEGACY_CHILD) {
129 if (ipoib_add_pkey_attr(priv->dev))93 if (ipoib_cm_add_mode_attr(priv->dev))
130 goto sysfs_failed;94 goto sysfs_failed;
131 if (ipoib_add_umcast_attr(priv->dev))95 if (ipoib_add_pkey_attr(priv->dev))
132 goto sysfs_failed;96 goto sysfs_failed;
133 97 if (ipoib_add_umcast_attr(priv->dev))
134 if (device_create_file(&priv->dev->dev, &dev_attr_parent))98 goto sysfs_failed;
135 goto sysfs_failed;99
100 if (device_create_file(&priv->dev->dev, &dev_attr_parent))
101 goto sysfs_failed;
102 }
136 103
104 priv->child_type = type;
105 priv->dev->iflink = ppriv->dev->ifindex;
137 list_add_tail(&priv->list, &ppriv->child_intfs);106 list_add_tail(&priv->list, &ppriv->child_intfs);
138 107
139 mutex_unlock(&ppriv->vlan_mutex);
140 rtnl_unlock();
141
142 return 0;108 return 0;
143 109
144sysfs_failed:110sysfs_failed:
111 result = -ENOMEM;
145 ipoib_delete_debug_files(priv->dev);112 ipoib_delete_debug_files(priv->dev);
146 unregister_netdevice(priv->dev);113 unregister_netdevice(priv->dev);
147 114
@@ -149,11 +116,60 @@ register_failed: · 1 unmodified line
149 ipoib_dev_cleanup(priv->dev);116 ipoib_dev_cleanup(priv->dev);
150 117
151err:118err:
119 return result;
120}
121
122int 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
165out:
152 mutex_unlock(&ppriv->vlan_mutex);166 mutex_unlock(&ppriv->vlan_mutex);
153 rtnl_unlock();167
154 if (priv)168 if (result)
155 free_netdev(priv->dev);169 free_netdev(priv->dev);
156 170
171 rtnl_unlock();
172
157 return result;173 return result;
158}174}
159 175
@@ -171,9 +187,9 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) · 11 unmodified lines
171 return restart_syscall();187 return restart_syscall();
172 mutex_lock(&ppriv->vlan_mutex);188 mutex_lock(&ppriv->vlan_mutex);
173 list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {189 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) {
175 unregister_netdevice(priv->dev);192 unregister_netdevice(priv->dev);
176 ipoib_dev_cleanup(priv->dev);
177 list_del(&priv->list);193 list_del(&priv->list);
178 dev = priv->dev;194 dev = priv->dev;
179 break;195 break;
drivers/isdn/gigaset/common.c+0−1
@@ -1123,7 +1123,6 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, · 1122 unmodified lines
1123 return drv;1123 return drv;
1124 1124
1125error:1125error:
1126 kfree(drv->cs);
1127 kfree(drv);1126 kfree(drv);
1128 return NULL;1127 return NULL;
1129}1128}
drivers/net/Kconfig+15−2
@@ -107,8 +107,6 @@ config MII · 106 unmodified lines
107 or internal device. It is safe to say Y or M here even if your107 or internal device. It is safe to say Y or M here even if your
108 ethernet card lacks MII.108 ethernet card lacks MII.
109 109
110source "drivers/ieee802154/Kconfig"
111
112config IFB110config IFB
113 tristate "Intermediate Functional Block support"111 tristate "Intermediate Functional Block support"
114 depends on NET_CLS_ACT112 depends on NET_CLS_ACT
@@ -151,6 +149,19 @@ config MACVTAP · 36 unmodified lines
151 To compile this driver as a module, choose M here: the module149 To compile this driver as a module, choose M here: the module
152 will be called macvtap.150 will be called macvtap.
153 151
152config 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
154config NETCONSOLE165config NETCONSOLE
155 tristate "Network console logging support"166 tristate "Network console logging support"
156 ---help---167 ---help---
@@ -290,6 +301,8 @@ source "drivers/net/wimax/Kconfig" · 133 unmodified lines
290 301
291source "drivers/net/wan/Kconfig"302source "drivers/net/wan/Kconfig"
292 303
304source "drivers/net/ieee802154/Kconfig"
305
293config XEN_NETDEV_FRONTEND306config XEN_NETDEV_FRONTEND
294 tristate "Xen network device frontend driver"307 tristate "Xen network device frontend driver"
295 depends on XEN308 depends on XEN
drivers/net/Makefile+2−0
@@ -21,6 +21,7 @@ obj-$(CONFIG_NET_TEAM) += team/ · 20 unmodified lines
21obj-$(CONFIG_TUN) += tun.o21obj-$(CONFIG_TUN) += tun.o
22obj-$(CONFIG_VETH) += veth.o22obj-$(CONFIG_VETH) += veth.o
23obj-$(CONFIG_VIRTIO_NET) += virtio_net.o23obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
24obj-$(CONFIG_VXLAN) += vxlan.o
24 25
25#26#
26# Networking Drivers27# Networking Drivers
@@ -53,6 +54,7 @@ obj-$(CONFIG_SUNGEM_PHY) += sungem_phy.o · 26 unmodified lines
53obj-$(CONFIG_WAN) += wan/54obj-$(CONFIG_WAN) += wan/
54obj-$(CONFIG_WLAN) += wireless/55obj-$(CONFIG_WLAN) += wireless/
55obj-$(CONFIG_WIMAX) += wimax/56obj-$(CONFIG_WIMAX) += wimax/
57obj-$(CONFIG_IEEE802154) += ieee802154/
56 58
57obj-$(CONFIG_VMXNET3) += vmxnet3/59obj-$(CONFIG_VMXNET3) += vmxnet3/
58obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o60obj-$(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
1120 write_unlock_bh(&bond->curr_slave_lock);1120 write_unlock_bh(&bond->curr_slave_lock);
1121 read_unlock(&bond->lock);1121 read_unlock(&bond->lock);
1122 1122
1123 netdev_bonding_change(bond->dev, NETDEV_BONDING_FAILOVER);1123 call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev);
1124 if (should_notify_peers)1124 if (should_notify_peers)
1125 netdev_bonding_change(bond->dev,1125 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS,
1126 NETDEV_NOTIFY_PEERS);1126 bond->dev);
1127 1127
1128 read_lock(&bond->lock);1128 read_lock(&bond->lock);
1129 write_lock_bh(&bond->curr_slave_lock);1129 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
1558 bond_dev->name,1558 bond_dev->name,
1559 bond_dev->type, slave_dev->type);1559 bond_dev->type, slave_dev->type);
1560 1560
1561 res = netdev_bonding_change(bond_dev,1561 res = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
1562 NETDEV_PRE_TYPE_CHANGE);1562 bond_dev);
1563 res = notifier_to_errno(res);1563 res = notifier_to_errno(res);
1564 if (res) {1564 if (res) {
1565 pr_err("%s: refused to change device type\n",1565 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
1579 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;1579 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
1580 }1580 }
1581 1581
1582 netdev_bonding_change(bond_dev,1582 call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
1583 NETDEV_POST_TYPE_CHANGE);1583 bond_dev);
1584 }1584 }
1585 } else if (bond_dev->type != slave_dev->type) {1585 } else if (bond_dev->type != slave_dev->type) {
1586 pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n",1586 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
1941 }1941 }
1942 1942
1943 block_netpoll_tx();1943 block_netpoll_tx();
1944 netdev_bonding_change(bond_dev, NETDEV_RELEASE);1944 call_netdevice_notifiers(NETDEV_RELEASE, bond_dev);
1945 write_lock_bh(&bond->lock);1945 write_lock_bh(&bond->lock);
1946 1946
1947 slave = bond_get_slave_by_dev(bond, slave_dev);1947 slave = bond_get_slave_by_dev(bond, slave_dev);
@@ -2584,7 +2584,7 @@ re_arm: · 636 unmodified lines
2584 read_unlock(&bond->lock);2584 read_unlock(&bond->lock);
2585 return;2585 return;
2586 }2586 }
2587 netdev_bonding_change(bond->dev, NETDEV_NOTIFY_PEERS);2587 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
2588 rtnl_unlock();2588 rtnl_unlock();
2589 }2589 }
2590}2590}
@@ -2811,12 +2811,13 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 220 unmodified lines
2811 arp_work.work);2811 arp_work.work);
2812 struct slave *slave, *oldcurrent;2812 struct slave *slave, *oldcurrent;
2813 int do_failover = 0;2813 int do_failover = 0;
2814 int delta_in_ticks;2814 int delta_in_ticks, extra_ticks;
2815 int i;2815 int i;
2816 2816
2817 read_lock(&bond->lock);2817 read_lock(&bond->lock);
2818 2818
2819 delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);2819 delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);
2820 extra_ticks = delta_in_ticks / 2;
2820 2821
2821 if (bond->slave_cnt == 0)2822 if (bond->slave_cnt == 0)
2822 goto re_arm;2823 goto re_arm;
@@ -2839,10 +2840,10 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 16 unmodified lines
2839 if (slave->link != BOND_LINK_UP) {2840 if (slave->link != BOND_LINK_UP) {
2840 if (time_in_range(jiffies,2841 if (time_in_range(jiffies,
2841 trans_start - delta_in_ticks,2842 trans_start - delta_in_ticks,
2842 trans_start + delta_in_ticks) &&2843 trans_start + delta_in_ticks + extra_ticks) &&
2843 time_in_range(jiffies,2844 time_in_range(jiffies,
2844 slave->dev->last_rx - delta_in_ticks,2845 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)) {
2846 2847
2847 slave->link = BOND_LINK_UP;2848 slave->link = BOND_LINK_UP;
2848 bond_set_active_slave(slave);2849 bond_set_active_slave(slave);
@@ -2872,10 +2873,10 @@ void bond_loadbalance_arp_mon(struct work_struct *work) · 23 unmodified lines
2872 */2873 */
2873 if (!time_in_range(jiffies,2874 if (!time_in_range(jiffies,
2874 trans_start - delta_in_ticks,2875 trans_start - delta_in_ticks,
2875 trans_start + 2 * delta_in_ticks) ||2876 trans_start + 2 * delta_in_ticks + extra_ticks) ||
2876 !time_in_range(jiffies,2877 !time_in_range(jiffies,
2877 slave->dev->last_rx - delta_in_ticks,2878 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)) {
2879 2880
2880 slave->link = BOND_LINK_DOWN;2881 slave->link = BOND_LINK_DOWN;
2881 bond_set_backup_slave(slave);2882 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
2933 struct slave *slave;2934 struct slave *slave;
2934 int i, commit = 0;2935 int i, commit = 0;
2935 unsigned long trans_start;2936 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;
2936 2945
2937 bond_for_each_slave(bond, slave, i) {2946 bond_for_each_slave(bond, slave, i) {
2938 slave->new_link = BOND_LINK_NOCHANGE;2947 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
2940 if (slave->link != BOND_LINK_UP) {2949 if (slave->link != BOND_LINK_UP) {
2941 if (time_in_range(jiffies,2950 if (time_in_range(jiffies,
2942 slave_last_rx(bond, slave) - delta_in_ticks,2951 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)) {
2944 2953
2945 slave->new_link = BOND_LINK_UP;2954 slave->new_link = BOND_LINK_UP;
2946 commit++;2955 commit++;
@@ -2956,7 +2965,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 9 unmodified lines
2956 */2965 */
2957 if (time_in_range(jiffies,2966 if (time_in_range(jiffies,
2958 slave->jiffies - delta_in_ticks,2967 slave->jiffies - delta_in_ticks,
2959 slave->jiffies + 2 * delta_in_ticks))2968 slave->jiffies + 2 * delta_in_ticks + extra_ticks))
2960 continue;2969 continue;
2961 2970
2962 /*2971 /*
@@ -2976,7 +2985,7 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 13 unmodified lines
2976 !bond->current_arp_slave &&2985 !bond->current_arp_slave &&
2977 !time_in_range(jiffies,2986 !time_in_range(jiffies,
2978 slave_last_rx(bond, slave) - delta_in_ticks,2987 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)) {
2980 2989
2981 slave->new_link = BOND_LINK_DOWN;2990 slave->new_link = BOND_LINK_DOWN;
2982 commit++;2991 commit++;
@@ -2992,10 +3001,10 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) · 9 unmodified lines
2992 if (bond_is_active_slave(slave) &&3001 if (bond_is_active_slave(slave) &&
2993 (!time_in_range(jiffies,3002 (!time_in_range(jiffies,
2994 trans_start - delta_in_ticks,3003 trans_start - delta_in_ticks,
2995 trans_start + 2 * delta_in_ticks) ||3004 trans_start + 2 * delta_in_ticks + extra_ticks) ||
2996 !time_in_range(jiffies,3005 !time_in_range(jiffies,
2997 slave_last_rx(bond, slave) - delta_in_ticks,3006 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))) {
2999 3008
3000 slave->new_link = BOND_LINK_DOWN;3009 slave->new_link = BOND_LINK_DOWN;
3001 commit++;3010 commit++;
@@ -3027,7 +3036,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) · 25 unmodified lines
3027 if ((!bond->curr_active_slave &&3036 if ((!bond->curr_active_slave &&
3028 time_in_range(jiffies,3037 time_in_range(jiffies,
3029 trans_start - delta_in_ticks,3038 trans_start - delta_in_ticks,
3030 trans_start + delta_in_ticks)) ||3039 trans_start + delta_in_ticks + delta_in_ticks / 2)) ||
3031 bond->curr_active_slave != slave) {3040 bond->curr_active_slave != slave) {
3032 slave->link = BOND_LINK_UP;3041 slave->link = BOND_LINK_UP;
3033 if (bond->current_arp_slave) {3042 if (bond->current_arp_slave) {
@@ -3203,7 +3212,7 @@ re_arm: · 169 unmodified lines
3203 read_unlock(&bond->lock);3212 read_unlock(&bond->lock);
3204 return;3213 return;
3205 }3214 }
3206 netdev_bonding_change(bond->dev, NETDEV_NOTIFY_PEERS);3215 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
3207 rtnl_unlock();3216 rtnl_unlock();
3208 }3217 }
3209}3218}
@@ -3351,57 +3360,94 @@ static struct notifier_block bond_netdev_notifier = { · 141 unmodified lines
3351 3360
3352/*---------------------------- Hashing Policies -----------------------------*/3361/*---------------------------- Hashing Policies -----------------------------*/
3353 3362
3363/*
3364 * Hash for the output device based upon layer 2 data
3365 */
3366static 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
3354/*3376/*
3355 * Hash for the output device based upon layer 2 and layer 3 data. If3377 * 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()
3357 */3379 */
3358static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)3380static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
3359{3381{
3360 struct ethhdr *data = (struct ethhdr *)skb->data;3382 struct ethhdr *data = (struct ethhdr *)skb->data;
3361 struct iphdr *iph = ip_hdr(skb);3383 struct iphdr *iph;
3362 3384 struct ipv6hdr *ipv6h;
3363 if (skb->protocol == htons(ETH_P_IP)) {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);
3364 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^3391 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
3365 (data->h_dest[5] ^ data->h_source[5])) % count;3392 (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;
3366 }3401 }
3367 3402
3368 return (data->h_dest[5] ^ data->h_source[5]) % count;3403 return bond_xmit_hash_policy_l2(skb, count);
3369}3404}
3370 3405
3371/*3406/*
3372 * Hash for the output device based upon layer 3 and layer 4 data. If3407 * Hash for the output device based upon layer 3 and layer 4 data. If
3373 * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is3408 * 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()
3375 */3410 */
3376static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)3411static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
3377{3412{
3378 struct ethhdr *data = (struct ethhdr *)skb->data;3413 u32 layer4_xor = 0;
3379 struct iphdr *iph = ip_hdr(skb);3414 struct iphdr *iph;
3380 __be16 *layer4hdr = (__be16 *)((u32 *)iph + iph->ihl);3415 struct ipv6hdr *ipv6h;
3381 int layer4_xor = 0;3416 __be32 *s, *d;
3382 3417 __be16 *layer4hdr;
3383 if (skb->protocol == htons(ETH_P_IP)) {3418
3419 if (skb->protocol == htons(ETH_P_IP) &&
3420 skb_network_header_len(skb) >= sizeof(*iph)) {
3421 iph = ip_hdr(skb);
3384 if (!ip_is_fragment(iph) &&3422 if (!ip_is_fragment(iph) &&
3385 (iph->protocol == IPPROTO_TCP ||3423 (iph->protocol == IPPROTO_TCP ||
3386 iph->protocol == IPPROTO_UDP)) {3424 iph->protocol == IPPROTO_UDP) &&
3387 layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1)));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));
3388 }3429 }
3389 return (layer4_xor ^3430 return (layer4_xor ^
3390 ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count;3431 ((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;
3392 }3448 }
3393 3449
3394 return (data->h_dest[5] ^ data->h_source[5]) % count;3450 return bond_xmit_hash_policy_l2(skb, count);
3395}
3396
3397/*
3398 * Hash for the output device based upon layer 2 data
3399 */
3400static 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;
3405}3451}
3406 3452
3407/*-------------------------- Device entry points ----------------------------*/3453/*-------------------------- Device entry points ----------------------------*/
drivers/net/can/c_can/c_can.c+125−5
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include <linux/if_ether.h>34#include <linux/if_ether.h>
35#include <linux/list.h>35#include <linux/list.h>
36#include <linux/io.h>36#include <linux/io.h>
37#include <linux/pm_runtime.h>
37 38
38#include <linux/can.h>39#include <linux/can.h>
39#include <linux/can/dev.h>40#include <linux/can/dev.h>
@@ -45,6 +46,9 @@ · 5 unmodified lines
45#define IF_ENUM_REG_LEN 1146#define IF_ENUM_REG_LEN 11
46#define C_CAN_IFACE(reg, iface) (C_CAN_IF1_##reg + (iface) * IF_ENUM_REG_LEN)47#define C_CAN_IFACE(reg, iface) (C_CAN_IF1_##reg + (iface) * IF_ENUM_REG_LEN)
47 48
49/* control extension register D_CAN specific */
50#define CONTROL_EX_PDR BIT(8)
51
48/* control register */52/* control register */
49#define CONTROL_TEST BIT(7)53#define CONTROL_TEST BIT(7)
50#define CONTROL_CCE BIT(6)54#define CONTROL_CCE BIT(6)
@@ -64,6 +68,7 @@ · 13 unmodified lines
64#define TEST_BASIC BIT(2)68#define TEST_BASIC BIT(2)
65 69
66/* status register */70/* status register */
71#define STATUS_PDA BIT(10)
67#define STATUS_BOFF BIT(7)72#define STATUS_BOFF BIT(7)
68#define STATUS_EWARN BIT(6)73#define STATUS_EWARN BIT(6)
69#define STATUS_EPASS BIT(5)74#define STATUS_EPASS BIT(5)
@@ -163,6 +168,9 @@ · 93 unmodified lines
163/* minimum timeout for checking BUSY status */168/* minimum timeout for checking BUSY status */
164#define MIN_TIMEOUT_VALUE 6169#define MIN_TIMEOUT_VALUE 6
165 170
171/* Wait for ~1 sec for INIT bit */
172#define INIT_WAIT_MS 1000
173
166/* napi related */174/* napi related */
167#define C_CAN_NAPI_WEIGHT C_CAN_MSG_OBJ_RX_NUM175#define C_CAN_NAPI_WEIGHT C_CAN_MSG_OBJ_RX_NUM
168 176
@@ -201,6 +209,30 @@ static const struct can_bittiming_const c_can_bittiming_const = { · 32 unmodified lines
201 .brp_inc = 1,209 .brp_inc = 1,
202};210};
203 211
212static 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
218static 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
224static 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
230static 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
204static inline int get_tx_next_msg_obj(const struct c_can_priv *priv)236static inline int get_tx_next_msg_obj(const struct c_can_priv *priv)
205{237{
206 return (priv->tx_next & C_CAN_NEXT_MSG_OBJ_MASK) +238 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
673 unsigned int reg_err_counter;705 unsigned int reg_err_counter;
674 struct c_can_priv *priv = netdev_priv(dev);706 struct c_can_priv *priv = netdev_priv(dev);
675 707
708 c_can_pm_runtime_get_sync(priv);
709
676 reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG);710 reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG);
677 bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >>711 bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >>
678 ERR_CNT_REC_SHIFT;712 ERR_CNT_REC_SHIFT;
679 bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK;713 bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK;
680 714
715 c_can_pm_runtime_put_sync(priv);
716
681 return 0;717 return 0;
682}718}
683 719
@@ -1053,11 +1089,13 @@ static int c_can_open(struct net_device *dev) · 369 unmodified lines
1053 int err;1089 int err;
1054 struct c_can_priv *priv = netdev_priv(dev);1090 struct c_can_priv *priv = netdev_priv(dev);
1055 1091
1092 c_can_pm_runtime_get_sync(priv);
1093
1056 /* open the can device */1094 /* open the can device */
1057 err = open_candev(dev);1095 err = open_candev(dev);
1058 if (err) {1096 if (err) {
1059 netdev_err(dev, "failed to open can device\n");1097 netdev_err(dev, "failed to open can device\n");
1060 return err;1098 goto exit_open_fail;
1061 }1099 }
1062 1100
1063 /* register interrupt handler */1101 /* register interrupt handler */
@@ -1079,6 +1117,8 @@ static int c_can_open(struct net_device *dev) · 15 unmodified lines
1079 1117
1080exit_irq_fail:1118exit_irq_fail:
1081 close_candev(dev);1119 close_candev(dev);
1120exit_open_fail:
1121 c_can_pm_runtime_put_sync(priv);
1082 return err;1122 return err;
1083}1123}
1084 1124
@@ -1091,6 +1131,7 @@ static int c_can_close(struct net_device *dev) · 6 unmodified lines
1091 c_can_stop(dev);1131 c_can_stop(dev);
1092 free_irq(dev->irq, dev);1132 free_irq(dev->irq, dev);
1093 close_candev(dev);1133 close_candev(dev);
1134 c_can_pm_runtime_put_sync(priv);
1094 1135
1095 return 0;1136 return 0;
1096}1137}
@@ -1119,6 +1160,77 @@ struct net_device *alloc_c_can_dev(void) · 22 unmodified lines
1119}1160}
1120EXPORT_SYMBOL_GPL(alloc_c_can_dev);1161EXPORT_SYMBOL_GPL(alloc_c_can_dev);
1121 1162
1163#ifdef CONFIG_PM
1164int 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}
1195EXPORT_SYMBOL_GPL(c_can_power_down);
1196
1197int 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}
1231EXPORT_SYMBOL_GPL(c_can_power_up);
1232#endif
1233
1122void free_c_can_dev(struct net_device *dev)1234void free_c_can_dev(struct net_device *dev)
1123{1235{
1124 free_candev(dev);1236 free_candev(dev);
@@ -1133,10 +1245,19 @@ static const struct net_device_ops c_can_netdev_ops = { · 8 unmodified lines
1133 1245
1134int register_c_can_dev(struct net_device *dev)1246int register_c_can_dev(struct net_device *dev)
1135{1247{
1248 struct c_can_priv *priv = netdev_priv(dev);
1249 int err;
1250
1251 c_can_pm_runtime_enable(priv);
1252
1136 dev->flags |= IFF_ECHO; /* we support local echo */1253 dev->flags |= IFF_ECHO; /* we support local echo */
1137 dev->netdev_ops = &c_can_netdev_ops;1254 dev->netdev_ops = &c_can_netdev_ops;
1138 1255
1139 return register_candev(dev);1256 err = register_candev(dev);
1257 if (err)
1258 c_can_pm_runtime_disable(priv);
1259
1260 return err;
1140}1261}
1141EXPORT_SYMBOL_GPL(register_c_can_dev);1262EXPORT_SYMBOL_GPL(register_c_can_dev);
1142 1263
@@ -1144,10 +1265,9 @@ void unregister_c_can_dev(struct net_device *dev) · 1 unmodified line
1144{1265{
1145 struct c_can_priv *priv = netdev_priv(dev);1266 struct c_can_priv *priv = netdev_priv(dev);
1146 1267
1147 /* disable all interrupts */
1148 c_can_enable_all_interrupts(priv, DISABLE_ALL_INTERRUPTS);
1149
1150 unregister_candev(dev);1268 unregister_candev(dev);
1269
1270 c_can_pm_runtime_disable(priv);
1151}1271}
1152EXPORT_SYMBOL_GPL(unregister_c_can_dev);1272EXPORT_SYMBOL_GPL(unregister_c_can_dev);
1153 1273
drivers/net/can/c_can/c_can.h+12−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
24 24
25enum reg {25enum reg {
26 C_CAN_CTRL_REG = 0,26 C_CAN_CTRL_REG = 0,
27 C_CAN_CTRL_EX_REG,
27 C_CAN_STS_REG,28 C_CAN_STS_REG,
28 C_CAN_ERR_CNT_REG,29 C_CAN_ERR_CNT_REG,
29 C_CAN_BTR_REG,30 C_CAN_BTR_REG,
@@ -104,6 +105,7 @@ static const u16 reg_map_c_can[] = { · 74 unmodified lines
104 105
105static const u16 reg_map_d_can[] = {106static const u16 reg_map_d_can[] = {
106 [C_CAN_CTRL_REG] = 0x00,107 [C_CAN_CTRL_REG] = 0x00,
108 [C_CAN_CTRL_EX_REG] = 0x02,
107 [C_CAN_STS_REG] = 0x04,109 [C_CAN_STS_REG] = 0x04,
108 [C_CAN_ERR_CNT_REG] = 0x08,110 [C_CAN_ERR_CNT_REG] = 0x08,
109 [C_CAN_BTR_REG] = 0x0C,111 [C_CAN_BTR_REG] = 0x0C,
@@ -143,8 +145,9 @@ static const u16 reg_map_d_can[] = { · 33 unmodified lines
143};145};
144 146
145enum c_can_dev_id {147enum c_can_dev_id {
146 C_CAN_DEVTYPE,148 BOSCH_C_CAN_PLATFORM,
147 D_CAN_DEVTYPE,149 BOSCH_C_CAN,
150 BOSCH_D_CAN,
148};151};
149 152
150/* c_can private data structure */153/* c_can private data structure */
@@ -152,6 +155,7 @@ struct c_can_priv { · 1 unmodified line
152 struct can_priv can; /* must be the first member */155 struct can_priv can; /* must be the first member */
153 struct napi_struct napi;156 struct napi_struct napi;
154 struct net_device *dev;157 struct net_device *dev;
158 struct device *device;
155 int tx_object;159 int tx_object;
156 int current_status;160 int current_status;
157 int last_status;161 int last_status;
@@ -164,6 +168,7 @@ struct c_can_priv { · 6 unmodified lines
164 unsigned int tx_echo;168 unsigned int tx_echo;
165 void *priv; /* for board-specific data */169 void *priv; /* for board-specific data */
166 u16 irqstatus;170 u16 irqstatus;
171 enum c_can_dev_id type;
167};172};
168 173
169struct net_device *alloc_c_can_dev(void);174struct net_device *alloc_c_can_dev(void);
@@ -171,4 +176,9 @@ void free_c_can_dev(struct net_device *dev); · 1 unmodified line
171int register_c_can_dev(struct net_device *dev);176int register_c_can_dev(struct net_device *dev);
172void unregister_c_can_dev(struct net_device *dev);177void unregister_c_can_dev(struct net_device *dev);
173 178
179#ifdef CONFIG_PM
180int c_can_power_up(struct net_device *dev);
181int c_can_power_down(struct net_device *dev);
182#endif
183
174#endif /* C_CAN_H */184#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
120 120
121 /* Configure CAN type */121 /* Configure CAN type */
122 switch (c_can_pci_data->type) {122 switch (c_can_pci_data->type) {
123 case C_CAN_DEVTYPE:123 case BOSCH_C_CAN:
124 priv->regs = reg_map_c_can;124 priv->regs = reg_map_c_can;
125 break;125 break;
126 case D_CAN_DEVTYPE:126 case BOSCH_D_CAN:
127 priv->regs = reg_map_d_can;127 priv->regs = reg_map_d_can;
128 priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;128 priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
129 break;129 break;
@@ -192,7 +192,7 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev) · 62 unmodified lines
192}192}
193 193
194static struct c_can_pci_data c_can_sta2x11= {194static struct c_can_pci_data c_can_sta2x11= {
195 .type = C_CAN_DEVTYPE,195 .type = BOSCH_C_CAN,
196 .reg_align = C_CAN_REG_ALIGN_32,196 .reg_align = C_CAN_REG_ALIGN_32,
197 .freq = 52000000, /* 52 Mhz */197 .freq = 52000000, /* 52 Mhz */
198};198};
drivers/net/can/c_can/c_can_platform.c+108−15
@@ -30,6 +30,9 @@ · 29 unmodified lines
30#include <linux/io.h>30#include <linux/io.h>
31#include <linux/platform_device.h>31#include <linux/platform_device.h>
32#include <linux/clk.h>32#include <linux/clk.h>
33#include <linux/of.h>
34#include <linux/of_device.h>
35#include <linux/pinctrl/consumer.h>
33 36
34#include <linux/can/dev.h>37#include <linux/can/dev.h>
35 38
@@ -65,17 +68,58 @@ static void c_can_plat_write_reg_aligned_to_32bit(struct c_can_priv *priv, · 29 unmodified lines
65 writew(val, priv->base + 2 * priv->regs[index]);68 writew(val, priv->base + 2 * priv->regs[index]);
66}69}
67 70
71static 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
87static 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
68static int __devinit c_can_plat_probe(struct platform_device *pdev)93static int __devinit c_can_plat_probe(struct platform_device *pdev)
69{94{
70 int ret;95 int ret;
71 void __iomem *addr;96 void __iomem *addr;
72 struct net_device *dev;97 struct net_device *dev;
73 struct c_can_priv *priv;98 struct c_can_priv *priv;
99 const struct of_device_id *match;
74 const struct platform_device_id *id;100 const struct platform_device_id *id;
101 struct pinctrl *pinctrl;
75 struct resource *mem;102 struct resource *mem;
76 int irq;103 int irq;
77 struct clk *clk;104 struct clk *clk;
78 105
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
79 /* get the appropriate clk */123 /* get the appropriate clk */
80 clk = clk_get(&pdev->dev, NULL);124 clk = clk_get(&pdev->dev, NULL);
81 if (IS_ERR(clk)) {125 if (IS_ERR(clk)) {
@@ -114,9 +158,8 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 32 unmodified lines
114 }158 }
115 159
116 priv = netdev_priv(dev);160 priv = netdev_priv(dev);
117 id = platform_get_device_id(pdev);
118 switch (id->driver_data) {161 switch (id->driver_data) {
119 case C_CAN_DEVTYPE:162 case BOSCH_C_CAN:
120 priv->regs = reg_map_c_can;163 priv->regs = reg_map_c_can;
121 switch (mem->flags & IORESOURCE_MEM_TYPE_MASK) {164 switch (mem->flags & IORESOURCE_MEM_TYPE_MASK) {
122 case IORESOURCE_MEM_32BIT:165 case IORESOURCE_MEM_32BIT:
@@ -130,7 +173,7 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 7 unmodified lines
130 break;173 break;
131 }174 }
132 break;175 break;
133 case D_CAN_DEVTYPE:176 case BOSCH_D_CAN:
134 priv->regs = reg_map_d_can;177 priv->regs = reg_map_d_can;
135 priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;178 priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
136 priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;179 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
143 186
144 dev->irq = irq;187 dev->irq = irq;
145 priv->base = addr;188 priv->base = addr;
189 priv->device = &pdev->dev;
146 priv->can.clock.freq = clk_get_rate(clk);190 priv->can.clock.freq = clk_get_rate(clk);
147 priv->priv = clk;191 priv->priv = clk;
192 priv->type = id->driver_data;
148 193
149 platform_set_drvdata(pdev, dev);194 platform_set_drvdata(pdev, dev);
150 SET_NETDEV_DEV(dev, &pdev->dev);195 SET_NETDEV_DEV(dev, &pdev->dev);
@@ -195,27 +240,75 @@ static int __devexit c_can_plat_remove(struct platform_device *pdev) · 44 unmodified lines
195 return 0;240 return 0;
196}241}
197 242
198static const struct platform_device_id c_can_id_table[] = {243#ifdef CONFIG_PM
199 {244static int c_can_suspend(struct platform_device *pdev, pm_message_t state)
200 .name = KBUILD_MODNAME,245{
201 .driver_data = C_CAN_DEVTYPE,246 int ret;
202 }, {247 struct net_device *ndev = platform_get_drvdata(pdev);
203 .name = "c_can",248 struct c_can_priv *priv = netdev_priv(ndev);
204 .driver_data = C_CAN_DEVTYPE,249
205 }, {250 if (priv->type != BOSCH_D_CAN) {
206 .name = "d_can",251 dev_warn(&pdev->dev, "Not supported\n");
207 .driver_data = D_CAN_DEVTYPE,252 return 0;
208 }, {
209 }253 }
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
271static 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
211 301
212static struct platform_driver c_can_plat_driver = {302static struct platform_driver c_can_plat_driver = {
213 .driver = {303 .driver = {
214 .name = KBUILD_MODNAME,304 .name = KBUILD_MODNAME,
215 .owner = THIS_MODULE,305 .owner = THIS_MODULE,
306 .of_match_table = of_match_ptr(c_can_of_table),
216 },307 },
217 .probe = c_can_plat_probe,308 .probe = c_can_plat_probe,
218 .remove = __devexit_p(c_can_plat_remove),309 .remove = __devexit_p(c_can_plat_remove),
310 .suspend = c_can_suspend,
311 .resume = c_can_resume,
219 .id_table = c_can_id_table,312 .id_table = c_can_id_table,
220};313};
221 314
drivers/net/can/flexcan.c+19−10
@@ -144,6 +144,10 @@ · 143 unmodified lines
144 144
145#define FLEXCAN_MB_CODE_MASK (0xf0ffffff)145#define FLEXCAN_MB_CODE_MASK (0xf0ffffff)
146 146
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
147/* Structure of the message buffer */151/* Structure of the message buffer */
148struct flexcan_mb {152struct flexcan_mb {
149 u32 can_ctrl;153 u32 can_ctrl;
@@ -178,7 +182,7 @@ struct flexcan_regs { · 28 unmodified lines
178};182};
179 183
180struct flexcan_devtype_data {184struct flexcan_devtype_data {
181 u32 hw_ver; /* hardware controller version */185 u32 features; /* hardware controller features */
182};186};
183 187
184struct flexcan_priv {188struct flexcan_priv {
@@ -197,11 +201,11 @@ struct flexcan_priv { · 12 unmodified lines
197};201};
198 202
199static struct flexcan_devtype_data fsl_p1010_devtype_data = {203static struct flexcan_devtype_data fsl_p1010_devtype_data = {
200 .hw_ver = 3,204 .features = FLEXCAN_HAS_BROKEN_ERR_STATE,
201};205};
202 206static struct flexcan_devtype_data fsl_imx28_devtype_data;
203static struct flexcan_devtype_data fsl_imx6q_devtype_data = {207static struct flexcan_devtype_data fsl_imx6q_devtype_data = {
204 .hw_ver = 10,208 .features = FLEXCAN_HAS_V10_FEATURES | FLEXCAN_HAS_BROKEN_ERR_STATE,
205};209};
206 210
207static const struct can_bittiming_const flexcan_bittiming_const = {211static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -741,15 +745,19 @@ static int flexcan_chip_start(struct net_device *dev) · 533 unmodified lines
741 * enable tx and rx warning interrupt745 * enable tx and rx warning interrupt
742 * enable bus off interrupt746 * enable bus off interrupt
743 * (== FLEXCAN_CTRL_ERR_STATE)747 * (== 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.
748 */748 */
749 reg_ctrl = flexcan_read(&regs->ctrl);749 reg_ctrl = flexcan_read(&regs->ctrl);
750 reg_ctrl &= ~FLEXCAN_CTRL_TSYN;750 reg_ctrl &= ~FLEXCAN_CTRL_TSYN;
751 reg_ctrl |= FLEXCAN_CTRL_BOFF_REC | FLEXCAN_CTRL_LBUF |751 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;
753 761
754 /* save for later use */762 /* save for later use */
755 priv->reg_ctrl_default = reg_ctrl;763 priv->reg_ctrl_default = reg_ctrl;
@@ -772,7 +780,7 @@ static int flexcan_chip_start(struct net_device *dev) · 16 unmodified lines
772 flexcan_write(0x0, &regs->rx14mask);780 flexcan_write(0x0, &regs->rx14mask);
773 flexcan_write(0x0, &regs->rx15mask);781 flexcan_write(0x0, &regs->rx15mask);
774 782
775 if (priv->devtype_data->hw_ver >= 10)783 if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES)
776 flexcan_write(0x0, &regs->rxfgmask);784 flexcan_write(0x0, &regs->rxfgmask);
777 785
778 flexcan_transceiver_switch(priv, 1);786 flexcan_transceiver_switch(priv, 1);
@@ -954,6 +962,7 @@ static void __devexit unregister_flexcandev(struct net_device *dev) · 175 unmodified lines
954 962
955static const struct of_device_id flexcan_of_match[] = {963static const struct of_device_id flexcan_of_match[] = {
956 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },964 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
965 { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
957 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },966 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
958 { /* sentinel */ },967 { /* sentinel */ },
959};968};
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
181 181
182 if (!clock_name || !strcmp(clock_name, "sys")) {182 if (!clock_name || !strcmp(clock_name, "sys")) {
183 sys_clk = clk_get(&ofdev->dev, "sys_clk");183 sys_clk = clk_get(&ofdev->dev, "sys_clk");
184 if (!sys_clk) {184 if (IS_ERR(sys_clk)) {
185 dev_err(&ofdev->dev, "couldn't get sys_clk\n");185 dev_err(&ofdev->dev, "couldn't get sys_clk\n");
186 goto exit_unmap;186 goto exit_unmap;
187 }187 }
@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, · 16 unmodified lines
204 204
205 if (clocksrc < 0) {205 if (clocksrc < 0) {
206 ref_clk = clk_get(&ofdev->dev, "ref_clk");206 ref_clk = clk_get(&ofdev->dev, "ref_clk");
207 if (!ref_clk) {207 if (IS_ERR(ref_clk)) {
208 dev_err(&ofdev->dev, "couldn't get ref_clk\n");208 dev_err(&ofdev->dev, "couldn't get ref_clk\n");
209 goto exit_unmap;209 goto exit_unmap;
210 }210 }
drivers/net/can/sja1000/sja1000.c+24−7
@@ -156,8 +156,13 @@ static void set_normal_mode(struct net_device *dev) · 155 unmodified lines
156 }156 }
157 157
158 /* set chip to normal mode */158 /* 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
160 udelay(10);164 udelay(10);
165
161 status = priv->read_reg(priv, REG_MOD);166 status = priv->read_reg(priv, REG_MOD);
162 }167 }
163 168
@@ -310,7 +315,10 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb, · 146 unmodified lines
310 315
311 can_put_echo_skb(skb, dev, 0);316 can_put_echo_skb(skb, dev, 0);
312 317
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);
314 322
315 return NETDEV_TX_OK;323 return NETDEV_TX_OK;
316}324}
@@ -505,10 +513,18 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) · 188 unmodified lines
505 netdev_warn(dev, "wakeup interrupt\n");513 netdev_warn(dev, "wakeup interrupt\n");
506 514
507 if (isrc & IRQ_TI) {515 if (isrc & IRQ_TI) {
508 /* transmission complete interrupt */516 /* transmission buffer released */
509 stats->tx_bytes += priv->read_reg(priv, REG_FI) & 0xf;517 if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT &&
510 stats->tx_packets++;518 !(status & SR_TCS)) {
511 can_get_echo_skb(dev, 0);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 }
512 netif_wake_queue(dev);528 netif_wake_queue(dev);
513 }529 }
514 if (isrc & IRQ_RI) {530 if (isrc & IRQ_RI) {
@@ -605,7 +621,8 @@ struct net_device *alloc_sja1000dev(int sizeof_priv) · 90 unmodified lines
605 priv->can.do_set_mode = sja1000_set_mode;621 priv->can.do_set_mode = sja1000_set_mode;
606 priv->can.do_get_berr_counter = sja1000_get_berr_counter;622 priv->can.do_get_berr_counter = sja1000_get_berr_counter;
607 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |623 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;
609 626
610 spin_lock_init(&priv->cmdreg_lock);627 spin_lock_init(&priv->cmdreg_lock);
611 628
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
53 * dump memory53 * dump memory
54 */54 */
55#define DUMP_WIDTH 1655#define DUMP_WIDTH 16
56void dump_mem(char *prompt, void *p, int l)56void pcan_dump_mem(char *prompt, void *p, int l)
57{57{
58 pr_info("%s dumping %s (%d bytes):\n",58 pr_info("%s dumping %s (%d bytes):\n",
59 PCAN_USB_DRIVER_NAME, prompt ? prompt : "memory", l);59 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
203 if (dev->state & PCAN_USB_STATE_STARTED) {203 if (dev->state & PCAN_USB_STATE_STARTED) {
204 err = dev->adapter->dev_decode_buf(dev, urb);204 err = dev->adapter->dev_decode_buf(dev, urb);
205 if (err)205 if (err)
206 dump_mem("received usb message",206 pcan_dump_mem("received usb message",
207 urb->transfer_buffer,207 urb->transfer_buffer,
208 urb->transfer_buffer_length);208 urb->transfer_buffer_length);
209 }209 }
210 }210 }
211 211
drivers/net/can/usb/peak_usb/pcan_usb_core.h+1−1
@@ -131,7 +131,7 @@ struct peak_usb_device { · 130 unmodified lines
131 struct peak_usb_device *next_siblings;131 struct peak_usb_device *next_siblings;
132};132};
133 133
134void dump_mem(char *prompt, void *p, int l);134void pcan_dump_mem(char *prompt, void *p, int l);
135 135
136/* common timestamp management */136/* common timestamp management */
137void peak_usb_init_time_ref(struct peak_time_ref *time_ref,137void 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
292 if (!rec_len) {292 if (!rec_len) {
293 netdev_err(dev->netdev,293 netdev_err(dev->netdev,
294 "got unprocessed record in msg\n");294 "got unprocessed record in msg\n");
295 dump_mem("rcvd rsp msg", pum->u.rec_buffer,295 pcan_dump_mem("rcvd rsp msg", pum->u.rec_buffer,
296 actual_length);296 actual_length);
297 break;297 break;
298 }298 }
299 299
@@ -756,8 +756,8 @@ static int pcan_usb_pro_decode_buf(struct peak_usb_device *dev, struct urb *urb) · 456 unmodified lines
756 756
757fail:757fail:
758 if (err)758 if (err)
759 dump_mem("received msg",759 pcan_dump_mem("received msg",
760 urb->transfer_buffer, urb->actual_length);760 urb->transfer_buffer, urb->actual_length);
761 761
762 return err;762 return err;
763}763}
drivers/net/ethernet/Kconfig+0−9
@@ -89,15 +89,6 @@ source "drivers/net/ethernet/marvell/Kconfig" · 88 unmodified lines
89source "drivers/net/ethernet/mellanox/Kconfig"89source "drivers/net/ethernet/mellanox/Kconfig"
90source "drivers/net/ethernet/micrel/Kconfig"90source "drivers/net/ethernet/micrel/Kconfig"
91source "drivers/net/ethernet/microchip/Kconfig"91source "drivers/net/ethernet/microchip/Kconfig"
92
93config 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
101source "drivers/net/ethernet/myricom/Kconfig"92source "drivers/net/ethernet/myricom/Kconfig"
102 93
103config FEALNX94config FEALNX
drivers/net/ethernet/Makefile+0−1
@@ -40,7 +40,6 @@ obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ · 39 unmodified lines
40obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/40obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/
41obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/41obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/
42obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/42obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/
43obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
44obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/43obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/
45obj-$(CONFIG_FEALNX) += fealnx.o44obj-$(CONFIG_FEALNX) += fealnx.o
46obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/45obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/
drivers/net/ethernet/broadcom/Kconfig+1−0
@@ -101,6 +101,7 @@ config TIGON3 · 100 unmodified lines
101 tristate "Broadcom Tigon3 support"101 tristate "Broadcom Tigon3 support"
102 depends on PCI102 depends on PCI
103 select PHYLIB103 select PHYLIB
104 select HWMON
104 ---help---105 ---help---
105 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.106 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
106 107
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+2−2
@@ -23,8 +23,8 @@ · 22 unmodified lines
23 * (you will need to reboot afterwards) */23 * (you will need to reboot afterwards) */
24/* #define BNX2X_STOP_ON_ERROR */24/* #define BNX2X_STOP_ON_ERROR */
25 25
26#define DRV_MODULE_VERSION "1.72.51-0"26#define DRV_MODULE_VERSION "1.78.00-0"
27#define DRV_MODULE_RELDATE "2012/06/18"27#define DRV_MODULE_RELDATE "2012/09/27"
28#define BNX2X_BC_VER 0x04020028#define BNX2X_BC_VER 0x040200
29 29
30#if defined(CONFIG_DCB)30#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
2285 /* Wait for all pending SP commands to complete */2285 /* Wait for all pending SP commands to complete */
2286 if (!bnx2x_wait_sp_comp(bp, ~0x0UL)) {2286 if (!bnx2x_wait_sp_comp(bp, ~0x0UL)) {
2287 BNX2X_ERR("Timeout waiting for SP elements to complete\n");2287 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);
2289 return -EBUSY;2289 return -EBUSY;
2290 }2290 }
2291 2291
@@ -2333,7 +2333,7 @@ load_error0: · 41 unmodified lines
2333}2333}
2334 2334
2335/* must be called with rtnl_lock */2335/* must be called with rtnl_lock */
2336int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)2336int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
2337{2337{
2338 int i;2338 int i;
2339 bool global = false;2339 bool global = false;
@@ -2395,7 +2395,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) · 55 unmodified lines
2395 2395
2396 /* Cleanup the chip if needed */2396 /* Cleanup the chip if needed */
2397 if (unload_mode != UNLOAD_RECOVERY)2397 if (unload_mode != UNLOAD_RECOVERY)
2398 bnx2x_chip_cleanup(bp, unload_mode);2398 bnx2x_chip_cleanup(bp, unload_mode, keep_link);
2399 else {2399 else {
2400 /* Send the UNLOAD_REQUEST to the MCP */2400 /* Send the UNLOAD_REQUEST to the MCP */
2401 bnx2x_send_unload_req(bp, unload_mode);2401 bnx2x_send_unload_req(bp, unload_mode);
@@ -2419,7 +2419,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) · 17 unmodified lines
2419 bnx2x_free_irq(bp);2419 bnx2x_free_irq(bp);
2420 2420
2421 /* Report UNLOAD_DONE to MCP */2421 /* Report UNLOAD_DONE to MCP */
2422 bnx2x_send_unload_done(bp);2422 bnx2x_send_unload_done(bp, false);
2423 }2423 }
2424 2424
2425 /*2425 /*
@@ -3026,8 +3026,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 600 unmodified lines
3026 first_bd = tx_start_bd;3026 first_bd = tx_start_bd;
3027 3027
3028 tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;3028 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,3029 SET_FLAG(tx_start_bd->general_data,
3030 mac_type);3030 ETH_TX_START_BD_PARSE_NBDS,
3031 0);
3031 3032
3032 /* header nbd */3033 /* header nbd */
3033 SET_FLAG(tx_start_bd->general_data, ETH_TX_START_BD_HDR_NBDS, 1);3034 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
3077 &pbd_e2->dst_mac_addr_lo,3078 &pbd_e2->dst_mac_addr_lo,
3078 eth->h_dest);3079 eth->h_dest);
3079 }3080 }
3081
3082 SET_FLAG(pbd_e2_parsing_data,
3083 ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE, mac_type);
3080 } else {3084 } else {
3085 u16 global_data = 0;
3081 pbd_e1x = &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;3086 pbd_e1x = &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;
3082 memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));3087 memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));
3083 /* Set PBD in checksum offload case */3088 /* Set PBD in checksum offload case */
3084 if (xmit_type & XMIT_CSUM)3089 if (xmit_type & XMIT_CSUM)
3085 hlen = bnx2x_set_pbd_csum(bp, skb, pbd_e1x, xmit_type);3090 hlen = bnx2x_set_pbd_csum(bp, skb, pbd_e1x, xmit_type);
3086 3091
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);
3087 }3095 }
3088 3096
3089 /* Setup the data pointer of the first BD of the packet */3097 /* 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
3770 if (unlikely(!netif_running(dev)))3778 if (unlikely(!netif_running(dev)))
3771 return 0;3779 return 0;
3772 3780
3773 bnx2x_nic_unload(bp, UNLOAD_NORMAL);3781 bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
3774 return bnx2x_nic_load(bp, LOAD_NORMAL);3782 return bnx2x_nic_load(bp, LOAD_NORMAL);
3775}3783}
3776 3784
@@ -3967,7 +3975,7 @@ int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state) · 190 unmodified lines
3967 3975
3968 netif_device_detach(dev);3976 netif_device_detach(dev);
3969 3977
3970 bnx2x_nic_unload(bp, UNLOAD_CLOSE);3978 bnx2x_nic_unload(bp, UNLOAD_CLOSE, false);
3971 3979
3972 bnx2x_set_power_state(bp, pci_choose_state(pdev, state));3980 bnx2x_set_power_state(bp, pci_choose_state(pdev, state));
3973 3981
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
83 * bnx2x_send_unload_done - send UNLOAD_DONE command to the MCP.83 * bnx2x_send_unload_done - send UNLOAD_DONE command to the MCP.
84 *84 *
85 * @bp: driver handle85 * @bp: driver handle
86 * @keep_link: true iff link should be kept up
86 */87 */
87void bnx2x_send_unload_done(struct bnx2x *bp);88void bnx2x_send_unload_done(struct bnx2x *bp, bool keep_link);
88 89
89/**90/**
90 * bnx2x_config_rss_pf - configure RSS parameters in a PF.91 * 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
152 */153 */
153void bnx2x_link_set(struct bnx2x *bp);154void bnx2x_link_set(struct bnx2x *bp);
154 155
156/**
157 * bnx2x_force_link_reset - Forces link reset, and put the PHY
158 * in reset as well.
159 *
160 * @bp: driver handle
161 */
162void bnx2x_force_link_reset(struct bnx2x *bp);
163
155/**164/**
156 * bnx2x_link_test - query link status.165 * bnx2x_link_test - query link status.
157 *166 *
@@ -312,12 +321,13 @@ void bnx2x_set_num_queues(struct bnx2x *bp); · 154 unmodified lines
312 *321 *
313 * @bp: driver handle322 * @bp: driver handle
314 * @unload_mode: COMMON, PORT, FUNCTION323 * @unload_mode: COMMON, PORT, FUNCTION
324 * @keep_link: true iff link should be kept up.
315 *325 *
316 * - Cleanup MAC configuration.326 * - Cleanup MAC configuration.
317 * - Closes clients.327 * - Closes clients.
318 * - etc.328 * - etc.
319 */329 */
320void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode);330void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link);
321 331
322/**332/**
323 * bnx2x_acquire_hw_lock - acquire HW lock.333 * 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
446bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err);456bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err);
447 457
448/* dev_close main block */458/* dev_close main block */
449int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode);459int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link);
450 460
451/* dev_open main block */461/* dev_open main block */
452int bnx2x_nic_load(struct bnx2x *bp, int load_mode);462int 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
91 /*91 /*
92 * Rx COS configuration92 * Rx COS configuration
93 * Changing PFC RX configuration .93 * Changing PFC RX configuration .
94 * In RX COS0 will always be configured to lossy and COS1 to lossless94 * In RX COS0 will always be configured to lossless and COS1 to lossy
95 */95 */
96 for (i = 0 ; i < MAX_PFC_PRIORITIES ; i++) {96 for (i = 0 ; i < MAX_PFC_PRIORITIES ; i++) {
97 pri_bit = 1 << i;97 pri_bit = 1 << i;
98 98
99 if (pri_bit & DCBX_PFC_PRI_PAUSE_MASK(bp))99 if (!(pri_bit & DCBX_PFC_PRI_PAUSE_MASK(bp)))
100 val |= 1 << (i * 4);100 val |= 1 << (i * 4);
101 }101 }
102 102
103 pfc_params.pkt_priority_to_cos = val;103 pfc_params.pkt_priority_to_cos = val;
104 104
105 /* RX COS0 */105 /* RX COS0 */
106 pfc_params.llfc_low_priority_classes = 0;106 pfc_params.llfc_low_priority_classes = DCBX_PFC_PRI_PAUSE_MASK(bp);
107 /* RX COS1 */107 /* RX COS1 */
108 pfc_params.llfc_high_priority_classes = DCBX_PFC_PRI_PAUSE_MASK(bp);108 pfc_params.llfc_high_priority_classes = 0;
109
110 /* BRB configuration */
111 pfc_params.cos0_pauseable = false;
112 pfc_params.cos1_pauseable = true;
113 109
114 bnx2x_acquire_phy_lock(bp);110 bnx2x_acquire_phy_lock(bp);
115 bp->link_params.feature_config_flags |= FEATURE_CONFIG_PFC_ENABLED;111 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
905 905
906 if (netif_running(dev)) {906 if (netif_running(dev)) {
907 bnx2x_stats_handle(bp, STATS_EVENT_STOP);907 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
908 bnx2x_force_link_reset(bp);
908 bnx2x_link_set(bp);909 bnx2x_link_set(bp);
909 }910 }
910 911
@@ -1606,7 +1607,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev, · 695 unmodified lines
1606 return 0;1607 return 0;
1607}1608}
1608 1609
1609static char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {1610static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] = {
1610 "register_test (offline) ",1611 "register_test (offline) ",
1611 "memory_test (offline) ",1612 "memory_test (offline) ",
1612 "int_loopback_test (offline)",1613 "int_loopback_test (offline)",
@@ -1653,7 +1654,7 @@ static int bnx2x_get_eee(struct net_device *dev, struct ethtool_eee *edata) · 40 unmodified lines
1653 return -EOPNOTSUPP;1654 return -EOPNOTSUPP;
1654 }1655 }
1655 1656
1656 eee_cfg = SHMEM2_RD(bp, eee_status[BP_PORT(bp)]);1657 eee_cfg = bp->link_vars.eee_status;
1657 1658
1658 edata->supported =1659 edata->supported =
1659 bnx2x_eee_to_adv((eee_cfg & SHMEM_EEE_SUPPORTED_MASK) >>1660 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
1690 return -EOPNOTSUPP;1691 return -EOPNOTSUPP;
1691 }1692 }
1692 1693
1693 eee_cfg = SHMEM2_RD(bp, eee_status[BP_PORT(bp)]);1694 eee_cfg = bp->link_vars.eee_status;
1694 1695
1695 if (!(eee_cfg & SHMEM_EEE_SUPPORTED_MASK)) {1696 if (!(eee_cfg & SHMEM_EEE_SUPPORTED_MASK)) {
1696 DP(BNX2X_MSG_ETHTOOL, "Board does not support EEE!\n");1697 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
1739 /* Restart link to propogate changes */1740 /* Restart link to propogate changes */
1740 if (netif_running(dev)) {1741 if (netif_running(dev)) {
1741 bnx2x_stats_handle(bp, STATS_EVENT_STOP);1742 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
1743 bnx2x_force_link_reset(bp);
1742 bnx2x_link_set(bp);1744 bnx2x_link_set(bp);
1743 }1745 }
1744 1746
@@ -2038,8 +2040,6 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode) · 293 unmodified lines
2038 u16 pkt_prod, bd_prod;2040 u16 pkt_prod, bd_prod;
2039 struct sw_tx_bd *tx_buf;2041 struct sw_tx_bd *tx_buf;
2040 struct eth_tx_start_bd *tx_start_bd;2042 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;
2043 dma_addr_t mapping;2043 dma_addr_t mapping;
2044 union eth_rx_cqe *cqe;2044 union eth_rx_cqe *cqe;
2045 u8 cqe_fp_flags, cqe_fp_type;2045 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
2130 tx_start_bd->nbytes = cpu_to_le16(skb_headlen(skb));2130 tx_start_bd->nbytes = cpu_to_le16(skb_headlen(skb));
2131 tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);2131 tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
2132 tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;2132 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);
2136 SET_FLAG(tx_start_bd->general_data,2133 SET_FLAG(tx_start_bd->general_data,
2137 ETH_TX_START_BD_HDR_NBDS,2134 ETH_TX_START_BD_HDR_NBDS,
2138 1);2135 1);
2136 SET_FLAG(tx_start_bd->general_data,
2137 ETH_TX_START_BD_PARSE_NBDS,
2138 0);
2139 2139
2140 /* turn on parsing and get a BD */2140 /* turn on parsing and get a BD */
2141 bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));2141 bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
2142 2142
2143 pbd_e1x = &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;2143 if (CHIP_IS_E1x(bp)) {
2144 pbd_e2 = &txdata->tx_desc_ring[bd_prod].parse_bd_e2;2144 u16 global_data = 0;
2145 2145 struct eth_tx_parse_bd_e1x *pbd_e1x =
2146 memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2));2146 &txdata->tx_desc_ring[bd_prod].parse_bd_e1x;
2147 memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));2147 memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));
2148 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 }
2149 wmb();2160 wmb();
2150 2161
2151 txdata->tx_db.data.prod += 2;2162 txdata->tx_db.data.prod += 2;
@@ -2263,7 +2274,7 @@ static int bnx2x_test_ext_loopback(struct bnx2x *bp) · 111 unmodified lines
2263 if (!netif_running(bp->dev))2274 if (!netif_running(bp->dev))
2264 return BNX2X_EXT_LOOPBACK_FAILED;2275 return BNX2X_EXT_LOOPBACK_FAILED;
2265 2276
2266 bnx2x_nic_unload(bp, UNLOAD_NORMAL);2277 bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
2267 rc = bnx2x_nic_load(bp, LOAD_LOOPBACK_EXT);2278 rc = bnx2x_nic_load(bp, LOAD_LOOPBACK_EXT);
2268 if (rc) {2279 if (rc) {
2269 DP(BNX2X_MSG_ETHTOOL,2280 DP(BNX2X_MSG_ETHTOOL,
@@ -2414,7 +2425,7 @@ static void bnx2x_self_test(struct net_device *dev, · 144 unmodified lines
2414 2425
2415 link_up = bp->link_vars.link_up;2426 link_up = bp->link_vars.link_up;
2416 2427
2417 bnx2x_nic_unload(bp, UNLOAD_NORMAL);2428 bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
2418 rc = bnx2x_nic_load(bp, LOAD_DIAG);2429 rc = bnx2x_nic_load(bp, LOAD_DIAG);
2419 if (rc) {2430 if (rc) {
2420 etest->flags |= ETH_TEST_FL_FAILED;2431 etest->flags |= ETH_TEST_FL_FAILED;
@@ -2446,7 +2457,7 @@ static void bnx2x_self_test(struct net_device *dev, · 25 unmodified lines
2446 etest->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE;2457 etest->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE;
2447 }2458 }
2448 2459
2449 bnx2x_nic_unload(bp, UNLOAD_NORMAL);2460 bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
2450 2461
2451 /* restore input for TX port IF */2462 /* restore input for TX port IF */
2452 REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, val);2463 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
2534static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)2545static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
2535{2546{
2536 struct bnx2x *bp = netdev_priv(dev);2547 struct bnx2x *bp = netdev_priv(dev);
2537 int i, j, k, offset, start;2548 int i, j, k, start;
2538 char queue_name[MAX_QUEUE_NAME_LEN+1];2549 char queue_name[MAX_QUEUE_NAME_LEN+1];
2539 2550
2540 switch (stringset) {2551 switch (stringset) {
@@ -2570,13 +2581,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) · 29 unmodified lines
2570 start = 0;2581 start = 0;
2571 else2582 else
2572 start = 4;2583 start = 4;
2573 for (i = 0, j = start; j < (start + BNX2X_NUM_TESTS(bp));2584 memcpy(buf, bnx2x_tests_str_arr + start,
2574 i++, j++) {2585 ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp));
2575 offset = sprintf(buf+32*i, "%s",
2576 bnx2x_tests_str_arr[j]);
2577 *(buf+offset) = '\0';
2578 }
2579 break;
2580 }2586 }
2581}2587}
2582 2588
@@ -2940,7 +2946,7 @@ static int bnx2x_set_channels(struct net_device *dev, · 357 unmodified lines
2940 bnx2x_change_num_queues(bp, channels->combined_count);2946 bnx2x_change_num_queues(bp, channels->combined_count);
2941 return 0;2947 return 0;
2942 }2948 }
2943 bnx2x_nic_unload(bp, UNLOAD_NORMAL);2949 bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
2944 bnx2x_change_num_queues(bp, channels->combined_count);2950 bnx2x_change_num_queues(bp, channels->combined_count);
2945 return bnx2x_nic_load(bp, LOAD_NORMAL);2951 return bnx2x_nic_load(bp, LOAD_NORMAL);
2946}2952}
drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h+0−3
@@ -88,9 +88,6 @@ · 87 unmodified lines
88#define TSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[102].base)88#define TSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[102].base)
89#define TSTORM_ASSERT_LIST_OFFSET(assertListEntry) \89#define TSTORM_ASSERT_LIST_OFFSET(assertListEntry) \
90 (IRO[101].base + ((assertListEntry) * IRO[101].m1))90 (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)
94#define TSTORM_FUNCTION_COMMON_CONFIG_OFFSET(pfId) \91#define TSTORM_FUNCTION_COMMON_CONFIG_OFFSET(pfId) \
95 (IRO[201].base + ((pfId) * IRO[201].m1))92 (IRO[201].base + ((pfId) * IRO[201].m1))
96#define TSTORM_FUNC_EN_OFFSET(funcId) \93#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
1286 #define DRV_MSG_CODE_SET_MF_BW_MIN_MASK 0x00ff00001286 #define DRV_MSG_CODE_SET_MF_BW_MIN_MASK 0x00ff0000
1287 #define DRV_MSG_CODE_SET_MF_BW_MAX_MASK 0xff0000001287 #define DRV_MSG_CODE_SET_MF_BW_MAX_MASK 0xff000000
1288 1288
1289 #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002
1290
1291 #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a
1289 u32 fw_mb_header;1292 u32 fw_mb_header;
1290 #define FW_MSG_CODE_MASK 0xffff00001293 #define FW_MSG_CODE_MASK 0xffff0000
1291 #define FW_MSG_CODE_DRV_LOAD_COMMON 0x101000001294 #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000
@@ -1909,6 +1912,54 @@ struct lldp_local_mib { · 617 unmodified lines
1909};1912};
1910/***END OF DCBX STRUCTURES DECLARATIONS***/1913/***END OF DCBX STRUCTURES DECLARATIONS***/
1911 1914
1915/***********************************************************/
1916/* Elink section */
1917/***********************************************************/
1918#define SHMEM_LINK_CONFIG_SIZE 2
1919struct 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
1912struct ncsi_oem_fcoe_features {1963struct ncsi_oem_fcoe_features {
1913 u32 fcoe_features1;1964 u32 fcoe_features1;
1914 #define FCOE_FEATURES1_IOS_PER_CONNECTION_MASK 0x0000FFFF1965 #define FCOE_FEATURES1_IOS_PER_CONNECTION_MASK 0x0000FFFF
@@ -2738,8 +2789,8 @@ struct afex_stats { · 823 unmodified lines
2738};2789};
2739 2790
2740#define BCM_5710_FW_MAJOR_VERSION 72791#define BCM_5710_FW_MAJOR_VERSION 7
2741#define BCM_5710_FW_MINOR_VERSION 22792#define BCM_5710_FW_MINOR_VERSION 8
2742#define BCM_5710_FW_REVISION_VERSION 512793#define BCM_5710_FW_REVISION_VERSION 2
2743#define BCM_5710_FW_ENGINEERING_VERSION 02794#define BCM_5710_FW_ENGINEERING_VERSION 0
2744#define BCM_5710_FW_COMPILE_FLAGS 12795#define BCM_5710_FW_COMPILE_FLAGS 1
2745 2796
@@ -3861,10 +3912,8 @@ struct eth_rss_update_ramrod_data { · 1115 unmodified lines
3861#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY_SHIFT 43912#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY_SHIFT 4
3862#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY (0x1<<5)3913#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY (0x1<<5)
3863#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY_SHIFT 53914#define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY_SHIFT 5
3864#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<6)3915#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<7)
3865#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 63916#define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 7
3866#define __ETH_RSS_UPDATE_RAMROD_DATA_RESERVED0 (0x1<<7)
3867#define __ETH_RSS_UPDATE_RAMROD_DATA_RESERVED0_SHIFT 7
3868 u8 rss_result_mask;3917 u8 rss_result_mask;
3869 u8 rss_mode;3918 u8 rss_mode;
3870 __le32 __reserved2;3919 __le32 __reserved2;
@@ -4080,27 +4129,29 @@ struct eth_tx_start_bd { · 209 unmodified lines
4080#define ETH_TX_START_BD_HDR_NBDS_SHIFT 04129#define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
4081#define ETH_TX_START_BD_FORCE_VLAN_MODE (0x1<<4)4130#define ETH_TX_START_BD_FORCE_VLAN_MODE (0x1<<4)
4082#define ETH_TX_START_BD_FORCE_VLAN_MODE_SHIFT 44131#define ETH_TX_START_BD_FORCE_VLAN_MODE_SHIFT 4
4083#define ETH_TX_START_BD_RESREVED (0x1<<5)4132#define ETH_TX_START_BD_PARSE_NBDS (0x3<<5)
4084#define ETH_TX_START_BD_RESREVED_SHIFT 54133#define ETH_TX_START_BD_PARSE_NBDS_SHIFT 5
4085#define ETH_TX_START_BD_ETH_ADDR_TYPE (0x3<<6)4134#define ETH_TX_START_BD_RESREVED (0x1<<7)
4086#define ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT 64135#define ETH_TX_START_BD_RESREVED_SHIFT 7
4087};4136};
4088 4137
4089/*4138/*
4090 * Tx parsing BD structure for ETH E1/E1h4139 * Tx parsing BD structure for ETH E1/E1h
4091 */4140 */
4092struct eth_tx_parse_bd_e1x {4141struct eth_tx_parse_bd_e1x {
4093 u8 global_data;4142 __le16 global_data;
4094#define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)4143#define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)
4095#define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 04144#define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 0
4096#define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x1<<4)4145#define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE (0x3<<4)
4097#define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 44146#define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE_SHIFT 4
4098#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<5)4147#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<6)
4099#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 54148#define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 6
4100#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<6)4149#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<7)
4101#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 64150#define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 7
4102#define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<7)4151#define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<8)
4103#define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 74152#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
4104 u8 tcp_flags;4155 u8 tcp_flags;
4105#define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)4156#define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)
4106#define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 04157#define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 0
@@ -4119,7 +4170,6 @@ struct eth_tx_parse_bd_e1x { · 12 unmodified lines
4119#define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)4170#define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)
4120#define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 74171#define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 7
4121 u8 ip_hlen_w;4172 u8 ip_hlen_w;
4122 s8 reserved;
4123 __le16 total_hlen_w;4173 __le16 total_hlen_w;
4124 __le16 tcp_pseudo_csum;4174 __le16 tcp_pseudo_csum;
4125 __le16 lso_mss;4175 __le16 lso_mss;
@@ -4138,14 +4188,16 @@ struct eth_tx_parse_bd_e2 { · 12 unmodified lines
4138 __le16 src_mac_addr_mid;4188 __le16 src_mac_addr_mid;
4139 __le16 src_mac_addr_hi;4189 __le16 src_mac_addr_hi;
4140 __le32 parsing_data;4190 __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)
4142#define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT 04192#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)4193#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<11)
4144#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 134194#define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 11
4145#define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<17)4195#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<15)
4146#define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 174196#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 15
4147#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<31)4197#define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<16)
4148#define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 314198#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
4149};4201};
4150 4202
4151/*4203/*
@@ -4913,7 +4965,8 @@ struct flow_control_configuration { · 761 unmodified lines
4913 *4965 *
4914 */4966 */
4915struct function_start_data {4967struct function_start_data {
4916 __le16 function_mode;4968 u8 function_mode;
4969 u8 reserved;
4917 __le16 sd_vlan_tag;4970 __le16 sd_vlan_tag;
4918 __le16 vif_id;4971 __le16 vif_id;
4919 u8 path_id;4972 u8 path_id;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h+1−1
@@ -566,7 +566,7 @@ static const struct { · 565 unmodified lines
566 u32 e2; /* 57712 */566 u32 e2; /* 57712 */
567 u32 e3; /* 578xx */567 u32 e3; /* 578xx */
568 } reg_mask; /* Register mask (all valid bits) */568 } reg_mask; /* Register mask (all valid bits) */
569 char name[7]; /* Block's longest name is 6 characters long569 char name[8]; /* Block's longest name is 7 characters long
570 * (name + suffix)570 * (name + suffix)
571 */571 */
572} bnx2x_blocks_parity_data[] = {572} bnx2x_blocks_parity_data[] = {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c+828−873
@@ -161,120 +161,6 @@ · 160 unmodified lines
161#define EDC_MODE_LIMITING 0x0044161#define EDC_MODE_LIMITING 0x0044
162#define EDC_MODE_PASSIVE_DAC 0x0055162#define EDC_MODE_PASSIVE_DAC 0x0055
163 163
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
278/* ETS defines*/164/* ETS defines*/
279#define DCBX_INVALID_COS (0xFF)165#define DCBX_INVALID_COS (0xFF)
280 166
@@ -321,6 +207,127 @@ static u32 bnx2x_bits_dis(struct bnx2x *bp, u32 reg, u32 bits) · 40 unmodified lines
321 return val;207 return val;
322}208}
323 209
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 */
218static 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}
324/******************************************************************/331/******************************************************************/
325/* EPIO/GPIO section */332/* EPIO/GPIO section */
326/******************************************************************/333/******************************************************************/
@@ -1306,93 +1313,6 @@ int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) · 979 unmodified lines
1306 return 0;1313 return 0;
1307}1314}
1308 1315
1309/******************************************************************/
1310/* EEE section */
1311/******************************************************************/
1312static 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
1323static 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
1343static 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
1363static 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
1396/******************************************************************/1316/******************************************************************/
1397/* PFC section */1317/* PFC section */
1398/******************************************************************/1318/******************************************************************/
@@ -1606,16 +1526,23 @@ static void bnx2x_set_xumac_nig(struct link_params *params, · 207 unmodified lines
1606 NIG_REG_P0_MAC_PAUSE_OUT_EN, tx_pause_en);1526 NIG_REG_P0_MAC_PAUSE_OUT_EN, tx_pause_en);
1607}1527}
1608 1528
1609static void bnx2x_umac_disable(struct link_params *params)1529static void bnx2x_set_umac_rxtx(struct link_params *params, u8 en)
1610{1530{
1611 u32 umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0;1531 u32 umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0;
1532 u32 val;
1612 struct bnx2x *bp = params->bp;1533 struct bnx2x *bp = params->bp;
1613 if (!(REG_RD(bp, MISC_REG_RESET_REG_2) &1534 if (!(REG_RD(bp, MISC_REG_RESET_REG_2) &
1614 (MISC_REGISTERS_RESET_REG_2_UMAC0 << params->port)))1535 (MISC_REGISTERS_RESET_REG_2_UMAC0 << params->port)))
1615 return;1536 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);
1617 /* Disable RX and TX */1544 /* 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);
1619}1546}
1620 1547
1621static void bnx2x_umac_enable(struct link_params *params,1548static void bnx2x_umac_enable(struct link_params *params,
@@ -1671,6 +1598,16 @@ static void bnx2x_umac_enable(struct link_params *params, · 49 unmodified lines
1671 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val);1598 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val);
1672 udelay(50);1599 udelay(50);
1673 1600
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
1674 /* Set MAC address for source TX Pause/PFC frames (under SW reset) */1611 /* Set MAC address for source TX Pause/PFC frames (under SW reset) */
1675 REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR0,1612 REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR0,
1676 ((params->mac_addr[2] << 24) |1613 ((params->mac_addr[2] << 24) |
@@ -1766,11 +1703,12 @@ static void bnx2x_xmac_init(struct link_params *params, u32 max_speed) · 89 unmodified lines
1766 1703
1767}1704}
1768 1705
1769static void bnx2x_xmac_disable(struct link_params *params)1706static void bnx2x_set_xmac_rxtx(struct link_params *params, u8 en)
1770{1707{
1771 u8 port = params->port;1708 u8 port = params->port;
1772 struct bnx2x *bp = params->bp;1709 struct bnx2x *bp = params->bp;
1773 u32 pfc_ctrl, xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;1710 u32 pfc_ctrl, xmac_base = (port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0;
1711 u32 val;
1774 1712
1775 if (REG_RD(bp, MISC_REG_RESET_REG_2) &1713 if (REG_RD(bp, MISC_REG_RESET_REG_2) &
1776 MISC_REGISTERS_RESET_REG_2_XMAC) {1714 MISC_REGISTERS_RESET_REG_2_XMAC) {
@@ -1784,7 +1722,12 @@ static void bnx2x_xmac_disable(struct link_params *params) · 7 unmodified lines
1784 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,1722 REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI,
1785 (pfc_ctrl | (1<<1)));1723 (pfc_ctrl | (1<<1)));
1786 DP(NETIF_MSG_LINK, "Disable XMAC on port %x\n", port);1724 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);
1788 }1731 }
1789}1732}
1790 1733
@@ -2087,391 +2030,6 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, · 296 unmodified lines
2087 REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, wb_data, 2);2030 REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, wb_data, 2);
2088}2031}
2089 2032
2090/* PFC BRB internal port configuration params */
2091struct bnx2x_pfc_brb_threshold_val {
2092 u32 pause_xoff;
2093 u32 pause_xon;
2094 u32 full_xoff;
2095 u32 full_xon;
2096};
2097
2098struct 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
2110struct 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};
2117static 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
2240static 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}
2319static 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
2475/******************************************************************************2033/******************************************************************************
2476* Description:2034* Description:
2477* This function is needed because NIG ARB_CREDIT_WEIGHT_X are2035* 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
2529 port_mb[params->port].link_status), link_status);2087 port_mb[params->port].link_status), link_status);
2530}2088}
2531 2089
2532static 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
2542static void bnx2x_update_pfc_nig(struct link_params *params,2090static void bnx2x_update_pfc_nig(struct link_params *params,
2543 struct link_vars *vars,2091 struct link_vars *vars,
2544 struct bnx2x_nig_brb_pfc_port_params *nig_params)2092 struct bnx2x_nig_brb_pfc_port_params *nig_params)
@@ -2658,11 +2206,6 @@ int bnx2x_update_pfc(struct link_params *params, · 113 unmodified lines
2658 /* Update NIG params */2206 /* Update NIG params */
2659 bnx2x_update_pfc_nig(params, vars, pfc_params);2207 bnx2x_update_pfc_nig(params, vars, pfc_params);
2660 2208
2661 /* Update BRB params */
2662 bnx2x_status = bnx2x_update_pfc_brb(params, vars, pfc_params);
2663 if (bnx2x_status)
2664 return bnx2x_status;
2665
2666 if (!vars->link_up)2209 if (!vars->link_up)
2667 return bnx2x_status;2210 return bnx2x_status;
2668 2211
@@ -2827,16 +2370,18 @@ static int bnx2x_bmac2_enable(struct link_params *params, · 158 unmodified lines
2827 2370
2828static int bnx2x_bmac_enable(struct link_params *params,2371static int bnx2x_bmac_enable(struct link_params *params,
2829 struct link_vars *vars,2372 struct link_vars *vars,
2830 u8 is_lb)2373 u8 is_lb, u8 reset_bmac)
2831{2374{
2832 int rc = 0;2375 int rc = 0;
2833 u8 port = params->port;2376 u8 port = params->port;
2834 struct bnx2x *bp = params->bp;2377 struct bnx2x *bp = params->bp;
2835 u32 val;2378 u32 val;
2836 /* Reset and unreset the BigMac */2379 /* Reset and unreset the BigMac */
2837 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,2380 if (reset_bmac) {
2838 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));2381 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,
2839 usleep_range(1000, 2000);2382 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
2383 usleep_range(1000, 2000);
2384 }
2840 2385
2841 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,2386 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,
2842 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));2387 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
@@ -2868,37 +2413,28 @@ static int bnx2x_bmac_enable(struct link_params *params, · 25 unmodified lines
2868 return rc;2413 return rc;
2869}2414}
2870 2415
2871static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port)2416static void bnx2x_set_bmac_rx(struct bnx2x *bp, u32 chip_id, u8 port, u8 en)
2872{2417{
2873 u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM :2418 u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM :
2874 NIG_REG_INGRESS_BMAC0_MEM;2419 NIG_REG_INGRESS_BMAC0_MEM;
2875 u32 wb_data[2];2420 u32 wb_data[2];
2876 u32 nig_bmac_enable = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4);2421 u32 nig_bmac_enable = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4);
2877 2422
2423 if (CHIP_IS_E2(bp))
2424 bmac_addr += BIGMAC2_REGISTER_BMAC_CONTROL;
2425 else
2426 bmac_addr += BIGMAC_REGISTER_BMAC_CONTROL;
2878 /* Only if the bmac is out of reset */2427 /* Only if the bmac is out of reset */
2879 if (REG_RD(bp, MISC_REG_RESET_REG_2) &2428 if (REG_RD(bp, MISC_REG_RESET_REG_2) &
2880 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port) &&2429 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port) &&
2881 nig_bmac_enable) {2430 nig_bmac_enable) {
2882 2431 /* Clear Rx Enable bit in BMAC_CONTROL register */
2883 if (CHIP_IS_E2(bp)) {2432 REG_RD_DMAE(bp, bmac_addr, wb_data, 2);
2884 /* Clear Rx Enable bit in BMAC_CONTROL register */2433 if (en)
2885 REG_RD_DMAE(bp, bmac_addr +2434 wb_data[0] |= BMAC_CONTROL_RX_ENABLE;
2886 BIGMAC2_REGISTER_BMAC_CONTROL,2435 else
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);
2897 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;2436 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
2898 REG_WR_DMAE(bp, bmac_addr +2437 REG_WR_DMAE(bp, bmac_addr, wb_data, 2);
2899 BIGMAC_REGISTER_BMAC_CONTROL,
2900 wb_data, 2);
2901 }
2902 usleep_range(1000, 2000);2438 usleep_range(1000, 2000);
2903 }2439 }
2904}2440}
@@ -3233,6 +2769,245 @@ static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, · 328 unmodified lines
3233 EMAC_MDIO_STATUS_10MB);2769 EMAC_MDIO_STATUS_10MB);
3234 return rc;2770 return rc;
3235}2771}
2772
2773/******************************************************************/
2774/* EEE section */
2775/******************************************************************/
2776static 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
2787static 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
2807static 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
2827static 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
2859static 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
2892static 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
2911static 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
2927static 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
2954static 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
2964static 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
3236/******************************************************************/3011/******************************************************************/
3237/* BSC access functions from E3 */3012/* BSC access functions from E3 */
3238/******************************************************************/3013/******************************************************************/
@@ -3754,6 +3529,19 @@ static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy, · 515 unmodified lines
3754 * init configuration, and set/clear SGMII flag. Internal3529 * init configuration, and set/clear SGMII flag. Internal
3755 * phy init is done purely in phy_init stage.3530 * phy init is done purely in phy_init stage.
3756 */3531 */
3532
3533static 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
3757static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,3545static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
3758 struct link_params *params,3546 struct link_params *params,
3759 struct link_vars *vars) {3547 struct link_vars *vars) {
@@ -4013,13 +3801,7 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, · 253 unmodified lines
4013 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,3801 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
4014 MDIO_WC_REG_DIGITAL4_MISC3, 0x8080);3802 MDIO_WC_REG_DIGITAL4_MISC3, 0x8080);
4015 3803
4016 /* Enable LPI pass through */3804 bnx2x_warpcore_set_lpi_passthrough(phy, params);
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);
4023 3805
4024 /* 10G XFI Full Duplex */3806 /* 10G XFI Full Duplex */
4025 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,3807 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
4116 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,3898 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
4117 MDIO_WC_REG_RX66_CONTROL, val16 & ~(3<<13));3899 MDIO_WC_REG_RX66_CONTROL, val16 & ~(3<<13));
4118 3900
3901 bnx2x_warpcore_set_lpi_passthrough(phy, params);
3902
4119 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) {3903 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) {
4120 /* SGMII Autoneg */3904 /* SGMII Autoneg */
4121 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,3905 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
4409 "serdes_net_if = 0x%x\n",4193 "serdes_net_if = 0x%x\n",
4410 vars->line_speed, serdes_net_if);4194 vars->line_speed, serdes_net_if);
4411 bnx2x_set_aer_mmd(params, phy);4195 bnx2x_set_aer_mmd(params, phy);
4412 4196 bnx2x_warpcore_reset_lane(bp, phy, 1);
4413 vars->phy_flags |= PHY_XGXS_FLAG;4197 vars->phy_flags |= PHY_XGXS_FLAG;
4414 if ((serdes_net_if == PORT_HW_CFG_NET_SERDES_IF_SGMII) ||4198 if ((serdes_net_if == PORT_HW_CFG_NET_SERDES_IF_SGMII) ||
4415 (phy->req_line_speed &&4199 (phy->req_line_speed &&
@@ -4718,6 +4502,10 @@ void bnx2x_link_status_update(struct link_params *params, · 302 unmodified lines
4718 vars->link_status = REG_RD(bp, params->shmem_base +4502 vars->link_status = REG_RD(bp, params->shmem_base +
4719 offsetof(struct shmem_region,4503 offsetof(struct shmem_region,
4720 port_mb[port].link_status));4504 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]));
4721 4509
4722 vars->phy_flags = PHY_XGXS_FLAG;4510 vars->phy_flags = PHY_XGXS_FLAG;
4723 bnx2x_sync_link(params, vars);4511 bnx2x_sync_link(params, vars);
@@ -6530,25 +6318,21 @@ static int bnx2x_update_link_down(struct link_params *params, · 1806 unmodified lines
6530 usleep_range(10000, 20000);6318 usleep_range(10000, 20000);
6531 /* Reset BigMac/Xmac */6319 /* Reset BigMac/Xmac */
6532 if (CHIP_IS_E1x(bp) ||6320 if (CHIP_IS_E1x(bp) ||
6533 CHIP_IS_E2(bp)) {6321 CHIP_IS_E2(bp))
6534 bnx2x_bmac_rx_disable(bp, params->port);6322 bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 0);
6535 REG_WR(bp, GRCBASE_MISC +6323
6536 MISC_REGISTERS_RESET_REG_2_CLEAR,
6537 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
6538 }
6539 if (CHIP_IS_E3(bp)) {6324 if (CHIP_IS_E3(bp)) {
6540 /* Prevent LPI Generation by chip */6325 /* Prevent LPI Generation by chip */
6541 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2),6326 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2),
6542 0);6327 0);
6543 REG_WR(bp, MISC_REG_CPMU_LP_DR_ENABLE, 0);
6544 REG_WR(bp, MISC_REG_CPMU_LP_MASK_ENT_P0 + (params->port << 2),6328 REG_WR(bp, MISC_REG_CPMU_LP_MASK_ENT_P0 + (params->port << 2),
6545 0);6329 0);
6546 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK |6330 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK |
6547 SHMEM_EEE_ACTIVE_BIT);6331 SHMEM_EEE_ACTIVE_BIT);
6548 6332
6549 bnx2x_update_mng_eee(params, vars->eee_status);6333 bnx2x_update_mng_eee(params, vars->eee_status);
6550 bnx2x_xmac_disable(params);6334 bnx2x_set_xmac_rxtx(params, 0);
6551 bnx2x_umac_disable(params);6335 bnx2x_set_umac_rxtx(params, 0);
6552 }6336 }
6553 6337
6554 return 0;6338 return 0;
@@ -6600,7 +6384,7 @@ static int bnx2x_update_link_up(struct link_params *params, · 45 unmodified lines
6600 if ((CHIP_IS_E1x(bp) ||6384 if ((CHIP_IS_E1x(bp) ||
6601 CHIP_IS_E2(bp))) {6385 CHIP_IS_E2(bp))) {
6602 if (link_10g) {6386 if (link_10g) {
6603 if (bnx2x_bmac_enable(params, vars, 0) ==6387 if (bnx2x_bmac_enable(params, vars, 0, 1) ==
6604 -ESRCH) {6388 -ESRCH) {
6605 DP(NETIF_MSG_LINK, "Found errors on BMAC\n");6389 DP(NETIF_MSG_LINK, "Found errors on BMAC\n");
6606 vars->link_up = 0;6390 vars->link_up = 0;
@@ -7207,6 +6991,22 @@ static void bnx2x_8073_set_pause_cl37(struct link_params *params, · 600 unmodified lines
7207 msleep(500);6991 msleep(500);
7208}6992}
7209 6993
6994static 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
7210static int bnx2x_8073_config_init(struct bnx2x_phy *phy,7010static int bnx2x_8073_config_init(struct bnx2x_phy *phy,
7211 struct link_params *params,7011 struct link_params *params,
7212 struct link_vars *vars)7012 struct link_vars *vars)
@@ -7227,12 +7027,7 @@ static int bnx2x_8073_config_init(struct bnx2x_phy *phy, · 14 unmodified lines
7227 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,7027 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,
7228 MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port);7028 MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port);
7229 7029
7230 /* Enable LASI */7030 bnx2x_8073_specific_func(phy, params, PHY_INIT);
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
7236 bnx2x_8073_set_pause_cl37(params, phy, vars);7031 bnx2x_8073_set_pause_cl37(params, phy, vars);
7237 7032
7238 bnx2x_cl45_read(bp, phy,7033 bnx2x_cl45_read(bp, phy,
@@ -8267,7 +8062,7 @@ static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, · 1028 unmodified lines
8267 u32 action)8062 u32 action)
8268{8063{
8269 struct bnx2x *bp = params->bp;8064 struct bnx2x *bp = params->bp;
8270 8065 u16 val;
8271 switch (action) {8066 switch (action) {
8272 case DISABLE_TX:8067 case DISABLE_TX:
8273 bnx2x_sfp_set_transmitter(params, phy, 0);8068 bnx2x_sfp_set_transmitter(params, phy, 0);
@@ -8276,6 +8071,40 @@ static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, · 2 unmodified lines
8276 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED))8071 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED))
8277 bnx2x_sfp_set_transmitter(params, phy, 1);8072 bnx2x_sfp_set_transmitter(params, phy, 1);
8278 break;8073 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;
8279 default:8108 default:
8280 DP(NETIF_MSG_LINK, "Function 0x%x not supported by 8727\n",8109 DP(NETIF_MSG_LINK, "Function 0x%x not supported by 8727\n",
8281 action);8110 action);
@@ -9058,28 +8887,15 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, · 776 unmodified lines
9058 struct link_vars *vars)8887 struct link_vars *vars)
9059{8888{
9060 u32 tx_en_mode;8889 u32 tx_en_mode;
9061 u16 tmp1, val, mod_abs, tmp2;8890 u16 tmp1, mod_abs, tmp2;
9062 u16 rx_alarm_ctrl_val;
9063 u16 lasi_ctrl_val;
9064 struct bnx2x *bp = params->bp;8891 struct bnx2x *bp = params->bp;
9065 /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */8892 /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */
9066 8893
9067 bnx2x_wait_reset_complete(bp, phy, params);8894 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;
9071 8895
9072 DP(NETIF_MSG_LINK, "Initializing BCM8727\n");8896 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);
9082 8897
8898 bnx2x_8727_specific_func(phy, params, PHY_INIT);
9083 /* Initially configure MOD_ABS to interrupt when module is8899 /* Initially configure MOD_ABS to interrupt when module is
9084 * presence( bit 8)8900 * presence( bit 8)
9085 */8901 */
@@ -9095,25 +8911,9 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, · 9 unmodified lines
9095 bnx2x_cl45_write(bp, phy,8911 bnx2x_cl45_write(bp, phy,
9096 MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs);8912 MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs);
9097 8913
9098
9099 /* Enable/Disable PHY transmitter output */8914 /* Enable/Disable PHY transmitter output */
9100 bnx2x_set_disable_pmd_transmit(params, phy, 0);8915 bnx2x_set_disable_pmd_transmit(params, phy, 0);
9101 8916
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
9117 bnx2x_8727_power_module(bp, phy, 1);8917 bnx2x_8727_power_module(bp, phy, 1);
9118 8918
9119 bnx2x_cl45_read(bp, phy,8919 bnx2x_cl45_read(bp, phy,
@@ -9123,13 +8923,7 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, · 3 unmodified lines
9123 MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXSTAT, &tmp1);8923 MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXSTAT, &tmp1);
9124 8924
9125 bnx2x_8727_config_speed(phy, params);8925 bnx2x_8727_config_speed(phy, params);
9126 /* Set 2-wire transfer rate of SFP+ module EEPROM8926
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);
9133 8927
9134 /* Set TX PreEmphasis if needed */8928 /* Set TX PreEmphasis if needed */
9135 if ((params->feature_config_flags &8929 if ((params->feature_config_flags &
@@ -9558,6 +9352,29 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp, · 422 unmodified lines
9558 0xFFFB, 0xFFFD);9352 0xFFFB, 0xFFFD);
9559}9353}
9560 9354
9355static 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
9561static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,9378static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
9562 struct link_params *params,9379 struct link_params *params,
9563 struct link_vars *vars)9380 struct link_vars *vars)
@@ -9565,22 +9382,10 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, · 1 unmodified line
9565 struct bnx2x *bp = params->bp;9382 struct bnx2x *bp = params->bp;
9566 u16 autoneg_val, an_1000_val, an_10_100_val, an_10g_val;9383 u16 autoneg_val, an_1000_val, an_10_100_val, an_10g_val;
9567 9384
9568 if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) {9385 bnx2x_848xx_specific_func(phy, params, PHY_INIT);
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
9579 bnx2x_cl45_write(bp, phy,9386 bnx2x_cl45_write(bp, phy,
9580 MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0x0000);9387 MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0x0000);
9581 9388
9582 bnx2x_848xx_set_led(bp, phy);
9583
9584 /* set 1000 speed advertisement */9389 /* set 1000 speed advertisement */
9585 bnx2x_cl45_read(bp, phy,9390 bnx2x_cl45_read(bp, phy,
9586 MDIO_AN_DEVAD, MDIO_AN_REG_8481_1000T_CTRL,9391 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
9887 return 0;9692 return 0;
9888}9693}
9889 9694
9890static 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
9923static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,9695static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,
9924 struct link_params *params,9696 struct link_params *params,
9925 struct link_vars *vars)9697 struct link_vars *vars)
@@ -9930,10 +9702,6 @@ static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy, · 4 unmodified lines
9930 9702
9931 DP(NETIF_MSG_LINK, "Don't Advertise 10GBase-T EEE\n");9703 DP(NETIF_MSG_LINK, "Don't Advertise 10GBase-T EEE\n");
9932 9704
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
9937 /* Prevent Phy from working in EEE and advertising it */9705 /* Prevent Phy from working in EEE and advertising it */
9938 rc = bnx2x_84833_cmd_hdlr(phy, params,9706 rc = bnx2x_84833_cmd_hdlr(phy, params,
9939 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);9707 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
9942 return rc;9710 return rc;
9943 }9711 }
9944 9712
9945 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0);9713 return bnx2x_eee_disable(phy, params, vars);
9946 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
9947
9948 return 0;
9949}9714}
9950 9715
9951static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy,9716static 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
9956 struct bnx2x *bp = params->bp;9721 struct bnx2x *bp = params->bp;
9957 u16 cmd_args = 1;9722 u16 cmd_args = 1;
9958 9723
9959 DP(NETIF_MSG_LINK, "Advertise 10GBase-T EEE\n");
9960
9961 rc = bnx2x_84833_cmd_hdlr(phy, params,9724 rc = bnx2x_84833_cmd_hdlr(phy, params,
9962 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);9725 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);
9963 if (rc) {9726 if (rc) {
@@ -9965,15 +9728,7 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy, · 1 unmodified line
9965 return rc;9728 return rc;
9966 }9729 }
9967 9730
9968 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0x8);9731 return bnx2x_eee_advertise(phy, params, vars, SHMEM_EEE_10G_ADV);
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;
9977}9732}
9978 9733
9979#define PHY84833_CONSTANT_LATENCY 11939734#define PHY84833_CONSTANT_LATENCY 1193
@@ -10105,22 +9860,10 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 125 unmodified lines
10105 MDIO_84833_TOP_CFG_FW_REV, &val);9860 MDIO_84833_TOP_CFG_FW_REV, &val);
10106 9861
10107 /* Configure EEE support */9862 /* Configure EEE support */
10108 if ((val >= MDIO_84833_TOP_CFG_FW_EEE) && bnx2x_eee_has_cap(params)) {9863 if ((val >= MDIO_84833_TOP_CFG_FW_EEE) &&
10109 phy->flags |= FLAGS_EEE_10GBT;9864 (val != MDIO_84833_TOP_CFG_FW_NO_EEE) &&
10110 vars->eee_status |= SHMEM_EEE_10G_ADV <<9865 bnx2x_eee_has_cap(params)) {
10111 SHMEM_EEE_SUPPORTED_SHIFT;9866 rc = bnx2x_eee_initial_config(params, vars, SHMEM_EEE_10G_ADV);
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);
10124 if (rc) {9867 if (rc) {
10125 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n");9868 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n");
10126 bnx2x_8483x_disable_eee(phy, params, vars);9869 bnx2x_8483x_disable_eee(phy, params, vars);
@@ -10139,7 +9882,6 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 12 unmodified lines
10139 return rc;9882 return rc;
10140 }9883 }
10141 } else {9884 } else {
10142 phy->flags &= ~FLAGS_EEE_10GBT;
10143 vars->eee_status &= ~SHMEM_EEE_SUPPORTED_MASK;9885 vars->eee_status &= ~SHMEM_EEE_SUPPORTED_MASK;
10144 }9886 }
10145 9887
@@ -10278,29 +10020,8 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, · 132 unmodified lines
10278 LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE;10020 LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE;
10279 10021
10280 /* Determine if EEE was negotiated */10022 /* Determine if EEE was negotiated */
10281 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) {10023 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833)
10282 u32 eee_shmem = 0;10024 bnx2x_eee_an_resolve(phy, params, vars);
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 }
10304 }10025 }
10305 10026
10306 return link_up;10027 return link_up;
@@ -10569,6 +10290,35 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, · 262 unmodified lines
10569/******************************************************************/10290/******************************************************************/
10570/* 54618SE PHY SECTION */10291/* 54618SE PHY SECTION */
10571/******************************************************************/10292/******************************************************************/
10293static 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
10572static int bnx2x_54618se_config_init(struct bnx2x_phy *phy,10322static int bnx2x_54618se_config_init(struct bnx2x_phy *phy,
10573 struct link_params *params,10323 struct link_params *params,
10574 struct link_vars *vars)10324 struct link_vars *vars)
@@ -10606,24 +10356,8 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, · 31 unmodified lines
10606 /* Wait for GPHY to reset */10356 /* Wait for GPHY to reset */
10607 msleep(50);10357 msleep(50);
10608 10358
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);
10626 10359
10360 bnx2x_54618se_specific_func(phy, params, PHY_INIT);
10627 /* Flip the signal detect polarity (set 0x1c.0x1e[8]). */10361 /* Flip the signal detect polarity (set 0x1c.0x1e[8]). */
10628 bnx2x_cl22_write(bp, phy,10362 bnx2x_cl22_write(bp, phy,
10629 MDIO_REG_GPHY_SHADOW,10363 MDIO_REG_GPHY_SHADOW,
@@ -10728,28 +10462,52 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, · 98 unmodified lines
10728 DP(NETIF_MSG_LINK, "Setting 10M force\n");10462 DP(NETIF_MSG_LINK, "Setting 10M force\n");
10729 }10463 }
10730 10464
10731 /* Check if we should turn on Auto-GrEEEn */10465 if ((phy->flags & FLAGS_EEE) && bnx2x_eee_has_cap(params)) {
10732 bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_PHYID_LSB, &temp);10466 int rc;
10733 if (temp == MDIO_REG_GPHY_ID_54618SE) {10467
10734 if (params->feature_config_flags &10468 bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS,
10735 FEATURE_CONFIG_AUTOGREEEN_ENABLED) {10469 MDIO_REG_GPHY_EXP_ACCESS_TOP |
10736 temp = 6;10470 MDIO_REG_GPHY_EXP_TOP_2K_BUF);
10737 DP(NETIF_MSG_LINK, "Enabling Auto-GrEEEn\n");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);
10738 } else {10490 } else {
10739 temp = 0;10491 DP(NETIF_MSG_LINK, "Don't Advertise 1GBase-T EEE\n");
10740 DP(NETIF_MSG_LINK, "Disabling Auto-GrEEEn\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);
10741 }10510 }
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);
10753 }10511 }
10754 10512
10755 bnx2x_cl22_write(bp, phy,10513 bnx2x_cl22_write(bp, phy,
@@ -10896,29 +10654,6 @@ static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy, · 140 unmodified lines
10896 DP(NETIF_MSG_LINK, "BCM54618SE: link speed is %d\n",10654 DP(NETIF_MSG_LINK, "BCM54618SE: link speed is %d\n",
10897 vars->line_speed);10655 vars->line_speed);
10898 10656
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
10922 bnx2x_ext_phy_resolve_fc(phy, params, vars);10657 bnx2x_ext_phy_resolve_fc(phy, params, vars);
10923 10658
10924 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) {10659 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
10948 if (val & (1<<11))10683 if (val & (1<<11))
10949 vars->link_status |=10684 vars->link_status |=
10950 LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE;10685 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);
10951 }10690 }
10952 }10691 }
10953 return link_up;10692 return link_up;
@@ -11353,7 +11092,7 @@ static struct bnx2x_phy phy_8073 = { · 399 unmodified lines
11353 .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver,11092 .format_fw_ver = (format_fw_ver_t)bnx2x_format_ver,
11354 .hw_reset = (hw_reset_t)NULL,11093 .hw_reset = (hw_reset_t)NULL,
11355 .set_link_led = (set_link_led_t)NULL,11094 .set_link_led = (set_link_led_t)NULL,
11356 .phy_specific_func = (phy_specific_func_t)NULL11095 .phy_specific_func = (phy_specific_func_t)bnx2x_8073_specific_func
11357};11096};
11358static struct bnx2x_phy phy_8705 = {11097static struct bnx2x_phy phy_8705 = {
11359 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705,11098 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705,
@@ -11546,7 +11285,7 @@ static struct bnx2x_phy phy_84823 = { · 186 unmodified lines
11546 .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver,11285 .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver,
11547 .hw_reset = (hw_reset_t)NULL,11286 .hw_reset = (hw_reset_t)NULL,
11548 .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led,11287 .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led,
11549 .phy_specific_func = (phy_specific_func_t)NULL11288 .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func
11550};11289};
11551 11290
11552static struct bnx2x_phy phy_84833 = {11291static struct bnx2x_phy phy_84833 = {
@@ -11555,8 +11294,7 @@ static struct bnx2x_phy phy_84833 = { · 2 unmodified lines
11555 .def_md_devad = 0,11294 .def_md_devad = 0,
11556 .flags = (FLAGS_FAN_FAILURE_DET_REQ |11295 .flags = (FLAGS_FAN_FAILURE_DET_REQ |
11557 FLAGS_REARM_LATCH_SIGNAL |11296 FLAGS_REARM_LATCH_SIGNAL |
11558 FLAGS_TX_ERROR_CHECK |11297 FLAGS_TX_ERROR_CHECK),
11559 FLAGS_EEE_10GBT),
11560 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},11298 .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
11561 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},11299 .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff},
11562 .mdio_ctrl = 0,11300 .mdio_ctrl = 0,
@@ -11582,7 +11320,7 @@ static struct bnx2x_phy phy_84833 = { · 19 unmodified lines
11582 .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver,11320 .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver,
11583 .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy,11321 .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy,
11584 .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led,11322 .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led,
11585 .phy_specific_func = (phy_specific_func_t)NULL11323 .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func
11586};11324};
11587 11325
11588static struct bnx2x_phy phy_54618se = {11326static struct bnx2x_phy phy_54618se = {
@@ -11616,7 +11354,7 @@ static struct bnx2x_phy phy_54618se = { · 27 unmodified lines
11616 .format_fw_ver = (format_fw_ver_t)NULL,11354 .format_fw_ver = (format_fw_ver_t)NULL,
11617 .hw_reset = (hw_reset_t)NULL,11355 .hw_reset = (hw_reset_t)NULL,
11618 .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led,11356 .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led,
11619 .phy_specific_func = (phy_specific_func_t)NULL11357 .phy_specific_func = (phy_specific_func_t)bnx2x_54618se_specific_func
11620};11358};
11621/*****************************************************************/11359/*****************************************************************/
11622/* */11360/* */
@@ -11862,6 +11600,8 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp, · 239 unmodified lines
11862 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616:11600 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616:
11863 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE:11601 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE:
11864 *phy = phy_54618se;11602 *phy = phy_54618se;
11603 if (phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE)
11604 phy->flags |= FLAGS_EEE;
11865 break;11605 break;
11866 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:11606 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
11867 *phy = phy_7101;11607 *phy = phy_7101;
@@ -12141,7 +11881,7 @@ void bnx2x_init_bmac_loopback(struct link_params *params, · 273 unmodified lines
12141 bnx2x_xgxs_deassert(params);11881 bnx2x_xgxs_deassert(params);
12142 11882
12143 /* set bmac loopback */11883 /* set bmac loopback */
12144 bnx2x_bmac_enable(params, vars, 1);11884 bnx2x_bmac_enable(params, vars, 1, 1);
12145 11885
12146 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);11886 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);
12147}11887}
@@ -12233,7 +11973,7 @@ void bnx2x_init_xgxs_loopback(struct link_params *params, · 85 unmodified lines
12233 if (USES_WARPCORE(bp))11973 if (USES_WARPCORE(bp))
12234 bnx2x_xmac_enable(params, vars, 0);11974 bnx2x_xmac_enable(params, vars, 0);
12235 else11975 else
12236 bnx2x_bmac_enable(params, vars, 0);11976 bnx2x_bmac_enable(params, vars, 0, 1);
12237 }11977 }
12238 11978
12239 if (params->loopback_mode == LOOPBACK_XGXS) {11979 if (params->loopback_mode == LOOPBACK_XGXS) {
@@ -12258,8 +11998,161 @@ void bnx2x_init_xgxs_loopback(struct link_params *params, · 18 unmodified lines
12258 bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed);11998 bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed);
12259}11999}
12260 12000
12001static 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}
12019static 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
12093static 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
12261int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)12153int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
12262{12154{
12155 int lfa_status;
12263 struct bnx2x *bp = params->bp;12156 struct bnx2x *bp = params->bp;
12264 DP(NETIF_MSG_LINK, "Phy Initialization started\n");12157 DP(NETIF_MSG_LINK, "Phy Initialization started\n");
12265 DP(NETIF_MSG_LINK, "(1) req_speed %d, req_flowctrl %d\n",12158 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
12274 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE;12167 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE;
12275 vars->mac_type = MAC_TYPE_NONE;12168 vars->mac_type = MAC_TYPE_NONE;
12276 vars->phy_flags = 0;12169 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);
12277 12183
12278 /* Disable attentions */12184 /* Disable attentions */
12279 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4,12185 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
12356 REG_WR(bp, NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0);12262 REG_WR(bp, NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0);
12357 }12263 }
12358 12264
12359 /* Stop BigMac rx */12265 if (!CHIP_IS_E3(bp)) {
12360 if (!CHIP_IS_E3(bp))12266 bnx2x_set_bmac_rx(bp, params->chip_id, port, 0);
12361 bnx2x_bmac_rx_disable(bp, port);12267 } else {
12362 else {12268 bnx2x_set_xmac_rxtx(params, 0);
12363 bnx2x_xmac_disable(params);12269 bnx2x_set_umac_rxtx(params, 0);
12364 bnx2x_umac_disable(params);12270 }
12365 }
12366 /* Disable emac */12271 /* Disable emac */
12367 if (!CHIP_IS_E3(bp))12272 if (!CHIP_IS_E3(bp))
12368 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0);12273 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
12420 vars->phy_flags = 0;12325 vars->phy_flags = 0;
12421 return 0;12326 return 0;
12422}12327}
12328int 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}
12423 12378
12424/****************************************************************************/12379/****************************************************************************/
12425/* Common function */12380/* Common function */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h+5−2
@@ -155,7 +155,7 @@ struct bnx2x_phy { · 154 unmodified lines
155#define FLAGS_DUMMY_READ (1<<9)155#define FLAGS_DUMMY_READ (1<<9)
156#define FLAGS_MDC_MDIO_WA_B0 (1<<10)156#define FLAGS_MDC_MDIO_WA_B0 (1<<10)
157#define FLAGS_TX_ERROR_CHECK (1<<12)157#define FLAGS_TX_ERROR_CHECK (1<<12)
158#define FLAGS_EEE_10GBT (1<<13)158#define FLAGS_EEE (1<<13)
159 159
160 /* preemphasis values for the rx side */160 /* preemphasis values for the rx side */
161 u16 rx_preemphasis[4];161 u16 rx_preemphasis[4];
@@ -216,6 +216,7 @@ struct bnx2x_phy { · 54 unmodified lines
216 phy_specific_func_t phy_specific_func;216 phy_specific_func_t phy_specific_func;
217#define DISABLE_TX 1217#define DISABLE_TX 1
218#define ENABLE_TX 2218#define ENABLE_TX 2
219#define PHY_INIT 3
219};220};
220 221
221/* Inputs parameters to the CLC */222/* Inputs parameters to the CLC */
@@ -304,6 +305,8 @@ struct link_params { · 82 unmodified lines
304 struct bnx2x *bp;305 struct bnx2x *bp;
305 u16 req_fc_auto_adv; /* Should be set to TX / BOTH when306 u16 req_fc_auto_adv; /* Should be set to TX / BOTH when
306 req_flow_ctrl is set to AUTO */307 req_flow_ctrl is set to AUTO */
308 u16 rsrv1;
309 u32 lfa_base;
307};310};
308 311
309/* Output parameters */312/* Output parameters */
@@ -356,7 +359,7 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars); · 46 unmodified lines
356 to 0 */359 to 0 */
357int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,360int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
358 u8 reset_ext_phy);361 u8 reset_ext_phy);
359 362int bnx2x_lfa_reset(struct link_params *params, struct link_vars *vars);
360/* bnx2x_link_update should be called upon link interrupt */363/* bnx2x_link_update should be called upon link interrupt */
361int bnx2x_link_update(struct link_params *params, struct link_vars *vars);364int bnx2x_link_update(struct link_params *params, struct link_vars *vars);
362 365
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+22−12
@@ -2166,7 +2166,6 @@ void bnx2x_link_set(struct bnx2x *bp) · 2165 unmodified lines
2166{2166{
2167 if (!BP_NOMCP(bp)) {2167 if (!BP_NOMCP(bp)) {
2168 bnx2x_acquire_phy_lock(bp);2168 bnx2x_acquire_phy_lock(bp);
2169 bnx2x_link_reset(&bp->link_params, &bp->link_vars, 1);
2170 bnx2x_phy_init(&bp->link_params, &bp->link_vars);2169 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
2171 bnx2x_release_phy_lock(bp);2170 bnx2x_release_phy_lock(bp);
2172 2171
@@ -2179,12 +2178,19 @@ static void bnx2x__link_reset(struct bnx2x *bp) · 6 unmodified lines
2179{2178{
2180 if (!BP_NOMCP(bp)) {2179 if (!BP_NOMCP(bp)) {
2181 bnx2x_acquire_phy_lock(bp);2180 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);
2183 bnx2x_release_phy_lock(bp);2182 bnx2x_release_phy_lock(bp);
2184 } else2183 } else
2185 BNX2X_ERR("Bootcode is missing - can not reset link\n");2184 BNX2X_ERR("Bootcode is missing - can not reset link\n");
2186}2185}
2187 2186
2187void 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
2188u8 bnx2x_link_test(struct bnx2x *bp, u8 is_serdes)2194u8 bnx2x_link_test(struct bnx2x *bp, u8 is_serdes)
2189{2195{
2190 u8 rc = 0;2196 u8 rc = 0;
@@ -6751,7 +6757,6 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 4560 unmodified lines
6751 u32 low, high;6757 u32 low, high;
6752 u32 val;6758 u32 val;
6753 6759
6754 bnx2x__link_reset(bp);
6755 6760
6756 DP(NETIF_MSG_HW, "starting port init port %d\n", port);6761 DP(NETIF_MSG_HW, "starting port init port %d\n", port);
6757 6762
@@ -8244,12 +8249,15 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) · 1486 unmodified lines
8244 * bnx2x_send_unload_done - send UNLOAD_DONE command to the MCP.8249 * bnx2x_send_unload_done - send UNLOAD_DONE command to the MCP.
8245 *8250 *
8246 * @bp: driver handle8251 * @bp: driver handle
8252 * @keep_link: true iff link should be kept up
8247 */8253 */
8248void bnx2x_send_unload_done(struct bnx2x *bp)8254void bnx2x_send_unload_done(struct bnx2x *bp, bool keep_link)
8249{8255{
8256 u32 reset_param = keep_link ? DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET : 0;
8257
8250 /* Report UNLOAD_DONE to MCP */8258 /* Report UNLOAD_DONE to MCP */
8251 if (!BP_NOMCP(bp))8259 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);
8253}8261}
8254 8262
8255static int bnx2x_func_wait_started(struct bnx2x *bp)8263static int bnx2x_func_wait_started(struct bnx2x *bp)
@@ -8318,7 +8326,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp) · 62 unmodified lines
8318 return 0;8326 return 0;
8319}8327}
8320 8328
8321void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode)8329void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
8322{8330{
8323 int port = BP_PORT(bp);8331 int port = BP_PORT(bp);
8324 int i, rc = 0;8332 int i, rc = 0;
@@ -8440,7 +8448,7 @@ unload_error: · 115 unmodified lines
8440 8448
8441 8449
8442 /* Report UNLOAD_DONE to MCP */8450 /* Report UNLOAD_DONE to MCP */
8443 bnx2x_send_unload_done(bp);8451 bnx2x_send_unload_done(bp, keep_link);
8444}8452}
8445 8453
8446void bnx2x_disable_close_the_gate(struct bnx2x *bp)8454void bnx2x_disable_close_the_gate(struct bnx2x *bp)
@@ -8852,7 +8860,8 @@ int bnx2x_leader_reset(struct bnx2x *bp) · 405 unmodified lines
8852 * driver is owner of the HW8860 * driver is owner of the HW
8853 */8861 */
8854 if (!global && !BP_NOMCP(bp)) {8862 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);
8856 if (!load_code) {8865 if (!load_code) {
8857 BNX2X_ERR("MCP response failure, aborting\n");8866 BNX2X_ERR("MCP response failure, aborting\n");
8858 rc = -EAGAIN;8867 rc = -EAGAIN;
@@ -8958,7 +8967,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp) · 99 unmodified lines
8958 8967
8959 /* Stop the driver */8968 /* Stop the driver */
8960 /* If interface has been removed - break */8969 /* If interface has been removed - break */
8961 if (bnx2x_nic_unload(bp, UNLOAD_RECOVERY))8970 if (bnx2x_nic_unload(bp, UNLOAD_RECOVERY, false))
8962 return;8971 return;
8963 8972
8964 bp->recovery_state = BNX2X_RECOVERY_WAIT;8973 bp->recovery_state = BNX2X_RECOVERY_WAIT;
@@ -9124,7 +9133,7 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work) · 159 unmodified lines
9124 bp->sp_rtnl_state = 0;9133 bp->sp_rtnl_state = 0;
9125 smp_mb();9134 smp_mb();
9126 9135
9127 bnx2x_nic_unload(bp, UNLOAD_NORMAL);9136 bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
9128 bnx2x_nic_load(bp, LOAD_NORMAL);9137 bnx2x_nic_load(bp, LOAD_NORMAL);
9129 9138
9130 goto sp_rtnl_exit;9139 goto sp_rtnl_exit;
@@ -9310,7 +9319,8 @@ static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, · 179 unmodified lines
9310 9319
9311static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp)9320static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp)
9312{9321{
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);
9314 if (!rc) {9324 if (!rc) {
9315 BNX2X_ERR("MCP response failure, aborting\n");9325 BNX2X_ERR("MCP response failure, aborting\n");
9316 return -EBUSY;9326 return -EBUSY;
@@ -11000,7 +11010,7 @@ static int bnx2x_close(struct net_device *dev) · 1683 unmodified lines
11000 struct bnx2x *bp = netdev_priv(dev);11010 struct bnx2x *bp = netdev_priv(dev);
11001 11011
11002 /* Unload the driver, release IRQs */11012 /* Unload the driver, release IRQs */
11003 bnx2x_nic_unload(bp, UNLOAD_CLOSE);11013 bnx2x_nic_unload(bp, UNLOAD_CLOSE, false);
11004 11014
11005 /* Power off */11015 /* Power off */
11006 bnx2x_set_power_state(bp, PCI_D3hot);11016 bnx2x_set_power_state(bp, PCI_D3hot);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h+11−3
@@ -4949,6 +4949,10 @@ · 4948 unmodified lines
4949#define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13)4949#define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13)
4950#define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0)4950#define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0)
4951#define UMAC_REG_COMMAND_CONFIG 0x84951#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
4952/* [RW 32] Register Bit 0 refers to Bit 16 of the MAC address; Bit 1 refers4956/* [RW 32] Register Bit 0 refers to Bit 16 of the MAC address; Bit 1 refers
4953 * to bit 17 of the MAC address etc. */4957 * to bit 17 of the MAC address etc. */
4954#define UMAC_REG_MAC_ADDR0 0xc4958#define UMAC_REG_MAC_ADDR0 0xc
@@ -4958,6 +4962,8 @@ · 3 unmodified lines
4958/* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive4962/* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive
4959 * logic to check frames. */4963 * logic to check frames. */
4960#define UMAC_REG_MAXFR 0x144964#define UMAC_REG_MAXFR 0x14
4965#define UMAC_REG_UMAC_EEE_CTRL 0x64
4966#define UMAC_UMAC_EEE_CTRL_REG_EEE_EN (0x1<<3)
4961/* [RW 8] The event id for aggregated interrupt 0 */4967/* [RW 8] The event id for aggregated interrupt 0 */
4962#define USDM_REG_AGG_INT_EVENT_0 0xc40384968#define USDM_REG_AGG_INT_EVENT_0 0xc4038
4963#define USDM_REG_AGG_INT_EVENT_1 0xc403c4969#define USDM_REG_AGG_INT_EVENT_1 0xc403c
@@ -6992,6 +6998,7 @@ Theotherbitsarereservedandshouldbezero*/ · 2028 unmodified lines
6992/* BCM84833 only */6998/* BCM84833 only */
6993#define MDIO_84833_TOP_CFG_FW_REV 0x400f6999#define MDIO_84833_TOP_CFG_FW_REV 0x400f
6994#define MDIO_84833_TOP_CFG_FW_EEE 0x10b17000#define MDIO_84833_TOP_CFG_FW_EEE 0x10b1
7001#define MDIO_84833_TOP_CFG_FW_NO_EEE 0x1f81
6995#define MDIO_84833_TOP_CFG_XGPHY_STRAP1 0x401a7002#define MDIO_84833_TOP_CFG_XGPHY_STRAP1 0x401a
6996#define MDIO_84833_SUPER_ISOLATE 0x80007003#define MDIO_84833_SUPER_ISOLATE 0x8000
6997/* These are mailbox register set used by 84833. */7004/* These are mailbox register set used by 84833. */
@@ -7160,10 +7167,11 @@ Theotherbitsarereservedandshouldbezero*/ · 162 unmodified lines
7160#define MDIO_REG_GPHY_ID_54618SE 0x5cd57167#define MDIO_REG_GPHY_ID_54618SE 0x5cd5
7161#define MDIO_REG_GPHY_CL45_ADDR_REG 0xd7168#define MDIO_REG_GPHY_CL45_ADDR_REG 0xd
7162#define MDIO_REG_GPHY_CL45_DATA_REG 0xe7169#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)
7166#define MDIO_REG_GPHY_EEE_RESOLVED 0x803e7170#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
7167#define MDIO_REG_GPHY_AUX_STATUS 0x197175#define MDIO_REG_GPHY_AUX_STATUS 0x19
7168#define MDIO_REG_INTR_STATUS 0x1a7176#define MDIO_REG_INTR_STATUS 0x1a
7169#define MDIO_REG_INTR_MASK 0x1b7177#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
229 */229 */
230 list_add_tail(&spacer.link, &o->pending_comp);230 list_add_tail(&spacer.link, &o->pending_comp);
231 mb();231 mb();
232 list_del(&elem->link);232 list_move_tail(&elem->link, &o->pending_comp);
233 list_add_tail(&elem->link, &o->pending_comp);
234 list_del(&spacer.link);233 list_del(&spacer.link);
235 } else234 } else
236 break;235 break;
@@ -5620,7 +5619,7 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp, · 5383 unmodified lines
5620 memset(rdata, 0, sizeof(*rdata));5619 memset(rdata, 0, sizeof(*rdata));
5621 5620
5622 /* Fill the ramrod data with provided parameters */5621 /* 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;
5624 rdata->sd_vlan_tag = cpu_to_le16(start_params->sd_vlan_tag);5623 rdata->sd_vlan_tag = cpu_to_le16(start_params->sd_vlan_tag);
5625 rdata->path_id = BP_PATH(bp);5624 rdata->path_id = BP_PATH(bp);
5626 rdata->network_cos_mode = start_params->network_cos_mode;5625 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
39#endif39#endif
40}40}
41 41
42static u16 bnx2x_get_port_stats_dma_len(struct bnx2x *bp)42static inline u16 bnx2x_get_port_stats_dma_len(struct bnx2x *bp)
43{43{
44 u16 res = sizeof(struct host_port_stats) >> 2;44 u16 res = 0;
45 45
46 /* if PFC stats are not supported by the MFW, don't DMA them */46 /* 'newest' convention - shmem2 cotains the size of the port stats */
47 if (!(bp->flags & BC_SUPPORTS_PFC_STATS))47 if (SHMEM2_HAS(bp, sizeof_port_stats)) {
48 res -= (sizeof(u32)*4) >> 2;48 u32 size = SHMEM2_RD(bp, sizeof_port_stats);
49 if (size)
50 res = size;
49 51
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);
50 return res;75 return res;
51}76}
52 77
drivers/net/ethernet/broadcom/cnic.c+86−30
@@ -823,10 +823,8 @@ static void cnic_free_context(struct cnic_dev *dev) · 822 unmodified lines
823 }823 }
824}824}
825 825
826static void __cnic_free_uio(struct cnic_uio_dev *udev)826static void __cnic_free_uio_rings(struct cnic_uio_dev *udev)
827{827{
828 uio_unregister_device(&udev->cnic_uinfo);
829
830 if (udev->l2_buf) {828 if (udev->l2_buf) {
831 dma_free_coherent(&udev->pdev->dev, udev->l2_buf_size,829 dma_free_coherent(&udev->pdev->dev, udev->l2_buf_size,
832 udev->l2_buf, udev->l2_buf_map);830 udev->l2_buf, udev->l2_buf_map);
@@ -839,6 +837,14 @@ static void __cnic_free_uio(struct cnic_uio_dev *udev) · 6 unmodified lines
839 udev->l2_ring = NULL;837 udev->l2_ring = NULL;
840 }838 }
841 839
840}
841
842static 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
842 pci_dev_put(udev->pdev);848 pci_dev_put(udev->pdev);
843 kfree(udev);849 kfree(udev);
844}850}
@@ -862,6 +868,8 @@ static void cnic_free_resc(struct cnic_dev *dev) · 17 unmodified lines
862 if (udev) {868 if (udev) {
863 udev->dev = NULL;869 udev->dev = NULL;
864 cp->udev = NULL;870 cp->udev = NULL;
871 if (udev->uio_dev == -1)
872 __cnic_free_uio_rings(udev);
865 }873 }
866 874
867 cnic_free_context(dev);875 cnic_free_context(dev);
@@ -996,6 +1004,34 @@ static int cnic_alloc_kcq(struct cnic_dev *dev, struct kcq_info *info, · 128 unmodified lines
996 return 0;1004 return 0;
997}1005}
998 1006
1007static 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
999static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)1035static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
1000{1036{
1001 struct cnic_local *cp = dev->cnic_priv;1037 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
1005 list_for_each_entry(udev, &cnic_udev_list, list) {1041 list_for_each_entry(udev, &cnic_udev_list, list) {
1006 if (udev->pdev == dev->pcidev) {1042 if (udev->pdev == dev->pcidev) {
1007 udev->dev = dev;1043 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 }
1008 cp->udev = udev;1049 cp->udev = udev;
1009 read_unlock(&cnic_dev_lock);1050 read_unlock(&cnic_dev_lock);
1010 return 0;1051 return 0;
@@ -1020,20 +1061,9 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) · 9 unmodified lines
1020 1061
1021 udev->dev = dev;1062 udev->dev = dev;
1022 udev->pdev = dev->pcidev;1063 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;
1029 1064
1030 udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;1065 if (__cnic_alloc_uio_rings(udev, pages))
1031 udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size);1066 goto err_udev;
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;
1037 1067
1038 write_lock(&cnic_dev_lock);1068 write_lock(&cnic_dev_lock);
1039 list_add(&udev->list, &cnic_udev_list);1069 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
1044 cp->udev = udev;1074 cp->udev = udev;
1045 1075
1046 return 0;1076 return 0;
1047 err_dma:1077
1048 dma_free_coherent(&udev->pdev->dev, udev->l2_ring_size,
1049 udev->l2_ring, udev->l2_ring_map);
1050 err_udev:1078 err_udev:
1051 kfree(udev);1079 kfree(udev);
1052 return -ENOMEM;1080 return -ENOMEM;
@@ -1260,7 +1288,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) · 207 unmodified lines
1260 if (ret)1288 if (ret)
1261 goto error;1289 goto error;
1262 1290
1263 if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {1291 if (CNIC_SUPPORTS_FCOE(cp)) {
1264 ret = cnic_alloc_kcq(dev, &cp->kcq2, true);1292 ret = cnic_alloc_kcq(dev, &cp->kcq2, true);
1265 if (ret)1293 if (ret)
1266 goto error;1294 goto error;
@@ -1275,6 +1303,9 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) · 8 unmodified lines
1275 if (ret)1303 if (ret)
1276 goto error;1304 goto error;
1277 1305
1306 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)
1307 return 0;
1308
1278 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk;1309 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk;
1279 1310
1280 cp->l2_rx_ring_size = 15;1311 cp->l2_rx_ring_size = 15;
@@ -3050,6 +3081,22 @@ static void cnic_ack_bnx2x_e2_msix(struct cnic_dev *dev) · 1769 unmodified lines
3050 IGU_INT_DISABLE, 0);3081 IGU_INT_DISABLE, 0);
3051}3082}
3052 3083
3084static 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
3092static 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
3053static u32 cnic_service_bnx2x_kcq(struct cnic_dev *dev, struct kcq_info *info)3100static u32 cnic_service_bnx2x_kcq(struct cnic_dev *dev, struct kcq_info *info)
3054{3101{
3055 u32 last_status = *info->status_idx_ptr;3102 u32 last_status = *info->status_idx_ptr;
@@ -3086,9 +3133,8 @@ static void cnic_service_bnx2x_bh(unsigned long data) · 30 unmodified lines
3086 CNIC_WR16(dev, cp->kcq1.io_addr,3133 CNIC_WR16(dev, cp->kcq1.io_addr,
3087 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);3134 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);
3088 3135
3089 if (!BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {3136 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE) {
3090 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID,3137 cp->arm_int(dev, status_idx);
3091 status_idx, IGU_INT_ENABLE, 1);
3092 break;3138 break;
3093 }3139 }
3094 3140
@@ -4845,6 +4891,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, · 1750 unmodified lines
4845 buf_map = udev->l2_buf_map;4891 buf_map = udev->l2_buf_map;
4846 for (i = 0; i < MAX_TX_DESC_CNT; i += 3, txbd += 3) {4892 for (i = 0; i < MAX_TX_DESC_CNT; i += 3, txbd += 3) {
4847 struct eth_tx_start_bd *start_bd = &txbd->start_bd;4893 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);
4848 struct eth_tx_bd *reg_bd = &((txbd + 2)->reg_bd);4897 struct eth_tx_bd *reg_bd = &((txbd + 2)->reg_bd);
4849 4898
4850 start_bd->addr_hi = cpu_to_le32((u64) buf_map >> 32);4899 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
4854 start_bd->nbytes = cpu_to_le16(0x10);4903 start_bd->nbytes = cpu_to_le16(0x10);
4855 start_bd->nbd = cpu_to_le16(3);4904 start_bd->nbd = cpu_to_le16(3);
4856 start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;4905 start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
4857 start_bd->general_data = (UNICAST_ADDRESS <<4906 start_bd->general_data &= ~ETH_TX_START_BD_PARSE_NBDS;
4858 ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT);
4859 start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT);4907 start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT);
4860 4908
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);
4861 }4915 }
4862 4916
4863 val = (u64) ring_map >> 32;4917 val = (u64) ring_map >> 32;
@@ -5308,7 +5362,7 @@ static void cnic_stop_hw(struct cnic_dev *dev) · 444 unmodified lines
5308 /* Need to wait for the ring shutdown event to complete5362 /* Need to wait for the ring shutdown event to complete
5309 * before clearing the CNIC_UP flag.5363 * before clearing the CNIC_UP flag.
5310 */5364 */
5311 while (cp->udev->uio_dev != -1 && i < 15) {5365 while (cp->udev && cp->udev->uio_dev != -1 && i < 15) {
5312 msleep(100);5366 msleep(100);
5313 i++;5367 i++;
5314 }5368 }
@@ -5473,8 +5527,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) · 158 unmodified lines
5473 5527
5474 if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI))5528 if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI))
5475 cdev->max_iscsi_conn = ethdev->max_iscsi_conn;5529 cdev->max_iscsi_conn = ethdev->max_iscsi_conn;
5476 if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) &&5530 if (CNIC_SUPPORTS_FCOE(cp))
5477 !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE))
5478 cdev->max_fcoe_conn = ethdev->max_fcoe_conn;5531 cdev->max_fcoe_conn = ethdev->max_fcoe_conn;
5479 5532
5480 if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)5533 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
5492 cp->stop_cm = cnic_cm_stop_bnx2x_hw;5545 cp->stop_cm = cnic_cm_stop_bnx2x_hw;
5493 cp->enable_int = cnic_enable_bnx2x_int;5546 cp->enable_int = cnic_enable_bnx2x_int;
5494 cp->disable_int_sync = cnic_disable_bnx2x_int_sync;5547 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)) {
5496 cp->ack_int = cnic_ack_bnx2x_e2_msix;5549 cp->ack_int = cnic_ack_bnx2x_e2_msix;
5497 else5550 cp->arm_int = cnic_arm_bnx2x_e2_msix;
5551 } else {
5498 cp->ack_int = cnic_ack_bnx2x_msix;5552 cp->ack_int = cnic_ack_bnx2x_msix;
5553 cp->arm_int = cnic_arm_bnx2x_msix;
5554 }
5499 cp->close_conn = cnic_close_bnx2x_conn;5555 cp->close_conn = cnic_close_bnx2x_conn;
5500 return cdev;5556 return cdev;
5501}5557}
drivers/net/ethernet/broadcom/cnic.h+5−0
@@ -334,6 +334,7 @@ struct cnic_local { · 333 unmodified lines
334 void (*enable_int)(struct cnic_dev *);334 void (*enable_int)(struct cnic_dev *);
335 void (*disable_int_sync)(struct cnic_dev *);335 void (*disable_int_sync)(struct cnic_dev *);
336 void (*ack_int)(struct cnic_dev *);336 void (*ack_int)(struct cnic_dev *);
337 void (*arm_int)(struct cnic_dev *, u32 index);
337 void (*close_conn)(struct cnic_sock *, u32 opcode);338 void (*close_conn)(struct cnic_sock *, u32 opcode);
338};339};
339 340
@@ -474,6 +475,10 @@ struct bnx2x_bd_chain_next { · 134 unmodified lines
474 MAX_STAT_COUNTER_ID_E1))475 MAX_STAT_COUNTER_ID_E1))
475#endif476#endif
476 477
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
477#define CNIC_RAMROD_TMO (HZ / 4)482#define CNIC_RAMROD_TMO (HZ / 4)
478 483
479#endif484#endif
drivers/net/ethernet/broadcom/cnic_defs.h+1−1
@@ -896,7 +896,7 @@ struct tstorm_tcp_tcp_ag_context_section { · 895 unmodified lines
896 u32 snd_nxt;896 u32 snd_nxt;
897 u32 rtt_seq;897 u32 rtt_seq;
898 u32 rtt_time;898 u32 rtt_time;
899 u32 __reserved66;899 u32 wnd_right_edge_local;
900 u32 wnd_right_edge;900 u32 wnd_right_edge;
901 u32 tcp_agg_vars1;901 u32 tcp_agg_vars1;
902#define TSTORM_TCP_TCP_AG_CONTEXT_SECTION_FIN_SENT_FLAG (0x1<<0)902#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
14 14
15#include "bnx2x/bnx2x_mfw_req.h"15#include "bnx2x/bnx2x_mfw_req.h"
16 16
17#define CNIC_MODULE_VERSION "2.5.12"17#define CNIC_MODULE_VERSION "2.5.14"
18#define CNIC_MODULE_RELDATE "June 29, 2012"18#define CNIC_MODULE_RELDATE "Sep 30, 2012"
19 19
20#define CNIC_ULP_RDMA 020#define CNIC_ULP_RDMA 0
21#define CNIC_ULP_ISCSI 121#define CNIC_ULP_ISCSI 1
drivers/net/ethernet/broadcom/tg3.c+356−178
@@ -44,10 +44,8 @@ · 43 unmodified lines
44#include <linux/prefetch.h>44#include <linux/prefetch.h>
45#include <linux/dma-mapping.h>45#include <linux/dma-mapping.h>
46#include <linux/firmware.h>46#include <linux/firmware.h>
47#if IS_ENABLED(CONFIG_HWMON)
48#include <linux/hwmon.h>47#include <linux/hwmon.h>
49#include <linux/hwmon-sysfs.h>48#include <linux/hwmon-sysfs.h>
50#endif
51 49
52#include <net/checksum.h>50#include <net/checksum.h>
53#include <net/ip.h>51#include <net/ip.h>
@@ -92,10 +90,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) · 38 unmodified lines
92 90
93#define DRV_MODULE_NAME "tg3"91#define DRV_MODULE_NAME "tg3"
94#define TG3_MAJ_NUM 392#define TG3_MAJ_NUM 3
95#define TG3_MIN_NUM 12493#define TG3_MIN_NUM 125
96#define DRV_MODULE_VERSION \94#define DRV_MODULE_VERSION \
97 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)95 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
98#define DRV_MODULE_RELDATE "March 21, 2012"96#define DRV_MODULE_RELDATE "September 26, 2012"
99 97
100#define RESET_KIND_SHUTDOWN 098#define RESET_KIND_SHUTDOWN 0
101#define RESET_KIND_INIT 199#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
6263 u32 jmb_prod_idx = dpr->rx_jmb_prod_idx;6261 u32 jmb_prod_idx = dpr->rx_jmb_prod_idx;
6264 6262
6265 tp->rx_refill = false;6263 tp->rx_refill = false;
6266 for (i = 1; i < tp->irq_cnt; i++)6264 for (i = 1; i <= tp->rxq_cnt; i++)
6267 err |= tg3_rx_prodring_xfer(tp, dpr,6265 err |= tg3_rx_prodring_xfer(tp, dpr,
6268 &tp->napi[i].prodring);6266 &tp->napi[i].prodring);
6269 6267
@@ -7592,15 +7590,11 @@ static int tg3_init_rings(struct tg3 *tp) · 1322 unmodified lines
7592 return 0;7590 return 0;
7593}7591}
7594 7592
7595/*7593static void tg3_mem_tx_release(struct tg3 *tp)
7596 * Must not be invoked with interrupt sources disabled and
7597 * the hardware shutdown down.
7598 */
7599static void tg3_free_consistent(struct tg3 *tp)
7600{7594{
7601 int i;7595 int i;
7602 7596
7603 for (i = 0; i < tp->irq_cnt; i++) {7597 for (i = 0; i < tp->irq_max; i++) {
7604 struct tg3_napi *tnapi = &tp->napi[i];7598 struct tg3_napi *tnapi = &tp->napi[i];
7605 7599
7606 if (tnapi->tx_ring) {7600 if (tnapi->tx_ring) {
@@ -7611,17 +7605,114 @@ static void tg3_free_consistent(struct tg3 *tp) · 4 unmodified lines
7611 7605
7612 kfree(tnapi->tx_buffers);7606 kfree(tnapi->tx_buffers);
7613 tnapi->tx_buffers = NULL;7607 tnapi->tx_buffers = NULL;
7608 }
7609}
7614 7610
7615 if (tnapi->rx_rcb) {7611static int tg3_mem_tx_acquire(struct tg3 *tp)
7616 dma_free_coherent(&tp->pdev->dev,7612{
7617 TG3_RX_RCB_RING_BYTES(tp),7613 int i;
7618 tnapi->rx_rcb,7614 struct tg3_napi *tnapi = &tp->napi[0];
7619 tnapi->rx_rcb_mapping);7615
7620 tnapi->rx_rcb = NULL;7616 /* If multivector TSS is enabled, vector 0 does not handle
7621 }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
7638err_out:
7639 tg3_mem_tx_release(tp);
7640 return -ENOMEM;
7641}
7642
7643static 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];
7622 7649
7623 tg3_rx_prodring_fini(tp, &tnapi->prodring);7650 tg3_rx_prodring_fini(tp, &tnapi->prodring);
7624 7651
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
7663static 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
7700err_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 */
7709static 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
7625 if (tnapi->hw_status) {7716 if (tnapi->hw_status) {
7626 dma_free_coherent(&tp->pdev->dev, TG3_HW_STATUS_SIZE,7717 dma_free_coherent(&tp->pdev->dev, TG3_HW_STATUS_SIZE,
7627 tnapi->hw_status,7718 tnapi->hw_status,
@@ -7630,6 +7721,9 @@ static void tg3_free_consistent(struct tg3 *tp) · 2 unmodified lines
7630 }7721 }
7631 }7722 }
7632 7723
7724 tg3_mem_rx_release(tp);
7725 tg3_mem_tx_release(tp);
7726
7633 if (tp->hw_stats) {7727 if (tp->hw_stats) {
7634 dma_free_coherent(&tp->pdev->dev, sizeof(struct tg3_hw_stats),7728 dma_free_coherent(&tp->pdev->dev, sizeof(struct tg3_hw_stats),
7635 tp->hw_stats, tp->stats_mapping);7729 tp->hw_stats, tp->stats_mapping);
@@ -7668,72 +7762,38 @@ static int tg3_alloc_consistent(struct tg3 *tp) · 32 unmodified lines
7668 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);7762 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
7669 sblk = tnapi->hw_status;7763 sblk = tnapi->hw_status;
7670 7764
7671 if (tg3_rx_prodring_init(tp, &tnapi->prodring))7765 if (tg3_flag(tp, ENABLE_RSS)) {
7672 goto err_out;7766 u16 *prodptr = 0;
7673 7767
7674 /* If multivector TSS is enabled, vector 0 does not handle7768 /*
7675 * tx interrupts. Don't allocate any resources for it.7769 * When RSS is enabled, the status block format changes
7676 */7770 * slightly. The "rx_jumbo_consumer", "reserved",
7677 if ((!i && !tg3_flag(tp, ENABLE_TSS)) ||7771 * and "rx_mini_consumer" members get mapped to the
7678 (i && tg3_flag(tp, ENABLE_TSS))) {7772 * other three rx return ring producer indexes.
7679 tnapi->tx_buffers = kzalloc(7773 */
7680 sizeof(struct tg3_tx_ring_info) *7774 switch (i) {
7681 TG3_TX_RING_SIZE, GFP_KERNEL);7775 case 1:
7682 if (!tnapi->tx_buffers)7776 prodptr = &sblk->idx[0].rx_producer;
7683 goto err_out;7777 break;
7684 7778 case 2:
7685 tnapi->tx_ring = dma_alloc_coherent(&tp->pdev->dev,7779 prodptr = &sblk->rx_jumbo_consumer;
7686 TG3_TX_RING_BYTES,7780 break;
7687 &tnapi->tx_desc_mapping,7781 case 3:
7688 GFP_KERNEL);7782 prodptr = &sblk->reserved;
7689 if (!tnapi->tx_ring)7783 break;
7690 goto err_out;7784 case 4:
7691 }7785 prodptr = &sblk->rx_mini_consumer;
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;
7703 break;7786 break;
7704 }7787 }
7705 /* Fall through */7788 tnapi->rx_rcb_prod_idx = prodptr;
7706 case 1:7789 } else {
7707 tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;7790 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;
7718 }7791 }
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));
7735 }7792 }
7736 7793
7794 if (tg3_mem_tx_acquire(tp) || tg3_mem_rx_acquire(tp))
7795 goto err_out;
7796
7737 return 0;7797 return 0;
7738 7798
7739err_out:7799err_out:
@@ -8247,9 +8307,10 @@ static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr, · 507 unmodified lines
8247 nic_addr);8307 nic_addr);
8248}8308}
8249 8309
8250static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)8310
8311static void tg3_coal_tx_init(struct tg3 *tp, struct ethtool_coalesce *ec)
8251{8312{
8252 int i;8313 int i = 0;
8253 8314
8254 if (!tg3_flag(tp, ENABLE_TSS)) {8315 if (!tg3_flag(tp, ENABLE_TSS)) {
8255 tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs);8316 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
8259 tw32(HOSTCC_TXCOL_TICKS, 0);8320 tw32(HOSTCC_TXCOL_TICKS, 0);
8260 tw32(HOSTCC_TXMAX_FRAMES, 0);8321 tw32(HOSTCC_TXMAX_FRAMES, 0);
8261 tw32(HOSTCC_TXCOAL_MAXF_INT, 0);8322 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 }
8262 }8334 }
8263 8335
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
8343static void tg3_coal_rx_init(struct tg3 *tp, struct ethtool_coalesce *ec)
8344{
8345 int i = 0;
8346 u32 limit = tp->rxq_cnt;
8347
8264 if (!tg3_flag(tp, ENABLE_RSS)) {8348 if (!tg3_flag(tp, ENABLE_RSS)) {
8265 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs);8349 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs);
8266 tw32(HOSTCC_RXMAX_FRAMES, ec->rx_max_coalesced_frames);8350 tw32(HOSTCC_RXMAX_FRAMES, ec->rx_max_coalesced_frames);
8267 tw32(HOSTCC_RXCOAL_MAXF_INT, ec->rx_max_coalesced_frames_irq);8351 tw32(HOSTCC_RXCOAL_MAXF_INT, ec->rx_max_coalesced_frames_irq);
8352 limit--;
8268 } else {8353 } else {
8269 tw32(HOSTCC_RXCOL_TICKS, 0);8354 tw32(HOSTCC_RXCOL_TICKS, 0);
8270 tw32(HOSTCC_RXMAX_FRAMES, 0);8355 tw32(HOSTCC_RXMAX_FRAMES, 0);
8271 tw32(HOSTCC_RXCOAL_MAXF_INT, 0);8356 tw32(HOSTCC_RXCOAL_MAXF_INT, 0);
8272 }8357 }
8273 8358
8274 if (!tg3_flag(tp, 5705_PLUS)) {8359 for (; i < limit; i++) {
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++) {
8287 u32 reg;8360 u32 reg;
8288 8361
8289 reg = HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18;8362 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
8292 tw32(reg, ec->rx_max_coalesced_frames);8365 tw32(reg, ec->rx_max_coalesced_frames);
8293 reg = HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18;8366 reg = HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18;
8294 tw32(reg, ec->rx_max_coalesced_frames_irq);8367 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 }
8304 }8368 }
8305 8369
8306 for (; i < tp->irq_max - 1; i++) {8370 for (; i < tp->irq_max - 1; i++) {
8307 tw32(HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18, 0);8371 tw32(HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18, 0);
8308 tw32(HOSTCC_RXMAX_FRAMES_VEC1 + i * 0x18, 0);8372 tw32(HOSTCC_RXMAX_FRAMES_VEC1 + i * 0x18, 0);
8309 tw32(HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);8373 tw32(HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);
8374 }
8375}
8310 8376
8311 if (tg3_flag(tp, ENABLE_TSS)) {8377static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)
8312 tw32(HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18, 0);8378{
8313 tw32(HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18, 0);8379 tg3_coal_tx_init(tp, ec);
8314 tw32(HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);8380 tg3_coal_rx_init(tp, ec);
8315 }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);
8316 }8392 }
8317}8393}
8318 8394
@@ -8570,13 +8646,12 @@ static void __tg3_set_rx_mode(struct net_device *dev) · 251 unmodified lines
8570 }8646 }
8571}8647}
8572 8648
8573static void tg3_rss_init_dflt_indir_tbl(struct tg3 *tp)8649static void tg3_rss_init_dflt_indir_tbl(struct tg3 *tp, u32 qcnt)
8574{8650{
8575 int i;8651 int i;
8576 8652
8577 for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++)8653 for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++)
8578 tp->rss_ind_tbl[i] =8654 tp->rss_ind_tbl[i] = ethtool_rxfh_indir_default(i, qcnt);
8579 ethtool_rxfh_indir_default(i, tp->irq_cnt - 1);
8580}8655}
8581 8656
8582static void tg3_rss_check_indir_tbl(struct tg3 *tp)8657static 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
8598 }8673 }
8599 8674
8600 if (i != TG3_RSS_INDIR_TBL_SIZE)8675 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);
8602}8677}
8603 8678
8604static void tg3_rss_write_indir_tbl(struct tg3 *tp)8679static 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
9495 return tg3_reset_hw(tp, reset_phy);9570 return tg3_reset_hw(tp, reset_phy);
9496}9571}
9497 9572
9498#if IS_ENABLED(CONFIG_HWMON)
9499static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)9573static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
9500{9574{
9501 int i;9575 int i;
@@ -9548,22 +9622,17 @@ static const struct attribute_group tg3_group = { · 46 unmodified lines
9548 .attrs = tg3_attributes,9622 .attrs = tg3_attributes,
9549};9623};
9550 9624
9551#endif
9552
9553static void tg3_hwmon_close(struct tg3 *tp)9625static void tg3_hwmon_close(struct tg3 *tp)
9554{9626{
9555#if IS_ENABLED(CONFIG_HWMON)
9556 if (tp->hwmon_dev) {9627 if (tp->hwmon_dev) {
9557 hwmon_device_unregister(tp->hwmon_dev);9628 hwmon_device_unregister(tp->hwmon_dev);
9558 tp->hwmon_dev = NULL;9629 tp->hwmon_dev = NULL;
9559 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);9630 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
9560 }9631 }
9561#endif
9562}9632}
9563 9633
9564static void tg3_hwmon_open(struct tg3 *tp)9634static void tg3_hwmon_open(struct tg3 *tp)
9565{9635{
9566#if IS_ENABLED(CONFIG_HWMON)
9567 int i, err;9636 int i, err;
9568 u32 size = 0;9637 u32 size = 0;
9569 struct pci_dev *pdev = tp->pdev;9638 struct pci_dev *pdev = tp->pdev;
@@ -9595,7 +9664,6 @@ static void tg3_hwmon_open(struct tg3 *tp) · 25 unmodified lines
9595 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");9664 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
9596 sysfs_remove_group(&pdev->dev.kobj, &tg3_group);9665 sysfs_remove_group(&pdev->dev.kobj, &tg3_group);
9597 }9666 }
9598#endif
9599}9667}
9600 9668
9601 9669
@@ -10119,21 +10187,43 @@ static int tg3_request_firmware(struct tg3 *tp) · 517 unmodified lines
10119 return 0;10187 return 0;
10120}10188}
10121 10189
10122static bool tg3_enable_msix(struct tg3 *tp)10190static u32 tg3_irq_count(struct tg3 *tp)
10123{10191{
10124 int i, rc;10192 u32 irq_cnt = max(tp->rxq_cnt, tp->txq_cnt);
10125 struct msix_entry msix_ent[tp->irq_max];
10126 10193
10127 tp->irq_cnt = netif_get_num_default_rss_queues();10194 if (irq_cnt > 1) {
10128 if (tp->irq_cnt > 1) {
10129 /* We want as many rx rings enabled as there are cpus.10195 /* We want as many rx rings enabled as there are cpus.
10130 * In multiqueue MSI-X mode, the first MSI-X vector10196 * In multiqueue MSI-X mode, the first MSI-X vector
10131 * only deals with link interrupts, etc, so we add10197 * only deals with link interrupts, etc, so we add
10132 * one to the number of vectors we are requesting.10198 * one to the number of vectors we are requesting.
10133 */10199 */
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);
10135 }10201 }
10136 10202
10203 return irq_cnt;
10204}
10205
10206static 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
10137 for (i = 0; i < tp->irq_max; i++) {10227 for (i = 0; i < tp->irq_max; i++) {
10138 msix_ent[i].entry = i;10228 msix_ent[i].entry = i;
10139 msix_ent[i].vector = 0;10229 msix_ent[i].vector = 0;
@@ -10148,27 +10238,28 @@ static bool tg3_enable_msix(struct tg3 *tp) · 8 unmodified lines
10148 netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",10238 netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n",
10149 tp->irq_cnt, rc);10239 tp->irq_cnt, rc);
10150 tp->irq_cnt = rc;10240 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);
10151 }10244 }
10152 10245
10153 for (i = 0; i < tp->irq_max; i++)10246 for (i = 0; i < tp->irq_max; i++)
10154 tp->napi[i].irq_vec = msix_ent[i].vector;10247 tp->napi[i].irq_vec = msix_ent[i].vector;
10155 10248
10156 netif_set_real_num_tx_queues(tp->dev, 1);10249 if (netif_set_real_num_rx_queues(tp->dev, tp->rxq_cnt)) {
10157 rc = tp->irq_cnt > 1 ? tp->irq_cnt - 1 : 1;
10158 if (netif_set_real_num_rx_queues(tp->dev, rc)) {
10159 pci_disable_msix(tp->pdev);10250 pci_disable_msix(tp->pdev);
10160 return false;10251 return false;
10161 }10252 }
10162 10253
10163 if (tp->irq_cnt > 1) {10254 if (tp->irq_cnt == 1)
10164 tg3_flag_set(tp, ENABLE_RSS);10255 return true;
10165 10256
10166 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||10257 tg3_flag_set(tp, ENABLE_RSS);
10167 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {10258
10168 tg3_flag_set(tp, ENABLE_TSS);10259 if (tp->txq_cnt > 1)
10169 netif_set_real_num_tx_queues(tp->dev, tp->irq_cnt - 1);10260 tg3_flag_set(tp, ENABLE_TSS);
10170 }10261
10171 }10262 netif_set_real_num_tx_queues(tp->dev, tp->txq_cnt);
10172 10263
10173 return true;10264 return true;
10174}10265}
@@ -10202,6 +10293,11 @@ defcfg: · 27 unmodified lines
10202 if (!tg3_flag(tp, USING_MSIX)) {10293 if (!tg3_flag(tp, USING_MSIX)) {
10203 tp->irq_cnt = 1;10294 tp->irq_cnt = 1;
10204 tp->napi[0].irq_vec = tp->pdev->irq;10295 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;
10205 netif_set_real_num_tx_queues(tp->dev, 1);10301 netif_set_real_num_tx_queues(tp->dev, 1);
10206 netif_set_real_num_rx_queues(tp->dev, 1);10302 netif_set_real_num_rx_queues(tp->dev, 1);
10207 }10303 }
@@ -10219,38 +10315,11 @@ static void tg3_ints_fini(struct tg3 *tp) · 11 unmodified lines
10219 tg3_flag_clear(tp, ENABLE_TSS);10315 tg3_flag_clear(tp, ENABLE_TSS);
10220}10316}
10221 10317
10222static int tg3_open(struct net_device *dev)10318static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq)
10223{10319{
10224 struct tg3 *tp = netdev_priv(dev);10320 struct net_device *dev = tp->dev;
10225 int i, err;10321 int i, err;
10226 10322
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
10254 /*10323 /*
10255 * Setup interrupts first so we know how10324 * Setup interrupts first so we know how
10256 * many NAPI resources to allocate10325 * many NAPI resources to allocate
@@ -10284,7 +10353,7 @@ static int tg3_open(struct net_device *dev) · 27 unmodified lines
10284 10353
10285 tg3_full_lock(tp, 0);10354 tg3_full_lock(tp, 0);
10286 10355
10287 err = tg3_init_hw(tp, 1);10356 err = tg3_init_hw(tp, reset_phy);
10288 if (err) {10357 if (err) {
10289 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);10358 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
10290 tg3_free_rings(tp);10359 tg3_free_rings(tp);
@@ -10295,7 +10364,7 @@ static int tg3_open(struct net_device *dev) · 4 unmodified lines
10295 if (err)10364 if (err)
10296 goto err_out3;10365 goto err_out3;
10297 10366
10298 if (tg3_flag(tp, USING_MSI)) {10367 if (test_irq && tg3_flag(tp, USING_MSI)) {
10299 err = tg3_test_msi(tp);10368 err = tg3_test_msi(tp);
10300 10369
10301 if (err) {10370 if (err) {
@@ -10351,20 +10420,18 @@ err_out2: · 49 unmodified lines
10351 10420
10352err_out1:10421err_out1:
10353 tg3_ints_fini(tp);10422 tg3_ints_fini(tp);
10354 tg3_frob_aux_power(tp, false);10423
10355 pci_set_power_state(tp->pdev, PCI_D3hot);
10356 return err;10424 return err;
10357}10425}
10358 10426
10359static int tg3_close(struct net_device *dev)10427static void tg3_stop(struct tg3 *tp)
10360{10428{
10361 int i;10429 int i;
10362 struct tg3 *tp = netdev_priv(dev);
10363 10430
10364 tg3_napi_disable(tp);10431 tg3_napi_disable(tp);
10365 tg3_reset_task_cancel(tp);10432 tg3_reset_task_cancel(tp);
10366 10433
10367 netif_tx_stop_all_queues(dev);10434 netif_tx_disable(tp->dev);
10368 10435
10369 tg3_timer_stop(tp);10436 tg3_timer_stop(tp);
10370 10437
@@ -10389,13 +10456,60 @@ static int tg3_close(struct net_device *dev) · 18 unmodified lines
10389 10456
10390 tg3_ints_fini(tp);10457 tg3_ints_fini(tp);
10391 10458
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
10396 tg3_napi_fini(tp);10459 tg3_napi_fini(tp);
10397 10460
10398 tg3_free_consistent(tp);10461 tg3_free_consistent(tp);
10462}
10463
10464static 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
10504static 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));
10399 10513
10400 tg3_power_down(tp);10514 tg3_power_down(tp);
10401 10515
@@ -11185,11 +11299,11 @@ static int tg3_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 783 unmodified lines
11185 switch (info->cmd) {11299 switch (info->cmd) {
11186 case ETHTOOL_GRXRINGS:11300 case ETHTOOL_GRXRINGS:
11187 if (netif_running(tp->dev))11301 if (netif_running(tp->dev))
11188 info->data = tp->irq_cnt;11302 info->data = tp->rxq_cnt;
11189 else {11303 else {
11190 info->data = num_online_cpus();11304 info->data = num_online_cpus();
11191 if (info->data > TG3_IRQ_MAX_VECS_RSS)11305 if (info->data > TG3_RSS_MAX_NUM_QS)
11192 info->data = TG3_IRQ_MAX_VECS_RSS;11306 info->data = TG3_RSS_MAX_NUM_QS;
11193 }11307 }
11194 11308
11195 /* The first interrupt vector only11309 /* 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
11246 return 0;11360 return 0;
11247}11361}
11248 11362
11363static 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
11388static 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
11249static void tg3_get_strings(struct net_device *dev, u32 stringset, u8 *buf)11415static void tg3_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
11250{11416{
11251 switch (stringset) {11417 switch (stringset) {
@@ -12494,6 +12660,8 @@ static const struct ethtool_ops tg3_ethtool_ops = { · 1242 unmodified lines
12494 .get_rxfh_indir_size = tg3_get_rxfh_indir_size,12660 .get_rxfh_indir_size = tg3_get_rxfh_indir_size,
12495 .get_rxfh_indir = tg3_get_rxfh_indir,12661 .get_rxfh_indir = tg3_get_rxfh_indir,
12496 .set_rxfh_indir = tg3_set_rxfh_indir,12662 .set_rxfh_indir = tg3_set_rxfh_indir,
12663 .get_channels = tg3_get_channels,
12664 .set_channels = tg3_set_channels,
12497 .get_ts_info = ethtool_op_get_ts_info,12665 .get_ts_info = ethtool_op_get_ts_info,
12498};12666};
12499 12667
@@ -14510,10 +14678,20 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) · 2010 unmodified lines
14510 if (tg3_flag(tp, 57765_PLUS)) {14678 if (tg3_flag(tp, 57765_PLUS)) {
14511 tg3_flag_set(tp, SUPPORT_MSIX);14679 tg3_flag_set(tp, SUPPORT_MSIX);
14512 tp->irq_max = TG3_IRQ_MAX_VECS;14680 tp->irq_max = TG3_IRQ_MAX_VECS;
14513 tg3_rss_init_dflt_indir_tbl(tp);
14514 }14681 }
14515 }14682 }
14516 14683
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
14517 if (tg3_flag(tp, 5755_PLUS) ||14695 if (tg3_flag(tp, 5755_PLUS) ||
14518 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)14696 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
14519 tg3_flag_set(tp, SHORT_DMA_BUG);14697 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
2860 dma_addr_t rx_jmb_mapping;2860 dma_addr_t rx_jmb_mapping;
2861};2861};
2862 2862
2863#define TG3_IRQ_MAX_VECS_RSS 52863#define TG3_RSS_MAX_NUM_QS 4
2864#define TG3_IRQ_MAX_VECS_RSS (TG3_RSS_MAX_NUM_QS + 1)
2864#define TG3_IRQ_MAX_VECS TG3_IRQ_MAX_VECS_RSS2865#define TG3_IRQ_MAX_VECS TG3_IRQ_MAX_VECS_RSS
2865 2866
2866struct tg3_napi {2867struct tg3_napi {
@@ -3037,6 +3038,9 @@ struct tg3 { · 170 unmodified lines
3037 void (*write32_tx_mbox) (struct tg3 *, u32,3038 void (*write32_tx_mbox) (struct tg3 *, u32,
3038 u32);3039 u32);
3039 u32 dma_limit;3040 u32 dma_limit;
3041 u32 txq_req;
3042 u32 txq_cnt;
3043 u32 txq_max;
3040 3044
3041 /* begin "rx thread" cacheline section */3045 /* begin "rx thread" cacheline section */
3042 struct tg3_napi napi[TG3_IRQ_MAX_VECS];3046 struct tg3_napi napi[TG3_IRQ_MAX_VECS];
@@ -3051,6 +3055,9 @@ struct tg3 { · 8 unmodified lines
3051 u32 rx_std_max_post;3055 u32 rx_std_max_post;
3052 u32 rx_offset;3056 u32 rx_offset;
3053 u32 rx_pkt_map_sz;3057 u32 rx_pkt_map_sz;
3058 u32 rxq_req;
3059 u32 rxq_cnt;
3060 u32 rxq_max;
3054 bool rx_refill;3061 bool rx_refill;
3055 3062
3056 3063
drivers/net/ethernet/brocade/bna/bnad.c+1−0
@@ -3268,6 +3268,7 @@ bnad_pci_probe(struct pci_dev *pdev, · 3267 unmodified lines
3268 * Output : using_dac = 1 for 64 bit DMA3268 * Output : using_dac = 1 for 64 bit DMA
3269 * = 0 for 32 bit DMA3269 * = 0 for 32 bit DMA
3270 */3270 */
3271 using_dac = false;
3271 err = bnad_pci_init(bnad, pdev, &using_dac);3272 err = bnad_pci_init(bnad, pdev, &using_dac);
3272 if (err)3273 if (err)
3273 goto unlock_mutex;3274 goto unlock_mutex;
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+46−5
@@ -67,12 +67,12 @@ enum { · 66 unmodified lines
67};67};
68 68
69enum {69enum {
70 MEMWIN0_APERTURE = 65536,70 MEMWIN0_APERTURE = 2048,
71 MEMWIN0_BASE = 0x30000,71 MEMWIN0_BASE = 0x1b800,
72 MEMWIN1_APERTURE = 32768,72 MEMWIN1_APERTURE = 32768,
73 MEMWIN1_BASE = 0x28000,73 MEMWIN1_BASE = 0x28000,
74 MEMWIN2_APERTURE = 2048,74 MEMWIN2_APERTURE = 65536,
75 MEMWIN2_BASE = 0x1b800,75 MEMWIN2_BASE = 0x30000,
76};76};
77 77
78enum dev_master {78enum dev_master {
@@ -211,6 +211,9 @@ struct tp_err_stats { · 132 unmodified lines
211struct tp_params {211struct tp_params {
212 unsigned int ntxchan; /* # of Tx channels */212 unsigned int ntxchan; /* # of Tx channels */
213 unsigned int tre; /* log2 of core clocks per TP tick */213 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 */
214};217};
215 218
216struct vpd_params {219struct vpd_params {
@@ -315,6 +318,10 @@ enum { /* adapter flags */ · 98 unmodified lines
315 USING_MSI = (1 << 1),318 USING_MSI = (1 << 1),
316 USING_MSIX = (1 << 2),319 USING_MSIX = (1 << 2),
317 FW_OK = (1 << 4),320 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),
318};325};
319 326
320struct rx_sw_desc;327struct rx_sw_desc;
@@ -467,6 +474,11 @@ struct sge { · 146 unmodified lines
467 u16 rdma_rxq[NCHAN];474 u16 rdma_rxq[NCHAN];
468 u16 timer_val[SGE_NTIMERS];475 u16 timer_val[SGE_NTIMERS];
469 u8 counter_val[SGE_NCOUNTERS];476 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 */
470 unsigned int starve_thres;482 unsigned int starve_thres;
471 u8 idma_state[2];483 u8 idma_state[2];
472 unsigned int egr_start;484 unsigned int egr_start;
@@ -511,6 +523,8 @@ struct adapter { · 38 unmodified lines
511 struct net_device *port[MAX_NPORTS];523 struct net_device *port[MAX_NPORTS];
512 u8 chan_map[NCHAN]; /* channel -> port map */524 u8 chan_map[NCHAN]; /* channel -> port map */
513 525
526 unsigned int l2t_start;
527 unsigned int l2t_end;
514 struct l2t_data *l2t;528 struct l2t_data *l2t;
515 void *uld_handle[CXGB4_ULD_MAX];529 void *uld_handle[CXGB4_ULD_MAX];
516 struct list_head list_node;530 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
619int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,633int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
620 struct net_device *dev, unsigned int iqid);634 struct net_device *dev, unsigned int iqid);
621irqreturn_t t4_sge_intr_msix(int irq, void *cookie);635irqreturn_t t4_sge_intr_msix(int irq, void *cookie);
622void t4_sge_init(struct adapter *adap);636int t4_sge_init(struct adapter *adap);
623void t4_sge_start(struct adapter *adap);637void t4_sge_start(struct adapter *adap);
624void t4_sge_stop(struct adapter *adap);638void t4_sge_stop(struct adapter *adap);
625extern int dbfifo_int_thresh;639extern int dbfifo_int_thresh;
@@ -638,6 +652,14 @@ static inline unsigned int us_to_core_ticks(const struct adapter *adap, · 12 unmodified lines
638 return (us * adap->params.vpd.cclk) / 1000;652 return (us * adap->params.vpd.cclk) / 1000;
639}653}
640 654
655static 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
641void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,663void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,
642 u32 val);664 u32 val);
643 665
@@ -656,6 +678,9 @@ static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, · 12 unmodified lines
656 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);678 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);
657}679}
658 680
681void 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);
659void t4_intr_enable(struct adapter *adapter);684void t4_intr_enable(struct adapter *adapter);
660void t4_intr_disable(struct adapter *adapter);685void t4_intr_disable(struct adapter *adapter);
661int t4_slow_intr_handler(struct adapter *adapter);686int t4_slow_intr_handler(struct adapter *adapter);
@@ -664,8 +689,12 @@ int t4_wait_dev_ready(struct adapter *adap); · 2 unmodified lines
664int t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port,689int t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port,
665 struct link_config *lc);690 struct link_config *lc);
666int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);691int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);
692int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
693 __be32 *buf);
667int t4_seeprom_wp(struct adapter *adapter, bool enable);694int t4_seeprom_wp(struct adapter *adapter, bool enable);
695int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
668int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);696int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
697unsigned int t4_flash_cfg_addr(struct adapter *adapter);
669int t4_check_fw_version(struct adapter *adapter);698int t4_check_fw_version(struct adapter *adapter);
670int t4_prep_adapter(struct adapter *adapter);699int t4_prep_adapter(struct adapter *adapter);
671int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);700int 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
680 709
681void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);710void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
682void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);711void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
712void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
713 unsigned int mask, unsigned int val);
683void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,714void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
684 struct tp_tcp_stats *v6);715 struct tp_tcp_stats *v6);
685void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,716void 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
695int t4_fw_bye(struct adapter *adap, unsigned int mbox);726int t4_fw_bye(struct adapter *adap, unsigned int mbox);
696int t4_early_init(struct adapter *adap, unsigned int mbox);727int t4_early_init(struct adapter *adap, unsigned int mbox);
697int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);728int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
729int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force);
730int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset);
731int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
732 const u8 *fw_data, unsigned int size, int force);
733int t4_fw_config_file(struct adapter *adap, unsigned int mbox,
734 unsigned int mtype, unsigned int maddr,
735 u32 *finiver, u32 *finicsum, u32 *cfcsum);
736int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
737 unsigned int cache_line_size);
738int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
698int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,739int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
699 unsigned int vf, unsigned int nparams, const u32 *params,740 unsigned int vf, unsigned int nparams, const u32 *params,
700 u32 *val);741 u32 *val);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+838−116
@@ -78,28 +78,45 @@ · 77 unmodified lines
78 */78 */
79#define MAX_SGE_TIMERVAL 200U79#define MAX_SGE_TIMERVAL 200U
80 80
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 */
89enum {81enum {
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 */
90 VFRES_NPORTS = 1, /* # of "ports" per VF */106 VFRES_NPORTS = 1, /* # of "ports" per VF */
91 VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */107 VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */
92 108
93 VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */109 VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */
94 VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */110 VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */
95 VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */111 VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */
96 VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
97 VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */112 VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */
113 VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
98 VFRES_TC = 0, /* PCI-E traffic class */114 VFRES_TC = 0, /* PCI-E traffic class */
99 VFRES_NEXACTF = 16, /* # of exact MPS filters */115 VFRES_NEXACTF = 16, /* # of exact MPS filters */
100 116
101 VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT,117 VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT,
102 VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF,118 VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF,
119#endif
103};120};
104 121
105/*122/*
@@ -146,7 +163,6 @@ static unsigned int pfvfres_pmask(struct adapter *adapter, · 40 unmodified lines
146 }163 }
147 /*NOTREACHED*/164 /*NOTREACHED*/
148}165}
149#endif
150 166
151enum {167enum {
152 MAX_TXQ_ENTRIES = 16384,168 MAX_TXQ_ENTRIES = 16384,
@@ -193,6 +209,7 @@ static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { · 40 unmodified lines
193};209};
194 210
195#define FW_FNAME "cxgb4/t4fw.bin"211#define FW_FNAME "cxgb4/t4fw.bin"
212#define FW_CFNAME "cxgb4/t4-config.txt"
196 213
197MODULE_DESCRIPTION(DRV_DESC);214MODULE_DESCRIPTION(DRV_DESC);
198MODULE_AUTHOR("Chelsio Communications");215MODULE_AUTHOR("Chelsio Communications");
@@ -201,6 +218,28 @@ MODULE_VERSION(DRV_VERSION); · 2 unmodified lines
201MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl);218MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl);
202MODULE_FIRMWARE(FW_FNAME);219MODULE_FIRMWARE(FW_FNAME);
203 220
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 */
227static uint force_init;
228
229module_param(force_init, uint, 0644);
230MODULE_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 */
238static uint force_old_init;
239
240module_param(force_old_init, uint, 0644);
241MODULE_PARM_DESC(force_old_init, "Force old initialization sequence");
242
204static int dflt_msg_enable = DFLT_MSG_ENABLE;243static int dflt_msg_enable = DFLT_MSG_ENABLE;
205 244
206module_param(dflt_msg_enable, int, 0644);245module_param(dflt_msg_enable, int, 0644);
@@ -236,6 +275,20 @@ module_param_array(intr_cnt, uint, NULL, 0644); · 29 unmodified lines
236MODULE_PARM_DESC(intr_cnt,275MODULE_PARM_DESC(intr_cnt,
237 "thresholds 1..3 for queue interrupt packet counters");276 "thresholds 1..3 for queue interrupt packet counters");
238 277
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 */
290static int rx_dma_offset = 2;
291
239static bool vf_acls;292static bool vf_acls;
240 293
241#ifdef CONFIG_PCI_IOV294#ifdef CONFIG_PCI_IOV
@@ -248,6 +301,30 @@ module_param_array(num_vf, uint, NULL, 0644); · 6 unmodified lines
248MODULE_PARM_DESC(num_vf, "number of VFs for each of PFs 0-3");301MODULE_PARM_DESC(num_vf, "number of VFs for each of PFs 0-3");
249#endif302#endif
250 303
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 */
320enum {
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
326static unsigned int tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
327
251static struct dentry *cxgb4_debugfs_root;328static struct dentry *cxgb4_debugfs_root;
252 329
253static LIST_HEAD(adapter_list);330static LIST_HEAD(adapter_list);
@@ -852,11 +929,25 @@ static int upgrade_fw(struct adapter *adap) · 598 unmodified lines
852 */929 */
853 if (FW_HDR_FW_VER_MAJOR_GET(adap->params.fw_vers) != FW_VERSION_MAJOR ||930 if (FW_HDR_FW_VER_MAJOR_GET(adap->params.fw_vers) != FW_VERSION_MAJOR ||
854 vers > adap->params.fw_vers) {931 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);
856 if (!ret)935 if (!ret)
857 dev_info(dev, "firmware upgraded to version %pI4 from "936 dev_info(dev, "firmware successfully upgraded to "
858 FW_FNAME "\n", &hdr->fw_ver);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;
859 }949 }
950
860out: release_firmware(fw);951out: release_firmware(fw);
861 return ret;952 return ret;
862}953}
@@ -2470,8 +2561,8 @@ int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, · 1607 unmodified lines
2470 else2561 else
2471 delta = size - hw_pidx + pidx;2562 delta = size - hw_pidx + pidx;
2472 wmb();2563 wmb();
2473 t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),2564 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
2474 V_QID(qid) | V_PIDX(delta));2565 QID(qid) | PIDX(delta));
2475 }2566 }
2476out:2567out:
2477 return ret;2568 return ret;
@@ -2579,8 +2670,8 @@ static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) · 101 unmodified lines
2579 else2670 else
2580 delta = q->size - hw_pidx + q->db_pidx;2671 delta = q->size - hw_pidx + q->db_pidx;
2581 wmb();2672 wmb();
2582 t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),2673 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
2583 V_QID(q->cntxt_id) | V_PIDX(delta));2674 QID(q->cntxt_id) | PIDX(delta));
2584 }2675 }
2585out:2676out:
2586 q->db_disabled = 0;2677 q->db_disabled = 0;
@@ -2617,9 +2708,9 @@ static void process_db_full(struct work_struct *work) · 30 unmodified lines
2617 2708
2618 notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL);2709 notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL);
2619 drain_db_fifo(adap, dbfifo_drain_delay);2710 drain_db_fifo(adap, dbfifo_drain_delay);
2620 t4_set_reg_field(adap, A_SGE_INT_ENABLE3,2711 t4_set_reg_field(adap, SGE_INT_ENABLE3,
2621 F_DBFIFO_HP_INT | F_DBFIFO_LP_INT,2712 DBFIFO_HP_INT | DBFIFO_LP_INT,
2622 F_DBFIFO_HP_INT | F_DBFIFO_LP_INT);2713 DBFIFO_HP_INT | DBFIFO_LP_INT);
2623 notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY);2714 notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY);
2624}2715}
2625 2716
@@ -2639,8 +2730,8 @@ static void process_db_drop(struct work_struct *work) · 13 unmodified lines
2639 2730
2640void t4_db_full(struct adapter *adap)2731void t4_db_full(struct adapter *adap)
2641{2732{
2642 t4_set_reg_field(adap, A_SGE_INT_ENABLE3,2733 t4_set_reg_field(adap, SGE_INT_ENABLE3,
2643 F_DBFIFO_HP_INT | F_DBFIFO_LP_INT, 0);2734 DBFIFO_HP_INT | DBFIFO_LP_INT, 0);
2644 queue_work(workq, &adap->db_full_task);2735 queue_work(workq, &adap->db_full_task);
2645}2736}
2646 2737
@@ -3076,6 +3167,10 @@ static void setup_memwin(struct adapter *adap) · 429 unmodified lines
3076 t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2),3167 t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2),
3077 (bar0 + MEMWIN2_BASE) | BIR(0) |3168 (bar0 + MEMWIN2_BASE) | BIR(0) |
3078 WINDOW(ilog2(MEMWIN2_APERTURE) - 10));3169 WINDOW(ilog2(MEMWIN2_APERTURE) - 10));
3170}
3171
3172static void setup_memwin_rdma(struct adapter *adap)
3173{
3079 if (adap->vres.ocq.size) {3174 if (adap->vres.ocq.size) {
3080 unsigned int start, sz_kb;3175 unsigned int start, sz_kb;
3081 3176
@@ -3153,6 +3248,488 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) · 71 unmodified lines
3153 */3248 */
3154#define MAX_ATIDS 8192U3249#define MAX_ATIDS 8192U
3155 3250
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 */
3267static 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 */
3302static 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 */
3470bye:
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 */
3481static 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 */
3729bye:
3730 return ret;
3731}
3732
3156/*3733/*
3157 * Phase 0 of initialization: contact FW, obtain config, perform basic init.3734 * Phase 0 of initialization: contact FW, obtain config, perform basic init.
3158 */3735 */
@@ -3162,72 +3739,216 @@ static int adap_init0(struct adapter *adap) · 3 unmodified lines
3162 u32 v, port_vec;3739 u32 v, port_vec;
3163 enum dev_state state;3740 enum dev_state state;
3164 u32 params[7], val[7];3741 u32 params[7], val[7];
3165 struct fw_caps_config_cmd c;3742 int reset = 1, j;
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;
3174 3743
3175 /* contact FW, request master */3744 /*
3176 ret = t4_fw_hello(adap, adap->fn, adap->fn, MASTER_MUST, &state);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);
3177 if (ret < 0) {3752 if (ret < 0) {
3178 dev_err(adap->pdev_dev, "could not connect to FW, error %d\n",3753 dev_err(adap->pdev_dev, "could not connect to FW, error %d\n",
3179 ret);3754 ret);
3180 return ret;3755 return ret;
3181 }3756 }
3757 if (ret == adap->mbox)
3758 adap->flags |= MASTER_PF;
3759 if (force_init && state == DEV_STATE_INIT)
3760 state = DEV_STATE_UNINIT;
3182 3761
3183 /* reset device */3762 /*
3184 ret = t4_fw_reset(adap, adap->fn, PIORSTMODE | PIORST);3763 * If we're the Master PF Driver and the device is uninitialized,
3185 if (ret < 0)3764 * then let's consider upgrading the firmware ... (We always want
3186 goto bye;3765 * to check the firmware version number in order to A. get it for
3187 3766 * later reporting and B. to warn if the currently loaded firmware
3188 for (v = 0; v < SGE_NTIMERS - 1; v++)3767 * is excessively mismatched relative to the driver.)
3189 adap->sge.timer_val[v] = min(intr_holdoff[v], MAX_SGE_TIMERVAL);3768 */
3190 adap->sge.timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL;3769 ret = t4_check_fw_version(adap);
3191 adap->sge.counter_val[0] = 1;3770 if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) {
3192 for (v = 1; v < SGE_NCOUNTERS; v++)3771 if (ret == -EINVAL || ret > 0) {
3193 adap->sge.counter_val[v] = min(intr_cnt[v - 1],3772 if (upgrade_fw(adap) >= 0) {
3194 THRESHOLD_3_MASK);3773 /*
3195#define FW_PARAM_DEV(param) \3774 * Note that the chip was reset as part of the
3196 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \3775 * firmware upgrade so we don't reset it again
3197 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))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 }
3198 3785
3199 params[0] = FW_PARAM_DEV(CCLK);3786 /*
3200 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 1, params, val);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);
3201 if (ret < 0)3794 if (ret < 0)
3202 goto bye;3795 goto bye;
3203 adap->params.vpd.cclk = val[0];
3204 3796
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);
3206 if (ret < 0)3806 if (ret < 0)
3207 goto bye;3807 goto bye;
3208 3808
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
3209#define FW_PARAM_PFVF(param) \3902#define FW_PARAM_PFVF(param) \
3210 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \3903 FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
3211 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param) | \3904 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param)| \
3212 FW_PARAMS_PARAM_Y(adap->fn))3905 FW_PARAMS_PARAM_Y(0) | \
3906 FW_PARAMS_PARAM_Z(0)
3213 3907
3214 params[0] = FW_PARAM_DEV(PORTVEC);3908 params[0] = FW_PARAM_PFVF(EQ_START);
3215 params[1] = FW_PARAM_PFVF(L2T_START);3909 params[1] = FW_PARAM_PFVF(L2T_START);
3216 params[2] = FW_PARAM_PFVF(L2T_END);3910 params[2] = FW_PARAM_PFVF(L2T_END);
3217 params[3] = FW_PARAM_PFVF(FILTER_START);3911 params[3] = FW_PARAM_PFVF(FILTER_START);
3218 params[4] = FW_PARAM_PFVF(FILTER_END);3912 params[4] = FW_PARAM_PFVF(FILTER_END);
3219 params[5] = FW_PARAM_PFVF(IQFLINT_START);3913 params[5] = FW_PARAM_PFVF(IQFLINT_START);
3220 params[6] = FW_PARAM_PFVF(EQ_START);3914 ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6, params, val);
3221 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 7, params, val);
3222 if (ret < 0)3915 if (ret < 0)
3223 goto bye;3916 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];
3225 adap->tids.ftid_base = val[3];3920 adap->tids.ftid_base = val[3];
3226 adap->tids.nftids = val[4] - val[3] + 1;3921 adap->tids.nftids = val[4] - val[3] + 1;
3227 adap->sge.ingr_start = val[5];3922 adap->sge.ingr_start = val[5];
3228 adap->sge.egr_start = val[6];
3229 3923
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) {
3231 /* query offload-related parameters */3952 /* query offload-related parameters */
3232 params[0] = FW_PARAM_DEV(NTID);3953 params[0] = FW_PARAM_DEV(NTID);
3233 params[1] = FW_PARAM_PFVF(SERVER_START);3954 params[1] = FW_PARAM_PFVF(SERVER_START);
@@ -3235,28 +3956,55 @@ static int adap_init0(struct adapter *adap) · 1 unmodified line
3235 params[3] = FW_PARAM_PFVF(TDDP_START);3956 params[3] = FW_PARAM_PFVF(TDDP_START);
3236 params[4] = FW_PARAM_PFVF(TDDP_END);3957 params[4] = FW_PARAM_PFVF(TDDP_END);
3237 params[5] = FW_PARAM_DEV(FLOWC_BUFFIFO_SZ);3958 params[5] = FW_PARAM_DEV(FLOWC_BUFFIFO_SZ);
3238 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,3959 ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6,
3239 val);3960 params, val);
3240 if (ret < 0)3961 if (ret < 0)
3241 goto bye;3962 goto bye;
3242 adap->tids.ntids = val[0];3963 adap->tids.ntids = val[0];
3243 adap->tids.natids = min(adap->tids.ntids / 2, MAX_ATIDS);3964 adap->tids.natids = min(adap->tids.ntids / 2, MAX_ATIDS);
3244 adap->tids.stid_base = val[1];3965 adap->tids.stid_base = val[1];
3245 adap->tids.nstids = val[2] - val[1] + 1;3966 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 }
3246 adap->vres.ddp.start = val[3];3984 adap->vres.ddp.start = val[3];
3247 adap->vres.ddp.size = val[4] - val[3] + 1;3985 adap->vres.ddp.size = val[4] - val[3] + 1;
3248 adap->params.ofldq_wr_cred = val[5];3986 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
3249 adap->params.offload = 1;3997 adap->params.offload = 1;
3250 }3998 }
3251 if (c.rdmacaps) {3999 if (caps_cmd.rdmacaps) {
3252 params[0] = FW_PARAM_PFVF(STAG_START);4000 params[0] = FW_PARAM_PFVF(STAG_START);
3253 params[1] = FW_PARAM_PFVF(STAG_END);4001 params[1] = FW_PARAM_PFVF(STAG_END);
3254 params[2] = FW_PARAM_PFVF(RQ_START);4002 params[2] = FW_PARAM_PFVF(RQ_START);
3255 params[3] = FW_PARAM_PFVF(RQ_END);4003 params[3] = FW_PARAM_PFVF(RQ_END);
3256 params[4] = FW_PARAM_PFVF(PBL_START);4004 params[4] = FW_PARAM_PFVF(PBL_START);
3257 params[5] = FW_PARAM_PFVF(PBL_END);4005 params[5] = FW_PARAM_PFVF(PBL_END);
3258 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,4006 ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6,
3259 val);4007 params, val);
3260 if (ret < 0)4008 if (ret < 0)
3261 goto bye;4009 goto bye;
3262 adap->vres.stag.start = val[0];4010 adap->vres.stag.start = val[0];
@@ -3272,8 +4020,7 @@ static int adap_init0(struct adapter *adap) · 9 unmodified lines
3272 params[3] = FW_PARAM_PFVF(CQ_END);4020 params[3] = FW_PARAM_PFVF(CQ_END);
3273 params[4] = FW_PARAM_PFVF(OCQ_START);4021 params[4] = FW_PARAM_PFVF(OCQ_START);
3274 params[5] = FW_PARAM_PFVF(OCQ_END);4022 params[5] = FW_PARAM_PFVF(OCQ_END);
3275 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,4023 ret = t4_query_params(adap, 0, 0, 0, 6, params, val);
3276 val);
3277 if (ret < 0)4024 if (ret < 0)
3278 goto bye;4025 goto bye;
3279 adap->vres.qp.start = val[0];4026 adap->vres.qp.start = val[0];
@@ -3283,11 +4030,11 @@ static int adap_init0(struct adapter *adap) · 3 unmodified lines
3283 adap->vres.ocq.start = val[4];4030 adap->vres.ocq.start = val[4];
3284 adap->vres.ocq.size = val[5] - val[4] + 1;4031 adap->vres.ocq.size = val[5] - val[4] + 1;
3285 }4032 }
3286 if (c.iscsicaps) {4033 if (caps_cmd.iscsicaps) {
3287 params[0] = FW_PARAM_PFVF(ISCSI_START);4034 params[0] = FW_PARAM_PFVF(ISCSI_START);
3288 params[1] = FW_PARAM_PFVF(ISCSI_END);4035 params[1] = FW_PARAM_PFVF(ISCSI_END);
3289 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 2, params,4036 ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2,
3290 val);4037 params, val);
3291 if (ret < 0)4038 if (ret < 0)
3292 goto bye;4039 goto bye;
3293 adap->vres.iscsi.start = val[0];4040 adap->vres.iscsi.start = val[0];
@@ -3295,63 +4042,33 @@ static int adap_init0(struct adapter *adap) · 1 unmodified line
3295 }4042 }
3296#undef FW_PARAM_PFVF4043#undef FW_PARAM_PFVF
3297#undef FW_PARAM_DEV4044#undef FW_PARAM_DEV
4045#endif /* CONFIG_CHELSIO_T4_OFFLOAD */
3298 4046
3299 adap->params.nports = hweight32(port_vec);4047 /*
3300 adap->params.portvec = port_vec;4048 * These are finalized by FW initialization, load their values now.
3301 adap->flags |= FW_OK;4049 */
3302
3303 /* These are finalized by FW initialization, load their values now */
3304 v = t4_read_reg(adap, TP_TIMER_RESOLUTION);4050 v = t4_read_reg(adap, TP_TIMER_RESOLUTION);
3305 adap->params.tp.tre = TIMERRESOLUTION_GET(v);4051 adap->params.tp.tre = TIMERRESOLUTION_GET(v);
4052 adap->params.tp.dack_re = DELAYEDACKRESOLUTION_GET(v);
3306 t4_read_mtu_tbl(adap, adap->params.mtus, NULL);4053 t4_read_mtu_tbl(adap, adap->params.mtus, NULL);
3307 t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd,4054 t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd,
3308 adap->params.b_wnd);4055 adap->params.b_wnd);
3309 4056
3310#ifdef CONFIG_PCI_IOV4057 /* MODQ_REQ_MAP defaults to setting queues 0-3 to chan 0-3 */
3311 /*4058 for (j = 0; j < NCHAN; j++)
3312 * Provision resource limits for Virtual Functions. We currently4059 adap->params.tp.tx_modq[j] = j;
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;
3325 4060
3326 /* VF numbering starts at 1! */4061 adap->flags |= FW_OK;
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);
3346 return 0;4062 return 0;
3347 4063
3348 /*4064 /*
3349 * If a command timed out or failed with EIO FW does not operate within4065 * Something bad happened. If a command timed out or failed with EIO
3350 * its spec or something catastrophic happened to HW/FW, stop issuing4066 * FW does not operate within its spec or something catastrophic
3351 * commands.4067 * happened to HW/FW, stop issuing commands.
3352 */4068 */
3353bye: if (ret != -ETIMEDOUT && ret != -EIO)4069bye:
3354 t4_fw_bye(adap, adap->fn);4070 if (ret != -ETIMEDOUT && ret != -EIO)
4071 t4_fw_bye(adap, adap->mbox);
3355 return ret;4072 return ret;
3356}4073}
3357 4074
@@ -3806,7 +4523,9 @@ static int __devinit init_one(struct pci_dev *pdev, · 448 unmodified lines
3806 err = t4_prep_adapter(adapter);4523 err = t4_prep_adapter(adapter);
3807 if (err)4524 if (err)
3808 goto out_unmap_bar;4525 goto out_unmap_bar;
4526 setup_memwin(adapter);
3809 err = adap_init0(adapter);4527 err = adap_init0(adapter);
4528 setup_memwin_rdma(adapter);
3810 if (err)4529 if (err)
3811 goto out_unmap_bar;4530 goto out_unmap_bar;
3812 4531
@@ -3948,8 +4667,11 @@ static void __devexit remove_one(struct pci_dev *pdev) · 135 unmodified lines
3948{4667{
3949 struct adapter *adapter = pci_get_drvdata(pdev);4668 struct adapter *adapter = pci_get_drvdata(pdev);
3950 4669
4670#ifdef CONFIG_PCI_IOV
3951 pci_disable_sriov(pdev);4671 pci_disable_sriov(pdev);
3952 4672
4673#endif
4674
3953 if (adapter) {4675 if (adapter) {
3954 int i;4676 int i;
3955 4677
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h+2−0
@@ -100,6 +100,8 @@ struct tid_info { · 99 unmodified lines
100 100
101 unsigned int nftids;101 unsigned int nftids;
102 unsigned int ftid_base;102 unsigned int ftid_base;
103 unsigned int aftid_base;
104 unsigned int aftid_end;
103 105
104 spinlock_t atid_lock ____cacheline_aligned_in_smp;106 spinlock_t atid_lock ____cacheline_aligned_in_smp;
105 union aopen_entry *afree;107 union aopen_entry *afree;
drivers/net/ethernet/chelsio/cxgb4/sge.c+277−64
@@ -68,9 +68,6 @@ · 67 unmodified lines
68 */68 */
69#define RX_PKT_SKB_LEN 51269#define RX_PKT_SKB_LEN 512
70 70
71/* Ethernet header padding prepended to RX_PKTs */
72#define RX_PKT_PAD 2
73
74/*71/*
75 * Max number of Tx descriptors we clean up at a time. Should be modest as72 * Max number of Tx descriptors we clean up at a time. Should be modest as
76 * freeing skbs isn't cheap and it happens while holding locks. We just need73 * freeing skbs isn't cheap and it happens while holding locks. We just need
@@ -137,13 +134,6 @@ · 60 unmodified lines
137 */134 */
138#define MAX_CTRL_WR_LEN SGE_MAX_WR_LEN135#define MAX_CTRL_WR_LEN SGE_MAX_WR_LEN
139 136
140enum {
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
147struct tx_sw_desc { /* SW state per Tx descriptor */137struct tx_sw_desc { /* SW state per Tx descriptor */
148 struct sk_buff *skb;138 struct sk_buff *skb;
149 struct ulptx_sgl *sgl;139 struct ulptx_sgl *sgl;
@@ -155,16 +145,57 @@ struct rx_sw_desc { /* SW state per Rx descriptor */ · 5 unmodified lines
155};145};
156 146
157/*147/*
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
156static 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 ...
159 */176 */
160enum {177enum {
161 RX_LARGE_BUF = 1 << 0, /* buffer is larger than PAGE_SIZE */178 RX_BUF_FLAGS = 0x1f, /* bottom five bits are special */
162 RX_UNMAPPED_BUF = 1 << 1, /* buffer is not mapped */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 */
163};194};
164 195
165static inline dma_addr_t get_buf_addr(const struct rx_sw_desc *d)196static inline dma_addr_t get_buf_addr(const struct rx_sw_desc *d)
166{197{
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;
168}199}
169 200
170static inline bool is_buf_mapped(const struct rx_sw_desc *d)201static 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
392 }423 }
393}424}
394 425
395static inline int get_buf_size(const struct rx_sw_desc *d)426static inline int get_buf_size(struct adapter *adapter,
427 const struct rx_sw_desc *d)
396{428{
397#if FL_PG_ORDER > 0429 struct sge *s = &adapter->sge;
398 return (d->dma_addr & RX_LARGE_BUF) ? (PAGE_SIZE << FL_PG_ORDER) :430 unsigned int rx_buf_size_idx = d->dma_addr & RX_BUF_SIZE;
399 PAGE_SIZE;431 int buf_size;
400#else432
401 return PAGE_SIZE;433 switch (rx_buf_size_idx) {
402#endif434 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;
403}455}
404 456
405/**457/**
@@ -418,7 +470,8 @@ static void free_rx_bufs(struct adapter *adap, struct sge_fl *q, int n) · 12 unmodified lines
418 470
419 if (is_buf_mapped(d))471 if (is_buf_mapped(d))
420 dma_unmap_page(adap->pdev_dev, get_buf_addr(d),472 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);
422 put_page(d->page);475 put_page(d->page);
423 d->page = NULL;476 d->page = NULL;
424 if (++q->cidx == q->size)477 if (++q->cidx == q->size)
@@ -444,7 +497,7 @@ static void unmap_rx_buf(struct adapter *adap, struct sge_fl *q) · 19 unmodified lines
444 497
445 if (is_buf_mapped(d))498 if (is_buf_mapped(d))
446 dma_unmap_page(adap->pdev_dev, get_buf_addr(d),499 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);
448 d->page = NULL;501 d->page = NULL;
449 if (++q->cidx == q->size)502 if (++q->cidx == q->size)
450 q->cidx = 0;503 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
485static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n,538static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n,
486 gfp_t gfp)539 gfp_t gfp)
487{540{
541 struct sge *s = &adap->sge;
488 struct page *pg;542 struct page *pg;
489 dma_addr_t mapping;543 dma_addr_t mapping;
490 unsigned int cred = q->avail;544 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
493 547
494 gfp |= __GFP_NOWARN | __GFP_COLD;548 gfp |= __GFP_NOWARN | __GFP_COLD;
495 549
496#if FL_PG_ORDER > 0550 if (s->fl_pg_order == 0)
551 goto alloc_small_pages;
552
497 /*553 /*
498 * Prefer large buffers554 * Prefer large buffers
499 */555 */
500 while (n) {556 while (n) {
501 pg = alloc_pages(gfp | __GFP_COMP, FL_PG_ORDER);557 pg = alloc_pages(gfp | __GFP_COMP, s->fl_pg_order);
502 if (unlikely(!pg)) {558 if (unlikely(!pg)) {
503 q->large_alloc_failed++;559 q->large_alloc_failed++;
504 break; /* fall back to single pages */560 break; /* fall back to single pages */
505 }561 }
506 562
507 mapping = dma_map_page(adap->pdev_dev, pg, 0,563 mapping = dma_map_page(adap->pdev_dev, pg, 0,
508 PAGE_SIZE << FL_PG_ORDER,564 PAGE_SIZE << s->fl_pg_order,
509 PCI_DMA_FROMDEVICE);565 PCI_DMA_FROMDEVICE);
510 if (unlikely(dma_mapping_error(adap->pdev_dev, mapping))) {566 if (unlikely(dma_mapping_error(adap->pdev_dev, mapping))) {
511 __free_pages(pg, FL_PG_ORDER);567 __free_pages(pg, s->fl_pg_order);
512 goto out; /* do not try small pages for this error */568 goto out; /* do not try small pages for this error */
513 }569 }
514 mapping |= RX_LARGE_BUF;570 mapping |= RX_LARGE_PG_BUF;
515 *d++ = cpu_to_be64(mapping);571 *d++ = cpu_to_be64(mapping);
516 572
517 set_rx_sw_desc(sd, pg, mapping);573 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
525 }581 }
526 n--;582 n--;
527 }583 }
528#endif
529 584
585alloc_small_pages:
530 while (n--) {586 while (n--) {
531 pg = __skb_alloc_page(gfp, NULL);587 pg = __skb_alloc_page(gfp, NULL);
532 if (unlikely(!pg)) {588 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
769 wmb(); /* write descriptors before telling HW */825 wmb(); /* write descriptors before telling HW */
770 spin_lock(&q->db_lock);826 spin_lock(&q->db_lock);
771 if (!q->db_disabled) {827 if (!q->db_disabled) {
772 t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),828 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
773 V_QID(q->cntxt_id) | V_PIDX(n));829 QID(q->cntxt_id) | PIDX(n));
774 }830 }
775 q->db_pidx = q->pidx;831 q->db_pidx = q->pidx;
776 spin_unlock(&q->db_lock);832 spin_unlock(&q->db_lock);
@@ -1519,6 +1575,8 @@ static noinline int handle_trace_pkt(struct adapter *adap, · 742 unmodified lines
1519static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,1575static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
1520 const struct cpl_rx_pkt *pkt)1576 const struct cpl_rx_pkt *pkt)
1521{1577{
1578 struct adapter *adapter = rxq->rspq.adap;
1579 struct sge *s = &adapter->sge;
1522 int ret;1580 int ret;
1523 struct sk_buff *skb;1581 struct sk_buff *skb;
1524 1582
@@ -1529,8 +1587,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, · 4 unmodified lines
1529 return;1587 return;
1530 }1588 }
1531 1589
1532 copy_frags(skb, gl, RX_PKT_PAD);1590 copy_frags(skb, gl, s->pktshift);
1533 skb->len = gl->tot_len - RX_PKT_PAD;1591 skb->len = gl->tot_len - s->pktshift;
1534 skb->data_len = skb->len;1592 skb->data_len = skb->len;
1535 skb->truesize += skb->data_len;1593 skb->truesize += skb->data_len;
1536 skb->ip_summed = CHECKSUM_UNNECESSARY;1594 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -1566,6 +1624,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 29 unmodified lines
1566 struct sk_buff *skb;1624 struct sk_buff *skb;
1567 const struct cpl_rx_pkt *pkt;1625 const struct cpl_rx_pkt *pkt;
1568 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);1626 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
1627 struct sge *s = &q->adap->sge;
1569 1628
1570 if (unlikely(*(u8 *)rsp == CPL_TRACE_PKT))1629 if (unlikely(*(u8 *)rsp == CPL_TRACE_PKT))
1571 return handle_trace_pkt(q->adap, si);1630 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
1585 return 0;1644 return 0;
1586 }1645 }
1587 1646
1588 __skb_pull(skb, RX_PKT_PAD); /* remove ethernet header padding */1647 __skb_pull(skb, s->pktshift); /* remove ethernet header padding */
1589 skb->protocol = eth_type_trans(skb, q->netdev);1648 skb->protocol = eth_type_trans(skb, q->netdev);
1590 skb_record_rx_queue(skb, q->idx);1649 skb_record_rx_queue(skb, q->idx);
1591 if (skb->dev->features & NETIF_F_RXHASH)1650 if (skb->dev->features & NETIF_F_RXHASH)
@@ -1696,6 +1755,8 @@ static int process_responses(struct sge_rspq *q, int budget) · 104 unmodified lines
1696 int budget_left = budget;1755 int budget_left = budget;
1697 const struct rsp_ctrl *rc;1756 const struct rsp_ctrl *rc;
1698 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);1757 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;
1699 1760
1700 while (likely(budget_left)) {1761 while (likely(budget_left)) {
1701 rc = (void *)q->cur_desc + (q->iqe_len - sizeof(*rc));1762 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
1722 /* gather packet fragments */1783 /* gather packet fragments */
1723 for (frags = 0, fp = si.frags; ; frags++, fp++) {1784 for (frags = 0, fp = si.frags; ; frags++, fp++) {
1724 rsd = &rxq->fl.sdesc[rxq->fl.cidx];1785 rsd = &rxq->fl.sdesc[rxq->fl.cidx];
1725 bufsz = get_buf_size(rsd);1786 bufsz = get_buf_size(adapter, rsd);
1726 fp->page = rsd->page;1787 fp->page = rsd->page;
1727 fp->offset = q->offset;1788 fp->offset = q->offset;
1728 fp->size = min(bufsz, len);1789 fp->size = min(bufsz, len);
@@ -1747,7 +1808,7 @@ static int process_responses(struct sge_rspq *q, int budget) · 18 unmodified lines
1747 si.nfrags = frags + 1;1808 si.nfrags = frags + 1;
1748 ret = q->handler(q, q->cur_desc, &si);1809 ret = q->handler(q, q->cur_desc, &si);
1749 if (likely(ret == 0))1810 if (likely(ret == 0))
1750 q->offset += ALIGN(fp->size, FL_ALIGN);1811 q->offset += ALIGN(fp->size, s->fl_align);
1751 else1812 else
1752 restore_rx_bufs(&si, &rxq->fl, frags);1813 restore_rx_bufs(&si, &rxq->fl, frags);
1753 } else if (likely(rsp_type == RSP_TYPE_CPL)) {1814 } 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
1983{2044{
1984 int ret, flsz = 0;2045 int ret, flsz = 0;
1985 struct fw_iq_cmd c;2046 struct fw_iq_cmd c;
2047 struct sge *s = &adap->sge;
1986 struct port_info *pi = netdev_priv(dev);2048 struct port_info *pi = netdev_priv(dev);
1987 2049
1988 /* Size needs to be multiple of 16, including status entry. */2050 /* 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
2015 fl->size = roundup(fl->size, 8);2077 fl->size = roundup(fl->size, 8);
2016 fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64),2078 fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64),
2017 sizeof(struct rx_sw_desc), &fl->addr,2079 sizeof(struct rx_sw_desc), &fl->addr,
2018 &fl->sdesc, STAT_LEN, NUMA_NO_NODE);2080 &fl->sdesc, s->stat_len, NUMA_NO_NODE);
2019 if (!fl->desc)2081 if (!fl->desc)
2020 goto fl_nomem;2082 goto fl_nomem;
2021 2083
2022 flsz = fl->size / 8 + STAT_LEN / sizeof(struct tx_desc);2084 flsz = fl->size / 8 + s->stat_len / sizeof(struct tx_desc);
2023 c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN |2085 c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN |
2024 FW_IQ_CMD_FL0FETCHRO(1) |2086 FW_IQ_CMD_FL0FETCHRO(1) |
2025 FW_IQ_CMD_FL0DATARO(1) |2087 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
2096{2158{
2097 int ret, nentries;2159 int ret, nentries;
2098 struct fw_eq_eth_cmd c;2160 struct fw_eq_eth_cmd c;
2161 struct sge *s = &adap->sge;
2099 struct port_info *pi = netdev_priv(dev);2162 struct port_info *pi = netdev_priv(dev);
2100 2163
2101 /* Add status entries */2164 /* 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);
2103 2166
2104 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,2167 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
2105 sizeof(struct tx_desc), sizeof(struct tx_sw_desc),2168 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,
2107 netdev_queue_numa_node_read(netdevq));2170 netdev_queue_numa_node_read(netdevq));
2108 if (!txq->q.desc)2171 if (!txq->q.desc)
2109 return -ENOMEM;2172 return -ENOMEM;
@@ -2149,10 +2212,11 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, · 39 unmodified lines
2149{2212{
2150 int ret, nentries;2213 int ret, nentries;
2151 struct fw_eq_ctrl_cmd c;2214 struct fw_eq_ctrl_cmd c;
2215 struct sge *s = &adap->sge;
2152 struct port_info *pi = netdev_priv(dev);2216 struct port_info *pi = netdev_priv(dev);
2153 2217
2154 /* Add status entries */2218 /* 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);
2156 2220
2157 txq->q.desc = alloc_ring(adap->pdev_dev, nentries,2221 txq->q.desc = alloc_ring(adap->pdev_dev, nentries,
2158 sizeof(struct tx_desc), 0, &txq->q.phys_addr,2222 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
2200{2264{
2201 int ret, nentries;2265 int ret, nentries;
2202 struct fw_eq_ofld_cmd c;2266 struct fw_eq_ofld_cmd c;
2267 struct sge *s = &adap->sge;
2203 struct port_info *pi = netdev_priv(dev);2268 struct port_info *pi = netdev_priv(dev);
2204 2269
2205 /* Add status entries */2270 /* 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);
2207 2272
2208 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,2273 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size,
2209 sizeof(struct tx_desc), sizeof(struct tx_sw_desc),2274 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,
2211 NUMA_NO_NODE);2276 NUMA_NO_NODE);
2212 if (!txq->q.desc)2277 if (!txq->q.desc)
2213 return -ENOMEM;2278 return -ENOMEM;
@@ -2251,8 +2316,10 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, · 37 unmodified lines
2251 2316
2252static void free_txq(struct adapter *adap, struct sge_txq *q)2317static void free_txq(struct adapter *adap, struct sge_txq *q)
2253{2318{
2319 struct sge *s = &adap->sge;
2320
2254 dma_free_coherent(adap->pdev_dev,2321 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,
2256 q->desc, q->phys_addr);2323 q->desc, q->phys_addr);
2257 q->cntxt_id = 0;2324 q->cntxt_id = 0;
2258 q->sdesc = NULL;2325 q->sdesc = NULL;
@@ -2262,6 +2329,7 @@ static void free_txq(struct adapter *adap, struct sge_txq *q) · 3 unmodified lines
2262static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq,2329static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq,
2263 struct sge_fl *fl)2330 struct sge_fl *fl)
2264{2331{
2332 struct sge *s = &adap->sge;
2265 unsigned int fl_id = fl ? fl->cntxt_id : 0xffff;2333 unsigned int fl_id = fl ? fl->cntxt_id : 0xffff;
2266 2334
2267 adap->sge.ingr_map[rq->cntxt_id - adap->sge.ingr_start] = NULL;2335 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
2276 2344
2277 if (fl) {2345 if (fl) {
2278 free_rx_bufs(adap, fl, fl->avail);2346 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,
2280 fl->desc, fl->addr);2348 fl->desc, fl->addr);
2281 kfree(fl->sdesc);2349 kfree(fl->sdesc);
2282 fl->sdesc = NULL;2350 fl->sdesc = NULL;
@@ -2408,18 +2476,112 @@ void t4_sge_stop(struct adapter *adap) · 125 unmodified lines
2408 * Performs SGE initialization needed every time after a chip reset.2476 * Performs SGE initialization needed every time after a chip reset.
2409 * We do not initialize any of the queues here, instead the driver2477 * We do not initialize any of the queues here, instead the driver
2410 * top-level must request them individually.2478 * 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 ...
2411 */2491 */
2412void t4_sge_init(struct adapter *adap)2492
2493static int t4_sge_init_soft(struct adapter *adap)
2413{2494{
2414 unsigned int i, v;
2415 struct sge *s = &adap->sge;2495 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;
2417 2499
2418 t4_set_reg_field(adap, SGE_CONTROL, PKTSHIFT_MASK |2500 /*
2419 INGPADBOUNDARY_MASK | EGRSTATUSPAGESIZE,2501 * Verify that CPL messages are going to the Ingress Queue for
2420 INGPADBOUNDARY(fl_align_log - 5) | PKTSHIFT(2) |2502 * process_responses() and that only packet data is going to the
2421 RXPKTCPLMODE |2503 * Free Lists.
2422 (STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0));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
2575static 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);
2423 2585
2424 /*2586 /*
2425 * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows2587 * 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
2433 t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_ENABLE_DROP,2595 t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_ENABLE_DROP,
2434 F_ENABLE_DROP);2596 F_ENABLE_DROP);
2435 2597
2436 for (i = v = 0; i < 32; i += 4)2598 /*
2437 v |= (PAGE_SHIFT - 10) << i;2599 * SGE_FL_BUFFER_SIZE0 (RX_SMALL_PG_BUF) is set up by
2438 t4_write_reg(adap, SGE_HOST_PAGE_SIZE, v);2600 * t4_fixup_host_params().
2439 t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, PAGE_SIZE);2601 */
2440#if FL_PG_ORDER > 02602 s->fl_pg_order = FL_PG_ORDER;
2441 t4_write_reg(adap, SGE_FL_BUFFER_SIZE1, PAGE_SIZE << FL_PG_ORDER);2603 if (s->fl_pg_order)
2442#endif2604 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 */
2443 t4_write_reg(adap, SGE_INGRESS_RX_THRESHOLD,2616 t4_write_reg(adap, SGE_INGRESS_RX_THRESHOLD,
2444 THRESHOLD_0(s->counter_val[0]) |2617 THRESHOLD_0(s->counter_val[0]) |
2445 THRESHOLD_1(s->counter_val[1]) |2618 THRESHOLD_1(s->counter_val[1]) |
@@ -2449,14 +2622,54 @@ void t4_sge_init(struct adapter *adap) · 3 unmodified lines
2449 TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[0])) |2622 TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[0])) |
2450 TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[1])));2623 TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[1])));
2451 t4_write_reg(adap, SGE_TIMER_VALUE_2_AND_3,2624 t4_write_reg(adap, SGE_TIMER_VALUE_2_AND_3,
2452 TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[2])) |2625 TIMERVALUE2(us_to_core_ticks(adap, s->timer_val[2])) |
2453 TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[3])));2626 TIMERVALUE3(us_to_core_ticks(adap, s->timer_val[3])));
2454 t4_write_reg(adap, SGE_TIMER_VALUE_4_AND_5,2627 t4_write_reg(adap, SGE_TIMER_VALUE_4_AND_5,
2455 TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[4])) |2628 TIMERVALUE4(us_to_core_ticks(adap, s->timer_val[4])) |
2456 TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[5])));2629 TIMERVALUE5(us_to_core_ticks(adap, s->timer_val[5])));
2630
2631 return 0;
2632}
2633
2634int 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
2457 setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap);2668 setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap);
2458 setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adap);2669 setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adap);
2459 s->starve_thres = core_ticks_per_usec(adap) * 1000000; /* 1 s */2670 s->starve_thres = core_ticks_per_usec(adap) * 1000000; /* 1 s */
2460 s->idma_state[0] = s->idma_state[1] = 0;2671 s->idma_state[0] = s->idma_state[1] = 0;
2461 spin_lock_init(&s->intrq_lock);2672 spin_lock_init(&s->intrq_lock);
2673
2674 return 0;
2462}2675}
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
120 }120 }
121}121}
122 122
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 */
135void 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
123/*145/*
124 * Get the reply to a mailbox command and store it in @rpl in big-endian order.146 * Get the reply to a mailbox command and store it in @rpl in big-endian order.
125 */147 */
@@ -330,6 +352,143 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) · 204 unmodified lines
330 return 0;352 return 0;
331}353}
332 354
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 */
366static 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 */
407static 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
486int 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
333#define EEPROM_STAT_ADDR 0x7bfc492#define EEPROM_STAT_ADDR 0x7bfc
334#define VPD_BASE 0493#define VPD_BASE 0
335#define VPD_LEN 512494#define VPD_LEN 512
@@ -355,8 +514,9 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) · 19 unmodified lines
355 *514 *
356 * Reads card parameters stored in VPD EEPROM.515 * Reads card parameters stored in VPD EEPROM.
357 */516 */
358static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)517int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
359{518{
519 u32 cclk_param, cclk_val;
360 int i, ret;520 int i, ret;
361 int ec, sn;521 int ec, sn;
362 u8 vpd[VPD_LEN], csum;522 u8 vpd[VPD_LEN], csum;
@@ -418,6 +578,19 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) · 55 unmodified lines
418 i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE);578 i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE);
419 memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN));579 memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN));
420 strim(p->sn);580 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
421 return 0;594 return 0;
422}595}
423 596
@@ -717,6 +890,77 @@ static int t4_flash_erase_sectors(struct adapter *adapter, int start, int end) · 293 unmodified lines
717 return ret;890 return ret;
718}891}
719 892
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 */
900unsigned 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 */
916int 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
957out:
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
720/**964/**
721 * t4_load_fw - download firmware965 * t4_load_fw - download firmware
722 * @adap: the adapter966 * @adap: the adapter
@@ -1018,9 +1262,9 @@ static void sge_intr_handler(struct adapter *adapter) · 295 unmodified lines
1018 { ERR_INVALID_CIDX_INC,1262 { ERR_INVALID_CIDX_INC,
1019 "SGE GTS CIDX increment too large", -1, 0 },1263 "SGE GTS CIDX increment too large", -1, 0 },
1020 { ERR_CPL_OPCODE_0, "SGE received 0-length CPL", -1, 0 },1264 { ERR_CPL_OPCODE_0, "SGE received 0-length CPL", -1, 0 },
1021 { F_DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },1265 { DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },
1022 { F_DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },1266 { DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },
1023 { F_ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },1267 { ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },
1024 { ERR_DATA_CPL_ON_HIGH_QID1 | ERR_DATA_CPL_ON_HIGH_QID0,1268 { ERR_DATA_CPL_ON_HIGH_QID1 | ERR_DATA_CPL_ON_HIGH_QID0,
1025 "SGE IQID > 1023 received CPL for FL", -1, 0 },1269 "SGE IQID > 1023 received CPL for FL", -1, 0 },
1026 { ERR_BAD_DB_PIDX3, "SGE DBP 3 pidx increment too large", -1,1270 { 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
1520 ERR_BAD_DB_PIDX2 | ERR_BAD_DB_PIDX1 |1764 ERR_BAD_DB_PIDX2 | ERR_BAD_DB_PIDX1 |
1521 ERR_BAD_DB_PIDX0 | ERR_ING_CTXT_PRIO |1765 ERR_BAD_DB_PIDX0 | ERR_ING_CTXT_PRIO |
1522 ERR_EGR_CTXT_PRIO | INGRESS_SIZE_ERR |1766 ERR_EGR_CTXT_PRIO | INGRESS_SIZE_ERR |
1523 F_DBFIFO_HP_INT | F_DBFIFO_LP_INT |1767 DBFIFO_HP_INT | DBFIFO_LP_INT |
1524 EGRESS_SIZE_ERR);1768 EGRESS_SIZE_ERR);
1525 t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE), PF_INTR_MASK);1769 t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE), PF_INTR_MASK);
1526 t4_set_reg_field(adapter, PL_INT_MAP0, 0, 1 << pf);1770 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
1716 }1960 }
1717}1961}
1718 1962
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 */
1972void 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
1719/**1980/**
1720 * init_cong_ctrl - initialize congestion control parameters1981 * init_cong_ctrl - initialize congestion control parameters
1721 * @a: the alpha values for congestion control1982 * @a: the alpha values for congestion control
@@ -2000,9 +2261,9 @@ int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, · 278 unmodified lines
2000 struct fw_ldst_cmd c;2261 struct fw_ldst_cmd c;
2001 2262
2002 memset(&c, 0, sizeof(c));2263 memset(&c, 0, sizeof(c));
2003 c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST |2264 c.op_to_addrspace = htonl(FW_CMD_OP(FW_LDST_CMD) | FW_CMD_REQUEST |
2004 F_FW_CMD_WRITE |2265 FW_CMD_WRITE |
2005 V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FIRMWARE));2266 FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FIRMWARE));
2006 c.cycles_to_len16 = htonl(FW_LEN16(c));2267 c.cycles_to_len16 = htonl(FW_LEN16(c));
2007 c.u.addrval.addr = htonl(addr);2268 c.u.addrval.addr = htonl(addr);
2008 c.u.addrval.val = htonl(val);2269 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
2033 if ((addr & 3) || (len + off) > MEMWIN0_APERTURE)2294 if ((addr & 3) || (len + off) > MEMWIN0_APERTURE)
2034 return -EINVAL;2295 return -EINVAL;
2035 2296
2036 t4_write_reg(adap, A_PCIE_MEM_ACCESS_OFFSET, addr & ~15);2297 t4_write_reg(adap, PCIE_MEM_ACCESS_OFFSET, addr & ~15);
2037 t4_read_reg(adap, A_PCIE_MEM_ACCESS_OFFSET);2298 t4_read_reg(adap, PCIE_MEM_ACCESS_OFFSET);
2038 2299
2039 for (i = 0; i < len; i += 4)2300 for (i = 0; i < len; i += 4)
2040 *data++ = t4_read_reg(adap, (MEMWIN0_BASE + off + i));2301 *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
2102}2363}
2103 2364
2104/**2365/**
2105 * t4_fw_hello - establish communication with FW2366 * t4_fw_hello - establish communication with FW
2106 * @adap: the adapter2367 * @adap: the adapter
2107 * @mbox: mailbox to use for the FW command2368 * @mbox: mailbox to use for the FW command
2108 * @evt_mbox: mailbox to receive async FW events2369 * @evt_mbox: mailbox to receive async FW events
2109 * @master: specifies the caller's willingness to be the device master2370 * @master: specifies the caller's willingness to be the device master
2110 * @state: returns the current device state2371 * @state: returns the current device state (if non-NULL)
2111 *2372 *
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.
2113 */2375 */
2114int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,2376int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,
2115 enum dev_master master, enum dev_state *state)2377 enum dev_master master, enum dev_state *state)
2116{2378{
2117 int ret;2379 int ret;
2118 struct fw_hello_cmd c;2380 struct fw_hello_cmd c;
2381 u32 v;
2382 unsigned int master_mbox;
2383 int retries = FW_CMD_HELLO_RETRIES;
2119 2384
2385retry:
2386 memset(&c, 0, sizeof(c));
2120 INIT_CMD(c, HELLO, WRITE);2387 INIT_CMD(c, HELLO, WRITE);
2121 c.err_to_mbasyncnot = htonl(2388 c.err_to_mbasyncnot = htonl(
2122 FW_HELLO_CMD_MASTERDIS(master == MASTER_CANT) |2389 FW_HELLO_CMD_MASTERDIS(master == MASTER_CANT) |
2123 FW_HELLO_CMD_MASTERFORCE(master == MASTER_MUST) |2390 FW_HELLO_CMD_MASTERFORCE(master == MASTER_MUST) |
2124 FW_HELLO_CMD_MBMASTER(master == MASTER_MUST ? mbox : 0xff) |2391 FW_HELLO_CMD_MBMASTER(master == MASTER_MUST ? mbox :
2125 FW_HELLO_CMD_MBASYNCNOT(evt_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);
2126 2396
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 */
2127 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);2402 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
2128 if (ret == 0 && state) {2403 if (ret < 0) {
2129 u32 v = ntohl(c.err_to_mbasyncnot);2404 if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0)
2130 if (v & FW_HELLO_CMD_INIT)2405 goto retry;
2131 *state = DEV_STATE_INIT;2406 return ret;
2132 else if (v & FW_HELLO_CMD_ERR)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)
2133 *state = DEV_STATE_ERR;2413 *state = DEV_STATE_ERR;
2414 else if (v & FW_HELLO_CMD_INIT)
2415 *state = DEV_STATE_INIT;
2134 else2416 else
2135 *state = DEV_STATE_UNINIT;2417 *state = DEV_STATE_UNINIT;
2136 }2418 }
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;
2138}2489}
2139 2490
2140/**2491/**
@@ -2185,6 +2536,334 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset) · 44 unmodified lines
2185 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);2536 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
2186}2537}
2187 2538
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 */
2555int 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 */
2620int 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 */
2683int 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 */
2736int 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 */
2791int 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 */
2858int 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
2188/**2867/**
2189 * t4_query_params - query FW or device parameters2868 * t4_query_params - query FW or device parameters
2190 * @adap: the adapter2869 * @adap: the adapter
@@ -2835,10 +3514,6 @@ int __devinit t4_prep_adapter(struct adapter *adapter) · 644 unmodified lines
2835 return ret;3514 return ret;
2836 }3515 }
2837 3516
2838 ret = get_vpd_params(adapter, &adapter->params.vpd);
2839 if (ret < 0)
2840 return ret;
2841
2842 init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd);3517 init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd);
2843 3518
2844 /*3519 /*
@@ -2846,6 +3521,7 @@ int __devinit t4_prep_adapter(struct adapter *adapter) · 1 unmodified line
2846 */3521 */
2847 adapter->params.nports = 1;3522 adapter->params.nports = 1;
2848 adapter->params.portvec = 1;3523 adapter->params.portvec = 1;
3524 adapter->params.vpd.cclk = 50000;
2849 return 0;3525 return 0;
2850}3526}
2851 3527
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h+80−0
@@ -58,6 +58,7 @@ enum { · 57 unmodified lines
58 58
59enum {59enum {
60 SF_PAGE_SIZE = 256, /* serial flash page size */60 SF_PAGE_SIZE = 256, /* serial flash page size */
61 SF_SEC_SIZE = 64 * 1024, /* serial flash sector size */
61};62};
62 63
63enum { RSP_TYPE_FLBUF, RSP_TYPE_CPL, RSP_TYPE_INTR }; /* response entry types */64enum { RSP_TYPE_FLBUF, RSP_TYPE_CPL, RSP_TYPE_INTR }; /* response entry types */
@@ -137,4 +138,83 @@ struct rsp_ctrl { · 73 unmodified lines
137#define QINTR_CNT_EN 0x1138#define QINTR_CNT_EN 0x1
138#define QINTR_TIMER_IDX(x) ((x) << 1)139#define QINTR_TIMER_IDX(x) ((x) << 1)
139#define QINTR_TIMER_IDX_GET(x) (((x) >> 1) & 0x7)140#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
148enum {
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
140#endif /* __T4_HW_H */220#endif /* __T4_HW_H */
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h+141−44
@@ -86,10 +86,17 @@ · 85 unmodified lines
86#define CIDXINC_SHIFT 086#define CIDXINC_SHIFT 0
87#define CIDXINC(x) ((x) << CIDXINC_SHIFT)87#define CIDXINC(x) ((x) << CIDXINC_SHIFT)
88 88
89#define X_RXPKTCPLMODE_SPLIT 1
90#define X_INGPADBOUNDARY_SHIFT 5
91
89#define SGE_CONTROL 0x100892#define SGE_CONTROL 0x1008
90#define DCASYSTYPE 0x00080000U93#define DCASYSTYPE 0x00080000U
91#define RXPKTCPLMODE 0x00040000U94#define RXPKTCPLMODE_MASK 0x00040000U
92#define EGRSTATUSPAGESIZE 0x00020000U95#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)
93#define PKTSHIFT_MASK 0x00001c00U100#define PKTSHIFT_MASK 0x00001c00U
94#define PKTSHIFT_SHIFT 10101#define PKTSHIFT_SHIFT 10
95#define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT)102#define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT)
@@ -108,6 +115,35 @@ · 12 unmodified lines
108#define GLOBALENABLE 0x00000001U115#define GLOBALENABLE 0x00000001U
109 116
110#define SGE_HOST_PAGE_SIZE 0x100c117#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
111#define HOSTPAGESIZEPF0_MASK 0x0000000fU147#define HOSTPAGESIZEPF0_MASK 0x0000000fU
112#define HOSTPAGESIZEPF0_SHIFT 0148#define HOSTPAGESIZEPF0_SHIFT 0
113#define HOSTPAGESIZEPF0(x) ((x) << HOSTPAGESIZEPF0_SHIFT)149#define HOSTPAGESIZEPF0(x) ((x) << HOSTPAGESIZEPF0_SHIFT)
@@ -155,6 +191,8 @@ · 41 unmodified lines
155#define SGE_INT_ENABLE3 0x1040191#define SGE_INT_ENABLE3 0x1040
156#define SGE_FL_BUFFER_SIZE0 0x1044192#define SGE_FL_BUFFER_SIZE0 0x1044
157#define SGE_FL_BUFFER_SIZE1 0x1048193#define SGE_FL_BUFFER_SIZE1 0x1048
194#define SGE_FL_BUFFER_SIZE2 0x104c
195#define SGE_FL_BUFFER_SIZE3 0x1050
158#define SGE_INGRESS_RX_THRESHOLD 0x10a0196#define SGE_INGRESS_RX_THRESHOLD 0x10a0
159#define THRESHOLD_0_MASK 0x3f000000U197#define THRESHOLD_0_MASK 0x3f000000U
160#define THRESHOLD_0_SHIFT 24198#define THRESHOLD_0_SHIFT 24
@@ -173,6 +211,12 @@ · 12 unmodified lines
173#define THRESHOLD_3(x) ((x) << THRESHOLD_3_SHIFT)211#define THRESHOLD_3(x) ((x) << THRESHOLD_3_SHIFT)
174#define THRESHOLD_3_GET(x) (((x) & THRESHOLD_3_MASK) >> THRESHOLD_3_SHIFT)212#define THRESHOLD_3_GET(x) (((x) & THRESHOLD_3_MASK) >> THRESHOLD_3_SHIFT)
175 213
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
176#define SGE_TIMER_VALUE_0_AND_1 0x10b8220#define SGE_TIMER_VALUE_0_AND_1 0x10b8
177#define TIMERVALUE0_MASK 0xffff0000U221#define TIMERVALUE0_MASK 0xffff0000U
178#define TIMERVALUE0_SHIFT 16222#define TIMERVALUE0_SHIFT 16
@@ -184,64 +228,54 @@ · 5 unmodified lines
184#define TIMERVALUE1_GET(x) (((x) & TIMERVALUE1_MASK) >> TIMERVALUE1_SHIFT)228#define TIMERVALUE1_GET(x) (((x) & TIMERVALUE1_MASK) >> TIMERVALUE1_SHIFT)
185 229
186#define SGE_TIMER_VALUE_2_AND_3 0x10bc230#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
187#define SGE_TIMER_VALUE_4_AND_5 0x10c0240#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
188#define SGE_DEBUG_INDEX 0x10cc250#define SGE_DEBUG_INDEX 0x10cc
189#define SGE_DEBUG_DATA_HIGH 0x10d0251#define SGE_DEBUG_DATA_HIGH 0x10d0
190#define SGE_DEBUG_DATA_LOW 0x10d4252#define SGE_DEBUG_DATA_LOW 0x10d4
191#define SGE_INGRESS_QUEUES_PER_PAGE_PF 0x10f4253#define SGE_INGRESS_QUEUES_PER_PAGE_PF 0x10f4
192 254
193#define S_LP_INT_THRESH 12
194#define V_LP_INT_THRESH(x) ((x) << S_LP_INT_THRESH)
195#define S_HP_INT_THRESH 28255#define S_HP_INT_THRESH 28
256#define M_HP_INT_THRESH 0xfU
196#define V_HP_INT_THRESH(x) ((x) << S_HP_INT_THRESH)257#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)
197#define A_SGE_DBFIFO_STATUS 0x10a4267#define A_SGE_DBFIFO_STATUS 0x10a4
198 268
199#define S_ENABLE_DROP 13269#define S_ENABLE_DROP 13
200#define V_ENABLE_DROP(x) ((x) << S_ENABLE_DROP)270#define V_ENABLE_DROP(x) ((x) << S_ENABLE_DROP)
201#define F_ENABLE_DROP V_ENABLE_DROP(1U)271#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
233#define S_DROPPED_DB 0272#define S_DROPPED_DB 0
234#define V_DROPPED_DB(x) ((x) << S_DROPPED_DB)273#define V_DROPPED_DB(x) ((x) << S_DROPPED_DB)
235#define F_DROPPED_DB V_DROPPED_DB(1U)274#define F_DROPPED_DB V_DROPPED_DB(1U)
275#define A_SGE_DOORBELL_CONTROL 0x10a8
236 276
237#define S_ERR_DROPPED_DB 18277#define A_SGE_CTXT_CMD 0x11fc
238#define V_ERR_DROPPED_DB(x) ((x) << S_ERR_DROPPED_DB)278#define A_SGE_DBQ_CTXT_BADDR 0x1084
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
245 279
246#define PCIE_PF_CLI 0x44280#define PCIE_PF_CLI 0x44
247#define PCIE_INT_CAUSE 0x3004281#define PCIE_INT_CAUSE 0x3004
@@ -287,6 +321,8 @@ · 39 unmodified lines
287#define WINDOW(x) ((x) << WINDOW_SHIFT)321#define WINDOW(x) ((x) << WINDOW_SHIFT)
288#define PCIE_MEM_ACCESS_OFFSET 0x306c322#define PCIE_MEM_ACCESS_OFFSET 0x306c
289 323
324#define PCIE_FW 0x30b8
325
290#define PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS 0x5908326#define PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS 0x5908
291#define RNPP 0x80000000U327#define RNPP 0x80000000U
292#define RPCP 0x20000000U328#define RPCP 0x20000000U
@@ -364,7 +400,7 @@ · 71 unmodified lines
364#define MEM_WRAP_CLIENT_NUM_MASK 0x0000000fU400#define MEM_WRAP_CLIENT_NUM_MASK 0x0000000fU
365#define MEM_WRAP_CLIENT_NUM_SHIFT 0401#define MEM_WRAP_CLIENT_NUM_SHIFT 0
366#define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT)402#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
368#define MA_PARITY_ERROR_STATUS 0x77f4404#define MA_PARITY_ERROR_STATUS 0x77f4
369 405
370#define EDC_0_BASE_ADDR 0x7900406#define EDC_0_BASE_ADDR 0x7900
@@ -385,6 +421,7 @@ · 14 unmodified lines
385 421
386#define CIM_BOOT_CFG 0x7b00422#define CIM_BOOT_CFG 0x7b00
387#define BOOTADDR_MASK 0xffffff00U423#define BOOTADDR_MASK 0xffffff00U
424#define UPCRST 0x1U
388 425
389#define CIM_PF_MAILBOX_DATA 0x240426#define CIM_PF_MAILBOX_DATA 0x240
390#define CIM_PF_MAILBOX_CTRL 0x280427#define CIM_PF_MAILBOX_CTRL 0x280
@@ -457,6 +494,13 @@ · 66 unmodified lines
457#define VLANEXTENABLE_MASK 0x0000f000U494#define VLANEXTENABLE_MASK 0x0000f000U
458#define VLANEXTENABLE_SHIFT 12495#define VLANEXTENABLE_SHIFT 12
459 496
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
460#define TP_PARA_REG2 0x7d68504#define TP_PARA_REG2 0x7d68
461#define MAXRXDATA_MASK 0xffff0000U505#define MAXRXDATA_MASK 0xffff0000U
462#define MAXRXDATA_SHIFT 16506#define MAXRXDATA_SHIFT 16
@@ -466,8 +510,47 @@ · 3 unmodified lines
466#define TIMERRESOLUTION_MASK 0x00ff0000U510#define TIMERRESOLUTION_MASK 0x00ff0000U
467#define TIMERRESOLUTION_SHIFT 16511#define TIMERRESOLUTION_SHIFT 16
468#define TIMERRESOLUTION_GET(x) (((x) & TIMERRESOLUTION_MASK) >> TIMERRESOLUTION_SHIFT)512#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)
469 517
470#define TP_SHIFT_CNT 0x7dc0518#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)
471 554
472#define TP_CCTRL_TABLE 0x7ddc555#define TP_CCTRL_TABLE 0x7ddc
473#define TP_MTU_TABLE 0x7de4556#define TP_MTU_TABLE 0x7de4
@@ -501,6 +584,20 @@ · 27 unmodified lines
501#define TP_INT_CAUSE 0x7e74584#define TP_INT_CAUSE 0x7e74
502#define FLMTXFLSTEMPTY 0x40000000U585#define FLMTXFLSTEMPTY 0x40000000U
503 586
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
504#define TP_INGRESS_CONFIG 0x141601#define TP_INGRESS_CONFIG 0x141
505#define VNIC 0x00000800U602#define VNIC 0x00000800U
506#define CSUM_HAS_PSEUDO_HDR 0x00000400U603#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
79#define FW_WR_FLOWID(x) ((x) << 8)79#define FW_WR_FLOWID(x) ((x) << 8)
80#define FW_WR_LEN16(x) ((x) << 0)80#define FW_WR_LEN16(x) ((x) << 0)
81 81
82#define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
83
82struct fw_ulptx_wr {84struct fw_ulptx_wr {
83 __be32 op_to_compl;85 __be32 op_to_compl;
84 __be32 flowid_len16;86 __be32 flowid_len16;
@@ -155,6 +157,17 @@ struct fw_eth_tx_pkt_vm_wr { · 70 unmodified lines
155 157
156#define FW_CMD_MAX_TIMEOUT 3000158#define FW_CMD_MAX_TIMEOUT 3000
157 159
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
158enum fw_cmd_opcodes {171enum fw_cmd_opcodes {
159 FW_LDST_CMD = 0x01,172 FW_LDST_CMD = 0x01,
160 FW_RESET_CMD = 0x03,173 FW_RESET_CMD = 0x03,
@@ -304,7 +317,17 @@ struct fw_reset_cmd { · 143 unmodified lines
304 __be32 op_to_write;317 __be32 op_to_write;
305 __be32 retval_len16;318 __be32 retval_len16;
306 __be32 val;319 __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
329enum fw_hellow_cmd {
330 fw_hello_cmd_stage_os = 0x0
308};331};
309 332
310struct fw_hello_cmd {333struct fw_hello_cmd {
@@ -315,8 +338,14 @@ struct fw_hello_cmd { · 4 unmodified lines
315#define FW_HELLO_CMD_INIT (1U << 30)338#define FW_HELLO_CMD_INIT (1U << 30)
316#define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)339#define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
317#define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)340#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)
319#define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)346#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)
320 __be32 fwrev;349 __be32 fwrev;
321};350};
322 351
@@ -401,6 +430,14 @@ enum fw_caps_config_fcoe { · 78 unmodified lines
401 FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,430 FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
402};431};
403 432
433enum 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
404struct fw_caps_config_cmd {441struct fw_caps_config_cmd {
405 __be32 op_to_write;442 __be32 op_to_write;
406 __be32 retval_len16;443 __be32 retval_len16;
@@ -416,10 +453,15 @@ struct fw_caps_config_cmd { · 9 unmodified lines
416 __be16 r4;453 __be16 r4;
417 __be16 iscsicaps;454 __be16 iscsicaps;
418 __be16 fcoecaps;455 __be16 fcoecaps;
419 __be32 r5;456 __be32 cfcsum;
420 __be64 r6;457 __be32 finiver;
458 __be32 finicsum;
421};459};
422 460
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
423/*465/*
424 * params command mnemonics466 * params command mnemonics
425 */467 */
@@ -451,6 +493,7 @@ enum fw_params_param_dev { · 25 unmodified lines
451 FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,493 FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
452 FW_PARAMS_PARAM_DEV_FWREV = 0x0B,494 FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
453 FW_PARAMS_PARAM_DEV_TPREV = 0x0C,495 FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
496 FW_PARAMS_PARAM_DEV_CF = 0x0D,
454};497};
455 498
456/*499/*
@@ -492,6 +535,8 @@ enum fw_params_param_pfvf { · 35 unmodified lines
492 FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,535 FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
493 FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,536 FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
494 FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,537 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
495};540};
496 541
497/*542/*
@@ -507,8 +552,16 @@ enum fw_params_param_dmaq { · 9 unmodified lines
507 552
508#define FW_PARAMS_MNEM(x) ((x) << 24)553#define FW_PARAMS_MNEM(x) ((x) << 24)
509#define FW_PARAMS_PARAM_X(x) ((x) << 16)554#define FW_PARAMS_PARAM_X(x) ((x) << 16)
510#define FW_PARAMS_PARAM_Y(x) ((x) << 8)555#define FW_PARAMS_PARAM_Y_SHIFT 8
511#define FW_PARAMS_PARAM_Z(x) ((x) << 0)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)
512#define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)565#define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
513#define FW_PARAMS_PARAM_YZ(x) ((x) << 0)566#define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
514 567
@@ -1599,6 +1652,16 @@ struct fw_debug_cmd { · 1084 unmodified lines
1599 } u;1652 } u;
1600};1653};
1601 1654
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
1602struct fw_hdr {1665struct fw_hdr {
1603 u8 ver;1666 u8 ver;
1604 u8 reserved1;1667 u8 reserved1;
@@ -1613,7 +1676,11 @@ struct fw_hdr { · 8 unmodified lines
1613 u8 intfver_iscsi;1676 u8 intfver_iscsi;
1614 u8 intfver_fcoe;1677 u8 intfver_fcoe;
1615 u8 reserved2;1678 u8 reserved2;
1616 __be32 reserved3[27];1679 __u32 reserved3;
1680 __u32 reserved4;
1681 __u32 reserved5;
1682 __be32 flags;
1683 __be32 reserved6[23];
1617};1684};
1618 1685
1619#define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)1686#define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
@@ -1621,18 +1688,8 @@ struct fw_hdr { · 1 unmodified line
1621#define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)1688#define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
1622#define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)1689#define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
1623 1690
1624#define S_FW_CMD_OP 241691enum fw_hdr_flags {
1625#define V_FW_CMD_OP(x) ((x) << S_FW_CMD_OP)1692 FW_HDR_FLAGS_RESET_HALT = 0x00000001,
1626 1693};
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)
1637 1694
1638#endif /* _T4FW_INTERFACE_H_ */1695#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
2421 fl0, fl1);2421 fl0, fl1);
2422 return -EINVAL;2422 return -EINVAL;
2423 }2423 }
2424 if ((sge_params->sge_control & RXPKTCPLMODE) == 0) {2424 if ((sge_params->sge_control & RXPKTCPLMODE_MASK) == 0) {
2425 dev_err(adapter->pdev_dev, "bad SGE CPL MODE\n");2425 dev_err(adapter->pdev_dev, "bad SGE CPL MODE\n");
2426 return -EINVAL;2426 return -EINVAL;
2427 }2427 }
@@ -2431,7 +2431,8 @@ int t4vf_sge_init(struct adapter *adapter) · 3 unmodified lines
2431 */2431 */
2432 if (fl1)2432 if (fl1)
2433 FL_PG_ORDER = ilog2(fl1) - PAGE_SHIFT;2433 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);
2435 PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control);2436 PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control);
2436 FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) +2437 FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) +
2437 SGE_INGPADBOUNDARY_SHIFT);2438 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
110#define MAX_RX_POST BE_NAPI_WEIGHT /* Frags posted at a time */110#define MAX_RX_POST BE_NAPI_WEIGHT /* Frags posted at a time */
111#define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST)111#define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST)
112 112
113#define MAX_VFS 30 /* Max VFs supported by BE3 FW */
113#define FW_VER_LEN 32114#define FW_VER_LEN 32
114 115
115struct be_dma_mem {116struct be_dma_mem {
@@ -336,7 +337,6 @@ struct phy_info { · 220 unmodified lines
336 u16 auto_speeds_supported;337 u16 auto_speeds_supported;
337 u16 fixed_speeds_supported;338 u16 fixed_speeds_supported;
338 int link_speed;339 int link_speed;
339 int forced_port_speed;
340 u32 dac_cable_len;340 u32 dac_cable_len;
341 u32 advertising;341 u32 advertising;
342 u32 supported;342 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
120 120
121 if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) {121 if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) {
122 dev_warn(&adapter->pdev->dev,122 dev_warn(&adapter->pdev->dev,
123 "opcode %d-%d is not permitted\n",123 "VF is not privileged to issue opcode %d-%d\n",
124 opcode, subsystem);124 opcode, subsystem);
125 } else {125 } else {
126 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &126 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
165 }165 }
166}166}
167 167
168/* Grp5 QOS Speed evt */168/* Grp5 QOS Speed evt: qos_link_speed is in units of 10 Mbps */
169static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,169static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
170 struct be_async_event_grp5_qos_link_speed *evt)170 struct be_async_event_grp5_qos_link_speed *evt)
171{171{
172 if (evt->physical_port == adapter->port_num) {172 if (adapter->phy.link_speed >= 0 &&
173 /* qos_link_speed is in units of 10 Mbps */173 evt->physical_port == adapter->port_num)
174 adapter->phy.link_speed = evt->qos_link_speed * 10;174 adapter->phy.link_speed = le16_to_cpu(evt->qos_link_speed) * 10;
175 }
176}175}
177 176
178/*Grp5 PVID evt*/177/*Grp5 PVID evt*/
@@ -717,7 +716,7 @@ int be_cmd_eq_create(struct be_adapter *adapter, · 538 unmodified lines
717 716
718/* Use MCC */717/* Use MCC */
719int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,718int 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)
721{720{
722 struct be_mcc_wrb *wrb;721 struct be_mcc_wrb *wrb;
723 struct be_cmd_req_mac_query *req;722 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
734 733
735 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,734 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
736 OPCODE_COMMON_NTWK_MAC_QUERY, sizeof(*req), wrb, NULL);735 OPCODE_COMMON_NTWK_MAC_QUERY, sizeof(*req), wrb, NULL);
737 req->type = type;736 req->type = MAC_ADDRESS_TYPE_NETWORK;
738 if (permanent) {737 if (permanent) {
739 req->permanent = 1;738 req->permanent = 1;
740 } else {739 } else {
@@ -1326,9 +1325,28 @@ err: · 585 unmodified lines
1326 return status;1325 return status;
1327}1326}
1328 1327
1329/* Uses synchronous mcc */1328static int be_mac_to_link_speed(int mac_speed)
1330int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,1329{
1331 u16 *link_speed, u8 *link_status, u32 dom)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 */
1348int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
1349 u8 *link_status, u32 dom)
1332{1350{
1333 struct be_mcc_wrb *wrb;1351 struct be_mcc_wrb *wrb;
1334 struct be_cmd_req_link_status *req;1352 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
1357 status = be_mcc_notify_wait(adapter);1375 status = be_mcc_notify_wait(adapter);
1358 if (!status) {1376 if (!status) {
1359 struct be_cmd_resp_link_status *resp = embedded_payload(wrb);1377 struct be_cmd_resp_link_status *resp = embedded_payload(wrb);
1360 if (resp->mac_speed != PHY_LINK_SPEED_ZERO) {1378 if (link_speed) {
1361 if (link_speed)1379 *link_speed = resp->link_speed ?
1362 *link_speed = le16_to_cpu(resp->link_speed);1380 le16_to_cpu(resp->link_speed) * 10 :
1363 if (mac_speed)1381 be_mac_to_link_speed(resp->mac_speed);
1364 *mac_speed = resp->mac_speed;1382
1383 if (!resp->logical_link_status)
1384 *link_speed = 0;
1365 }1385 }
1366 if (link_status)1386 if (link_status)
1367 *link_status = resp->logical_link_status;1387 *link_status = resp->logical_link_status;
@@ -2405,6 +2425,9 @@ int be_cmd_req_native_mode(struct be_adapter *adapter) · 1037 unmodified lines
2405 struct be_cmd_resp_set_func_cap *resp = embedded_payload(wrb);2425 struct be_cmd_resp_set_func_cap *resp = embedded_payload(wrb);
2406 adapter->be3_native = le32_to_cpu(resp->cap_flags) &2426 adapter->be3_native = le32_to_cpu(resp->cap_flags) &
2407 CAPABILITY_BE3_NATIVE_ERX_API;2427 CAPABILITY_BE3_NATIVE_ERX_API;
2428 if (!adapter->be3_native)
2429 dev_warn(&adapter->pdev->dev,
2430 "adapter not in advanced mode\n");
2408 }2431 }
2409err:2432err:
2410 mutex_unlock(&adapter->mbox_lock);2433 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
1687extern int be_pci_fnum_get(struct be_adapter *adapter);1687extern int be_pci_fnum_get(struct be_adapter *adapter);
1688extern int be_fw_wait_ready(struct be_adapter *adapter);1688extern int be_fw_wait_ready(struct be_adapter *adapter);
1689extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,1689extern 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);
1691extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,1691extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
1692 u32 if_id, u32 *pmac_id, u32 domain);1692 u32 if_id, u32 *pmac_id, u32 domain);
1693extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id,1693extern 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
1714 int type);1714 int type);
1715extern int be_cmd_rxq_destroy(struct be_adapter *adapter,1715extern int be_cmd_rxq_destroy(struct be_adapter *adapter,
1716 struct be_queue_info *q);1716 struct be_queue_info *q);
1717extern int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,1717extern int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
1718 u16 *link_speed, u8 *link_status, u32 dom);1718 u8 *link_status, u32 dom);
1719extern int be_cmd_reset(struct be_adapter *adapter);1719extern int be_cmd_reset(struct be_adapter *adapter);
1720extern int be_cmd_get_stats(struct be_adapter *adapter,1720extern int be_cmd_get_stats(struct be_adapter *adapter,
1721 struct be_dma_mem *nonemb_cmd);1721 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
512 return val;512 return val;
513}513}
514 514
515static 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
537bool be_pause_supported(struct be_adapter *adapter)515bool be_pause_supported(struct be_adapter *adapter)
538{516{
539 return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB ||517 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
544static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)522static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
545{523{
546 struct be_adapter *adapter = netdev_priv(netdev);524 struct be_adapter *adapter = netdev_priv(netdev);
547 u8 port_speed = 0;
548 u16 link_speed = 0;
549 u8 link_status;525 u8 link_status;
550 u32 et_speed = 0;526 u16 link_speed = 0;
551 int status;527 int status;
552 528
553 if (adapter->phy.link_speed < 0 || !(netdev->flags & IFF_UP)) {529 if (adapter->phy.link_speed < 0) {
554 if (adapter->phy.forced_port_speed < 0) {530 status = be_cmd_link_status_query(adapter, &link_speed,
555 status = be_cmd_link_status_query(adapter, &port_speed,531 &link_status, 0);
556 &link_speed, &link_status, 0);532 if (!status)
557 if (!status)533 be_link_status_update(adapter, link_status);
558 be_link_status_update(adapter, link_status);534 ethtool_cmd_speed_set(ecmd, link_speed);
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);
568 535
569 status = be_cmd_get_phy_info(adapter);536 status = be_cmd_get_phy_info(adapter);
570 if (status)537 if (status)
@@ -773,8 +740,8 @@ static void · 202 unmodified lines
773be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)740be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
774{741{
775 struct be_adapter *adapter = netdev_priv(netdev);742 struct be_adapter *adapter = netdev_priv(netdev);
776 u8 mac_speed = 0;743 int status;
777 u16 qos_link_speed = 0;744 u8 link_status = 0;
778 745
779 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);746 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
780 747
@@ -798,11 +765,11 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) · 17 unmodified lines
798 test->flags |= ETH_TEST_FL_FAILED;765 test->flags |= ETH_TEST_FL_FAILED;
799 }766 }
800 767
801 if (be_cmd_link_status_query(adapter, &mac_speed,768 status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
802 &qos_link_speed, NULL, 0) != 0) {769 if (status) {
803 test->flags |= ETH_TEST_FL_FAILED;770 test->flags |= ETH_TEST_FL_FAILED;
804 data[4] = -1;771 data[4] = -1;
805 } else if (!mac_speed) {772 } else if (!link_status) {
806 test->flags |= ETH_TEST_FL_FAILED;773 test->flags |= ETH_TEST_FL_FAILED;
807 data[4] = 1;774 data[4] = 1;
808 }775 }
drivers/net/ethernet/emulex/benet/be_main.c+58−38
@@ -20,6 +20,7 @@ · 19 unmodified lines
20#include "be.h"20#include "be.h"
21#include "be_cmds.h"21#include "be_cmds.h"
22#include <asm/div64.h>22#include <asm/div64.h>
23#include <linux/aer.h>
23 24
24MODULE_VERSION(DRV_VER);25MODULE_VERSION(DRV_VER);
25MODULE_DEVICE_TABLE(pci, be_dev_ids);26MODULE_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
240 if (!is_valid_ether_addr(addr->sa_data))241 if (!is_valid_ether_addr(addr->sa_data))
241 return -EADDRNOTAVAIL;242 return -EADDRNOTAVAIL;
242 243
243 status = be_cmd_mac_addr_query(adapter, current_mac,244 status = be_cmd_mac_addr_query(adapter, current_mac, false,
244 MAC_ADDRESS_TYPE_NETWORK, false,245 adapter->if_handle, 0);
245 adapter->if_handle, 0);
246 if (status)246 if (status)
247 goto err;247 goto err;
248 248
@@ -1075,7 +1075,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, · 826 unmodified lines
1075static int be_find_vfs(struct be_adapter *adapter, int vf_state)1075static int be_find_vfs(struct be_adapter *adapter, int vf_state)
1076{1076{
1077 struct pci_dev *dev, *pdev = adapter->pdev;1077 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;
1079 u16 offset, stride;1079 u16 offset, stride;
1080 1080
1081 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);1081 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
1086 1086
1087 dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);1087 dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);
1088 while (dev) {1088 while (dev) {
1089 vf_fn = (pdev->devfn + offset + stride * vfs) & 0xFFFF;1089 if (dev->is_virtfn && pci_physfn(dev) == pdev) {
1090 if (dev->is_virtfn && dev->devfn == vf_fn &&
1091 dev->bus->number == pdev->bus->number) {
1092 vfs++;1090 vfs++;
1093 if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)1091 if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
1094 assigned_vfs++;1092 assigned_vfs++;
@@ -1896,6 +1894,8 @@ static int be_tx_qs_create(struct be_adapter *adapter) · 801 unmodified lines
1896 return status;1894 return status;
1897 }1895 }
1898 1896
1897 dev_info(&adapter->pdev->dev, "created %d TX queue(s)\n",
1898 adapter->num_tx_qs);
1899 return 0;1899 return 0;
1900}1900}
1901 1901
@@ -1946,10 +1946,9 @@ static int be_rx_cqs_create(struct be_adapter *adapter) · 44 unmodified lines
1946 return rc;1946 return rc;
1947 }1947 }
1948 1948
1949 if (adapter->num_rx_qs != MAX_RX_QS)1949 dev_info(&adapter->pdev->dev,
1950 dev_info(&adapter->pdev->dev,1950 "created %d RSS queue(s) and 1 default RX queue\n",
1951 "Created only %d receive queues\n", adapter->num_rx_qs);1951 adapter->num_rx_qs - 1);
1952
1953 return 0;1952 return 0;
1954}1953}
1955 1954
@@ -2176,8 +2175,7 @@ static uint be_num_rss_want(struct be_adapter *adapter) · 220 unmodified lines
2176{2175{
2177 u32 num = 0;2176 u32 num = 0;
2178 if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) &&2177 if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) &&
2179 !sriov_want(adapter) && be_physfn(adapter) &&2178 !sriov_want(adapter) && be_physfn(adapter)) {
2180 !be_is_mc(adapter)) {
2181 num = (adapter->be3_native) ? BE3_MAX_RSS_QS : BE2_MAX_RSS_QS;2179 num = (adapter->be3_native) ? BE3_MAX_RSS_QS : BE2_MAX_RSS_QS;
2182 num = min_t(u32, num, (u32)netif_get_num_default_rss_queues());2180 num = min_t(u32, num, (u32)netif_get_num_default_rss_queues());
2183 }2181 }
@@ -2188,6 +2186,7 @@ static void be_msix_enable(struct be_adapter *adapter) · 4 unmodified lines
2188{2186{
2189#define BE_MIN_MSIX_VECTORS 12187#define BE_MIN_MSIX_VECTORS 1
2190 int i, status, num_vec, num_roce_vec = 0;2188 int i, status, num_vec, num_roce_vec = 0;
2189 struct device *dev = &adapter->pdev->dev;
2191 2190
2192 /* If RSS queues are not used, need a vec for default RX Q */2191 /* If RSS queues are not used, need a vec for default RX Q */
2193 num_vec = min(be_num_rss_want(adapter), num_online_cpus());2192 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
2212 num_vec) == 0)2211 num_vec) == 0)
2213 goto done;2212 goto done;
2214 }2213 }
2214
2215 dev_warn(dev, "MSIx enable failed\n");
2215 return;2216 return;
2216done:2217done:
2217 if (be_roce_supported(adapter)) {2218 if (be_roce_supported(adapter)) {
@@ -2225,6 +2226,7 @@ done: · 7 unmodified lines
2225 }2226 }
2226 } else2227 } else
2227 adapter->num_msix_vec = num_vec;2228 adapter->num_msix_vec = num_vec;
2229 dev_info(dev, "enabled %d MSI-x vector(s)\n", adapter->num_msix_vec);
2228 return;2230 return;
2229}2231}
2230 2232
@@ -2441,8 +2443,7 @@ static int be_open(struct net_device *netdev) · 210 unmodified lines
2441 be_eq_notify(adapter, eqo->q.id, true, false, 0);2443 be_eq_notify(adapter, eqo->q.id, true, false, 0);
2442 }2444 }
2443 2445
2444 status = be_cmd_link_status_query(adapter, NULL, NULL,2446 status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
2445 &link_status, 0);
2446 if (!status)2447 if (!status)
2447 be_link_status_update(adapter, link_status);2448 be_link_status_update(adapter, link_status);
2448 2449
@@ -2646,8 +2647,8 @@ static int be_vf_setup(struct be_adapter *adapter) · 197 unmodified lines
2646 }2647 }
2647 2648
2648 for_all_vfs(adapter, vf_cfg, vf) {2649 for_all_vfs(adapter, vf_cfg, vf) {
2649 status = be_cmd_link_status_query(adapter, NULL, &lnk_speed,2650 lnk_speed = 1000;
2650 NULL, vf + 1);2651 status = be_cmd_set_qos(adapter, lnk_speed, vf + 1);
2651 if (status)2652 if (status)
2652 goto err;2653 goto err;
2653 vf_cfg->tx_rate = lnk_speed * 10;2654 vf_cfg->tx_rate = lnk_speed * 10;
@@ -2671,7 +2672,6 @@ static void be_setup_init(struct be_adapter *adapter) · 17 unmodified lines
2671 adapter->be3_native = false;2672 adapter->be3_native = false;
2672 adapter->promiscuous = false;2673 adapter->promiscuous = false;
2673 adapter->eq_next_idx = 0;2674 adapter->eq_next_idx = 0;
2674 adapter->phy.forced_port_speed = -1;
2675}2675}
2676 2676
2677static int be_get_mac_addr(struct be_adapter *adapter, u8 *mac, u32 if_handle,2677static 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
2693 status = be_cmd_get_mac_from_list(adapter, mac,2693 status = be_cmd_get_mac_from_list(adapter, mac,
2694 active_mac, pmac_id, 0);2694 active_mac, pmac_id, 0);
2695 if (*active_mac) {2695 if (*active_mac) {
2696 status = be_cmd_mac_addr_query(adapter, mac,2696 status = be_cmd_mac_addr_query(adapter, mac, false,
2697 MAC_ADDRESS_TYPE_NETWORK,2697 if_handle, *pmac_id);
2698 false, if_handle,
2699 *pmac_id);
2700 }2698 }
2701 } else if (be_physfn(adapter)) {2699 } else if (be_physfn(adapter)) {
2702 /* For BE3, for PF get permanent MAC */2700 /* For BE3, for PF get permanent MAC */
2703 status = be_cmd_mac_addr_query(adapter, mac,2701 status = be_cmd_mac_addr_query(adapter, mac, true, 0, 0);
2704 MAC_ADDRESS_TYPE_NETWORK, true,
2705 0, 0);
2706 *active_mac = false;2702 *active_mac = false;
2707 } else {2703 } else {
2708 /* For BE3, for VF get soft MAC assigned by PF*/2704 /* For BE3, for VF get soft MAC assigned by PF*/
2709 status = be_cmd_mac_addr_query(adapter, mac,2705 status = be_cmd_mac_addr_query(adapter, mac, false,
2710 MAC_ADDRESS_TYPE_NETWORK, false,
2711 if_handle, 0);2706 if_handle, 0);
2712 *active_mac = true;2707 *active_mac = true;
2713 }2708 }
@@ -2724,6 +2719,8 @@ static int be_get_config(struct be_adapter *adapter) · 10 unmodified lines
2724 if (pos) {2719 if (pos) {
2725 pci_read_config_word(adapter->pdev, pos + PCI_SRIOV_TOTAL_VF,2720 pci_read_config_word(adapter->pdev, pos + PCI_SRIOV_TOTAL_VF,
2726 &dev_num_vfs);2721 &dev_num_vfs);
2722 if (!lancer_chip(adapter))
2723 dev_num_vfs = min_t(u16, dev_num_vfs, MAX_VFS);
2727 adapter->dev_num_vfs = dev_num_vfs;2724 adapter->dev_num_vfs = dev_num_vfs;
2728 }2725 }
2729 return 0;2726 return 0;
@@ -3437,6 +3434,7 @@ static void be_ctrl_cleanup(struct be_adapter *adapter) · 707 unmodified lines
3437 if (mem->va)3434 if (mem->va)
3438 dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,3435 dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
3439 mem->dma);3436 mem->dma);
3437 kfree(adapter->pmac_id);
3440}3438}
3441 3439
3442static int be_ctrl_init(struct be_adapter *adapter)3440static int be_ctrl_init(struct be_adapter *adapter)
@@ -3473,6 +3471,12 @@ static int be_ctrl_init(struct be_adapter *adapter) · 30 unmodified lines
3473 }3471 }
3474 memset(rx_filter->va, 0, rx_filter->size);3472 memset(rx_filter->va, 0, rx_filter->size);
3475 3473
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
3476 mutex_init(&adapter->mbox_lock);3480 mutex_init(&adapter->mbox_lock);
3477 spin_lock_init(&adapter->mcc_lock);3481 spin_lock_init(&adapter->mcc_lock);
3478 spin_lock_init(&adapter->mcc_cq_lock);3482 spin_lock_init(&adapter->mcc_cq_lock);
@@ -3543,6 +3547,8 @@ static void __devexit be_remove(struct pci_dev *pdev) · 64 unmodified lines
3543 3547
3544 be_ctrl_cleanup(adapter);3548 be_ctrl_cleanup(adapter);
3545 3549
3550 pci_disable_pcie_error_reporting(pdev);
3551
3546 pci_set_drvdata(pdev, NULL);3552 pci_set_drvdata(pdev, NULL);
3547 pci_release_regions(pdev);3553 pci_release_regions(pdev);
3548 pci_disable_device(pdev);3554 pci_disable_device(pdev);
@@ -3609,12 +3615,6 @@ static int be_get_initial_config(struct be_adapter *adapter) · 60 unmodified lines
3609 else3615 else
3610 adapter->max_pmac_cnt = BE_VF_UC_PMAC_COUNT;3616 adapter->max_pmac_cnt = BE_VF_UC_PMAC_COUNT;
3611 3617
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
3618 status = be_cmd_get_cntl_attributes(adapter);3618 status = be_cmd_get_cntl_attributes(adapter);
3619 if (status)3619 if (status)
3620 return status;3620 return status;
@@ -3800,6 +3800,23 @@ static bool be_reset_required(struct be_adapter *adapter) · 179 unmodified lines
3800 return be_find_vfs(adapter, ENABLED) > 0 ? false : true;3800 return be_find_vfs(adapter, ENABLED) > 0 ? false : true;
3801}3801}
3802 3802
3803static 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
3815static inline char *func_name(struct be_adapter *adapter)
3816{
3817 return be_physfn(adapter) ? "PF" : "VF";
3818}
3819
3803static int __devinit be_probe(struct pci_dev *pdev,3820static int __devinit be_probe(struct pci_dev *pdev,
3804 const struct pci_device_id *pdev_id)3821 const struct pci_device_id *pdev_id)
3805{3822{
@@ -3844,6 +3861,10 @@ static int __devinit be_probe(struct pci_dev *pdev, · 38 unmodified lines
3844 }3861 }
3845 }3862 }
3846 3863
3864 status = pci_enable_pcie_error_reporting(pdev);
3865 if (status)
3866 dev_err(&pdev->dev, "Could not use PCIe error reporting\n");
3867
3847 status = be_ctrl_init(adapter);3868 status = be_ctrl_init(adapter);
3848 if (status)3869 if (status)
3849 goto free_netdev;3870 goto free_netdev;
@@ -3886,7 +3907,7 @@ static int __devinit be_probe(struct pci_dev *pdev, · 36 unmodified lines
3886 3907
3887 status = be_setup(adapter);3908 status = be_setup(adapter);
3888 if (status)3909 if (status)
3889 goto msix_disable;3910 goto stats_clean;
3890 3911
3891 be_netdev_init(netdev);3912 be_netdev_init(netdev);
3892 status = register_netdev(netdev);3913 status = register_netdev(netdev);
@@ -3900,15 +3921,13 @@ static int __devinit be_probe(struct pci_dev *pdev, · 7 unmodified lines
3900 3921
3901 be_cmd_query_port_name(adapter, &port_name);3922 be_cmd_query_port_name(adapter, &port_name);
3902 3923
3903 dev_info(&pdev->dev, "%s: %s port %c\n", netdev->name, nic_name(pdev),3924 dev_info(&pdev->dev, "%s: %s %s port %c\n", nic_name(pdev),
3904 port_name);3925 func_name(adapter), mc_name(adapter), port_name);
3905 3926
3906 return 0;3927 return 0;
3907 3928
3908unsetup:3929unsetup:
3909 be_clear(adapter);3930 be_clear(adapter);
3910msix_disable:
3911 be_msix_disable(adapter);
3912stats_clean:3931stats_clean:
3913 be_stats_cleanup(adapter);3932 be_stats_cleanup(adapter);
3914ctrl_clean:3933ctrl_clean:
@@ -4066,6 +4085,7 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) · 151 unmodified lines
4066 if (status)4085 if (status)
4067 return PCI_ERS_RESULT_DISCONNECT;4086 return PCI_ERS_RESULT_DISCONNECT;
4068 4087
4088 pci_cleanup_aer_uncorrect_error_status(pdev);
4069 return PCI_ERS_RESULT_RECOVERED;4089 return PCI_ERS_RESULT_RECOVERED;
4070}4090}
4071 4091
drivers/net/ethernet/freescale/Kconfig+7−0
@@ -62,6 +62,13 @@ config FSL_PQ_MDIO · 61 unmodified lines
62 ---help---62 ---help---
63 This driver supports the MDIO bus used by the gianfar and UCC drivers.63 This driver supports the MDIO bus used by the gianfar and UCC drivers.
64 64
65config 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
65config UCC_GETH72config UCC_GETH
66 tristate "Freescale QE Gigabit Ethernet"73 tristate "Freescale QE Gigabit Ethernet"
67 depends on QUICC_ENGINE74 depends on QUICC_ENGINE
drivers/net/ethernet/freescale/Makefile+1−0
@@ -9,6 +9,7 @@ ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y) · 8 unmodified lines
9endif9endif
10obj-$(CONFIG_FS_ENET) += fs_enet/10obj-$(CONFIG_FS_ENET) += fs_enet/
11obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o11obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
12obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
12obj-$(CONFIG_GIANFAR) += gianfar_driver.o13obj-$(CONFIG_GIANFAR) += gianfar_driver.o
13obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o14obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o
14gianfar_driver-objs := gianfar.o \15gianfar_driver-objs := gianfar.o \
drivers/net/ethernet/freescale/fsl_pq_mdio.c+292−257
@@ -19,54 +19,90 @@ · 18 unmodified lines
19#include <linux/kernel.h>19#include <linux/kernel.h>
20#include <linux/string.h>20#include <linux/string.h>
21#include <linux/errno.h>21#include <linux/errno.h>
22#include <linux/unistd.h>
23#include <linux/slab.h>22#include <linux/slab.h>
24#include <linux/interrupt.h>
25#include <linux/init.h>23#include <linux/init.h>
26#include <linux/delay.h>24#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>
32#include <linux/module.h>25#include <linux/module.h>
33#include <linux/platform_device.h>
34#include <linux/crc32.h>
35#include <linux/mii.h>26#include <linux/mii.h>
36#include <linux/phy.h>
37#include <linux/of.h>
38#include <linux/of_address.h>27#include <linux/of_address.h>
39#include <linux/of_mdio.h>28#include <linux/of_mdio.h>
40#include <linux/of_platform.h>29#include <linux/of_device.h>
41 30
42#include <asm/io.h>31#include <asm/io.h>
43#include <asm/irq.h>32#include <asm/ucc.h> /* for ucc_set_qe_mux_mii_mng() */
44#include <asm/uaccess.h>
45#include <asm/ucc.h>
46 33
47#include "gianfar.h"34#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
43struct 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
52struct 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;
49 64
50/* Number of microseconds to wait for an MII register to respond */65/* Number of microseconds to wait for an MII register to respond */
51#define MII_TIMEOUT 100066#define MII_TIMEOUT 1000
52 67
53struct fsl_pq_mdio_priv {68struct fsl_pq_mdio_priv {
54 void __iomem *map;69 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 */
86struct 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);
56};90};
57 91
58/*92/*
59 * Write value to the PHY at mii_id at register regnum,93 * Write value to the PHY at mii_id at register regnum, on the bus attached
60 * on the bus attached to the local interface, which may be different from the94 * to the local interface, which may be different from the generic mdio bus
61 * generic mdio bus (tied to a single interface), waiting until the write is95 * (tied to a single interface), waiting until the write is done before
62 * done before returning. This is helpful in programming interfaces like96 * returning. This is helpful in programming interfaces like the TBI which
63 * the TBI which control interfaces like onchip SERDES and are always tied to97 * control interfaces like onchip SERDES and are always tied to the local
64 * the local mdio pins, which may not be the same as system mdio bus, used for98 * mdio pins, which may not be the same as system mdio bus, used for
65 * controlling the external PHYs, for example.99 * controlling the external PHYs, for example.
66 */100 */
67int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,101static int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
68 int regnum, u16 value)102 u16 value)
69{103{
104 struct fsl_pq_mdio_priv *priv = bus->priv;
105 struct fsl_pq_mii __iomem *regs = priv->regs;
70 u32 status;106 u32 status;
71 107
72 /* Set the PHY address and the register address we want to write */108 /* 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
83}119}
84 120
85/*121/*
86 * Read the bus for PHY at addr mii_id, register regnum, and122 * Read the bus for PHY at addr mii_id, register regnum, and return the value.
87 * return the value. Clears miimcom first. All PHY operation123 * Clears miimcom first.
88 * done on the bus attached to the local interface,124 *
89 * which may be different from the generic mdio bus125 * All PHY operation done on the bus attached to the local interface, which
90 * This is helpful in programming interfaces like126 * may be different from the generic mdio bus. This is helpful in programming
91 * the TBI which, in turn, control interfaces like onchip SERDES127 * interfaces like the TBI which, in turn, control interfaces like on-chip
92 * and are always tied to the local mdio pins, which may not be the128 * SERDES and are always tied to the local mdio pins, which may not be the
93 * same as system mdio bus, used for controlling the external PHYs, for eg.129 * same as system mdio bus, used for controlling the external PHYs, for eg.
94 */130 */
95int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,131static int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
96 int mii_id, int regnum)
97{132{
98 u16 value;133 struct fsl_pq_mdio_priv *priv = bus->priv;
134 struct fsl_pq_mii __iomem *regs = priv->regs;
99 u32 status;135 u32 status;
136 u16 value;
100 137
101 /* Set the PHY address and the register address we want to read */138 /* Set the PHY address and the register address we want to read */
102 out_be32(&regs->miimadd, (mii_id << 8) | regnum);139 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
115 /* Grab the value of the register from miimstat */152 /* Grab the value of the register from miimstat */
116 value = in_be32(&regs->miimstat);153 value = in_be32(&regs->miimstat);
117 154
155 dev_dbg(&bus->dev, "read %04x from address %x/%x\n", value, mii_id, regnum);
118 return value;156 return value;
119}157}
120 158
121static 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 */
132int 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 */
144int 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
152/* Reset the MIIM registers, and wait for the bus to free */159/* Reset the MIIM registers, and wait for the bus to free */
153static int fsl_pq_mdio_reset(struct mii_bus *bus)160static int fsl_pq_mdio_reset(struct mii_bus *bus)
154{161{
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;
156 u32 status;164 u32 status;
157 165
158 mutex_lock(&bus->mdio_lock);166 mutex_lock(&bus->mdio_lock);
@@ -170,234 +178,291 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus) · 11 unmodified lines
170 mutex_unlock(&bus->mdio_lock);178 mutex_unlock(&bus->mdio_lock);
171 179
172 if (!status) {180 if (!status) {
173 printk(KERN_ERR "%s: The MII Bus is stuck!\n",181 dev_err(&bus->dev, "timeout waiting for MII bus\n");
174 bus->name);
175 return -EBUSY;182 return -EBUSY;
176 }183 }
177 184
178 return 0;185 return 0;
179}186}
180 187
181void 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 */
194static uint32_t __iomem *get_gfar_tbipa(void __iomem *p)
182{195{
183 const u32 *addr;196 struct gfar __iomem *enet_regs = p;
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);
189 197
190 snprintf(name, MII_BUS_ID_SIZE, "%s@%llx", np->name,198 return &enet_regs->tbipa;
191 (unsigned long long)taddr);
192}199}
193EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);
194 200
201/*
202 * Return the TBIPAR address for an eTSEC2 node
203 */
204static uint32_t __iomem *get_etsec_tbipa(void __iomem *p)
205{
206 return p;
207}
208#endif
195 209
196static 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 */
214static uint32_t __iomem *get_ucc_tbipa(void __iomem *p)
197{215{
198#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)216 struct fsl_pq_mdio __iomem *mdio = p;
199 struct gfar __iomem *enet_regs;
200 217
201 /*218 return &mdio->utbipar;
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;
217}219}
218 220
219 221/*
220static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)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 */
232static void ucc_configure(phys_addr_t start, phys_addr_t end)
221{233{
222#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)234 static bool found_mii_master;
223 struct device_node *np = NULL;235 struct device_node *np = NULL;
224 int err = 0;
225 236
226 for_each_compatible_node(np, NULL, "ucc_geth") {237 if (found_mii_master)
227 struct resource tempres;238 return;
228 239
229 err = of_address_to_resource(np, 0, &tempres);240 for_each_compatible_node(np, NULL, "ucc_geth") {
230 if (err)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);
231 continue;250 continue;
251 }
232 252
233 /* if our mdio regs fall within this UCC regs range */253 /* if our mdio regs fall within this UCC regs range */
234 if ((start >= tempres.start) && (end <= tempres.end)) {254 if ((start < res.start) || (end > res.end))
235 /* Find the id of the UCC */255 continue;
236 const u32 *id;256
237 257 iprop = of_get_property(np, "cell-index", NULL);
238 id = of_get_property(np, "cell-index", NULL);258 if (!iprop) {
239 if (!id) {259 iprop = of_get_property(np, "device-id", NULL);
240 id = of_get_property(np, "device-id", NULL);260 if (!iprop) {
241 if (!id)261 pr_debug("fsl-pq-mdio: no UCC ID in node %s\n",
242 continue;262 np->full_name);
263 continue;
243 }264 }
265 }
244 266
245 *ucc_id = *id;267 id = be32_to_cpup(iprop);
246 268
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;
248 }277 }
278
279 pr_debug("fsl-pq-mdio: setting node UCC%u to MII master\n", id);
280 found_mii_master = true;
249 }281 }
282}
250 283
251 if (err)
252 return err;
253 else
254 return -EINVAL;
255#else
256 return -ENODEV;
257#endif284#endif
258}
259 285
260static int fsl_pq_mdio_probe(struct platform_device *ofdev)286static 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};
356MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
357
358static int fsl_pq_mdio_probe(struct platform_device *pdev)
261{359{
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;
263 struct device_node *tbi;365 struct device_node *tbi;
264 struct fsl_pq_mdio_priv *priv;366 struct fsl_pq_mdio_priv *priv;
265 struct fsl_pq_mdio __iomem *regs = NULL;
266 void __iomem *map;
267 u32 __iomem *tbipa;
268 struct mii_bus *new_bus;367 struct mii_bus *new_bus;
269 int tbiaddr = -1;
270 const u32 *addrp;
271 u64 addr = 0, size = 0;
272 int err;368 int err;
273 369
274 priv = kzalloc(sizeof(*priv), GFP_KERNEL);370 dev_dbg(&pdev->dev, "found %s compatible node\n", id->compatible);
275 if (!priv)
276 return -ENOMEM;
277 371
278 new_bus = mdiobus_alloc();372 new_bus = mdiobus_alloc_size(sizeof(*priv));
279 if (!new_bus) {373 if (!new_bus)
280 err = -ENOMEM;374 return -ENOMEM;
281 goto err_free_priv;
282 }
283 375
376 priv = new_bus->priv;
284 new_bus->name = "Freescale PowerQUICC MII Bus",377 new_bus->name = "Freescale PowerQUICC MII Bus",
285 new_bus->read = &fsl_pq_mdio_read,378 new_bus->read = &fsl_pq_mdio_read;
286 new_bus->write = &fsl_pq_mdio_write,379 new_bus->write = &fsl_pq_mdio_write;
287 new_bus->reset = &fsl_pq_mdio_reset,380 new_bus->reset = &fsl_pq_mdio_reset;
288 new_bus->priv = priv;381 new_bus->irq = priv->irqs;
289 fsl_pq_mdio_bus_name(new_bus->id, np);382
290 383 err = of_address_to_resource(np, 0, &res);
291 addrp = of_get_address(np, 0, &size, NULL);384 if (err < 0) {
292 if (!addrp) {385 dev_err(&pdev->dev, "could not obtain address information\n");
293 err = -EINVAL;386 goto error;
294 goto err_free_bus;
295 }387 }
296 388
297 /* Set the PHY base address */389 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s@%llx", np->name,
298 addr = of_translate_address(np, addrp);390 (unsigned long long)res.start);
299 if (addr == OF_BAD_ADDR) {
300 err = -EINVAL;
301 goto err_free_bus;
302 }
303 391
304 map = ioremap(addr, size);392 priv->map = of_iomap(np, 0);
305 if (!map) {393 if (!priv->map) {
306 err = -ENOMEM;394 err = -ENOMEM;
307 goto err_free_bus;395 goto error;
308 }396 }
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);
320 397
321 if (NULL == new_bus->irq) {398 /*
322 err = -ENOMEM;399 * Some device tree nodes represent only the MII registers, and
323 goto err_unmap_regs;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;
324 }408 }
409 priv->regs = priv->map + data->mii_offset;
325 410
326 new_bus->parent = &ofdev->dev;411 new_bus->parent = &pdev->dev;
327 dev_set_drvdata(&ofdev->dev, new_bus);412 dev_set_drvdata(&pdev->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;
348 413
349 if (!mii_mng_master) {414 if (data->get_tbipa) {
350 mii_mng_master = id;415 for_each_child_of_node(np, tbi) {
351 ucc_set_qe_mux_mii_mng(id - 1);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 }
352 }421 }
353 } else {
354 err = -ENODEV;
355 goto err_free_irqs;
356 }
357 422
358 for_each_child_of_node(np, tbi) {423 if (tbi) {
359 if (!strncmp(tbi->type, "tbi-phy", 8))424 const u32 *prop = of_get_property(tbi, "reg", NULL);
360 break;425 uint32_t __iomem *tbipa;
361 }
362 426
363 if (tbi) {427 if (!prop) {
364 const u32 *prop = of_get_property(tbi, "reg", NULL);428 dev_err(&pdev->dev,
429 "missing 'reg' property in node %s\n",
430 tbi->full_name);
431 err = -EBUSY;
432 goto error;
433 }
365 434
366 if (prop)435 tbipa = data->get_tbipa(priv->map);
367 tbiaddr = *prop;
368 436
369 if (tbiaddr == -1) {437 out_be32(tbipa, be32_to_cpup(prop));
370 err = -EBUSY;
371 goto err_free_irqs;
372 } else {
373 out_be32(tbipa, tbiaddr);
374 }438 }
375 }439 }
376 440
441 if (data->ucc_configure)
442 data->ucc_configure(res.start, res.end);
443
377 err = of_mdiobus_register(new_bus, np);444 err = of_mdiobus_register(new_bus, np);
378 if (err) {445 if (err) {
379 printk (KERN_ERR "%s: Cannot register as MDIO bus\n",446 dev_err(&pdev->dev, "cannot register %s as MDIO bus\n",
380 new_bus->name);447 new_bus->name);
381 goto err_free_irqs;448 goto error;
382 }449 }
383 450
384 return 0;451 return 0;
385 452
386err_free_irqs:453error:
387 kfree(new_bus->irq);454 if (priv->map)
388err_unmap_regs:455 iounmap(priv->map);
389 iounmap(priv->map);456
390err_free_bus:
391 kfree(new_bus);457 kfree(new_bus);
392err_free_priv:458
393 kfree(priv);
394 return err;459 return err;
395}460}
396 461
397 462
398static int fsl_pq_mdio_remove(struct platform_device *ofdev)463static int fsl_pq_mdio_remove(struct platform_device *pdev)
399{464{
400 struct device *device = &ofdev->dev;465 struct device *device = &pdev->dev;
401 struct mii_bus *bus = dev_get_drvdata(device);466 struct mii_bus *bus = dev_get_drvdata(device);
402 struct fsl_pq_mdio_priv *priv = bus->priv;467 struct fsl_pq_mdio_priv *priv = bus->priv;
403 468
@@ -406,41 +471,11 @@ static int fsl_pq_mdio_remove(struct platform_device *ofdev) · 2 unmodified lines
406 dev_set_drvdata(device, NULL);471 dev_set_drvdata(device, NULL);
407 472
408 iounmap(priv->map);473 iounmap(priv->map);
409 bus->priv = NULL;
410 mdiobus_free(bus);474 mdiobus_free(bus);
411 kfree(priv);
412 475
413 return 0;476 return 0;
414}477}
415 478
416static 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};
442MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
443
444static struct platform_driver fsl_pq_mdio_driver = {479static struct platform_driver fsl_pq_mdio_driver = {
445 .driver = {480 .driver = {
446 .name = "fsl-pq_mdio",481 .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
26struct 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
44int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
45int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
46int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,
47 int regnum, u16 value);
48int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs, int mii_id, int regnum);
49int __init fsl_pq_mdio_init(void);
50void fsl_pq_mdio_exit(void);
51void 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
100#include <linux/of_net.h>100#include <linux/of_net.h>
101 101
102#include "gianfar.h"102#include "gianfar.h"
103#include "fsl_pq_mdio.h"
104 103
105#define TX_TIMEOUT (1*HZ)104#define TX_TIMEOUT (1*HZ)
106 105
@@ -395,7 +394,13 @@ static void gfar_init_mac(struct net_device *ndev) · 288 unmodified lines
395 if (ndev->features & NETIF_F_IP_CSUM)394 if (ndev->features & NETIF_F_IP_CSUM)
396 tctrl |= TCTRL_INIT_CSUM;395 tctrl |= TCTRL_INIT_CSUM;
397 396
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 }
399 404
400 gfar_write(&regs->tctrl, tctrl);405 gfar_write(&regs->tctrl, tctrl);
401 406
@@ -1161,6 +1166,9 @@ static int gfar_probe(struct platform_device *ofdev) · 759 unmodified lines
1161 priv->rx_filer_enable = 1;1166 priv->rx_filer_enable = 1;
1162 /* Enable most messages by default */1167 /* Enable most messages by default */
1163 priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;1168 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;
1164 1172
1165 /* Carrier starts down, phylib will bring it up */1173 /* Carrier starts down, phylib will bring it up */
1166 netif_carrier_off(dev);1174 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
301#define TCTRL_TFCPAUSE 0x00000008301#define TCTRL_TFCPAUSE 0x00000008
302#define TCTRL_TXSCHED_MASK 0x00000006302#define TCTRL_TXSCHED_MASK 0x00000006
303#define TCTRL_TXSCHED_INIT 0x00000000303#define TCTRL_TXSCHED_INIT 0x00000000
304/* priority scheduling */
304#define TCTRL_TXSCHED_PRIO 0x00000002305#define TCTRL_TXSCHED_PRIO 0x00000002
306/* weighted round-robin scheduling (WRRS) */
305#define TCTRL_TXSCHED_WRRS 0x00000004307#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
306#define TCTRL_INIT_CSUM (TCTRL_TUCSEN | TCTRL_IPCSEN)314#define TCTRL_INIT_CSUM (TCTRL_TUCSEN | TCTRL_IPCSEN)
307 315
308#define IEVENT_INIT_CLEAR 0xffffffff316#define IEVENT_INIT_CLEAR 0xffffffff
@@ -1098,7 +1106,8 @@ struct gfar_private { · 789 unmodified lines
1098 extended_hash:1,1106 extended_hash:1,
1099 bd_stash_en:1,1107 bd_stash_en:1,
1100 rx_filer_enable:1,1108 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 */
1102 unsigned short padding;1111 unsigned short padding;
1103 1112
1104 /* PHY stuff */1113 /* 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
510 510
511 spin_unlock_irqrestore(&etsects->lock, flags);511 spin_unlock_irqrestore(&etsects->lock, flags);
512 512
513 etsects->clock = ptp_clock_register(&etsects->caps);513 etsects->clock = ptp_clock_register(&etsects->caps, &dev->dev);
514 if (IS_ERR(etsects->clock)) {514 if (IS_ERR(etsects->clock)) {
515 err = PTR_ERR(etsects->clock);515 err = PTR_ERR(etsects->clock);
516 goto no_clock;516 goto no_clock;
drivers/net/ethernet/freescale/ucc_geth.c+0−1
@@ -42,7 +42,6 @@ · 41 unmodified lines
42#include <asm/machdep.h>42#include <asm/machdep.h>
43 43
44#include "ucc_geth.h"44#include "ucc_geth.h"
45#include "fsl_pq_mdio.h"
46 45
47#undef DEBUG46#undef DEBUG
48 47
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
26struct 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 */
50static 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 */
69static 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 */
90static 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 */
129static 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 */
175static 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
192static 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
234err_registration:
235 iounmap(bus->priv);
236
237err_ioremap:
238 mdiobus_free(bus);
239
240 return ret;
241}
242
243static 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
254static struct of_device_id xgmac_mdio_match[] = {
255 {
256 .compatible = "fsl,fman-xmdio",
257 },
258 {},
259};
260MODULE_DEVICE_TABLE(of, xgmac_mdio_match);
261
262static 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
271module_platform_driver(xgmac_mdio_driver);
272
273MODULE_DESCRIPTION("Freescale QorIQ 10G MDIO Controller");
274MODULE_LICENSE("GPL v2");
drivers/net/ethernet/i825xx/Kconfig+1−1
@@ -150,7 +150,7 @@ config SUN3_82586 · 149 unmodified lines
150 150
151config ZNET151config ZNET
152 tristate "Zenith Z-Note support (EXPERIMENTAL)"152 tristate "Zenith Z-Note support (EXPERIMENTAL)"
153 depends on EXPERIMENTAL && ISA_DMA_API153 depends on EXPERIMENTAL && ISA_DMA_API && X86
154 ---help---154 ---help---
155 The Zenith Z-Note notebook computer has a built-in network155 The Zenith Z-Note notebook computer has a built-in network
156 (Ethernet) card, and this is the Linux driver for it. Note that the156 (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
865 disable_dma(znet->rx_dma); /* reset by an interrupting task. */865 disable_dma(znet->rx_dma); /* reset by an interrupting task. */
866 clear_dma_ff(znet->rx_dma);866 clear_dma_ff(znet->rx_dma);
867 set_dma_mode(znet->rx_dma, DMA_RX_MODE);867 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));
869 set_dma_count(znet->rx_dma, RX_BUF_SIZE);869 set_dma_count(znet->rx_dma, RX_BUF_SIZE);
870 enable_dma(znet->rx_dma);870 enable_dma(znet->rx_dma);
871 /* Now set up the Tx channel. */871 /* Now set up the Tx channel. */
872 disable_dma(znet->tx_dma);872 disable_dma(znet->tx_dma);
873 clear_dma_ff(znet->tx_dma);873 clear_dma_ff(znet->tx_dma);
874 set_dma_mode(znet->tx_dma, DMA_TX_MODE);874 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));
876 set_dma_count(znet->tx_dma, znet->tx_buf_len<<1);876 set_dma_count(znet->tx_dma, znet->tx_buf_len<<1);
877 enable_dma(znet->tx_dma);877 enable_dma(znet->tx_dma);
878 release_dma_lock(flags);878 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
174 174
175 ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||175 ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||
176 hw->autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;176 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;
177 return 0;191 return 0;
178}192}
179 193
@@ -183,6 +197,22 @@ static int e1000_set_settings(struct net_device *netdev, · 3 unmodified lines
183 struct e1000_adapter *adapter = netdev_priv(netdev);197 struct e1000_adapter *adapter = netdev_priv(netdev);
184 struct e1000_hw *hw = &adapter->hw;198 struct e1000_hw *hw = &adapter->hw;
185 199
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
186 while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))216 while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
187 msleep(1);217 msleep(1);
188 218
@@ -199,12 +229,21 @@ static int e1000_set_settings(struct net_device *netdev, · 10 unmodified lines
199 ecmd->advertising = hw->autoneg_advertised;229 ecmd->advertising = hw->autoneg_advertised;
200 } else {230 } else {
201 u32 speed = ethtool_cmd_speed(ecmd);231 u32 speed = ethtool_cmd_speed(ecmd);
232 /* calling this overrides forced MDI setting */
202 if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {233 if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
203 clear_bit(__E1000_RESETTING, &adapter->flags);234 clear_bit(__E1000_RESETTING, &adapter->flags);
204 return -EINVAL;235 return -EINVAL;
205 }236 }
206 }237 }
207 238
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
208 /* reset the link */247 /* reset the link */
209 248
210 if (netif_running(adapter->netdev)) {249 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
2014 e1000_unmap_and_free_tx_resource(adapter, buffer_info);2014 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
2015 }2015 }
2016 2016
2017 netdev_reset_queue(adapter->netdev);
2017 size = sizeof(struct e1000_buffer) * tx_ring->count;2018 size = sizeof(struct e1000_buffer) * tx_ring->count;
2018 memset(tx_ring->buffer_info, 0, size);2019 memset(tx_ring->buffer_info, 0, size);
2019 2020
@@ -3273,6 +3274,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 1253 unmodified lines
3273 nr_frags, mss);3274 nr_frags, mss);
3274 3275
3275 if (count) {3276 if (count) {
3277 netdev_sent_queue(netdev, skb->len);
3276 skb_tx_timestamp(skb);3278 skb_tx_timestamp(skb);
3277 3279
3278 e1000_tx_queue(adapter, tx_ring, tx_flags, count);3280 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
3860 unsigned int i, eop;3862 unsigned int i, eop;
3861 unsigned int count = 0;3863 unsigned int count = 0;
3862 unsigned int total_tx_bytes=0, total_tx_packets=0;3864 unsigned int total_tx_bytes=0, total_tx_packets=0;
3865 unsigned int bytes_compl = 0, pkts_compl = 0;
3863 3866
3864 i = tx_ring->next_to_clean;3867 i = tx_ring->next_to_clean;
3865 eop = tx_ring->buffer_info[i].next_to_watch;3868 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
3877 if (cleaned) {3880 if (cleaned) {
3878 total_tx_packets += buffer_info->segs;3881 total_tx_packets += buffer_info->segs;
3879 total_tx_bytes += buffer_info->bytecount;3882 total_tx_bytes += buffer_info->bytecount;
3883 if (buffer_info->skb) {
3884 bytes_compl += buffer_info->skb->len;
3885 pkts_compl++;
3886 }
3887
3880 }3888 }
3881 e1000_unmap_and_free_tx_resource(adapter, buffer_info);3889 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
3882 tx_desc->upper.data = 0;3890 tx_desc->upper.data = 0;
@@ -3890,6 +3898,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, · 7 unmodified lines
3890 3898
3891 tx_ring->next_to_clean = i;3899 tx_ring->next_to_clean = i;
3892 3900
3901 netdev_completed_queue(netdev, pkts_compl, bytes_compl);
3902
3893#define TX_WAKE_THRESHOLD 323903#define TX_WAKE_THRESHOLD 32
3894 if (unlikely(count && netif_carrier_ok(netdev) &&3904 if (unlikely(count && netif_carrier_ok(netdev) &&
3895 E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) {3905 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
4950 default:4960 default:
4951 goto err_inval;4961 goto err_inval;
4952 }4962 }
4963
4964 /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
4965 hw->mdix = AUTO_ALL_MODES;
4966
4953 return 0;4967 return 0;
4954 4968
4955err_inval:4969err_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
653 **/653 **/
654static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active)654static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active)
655{655{
656 u16 data = er32(POEMB);656 u32 data = er32(POEMB);
657 657
658 if (active)658 if (active)
659 data |= E1000_PHY_CTRL_D0A_LPLU;659 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
677 **/677 **/
678static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active)678static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active)
679{679{
680 u16 data = er32(POEMB);680 u32 data = er32(POEMB);
681 681
682 if (!active) {682 if (!active) {
683 data &= ~E1000_PHY_CTRL_NOND0A_LPLU;683 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
199 else199 else
200 ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;200 ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
201 201
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
202 return 0;207 return 0;
203}208}
204 209
@@ -241,6 +246,10 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx) · 36 unmodified lines
241 default:246 default:
242 goto err_inval;247 goto err_inval;
243 }248 }
249
250 /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
251 adapter->hw.phy.mdix = AUTO_ALL_MODES;
252
244 return 0;253 return 0;
245 254
246err_inval:255err_inval:
@@ -264,6 +273,22 @@ static int e1000_set_settings(struct net_device *netdev, · 17 unmodified lines
264 return -EINVAL;273 return -EINVAL;
265 }274 }
266 275
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
267 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))292 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
268 usleep_range(1000, 2000);293 usleep_range(1000, 2000);
269 294
@@ -282,20 +307,32 @@ static int e1000_set_settings(struct net_device *netdev, · 12 unmodified lines
282 hw->fc.requested_mode = e1000_fc_default;307 hw->fc.requested_mode = e1000_fc_default;
283 } else {308 } else {
284 u32 speed = ethtool_cmd_speed(ecmd);309 u32 speed = ethtool_cmd_speed(ecmd);
310 /* calling this overrides forced MDI setting */
285 if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {311 if (e1000_set_spd_dplx(adapter, speed, ecmd->duplex)) {
286 clear_bit(__E1000_RESETTING, &adapter->state);312 clear_bit(__E1000_RESETTING, &adapter->state);
287 return -EINVAL;313 return -EINVAL;
288 }314 }
289 }315 }
290 316
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
291 /* reset the link */329 /* reset the link */
292 330
293 if (netif_running(adapter->netdev)) {331 if (netif_running(adapter->netdev)) {
294 e1000e_down(adapter);332 e1000e_down(adapter);
295 e1000e_up(adapter);333 e1000e_up(adapter);
296 } else {334 } else
297 e1000e_reset(adapter);335 e1000e_reset(adapter);
298 }
299 336
300 clear_bit(__E1000_RESETTING, &adapter->state);337 clear_bit(__E1000_RESETTING, &adapter->state);
301 return 0;338 return 0;
@@ -1905,7 +1942,8 @@ static int e1000_set_coalesce(struct net_device *netdev, · 1603 unmodified lines
1905 return -EINVAL;1942 return -EINVAL;
1906 1943
1907 if (ec->rx_coalesce_usecs == 4) {1944 if (ec->rx_coalesce_usecs == 4) {
1908 adapter->itr = adapter->itr_setting = 4;1945 adapter->itr_setting = 4;
1946 adapter->itr = adapter->itr_setting;
1909 } else if (ec->rx_coalesce_usecs <= 3) {1947 } else if (ec->rx_coalesce_usecs <= 3) {
1910 adapter->itr = 20000;1948 adapter->itr = 20000;
1911 adapter->itr_setting = ec->rx_coalesce_usecs;1949 adapter->itr_setting = ec->rx_coalesce_usecs;
drivers/net/ethernet/intel/e1000e/netdev.c+13−6
@@ -56,7 +56,7 @@ · 55 unmodified lines
56 56
57#define DRV_EXTRAVERSION "-k"57#define DRV_EXTRAVERSION "-k"
58 58
59#define DRV_VERSION "2.0.0" DRV_EXTRAVERSION59#define DRV_VERSION "2.1.4" DRV_EXTRAVERSION
60char e1000e_driver_name[] = "e1000e";60char e1000e_driver_name[] = "e1000e";
61const char e1000e_driver_version[] = DRV_VERSION;61const char e1000e_driver_version[] = DRV_VERSION;
62 62
@@ -3446,7 +3446,7 @@ void e1000e_reset(struct e1000_adapter *adapter) · 3383 unmodified lines
3446 3446
3447 /*3447 /*
3448 * if short on Rx space, Rx wins and must trump Tx3448 * if short on Rx space, Rx wins and must trump Tx
3449 * adjustment or use Early Receive if available3449 * adjustment
3450 */3450 */
3451 if (pba < min_rx_space)3451 if (pba < min_rx_space)
3452 pba = min_rx_space;3452 pba = min_rx_space;
@@ -3755,6 +3755,10 @@ static irqreturn_t e1000_intr_msi_test(int irq, void *data) · 302 unmodified lines
3755 e_dbg("icr is %08X\n", icr);3755 e_dbg("icr is %08X\n", icr);
3756 if (icr & E1000_ICR_RXSEQ) {3756 if (icr & E1000_ICR_RXSEQ) {
3757 adapter->flags &= ~FLAG_MSI_TEST_FAILED;3757 adapter->flags &= ~FLAG_MSI_TEST_FAILED;
3758 /*
3759 * Force memory writes to complete before acknowledging the
3760 * interrupt is handled.
3761 */
3758 wmb();3762 wmb();
3759 }3763 }
3760 3764
@@ -3796,6 +3800,10 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) · 35 unmodified lines
3796 goto msi_test_failed;3800 goto msi_test_failed;
3797 }3801 }
3798 3802
3803 /*
3804 * Force memory writes to complete before enabling and firing an
3805 * interrupt.
3806 */
3799 wmb();3807 wmb();
3800 3808
3801 e1000_irq_enable(adapter);3809 e1000_irq_enable(adapter);
@@ -3807,7 +3815,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) · 5 unmodified lines
3807 3815
3808 e1000_irq_disable(adapter);3816 e1000_irq_disable(adapter);
3809 3817
3810 rmb();3818 rmb(); /* read flags after interrupt has been fired */
3811 3819
3812 if (adapter->flags & FLAG_MSI_TEST_FAILED) {3820 if (adapter->flags & FLAG_MSI_TEST_FAILED) {
3813 adapter->int_mode = E1000E_INT_MODE_LEGACY;3821 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
4670 struct e1000_buffer *buffer_info;4678 struct e1000_buffer *buffer_info;
4671 unsigned int i;4679 unsigned int i;
4672 u32 cmd_length = 0;4680 u32 cmd_length = 0;
4673 u16 ipcse = 0, tucse, mss;4681 u16 ipcse = 0, mss;
4674 u8 ipcss, ipcso, tucss, tucso, hdr_len;4682 u8 ipcss, ipcso, tucss, tucso, hdr_len;
4675 4683
4676 if (!skb_is_gso(skb))4684 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
4704 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;4712 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
4705 tucss = skb_transport_offset(skb);4713 tucss = skb_transport_offset(skb);
4706 tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;4714 tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;
4707 tucse = 0;
4708 4715
4709 cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |4716 cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
4710 E1000_TXD_CMD_TCP | (skb->len - (hdr_len)));4717 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
4718 context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse);4725 context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse);
4719 context_desc->upper_setup.tcp_fields.tucss = tucss;4726 context_desc->upper_setup.tcp_fields.tucss = tucss;
4720 context_desc->upper_setup.tcp_fields.tucso = tucso;4727 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;
4722 context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss);4729 context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss);
4723 context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;4730 context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
4724 context_desc->cmd_and_length = cpu_to_le32(cmd_length);4731 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
84#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x020084#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200
85 85
86/* I82577 PHY Control 2 */86/* I82577 PHY Control 2 */
87#define I82577_PHY_CTRL2_AUTO_MDIX 0x040087#define I82577_PHY_CTRL2_MANUAL_MDIX 0x0200
88#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x020088#define I82577_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
89#define I82577_PHY_CTRL2_MDIX_CFG_MASK 0x0600
89 90
90/* I82577 PHY Diagnostics Status */91/* I82577 PHY Diagnostics Status */
91#define I82577_DSTATUS_CABLE_LENGTH 0x03FC92#define I82577_DSTATUS_CABLE_LENGTH 0x03FC
@@ -702,6 +703,32 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) · 610 unmodified lines
702 if (ret_val)703 if (ret_val)
703 return ret_val;704 return ret_val;
704 705
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
705 return e1000_set_master_slave_mode(hw);732 return e1000_set_master_slave_mode(hw);
706}733}
707 734
drivers/net/ethernet/intel/igb/e1000_82575.c+13−4
@@ -2223,11 +2223,10 @@ out: · 2222 unmodified lines
2223s32 igb_set_eee_i350(struct e1000_hw *hw)2223s32 igb_set_eee_i350(struct e1000_hw *hw)
2224{2224{
2225 s32 ret_val = 0;2225 s32 ret_val = 0;
2226 u32 ipcnfg, eeer, ctrl_ext;2226 u32 ipcnfg, eeer;
2227 2227
2228 ctrl_ext = rd32(E1000_CTRL_EXT);2228 if ((hw->mac.type < e1000_i350) ||
2229 if ((hw->mac.type != e1000_i350) ||2229 (hw->phy.media_type != e1000_media_type_copper))
2230 (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK))
2231 goto out;2230 goto out;
2232 ipcnfg = rd32(E1000_IPCNFG);2231 ipcnfg = rd32(E1000_IPCNFG);
2233 eeer = rd32(E1000_EEER);2232 eeer = rd32(E1000_EEER);
@@ -2240,6 +2239,14 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) · 6 unmodified lines
2240 E1000_EEER_RX_LPI_EN |2239 E1000_EEER_RX_LPI_EN |
2241 E1000_EEER_LPI_FC);2240 E1000_EEER_LPI_FC);
2242 2241
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
2243 } else {2250 } else {
2244 ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN |2251 ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN |
2245 E1000_IPCNFG_EEE_100M_AN);2252 E1000_IPCNFG_EEE_100M_AN);
@@ -2249,6 +2256,8 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) · 3 unmodified lines
2249 }2256 }
2250 wr32(E1000_IPCNFG, ipcnfg);2257 wr32(E1000_IPCNFG, ipcnfg);
2251 wr32(E1000_EEER, eeer);2258 wr32(E1000_EEER, eeer);
2259 rd32(E1000_IPCNFG);
2260 rd32(E1000_EEER);
2252out:2261out:
2253 2262
2254 return ret_val;2263 return ret_val;
drivers/net/ethernet/intel/igb/e1000_defines.h+10−1
@@ -322,6 +322,9 @@ · 321 unmodified lines
322#define E1000_FCRTC_RTH_COAL_SHIFT 4322#define E1000_FCRTC_RTH_COAL_SHIFT 4
323#define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision */323#define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision */
324 324
325/* Timestamp in Rx buffer */
326#define E1000_RXPBS_CFG_TS_EN 0x80000000
327
325/* SerDes Control */328/* SerDes Control */
326#define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400329#define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400
327 330
@@ -360,6 +363,7 @@ · 32 unmodified lines
360#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */363#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */
361#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */364#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */
362#define E1000_ICR_VMMB 0x00000100 /* VM MB event */365#define E1000_ICR_VMMB 0x00000100 /* VM MB event */
366#define E1000_ICR_TS 0x00080000 /* Time Sync Interrupt */
363#define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */367#define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */
364/* If this bit asserted, the driver should claim the interrupt */368/* If this bit asserted, the driver should claim the interrupt */
365#define E1000_ICR_INT_ASSERTED 0x80000000369#define E1000_ICR_INT_ASSERTED 0x80000000
@@ -399,6 +403,7 @@ · 33 unmodified lines
399#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */403#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
400#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */404#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */
401#define E1000_IMS_VMMB E1000_ICR_VMMB /* Mail box activity */405#define E1000_IMS_VMMB E1000_ICR_VMMB /* Mail box activity */
406#define E1000_IMS_TS E1000_ICR_TS /* Time Sync Interrupt */
402#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */407#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
403#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */408#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
404#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */409#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */
@@ -510,6 +515,9 @@ · 105 unmodified lines
510 515
511#define E1000_TIMINCA_16NS_SHIFT 24516#define E1000_TIMINCA_16NS_SHIFT 24
512 517
518#define E1000_TSICR_TXTS 0x00000002
519#define E1000_TSIM_TXTS 0x00000002
520
513#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */521#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */
514#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */522#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */
515#define E1000_MDICNFG_PHY_MASK 0x03E00000523#define E1000_MDICNFG_PHY_MASK 0x03E00000
@@ -849,8 +857,9 @@ · 333 unmodified lines
849#define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */857#define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */
850#define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */858#define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */
851#define E1000_EEER_RX_LPI_EN 0x00020000 /* EEE Rx LPI Enable */859#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 */
853#define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */861#define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */
862#define E1000_EEE_SU_LPI_CLK_STP 0X00800000 /* EEE LPI Clock Stop */
854 863
855/* SerDes Control */864/* SerDes Control */
856#define E1000_GEN_CTL_READY 0x80000000865#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
464 phy_data |= I82580_CFG_ENABLE_DOWNSHIFT;464 phy_data |= I82580_CFG_ENABLE_DOWNSHIFT;
465 465
466 ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data);466 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);
467 493
468out:494out:
469 return ret_val;495 return ret_val;
@@ -2246,8 +2272,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw) · 1776 unmodified lines
2246 if (ret_val)2272 if (ret_val)
2247 goto out;2273 goto out;
2248 2274
2249 phy_data &= ~I82580_PHY_CTRL2_AUTO_MDIX;2275 phy_data &= ~I82580_PHY_CTRL2_MDIX_CFG_MASK;
2250 phy_data &= ~I82580_PHY_CTRL2_FORCE_MDI_MDIX;
2251 2276
2252 ret_val = phy->ops.write_reg(hw, I82580_PHY_CTRL_2, phy_data);2277 ret_val = phy->ops.write_reg(hw, I82580_PHY_CTRL_2, phy_data);
2253 if (ret_val)2278 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
111#define I82580_PHY_STATUS2_SPEED_100MBPS 0x0100111#define I82580_PHY_STATUS2_SPEED_100MBPS 0x0100
112 112
113/* I82580 PHY Control 2 */113/* I82580 PHY Control 2 */
114#define I82580_PHY_CTRL2_AUTO_MDIX 0x0400114#define I82580_PHY_CTRL2_MANUAL_MDIX 0x0200
115#define I82580_PHY_CTRL2_FORCE_MDI_MDIX 0x0200115#define I82580_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
116#define I82580_PHY_CTRL2_MDIX_CFG_MASK 0x0600
116 117
117/* I82580 PHY Diagnostics Status */118/* I82580 PHY Diagnostics Status */
118#define I82580_DSTATUS_CABLE_LENGTH 0x03FC119#define I82580_DSTATUS_CABLE_LENGTH 0x03FC
drivers/net/ethernet/intel/igb/e1000_regs.h+3−0
@@ -91,6 +91,8 @@ · 90 unmodified lines
91#define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */91#define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */
92#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */92#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */
93#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */93#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */
94#define E1000_TSICR 0x0B66C /* Interrupt Cause Register */
95#define E1000_TSIM 0x0B674 /* Interrupt Mask Register */
94 96
95/* Filtering Registers */97/* Filtering Registers */
96#define E1000_SAQF(_n) (0x5980 + 4 * (_n))98#define E1000_SAQF(_n) (0x5980 + 4 * (_n))
@@ -347,6 +349,7 @@ · 250 unmodified lines
347/* Energy Efficient Ethernet "EEE" register */349/* Energy Efficient Ethernet "EEE" register */
348#define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */350#define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */
349#define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */351#define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */
352#define E1000_EEE_SU 0X0E34 /* EEE Setup */
350 353
351/* Thermal Sensor Register */354/* Thermal Sensor Register */
352#define E1000_THSTAT 0x08110 /* Thermal Sensor Status */355#define E1000_THSTAT 0x08110 /* Thermal Sensor Status */
drivers/net/ethernet/intel/igb/igb.h+24−17
@@ -34,9 +34,11 @@ · 33 unmodified lines
34#include "e1000_mac.h"34#include "e1000_mac.h"
35#include "e1000_82575.h"35#include "e1000_82575.h"
36 36
37#ifdef CONFIG_IGB_PTP
37#include <linux/clocksource.h>38#include <linux/clocksource.h>
38#include <linux/net_tstamp.h>39#include <linux/net_tstamp.h>
39#include <linux/ptp_clock_kernel.h>40#include <linux/ptp_clock_kernel.h>
41#endif /* CONFIG_IGB_PTP */
40#include <linux/bitops.h>42#include <linux/bitops.h>
41#include <linux/if_vlan.h>43#include <linux/if_vlan.h>
42 44
@@ -99,7 +101,6 @@ struct vf_data_storage { · 56 unmodified lines
99 u16 pf_vlan; /* When set, guest VLAN config not allowed. */101 u16 pf_vlan; /* When set, guest VLAN config not allowed. */
100 u16 pf_qos;102 u16 pf_qos;
101 u16 tx_rate;103 u16 tx_rate;
102 struct pci_dev *vfdev;
103};104};
104 105
105#define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */106#define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */
@@ -131,9 +132,9 @@ struct vf_data_storage { · 25 unmodified lines
131#define MAXIMUM_ETHERNET_VLAN_SIZE 1522132#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
132 133
133/* Supported Rx Buffer Sizes */134/* Supported Rx Buffer Sizes */
134#define IGB_RXBUFFER_512 512135#define IGB_RXBUFFER_256 256
135#define IGB_RXBUFFER_16384 16384136#define IGB_RXBUFFER_16384 16384
136#define IGB_RX_HDR_LEN IGB_RXBUFFER_512137#define IGB_RX_HDR_LEN IGB_RXBUFFER_256
137 138
138/* How many Tx Descriptors do we need to call netif_wake_queue ? */139/* How many Tx Descriptors do we need to call netif_wake_queue ? */
139#define IGB_TX_QUEUE_WAKE 16140#define IGB_TX_QUEUE_WAKE 16
@@ -167,8 +168,8 @@ struct igb_tx_buffer { · 27 unmodified lines
167 unsigned int bytecount;168 unsigned int bytecount;
168 u16 gso_segs;169 u16 gso_segs;
169 __be16 protocol;170 __be16 protocol;
170 dma_addr_t dma;171 DEFINE_DMA_UNMAP_ADDR(dma);
171 u32 length;172 DEFINE_DMA_UNMAP_LEN(len);
172 u32 tx_flags;173 u32 tx_flags;
173};174};
174 175
@@ -212,7 +213,6 @@ struct igb_q_vector { · 37 unmodified lines
212 struct igb_ring_container rx, tx;213 struct igb_ring_container rx, tx;
213 214
214 struct napi_struct napi;215 struct napi_struct napi;
215 int numa_node;
216 216
217 u16 itr_val;217 u16 itr_val;
218 u8 set_itr;218 u8 set_itr;
@@ -257,7 +257,6 @@ struct igb_ring { · 38 unmodified lines
257 };257 };
258 /* Items past this point are only used during ring alloc / free */258 /* Items past this point are only used during ring alloc / free */
259 dma_addr_t dma; /* phys address of the ring */259 dma_addr_t dma; /* phys address of the ring */
260 int numa_node; /* node to alloc ring memory on */
261};260};
262 261
263enum e1000_ring_flags_t {262enum e1000_ring_flags_t {
@@ -342,7 +341,6 @@ struct igb_adapter { · 78 unmodified lines
342 341
343 /* OS defined structs */342 /* OS defined structs */
344 struct pci_dev *pdev;343 struct pci_dev *pdev;
345 struct hwtstamp_config hwtstamp_config;
346 344
347 spinlock_t stats64_lock;345 spinlock_t stats64_lock;
348 struct rtnl_link_stats64 stats64;346 struct rtnl_link_stats64 stats64;
@@ -373,15 +371,19 @@ struct igb_adapter { · 24 unmodified lines
373 int vf_rate_link_speed;371 int vf_rate_link_speed;
374 u32 rss_queues;372 u32 rss_queues;
375 u32 wvbr;373 u32 wvbr;
376 int node;
377 u32 *shadow_vfta;374 u32 *shadow_vfta;
378 375
376#ifdef CONFIG_IGB_PTP
379 struct ptp_clock *ptp_clock;377 struct ptp_clock *ptp_clock;
380 struct ptp_clock_info caps;378 struct ptp_clock_info ptp_caps;
381 struct delayed_work overflow_work;379 struct delayed_work ptp_overflow_work;
380 struct work_struct ptp_tx_work;
381 struct sk_buff *ptp_tx_skb;
382 spinlock_t tmreg_lock;382 spinlock_t tmreg_lock;
383 struct cyclecounter cc;383 struct cyclecounter cc;
384 struct timecounter tc;384 struct timecounter tc;
385#endif /* CONFIG_IGB_PTP */
386
385 char fw_version[32];387 char fw_version[32];
386};388};
387 389
@@ -390,6 +392,7 @@ struct igb_adapter { · 2 unmodified lines
390#define IGB_FLAG_QUAD_PORT_A (1 << 2)392#define IGB_FLAG_QUAD_PORT_A (1 << 2)
391#define IGB_FLAG_QUEUE_PAIRS (1 << 3)393#define IGB_FLAG_QUEUE_PAIRS (1 << 3)
392#define IGB_FLAG_DMAC (1 << 4)394#define IGB_FLAG_DMAC (1 << 4)
395#define IGB_FLAG_PTP (1 << 5)
393 396
394/* DMA Coalescing defines */397/* DMA Coalescing defines */
395#define IGB_MIN_TXPBSIZE 20408398#define IGB_MIN_TXPBSIZE 20408
@@ -435,13 +438,17 @@ extern void igb_power_up_link(struct igb_adapter *); · 39 unmodified lines
435extern void igb_set_fw_version(struct igb_adapter *);438extern void igb_set_fw_version(struct igb_adapter *);
436#ifdef CONFIG_IGB_PTP439#ifdef CONFIG_IGB_PTP
437extern void igb_ptp_init(struct igb_adapter *adapter);440extern void igb_ptp_init(struct igb_adapter *adapter);
438extern void igb_ptp_remove(struct igb_adapter *adapter);441extern void igb_ptp_stop(struct igb_adapter *adapter);
439 442extern void igb_ptp_reset(struct igb_adapter *adapter);
440extern void igb_systim_to_hwtstamp(struct igb_adapter *adapter,443extern void igb_ptp_tx_work(struct work_struct *work);
441 struct skb_shared_hwtstamps *hwtstamps,444extern void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
442 u64 systim);445extern void igb_ptp_rx_hwtstamp(struct igb_q_vector *q_vector,
446 union e1000_adv_rx_desc *rx_desc,
447 struct sk_buff *skb);
448extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
449 struct ifreq *ifr, int cmd);
450#endif /* CONFIG_IGB_PTP */
443 451
444#endif
445static inline s32 igb_reset_phy(struct e1000_hw *hw)452static inline s32 igb_reset_phy(struct e1000_hw *hw)
446{453{
447 if (hw->phy.ops.reset)454 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
148 SUPPORTED_100baseT_Full |148 SUPPORTED_100baseT_Full |
149 SUPPORTED_1000baseT_Full|149 SUPPORTED_1000baseT_Full|
150 SUPPORTED_Autoneg |150 SUPPORTED_Autoneg |
151 SUPPORTED_TP);151 SUPPORTED_TP |
152 ecmd->advertising = (ADVERTISED_TP |152 SUPPORTED_Pause);
153 ADVERTISED_Pause);153 ecmd->advertising = ADVERTISED_TP;
154 154
155 if (hw->mac.autoneg == 1) {155 if (hw->mac.autoneg == 1) {
156 ecmd->advertising |= ADVERTISED_Autoneg;156 ecmd->advertising |= ADVERTISED_Autoneg;
@@ -158,6 +158,21 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 1 unmodified line
158 ecmd->advertising |= hw->phy.autoneg_advertised;158 ecmd->advertising |= hw->phy.autoneg_advertised;
159 }159 }
160 160
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
161 ecmd->port = PORT_TP;176 ecmd->port = PORT_TP;
162 ecmd->phy_address = hw->phy.addr;177 ecmd->phy_address = hw->phy.addr;
163 } else {178 } else {
@@ -198,6 +213,19 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 34 unmodified lines
198 }213 }
199 214
200 ecmd->autoneg = hw->mac.autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE;215 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
201 return 0;229 return 0;
202}230}
203 231
@@ -214,6 +242,22 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 10 unmodified lines
214 return -EINVAL;242 return -EINVAL;
215 }243 }
216 244
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
217 while (test_and_set_bit(__IGB_RESETTING, &adapter->state))261 while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
218 msleep(1);262 msleep(1);
219 263
@@ -227,12 +271,25 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 7 unmodified lines
227 hw->fc.requested_mode = e1000_fc_default;271 hw->fc.requested_mode = e1000_fc_default;
228 } else {272 } else {
229 u32 speed = ethtool_cmd_speed(ecmd);273 u32 speed = ethtool_cmd_speed(ecmd);
274 /* calling this overrides forced MDI setting */
230 if (igb_set_spd_dplx(adapter, speed, ecmd->duplex)) {275 if (igb_set_spd_dplx(adapter, speed, ecmd->duplex)) {
231 clear_bit(__IGB_RESETTING, &adapter->state);276 clear_bit(__IGB_RESETTING, &adapter->state);
232 return -EINVAL;277 return -EINVAL;
233 }278 }
234 }279 }
235 280
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
236 /* reset the link */293 /* reset the link */
237 if (netif_running(adapter->netdev)) {294 if (netif_running(adapter->netdev)) {
238 igb_down(adapter);295 igb_down(adapter);
@@ -1469,33 +1526,22 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) · 1230 unmodified lines
1469{1526{
1470 struct e1000_hw *hw = &adapter->hw;1527 struct e1000_hw *hw = &adapter->hw;
1471 u32 ctrl_reg = 0;1528 u32 ctrl_reg = 0;
1472 u16 phy_reg = 0;
1473 1529
1474 hw->mac.autoneg = false;1530 hw->mac.autoneg = false;
1475 1531
1476 switch (hw->phy.type) {1532 if (hw->phy.type == e1000_phy_m88) {
1477 case e1000_phy_m88:1533 if (hw->phy.id != I210_I_PHY_ID) {
1478 /* Auto-MDI/MDIX Off */1534 /* Auto-MDI/MDIX Off */
1479 igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);1535 igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
1480 /* reset to update Auto-MDI/MDIX */1536 /* reset to update Auto-MDI/MDIX */
1481 igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);1537 igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);
1482 /* autoneg off */1538 /* autoneg off */
1483 igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);1539 igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);
1484 break;1540 } else {
1485 case e1000_phy_82580:1541 /* force 1000, set loopback */
1486 /* enable MII loopback */1542 igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0);
1487 igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041);1543 igb_write_phy_reg(hw, PHY_CONTROL, 0x4140);
1488 break;1544 }
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;
1499 }1545 }
1500 1546
1501 /* add small delay to avoid loopback test failure */1547 /* 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
1513 E1000_CTRL_FD | /* Force Duplex to FULL */1559 E1000_CTRL_FD | /* Force Duplex to FULL */
1514 E1000_CTRL_SLU); /* Set link up enable bit */1560 E1000_CTRL_SLU); /* Set link up enable bit */
1515 1561
1516 if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210))1562 if (hw->phy.type == e1000_phy_m88)
1517 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */1563 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
1518 1564
1519 wr32(E1000_CTRL, ctrl_reg);1565 wr32(E1000_CTRL, ctrl_reg);
@@ -1521,11 +1567,10 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) · 1 unmodified line
1521 /* Disable the receiver on the PHY so when a cable is plugged in, the1567 /* Disable the receiver on the PHY so when a cable is plugged in, the
1522 * PHY does not begin to autoneg when a cable is reconnected to the NIC.1568 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
1523 */1569 */
1524 if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210))1570 if (hw->phy.type == e1000_phy_m88)
1525 igb_phy_disable_receiver(adapter);1571 igb_phy_disable_receiver(adapter);
1526 1572
1527 udelay(500);1573 mdelay(500);
1528
1529 return 0;1574 return 0;
1530}1575}
1531 1576
@@ -1785,13 +1830,6 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data) · 253 unmodified lines
1785 *data = 0;1830 *data = 0;
1786 goto out;1831 goto out;
1787 }1832 }
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 }
1795 *data = igb_setup_desc_rings(adapter);1833 *data = igb_setup_desc_rings(adapter);
1796 if (*data)1834 if (*data)
1797 goto out;1835 goto out;
@@ -2257,6 +2295,54 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · 459 unmodified lines
2257 }2295 }
2258}2296}
2259 2297
2298static 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
2260static int igb_ethtool_begin(struct net_device *netdev)2346static int igb_ethtool_begin(struct net_device *netdev)
2261{2347{
2262 struct igb_adapter *adapter = netdev_priv(netdev);2348 struct igb_adapter *adapter = netdev_priv(netdev);
@@ -2270,38 +2356,6 @@ static void igb_ethtool_complete(struct net_device *netdev) · 7 unmodified lines
2270 pm_runtime_put(&adapter->pdev->dev);2356 pm_runtime_put(&adapter->pdev->dev);
2271}2357}
2272 2358
2273#ifdef CONFIG_IGB_PTP
2274static 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
2305static const struct ethtool_ops igb_ethtool_ops = {2359static const struct ethtool_ops igb_ethtool_ops = {
2306 .get_settings = igb_get_settings,2360 .get_settings = igb_get_settings,
2307 .set_settings = igb_set_settings,2361 .set_settings = igb_set_settings,
@@ -2328,11 +2382,9 @@ static const struct ethtool_ops igb_ethtool_ops = { · 20 unmodified lines
2328 .get_ethtool_stats = igb_get_ethtool_stats,2382 .get_ethtool_stats = igb_get_ethtool_stats,
2329 .get_coalesce = igb_get_coalesce,2383 .get_coalesce = igb_get_coalesce,
2330 .set_coalesce = igb_set_coalesce,2384 .set_coalesce = igb_set_coalesce,
2385 .get_ts_info = igb_get_ts_info,
2331 .begin = igb_ethtool_begin,2386 .begin = igb_ethtool_begin,
2332 .complete = igb_ethtool_complete,2387 .complete = igb_ethtool_complete,
2333#ifdef CONFIG_IGB_PTP
2334 .get_ts_info = igb_ethtool_get_ts_info,
2335#endif
2336};2388};
2337 2389
2338void igb_set_ethtool_ops(struct net_device *netdev)2390void 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
172 172
173#ifdef CONFIG_PCI_IOV173#ifdef CONFIG_PCI_IOV
174static int igb_vf_configure(struct igb_adapter *adapter, int vf);174static int igb_vf_configure(struct igb_adapter *adapter, int vf);
175static int igb_find_enabled_vfs(struct igb_adapter *adapter);175static bool igb_vfs_are_assigned(struct igb_adapter *adapter);
176static int igb_check_vf_assignment(struct igb_adapter *adapter);
177#endif176#endif
178 177
179#ifdef CONFIG_PM178#ifdef CONFIG_PM
@@ -404,8 +403,8 @@ static void igb_dump(struct igb_adapter *adapter) · 224 unmodified lines
404 buffer_info = &tx_ring->tx_buffer_info[tx_ring->next_to_clean];403 buffer_info = &tx_ring->tx_buffer_info[tx_ring->next_to_clean];
405 pr_info(" %5d %5X %5X %016llX %04X %p %016llX\n",404 pr_info(" %5d %5X %5X %016llX %04X %p %016llX\n",
406 n, tx_ring->next_to_use, tx_ring->next_to_clean,405 n, tx_ring->next_to_use, tx_ring->next_to_clean,
407 (u64)buffer_info->dma,406 (u64)dma_unmap_addr(buffer_info, dma),
408 buffer_info->length,407 dma_unmap_len(buffer_info, len),
409 buffer_info->next_to_watch,408 buffer_info->next_to_watch,
410 (u64)buffer_info->time_stamp);409 (u64)buffer_info->time_stamp);
411 }410 }
@@ -456,8 +455,8 @@ static void igb_dump(struct igb_adapter *adapter) · 44 unmodified lines
456 " %04X %p %016llX %p%s\n", i,455 " %04X %p %016llX %p%s\n", i,
457 le64_to_cpu(u0->a),456 le64_to_cpu(u0->a),
458 le64_to_cpu(u0->b),457 le64_to_cpu(u0->b),
459 (u64)buffer_info->dma,458 (u64)dma_unmap_addr(buffer_info, dma),
460 buffer_info->length,459 dma_unmap_len(buffer_info, len),
461 buffer_info->next_to_watch,460 buffer_info->next_to_watch,
462 (u64)buffer_info->time_stamp,461 (u64)buffer_info->time_stamp,
463 buffer_info->skb, next_desc);462 buffer_info->skb, next_desc);
@@ -466,7 +465,8 @@ static void igb_dump(struct igb_adapter *adapter) · 2 unmodified lines
466 print_hex_dump(KERN_INFO, "",465 print_hex_dump(KERN_INFO, "",
467 DUMP_PREFIX_ADDRESS,466 DUMP_PREFIX_ADDRESS,
468 16, 1, buffer_info->skb->data,467 16, 1, buffer_info->skb->data,
469 buffer_info->length, true);468 dma_unmap_len(buffer_info, len),
469 true);
470 }470 }
471 }471 }
472 472
@@ -683,52 +683,29 @@ static int igb_alloc_queues(struct igb_adapter *adapter) · 210 unmodified lines
683{683{
684 struct igb_ring *ring;684 struct igb_ring *ring;
685 int i;685 int i;
686 int orig_node = adapter->node;
687 686
688 for (i = 0; i < adapter->num_tx_queues; i++) {687 for (i = 0; i < adapter->num_tx_queues; i++) {
689 if (orig_node == -1) {688 ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
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);
699 if (!ring)689 if (!ring)
700 goto err;690 goto err;
701 ring->count = adapter->tx_ring_count;691 ring->count = adapter->tx_ring_count;
702 ring->queue_index = i;692 ring->queue_index = i;
703 ring->dev = &adapter->pdev->dev;693 ring->dev = &adapter->pdev->dev;
704 ring->netdev = adapter->netdev;694 ring->netdev = adapter->netdev;
705 ring->numa_node = adapter->node;
706 /* For 82575, context index must be unique per ring. */695 /* For 82575, context index must be unique per ring. */
707 if (adapter->hw.mac.type == e1000_82575)696 if (adapter->hw.mac.type == e1000_82575)
708 set_bit(IGB_RING_FLAG_TX_CTX_IDX, &ring->flags);697 set_bit(IGB_RING_FLAG_TX_CTX_IDX, &ring->flags);
709 adapter->tx_ring[i] = ring;698 adapter->tx_ring[i] = ring;
710 }699 }
711 /* Restore the adapter's original node */
712 adapter->node = orig_node;
713 700
714 for (i = 0; i < adapter->num_rx_queues; i++) {701 for (i = 0; i < adapter->num_rx_queues; i++) {
715 if (orig_node == -1) {702 ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
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);
725 if (!ring)703 if (!ring)
726 goto err;704 goto err;
727 ring->count = adapter->rx_ring_count;705 ring->count = adapter->rx_ring_count;
728 ring->queue_index = i;706 ring->queue_index = i;
729 ring->dev = &adapter->pdev->dev;707 ring->dev = &adapter->pdev->dev;
730 ring->netdev = adapter->netdev;708 ring->netdev = adapter->netdev;
731 ring->numa_node = adapter->node;
732 /* set flag indicating ring supports SCTP checksum offload */709 /* set flag indicating ring supports SCTP checksum offload */
733 if (adapter->hw.mac.type >= e1000_82576)710 if (adapter->hw.mac.type >= e1000_82576)
734 set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags);711 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
742 719
743 adapter->rx_ring[i] = ring;720 adapter->rx_ring[i] = ring;
744 }721 }
745 /* Restore the adapter's original node */
746 adapter->node = orig_node;
747 722
748 igb_cache_ring_register(adapter);723 igb_cache_ring_register(adapter);
749 724
750 return 0;725 return 0;
751 726
752err:727err:
753 /* Restore the adapter's original node */
754 adapter->node = orig_node;
755 igb_free_queues(adapter);728 igb_free_queues(adapter);
756 729
757 return -ENOMEM;730 return -ENOMEM;
@@ -1117,24 +1090,10 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter) · 359 unmodified lines
1117 struct igb_q_vector *q_vector;1090 struct igb_q_vector *q_vector;
1118 struct e1000_hw *hw = &adapter->hw;1091 struct e1000_hw *hw = &adapter->hw;
1119 int v_idx;1092 int v_idx;
1120 int orig_node = adapter->node;
1121 1093
1122 for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) {1094 for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) {
1123 if ((adapter->num_q_vectors == (adapter->num_rx_queues +1095 q_vector = kzalloc(sizeof(struct igb_q_vector),
1124 adapter->num_tx_queues)) &&1096 GFP_KERNEL);
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);
1138 if (!q_vector)1097 if (!q_vector)
1139 goto err_out;1098 goto err_out;
1140 q_vector->adapter = adapter;1099 q_vector->adapter = adapter;
@@ -1143,14 +1102,10 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter) · 2 unmodified lines
1143 netif_napi_add(adapter->netdev, &q_vector->napi, igb_poll, 64);1102 netif_napi_add(adapter->netdev, &q_vector->napi, igb_poll, 64);
1144 adapter->q_vector[v_idx] = q_vector;1103 adapter->q_vector[v_idx] = q_vector;
1145 }1104 }
1146 /* Restore the adapter's original node */
1147 adapter->node = orig_node;
1148 1105
1149 return 0;1106 return 0;
1150 1107
1151err_out:1108err_out:
1152 /* Restore the adapter's original node */
1153 adapter->node = orig_node;
1154 igb_free_q_vectors(adapter);1109 igb_free_q_vectors(adapter);
1155 return -ENOMEM;1110 return -ENOMEM;
1156}1111}
@@ -1751,6 +1706,11 @@ void igb_reset(struct igb_adapter *adapter) · 594 unmodified lines
1751 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */1706 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
1752 wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE);1707 wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE);
1753 1708
1709#ifdef CONFIG_IGB_PTP
1710 /* Re-enable PTP, where applicable. */
1711 igb_ptp_reset(adapter);
1712#endif /* CONFIG_IGB_PTP */
1713
1754 igb_get_phy_info(hw);1714 igb_get_phy_info(hw);
1755}1715}
1756 1716
@@ -2180,11 +2140,12 @@ static int __devinit igb_probe(struct pci_dev *pdev, · 423 unmodified lines
2180 }2140 }
2181 2141
2182#endif2142#endif
2143
2183#ifdef CONFIG_IGB_PTP2144#ifdef CONFIG_IGB_PTP
2184 /* do hw tstamp init after resetting */2145 /* do hw tstamp init after resetting */
2185 igb_ptp_init(adapter);2146 igb_ptp_init(adapter);
2147#endif /* CONFIG_IGB_PTP */
2186 2148
2187#endif
2188 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");2149 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
2189 /* print bus type/speed/width info */2150 /* print bus type/speed/width info */
2190 dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n",2151 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
2259 2220
2260 pm_runtime_get_noresume(&pdev->dev);2221 pm_runtime_get_noresume(&pdev->dev);
2261#ifdef CONFIG_IGB_PTP2222#ifdef CONFIG_IGB_PTP
2262 igb_ptp_remove(adapter);2223 igb_ptp_stop(adapter);
2224#endif /* CONFIG_IGB_PTP */
2263 2225
2264#endif
2265 /*2226 /*
2266 * The watchdog timer may be rescheduled, so explicitly2227 * The watchdog timer may be rescheduled, so explicitly
2267 * disable watchdog from being rescheduled.2228 * disable watchdog from being rescheduled.
@@ -2294,11 +2255,11 @@ static void __devexit igb_remove(struct pci_dev *pdev) · 26 unmodified lines
2294 /* reclaim resources allocated to VFs */2255 /* reclaim resources allocated to VFs */
2295 if (adapter->vf_data) {2256 if (adapter->vf_data) {
2296 /* disable iov and allow time for transactions to clear */2257 /* 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 {
2298 pci_disable_sriov(pdev);2261 pci_disable_sriov(pdev);
2299 msleep(500);2262 msleep(500);
2300 } else {
2301 dev_info(&pdev->dev, "VF(s) assigned to guests!\n");
2302 }2263 }
2303 2264
2304 kfree(adapter->vf_data);2265 kfree(adapter->vf_data);
@@ -2338,7 +2299,7 @@ static void __devinit igb_probe_vfs(struct igb_adapter * adapter) · 33 unmodified lines
2338#ifdef CONFIG_PCI_IOV2299#ifdef CONFIG_PCI_IOV
2339 struct pci_dev *pdev = adapter->pdev;2300 struct pci_dev *pdev = adapter->pdev;
2340 struct e1000_hw *hw = &adapter->hw;2301 struct e1000_hw *hw = &adapter->hw;
2341 int old_vfs = igb_find_enabled_vfs(adapter);2302 int old_vfs = pci_num_vf(adapter->pdev);
2342 int i;2303 int i;
2343 2304
2344 /* Virtualization features not supported on i210 family. */2305 /* Virtualization features not supported on i210 family. */
@@ -2418,8 +2379,6 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) · 73 unmodified lines
2418 VLAN_HLEN;2379 VLAN_HLEN;
2419 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;2380 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
2420 2381
2421 adapter->node = -1;
2422
2423 spin_lock_init(&adapter->stats64_lock);2382 spin_lock_init(&adapter->stats64_lock);
2424#ifdef CONFIG_PCI_IOV2383#ifdef CONFIG_PCI_IOV
2425 switch (hw->mac.type) {2384 switch (hw->mac.type) {
@@ -2666,13 +2625,11 @@ static int igb_close(struct net_device *netdev) · 240 unmodified lines
2666int igb_setup_tx_resources(struct igb_ring *tx_ring)2625int igb_setup_tx_resources(struct igb_ring *tx_ring)
2667{2626{
2668 struct device *dev = tx_ring->dev;2627 struct device *dev = tx_ring->dev;
2669 int orig_node = dev_to_node(dev);
2670 int size;2628 int size;
2671 2629
2672 size = sizeof(struct igb_tx_buffer) * tx_ring->count;2630 size = sizeof(struct igb_tx_buffer) * tx_ring->count;
2673 tx_ring->tx_buffer_info = vzalloc_node(size, tx_ring->numa_node);2631
2674 if (!tx_ring->tx_buffer_info)2632 tx_ring->tx_buffer_info = vzalloc(size);
2675 tx_ring->tx_buffer_info = vzalloc(size);
2676 if (!tx_ring->tx_buffer_info)2633 if (!tx_ring->tx_buffer_info)
2677 goto err;2634 goto err;
2678 2635
@@ -2680,18 +2637,10 @@ int igb_setup_tx_resources(struct igb_ring *tx_ring) · 1 unmodified line
2680 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);2637 tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
2681 tx_ring->size = ALIGN(tx_ring->size, 4096);2638 tx_ring->size = ALIGN(tx_ring->size, 4096);
2682 2639
2683 set_dev_node(dev, tx_ring->numa_node);
2684 tx_ring->desc = dma_alloc_coherent(dev,2640 tx_ring->desc = dma_alloc_coherent(dev,
2685 tx_ring->size,2641 tx_ring->size,
2686 &tx_ring->dma,2642 &tx_ring->dma,
2687 GFP_KERNEL);2643 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
2695 if (!tx_ring->desc)2644 if (!tx_ring->desc)
2696 goto err;2645 goto err;
2697 2646
@@ -2702,8 +2651,8 @@ int igb_setup_tx_resources(struct igb_ring *tx_ring) · 4 unmodified lines
2702 2651
2703err:2652err:
2704 vfree(tx_ring->tx_buffer_info);2653 vfree(tx_ring->tx_buffer_info);
2705 dev_err(dev,2654 tx_ring->tx_buffer_info = NULL;
2706 "Unable to allocate memory for the transmit descriptor ring\n");2655 dev_err(dev, "Unable to allocate memory for the Tx descriptor ring\n");
2707 return -ENOMEM;2656 return -ENOMEM;
2708}2657}
2709 2658
@@ -2820,34 +2769,23 @@ static void igb_configure_tx(struct igb_adapter *adapter) · 110 unmodified lines
2820int igb_setup_rx_resources(struct igb_ring *rx_ring)2769int igb_setup_rx_resources(struct igb_ring *rx_ring)
2821{2770{
2822 struct device *dev = rx_ring->dev;2771 struct device *dev = rx_ring->dev;
2823 int orig_node = dev_to_node(dev);2772 int size;
2824 int size, desc_len;
2825 2773
2826 size = sizeof(struct igb_rx_buffer) * rx_ring->count;2774 size = sizeof(struct igb_rx_buffer) * rx_ring->count;
2827 rx_ring->rx_buffer_info = vzalloc_node(size, rx_ring->numa_node);2775
2828 if (!rx_ring->rx_buffer_info)2776 rx_ring->rx_buffer_info = vzalloc(size);
2829 rx_ring->rx_buffer_info = vzalloc(size);
2830 if (!rx_ring->rx_buffer_info)2777 if (!rx_ring->rx_buffer_info)
2831 goto err;2778 goto err;
2832 2779
2833 desc_len = sizeof(union e1000_adv_rx_desc);
2834 2780
2835 /* Round up to nearest 4K */2781 /* 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);
2837 rx_ring->size = ALIGN(rx_ring->size, 4096);2783 rx_ring->size = ALIGN(rx_ring->size, 4096);
2838 2784
2839 set_dev_node(dev, rx_ring->numa_node);
2840 rx_ring->desc = dma_alloc_coherent(dev,2785 rx_ring->desc = dma_alloc_coherent(dev,
2841 rx_ring->size,2786 rx_ring->size,
2842 &rx_ring->dma,2787 &rx_ring->dma,
2843 GFP_KERNEL);2788 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
2851 if (!rx_ring->desc)2789 if (!rx_ring->desc)
2852 goto err;2790 goto err;
2853 2791
@@ -2859,8 +2797,7 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) · 5 unmodified lines
2859err:2797err:
2860 vfree(rx_ring->rx_buffer_info);2798 vfree(rx_ring->rx_buffer_info);
2861 rx_ring->rx_buffer_info = NULL;2799 rx_ring->rx_buffer_info = NULL;
2862 dev_err(dev, "Unable to allocate memory for the receive descriptor"2800 dev_err(dev, "Unable to allocate memory for the Rx descriptor ring\n");
2863 " ring\n");
2864 return -ENOMEM;2801 return -ENOMEM;
2865}2802}
2866 2803
@@ -2898,57 +2835,48 @@ static void igb_setup_mrqc(struct igb_adapter *adapter) · 31 unmodified lines
2898{2835{
2899 struct e1000_hw *hw = &adapter->hw;2836 struct e1000_hw *hw = &adapter->hw;
2900 u32 mrqc, rxcsum;2837 u32 mrqc, rxcsum;
2901 u32 j, num_rx_queues, shift = 0, shift2 = 0;2838 u32 j, num_rx_queues, shift = 0;
2902 union e1000_reta {2839 static const u32 rsskey[10] = { 0xDA565A6D, 0xC20E5B25, 0x3D256741,
2903 u32 dword;2840 0xB08FA343, 0xCB2BCAD0, 0xB4307BAE,
2904 u8 bytes[4];2841 0xA32DCB77, 0x0CF23080, 0x3BB7426A,
2905 } reta;2842 0xFA01ACBE };
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 };
2911 2843
2912 /* Fill out hash function seeds */2844 /* Fill out hash function seeds */
2913 for (j = 0; j < 10; j++) {2845 for (j = 0; j < 10; j++)
2914 u32 rsskey = rsshash[(j * 4)];2846 wr32(E1000_RSSRK(j), rsskey[j]);
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 }
2920 2847
2921 num_rx_queues = adapter->rss_queues;2848 num_rx_queues = adapter->rss_queues;
2922 2849
2923 if (adapter->vfs_allocated_count) {2850 switch (hw->mac.type) {
2924 /* 82575 and 82576 supports 2 RSS queues for VMDq */2851 case e1000_82575:
2925 switch (hw->mac.type) {2852 shift = 6;
2926 case e1000_i350:2853 break;
2927 case e1000_82580:2854 case e1000_82576:
2928 num_rx_queues = 1;2855 /* 82576 supports 2 RSS queues for SR-IOV */
2929 shift = 0;2856 if (adapter->vfs_allocated_count) {
2930 break;
2931 case e1000_82576:
2932 shift = 3;2857 shift = 3;
2933 num_rx_queues = 2;2858 num_rx_queues = 2;
2934 break;
2935 case e1000_82575:
2936 shift = 2;
2937 shift2 = 6;
2938 default:
2939 break;
2940 }2859 }
2941 } else {2860 break;
2942 if (hw->mac.type == e1000_82575)2861 default:
2943 shift = 6;2862 break;
2944 }2863 }
2945 2864
2946 for (j = 0; j < (32 * 4); j++) {2865 /*
2947 reta.bytes[j & 3] = (j % num_rx_queues) << shift;2866 * Populate the indirection table 4 entries at a time. To do this
2948 if (shift2)2867 * we are generating the results for n and n+2 and then interleaving
2949 reta.bytes[j & 3] |= num_rx_queues << shift2;2868 * those with the results with n+1 and n+3.
2950 if ((j & 3) == 3)2869 */
2951 wr32(E1000_RETA(j >> 2), reta.dword);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);
2952 }2880 }
2953 2881
2954 /*2882 /*
@@ -3184,8 +3112,10 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, · 229 unmodified lines
3184 srrctl |= (PAGE_SIZE / 2) >> E1000_SRRCTL_BSIZEPKT_SHIFT;3112 srrctl |= (PAGE_SIZE / 2) >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3185#endif3113#endif
3186 srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;3114 srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
3115#ifdef CONFIG_IGB_PTP
3187 if (hw->mac.type >= e1000_82580)3116 if (hw->mac.type >= e1000_82580)
3188 srrctl |= E1000_SRRCTL_TIMESTAMP;3117 srrctl |= E1000_SRRCTL_TIMESTAMP;
3118#endif /* CONFIG_IGB_PTP */
3189 /* Only set Drop Enable if we are supporting multiple queues */3119 /* Only set Drop Enable if we are supporting multiple queues */
3190 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)3120 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)
3191 srrctl |= E1000_SRRCTL_DROP_EN;3121 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -3269,20 +3199,20 @@ void igb_unmap_and_free_tx_resource(struct igb_ring *ring, · 77 unmodified lines
3269{3199{
3270 if (tx_buffer->skb) {3200 if (tx_buffer->skb) {
3271 dev_kfree_skb_any(tx_buffer->skb);3201 dev_kfree_skb_any(tx_buffer->skb);
3272 if (tx_buffer->dma)3202 if (dma_unmap_len(tx_buffer, len))
3273 dma_unmap_single(ring->dev,3203 dma_unmap_single(ring->dev,
3274 tx_buffer->dma,3204 dma_unmap_addr(tx_buffer, dma),
3275 tx_buffer->length,3205 dma_unmap_len(tx_buffer, len),
3276 DMA_TO_DEVICE);3206 DMA_TO_DEVICE);
3277 } else if (tx_buffer->dma) {3207 } else if (dma_unmap_len(tx_buffer, len)) {
3278 dma_unmap_page(ring->dev,3208 dma_unmap_page(ring->dev,
3279 tx_buffer->dma,3209 dma_unmap_addr(tx_buffer, dma),
3280 tx_buffer->length,3210 dma_unmap_len(tx_buffer, len),
3281 DMA_TO_DEVICE);3211 DMA_TO_DEVICE);
3282 }3212 }
3283 tx_buffer->next_to_watch = NULL;3213 tx_buffer->next_to_watch = NULL;
3284 tx_buffer->skb = NULL;3214 tx_buffer->skb = NULL;
3285 tx_buffer->dma = 0;3215 dma_unmap_len_set(tx_buffer, len, 0);
3286 /* buffer_info must be completely set up in the transmit path */3216 /* buffer_info must be completely set up in the transmit path */
3287}3217}
3288 3218
@@ -4229,9 +4159,11 @@ static __le32 igb_tx_cmd_type(u32 tx_flags) · 940 unmodified lines
4229 if (tx_flags & IGB_TX_FLAGS_VLAN)4159 if (tx_flags & IGB_TX_FLAGS_VLAN)
4230 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE);4160 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE);
4231 4161
4162#ifdef CONFIG_IGB_PTP
4232 /* set timestamp bit if present */4163 /* set timestamp bit if present */
4233 if (tx_flags & IGB_TX_FLAGS_TSTAMP)4164 if (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP))
4234 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP);4165 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP);
4166#endif /* CONFIG_IGB_PTP */
4235 4167
4236 /* set segmentation bits for TSO */4168 /* set segmentation bits for TSO */
4237 if (tx_flags & IGB_TX_FLAGS_TSO)4169 if (tx_flags & IGB_TX_FLAGS_TSO)
@@ -4275,7 +4207,7 @@ static void igb_tx_map(struct igb_ring *tx_ring, · 37 unmodified lines
4275 const u8 hdr_len)4207 const u8 hdr_len)
4276{4208{
4277 struct sk_buff *skb = first->skb;4209 struct sk_buff *skb = first->skb;
4278 struct igb_tx_buffer *tx_buffer_info;4210 struct igb_tx_buffer *tx_buffer;
4279 union e1000_adv_tx_desc *tx_desc;4211 union e1000_adv_tx_desc *tx_desc;
4280 dma_addr_t dma;4212 dma_addr_t dma;
4281 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];4213 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
4296 goto dma_error;4228 goto dma_error;
4297 4229
4298 /* record length, and DMA address */4230 /* record length, and DMA address */
4299 first->length = size;4231 dma_unmap_len_set(first, len, size);
4300 first->dma = dma;4232 dma_unmap_addr_set(first, dma, dma);
4301 tx_desc->read.buffer_addr = cpu_to_le64(dma);4233 tx_desc->read.buffer_addr = cpu_to_le64(dma);
4302 4234
4303 for (;;) {4235 for (;;) {
@@ -4339,9 +4271,9 @@ static void igb_tx_map(struct igb_ring *tx_ring, · 35 unmodified lines
4339 if (dma_mapping_error(tx_ring->dev, dma))4271 if (dma_mapping_error(tx_ring->dev, dma))
4340 goto dma_error;4272 goto dma_error;
4341 4273
4342 tx_buffer_info = &tx_ring->tx_buffer_info[i];4274 tx_buffer = &tx_ring->tx_buffer_info[i];
4343 tx_buffer_info->length = size;4275 dma_unmap_len_set(tx_buffer, len, size);
4344 tx_buffer_info->dma = dma;4276 dma_unmap_addr_set(tx_buffer, dma, dma);
4345 4277
4346 tx_desc->read.olinfo_status = 0;4278 tx_desc->read.olinfo_status = 0;
4347 tx_desc->read.buffer_addr = cpu_to_le64(dma);4279 tx_desc->read.buffer_addr = cpu_to_le64(dma);
@@ -4392,9 +4324,9 @@ dma_error: · 44 unmodified lines
4392 4324
4393 /* clear dma mappings for failed tx_buffer_info map */4325 /* clear dma mappings for failed tx_buffer_info map */
4394 for (;;) {4326 for (;;) {
4395 tx_buffer_info = &tx_ring->tx_buffer_info[i];4327 tx_buffer = &tx_ring->tx_buffer_info[i];
4396 igb_unmap_and_free_tx_resource(tx_ring, tx_buffer_info);4328 igb_unmap_and_free_tx_resource(tx_ring, tx_buffer);
4397 if (tx_buffer_info == first)4329 if (tx_buffer == first)
4398 break;4330 break;
4399 if (i == 0)4331 if (i == 0)
4400 i = tx_ring->count;4332 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
4440netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,4372netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4441 struct igb_ring *tx_ring)4373 struct igb_ring *tx_ring)
4442{4374{
4375#ifdef CONFIG_IGB_PTP
4376 struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
4377#endif /* CONFIG_IGB_PTP */
4443 struct igb_tx_buffer *first;4378 struct igb_tx_buffer *first;
4444 int tso;4379 int tso;
4445 u32 tx_flags = 0;4380 u32 tx_flags = 0;
@@ -4462,10 +4397,17 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, · 16 unmodified lines
4462 first->bytecount = skb->len;4397 first->bytecount = skb->len;
4463 first->gso_segs = 1;4398 first->gso_segs = 1;
4464 4399
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))) {
4466 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;4403 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
4467 tx_flags |= IGB_TX_FLAGS_TSTAMP;4404 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);
4468 }4409 }
4410#endif /* CONFIG_IGB_PTP */
4469 4411
4470 if (vlan_tx_tag_present(skb)) {4412 if (vlan_tx_tag_present(skb)) {
4471 tx_flags |= IGB_TX_FLAGS_VLAN;4413 tx_flags |= IGB_TX_FLAGS_VLAN;
@@ -4661,11 +4603,13 @@ void igb_update_stats(struct igb_adapter *adapter, · 189 unmodified lines
4661 bytes = 0;4603 bytes = 0;
4662 packets = 0;4604 packets = 0;
4663 for (i = 0; i < adapter->num_rx_queues; i++) {4605 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));
4665 struct igb_ring *ring = adapter->rx_ring[i];4607 struct igb_ring *ring = adapter->rx_ring[i];
4666 4608
4667 ring->rx_stats.drops += rqdpc_tmp;4609 if (rqdpc) {
4668 net_stats->rx_fifo_errors += rqdpc_tmp;4610 ring->rx_stats.drops += rqdpc;
4611 net_stats->rx_fifo_errors += rqdpc;
4612 }
4669 4613
4670 do {4614 do {
4671 start = u64_stats_fetch_begin_bh(&ring->rx_syncp);4615 start = u64_stats_fetch_begin_bh(&ring->rx_syncp);
@@ -4755,7 +4699,11 @@ void igb_update_stats(struct igb_adapter *adapter, · 83 unmodified lines
4755 reg = rd32(E1000_CTRL_EXT);4699 reg = rd32(E1000_CTRL_EXT);
4756 if (!(reg & E1000_CTRL_EXT_LINK_MODE_MASK)) {4700 if (!(reg & E1000_CTRL_EXT_LINK_MODE_MASK)) {
4757 adapter->stats.rxerrc += rd32(E1000_RXERRC);4701 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);
4759 }4707 }
4760 4708
4761 adapter->stats.tsctc += rd32(E1000_TSCTC);4709 adapter->stats.tsctc += rd32(E1000_TSCTC);
@@ -4852,6 +4800,19 @@ static irqreturn_t igb_msix_other(int irq, void *data) · 90 unmodified lines
4852 mod_timer(&adapter->watchdog_timer, jiffies + 1);4800 mod_timer(&adapter->watchdog_timer, jiffies + 1);
4853 }4801 }
4854 4802
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
4855 wr32(E1000_EIMS, adapter->eims_other);4816 wr32(E1000_EIMS, adapter->eims_other);
4856 4817
4857 return IRQ_HANDLED;4818 return IRQ_HANDLED;
@@ -5002,102 +4963,43 @@ static int igb_notify_dca(struct notifier_block *nb, unsigned long event, · 144 unmodified lines
5002static int igb_vf_configure(struct igb_adapter *adapter, int vf)4963static int igb_vf_configure(struct igb_adapter *adapter, int vf)
5003{4964{
5004 unsigned char mac_addr[ETH_ALEN];4965 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;
5010 4966
5011 eth_random_addr(mac_addr);4967 eth_random_addr(mac_addr);
5012 igb_set_vf_mac(adapter, vf, mac_addr);4968 igb_set_vf_mac(adapter, vf, mac_addr);
5013 4969
5014 switch (adapter->hw.mac.type) {4970 return 0;
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;
5048}4971}
5049 4972
5050static int igb_find_enabled_vfs(struct igb_adapter *adapter)4973static bool igb_vfs_are_assigned(struct igb_adapter *adapter)
5051{4974{
5052 struct e1000_hw *hw = &adapter->hw;
5053 struct pci_dev *pdev = adapter->pdev;4975 struct pci_dev *pdev = adapter->pdev;
5054 struct pci_dev *pvfdev;4976 struct pci_dev *vfdev;
5055 u16 vf_devfn = 0;4977 int dev_id;
5056 u16 vf_stride;
5057 unsigned int device_id;
5058 int vfs_found = 0;
5059 4978
5060 switch (adapter->hw.mac.type) {4979 switch (adapter->hw.mac.type) {
5061 case e1000_82576:4980 case e1000_82576:
5062 device_id = IGB_82576_VF_DEV_ID;4981 dev_id = IGB_82576_VF_DEV_ID;
5063 /* VF Stride for 82576 is 2 */
5064 vf_stride = 2;
5065 break;4982 break;
5066 case e1000_i350:4983 case e1000_i350:
5067 device_id = IGB_I350_VF_DEV_ID;4984 dev_id = IGB_I350_VF_DEV_ID;
5068 /* VF Stride for I350 is 4 */
5069 vf_stride = 4;
5070 break;4985 break;
5071 default:4986 default:
5072 device_id = 0;4987 return false;
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);
5086 }4988 }
5087 4989
5088 return vfs_found;4990 /* loop through all the VFs to see if we own any that are assigned */
5089}4991 vfdev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL);
5090 4992 while (vfdev) {
5091static int igb_check_vf_assignment(struct igb_adapter *adapter)4993 /* if we don't own it we don't care */
5092{4994 if (vfdev->is_virtfn && vfdev->physfn == pdev) {
5093 int i;4995 /* if it is assigned we cannot release it */
5094 for (i = 0; i < adapter->vfs_allocated_count; i++) {4996 if (vfdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
5095 if (adapter->vf_data[i].vfdev) {
5096 if (adapter->vf_data[i].vfdev->dev_flags &
5097 PCI_DEV_FLAGS_ASSIGNED)
5098 return true;4997 return true;
5099 }4998 }
4999
5000 vfdev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, vfdev);
5100 }5001 }
5002
5101 return false;5003 return false;
5102}5004}
5103 5005
@@ -5643,6 +5545,19 @@ static irqreturn_t igb_intr_msi(int irq, void *data) · 539 unmodified lines
5643 mod_timer(&adapter->watchdog_timer, jiffies + 1);5545 mod_timer(&adapter->watchdog_timer, jiffies + 1);
5644 }5546 }
5645 5547
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
5646 napi_schedule(&q_vector->napi);5561 napi_schedule(&q_vector->napi);
5647 5562
5648 return IRQ_HANDLED;5563 return IRQ_HANDLED;
@@ -5684,6 +5599,19 @@ static irqreturn_t igb_intr(int irq, void *data) · 35 unmodified lines
5684 mod_timer(&adapter->watchdog_timer, jiffies + 1);5599 mod_timer(&adapter->watchdog_timer, jiffies + 1);
5685 }5600 }
5686 5601
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
5687 napi_schedule(&q_vector->napi);5615 napi_schedule(&q_vector->napi);
5688 5616
5689 return IRQ_HANDLED;5617 return IRQ_HANDLED;
@@ -5743,37 +5671,6 @@ static int igb_poll(struct napi_struct *napi, int budget) · 53 unmodified lines
5743 return 0;5671 return 0;
5744}5672}
5745 5673
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 */
5756static 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
5777/**5674/**
5778 * igb_clean_tx_irq - Reclaim resources after transmit completes5675 * igb_clean_tx_irq - Reclaim resources after transmit completes
5779 * @q_vector: pointer to q_vector containing needed info5676 * @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
5785 struct igb_adapter *adapter = q_vector->adapter;5682 struct igb_adapter *adapter = q_vector->adapter;
5786 struct igb_ring *tx_ring = q_vector->tx.ring;5683 struct igb_ring *tx_ring = q_vector->tx.ring;
5787 struct igb_tx_buffer *tx_buffer;5684 struct igb_tx_buffer *tx_buffer;
5788 union e1000_adv_tx_desc *tx_desc, *eop_desc;5685 union e1000_adv_tx_desc *tx_desc;
5789 unsigned int total_bytes = 0, total_packets = 0;5686 unsigned int total_bytes = 0, total_packets = 0;
5790 unsigned int budget = q_vector->tx.work_limit;5687 unsigned int budget = q_vector->tx.work_limit;
5791 unsigned int i = tx_ring->next_to_clean;5688 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
5797 tx_desc = IGB_TX_DESC(tx_ring, i);5694 tx_desc = IGB_TX_DESC(tx_ring, i);
5798 i -= tx_ring->count;5695 i -= tx_ring->count;
5799 5696
5800 for (; budget; budget--) {5697 do {
5801 eop_desc = tx_buffer->next_to_watch;5698 union e1000_adv_tx_desc *eop_desc = tx_buffer->next_to_watch;
5802
5803 /* prevent any other reads prior to eop_desc */
5804 rmb();
5805 5699
5806 /* if next_to_watch is not set then there is no work pending */5700 /* if next_to_watch is not set then there is no work pending */
5807 if (!eop_desc)5701 if (!eop_desc)
5808 break;5702 break;
5809 5703
5704 /* prevent any other reads prior to eop_desc */
5705 rmb();
5706
5810 /* if DD is not set pending work has not been completed */5707 /* if DD is not set pending work has not been completed */
5811 if (!(eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)))5708 if (!(eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)))
5812 break;5709 break;
@@ -5818,25 +5715,21 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 5 unmodified lines
5818 total_bytes += tx_buffer->bytecount;5715 total_bytes += tx_buffer->bytecount;
5819 total_packets += tx_buffer->gso_segs;5716 total_packets += tx_buffer->gso_segs;
5820 5717
5821#ifdef CONFIG_IGB_PTP
5822 /* retrieve hardware timestamp */
5823 igb_tx_hwtstamp(q_vector, tx_buffer);
5824
5825#endif
5826 /* free the skb */5718 /* free the skb */
5827 dev_kfree_skb_any(tx_buffer->skb);5719 dev_kfree_skb_any(tx_buffer->skb);
5828 tx_buffer->skb = NULL;
5829 5720
5830 /* unmap skb header data */5721 /* unmap skb header data */
5831 dma_unmap_single(tx_ring->dev,5722 dma_unmap_single(tx_ring->dev,
5832 tx_buffer->dma,5723 dma_unmap_addr(tx_buffer, dma),
5833 tx_buffer->length,5724 dma_unmap_len(tx_buffer, len),
5834 DMA_TO_DEVICE);5725 DMA_TO_DEVICE);
5835 5726
5727 /* clear tx_buffer data */
5728 tx_buffer->skb = NULL;
5729 dma_unmap_len_set(tx_buffer, len, 0);
5730
5836 /* clear last DMA location and unmap remaining buffers */5731 /* clear last DMA location and unmap remaining buffers */
5837 while (tx_desc != eop_desc) {5732 while (tx_desc != eop_desc) {
5838 tx_buffer->dma = 0;
5839
5840 tx_buffer++;5733 tx_buffer++;
5841 tx_desc++;5734 tx_desc++;
5842 i++;5735 i++;
@@ -5847,17 +5740,15 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 4 unmodified lines
5847 }5740 }
5848 5741
5849 /* unmap any remaining paged data */5742 /* unmap any remaining paged data */
5850 if (tx_buffer->dma) {5743 if (dma_unmap_len(tx_buffer, len)) {
5851 dma_unmap_page(tx_ring->dev,5744 dma_unmap_page(tx_ring->dev,
5852 tx_buffer->dma,5745 dma_unmap_addr(tx_buffer, dma),
5853 tx_buffer->length,5746 dma_unmap_len(tx_buffer, len),
5854 DMA_TO_DEVICE);5747 DMA_TO_DEVICE);
5748 dma_unmap_len_set(tx_buffer, len, 0);
5855 }5749 }
5856 }5750 }
5857 5751
5858 /* clear last DMA location */
5859 tx_buffer->dma = 0;
5860
5861 /* move us one more past the eop_desc for start of next pkt */5752 /* move us one more past the eop_desc for start of next pkt */
5862 tx_buffer++;5753 tx_buffer++;
5863 tx_desc++;5754 tx_desc++;
@@ -5867,7 +5758,13 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 3 unmodified lines
5867 tx_buffer = tx_ring->tx_buffer_info;5758 tx_buffer = tx_ring->tx_buffer_info;
5868 tx_desc = IGB_TX_DESC(tx_ring, 0);5759 tx_desc = IGB_TX_DESC(tx_ring, 0);
5869 }5760 }
5870 }5761
5762 /* issue prefetch for next Tx descriptor */
5763 prefetch(tx_desc);
5764
5765 /* update budget accounting */
5766 budget--;
5767 } while (likely(budget));
5871 5768
5872 netdev_tx_completed_queue(txring_txq(tx_ring),5769 netdev_tx_completed_queue(txring_txq(tx_ring),
5873 total_packets, total_bytes);5770 total_packets, total_bytes);
@@ -5883,12 +5780,10 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) · 9 unmodified lines
5883 if (test_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags)) {5780 if (test_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags)) {
5884 struct e1000_hw *hw = &adapter->hw;5781 struct e1000_hw *hw = &adapter->hw;
5885 5782
5886 eop_desc = tx_buffer->next_to_watch;
5887
5888 /* Detect a transmit hang in hardware, this serializes the5783 /* Detect a transmit hang in hardware, this serializes the
5889 * check with the clearing of time_stamp and movement of i */5784 * check with the clearing of time_stamp and movement of i */
5890 clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);5785 clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
5891 if (eop_desc &&5786 if (tx_buffer->next_to_watch &&
5892 time_after(jiffies, tx_buffer->time_stamp +5787 time_after(jiffies, tx_buffer->time_stamp +
5893 (adapter->tx_timeout_factor * HZ)) &&5788 (adapter->tx_timeout_factor * HZ)) &&
5894 !(rd32(E1000_STATUS) & E1000_STATUS_TXOFF)) {5789 !(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
5912 tx_ring->next_to_use,5807 tx_ring->next_to_use,
5913 tx_ring->next_to_clean,5808 tx_ring->next_to_clean,
5914 tx_buffer->time_stamp,5809 tx_buffer->time_stamp,
5915 eop_desc,5810 tx_buffer->next_to_watch,
5916 jiffies,5811 jiffies,
5917 eop_desc->wb.status);5812 tx_buffer->next_to_watch->wb.status);
5918 netif_stop_subqueue(tx_ring->netdev,5813 netif_stop_subqueue(tx_ring->netdev,
5919 tx_ring->queue_index);5814 tx_ring->queue_index);
5920 5815
@@ -5994,47 +5889,6 @@ static inline void igb_rx_hash(struct igb_ring *ring, · 73 unmodified lines
5994 skb->rxhash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);5889 skb->rxhash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);
5995}5890}
5996 5891
5997#ifdef CONFIG_IGB_PTP
5998static 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
6038static void igb_rx_vlan(struct igb_ring *ring,5892static void igb_rx_vlan(struct igb_ring *ring,
6039 union e1000_adv_rx_desc *rx_desc,5893 union e1000_adv_rx_desc *rx_desc,
6040 struct sk_buff *skb)5894 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
6146 }6000 }
6147 6001
6148#ifdef CONFIG_IGB_PTP6002#ifdef CONFIG_IGB_PTP
6149 igb_rx_hwtstamp(q_vector, rx_desc, skb);6003 igb_ptp_rx_hwtstamp(q_vector, rx_desc, skb);
6150#endif6004#endif /* CONFIG_IGB_PTP */
6151 igb_rx_hash(rx_ring, rx_desc, skb);6005 igb_rx_hash(rx_ring, rx_desc, skb);
6152 igb_rx_checksum(rx_ring, rx_desc, skb);6006 igb_rx_checksum(rx_ring, rx_desc, skb);
6153 igb_rx_vlan(rx_ring, rx_desc, skb);6007 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
6340 return 0;6194 return 0;
6341}6195}
6342 6196
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 **/
6362static 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
6518/**6197/**
6519 * igb_ioctl -6198 * igb_ioctl -
6520 * @netdev:6199 * @netdev:
@@ -6528,8 +6207,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) · 7 unmodified lines
6528 case SIOCGMIIREG:6207 case SIOCGMIIREG:
6529 case SIOCSMIIREG:6208 case SIOCSMIIREG:
6530 return igb_mii_ioctl(netdev, ifr, cmd);6209 return igb_mii_ioctl(netdev, ifr, cmd);
6210#ifdef CONFIG_IGB_PTP
6531 case SIOCSHWTSTAMP:6211 case SIOCSHWTSTAMP:
6532 return igb_hwtstamp_ioctl(netdev, ifr, cmd);6212 return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd);
6213#endif /* CONFIG_IGB_PTP */
6533 default:6214 default:
6534 return -EOPNOTSUPP;6215 return -EOPNOTSUPP;
6535 }6216 }
@@ -6667,6 +6348,10 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx) · 131 unmodified lines
6667 default:6348 default:
6668 goto err_inval;6349 goto err_inval;
6669 }6350 }
6351
6352 /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
6353 adapter->hw.phy.mdix = AUTO_ALL_MODES;
6354
6670 return 0;6355 return 0;
6671 6356
6672err_inval:6357err_inval:
drivers/net/ethernet/intel/igb/igb_ptp.c+561−116
@@ -69,22 +69,22 @@ · 68 unmodified lines
69 * 2^40 * 10^-9 / 60 = 18.3 minutes.69 * 2^40 * 10^-9 / 60 = 18.3 minutes.
70 */70 */
71 71
72#define IGB_OVERFLOW_PERIOD (HZ * 60 * 9)72#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 9)
73#define INCPERIOD_82576 (1 << E1000_TIMINCA_16NS_SHIFT)73#define INCPERIOD_82576 (1 << E1000_TIMINCA_16NS_SHIFT)
74#define INCVALUE_82576_MASK ((1 << E1000_TIMINCA_16NS_SHIFT) - 1)74#define INCVALUE_82576_MASK ((1 << E1000_TIMINCA_16NS_SHIFT) - 1)
75#define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)75#define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
76#define IGB_NBITS_82580 4076#define IGB_NBITS_82580 40
77 77
78/*78/*
79 * SYSTIM read access for the 8257679 * SYSTIM read access for the 82576
80 */80 */
81 81
82static cycle_t igb_82576_systim_read(const struct cyclecounter *cc)82static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
83{83{
84 u64 val;
85 u32 lo, hi;
86 struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);84 struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
87 struct e1000_hw *hw = &igb->hw;85 struct e1000_hw *hw = &igb->hw;
86 u64 val;
87 u32 lo, hi;
88 88
89 lo = rd32(E1000_SYSTIML);89 lo = rd32(E1000_SYSTIML);
90 hi = rd32(E1000_SYSTIMH);90 hi = rd32(E1000_SYSTIMH);
@@ -99,12 +99,12 @@ static cycle_t igb_82576_systim_read(const struct cyclecounter *cc) · 8 unmodified lines
99 * SYSTIM read access for the 8258099 * SYSTIM read access for the 82580
100 */100 */
101 101
102static cycle_t igb_82580_systim_read(const struct cyclecounter *cc)102static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
103{103{
104 u64 val;
105 u32 lo, hi, jk;
106 struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);104 struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
107 struct e1000_hw *hw = &igb->hw;105 struct e1000_hw *hw = &igb->hw;
106 u64 val;
107 u32 lo, hi, jk;
108 108
109 /*109 /*
110 * The timestamp latches on lowest register read. For the 82580110 * 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
121 return val;121 return val;
122}122}
123 123
124/*
125 * SYSTIM read access for I210/I211
126 */
127
128static 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
146static 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 **/
176static 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
124/*208/*
125 * PTP clock operations209 * PTP clock operations
126 */210 */
127 211
128static int ptp_82576_adjfreq(struct ptp_clock_info *ptp, s32 ppb)212static int igb_ptp_adjfreq_82576(struct ptp_clock_info *ptp, s32 ppb)
129{213{
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;
130 u64 rate;218 u64 rate;
131 u32 incvalue;219 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;
135 220
136 if (ppb < 0) {221 if (ppb < 0) {
137 neg_adj = 1;222 neg_adj = 1;
@@ -153,13 +238,14 @@ static int ptp_82576_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 15 unmodified lines
153 return 0;238 return 0;
154}239}
155 240
156static int ptp_82580_adjfreq(struct ptp_clock_info *ptp, s32 ppb)241static int igb_ptp_adjfreq_82580(struct ptp_clock_info *ptp, s32 ppb)
157{242{
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;
158 u64 rate;247 u64 rate;
159 u32 inca;248 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;
163 249
164 if (ppb < 0) {250 if (ppb < 0) {
165 neg_adj = 1;251 neg_adj = 1;
@@ -178,11 +264,12 @@ static int ptp_82580_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 12 unmodified lines
178 return 0;264 return 0;
179}265}
180 266
181static int igb_adjtime(struct ptp_clock_info *ptp, s64 delta)267static int igb_ptp_adjtime_82576(struct ptp_clock_info *ptp, s64 delta)
182{268{
183 s64 now;269 struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
270 ptp_caps);
184 unsigned long flags;271 unsigned long flags;
185 struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);272 s64 now;
186 273
187 spin_lock_irqsave(&igb->tmreg_lock, flags);274 spin_lock_irqsave(&igb->tmreg_lock, flags);
188 275
@@ -195,12 +282,32 @@ static int igb_adjtime(struct ptp_clock_info *ptp, s64 delta) · 6 unmodified lines
195 return 0;282 return 0;
196}283}
197 284
198static int igb_gettime(struct ptp_clock_info *ptp, struct timespec *ts)285static int igb_ptp_adjtime_i210(struct ptp_clock_info *ptp, s64 delta)
199{286{
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
303static 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;
200 u64 ns;309 u64 ns;
201 u32 remainder;310 u32 remainder;
202 unsigned long flags;
203 struct igb_adapter *igb = container_of(ptp, struct igb_adapter, caps);
204 311
205 spin_lock_irqsave(&igb->tmreg_lock, flags);312 spin_lock_irqsave(&igb->tmreg_lock, flags);
206 313
@@ -214,11 +321,29 @@ static int igb_gettime(struct ptp_clock_info *ptp, struct timespec *ts) · 7 unmodified lines
214 return 0;321 return 0;
215}322}
216 323
217static int igb_settime(struct ptp_clock_info *ptp, const struct timespec *ts)324static int igb_ptp_gettime_i210(struct ptp_clock_info *ptp,
325 struct timespec *ts)
218{326{
219 u64 ns;327 struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
328 ptp_caps);
220 unsigned long flags;329 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
340static 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;
222 347
223 ns = ts->tv_sec * 1000000000ULL;348 ns = ts->tv_sec * 1000000000ULL;
224 ns += ts->tv_nsec;349 ns += ts->tv_nsec;
@@ -232,77 +357,369 @@ static int igb_settime(struct ptp_clock_info *ptp, const struct timespec *ts) · 7 unmodified lines
232 return 0;357 return 0;
233}358}
234 359
235static int ptp_82576_enable(struct ptp_clock_info *ptp,360static int igb_ptp_settime_i210(struct ptp_clock_info *ptp,
236 struct ptp_clock_request *rq, int on)361 const struct timespec *ts)
237{362{
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;
239}374}
240 375
241static int ptp_82580_enable(struct ptp_clock_info *ptp,376static int igb_ptp_enable(struct ptp_clock_info *ptp,
242 struct ptp_clock_request *rq, int on)377 struct ptp_clock_request *rq, int on)
243{378{
244 return -EOPNOTSUPP;379 return -EOPNOTSUPP;
245}380}
246 381
247static 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 */
389void 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
407static void igb_ptp_overflow_check(struct work_struct *work)
248{408{
249 struct timespec ts;
250 struct igb_adapter *igb =409 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;
252 412
253 igb_gettime(&igb->caps, &ts);413 igb->ptp_caps.gettime(&igb->ptp_caps, &ts);
254 414
255 pr_debug("igb overflow check at %ld.%09lu\n", ts.tv_sec, ts.tv_nsec);415 pr_debug("igb overflow check at %ld.%09lu\n", ts.tv_sec, ts.tv_nsec);
256 416
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 */
429void 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
444void 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 **/
502int 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;
258}663}
259 664
260void igb_ptp_init(struct igb_adapter *adapter)665void igb_ptp_init(struct igb_adapter *adapter)
261{666{
262 struct e1000_hw *hw = &adapter->hw;667 struct e1000_hw *hw = &adapter->hw;
668 struct net_device *netdev = adapter->netdev;
263 669
264 switch (hw->mac.type) {670 switch (hw->mac.type) {
265 case e1000_i210:671 case e1000_82576:
266 case e1000_i211:672 snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
267 case e1000_i350: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;
268 case e1000_82580:689 case e1000_82580:
269 adapter->caps.owner = THIS_MODULE;690 case e1000_i350:
270 strcpy(adapter->caps.name, "igb-82580");691 snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
271 adapter->caps.max_adj = 62499999;692 adapter->ptp_caps.owner = THIS_MODULE;
272 adapter->caps.n_ext_ts = 0;693 adapter->ptp_caps.max_adj = 62499999;
273 adapter->caps.pps = 0;694 adapter->ptp_caps.n_ext_ts = 0;
274 adapter->caps.adjfreq = ptp_82580_adjfreq;695 adapter->ptp_caps.pps = 0;
275 adapter->caps.adjtime = igb_adjtime;696 adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580;
276 adapter->caps.gettime = igb_gettime;697 adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576;
277 adapter->caps.settime = igb_settime;698 adapter->ptp_caps.gettime = igb_ptp_gettime_82576;
278 adapter->caps.enable = ptp_82580_enable;699 adapter->ptp_caps.settime = igb_ptp_settime_82576;
279 adapter->cc.read = igb_82580_systim_read;700 adapter->ptp_caps.enable = igb_ptp_enable;
280 adapter->cc.mask = CLOCKSOURCE_MASK(IGB_NBITS_82580);701 adapter->cc.read = igb_ptp_read_82580;
281 adapter->cc.mult = 1;702 adapter->cc.mask = CLOCKSOURCE_MASK(IGB_NBITS_82580);
282 adapter->cc.shift = 0;703 adapter->cc.mult = 1;
704 adapter->cc.shift = 0;
283 /* Enable the timer functions by clearing bit 31. */705 /* Enable the timer functions by clearing bit 31. */
284 wr32(E1000_TSAUXC, 0x0);706 wr32(E1000_TSAUXC, 0x0);
285 break;707 break;
286 708 case e1000_i210:
287 case e1000_82576:709 case e1000_i211:
288 adapter->caps.owner = THIS_MODULE;710 snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
289 strcpy(adapter->caps.name, "igb-82576");711 adapter->ptp_caps.owner = THIS_MODULE;
290 adapter->caps.max_adj = 1000000000;712 adapter->ptp_caps.max_adj = 62499999;
291 adapter->caps.n_ext_ts = 0;713 adapter->ptp_caps.n_ext_ts = 0;
292 adapter->caps.pps = 0;714 adapter->ptp_caps.pps = 0;
293 adapter->caps.adjfreq = ptp_82576_adjfreq;715 adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82580;
294 adapter->caps.adjtime = igb_adjtime;716 adapter->ptp_caps.adjtime = igb_ptp_adjtime_i210;
295 adapter->caps.gettime = igb_gettime;717 adapter->ptp_caps.gettime = igb_ptp_gettime_i210;
296 adapter->caps.settime = igb_settime;718 adapter->ptp_caps.settime = igb_ptp_settime_i210;
297 adapter->caps.enable = ptp_82576_enable;719 adapter->ptp_caps.enable = igb_ptp_enable;
298 adapter->cc.read = igb_82576_systim_read;720 /* Enable the timer functions by clearing bit 31. */
299 adapter->cc.mask = CLOCKSOURCE_MASK(64);721 wr32(E1000_TSAUXC, 0x0);
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);
304 break;722 break;
305
306 default:723 default:
307 adapter->ptp_clock = NULL;724 adapter->ptp_clock = NULL;
308 return;725 return;
@@ -310,86 +727,114 @@ void igb_ptp_init(struct igb_adapter *adapter) · 1 unmodified line
310 727
311 wrfl();728 wrfl();
312 729
313 timecounter_init(&adapter->tc, &adapter->cc,730 spin_lock_init(&adapter->tmreg_lock);
314 ktime_to_ns(ktime_get_real()));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());
315 736
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()));
317 741
318 spin_lock_init(&adapter->tmreg_lock);742 INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
743 igb_ptp_overflow_check);
319 744
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 }
321 754
322 adapter->ptp_clock = ptp_clock_register(&adapter->caps);755 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
756 &adapter->pdev->dev);
323 if (IS_ERR(adapter->ptp_clock)) {757 if (IS_ERR(adapter->ptp_clock)) {
324 adapter->ptp_clock = NULL;758 adapter->ptp_clock = NULL;
325 dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n");759 dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n");
326 } else760 } else {
327 dev_info(&adapter->pdev->dev, "added PHC on %s\n",761 dev_info(&adapter->pdev->dev, "added PHC on %s\n",
328 adapter->netdev->name);762 adapter->netdev->name);
763 adapter->flags |= IGB_FLAG_PTP;
764 }
329}765}
330 766
331void 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 **/
773void igb_ptp_stop(struct igb_adapter *adapter)
332{774{
333 switch (adapter->hw.mac.type) {775 switch (adapter->hw.mac.type) {
334 case e1000_i211:
335 case e1000_i210:
336 case e1000_i350:
337 case e1000_82580:
338 case e1000_82576:776 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. */
340 break;784 break;
341 default:785 default:
342 return;786 return;
343 }787 }
344 788
789 cancel_work_sync(&adapter->ptp_tx_work);
790
345 if (adapter->ptp_clock) {791 if (adapter->ptp_clock) {
346 ptp_clock_unregister(adapter->ptp_clock);792 ptp_clock_unregister(adapter->ptp_clock);
347 dev_info(&adapter->pdev->dev, "removed PHC on %s\n",793 dev_info(&adapter->pdev->dev, "removed PHC on %s\n",
348 adapter->netdev->name);794 adapter->netdev->name);
795 adapter->flags &= ~IGB_FLAG_PTP;
349 }796 }
350}797}
351 798
352/**799/**
353 * igb_systim_to_hwtstamp - convert system time value to hw timestamp800 * igb_ptp_reset - Re-enable the adapter for PTP following a reset.
354 * @adapter: board private structure801 * @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.
360 *802 *
361 * The 'tmreg_lock' spinlock is used to protect the consistency of the803 * This function handles the reset work required to re-enable the PTP device.
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.
368 **/804 **/
369void igb_systim_to_hwtstamp(struct igb_adapter *adapter,805void igb_ptp_reset(struct igb_adapter *adapter)
370 struct skb_shared_hwtstamps *hwtstamps,
371 u64 systim)
372{806{
373 u64 ns;807 struct e1000_hw *hw = &adapter->hw;
374 unsigned long flags;808
809 if (!(adapter->flags & IGB_FLAG_PTP))
810 return;
375 811
376 switch (adapter->hw.mac.type) {812 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:
377 case e1000_i210:819 case e1000_i210:
378 case e1000_i211:820 case e1000_i211:
379 case e1000_i350:821 /* Enable the timer functions and interrupts. */
380 case e1000_82580:822 wr32(E1000_TSAUXC, 0x0);
381 case e1000_82576:823 wr32(E1000_TSIM, E1000_TSIM_TXTS);
824 wr32(E1000_IMS, E1000_IMS_TS);
382 break;825 break;
383 default:826 default:
827 /* No work to do. */
384 return;828 return;
385 }829 }
386 830
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());
388 834
389 ns = timecounter_cyc2time(&adapter->tc, systim);835 igb_ptp_settime_i210(&adapter->ptp_caps, &ts);
390 836 } else {
391 spin_unlock_irqrestore(&adapter->tmreg_lock, flags);837 timecounter_init(&adapter->tc, &adapter->cc,
392 838 ktime_to_ns(ktime_get_real()));
393 memset(hwtstamps, 0, sizeof(*hwtstamps));839 }
394 hwtstamps->hwtstamp = ns_to_ktime(ns);
395}840}
drivers/net/ethernet/intel/ixgbe/Makefile+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
32 32
33obj-$(CONFIG_IXGBE) += ixgbe.o33obj-$(CONFIG_IXGBE) += ixgbe.o
34 34
35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\
36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o
38 38
drivers/net/ethernet/intel/ixgbe/ixgbe.h+28−7
@@ -78,6 +78,9 @@ · 77 unmodified lines
78 78
79/* Supported Rx Buffer Sizes */79/* Supported Rx Buffer Sizes */
80#define IXGBE_RXBUFFER_256 256 /* Used for skb receive header */80#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
81#define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */84#define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */
82 85
83/*86/*
@@ -104,6 +107,7 @@ · 20 unmodified lines
104#define IXGBE_TX_FLAGS_FSO (u32)(1 << 6)107#define IXGBE_TX_FLAGS_FSO (u32)(1 << 6)
105#define IXGBE_TX_FLAGS_TXSW (u32)(1 << 7)108#define IXGBE_TX_FLAGS_TXSW (u32)(1 << 7)
106#define IXGBE_TX_FLAGS_TSTAMP (u32)(1 << 8)109#define IXGBE_TX_FLAGS_TSTAMP (u32)(1 << 8)
110#define IXGBE_TX_FLAGS_NO_IFCS (u32)(1 << 9)
107#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000111#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000
108#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000112#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
109#define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29113#define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29
@@ -293,16 +297,25 @@ struct ixgbe_ring_feature { · 183 unmodified lines
293 * this is twice the size of a half page we need to double the page order297 * this is twice the size of a half page we need to double the page order
294 * for FCoE enabled Rx queues.298 * for FCoE enabled Rx queues.
295 */299 */
296#if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192)300static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring)
297static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
298{301{
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;
300}308}
301#else309
302#define ixgbe_rx_pg_order(_ring) 0310static 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;
303#endif315#endif
316 return 0;
317}
304#define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring))318#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))
306 319
307struct ixgbe_ring_container {320struct ixgbe_ring_container {
308 struct ixgbe_ring *ring; /* pointer to linked list of rings */321 struct ixgbe_ring *ring; /* pointer to linked list of rings */
@@ -584,6 +597,9 @@ struct ixgbe_adapter { · 275 unmodified lines
584#ifdef CONFIG_IXGBE_HWMON597#ifdef CONFIG_IXGBE_HWMON
585 struct hwmon_buff ixgbe_hwmon_buff;598 struct hwmon_buff ixgbe_hwmon_buff;
586#endif /* CONFIG_IXGBE_HWMON */599#endif /* CONFIG_IXGBE_HWMON */
600#ifdef CONFIG_DEBUG_FS
601 struct dentry *ixgbe_dbg_adapter;
602#endif /*CONFIG_DEBUG_FS*/
587};603};
588 604
589struct ixgbe_fdir_filter {605struct ixgbe_fdir_filter {
@@ -712,7 +728,12 @@ extern int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, · 122 unmodified lines
712 struct netdev_fcoe_hbainfo *info);728 struct netdev_fcoe_hbainfo *info);
713extern u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter);729extern u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter);
714#endif /* IXGBE_FCOE */730#endif /* IXGBE_FCOE */
715 731#ifdef CONFIG_DEBUG_FS
732extern void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter);
733extern void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter);
734extern void ixgbe_dbg_init(void);
735extern void ixgbe_dbg_exit(void);
736#endif /* CONFIG_DEBUG_FS */
716static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)737static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
717{738{
718 return netdev_get_tx_queue(ring->netdev, ring->queue_index);739 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
35static struct dentry *ixgbe_dbg_root;
36
37static 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 **/
47static 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 **/
60static 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 **/
91static 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
143static 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
150static 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 **/
160static 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 **/
173static 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 **/
205static 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
239static 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 **/
250void 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 **/
275void 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 **/
285void 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 **/
295void 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
1167 }1167 }
1168 1168
1169 bi->dma = dma;1169 bi->dma = dma;
1170 bi->page_offset ^= ixgbe_rx_bufsz(rx_ring);1170 bi->page_offset = 0;
1171 1171
1172 return true;1172 return true;
1173}1173}
@@ -1320,29 +1320,6 @@ static unsigned int ixgbe_get_headlen(unsigned char *data, · 146 unmodified lines
1320 return max_len;1320 return max_len;
1321}1321}
1322 1322
1323static 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
1346static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,1323static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
1347 struct sk_buff *skb)1324 struct sk_buff *skb)
1348{1325{
@@ -1440,16 +1417,28 @@ static bool ixgbe_is_non_eop(struct ixgbe_ring *rx_ring, · 91 unmodified lines
1440 1417
1441 prefetch(IXGBE_RX_DESC(rx_ring, ntc));1418 prefetch(IXGBE_RX_DESC(rx_ring, ntc));
1442 1419
1443 if (likely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)))1420 /* update RSC append count if present */
1444 return false;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;
1445 1430
1446 /* append_cnt indicates packet is RSC, if so fetch nextp */1431 /* update ntc based on RSC value */
1447 if (IXGBE_CB(skb)->append_cnt) {1432 ntc = le32_to_cpu(rx_desc->wb.upper.status_error);
1448 ntc = le32_to_cpu(rx_desc->wb.upper.status_error);1433 ntc &= IXGBE_RXDADV_NEXTP_MASK;
1449 ntc &= IXGBE_RXDADV_NEXTP_MASK;1434 ntc >>= IXGBE_RXDADV_NEXTP_SHIFT;
1450 ntc >>= IXGBE_RXDADV_NEXTP_SHIFT;1435 }
1451 }1436 }
1452 1437
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
1453 /* place skb in next buffer to be received */1442 /* place skb in next buffer to be received */
1454 rx_ring->rx_buffer_info[ntc].skb = skb;1443 rx_ring->rx_buffer_info[ntc].skb = skb;
1455 rx_ring->rx_stats.non_eop_descs++;1444 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
1457 return true;1446 return true;
1458}1447}
1459 1448
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 */
1461static 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 */
1501static 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
1460/**1521/**
1461 * ixgbe_cleanup_headers - Correct corrupted or empty headers1522 * ixgbe_cleanup_headers - Correct corrupted or empty headers
1462 * @rx_ring: rx descriptor ring packet is being transacted on1523 * @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
1479 union ixgbe_adv_rx_desc *rx_desc,1540 union ixgbe_adv_rx_desc *rx_desc,
1480 struct sk_buff *skb)1541 struct sk_buff *skb)
1481{1542{
1482 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
1483 struct net_device *netdev = rx_ring->netdev;1543 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;
1500 1544
1501 /* verify that the packet does not have any known errors */1545 /* verify that the packet does not have any known errors */
1502 if (unlikely(ixgbe_test_staterr(rx_desc,1546 if (unlikely(ixgbe_test_staterr(rx_desc,
@@ -1506,40 +1550,9 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, · 3 unmodified lines
1506 return true;1550 return true;
1507 }1551 }
1508 1552
1509 /*1553 /* place header in linear portion of buffer */
1510 * it is valid to use page_address instead of kmap since we are1554 if (skb_is_nonlinear(skb))
1511 * working with pages allocated out of the lomem pool per1555 ixgbe_pull_tail(rx_ring, skb);
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 }
1543 1556
1544#ifdef IXGBE_FCOE1557#ifdef IXGBE_FCOE
1545 /* do not attempt to pad FCoE Frames as this will disrupt DDP */1558 /* 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
1559 return false;1572 return false;
1560}1573}
1561 1574
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 **/
1568static 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
1577/**1575/**
1578 * ixgbe_reuse_rx_page - page flip buffer and store it back on the ring1576 * ixgbe_reuse_rx_page - page flip buffer and store it back on the ring
1579 * @rx_ring: rx descriptor ring to store buffers on1577 * @rx_ring: rx descriptor ring to store buffers on
1580 * @old_buff: donor buffer to have page reused1578 * @old_buff: donor buffer to have page reused
1581 *1579 *
1582 * Syncronizes page for reuse by the adapter1580 * Synchronizes page for reuse by the adapter
1583 **/1581 **/
1584static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring,1582static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring,
1585 struct ixgbe_rx_buffer *old_buff)1583 struct ixgbe_rx_buffer *old_buff)
1586{1584{
1587 struct ixgbe_rx_buffer *new_buff;1585 struct ixgbe_rx_buffer *new_buff;
1588 u16 nta = rx_ring->next_to_alloc;1586 u16 nta = rx_ring->next_to_alloc;
1589 u16 bufsz = ixgbe_rx_bufsz(rx_ring);
1590 1587
1591 new_buff = &rx_ring->rx_buffer_info[nta];1588 new_buff = &rx_ring->rx_buffer_info[nta];
1592 1589
@@ -1597,17 +1594,13 @@ static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring, · 4 unmodified lines
1597 /* transfer page from old buffer to new buffer */1594 /* transfer page from old buffer to new buffer */
1598 new_buff->page = old_buff->page;1595 new_buff->page = old_buff->page;
1599 new_buff->dma = old_buff->dma;1596 new_buff->dma = old_buff->dma;
1600 1597 new_buff->page_offset = old_buff->page_offset;
1601 /* flip page offset to other buffer and store to new_buff */
1602 new_buff->page_offset = old_buff->page_offset ^ bufsz;
1603 1598
1604 /* sync the buffer for use by the device */1599 /* sync the buffer for use by the device */
1605 dma_sync_single_range_for_device(rx_ring->dev, new_buff->dma,1600 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),
1607 DMA_FROM_DEVICE);1603 DMA_FROM_DEVICE);
1608
1609 /* bump ref count on page before it is given to the stack */
1610 get_page(new_buff->page);
1611}1604}
1612 1605
1613/**1606/**
@@ -1617,20 +1610,159 @@ static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring, · 3 unmodified lines
1617 * @rx_desc: descriptor containing length of buffer written by hardware1610 * @rx_desc: descriptor containing length of buffer written by hardware
1618 * @skb: sk_buff to place the data into1611 * @skb: sk_buff to place the data into
1619 *1612 *
1620 * This function is based on skb_add_rx_frag. I would have used that1613 * This function will add the data contained in rx_buffer->page to the skb.
1621 * function however it doesn't handle the truesize case correctly since we1614 * This is done either through a direct copy if the data in the buffer is
1622 * are allocating more memory than might be used for a single receive.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.
1623 **/1620 **/
1624static void ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring,1621static bool ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring,
1625 struct ixgbe_rx_buffer *rx_buffer,1622 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)
1627{1625{
1628 skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags,1626 struct page *page = rx_buffer->page;
1629 rx_buffer->page, rx_buffer->page_offset,1627 unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
1630 size);1628#if (PAGE_SIZE < 8192)
1631 skb->len += size;1629 unsigned int truesize = ixgbe_rx_bufsz(rx_ring);
1632 skb->data_len += size;1630#else
1633 skb->truesize += ixgbe_rx_bufsz(rx_ring);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
1685static 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
1737dma_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;
1634}1766}
1635 1767
1636/**1768/**
@@ -1653,16 +1785,14 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 16 unmodified lines
1653 unsigned int total_rx_bytes = 0, total_rx_packets = 0;1785 unsigned int total_rx_bytes = 0, total_rx_packets = 0;
1654#ifdef IXGBE_FCOE1786#ifdef IXGBE_FCOE
1655 struct ixgbe_adapter *adapter = q_vector->adapter;1787 struct ixgbe_adapter *adapter = q_vector->adapter;
1656 int ddp_bytes = 0;1788 int ddp_bytes;
1789 unsigned int mss = 0;
1657#endif /* IXGBE_FCOE */1790#endif /* IXGBE_FCOE */
1658 u16 cleaned_count = ixgbe_desc_unused(rx_ring);1791 u16 cleaned_count = ixgbe_desc_unused(rx_ring);
1659 1792
1660 do {1793 do {
1661 struct ixgbe_rx_buffer *rx_buffer;
1662 union ixgbe_adv_rx_desc *rx_desc;1794 union ixgbe_adv_rx_desc *rx_desc;
1663 struct sk_buff *skb;1795 struct sk_buff *skb;
1664 struct page *page;
1665 u16 ntc;
1666 1796
1667 /* return some buffers to hardware, one at a time is too slow */1797 /* return some buffers to hardware, one at a time is too slow */
1668 if (cleaned_count >= IXGBE_RX_BUFFER_WRITE) {1798 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
1670 cleaned_count = 0;1800 cleaned_count = 0;
1671 }1801 }
1672 1802
1673 ntc = rx_ring->next_to_clean;1803 rx_desc = IXGBE_RX_DESC(rx_ring, rx_ring->next_to_clean);
1674 rx_desc = IXGBE_RX_DESC(rx_ring, ntc);
1675 rx_buffer = &rx_ring->rx_buffer_info[ntc];
1676 1804
1677 if (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_DD))1805 if (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_DD))
1678 break;1806 break;
@@ -1684,75 +1812,12 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 5 unmodified lines
1684 */1812 */
1685 rmb();1813 rmb();
1686 1814
1687 page = rx_buffer->page;1815 /* retrieve a buffer from the ring */
1688 prefetchw(page);1816 skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);
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
1701 1817
1702 /* allocate a skb to store the frags */1818 /* exit if we failed to retrieve a buffer */
1703 skb = netdev_alloc_skb_ip_align(rx_ring->netdev,1819 if (!skb)
1704 IXGBE_RX_HDR_SIZE);1820 break;
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);
1756 1821
1757 cleaned_count++;1822 cleaned_count++;
1758 1823
@@ -1775,6 +1840,20 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 16 unmodified lines
1775 /* if ddp, not passing to ULD unless for FCP_RSP or error */1840 /* if ddp, not passing to ULD unless for FCP_RSP or error */
1776 if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) {1841 if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) {
1777 ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb);1842 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 }
1778 if (!ddp_bytes) {1857 if (!ddp_bytes) {
1779 dev_kfree_skb_any(skb);1858 dev_kfree_skb_any(skb);
1780 continue;1859 continue;
@@ -1788,21 +1867,6 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, · 7 unmodified lines
1788 budget--;1867 budget--;
1789 } while (likely(budget));1868 } while (likely(budget));
1790 1869
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 */
1806 u64_stats_update_begin(&rx_ring->syncp);1870 u64_stats_update_begin(&rx_ring->syncp);
1807 rx_ring->stats.packets += total_rx_packets;1871 rx_ring->stats.packets += total_rx_packets;
1808 rx_ring->stats.bytes += total_rx_bytes;1872 rx_ring->stats.bytes += total_rx_bytes;
@@ -2868,11 +2932,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, · 1059 unmodified lines
2868 srrctl = IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT;2932 srrctl = IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT;
2869 2933
2870 /* configure the packet buffer length */2934 /* configure the packet buffer length */
2871#if PAGE_SIZE > IXGBE_MAX_RXBUFFER
2872 srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
2873#else
2874 srrctl |= ixgbe_rx_bufsz(rx_ring) >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;2935 srrctl |= ixgbe_rx_bufsz(rx_ring) >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
2875#endif
2876 2936
2877 /* configure descriptor type */2937 /* configure descriptor type */
2878 srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;2938 srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
@@ -2980,13 +3040,7 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, · 101 unmodified lines
2980 * total size of max desc * buf_len is not greater3040 * total size of max desc * buf_len is not greater
2981 * than 655363041 * than 65536
2982 */3042 */
2983#if (PAGE_SIZE <= 8192)
2984 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;3043 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
2990 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(reg_idx), rscctrl);3044 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(reg_idx), rscctrl);
2991}3045}
2992 3046
@@ -3606,8 +3660,6 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) · 613 unmodified lines
3606 if (hw->mac.type == ixgbe_mac_82598EB)3660 if (hw->mac.type == ixgbe_mac_82598EB)
3607 netif_set_gso_max_size(adapter->netdev, 32768);3661 netif_set_gso_max_size(adapter->netdev, 32768);
3608 3662
3609 hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true);
3610
3611#ifdef IXGBE_FCOE3663#ifdef IXGBE_FCOE
3612 if (adapter->netdev->features & NETIF_F_FCOE_MTU)3664 if (adapter->netdev->features & NETIF_F_FCOE_MTU)
3613 max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);3665 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
3807#ifdef CONFIG_IXGBE_DCB3859#ifdef CONFIG_IXGBE_DCB
3808 ixgbe_configure_dcb(adapter);3860 ixgbe_configure_dcb(adapter);
3809#endif3861#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);
3810 3867
3811 ixgbe_set_rx_mode(adapter->netdev);3868 ixgbe_set_rx_mode(adapter->netdev);
3812 ixgbe_restore_vlan(adapter);3869 ixgbe_restore_vlan(adapter);
@@ -3838,8 +3895,6 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter) · 25 unmodified lines
3838 break;3895 break;
3839 }3896 }
3840 3897
3841 ixgbe_configure_virtualization(adapter);
3842
3843#ifdef IXGBE_FCOE3898#ifdef IXGBE_FCOE
3844 /* configure FCoE L2 filters, redirection table, and Rx control */3899 /* configure FCoE L2 filters, redirection table, and Rx control */
3845 ixgbe_configure_fcoe(adapter);3900 ixgbe_configure_fcoe(adapter);
@@ -4129,27 +4184,6 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) · 283 unmodified lines
4129 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));4184 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
4130}4185}
4131 4186
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 **/
4141static 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
4153/**4187/**
4154 * ixgbe_clean_rx_ring - Free Rx Buffers per Queue4188 * ixgbe_clean_rx_ring - Free Rx Buffers per Queue
4155 * @rx_ring: ring to free buffers from4189 * @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
4195 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;4229 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
4196 memset(rx_ring->rx_buffer_info, 0, size);4230 memset(rx_ring->rx_buffer_info, 0, size);
4197 4231
4198 ixgbe_init_rx_page_offset(rx_ring);
4199
4200 /* Zero out the descriptor ring */4232 /* Zero out the descriptor ring */
4201 memset(rx_ring->desc, 0, rx_ring->size);4233 memset(rx_ring->desc, 0, rx_ring->size);
4202 4234
@@ -4646,8 +4678,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring) · 443 unmodified lines
4646 rx_ring->next_to_clean = 0;4678 rx_ring->next_to_clean = 0;
4647 rx_ring->next_to_use = 0;4679 rx_ring->next_to_use = 0;
4648 4680
4649 ixgbe_init_rx_page_offset(rx_ring);
4650
4651 return 0;4681 return 0;
4652err:4682err:
4653 vfree(rx_ring->rx_buffer_info);4683 vfree(rx_ring->rx_buffer_info);
@@ -5530,8 +5560,9 @@ static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) · 876 unmodified lines
5530{5560{
5531 u32 ssvpc;5561 u32 ssvpc;
5532 5562
5533 /* Do not perform spoof check for 82598 */5563 /* Do not perform spoof check for 82598 or if not in IOV mode */
5534 if (adapter->hw.mac.type == ixgbe_mac_82598EB)5564 if (adapter->hw.mac.type == ixgbe_mac_82598EB ||
5565 adapter->num_vfs == 0)
5535 return;5566 return;
5536 5567
5537 ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC);5568 ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC);
@@ -5543,7 +5574,7 @@ static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) · 5 unmodified lines
5543 if (!ssvpc)5574 if (!ssvpc)
5544 return;5575 return;
5545 5576
5546 e_warn(drv, "%d Spoofed packets detected\n", ssvpc);5577 e_warn(drv, "%u Spoofed packets detected\n", ssvpc);
5547}5578}
5548 5579
5549/**5580/**
@@ -5874,9 +5905,12 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring, · 324 unmodified lines
5874 u32 type_tucmd = 0;5905 u32 type_tucmd = 0;
5875 5906
5876 if (skb->ip_summed != CHECKSUM_PARTIAL) {5907 if (skb->ip_summed != CHECKSUM_PARTIAL) {
5877 if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN) &&5908 if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN)) {
5878 !(first->tx_flags & IXGBE_TX_FLAGS_TXSW))5909 if (unlikely(skb->no_fcs))
5879 return;5910 first->tx_flags |= IXGBE_TX_FLAGS_NO_IFCS;
5911 if (!(first->tx_flags & IXGBE_TX_FLAGS_TXSW))
5912 return;
5913 }
5880 } else {5914 } else {
5881 u8 l4_hdr = 0;5915 u8 l4_hdr = 0;
5882 switch (first->protocol) {5916 switch (first->protocol) {
@@ -5938,7 +5972,6 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags) · 55 unmodified lines
5938{5972{
5939 /* set type for advanced descriptor with frame checksum insertion */5973 /* set type for advanced descriptor with frame checksum insertion */
5940 __le32 cmd_type = cpu_to_le32(IXGBE_ADVTXD_DTYP_DATA |5974 __le32 cmd_type = cpu_to_le32(IXGBE_ADVTXD_DTYP_DATA |
5941 IXGBE_ADVTXD_DCMD_IFCS |
5942 IXGBE_ADVTXD_DCMD_DEXT);5975 IXGBE_ADVTXD_DCMD_DEXT);
5943 5976
5944 /* set HW vlan bit if vlan is present */5977 /* set HW vlan bit if vlan is present */
@@ -5958,6 +5991,10 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags) · 13 unmodified lines
5958#endif5991#endif
5959 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_TSE);5992 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_TSE);
5960 5993
5994 /* insert frame checksum */
5995 if (!(tx_flags & IXGBE_TX_FLAGS_NO_IFCS))
5996 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_IFCS);
5997
5961 return cmd_type;5998 return cmd_type;
5962}5999}
5963 6000
@@ -6063,8 +6100,6 @@ static void ixgbe_tx_map(struct ixgbe_ring *tx_ring, · 99 unmodified lines
6063 if (likely(!data_len))6100 if (likely(!data_len))
6064 break;6101 break;
6065 6102
6066 if (unlikely(skb->no_fcs))
6067 cmd_type &= ~(cpu_to_le32(IXGBE_ADVTXD_DCMD_IFCS));
6068 tx_desc->read.cmd_type_len = cmd_type | cpu_to_le32(size);6103 tx_desc->read.cmd_type_len = cmd_type | cpu_to_le32(size);
6069 6104
6070 i++;6105 i++;
@@ -6854,9 +6889,9 @@ static int ixgbe_set_features(struct net_device *netdev, · 783 unmodified lines
6854 return 0;6889 return 0;
6855}6890}
6856 6891
6857static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,6892static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
6858 struct net_device *dev,6893 struct net_device *dev,
6859 unsigned char *addr,6894 const unsigned char *addr,
6860 u16 flags)6895 u16 flags)
6861{6896{
6862 struct ixgbe_adapter *adapter = netdev_priv(dev);6897 struct ixgbe_adapter *adapter = netdev_priv(dev);
@@ -6893,7 +6928,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, · 30 unmodified lines
6893 6928
6894static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,6929static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,
6895 struct net_device *dev,6930 struct net_device *dev,
6896 unsigned char *addr)6931 const unsigned char *addr)
6897{6932{
6898 struct ixgbe_adapter *adapter = netdev_priv(dev);6933 struct ixgbe_adapter *adapter = netdev_priv(dev);
6899 int err = -EOPNOTSUPP;6934 int err = -EOPNOTSUPP;
@@ -7136,11 +7171,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, · 236 unmodified lines
7136 goto err_ioremap;7171 goto err_ioremap;
7137 }7172 }
7138 7173
7139 for (i = 1; i <= 5; i++) {
7140 if (pci_resource_len(pdev, i) == 0)
7141 continue;
7142 }
7143
7144 netdev->netdev_ops = &ixgbe_netdev_ops;7174 netdev->netdev_ops = &ixgbe_netdev_ops;
7145 ixgbe_set_ethtool_ops(netdev);7175 ixgbe_set_ethtool_ops(netdev);
7146 netdev->watchdog_timeo = 5 * HZ;7176 netdev->watchdog_timeo = 5 * HZ;
@@ -7419,6 +7449,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, · 272 unmodified lines
7419 e_err(probe, "failed to allocate sysfs resources\n");7449 e_err(probe, "failed to allocate sysfs resources\n");
7420#endif /* CONFIG_IXGBE_HWMON */7450#endif /* CONFIG_IXGBE_HWMON */
7421 7451
7452#ifdef CONFIG_DEBUG_FS
7453 ixgbe_dbg_adapter_init(adapter);
7454#endif /* CONFIG_DEBUG_FS */
7455
7422 return 0;7456 return 0;
7423 7457
7424err_register:7458err_register:
@@ -7453,6 +7487,10 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) · 28 unmodified lines
7453 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);7487 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
7454 struct net_device *netdev = adapter->netdev;7488 struct net_device *netdev = adapter->netdev;
7455 7489
7490#ifdef CONFIG_DEBUG_FS
7491 ixgbe_dbg_adapter_exit(adapter);
7492#endif /*CONFIG_DEBUG_FS */
7493
7456 set_bit(__IXGBE_DOWN, &adapter->state);7494 set_bit(__IXGBE_DOWN, &adapter->state);
7457 cancel_work_sync(&adapter->service_task);7495 cancel_work_sync(&adapter->service_task);
7458 7496
@@ -7708,6 +7746,10 @@ static int __init ixgbe_init_module(void) · 249 unmodified lines
7708 pr_info("%s - version %s\n", ixgbe_driver_string, ixgbe_driver_version);7746 pr_info("%s - version %s\n", ixgbe_driver_string, ixgbe_driver_version);
7709 pr_info("%s\n", ixgbe_copyright);7747 pr_info("%s\n", ixgbe_copyright);
7710 7748
7749#ifdef CONFIG_DEBUG_FS
7750 ixgbe_dbg_init();
7751#endif /* CONFIG_DEBUG_FS */
7752
7711#ifdef CONFIG_IXGBE_DCA7753#ifdef CONFIG_IXGBE_DCA
7712 dca_register_notify(&dca_notifier);7754 dca_register_notify(&dca_notifier);
7713#endif7755#endif
@@ -7730,6 +7772,11 @@ static void __exit ixgbe_exit_module(void) · 16 unmodified lines
7730 dca_unregister_notify(&dca_notifier);7772 dca_unregister_notify(&dca_notifier);
7731#endif7773#endif
7732 pci_unregister_driver(&ixgbe_driver);7774 pci_unregister_driver(&ixgbe_driver);
7775
7776#ifdef CONFIG_DEBUG_FS
7777 ixgbe_dbg_exit();
7778#endif /* CONFIG_DEBUG_FS */
7779
7733 rcu_barrier(); /* Wait for completion of call_rcu()'s */7780 rcu_barrier(); /* Wait for completion of call_rcu()'s */
7734}7781}
7735 7782
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
960 /* (Re)start the overflow check */960 /* (Re)start the overflow check */
961 adapter->flags2 |= IXGBE_FLAG2_OVERFLOW_CHECK_ENABLED;961 adapter->flags2 |= IXGBE_FLAG2_OVERFLOW_CHECK_ENABLED;
962 962
963 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps);963 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
964 &adapter->pdev->dev);
964 if (IS_ERR(adapter->ptp_clock)) {965 if (IS_ERR(adapter->ptp_clock)) {
965 adapter->ptp_clock = NULL;966 adapter->ptp_clock = NULL;
966 e_dev_err("ptp_clock_register failed\n");967 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
346static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid,346static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid,
347 u32 vf)347 u32 vf)
348{348{
349 /* VLAN 0 is a special case, don't allow it to be removed */
350 if (!vid && !add)
351 return 0;
352
349 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add);353 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add);
350}354}
351 355
@@ -414,6 +418,7 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) · 62 unmodified lines
414 VLAN_PRIO_SHIFT)), vf);418 VLAN_PRIO_SHIFT)), vf);
415 ixgbe_set_vmolr(hw, vf, false);419 ixgbe_set_vmolr(hw, vf, false);
416 } else {420 } else {
421 ixgbe_set_vf_vlan(adapter, true, 0, vf);
417 ixgbe_set_vmvir(adapter, 0, vf);422 ixgbe_set_vmvir(adapter, 0, vf);
418 ixgbe_set_vmolr(hw, vf, true);423 ixgbe_set_vmolr(hw, vf, true);
419 }424 }
@@ -810,9 +815,9 @@ out: · 390 unmodified lines
810 return err;815 return err;
811}816}
812 817
813static int ixgbe_link_mbps(int internal_link_speed)818static int ixgbe_link_mbps(struct ixgbe_adapter *adapter)
814{819{
815 switch (internal_link_speed) {820 switch (adapter->link_speed) {
816 case IXGBE_LINK_SPEED_100_FULL:821 case IXGBE_LINK_SPEED_100_FULL:
817 return 100;822 return 100;
818 case IXGBE_LINK_SPEED_1GB_FULL:823 case IXGBE_LINK_SPEED_1GB_FULL:
@@ -824,27 +829,30 @@ static int ixgbe_link_mbps(int internal_link_speed) · 5 unmodified lines
824 }829 }
825}830}
826 831
827static void ixgbe_set_vf_rate_limit(struct ixgbe_hw *hw, int vf, int tx_rate,832static void ixgbe_set_vf_rate_limit(struct ixgbe_adapter *adapter, int vf)
828 int link_speed)
829{833{
830 int rf_dec, rf_int;834 struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
831 u32 bcnrc_val;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;
832 843
833 if (tx_rate != 0) {
834 /* Calculate the rate factor values to set */844 /* Calculate the rate factor values to set */
835 rf_int = link_speed / tx_rate;845 bcnrc_val <<= IXGBE_RTTBCNRC_RF_INT_SHIFT;
836 rf_dec = (link_speed - (rf_int * tx_rate));846 bcnrc_val /= tx_rate;
837 rf_dec = (rf_dec * (1<<IXGBE_RTTBCNRC_RF_INT_SHIFT)) / tx_rate;847
838 848 /* clear everything but the rate factor */
839 bcnrc_val = IXGBE_RTTBCNRC_RS_ENA;849 bcnrc_val &= IXGBE_RTTBCNRC_RF_INT_MASK |
840 bcnrc_val |= ((rf_int<<IXGBE_RTTBCNRC_RF_INT_SHIFT) &850 IXGBE_RTTBCNRC_RF_DEC_MASK;
841 IXGBE_RTTBCNRC_RF_INT_MASK);851
842 bcnrc_val |= (rf_dec & IXGBE_RTTBCNRC_RF_DEC_MASK);852 /* enable the rate scheduler */
843 } else {853 bcnrc_val |= IXGBE_RTTBCNRC_RS_ENA;
844 bcnrc_val = 0;
845 }854 }
846 855
847 IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, 2*vf); /* vf Y uses queue 2*Y */
848 /*856 /*
849 * Set global transmit compensation time to the MMW_SIZE in RTTBCNRM857 * Set global transmit compensation time to the MMW_SIZE in RTTBCNRM
850 * register. Typically MMW_SIZE=0x014 if 9728-byte jumbo is supported858 * 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
861 break;869 break;
862 }870 }
863 871
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 }
865}882}
866 883
867void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter)884void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter)
868{885{
869 int actual_link_speed, i;886 int i;
870 bool reset_rate = false;
871 887
872 /* VF Tx rate limit was not set */888 /* VF Tx rate limit was not set */
873 if (adapter->vf_rate_link_speed == 0)889 if (!adapter->vf_rate_link_speed)
874 return;890 return;
875 891
876 actual_link_speed = ixgbe_link_mbps(adapter->link_speed);892 if (ixgbe_link_mbps(adapter) != adapter->vf_rate_link_speed) {
877 if (actual_link_speed != adapter->vf_rate_link_speed) {
878 reset_rate = true;
879 adapter->vf_rate_link_speed = 0;893 adapter->vf_rate_link_speed = 0;
880 dev_info(&adapter->pdev->dev,894 dev_info(&adapter->pdev->dev,
881 "Link speed has been changed. VF Transmit rate "895 "Link speed has been changed. VF Transmit rate is disabled\n");
882 "is disabled\n");
883 }896 }
884 897
885 for (i = 0; i < adapter->num_vfs; i++) {898 for (i = 0; i < adapter->num_vfs; i++) {
886 if (reset_rate)899 if (!adapter->vf_rate_link_speed)
887 adapter->vfinfo[i].tx_rate = 0;900 adapter->vfinfo[i].tx_rate = 0;
888 901
889 ixgbe_set_vf_rate_limit(&adapter->hw, i,902 ixgbe_set_vf_rate_limit(adapter, i);
890 adapter->vfinfo[i].tx_rate,
891 actual_link_speed);
892 }903 }
893}904}
894 905
895int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate)906int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate)
896{907{
897 struct ixgbe_adapter *adapter = netdev_priv(netdev);908 struct ixgbe_adapter *adapter = netdev_priv(netdev);
898 struct ixgbe_hw *hw = &adapter->hw;909 int link_speed;
899 int actual_link_speed;910
911 /* verify VF is active */
912 if (vf >= adapter->num_vfs)
913 return -EINVAL;
900 914
901 actual_link_speed = ixgbe_link_mbps(adapter->link_speed);915 /* verify link is up */
902 if ((vf >= adapter->num_vfs) || (!adapter->link_up) ||916 if (!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 */
906 return -EINVAL;917 return -EINVAL;
907 918
908 adapter->vf_rate_link_speed = actual_link_speed;919 /* verify we are linked at 10Gbps */
909 adapter->vfinfo[vf].tx_rate = (u16)tx_rate;920 link_speed = ixgbe_link_mbps(adapter);
910 ixgbe_set_vf_rate_limit(hw, vf, tx_rate, actual_link_speed);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);
911 934
912 return 0;935 return 0;
913}936}
drivers/net/ethernet/intel/ixgbevf/defines.h+1−0
@@ -272,5 +272,6 @@ struct ixgbe_adv_tx_context_desc { · 271 unmodified lines
272/* Error Codes */272/* Error Codes */
273#define IXGBE_ERR_INVALID_MAC_ADDR -1273#define IXGBE_ERR_INVALID_MAC_ADDR -1
274#define IXGBE_ERR_RESET_FAILED -2274#define IXGBE_ERR_RESET_FAILED -2
275#define IXGBE_ERR_INVALID_ARGUMENT -3
275 276
276#endif /* _IXGBEVF_DEFINES_H_ */277#endif /* _IXGBEVF_DEFINES_H_ */
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h+8−1
@@ -101,7 +101,9 @@ struct ixgbevf_ring { · 100 unmodified lines
101 101
102/* Supported Rx Buffer Sizes */102/* Supported Rx Buffer Sizes */
103#define IXGBEVF_RXBUFFER_256 256 /* Used for packet split */103#define IXGBEVF_RXBUFFER_256 256 /* Used for packet split */
104#define IXGBEVF_RXBUFFER_2048 2048104#define IXGBEVF_RXBUFFER_3K 3072
105#define IXGBEVF_RXBUFFER_7K 7168
106#define IXGBEVF_RXBUFFER_15K 15360
105#define IXGBEVF_MAX_RXBUFFER 16384 /* largest size for single descriptor */107#define IXGBEVF_MAX_RXBUFFER 16384 /* largest size for single descriptor */
106 108
107#define IXGBEVF_RX_HDR_SIZE IXGBEVF_RXBUFFER_256109#define IXGBEVF_RX_HDR_SIZE IXGBEVF_RXBUFFER_256
@@ -259,6 +261,11 @@ enum ixbgevf_state_t { · 151 unmodified lines
259 __IXGBEVF_DOWN261 __IXGBEVF_DOWN
260};262};
261 263
264struct ixgbevf_cb {
265 struct sk_buff *prev;
266};
267#define IXGBE_CB(skb) ((struct ixgbevf_cb *)(skb)->cb)
268
262enum ixgbevf_boards {269enum ixgbevf_boards {
263 board_82599_vf,270 board_82599_vf,
264 board_X540_vf,271 board_X540_vf,
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+194−78
@@ -263,6 +263,8 @@ cont_loop: · 262 unmodified lines
263 tx_ring->total_bytes += total_bytes;263 tx_ring->total_bytes += total_bytes;
264 tx_ring->total_packets += total_packets;264 tx_ring->total_packets += total_packets;
265 u64_stats_update_end(&tx_ring->syncp);265 u64_stats_update_end(&tx_ring->syncp);
266 q_vector->tx.total_bytes += total_bytes;
267 q_vector->tx.total_packets += total_packets;
266 268
267 return count < tx_ring->count;269 return count < tx_ring->count;
268}270}
@@ -272,12 +274,10 @@ cont_loop: · 3 unmodified lines
272 * @q_vector: structure containing interrupt and ring information274 * @q_vector: structure containing interrupt and ring information
273 * @skb: packet to send up275 * @skb: packet to send up
274 * @status: hardware indication of status of receive276 * @status: hardware indication of status of receive
275 * @rx_ring: rx descriptor ring (for a specific queue) to setup
276 * @rx_desc: rx descriptor277 * @rx_desc: rx descriptor
277 **/278 **/
278static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector,279static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector,
279 struct sk_buff *skb, u8 status,280 struct sk_buff *skb, u8 status,
280 struct ixgbevf_ring *ring,
281 union ixgbe_adv_rx_desc *rx_desc)281 union ixgbe_adv_rx_desc *rx_desc)
282{282{
283 struct ixgbevf_adapter *adapter = q_vector->adapter;283 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
433 433
434 if (!(staterr & IXGBE_RXD_STAT_EOP)) {434 if (!(staterr & IXGBE_RXD_STAT_EOP)) {
435 skb->next = next_buffer->skb;435 skb->next = next_buffer->skb;
436 skb->next->prev = skb;436 IXGBE_CB(skb->next)->prev = skb;
437 adapter->non_eop_descs++;437 adapter->non_eop_descs++;
438 goto next_desc;438 goto next_desc;
439 }439 }
440 440
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
441 /* ERR_MASK will only have valid bits if EOP set */451 /* ERR_MASK will only have valid bits if EOP set */
442 if (unlikely(staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK)) {452 if (unlikely(staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK)) {
443 dev_kfree_skb_irq(skb);453 dev_kfree_skb_irq(skb);
@@ -461,7 +471,7 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, · 17 unmodified lines
461 }471 }
462 skb->protocol = eth_type_trans(skb, rx_ring->netdev);472 skb->protocol = eth_type_trans(skb, rx_ring->netdev);
463 473
464 ixgbevf_receive_skb(q_vector, skb, staterr, rx_ring, rx_desc);474 ixgbevf_receive_skb(q_vector, skb, staterr, rx_desc);
465 475
466next_desc:476next_desc:
467 rx_desc->wb.upper.status_error = 0;477 rx_desc->wb.upper.status_error = 0;
@@ -490,6 +500,8 @@ next_desc: · 22 unmodified lines
490 rx_ring->total_packets += total_rx_packets;500 rx_ring->total_packets += total_rx_packets;
491 rx_ring->total_bytes += total_rx_bytes;501 rx_ring->total_bytes += total_rx_bytes;
492 u64_stats_update_end(&rx_ring->syncp);502 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;
493 505
494 return !!budget;506 return !!budget;
495}507}
@@ -716,40 +728,15 @@ static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector) · 220 unmodified lines
716 }728 }
717}729}
718 730
719static irqreturn_t ixgbevf_msix_mbx(int irq, void *data)731static irqreturn_t ixgbevf_msix_other(int irq, void *data)
720{732{
721 struct ixgbevf_adapter *adapter = data;733 struct ixgbevf_adapter *adapter = data;
722 struct ixgbe_hw *hw = &adapter->hw;734 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;
728 735
729 if (!hw->mbx.ops.check_for_msg(hw)) {736 hw->mac.get_link_status = 1;
730 hw->mbx.ops.read(hw, &msg, 1);
731 737
732 if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG)738 if (!test_bit(__IXGBEVF_DOWN, &adapter->state))
733 mod_timer(&adapter->watchdog_timer,739 mod_timer(&adapter->watchdog_timer, jiffies);
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;
753 740
754 IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, adapter->eims_other);741 IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, adapter->eims_other);
755 742
@@ -899,10 +886,10 @@ static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter) · 143 unmodified lines
899 }886 }
900 887
901 err = request_irq(adapter->msix_entries[vector].vector,888 err = request_irq(adapter->msix_entries[vector].vector,
902 &ixgbevf_msix_mbx, 0, netdev->name, adapter);889 &ixgbevf_msix_other, 0, netdev->name, adapter);
903 if (err) {890 if (err) {
904 hw_dbg(&adapter->hw,891 hw_dbg(&adapter->hw,
905 "request_irq for msix_mbx failed: %d\n", err);892 "request_irq for msix_other failed: %d\n", err);
906 goto free_queue_irqs;893 goto free_queue_irqs;
907 }894 }
908 895
@@ -1057,15 +1044,46 @@ static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index) · 148 unmodified lines
1057 1044
1058 srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;1045 srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
1059 1046
1060 if (rx_ring->rx_buf_len == MAXIMUM_ETHERNET_VLAN_SIZE)1047 srrctl |= ALIGN(rx_ring->rx_buf_len, 1024) >>
1061 srrctl |= IXGBEVF_RXBUFFER_2048 >>1048 IXGBE_SRRCTL_BSIZEPKT_SHIFT;
1062 IXGBE_SRRCTL_BSIZEPKT_SHIFT;1049
1063 else
1064 srrctl |= rx_ring->rx_buf_len >>
1065 IXGBE_SRRCTL_BSIZEPKT_SHIFT;
1066 IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(index), srrctl);1050 IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(index), srrctl);
1067}1051}
1068 1052
1053static 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
1069/**1087/**
1070 * ixgbevf_configure_rx - Configure 82599 VF Receive Unit after Reset1088 * ixgbevf_configure_rx - Configure 82599 VF Receive Unit after Reset
1071 * @adapter: board private structure1089 * @adapter: board private structure
@@ -1076,18 +1094,14 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter) · 4 unmodified lines
1076{1094{
1077 u64 rdba;1095 u64 rdba;
1078 struct ixgbe_hw *hw = &adapter->hw;1096 struct ixgbe_hw *hw = &adapter->hw;
1079 struct net_device *netdev = adapter->netdev;
1080 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
1081 int i, j;1097 int i, j;
1082 u32 rdlen;1098 u32 rdlen;
1083 int rx_buf_len;
1084 1099
1085 /* PSRTYPE must be initialized in 82599 */1100 /* PSRTYPE must be initialized in 82599 */
1086 IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);1101 IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);
1087 if (netdev->mtu <= ETH_DATA_LEN)1102
1088 rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE;1103 /* set_rx_buffer_len must be called before ring initialization */
1089 else1104 ixgbevf_set_rx_buffer_len(adapter);
1090 rx_buf_len = ALIGN(max_frame, 1024);
1091 1105
1092 rdlen = adapter->rx_ring[0].count * sizeof(union ixgbe_adv_rx_desc);1106 rdlen = adapter->rx_ring[0].count * sizeof(union ixgbe_adv_rx_desc);
1093 /* Setup the HW Rx Head and Tail Descriptor Pointers and1107 /* 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
1103 IXGBE_WRITE_REG(hw, IXGBE_VFRDT(j), 0);1117 IXGBE_WRITE_REG(hw, IXGBE_VFRDT(j), 0);
1104 adapter->rx_ring[i].head = IXGBE_VFRDH(j);1118 adapter->rx_ring[i].head = IXGBE_VFRDH(j);
1105 adapter->rx_ring[i].tail = IXGBE_VFRDT(j);1119 adapter->rx_ring[i].tail = IXGBE_VFRDT(j);
1106 adapter->rx_ring[i].rx_buf_len = rx_buf_len;
1107 1120
1108 ixgbevf_configure_srrctl(adapter, j);1121 ixgbevf_configure_srrctl(adapter, j);
1109 }1122 }
@@ -1113,36 +1126,47 @@ static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) · 3 unmodified lines
1113{1126{
1114 struct ixgbevf_adapter *adapter = netdev_priv(netdev);1127 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
1115 struct ixgbe_hw *hw = &adapter->hw;1128 struct ixgbe_hw *hw = &adapter->hw;
1129 int err;
1130
1131 if (!hw->mac.ops.set_vfta)
1132 return -EOPNOTSUPP;
1116 1133
1117 spin_lock(&adapter->mbx_lock);1134 spin_lock(&adapter->mbx_lock);
1118 1135
1119 /* add VID to filter table */1136 /* add VID to filter table */
1120 if (hw->mac.ops.set_vfta)1137 err = hw->mac.ops.set_vfta(hw, vid, 0, true);
1121 hw->mac.ops.set_vfta(hw, vid, 0, true);
1122 1138
1123 spin_unlock(&adapter->mbx_lock);1139 spin_unlock(&adapter->mbx_lock);
1124 1140
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
1125 set_bit(vid, adapter->active_vlans);1148 set_bit(vid, adapter->active_vlans);
1126 1149
1127 return 0;1150 return err;
1128}1151}
1129 1152
1130static int ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)1153static int ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1131{1154{
1132 struct ixgbevf_adapter *adapter = netdev_priv(netdev);1155 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
1133 struct ixgbe_hw *hw = &adapter->hw;1156 struct ixgbe_hw *hw = &adapter->hw;
1157 int err = -EOPNOTSUPP;
1134 1158
1135 spin_lock(&adapter->mbx_lock);1159 spin_lock(&adapter->mbx_lock);
1136 1160
1137 /* remove VID from filter table */1161 /* remove VID from filter table */
1138 if (hw->mac.ops.set_vfta)1162 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);
1140 1164
1141 spin_unlock(&adapter->mbx_lock);1165 spin_unlock(&adapter->mbx_lock);
1142 1166
1143 clear_bit(vid, adapter->active_vlans);1167 clear_bit(vid, adapter->active_vlans);
1144 1168
1145 return 0;1169 return err;
1146}1170}
1147 1171
1148static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter)1172static 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
1308 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc;1332 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc;
1309}1333}
1310 1334
1335static 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
1311static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)1354static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
1312{1355{
1313 struct net_device *netdev = adapter->netdev;1356 struct net_device *netdev = adapter->netdev;
@@ -1315,7 +1358,6 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) · 1 unmodified line
1315 int i, j = 0;1358 int i, j = 0;
1316 int num_rx_rings = adapter->num_rx_queues;1359 int num_rx_rings = adapter->num_rx_queues;
1317 u32 txdctl, rxdctl;1360 u32 txdctl, rxdctl;
1318 u32 msg[2];
1319 1361
1320 for (i = 0; i < adapter->num_tx_queues; i++) {1362 for (i = 0; i < adapter->num_tx_queues; i++) {
1321 j = adapter->tx_ring[i].reg_idx;1363 j = adapter->tx_ring[i].reg_idx;
@@ -1356,10 +1398,6 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) · 34 unmodified lines
1356 hw->mac.ops.set_rar(hw, 0, hw->mac.perm_addr, 0);1398 hw->mac.ops.set_rar(hw, 0, hw->mac.perm_addr, 0);
1357 }1399 }
1358 1400
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
1363 spin_unlock(&adapter->mbx_lock);1401 spin_unlock(&adapter->mbx_lock);
1364 1402
1365 clear_bit(__IXGBEVF_DOWN, &adapter->state);1403 clear_bit(__IXGBEVF_DOWN, &adapter->state);
@@ -1371,6 +1409,7 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) · 5 unmodified lines
1371 ixgbevf_save_reset_stats(adapter);1409 ixgbevf_save_reset_stats(adapter);
1372 ixgbevf_init_last_counter_stats(adapter);1410 ixgbevf_init_last_counter_stats(adapter);
1373 1411
1412 hw->mac.get_link_status = 1;
1374 mod_timer(&adapter->watchdog_timer, jiffies);1413 mod_timer(&adapter->watchdog_timer, jiffies);
1375}1414}
1376 1415
@@ -1378,6 +1417,8 @@ void ixgbevf_up(struct ixgbevf_adapter *adapter) · 1 unmodified line
1378{1417{
1379 struct ixgbe_hw *hw = &adapter->hw;1418 struct ixgbe_hw *hw = &adapter->hw;
1380 1419
1420 ixgbevf_negotiate_api(adapter);
1421
1381 ixgbevf_configure(adapter);1422 ixgbevf_configure(adapter);
1382 1423
1383 ixgbevf_up_complete(adapter);1424 ixgbevf_up_complete(adapter);
@@ -1419,7 +1460,7 @@ static void ixgbevf_clean_rx_ring(struct ixgbevf_adapter *adapter, · 35 unmodified lines
1419 rx_buffer_info->skb = NULL;1460 rx_buffer_info->skb = NULL;
1420 do {1461 do {
1421 struct sk_buff *this = skb;1462 struct sk_buff *this = skb;
1422 skb = skb->prev;1463 skb = IXGBE_CB(skb)->prev;
1423 dev_kfree_skb(this);1464 dev_kfree_skb(this);
1424 } while (skb);1465 } while (skb);
1425 }1466 }
@@ -1547,8 +1588,6 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter) · 121 unmodified lines
1547 1588
1548void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter)1589void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter)
1549{1590{
1550 struct ixgbe_hw *hw = &adapter->hw;
1551
1552 WARN_ON(in_interrupt());1591 WARN_ON(in_interrupt());
1553 1592
1554 while (test_and_set_bit(__IXGBEVF_RESETTING, &adapter->state))1593 while (test_and_set_bit(__IXGBEVF_RESETTING, &adapter->state))
@@ -1561,10 +1600,8 @@ void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter) · 6 unmodified lines
1561 * watchdog task will continue to schedule reset tasks until1600 * watchdog task will continue to schedule reset tasks until
1562 * the PF is up and running.1601 * the PF is up and running.
1563 */1602 */
1564 if (!hw->mac.ops.reset_hw(hw)) {1603 ixgbevf_down(adapter);
1565 ixgbevf_down(adapter);1604 ixgbevf_up(adapter);
1566 ixgbevf_up(adapter);
1567 }
1568 1605
1569 clear_bit(__IXGBEVF_RESETTING, &adapter->state);1606 clear_bit(__IXGBEVF_RESETTING, &adapter->state);
1570}1607}
@@ -1866,6 +1903,22 @@ err_set_interrupt: · 295 unmodified lines
1866 return err;1903 return err;
1867}1904}
1868 1905
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 **/
1913static 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
1869/**1922/**
1870 * ixgbevf_sw_init - Initialize general software structures1923 * ixgbevf_sw_init - Initialize general software structures
1871 * (struct ixgbevf_adapter)1924 * (struct ixgbevf_adapter)
@@ -2351,6 +2404,8 @@ static int ixgbevf_open(struct net_device *netdev) · 479 unmodified lines
2351 }2404 }
2352 }2405 }
2353 2406
2407 ixgbevf_negotiate_api(adapter);
2408
2354 /* allocate transmit descriptors */2409 /* allocate transmit descriptors */
2355 err = ixgbevf_setup_all_tx_resources(adapter);2410 err = ixgbevf_setup_all_tx_resources(adapter);
2356 if (err)2411 if (err)
@@ -2860,10 +2915,8 @@ static int ixgbevf_set_mac(struct net_device *netdev, void *p) · 503 unmodified lines
2860static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)2915static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
2861{2916{
2862 struct ixgbevf_adapter *adapter = netdev_priv(netdev);2917 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
2863 struct ixgbe_hw *hw = &adapter->hw;
2864 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;2918 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
2865 int max_possible_frame = MAXIMUM_ETHERNET_VLAN_SIZE;2919 int max_possible_frame = MAXIMUM_ETHERNET_VLAN_SIZE;
2866 u32 msg[2];
2867 2920
2868 if (adapter->hw.mac.type == ixgbe_mac_X540_vf)2921 if (adapter->hw.mac.type == ixgbe_mac_X540_vf)
2869 max_possible_frame = IXGBE_MAX_JUMBO_FRAME_SIZE;2922 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
2877 /* must set new MTU before calling down or up */2930 /* must set new MTU before calling down or up */
2878 netdev->mtu = new_mtu;2931 netdev->mtu = new_mtu;
2879 2932
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
2886 if (netif_running(netdev))2933 if (netif_running(netdev))
2887 ixgbevf_reinit_locked(adapter);2934 ixgbevf_reinit_locked(adapter);
2888 2935
2889 return 0;2936 return 0;
2890}2937}
2891 2938
2892static void ixgbevf_shutdown(struct pci_dev *pdev)2939static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
2893{2940{
2894 struct net_device *netdev = pci_get_drvdata(pdev);2941 struct net_device *netdev = pci_get_drvdata(pdev);
2895 struct ixgbevf_adapter *adapter = netdev_priv(netdev);2942 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
2943#ifdef CONFIG_PM
2944 int retval = 0;
2945#endif
2896 2946
2897 netif_device_detach(netdev);2947 netif_device_detach(netdev);
2898 2948
2899 if (netif_running(netdev)) {2949 if (netif_running(netdev)) {
2950 rtnl_lock();
2900 ixgbevf_down(adapter);2951 ixgbevf_down(adapter);
2901 ixgbevf_free_irq(adapter);2952 ixgbevf_free_irq(adapter);
2902 ixgbevf_free_all_tx_resources(adapter);2953 ixgbevf_free_all_tx_resources(adapter);
2903 ixgbevf_free_all_rx_resources(adapter);2954 ixgbevf_free_all_rx_resources(adapter);
2955 rtnl_unlock();
2904 }2956 }
2905 2957
2906 pci_save_state(pdev);2958 ixgbevf_clear_interrupt_scheme(adapter);
2907 2959
2960#ifdef CONFIG_PM
2961 retval = pci_save_state(pdev);
2962 if (retval)
2963 return retval;
2964
2965#endif
2908 pci_disable_device(pdev);2966 pci_disable_device(pdev);
2967
2968 return 0;
2969}
2970
2971#ifdef CONFIG_PM
2972static 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 */
3015static void ixgbevf_shutdown(struct pci_dev *pdev)
3016{
3017 ixgbevf_suspend(pdev, PMSG_SUSPEND);
2909}3018}
2910 3019
2911static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev,3020static 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
2946 return stats;3055 return stats;
2947}3056}
2948 3057
2949static const struct net_device_ops ixgbe_netdev_ops = {3058static const struct net_device_ops ixgbevf_netdev_ops = {
2950 .ndo_open = ixgbevf_open,3059 .ndo_open = ixgbevf_open,
2951 .ndo_stop = ixgbevf_close,3060 .ndo_stop = ixgbevf_close,
2952 .ndo_start_xmit = ixgbevf_xmit_frame,3061 .ndo_start_xmit = ixgbevf_xmit_frame,
@@ -2962,7 +3071,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { · 9 unmodified lines
2962 3071
2963static void ixgbevf_assign_netdev_ops(struct net_device *dev)3072static void ixgbevf_assign_netdev_ops(struct net_device *dev)
2964{3073{
2965 dev->netdev_ops = &ixgbe_netdev_ops;3074 dev->netdev_ops = &ixgbevf_netdev_ops;
2966 ixgbevf_set_ethtool_ops(dev);3075 ixgbevf_set_ethtool_ops(dev);
2967 dev->watchdog_timeo = 5 * HZ;3076 dev->watchdog_timeo = 5 * HZ;
2968}3077}
@@ -3131,6 +3240,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, · 162 unmodified lines
3131 return 0;3240 return 0;
3132 3241
3133err_register:3242err_register:
3243 ixgbevf_clear_interrupt_scheme(adapter);
3134err_sw_init:3244err_sw_init:
3135 ixgbevf_reset_interrupt_capability(adapter);3245 ixgbevf_reset_interrupt_capability(adapter);
3136 iounmap(hw->hw_addr);3246 iounmap(hw->hw_addr);
@@ -3168,6 +3278,7 @@ static void __devexit ixgbevf_remove(struct pci_dev *pdev) · 31 unmodified lines
3168 if (netdev->reg_state == NETREG_REGISTERED)3278 if (netdev->reg_state == NETREG_REGISTERED)
3169 unregister_netdev(netdev);3279 unregister_netdev(netdev);
3170 3280
3281 ixgbevf_clear_interrupt_scheme(adapter);
3171 ixgbevf_reset_interrupt_capability(adapter);3282 ixgbevf_reset_interrupt_capability(adapter);
3172 3283
3173 iounmap(adapter->hw.hw_addr);3284 iounmap(adapter->hw.hw_addr);
@@ -3267,6 +3378,11 @@ static struct pci_driver ixgbevf_driver = { · 93 unmodified lines
3267 .id_table = ixgbevf_pci_tbl,3378 .id_table = ixgbevf_pci_tbl,
3268 .probe = ixgbevf_probe,3379 .probe = ixgbevf_probe,
3269 .remove = __devexit_p(ixgbevf_remove),3380 .remove = __devexit_p(ixgbevf_remove),
3381#ifdef CONFIG_PM
3382 /* Power Management Hooks */
3383 .suspend = ixgbevf_suspend,
3384 .resume = ixgbevf_resume,
3385#endif
3270 .shutdown = ixgbevf_shutdown,3386 .shutdown = ixgbevf_shutdown,
3271 .err_handler = &ixgbevf_err_handler3387 .err_handler = &ixgbevf_err_handler
3272};3388};
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
86static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)86static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)
87{87{
88 struct ixgbe_mbx_info *mbx = &hw->mbx;88 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;
90 93
91 ret_val = ixgbevf_poll_for_msg(hw);94 ret_val = ixgbevf_poll_for_msg(hw);
92 95
93 /* if ack received read message, otherwise we timed out */96 /* if ack received read message, otherwise we timed out */
94 if (!ret_val)97 if (!ret_val)
95 ret_val = mbx->ops.read(hw, msg, size);98 ret_val = mbx->ops.read(hw, msg, size);
96 99out:
97 return ret_val;100 return ret_val;
98}101}
99 102
@@ -109,7 +112,11 @@ static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) · 9 unmodified lines
109static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)112static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)
110{113{
111 struct ixgbe_mbx_info *mbx = &hw->mbx;114 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;
113 120
114 /* send msg */121 /* send msg */
115 ret_val = mbx->ops.write(hw, msg, size);122 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
117 /* if msg sent wait until we receive an ack */124 /* if msg sent wait until we receive an ack */
118 if (!ret_val)125 if (!ret_val)
119 ret_val = ixgbevf_poll_for_ack(hw);126 ret_val = ixgbevf_poll_for_ack(hw);
120 127out:
121 return ret_val;128 return ret_val;
122}129}
123 130
drivers/net/ethernet/intel/ixgbevf/mbx.h+19−2
@@ -76,12 +76,29 @@ · 75 unmodified lines
76/* bits 23:16 are used for exra info for certain messages */76/* bits 23:16 are used for exra info for certain messages */
77#define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT)77#define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT)
78 78
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 */
85enum 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 */
79#define IXGBE_VF_RESET 0x01 /* VF requests reset */93#define IXGBE_VF_RESET 0x01 /* VF requests reset */
80#define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */94#define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
81#define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */95#define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */
82#define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */96#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 */97
84#define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */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 */
85 102
86/* length of permanent address message returned from PF */103/* length of permanent address message returned from PF */
87#define IXGBE_VF_PERMADDR_MSG_LEN 4104#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
79 /* Call adapter stop to disable tx/rx and clear interrupts */79 /* Call adapter stop to disable tx/rx and clear interrupts */
80 hw->mac.ops.stop_adapter(hw);80 hw->mac.ops.stop_adapter(hw);
81 81
82 /* reset the api version */
83 hw->api_version = ixgbe_mbox_api_10;
84
82 IXGBE_WRITE_REG(hw, IXGBE_VFCTRL, IXGBE_CTRL_RST);85 IXGBE_WRITE_REG(hw, IXGBE_VFCTRL, IXGBE_CTRL_RST);
83 IXGBE_WRITE_FLUSH(hw);86 IXGBE_WRITE_FLUSH(hw);
84 87
@@ -97,7 +100,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) · 12 unmodified lines
97 msgbuf[0] = IXGBE_VF_RESET;100 msgbuf[0] = IXGBE_VF_RESET;
98 mbx->ops.write_posted(hw, msgbuf, 1);101 mbx->ops.write_posted(hw, msgbuf, 1);
99 102
100 msleep(10);103 mdelay(10);
101 104
102 /* set our "perm_addr" based on info provided by PF */105 /* set our "perm_addr" based on info provided by PF */
103 /* also set up the mc_filter_type which is piggy backed106 /* 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
346static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,349static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
347 bool vlan_on)350 bool vlan_on)
348{351{
352 struct ixgbe_mbx_info *mbx = &hw->mbx;
349 u32 msgbuf[2];353 u32 msgbuf[2];
354 s32 err;
350 355
351 msgbuf[0] = IXGBE_VF_SET_VLAN;356 msgbuf[0] = IXGBE_VF_SET_VLAN;
352 msgbuf[1] = vlan;357 msgbuf[1] = vlan;
353 /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */358 /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
354 msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;359 msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
355 360
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;
357 364
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
376mbx_err:
377 return err;
359}378}
360 379
361/**380/**
@@ -389,20 +408,23 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw, · 27 unmodified lines
389 bool *link_up,408 bool *link_up,
390 bool autoneg_wait_to_complete)409 bool autoneg_wait_to_complete)
391{410{
411 struct ixgbe_mbx_info *mbx = &hw->mbx;
412 struct ixgbe_mac_info *mac = &hw->mac;
413 s32 ret_val = 0;
392 u32 links_reg;414 u32 links_reg;
415 u32 in_msg = 0;
393 416
394 if (!(hw->mbx.ops.check_for_rst(hw))) {417 /* If we were hit with a reset drop the link */
395 *link_up = false;418 if (!mbx->ops.check_for_rst(hw) || !mbx->timeout)
396 *speed = 0;419 mac->get_link_status = true;
397 return -1;
398 }
399 420
400 links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);421 if (!mac->get_link_status)
422 goto out;
401 423
402 if (links_reg & IXGBE_LINKS_UP)424 /* if link status is down no point in checking to see if pf is up */
403 *link_up = true;425 links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
404 else426 if (!(links_reg & IXGBE_LINKS_UP))
405 *link_up = false;427 goto out;
406 428
407 switch (links_reg & IXGBE_LINKS_SPEED_82599) {429 switch (links_reg & IXGBE_LINKS_SPEED_82599) {
408 case IXGBE_LINKS_SPEED_10G_82599:430 case IXGBE_LINKS_SPEED_10G_82599:
@@ -416,7 +438,79 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw, · 7 unmodified lines
416 break;438 break;
417 }439 }
418 440
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
463out:
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 **/
473void 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 **/
487int 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;
420}514}
421 515
422static const struct ixgbe_mac_operations ixgbevf_mac_ops = {516static 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
137 137
138 u8 revision_id;138 u8 revision_id;
139 bool adapter_stopped;139 bool adapter_stopped;
140
141 int api_version;
140};142};
141 143
142struct ixgbevf_hw_stats {144struct ixgbevf_hw_stats {
@@ -170,5 +172,7 @@ struct ixgbevf_info { · 27 unmodified lines
170 const struct ixgbe_mac_operations *mac_ops;172 const struct ixgbe_mac_operations *mac_ops;
171};173};
172 174
175void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
176int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
173#endif /* __IXGBE_VF_H__ */177#endif /* __IXGBE_VF_H__ */
174 178
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
712 if (bounce)712 if (bounce)
713 tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size);713 tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size);
714 714
715 /* Run destructor before passing skb to HW */
716 if (likely(!skb_shared(skb)))
717 skb_orphan(skb);
718
719 if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) {715 if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) {
720 *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);716 *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);
721 op_own |= htonl((bf_index & 0xffff) << 8);717 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 */
22struct 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
105static char mipsnet_string[] = "mipsnet";
106
107/*
108 * Copy data from the MIPSNET rx data port
109 */
110static 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
119static 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
136static 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
148static 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
176static 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
205out_badirq:
206 printk(KERN_INFO "%s: %s(): irq %d for unknown device\n",
207 dev->name, __func__, irq);
208 return ret;
209}
210
211static 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
230static int mipsnet_close(struct net_device *dev)
231{
232 netif_stop_queue(dev);
233 free_irq(dev->irq, dev);
234 return 0;
235}
236
237static void mipsnet_set_mclist(struct net_device *dev)
238{
239}
240
241static 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
251static 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
294out_free_region:
295 release_region(netdev->base_addr, sizeof(struct mipsnet_regs));
296
297out_free_netdev:
298 free_netdev(netdev);
299
300out:
301 return err;
302}
303
304static 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
316static 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
325static 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
339static void __exit mipsnet_exit_module(void)
340{
341 platform_driver_unregister(&mipsnet_driver);
342}
343
344module_init(mipsnet_init_module);
345module_exit(mipsnet_exit_module);
drivers/net/ethernet/nvidia/forcedeth.c+13−4
@@ -3409,7 +3409,7 @@ set_speed: · 3408 unmodified lines
3409 3409
3410 pause_flags = 0;3410 pause_flags = 0;
3411 /* setup pause frame */3411 /* setup pause frame */
3412 if (np->duplex != 0) {3412 if (netif_running(dev) && (np->duplex != 0)) {
3413 if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) {3413 if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) {
3414 adv_pause = adv & (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);3414 adv_pause = adv & (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
3415 lpa_pause = lpa & (LPA_PAUSE_CAP | LPA_PAUSE_ASYM);3415 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
4435 4435
4436 regs->version = FORCEDETH_REGS_VER;4436 regs->version = FORCEDETH_REGS_VER;
4437 spin_lock_irq(&np->lock);4437 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++)
4439 rbuf[i] = readl(base + i*sizeof(u32));4439 rbuf[i] = readl(base + i*sizeof(u32));
4440 spin_unlock_irq(&np->lock);4440 spin_unlock_irq(&np->lock);
4441}4441}
@@ -5455,6 +5455,7 @@ static int nv_close(struct net_device *dev) · 1013 unmodified lines
5455 5455
5456 netif_stop_queue(dev);5456 netif_stop_queue(dev);
5457 spin_lock_irq(&np->lock);5457 spin_lock_irq(&np->lock);
5458 nv_update_pause(dev, 0); /* otherwise stop_tx bricks NIC */
5458 nv_stop_rxtx(dev);5459 nv_stop_rxtx(dev);
5459 nv_txrx_reset(dev);5460 nv_txrx_reset(dev);
5460 5461
@@ -5904,11 +5905,19 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i · 443 unmodified lines
5904 goto out_error;5905 goto out_error;
5905 }5906 }
5906 5907
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
5907 if (id->driver_data & DEV_HAS_VLAN)5918 if (id->driver_data & DEV_HAS_VLAN)
5908 nv_vlan_mode(dev, dev->features);5919 nv_vlan_mode(dev, dev->features);
5909 5920
5910 netif_carrier_off(dev);
5911
5912 dev_info(&pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, addr %pM\n",5921 dev_info(&pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, addr %pM\n",
5913 dev->name, np->phy_oui, np->phyaddr, dev->dev_addr);5922 dev->name, np->phy_oui, np->phyaddr, dev->dev_addr);
5914 5923
drivers/net/ethernet/realtek/r8169.c+3−1
@@ -77,7 +77,7 @@ · 76 unmodified lines
77static const int multicast_filter_limit = 32;77static const int multicast_filter_limit = 32;
78 78
79#define MAX_READ_REQUEST_SHIFT 1279#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 */
81#define SafeMtu 0x1c20 /* ... actually life sucks beyond ~7k */81#define SafeMtu 0x1c20 /* ... actually life sucks beyond ~7k */
82#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */82#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
83 83
@@ -287,6 +287,8 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8169_pci_tbl) = { · 203 unmodified lines
287 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 },287 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 },
288 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 },288 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 },
289 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 },289 { 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 },
290 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 },292 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 },
291 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4302), 0, 0, RTL_CFG_0 },293 { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4302), 0, 0, RTL_CFG_0 },
292 { PCI_DEVICE(PCI_VENDOR_ID_AT, 0xc107), 0, 0, RTL_CFG_0 },294 { 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
34 This enables support for the SFC9000 I/O Virtualization34 This enables support for the SFC9000 I/O Virtualization
35 features, allowing accelerated network performance in35 features, allowing accelerated network performance in
36 virtualized environments.36 virtualized environments.
37config 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
5 mcdi.o mcdi_phy.o mcdi_mon.o5 mcdi.o mcdi_phy.o mcdi_mon.o
6sfc-$(CONFIG_SFC_MTD) += mtd.o6sfc-$(CONFIG_SFC_MTD) += mtd.o
7sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o7sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o
8sfc-$(CONFIG_SFC_PTP) += ptp.o
8 9
9obj-$(CONFIG_SFC) += sfc.o10obj-$(CONFIG_SFC) += sfc.o
drivers/net/ethernet/sfc/bitfield.h+11−11
@@ -120,10 +120,10 @@ typedef union efx_oword { · 119 unmodified lines
120 * [0,high-low), with garbage in bits [high-low+1,...).120 * [0,high-low), with garbage in bits [high-low+1,...).
121 */121 */
122#define EFX_EXTRACT_NATIVE(native_element, min, max, low, high) \122#define EFX_EXTRACT_NATIVE(native_element, min, max, low, high) \
123 (((low > max) || (high < min)) ? 0 : \123 ((low) > (max) || (high) < (min) ? 0 : \
124 ((low > min) ? \124 (low) > (min) ? \
125 ((native_element) >> (low - min)) : \125 (native_element) >> ((low) - (min)) : \
126 ((native_element) << (min - low))))126 (native_element) << ((min) - (low)))
127 127
128/*128/*
129 * Extract bit field portion [low,high) from the 64-bit little-endian129 * Extract bit field portion [low,high) from the 64-bit little-endian
@@ -142,27 +142,27 @@ typedef union efx_oword { · 12 unmodified lines
142#define EFX_EXTRACT_OWORD64(oword, low, high) \142#define EFX_EXTRACT_OWORD64(oword, low, high) \
143 ((EFX_EXTRACT64((oword).u64[0], 0, 63, low, high) | \143 ((EFX_EXTRACT64((oword).u64[0], 0, 63, low, high) | \
144 EFX_EXTRACT64((oword).u64[1], 64, 127, low, high)) & \144 EFX_EXTRACT64((oword).u64[1], 64, 127, low, high)) & \
145 EFX_MASK64(high + 1 - low))145 EFX_MASK64((high) + 1 - (low)))
146 146
147#define EFX_EXTRACT_QWORD64(qword, low, high) \147#define EFX_EXTRACT_QWORD64(qword, low, high) \
148 (EFX_EXTRACT64((qword).u64[0], 0, 63, low, high) & \148 (EFX_EXTRACT64((qword).u64[0], 0, 63, low, high) & \
149 EFX_MASK64(high + 1 - low))149 EFX_MASK64((high) + 1 - (low)))
150 150
151#define EFX_EXTRACT_OWORD32(oword, low, high) \151#define EFX_EXTRACT_OWORD32(oword, low, high) \
152 ((EFX_EXTRACT32((oword).u32[0], 0, 31, low, high) | \152 ((EFX_EXTRACT32((oword).u32[0], 0, 31, low, high) | \
153 EFX_EXTRACT32((oword).u32[1], 32, 63, low, high) | \153 EFX_EXTRACT32((oword).u32[1], 32, 63, low, high) | \
154 EFX_EXTRACT32((oword).u32[2], 64, 95, low, high) | \154 EFX_EXTRACT32((oword).u32[2], 64, 95, low, high) | \
155 EFX_EXTRACT32((oword).u32[3], 96, 127, low, high)) & \155 EFX_EXTRACT32((oword).u32[3], 96, 127, low, high)) & \
156 EFX_MASK32(high + 1 - low))156 EFX_MASK32((high) + 1 - (low)))
157 157
158#define EFX_EXTRACT_QWORD32(qword, low, high) \158#define EFX_EXTRACT_QWORD32(qword, low, high) \
159 ((EFX_EXTRACT32((qword).u32[0], 0, 31, low, high) | \159 ((EFX_EXTRACT32((qword).u32[0], 0, 31, low, high) | \
160 EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) & \160 EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) & \
161 EFX_MASK32(high + 1 - low))161 EFX_MASK32((high) + 1 - (low)))
162 162
163#define EFX_EXTRACT_DWORD(dword, low, high) \163#define EFX_EXTRACT_DWORD(dword, low, high) \
164 (EFX_EXTRACT32((dword).u32[0], 0, 31, low, high) & \164 (EFX_EXTRACT32((dword).u32[0], 0, 31, low, high) & \
165 EFX_MASK32(high + 1 - low))165 EFX_MASK32((high) + 1 - (low)))
166 166
167#define EFX_OWORD_FIELD64(oword, field) \167#define EFX_OWORD_FIELD64(oword, field) \
168 EFX_EXTRACT_OWORD64(oword, EFX_LOW_BIT(field), \168 EFX_EXTRACT_OWORD64(oword, EFX_LOW_BIT(field), \
@@ -442,10 +442,10 @@ typedef union efx_oword { · 273 unmodified lines
442 cpu_to_le32(EFX_INSERT_NATIVE(min, max, low, high, value))442 cpu_to_le32(EFX_INSERT_NATIVE(min, max, low, high, value))
443 443
444#define EFX_INPLACE_MASK64(min, max, low, high) \444#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)))
446 446
447#define EFX_INPLACE_MASK32(min, max, low, high) \447#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)))
449 449
450#define EFX_SET_OWORD64(oword, low, high, value) do { \450#define EFX_SET_OWORD64(oword, low, high, value) do { \
451 (oword).u64[0] = (((oword).u64[0] \451 (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
202 202
203#define EFX_ASSERT_RESET_SERIALISED(efx) \203#define EFX_ASSERT_RESET_SERIALISED(efx) \
204 do { \204 do { \
205 if ((efx->state == STATE_RUNNING) || \205 if ((efx->state == STATE_READY) || \
206 (efx->state == STATE_DISABLED)) \206 (efx->state == STATE_DISABLED)) \
207 ASSERT_RTNL(); \207 ASSERT_RTNL(); \
208 } while (0)208 } while (0)
209 209
210static 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
210/**************************************************************************220/**************************************************************************
211 *221 *
212 * Event queue processing222 * Event queue processing
@@ -630,6 +640,16 @@ static void efx_start_datapath(struct efx_nic *efx) · 417 unmodified lines
630 efx->rx_buffer_order = get_order(efx->rx_buffer_len +640 efx->rx_buffer_order = get_order(efx->rx_buffer_len +
631 sizeof(struct efx_rx_page_state));641 sizeof(struct efx_rx_page_state));
632 642
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
633 /* Initialise the channels */653 /* Initialise the channels */
634 efx_for_each_channel(channel, efx) {654 efx_for_each_channel(channel, efx) {
635 efx_for_each_channel_tx_queue(tx_queue, channel)655 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
714 efx_for_each_possible_channel_tx_queue(tx_queue, channel)734 efx_for_each_possible_channel_tx_queue(tx_queue, channel)
715 efx_remove_tx_queue(tx_queue);735 efx_remove_tx_queue(tx_queue);
716 efx_remove_eventq(channel);736 efx_remove_eventq(channel);
737 channel->type->post_remove(channel);
717}738}
718 739
719static void efx_remove_channels(struct efx_nic *efx)740static 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
730 struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel;751 struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel;
731 u32 old_rxq_entries, old_txq_entries;752 u32 old_rxq_entries, old_txq_entries;
732 unsigned i, next_buffer_table = 0;753 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;
734 759
735 /* Not all channels should be reallocated. We must avoid760 /* Not all channels should be reallocated. We must avoid
736 * reallocating their buffer table entries.761 * reallocating their buffer table entries.
@@ -828,6 +853,7 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue) · 91 unmodified lines
828 853
829static const struct efx_channel_type efx_default_channel_type = {854static const struct efx_channel_type efx_default_channel_type = {
830 .pre_probe = efx_channel_dummy_op_int,855 .pre_probe = efx_channel_dummy_op_int,
856 .post_remove = efx_channel_dummy_op_void,
831 .get_name = efx_get_channel_name,857 .get_name = efx_get_channel_name,
832 .copy = efx_copy_channel,858 .copy = efx_copy_channel,
833 .keep_eventq = false,859 .keep_eventq = false,
@@ -838,6 +864,10 @@ int efx_channel_dummy_op_int(struct efx_channel *channel) · 4 unmodified lines
838 return 0;864 return 0;
839}865}
840 866
867void efx_channel_dummy_op_void(struct efx_channel *channel)
868{
869}
870
841/**************************************************************************871/**************************************************************************
842 *872 *
843 * Port handling873 * Port handling
@@ -1365,6 +1395,8 @@ static void efx_start_interrupts(struct efx_nic *efx, bool may_keep_eventq) · 521 unmodified lines
1365{1395{
1366 struct efx_channel *channel;1396 struct efx_channel *channel;
1367 1397
1398 BUG_ON(efx->state == STATE_DISABLED);
1399
1368 if (efx->legacy_irq)1400 if (efx->legacy_irq)
1369 efx->legacy_irq_enabled = true;1401 efx->legacy_irq_enabled = true;
1370 efx_nic_enable_interrupts(efx);1402 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
1382{1414{
1383 struct efx_channel *channel;1415 struct efx_channel *channel;
1384 1416
1417 if (efx->state == STATE_DISABLED)
1418 return;
1419
1385 efx_mcdi_mode_poll(efx);1420 efx_mcdi_mode_poll(efx);
1386 1421
1387 efx_nic_disable_interrupts(efx);1422 efx_nic_disable_interrupts(efx);
@@ -1422,10 +1457,16 @@ static void efx_set_channels(struct efx_nic *efx) · 34 unmodified lines
1422 efx->tx_channel_offset =1457 efx->tx_channel_offset =
1423 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;1458 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;
1424 1459
1425 /* We need to adjust the TX queue numbers if we have separate1460 /* We need to mark which channels really have RX and TX
1461 * queues, and adjust the TX queue numbers if we have separate
1426 * RX-only and TX-only channels.1462 * RX-only and TX-only channels.
1427 */1463 */
1428 efx_for_each_channel(channel, efx) {1464 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
1429 efx_for_each_channel_tx_queue(tx_queue, channel)1470 efx_for_each_channel_tx_queue(tx_queue, channel)
1430 tx_queue->queue -= (efx->tx_channel_offset *1471 tx_queue->queue -= (efx->tx_channel_offset *
1431 EFX_TXQ_TYPES);1472 EFX_TXQ_TYPES);
@@ -1533,22 +1574,21 @@ static int efx_probe_all(struct efx_nic *efx) · 101 unmodified lines
1533 return rc;1574 return rc;
1534}1575}
1535 1576
1536/* Called after previous invocation(s) of efx_stop_all, restarts the port,1577/* If the interface is supposed to be running but is not, start
1537 * kernel transmit queues and NAPI processing, and ensures that the port is1578 * the hardware and software data path, regular activity for the port
1538 * scheduled to be reconfigured. This function is safe to call multiple1579 * (MAC statistics, link polling, etc.) and schedule the port to be
1539 * times when the NIC is in any state.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.
1540 */1583 */
1541static void efx_start_all(struct efx_nic *efx)1584static void efx_start_all(struct efx_nic *efx)
1542{1585{
1543 EFX_ASSERT_RESET_SERIALISED(efx);1586 EFX_ASSERT_RESET_SERIALISED(efx);
1587 BUG_ON(efx->state == STATE_DISABLED);
1544 1588
1545 /* Check that it is appropriate to restart the interface. All1589 /* Check that it is appropriate to restart the interface. All
1546 * of these flags are safe to read under just the rtnl lock */1590 * of these flags are safe to read under just the rtnl lock */
1547 if (efx->port_enabled)1591 if (efx->port_enabled || !netif_running(efx->net_dev))
1548 return;
1549 if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT))
1550 return;
1551 if (!netif_running(efx->net_dev))
1552 return;1592 return;
1553 1593
1554 efx_start_port(efx);1594 efx_start_port(efx);
@@ -1582,11 +1622,11 @@ static void efx_flush_all(struct efx_nic *efx) · 27 unmodified lines
1582 cancel_work_sync(&efx->mac_work);1622 cancel_work_sync(&efx->mac_work);
1583}1623}
1584 1624
1585/* Quiesce hardware and software without bringing the link down.1625/* Quiesce the hardware and software data path, and regular activity
1586 * Safe to call multiple times, when the nic and interface is in any1626 * for the port without bringing the link down. Safe to call multiple
1587 * state. The caller is guaranteed to subsequently be in a position1627 * times with the NIC in almost any state, but interrupts should be
1588 * to modify any hardware and software state they see fit without1628 * enabled. Requires the RTNL lock.
1589 * taking locks. */1629 */
1590static void efx_stop_all(struct efx_nic *efx)1630static void efx_stop_all(struct efx_nic *efx)
1591{1631{
1592 EFX_ASSERT_RESET_SERIALISED(efx);1632 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
1739 struct efx_nic *efx = netdev_priv(net_dev);1779 struct efx_nic *efx = netdev_priv(net_dev);
1740 struct mii_ioctl_data *data = if_mii(ifr);1780 struct mii_ioctl_data *data = if_mii(ifr);
1741 1781
1742 EFX_ASSERT_RESET_SERIALISED(efx);1782 if (cmd == SIOCSHWTSTAMP)
1783 return efx_ptp_ioctl(efx, ifr, cmd);
1743 1784
1744 /* Convert phy_id from older PRTAD/DEVAD format */1785 /* Convert phy_id from older PRTAD/DEVAD format */
1745 if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&1786 if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
@@ -1820,13 +1861,14 @@ static void efx_netpoll(struct net_device *net_dev) · 74 unmodified lines
1820static int efx_net_open(struct net_device *net_dev)1861static int efx_net_open(struct net_device *net_dev)
1821{1862{
1822 struct efx_nic *efx = netdev_priv(net_dev);1863 struct efx_nic *efx = netdev_priv(net_dev);
1823 EFX_ASSERT_RESET_SERIALISED(efx);1864 int rc;
1824 1865
1825 netif_dbg(efx, ifup, efx->net_dev, "opening device on CPU %d\n",1866 netif_dbg(efx, ifup, efx->net_dev, "opening device on CPU %d\n",
1826 raw_smp_processor_id());1867 raw_smp_processor_id());
1827 1868
1828 if (efx->state == STATE_DISABLED)1869 rc = efx_check_disabled(efx);
1829 return -EIO;1870 if (rc)
1871 return rc;
1830 if (efx->phy_mode & PHY_MODE_SPECIAL)1872 if (efx->phy_mode & PHY_MODE_SPECIAL)
1831 return -EBUSY;1873 return -EBUSY;
1832 if (efx_mcdi_poll_reboot(efx) && efx_reset(efx, RESET_TYPE_ALL))1874 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
1852 netif_dbg(efx, ifdown, efx->net_dev, "closing on CPU %d\n",1894 netif_dbg(efx, ifdown, efx->net_dev, "closing on CPU %d\n",
1853 raw_smp_processor_id());1895 raw_smp_processor_id());
1854 1896
1855 if (efx->state != STATE_DISABLED) {1897 /* Stop the device and flush all the channels */
1856 /* Stop the device and flush all the channels */1898 efx_stop_all(efx);
1857 efx_stop_all(efx);
1858 }
1859 1899
1860 return 0;1900 return 0;
1861}1901}
@@ -1915,9 +1955,11 @@ static void efx_watchdog(struct net_device *net_dev) · 53 unmodified lines
1915static int efx_change_mtu(struct net_device *net_dev, int new_mtu)1955static int efx_change_mtu(struct net_device *net_dev, int new_mtu)
1916{1956{
1917 struct efx_nic *efx = netdev_priv(net_dev);1957 struct efx_nic *efx = netdev_priv(net_dev);
1958 int rc;
1918 1959
1919 EFX_ASSERT_RESET_SERIALISED(efx);1960 rc = efx_check_disabled(efx);
1920 1961 if (rc)
1962 return rc;
1921 if (new_mtu > EFX_MAX_MTU)1963 if (new_mtu > EFX_MAX_MTU)
1922 return -EINVAL;1964 return -EINVAL;
1923 1965
@@ -1926,8 +1968,6 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) · 2 unmodified lines
1926 netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu);1968 netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu);
1927 1969
1928 mutex_lock(&efx->mac_lock);1970 mutex_lock(&efx->mac_lock);
1929 /* Reconfigure the MAC before enabling the dma queues so that
1930 * the RX buffers don't overflow */
1931 net_dev->mtu = new_mtu;1971 net_dev->mtu = new_mtu;
1932 efx->type->reconfigure_mac(efx);1972 efx->type->reconfigure_mac(efx);
1933 mutex_unlock(&efx->mac_lock);1973 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
1942 struct sockaddr *addr = data;1982 struct sockaddr *addr = data;
1943 char *new_addr = addr->sa_data;1983 char *new_addr = addr->sa_data;
1944 1984
1945 EFX_ASSERT_RESET_SERIALISED(efx);
1946
1947 if (!is_valid_ether_addr(new_addr)) {1985 if (!is_valid_ether_addr(new_addr)) {
1948 netif_err(efx, drv, efx->net_dev,1986 netif_err(efx, drv, efx->net_dev,
1949 "invalid ethernet MAC address requested: %pM\n",1987 "invalid ethernet MAC address requested: %pM\n",
@@ -2079,11 +2117,27 @@ static int efx_register_netdev(struct efx_nic *efx) · 129 unmodified lines
2079 2117
2080 rtnl_lock();2118 rtnl_lock();
2081 2119
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
2082 rc = dev_alloc_name(net_dev, net_dev->name);2133 rc = dev_alloc_name(net_dev, net_dev->name);
2083 if (rc < 0)2134 if (rc < 0)
2084 goto fail_locked;2135 goto fail_locked;
2085 efx_update_name(efx);2136 efx_update_name(efx);
2086 2137
2138 /* Always start with carrier off; PHY events will detect the link */
2139 netif_carrier_off(net_dev);
2140
2087 rc = register_netdevice(net_dev);2141 rc = register_netdevice(net_dev);
2088 if (rc)2142 if (rc)
2089 goto fail_locked;2143 goto fail_locked;
@@ -2094,9 +2148,6 @@ static int efx_register_netdev(struct efx_nic *efx) · 4 unmodified lines
2094 efx_init_tx_queue_core_txq(tx_queue);2148 efx_init_tx_queue_core_txq(tx_queue);
2095 }2149 }
2096 2150
2097 /* Always start with carrier off; PHY events will detect the link */
2098 netif_carrier_off(net_dev);
2099
2100 rtnl_unlock();2151 rtnl_unlock();
2101 2152
2102 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type);2153 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
2108 2159
2109 return 0;2160 return 0;
2110 2161
2162fail_registered:
2163 rtnl_lock();
2164 unregister_netdevice(net_dev);
2111fail_locked:2165fail_locked:
2166 efx->state = STATE_UNINIT;
2112 rtnl_unlock();2167 rtnl_unlock();
2113 netif_err(efx, drv, efx->net_dev, "could not register net dev\n");2168 netif_err(efx, drv, efx->net_dev, "could not register net dev\n");
2114 return rc;2169 return rc;
2115
2116fail_registered:
2117 unregister_netdev(net_dev);
2118 return rc;
2119}2170}
2120 2171
2121static void efx_unregister_netdev(struct efx_nic *efx)2172static void efx_unregister_netdev(struct efx_nic *efx)
@@ -2138,7 +2189,11 @@ static void efx_unregister_netdev(struct efx_nic *efx) · 16 unmodified lines
2138 2189
2139 strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name));2190 strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name));
2140 device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_type);2191 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();
2142}2197}
2143 2198
2144/**************************************************************************2199/**************************************************************************
@@ -2154,9 +2209,9 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method) · 9 unmodified lines
2154 EFX_ASSERT_RESET_SERIALISED(efx);2209 EFX_ASSERT_RESET_SERIALISED(efx);
2155 2210
2156 efx_stop_all(efx);2211 efx_stop_all(efx);
2157 mutex_lock(&efx->mac_lock);
2158
2159 efx_stop_interrupts(efx, false);2212 efx_stop_interrupts(efx, false);
2213
2214 mutex_lock(&efx->mac_lock);
2160 if (efx->port_initialized && method != RESET_TYPE_INVISIBLE)2215 if (efx->port_initialized && method != RESET_TYPE_INVISIBLE)
2161 efx->phy_op->fini(efx);2216 efx->phy_op->fini(efx);
2162 efx->type->fini(efx);2217 efx->type->fini(efx);
@@ -2276,16 +2331,15 @@ static void efx_reset_work(struct work_struct *data) · 113 unmodified lines
2276 if (!pending)2331 if (!pending)
2277 return;2332 return;
2278 2333
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
2287 rtnl_lock();2334 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
2289 rtnl_unlock();2343 rtnl_unlock();
2290}2344}
2291 2345
@@ -2311,6 +2365,13 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) · 19 unmodified lines
2311 }2365 }
2312 2366
2313 set_bit(method, &efx->reset_pending);2367 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;
2314 2375
2315 /* efx_process_channel() will no longer read events once a2376 /* efx_process_channel() will no longer read events once a
2316 * reset is scheduled. So switch back to poll'd MCDI completions. */2377 * 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
2376/* This zeroes out and then fills in the invariants in a struct2437/* This zeroes out and then fills in the invariants in a struct
2377 * efx_nic (including all sub-structures).2438 * efx_nic (including all sub-structures).
2378 */2439 */
2379static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,2440static int efx_init_struct(struct efx_nic *efx,
2380 struct pci_dev *pci_dev, struct net_device *net_dev)2441 struct pci_dev *pci_dev, struct net_device *net_dev)
2381{2442{
2382 int i;2443 int i;
2383 2444
2384 /* Initialise common structures */2445 /* Initialise common structures */
2385 memset(efx, 0, sizeof(*efx));
2386 spin_lock_init(&efx->biu_lock);2446 spin_lock_init(&efx->biu_lock);
2387#ifdef CONFIG_SFC_MTD2447#ifdef CONFIG_SFC_MTD
2388 INIT_LIST_HEAD(&efx->mtd_list);2448 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
2392 INIT_DELAYED_WORK(&efx->selftest_work, efx_selftest_async_work);2452 INIT_DELAYED_WORK(&efx->selftest_work, efx_selftest_async_work);
2393 efx->pci_dev = pci_dev;2453 efx->pci_dev = pci_dev;
2394 efx->msg_enable = debug;2454 efx->msg_enable = debug;
2395 efx->state = STATE_INIT;2455 efx->state = STATE_UNINIT;
2396 strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));2456 strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
2397 2457
2398 efx->net_dev = net_dev;2458 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
2409 goto fail;2469 goto fail;
2410 }2470 }
2411 2471
2412 efx->type = type;
2413
2414 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS);2472 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS);
2415 2473
2416 /* Higher numbered interrupt modes are less capable! */2474 /* Higher numbered interrupt modes are less capable! */
@@ -2455,6 +2513,12 @@ static void efx_fini_struct(struct efx_nic *efx) · 38 unmodified lines
2455 */2513 */
2456static void efx_pci_remove_main(struct efx_nic *efx)2514static void efx_pci_remove_main(struct efx_nic *efx)
2457{2515{
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
2458#ifdef CONFIG_RFS_ACCEL2522#ifdef CONFIG_RFS_ACCEL
2459 free_irq_cpu_rmap(efx->net_dev->rx_cpu_rmap);2523 free_irq_cpu_rmap(efx->net_dev->rx_cpu_rmap);
2460 efx->net_dev->rx_cpu_rmap = NULL;2524 efx->net_dev->rx_cpu_rmap = NULL;
@@ -2480,24 +2544,15 @@ static void efx_pci_remove(struct pci_dev *pci_dev) · 19 unmodified lines
2480 2544
2481 /* Mark the NIC as fini, then stop the interface */2545 /* Mark the NIC as fini, then stop the interface */
2482 rtnl_lock();2546 rtnl_lock();
2483 efx->state = STATE_FINI;
2484 dev_close(efx->net_dev);2547 dev_close(efx->net_dev);
2485 2548 efx_stop_interrupts(efx, false);
2486 /* Allow any queued efx_resets() to complete */
2487 rtnl_unlock();2549 rtnl_unlock();
2488 2550
2489 efx_stop_interrupts(efx, false);
2490 efx_sriov_fini(efx);2551 efx_sriov_fini(efx);
2491 efx_unregister_netdev(efx);2552 efx_unregister_netdev(efx);
2492 2553
2493 efx_mtd_remove(efx);2554 efx_mtd_remove(efx);
2494 2555
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
2501 efx_pci_remove_main(efx);2556 efx_pci_remove_main(efx);
2502 2557
2503 efx_fini_io(efx);2558 efx_fini_io(efx);
@@ -2617,7 +2672,6 @@ static int efx_pci_probe_main(struct efx_nic *efx) · 113 unmodified lines
2617static int __devinit efx_pci_probe(struct pci_dev *pci_dev,2672static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2618 const struct pci_device_id *entry)2673 const struct pci_device_id *entry)
2619{2674{
2620 const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data;
2621 struct net_device *net_dev;2675 struct net_device *net_dev;
2622 struct efx_nic *efx;2676 struct efx_nic *efx;
2623 int rc;2677 int rc;
@@ -2627,10 +2681,12 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, · 3 unmodified lines
2627 EFX_MAX_RX_QUEUES);2681 EFX_MAX_RX_QUEUES);
2628 if (!net_dev)2682 if (!net_dev)
2629 return -ENOMEM;2683 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 |
2631 NETIF_F_HIGHDMA | NETIF_F_TSO |2687 NETIF_F_HIGHDMA | NETIF_F_TSO |
2632 NETIF_F_RXCSUM);2688 NETIF_F_RXCSUM);
2633 if (type->offload_features & NETIF_F_V6_CSUM)2689 if (efx->type->offload_features & NETIF_F_V6_CSUM)
2634 net_dev->features |= NETIF_F_TSO6;2690 net_dev->features |= NETIF_F_TSO6;
2635 /* Mask for features that also apply to VLAN devices */2691 /* Mask for features that also apply to VLAN devices */
2636 net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG |2692 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
2638 NETIF_F_RXCSUM);2694 NETIF_F_RXCSUM);
2639 /* All offloads can be toggled */2695 /* All offloads can be toggled */
2640 net_dev->hw_features = net_dev->features & ~NETIF_F_HIGHDMA;2696 net_dev->hw_features = net_dev->features & ~NETIF_F_HIGHDMA;
2641 efx = netdev_priv(net_dev);
2642 pci_set_drvdata(pci_dev, efx);2697 pci_set_drvdata(pci_dev, efx);
2643 SET_NETDEV_DEV(net_dev, &pci_dev->dev);2698 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);
2645 if (rc)2700 if (rc)
2646 goto fail1;2701 goto fail1;
2647 2702
@@ -2656,28 +2711,9 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, · 8 unmodified lines
2656 goto fail2;2711 goto fail2;
2657 2712
2658 rc = efx_pci_probe_main(efx);2713 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
2666 if (rc)2714 if (rc)
2667 goto fail3;2715 goto fail3;
2668 2716
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
2681 rc = efx_register_netdev(efx);2717 rc = efx_register_netdev(efx);
2682 if (rc)2718 if (rc)
2683 goto fail4;2719 goto fail4;
@@ -2717,12 +2753,18 @@ static int efx_pm_freeze(struct device *dev) · 33 unmodified lines
2717{2753{
2718 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));2754 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
2719 2755
2720 efx->state = STATE_FINI;2756 rtnl_lock();
2721 2757
2722 netif_device_detach(efx->net_dev);2758 if (efx->state != STATE_DISABLED) {
2759 efx->state = STATE_UNINIT;
2723 2760
2724 efx_stop_all(efx);2761 netif_device_detach(efx->net_dev);
2725 efx_stop_interrupts(efx, false);2762
2763 efx_stop_all(efx);
2764 efx_stop_interrupts(efx, false);
2765 }
2766
2767 rtnl_unlock();
2726 2768
2727 return 0;2769 return 0;
2728}2770}
@@ -2731,21 +2773,25 @@ static int efx_pm_thaw(struct device *dev) · 2 unmodified lines
2731{2773{
2732 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));2774 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
2733 2775
2734 efx->state = STATE_INIT;2776 rtnl_lock();
2735 2777
2736 efx_start_interrupts(efx, false);2778 if (efx->state != STATE_DISABLED) {
2779 efx_start_interrupts(efx, false);
2737 2780
2738 mutex_lock(&efx->mac_lock);2781 mutex_lock(&efx->mac_lock);
2739 efx->phy_op->reconfigure(efx);2782 efx->phy_op->reconfigure(efx);
2740 mutex_unlock(&efx->mac_lock);2783 mutex_unlock(&efx->mac_lock);
2741 2784
2742 efx_start_all(efx);2785 efx_start_all(efx);
2743 2786
2744 netif_device_attach(efx->net_dev);2787 netif_device_attach(efx->net_dev);
2745 2788
2746 efx->state = STATE_RUNNING;2789 efx->state = STATE_READY;
2747 2790
2748 efx->type->resume_wol(efx);2791 efx->type->resume_wol(efx);
2792 }
2793
2794 rtnl_unlock();
2749 2795
2750 /* Reschedule any quenched resets scheduled during efx_pm_freeze() */2796 /* Reschedule any quenched resets scheduled during efx_pm_freeze() */
2751 queue_work(reset_workqueue, &efx->reset_work);2797 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
102 102
103/* Channels */103/* Channels */
104extern int efx_channel_dummy_op_int(struct efx_channel *channel);104extern int efx_channel_dummy_op_int(struct efx_channel *channel);
105extern void efx_channel_dummy_op_void(struct efx_channel *channel);
105extern void efx_process_channel_now(struct efx_channel *channel);106extern void efx_process_channel_now(struct efx_channel *channel);
106extern int107extern int
107efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries);108efx_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
337 unsigned int test_index,337 unsigned int test_index,
338 struct ethtool_string *strings, u64 *data)338 struct ethtool_string *strings, u64 *data)
339{339{
340 struct efx_channel *channel = efx_get_channel(efx, 0);340 struct efx_channel *channel =
341 efx_get_channel(efx, efx->tx_channel_offset);
341 struct efx_tx_queue *tx_queue;342 struct efx_tx_queue *tx_queue;
342 343
343 efx_for_each_channel_tx_queue(tx_queue, channel) {344 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
529 if (!efx_tests)530 if (!efx_tests)
530 goto fail;531 goto fail;
531 532
532 533 if (efx->state != STATE_READY) {
533 ASSERT_RTNL();
534 if (efx->state != STATE_RUNNING) {
535 rc = -EIO;534 rc = -EIO;
536 goto fail1;535 goto fail1;
537 }536 }
@@ -962,9 +961,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, · 424 unmodified lines
962 int rc;961 int rc;
963 962
964 /* Check that user wants us to choose the location */963 /* Check that user wants us to choose the location */
965 if (rule->location != RX_CLS_LOC_ANY &&964 if (rule->location != RX_CLS_LOC_ANY)
966 rule->location != RX_CLS_LOC_FIRST &&
967 rule->location != RX_CLS_LOC_LAST)
968 return -EINVAL;965 return -EINVAL;
969 966
970 /* Range-check ring_cookie */967 /* Range-check ring_cookie */
@@ -978,9 +975,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, · 7 unmodified lines
978 rule->m_ext.data[1]))975 rule->m_ext.data[1]))
979 return -EINVAL;976 return -EINVAL;
980 977
981 efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL,978 efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, 0,
982 (rule->location == RX_CLS_LOC_FIRST) ?
983 EFX_FILTER_FLAG_RX_OVERRIDE_IP : 0,
984 (rule->ring_cookie == RX_CLS_FLOW_DISC) ?979 (rule->ring_cookie == RX_CLS_FLOW_DISC) ?
985 0xfff : rule->ring_cookie);980 0xfff : rule->ring_cookie);
986 981
@@ -1176,6 +1171,7 @@ const struct ethtool_ops efx_ethtool_ops = { · 189 unmodified lines
1176 .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,1171 .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
1177 .get_rxfh_indir = efx_ethtool_get_rxfh_indir,1172 .get_rxfh_indir = efx_ethtool_get_rxfh_indir,
1178 .set_rxfh_indir = efx_ethtool_set_rxfh_indir,1173 .set_rxfh_indir = efx_ethtool_set_rxfh_indir,
1174 .get_ts_info = efx_ptp_get_ts_info,
1179 .get_module_info = efx_ethtool_get_module_info,1175 .get_module_info = efx_ethtool_get_module_info,
1180 .get_module_eeprom = efx_ethtool_get_module_eeprom,1176 .get_module_eeprom = efx_ethtool_get_module_eeprom,
1181};1177};
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
380 new_mode = PHY_MODE_SPECIAL;380 new_mode = PHY_MODE_SPECIAL;
381 if (!((old_mode ^ new_mode) & PHY_MODE_SPECIAL)) {381 if (!((old_mode ^ new_mode) & PHY_MODE_SPECIAL)) {
382 err = 0;382 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)) {
384 err = -EBUSY;384 err = -EBUSY;
385 } else {385 } else {
386 /* Reset the PHY, reconfigure the MAC and enable/disable386 /* 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
161 filter_ctl, FRF_CZ_UNICAST_NOMATCH_RSS_ENABLED,161 filter_ctl, FRF_CZ_UNICAST_NOMATCH_RSS_ENABLED,
162 !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags &162 !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags &
163 EFX_FILTER_FLAG_RX_RSS));163 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));
168 EFX_SET_OWORD_FIELD(164 EFX_SET_OWORD_FIELD(
169 filter_ctl, FRF_CZ_MULTICAST_NOMATCH_Q_ID,165 filter_ctl, FRF_CZ_MULTICAST_NOMATCH_Q_ID,
170 table->spec[EFX_FILTER_INDEX_MC_DEF].dmaq_id);166 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
172 filter_ctl, FRF_CZ_MULTICAST_NOMATCH_RSS_ENABLED,168 filter_ctl, FRF_CZ_MULTICAST_NOMATCH_RSS_ENABLED,
173 !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags &169 !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags &
174 EFX_FILTER_FLAG_RX_RSS));170 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));
179 }171 }
180 172
181 efx_writeo(efx, &filter_ctl, FR_BZ_RX_FILTER_CTL);173 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
480 472
481 case EFX_FILTER_TABLE_RX_MAC: {473 case EFX_FILTER_TABLE_RX_MAC: {
482 bool is_wild = spec->type == EFX_FILTER_MAC_WILD;474 bool is_wild = spec->type == EFX_FILTER_MAC_WILD;
483 EFX_POPULATE_OWORD_8(475 EFX_POPULATE_OWORD_7(
484 *filter,476 *filter,
485 FRF_CZ_RMFT_RSS_EN,477 FRF_CZ_RMFT_RSS_EN,
486 !!(spec->flags & EFX_FILTER_FLAG_RX_RSS),478 !!(spec->flags & EFX_FILTER_FLAG_RX_RSS),
487 FRF_CZ_RMFT_SCATTER_EN,479 FRF_CZ_RMFT_SCATTER_EN,
488 !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER),480 !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER),
489 FRF_CZ_RMFT_IP_OVERRIDE,
490 !!(spec->flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP),
491 FRF_CZ_RMFT_RXQ_ID, spec->dmaq_id,481 FRF_CZ_RMFT_RXQ_ID, spec->dmaq_id,
492 FRF_CZ_RMFT_WILDCARD_MATCH, is_wild,482 FRF_CZ_RMFT_WILDCARD_MATCH, is_wild,
493 FRF_CZ_RMFT_DEST_MAC_HI, spec->data[2],483 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
567}557}
568 558
569/*559/*
570 * Construct/deconstruct external filter IDs. These must be ordered560 * Construct/deconstruct external filter IDs. At least the RX filter
571 * by matching priority, for RX NFC semantics.561 * IDs must be ordered by matching priority, for RX NFC semantics.
572 *562 *
573 * Each RX MAC filter entry has a flag for whether it can override an563 * Deconstruction needs to be robust against invalid IDs so that
574 * RX IP filter that also matches. So we assign locations for MAC564 * efx_filter_remove_id_safe() and efx_filter_get_filter_safe() can
575 * filters with overriding behaviour, then for IP filters, then for565 * accept user-provided IDs.
576 * MAC filters without overriding behaviour.
577 */566 */
578 567
579#define EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP 0568#define EFX_FILTER_MATCH_PRI_COUNT 5
580#define EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP 1569
581#define EFX_FILTER_MATCH_PRI_NORMAL_BASE 2570static 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
581static 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};
582 592
583#define EFX_FILTER_INDEX_WIDTH 13593#define EFX_FILTER_INDEX_WIDTH 13
584#define EFX_FILTER_INDEX_MASK ((1 << EFX_FILTER_INDEX_WIDTH) - 1)594#define EFX_FILTER_INDEX_MASK ((1 << EFX_FILTER_INDEX_WIDTH) - 1)
585 595
586static inline u32 efx_filter_make_id(enum efx_filter_table_id table_id,596static inline u32
587 unsigned int index, u8 flags)597efx_filter_make_id(const struct efx_filter_spec *spec, unsigned int index)
588{598{
589 unsigned int match_pri = EFX_FILTER_MATCH_PRI_NORMAL_BASE + table_id;599 unsigned int range;
590 600
591 if (flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP) {601 range = efx_filter_type_match_pri[spec->type];
592 if (table_id == EFX_FILTER_TABLE_RX_MAC)602 if (!(spec->flags & EFX_FILTER_FLAG_RX))
593 match_pri = EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP;603 range += EFX_FILTER_MATCH_PRI_COUNT;
594 else if (table_id == EFX_FILTER_TABLE_RX_DEF)
595 match_pri = EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP;
596 }
597 604
598 return match_pri << EFX_FILTER_INDEX_WIDTH | index;605 return range << EFX_FILTER_INDEX_WIDTH | index;
599}606}
600 607
601static inline enum efx_filter_table_id efx_filter_id_table_id(u32 id)608static inline enum efx_filter_table_id efx_filter_id_table_id(u32 id)
602{609{
603 unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH;610 unsigned int range = id >> EFX_FILTER_INDEX_WIDTH;
604 611
605 switch (match_pri) {612 if (range < ARRAY_SIZE(efx_filter_range_table))
606 case EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP:613 return efx_filter_range_table[range];
607 return EFX_FILTER_TABLE_RX_MAC;614 else
608 case EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP:615 return EFX_FILTER_TABLE_COUNT; /* invalid */
609 return EFX_FILTER_TABLE_RX_DEF;
610 default:
611 return match_pri - EFX_FILTER_MATCH_PRI_NORMAL_BASE;
612 }
613}616}
614 617
615static inline unsigned int efx_filter_id_index(u32 id)618static 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
619 622
620static inline u8 efx_filter_id_flags(u32 id)623static inline u8 efx_filter_id_flags(u32 id)
621{624{
622 unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH;625 unsigned int range = id >> EFX_FILTER_INDEX_WIDTH;
623 626
624 if (match_pri < EFX_FILTER_MATCH_PRI_NORMAL_BASE)627 if (range < EFX_FILTER_MATCH_PRI_COUNT)
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)
628 return EFX_FILTER_FLAG_RX;628 return EFX_FILTER_FLAG_RX;
629 else629 else
630 return EFX_FILTER_FLAG_TX;630 return EFX_FILTER_FLAG_TX;
@@ -633,14 +633,15 @@ static inline u8 efx_filter_id_flags(u32 id) · 2 unmodified lines
633u32 efx_filter_get_rx_id_limit(struct efx_nic *efx)633u32 efx_filter_get_rx_id_limit(struct efx_nic *efx)
634{634{
635 struct efx_filter_state *state = efx->filter_state;635 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;
637 638
638 do {639 do {
640 table_id = efx_filter_range_table[range];
639 if (state->table[table_id].size != 0)641 if (state->table[table_id].size != 0)
640 return ((EFX_FILTER_MATCH_PRI_NORMAL_BASE + table_id)642 return range << EFX_FILTER_INDEX_WIDTH |
641 << EFX_FILTER_INDEX_WIDTH) +
642 state->table[table_id].size;643 state->table[table_id].size;
643 } while (table_id--);644 } while (range--);
644 645
645 return 0;646 return 0;
646}647}
@@ -718,7 +719,7 @@ s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, · 71 unmodified lines
718 netif_vdbg(efx, hw, efx->net_dev,719 netif_vdbg(efx, hw, efx->net_dev,
719 "%s: filter type %d index %d rxq %u set",720 "%s: filter type %d index %d rxq %u set",
720 __func__, spec->type, filter_idx, spec->dmaq_id);721 __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);
722 723
723out:724out:
724 spin_unlock_bh(&state->lock);725 spin_unlock_bh(&state->lock);
@@ -781,8 +782,7 @@ int efx_filter_remove_id_safe(struct efx_nic *efx, · 56 unmodified lines
781 spin_lock_bh(&state->lock);782 spin_lock_bh(&state->lock);
782 783
783 if (test_bit(filter_idx, table->used_bitmap) &&784 if (test_bit(filter_idx, table->used_bitmap) &&
784 spec->priority == priority &&785 spec->priority == priority) {
785 !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) {
786 efx_filter_table_clear_entry(efx, table, filter_idx);786 efx_filter_table_clear_entry(efx, table, filter_idx);
787 if (table->used == 0)787 if (table->used == 0)
788 efx_filter_table_reset_search_depth(table);788 efx_filter_table_reset_search_depth(table);
@@ -833,8 +833,7 @@ int efx_filter_get_filter_safe(struct efx_nic *efx, · 44 unmodified lines
833 spin_lock_bh(&state->lock);833 spin_lock_bh(&state->lock);
834 834
835 if (test_bit(filter_idx, table->used_bitmap) &&835 if (test_bit(filter_idx, table->used_bitmap) &&
836 spec->priority == priority &&836 spec->priority == priority) {
837 !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) {
838 *spec_buf = *spec;837 *spec_buf = *spec;
839 rc = 0;838 rc = 0;
840 } else {839 } else {
@@ -927,8 +926,7 @@ s32 efx_filter_get_rx_ids(struct efx_nic *efx, · 86 unmodified lines
927 goto out;926 goto out;
928 }927 }
929 buf[count++] = efx_filter_make_id(928 buf[count++] = efx_filter_make_id(
930 table_id, filter_idx,929 &table->spec[filter_idx], filter_idx);
931 table->spec[filter_idx].flags);
932 }930 }
933 }931 }
934 }932 }
drivers/net/ethernet/sfc/filter.h+1−6
@@ -61,16 +61,12 @@ enum efx_filter_priority { · 60 unmodified lines
61 * according to the indirection table.61 * according to the indirection table.
62 * @EFX_FILTER_FLAG_RX_SCATTER: Enable DMA scatter on the receiving62 * @EFX_FILTER_FLAG_RX_SCATTER: Enable DMA scatter on the receiving
63 * queue.63 * 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.
67 * @EFX_FILTER_FLAG_RX: Filter is for RX64 * @EFX_FILTER_FLAG_RX: Filter is for RX
68 * @EFX_FILTER_FLAG_TX: Filter is for TX65 * @EFX_FILTER_FLAG_TX: Filter is for TX
69 */66 */
70enum efx_filter_flags {67enum efx_filter_flags {
71 EFX_FILTER_FLAG_RX_RSS = 0x01,68 EFX_FILTER_FLAG_RX_RSS = 0x01,
72 EFX_FILTER_FLAG_RX_SCATTER = 0x02,69 EFX_FILTER_FLAG_RX_SCATTER = 0x02,
73 EFX_FILTER_FLAG_RX_OVERRIDE_IP = 0x04,
74 EFX_FILTER_FLAG_RX = 0x08,70 EFX_FILTER_FLAG_RX = 0x08,
75 EFX_FILTER_FLAG_TX = 0x10,71 EFX_FILTER_FLAG_TX = 0x10,
76};72};
@@ -88,8 +84,7 @@ enum efx_filter_flags { · 11 unmodified lines
88 *84 *
89 * The @priority field is used by software to determine whether a new85 * The @priority field is used by software to determine whether a new
90 * filter may replace an old one. The hardware priority of a filter86 * filter may replace an old one. The hardware priority of a filter
91 * depends on the filter type and %EFX_FILTER_FLAG_RX_OVERRIDE_IP87 * depends on the filter type.
92 * flag.
93 */88 */
94struct efx_filter_spec {89struct efx_filter_spec {
95 u8 type:4;90 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
320 efx_mcdi_complete(mcdi);320 efx_mcdi_complete(mcdi);
321}321}
322 322
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. */
325int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,323int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
326 const u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen,324 const u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen,
327 size_t *outlen_actual)325 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
332void efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, const u8 *inbuf,
333 size_t inlen)
328{334{
329 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);335 struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
330 int rc;336
331 BUG_ON(efx_nic_rev(efx) < EFX_REV_SIENA_A0);337 BUG_ON(efx_nic_rev(efx) < EFX_REV_SIENA_A0);
332 338
333 efx_mcdi_acquire(mcdi);339 efx_mcdi_acquire(mcdi);
@@ -338,6 +344,15 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, · 4 unmodified lines
338 spin_unlock_bh(&mcdi->iface_lock);344 spin_unlock_bh(&mcdi->iface_lock);
339 345
340 efx_mcdi_copyin(efx, cmd, inbuf, inlen);346 efx_mcdi_copyin(efx, cmd, inbuf, inlen);
347}
348
349int 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);
341 356
342 if (mcdi->mode == MCDI_MODE_POLL)357 if (mcdi->mode == MCDI_MODE_POLL)
343 rc = efx_mcdi_poll(efx);358 rc = efx_mcdi_poll(efx);
@@ -563,6 +578,11 @@ void efx_mcdi_process_event(struct efx_channel *channel, · 219 unmodified lines
563 case MCDI_EVENT_CODE_FLR:578 case MCDI_EVENT_CODE_FLR:
564 efx_sriov_flr(efx, MCDI_EVENT_FIELD(*event, FLR_VF));579 efx_sriov_flr(efx, MCDI_EVENT_FIELD(*event, FLR_VF));
565 break;580 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;
566 586
567 default:587 default:
568 netif_err(efx, hw, efx->net_dev, "Unknown MCDI event 0x%x\n",588 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
641 u16 *fw_subtype_list, u32 *capabilities)661 u16 *fw_subtype_list, u32 *capabilities)
642{662{
643 uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];663 uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
644 size_t outlen;664 size_t outlen, offset, i;
645 int port_num = efx_port_num(efx);665 int port_num = efx_port_num(efx);
646 int offset;
647 int rc;666 int rc;
648 667
649 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);668 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
663 : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;682 : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;
664 if (mac_address)683 if (mac_address)
665 memcpy(mac_address, outbuf + offset, ETH_ALEN);684 memcpy(mac_address, outbuf + offset, ETH_ALEN);
666 if (fw_subtype_list)685 if (fw_subtype_list) {
667 memcpy(fw_subtype_list,686 /* Byte-swap and truncate or zero-pad as necessary */
668 outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST,687 offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
669 MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM *688 for (i = 0;
670 sizeof(fw_subtype_list[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 }
671 if (capabilities) {697 if (capabilities) {
672 if (port_num)698 if (port_num)
673 *capabilities = MCDI_DWORD(outbuf,699 *capabilities = MCDI_DWORD(outbuf,
@@ -1169,6 +1195,9 @@ int efx_mcdi_flush_rxqs(struct efx_nic *efx) · 495 unmodified lines
1169 __le32 *qid;1195 __le32 *qid;
1170 int rc, count;1196 int rc, count;
1171 1197
1198 BUILD_BUG_ON(EFX_MAX_CHANNELS >
1199 MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM);
1200
1172 qid = kmalloc(EFX_MAX_CHANNELS * sizeof(*qid), GFP_KERNEL);1201 qid = kmalloc(EFX_MAX_CHANNELS * sizeof(*qid), GFP_KERNEL);
1173 if (qid == NULL)1202 if (qid == NULL)
1174 return -ENOMEM;1203 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
71 size_t inlen, u8 *outbuf, size_t outlen,71 size_t inlen, u8 *outbuf, size_t outlen,
72 size_t *outlen_actual);72 size_t *outlen_actual);
73 73
74extern void efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
75 const u8 *inbuf, size_t inlen);
76extern 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
74extern int efx_mcdi_poll_reboot(struct efx_nic *efx);80extern int efx_mcdi_poll_reboot(struct efx_nic *efx);
75extern void efx_mcdi_mode_poll(struct efx_nic *efx);81extern void efx_mcdi_mode_poll(struct efx_nic *efx);
76extern void efx_mcdi_mode_event(struct efx_nic *efx);82extern 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
107#define MCDI_EVENT_FIELD(_ev, _field) \113#define MCDI_EVENT_FIELD(_ev, _field) \
108 EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)114 EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
109#define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2) \115#define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2) \
110 EFX_DWORD_FIELD( \116 EFX_EXTRACT_DWORD( \
111 *((efx_dword_t *) \117 *((efx_dword_t *) \
112 (MCDI_ARRAY_PTR(_buf, _field1, _type, _index) + \118 (MCDI_ARRAY_PTR(_buf, _field1, _type, _index) + \
113 (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _OFST & ~3))), \119 (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)
115 123
116extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);124extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);
117extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,125extern 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
289#define MCDI_EVENT_CODE_TX_FLUSH 0xc /* enum */289#define MCDI_EVENT_CODE_TX_FLUSH 0xc /* enum */
290#define MCDI_EVENT_CODE_PTP_RX 0xd /* enum */290#define MCDI_EVENT_CODE_PTP_RX 0xd /* enum */
291#define MCDI_EVENT_CODE_PTP_FAULT 0xe /* enum */291#define MCDI_EVENT_CODE_PTP_FAULT 0xe /* enum */
292#define MCDI_EVENT_CODE_PTP_PPS 0xf /* enum */
292#define MCDI_EVENT_CMDDONE_DATA_OFST 0293#define MCDI_EVENT_CMDDONE_DATA_OFST 0
293#define MCDI_EVENT_CMDDONE_DATA_LBN 0294#define MCDI_EVENT_CMDDONE_DATA_LBN 0
294#define MCDI_EVENT_CMDDONE_DATA_WIDTH 32295#define MCDI_EVENT_CMDDONE_DATA_WIDTH 32
@@ -491,12 +492,12 @@ · 196 unmodified lines
491 492
492/* MC_CMD_GET_FPGAREG_OUT msgresponse */493/* MC_CMD_GET_FPGAREG_OUT msgresponse */
493#define MC_CMD_GET_FPGAREG_OUT_LENMIN 1494#define MC_CMD_GET_FPGAREG_OUT_LENMIN 1
494#define MC_CMD_GET_FPGAREG_OUT_LENMAX 255495#define MC_CMD_GET_FPGAREG_OUT_LENMAX 252
495#define MC_CMD_GET_FPGAREG_OUT_LEN(num) (0+1*(num))496#define MC_CMD_GET_FPGAREG_OUT_LEN(num) (0+1*(num))
496#define MC_CMD_GET_FPGAREG_OUT_BUFFER_OFST 0497#define MC_CMD_GET_FPGAREG_OUT_BUFFER_OFST 0
497#define MC_CMD_GET_FPGAREG_OUT_BUFFER_LEN 1498#define MC_CMD_GET_FPGAREG_OUT_BUFFER_LEN 1
498#define MC_CMD_GET_FPGAREG_OUT_BUFFER_MINNUM 1499#define MC_CMD_GET_FPGAREG_OUT_BUFFER_MINNUM 1
499#define MC_CMD_GET_FPGAREG_OUT_BUFFER_MAXNUM 255500#define MC_CMD_GET_FPGAREG_OUT_BUFFER_MAXNUM 252
500 501
501 502
502/***********************************/503/***********************************/
@@ -507,13 +508,13 @@ · 4 unmodified lines
507 508
508/* MC_CMD_PUT_FPGAREG_IN msgrequest */509/* MC_CMD_PUT_FPGAREG_IN msgrequest */
509#define MC_CMD_PUT_FPGAREG_IN_LENMIN 5510#define MC_CMD_PUT_FPGAREG_IN_LENMIN 5
510#define MC_CMD_PUT_FPGAREG_IN_LENMAX 255511#define MC_CMD_PUT_FPGAREG_IN_LENMAX 252
511#define MC_CMD_PUT_FPGAREG_IN_LEN(num) (4+1*(num))512#define MC_CMD_PUT_FPGAREG_IN_LEN(num) (4+1*(num))
512#define MC_CMD_PUT_FPGAREG_IN_ADDR_OFST 0513#define MC_CMD_PUT_FPGAREG_IN_ADDR_OFST 0
513#define MC_CMD_PUT_FPGAREG_IN_BUFFER_OFST 4514#define MC_CMD_PUT_FPGAREG_IN_BUFFER_OFST 4
514#define MC_CMD_PUT_FPGAREG_IN_BUFFER_LEN 1515#define MC_CMD_PUT_FPGAREG_IN_BUFFER_LEN 1
515#define MC_CMD_PUT_FPGAREG_IN_BUFFER_MINNUM 1516#define MC_CMD_PUT_FPGAREG_IN_BUFFER_MINNUM 1
516#define MC_CMD_PUT_FPGAREG_IN_BUFFER_MAXNUM 251517#define MC_CMD_PUT_FPGAREG_IN_BUFFER_MAXNUM 248
517 518
518/* MC_CMD_PUT_FPGAREG_OUT msgresponse */519/* MC_CMD_PUT_FPGAREG_OUT msgresponse */
519#define MC_CMD_PUT_FPGAREG_OUT_LEN 0520#define MC_CMD_PUT_FPGAREG_OUT_LEN 0
@@ -560,7 +561,7 @@ · 40 unmodified lines
560 561
561/* MC_CMD_PTP_IN_TRANSMIT msgrequest */562/* MC_CMD_PTP_IN_TRANSMIT msgrequest */
562#define MC_CMD_PTP_IN_TRANSMIT_LENMIN 13563#define MC_CMD_PTP_IN_TRANSMIT_LENMIN 13
563#define MC_CMD_PTP_IN_TRANSMIT_LENMAX 255564#define MC_CMD_PTP_IN_TRANSMIT_LENMAX 252
564#define MC_CMD_PTP_IN_TRANSMIT_LEN(num) (12+1*(num))565#define MC_CMD_PTP_IN_TRANSMIT_LEN(num) (12+1*(num))
565/* MC_CMD_PTP_IN_CMD_OFST 0 */566/* MC_CMD_PTP_IN_CMD_OFST 0 */
566/* MC_CMD_PTP_IN_PERIPH_ID_OFST 4 */567/* MC_CMD_PTP_IN_PERIPH_ID_OFST 4 */
@@ -568,7 +569,7 @@ · 1 unmodified line
568#define MC_CMD_PTP_IN_TRANSMIT_PACKET_OFST 12569#define MC_CMD_PTP_IN_TRANSMIT_PACKET_OFST 12
569#define MC_CMD_PTP_IN_TRANSMIT_PACKET_LEN 1570#define MC_CMD_PTP_IN_TRANSMIT_PACKET_LEN 1
570#define MC_CMD_PTP_IN_TRANSMIT_PACKET_MINNUM 1571#define MC_CMD_PTP_IN_TRANSMIT_PACKET_MINNUM 1
571#define MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM 243572#define MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM 240
572 573
573/* MC_CMD_PTP_IN_READ_NIC_TIME msgrequest */574/* MC_CMD_PTP_IN_READ_NIC_TIME msgrequest */
574#define MC_CMD_PTP_IN_READ_NIC_TIME_LEN 8575#define MC_CMD_PTP_IN_READ_NIC_TIME_LEN 8
@@ -1145,7 +1146,7 @@ · 570 unmodified lines
1145 1146
1146/* MC_CMD_PUTS_IN msgrequest */1147/* MC_CMD_PUTS_IN msgrequest */
1147#define MC_CMD_PUTS_IN_LENMIN 131148#define MC_CMD_PUTS_IN_LENMIN 13
1148#define MC_CMD_PUTS_IN_LENMAX 2551149#define MC_CMD_PUTS_IN_LENMAX 252
1149#define MC_CMD_PUTS_IN_LEN(num) (12+1*(num))1150#define MC_CMD_PUTS_IN_LEN(num) (12+1*(num))
1150#define MC_CMD_PUTS_IN_DEST_OFST 01151#define MC_CMD_PUTS_IN_DEST_OFST 0
1151#define MC_CMD_PUTS_IN_UART_LBN 01152#define MC_CMD_PUTS_IN_UART_LBN 0
@@ -1157,7 +1158,7 @@ · 5 unmodified lines
1157#define MC_CMD_PUTS_IN_STRING_OFST 121158#define MC_CMD_PUTS_IN_STRING_OFST 12
1158#define MC_CMD_PUTS_IN_STRING_LEN 11159#define MC_CMD_PUTS_IN_STRING_LEN 1
1159#define MC_CMD_PUTS_IN_STRING_MINNUM 11160#define MC_CMD_PUTS_IN_STRING_MINNUM 1
1160#define MC_CMD_PUTS_IN_STRING_MAXNUM 2431161#define MC_CMD_PUTS_IN_STRING_MAXNUM 240
1161 1162
1162/* MC_CMD_PUTS_OUT msgresponse */1163/* MC_CMD_PUTS_OUT msgresponse */
1163#define MC_CMD_PUTS_OUT_LEN 01164#define MC_CMD_PUTS_OUT_LEN 0
@@ -1947,12 +1948,12 @@ · 783 unmodified lines
1947 1948
1948/* MC_CMD_NVRAM_READ_OUT msgresponse */1949/* MC_CMD_NVRAM_READ_OUT msgresponse */
1949#define MC_CMD_NVRAM_READ_OUT_LENMIN 11950#define MC_CMD_NVRAM_READ_OUT_LENMIN 1
1950#define MC_CMD_NVRAM_READ_OUT_LENMAX 2551951#define MC_CMD_NVRAM_READ_OUT_LENMAX 252
1951#define MC_CMD_NVRAM_READ_OUT_LEN(num) (0+1*(num))1952#define MC_CMD_NVRAM_READ_OUT_LEN(num) (0+1*(num))
1952#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_OFST 01953#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_OFST 0
1953#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_LEN 11954#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_LEN 1
1954#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MINNUM 11955#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MINNUM 1
1955#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MAXNUM 2551956#define MC_CMD_NVRAM_READ_OUT_READ_BUFFER_MAXNUM 252
1956 1957
1957 1958
1958/***********************************/1959/***********************************/
@@ -1963,7 +1964,7 @@ · 4 unmodified lines
1963 1964
1964/* MC_CMD_NVRAM_WRITE_IN msgrequest */1965/* MC_CMD_NVRAM_WRITE_IN msgrequest */
1965#define MC_CMD_NVRAM_WRITE_IN_LENMIN 131966#define MC_CMD_NVRAM_WRITE_IN_LENMIN 13
1966#define MC_CMD_NVRAM_WRITE_IN_LENMAX 2551967#define MC_CMD_NVRAM_WRITE_IN_LENMAX 252
1967#define MC_CMD_NVRAM_WRITE_IN_LEN(num) (12+1*(num))1968#define MC_CMD_NVRAM_WRITE_IN_LEN(num) (12+1*(num))
1968#define MC_CMD_NVRAM_WRITE_IN_TYPE_OFST 01969#define MC_CMD_NVRAM_WRITE_IN_TYPE_OFST 0
1969/* Enum values, see field(s): */1970/* Enum values, see field(s): */
@@ -1973,7 +1974,7 @@ · 3 unmodified lines
1973#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_OFST 121974#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_OFST 12
1974#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_LEN 11975#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_LEN 1
1975#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MINNUM 11976#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MINNUM 1
1976#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MAXNUM 2431977#define MC_CMD_NVRAM_WRITE_IN_WRITE_BUFFER_MAXNUM 240
1977 1978
1978/* MC_CMD_NVRAM_WRITE_OUT msgresponse */1979/* MC_CMD_NVRAM_WRITE_OUT msgresponse */
1979#define MC_CMD_NVRAM_WRITE_OUT_LEN 01980#define MC_CMD_NVRAM_WRITE_OUT_LEN 0
@@ -2305,13 +2306,13 @@ · 325 unmodified lines
2305 2306
2306/* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */2307/* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */
2307#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 52308#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 5
2308#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 2552309#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 252
2309#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LEN(num) (4+1*(num))2310#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LEN(num) (4+1*(num))
2310#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATALEN_OFST 02311#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATALEN_OFST 0
2311#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_OFST 42312#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_OFST 4
2312#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_LEN 12313#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_LEN 1
2313#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MINNUM 12314#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MINNUM 1
2314#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MAXNUM 2512315#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_DATA_MAXNUM 248
2315 2316
2316 2317
2317/***********************************/2318/***********************************/
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
585 [MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT1] = { 1, "sfc_exp_rom_cfg" },585 [MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT1] = { 1, "sfc_exp_rom_cfg" },
586 [MC_CMD_NVRAM_TYPE_PHY_PORT0] = { 0, "sfc_phy_fw" },586 [MC_CMD_NVRAM_TYPE_PHY_PORT0] = { 0, "sfc_phy_fw" },
587 [MC_CMD_NVRAM_TYPE_PHY_PORT1] = { 1, "sfc_phy_fw" },587 [MC_CMD_NVRAM_TYPE_PHY_PORT1] = { 1, "sfc_phy_fw" },
588 [MC_CMD_NVRAM_TYPE_FPGA] = { 0, "sfc_fpga" },
588};589};
589 590
590static int siena_mtd_probe_partition(struct efx_nic *efx,591static 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
598 bool protected;599 bool protected;
599 int rc;600 int rc;
600 601
601 if (type >= ARRAY_SIZE(siena_nvram_types))602 if (type >= ARRAY_SIZE(siena_nvram_types) ||
603 siena_nvram_types[type].name == NULL)
602 return -ENODEV;604 return -ENODEV;
603 605
604 info = &siena_nvram_types[type];606 info = &siena_nvram_types[type];
@@ -627,7 +629,8 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, · 22 unmodified lines
627 struct efx_mtd *efx_mtd)629 struct efx_mtd *efx_mtd)
628{630{
629 struct efx_mtd_partition *part;631 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];
631 int rc;634 int rc;
632 635
633 rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL);636 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
37 *37 *
38 **************************************************************************/38 **************************************************************************/
39 39
40#define EFX_DRIVER_VERSION "3.1"40#define EFX_DRIVER_VERSION "3.2"
41 41
42#ifdef DEBUG42#ifdef DEBUG
43#define EFX_BUG_ON_PARANOID(x) BUG_ON(x)43#define EFX_BUG_ON_PARANOID(x) BUG_ON(x)
@@ -56,7 +56,8 @@ · 12 unmodified lines
56#define EFX_MAX_CHANNELS 32U56#define EFX_MAX_CHANNELS 32U
57#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS57#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS
58#define EFX_EXTRA_CHANNEL_IOV 058#define EFX_EXTRA_CHANNEL_IOV 0
59#define EFX_MAX_EXTRA_CHANNELS 1U59#define EFX_EXTRA_CHANNEL_PTP 1
60#define EFX_MAX_EXTRA_CHANNELS 2U
60 61
61/* Checksum generation is a per-queue option in hardware, so each62/* Checksum generation is a per-queue option in hardware, so each
62 * queue visible to the networking core is backed by two hardware TX63 * queue visible to the networking core is backed by two hardware TX
@@ -68,6 +69,9 @@ · 5 unmodified lines
68#define EFX_TXQ_TYPES 469#define EFX_TXQ_TYPES 4
69#define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)70#define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)
70 71
72/* Forward declare Precision Time Protocol (PTP) support structure. */
73struct efx_ptp_data;
74
71struct efx_self_tests;75struct efx_self_tests;
72 76
73/**77/**
@@ -91,29 +95,31 @@ struct efx_special_buffer { · 17 unmodified lines
91};95};
92 96
93/**97/**
94 * struct efx_tx_buffer - An Efx TX buffer98 * struct efx_tx_buffer - buffer state for a TX descriptor
95 * @skb: The associated socket buffer.99 * @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
96 * Set only on the final fragment of a packet; %NULL for all other100 * freed when descriptor completes
97 * fragments. When this fragment completes, then we can free this101 * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be
98 * skb.102 * freed when descriptor completes.
99 * @tsoh: The associated TSO header structure, or %NULL if this
100 * buffer is not a TSO header.
101 * @dma_addr: DMA address of the fragment.103 * @dma_addr: DMA address of the fragment.
104 * @flags: Flags for allocation and DMA mapping type
102 * @len: Length of this fragment.105 * @len: Length of this fragment.
103 * This field is zero when the queue slot is empty.106 * 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.
106 * @unmap_len: Length of this fragment to unmap107 * @unmap_len: Length of this fragment to unmap
107 */108 */
108struct efx_tx_buffer {109struct efx_tx_buffer {
109 const struct sk_buff *skb;110 union {
110 struct efx_tso_header *tsoh;111 const struct sk_buff *skb;
112 void *heap_buf;
113 };
111 dma_addr_t dma_addr;114 dma_addr_t dma_addr;
115 unsigned short flags;
112 unsigned short len;116 unsigned short len;
113 bool continuation;
114 bool unmap_single;
115 unsigned short unmap_len;117 unsigned short unmap_len;
116};118};
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() */
117 123
118/**124/**
119 * struct efx_tx_queue - An Efx TX queue125 * struct efx_tx_queue - An Efx TX queue
@@ -133,6 +139,7 @@ struct efx_tx_buffer { · 13 unmodified lines
133 * @channel: The associated channel139 * @channel: The associated channel
134 * @core_txq: The networking core TX queue structure140 * @core_txq: The networking core TX queue structure
135 * @buffer: The software buffer ring141 * @buffer: The software buffer ring
142 * @tsoh_page: Array of pages of TSO header buffers
136 * @txd: The hardware descriptor ring143 * @txd: The hardware descriptor ring
137 * @ptr_mask: The size of the ring minus 1.144 * @ptr_mask: The size of the ring minus 1.
138 * @initialised: Has hardware queue been initialised?145 * @initialised: Has hardware queue been initialised?
@@ -156,9 +163,6 @@ struct efx_tx_buffer { · 17 unmodified lines
156 * variable indicates that the queue is full. This is to163 * variable indicates that the queue is full. This is to
157 * avoid cache-line ping-pong between the xmit path and the164 * avoid cache-line ping-pong between the xmit path and the
158 * completion path.165 * 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.
162 * @tso_bursts: Number of times TSO xmit invoked by kernel166 * @tso_bursts: Number of times TSO xmit invoked by kernel
163 * @tso_long_headers: Number of packets with headers too long for standard167 * @tso_long_headers: Number of packets with headers too long for standard
164 * blocks168 * blocks
@@ -175,6 +179,7 @@ struct efx_tx_queue { · 10 unmodified lines
175 struct efx_channel *channel;179 struct efx_channel *channel;
176 struct netdev_queue *core_txq;180 struct netdev_queue *core_txq;
177 struct efx_tx_buffer *buffer;181 struct efx_tx_buffer *buffer;
182 struct efx_buffer *tsoh_page;
178 struct efx_special_buffer txd;183 struct efx_special_buffer txd;
179 unsigned int ptr_mask;184 unsigned int ptr_mask;
180 bool initialised;185 bool initialised;
@@ -187,7 +192,6 @@ struct efx_tx_queue { · 6 unmodified lines
187 unsigned int insert_count ____cacheline_aligned_in_smp;192 unsigned int insert_count ____cacheline_aligned_in_smp;
188 unsigned int write_count;193 unsigned int write_count;
189 unsigned int old_read_count;194 unsigned int old_read_count;
190 struct efx_tso_header *tso_headers_free;
191 unsigned int tso_bursts;195 unsigned int tso_bursts;
192 unsigned int tso_long_headers;196 unsigned int tso_long_headers;
193 unsigned int tso_packets;197 unsigned int tso_packets;
@@ -242,6 +246,8 @@ struct efx_rx_page_state { · 48 unmodified lines
242/**246/**
243 * struct efx_rx_queue - An Efx RX queue247 * struct efx_rx_queue - An Efx RX queue
244 * @efx: The associated Efx NIC248 * @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.
245 * @buffer: The software buffer ring251 * @buffer: The software buffer ring
246 * @rxd: The hardware descriptor ring252 * @rxd: The hardware descriptor ring
247 * @ptr_mask: The size of the ring minus 1.253 * @ptr_mask: The size of the ring minus 1.
@@ -263,6 +269,7 @@ struct efx_rx_page_state { · 15 unmodified lines
263 */269 */
264struct efx_rx_queue {270struct efx_rx_queue {
265 struct efx_nic *efx;271 struct efx_nic *efx;
272 int core_index;
266 struct efx_rx_buffer *buffer;273 struct efx_rx_buffer *buffer;
267 struct efx_special_buffer rxd;274 struct efx_special_buffer rxd;
268 unsigned int ptr_mask;275 unsigned int ptr_mask;
@@ -390,14 +397,17 @@ struct efx_channel { · 121 unmodified lines
390 * @get_name: Generate the channel's name (used for its IRQ handler)397 * @get_name: Generate the channel's name (used for its IRQ handler)
391 * @copy: Copy the channel state prior to reallocation. May be %NULL if398 * @copy: Copy the channel state prior to reallocation. May be %NULL if
392 * reallocation is not supported.399 * reallocation is not supported.
400 * @receive_skb: Handle an skb ready to be passed to netif_receive_skb()
393 * @keep_eventq: Flag for whether event queue should be kept initialised401 * @keep_eventq: Flag for whether event queue should be kept initialised
394 * while the device is stopped402 * while the device is stopped
395 */403 */
396struct efx_channel_type {404struct efx_channel_type {
397 void (*handle_no_channel)(struct efx_nic *);405 void (*handle_no_channel)(struct efx_nic *);
398 int (*pre_probe)(struct efx_channel *);406 int (*pre_probe)(struct efx_channel *);
407 void (*post_remove)(struct efx_channel *);
399 void (*get_name)(struct efx_channel *, char *buf, size_t len);408 void (*get_name)(struct efx_channel *, char *buf, size_t len);
400 struct efx_channel *(*copy)(const struct efx_channel *);409 struct efx_channel *(*copy)(const struct efx_channel *);
410 void (*receive_skb)(struct efx_channel *, struct sk_buff *);
401 bool keep_eventq;411 bool keep_eventq;
402};412};
403 413
@@ -430,11 +440,9 @@ enum efx_int_mode { · 26 unmodified lines
430#define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)440#define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
431 441
432enum nic_state {442enum nic_state {
433 STATE_INIT = 0,443 STATE_UNINIT = 0, /* device being probed/removed or is frozen */
434 STATE_RUNNING = 1,444 STATE_READY = 1, /* hardware ready and netdev registered */
435 STATE_FINI = 2,445 STATE_DISABLED = 2, /* device disabled due to hardware errors */
436 STATE_DISABLED = 3,
437 STATE_MAX,
438};446};
439 447
440/*448/*
@@ -654,7 +662,7 @@ struct vfdi_status; · 213 unmodified lines
654 * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues662 * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
655 * @irq_rx_moderation: IRQ moderation time for RX event queues663 * @irq_rx_moderation: IRQ moderation time for RX event queues
656 * @msg_enable: Log message enable flags664 * @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.
658 * @reset_pending: Bitmask for pending resets666 * @reset_pending: Bitmask for pending resets
659 * @tx_queue: TX DMA queues667 * @tx_queue: TX DMA queues
660 * @rx_queue: RX DMA queues668 * @rx_queue: RX DMA queues
@@ -664,6 +672,8 @@ struct vfdi_status; · 3 unmodified lines
664 * should be allocated for this NIC672 * should be allocated for this NIC
665 * @rxq_entries: Size of receive queues requested by user.673 * @rxq_entries: Size of receive queues requested by user.
666 * @txq_entries: Size of transmit queues requested by user.674 * @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.
667 * @tx_dc_base: Base qword address in SRAM of TX queue descriptor caches677 * @tx_dc_base: Base qword address in SRAM of TX queue descriptor caches
668 * @rx_dc_base: Base qword address in SRAM of RX queue descriptor caches678 * @rx_dc_base: Base qword address in SRAM of RX queue descriptor caches
669 * @sram_lim_qw: Qword address limit of SRAM679 * @sram_lim_qw: Qword address limit of SRAM
@@ -730,6 +740,7 @@ struct vfdi_status; · 60 unmodified lines
730 * %local_addr_list. Protected by %local_lock.740 * %local_addr_list. Protected by %local_lock.
731 * @local_lock: Mutex protecting %local_addr_list and %local_page_list.741 * @local_lock: Mutex protecting %local_addr_list and %local_page_list.
732 * @peer_work: Work item to broadcast peer addresses to VMs.742 * @peer_work: Work item to broadcast peer addresses to VMs.
743 * @ptp_data: PTP state data
733 * @monitor_work: Hardware monitor workitem744 * @monitor_work: Hardware monitor workitem
734 * @biu_lock: BIU (bus interface unit) lock745 * @biu_lock: BIU (bus interface unit) lock
735 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This746 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
@@ -774,6 +785,9 @@ struct efx_nic { · 38 unmodified lines
774 785
775 unsigned rxq_entries;786 unsigned rxq_entries;
776 unsigned txq_entries;787 unsigned txq_entries;
788 unsigned int txq_stop_thresh;
789 unsigned int txq_wake_thresh;
790
777 unsigned tx_dc_base;791 unsigned tx_dc_base;
778 unsigned rx_dc_base;792 unsigned rx_dc_base;
779 unsigned sram_lim_qw;793 unsigned sram_lim_qw;
@@ -854,6 +868,10 @@ struct efx_nic { · 74 unmodified lines
854 struct work_struct peer_work;868 struct work_struct peer_work;
855#endif869#endif
856 870
871#ifdef CONFIG_SFC_PTP
872 struct efx_ptp_data *ptp_data;
873#endif
874
857 /* The following fields may be written more often */875 /* The following fields may be written more often */
858 876
859 struct delayed_work monitor_work ____cacheline_aligned_in_smp;877 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
1044 1062
1045static inline bool efx_channel_has_rx_queue(struct efx_channel *channel)1063static inline bool efx_channel_has_rx_queue(struct efx_channel *channel)
1046{1064{
1047 return channel->channel < channel->efx->n_rx_channels;1065 return channel->rx_queue.core_index >= 0;
1048}1066}
1049 1067
1050static inline struct efx_rx_queue *1068static inline struct efx_rx_queue *
@@ -1116,5 +1134,13 @@ static inline void clear_bit_le(unsigned nr, unsigned char *addr) · 65 unmodified lines
1116#define EFX_MAX_FRAME_LEN(mtu) \1134#define EFX_MAX_FRAME_LEN(mtu) \
1117 ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */ + 7) & ~7) + 16)1135 ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */ + 7) & ~7) + 16)
1118 1136
1137static inline bool efx_xmit_with_hwtstamp(struct sk_buff *skb)
1138{
1139 return skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP;
1140}
1141static inline void efx_xmit_hwtstamp_pending(struct sk_buff *skb)
1142{
1143 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1144}
1119 1145
1120#endif /* EFX_NET_DRIVER_H */1146#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
298/**************************************************************************298/**************************************************************************
299 *299 *
300 * Generic buffer handling300 * Generic buffer handling
301 * These buffers are used for interrupt status and MAC stats301 * These buffers are used for interrupt status, MAC stats, etc.
302 *302 *
303 **************************************************************************/303 **************************************************************************/
304 304
@@ -401,8 +401,10 @@ void efx_nic_push_buffers(struct efx_tx_queue *tx_queue) · 96 unmodified lines
401 ++tx_queue->write_count;401 ++tx_queue->write_count;
402 402
403 /* Create TX descriptor ring entry */403 /* Create TX descriptor ring entry */
404 BUILD_BUG_ON(EFX_TX_BUF_CONT != 1);
404 EFX_POPULATE_QWORD_4(*txd,405 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,
406 FSF_AZ_TX_KER_BYTE_COUNT, buffer->len,408 FSF_AZ_TX_KER_BYTE_COUNT, buffer->len,
407 FSF_AZ_TX_KER_BUF_REGION, 0,409 FSF_AZ_TX_KER_BUF_REGION, 0,
408 FSF_AZ_TX_KER_BUF_ADDR, buffer->dma_addr);410 FSF_AZ_TX_KER_BUF_ADDR, buffer->dma_addr);
drivers/net/ethernet/sfc/nic.h+36−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
11#ifndef EFX_NIC_H11#ifndef EFX_NIC_H
12#define EFX_NIC_H12#define EFX_NIC_H
13 13
14#include <linux/net_tstamp.h>
14#include <linux/i2c-algo-bit.h>15#include <linux/i2c-algo-bit.h>
15#include "net_driver.h"16#include "net_driver.h"
16#include "efx.h"17#include "efx.h"
@@ -250,6 +251,41 @@ extern int efx_sriov_get_vf_config(struct net_device *dev, int vf, · 233 unmodified lines
250extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf,251extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf,
251 bool spoofchk);252 bool spoofchk);
252 253
254struct ethtool_ts_info;
255#ifdef CONFIG_SFC_PTP
256extern void efx_ptp_probe(struct efx_nic *efx);
257extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd);
258extern int efx_ptp_get_ts_info(struct net_device *net_dev,
259 struct ethtool_ts_info *ts_info);
260extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
261extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
262extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
263#else
264static inline void efx_ptp_probe(struct efx_nic *efx) {}
265static inline int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd)
266{
267 return -EOPNOTSUPP;
268}
269static 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}
278static inline bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb)
279{
280 return false;
281}
282static inline int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb)
283{
284 return NETDEV_TX_OK;
285}
286static inline void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) {}
287#endif
288
253extern const struct efx_nic_type falcon_a1_nic_type;289extern const struct efx_nic_type falcon_a1_nic_type;
254extern const struct efx_nic_type falcon_b0_nic_type;290extern const struct efx_nic_type falcon_b0_nic_type;
255extern const struct efx_nic_type siena_a0_nic_type;291extern 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
132enum 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 */
172struct 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 */
184struct 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 */
203struct 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 */
263struct 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
300static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta);
301static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta);
302static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts);
303static int efx_phc_settime(struct ptp_clock_info *ptp,
304 const struct timespec *e_ts);
305static int efx_phc_enable(struct ptp_clock_info *ptp,
306 struct ptp_clock_request *request, int on);
307
308/* Enable MCDI PTP support. */
309static 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 */
327static 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
336static 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
347static 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 */
357static 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. */
396static 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 */
425static 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