History

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

Pull networking updates from David Miller: "This is a re-do of the net-next pull request for the current merge window. The only difference from the one I made the other day is that this has Eliezer's interface renames and the timeout handling changes made based upon your feedback, as well as a few bug fixes that have trickeled in. Highlights: 1) Low latency device polling, eliminating the cost of interrupt handling and context switches. Allows direct polling of a network device from socket operations, such as recvmsg() and poll(). Currently ixgbe, mlx4, and bnx2x support this feature. Full high level description, performance numbers, and design in commit 0a4db187a999 ("Merge branch 'll_poll'") From Eliezer Tamir. 2) With the routing cache removed, ip_check_mc_rcu() gets exercised more than ever before in the case where we have lots of multicast addresses. Use a hash table instead of a simple linked list, from Eric Dumazet. 3) Add driver for Atheros CQA98xx 802.11ac wireless devices, from Bartosz Markowski, Janusz Dziedzic, Kalle Valo, Marek Kwaczynski, Marek Puzyniak, Michal Kazior, and Sujith Manoharan. 4) Support reporting the TUN device persist flag to userspace, from Pavel Emelyanov. 5) Allow controlling network device VF link state using netlink, from Rony Efraim. 6) Support GRE tunneling in openvswitch, from Pravin B Shelar. 7) Adjust SOCK_MIN_RCVBUF and SOCK_MIN_SNDBUF for modern times, from Daniel Borkmann and Eric Dumazet. 8) Allow controlling of TCP quickack behavior on a per-route basis, from Cong Wang. 9) Several bug fixes and improvements to vxlan from Stephen Hemminger, Pravin B Shelar, and Mike Rapoport. In particular, support receiving on multiple UDP ports. 10) Major cleanups, particular in the area of debugging and cookie lifetime handline, to the SCTP protocol code. From Daniel Borkmann. 11) Allow packets to cross network namespaces when traversing tunnel devices. From Nicolas Dichtel. 12) Allow monitoring netlink traffic via AF_PACKET sockets, in a manner akin to how we monitor real network traffic via ptype_all. From Daniel Borkmann. 13) Several bug fixes and improvements for the new alx device driver, from Johannes Berg. 14) Fix scalability issues in the netem packet scheduler's time queue, by using an rbtree. From Eric Dumazet. 15) Several bug fixes in TCP loss recovery handling, from Yuchung Cheng. 16) Add support for GSO segmentation of MPLS packets, from Simon Horman. 17) Make network notifiers have a real data type for the opaque pointer that's passed into them. Use this to properly handle network device flag changes in arp_netdev_event(). From Jiri Pirko and Timo Teräs. 18) Convert several drivers over to module_pci_driver(), from Peter Huewe. 19) tcp_fixup_rcvbuf() can loop 500 times over loopback, just use a O(1) calculation instead. From Eric Dumazet. 20) Support setting of explicit tunnel peer addresses in ipv6, just like ipv4. From Nicolas Dichtel. 21) Protect x86 BPF JIT against spraying attacks, from Eric Dumazet. 22) Prevent a single high rate flow from overruning an individual cpu during RX packet processing via selective flow shedding. From Willem de Bruijn. 23) Don't use spinlocks in TCP md5 signing fast paths, from Eric Dumazet. 24) Don't just drop GSO packets which are above the TBF scheduler's burst limit, chop them up so they are in-bounds instead. Also from Eric Dumazet. 25) VLAN offloads are missed when configured on top of a bridge, fix from Vlad Yasevich. 26) Support IPV6 in ping sockets. From Lorenzo Colitti. 27) Receive flow steering targets should be updated at poll() time too, from David Majnemer. 28) Fix several corner case regressions in PMTU/redirect handling due to the routing cache removal, from Timo Teräs. 29) We have to be mindful of ipv4 mapped ipv6 sockets in upd_v6_push_pending_frames(). From Hannes Frederic Sowa. 30) Fix L2TP sequence number handling bugs, from James Chapman." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1214 commits) drivers/net: caif: fix wrong rtnl_is_locked() usage drivers/net: enic: release rtnl_lock on error-path vhost-net: fix use-after-free in vhost_net_flush net: mv643xx_eth: do not use port number as platform device id net: sctp: confirm route during forward progress virtio_net: fix race in RX VQ processing virtio: support unlocked queue poll net/cadence/macb: fix bug/typo in extracting gem_irq_read_clear bit Documentation: Fix references to defunct linux-net@vger.kernel.org net/fs: change busy poll time accounting net: rename low latency sockets functions to busy poll bridge: fix some kernel warning in multicast timer sfc: Fix memory leak when discarding scattered packets sit: fix tunnel update via netlink dt:net:stmmac: Add dt specific phy reset callback support. dt:net:stmmac: Add support to dwmac version 3.610 and 3.710 dt:net:stmmac: Allocate platform data only if its NULL. net:stmmac: fix memleak in the open method ipv6: rt6_check_neigh should successfully verify neigh if no NUD information are available net: ipv6: fix wrong ping_v6_sendmsg return value ...

Linus Torvalds committed 13 years ago

Commit 496322b2 parents 2e17c5a 56e0ef51181 files · +74016 −21793Browse files

Unified · Split

1181 files
  1. Documentation/DocBook/80211.tmpl +5 −8
  2. Documentation/devicetree/bindings/net/allwinner,sun4i-emac.txt +22 −0
  3. Documentation/devicetree/bindings/net/allwinner,sun4i-mdio.txt +26 −0
  4. Documentation/devicetree/bindings/net/arc_emac.txt +38 −0
  5. Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +2 −0
  6. Documentation/devicetree/bindings/net/cpsw.txt +6 −0
  7. Documentation/devicetree/bindings/net/davicom-dm9000.txt +26 −0
  8. Documentation/devicetree/bindings/net/marvell-orion-net.txt +85 −0
  9. Documentation/devicetree/bindings/net/micrel-ks8851.txt +9 −0
  10. Documentation/devicetree/bindings/net/stmmac.txt +10 −0
  11. Documentation/devicetree/bindings/net/via-velocity.txt +20 −0
  12. Documentation/devicetree/bindings/vendor-prefixes.txt +1 −0
  13. Documentation/networking/.gitignore +0 −1
  14. Documentation/networking/00-INDEX +0 −2
  15. Documentation/networking/Makefile +0 −5
  16. Documentation/networking/arcnet.txt +4 −3
  17. Documentation/networking/bonding.txt +35 −44
  18. Documentation/networking/ifenslave.c +0 −1105
  19. Documentation/networking/ip-sysctl.txt +10 −1
  20. Documentation/networking/ipvs-sysctl.txt +13 −0
  21. Documentation/networking/netlink_mmap.txt +3 −3
  22. Documentation/networking/packet_mmap.txt +28 −105
  23. Documentation/networking/scaling.txt +58 −0
  24. Documentation/networking/vortex.txt +1 −1
  25. Documentation/printk-formats.txt +32 −0
  26. Documentation/sysctl/net.txt +40 −3
  27. MAINTAINERS +5 −0
  28. arch/alpha/include/uapi/asm/socket.h +2 −0
  29. arch/arm/boot/dts/am335x-bone.dts +2 −0
  30. arch/arm/boot/dts/am335x-evm.dts +2 −0
  31. arch/arm/boot/dts/am335x-evmsk.dts +10 −0
  32. arch/arm/boot/dts/imx28-evk.dts +12 −0
  33. arch/arm/boot/dts/sun4i-a10-cubieboard.dts +15 −0
  34. arch/arm/boot/dts/sun4i-a10-hackberry.dts +41 −0
  35. arch/arm/boot/dts/sun4i-a10.dtsi +27 −0
  36. arch/arm/configs/omap2plus_defconfig +1 −0
  37. arch/arm/mach-imx/Kconfig +0 −4
  38. arch/arm/mach-imx/devices-imx25.h +4 −4
  39. arch/arm/mach-imx/devices-imx35.h +4 −4
  40. arch/arm/mach-imx/devices/Kconfig +0 −1
  41. arch/arm/mach-imx/devices/devices-common.h +1 −3
  42. arch/arm/mach-imx/devices/platform-flexcan.c +2 −3
  43. arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c +1 −1
  44. arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c +1 −1
  45. arch/arm/mach-imx/mach-mx25_3ds.c +1 −1
  46. arch/arm/mach-imx/mach-pcm043.c +1 −1
  47. arch/arm/mach-mxs/Kconfig +0 −1
  48. arch/arm/mach-mxs/mach-mxs.c +1 −49
  49. arch/arm/mach-shmobile/board-armadillo800eva.c +1 −1
  50. arch/arm/mach-shmobile/clock-r8a7740.c +1 −1
  51. arch/arm/mach-shmobile/clock-r8a7778.c +1 −1
  52. arch/arm/mach-shmobile/clock-r8a7779.c +1 −1
  53. arch/arm/net/bpf_jit_32.c +3 −15
  54. arch/avr32/include/uapi/asm/socket.h +2 −0
  55. arch/cris/arch-v10/drivers/Kconfig +1 −3
  56. arch/cris/arch-v32/drivers/Kconfig +1 −3
  57. arch/cris/include/uapi/asm/socket.h +2 −0
  58. arch/frv/include/uapi/asm/socket.h +2 −0
  59. arch/h8300/include/uapi/asm/socket.h +2 −0
  60. arch/ia64/hp/sim/simeth.c +1 −1
  61. arch/ia64/include/uapi/asm/socket.h +2 −0
  62. arch/m32r/include/uapi/asm/socket.h +2 −0
  63. arch/mips/bcm63xx/boards/board_bcm963xx.c +4 −0
  64. arch/mips/bcm63xx/dev-enet.c +167 −14
  65. arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +5 −2
  66. arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h +122 −0
  67. arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +85 −8
  68. arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +2 −0
  69. arch/mips/include/uapi/asm/socket.h +2 −0
  70. arch/mips/txx9/generic/setup_tx4939.c +2 −1
  71. arch/mn10300/include/uapi/asm/socket.h +2 −0
  72. arch/parisc/include/uapi/asm/socket.h +2 −0
  73. arch/powerpc/Kconfig +0 −1
  74. arch/powerpc/include/uapi/asm/socket.h +2 −0
  75. arch/powerpc/net/bpf_jit_comp.c +3 −16
  76. arch/s390/include/uapi/asm/socket.h +2 −0
  77. arch/sh/boards/board-espt.c +1 −1
  78. arch/sh/boards/board-sh7757lcr.c +4 −4
  79. arch/sh/boards/mach-ecovec24/setup.c +2 −2
  80. arch/sh/boards/mach-se/770x/setup.c +4 −4
  81. arch/sh/boards/mach-se/7724/setup.c +2 −2
  82. arch/sh/boards/mach-sh7763rdp/setup.c +1 −1
  83. arch/sh/kernel/cpu/sh2/setup-sh7619.c +2 −2
  84. arch/sh/kernel/cpu/sh4a/clock-sh7724.c +1 −1
  85. arch/sh/kernel/cpu/sh4a/clock-sh7734.c +1 −1
  86. arch/sparc/include/uapi/asm/socket.h +2 −0
  87. arch/sparc/net/bpf_jit_comp.c +3 −17
  88. arch/x86/net/bpf_jit_comp.c +44 −17
  89. arch/xtensa/include/uapi/asm/socket.h +2 −0
  90. drivers/atm/ambassador.c +1 −1
  91. drivers/bcma/Kconfig +1 −0
  92. drivers/bcma/bcma_private.h +2 −0
  93. drivers/bcma/core.c +25 −3
  94. drivers/bcma/driver_chipcommon.c +9 −2
  95. drivers/bcma/driver_chipcommon_pmu.c +123 −0
  96. drivers/bcma/driver_chipcommon_sflash.c +4 −4
  97. drivers/bcma/host_pci.c +1 −0
  98. drivers/bcma/main.c +19 −0
  99. drivers/bcma/sprom.c +40 −32
  100. drivers/bluetooth/btmrvl_sdio.c +1 −0
  101. drivers/bluetooth/btusb.c +4 −0
  102. drivers/infiniband/core/cma.c +2 −2
  103. drivers/infiniband/hw/mlx4/main.c +1 −1
  104. drivers/isdn/i4l/isdn_net.c +1 −1
  105. drivers/net/Kconfig +13 −7
  106. drivers/net/Makefile +1 −0
  107. drivers/net/bonding/bond_alb.c +19 −80
  108. drivers/net/bonding/bond_main.c +123 −167
  109. drivers/net/bonding/bond_sysfs.c +85 −48
  110. drivers/net/bonding/bonding.h +44 −5
  111. drivers/net/caif/caif_serial.c +39 −22
  112. drivers/net/can/Kconfig +1 −4
  113. drivers/net/can/at91_can.c +2 −6
  114. drivers/net/can/bfin_can.c +4 −6
  115. drivers/net/can/c_can/c_can_platform.c +2 −4
  116. drivers/net/can/cc770/cc770_isa.c +2 −3
  117. drivers/net/can/cc770/cc770_platform.c +2 −2
  118. drivers/net/can/flexcan.c +22 −30
  119. drivers/net/can/grcan.c +5 −7
  120. drivers/net/can/janz-ican3.c +1 −1
  121. drivers/net/can/led.c +2 −2
  122. drivers/net/can/mscan/mpc5xxx_can.c +4 −6
  123. drivers/net/can/sja1000/sja1000_isa.c +2 −3
  124. drivers/net/can/sja1000/sja1000_of_platform.c +2 −4
  125. drivers/net/can/sja1000/sja1000_platform.c +2 −3
  126. drivers/net/can/slcan.c +1 −1
  127. drivers/net/can/softing/softing_main.c +1 −1
  128. drivers/net/can/ti_hecc.c +0 −1
  129. drivers/net/ethernet/3com/3c509.c +0 −19
  130. drivers/net/ethernet/3com/3c59x.c +20 −22
  131. drivers/net/ethernet/3com/Kconfig +0 −1
  132. drivers/net/ethernet/8390/ne.c +0 −1
  133. drivers/net/ethernet/8390/ne2k-pci.c +1 −1
  134. drivers/net/ethernet/Kconfig +2 −4
  135. drivers/net/ethernet/Makefile +2 −0
  136. drivers/net/ethernet/adaptec/Kconfig +0 −1
  137. drivers/net/ethernet/adi/Kconfig +0 −1
  138. drivers/net/ethernet/adi/bfin_mac.c +0 −4
  139. drivers/net/ethernet/aeroflex/greth.c +1 −3
  140. drivers/net/ethernet/allwinner/Kconfig +35 −0
  141. drivers/net/ethernet/allwinner/Makefile +5 −0
  142. drivers/net/ethernet/allwinner/sun4i-emac.c +954 −0
  143. drivers/net/ethernet/allwinner/sun4i-emac.h +108 −0
  144. drivers/net/ethernet/alteon/acenic.c +2 −13
  145. drivers/net/ethernet/amd/Kconfig +0 −2
  146. drivers/net/ethernet/amd/amd8111e.c +4 −15
  147. drivers/net/ethernet/amd/au1000_eth.c +0 −2
  148. drivers/net/ethernet/amd/sunlance.c +2 −4
  149. drivers/net/ethernet/apple/bmac.c +1 −4
  150. drivers/net/ethernet/arc/Kconfig +31 −0
  151. drivers/net/ethernet/arc/Makefile +6 −0
  152. drivers/net/ethernet/arc/emac.h +214 −0
  153. drivers/net/ethernet/arc/emac_main.c +819 −0
  154. drivers/net/ethernet/arc/emac_mdio.c +152 −0
  155. drivers/net/ethernet/atheros/Kconfig +0 −5
  156. drivers/net/ethernet/atheros/alx/alx.h +4 −4
  157. drivers/net/ethernet/atheros/alx/ethtool.c +36 −96
  158. drivers/net/ethernet/atheros/alx/hw.c +19 −193
  159. drivers/net/ethernet/atheros/alx/hw.h +18 −7
  160. drivers/net/ethernet/atheros/alx/main.c +32 −141
  161. drivers/net/ethernet/atheros/atl1c/atl1c_main.c +1 −24
  162. drivers/net/ethernet/atheros/atl1e/atl1e_main.c +1 −24
  163. drivers/net/ethernet/atheros/atlx/atl1.c +2 −25
  164. drivers/net/ethernet/broadcom/Kconfig +0 −2
  165. drivers/net/ethernet/broadcom/bcm63xx_enet.c +1092 −96
  166. drivers/net/ethernet/broadcom/bcm63xx_enet.h +86 −0
  167. drivers/net/ethernet/broadcom/bnx2.c +2 −16
  168. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +149 −36
  169. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +132 −79
  170. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +49 −26
  171. drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +22 −30
  172. drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h +0 −3
  173. drivers/net/ethernet/broadcom/bnx2x/bnx2x_dump.h +0 −7
  174. drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +81 −34
  175. drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +4 −1
  176. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +436 −251
  177. drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +6 −0
  178. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +105 −179
  179. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +22 −33
  180. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +66 −23
  181. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +6 −3
  182. drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +0 −1
  183. drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +0 −4
  184. drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +23 −10
  185. drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h +4 −1
  186. drivers/net/ethernet/broadcom/cnic.c +1 −1
  187. drivers/net/ethernet/broadcom/sb1250-mac.c +4 −5
  188. drivers/net/ethernet/broadcom/tg3.c +272 −153
  189. drivers/net/ethernet/broadcom/tg3.h +2 −0
  190. drivers/net/ethernet/brocade/bna/bfa_defs.h +2 −1
  191. drivers/net/ethernet/brocade/bna/bfa_ioc.c +4 −3
  192. drivers/net/ethernet/brocade/bna/bfa_ioc.h +2 −0
  193. drivers/net/ethernet/brocade/bna/bna.h +2 −0
  194. drivers/net/ethernet/brocade/bna/bna_enet.c +6 −1
  195. drivers/net/ethernet/brocade/bna/bna_tx_rx.c +15 −0
  196. drivers/net/ethernet/brocade/bna/bnad.c +3 −0
  197. drivers/net/ethernet/brocade/bna/bnad.h +1 −1
  198. drivers/net/ethernet/brocade/bna/cna.h +2 −2
  199. drivers/net/ethernet/cadence/Kconfig +0 −1
  200. drivers/net/ethernet/cadence/at91_ether.c +0 −1
  201. drivers/net/ethernet/cadence/macb.c +282 −45
  202. drivers/net/ethernet/cadence/macb.h +14 −0
  203. drivers/net/ethernet/calxeda/xgmac.c +0 −2
  204. drivers/net/ethernet/chelsio/cxgb/cxgb2.c +2 −13
  205. drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +2 −0
  206. drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +5 −4
  207. drivers/net/ethernet/chelsio/cxgb3/sge.c +87 −29
  208. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +1 −1
  209. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +25 −2
  210. drivers/net/ethernet/chelsio/cxgb4/sge.c +1 −1
  211. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +9 −1
  212. drivers/net/ethernet/cirrus/Kconfig +0 −1
  213. drivers/net/ethernet/cirrus/ep93xx_eth.c +0 −1
  214. drivers/net/ethernet/cisco/enic/enic_main.c +2 −0
  215. drivers/net/ethernet/davicom/Kconfig +0 −1
  216. drivers/net/ethernet/davicom/dm9000.c +43 −10
  217. drivers/net/ethernet/dec/tulip/Kconfig +0 −1
  218. drivers/net/ethernet/dec/tulip/tulip_core.c +0 −6
  219. drivers/net/ethernet/dec/tulip/xircom_cb.c +1 −13
  220. drivers/net/ethernet/dlink/Kconfig +0 −1
  221. drivers/net/ethernet/emulex/benet/be.h +4 −0
  222. drivers/net/ethernet/emulex/benet/be_cmds.c +66 −0
  223. drivers/net/ethernet/emulex/benet/be_cmds.h +3 −0
  224. drivers/net/ethernet/emulex/benet/be_ethtool.c +31 −6
  225. drivers/net/ethernet/emulex/benet/be_hw.h +2 −0
  226. drivers/net/ethernet/emulex/benet/be_main.c +62 −88
  227. drivers/net/ethernet/ethoc.c +0 −2
  228. drivers/net/ethernet/faraday/Kconfig +0 −1
  229. drivers/net/ethernet/faraday/ftgmac100.c +0 −2
  230. drivers/net/ethernet/faraday/ftmac100.c +0 −2
  231. drivers/net/ethernet/freescale/fec.h +60 −1
  232. drivers/net/ethernet/freescale/fec_main.c +211 −43
  233. drivers/net/ethernet/freescale/fec_mpc52xx.c +4 −5
  234. drivers/net/ethernet/freescale/fec_ptp.c +2 −1
  235. drivers/net/ethernet/freescale/fs_enet/Kconfig +0 −1
  236. drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +2 −3
  237. drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +2 −4
  238. drivers/net/ethernet/freescale/fs_enet/mii-fec.c +2 −4
  239. drivers/net/ethernet/freescale/gianfar.c +51 −6
  240. drivers/net/ethernet/freescale/gianfar_ptp.c +2 −2
  241. drivers/net/ethernet/freescale/ucc_geth.c +2 −2
  242. drivers/net/ethernet/freescale/xgmac_mdio.c +2 −2
  243. drivers/net/ethernet/ibm/Kconfig +1 −2
  244. drivers/net/ethernet/ibm/ehea/ehea_main.c +2 −2
  245. drivers/net/ethernet/ibm/emac/mal.c +2 −4
  246. drivers/net/ethernet/ibm/emac/rgmii.c +8 −10
  247. drivers/net/ethernet/ibm/emac/tah.c +6 −8
  248. drivers/net/ethernet/ibm/emac/zmii.c +8 −10
  249. drivers/net/ethernet/icplus/Kconfig +0 −1
  250. drivers/net/ethernet/icplus/ipg.c +1 −12
  251. drivers/net/ethernet/intel/Kconfig +0 −1
  252. drivers/net/ethernet/intel/e100.c +2 −2
  253. drivers/net/ethernet/intel/e1000e/80003es2lan.c +12 −12
  254. drivers/net/ethernet/intel/e1000e/82571.c +15 −15
  255. drivers/net/ethernet/intel/e1000e/ethtool.c +17 −17
  256. drivers/net/ethernet/intel/e1000e/hw.h +17 −17
  257. drivers/net/ethernet/intel/e1000e/ich8lan.c +31 −31
  258. drivers/net/ethernet/intel/e1000e/netdev.c +27 −28
  259. drivers/net/ethernet/intel/e1000e/nvm.c +0 −1
  260. drivers/net/ethernet/intel/e1000e/phy.c +11 −11
  261. drivers/net/ethernet/intel/igb/e1000_82575.c +115 −5
  262. drivers/net/ethernet/intel/igb/e1000_defines.h +20 −16
  263. drivers/net/ethernet/intel/igb/e1000_hw.h +2 −0
  264. drivers/net/ethernet/intel/igb/e1000_i210.h +3 −3
  265. drivers/net/ethernet/intel/igb/e1000_mac.c +35 −10
  266. drivers/net/ethernet/intel/igb/e1000_phy.c +124 −0
  267. drivers/net/ethernet/intel/igb/e1000_phy.h +20 −0
  268. drivers/net/ethernet/intel/igb/igb.h +7 −7
  269. drivers/net/ethernet/intel/igb/igb_ethtool.c +35 −39
  270. drivers/net/ethernet/intel/igb/igb_main.c +6 −3
  271. drivers/net/ethernet/intel/ixgbe/ixgbe.h +134 −0
  272. drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c +23 −0
  273. drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h +2 −0
  274. drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h +1 −0
  275. drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +3 −0
  276. drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +40 −0
  277. drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +2 −0
  278. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +61 −8
  279. drivers/net/ethernet/jme.c +0 −1
  280. drivers/net/ethernet/korina.c +1 −6
  281. drivers/net/ethernet/marvell/mv643xx_eth.c +192 −17
  282. drivers/net/ethernet/marvell/mvneta.c +35 −11
  283. drivers/net/ethernet/marvell/pxa168_eth.c +1 −2
  284. drivers/net/ethernet/marvell/skge.c +1 −1
  285. drivers/net/ethernet/marvell/sky2.c +1 −1
  286. drivers/net/ethernet/mellanox/mlx4/cmd.c +191 −5
  287. drivers/net/ethernet/mellanox/mlx4/en_cq.c +3 −0
  288. drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c +0 −3
  289. drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +19 −1
  290. drivers/net/ethernet/mellanox/mlx4/en_main.c +1 −1
  291. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +75 −13
  292. drivers/net/ethernet/mellanox/mlx4/en_rx.c +102 −82
  293. drivers/net/ethernet/mellanox/mlx4/en_tx.c +1 −1
  294. drivers/net/ethernet/mellanox/mlx4/eq.c +7 −2
  295. drivers/net/ethernet/mellanox/mlx4/fw.c +12 −1
  296. drivers/net/ethernet/mellanox/mlx4/main.c +8 −3
  297. drivers/net/ethernet/mellanox/mlx4/mlx4.h +22 −0
  298. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +136 −9
  299. drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +158 −5
  300. drivers/net/ethernet/micrel/Kconfig +0 −4
  301. drivers/net/ethernet/micrel/ks8695net.c +0 −1
  302. drivers/net/ethernet/micrel/ks8842.c +0 −1
  303. drivers/net/ethernet/micrel/ks8851_mll.c +26 −8
  304. drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 −1
  305. drivers/net/ethernet/netx-eth.c +1 −4
  306. drivers/net/ethernet/nuvoton/Kconfig +0 −1
  307. drivers/net/ethernet/nuvoton/w90p910_ether.c +0 −2
  308. drivers/net/ethernet/nvidia/forcedeth.c +2 −15
  309. drivers/net/ethernet/nxp/lpc_eth.c +0 −2
  310. drivers/net/ethernet/octeon/octeon_mgmt.c +2 −2
  311. drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +0 −1
  312. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h +2 −0
  313. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_api.c +44 −26
  314. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c +1 −1
  315. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +175 −152
  316. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +40 −23
  317. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.c +16 −10
  318. drivers/net/ethernet/packetengines/Kconfig +0 −1
  319. drivers/net/ethernet/qlogic/netxen/netxen_nic.h +9 −5
  320. drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h +3 −0
  321. drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +93 −40
  322. drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +53 −6
  323. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +266 −80
  324. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +12 −1
  325. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +47 −12
  326. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c +39 −23
  327. drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +116 −56
  328. drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +5 −1
  329. drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h +1 −0
  330. drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +88 −15
  331. drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +7 −1
  332. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +110 −116
  333. drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +218 −7
  334. drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h +4 −0
  335. drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +59 −1
  336. drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +36 −0
  337. drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +78 −48
  338. drivers/net/ethernet/qlogic/qlge/qlge_main.c +1 −12
  339. drivers/net/ethernet/rdc/Kconfig +0 −1
  340. drivers/net/ethernet/realtek/8139cp.c +1 −1
  341. drivers/net/ethernet/realtek/Kconfig +0 −3
  342. drivers/net/ethernet/renesas/Kconfig +0 −7
  343. drivers/net/ethernet/renesas/sh_eth.c +219 −302
  344. drivers/net/ethernet/renesas/sh_eth.h +17 −12
  345. drivers/net/ethernet/s6gmac.c +0 −1
  346. drivers/net/ethernet/seeq/sgiseeq.c +0 −1
  347. drivers/net/ethernet/sfc/efx.c +7 −35
  348. drivers/net/ethernet/sfc/efx.h +1 −0
  349. drivers/net/ethernet/sfc/ethtool.c +15 −1
  350. drivers/net/ethernet/sfc/filter.c +14 −1
  351. drivers/net/ethernet/sfc/net_driver.h +4 −1
  352. drivers/net/ethernet/sfc/nic.c +64 −10
  353. drivers/net/ethernet/sfc/nic.h +2 −2
  354. drivers/net/ethernet/sfc/ptp.c +5 −8
  355. drivers/net/ethernet/sfc/rx.c +25 −10
  356. drivers/net/ethernet/sfc/siena.c +1 −1
  357. drivers/net/ethernet/sgi/Kconfig +0 −1
  358. drivers/net/ethernet/sgi/ioc3-eth.c +1 −13
  359. drivers/net/ethernet/sgi/meth.c +0 −1
  360. drivers/net/ethernet/silan/sc92031.c +1 −13
  361. drivers/net/ethernet/sis/Kconfig +0 −2
  362. drivers/net/ethernet/sis/sis190.c +1 −12
  363. drivers/net/ethernet/smsc/Kconfig +1 −6
  364. drivers/net/ethernet/smsc/smc911x.c +0 −2
  365. drivers/net/ethernet/smsc/smc91x.c +0 −3
  366. drivers/net/ethernet/smsc/smsc911x.c +0 −2
  367. drivers/net/ethernet/stmicro/stmmac/Kconfig +0 −1
  368. drivers/net/ethernet/stmicro/stmmac/common.h +0 −10
  369. drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +19 −38
  370. drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +4 −6
  371. drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c +0 −4
  372. drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c +4 −4
  373. drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +25 −47
  374. drivers/net/ethernet/stmicro/stmmac/enh_desc.c +26 −69
  375. drivers/net/ethernet/stmicro/stmmac/norm_desc.c +1 −3
  376. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +56 −104
  377. drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +46 −2
  378. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +29 −5
  379. drivers/net/ethernet/sun/cassini.c +8 −10
  380. drivers/net/ethernet/sun/niu.c +2 −3
  381. drivers/net/ethernet/sun/sunbmac.c +1 −5
  382. drivers/net/ethernet/sun/sungem.c +1 −12
  383. drivers/net/ethernet/sun/sunhme.c +2 −2
  384. drivers/net/ethernet/sun/sunqe.c +4 −6
  385. drivers/net/ethernet/ti/cpsw.c +4 −3
  386. drivers/net/ethernet/ti/davinci_cpdma.c +5 −0
  387. drivers/net/ethernet/ti/davinci_emac.c +32 −87
  388. drivers/net/ethernet/ti/davinci_mdio.c +4 −1
  389. drivers/net/ethernet/ti/tlan.c +1 −2
  390. drivers/net/ethernet/ti/tlan.h +0 −1
  391. drivers/net/ethernet/toshiba/tc35815.c +1 −13
  392. drivers/net/ethernet/tundra/tsi108_eth.c +0 −1
  393. drivers/net/ethernet/via/Kconfig +1 −4
  394. drivers/net/ethernet/via/via-velocity.c +331 −176
  395. drivers/net/ethernet/via/via-velocity.h +5 −3
  396. drivers/net/ethernet/wiznet/w5100.c +0 −2
  397. drivers/net/ethernet/wiznet/w5300.c +0 −2
  398. drivers/net/ethernet/xilinx/Kconfig +2 −2
  399. drivers/net/ethernet/xilinx/ll_temac_main.c +2 −3
  400. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 −4
  401. drivers/net/ethernet/xilinx/xilinx_emaclite.c +116 −120
  402. drivers/net/ethernet/xscale/ixp4xx_eth.c +0 −2
  403. drivers/net/fddi/skfp/skfddi.c +1 −12
  404. drivers/net/hamradio/bpqether.c +4 −3
  405. drivers/net/hippi/rrunner.c +1 −12
  406. drivers/net/irda/bfin_sir.c +0 −1
  407. drivers/net/irda/sh_irda.c +0 −1
  408. drivers/net/irda/sh_sir.c +0 −1
  409. drivers/net/macvlan.c +11 −1
  410. drivers/net/macvtap.c +255 −86
  411. drivers/net/netconsole.c +2 −3
  412. drivers/net/nlmon.c +181 −0
  413. drivers/net/phy/Kconfig +10 −0
  414. drivers/net/phy/Makefile +1 −0
  415. drivers/net/phy/at803x.c +88 −40
  416. drivers/net/phy/bcm63xx.c +2 −2
  417. drivers/net/phy/marvell.c +99 −9
  418. drivers/net/phy/mdio-sun4i.c +194 −0
  419. drivers/net/phy/phy.c +16 −10
  420. drivers/net/phy/phy_device.c +9 −2
  421. drivers/net/phy/spi_ks8995.c +1 −13
  422. drivers/net/phy/vitesse.c +26 −12
  423. drivers/net/ppp/pppoe.c +1 −1
  424. drivers/net/team/team.c +53 −33
  425. drivers/net/team/team_mode_loadbalance.c +1 −2
  426. drivers/net/team/team_mode_roundrobin.c +2 −1
  427. drivers/net/tun.c +5 −7
  428. drivers/net/usb/Kconfig +0 −4
  429. drivers/net/usb/ax88179_178a.c +3 −2
  430. drivers/net/usb/cdc_ether.c +17 −5
  431. drivers/net/usb/ipheth.c +5 −0
  432. drivers/net/usb/kalmia.c +15 −30
  433. drivers/net/usb/qmi_wwan.c +3 −1
  434. drivers/net/usb/r8152.c +1 −13
  435. drivers/net/veth.c +0 −7
  436. drivers/net/virtio_net.c +3 −2
  437. drivers/net/vxlan.c +508 −280
  438. drivers/net/wan/dlci.c +1 −1
  439. drivers/net/wan/hdlc.c +1 −1
  440. drivers/net/wan/ixp4xx_hss.c +0 −1
  441. drivers/net/wan/lapbether.c +1 −1
  442. drivers/net/wireless/Kconfig +1 −0
  443. drivers/net/wireless/Makefile +2 −0
  444. drivers/net/wireless/ath/Kconfig +1 −0
  445. drivers/net/wireless/ath/Makefile +1 −0
  446. drivers/net/wireless/ath/ath.h +6 −7
  447. drivers/net/wireless/ath/ath10k/Kconfig +39 −0
  448. drivers/net/wireless/ath/ath10k/Makefile +20 −0
  449. drivers/net/wireless/ath/ath10k/bmi.c +295 −0
  450. drivers/net/wireless/ath/ath10k/bmi.h +224 −0
  451. drivers/net/wireless/ath/ath10k/ce.c +1189 −0
  452. drivers/net/wireless/ath/ath10k/ce.h +516 −0
  453. drivers/net/wireless/ath/ath10k/core.c +665 −0
  454. drivers/net/wireless/ath/ath10k/core.h +369 −0
  455. drivers/net/wireless/ath/ath10k/debug.c +503 −0
  456. drivers/net/wireless/ath/ath10k/debug.h +90 −0
  457. drivers/net/wireless/ath/ath10k/hif.h +137 −0
  458. drivers/net/wireless/ath/ath10k/htc.c +1000 −0
  459. drivers/net/wireless/ath/ath10k/htc.h +368 −0
  460. drivers/net/wireless/ath/ath10k/htt.c +152 −0
  461. drivers/net/wireless/ath/ath10k/htt.h +1338 −0
  462. drivers/net/wireless/ath/ath10k/htt_rx.c +1167 −0
  463. drivers/net/wireless/ath/ath10k/htt_tx.c +510 −0
  464. drivers/net/wireless/ath/ath10k/hw.h +304 −0
  465. drivers/net/wireless/ath/ath10k/mac.c +3069 −0
  466. drivers/net/wireless/ath/ath10k/mac.h +61 −0
  467. drivers/net/wireless/ath/ath10k/pci.c +2507 −0
  468. drivers/net/wireless/ath/ath10k/pci.h +355 −0
  469. drivers/net/wireless/ath/ath10k/rx_desc.h +990 −0
  470. drivers/net/wireless/ath/ath10k/targaddrs.h +449 −0
  471. drivers/net/wireless/ath/ath10k/trace.c +20 −0
  472. drivers/net/wireless/ath/ath10k/trace.h +170 −0
  473. drivers/net/wireless/ath/ath10k/txrx.c +417 −0
  474. drivers/net/wireless/ath/ath10k/txrx.h +39 −0
  475. drivers/net/wireless/ath/ath10k/wmi.c +2081 −0
  476. drivers/net/wireless/ath/ath10k/wmi.h +3052 −0
  477. drivers/net/wireless/ath/ath5k/ahb.c +0 −2
  478. drivers/net/wireless/ath/ath5k/base.c +65 −14
  479. drivers/net/wireless/ath/ath5k/base.h +8 −6
  480. drivers/net/wireless/ath/ath5k/mac80211-ops.c +1 −1
  481. drivers/net/wireless/ath/ath6kl/cfg80211.c +32 −19
  482. drivers/net/wireless/ath/ath6kl/debug.c +1 −7
  483. drivers/net/wireless/ath/ath6kl/init.c +7 −7
  484. drivers/net/wireless/ath/ath6kl/sdio.c +6 −6
  485. drivers/net/wireless/ath/ath6kl/usb.c +27 −9
  486. drivers/net/wireless/ath/ath9k/Kconfig +0 −8
  487. drivers/net/wireless/ath/ath9k/ahb.c +0 −2
  488. drivers/net/wireless/ath/ath9k/ani.c +35 −54
  489. drivers/net/wireless/ath/ath9k/ani.h +2 −21
  490. drivers/net/wireless/ath/ath9k/ar5008_phy.c +3 −3
  491. drivers/net/wireless/ath/ath9k/ar9002_hw.c +0 −4
  492. drivers/net/wireless/ath/ath9k/ar9002_initvals.h +0 −14
  493. drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +25 −8
  494. drivers/net/wireless/ath/ath9k/ar9003_hw.c +79 −1
  495. drivers/net/wireless/ath/ath9k/ar9003_mac.c +3 −2
  496. drivers/net/wireless/ath/ath9k/ar9003_paprd.c +11 −8
  497. drivers/net/wireless/ath/ath9k/ar9003_phy.c +102 −5
  498. drivers/net/wireless/ath/ath9k/ar9003_phy.h +4 −2
  499. drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h +344 −1
  500. drivers/net/wireless/ath/ath9k/ar9462_2p1_initvals.h +1774 −0
  501. drivers/net/wireless/ath/ath9k/ath9k.h +15 −1
  502. drivers/net/wireless/ath/ath9k/beacon.c +7 −24
  503. drivers/net/wireless/ath/ath9k/calib.c +0 −1
  504. drivers/net/wireless/ath/ath9k/debug.c +70 −360
  505. drivers/net/wireless/ath/ath9k/debug.h +0 −59
  506. drivers/net/wireless/ath/ath9k/dfs_debug.c +1 −1
  507. drivers/net/wireless/ath/ath9k/hif_usb.c +7 −1
  508. drivers/net/wireless/ath/ath9k/htc.h +24 −0
  509. drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +4 −1
  510. drivers/net/wireless/ath/ath9k/htc_drv_debug.c +83 −16
  511. drivers/net/wireless/ath/ath9k/htc_drv_init.c +16 −1
  512. drivers/net/wireless/ath/ath9k/htc_drv_main.c +69 −12
  513. drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +1 −1
  514. drivers/net/wireless/ath/ath9k/hw.c +11 −17
  515. drivers/net/wireless/ath/ath9k/hw.h +9 −11
  516. drivers/net/wireless/ath/ath9k/init.c +50 −16
  517. drivers/net/wireless/ath/ath9k/link.c +2 −7
  518. drivers/net/wireless/ath/ath9k/mac.c +12 −4
  519. drivers/net/wireless/ath/ath9k/mac.h +3 −1
  520. drivers/net/wireless/ath/ath9k/main.c +9 −46
  521. drivers/net/wireless/ath/ath9k/pci.c +101 −0
  522. drivers/net/wireless/ath/ath9k/recv.c +3 −6
  523. drivers/net/wireless/ath/ath9k/reg.h +11 −2
  524. drivers/net/wireless/ath/ath9k/wow.c +29 −139
  525. drivers/net/wireless/ath/ath9k/xmit.c +273 −70
  526. drivers/net/wireless/ath/carl9170/carl9170.h +3 −0
  527. drivers/net/wireless/ath/carl9170/main.c +3 −0
  528. drivers/net/wireless/ath/carl9170/tx.c +104 −78
  529. drivers/net/wireless/ath/regd.c +3 −3
  530. drivers/net/wireless/ath/wil6210/Kconfig +12 −0
  531. drivers/net/wireless/ath/wil6210/Makefile +13 −8
  532. drivers/net/wireless/ath/wil6210/cfg80211.c +36 −2
  533. drivers/net/wireless/ath/wil6210/debug.c +69 −0
  534. drivers/net/wireless/ath/wil6210/debugfs.c +7 −1
  535. drivers/net/wireless/ath/wil6210/interrupt.c +15 −14
  536. drivers/net/wireless/ath/wil6210/main.c +16 −48
  537. drivers/net/wireless/ath/wil6210/netdev.c +54 −0
  538. drivers/net/wireless/ath/wil6210/trace.c +20 −0
  539. drivers/net/wireless/ath/wil6210/trace.h +235 −0
  540. drivers/net/wireless/ath/wil6210/txrx.c +121 −84
  541. drivers/net/wireless/ath/wil6210/txrx.h +30 −6
  542. drivers/net/wireless/ath/wil6210/wil6210.h +19 −9
  543. drivers/net/wireless/ath/wil6210/wmi.c +18 −42
  544. drivers/net/wireless/b43/Kconfig +4 −8
  545. drivers/net/wireless/b43/main.c +10 −2
  546. drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +239 −63
  547. drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +4 −113
  548. drivers/net/wireless/brcm80211/brcmfmac/dhd.h +2 −0
  549. drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c +3 −0
  550. drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c +12 −6
  551. drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h +4 −2
  552. drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +19 −33
  553. drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +17 −159
  554. drivers/net/wireless/brcm80211/brcmfmac/fweh.h +2 −1
  555. drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +444 −499
  556. drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h +1 −0
  557. drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h +4 −16
  558. drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h +21 −0
  559. drivers/net/wireless/brcm80211/brcmfmac/usb.c +8 −0
  560. drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +13 −5
  561. drivers/net/wireless/brcm80211/brcmsmac/ampdu.c +1 −1
  562. drivers/net/wireless/cw1200/Kconfig +30 −0
  563. drivers/net/wireless/cw1200/Makefile +21 −0
  564. drivers/net/wireless/cw1200/bh.c +619 −0
  565. drivers/net/wireless/cw1200/bh.h +28 −0
  566. drivers/net/wireless/cw1200/cw1200.h +323 −0
  567. drivers/net/wireless/cw1200/cw1200_sdio.c +425 −0
  568. drivers/net/wireless/cw1200/cw1200_spi.c +471 −0
  569. drivers/net/wireless/cw1200/debug.c +428 −0
  570. drivers/net/wireless/cw1200/debug.h +93 −0
  571. drivers/net/wireless/cw1200/fwio.c +520 −0
  572. drivers/net/wireless/cw1200/fwio.h +39 −0
  573. drivers/net/wireless/cw1200/hwbus.h +33 −0
  574. drivers/net/wireless/cw1200/hwio.c +312 −0
  575. drivers/net/wireless/cw1200/hwio.h +247 −0
  576. drivers/net/wireless/cw1200/main.c +605 −0
  577. drivers/net/wireless/cw1200/pm.c +367 −0
  578. drivers/net/wireless/cw1200/pm.h +43 −0
  579. drivers/net/wireless/cw1200/queue.c +583 −0
  580. drivers/net/wireless/cw1200/queue.h +116 −0
  581. drivers/net/wireless/cw1200/scan.c +461 −0
  582. drivers/net/wireless/cw1200/scan.h +56 −0
  583. drivers/net/wireless/cw1200/sta.c +2403 −0
  584. drivers/net/wireless/cw1200/sta.h +123 −0
  585. drivers/net/wireless/cw1200/txrx.c +1473 −0
  586. drivers/net/wireless/cw1200/txrx.h +106 −0
  587. drivers/net/wireless/cw1200/wsm.c +1822 −0
  588. drivers/net/wireless/cw1200/wsm.h +1870 −0
  589. drivers/net/wireless/ipw2x00/ipw2100.c +0 −2
  590. drivers/net/wireless/ipw2x00/ipw2200.c +1 −0
  591. drivers/net/wireless/ipw2x00/libipw_rx.c +1 −1
  592. drivers/net/wireless/iwlegacy/3945-mac.c +3 −2
  593. drivers/net/wireless/iwlegacy/3945.c +18 −0
  594. drivers/net/wireless/iwlegacy/4965-mac.c +22 −3
  595. drivers/net/wireless/iwlegacy/commands.h +0 −8
  596. drivers/net/wireless/iwlegacy/common.c +11 −0
  597. drivers/net/wireless/iwlegacy/common.h +37 −4
  598. drivers/net/wireless/iwlwifi/Kconfig +0 −10
  599. drivers/net/wireless/iwlwifi/Makefile +4 −3
  600. drivers/net/wireless/iwlwifi/dvm/Makefile +0 −1
  601. drivers/net/wireless/iwlwifi/dvm/agn.h +12 −46
  602. drivers/net/wireless/iwlwifi/dvm/calib.c +4 −4
  603. drivers/net/wireless/iwlwifi/dvm/commands.h +0 −12
  604. drivers/net/wireless/iwlwifi/dvm/dev.h +55 −18
  605. drivers/net/wireless/iwlwifi/dvm/devices.c +100 −7
  606. drivers/net/wireless/iwlwifi/dvm/lib.c +10 −16
  607. drivers/net/wireless/iwlwifi/dvm/mac80211.c +22 −15
  608. drivers/net/wireless/iwlwifi/dvm/main.c +27 −40
  609. drivers/net/wireless/iwlwifi/dvm/power.c +3 −3
  610. drivers/net/wireless/iwlwifi/dvm/rs.c +16 −35
  611. drivers/net/wireless/iwlwifi/dvm/rx.c +13 −29
  612. drivers/net/wireless/iwlwifi/dvm/scan.c +6 −6
  613. drivers/net/wireless/iwlwifi/dvm/testmode.c +0 −471
  614. drivers/net/wireless/iwlwifi/dvm/tt.c +1 −1
  615. drivers/net/wireless/iwlwifi/dvm/tx.c +6 −18
  616. drivers/net/wireless/iwlwifi/dvm/ucode.c +5 −5
  617. drivers/net/wireless/iwlwifi/iwl-1000.c +0 −3
  618. drivers/net/wireless/iwlwifi/iwl-2000.c +3 −36
  619. drivers/net/wireless/iwlwifi/iwl-5000.c +0 −4
  620. drivers/net/wireless/iwlwifi/iwl-6000.c +2 −30
  621. drivers/net/wireless/iwlwifi/iwl-7000.c +47 −18
  622. drivers/net/wireless/iwlwifi/iwl-config.h +11 −43
  623. drivers/net/wireless/iwlwifi/iwl-csr.h +19 −0
  624. drivers/net/wireless/iwlwifi/iwl-debug.h +4 −0
  625. drivers/net/wireless/iwlwifi/iwl-drv.c +3 −16
  626. drivers/net/wireless/iwlwifi/iwl-drv.h +1 −2
  627. drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c +8 −7
  628. drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h +2 −1
  629. drivers/net/wireless/iwlwifi/iwl-fw.h +5 −2
  630. drivers/net/wireless/iwlwifi/iwl-modparams.h +3 −6
  631. drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +12 −8
  632. drivers/net/wireless/iwlwifi/iwl-nvm-parse.h +1 −1
  633. drivers/net/wireless/iwlwifi/iwl-phy-db.c +6 −33
  634. drivers/net/wireless/iwlwifi/iwl-prph.h +12 −0
  635. drivers/net/wireless/iwlwifi/iwl-test.c +0 −852
  636. drivers/net/wireless/iwlwifi/iwl-test.h +0 −161
  637. drivers/net/wireless/iwlwifi/iwl-testmode.h +0 −309
  638. drivers/net/wireless/iwlwifi/iwl-trans.h +11 −10
  639. drivers/net/wireless/iwlwifi/mvm/Makefile +1 −1
  640. drivers/net/wireless/iwlwifi/mvm/bt-coex.c +25 −4
  641. drivers/net/wireless/iwlwifi/mvm/d3.c +179 −18
  642. drivers/net/wireless/iwlwifi/mvm/debugfs.c +443 −10
  643. drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h +3 −1
  644. drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h +7 −1
  645. drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +95 −3
  646. drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h +6 −4
  647. drivers/net/wireless/iwlwifi/mvm/fw-api.h +233 −0
  648. drivers/net/wireless/iwlwifi/mvm/fw.c +36 −1
  649. drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +86 −11
  650. drivers/net/wireless/iwlwifi/mvm/mac80211.c +213 −86
  651. drivers/net/wireless/iwlwifi/mvm/mvm.h +194 −10
  652. drivers/net/wireless/iwlwifi/mvm/nvm.c +199 −13
  653. drivers/net/wireless/iwlwifi/mvm/ops.c +32 −5
  654. drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +22 −54
  655. drivers/net/wireless/iwlwifi/mvm/power.c +211 −7
  656. drivers/net/wireless/iwlwifi/mvm/quota.c +16 −9
  657. drivers/net/wireless/iwlwifi/mvm/rs.c +152 −19
  658. drivers/net/wireless/iwlwifi/mvm/rs.h +17 −0
  659. drivers/net/wireless/iwlwifi/mvm/rx.c +22 −0
  660. drivers/net/wireless/iwlwifi/mvm/scan.c +0 −6
  661. drivers/net/wireless/iwlwifi/mvm/sta.c +10 −14
  662. drivers/net/wireless/iwlwifi/mvm/sta.h +6 −2
  663. drivers/net/wireless/iwlwifi/mvm/tt.c +530 −0
  664. drivers/net/wireless/iwlwifi/mvm/tx.c +3 −4
  665. drivers/net/wireless/iwlwifi/mvm/utils.c +41 −0
  666. drivers/net/wireless/iwlwifi/pcie/drv.c +51 −3
  667. drivers/net/wireless/iwlwifi/pcie/internal.h +2 −0
  668. drivers/net/wireless/iwlwifi/pcie/rx.c +57 −58
  669. drivers/net/wireless/iwlwifi/pcie/trans.c +42 −26
  670. drivers/net/wireless/iwlwifi/pcie/tx.c +30 −10
  671. drivers/net/wireless/libertas/mesh.c +1 −1
  672. drivers/net/wireless/mwifiex/11h.c +101 −0
  673. drivers/net/wireless/mwifiex/Kconfig +2 −2
  674. drivers/net/wireless/mwifiex/Makefile +1 −0
  675. drivers/net/wireless/mwifiex/cfg80211.c +99 −23
  676. drivers/net/wireless/mwifiex/cmdevt.c +1 −0
  677. drivers/net/wireless/mwifiex/fw.h +33 −0
  678. drivers/net/wireless/mwifiex/init.c +19 −96
  679. drivers/net/wireless/mwifiex/join.c +4 −3
  680. drivers/net/wireless/mwifiex/main.c +98 −3
  681. drivers/net/wireless/mwifiex/main.h +31 −1
  682. drivers/net/wireless/mwifiex/scan.c +46 −14
  683. drivers/net/wireless/mwifiex/sdio.c +326 −137
  684. drivers/net/wireless/mwifiex/sdio.h +226 −114
  685. drivers/net/wireless/mwifiex/sta_cmd.c +62 −0
  686. drivers/net/wireless/mwifiex/sta_cmdresp.c +17 −0
  687. drivers/net/wireless/mwifiex/sta_event.c +11 −0
  688. drivers/net/wireless/mwifiex/sta_ioctl.c +30 −22
  689. drivers/net/wireless/mwifiex/uap_cmd.c +21 −0
  690. drivers/net/wireless/mwifiex/uap_event.c +19 −6
  691. drivers/net/wireless/mwifiex/wmm.c +4 −1
  692. drivers/net/wireless/mwl8k.c +9 −2
  693. drivers/net/wireless/orinoco/orinoco_pci.h +1 −1
  694. drivers/net/wireless/orinoco/orinoco_usb.c +2 −1
  695. drivers/net/wireless/p54/p54spi.c +8 −29
  696. drivers/net/wireless/rt2x00/rt2400pci.c +37 −29
  697. drivers/net/wireless/rt2x00/rt2500pci.c +37 −29
  698. drivers/net/wireless/rt2x00/rt2500usb.c +37 −29
  699. drivers/net/wireless/rt2x00/rt2800.h +7 −5
  700. drivers/net/wireless/rt2x00/rt2800lib.c +528 −307
  701. drivers/net/wireless/rt2x00/rt2800pci.c +40 −28
  702. drivers/net/wireless/rt2x00/rt2800usb.c +51 −76
  703. drivers/net/wireless/rt2x00/rt2x00.h +4 −5
  704. drivers/net/wireless/rt2x00/rt2x00dev.c +34 −20
  705. drivers/net/wireless/rt2x00/rt2x00pci.c +8 −1
  706. drivers/net/wireless/rt2x00/rt2x00queue.c +14 −18
  707. drivers/net/wireless/rt2x00/rt2x00queue.h +2 −19
  708. drivers/net/wireless/rt2x00/rt61pci.c +36 −24
  709. drivers/net/wireless/rt2x00/rt73usb.c +35 −23
  710. drivers/net/wireless/rtlwifi/base.c +1 −1
  711. drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +1 −1
  712. drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +1 −0
  713. drivers/net/wireless/rtlwifi/rtl8192de/dm.c +1 −1
  714. drivers/net/wireless/rtlwifi/rtl8723ae/sw.c +3 −3
  715. drivers/net/wireless/ti/wl1251/spi.c +4 −26
  716. drivers/net/wireless/ti/wl18xx/main.c +45 −2
  717. drivers/net/wireless/ti/wl18xx/reg.h +15 −0
  718. drivers/net/wireless/ti/wlcore/Makefile +1 −1
  719. drivers/net/wireless/ti/wlcore/main.c +66 −218
  720. drivers/net/wireless/ti/wlcore/ps.c +1 −1
  721. drivers/net/wireless/ti/wlcore/spi.c +1 −13
  722. drivers/net/wireless/ti/wlcore/sysfs.c +216 −0
  723. drivers/net/wireless/ti/wlcore/sysfs.h +28 −0
  724. drivers/net/wireless/ti/wlcore/tx.c +1 −1
  725. drivers/net/xen-netback/common.h +11 −3
  726. drivers/net/xen-netback/interface.c +87 −15
  727. drivers/net/xen-netback/netback.c +32 −10
  728. drivers/net/xen-netback/xenbus.c +42 −11
  729. drivers/net/xen-netfront.c +188 −65
  730. drivers/nfc/Kconfig +10 −0
  731. drivers/nfc/Makefile +1 −0
  732. drivers/nfc/mei_phy.c +3 −3
  733. drivers/nfc/microread/microread.c +2 −4
  734. drivers/nfc/nfcsim.c +541 −0
  735. drivers/nfc/nfcwilink.c +5 −13
  736. drivers/nfc/pn533.c +22 −9
  737. drivers/nfc/pn544/pn544.c +20 −20
  738. drivers/of/of_net.c +1 −0
  739. drivers/s390/net/netiucv.c +0 −20
  740. drivers/s390/net/qeth_core.h +1 −1
  741. drivers/s390/net/qeth_core_main.c +13 −10
  742. drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 −1
  743. drivers/scsi/fcoe/fcoe.c +1 −1
  744. drivers/scsi/fcoe/fcoe_transport.c +1 −1
  745. drivers/scsi/libiscsi_tcp.c +0 −1
  746. drivers/ssb/driver_chipcommon_sflash.c +30 −4
  747. drivers/ssb/main.c +8 −0
  748. drivers/ssb/pcihost_wrapper.c +1 −1
  749. drivers/ssb/sprom.c +1 −1
  750. drivers/ssb/ssb_private.h +4 −0
  751. drivers/staging/csr/netdev.c +1 −1
  752. drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +1 −1
  753. drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +1 −1
  754. drivers/staging/rtl8192u/r8192U_core.c +2 −2
  755. drivers/staging/silicom/Kconfig +3 −4
  756. drivers/staging/silicom/bpctl_mod.c +1 −1
  757. drivers/vhost/net.c +7 −2
  758. drivers/virtio/virtio_ring.c +44 −12
  759. fs/select.c +57 −5
  760. include/linux/bcma/bcma.h +1 −0
  761. include/linux/bcma/bcma_driver_chipcommon.h +55 −0
  762. include/linux/can/platform/flexcan.h +0 −20
  763. include/linux/filter.h +2 −2
  764. include/linux/ieee80211.h +10 −0
  765. include/linux/if_link.h +1 −0
  766. include/linux/if_macvlan.h +9 −3
  767. include/linux/if_team.h +11 −0
  768. include/linux/if_vlan.h +0 −2
  769. include/linux/igmp.h +1 −0
  770. include/linux/inetdevice.h +5 −0
  771. include/linux/jiffies.h +4 −0
  772. include/linux/ktime.h +13 −0
  773. include/linux/marvell_phy.h +2 −0
  774. include/linux/mlx4/cmd.h +2 −1
  775. include/linux/mlx4/device.h +2 −1
  776. include/linux/mlx4/qp.h +36 −0
  777. include/linux/mv643xx_eth.h +2 −0
  778. include/linux/net.h +3 −3
  779. include/linux/netdev_features.h +3 −1
  780. include/linux/netdevice.h +83 −2
  781. include/linux/netfilter.h +1 −1
  782. include/linux/netlink.h +27 −0
  783. include/linux/netpoll.h +2 −2
  784. include/linux/phy.h +27 −0
  785. include/linux/platform_data/brcmfmac-sdio.h +5 −0
  786. include/linux/platform_data/net-cw1200.h +81 −0
  787. include/linux/sched.h +9 −0
  788. include/linux/skbuff.h +20 −117
  789. include/linux/ssb/ssb_driver_mips.h +15 −0
  790. include/linux/ssb/ssb_regs.h +1 −0
  791. include/linux/stmmac.h +4 −0
  792. include/linux/tcp.h +0 −1
  793. include/linux/virtio.h +4 −0
  794. include/net/act_api.h +1 −1
  795. include/net/addrconf.h +4 −0
  796. include/net/bluetooth/hci.h +0 −1
  797. include/net/bluetooth/hci_core.h +11 −18
  798. include/net/bluetooth/l2cap.h +1 −1
  799. include/net/cfg80211.h +141 −95
  800. include/net/gen_stats.h +5 −5
  801. include/net/gre.h +31 −0
  802. include/net/ieee80211_radiotap.h +7 −0
  803. include/net/if_inet6.h +10 −3
  804. include/net/inet_ecn.h +4 −2
  805. include/net/inet_sock.h +0 −1
  806. include/net/ip_fib.h +3 −2
  807. include/net/ip_tunnels.h +24 −12
  808. include/net/ip_vs.h +52 −40
  809. include/net/ipv6.h +8 −2
  810. include/net/ll_poll.h +183 −0
  811. include/net/mac80211.h +21 −6
  812. include/net/ndisc.h +1 −1
  813. include/net/net_namespace.h +13 −0
  814. include/net/netfilter/xt_rateest.h +1 −1
  815. include/net/netns/x_tables.h +6 −0
  816. include/net/nfc/hci.h +4 −3
  817. include/net/nfc/nci_core.h +55 −3
  818. include/net/nfc/nfc.h +30 −5
  819. include/net/ping.h +62 −3
  820. include/net/sch_generic.h +9 −8
  821. include/net/sctp/checksum.h +5 −0
  822. include/net/sctp/sctp.h +0 −111
  823. include/net/sctp/structs.h +3 −3
  824. include/net/sock.h +15 −6
  825. include/net/tcp.h +15 −14
  826. include/net/transp_v6.h +40 −39
  827. include/net/udp.h +5 −3
  828. include/uapi/asm-generic/poll.h +2 −0
  829. include/uapi/asm-generic/socket.h +2 −0
  830. include/uapi/linux/ethtool.h +2 −2
  831. include/uapi/linux/gen_stats.h +11 −0
  832. include/uapi/linux/if_arp.h +1 −0
  833. include/uapi/linux/if_link.h +15 −0
  834. include/uapi/linux/if_pppox.h +2 −2
  835. include/uapi/linux/if_tun.h +2 −0
  836. include/uapi/linux/ip_vs.h +6 −0
  837. include/uapi/linux/netfilter/nfnetlink_queue.h +2 −0
  838. include/uapi/linux/netfilter/xt_socket.h +7 −0
  839. include/uapi/linux/nfc.h +17 −1
  840. include/uapi/linux/nl80211.h +37 −0
  841. include/uapi/linux/openvswitch.h +19 −1
  842. include/uapi/linux/rtnetlink.h +2 −0
  843. include/uapi/linux/snmp.h +2 −0
  844. include/uapi/linux/tipc.h +1 −1
  845. include/uapi/linux/tipc_config.h +1 −1
  846. include/xen/interface/io/netif.h +12 −0
  847. kernel/sysctl_binary.c +0 −1
  848. lib/vsprintf.c +122 −2
  849. net/8021q/vlan.c +1 −1
  850. net/Kconfig +17 −0
  851. net/Makefile +1 −0
  852. net/appletalk/aarp.c +1 −1
  853. net/appletalk/ddp.c +1 −1
  854. net/atm/clip.c +5 −3
  855. net/atm/mpc.c +2 −4
  856. net/ax25/af_ax25.c +3 −3
  857. net/ax25/sysctl_net_ax25.c +1 −1
  858. net/batman-adv/Makefile +0 −1
  859. net/batman-adv/bat_iv_ogm.c +89 −34
  860. net/batman-adv/bridge_loop_avoidance.c +51 −43
  861. net/batman-adv/bridge_loop_avoidance.h +7 −5
  862. net/batman-adv/distributed-arp-table.c +39 −43
  863. net/batman-adv/hard-interface.c +58 −40
  864. net/batman-adv/icmp_socket.c +2 −2
  865. net/batman-adv/main.c +0 −1
  866. net/batman-adv/main.h +17 −1
  867. net/batman-adv/network-coding.c +14 −8
  868. net/batman-adv/network-coding.h +2 −4
  869. net/batman-adv/originator.c +3 −3
  870. net/batman-adv/originator.h +1 −1
  871. net/batman-adv/ring_buffer.c +0 −51
  872. net/batman-adv/ring_buffer.h +0 −27
  873. net/batman-adv/routing.c +19 −45
  874. net/batman-adv/routing.h +0 −1
  875. net/batman-adv/send.c +24 −12
  876. net/batman-adv/send.h +3 −3
  877. net/batman-adv/soft-interface.c +3 −3
  878. net/batman-adv/translation-table.c +49 −25
  879. net/batman-adv/translation-table.h +1 −1
  880. net/batman-adv/types.h +4 −2
  881. net/batman-adv/unicast.c +1 −1
  882. net/batman-adv/vis.c +10 −9
  883. net/bluetooth/hci_core.c +60 −132
  884. net/bluetooth/hci_event.c +6 −65
  885. net/bluetooth/hidp/core.c +4 −10
  886. net/bluetooth/l2cap_core.c +81 −40
  887. net/bluetooth/l2cap_sock.c +2 −2
  888. net/bluetooth/mgmt.c +155 −74
  889. net/bridge/br_device.c +11 −10
  890. net/bridge/br_fdb.c +5 −0
  891. net/bridge/br_forward.c +9 −5
  892. net/bridge/br_if.c +1 −1
  893. net/bridge/br_input.c +10 −5
  894. net/bridge/br_mdb.c +1 −1
  895. net/bridge/br_multicast.c +44 −30
  896. net/bridge/br_netfilter.c +2 −2
  897. net/bridge/br_netlink.c +9 −1
  898. net/bridge/br_notify.c +1 −1
  899. net/bridge/br_private.h +7 −2
  900. net/bridge/br_sysfs_br.c +26 −0
  901. net/bridge/br_sysfs_if.c +4 −0
  902. net/bridge/netfilter/ebt_ulog.c +6 −0
  903. net/bridge/netfilter/ebtables.c +3 −3
  904. net/caif/caif_dev.c +2 −2
  905. net/caif/caif_usb.c +2 −2
  906. net/can/af_can.c +2 −2
  907. net/can/bcm.c +2 −2
  908. net/can/gw.c +2 −2
  909. net/can/raw.c +2 −2
  910. net/core/datagram.c +5 −0
  911. net/core/dev.c +192 −46
  912. net/core/drop_monitor.c +2 −2
  913. net/core/dst.c +1 −1
  914. net/core/ethtool.c +22 −2
  915. net/core/fib_rules.c +2 −2
  916. net/core/gen_estimator.c +6 −6
  917. net/core/gen_stats.c +17 −5
  918. net/core/link_watch.c +3 −0
  919. net/core/neighbour.c +19 −15
  920. net/core/net-procfs.c +14 −2
  921. net/core/netpoll.c +5 −11
  922. net/core/netprio_cgroup.c +1 −1
  923. net/core/pktgen.c +40 −41
  924. net/core/rtnetlink.c +21 −11
  925. net/core/skbuff.c +43 −26
  926. net/core/sock.c +26 −0
  927. net/core/sysctl_net_core.c +137 −2
  928. net/decnet/af_decnet.c +2 −2
  929. net/decnet/dn_dev.c +3 −3
  930. net/decnet/sysctl_net_decnet.c +3 −3
  931. net/ieee802154/6lowpan.c +2 −3
  932. net/ipv4/Kconfig +3 −8
  933. net/ipv4/Makefile +4 −3
  934. net/ipv4/af_inet.c +6 −20
  935. net/ipv4/ah4.c +2 −5
  936. net/ipv4/arp.c +7 −1
  937. net/ipv4/devinet.c +5 −4
  938. net/ipv4/esp4.c +2 −5
  939. net/ipv4/fib_frontend.c +2 −2
  940. net/ipv4/fib_semantics.c +2 −1
  941. net/ipv4/gre.c +0 −253
  942. net/ipv4/gre_demux.c +414 −0
  943. net/ipv4/gre_offload.c +127 −0
  944. net/ipv4/icmp.c +30 −21
  945. net/ipv4/igmp.c +71 −8
  946. net/ipv4/inet_fragment.c +0 −2
  947. net/ipv4/ip_gre.c +35 −223
  948. net/ipv4/ip_tunnel.c +79 −98
  949. net/ipv4/ip_tunnel_core.c +122 −0
  950. net/ipv4/ip_vti.c +0 −7
  951. net/ipv4/ipcomp.c +2 −5
  952. net/ipv4/ipip.c +13 −7
  953. net/ipv4/ipmr.c +2 −2
  954. net/ipv4/netfilter/Kconfig +1 −1
  955. net/ipv4/netfilter/ipt_MASQUERADE.c +5 −2
  956. net/ipv4/netfilter/ipt_ULOG.c +6 −0
  957. net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +1 −1
  958. net/ipv4/ping.c +451 −190
  959. net/ipv4/proc.c +1 −0
  960. net/ipv4/route.c +101 −43
  961. net/ipv4/sysctl_net_ipv4.c +16 −15
  962. net/ipv4/tcp.c +28 −316
  963. net/ipv4/tcp_input.c +224 −293
  964. net/ipv4/tcp_ipv4.c +4 −74
  965. net/ipv4/tcp_minisocks.c +2 −4
  966. net/ipv4/tcp_offload.c +332 −0
  967. net/ipv4/tcp_output.c +22 −17
  968. net/ipv4/udp.c +13 −77
  969. net/ipv4/udp_offload.c +100 −0
  970. net/ipv4/xfrm4_tunnel.c +1 −1
  971. net/ipv6/Makefile +1 −1
  972. net/ipv6/addrconf.c +190 −114
  973. net/ipv6/addrconf_core.c +1 −0
  974. net/ipv6/af_inet6.c +12 −0
  975. net/ipv6/datagram.c +27 −0
  976. net/ipv6/exthdrs_core.c +1 −1
  977. net/ipv6/icmp.c +16 −7
  978. net/ipv6/ip6_offload.c +1 −0
  979. net/ipv6/ip6_output.c +10 −6
  980. net/ipv6/ip6mr.c +1 −1
  981. net/ipv6/mcast.c +65 −10
  982. net/ipv6/mip6.c +4 −2
  983. net/ipv6/ndisc.c +6 −5
  984. net/ipv6/netfilter/ip6t_MASQUERADE.c +4 −2
  985. net/ipv6/output_core.c +2 −1
  986. net/ipv6/ping.c +277 −0
  987. net/ipv6/raw.c +10 −38
  988. net/ipv6/route.c +15 −9
  989. net/ipv6/sit.c +166 −45
  990. net/ipv6/sysctl_net_ipv6.c +2 −2
  991. net/ipv6/tcp_ipv6.c +2 −0
  992. net/ipv6/udp.c +20 −42
  993. net/ipv6/udp_offload.c +2 −1
  994. net/ipx/af_ipx.c +1 −1
  995. net/irda/irsysctl.c +3 −3
  996. net/iucv/af_iucv.c +1 −1
  997. net/l2tp/l2tp_core.c +90 −24
  998. net/l2tp/l2tp_core.h +5 −0
  999. net/l2tp/l2tp_ppp.c +2 −1
  1000. net/mac80211/aes_ccm.c +3 −3
  1001. net/mac80211/cfg.c +43 −24
  1002. net/mac80211/debugfs_netdev.c +8 −7
  1003. net/mac80211/driver-ops.h +2 −1
  1004. net/mac80211/ht.c +5 −3
  1005. net/mac80211/ibss.c +42 −72
  1006. net/mac80211/ieee80211_i.h +25 −12
  1007. net/mac80211/iface.c +25 −9
  1008. net/mac80211/key.c +12 −12
  1009. net/mac80211/key.h +2 −13
  1010. net/mac80211/main.c +3 −4
  1011. net/mac80211/mesh.c +69 −38
  1012. net/mac80211/mesh.h +4 −3
  1013. net/mac80211/mesh_plink.c +7 −1
  1014. net/mac80211/mlme.c +174 −262
  1015. net/mac80211/rate.c +7 −1
  1016. net/mac80211/rx.c +34 −22
  1017. net/mac80211/scan.c +9 −0
  1018. net/mac80211/sta_info.c +7 −1
  1019. net/mac80211/sta_info.h +9 −0
  1020. net/mac80211/tx.c +3 −8
  1021. net/mac80211/util.c +11 −30
  1022. net/mac80211/vht.c +1 −1
  1023. net/mac80211/wep.c +25 −23
  1024. net/mac80211/wpa.c +36 −32
  1025. net/mpls/Kconfig +9 −0
  1026. net/mpls/Makefile +4 −0
  1027. net/mpls/mpls_gso.c +108 −0
  1028. net/netfilter/core.c +15 −6
  1029. net/netfilter/ipvs/ip_vs_conn.c +20 −15
  1030. net/netfilter/ipvs/ip_vs_core.c +2 −2
  1031. net/netfilter/ipvs/ip_vs_ctl.c +28 −7
  1032. net/netfilter/ipvs/ip_vs_dh.c +4 −6
  1033. net/netfilter/ipvs/ip_vs_lblc.c +6 −8
  1034. net/netfilter/ipvs/ip_vs_lblcr.c +6 −8
  1035. net/netfilter/ipvs/ip_vs_lc.c +2 −1
  1036. net/netfilter/ipvs/ip_vs_nq.c +2 −1
  1037. net/netfilter/ipvs/ip_vs_proto_sctp.c +157 −703
  1038. net/netfilter/ipvs/ip_vs_proto_tcp.c +8 −6
  1039. net/netfilter/ipvs/ip_vs_rr.c +2 −1
  1040. net/netfilter/ipvs/ip_vs_sed.c +2 −1
  1041. net/netfilter/ipvs/ip_vs_sh.c +88 −20
  1042. net/netfilter/ipvs/ip_vs_sync.c +16 −3
  1043. net/netfilter/ipvs/ip_vs_wlc.c +2 −1
  1044. net/netfilter/ipvs/ip_vs_wrr.c +2 −1
  1045. net/netfilter/nf_conntrack_ftp.c +54 −19
  1046. net/netfilter/nf_conntrack_netlink.c +23 −7
  1047. net/netfilter/nf_conntrack_proto_tcp.c +6 −0
  1048. net/netfilter/nf_conntrack_standalone.c +2 −2
  1049. net/netfilter/nf_log.c +2 −4
  1050. net/netfilter/nf_nat_helper.c +1 −1
  1051. net/netfilter/nfnetlink_cthelper.c +12 −4
  1052. net/netfilter/nfnetlink_cttimeout.c +4 −2
  1053. net/netfilter/nfnetlink_queue_core.c +29 −18
  1054. net/netfilter/xt_CT.c +6 −4
  1055. net/netfilter/xt_TEE.c +1 −1
  1056. net/netfilter/xt_rateest.c +1 −1
  1057. net/netfilter/xt_socket.c +78 −18
  1058. net/netlabel/netlabel_unlabeled.c +3 −4
  1059. net/netlink/af_netlink.c +168 −10
  1060. net/netlink/af_netlink.h +1 −0
  1061. net/netrom/af_netrom.c +1 −1
  1062. net/netrom/sysctl_net_netrom.c +1 −1
  1063. net/nfc/core.c +221 −3
  1064. net/nfc/hci/core.c +59 −16
  1065. net/nfc/llcp.h +2 −1
  1066. net/nfc/llcp_commands.c +1 −21
  1067. net/nfc/llcp_core.c +14 −2
  1068. net/nfc/llcp_sock.c +14 −5
  1069. net/nfc/nci/Kconfig +10 −0
  1070. net/nfc/nci/Makefile +3 −1
  1071. net/nfc/nci/core.c +24 −13
  1072. net/nfc/nci/data.c +0 −2
  1073. net/nfc/nci/spi.c +378 −0
  1074. net/nfc/netlink.c +182 −1
  1075. net/nfc/nfc.h +11 −0
  1076. net/openvswitch/Kconfig +14 −0
  1077. net/openvswitch/Makefile +2 −1
  1078. net/openvswitch/actions.c +8 −0
  1079. net/openvswitch/datapath.c +304 −67
  1080. net/openvswitch/datapath.h +4 −0
  1081. net/openvswitch/dp_notify.c +1 −1
  1082. net/openvswitch/flow.c +180 −31
  1083. net/openvswitch/flow.h +41 −6
  1084. net/openvswitch/vport-gre.c +275 −0
  1085. net/openvswitch/vport-internal_dev.c +2 −1
  1086. net/openvswitch/vport-netdev.c +5 −4
  1087. net/openvswitch/vport-netdev.h +0 −1
  1088. net/openvswitch/vport.c +30 −4
  1089. net/openvswitch/vport.h +18 −5
  1090. net/packet/af_packet.c +3 −2
  1091. net/phonet/pn_dev.c +2 −2
  1092. net/phonet/sysctl.c +2 −2
  1093. net/rds/ib_sysctl.c +1 −1
  1094. net/rds/iw_sysctl.c +1 −1
  1095. net/rds/sysctl.c +1 −1
  1096. net/rose/af_rose.c +3 −3
  1097. net/rose/sysctl_net_rose.c +1 −1
  1098. net/sched/act_mirred.c +1 −1
  1099. net/sched/sch_cbq.c +1 −1
  1100. net/sched/sch_drr.c +1 −1
  1101. net/sched/sch_generic.c +20 −24
  1102. net/sched/sch_hfsc.c +1 −1
  1103. net/sched/sch_htb.c +140 −121
  1104. net/sched/sch_netem.c +87 −24
  1105. net/sched/sch_qfq.c +1 −1
  1106. net/sched/sch_tbf.c +45 −2
  1107. net/sctp/Kconfig +2 −9
  1108. net/sctp/associola.c +38 −46
  1109. net/sctp/bind_addr.c +1 −1
  1110. net/sctp/chunk.c +4 −3
  1111. net/sctp/debug.c +0 −4
  1112. net/sctp/endpointola.c +15 −10
  1113. net/sctp/input.c +6 −6
  1114. net/sctp/inqueue.c +4 −5
  1115. net/sctp/ipv6.c +16 −13
  1116. net/sctp/output.c +17 −23
  1117. net/sctp/outqueue.c +49 −165
  1118. net/sctp/proc.c +9 −3
  1119. net/sctp/protocol.c +29 −27
  1120. net/sctp/sm_make_chunk.c +26 −28
  1121. net/sctp/sm_sideeffect.c +50 −57
  1122. net/sctp/sm_statefuns.c +51 −34
  1123. net/sctp/socket.c +138 −151
  1124. net/sctp/sysctl.c +5 −5
  1125. net/sctp/transport.c +25 −26
  1126. net/sctp/tsnmap.c +5 −5
  1127. net/sctp/ulpevent.c +5 −5
  1128. net/socket.c +21 −2
  1129. net/sunrpc/sysctl.c +5 −5
  1130. net/sunrpc/xprtrdma/svc_rdma.c +4 −4
  1131. net/sunrpc/xprtrdma/transport.c +2 −2
  1132. net/sunrpc/xprtsock.c +2 −2
  1133. net/tipc/Makefile +2 −1
  1134. net/tipc/bcast.c +1 −2
  1135. net/tipc/bcast.h +2 −1
  1136. net/tipc/config.c +48 −71
  1137. net/tipc/core.c +15 −7
  1138. net/tipc/core.h +15 −2
  1139. net/tipc/discover.c +3 −4
  1140. net/tipc/eth_media.c +5 −14
  1141. net/tipc/ib_media.c +4 −13
  1142. net/tipc/link.c +26 −62
  1143. net/tipc/msg.c +7 −12
  1144. net/tipc/msg.h +4 −4
  1145. net/tipc/name_table.c +5 −5
  1146. net/tipc/name_table.h +6 −5
  1147. net/tipc/node_subscr.c +1 −1
  1148. net/tipc/port.c +11 −309
  1149. net/tipc/port.h +12 −73
  1150. net/tipc/server.c +596 −0
  1151. net/tipc/server.h +94 −0
  1152. net/tipc/socket.c +116 −30
  1153. net/tipc/subscr.c +97 −251
  1154. net/tipc/subscr.h +10 −11
  1155. net/tipc/sysctl.c +64 −0
  1156. net/unix/sysctl_net_unix.c +1 −1
  1157. net/vmw_vsock/af_vsock.c +24 −31
  1158. net/vmw_vsock/vmci_transport.c +9 −9
  1159. net/wireless/chan.c +49 −8
  1160. net/wireless/core.c +71 −199
  1161. net/wireless/core.h +35 −88
  1162. net/wireless/debugfs.c +2 −2
  1163. net/wireless/ibss.c +2 −14
  1164. net/wireless/mesh.c +13 −2
  1165. net/wireless/mlme.c +140 −293
  1166. net/wireless/nl80211.c +415 −399
  1167. net/wireless/reg.c +45 −93
  1168. net/wireless/scan.c +34 −17
  1169. net/wireless/sme.c +292 −360
  1170. net/wireless/sysfs.c +6 −2
  1171. net/wireless/trace.h +34 −12
  1172. net/wireless/util.c +28 −11
  1173. net/wireless/wext-compat.c +4 −18
  1174. net/wireless/wext-sme.c +15 −34
  1175. net/x25/af_x25.c +9 −8
  1176. net/xfrm/xfrm_input.c +5 −0
  1177. net/xfrm/xfrm_output.c +4 −5
  1178. net/xfrm/xfrm_policy.c +1 −1
  1179. net/xfrm/xfrm_proc.c +1 −0
  1180. security/selinux/netif.c +1 −1
  1181. tools/testing/selftests/net/psock_tpacket.c +20 −39
Documentation/DocBook/80211.tmpl+5−8
@@ -127,14 +127,11 @@ · 126 unmodified lines
127127 !Finclude/net/cfg80211.h cfg80211_ibss_params
128128 !Finclude/net/cfg80211.h cfg80211_connect_params
129129 !Finclude/net/cfg80211.h cfg80211_pmksa
130−!Finclude/net/cfg80211.h cfg80211_send_rx_auth
131−!Finclude/net/cfg80211.h cfg80211_send_auth_timeout
132−!Finclude/net/cfg80211.h cfg80211_send_rx_assoc
133−!Finclude/net/cfg80211.h cfg80211_send_assoc_timeout
134−!Finclude/net/cfg80211.h cfg80211_send_deauth
135−!Finclude/net/cfg80211.h __cfg80211_send_deauth
136−!Finclude/net/cfg80211.h cfg80211_send_disassoc
137−!Finclude/net/cfg80211.h __cfg80211_send_disassoc
130+!Finclude/net/cfg80211.h cfg80211_rx_mlme_mgmt
131+!Finclude/net/cfg80211.h cfg80211_auth_timeout
132+!Finclude/net/cfg80211.h cfg80211_rx_assoc_resp
133+!Finclude/net/cfg80211.h cfg80211_assoc_timeout
134+!Finclude/net/cfg80211.h cfg80211_tx_mlme_mgmt
138135 !Finclude/net/cfg80211.h cfg80211_ibss_joined
139136 !Finclude/net/cfg80211.h cfg80211_connect_result
140137 !Finclude/net/cfg80211.h cfg80211_roamed
Documentation/devicetree/bindings/net/allwinner,sun4i-emac.txt+22−0
@@ -0,0 +1,22 @@
1+* Allwinner EMAC ethernet controller
2+
3+Required properties:
4+- compatible: should be "allwinner,sun4i-emac".
5+- reg: address and length of the register set for the device.
6+- interrupts: interrupt for the device
7+- phy: A phandle to a phy node defining the PHY address (as the reg
8+ property, a single integer).
9+- clocks: A phandle to the reference clock for this device
10+
11+Optional properties:
12+- (local-)mac-address: mac address to be used by this driver
13+
14+Example:
15+
16+emac: ethernet@01c0b000 {
17+ compatible = "allwinner,sun4i-emac";
18+ reg = <0x01c0b000 0x1000>;
19+ interrupts = <55>;
20+ clocks = <&ahb_gates 17>;
21+ phy = <&phy0>;
22+};
Documentation/devicetree/bindings/net/allwinner,sun4i-mdio.txt+26−0
@@ -0,0 +1,26 @@
1+* Allwinner A10 MDIO Ethernet Controller interface
2+
3+Required properties:
4+- compatible: should be "allwinner,sun4i-mdio".
5+- reg: address and length of the register set for the device.
6+
7+Optional properties:
8+- phy-supply: phandle to a regulator if the PHY needs one
9+
10+Example at the SoC level:
11+mdio@01c0b080 {
12+ compatible = "allwinner,sun4i-mdio";
13+ reg = <0x01c0b080 0x14>;
14+ #address-cells = <1>;
15+ #size-cells = <0>;
16+};
17+
18+And at the board level:
19+
20+mdio@01c0b080 {
21+ phy-supply = <&reg_emac_3v3>;
22+
23+ phy0: ethernet-phy@0 {
24+ reg = <0>;
25+ };
26+};
Documentation/devicetree/bindings/net/arc_emac.txt+38−0
@@ -0,0 +1,38 @@
1+* Synopsys ARC EMAC 10/100 Ethernet driver (EMAC)
2+
3+Required properties:
4+- compatible: Should be "snps,arc-emac"
5+- reg: Address and length of the register set for the device
6+- interrupts: Should contain the EMAC interrupts
7+- clock-frequency: CPU frequency. It is needed to calculate and set polling
8+period of EMAC.
9+- max-speed: Maximum supported data-rate in Mbit/s. In some HW configurations
10+bandwidth of external memory controller might be a limiting factor. That's why
11+it's required to specify which data-rate is supported on current SoC or FPGA.
12+For example if only 10 Mbit/s is supported (10BASE-T) set "10". If 100 Mbit/s is
13+supported (100BASE-TX) set "100".
14+- phy: PHY device attached to the EMAC via MDIO bus
15+
16+Child nodes of the driver are the individual PHY devices connected to the
17+MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
18+
19+Optional properties:
20+- mac-address: 6 bytes, mac address
21+
22+Examples:
23+
24+ ethernet@c0fc2000 {
25+ compatible = "snps,arc-emac";
26+ reg = <0xc0fc2000 0x3c>;
27+ interrupts = <6>;
28+ mac-address = [ 00 11 22 33 44 55 ];
29+ clock-frequency = <80000000>;
30+ max-speed = <100>;
31+ phy = <&phy0>;
32+
33+ #address-cells = <1>;
34+ #size-cells = <0>;
35+ phy0: ethernet-phy@0 {
36+ reg = <1>;
37+ };
38+ };
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt+2−0
@@ -16,6 +16,8 @@ Optional properties: · 15 unmodified lines
1616
1717 - clock-frequency : The oscillator frequency driving the flexcan device
1818
19+- xceiver-supply: Regulator that powers the CAN transceiver
20+
1921 Example:
2022
2123 can@1c000 {
Documentation/devicetree/bindings/net/cpsw.txt+6−0
@@ -28,6 +28,8 @@ Optional properties: · 27 unmodified lines
2828 Slave Properties:
2929 Required properties:
3030 - phy_id : Specifies slave phy id
31+- phy-mode : The interface between the SoC and the PHY (a string
32+ that of_get_phy_mode() can understand)
3133 - mac-address : Specifies slave MAC address
3234
3335 Optional properties:
@@ -58,11 +60,13 @@ Examples: · 24 unmodified lines
5860 cpts_clock_shift = <29>;
5961 cpsw_emac0: slave@0 {
6062 phy_id = <&davinci_mdio>, <0>;
63+ phy-mode = "rgmii-txid";
6164 /* Filled in by U-Boot */
6265 mac-address = [ 00 00 00 00 00 00 ];
6366 };
6467 cpsw_emac1: slave@1 {
6568 phy_id = <&davinci_mdio>, <1>;
69+ phy-mode = "rgmii-txid";
6670 /* Filled in by U-Boot */
6771 mac-address = [ 00 00 00 00 00 00 ];
6872 };
@@ -84,11 +88,13 @@ Examples: · 15 unmodified lines
8488 cpts_clock_shift = <29>;
8589 cpsw_emac0: slave@0 {
8690 phy_id = <&davinci_mdio>, <0>;
91+ phy-mode = "rgmii-txid";
8792 /* Filled in by U-Boot */
8893 mac-address = [ 00 00 00 00 00 00 ];
8994 };
9095 cpsw_emac1: slave@1 {
9196 phy_id = <&davinci_mdio>, <1>;
97+ phy-mode = "rgmii-txid";
9298 /* Filled in by U-Boot */
9399 mac-address = [ 00 00 00 00 00 00 ];
94100 };
Documentation/devicetree/bindings/net/davicom-dm9000.txt+26−0
@@ -0,0 +1,26 @@
1+Davicom DM9000 Fast Ethernet controller
2+
3+Required properties:
4+- compatible = "davicom,dm9000";
5+- reg : physical addresses and sizes of registers, must contain 2 entries:
6+ first entry : address register,
7+ second entry : data register.
8+- interrupt-parent : interrupt controller to which the device is connected
9+- interrupts : interrupt specifier specific to interrupt controller
10+
11+Optional properties:
12+- local-mac-address : A bytestring of 6 bytes specifying Ethernet MAC address
13+ to use (from firmware or bootloader)
14+- davicom,no-eeprom : Configuration EEPROM is not available
15+- davicom,ext-phy : Use external PHY
16+
17+Example:
18+
19+ ethernet@18000000 {
20+ compatible = "davicom,dm9000";
21+ reg = <0x18000000 0x2 0x18000004 0x2>;
22+ interrupt-parent = <&gpn>;
23+ interrupts = <7 4>;
24+ local-mac-address = [00 00 de ad be ef];
25+ davicom,no-eeprom;
26+ };
Documentation/devicetree/bindings/net/marvell-orion-net.txt+85−0
@@ -0,0 +1,85 @@
1+Marvell Orion/Discovery ethernet controller
2+=============================================
3+
4+The Marvell Discovery ethernet controller can be found on Marvell Orion SoCs
5+(Kirkwood, Dove, Orion5x, and Discovery Innovation) and as part of Marvell
6+Discovery system controller chips (mv64[345]60).
7+
8+The Discovery ethernet controller is described with two levels of nodes. The
9+first level describes the ethernet controller itself and the second level
10+describes up to 3 ethernet port nodes within that controller. The reason for
11+the multiple levels is that the port registers are interleaved within a single
12+set of controller registers. Each port node describes port-specific properties.
13+
14+Note: The above separation is only true for Discovery system controllers.
15+For Orion SoCs we stick to the separation, although there each controller has
16+only one port associated. Multiple ports are implemented as multiple single-port
17+controllers. As Kirkwood has some issues with proper initialization after reset,
18+an extra compatible string is added for it.
19+
20+* Ethernet controller node
21+
22+Required controller properties:
23+ - #address-cells: shall be 1.
24+ - #size-cells: shall be 0.
25+ - compatible: shall be one of "marvell,orion-eth", "marvell,kirkwood-eth".
26+ - reg: address and length of the controller registers.
27+
28+Optional controller properties:
29+ - clocks: phandle reference to the controller clock.
30+ - marvell,tx-checksum-limit: max tx packet size for hardware checksum.
31+
32+* Ethernet port node
33+
34+Required port properties:
35+ - device_type: shall be "network".
36+ - compatible: shall be one of "marvell,orion-eth-port",
37+ "marvell,kirkwood-eth-port".
38+ - reg: port number relative to ethernet controller, shall be 0, 1, or 2.
39+ - interrupts: port interrupt.
40+ - local-mac-address: 6 bytes MAC address.
41+
42+Optional port properties:
43+ - marvell,tx-queue-size: size of the transmit ring buffer.
44+ - marvell,tx-sram-addr: address of transmit descriptor buffer located in SRAM.
45+ - marvell,tx-sram-size: size of transmit descriptor buffer located in SRAM.
46+ - marvell,rx-queue-size: size of the receive ring buffer.
47+ - marvell,rx-sram-addr: address of receive descriptor buffer located in SRAM.
48+ - marvell,rx-sram-size: size of receive descriptor buffer located in SRAM.
49+
50+and
51+
52+ - phy-handle: phandle reference to ethernet PHY.
53+
54+or
55+
56+ - speed: port speed if no PHY connected.
57+ - duplex: port mode if no PHY connected.
58+
59+* Node example:
60+
61+mdio-bus {
62+ ...
63+ ethphy: ethernet-phy@8 {
64+ device_type = "ethernet-phy";
65+ ...
66+ };
67+};
68+
69+eth: ethernet-controller@72000 {
70+ compatible = "marvell,orion-eth";
71+ #address-cells = <1>;
72+ #size-cells = <0>;
73+ reg = <0x72000 0x2000>;
74+ clocks = <&gate_clk 2>;
75+ marvell,tx-checksum-limit = <1600>;
76+
77+ ethernet@0 {
78+ device_type = "network";
79+ compatible = "marvell,orion-eth-port";
80+ reg = <0>;
81+ interrupts = <29>;
82+ phy-handle = <&ethphy>;
83+ local-mac-address = [00 00 00 00 00 00];
84+ };
85+};
Documentation/devicetree/bindings/net/micrel-ks8851.txt+9−0
@@ -0,0 +1,9 @@
1+Micrel KS8851 Ethernet mac
2+
3+Required properties:
4+- compatible = "micrel,ks8851-ml" of parallel interface
5+- reg : 2 physical address and size of registers for data and command
6+- interrupts : interrupt connection
7+
8+Optional properties:
9+- local-mac-address : Ethernet mac address to use
Documentation/devicetree/bindings/net/stmmac.txt+10−0
@@ -12,6 +12,16 @@ Required properties: · 11 unmodified lines
1212 property
1313 - phy-mode: String, operation mode of the PHY interface.
1414 Supported values are: "mii", "rmii", "gmii", "rgmii".
15+- snps,phy-addr phy address to connect to.
16+- snps,reset-gpio gpio number for phy reset.
17+- snps,reset-active-low boolean flag to indicate if phy reset is active low.
18+- snps,reset-delays-us is triplet of delays
19+ The 1st cell is reset pre-delay in micro seconds.
20+ The 2nd cell is reset pulse in micro seconds.
21+ The 3rd cell is reset post-delay in micro seconds.
22+- snps,pbl Programmable Burst Length
23+- snps,fixed-burst Program the DMA to use the fixed burst mode
24+- snps,mixed-burst Program the DMA to use the mixed burst mode
1525
1626 Optional properties:
1727 - mac-address: 6 bytes, mac address
Documentation/devicetree/bindings/net/via-velocity.txt+20−0
@@ -0,0 +1,20 @@
1+* VIA Velocity 10/100/1000 Network Controller
2+
3+Required properties:
4+- compatible : Should be "via,velocity-vt6110"
5+- reg : Address and length of the io space
6+- interrupts : Should contain the controller interrupt line
7+
8+Optional properties:
9+- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded
10+ devices quite often set this data in uboot and do not provide an eeprom.
11+ Specify this option if you have no external eeprom.
12+
13+Examples:
14+
15+eth0@d8004000 {
16+ compatible = "via,velocity-vt6110";
17+ reg = <0xd8004000 0x400>;
18+ interrupts = <10>;
19+ no-eeprom;
20+};
Documentation/devicetree/bindings/vendor-prefixes.txt+1−0
@@ -18,6 +18,7 @@ chrp Common Hardware Reference Platform · 17 unmodified lines
1818 cirrus Cirrus Logic, Inc.
1919 cortina Cortina Systems, Inc.
2020 dallas Maxim Integrated Products (formerly Dallas Semiconductor)
21+davicom DAVICOM Semiconductor, Inc.
2122 denx Denx Software Engineering
2223 emmicro EM Microelectronic
2324 epson Seiko Epson Corp.
Documentation/networking/.gitignore+0−1
@@ -1 +0,0 @@
1−ifenslave
Documentation/networking/00-INDEX+0−2
@@ -88,8 +88,6 @@ gianfar.txt · 87 unmodified lines
8888 - Gianfar Ethernet Driver.
8989 ieee802154.txt
9090 - Linux IEEE 802.15.4 implementation, API and drivers
91−ifenslave.c
92− - Configure network interfaces for parallel routing (bonding).
9391 igb.txt
9492 - README for the Intel Gigabit Ethernet Driver (igb).
9593 igbvf.txt
Documentation/networking/Makefile+0−5
@@ -1,11 +1,6 @@
11 # kbuild trick to avoid linker error. Can be omitted if a module is built.
22 obj- := dummy.o
33
4−# List of programs to build
5−hostprogs-y := ifenslave
6−
7−HOSTCFLAGS_ifenslave.o += -I$(objtree)/usr/include
8−
94 # Tell kbuild to always build the programs
105 always := $(hostprogs-y)
116
Documentation/networking/arcnet.txt+4−3
@@ -70,9 +70,10 @@ list, mail to linux-arcnet@tichy.ch.uj.edu.pl. · 69 unmodified lines
7070 There are archives of the mailing list at:
7171 http://epistolary.org/mailman/listinfo.cgi/arcnet
7272
73−The people on linux-net@vger.kernel.org have also been known to be very
74−helpful, especially when we're talking about ALPHA Linux kernels that may or
75−may not work right in the first place.
73+The people on linux-net@vger.kernel.org (now defunct, replaced by
74+netdev@vger.kernel.org) have also been known to be very helpful, especially
75+when we're talking about ALPHA Linux kernels that may or may not work right
76+in the first place.
7677
7778
7879 Other Drivers and Info
Documentation/networking/bonding.txt+35−44
@@ -104,8 +104,7 @@ Table of Contents · 103 unmodified lines
104104 ==============================
105105
106106 Most popular distro kernels ship with the bonding driver
107−already available as a module and the ifenslave user level control
108−program installed and ready for use. If your distro does not, or you
107+already available as a module. If your distro does not, or you
109108 have need to compile bonding from source (e.g., configuring and
110109 installing a mainline kernel from kernel.org), you'll need to perform
111110 the following steps:
@@ -124,46 +123,13 @@ device support" section. It is recommended that you configure the · 12 unmodified lines
124123 driver as module since it is currently the only way to pass parameters
125124 to the driver or configure more than one bonding device.
126125
127− Build and install the new kernel and modules, then continue
128−below to install ifenslave.
126+ Build and install the new kernel and modules.
129127
130−1.2 Install ifenslave Control Utility
128+1.2 Bonding Control Utility
131129 -------------------------------------
132130
133− The ifenslave user level control program is included in the
134−kernel source tree, in the file Documentation/networking/ifenslave.c.
135−It is generally recommended that you use the ifenslave that
136−corresponds to the kernel that you are using (either from the same
137−source tree or supplied with the distro), however, ifenslave
138−executables from older kernels should function (but features newer
139−than the ifenslave release are not supported). Running an ifenslave
140−that is newer than the kernel is not supported, and may or may not
141−work.
142−
143− To install ifenslave, do the following:
144−
145−# gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
146−# cp ifenslave /sbin/ifenslave
147−
148− If your kernel source is not in "/usr/src/linux," then replace
149−"/usr/src/linux/include" in the above with the location of your kernel
150−source include directory.
151−
152− You may wish to back up any existing /sbin/ifenslave, or, for
153−testing or informal use, tag the ifenslave to the kernel version
154−(e.g., name the ifenslave executable /sbin/ifenslave-2.6.10).
155−
156−IMPORTANT NOTE:
157−
158− If you omit the "-I" or specify an incorrect directory, you
159−may end up with an ifenslave that is incompatible with the kernel
160−you're trying to build it for. Some distros (e.g., Red Hat from 7.1
161−onwards) do not have /usr/include/linux symbolically linked to the
162−default kernel source include directory.
163−
164−SECOND IMPORTANT NOTE:
165− If you plan to configure bonding using sysfs or using the
166−/etc/network/interfaces file, you do not need to use ifenslave.
131+ It is recommended to configure bonding via iproute2 (netlink)
132+or sysfs, the old ifenslave control utility is obsolete.
167133
168134 2. Bonding Driver Options
169135 =========================
@@ -337,6 +303,12 @@ arp_validate · 167 unmodified lines
337303 such a situation, validation of backup slaves must be
338304 disabled.
339305
306+ The validation of ARP requests on backup slaves is mainly
307+ helping bonding to decide which slaves are more likely to
308+ work in case of the active slave failure, it doesn't really
309+ guarantee that the backup slave will work if it's selected
310+ as the next active slave.
311+
340312 This option is useful in network configurations in which
341313 multiple bonding hosts are concurrently issuing ARPs to one or
342314 more targets beyond a common switch. Should the link between
@@ -349,6 +321,25 @@ arp_validate · 6 unmodified lines
349321
350322 This option was added in bonding version 3.1.0.
351323
324+arp_all_targets
325+
326+ Specifies the quantity of arp_ip_targets that must be reachable
327+ in order for the ARP monitor to consider a slave as being up.
328+ This option affects only active-backup mode for slaves with
329+ arp_validation enabled.
330+
331+ Possible values are:
332+
333+ any or 0
334+
335+ consider the slave up only when any of the arp_ip_targets
336+ is reachable
337+
338+ all or 1
339+
340+ consider the slave up only when all of the arp_ip_targets
341+ are reachable
342+
352343 downdelay
353344
354345 Specifies the time, in milliseconds, to wait before disabling
@@ -851,7 +842,7 @@ resend_igmp · 496 unmodified lines
851842 ==============================
852843
853844 You can configure bonding using either your distro's network
854−initialization scripts, or manually using either ifenslave or the
845+initialization scripts, or manually using either iproute2 or the
855846 sysfs interface. Distros generally use one of three packages for the
856847 network initialization scripts: initscripts, sysconfig or interfaces.
857848 Recent versions of these packages have support for bonding, while older
@@ -1160,7 +1151,7 @@ not support this method for specifying multiple bonding interfaces; for · 302 unmodified lines
11601151 those instances, see the "Configuring Multiple Bonds Manually" section,
11611152 below.
11621153
1163−3.3 Configuring Bonding Manually with Ifenslave
1154+3.3 Configuring Bonding Manually with iproute2
11641155 -----------------------------------------------
11651156
11661157 This section applies to distros whose network initialization
@@ -1171,7 +1162,7 @@ version 8. · 4 unmodified lines
11711162 The general method for these systems is to place the bonding
11721163 module parameters into a config file in /etc/modprobe.d/ (as
11731164 appropriate for the installed distro), then add modprobe and/or
1174−ifenslave commands to the system's global init script. The name of
1165+`ip link` commands to the system's global init script. The name of
11751166 the global init script differs; for sysconfig, it is
11761167 /etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
11771168
@@ -1183,8 +1174,8 @@ reboots, edit the appropriate file (/etc/init.d/boot.local or · 5 unmodified lines
11831174 modprobe bonding mode=balance-alb miimon=100
11841175 modprobe e100
11851176 ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
1186−ifenslave bond0 eth0
1187−ifenslave bond0 eth1
1177+ip link set eth0 master bond0
1178+ip link set eth1 master bond0
11881179
11891180 Replace the example bonding module parameters and bond0
11901181 network configuration (IP address, netmask, etc) with the appropriate
Documentation/networking/ifenslave.c+0−1105
@@ -1,1105 +0,0 @@
1−/* Mode: C;
2− * ifenslave.c: Configure network interfaces for parallel routing.
3− *
4− * This program controls the Linux implementation of running multiple
5− * network interfaces in parallel.
6− *
7− * Author: Donald Becker <becker@cesdis.gsfc.nasa.gov>
8− * Copyright 1994-1996 Donald Becker
9− *
10− * This program is free software; you can redistribute it
11− * and/or modify it under the terms of the GNU General Public
12− * License as published by the Free Software Foundation.
13− *
14− * The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
15− * Center of Excellence in Space Data and Information Sciences
16− * Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
17− *
18− * Changes :
19− * - 2000/10/02 Willy Tarreau <willy at meta-x.org> :
20− * - few fixes. Master's MAC address is now correctly taken from
21− * the first device when not previously set ;
22− * - detach support : call BOND_RELEASE to detach an enslaved interface.
23− * - give a mini-howto from command-line help : # ifenslave -h
24− *
25− * - 2001/02/16 Chad N. Tindel <ctindel at ieee dot org> :
26− * - Master is now brought down before setting the MAC address. In
27− * the 2.4 kernel you can't change the MAC address while the device is
28− * up because you get EBUSY.
29− *
30− * - 2001/09/13 Takao Indoh <indou dot takao at jp dot fujitsu dot com>
31− * - Added the ability to change the active interface on a mode 1 bond
32− * at runtime.
33− *
34− * - 2001/10/23 Chad N. Tindel <ctindel at ieee dot org> :
35− * - No longer set the MAC address of the master. The bond device will
36− * take care of this itself
37− * - Try the SIOC*** versions of the bonding ioctls before using the
38− * old versions
39− * - 2002/02/18 Erik Habbinga <erik_habbinga @ hp dot com> :
40− * - ifr2.ifr_flags was not initialized in the hwaddr_notset case,
41− * SIOCGIFFLAGS now called before hwaddr_notset test
42− *
43− * - 2002/10/31 Tony Cureington <tony.cureington * hp_com> :
44− * - If the master does not have a hardware address when the first slave
45− * is enslaved, the master is assigned the hardware address of that
46− * slave - there is a comment in bonding.c stating "ifenslave takes
47− * care of this now." This corrects the problem of slaves having
48− * different hardware addresses in active-backup mode when
49− * multiple interfaces are specified on a single ifenslave command
50− * (ifenslave bond0 eth0 eth1).
51− *
52− * - 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and
53− * Shmulik Hen <shmulik.hen at intel dot com>
54− * - Moved setting the slave's mac address and openning it, from
55− * the application to the driver. This enables support of modes
56− * that need to use the unique mac address of each slave.
57− * The driver also takes care of closing the slave and restoring its
58− * original mac address upon release.
59− * In addition, block possibility of enslaving before the master is up.
60− * This prevents putting the system in an undefined state.
61− *
62− * - 2003/05/01 - Amir Noam <amir.noam at intel dot com>
63− * - Added ABI version control to restore compatibility between
64− * new/old ifenslave and new/old bonding.
65− * - Prevent adding an adapter that is already a slave.
66− * Fixes the problem of stalling the transmission and leaving
67− * the slave in a down state.
68− *
69− * - 2003/05/01 - Shmulik Hen <shmulik.hen at intel dot com>
70− * - Prevent enslaving if the bond device is down.
71− * Fixes the problem of leaving the system in unstable state and
72− * halting when trying to remove the module.
73− * - Close socket on all abnormal exists.
74− * - Add versioning scheme that follows that of the bonding driver.
75− * current version is 1.0.0 as a base line.
76− *
77− * - 2003/05/22 - Jay Vosburgh <fubar at us dot ibm dot com>
78− * - ifenslave -c was broken; it's now fixed
79− * - Fixed problem with routes vanishing from master during enslave
80− * processing.
81− *
82− * - 2003/05/27 - Amir Noam <amir.noam at intel dot com>
83− * - Fix backward compatibility issues:
84− * For drivers not using ABI versions, slave was set down while
85− * it should be left up before enslaving.
86− * Also, master was not set down and the default set_mac_address()
87− * would fail and generate an error message in the system log.
88− * - For opt_c: slave should not be set to the master's setting
89− * while it is running. It was already set during enslave. To
90− * simplify things, it is now handled separately.
91− *
92− * - 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
93− * - Code cleanup and style changes
94− * set version to 1.1.0
95− */
96−
97−#define APP_VERSION "1.1.0"
98−#define APP_RELDATE "December 1, 2003"
99−#define APP_NAME "ifenslave"
100−
101−static char *version =
102−APP_NAME ".c:v" APP_VERSION " (" APP_RELDATE ")\n"
103−"o Donald Becker (becker@cesdis.gsfc.nasa.gov).\n"
104−"o Detach support added on 2000/10/02 by Willy Tarreau (willy at meta-x.org).\n"
105−"o 2.4 kernel support added on 2001/02/16 by Chad N. Tindel\n"
106−" (ctindel at ieee dot org).\n";
107−
108−static const char *usage_msg =
109−"Usage: ifenslave [-f] <master-if> <slave-if> [<slave-if>...]\n"
110−" ifenslave -d <master-if> <slave-if> [<slave-if>...]\n"
111−" ifenslave -c <master-if> <slave-if>\n"
112−" ifenslave --help\n";
113−
114−static const char *help_msg =
115−"\n"
116−" To create a bond device, simply follow these three steps :\n"
117−" - ensure that the required drivers are properly loaded :\n"
118−" # modprobe bonding ; modprobe <3c59x|eepro100|pcnet32|tulip|...>\n"
119−" - assign an IP address to the bond device :\n"
120−" # ifconfig bond0 <addr> netmask <mask> broadcast <bcast>\n"
121−" - attach all the interfaces you need to the bond device :\n"
122−" # ifenslave [{-f|--force}] bond0 eth0 [eth1 [eth2]...]\n"
123−" If bond0 didn't have a MAC address, it will take eth0's. Then, all\n"
124−" interfaces attached AFTER this assignment will get the same MAC addr.\n"
125−" (except for ALB/TLB modes)\n"
126−"\n"
127−" To set the bond device down and automatically release all the slaves :\n"
128−" # ifconfig bond0 down\n"
129−"\n"
130−" To detach a dead interface without setting the bond device down :\n"
131−" # ifenslave {-d|--detach} bond0 eth0 [eth1 [eth2]...]\n"
132−"\n"
133−" To change active slave :\n"
134−" # ifenslave {-c|--change-active} bond0 eth0\n"
135−"\n"
136−" To show master interface info\n"
137−" # ifenslave bond0\n"
138−"\n"
139−" To show all interfaces info\n"
140−" # ifenslave {-a|--all-interfaces}\n"
141−"\n"
142−" To be more verbose\n"
143−" # ifenslave {-v|--verbose} ...\n"
144−"\n"
145−" # ifenslave {-u|--usage} Show usage\n"
146−" # ifenslave {-V|--version} Show version\n"
147−" # ifenslave {-h|--help} This message\n"
148−"\n";
149−
150−#include <unistd.h>
151−#include <stdlib.h>
152−#include <stdio.h>
153−#include <ctype.h>
154−#include <string.h>
155−#include <errno.h>
156−#include <fcntl.h>
157−#include <getopt.h>
158−#include <sys/types.h>
159−#include <sys/socket.h>
160−#include <sys/ioctl.h>
161−#include <linux/if.h>
162−#include <net/if_arp.h>
163−#include <linux/if_ether.h>
164−#include <linux/if_bonding.h>
165−#include <linux/sockios.h>
166−
167−typedef unsigned long long u64; /* hack, so we may include kernel's ethtool.h */
168−typedef __uint32_t u32; /* ditto */
169−typedef __uint16_t u16; /* ditto */
170−typedef __uint8_t u8; /* ditto */
171−#include <linux/ethtool.h>
172−
173−struct option longopts[] = {
174− /* { name has_arg *flag val } */
175− {"all-interfaces", 0, 0, 'a'}, /* Show all interfaces. */
176− {"change-active", 0, 0, 'c'}, /* Change the active slave. */
177− {"detach", 0, 0, 'd'}, /* Detach a slave interface. */
178− {"force", 0, 0, 'f'}, /* Force the operation. */
179− {"help", 0, 0, 'h'}, /* Give help */
180− {"usage", 0, 0, 'u'}, /* Give usage */
181− {"verbose", 0, 0, 'v'}, /* Report each action taken. */
182− {"version", 0, 0, 'V'}, /* Emit version information. */
183− { 0, 0, 0, 0}
184−};
185−
186−/* Command-line flags. */
187−unsigned int
188−opt_a = 0, /* Show-all-interfaces flag. */
189−opt_c = 0, /* Change-active-slave flag. */
190−opt_d = 0, /* Detach a slave interface. */
191−opt_f = 0, /* Force the operation. */
192−opt_h = 0, /* Help */
193−opt_u = 0, /* Usage */
194−opt_v = 0, /* Verbose flag. */
195−opt_V = 0; /* Version */
196−
197−int skfd = -1; /* AF_INET socket for ioctl() calls.*/
198−int abi_ver = 0; /* userland - kernel ABI version */
199−int hwaddr_set = 0; /* Master's hwaddr is set */
200−int saved_errno;
201−
202−struct ifreq master_mtu, master_flags, master_hwaddr;
203−struct ifreq slave_mtu, slave_flags, slave_hwaddr;
204−
205−struct dev_ifr {
206− struct ifreq *req_ifr;
207− char *req_name;
208− int req_type;
209−};
210−
211−struct dev_ifr master_ifra[] = {
212− {&master_mtu, "SIOCGIFMTU", SIOCGIFMTU},
213− {&master_flags, "SIOCGIFFLAGS", SIOCGIFFLAGS},
214− {&master_hwaddr, "SIOCGIFHWADDR", SIOCGIFHWADDR},
215− {NULL, "", 0}
216−};
217−
218−struct dev_ifr slave_ifra[] = {
219− {&slave_mtu, "SIOCGIFMTU", SIOCGIFMTU},
220− {&slave_flags, "SIOCGIFFLAGS", SIOCGIFFLAGS},
221− {&slave_hwaddr, "SIOCGIFHWADDR", SIOCGIFHWADDR},
222− {NULL, "", 0}
223−};
224−
225−static void if_print(char *ifname);
226−static int get_drv_info(char *master_ifname);
227−static int get_if_settings(char *ifname, struct dev_ifr ifra[]);
228−static int get_slave_flags(char *slave_ifname);
229−static int set_master_hwaddr(char *master_ifname, struct sockaddr *hwaddr);
230−static int set_slave_hwaddr(char *slave_ifname, struct sockaddr *hwaddr);
231−static int set_slave_mtu(char *slave_ifname, int mtu);
232−static int set_if_flags(char *ifname, short flags);
233−static int set_if_up(char *ifname, short flags);
234−static int set_if_down(char *ifname, short flags);
235−static int clear_if_addr(char *ifname);
236−static int set_if_addr(char *master_ifname, char *slave_ifname);
237−static int change_active(char *master_ifname, char *slave_ifname);
238−static int enslave(char *master_ifname, char *slave_ifname);
239−static int release(char *master_ifname, char *slave_ifname);
240−#define v_print(fmt, args...) \
241− if (opt_v) \
242− fprintf(stderr, fmt, ## args )
243−
244−int main(int argc, char *argv[])
245−{
246− char **spp, *master_ifname, *slave_ifname;
247− int c, i, rv;
248− int res = 0;
249− int exclusive = 0;
250−
251− while ((c = getopt_long(argc, argv, "acdfhuvV", longopts, 0)) != EOF) {
252− switch (c) {
253− case 'a': opt_a++; exclusive++; break;
254− case 'c': opt_c++; exclusive++; break;
255− case 'd': opt_d++; exclusive++; break;
256− case 'f': opt_f++; exclusive++; break;
257− case 'h': opt_h++; exclusive++; break;
258− case 'u': opt_u++; exclusive++; break;
259− case 'v': opt_v++; break;
260− case 'V': opt_V++; exclusive++; break;
261−
262− case '?':
263− fprintf(stderr, "%s", usage_msg);
264− res = 2;
265− goto out;
266− }
267− }
268−
269− /* options check */
270− if (exclusive > 1) {
271− fprintf(stderr, "%s", usage_msg);
272− res = 2;
273− goto out;
274− }
275−
276− if (opt_v || opt_V) {
277− printf("%s", version);
278− if (opt_V) {
279− res = 0;
280− goto out;
281− }
282− }
283−
284− if (opt_u) {
285− printf("%s", usage_msg);
286− res = 0;
287− goto out;
288− }
289−
290− if (opt_h) {
291− printf("%s", usage_msg);
292− printf("%s", help_msg);
293− res = 0;
294− goto out;
295− }
296−
297− /* Open a basic socket */
298− if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
299− perror("socket");
300− res = 1;
301− goto out;
302− }
303−
304− if (opt_a) {
305− if (optind == argc) {
306− /* No remaining args */
307− /* show all interfaces */
308− if_print((char *)NULL);
309− goto out;
310− } else {
311− /* Just show usage */
312− fprintf(stderr, "%s", usage_msg);
313− res = 2;
314− goto out;
315− }
316− }
317−
318− /* Copy the interface name */
319− spp = argv + optind;
320− master_ifname = *spp++;
321−
322− if (master_ifname == NULL) {
323− fprintf(stderr, "%s", usage_msg);
324− res = 2;
325− goto out;
326− }
327−
328− /* exchange abi version with bonding module */
329− res = get_drv_info(master_ifname);
330− if (res) {
331− fprintf(stderr,
332− "Master '%s': Error: handshake with driver failed. "
333− "Aborting\n",
334− master_ifname);
335− goto out;
336− }
337−
338− slave_ifname = *spp++;
339−
340− if (slave_ifname == NULL) {
341− if (opt_d || opt_c) {
342− fprintf(stderr, "%s", usage_msg);
343− res = 2;
344− goto out;
345− }
346−
347− /* A single arg means show the
348− * configuration for this interface
349− */
350− if_print(master_ifname);
351− goto out;
352− }
353−
354− res = get_if_settings(master_ifname, master_ifra);
355− if (res) {
356− /* Probably a good reason not to go on */
357− fprintf(stderr,
358− "Master '%s': Error: get settings failed: %s. "
359− "Aborting\n",
360− master_ifname, strerror(res));
361− goto out;
362− }
363−
364− /* check if master is indeed a master;
365− * if not then fail any operation
366− */
367− if (!(master_flags.ifr_flags & IFF_MASTER)) {
368− fprintf(stderr,
369− "Illegal operation; the specified interface '%s' "
370− "is not a master. Aborting\n",
371− master_ifname);
372− res = 1;
373− goto out;
374− }
375−
376− /* check if master is up; if not then fail any operation */
377− if (!(master_flags.ifr_flags & IFF_UP)) {
378− fprintf(stderr,
379− "Illegal operation; the specified master interface "
380− "'%s' is not up.\n",
381− master_ifname);
382− res = 1;
383− goto out;
384− }
385−
386− /* Only for enslaving */
387− if (!opt_c && !opt_d) {
388− sa_family_t master_family = master_hwaddr.ifr_hwaddr.sa_family;
389− unsigned char *hwaddr =
390− (unsigned char *)master_hwaddr.ifr_hwaddr.sa_data;
391−
392− /* The family '1' is ARPHRD_ETHER for ethernet. */
393− if (master_family != 1 && !opt_f) {
394− fprintf(stderr,
395− "Illegal operation: The specified master "
396− "interface '%s' is not ethernet-like.\n "
397− "This program is designed to work with "
398− "ethernet-like network interfaces.\n "
399− "Use the '-f' option to force the "
400− "operation.\n",
401− master_ifname);
402− res = 1;
403− goto out;
404− }
405−
406− /* Check master's hw addr */
407− for (i = 0; i < 6; i++) {
408− if (hwaddr[i] != 0) {
409− hwaddr_set = 1;
410− break;
411− }
412− }
413−
414− if (hwaddr_set) {
415− v_print("current hardware address of master '%s' "
416− "is %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "
417− "type %d\n",
418− master_ifname,
419− hwaddr[0], hwaddr[1],
420− hwaddr[2], hwaddr[3],
421− hwaddr[4], hwaddr[5],
422− master_family);
423− }
424− }
425−
426− /* Accepts only one slave */
427− if (opt_c) {
428− /* change active slave */
429− res = get_slave_flags(slave_ifname);
430− if (res) {
431− fprintf(stderr,
432− "Slave '%s': Error: get flags failed. "
433− "Aborting\n",
434− slave_ifname);
435− goto out;
436− }
437− res = change_active(master_ifname, slave_ifname);
438− if (res) {
439− fprintf(stderr,
440− "Master '%s', Slave '%s': Error: "
441− "Change active failed\n",
442− master_ifname, slave_ifname);
443− }
444− } else {
445− /* Accept multiple slaves */
446− do {
447− if (opt_d) {
448− /* detach a slave interface from the master */
449− rv = get_slave_flags(slave_ifname);
450− if (rv) {
451− /* Can't work with this slave. */
452− /* remember the error and skip it*/
453− fprintf(stderr,
454− "Slave '%s': Error: get flags "
455− "failed. Skipping\n",
456− slave_ifname);
457− res = rv;
458− continue;
459− }
460− rv = release(master_ifname, slave_ifname);
461− if (rv) {
462− fprintf(stderr,
463− "Master '%s', Slave '%s': Error: "
464− "Release failed\n",
465− master_ifname, slave_ifname);
466− res = rv;
467− }
468− } else {
469− /* attach a slave interface to the master */
470− rv = get_if_settings(slave_ifname, slave_ifra);
471− if (rv) {
472− /* Can't work with this slave. */
473− /* remember the error and skip it*/
474− fprintf(stderr,
475− "Slave '%s': Error: get "
476− "settings failed: %s. "
477− "Skipping\n",
478− slave_ifname, strerror(rv));
479− res = rv;
480− continue;
481− }
482− rv = enslave(master_ifname, slave_ifname);
483− if (rv) {
484− fprintf(stderr,
485− "Master '%s', Slave '%s': Error: "
486− "Enslave failed\n",
487− master_ifname, slave_ifname);
488− res = rv;
489− }
490− }
491− } while ((slave_ifname = *spp++) != NULL);
492− }
493−
494−out:
495− if (skfd >= 0) {
496− close(skfd);
497− }
498−
499− return res;
500−}
501−
502−static short mif_flags;
503−
504−/* Get the inteface configuration from the kernel. */
505−static int if_getconfig(char *ifname)
506−{
507− struct ifreq ifr;
508− int metric, mtu; /* Parameters of the master interface. */
509− struct sockaddr dstaddr, broadaddr, netmask;
510− unsigned char *hwaddr;
511−
512− strcpy(ifr.ifr_name, ifname);
513− if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0)
514− return -1;
515− mif_flags = ifr.ifr_flags;
516− printf("The result of SIOCGIFFLAGS on %s is %x.\n",
517− ifname, ifr.ifr_flags);
518−
519− strcpy(ifr.ifr_name, ifname);
520− if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0)
521− return -1;
522− printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
523− ifr.ifr_addr.sa_data[0], ifr.ifr_addr.sa_data[1],
524− ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3]);
525−
526− strcpy(ifr.ifr_name, ifname);
527− if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
528− return -1;
529−
530− /* Gotta convert from 'char' to unsigned for printf(). */
531− hwaddr = (unsigned char *)ifr.ifr_hwaddr.sa_data;
532− printf("The result of SIOCGIFHWADDR is type %d "
533− "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n",
534− ifr.ifr_hwaddr.sa_family, hwaddr[0], hwaddr[1],
535− hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
536−
537− strcpy(ifr.ifr_name, ifname);
538− if (ioctl(skfd, SIOCGIFMETRIC, &ifr) < 0) {
539− metric = 0;
540− } else
541− metric = ifr.ifr_metric;
542− printf("The result of SIOCGIFMETRIC is %d\n", metric);
543−
544− strcpy(ifr.ifr_name, ifname);
545− if (ioctl(skfd, SIOCGIFMTU, &ifr) < 0)
546− mtu = 0;
547− else
548− mtu = ifr.ifr_mtu;
549− printf("The result of SIOCGIFMTU is %d\n", mtu);
550−
551− strcpy(ifr.ifr_name, ifname);
552− if (ioctl(skfd, SIOCGIFDSTADDR, &ifr) < 0) {
553− memset(&dstaddr, 0, sizeof(struct sockaddr));
554− } else
555− dstaddr = ifr.ifr_dstaddr;
556−
557− strcpy(ifr.ifr_name, ifname);
558− if (ioctl(skfd, SIOCGIFBRDADDR, &ifr) < 0) {
559− memset(&broadaddr, 0, sizeof(struct sockaddr));
560− } else
561− broadaddr = ifr.ifr_broadaddr;
562−
563− strcpy(ifr.ifr_name, ifname);
564− if (ioctl(skfd, SIOCGIFNETMASK, &ifr) < 0) {
565− memset(&netmask, 0, sizeof(struct sockaddr));
566− } else
567− netmask = ifr.ifr_netmask;
568−
569− return 0;
570−}
571−
572−static void if_print(char *ifname)
573−{
574− char buff[1024];
575− struct ifconf ifc;
576− struct ifreq *ifr;
577− int i;
578−
579− if (ifname == (char *)NULL) {
580− ifc.ifc_len = sizeof(buff);
581− ifc.ifc_buf = buff;
582− if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) {
583− perror("SIOCGIFCONF failed");
584− return;
585− }
586−
587− ifr = ifc.ifc_req;
588− for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; ifr++) {
589− if (if_getconfig(ifr->ifr_name) < 0) {
590− fprintf(stderr,
591− "%s: unknown interface.\n",
592− ifr->ifr_name);
593− continue;
594− }
595−
596− if (((mif_flags & IFF_UP) == 0) && !opt_a) continue;
597− /*ife_print(&ife);*/
598− }
599− } else {
600− if (if_getconfig(ifname) < 0) {
601− fprintf(stderr,
602− "%s: unknown interface.\n", ifname);
603− }
604− }
605−}
606−
607−static int get_drv_info(char *master_ifname)
608−{
609− struct ifreq ifr;
610− struct ethtool_drvinfo info;
611− char *endptr;
612−
613− memset(&ifr, 0, sizeof(ifr));
614− strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
615− ifr.ifr_data = (caddr_t)&info;
616−
617− info.cmd = ETHTOOL_GDRVINFO;
618− strncpy(info.driver, "ifenslave", 32);
619− snprintf(info.fw_version, 32, "%d", BOND_ABI_VERSION);
620−
621− if (ioctl(skfd, SIOCETHTOOL, &ifr) < 0) {
622− if (errno == EOPNOTSUPP) {
623− goto out;
624− }
625−
626− saved_errno = errno;
627− v_print("Master '%s': Error: get bonding info failed %s\n",
628− master_ifname, strerror(saved_errno));
629− return 1;
630− }
631−
632− abi_ver = strtoul(info.fw_version, &endptr, 0);
633− if (*endptr) {
634− v_print("Master '%s': Error: got invalid string as an ABI "
635− "version from the bonding module\n",
636− master_ifname);
637− return 1;
638− }
639−
640−out:
641− v_print("ABI ver is %d\n", abi_ver);
642−
643− return 0;
644−}
645−
646−static int change_active(char *master_ifname, char *slave_ifname)
647−{
648− struct ifreq ifr;
649− int res = 0;
650−
651− if (!(slave_flags.ifr_flags & IFF_SLAVE)) {
652− fprintf(stderr,
653− "Illegal operation: The specified slave interface "
654− "'%s' is not a slave\n",
655− slave_ifname);
656− return 1;
657− }
658−
659− strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
660− strncpy(ifr.ifr_slave, slave_ifname, IFNAMSIZ);
661− if ((ioctl(skfd, SIOCBONDCHANGEACTIVE, &ifr) < 0) &&
662− (ioctl(skfd, BOND_CHANGE_ACTIVE_OLD, &ifr) < 0)) {
663− saved_errno = errno;
664− v_print("Master '%s': Error: SIOCBONDCHANGEACTIVE failed: "
665− "%s\n",
666− master_ifname, strerror(saved_errno));
667− res = 1;
668− }
669−
670− return res;
671−}
672−
673−static int enslave(char *master_ifname, char *slave_ifname)
674−{
675− struct ifreq ifr;
676− int res = 0;
677−
678− if (slave_flags.ifr_flags & IFF_SLAVE) {
679− fprintf(stderr,
680− "Illegal operation: The specified slave interface "
681− "'%s' is already a slave\n",
682− slave_ifname);
683− return 1;
684− }
685−
686− res = set_if_down(slave_ifname, slave_flags.ifr_flags);
687− if (res) {
688− fprintf(stderr,
689− "Slave '%s': Error: bring interface down failed\n",
690− slave_ifname);
691− return res;
692− }
693−
694− if (abi_ver < 2) {
695− /* Older bonding versions would panic if the slave has no IP
696− * address, so get the IP setting from the master.
697− */
698− set_if_addr(master_ifname, slave_ifname);
699− } else {
700− res = clear_if_addr(slave_ifname);
701− if (res) {
702− fprintf(stderr,
703− "Slave '%s': Error: clear address failed\n",
704− slave_ifname);
705− return res;
706− }
707− }
708−
709− if (master_mtu.ifr_mtu != slave_mtu.ifr_mtu) {
710− res = set_slave_mtu(slave_ifname, master_mtu.ifr_mtu);
711− if (res) {
712− fprintf(stderr,
713− "Slave '%s': Error: set MTU failed\n",
714− slave_ifname);
715− return res;
716− }
717− }
718−
719− if (hwaddr_set) {
720− /* Master already has an hwaddr
721− * so set it's hwaddr to the slave
722− */
723− if (abi_ver < 1) {
724− /* The driver is using an old ABI, so
725− * the application sets the slave's
726− * hwaddr
727− */
728− res = set_slave_hwaddr(slave_ifname,
729− &(master_hwaddr.ifr_hwaddr));
730− if (res) {
731− fprintf(stderr,
732− "Slave '%s': Error: set hw address "
733− "failed\n",
734− slave_ifname);
735− goto undo_mtu;
736− }
737−
738− /* For old ABI the application needs to bring the
739− * slave back up
740− */
741− res = set_if_up(slave_ifname, slave_flags.ifr_flags);
742− if (res) {
743− fprintf(stderr,
744− "Slave '%s': Error: bring interface "
745− "down failed\n",
746− slave_ifname);
747− goto undo_slave_mac;
748− }
749− }
750− /* The driver is using a new ABI,
751− * so the driver takes care of setting
752− * the slave's hwaddr and bringing
753− * it up again
754− */
755− } else {
756− /* No hwaddr for master yet, so
757− * set the slave's hwaddr to it
758− */
759− if (abi_ver < 1) {
760− /* For old ABI, the master needs to be
761− * down before setting its hwaddr
762− */
763− res = set_if_down(master_ifname, master_flags.ifr_flags);
764− if (res) {
765− fprintf(stderr,
766− "Master '%s': Error: bring interface "
767− "down failed\n",
768− master_ifname);
769− goto undo_mtu;
770− }
771− }
772−
773− res = set_master_hwaddr(master_ifname,
774− &(slave_hwaddr.ifr_hwaddr));
775− if (res) {
776− fprintf(stderr,
777− "Master '%s': Error: set hw address "
778− "failed\n",
779− master_ifname);
780− goto undo_mtu;
781− }
782−
783− if (abi_ver < 1) {
784− /* For old ABI, bring the master
785− * back up
786− */
787− res = set_if_up(master_ifname, master_flags.ifr_flags);
788− if (res) {
789− fprintf(stderr,
790− "Master '%s': Error: bring interface "
791− "up failed\n",
792− master_ifname);
793− goto undo_master_mac;
794− }
795− }
796−
797− hwaddr_set = 1;
798− }
799−
800− /* Do the real thing */
801− strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
802− strncpy(ifr.ifr_slave, slave_ifname, IFNAMSIZ);
803− if ((ioctl(skfd, SIOCBONDENSLAVE, &ifr) < 0) &&
804− (ioctl(skfd, BOND_ENSLAVE_OLD, &ifr) < 0)) {
805− saved_errno = errno;
806− v_print("Master '%s': Error: SIOCBONDENSLAVE failed: %s\n",
807− master_ifname, strerror(saved_errno));
808− res = 1;
809− }
810−
811− if (res) {
812− goto undo_master_mac;
813− }
814−
815− return 0;
816−
817−/* rollback (best effort) */
818−undo_master_mac:
819− set_master_hwaddr(master_ifname, &(master_hwaddr.ifr_hwaddr));
820− hwaddr_set = 0;
821− goto undo_mtu;
822−undo_slave_mac:
823− set_slave_hwaddr(slave_ifname, &(slave_hwaddr.ifr_hwaddr));
824−undo_mtu:
825− set_slave_mtu(slave_ifname, slave_mtu.ifr_mtu);
826− return res;
827−}
828−
829−static int release(char *master_ifname, char *slave_ifname)
830−{
831− struct ifreq ifr;
832− int res = 0;
833−
834− if (!(slave_flags.ifr_flags & IFF_SLAVE)) {
835− fprintf(stderr,
836− "Illegal operation: The specified slave interface "
837− "'%s' is not a slave\n",
838− slave_ifname);
839− return 1;
840− }
841−
842− strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
843− strncpy(ifr.ifr_slave, slave_ifname, IFNAMSIZ);
844− if ((ioctl(skfd, SIOCBONDRELEASE, &ifr) < 0) &&
845− (ioctl(skfd, BOND_RELEASE_OLD, &ifr) < 0)) {
846− saved_errno = errno;
847− v_print("Master '%s': Error: SIOCBONDRELEASE failed: %s\n",
848− master_ifname, strerror(saved_errno));
849− return 1;
850− } else if (abi_ver < 1) {
851− /* The driver is using an old ABI, so we'll set the interface
852− * down to avoid any conflicts due to same MAC/IP
853− */
854− res = set_if_down(slave_ifname, slave_flags.ifr_flags);
855− if (res) {
856− fprintf(stderr,
857− "Slave '%s': Error: bring interface "
858− "down failed\n",
859− slave_ifname);
860− }
861− }
862−
863− /* set to default mtu */
864− set_slave_mtu(slave_ifname, 1500);
865−
866− return res;
867−}
868−
869−static int get_if_settings(char *ifname, struct dev_ifr ifra[])
870−{
871− int i;
872− int res = 0;
873−
874− for (i = 0; ifra[i].req_ifr; i++) {
875− strncpy(ifra[i].req_ifr->ifr_name, ifname, IFNAMSIZ);
876− res = ioctl(skfd, ifra[i].req_type, ifra[i].req_ifr);
877− if (res < 0) {
878− saved_errno = errno;
879− v_print("Interface '%s': Error: %s failed: %s\n",
880− ifname, ifra[i].req_name,
881− strerror(saved_errno));
882−
883− return saved_errno;
884− }
885− }
886−
887− return 0;
888−}
889−
890−static int get_slave_flags(char *slave_ifname)
891−{
892− int res = 0;
893−
894− strncpy(slave_flags.ifr_name, slave_ifname, IFNAMSIZ);
895− res = ioctl(skfd, SIOCGIFFLAGS, &slave_flags);
896− if (res < 0) {
897− saved_errno = errno;
898− v_print("Slave '%s': Error: SIOCGIFFLAGS failed: %s\n",
899− slave_ifname, strerror(saved_errno));
900− } else {
901− v_print("Slave %s: flags %04X.\n",
902− slave_ifname, slave_flags.ifr_flags);
903− }
904−
905− return res;
906−}
907−
908−static int set_master_hwaddr(char *master_ifname, struct sockaddr *hwaddr)
909−{
910− unsigned char *addr = (unsigned char *)hwaddr->sa_data;
911− struct ifreq ifr;
912− int res = 0;
913−
914− strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
915− memcpy(&(ifr.ifr_hwaddr), hwaddr, sizeof(struct sockaddr));
916− res = ioctl(skfd, SIOCSIFHWADDR, &ifr);
917− if (res < 0) {
918− saved_errno = errno;
919− v_print("Master '%s': Error: SIOCSIFHWADDR failed: %s\n",
920− master_ifname, strerror(saved_errno));
921− return res;
922− } else {
923− v_print("Master '%s': hardware address set to "
924− "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n",
925− master_ifname, addr[0], addr[1], addr[2],
926− addr[3], addr[4], addr[5]);
927− }
928−
929− return res;
930−}
931−
932−static int set_slave_hwaddr(char *slave_ifname, struct sockaddr *hwaddr)
933−{
934− unsigned char *addr = (unsigned char *)hwaddr->sa_data;
935− struct ifreq ifr;
936− int res = 0;
937−
938− strncpy(ifr.ifr_name, slave_ifname, IFNAMSIZ);
939− memcpy(&(ifr.ifr_hwaddr), hwaddr, sizeof(struct sockaddr));
940− res = ioctl(skfd, SIOCSIFHWADDR, &ifr);
941− if (res < 0) {
942− saved_errno = errno;
943−
944− v_print("Slave '%s': Error: SIOCSIFHWADDR failed: %s\n",
945− slave_ifname, strerror(saved_errno));
946−
947− if (saved_errno == EBUSY) {
948− v_print(" The device is busy: it must be idle "
949− "before running this command.\n");
950− } else if (saved_errno == EOPNOTSUPP) {
951− v_print(" The device does not support setting "
952− "the MAC address.\n"
953− " Your kernel likely does not support slave "
954− "devices.\n");
955− } else if (saved_errno == EINVAL) {
956− v_print(" The device's address type does not match "
957− "the master's address type.\n");
958− }
959− return res;
960− } else {
961− v_print("Slave '%s': hardware address set to "
962− "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n",
963− slave_ifname, addr[0], addr[1], addr[2],
964− addr[3], addr[4], addr[5]);
965− }
966−
967− return res;
968−}
969−
970−static int set_slave_mtu(char *slave_ifname, int mtu)
971−{
972− struct ifreq ifr;
973− int res = 0;
974−
975− ifr.ifr_mtu = mtu;
976− strncpy(ifr.ifr_name, slave_ifname, IFNAMSIZ);
977−
978− res = ioctl(skfd, SIOCSIFMTU, &ifr);
979− if (res < 0) {
980− saved_errno = errno;
981− v_print("Slave '%s': Error: SIOCSIFMTU failed: %s\n",
982− slave_ifname, strerror(saved_errno));
983− } else {
984− v_print("Slave '%s': MTU set to %d.\n", slave_ifname, mtu);
985− }
986−
987− return res;
988−}
989−
990−static int set_if_flags(char *ifname, short flags)
991−{
992− struct ifreq ifr;
993− int res = 0;
994−
995− ifr.ifr_flags = flags;
996− strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
997−
998− res = ioctl(skfd, SIOCSIFFLAGS, &ifr);
999− if (res < 0) {
1000− saved_errno = errno;
1001− v_print("Interface '%s': Error: SIOCSIFFLAGS failed: %s\n",
1002− ifname, strerror(saved_errno));
1003− } else {
1004− v_print("Interface '%s': flags set to %04X.\n", ifname, flags);
1005− }
1006−
1007− return res;
1008−}
1009−
1010−static int set_if_up(char *ifname, short flags)
1011−{
1012− return set_if_flags(ifname, flags | IFF_UP);
1013−}
1014−
1015−static int set_if_down(char *ifname, short flags)
1016−{
1017− return set_if_flags(ifname, flags & ~IFF_UP);
1018−}
1019−
1020−static int clear_if_addr(char *ifname)
1021−{
1022− struct ifreq ifr;
1023− int res = 0;
1024−
1025− strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
1026− ifr.ifr_addr.sa_family = AF_INET;
1027− memset(ifr.ifr_addr.sa_data, 0, sizeof(ifr.ifr_addr.sa_data));
1028−
1029− res = ioctl(skfd, SIOCSIFADDR, &ifr);
1030− if (res < 0) {
1031− saved_errno = errno;
1032− v_print("Interface '%s': Error: SIOCSIFADDR failed: %s\n",
1033− ifname, strerror(saved_errno));
1034− } else {
1035− v_print("Interface '%s': address cleared\n", ifname);
1036− }
1037−
1038− return res;
1039−}
1040−
1041−static int set_if_addr(char *master_ifname, char *slave_ifname)
1042−{
1043− struct ifreq ifr;
1044− int res;
1045− unsigned char *ipaddr;
1046− int i;
1047− struct {
1048− char *req_name;
1049− char *desc;
1050− int g_ioctl;
1051− int s_ioctl;
1052− } ifra[] = {
1053− {"IFADDR", "addr", SIOCGIFADDR, SIOCSIFADDR},
1054− {"DSTADDR", "destination addr", SIOCGIFDSTADDR, SIOCSIFDSTADDR},
1055− {"BRDADDR", "broadcast addr", SIOCGIFBRDADDR, SIOCSIFBRDADDR},
1056− {"NETMASK", "netmask", SIOCGIFNETMASK, SIOCSIFNETMASK},
1057− {NULL, NULL, 0, 0},
1058− };
1059−
1060− for (i = 0; ifra[i].req_name; i++) {
1061− strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
1062− res = ioctl(skfd, ifra[i].g_ioctl, &ifr);
1063− if (res < 0) {
1064− int saved_errno = errno;
1065−
1066− v_print("Interface '%s': Error: SIOCG%s failed: %s\n",
1067− master_ifname, ifra[i].req_name,
1068− strerror(saved_errno));
1069−
1070− ifr.ifr_addr.sa_family = AF_INET;
1071− memset(ifr.ifr_addr.sa_data, 0,
1072− sizeof(ifr.ifr_addr.sa_data));
1073− }
1074−
1075− strncpy(ifr.ifr_name, slave_ifname, IFNAMSIZ);
1076− res = ioctl(skfd, ifra[i].s_ioctl, &ifr);
1077− if (res < 0) {
1078− int saved_errno = errno;
1079−
1080− v_print("Interface '%s': Error: SIOCS%s failed: %s\n",
1081− slave_ifname, ifra[i].req_name,
1082− strerror(saved_errno));
1083−
1084− }
1085−
1086− ipaddr = (unsigned char *)ifr.ifr_addr.sa_data;
1087− v_print("Interface '%s': set IP %s to %d.%d.%d.%d\n",
1088− slave_ifname, ifra[i].desc,
1089− ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
1090− }
1091−
1092− return 0;
1093−}
1094−
1095−/*
1096− * Local variables:
1097− * version-control: t
1098− * kept-new-versions: 5
1099− * c-indent-level: 4
1100− * c-basic-offset: 4
1101− * tab-width: 4
1102− * compile-command: "gcc -Wall -Wstrict-prototypes -O -I/usr/src/linux/include ifenslave.c -o ifenslave"
1103− * End:
1104− */
1105−
Documentation/networking/ip-sysctl.txt+10−1
@@ -685,6 +685,15 @@ ip_dynaddr - BOOLEAN · 684 unmodified lines
685685 occurs.
686686 Default: 0
687687
688+ip_early_demux - BOOLEAN
689+ Optimize input packet processing down to one demux for
690+ certain kinds of local sockets. Currently we only do this
691+ for established TCP sockets.
692+
693+ It may add an additional cost for pure routing workloads that
694+ reduces overall throughput, in such case you should disable it.
695+ Default: 1
696+
688697 icmp_echo_ignore_all - BOOLEAN
689698 If set non-zero, then the kernel will ignore all ICMP ECHO
690699 requests sent to it.
@@ -729,7 +738,7 @@ icmp_ignore_bogus_error_responses - BOOLEAN · 38 unmodified lines
729738 frames. Such violations are normally logged via a kernel warning.
730739 If this is set to TRUE, the kernel will not give such warnings, which
731740 will avoid log file clutter.
732− Default: FALSE
741+ Default: 1
733742
734743 icmp_errors_use_inbound_ifaddr - BOOLEAN
735744
Documentation/networking/ipvs-sysctl.txt+13−0
@@ -181,6 +181,19 @@ snat_reroute - BOOLEAN · 180 unmodified lines
181181 always be the same as the original route so it is an optimisation
182182 to disable snat_reroute and avoid the recalculation.
183183
184+sync_persist_mode - INTEGER
185+ default 0
186+
187+ Controls the synchronisation of connections when using persistence
188+
189+ 0: All types of connections are synchronised
190+ 1: Attempt to reduce the synchronisation traffic depending on
191+ the connection type. For persistent services avoid synchronisation
192+ for normal connections, do it only for persistence templates.
193+ In such case, for TCP and SCTP it may need enabling sloppy_tcp and
194+ sloppy_sctp flags on backup servers. For non-persistent services
195+ such optimization is not applied, mode 0 is assumed.
196+
184197 sync_version - INTEGER
185198 default 1
186199
Documentation/networking/netlink_mmap.txt+3−3
@@ -114,7 +114,7 @@ Some parameters are constrained, specifically: · 113 unmodified lines
114114 - nm_frame_nr must equal the actual number of frames as specified above.
115115
116116 When the kernel can't allocate physically continuous memory for a ring block,
117−it will fall back to use physically discontinous memory. This might affect
117+it will fall back to use physically discontinuous memory. This might affect
118118 performance negatively, in order to avoid this the nm_frame_size parameter
119119 should be chosen to be as small as possible for the required frame size and
120120 the number of blocks should be increased instead.
@@ -274,9 +274,9 @@ This example assumes some ring parameters of the ring setup are available. · 153 unmodified lines
274274 /* Get next frame header */
275275 hdr = rx_ring + frame_offset;
276276
277− if (hdr->nm_status == NL_MMAP_STATUS_VALID)
277+ if (hdr->nm_status == NL_MMAP_STATUS_VALID) {
278278 /* Regular memory mapped frame */
279− nlh = (void *hdr) + NL_MMAP_HDRLEN;
279+ nlh = (void *)hdr + NL_MMAP_HDRLEN;
280280 len = hdr->nm_len;
281281
282282 /* Release empty message immediately. May happen
Documentation/networking/packet_mmap.txt+28−105
@@ -704,6 +704,12 @@ So it seems to be a good candidate to be used with packet fanout. · 703 unmodified lines
704704 Minimal example code by Daniel Borkmann based on Chetan Loke's lolpcap (compile
705705 it with gcc -Wall -O2 blob.c, and try things like "./a.out eth0", etc.):
706706
707+/* Written from scratch, but kernel-to-user space API usage
708+ * dissected from lolpcap:
709+ * Copyright 2011, Chetan Loke <loke.chetan@gmail.com>
710+ * License: GPL, version 2.0
711+ */
712+
707713 #include <stdio.h>
708714 #include <stdlib.h>
709715 #include <stdint.h>
@@ -722,27 +728,6 @@ it with gcc -Wall -O2 blob.c, and try things like "./a.out eth0", etc.): · 12 unmodified lines
722728 #include <linux/if_ether.h>
723729 #include <linux/ip.h>
724730
725−#define BLOCK_SIZE (1 << 22)
726−#define FRAME_SIZE 2048
727−
728−#define NUM_BLOCKS 64
729−#define NUM_FRAMES ((BLOCK_SIZE * NUM_BLOCKS) / FRAME_SIZE)
730−
731−#define BLOCK_RETIRE_TOV_IN_MS 64
732−#define BLOCK_PRIV_AREA_SZ 13
733−
734−#define ALIGN_8(x) (((x) + 8 - 1) & ~(8 - 1))
735−
736−#define BLOCK_STATUS(x) ((x)->h1.block_status)
737−#define BLOCK_NUM_PKTS(x) ((x)->h1.num_pkts)
738−#define BLOCK_O2FP(x) ((x)->h1.offset_to_first_pkt)
739−#define BLOCK_LEN(x) ((x)->h1.blk_len)
740−#define BLOCK_SNUM(x) ((x)->h1.seq_num)
741−#define BLOCK_O2PRIV(x) ((x)->offset_to_priv)
742−#define BLOCK_PRIV(x) ((void *) ((uint8_t *) (x) + BLOCK_O2PRIV(x)))
743−#define BLOCK_HDR_LEN (ALIGN_8(sizeof(struct block_desc)))
744−#define BLOCK_PLUS_PRIV(sz_pri) (BLOCK_HDR_LEN + ALIGN_8((sz_pri)))
745−
746731 #ifndef likely
747732 # define likely(x) __builtin_expect(!!(x), 1)
748733 #endif
@@ -765,7 +750,7 @@ struct ring { · 16 unmodified lines
765750 static unsigned long packets_total = 0, bytes_total = 0;
766751 static sig_atomic_t sigint = 0;
767752
768−void sighandler(int num)
753+static void sighandler(int num)
769754 {
770755 sigint = 1;
771756 }
@@ -774,6 +759,8 @@ static int setup_socket(struct ring *ring, char *netdev) · 2 unmodified lines
774759 {
775760 int err, i, fd, v = TPACKET_V3;
776761 struct sockaddr_ll ll;
762+ unsigned int blocksiz = 1 << 22, framesiz = 1 << 11;
763+ unsigned int blocknum = 64;
777764
778765 fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
779766 if (fd < 0) {
@@ -788,13 +775,12 @@ static int setup_socket(struct ring *ring, char *netdev) · 8 unmodified lines
788775 }
789776
790777 memset(&ring->req, 0, sizeof(ring->req));
791− ring->req.tp_block_size = BLOCK_SIZE;
792− ring->req.tp_frame_size = FRAME_SIZE;
793− ring->req.tp_block_nr = NUM_BLOCKS;
794− ring->req.tp_frame_nr = NUM_FRAMES;
795− ring->req.tp_retire_blk_tov = BLOCK_RETIRE_TOV_IN_MS;
796− ring->req.tp_sizeof_priv = BLOCK_PRIV_AREA_SZ;
797− ring->req.tp_feature_req_word |= TP_FT_REQ_FILL_RXHASH;
778+ ring->req.tp_block_size = blocksiz;
779+ ring->req.tp_frame_size = framesiz;
780+ ring->req.tp_block_nr = blocknum;
781+ ring->req.tp_frame_nr = (blocksiz * blocknum) / framesiz;
782+ ring->req.tp_retire_blk_tov = 60;
783+ ring->req.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH;
798784
799785 err = setsockopt(fd, SOL_PACKET, PACKET_RX_RING, &ring->req,
800786 sizeof(ring->req));
@@ -804,8 +790,7 @@ static int setup_socket(struct ring *ring, char *netdev) · 3 unmodified lines
804790 }
805791
806792 ring->map = mmap(NULL, ring->req.tp_block_size * ring->req.tp_block_nr,
807− PROT_READ | PROT_WRITE, MAP_SHARED | MAP_LOCKED,
808− fd, 0);
793+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_LOCKED, fd, 0);
809794 if (ring->map == MAP_FAILED) {
810795 perror("mmap");
811796 exit(1);
@@ -835,58 +820,6 @@ static int setup_socket(struct ring *ring, char *netdev) · 23 unmodified lines
835820 return fd;
836821 }
837822
838−#ifdef __checked
839−static uint64_t prev_block_seq_num = 0;
840−
841−void assert_block_seq_num(struct block_desc *pbd)
842−{
843− if (unlikely(prev_block_seq_num + 1 != BLOCK_SNUM(pbd))) {
844− printf("prev_block_seq_num:%"PRIu64", expected seq:%"PRIu64" != "
845− "actual seq:%"PRIu64"\n", prev_block_seq_num,
846− prev_block_seq_num + 1, (uint64_t) BLOCK_SNUM(pbd));
847− exit(1);
848− }
849−
850− prev_block_seq_num = BLOCK_SNUM(pbd);
851−}
852−
853−static void assert_block_len(struct block_desc *pbd, uint32_t bytes, int block_num)
854−{
855− if (BLOCK_NUM_PKTS(pbd)) {
856− if (unlikely(bytes != BLOCK_LEN(pbd))) {
857− printf("block:%u with %upackets, expected len:%u != actual len:%u\n",
858− block_num, BLOCK_NUM_PKTS(pbd), bytes, BLOCK_LEN(pbd));
859− exit(1);
860− }
861− } else {
862− if (unlikely(BLOCK_LEN(pbd) != BLOCK_PLUS_PRIV(BLOCK_PRIV_AREA_SZ))) {
863− printf("block:%u, expected len:%lu != actual len:%u\n",
864− block_num, BLOCK_HDR_LEN, BLOCK_LEN(pbd));
865− exit(1);
866− }
867− }
868−}
869−
870−static void assert_block_header(struct block_desc *pbd, const int block_num)
871−{
872− uint32_t block_status = BLOCK_STATUS(pbd);
873−
874− if (unlikely((block_status & TP_STATUS_USER) == 0)) {
875− printf("block:%u, not in TP_STATUS_USER\n", block_num);
876− exit(1);
877− }
878−
879− assert_block_seq_num(pbd);
880−}
881−#else
882−static inline void assert_block_header(struct block_desc *pbd, const int block_num)
883−{
884−}
885−static void assert_block_len(struct block_desc *pbd, uint32_t bytes, int block_num)
886−{
887−}
888−#endif
889−
890823 static void display(struct tpacket3_hdr *ppd)
891824 {
892825 struct ethhdr *eth = (struct ethhdr *) ((uint8_t *) ppd + ppd->tp_mac);
@@ -916,37 +849,27 @@ static void display(struct tpacket3_hdr *ppd) · 23 unmodified lines
916849
917850 static void walk_block(struct block_desc *pbd, const int block_num)
918851 {
919− int num_pkts = BLOCK_NUM_PKTS(pbd), i;
852+ int num_pkts = pbd->h1.num_pkts, i;
920853 unsigned long bytes = 0;
921− unsigned long bytes_with_padding = BLOCK_PLUS_PRIV(BLOCK_PRIV_AREA_SZ);
922854 struct tpacket3_hdr *ppd;
923855
924− assert_block_header(pbd, block_num);
925−
926− ppd = (struct tpacket3_hdr *) ((uint8_t *) pbd + BLOCK_O2FP(pbd));
856+ ppd = (struct tpacket3_hdr *) ((uint8_t *) pbd +
857+ pbd->h1.offset_to_first_pkt);
927858 for (i = 0; i < num_pkts; ++i) {
928859 bytes += ppd->tp_snaplen;
929− if (ppd->tp_next_offset)
930− bytes_with_padding += ppd->tp_next_offset;
931− else
932− bytes_with_padding += ALIGN_8(ppd->tp_snaplen + ppd->tp_mac);
933−
934860 display(ppd);
935861
936− ppd = (struct tpacket3_hdr *) ((uint8_t *) ppd + ppd->tp_next_offset);
937− __sync_synchronize();
862+ ppd = (struct tpacket3_hdr *) ((uint8_t *) ppd +
863+ ppd->tp_next_offset);
938864 }
939865
940− assert_block_len(pbd, bytes_with_padding, block_num);
941−
942866 packets_total += num_pkts;
943867 bytes_total += bytes;
944868 }
945869
946−void flush_block(struct block_desc *pbd)
870+static void flush_block(struct block_desc *pbd)
947871 {
948− BLOCK_STATUS(pbd) = TP_STATUS_KERNEL;
949− __sync_synchronize();
872+ pbd->h1.block_status = TP_STATUS_KERNEL;
950873 }
951874
952875 static void teardown_socket(struct ring *ring, int fd)
@@ -962,7 +885,7 @@ int main(int argc, char **argp) · 9 unmodified lines
962885 socklen_t len;
963886 struct ring ring;
964887 struct pollfd pfd;
965− unsigned int block_num = 0;
888+ unsigned int block_num = 0, blocks = 64;
966889 struct block_desc *pbd;
967890 struct tpacket_stats_v3 stats;
968891
@@ -984,15 +907,15 @@ int main(int argc, char **argp) · 15 unmodified lines
984907
985908 while (likely(!sigint)) {
986909 pbd = (struct block_desc *) ring.rd[block_num].iov_base;
987−retry_block:
988− if ((BLOCK_STATUS(pbd) & TP_STATUS_USER) == 0) {
910+
911+ if ((pbd->h1.block_status & TP_STATUS_USER) == 0) {
989912 poll(&pfd, 1, -1);
990− goto retry_block;
913+ continue;
991914 }
992915
993916 walk_block(pbd, block_num);
994917 flush_block(pbd);
995− block_num = (block_num + 1) % NUM_BLOCKS;
918+ block_num = (block_num + 1) % blocks;
996919 }
997920
998921 len = sizeof(stats);
Documentation/networking/scaling.txt+58−0
@@ -163,6 +163,64 @@ and unnecessary. If there are fewer hardware queues than CPUs, then · 162 unmodified lines
163163 RPS might be beneficial if the rps_cpus for each queue are the ones that
164164 share the same memory domain as the interrupting CPU for that queue.
165165
166+==== RPS Flow Limit
167+
168+RPS scales kernel receive processing across CPUs without introducing
169+reordering. The trade-off to sending all packets from the same flow
170+to the same CPU is CPU load imbalance if flows vary in packet rate.
171+In the extreme case a single flow dominates traffic. Especially on
172+common server workloads with many concurrent connections, such
173+behavior indicates a problem such as a misconfiguration or spoofed
174+source Denial of Service attack.
175+
176+Flow Limit is an optional RPS feature that prioritizes small flows
177+during CPU contention by dropping packets from large flows slightly
178+ahead of those from small flows. It is active only when an RPS or RFS
179+destination CPU approaches saturation. Once a CPU's input packet
180+queue exceeds half the maximum queue length (as set by sysctl
181+net.core.netdev_max_backlog), the kernel starts a per-flow packet
182+count over the last 256 packets. If a flow exceeds a set ratio (by
183+default, half) of these packets when a new packet arrives, then the
184+new packet is dropped. Packets from other flows are still only
185+dropped once the input packet queue reaches netdev_max_backlog.
186+No packets are dropped when the input packet queue length is below
187+the threshold, so flow limit does not sever connections outright:
188+even large flows maintain connectivity.
189+
190+== Interface
191+
192+Flow limit is compiled in by default (CONFIG_NET_FLOW_LIMIT), but not
193+turned on. It is implemented for each CPU independently (to avoid lock
194+and cache contention) and toggled per CPU by setting the relevant bit
195+in sysctl net.core.flow_limit_cpu_bitmap. It exposes the same CPU
196+bitmap interface as rps_cpus (see above) when called from procfs:
197+
198+ /proc/sys/net/core/flow_limit_cpu_bitmap
199+
200+Per-flow rate is calculated by hashing each packet into a hashtable
201+bucket and incrementing a per-bucket counter. The hash function is
202+the same that selects a CPU in RPS, but as the number of buckets can
203+be much larger than the number of CPUs, flow limit has finer-grained
204+identification of large flows and fewer false positives. The default
205+table has 4096 buckets. This value can be modified through sysctl
206+
207+ net.core.flow_limit_table_len
208+
209+The value is only consulted when a new table is allocated. Modifying
210+it does not update active tables.
211+
212+== Suggested Configuration
213+
214+Flow limit is useful on systems with many concurrent connections,
215+where a single connection taking up 50% of a CPU indicates a problem.
216+In such environments, enable the feature on all CPUs that handle
217+network rx interrupts (as set in /proc/irq/N/smp_affinity).
218+
219+The feature depends on the input packet queue length to exceed
220+the flow limit threshold (50%) + the flow history length (256).
221+Setting net.core.netdev_max_backlog to either 1000 or 10000
222+performed well in experiments.
223+
166224
167225 RFS: Receive Flow Steering
168226 ==========================
Documentation/networking/vortex.txt+1−1
@@ -359,7 +359,7 @@ steps you should take: · 358 unmodified lines
359359 - OK, it's a driver problem.
360360
361361 You need to generate a report. Typically this is an email to the
362− maintainer and/or linux-net@vger.kernel.org. The maintainer's
362+ maintainer and/or netdev@vger.kernel.org. The maintainer's
363363 email address will be in the driver source or in the MAINTAINERS file.
364364
365365 - The contents of your report will vary a lot depending upon the
Documentation/printk-formats.txt+32−0
@@ -121,6 +121,38 @@ IPv6 addresses: · 120 unmodified lines
121121 print a compressed IPv6 address as described by
122122 http://tools.ietf.org/html/rfc5952
123123
124+IPv4/IPv6 addresses (generic, with port, flowinfo, scope):
125+
126+ %pIS 1.2.3.4 or 0001:0002:0003:0004:0005:0006:0007:0008
127+ %piS 001.002.003.004 or 00010002000300040005000600070008
128+ %pISc 1.2.3.4 or 1:2:3:4:5:6:7:8
129+ %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345
130+ %p[Ii]S[pfschnbl]
131+
132+ For printing an IP address without the need to distinguish whether it's
133+ of type AF_INET or AF_INET6, a pointer to a valid 'struct sockaddr',
134+ specified through 'IS' or 'iS', can be passed to this format specifier.
135+
136+ The additional 'p', 'f', and 's' specifiers are used to specify port
137+ (IPv4, IPv6), flowinfo (IPv6) and scope (IPv6). Ports have a ':' prefix,
138+ flowinfo a '/' and scope a '%', each followed by the actual value.
139+
140+ In case of an IPv6 address the compressed IPv6 address as described by
141+ http://tools.ietf.org/html/rfc5952 is being used if the additional
142+ specifier 'c' is given. The IPv6 address is surrounded by '[', ']' in
143+ case of additional specifiers 'p', 'f' or 's' as suggested by
144+ https://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-07
145+
146+ In case of IPv4 addresses, the additional 'h', 'n', 'b', and 'l'
147+ specifiers can be used as well and are ignored in case of an IPv6
148+ address.
149+
150+ Further examples:
151+
152+ %pISfc 1.2.3.4 or [1:2:3:4:5:6:7:8]/123456789
153+ %pISsc 1.2.3.4 or [1:2:3:4:5:6:7:8]%1234567890
154+ %pISpfc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345/123456789
155+
124156 UUID/GUID addresses:
125157
126158 %pUb 00010203-0405-0607-0809-0a0b0c0d0e0f
Documentation/sysctl/net.txt+40−3
@@ -26,7 +26,7 @@ Table : Subdirectories in /proc/sys/net · 25 unmodified lines
2626 ipv4 IP version 4 x25 X.25 protocol
2727 ipx IPX token-ring IBM token ring
2828 bridge Bridging decnet DEC net
29− ipv6 IP version 6
29+ ipv6 IP version 6 tipc TIPC
3030 ..............................................................................
3131
3232 1. /proc/sys/net/core - Network core options
@@ -50,6 +50,29 @@ The maximum number of packets that kernel can handle on a NAPI interrupt, · 17 unmodified lines
5050 it's a Per-CPU variable.
5151 Default: 64
5252
53+low_latency_read
54+----------------
55+Low latency busy poll timeout for socket reads. (needs CONFIG_NET_LL_RX_POLL)
56+Approximate time in us to busy loop waiting for packets on the device queue.
57+This sets the default value of the SO_LL socket option.
58+Can be set or overridden per socket by setting socket option SO_LL, which is
59+the preferred method of enabling.
60+If you need to enable the feature globally via sysctl, a value of 50 is recommended.
61+Will increase power usage.
62+Default: 0 (off)
63+
64+low_latency_poll
65+----------------
66+Low latency busy poll timeout for poll and select. (needs CONFIG_NET_LL_RX_POLL)
67+Approximate time in us to busy loop waiting for events.
68+Recommended value depends on the number of sockets you poll on.
69+For several sockets 50, for several hundreds 100.
70+For more than that you probably want to use epoll.
71+Note that only sockets with SO_LL set will be busy polled, so you want to either
72+selectively set SO_LL on those sockets or set sysctl.net.low_latency_read globally.
73+Will increase power usage.
74+Default: 0 (off)
75+
5376 rmem_default
5477 ------------
5578
@@ -93,8 +116,7 @@ netdev_budget · 37 unmodified lines
93116
94117 Maximum number of packets taken from all interfaces in one polling cycle (NAPI
95118 poll). In one polling cycle interfaces which are registered to polling are
96−probed in a round-robin manner. The limit of packets in one such probe can be
97−set per-device via sysfs class/net/<device>/weight .
119+probed in a round-robin manner.
98120
99121 netdev_max_backlog
100122 ------------------
@@ -201,3 +223,18 @@ IPX. · 100 unmodified lines
201223 The /proc/net/ipx_route table holds a list of IPX routes. For each route it
202224 gives the destination network, the router node (or Directly) and the network
203225 address of the router (or Connected) for internal networks.
226+
227+6. TIPC
228+-------------------------------------------------------
229+
230+The TIPC protocol now has a tunable for the receive memory, similar to the
231+tcp_rmem - i.e. a vector of 3 INTEGERs: (min, default, max)
232+
233+ # cat /proc/sys/net/tipc/tipc_rmem
234+ 4252725 34021800 68043600
235+ #
236+
237+The max value is set to CONN_OVERLOAD_LIMIT, and the default and min values
238+are scaled (shifted) versions of that same value. Note that the min value
239+is not at this point in time used in any meaningful way, but the triplet is
240+preserved in order to be consistent with things like tcp_rmem.
MAINTAINERS+5−0
@@ -2332,6 +2332,11 @@ M: Jaya Kumar <jayakumar.alsa@gmail.com> · 2331 unmodified lines
23322332 S: Maintained
23332333 F: sound/pci/cs5535audio/
23342334
2335+CW1200 WLAN driver
2336+M: Solomon Peachy <pizza@shaftnet.org>
2337+S: Maintained
2338+F: drivers/net/wireless/cw1200/
2339+
23352340 CX18 VIDEO4LINUX DRIVER
23362341 M: Andy Walls <awalls@md.metrocast.net>
23372342 L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers)
arch/alpha/include/uapi/asm/socket.h+2−0
@@ -81,4 +81,6 @@ · 80 unmodified lines
8181
8282 #define SO_SELECT_ERR_QUEUE 45
8383
84+#define SO_LL 46
85+
8486 #endif /* _UAPI_ASM_SOCKET_H */
arch/arm/boot/dts/am335x-bone.dts+2−0
@@ -214,10 +214,12 @@ · 213 unmodified lines
214214
215215 &cpsw_emac0 {
216216 phy_id = <&davinci_mdio>, <0>;
217+ phy-mode = "mii";
217218 };
218219
219220 &cpsw_emac1 {
220221 phy_id = <&davinci_mdio>, <1>;
222+ phy-mode = "mii";
221223 };
222224
223225 &mac {
arch/arm/boot/dts/am335x-evm.dts+2−0
@@ -467,8 +467,10 @@ · 466 unmodified lines
467467
468468 &cpsw_emac0 {
469469 phy_id = <&davinci_mdio>, <0>;
470+ phy-mode = "rgmii-txid";
470471 };
471472
472473 &cpsw_emac1 {
473474 phy_id = <&davinci_mdio>, <1>;
475+ phy-mode = "rgmii-txid";
474476 };
arch/arm/boot/dts/am335x-evmsk.dts+10−0
@@ -392,3 +392,13 @@ · 391 unmodified lines
392392 pinctrl-0 = <&davinci_mdio_default>;
393393 pinctrl-1 = <&davinci_mdio_sleep>;
394394 };
395+
396+&cpsw_emac0 {
397+ phy_id = <&davinci_mdio>, <0>;
398+ phy-mode = "rgmii-txid";
399+};
400+
401+&cpsw_emac1 {
402+ phy_id = <&davinci_mdio>, <1>;
403+ phy-mode = "rgmii-txid";
404+};
arch/arm/boot/dts/imx28-evk.dts+12−0
@@ -155,12 +155,14 @@ · 154 unmodified lines
155155 can0: can@80032000 {
156156 pinctrl-names = "default";
157157 pinctrl-0 = <&can0_pins_a>;
158+ xceiver-supply = <&reg_can_3v3>;
158159 status = "okay";
159160 };
160161
161162 can1: can@80034000 {
162163 pinctrl-names = "default";
163164 pinctrl-0 = <&can1_pins_a>;
165+ xceiver-supply = <&reg_can_3v3>;
164166 status = "okay";
165167 };
166168 };
@@ -319,6 +321,16 @@ · 152 unmodified lines
319321 gpio = <&gpio3 30 0>;
320322 enable-active-high;
321323 };
324+
325+ reg_can_3v3: can-3v3 {
326+ compatible = "regulator-fixed";
327+ regulator-name = "can-3v3";
328+ regulator-min-microvolt = <3300000>;
329+ regulator-max-microvolt = <3300000>;
330+ gpio = <&gpio2 13 0>;
331+ enable-active-high;
332+ };
333+
322334 };
323335
324336 sound {
arch/arm/boot/dts/sun4i-a10-cubieboard.dts+15−0
@@ -27,6 +27,21 @@ · 26 unmodified lines
2727 };
2828
2929 soc@01c20000 {
30+ emac: ethernet@01c0b000 {
31+ pinctrl-names = "default";
32+ pinctrl-0 = <&emac_pins_a>;
33+ phy = <&phy1>;
34+ status = "okay";
35+ };
36+
37+ mdio@01c0b080 {
38+ status = "okay";
39+
40+ phy1: ethernet-phy@1 {
41+ reg = <1>;
42+ };
43+ };
44+
3045 pinctrl@01c20800 {
3146 led_pins_cubieboard: led_pins@0 {
3247 allwinner,pins = "PH20", "PH21";
arch/arm/boot/dts/sun4i-a10-hackberry.dts+41−0
@@ -23,10 +23,51 @@ · 22 unmodified lines
2323 };
2424
2525 soc@01c20000 {
26+ emac: ethernet@01c0b000 {
27+ pinctrl-names = "default";
28+ pinctrl-0 = <&emac_pins_a>;
29+ phy = <&phy0>;
30+ status = "okay";
31+ };
32+
33+ mdio@01c0b080 {
34+ phy-supply = <&reg_emac_3v3>;
35+ status = "okay";
36+
37+ phy0: ethernet-phy@0 {
38+ reg = <0>;
39+ };
40+ };
41+
42+ pio: pinctrl@01c20800 {
43+ pinctrl-names = "default";
44+ pinctrl-0 = <&hackberry_hogs>;
45+
46+ hackberry_hogs: hogs@0 {
47+ allwinner,pins = "PH19";
48+ allwinner,function = "gpio_out";
49+ allwinner,drive = <0>;
50+ allwinner,pull = <0>;
51+ };
52+ };
53+
2654 uart0: serial@01c28000 {
2755 pinctrl-names = "default";
2856 pinctrl-0 = <&uart0_pins_a>;
2957 status = "okay";
3058 };
3159 };
60+
61+ regulators {
62+ compatible = "simple-bus";
63+
64+ reg_emac_3v3: emac-3v3 {
65+ compatible = "regulator-fixed";
66+ regulator-name = "emac-3v3";
67+ regulator-min-microvolt = <3300000>;
68+ regulator-max-microvolt = <3300000>;
69+ enable-active-high;
70+ gpio = <&pio 7 19 0>;
71+ };
72+ };
3273 };
arch/arm/boot/dts/sun4i-a10.dtsi+27−0
@@ -167,6 +167,22 @@ · 166 unmodified lines
167167 reg = <0x01c20000 0x300000>;
168168 ranges;
169169
170+ emac: ethernet@01c0b000 {
171+ compatible = "allwinner,sun4i-emac";
172+ reg = <0x01c0b000 0x1000>;
173+ interrupts = <55>;
174+ clocks = <&ahb_gates 17>;
175+ status = "disabled";
176+ };
177+
178+ mdio@01c0b080 {
179+ compatible = "allwinner,sun4i-mdio";
180+ reg = <0x01c0b080 0x14>;
181+ status = "disabled";
182+ #address-cells = <1>;
183+ #size-cells = <0>;
184+ };
185+
170186 intc: interrupt-controller@01c20400 {
171187 compatible = "allwinner,sun4i-ic";
172188 reg = <0x01c20400 0x400>;
@@ -226,6 +242,17 @@ · 53 unmodified lines
226242 allwinner,drive = <0>;
227243 allwinner,pull = <0>;
228244 };
245+
246+ emac_pins_a: emac0@0 {
247+ allwinner,pins = "PA0", "PA1", "PA2",
248+ "PA3", "PA4", "PA5", "PA6",
249+ "PA7", "PA8", "PA9", "PA10",
250+ "PA11", "PA12", "PA13", "PA14",
251+ "PA15", "PA16";
252+ allwinner,function = "emac";
253+ allwinner,drive = <0>;
254+ allwinner,pull = <0>;
255+ };
229256 };
230257
231258 timer@01c20c00 {
arch/arm/configs/omap2plus_defconfig+1−0
@@ -286,3 +286,4 @@ CONFIG_SOC_OMAP5=y · 285 unmodified lines
286286 CONFIG_TI_DAVINCI_MDIO=y
287287 CONFIG_TI_DAVINCI_CPDMA=y
288288 CONFIG_TI_CPSW=y
289+CONFIG_AT803X_PHY=y
arch/arm/mach-imx/Kconfig+0−4
@@ -108,7 +108,6 @@ config SOC_IMX25 · 107 unmodified lines
108108 select ARCH_MXC_IOMUX_V3
109109 select COMMON_CLK
110110 select CPU_ARM926T
111− select HAVE_CAN_FLEXCAN if CAN
112111 select MXC_AVIC
113112
114113 config SOC_IMX27
@@ -134,7 +133,6 @@ config SOC_IMX35 · 19 unmodified lines
134133 select ARCH_MXC_IOMUX_V3
135134 select COMMON_CLK
136135 select CPU_V6K
137− select HAVE_CAN_FLEXCAN if CAN
138136 select HAVE_EPIT
139137 select MXC_AVIC
140138 select SMP_ON_UP if SMP
@@ -774,7 +772,6 @@ comment "Device tree only" · 633 unmodified lines
774772
775773 config SOC_IMX53
776774 bool "i.MX53 support"
777− select HAVE_CAN_FLEXCAN if CAN
778775 select HAVE_IMX_SRC
779776 select IMX_HAVE_PLATFORM_IMX2_WDT
780777 select PINCTRL
@@ -797,7 +794,6 @@ config SOC_IMX6Q · 16 unmodified lines
797794 select CPU_V7
798795 select HAVE_ARM_SCU if SMP
799796 select HAVE_ARM_TWD if LOCAL_TIMERS
800− select HAVE_CAN_FLEXCAN if CAN
801797 select HAVE_IMX_ANATOP
802798 select HAVE_IMX_GPC
803799 select HAVE_IMX_MMDC
arch/arm/mach-imx/devices-imx25.h+4−4
@@ -13,10 +13,10 @@ extern const struct imx_fec_data imx25_fec_data; · 12 unmodified lines
1313 imx_add_fec(&imx25_fec_data, pdata)
1414
1515 extern const struct imx_flexcan_data imx25_flexcan_data[];
16−#define imx25_add_flexcan(id, pdata) \
17− imx_add_flexcan(&imx25_flexcan_data[id], pdata)
18−#define imx25_add_flexcan0(pdata) imx25_add_flexcan(0, pdata)
19−#define imx25_add_flexcan1(pdata) imx25_add_flexcan(1, pdata)
16+#define imx25_add_flexcan(id) \
17+ imx_add_flexcan(&imx25_flexcan_data[id])
18+#define imx25_add_flexcan0() imx25_add_flexcan(0)
19+#define imx25_add_flexcan1() imx25_add_flexcan(1)
2020
2121 extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data;
2222 #define imx25_add_fsl_usb2_udc(pdata) \
arch/arm/mach-imx/devices-imx35.h+4−4
@@ -17,10 +17,10 @@ extern const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data; · 16 unmodified lines
1717 imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata)
1818
1919 extern const struct imx_flexcan_data imx35_flexcan_data[];
20−#define imx35_add_flexcan(id, pdata) \
21− imx_add_flexcan(&imx35_flexcan_data[id], pdata)
22−#define imx35_add_flexcan0(pdata) imx35_add_flexcan(0, pdata)
23−#define imx35_add_flexcan1(pdata) imx35_add_flexcan(1, pdata)
20+#define imx35_add_flexcan(id) \
21+ imx_add_flexcan(&imx35_flexcan_data[id])
22+#define imx35_add_flexcan0() imx35_add_flexcan(0)
23+#define imx35_add_flexcan1() imx35_add_flexcan(1)
2424
2525 extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data;
2626 #define imx35_add_imx2_wdt() \
arch/arm/mach-imx/devices/Kconfig+0−1
@@ -4,7 +4,6 @@ config IMX_HAVE_PLATFORM_FEC · 3 unmodified lines
44
55 config IMX_HAVE_PLATFORM_FLEXCAN
66 bool
7− select HAVE_CAN_FLEXCAN if CAN
87
98 config IMX_HAVE_PLATFORM_FSL_USB2_UDC
109 bool
arch/arm/mach-imx/devices/devices-common.h+1−3
@@ -50,7 +50,6 @@ struct platform_device *__init imx_add_fec( · 49 unmodified lines
5050 const struct imx_fec_data *data,
5151 const struct fec_platform_data *pdata);
5252
53−#include <linux/can/platform/flexcan.h>
5453 struct imx_flexcan_data {
5554 int id;
5655 resource_size_t iobase;
@@ -58,8 +57,7 @@ struct imx_flexcan_data { · 1 unmodified line
5857 resource_size_t irq;
5958 };
6059 struct platform_device *__init imx_add_flexcan(
61− const struct imx_flexcan_data *data,
62− const struct flexcan_platform_data *pdata);
60+ const struct imx_flexcan_data *data);
6361
6462 #include <linux/fsl_devices.h>
6563 struct imx_fsl_usb2_udc_data {
arch/arm/mach-imx/devices/platform-flexcan.c+2−3
@@ -38,8 +38,7 @@ const struct imx_flexcan_data imx35_flexcan_data[] __initconst = { · 37 unmodified lines
3838 #endif /* ifdef CONFIG_SOC_IMX35 */
3939
4040 struct platform_device *__init imx_add_flexcan(
41− const struct imx_flexcan_data *data,
42− const struct flexcan_platform_data *pdata)
41+ const struct imx_flexcan_data *data)
4342 {
4443 struct resource res[] = {
4544 {
@@ -54,5 +53,5 @@ struct platform_device *__init imx_add_flexcan( · 8 unmodified lines
5453 };
5554
5655 return imx_add_platform_device("flexcan", data->id,
57− res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
56+ res, ARRAY_SIZE(res), NULL, 0);
5857 }
arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c+1−1
@@ -279,7 +279,7 @@ void __init eukrea_mbimxsd25_baseboard_init(void) · 278 unmodified lines
279279 imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata);
280280 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
281281
282− imx25_add_flexcan1(NULL);
282+ imx25_add_flexcan1();
283283 imx25_add_sdhci_esdhc_imx(0, &sd1_pdata);
284284
285285 gpio_request(GPIO_LED1, "LED1");
arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c+1−1
@@ -287,7 +287,7 @@ void __init eukrea_mbimxsd35_baseboard_init(void) · 286 unmodified lines
287287
288288 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
289289
290− imx35_add_flexcan1(NULL);
290+ imx35_add_flexcan1();
291291 imx35_add_sdhci_esdhc_imx(0, &sd1_pdata);
292292
293293 gpio_request(GPIO_LED1, "LED1");
arch/arm/mach-imx/mach-mx25_3ds.c+1−1
@@ -249,7 +249,7 @@ static void __init mx25pdk_init(void) · 248 unmodified lines
249249 imx25_add_imx_i2c0(&mx25_3ds_i2c0_data);
250250
251251 gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn");
252− imx25_add_flexcan0(NULL);
252+ imx25_add_flexcan0();
253253 }
254254
255255 static void __init mx25pdk_timer_init(void)
arch/arm/mach-imx/mach-pcm043.c+1−1
@@ -385,7 +385,7 @@ static void __init pcm043_init(void) · 384 unmodified lines
385385 if (!otg_mode_host)
386386 imx35_add_fsl_usb2_udc(&otg_device_pdata);
387387
388− imx35_add_flexcan1(NULL);
388+ imx35_add_flexcan1();
389389 imx35_add_sdhci_esdhc_imx(0, &sd1_pdata);
390390 }
391391
arch/arm/mach-mxs/Kconfig+0−1
@@ -10,7 +10,6 @@ config SOC_IMX28 · 9 unmodified lines
1010 select ARM_AMBA
1111 select ARM_CPU_SUSPEND if PM
1212 select CPU_ARM926T
13− select HAVE_CAN_FLEXCAN if CAN
1413 select PINCTRL_IMX28
1514
1615 config ARCH_MXS
arch/arm/mach-mxs/mach-mxs.c+1−49
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 #include <linux/clk/mxs.h>
1515 #include <linux/clkdev.h>
1616 #include <linux/clocksource.h>
17−#include <linux/can/platform/flexcan.h>
1817 #include <linux/delay.h>
1918 #include <linux/err.h>
2019 #include <linux/gpio.h>
@@ -77,41 +76,6 @@ static inline void __mxs_togl(u32 mask, void __iomem *reg) · 56 unmodified lines
7776 __raw_writel(mask, reg + MXS_TOG_ADDR);
7877 }
7978
80−/*
81− * MX28EVK_FLEXCAN_SWITCH is shared between both flexcan controllers
82− */
83−#define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13)
84−
85−static int flexcan0_en, flexcan1_en;
86−
87−static void mx28evk_flexcan_switch(void)
88−{
89− if (flexcan0_en || flexcan1_en)
90− gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 1);
91− else
92− gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 0);
93−}
94−
95−static void mx28evk_flexcan0_switch(int enable)
96−{
97− flexcan0_en = enable;
98− mx28evk_flexcan_switch();
99−}
100−
101−static void mx28evk_flexcan1_switch(int enable)
102−{
103− flexcan1_en = enable;
104− mx28evk_flexcan_switch();
105−}
106−
107−static struct flexcan_platform_data flexcan_pdata[2];
108−
109−static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
110− OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80032000, NULL, &flexcan_pdata[0]),
111− OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80034000, NULL, &flexcan_pdata[1]),
112− { /* sentinel */ }
113−};
114−
11579 #define OCOTP_WORD_OFFSET 0x20
11680 #define OCOTP_WORD_COUNT 0x20
11781
@@ -271,15 +235,6 @@ static void __init imx28_evk_init(void) · 153 unmodified lines
271235 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
272236 }
273237
274−static void __init imx28_evk_post_init(void)
275−{
276− if (!gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT,
277− "flexcan-switch")) {
278− flexcan_pdata[0].transceiver_switch = mx28evk_flexcan0_switch;
279− flexcan_pdata[1].transceiver_switch = mx28evk_flexcan1_switch;
280− }
281−}
282−
283238 static int apx4devkit_phy_fixup(struct phy_device *phy)
284239 {
285240 phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
@@ -485,13 +440,10 @@ static void __init mxs_machine_init(void) · 199 unmodified lines
485440 crystalfontz_init();
486441
487442 of_platform_populate(NULL, of_default_bus_match_table,
488− mxs_auxdata_lookup, parent);
443+ NULL, parent);
489444
490445 if (of_machine_is_compatible("karo,tx28"))
491446 tx28_post_init();
492−
493− if (of_machine_is_compatible("fsl,imx28-evk"))
494− imx28_evk_post_init();
495447 }
496448
497449 #define MX23_CLKCTRL_RESET_OFFSET 0x120
arch/arm/mach-shmobile/board-armadillo800eva.c+1−1
@@ -378,7 +378,7 @@ static struct resource sh_eth_resources[] = { · 377 unmodified lines
378378 };
379379
380380 static struct platform_device sh_eth_device = {
381− .name = "sh-eth",
381+ .name = "r8a7740-gether",
382382 .id = -1,
383383 .dev = {
384384 .platform_data = &sh_eth_platdata,
arch/arm/mach-shmobile/clock-r8a7740.c+1−1
@@ -594,7 +594,7 @@ static struct clk_lookup lookups[] = { · 593 unmodified lines
594594 CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]),
595595 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
596596 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]),
597− CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]),
597+ CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]),
598598 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]),
599599 CLKDEV_DEV_ID("renesas_tpu_pwm", &mstp_clks[MSTP304]),
600600
arch/arm/mach-shmobile/clock-r8a7778.c+1−1
@@ -145,7 +145,7 @@ static struct clk_lookup lookups[] = { · 144 unmodified lines
145145 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
146146 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
147147 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
148− CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */
148+ CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
149149 CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
150150 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
151151 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
arch/arm/mach-shmobile/clock-r8a7779.c+1−1
@@ -165,7 +165,7 @@ static struct clk_lookup lookups[] = { · 164 unmodified lines
165165 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
166166 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
167167 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
168− CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */
168+ CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
169169 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
170170 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
171171 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
arch/arm/net/bpf_jit_32.c+3−15
@@ -900,8 +900,7 @@ void bpf_jit_compile(struct sk_filter *fp) · 899 unmodified lines
900900 #endif
901901
902902 alloc_size = 4 * ctx.idx;
903− ctx.target = module_alloc(max(sizeof(struct work_struct),
904− alloc_size));
903+ ctx.target = module_alloc(alloc_size);
905904 if (unlikely(ctx.target == NULL))
906905 goto out;
907906
@@ -927,19 +926,8 @@ out: · 19 unmodified lines
927926 return;
928927 }
929928
930−static void bpf_jit_free_worker(struct work_struct *work)
931−{
932− module_free(NULL, work);
933−}
934−
935929 void bpf_jit_free(struct sk_filter *fp)
936930 {
937− struct work_struct *work;
938−
939− if (fp->bpf_func != sk_run_filter) {
940− work = (struct work_struct *)fp->bpf_func;
941−
942− INIT_WORK(work, bpf_jit_free_worker);
943− schedule_work(work);
944− }
931+ if (fp->bpf_func != sk_run_filter)
932+ module_free(NULL, fp->bpf_func);
945933 }
arch/avr32/include/uapi/asm/socket.h+2−0
@@ -74,4 +74,6 @@ · 73 unmodified lines
7474
7575 #define SO_SELECT_ERR_QUEUE 45
7676
77+#define SO_LL 46
78+
7779 #endif /* __ASM_AVR32_SOCKET_H */
arch/cris/arch-v10/drivers/Kconfig+1−3
@@ -2,9 +2,7 @@ if ETRAX_ARCH_V10 · 1 unmodified line
22
33 config ETRAX_ETHERNET
44 bool "Ethernet support"
5− depends on ETRAX_ARCH_V10
6− select ETHERNET
7− select NET_CORE
5+ depends on ETRAX_ARCH_V10 && NETDEVICES
86 select MII
97 help
108 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
arch/cris/arch-v32/drivers/Kconfig+1−3
@@ -2,9 +2,7 @@ if ETRAX_ARCH_V32 · 1 unmodified line
22
33 config ETRAX_ETHERNET
44 bool "Ethernet support"
5− depends on ETRAX_ARCH_V32
6− select ETHERNET
7− select NET_CORE
5+ depends on ETRAX_ARCH_V32 && NETDEVICES
86 select MII
97 help
108 This option enables the ETRAX FS built-in 10/100Mbit Ethernet
arch/cris/include/uapi/asm/socket.h+2−0
@@ -76,6 +76,8 @@ · 75 unmodified lines
7676
7777 #define SO_SELECT_ERR_QUEUE 45
7878
79+#define SO_LL 46
80+
7981 #endif /* _ASM_SOCKET_H */
8082
8183
arch/frv/include/uapi/asm/socket.h+2−0
@@ -74,5 +74,7 @@ · 73 unmodified lines
7474
7575 #define SO_SELECT_ERR_QUEUE 45
7676
77+#define SO_LL 46
78+
7779 #endif /* _ASM_SOCKET_H */
7880
arch/h8300/include/uapi/asm/socket.h+2−0
@@ -74,4 +74,6 @@ · 73 unmodified lines
7474
7575 #define SO_SELECT_ERR_QUEUE 45
7676
77+#define SO_LL 46
78+
7779 #endif /* _ASM_SOCKET_H */
arch/ia64/hp/sim/simeth.c+1−1
@@ -268,7 +268,7 @@ static __inline__ int dev_is_ethdev(struct net_device *dev) · 267 unmodified lines
268268 static int
269269 simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
270270 {
271− struct net_device *dev = ptr;
271+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
272272 struct simeth_local *local;
273273 struct in_device *in_dev;
274274 struct in_ifaddr **ifap = NULL;
arch/ia64/include/uapi/asm/socket.h+2−0
@@ -83,4 +83,6 @@ · 82 unmodified lines
8383
8484 #define SO_SELECT_ERR_QUEUE 45
8585
86+#define SO_LL 46
87+
8688 #endif /* _ASM_IA64_SOCKET_H */
arch/m32r/include/uapi/asm/socket.h+2−0
@@ -74,4 +74,6 @@ · 73 unmodified lines
7474
7575 #define SO_SELECT_ERR_QUEUE 45
7676
77+#define SO_LL 46
78+
7779 #endif /* _ASM_M32R_SOCKET_H */
arch/mips/bcm63xx/boards/board_bcm963xx.c+4−0
@@ -845,6 +845,10 @@ int __init board_register_devices(void) · 844 unmodified lines
845845 !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr))
846846 bcm63xx_enet_register(1, &board.enet1);
847847
848+ if (board.has_enetsw &&
849+ !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr))
850+ bcm63xx_enetsw_register(&board.enetsw);
851+
848852 if (board.has_usbd)
849853 bcm63xx_usbd_register(&board.usbd);
850854
arch/mips/bcm63xx/dev-enet.c+167−14
@@ -9,16 +9,60 @@ · 8 unmodified lines
99 #include <linux/init.h>
1010 #include <linux/kernel.h>
1111 #include <linux/platform_device.h>
12+#include <linux/export.h>
1213 #include <bcm63xx_dev_enet.h>
1314 #include <bcm63xx_io.h>
1415 #include <bcm63xx_regs.h>
1516
17+#ifdef BCMCPU_RUNTIME_DETECT
18+static const unsigned long bcm6348_regs_enetdmac[] = {
19+ [ENETDMAC_CHANCFG] = ENETDMAC_CHANCFG_REG,
20+ [ENETDMAC_IR] = ENETDMAC_IR_REG,
21+ [ENETDMAC_IRMASK] = ENETDMAC_IRMASK_REG,
22+ [ENETDMAC_MAXBURST] = ENETDMAC_MAXBURST_REG,
23+};
24+
25+static const unsigned long bcm6345_regs_enetdmac[] = {
26+ [ENETDMAC_CHANCFG] = ENETDMA_6345_CHANCFG_REG,
27+ [ENETDMAC_IR] = ENETDMA_6345_IR_REG,
28+ [ENETDMAC_IRMASK] = ENETDMA_6345_IRMASK_REG,
29+ [ENETDMAC_MAXBURST] = ENETDMA_6345_MAXBURST_REG,
30+ [ENETDMAC_BUFALLOC] = ENETDMA_6345_BUFALLOC_REG,
31+ [ENETDMAC_RSTART] = ENETDMA_6345_RSTART_REG,
32+ [ENETDMAC_FC] = ENETDMA_6345_FC_REG,
33+ [ENETDMAC_LEN] = ENETDMA_6345_LEN_REG,
34+};
35+
36+const unsigned long *bcm63xx_regs_enetdmac;
37+EXPORT_SYMBOL(bcm63xx_regs_enetdmac);
38+
39+static __init void bcm63xx_enetdmac_regs_init(void)
40+{
41+ if (BCMCPU_IS_6345())
42+ bcm63xx_regs_enetdmac = bcm6345_regs_enetdmac;
43+ else
44+ bcm63xx_regs_enetdmac = bcm6348_regs_enetdmac;
45+}
46+#else
47+static __init void bcm63xx_enetdmac_regs_init(void) { }
48+#endif
49+
1650 static struct resource shared_res[] = {
1751 {
1852 .start = -1, /* filled at runtime */
1953 .end = -1, /* filled at runtime */
2054 .flags = IORESOURCE_MEM,
2155 },
56+ {
57+ .start = -1, /* filled at runtime */
58+ .end = -1, /* filled at runtime */
59+ .flags = IORESOURCE_MEM,
60+ },
61+ {
62+ .start = -1, /* filled at runtime */
63+ .end = -1, /* filled at runtime */
64+ .flags = IORESOURCE_MEM,
65+ },
2266 };
2367
2468 static struct platform_device bcm63xx_enet_shared_device = {
@@ -94,6 +138,71 @@ static struct platform_device bcm63xx_enet1_device = { · 69 unmodified lines
94138 },
95139 };
96140
141+static struct resource enetsw_res[] = {
142+ {
143+ /* start & end filled at runtime */
144+ .flags = IORESOURCE_MEM,
145+ },
146+ {
147+ /* start filled at runtime */
148+ .flags = IORESOURCE_IRQ,
149+ },
150+ {
151+ /* start filled at runtime */
152+ .flags = IORESOURCE_IRQ,
153+ },
154+};
155+
156+static struct bcm63xx_enetsw_platform_data enetsw_pd;
157+
158+static struct platform_device bcm63xx_enetsw_device = {
159+ .name = "bcm63xx_enetsw",
160+ .num_resources = ARRAY_SIZE(enetsw_res),
161+ .resource = enetsw_res,
162+ .dev = {
163+ .platform_data = &enetsw_pd,
164+ },
165+};
166+
167+static int __init register_shared(void)
168+{
169+ int ret, chan_count;
170+
171+ if (shared_device_registered)
172+ return 0;
173+
174+ bcm63xx_enetdmac_regs_init();
175+
176+ shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA);
177+ shared_res[0].end = shared_res[0].start;
178+ if (BCMCPU_IS_6345())
179+ shared_res[0].end += (RSET_6345_ENETDMA_SIZE) - 1;
180+ else
181+ shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
182+
183+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
184+ chan_count = 32;
185+ else if (BCMCPU_IS_6345())
186+ chan_count = 8;
187+ else
188+ chan_count = 16;
189+
190+ shared_res[1].start = bcm63xx_regset_address(RSET_ENETDMAC);
191+ shared_res[1].end = shared_res[1].start;
192+ shared_res[1].end += RSET_ENETDMAC_SIZE(chan_count) - 1;
193+
194+ shared_res[2].start = bcm63xx_regset_address(RSET_ENETDMAS);
195+ shared_res[2].end = shared_res[2].start;
196+ shared_res[2].end += RSET_ENETDMAS_SIZE(chan_count) - 1;
197+
198+ ret = platform_device_register(&bcm63xx_enet_shared_device);
199+ if (ret)
200+ return ret;
201+ shared_device_registered = 1;
202+
203+ return 0;
204+}
205+
97206 int __init bcm63xx_enet_register(int unit,
98207 const struct bcm63xx_enet_platform_data *pd)
99208 {
@@ -104,22 +213,12 @@ int __init bcm63xx_enet_register(int unit, · 4 unmodified lines
104213 if (unit > 1)
105214 return -ENODEV;
106215
107− if (unit == 1 && BCMCPU_IS_6338())
216+ if (unit == 1 && (BCMCPU_IS_6338() || BCMCPU_IS_6345()))
108217 return -ENODEV;
109218
110− if (!shared_device_registered) {
111− shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA);
112− shared_res[0].end = shared_res[0].start;
113− if (BCMCPU_IS_6338())
114− shared_res[0].end += (RSET_ENETDMA_SIZE / 2) - 1;
115− else
116− shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
117−
118− ret = platform_device_register(&bcm63xx_enet_shared_device);
119− if (ret)
120− return ret;
121− shared_device_registered = 1;
122− }
219+ ret = register_shared();
220+ if (ret)
221+ return ret;
123222
124223 if (unit == 0) {
125224 enet0_res[0].start = bcm63xx_regset_address(RSET_ENET0);
@@ -155,8 +254,62 @@ int __init bcm63xx_enet_register(int unit, · 29 unmodified lines
155254 dpd->phy_interrupt = bcm63xx_get_irq_number(IRQ_ENET_PHY);
156255 }
157256
257+ dpd->dma_chan_en_mask = ENETDMAC_CHANCFG_EN_MASK;
258+ dpd->dma_chan_int_mask = ENETDMAC_IR_PKTDONE_MASK;
259+ if (BCMCPU_IS_6345()) {
260+ dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_CHAINING_MASK;
261+ dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_WRAP_EN_MASK;
262+ dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_FLOWC_EN_MASK;
263+ dpd->dma_chan_int_mask |= ENETDMA_IR_BUFDONE_MASK;
264+ dpd->dma_chan_int_mask |= ENETDMA_IR_NOTOWNER_MASK;
265+ dpd->dma_chan_width = ENETDMA_6345_CHAN_WIDTH;
266+ dpd->dma_desc_shift = ENETDMA_6345_DESC_SHIFT;
267+ } else {
268+ dpd->dma_has_sram = true;
269+ dpd->dma_chan_width = ENETDMA_CHAN_WIDTH;
270+ }
271+
158272 ret = platform_device_register(pdev);
159273 if (ret)
160274 return ret;
161275 return 0;
162276 }
277+
278+int __init
279+bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd)
280+{
281+ int ret;
282+
283+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
284+ return -ENODEV;
285+
286+ ret = register_shared();
287+ if (ret)
288+ return ret;
289+
290+ enetsw_res[0].start = bcm63xx_regset_address(RSET_ENETSW);
291+ enetsw_res[0].end = enetsw_res[0].start;
292+ enetsw_res[0].end += RSET_ENETSW_SIZE - 1;
293+ enetsw_res[1].start = bcm63xx_get_irq_number(IRQ_ENETSW_RXDMA0);
294+ enetsw_res[2].start = bcm63xx_get_irq_number(IRQ_ENETSW_TXDMA0);
295+ if (!enetsw_res[2].start)
296+ enetsw_res[2].start = -1;
297+
298+ memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd));
299+
300+ if (BCMCPU_IS_6328())
301+ enetsw_pd.num_ports = ENETSW_PORTS_6328;
302+ else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
303+ enetsw_pd.num_ports = ENETSW_PORTS_6368;
304+
305+ enetsw_pd.dma_has_sram = true;
306+ enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH;
307+ enetsw_pd.dma_chan_en_mask = ENETDMAC_CHANCFG_EN_MASK;
308+ enetsw_pd.dma_chan_int_mask = ENETDMAC_IR_PKTDONE_MASK;
309+
310+ ret = platform_device_register(&bcm63xx_enetsw_device);
311+ if (ret)
312+ return ret;
313+
314+ return 0;
315+}
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h+5−2
@@ -173,7 +173,10 @@ enum bcm63xx_regs_set { · 172 unmodified lines
173173 #define BCM_6358_RSET_SPI_SIZE 1804
174174 #define BCM_6368_RSET_SPI_SIZE 1804
175175 #define RSET_ENET_SIZE 2048
176−#define RSET_ENETDMA_SIZE 2048
176+#define RSET_ENETDMA_SIZE 256
177+#define RSET_6345_ENETDMA_SIZE 64
178+#define RSET_ENETDMAC_SIZE(chans) (16 * (chans))
179+#define RSET_ENETDMAS_SIZE(chans) (16 * (chans))
177180 #define RSET_ENETSW_SIZE 65536
178181 #define RSET_UART_SIZE 24
179182 #define RSET_UDC_SIZE 256
@@ -298,7 +301,7 @@ enum bcm63xx_regs_set { · 118 unmodified lines
298301 #define BCM_6345_USBDMA_BASE (0xfffe2800)
299302 #define BCM_6345_ENET0_BASE (0xfffe1800)
300303 #define BCM_6345_ENETDMA_BASE (0xfffe2800)
301−#define BCM_6345_ENETDMAC_BASE (0xfffe2900)
304+#define BCM_6345_ENETDMAC_BASE (0xfffe2840)
302305 #define BCM_6345_ENETDMAS_BASE (0xfffe2a00)
303306 #define BCM_6345_ENETSW_BASE (0xdeadbeef)
304307 #define BCM_6345_PCMCIA_BASE (0xfffe2028)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h+122−0
@@ -4,6 +4,8 @@ · 3 unmodified lines
44 #include <linux/if_ether.h>
55 #include <linux/init.h>
66
7+#include <bcm63xx_regs.h>
8+
79 /*
810 * on board ethernet platform data
911 */
@@ -37,9 +39,129 @@ struct bcm63xx_enet_platform_data { · 27 unmodified lines
3739 int phy_id, int reg),
3840 void (*mii_write)(struct net_device *dev,
3941 int phy_id, int reg, int val));
42+
43+ /* DMA channel enable mask */
44+ u32 dma_chan_en_mask;
45+
46+ /* DMA channel interrupt mask */
47+ u32 dma_chan_int_mask;
48+
49+ /* DMA engine has internal SRAM */
50+ bool dma_has_sram;
51+
52+ /* DMA channel register width */
53+ unsigned int dma_chan_width;
54+
55+ /* DMA descriptor shift */
56+ unsigned int dma_desc_shift;
57+};
58+
59+/*
60+ * on board ethernet switch platform data
61+ */
62+#define ENETSW_MAX_PORT 8
63+#define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
64+#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
65+
66+#define ENETSW_RGMII_PORT0 4
67+
68+struct bcm63xx_enetsw_port {
69+ int used;
70+ int phy_id;
71+
72+ int bypass_link;
73+ int force_speed;
74+ int force_duplex_full;
75+
76+ const char *name;
77+};
78+
79+struct bcm63xx_enetsw_platform_data {
80+ char mac_addr[ETH_ALEN];
81+ int num_ports;
82+ struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
83+
84+ /* DMA channel enable mask */
85+ u32 dma_chan_en_mask;
86+
87+ /* DMA channel interrupt mask */
88+ u32 dma_chan_int_mask;
89+
90+ /* DMA channel register width */
91+ unsigned int dma_chan_width;
92+
93+ /* DMA engine has internal SRAM */
94+ bool dma_has_sram;
4095 };
4196
4297 int __init bcm63xx_enet_register(int unit,
4398 const struct bcm63xx_enet_platform_data *pd);
4499
100+int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
101+
102+enum bcm63xx_regs_enetdmac {
103+ ENETDMAC_CHANCFG,
104+ ENETDMAC_IR,
105+ ENETDMAC_IRMASK,
106+ ENETDMAC_MAXBURST,
107+ ENETDMAC_BUFALLOC,
108+ ENETDMAC_RSTART,
109+ ENETDMAC_FC,
110+ ENETDMAC_LEN,
111+};
112+
113+static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
114+{
115+#ifdef BCMCPU_RUNTIME_DETECT
116+ extern const unsigned long *bcm63xx_regs_enetdmac;
117+
118+ return bcm63xx_regs_enetdmac[reg];
119+#else
120+#ifdef CONFIG_BCM63XX_CPU_6345
121+ switch (reg) {
122+ case ENETDMAC_CHANCFG:
123+ return ENETDMA_6345_CHANCFG_REG;
124+ case ENETDMAC_IR:
125+ return ENETDMA_6345_IR_REG;
126+ case ENETDMAC_IRMASK:
127+ return ENETDMA_6345_IRMASK_REG;
128+ case ENETDMAC_MAXBURST:
129+ return ENETDMA_6345_MAXBURST_REG;
130+ case ENETDMAC_BUFALLOC:
131+ return ENETDMA_6345_BUFALLOC_REG;
132+ case ENETDMAC_RSTART:
133+ return ENETDMA_6345_RSTART_REG;
134+ case ENETDMAC_FC:
135+ return ENETDMA_6345_FC_REG;
136+ case ENETDMAC_LEN:
137+ return ENETDMA_6345_LEN_REG;
138+ }
139+#endif
140+#if defined(CONFIG_BCM63XX_CPU_6328) || \
141+ defined(CONFIG_BCM63XX_CPU_6338) || \
142+ defined(CONFIG_BCM63XX_CPU_6348) || \
143+ defined(CONFIG_BCM63XX_CPU_6358) || \
144+ defined(CONFIG_BCM63XX_CPU_6362) || \
145+ defined(CONFIG_BCM63XX_CPU_6368)
146+ switch (reg) {
147+ case ENETDMAC_CHANCFG:
148+ return ENETDMAC_CHANCFG_REG;
149+ case ENETDMAC_IR:
150+ return ENETDMAC_IR_REG;
151+ case ENETDMAC_IRMASK:
152+ return ENETDMAC_IRMASK_REG;
153+ case ENETDMAC_MAXBURST:
154+ return ENETDMAC_MAXBURST_REG;
155+ case ENETDMAC_BUFALLOC:
156+ case ENETDMAC_RSTART:
157+ case ENETDMAC_FC:
158+ case ENETDMAC_LEN:
159+ return 0;
160+ }
161+#endif
162+#endif
163+ return 0;
164+}
165+
166+
45167 #endif /* ! BCM63XX_DEV_ENET_H_ */
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h+85−8
@@ -727,6 +727,8 @@ · 726 unmodified lines
727727 /*************************************************************************
728728 * _REG relative to RSET_ENETDMA
729729 *************************************************************************/
730+#define ENETDMA_CHAN_WIDTH 0x10
731+#define ENETDMA_6345_CHAN_WIDTH 0x40
730732
731733 /* Controller Configuration Register */
732734 #define ENETDMA_CFG_REG (0x0)
@@ -782,31 +784,56 @@ · 49 unmodified lines
782784 /* State Ram Word 4 */
783785 #define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10)
784786
787+/* Broadcom 6345 ENET DMA definitions */
788+#define ENETDMA_6345_CHANCFG_REG (0x00)
789+
790+#define ENETDMA_6345_MAXBURST_REG (0x40)
791+
792+#define ENETDMA_6345_RSTART_REG (0x08)
793+
794+#define ENETDMA_6345_LEN_REG (0x0C)
795+
796+#define ENETDMA_6345_IR_REG (0x14)
797+
798+#define ENETDMA_6345_IRMASK_REG (0x18)
799+
800+#define ENETDMA_6345_FC_REG (0x1C)
801+
802+#define ENETDMA_6345_BUFALLOC_REG (0x20)
803+
804+/* Shift down for EOP, SOP and WRAP bits */
805+#define ENETDMA_6345_DESC_SHIFT (3)
785806
786807 /*************************************************************************
787808 * _REG relative to RSET_ENETDMAC
788809 *************************************************************************/
789810
790811 /* Channel Configuration register */
791−#define ENETDMAC_CHANCFG_REG(x) ((x) * 0x10)
812+#define ENETDMAC_CHANCFG_REG (0x0)
792813 #define ENETDMAC_CHANCFG_EN_SHIFT 0
793814 #define ENETDMAC_CHANCFG_EN_MASK (1 << ENETDMAC_CHANCFG_EN_SHIFT)
794815 #define ENETDMAC_CHANCFG_PKTHALT_SHIFT 1
795816 #define ENETDMAC_CHANCFG_PKTHALT_MASK (1 << ENETDMAC_CHANCFG_PKTHALT_SHIFT)
796817 #define ENETDMAC_CHANCFG_BUFHALT_SHIFT 2
797818 #define ENETDMAC_CHANCFG_BUFHALT_MASK (1 << ENETDMAC_CHANCFG_BUFHALT_SHIFT)
819+#define ENETDMAC_CHANCFG_CHAINING_SHIFT 2
820+#define ENETDMAC_CHANCFG_CHAINING_MASK (1 << ENETDMAC_CHANCFG_CHAINING_SHIFT)
821+#define ENETDMAC_CHANCFG_WRAP_EN_SHIFT 3
822+#define ENETDMAC_CHANCFG_WRAP_EN_MASK (1 << ENETDMAC_CHANCFG_WRAP_EN_SHIFT)
823+#define ENETDMAC_CHANCFG_FLOWC_EN_SHIFT 4
824+#define ENETDMAC_CHANCFG_FLOWC_EN_MASK (1 << ENETDMAC_CHANCFG_FLOWC_EN_SHIFT)
798825
799826 /* Interrupt Control/Status register */
800−#define ENETDMAC_IR_REG(x) (0x4 + (x) * 0x10)
827+#define ENETDMAC_IR_REG (0x4)
801828 #define ENETDMAC_IR_BUFDONE_MASK (1 << 0)
802829 #define ENETDMAC_IR_PKTDONE_MASK (1 << 1)
803830 #define ENETDMAC_IR_NOTOWNER_MASK (1 << 2)
804831
805832 /* Interrupt Mask register */
806−#define ENETDMAC_IRMASK_REG(x) (0x8 + (x) * 0x10)
833+#define ENETDMAC_IRMASK_REG (0x8)
807834
808835 /* Maximum Burst Length */
809−#define ENETDMAC_MAXBURST_REG(x) (0xc + (x) * 0x10)
836+#define ENETDMAC_MAXBURST_REG (0xc)
810837
811838
812839 /*************************************************************************
@@ -814,26 +841,76 @@ · 1 unmodified line
814841 *************************************************************************/
815842
816843 /* Ring Start Address register */
817−#define ENETDMAS_RSTART_REG(x) ((x) * 0x10)
844+#define ENETDMAS_RSTART_REG (0x0)
818845
819846 /* State Ram Word 2 */
820−#define ENETDMAS_SRAM2_REG(x) (0x4 + (x) * 0x10)
847+#define ENETDMAS_SRAM2_REG (0x4)
821848
822849 /* State Ram Word 3 */
823−#define ENETDMAS_SRAM3_REG(x) (0x8 + (x) * 0x10)
850+#define ENETDMAS_SRAM3_REG (0x8)
824851
825852 /* State Ram Word 4 */
826−#define ENETDMAS_SRAM4_REG(x) (0xc + (x) * 0x10)
853+#define ENETDMAS_SRAM4_REG (0xc)
827854
828855
829856 /*************************************************************************
830857 * _REG relative to RSET_ENETSW
831858 *************************************************************************/
832859
860+/* Port traffic control */
861+#define ENETSW_PTCTRL_REG(x) (0x0 + (x))
862+#define ENETSW_PTCTRL_RXDIS_MASK (1 << 0)
863+#define ENETSW_PTCTRL_TXDIS_MASK (1 << 1)
864+
865+/* Switch mode register */
866+#define ENETSW_SWMODE_REG (0xb)
867+#define ENETSW_SWMODE_FWD_EN_MASK (1 << 1)
868+
869+/* IMP override Register */
870+#define ENETSW_IMPOV_REG (0xe)
871+#define ENETSW_IMPOV_FORCE_MASK (1 << 7)
872+#define ENETSW_IMPOV_TXFLOW_MASK (1 << 5)
873+#define ENETSW_IMPOV_RXFLOW_MASK (1 << 4)
874+#define ENETSW_IMPOV_1000_MASK (1 << 3)
875+#define ENETSW_IMPOV_100_MASK (1 << 2)
876+#define ENETSW_IMPOV_FDX_MASK (1 << 1)
877+#define ENETSW_IMPOV_LINKUP_MASK (1 << 0)
878+
879+/* Port override Register */
880+#define ENETSW_PORTOV_REG(x) (0x58 + (x))
881+#define ENETSW_PORTOV_ENABLE_MASK (1 << 6)
882+#define ENETSW_PORTOV_TXFLOW_MASK (1 << 5)
883+#define ENETSW_PORTOV_RXFLOW_MASK (1 << 4)
884+#define ENETSW_PORTOV_1000_MASK (1 << 3)
885+#define ENETSW_PORTOV_100_MASK (1 << 2)
886+#define ENETSW_PORTOV_FDX_MASK (1 << 1)
887+#define ENETSW_PORTOV_LINKUP_MASK (1 << 0)
888+
889+/* MDIO control register */
890+#define ENETSW_MDIOC_REG (0xb0)
891+#define ENETSW_MDIOC_EXT_MASK (1 << 16)
892+#define ENETSW_MDIOC_REG_SHIFT 20
893+#define ENETSW_MDIOC_PHYID_SHIFT 25
894+#define ENETSW_MDIOC_RD_MASK (1 << 30)
895+#define ENETSW_MDIOC_WR_MASK (1 << 31)
896+
897+/* MDIO data register */
898+#define ENETSW_MDIOD_REG (0xb4)
899+
900+/* Global Management Configuration Register */
901+#define ENETSW_GMCR_REG (0x200)
902+#define ENETSW_GMCR_RST_MIB_MASK (1 << 0)
903+
833904 /* MIB register */
834905 #define ENETSW_MIB_REG(x) (0x2800 + (x) * 4)
835906 #define ENETSW_MIB_REG_COUNT 47
836907
908+/* Jumbo control register port mask register */
909+#define ENETSW_JMBCTL_PORT_REG (0x4004)
910+
911+/* Jumbo control mib good frame register */
912+#define ENETSW_JMBCTL_MAXSIZE_REG (0x4008)
913+
837914
838915 /*************************************************************************
839916 * _REG relative to RSET_OHCI_PRIV
arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h+2−0
@@ -24,6 +24,7 @@ struct board_info { · 23 unmodified lines
2424 /* enabled feature/device */
2525 unsigned int has_enet0:1;
2626 unsigned int has_enet1:1;
27+ unsigned int has_enetsw:1;
2728 unsigned int has_pci:1;
2829 unsigned int has_pccard:1;
2930 unsigned int has_ohci0:1;
@@ -36,6 +37,7 @@ struct board_info { · 6 unmodified lines
3637 /* ethernet config */
3738 struct bcm63xx_enet_platform_data enet0;
3839 struct bcm63xx_enet_platform_data enet1;
40+ struct bcm63xx_enetsw_platform_data enetsw;
3941
4042 /* USB config */
4143 struct bcm63xx_usbd_platform_data usbd;
arch/mips/include/uapi/asm/socket.h+2−0
@@ -92,4 +92,6 @@ · 91 unmodified lines
9292
9393 #define SO_SELECT_ERR_QUEUE 45
9494
95+#define SO_LL 46
96+
9597 #endif /* _UAPI_ASM_SOCKET_H */
arch/mips/txx9/generic/setup_tx4939.c+2−1
@@ -331,7 +331,8 @@ static int tx4939_netdev_event(struct notifier_block *this, · 330 unmodified lines
331331 unsigned long event,
332332 void *ptr)
333333 {
334− struct net_device *dev = ptr;
334+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
335+
335336 if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) {
336337 __u64 bit = 0;
337338 if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0))
arch/mn10300/include/uapi/asm/socket.h+2−0
@@ -74,4 +74,6 @@ · 73 unmodified lines
7474
7575 #define SO_SELECT_ERR_QUEUE 45
7676
77+#define SO_LL 46
78+
7779 #endif /* _ASM_SOCKET_H */
arch/parisc/include/uapi/asm/socket.h+2−0
@@ -73,6 +73,8 @@ · 72 unmodified lines
7373
7474 #define SO_SELECT_ERR_QUEUE 0x4026
7575
76+#define SO_LL 0x4027
77+
7678 /* O_NONBLOCK clashes with the bits used for socket types. Therefore we
7779 * have to define SOCK_NONBLOCK to a different value here.
7880 */
arch/powerpc/Kconfig+0−1
@@ -668,7 +668,6 @@ config SBUS · 667 unmodified lines
668668
669669 config FSL_SOC
670670 bool
671− select HAVE_CAN_FLEXCAN if NET && CAN
672671
673672 config FSL_PCI
674673 bool
arch/powerpc/include/uapi/asm/socket.h+2−0
@@ -81,4 +81,6 @@ · 80 unmodified lines
8181
8282 #define SO_SELECT_ERR_QUEUE 45
8383
84+#define SO_LL 46
85+
8486 #endif /* _ASM_POWERPC_SOCKET_H */
arch/powerpc/net/bpf_jit_comp.c+3−16
@@ -650,8 +650,7 @@ void bpf_jit_compile(struct sk_filter *fp) · 649 unmodified lines
650650
651651 proglen = cgctx.idx * 4;
652652 alloclen = proglen + FUNCTION_DESCR_SIZE;
653− image = module_alloc(max_t(unsigned int, alloclen,
654− sizeof(struct work_struct)));
653+ image = module_alloc(alloclen);
655654 if (!image)
656655 goto out;
657656
@@ -688,20 +687,8 @@ out: · 30 unmodified lines
688687 return;
689688 }
690689
691−static void jit_free_defer(struct work_struct *arg)
692−{
693− module_free(NULL, arg);
694−}
695−
696−/* run from softirq, we must use a work_struct to call
697− * module_free() from process context
698− */
699690 void bpf_jit_free(struct sk_filter *fp)
700691 {
701− if (fp->bpf_func != sk_run_filter) {
702− struct work_struct *work = (struct work_struct *)fp->bpf_func;
703−
704− INIT_WORK(work, jit_free_defer);
705− schedule_work(work);
706− }
692+ if (fp->bpf_func != sk_run_filter)
693+ module_free(NULL, fp->bpf_func);
707694 }
arch/s390/include/uapi/asm/socket.h+2−0
@@ -80,4 +80,6 @@ · 79 unmodified lines
8080
8181 #define SO_SELECT_ERR_QUEUE 45
8282
83+#define SO_LL 46
84+
8385 #endif /* _ASM_SOCKET_H */
arch/sh/boards/board-espt.c+1−1
@@ -85,7 +85,7 @@ static struct sh_eth_plat_data sh7763_eth_pdata = { · 84 unmodified lines
8585 };
8686
8787 static struct platform_device espt_eth_device = {
88− .name = "sh-eth",
88+ .name = "sh7763-gether",
8989 .resource = sh_eth_resources,
9090 .num_resources = ARRAY_SIZE(sh_eth_resources),
9191 .dev = {
arch/sh/boards/board-sh7757lcr.c+4−4
@@ -82,7 +82,7 @@ static struct sh_eth_plat_data sh7757_eth0_pdata = { · 81 unmodified lines
8282 };
8383
8484 static struct platform_device sh7757_eth0_device = {
85− .name = "sh-eth",
85+ .name = "sh7757-ether",
8686 .resource = sh_eth0_resources,
8787 .id = 0,
8888 .num_resources = ARRAY_SIZE(sh_eth0_resources),
@@ -111,7 +111,7 @@ static struct sh_eth_plat_data sh7757_eth1_pdata = { · 22 unmodified lines
111111 };
112112
113113 static struct platform_device sh7757_eth1_device = {
114− .name = "sh-eth",
114+ .name = "sh7757-ether",
115115 .resource = sh_eth1_resources,
116116 .id = 1,
117117 .num_resources = ARRAY_SIZE(sh_eth1_resources),
@@ -157,7 +157,7 @@ static struct sh_eth_plat_data sh7757_eth_giga0_pdata = { · 39 unmodified lines
157157 };
158158
159159 static struct platform_device sh7757_eth_giga0_device = {
160− .name = "sh-eth",
160+ .name = "sh7757-gether",
161161 .resource = sh_eth_giga0_resources,
162162 .id = 2,
163163 .num_resources = ARRAY_SIZE(sh_eth_giga0_resources),
@@ -192,7 +192,7 @@ static struct sh_eth_plat_data sh7757_eth_giga1_pdata = { · 28 unmodified lines
192192 };
193193
194194 static struct platform_device sh7757_eth_giga1_device = {
195− .name = "sh-eth",
195+ .name = "sh7757-gether",
196196 .resource = sh_eth_giga1_resources,
197197 .id = 3,
198198 .num_resources = ARRAY_SIZE(sh_eth_giga1_resources),
arch/sh/boards/mach-ecovec24/setup.c+2−2
@@ -165,8 +165,8 @@ static struct sh_eth_plat_data sh_eth_plat = { · 164 unmodified lines
165165 };
166166
167167 static struct platform_device sh_eth_device = {
168− .name = "sh-eth",
169− .id = 0,
168+ .name = "sh7724-ether",
169+ .id = 0,
170170 .dev = {
171171 .platform_data = &sh_eth_plat,
172172 },
arch/sh/boards/mach-se/770x/setup.c+4−4
@@ -128,8 +128,8 @@ static struct resource sh_eth0_resources[] = { · 127 unmodified lines
128128 };
129129
130130 static struct platform_device sh_eth0_device = {
131− .name = "sh-eth",
132− .id = 0,
131+ .name = "sh771x-ether",
132+ .id = 0,
133133 .dev = {
134134 .platform_data = PHY_ID,
135135 },
@@ -151,8 +151,8 @@ static struct resource sh_eth1_resources[] = { · 15 unmodified lines
151151 };
152152
153153 static struct platform_device sh_eth1_device = {
154− .name = "sh-eth",
155− .id = 1,
154+ .name = "sh771x-ether",
155+ .id = 1,
156156 .dev = {
157157 .platform_data = PHY_ID,
158158 },
arch/sh/boards/mach-se/7724/setup.c+2−2
@@ -380,8 +380,8 @@ static struct sh_eth_plat_data sh_eth_plat = { · 379 unmodified lines
380380 };
381381
382382 static struct platform_device sh_eth_device = {
383− .name = "sh-eth",
384− .id = 0,
383+ .name = "sh7724-ether",
384+ .id = 0,
385385 .dev = {
386386 .platform_data = &sh_eth_plat,
387387 },
arch/sh/boards/mach-sh7763rdp/setup.c+1−1
@@ -93,7 +93,7 @@ static struct sh_eth_plat_data sh7763_eth_pdata = { · 92 unmodified lines
9393 };
9494
9595 static struct platform_device sh7763rdp_eth_device = {
96− .name = "sh-eth",
96+ .name = "sh7763-gether",
9797 .resource = sh_eth_resources,
9898 .num_resources = ARRAY_SIZE(sh_eth_resources),
9999 .dev = {
arch/sh/kernel/cpu/sh2/setup-sh7619.c+2−2
@@ -124,8 +124,8 @@ static struct resource eth_resources[] = { · 123 unmodified lines
124124 };
125125
126126 static struct platform_device eth_device = {
127− .name = "sh-eth",
128− .id = -1,
127+ .name = "sh7619-ether",
128+ .id = -1,
129129 .dev = {
130130 .platform_data = (void *)1,
131131 },
arch/sh/kernel/cpu/sh4a/clock-sh7724.c+1−1
@@ -329,7 +329,7 @@ static struct clk_lookup lookups[] = { · 328 unmodified lines
329329 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC0]),
330330 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[HWBLK_IIC1]),
331331 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[HWBLK_MMC]),
332− CLKDEV_DEV_ID("sh-eth.0", &mstp_clks[HWBLK_ETHER]),
332+ CLKDEV_DEV_ID("sh7724-ether.0", &mstp_clks[HWBLK_ETHER]),
333333 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]),
334334 CLKDEV_CON_ID("tpu0", &mstp_clks[HWBLK_TPU]),
335335 CLKDEV_CON_ID("irda0", &mstp_clks[HWBLK_IRDA]),
arch/sh/kernel/cpu/sh4a/clock-sh7734.c+1−1
@@ -238,7 +238,7 @@ static struct clk_lookup lookups[] = { · 237 unmodified lines
238238 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP313]),
239239 CLKDEV_CON_ID("mtu0", &mstp_clks[MSTP312]),
240240 CLKDEV_CON_ID("iebus0", &mstp_clks[MSTP304]),
241− CLKDEV_DEV_ID("sh-eth.0", &mstp_clks[MSTP114]),
241+ CLKDEV_DEV_ID("sh7734-gether.0", &mstp_clks[MSTP114]),
242242 CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP303]),
243243 CLKDEV_CON_ID("hif0", &mstp_clks[MSTP302]),
244244 CLKDEV_CON_ID("stif0", &mstp_clks[MSTP301]),
arch/sparc/include/uapi/asm/socket.h+2−0
@@ -70,6 +70,8 @@ · 69 unmodified lines
7070
7171 #define SO_SELECT_ERR_QUEUE 0x0029
7272
73+#define SO_LL 0x0030
74+
7375 /* Security levels - as per NRL IPv6 - don't actually do anything */
7476 #define SO_SECURITY_AUTHENTICATION 0x5001
7577 #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
arch/sparc/net/bpf_jit_comp.c+3−17
@@ -785,9 +785,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf]; · 784 unmodified lines
785785 break;
786786 }
787787 if (proglen == oldproglen) {
788− image = module_alloc(max_t(unsigned int,
789− proglen,
790− sizeof(struct work_struct)));
788+ image = module_alloc(proglen);
791789 if (!image)
792790 goto out;
793791 }
@@ -806,20 +804,8 @@ out: · 12 unmodified lines
806804 return;
807805 }
808806
809−static void jit_free_defer(struct work_struct *arg)
810−{
811− module_free(NULL, arg);
812−}
813−
814−/* run from softirq, we must use a work_struct to call
815− * module_free() from process context
816− */
817807 void bpf_jit_free(struct sk_filter *fp)
818808 {
819− if (fp->bpf_func != sk_run_filter) {
820− struct work_struct *work = (struct work_struct *)fp->bpf_func;
821−
822− INIT_WORK(work, jit_free_defer);
823− schedule_work(work);
824− }
809+ if (fp->bpf_func != sk_run_filter)
810+ module_free(NULL, fp->bpf_func);
825811 }
arch/x86/net/bpf_jit_comp.c+44−17
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/netdevice.h>
1313 #include <linux/filter.h>
1414 #include <linux/if_vlan.h>
15+#include <linux/random.h>
1516
1617 /*
1718 * Conventions :
@@ -144,6 +145,39 @@ static int pkt_type_offset(void) · 126 unmodified lines
144145 return -1;
145146 }
146147
148+struct bpf_binary_header {
149+ unsigned int pages;
150+ /* Note : for security reasons, bpf code will follow a randomly
151+ * sized amount of int3 instructions
152+ */
153+ u8 image[];
154+};
155+
156+static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
157+ u8 **image_ptr)
158+{
159+ unsigned int sz, hole;
160+ struct bpf_binary_header *header;
161+
162+ /* Most of BPF filters are really small,
163+ * but if some of them fill a page, allow at least
164+ * 128 extra bytes to insert a random section of int3
165+ */
166+ sz = round_up(proglen + sizeof(*header) + 128, PAGE_SIZE);
167+ header = module_alloc(sz);
168+ if (!header)
169+ return NULL;
170+
171+ memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
172+
173+ header->pages = sz / PAGE_SIZE;
174+ hole = sz - (proglen + sizeof(*header));
175+
176+ /* insert a random number of int3 instructions before BPF code */
177+ *image_ptr = &header->image[prandom_u32() % hole];
178+ return header;
179+}
180+
147181 void bpf_jit_compile(struct sk_filter *fp)
148182 {
149183 u8 temp[64];
@@ -153,6 +187,7 @@ void bpf_jit_compile(struct sk_filter *fp) · 3 unmodified lines
153187 int t_offset, f_offset;
154188 u8 t_op, f_op, seen = 0, pass;
155189 u8 *image = NULL;
190+ struct bpf_binary_header *header = NULL;
156191 u8 *func;
157192 int pc_ret0 = -1; /* bpf index of first RET #0 instruction (if any) */
158193 unsigned int cleanup_addr; /* epilogue code offset */
@@ -693,7 +728,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i]; · 534 unmodified lines
693728 if (unlikely(proglen + ilen > oldproglen)) {
694729 pr_err("bpb_jit_compile fatal error\n");
695730 kfree(addrs);
696− module_free(NULL, image);
731+ module_free(NULL, header);
697732 return;
698733 }
699734 memcpy(image + proglen, temp, ilen);
@@ -717,10 +752,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i]; · 17 unmodified lines
717752 break;
718753 }
719754 if (proglen == oldproglen) {
720− image = module_alloc(max_t(unsigned int,
721− proglen,
722− sizeof(struct work_struct)));
723− if (!image)
755+ header = bpf_alloc_binary(proglen, &image);
756+ if (!header)
724757 goto out;
725758 }
726759 oldproglen = proglen;
@@ -730,7 +763,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i]; · 3 unmodified lines
730763 bpf_jit_dump(flen, proglen, pass, image);
731764
732765 if (image) {
733− bpf_flush_icache(image, image + proglen);
766+ bpf_flush_icache(header, image + proglen);
767+ set_memory_ro((unsigned long)header, header->pages);
734768 fp->bpf_func = (void *)image;
735769 }
736770 out:
@@ -738,20 +772,13 @@ out: · 1 unmodified line
738772 return;
739773 }
740774
741−static void jit_free_defer(struct work_struct *arg)
742−{
743− module_free(NULL, arg);
744−}
745−
746−/* run from softirq, we must use a work_struct to call
747− * module_free() from process context
748− */
749775 void bpf_jit_free(struct sk_filter *fp)
750776 {
751777 if (fp->bpf_func != sk_run_filter) {
752− struct work_struct *work = (struct work_struct *)fp->bpf_func;
778+ unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
779+ struct bpf_binary_header *header = (void *)addr;
753780
754− INIT_WORK(work, jit_free_defer);
755− schedule_work(work);
781+ set_memory_rw(addr, header->pages);
782+ module_free(NULL, header);
756783 }
757784 }
arch/xtensa/include/uapi/asm/socket.h+2−0
@@ -85,4 +85,6 @@ · 84 unmodified lines
8585
8686 #define SO_SELECT_ERR_QUEUE 45
8787
88+#define SO_LL 46
89+
8890 #endif /* _XTENSA_SOCKET_H */
drivers/atm/ambassador.c+1−1
@@ -1403,7 +1403,7 @@ static void amb_free_rx_skb (struct atm_vcc * atm_vcc, struct sk_buff * skb) { · 1402 unmodified lines
14031403 rx.host_address = cpu_to_be32 (virt_to_bus (skb->data));
14041404
14051405 skb->data = skb->head;
1406− skb->tail = skb->head;
1406+ skb_reset_tail_pointer(skb);
14071407 skb->len = 0;
14081408
14091409 if (!rx_give (dev, &rx, pool)) {
drivers/bcma/Kconfig+1−0
@@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE · 25 unmodified lines
2626 config BCMA_HOST_PCI
2727 bool "Support for BCMA on PCI-host bus"
2828 depends on BCMA_HOST_PCI_POSSIBLE
29+ default y
2930
3031 config BCMA_DRIVER_PCI_HOSTMODE
3132 bool "Driver for PCI core working in hostmode"
drivers/bcma/bcma_private.h+2−0
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 struct bcma_bus;
2323
2424 /* main.c */
25+bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
26+ int timeout);
2527 int bcma_bus_register(struct bcma_bus *bus);
2628 void bcma_bus_unregister(struct bcma_bus *bus);
2729 int __init bcma_bus_early_register(struct bcma_bus *bus,
drivers/bcma/core.c+25−3
@@ -9,6 +9,25 @@ · 8 unmodified lines
99 #include <linux/export.h>
1010 #include <linux/bcma/bcma.h>
1111
12+static bool bcma_core_wait_value(struct bcma_device *core, u16 reg, u32 mask,
13+ u32 value, int timeout)
14+{
15+ unsigned long deadline = jiffies + timeout;
16+ u32 val;
17+
18+ do {
19+ val = bcma_aread32(core, reg);
20+ if ((val & mask) == value)
21+ return true;
22+ cpu_relax();
23+ udelay(10);
24+ } while (!time_after_eq(jiffies, deadline));
25+
26+ bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg);
27+
28+ return false;
29+}
30+
1231 bool bcma_core_is_enabled(struct bcma_device *core)
1332 {
1433 if ((bcma_aread32(core, BCMA_IOCTL) & (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC))
@@ -25,13 +44,15 @@ void bcma_core_disable(struct bcma_device *core, u32 flags) · 10 unmodified lines
2544 if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
2645 return;
2746
28− bcma_awrite32(core, BCMA_IOCTL, flags);
29− bcma_aread32(core, BCMA_IOCTL);
30− udelay(10);
47+ bcma_core_wait_value(core, BCMA_RESET_ST, ~0, 0, 300);
3148
3249 bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET);
3350 bcma_aread32(core, BCMA_RESET_CTL);
3451 udelay(1);
52+
53+ bcma_awrite32(core, BCMA_IOCTL, flags);
54+ bcma_aread32(core, BCMA_IOCTL);
55+ udelay(10);
3556 }
3657 EXPORT_SYMBOL_GPL(bcma_core_disable);
3758
@@ -43,6 +64,7 @@ int bcma_core_enable(struct bcma_device *core, u32 flags) · 5 unmodified lines
4364 bcma_aread32(core, BCMA_IOCTL);
4465
4566 bcma_awrite32(core, BCMA_RESET_CTL, 0);
67+ bcma_aread32(core, BCMA_RESET_CTL);
4668 udelay(1);
4769
4870 bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
drivers/bcma/driver_chipcommon.c+9−2
@@ -140,8 +140,15 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) · 139 unmodified lines
140140 bcma_core_chipcommon_early_init(cc);
141141
142142 if (cc->core->id.rev >= 20) {
143− bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
144− bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0);
143+ u32 pullup = 0, pulldown = 0;
144+
145+ if (cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM43142) {
146+ pullup = 0x402e0;
147+ pulldown = 0x20500;
148+ }
149+
150+ bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, pullup);
151+ bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, pulldown);
145152 }
146153
147154 if (cc->capabilities & BCMA_CC_CAP_PMU)
drivers/bcma/driver_chipcommon_pmu.c+123−0
@@ -56,6 +56,109 @@ void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, · 55 unmodified lines
5656 }
5757 EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset);
5858
59+static u32 bcma_pmu_xtalfreq(struct bcma_drv_cc *cc)
60+{
61+ u32 ilp_ctl, alp_hz;
62+
63+ if (!(bcma_cc_read32(cc, BCMA_CC_PMU_STAT) &
64+ BCMA_CC_PMU_STAT_EXT_LPO_AVAIL))
65+ return 0;
66+
67+ bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ,
68+ BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT));
69+ usleep_range(1000, 2000);
70+
71+ ilp_ctl = bcma_cc_read32(cc, BCMA_CC_PMU_XTAL_FREQ);
72+ ilp_ctl &= BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK;
73+
74+ bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0);
75+
76+ alp_hz = ilp_ctl * 32768 / 4;
77+ return (alp_hz + 50000) / 100000 * 100;
78+}
79+
80+static void bcma_pmu2_pll_init0(struct bcma_drv_cc *cc, u32 xtalfreq)
81+{
82+ struct bcma_bus *bus = cc->core->bus;
83+ u32 freq_tgt_target = 0, freq_tgt_current;
84+ u32 pll0, mask;
85+
86+ switch (bus->chipinfo.id) {
87+ case BCMA_CHIP_ID_BCM43142:
88+ /* pmu2_xtaltab0_adfll_485 */
89+ switch (xtalfreq) {
90+ case 12000:
91+ freq_tgt_target = 0x50D52;
92+ break;
93+ case 20000:
94+ freq_tgt_target = 0x307FE;
95+ break;
96+ case 26000:
97+ freq_tgt_target = 0x254EA;
98+ break;
99+ case 37400:
100+ freq_tgt_target = 0x19EF8;
101+ break;
102+ case 52000:
103+ freq_tgt_target = 0x12A75;
104+ break;
105+ }
106+ break;
107+ }
108+
109+ if (!freq_tgt_target) {
110+ bcma_err(bus, "Unknown TGT frequency for xtalfreq %d\n",
111+ xtalfreq);
112+ return;
113+ }
114+
115+ pll0 = bcma_chipco_pll_read(cc, BCMA_CC_PMU15_PLL_PLLCTL0);
116+ freq_tgt_current = (pll0 & BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK) >>
117+ BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT;
118+
119+ if (freq_tgt_current == freq_tgt_target) {
120+ bcma_debug(bus, "Target TGT frequency already set\n");
121+ return;
122+ }
123+
124+ /* Turn off PLL */
125+ switch (bus->chipinfo.id) {
126+ case BCMA_CHIP_ID_BCM43142:
127+ mask = (u32)~(BCMA_RES_4314_HT_AVAIL |
128+ BCMA_RES_4314_MACPHY_CLK_AVAIL);
129+
130+ bcma_cc_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask);
131+ bcma_cc_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask);
132+ bcma_wait_value(cc->core, BCMA_CLKCTLST,
133+ BCMA_CLKCTLST_HAVEHT, 0, 20000);
134+ break;
135+ }
136+
137+ pll0 &= ~BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK;
138+ pll0 |= freq_tgt_target << BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT;
139+ bcma_chipco_pll_write(cc, BCMA_CC_PMU15_PLL_PLLCTL0, pll0);
140+
141+ /* Flush */
142+ if (cc->pmu.rev >= 2)
143+ bcma_cc_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
144+
145+ /* TODO: Do we need to update OTP? */
146+}
147+
148+static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)
149+{
150+ struct bcma_bus *bus = cc->core->bus;
151+ u32 xtalfreq = bcma_pmu_xtalfreq(cc);
152+
153+ switch (bus->chipinfo.id) {
154+ case BCMA_CHIP_ID_BCM43142:
155+ if (xtalfreq == 0)
156+ xtalfreq = 20000;
157+ bcma_pmu2_pll_init0(cc, xtalfreq);
158+ break;
159+ }
160+}
161+
59162 static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
60163 {
61164 struct bcma_bus *bus = cc->core->bus;
@@ -66,6 +169,25 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc) · 4 unmodified lines
66169 min_msk = 0x200D;
67170 max_msk = 0xFFFF;
68171 break;
172+ case BCMA_CHIP_ID_BCM43142:
173+ min_msk = BCMA_RES_4314_LPLDO_PU |
174+ BCMA_RES_4314_PMU_SLEEP_DIS |
175+ BCMA_RES_4314_PMU_BG_PU |
176+ BCMA_RES_4314_CBUCK_LPOM_PU |
177+ BCMA_RES_4314_CBUCK_PFM_PU |
178+ BCMA_RES_4314_CLDO_PU |
179+ BCMA_RES_4314_LPLDO2_LVM |
180+ BCMA_RES_4314_WL_PMU_PU |
181+ BCMA_RES_4314_LDO3P3_PU |
182+ BCMA_RES_4314_OTP_PU |
183+ BCMA_RES_4314_WL_PWRSW_PU |
184+ BCMA_RES_4314_LQ_AVAIL |
185+ BCMA_RES_4314_LOGIC_RET |
186+ BCMA_RES_4314_MEM_SLEEP |
187+ BCMA_RES_4314_MACPHY_RET |
188+ BCMA_RES_4314_WL_CORE_READY;
189+ max_msk = 0x3FFFFFFF;
190+ break;
69191 default:
70192 bcma_debug(bus, "PMU resource config unknown or not needed for device 0x%04X\n",
71193 bus->chipinfo.id);
@@ -165,6 +287,7 @@ void bcma_pmu_init(struct bcma_drv_cc *cc) · 93 unmodified lines
165287 bcma_cc_set32(cc, BCMA_CC_PMU_CTL,
166288 BCMA_CC_PMU_CTL_NOILPONW);
167289
290+ bcma_pmu_pll_init(cc);
168291 bcma_pmu_resources_init(cc);
169292 bcma_pmu_workarounds(cc);
170293 }
drivers/bcma/driver_chipcommon_sflash.c+4−4
@@ -30,7 +30,7 @@ struct bcma_sflash_tbl_e { · 29 unmodified lines
3030 u16 numblocks;
3131 };
3232
33−static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = {
33+static const struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = {
3434 { "M25P20", 0x11, 0x10000, 4, },
3535 { "M25P40", 0x12, 0x10000, 8, },
3636
@@ -41,7 +41,7 @@ static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = { · 4 unmodified lines
4141 { 0 },
4242 };
4343
44−static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = {
44+static const struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = {
4545 { "SST25WF512", 1, 0x1000, 16, },
4646 { "SST25VF512", 0x48, 0x1000, 16, },
4747 { "SST25WF010", 2, 0x1000, 32, },
@@ -59,7 +59,7 @@ static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = { · 11 unmodified lines
5959 { 0 },
6060 };
6161
62−static struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = {
62+static const struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = {
6363 { "AT45DB011", 0xc, 256, 512, },
6464 { "AT45DB021", 0x14, 256, 1024, },
6565 { "AT45DB041", 0x1c, 256, 2048, },
@@ -89,7 +89,7 @@ int bcma_sflash_init(struct bcma_drv_cc *cc) · 23 unmodified lines
8989 {
9090 struct bcma_bus *bus = cc->core->bus;
9191 struct bcma_sflash *sflash = &cc->sflash;
92− struct bcma_sflash_tbl_e *e;
92+ const struct bcma_sflash_tbl_e *e;
9393 u32 id, id2;
9494
9595 switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
drivers/bcma/host_pci.c+1−0
@@ -275,6 +275,7 @@ static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { · 274 unmodified lines
275275 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
276276 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
277277 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
278+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
278279 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
279280 { 0, },
280281 };
drivers/bcma/main.c+19−0
@@ -93,6 +93,25 @@ struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid, · 92 unmodified lines
9393 return NULL;
9494 }
9595
96+bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
97+ int timeout)
98+{
99+ unsigned long deadline = jiffies + timeout;
100+ u32 val;
101+
102+ do {
103+ val = bcma_read32(core, reg);
104+ if ((val & mask) == value)
105+ return true;
106+ cpu_relax();
107+ udelay(10);
108+ } while (!time_after_eq(jiffies, deadline));
109+
110+ bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg);
111+
112+ return false;
113+}
114+
96115 static void bcma_release_core_dev(struct device *dev)
97116 {
98117 struct bcma_device *core = container_of(dev, struct bcma_device, dev);
drivers/bcma/sprom.c+40−32
@@ -72,12 +72,12 @@ fail: · 71 unmodified lines
7272 * R/W ops.
7373 **************************************************/
7474
75−static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom)
75+static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom,
76+ size_t words)
7677 {
7778 int i;
78− for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++)
79− sprom[i] = bcma_read16(bus->drv_cc.core,
80− offset + (i * 2));
79+ for (i = 0; i < words; i++)
80+ sprom[i] = bcma_read16(bus->drv_cc.core, offset + (i * 2));
8181 }
8282
8383 /**************************************************
@@ -124,29 +124,29 @@ static inline u8 bcma_crc8(u8 crc, u8 data) · 40 unmodified lines
124124 return t[crc ^ data];
125125 }
126126
127−static u8 bcma_sprom_crc(const u16 *sprom)
127+static u8 bcma_sprom_crc(const u16 *sprom, size_t words)
128128 {
129129 int word;
130130 u8 crc = 0xFF;
131131
132− for (word = 0; word < SSB_SPROMSIZE_WORDS_R4 - 1; word++) {
132+ for (word = 0; word < words - 1; word++) {
133133 crc = bcma_crc8(crc, sprom[word] & 0x00FF);
134134 crc = bcma_crc8(crc, (sprom[word] & 0xFF00) >> 8);
135135 }
136− crc = bcma_crc8(crc, sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & 0x00FF);
136+ crc = bcma_crc8(crc, sprom[words - 1] & 0x00FF);
137137 crc ^= 0xFF;
138138
139139 return crc;
140140 }
141141
142−static int bcma_sprom_check_crc(const u16 *sprom)
142+static int bcma_sprom_check_crc(const u16 *sprom, size_t words)
143143 {
144144 u8 crc;
145145 u8 expected_crc;
146146 u16 tmp;
147147
148− crc = bcma_sprom_crc(sprom);
149− tmp = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_CRC;
148+ crc = bcma_sprom_crc(sprom, words);
149+ tmp = sprom[words - 1] & SSB_SPROM_REVISION_CRC;
150150 expected_crc = tmp >> SSB_SPROM_REVISION_CRC_SHIFT;
151151 if (crc != expected_crc)
152152 return -EPROTO;
@@ -154,21 +154,25 @@ static int bcma_sprom_check_crc(const u16 *sprom) · 1 unmodified line
154154 return 0;
155155 }
156156
157−static int bcma_sprom_valid(const u16 *sprom)
157+static int bcma_sprom_valid(struct bcma_bus *bus, const u16 *sprom,
158+ size_t words)
158159 {
159160 u16 revision;
160161 int err;
161162
162− err = bcma_sprom_check_crc(sprom);
163+ err = bcma_sprom_check_crc(sprom, words);
163164 if (err)
164165 return err;
165166
166− revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_REV;
167− if (revision != 8 && revision != 9) {
167+ revision = sprom[words - 1] & SSB_SPROM_REVISION_REV;
168+ if (revision != 8 && revision != 9 && revision != 10) {
168169 pr_err("Unsupported SPROM revision: %d\n", revision);
169170 return -ENOENT;
170171 }
171172
173+ bus->sprom.revision = revision;
174+ bcma_debug(bus, "Found SPROM revision %d\n", revision);
175+
172176 return 0;
173177 }
174178
@@ -208,9 +212,6 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) · 33 unmodified lines
208212 BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) !=
209213 ARRAY_SIZE(bus->sprom.core_pwr_info));
210214
211− bus->sprom.revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] &
212− SSB_SPROM_REVISION_REV;
213−
214215 for (i = 0; i < 3; i++) {
215216 v = sprom[SPOFF(SSB_SPROM8_IL0MAC) + i];
216217 *(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v);
@@ -502,7 +503,7 @@ static bool bcma_sprom_onchip_available(struct bcma_bus *bus) · 285 unmodified lines
502503 case BCMA_CHIP_ID_BCM4331:
503504 present = chip_status & BCMA_CC_CHIPST_4331_OTP_PRESENT;
504505 break;
505−
506+ case BCMA_CHIP_ID_BCM43142:
506507 case BCMA_CHIP_ID_BCM43224:
507508 case BCMA_CHIP_ID_BCM43225:
508509 /* for these chips OTP is always available */
@@ -550,7 +551,9 @@ int bcma_sprom_get(struct bcma_bus *bus) · 41 unmodified lines
550551 {
551552 u16 offset = BCMA_CC_SPROM;
552553 u16 *sprom;
553− int err = 0;
554+ size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4,
555+ SSB_SPROMSIZE_WORDS_R10, };
556+ int i, err = 0;
554557
555558 if (!bus->drv_cc.core)
556559 return -EOPNOTSUPP;
@@ -579,32 +582,37 @@ int bcma_sprom_get(struct bcma_bus *bus) · 22 unmodified lines
579582 }
580583 }
581584
582− sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
583− GFP_KERNEL);
584− if (!sprom)
585− return -ENOMEM;
586−
587585 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 ||
588586 bus->chipinfo.id == BCMA_CHIP_ID_BCM43431)
589587 bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false);
590588
591589 bcma_debug(bus, "SPROM offset 0x%x\n", offset);
592− bcma_sprom_read(bus, offset, sprom);
590+ for (i = 0; i < ARRAY_SIZE(sprom_sizes); i++) {
591+ size_t words = sprom_sizes[i];
592+
593+ sprom = kcalloc(words, sizeof(u16), GFP_KERNEL);
594+ if (!sprom)
595+ return -ENOMEM;
596+
597+ bcma_sprom_read(bus, offset, sprom, words);
598+ err = bcma_sprom_valid(bus, sprom, words);
599+ if (!err)
600+ break;
601+
602+ kfree(sprom);
603+ }
593604
594605 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 ||
595606 bus->chipinfo.id == BCMA_CHIP_ID_BCM43431)
596607 bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);
597608
598− err = bcma_sprom_valid(sprom);
599609 if (err) {
600− bcma_warn(bus, "invalid sprom read from the PCIe card, try to use fallback sprom\n");
610+ bcma_warn(bus, "Invalid SPROM read from the PCIe card, trying to use fallback SPROM\n");
601611 err = bcma_fill_sprom_with_fallback(bus, &bus->sprom);
602− goto out;
612+ } else {
613+ bcma_sprom_extract_r8(bus, sprom);
614+ kfree(sprom);
603615 }
604616
605− bcma_sprom_extract_r8(bus, sprom);
606−
607−out:
608− kfree(sprom);
609617 return err;
610618 }
drivers/bluetooth/btmrvl_sdio.c+1−0
@@ -554,6 +554,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) · 553 unmodified lines
554554 skb = bt_skb_alloc(num_blocks * blksz + BTSDIO_DMA_ALIGN, GFP_ATOMIC);
555555 if (skb == NULL) {
556556 BT_ERR("No free skb");
557+ ret = -ENOMEM;
557558 goto exit;
558559 }
559560
drivers/bluetooth/btusb.c+4−0
@@ -57,6 +57,9 @@ static struct usb_device_id btusb_table[] = { · 56 unmodified lines
5757 /* Apple-specific (Broadcom) devices */
5858 { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) },
5959
60+ /* MediaTek MT76x0E */
61+ { USB_DEVICE(0x0e8d, 0x763f) },
62+
6063 /* Broadcom SoftSailing reporting vendor specific */
6164 { USB_DEVICE(0x0a5c, 0x21e1) },
6265
@@ -1616,6 +1619,7 @@ static struct usb_driver btusb_driver = { · 1553 unmodified lines
16161619 #ifdef CONFIG_PM
16171620 .suspend = btusb_suspend,
16181621 .resume = btusb_resume,
1622+ .reset_resume = btusb_resume,
16191623 #endif
16201624 .id_table = btusb_table,
16211625 .supports_autosuspend = 1,
drivers/infiniband/core/cma.c+2−2
@@ -3269,9 +3269,9 @@ static int cma_netdev_change(struct net_device *ndev, struct rdma_id_private *id · 3268 unmodified lines
32693269 }
32703270
32713271 static int cma_netdev_callback(struct notifier_block *self, unsigned long event,
3272− void *ctx)
3272+ void *ptr)
32733273 {
3274− struct net_device *ndev = (struct net_device *)ctx;
3274+ struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
32753275 struct cma_device *cma_dev;
32763276 struct rdma_id_private *id_priv;
32773277 int ret = NOTIFY_DONE;
drivers/infiniband/hw/mlx4/main.c+1−1
@@ -1161,7 +1161,7 @@ static void netdev_removed(struct mlx4_ib_dev *dev, int port) · 1160 unmodified lines
11611161 static int mlx4_ib_netdev_event(struct notifier_block *this, unsigned long event,
11621162 void *ptr)
11631163 {
1164− struct net_device *dev = ptr;
1164+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
11651165 struct mlx4_ib_dev *ibdev;
11661166 struct net_device *oldnd;
11671167 struct mlx4_ib_iboe *iboe;
drivers/isdn/i4l/isdn_net.c+1−1
@@ -885,7 +885,7 @@ isdn_net_log_skb(struct sk_buff *skb, isdn_net_local *lp) · 884 unmodified lines
885885
886886 addinfo[0] = '\0';
887887 /* This check stolen from 2.1.72 dev_queue_xmit_nit() */
888− if (p < skb->data || skb->network_header >= skb->tail) {
888+ if (p < skb->data || skb_network_header(skb) >= skb_tail_pointer(skb)) {
889889 /* fall back to old isdn_net_log_packet method() */
890890 char *buf = skb->data;
891891
drivers/net/Kconfig+13−7
@@ -25,6 +25,9 @@ menuconfig NETDEVICES · 24 unmodified lines
2525 # that for each of the symbols.
2626 if NETDEVICES
2727
28+config MII
29+ tristate
30+
2831 config NET_CORE
2932 default y
3033 bool "Network core driver support"
@@ -100,13 +103,6 @@ config NET_FC · 69 unmodified lines
100103 adaptor below. You also should have said Y to "SCSI support" and
101104 "SCSI generic support".
102105
103−config MII
104− tristate "Generic Media Independent Interface device support"
105− help
106− Most ethernet controllers have MII transceiver either as an external
107− or internal device. It is safe to say Y or M here even if your
108− ethernet card lacks MII.
109−
110106 config IFB
111107 tristate "Intermediate Functional Block support"
112108 depends on NET_CLS_ACT
@@ -244,6 +240,16 @@ config VIRTIO_NET · 131 unmodified lines
244240 This is the virtual network driver for virtio. It can be used with
245241 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M.
246242
243+config NLMON
244+ tristate "Virtual netlink monitoring device"
245+ ---help---
246+ This option enables a monitoring net device for netlink skbs. The
247+ purpose of this is to analyze netlink messages with packet sockets.
248+ Thus applications like tcpdump will be able to see local netlink
249+ messages if they tap into the netlink device, record pcaps for further
250+ diagnostics, etc. This is mostly intended for developers or support
251+ to debug netlink issues. If unsure, say N.
252+
247253 endif # NET_CORE
248254
249255 config SUNGEM_PHY
drivers/net/Makefile+1−0
@@ -22,6 +22,7 @@ obj-$(CONFIG_TUN) += tun.o · 21 unmodified lines
2222 obj-$(CONFIG_VETH) += veth.o
2323 obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
2424 obj-$(CONFIG_VXLAN) += vxlan.o
25+obj-$(CONFIG_NLMON) += nlmon.o
2526
2627 #
2728 # Networking Drivers
drivers/net/bonding/bond_alb.c+19−80
@@ -1056,7 +1056,7 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[]) · 1055 unmodified lines
10561056 *
10571057 */
10581058
1059−static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct slave *slave2)
1059+static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
10601060 {
10611061 u8 tmp_mac_addr[ETH_ALEN];
10621062
@@ -1129,6 +1129,7 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla · 66 unmodified lines
11291129 {
11301130 int perm_curr_diff;
11311131 int perm_bond_diff;
1132+ struct slave *found_slave;
11321133
11331134 perm_curr_diff = !ether_addr_equal_64bits(slave->perm_hwaddr,
11341135 slave->dev->dev_addr);
@@ -1136,21 +1137,12 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla · 1 unmodified line
11361137 bond->dev->dev_addr);
11371138
11381139 if (perm_curr_diff && perm_bond_diff) {
1139− struct slave *tmp_slave;
1140− int i, found = 0;
1141−
1142− bond_for_each_slave(bond, tmp_slave, i) {
1143− if (ether_addr_equal_64bits(slave->perm_hwaddr,
1144− tmp_slave->dev->dev_addr)) {
1145− found = 1;
1146− break;
1147− }
1148− }
1140+ found_slave = bond_slave_has_mac(bond, slave->perm_hwaddr);
11491141
1150− if (found) {
1142+ if (found_slave) {
11511143 /* locking: needs RTNL and nothing else */
1152− alb_swap_mac_addr(bond, slave, tmp_slave);
1153− alb_fasten_mac_swap(bond, slave, tmp_slave);
1144+ alb_swap_mac_addr(slave, found_slave);
1145+ alb_fasten_mac_swap(bond, slave, found_slave);
11541146 }
11551147 }
11561148 }
@@ -1175,16 +1167,13 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla · 18 unmodified lines
11751167 * @slave.
11761168 *
11771169 * assumption: this function is called before @slave is attached to the
1178− * bond slave list.
1179− *
1180− * caller must hold the bond lock for write since the mac addresses are compared
1181− * and may be swapped.
1170+ * bond slave list.
11821171 */
11831172 static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
11841173 {
1185− struct slave *tmp_slave1, *tmp_slave2, *free_mac_slave;
1174+ struct slave *tmp_slave1, *free_mac_slave = NULL;
11861175 struct slave *has_bond_addr = bond->curr_active_slave;
1187− int i, j, found = 0;
1176+ int i;
11881177
11891178 if (bond->slave_cnt == 0) {
11901179 /* this is the first slave */
@@ -1196,15 +1185,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav · 5 unmodified lines
11961185 * slaves in the bond.
11971186 */
11981187 if (!ether_addr_equal_64bits(slave->perm_hwaddr, bond->dev->dev_addr)) {
1199− bond_for_each_slave(bond, tmp_slave1, i) {
1200− if (ether_addr_equal_64bits(tmp_slave1->dev->dev_addr,
1201− slave->dev->dev_addr)) {
1202− found = 1;
1203− break;
1204− }
1205− }
1206−
1207− if (!found)
1188+ if (!bond_slave_has_mac(bond, slave->dev->dev_addr))
12081189 return 0;
12091190
12101191 /* Try setting slave mac to bond address and fall-through
@@ -1215,19 +1196,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav · 4 unmodified lines
12151196 /* The slave's address is equal to the address of the bond.
12161197 * Search for a spare address in the bond for this slave.
12171198 */
1218− free_mac_slave = NULL;
1219−
12201199 bond_for_each_slave(bond, tmp_slave1, i) {
1221− found = 0;
1222− bond_for_each_slave(bond, tmp_slave2, j) {
1223− if (ether_addr_equal_64bits(tmp_slave1->perm_hwaddr,
1224− tmp_slave2->dev->dev_addr)) {
1225− found = 1;
1226− break;
1227− }
1228− }
1229−
1230− if (!found) {
1200+ if (!bond_slave_has_mac(bond, tmp_slave1->perm_hwaddr)) {
12311201 /* no slave has tmp_slave1's perm addr
12321202 * as its curr addr
12331203 */
@@ -1607,15 +1577,7 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave) · 373 unmodified lines
16071577 return res;
16081578 }
16091579
1610− /* caller must hold the bond lock for write since the mac addresses
1611− * are compared and may be swapped.
1612− */
1613− read_lock(&bond->lock);
1614−
16151580 res = alb_handle_addr_collision_on_attach(bond, slave);
1616−
1617− read_unlock(&bond->lock);
1618−
16191581 if (res) {
16201582 return res;
16211583 }
@@ -1698,7 +1660,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave · 76 unmodified lines
16981660 __acquires(&bond->curr_slave_lock)
16991661 {
17001662 struct slave *swap_slave;
1701− int i;
17021663
17031664 if (bond->curr_active_slave == new_slave) {
17041665 return;
@@ -1720,17 +1681,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave · 15 unmodified lines
17201681 /* set the new curr_active_slave to the bonds mac address
17211682 * i.e. swap mac addresses of old curr_active_slave and new curr_active_slave
17221683 */
1723− if (!swap_slave) {
1724− struct slave *tmp_slave;
1725− /* find slave that is holding the bond's mac address */
1726− bond_for_each_slave(bond, tmp_slave, i) {
1727− if (ether_addr_equal_64bits(tmp_slave->dev->dev_addr,
1728− bond->dev->dev_addr)) {
1729− swap_slave = tmp_slave;
1730− break;
1731− }
1732− }
1733− }
1684+ if (!swap_slave)
1685+ swap_slave = bond_slave_has_mac(bond, bond->dev->dev_addr);
17341686
17351687 /*
17361688 * Arrange for swap_slave and new_slave to temporarily be
@@ -1750,16 +1702,12 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave · 13 unmodified lines
17501702 /* curr_active_slave must be set before calling alb_swap_mac_addr */
17511703 if (swap_slave) {
17521704 /* swap mac address */
1753− alb_swap_mac_addr(bond, swap_slave, new_slave);
1754− } else {
1755− /* set the new_slave to the bond mac address */
1756− alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr);
1757− }
1758−
1759− if (swap_slave) {
1705+ alb_swap_mac_addr(swap_slave, new_slave);
17601706 alb_fasten_mac_swap(bond, swap_slave, new_slave);
17611707 read_lock(&bond->lock);
17621708 } else {
1709+ /* set the new_slave to the bond mac address */
1710+ alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr);
17631711 read_lock(&bond->lock);
17641712 alb_send_learning_packets(new_slave, bond->dev->dev_addr);
17651713 }
@@ -1776,9 +1724,8 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) · 10 unmodified lines
17761724 {
17771725 struct bonding *bond = netdev_priv(bond_dev);
17781726 struct sockaddr *sa = addr;
1779− struct slave *slave, *swap_slave;
1727+ struct slave *swap_slave;
17801728 int res;
1781− int i;
17821729
17831730 if (!is_valid_ether_addr(sa->sa_data)) {
17841731 return -EADDRNOTAVAIL;
@@ -1799,18 +1746,10 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) · 14 unmodified lines
17991746 return 0;
18001747 }
18011748
1802− swap_slave = NULL;
1803−
1804− bond_for_each_slave(bond, slave, i) {
1805− if (ether_addr_equal_64bits(slave->dev->dev_addr,
1806− bond_dev->dev_addr)) {
1807− swap_slave = slave;
1808− break;
1809− }
1810− }
1749+ swap_slave = bond_slave_has_mac(bond, bond_dev->dev_addr);
18111750
18121751 if (swap_slave) {
1813− alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
1752+ alb_swap_mac_addr(swap_slave, bond->curr_active_slave);
18141753 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
18151754 } else {
18161755 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr);
drivers/net/bonding/bond_main.c+123−167
@@ -104,6 +104,7 @@ static char *xmit_hash_policy; · 103 unmodified lines
104104 static int arp_interval = BOND_LINK_ARP_INTERV;
105105 static char *arp_ip_target[BOND_MAX_ARP_TARGETS];
106106 static char *arp_validate;
107+static char *arp_all_targets;
107108 static char *fail_over_mac;
108109 static int all_slaves_active = 0;
109110 static struct bond_params bonding_defaults;
@@ -166,6 +167,8 @@ module_param(arp_validate, charp, 0); · 56 unmodified lines
166167 MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes; "
167168 "0 for none (default), 1 for active, "
168169 "2 for backup, 3 for all");
170+module_param(arp_all_targets, charp, 0);
171+MODULE_PARM_DESC(arp_all_targets, "fail on any/all arp targets timeout; 0 for any (default), 1 for all");
169172 module_param(fail_over_mac, charp, 0);
170173 MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
171174 "the same MAC; 0 for none (default), "
@@ -216,6 +219,12 @@ const struct bond_parm_tbl xmit_hashtype_tbl[] = { · 44 unmodified lines
216219 { NULL, -1},
217220 };
218221
222+const struct bond_parm_tbl arp_all_targets_tbl[] = {
223+{ "any", BOND_ARP_TARGETS_ANY},
224+{ "all", BOND_ARP_TARGETS_ALL},
225+{ NULL, -1},
226+};
227+
219228 const struct bond_parm_tbl arp_validate_tbl[] = {
220229 { "none", BOND_ARP_VALIDATE_NONE},
221230 { "active", BOND_ARP_VALIDATE_ACTIVE},
@@ -706,45 +715,6 @@ static int bond_set_allmulti(struct bonding *bond, int inc) · 484 unmodified lines
706715 return err;
707716 }
708717
709−/*
710− * Add a Multicast address to slaves
711− * according to mode
712− */
713−static void bond_mc_add(struct bonding *bond, void *addr)
714−{
715− if (USES_PRIMARY(bond->params.mode)) {
716− /* write lock already acquired */
717− if (bond->curr_active_slave)
718− dev_mc_add(bond->curr_active_slave->dev, addr);
719− } else {
720− struct slave *slave;
721− int i;
722−
723− bond_for_each_slave(bond, slave, i)
724− dev_mc_add(slave->dev, addr);
725− }
726−}
727−
728−/*
729− * Remove a multicast address from slave
730− * according to mode
731− */
732−static void bond_mc_del(struct bonding *bond, void *addr)
733−{
734− if (USES_PRIMARY(bond->params.mode)) {
735− /* write lock already acquired */
736− if (bond->curr_active_slave)
737− dev_mc_del(bond->curr_active_slave->dev, addr);
738− } else {
739− struct slave *slave;
740− int i;
741− bond_for_each_slave(bond, slave, i) {
742− dev_mc_del(slave->dev, addr);
743− }
744− }
745−}
746−
747−
748718 static void __bond_resend_igmp_join_requests(struct net_device *dev)
749719 {
750720 struct in_device *in_dev;
@@ -810,17 +780,15 @@ static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) · 59 unmodified lines
810780 bond_resend_igmp_join_requests(bond);
811781 }
812782
813−/*
814− * flush all members of flush->mc_list from device dev->mc_list
783+/* Flush bond's hardware addresses from slave
815784 */
816−static void bond_mc_list_flush(struct net_device *bond_dev,
785+static void bond_hw_addr_flush(struct net_device *bond_dev,
817786 struct net_device *slave_dev)
818787 {
819788 struct bonding *bond = netdev_priv(bond_dev);
820− struct netdev_hw_addr *ha;
821789
822− netdev_for_each_mc_addr(ha, bond_dev)
823− dev_mc_del(slave_dev, ha->addr);
790+ dev_uc_unsync(slave_dev, bond_dev);
791+ dev_mc_unsync(slave_dev, bond_dev);
824792
825793 if (bond->params.mode == BOND_MODE_8023AD) {
826794 /* del lacpdu mc addr from mc list */
@@ -832,22 +800,14 @@ static void bond_mc_list_flush(struct net_device *bond_dev, · 5 unmodified lines
832800
833801 /*--------------------------- Active slave change ---------------------------*/
834802
835−/*
836− * Update the mc list and multicast-related flags for the new and
837− * old active slaves (if any) according to the multicast mode, and
838− * promiscuous flags unconditionally.
803+/* Update the hardware address list and promisc/allmulti for the new and
804+ * old active slaves (if any). Modes that are !USES_PRIMARY keep all
805+ * slaves up date at all times; only the USES_PRIMARY modes need to call
806+ * this function to swap these settings during a failover.
839807 */
840−static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
841− struct slave *old_active)
808+static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
809+ struct slave *old_active)
842810 {
843− struct netdev_hw_addr *ha;
844−
845− if (!USES_PRIMARY(bond->params.mode))
846− /* nothing to do - mc list is already up-to-date on
847− * all slaves
848− */
849− return;
850−
851811 if (old_active) {
852812 if (bond->dev->flags & IFF_PROMISC)
853813 dev_set_promiscuity(old_active->dev, -1);
@@ -855,10 +815,7 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, · 1 unmodified line
855815 if (bond->dev->flags & IFF_ALLMULTI)
856816 dev_set_allmulti(old_active->dev, -1);
857817
858− netif_addr_lock_bh(bond->dev);
859− netdev_for_each_mc_addr(ha, bond->dev)
860− dev_mc_del(old_active->dev, ha->addr);
861− netif_addr_unlock_bh(bond->dev);
818+ bond_hw_addr_flush(bond->dev, old_active->dev);
862819 }
863820
864821 if (new_active) {
@@ -870,12 +827,29 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, · 5 unmodified lines
870827 dev_set_allmulti(new_active->dev, 1);
871828
872829 netif_addr_lock_bh(bond->dev);
873− netdev_for_each_mc_addr(ha, bond->dev)
874− dev_mc_add(new_active->dev, ha->addr);
830+ dev_uc_sync(new_active->dev, bond->dev);
831+ dev_mc_sync(new_active->dev, bond->dev);
875832 netif_addr_unlock_bh(bond->dev);
876833 }
877834 }
878835
836+/**
837+ * bond_set_dev_addr - clone slave's address to bond
838+ * @bond_dev: bond net device
839+ * @slave_dev: slave net device
840+ *
841+ * Should be called with RTNL held.
842+ */
843+static void bond_set_dev_addr(struct net_device *bond_dev,
844+ struct net_device *slave_dev)
845+{
846+ pr_debug("bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n",
847+ bond_dev, slave_dev, slave_dev->addr_len);
848+ memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len);
849+ bond_dev->addr_assign_type = NET_ADDR_STOLEN;
850+ call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
851+}
852+
879853 /*
880854 * bond_do_fail_over_mac
881855 *
@@ -898,11 +872,9 @@ static void bond_do_fail_over_mac(struct bonding *bond, · 16 unmodified lines
898872 switch (bond->params.fail_over_mac) {
899873 case BOND_FOM_ACTIVE:
900874 if (new_active) {
901− memcpy(bond->dev->dev_addr, new_active->dev->dev_addr,
902− new_active->dev->addr_len);
903875 write_unlock_bh(&bond->curr_slave_lock);
904876 read_unlock(&bond->lock);
905− call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
877+ bond_set_dev_addr(bond->dev, new_active->dev);
906878 read_lock(&bond->lock);
907879 write_lock_bh(&bond->curr_slave_lock);
908880 }
@@ -1090,7 +1062,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) · 181 unmodified lines
10901062 }
10911063
10921064 if (USES_PRIMARY(bond->params.mode))
1093− bond_mc_swap(bond, new_active, old_active);
1065+ bond_hw_addr_swap(bond, new_active, old_active);
10941066
10951067 if (bond_is_lb(bond)) {
10961068 bond_alb_handle_active_change(bond, new_active);
@@ -1333,17 +1305,6 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev) · 236 unmodified lines
13331305
13341306 /*---------------------------------- IOCTL ----------------------------------*/
13351307
1336−static void bond_set_dev_addr(struct net_device *bond_dev,
1337− struct net_device *slave_dev)
1338−{
1339− pr_debug("bond_dev=%p\n", bond_dev);
1340− pr_debug("slave_dev=%p\n", slave_dev);
1341− pr_debug("slave_dev->addr_len=%d\n", slave_dev->addr_len);
1342− memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len);
1343− bond_dev->addr_assign_type = NET_ADDR_SET;
1344− call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
1345−}
1346−
13471308 static netdev_features_t bond_fix_features(struct net_device *dev,
13481309 netdev_features_t features)
13491310 {
@@ -1425,8 +1386,6 @@ done: · 75 unmodified lines
14251386 static void bond_setup_by_slave(struct net_device *bond_dev,
14261387 struct net_device *slave_dev)
14271388 {
1428− struct bonding *bond = netdev_priv(bond_dev);
1429−
14301389 bond_dev->header_ops = slave_dev->header_ops;
14311390
14321391 bond_dev->type = slave_dev->type;
@@ -1435,7 +1394,6 @@ static void bond_setup_by_slave(struct net_device *bond_dev, · 2 unmodified lines
14351394
14361395 memcpy(bond_dev->broadcast, slave_dev->broadcast,
14371396 slave_dev->addr_len);
1438− bond->setup_by_slave = 1;
14391397 }
14401398
14411399 /* On bonding slaves other than the currently active slave, suppress
@@ -1533,10 +1491,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 91 unmodified lines
15331491 struct bonding *bond = netdev_priv(bond_dev);
15341492 const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
15351493 struct slave *new_slave = NULL;
1536− struct netdev_hw_addr *ha;
15371494 struct sockaddr addr;
15381495 int link_reporting;
1539− int res = 0;
1496+ int res = 0, i;
15401497
15411498 if (!bond->params.use_carrier &&
15421499 slave_dev->ethtool_ops->get_link == NULL &&
@@ -1643,7 +1600,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 100 unmodified lines
16431600
16441601 /* If this is the first slave, then we need to set the master's hardware
16451602 * address to be the same as the slave's. */
1646− if (bond->slave_cnt == 0 && bond->dev_addr_from_first)
1603+ if (!bond->slave_cnt && bond->dev->addr_assign_type == NET_ADDR_RANDOM)
16471604 bond_set_dev_addr(bond->dev, slave_dev);
16481605
16491606 new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
@@ -1713,10 +1670,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 63 unmodified lines
17131670 goto err_close;
17141671 }
17151672
1716− /* If the mode USES_PRIMARY, then the new slave gets the
1717− * master's promisc (and mc) settings only if it becomes the
1718− * curr_active_slave, and that is taken care of later when calling
1719− * bond_change_active()
1673+ /* If the mode USES_PRIMARY, then the following is handled by
1674+ * bond_change_active_slave().
17201675 */
17211676 if (!USES_PRIMARY(bond->params.mode)) {
17221677 /* set promiscuity level to new slave */
@@ -1734,9 +1689,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 11 unmodified lines
17341689 }
17351690
17361691 netif_addr_lock_bh(bond_dev);
1737− /* upload master's mc_list to new slave */
1738− netdev_for_each_mc_addr(ha, bond_dev)
1739− dev_mc_add(slave_dev, ha->addr);
1692+
1693+ dev_mc_sync_multiple(slave_dev, bond_dev);
1694+ dev_uc_sync_multiple(slave_dev, bond_dev);
1695+
17401696 netif_addr_unlock_bh(bond_dev);
17411697 }
17421698
@@ -1766,6 +1722,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 23 unmodified lines
17661722
17671723 new_slave->last_arp_rx = jiffies -
17681724 (msecs_to_jiffies(bond->params.arp_interval) + 1);
1725+ for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
1726+ new_slave->target_last_arp_rx[i] = new_slave->last_arp_rx;
17691727
17701728 if (bond->params.miimon && !bond->params.use_carrier) {
17711729 link_reporting = bond_check_dev_link(bond, slave_dev, 1);
@@ -1915,11 +1873,9 @@ err_dest_symlinks: · 143 unmodified lines
19151873 bond_destroy_slave_symlinks(bond_dev, slave_dev);
19161874
19171875 err_detach:
1918− if (!USES_PRIMARY(bond->params.mode)) {
1919− netif_addr_lock_bh(bond_dev);
1920− bond_mc_list_flush(bond_dev, slave_dev);
1921− netif_addr_unlock_bh(bond_dev);
1922− }
1876+ if (!USES_PRIMARY(bond->params.mode))
1877+ bond_hw_addr_flush(bond_dev, slave_dev);
1878+
19231879 bond_del_vlans_from_slave(bond, slave_dev);
19241880 write_lock_bh(&bond->lock);
19251881 bond_detach_slave(bond, new_slave);
@@ -2089,7 +2045,6 @@ static int __bond_release_one(struct net_device *bond_dev, · 163 unmodified lines
20892045 if (bond->slave_cnt == 0) {
20902046 bond_set_carrier(bond);
20912047 eth_hw_addr_random(bond_dev);
2092− bond->dev_addr_from_first = true;
20932048
20942049 if (bond_vlan_used(bond)) {
20952050 pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n",
@@ -2118,9 +2073,8 @@ static int __bond_release_one(struct net_device *bond_dev, · 22 unmodified lines
21182073
21192074 bond_del_vlans_from_slave(bond, slave_dev);
21202075
2121− /* If the mode USES_PRIMARY, then we should only remove its
2122− * promisc and mc settings if it was the curr_active_slave, but that was
2123− * already taken care of above when we detached the slave
2076+ /* If the mode USES_PRIMARY, then this cases was handled above by
2077+ * bond_change_active_slave(..., NULL)
21242078 */
21252079 if (!USES_PRIMARY(bond->params.mode)) {
21262080 /* unset promiscuity level from slave */
@@ -2131,10 +2085,7 @@ static int __bond_release_one(struct net_device *bond_dev, · 4 unmodified lines
21312085 if (bond_dev->flags & IFF_ALLMULTI)
21322086 dev_set_allmulti(slave_dev, -1);
21332087
2134− /* flush master's mc_list from slave */
2135− netif_addr_lock_bh(bond_dev);
2136− bond_mc_list_flush(bond_dev, slave_dev);
2137− netif_addr_unlock_bh(bond_dev);
2088+ bond_hw_addr_flush(bond_dev, slave_dev);
21382089 }
21392090
21402091 bond_upper_dev_unlink(bond_dev, slave_dev);
@@ -2672,18 +2623,19 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) · 531 unmodified lines
26722623 static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip)
26732624 {
26742625 int i;
2675− __be32 *targets = bond->params.arp_targets;
26762626
2677− for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2678− pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
2679− &sip, &tip, i, &targets[i],
2680− bond_has_this_ip(bond, tip));
2681− if (sip == targets[i]) {
2682− if (bond_has_this_ip(bond, tip))
2683− slave->last_arp_rx = jiffies;
2684− return;
2685− }
2627+ if (!sip || !bond_has_this_ip(bond, tip)) {
2628+ pr_debug("bva: sip %pI4 tip %pI4 not found\n", &sip, &tip);
2629+ return;
2630+ }
2631+
2632+ i = bond_get_targets_ip(bond->params.arp_targets, sip);
2633+ if (i == -1) {
2634+ pr_debug("bva: sip %pI4 not found in targets\n", &sip);
2635+ return;
26862636 }
2637+ slave->last_arp_rx = jiffies;
2638+ slave->target_last_arp_rx[i] = jiffies;
26872639 }
26882640
26892641 static int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
@@ -2698,6 +2650,10 @@ static int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, · 8 unmodified lines
26982650 return RX_HANDLER_ANOTHER;
26992651
27002652 read_lock(&bond->lock);
2653+
2654+ if (!slave_do_arp_validate(bond, slave))
2655+ goto out_unlock;
2656+
27012657 alen = arp_hdr_len(bond->dev);
27022658
27032659 pr_debug("bond_arp_rcv: bond %s skb->dev %s\n",
@@ -2737,10 +2693,17 @@ static int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, · 33 unmodified lines
27372693 * configuration, the ARP probe will (hopefully) travel from
27382694 * the active, through one switch, the router, then the other
27392695 * switch before reaching the backup.
2696+ *
2697+ * We 'trust' the arp requests if there is an active slave and
2698+ * it received valid arp reply(s) after it became active. This
2699+ * is done to avoid endless looping when we can't reach the
2700+ * arp_ip_target and fool ourselves with our own arp requests.
27402701 */
27412702 if (bond_is_active_slave(slave))
27422703 bond_validate_arp(bond, slave, sip, tip);
2743− else
2704+ else if (bond->curr_active_slave &&
2705+ time_after(slave_last_rx(bond, bond->curr_active_slave),
2706+ bond->curr_active_slave->jiffies))
27442707 bond_validate_arp(bond, slave, tip, sip);
27452708
27462709 out_unlock:
@@ -3225,7 +3188,7 @@ static int bond_slave_netdev_event(unsigned long event, · 478 unmodified lines
32253188
32263189 switch (event) {
32273190 case NETDEV_UNREGISTER:
3228− if (bond->setup_by_slave)
3191+ if (bond_dev->type != ARPHRD_ETHER)
32293192 bond_release_and_destroy(bond_dev, slave_dev);
32303193 else
32313194 bond_release(bond_dev, slave_dev);
@@ -3289,7 +3252,7 @@ static int bond_slave_netdev_event(unsigned long event, · 57 unmodified lines
32893252 static int bond_netdev_event(struct notifier_block *this,
32903253 unsigned long event, void *ptr)
32913254 {
3292− struct net_device *event_dev = (struct net_device *)ptr;
3255+ struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
32933256
32943257 pr_debug("event_dev: %s, event: %lx\n",
32953258 event_dev ? event_dev->name : "None",
@@ -3672,19 +3635,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd · 376 unmodified lines
36723635 return res;
36733636 }
36743637
3675−static bool bond_addr_in_mc_list(unsigned char *addr,
3676− struct netdev_hw_addr_list *list,
3677− int addrlen)
3678−{
3679− struct netdev_hw_addr *ha;
3680−
3681− netdev_hw_addr_list_for_each(ha, list)
3682− if (!memcmp(ha->addr, addr, addrlen))
3683− return true;
3684−
3685− return false;
3686−}
3687−
36883638 static void bond_change_rx_flags(struct net_device *bond_dev, int change)
36893639 {
36903640 struct bonding *bond = netdev_priv(bond_dev);
@@ -3698,35 +3648,29 @@ static void bond_change_rx_flags(struct net_device *bond_dev, int change) · 7 unmodified lines
36983648 bond_dev->flags & IFF_ALLMULTI ? 1 : -1);
36993649 }
37003650
3701−static void bond_set_multicast_list(struct net_device *bond_dev)
3651+static void bond_set_rx_mode(struct net_device *bond_dev)
37023652 {
37033653 struct bonding *bond = netdev_priv(bond_dev);
3704− struct netdev_hw_addr *ha;
3705− bool found;
3654+ struct slave *slave;
3655+ int i;
37063656
37073657 read_lock(&bond->lock);
37083658
3709− /* looking for addresses to add to slaves' mc list */
3710− netdev_for_each_mc_addr(ha, bond_dev) {
3711− found = bond_addr_in_mc_list(ha->addr, &bond->mc_list,
3712− bond_dev->addr_len);
3713− if (!found)
3714− bond_mc_add(bond, ha->addr);
3715− }
3716−
3717− /* looking for addresses to delete from slaves' list */
3718− netdev_hw_addr_list_for_each(ha, &bond->mc_list) {
3719− found = bond_addr_in_mc_list(ha->addr, &bond_dev->mc,
3720− bond_dev->addr_len);
3721− if (!found)
3722− bond_mc_del(bond, ha->addr);
3659+ if (USES_PRIMARY(bond->params.mode)) {
3660+ read_lock(&bond->curr_slave_lock);
3661+ slave = bond->curr_active_slave;
3662+ if (slave) {
3663+ dev_uc_sync(slave->dev, bond_dev);
3664+ dev_mc_sync(slave->dev, bond_dev);
3665+ }
3666+ read_unlock(&bond->curr_slave_lock);
3667+ } else {
3668+ bond_for_each_slave(bond, slave, i) {
3669+ dev_uc_sync_multiple(slave->dev, bond_dev);
3670+ dev_mc_sync_multiple(slave->dev, bond_dev);
3671+ }
37233672 }
37243673
3725− /* save master's multicast list */
3726− __hw_addr_flush(&bond->mc_list);
3727− __hw_addr_add_multiple(&bond->mc_list, &bond_dev->mc,
3728− bond_dev->addr_len, NETDEV_HW_ADDR_T_MULTICAST);
3729−
37303674 read_unlock(&bond->lock);
37313675 }
37323676
@@ -3871,11 +3815,10 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) · 138 unmodified lines
38713815 pr_debug("bond=%p, name=%s\n",
38723816 bond, bond_dev ? bond_dev->name : "None");
38733817
3874− /*
3875− * If fail_over_mac is set to active, do nothing and return
3876− * success. Returning an error causes ifenslave to fail.
3818+ /* If fail_over_mac is enabled, do nothing and return success.
3819+ * Returning an error causes ifenslave to fail.
38773820 */
3878− if (bond->params.fail_over_mac == BOND_FOM_ACTIVE)
3821+ if (bond->params.fail_over_mac)
38793822 return 0;
38803823
38813824 if (!is_valid_ether_addr(sa->sa_data))
@@ -4333,7 +4276,7 @@ static const struct net_device_ops bond_netdev_ops = { · 451 unmodified lines
43334276 .ndo_get_stats64 = bond_get_stats,
43344277 .ndo_do_ioctl = bond_do_ioctl,
43354278 .ndo_change_rx_flags = bond_change_rx_flags,
4336− .ndo_set_rx_mode = bond_set_multicast_list,
4279+ .ndo_set_rx_mode = bond_set_rx_mode,
43374280 .ndo_change_mtu = bond_change_mtu,
43384281 .ndo_set_mac_address = bond_set_mac_address,
43394282 .ndo_neigh_setup = bond_neigh_setup,
@@ -4438,8 +4381,6 @@ static void bond_uninit(struct net_device *bond_dev) · 98 unmodified lines
44384381
44394382 bond_debug_unregister(bond);
44404383
4441− __hw_addr_flush(&bond->mc_list);
4442−
44434384 list_for_each_entry_safe(vlan, tmp, &bond->vlan_list, vlan_list) {
44444385 list_del(&vlan->vlan_list);
44454386 kfree(vlan);
@@ -4484,6 +4425,7 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl) · 38 unmodified lines
44844425 static int bond_check_params(struct bond_params *params)
44854426 {
44864427 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
4428+ int arp_all_targets_value;
44874429
44884430 /*
44894431 * Convert string parameters.
@@ -4674,7 +4616,11 @@ static int bond_check_params(struct bond_params *params) · 184 unmodified lines
46744616 arp_ip_target[i]);
46754617 arp_interval = 0;
46764618 } else {
4677− arp_target[arp_ip_count++] = ip;
4619+ if (bond_get_targets_ip(arp_target, ip) == -1)
4620+ arp_target[arp_ip_count++] = ip;
4621+ else
4622+ pr_warning("Warning: duplicate address %pI4 in arp_ip_target, skipping\n",
4623+ &ip);
46784624 }
46794625 }
46804626
@@ -4705,6 +4651,18 @@ static int bond_check_params(struct bond_params *params) · 24 unmodified lines
47054651 } else
47064652 arp_validate_value = 0;
47074653
4654+ arp_all_targets_value = 0;
4655+ if (arp_all_targets) {
4656+ arp_all_targets_value = bond_parse_parm(arp_all_targets,
4657+ arp_all_targets_tbl);
4658+
4659+ if (arp_all_targets_value == -1) {
4660+ pr_err("Error: invalid arp_all_targets_value \"%s\"\n",
4661+ arp_all_targets);
4662+ arp_all_targets_value = 0;
4663+ }
4664+ }
4665+
47084666 if (miimon) {
47094667 pr_info("MII link monitoring set to %d ms\n", miimon);
47104668 } else if (arp_interval) {
@@ -4769,6 +4727,7 @@ static int bond_check_params(struct bond_params *params) · 58 unmodified lines
47694727 params->num_peer_notif = num_peer_notif;
47704728 params->arp_interval = arp_interval;
47714729 params->arp_validate = arp_validate_value;
4730+ params->arp_all_targets = arp_all_targets_value;
47724731 params->updelay = updelay;
47734732 params->downdelay = downdelay;
47744733 params->use_carrier = use_carrier;
@@ -4845,12 +4804,9 @@ static int bond_init(struct net_device *bond_dev) · 70 unmodified lines
48454804
48464805 /* Ensure valid dev_addr */
48474806 if (is_zero_ether_addr(bond_dev->dev_addr) &&
4848− bond_dev->addr_assign_type == NET_ADDR_PERM) {
4807+ bond_dev->addr_assign_type == NET_ADDR_PERM)
48494808 eth_hw_addr_random(bond_dev);
4850− bond->dev_addr_from_first = true;
4851− }
48524809
4853− __hw_addr_init(&bond->mc_list);
48544810 return 0;
48554811 }
48564812
@@ -4923,7 +4879,7 @@ static int __net_init bond_net_init(struct net *net) · 66 unmodified lines
49234879
49244880 bond_create_proc_dir(bn);
49254881 bond_create_sysfs(bn);
4926−
4882+
49274883 return 0;
49284884 }
49294885
drivers/net/bonding/bond_sysfs.c+85−48
@@ -231,8 +231,7 @@ static ssize_t bonding_show_slaves(struct device *d, · 230 unmodified lines
231231 }
232232
233233 /*
234− * Set the slaves in the current bond. The bond interface must be
235− * up for this to succeed.
234+ * Set the slaves in the current bond.
236235 * This is supposed to be only thin wrapper for bond_enslave and bond_release.
237236 * All hard work should be done there.
238237 */
@@ -363,7 +362,6 @@ static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, · 124 unmodified lines
363362
364363 /*
365364 * Show and set the bonding transmit hash method.
366− * The bond interface must be down to change the xmit hash policy.
367365 */
368366 static ssize_t bonding_show_xmit_hash(struct device *d,
369367 struct device_attribute *attr,
@@ -383,20 +381,12 @@ static ssize_t bonding_store_xmit_hash(struct device *d, · 13 unmodified lines
383381 int new_value, ret = count;
384382 struct bonding *bond = to_bond(d);
385383
386− if (bond->dev->flags & IFF_UP) {
387− pr_err("%s: Interface is up. Unable to update xmit policy.\n",
388− bond->dev->name);
389− ret = -EPERM;
390− goto out;
391− }
392−
393384 new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
394385 if (new_value < 0) {
395386 pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n",
396387 bond->dev->name,
397388 (int)strlen(buf) - 1, buf);
398389 ret = -EINVAL;
399− goto out;
400390 } else {
401391 bond->params.xmit_policy = new_value;
402392 bond_set_mode_ops(bond, bond->params.mode);
@@ -404,7 +394,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, · 1 unmodified line
404394 bond->dev->name,
405395 xmit_hashtype_tbl[new_value].modename, new_value);
406396 }
407−out:
397+
408398 return ret;
409399 }
410400 static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR,
@@ -453,6 +443,44 @@ static ssize_t bonding_store_arp_validate(struct device *d, · 42 unmodified lines
453443
454444 static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate,
455445 bonding_store_arp_validate);
446+/*
447+ * Show and set arp_all_targets.
448+ */
449+static ssize_t bonding_show_arp_all_targets(struct device *d,
450+ struct device_attribute *attr,
451+ char *buf)
452+{
453+ struct bonding *bond = to_bond(d);
454+ int value = bond->params.arp_all_targets;
455+
456+ return sprintf(buf, "%s %d\n", arp_all_targets_tbl[value].modename,
457+ value);
458+}
459+
460+static ssize_t bonding_store_arp_all_targets(struct device *d,
461+ struct device_attribute *attr,
462+ const char *buf, size_t count)
463+{
464+ struct bonding *bond = to_bond(d);
465+ int new_value;
466+
467+ new_value = bond_parse_parm(buf, arp_all_targets_tbl);
468+ if (new_value < 0) {
469+ pr_err("%s: Ignoring invalid arp_all_targets value %s\n",
470+ bond->dev->name, buf);
471+ return -EINVAL;
472+ }
473+ pr_info("%s: setting arp_all_targets to %s (%d).\n",
474+ bond->dev->name, arp_all_targets_tbl[new_value].modename,
475+ new_value);
476+
477+ bond->params.arp_all_targets = new_value;
478+
479+ return count;
480+}
481+
482+static DEVICE_ATTR(arp_all_targets, S_IRUGO | S_IWUSR,
483+ bonding_show_arp_all_targets, bonding_store_arp_all_targets);
456484
457485 /*
458486 * Show and store fail_over_mac. User only allowed to change the
@@ -600,10 +628,11 @@ static ssize_t bonding_store_arp_targets(struct device *d, · 141 unmodified lines
600628 struct device_attribute *attr,
601629 const char *buf, size_t count)
602630 {
603− __be32 newtarget;
604− int i = 0, done = 0, ret = count;
605631 struct bonding *bond = to_bond(d);
606− __be32 *targets;
632+ struct slave *slave;
633+ __be32 newtarget, *targets;
634+ unsigned long *targets_rx;
635+ int ind, i, j, ret = -EINVAL;
607636
608637 targets = bond->params.arp_targets;
609638 newtarget = in_aton(buf + 1);
@@ -612,57 +641,63 @@ static ssize_t bonding_store_arp_targets(struct device *d, · 2 unmodified lines
612641 if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) {
613642 pr_err("%s: invalid ARP target %pI4 specified for addition\n",
614643 bond->dev->name, &newtarget);
615− ret = -EINVAL;
616644 goto out;
617645 }
618− /* look for an empty slot to put the target in, and check for dupes */
619− for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
620− if (targets[i] == newtarget) { /* duplicate */
621− pr_err("%s: ARP target %pI4 is already present\n",
622− bond->dev->name, &newtarget);
623− ret = -EINVAL;
624− goto out;
625− }
626− if (targets[i] == 0) {
627− pr_info("%s: adding ARP target %pI4.\n",
628− bond->dev->name, &newtarget);
629− done = 1;
630− targets[i] = newtarget;
631− }
646+
647+ if (bond_get_targets_ip(targets, newtarget) != -1) { /* dup */
648+ pr_err("%s: ARP target %pI4 is already present\n",
649+ bond->dev->name, &newtarget);
650+ goto out;
632651 }
633− if (!done) {
652+
653+ ind = bond_get_targets_ip(targets, 0); /* first free slot */
654+ if (ind == -1) {
634655 pr_err("%s: ARP target table is full!\n",
635656 bond->dev->name);
636− ret = -EINVAL;
637657 goto out;
638658 }
639659
660+ pr_info("%s: adding ARP target %pI4.\n", bond->dev->name,
661+ &newtarget);
662+ /* not to race with bond_arp_rcv */
663+ write_lock_bh(&bond->lock);
664+ bond_for_each_slave(bond, slave, i)
665+ slave->target_last_arp_rx[ind] = jiffies;
666+ targets[ind] = newtarget;
667+ write_unlock_bh(&bond->lock);
640668 } else if (buf[0] == '-') {
641669 if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) {
642670 pr_err("%s: invalid ARP target %pI4 specified for removal\n",
643671 bond->dev->name, &newtarget);
644− ret = -EINVAL;
645672 goto out;
646673 }
647674
648− for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
649− if (targets[i] == newtarget) {
650− int j;
651− pr_info("%s: removing ARP target %pI4.\n",
652− bond->dev->name, &newtarget);
653− for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++)
654− targets[j] = targets[j+1];
655−
656− targets[j] = 0;
657− done = 1;
658− }
659− }
660− if (!done) {
661− pr_info("%s: unable to remove nonexistent ARP target %pI4.\n",
675+ ind = bond_get_targets_ip(targets, newtarget);
676+ if (ind == -1) {
677+ pr_err("%s: unable to remove nonexistent ARP target %pI4.\n",
662678 bond->dev->name, &newtarget);
663− ret = -EINVAL;
664679 goto out;
665680 }
681+
682+ if (ind == 0 && !targets[1] && bond->params.arp_interval)
683+ pr_warn("%s: removing last arp target with arp_interval on\n",
684+ bond->dev->name);
685+
686+ pr_info("%s: removing ARP target %pI4.\n", bond->dev->name,
687+ &newtarget);
688+
689+ write_lock_bh(&bond->lock);
690+ bond_for_each_slave(bond, slave, i) {
691+ targets_rx = slave->target_last_arp_rx;
692+ j = ind;
693+ for (; (j < BOND_MAX_ARP_TARGETS-1) && targets[j+1]; j++)
694+ targets_rx[j] = targets_rx[j+1];
695+ targets_rx[j] = 0;
696+ }
697+ for (i = ind; (i < BOND_MAX_ARP_TARGETS-1) && targets[i+1]; i++)
698+ targets[i] = targets[i+1];
699+ targets[i] = 0;
700+ write_unlock_bh(&bond->lock);
666701 } else {
667702 pr_err("no command found in arp_ip_targets file for bond %s. Use +<addr> or -<addr>.\n",
668703 bond->dev->name);
@@ -670,6 +705,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, · 1 unmodified line
670705 goto out;
671706 }
672707
708+ ret = count;
673709 out:
674710 return ret;
675711 }
@@ -1645,6 +1681,7 @@ static struct attribute *per_bond_attrs[] = { · 969 unmodified lines
16451681 &dev_attr_mode.attr,
16461682 &dev_attr_fail_over_mac.attr,
16471683 &dev_attr_arp_validate.attr,
1684+ &dev_attr_arp_all_targets.attr,
16481685 &dev_attr_arp_interval.attr,
16491686 &dev_attr_arp_ip_target.attr,
16501687 &dev_attr_downdelay.attr,
drivers/net/bonding/bonding.h+44−5
@@ -144,6 +144,7 @@ struct bond_params { · 143 unmodified lines
144144 u8 num_peer_notif;
145145 int arp_interval;
146146 int arp_validate;
147+ int arp_all_targets;
147148 int use_carrier;
148149 int fail_over_mac;
149150 int updelay;
@@ -179,6 +180,7 @@ struct slave { · 29 unmodified lines
179180 int delay;
180181 unsigned long jiffies;
181182 unsigned long last_arp_rx;
183+ unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
182184 s8 link; /* one of BOND_LINK_XXXX */
183185 s8 new_link;
184186 u8 backup:1, /* indicates backup slave. Value corresponds with
@@ -224,14 +226,12 @@ struct bonding { · 39 unmodified lines
224226 rwlock_t lock;
225227 rwlock_t curr_slave_lock;
226228 u8 send_peer_notif;
227− s8 setup_by_slave;
228229 u8 igmp_retrans;
229230 #ifdef CONFIG_PROC_FS
230231 struct proc_dir_entry *proc_entry;
231232 char proc_file_name[IFNAMSIZ];
232233 #endif /* CONFIG_PROC_FS */
233234 struct list_head bond_list;
234− struct netdev_hw_addr_list mc_list;
235235 int (*xmit_hash_policy)(struct sk_buff *, int);
236236 u16 rr_tx_counter;
237237 struct ad_bond_info ad_info;
@@ -248,7 +248,6 @@ struct bonding { · 10 unmodified lines
248248 /* debugging support via debugfs */
249249 struct dentry *debug_dir;
250250 #endif /* CONFIG_DEBUG_FS */
251− bool dev_addr_from_first;
252251 };
253252
254253 static inline bool bond_vlan_used(struct bonding *bond)
@@ -323,6 +322,9 @@ static inline bool bond_is_active_slave(struct slave *slave) · 68 unmodified lines
323322 #define BOND_FOM_ACTIVE 1
324323 #define BOND_FOM_FOLLOW 2
325324
325+#define BOND_ARP_TARGETS_ANY 0
326+#define BOND_ARP_TARGETS_ALL 1
327+
326328 #define BOND_ARP_VALIDATE_NONE 0
327329 #define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE)
328330 #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP)
@@ -335,11 +337,31 @@ static inline int slave_do_arp_validate(struct bonding *bond, · 6 unmodified lines
335337 return bond->params.arp_validate & (1 << bond_slave_state(slave));
336338 }
337339
340+/* Get the oldest arp which we've received on this slave for bond's
341+ * arp_targets.
342+ */
343+static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
344+ struct slave *slave)
345+{
346+ int i = 1;
347+ unsigned long ret = slave->target_last_arp_rx[0];
348+
349+ for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++)
350+ if (time_before(slave->target_last_arp_rx[i], ret))
351+ ret = slave->target_last_arp_rx[i];
352+
353+ return ret;
354+}
355+
338356 static inline unsigned long slave_last_rx(struct bonding *bond,
339357 struct slave *slave)
340358 {
341− if (slave_do_arp_validate(bond, slave))
342− return slave->last_arp_rx;
359+ if (slave_do_arp_validate(bond, slave)) {
360+ if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
361+ return slave_oldest_target_arp_rx(bond, slave);
362+ else
363+ return slave->last_arp_rx;
364+ }
343365
344366 return slave->dev->last_rx;
345367 }
@@ -465,12 +487,29 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond, · 119 unmodified lines
465487 return NULL;
466488 }
467489
490+/* Check if the ip is present in arp ip list, or first free slot if ip == 0
491+ * Returns -1 if not found, index if found
492+ */
493+static inline int bond_get_targets_ip(__be32 *targets, __be32 ip)
494+{
495+ int i;
496+
497+ for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
498+ if (targets[i] == ip)
499+ return i;
500+ else if (targets[i] == 0)
501+ break;
502+
503+ return -1;
504+}
505+
468506 /* exported from bond_main.c */
469507 extern int bond_net_id;
470508 extern const struct bond_parm_tbl bond_lacp_tbl[];
471509 extern const struct bond_parm_tbl bond_mode_tbl[];
472510 extern const struct bond_parm_tbl xmit_hashtype_tbl[];
473511 extern const struct bond_parm_tbl arp_validate_tbl[];
512+extern const struct bond_parm_tbl arp_all_targets_tbl[];
474513 extern const struct bond_parm_tbl fail_over_mac_tbl[];
475514 extern const struct bond_parm_tbl pri_reselect_tbl[];
476515 extern struct bond_parm_tbl ad_select_tbl[];
drivers/net/caif/caif_serial.c+39−22
@@ -35,8 +35,9 @@ MODULE_ALIAS_LDISC(N_CAIF); · 34 unmodified lines
3535 #define OFF 0
3636 #define CAIF_MAX_MTU 4096
3737
38−/*This list is protected by the rtnl lock. */
38+static DEFINE_SPINLOCK(ser_lock);
3939 static LIST_HEAD(ser_list);
40+static LIST_HEAD(ser_release_list);
4041
4142 static bool ser_loop;
4243 module_param(ser_loop, bool, S_IRUGO);
@@ -308,6 +309,28 @@ static void ldisc_tx_wakeup(struct tty_struct *tty) · 265 unmodified lines
308309 }
309310
310311
312+static void ser_release(struct work_struct *work)
313+{
314+ struct list_head list;
315+ struct ser_device *ser, *tmp;
316+
317+ spin_lock(&ser_lock);
318+ list_replace_init(&ser_release_list, &list);
319+ spin_unlock(&ser_lock);
320+
321+ if (!list_empty(&list)) {
322+ rtnl_lock();
323+ list_for_each_entry_safe(ser, tmp, &list, node) {
324+ dev_close(ser->dev);
325+ unregister_netdevice(ser->dev);
326+ debugfs_deinit(ser);
327+ }
328+ rtnl_unlock();
329+ }
330+}
331+
332+static DECLARE_WORK(ser_release_work, ser_release);
333+
311334 static int ldisc_open(struct tty_struct *tty)
312335 {
313336 struct ser_device *ser;
@@ -321,6 +344,9 @@ static int ldisc_open(struct tty_struct *tty) · 7 unmodified lines
321344 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_TTY_CONFIG))
322345 return -EPERM;
323346
347+ /* release devices to avoid name collision */
348+ ser_release(NULL);
349+
324350 sprintf(name, "cf%s", tty->name);
325351 dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
326352 if (!dev)
@@ -341,7 +367,9 @@ static int ldisc_open(struct tty_struct *tty) · 14 unmodified lines
341367 return -ENODEV;
342368 }
343369
370+ spin_lock(&ser_lock);
344371 list_add(&ser->node, &ser_list);
372+ spin_unlock(&ser_lock);
345373 rtnl_unlock();
346374 netif_stop_queue(dev);
347375 update_tty_status(ser);
@@ -351,19 +379,13 @@ static int ldisc_open(struct tty_struct *tty) · 3 unmodified lines
351379 static void ldisc_close(struct tty_struct *tty)
352380 {
353381 struct ser_device *ser = tty->disc_data;
354− /* Remove may be called inside or outside of rtnl_lock */
355− int islocked = rtnl_is_locked();
356382
357− if (!islocked)
358− rtnl_lock();
359− /* device is freed automagically by net-sysfs */
360− dev_close(ser->dev);
361− unregister_netdevice(ser->dev);
362− list_del(&ser->node);
363− debugfs_deinit(ser);
364383 tty_kref_put(ser->tty);
365− if (!islocked)
366− rtnl_unlock();
384+
385+ spin_lock(&ser_lock);
386+ list_move(&ser->node, &ser_release_list);
387+ spin_unlock(&ser_lock);
388+ schedule_work(&ser_release_work);
367389 }
368390
369391 /* The line discipline structure. */
@@ -438,16 +460,11 @@ static int __init caif_ser_init(void) · 68 unmodified lines
438460
439461 static void __exit caif_ser_exit(void)
440462 {
441− struct ser_device *ser = NULL;
442− struct list_head *node;
443− struct list_head *_tmp;
444−
445− list_for_each_safe(node, _tmp, &ser_list) {
446− ser = list_entry(node, struct ser_device, node);
447− dev_close(ser->dev);
448− unregister_netdevice(ser->dev);
449− list_del(node);
450− }
463+ spin_lock(&ser_lock);
464+ list_splice(&ser_list, &ser_release_list);
465+ spin_unlock(&ser_lock);
466+ ser_release(NULL);
467+ cancel_work_sync(&ser_release_work);
451468 tty_unregister_ldisc(N_CAIF);
452469 debugfs_remove_recursive(debugfsdir);
453470 }
drivers/net/can/Kconfig+1−4
@@ -102,12 +102,9 @@ config CAN_JANZ_ICAN3 · 101 unmodified lines
102102 This driver can also be built as a module. If so, the module will be
103103 called janz-ican3.ko.
104104
105−config HAVE_CAN_FLEXCAN
106− bool
107−
108105 config CAN_FLEXCAN
109106 tristate "Support for Freescale FLEXCAN based chips"
110− depends on HAVE_CAN_FLEXCAN
107+ depends on ARM || PPC
111108 ---help---
112109 Say Y here if you want to support for Freescale FlexCAN.
113110
drivers/net/can/at91_can.c+2−6
@@ -1220,7 +1220,7 @@ static ssize_t at91_sysfs_set_mb0_id(struct device *dev, · 1219 unmodified lines
12201220 goto out;
12211221 }
12221222
1223− err = strict_strtoul(buf, 0, &can_id);
1223+ err = kstrtoul(buf, 0, &can_id);
12241224 if (err) {
12251225 ret = err;
12261226 goto out;
@@ -1264,8 +1264,6 @@ static const struct of_device_id at91_can_dt_ids[] = { · 37 unmodified lines
12641264 }
12651265 };
12661266 MODULE_DEVICE_TABLE(of, at91_can_dt_ids);
1267−#else
1268−#define at91_can_dt_ids NULL
12691267 #endif
12701268
12711269 static const struct at91_devtype_data *at91_can_get_driver_data(struct platform_device *pdev)
@@ -1393,8 +1391,6 @@ static int at91_can_remove(struct platform_device *pdev) · 121 unmodified lines
13931391
13941392 unregister_netdev(dev);
13951393
1396− platform_set_drvdata(pdev, NULL);
1397−
13981394 iounmap(priv->reg_base);
13991395
14001396 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1426,7 +1422,7 @@ static struct platform_driver at91_can_driver = { · 25 unmodified lines
14261422 .driver = {
14271423 .name = KBUILD_MODNAME,
14281424 .owner = THIS_MODULE,
1429− .of_match_table = at91_can_dt_ids,
1425+ .of_match_table = of_match_ptr(at91_can_dt_ids),
14301426 },
14311427 .id_table = at91_can_id_table,
14321428 };
drivers/net/can/bfin_can.c+4−6
@@ -580,7 +580,7 @@ static int bfin_can_probe(struct platform_device *pdev) · 579 unmodified lines
580580 priv->pin_list = pdata;
581581 priv->can.clock.freq = get_sclk();
582582
583− dev_set_drvdata(&pdev->dev, dev);
583+ platform_set_drvdata(pdev, dev);
584584 SET_NETDEV_DEV(dev, &pdev->dev);
585585
586586 dev->flags |= IFF_ECHO; /* we support local echo */
@@ -613,7 +613,7 @@ exit: · 26 unmodified lines
613613
614614 static int bfin_can_remove(struct platform_device *pdev)
615615 {
616− struct net_device *dev = dev_get_drvdata(&pdev->dev);
616+ struct net_device *dev = platform_get_drvdata(pdev);
617617 struct bfin_can_priv *priv = netdev_priv(dev);
618618 struct resource *res;
619619
@@ -621,8 +621,6 @@ static int bfin_can_remove(struct platform_device *pdev) · 1 unmodified line
621621
622622 unregister_candev(dev);
623623
624− dev_set_drvdata(&pdev->dev, NULL);
625−
626624 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
627625 release_mem_region(res->start, resource_size(res));
628626
@@ -635,7 +633,7 @@ static int bfin_can_remove(struct platform_device *pdev) · 6 unmodified lines
635633 #ifdef CONFIG_PM
636634 static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
637635 {
638− struct net_device *dev = dev_get_drvdata(&pdev->dev);
636+ struct net_device *dev = platform_get_drvdata(pdev);
639637 struct bfin_can_priv *priv = netdev_priv(dev);
640638 struct bfin_can_regs __iomem *reg = priv->membase;
641639 int timeout = BFIN_CAN_TIMEOUT;
@@ -658,7 +656,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg) · 16 unmodified lines
658656
659657 static int bfin_can_resume(struct platform_device *pdev)
660658 {
661− struct net_device *dev = dev_get_drvdata(&pdev->dev);
659+ struct net_device *dev = platform_get_drvdata(pdev);
662660 struct bfin_can_priv *priv = netdev_priv(dev);
663661 struct bfin_can_regs __iomem *reg = priv->membase;
664662
drivers/net/can/c_can/c_can_platform.c+2−4
@@ -201,8 +201,8 @@ static int c_can_plat_probe(struct platform_device *pdev) · 200 unmodified lines
201201 priv->instance = pdev->id;
202202
203203 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
204− priv->raminit_ctrlreg = devm_request_and_ioremap(&pdev->dev, res);
205− if (!priv->raminit_ctrlreg || priv->instance < 0)
204+ priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
205+ if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
206206 dev_info(&pdev->dev, "control memory is not used for raminit\n");
207207 else
208208 priv->raminit = c_can_hw_raminit;
@@ -234,7 +234,6 @@ static int c_can_plat_probe(struct platform_device *pdev) · 25 unmodified lines
234234 return 0;
235235
236236 exit_free_device:
237− platform_set_drvdata(pdev, NULL);
238237 free_c_can_dev(dev);
239238 exit_iounmap:
240239 iounmap(addr);
@@ -255,7 +254,6 @@ static int c_can_plat_remove(struct platform_device *pdev) · 14 unmodified lines
255254 struct resource *mem;
256255
257256 unregister_c_can_dev(dev);
258− platform_set_drvdata(pdev, NULL);
259257
260258 free_c_can_dev(dev);
261259 iounmap(priv->base);
drivers/net/can/cc770/cc770_isa.c+2−3
@@ -265,7 +265,7 @@ static int cc770_isa_probe(struct platform_device *pdev) · 264 unmodified lines
265265 else
266266 priv->clkout = COR_DEFAULT;
267267
268− dev_set_drvdata(&pdev->dev, dev);
268+ platform_set_drvdata(pdev, dev);
269269 SET_NETDEV_DEV(dev, &pdev->dev);
270270
271271 err = register_cc770dev(dev);
@@ -293,12 +293,11 @@ static int cc770_isa_probe(struct platform_device *pdev) · 21 unmodified lines
293293
294294 static int cc770_isa_remove(struct platform_device *pdev)
295295 {
296− struct net_device *dev = dev_get_drvdata(&pdev->dev);
296+ struct net_device *dev = platform_get_drvdata(pdev);
297297 struct cc770_priv *priv = netdev_priv(dev);
298298 int idx = pdev->id;
299299
300300 unregister_cc770dev(dev);
301− dev_set_drvdata(&pdev->dev, NULL);
302301
303302 if (mem[idx]) {
304303 iounmap(priv->reg_base);
drivers/net/can/cc770/cc770_platform.c+2−2
@@ -216,7 +216,7 @@ static int cc770_platform_probe(struct platform_device *pdev) · 215 unmodified lines
216216 priv->reg_base, dev->irq, priv->can.clock.freq,
217217 priv->cpu_interface, priv->bus_config, priv->clkout);
218218
219− dev_set_drvdata(&pdev->dev, dev);
219+ platform_set_drvdata(pdev, dev);
220220 SET_NETDEV_DEV(dev, &pdev->dev);
221221
222222 err = register_cc770dev(dev);
@@ -240,7 +240,7 @@ exit_release_mem: · 17 unmodified lines
240240
241241 static int cc770_platform_remove(struct platform_device *pdev)
242242 {
243− struct net_device *dev = dev_get_drvdata(&pdev->dev);
243+ struct net_device *dev = platform_get_drvdata(pdev);
244244 struct cc770_priv *priv = netdev_priv(dev);
245245 struct resource *mem;
246246
drivers/net/can/flexcan.c+22−30
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include <linux/can/dev.h>
2525 #include <linux/can/error.h>
2626 #include <linux/can/led.h>
27−#include <linux/can/platform/flexcan.h>
2827 #include <linux/clk.h>
2928 #include <linux/delay.h>
3029 #include <linux/if_arp.h>
@@ -37,7 +36,7 @@ · 6 unmodified lines
3736 #include <linux/of.h>
3837 #include <linux/of_device.h>
3938 #include <linux/platform_device.h>
40−#include <linux/pinctrl/consumer.h>
39+#include <linux/regulator/consumer.h>
4140
4241 #define DRV_NAME "flexcan"
4342
@@ -212,6 +211,7 @@ struct flexcan_priv { · 168 unmodified lines
212211 struct clk *clk_per;
213212 struct flexcan_platform_data *pdata;
214213 const struct flexcan_devtype_data *devtype_data;
214+ struct regulator *reg_xceiver;
215215 };
216216
217217 static struct flexcan_devtype_data fsl_p1010_devtype_data = {
@@ -259,15 +259,6 @@ static inline void flexcan_write(u32 val, void __iomem *addr) · 41 unmodified lines
259259 }
260260 #endif
261261
262−/*
263− * Swtich transceiver on or off
264− */
265−static void flexcan_transceiver_switch(const struct flexcan_priv *priv, int on)
266−{
267− if (priv->pdata && priv->pdata->transceiver_switch)
268− priv->pdata->transceiver_switch(on);
269−}
270−
271262 static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv,
272263 u32 reg_esr)
273264 {
@@ -800,7 +791,11 @@ static int flexcan_chip_start(struct net_device *dev) · 526 unmodified lines
800791 if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES)
801792 flexcan_write(0x0, &regs->rxfgmask);
802793
803− flexcan_transceiver_switch(priv, 1);
794+ if (priv->reg_xceiver) {
795+ err = regulator_enable(priv->reg_xceiver);
796+ if (err)
797+ goto out;
798+ }
804799
805800 /* synchronize with the can bus */
806801 reg_mcr = flexcan_read(&regs->mcr);
@@ -843,7 +838,8 @@ static void flexcan_chip_stop(struct net_device *dev) · 36 unmodified lines
843838 reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT;
844839 flexcan_write(reg, &regs->mcr);
845840
846− flexcan_transceiver_switch(priv, 0);
841+ if (priv->reg_xceiver)
842+ regulator_disable(priv->reg_xceiver);
847843 priv->can.state = CAN_STATE_STOPPED;
848844
849845 return;
@@ -1004,16 +1000,11 @@ static int flexcan_probe(struct platform_device *pdev) · 154 unmodified lines
10041000 struct flexcan_priv *priv;
10051001 struct resource *mem;
10061002 struct clk *clk_ipg = NULL, *clk_per = NULL;
1007− struct pinctrl *pinctrl;
10081003 void __iomem *base;
10091004 resource_size_t mem_size;
10101005 int err, irq;
10111006 u32 clock_freq = 0;
10121007
1013− pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
1014− if (IS_ERR(pinctrl))
1015− return PTR_ERR(pinctrl);
1016−
10171008 if (pdev->dev.of_node)
10181009 of_property_read_u32(pdev->dev.of_node,
10191010 "clock-frequency", &clock_freq);
@@ -1090,6 +1081,10 @@ static int flexcan_probe(struct platform_device *pdev) · 70 unmodified lines
10901081 priv->pdata = pdev->dev.platform_data;
10911082 priv->devtype_data = devtype_data;
10921083
1084+ priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
1085+ if (IS_ERR(priv->reg_xceiver))
1086+ priv->reg_xceiver = NULL;
1087+
10931088 netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT);
10941089
10951090 dev_set_drvdata(&pdev->dev, dev);
@@ -1127,7 +1122,6 @@ static int flexcan_remove(struct platform_device *pdev) · 31 unmodified lines
11271122 struct resource *mem;
11281123
11291124 unregister_flexcandev(dev);
1130− platform_set_drvdata(pdev, NULL);
11311125 iounmap(priv->base);
11321126
11331127 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1138,10 +1132,10 @@ static int flexcan_remove(struct platform_device *pdev) · 4 unmodified lines
11381132 return 0;
11391133 }
11401134
1141−#ifdef CONFIG_PM
1142−static int flexcan_suspend(struct platform_device *pdev, pm_message_t state)
1135+#ifdef CONFIG_PM_SLEEP
1136+static int flexcan_suspend(struct device *device)
11431137 {
1144− struct net_device *dev = platform_get_drvdata(pdev);
1138+ struct net_device *dev = dev_get_drvdata(device);
11451139 struct flexcan_priv *priv = netdev_priv(dev);
11461140
11471141 flexcan_chip_disable(priv);
@@ -1155,9 +1149,9 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) · 7 unmodified lines
11551149 return 0;
11561150 }
11571151
1158−static int flexcan_resume(struct platform_device *pdev)
1152+static int flexcan_resume(struct device *device)
11591153 {
1160− struct net_device *dev = platform_get_drvdata(pdev);
1154+ struct net_device *dev = dev_get_drvdata(device);
11611155 struct flexcan_priv *priv = netdev_priv(dev);
11621156
11631157 priv->can.state = CAN_STATE_ERROR_ACTIVE;
@@ -1169,21 +1163,19 @@ static int flexcan_resume(struct platform_device *pdev) · 5 unmodified lines
11691163
11701164 return 0;
11711165 }
1172−#else
1173−#define flexcan_suspend NULL
1174−#define flexcan_resume NULL
1175−#endif
1166+#endif /* CONFIG_PM_SLEEP */
1167+
1168+static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume);
11761169
11771170 static struct platform_driver flexcan_driver = {
11781171 .driver = {
11791172 .name = DRV_NAME,
11801173 .owner = THIS_MODULE,
1174+ .pm = &flexcan_pm_ops,
11811175 .of_match_table = flexcan_of_match,
11821176 },
11831177 .probe = flexcan_probe,
11841178 .remove = flexcan_remove,
1185− .suspend = flexcan_suspend,
1186− .resume = flexcan_resume,
11871179 .id_table = flexcan_id_table,
11881180 };
11891181
drivers/net/can/grcan.c+5−7
@@ -1646,7 +1646,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev, · 1645 unmodified lines
16461646 if (err)
16471647 goto exit_free_candev;
16481648
1649− dev_set_drvdata(&ofdev->dev, dev);
1649+ platform_set_drvdata(ofdev, dev);
16501650
16511651 /* Reset device to allow bit-timing to be set. No need to call
16521652 * grcan_reset at this stage. That is done in grcan_open.
@@ -1683,10 +1683,9 @@ static int grcan_probe(struct platform_device *ofdev) · 30 unmodified lines
16831683 }
16841684
16851685 res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
1686− base = devm_request_and_ioremap(&ofdev->dev, res);
1687− if (!base) {
1688− dev_err(&ofdev->dev, "couldn't map IO resource\n");
1689− err = -EADDRNOTAVAIL;
1686+ base = devm_ioremap_resource(&ofdev->dev, res);
1687+ if (IS_ERR(base)) {
1688+ err = PTR_ERR(base);
16901689 goto exit_error;
16911690 }
16921691
@@ -1716,13 +1715,12 @@ exit_error: · 23 unmodified lines
17161715
17171716 static int grcan_remove(struct platform_device *ofdev)
17181717 {
1719− struct net_device *dev = dev_get_drvdata(&ofdev->dev);
1718+ struct net_device *dev = platform_get_drvdata(ofdev);
17201719 struct grcan_priv *priv = netdev_priv(dev);
17211720
17221721 unregister_candev(dev); /* Will in turn call grcan_close */
17231722
17241723 irq_dispose_mapping(dev->irq);
1725− dev_set_drvdata(&ofdev->dev, NULL);
17261724 netif_napi_del(&priv->napi);
17271725 free_candev(dev);
17281726
drivers/net/can/janz-ican3.c+1−1
@@ -1734,7 +1734,7 @@ static ssize_t ican3_sysfs_set_term(struct device *dev, · 1733 unmodified lines
17341734 unsigned long enable;
17351735 int ret;
17361736
1737− if (strict_strtoul(buf, 0, &enable))
1737+ if (kstrtoul(buf, 0, &enable))
17381738 return -EINVAL;
17391739
17401740 ret = ican3_set_termination(mod, enable);
drivers/net/can/led.c+2−2
@@ -88,9 +88,9 @@ EXPORT_SYMBOL_GPL(devm_can_led_init); · 87 unmodified lines
8888
8989 /* NETDEV rename notifier to rename the associated led triggers too */
9090 static int can_led_notifier(struct notifier_block *nb, unsigned long msg,
91− void *data)
91+ void *ptr)
9292 {
93− struct net_device *netdev = data;
93+ struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
9494 struct can_priv *priv = safe_candev_priv(netdev);
9595 char name[CAN_LED_NAME_SZ];
9696
drivers/net/can/mscan/mpc5xxx_can.c+4−6
@@ -302,7 +302,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) · 301 unmodified lines
302302 goto exit_free_mscan;
303303 }
304304
305− dev_set_drvdata(&ofdev->dev, dev);
305+ platform_set_drvdata(ofdev, dev);
306306
307307 dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
308308 priv->reg_base, dev->irq, priv->can.clock.freq);
@@ -321,11 +321,9 @@ exit_unmap_mem: · 12 unmodified lines
321321
322322 static int mpc5xxx_can_remove(struct platform_device *ofdev)
323323 {
324− struct net_device *dev = dev_get_drvdata(&ofdev->dev);
324+ struct net_device *dev = platform_get_drvdata(ofdev);
325325 struct mscan_priv *priv = netdev_priv(dev);
326326
327− dev_set_drvdata(&ofdev->dev, NULL);
328−
329327 unregister_mscandev(dev);
330328 iounmap(priv->reg_base);
331329 irq_dispose_mapping(dev->irq);
@@ -338,7 +336,7 @@ static int mpc5xxx_can_remove(struct platform_device *ofdev) · 6 unmodified lines
338336 static struct mscan_regs saved_regs;
339337 static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state)
340338 {
341− struct net_device *dev = dev_get_drvdata(&ofdev->dev);
339+ struct net_device *dev = platform_get_drvdata(ofdev);
342340 struct mscan_priv *priv = netdev_priv(dev);
343341 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
344342
@@ -349,7 +347,7 @@ static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state · 4 unmodified lines
349347
350348 static int mpc5xxx_can_resume(struct platform_device *ofdev)
351349 {
352− struct net_device *dev = dev_get_drvdata(&ofdev->dev);
350+ struct net_device *dev = platform_get_drvdata(ofdev);
353351 struct mscan_priv *priv = netdev_priv(dev);
354352 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
355353
drivers/net/can/sja1000/sja1000_isa.c+2−3
@@ -197,7 +197,7 @@ static int sja1000_isa_probe(struct platform_device *pdev) · 196 unmodified lines
197197 else
198198 priv->cdr = CDR_DEFAULT;
199199
200− dev_set_drvdata(&pdev->dev, dev);
200+ platform_set_drvdata(pdev, dev);
201201 SET_NETDEV_DEV(dev, &pdev->dev);
202202
203203 err = register_sja1000dev(dev);
@@ -225,12 +225,11 @@ static int sja1000_isa_probe(struct platform_device *pdev) · 21 unmodified lines
225225
226226 static int sja1000_isa_remove(struct platform_device *pdev)
227227 {
228− struct net_device *dev = dev_get_drvdata(&pdev->dev);
228+ struct net_device *dev = platform_get_drvdata(pdev);
229229 struct sja1000_priv *priv = netdev_priv(dev);
230230 int idx = pdev->id;
231231
232232 unregister_sja1000dev(dev);
233− dev_set_drvdata(&pdev->dev, NULL);
234233
235234 if (mem[idx]) {
236235 iounmap(priv->reg_base);
drivers/net/can/sja1000/sja1000_of_platform.c+2−4
@@ -72,13 +72,11 @@ static void sja1000_ofp_write_reg(const struct sja1000_priv *priv, · 71 unmodified lines
7272
7373 static int sja1000_ofp_remove(struct platform_device *ofdev)
7474 {
75− struct net_device *dev = dev_get_drvdata(&ofdev->dev);
75+ struct net_device *dev = platform_get_drvdata(ofdev);
7676 struct sja1000_priv *priv = netdev_priv(dev);
7777 struct device_node *np = ofdev->dev.of_node;
7878 struct resource res;
7979
80− dev_set_drvdata(&ofdev->dev, NULL);
81−
8280 unregister_sja1000dev(dev);
8381 free_sja1000dev(dev);
8482 iounmap(priv->reg_base);
@@ -181,7 +179,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) · 96 unmodified lines
181179 priv->reg_base, dev->irq, priv->can.clock.freq,
182180 priv->ocr, priv->cdr);
183181
184− dev_set_drvdata(&ofdev->dev, dev);
182+ platform_set_drvdata(ofdev, dev);
185183 SET_NETDEV_DEV(dev, &ofdev->dev);
186184
187185 err = register_sja1000dev(dev);
drivers/net/can/sja1000/sja1000_platform.c+2−3
@@ -135,7 +135,7 @@ static int sp_probe(struct platform_device *pdev) · 134 unmodified lines
135135 break;
136136 }
137137
138− dev_set_drvdata(&pdev->dev, dev);
138+ platform_set_drvdata(pdev, dev);
139139 SET_NETDEV_DEV(dev, &pdev->dev);
140140
141141 err = register_sja1000dev(dev);
@@ -161,12 +161,11 @@ static int sp_probe(struct platform_device *pdev) · 19 unmodified lines
161161
162162 static int sp_remove(struct platform_device *pdev)
163163 {
164− struct net_device *dev = dev_get_drvdata(&pdev->dev);
164+ struct net_device *dev = platform_get_drvdata(pdev);
165165 struct sja1000_priv *priv = netdev_priv(dev);
166166 struct resource *res;
167167
168168 unregister_sja1000dev(dev);
169− dev_set_drvdata(&pdev->dev, NULL);
170169
171170 if (priv->reg_base)
172171 iounmap(priv->reg_base);
drivers/net/can/slcan.c+1−1
@@ -161,7 +161,7 @@ static void slc_bump(struct slcan *sl) · 160 unmodified lines
161161
162162 sl->rbuff[dlc_pos] = 0; /* terminate can_id string */
163163
164− if (strict_strtoul(sl->rbuff+1, 16, &ultmp))
164+ if (kstrtoul(sl->rbuff+1, 16, &ultmp))
165165 return;
166166
167167 cf.can_id = ultmp;
drivers/net/can/softing/softing_main.c+1−1
@@ -594,7 +594,7 @@ static ssize_t store_output(struct device *dev, struct device_attribute *attr, · 593 unmodified lines
594594 unsigned long val;
595595 int ret;
596596
597− ret = strict_strtoul(buf, 0, &val);
597+ ret = kstrtoul(buf, 0, &val);
598598 if (ret < 0)
599599 return ret;
600600 val &= 0xFF;
drivers/net/can/ti_hecc.c+0−1
@@ -1001,7 +1001,6 @@ static int ti_hecc_remove(struct platform_device *pdev) · 1000 unmodified lines
10011001 iounmap(priv->base);
10021002 release_mem_region(res->start, resource_size(res));
10031003 free_candev(ndev);
1004− platform_set_drvdata(pdev, NULL);
10051004
10061005 return 0;
10071006 }
drivers/net/ethernet/3com/3c509.c+0−19
@@ -723,25 +723,6 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev) · 722 unmodified lines
723723 pr_debug("%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
724724 dev->name, skb->len, inw(ioaddr + EL3_STATUS));
725725 }
726−#if 0
727−#ifndef final_version
728− { /* Error-checking code, delete someday. */
729− ushort status = inw(ioaddr + EL3_STATUS);
730− if (status & 0x0001 && /* IRQ line active, missed one. */
731− inw(ioaddr + EL3_STATUS) & 1) { /* Make sure. */
732− pr_debug("%s: Missed interrupt, status then %04x now %04x"
733− " Tx %2.2x Rx %4.4x.\n", dev->name, status,
734− inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS),
735− inw(ioaddr + RX_STATUS));
736− /* Fake interrupt trigger by masking, acknowledge interrupts. */
737− outw(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
738− outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
739− ioaddr + EL3_CMD);
740− outw(SetStatusEnb | 0xff, ioaddr + EL3_CMD);
741− }
742− }
743−#endif
744−#endif
745726 /*
746727 * We lock the driver against other processors. Note
747728 * we don't need to lock versus the IRQ as we suspended
drivers/net/ethernet/3com/3c59x.c+20−22
@@ -1012,10 +1012,8 @@ static int vortex_init_one(struct pci_dev *pdev, · 1011 unmodified lines
10121012 goto out;
10131013
10141014 rc = pci_request_regions(pdev, DRV_NAME);
1015− if (rc < 0) {
1016− pci_disable_device(pdev);
1017− goto out;
1018− }
1015+ if (rc < 0)
1016+ goto out_disable;
10191017
10201018 unit = vortex_cards_found;
10211019
@@ -1032,23 +1030,24 @@ static int vortex_init_one(struct pci_dev *pdev, · 10 unmodified lines
10321030 if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */
10331031 ioaddr = pci_iomap(pdev, 0, 0);
10341032 if (!ioaddr) {
1035− pci_release_regions(pdev);
1036− pci_disable_device(pdev);
10371033 rc = -ENOMEM;
1038− goto out;
1034+ goto out_release;
10391035 }
10401036
10411037 rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq,
10421038 ent->driver_data, unit);
1043− if (rc < 0) {
1044− pci_iounmap(pdev, ioaddr);
1045− pci_release_regions(pdev);
1046− pci_disable_device(pdev);
1047− goto out;
1048− }
1039+ if (rc < 0)
1040+ goto out_iounmap;
10491041
10501042 vortex_cards_found++;
1043+ goto out;
10511044
1045+out_iounmap:
1046+ pci_iounmap(pdev, ioaddr);
1047+out_release:
1048+ pci_release_regions(pdev);
1049+out_disable:
1050+ pci_disable_device(pdev);
10521051 out:
10531052 return rc;
10541053 }
@@ -1473,7 +1472,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, · 418 unmodified lines
14731472
14741473 if (pdev) {
14751474 vp->pm_state_valid = 1;
1476− pci_save_state(VORTEX_PCI(vp));
1475+ pci_save_state(pdev);
14771476 acpi_set_WOL(dev);
14781477 }
14791478 retval = register_netdev(dev);
@@ -3233,21 +3232,20 @@ static void vortex_remove_one(struct pci_dev *pdev) · 1753 unmodified lines
32333232 vp = netdev_priv(dev);
32343233
32353234 if (vp->cb_fn_base)
3236− pci_iounmap(VORTEX_PCI(vp), vp->cb_fn_base);
3235+ pci_iounmap(pdev, vp->cb_fn_base);
32373236
32383237 unregister_netdev(dev);
32393238
3240− if (VORTEX_PCI(vp)) {
3241− pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
3242− if (vp->pm_state_valid)
3243− pci_restore_state(VORTEX_PCI(vp));
3244− pci_disable_device(VORTEX_PCI(vp));
3245− }
3239+ pci_set_power_state(pdev, PCI_D0); /* Go active */
3240+ if (vp->pm_state_valid)
3241+ pci_restore_state(pdev);
3242+ pci_disable_device(pdev);
3243+
32463244 /* Should really use issue_and_wait() here */
32473245 iowrite16(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14),
32483246 vp->ioaddr + EL3_CMD);
32493247
3250− pci_iounmap(VORTEX_PCI(vp), vp->ioaddr);
3248+ pci_iounmap(pdev, vp->ioaddr);
32513249
32523250 pci_free_consistent(pdev,
32533251 sizeof(struct boom_rx_desc) * RX_RING_SIZE
drivers/net/ethernet/3com/Kconfig+0−1
@@ -67,7 +67,6 @@ config PCMCIA_3C589 · 66 unmodified lines
6767 config VORTEX
6868 tristate "3c590/3c900 series (592/595/597) \"Vortex/Boomerang\" support"
6969 depends on (PCI || EISA) && HAS_IOPORT
70− select NET_CORE
7170 select MII
7271 ---help---
7372 This option enables driver support for a large number of 10Mbps and
drivers/net/ethernet/8390/ne.c+0−1
@@ -849,7 +849,6 @@ static int ne_drv_remove(struct platform_device *pdev) · 848 unmodified lines
849849 free_irq(dev->irq, dev);
850850 release_region(dev->base_addr, NE_IO_EXTENT);
851851 free_netdev(dev);
852− platform_set_drvdata(pdev, NULL);
853852 }
854853 return 0;
855854 }
drivers/net/ethernet/8390/ne2k-pci.c+1−1
@@ -676,7 +676,7 @@ static int ne2k_pci_resume (struct pci_dev *pdev) · 675 unmodified lines
676676 struct net_device *dev = pci_get_drvdata (pdev);
677677 int rc;
678678
679− pci_set_power_state(pdev, 0);
679+ pci_set_power_state(pdev, PCI_D0);
680680 pci_restore_state(pdev);
681681
682682 rc = pci_enable_device(pdev);
drivers/net/ethernet/Kconfig+2−4
@@ -20,9 +20,11 @@ config SUNGEM_PHY · 19 unmodified lines
2020 source "drivers/net/ethernet/3com/Kconfig"
2121 source "drivers/net/ethernet/adaptec/Kconfig"
2222 source "drivers/net/ethernet/aeroflex/Kconfig"
23+source "drivers/net/ethernet/allwinner/Kconfig"
2324 source "drivers/net/ethernet/alteon/Kconfig"
2425 source "drivers/net/ethernet/amd/Kconfig"
2526 source "drivers/net/ethernet/apple/Kconfig"
27+source "drivers/net/ethernet/arc/Kconfig"
2628 source "drivers/net/ethernet/atheros/Kconfig"
2729 source "drivers/net/ethernet/cadence/Kconfig"
2830 source "drivers/net/ethernet/adi/Kconfig"
@@ -63,7 +65,6 @@ config JME · 34 unmodified lines
6365 tristate "JMicron(R) PCI-Express Gigabit Ethernet support"
6466 depends on PCI
6567 select CRC32
66− select NET_CORE
6768 select MII
6869 ---help---
6970 This driver supports the PCI-Express gigabit ethernet adapters
@@ -95,7 +96,6 @@ config FEALNX · 25 unmodified lines
9596 tristate "Myson MTD-8xx PCI Ethernet support"
9697 depends on PCI
9798 select CRC32
98− select NET_CORE
9999 select MII
100100 ---help---
101101 Say Y here to support the Myson MTD-800 family of PCI-based Ethernet
@@ -106,7 +106,6 @@ source "drivers/net/ethernet/8390/Kconfig" · 4 unmodified lines
106106
107107 config NET_NETX
108108 tristate "NetX Ethernet support"
109− select NET_CORE
110109 select MII
111110 depends on ARCH_NETX
112111 ---help---
@@ -124,7 +123,6 @@ source "drivers/net/ethernet/oki-semi/Kconfig" · 11 unmodified lines
124123 config ETHOC
125124 tristate "OpenCores 10/100 Mbps Ethernet MAC support"
126125 depends on HAS_IOMEM && HAS_DMA
127− select NET_CORE
128126 select MII
129127 select PHYLIB
130128 select CRC32
drivers/net/ethernet/Makefile+2−0
@@ -6,9 +6,11 @@ obj-$(CONFIG_NET_VENDOR_3COM) += 3com/ · 5 unmodified lines
66 obj-$(CONFIG_NET_VENDOR_8390) += 8390/
77 obj-$(CONFIG_NET_VENDOR_ADAPTEC) += adaptec/
88 obj-$(CONFIG_GRETH) += aeroflex/
9+obj-$(CONFIG_NET_VENDOR_ALLWINNER) += allwinner/
910 obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
1011 obj-$(CONFIG_NET_VENDOR_AMD) += amd/
1112 obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
13+obj-$(CONFIG_NET_VENDOR_ARC) += arc/
1214 obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
1315 obj-$(CONFIG_NET_CADENCE) += cadence/
1416 obj-$(CONFIG_NET_BFIN) += adi/
drivers/net/ethernet/adaptec/Kconfig+0−1
@@ -22,7 +22,6 @@ config ADAPTEC_STARFIRE · 21 unmodified lines
2222 tristate "Adaptec Starfire/DuraLAN support"
2323 depends on PCI
2424 select CRC32
25− select NET_CORE
2625 select MII
2726 ---help---
2827 Say Y here if you have an Adaptec Starfire (or DuraLAN) PCI network
drivers/net/ethernet/adi/Kconfig+0−1
@@ -23,7 +23,6 @@ config BFIN_MAC · 22 unmodified lines
2323 tristate "Blackfin on-chip MAC support"
2424 depends on (BF516 || BF518 || BF526 || BF527 || BF536 || BF537)
2525 select CRC32
26− select NET_CORE
2726 select MII
2827 select PHYLIB
2928 select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE
drivers/net/ethernet/adi/bfin_mac.c+0−4
@@ -1719,7 +1719,6 @@ out_err_mii_probe: · 1718 unmodified lines
17191719 mdiobus_unregister(lp->mii_bus);
17201720 mdiobus_free(lp->mii_bus);
17211721 out_err_probe_mac:
1722− platform_set_drvdata(pdev, NULL);
17231722 free_netdev(ndev);
17241723
17251724 return rc;
@@ -1732,8 +1731,6 @@ static int bfin_mac_remove(struct platform_device *pdev) · 6 unmodified lines
17321731
17331732 bfin_phc_release(lp);
17341733
1735− platform_set_drvdata(pdev, NULL);
1736−
17371734 lp->mii_bus->priv = NULL;
17381735
17391736 unregister_netdev(ndev);
@@ -1868,7 +1865,6 @@ static int bfin_mii_bus_remove(struct platform_device *pdev) · 128 unmodified lines
18681865 struct bfin_mii_bus_platform_data *mii_bus_pd =
18691866 dev_get_platdata(&pdev->dev);
18701867
1871− platform_set_drvdata(pdev, NULL);
18721868 mdiobus_unregister(miibus);
18731869 kfree(miibus->irq);
18741870 mdiobus_free(miibus);
drivers/net/ethernet/aeroflex/greth.c+1−3
@@ -1565,7 +1565,7 @@ error1: · 1564 unmodified lines
15651565
15661566 static int greth_of_remove(struct platform_device *of_dev)
15671567 {
1568− struct net_device *ndev = dev_get_drvdata(&of_dev->dev);
1568+ struct net_device *ndev = platform_get_drvdata(of_dev);
15691569 struct greth_private *greth = netdev_priv(ndev);
15701570
15711571 /* Free descriptor areas */
@@ -1573,8 +1573,6 @@ static int greth_of_remove(struct platform_device *of_dev) · 1 unmodified line
15731573
15741574 dma_free_coherent(&of_dev->dev, 1024, greth->tx_bd_base, greth->tx_bd_base_phys);
15751575
1576− dev_set_drvdata(&of_dev->dev, NULL);
1577−
15781576 if (greth->phy)
15791577 phy_stop(greth->phy);
15801578 mdiobus_unregister(greth->mdio);
drivers/net/ethernet/allwinner/Kconfig+35−0
@@ -0,0 +1,35 @@
1+#
2+# Allwinner device configuration
3+#
4+
5+config NET_VENDOR_ALLWINNER
6+ bool "Allwinner devices"
7+ default y
8+ depends on ARCH_SUNXI
9+ ---help---
10+ If you have a network (Ethernet) card belonging to this
11+ class, say Y and read the Ethernet-HOWTO, available from
12+ <http://www.tldp.org/docs.html#howto>.
13+
14+ Note that the answer to this question doesn't directly
15+ affect the kernel: saying N will just cause the configurator
16+ to skip all the questions about Allwinner cards. If you say Y,
17+ you will be asked for your specific card in the following
18+ questions.
19+
20+if NET_VENDOR_ALLWINNER
21+
22+config SUN4I_EMAC
23+ tristate "Allwinner A10 EMAC support"
24+ depends on ARCH_SUNXI
25+ depends on OF
26+ select CRC32
27+ select MII
28+ select PHYLIB
29+ ---help---
30+ Support for Allwinner A10 EMAC ethernet driver.
31+
32+ To compile this driver as a module, choose M here. The module
33+ will be called sun4i-emac.
34+
35+endif # NET_VENDOR_ALLWINNER
drivers/net/ethernet/allwinner/Makefile+5−0
@@ -0,0 +1,5 @@
1+#
2+# Makefile for the Allwinner device drivers.
3+#
4+
5+obj-$(CONFIG_SUN4I_EMAC) += sun4i-emac.o
drivers/net/ethernet/allwinner/sun4i-emac.c+954−0
@@ -0,0 +1,954 @@
1+/*
2+ * Allwinner EMAC Fast Ethernet driver for Linux.
3+ *
4+ * Copyright 2012-2013 Stefan Roese <sr@denx.de>
5+ * Copyright 2013 Maxime Ripard <maxime.ripard@free-electrons.com>
6+ *
7+ * Based on the Linux driver provided by Allwinner:
8+ * Copyright (C) 1997 Sten Wang
9+ *
10+ * This file is licensed under the terms of the GNU General Public
11+ * License version 2. This program is licensed "as is" without any
12+ * warranty of any kind, whether express or implied.
13+ */
14+
15+#include <linux/clk.h>
16+#include <linux/etherdevice.h>
17+#include <linux/ethtool.h>
18+#include <linux/gpio.h>
19+#include <linux/init.h>
20+#include <linux/interrupt.h>
21+#include <linux/irq.h>
22+#include <linux/mii.h>
23+#include <linux/module.h>
24+#include <linux/netdevice.h>
25+#include <linux/of_address.h>
26+#include <linux/of_irq.h>
27+#include <linux/of_mdio.h>
28+#include <linux/of_net.h>
29+#include <linux/of_platform.h>
30+#include <linux/platform_device.h>
31+#include <linux/phy.h>
32+
33+#include "sun4i-emac.h"
34+
35+#define DRV_NAME "sun4i-emac"
36+#define DRV_VERSION "1.02"
37+
38+#define EMAC_MAX_FRAME_LEN 0x0600
39+
40+/* Transmit timeout, default 5 seconds. */
41+static int watchdog = 5000;
42+module_param(watchdog, int, 0400);
43+MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds");
44+
45+/* EMAC register address locking.
46+ *
47+ * The EMAC uses an address register to control where data written
48+ * to the data register goes. This means that the address register
49+ * must be preserved over interrupts or similar calls.
50+ *
51+ * During interrupt and other critical calls, a spinlock is used to
52+ * protect the system, but the calls themselves save the address
53+ * in the address register in case they are interrupting another
54+ * access to the device.
55+ *
56+ * For general accesses a lock is provided so that calls which are
57+ * allowed to sleep are serialised so that the address register does
58+ * not need to be saved. This lock also serves to serialise access
59+ * to the EEPROM and PHY access registers which are shared between
60+ * these two devices.
61+ */
62+
63+/* The driver supports the original EMACE, and now the two newer
64+ * devices, EMACA and EMACB.
65+ */
66+
67+struct emac_board_info {
68+ struct clk *clk;
69+ struct device *dev;
70+ struct platform_device *pdev;
71+ spinlock_t lock;
72+ void __iomem *membase;
73+ u32 msg_enable;
74+ struct net_device *ndev;
75+ struct sk_buff *skb_last;
76+ u16 tx_fifo_stat;
77+
78+ int emacrx_completed_flag;
79+
80+ struct phy_device *phy_dev;
81+ struct device_node *phy_node;
82+ unsigned int link;
83+ unsigned int speed;
84+ unsigned int duplex;
85+
86+ phy_interface_t phy_interface;
87+};
88+
89+static void emac_update_speed(struct net_device *dev)
90+{
91+ struct emac_board_info *db = netdev_priv(dev);
92+ unsigned int reg_val;
93+
94+ /* set EMAC SPEED, depend on PHY */
95+ reg_val = readl(db->membase + EMAC_MAC_SUPP_REG);
96+ reg_val &= ~(0x1 << 8);
97+ if (db->speed == SPEED_100)
98+ reg_val |= 1 << 8;
99+ writel(reg_val, db->membase + EMAC_MAC_SUPP_REG);
100+}
101+
102+static void emac_update_duplex(struct net_device *dev)
103+{
104+ struct emac_board_info *db = netdev_priv(dev);
105+ unsigned int reg_val;
106+
107+ /* set duplex depend on phy */
108+ reg_val = readl(db->membase + EMAC_MAC_CTL1_REG);
109+ reg_val &= ~EMAC_MAC_CTL1_DUPLEX_EN;
110+ if (db->duplex)
111+ reg_val |= EMAC_MAC_CTL1_DUPLEX_EN;
112+ writel(reg_val, db->membase + EMAC_MAC_CTL1_REG);
113+}
114+
115+static void emac_handle_link_change(struct net_device *dev)
116+{
117+ struct emac_board_info *db = netdev_priv(dev);
118+ struct phy_device *phydev = db->phy_dev;
119+ unsigned long flags;
120+ int status_change = 0;
121+
122+ if (phydev->link) {
123+ if (db->speed != phydev->speed) {
124+ spin_lock_irqsave(&db->lock, flags);
125+ db->speed = phydev->speed;
126+ emac_update_speed(dev);
127+ spin_unlock_irqrestore(&db->lock, flags);
128+ status_change = 1;
129+ }
130+
131+ if (db->duplex != phydev->duplex) {
132+ spin_lock_irqsave(&db->lock, flags);
133+ db->duplex = phydev->duplex;
134+ emac_update_duplex(dev);
135+ spin_unlock_irqrestore(&db->lock, flags);
136+ status_change = 1;
137+ }
138+ }
139+
140+ if (phydev->link != db->link) {
141+ if (!phydev->link) {
142+ db->speed = 0;
143+ db->duplex = -1;
144+ }
145+ db->link = phydev->link;
146+
147+ status_change = 1;
148+ }
149+
150+ if (status_change)
151+ phy_print_status(phydev);
152+}
153+
154+static int emac_mdio_probe(struct net_device *dev)
155+{
156+ struct emac_board_info *db = netdev_priv(dev);
157+
158+ /* to-do: PHY interrupts are currently not supported */
159+
160+ /* attach the mac to the phy */
161+ db->phy_dev = of_phy_connect(db->ndev, db->phy_node,
162+ &emac_handle_link_change, 0,
163+ db->phy_interface);
164+ if (!db->phy_dev) {
165+ netdev_err(db->ndev, "could not find the PHY\n");
166+ return -ENODEV;
167+ }
168+
169+ /* mask with MAC supported features */
170+ db->phy_dev->supported &= PHY_BASIC_FEATURES;
171+ db->phy_dev->advertising = db->phy_dev->supported;
172+
173+ db->link = 0;
174+ db->speed = 0;
175+ db->duplex = -1;
176+
177+ return 0;
178+}
179+
180+static void emac_mdio_remove(struct net_device *dev)
181+{
182+ struct emac_board_info *db = netdev_priv(dev);
183+
184+ phy_disconnect(db->phy_dev);
185+ db->phy_dev = NULL;
186+}
187+
188+static void emac_reset(struct emac_board_info *db)
189+{
190+ dev_dbg(db->dev, "resetting device\n");
191+
192+ /* RESET device */
193+ writel(0, db->membase + EMAC_CTL_REG);
194+ udelay(200);
195+ writel(EMAC_CTL_RESET, db->membase + EMAC_CTL_REG);
196+ udelay(200);
197+}
198+
199+static void emac_outblk_32bit(void __iomem *reg, void *data, int count)
200+{
201+ writesl(reg, data, round_up(count, 4) / 4);
202+}
203+
204+static void emac_inblk_32bit(void __iomem *reg, void *data, int count)
205+{
206+ readsl(reg, data, round_up(count, 4) / 4);
207+}
208+
209+static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
210+{
211+ struct emac_board_info *dm = netdev_priv(dev);
212+ struct phy_device *phydev = dm->phy_dev;
213+
214+ if (!netif_running(dev))
215+ return -EINVAL;
216+
217+ if (!phydev)
218+ return -ENODEV;
219+
220+ return phy_mii_ioctl(phydev, rq, cmd);
221+}
222+
223+/* ethtool ops */
224+static void emac_get_drvinfo(struct net_device *dev,
225+ struct ethtool_drvinfo *info)
226+{
227+ strlcpy(info->driver, DRV_NAME, sizeof(DRV_NAME));
228+ strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION));
229+ strlcpy(info->bus_info, dev_name(&dev->dev), sizeof(info->bus_info));
230+}
231+
232+static int emac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
233+{
234+ struct emac_board_info *dm = netdev_priv(dev);
235+ struct phy_device *phydev = dm->phy_dev;
236+
237+ if (!phydev)
238+ return -ENODEV;
239+
240+ return phy_ethtool_gset(phydev, cmd);
241+}
242+
243+static int emac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
244+{
245+ struct emac_board_info *dm = netdev_priv(dev);
246+ struct phy_device *phydev = dm->phy_dev;
247+
248+ if (!phydev)
249+ return -ENODEV;
250+
251+ return phy_ethtool_sset(phydev, cmd);
252+}
253+
254+static const struct ethtool_ops emac_ethtool_ops = {
255+ .get_drvinfo = emac_get_drvinfo,
256+ .get_settings = emac_get_settings,
257+ .set_settings = emac_set_settings,
258+ .get_link = ethtool_op_get_link,
259+};
260+
261+static unsigned int emac_setup(struct net_device *ndev)
262+{
263+ struct emac_board_info *db = netdev_priv(ndev);
264+ unsigned int reg_val;
265+
266+ /* set up TX */
267+ reg_val = readl(db->membase + EMAC_TX_MODE_REG);
268+
269+ writel(reg_val | EMAC_TX_MODE_ABORTED_FRAME_EN,
270+ db->membase + EMAC_TX_MODE_REG);
271+
272+ /* set up RX */
273+ reg_val = readl(db->membase + EMAC_RX_CTL_REG);
274+
275+ writel(reg_val | EMAC_RX_CTL_PASS_LEN_OOR_EN |
276+ EMAC_RX_CTL_ACCEPT_UNICAST_EN | EMAC_RX_CTL_DA_FILTER_EN |
277+ EMAC_RX_CTL_ACCEPT_MULTICAST_EN |
278+ EMAC_RX_CTL_ACCEPT_BROADCAST_EN,
279+ db->membase + EMAC_RX_CTL_REG);
280+
281+ /* set MAC */
282+ /* set MAC CTL0 */
283+ reg_val = readl(db->membase + EMAC_MAC_CTL0_REG);
284+ writel(reg_val | EMAC_MAC_CTL0_RX_FLOW_CTL_EN |
285+ EMAC_MAC_CTL0_TX_FLOW_CTL_EN,
286+ db->membase + EMAC_MAC_CTL0_REG);
287+
288+ /* set MAC CTL1 */
289+ reg_val = readl(db->membase + EMAC_MAC_CTL1_REG);
290+ reg_val |= EMAC_MAC_CTL1_LEN_CHECK_EN;
291+ reg_val |= EMAC_MAC_CTL1_CRC_EN;
292+ reg_val |= EMAC_MAC_CTL1_PAD_EN;
293+ writel(reg_val, db->membase + EMAC_MAC_CTL1_REG);
294+
295+ /* set up IPGT */
296+ writel(EMAC_MAC_IPGT_FULL_DUPLEX, db->membase + EMAC_MAC_IPGT_REG);
297+
298+ /* set up IPGR */
299+ writel((EMAC_MAC_IPGR_IPG1 << 8) | EMAC_MAC_IPGR_IPG2,
300+ db->membase + EMAC_MAC_IPGR_REG);
301+
302+ /* set up Collison window */
303+ writel((EMAC_MAC_CLRT_COLLISION_WINDOW << 8) | EMAC_MAC_CLRT_RM,
304+ db->membase + EMAC_MAC_CLRT_REG);
305+
306+ /* set up Max Frame Length */
307+ writel(EMAC_MAX_FRAME_LEN,
308+ db->membase + EMAC_MAC_MAXF_REG);
309+
310+ return 0;
311+}
312+
313+static unsigned int emac_powerup(struct net_device *ndev)
314+{
315+ struct emac_board_info *db = netdev_priv(ndev);
316+ unsigned int reg_val;
317+
318+ /* initial EMAC */
319+ /* flush RX FIFO */
320+ reg_val = readl(db->membase + EMAC_RX_CTL_REG);
321+ reg_val |= 0x8;
322+ writel(reg_val, db->membase + EMAC_RX_CTL_REG);
323+ udelay(1);
324+
325+ /* initial MAC */
326+ /* soft reset MAC */
327+ reg_val = readl(db->membase + EMAC_MAC_CTL0_REG);
328+ reg_val &= ~EMAC_MAC_CTL0_SOFT_RESET;
329+ writel(reg_val, db->membase + EMAC_MAC_CTL0_REG);
330+
331+ /* set MII clock */
332+ reg_val = readl(db->membase + EMAC_MAC_MCFG_REG);
333+ reg_val &= (~(0xf << 2));
334+ reg_val |= (0xD << 2);
335+ writel(reg_val, db->membase + EMAC_MAC_MCFG_REG);
336+
337+ /* clear RX counter */
338+ writel(0x0, db->membase + EMAC_RX_FBC_REG);
339+
340+ /* disable all interrupt and clear interrupt status */
341+ writel(0, db->membase + EMAC_INT_CTL_REG);
342+ reg_val = readl(db->membase + EMAC_INT_STA_REG);
343+ writel(reg_val, db->membase + EMAC_INT_STA_REG);
344+
345+ udelay(1);
346+
347+ /* set up EMAC */
348+ emac_setup(ndev);
349+
350+ /* set mac_address to chip */
351+ writel(ndev->dev_addr[0] << 16 | ndev->dev_addr[1] << 8 | ndev->
352+ dev_addr[2], db->membase + EMAC_MAC_A1_REG);
353+ writel(ndev->dev_addr[3] << 16 | ndev->dev_addr[4] << 8 | ndev->
354+ dev_addr[5], db->membase + EMAC_MAC_A0_REG);
355+
356+ mdelay(1);
357+
358+ return 0;
359+}
360+
361+static int emac_set_mac_address(struct net_device *dev, void *p)
362+{
363+ struct sockaddr *addr = p;
364+ struct emac_board_info *db = netdev_priv(dev);
365+
366+ if (netif_running(dev))
367+ return -EBUSY;
368+
369+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
370+
371+ writel(dev->dev_addr[0] << 16 | dev->dev_addr[1] << 8 | dev->
372+ dev_addr[2], db->membase + EMAC_MAC_A1_REG);
373+ writel(dev->dev_addr[3] << 16 | dev->dev_addr[4] << 8 | dev->
374+ dev_addr[5], db->membase + EMAC_MAC_A0_REG);
375+
376+ return 0;
377+}
378+
379+/* Initialize emac board */
380+static void emac_init_device(struct net_device *dev)
381+{
382+ struct emac_board_info *db = netdev_priv(dev);
383+ unsigned long flags;
384+ unsigned int reg_val;
385+
386+ spin_lock_irqsave(&db->lock, flags);
387+
388+ emac_update_speed(dev);
389+ emac_update_duplex(dev);
390+
391+ /* enable RX/TX */
392+ reg_val = readl(db->membase + EMAC_CTL_REG);
393+ writel(reg_val | EMAC_CTL_RESET | EMAC_CTL_TX_EN | EMAC_CTL_RX_EN,
394+ db->membase + EMAC_CTL_REG);
395+
396+ /* enable RX/TX0/RX Hlevel interrup */
397+ reg_val = readl(db->membase + EMAC_INT_CTL_REG);
398+ reg_val |= (0xf << 0) | (0x01 << 8);
399+ writel(reg_val, db->membase + EMAC_INT_CTL_REG);
400+
401+ spin_unlock_irqrestore(&db->lock, flags);
402+}
403+
404+/* Our watchdog timed out. Called by the networking layer */
405+static void emac_timeout(struct net_device *dev)
406+{
407+ struct emac_board_info *db = netdev_priv(dev);
408+ unsigned long flags;
409+
410+ if (netif_msg_timer(db))
411+ dev_err(db->dev, "tx time out.\n");
412+
413+ /* Save previous register address */
414+ spin_lock_irqsave(&db->lock, flags);
415+
416+ netif_stop_queue(dev);
417+ emac_reset(db);
418+ emac_init_device(dev);
419+ /* We can accept TX packets again */
420+ dev->trans_start = jiffies;
421+ netif_wake_queue(dev);
422+
423+ /* Restore previous register address */
424+ spin_unlock_irqrestore(&db->lock, flags);
425+}
426+
427+/* Hardware start transmission.
428+ * Send a packet to media from the upper layer.
429+ */
430+static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev)
431+{
432+ struct emac_board_info *db = netdev_priv(dev);
433+ unsigned long channel;
434+ unsigned long flags;
435+
436+ channel = db->tx_fifo_stat & 3;
437+ if (channel == 3)
438+ return 1;
439+
440+ channel = (channel == 1 ? 1 : 0);
441+
442+ spin_lock_irqsave(&db->lock, flags);
443+
444+ writel(channel, db->membase + EMAC_TX_INS_REG);
445+
446+ emac_outblk_32bit(db->membase + EMAC_TX_IO_DATA_REG,
447+ skb->data, skb->len);
448+ dev->stats.tx_bytes += skb->len;
449+
450+ db->tx_fifo_stat |= 1 << channel;
451+ /* TX control: First packet immediately send, second packet queue */
452+ if (channel == 0) {
453+ /* set TX len */
454+ writel(skb->len, db->membase + EMAC_TX_PL0_REG);
455+ /* start translate from fifo to phy */
456+ writel(readl(db->membase + EMAC_TX_CTL0_REG) | 1,
457+ db->membase + EMAC_TX_CTL0_REG);
458+
459+ /* save the time stamp */
460+ dev->trans_start = jiffies;
461+ } else if (channel == 1) {
462+ /* set TX len */
463+ writel(skb->len, db->membase + EMAC_TX_PL1_REG);
464+ /* start translate from fifo to phy */
465+ writel(readl(db->membase + EMAC_TX_CTL1_REG) | 1,
466+ db->membase + EMAC_TX_CTL1_REG);
467+
468+ /* save the time stamp */
469+ dev->trans_start = jiffies;
470+ }
471+
472+ if ((db->tx_fifo_stat & 3) == 3) {
473+ /* Second packet */
474+ netif_stop_queue(dev);
475+ }
476+
477+ spin_unlock_irqrestore(&db->lock, flags);
478+
479+ /* free this SKB */
480+ dev_kfree_skb(skb);
481+
482+ return NETDEV_TX_OK;
483+}
484+
485+/* EMAC interrupt handler
486+ * receive the packet to upper layer, free the transmitted packet
487+ */
488+static void emac_tx_done(struct net_device *dev, struct emac_board_info *db,
489+ unsigned int tx_status)
490+{
491+ /* One packet sent complete */
492+ db->tx_fifo_stat &= ~(tx_status & 3);
493+ if (3 == (tx_status & 3))
494+ dev->stats.tx_packets += 2;
495+ else
496+ dev->stats.tx_packets++;
497+
498+ if (netif_msg_tx_done(db))
499+ dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status);
500+
501+ netif_wake_queue(dev);
502+}
503+
504+/* Received a packet and pass to upper layer
505+ */
506+static void emac_rx(struct net_device *dev)
507+{
508+ struct emac_board_info *db = netdev_priv(dev);
509+ struct sk_buff *skb;
510+ u8 *rdptr;
511+ bool good_packet;
512+ static int rxlen_last;
513+ unsigned int reg_val;
514+ u32 rxhdr, rxstatus, rxcount, rxlen;
515+
516+ /* Check packet ready or not */
517+ while (1) {
518+ /* race warning: the first packet might arrive with
519+ * the interrupts disabled, but the second will fix
520+ * it
521+ */
522+ rxcount = readl(db->membase + EMAC_RX_FBC_REG);
523+
524+ if (netif_msg_rx_status(db))
525+ dev_dbg(db->dev, "RXCount: %x\n", rxcount);
526+
527+ if ((db->skb_last != NULL) && (rxlen_last > 0)) {
528+ dev->stats.rx_bytes += rxlen_last;
529+
530+ /* Pass to upper layer */
531+ db->skb_last->protocol = eth_type_trans(db->skb_last,
532+ dev);
533+ netif_rx(db->skb_last);
534+ dev->stats.rx_packets++;
535+ db->skb_last = NULL;
536+ rxlen_last = 0;
537+
538+ reg_val = readl(db->membase + EMAC_RX_CTL_REG);
539+ reg_val &= ~EMAC_RX_CTL_DMA_EN;
540+ writel(reg_val, db->membase + EMAC_RX_CTL_REG);
541+ }
542+
543+ if (!rxcount) {
544+ db->emacrx_completed_flag = 1;
545+ reg_val = readl(db->membase + EMAC_INT_CTL_REG);
546+ reg_val |= (0xf << 0) | (0x01 << 8);
547+ writel(reg_val, db->membase + EMAC_INT_CTL_REG);
548+
549+ /* had one stuck? */
550+ rxcount = readl(db->membase + EMAC_RX_FBC_REG);
551+ if (!rxcount)
552+ return;
553+ }
554+
555+ reg_val = readl(db->membase + EMAC_RX_IO_DATA_REG);
556+ if (netif_msg_rx_status(db))
557+ dev_dbg(db->dev, "receive header: %x\n", reg_val);
558+ if (reg_val != EMAC_UNDOCUMENTED_MAGIC) {
559+ /* disable RX */
560+ reg_val = readl(db->membase + EMAC_CTL_REG);
561+ writel(reg_val & ~EMAC_CTL_RX_EN,
562+ db->membase + EMAC_CTL_REG);
563+
564+ /* Flush RX FIFO */
565+ reg_val = readl(db->membase + EMAC_RX_CTL_REG);
566+ writel(reg_val | (1 << 3),
567+ db->membase + EMAC_RX_CTL_REG);
568+
569+ do {
570+ reg_val = readl(db->membase + EMAC_RX_CTL_REG);
571+ } while (reg_val & (1 << 3));
572+
573+ /* enable RX */
574+ reg_val = readl(db->membase + EMAC_CTL_REG);
575+ writel(reg_val | EMAC_CTL_RX_EN,
576+ db->membase + EMAC_CTL_REG);
577+ reg_val = readl(db->membase + EMAC_INT_CTL_REG);
578+ reg_val |= (0xf << 0) | (0x01 << 8);
579+ writel(reg_val, db->membase + EMAC_INT_CTL_REG);
580+
581+ db->emacrx_completed_flag = 1;
582+
583+ return;
584+ }
585+
586+ /* A packet ready now & Get status/length */
587+ good_packet = true;
588+
589+ emac_inblk_32bit(db->membase + EMAC_RX_IO_DATA_REG,
590+ &rxhdr, sizeof(rxhdr));
591+
592+ if (netif_msg_rx_status(db))
593+ dev_dbg(db->dev, "rxhdr: %x\n", *((int *)(&rxhdr)));
594+
595+ rxlen = EMAC_RX_IO_DATA_LEN(rxhdr);
596+ rxstatus = EMAC_RX_IO_DATA_STATUS(rxhdr);
597+
598+ if (netif_msg_rx_status(db))
599+ dev_dbg(db->dev, "RX: status %02x, length %04x\n",
600+ rxstatus, rxlen);
601+
602+ /* Packet Status check */
603+ if (rxlen < 0x40) {
604+ good_packet = false;
605+ if (netif_msg_rx_err(db))
606+ dev_dbg(db->dev, "RX: Bad Packet (runt)\n");
607+ }
608+
609+ if (unlikely(!(rxstatus & EMAC_RX_IO_DATA_STATUS_OK))) {
610+ good_packet = false;
611+
612+ if (rxstatus & EMAC_RX_IO_DATA_STATUS_CRC_ERR) {
613+ if (netif_msg_rx_err(db))
614+ dev_dbg(db->dev, "crc error\n");
615+ dev->stats.rx_crc_errors++;
616+ }
617+
618+ if (rxstatus & EMAC_RX_IO_DATA_STATUS_LEN_ERR) {
619+ if (netif_msg_rx_err(db))
620+ dev_dbg(db->dev, "length error\n");
621+ dev->stats.rx_length_errors++;
622+ }
623+ }
624+
625+ /* Move data from EMAC */
626+ skb = dev_alloc_skb(rxlen + 4);
627+ if (good_packet && skb) {
628+ skb_reserve(skb, 2);
629+ rdptr = (u8 *) skb_put(skb, rxlen - 4);
630+
631+ /* Read received packet from RX SRAM */
632+ if (netif_msg_rx_status(db))
633+ dev_dbg(db->dev, "RxLen %x\n", rxlen);
634+
635+ emac_inblk_32bit(db->membase + EMAC_RX_IO_DATA_REG,
636+ rdptr, rxlen);
637+ dev->stats.rx_bytes += rxlen;
638+
639+ /* Pass to upper layer */
640+ skb->protocol = eth_type_trans(skb, dev);
641+ netif_rx(skb);
642+ dev->stats.rx_packets++;
643+ }
644+ }
645+}
646+
647+static irqreturn_t emac_interrupt(int irq, void *dev_id)
648+{
649+ struct net_device *dev = dev_id;
650+ struct emac_board_info *db = netdev_priv(dev);
651+ int int_status;
652+ unsigned long flags;
653+ unsigned int reg_val;
654+
655+ /* A real interrupt coming */
656+
657+ /* holders of db->lock must always block IRQs */
658+ spin_lock_irqsave(&db->lock, flags);
659+
660+ /* Disable all interrupts */
661+ writel(0, db->membase + EMAC_INT_CTL_REG);
662+
663+ /* Got EMAC interrupt status */
664+ /* Got ISR */
665+ int_status = readl(db->membase + EMAC_INT_STA_REG);
666+ /* Clear ISR status */
667+ writel(int_status, db->membase + EMAC_INT_STA_REG);
668+
669+ if (netif_msg_intr(db))
670+ dev_dbg(db->dev, "emac interrupt %02x\n", int_status);
671+
672+ /* Received the coming packet */
673+ if ((int_status & 0x100) && (db->emacrx_completed_flag == 1)) {
674+ /* carrier lost */
675+ db->emacrx_completed_flag = 0;
676+ emac_rx(dev);
677+ }
678+
679+ /* Transmit Interrupt check */
680+ if (int_status & (0x01 | 0x02))
681+ emac_tx_done(dev, db, int_status);
682+
683+ if (int_status & (0x04 | 0x08))
684+ netdev_info(dev, " ab : %x\n", int_status);
685+
686+ /* Re-enable interrupt mask */
687+ if (db->emacrx_completed_flag == 1) {
688+ reg_val = readl(db->membase + EMAC_INT_CTL_REG);
689+ reg_val |= (0xf << 0) | (0x01 << 8);
690+ writel(reg_val, db->membase + EMAC_INT_CTL_REG);
691+ }
692+ spin_unlock_irqrestore(&db->lock, flags);
693+
694+ return IRQ_HANDLED;
695+}
696+
697+#ifdef CONFIG_NET_POLL_CONTROLLER
698+/*
699+ * Used by netconsole
700+ */
701+static void emac_poll_controller(struct net_device *dev)
702+{
703+ disable_irq(dev->irq);
704+ emac_interrupt(dev->irq, dev);
705+ enable_irq(dev->irq);
706+}
707+#endif
708+
709+/* Open the interface.
710+ * The interface is opened whenever "ifconfig" actives it.
711+ */
712+static int emac_open(struct net_device *dev)
713+{
714+ struct emac_board_info *db = netdev_priv(dev);
715+ int ret;
716+
717+ if (netif_msg_ifup(db))
718+ dev_dbg(db->dev, "enabling %s\n", dev->name);
719+
720+ if (devm_request_irq(db->dev, dev->irq, &emac_interrupt,
721+ 0, dev->name, dev))
722+ return -EAGAIN;
723+
724+ /* Initialize EMAC board */
725+ emac_reset(db);
726+ emac_init_device(dev);
727+
728+ ret = emac_mdio_probe(dev);
729+ if (ret < 0) {
730+ netdev_err(dev, "cannot probe MDIO bus\n");
731+ return ret;
732+ }
733+
734+ phy_start(db->phy_dev);
735+ netif_start_queue(dev);
736+
737+ return 0;
738+}
739+
740+static void emac_shutdown(struct net_device *dev)
741+{
742+ unsigned int reg_val;
743+ struct emac_board_info *db = netdev_priv(dev);
744+
745+ /* Disable all interrupt */
746+ writel(0, db->membase + EMAC_INT_CTL_REG);
747+
748+ /* clear interupt status */
749+ reg_val = readl(db->membase + EMAC_INT_STA_REG);
750+ writel(reg_val, db->membase + EMAC_INT_STA_REG);
751+
752+ /* Disable RX/TX */
753+ reg_val = readl(db->membase + EMAC_CTL_REG);
754+ reg_val &= ~(EMAC_CTL_TX_EN | EMAC_CTL_RX_EN | EMAC_CTL_RESET);
755+ writel(reg_val, db->membase + EMAC_CTL_REG);
756+}
757+
758+/* Stop the interface.
759+ * The interface is stopped when it is brought.
760+ */
761+static int emac_stop(struct net_device *ndev)
762+{
763+ struct emac_board_info *db = netdev_priv(ndev);
764+
765+ if (netif_msg_ifdown(db))
766+ dev_dbg(db->dev, "shutting down %s\n", ndev->name);
767+
768+ netif_stop_queue(ndev);
769+ netif_carrier_off(ndev);
770+
771+ phy_stop(db->phy_dev);
772+
773+ emac_mdio_remove(ndev);
774+
775+ emac_shutdown(ndev);
776+
777+ return 0;
778+}
779+
780+static const struct net_device_ops emac_netdev_ops = {
781+ .ndo_open = emac_open,
782+ .ndo_stop = emac_stop,
783+ .ndo_start_xmit = emac_start_xmit,
784+ .ndo_tx_timeout = emac_timeout,
785+ .ndo_do_ioctl = emac_ioctl,
786+ .ndo_change_mtu = eth_change_mtu,
787+ .ndo_validate_addr = eth_validate_addr,
788+ .ndo_set_mac_address = emac_set_mac_address,
789+#ifdef CONFIG_NET_POLL_CONTROLLER
790+ .ndo_poll_controller = emac_poll_controller,
791+#endif
792+};
793+
794+/* Search EMAC board, allocate space and register it
795+ */
796+static int emac_probe(struct platform_device *pdev)
797+{
798+ struct device_node *np = pdev->dev.of_node;
799+ struct emac_board_info *db;
800+ struct net_device *ndev;
801+ int ret = 0;
802+ const char *mac_addr;
803+
804+ ndev = alloc_etherdev(sizeof(struct emac_board_info));
805+ if (!ndev) {
806+ dev_err(&pdev->dev, "could not allocate device.\n");
807+ return -ENOMEM;
808+ }
809+
810+ SET_NETDEV_DEV(ndev, &pdev->dev);
811+
812+ db = netdev_priv(ndev);
813+ memset(db, 0, sizeof(*db));
814+
815+ db->dev = &pdev->dev;
816+ db->ndev = ndev;
817+ db->pdev = pdev;
818+
819+ spin_lock_init(&db->lock);
820+
821+ db->membase = of_iomap(np, 0);
822+ if (!db->membase) {
823+ dev_err(&pdev->dev, "failed to remap registers\n");
824+ ret = -ENOMEM;
825+ goto out;
826+ }
827+
828+ /* fill in parameters for net-dev structure */
829+ ndev->base_addr = (unsigned long)db->membase;
830+ ndev->irq = irq_of_parse_and_map(np, 0);
831+ if (ndev->irq == -ENXIO) {
832+ netdev_err(ndev, "No irq resource\n");
833+ ret = ndev->irq;
834+ goto out;
835+ }
836+
837+ db->clk = devm_clk_get(&pdev->dev, NULL);
838+ if (IS_ERR(db->clk))
839+ goto out;
840+
841+ clk_prepare_enable(db->clk);
842+
843+ db->phy_node = of_parse_phandle(np, "phy", 0);
844+ if (!db->phy_node) {
845+ dev_err(&pdev->dev, "no associated PHY\n");
846+ ret = -ENODEV;
847+ goto out;
848+ }
849+
850+ /* Read MAC-address from DT */
851+ mac_addr = of_get_mac_address(np);
852+ if (mac_addr)
853+ memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
854+
855+ /* Check if the MAC address is valid, if not get a random one */
856+ if (!is_valid_ether_addr(ndev->dev_addr)) {
857+ eth_hw_addr_random(ndev);
858+ dev_warn(&pdev->dev, "using random MAC address %pM\n",
859+ ndev->dev_addr);
860+ }
861+
862+ db->emacrx_completed_flag = 1;
863+ emac_powerup(ndev);
864+ emac_reset(db);
865+
866+ ether_setup(ndev);
867+
868+ ndev->netdev_ops = &emac_netdev_ops;
869+ ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
870+ ndev->ethtool_ops = &emac_ethtool_ops;
871+
872+ platform_set_drvdata(pdev, ndev);
873+
874+ /* Carrier starts down, phylib will bring it up */
875+ netif_carrier_off(ndev);
876+
877+ ret = register_netdev(ndev);
878+ if (ret) {
879+ dev_err(&pdev->dev, "Registering netdev failed!\n");
880+ ret = -ENODEV;
881+ goto out;
882+ }
883+
884+ dev_info(&pdev->dev, "%s: at %p, IRQ %d MAC: %pM\n",
885+ ndev->name, db->membase, ndev->irq, ndev->dev_addr);
886+
887+ return 0;
888+
889+out:
890+ dev_err(db->dev, "not found (%d).\n", ret);
891+
892+ free_netdev(ndev);
893+
894+ return ret;
895+}
896+
897+static int emac_remove(struct platform_device *pdev)
898+{
899+ struct net_device *ndev = platform_get_drvdata(pdev);
900+
901+ unregister_netdev(ndev);
902+ free_netdev(ndev);
903+
904+ dev_dbg(&pdev->dev, "released and freed device\n");
905+ return 0;
906+}
907+
908+static int emac_suspend(struct platform_device *dev, pm_message_t state)
909+{
910+ struct net_device *ndev = platform_get_drvdata(dev);
911+
912+ netif_carrier_off(ndev);
913+ netif_device_detach(ndev);
914+ emac_shutdown(ndev);
915+
916+ return 0;
917+}
918+
919+static int emac_resume(struct platform_device *dev)
920+{
921+ struct net_device *ndev = platform_get_drvdata(dev);
922+ struct emac_board_info *db = netdev_priv(ndev);
923+
924+ emac_reset(db);
925+ emac_init_device(ndev);
926+ netif_device_attach(ndev);
927+
928+ return 0;
929+}
930+
931+static const struct of_device_id emac_of_match[] = {
932+ {.compatible = "allwinner,sun4i-emac",},
933+ {},
934+};
935+
936+MODULE_DEVICE_TABLE(of, emac_of_match);
937+
938+static struct platform_driver emac_driver = {
939+ .driver = {
940+ .name = "sun4i-emac",
941+ .of_match_table = emac_of_match,
942+ },
943+ .probe = emac_probe,
944+ .remove = emac_remove,
945+ .suspend = emac_suspend,
946+ .resume = emac_resume,
947+};
948+
949+module_platform_driver(emac_driver);
950+
951+MODULE_AUTHOR("Stefan Roese <sr@denx.de>");
952+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
953+MODULE_DESCRIPTION("Allwinner A10 emac network driver");
954+MODULE_LICENSE("GPL");
drivers/net/ethernet/allwinner/sun4i-emac.h+108−0
@@ -0,0 +1,108 @@
1+/*
2+ * Allwinner EMAC Fast Ethernet driver for Linux.
3+ *
4+ * Copyright 2012 Stefan Roese <sr@denx.de>
5+ * Copyright 2013 Maxime Ripard <maxime.ripard@free-electrons.com>
6+ *
7+ * Based on the Linux driver provided by Allwinner:
8+ * Copyright (C) 1997 Sten Wang
9+ *
10+ * This file is licensed under the terms of the GNU General Public
11+ * License version 2. This program is licensed "as is" without any
12+ * warranty of any kind, whether express or implied.
13+ */
14+
15+#ifndef _SUN4I_EMAC_H_
16+#define _SUN4I_EMAC_H_
17+
18+#define EMAC_CTL_REG (0x00)
19+#define EMAC_CTL_RESET (1 << 0)
20+#define EMAC_CTL_TX_EN (1 << 1)
21+#define EMAC_CTL_RX_EN (1 << 2)
22+#define EMAC_TX_MODE_REG (0x04)
23+#define EMAC_TX_MODE_ABORTED_FRAME_EN (1 << 0)
24+#define EMAC_TX_MODE_DMA_EN (1 << 1)
25+#define EMAC_TX_FLOW_REG (0x08)
26+#define EMAC_TX_CTL0_REG (0x0c)
27+#define EMAC_TX_CTL1_REG (0x10)
28+#define EMAC_TX_INS_REG (0x14)
29+#define EMAC_TX_PL0_REG (0x18)
30+#define EMAC_TX_PL1_REG (0x1c)
31+#define EMAC_TX_STA_REG (0x20)
32+#define EMAC_TX_IO_DATA_REG (0x24)
33+#define EMAC_TX_IO_DATA1_REG (0x28)
34+#define EMAC_TX_TSVL0_REG (0x2c)
35+#define EMAC_TX_TSVH0_REG (0x30)
36+#define EMAC_TX_TSVL1_REG (0x34)
37+#define EMAC_TX_TSVH1_REG (0x38)
38+#define EMAC_RX_CTL_REG (0x3c)
39+#define EMAC_RX_CTL_AUTO_DRQ_EN (1 << 1)
40+#define EMAC_RX_CTL_DMA_EN (1 << 2)
41+#define EMAC_RX_CTL_PASS_ALL_EN (1 << 4)
42+#define EMAC_RX_CTL_PASS_CTL_EN (1 << 5)
43+#define EMAC_RX_CTL_PASS_CRC_ERR_EN (1 << 6)
44+#define EMAC_RX_CTL_PASS_LEN_ERR_EN (1 << 7)
45+#define EMAC_RX_CTL_PASS_LEN_OOR_EN (1 << 8)
46+#define EMAC_RX_CTL_ACCEPT_UNICAST_EN (1 << 16)
47+#define EMAC_RX_CTL_DA_FILTER_EN (1 << 17)
48+#define EMAC_RX_CTL_ACCEPT_MULTICAST_EN (1 << 20)
49+#define EMAC_RX_CTL_HASH_FILTER_EN (1 << 21)
50+#define EMAC_RX_CTL_ACCEPT_BROADCAST_EN (1 << 22)
51+#define EMAC_RX_CTL_SA_FILTER_EN (1 << 24)
52+#define EMAC_RX_CTL_SA_FILTER_INVERT_EN (1 << 25)
53+#define EMAC_RX_HASH0_REG (0x40)
54+#define EMAC_RX_HASH1_REG (0x44)
55+#define EMAC_RX_STA_REG (0x48)
56+#define EMAC_RX_IO_DATA_REG (0x4c)
57+#define EMAC_RX_IO_DATA_LEN(x) (x & 0xffff)
58+#define EMAC_RX_IO_DATA_STATUS(x) ((x >> 16) & 0xffff)
59+#define EMAC_RX_IO_DATA_STATUS_CRC_ERR (1 << 4)
60+#define EMAC_RX_IO_DATA_STATUS_LEN_ERR (3 << 5)
61+#define EMAC_RX_IO_DATA_STATUS_OK (1 << 7)
62+#define EMAC_RX_FBC_REG (0x50)
63+#define EMAC_INT_CTL_REG (0x54)
64+#define EMAC_INT_STA_REG (0x58)
65+#define EMAC_MAC_CTL0_REG (0x5c)
66+#define EMAC_MAC_CTL0_RX_FLOW_CTL_EN (1 << 2)
67+#define EMAC_MAC_CTL0_TX_FLOW_CTL_EN (1 << 3)
68+#define EMAC_MAC_CTL0_SOFT_RESET (1 << 15)
69+#define EMAC_MAC_CTL1_REG (0x60)
70+#define EMAC_MAC_CTL1_DUPLEX_EN (1 << 0)
71+#define EMAC_MAC_CTL1_LEN_CHECK_EN (1 << 1)
72+#define EMAC_MAC_CTL1_HUGE_FRAME_EN (1 << 2)
73+#define EMAC_MAC_CTL1_DELAYED_CRC_EN (1 << 3)
74+#define EMAC_MAC_CTL1_CRC_EN (1 << 4)
75+#define EMAC_MAC_CTL1_PAD_EN (1 << 5)
76+#define EMAC_MAC_CTL1_PAD_CRC_EN (1 << 6)
77+#define EMAC_MAC_CTL1_AD_SHORT_FRAME_EN (1 << 7)
78+#define EMAC_MAC_CTL1_BACKOFF_DIS (1 << 12)
79+#define EMAC_MAC_IPGT_REG (0x64)
80+#define EMAC_MAC_IPGT_HALF_DUPLEX (0x12)
81+#define EMAC_MAC_IPGT_FULL_DUPLEX (0x15)
82+#define EMAC_MAC_IPGR_REG (0x68)
83+#define EMAC_MAC_IPGR_IPG1 (0x0c)
84+#define EMAC_MAC_IPGR_IPG2 (0x12)
85+#define EMAC_MAC_CLRT_REG (0x6c)
86+#define EMAC_MAC_CLRT_COLLISION_WINDOW (0x37)
87+#define EMAC_MAC_CLRT_RM (0x0f)
88+#define EMAC_MAC_MAXF_REG (0x70)
89+#define EMAC_MAC_SUPP_REG (0x74)
90+#define EMAC_MAC_TEST_REG (0x78)
91+#define EMAC_MAC_MCFG_REG (0x7c)
92+#define EMAC_MAC_A0_REG (0x98)
93+#define EMAC_MAC_A1_REG (0x9c)
94+#define EMAC_MAC_A2_REG (0xa0)
95+#define EMAC_SAFX_L_REG0 (0xa4)
96+#define EMAC_SAFX_H_REG0 (0xa8)
97+#define EMAC_SAFX_L_REG1 (0xac)
98+#define EMAC_SAFX_H_REG1 (0xb0)
99+#define EMAC_SAFX_L_REG2 (0xb4)
100+#define EMAC_SAFX_H_REG2 (0xb8)
101+#define EMAC_SAFX_L_REG3 (0xbc)
102+#define EMAC_SAFX_H_REG3 (0xc0)
103+
104+#define EMAC_PHY_DUPLEX (1 << 8)
105+
106+#define EMAC_EEPROM_MAGIC (0x444d394b)
107+#define EMAC_UNDOCUMENTED_MAGIC (0x0143414d)
108+#endif /* _SUN4I_EMAC_H_ */
drivers/net/ethernet/alteon/acenic.c+2−13
@@ -702,19 +702,6 @@ static struct pci_driver acenic_pci_driver = { · 701 unmodified lines
702702 .remove = acenic_remove_one,
703703 };
704704
705−static int __init acenic_init(void)
706−{
707− return pci_register_driver(&acenic_pci_driver);
708−}
709−
710−static void __exit acenic_exit(void)
711−{
712− pci_unregister_driver(&acenic_pci_driver);
713−}
714−
715−module_init(acenic_init);
716−module_exit(acenic_exit);
717−
718705 static void ace_free_descriptors(struct net_device *dev)
719706 {
720707 struct ace_private *ap = netdev_priv(dev);
@@ -3199,3 +3186,5 @@ static int read_eeprom_byte(struct net_device *dev, unsigned long offset) · 2478 unmodified lines
31993186 ap->name, offset);
32003187 goto out;
32013188 }
3189+
3190+module_pci_driver(acenic_pci_driver);
drivers/net/ethernet/amd/Kconfig+0−2
@@ -34,7 +34,6 @@ config AMD8111_ETH · 33 unmodified lines
3434 tristate "AMD 8111 (new PCI LANCE) support"
3535 depends on PCI
3636 select CRC32
37− select NET_CORE
3837 select MII
3938 ---help---
4039 If you have an AMD 8111-based PCI LANCE ethernet card,
@@ -60,7 +59,6 @@ config PCNET32 · 19 unmodified lines
6059 tristate "AMD PCnet32 PCI support"
6160 depends on PCI
6261 select CRC32
63− select NET_CORE
6462 select MII
6563 ---help---
6664 If you have a PCnet32 or PCnetPCI based network (Ethernet) card,
drivers/net/ethernet/amd/amd8111e.c+4−15
@@ -1813,7 +1813,7 @@ static const struct net_device_ops amd8111e_netdev_ops = { · 1812 unmodified lines
18131813 static int amd8111e_probe_one(struct pci_dev *pdev,
18141814 const struct pci_device_id *ent)
18151815 {
1816− int err,i,pm_cap;
1816+ int err, i;
18171817 unsigned long reg_addr,reg_len;
18181818 struct amd8111e_priv* lp;
18191819 struct net_device* dev;
@@ -1842,7 +1842,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, · 22 unmodified lines
18421842 pci_set_master(pdev);
18431843
18441844 /* Find power-management capability. */
1845− if((pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM))==0){
1845+ if (!pdev->pm_cap) {
18461846 printk(KERN_ERR "amd8111e: No Power Management capability, "
18471847 "exiting.\n");
18481848 err = -ENODEV;
@@ -1875,7 +1875,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, · 26 unmodified lines
18751875 lp = netdev_priv(dev);
18761876 lp->pci_dev = pdev;
18771877 lp->amd8111e_net_dev = dev;
1878− lp->pm_cap = pm_cap;
1878+ lp->pm_cap = pdev->pm_cap;
18791879
18801880 spin_lock_init(&lp->lock);
18811881
@@ -1981,15 +1981,4 @@ static struct pci_driver amd8111e_driver = { · 99 unmodified lines
19811981 .resume = amd8111e_resume
19821982 };
19831983
1984−static int __init amd8111e_init(void)
1985−{
1986− return pci_register_driver(&amd8111e_driver);
1987−}
1988−
1989−static void __exit amd8111e_cleanup(void)
1990−{
1991− pci_unregister_driver(&amd8111e_driver);
1992−}
1993−
1994−module_init(amd8111e_init);
1995−module_exit(amd8111e_cleanup);
1984+module_pci_driver(amd8111e_driver);
drivers/net/ethernet/amd/au1000_eth.c+0−2
@@ -1301,8 +1301,6 @@ static int au1000_remove(struct platform_device *pdev) · 1300 unmodified lines
13011301 int i;
13021302 struct resource *base, *macen;
13031303
1304− platform_set_drvdata(pdev, NULL);
1305−
13061304 unregister_netdev(dev);
13071305 mdiobus_unregister(aup->mii_bus);
13081306 mdiobus_free(aup->mii_bus);
drivers/net/ethernet/amd/sunlance.c+2−4
@@ -1470,7 +1470,7 @@ no_link_test: · 1469 unmodified lines
14701470 goto fail;
14711471 }
14721472
1473− dev_set_drvdata(&op->dev, lp);
1473+ platform_set_drvdata(op, lp);
14741474
14751475 printk(KERN_INFO "%s: LANCE %pM\n",
14761476 dev->name, dev->dev_addr);
@@ -1501,7 +1501,7 @@ static int sunlance_sbus_probe(struct platform_device *op) · 24 unmodified lines
15011501
15021502 static int sunlance_sbus_remove(struct platform_device *op)
15031503 {
1504− struct lance_private *lp = dev_get_drvdata(&op->dev);
1504+ struct lance_private *lp = platform_get_drvdata(op);
15051505 struct net_device *net_dev = lp->dev;
15061506
15071507 unregister_netdev(net_dev);
@@ -1510,8 +1510,6 @@ static int sunlance_sbus_remove(struct platform_device *op) · 2 unmodified lines
15101510
15111511 free_netdev(net_dev);
15121512
1513− dev_set_drvdata(&op->dev, NULL);
1514−
15151513 return 0;
15161514 }
15171515
drivers/net/ethernet/apple/bmac.c+1−4
@@ -1016,7 +1016,6 @@ static void bmac_set_multicast(struct net_device *dev) · 1015 unmodified lines
10161016 static void bmac_set_multicast(struct net_device *dev)
10171017 {
10181018 struct netdev_hw_addr *ha;
1019− int i;
10201019 unsigned short rx_cfg;
10211020 u32 crc;
10221021
@@ -1030,14 +1029,12 @@ static void bmac_set_multicast(struct net_device *dev) · 7 unmodified lines
10301029 rx_cfg |= RxPromiscEnable;
10311030 bmwrite(dev, RXCFG, rx_cfg);
10321031 } else {
1033− u16 hash_table[4];
1032+ u16 hash_table[4] = { 0 };
10341033
10351034 rx_cfg = bmread(dev, RXCFG);
10361035 rx_cfg &= ~RxPromiscEnable;
10371036 bmwrite(dev, RXCFG, rx_cfg);
10381037
1039− for(i = 0; i < 4; i++) hash_table[i] = 0;
1040−
10411038 netdev_for_each_mc_addr(ha, dev) {
10421039 crc = ether_crc_le(6, ha->addr);
10431040 crc >>= 26;
drivers/net/ethernet/arc/Kconfig+31−0
@@ -0,0 +1,31 @@
1+#
2+# ARC EMAC network device configuration
3+#
4+
5+config NET_VENDOR_ARC
6+ bool "ARC devices"
7+ default y
8+ ---help---
9+ If you have a network (Ethernet) card belonging to this class, say Y
10+ and read the Ethernet-HOWTO, available from
11+ <http://www.tldp.org/docs.html#howto>.
12+
13+ Note that the answer to this question doesn't directly affect the
14+ kernel: saying N will just cause the configurator to skip all
15+ the questions about ARC cards. If you say Y, you will be asked for
16+ your specific card in the following questions.
17+
18+if NET_VENDOR_ARC
19+
20+config ARC_EMAC
21+ tristate "ARC EMAC support"
22+ select MII
23+ select PHYLIB
24+ depends on OF_IRQ
25+ depends on OF_NET
26+ ---help---
27+ On some legacy ARC (Synopsys) FPGA boards such as ARCAngel4/ML50x
28+ non-standard on-chip ethernet device ARC EMAC 10/100 is used.
29+ Say Y here if you have such a board. If unsure, say N.
30+
31+endif # NET_VENDOR_ARC
drivers/net/ethernet/arc/Makefile+6−0
@@ -0,0 +1,6 @@
1+#
2+# Makefile for the ARC network device drivers.
3+#
4+
5+arc_emac-objs := emac_main.o emac_mdio.o
6+obj-$(CONFIG_ARC_EMAC) += arc_emac.o
drivers/net/ethernet/arc/emac.h+214−0
@@ -0,0 +1,214 @@
1+/*
2+ * Copyright (C) 2004-2013 Synopsys, Inc. (www.synopsys.com)
3+ *
4+ * Registers and bits definitions of ARC EMAC
5+ */
6+
7+#ifndef ARC_EMAC_H
8+#define ARC_EMAC_H
9+
10+#include <linux/device.h>
11+#include <linux/dma-mapping.h>
12+#include <linux/netdevice.h>
13+#include <linux/phy.h>
14+
15+/* STATUS and ENABLE Register bit masks */
16+#define TXINT_MASK (1<<0) /* Transmit interrupt */
17+#define RXINT_MASK (1<<1) /* Receive interrupt */
18+#define ERR_MASK (1<<2) /* Error interrupt */
19+#define TXCH_MASK (1<<3) /* Transmit chaining error interrupt */
20+#define MSER_MASK (1<<4) /* Missed packet counter error */
21+#define RXCR_MASK (1<<8) /* RXCRCERR counter rolled over */
22+#define RXFR_MASK (1<<9) /* RXFRAMEERR counter rolled over */
23+#define RXFL_MASK (1<<10) /* RXOFLOWERR counter rolled over */
24+#define MDIO_MASK (1<<12) /* MDIO complete interrupt */
25+#define TXPL_MASK (1<<31) /* Force polling of BD by EMAC */
26+
27+/* CONTROL Register bit masks */
28+#define EN_MASK (1<<0) /* VMAC enable */
29+#define TXRN_MASK (1<<3) /* TX enable */
30+#define RXRN_MASK (1<<4) /* RX enable */
31+#define DSBC_MASK (1<<8) /* Disable receive broadcast */
32+#define ENFL_MASK (1<<10) /* Enable Full-duplex */
33+#define PROM_MASK (1<<11) /* Promiscuous mode */
34+
35+/* Buffer descriptor INFO bit masks */
36+#define OWN_MASK (1<<31) /* 0-CPU owns buffer, 1-EMAC owns buffer */
37+#define FIRST_MASK (1<<16) /* First buffer in chain */
38+#define LAST_MASK (1<<17) /* Last buffer in chain */
39+#define LEN_MASK 0x000007FF /* last 11 bits */
40+#define CRLS (1<<21)
41+#define DEFR (1<<22)
42+#define DROP (1<<23)
43+#define RTRY (1<<24)
44+#define LTCL (1<<28)
45+#define UFLO (1<<29)
46+
47+#define FOR_EMAC OWN_MASK
48+#define FOR_CPU 0
49+
50+/* ARC EMAC register set combines entries for MAC and MDIO */
51+enum {
52+ R_ID = 0,
53+ R_STATUS,
54+ R_ENABLE,
55+ R_CTRL,
56+ R_POLLRATE,
57+ R_RXERR,
58+ R_MISS,
59+ R_TX_RING,
60+ R_RX_RING,
61+ R_ADDRL,
62+ R_ADDRH,
63+ R_LAFL,
64+ R_LAFH,
65+ R_MDIO,
66+};
67+
68+#define TX_TIMEOUT (400*HZ/1000) /* Transmission timeout */
69+
70+#define ARC_EMAC_NAPI_WEIGHT 40 /* Workload for NAPI */
71+
72+#define EMAC_BUFFER_SIZE 1536 /* EMAC buffer size */
73+
74+/**
75+ * struct arc_emac_bd - EMAC buffer descriptor (BD).
76+ *
77+ * @info: Contains status information on the buffer itself.
78+ * @data: 32-bit byte addressable pointer to the packet data.
79+ */
80+struct arc_emac_bd {
81+ __le32 info;
82+ dma_addr_t data;
83+};
84+
85+/* Number of Rx/Tx BD's */
86+#define RX_BD_NUM 128
87+#define TX_BD_NUM 128
88+
89+#define RX_RING_SZ (RX_BD_NUM * sizeof(struct arc_emac_bd))
90+#define TX_RING_SZ (TX_BD_NUM * sizeof(struct arc_emac_bd))
91+
92+/**
93+ * struct buffer_state - Stores Rx/Tx buffer state.
94+ * @sk_buff: Pointer to socket buffer.
95+ * @addr: Start address of DMA-mapped memory region.
96+ * @len: Length of DMA-mapped memory region.
97+ */
98+struct buffer_state {
99+ struct sk_buff *skb;
100+ DEFINE_DMA_UNMAP_ADDR(addr);
101+ DEFINE_DMA_UNMAP_LEN(len);
102+};
103+
104+/**
105+ * struct arc_emac_priv - Storage of EMAC's private information.
106+ * @dev: Pointer to the current device.
107+ * @ndev: Pointer to the current network device.
108+ * @phy_dev: Pointer to attached PHY device.
109+ * @bus: Pointer to the current MII bus.
110+ * @regs: Base address of EMAC memory-mapped control registers.
111+ * @napi: Structure for NAPI.
112+ * @stats: Network device statistics.
113+ * @rxbd: Pointer to Rx BD ring.
114+ * @txbd: Pointer to Tx BD ring.
115+ * @rxbd_dma: DMA handle for Rx BD ring.
116+ * @txbd_dma: DMA handle for Tx BD ring.
117+ * @rx_buff: Storage for Rx buffers states.
118+ * @tx_buff: Storage for Tx buffers states.
119+ * @txbd_curr: Index of Tx BD to use on the next "ndo_start_xmit".
120+ * @txbd_dirty: Index of Tx BD to free on the next Tx interrupt.
121+ * @last_rx_bd: Index of the last Rx BD we've got from EMAC.
122+ * @link: PHY's last seen link state.
123+ * @duplex: PHY's last set duplex mode.
124+ * @speed: PHY's last set speed.
125+ * @max_speed: Maximum supported by current system network data-rate.
126+ */
127+struct arc_emac_priv {
128+ /* Devices */
129+ struct device *dev;
130+ struct net_device *ndev;
131+ struct phy_device *phy_dev;
132+ struct mii_bus *bus;
133+
134+ void __iomem *regs;
135+
136+ struct napi_struct napi;
137+ struct net_device_stats stats;
138+
139+ struct arc_emac_bd *rxbd;
140+ struct arc_emac_bd *txbd;
141+
142+ dma_addr_t rxbd_dma;
143+ dma_addr_t txbd_dma;
144+
145+ struct buffer_state rx_buff[RX_BD_NUM];
146+ struct buffer_state tx_buff[TX_BD_NUM];
147+ unsigned int txbd_curr;
148+ unsigned int txbd_dirty;
149+
150+ unsigned int last_rx_bd;
151+
152+ unsigned int link;
153+ unsigned int duplex;
154+ unsigned int speed;
155+ unsigned int max_speed;
156+};
157+
158+/**
159+ * arc_reg_set - Sets EMAC register with provided value.
160+ * @priv: Pointer to ARC EMAC private data structure.
161+ * @reg: Register offset from base address.
162+ * @value: Value to set in register.
163+ */
164+static inline void arc_reg_set(struct arc_emac_priv *priv, int reg, int value)
165+{
166+ iowrite32(value, priv->regs + reg * sizeof(int));
167+}
168+
169+/**
170+ * arc_reg_get - Gets value of specified EMAC register.
171+ * @priv: Pointer to ARC EMAC private data structure.
172+ * @reg: Register offset from base address.
173+ *
174+ * returns: Value of requested register.
175+ */
176+static inline unsigned int arc_reg_get(struct arc_emac_priv *priv, int reg)
177+{
178+ return ioread32(priv->regs + reg * sizeof(int));
179+}
180+
181+/**
182+ * arc_reg_or - Applies mask to specified EMAC register - ("reg" | "mask").
183+ * @priv: Pointer to ARC EMAC private data structure.
184+ * @reg: Register offset from base address.
185+ * @mask: Mask to apply to specified register.
186+ *
187+ * This function reads initial register value, then applies provided mask
188+ * to it and then writes register back.
189+ */
190+static inline void arc_reg_or(struct arc_emac_priv *priv, int reg, int mask)
191+{
192+ unsigned int value = arc_reg_get(priv, reg);
193+ arc_reg_set(priv, reg, value | mask);
194+}
195+
196+/**
197+ * arc_reg_clr - Applies mask to specified EMAC register - ("reg" & ~"mask").
198+ * @priv: Pointer to ARC EMAC private data structure.
199+ * @reg: Register offset from base address.
200+ * @mask: Mask to apply to specified register.
201+ *
202+ * This function reads initial register value, then applies provided mask
203+ * to it and then writes register back.
204+ */
205+static inline void arc_reg_clr(struct arc_emac_priv *priv, int reg, int mask)
206+{
207+ unsigned int value = arc_reg_get(priv, reg);
208+ arc_reg_set(priv, reg, value & ~mask);
209+}
210+
211+int arc_mdio_probe(struct platform_device *pdev, struct arc_emac_priv *priv);
212+int arc_mdio_remove(struct arc_emac_priv *priv);
213+
214+#endif /* ARC_EMAC_H */
drivers/net/ethernet/arc/emac_main.c+819−0
@@ -0,0 +1,819 @@
1+/*
2+ * Copyright (C) 2004-2013 Synopsys, Inc. (www.synopsys.com)
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License version 2 as
6+ * published by the Free Software Foundation.
7+ *
8+ * Driver for the ARC EMAC 10100 (hardware revision 5)
9+ *
10+ * Contributors:
11+ * Amit Bhor
12+ * Sameer Dhavale
13+ * Vineet Gupta
14+ */
15+
16+#include <linux/etherdevice.h>
17+#include <linux/interrupt.h>
18+#include <linux/io.h>
19+#include <linux/module.h>
20+#include <linux/of_address.h>
21+#include <linux/of_irq.h>
22+#include <linux/of_mdio.h>
23+#include <linux/of_net.h>
24+#include <linux/of_platform.h>
25+
26+#include "emac.h"
27+
28+#define DRV_NAME "arc_emac"
29+#define DRV_VERSION "1.0"
30+
31+/**
32+ * arc_emac_adjust_link - Adjust the PHY link duplex.
33+ * @ndev: Pointer to the net_device structure.
34+ *
35+ * This function is called to change the duplex setting after auto negotiation
36+ * is done by the PHY.
37+ */
38+static void arc_emac_adjust_link(struct net_device *ndev)
39+{
40+ struct arc_emac_priv *priv = netdev_priv(ndev);
41+ struct phy_device *phy_dev = priv->phy_dev;
42+ unsigned int reg, state_changed = 0;
43+
44+ if (priv->link != phy_dev->link) {
45+ priv->link = phy_dev->link;
46+ state_changed = 1;
47+ }
48+
49+ if (priv->speed != phy_dev->speed) {
50+ priv->speed = phy_dev->speed;
51+ state_changed = 1;
52+ }
53+
54+ if (priv->duplex != phy_dev->duplex) {
55+ reg = arc_reg_get(priv, R_CTRL);
56+
57+ if (DUPLEX_FULL == phy_dev->duplex)
58+ reg |= ENFL_MASK;
59+ else
60+ reg &= ~ENFL_MASK;
61+
62+ arc_reg_set(priv, R_CTRL, reg);
63+ priv->duplex = phy_dev->duplex;
64+ state_changed = 1;
65+ }
66+
67+ if (state_changed)
68+ phy_print_status(phy_dev);
69+}
70+
71+/**
72+ * arc_emac_get_settings - Get PHY settings.
73+ * @ndev: Pointer to net_device structure.
74+ * @cmd: Pointer to ethtool_cmd structure.
75+ *
76+ * This implements ethtool command for getting PHY settings. If PHY could
77+ * not be found, the function returns -ENODEV. This function calls the
78+ * relevant PHY ethtool API to get the PHY settings.
79+ * Issue "ethtool ethX" under linux prompt to execute this function.
80+ */
81+static int arc_emac_get_settings(struct net_device *ndev,
82+ struct ethtool_cmd *cmd)
83+{
84+ struct arc_emac_priv *priv = netdev_priv(ndev);
85+
86+ return phy_ethtool_gset(priv->phy_dev, cmd);
87+}
88+
89+/**
90+ * arc_emac_set_settings - Set PHY settings as passed in the argument.
91+ * @ndev: Pointer to net_device structure.
92+ * @cmd: Pointer to ethtool_cmd structure.
93+ *
94+ * This implements ethtool command for setting various PHY settings. If PHY
95+ * could not be found, the function returns -ENODEV. This function calls the
96+ * relevant PHY ethtool API to set the PHY.
97+ * Issue e.g. "ethtool -s ethX speed 1000" under linux prompt to execute this
98+ * function.
99+ */
100+static int arc_emac_set_settings(struct net_device *ndev,
101+ struct ethtool_cmd *cmd)
102+{
103+ struct arc_emac_priv *priv = netdev_priv(ndev);
104+
105+ if (!capable(CAP_NET_ADMIN))
106+ return -EPERM;
107+
108+ return phy_ethtool_sset(priv->phy_dev, cmd);
109+}
110+
111+/**
112+ * arc_emac_get_drvinfo - Get EMAC driver information.
113+ * @ndev: Pointer to net_device structure.
114+ * @info: Pointer to ethtool_drvinfo structure.
115+ *
116+ * This implements ethtool command for getting the driver information.
117+ * Issue "ethtool -i ethX" under linux prompt to execute this function.
118+ */
119+static void arc_emac_get_drvinfo(struct net_device *ndev,
120+ struct ethtool_drvinfo *info)
121+{
122+ strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
123+ strlcpy(info->version, DRV_VERSION, sizeof(info->version));
124+}
125+
126+static const struct ethtool_ops arc_emac_ethtool_ops = {
127+ .get_settings = arc_emac_get_settings,
128+ .set_settings = arc_emac_set_settings,
129+ .get_drvinfo = arc_emac_get_drvinfo,
130+ .get_link = ethtool_op_get_link,
131+};
132+
133+#define FIRST_OR_LAST_MASK (FIRST_MASK | LAST_MASK)
134+
135+/**
136+ * arc_emac_tx_clean - clears processed by EMAC Tx BDs.
137+ * @ndev: Pointer to the network device.
138+ */
139+static void arc_emac_tx_clean(struct net_device *ndev)
140+{
141+ struct arc_emac_priv *priv = netdev_priv(ndev);
142+ struct net_device_stats *stats = &priv->stats;
143+ unsigned int i;
144+
145+ for (i = 0; i < TX_BD_NUM; i++) {
146+ unsigned int *txbd_dirty = &priv->txbd_dirty;
147+ struct arc_emac_bd *txbd = &priv->txbd[*txbd_dirty];
148+ struct buffer_state *tx_buff = &priv->tx_buff[*txbd_dirty];
149+ struct sk_buff *skb = tx_buff->skb;
150+ unsigned int info = le32_to_cpu(txbd->info);
151+
152+ *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM;
153+
154+ if ((info & FOR_EMAC) || !txbd->data)
155+ break;
156+
157+ if (unlikely(info & (DROP | DEFR | LTCL | UFLO))) {
158+ stats->tx_errors++;
159+ stats->tx_dropped++;
160+
161+ if (info & DEFR)
162+ stats->tx_carrier_errors++;
163+
164+ if (info & LTCL)
165+ stats->collisions++;
166+
167+ if (info & UFLO)
168+ stats->tx_fifo_errors++;
169+ } else if (likely(info & FIRST_OR_LAST_MASK)) {
170+ stats->tx_packets++;
171+ stats->tx_bytes += skb->len;
172+ }
173+
174+ dma_unmap_single(&ndev->dev, dma_unmap_addr(tx_buff, addr),
175+ dma_unmap_len(tx_buff, len), DMA_TO_DEVICE);
176+
177+ /* return the sk_buff to system */
178+ dev_kfree_skb_irq(skb);
179+
180+ txbd->data = 0;
181+ txbd->info = 0;
182+
183+ if (netif_queue_stopped(ndev))
184+ netif_wake_queue(ndev);
185+ }
186+}
187+
188+/**
189+ * arc_emac_rx - processing of Rx packets.
190+ * @ndev: Pointer to the network device.
191+ * @budget: How many BDs to process on 1 call.
192+ *
193+ * returns: Number of processed BDs
194+ *
195+ * Iterate through Rx BDs and deliver received packages to upper layer.
196+ */
197+static int arc_emac_rx(struct net_device *ndev, int budget)
198+{
199+ struct arc_emac_priv *priv = netdev_priv(ndev);
200+ unsigned int work_done;
201+
202+ for (work_done = 0; work_done <= budget; work_done++) {
203+ unsigned int *last_rx_bd = &priv->last_rx_bd;
204+ struct net_device_stats *stats = &priv->stats;
205+ struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
206+ struct arc_emac_bd *rxbd = &priv->rxbd[*last_rx_bd];
207+ unsigned int pktlen, info = le32_to_cpu(rxbd->info);
208+ struct sk_buff *skb;
209+ dma_addr_t addr;
210+
211+ if (unlikely((info & OWN_MASK) == FOR_EMAC))
212+ break;
213+
214+ /* Make a note that we saw a packet at this BD.
215+ * So next time, driver starts from this + 1
216+ */
217+ *last_rx_bd = (*last_rx_bd + 1) % RX_BD_NUM;
218+
219+ if (unlikely((info & FIRST_OR_LAST_MASK) !=
220+ FIRST_OR_LAST_MASK)) {
221+ /* We pre-allocate buffers of MTU size so incoming
222+ * packets won't be split/chained.
223+ */
224+ if (net_ratelimit())
225+ netdev_err(ndev, "incomplete packet received\n");
226+
227+ /* Return ownership to EMAC */
228+ rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE);
229+ stats->rx_errors++;
230+ stats->rx_length_errors++;
231+ continue;
232+ }
233+
234+ pktlen = info & LEN_MASK;
235+ stats->rx_packets++;
236+ stats->rx_bytes += pktlen;
237+ skb = rx_buff->skb;
238+ skb_put(skb, pktlen);
239+ skb->dev = ndev;
240+ skb->protocol = eth_type_trans(skb, ndev);
241+
242+ dma_unmap_single(&ndev->dev, dma_unmap_addr(rx_buff, addr),
243+ dma_unmap_len(rx_buff, len), DMA_FROM_DEVICE);
244+
245+ /* Prepare the BD for next cycle */
246+ rx_buff->skb = netdev_alloc_skb_ip_align(ndev,
247+ EMAC_BUFFER_SIZE);
248+ if (unlikely(!rx_buff->skb)) {
249+ stats->rx_errors++;
250+ /* Because receive_skb is below, increment rx_dropped */
251+ stats->rx_dropped++;
252+ continue;
253+ }
254+
255+ /* receive_skb only if new skb was allocated to avoid holes */
256+ netif_receive_skb(skb);
257+
258+ addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data,
259+ EMAC_BUFFER_SIZE, DMA_FROM_DEVICE);
260+ if (dma_mapping_error(&ndev->dev, addr)) {
261+ if (net_ratelimit())
262+ netdev_err(ndev, "cannot dma map\n");
263+ dev_kfree_skb(rx_buff->skb);
264+ stats->rx_errors++;
265+ continue;
266+ }
267+ dma_unmap_addr_set(rx_buff, addr, addr);
268+ dma_unmap_len_set(rx_buff, len, EMAC_BUFFER_SIZE);
269+
270+ rxbd->data = cpu_to_le32(addr);
271+
272+ /* Make sure pointer to data buffer is set */
273+ wmb();
274+
275+ /* Return ownership to EMAC */
276+ rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE);
277+ }
278+
279+ return work_done;
280+}
281+
282+/**
283+ * arc_emac_poll - NAPI poll handler.
284+ * @napi: Pointer to napi_struct structure.
285+ * @budget: How many BDs to process on 1 call.
286+ *
287+ * returns: Number of processed BDs
288+ */
289+static int arc_emac_poll(struct napi_struct *napi, int budget)
290+{
291+ struct net_device *ndev = napi->dev;
292+ struct arc_emac_priv *priv = netdev_priv(ndev);
293+ unsigned int work_done;
294+
295+ arc_emac_tx_clean(ndev);
296+
297+ work_done = arc_emac_rx(ndev, budget);
298+ if (work_done < budget) {
299+ napi_complete(napi);
300+ arc_reg_or(priv, R_ENABLE, RXINT_MASK);
301+ }
302+
303+ return work_done;
304+}
305+
306+/**
307+ * arc_emac_intr - Global interrupt handler for EMAC.
308+ * @irq: irq number.
309+ * @dev_instance: device instance.
310+ *
311+ * returns: IRQ_HANDLED for all cases.
312+ *
313+ * ARC EMAC has only 1 interrupt line, and depending on bits raised in
314+ * STATUS register we may tell what is a reason for interrupt to fire.
315+ */
316+static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
317+{
318+ struct net_device *ndev = dev_instance;
319+ struct arc_emac_priv *priv = netdev_priv(ndev);
320+ struct net_device_stats *stats = &priv->stats;
321+ unsigned int status;
322+
323+ status = arc_reg_get(priv, R_STATUS);
324+ status &= ~MDIO_MASK;
325+
326+ /* Reset all flags except "MDIO complete" */
327+ arc_reg_set(priv, R_STATUS, status);
328+
329+ if (status & RXINT_MASK) {
330+ if (likely(napi_schedule_prep(&priv->napi))) {
331+ arc_reg_clr(priv, R_ENABLE, RXINT_MASK);
332+ __napi_schedule(&priv->napi);
333+ }
334+ }
335+
336+ if (status & ERR_MASK) {
337+ /* MSER/RXCR/RXFR/RXFL interrupt fires on corresponding
338+ * 8-bit error counter overrun.
339+ */
340+
341+ if (status & MSER_MASK) {
342+ stats->rx_missed_errors += 0x100;
343+ stats->rx_errors += 0x100;
344+ }
345+
346+ if (status & RXCR_MASK) {
347+ stats->rx_crc_errors += 0x100;
348+ stats->rx_errors += 0x100;
349+ }
350+
351+ if (status & RXFR_MASK) {
352+ stats->rx_frame_errors += 0x100;
353+ stats->rx_errors += 0x100;
354+ }
355+
356+ if (status & RXFL_MASK) {
357+ stats->rx_over_errors += 0x100;
358+ stats->rx_errors += 0x100;
359+ }
360+ }
361+
362+ return IRQ_HANDLED;
363+}
364+
365+/**
366+ * arc_emac_open - Open the network device.
367+ * @ndev: Pointer to the network device.
368+ *
369+ * returns: 0, on success or non-zero error value on failure.
370+ *
371+ * This function sets the MAC address, requests and enables an IRQ
372+ * for the EMAC device and starts the Tx queue.
373+ * It also connects to the phy device.
374+ */
375+static int arc_emac_open(struct net_device *ndev)
376+{
377+ struct arc_emac_priv *priv = netdev_priv(ndev);
378+ struct phy_device *phy_dev = priv->phy_dev;
379+ int i;
380+
381+ phy_dev->autoneg = AUTONEG_ENABLE;
382+ phy_dev->speed = 0;
383+ phy_dev->duplex = 0;
384+ phy_dev->advertising = phy_dev->supported;
385+
386+ if (priv->max_speed > 100) {
387+ phy_dev->advertising &= PHY_GBIT_FEATURES;
388+ } else if (priv->max_speed <= 100) {
389+ phy_dev->advertising &= PHY_BASIC_FEATURES;
390+ if (priv->max_speed <= 10) {
391+ phy_dev->advertising &= ~SUPPORTED_100baseT_Half;
392+ phy_dev->advertising &= ~SUPPORTED_100baseT_Full;
393+ }
394+ }
395+
396+ priv->last_rx_bd = 0;
397+
398+ /* Allocate and set buffers for Rx BD's */
399+ for (i = 0; i < RX_BD_NUM; i++) {
400+ dma_addr_t addr;
401+ unsigned int *last_rx_bd = &priv->last_rx_bd;
402+ struct arc_emac_bd *rxbd = &priv->rxbd[*last_rx_bd];
403+ struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
404+
405+ rx_buff->skb = netdev_alloc_skb_ip_align(ndev,
406+ EMAC_BUFFER_SIZE);
407+ if (unlikely(!rx_buff->skb))
408+ return -ENOMEM;
409+
410+ addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data,
411+ EMAC_BUFFER_SIZE, DMA_FROM_DEVICE);
412+ if (dma_mapping_error(&ndev->dev, addr)) {
413+ netdev_err(ndev, "cannot dma map\n");
414+ dev_kfree_skb(rx_buff->skb);
415+ return -ENOMEM;
416+ }
417+ dma_unmap_addr_set(rx_buff, addr, addr);
418+ dma_unmap_len_set(rx_buff, len, EMAC_BUFFER_SIZE);
419+
420+ rxbd->data = cpu_to_le32(addr);
421+
422+ /* Make sure pointer to data buffer is set */
423+ wmb();
424+
425+ /* Return ownership to EMAC */
426+ rxbd->info = cpu_to_le32(FOR_EMAC | EMAC_BUFFER_SIZE);
427+
428+ *last_rx_bd = (*last_rx_bd + 1) % RX_BD_NUM;
429+ }
430+
431+ /* Clean Tx BD's */
432+ memset(priv->txbd, 0, TX_RING_SZ);
433+
434+ /* Initialize logical address filter */
435+ arc_reg_set(priv, R_LAFL, 0);
436+ arc_reg_set(priv, R_LAFH, 0);
437+
438+ /* Set BD ring pointers for device side */
439+ arc_reg_set(priv, R_RX_RING, (unsigned int)priv->rxbd_dma);
440+ arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
441+
442+ /* Enable interrupts */
443+ arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
444+
445+ /* Set CONTROL */
446+ arc_reg_set(priv, R_CTRL,
447+ (RX_BD_NUM << 24) | /* RX BD table length */
448+ (TX_BD_NUM << 16) | /* TX BD table length */
449+ TXRN_MASK | RXRN_MASK);
450+
451+ napi_enable(&priv->napi);
452+
453+ /* Enable EMAC */
454+ arc_reg_or(priv, R_CTRL, EN_MASK);
455+
456+ phy_start_aneg(priv->phy_dev);
457+
458+ netif_start_queue(ndev);
459+
460+ return 0;
461+}
462+
463+/**
464+ * arc_emac_stop - Close the network device.
465+ * @ndev: Pointer to the network device.
466+ *
467+ * This function stops the Tx queue, disables interrupts and frees the IRQ for
468+ * the EMAC device.
469+ * It also disconnects the PHY device associated with the EMAC device.
470+ */
471+static int arc_emac_stop(struct net_device *ndev)
472+{
473+ struct arc_emac_priv *priv = netdev_priv(ndev);
474+
475+ napi_disable(&priv->napi);
476+ netif_stop_queue(ndev);
477+
478+ /* Disable interrupts */
479+ arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
480+
481+ /* Disable EMAC */
482+ arc_reg_clr(priv, R_CTRL, EN_MASK);
483+
484+ return 0;
485+}
486+
487+/**
488+ * arc_emac_stats - Get system network statistics.
489+ * @ndev: Pointer to net_device structure.
490+ *
491+ * Returns the address of the device statistics structure.
492+ * Statistics are updated in interrupt handler.
493+ */
494+static struct net_device_stats *arc_emac_stats(struct net_device *ndev)
495+{
496+ struct arc_emac_priv *priv = netdev_priv(ndev);
497+ struct net_device_stats *stats = &priv->stats;
498+ unsigned long miss, rxerr;
499+ u8 rxcrc, rxfram, rxoflow;
500+
501+ rxerr = arc_reg_get(priv, R_RXERR);
502+ miss = arc_reg_get(priv, R_MISS);
503+
504+ rxcrc = rxerr;
505+ rxfram = rxerr >> 8;
506+ rxoflow = rxerr >> 16;
507+
508+ stats->rx_errors += miss;
509+ stats->rx_errors += rxcrc + rxfram + rxoflow;
510+
511+ stats->rx_over_errors += rxoflow;
512+ stats->rx_frame_errors += rxfram;
513+ stats->rx_crc_errors += rxcrc;
514+ stats->rx_missed_errors += miss;
515+
516+ return stats;
517+}
518+
519+/**
520+ * arc_emac_tx - Starts the data transmission.
521+ * @skb: sk_buff pointer that contains data to be Transmitted.
522+ * @ndev: Pointer to net_device structure.
523+ *
524+ * returns: NETDEV_TX_OK, on success
525+ * NETDEV_TX_BUSY, if any of the descriptors are not free.
526+ *
527+ * This function is invoked from upper layers to initiate transmission.
528+ */
529+static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
530+{
531+ struct arc_emac_priv *priv = netdev_priv(ndev);
532+ unsigned int len, *txbd_curr = &priv->txbd_curr;
533+ struct net_device_stats *stats = &priv->stats;
534+ __le32 *info = &priv->txbd[*txbd_curr].info;
535+ dma_addr_t addr;
536+
537+ if (skb_padto(skb, ETH_ZLEN))
538+ return NETDEV_TX_OK;
539+
540+ len = max_t(unsigned int, ETH_ZLEN, skb->len);
541+
542+ /* EMAC still holds this buffer in its possession.
543+ * CPU must not modify this buffer descriptor
544+ */
545+ if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) {
546+ netif_stop_queue(ndev);
547+ return NETDEV_TX_BUSY;
548+ }
549+
550+ addr = dma_map_single(&ndev->dev, (void *)skb->data, len,
551+ DMA_TO_DEVICE);
552+
553+ if (unlikely(dma_mapping_error(&ndev->dev, addr))) {
554+ stats->tx_dropped++;
555+ stats->tx_errors++;
556+ dev_kfree_skb(skb);
557+ return NETDEV_TX_OK;
558+ }
559+ dma_unmap_addr_set(&priv->tx_buff[*txbd_curr], addr, addr);
560+ dma_unmap_len_set(&priv->tx_buff[*txbd_curr], len, len);
561+
562+ priv->tx_buff[*txbd_curr].skb = skb;
563+ priv->txbd[*txbd_curr].data = cpu_to_le32(addr);
564+
565+ /* Make sure pointer to data buffer is set */
566+ wmb();
567+
568+ *info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);
569+
570+ /* Increment index to point to the next BD */
571+ *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM;
572+
573+ /* Get "info" of the next BD */
574+ info = &priv->txbd[*txbd_curr].info;
575+
576+ /* Check if if Tx BD ring is full - next BD is still owned by EMAC */
577+ if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC))
578+ netif_stop_queue(ndev);
579+
580+ arc_reg_set(priv, R_STATUS, TXPL_MASK);
581+
582+ skb_tx_timestamp(skb);
583+
584+ return NETDEV_TX_OK;
585+}
586+
587+/**
588+ * arc_emac_set_address - Set the MAC address for this device.
589+ * @ndev: Pointer to net_device structure.
590+ * @p: 6 byte Address to be written as MAC address.
591+ *
592+ * This function copies the HW address from the sockaddr structure to the
593+ * net_device structure and updates the address in HW.
594+ *
595+ * returns: -EBUSY if the net device is busy or 0 if the address is set
596+ * successfully.
597+ */
598+static int arc_emac_set_address(struct net_device *ndev, void *p)
599+{
600+ struct arc_emac_priv *priv = netdev_priv(ndev);
601+ struct sockaddr *addr = p;
602+ unsigned int addr_low, addr_hi;
603+
604+ if (netif_running(ndev))
605+ return -EBUSY;
606+
607+ if (!is_valid_ether_addr(addr->sa_data))
608+ return -EADDRNOTAVAIL;
609+
610+ memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
611+
612+ addr_low = le32_to_cpu(*(__le32 *) &ndev->dev_addr[0]);
613+ addr_hi = le16_to_cpu(*(__le16 *) &ndev->dev_addr[4]);
614+
615+ arc_reg_set(priv, R_ADDRL, addr_low);
616+ arc_reg_set(priv, R_ADDRH, addr_hi);
617+
618+ return 0;
619+}
620+
621+static const struct net_device_ops arc_emac_netdev_ops = {
622+ .ndo_open = arc_emac_open,
623+ .ndo_stop = arc_emac_stop,
624+ .ndo_start_xmit = arc_emac_tx,
625+ .ndo_set_mac_address = arc_emac_set_address,
626+ .ndo_get_stats = arc_emac_stats,
627+};
628+
629+static int arc_emac_probe(struct platform_device *pdev)
630+{
631+ struct resource res_regs, res_irq;
632+ struct device_node *phy_node;
633+ struct arc_emac_priv *priv;
634+ struct net_device *ndev;
635+ const char *mac_addr;
636+ unsigned int id, clock_frequency;
637+ int err;
638+
639+ if (!pdev->dev.of_node)
640+ return -ENODEV;
641+
642+ /* Get PHY from device tree */
643+ phy_node = of_parse_phandle(pdev->dev.of_node, "phy", 0);
644+ if (!phy_node) {
645+ dev_err(&pdev->dev, "failed to retrieve phy description from device tree\n");
646+ return -ENODEV;
647+ }
648+
649+ /* Get EMAC registers base address from device tree */
650+ err = of_address_to_resource(pdev->dev.of_node, 0, &res_regs);
651+ if (err) {
652+ dev_err(&pdev->dev, "failed to retrieve registers base from device tree\n");
653+ return -ENODEV;
654+ }
655+
656+ /* Get CPU clock frequency from device tree */
657+ if (of_property_read_u32(pdev->dev.of_node, "clock-frequency",
658+ &clock_frequency)) {
659+ dev_err(&pdev->dev, "failed to retrieve <clock-frequency> from device tree\n");
660+ return -EINVAL;
661+ }
662+
663+ /* Get IRQ from device tree */
664+ err = of_irq_to_resource(pdev->dev.of_node, 0, &res_irq);
665+ if (!err) {
666+ dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n");
667+ return -ENODEV;
668+ }
669+
670+ ndev = alloc_etherdev(sizeof(struct arc_emac_priv));
671+ if (!ndev)
672+ return -ENOMEM;
673+
674+ SET_NETDEV_DEV(ndev, &pdev->dev);
675+
676+ ndev->netdev_ops = &arc_emac_netdev_ops;
677+ ndev->ethtool_ops = &arc_emac_ethtool_ops;
678+ ndev->watchdog_timeo = TX_TIMEOUT;
679+ /* FIXME :: no multicast support yet */
680+ ndev->flags &= ~IFF_MULTICAST;
681+
682+ priv = netdev_priv(ndev);
683+ priv->dev = &pdev->dev;
684+ priv->ndev = ndev;
685+
686+ priv->regs = devm_ioremap_resource(&pdev->dev, &res_regs);
687+ if (IS_ERR(priv->regs)) {
688+ err = PTR_ERR(priv->regs);
689+ goto out;
690+ }
691+ dev_dbg(&pdev->dev, "Registers base address is 0x%p\n", priv->regs);
692+
693+ id = arc_reg_get(priv, R_ID);
694+
695+ /* Check for EMAC revision 5 or 7, magic number */
696+ if (!(id == 0x0005fd02 || id == 0x0007fd02)) {
697+ dev_err(&pdev->dev, "ARC EMAC not detected, id=0x%x\n", id);
698+ err = -ENODEV;
699+ goto out;
700+ }
701+ dev_info(&pdev->dev, "ARC EMAC detected with id: 0x%x\n", id);
702+
703+ /* Set poll rate so that it polls every 1 ms */
704+ arc_reg_set(priv, R_POLLRATE, clock_frequency / 1000000);
705+
706+ /* Get max speed of operation from device tree */
707+ if (of_property_read_u32(pdev->dev.of_node, "max-speed",
708+ &priv->max_speed)) {
709+ dev_err(&pdev->dev, "failed to retrieve <max-speed> from device tree\n");
710+ err = -EINVAL;
711+ goto out;
712+ }
713+
714+ ndev->irq = res_irq.start;
715+ dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq);
716+
717+ /* Register interrupt handler for device */
718+ err = devm_request_irq(&pdev->dev, ndev->irq, arc_emac_intr, 0,
719+ ndev->name, ndev);
720+ if (err) {
721+ dev_err(&pdev->dev, "could not allocate IRQ\n");
722+ goto out;
723+ }
724+
725+ /* Get MAC address from device tree */
726+ mac_addr = of_get_mac_address(pdev->dev.of_node);
727+
728+ if (!mac_addr || !is_valid_ether_addr(mac_addr))
729+ eth_hw_addr_random(ndev);
730+ else
731+ memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
732+
733+ dev_info(&pdev->dev, "MAC address is now %pM\n", ndev->dev_addr);
734+
735+ /* Do 1 allocation instead of 2 separate ones for Rx and Tx BD rings */
736+ priv->rxbd = dmam_alloc_coherent(&pdev->dev, RX_RING_SZ + TX_RING_SZ,
737+ &priv->rxbd_dma, GFP_KERNEL);
738+
739+ if (!priv->rxbd) {
740+ dev_err(&pdev->dev, "failed to allocate data buffers\n");
741+ err = -ENOMEM;
742+ goto out;
743+ }
744+
745+ priv->txbd = priv->rxbd + RX_BD_NUM;
746+
747+ priv->txbd_dma = priv->rxbd_dma + RX_RING_SZ;
748+ dev_dbg(&pdev->dev, "EMAC Device addr: Rx Ring [0x%x], Tx Ring[%x]\n",
749+ (unsigned int)priv->rxbd_dma, (unsigned int)priv->txbd_dma);
750+
751+ err = arc_mdio_probe(pdev, priv);
752+ if (err) {
753+ dev_err(&pdev->dev, "failed to probe MII bus\n");
754+ goto out;
755+ }
756+
757+ priv->phy_dev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0,
758+ PHY_INTERFACE_MODE_MII);
759+ if (!priv->phy_dev) {
760+ dev_err(&pdev->dev, "of_phy_connect() failed\n");
761+ err = -ENODEV;
762+ goto out;
763+ }
764+
765+ dev_info(&pdev->dev, "connected to %s phy with id 0x%x\n",
766+ priv->phy_dev->drv->name, priv->phy_dev->phy_id);
767+
768+ netif_napi_add(ndev, &priv->napi, arc_emac_poll, ARC_EMAC_NAPI_WEIGHT);
769+
770+ err = register_netdev(ndev);
771+ if (err) {
772+ netif_napi_del(&priv->napi);
773+ dev_err(&pdev->dev, "failed to register network device\n");
774+ goto out;
775+ }
776+
777+ return 0;
778+
779+out:
780+ free_netdev(ndev);
781+ return err;
782+}
783+
784+static int arc_emac_remove(struct platform_device *pdev)
785+{
786+ struct net_device *ndev = platform_get_drvdata(pdev);
787+ struct arc_emac_priv *priv = netdev_priv(ndev);
788+
789+ phy_disconnect(priv->phy_dev);
790+ priv->phy_dev = NULL;
791+ arc_mdio_remove(priv);
792+ unregister_netdev(ndev);
793+ netif_napi_del(&priv->napi);
794+ free_netdev(ndev);
795+
796+ return 0;
797+}
798+
799+static const struct of_device_id arc_emac_dt_ids[] = {
800+ { .compatible = "snps,arc-emac" },
801+ { /* Sentinel */ }
802+};
803+MODULE_DEVICE_TABLE(of, arc_emac_dt_ids);
804+
805+static struct platform_driver arc_emac_driver = {
806+ .probe = arc_emac_probe,
807+ .remove = arc_emac_remove,
808+ .driver = {
809+ .name = DRV_NAME,
810+ .owner = THIS_MODULE,
811+ .of_match_table = arc_emac_dt_ids,
812+ },
813+};
814+
815+module_platform_driver(arc_emac_driver);
816+
817+MODULE_AUTHOR("Alexey Brodkin <abrodkin@synopsys.com>");
818+MODULE_DESCRIPTION("ARC EMAC driver");
819+MODULE_LICENSE("GPL");
drivers/net/ethernet/arc/emac_mdio.c+152−0
@@ -0,0 +1,152 @@
1+/*
2+ * Copyright (C) 2004-2013 Synopsys, Inc. (www.synopsys.com)
3+ *
4+ * MDIO implementation for ARC EMAC
5+ */
6+
7+#include <linux/delay.h>
8+#include <linux/of_mdio.h>
9+#include <linux/platform_device.h>
10+
11+#include "emac.h"
12+
13+/* Number of seconds we wait for "MDIO complete" flag to appear */
14+#define ARC_MDIO_COMPLETE_POLL_COUNT 1
15+
16+/**
17+ * arc_mdio_complete_wait - Waits until MDIO transaction is completed.
18+ * @priv: Pointer to ARC EMAC private data structure.
19+ *
20+ * returns: 0 on success, -ETIMEDOUT on a timeout.
21+ */
22+static int arc_mdio_complete_wait(struct arc_emac_priv *priv)
23+{
24+ unsigned int i;
25+
26+ for (i = 0; i < ARC_MDIO_COMPLETE_POLL_COUNT * 40; i++) {
27+ unsigned int status = arc_reg_get(priv, R_STATUS);
28+
29+ status &= MDIO_MASK;
30+
31+ if (status) {
32+ /* Reset "MDIO complete" flag */
33+ arc_reg_set(priv, R_STATUS, status);
34+ return 0;
35+ }
36+
37+ msleep(25);
38+ }
39+
40+ return -ETIMEDOUT;
41+}
42+
43+/**
44+ * arc_mdio_read - MDIO interface read function.
45+ * @bus: Pointer to MII bus structure.
46+ * @phy_addr: Address of the PHY device.
47+ * @reg_num: PHY register to read.
48+ *
49+ * returns: The register contents on success, -ETIMEDOUT on a timeout.
50+ *
51+ * Reads the contents of the requested register from the requested PHY
52+ * address.
53+ */
54+static int arc_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
55+{
56+ struct arc_emac_priv *priv = bus->priv;
57+ unsigned int value;
58+ int error;
59+
60+ arc_reg_set(priv, R_MDIO,
61+ 0x60020000 | (phy_addr << 23) | (reg_num << 18));
62+
63+ error = arc_mdio_complete_wait(priv);
64+ if (error < 0)
65+ return error;
66+
67+ value = arc_reg_get(priv, R_MDIO) & 0xffff;
68+
69+ dev_dbg(priv->dev, "arc_mdio_read(phy_addr=%i, reg_num=%x) = %x\n",
70+ phy_addr, reg_num, value);
71+
72+ return value;
73+}
74+
75+/**
76+ * arc_mdio_write - MDIO interface write function.
77+ * @bus: Pointer to MII bus structure.
78+ * @phy_addr: Address of the PHY device.
79+ * @reg_num: PHY register to write to.
80+ * @value: Value to be written into the register.
81+ *
82+ * returns: 0 on success, -ETIMEDOUT on a timeout.
83+ *
84+ * Writes the value to the requested register.
85+ */
86+static int arc_mdio_write(struct mii_bus *bus, int phy_addr,
87+ int reg_num, u16 value)
88+{
89+ struct arc_emac_priv *priv = bus->priv;
90+
91+ dev_dbg(priv->dev,
92+ "arc_mdio_write(phy_addr=%i, reg_num=%x, value=%x)\n",
93+ phy_addr, reg_num, value);
94+
95+ arc_reg_set(priv, R_MDIO,
96+ 0x50020000 | (phy_addr << 23) | (reg_num << 18) | value);
97+
98+ return arc_mdio_complete_wait(priv);
99+}
100+
101+/**
102+ * arc_mdio_probe - MDIO probe function.
103+ * @pdev: Pointer to platform device.
104+ * @priv: Pointer to ARC EMAC private data structure.
105+ *
106+ * returns: 0 on success, -ENOMEM when mdiobus_alloc
107+ * (to allocate memory for MII bus structure) fails.
108+ *
109+ * Sets up and registers the MDIO interface.
110+ */
111+int arc_mdio_probe(struct platform_device *pdev, struct arc_emac_priv *priv)
112+{
113+ struct mii_bus *bus;
114+ int error;
115+
116+ bus = mdiobus_alloc();
117+ if (!bus)
118+ return -ENOMEM;
119+
120+ priv->bus = bus;
121+ bus->priv = priv;
122+ bus->parent = priv->dev;
123+ bus->name = "Synopsys MII Bus",
124+ bus->read = &arc_mdio_read;
125+ bus->write = &arc_mdio_write;
126+
127+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
128+
129+ error = of_mdiobus_register(bus, pdev->dev.of_node);
130+ if (error) {
131+ dev_err(priv->dev, "cannot register MDIO bus %s\n", bus->name);
132+ mdiobus_free(bus);
133+ return error;
134+ }
135+
136+ return 0;
137+}
138+
139+/**
140+ * arc_mdio_remove - MDIO remove function.
141+ * @priv: Pointer to ARC EMAC private data structure.
142+ *
143+ * Unregisters the MDIO and frees any associate memory for MII bus.
144+ */
145+int arc_mdio_remove(struct arc_emac_priv *priv)
146+{
147+ mdiobus_unregister(priv->bus);
148+ mdiobus_free(priv->bus);
149+ priv->bus = NULL;
150+
151+ return 0;
152+}
drivers/net/ethernet/atheros/Kconfig+0−5
@@ -22,7 +22,6 @@ config ATL2 · 21 unmodified lines
2222 tristate "Atheros L2 Fast Ethernet support"
2323 depends on PCI
2424 select CRC32
25− select NET_CORE
2625 select MII
2726 ---help---
2827 This driver supports the Atheros L2 fast ethernet adapter.
@@ -34,7 +33,6 @@ config ATL1 · 5 unmodified lines
3433 tristate "Atheros/Attansic L1 Gigabit Ethernet support"
3534 depends on PCI
3635 select CRC32
37− select NET_CORE
3836 select MII
3937 ---help---
4038 This driver supports the Atheros/Attansic L1 gigabit ethernet
@@ -47,7 +45,6 @@ config ATL1E · 6 unmodified lines
4745 tristate "Atheros L1E Gigabit Ethernet support"
4846 depends on PCI
4947 select CRC32
50− select NET_CORE
5148 select MII
5249 ---help---
5350 This driver supports the Atheros L1E gigabit ethernet adapter.
@@ -59,7 +56,6 @@ config ATL1C · 5 unmodified lines
5956 tristate "Atheros L1C Gigabit Ethernet support"
6057 depends on PCI
6158 select CRC32
62− select NET_CORE
6359 select MII
6460 ---help---
6561 This driver supports the Atheros L1C gigabit ethernet adapter.
@@ -71,7 +67,6 @@ config ALX · 5 unmodified lines
7167 tristate "Qualcomm Atheros AR816x/AR817x support"
7268 depends on PCI
7369 select CRC32
74− select NET_CORE
7570 select MDIO
7671 help
7772 This driver supports the Qualcomm Atheros L1F ethernet adapter,
drivers/net/ethernet/atheros/alx/alx.h+4−4
@@ -85,16 +85,16 @@ struct alx_priv { · 84 unmodified lines
8585 struct {
8686 dma_addr_t dma;
8787 void *virt;
88− int size;
88+ unsigned int size;
8989 } descmem;
9090
9191 /* protect int_mask updates */
9292 spinlock_t irq_lock;
9393 u32 int_mask;
9494
95− int tx_ringsz;
96− int rx_ringsz;
97− int rxbuf_size;
95+ unsigned int tx_ringsz;
96+ unsigned int rx_ringsz;
97+ unsigned int rxbuf_size;
9898
9999 struct napi_struct napi;
100100 struct alx_tx_queue txq;
drivers/net/ethernet/atheros/alx/ethtool.c+36−96
@@ -46,21 +46,37 @@ · 45 unmodified lines
4646 #include "reg.h"
4747 #include "hw.h"
4848
49+static u32 alx_get_supported_speeds(struct alx_hw *hw)
50+{
51+ u32 supported = SUPPORTED_10baseT_Half |
52+ SUPPORTED_10baseT_Full |
53+ SUPPORTED_100baseT_Half |
54+ SUPPORTED_100baseT_Full;
55+
56+ if (alx_hw_giga(hw))
57+ supported |= SUPPORTED_1000baseT_Full;
58+
59+ BUILD_BUG_ON(SUPPORTED_10baseT_Half != ADVERTISED_10baseT_Half);
60+ BUILD_BUG_ON(SUPPORTED_10baseT_Full != ADVERTISED_10baseT_Full);
61+ BUILD_BUG_ON(SUPPORTED_100baseT_Half != ADVERTISED_100baseT_Half);
62+ BUILD_BUG_ON(SUPPORTED_100baseT_Full != ADVERTISED_100baseT_Full);
63+ BUILD_BUG_ON(SUPPORTED_1000baseT_Full != ADVERTISED_1000baseT_Full);
64+
65+ return supported;
66+}
4967
5068 static int alx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
5169 {
5270 struct alx_priv *alx = netdev_priv(netdev);
5371 struct alx_hw *hw = &alx->hw;
5472
55− ecmd->supported = SUPPORTED_10baseT_Half |
56− SUPPORTED_10baseT_Full |
57− SUPPORTED_100baseT_Half |
58− SUPPORTED_100baseT_Full |
59− SUPPORTED_Autoneg |
73+ ecmd->supported = SUPPORTED_Autoneg |
6074 SUPPORTED_TP |
61− SUPPORTED_Pause;
75+ SUPPORTED_Pause |
76+ SUPPORTED_Asym_Pause;
6277 if (alx_hw_giga(hw))
6378 ecmd->supported |= SUPPORTED_1000baseT_Full;
79+ ecmd->supported |= alx_get_supported_speeds(hw);
6480
6581 ecmd->advertising = ADVERTISED_TP;
6682 if (hw->adv_cfg & ADVERTISED_Autoneg)
@@ -68,6 +84,7 @@ static int alx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 1 unmodified line
6884
6985 ecmd->port = PORT_TP;
7086 ecmd->phy_address = 0;
87+
7188 if (hw->adv_cfg & ADVERTISED_Autoneg)
7289 ecmd->autoneg = AUTONEG_ENABLE;
7390 else
@@ -85,14 +102,8 @@ static int alx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 11 unmodified lines
85102 }
86103 }
87104
88− if (hw->link_speed != SPEED_UNKNOWN) {
89− ethtool_cmd_speed_set(ecmd,
90− hw->link_speed - hw->link_speed % 10);
91− ecmd->duplex = hw->link_speed % 10;
92− } else {
93− ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
94− ecmd->duplex = DUPLEX_UNKNOWN;
95− }
105+ ethtool_cmd_speed_set(ecmd, hw->link_speed);
106+ ecmd->duplex = hw->duplex;
96107
97108 return 0;
98109 }
@@ -106,28 +117,15 @@ static int alx_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) · 7 unmodified lines
106117 ASSERT_RTNL();
107118
108119 if (ecmd->autoneg == AUTONEG_ENABLE) {
109− if (ecmd->advertising & ADVERTISED_1000baseT_Half)
120+ if (ecmd->advertising & ~alx_get_supported_speeds(hw))
110121 return -EINVAL;
111122 adv_cfg = ecmd->advertising | ADVERTISED_Autoneg;
112123 } else {
113− int speed = ethtool_cmd_speed(ecmd);
114−
115− switch (speed + ecmd->duplex) {
116− case SPEED_10 + DUPLEX_HALF:
117− adv_cfg = ADVERTISED_10baseT_Half;
118− break;
119− case SPEED_10 + DUPLEX_FULL:
120− adv_cfg = ADVERTISED_10baseT_Full;
121− break;
122− case SPEED_100 + DUPLEX_HALF:
123− adv_cfg = ADVERTISED_100baseT_Half;
124− break;
125− case SPEED_100 + DUPLEX_FULL:
126− adv_cfg = ADVERTISED_100baseT_Full;
127− break;
128− default:
124+ adv_cfg = alx_speed_to_ethadv(ethtool_cmd_speed(ecmd),
125+ ecmd->duplex);
126+
127+ if (!adv_cfg || adv_cfg == ADVERTISED_1000baseT_Full)
129128 return -EINVAL;
130− }
131129 }
132130
133131 hw->adv_cfg = adv_cfg;
@@ -140,21 +138,10 @@ static void alx_get_pauseparam(struct net_device *netdev, · 6 unmodified lines
140138 struct alx_priv *alx = netdev_priv(netdev);
141139 struct alx_hw *hw = &alx->hw;
142140
143− if (hw->flowctrl & ALX_FC_ANEG &&
144− hw->adv_cfg & ADVERTISED_Autoneg)
145− pause->autoneg = AUTONEG_ENABLE;
146− else
147− pause->autoneg = AUTONEG_DISABLE;
148−
149− if (hw->flowctrl & ALX_FC_TX)
150− pause->tx_pause = 1;
151− else
152− pause->tx_pause = 0;
153−
154− if (hw->flowctrl & ALX_FC_RX)
155− pause->rx_pause = 1;
156− else
157− pause->rx_pause = 0;
141+ pause->autoneg = !!(hw->flowctrl & ALX_FC_ANEG &&
142+ hw->adv_cfg & ADVERTISED_Autoneg);
143+ pause->tx_pause = !!(hw->flowctrl & ALX_FC_TX);
144+ pause->rx_pause = !!(hw->flowctrl & ALX_FC_RX);
158145 }
159146
160147
@@ -187,7 +174,8 @@ static int alx_set_pauseparam(struct net_device *netdev, · 26 unmodified lines
187174
188175 if (reconfig_phy) {
189176 err = alx_setup_speed_duplex(hw, hw->adv_cfg, fc);
190− return err;
177+ if (err)
178+ return err;
191179 }
192180
193181 /* flow control on mac */
@@ -213,60 +201,12 @@ static void alx_set_msglevel(struct net_device *netdev, u32 data) · 19 unmodified lines
213201 alx->msg_enable = data;
214202 }
215203
216−static void alx_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
217−{
218− struct alx_priv *alx = netdev_priv(netdev);
219− struct alx_hw *hw = &alx->hw;
220−
221− wol->supported = WAKE_MAGIC | WAKE_PHY;
222− wol->wolopts = 0;
223−
224− if (hw->sleep_ctrl & ALX_SLEEP_WOL_MAGIC)
225− wol->wolopts |= WAKE_MAGIC;
226− if (hw->sleep_ctrl & ALX_SLEEP_WOL_PHY)
227− wol->wolopts |= WAKE_PHY;
228−}
229−
230−static int alx_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
231−{
232− struct alx_priv *alx = netdev_priv(netdev);
233− struct alx_hw *hw = &alx->hw;
234−
235− if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE |
236− WAKE_UCAST | WAKE_BCAST | WAKE_MCAST))
237− return -EOPNOTSUPP;
238−
239− hw->sleep_ctrl = 0;
240−
241− if (wol->wolopts & WAKE_MAGIC)
242− hw->sleep_ctrl |= ALX_SLEEP_WOL_MAGIC;
243− if (wol->wolopts & WAKE_PHY)
244− hw->sleep_ctrl |= ALX_SLEEP_WOL_PHY;
245−
246− device_set_wakeup_enable(&alx->hw.pdev->dev, hw->sleep_ctrl);
247−
248− return 0;
249−}
250−
251−static void alx_get_drvinfo(struct net_device *netdev,
252− struct ethtool_drvinfo *drvinfo)
253−{
254− struct alx_priv *alx = netdev_priv(netdev);
255−
256− strlcpy(drvinfo->driver, alx_drv_name, sizeof(drvinfo->driver));
257− strlcpy(drvinfo->bus_info, pci_name(alx->hw.pdev),
258− sizeof(drvinfo->bus_info));
259−}
260−
261204 const struct ethtool_ops alx_ethtool_ops = {
262205 .get_settings = alx_get_settings,
263206 .set_settings = alx_set_settings,
264207 .get_pauseparam = alx_get_pauseparam,
265208 .set_pauseparam = alx_set_pauseparam,
266− .get_drvinfo = alx_get_drvinfo,
267209 .get_msglevel = alx_get_msglevel,
268210 .set_msglevel = alx_set_msglevel,
269− .get_wol = alx_get_wol,
270− .set_wol = alx_set_wol,
271211 .get_link = ethtool_op_get_link,
272212 };
drivers/net/ethernet/atheros/alx/hw.c+19−193
@@ -282,8 +282,8 @@ static bool alx_read_macaddr(struct alx_hw *hw, u8 *addr) · 281 unmodified lines
282282 mac1 = alx_read_mem32(hw, ALX_STAD1);
283283
284284 /* addr should be big-endian */
285− *(__be32 *)(addr + 2) = cpu_to_be32(mac0);
286− *(__be16 *)addr = cpu_to_be16(mac1);
285+ put_unaligned(cpu_to_be32(mac0), (__be32 *)(addr + 2));
286+ put_unaligned(cpu_to_be16(mac1), (__be16 *)addr);
287287
288288 return is_valid_ether_addr(addr);
289289 }
@@ -326,22 +326,12 @@ void alx_set_macaddr(struct alx_hw *hw, const u8 *addr) · 36 unmodified lines
326326 u32 val;
327327
328328 /* for example: 00-0B-6A-F6-00-DC * STAD0=6AF600DC, STAD1=000B */
329− val = be32_to_cpu(*(__be32 *)(addr + 2));
329+ val = be32_to_cpu(get_unaligned((__be32 *)(addr + 2)));
330330 alx_write_mem32(hw, ALX_STAD0, val);
331− val = be16_to_cpu(*(__be16 *)addr);
331+ val = be16_to_cpu(get_unaligned((__be16 *)addr));
332332 alx_write_mem32(hw, ALX_STAD1, val);
333333 }
334334
335−static void alx_enable_osc(struct alx_hw *hw)
336−{
337− u32 val;
338−
339− /* rising edge */
340− val = alx_read_mem32(hw, ALX_MISC);
341− alx_write_mem32(hw, ALX_MISC, val & ~ALX_MISC_INTNLOSC_OPEN);
342− alx_write_mem32(hw, ALX_MISC, val | ALX_MISC_INTNLOSC_OPEN);
343−}
344−
345335 static void alx_reset_osc(struct alx_hw *hw, u8 rev)
346336 {
347337 u32 val, val2;
@@ -624,12 +614,12 @@ void alx_start_mac(struct alx_hw *hw) · 276 unmodified lines
624614 alx_write_mem32(hw, ALX_TXQ0, txq | ALX_TXQ0_EN);
625615
626616 mac = hw->rx_ctrl;
627− if (hw->link_speed % 10 == DUPLEX_FULL)
617+ if (hw->duplex == DUPLEX_FULL)
628618 mac |= ALX_MAC_CTRL_FULLD;
629619 else
630620 mac &= ~ALX_MAC_CTRL_FULLD;
631621 ALX_SET_FIELD(mac, ALX_MAC_CTRL_SPEED,
632− hw->link_speed >= SPEED_1000 ? ALX_MAC_CTRL_SPEED_1000 :
622+ hw->link_speed == SPEED_1000 ? ALX_MAC_CTRL_SPEED_1000 :
633623 ALX_MAC_CTRL_SPEED_10_100);
634624 mac |= ALX_MAC_CTRL_TX_EN | ALX_MAC_CTRL_RX_EN;
635625 hw->rx_ctrl = mac;
@@ -790,28 +780,22 @@ void alx_post_phy_link(struct alx_hw *hw) · 154 unmodified lines
790780 u16 phy_val, len, agc;
791781 u8 revid = alx_hw_revision(hw);
792782 bool adj_th = revid == ALX_REV_B0;
793− int speed;
794−
795− if (hw->link_speed == SPEED_UNKNOWN)
796− speed = SPEED_UNKNOWN;
797− else
798− speed = hw->link_speed - hw->link_speed % 10;
799783
800784 if (revid != ALX_REV_B0 && !alx_is_rev_a(revid))
801785 return;
802786
803787 /* 1000BT/AZ, wrong cable length */
804− if (speed != SPEED_UNKNOWN) {
788+ if (hw->link_speed != SPEED_UNKNOWN) {
805789 alx_read_phy_ext(hw, ALX_MIIEXT_PCS, ALX_MIIEXT_CLDCTRL6,
806790 &phy_val);
807791 len = ALX_GET_FIELD(phy_val, ALX_CLDCTRL6_CAB_LEN);
808792 alx_read_phy_dbg(hw, ALX_MIIDBG_AGC, &phy_val);
809793 agc = ALX_GET_FIELD(phy_val, ALX_AGC_2_VGA);
810794
811− if ((speed == SPEED_1000 &&
795+ if ((hw->link_speed == SPEED_1000 &&
812796 (len > ALX_CLDCTRL6_CAB_LEN_SHORT1G ||
813797 (len == 0 && agc > ALX_AGC_LONG1G_LIMT))) ||
814− (speed == SPEED_100 &&
798+ (hw->link_speed == SPEED_100 &&
815799 (len > ALX_CLDCTRL6_CAB_LEN_SHORT100M ||
816800 (len == 0 && agc > ALX_AGC_LONG100M_LIMT)))) {
817801 alx_write_phy_dbg(hw, ALX_MIIDBG_AZ_ANADECT,
@@ -831,10 +815,10 @@ void alx_post_phy_link(struct alx_hw *hw) · 13 unmodified lines
831815
832816 /* threshold adjust */
833817 if (adj_th && hw->lnk_patch) {
834− if (speed == SPEED_100) {
818+ if (hw->link_speed == SPEED_100) {
835819 alx_write_phy_dbg(hw, ALX_MIIDBG_MSE16DB,
836820 ALX_MSE16DB_UP);
837− } else if (speed == SPEED_1000) {
821+ } else if (hw->link_speed == SPEED_1000) {
838822 /*
839823 * Giga link threshold, raise the tolerance of
840824 * noise 50%
@@ -864,66 +848,6 @@ void alx_post_phy_link(struct alx_hw *hw) · 23 unmodified lines
864848 }
865849 }
866850
867−
868−/* NOTE:
869− * 1. phy link must be established before calling this function
870− * 2. wol option (pattern,magic,link,etc.) is configed before call it.
871− */
872−int alx_pre_suspend(struct alx_hw *hw, int speed)
873−{
874− u32 master, mac, phy, val;
875− int err = 0;
876−
877− master = alx_read_mem32(hw, ALX_MASTER);
878− master &= ~ALX_MASTER_PCLKSEL_SRDS;
879− mac = hw->rx_ctrl;
880− /* 10/100 half */
881− ALX_SET_FIELD(mac, ALX_MAC_CTRL_SPEED, ALX_MAC_CTRL_SPEED_10_100);
882− mac &= ~(ALX_MAC_CTRL_FULLD | ALX_MAC_CTRL_RX_EN | ALX_MAC_CTRL_TX_EN);
883−
884− phy = alx_read_mem32(hw, ALX_PHY_CTRL);
885− phy &= ~(ALX_PHY_CTRL_DSPRST_OUT | ALX_PHY_CTRL_CLS);
886− phy |= ALX_PHY_CTRL_RST_ANALOG | ALX_PHY_CTRL_HIB_PULSE |
887− ALX_PHY_CTRL_HIB_EN;
888−
889− /* without any activity */
890− if (!(hw->sleep_ctrl & ALX_SLEEP_ACTIVE)) {
891− err = alx_write_phy_reg(hw, ALX_MII_IER, 0);
892− if (err)
893− return err;
894− phy |= ALX_PHY_CTRL_IDDQ | ALX_PHY_CTRL_POWER_DOWN;
895− } else {
896− if (hw->sleep_ctrl & (ALX_SLEEP_WOL_MAGIC | ALX_SLEEP_CIFS))
897− mac |= ALX_MAC_CTRL_RX_EN | ALX_MAC_CTRL_BRD_EN;
898− if (hw->sleep_ctrl & ALX_SLEEP_CIFS)
899− mac |= ALX_MAC_CTRL_TX_EN;
900− if (speed % 10 == DUPLEX_FULL)
901− mac |= ALX_MAC_CTRL_FULLD;
902− if (speed >= SPEED_1000)
903− ALX_SET_FIELD(mac, ALX_MAC_CTRL_SPEED,
904− ALX_MAC_CTRL_SPEED_1000);
905− phy |= ALX_PHY_CTRL_DSPRST_OUT;
906− err = alx_write_phy_ext(hw, ALX_MIIEXT_ANEG,
907− ALX_MIIEXT_S3DIG10,
908− ALX_MIIEXT_S3DIG10_SL);
909− if (err)
910− return err;
911− }
912−
913− alx_enable_osc(hw);
914− hw->rx_ctrl = mac;
915− alx_write_mem32(hw, ALX_MASTER, master);
916− alx_write_mem32(hw, ALX_MAC_CTRL, mac);
917− alx_write_mem32(hw, ALX_PHY_CTRL, phy);
918−
919− /* set val of PDLL D3PLLOFF */
920− val = alx_read_mem32(hw, ALX_PDLL_TRNS1);
921− val |= ALX_PDLL_TRNS1_D3PLLOFF_EN;
922− alx_write_mem32(hw, ALX_PDLL_TRNS1, val);
923−
924− return 0;
925−}
926−
927851 bool alx_phy_configured(struct alx_hw *hw)
928852 {
929853 u32 cfg, hw_cfg;
@@ -938,7 +862,7 @@ bool alx_phy_configured(struct alx_hw *hw) · 8 unmodified lines
938862 return cfg == hw_cfg;
939863 }
940864
941−int alx_get_phy_link(struct alx_hw *hw, int *speed)
865+int alx_read_phy_link(struct alx_hw *hw)
942866 {
943867 struct pci_dev *pdev = hw->pdev;
944868 u16 bmsr, giga;
@@ -953,7 +877,8 @@ int alx_get_phy_link(struct alx_hw *hw, int *speed) · 8 unmodified lines
953877 return err;
954878
955879 if (!(bmsr & BMSR_LSTATUS)) {
956− *speed = SPEED_UNKNOWN;
880+ hw->link_speed = SPEED_UNKNOWN;
881+ hw->duplex = DUPLEX_UNKNOWN;
957882 return 0;
958883 }
959884
@@ -967,20 +892,20 @@ int alx_get_phy_link(struct alx_hw *hw, int *speed) · 7 unmodified lines
967892
968893 switch (giga & ALX_GIGA_PSSR_SPEED) {
969894 case ALX_GIGA_PSSR_1000MBS:
970− *speed = SPEED_1000;
895+ hw->link_speed = SPEED_1000;
971896 break;
972897 case ALX_GIGA_PSSR_100MBS:
973− *speed = SPEED_100;
898+ hw->link_speed = SPEED_100;
974899 break;
975900 case ALX_GIGA_PSSR_10MBS:
976− *speed = SPEED_10;
901+ hw->link_speed = SPEED_10;
977902 break;
978903 default:
979904 goto wrong_speed;
980905 }
981906
982− *speed += (giga & ALX_GIGA_PSSR_DPLX) ? DUPLEX_FULL : DUPLEX_HALF;
983− return 1;
907+ hw->duplex = (giga & ALX_GIGA_PSSR_DPLX) ? DUPLEX_FULL : DUPLEX_HALF;
908+ return 0;
984909
985910 wrong_speed:
986911 dev_err(&pdev->dev, "invalid PHY speed/duplex: 0x%x\n", giga);
@@ -995,26 +920,6 @@ int alx_clear_phy_intr(struct alx_hw *hw) · 8 unmodified lines
995920 return alx_read_phy_reg(hw, ALX_MII_ISR, &isr);
996921 }
997922
998−int alx_config_wol(struct alx_hw *hw)
999−{
1000− u32 wol = 0;
1001− int err = 0;
1002−
1003− /* turn on magic packet event */
1004− if (hw->sleep_ctrl & ALX_SLEEP_WOL_MAGIC)
1005− wol |= ALX_WOL0_MAGIC_EN | ALX_WOL0_PME_MAGIC_EN;
1006−
1007− /* turn on link up event */
1008− if (hw->sleep_ctrl & ALX_SLEEP_WOL_PHY) {
1009− wol |= ALX_WOL0_LINK_EN | ALX_WOL0_PME_LINK;
1010− /* only link up can wake up */
1011− err = alx_write_phy_reg(hw, ALX_MII_IER, ALX_IER_LINK_UP);
1012− }
1013− alx_write_mem32(hw, ALX_WOL0, wol);
1014−
1015− return err;
1016−}
1017−
1018923 void alx_disable_rss(struct alx_hw *hw)
1019924 {
1020925 u32 ctrl = alx_read_mem32(hw, ALX_RXQ0);
@@ -1126,85 +1031,6 @@ void alx_configure_basic(struct alx_hw *hw) · 105 unmodified lines
11261031 alx_write_mem32(hw, ALX_WRR, val);
11271032 }
11281033
1129−static inline u32 alx_speed_to_ethadv(int speed)
1130−{
1131− switch (speed) {
1132− case SPEED_1000 + DUPLEX_FULL:
1133− return ADVERTISED_1000baseT_Full;
1134− case SPEED_100 + DUPLEX_FULL:
1135− return ADVERTISED_100baseT_Full;
1136− case SPEED_100 + DUPLEX_HALF:
1137− return ADVERTISED_10baseT_Half;
1138− case SPEED_10 + DUPLEX_FULL:
1139− return ADVERTISED_10baseT_Full;
1140− case SPEED_10 + DUPLEX_HALF:
1141− return ADVERTISED_10baseT_Half;
1142− default:
1143− return 0;
1144− }
1145−}
1146−
1147−int alx_select_powersaving_speed(struct alx_hw *hw, int *speed)
1148−{
1149− int i, err, spd;
1150− u16 lpa;
1151−
1152− err = alx_get_phy_link(hw, &spd);
1153− if (err < 0)
1154− return err;
1155−
1156− if (spd == SPEED_UNKNOWN)
1157− return 0;
1158−
1159− err = alx_read_phy_reg(hw, MII_LPA, &lpa);
1160− if (err)
1161− return err;
1162−
1163− if (!(lpa & LPA_LPACK)) {
1164− *speed = spd;
1165− return 0;
1166− }
1167−
1168− if (lpa & LPA_10FULL)
1169− *speed = SPEED_10 + DUPLEX_FULL;
1170− else if (lpa & LPA_10HALF)
1171− *speed = SPEED_10 + DUPLEX_HALF;
1172− else if (lpa & LPA_100FULL)
1173− *speed = SPEED_100 + DUPLEX_FULL;
1174− else
1175− *speed = SPEED_100 + DUPLEX_HALF;
1176−
1177− if (*speed != spd) {
1178− err = alx_write_phy_reg(hw, ALX_MII_IER, 0);
1179− if (err)
1180− return err;
1181− err = alx_setup_speed_duplex(hw,
1182− alx_speed_to_ethadv(*speed) |
1183− ADVERTISED_Autoneg,
1184− ALX_FC_ANEG | ALX_FC_RX |
1185− ALX_FC_TX);
1186− if (err)
1187− return err;
1188−
1189− /* wait for linkup */
1190− for (i = 0; i < ALX_MAX_SETUP_LNK_CYCLE; i++) {
1191− int speed2;
1192−
1193− msleep(100);
1194−
1195− err = alx_get_phy_link(hw, &speed2);
1196− if (err < 0)
1197− return err;
1198− if (speed2 != SPEED_UNKNOWN)
1199− break;
1200− }
1201− if (i == ALX_MAX_SETUP_LNK_CYCLE)
1202− return -ETIMEDOUT;
1203− }
1204−
1205− return 0;
1206−}
1207−
12081034 bool alx_get_phy_info(struct alx_hw *hw)
12091035 {
12101036 u16 devs1, devs2;
drivers/net/ethernet/atheros/alx/hw.h+18−7
@@ -412,12 +412,11 @@ struct alx_hw { · 411 unmodified lines
412412 u32 smb_timer;
413413 /* SPEED_* + DUPLEX_*, SPEED_UNKNOWN if link is down */
414414 int link_speed;
415+ u8 duplex;
415416
416417 /* auto-neg advertisement or force mode config */
417− u32 adv_cfg;
418418 u8 flowctrl;
419−
420− u32 sleep_ctrl;
419+ u32 adv_cfg;
421420
422421 spinlock_t mdio_lock;
423422 struct mdio_if_info mdio;
@@ -478,14 +477,12 @@ void alx_reset_pcie(struct alx_hw *hw); · 54 unmodified lines
478477 void alx_enable_aspm(struct alx_hw *hw, bool l0s_en, bool l1_en);
479478 int alx_setup_speed_duplex(struct alx_hw *hw, u32 ethadv, u8 flowctrl);
480479 void alx_post_phy_link(struct alx_hw *hw);
481−int alx_pre_suspend(struct alx_hw *hw, int speed);
482480 int alx_read_phy_reg(struct alx_hw *hw, u16 reg, u16 *phy_data);
483481 int alx_write_phy_reg(struct alx_hw *hw, u16 reg, u16 phy_data);
484482 int alx_read_phy_ext(struct alx_hw *hw, u8 dev, u16 reg, u16 *pdata);
485483 int alx_write_phy_ext(struct alx_hw *hw, u8 dev, u16 reg, u16 data);
486−int alx_get_phy_link(struct alx_hw *hw, int *speed);
484+int alx_read_phy_link(struct alx_hw *hw);
487485 int alx_clear_phy_intr(struct alx_hw *hw);
488−int alx_config_wol(struct alx_hw *hw);
489486 void alx_cfg_mac_flowcontrol(struct alx_hw *hw, u8 fc);
490487 void alx_start_mac(struct alx_hw *hw);
491488 int alx_reset_mac(struct alx_hw *hw);
@@ -493,7 +490,21 @@ void alx_set_macaddr(struct alx_hw *hw, const u8 *addr); · 1 unmodified line
493490 bool alx_phy_configured(struct alx_hw *hw);
494491 void alx_configure_basic(struct alx_hw *hw);
495492 void alx_disable_rss(struct alx_hw *hw);
496−int alx_select_powersaving_speed(struct alx_hw *hw, int *speed);
497493 bool alx_get_phy_info(struct alx_hw *hw);
498494
495+static inline u32 alx_speed_to_ethadv(int speed, u8 duplex)
496+{
497+ if (speed == SPEED_1000 && duplex == DUPLEX_FULL)
498+ return ADVERTISED_1000baseT_Full;
499+ if (speed == SPEED_100 && duplex == DUPLEX_FULL)
500+ return ADVERTISED_100baseT_Full;
501+ if (speed == SPEED_100 && duplex== DUPLEX_HALF)
502+ return ADVERTISED_100baseT_Half;
503+ if (speed == SPEED_10 && duplex == DUPLEX_FULL)
504+ return ADVERTISED_10baseT_Full;
505+ if (speed == SPEED_10 && duplex == DUPLEX_HALF)
506+ return ADVERTISED_10baseT_Half;
507+ return 0;
508+}
509+
499510 #endif
drivers/net/ethernet/atheros/alx/main.c+32−141
@@ -706,12 +706,12 @@ static int alx_init_sw(struct alx_priv *alx) · 705 unmodified lines
706706 alx->rxbuf_size = ALIGN(ALX_RAW_MTU(hw->mtu), 8);
707707 alx->tx_ringsz = 256;
708708 alx->rx_ringsz = 512;
709− hw->sleep_ctrl = ALX_SLEEP_WOL_MAGIC | ALX_SLEEP_WOL_PHY;
710709 hw->imt = 200;
711710 alx->int_mask = ALX_ISR_MISC;
712711 hw->dma_chnl = hw->max_dma_chnl;
713712 hw->ith_tpd = alx->tx_ringsz / 3;
714713 hw->link_speed = SPEED_UNKNOWN;
714+ hw->duplex = DUPLEX_UNKNOWN;
715715 hw->adv_cfg = ADVERTISED_Autoneg |
716716 ADVERTISED_10baseT_Half |
717717 ADVERTISED_10baseT_Full |
@@ -758,6 +758,7 @@ static void alx_halt(struct alx_priv *alx) · 40 unmodified lines
758758
759759 alx_netif_stop(alx);
760760 hw->link_speed = SPEED_UNKNOWN;
761+ hw->duplex = DUPLEX_UNKNOWN;
761762
762763 alx_reset_mac(hw);
763764
@@ -869,18 +870,18 @@ static void __alx_stop(struct alx_priv *alx) · 105 unmodified lines
869870 alx_free_rings(alx);
870871 }
871872
872−static const char *alx_speed_desc(u16 speed)
873+static const char *alx_speed_desc(struct alx_hw *hw)
873874 {
874− switch (speed) {
875− case SPEED_1000 + DUPLEX_FULL:
875+ switch (alx_speed_to_ethadv(hw->link_speed, hw->duplex)) {
876+ case ADVERTISED_1000baseT_Full:
876877 return "1 Gbps Full";
877− case SPEED_100 + DUPLEX_FULL:
878+ case ADVERTISED_100baseT_Full:
878879 return "100 Mbps Full";
879− case SPEED_100 + DUPLEX_HALF:
880+ case ADVERTISED_100baseT_Half:
880881 return "100 Mbps Half";
881− case SPEED_10 + DUPLEX_FULL:
882+ case ADVERTISED_10baseT_Full:
882883 return "10 Mbps Full";
883− case SPEED_10 + DUPLEX_HALF:
884+ case ADVERTISED_10baseT_Half:
884885 return "10 Mbps Half";
885886 default:
886887 return "Unknown speed";
@@ -891,7 +892,8 @@ static void alx_check_link(struct alx_priv *alx) · 4 unmodified lines
891892 {
892893 struct alx_hw *hw = &alx->hw;
893894 unsigned long flags;
894− int speed, old_speed;
895+ int old_speed;
896+ u8 old_duplex;
895897 int err;
896898
897899 /* clear PHY internal interrupt status, otherwise the main
@@ -899,7 +901,9 @@ static void alx_check_link(struct alx_priv *alx) · 1 unmodified line
899901 */
900902 alx_clear_phy_intr(hw);
901903
902− err = alx_get_phy_link(hw, &speed);
904+ old_speed = hw->link_speed;
905+ old_duplex = hw->duplex;
906+ err = alx_read_phy_link(hw);
903907 if (err < 0)
904908 goto reset;
905909
@@ -908,15 +912,12 @@ static void alx_check_link(struct alx_priv *alx) · 2 unmodified lines
908912 alx_write_mem32(hw, ALX_IMR, alx->int_mask);
909913 spin_unlock_irqrestore(&alx->irq_lock, flags);
910914
911− old_speed = hw->link_speed;
912−
913− if (old_speed == speed)
915+ if (old_speed == hw->link_speed)
914916 return;
915− hw->link_speed = speed;
916917
917− if (speed != SPEED_UNKNOWN) {
918+ if (hw->link_speed != SPEED_UNKNOWN) {
918919 netif_info(alx, link, alx->dev,
919− "NIC Up: %s\n", alx_speed_desc(speed));
920+ "NIC Up: %s\n", alx_speed_desc(hw));
920921 alx_post_phy_link(hw);
921922 alx_enable_aspm(hw, true, true);
922923 alx_start_mac(hw);
@@ -959,65 +960,6 @@ static int alx_stop(struct net_device *netdev) · 36 unmodified lines
959960 return 0;
960961 }
961962
962−static int __alx_shutdown(struct pci_dev *pdev, bool *wol_en)
963−{
964− struct alx_priv *alx = pci_get_drvdata(pdev);
965− struct net_device *netdev = alx->dev;
966− struct alx_hw *hw = &alx->hw;
967− int err, speed;
968−
969− netif_device_detach(netdev);
970−
971− if (netif_running(netdev))
972− __alx_stop(alx);
973−
974−#ifdef CONFIG_PM_SLEEP
975− err = pci_save_state(pdev);
976− if (err)
977− return err;
978−#endif
979−
980− err = alx_select_powersaving_speed(hw, &speed);
981− if (err)
982− return err;
983− err = alx_clear_phy_intr(hw);
984− if (err)
985− return err;
986− err = alx_pre_suspend(hw, speed);
987− if (err)
988− return err;
989− err = alx_config_wol(hw);
990− if (err)
991− return err;
992−
993− *wol_en = false;
994− if (hw->sleep_ctrl & ALX_SLEEP_ACTIVE) {
995− netif_info(alx, wol, netdev,
996− "wol: ctrl=%X, speed=%X\n",
997− hw->sleep_ctrl, speed);
998− device_set_wakeup_enable(&pdev->dev, true);
999− *wol_en = true;
1000− }
1001−
1002− pci_disable_device(pdev);
1003−
1004− return 0;
1005−}
1006−
1007−static void alx_shutdown(struct pci_dev *pdev)
1008−{
1009− int err;
1010− bool wol_en;
1011−
1012− err = __alx_shutdown(pdev, &wol_en);
1013− if (!err) {
1014− pci_wake_from_d3(pdev, wol_en);
1015− pci_set_power_state(pdev, PCI_D3hot);
1016− } else {
1017− dev_err(&pdev->dev, "shutdown fail %d\n", err);
1018− }
1019−}
1020−
1021963 static void alx_link_check(struct work_struct *work)
1022964 {
1023965 struct alx_priv *alx;
@@ -1396,8 +1338,6 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 372 unmodified lines
13961338 goto out_unmap;
13971339 }
13981340
1399− device_set_wakeup_enable(&pdev->dev, hw->sleep_ctrl);
1400−
14011341 netdev_info(netdev,
14021342 "Qualcomm Atheros AR816x/AR817x Ethernet [%pM]\n",
14031343 netdev->dev_addr);
@@ -1442,22 +1382,12 @@ static void alx_remove(struct pci_dev *pdev) · 38 unmodified lines
14421382 static int alx_suspend(struct device *dev)
14431383 {
14441384 struct pci_dev *pdev = to_pci_dev(dev);
1445− int err;
1446− bool wol_en;
1447−
1448− err = __alx_shutdown(pdev, &wol_en);
1449− if (err) {
1450− dev_err(&pdev->dev, "shutdown fail in suspend %d\n", err);
1451− return err;
1452− }
1453−
1454− if (wol_en) {
1455− pci_prepare_to_sleep(pdev);
1456− } else {
1457− pci_wake_from_d3(pdev, false);
1458− pci_set_power_state(pdev, PCI_D3hot);
1459− }
1385+ struct alx_priv *alx = pci_get_drvdata(pdev);
14601386
1387+ if (!netif_running(alx->dev))
1388+ return 0;
1389+ netif_device_detach(alx->dev);
1390+ __alx_stop(alx);
14611391 return 0;
14621392 }
14631393
@@ -1465,49 +1395,20 @@ static int alx_resume(struct device *dev) · 1 unmodified line
14651395 {
14661396 struct pci_dev *pdev = to_pci_dev(dev);
14671397 struct alx_priv *alx = pci_get_drvdata(pdev);
1468− struct net_device *netdev = alx->dev;
1469− struct alx_hw *hw = &alx->hw;
1470− int err;
1471−
1472− pci_set_power_state(pdev, PCI_D0);
1473− pci_restore_state(pdev);
1474− pci_save_state(pdev);
1475−
1476− pci_enable_wake(pdev, PCI_D3hot, 0);
1477− pci_enable_wake(pdev, PCI_D3cold, 0);
14781398
1479− hw->link_speed = SPEED_UNKNOWN;
1480− alx->int_mask = ALX_ISR_MISC;
1481−
1482− alx_reset_pcie(hw);
1483− alx_reset_phy(hw);
1484−
1485− err = alx_reset_mac(hw);
1486− if (err) {
1487− netif_err(alx, hw, alx->dev,
1488− "resume:reset_mac fail %d\n", err);
1489− return -EIO;
1490− }
1491−
1492− err = alx_setup_speed_duplex(hw, hw->adv_cfg, hw->flowctrl);
1493− if (err) {
1494− netif_err(alx, hw, alx->dev,
1495− "resume:setup_speed_duplex fail %d\n", err);
1496− return -EIO;
1497− }
1498−
1499− if (netif_running(netdev)) {
1500− err = __alx_open(alx, true);
1501− if (err)
1502− return err;
1503− }
1504−
1505− netif_device_attach(netdev);
1506−
1507− return err;
1399+ if (!netif_running(alx->dev))
1400+ return 0;
1401+ netif_device_attach(alx->dev);
1402+ return __alx_open(alx, true);
15081403 }
1404+
1405+static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);
1406+#define ALX_PM_OPS (&alx_pm_ops)
1407+#else
1408+#define ALX_PM_OPS NULL
15091409 #endif
15101410
1411+
15111412 static pci_ers_result_t alx_pci_error_detected(struct pci_dev *pdev,
15121413 pci_channel_state_t state)
15131414 {
@@ -1550,8 +1451,6 @@ static pci_ers_result_t alx_pci_error_slot_reset(struct pci_dev *pdev) · 36 unmodified lines
15501451 }
15511452
15521453 pci_set_master(pdev);
1553− pci_enable_wake(pdev, PCI_D3hot, 0);
1554− pci_enable_wake(pdev, PCI_D3cold, 0);
15551454
15561455 alx_reset_pcie(hw);
15571456 if (!alx_reset_mac(hw))
@@ -1587,13 +1486,6 @@ static const struct pci_error_handlers alx_err_handlers = { · 29 unmodified lines
15871486 .resume = alx_pci_error_resume,
15881487 };
15891488
1590−#ifdef CONFIG_PM_SLEEP
1591−static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);
1592−#define ALX_PM_OPS (&alx_pm_ops)
1593−#else
1594−#define ALX_PM_OPS NULL
1595−#endif
1596−
15971489 static DEFINE_PCI_DEVICE_TABLE(alx_pci_tbl) = {
15981490 { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8161),
15991491 .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG },
@@ -1611,7 +1503,6 @@ static struct pci_driver alx_driver = { · 11 unmodified lines
16111503 .id_table = alx_pci_tbl,
16121504 .probe = alx_probe,
16131505 .remove = alx_remove,
1614− .shutdown = alx_shutdown,
16151506 .err_handler = &alx_err_handlers,
16161507 .driver.pm = ALX_PM_OPS,
16171508 };
drivers/net/ethernet/atheros/atl1c/atl1c_main.c+1−24
@@ -2755,27 +2755,4 @@ static struct pci_driver atl1c_driver = { · 2754 unmodified lines
27552755 .driver.pm = &atl1c_pm_ops,
27562756 };
27572757
2758−/**
2759− * atl1c_init_module - Driver Registration Routine
2760− *
2761− * atl1c_init_module is the first routine called when the driver is
2762− * loaded. All it does is register with the PCI subsystem.
2763− */
2764−static int __init atl1c_init_module(void)
2765−{
2766− return pci_register_driver(&atl1c_driver);
2767−}
2768−
2769−/**
2770− * atl1c_exit_module - Driver Exit Cleanup Routine
2771− *
2772− * atl1c_exit_module is called just before the driver is removed
2773− * from memory.
2774− */
2775−static void __exit atl1c_exit_module(void)
2776−{
2777− pci_unregister_driver(&atl1c_driver);
2778−}
2779−
2780−module_init(atl1c_init_module);
2781−module_exit(atl1c_exit_module);
2758+module_pci_driver(atl1c_driver);
drivers/net/ethernet/atheros/atl1e/atl1e_main.c+1−24
@@ -2489,27 +2489,4 @@ static struct pci_driver atl1e_driver = { · 2488 unmodified lines
24892489 .err_handler = &atl1e_err_handler
24902490 };
24912491
2492−/**
2493− * atl1e_init_module - Driver Registration Routine
2494− *
2495− * atl1e_init_module is the first routine called when the driver is
2496− * loaded. All it does is register with the PCI subsystem.
2497− */
2498−static int __init atl1e_init_module(void)
2499−{
2500− return pci_register_driver(&atl1e_driver);
2501−}
2502−
2503−/**
2504− * atl1e_exit_module - Driver Exit Cleanup Routine
2505− *
2506− * atl1e_exit_module is called just before the driver is removed
2507− * from memory.
2508− */
2509−static void __exit atl1e_exit_module(void)
2510−{
2511− pci_unregister_driver(&atl1e_driver);
2512−}
2513−
2514−module_init(atl1e_init_module);
2515−module_exit(atl1e_exit_module);
2492+module_pci_driver(atl1e_driver);
drivers/net/ethernet/atheros/atlx/atl1.c+2−25
@@ -3145,31 +3145,6 @@ static struct pci_driver atl1_driver = { · 3144 unmodified lines
31453145 .driver.pm = &atl1_pm_ops,
31463146 };
31473147
3148−/**
3149− * atl1_exit_module - Driver Exit Cleanup Routine
3150− *
3151− * atl1_exit_module is called just before the driver is removed
3152− * from memory.
3153− */
3154−static void __exit atl1_exit_module(void)
3155−{
3156− pci_unregister_driver(&atl1_driver);
3157−}
3158−
3159−/**
3160− * atl1_init_module - Driver Registration Routine
3161− *
3162− * atl1_init_module is the first routine called when the driver is
3163− * loaded. All it does is register with the PCI subsystem.
3164− */
3165−static int __init atl1_init_module(void)
3166−{
3167− return pci_register_driver(&atl1_driver);
3168−}
3169−
3170−module_init(atl1_init_module);
3171−module_exit(atl1_exit_module);
3172−
31733148 struct atl1_stats {
31743149 char stat_string[ETH_GSTRING_LEN];
31753150 int sizeof_stat;
@@ -3705,3 +3680,5 @@ static const struct ethtool_ops atl1_ethtool_ops = { · 529 unmodified lines
37053680 .get_ethtool_stats = atl1_get_ethtool_stats,
37063681 .get_sset_count = atl1_get_sset_count,
37073682 };
3683+
3684+module_pci_driver(atl1_driver);
drivers/net/ethernet/broadcom/Kconfig+0−2
@@ -22,7 +22,6 @@ config B44 · 21 unmodified lines
2222 tristate "Broadcom 440x/47xx ethernet support"
2323 depends on SSB_POSSIBLE && HAS_DMA
2424 select SSB
25− select NET_CORE
2625 select MII
2726 ---help---
2827 If you have a network (Ethernet) controller of this type, say Y
@@ -54,7 +53,6 @@ config B44_PCI · 25 unmodified lines
5453 config BCM63XX_ENET
5554 tristate "Broadcom 63xx internal mac support"
5655 depends on BCM63XX
57− select NET_CORE
5856 select MII
5957 select PHYLIB
6058 help
drivers/net/ethernet/broadcom/bcm63xx_enet.c+1092−96
@@ -41,8 +41,8 @@ static int copybreak __read_mostly = 128; · 40 unmodified lines
4141 module_param(copybreak, int, 0);
4242 MODULE_PARM_DESC(copybreak, "Receive copy threshold");
4343
44−/* io memory shared between all devices */
45−static void __iomem *bcm_enet_shared_base;
44+/* io registers memory shared between all devices */
45+static void __iomem *bcm_enet_shared_base[3];
4646
4747 /*
4848 * io helpers to access mac registers
@@ -59,17 +59,76 @@ static inline void enet_writel(struct bcm_enet_priv *priv, · 10 unmodified lines
5959 }
6060
6161 /*
62− * io helpers to access shared registers
62+ * io helpers to access switch registers
6363 */
64+static inline u32 enetsw_readl(struct bcm_enet_priv *priv, u32 off)
65+{
66+ return bcm_readl(priv->base + off);
67+}
68+
69+static inline void enetsw_writel(struct bcm_enet_priv *priv,
70+ u32 val, u32 off)
71+{
72+ bcm_writel(val, priv->base + off);
73+}
74+
75+static inline u16 enetsw_readw(struct bcm_enet_priv *priv, u32 off)
76+{
77+ return bcm_readw(priv->base + off);
78+}
79+
80+static inline void enetsw_writew(struct bcm_enet_priv *priv,
81+ u16 val, u32 off)
82+{
83+ bcm_writew(val, priv->base + off);
84+}
85+
86+static inline u8 enetsw_readb(struct bcm_enet_priv *priv, u32 off)
87+{
88+ return bcm_readb(priv->base + off);
89+}
90+
91+static inline void enetsw_writeb(struct bcm_enet_priv *priv,
92+ u8 val, u32 off)
93+{
94+ bcm_writeb(val, priv->base + off);
95+}
96+
97+
98+/* io helpers to access shared registers */
6499 static inline u32 enet_dma_readl(struct bcm_enet_priv *priv, u32 off)
65100 {
66− return bcm_readl(bcm_enet_shared_base + off);
101+ return bcm_readl(bcm_enet_shared_base[0] + off);
67102 }
68103
69104 static inline void enet_dma_writel(struct bcm_enet_priv *priv,
70105 u32 val, u32 off)
71106 {
72− bcm_writel(val, bcm_enet_shared_base + off);
107+ bcm_writel(val, bcm_enet_shared_base[0] + off);
108+}
109+
110+static inline u32 enet_dmac_readl(struct bcm_enet_priv *priv, u32 off, int chan)
111+{
112+ return bcm_readl(bcm_enet_shared_base[1] +
113+ bcm63xx_enetdmacreg(off) + chan * priv->dma_chan_width);
114+}
115+
116+static inline void enet_dmac_writel(struct bcm_enet_priv *priv,
117+ u32 val, u32 off, int chan)
118+{
119+ bcm_writel(val, bcm_enet_shared_base[1] +
120+ bcm63xx_enetdmacreg(off) + chan * priv->dma_chan_width);
121+}
122+
123+static inline u32 enet_dmas_readl(struct bcm_enet_priv *priv, u32 off, int chan)
124+{
125+ return bcm_readl(bcm_enet_shared_base[2] + off + chan * priv->dma_chan_width);
126+}
127+
128+static inline void enet_dmas_writel(struct bcm_enet_priv *priv,
129+ u32 val, u32 off, int chan)
130+{
131+ bcm_writel(val, bcm_enet_shared_base[2] + off + chan * priv->dma_chan_width);
73132 }
74133
75134 /*
@@ -196,7 +255,6 @@ static int bcm_enet_refill_rx(struct net_device *dev) · 120 unmodified lines
196255 if (!skb)
197256 break;
198257 priv->rx_skb[desc_idx] = skb;
199−
200258 p = dma_map_single(&priv->pdev->dev, skb->data,
201259 priv->rx_skb_size,
202260 DMA_FROM_DEVICE);
@@ -206,7 +264,7 @@ static int bcm_enet_refill_rx(struct net_device *dev) · 3 unmodified lines
206264 len_stat = priv->rx_skb_size << DMADESC_LENGTH_SHIFT;
207265 len_stat |= DMADESC_OWNER_MASK;
208266 if (priv->rx_dirty_desc == priv->rx_ring_size - 1) {
209− len_stat |= DMADESC_WRAP_MASK;
267+ len_stat |= (DMADESC_WRAP_MASK >> priv->dma_desc_shift);
210268 priv->rx_dirty_desc = 0;
211269 } else {
212270 priv->rx_dirty_desc++;
@@ -217,7 +275,10 @@ static int bcm_enet_refill_rx(struct net_device *dev) · 4 unmodified lines
217275 priv->rx_desc_count++;
218276
219277 /* tell dma engine we allocated one buffer */
220− enet_dma_writel(priv, 1, ENETDMA_BUFALLOC_REG(priv->rx_chan));
278+ if (priv->dma_has_sram)
279+ enet_dma_writel(priv, 1, ENETDMA_BUFALLOC_REG(priv->rx_chan));
280+ else
281+ enet_dmac_writel(priv, 1, ENETDMAC_BUFALLOC, priv->rx_chan);
221282 }
222283
223284 /* If rx ring is still empty, set a timer to try allocating
@@ -293,13 +354,15 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget) · 69 unmodified lines
293354
294355 /* if the packet does not have start of packet _and_
295356 * end of packet flag set, then just recycle it */
296− if ((len_stat & DMADESC_ESOP_MASK) != DMADESC_ESOP_MASK) {
357+ if ((len_stat & (DMADESC_ESOP_MASK >> priv->dma_desc_shift)) !=
358+ (DMADESC_ESOP_MASK >> priv->dma_desc_shift)) {
297359 dev->stats.rx_dropped++;
298360 continue;
299361 }
300362
301363 /* recycle packet if it's marked as bad */
302− if (unlikely(len_stat & DMADESC_ERR_MASK)) {
364+ if (!priv->enet_is_sw &&
365+ unlikely(len_stat & DMADESC_ERR_MASK)) {
303366 dev->stats.rx_errors++;
304367
305368 if (len_stat & DMADESC_OVSIZE_MASK)
@@ -353,8 +416,8 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget) · 47 unmodified lines
353416 bcm_enet_refill_rx(dev);
354417
355418 /* kick rx dma */
356− enet_dma_writel(priv, ENETDMA_CHANCFG_EN_MASK,
357− ENETDMA_CHANCFG_REG(priv->rx_chan));
419+ enet_dmac_writel(priv, priv->dma_chan_en_mask,
420+ ENETDMAC_CHANCFG, priv->rx_chan);
358421 }
359422
360423 return processed;
@@ -429,10 +492,10 @@ static int bcm_enet_poll(struct napi_struct *napi, int budget) · 68 unmodified lines
429492 dev = priv->net_dev;
430493
431494 /* ack interrupts */
432− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
433− ENETDMA_IR_REG(priv->rx_chan));
434− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
435− ENETDMA_IR_REG(priv->tx_chan));
495+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
496+ ENETDMAC_IR, priv->rx_chan);
497+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
498+ ENETDMAC_IR, priv->tx_chan);
436499
437500 /* reclaim sent skb */
438501 tx_work_done = bcm_enet_tx_reclaim(dev, 0);
@@ -451,10 +514,10 @@ static int bcm_enet_poll(struct napi_struct *napi, int budget) · 12 unmodified lines
451514 napi_complete(napi);
452515
453516 /* restore rx/tx interrupt */
454− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
455− ENETDMA_IRMASK_REG(priv->rx_chan));
456− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
457− ENETDMA_IRMASK_REG(priv->tx_chan));
517+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
518+ ENETDMAC_IRMASK, priv->rx_chan);
519+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
520+ ENETDMAC_IRMASK, priv->tx_chan);
458521
459522 return rx_work_done;
460523 }
@@ -497,8 +560,8 @@ static irqreturn_t bcm_enet_isr_dma(int irq, void *dev_id) · 36 unmodified lines
497560 priv = netdev_priv(dev);
498561
499562 /* mask rx/tx interrupts */
500− enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->rx_chan));
501− enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->tx_chan));
563+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->rx_chan);
564+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->tx_chan);
502565
503566 napi_schedule(&priv->napi);
504567
@@ -530,6 +593,26 @@ static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) · 25 unmodified lines
530593 goto out_unlock;
531594 }
532595
596+ /* pad small packets sent on a switch device */
597+ if (priv->enet_is_sw && skb->len < 64) {
598+ int needed = 64 - skb->len;
599+ char *data;
600+
601+ if (unlikely(skb_tailroom(skb) < needed)) {
602+ struct sk_buff *nskb;
603+
604+ nskb = skb_copy_expand(skb, 0, needed, GFP_ATOMIC);
605+ if (!nskb) {
606+ ret = NETDEV_TX_BUSY;
607+ goto out_unlock;
608+ }
609+ dev_kfree_skb(skb);
610+ skb = nskb;
611+ }
612+ data = skb_put(skb, needed);
613+ memset(data, 0, needed);
614+ }
615+
533616 /* point to the next available desc */
534617 desc = &priv->tx_desc_cpu[priv->tx_curr_desc];
535618 priv->tx_skb[priv->tx_curr_desc] = skb;
@@ -539,14 +622,14 @@ static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3 unmodified lines
539622 DMA_TO_DEVICE);
540623
541624 len_stat = (skb->len << DMADESC_LENGTH_SHIFT) & DMADESC_LENGTH_MASK;
542− len_stat |= DMADESC_ESOP_MASK |
625+ len_stat |= (DMADESC_ESOP_MASK >> priv->dma_desc_shift) |
543626 DMADESC_APPEND_CRC |
544627 DMADESC_OWNER_MASK;
545628
546629 priv->tx_curr_desc++;
547630 if (priv->tx_curr_desc == priv->tx_ring_size) {
548631 priv->tx_curr_desc = 0;
549− len_stat |= DMADESC_WRAP_MASK;
632+ len_stat |= (DMADESC_WRAP_MASK >> priv->dma_desc_shift);
550633 }
551634 priv->tx_desc_count--;
552635
@@ -557,8 +640,8 @@ static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) · 4 unmodified lines
557640 wmb();
558641
559642 /* kick tx dma */
560− enet_dma_writel(priv, ENETDMA_CHANCFG_EN_MASK,
561− ENETDMA_CHANCFG_REG(priv->tx_chan));
643+ enet_dmac_writel(priv, priv->dma_chan_en_mask,
644+ ENETDMAC_CHANCFG, priv->tx_chan);
562645
563646 /* stop queue if no more desc available */
564647 if (!priv->tx_desc_count)
@@ -686,6 +769,9 @@ static void bcm_enet_set_flow(struct bcm_enet_priv *priv, int rx_en, int tx_en) · 121 unmodified lines
686769 val &= ~ENET_RXCFG_ENFLOW_MASK;
687770 enet_writel(priv, val, ENET_RXCFG_REG);
688771
772+ if (!priv->dma_has_sram)
773+ return;
774+
689775 /* tx flow control (pause frame generation) */
690776 val = enet_dma_readl(priv, ENETDMA_CFG_REG);
691777 if (tx_en)
@@ -833,8 +919,8 @@ static int bcm_enet_open(struct net_device *dev) · 141 unmodified lines
833919
834920 /* mask all interrupts and request them */
835921 enet_writel(priv, 0, ENET_IRMASK_REG);
836− enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->rx_chan));
837− enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->tx_chan));
922+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->rx_chan);
923+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->tx_chan);
838924
839925 ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev);
840926 if (ret)
@@ -909,8 +995,12 @@ static int bcm_enet_open(struct net_device *dev) · 68 unmodified lines
909995 priv->rx_curr_desc = 0;
910996
911997 /* initialize flow control buffer allocation */
912− enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
913− ENETDMA_BUFALLOC_REG(priv->rx_chan));
998+ if (priv->dma_has_sram)
999+ enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
1000+ ENETDMA_BUFALLOC_REG(priv->rx_chan));
1001+ else
1002+ enet_dmac_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
1003+ ENETDMAC_BUFALLOC, priv->rx_chan);
9141004
9151005 if (bcm_enet_refill_rx(dev)) {
9161006 dev_err(kdev, "cannot allocate rx skb queue\n");
@@ -919,37 +1009,55 @@ static int bcm_enet_open(struct net_device *dev) · 2 unmodified lines
9191009 }
9201010
9211011 /* write rx & tx ring addresses */
922− enet_dma_writel(priv, priv->rx_desc_dma,
923− ENETDMA_RSTART_REG(priv->rx_chan));
924− enet_dma_writel(priv, priv->tx_desc_dma,
925− ENETDMA_RSTART_REG(priv->tx_chan));
1012+ if (priv->dma_has_sram) {
1013+ enet_dmas_writel(priv, priv->rx_desc_dma,
1014+ ENETDMAS_RSTART_REG, priv->rx_chan);
1015+ enet_dmas_writel(priv, priv->tx_desc_dma,
1016+ ENETDMAS_RSTART_REG, priv->tx_chan);
1017+ } else {
1018+ enet_dmac_writel(priv, priv->rx_desc_dma,
1019+ ENETDMAC_RSTART, priv->rx_chan);
1020+ enet_dmac_writel(priv, priv->tx_desc_dma,
1021+ ENETDMAC_RSTART, priv->tx_chan);
1022+ }
9261023
9271024 /* clear remaining state ram for rx & tx channel */
928− enet_dma_writel(priv, 0, ENETDMA_SRAM2_REG(priv->rx_chan));
929− enet_dma_writel(priv, 0, ENETDMA_SRAM2_REG(priv->tx_chan));
930− enet_dma_writel(priv, 0, ENETDMA_SRAM3_REG(priv->rx_chan));
931− enet_dma_writel(priv, 0, ENETDMA_SRAM3_REG(priv->tx_chan));
932− enet_dma_writel(priv, 0, ENETDMA_SRAM4_REG(priv->rx_chan));
933− enet_dma_writel(priv, 0, ENETDMA_SRAM4_REG(priv->tx_chan));
1025+ if (priv->dma_has_sram) {
1026+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM2_REG, priv->rx_chan);
1027+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM2_REG, priv->tx_chan);
1028+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM3_REG, priv->rx_chan);
1029+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM3_REG, priv->tx_chan);
1030+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG, priv->rx_chan);
1031+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG, priv->tx_chan);
1032+ } else {
1033+ enet_dmac_writel(priv, 0, ENETDMAC_FC, priv->rx_chan);
1034+ enet_dmac_writel(priv, 0, ENETDMAC_FC, priv->tx_chan);
1035+ }
9341036
9351037 /* set max rx/tx length */
9361038 enet_writel(priv, priv->hw_mtu, ENET_RXMAXLEN_REG);
9371039 enet_writel(priv, priv->hw_mtu, ENET_TXMAXLEN_REG);
9381040
9391041 /* set dma maximum burst len */
940− enet_dma_writel(priv, BCMENET_DMA_MAXBURST,
941− ENETDMA_MAXBURST_REG(priv->rx_chan));
942− enet_dma_writel(priv, BCMENET_DMA_MAXBURST,
943− ENETDMA_MAXBURST_REG(priv->tx_chan));
1042+ enet_dmac_writel(priv, priv->dma_maxburst,
1043+ ENETDMAC_MAXBURST, priv->rx_chan);
1044+ enet_dmac_writel(priv, priv->dma_maxburst,
1045+ ENETDMAC_MAXBURST, priv->tx_chan);
9441046
9451047 /* set correct transmit fifo watermark */
9461048 enet_writel(priv, BCMENET_TX_FIFO_TRESH, ENET_TXWMARK_REG);
9471049
9481050 /* set flow control low/high threshold to 1/3 / 2/3 */
949− val = priv->rx_ring_size / 3;
950− enet_dma_writel(priv, val, ENETDMA_FLOWCL_REG(priv->rx_chan));
951− val = (priv->rx_ring_size * 2) / 3;
952− enet_dma_writel(priv, val, ENETDMA_FLOWCH_REG(priv->rx_chan));
1051+ if (priv->dma_has_sram) {
1052+ val = priv->rx_ring_size / 3;
1053+ enet_dma_writel(priv, val, ENETDMA_FLOWCL_REG(priv->rx_chan));
1054+ val = (priv->rx_ring_size * 2) / 3;
1055+ enet_dma_writel(priv, val, ENETDMA_FLOWCH_REG(priv->rx_chan));
1056+ } else {
1057+ enet_dmac_writel(priv, 5, ENETDMAC_FC, priv->rx_chan);
1058+ enet_dmac_writel(priv, priv->rx_ring_size, ENETDMAC_LEN, priv->rx_chan);
1059+ enet_dmac_writel(priv, priv->tx_ring_size, ENETDMAC_LEN, priv->tx_chan);
1060+ }
9531061
9541062 /* all set, enable mac and interrupts, start dma engine and
9551063 * kick rx dma channel */
@@ -958,26 +1066,26 @@ static int bcm_enet_open(struct net_device *dev) · 2 unmodified lines
9581066 val |= ENET_CTL_ENABLE_MASK;
9591067 enet_writel(priv, val, ENET_CTL_REG);
9601068 enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
961− enet_dma_writel(priv, ENETDMA_CHANCFG_EN_MASK,
962− ENETDMA_CHANCFG_REG(priv->rx_chan));
1069+ enet_dmac_writel(priv, priv->dma_chan_en_mask,
1070+ ENETDMAC_CHANCFG, priv->rx_chan);
9631071
9641072 /* watch "mib counters about to overflow" interrupt */
9651073 enet_writel(priv, ENET_IR_MIB, ENET_IR_REG);
9661074 enet_writel(priv, ENET_IR_MIB, ENET_IRMASK_REG);
9671075
9681076 /* watch "packet transferred" interrupt in rx and tx */
969− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
970− ENETDMA_IR_REG(priv->rx_chan));
971− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
972− ENETDMA_IR_REG(priv->tx_chan));
1077+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
1078+ ENETDMAC_IR, priv->rx_chan);
1079+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
1080+ ENETDMAC_IR, priv->tx_chan);
9731081
9741082 /* make sure we enable napi before rx interrupt */
9751083 napi_enable(&priv->napi);
9761084
977− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
978− ENETDMA_IRMASK_REG(priv->rx_chan));
979− enet_dma_writel(priv, ENETDMA_IR_PKTDONE_MASK,
980− ENETDMA_IRMASK_REG(priv->tx_chan));
1085+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
1086+ ENETDMAC_IRMASK, priv->rx_chan);
1087+ enet_dmac_writel(priv, priv->dma_chan_int_mask,
1088+ ENETDMAC_IRMASK, priv->tx_chan);
9811089
9821090 if (priv->has_phy)
9831091 phy_start(priv->phydev);
@@ -1057,14 +1165,14 @@ static void bcm_enet_disable_dma(struct bcm_enet_priv *priv, int chan) · 73 unmodified lines
10571165 {
10581166 int limit;
10591167
1060− enet_dma_writel(priv, 0, ENETDMA_CHANCFG_REG(chan));
1168+ enet_dmac_writel(priv, 0, ENETDMAC_CHANCFG, chan);
10611169
10621170 limit = 1000;
10631171 do {
10641172 u32 val;
10651173
1066− val = enet_dma_readl(priv, ENETDMA_CHANCFG_REG(chan));
1067− if (!(val & ENETDMA_CHANCFG_EN_MASK))
1174+ val = enet_dmac_readl(priv, ENETDMAC_CHANCFG, chan);
1175+ if (!(val & ENETDMAC_CHANCFG_EN_MASK))
10681176 break;
10691177 udelay(1);
10701178 } while (limit--);
@@ -1090,8 +1198,8 @@ static int bcm_enet_stop(struct net_device *dev) · 19 unmodified lines
10901198
10911199 /* mask all interrupts */
10921200 enet_writel(priv, 0, ENET_IRMASK_REG);
1093− enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->rx_chan));
1094− enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->tx_chan));
1201+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->rx_chan);
1202+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->tx_chan);
10951203
10961204 /* make sure no mib update is scheduled */
10971205 cancel_work_sync(&priv->mib_update_task);
@@ -1328,6 +1436,20 @@ static void bcm_enet_get_ethtool_stats(struct net_device *netdev, · 230 unmodified lines
13281436 mutex_unlock(&priv->mib_update_lock);
13291437 }
13301438
1439+static int bcm_enet_nway_reset(struct net_device *dev)
1440+{
1441+ struct bcm_enet_priv *priv;
1442+
1443+ priv = netdev_priv(dev);
1444+ if (priv->has_phy) {
1445+ if (!priv->phydev)
1446+ return -ENODEV;
1447+ return genphy_restart_aneg(priv->phydev);
1448+ }
1449+
1450+ return -EOPNOTSUPP;
1451+}
1452+
13311453 static int bcm_enet_get_settings(struct net_device *dev,
13321454 struct ethtool_cmd *cmd)
13331455 {
@@ -1470,6 +1592,7 @@ static const struct ethtool_ops bcm_enet_ethtool_ops = { · 136 unmodified lines
14701592 .get_strings = bcm_enet_get_strings,
14711593 .get_sset_count = bcm_enet_get_sset_count,
14721594 .get_ethtool_stats = bcm_enet_get_ethtool_stats,
1595+ .nway_reset = bcm_enet_nway_reset,
14731596 .get_settings = bcm_enet_get_settings,
14741597 .set_settings = bcm_enet_set_settings,
14751598 .get_drvinfo = bcm_enet_get_drvinfo,
@@ -1530,7 +1653,7 @@ static int compute_hw_mtu(struct bcm_enet_priv *priv, int mtu) · 54 unmodified lines
15301653 * it's appended
15311654 */
15321655 priv->rx_skb_size = ALIGN(actual_mtu + ETH_FCS_LEN,
1533− BCMENET_DMA_MAXBURST * 4);
1656+ priv->dma_maxburst * 4);
15341657 return 0;
15351658 }
15361659
@@ -1621,7 +1744,7 @@ static int bcm_enet_probe(struct platform_device *pdev) · 84 unmodified lines
16211744
16221745 /* stop if shared driver failed, assume driver->probe will be
16231746 * called in the same order we register devices (correct ?) */
1624− if (!bcm_enet_shared_base)
1747+ if (!bcm_enet_shared_base[0])
16251748 return -ENODEV;
16261749
16271750 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1637,6 +1760,9 @@ static int bcm_enet_probe(struct platform_device *pdev) · 9 unmodified lines
16371760 return -ENOMEM;
16381761 priv = netdev_priv(dev);
16391762
1763+ priv->enet_is_sw = false;
1764+ priv->dma_maxburst = BCMENET_DMA_MAXBURST;
1765+
16401766 ret = compute_hw_mtu(priv, dev->mtu);
16411767 if (ret)
16421768 goto out;
@@ -1687,6 +1813,11 @@ static int bcm_enet_probe(struct platform_device *pdev) · 44 unmodified lines
16871813 priv->pause_tx = pd->pause_tx;
16881814 priv->force_duplex_full = pd->force_duplex_full;
16891815 priv->force_speed_100 = pd->force_speed_100;
1816+ priv->dma_chan_en_mask = pd->dma_chan_en_mask;
1817+ priv->dma_chan_int_mask = pd->dma_chan_int_mask;
1818+ priv->dma_chan_width = pd->dma_chan_width;
1819+ priv->dma_has_sram = pd->dma_has_sram;
1820+ priv->dma_desc_shift = pd->dma_desc_shift;
16901821 }
16911822
16921823 if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {
@@ -1847,7 +1978,6 @@ static int bcm_enet_remove(struct platform_device *pdev) · 154 unmodified lines
18471978 clk_disable_unprepare(priv->mac_clk);
18481979 clk_put(priv->mac_clk);
18491980
1850− platform_set_drvdata(pdev, NULL);
18511981 free_netdev(dev);
18521982 return 0;
18531983 }
@@ -1862,55 +1992,920 @@ struct platform_driver bcm63xx_enet_driver = { · 8 unmodified lines
18621992 };
18631993
18641994 /*
1865− * reserve & remap memory space shared between all macs
1995+ * switch mii access callbacks
18661996 */
1867−static int bcm_enet_shared_probe(struct platform_device *pdev)
1997+static int bcmenet_sw_mdio_read(struct bcm_enet_priv *priv,
1998+ int ext, int phy_id, int location)
18681999 {
1869− struct resource *res;
2000+ u32 reg;
2001+ int ret;
18702002
1871− res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1872− if (!res)
1873− return -ENODEV;
2003+ spin_lock_bh(&priv->enetsw_mdio_lock);
2004+ enetsw_writel(priv, 0, ENETSW_MDIOC_REG);
18742005
1875− bcm_enet_shared_base = devm_request_and_ioremap(&pdev->dev, res);
1876− if (!bcm_enet_shared_base)
1877− return -ENOMEM;
2006+ reg = ENETSW_MDIOC_RD_MASK |
2007+ (phy_id << ENETSW_MDIOC_PHYID_SHIFT) |
2008+ (location << ENETSW_MDIOC_REG_SHIFT);
18782009
1879− return 0;
2010+ if (ext)
2011+ reg |= ENETSW_MDIOC_EXT_MASK;
2012+
2013+ enetsw_writel(priv, reg, ENETSW_MDIOC_REG);
2014+ udelay(50);
2015+ ret = enetsw_readw(priv, ENETSW_MDIOD_REG);
2016+ spin_unlock_bh(&priv->enetsw_mdio_lock);
2017+ return ret;
18802018 }
18812019
1882−static int bcm_enet_shared_remove(struct platform_device *pdev)
2020+static void bcmenet_sw_mdio_write(struct bcm_enet_priv *priv,
2021+ int ext, int phy_id, int location,
2022+ uint16_t data)
18832023 {
1884− return 0;
2024+ u32 reg;
2025+
2026+ spin_lock_bh(&priv->enetsw_mdio_lock);
2027+ enetsw_writel(priv, 0, ENETSW_MDIOC_REG);
2028+
2029+ reg = ENETSW_MDIOC_WR_MASK |
2030+ (phy_id << ENETSW_MDIOC_PHYID_SHIFT) |
2031+ (location << ENETSW_MDIOC_REG_SHIFT);
2032+
2033+ if (ext)
2034+ reg |= ENETSW_MDIOC_EXT_MASK;
2035+
2036+ reg |= data;
2037+
2038+ enetsw_writel(priv, reg, ENETSW_MDIOC_REG);
2039+ udelay(50);
2040+ spin_unlock_bh(&priv->enetsw_mdio_lock);
2041+}
2042+
2043+static inline int bcm_enet_port_is_rgmii(int portid)
2044+{
2045+ return portid >= ENETSW_RGMII_PORT0;
18852046 }
18862047
18872048 /*
1888− * this "shared" driver is needed because both macs share a single
1889− * address space
2049+ * enet sw PHY polling
18902050 */
1891−struct platform_driver bcm63xx_enet_shared_driver = {
1892− .probe = bcm_enet_shared_probe,
1893− .remove = bcm_enet_shared_remove,
1894− .driver = {
1895− .name = "bcm63xx_enet_shared",
1896− .owner = THIS_MODULE,
1897− },
1898−};
2051+static void swphy_poll_timer(unsigned long data)
2052+{
2053+ struct bcm_enet_priv *priv = (struct bcm_enet_priv *)data;
2054+ unsigned int i;
2055+
2056+ for (i = 0; i < priv->num_ports; i++) {
2057+ struct bcm63xx_enetsw_port *port;
2058+ int val, j, up, advertise, lpa, lpa2, speed, duplex, media;
2059+ int external_phy = bcm_enet_port_is_rgmii(i);
2060+ u8 override;
2061+
2062+ port = &priv->used_ports[i];
2063+ if (!port->used)
2064+ continue;
2065+
2066+ if (port->bypass_link)
2067+ continue;
2068+
2069+ /* dummy read to clear */
2070+ for (j = 0; j < 2; j++)
2071+ val = bcmenet_sw_mdio_read(priv, external_phy,
2072+ port->phy_id, MII_BMSR);
2073+
2074+ if (val == 0xffff)
2075+ continue;
2076+
2077+ up = (val & BMSR_LSTATUS) ? 1 : 0;
2078+ if (!(up ^ priv->sw_port_link[i]))
2079+ continue;
2080+
2081+ priv->sw_port_link[i] = up;
2082+
2083+ /* link changed */
2084+ if (!up) {
2085+ dev_info(&priv->pdev->dev, "link DOWN on %s\n",
2086+ port->name);
2087+ enetsw_writeb(priv, ENETSW_PORTOV_ENABLE_MASK,
2088+ ENETSW_PORTOV_REG(i));
2089+ enetsw_writeb(priv, ENETSW_PTCTRL_RXDIS_MASK |
2090+ ENETSW_PTCTRL_TXDIS_MASK,
2091+ ENETSW_PTCTRL_REG(i));
2092+ continue;
2093+ }
2094+
2095+ advertise = bcmenet_sw_mdio_read(priv, external_phy,
2096+ port->phy_id, MII_ADVERTISE);
2097+
2098+ lpa = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
2099+ MII_LPA);
2100+
2101+ lpa2 = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
2102+ MII_STAT1000);
2103+
2104+ /* figure out media and duplex from advertise and LPA values */
2105+ media = mii_nway_result(lpa & advertise);
2106+ duplex = (media & ADVERTISE_FULL) ? 1 : 0;
2107+ if (lpa2 & LPA_1000FULL)
2108+ duplex = 1;
2109+
2110+ if (lpa2 & (LPA_1000FULL | LPA_1000HALF))
2111+ speed = 1000;
2112+ else {
2113+ if (media & (ADVERTISE_100FULL | ADVERTISE_100HALF))
2114+ speed = 100;
2115+ else
2116+ speed = 10;
2117+ }
2118+
2119+ dev_info(&priv->pdev->dev,
2120+ "link UP on %s, %dMbps, %s-duplex\n",
2121+ port->name, speed, duplex ? "full" : "half");
2122+
2123+ override = ENETSW_PORTOV_ENABLE_MASK |
2124+ ENETSW_PORTOV_LINKUP_MASK;
2125+
2126+ if (speed == 1000)
2127+ override |= ENETSW_IMPOV_1000_MASK;
2128+ else if (speed == 100)
2129+ override |= ENETSW_IMPOV_100_MASK;
2130+ if (duplex)
2131+ override |= ENETSW_IMPOV_FDX_MASK;
2132+
2133+ enetsw_writeb(priv, override, ENETSW_PORTOV_REG(i));
2134+ enetsw_writeb(priv, 0, ENETSW_PTCTRL_REG(i));
2135+ }
2136+
2137+ priv->swphy_poll.expires = jiffies + HZ;
2138+ add_timer(&priv->swphy_poll);
2139+}
18992140
19002141 /*
1901− * entry point
2142+ * open callback, allocate dma rings & buffers and start rx operation
19022143 */
1903−static int __init bcm_enet_init(void)
2144+static int bcm_enetsw_open(struct net_device *dev)
19042145 {
1905− int ret;
2146+ struct bcm_enet_priv *priv;
2147+ struct device *kdev;
2148+ int i, ret;
2149+ unsigned int size;
2150+ void *p;
2151+ u32 val;
19062152
1907− ret = platform_driver_register(&bcm63xx_enet_shared_driver);
1908− if (ret)
1909− return ret;
2153+ priv = netdev_priv(dev);
2154+ kdev = &priv->pdev->dev;
19102155
1911− ret = platform_driver_register(&bcm63xx_enet_driver);
2156+ /* mask all interrupts and request them */
2157+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->rx_chan);
2158+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->tx_chan);
2159+
2160+ ret = request_irq(priv->irq_rx, bcm_enet_isr_dma,
2161+ IRQF_DISABLED, dev->name, dev);
19122162 if (ret)
1913− platform_driver_unregister(&bcm63xx_enet_shared_driver);
2163+ goto out_freeirq;
2164+
2165+ if (priv->irq_tx != -1) {
2166+ ret = request_irq(priv->irq_tx, bcm_enet_isr_dma,
2167+ IRQF_DISABLED, dev->name, dev);
2168+ if (ret)
2169+ goto out_freeirq_rx;
2170+ }
2171+
2172+ /* allocate rx dma ring */
2173+ size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
2174+ p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
2175+ if (!p) {
2176+ dev_err(kdev, "cannot allocate rx ring %u\n", size);
2177+ ret = -ENOMEM;
2178+ goto out_freeirq_tx;
2179+ }
2180+
2181+ memset(p, 0, size);
2182+ priv->rx_desc_alloc_size = size;
2183+ priv->rx_desc_cpu = p;
2184+
2185+ /* allocate tx dma ring */
2186+ size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
2187+ p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
2188+ if (!p) {
2189+ dev_err(kdev, "cannot allocate tx ring\n");
2190+ ret = -ENOMEM;
2191+ goto out_free_rx_ring;
2192+ }
2193+
2194+ memset(p, 0, size);
2195+ priv->tx_desc_alloc_size = size;
2196+ priv->tx_desc_cpu = p;
2197+
2198+ priv->tx_skb = kzalloc(sizeof(struct sk_buff *) * priv->tx_ring_size,
2199+ GFP_KERNEL);
2200+ if (!priv->tx_skb) {
2201+ dev_err(kdev, "cannot allocate rx skb queue\n");
2202+ ret = -ENOMEM;
2203+ goto out_free_tx_ring;
2204+ }
2205+
2206+ priv->tx_desc_count = priv->tx_ring_size;
2207+ priv->tx_dirty_desc = 0;
2208+ priv->tx_curr_desc = 0;
2209+ spin_lock_init(&priv->tx_lock);
2210+
2211+ /* init & fill rx ring with skbs */
2212+ priv->rx_skb = kzalloc(sizeof(struct sk_buff *) * priv->rx_ring_size,
2213+ GFP_KERNEL);
2214+ if (!priv->rx_skb) {
2215+ dev_err(kdev, "cannot allocate rx skb queue\n");
2216+ ret = -ENOMEM;
2217+ goto out_free_tx_skb;
2218+ }
2219+
2220+ priv->rx_desc_count = 0;
2221+ priv->rx_dirty_desc = 0;
2222+ priv->rx_curr_desc = 0;
2223+
2224+ /* disable all ports */
2225+ for (i = 0; i < priv->num_ports; i++) {
2226+ enetsw_writeb(priv, ENETSW_PORTOV_ENABLE_MASK,
2227+ ENETSW_PORTOV_REG(i));
2228+ enetsw_writeb(priv, ENETSW_PTCTRL_RXDIS_MASK |
2229+ ENETSW_PTCTRL_TXDIS_MASK,
2230+ ENETSW_PTCTRL_REG(i));
2231+
2232+ priv->sw_port_link[i] = 0;
2233+ }
2234+
2235+ /* reset mib */
2236+ val = enetsw_readb(priv, ENETSW_GMCR_REG);
2237+ val |= ENETSW_GMCR_RST_MIB_MASK;
2238+ enetsw_writeb(priv, val, ENETSW_GMCR_REG);
2239+ mdelay(1);
2240+ val &= ~ENETSW_GMCR_RST_MIB_MASK;
2241+ enetsw_writeb(priv, val, ENETSW_GMCR_REG);
2242+ mdelay(1);
2243+
2244+ /* force CPU port state */
2245+ val = enetsw_readb(priv, ENETSW_IMPOV_REG);
2246+ val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK;
2247+ enetsw_writeb(priv, val, ENETSW_IMPOV_REG);
2248+
2249+ /* enable switch forward engine */
2250+ val = enetsw_readb(priv, ENETSW_SWMODE_REG);
2251+ val |= ENETSW_SWMODE_FWD_EN_MASK;
2252+ enetsw_writeb(priv, val, ENETSW_SWMODE_REG);
2253+
2254+ /* enable jumbo on all ports */
2255+ enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG);
2256+ enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG);
2257+
2258+ /* initialize flow control buffer allocation */
2259+ enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
2260+ ENETDMA_BUFALLOC_REG(priv->rx_chan));
2261+
2262+ if (bcm_enet_refill_rx(dev)) {
2263+ dev_err(kdev, "cannot allocate rx skb queue\n");
2264+ ret = -ENOMEM;
2265+ goto out;
2266+ }
2267+
2268+ /* write rx & tx ring addresses */
2269+ enet_dmas_writel(priv, priv->rx_desc_dma,
2270+ ENETDMAS_RSTART_REG, priv->rx_chan);
2271+ enet_dmas_writel(priv, priv->tx_desc_dma,
2272+ ENETDMAS_RSTART_REG, priv->tx_chan);
2273+
2274+ /* clear remaining state ram for rx & tx channel */
2275+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM2_REG, priv->rx_chan);
2276+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM2_REG, priv->tx_chan);
2277+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM3_REG, priv->rx_chan);
2278+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM3_REG, priv->tx_chan);
2279+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG, priv->rx_chan);
2280+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG, priv->tx_chan);
2281+
2282+ /* set dma maximum burst len */
2283+ enet_dmac_writel(priv, priv->dma_maxburst,
2284+ ENETDMAC_MAXBURST, priv->rx_chan);
2285+ enet_dmac_writel(priv, priv->dma_maxburst,
2286+ ENETDMAC_MAXBURST, priv->tx_chan);
2287+
2288+ /* set flow control low/high threshold to 1/3 / 2/3 */
2289+ val = priv->rx_ring_size / 3;
2290+ enet_dma_writel(priv, val, ENETDMA_FLOWCL_REG(priv->rx_chan));
2291+ val = (priv->rx_ring_size * 2) / 3;
2292+ enet_dma_writel(priv, val, ENETDMA_FLOWCH_REG(priv->rx_chan));
2293+
2294+ /* all set, enable mac and interrupts, start dma engine and
2295+ * kick rx dma channel
2296+ */
2297+ wmb();
2298+ enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
2299+ enet_dmac_writel(priv, ENETDMAC_CHANCFG_EN_MASK,
2300+ ENETDMAC_CHANCFG, priv->rx_chan);
2301+
2302+ /* watch "packet transferred" interrupt in rx and tx */
2303+ enet_dmac_writel(priv, ENETDMAC_IR_PKTDONE_MASK,
2304+ ENETDMAC_IR, priv->rx_chan);
2305+ enet_dmac_writel(priv, ENETDMAC_IR_PKTDONE_MASK,
2306+ ENETDMAC_IR, priv->tx_chan);
2307+
2308+ /* make sure we enable napi before rx interrupt */
2309+ napi_enable(&priv->napi);
2310+
2311+ enet_dmac_writel(priv, ENETDMAC_IR_PKTDONE_MASK,
2312+ ENETDMAC_IRMASK, priv->rx_chan);
2313+ enet_dmac_writel(priv, ENETDMAC_IR_PKTDONE_MASK,
2314+ ENETDMAC_IRMASK, priv->tx_chan);
2315+
2316+ netif_carrier_on(dev);
2317+ netif_start_queue(dev);
2318+
2319+ /* apply override config for bypass_link ports here. */
2320+ for (i = 0; i < priv->num_ports; i++) {
2321+ struct bcm63xx_enetsw_port *port;
2322+ u8 override;
2323+ port = &priv->used_ports[i];
2324+ if (!port->used)
2325+ continue;
2326+
2327+ if (!port->bypass_link)
2328+ continue;
2329+
2330+ override = ENETSW_PORTOV_ENABLE_MASK |
2331+ ENETSW_PORTOV_LINKUP_MASK;
2332+
2333+ switch (port->force_speed) {
2334+ case 1000:
2335+ override |= ENETSW_IMPOV_1000_MASK;
2336+ break;
2337+ case 100:
2338+ override |= ENETSW_IMPOV_100_MASK;
2339+ break;
2340+ case 10:
2341+ break;
2342+ default:
2343+ pr_warn("invalid forced speed on port %s: assume 10\n",
2344+ port->name);
2345+ break;
2346+ }
2347+
2348+ if (port->force_duplex_full)
2349+ override |= ENETSW_IMPOV_FDX_MASK;
2350+
2351+
2352+ enetsw_writeb(priv, override, ENETSW_PORTOV_REG(i));
2353+ enetsw_writeb(priv, 0, ENETSW_PTCTRL_REG(i));
2354+ }
2355+
2356+ /* start phy polling timer */
2357+ init_timer(&priv->swphy_poll);
2358+ priv->swphy_poll.function = swphy_poll_timer;
2359+ priv->swphy_poll.data = (unsigned long)priv;
2360+ priv->swphy_poll.expires = jiffies;
2361+ add_timer(&priv->swphy_poll);
2362+ return 0;
2363+
2364+out:
2365+ for (i = 0; i < priv->rx_ring_size; i++) {
2366+ struct bcm_enet_desc *desc;
2367+
2368+ if (!priv->rx_skb[i])
2369+ continue;
2370+
2371+ desc = &priv->rx_desc_cpu[i];
2372+ dma_unmap_single(kdev, desc->address, priv->rx_skb_size,
2373+ DMA_FROM_DEVICE);
2374+ kfree_skb(priv->rx_skb[i]);
2375+ }
2376+ kfree(priv->rx_skb);
2377+
2378+out_free_tx_skb:
2379+ kfree(priv->tx_skb);
2380+
2381+out_free_tx_ring:
2382+ dma_free_coherent(kdev, priv->tx_desc_alloc_size,
2383+ priv->tx_desc_cpu, priv->tx_desc_dma);
2384+
2385+out_free_rx_ring:
2386+ dma_free_coherent(kdev, priv->rx_desc_alloc_size,
2387+ priv->rx_desc_cpu, priv->rx_desc_dma);
2388+
2389+out_freeirq_tx:
2390+ if (priv->irq_tx != -1)
2391+ free_irq(priv->irq_tx, dev);
2392+
2393+out_freeirq_rx:
2394+ free_irq(priv->irq_rx, dev);
2395+
2396+out_freeirq:
2397+ return ret;
2398+}
2399+
2400+/* stop callback */
2401+static int bcm_enetsw_stop(struct net_device *dev)
2402+{
2403+ struct bcm_enet_priv *priv;
2404+ struct device *kdev;
2405+ int i;
2406+
2407+ priv = netdev_priv(dev);
2408+ kdev = &priv->pdev->dev;
2409+
2410+ del_timer_sync(&priv->swphy_poll);
2411+ netif_stop_queue(dev);
2412+ napi_disable(&priv->napi);
2413+ del_timer_sync(&priv->rx_timeout);
2414+
2415+ /* mask all interrupts */
2416+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->rx_chan);
2417+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK, priv->tx_chan);
2418+
2419+ /* disable dma & mac */
2420+ bcm_enet_disable_dma(priv, priv->tx_chan);
2421+ bcm_enet_disable_dma(priv, priv->rx_chan);
2422+
2423+ /* force reclaim of all tx buffers */
2424+ bcm_enet_tx_reclaim(dev, 1);
2425+
2426+ /* free the rx skb ring */
2427+ for (i = 0; i < priv->rx_ring_size; i++) {
2428+ struct bcm_enet_desc *desc;
2429+
2430+ if (!priv->rx_skb[i])
2431+ continue;
2432+
2433+ desc = &priv->rx_desc_cpu[i];
2434+ dma_unmap_single(kdev, desc->address, priv->rx_skb_size,
2435+ DMA_FROM_DEVICE);
2436+ kfree_skb(priv->rx_skb[i]);
2437+ }
2438+
2439+ /* free remaining allocated memory */
2440+ kfree(priv->rx_skb);
2441+ kfree(priv->tx_skb);
2442+ dma_free_coherent(kdev, priv->rx_desc_alloc_size,
2443+ priv->rx_desc_cpu, priv->rx_desc_dma);
2444+ dma_free_coherent(kdev, priv->tx_desc_alloc_size,
2445+ priv->tx_desc_cpu, priv->tx_desc_dma);
2446+ if (priv->irq_tx != -1)
2447+ free_irq(priv->irq_tx, dev);
2448+ free_irq(priv->irq_rx, dev);
2449+
2450+ return 0;
2451+}
2452+
2453+/* try to sort out phy external status by walking the used_port field
2454+ * in the bcm_enet_priv structure. in case the phy address is not
2455+ * assigned to any physical port on the switch, assume it is external
2456+ * (and yell at the user).
2457+ */
2458+static int bcm_enetsw_phy_is_external(struct bcm_enet_priv *priv, int phy_id)
2459+{
2460+ int i;
2461+
2462+ for (i = 0; i < priv->num_ports; ++i) {
2463+ if (!priv->used_ports[i].used)
2464+ continue;
2465+ if (priv->used_ports[i].phy_id == phy_id)
2466+ return bcm_enet_port_is_rgmii(i);
2467+ }
2468+
2469+ printk_once(KERN_WARNING "bcm63xx_enet: could not find a used port with phy_id %i, assuming phy is external\n",
2470+ phy_id);
2471+ return 1;
2472+}
2473+
2474+/* can't use bcmenet_sw_mdio_read directly as we need to sort out
2475+ * external/internal status of the given phy_id first.
2476+ */
2477+static int bcm_enetsw_mii_mdio_read(struct net_device *dev, int phy_id,
2478+ int location)
2479+{
2480+ struct bcm_enet_priv *priv;
2481+
2482+ priv = netdev_priv(dev);
2483+ return bcmenet_sw_mdio_read(priv,
2484+ bcm_enetsw_phy_is_external(priv, phy_id),
2485+ phy_id, location);
2486+}
2487+
2488+/* can't use bcmenet_sw_mdio_write directly as we need to sort out
2489+ * external/internal status of the given phy_id first.
2490+ */
2491+static void bcm_enetsw_mii_mdio_write(struct net_device *dev, int phy_id,
2492+ int location,
2493+ int val)
2494+{
2495+ struct bcm_enet_priv *priv;
2496+
2497+ priv = netdev_priv(dev);
2498+ bcmenet_sw_mdio_write(priv, bcm_enetsw_phy_is_external(priv, phy_id),
2499+ phy_id, location, val);
2500+}
2501+
2502+static int bcm_enetsw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2503+{
2504+ struct mii_if_info mii;
2505+
2506+ mii.dev = dev;
2507+ mii.mdio_read = bcm_enetsw_mii_mdio_read;
2508+ mii.mdio_write = bcm_enetsw_mii_mdio_write;
2509+ mii.phy_id = 0;
2510+ mii.phy_id_mask = 0x3f;
2511+ mii.reg_num_mask = 0x1f;
2512+ return generic_mii_ioctl(&mii, if_mii(rq), cmd, NULL);
2513+
2514+}
2515+
2516+static const struct net_device_ops bcm_enetsw_ops = {
2517+ .ndo_open = bcm_enetsw_open,
2518+ .ndo_stop = bcm_enetsw_stop,
2519+ .ndo_start_xmit = bcm_enet_start_xmit,
2520+ .ndo_change_mtu = bcm_enet_change_mtu,
2521+ .ndo_do_ioctl = bcm_enetsw_ioctl,
2522+};
2523+
2524+
2525+static const struct bcm_enet_stats bcm_enetsw_gstrings_stats[] = {
2526+ { "rx_packets", DEV_STAT(rx_packets), -1 },
2527+ { "tx_packets", DEV_STAT(tx_packets), -1 },
2528+ { "rx_bytes", DEV_STAT(rx_bytes), -1 },
2529+ { "tx_bytes", DEV_STAT(tx_bytes), -1 },
2530+ { "rx_errors", DEV_STAT(rx_errors), -1 },
2531+ { "tx_errors", DEV_STAT(tx_errors), -1 },
2532+ { "rx_dropped", DEV_STAT(rx_dropped), -1 },
2533+ { "tx_dropped", DEV_STAT(tx_dropped), -1 },
2534+
2535+ { "tx_good_octets", GEN_STAT(mib.tx_gd_octets), ETHSW_MIB_RX_GD_OCT },
2536+ { "tx_unicast", GEN_STAT(mib.tx_unicast), ETHSW_MIB_RX_BRDCAST },
2537+ { "tx_broadcast", GEN_STAT(mib.tx_brdcast), ETHSW_MIB_RX_BRDCAST },
2538+ { "tx_multicast", GEN_STAT(mib.tx_mult), ETHSW_MIB_RX_MULT },
2539+ { "tx_64_octets", GEN_STAT(mib.tx_64), ETHSW_MIB_RX_64 },
2540+ { "tx_65_127_oct", GEN_STAT(mib.tx_65_127), ETHSW_MIB_RX_65_127 },
2541+ { "tx_128_255_oct", GEN_STAT(mib.tx_128_255), ETHSW_MIB_RX_128_255 },
2542+ { "tx_256_511_oct", GEN_STAT(mib.tx_256_511), ETHSW_MIB_RX_256_511 },
2543+ { "tx_512_1023_oct", GEN_STAT(mib.tx_512_1023), ETHSW_MIB_RX_512_1023},
2544+ { "tx_1024_1522_oct", GEN_STAT(mib.tx_1024_max),
2545+ ETHSW_MIB_RX_1024_1522 },
2546+ { "tx_1523_2047_oct", GEN_STAT(mib.tx_1523_2047),
2547+ ETHSW_MIB_RX_1523_2047 },
2548+ { "tx_2048_4095_oct", GEN_STAT(mib.tx_2048_4095),
2549+ ETHSW_MIB_RX_2048_4095 },
2550+ { "tx_4096_8191_oct", GEN_STAT(mib.tx_4096_8191),
2551+ ETHSW_MIB_RX_4096_8191 },
2552+ { "tx_8192_9728_oct", GEN_STAT(mib.tx_8192_9728),
2553+ ETHSW_MIB_RX_8192_9728 },
2554+ { "tx_oversize", GEN_STAT(mib.tx_ovr), ETHSW_MIB_RX_OVR },
2555+ { "tx_oversize_drop", GEN_STAT(mib.tx_ovr), ETHSW_MIB_RX_OVR_DISC },
2556+ { "tx_dropped", GEN_STAT(mib.tx_drop), ETHSW_MIB_RX_DROP },
2557+ { "tx_undersize", GEN_STAT(mib.tx_underrun), ETHSW_MIB_RX_UND },
2558+ { "tx_pause", GEN_STAT(mib.tx_pause), ETHSW_MIB_RX_PAUSE },
2559+
2560+ { "rx_good_octets", GEN_STAT(mib.rx_gd_octets), ETHSW_MIB_TX_ALL_OCT },
2561+ { "rx_broadcast", GEN_STAT(mib.rx_brdcast), ETHSW_MIB_TX_BRDCAST },
2562+ { "rx_multicast", GEN_STAT(mib.rx_mult), ETHSW_MIB_TX_MULT },
2563+ { "rx_unicast", GEN_STAT(mib.rx_unicast), ETHSW_MIB_TX_MULT },
2564+ { "rx_pause", GEN_STAT(mib.rx_pause), ETHSW_MIB_TX_PAUSE },
2565+ { "rx_dropped", GEN_STAT(mib.rx_drop), ETHSW_MIB_TX_DROP_PKTS },
2566+
2567+};
2568+
2569+#define BCM_ENETSW_STATS_LEN \
2570+ (sizeof(bcm_enetsw_gstrings_stats) / sizeof(struct bcm_enet_stats))
2571+
2572+static void bcm_enetsw_get_strings(struct net_device *netdev,
2573+ u32 stringset, u8 *data)
2574+{
2575+ int i;
2576+
2577+ switch (stringset) {
2578+ case ETH_SS_STATS:
2579+ for (i = 0; i < BCM_ENETSW_STATS_LEN; i++) {
2580+ memcpy(data + i * ETH_GSTRING_LEN,
2581+ bcm_enetsw_gstrings_stats[i].stat_string,
2582+ ETH_GSTRING_LEN);
2583+ }
2584+ break;
2585+ }
2586+}
2587+
2588+static int bcm_enetsw_get_sset_count(struct net_device *netdev,
2589+ int string_set)
2590+{
2591+ switch (string_set) {
2592+ case ETH_SS_STATS:
2593+ return BCM_ENETSW_STATS_LEN;
2594+ default:
2595+ return -EINVAL;
2596+ }
2597+}
2598+
2599+static void bcm_enetsw_get_drvinfo(struct net_device *netdev,
2600+ struct ethtool_drvinfo *drvinfo)
2601+{
2602+ strncpy(drvinfo->driver, bcm_enet_driver_name, 32);
2603+ strncpy(drvinfo->version, bcm_enet_driver_version, 32);
2604+ strncpy(drvinfo->fw_version, "N/A", 32);
2605+ strncpy(drvinfo->bus_info, "bcm63xx", 32);
2606+ drvinfo->n_stats = BCM_ENETSW_STATS_LEN;
2607+}
2608+
2609+static void bcm_enetsw_get_ethtool_stats(struct net_device *netdev,
2610+ struct ethtool_stats *stats,
2611+ u64 *data)
2612+{
2613+ struct bcm_enet_priv *priv;
2614+ int i;
2615+
2616+ priv = netdev_priv(netdev);
2617+
2618+ for (i = 0; i < BCM_ENETSW_STATS_LEN; i++) {
2619+ const struct bcm_enet_stats *s;
2620+ u32 lo, hi;
2621+ char *p;
2622+ int reg;
2623+
2624+ s = &bcm_enetsw_gstrings_stats[i];
2625+
2626+ reg = s->mib_reg;
2627+ if (reg == -1)
2628+ continue;
2629+
2630+ lo = enetsw_readl(priv, ENETSW_MIB_REG(reg));
2631+ p = (char *)priv + s->stat_offset;
2632+
2633+ if (s->sizeof_stat == sizeof(u64)) {
2634+ hi = enetsw_readl(priv, ENETSW_MIB_REG(reg + 1));
2635+ *(u64 *)p = ((u64)hi << 32 | lo);
2636+ } else {
2637+ *(u32 *)p = lo;
2638+ }
2639+ }
2640+
2641+ for (i = 0; i < BCM_ENETSW_STATS_LEN; i++) {
2642+ const struct bcm_enet_stats *s;
2643+ char *p;
2644+
2645+ s = &bcm_enetsw_gstrings_stats[i];
2646+
2647+ if (s->mib_reg == -1)
2648+ p = (char *)&netdev->stats + s->stat_offset;
2649+ else
2650+ p = (char *)priv + s->stat_offset;
2651+
2652+ data[i] = (s->sizeof_stat == sizeof(u64)) ?
2653+ *(u64 *)p : *(u32 *)p;
2654+ }
2655+}
2656+
2657+static void bcm_enetsw_get_ringparam(struct net_device *dev,
2658+ struct ethtool_ringparam *ering)
2659+{
2660+ struct bcm_enet_priv *priv;
2661+
2662+ priv = netdev_priv(dev);
2663+
2664+ /* rx/tx ring is actually only limited by memory */
2665+ ering->rx_max_pending = 8192;
2666+ ering->tx_max_pending = 8192;
2667+ ering->rx_mini_max_pending = 0;
2668+ ering->rx_jumbo_max_pending = 0;
2669+ ering->rx_pending = priv->rx_ring_size;
2670+ ering->tx_pending = priv->tx_ring_size;
2671+}
2672+
2673+static int bcm_enetsw_set_ringparam(struct net_device *dev,
2674+ struct ethtool_ringparam *ering)
2675+{
2676+ struct bcm_enet_priv *priv;
2677+ int was_running;
2678+
2679+ priv = netdev_priv(dev);
2680+
2681+ was_running = 0;
2682+ if (netif_running(dev)) {
2683+ bcm_enetsw_stop(dev);
2684+ was_running = 1;
2685+ }
2686+
2687+ priv->rx_ring_size = ering->rx_pending;
2688+ priv->tx_ring_size = ering->tx_pending;
2689+
2690+ if (was_running) {
2691+ int err;
2692+
2693+ err = bcm_enetsw_open(dev);
2694+ if (err)
2695+ dev_close(dev);
2696+ }
2697+ return 0;
2698+}
2699+
2700+static struct ethtool_ops bcm_enetsw_ethtool_ops = {
2701+ .get_strings = bcm_enetsw_get_strings,
2702+ .get_sset_count = bcm_enetsw_get_sset_count,
2703+ .get_ethtool_stats = bcm_enetsw_get_ethtool_stats,
2704+ .get_drvinfo = bcm_enetsw_get_drvinfo,
2705+ .get_ringparam = bcm_enetsw_get_ringparam,
2706+ .set_ringparam = bcm_enetsw_set_ringparam,
2707+};
2708+
2709+/* allocate netdevice, request register memory and register device. */
2710+static int bcm_enetsw_probe(struct platform_device *pdev)
2711+{
2712+ struct bcm_enet_priv *priv;
2713+ struct net_device *dev;
2714+ struct bcm63xx_enetsw_platform_data *pd;
2715+ struct resource *res_mem;
2716+ int ret, irq_rx, irq_tx;
2717+
2718+ /* stop if shared driver failed, assume driver->probe will be
2719+ * called in the same order we register devices (correct ?)
2720+ */
2721+ if (!bcm_enet_shared_base[0])
2722+ return -ENODEV;
2723+
2724+ res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2725+ irq_rx = platform_get_irq(pdev, 0);
2726+ irq_tx = platform_get_irq(pdev, 1);
2727+ if (!res_mem || irq_rx < 0)
2728+ return -ENODEV;
2729+
2730+ ret = 0;
2731+ dev = alloc_etherdev(sizeof(*priv));
2732+ if (!dev)
2733+ return -ENOMEM;
2734+ priv = netdev_priv(dev);
2735+ memset(priv, 0, sizeof(*priv));
2736+
2737+ /* initialize default and fetch platform data */
2738+ priv->enet_is_sw = true;
2739+ priv->irq_rx = irq_rx;
2740+ priv->irq_tx = irq_tx;
2741+ priv->rx_ring_size = BCMENET_DEF_RX_DESC;
2742+ priv->tx_ring_size = BCMENET_DEF_TX_DESC;
2743+ priv->dma_maxburst = BCMENETSW_DMA_MAXBURST;
2744+
2745+ pd = pdev->dev.platform_data;
2746+ if (pd) {
2747+ memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
2748+ memcpy(priv->used_ports, pd->used_ports,
2749+ sizeof(pd->used_ports));
2750+ priv->num_ports = pd->num_ports;
2751+ priv->dma_has_sram = pd->dma_has_sram;
2752+ priv->dma_chan_en_mask = pd->dma_chan_en_mask;
2753+ priv->dma_chan_int_mask = pd->dma_chan_int_mask;
2754+ priv->dma_chan_width = pd->dma_chan_width;
2755+ }
2756+
2757+ ret = compute_hw_mtu(priv, dev->mtu);
2758+ if (ret)
2759+ goto out;
2760+
2761+ if (!request_mem_region(res_mem->start, resource_size(res_mem),
2762+ "bcm63xx_enetsw")) {
2763+ ret = -EBUSY;
2764+ goto out;
2765+ }
2766+
2767+ priv->base = ioremap(res_mem->start, resource_size(res_mem));
2768+ if (priv->base == NULL) {
2769+ ret = -ENOMEM;
2770+ goto out_release_mem;
2771+ }
2772+
2773+ priv->mac_clk = clk_get(&pdev->dev, "enetsw");
2774+ if (IS_ERR(priv->mac_clk)) {
2775+ ret = PTR_ERR(priv->mac_clk);
2776+ goto out_unmap;
2777+ }
2778+ clk_enable(priv->mac_clk);
2779+
2780+ priv->rx_chan = 0;
2781+ priv->tx_chan = 1;
2782+ spin_lock_init(&priv->rx_lock);
2783+
2784+ /* init rx timeout (used for oom) */
2785+ init_timer(&priv->rx_timeout);
2786+ priv->rx_timeout.function = bcm_enet_refill_rx_timer;
2787+ priv->rx_timeout.data = (unsigned long)dev;
2788+
2789+ /* register netdevice */
2790+ dev->netdev_ops = &bcm_enetsw_ops;
2791+ netif_napi_add(dev, &priv->napi, bcm_enet_poll, 16);
2792+ SET_ETHTOOL_OPS(dev, &bcm_enetsw_ethtool_ops);
2793+ SET_NETDEV_DEV(dev, &pdev->dev);
2794+
2795+ spin_lock_init(&priv->enetsw_mdio_lock);
2796+
2797+ ret = register_netdev(dev);
2798+ if (ret)
2799+ goto out_put_clk;
2800+
2801+ netif_carrier_off(dev);
2802+ platform_set_drvdata(pdev, dev);
2803+ priv->pdev = pdev;
2804+ priv->net_dev = dev;
2805+
2806+ return 0;
2807+
2808+out_put_clk:
2809+ clk_put(priv->mac_clk);
2810+
2811+out_unmap:
2812+ iounmap(priv->base);
2813+
2814+out_release_mem:
2815+ release_mem_region(res_mem->start, resource_size(res_mem));
2816+out:
2817+ free_netdev(dev);
2818+ return ret;
2819+}
2820+
2821+
2822+/* exit func, stops hardware and unregisters netdevice */
2823+static int bcm_enetsw_remove(struct platform_device *pdev)
2824+{
2825+ struct bcm_enet_priv *priv;
2826+ struct net_device *dev;
2827+ struct resource *res;
2828+
2829+ /* stop netdevice */
2830+ dev = platform_get_drvdata(pdev);
2831+ priv = netdev_priv(dev);
2832+ unregister_netdev(dev);
2833+
2834+ /* release device resources */
2835+ iounmap(priv->base);
2836+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2837+ release_mem_region(res->start, resource_size(res));
2838+
2839+ platform_set_drvdata(pdev, NULL);
2840+ free_netdev(dev);
2841+ return 0;
2842+}
2843+
2844+struct platform_driver bcm63xx_enetsw_driver = {
2845+ .probe = bcm_enetsw_probe,
2846+ .remove = bcm_enetsw_remove,
2847+ .driver = {
2848+ .name = "bcm63xx_enetsw",
2849+ .owner = THIS_MODULE,
2850+ },
2851+};
2852+
2853+/* reserve & remap memory space shared between all macs */
2854+static int bcm_enet_shared_probe(struct platform_device *pdev)
2855+{
2856+ struct resource *res;
2857+ void __iomem *p[3];
2858+ unsigned int i;
2859+
2860+ memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
2861+
2862+ for (i = 0; i < 3; i++) {
2863+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
2864+ p[i] = devm_ioremap_resource(&pdev->dev, res);
2865+ if (IS_ERR(p[i]))
2866+ return PTR_ERR(p[i]);
2867+ }
2868+
2869+ memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
2870+
2871+ return 0;
2872+}
2873+
2874+static int bcm_enet_shared_remove(struct platform_device *pdev)
2875+{
2876+ return 0;
2877+}
2878+
2879+/* this "shared" driver is needed because both macs share a single
2880+ * address space
2881+ */
2882+struct platform_driver bcm63xx_enet_shared_driver = {
2883+ .probe = bcm_enet_shared_probe,
2884+ .remove = bcm_enet_shared_remove,
2885+ .driver = {
2886+ .name = "bcm63xx_enet_shared",
2887+ .owner = THIS_MODULE,
2888+ },
2889+};
2890+
2891+/* entry point */
2892+static int __init bcm_enet_init(void)
2893+{
2894+ int ret;
2895+
2896+ ret = platform_driver_register(&bcm63xx_enet_shared_driver);
2897+ if (ret)
2898+ return ret;
2899+
2900+ ret = platform_driver_register(&bcm63xx_enet_driver);
2901+ if (ret)
2902+ platform_driver_unregister(&bcm63xx_enet_shared_driver);
2903+
2904+ ret = platform_driver_register(&bcm63xx_enetsw_driver);
2905+ if (ret) {
2906+ platform_driver_unregister(&bcm63xx_enet_driver);
2907+ platform_driver_unregister(&bcm63xx_enet_shared_driver);
2908+ }
19142909
19152910 return ret;
19162911 }
@@ -1918,6 +2913,7 @@ static int __init bcm_enet_init(void) · 1 unmodified line
19182913 static void __exit bcm_enet_exit(void)
19192914 {
19202915 platform_driver_unregister(&bcm63xx_enet_driver);
2916+ platform_driver_unregister(&bcm63xx_enetsw_driver);
19212917 platform_driver_unregister(&bcm63xx_enet_shared_driver);
19222918 }
19232919
drivers/net/ethernet/broadcom/bcm63xx_enet.h+86−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818
1919 /* maximum burst len for dma (4 bytes unit) */
2020 #define BCMENET_DMA_MAXBURST 16
21+#define BCMENETSW_DMA_MAXBURST 8
2122
2223 /* tx transmit threshold (4 bytes unit), fifo is 256 bytes, the value
2324 * must be low enough so that a DMA transfer of above burst length can
@@ -84,11 +85,60 @@ · 60 unmodified lines
8485 #define ETH_MIB_RX_CNTRL 54
8586
8687
88+/*
89+ * SW MIB Counters register definitions
90+*/
91+#define ETHSW_MIB_TX_ALL_OCT 0
92+#define ETHSW_MIB_TX_DROP_PKTS 2
93+#define ETHSW_MIB_TX_QOS_PKTS 3
94+#define ETHSW_MIB_TX_BRDCAST 4
95+#define ETHSW_MIB_TX_MULT 5
96+#define ETHSW_MIB_TX_UNI 6
97+#define ETHSW_MIB_TX_COL 7
98+#define ETHSW_MIB_TX_1_COL 8
99+#define ETHSW_MIB_TX_M_COL 9
100+#define ETHSW_MIB_TX_DEF 10
101+#define ETHSW_MIB_TX_LATE 11
102+#define ETHSW_MIB_TX_EX_COL 12
103+#define ETHSW_MIB_TX_PAUSE 14
104+#define ETHSW_MIB_TX_QOS_OCT 15
105+
106+#define ETHSW_MIB_RX_ALL_OCT 17
107+#define ETHSW_MIB_RX_UND 19
108+#define ETHSW_MIB_RX_PAUSE 20
109+#define ETHSW_MIB_RX_64 21
110+#define ETHSW_MIB_RX_65_127 22
111+#define ETHSW_MIB_RX_128_255 23
112+#define ETHSW_MIB_RX_256_511 24
113+#define ETHSW_MIB_RX_512_1023 25
114+#define ETHSW_MIB_RX_1024_1522 26
115+#define ETHSW_MIB_RX_OVR 27
116+#define ETHSW_MIB_RX_JAB 28
117+#define ETHSW_MIB_RX_ALIGN 29
118+#define ETHSW_MIB_RX_CRC 30
119+#define ETHSW_MIB_RX_GD_OCT 31
120+#define ETHSW_MIB_RX_DROP 33
121+#define ETHSW_MIB_RX_UNI 34
122+#define ETHSW_MIB_RX_MULT 35
123+#define ETHSW_MIB_RX_BRDCAST 36
124+#define ETHSW_MIB_RX_SA_CHANGE 37
125+#define ETHSW_MIB_RX_FRAG 38
126+#define ETHSW_MIB_RX_OVR_DISC 39
127+#define ETHSW_MIB_RX_SYM 40
128+#define ETHSW_MIB_RX_QOS_PKTS 41
129+#define ETHSW_MIB_RX_QOS_OCT 42
130+#define ETHSW_MIB_RX_1523_2047 44
131+#define ETHSW_MIB_RX_2048_4095 45
132+#define ETHSW_MIB_RX_4096_8191 46
133+#define ETHSW_MIB_RX_8192_9728 47
134+
135+
87136 struct bcm_enet_mib_counters {
88137 u64 tx_gd_octets;
89138 u32 tx_gd_pkts;
90139 u32 tx_all_octets;
91140 u32 tx_all_pkts;
141+ u32 tx_unicast;
92142 u32 tx_brdcast;
93143 u32 tx_mult;
94144 u32 tx_64;
@@ -97,7 +147,12 @@ struct bcm_enet_mib_counters { · 2 unmodified lines
97147 u32 tx_256_511;
98148 u32 tx_512_1023;
99149 u32 tx_1024_max;
150+ u32 tx_1523_2047;
151+ u32 tx_2048_4095;
152+ u32 tx_4096_8191;
153+ u32 tx_8192_9728;
100154 u32 tx_jab;
155+ u32 tx_drop;
101156 u32 tx_ovr;
102157 u32 tx_frag;
103158 u32 tx_underrun;
@@ -114,6 +169,7 @@ struct bcm_enet_mib_counters { · 10 unmodified lines
114169 u32 rx_all_octets;
115170 u32 rx_all_pkts;
116171 u32 rx_brdcast;
172+ u32 rx_unicast;
117173 u32 rx_mult;
118174 u32 rx_64;
119175 u32 rx_65_127;
@@ -197,6 +253,9 @@ struct bcm_enet_priv { · 77 unmodified lines
197253 /* number of dma desc in tx ring */
198254 int tx_ring_size;
199255
256+ /* maximum dma burst size */
257+ int dma_maxburst;
258+
200259 /* cpu view of rx dma ring */
201260 struct bcm_enet_desc *tx_desc_cpu;
202261
@@ -269,6 +328,33 @@ struct bcm_enet_priv { · 66 unmodified lines
269328
270329 /* maximum hardware transmit/receive size */
271330 unsigned int hw_mtu;
331+
332+ bool enet_is_sw;
333+
334+ /* port mapping for switch devices */
335+ int num_ports;
336+ struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
337+ int sw_port_link[ENETSW_MAX_PORT];
338+
339+ /* used to poll switch port state */
340+ struct timer_list swphy_poll;
341+ spinlock_t enetsw_mdio_lock;
342+
343+ /* dma channel enable mask */
344+ u32 dma_chan_en_mask;
345+
346+ /* dma channel interrupt mask */
347+ u32 dma_chan_int_mask;
348+
349+ /* DMA engine has internal SRAM */
350+ bool dma_has_sram;
351+
352+ /* dma channel width */
353+ unsigned int dma_chan_width;
354+
355+ /* dma descriptor shift value */
356+ unsigned int dma_desc_shift;
272357 };
273358
359+
274360 #endif /* ! BCM63XX_ENET_H_ */
drivers/net/ethernet/broadcom/bnx2.c+2−16
@@ -8104,7 +8104,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 8103 unmodified lines
81048104
81058105 pci_set_master(pdev);
81068106
8107− bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
8107+ bp->pm_cap = pdev->pm_cap;
81088108 if (bp->pm_cap == 0) {
81098109 dev_err(&pdev->dev,
81108110 "Cannot find power management capability, aborting\n");
@@ -8764,18 +8764,4 @@ static struct pci_driver bnx2_pci_driver = { · 653 unmodified lines
87648764 .err_handler = &bnx2_err_handler,
87658765 };
87668766
8767−static int __init bnx2_init(void)
8768−{
8769− return pci_register_driver(&bnx2_pci_driver);
8770−}
8771−
8772−static void __exit bnx2_cleanup(void)
8773−{
8774− pci_unregister_driver(&bnx2_pci_driver);
8775−}
8776−
8777−module_init(bnx2_init);
8778−module_exit(bnx2_cleanup);
8779−
8780−
8781−
8767+module_pci_driver(bnx2_pci_driver);
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+149−36
@@ -34,12 +34,10 @@ · 33 unmodified lines
3434 #define BCM_DCBNL
3535 #endif
3636
37−
3837 #include "bnx2x_hsi.h"
3938
4039 #include "../cnic_if.h"
4140
42−
4341 #define BNX2X_MIN_MSIX_VEC_CNT(bp) ((bp)->min_msix_vec_cnt)
4442
4543 #include <linux/mdio.h>
@@ -114,7 +112,6 @@ do { \ · 68 unmodified lines
114112 #define BNX2X_ERROR(fmt, ...) \
115113 pr_err("[%s:%d]" fmt, __func__, __LINE__, ##__VA_ARGS__)
116114
117−
118115 /* before we have a dev->name use dev_info() */
119116 #define BNX2X_DEV_INFO(fmt, ...) \
120117 do { \
@@ -147,7 +144,6 @@ do { \ · 26 unmodified lines
147144 #define U64_HI(x) ((u32)(((u64)(x)) >> 32))
148145 #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo))
149146
150−
151147 #define REG_ADDR(bp, offset) ((bp->regview) + (offset))
152148
153149 #define REG_RD(bp, offset) readl(REG_ADDR(bp, offset))
@@ -366,7 +362,7 @@ union db_prod { · 212 unmodified lines
366362 /*
367363 * Number of required SGEs is the sum of two:
368364 * 1. Number of possible opened aggregations (next packet for
369− * these aggregations will probably consume SGE immidiatelly)
365+ * these aggregations will probably consume SGE immediately)
370366 * 2. Rest of BRB blocks divided by 2 (block will consume new SGE only
371367 * after placement on BD for new TPA aggregation)
372368 *
@@ -387,7 +383,6 @@ union db_prod { · 14 unmodified lines
387383 #define BIT_VEC64_ELEM_SHIFT 6
388384 #define BIT_VEC64_ELEM_MASK ((u64)BIT_VEC64_ELEM_SZ - 1)
389385
390−
391386 #define __BIT_VEC64_SET_BIT(el, bit) \
392387 do { \
393388 el = ((el) | ((u64)0x1 << (bit))); \
@@ -398,7 +393,6 @@ union db_prod { · 4 unmodified lines
398393 el = ((el) & (~((u64)0x1 << (bit)))); \
399394 } while (0)
400395
401−
402396 #define BIT_VEC64_SET_BIT(vec64, idx) \
403397 __BIT_VEC64_SET_BIT((vec64)[(idx) >> BIT_VEC64_ELEM_SHIFT], \
404398 (idx) & BIT_VEC64_ELEM_MASK)
@@ -419,8 +413,6 @@ union db_prod { · 14 unmodified lines
419413
420414 /*******************************************************/
421415
422−
423−
424416 /* Number of u64 elements in SGE mask array */
425417 #define RX_SGE_MASK_LEN (NUM_RX_SGE / BIT_VEC64_ELEM_SZ)
426418 #define RX_SGE_MASK_LEN_MASK (RX_SGE_MASK_LEN - 1)
@@ -493,11 +485,26 @@ struct bnx2x_fastpath { · 66 unmodified lines
493485 struct bnx2x *bp; /* parent */
494486
495487 struct napi_struct napi;
488+
489+#ifdef CONFIG_NET_LL_RX_POLL
490+ unsigned int state;
491+#define BNX2X_FP_STATE_IDLE 0
492+#define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */
493+#define BNX2X_FP_STATE_POLL (1 << 1) /* poll owns this FP */
494+#define BNX2X_FP_STATE_NAPI_YIELD (1 << 2) /* NAPI yielded this FP */
495+#define BNX2X_FP_STATE_POLL_YIELD (1 << 3) /* poll yielded this FP */
496+#define BNX2X_FP_YIELD (BNX2X_FP_STATE_NAPI_YIELD | BNX2X_FP_STATE_POLL_YIELD)
497+#define BNX2X_FP_LOCKED (BNX2X_FP_STATE_NAPI | BNX2X_FP_STATE_POLL)
498+#define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD)
499+ /* protect state */
500+ spinlock_t lock;
501+#endif /* CONFIG_NET_LL_RX_POLL */
502+
496503 union host_hc_status_block status_blk;
497− /* chip independed shortcuts into sb structure */
504+ /* chip independent shortcuts into sb structure */
498505 __le16 *sb_index_values;
499506 __le16 *sb_running_index;
500− /* chip independed shortcut into rx_prods_offset memory */
507+ /* chip independent shortcut into rx_prods_offset memory */
501508 u32 ustorm_rx_prods_offset;
502509
503510 u32 rx_buf_size;
@@ -565,6 +572,116 @@ struct bnx2x_fastpath { · 61 unmodified lines
565572 #define bnx2x_fp_stats(bp, fp) (&((bp)->fp_stats[(fp)->index]))
566573 #define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats))
567574
575+#ifdef CONFIG_NET_LL_RX_POLL
576+static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp)
577+{
578+ spin_lock_init(&fp->lock);
579+ fp->state = BNX2X_FP_STATE_IDLE;
580+}
581+
582+/* called from the device poll routine to get ownership of a FP */
583+static inline bool bnx2x_fp_lock_napi(struct bnx2x_fastpath *fp)
584+{
585+ bool rc = true;
586+
587+ spin_lock(&fp->lock);
588+ if (fp->state & BNX2X_FP_LOCKED) {
589+ WARN_ON(fp->state & BNX2X_FP_STATE_NAPI);
590+ fp->state |= BNX2X_FP_STATE_NAPI_YIELD;
591+ rc = false;
592+ } else {
593+ /* we don't care if someone yielded */
594+ fp->state = BNX2X_FP_STATE_NAPI;
595+ }
596+ spin_unlock(&fp->lock);
597+ return rc;
598+}
599+
600+/* returns true is someone tried to get the FP while napi had it */
601+static inline bool bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp)
602+{
603+ bool rc = false;
604+
605+ spin_lock(&fp->lock);
606+ WARN_ON(fp->state &
607+ (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_NAPI_YIELD));
608+
609+ if (fp->state & BNX2X_FP_STATE_POLL_YIELD)
610+ rc = true;
611+ fp->state = BNX2X_FP_STATE_IDLE;
612+ spin_unlock(&fp->lock);
613+ return rc;
614+}
615+
616+/* called from bnx2x_low_latency_poll() */
617+static inline bool bnx2x_fp_lock_poll(struct bnx2x_fastpath *fp)
618+{
619+ bool rc = true;
620+
621+ spin_lock_bh(&fp->lock);
622+ if ((fp->state & BNX2X_FP_LOCKED)) {
623+ fp->state |= BNX2X_FP_STATE_POLL_YIELD;
624+ rc = false;
625+ } else {
626+ /* preserve yield marks */
627+ fp->state |= BNX2X_FP_STATE_POLL;
628+ }
629+ spin_unlock_bh(&fp->lock);
630+ return rc;
631+}
632+
633+/* returns true if someone tried to get the FP while it was locked */
634+static inline bool bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp)
635+{
636+ bool rc = false;
637+
638+ spin_lock_bh(&fp->lock);
639+ WARN_ON(fp->state & BNX2X_FP_STATE_NAPI);
640+
641+ if (fp->state & BNX2X_FP_STATE_POLL_YIELD)
642+ rc = true;
643+ fp->state = BNX2X_FP_STATE_IDLE;
644+ spin_unlock_bh(&fp->lock);
645+ return rc;
646+}
647+
648+/* true if a socket is polling, even if it did not get the lock */
649+static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp)
650+{
651+ WARN_ON(!(fp->state & BNX2X_FP_LOCKED));
652+ return fp->state & BNX2X_FP_USER_PEND;
653+}
654+#else
655+static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp)
656+{
657+}
658+
659+static inline bool bnx2x_fp_lock_napi(struct bnx2x_fastpath *fp)
660+{
661+ return true;
662+}
663+
664+static inline bool bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp)
665+{
666+ return false;
667+}
668+
669+static inline bool bnx2x_fp_lock_poll(struct bnx2x_fastpath *fp)
670+{
671+ return false;
672+}
673+
674+static inline bool bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp)
675+{
676+ return false;
677+}
678+
679+static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp)
680+{
681+ return false;
682+}
683+#endif /* CONFIG_NET_LL_RX_POLL */
684+
568685 /* Use 2500 as a mini-jumbo MTU for FCoE */
569686 #define BNX2X_FCOE_MINI_JUMBO_MTU 2500
570687
@@ -580,12 +697,10 @@ struct bnx2x_fastpath { · 9 unmodified lines
580697 txdata_ptr[FIRST_TX_COS_INDEX] \
581698 ->var)
582699
583−
584700 #define IS_ETH_FP(fp) ((fp)->index < BNX2X_NUM_ETH_QUEUES((fp)->bp))
585701 #define IS_FCOE_FP(fp) ((fp)->index == FCOE_IDX((fp)->bp))
586702 #define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX(bp))
587703
588−
589704 /* MC hsi */
590705 #define MAX_FETCH_BD 13 /* HW max BDs per packet */
591706 #define RX_COPY_THRESH 92
@@ -613,7 +728,7 @@ struct bnx2x_fastpath { · 21 unmodified lines
613728 * START_BD(splitted) - includes unpaged data segment for GSO
614729 * PARSING_BD - for TSO and CSUM data
615730 * PARSING_BD2 - for encapsulation data
616− * Frag BDs - decribes pages for frags
731+ * Frag BDs - describes pages for frags
617732 */
618733 #define BDS_PER_TX_PKT 4
619734 #define MAX_BDS_PER_TX_PKT (MAX_SKB_FRAGS + BDS_PER_TX_PKT)
@@ -693,12 +808,10 @@ struct bnx2x_fastpath { · 73 unmodified lines
693808 FW_DROP_LEVEL(bp))
694809 #define RCQ_TH_HI(bp) (RCQ_TH_LO(bp) + DROPLESS_FC_HEADROOM)
695810
696−
697811 /* This is needed for determining of last_max */
698812 #define SUB_S16(a, b) (s16)((s16)(a) - (s16)(b))
699813 #define SUB_S32(a, b) (s32)((s32)(a) - (s32)(b))
700814
701−
702815 #define BNX2X_SWCID_SHIFT 17
703816 #define BNX2X_SWCID_MASK ((0x1 << BNX2X_SWCID_SHIFT) - 1)
704817
@@ -723,7 +836,6 @@ struct bnx2x_fastpath { · 18 unmodified lines
723836 DPM_TRIGER_TYPE); \
724837 } while (0)
725838
726−
727839 /* TX CSUM helpers */
728840 #define SKB_CS_OFF(skb) (offsetof(struct tcphdr, check) - \
729841 skb->csum_offset)
@@ -766,7 +878,6 @@ struct bnx2x_fastpath { · 36 unmodified lines
766878 #define BNX2X_RX_SUM_FIX(cqe) \
767879 BNX2X_PRS_FLAG_OVERETH_IPV4(cqe->fast_path_cqe.pars_flags.flags)
768880
769−
770881 #define FP_USB_FUNC_OFF \
771882 offsetof(struct cstorm_status_block_u, func)
772883 #define FP_CSB_FUNC_OFF \
@@ -900,14 +1011,14 @@ struct bnx2x_common { · 127 unmodified lines
9001011 #define CHIP_IS_E3A0(bp) (CHIP_IS_E3(bp) && \
9011012 (CHIP_REV(bp) == CHIP_REV_Ax))
9021013 /* This define is used in two main places:
903− * 1. In the early stages of nic_load, to know if to configrue Parser / Searcher
1014+ * 1. In the early stages of nic_load, to know if to configure Parser / Searcher
9041015 * to nic-only mode or to offload mode. Offload mode is configured if either the
9051016 * chip is E1x (where MIC_MODE register is not applicable), or if cnic already
9061017 * registered for this port (which means that the user wants storage services).
9071018 * 2. During cnic-related load, to know if offload mode is already configured in
908− * the HW or needs to be configrued.
1019+ * the HW or needs to be configured.
9091020 * Since the transition from nic-mode to offload-mode in HW causes traffic
910− * coruption, nic-mode is configured only in ports on which storage services
1021+ * corruption, nic-mode is configured only in ports on which storage services
9111022 * where never requested.
9121023 */
9131024 #define CONFIGURE_NIC_MODE(bp) (!CHIP_IS_E1x(bp) && !CNIC_ENABLED(bp))
@@ -1008,14 +1119,14 @@ extern struct workqueue_struct *bnx2x_wq; · 94 unmodified lines
10081119 * If the maximum number of FP-SB available is X then:
10091120 * a. If CNIC is supported it consumes 1 FP-SB thus the max number of
10101121 * regular L2 queues is Y=X-1
1011− * b. in MF mode the actual number of L2 queues is Y= (X-1/MF_factor)
1122+ * b. In MF mode the actual number of L2 queues is Y= (X-1/MF_factor)
10121123 * c. If the FCoE L2 queue is supported the actual number of L2 queues
10131124 * is Y+1
10141125 * d. The number of irqs (MSIX vectors) is either Y+1 (one extra for
10151126 * slow-path interrupts) or Y+2 if CNIC is supported (one additional
10161127 * FP interrupt context for the CNIC).
10171128 * e. The number of HW context (CID count) is always X or X+1 if FCoE
1018− * L2 queue is supported. the cid for the FCoE L2 queue is always X.
1129+ * L2 queue is supported. The cid for the FCoE L2 queue is always X.
10191130 */
10201131
10211132 /* fast-path interrupt contexts E1x */
@@ -1068,7 +1179,6 @@ struct bnx2x_slowpath { · 46 unmodified lines
10681179 struct eth_classify_rules_ramrod_data e2;
10691180 } mac_rdata;
10701181
1071−
10721182 union {
10731183 struct tstorm_eth_mac_filter_config e1x;
10741184 struct eth_filter_rules_ramrod_data e2;
@@ -1119,7 +1229,6 @@ struct bnx2x_slowpath { · 44 unmodified lines
11191229 #define bnx2x_sp_mapping(bp, var) \
11201230 (bp->slowpath_mapping + offsetof(struct bnx2x_slowpath, var))
11211231
1122−
11231232 /* attn group wiring */
11241233 #define MAX_DYNAMIC_ATTN_GRPS 8
11251234
@@ -1221,11 +1330,11 @@ enum { · 95 unmodified lines
12211330 BNX2X_SP_RTNL_AFEX_F_UPDATE,
12221331 BNX2X_SP_RTNL_ENABLE_SRIOV,
12231332 BNX2X_SP_RTNL_VFPF_MCAST,
1333+ BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
12241334 BNX2X_SP_RTNL_VFPF_STORM_RX_MODE,
12251335 BNX2X_SP_RTNL_HYPERVISOR_VLAN,
12261336 };
12271337
1228−
12291338 struct bnx2x_prev_path_list {
12301339 struct list_head list;
12311340 u8 bus;
@@ -1392,6 +1501,7 @@ struct bnx2x { · 160 unmodified lines
13921501 #define USING_SINGLE_MSIX_FLAG (1 << 20)
13931502 #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21)
13941503 #define IS_VF_FLAG (1 << 22)
1504+#define INTERRUPTS_ENABLED_FLAG (1 << 23)
13951505
13961506 #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG)
13971507
@@ -1585,7 +1695,7 @@ struct bnx2x { · 187 unmodified lines
15851695 struct mutex cnic_mutex;
15861696 struct bnx2x_vlan_mac_obj iscsi_l2_mac_obj;
15871697
1588− /* Start index of the "special" (CNIC related) L2 cleints */
1698+ /* Start index of the "special" (CNIC related) L2 clients */
15891699 u8 cnic_base_cl_id;
15901700
15911701 int dmae_ready;
@@ -1699,7 +1809,7 @@ struct bnx2x { · 107 unmodified lines
16991809 /* operation indication for the sp_rtnl task */
17001810 unsigned long sp_rtnl_state;
17011811
1702− /* DCBX Negotation results */
1812+ /* DCBX Negotiation results */
17031813 struct dcbx_features dcbx_local_feat;
17041814 u32 dcbx_error;
17051815
@@ -1755,7 +1865,6 @@ extern int num_queues; · 49 unmodified lines
17551865 #define FUNC_FLG_SPQ 0x0010
17561866 #define FUNC_FLG_LEADING 0x0020 /* PF only */
17571867
1758−
17591868 struct bnx2x_func_init_params {
17601869 /* dma */
17611870 dma_addr_t fw_stat_map; /* valid iff FUNC_FLG_STATS */
@@ -1853,9 +1962,6 @@ struct bnx2x_func_init_params { · 91 unmodified lines
18531962
18541963 #define skip_queue(bp, idx) (NO_FCOE(bp) && IS_FCOE_IDX(idx))
18551964
1856−
1857−
1858−
18591965 /**
18601966 * bnx2x_set_mac_one - configure a single MAC address
18611967 *
@@ -1921,7 +2027,6 @@ u32 bnx2x_dmae_opcode(struct bnx2x *bp, u8 src_type, u8 dst_type, · 59 unmodified lines
19212027 void bnx2x_prep_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
19222028 u8 src_type, u8 dst_type);
19232029 int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae);
1924−void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae, int msglvl);
19252030
19262031 /* FLR related routines */
19272032 u32 bnx2x_flr_clnup_poll_count(struct bnx2x *bp);
@@ -1937,6 +2042,8 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, · 9 unmodified lines
19372042 void bnx2x_update_coalesce(struct bnx2x *bp);
19382043 int bnx2x_get_cur_phy_idx(struct bnx2x *bp);
19392044
2045+bool bnx2x_port_after_undi(struct bnx2x *bp);
2046+
19402047 static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
19412048 int wait)
19422049 {
@@ -1998,7 +2105,6 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, · 55 unmodified lines
19982105 #define UNLOAD_CLOSE 1
19992106 #define UNLOAD_RECOVERY 2
20002107
2001−
20022108 /* DMAE command defines */
20032109 #define DMAE_TIMEOUT -1
20042110 #define DMAE_PCI_ERROR -2 /* E2 and onward */
@@ -2062,7 +2168,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, · 57 unmodified lines
20622168 #define DMAE_LEN32_WR_MAX(bp) (CHIP_IS_E1(bp) ? 0x400 : 0x2000)
20632169
20642170 #define DMAE_COMP_VAL 0x60d0d0ae /* E2 and on - upper bit
2065− indicates eror */
2171+ * indicates error
2172+ */
20662173
20672174 #define MAX_DMAE_C_PER_PORT 8
20682175 #define INIT_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \
@@ -2100,7 +2207,6 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, · 31 unmodified lines
21002207 #define SP_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_spe))
21012208 #define MAX_SP_DESC_CNT (SP_DESC_CNT - 1)
21022209
2103−
21042210 #define BNX2X_BTR 4
21052211 #define MAX_SPQ_PENDING 8
21062212
@@ -2137,6 +2243,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, · 30 unmodified lines
21372243 #define ATTN_HARD_WIRED_MASK 0xff00
21382244 #define ATTENTION_ID 4
21392245
2246+#define IS_MF_STORAGE_ONLY(bp) (IS_MF_STORAGE_SD(bp) || \
2247+ IS_MF_FCOE_AFEX(bp))
21402248
21412249 /* stuff added to make the code fit 80Col */
21422250
@@ -2338,4 +2446,9 @@ enum { · 195 unmodified lines
23382446
23392447 #define NUM_MACS 8
23402448
2449+enum bnx2x_pci_bus_speed {
2450+ BNX2X_PCI_LINK_SPEED_2500 = 2500,
2451+ BNX2X_PCI_LINK_SPEED_5000 = 5000,
2452+ BNX2X_PCI_LINK_SPEED_8000 = 8000
2453+};
23412454 #endif /* bnx2x.h */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+132−79
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <net/tcp.h>
2525 #include <net/ipv6.h>
2626 #include <net/ip6_checksum.h>
27+#include <net/ll_poll.h>
2728 #include <linux/prefetch.h>
2829 #include "bnx2x_cmn.h"
2930 #include "bnx2x_init.h"
@@ -124,7 +125,7 @@ static void bnx2x_shrink_eth_fp(struct bnx2x *bp, int delta) · 94 unmodified lines
124125 int i, cos, old_eth_num = BNX2X_NUM_ETH_QUEUES(bp);
125126
126127 /* Queue pointer cannot be re-set on an fp-basis, as moving pointer
127− * backward along the array could cause memory to be overriden
128+ * backward along the array could cause memory to be overridden
128129 */
129130 for (cos = 1; cos < bp->max_cos; cos++) {
130131 for (i = 0; i < old_eth_num - delta; i++) {
@@ -165,7 +166,6 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, · 34 unmodified lines
165166 dma_unmap_single(&bp->pdev->dev, BD_UNMAP_ADDR(tx_start_bd),
166167 BD_UNMAP_LEN(tx_start_bd), DMA_TO_DEVICE);
167168
168−
169169 nbd = le16_to_cpu(tx_start_bd->nbd) - 1;
170170 #ifdef BNX2X_STOP_ON_ERROR
171171 if ((nbd - 1) > (MAX_SKB_FRAGS + 2)) {
@@ -259,7 +259,7 @@ int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata) · 87 unmodified lines
259259 smp_mb();
260260
261261 if (unlikely(netif_tx_queue_stopped(txq))) {
262− /* Taking tx_lock() is needed to prevent reenabling the queue
262+ /* Taking tx_lock() is needed to prevent re-enabling the queue
263263 * while it's empty. This could have happen if rx_action() gets
264264 * suspended in bnx2x_tx_int() after the condition before
265265 * netif_tx_wake_queue(), while tx_action (bnx2x_start_xmit()):
@@ -572,7 +572,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 306 unmodified lines
572572 return err;
573573 }
574574
575− /* Unmap the page as we r going to pass it to the stack */
575+ /* Unmap the page as we're going to pass it to the stack */
576576 dma_unmap_page(&bp->pdev->dev,
577577 dma_unmap_addr(&old_rx_pg, mapping),
578578 SGE_PAGES, DMA_FROM_DEVICE);
@@ -733,7 +733,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 154 unmodified lines
733733 dev_kfree_skb_any(skb);
734734 }
735735
736−
737736 /* put new data in bin */
738737 rx_buf->data = new_data;
739738
@@ -805,40 +804,32 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) · 65 unmodified lines
805804 {
806805 struct bnx2x *bp = fp->bp;
807806 u16 bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
808− u16 hw_comp_cons, sw_comp_cons, sw_comp_prod;
807+ u16 sw_comp_cons, sw_comp_prod;
809808 int rx_pkt = 0;
809+ union eth_rx_cqe *cqe;
810+ struct eth_fast_path_rx_cqe *cqe_fp;
810811
811812 #ifdef BNX2X_STOP_ON_ERROR
812813 if (unlikely(bp->panic))
813814 return 0;
814815 #endif
815816
816− /* CQ "next element" is of the size of the regular element,
817− that's why it's ok here */
818− hw_comp_cons = le16_to_cpu(*fp->rx_cons_sb);
819− if ((hw_comp_cons & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
820− hw_comp_cons++;
821−
822817 bd_cons = fp->rx_bd_cons;
823818 bd_prod = fp->rx_bd_prod;
824819 bd_prod_fw = bd_prod;
825820 sw_comp_cons = fp->rx_comp_cons;
826821 sw_comp_prod = fp->rx_comp_prod;
827822
828− /* Memory barrier necessary as speculative reads of the rx
829− * buffer can be ahead of the index in the status block
830− */
831− rmb();
823+ comp_ring_cons = RCQ_BD(sw_comp_cons);
824+ cqe = &fp->rx_comp_ring[comp_ring_cons];
825+ cqe_fp = &cqe->fast_path_cqe;
832826
833827 DP(NETIF_MSG_RX_STATUS,
834− "queue[%d]: hw_comp_cons %u sw_comp_cons %u\n",
835− fp->index, hw_comp_cons, sw_comp_cons);
828+ "queue[%d]: sw_comp_cons %u\n", fp->index, sw_comp_cons);
836829
837− while (sw_comp_cons != hw_comp_cons) {
830+ while (BNX2X_IS_CQE_COMPLETED(cqe_fp)) {
838831 struct sw_rx_bd *rx_buf = NULL;
839832 struct sk_buff *skb;
840− union eth_rx_cqe *cqe;
841− struct eth_fast_path_rx_cqe *cqe_fp;
842833 u8 cqe_fp_flags;
843834 enum eth_rx_cqe_type cqe_fp_type;
844835 u16 len, pad, queue;
@@ -850,12 +841,9 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) · 5 unmodified lines
850841 return 0;
851842 #endif
852843
853− comp_ring_cons = RCQ_BD(sw_comp_cons);
854844 bd_prod = RX_BD(bd_prod);
855845 bd_cons = RX_BD(bd_cons);
856846
857− cqe = &fp->rx_comp_ring[comp_ring_cons];
858− cqe_fp = &cqe->fast_path_cqe;
859847 cqe_fp_flags = cqe_fp->type_error_flags;
860848 cqe_fp_type = cqe_fp_flags & ETH_FAST_PATH_RX_CQE_TYPE;
861849
@@ -899,7 +887,6 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) · 37 unmodified lines
899887 cqe_fp);
900888
901889 goto next_rx;
902−
903890 }
904891 queue = cqe->end_agg_cqe.queue_index;
905892 tpa_info = &fp->tpa_info[queue];
@@ -1002,9 +989,13 @@ reuse_rx: · 96 unmodified lines
1002989 PARSING_FLAGS_VLAN)
1003990 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
1004991 le16_to_cpu(cqe_fp->vlan_tag));
1005− napi_gro_receive(&fp->napi, skb);
1006992
993+ skb_mark_ll(skb, &fp->napi);
1007994
995+ if (bnx2x_fp_ll_polling(fp))
996+ netif_receive_skb(skb);
997+ else
998+ napi_gro_receive(&fp->napi, skb);
1008999 next_rx:
10091000 rx_buf->data = NULL;
10101001
@@ -1016,8 +1007,15 @@ next_cqe: · 5 unmodified lines
10161007 sw_comp_prod = NEXT_RCQ_IDX(sw_comp_prod);
10171008 sw_comp_cons = NEXT_RCQ_IDX(sw_comp_cons);
10181009
1010+ /* mark CQE as free */
1011+ BNX2X_SEED_CQE(cqe_fp);
1012+
10191013 if (rx_pkt == budget)
10201014 break;
1015+
1016+ comp_ring_cons = RCQ_BD(sw_comp_cons);
1017+ cqe = &fp->rx_comp_ring[comp_ring_cons];
1018+ cqe_fp = &cqe->fast_path_cqe;
10211019 } /* while */
10221020
10231021 fp->rx_bd_cons = bd_cons;
@@ -1053,8 +1051,6 @@ static irqreturn_t bnx2x_msix_fp_int(int irq, void *fp_cookie) · 29 unmodified lines
10531051 #endif
10541052
10551053 /* Handle Rx and Tx according to MSI-X vector */
1056− prefetch(fp->rx_cons_sb);
1057−
10581054 for_each_cos_in_tx_queue(fp, cos)
10591055 prefetch(fp->txdata_ptr[cos]->tx_cons_sb);
10601056
@@ -1118,7 +1114,7 @@ static void bnx2x_fill_report_data(struct bnx2x *bp, · 57 unmodified lines
11181114
11191115 memset(data, 0, sizeof(*data));
11201116
1121− /* Fill the report data: efective line speed */
1117+ /* Fill the report data: effective line speed */
11221118 data->line_speed = line_speed;
11231119
11241120 /* Link is down */
@@ -1161,7 +1157,7 @@ void bnx2x_link_report(struct bnx2x *bp) · 36 unmodified lines
11611157 *
11621158 * @bp: driver handle
11631159 *
1164− * None atomic inmlementation.
1160+ * None atomic implementation.
11651161 * Should be called under the phy_lock.
11661162 */
11671163 void __bnx2x_link_report(struct bnx2x *bp)
@@ -1304,7 +1300,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) · 136 unmodified lines
13041300 "mtu %d rx_buf_size %d\n", bp->dev->mtu, fp->rx_buf_size);
13051301
13061302 if (!fp->disable_tpa) {
1307− /* Fill the per-aggregtion pool */
1303+ /* Fill the per-aggregation pool */
13081304 for (i = 0; i < MAX_AGG_QS(bp); i++) {
13091305 struct bnx2x_agg_info *tpa_info =
13101306 &fp->tpa_info[i];
@@ -1726,7 +1722,7 @@ static int bnx2x_req_irq(struct bnx2x *bp) · 415 unmodified lines
17261722 return request_irq(irq, bnx2x_interrupt, flags, bp->dev->name, bp->dev);
17271723 }
17281724
1729−int bnx2x_setup_irqs(struct bnx2x *bp)
1725+static int bnx2x_setup_irqs(struct bnx2x *bp)
17301726 {
17311727 int rc = 0;
17321728 if (bp->flags & USING_MSIX_FLAG &&
@@ -1759,32 +1755,46 @@ static void bnx2x_napi_enable_cnic(struct bnx2x *bp) · 26 unmodified lines
17591755 {
17601756 int i;
17611757
1762− for_each_rx_queue_cnic(bp, i)
1758+ for_each_rx_queue_cnic(bp, i) {
1759+ bnx2x_fp_init_lock(&bp->fp[i]);
17631760 napi_enable(&bnx2x_fp(bp, i, napi));
1761+ }
17641762 }
17651763
17661764 static void bnx2x_napi_enable(struct bnx2x *bp)
17671765 {
17681766 int i;
17691767
1770− for_each_eth_queue(bp, i)
1768+ for_each_eth_queue(bp, i) {
1769+ bnx2x_fp_init_lock(&bp->fp[i]);
17711770 napi_enable(&bnx2x_fp(bp, i, napi));
1771+ }
17721772 }
17731773
17741774 static void bnx2x_napi_disable_cnic(struct bnx2x *bp)
17751775 {
17761776 int i;
17771777
1778− for_each_rx_queue_cnic(bp, i)
1778+ local_bh_disable();
1779+ for_each_rx_queue_cnic(bp, i) {
17791780 napi_disable(&bnx2x_fp(bp, i, napi));
1781+ while (!bnx2x_fp_lock_napi(&bp->fp[i]))
1782+ mdelay(1);
1783+ }
1784+ local_bh_enable();
17801785 }
17811786
17821787 static void bnx2x_napi_disable(struct bnx2x *bp)
17831788 {
17841789 int i;
17851790
1786− for_each_eth_queue(bp, i)
1791+ local_bh_disable();
1792+ for_each_eth_queue(bp, i) {
17871793 napi_disable(&bnx2x_fp(bp, i, napi));
1794+ while (!bnx2x_fp_lock_napi(&bp->fp[i]))
1795+ mdelay(1);
1796+ }
1797+ local_bh_enable();
17881798 }
17891799
17901800 void bnx2x_netif_start(struct bnx2x *bp)
@@ -1829,7 +1839,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb) · 38 unmodified lines
18291839 }
18301840
18311841 /* select a non-FCoE queue */
1832− return __skb_tx_hash(dev, skb, BNX2X_NUM_ETH_QUEUES(bp));
1842+ return __netdev_pick_tx(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp);
18331843 }
18341844
18351845 void bnx2x_set_num_queues(struct bnx2x *bp)
@@ -1862,7 +1872,7 @@ void bnx2x_set_num_queues(struct bnx2x *bp) · 26 unmodified lines
18621872 *
18631873 * If the actual number of Tx queues (for each CoS) is less than 16 then there
18641874 * will be the holes at the end of each group of 16 ETh L2 indices (0..15,
1865− * 16..31,...) with indicies that are not coupled with any real Tx queue.
1875+ * 16..31,...) with indices that are not coupled with any real Tx queue.
18661876 *
18671877 * The proper configuration of skb->queue_mapping is handled by
18681878 * bnx2x_select_queue() and __skb_tx_hash().
@@ -1924,7 +1934,7 @@ static void bnx2x_set_rx_buf_size(struct bnx2x *bp) · 55 unmodified lines
19241934 ETH_OVREHEAD +
19251935 mtu +
19261936 BNX2X_FW_RX_ALIGN_END;
1927− /* Note : rx_buf_size doesnt take into account NET_SKB_PAD */
1937+ /* Note : rx_buf_size doesn't take into account NET_SKB_PAD */
19281938 if (fp->rx_buf_size + NET_SKB_PAD <= PAGE_SIZE)
19291939 fp->rx_frag_size = fp->rx_buf_size + NET_SKB_PAD;
19301940 else
@@ -1937,7 +1947,7 @@ static int bnx2x_init_rss_pf(struct bnx2x *bp) · 6 unmodified lines
19371947 int i;
19381948 u8 num_eth_queues = BNX2X_NUM_ETH_QUEUES(bp);
19391949
1940− /* Prepare the initial contents fo the indirection table if RSS is
1950+ /* Prepare the initial contents for the indirection table if RSS is
19411951 * enabled
19421952 */
19431953 for (i = 0; i < sizeof(bp->rss_conf_obj.ind_table); i++)
@@ -2015,7 +2025,7 @@ static int bnx2x_init_hw(struct bnx2x *bp, u32 load_code) · 71 unmodified lines
20152025
20162026 /*
20172027 * Cleans the object that have internal lists without sending
2018− * ramrods. Should be run when interrutps are disabled.
2028+ * ramrods. Should be run when interrupts are disabled.
20192029 */
20202030 void bnx2x_squeeze_objects(struct bnx2x *bp)
20212031 {
@@ -2166,10 +2176,10 @@ static int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp) · 144 unmodified lines
21662176 bp->fw_stats_data_mapping = bp->fw_stats_mapping +
21672177 bp->fw_stats_req_sz;
21682178
2169− DP(BNX2X_MSG_SP, "statistics request base address set to %x %x",
2179+ DP(BNX2X_MSG_SP, "statistics request base address set to %x %x\n",
21702180 U64_HI(bp->fw_stats_req_mapping),
21712181 U64_LO(bp->fw_stats_req_mapping));
2172− DP(BNX2X_MSG_SP, "statistics data base address set to %x %x",
2182+ DP(BNX2X_MSG_SP, "statistics data base address set to %x %x\n",
21732183 U64_HI(bp->fw_stats_data_mapping),
21742184 U64_LO(bp->fw_stats_data_mapping));
21752185 return 0;
@@ -2183,6 +2193,8 @@ alloc_mem_err: · 7 unmodified lines
21832193 /* send load request to mcp and analyze response */
21842194 static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code)
21852195 {
2196+ u32 param;
2197+
21862198 /* init fw_seq */
21872199 bp->fw_seq =
21882200 (SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
@@ -2195,9 +2207,13 @@ static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code) · 6 unmodified lines
21952207 DRV_PULSE_SEQ_MASK);
21962208 BNX2X_DEV_INFO("drv_pulse 0x%x\n", bp->fw_drv_pulse_wr_seq);
21972209
2210+ param = DRV_MSG_CODE_LOAD_REQ_WITH_LFA;
2211+
2212+ if (IS_MF_SD(bp) && bnx2x_port_after_undi(bp))
2213+ param |= DRV_MSG_CODE_LOAD_REQ_FORCE_LFA;
2214+
21982215 /* load request */
2199− (*load_code) = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ,
2200− DRV_MSG_CODE_LOAD_REQ_WITH_LFA);
2216+ (*load_code) = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, param);
22012217
22022218 /* if mcp fails to respond we must abort */
22032219 if (!(*load_code)) {
@@ -2238,7 +2254,7 @@ int bnx2x_nic_load_analyze_req(struct bnx2x *bp, u32 load_code) · 34 unmodified lines
22382254
22392255 /* abort nic load if version mismatch */
22402256 if (my_fw != loaded_fw) {
2241− BNX2X_ERR("bnx2x with FW %x was already loaded which mismatches my %x FW. aborting\n",
2257+ BNX2X_ERR("bnx2x with FW %x was already loaded which mismatches my %x FW. Aborting\n",
22422258 loaded_fw, my_fw);
22432259 return -EBUSY;
22442260 }
@@ -2316,10 +2332,10 @@ static void bnx2x_nic_load_afex_dcc(struct bnx2x *bp, int load_code) · 71 unmodified lines
23162332 static void bnx2x_bz_fp(struct bnx2x *bp, int index)
23172333 {
23182334 struct bnx2x_fastpath *fp = &bp->fp[index];
2319−
23202335 int cos;
23212336 struct napi_struct orig_napi = fp->napi;
23222337 struct bnx2x_agg_info *orig_tpa_info = fp->tpa_info;
2338+
23232339 /* bzero bnx2x_fastpath contents */
23242340 if (fp->tpa_info)
23252341 memset(fp->tpa_info, 0, ETH_MAX_AGGREGATION_QUEUES_E1H_E2 *
@@ -2345,8 +2361,7 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) · 19 unmodified lines
23452361 fp->txdata_ptr[cos] = &bp->bnx2x_txq[cos *
23462362 BNX2X_NUM_ETH_QUEUES(bp) + index];
23472363
2348− /*
2349− * set the tpa flag for each queue. The tpa flag determines the queue
2364+ /* set the tpa flag for each queue. The tpa flag determines the queue
23502365 * minimal size so it must be set prior to queue memory allocation
23512366 */
23522367 fp->disable_tpa = !(bp->flags & TPA_ENABLE_FLAG ||
@@ -2429,7 +2444,6 @@ int bnx2x_load_cnic(struct bnx2x *bp) · 76 unmodified lines
24292444 if (bp->state == BNX2X_STATE_OPEN)
24302445 bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD);
24312446
2432−
24332447 DP(NETIF_MSG_IFUP, "Ending successfully CNIC-related load\n");
24342448
24352449 return 0;
@@ -2472,6 +2486,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 36 unmodified lines
24722486
24732487 bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
24742488
2489+ /* zero the structure w/o any lock, before SP handler is initialized */
24752490 memset(&bp->last_reported_link, 0, sizeof(bp->last_reported_link));
24762491 __set_bit(BNX2X_LINK_REPORT_LINK_DOWN,
24772492 &bp->last_reported_link.link_report_flags);
@@ -2536,8 +2551,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 58 unmodified lines
25362551 }
25372552
25382553 /* configure multi cos mappings in kernel.
2539− * this configuration may be overriden by a multi class queue discipline
2540− * or by a dcbx negotiation result.
2554+ * this configuration may be overridden by a multi class queue
2555+ * discipline or by a dcbx negotiation result.
25412556 */
25422557 bnx2x_setup_tc(bp->dev, bp->max_cos);
25432558
@@ -2696,7 +2711,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 152 unmodified lines
26962711 /* Start the Tx */
26972712 switch (load_mode) {
26982713 case LOAD_NORMAL:
2699− /* Tx queue should be only reenabled */
2714+ /* Tx queue should be only re-enabled */
27002715 netif_tx_wake_all_queues(bp->dev);
27012716 break;
27022717
@@ -2841,7 +2856,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 138 unmodified lines
28412856 }
28422857
28432858 /* Nothing to do during unload if previous bnx2x_nic_load()
2844− * have not completed succesfully - all resourses are released.
2859+ * have not completed successfully - all resources are released.
28452860 *
28462861 * we can get here only after unsuccessful ndo_* callback, during which
28472862 * dev->IFF_UP flag is still on.
@@ -2856,6 +2871,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 8 unmodified lines
28562871 bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
28572872 smp_mb();
28582873
2874+ /* indicate to VFs that the PF is going down */
2875+ bnx2x_iov_channel_down(bp);
2876+
28592877 if (CNIC_LOADED(bp))
28602878 bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD);
28612879
@@ -2890,10 +2908,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 28 unmodified lines
28902908 /* Send the UNLOAD_REQUEST to the MCP */
28912909 bnx2x_send_unload_req(bp, unload_mode);
28922910
2893− /*
2894− * Prevent transactions to host from the functions on the
2911+ /* Prevent transactions to host from the functions on the
28952912 * engine that doesn't reset global blocks in case of global
2896− * attention once gloabl blocks are reset and gates are opened
2913+ * attention once global blocks are reset and gates are opened
28972914 * (the engine which leader will perform the recovery
28982915 * last).
28992916 */
@@ -2914,7 +2931,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 14 unmodified lines
29142931 }
29152932
29162933 /*
2917− * At this stage no more interrupts will arrive so we may safly clean
2934+ * At this stage no more interrupts will arrive so we may safely clean
29182935 * the queueable objects here in case they failed to get cleaned so far.
29192936 */
29202937 if (IS_PF(bp))
@@ -2955,7 +2972,6 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 34 unmodified lines
29552972 bnx2x_set_reset_global(bp);
29562973 }
29572974
2958−
29592975 /* The last driver must disable a "close the gate" if there is no
29602976 * parity attention or "process kill" pending.
29612977 */
@@ -3040,6 +3056,8 @@ int bnx2x_poll(struct napi_struct *napi, int budget) · 78 unmodified lines
30403056 return 0;
30413057 }
30423058 #endif
3059+ if (!bnx2x_fp_lock_napi(fp))
3060+ return work_done;
30433061
30443062 for_each_cos_in_tx_queue(fp, cos)
30453063 if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos]))
@@ -3049,12 +3067,15 @@ int bnx2x_poll(struct napi_struct *napi, int budget) · 3 unmodified lines
30493067 work_done += bnx2x_rx_int(fp, budget - work_done);
30503068
30513069 /* must not complete if we consumed full budget */
3052− if (work_done >= budget)
3070+ if (work_done >= budget) {
3071+ bnx2x_fp_unlock_napi(fp);
30533072 break;
3073+ }
30543074 }
30553075
30563076 /* Fall out from the NAPI loop if needed */
3057− if (!(bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) {
3077+ if (!bnx2x_fp_unlock_napi(fp) &&
3078+ !(bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) {
30583079
30593080 /* No need to update SB for FCoE L2 ring as long as
30603081 * it's connected to the default SB and the SB
@@ -3096,6 +3117,32 @@ int bnx2x_poll(struct napi_struct *napi, int budget) · 35 unmodified lines
30963117 return work_done;
30973118 }
30983119
3120+#ifdef CONFIG_NET_LL_RX_POLL
3121+/* must be called with local_bh_disable()d */
3122+int bnx2x_low_latency_recv(struct napi_struct *napi)
3123+{
3124+ struct bnx2x_fastpath *fp = container_of(napi, struct bnx2x_fastpath,
3125+ napi);
3126+ struct bnx2x *bp = fp->bp;
3127+ int found = 0;
3128+
3129+ if ((bp->state == BNX2X_STATE_CLOSED) ||
3130+ (bp->state == BNX2X_STATE_ERROR) ||
3131+ (bp->flags & (TPA_ENABLE_FLAG | GRO_ENABLE_FLAG)))
3132+ return LL_FLUSH_FAILED;
3133+
3134+ if (!bnx2x_fp_lock_poll(fp))
3135+ return LL_FLUSH_BUSY;
3136+
3137+ if (bnx2x_has_rx_work(fp))
3138+ found = bnx2x_rx_int(fp, 4);
3139+
3140+ bnx2x_fp_unlock_poll(fp);
3141+
3142+ return found;
3143+}
3144+#endif
3145+
30993146 /* we split the first BD into headers and data BDs
31003147 * to ease the pain of our fellow microcode engineers
31013148 * we use one mapping for both BDs
@@ -3496,9 +3543,12 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb, · 394 unmodified lines
34963543 /* outer IP header info */
34973544 if (xmit_type & XMIT_CSUM_V4) {
34983545 struct iphdr *iph = ip_hdr(skb);
3546+ u16 csum = (__force u16)(~iph->check) -
3547+ (__force u16)iph->tot_len -
3548+ (__force u16)iph->frag_off;
3549+
34993550 pbd2->fw_ip_csum_wo_len_flags_frag =
3500− bswab16(csum_fold((~iph->check) -
3501− iph->tot_len - iph->frag_off));
3551+ bswab16(csum_fold((__force __wsum)csum));
35023552 } else {
35033553 pbd2->fw_ip_hdr_to_payload_w =
35043554 hlen_w - ((sizeof(struct ipv6hdr)) >> 1);
@@ -3586,7 +3636,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 81 unmodified lines
35863636 DP(NETIF_MSG_TX_QUEUED, "indices: txq %d, fp %d, txdata %d\n",
35873637 txq_index, fp_index, txdata_index); */
35883638
3589− /* enable this debug print to view the tranmission details
3639+ /* enable this debug print to view the transmission details
35903640 DP(NETIF_MSG_TX_QUEUED,
35913641 "transmitting packet cid %d fp index %d txdata_index %d tx_data ptr %p fp pointer %p\n",
35923642 txdata->cid, fp_index, txdata_index, txdata, fp); */
@@ -3968,7 +4018,7 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc) · 375 unmodified lines
39684018 /* setup tc must be called under rtnl lock */
39694019 ASSERT_RTNL();
39704020
3971− /* no traffic classes requested. aborting */
4021+ /* no traffic classes requested. Aborting */
39724022 if (!num_tc) {
39734023 netdev_reset_tc(dev);
39744024 return 0;
@@ -3976,7 +4026,7 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc) · 1 unmodified line
39764026
39774027 /* requested to support too many traffic classes */
39784028 if (num_tc > bp->max_cos) {
3979− BNX2X_ERR("support for too many traffic classes requested: %d. max supported is %d\n",
4029+ BNX2X_ERR("support for too many traffic classes requested: %d. Max supported is %d\n",
39804030 num_tc, bp->max_cos);
39814031 return -EINVAL;
39824032 }
@@ -3995,8 +4045,7 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc) · 12 unmodified lines
39954045 prio, bp->prio_to_cos[prio]);
39964046 }
39974047
3998−
3999− /* Use this configuration to diffrentiate tc0 from other COSes
4048+ /* Use this configuration to differentiate tc0 from other COSes
40004049 This can be used for ets or pfc, and save the effort of setting
40014050 up a multio class queue disc or negotiating DCBX with a switch
40024051 netdev_set_prio_tc_map(dev, 0, 0);
@@ -4288,10 +4337,11 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) · 285 unmodified lines
42884337 &bnx2x_fp(bp, index, rx_desc_mapping),
42894338 sizeof(struct eth_rx_bd) * NUM_RX_BD);
42904339
4291− BNX2X_PCI_ALLOC(bnx2x_fp(bp, index, rx_comp_ring),
4292− &bnx2x_fp(bp, index, rx_comp_mapping),
4293− sizeof(struct eth_fast_path_rx_cqe) *
4294− NUM_RCQ_BD);
4340+ /* Seed all CQEs by 1s */
4341+ BNX2X_PCI_FALLOC(bnx2x_fp(bp, index, rx_comp_ring),
4342+ &bnx2x_fp(bp, index, rx_comp_mapping),
4343+ sizeof(struct eth_fast_path_rx_cqe) *
4344+ NUM_RCQ_BD);
42954345
42964346 /* SGE ring */
42974347 BNX2X_ALLOC(bnx2x_fp(bp, index, rx_page_ring),
@@ -4472,7 +4522,6 @@ int bnx2x_alloc_mem_bp(struct bnx2x *bp) · 174 unmodified lines
44724522 alloc_err:
44734523 bnx2x_free_mem_bp(bp);
44744524 return -ENOMEM;
4475−
44764525 }
44774526
44784527 int bnx2x_reload_if_running(struct net_device *dev)
@@ -4514,7 +4563,6 @@ int bnx2x_get_cur_phy_idx(struct bnx2x *bp) · 35 unmodified lines
45144563 }
45154564
45164565 return sel_phy_idx;
4517−
45184566 }
45194567 int bnx2x_get_link_cfg_idx(struct bnx2x *bp)
45204568 {
@@ -4602,6 +4650,7 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) · 81 unmodified lines
46024650 {
46034651 struct bnx2x *bp = netdev_priv(dev);
46044652 u32 flags = bp->flags;
4653+ u32 changes;
46054654 bool bnx2x_reload = false;
46064655
46074656 if (features & NETIF_F_LRO)
@@ -4626,10 +4675,16 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) · 18 unmodified lines
46264675 }
46274676 }
46284677
4629− if (flags ^ bp->flags) {
4630− bp->flags = flags;
4678+ changes = flags ^ bp->flags;
4679+
4680+ /* if GRO is changed while LRO is enabled, don't force a reload */
4681+ if ((changes & GRO_ENABLE_FLAG) && (flags & TPA_ENABLE_FLAG))
4682+ changes &= ~GRO_ENABLE_FLAG;
4683+
4684+ if (changes)
46314685 bnx2x_reload = true;
4632− }
4686+
4687+ bp->flags = flags;
46334688
46344689 if (bnx2x_reload) {
46354690 if (bp->recovery_state == BNX2X_RECOVERY_DONE)
@@ -4724,7 +4779,6 @@ int bnx2x_resume(struct pci_dev *pdev) · 88 unmodified lines
47244779 return rc;
47254780 }
47264781
4727−
47284782 void bnx2x_set_ctx_validation(struct bnx2x *bp, struct eth_context *cxt,
47294783 u32 cid)
47304784 {
@@ -4742,7 +4796,6 @@ static void storm_memset_hc_timeout(struct bnx2x *bp, u8 port, · 11 unmodified lines
47424796 u8 fw_sb_id, u8 sb_index,
47434797 u8 ticks)
47444798 {
4745−
47464799 u32 addr = BAR_CSTRORM_INTMEM +
47474800 CSTORM_STATUS_BLOCK_DATA_TIMEOUT_OFFSET(fw_sb_id, sb_index);
47484801 REG_WR8(bp, addr, ticks);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h+49−26
@@ -22,7 +22,6 @@ · 21 unmodified lines
2222 #include <linux/netdevice.h>
2323 #include <linux/etherdevice.h>
2424
25−
2625 #include "bnx2x.h"
2726 #include "bnx2x_sriov.h"
2827
@@ -50,13 +49,25 @@ extern int int_mode; · 21 unmodified lines
5049 } \
5150 } while (0)
5251
53−#define BNX2X_PCI_ALLOC(x, y, size) \
54−do { \
55− x = dma_alloc_coherent(&bp->pdev->dev, size, y, \
56− GFP_KERNEL | __GFP_ZERO); \
57− if (x == NULL) \
58− goto alloc_mem_err; \
59−} while (0)
52+#define BNX2X_PCI_ALLOC(x, y, size) \
53+ do { \
54+ x = dma_alloc_coherent(&bp->pdev->dev, size, y, \
55+ GFP_KERNEL | __GFP_ZERO); \
56+ if (x == NULL) \
57+ goto alloc_mem_err; \
58+ DP(NETIF_MSG_HW, "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
59+ (unsigned long long)(*y), x); \
60+ } while (0)
61+
62+#define BNX2X_PCI_FALLOC(x, y, size) \
63+ do { \
64+ x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
65+ if (x == NULL) \
66+ goto alloc_mem_err; \
67+ memset((void *)x, 0xFFFFFFFF, size); \
68+ DP(NETIF_MSG_HW, "BNX2X_PCI_FALLOC: Physical %Lx Virtual %p\n",\
69+ (unsigned long long)(*y), x); \
70+ } while (0)
6071
6172 #define BNX2X_ALLOC(x, size) \
6273 do { \
@@ -494,9 +505,6 @@ void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value); · 431 unmodified lines
494505 /* Error handling */
495506 void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl);
496507
497−/* validate currect fw is loaded */
498−bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err);
499−
500508 /* dev_close main block */
501509 int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link);
502510
@@ -606,6 +614,13 @@ int bnx2x_enable_msi(struct bnx2x *bp); · 103 unmodified lines
606614 */
607615 int bnx2x_poll(struct napi_struct *napi, int budget);
608616
617+/**
618+ * bnx2x_low_latency_recv - LL callback
619+ *
620+ * @napi: napi structure
621+ */
622+int bnx2x_low_latency_recv(struct napi_struct *napi);
623+
609624 /**
610625 * bnx2x_alloc_mem_bp - allocate memories outsize main driver structure
611626 *
@@ -800,16 +815,18 @@ static inline bool bnx2x_has_tx_work(struct bnx2x_fastpath *fp) · 188 unmodified lines
800815 return false;
801816 }
802817
818+#define BNX2X_IS_CQE_COMPLETED(cqe_fp) (cqe_fp->marker == 0x0)
819+#define BNX2X_SEED_CQE(cqe_fp) (cqe_fp->marker = 0xFFFFFFFF)
803820 static inline int bnx2x_has_rx_work(struct bnx2x_fastpath *fp)
804821 {
805− u16 rx_cons_sb;
822+ u16 cons;
823+ union eth_rx_cqe *cqe;
824+ struct eth_fast_path_rx_cqe *cqe_fp;
806825
807− /* Tell compiler that status block fields can change */
808− barrier();
809− rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
810− if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
811− rx_cons_sb++;
812− return (fp->rx_comp_cons != rx_cons_sb);
826+ cons = RCQ_BD(fp->rx_comp_cons);
827+ cqe = &fp->rx_comp_ring[cons];
828+ cqe_fp = &cqe->fast_path_cqe;
829+ return BNX2X_IS_CQE_COMPLETED(cqe_fp);
813830 }
814831
815832 /**
@@ -848,9 +865,11 @@ static inline void bnx2x_add_all_napi_cnic(struct bnx2x *bp) · 32 unmodified lines
848865 int i;
849866
850867 /* Add NAPI objects */
851− for_each_rx_queue_cnic(bp, i)
868+ for_each_rx_queue_cnic(bp, i) {
852869 netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
853870 bnx2x_poll, NAPI_POLL_WEIGHT);
871+ napi_hash_add(&bnx2x_fp(bp, i, napi));
872+ }
854873 }
855874
856875 static inline void bnx2x_add_all_napi(struct bnx2x *bp)
@@ -858,25 +877,31 @@ static inline void bnx2x_add_all_napi(struct bnx2x *bp) · 1 unmodified line
858877 int i;
859878
860879 /* Add NAPI objects */
861− for_each_eth_queue(bp, i)
880+ for_each_eth_queue(bp, i) {
862881 netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
863882 bnx2x_poll, NAPI_POLL_WEIGHT);
883+ napi_hash_add(&bnx2x_fp(bp, i, napi));
884+ }
864885 }
865886
866887 static inline void bnx2x_del_all_napi_cnic(struct bnx2x *bp)
867888 {
868889 int i;
869890
870− for_each_rx_queue_cnic(bp, i)
891+ for_each_rx_queue_cnic(bp, i) {
892+ napi_hash_del(&bnx2x_fp(bp, i, napi));
871893 netif_napi_del(&bnx2x_fp(bp, i, napi));
894+ }
872895 }
873896
874897 static inline void bnx2x_del_all_napi(struct bnx2x *bp)
875898 {
876899 int i;
877900
878− for_each_eth_queue(bp, i)
901+ for_each_eth_queue(bp, i) {
902+ napi_hash_del(&bnx2x_fp(bp, i, napi));
879903 netif_napi_del(&bnx2x_fp(bp, i, napi));
904+ }
880905 }
881906
882907 int bnx2x_set_int_mode(struct bnx2x *bp);
@@ -1171,7 +1196,6 @@ static inline u8 bnx2x_cnic_eth_cl_id(struct bnx2x *bp, u8 cl_idx) · 288 unmodified lines
11711196
11721197 static inline u8 bnx2x_cnic_fw_sb_id(struct bnx2x *bp)
11731198 {
1174−
11751199 /* the 'first' id is allocated for the cnic */
11761200 return bp->base_fw_ndsb;
11771201 }
@@ -1181,7 +1205,6 @@ static inline u8 bnx2x_cnic_igu_sb_id(struct bnx2x *bp) · 3 unmodified lines
11811205 return bp->igu_base_sb;
11821206 }
11831207
1184−
11851208 static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp)
11861209 {
11871210 struct bnx2x_fastpath *fp = bnx2x_fcoe_fp(bp);
@@ -1334,8 +1357,8 @@ static inline bool bnx2x_mtu_allows_gro(int mtu) · 146 unmodified lines
13341357 int fpp = SGE_PAGE_SIZE / (mtu - ETH_MAX_TPA_HEADER_SIZE);
13351358
13361359 /*
1337− * 1. number of frags should not grow above MAX_SKB_FRAGS
1338− * 2. frag must fit the page
1360+ * 1. Number of frags should not grow above MAX_SKB_FRAGS
1361+ * 2. Frag must fit the page
13391362 */
13401363 return mtu <= SGE_PAGE_SIZE && (U_ETH_SGL_SIZE * fpp) <= MAX_SKB_FRAGS;
13411364 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c+22−30
@@ -253,7 +253,6 @@ static void bnx2x_dcbx_get_ets_feature(struct bnx2x *bp, · 252 unmodified lines
253253
254254 memset(&pg_help_data, 0, sizeof(struct pg_help_data));
255255
256−
257256 if (GET_FLAGS(error, DCBX_LOCAL_ETS_ERROR))
258257 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_ETS_ERROR\n");
259258
@@ -298,7 +297,6 @@ static void bnx2x_dcbx_get_ets_feature(struct bnx2x *bp, · 38 unmodified lines
298297 static void bnx2x_dcbx_get_pfc_feature(struct bnx2x *bp,
299298 struct dcbx_pfc_feature *pfc, u32 error)
300299 {
301−
302300 if (GET_FLAGS(error, DCBX_LOCAL_PFC_ERROR))
303301 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_PFC_ERROR\n");
304302
@@ -367,7 +365,6 @@ static int bnx2x_dcbx_read_mib(struct bnx2x *bp, · 62 unmodified lines
367365 struct lldp_remote_mib *remote_mib ;
368366 struct lldp_local_mib *local_mib;
369367
370−
371368 switch (read_mib_type) {
372369 case DCBX_READ_LOCAL_MIB:
373370 mib_size = sizeof(struct lldp_local_mib);
@@ -629,7 +626,6 @@ static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp) · 255 unmodified lines
629626 return 0;
630627 }
631628
632−
633629 #ifdef BCM_DCBNL
634630 static inline
635631 u8 bnx2x_dcbx_dcbnl_app_up(struct dcbx_app_priority_entry *ent)
@@ -691,7 +687,7 @@ static inline void bnx2x_dcbx_update_tc_mapping(struct bnx2x *bp) · 55 unmodified lines
691687 }
692688
693689 /* setup tc must be called under rtnl lock, but we can't take it here
694− * as we are handling an attetntion on a work queue which must be
690+ * as we are handling an attention on a work queue which must be
695691 * flushed at some rtnl-locked contexts (e.g. if down)
696692 */
697693 if (!test_and_set_bit(BNX2X_SP_RTNL_SETUP_TC, &bp->sp_rtnl_state))
@@ -711,7 +707,7 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) · 13 unmodified lines
711707 */
712708 bnx2x_dcbnl_update_applist(bp, true);
713709
714− /* Read rmeote mib if dcbx is in the FW */
710+ /* Read remote mib if dcbx is in the FW */
715711 if (bnx2x_dcbx_read_shmem_remote_mib(bp))
716712 return;
717713 #endif
@@ -742,7 +738,7 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) · 24 unmodified lines
742738 bnx2x_dcbx_update_tc_mapping(bp);
743739
744740 /*
745− * allow other funtions to update their netdevices
741+ * allow other functions to update their netdevices
746742 * accordingly
747743 */
748744 if (IS_MF(bp))
@@ -864,7 +860,7 @@ static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp, · 115 unmodified lines
864860 i, DCBX_PRI_PG_GET(af->ets.pri_pg_tbl, i));
865861 }
866862
867− /*For IEEE admin_recommendation_bw_precentage
863+ /*For IEEE admin_recommendation_bw_percentage
868864 *For IEEE admin_recommendation_ets_pg */
869865 af->pfc.pri_en_bitmap = (u8)dp->admin_pfc_bitmap;
870866 for (i = 0; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
@@ -896,13 +892,11 @@ static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp, · 25 unmodified lines
896892 }
897893
898894 af->app.default_pri = (u8)dp->admin_default_priority;
899−
900895 }
901896
902897 /* Write the data. */
903898 bnx2x_write_data(bp, (u32 *)&admin_mib, offset,
904899 sizeof(struct lldp_admin_mib));
905−
906900 }
907901
908902 void bnx2x_dcbx_set_state(struct bnx2x *bp, bool dcb_on, u32 dcbx_enabled)
@@ -1076,7 +1070,7 @@ static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp, · 167 unmodified lines
10761070 bool pg_found = false;
10771071 u32 i, traf_type, add_traf_type, add_pg;
10781072 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1079− struct pg_entry_help_data *data = help_data->data; /*shotcut*/
1073+ struct pg_entry_help_data *data = help_data->data; /*shortcut*/
10801074
10811075 /* Set to invalid */
10821076 for (i = 0; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++)
@@ -1172,7 +1166,8 @@ static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp, · 89 unmodified lines
11721166 DCBX_PG_BW_GET(ets->pg_bw_tbl, pg_entry));
11731167 else
11741168 /* If we join a group and one is strict
1175− * than the bw rulls */
1169+ * than the bw rules
1170+ */
11761171 cos_data->data[entry].strict =
11771172 BNX2X_DCBX_STRICT_COS_HIGHEST;
11781173 }
@@ -1181,7 +1176,6 @@ static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp, · 2 unmodified lines
11811176 BNX2X_ERR("dcbx error: Both groups must have priorities\n");
11821177 }
11831178
1184−
11851179 #ifndef POWER_OF_2
11861180 #define POWER_OF_2(x) ((0 != x) && (0 == (x & (x-1))))
11871181 #endif
@@ -1284,7 +1278,7 @@ static void bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(struct bnx2x *bp, · 96 unmodified lines
12841278 } else {
12851279 /* If there are only pauseable priorities or
12861280 * only non-pauseable,* the lower priorities go
1287− * to the first queue and the higherpriorities go
1281+ * to the first queue and the higher priorities go
12881282 * to the second queue.
12891283 */
12901284 cos_data->data[0].pausable =
@@ -1484,7 +1478,7 @@ static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params( · 193 unmodified lines
14841478 * queue and one priority goes to the second queue.
14851479 *
14861480 * We will join this two cases:
1487− * if one is BW limited it will go to the secoend queue
1481+ * if one is BW limited it will go to the second queue
14881482 * otherwise the last priority will get it
14891483 */
14901484
@@ -1504,7 +1498,8 @@ static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params( · 13 unmodified lines
15041498 false == b_found_strict)
15051499 /* last entry will be handled separately
15061500 * If no priority is strict than last
1507− * enty goes to last queue.*/
1501+ * entry goes to last queue.
1502+ */
15081503 entry = 1;
15091504 cos_data->data[entry].pri_join_mask |=
15101505 pri_tested;
@@ -1516,7 +1511,8 @@ static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params( · 5 unmodified lines
15161511 b_found_strict = true;
15171512 cos_data->data[1].pri_join_mask |= pri_tested;
15181513 /* If we join a group and one is strict
1519− * than the bw rulls */
1514+ * than the bw rules
1515+ */
15201516 cos_data->data[1].strict =
15211517 BNX2X_DCBX_STRICT_COS_HIGHEST;
15221518 }
@@ -1524,7 +1520,6 @@ static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params( · 1 unmodified line
15241520 }
15251521 }
15261522
1527−
15281523 static void bnx2x_dcbx_2cos_limit_cee_fill_cos_params(struct bnx2x *bp,
15291524 struct pg_help_data *help_data,
15301525 struct dcbx_ets_feature *ets,
@@ -1533,7 +1528,6 @@ static void bnx2x_dcbx_2cos_limit_cee_fill_cos_params(struct bnx2x *bp, · 2 unmodified lines
15331528 u32 pri_join_mask,
15341529 u8 num_of_dif_pri)
15351530 {
1536−
15371531 /* default E2 settings */
15381532 cos_data->num_of_cos = DCBX_COS_MAX_NUM_E2;
15391533
@@ -1629,7 +1623,6 @@ static u8 bnx2x_dcbx_cee_fill_strict_pri(struct bnx2x *bp, · 89 unmodified lines
16291623 u8 num_spread_of_entries,
16301624 u8 strict_app_pris)
16311625 {
1632−
16331626 if (bnx2x_dcbx_spread_strict_pri(bp, cos_data, entry,
16341627 num_spread_of_entries,
16351628 strict_app_pris)) {
@@ -1848,7 +1841,7 @@ static void bnx2x_dcbx_fw_struct(struct bnx2x *bp, · 212 unmodified lines
18481841
18491842 void bnx2x_dcbx_pmf_update(struct bnx2x *bp)
18501843 {
1851− /* if we need to syncronize DCBX result from prev PMF
1844+ /* if we need to synchronize DCBX result from prev PMF
18521845 * read it from shmem and update bp and netdev accordingly
18531846 */
18541847 if (SHMEM2_HAS(bp, drv_flags) &&
@@ -1876,7 +1869,6 @@ void bnx2x_dcbx_pmf_update(struct bnx2x *bp) · 21 unmodified lines
18761869 * dcbx negotiation.
18771870 */
18781871 bnx2x_dcbx_update_tc_mapping(bp);
1879−
18801872 }
18811873 }
18821874
@@ -1943,14 +1935,14 @@ static void bnx2x_dcbnl_set_pg_tccfg_tx(struct net_device *netdev, int prio, · 60 unmodified lines
19431935 return;
19441936
19451937 /**
1946− * bw_pct ingnored - band-width percentage devision between user
1938+ * bw_pct ignored - band-width percentage devision between user
19471939 * priorities within the same group is not
19481940 * standard and hence not supported
19491941 *
1950− * prio_type igonred - priority levels within the same group are not
1942+ * prio_type ignored - priority levels within the same group are not
19511943 * standard and hence are not supported. According
19521944 * to the standard pgid 15 is dedicated to strict
1953− * prioirty traffic (on the port level).
1945+ * priority traffic (on the port level).
19541946 *
19551947 * up_map ignored
19561948 */
@@ -1995,14 +1987,14 @@ static void bnx2x_dcbnl_get_pg_tccfg_tx(struct net_device *netdev, int prio, · 38 unmodified lines
19951987 DP(BNX2X_MSG_DCB, "prio = %d\n", prio);
19961988
19971989 /**
1998− * bw_pct ingnored - band-width percentage devision between user
1990+ * bw_pct ignored - band-width percentage devision between user
19991991 * priorities within the same group is not
20001992 * standard and hence not supported
20011993 *
2002− * prio_type igonred - priority levels within the same group are not
1994+ * prio_type ignored - priority levels within the same group are not
20031995 * standard and hence are not supported. According
20041996 * to the standard pgid 15 is dedicated to strict
2005− * prioirty traffic (on the port level).
1997+ * priority traffic (on the port level).
20061998 *
20071999 * up_map ignored
20082000 */
@@ -2389,7 +2381,7 @@ static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid, · 380 unmodified lines
23892381 *flags |= DCB_FEATCFG_ERROR;
23902382 break;
23912383 default:
2392− BNX2X_ERR("Non valid featrue-ID\n");
2384+ BNX2X_ERR("Non valid feature-ID\n");
23932385 rval = 1;
23942386 break;
23952387 }
@@ -2430,7 +2422,7 @@ static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid, · 34 unmodified lines
24302422 flags & DCB_FEATCFG_WILLING ? 1 : 0;
24312423 break;
24322424 default:
2433− BNX2X_ERR("Non valid featrue-ID\n");
2425+ BNX2X_ERR("Non valid feature-ID\n");
24342426 rval = 1;
24352427 break;
24362428 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h+0−3
@@ -134,8 +134,6 @@ enum { · 133 unmodified lines
134134 #define PFC_BRB1_REG_HIGH_LLFC_LOW_THRESHOLD 130
135135 #define PFC_BRB1_REG_HIGH_LLFC_HIGH_THRESHOLD 170
136136
137−
138−
139137 struct cos_entry_help_data {
140138 u32 pri_join_mask;
141139 u32 cos_bw;
@@ -170,7 +168,6 @@ struct cos_help_data { · 28 unmodified lines
170168 (!(IS_DCBX_PFC_PRI_ONLY_NON_PAUSE((bp), (pg_pri)) || \
171169 IS_DCBX_PFC_PRI_ONLY_PAUSE((bp), (pg_pri))))
172170
173−
174171 struct pg_entry_help_data {
175172 u8 num_of_dif_pri;
176173 u8 pg;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dump.h+0−7
@@ -13,12 +13,6 @@ · 12 unmodified lines
1313 * consent.
1414 */
1515
16−
17−/* This struct holds a signature to ensure the dump returned from the driver
18− * match the meta data file inserted to grc_dump.tcl
19− * The signature is time stamp, diag version and grc_dump version
20− */
21−
2216 #ifndef BNX2X_DUMP_H
2317 #define BNX2X_DUMP_H
2418
@@ -28,7 +22,6 @@ · 3 unmodified lines
2822 #define DRV_DUMP_USTORM_WAITP_ADDRESS 0x338a80
2923 #define DRV_DUMP_CSTORM_WAITP_ADDRESS 0x238a80
3024
31−
3225 /* Possible Chips */
3326 #define DUMP_CHIP_E1 1
3427 #define DUMP_CHIP_E1H 2
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c+81−34
@@ -320,7 +320,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 319 unmodified lines
320320
321321 speed = ethtool_cmd_speed(cmd);
322322
323− /* If recieved a request for an unknown duplex, assume full*/
323+ /* If received a request for an unknown duplex, assume full*/
324324 if (cmd->duplex == DUPLEX_UNKNOWN)
325325 cmd->duplex = DUPLEX_FULL;
326326
@@ -733,7 +733,6 @@ static bool bnx2x_is_reg_in_chip(struct bnx2x *bp, · 406 unmodified lines
733733 return false;
734734 }
735735
736−
737736 static bool bnx2x_is_wreg_in_chip(struct bnx2x *bp,
738737 const struct wreg_addr *wreg_info)
739738 {
@@ -850,7 +849,7 @@ static int __bnx2x_get_preset_regs(struct bnx2x *bp, u32 *p, u32 preset) · 110 unmodified lines
850849
851850 /* Paged registers are supported in E2 & E3 only */
852851 if (CHIP_IS_E2(bp) || CHIP_IS_E3(bp)) {
853− /* Read "paged" registes */
852+ /* Read "paged" registers */
854853 bnx2x_read_pages_regs(bp, p, preset);
855854 }
856855
@@ -960,6 +959,9 @@ static int bnx2x_set_dump(struct net_device *dev, struct ethtool_dump *val) · 103 unmodified lines
960959 struct bnx2x *bp = netdev_priv(dev);
961960
962961 /* Use the ethtool_dump "flag" field as the dump preset index */
962+ if (val->flag < 1 || val->flag > DUMP_MAX_PRESETS)
963+ return -EINVAL;
964+
963965 bp->dump_preset_idx = val->flag;
964966 return 0;
965967 }
@@ -969,12 +971,12 @@ static int bnx2x_get_dump_flag(struct net_device *dev, · 3 unmodified lines
969971 {
970972 struct bnx2x *bp = netdev_priv(dev);
971973
974+ dump->version = BNX2X_DUMP_VERSION;
975+ dump->flag = bp->dump_preset_idx;
972976 /* Calculate the requested preset idx length */
973977 dump->len = bnx2x_get_preset_regs_len(dev, bp->dump_preset_idx);
974978 DP(BNX2X_MSG_ETHTOOL, "Get dump preset %d length=%d\n",
975979 bp->dump_preset_idx, dump->len);
976−
977− dump->flag = ETHTOOL_GET_DUMP_DATA;
978980 return 0;
979981 }
980982
@@ -986,8 +988,6 @@ static int bnx2x_get_dump_data(struct net_device *dev, · 5 unmodified lines
986988 struct bnx2x *bp = netdev_priv(dev);
987989 struct dump_header dump_hdr = {0};
988990
989− memset(p, 0, dump->len);
990−
991991 /* Disable parity attentions as long as following dump may
992992 * cause false alarms by reading never written registers. We
993993 * will re-enable parity attentions right after the dump.
@@ -1155,8 +1155,8 @@ static int bnx2x_get_eeprom_len(struct net_device *dev) · 161 unmodified lines
11551155 return bp->common.flash_size;
11561156 }
11571157
1158−/* Per pf misc lock must be aquired before the per port mcp lock. Otherwise, had
1159− * we done things the other way around, if two pfs from the same port would
1158+/* Per pf misc lock must be acquired before the per port mcp lock. Otherwise,
1159+ * had we done things the other way around, if two pfs from the same port would
11601160 * attempt to access nvram at the same time, we could run into a scenario such
11611161 * as:
11621162 * pf A takes the port lock.
@@ -1381,12 +1381,29 @@ static int bnx2x_nvram_read32(struct bnx2x *bp, u32 offset, u32 *buf, · 218 unmodified lines
13811381 return rc;
13821382 }
13831383
1384+static bool bnx2x_is_nvm_accessible(struct bnx2x *bp)
1385+{
1386+ int rc = 1;
1387+ u16 pm = 0;
1388+ struct net_device *dev = pci_get_drvdata(bp->pdev);
1389+
1390+ if (bp->pm_cap)
1391+ rc = pci_read_config_word(bp->pdev,
1392+ bp->pm_cap + PCI_PM_CTRL, &pm);
1393+
1394+ if ((rc && !netif_running(dev)) ||
1395+ (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0)))
1396+ return false;
1397+
1398+ return true;
1399+}
1400+
13841401 static int bnx2x_get_eeprom(struct net_device *dev,
13851402 struct ethtool_eeprom *eeprom, u8 *eebuf)
13861403 {
13871404 struct bnx2x *bp = netdev_priv(dev);
13881405
1389− if (!netif_running(dev)) {
1406+ if (!bnx2x_is_nvm_accessible(bp)) {
13901407 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
13911408 "cannot access eeprom when the interface is down\n");
13921409 return -EAGAIN;
@@ -1411,7 +1428,7 @@ static int bnx2x_get_module_eeprom(struct net_device *dev, · 18 unmodified lines
14111428 u8 *user_data = data;
14121429 unsigned int start_addr = ee->offset, xfer_size = 0;
14131430
1414− if (!netif_running(dev)) {
1431+ if (!bnx2x_is_nvm_accessible(bp)) {
14151432 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
14161433 "cannot access eeprom when the interface is down\n");
14171434 return -EAGAIN;
@@ -1474,7 +1491,7 @@ static int bnx2x_get_module_info(struct net_device *dev, · 56 unmodified lines
14741491 int phy_idx, rc;
14751492 u8 sff8472_comp, diag_type;
14761493
1477− if (!netif_running(dev)) {
1494+ if (!bnx2x_is_nvm_accessible(bp)) {
14781495 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
14791496 "cannot access eeprom when the interface is down\n");
14801497 return -EAGAIN;
@@ -1594,8 +1611,10 @@ static int bnx2x_nvram_write1(struct bnx2x *bp, u32 offset, u8 *data_buf, · 113 unmodified lines
15941611 */
15951612 val = be32_to_cpu(val_be);
15961613
1597− val &= ~le32_to_cpu(0xff << BYTE_OFFSET(offset));
1598− val |= le32_to_cpu(*data_buf << BYTE_OFFSET(offset));
1614+ val &= ~le32_to_cpu((__force __le32)
1615+ (0xff << BYTE_OFFSET(offset)));
1616+ val |= le32_to_cpu((__force __le32)
1617+ (*data_buf << BYTE_OFFSET(offset)));
15991618
16001619 rc = bnx2x_nvram_write_dword(bp, align_offset, val,
16011620 cmd_flags);
@@ -1676,7 +1695,8 @@ static int bnx2x_set_eeprom(struct net_device *dev, · 74 unmodified lines
16761695 int port = BP_PORT(bp);
16771696 int rc = 0;
16781697 u32 ext_phy_config;
1679− if (!netif_running(dev)) {
1698+
1699+ if (!bnx2x_is_nvm_accessible(bp)) {
16801700 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
16811701 "cannot access eeprom when the interface is down\n");
16821702 return -EAGAIN;
@@ -1921,6 +1941,19 @@ static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] = { · 238 unmodified lines
19211941 "link_test (online) "
19221942 };
19231943
1944+enum {
1945+ BNX2X_PRI_FLAG_ISCSI,
1946+ BNX2X_PRI_FLAG_FCOE,
1947+ BNX2X_PRI_FLAG_STORAGE,
1948+ BNX2X_PRI_FLAG_LEN,
1949+};
1950+
1951+static const char bnx2x_private_arr[BNX2X_PRI_FLAG_LEN][ETH_GSTRING_LEN] = {
1952+ "iSCSI offload support",
1953+ "FCoE offload support",
1954+ "Storage only interface"
1955+};
1956+
19241957 static u32 bnx2x_eee_to_adv(u32 eee_adv)
19251958 {
19261959 u32 modes = 0;
@@ -2041,7 +2074,7 @@ static int bnx2x_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 114 unmodified lines
20412074 EEE_MODE_OVERRIDE_NVRAM |
20422075 EEE_MODE_OUTPUT_TIME;
20432076
2044− /* Restart link to propogate changes */
2077+ /* Restart link to propagate changes */
20452078 if (netif_running(dev)) {
20462079 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
20472080 bnx2x_force_link_reset(bp);
@@ -2160,7 +2193,7 @@ static int bnx2x_test_registers(struct bnx2x *bp) · 112 unmodified lines
21602193 { BNX2X_CHIP_MASK_ALL, 0xffffffff, 0, 0x00000000 }
21612194 };
21622195
2163− if (!netif_running(bp->dev)) {
2196+ if (!bnx2x_is_nvm_accessible(bp)) {
21642197 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
21652198 "cannot access eeprom when the interface is down\n");
21662199 return rc;
@@ -2264,7 +2297,7 @@ static int bnx2x_test_memory(struct bnx2x *bp) · 97 unmodified lines
22642297 { NULL, 0xffffffff, {0, 0, 0, 0} }
22652298 };
22662299
2267− if (!netif_running(bp->dev)) {
2300+ if (!bnx2x_is_nvm_accessible(bp)) {
22682301 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
22692302 "cannot access eeprom when the interface is down\n");
22702303 return rc;
@@ -2978,32 +3011,47 @@ static int bnx2x_num_stat_queues(struct bnx2x *bp) · 707 unmodified lines
29783011 static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
29793012 {
29803013 struct bnx2x *bp = netdev_priv(dev);
2981− int i, num_stats;
3014+ int i, num_strings = 0;
29823015
29833016 switch (stringset) {
29843017 case ETH_SS_STATS:
29853018 if (is_multi(bp)) {
2986− num_stats = bnx2x_num_stat_queues(bp) *
2987− BNX2X_NUM_Q_STATS;
3019+ num_strings = bnx2x_num_stat_queues(bp) *
3020+ BNX2X_NUM_Q_STATS;
29883021 } else
2989− num_stats = 0;
3022+ num_strings = 0;
29903023 if (IS_MF_MODE_STAT(bp)) {
29913024 for (i = 0; i < BNX2X_NUM_STATS; i++)
29923025 if (IS_FUNC_STAT(i))
2993− num_stats++;
3026+ num_strings++;
29943027 } else
2995− num_stats += BNX2X_NUM_STATS;
3028+ num_strings += BNX2X_NUM_STATS;
29963029
2997− return num_stats;
3030+ return num_strings;
29983031
29993032 case ETH_SS_TEST:
30003033 return BNX2X_NUM_TESTS(bp);
30013034
3035+ case ETH_SS_PRIV_FLAGS:
3036+ return BNX2X_PRI_FLAG_LEN;
3037+
30023038 default:
30033039 return -EINVAL;
30043040 }
30053041 }
30063042
3043+static u32 bnx2x_get_private_flags(struct net_device *dev)
3044+{
3045+ struct bnx2x *bp = netdev_priv(dev);
3046+ u32 flags = 0;
3047+
3048+ flags |= (!(bp->flags & NO_ISCSI_FLAG) ? 1 : 0) << BNX2X_PRI_FLAG_ISCSI;
3049+ flags |= (!(bp->flags & NO_FCOE_FLAG) ? 1 : 0) << BNX2X_PRI_FLAG_FCOE;
3050+ flags |= (!!IS_MF_STORAGE_ONLY(bp)) << BNX2X_PRI_FLAG_STORAGE;
3051+
3052+ return flags;
3053+}
3054+
30073055 static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
30083056 {
30093057 struct bnx2x *bp = netdev_priv(dev);
@@ -3026,7 +3074,6 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) · 16 unmodified lines
30263074 }
30273075 }
30283076
3029−
30303077 for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
30313078 if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
30323079 continue;
@@ -3045,6 +3092,12 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) · 12 unmodified lines
30453092 start = 4;
30463093 memcpy(buf, bnx2x_tests_str_arr + start,
30473094 ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp));
3095+ break;
3096+
3097+ case ETH_SS_PRIV_FLAGS:
3098+ memcpy(buf, bnx2x_private_arr,
3099+ ETH_GSTRING_LEN * BNX2X_PRI_FLAG_LEN);
3100+ break;
30483101 }
30493102 }
30503103
@@ -3106,17 +3159,12 @@ static int bnx2x_set_phys_id(struct net_device *dev, · 55 unmodified lines
31063159 {
31073160 struct bnx2x *bp = netdev_priv(dev);
31083161
3109− if (!netif_running(dev)) {
3162+ if (!bnx2x_is_nvm_accessible(bp)) {
31103163 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
31113164 "cannot access eeprom when the interface is down\n");
31123165 return -EAGAIN;
31133166 }
31143167
3115− if (!bp->port.pmf) {
3116− DP(BNX2X_MSG_ETHTOOL, "Interface is not pmf\n");
3117− return -EOPNOTSUPP;
3118− }
3119−
31203168 switch (state) {
31213169 case ETHTOOL_ID_ACTIVE:
31223170 return 1; /* cycle on/off once per second */
@@ -3148,7 +3196,6 @@ static int bnx2x_set_phys_id(struct net_device *dev, · 25 unmodified lines
31483196
31493197 static int bnx2x_get_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
31503198 {
3151−
31523199 switch (info->flow_type) {
31533200 case TCP_V4_FLOW:
31543201 case TCP_V6_FLOW:
@@ -3384,7 +3431,6 @@ static int bnx2x_set_channels(struct net_device *dev, · 229 unmodified lines
33843431 {
33853432 struct bnx2x *bp = netdev_priv(dev);
33863433
3387−
33883434 DP(BNX2X_MSG_ETHTOOL,
33893435 "set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n",
33903436 channels->rx_count, channels->tx_count, channels->other_count,
@@ -3445,6 +3491,7 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { · 54 unmodified lines
34453491 .set_pauseparam = bnx2x_set_pauseparam,
34463492 .self_test = bnx2x_self_test,
34473493 .get_sset_count = bnx2x_get_sset_count,
3494+ .get_priv_flags = bnx2x_get_private_flags,
34483495 .get_strings = bnx2x_get_strings,
34493496 .set_phys_id = bnx2x_set_phys_id,
34503497 .get_ethtool_stats = bnx2x_get_ethtool_stats,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h+4−1
@@ -1323,6 +1323,8 @@ struct drv_func_mb { · 1322 unmodified lines
13231323 #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002
13241324
13251325 #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a
1326+ #define DRV_MSG_CODE_LOAD_REQ_FORCE_LFA 0x00002000
1327+
13261328 u32 fw_mb_header;
13271329 #define FW_MSG_CODE_MASK 0xffff0000
13281330 #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000
@@ -3816,7 +3818,8 @@ struct eth_fast_path_rx_cqe { · 2487 unmodified lines
38163818 __le16 len_on_bd;
38173819 struct parsing_flags pars_flags;
38183820 union eth_sgl_or_raw_data sgl_or_raw_data;
3819− __le32 reserved1[8];
3821+ __le32 reserved1[7];
3822+ u32 marker;
38203823 };
38213824
38223825
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+436−251
@@ -93,7 +93,6 @@ MODULE_FIRMWARE(FW_FILE_NAME_E1); · 92 unmodified lines
9393 MODULE_FIRMWARE(FW_FILE_NAME_E1H);
9494 MODULE_FIRMWARE(FW_FILE_NAME_E2);
9595
96−
9796 int num_queues;
9897 module_param(num_queues, int, 0);
9998 MODULE_PARM_DESC(num_queues,
@@ -103,8 +102,6 @@ static int disable_tpa; · 3 unmodified lines
103102 module_param(disable_tpa, int, 0);
104103 MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature");
105104
106−#define INT_MODE_INTx 1
107−#define INT_MODE_MSI 2
108105 int int_mode;
109106 module_param(int_mode, int, 0);
110107 MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X "
@@ -122,8 +119,6 @@ static int debug; · 11 unmodified lines
122119 module_param(debug, int, 0);
123120 MODULE_PARM_DESC(debug, " Default debug msglevel");
124121
125−
126−
127122 struct workqueue_struct *bnx2x_wq;
128123
129124 struct bnx2x_mac_vals {
@@ -376,9 +371,11 @@ static u32 bnx2x_reg_rd_ind(struct bnx2x *bp, u32 addr) · 246 unmodified lines
376371 #define DMAE_DP_DST_PCI "pci dst_addr [%x:%08x]"
377372 #define DMAE_DP_DST_NONE "dst_addr [none]"
378373
379−void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae, int msglvl)
374+static void bnx2x_dp_dmae(struct bnx2x *bp,
375+ struct dmae_command *dmae, int msglvl)
380376 {
381377 u32 src_type = dmae->opcode & DMAE_COMMAND_SRC;
378+ int i;
382379
383380 switch (dmae->opcode & DMAE_COMMAND_DST) {
384381 case DMAE_CMD_DST_PCI:
@@ -434,6 +431,10 @@ void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae, int msglvl) · 49 unmodified lines
434431 dmae->comp_val);
435432 break;
436433 }
434+
435+ for (i = 0; i < (sizeof(struct dmae_command)/4); i++)
436+ DP(msglvl, "DMAE RAW [%02d]: 0x%08x\n",
437+ i, *(((u32 *)dmae) + i));
437438 }
438439
439440 /* copy command into DMAE command memory and set DMAE command go */
@@ -508,8 +509,9 @@ int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae) · 68 unmodified lines
508509 int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 4000;
509510 int rc = 0;
510511
511− /*
512− * Lock the dmae channel. Disable BHs to prevent a dead-lock
512+ bnx2x_dp_dmae(bp, dmae, BNX2X_MSG_DMAE);
513+
514+ /* Lock the dmae channel. Disable BHs to prevent a dead-lock
513515 * as long as this code is called both from syscall context and
514516 * from ndo_set_rx_mode() flow that may be called from BH.
515517 */
@@ -548,6 +550,7 @@ unlock: · 32 unmodified lines
548550 void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
549551 u32 len32)
550552 {
553+ int rc;
551554 struct dmae_command dmae;
552555
553556 if (!bp->dmae_ready) {
@@ -571,11 +574,16 @@ void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr, · 17 unmodified lines
571574 dmae.len = len32;
572575
573576 /* issue the command and wait for completion */
574− bnx2x_issue_dmae_with_comp(bp, &dmae);
577+ rc = bnx2x_issue_dmae_with_comp(bp, &dmae);
578+ if (rc) {
579+ BNX2X_ERR("DMAE returned failure %d\n", rc);
580+ bnx2x_panic();
581+ }
575582 }
576583
577584 void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32)
578585 {
586+ int rc;
579587 struct dmae_command dmae;
580588
581589 if (!bp->dmae_ready) {
@@ -603,7 +611,11 @@ void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32) · 21 unmodified lines
603611 dmae.len = len32;
604612
605613 /* issue the command and wait for completion */
606− bnx2x_issue_dmae_with_comp(bp, &dmae);
614+ rc = bnx2x_issue_dmae_with_comp(bp, &dmae);
615+ if (rc) {
616+ BNX2X_ERR("DMAE returned failure %d\n", rc);
617+ bnx2x_panic();
618+ }
607619 }
608620
609621 static void bnx2x_write_dmae_phys_len(struct bnx2x *bp, dma_addr_t phys_addr,
@@ -811,8 +823,8 @@ static void bnx2x_hc_int_disable(struct bnx2x *bp) · 201 unmodified lines
811823 u32 val = REG_RD(bp, addr);
812824
813825 /* in E1 we must use only PCI configuration space to disable
814− * MSI/MSIX capablility
815− * It's forbitten to disable IGU_PF_CONF_MSI_MSIX_EN in HC block
826+ * MSI/MSIX capability
827+ * It's forbidden to disable IGU_PF_CONF_MSI_MSIX_EN in HC block
816828 */
817829 if (CHIP_IS_E1(bp)) {
818830 /* Since IGU_PF_CONF_MSI_MSIX_EN still always on
@@ -839,7 +851,7 @@ static void bnx2x_hc_int_disable(struct bnx2x *bp) · 20 unmodified lines
839851
840852 REG_WR(bp, addr, val);
841853 if (REG_RD(bp, addr) != val)
842− BNX2X_ERR("BUG! proper val not read from IGU!\n");
854+ BNX2X_ERR("BUG! Proper val not read from IGU!\n");
843855 }
844856
845857 static void bnx2x_igu_int_disable(struct bnx2x *bp)
@@ -857,7 +869,7 @@ static void bnx2x_igu_int_disable(struct bnx2x *bp) · 11 unmodified lines
857869
858870 REG_WR(bp, IGU_REG_PF_CONFIGURATION, val);
859871 if (REG_RD(bp, IGU_REG_PF_CONFIGURATION) != val)
860− BNX2X_ERR("BUG! proper val not read from IGU!\n");
872+ BNX2X_ERR("BUG! Proper val not read from IGU!\n");
861873 }
862874
863875 static void bnx2x_int_disable(struct bnx2x *bp)
@@ -917,7 +929,6 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) · 53 unmodified lines
917929 sp_sb_data.p_func.vf_valid,
918930 sp_sb_data.state);
919931
920−
921932 for_each_eth_queue(bp, i) {
922933 struct bnx2x_fastpath *fp = &bp->fp[i];
923934 int loop;
@@ -1016,7 +1027,7 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) · 92 unmodified lines
10161027 hc_sm_p[j].timer_value);
10171028 }
10181029
1019− /* Indecies data */
1030+ /* Indices data */
10201031 for (j = 0; j < loop; j++) {
10211032 pr_cont("INDEX[%d] flags (0x%x) timeout (0x%x)\n", j,
10221033 hc_index_p[j].flags,
@@ -1027,6 +1038,7 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) · 4 unmodified lines
10271038 #ifdef BNX2X_STOP_ON_ERROR
10281039
10291040 /* event queue */
1041+ BNX2X_ERR("eq cons %x prod %x\n", bp->eq_cons, bp->eq_prod);
10301042 for (i = 0; i < NUM_EQ_DESC; i++) {
10311043 u32 *data = (u32 *)&bp->eq_ring[i].message.data;
10321044
@@ -1111,7 +1123,7 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) · 78 unmodified lines
11111123 * bnx2x_pf_flr_clnup() is called during nic_load in the per function HW
11121124 * initialization.
11131125 */
1114−#define FLR_WAIT_USEC 10000 /* 10 miliseconds */
1126+#define FLR_WAIT_USEC 10000 /* 10 milliseconds */
11151127 #define FLR_WAIT_INTERVAL 50 /* usec */
11161128 #define FLR_POLL_CNT (FLR_WAIT_USEC/FLR_WAIT_INTERVAL) /* 200 */
11171129
@@ -1290,7 +1302,6 @@ void bnx2x_tx_hw_flushed(struct bnx2x *bp, u32 poll_count) · 172 unmodified lines
12901302 for (i = 0; i < ARRAY_SIZE(cmd_regs); i++)
12911303 bnx2x_pbf_pN_cmd_flushed(bp, &cmd_regs[i], poll_count);
12921304
1293−
12941305 /* Verify the transmission buffers are flushed P0, P1, P4 */
12951306 for (i = 0; i < ARRAY_SIZE(buf_regs); i++)
12961307 bnx2x_pbf_pN_buf_flushed(bp, &buf_regs[i], poll_count);
@@ -1305,11 +1316,9 @@ void bnx2x_tx_hw_flushed(struct bnx2x *bp, u32 poll_count) · 8 unmodified lines
13051316 #define OP_GEN_AGG_VECT(index) \
13061317 (((index) << SDM_OP_GEN_AGG_VECT_IDX_SHIFT) & SDM_OP_GEN_AGG_VECT_IDX)
13071318
1308−
13091319 int bnx2x_send_final_clnup(struct bnx2x *bp, u8 clnup_func, u32 poll_cnt)
13101320 {
13111321 u32 op_gen_command = 0;
1312−
13131322 u32 comp_addr = BAR_CSTRORM_INTMEM +
13141323 CSTORM_FINAL_CLEANUP_COMPLETE_OFFSET(clnup_func);
13151324 int ret = 0;
@@ -1334,7 +1343,7 @@ int bnx2x_send_final_clnup(struct bnx2x *bp, u8 clnup_func, u32 poll_cnt) · 18 unmodified lines
13341343 bnx2x_panic();
13351344 return 1;
13361345 }
1337− /* Zero completion for nxt FLR */
1346+ /* Zero completion for next FLR */
13381347 REG_WR(bp, comp_addr, 0);
13391348
13401349 return ret;
@@ -1352,7 +1361,6 @@ u8 bnx2x_is_pcie_pending(struct pci_dev *dev) · 11 unmodified lines
13521361 */
13531362 static int bnx2x_poll_hw_usage_counters(struct bnx2x *bp, u32 poll_cnt)
13541363 {
1355−
13561364 /* wait for CFC PF usage-counter to zero (includes all the VFs) */
13571365 if (bnx2x_flr_clnup_poll_hw_counter(bp,
13581366 CFC_REG_NUM_LCIDS_INSIDE_PF,
@@ -1360,7 +1368,6 @@ static int bnx2x_poll_hw_usage_counters(struct bnx2x *bp, u32 poll_cnt) · 1 unmodified line
13601368 poll_cnt))
13611369 return 1;
13621370
1363−
13641371 /* Wait for DQ PF usage-counter to zero (until DQ cleanup) */
13651372 if (bnx2x_flr_clnup_poll_hw_counter(bp,
13661373 DORQ_REG_PF_USAGE_CNT,
@@ -1390,7 +1397,7 @@ static int bnx2x_poll_hw_usage_counters(struct bnx2x *bp, u32 poll_cnt) · 23 unmodified lines
13901397 /* Wait DMAE PF usage counter to zero */
13911398 if (bnx2x_flr_clnup_poll_hw_counter(bp,
13921399 dmae_reg_go_c[INIT_DMAE_C(bp)],
1393− "DMAE dommand register timed out",
1400+ "DMAE command register timed out",
13941401 poll_cnt))
13951402 return 1;
13961403
@@ -1770,7 +1777,7 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) · 373 unmodified lines
17701777 break;
17711778
17721779 case (RAMROD_CMD_ID_ETH_TERMINATE):
1773− DP(BNX2X_MSG_SP, "got MULTI[%d] teminate ramrod\n", cid);
1780+ DP(BNX2X_MSG_SP, "got MULTI[%d] terminate ramrod\n", cid);
17741781 drv_cmd = BNX2X_Q_CMD_TERMINATE;
17751782 break;
17761783
@@ -1859,7 +1866,6 @@ irqreturn_t bnx2x_interrupt(int irq, void *dev_instance) · 82 unmodified lines
18591866 mask = 0x2 << (fp->index + CNIC_SUPPORT(bp));
18601867 if (status & mask) {
18611868 /* Handle Rx or Tx according to SB id */
1862− prefetch(fp->rx_cons_sb);
18631869 for_each_cos_in_tx_queue(fp, cos)
18641870 prefetch(fp->txdata_ptr[cos]->tx_cons_sb);
18651871 prefetch(&fp->sb_running_index[SM_RX_ID]);
@@ -1947,7 +1953,7 @@ int bnx2x_acquire_hw_lock(struct bnx2x *bp, u32 resource) · 81 unmodified lines
19471953 if (lock_status & resource_bit)
19481954 return 0;
19491955
1950− msleep(5);
1956+ usleep_range(5000, 10000);
19511957 }
19521958 BNX2X_ERR("Timeout\n");
19531959 return -EAGAIN;
@@ -1982,8 +1988,8 @@ int bnx2x_release_hw_lock(struct bnx2x *bp, u32 resource) · 28 unmodified lines
19821988 /* Validating that the resource is currently taken */
19831989 lock_status = REG_RD(bp, hw_lock_control_reg);
19841990 if (!(lock_status & resource_bit)) {
1985− BNX2X_ERR("lock_status 0x%x resource_bit 0x%x. unlock was called but lock wasn't taken!\n",
1986− lock_status, resource_bit);
1991+ BNX2X_ERR("lock_status 0x%x resource_bit 0x%x. Unlock was called but lock wasn't taken!\n",
1992+ lock_status, resource_bit);
19871993 return -EFAULT;
19881994 }
19891995
@@ -1991,7 +1997,6 @@ int bnx2x_release_hw_lock(struct bnx2x *bp, u32 resource) · 1 unmodified line
19911997 return 0;
19921998 }
19931999
1994−
19952000 int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port)
19962001 {
19972002 /* The GPIO should be swapped if swap register is set and active */
@@ -2347,14 +2352,13 @@ u8 bnx2x_link_test(struct bnx2x *bp, u8 is_serdes) · 349 unmodified lines
23472352 return rc;
23482353 }
23492354
2350−
23512355 /* Calculates the sum of vn_min_rates.
23522356 It's needed for further normalizing of the min_rates.
23532357 Returns:
23542358 sum of vn_min_rates.
23552359 or
23562360 0 - if all the min_rates are 0.
2357− In the later case fainess algorithm should be deactivated.
2361+ In the later case fairness algorithm should be deactivated.
23582362 If not all min_rates are zero then those that are zeroes will be set to 1.
23592363 */
23602364 static void bnx2x_calc_vn_min(struct bnx2x *bp,
@@ -2419,7 +2423,6 @@ static void bnx2x_calc_vn_max(struct bnx2x *bp, int vn, · 58 unmodified lines
24192423 input->vnic_max_rate[vn] = vn_max_rate;
24202424 }
24212425
2422−
24232426 static int bnx2x_get_cmng_fns_mode(struct bnx2x *bp)
24242427 {
24252428 if (CHIP_REV_IS_SLOW(bp))
@@ -2435,7 +2438,7 @@ void bnx2x_read_mf_cfg(struct bnx2x *bp) · 9 unmodified lines
24352438 int vn, n = (CHIP_MODE_IS_4_PORT(bp) ? 2 : 1);
24362439
24372440 if (BP_NOMCP(bp))
2438− return; /* what should be the default bvalue in this case */
2441+ return; /* what should be the default value in this case */
24392442
24402443 /* For 2 port configuration the absolute function number formula
24412444 * is:
@@ -2901,7 +2904,6 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command, u32 param) · 459 unmodified lines
29012904 return rc;
29022905 }
29032906
2904−
29052907 static void storm_memset_func_cfg(struct bnx2x *bp,
29062908 struct tstorm_eth_function_common_config *tcfg,
29072909 u16 abs_fid)
@@ -2935,7 +2937,7 @@ void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p) · 27 unmodified lines
29352937 }
29362938
29372939 /**
2938− * bnx2x_get_tx_only_flags - Return common flags
2940+ * bnx2x_get_common_flags - Return common flags
29392941 *
29402942 * @bp device handle
29412943 * @fp queue handle
@@ -3006,7 +3008,6 @@ static unsigned long bnx2x_get_q_flags(struct bnx2x *bp, · 64 unmodified lines
30063008 if (IS_MF_AFEX(bp))
30073009 __set_bit(BNX2X_Q_FLG_SILENT_VLAN_REM, &flags);
30083010
3009−
30103011 return flags | bnx2x_get_common_flags(bp, fp, true);
30113012 }
30123013
@@ -3082,7 +3083,7 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp, · 69 unmodified lines
30823083 * placed on the BD (not including paddings).
30833084 */
30843085 rxq_init->buf_sz = fp->rx_buf_size - BNX2X_FW_RX_ALIGN_START -
3085− BNX2X_FW_RX_ALIGN_END - IP_HEADER_ALIGNMENT_PADDING;
3086+ BNX2X_FW_RX_ALIGN_END - IP_HEADER_ALIGNMENT_PADDING;
30863087
30873088 rxq_init->cl_qzone_id = fp->cl_qzone_id;
30883089 rxq_init->tpa_agg_sz = tpa_agg_size;
@@ -3124,7 +3125,7 @@ static void bnx2x_pf_tx_q_prep(struct bnx2x *bp, · 35 unmodified lines
31243125 txq_init->fw_sb_id = fp->fw_sb_id;
31253126
31263127 /*
3127− * set the tss leading client id for TX classfication ==
3128+ * set the tss leading client id for TX classification ==
31283129 * leading RSS client id
31293130 */
31303131 txq_init->tss_leading_cl_id = bnx2x_fp(bp, 0, cl_id);
@@ -3196,7 +3197,6 @@ static void bnx2x_pf_init(struct bnx2x *bp) · 65 unmodified lines
31963197 storm_memset_eq_data(bp, &eq_data, BP_FUNC(bp));
31973198 }
31983199
3199−
32003200 static void bnx2x_e1h_disable(struct bnx2x *bp)
32013201 {
32023202 int port = BP_PORT(bp);
@@ -3212,7 +3212,7 @@ static void bnx2x_e1h_enable(struct bnx2x *bp) · 9 unmodified lines
32123212
32133213 REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 1);
32143214
3215− /* Tx queue should be only reenabled */
3215+ /* Tx queue should be only re-enabled */
32163216 netif_tx_wake_all_queues(bp->dev);
32173217
32183218 /*
@@ -3540,10 +3540,8 @@ static bool bnx2x_is_contextless_ramrod(int cmd, int cmd_type) · 321 unmodified lines
35403540 return true;
35413541 else
35423542 return false;
3543−
35443543 }
35453544
3546−
35473545 /**
35483546 * bnx2x_sp_post - place a single command on an SP ring
35493547 *
@@ -3608,14 +3606,13 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, · 58 unmodified lines
36083606 /*
36093607 * It's ok if the actual decrement is issued towards the memory
36103608 * somewhere between the spin_lock and spin_unlock. Thus no
3611− * more explict memory barrier is needed.
3609+ * more explicit memory barrier is needed.
36123610 */
36133611 if (common)
36143612 atomic_dec(&bp->eq_spq_left);
36153613 else
36163614 atomic_dec(&bp->cq_spq_left);
36173615
3618−
36193616 DP(BNX2X_MSG_SP,
36203617 "SPQE[%x] (%x:%x) (cmd, common?) (%d,%d) hw_cid %x data (%x:%x) type(0x%x) left (CQ, EQ) (%x,%x)\n",
36213618 bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping),
@@ -3637,15 +3634,14 @@ static int bnx2x_acquire_alr(struct bnx2x *bp) · 15 unmodified lines
36373634
36383635 might_sleep();
36393636 for (j = 0; j < 1000; j++) {
3640− val = (1UL << 31);
3641− REG_WR(bp, GRCBASE_MCP + 0x9c, val);
3642− val = REG_RD(bp, GRCBASE_MCP + 0x9c);
3643− if (val & (1L << 31))
3637+ REG_WR(bp, MCP_REG_MCPR_ACCESS_LOCK, MCPR_ACCESS_LOCK_LOCK);
3638+ val = REG_RD(bp, MCP_REG_MCPR_ACCESS_LOCK);
3639+ if (val & MCPR_ACCESS_LOCK_LOCK)
36443640 break;
36453641
3646− msleep(5);
3642+ usleep_range(5000, 10000);
36473643 }
3648− if (!(val & (1L << 31))) {
3644+ if (!(val & MCPR_ACCESS_LOCK_LOCK)) {
36493645 BNX2X_ERR("Cannot acquire MCP access lock register\n");
36503646 rc = -EBUSY;
36513647 }
@@ -3656,7 +3652,7 @@ static int bnx2x_acquire_alr(struct bnx2x *bp) · 4 unmodified lines
36563652 /* release split MCP access lock register */
36573653 static void bnx2x_release_alr(struct bnx2x *bp)
36583654 {
3659− REG_WR(bp, GRCBASE_MCP + 0x9c, 0);
3655+ REG_WR(bp, MCP_REG_MCPR_ACCESS_LOCK, 0);
36603656 }
36613657
36623658 #define BNX2X_DEF_SB_ATT_IDX 0x0001
@@ -3678,7 +3674,7 @@ static u16 bnx2x_update_dsb_idx(struct bnx2x *bp) · 15 unmodified lines
36783674 rc |= BNX2X_DEF_SB_IDX;
36793675 }
36803676
3681− /* Do not reorder: indecies reading should complete before handling */
3677+ /* Do not reorder: indices reading should complete before handling */
36823678 barrier();
36833679 return rc;
36843680 }
@@ -3827,8 +3823,7 @@ static void bnx2x_fan_failure(struct bnx2x *bp) · 142 unmodified lines
38273823 netdev_err(bp->dev, "Fan Failure on Network Controller has caused the driver to shutdown the card to prevent permanent damage.\n"
38283824 "Please contact OEM Support for assistance\n");
38293825
3830− /*
3831− * Schedule device reset (unload)
3826+ /* Schedule device reset (unload)
38323827 * This is due to some boards consuming sufficient power when driver is
38333828 * up to overheat if fan fails.
38343829 */
@@ -3836,7 +3831,6 @@ static void bnx2x_fan_failure(struct bnx2x *bp) · 1 unmodified line
38363831 set_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state);
38373832 smp_mb__after_clear_bit();
38383833 schedule_delayed_work(&bp->sp_rtnl_task, 0);
3839−
38403834 }
38413835
38423836 static void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
@@ -4106,7 +4100,7 @@ static void bnx2x_clear_reset_global(struct bnx2x *bp) · 263 unmodified lines
41064100 */
41074101 static bool bnx2x_reset_is_global(struct bnx2x *bp)
41084102 {
4109− u32 val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
4103+ u32 val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
41104104
41114105 DP(NETIF_MSG_HW, "GEN_REG_VAL=0x%08x\n", val);
41124106 return (val & BNX2X_GLOBAL_RESET_BIT) ? true : false;
@@ -4157,7 +4151,7 @@ void bnx2x_set_reset_in_progress(struct bnx2x *bp) · 44 unmodified lines
41574151 */
41584152 bool bnx2x_reset_is_done(struct bnx2x *bp, int engine)
41594153 {
4160− u32 val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
4154+ u32 val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
41614155 u32 bit = engine ?
41624156 BNX2X_PATH1_RST_IN_PROG_BIT : BNX2X_PATH0_RST_IN_PROG_BIT;
41634157
@@ -4260,13 +4254,18 @@ static bool bnx2x_get_load_status(struct bnx2x *bp, int engine) · 96 unmodified lines
42604254 return val != 0;
42614255 }
42624256
4257+static void _print_parity(struct bnx2x *bp, u32 reg)
4258+{
4259+ pr_cont(" [0x%08x] ", REG_RD(bp, reg));
4260+}
4261+
42634262 static void _print_next_block(int idx, const char *blk)
42644263 {
42654264 pr_cont("%s%s", idx ? ", " : "", blk);
42664265 }
42674266
4268−static int bnx2x_check_blocks_with_parity0(u32 sig, int par_num,
4269− bool print)
4267+static int bnx2x_check_blocks_with_parity0(struct bnx2x *bp, u32 sig,
4268+ int par_num, bool print)
42704269 {
42714270 int i = 0;
42724271 u32 cur_bit = 0;
@@ -4275,33 +4274,54 @@ static int bnx2x_check_blocks_with_parity0(u32 sig, int par_num, · 2 unmodified lines
42754274 if (sig & cur_bit) {
42764275 switch (cur_bit) {
42774276 case AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR:
4278− if (print)
4277+ if (print) {
42794278 _print_next_block(par_num++, "BRB");
4279+ _print_parity(bp,
4280+ BRB1_REG_BRB1_PRTY_STS);
4281+ }
42804282 break;
42814283 case AEU_INPUTS_ATTN_BITS_PARSER_PARITY_ERROR:
4282− if (print)
4284+ if (print) {
42834285 _print_next_block(par_num++, "PARSER");
4286+ _print_parity(bp, PRS_REG_PRS_PRTY_STS);
4287+ }
42844288 break;
42854289 case AEU_INPUTS_ATTN_BITS_TSDM_PARITY_ERROR:
4286− if (print)
4290+ if (print) {
42874291 _print_next_block(par_num++, "TSDM");
4292+ _print_parity(bp,
4293+ TSDM_REG_TSDM_PRTY_STS);
4294+ }
42884295 break;
42894296 case AEU_INPUTS_ATTN_BITS_SEARCHER_PARITY_ERROR:
4290− if (print)
4297+ if (print) {
42914298 _print_next_block(par_num++,
42924299 "SEARCHER");
4300+ _print_parity(bp, SRC_REG_SRC_PRTY_STS);
4301+ }
42934302 break;
42944303 case AEU_INPUTS_ATTN_BITS_TCM_PARITY_ERROR:
4295− if (print)
4304+ if (print) {
42964305 _print_next_block(par_num++, "TCM");
4306+ _print_parity(bp,
4307+ TCM_REG_TCM_PRTY_STS);
4308+ }
42974309 break;
42984310 case AEU_INPUTS_ATTN_BITS_TSEMI_PARITY_ERROR:
4299− if (print)
4311+ if (print) {
43004312 _print_next_block(par_num++, "TSEMI");
4313+ _print_parity(bp,
4314+ TSEM_REG_TSEM_PRTY_STS_0);
4315+ _print_parity(bp,
4316+ TSEM_REG_TSEM_PRTY_STS_1);
4317+ }
43014318 break;
43024319 case AEU_INPUTS_ATTN_BITS_PBCLIENT_PARITY_ERROR:
4303− if (print)
4320+ if (print) {
43044321 _print_next_block(par_num++, "XPB");
4322+ _print_parity(bp, GRCBASE_XPB +
4323+ PB_REG_PB_PRTY_STS);
4324+ }
43054325 break;
43064326 }
43074327
@@ -4313,8 +4333,9 @@ static int bnx2x_check_blocks_with_parity0(u32 sig, int par_num, · 5 unmodified lines
43134333 return par_num;
43144334 }
43154335
4316−static int bnx2x_check_blocks_with_parity1(u32 sig, int par_num,
4317− bool *global, bool print)
4336+static int bnx2x_check_blocks_with_parity1(struct bnx2x *bp, u32 sig,
4337+ int par_num, bool *global,
4338+ bool print)
43184339 {
43194340 int i = 0;
43204341 u32 cur_bit = 0;
@@ -4323,37 +4344,66 @@ static int bnx2x_check_blocks_with_parity1(u32 sig, int par_num, · 2 unmodified lines
43234344 if (sig & cur_bit) {
43244345 switch (cur_bit) {
43254346 case AEU_INPUTS_ATTN_BITS_PBF_PARITY_ERROR:
4326− if (print)
4347+ if (print) {
43274348 _print_next_block(par_num++, "PBF");
4349+ _print_parity(bp, PBF_REG_PBF_PRTY_STS);
4350+ }
43284351 break;
43294352 case AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR:
4330− if (print)
4353+ if (print) {
43314354 _print_next_block(par_num++, "QM");
4355+ _print_parity(bp, QM_REG_QM_PRTY_STS);
4356+ }
43324357 break;
43334358 case AEU_INPUTS_ATTN_BITS_TIMERS_PARITY_ERROR:
4334− if (print)
4359+ if (print) {
43354360 _print_next_block(par_num++, "TM");
4361+ _print_parity(bp, TM_REG_TM_PRTY_STS);
4362+ }
43364363 break;
43374364 case AEU_INPUTS_ATTN_BITS_XSDM_PARITY_ERROR:
4338− if (print)
4365+ if (print) {
43394366 _print_next_block(par_num++, "XSDM");
4367+ _print_parity(bp,
4368+ XSDM_REG_XSDM_PRTY_STS);
4369+ }
43404370 break;
43414371 case AEU_INPUTS_ATTN_BITS_XCM_PARITY_ERROR:
4342− if (print)
4372+ if (print) {
43434373 _print_next_block(par_num++, "XCM");
4374+ _print_parity(bp, XCM_REG_XCM_PRTY_STS);
4375+ }
43444376 break;
43454377 case AEU_INPUTS_ATTN_BITS_XSEMI_PARITY_ERROR:
4346− if (print)
4378+ if (print) {
43474379 _print_next_block(par_num++, "XSEMI");
4380+ _print_parity(bp,
4381+ XSEM_REG_XSEM_PRTY_STS_0);
4382+ _print_parity(bp,
4383+ XSEM_REG_XSEM_PRTY_STS_1);
4384+ }
43484385 break;
43494386 case AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR:
4350− if (print)
4387+ if (print) {
43514388 _print_next_block(par_num++,
43524389 "DOORBELLQ");
4390+ _print_parity(bp,
4391+ DORQ_REG_DORQ_PRTY_STS);
4392+ }
43534393 break;
43544394 case AEU_INPUTS_ATTN_BITS_NIG_PARITY_ERROR:
4355− if (print)
4395+ if (print) {
43564396 _print_next_block(par_num++, "NIG");
4397+ if (CHIP_IS_E1x(bp)) {
4398+ _print_parity(bp,
4399+ NIG_REG_NIG_PRTY_STS);
4400+ } else {
4401+ _print_parity(bp,
4402+ NIG_REG_NIG_PRTY_STS_0);
4403+ _print_parity(bp,
4404+ NIG_REG_NIG_PRTY_STS_1);
4405+ }
4406+ }
43574407 break;
43584408 case AEU_INPUTS_ATTN_BITS_VAUX_PCI_CORE_PARITY_ERROR:
43594409 if (print)
@@ -4362,32 +4412,52 @@ static int bnx2x_check_blocks_with_parity1(u32 sig, int par_num, · 2 unmodified lines
43624412 *global = true;
43634413 break;
43644414 case AEU_INPUTS_ATTN_BITS_DEBUG_PARITY_ERROR:
4365− if (print)
4415+ if (print) {
43664416 _print_next_block(par_num++, "DEBUG");
4417+ _print_parity(bp, DBG_REG_DBG_PRTY_STS);
4418+ }
43674419 break;
43684420 case AEU_INPUTS_ATTN_BITS_USDM_PARITY_ERROR:
4369− if (print)
4421+ if (print) {
43704422 _print_next_block(par_num++, "USDM");
4423+ _print_parity(bp,
4424+ USDM_REG_USDM_PRTY_STS);
4425+ }
43714426 break;
43724427 case AEU_INPUTS_ATTN_BITS_UCM_PARITY_ERROR:
4373− if (print)
4428+ if (print) {
43744429 _print_next_block(par_num++, "UCM");
4430+ _print_parity(bp, UCM_REG_UCM_PRTY_STS);
4431+ }
43754432 break;
43764433 case AEU_INPUTS_ATTN_BITS_USEMI_PARITY_ERROR:
4377− if (print)
4434+ if (print) {
43784435 _print_next_block(par_num++, "USEMI");
4436+ _print_parity(bp,
4437+ USEM_REG_USEM_PRTY_STS_0);
4438+ _print_parity(bp,
4439+ USEM_REG_USEM_PRTY_STS_1);
4440+ }
43794441 break;
43804442 case AEU_INPUTS_ATTN_BITS_UPB_PARITY_ERROR:
4381− if (print)
4443+ if (print) {
43824444 _print_next_block(par_num++, "UPB");
4445+ _print_parity(bp, GRCBASE_UPB +
4446+ PB_REG_PB_PRTY_STS);
4447+ }
43834448 break;
43844449 case AEU_INPUTS_ATTN_BITS_CSDM_PARITY_ERROR:
4385− if (print)
4450+ if (print) {
43864451 _print_next_block(par_num++, "CSDM");
4452+ _print_parity(bp,
4453+ CSDM_REG_CSDM_PRTY_STS);
4454+ }
43874455 break;
43884456 case AEU_INPUTS_ATTN_BITS_CCM_PARITY_ERROR:
4389− if (print)
4457+ if (print) {
43904458 _print_next_block(par_num++, "CCM");
4459+ _print_parity(bp, CCM_REG_CCM_PRTY_STS);
4460+ }
43914461 break;
43924462 }
43934463
@@ -4399,8 +4469,8 @@ static int bnx2x_check_blocks_with_parity1(u32 sig, int par_num, · 5 unmodified lines
43994469 return par_num;
44004470 }
44014471
4402−static int bnx2x_check_blocks_with_parity2(u32 sig, int par_num,
4403− bool print)
4472+static int bnx2x_check_blocks_with_parity2(struct bnx2x *bp, u32 sig,
4473+ int par_num, bool print)
44044474 {
44054475 int i = 0;
44064476 u32 cur_bit = 0;
@@ -4409,12 +4479,23 @@ static int bnx2x_check_blocks_with_parity2(u32 sig, int par_num, · 2 unmodified lines
44094479 if (sig & cur_bit) {
44104480 switch (cur_bit) {
44114481 case AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR:
4412− if (print)
4482+ if (print) {
44134483 _print_next_block(par_num++, "CSEMI");
4484+ _print_parity(bp,
4485+ CSEM_REG_CSEM_PRTY_STS_0);
4486+ _print_parity(bp,
4487+ CSEM_REG_CSEM_PRTY_STS_1);
4488+ }
44144489 break;
44154490 case AEU_INPUTS_ATTN_BITS_PXP_PARITY_ERROR:
4416− if (print)
4491+ if (print) {
44174492 _print_next_block(par_num++, "PXP");
4493+ _print_parity(bp, PXP_REG_PXP_PRTY_STS);
4494+ _print_parity(bp,
4495+ PXP2_REG_PXP2_PRTY_STS_0);
4496+ _print_parity(bp,
4497+ PXP2_REG_PXP2_PRTY_STS_1);
4498+ }
44184499 break;
44194500 case AEU_IN_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR:
44204501 if (print)
@@ -4422,24 +4503,42 @@ static int bnx2x_check_blocks_with_parity2(u32 sig, int par_num, · 1 unmodified line
44224503 "PXPPCICLOCKCLIENT");
44234504 break;
44244505 case AEU_INPUTS_ATTN_BITS_CFC_PARITY_ERROR:
4425− if (print)
4506+ if (print) {
44264507 _print_next_block(par_num++, "CFC");
4508+ _print_parity(bp,
4509+ CFC_REG_CFC_PRTY_STS);
4510+ }
44274511 break;
44284512 case AEU_INPUTS_ATTN_BITS_CDU_PARITY_ERROR:
4429− if (print)
4513+ if (print) {
44304514 _print_next_block(par_num++, "CDU");
4515+ _print_parity(bp, CDU_REG_CDU_PRTY_STS);
4516+ }
44314517 break;
44324518 case AEU_INPUTS_ATTN_BITS_DMAE_PARITY_ERROR:
4433− if (print)
4519+ if (print) {
44344520 _print_next_block(par_num++, "DMAE");
4521+ _print_parity(bp,
4522+ DMAE_REG_DMAE_PRTY_STS);
4523+ }
44354524 break;
44364525 case AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR:
4437− if (print)
4526+ if (print) {
44384527 _print_next_block(par_num++, "IGU");
4528+ if (CHIP_IS_E1x(bp))
4529+ _print_parity(bp,
4530+ HC_REG_HC_PRTY_STS);
4531+ else
4532+ _print_parity(bp,
4533+ IGU_REG_IGU_PRTY_STS);
4534+ }
44394535 break;
44404536 case AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR:
4441− if (print)
4537+ if (print) {
44424538 _print_next_block(par_num++, "MISC");
4539+ _print_parity(bp,
4540+ MISC_REG_MISC_PRTY_STS);
4541+ }
44434542 break;
44444543 }
44454544
@@ -4493,8 +4592,8 @@ static int bnx2x_check_blocks_with_parity3(u32 sig, int par_num, · 47 unmodified lines
44934592 return par_num;
44944593 }
44954594
4496−static int bnx2x_check_blocks_with_parity4(u32 sig, int par_num,
4497− bool print)
4595+static int bnx2x_check_blocks_with_parity4(struct bnx2x *bp, u32 sig,
4596+ int par_num, bool print)
44984597 {
44994598 int i = 0;
45004599 u32 cur_bit = 0;
@@ -4503,12 +4602,18 @@ static int bnx2x_check_blocks_with_parity4(u32 sig, int par_num, · 2 unmodified lines
45034602 if (sig & cur_bit) {
45044603 switch (cur_bit) {
45054604 case AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR:
4506− if (print)
4605+ if (print) {
45074606 _print_next_block(par_num++, "PGLUE_B");
4607+ _print_parity(bp,
4608+ PGLUE_B_REG_PGLUE_B_PRTY_STS);
4609+ }
45084610 break;
45094611 case AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR:
4510− if (print)
4612+ if (print) {
45114613 _print_next_block(par_num++, "ATC");
4614+ _print_parity(bp,
4615+ ATC_REG_ATC_PRTY_STS);
4616+ }
45124617 break;
45134618 }
45144619
@@ -4539,15 +4644,15 @@ static bool bnx2x_parity_attn(struct bnx2x *bp, bool *global, bool print, · 24 unmodified lines
45394644 if (print)
45404645 netdev_err(bp->dev,
45414646 "Parity errors detected in blocks: ");
4542− par_num = bnx2x_check_blocks_with_parity0(
4647+ par_num = bnx2x_check_blocks_with_parity0(bp,
45434648 sig[0] & HW_PRTY_ASSERT_SET_0, par_num, print);
4544− par_num = bnx2x_check_blocks_with_parity1(
4649+ par_num = bnx2x_check_blocks_with_parity1(bp,
45454650 sig[1] & HW_PRTY_ASSERT_SET_1, par_num, global, print);
4546− par_num = bnx2x_check_blocks_with_parity2(
4651+ par_num = bnx2x_check_blocks_with_parity2(bp,
45474652 sig[2] & HW_PRTY_ASSERT_SET_2, par_num, print);
45484653 par_num = bnx2x_check_blocks_with_parity3(
45494654 sig[3] & HW_PRTY_ASSERT_SET_3, par_num, global, print);
4550− par_num = bnx2x_check_blocks_with_parity4(
4655+ par_num = bnx2x_check_blocks_with_parity4(bp,
45514656 sig[4] & HW_PRTY_ASSERT_SET_4, par_num, print);
45524657
45534658 if (print)
@@ -4591,7 +4696,6 @@ bool bnx2x_chk_parity_attn(struct bnx2x *bp, bool *global, bool print) · 37 unmodified lines
45914696 return bnx2x_parity_attn(bp, global, print, attn.sig);
45924697 }
45934698
4594−
45954699 static void bnx2x_attn_int_deasserted4(struct bnx2x *bp, u32 attn)
45964700 {
45974701 u32 val;
@@ -4643,7 +4747,6 @@ static void bnx2x_attn_int_deasserted4(struct bnx2x *bp, u32 attn) · 45 unmodified lines
46434747 (u32)(attn & (AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR |
46444748 AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR)));
46454749 }
4646−
46474750 }
46484751
46494752 static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
@@ -4878,7 +4981,6 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp, · 228 unmodified lines
48784981 BNX2X_ERR("Failed to schedule new commands: %d\n", rc);
48794982 else if (rc > 0)
48804983 DP(BNX2X_MSG_SP, "Scheduled next pending commands...\n");
4881−
48824984 }
48834985
48844986 static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp, bool start);
@@ -5009,7 +5111,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) · 124 unmodified lines
50095111 hw_cons = le16_to_cpu(*bp->eq_cons_sb);
50105112
50115113 /* The hw_cos range is 1-255, 257 - the sw_cons range is 0-254, 256.
5012− * when we get the the next-page we nned to adjust so the loop
5114+ * when we get the next-page we need to adjust so the loop
50135115 * condition below will be met. The next element is the size of a
50145116 * regular element and hence incrementing by 1
50155117 */
@@ -5075,8 +5177,6 @@ static void bnx2x_eq_int(struct bnx2x *bp) · 59 unmodified lines
50755177 if (q_obj->complete_cmd(bp, q_obj, BNX2X_Q_CMD_CFC_DEL))
50765178 break;
50775179
5078−
5079−
50805180 goto next_spqe;
50815181
50825182 case EVENT_RING_OPCODE_STOP_TRAFFIC:
@@ -5218,7 +5318,7 @@ static void bnx2x_sp_task(struct work_struct *work) · 135 unmodified lines
52185318
52195319 DP(BNX2X_MSG_SP, "sp task invoked\n");
52205320
5221− /* make sure the atomic interupt_occurred has been written */
5321+ /* make sure the atomic interrupt_occurred has been written */
52225322 smp_rmb();
52235323 if (atomic_read(&bp->interrupt_occurred)) {
52245324
@@ -5265,7 +5365,6 @@ static void bnx2x_sp_task(struct work_struct *work) · 40 unmodified lines
52655365 /* ack status block only if something was actually handled */
52665366 bnx2x_ack_sb(bp, bp->igu_dsb_id, ATTENTION_ID,
52675367 le16_to_cpu(bp->def_att_idx), IGU_INT_ENABLE, 1);
5268−
52695368 }
52705369
52715370 /* must be called after the EQ processing (since eq leads to sriov
@@ -5316,7 +5415,6 @@ irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) · 44 unmodified lines
53165415
53175416 /* end of slow path */
53185417
5319−
53205418 void bnx2x_drv_pulse(struct bnx2x *bp)
53215419 {
53225420 SHMEM_WR(bp, func_mb[BP_FW_MB_IDX(bp)].drv_pulse_mb,
@@ -5360,7 +5458,7 @@ static void bnx2x_timer(unsigned long data) · 37 unmodified lines
53605458
53615459 /* sample pf vf bulletin board for new posts from pf */
53625460 if (IS_VF(bp))
5363− bnx2x_sample_bulletin(bp);
5461+ bnx2x_timer_sriov(bp);
53645462
53655463 mod_timer(&bp->timer, jiffies + bp->current_interval);
53665464 }
@@ -5382,7 +5480,6 @@ static void bnx2x_fill(struct bnx2x *bp, u32 addr, int fill, u32 len) · 15 unmodified lines
53825480 else
53835481 for (i = 0; i < len; i++)
53845482 REG_WR8(bp, addr + i, fill);
5385−
53865483 }
53875484
53885485 /* helper: writes FP SP data to FW - data_size in dwords */
@@ -5461,10 +5558,8 @@ static void bnx2x_zero_sp_sb(struct bnx2x *bp) · 72 unmodified lines
54615558 bnx2x_fill(bp, BAR_CSTRORM_INTMEM +
54625559 CSTORM_SP_SYNC_BLOCK_OFFSET(func), 0,
54635560 CSTORM_SP_SYNC_BLOCK_SIZE);
5464−
54655561 }
54665562
5467−
54685563 static void bnx2x_setup_ndsb_state_machine(struct hc_status_block_sm *hc_sm,
54695564 int igu_sb_id, int igu_seg_id)
54705565 {
@@ -5474,7 +5569,6 @@ static void bnx2x_setup_ndsb_state_machine(struct hc_status_block_sm *hc_sm, · 3 unmodified lines
54745569 hc_sm->time_to_expire = 0xFFFFFFFF;
54755570 }
54765571
5477−
54785572 /* allocates state machine ids. */
54795573 static void bnx2x_map_sb_state_machines(struct hc_index_data *index_data)
54805574 {
@@ -5700,7 +5794,7 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp) · 219 unmodified lines
57005794 bp->eq_cons = 0;
57015795 bp->eq_prod = NUM_EQ_DESC;
57025796 bp->eq_cons_sb = BNX2X_EQ_INDEX;
5703− /* we want a warning message before it gets rought... */
5797+ /* we want a warning message before it gets wrought... */
57045798 atomic_set(&bp->eq_spq_left,
57055799 min_t(int, MAX_SP_DESC_CNT - MAX_SPQ_PENDING, NUM_EQ_DESC) - 1);
57065800 }
@@ -5784,7 +5878,7 @@ static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode, · 77 unmodified lines
57845878
57855879 break;
57865880 case BNX2X_RX_MODE_PROMISC:
5787− /* According to deffinition of SI mode, iface in promisc mode
5881+ /* According to definition of SI mode, iface in promisc mode
57885882 * should receive matched and unmatched (in resolution of port)
57895883 * unicast packets.
57905884 */
@@ -5927,7 +6021,7 @@ static void bnx2x_init_eth_fp(struct bnx2x *bp, int fp_idx) · 136 unmodified lines
59276021 /* init shortcut */
59286022 fp->ustorm_rx_prods_offset = bnx2x_rx_ustorm_prods_offset(fp);
59296023
5930− /* Setup SB indicies */
6024+ /* Setup SB indices */
59316025 fp->rx_cons_sb = BNX2X_RX_SB_INDEX;
59326026
59336027 /* Configure Queue State object */
@@ -5983,6 +6077,8 @@ static void bnx2x_init_tx_ring_one(struct bnx2x_fp_txdata *txdata) · 49 unmodified lines
59836077 BCM_PAGE_SIZE*(i % NUM_TX_RINGS)));
59846078 }
59856079
6080+ *txdata->tx_cons_sb = cpu_to_le16(0);
6081+
59866082 SET_FLAG(txdata->tx_db.data.header.header, DOORBELL_HDR_DB_TYPE, 1);
59876083 txdata->tx_db.data.zero_fill1 = 0;
59886084 txdata->tx_db.data.prod = 0;
@@ -6001,6 +6097,7 @@ static void bnx2x_init_tx_rings_cnic(struct bnx2x *bp) · 12 unmodified lines
60016097 for_each_tx_queue_cnic(bp, i)
60026098 bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[0]);
60036099 }
6100+
60046101 static void bnx2x_init_tx_rings(struct bnx2x *bp)
60056102 {
60066103 int i;
@@ -6043,11 +6140,6 @@ void bnx2x_pre_irq_nic_init(struct bnx2x *bp) · 36 unmodified lines
60436140 bnx2x_init_rx_rings(bp);
60446141 bnx2x_init_tx_rings(bp);
60456142
6046− if (IS_VF(bp)) {
6047− bnx2x_memset_stats(bp);
6048− return;
6049− }
6050−
60516143 if (IS_PF(bp)) {
60526144 /* Initialize MOD_ABS interrupts */
60536145 bnx2x_init_mod_abs_int(bp, &bp->link_vars, bp->common.chip_id,
@@ -6058,6 +6150,8 @@ void bnx2x_pre_irq_nic_init(struct bnx2x *bp) · 4 unmodified lines
60586150 bnx2x_init_def_sb(bp);
60596151 bnx2x_update_dsb_idx(bp);
60606152 bnx2x_init_sp_ring(bp);
6153+ } else {
6154+ bnx2x_memset_stats(bp);
60616155 }
60626156 }
60636157
@@ -6236,7 +6330,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) · 172 unmodified lines
62366330 if (val == 0x10)
62376331 break;
62386332
6239− msleep(10);
6333+ usleep_range(10000, 20000);
62406334 count--;
62416335 }
62426336 if (val != 0x10) {
@@ -6251,7 +6345,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) · 8 unmodified lines
62516345 if (val == 1)
62526346 break;
62536347
6254− msleep(10);
6348+ usleep_range(10000, 20000);
62556349 count--;
62566350 }
62576351 if (val != 0x1) {
@@ -6292,7 +6386,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) · 34 unmodified lines
62926386 if (val == 0xb0)
62936387 break;
62946388
6295− msleep(10);
6389+ usleep_range(10000, 20000);
62966390 count--;
62976391 }
62986392 if (val != 0xb0) {
@@ -6681,7 +6775,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) · 382 unmodified lines
66816775 * stay set)
66826776 * f. If this is VNIC 3 of a port then also init
66836777 * first_timers_ilt_entry to zero and last_timers_ilt_entry
6684− * to the last enrty in the ILT.
6778+ * to the last entry in the ILT.
66856779 *
66866780 * Notes:
66876781 * Currently the PF error in the PGLC is non recoverable.
@@ -6772,7 +6866,6 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) · 84 unmodified lines
67726866
67736867 bnx2x_init_block(bp, BLOCK_QM, PHASE_COMMON);
67746868
6775−
67766869 /* QM queues pointers table */
67776870 bnx2x_qm_init_ptr_table(bp, bp->qm_cid_count, INITOP_SET);
67786871
@@ -7013,7 +7106,6 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 234 unmodified lines
70137106 u32 low, high;
70147107 u32 val;
70157108
7016−
70177109 DP(NETIF_MSG_HW, "starting port init port %d\n", port);
70187110
70197111 REG_WR(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 0);
@@ -7078,7 +7170,6 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 58 unmodified lines
70787170 BRB1_REG_MAC_GUARANTIED_1 :
70797171 BRB1_REG_MAC_GUARANTIED_0), 40);
70807172
7081−
70827173 bnx2x_init_block(bp, BLOCK_PRS, init_phase);
70837174 if (CHIP_IS_E3B0(bp)) {
70847175 if (IS_MF_AFEX(bp)) {
@@ -7150,8 +7241,8 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 65 unmodified lines
71507241
71517242 bnx2x_init_block(bp, BLOCK_MISC_AEU, init_phase);
71527243 /* init aeu_mask_attn_func_0/1:
7153− * - SF mode: bits 3-7 are masked. only bits 0-2 are in use
7154− * - MF mode: bit 3 is masked. bits 0-2 are in use as in SF
7244+ * - SF mode: bits 3-7 are masked. Only bits 0-2 are in use
7245+ * - MF mode: bit 3 is masked. Bits 0-2 are in use as in SF
71557246 * bits 4-7 are used for "per vn group attention" */
71567247 val = IS_MF(bp) ? 0xF7 : 0x7;
71577248 /* Enable DCBX attention for all but E1 */
@@ -7275,7 +7366,6 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, bool is_pf) · 117 unmodified lines
72757366 while (!(REG_RD(bp, igu_addr_ack) & sb_bit) && --cnt)
72767367 msleep(20);
72777368
7278−
72797369 if (!(REG_RD(bp, igu_addr_ack) & sb_bit)) {
72807370 DP(NETIF_MSG_HW,
72817371 "Unable to finish IGU cleanup: idu_sb_id %d offset %d bit %d (cnt %d)\n",
@@ -7295,7 +7385,6 @@ static void bnx2x_clear_func_ilt(struct bnx2x *bp, u32 func) · 13 unmodified lines
72957385 bnx2x_ilt_wr(bp, i, 0);
72967386 }
72977387
7298−
72997388 static void bnx2x_init_searcher(struct bnx2x *bp)
73007389 {
73017390 int port = BP_PORT(bp);
@@ -7331,7 +7420,6 @@ static int bnx2x_reset_nic_mode(struct bnx2x *bp) · 29 unmodified lines
73317420 int rc, i, port = BP_PORT(bp);
73327421 int vlan_en = 0, mac_en[NUM_MACS];
73337422
7334−
73357423 /* Close input from network */
73367424 if (bp->mf_mode == SINGLE_FUNCTION) {
73377425 bnx2x_set_rx_filter(&bp->link_params, 0);
@@ -7406,7 +7494,7 @@ int bnx2x_init_hw_func_cnic(struct bnx2x *bp) · 68 unmodified lines
74067494 bnx2x_ilt_init_op_cnic(bp, INITOP_SET);
74077495
74087496 if (CONFIGURE_NIC_MODE(bp)) {
7409− /* Configrue searcher as part of function hw init */
7497+ /* Configure searcher as part of function hw init */
74107498 bnx2x_init_searcher(bp);
74117499
74127500 /* Reset NIC mode */
@@ -7479,8 +7567,7 @@ static int bnx2x_init_hw_func(struct bnx2x *bp) · 66 unmodified lines
74797567 } else {
74807568 /* Set NIC mode */
74817569 REG_WR(bp, PRS_REG_NIC_MODE, 1);
7482− DP(NETIF_MSG_IFUP, "NIC MODE configrued\n");
7483−
7570+ DP(NETIF_MSG_IFUP, "NIC MODE configured\n");
74847571 }
74857572
74867573 if (!CHIP_IS_E1x(bp)) {
@@ -7677,7 +7764,7 @@ static int bnx2x_init_hw_func(struct bnx2x *bp) · 190 unmodified lines
76777764 }
76787765 bnx2x_igu_clear_sb(bp, bp->igu_dsb_id);
76797766
7680− /* !!! these should become driver const once
7767+ /* !!! These should become driver const once
76817768 rf-tool supports split-68 const */
76827769 REG_WR(bp, IGU_REG_SB_INT_BEFORE_MASK_LSB, 0);
76837770 REG_WR(bp, IGU_REG_SB_INT_BEFORE_MASK_MSB, 0);
@@ -7734,7 +7821,6 @@ static int bnx2x_init_hw_func(struct bnx2x *bp) · 50 unmodified lines
77347821 return 0;
77357822 }
77367823
7737−
77387824 void bnx2x_free_mem_cnic(struct bnx2x *bp)
77397825 {
77407826 bnx2x_ilt_mem_op_cnic(bp, ILT_MEMOP_FREE);
@@ -7779,7 +7865,6 @@ void bnx2x_free_mem(struct bnx2x *bp) · 38 unmodified lines
77797865 bnx2x_iov_free_mem(bp);
77807866 }
77817867
7782−
77837868 int bnx2x_alloc_mem_cnic(struct bnx2x *bp)
77847869 {
77857870 if (!CHIP_IS_E1x(bp))
@@ -7793,7 +7878,7 @@ int bnx2x_alloc_mem_cnic(struct bnx2x *bp) · 7 unmodified lines
77937878 host_hc_status_block_e1x));
77947879
77957880 if (CONFIGURE_NIC_MODE(bp) && !bp->t2)
7796− /* allocate searcher T2 table, as it wan't allocated before */
7881+ /* allocate searcher T2 table, as it wasn't allocated before */
77977882 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ);
77987883
77997884 /* write address to which L5 should insert its values */
@@ -8068,7 +8153,6 @@ void bnx2x_ilt_set_info(struct bnx2x *bp) · 268 unmodified lines
80688153 ilt_client->page_size,
80698154 ilt_client->flags,
80708155 ilog2(ilt_client->page_size >> 12));
8071−
80728156 }
80738157
80748158 if (CNIC_SUPPORT(bp)) {
@@ -8124,7 +8208,6 @@ void bnx2x_ilt_set_info(struct bnx2x *bp) · 49 unmodified lines
81248208 static void bnx2x_pf_q_prep_init(struct bnx2x *bp,
81258209 struct bnx2x_fastpath *fp, struct bnx2x_queue_init_params *init_params)
81268210 {
8127−
81288211 u8 cos;
81298212 int cxt_index, cxt_offset;
81308213
@@ -8133,7 +8216,7 @@ static void bnx2x_pf_q_prep_init(struct bnx2x *bp, · 2 unmodified lines
81338216 __set_bit(BNX2X_Q_FLG_HC, &init_params->rx.flags);
81348217 __set_bit(BNX2X_Q_FLG_HC, &init_params->tx.flags);
81358218
8136− /* If HC is supporterd, enable host coalescing in the transition
8219+ /* If HC is supported, enable host coalescing in the transition
81378220 * to INIT state.
81388221 */
81398222 __set_bit(BNX2X_Q_FLG_HC_EN, &init_params->rx.flags);
@@ -8205,7 +8288,6 @@ static int bnx2x_setup_tx_only(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 65 unmodified lines
82058288 return bnx2x_queue_state_change(bp, q_params);
82068289 }
82078290
8208−
82098291 /**
82108292 * bnx2x_setup_queue - setup queue
82118293 *
@@ -8254,7 +8336,6 @@ int bnx2x_setup_queue(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 42 unmodified lines
82548336
82558337 DP(NETIF_MSG_IFUP, "init complete\n");
82568338
8257−
82588339 /* Now move the Queue to the SETUP state... */
82598340 memset(setup_params, 0, sizeof(*setup_params));
82608341
@@ -8315,7 +8396,6 @@ static int bnx2x_stop_queue(struct bnx2x *bp, int index) · 54 unmodified lines
83158396 /* We want to wait for completion in this context */
83168397 __set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags);
83178398
8318−
83198399 /* close tx-only connections */
83208400 for (tx_index = FIRST_TX_ONLY_COS_INDEX;
83218401 tx_index < fp->max_cos;
@@ -8369,7 +8449,6 @@ static int bnx2x_stop_queue(struct bnx2x *bp, int index) · 47 unmodified lines
83698449 return bnx2x_queue_state_change(bp, &q_params);
83708450 }
83718451
8372−
83738452 static void bnx2x_reset_func(struct bnx2x *bp)
83748453 {
83758454 int port = BP_PORT(bp);
@@ -8422,7 +8501,7 @@ static void bnx2x_reset_func(struct bnx2x *bp) · 46 unmodified lines
84228501 * scan to complete
84238502 */
84248503 for (i = 0; i < 200; i++) {
8425− msleep(10);
8504+ usleep_range(10000, 20000);
84268505 if (!REG_RD(bp, TM_REG_LIN0_SCAN_ON + port*4))
84278506 break;
84288507 }
@@ -8623,14 +8702,14 @@ static int bnx2x_func_wait_started(struct bnx2x *bp) · 194 unmodified lines
86238702
86248703 /*
86258704 * (assumption: No Attention from MCP at this stage)
8626− * PMF probably in the middle of TXdisable/enable transaction
8705+ * PMF probably in the middle of TX disable/enable transaction
86278706 * 1. Sync IRS for default SB
8628− * 2. Sync SP queue - this guarantes us that attention handling started
8629− * 3. Wait, that TXdisable/enable transaction completes
8707+ * 2. Sync SP queue - this guarantees us that attention handling started
8708+ * 3. Wait, that TX disable/enable transaction completes
86308709 *
8631− * 1+2 guranty that if DCBx attention was scheduled it already changed
8632− * pending bit of transaction from STARTED-->TX_STOPPED, if we alredy
8633− * received complettion for the transaction the state is TX_STOPPED.
8710+ * 1+2 guarantee that if DCBx attention was scheduled it already changed
8711+ * pending bit of transaction from STARTED-->TX_STOPPED, if we already
8712+ * received completion for the transaction the state is TX_STOPPED.
86348713 * State will return to STARTED after completion of TX_STOPPED-->STARTED
86358714 * transaction.
86368715 */
@@ -8660,7 +8739,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp) · 23 unmodified lines
86608739 struct bnx2x_func_state_params func_params = {NULL};
86618740
86628741 DP(NETIF_MSG_IFDOWN,
8663− "Hmmm... unexpected function state! Forcing STARTED-->TX_ST0PPED-->STARTED\n");
8742+ "Hmmm... Unexpected function state! Forcing STARTED-->TX_ST0PPED-->STARTED\n");
86648743
86658744 func_params.f_obj = &bp->func_obj;
86668745 __set_bit(RAMROD_DRV_CLR_ONLY,
@@ -8740,7 +8819,6 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link) · 73 unmodified lines
87408819
87418820 bnx2x_iov_chip_cleanup(bp);
87428821
8743−
87448822 /*
87458823 * Send the UNLOAD_REQUEST to the MCP. This will return if
87468824 * this function should perform FUNC, PORT or COMMON HW
@@ -8750,7 +8828,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link) · 3 unmodified lines
87508828
87518829 /*
87528830 * (assumption: No Attention from MCP at this stage)
8753− * PMF probably in the middle of TXdisable/enable transaction
8831+ * PMF probably in the middle of TX disable/enable transaction
87548832 */
87558833 rc = bnx2x_func_wait_started(bp);
87568834 if (rc) {
@@ -8813,7 +8891,6 @@ unload_error: · 56 unmodified lines
88138891 if (rc)
88148892 BNX2X_ERR("HW_RESET failed\n");
88158893
8816−
88178894 /* Report UNLOAD_DONE to MCP */
88188895 bnx2x_send_unload_done(bp, keep_link);
88198896 }
@@ -9179,7 +9256,6 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global) · 359 unmodified lines
91799256 if (!CHIP_IS_E1x(bp) && bnx2x_er_poll_igu_vq(bp))
91809257 return -EAGAIN;
91819258
9182−
91839259 /* TBD: Indicate that "process kill" is in progress to MCP */
91849260
91859261 /* Clear "unprepared" bit */
@@ -9367,7 +9443,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp) · 181 unmodified lines
93679443 * the first leader that performs a
93689444 * leader_reset() reset the global blocks in
93699445 * order to clear global attentions. Otherwise
9370− * the the gates will remain closed for that
9446+ * the gates will remain closed for that
93719447 * engine.
93729448 */
93739449 if (load_status ||
@@ -9480,14 +9556,12 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work) · 106 unmodified lines
94809556 return;
94819557 }
94829558
9483− /* if stop on error is defined no recovery flows should be executed */
9559+ if (unlikely(bp->recovery_state != BNX2X_RECOVERY_DONE)) {
94849560 #ifdef BNX2X_STOP_ON_ERROR
9485− BNX2X_ERR("recovery flow called but STOP_ON_ERROR defined so reset not done to allow debug dump,\n"
9486− "you will need to reboot when done\n");
9487− goto sp_rtnl_not_reset;
9561+ BNX2X_ERR("recovery flow called but STOP_ON_ERROR defined so reset not done to allow debug dump,\n"
9562+ "you will need to reboot when done\n");
9563+ goto sp_rtnl_not_reset;
94889564 #endif
9489−
9490− if (unlikely(bp->recovery_state != BNX2X_RECOVERY_DONE)) {
94919565 /*
94929566 * Clear all pending SP commands as we are going to reset the
94939567 * function anyway.
@@ -9502,6 +9576,12 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work) · 8 unmodified lines
95029576 }
95039577
95049578 if (test_and_clear_bit(BNX2X_SP_RTNL_TX_TIMEOUT, &bp->sp_rtnl_state)) {
9579+#ifdef BNX2X_STOP_ON_ERROR
9580+ BNX2X_ERR("recovery flow called but STOP_ON_ERROR defined so reset not done to allow debug dump,\n"
9581+ "you will need to reboot when done\n");
9582+ goto sp_rtnl_not_reset;
9583+#endif
9584+
95059585 /*
95069586 * Clear all pending SP commands as we are going to reset the
95079587 * function anyway.
@@ -9540,6 +9620,13 @@ sp_rtnl_not_reset: · 32 unmodified lines
95409620 "sending set mcast vf pf channel message from rtnl sp-task\n");
95419621 bnx2x_vfpf_set_mcast(bp->dev);
95429622 }
9623+ if (test_and_clear_bit(BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
9624+ &bp->sp_rtnl_state)){
9625+ if (!test_bit(__LINK_STATE_NOCARRIER, &bp->dev->state)) {
9626+ bnx2x_tx_disable(bp);
9627+ BNX2X_ERR("PF indicated channel is not servicable anymore. This means this VF device is no longer operational\n");
9628+ }
9629+ }
95439630
95449631 if (test_and_clear_bit(BNX2X_SP_RTNL_VFPF_STORM_RX_MODE,
95459632 &bp->sp_rtnl_state)) {
@@ -9647,7 +9734,6 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, · 101 unmodified lines
96479734 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
96489735 REG_WR(bp, vals->bmac_addr, wb_data[0]);
96499736 REG_WR(bp, vals->bmac_addr + 0x4, wb_data[1]);
9650−
96519737 }
96529738 BNX2X_DEV_INFO("Disable emac Rx\n");
96539739 vals->emac_addr = NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4;
@@ -9681,7 +9767,6 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, · 27 unmodified lines
96819767
96829768 if (mac_stopped)
96839769 msleep(20);
9684−
96859770 }
96869771
96879772 #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4))
@@ -9780,6 +9865,21 @@ static bool bnx2x_prev_is_path_marked(struct bnx2x *bp) · 92 unmodified lines
97809865 return rc;
97819866 }
97829867
9868+bool bnx2x_port_after_undi(struct bnx2x *bp)
9869+{
9870+ struct bnx2x_prev_path_list *entry;
9871+ bool val;
9872+
9873+ down(&bnx2x_prev_sem);
9874+
9875+ entry = bnx2x_prev_path_get_entry(bp);
9876+ val = !!(entry && (entry->undi & (1 << BP_PORT(bp))));
9877+
9878+ up(&bnx2x_prev_sem);
9879+
9880+ return val;
9881+}
9882+
97839883 static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
97849884 {
97859885 struct bnx2x_prev_path_list *tmp_list;
@@ -9839,7 +9939,6 @@ static int bnx2x_do_flr(struct bnx2x *bp) · 53 unmodified lines
98399939 u16 status;
98409940 struct pci_dev *dev = bp->pdev;
98419941
9842−
98439942 if (CHIP_IS_E1x(bp)) {
98449943 BNX2X_DEV_INFO("FLR not supported in E1/E1H\n");
98459944 return -EINVAL;
@@ -9986,7 +10085,6 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) · 140 unmodified lines
998610085
998710086 if (!timer_count)
998810087 BNX2X_ERR("Failed to empty BRB, hope for the best\n");
9989−
999010088 }
999110089
999210090 /* No packets are in the pipeline, path is ready for reset */
@@ -10036,7 +10134,6 @@ static int bnx2x_prev_unload(struct bnx2x *bp) · 43 unmodified lines
1003610134 {
1003710135 int time_counter = 10;
1003810136 u32 rc, fw, hw_lock_reg, hw_lock_val;
10039− struct bnx2x_prev_path_list *prev_list;
1004010137 BNX2X_DEV_INFO("Entering Previous Unload Flow\n");
1004110138
1004210139 /* clear hw from errors which may have resulted from an interrupted
@@ -10049,7 +10146,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp) · 6 unmodified lines
1004910146 (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) :
1005010147 (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8);
1005110148
10052− hw_lock_val = (REG_RD(bp, hw_lock_reg));
10149+ hw_lock_val = REG_RD(bp, hw_lock_reg);
1005310150 if (hw_lock_val) {
1005410151 if (hw_lock_val & HW_LOCK_RESOURCE_NVRAM) {
1005510152 BNX2X_DEV_INFO("Release Previously held NVRAM lock\n");
@@ -10064,7 +10161,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp) · 8 unmodified lines
1006410161
1006510162 if (MCPR_ACCESS_LOCK_LOCK & REG_RD(bp, MCP_REG_MCPR_ACCESS_LOCK)) {
1006610163 BNX2X_DEV_INFO("Release previously held alr\n");
10067− REG_WR(bp, MCP_REG_MCPR_ACCESS_LOCK, 0);
10164+ bnx2x_release_alr(bp);
1006810165 }
1006910166
1007010167 do {
@@ -10093,7 +10190,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp) · 22 unmodified lines
1009310190 break;
1009410191 }
1009510192
10096− /* non-common reply from MCP night require looping */
10193+ /* non-common reply from MCP might require looping */
1009710194 rc = bnx2x_prev_unload_uncommon(bp);
1009810195 if (rc != BNX2X_PREV_WAIT_NEEDED)
1009910196 break;
@@ -10107,8 +10204,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp) · 7 unmodified lines
1010710204 }
1010810205
1010910206 /* Mark function if its port was used to boot from SAN */
10110− prev_list = bnx2x_prev_path_get_entry(bp);
10111− if (prev_list && (prev_list->undi & (1 << BP_PORT(bp))))
10207+ if (bnx2x_port_after_undi(bp))
1011210208 bp->link_params.feature_config_flags |=
1011310209 FEATURE_CONFIG_BOOT_FROM_SAN;
1011410210
@@ -10192,8 +10288,6 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp) · 77 unmodified lines
1019210288
1019310289 bnx2x_init_shmem(bp);
1019410290
10195−
10196−
1019710291 bp->common.shmem2_base = REG_RD(bp, (BP_PATH(bp) ?
1019810292 MISC_REG_GENERIC_CR_1 :
1019910293 MISC_REG_GENERIC_CR_0));
@@ -10455,6 +10549,9 @@ static void bnx2x_link_settings_supported(struct bnx2x *bp, u32 switch_cfg) · 255 unmodified lines
1045510549 PORT_HW_CFG_SPEED_CAPABILITY_D0_10G))
1045610550 bp->port.supported[idx] &= ~SUPPORTED_10000baseT_Full;
1045710551
10552+ if (!(bp->link_params.speed_cap_mask[idx] &
10553+ PORT_HW_CFG_SPEED_CAPABILITY_D0_20G))
10554+ bp->port.supported[idx] &= ~SUPPORTED_20000baseKR2_Full;
1045810555 }
1045910556
1046010557 BNX2X_DEV_INFO("supported 0x%x 0x%x\n", bp->port.supported[0],
@@ -10765,7 +10862,6 @@ void bnx2x_get_iscsi_info(struct bnx2x *bp) · 304 unmodified lines
1076510862 */
1076610863 if (!bp->cnic_eth_dev.max_iscsi_conn)
1076710864 bp->flags |= no_flags;
10768−
1076910865 }
1077010866
1077110867 static void bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func)
@@ -10782,12 +10878,56 @@ static void bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func) · 10 unmodified lines
1078210878 bp->cnic_eth_dev.fcoe_wwn_node_name_lo =
1078310879 MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower);
1078410880 }
10881+
10882+static int bnx2x_shared_fcoe_funcs(struct bnx2x *bp)
10883+{
10884+ u8 count = 0;
10885+
10886+ if (IS_MF(bp)) {
10887+ u8 fid;
10888+
10889+ /* iterate over absolute function ids for this path: */
10890+ for (fid = BP_PATH(bp); fid < E2_FUNC_MAX * 2; fid += 2) {
10891+ if (IS_MF_SD(bp)) {
10892+ u32 cfg = MF_CFG_RD(bp,
10893+ func_mf_config[fid].config);
10894+
10895+ if (!(cfg & FUNC_MF_CFG_FUNC_HIDE) &&
10896+ ((cfg & FUNC_MF_CFG_PROTOCOL_MASK) ==
10897+ FUNC_MF_CFG_PROTOCOL_FCOE))
10898+ count++;
10899+ } else {
10900+ u32 cfg = MF_CFG_RD(bp,
10901+ func_ext_config[fid].
10902+ func_cfg);
10903+
10904+ if ((cfg & MACP_FUNC_CFG_FLAGS_ENABLED) &&
10905+ (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD))
10906+ count++;
10907+ }
10908+ }
10909+ } else { /* SF */
10910+ int port, port_cnt = CHIP_MODE_IS_4_PORT(bp) ? 2 : 1;
10911+
10912+ for (port = 0; port < port_cnt; port++) {
10913+ u32 lic = SHMEM_RD(bp,
10914+ drv_lic_key[port].max_fcoe_conn) ^
10915+ FW_ENCODE_32BIT_PATTERN;
10916+ if (lic)
10917+ count++;
10918+ }
10919+ }
10920+
10921+ return count;
10922+}
10923+
1078510924 static void bnx2x_get_fcoe_info(struct bnx2x *bp)
1078610925 {
1078710926 int port = BP_PORT(bp);
1078810927 int func = BP_ABS_FUNC(bp);
1078910928 u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
1079010929 drv_lic_key[port].max_fcoe_conn);
10930+ u8 num_fcoe_func = bnx2x_shared_fcoe_funcs(bp);
1079110931
1079210932 if (!CNIC_SUPPORT(bp)) {
1079310933 bp->flags |= NO_FCOE_FLAG;
@@ -10801,9 +10941,10 @@ static void bnx2x_get_fcoe_info(struct bnx2x *bp) · 7 unmodified lines
1080110941
1080210942 /* Calculate the number of maximum allowed FCoE tasks */
1080310943 bp->cnic_eth_dev.max_fcoe_exchanges = MAX_NUM_FCOE_TASKS_PER_ENGINE;
10804− if (IS_MF(bp) || CHIP_MODE_IS_4_PORT(bp))
10805− bp->cnic_eth_dev.max_fcoe_exchanges /=
10806− MAX_FCOE_FUNCS_PER_ENGINE;
10944+
10945+ /* check if FCoE resources must be shared between different functions */
10946+ if (num_fcoe_func)
10947+ bp->cnic_eth_dev.max_fcoe_exchanges /= num_fcoe_func;
1080710948
1080810949 /* Read the WWN: */
1080910950 if (!IS_MF(bp)) {
@@ -11031,7 +11172,7 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp) · 221 unmodified lines
1103111172 } else {
1103211173 bp->common.int_block = INT_BLOCK_IGU;
1103311174
11034− /* do not allow device reset during IGU info preocessing */
11175+ /* do not allow device reset during IGU info processing */
1103511176 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET);
1103611177
1103711178 val = REG_RD(bp, IGU_REG_BLOCK_CONFIGURATION);
@@ -11110,7 +11251,7 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp) · 72 unmodified lines
1111011251 E1H_FUNC_MAX * sizeof(struct drv_func_mb);
1111111252 /*
1111211253 * get mf configuration:
11113− * 1. existence of MF configuration
11254+ * 1. Existence of MF configuration
1111411255 * 2. MAC address must be legal (check only upper bytes)
1111511256 * for Switch-Independent mode;
1111611257 * OVLAN must be legal for Switch-Dependent mode
@@ -11384,7 +11525,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 267 unmodified lines
1138411525 mutex_init(&bp->fw_mb_mutex);
1138511526 spin_lock_init(&bp->stats_lock);
1138611527
11387−
1138811528 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
1138911529 INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task);
1139011530 INIT_DELAYED_WORK(&bp->period_task, bnx2x_period_task);
@@ -11393,7 +11533,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 2 unmodified lines
1139311533 if (rc)
1139411534 return rc;
1139511535 } else {
11396− random_ether_addr(bp->dev->dev_addr);
11536+ eth_zero_addr(bp->dev->dev_addr);
1139711537 }
1139811538
1139911539 bnx2x_set_modes_bitmap(bp);
@@ -11417,7 +11557,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 17 unmodified lines
1141711557 bnx2x_prev_unload(bp);
1141811558 }
1141911559
11420−
1142111560 if (CHIP_REV_IS_FPGA(bp))
1142211561 dev_err(&bp->pdev->dev, "FPGA detected\n");
1142311562
@@ -11489,7 +11628,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 65 unmodified lines
1148911628
1149011629 /* We need at least one default status block for slow-path events,
1149111630 * second status block for the L2 queue, and a third status block for
11492− * CNIC if supproted.
11631+ * CNIC if supported.
1149311632 */
1149411633 if (CNIC_SUPPORT(bp))
1149511634 bp->min_msix_vec_cnt = 3;
@@ -11497,10 +11636,11 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 1 unmodified line
1149711636 bp->min_msix_vec_cnt = 2;
1149811637 BNX2X_DEV_INFO("bp->min_msix_vec_cnt %d", bp->min_msix_vec_cnt);
1149911638
11639+ bp->dump_preset_idx = 1;
11640+
1150011641 return rc;
1150111642 }
1150211643
11503−
1150411644 /****************************************************************************
1150511645 * General service functions
1150611646 ****************************************************************************/
@@ -11585,9 +11725,6 @@ static int bnx2x_close(struct net_device *dev) · 78 unmodified lines
1158511725 /* Unload the driver, release IRQs */
1158611726 bnx2x_nic_unload(bp, UNLOAD_CLOSE, false);
1158711727
11588− /* Power off */
11589− bnx2x_set_power_state(bp, PCI_D3hot);
11590−
1159111728 return 0;
1159211729 }
1159311730
@@ -11852,6 +11989,10 @@ static int bnx2x_validate_addr(struct net_device *dev) · 258 unmodified lines
1185211989 {
1185311990 struct bnx2x *bp = netdev_priv(dev);
1185411991
11992+ /* query the bulletin board for mac address configured by the PF */
11993+ if (IS_VF(bp))
11994+ bnx2x_sample_bulletin(bp);
11995+
1185511996 if (!bnx2x_is_valid_ether_addr(bp, dev->dev_addr)) {
1185611997 BNX2X_ERR("Non-valid Ethernet address\n");
1185711998 return -EADDRNOTAVAIL;
@@ -11878,12 +12019,16 @@ static const struct net_device_ops bnx2x_netdev_ops = { · 20 unmodified lines
1187812019 .ndo_setup_tc = bnx2x_setup_tc,
1187912020 #ifdef CONFIG_BNX2X_SRIOV
1188012021 .ndo_set_vf_mac = bnx2x_set_vf_mac,
11881− .ndo_set_vf_vlan = bnx2x_set_vf_vlan,
12022+ .ndo_set_vf_vlan = bnx2x_set_vf_vlan,
1188212023 .ndo_get_vf_config = bnx2x_get_vf_config,
1188312024 #endif
1188412025 #ifdef NETDEV_FCOE_WWNN
1188512026 .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn,
1188612027 #endif
12028+
12029+#ifdef CONFIG_NET_LL_RX_POLL
12030+ .ndo_ll_poll = bnx2x_low_latency_recv,
12031+#endif
1188712032 };
1188812033
1188912034 static int bnx2x_set_coherency_mask(struct bnx2x *bp)
@@ -11959,7 +12104,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, · 69 unmodified lines
1195912104 }
1196012105
1196112106 if (IS_PF(bp)) {
11962− bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
12107+ bp->pm_cap = pdev->pm_cap;
1196312108 if (bp->pm_cap == 0) {
1196412109 dev_err(&bp->pdev->dev,
1196512110 "Cannot find power management capability, aborting\n");
@@ -12008,8 +12153,6 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, · 42 unmodified lines
1200812153 }
1200912154 BNX2X_DEV_INFO("me reg PF num: %d\n", bp->pf_num);
1201012155
12011− bnx2x_set_power_state(bp, PCI_D0);
12012−
1201312156 /* clean indirect addresses */
1201412157 pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS,
1201512158 PCICFG_VENDOR_ID_OFFSET);
@@ -12094,15 +12237,26 @@ err_out: · 78 unmodified lines
1209412237 return rc;
1209512238 }
1209612239
12097−static void bnx2x_get_pcie_width_speed(struct bnx2x *bp, int *width, int *speed)
12240+static void bnx2x_get_pcie_width_speed(struct bnx2x *bp, int *width,
12241+ enum bnx2x_pci_bus_speed *speed)
1209812242 {
12099− u32 val = 0;
12243+ u32 link_speed, val = 0;
1210012244
1210112245 pci_read_config_dword(bp->pdev, PCICFG_LINK_CONTROL, &val);
1210212246 *width = (val & PCICFG_LINK_WIDTH) >> PCICFG_LINK_WIDTH_SHIFT;
1210312247
12104− /* return value of 1=2.5GHz 2=5GHz */
12105− *speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT;
12248+ link_speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT;
12249+
12250+ switch (link_speed) {
12251+ case 3:
12252+ *speed = BNX2X_PCI_LINK_SPEED_8000;
12253+ break;
12254+ case 2:
12255+ *speed = BNX2X_PCI_LINK_SPEED_5000;
12256+ break;
12257+ default:
12258+ *speed = BNX2X_PCI_LINK_SPEED_2500;
12259+ }
1210612260 }
1210712261
1210812262 static int bnx2x_check_firmware(struct bnx2x *bp)
@@ -12327,7 +12481,6 @@ static void bnx2x_release_firmware(struct bnx2x *bp) · 218 unmodified lines
1232712481 bp->firmware = NULL;
1232812482 }
1232912483
12330−
1233112484 static struct bnx2x_func_sp_drv_ops bnx2x_func_sp_drv = {
1233212485 .init_hw_cmn_chip = bnx2x_init_hw_common_chip,
1233312486 .init_hw_cmn = bnx2x_init_hw_common,
@@ -12465,7 +12618,8 @@ static int bnx2x_init_one(struct pci_dev *pdev, · 131 unmodified lines
1246512618 {
1246612619 struct net_device *dev = NULL;
1246712620 struct bnx2x *bp;
12468− int pcie_width, pcie_speed;
12621+ int pcie_width;
12622+ enum bnx2x_pci_bus_speed pcie_speed;
1246912623 int rc, max_non_def_sbs;
1247012624 int rx_count, tx_count, rss_count, doorbell_size;
1247112625 int max_cos_est;
@@ -12605,7 +12759,6 @@ static int bnx2x_init_one(struct pci_dev *pdev, · 133 unmodified lines
1260512759 }
1260612760 BNX2X_DEV_INFO("device name after netdev register %s\n", dev->name);
1260712761
12608−
1260912762 if (!NO_FCOE(bp)) {
1261012763 /* Add storage MAC address */
1261112764 rtnl_lock();
@@ -12617,15 +12770,15 @@ static int bnx2x_init_one(struct pci_dev *pdev, · 5 unmodified lines
1261712770 BNX2X_DEV_INFO("got pcie width %d and speed %d\n",
1261812771 pcie_width, pcie_speed);
1261912772
12620− BNX2X_DEV_INFO(
12621− "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n",
12622− board_info[ent->driver_data].name,
12623− (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
12624− pcie_width,
12625− ((!CHIP_IS_E2(bp) && pcie_speed == 2) ||
12626− (CHIP_IS_E2(bp) && pcie_speed == 1)) ?
12627− "5GHz (Gen2)" : "2.5GHz",
12628− dev->base_addr, bp->pdev->irq, dev->dev_addr);
12773+ BNX2X_DEV_INFO("%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n",
12774+ board_info[ent->driver_data].name,
12775+ (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
12776+ pcie_width,
12777+ pcie_speed == BNX2X_PCI_LINK_SPEED_2500 ? "2.5GHz" :
12778+ pcie_speed == BNX2X_PCI_LINK_SPEED_5000 ? "5.0GHz" :
12779+ pcie_speed == BNX2X_PCI_LINK_SPEED_8000 ? "8.0GHz" :
12780+ "Unknown",
12781+ dev->base_addr, bp->pdev->irq, dev->dev_addr);
1262912782
1263012783 return 0;
1263112784
@@ -12647,17 +12800,11 @@ init_one_exit: · 15 unmodified lines
1264712800 return rc;
1264812801 }
1264912802
12650−static void bnx2x_remove_one(struct pci_dev *pdev)
12803+static void __bnx2x_remove(struct pci_dev *pdev,
12804+ struct net_device *dev,
12805+ struct bnx2x *bp,
12806+ bool remove_netdev)
1265112807 {
12652− struct net_device *dev = pci_get_drvdata(pdev);
12653− struct bnx2x *bp;
12654−
12655− if (!dev) {
12656− dev_err(&pdev->dev, "BAD net device from bnx2x_init_one\n");
12657− return;
12658− }
12659− bp = netdev_priv(dev);
12660−
1266112808 /* Delete storage MAC address */
1266212809 if (!NO_FCOE(bp)) {
1266312810 rtnl_lock();
@@ -12670,7 +12817,17 @@ static void bnx2x_remove_one(struct pci_dev *pdev) · 6 unmodified lines
1267012817 bnx2x_dcbnl_update_applist(bp, true);
1267112818 #endif
1267212819
12673− unregister_netdev(dev);
12820+ /* Close the interface - either directly or implicitly */
12821+ if (remove_netdev) {
12822+ unregister_netdev(dev);
12823+ } else {
12824+ rtnl_lock();
12825+ if (netif_running(dev))
12826+ bnx2x_close(dev);
12827+ rtnl_unlock();
12828+ }
12829+
12830+ bnx2x_iov_remove_one(bp);
1267412831
1267512832 /* Power on: we can't let PCI layer write to us while we are in D3 */
1267612833 if (IS_PF(bp))
@@ -12686,12 +12843,16 @@ static void bnx2x_remove_one(struct pci_dev *pdev) · 9 unmodified lines
1268612843 /* Make sure RESET task is not scheduled before continuing */
1268712844 cancel_delayed_work_sync(&bp->sp_rtnl_task);
1268812845
12689− bnx2x_iov_remove_one(bp);
12690−
1269112846 /* send message via vfpf channel to release the resources of this vf */
1269212847 if (IS_VF(bp))
1269312848 bnx2x_vfpf_release(bp);
1269412849
12850+ /* Assumes no further PCIe PM changes will occur */
12851+ if (system_state == SYSTEM_POWER_OFF) {
12852+ pci_wake_from_d3(pdev, bp->wol);
12853+ pci_set_power_state(pdev, PCI_D3hot);
12854+ }
12855+
1269512856 if (bp->regview)
1269612857 iounmap(bp->regview);
1269712858
@@ -12706,7 +12867,8 @@ static void bnx2x_remove_one(struct pci_dev *pdev) · 8 unmodified lines
1270612867 }
1270712868 bnx2x_free_mem_bp(bp);
1270812869
12709− free_netdev(dev);
12870+ if (remove_netdev)
12871+ free_netdev(dev);
1271012872
1271112873 if (atomic_read(&pdev->enable_cnt) == 1)
1271212874 pci_release_regions(pdev);
@@ -12715,6 +12877,20 @@ static void bnx2x_remove_one(struct pci_dev *pdev) · 2 unmodified lines
1271512877 pci_set_drvdata(pdev, NULL);
1271612878 }
1271712879
12880+static void bnx2x_remove_one(struct pci_dev *pdev)
12881+{
12882+ struct net_device *dev = pci_get_drvdata(pdev);
12883+ struct bnx2x *bp;
12884+
12885+ if (!dev) {
12886+ dev_err(&pdev->dev, "BAD net device from bnx2x_init_one\n");
12887+ return;
12888+ }
12889+ bp = netdev_priv(dev);
12890+
12891+ __bnx2x_remove(pdev, dev, bp, true);
12892+}
12893+
1271812894 static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
1271912895 {
1272012896 bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
@@ -12747,19 +12923,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp) · 26 unmodified lines
1274712923 return 0;
1274812924 }
1274912925
12750−static void bnx2x_eeh_recover(struct bnx2x *bp)
12751−{
12752− u32 val;
12753−
12754− mutex_init(&bp->port.phy_mutex);
12755−
12756−
12757− val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]);
12758− if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
12759− != (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
12760− BNX2X_ERR("BAD MCP validity signature\n");
12761−}
12762−
1276312926 /**
1276412927 * bnx2x_io_error_detected - called when PCI error is detected
1276512928 * @pdev: Pointer to PCI device
@@ -12828,6 +12991,10 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev) · 62 unmodified lines
1282812991
1282912992 if (netif_running(dev)) {
1283012993 BNX2X_ERR("IO slot reset --> driver unload\n");
12994+
12995+ /* MCP should have been reset; Need to wait for validity */
12996+ bnx2x_init_shmem(bp);
12997+
1283112998 if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) {
1283212999 u32 v;
1283313000
@@ -12849,7 +13016,7 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev) · 15 unmodified lines
1284913016
1285013017 bnx2x_prev_unload(bp);
1285113018
12852− /* We should have resetted the engine, so It's fair to
13019+ /* We should have reseted the engine, so It's fair to
1285313020 * assume the FW will no longer write to the bnx2x driver.
1285413021 */
1285513022 bnx2x_squeeze_objects(bp);
@@ -12886,8 +13053,6 @@ static void bnx2x_io_resume(struct pci_dev *pdev) · 30 unmodified lines
1288613053
1288713054 rtnl_lock();
1288813055
12889− bnx2x_eeh_recover(bp);
12890−
1289113056 bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
1289213057 DRV_MSG_SEQ_NUMBER_MASK;
1289313058
@@ -12905,6 +13070,29 @@ static const struct pci_error_handlers bnx2x_err_handler = { · 11 unmodified lines
1290513070 .resume = bnx2x_io_resume,
1290613071 };
1290713072
13073+static void bnx2x_shutdown(struct pci_dev *pdev)
13074+{
13075+ struct net_device *dev = pci_get_drvdata(pdev);
13076+ struct bnx2x *bp;
13077+
13078+ if (!dev)
13079+ return;
13080+
13081+ bp = netdev_priv(dev);
13082+ if (!bp)
13083+ return;
13084+
13085+ rtnl_lock();
13086+ netif_device_detach(dev);
13087+ rtnl_unlock();
13088+
13089+ /* Don't remove the netdevice, as there are scenarios which will cause
13090+ * the kernel to hang, e.g., when trying to remove bnx2i while the
13091+ * rootfs is mounted from SAN.
13092+ */
13093+ __bnx2x_remove(pdev, dev, bp, false);
13094+}
13095+
1290813096 static struct pci_driver bnx2x_pci_driver = {
1290913097 .name = DRV_MODULE_NAME,
1291013098 .id_table = bnx2x_pci_tbl,
@@ -12916,6 +13104,7 @@ static struct pci_driver bnx2x_pci_driver = { · 5 unmodified lines
1291613104 #ifdef CONFIG_BNX2X_SRIOV
1291713105 .sriov_configure = bnx2x_sriov_configure,
1291813106 #endif
13107+ .shutdown = bnx2x_shutdown,
1291913108 };
1292013109
1292113110 static int __init bnx2x_init(void)
@@ -12941,11 +13130,12 @@ static int __init bnx2x_init(void) · 19 unmodified lines
1294113130 static void __exit bnx2x_cleanup(void)
1294213131 {
1294313132 struct list_head *pos, *q;
13133+
1294413134 pci_unregister_driver(&bnx2x_pci_driver);
1294513135
1294613136 destroy_workqueue(bnx2x_wq);
1294713137
12948− /* Free globablly allocated resources */
13138+ /* Free globally allocated resources */
1294913139 list_for_each_safe(pos, q, &bnx2x_prev_list) {
1295013140 struct bnx2x_prev_path_list *tmp =
1295113141 list_entry(pos, struct bnx2x_prev_path_list, list);
@@ -12968,7 +13158,7 @@ module_exit(bnx2x_cleanup); · 16 unmodified lines
1296813158 * @bp: driver handle
1296913159 * @set: set or clear the CAM entry
1297013160 *
12971− * This function will wait until the ramdord completion returns.
13161+ * This function will wait until the ramrod completion returns.
1297213162 * Return 0 if success, -ENODEV if ramrod doesn't return.
1297313163 */
1297413164 static int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp)
@@ -12996,7 +13186,6 @@ static void bnx2x_cnic_sp_post(struct bnx2x *bp, int count) · 21 unmodified lines
1299613186 BUG_ON(bp->cnic_spq_pending < count);
1299713187 bp->cnic_spq_pending -= count;
1299813188
12999−
1300013189 for (; bp->cnic_kwq_pending; bp->cnic_kwq_pending--) {
1300113190 u16 type = (le16_to_cpu(bp->cnic_kwq_cons->hdr.type)
1300213191 & SPE_HDR_CONN_TYPE) >>
@@ -13169,7 +13358,6 @@ static void bnx2x_cnic_cfc_comp(struct bnx2x *bp, int cid, u8 err) · 166 unmodified lines
1316913358 bnx2x_cnic_sp_post(bp, 0);
1317013359 }
1317113360
13172−
1317313361 /* Called with netif_addr_lock_bh() taken.
1317413362 * Sets an rx_mode config for an iSCSI ETH client.
1317513363 * Doesn't block.
@@ -13210,7 +13398,6 @@ static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp, bool start) · 34 unmodified lines
1321013398 }
1321113399 }
1321213400
13213−
1321413401 static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
1321513402 {
1321613403 struct bnx2x *bp = netdev_priv(dev);
@@ -13398,7 +13585,6 @@ void bnx2x_setup_cnic_info(struct bnx2x *bp) · 181 unmodified lines
1339813585 {
1339913586 struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
1340013587
13401−
1340213588 cp->ctx_tbl_offset = FUNC_ILT_BASE(BP_FUNC(bp)) +
1340313589 bnx2x_cid_ilt_lines(bp);
1340413590 cp->starting_cid = bnx2x_cid_ilt_lines(bp) * ILT_PAGE_CIDS;
@@ -13434,7 +13620,6 @@ static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops, · 29 unmodified lines
1343413620 BNX2X_ERR("CNIC-related load failed\n");
1343513621 return rc;
1343613622 }
13437−
1343813623 }
1343913624
1344013625 bp->cnic_enabled = true;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h+6−0
@@ -35,6 +35,8 @@ · 34 unmodified lines
3535 #define ATC_REG_ATC_INT_STS_CLR 0x1101c0
3636 /* [RW 5] Parity mask register #0 read/write */
3737 #define ATC_REG_ATC_PRTY_MASK 0x1101d8
38+/* [R 5] Parity register #0 read */
39+#define ATC_REG_ATC_PRTY_STS 0x1101cc
3840 /* [RC 5] Parity register #0 read clear */
3941 #define ATC_REG_ATC_PRTY_STS_CLR 0x1101d0
4042 /* [RW 19] Interrupt mask register #0 read/write */
@@ -2750,6 +2752,8 @@ · 2709 unmodified lines
27502752 #define PBF_REG_PBF_INT_STS 0x1401c8
27512753 /* [RW 20] Parity mask register #0 read/write */
27522754 #define PBF_REG_PBF_PRTY_MASK 0x1401e4
2755+/* [R 28] Parity register #0 read */
2756+#define PBF_REG_PBF_PRTY_STS 0x1401d8
27532757 /* [RC 20] Parity register #0 read clear */
27542758 #define PBF_REG_PBF_PRTY_STS_CLR 0x1401dc
27552759 /* [RW 16] The Ethernet type value for L2 tag 0 */
@@ -4517,6 +4521,8 @@ · 1761 unmodified lines
45174521 #define TM_REG_TM_INT_STS 0x1640f0
45184522 /* [RW 7] Parity mask register #0 read/write */
45194523 #define TM_REG_TM_PRTY_MASK 0x16410c
4524+/* [R 7] Parity register #0 read */
4525+#define TM_REG_TM_PRTY_STS 0x164100
45204526 /* [RC 7] Parity register #0 read clear */
45214527 #define TM_REG_TM_PRTY_STS_CLR 0x164104
45224528 /* [RW 8] The event id for aggregated interrupt 0 */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c+105−179
@@ -35,9 +35,9 @@ · 34 unmodified lines
3535 /**
3636 * bnx2x_exe_queue_init - init the Exe Queue object
3737 *
38− * @o: poiter to the object
38+ * @o: pointer to the object
3939 * @exe_len: length
40− * @owner: poiter to the owner
40+ * @owner: pointer to the owner
4141 * @validate: validate function pointer
4242 * @optimize: optimize function pointer
4343 * @exec: execute function pointer
@@ -142,7 +142,6 @@ free_and_exit: · 98 unmodified lines
142142 spin_unlock_bh(&o->lock);
143143
144144 return rc;
145−
146145 }
147146
148147 static inline void __bnx2x_exe_queue_reset_pending(
@@ -163,13 +162,11 @@ static inline void __bnx2x_exe_queue_reset_pending( · 14 unmodified lines
163162 static inline void bnx2x_exe_queue_reset_pending(struct bnx2x *bp,
164163 struct bnx2x_exe_queue_obj *o)
165164 {
166−
167165 spin_lock_bh(&o->lock);
168166
169167 __bnx2x_exe_queue_reset_pending(bp, o);
170168
171169 spin_unlock_bh(&o->lock);
172−
173170 }
174171
175172 /**
@@ -179,7 +176,7 @@ static inline void bnx2x_exe_queue_reset_pending(struct bnx2x *bp, · 3 unmodified lines
179176 * @o: queue
180177 * @ramrod_flags: flags
181178 *
182− * (Atomicy is ensured using the exe_queue->lock).
179+ * (Atomicity is ensured using the exe_queue->lock).
183180 */
184181 static inline int bnx2x_exe_queue_step(struct bnx2x *bp,
185182 struct bnx2x_exe_queue_obj *o,
@@ -192,8 +189,7 @@ static inline int bnx2x_exe_queue_step(struct bnx2x *bp, · 6 unmodified lines
192189
193190 spin_lock_bh(&o->lock);
194191
195− /*
196− * Next step should not be performed until the current is finished,
192+ /* Next step should not be performed until the current is finished,
197193 * unless a DRV_CLEAR_ONLY bit is set. In this case we just want to
198194 * properly clear object internals without sending any command to the FW
199195 * which also implies there won't be any completion to clear the
@@ -209,8 +205,7 @@ static inline int bnx2x_exe_queue_step(struct bnx2x *bp, · 9 unmodified lines
209205 }
210206 }
211207
212− /*
213− * Run through the pending commands list and create a next
208+ /* Run through the pending commands list and create a next
214209 * execution chunk.
215210 */
216211 while (!list_empty(&o->exe_queue)) {
@@ -220,8 +215,7 @@ static inline int bnx2x_exe_queue_step(struct bnx2x *bp, · 3 unmodified lines
220215
221216 if (cur_len + elem->cmd_len <= o->exe_chunk_len) {
222217 cur_len += elem->cmd_len;
223− /*
224− * Prevent from both lists being empty when moving an
218+ /* Prevent from both lists being empty when moving an
225219 * element. This will allow the call of
226220 * bnx2x_exe_queue_empty() without locking.
227221 */
@@ -241,14 +235,12 @@ static inline int bnx2x_exe_queue_step(struct bnx2x *bp, · 13 unmodified lines
241235
242236 rc = o->execute(bp, o->owner, &o->pending_comp, ramrod_flags);
243237 if (rc < 0)
244− /*
245− * In case of an error return the commands back to the queue
246− * and reset the pending_comp.
238+ /* In case of an error return the commands back to the queue
239+ * and reset the pending_comp.
247240 */
248241 list_splice_init(&o->pending_comp, &o->exe_queue);
249242 else if (!rc)
250− /*
251− * If zero is returned, means there are no outstanding pending
243+ /* If zero is returned, means there are no outstanding pending
252244 * completions and we may dismiss the pending list.
253245 */
254246 __bnx2x_exe_queue_reset_pending(bp, o);
@@ -308,7 +300,6 @@ static inline int bnx2x_state_wait(struct bnx2x *bp, int state, · 53 unmodified lines
308300 /* can take a while if any port is running */
309301 int cnt = 5000;
310302
311−
312303 if (CHIP_REV_IS_EMUL(bp))
313304 cnt *= 20;
314305
@@ -456,7 +447,6 @@ static int bnx2x_get_n_elements(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o, · 141 unmodified lines
456447 DP(BNX2X_MSG_SP, "copied element number %d to address %p element was:\n",
457448 counter, next);
458449 next += stride + size;
459−
460450 }
461451 }
462452 return counter * ETH_ALEN;
@@ -518,7 +508,6 @@ static int bnx2x_check_vlan_mac_add(struct bnx2x *bp, · 55 unmodified lines
518508 return 0;
519509 }
520510
521−
522511 /* check_del() callbacks */
523512 static struct bnx2x_vlan_mac_registry_elem *
524513 bnx2x_check_mac_del(struct bnx2x *bp,
@@ -609,7 +598,6 @@ static bool bnx2x_check_move_always_err( · 84 unmodified lines
609598 return false;
610599 }
611600
612−
613601 static inline u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o)
614602 {
615603 struct bnx2x_raw_obj *raw = &o->raw;
@@ -626,7 +614,6 @@ static inline u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o) · 10 unmodified lines
626614 return rx_tx_flag;
627615 }
628616
629−
630617 void bnx2x_set_mac_in_nig(struct bnx2x *bp,
631618 bool add, unsigned char *dev_addr, int index)
632619 {
@@ -693,7 +680,7 @@ static inline void bnx2x_vlan_mac_set_cmd_hdr_e2(struct bnx2x *bp, · 60 unmodified lines
693680 *
694681 * @cid: connection id
695682 * @type: BNX2X_FILTER_XXX_PENDING
696− * @hdr: poiter to header to setup
683+ * @hdr: pointer to header to setup
697684 * @rule_cnt:
698685 *
699686 * currently we always configure one rule and echo field to contain a CID and an
@@ -707,7 +694,6 @@ static inline void bnx2x_vlan_mac_set_rdata_hdr_e2(u32 cid, int type, · 7 unmodified lines
707694 hdr->rule_cnt = (u8)rule_cnt;
708695 }
709696
710−
711697 /* hw_config() callbacks */
712698 static void bnx2x_set_one_mac_e2(struct bnx2x *bp,
713699 struct bnx2x_vlan_mac_obj *o,
@@ -723,8 +709,7 @@ static void bnx2x_set_one_mac_e2(struct bnx2x *bp, · 9 unmodified lines
723709 unsigned long *vlan_mac_flags = &elem->cmd_data.vlan_mac.vlan_mac_flags;
724710 u8 *mac = elem->cmd_data.vlan_mac.u.mac.mac;
725711
726− /*
727− * Set LLH CAM entry: currently only iSCSI and ETH macs are
712+ /* Set LLH CAM entry: currently only iSCSI and ETH macs are
728713 * relevant. In addition, current implementation is tuned for a
729714 * single ETH MAC.
730715 *
@@ -879,8 +864,7 @@ static void bnx2x_set_one_mac_e1x(struct bnx2x *bp, · 148 unmodified lines
879864 struct bnx2x_raw_obj *raw = &o->raw;
880865 struct mac_configuration_cmd *config =
881866 (struct mac_configuration_cmd *)(raw->rdata);
882− /*
883− * 57710 and 57711 do not support MOVE command,
867+ /* 57710 and 57711 do not support MOVE command,
884868 * so it's either ADD or DEL
885869 */
886870 bool add = (elem->cmd_data.vlan_mac.cmd == BNX2X_VLAN_MAC_ADD) ?
@@ -960,7 +944,6 @@ static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp, · 73 unmodified lines
960944 u16 vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan;
961945 u8 *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac;
962946
963−
964947 /* Reset the ramrod data buffer for the first rule */
965948 if (rule_idx == 0)
966949 memset(data, 0, sizeof(*data));
@@ -969,7 +952,7 @@ static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp, · 2 unmodified lines
969952 bnx2x_vlan_mac_set_cmd_hdr_e2(bp, o, add, CLASSIFY_RULE_OPCODE_PAIR,
970953 &rule_entry->pair.header);
971954
972− /* Set VLAN and MAC themselvs */
955+ /* Set VLAN and MAC themselves */
973956 rule_entry->pair.vlan = cpu_to_le16(vlan);
974957 bnx2x_set_fw_mac_addr(&rule_entry->pair.mac_msb,
975958 &rule_entry->pair.mac_mid,
@@ -1021,8 +1004,7 @@ static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp, · 45 unmodified lines
10211004 struct bnx2x_raw_obj *raw = &o->raw;
10221005 struct mac_configuration_cmd *config =
10231006 (struct mac_configuration_cmd *)(raw->rdata);
1024− /*
1025− * 57710 and 57711 do not support MOVE command,
1007+ /* 57710 and 57711 do not support MOVE command,
10261008 * so it's either ADD or DEL
10271009 */
10281010 bool add = (elem->cmd_data.vlan_mac.cmd == BNX2X_VLAN_MAC_ADD) ?
@@ -1046,7 +1028,7 @@ static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp, · 17 unmodified lines
10461028 *
10471029 * @bp: device handle
10481030 * @p: command parameters
1049− * @ppos: pointer to the cooky
1031+ * @ppos: pointer to the cookie
10501032 *
10511033 * reconfigure next MAC/VLAN/VLAN-MAC element from the
10521034 * previously configured elements list.
@@ -1054,7 +1036,7 @@ static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp, · 1 unmodified line
10541036 * from command parameters only RAMROD_COMP_WAIT bit in ramrod_flags is taken
10551037 * into an account
10561038 *
1057− * pointer to the cooky - that should be given back in the next call to make
1039+ * pointer to the cookie - that should be given back in the next call to make
10581040 * function handle the next element. If *ppos is set to NULL it will restart the
10591041 * iterator. If returned *ppos == NULL this means that the last element has been
10601042 * handled.
@@ -1102,8 +1084,7 @@ static int bnx2x_vlan_mac_restore(struct bnx2x *bp, · 41 unmodified lines
11021084 return bnx2x_config_vlan_mac(bp, p);
11031085 }
11041086
1105−/*
1106− * bnx2x_exeq_get_mac/bnx2x_exeq_get_vlan/bnx2x_exeq_get_vlan_mac return a
1087+/* bnx2x_exeq_get_mac/bnx2x_exeq_get_vlan/bnx2x_exeq_get_vlan_mac return a
11071088 * pointer to an element with a specific criteria and NULL if such an element
11081089 * hasn't been found.
11091090 */
@@ -1187,8 +1168,7 @@ static inline int bnx2x_validate_vlan_mac_add(struct bnx2x *bp, · 77 unmodified lines
11871168 return rc;
11881169 }
11891170
1190− /*
1191− * Check if there is a pending ADD command for this
1171+ /* Check if there is a pending ADD command for this
11921172 * MAC/VLAN/VLAN-MAC. Return an error if there is.
11931173 */
11941174 if (exeq->get(exeq, elem)) {
@@ -1196,8 +1176,7 @@ static inline int bnx2x_validate_vlan_mac_add(struct bnx2x *bp, · 1 unmodified line
11961176 return -EEXIST;
11971177 }
11981178
1199− /*
1200− * TODO: Check the pending MOVE from other objects where this
1179+ /* TODO: Check the pending MOVE from other objects where this
12011180 * object is a destination object.
12021181 */
12031182
@@ -1240,8 +1219,7 @@ static inline int bnx2x_validate_vlan_mac_del(struct bnx2x *bp, · 36 unmodified lines
12401219 return -EEXIST;
12411220 }
12421221
1243− /*
1244− * Check if there are pending DEL or MOVE commands for this
1222+ /* Check if there are pending DEL or MOVE commands for this
12451223 * MAC/VLAN/VLAN-MAC. Return an error if so.
12461224 */
12471225 memcpy(&query_elem, elem, sizeof(query_elem));
@@ -1292,8 +1270,7 @@ static inline int bnx2x_validate_vlan_mac_move(struct bnx2x *bp, · 44 unmodified lines
12921270 struct bnx2x_exe_queue_obj *src_exeq = &src_o->exe_queue;
12931271 struct bnx2x_exe_queue_obj *dest_exeq = &dest_o->exe_queue;
12941272
1295− /*
1296− * Check if we can perform this operation based on the current registry
1273+ /* Check if we can perform this operation based on the current registry
12971274 * state.
12981275 */
12991276 if (!src_o->check_move(bp, src_o, dest_o,
@@ -1302,8 +1279,7 @@ static inline int bnx2x_validate_vlan_mac_move(struct bnx2x *bp, · 2 unmodified lines
13021279 return -EINVAL;
13031280 }
13041281
1305− /*
1306− * Check if there is an already pending DEL or MOVE command for the
1282+ /* Check if there is an already pending DEL or MOVE command for the
13071283 * source object or ADD command for a destination object. Return an
13081284 * error if so.
13091285 */
@@ -1392,7 +1368,7 @@ static int bnx2x_remove_vlan_mac(struct bnx2x *bp, · 82 unmodified lines
13921368 }
13931369
13941370 /**
1395− * bnx2x_wait_vlan_mac - passivly wait for 5 seconds until all work completes.
1371+ * bnx2x_wait_vlan_mac - passively wait for 5 seconds until all work completes.
13961372 *
13971373 * @bp: device handle
13981374 * @o: bnx2x_vlan_mac_obj
@@ -1550,9 +1526,8 @@ static inline int bnx2x_vlan_mac_get_registry_elem( · 151 unmodified lines
15501526
15511527 /* Get a new CAM offset */
15521528 if (!o->get_cam_offset(o, &reg_elem->cam_offset)) {
1553− /*
1554− * This shell never happen, because we have checked the
1555− * CAM availiability in the 'validate'.
1529+ /* This shall never happen, because we have checked the
1530+ * CAM availability in the 'validate'.
15561531 */
15571532 WARN_ON(1);
15581533 kfree(reg_elem);
@@ -1599,8 +1574,7 @@ static int bnx2x_execute_vlan_mac(struct bnx2x *bp, · 40 unmodified lines
15991574 struct bnx2x_vlan_mac_registry_elem *reg_elem;
16001575 enum bnx2x_vlan_mac_cmd cmd;
16011576
1602− /*
1603− * If DRIVER_ONLY execution is requested, cleanup a registry
1577+ /* If DRIVER_ONLY execution is requested, cleanup a registry
16041578 * and exit. Otherwise send a ramrod to FW.
16051579 */
16061580 if (!drv_only) {
@@ -1609,11 +1583,10 @@ static int bnx2x_execute_vlan_mac(struct bnx2x *bp, · 2 unmodified lines
16091583 /* Set pending */
16101584 r->set_pending(r);
16111585
1612− /* Fill tha ramrod data */
1586+ /* Fill the ramrod data */
16131587 list_for_each_entry(elem, exe_chunk, link) {
16141588 cmd = elem->cmd_data.vlan_mac.cmd;
1615− /*
1616− * We will add to the target object in MOVE command, so
1589+ /* We will add to the target object in MOVE command, so
16171590 * change the object for a CAM search.
16181591 */
16191592 if (cmd == BNX2X_VLAN_MAC_MOVE)
@@ -1646,12 +1619,11 @@ static int bnx2x_execute_vlan_mac(struct bnx2x *bp, · 26 unmodified lines
16461619 idx++;
16471620 }
16481621
1649− /*
1650− * No need for an explicit memory barrier here as long we would
1651− * need to ensure the ordering of writing to the SPQ element
1652− * and updating of the SPQ producer which involves a memory
1653− * read and we will have to put a full memory barrier there
1654− * (inside bnx2x_sp_post()).
1622+ /* No need for an explicit memory barrier here as long we would
1623+ * need to ensure the ordering of writing to the SPQ element
1624+ * and updating of the SPQ producer which involves a memory
1625+ * read and we will have to put a full memory barrier there
1626+ * (inside bnx2x_sp_post()).
16551627 */
16561628
16571629 rc = bnx2x_sp_post(bp, o->ramrod_cmd, r->cid,
@@ -1766,8 +1738,7 @@ int bnx2x_config_vlan_mac( · 108 unmodified lines
17661738 return rc;
17671739 }
17681740
1769− /*
1770− * If nothing will be executed further in this iteration we want to
1741+ /* If nothing will be executed further in this iteration we want to
17711742 * return PENDING if there are pending commands
17721743 */
17731744 if (!bnx2x_exe_queue_empty(&o->exe_queue))
@@ -1786,13 +1757,11 @@ int bnx2x_config_vlan_mac( · 12 unmodified lines
17861757 return rc;
17871758 }
17881759
1789− /*
1790− * RAMROD_COMP_WAIT is a superset of RAMROD_EXEC. If it was set
1760+ /* RAMROD_COMP_WAIT is a superset of RAMROD_EXEC. If it was set
17911761 * then user want to wait until the last command is done.
17921762 */
17931763 if (test_bit(RAMROD_COMP_WAIT, &p->ramrod_flags)) {
1794− /*
1795− * Wait maximum for the current exe_queue length iterations plus
1764+ /* Wait maximum for the current exe_queue length iterations plus
17961765 * one (for the current pending command).
17971766 */
17981767 int max_iterations = bnx2x_exe_queue_length(&o->exe_queue) + 1;
@@ -1818,8 +1787,6 @@ int bnx2x_config_vlan_mac( · 19 unmodified lines
18181787 return rc;
18191788 }
18201789
1821−
1822−
18231790 /**
18241791 * bnx2x_vlan_mac_del_all - delete elements with given vlan_mac_flags spec
18251792 *
@@ -1829,7 +1796,7 @@ int bnx2x_config_vlan_mac( · 3 unmodified lines
18291796 * @ramrod_flags: execution flags to be used for this deletion
18301797 *
18311798 * if the last operation has completed successfully and there are no
1832− * moreelements left, positive value if the last operation has completed
1799+ * more elements left, positive value if the last operation has completed
18331800 * successfully and there are more previously configured elements, negative
18341801 * value is current operation has failed.
18351802 */
@@ -1870,8 +1837,7 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, · 34 unmodified lines
18701837 p.ramrod_flags = *ramrod_flags;
18711838 p.user_req.cmd = BNX2X_VLAN_MAC_DEL;
18721839
1873− /*
1874− * Add all but the last VLAN-MAC to the execution queue without actually
1840+ /* Add all but the last VLAN-MAC to the execution queue without actually
18751841 * execution anything.
18761842 */
18771843 __clear_bit(RAMROD_COMP_WAIT, &p.ramrod_flags);
@@ -1934,7 +1900,6 @@ static inline void bnx2x_init_vlan_mac_common(struct bnx2x_vlan_mac_obj *o, · 56 unmodified lines
19341900 state, pstate, type);
19351901 }
19361902
1937−
19381903 void bnx2x_init_mac_obj(struct bnx2x *bp,
19391904 struct bnx2x_vlan_mac_obj *mac_obj,
19401905 u8 cl_id, u32 cid, u8 func_id, void *rdata,
@@ -2048,8 +2013,7 @@ void bnx2x_init_vlan_mac_obj(struct bnx2x *bp, · 107 unmodified lines
20482013 /* CAM pool handling */
20492014 vlan_mac_obj->get_credit = bnx2x_get_credit_vlan_mac;
20502015 vlan_mac_obj->put_credit = bnx2x_put_credit_vlan_mac;
2051− /*
2052− * CAM offset is relevant for 57710 and 57711 chips only which have a
2016+ /* CAM offset is relevant for 57710 and 57711 chips only which have a
20532017 * single CAM for both MACs and VLAN-MAC pairs. So the offset
20542018 * will be taken from MACs' pool object only.
20552019 */
@@ -2092,7 +2056,6 @@ void bnx2x_init_vlan_mac_obj(struct bnx2x *bp, · 36 unmodified lines
20922056 bnx2x_execute_vlan_mac,
20932057 bnx2x_exeq_get_vlan_mac);
20942058 }
2095−
20962059 }
20972060
20982061 /* RX_MODE verbs: DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
@@ -2117,12 +2080,12 @@ static int bnx2x_set_rx_mode_e1x(struct bnx2x *bp, · 18 unmodified lines
21172080 struct tstorm_eth_mac_filter_config *mac_filters =
21182081 (struct tstorm_eth_mac_filter_config *)p->rdata;
21192082
2120− /* initial seeting is drop-all */
2083+ /* initial setting is drop-all */
21212084 u8 drop_all_ucast = 1, drop_all_mcast = 1;
21222085 u8 accp_all_ucast = 0, accp_all_bcast = 0, accp_all_mcast = 0;
21232086 u8 unmatched_unicast = 0;
21242087
2125− /* In e1x there we only take into account rx acceot flag since tx switching
2088+ /* In e1x there we only take into account rx accept flag since tx switching
21262089 * isn't enabled. */
21272090 if (test_bit(BNX2X_ACCEPT_UNICAST, &p->rx_accept_flags))
21282091 /* accept matched ucast */
@@ -2245,7 +2208,6 @@ static inline void bnx2x_rx_mode_set_cmd_state_e2(struct bnx2x *bp, · 116 unmodified lines
22452208 }
22462209
22472210 cmd->state = cpu_to_le16(state);
2248−
22492211 }
22502212
22512213 static int bnx2x_set_rx_mode_e2(struct bnx2x *bp,
@@ -2286,9 +2248,7 @@ static int bnx2x_set_rx_mode_e2(struct bnx2x *bp, · 34 unmodified lines
22862248 false);
22872249 }
22882250
2289−
2290− /*
2291− * If FCoE Queue configuration has been requested configure the Rx and
2251+ /* If FCoE Queue configuration has been requested configure the Rx and
22922252 * internal switching modes for this queue in separate rules.
22932253 *
22942254 * FCoE queue shell never be set to ACCEPT_ALL packets of any sort:
@@ -2324,8 +2284,7 @@ static int bnx2x_set_rx_mode_e2(struct bnx2x *bp, · 29 unmodified lines
23242284 }
23252285 }
23262286
2327− /*
2328− * Set the ramrod header (most importantly - number of rules to
2287+ /* Set the ramrod header (most importantly - number of rules to
23292288 * configure).
23302289 */
23312290 bnx2x_rx_mode_set_rdata_hdr_e2(p->cid, &data->header, rule_idx);
@@ -2334,12 +2293,11 @@ static int bnx2x_set_rx_mode_e2(struct bnx2x *bp, · 2 unmodified lines
23342293 data->header.rule_cnt, p->rx_accept_flags,
23352294 p->tx_accept_flags);
23362295
2337− /*
2338− * No need for an explicit memory barrier here as long we would
2339− * need to ensure the ordering of writing to the SPQ element
2340− * and updating of the SPQ producer which involves a memory
2341− * read and we will have to put a full memory barrier there
2342− * (inside bnx2x_sp_post()).
2296+ /* No need for an explicit memory barrier here as long we would
2297+ * need to ensure the ordering of writing to the SPQ element
2298+ * and updating of the SPQ producer which involves a memory
2299+ * read and we will have to put a full memory barrier there
2300+ * (inside bnx2x_sp_post()).
23432301 */
23442302
23452303 /* Send a ramrod */
@@ -2476,7 +2434,7 @@ static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp, · 130 unmodified lines
24762434 cur_mac = (struct bnx2x_mcast_mac_elem *)
24772435 ((u8 *)new_cmd + sizeof(*new_cmd));
24782436
2479− /* Push the MACs of the current command into the pendig command
2437+ /* Push the MACs of the current command into the pending command
24802438 * MACs list: FIFO
24812439 */
24822440 list_for_each_entry(pos, &p->mcast_list, link) {
@@ -2909,7 +2867,6 @@ static int bnx2x_mcast_validate_e2(struct bnx2x *bp, · 426 unmodified lines
29092867 default:
29102868 BNX2X_ERR("Unknown command: %d\n", cmd);
29112869 return -EINVAL;
2912−
29132870 }
29142871
29152872 /* Increase the total number of MACs pending to be configured */
@@ -3034,20 +2991,18 @@ static int bnx2x_mcast_setup_e2(struct bnx2x *bp, · 118 unmodified lines
30342991 if (!o->total_pending_num)
30352992 bnx2x_mcast_refresh_registry_e2(bp, o);
30362993
3037− /*
3038− * If CLEAR_ONLY was requested - don't send a ramrod and clear
2994+ /* If CLEAR_ONLY was requested - don't send a ramrod and clear
30392995 * RAMROD_PENDING status immediately.
30402996 */
30412997 if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) {
30422998 raw->clear_pending(raw);
30432999 return 0;
30443000 } else {
3045− /*
3046− * No need for an explicit memory barrier here as long we would
3047− * need to ensure the ordering of writing to the SPQ element
3048− * and updating of the SPQ producer which involves a memory
3049− * read and we will have to put a full memory barrier there
3050− * (inside bnx2x_sp_post()).
3001+ /* No need for an explicit memory barrier here as long we would
3002+ * need to ensure the ordering of writing to the SPQ element
3003+ * and updating of the SPQ producer which involves a memory
3004+ * read and we will have to put a full memory barrier there
3005+ * (inside bnx2x_sp_post()).
30513006 */
30523007
30533008 /* Send a ramrod */
@@ -3121,7 +3076,7 @@ static inline void bnx2x_mcast_hdl_restore_e1h(struct bnx2x *bp, · 67 unmodified lines
31213076 }
31223077 }
31233078
3124−/* On 57711 we write the multicast MACs' aproximate match
3079+/* On 57711 we write the multicast MACs' approximate match
31253080 * table by directly into the TSTORM's internal RAM. So we don't
31263081 * really need to handle any tricks to make it work.
31273082 */
@@ -3223,7 +3178,6 @@ static int bnx2x_mcast_validate_e1(struct bnx2x *bp, · 95 unmodified lines
32233178 default:
32243179 BNX2X_ERR("Unknown command: %d\n", cmd);
32253180 return -EINVAL;
3226−
32273181 }
32283182
32293183 /* We want to ensure that commands are executed one by one for 57710.
@@ -3245,7 +3199,7 @@ static void bnx2x_mcast_revert_e1(struct bnx2x *bp, · 15 unmodified lines
32453199
32463200 /* If current command hasn't been handled yet and we are
32473201 * here means that it's meant to be dropped and we have to
3248− * update the number of outstandling MACs accordingly.
3202+ * update the number of outstanding MACs accordingly.
32493203 */
32503204 if (p->mcast_list_len)
32513205 o->total_pending_num -= o->max_cmd_len;
@@ -3342,7 +3296,6 @@ static inline int bnx2x_mcast_handle_restore_cmd_e1( · 90 unmodified lines
33423296 return -1;
33433297 }
33443298
3345−
33463299 static inline int bnx2x_mcast_handle_pending_cmds_e1(
33473300 struct bnx2x *bp, struct bnx2x_mcast_ramrod_params *p)
33483301 {
@@ -3352,7 +3305,6 @@ static inline int bnx2x_mcast_handle_pending_cmds_e1( · 3 unmodified lines
33523305 union bnx2x_mcast_config_data cfg_data = {NULL};
33533306 int cnt = 0;
33543307
3355−
33563308 /* If nothing to be done - return */
33573309 if (list_empty(&o->pending_cmds_head))
33583310 return 0;
@@ -3523,20 +3475,18 @@ static int bnx2x_mcast_setup_e1(struct bnx2x *bp, · 164 unmodified lines
35233475 if (rc)
35243476 return rc;
35253477
3526− /*
3527− * If CLEAR_ONLY was requested - don't send a ramrod and clear
3478+ /* If CLEAR_ONLY was requested - don't send a ramrod and clear
35283479 * RAMROD_PENDING status immediately.
35293480 */
35303481 if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) {
35313482 raw->clear_pending(raw);
35323483 return 0;
35333484 } else {
3534− /*
3535− * No need for an explicit memory barrier here as long we would
3536− * need to ensure the ordering of writing to the SPQ element
3537− * and updating of the SPQ producer which involves a memory
3538− * read and we will have to put a full memory barrier there
3539− * (inside bnx2x_sp_post()).
3485+ /* No need for an explicit memory barrier here as long we would
3486+ * need to ensure the ordering of writing to the SPQ element
3487+ * and updating of the SPQ producer which involves a memory
3488+ * read and we will have to put a full memory barrier there
3489+ * (inside bnx2x_sp_post()).
35403490 */
35413491
35423492 /* Send a ramrod */
@@ -3550,7 +3500,6 @@ static int bnx2x_mcast_setup_e1(struct bnx2x *bp, · 7 unmodified lines
35503500 /* Ramrod completion is pending */
35513501 return 1;
35523502 }
3553−
35543503 }
35553504
35563505 static int bnx2x_mcast_get_registry_size_exact(struct bnx2x_mcast_obj *o)
@@ -3848,7 +3797,6 @@ static bool bnx2x_credit_pool_always_true(struct bnx2x_credit_pool_obj *o, · 291 unmodified lines
38483797 return true;
38493798 }
38503799
3851−
38523800 static bool bnx2x_credit_pool_get_entry(
38533801 struct bnx2x_credit_pool_obj *o,
38543802 int *offset)
@@ -3999,8 +3947,7 @@ void bnx2x_init_mac_credit_pool(struct bnx2x *bp, · 144 unmodified lines
39993947
40003948 } else {
40013949
4002− /*
4003− * CAM credit is equaly divided between all active functions
3950+ /* CAM credit is equaly divided between all active functions
40043951 * on the PATH.
40053952 */
40063953 if ((func_num > 0)) {
@@ -4009,8 +3956,7 @@ void bnx2x_init_mac_credit_pool(struct bnx2x *bp, · 2 unmodified lines
40093956 else
40103957 cam_sz = BNX2X_CAM_SIZE_EMUL;
40113958
4012− /*
4013− * No need for CAM entries handling for 57712 and
3959+ /* No need for CAM entries handling for 57712 and
40143960 * newer.
40153961 */
40163962 bnx2x_init_credit_pool(p, -1, cam_sz);
@@ -4018,7 +3964,6 @@ void bnx2x_init_mac_credit_pool(struct bnx2x *bp, · 1 unmodified line
40183964 /* this should never happen! Block MAC operations. */
40193965 bnx2x_init_credit_pool(p, 0, 0);
40203966 }
4021−
40223967 }
40233968 }
40243969
@@ -4028,14 +3973,12 @@ void bnx2x_init_vlan_credit_pool(struct bnx2x *bp, · 3 unmodified lines
40283973 u8 func_num)
40293974 {
40303975 if (CHIP_IS_E1x(bp)) {
4031− /*
4032− * There is no VLAN credit in HW on 57710 and 57711 only
3976+ /* There is no VLAN credit in HW on 57710 and 57711 only
40333977 * MAC / MAC-VLAN can be set
40343978 */
40353979 bnx2x_init_credit_pool(p, 0, -1);
40363980 } else {
4037− /*
4038− * CAM credit is equaly divided between all active functions
3981+ /* CAM credit is equally divided between all active functions
40393982 * on the PATH.
40403983 */
40413984 if (func_num > 0) {
@@ -4051,7 +3994,7 @@ void bnx2x_init_vlan_credit_pool(struct bnx2x *bp, · 9 unmodified lines
40513994 /**
40523995 * bnx2x_debug_print_ind_table - prints the indirection table configuration.
40533996 *
4054− * @bp: driver hanlde
3997+ * @bp: driver handle
40553998 * @p: pointer to rss configuration
40563999 *
40574000 * Prints it when NETIF_MSG_IFUP debug level is configured.
@@ -4164,12 +4107,11 @@ static int bnx2x_setup_rss(struct bnx2x *bp, · 106 unmodified lines
41644107 data->capabilities |= ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY;
41654108 }
41664109
4167− /*
4168− * No need for an explicit memory barrier here as long we would
4169− * need to ensure the ordering of writing to the SPQ element
4170− * and updating of the SPQ producer which involves a memory
4171− * read and we will have to put a full memory barrier there
4172− * (inside bnx2x_sp_post()).
4110+ /* No need for an explicit memory barrier here as long we would
4111+ * need to ensure the ordering of writing to the SPQ element
4112+ * and updating of the SPQ producer which involves a memory
4113+ * read and we will have to put a full memory barrier there
4114+ * (inside bnx2x_sp_post()).
41734115 */
41744116
41754117 /* Send a ramrod */
@@ -4215,7 +4157,6 @@ int bnx2x_config_rss(struct bnx2x *bp, · 39 unmodified lines
42154157 return rc;
42164158 }
42174159
4218−
42194160 void bnx2x_init_rss_config_obj(struct bnx2x *bp,
42204161 struct bnx2x_rss_config_obj *rss_obj,
42214162 u8 cl_id, u32 cid, u8 func_id, u8 engine_id,
@@ -4288,7 +4229,6 @@ int bnx2x_queue_state_change(struct bnx2x *bp, · 66 unmodified lines
42884229 return !!test_bit(pending_bit, pending);
42894230 }
42904231
4291−
42924232 static int bnx2x_queue_set_pending(struct bnx2x_queue_sp_obj *obj,
42934233 struct bnx2x_queue_state_params *params)
42944234 {
@@ -4337,7 +4277,7 @@ static int bnx2x_queue_comp_cmd(struct bnx2x *bp, · 42 unmodified lines
43374277 }
43384278
43394279 if (o->next_tx_only >= o->max_cos)
4340− /* >= becuase tx only must always be smaller than cos since the
4280+ /* >= because tx only must always be smaller than cos since the
43414281 * primary connection supports COS 0
43424282 */
43434283 BNX2X_ERR("illegal value for next tx_only: %d. max cos was %d",
@@ -4403,7 +4343,6 @@ static void bnx2x_q_fill_init_general_data(struct bnx2x *bp, · 59 unmodified lines
44034343 gen_data->mtu = cpu_to_le16(params->mtu);
44044344 gen_data->func_id = o->func_id;
44054345
4406−
44074346 gen_data->cos = params->cos;
44084347
44094348 gen_data->traffic_type =
@@ -4530,7 +4469,6 @@ static void bnx2x_q_fill_init_rx_data(struct bnx2x_queue_sp_obj *o, · 120 unmodified lines
45304469 cpu_to_le16(params->silent_removal_value);
45314470 rx_data->silent_vlan_mask =
45324471 cpu_to_le16(params->silent_removal_mask);
4533−
45344472 }
45354473
45364474 /* initialize the general, tx and rx parts of a queue object */
@@ -4652,12 +4590,11 @@ static inline int bnx2x_q_send_setup_e1x(struct bnx2x *bp, · 115 unmodified lines
46524590 /* Fill the ramrod data */
46534591 bnx2x_q_fill_setup_data_cmn(bp, params, rdata);
46544592
4655− /*
4656− * No need for an explicit memory barrier here as long we would
4657− * need to ensure the ordering of writing to the SPQ element
4658− * and updating of the SPQ producer which involves a memory
4659− * read and we will have to put a full memory barrier there
4660− * (inside bnx2x_sp_post()).
4593+ /* No need for an explicit memory barrier here as long we would
4594+ * need to ensure the ordering of writing to the SPQ element
4595+ * and updating of the SPQ producer which involves a memory
4596+ * read and we will have to put a full memory barrier there
4597+ * (inside bnx2x_sp_post()).
46614598 */
46624599
46634600 return bnx2x_sp_post(bp, ramrod, o->cids[BNX2X_PRIMARY_CID_INDEX],
@@ -4681,12 +4618,11 @@ static inline int bnx2x_q_send_setup_e2(struct bnx2x *bp, · 17 unmodified lines
46814618 bnx2x_q_fill_setup_data_cmn(bp, params, rdata);
46824619 bnx2x_q_fill_setup_data_e2(bp, params, rdata);
46834620
4684− /*
4685− * No need for an explicit memory barrier here as long we would
4686− * need to ensure the ordering of writing to the SPQ element
4687− * and updating of the SPQ producer which involves a memory
4688− * read and we will have to put a full memory barrier there
4689− * (inside bnx2x_sp_post()).
4621+ /* No need for an explicit memory barrier here as long we would
4622+ * need to ensure the ordering of writing to the SPQ element
4623+ * and updating of the SPQ producer which involves a memory
4624+ * read and we will have to put a full memory barrier there
4625+ * (inside bnx2x_sp_post()).
46904626 */
46914627
46924628 return bnx2x_sp_post(bp, ramrod, o->cids[BNX2X_PRIMARY_CID_INDEX],
@@ -4706,7 +4642,6 @@ static inline int bnx2x_q_send_setup_tx_only(struct bnx2x *bp, · 13 unmodified lines
47064642 &params->params.tx_only;
47074643 u8 cid_index = tx_only_params->cid_index;
47084644
4709−
47104645 if (cid_index >= o->max_cos) {
47114646 BNX2X_ERR("queue[%d]: cid_index (%d) is out of range\n",
47124647 o->cl_id, cid_index);
@@ -4727,12 +4662,11 @@ static inline int bnx2x_q_send_setup_tx_only(struct bnx2x *bp, · 14 unmodified lines
47274662 o->cids[cid_index], rdata->general.client_id,
47284663 rdata->general.sp_client_id, rdata->general.cos);
47294664
4730− /*
4731− * No need for an explicit memory barrier here as long we would
4732− * need to ensure the ordering of writing to the SPQ element
4733− * and updating of the SPQ producer which involves a memory
4734− * read and we will have to put a full memory barrier there
4735− * (inside bnx2x_sp_post()).
4665+ /* No need for an explicit memory barrier here as long we would
4666+ * need to ensure the ordering of writing to the SPQ element
4667+ * and updating of the SPQ producer which involves a memory
4668+ * read and we will have to put a full memory barrier there
4669+ * (inside bnx2x_sp_post()).
47364670 */
47374671
47384672 return bnx2x_sp_post(bp, ramrod, o->cids[cid_index],
@@ -4761,7 +4695,7 @@ static void bnx2x_q_fill_update_data(struct bnx2x *bp, · 22 unmodified lines
47614695 test_bit(BNX2X_Q_UPDATE_IN_VLAN_REM_CHNG,
47624696 &params->update_flags);
47634697
4764− /* Outer VLAN sripping */
4698+ /* Outer VLAN stripping */
47654699 data->outer_vlan_removal_enable_flg =
47664700 test_bit(BNX2X_Q_UPDATE_OUT_VLAN_REM, &params->update_flags);
47674701 data->outer_vlan_removal_change_flg =
@@ -4816,19 +4750,17 @@ static inline int bnx2x_q_send_update(struct bnx2x *bp, · 48 unmodified lines
48164750 return -EINVAL;
48174751 }
48184752
4819−
48204753 /* Clear the ramrod data */
48214754 memset(rdata, 0, sizeof(*rdata));
48224755
48234756 /* Fill the ramrod data */
48244757 bnx2x_q_fill_update_data(bp, o, update_params, rdata);
48254758
4826− /*
4827− * No need for an explicit memory barrier here as long we would
4828− * need to ensure the ordering of writing to the SPQ element
4829− * and updating of the SPQ producer which involves a memory
4830− * read and we will have to put a full memory barrier there
4831− * (inside bnx2x_sp_post()).
4759+ /* No need for an explicit memory barrier here as long we would
4760+ * need to ensure the ordering of writing to the SPQ element
4761+ * and updating of the SPQ producer which involves a memory
4762+ * read and we will have to put a full memory barrier there
4763+ * (inside bnx2x_sp_post()).
48324764 */
48334765
48344766 return bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_CLIENT_UPDATE,
@@ -5038,8 +4970,7 @@ static int bnx2x_queue_chk_transition(struct bnx2x *bp, · 203 unmodified lines
50384970 &params->params.update;
50394971 u8 next_tx_only = o->num_tx_only;
50404972
5041− /*
5042− * Forget all pending for completion commands if a driver only state
4973+ /* Forget all pending for completion commands if a driver only state
50434974 * transition has been requested.
50444975 */
50454976 if (test_bit(RAMROD_DRV_CLR_ONLY, &params->ramrod_flags)) {
@@ -5047,8 +4978,7 @@ static int bnx2x_queue_chk_transition(struct bnx2x *bp, · 1 unmodified line
50474978 o->next_state = BNX2X_Q_STATE_MAX;
50484979 }
50494980
5050− /*
5051− * Don't allow a next state transition if we are in the middle of
4981+ /* Don't allow a next state transition if we are in the middle of
50524982 * the previous one.
50534983 */
50544984 if (o->pending) {
@@ -5257,8 +5187,7 @@ enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp, · 202 unmodified lines
52575187 if (o->pending)
52585188 return BNX2X_F_STATE_MAX;
52595189
5260− /*
5261− * unsure the order of reading of o->pending and o->state
5190+ /* unsure the order of reading of o->pending and o->state
52625191 * o->pending should be read first
52635192 */
52645193 rmb();
@@ -5356,8 +5285,7 @@ static int bnx2x_func_chk_transition(struct bnx2x *bp, · 91 unmodified lines
53565285 enum bnx2x_func_state state = o->state, next_state = BNX2X_F_STATE_MAX;
53575286 enum bnx2x_func_cmd cmd = params->cmd;
53585287
5359− /*
5360− * Forget all pending for completion commands if a driver only state
5288+ /* Forget all pending for completion commands if a driver only state
53615289 * transition has been requested.
53625290 */
53635291 if (test_bit(RAMROD_DRV_CLR_ONLY, &params->ramrod_flags)) {
@@ -5365,8 +5293,7 @@ static int bnx2x_func_chk_transition(struct bnx2x *bp, · 1 unmodified line
53655293 o->next_state = BNX2X_F_STATE_MAX;
53665294 }
53675295
5368− /*
5369− * Don't allow a next state transition if we are in the middle of
5296+ /* Don't allow a next state transition if we are in the middle of
53705297 * the previous one.
53715298 */
53725299 if (o->pending)
@@ -5539,7 +5466,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp, · 166 unmodified lines
55395466 goto init_err;
55405467 }
55415468
5542− /* Handle the beginning of COMMON_XXX pases separatelly... */
5469+ /* Handle the beginning of COMMON_XXX pases separately... */
55435470 switch (load_code) {
55445471 case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP:
55455472 rc = bnx2x_func_init_cmn_chip(bp, drv);
@@ -5573,7 +5500,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp, · 27 unmodified lines
55735500 init_err:
55745501 drv->gunzip_end(bp);
55755502
5576− /* In case of success, complete the comand immediatelly: no ramrods
5503+ /* In case of success, complete the command immediately: no ramrods
55775504 * have been sent.
55785505 */
55795506 if (!rc)
@@ -5598,7 +5525,7 @@ static inline void bnx2x_func_reset_func(struct bnx2x *bp, · 18 unmodified lines
55985525 }
55995526
56005527 /**
5601− * bnx2x_func_reset_port - reser HW at port stage
5528+ * bnx2x_func_reset_port - reset HW at port stage
56025529 *
56035530 * @bp: device handle
56045531 * @drv:
@@ -5620,7 +5547,7 @@ static inline void bnx2x_func_reset_port(struct bnx2x *bp, · 15 unmodified lines
56205547 }
56215548
56225549 /**
5623− * bnx2x_func_reset_cmn - reser HW at common stage
5550+ * bnx2x_func_reset_cmn - reset HW at common stage
56245551 *
56255552 * @bp: device handle
56265553 * @drv:
@@ -5636,7 +5563,6 @@ static inline void bnx2x_func_reset_cmn(struct bnx2x *bp, · 9 unmodified lines
56365563 drv->reset_hw_cmn(bp);
56375564 }
56385565
5639−
56405566 static inline int bnx2x_func_hw_reset(struct bnx2x *bp,
56415567 struct bnx2x_func_state_params *params)
56425568 {
@@ -5663,7 +5589,7 @@ static inline int bnx2x_func_hw_reset(struct bnx2x *bp, · 20 unmodified lines
56635589 break;
56645590 }
56655591
5666− /* Complete the comand immediatelly: no ramrods have been sent. */
5592+ /* Complete the command immediately: no ramrods have been sent. */
56675593 o->complete_cmd(bp, o, BNX2X_F_CMD_HW_RESET);
56685594
56695595 return 0;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h+22−33
@@ -34,8 +34,7 @@ enum { · 33 unmodified lines
3434 RAMROD_RESTORE,
3535 /* Execute the next command now */
3636 RAMROD_EXEC,
37− /*
38− * Don't add a new command and continue execution of posponed
37+ /* Don't add a new command and continue execution of postponed
3938 * commands. If not set a new command will be added to the
4039 * pending commands list.
4140 */
@@ -129,8 +128,7 @@ enum bnx2x_vlan_mac_cmd { · 87 unmodified lines
129128 struct bnx2x_vlan_mac_data {
130129 /* Requested command: BNX2X_VLAN_MAC_XX */
131130 enum bnx2x_vlan_mac_cmd cmd;
132− /*
133− * used to contain the data related vlan_mac_flags bits from
131+ /* used to contain the data related vlan_mac_flags bits from
134132 * ramrod parameters.
135133 */
136134 unsigned long vlan_mac_flags;
@@ -190,14 +188,10 @@ typedef struct bnx2x_exeq_elem * · 53 unmodified lines
190188 struct bnx2x_exeq_elem *elem);
191189
192190 struct bnx2x_exe_queue_obj {
193− /*
194− * Commands pending for an execution.
195− */
191+ /* Commands pending for an execution. */
196192 struct list_head exe_queue;
197193
198− /*
199− * Commands pending for an completion.
200− */
194+ /* Commands pending for an completion. */
201195 struct list_head pending_comp;
202196
203197 spinlock_t lock;
@@ -245,14 +239,13 @@ struct bnx2x_exe_queue_obj { · 41 unmodified lines
245239 };
246240 /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/
247241 /*
248− * Element in the VLAN_MAC registry list having all currenty configured
242+ * Element in the VLAN_MAC registry list having all currently configured
249243 * rules.
250244 */
251245 struct bnx2x_vlan_mac_registry_elem {
252246 struct list_head link;
253247
254− /*
255− * Used to store the cam offset used for the mac/vlan/vlan-mac.
248+ /* Used to store the cam offset used for the mac/vlan/vlan-mac.
256249 * Relevant for 57710 and 57711 only. VLANs and MACs share the
257250 * same CAM for these chips.
258251 */
@@ -310,7 +303,7 @@ struct bnx2x_vlan_mac_obj { · 51 unmodified lines
310303 * @param n number of elements to get
311304 * @param buf buffer preallocated by caller into which elements
312305 * will be copied. Note elements are 4-byte aligned
313− * so buffer size must be able to accomodate the
306+ * so buffer size must be able to accommodate the
314307 * aligned elements.
315308 *
316309 * @return number of copied bytes
@@ -395,7 +388,7 @@ struct bnx2x_vlan_mac_obj { · 78 unmodified lines
395388 * @param bp
396389 * @param p Command parameters (RAMROD_COMP_WAIT bit in
397390 * ramrod_flags is only taken into an account)
398− * @param ppos a pointer to the cooky that should be given back in the
391+ * @param ppos a pointer to the cookie that should be given back in the
399392 * next call to make function handle the next element. If
400393 * *ppos is set to NULL it will restart the iterator.
401394 * If returned *ppos == NULL this means that the last
@@ -408,7 +401,7 @@ struct bnx2x_vlan_mac_obj { · 6 unmodified lines
408401 struct bnx2x_vlan_mac_registry_elem **ppos);
409402
410403 /**
411− * Should be called on a completion arival.
404+ * Should be called on a completion arrival.
412405 *
413406 * @param bp
414407 * @param o
@@ -447,7 +440,7 @@ void bnx2x_set_mac_in_nig(struct bnx2x *bp, · 32 unmodified lines
447440
448441 /** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
449442
450−/* RX_MODE ramrod spesial flags: set in rx_mode_flags field in
443+/* RX_MODE ramrod special flags: set in rx_mode_flags field in
451444 * a bnx2x_rx_mode_ramrod_params.
452445 */
453446 enum {
@@ -475,8 +468,7 @@ struct bnx2x_rx_mode_ramrod_params { · 21 unmodified lines
475468 unsigned long ramrod_flags;
476469 unsigned long rx_mode_flags;
477470
478− /*
479− * rdata is either a pointer to eth_filter_rules_ramrod_data(e2) or to
471+ /* rdata is either a pointer to eth_filter_rules_ramrod_data(e2) or to
480472 * a tstorm_eth_mac_filter_config (e1x).
481473 */
482474 void *rdata;
@@ -646,12 +638,11 @@ struct bnx2x_credit_pool_obj { · 163 unmodified lines
646638 /* Maximum allowed credit. put() will check against it. */
647639 int pool_sz;
648640
649− /*
650− * Allocate a pool table statically.
641+ /* Allocate a pool table statically.
651642 *
652− * Currently the mamimum allowed size is MAX_MAC_CREDIT_E2(272)
643+ * Currently the maximum allowed size is MAX_MAC_CREDIT_E2(272)
653644 *
654− * The set bit in the table will mean that the entry is available.
645+ * The set bit in the table will mean that the entry is available.
655646 */
656647 #define BNX2X_POOL_VEC_SIZE (MAX_MAC_CREDIT_E2 / 64)
657648 u64 pool_mirror[BNX2X_POOL_VEC_SIZE];
@@ -832,7 +823,7 @@ enum { · 174 unmodified lines
832823 BNX2X_Q_FLG_TUN_INC_INNER_IP_ID
833824 };
834825
835−/* Queue type options: queue type may be a compination of below. */
826+/* Queue type options: queue type may be a combination of below. */
836827 enum bnx2x_q_type {
837828 /** TODO: Consider moving both these flags into the init()
838829 * ramrod params.
@@ -1002,10 +993,9 @@ struct bnx2x_queue_sp_obj { · 163 unmodified lines
1002993 u8 cl_id;
1003994 u8 func_id;
1004995
1005− /*
1006− * number of traffic classes supported by queue.
1007− * The primary connection of the queue suppotrs the first traffic
1008− * class. Any further traffic class is suppoted by a tx-only
996+ /* number of traffic classes supported by queue.
997+ * The primary connection of the queue supports the first traffic
998+ * class. Any further traffic class is supported by a tx-only
1009999 * connection.
10101000 *
10111001 * Therefore max_cos is also a number of valid entries in the cids
@@ -1021,7 +1011,7 @@ struct bnx2x_queue_sp_obj { · 9 unmodified lines
10211011
10221012 /* BNX2X_Q_CMD_XX bits. This object implements "one
10231013 * pending" paradigm but for debug and tracing purposes it's
1024− * more convinient to have different bits for different
1014+ * more convenient to have different bits for different
10251015 * commands.
10261016 */
10271017 unsigned long pending;
@@ -1210,7 +1200,7 @@ struct bnx2x_func_sp_obj { · 182 unmodified lines
12101200
12111201 /* BNX2X_FUNC_CMD_XX bits. This object implements "one
12121202 * pending" paradigm but for debug and tracing purposes it's
1213− * more convinient to have different bits for different
1203+ * more convenient to have different bits for different
12141204 * commands.
12151205 */
12161206 unsigned long pending;
@@ -1329,7 +1319,7 @@ void bnx2x_init_rx_mode_obj(struct bnx2x *bp, · 112 unmodified lines
13291319 *
13301320 * @p: Command parameters
13311321 *
1332− * Return: 0 - if operation was successfull and there is no pending completions,
1322+ * Return: 0 - if operation was successful and there is no pending completions,
13331323 * positive number - if there are pending completions,
13341324 * negative - if there were errors
13351325 */
@@ -1361,7 +1351,7 @@ void bnx2x_init_mcast_obj(struct bnx2x *bp, · 25 unmodified lines
13611351 * the current command will be enqueued to the tail of the
13621352 * pending commands list.
13631353 *
1364− * Return: 0 is operation was successfull and there are no pending completions,
1354+ * Return: 0 is operation was successful and there are no pending completions,
13651355 * negative if there were errors, positive if there are pending
13661356 * completions.
13671357 */
@@ -1377,7 +1367,6 @@ void bnx2x_init_vlan_credit_pool(struct bnx2x *bp, · 9 unmodified lines
13771367 struct bnx2x_credit_pool_obj *p, u8 func_id,
13781368 u8 func_num);
13791369
1380−
13811370 /****************** RSS CONFIGURATION ****************/
13821371 void bnx2x_init_rss_config_obj(struct bnx2x *bp,
13831372 struct bnx2x_rss_config_obj *rss_obj,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+66−23
@@ -1341,7 +1341,7 @@ int bnx2x_vfop_qdown_cmd(struct bnx2x *bp, · 1340 unmodified lines
13411341 */
13421342
13431343 /* internal vf enable - until vf is enabled internally all transactions
1344− * are blocked. this routine should always be called last with pretend.
1344+ * are blocked. This routine should always be called last with pretend.
13451345 */
13461346 static void bnx2x_vf_enable_internal(struct bnx2x *bp, u8 enable)
13471347 {
@@ -1459,21 +1459,16 @@ static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid) · 111 unmodified lines
14591459 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid);
14601460
14611461 if (!vf)
1462− goto unknown_dev;
1462+ return false;
14631463
14641464 dev = pci_get_bus_and_slot(vf->bus, vf->devfn);
14651465 if (dev)
14661466 return bnx2x_is_pcie_pending(dev);
1467−
1468−unknown_dev:
14691467 return false;
14701468 }
14711469
14721470 int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid)
14731471 {
1474− /* Wait 100ms */
1475− msleep(100);
1476−
14771472 /* Verify no pending pci transactions */
14781473 if (bnx2x_vf_is_pcie_pending(bp, abs_vfid))
14791474 BNX2X_ERR("PCIE Transactions still pending\n");
@@ -1620,7 +1615,7 @@ next_vf_to_clean: · 140 unmodified lines
16201615 i++)
16211616 ;
16221617
1623− DP(BNX2X_MSG_IOV, "next vf to cleanup: %d. num of vfs: %d\n", i,
1618+ DP(BNX2X_MSG_IOV, "next vf to cleanup: %d. Num of vfs: %d\n", i,
16241619 BNX2X_NR_VIRTFN(bp));
16251620
16261621 if (i < BNX2X_NR_VIRTFN(bp)) {
@@ -1743,7 +1738,7 @@ void bnx2x_iov_init_dq(struct bnx2x *bp) · 116 unmodified lines
17431738 REG_WR(bp, DORQ_REG_VF_TYPE_MIN_MCID_0, 0);
17441739 REG_WR(bp, DORQ_REG_VF_TYPE_MAX_MCID_0, 0x1ffff);
17451740
1746− /* set the number of VF alllowed doorbells to the full DQ range */
1741+ /* set the number of VF allowed doorbells to the full DQ range */
17471742 REG_WR(bp, DORQ_REG_VF_NORM_MAX_CID_COUNT, 0x20000);
17481743
17491744 /* set the VF doorbell threshold */
@@ -2176,6 +2171,9 @@ int bnx2x_iov_nic_init(struct bnx2x *bp) · 426 unmodified lines
21762171
21772172 DP(BNX2X_MSG_IOV, "num of vfs: %d\n", (bp)->vfdb->sriov.nr_virtfn);
21782173
2174+ /* let FLR complete ... */
2175+ msleep(100);
2176+
21792177 /* initialize vf database */
21802178 for_each_vf(bp, vfid) {
21812179 struct bnx2x_virtf *vf = BP_VF(bp, vfid);
@@ -2403,7 +2401,7 @@ int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem) · 221 unmodified lines
24032401
24042402 /* extract vf and rxq index from vf_cid - relies on the following:
24052403 * 1. vfid on cid reflects the true abs_vfid
2406− * 2. the max number of VFs (per path) is 64
2404+ * 2. The max number of VFs (per path) is 64
24072405 */
24082406 qidx = cid & ((1 << BNX2X_VF_CID_WND)-1);
24092407 abs_vfid = (cid >> BNX2X_VF_CID_WND) & (BNX2X_MAX_NUM_OF_VFS-1);
@@ -2461,7 +2459,7 @@ static struct bnx2x_virtf *bnx2x_vf_by_cid(struct bnx2x *bp, int vf_cid) · 51 unmodified lines
24612459 {
24622460 /* extract the vf from vf_cid - relies on the following:
24632461 * 1. vfid on cid reflects the true abs_vfid
2464− * 2. the max number of VFs (per path) is 64
2462+ * 2. The max number of VFs (per path) is 64
24652463 */
24662464 int abs_vfid = (vf_cid >> BNX2X_VF_CID_WND) & (BNX2X_MAX_NUM_OF_VFS-1);
24672465 return bnx2x_vf_by_abs_fid(bp, abs_vfid);
@@ -2480,7 +2478,7 @@ void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid, · 12 unmodified lines
24802478 if (vf) {
24812479 /* extract queue index from vf_cid - relies on the following:
24822480 * 1. vfid on cid reflects the true abs_vfid
2483− * 2. the max number of VFs (per path) is 64
2481+ * 2. The max number of VFs (per path) is 64
24842482 */
24852483 int q_index = vf_cid & ((1 << BNX2X_VF_CID_WND)-1);
24862484 *q_obj = &bnx2x_vfq(vf, q_index, sp_obj);
@@ -2705,7 +2703,7 @@ int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf, · 218 unmodified lines
27052703 }
27062704
27072705 /* static allocation:
2708− * the global maximum number are fixed per VF. fail the request if
2706+ * the global maximum number are fixed per VF. Fail the request if
27092707 * requested number exceed these globals
27102708 */
27112709 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) {
@@ -2777,6 +2775,10 @@ int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map) · 65 unmodified lines
27772775 vf->abs_vfid, vf->state);
27782776 return -EINVAL;
27792777 }
2778+
2779+ /* let FLR complete ... */
2780+ msleep(100);
2781+
27802782 /* FLR cleanup epilogue */
27812783 if (bnx2x_vf_flr_clnup_epilog(bp, vf->abs_vfid))
27822784 return -EBUSY;
@@ -2890,7 +2892,7 @@ int bnx2x_vfop_close_cmd(struct bnx2x *bp, · 107 unmodified lines
28902892 return -ENOMEM;
28912893 }
28922894
2893−/* VF release can be called either: 1. the VF was acquired but
2895+/* VF release can be called either: 1. The VF was acquired but
28942896 * not enabled 2. the vf was enabled or in the process of being
28952897 * enabled
28962898 */
@@ -3024,7 +3026,6 @@ void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, · 127 unmodified lines
30243026
30253027 int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs_param)
30263028 {
3027−
30283029 struct bnx2x *bp = netdev_priv(pci_get_drvdata(dev));
30293030
30303031 DP(BNX2X_MSG_IOV, "bnx2x_sriov_configure called with %d, BNX2X_NR_VIRTFN(bp) was %d\n",
@@ -3032,7 +3033,7 @@ int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs_param) · 1 unmodified line
30323033
30333034 /* HW channel is only operational when PF is up */
30343035 if (bp->state != BNX2X_STATE_OPEN) {
3035− BNX2X_ERR("VF num configurtion via sysfs not supported while PF is down");
3036+ BNX2X_ERR("VF num configuration via sysfs not supported while PF is down\n");
30363037 return -EINVAL;
30373038 }
30383039
@@ -3086,6 +3087,11 @@ void bnx2x_disable_sriov(struct bnx2x *bp) · 47 unmodified lines
30863087 static int bnx2x_vf_ndo_sanity(struct bnx2x *bp, int vfidx,
30873088 struct bnx2x_virtf *vf)
30883089 {
3090+ if (bp->state != BNX2X_STATE_OPEN) {
3091+ BNX2X_ERR("vf ndo called though PF is down\n");
3092+ return -EINVAL;
3093+ }
3094+
30893095 if (!IS_SRIOV(bp)) {
30903096 BNX2X_ERR("vf ndo called though sriov is disabled\n");
30913097 return -EINVAL;
@@ -3141,7 +3147,7 @@ int bnx2x_get_vf_config(struct net_device *dev, int vfidx, · 49 unmodified lines
31413147 /* mac configured by ndo so its in bulletin board */
31423148 memcpy(&ivi->mac, bulletin->mac, ETH_ALEN);
31433149 else
3144− /* funtion has not been loaded yet. Show mac as 0s */
3150+ /* function has not been loaded yet. Show mac as 0s */
31453151 memset(&ivi->mac, 0, ETH_ALEN);
31463152
31473153 /* vlan */
@@ -3149,7 +3155,7 @@ int bnx2x_get_vf_config(struct net_device *dev, int vfidx, · 1 unmodified line
31493155 /* vlan configured by ndo so its in bulletin board */
31503156 memcpy(&ivi->vlan, &bulletin->vlan, VLAN_HLEN);
31513157 else
3152− /* funtion has not been loaded yet. Show vlans as 0s */
3158+ /* function has not been loaded yet. Show vlans as 0s */
31533159 memset(&ivi->vlan, 0, VLAN_HLEN);
31543160 }
31553161
@@ -3189,7 +3195,7 @@ int bnx2x_set_vf_mac(struct net_device *dev, int vfidx, u8 *mac) · 33 unmodified lines
31893195 return -EINVAL;
31903196 }
31913197
3192− /* update PF's copy of the VF's bulletin. will no longer accept mac
3198+ /* update PF's copy of the VF's bulletin. Will no longer accept mac
31933199 * configuration requests from vf unless match this mac
31943200 */
31953201 bulletin->valid_bitmap |= 1 << MAC_ADDR_VALID;
@@ -3358,8 +3364,11 @@ int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos) · 162 unmodified lines
33583364 return 0;
33593365 }
33603366
3361−/* crc is the first field in the bulletin board. compute the crc over the
3362− * entire bulletin board excluding the crc field itself
3367+/* crc is the first field in the bulletin board. Compute the crc over the
3368+ * entire bulletin board excluding the crc field itself. Use the length field
3369+ * as the Bulletin Board was posted by a PF with possibly a different version
3370+ * from the vf which will sample it. Therefore, the length is computed by the
3371+ * PF and the used blindly by the VF.
33633372 */
33643373 u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp,
33653374 struct pf_vf_bulletin_content *bulletin)
@@ -3389,7 +3398,7 @@ enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp) · 23 unmodified lines
33893398 if (bulletin.crc == bnx2x_crc_vf_bulletin(bp,
33903399 &bulletin))
33913400 break;
3392− BNX2X_ERR("bad crc on bulletin board. contained %x computed %x\n",
3401+ BNX2X_ERR("bad crc on bulletin board. Contained %x computed %x\n",
33933402 bulletin.crc,
33943403 bnx2x_crc_vf_bulletin(bp, &bulletin));
33953404 }
@@ -3417,6 +3426,20 @@ enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp) · 21 unmodified lines
34173426 return PFVF_BULLETIN_UPDATED;
34183427 }
34193428
3429+void bnx2x_timer_sriov(struct bnx2x *bp)
3430+{
3431+ bnx2x_sample_bulletin(bp);
3432+
3433+ /* if channel is down we need to self destruct */
3434+ if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) {
3435+ smp_mb__before_clear_bit();
3436+ set_bit(BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
3437+ &bp->sp_rtnl_state);
3438+ smp_mb__after_clear_bit();
3439+ schedule_delayed_work(&bp->sp_rtnl_task, 0);
3440+ }
3441+}
3442+
34203443 void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
34213444 {
34223445 /* vf doorbells are embedded within the regview */
@@ -3452,7 +3475,7 @@ int bnx2x_open_epilog(struct bnx2x *bp) · 29 unmodified lines
34523475 * register_netdevice which must have rtnl lock taken. As we are holding
34533476 * the lock right now, that could only work if the probe would not take
34543477 * the lock. However, as the probe of the vf may be called from other
3455− * contexts as well (such as passthrough to vm failes) it can't assume
3478+ * contexts as well (such as passthrough to vm fails) it can't assume
34563479 * the lock is being held for it. Using delayed work here allows the
34573480 * probe code to simply take the lock (i.e. wait for it to be released
34583481 * if it is being held). We only want to do this if the number of VFs
@@ -3467,3 +3490,23 @@ int bnx2x_open_epilog(struct bnx2x *bp) · 8 unmodified lines
34673490
34683491 return 0;
34693492 }
3493+
3494+void bnx2x_iov_channel_down(struct bnx2x *bp)
3495+{
3496+ int vf_idx;
3497+ struct pf_vf_bulletin_content *bulletin;
3498+
3499+ if (!IS_SRIOV(bp))
3500+ return;
3501+
3502+ for_each_vf(bp, vf_idx) {
3503+ /* locate this VFs bulletin board and update the channel down
3504+ * bit
3505+ */
3506+ bulletin = BP_VF_BULLETIN(bp, vf_idx);
3507+ bulletin->valid_bitmap |= 1 << CHANNEL_DOWN;
3508+
3509+ /* update vf bulletin board */
3510+ bnx2x_post_vf_bulletin(bp, vf_idx);
3511+ }
3512+}
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h+6−3
@@ -197,7 +197,7 @@ struct bnx2x_virtf { · 196 unmodified lines
197197
198198 u8 state;
199199 #define VF_FREE 0 /* VF ready to be acquired holds no resc */
200−#define VF_ACQUIRED 1 /* VF aquired, but not initalized */
200+#define VF_ACQUIRED 1 /* VF acquired, but not initialized */
201201 #define VF_ENABLED 2 /* VF Enabled */
202202 #define VF_RESET 3 /* VF FLR'd, pending cleanup */
203203
@@ -496,7 +496,7 @@ enum { · 292 unmodified lines
496496 else if ((next) == VFOP_VERIFY_PEND) \
497497 BNX2X_ERR("expected pending\n"); \
498498 else { \
499− DP(BNX2X_MSG_IOV, "no ramrod. scheduling\n"); \
499+ DP(BNX2X_MSG_IOV, "no ramrod. Scheduling\n"); \
500500 atomic_set(&vf->op_in_progress, 1); \
501501 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); \
502502 return; \
@@ -722,7 +722,6 @@ u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp, · 219 unmodified lines
722722 struct pf_vf_bulletin_content *bulletin);
723723 int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf);
724724
725−
726725 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
727726
728727 /* VF side vfpf channel functions */
@@ -752,6 +751,7 @@ static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp, · 23 unmodified lines
752751 }
753752
754753 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
754+void bnx2x_timer_sriov(struct bnx2x *bp);
755755 void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp);
756756 int bnx2x_vf_pci_alloc(struct bnx2x *bp);
757757 int bnx2x_enable_sriov(struct bnx2x *bp);
@@ -762,6 +762,7 @@ static inline int bnx2x_vf_headroom(struct bnx2x *bp) · 4 unmodified lines
762762 }
763763 void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
764764 int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
765+void bnx2x_iov_channel_down(struct bnx2x *bp);
765766 int bnx2x_open_epilog(struct bnx2x *bp);
766767
767768 #else /* CONFIG_BNX2X_SRIOV */
@@ -809,6 +810,7 @@ static inline enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp · 41 unmodified lines
809810 {
810811 return PFVF_BULLETIN_UNCHANGED;
811812 }
813+static inline void bnx2x_timer_sriov(struct bnx2x *bp) {}
812814
813815 static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
814816 {
@@ -818,6 +820,7 @@ static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp) · 3 unmodified lines
818820 static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
819821 static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
820822 static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
823+static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
821824 static inline int bnx2x_open_epilog(struct bnx2x *bp) {return 0; }
822825
823826 #endif /* CONFIG_BNX2X_SRIOV */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c+0−1
@@ -1002,7 +1002,6 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp) · 1001 unmodified lines
10021002 qstats->valid_bytes_received_lo =
10031003 qstats->total_bytes_received_lo;
10041004
1005−
10061005 UPDATE_EXTEND_TSTAT(rcv_ucast_pkts,
10071006 total_unicast_packets_received);
10081007 UPDATE_EXTEND_TSTAT(rcv_mcast_pkts,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h+0−4
@@ -40,7 +40,6 @@ struct nig_stats { · 39 unmodified lines
4040 u32 egress_mac_pkt1_hi;
4141 };
4242
43−
4443 enum bnx2x_stats_event {
4544 STATS_EVENT_PMF = 0,
4645 STATS_EVENT_LINK_UP,
@@ -208,7 +207,6 @@ struct bnx2x_eth_stats { · 161 unmodified lines
208207 u32 eee_tx_lpi;
209208 };
210209
211−
212210 struct bnx2x_eth_q_stats {
213211 u32 total_unicast_bytes_received_hi;
214212 u32 total_unicast_bytes_received_lo;
@@ -331,7 +329,6 @@ struct bnx2x_fw_port_stats_old { · 116 unmodified lines
331329 u32 mac_discard;
332330 };
333331
334−
335332 /****************************************************************************
336333 * Macros
337334 ****************************************************************************/
@@ -536,7 +533,6 @@ struct bnx2x_fw_port_stats_old { · 198 unmodified lines
536533 SUB_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
537534 } while (0)
538535
539−
540536 /* forward */
541537 struct bnx2x;
542538
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c+23−10
@@ -113,7 +113,7 @@ static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping) · 112 unmodified lines
113113 {
114114 struct cstorm_vf_zone_data __iomem *zone_data =
115115 REG_ADDR(bp, PXP_VF_ADDR_CSDM_GLOBAL_START);
116− int tout = 600, interval = 100; /* wait for 60 seconds */
116+ int tout = 100, interval = 100; /* wait for 10 seconds */
117117
118118 if (*done) {
119119 BNX2X_ERR("done was non zero before message to pf was sent\n");
@@ -121,6 +121,16 @@ static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping) · 1 unmodified line
121121 return -EINVAL;
122122 }
123123
124+ /* if PF indicated channel is down avoid sending message. Return success
125+ * so calling flow can continue
126+ */
127+ bnx2x_sample_bulletin(bp);
128+ if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) {
129+ DP(BNX2X_MSG_IOV, "detecting channel down. Aborting message\n");
130+ *done = PFVF_STATUS_SUCCESS;
131+ return 0;
132+ }
133+
124134 /* Write message address */
125135 writel(U64_LO(msg_mapping),
126136 &zone_data->non_trigger.vf_pf_channel.msg_addr_lo);
@@ -233,7 +243,7 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count) · 106 unmodified lines
233243
234244 attempts++;
235245
236− /* test whether the PF accepted our request. If not, humble the
246+ /* test whether the PF accepted our request. If not, humble
237247 * the request and try again.
238248 */
239249 if (bp->acquire_resp.hdr.status == PFVF_STATUS_SUCCESS) {
@@ -333,7 +343,7 @@ int bnx2x_vfpf_release(struct bnx2x *bp) · 93 unmodified lines
333343 DP(BNX2X_MSG_SP, "vf released\n");
334344 } else {
335345 /* PF reports error */
336− BNX2X_ERR("PF failed our release request - are we out of sync? response status: %d\n",
346+ BNX2X_ERR("PF failed our release request - are we out of sync? Response status: %d\n",
337347 resp->hdr.status);
338348 rc = -EAGAIN;
339349 goto out;
@@ -787,7 +797,7 @@ static inline void bnx2x_set_vf_mbxs_valid(struct bnx2x *bp) · 447 unmodified lines
787797 storm_memset_vf_mbx_valid(bp, bnx2x_vf(bp, i, abs_vfid));
788798 }
789799
790−/* enable vf_pf mailbox (aka vf-pf-chanell) */
800+/* enable vf_pf mailbox (aka vf-pf-channel) */
791801 void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid)
792802 {
793803 bnx2x_vf_flr_clnup_epilog(bp, abs_vfid);
@@ -844,7 +854,6 @@ static int bnx2x_copy32_vf_dmae(struct bnx2x *bp, u8 from_vf, · 50 unmodified lines
844854 dmae.dst_addr_hi = vf_addr_hi;
845855 }
846856 dmae.len = len32;
847− bnx2x_dp_dmae(bp, &dmae, BNX2X_MSG_DMAE);
848857
849858 /* issue the command and wait for completion */
850859 return bnx2x_issue_dmae_with_comp(bp, &dmae);
@@ -1072,7 +1081,7 @@ static void bnx2x_vf_mbx_set_q_flags(struct bnx2x *bp, u32 mbx_q_flags, · 221 unmodified lines
10721081 if (mbx_q_flags & VFPF_QUEUE_FLG_DHC)
10731082 __set_bit(BNX2X_Q_FLG_DHC, sp_q_flags);
10741083
1075− /* outer vlan removal is set according to the PF's multi fuction mode */
1084+ /* outer vlan removal is set according to PF's multi function mode */
10761085 if (IS_MF_SD(bp))
10771086 __set_bit(BNX2X_Q_FLG_OV, sp_q_flags);
10781087 }
@@ -1104,7 +1113,7 @@ static void bnx2x_vf_mbx_setup_q(struct bnx2x *bp, struct bnx2x_virtf *vf, · 25 unmodified lines
11041113 struct bnx2x_queue_init_params *init_p;
11051114 struct bnx2x_queue_setup_params *setup_p;
11061115
1107− /* reinit the VF operation context */
1116+ /* re-init the VF operation context */
11081117 memset(&vf->op_params.qctor, 0 , sizeof(vf->op_params.qctor));
11091118 setup_p = &vf->op_params.qctor.prep_qsetup;
11101119 init_p = &vf->op_params.qctor.qstate.params.init;
@@ -1588,8 +1597,9 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, · 477 unmodified lines
15881597 * support them. Or this may be because someone wrote a crappy
15891598 * VF driver and is sending garbage over the channel.
15901599 */
1591− BNX2X_ERR("unknown TLV. type %d length %d. first 20 bytes of mailbox buffer:\n",
1592− mbx->first_tlv.tl.type, mbx->first_tlv.tl.length);
1600+ BNX2X_ERR("unknown TLV. type %d length %d vf->state was %d. first 20 bytes of mailbox buffer:\n",
1601+ mbx->first_tlv.tl.type, mbx->first_tlv.tl.length,
1602+ vf->state);
15931603 for (i = 0; i < 20; i++)
15941604 DP_CONT(BNX2X_MSG_IOV, "%x ",
15951605 mbx->msg->req.tlv_buf_size.tlv_buffer[i]);
@@ -1605,8 +1615,11 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, · 9 unmodified lines
16051615 bnx2x_vf_mbx_resp(bp, vf);
16061616 } else {
16071617 /* can't send a response since this VF is unknown to us
1608− * just unlock the channel and be done with.
1618+ * just ack the FW to release the mailbox and unlock
1619+ * the channel.
16091620 */
1621+ storm_memset_vf_mbx_ack(bp, vf->abs_vfid);
1622+ mmiowb();
16101623 bnx2x_unlock_vf_pf_channel(bp, vf,
16111624 mbx->first_tlv.tl.type);
16121625 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h+4−1
@@ -331,7 +331,10 @@ struct pf_vf_bulletin_content { · 330 unmodified lines
331331 #define VLAN_VALID 1 /* when set, the vf should not access
332332 * the vfpf channel
333333 */
334−
334+#define CHANNEL_DOWN 2 /* vfpf channel is disabled. VFs are not
335+ * to attempt to send messages on the
336+ * channel after this bit is set
337+ */
335338 u8 mac[ETH_ALEN];
336339 u8 mac_padding[2];
337340
drivers/net/ethernet/broadcom/cnic.c+1−1
@@ -5622,7 +5622,7 @@ static void cnic_rcv_netevent(struct cnic_local *cp, unsigned long event, · 5621 unmodified lines
56225622 static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
56235623 void *ptr)
56245624 {
5625− struct net_device *netdev = ptr;
5625+ struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
56265626 struct cnic_dev *dev;
56275627 int new_dev = 0;
56285628
drivers/net/ethernet/broadcom/sb1250-mac.c+4−5
@@ -2197,7 +2197,7 @@ static const struct net_device_ops sbmac_netdev_ops = { · 2196 unmodified lines
21972197
21982198 static int sbmac_init(struct platform_device *pldev, long long base)
21992199 {
2200− struct net_device *dev = dev_get_drvdata(&pldev->dev);
2200+ struct net_device *dev = platform_get_drvdata(pldev);
22012201 int idx = pldev->id;
22022202 struct sbmac_softc *sc = netdev_priv(dev);
22032203 unsigned char *eaddr;
@@ -2275,7 +2275,7 @@ static int sbmac_init(struct platform_device *pldev, long long base) · 71 unmodified lines
22752275 dev->name);
22762276 goto free_mdio;
22772277 }
2278− dev_set_drvdata(&pldev->dev, sc->mii_bus);
2278+ platform_set_drvdata(pldev, sc->mii_bus);
22792279
22802280 err = register_netdev(dev);
22812281 if (err) {
@@ -2300,7 +2300,6 @@ static int sbmac_init(struct platform_device *pldev, long long base) · 18 unmodified lines
23002300 return 0;
23012301 unreg_mdio:
23022302 mdiobus_unregister(sc->mii_bus);
2303− dev_set_drvdata(&pldev->dev, NULL);
23042303 free_mdio:
23052304 mdiobus_free(sc->mii_bus);
23062305 uninit_ctx:
@@ -2624,7 +2623,7 @@ static int sbmac_probe(struct platform_device *pldev) · 317 unmodified lines
26242623 goto out_unmap;
26252624 }
26262625
2627− dev_set_drvdata(&pldev->dev, dev);
2626+ platform_set_drvdata(pldev, dev);
26282627 SET_NETDEV_DEV(dev, &pldev->dev);
26292628
26302629 sc = netdev_priv(dev);
@@ -2649,7 +2648,7 @@ out_out: · 18 unmodified lines
26492648
26502649 static int __exit sbmac_remove(struct platform_device *pldev)
26512650 {
2652− struct net_device *dev = dev_get_drvdata(&pldev->dev);
2651+ struct net_device *dev = platform_get_drvdata(pldev);
26532652 struct sbmac_softc *sc = netdev_priv(dev);
26542653
26552654 unregister_netdev(dev);
drivers/net/ethernet/broadcom/tg3.c+272−153
@@ -968,9 +968,6 @@ static void tg3_ape_driver_state_change(struct tg3 *tp, int kind) · 967 unmodified lines
968968
969969 event = APE_EVENT_STATUS_STATE_UNLOAD;
970970 break;
971− case RESET_KIND_SUSPEND:
972− event = APE_EVENT_STATUS_STATE_SUSPEND;
973− break;
974971 default:
975972 return;
976973 }
@@ -1317,8 +1314,8 @@ static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable) · 340 unmodified lines
13171314
13181315 if (err)
13191316 return err;
1320− if (enable)
13211317
1318+ if (enable)
13221319 val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
13231320 else
13241321 val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
@@ -1745,10 +1742,6 @@ static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) · 420 unmodified lines
17451742 break;
17461743 }
17471744 }
1748−
1749− if (kind == RESET_KIND_INIT ||
1750− kind == RESET_KIND_SUSPEND)
1751− tg3_ape_driver_state_change(tp, kind);
17521745 }
17531746
17541747 /* tp->lock is held. */
@@ -1770,9 +1763,6 @@ static void tg3_write_sig_post_reset(struct tg3 *tp, int kind) · 15 unmodified lines
17701763 break;
17711764 }
17721765 }
1773−
1774− if (kind == RESET_KIND_SHUTDOWN)
1775− tg3_ape_driver_state_change(tp, kind);
17761766 }
17771767
17781768 /* tp->lock is held. */
@@ -2341,6 +2331,46 @@ static void tg3_phy_apply_otp(struct tg3 *tp) · 562 unmodified lines
23412331 tg3_phy_toggle_auxctl_smdsp(tp, false);
23422332 }
23432333
2334+static void tg3_eee_pull_config(struct tg3 *tp, struct ethtool_eee *eee)
2335+{
2336+ u32 val;
2337+ struct ethtool_eee *dest = &tp->eee;
2338+
2339+ if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
2340+ return;
2341+
2342+ if (eee)
2343+ dest = eee;
2344+
2345+ if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, TG3_CL45_D7_EEERES_STAT, &val))
2346+ return;
2347+
2348+ /* Pull eee_active */
2349+ if (val == TG3_CL45_D7_EEERES_STAT_LP_1000T ||
2350+ val == TG3_CL45_D7_EEERES_STAT_LP_100TX) {
2351+ dest->eee_active = 1;
2352+ } else
2353+ dest->eee_active = 0;
2354+
2355+ /* Pull lp advertised settings */
2356+ if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_LPABLE, &val))
2357+ return;
2358+ dest->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(val);
2359+
2360+ /* Pull advertised and eee_enabled settings */
2361+ if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, &val))
2362+ return;
2363+ dest->eee_enabled = !!val;
2364+ dest->advertised = mmd_eee_adv_to_ethtool_adv_t(val);
2365+
2366+ /* Pull tx_lpi_enabled */
2367+ val = tr32(TG3_CPMU_EEE_MODE);
2368+ dest->tx_lpi_enabled = !!(val & TG3_CPMU_EEEMD_LPI_IN_TX);
2369+
2370+ /* Pull lpi timer value */
2371+ dest->tx_lpi_timer = tr32(TG3_CPMU_EEE_DBTMR1) & 0xffff;
2372+}
2373+
23442374 static void tg3_phy_eee_adjust(struct tg3 *tp, bool current_link_up)
23452375 {
23462376 u32 val;
@@ -2364,11 +2394,8 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, bool current_link_up) · 17 unmodified lines
23642394
23652395 tw32(TG3_CPMU_EEE_CTRL, eeectl);
23662396
2367− tg3_phy_cl45_read(tp, MDIO_MMD_AN,
2368− TG3_CL45_D7_EEERES_STAT, &val);
2369−
2370− if (val == TG3_CL45_D7_EEERES_STAT_LP_1000T ||
2371− val == TG3_CL45_D7_EEERES_STAT_LP_100TX)
2397+ tg3_eee_pull_config(tp, NULL);
2398+ if (tp->eee.eee_active)
23722399 tp->setlpicnt = 2;
23732400 }
23742401
@@ -4192,6 +4219,8 @@ static int tg3_power_down_prepare(struct tg3 *tp) · 1817 unmodified lines
41924219
41934220 tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
41944221
4222+ tg3_ape_driver_state_change(tp, RESET_KIND_SHUTDOWN);
4223+
41954224 return 0;
41964225 }
41974226
@@ -4292,6 +4321,16 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) · 94 unmodified lines
42924321 /* Advertise 1000-BaseT EEE ability */
42934322 if (advertise & ADVERTISED_1000baseT_Full)
42944323 val |= MDIO_AN_EEE_ADV_1000T;
4324+
4325+ if (!tp->eee.eee_enabled) {
4326+ val = 0;
4327+ tp->eee.advertised = 0;
4328+ } else {
4329+ tp->eee.advertised = advertise &
4330+ (ADVERTISED_100baseT_Full |
4331+ ADVERTISED_1000baseT_Full);
4332+ }
4333+
42954334 err = tg3_phy_cl45_write(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, val);
42964335 if (err)
42974336 val = 0;
@@ -4536,26 +4575,23 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp) · 238 unmodified lines
45364575
45374576 static bool tg3_phy_eee_config_ok(struct tg3 *tp)
45384577 {
4539− u32 val;
4540− u32 tgtadv = 0;
4541− u32 advertising = tp->link_config.advertising;
4578+ struct ethtool_eee eee;
45424579
45434580 if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
45444581 return true;
45454582
4546− if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, &val))
4547− return false;
4548−
4549− val &= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
4550−
4551−
4552− if (advertising & ADVERTISED_100baseT_Full)
4553− tgtadv |= MDIO_AN_EEE_ADV_100TX;
4554− if (advertising & ADVERTISED_1000baseT_Full)
4555− tgtadv |= MDIO_AN_EEE_ADV_1000T;
4583+ tg3_eee_pull_config(tp, &eee);
45564584
4557− if (val != tgtadv)
4558− return false;
4585+ if (tp->eee.eee_enabled) {
4586+ if (tp->eee.advertised != eee.advertised ||
4587+ tp->eee.tx_lpi_timer != eee.tx_lpi_timer ||
4588+ tp->eee.tx_lpi_enabled != eee.tx_lpi_enabled)
4589+ return false;
4590+ } else {
4591+ /* EEE is disabled but we're advertising */
4592+ if (eee.advertised)
4593+ return false;
4594+ }
45594595
45604596 return true;
45614597 }
@@ -4656,6 +4692,42 @@ static void tg3_clear_mac_status(struct tg3 *tp) · 94 unmodified lines
46564692 udelay(40);
46574693 }
46584694
4695+static void tg3_setup_eee(struct tg3 *tp)
4696+{
4697+ u32 val;
4698+
4699+ val = TG3_CPMU_EEE_LNKIDL_PCIE_NL0 |
4700+ TG3_CPMU_EEE_LNKIDL_UART_IDL;
4701+ if (tg3_chip_rev_id(tp) == CHIPREV_ID_57765_A0)
4702+ val |= TG3_CPMU_EEE_LNKIDL_APE_TX_MT;
4703+
4704+ tw32_f(TG3_CPMU_EEE_LNKIDL_CTRL, val);
4705+
4706+ tw32_f(TG3_CPMU_EEE_CTRL,
4707+ TG3_CPMU_EEE_CTRL_EXIT_20_1_US);
4708+
4709+ val = TG3_CPMU_EEEMD_ERLY_L1_XIT_DET |
4710+ (tp->eee.tx_lpi_enabled ? TG3_CPMU_EEEMD_LPI_IN_TX : 0) |
4711+ TG3_CPMU_EEEMD_LPI_IN_RX |
4712+ TG3_CPMU_EEEMD_EEE_ENABLE;
4713+
4714+ if (tg3_asic_rev(tp) != ASIC_REV_5717)
4715+ val |= TG3_CPMU_EEEMD_SND_IDX_DET_EN;
4716+
4717+ if (tg3_flag(tp, ENABLE_APE))
4718+ val |= TG3_CPMU_EEEMD_APE_TX_DET_EN;
4719+
4720+ tw32_f(TG3_CPMU_EEE_MODE, tp->eee.eee_enabled ? val : 0);
4721+
4722+ tw32_f(TG3_CPMU_EEE_DBTMR1,
4723+ TG3_CPMU_DBTMR1_PCIEXIT_2047US |
4724+ (tp->eee.tx_lpi_timer & 0xffff));
4725+
4726+ tw32_f(TG3_CPMU_EEE_DBTMR2,
4727+ TG3_CPMU_DBTMR2_APE_TX_2047US |
4728+ TG3_CPMU_DBTMR2_TXIDXEQ_2047US);
4729+}
4730+
46594731 static int tg3_setup_copper_phy(struct tg3 *tp, bool force_reset)
46604732 {
46614733 bool current_link_up;
@@ -4822,8 +4894,10 @@ static int tg3_setup_copper_phy(struct tg3 *tp, bool force_reset) · 160 unmodified lines
48224894 */
48234895 if (!eee_config_ok &&
48244896 (tp->phy_flags & TG3_PHYFLG_KEEP_LINK_ON_PWRDN) &&
4825− !force_reset)
4897+ !force_reset) {
4898+ tg3_setup_eee(tp);
48264899 tg3_phy_reset(tp);
4900+ }
48274901 } else {
48284902 if (!(bmcr & BMCR_ANENABLE) &&
48294903 tp->link_config.speed == current_speed &&
@@ -6335,9 +6409,7 @@ static void tg3_tx_recover(struct tg3 *tp) · 1505 unmodified lines
63356409 "Please report the problem to the driver maintainer "
63366410 "and include system chipset information.\n");
63376411
6338− spin_lock(&tp->lock);
63396412 tg3_flag_set(tp, TX_RECOVERY_PENDING);
6340− spin_unlock(&tp->lock);
63416413 }
63426414
63436415 static inline u32 tg3_tx_avail(struct tg3_napi *tnapi)
@@ -9205,11 +9277,9 @@ static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) · 2861 unmodified lines
92059277 }
92069278
92079279 /* tp->lock is held. */
9208−static void tg3_rings_reset(struct tg3 *tp)
9280+static void tg3_tx_rcbs_disable(struct tg3 *tp)
92099281 {
9210− int i;
9211− u32 stblk, txrcb, rxrcb, limit;
9212− struct tg3_napi *tnapi = &tp->napi[0];
9282+ u32 txrcb, limit;
92139283
92149284 /* Disable all transmit rings but the first. */
92159285 if (!tg3_flag(tp, 5705_PLUS))
@@ -9226,7 +9296,33 @@ static void tg3_rings_reset(struct tg3 *tp) · 10 unmodified lines
92269296 txrcb < limit; txrcb += TG3_BDINFO_SIZE)
92279297 tg3_write_mem(tp, txrcb + TG3_BDINFO_MAXLEN_FLAGS,
92289298 BDINFO_FLAGS_DISABLED);
9299+}
9300+
9301+/* tp->lock is held. */
9302+static void tg3_tx_rcbs_init(struct tg3 *tp)
9303+{
9304+ int i = 0;
9305+ u32 txrcb = NIC_SRAM_SEND_RCB;
9306+
9307+ if (tg3_flag(tp, ENABLE_TSS))
9308+ i++;
9309+
9310+ for (; i < tp->irq_max; i++, txrcb += TG3_BDINFO_SIZE) {
9311+ struct tg3_napi *tnapi = &tp->napi[i];
9312+
9313+ if (!tnapi->tx_ring)
9314+ continue;
9315+
9316+ tg3_set_bdinfo(tp, txrcb, tnapi->tx_desc_mapping,
9317+ (TG3_TX_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT),
9318+ NIC_SRAM_TX_BUFFER_DESC);
9319+ }
9320+}
92299321
9322+/* tp->lock is held. */
9323+static void tg3_rx_ret_rcbs_disable(struct tg3 *tp)
9324+{
9325+ u32 rxrcb, limit;
92309326
92319327 /* Disable all receive return rings but the first. */
92329328 if (tg3_flag(tp, 5717_PLUS))
@@ -9244,6 +9340,39 @@ static void tg3_rings_reset(struct tg3 *tp) · 11 unmodified lines
92449340 rxrcb < limit; rxrcb += TG3_BDINFO_SIZE)
92459341 tg3_write_mem(tp, rxrcb + TG3_BDINFO_MAXLEN_FLAGS,
92469342 BDINFO_FLAGS_DISABLED);
9343+}
9344+
9345+/* tp->lock is held. */
9346+static void tg3_rx_ret_rcbs_init(struct tg3 *tp)
9347+{
9348+ int i = 0;
9349+ u32 rxrcb = NIC_SRAM_RCV_RET_RCB;
9350+
9351+ if (tg3_flag(tp, ENABLE_RSS))
9352+ i++;
9353+
9354+ for (; i < tp->irq_max; i++, rxrcb += TG3_BDINFO_SIZE) {
9355+ struct tg3_napi *tnapi = &tp->napi[i];
9356+
9357+ if (!tnapi->rx_rcb)
9358+ continue;
9359+
9360+ tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
9361+ (tp->rx_ret_ring_mask + 1) <<
9362+ BDINFO_FLAGS_MAXLEN_SHIFT, 0);
9363+ }
9364+}
9365+
9366+/* tp->lock is held. */
9367+static void tg3_rings_reset(struct tg3 *tp)
9368+{
9369+ int i;
9370+ u32 stblk;
9371+ struct tg3_napi *tnapi = &tp->napi[0];
9372+
9373+ tg3_tx_rcbs_disable(tp);
9374+
9375+ tg3_rx_ret_rcbs_disable(tp);
92479376
92489377 /* Disable interrupts */
92499378 tw32_mailbox_f(tp->napi[0].int_mbox, 1);
@@ -9280,9 +9409,6 @@ static void tg3_rings_reset(struct tg3 *tp) · 30 unmodified lines
92809409 tw32_tx_mbox(mbox + i * 8, 0);
92819410 }
92829411
9283− txrcb = NIC_SRAM_SEND_RCB;
9284− rxrcb = NIC_SRAM_RCV_RET_RCB;
9285−
92869412 /* Clear status block in ram. */
92879413 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
92889414
@@ -9292,46 +9418,20 @@ static void tg3_rings_reset(struct tg3 *tp) · 3 unmodified lines
92929418 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
92939419 ((u64) tnapi->status_mapping & 0xffffffff));
92949420
9295− if (tnapi->tx_ring) {
9296− tg3_set_bdinfo(tp, txrcb, tnapi->tx_desc_mapping,
9297− (TG3_TX_RING_SIZE <<
9298− BDINFO_FLAGS_MAXLEN_SHIFT),
9299− NIC_SRAM_TX_BUFFER_DESC);
9300− txrcb += TG3_BDINFO_SIZE;
9301− }
9302−
9303− if (tnapi->rx_rcb) {
9304− tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
9305− (tp->rx_ret_ring_mask + 1) <<
9306− BDINFO_FLAGS_MAXLEN_SHIFT, 0);
9307− rxrcb += TG3_BDINFO_SIZE;
9308− }
9309−
93109421 stblk = HOSTCC_STATBLCK_RING1;
93119422
93129423 for (i = 1, tnapi++; i < tp->irq_cnt; i++, tnapi++) {
93139424 u64 mapping = (u64)tnapi->status_mapping;
93149425 tw32(stblk + TG3_64BIT_REG_HIGH, mapping >> 32);
93159426 tw32(stblk + TG3_64BIT_REG_LOW, mapping & 0xffffffff);
9427+ stblk += 8;
93169428
93179429 /* Clear status block in ram. */
93189430 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
9319−
9320− if (tnapi->tx_ring) {
9321− tg3_set_bdinfo(tp, txrcb, tnapi->tx_desc_mapping,
9322− (TG3_TX_RING_SIZE <<
9323− BDINFO_FLAGS_MAXLEN_SHIFT),
9324− NIC_SRAM_TX_BUFFER_DESC);
9325− txrcb += TG3_BDINFO_SIZE;
9326− }
9327−
9328− tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
9329− ((tp->rx_ret_ring_mask + 1) <<
9330− BDINFO_FLAGS_MAXLEN_SHIFT), 0);
9331−
9332− stblk += 8;
9333− rxrcb += TG3_BDINFO_SIZE;
93349431 }
9432+
9433+ tg3_tx_rcbs_init(tp);
9434+ tg3_rx_ret_rcbs_init(tp);
93359435 }
93369436
93379437 static void tg3_setup_rxbd_thresholds(struct tg3 *tp)
@@ -9531,46 +9631,17 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) · 193 unmodified lines
95319631 if (tg3_flag(tp, INIT_COMPLETE))
95329632 tg3_abort_hw(tp, 1);
95339633
9534− /* Enable MAC control of LPI */
9535− if (tp->phy_flags & TG3_PHYFLG_EEE_CAP) {
9536− val = TG3_CPMU_EEE_LNKIDL_PCIE_NL0 |
9537− TG3_CPMU_EEE_LNKIDL_UART_IDL;
9538− if (tg3_chip_rev_id(tp) == CHIPREV_ID_57765_A0)
9539− val |= TG3_CPMU_EEE_LNKIDL_APE_TX_MT;
9540−
9541− tw32_f(TG3_CPMU_EEE_LNKIDL_CTRL, val);
9542−
9543− tw32_f(TG3_CPMU_EEE_CTRL,
9544− TG3_CPMU_EEE_CTRL_EXIT_20_1_US);
9545−
9546− val = TG3_CPMU_EEEMD_ERLY_L1_XIT_DET |
9547− TG3_CPMU_EEEMD_LPI_IN_TX |
9548− TG3_CPMU_EEEMD_LPI_IN_RX |
9549− TG3_CPMU_EEEMD_EEE_ENABLE;
9550−
9551− if (tg3_asic_rev(tp) != ASIC_REV_5717)
9552− val |= TG3_CPMU_EEEMD_SND_IDX_DET_EN;
9553−
9554− if (tg3_flag(tp, ENABLE_APE))
9555− val |= TG3_CPMU_EEEMD_APE_TX_DET_EN;
9556−
9557− tw32_f(TG3_CPMU_EEE_MODE, val);
9558−
9559− tw32_f(TG3_CPMU_EEE_DBTMR1,
9560− TG3_CPMU_DBTMR1_PCIEXIT_2047US |
9561− TG3_CPMU_DBTMR1_LNKIDLE_2047US);
9562−
9563− tw32_f(TG3_CPMU_EEE_DBTMR2,
9564− TG3_CPMU_DBTMR2_APE_TX_2047US |
9565− TG3_CPMU_DBTMR2_TXIDXEQ_2047US);
9566− }
9567−
95689634 if ((tp->phy_flags & TG3_PHYFLG_KEEP_LINK_ON_PWRDN) &&
95699635 !(tp->phy_flags & TG3_PHYFLG_USER_CONFIGURED)) {
95709636 tg3_phy_pull_config(tp);
9637+ tg3_eee_pull_config(tp, NULL);
95719638 tp->phy_flags |= TG3_PHYFLG_USER_CONFIGURED;
95729639 }
95739640
9641+ /* Enable MAC control of LPI */
9642+ if (tp->phy_flags & TG3_PHYFLG_EEE_CAP)
9643+ tg3_setup_eee(tp);
9644+
95749645 if (reset_phy)
95759646 tg3_phy_reset(tp);
95769647
@@ -11226,7 +11297,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 1649 unmodified lines
1122611297 */
1122711298 err = tg3_alloc_consistent(tp);
1122811299 if (err)
11229− goto err_out1;
11300+ goto out_ints_fini;
1123011301
1123111302 tg3_napi_init(tp);
1123211303
@@ -11240,12 +11311,15 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 7 unmodified lines
1124011311 tnapi = &tp->napi[i];
1124111312 free_irq(tnapi->irq_vec, tnapi);
1124211313 }
11243− goto err_out2;
11314+ goto out_napi_fini;
1124411315 }
1124511316 }
1124611317
1124711318 tg3_full_lock(tp, 0);
1124811319
11320+ if (init)
11321+ tg3_ape_driver_state_change(tp, RESET_KIND_INIT);
11322+
1124911323 err = tg3_init_hw(tp, reset_phy);
1125011324 if (err) {
1125111325 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
@@ -11255,7 +11329,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 3 unmodified lines
1125511329 tg3_full_unlock(tp);
1125611330
1125711331 if (err)
11258− goto err_out3;
11332+ goto out_free_irq;
1125911333
1126011334 if (test_irq && tg3_flag(tp, USING_MSI)) {
1126111335 err = tg3_test_msi(tp);
@@ -11266,7 +11340,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 4 unmodified lines
1126611340 tg3_free_rings(tp);
1126711341 tg3_full_unlock(tp);
1126811342
11269− goto err_out2;
11343+ goto out_napi_fini;
1127011344 }
1127111345
1127211346 if (!tg3_flag(tp, 57765_PLUS) && tg3_flag(tp, USING_MSI)) {
@@ -11306,18 +11380,18 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 33 unmodified lines
1130611380
1130711381 return 0;
1130811382
11309−err_out3:
11383+out_free_irq:
1131011384 for (i = tp->irq_cnt - 1; i >= 0; i--) {
1131111385 struct tg3_napi *tnapi = &tp->napi[i];
1131211386 free_irq(tnapi->irq_vec, tnapi);
1131311387 }
1131411388
11315−err_out2:
11389+out_napi_fini:
1131611390 tg3_napi_disable(tp);
1131711391 tg3_napi_fini(tp);
1131811392 tg3_free_consistent(tp);
1131911393
11320−err_out1:
11394+out_ints_fini:
1132111395 tg3_ints_fini(tp);
1132211396
1132311397 return err;
@@ -13362,11 +13436,13 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, · 2038 unmodified lines
1336213436 struct tg3 *tp = netdev_priv(dev);
1336313437 bool doextlpbk = etest->flags & ETH_TEST_FL_EXTERNAL_LB;
1336413438
13365− if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) &&
13366− tg3_power_up(tp)) {
13367− etest->flags |= ETH_TEST_FL_FAILED;
13368− memset(data, 1, sizeof(u64) * TG3_NUM_TEST);
13369− return;
13439+ if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
13440+ if (tg3_power_up(tp)) {
13441+ etest->flags |= ETH_TEST_FL_FAILED;
13442+ memset(data, 1, sizeof(u64) * TG3_NUM_TEST);
13443+ return;
13444+ }
13445+ tg3_ape_driver_state_change(tp, RESET_KIND_INIT);
1337013446 }
1337113447
1337213448 memset(data, 0, sizeof(u64) * TG3_NUM_TEST);
@@ -13657,6 +13733,57 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) · 284 unmodified lines
1365713733 return 0;
1365813734 }
1365913735
13736+static int tg3_set_eee(struct net_device *dev, struct ethtool_eee *edata)
13737+{
13738+ struct tg3 *tp = netdev_priv(dev);
13739+
13740+ if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP)) {
13741+ netdev_warn(tp->dev, "Board does not support EEE!\n");
13742+ return -EOPNOTSUPP;
13743+ }
13744+
13745+ if (edata->advertised != tp->eee.advertised) {
13746+ netdev_warn(tp->dev,
13747+ "Direct manipulation of EEE advertisement is not supported\n");
13748+ return -EINVAL;
13749+ }
13750+
13751+ if (edata->tx_lpi_timer > TG3_CPMU_DBTMR1_LNKIDLE_MAX) {
13752+ netdev_warn(tp->dev,
13753+ "Maximal Tx Lpi timer supported is %#x(u)\n",
13754+ TG3_CPMU_DBTMR1_LNKIDLE_MAX);
13755+ return -EINVAL;
13756+ }
13757+
13758+ tp->eee = *edata;
13759+
13760+ tp->phy_flags |= TG3_PHYFLG_USER_CONFIGURED;
13761+ tg3_warn_mgmt_link_flap(tp);
13762+
13763+ if (netif_running(tp->dev)) {
13764+ tg3_full_lock(tp, 0);
13765+ tg3_setup_eee(tp);
13766+ tg3_phy_reset(tp);
13767+ tg3_full_unlock(tp);
13768+ }
13769+
13770+ return 0;
13771+}
13772+
13773+static int tg3_get_eee(struct net_device *dev, struct ethtool_eee *edata)
13774+{
13775+ struct tg3 *tp = netdev_priv(dev);
13776+
13777+ if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP)) {
13778+ netdev_warn(tp->dev,
13779+ "Board does not support EEE!\n");
13780+ return -EOPNOTSUPP;
13781+ }
13782+
13783+ *edata = tp->eee;
13784+ return 0;
13785+}
13786+
1366013787 static const struct ethtool_ops tg3_ethtool_ops = {
1366113788 .get_settings = tg3_get_settings,
1366213789 .set_settings = tg3_set_settings,
@@ -13690,6 +13817,8 @@ static const struct ethtool_ops tg3_ethtool_ops = { · 27 unmodified lines
1369013817 .get_channels = tg3_get_channels,
1369113818 .set_channels = tg3_set_channels,
1369213819 .get_ts_info = tg3_get_ts_info,
13820+ .get_eee = tg3_get_eee,
13821+ .set_eee = tg3_set_eee,
1369313822 };
1369413823
1369513824 static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
@@ -15038,9 +15167,18 @@ static int tg3_phy_probe(struct tg3 *tp) · 1342 unmodified lines
1503815167 (tg3_asic_rev(tp) == ASIC_REV_5717 &&
1503915168 tg3_chip_rev_id(tp) != CHIPREV_ID_5717_A0) ||
1504015169 (tg3_asic_rev(tp) == ASIC_REV_57765 &&
15041− tg3_chip_rev_id(tp) != CHIPREV_ID_57765_A0)))
15170+ tg3_chip_rev_id(tp) != CHIPREV_ID_57765_A0))) {
1504215171 tp->phy_flags |= TG3_PHYFLG_EEE_CAP;
1504315172
15173+ tp->eee.supported = SUPPORTED_100baseT_Full |
15174+ SUPPORTED_1000baseT_Full;
15175+ tp->eee.advertised = ADVERTISED_100baseT_Full |
15176+ ADVERTISED_1000baseT_Full;
15177+ tp->eee.eee_enabled = 1;
15178+ tp->eee.tx_lpi_enabled = 1;
15179+ tp->eee.tx_lpi_timer = TG3_CPMU_DBTMR1_LNKIDLE_2047US;
15180+ }
15181+
1504415182 tg3_phy_init_link_config(tp);
1504515183
1504615184 if (!(tp->phy_flags & TG3_PHYFLG_KEEP_LINK_ON_PWRDN) &&
@@ -17112,7 +17250,7 @@ static int tg3_init_one(struct pci_dev *pdev, · 2065 unmodified lines
1711217250 {
1711317251 struct net_device *dev;
1711417252 struct tg3 *tp;
17115− int i, err, pm_cap;
17253+ int i, err;
1711617254 u32 sndmbx, rcvmbx, intmbx;
1711717255 char str[40];
1711817256 u64 dma_mask, persist_dma_mask;
@@ -17134,25 +17272,10 @@ static int tg3_init_one(struct pci_dev *pdev, · 15 unmodified lines
1713417272
1713517273 pci_set_master(pdev);
1713617274
17137− /* Find power-management capability. */
17138− pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
17139− if (pm_cap == 0) {
17140− dev_err(&pdev->dev,
17141− "Cannot find Power Management capability, aborting\n");
17142− err = -EIO;
17143− goto err_out_free_res;
17144− }
17145−
17146− err = pci_set_power_state(pdev, PCI_D0);
17147− if (err) {
17148− dev_err(&pdev->dev, "Transition to D0 failed, aborting\n");
17149− goto err_out_free_res;
17150− }
17151−
1715217275 dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
1715317276 if (!dev) {
1715417277 err = -ENOMEM;
17155− goto err_out_power_down;
17278+ goto err_out_free_res;
1715617279 }
1715717280
1715817281 SET_NETDEV_DEV(dev, &pdev->dev);
@@ -17160,7 +17283,7 @@ static int tg3_init_one(struct pci_dev *pdev, · 1 unmodified line
1716017283 tp = netdev_priv(dev);
1716117284 tp->pdev = pdev;
1716217285 tp->dev = dev;
17163− tp->pm_cap = pm_cap;
17286+ tp->pm_cap = pdev->pm_cap;
1716417287 tp->rx_mode = TG3_DEF_RX_MODE;
1716517288 tp->tx_mode = TG3_DEF_TX_MODE;
1716617289 tp->irq_sync = 1;
@@ -17498,9 +17621,6 @@ err_out_iounmap: · 331 unmodified lines
1749817621 err_out_free_dev:
1749917622 free_netdev(dev);
1750017623
17501−err_out_power_down:
17502− pci_set_power_state(pdev, PCI_D3hot);
17503−
1750417624 err_out_free_res:
1750517625 pci_release_regions(pdev);
1750617626
@@ -17610,6 +17730,8 @@ static int tg3_resume(struct device *device) · 103 unmodified lines
1761017730
1761117731 tg3_full_lock(tp, 0);
1761217732
17733+ tg3_ape_driver_state_change(tp, RESET_KIND_INIT);
17734+
1761317735 tg3_flag_set(tp, INIT_COMPLETE);
1761417736 err = tg3_restart_hw(tp,
1761517737 !(tp->phy_flags & TG3_PHYFLG_KEEP_LINK_ON_PWRDN));
@@ -17671,10 +17793,13 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, · 55 unmodified lines
1767117793 tg3_full_unlock(tp);
1767217794
1767317795 done:
17674− if (state == pci_channel_io_perm_failure)
17796+ if (state == pci_channel_io_perm_failure) {
17797+ tg3_napi_enable(tp);
17798+ dev_close(netdev);
1767517799 err = PCI_ERS_RESULT_DISCONNECT;
17676− else
17800+ } else {
1767717801 pci_disable_device(pdev);
17802+ }
1767817803
1767917804 rtnl_unlock();
1768017805
@@ -17720,6 +17845,10 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) · 39 unmodified lines
1772017845 rc = PCI_ERS_RESULT_RECOVERED;
1772117846
1772217847 done:
17848+ if (rc != PCI_ERS_RESULT_RECOVERED && netif_running(netdev)) {
17849+ tg3_napi_enable(tp);
17850+ dev_close(netdev);
17851+ }
1772317852 rtnl_unlock();
1772417853
1772517854 return rc;
@@ -17744,6 +17873,7 @@ static void tg3_io_resume(struct pci_dev *pdev) · 18 unmodified lines
1774417873 goto done;
1774517874
1774617875 tg3_full_lock(tp, 0);
17876+ tg3_ape_driver_state_change(tp, RESET_KIND_INIT);
1774717877 tg3_flag_set(tp, INIT_COMPLETE);
1774817878 err = tg3_restart_hw(tp, true);
1774917879 if (err) {
@@ -17781,15 +17911,4 @@ static struct pci_driver tg3_driver = { · 31 unmodified lines
1778117911 .driver.pm = &tg3_pm_ops,
1778217912 };
1778317913
17784−static int __init tg3_init(void)
17785−{
17786− return pci_register_driver(&tg3_driver);
17787−}
17788−
17789−static void __exit tg3_cleanup(void)
17790−{
17791− pci_unregister_driver(&tg3_driver);
17792−}
17793−
17794−module_init(tg3_init);
17795−module_exit(tg3_cleanup);
17914+module_pci_driver(tg3_driver);
drivers/net/ethernet/broadcom/tg3.h+2−0
@@ -1175,6 +1175,7 @@ · 1174 unmodified lines
11751175 #define TG3_CPMU_EEE_DBTMR1 0x000036b4
11761176 #define TG3_CPMU_DBTMR1_PCIEXIT_2047US 0x07ff0000
11771177 #define TG3_CPMU_DBTMR1_LNKIDLE_2047US 0x000007ff
1178+#define TG3_CPMU_DBTMR1_LNKIDLE_MAX 0x0000ffff
11781179 #define TG3_CPMU_EEE_DBTMR2 0x000036b8
11791180 #define TG3_CPMU_DBTMR2_APE_TX_2047US 0x07ff0000
11801181 #define TG3_CPMU_DBTMR2_TXIDXEQ_2047US 0x000007ff
@@ -3372,6 +3373,7 @@ struct tg3 { · 2191 unmodified lines
33723373 unsigned int irq_cnt;
33733374
33743375 struct ethtool_coalesce coal;
3376+ struct ethtool_eee eee;
33753377
33763378 /* firmware info */
33773379 const char *fw_needed;
drivers/net/ethernet/brocade/bna/bfa_defs.h+2−1
@@ -164,7 +164,8 @@ struct bfa_ioc_attr { · 163 unmodified lines
164164 u8 port_mode; /*!< enum bfa_mode */
165165 u8 cap_bm; /*!< capability */
166166 u8 port_mode_cfg; /*!< enum bfa_mode */
167− u8 rsvd[4]; /*!< 64bit align */
167+ u8 def_fn; /*!< 1 if default fn */
168+ u8 rsvd[3]; /*!< 64bit align */
168169 };
169170
170171 /* Adapter capability mask definition */
drivers/net/ethernet/brocade/bna/bfa_ioc.c+4−3
@@ -2371,7 +2371,7 @@ bfa_nw_ioc_get_attr(struct bfa_ioc *ioc, struct bfa_ioc_attr *ioc_attr) · 2370 unmodified lines
23712371 memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr));
23722372
23732373 ioc_attr->state = bfa_ioc_get_state(ioc);
2374− ioc_attr->port_id = ioc->port_id;
2374+ ioc_attr->port_id = bfa_ioc_portid(ioc);
23752375 ioc_attr->port_mode = ioc->port_mode;
23762376
23772377 ioc_attr->port_mode_cfg = ioc->port_mode_cfg;
@@ -2381,8 +2381,9 @@ bfa_nw_ioc_get_attr(struct bfa_ioc *ioc, struct bfa_ioc_attr *ioc_attr) · 3 unmodified lines
23812381
23822382 bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr);
23832383
2384− ioc_attr->pci_attr.device_id = ioc->pcidev.device_id;
2385− ioc_attr->pci_attr.pcifn = ioc->pcidev.pci_func;
2384+ ioc_attr->pci_attr.device_id = bfa_ioc_devid(ioc);
2385+ ioc_attr->pci_attr.pcifn = bfa_ioc_pcifn(ioc);
2386+ ioc_attr->def_fn = bfa_ioc_is_default(ioc);
23862387 bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev);
23872388 }
23882389
drivers/net/ethernet/brocade/bna/bfa_ioc.h+2−0
@@ -222,6 +222,8 @@ struct bfa_ioc_hwif { · 221 unmodified lines
222222 #define bfa_ioc_bar0(__ioc) ((__ioc)->pcidev.pci_bar_kva)
223223 #define bfa_ioc_portid(__ioc) ((__ioc)->port_id)
224224 #define bfa_ioc_asic_gen(__ioc) ((__ioc)->asic_gen)
225+#define bfa_ioc_is_default(__ioc) \
226+ (bfa_ioc_pcifn(__ioc) == bfa_ioc_portid(__ioc))
225227 #define bfa_ioc_fetch_stats(__ioc, __stats) \
226228 (((__stats)->drv_stats) = (__ioc)->stats)
227229 #define bfa_ioc_clr_stats(__ioc) \
drivers/net/ethernet/brocade/bna/bna.h+2−0
@@ -455,6 +455,8 @@ void bna_bfi_rx_enet_stop_rsp(struct bna_rx *rx, · 454 unmodified lines
455455 void bna_bfi_rxf_cfg_rsp(struct bna_rxf *rxf, struct bfi_msgq_mhdr *msghdr);
456456 void bna_bfi_rxf_mcast_add_rsp(struct bna_rxf *rxf,
457457 struct bfi_msgq_mhdr *msghdr);
458+void bna_bfi_rxf_ucast_set_rsp(struct bna_rxf *rxf,
459+ struct bfi_msgq_mhdr *msghdr);
458460
459461 /* APIs for BNA */
460462 void bna_rx_mod_init(struct bna_rx_mod *rx_mod, struct bna *bna,
drivers/net/ethernet/brocade/bna/bna_enet.c+6−1
@@ -298,7 +298,6 @@ bna_msgq_rsp_handler(void *arg, struct bfi_msgq_mhdr *msghdr) · 297 unmodified lines
298298 case BFI_ENET_I2H_RSS_ENABLE_RSP:
299299 case BFI_ENET_I2H_RX_PROMISCUOUS_RSP:
300300 case BFI_ENET_I2H_RX_DEFAULT_RSP:
301− case BFI_ENET_I2H_MAC_UCAST_SET_RSP:
302301 case BFI_ENET_I2H_MAC_UCAST_CLR_RSP:
303302 case BFI_ENET_I2H_MAC_UCAST_ADD_RSP:
304303 case BFI_ENET_I2H_MAC_UCAST_DEL_RSP:
@@ -311,6 +310,12 @@ bna_msgq_rsp_handler(void *arg, struct bfi_msgq_mhdr *msghdr) · 6 unmodified lines
311310 bna_bfi_rxf_cfg_rsp(&rx->rxf, msghdr);
312311 break;
313312
313+ case BFI_ENET_I2H_MAC_UCAST_SET_RSP:
314+ bna_rx_from_rid(bna, msghdr->enet_id, rx);
315+ if (rx)
316+ bna_bfi_rxf_ucast_set_rsp(&rx->rxf, msghdr);
317+ break;
318+
314319 case BFI_ENET_I2H_MAC_MCAST_ADD_RSP:
315320 bna_rx_from_rid(bna, msghdr->enet_id, rx);
316321 if (rx)
drivers/net/ethernet/brocade/bna/bna_tx_rx.c+15−0
@@ -710,6 +710,21 @@ bna_bfi_rxf_cfg_rsp(struct bna_rxf *rxf, struct bfi_msgq_mhdr *msghdr) · 709 unmodified lines
710710 bfa_fsm_send_event(rxf, RXF_E_FW_RESP);
711711 }
712712
713+void
714+bna_bfi_rxf_ucast_set_rsp(struct bna_rxf *rxf,
715+ struct bfi_msgq_mhdr *msghdr)
716+{
717+ struct bfi_enet_rsp *rsp =
718+ (struct bfi_enet_rsp *)msghdr;
719+
720+ if (rsp->error) {
721+ /* Clear ucast from cache */
722+ rxf->ucast_active_set = 0;
723+ }
724+
725+ bfa_fsm_send_event(rxf, RXF_E_FW_RESP);
726+}
727+
713728 void
714729 bna_bfi_rxf_mcast_add_rsp(struct bna_rxf *rxf,
715730 struct bfi_msgq_mhdr *msghdr)
drivers/net/ethernet/brocade/bna/bnad.c+3−0
@@ -2624,6 +2624,9 @@ bnad_stop(struct net_device *netdev) · 2623 unmodified lines
26242624 bnad_destroy_tx(bnad, 0);
26252625 bnad_destroy_rx(bnad, 0);
26262626
2627+ /* These config flags are cleared in the hardware */
2628+ bnad->cfg_flags &= ~(BNAD_CF_ALLMULTI | BNAD_CF_PROMISC);
2629+
26272630 /* Synchronize mailbox IRQ */
26282631 bnad_mbox_irq_sync(bnad);
26292632
drivers/net/ethernet/brocade/bna/bnad.h+1−1
@@ -71,7 +71,7 @@ struct bnad_rx_ctrl { · 70 unmodified lines
7171 #define BNAD_NAME "bna"
7272 #define BNAD_NAME_LEN 64
7373
74−#define BNAD_VERSION "3.1.2.1"
74+#define BNAD_VERSION "3.2.21.1"
7575
7676 #define BNAD_MAILBOX_MSIX_INDEX 0
7777 #define BNAD_MAILBOX_MSIX_VECTORS 1
drivers/net/ethernet/brocade/bna/cna.h+2−2
@@ -37,8 +37,8 @@ · 36 unmodified lines
3737
3838 extern char bfa_version[];
3939
40−#define CNA_FW_FILE_CT "ctfw-3.1.0.0.bin"
41−#define CNA_FW_FILE_CT2 "ct2fw-3.1.0.0.bin"
40+#define CNA_FW_FILE_CT "ctfw-3.2.1.0.bin"
41+#define CNA_FW_FILE_CT2 "ct2fw-3.2.1.0.bin"
4242 #define FC_SYMNAME_MAX 256 /*!< max name server symbolic name size */
4343
4444 #pragma pack(1)
drivers/net/ethernet/cadence/Kconfig+0−1
@@ -23,7 +23,6 @@ if NET_CADENCE · 22 unmodified lines
2323 config ARM_AT91_ETHER
2424 tristate "AT91RM9200 Ethernet support"
2525 depends on GENERIC_HARDIRQS && HAS_DMA
26− select NET_CORE
2726 select MACB
2827 ---help---
2928 If you wish to compile a kernel for the AT91RM9200 and enable
drivers/net/ethernet/cadence/at91_ether.c+0−1
@@ -435,7 +435,6 @@ static int at91ether_remove(struct platform_device *pdev) · 434 unmodified lines
435435 unregister_netdev(dev);
436436 clk_disable(lp->pclk);
437437 free_netdev(dev);
438− platform_set_drvdata(pdev, NULL);
439438
440439 return 0;
441440 }
drivers/net/ethernet/cadence/macb.c+282−45
@@ -32,7 +32,8 @@ · 31 unmodified lines
3232
3333 #include "macb.h"
3434
35−#define RX_BUFFER_SIZE 128
35+#define MACB_RX_BUFFER_SIZE 128
36+#define RX_BUFFER_MULTIPLE 64 /* bytes */
3637 #define RX_RING_SIZE 512 /* must be power of 2 */
3738 #define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE)
3839
@@ -92,7 +93,7 @@ static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index) · 53 unmodified lines
9293
9394 static void *macb_rx_buffer(struct macb *bp, unsigned int index)
9495 {
95− return bp->rx_buffers + RX_BUFFER_SIZE * macb_rx_ring_wrap(index);
96+ return bp->rx_buffers + bp->rx_buffer_size * macb_rx_ring_wrap(index);
9697 }
9798
9899 void macb_set_hwaddr(struct macb *bp)
@@ -528,6 +529,155 @@ static void macb_tx_interrupt(struct macb *bp) · 429 unmodified lines
528529 netif_wake_queue(bp->dev);
529530 }
530531
532+static void gem_rx_refill(struct macb *bp)
533+{
534+ unsigned int entry;
535+ struct sk_buff *skb;
536+ struct macb_dma_desc *desc;
537+ dma_addr_t paddr;
538+
539+ while (CIRC_SPACE(bp->rx_prepared_head, bp->rx_tail, RX_RING_SIZE) > 0) {
540+ u32 addr, ctrl;
541+
542+ entry = macb_rx_ring_wrap(bp->rx_prepared_head);
543+ desc = &bp->rx_ring[entry];
544+
545+ /* Make hw descriptor updates visible to CPU */
546+ rmb();
547+
548+ addr = desc->addr;
549+ ctrl = desc->ctrl;
550+ bp->rx_prepared_head++;
551+
552+ if ((addr & MACB_BIT(RX_USED)))
553+ continue;
554+
555+ if (bp->rx_skbuff[entry] == NULL) {
556+ /* allocate sk_buff for this free entry in ring */
557+ skb = netdev_alloc_skb(bp->dev, bp->rx_buffer_size);
558+ if (unlikely(skb == NULL)) {
559+ netdev_err(bp->dev,
560+ "Unable to allocate sk_buff\n");
561+ break;
562+ }
563+ bp->rx_skbuff[entry] = skb;
564+
565+ /* now fill corresponding descriptor entry */
566+ paddr = dma_map_single(&bp->pdev->dev, skb->data,
567+ bp->rx_buffer_size, DMA_FROM_DEVICE);
568+
569+ if (entry == RX_RING_SIZE - 1)
570+ paddr |= MACB_BIT(RX_WRAP);
571+ bp->rx_ring[entry].addr = paddr;
572+ bp->rx_ring[entry].ctrl = 0;
573+
574+ /* properly align Ethernet header */
575+ skb_reserve(skb, NET_IP_ALIGN);
576+ }
577+ }
578+
579+ /* Make descriptor updates visible to hardware */
580+ wmb();
581+
582+ netdev_vdbg(bp->dev, "rx ring: prepared head %d, tail %d\n",
583+ bp->rx_prepared_head, bp->rx_tail);
584+}
585+
586+/* Mark DMA descriptors from begin up to and not including end as unused */
587+static void discard_partial_frame(struct macb *bp, unsigned int begin,
588+ unsigned int end)
589+{
590+ unsigned int frag;
591+
592+ for (frag = begin; frag != end; frag++) {
593+ struct macb_dma_desc *desc = macb_rx_desc(bp, frag);
594+ desc->addr &= ~MACB_BIT(RX_USED);
595+ }
596+
597+ /* Make descriptor updates visible to hardware */
598+ wmb();
599+
600+ /*
601+ * When this happens, the hardware stats registers for
602+ * whatever caused this is updated, so we don't have to record
603+ * anything.
604+ */
605+}
606+
607+static int gem_rx(struct macb *bp, int budget)
608+{
609+ unsigned int len;
610+ unsigned int entry;
611+ struct sk_buff *skb;
612+ struct macb_dma_desc *desc;
613+ int count = 0;
614+
615+ while (count < budget) {
616+ u32 addr, ctrl;
617+
618+ entry = macb_rx_ring_wrap(bp->rx_tail);
619+ desc = &bp->rx_ring[entry];
620+
621+ /* Make hw descriptor updates visible to CPU */
622+ rmb();
623+
624+ addr = desc->addr;
625+ ctrl = desc->ctrl;
626+
627+ if (!(addr & MACB_BIT(RX_USED)))
628+ break;
629+
630+ desc->addr &= ~MACB_BIT(RX_USED);
631+ bp->rx_tail++;
632+ count++;
633+
634+ if (!(ctrl & MACB_BIT(RX_SOF) && ctrl & MACB_BIT(RX_EOF))) {
635+ netdev_err(bp->dev,
636+ "not whole frame pointed by descriptor\n");
637+ bp->stats.rx_dropped++;
638+ break;
639+ }
640+ skb = bp->rx_skbuff[entry];
641+ if (unlikely(!skb)) {
642+ netdev_err(bp->dev,
643+ "inconsistent Rx descriptor chain\n");
644+ bp->stats.rx_dropped++;
645+ break;
646+ }
647+ /* now everything is ready for receiving packet */
648+ bp->rx_skbuff[entry] = NULL;
649+ len = MACB_BFEXT(RX_FRMLEN, ctrl);
650+
651+ netdev_vdbg(bp->dev, "gem_rx %u (len %u)\n", entry, len);
652+
653+ skb_put(skb, len);
654+ addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, addr));
655+ dma_unmap_single(&bp->pdev->dev, addr,
656+ len, DMA_FROM_DEVICE);
657+
658+ skb->protocol = eth_type_trans(skb, bp->dev);
659+ skb_checksum_none_assert(skb);
660+
661+ bp->stats.rx_packets++;
662+ bp->stats.rx_bytes += skb->len;
663+
664+#if defined(DEBUG) && defined(VERBOSE_DEBUG)
665+ netdev_vdbg(bp->dev, "received skb of length %u, csum: %08x\n",
666+ skb->len, skb->csum);
667+ print_hex_dump(KERN_DEBUG, " mac: ", DUMP_PREFIX_ADDRESS, 16, 1,
668+ skb->mac_header, 16, true);
669+ print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_ADDRESS, 16, 1,
670+ skb->data, 32, true);
671+#endif
672+
673+ netif_receive_skb(skb);
674+ }
675+
676+ gem_rx_refill(bp);
677+
678+ return count;
679+}
680+
531681 static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
532682 unsigned int last_frag)
533683 {
@@ -575,7 +725,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, · 41 unmodified lines
575725 skb_put(skb, len);
576726
577727 for (frag = first_frag; ; frag++) {
578− unsigned int frag_len = RX_BUFFER_SIZE;
728+ unsigned int frag_len = bp->rx_buffer_size;
579729
580730 if (offset + frag_len > len) {
581731 BUG_ON(frag != last_frag);
@@ -583,7 +733,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, · 1 unmodified line
583733 }
584734 skb_copy_to_linear_data_offset(skb, offset,
585735 macb_rx_buffer(bp, frag), frag_len);
586− offset += RX_BUFFER_SIZE;
736+ offset += bp->rx_buffer_size;
587737 desc = macb_rx_desc(bp, frag);
588738 desc->addr &= ~MACB_BIT(RX_USED);
589739
@@ -606,27 +756,6 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, · 16 unmodified lines
606756 return 0;
607757 }
608758
609−/* Mark DMA descriptors from begin up to and not including end as unused */
610−static void discard_partial_frame(struct macb *bp, unsigned int begin,
611− unsigned int end)
612−{
613− unsigned int frag;
614−
615− for (frag = begin; frag != end; frag++) {
616− struct macb_dma_desc *desc = macb_rx_desc(bp, frag);
617− desc->addr &= ~MACB_BIT(RX_USED);
618− }
619−
620− /* Make descriptor updates visible to hardware */
621− wmb();
622−
623− /*
624− * When this happens, the hardware stats registers for
625− * whatever caused this is updated, so we don't have to record
626− * anything.
627− */
628−}
629−
630759 static int macb_rx(struct macb *bp, int budget)
631760 {
632761 int received = 0;
@@ -687,7 +816,7 @@ static int macb_poll(struct napi_struct *napi, int budget) · 54 unmodified lines
687816 netdev_vdbg(bp->dev, "poll: status = %08lx, budget = %d\n",
688817 (unsigned long)status, budget);
689818
690− work_done = macb_rx(bp, budget);
819+ work_done = bp->macbgem_ops.mog_rx(bp, budget);
691820 if (work_done < budget) {
692821 napi_complete(napi);
693822
@@ -870,12 +999,71 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) · 176 unmodified lines
870999 return NETDEV_TX_OK;
8711000 }
8721001
1002+static void macb_init_rx_buffer_size(struct macb *bp, size_t size)
1003+{
1004+ if (!macb_is_gem(bp)) {
1005+ bp->rx_buffer_size = MACB_RX_BUFFER_SIZE;
1006+ } else {
1007+ bp->rx_buffer_size = size;
1008+
1009+ if (bp->rx_buffer_size % RX_BUFFER_MULTIPLE) {
1010+ netdev_dbg(bp->dev,
1011+ "RX buffer must be multiple of %d bytes, expanding\n",
1012+ RX_BUFFER_MULTIPLE);
1013+ bp->rx_buffer_size =
1014+ roundup(bp->rx_buffer_size, RX_BUFFER_MULTIPLE);
1015+ }
1016+ }
1017+
1018+ netdev_dbg(bp->dev, "mtu [%u] rx_buffer_size [%Zu]\n",
1019+ bp->dev->mtu, bp->rx_buffer_size);
1020+}
1021+
1022+static void gem_free_rx_buffers(struct macb *bp)
1023+{
1024+ struct sk_buff *skb;
1025+ struct macb_dma_desc *desc;
1026+ dma_addr_t addr;
1027+ int i;
1028+
1029+ if (!bp->rx_skbuff)
1030+ return;
1031+
1032+ for (i = 0; i < RX_RING_SIZE; i++) {
1033+ skb = bp->rx_skbuff[i];
1034+
1035+ if (skb == NULL)
1036+ continue;
1037+
1038+ desc = &bp->rx_ring[i];
1039+ addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr));
1040+ dma_unmap_single(&bp->pdev->dev, addr, skb->len,
1041+ DMA_FROM_DEVICE);
1042+ dev_kfree_skb_any(skb);
1043+ skb = NULL;
1044+ }
1045+
1046+ kfree(bp->rx_skbuff);
1047+ bp->rx_skbuff = NULL;
1048+}
1049+
1050+static void macb_free_rx_buffers(struct macb *bp)
1051+{
1052+ if (bp->rx_buffers) {
1053+ dma_free_coherent(&bp->pdev->dev,
1054+ RX_RING_SIZE * bp->rx_buffer_size,
1055+ bp->rx_buffers, bp->rx_buffers_dma);
1056+ bp->rx_buffers = NULL;
1057+ }
1058+}
1059+
8731060 static void macb_free_consistent(struct macb *bp)
8741061 {
8751062 if (bp->tx_skb) {
8761063 kfree(bp->tx_skb);
8771064 bp->tx_skb = NULL;
8781065 }
1066+ bp->macbgem_ops.mog_free_rx_buffers(bp);
8791067 if (bp->rx_ring) {
8801068 dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES,
8811069 bp->rx_ring, bp->rx_ring_dma);
@@ -886,12 +1074,37 @@ static void macb_free_consistent(struct macb *bp) · 4 unmodified lines
8861074 bp->tx_ring, bp->tx_ring_dma);
8871075 bp->tx_ring = NULL;
8881076 }
889− if (bp->rx_buffers) {
890− dma_free_coherent(&bp->pdev->dev,
891− RX_RING_SIZE * RX_BUFFER_SIZE,
892− bp->rx_buffers, bp->rx_buffers_dma);
893− bp->rx_buffers = NULL;
894− }
1077+}
1078+
1079+static int gem_alloc_rx_buffers(struct macb *bp)
1080+{
1081+ int size;
1082+
1083+ size = RX_RING_SIZE * sizeof(struct sk_buff *);
1084+ bp->rx_skbuff = kzalloc(size, GFP_KERNEL);
1085+ if (!bp->rx_skbuff)
1086+ return -ENOMEM;
1087+ else
1088+ netdev_dbg(bp->dev,
1089+ "Allocated %d RX struct sk_buff entries at %p\n",
1090+ RX_RING_SIZE, bp->rx_skbuff);
1091+ return 0;
1092+}
1093+
1094+static int macb_alloc_rx_buffers(struct macb *bp)
1095+{
1096+ int size;
1097+
1098+ size = RX_RING_SIZE * bp->rx_buffer_size;
1099+ bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size,
1100+ &bp->rx_buffers_dma, GFP_KERNEL);
1101+ if (!bp->rx_buffers)
1102+ return -ENOMEM;
1103+ else
1104+ netdev_dbg(bp->dev,
1105+ "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
1106+ size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
1107+ return 0;
8951108 }
8961109
8971110 static int macb_alloc_consistent(struct macb *bp)
@@ -921,14 +1134,8 @@ static int macb_alloc_consistent(struct macb *bp) · 23 unmodified lines
9211134 "Allocated TX ring of %d bytes at %08lx (mapped %p)\n",
9221135 size, (unsigned long)bp->tx_ring_dma, bp->tx_ring);
9231136
924− size = RX_RING_SIZE * RX_BUFFER_SIZE;
925− bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size,
926− &bp->rx_buffers_dma, GFP_KERNEL);
927− if (!bp->rx_buffers)
1137+ if (bp->macbgem_ops.mog_alloc_rx_buffers(bp))
9281138 goto out_err;
929− netdev_dbg(bp->dev,
930− "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
931− size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
9321139
9331140 return 0;
9341141
@@ -937,6 +1144,21 @@ out_err: · 2 unmodified lines
9371144 return -ENOMEM;
9381145 }
9391146
1147+static void gem_init_rings(struct macb *bp)
1148+{
1149+ int i;
1150+
1151+ for (i = 0; i < TX_RING_SIZE; i++) {
1152+ bp->tx_ring[i].addr = 0;
1153+ bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
1154+ }
1155+ bp->tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP);
1156+
1157+ bp->rx_tail = bp->rx_prepared_head = bp->tx_head = bp->tx_tail = 0;
1158+
1159+ gem_rx_refill(bp);
1160+}
1161+
9401162 static void macb_init_rings(struct macb *bp)
9411163 {
9421164 int i;
@@ -946,7 +1168,7 @@ static void macb_init_rings(struct macb *bp) · 3 unmodified lines
9461168 for (i = 0; i < RX_RING_SIZE; i++) {
9471169 bp->rx_ring[i].addr = addr;
9481170 bp->rx_ring[i].ctrl = 0;
949− addr += RX_BUFFER_SIZE;
1171+ addr += bp->rx_buffer_size;
9501172 }
9511173 bp->rx_ring[RX_RING_SIZE - 1].addr |= MACB_BIT(RX_WRAP);
9521174
@@ -1056,7 +1278,7 @@ static void macb_configure_dma(struct macb *bp) · 103 unmodified lines
10561278
10571279 if (macb_is_gem(bp)) {
10581280 dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L);
1059− dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64);
1281+ dmacfg |= GEM_BF(RXBS, bp->rx_buffer_size / RX_BUFFER_MULTIPLE);
10601282 dmacfg |= GEM_BF(FBLDO, 16);
10611283 dmacfg |= GEM_BIT(TXPBMS) | GEM_BF(RXBMS, -1L);
10621284 dmacfg &= ~GEM_BIT(ENDIA);
@@ -1070,7 +1292,7 @@ static void macb_configure_dma(struct macb *bp) · 7 unmodified lines
10701292 static void macb_configure_caps(struct macb *bp)
10711293 {
10721294 if (macb_is_gem(bp)) {
1073− if (GEM_BF(IRQCOR, gem_readl(bp, DCFG1)) == 0)
1295+ if (GEM_BFEXT(IRQCOR, gem_readl(bp, DCFG1)) == 0)
10741296 bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE;
10751297 }
10761298 }
@@ -1233,6 +1455,7 @@ EXPORT_SYMBOL_GPL(macb_set_rx_mode); · 156 unmodified lines
12331455 static int macb_open(struct net_device *dev)
12341456 {
12351457 struct macb *bp = netdev_priv(dev);
1458+ size_t bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + NET_IP_ALIGN;
12361459 int err;
12371460
12381461 netdev_dbg(bp->dev, "open\n");
@@ -1244,6 +1467,9 @@ static int macb_open(struct net_device *dev) · 5 unmodified lines
12441467 if (!bp->phy_dev)
12451468 return -EAGAIN;
12461469
1470+ /* RX buffers initialization */
1471+ macb_init_rx_buffer_size(bp, bufsz);
1472+
12471473 err = macb_alloc_consistent(bp);
12481474 if (err) {
12491475 netdev_err(dev, "Unable to allocate DMA memory (error %d)\n",
@@ -1253,7 +1479,7 @@ static int macb_open(struct net_device *dev) · 3 unmodified lines
12531479
12541480 napi_enable(&bp->napi);
12551481
1256− macb_init_rings(bp);
1482+ bp->macbgem_ops.mog_init_rings(bp);
12571483 macb_init_hw(bp);
12581484
12591485 /* schedule a link state check */
@@ -1572,6 +1798,19 @@ static int __init macb_probe(struct platform_device *pdev) · 312 unmodified lines
15721798
15731799 dev->base_addr = regs->start;
15741800
1801+ /* setup appropriated routines according to adapter type */
1802+ if (macb_is_gem(bp)) {
1803+ bp->macbgem_ops.mog_alloc_rx_buffers = gem_alloc_rx_buffers;
1804+ bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers;
1805+ bp->macbgem_ops.mog_init_rings = gem_init_rings;
1806+ bp->macbgem_ops.mog_rx = gem_rx;
1807+ } else {
1808+ bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers;
1809+ bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers;
1810+ bp->macbgem_ops.mog_init_rings = macb_init_rings;
1811+ bp->macbgem_ops.mog_rx = macb_rx;
1812+ }
1813+
15751814 /* Set MII management clock divider */
15761815 config = macb_mdc_clk_div(bp);
15771816 config |= macb_dbw(bp);
@@ -1649,7 +1888,6 @@ err_out_put_pclk: · 71 unmodified lines
16491888 err_out_free_dev:
16501889 free_netdev(dev);
16511890 err_out:
1652− platform_set_drvdata(pdev, NULL);
16531891 return err;
16541892 }
16551893
@@ -1675,7 +1913,6 @@ static int __exit macb_remove(struct platform_device *pdev) · 19 unmodified lines
16751913 clk_disable_unprepare(bp->pclk);
16761914 clk_put(bp->pclk);
16771915 free_netdev(dev);
1678− platform_set_drvdata(pdev, NULL);
16791916 }
16801917
16811918 return 0;
drivers/net/ethernet/cadence/macb.h+14−0
@@ -545,12 +545,24 @@ struct gem_stats { · 544 unmodified lines
545545 u32 rx_udp_checksum_errors;
546546 };
547547
548+struct macb;
549+
550+struct macb_or_gem_ops {
551+ int (*mog_alloc_rx_buffers)(struct macb *bp);
552+ void (*mog_free_rx_buffers)(struct macb *bp);
553+ void (*mog_init_rings)(struct macb *bp);
554+ int (*mog_rx)(struct macb *bp, int budget);
555+};
556+
548557 struct macb {
549558 void __iomem *regs;
550559
551560 unsigned int rx_tail;
561+ unsigned int rx_prepared_head;
552562 struct macb_dma_desc *rx_ring;
563+ struct sk_buff **rx_skbuff;
553564 void *rx_buffers;
565+ size_t rx_buffer_size;
554566
555567 unsigned int tx_head, tx_tail;
556568 struct macb_dma_desc *tx_ring;
@@ -573,6 +585,8 @@ struct macb { · 16 unmodified lines
573585 dma_addr_t tx_ring_dma;
574586 dma_addr_t rx_buffers_dma;
575587
588+ struct macb_or_gem_ops macbgem_ops;
589+
576590 struct mii_bus *mii_bus;
577591 struct phy_device *phy_dev;
578592 unsigned int link;
drivers/net/ethernet/calxeda/xgmac.c+0−2
@@ -1790,7 +1790,6 @@ err_io: · 1789 unmodified lines
17901790 free_netdev(ndev);
17911791 err_alloc:
17921792 release_mem_region(res->start, resource_size(res));
1793− platform_set_drvdata(pdev, NULL);
17941793 return ret;
17951794 }
17961795
@@ -1813,7 +1812,6 @@ static int xgmac_remove(struct platform_device *pdev) · 16 unmodified lines
18131812 free_irq(ndev->irq, ndev);
18141813 free_irq(priv->pmt_irq, ndev);
18151814
1816− platform_set_drvdata(pdev, NULL);
18171815 unregister_netdev(ndev);
18181816 netif_napi_del(&priv->napi);
18191817
drivers/net/ethernet/chelsio/cxgb/cxgb2.c+2−13
@@ -1351,22 +1351,11 @@ static void remove_one(struct pci_dev *pdev) · 1350 unmodified lines
13511351 t1_sw_reset(pdev);
13521352 }
13531353
1354−static struct pci_driver driver = {
1354+static struct pci_driver cxgb_pci_driver = {
13551355 .name = DRV_NAME,
13561356 .id_table = t1_pci_tbl,
13571357 .probe = init_one,
13581358 .remove = remove_one,
13591359 };
13601360
1361−static int __init t1_init_module(void)
1362−{
1363− return pci_register_driver(&driver);
1364−}
1365−
1366−static void __exit t1_cleanup_module(void)
1367−{
1368− pci_unregister_driver(&driver);
1369−}
1370−
1371−module_init(t1_init_module);
1372−module_exit(t1_cleanup_module);
1361+module_pci_driver(cxgb_pci_driver);
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c+2−0
@@ -3037,7 +3037,9 @@ static void t3_io_resume(struct pci_dev *pdev) · 3036 unmodified lines
30373037 CH_ALERT(adapter, "adapter recovering, PEX ERR 0x%x\n",
30383038 t3_read_reg(adapter, A_PCIE_PEX_ERR));
30393039
3040+ rtnl_lock();
30403041 t3_resume_ports(adapter);
3042+ rtnl_unlock();
30413043 }
30423044
30433045 static const struct pci_error_handlers t3_err_handler = {
drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c+5−4
@@ -1246,6 +1246,7 @@ int cxgb3_offload_activate(struct adapter *adapter) · 1245 unmodified lines
12461246 struct tid_range stid_range, tid_range;
12471247 struct mtutab mtutab;
12481248 unsigned int l2t_capacity;
1249+ struct l2t_data *l2td;
12491250
12501251 t = kzalloc(sizeof(*t), GFP_KERNEL);
12511252 if (!t)
@@ -1261,8 +1262,8 @@ int cxgb3_offload_activate(struct adapter *adapter) · 9 unmodified lines
12611262 goto out_free;
12621263
12631264 err = -ENOMEM;
1264− RCU_INIT_POINTER(dev->l2opt, t3_init_l2t(l2t_capacity));
1265− if (!L2DATA(dev))
1265+ l2td = t3_init_l2t(l2t_capacity);
1266+ if (!l2td)
12661267 goto out_free;
12671268
12681269 natids = min(tid_range.num / 2, MAX_ATIDS);
@@ -1279,6 +1280,7 @@ int cxgb3_offload_activate(struct adapter *adapter) · 10 unmodified lines
12791280 INIT_LIST_HEAD(&t->list_node);
12801281 t->dev = dev;
12811282
1283+ RCU_INIT_POINTER(dev->l2opt, l2td);
12821284 T3C_DATA(dev) = t;
12831285 dev->recv = process_rx;
12841286 dev->neigh_update = t3_l2t_update;
@@ -1294,8 +1296,7 @@ int cxgb3_offload_activate(struct adapter *adapter) · 9 unmodified lines
12941296 return 0;
12951297
12961298 out_free_l2t:
1297− t3_free_l2t(L2DATA(dev));
1298− RCU_INIT_POINTER(dev->l2opt, NULL);
1299+ t3_free_l2t(l2td);
12991300 out_free:
13001301 kfree(t);
13011302 return err;
drivers/net/ethernet/chelsio/cxgb3/sge.c+87−29
@@ -455,6 +455,11 @@ static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q, · 454 unmodified lines
455455 q->pg_chunk.offset = 0;
456456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page,
457457 0, q->alloc_size, PCI_DMA_FROMDEVICE);
458+ if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) {
459+ __free_pages(q->pg_chunk.page, order);
460+ q->pg_chunk.page = NULL;
461+ return -EIO;
462+ }
458463 q->pg_chunk.mapping = mapping;
459464 }
460465 sd->pg_chunk = q->pg_chunk;
@@ -949,40 +954,75 @@ static inline unsigned int calc_tx_descs(const struct sk_buff *skb) · 488 unmodified lines
949954 return flits_to_desc(flits);
950955 }
951956
957+
958+/* map_skb - map a packet main body and its page fragments
959+ * @pdev: the PCI device
960+ * @skb: the packet
961+ * @addr: placeholder to save the mapped addresses
962+ *
963+ * map the main body of an sk_buff and its page fragments, if any.
964+ */
965+static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb,
966+ dma_addr_t *addr)
967+{
968+ const skb_frag_t *fp, *end;
969+ const struct skb_shared_info *si;
970+
971+ *addr = pci_map_single(pdev, skb->data, skb_headlen(skb),
972+ PCI_DMA_TODEVICE);
973+ if (pci_dma_mapping_error(pdev, *addr))
974+ goto out_err;
975+
976+ si = skb_shinfo(skb);
977+ end = &si->frags[si->nr_frags];
978+
979+ for (fp = si->frags; fp < end; fp++) {
980+ *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp),
981+ DMA_TO_DEVICE);
982+ if (pci_dma_mapping_error(pdev, *addr))
983+ goto unwind;
984+ }
985+ return 0;
986+
987+unwind:
988+ while (fp-- > si->frags)
989+ dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp),
990+ DMA_TO_DEVICE);
991+
992+ pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE);
993+out_err:
994+ return -ENOMEM;
995+}
996+
952997 /**
953− * make_sgl - populate a scatter/gather list for a packet
998+ * write_sgl - populate a scatter/gather list for a packet
954999 * @skb: the packet
9551000 * @sgp: the SGL to populate
9561001 * @start: start address of skb main body data to include in the SGL
9571002 * @len: length of skb main body data to include in the SGL
958− * @pdev: the PCI device
1003+ * @addr: the list of the mapped addresses
9591004 *
960− * Generates a scatter/gather list for the buffers that make up a packet
1005+ * Copies the scatter/gather list for the buffers that make up a packet
9611006 * and returns the SGL size in 8-byte words. The caller must size the SGL
9621007 * appropriately.
9631008 */
964−static inline unsigned int make_sgl(const struct sk_buff *skb,
1009+static inline unsigned int write_sgl(const struct sk_buff *skb,
9651010 struct sg_ent *sgp, unsigned char *start,
966− unsigned int len, struct pci_dev *pdev)
1011+ unsigned int len, const dma_addr_t *addr)
9671012 {
968− dma_addr_t mapping;
969− unsigned int i, j = 0, nfrags;
1013+ unsigned int i, j = 0, k = 0, nfrags;
9701014
9711015 if (len) {
972− mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE);
9731016 sgp->len[0] = cpu_to_be32(len);
974− sgp->addr[0] = cpu_to_be64(mapping);
975− j = 1;
1017+ sgp->addr[j++] = cpu_to_be64(addr[k++]);
9761018 }
9771019
9781020 nfrags = skb_shinfo(skb)->nr_frags;
9791021 for (i = 0; i < nfrags; i++) {
9801022 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
9811023
982− mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),
983− DMA_TO_DEVICE);
9841024 sgp->len[j] = cpu_to_be32(skb_frag_size(frag));
985− sgp->addr[j] = cpu_to_be64(mapping);
1025+ sgp->addr[j] = cpu_to_be64(addr[k++]);
9861026 j ^= 1;
9871027 if (j == 0)
9881028 ++sgp;
@@ -1138,7 +1178,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 149 unmodified lines
11381178 const struct port_info *pi,
11391179 unsigned int pidx, unsigned int gen,
11401180 struct sge_txq *q, unsigned int ndesc,
1141− unsigned int compl)
1181+ unsigned int compl, const dma_addr_t *addr)
11421182 {
11431183 unsigned int flits, sgl_flits, cntrl, tso_info;
11441184 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1];
@@ -1196,7 +1236,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 51 unmodified lines
11961236 }
11971237
11981238 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1199− sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev);
1239+ sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr);
12001240
12011241 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen,
12021242 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl),
@@ -1227,6 +1267,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 24 unmodified lines
12271267 struct netdev_queue *txq;
12281268 struct sge_qset *qs;
12291269 struct sge_txq *q;
1270+ dma_addr_t addr[MAX_SKB_FRAGS + 1];
12301271
12311272 /*
12321273 * The chip min packet length is 9 octets but play safe and reject
@@ -1255,6 +1296,11 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines
12551296 return NETDEV_TX_BUSY;
12561297 }
12571298
1299+ if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) {
1300+ dev_kfree_skb(skb);
1301+ return NETDEV_TX_OK;
1302+ }
1303+
12581304 q->in_use += ndesc;
12591305 if (unlikely(credits - ndesc < q->stop_thres)) {
12601306 t3_stop_tx_queue(txq, qs, q);
@@ -1312,7 +1358,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 51 unmodified lines
13121358 if (likely(!skb_shared(skb)))
13131359 skb_orphan(skb);
13141360
1315− write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl);
1361+ write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr);
13161362 check_ring_tx_db(adap, q);
13171363 return NETDEV_TX_OK;
13181364 }
@@ -1537,10 +1583,9 @@ static void deferred_unmap_destructor(struct sk_buff *skb) · 218 unmodified lines
15371583 dui = (struct deferred_unmap_info *)skb->head;
15381584 p = dui->addr;
15391585
1540− if (skb->tail - skb->transport_header)
1541− pci_unmap_single(dui->pdev, *p++,
1542− skb->tail - skb->transport_header,
1543− PCI_DMA_TODEVICE);
1586+ if (skb_tail_pointer(skb) - skb_transport_header(skb))
1587+ pci_unmap_single(dui->pdev, *p++, skb_tail_pointer(skb) -
1588+ skb_transport_header(skb), PCI_DMA_TODEVICE);
15441589
15451590 si = skb_shinfo(skb);
15461591 for (i = 0; i < si->nr_frags; i++)
@@ -1578,7 +1623,8 @@ static void setup_deferred_unmapping(struct sk_buff *skb, struct pci_dev *pdev, · 31 unmodified lines
15781623 */
15791624 static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
15801625 struct sge_txq *q, unsigned int pidx,
1581− unsigned int gen, unsigned int ndesc)
1626+ unsigned int gen, unsigned int ndesc,
1627+ const dma_addr_t *addr)
15821628 {
15831629 unsigned int sgl_flits, flits;
15841630 struct work_request_hdr *from;
@@ -1599,9 +1645,9 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, · 14 unmodified lines
15991645
16001646 flits = skb_transport_offset(skb) / 8;
16011647 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1602− sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),
1603− skb->tail - skb->transport_header,
1604− adap->pdev);
1648+ sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb),
1649+ skb_tail_pointer(skb) -
1650+ skb_transport_header(skb), addr);
16051651 if (need_skb_unmap()) {
16061652 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
16071653 skb->destructor = deferred_unmap_destructor;
@@ -1627,7 +1673,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb) · 19 unmodified lines
16271673
16281674 flits = skb_transport_offset(skb) / 8; /* headers */
16291675 cnt = skb_shinfo(skb)->nr_frags;
1630− if (skb->tail != skb->transport_header)
1676+ if (skb_tail_pointer(skb) != skb_transport_header(skb))
16311677 cnt++;
16321678 return flits_to_desc(flits + sgl_len(cnt));
16331679 }
@@ -1659,6 +1705,11 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 25 unmodified lines
16591705 goto again;
16601706 }
16611707
1708+ if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) {
1709+ spin_unlock(&q->lock);
1710+ return NET_XMIT_SUCCESS;
1711+ }
1712+
16621713 gen = q->gen;
16631714 q->in_use += ndesc;
16641715 pidx = q->pidx;
@@ -1669,7 +1720,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 4 unmodified lines
16691720 }
16701721 spin_unlock(&q->lock);
16711722
1672− write_ofld_wr(adap, skb, q, pidx, gen, ndesc);
1723+ write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head);
16731724 check_ring_tx_db(adap, q);
16741725 return NET_XMIT_SUCCESS;
16751726 }
@@ -1687,6 +1738,7 @@ static void restart_offloadq(unsigned long data) · 11 unmodified lines
16871738 struct sge_txq *q = &qs->txq[TXQ_OFLD];
16881739 const struct port_info *pi = netdev_priv(qs->netdev);
16891740 struct adapter *adap = pi->adapter;
1741+ unsigned int written = 0;
16901742
16911743 spin_lock(&q->lock);
16921744 again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);
@@ -1706,10 +1758,14 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 13 unmodified lines
17061758 break;
17071759 }
17081760
1761+ if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head))
1762+ break;
1763+
17091764 gen = q->gen;
17101765 q->in_use += ndesc;
17111766 pidx = q->pidx;
17121767 q->pidx += ndesc;
1768+ written += ndesc;
17131769 if (q->pidx >= q->size) {
17141770 q->pidx -= q->size;
17151771 q->gen ^= 1;
@@ -1717,7 +1773,8 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 1 unmodified line
17171773 __skb_unlink(skb, &q->sendq);
17181774 spin_unlock(&q->lock);
17191775
1720− write_ofld_wr(adap, skb, q, pidx, gen, ndesc);
1776+ write_ofld_wr(adap, skb, q, pidx, gen, ndesc,
1777+ (dma_addr_t *)skb->head);
17211778 spin_lock(&q->lock);
17221779 }
17231780 spin_unlock(&q->lock);
@@ -1727,8 +1784,9 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 3 unmodified lines
17271784 set_bit(TXQ_LAST_PKT_DB, &q->flags);
17281785 #endif
17291786 wmb();
1730− t3_write_reg(adap, A_SG_KDOORBELL,
1731− F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
1787+ if (likely(written))
1788+ t3_write_reg(adap, A_SG_KDOORBELL,
1789+ F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
17321790 }
17331791
17341792 /**
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+1−1
@@ -51,7 +51,7 @@ · 50 unmodified lines
5151 #include "t4_hw.h"
5252
5353 #define FW_VERSION_MAJOR 1
54−#define FW_VERSION_MINOR 1
54+#define FW_VERSION_MINOR 4
5555 #define FW_VERSION_MICRO 0
5656
5757 #define FW_VERSION_MAJOR_T5 0
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+25−2
@@ -4842,8 +4842,17 @@ static int adap_init0(struct adapter *adap) · 4841 unmodified lines
48424842 * is excessively mismatched relative to the driver.)
48434843 */
48444844 ret = t4_check_fw_version(adap);
4845+
4846+ /* The error code -EFAULT is returned by t4_check_fw_version() if
4847+ * firmware on adapter < supported firmware. If firmware on adapter
4848+ * is too old (not supported by driver) and we're the MASTER_PF set
4849+ * adapter state to DEV_STATE_UNINIT to force firmware upgrade
4850+ * and reinitialization.
4851+ */
4852+ if ((adap->flags & MASTER_PF) && ret == -EFAULT)
4853+ state = DEV_STATE_UNINIT;
48454854 if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) {
4846− if (ret == -EINVAL || ret > 0) {
4855+ if (ret == -EINVAL || ret == -EFAULT || ret > 0) {
48474856 if (upgrade_fw(adap) >= 0) {
48484857 /*
48494858 * Note that the chip was reset as part of the
@@ -4852,7 +4861,21 @@ static int adap_init0(struct adapter *adap) · 2 unmodified lines
48524861 */
48534862 reset = 0;
48544863 ret = t4_check_fw_version(adap);
4855− }
4864+ } else
4865+ if (ret == -EFAULT) {
4866+ /*
4867+ * Firmware is old but still might
4868+ * work if we force reinitialization
4869+ * of the adapter. Ignoring FW upgrade
4870+ * failure.
4871+ */
4872+ dev_warn(adap->pdev_dev,
4873+ "Ignoring firmware upgrade "
4874+ "failure, and forcing driver "
4875+ "to reinitialize the "
4876+ "adapter.\n");
4877+ ret = 0;
4878+ }
48564879 }
48574880 if (ret < 0)
48584881 return ret;
drivers/net/ethernet/chelsio/cxgb4/sge.c+1−1
@@ -1294,7 +1294,7 @@ static inline unsigned int calc_tx_flits_ofld(const struct sk_buff *skb) · 1293 unmodified lines
12941294
12951295 flits = skb_transport_offset(skb) / 8U; /* headers */
12961296 cnt = skb_shinfo(skb)->nr_frags;
1297− if (skb->tail != skb->transport_header)
1297+ if (skb_tail_pointer(skb) != skb_transport_header(skb))
12981298 cnt++;
12991299 return flits + sgl_len(cnt);
13001300 }
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+9−1
@@ -938,6 +938,15 @@ int t4_check_fw_version(struct adapter *adapter) · 937 unmodified lines
938938 memcpy(adapter->params.api_vers, api_vers,
939939 sizeof(adapter->params.api_vers));
940940
941+ if (major < exp_major || (major == exp_major && minor < exp_minor) ||
942+ (major == exp_major && minor == exp_minor && micro < exp_micro)) {
943+ dev_err(adapter->pdev_dev,
944+ "Card has firmware version %u.%u.%u, minimum "
945+ "supported firmware is %u.%u.%u.\n", major, minor,
946+ micro, exp_major, exp_minor, exp_micro);
947+ return -EFAULT;
948+ }
949+
941950 if (major != exp_major) { /* major mismatch - fail */
942951 dev_err(adapter->pdev_dev,
943952 "card FW has major version %u, driver wants %u\n",
@@ -3773,7 +3782,6 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf) · 2829 unmodified lines
37733782 p->lport = j;
37743783 p->rss_size = rss_size;
37753784 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
3776− adap->port[i]->dev_id = j;
37773785
37783786 ret = ntohl(c.u.info.lstatus_to_modtype);
37793787 p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ?
drivers/net/ethernet/cirrus/Kconfig+0−1
@@ -44,7 +44,6 @@ config CS89x0_PLATFORM · 43 unmodified lines
4444 config EP93XX_ETH
4545 tristate "EP93xx Ethernet support"
4646 depends on ARM && ARCH_EP93XX
47− select NET_CORE
4847 select MII
4948 help
5049 This is a driver for the ethernet hardware included in EP93xx CPUs.
drivers/net/ethernet/cirrus/ep93xx_eth.c+0−1
@@ -783,7 +783,6 @@ static int ep93xx_eth_remove(struct platform_device *pdev) · 782 unmodified lines
783783 dev = platform_get_drvdata(pdev);
784784 if (dev == NULL)
785785 return 0;
786− platform_set_drvdata(pdev, NULL);
787786
788787 ep = netdev_priv(dev);
789788
drivers/net/ethernet/cisco/enic/enic_main.c+2−0
@@ -1761,6 +1761,7 @@ static void enic_change_mtu_work(struct work_struct *work) · 1760 unmodified lines
17611761 enic_synchronize_irqs(enic);
17621762 err = vnic_rq_disable(&enic->rq[0]);
17631763 if (err) {
1764+ rtnl_unlock();
17641765 netdev_err(netdev, "Unable to disable RQ.\n");
17651766 return;
17661767 }
@@ -1773,6 +1774,7 @@ static void enic_change_mtu_work(struct work_struct *work) · 6 unmodified lines
17731774 vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf);
17741775 /* Need at least one buffer on ring to get going */
17751776 if (vnic_rq_desc_used(&enic->rq[0]) == 0) {
1777+ rtnl_unlock();
17761778 netdev_err(netdev, "Unable to alloc receive buffers.\n");
17771779 return;
17781780 }
drivers/net/ethernet/davicom/Kconfig+0−1
@@ -6,7 +6,6 @@ config DM9000 · 5 unmodified lines
66 tristate "DM9000 support"
77 depends on ARM || BLACKFIN || MIPS || COLDFIRE
88 select CRC32
9− select NET_CORE
109 select MII
1110 ---help---
1211 Support for DM9000 chipset.
drivers/net/ethernet/davicom/dm9000.c+43−10
@@ -29,6 +29,8 @@ · 28 unmodified lines
2929 #include <linux/spinlock.h>
3030 #include <linux/crc32.h>
3131 #include <linux/mii.h>
32+#include <linux/of.h>
33+#include <linux/of_net.h>
3234 #include <linux/ethtool.h>
3335 #include <linux/dm9000.h>
3436 #include <linux/delay.h>
@@ -827,7 +829,7 @@ dm9000_hash_table_unlocked(struct net_device *dev) · 792 unmodified lines
827829 struct netdev_hw_addr *ha;
828830 int i, oft;
829831 u32 hash_val;
830− u16 hash_table[4];
832+ u16 hash_table[4] = { 0, 0, 0, 0x8000 }; /* broadcast address */
831833 u8 rcr = RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN;
832834
833835 dm9000_dbg(db, 1, "entering %s\n", __func__);
@@ -835,13 +837,6 @@ dm9000_hash_table_unlocked(struct net_device *dev) · 1 unmodified line
835837 for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
836838 iow(db, oft, dev->dev_addr[i]);
837839
838− /* Clear Hash Table */
839− for (i = 0; i < 4; i++)
840− hash_table[i] = 0x0;
841−
842− /* broadcast address */
843− hash_table[3] = 0x8000;
844−
845840 if (dev->flags & IFF_PROMISC)
846841 rcr |= RCR_PRMSC;
847842
@@ -1358,6 +1353,31 @@ static const struct net_device_ops dm9000_netdev_ops = { · 510 unmodified lines
13581353 #endif
13591354 };
13601355
1356+static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
1357+{
1358+ struct dm9000_plat_data *pdata;
1359+ struct device_node *np = dev->of_node;
1360+ const void *mac_addr;
1361+
1362+ if (!IS_ENABLED(CONFIG_OF) || !np)
1363+ return NULL;
1364+
1365+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
1366+ if (!pdata)
1367+ return ERR_PTR(-ENOMEM);
1368+
1369+ if (of_find_property(np, "davicom,ext-phy", NULL))
1370+ pdata->flags |= DM9000_PLATF_EXT_PHY;
1371+ if (of_find_property(np, "davicom,no-eeprom", NULL))
1372+ pdata->flags |= DM9000_PLATF_NO_EEPROM;
1373+
1374+ mac_addr = of_get_mac_address(np);
1375+ if (mac_addr)
1376+ memcpy(pdata->dev_addr, mac_addr, sizeof(pdata->dev_addr));
1377+
1378+ return pdata;
1379+}
1380+
13611381 /*
13621382 * Search DM9000 board, allocate space and register it
13631383 */
@@ -1373,6 +1393,12 @@ dm9000_probe(struct platform_device *pdev) · 9 unmodified lines
13731393 int i;
13741394 u32 id_val;
13751395
1396+ if (!pdata) {
1397+ pdata = dm9000_parse_dt(&pdev->dev);
1398+ if (IS_ERR(pdata))
1399+ return PTR_ERR(pdata);
1400+ }
1401+
13761402 /* Init network device */
13771403 ndev = alloc_etherdev(sizeof(struct board_info));
13781404 if (!ndev)
@@ -1673,8 +1699,6 @@ dm9000_drv_remove(struct platform_device *pdev) · 294 unmodified lines
16731699 {
16741700 struct net_device *ndev = platform_get_drvdata(pdev);
16751701
1676− platform_set_drvdata(pdev, NULL);
1677−
16781702 unregister_netdev(ndev);
16791703 dm9000_release_board(pdev, netdev_priv(ndev));
16801704 free_netdev(ndev); /* free device structure */
@@ -1683,11 +1707,20 @@ dm9000_drv_remove(struct platform_device *pdev) · 2 unmodified lines
16831707 return 0;
16841708 }
16851709
1710+#ifdef CONFIG_OF
1711+static const struct of_device_id dm9000_of_matches[] = {
1712+ { .compatible = "davicom,dm9000", },
1713+ { /* sentinel */ }
1714+};
1715+MODULE_DEVICE_TABLE(of, dm9000_of_matches);
1716+#endif
1717+
16861718 static struct platform_driver dm9000_driver = {
16871719 .driver = {
16881720 .name = "dm9000",
16891721 .owner = THIS_MODULE,
16901722 .pm = &dm9000_drv_pm_ops,
1723+ .of_match_table = of_match_ptr(dm9000_of_matches),
16911724 },
16921725 .probe = dm9000_probe,
16931726 .remove = dm9000_drv_remove,
drivers/net/ethernet/dec/tulip/Kconfig+0−1
@@ -126,7 +126,6 @@ config WINBOND_840 · 125 unmodified lines
126126 tristate "Winbond W89c840 Ethernet support"
127127 depends on PCI
128128 select CRC32
129− select NET_CORE
130129 select MII
131130 ---help---
132131 This driver is for the Winbond W89c840 chip. It also works with
drivers/net/ethernet/dec/tulip/tulip_core.c+0−6
@@ -1410,12 +1410,6 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 1409 unmodified lines
14101410 return i;
14111411 }
14121412
1413− /* The chip will fail to enter a low-power state later unless
1414− * first explicitly commanded into D0 */
1415− if (pci_set_power_state(pdev, PCI_D0)) {
1416− pr_notice("Failed to set power state to D0\n");
1417− }
1418−
14191413 irq = pdev->irq;
14201414
14211415 /* alloc_etherdev ensures aligned and zeroed private structures */
drivers/net/ethernet/dec/tulip/xircom_cb.c+1−13
@@ -1171,16 +1171,4 @@ investigate_write_descriptor(struct net_device *dev, · 1170 unmodified lines
11711171 }
11721172 }
11731173
1174−static int __init xircom_init(void)
1175−{
1176− return pci_register_driver(&xircom_ops);
1177−}
1178−
1179−static void __exit xircom_exit(void)
1180−{
1181− pci_unregister_driver(&xircom_ops);
1182−}
1183−
1184−module_init(xircom_init)
1185−module_exit(xircom_exit)
1186−
1174+module_pci_driver(xircom_ops);
drivers/net/ethernet/dlink/Kconfig+0−1
@@ -36,7 +36,6 @@ config SUNDANCE · 35 unmodified lines
3636 tristate "Sundance Alta support"
3737 depends on PCI
3838 select CRC32
39− select NET_CORE
4039 select MII
4140 ---help---
4241 This driver is for the Sundance "Alta" chip.
drivers/net/ethernet/emulex/benet/be.h+4−0
@@ -333,6 +333,9 @@ enum vf_state { · 332 unmodified lines
333333 #define BE_VF_UC_PMAC_COUNT 2
334334 #define BE_FLAGS_QNQ_ASYNC_EVT_RCVD (1 << 11)
335335
336+/* Ethtool set_dump flags */
337+#define LANCER_INITIATE_FW_DUMP 0x1
338+
336339 struct phy_info {
337340 u8 transceiver;
338341 u8 autoneg;
@@ -398,6 +401,7 @@ struct be_adapter { · 59 unmodified lines
398401 u32 cmd_privileges;
399402 /* Ethtool knobs and info */
400403 char fw_ver[FW_VER_LEN];
404+ char fw_on_flash[FW_VER_LEN];
401405 int if_handle; /* Used to configure filtering */
402406 u32 *pmac_id; /* MAC addr handle used by BE card */
403407 u32 beacon_state; /* for set_phys_id */
drivers/net/ethernet/emulex/benet/be_cmds.c+66−0
@@ -3255,6 +3255,72 @@ err: · 3254 unmodified lines
32553255 return status;
32563256 }
32573257
3258+static int lancer_wait_idle(struct be_adapter *adapter)
3259+{
3260+#define SLIPORT_IDLE_TIMEOUT 30
3261+ u32 reg_val;
3262+ int status = 0, i;
3263+
3264+ for (i = 0; i < SLIPORT_IDLE_TIMEOUT; i++) {
3265+ reg_val = ioread32(adapter->db + PHYSDEV_CONTROL_OFFSET);
3266+ if ((reg_val & PHYSDEV_CONTROL_INP_MASK) == 0)
3267+ break;
3268+
3269+ ssleep(1);
3270+ }
3271+
3272+ if (i == SLIPORT_IDLE_TIMEOUT)
3273+ status = -1;
3274+
3275+ return status;
3276+}
3277+
3278+int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask)
3279+{
3280+ int status = 0;
3281+
3282+ status = lancer_wait_idle(adapter);
3283+ if (status)
3284+ return status;
3285+
3286+ iowrite32(mask, adapter->db + PHYSDEV_CONTROL_OFFSET);
3287+
3288+ return status;
3289+}
3290+
3291+/* Routine to check whether dump image is present or not */
3292+bool dump_present(struct be_adapter *adapter)
3293+{
3294+ u32 sliport_status = 0;
3295+
3296+ sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
3297+ return !!(sliport_status & SLIPORT_STATUS_DIP_MASK);
3298+}
3299+
3300+int lancer_initiate_dump(struct be_adapter *adapter)
3301+{
3302+ int status;
3303+
3304+ /* give firmware reset and diagnostic dump */
3305+ status = lancer_physdev_ctrl(adapter, PHYSDEV_CONTROL_FW_RESET_MASK |
3306+ PHYSDEV_CONTROL_DD_MASK);
3307+ if (status < 0) {
3308+ dev_err(&adapter->pdev->dev, "Firmware reset failed\n");
3309+ return status;
3310+ }
3311+
3312+ status = lancer_wait_idle(adapter);
3313+ if (status)
3314+ return status;
3315+
3316+ if (!dump_present(adapter)) {
3317+ dev_err(&adapter->pdev->dev, "Dump image not present\n");
3318+ return -1;
3319+ }
3320+
3321+ return 0;
3322+}
3323+
32583324 /* Uses sync mcc */
32593325 int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain)
32603326 {
drivers/net/ethernet/emulex/benet/be_cmds.h+3−0
@@ -1937,6 +1937,9 @@ extern int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter, · 1936 unmodified lines
19371937 struct be_dma_mem *cmd,
19381938 struct be_fat_conf_params *cfgs);
19391939 extern int lancer_wait_ready(struct be_adapter *adapter);
1940+extern int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask);
1941+extern int lancer_initiate_dump(struct be_adapter *adapter);
1942+extern bool dump_present(struct be_adapter *adapter);
19401943 extern int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
19411944 extern int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name);
19421945 extern int be_cmd_get_func_config(struct be_adapter *adapter);
drivers/net/ethernet/emulex/benet/be_ethtool.c+31−6
@@ -177,19 +177,15 @@ static void be_get_drvinfo(struct net_device *netdev, · 176 unmodified lines
177177 struct ethtool_drvinfo *drvinfo)
178178 {
179179 struct be_adapter *adapter = netdev_priv(netdev);
180− char fw_on_flash[FW_VER_LEN];
181−
182− memset(fw_on_flash, 0 , sizeof(fw_on_flash));
183− be_cmd_get_fw_ver(adapter, adapter->fw_ver, fw_on_flash);
184180
185181 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
186182 strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version));
187− if (!memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN))
183+ if (!memcmp(adapter->fw_ver, adapter->fw_on_flash, FW_VER_LEN))
188184 strlcpy(drvinfo->fw_version, adapter->fw_ver,
189185 sizeof(drvinfo->fw_version));
190186 else
191187 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
192− "%s [%s]", adapter->fw_ver, fw_on_flash);
188+ "%s [%s]", adapter->fw_ver, adapter->fw_on_flash);
193189
194190 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
195191 sizeof(drvinfo->bus_info));
@@ -673,6 +669,34 @@ be_set_phys_id(struct net_device *netdev, · 477 unmodified lines
673669 return 0;
674670 }
675671
672+static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
673+{
674+ struct be_adapter *adapter = netdev_priv(netdev);
675+ struct device *dev = &adapter->pdev->dev;
676+ int status;
677+
678+ if (!lancer_chip(adapter)) {
679+ dev_err(dev, "FW dump not supported\n");
680+ return -EOPNOTSUPP;
681+ }
682+
683+ if (dump_present(adapter)) {
684+ dev_err(dev, "Previous dump not cleared, not forcing dump\n");
685+ return 0;
686+ }
687+
688+ switch (dump->flag) {
689+ case LANCER_INITIATE_FW_DUMP:
690+ status = lancer_initiate_dump(adapter);
691+ if (!status)
692+ dev_info(dev, "F/w dump initiated successfully\n");
693+ break;
694+ default:
695+ dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag);
696+ return -EINVAL;
697+ }
698+ return status;
699+}
676700
677701 static void
678702 be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
@@ -1110,6 +1134,7 @@ const struct ethtool_ops be_ethtool_ops = { · 431 unmodified lines
11101134 .set_pauseparam = be_set_pauseparam,
11111135 .get_strings = be_get_stat_strings,
11121136 .set_phys_id = be_set_phys_id,
1137+ .set_dump = be_set_dump,
11131138 .get_msglevel = be_get_msg_level,
11141139 .set_msglevel = be_set_msg_level,
11151140 .get_sset_count = be_get_sset_count,
drivers/net/ethernet/emulex/benet/be_hw.h+2−0
@@ -53,10 +53,12 @@ · 52 unmodified lines
5353 #define PHYSDEV_CONTROL_OFFSET 0x414
5454
5555 #define SLIPORT_STATUS_ERR_MASK 0x80000000
56+#define SLIPORT_STATUS_DIP_MASK 0x02000000
5657 #define SLIPORT_STATUS_RN_MASK 0x01000000
5758 #define SLIPORT_STATUS_RDY_MASK 0x00800000
5859 #define SLI_PORT_CONTROL_IP_MASK 0x08000000
5960 #define PHYSDEV_CONTROL_FW_RESET_MASK 0x00000002
61+#define PHYSDEV_CONTROL_DD_MASK 0x00000004
6062 #define PHYSDEV_CONTROL_INP_MASK 0x40000000
6163
6264 #define SLIPORT_ERROR_NO_RESOURCE1 0x2
drivers/net/ethernet/emulex/benet/be_main.c+62−88
@@ -834,32 +834,39 @@ static int be_vlan_tag_tx_chk(struct be_adapter *adapter, struct sk_buff *skb) · 833 unmodified lines
834834 return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid;
835835 }
836836
837−static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, struct sk_buff *skb)
837+static int be_ipv6_tx_stall_chk(struct be_adapter *adapter,
838+ struct sk_buff *skb)
838839 {
839− return BE3_chip(adapter) &&
840− be_ipv6_exthdr_check(skb);
840+ return BE3_chip(adapter) && be_ipv6_exthdr_check(skb);
841841 }
842842
843−static netdev_tx_t be_xmit(struct sk_buff *skb,
844− struct net_device *netdev)
843+static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
844+ struct sk_buff *skb,
845+ bool *skip_hw_vlan)
845846 {
846− struct be_adapter *adapter = netdev_priv(netdev);
847− struct be_tx_obj *txo = &adapter->tx_obj[skb_get_queue_mapping(skb)];
848− struct be_queue_info *txq = &txo->q;
849− struct iphdr *ip = NULL;
850− u32 wrb_cnt = 0, copied = 0;
851− u32 start = txq->head, eth_hdr_len;
852− bool dummy_wrb, stopped = false;
853− bool skip_hw_vlan = false;
854847 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
848+ unsigned int eth_hdr_len;
849+ struct iphdr *ip;
855850
856− eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ?
857− VLAN_ETH_HLEN : ETH_HLEN;
851+ /* Lancer ASIC has a bug wherein packets that are 32 bytes or less
852+ * may cause a transmit stall on that port. So the work-around is to
853+ * pad such packets to a 36-byte length.
854+ */
855+ if (unlikely(lancer_chip(adapter) && skb->len <= 32)) {
856+ if (skb_padto(skb, 36))
857+ goto tx_drop;
858+ skb->len = 36;
859+ }
858860
859861 /* For padded packets, BE HW modifies tot_len field in IP header
860862 * incorrecly when VLAN tag is inserted by HW.
863+ * For padded packets, Lancer computes incorrect checksum.
861864 */
862− if (skb->len <= 60 && vlan_tx_tag_present(skb) && is_ipv4_pkt(skb)) {
865+ eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ?
866+ VLAN_ETH_HLEN : ETH_HLEN;
867+ if (skb->len <= 60 &&
868+ (lancer_chip(adapter) || vlan_tx_tag_present(skb)) &&
869+ is_ipv4_pkt(skb)) {
863870 ip = (struct iphdr *)ip_hdr(skb);
864871 pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len));
865872 }
@@ -869,15 +876,15 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, · 3 unmodified lines
869876 */
870877 if ((adapter->function_mode & UMC_ENABLED) &&
871878 veh->h_vlan_proto == htons(ETH_P_8021Q))
872− skip_hw_vlan = true;
879+ *skip_hw_vlan = true;
873880
874881 /* HW has a bug wherein it will calculate CSUM for VLAN
875882 * pkts even though it is disabled.
876883 * Manually insert VLAN in pkt.
877884 */
878885 if (skb->ip_summed != CHECKSUM_PARTIAL &&
879− vlan_tx_tag_present(skb)) {
880− skb = be_insert_vlan_in_pkt(adapter, skb, &skip_hw_vlan);
886+ vlan_tx_tag_present(skb)) {
887+ skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan);
881888 if (unlikely(!skb))
882889 goto tx_drop;
883890 }
@@ -887,8 +894,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, · 3 unmodified lines
887894 * skip HW tagging is not enabled by FW.
888895 */
889896 if (unlikely(be_ipv6_tx_stall_chk(adapter, skb) &&
890− (adapter->pvid || adapter->qnq_vid) &&
891− !qnq_async_evt_rcvd(adapter)))
897+ (adapter->pvid || adapter->qnq_vid) &&
898+ !qnq_async_evt_rcvd(adapter)))
892899 goto tx_drop;
893900
894901 /* Manual VLAN tag insertion to prevent:
@@ -899,11 +906,31 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, · 4 unmodified lines
899906 */
900907 if (be_ipv6_tx_stall_chk(adapter, skb) &&
901908 be_vlan_tag_tx_chk(adapter, skb)) {
902− skb = be_insert_vlan_in_pkt(adapter, skb, &skip_hw_vlan);
909+ skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan);
903910 if (unlikely(!skb))
904911 goto tx_drop;
905912 }
906913
914+ return skb;
915+tx_drop:
916+ dev_kfree_skb_any(skb);
917+ return NULL;
918+}
919+
920+static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
921+{
922+ struct be_adapter *adapter = netdev_priv(netdev);
923+ struct be_tx_obj *txo = &adapter->tx_obj[skb_get_queue_mapping(skb)];
924+ struct be_queue_info *txq = &txo->q;
925+ bool dummy_wrb, stopped = false;
926+ u32 wrb_cnt = 0, copied = 0;
927+ bool skip_hw_vlan = false;
928+ u32 start = txq->head;
929+
930+ skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan);
931+ if (!skb)
932+ return NETDEV_TX_OK;
933+
907934 wrb_cnt = wrb_cnt_for_skb(adapter, skb, &dummy_wrb);
908935
909936 copied = make_tx_wrbs(adapter, txq, skb, wrb_cnt, dummy_wrb,
@@ -933,7 +960,6 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, · 23 unmodified lines
933960 txq->head = start;
934961 dev_kfree_skb_any(skb);
935962 }
936−tx_drop:
937963 return NETDEV_TX_OK;
938964 }
939965
@@ -1236,30 +1262,6 @@ static int be_set_vf_tx_rate(struct net_device *netdev, · 296 unmodified lines
12361262 return status;
12371263 }
12381264
1239−static int be_find_vfs(struct be_adapter *adapter, int vf_state)
1240−{
1241− struct pci_dev *dev, *pdev = adapter->pdev;
1242− int vfs = 0, assigned_vfs = 0, pos;
1243− u16 offset, stride;
1244−
1245− pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
1246− if (!pos)
1247− return 0;
1248− pci_read_config_word(pdev, pos + PCI_SRIOV_VF_OFFSET, &offset);
1249− pci_read_config_word(pdev, pos + PCI_SRIOV_VF_STRIDE, &stride);
1250−
1251− dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);
1252− while (dev) {
1253− if (dev->is_virtfn && pci_physfn(dev) == pdev) {
1254− vfs++;
1255− if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
1256− assigned_vfs++;
1257− }
1258− dev = pci_get_device(pdev->vendor, PCI_ANY_ID, dev);
1259− }
1260− return (vf_state == ASSIGNED) ? assigned_vfs : vfs;
1261−}
1262−
12631265 static void be_eqd_update(struct be_adapter *adapter, struct be_eq_obj *eqo)
12641266 {
12651267 struct be_rx_stats *stats = rx_stats(&adapter->rx_obj[eqo->idx]);
@@ -2771,7 +2773,7 @@ static void be_vf_clear(struct be_adapter *adapter) · 1505 unmodified lines
27712773 struct be_vf_cfg *vf_cfg;
27722774 u32 vf;
27732775
2774− if (be_find_vfs(adapter, ASSIGNED)) {
2776+ if (pci_vfs_assigned(adapter->pdev)) {
27752777 dev_warn(&adapter->pdev->dev,
27762778 "VFs are assigned to VMs: not disabling VFs\n");
27772779 goto done;
@@ -2873,7 +2875,7 @@ static int be_vf_setup(struct be_adapter *adapter) · 95 unmodified lines
28732875 int status, old_vfs, vf;
28742876 struct device *dev = &adapter->pdev->dev;
28752877
2876− old_vfs = be_find_vfs(adapter, ENABLED);
2878+ old_vfs = pci_num_vf(adapter->pdev);
28772879 if (old_vfs) {
28782880 dev_info(dev, "%d VFs are already enabled\n", old_vfs);
28792881 if (old_vfs != num_vfs)
@@ -3184,7 +3186,7 @@ static int be_setup(struct be_adapter *adapter) · 304 unmodified lines
31843186 if (status)
31853187 goto err;
31863188
3187− be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL);
3189+ be_cmd_get_fw_ver(adapter, adapter->fw_ver, adapter->fw_on_flash);
31883190
31893191 if (adapter->vlans_added)
31903192 be_vid_config(adapter);
@@ -3530,40 +3532,6 @@ static int be_flash_skyhawk(struct be_adapter *adapter, · 339 unmodified lines
35303532 return 0;
35313533 }
35323534
3533−static int lancer_wait_idle(struct be_adapter *adapter)
3534−{
3535−#define SLIPORT_IDLE_TIMEOUT 30
3536− u32 reg_val;
3537− int status = 0, i;
3538−
3539− for (i = 0; i < SLIPORT_IDLE_TIMEOUT; i++) {
3540− reg_val = ioread32(adapter->db + PHYSDEV_CONTROL_OFFSET);
3541− if ((reg_val & PHYSDEV_CONTROL_INP_MASK) == 0)
3542− break;
3543−
3544− ssleep(1);
3545− }
3546−
3547− if (i == SLIPORT_IDLE_TIMEOUT)
3548− status = -1;
3549−
3550− return status;
3551−}
3552−
3553−static int lancer_fw_reset(struct be_adapter *adapter)
3554−{
3555− int status = 0;
3556−
3557− status = lancer_wait_idle(adapter);
3558− if (status)
3559− return status;
3560−
3561− iowrite32(PHYSDEV_CONTROL_FW_RESET_MASK, adapter->db +
3562− PHYSDEV_CONTROL_OFFSET);
3563−
3564− return status;
3565−}
3566−
35673535 static int lancer_fw_download(struct be_adapter *adapter,
35683536 const struct firmware *fw)
35693537 {
@@ -3641,7 +3609,8 @@ static int lancer_fw_download(struct be_adapter *adapter, · 71 unmodified lines
36413609 }
36423610
36433611 if (change_status == LANCER_FW_RESET_NEEDED) {
3644− status = lancer_fw_reset(adapter);
3612+ status = lancer_physdev_ctrl(adapter,
3613+ PHYSDEV_CONTROL_FW_RESET_MASK);
36453614 if (status) {
36463615 dev_err(&adapter->pdev->dev,
36473616 "Adapter busy for FW reset.\n"
@@ -3776,6 +3745,10 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file) · 128 unmodified lines
37763745 else
37773746 status = be_fw_download(adapter, fw);
37783747
3748+ if (!status)
3749+ be_cmd_get_fw_ver(adapter, adapter->fw_ver,
3750+ adapter->fw_on_flash);
3751+
37793752 fw_exit:
37803753 release_firmware(fw);
37813754 return status;
@@ -4203,9 +4176,10 @@ reschedule: · 421 unmodified lines
42034176 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
42044177 }
42054178
4179+/* If any VFs are already enabled don't FLR the PF */
42064180 static bool be_reset_required(struct be_adapter *adapter)
42074181 {
4208− return be_find_vfs(adapter, ENABLED) > 0 ? false : true;
4182+ return pci_num_vf(adapter->pdev) ? false : true;
42094183 }
42104184
42114185 static char *mc_name(struct be_adapter *adapter)
@@ -4390,7 +4364,7 @@ static int be_resume(struct pci_dev *pdev) · 178 unmodified lines
43904364 if (status)
43914365 return status;
43924366
4393− pci_set_power_state(pdev, 0);
4367+ pci_set_power_state(pdev, PCI_D0);
43944368 pci_restore_state(pdev);
43954369
43964370 /* tell fw we're ready to fire cmds */
@@ -4486,7 +4460,7 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) · 89 unmodified lines
44864460 return PCI_ERS_RESULT_DISCONNECT;
44874461
44884462 pci_set_master(pdev);
4489− pci_set_power_state(pdev, 0);
4463+ pci_set_power_state(pdev, PCI_D0);
44904464 pci_restore_state(pdev);
44914465
44924466 /* Check if card is ok and fw is ready */
drivers/net/ethernet/ethoc.c+0−2
@@ -1147,8 +1147,6 @@ static int ethoc_remove(struct platform_device *pdev) · 1146 unmodified lines
11471147 struct net_device *netdev = platform_get_drvdata(pdev);
11481148 struct ethoc *priv = netdev_priv(netdev);
11491149
1150− platform_set_drvdata(pdev, NULL);
1151−
11521150 if (netdev) {
11531151 netif_napi_del(&priv->napi);
11541152 phy_disconnect(priv->phy);
drivers/net/ethernet/faraday/Kconfig+0−1
@@ -21,7 +21,6 @@ if NET_VENDOR_FARADAY · 20 unmodified lines
2121 config FTMAC100
2222 tristate "Faraday FTMAC100 10/100 Ethernet support"
2323 depends on ARM
24− select NET_CORE
2524 select MII
2625 ---help---
2726 This driver supports the FTMAC100 10/100 Ethernet controller
drivers/net/ethernet/faraday/ftgmac100.c+0−2
@@ -1311,7 +1311,6 @@ err_ioremap: · 1310 unmodified lines
13111311 release_resource(priv->res);
13121312 err_req_mem:
13131313 netif_napi_del(&priv->napi);
1314− platform_set_drvdata(pdev, NULL);
13151314 free_netdev(netdev);
13161315 err_alloc_etherdev:
13171316 return err;
@@ -1335,7 +1334,6 @@ static int __exit ftgmac100_remove(struct platform_device *pdev) · 17 unmodified lines
13351334 release_resource(priv->res);
13361335
13371336 netif_napi_del(&priv->napi);
1338− platform_set_drvdata(pdev, NULL);
13391337 free_netdev(netdev);
13401338 return 0;
13411339 }
drivers/net/ethernet/faraday/ftmac100.c+0−2
@@ -1149,7 +1149,6 @@ err_ioremap: · 1148 unmodified lines
11491149 release_resource(priv->res);
11501150 err_req_mem:
11511151 netif_napi_del(&priv->napi);
1152− platform_set_drvdata(pdev, NULL);
11531152 free_netdev(netdev);
11541153 err_alloc_etherdev:
11551154 return err;
@@ -1169,7 +1168,6 @@ static int __exit ftmac100_remove(struct platform_device *pdev) · 13 unmodified lines
11691168 release_resource(priv->res);
11701169
11711170 netif_napi_del(&priv->napi);
1172− platform_set_drvdata(pdev, NULL);
11731171 free_netdev(netdev);
11741172 return 0;
11751173 }
drivers/net/ethernet/freescale/fec.h+60−1
@@ -60,6 +60,61 @@ · 59 unmodified lines
6060 #define BM_MIIGSK_CFGR_RMII 0x01
6161 #define BM_MIIGSK_CFGR_FRCONT_10M 0x40
6262
63+#define RMON_T_DROP 0x200 /* Count of frames not cntd correctly */
64+#define RMON_T_PACKETS 0x204 /* RMON TX packet count */
65+#define RMON_T_BC_PKT 0x208 /* RMON TX broadcast pkts */
66+#define RMON_T_MC_PKT 0x20C /* RMON TX multicast pkts */
67+#define RMON_T_CRC_ALIGN 0x210 /* RMON TX pkts with CRC align err */
68+#define RMON_T_UNDERSIZE 0x214 /* RMON TX pkts < 64 bytes, good CRC */
69+#define RMON_T_OVERSIZE 0x218 /* RMON TX pkts > MAX_FL bytes good CRC */
70+#define RMON_T_FRAG 0x21C /* RMON TX pkts < 64 bytes, bad CRC */
71+#define RMON_T_JAB 0x220 /* RMON TX pkts > MAX_FL bytes, bad CRC */
72+#define RMON_T_COL 0x224 /* RMON TX collision count */
73+#define RMON_T_P64 0x228 /* RMON TX 64 byte pkts */
74+#define RMON_T_P65TO127 0x22C /* RMON TX 65 to 127 byte pkts */
75+#define RMON_T_P128TO255 0x230 /* RMON TX 128 to 255 byte pkts */
76+#define RMON_T_P256TO511 0x234 /* RMON TX 256 to 511 byte pkts */
77+#define RMON_T_P512TO1023 0x238 /* RMON TX 512 to 1023 byte pkts */
78+#define RMON_T_P1024TO2047 0x23C /* RMON TX 1024 to 2047 byte pkts */
79+#define RMON_T_P_GTE2048 0x240 /* RMON TX pkts > 2048 bytes */
80+#define RMON_T_OCTETS 0x244 /* RMON TX octets */
81+#define IEEE_T_DROP 0x248 /* Count of frames not counted crtly */
82+#define IEEE_T_FRAME_OK 0x24C /* Frames tx'd OK */
83+#define IEEE_T_1COL 0x250 /* Frames tx'd with single collision */
84+#define IEEE_T_MCOL 0x254 /* Frames tx'd with multiple collision */
85+#define IEEE_T_DEF 0x258 /* Frames tx'd after deferral delay */
86+#define IEEE_T_LCOL 0x25C /* Frames tx'd with late collision */
87+#define IEEE_T_EXCOL 0x260 /* Frames tx'd with excesv collisions */
88+#define IEEE_T_MACERR 0x264 /* Frames tx'd with TX FIFO underrun */
89+#define IEEE_T_CSERR 0x268 /* Frames tx'd with carrier sense err */
90+#define IEEE_T_SQE 0x26C /* Frames tx'd with SQE err */
91+#define IEEE_T_FDXFC 0x270 /* Flow control pause frames tx'd */
92+#define IEEE_T_OCTETS_OK 0x274 /* Octet count for frames tx'd w/o err */
93+#define RMON_R_PACKETS 0x284 /* RMON RX packet count */
94+#define RMON_R_BC_PKT 0x288 /* RMON RX broadcast pkts */
95+#define RMON_R_MC_PKT 0x28C /* RMON RX multicast pkts */
96+#define RMON_R_CRC_ALIGN 0x290 /* RMON RX pkts with CRC alignment err */
97+#define RMON_R_UNDERSIZE 0x294 /* RMON RX pkts < 64 bytes, good CRC */
98+#define RMON_R_OVERSIZE 0x298 /* RMON RX pkts > MAX_FL bytes good CRC */
99+#define RMON_R_FRAG 0x29C /* RMON RX pkts < 64 bytes, bad CRC */
100+#define RMON_R_JAB 0x2A0 /* RMON RX pkts > MAX_FL bytes, bad CRC */
101+#define RMON_R_RESVD_O 0x2A4 /* Reserved */
102+#define RMON_R_P64 0x2A8 /* RMON RX 64 byte pkts */
103+#define RMON_R_P65TO127 0x2AC /* RMON RX 65 to 127 byte pkts */
104+#define RMON_R_P128TO255 0x2B0 /* RMON RX 128 to 255 byte pkts */
105+#define RMON_R_P256TO511 0x2B4 /* RMON RX 256 to 511 byte pkts */
106+#define RMON_R_P512TO1023 0x2B8 /* RMON RX 512 to 1023 byte pkts */
107+#define RMON_R_P1024TO2047 0x2BC /* RMON RX 1024 to 2047 byte pkts */
108+#define RMON_R_P_GTE2048 0x2C0 /* RMON RX pkts > 2048 bytes */
109+#define RMON_R_OCTETS 0x2C4 /* RMON RX octets */
110+#define IEEE_R_DROP 0x2C8 /* Count frames not counted correctly */
111+#define IEEE_R_FRAME_OK 0x2CC /* Frames rx'd OK */
112+#define IEEE_R_CRC 0x2D0 /* Frames rx'd with CRC err */
113+#define IEEE_R_ALIGN 0x2D4 /* Frames rx'd with alignment err */
114+#define IEEE_R_MACERR 0x2D8 /* Receive FIFO overflow count */
115+#define IEEE_R_FDXFC 0x2DC /* Flow control pause frames rx'd */
116+#define IEEE_R_OCTETS_OK 0x2E0 /* Octet cnt for frames rx'd w/o err */
117+
63118 #else
64119
65120 #define FEC_ECNTRL 0x000 /* Ethernet control reg */
@@ -148,6 +203,9 @@ struct bufdesc_ex { · 82 unmodified lines
148203 #define BD_ENET_RX_CL ((ushort)0x0001)
149204 #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
150205
206+/* Enhanced buffer descriptor control/status used by Ethernet receive */
207+#define BD_ENET_RX_VLAN 0x00000004
208+
151209 /* Buffer descriptor control/status used by Ethernet transmit.
152210 */
153211 #define BD_ENET_TX_READY ((ushort)0x8000)
@@ -272,9 +330,10 @@ struct fec_enet_private { · 118 unmodified lines
272330 int hwts_tx_en;
273331 struct timer_list time_keep;
274332 struct fec_enet_delayed_work delay_work;
333+ struct regulator *reg_phy;
275334 };
276335
277−void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev);
336+void fec_ptp_init(struct platform_device *pdev);
278337 void fec_ptp_start_cyclecounter(struct net_device *ndev);
279338 int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd);
280339
drivers/net/ethernet/freescale/fec_main.c+211−43
@@ -53,13 +53,15 @@ · 52 unmodified lines
5353 #include <linux/of_device.h>
5454 #include <linux/of_gpio.h>
5555 #include <linux/of_net.h>
56−#include <linux/pinctrl/consumer.h>
5756 #include <linux/regulator/consumer.h>
57+#include <linux/if_vlan.h>
5858
5959 #include <asm/cacheflush.h>
6060
6161 #include "fec.h"
6262
63+static void set_multicast_list(struct net_device *ndev);
64+
6365 #if defined(CONFIG_ARM)
6466 #define FEC_ALIGNMENT 0xf
6567 #else
@@ -89,6 +91,8 @@ · 23 unmodified lines
8991 #define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4)
9092 /* Controller has hardware checksum support */
9193 #define FEC_QUIRK_HAS_CSUM (1 << 5)
94+/* Controller has hardware vlan support */
95+#define FEC_QUIRK_HAS_VLAN (1 << 6)
9296
9397 static struct platform_device_id fec_devtype[] = {
9498 {
@@ -107,7 +111,8 @@ static struct platform_device_id fec_devtype[] = { · 12 unmodified lines
107111 }, {
108112 .name = "imx6q-fec",
109113 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
110− FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM,
114+ FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
115+ FEC_QUIRK_HAS_VLAN,
111116 }, {
112117 .name = "mvf600-fec",
113118 .driver_data = FEC_QUIRK_ENET_MAC,
@@ -178,11 +183,11 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address"); · 64 unmodified lines
178183 #define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII)
179184 #define FEC_RX_DISABLED_IMASK (FEC_DEFAULT_IMASK & (~FEC_ENET_RXF))
180185
181−/* The FEC stores dest/src/type, data, and checksum for receive packets.
186+/* The FEC stores dest/src/type/vlan, data, and checksum for receive packets.
182187 */
183−#define PKT_MAXBUF_SIZE 1518
188+#define PKT_MAXBUF_SIZE 1522
184189 #define PKT_MINBUF_SIZE 64
185−#define PKT_MAXBLR_SIZE 1520
190+#define PKT_MAXBLR_SIZE 1536
186191
187192 /* FEC receive acceleration */
188193 #define FEC_RACC_IPDIS (1 << 1)
@@ -243,7 +248,7 @@ static void *swap_buffer(void *bufaddr, int len) · 54 unmodified lines
243248 int i;
244249 unsigned int *buf = bufaddr;
245250
246− for (i = 0; i < (len + 3) / 4; i++, buf++)
251+ for (i = 0; i < DIV_ROUND_UP(len, 4); i++, buf++)
247252 *buf = cpu_to_be32(*buf);
248253
249254 return bufaddr;
@@ -471,9 +476,8 @@ fec_restart(struct net_device *ndev, int duplex) · 221 unmodified lines
471476 /* Clear any outstanding interrupt. */
472477 writel(0xffc00000, fep->hwp + FEC_IEVENT);
473478
474− /* Reset all multicast. */
475− writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
476− writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
479+ /* Setup multicast filter. */
480+ set_multicast_list(ndev);
477481 #ifndef CONFIG_M5272
478482 writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
479483 writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
@@ -609,6 +613,11 @@ fec_restart(struct net_device *ndev, int duplex) · 129 unmodified lines
609613 if (fep->bufdesc_ex)
610614 ecntl |= (1 << 4);
611615
616+#ifndef CONFIG_M5272
617+ /* Enable the MIB statistic event counters */
618+ writel(0 << 31, fep->hwp + FEC_MIB_CTRLSTAT);
619+#endif
620+
612621 /* And last, enable the transmit and receive processing */
613622 writel(ecntl, fep->hwp + FEC_ECNTRL);
614623 writel(0, fep->hwp + FEC_R_DES_ACTIVE);
@@ -735,6 +744,7 @@ fec_enet_tx(struct net_device *ndev) · 120 unmodified lines
735744 ndev->stats.tx_carrier_errors++;
736745 } else {
737746 ndev->stats.tx_packets++;
747+ ndev->stats.tx_bytes += bdp->cbd_datlen;
738748 }
739749
740750 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) &&
@@ -800,6 +810,9 @@ fec_enet_rx(struct net_device *ndev, int budget) · 59 unmodified lines
800810 ushort pkt_len;
801811 __u8 *data;
802812 int pkt_received = 0;
813+ struct bufdesc_ex *ebdp = NULL;
814+ bool vlan_packet_rcvd = false;
815+ u16 vlan_tag;
803816
804817 #ifdef CONFIG_M532x
805818 flush_cache_all();
@@ -863,6 +876,24 @@ fec_enet_rx(struct net_device *ndev, int budget) · 57 unmodified lines
863876 if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME)
864877 swap_buffer(data, pkt_len);
865878
879+ /* Extract the enhanced buffer descriptor */
880+ ebdp = NULL;
881+ if (fep->bufdesc_ex)
882+ ebdp = (struct bufdesc_ex *)bdp;
883+
884+ /* If this is a VLAN packet remove the VLAN Tag */
885+ vlan_packet_rcvd = false;
886+ if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
887+ fep->bufdesc_ex && (ebdp->cbd_esc & BD_ENET_RX_VLAN)) {
888+ /* Push and remove the vlan tag */
889+ struct vlan_hdr *vlan_header =
890+ (struct vlan_hdr *) (data + ETH_HLEN);
891+ vlan_tag = ntohs(vlan_header->h_vlan_TCI);
892+ pkt_len -= VLAN_HLEN;
893+
894+ vlan_packet_rcvd = true;
895+ }
896+
866897 /* This does 16 byte alignment, exactly what we need.
867898 * The packet length includes FCS, but we don't want to
868899 * include that when passing upstream as it messes up
@@ -873,9 +904,18 @@ fec_enet_rx(struct net_device *ndev, int budget) · 4 unmodified lines
873904 if (unlikely(!skb)) {
874905 ndev->stats.rx_dropped++;
875906 } else {
907+ int payload_offset = (2 * ETH_ALEN);
876908 skb_reserve(skb, NET_IP_ALIGN);
877909 skb_put(skb, pkt_len - 4); /* Make room */
878− skb_copy_to_linear_data(skb, data, pkt_len - 4);
910+
911+ /* Extract the frame data without the VLAN header. */
912+ skb_copy_to_linear_data(skb, data, (2 * ETH_ALEN));
913+ if (vlan_packet_rcvd)
914+ payload_offset = (2 * ETH_ALEN) + VLAN_HLEN;
915+ skb_copy_to_linear_data_offset(skb, (2 * ETH_ALEN),
916+ data + payload_offset,
917+ pkt_len - 4 - (2 * ETH_ALEN));
918+
879919 skb->protocol = eth_type_trans(skb, ndev);
880920
881921 /* Get receive timestamp from the skb */
@@ -883,8 +923,6 @@ fec_enet_rx(struct net_device *ndev, int budget) · 1 unmodified line
883923 struct skb_shared_hwtstamps *shhwtstamps =
884924 skb_hwtstamps(skb);
885925 unsigned long flags;
886− struct bufdesc_ex *ebdp =
887− (struct bufdesc_ex *)bdp;
888926
889927 memset(shhwtstamps, 0, sizeof(*shhwtstamps));
890928
@@ -895,9 +933,7 @@ fec_enet_rx(struct net_device *ndev, int budget) · 4 unmodified lines
895933 }
896934
897935 if (fep->bufdesc_ex &&
898− (fep->csum_flags & FLAG_RX_CSUM_ENABLED)) {
899− struct bufdesc_ex *ebdp =
900− (struct bufdesc_ex *)bdp;
936+ (fep->csum_flags & FLAG_RX_CSUM_ENABLED)) {
901937 if (!(ebdp->cbd_esc & FLAG_RX_CSUM_ERROR)) {
902938 /* don't check it */
903939 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -906,6 +942,12 @@ fec_enet_rx(struct net_device *ndev, int budget) · 2 unmodified lines
906942 }
907943 }
908944
945+ /* Handle received VLAN packets */
946+ if (vlan_packet_rcvd)
947+ __vlan_hwaccel_put_tag(skb,
948+ htons(ETH_P_8021Q),
949+ vlan_tag);
950+
909951 if (!skb_defer_rx_timestamp(skb))
910952 napi_gro_receive(&fep->napi, skb);
911953 }
@@ -1444,8 +1486,117 @@ static int fec_enet_set_pauseparam(struct net_device *ndev, · 532 unmodified lines
14441486 return 0;
14451487 }
14461488
1489+static const struct fec_stat {
1490+ char name[ETH_GSTRING_LEN];
1491+ u16 offset;
1492+} fec_stats[] = {
1493+ /* RMON TX */
1494+ { "tx_dropped", RMON_T_DROP },
1495+ { "tx_packets", RMON_T_PACKETS },
1496+ { "tx_broadcast", RMON_T_BC_PKT },
1497+ { "tx_multicast", RMON_T_MC_PKT },
1498+ { "tx_crc_errors", RMON_T_CRC_ALIGN },
1499+ { "tx_undersize", RMON_T_UNDERSIZE },
1500+ { "tx_oversize", RMON_T_OVERSIZE },
1501+ { "tx_fragment", RMON_T_FRAG },
1502+ { "tx_jabber", RMON_T_JAB },
1503+ { "tx_collision", RMON_T_COL },
1504+ { "tx_64byte", RMON_T_P64 },
1505+ { "tx_65to127byte", RMON_T_P65TO127 },
1506+ { "tx_128to255byte", RMON_T_P128TO255 },
1507+ { "tx_256to511byte", RMON_T_P256TO511 },
1508+ { "tx_512to1023byte", RMON_T_P512TO1023 },
1509+ { "tx_1024to2047byte", RMON_T_P1024TO2047 },
1510+ { "tx_GTE2048byte", RMON_T_P_GTE2048 },
1511+ { "tx_octets", RMON_T_OCTETS },
1512+
1513+ /* IEEE TX */
1514+ { "IEEE_tx_drop", IEEE_T_DROP },
1515+ { "IEEE_tx_frame_ok", IEEE_T_FRAME_OK },
1516+ { "IEEE_tx_1col", IEEE_T_1COL },
1517+ { "IEEE_tx_mcol", IEEE_T_MCOL },
1518+ { "IEEE_tx_def", IEEE_T_DEF },
1519+ { "IEEE_tx_lcol", IEEE_T_LCOL },
1520+ { "IEEE_tx_excol", IEEE_T_EXCOL },
1521+ { "IEEE_tx_macerr", IEEE_T_MACERR },
1522+ { "IEEE_tx_cserr", IEEE_T_CSERR },
1523+ { "IEEE_tx_sqe", IEEE_T_SQE },
1524+ { "IEEE_tx_fdxfc", IEEE_T_FDXFC },
1525+ { "IEEE_tx_octets_ok", IEEE_T_OCTETS_OK },
1526+
1527+ /* RMON RX */
1528+ { "rx_packets", RMON_R_PACKETS },
1529+ { "rx_broadcast", RMON_R_BC_PKT },
1530+ { "rx_multicast", RMON_R_MC_PKT },
1531+ { "rx_crc_errors", RMON_R_CRC_ALIGN },
1532+ { "rx_undersize", RMON_R_UNDERSIZE },
1533+ { "rx_oversize", RMON_R_OVERSIZE },
1534+ { "rx_fragment", RMON_R_FRAG },
1535+ { "rx_jabber", RMON_R_JAB },
1536+ { "rx_64byte", RMON_R_P64 },
1537+ { "rx_65to127byte", RMON_R_P65TO127 },
1538+ { "rx_128to255byte", RMON_R_P128TO255 },
1539+ { "rx_256to511byte", RMON_R_P256TO511 },
1540+ { "rx_512to1023byte", RMON_R_P512TO1023 },
1541+ { "rx_1024to2047byte", RMON_R_P1024TO2047 },
1542+ { "rx_GTE2048byte", RMON_R_P_GTE2048 },
1543+ { "rx_octets", RMON_R_OCTETS },
1544+
1545+ /* IEEE RX */
1546+ { "IEEE_rx_drop", IEEE_R_DROP },
1547+ { "IEEE_rx_frame_ok", IEEE_R_FRAME_OK },
1548+ { "IEEE_rx_crc", IEEE_R_CRC },
1549+ { "IEEE_rx_align", IEEE_R_ALIGN },
1550+ { "IEEE_rx_macerr", IEEE_R_MACERR },
1551+ { "IEEE_rx_fdxfc", IEEE_R_FDXFC },
1552+ { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK },
1553+};
1554+
1555+static void fec_enet_get_ethtool_stats(struct net_device *dev,
1556+ struct ethtool_stats *stats, u64 *data)
1557+{
1558+ struct fec_enet_private *fep = netdev_priv(dev);
1559+ int i;
1560+
1561+ for (i = 0; i < ARRAY_SIZE(fec_stats); i++)
1562+ data[i] = readl(fep->hwp + fec_stats[i].offset);
1563+}
1564+
1565+static void fec_enet_get_strings(struct net_device *netdev,
1566+ u32 stringset, u8 *data)
1567+{
1568+ int i;
1569+ switch (stringset) {
1570+ case ETH_SS_STATS:
1571+ for (i = 0; i < ARRAY_SIZE(fec_stats); i++)
1572+ memcpy(data + i * ETH_GSTRING_LEN,
1573+ fec_stats[i].name, ETH_GSTRING_LEN);
1574+ break;
1575+ }
1576+}
1577+
1578+static int fec_enet_get_sset_count(struct net_device *dev, int sset)
1579+{
1580+ switch (sset) {
1581+ case ETH_SS_STATS:
1582+ return ARRAY_SIZE(fec_stats);
1583+ default:
1584+ return -EOPNOTSUPP;
1585+ }
1586+}
14471587 #endif /* !defined(CONFIG_M5272) */
14481588
1589+static int fec_enet_nway_reset(struct net_device *dev)
1590+{
1591+ struct fec_enet_private *fep = netdev_priv(dev);
1592+ struct phy_device *phydev = fep->phy_dev;
1593+
1594+ if (!phydev)
1595+ return -ENODEV;
1596+
1597+ return genphy_restart_aneg(phydev);
1598+}
1599+
14491600 static const struct ethtool_ops fec_enet_ethtool_ops = {
14501601 #if !defined(CONFIG_M5272)
14511602 .get_pauseparam = fec_enet_get_pauseparam,
@@ -1456,6 +1607,12 @@ static const struct ethtool_ops fec_enet_ethtool_ops = { · 4 unmodified lines
14561607 .get_drvinfo = fec_enet_get_drvinfo,
14571608 .get_link = ethtool_op_get_link,
14581609 .get_ts_info = fec_enet_get_ts_info,
1610+ .nway_reset = fec_enet_nway_reset,
1611+#ifndef CONFIG_M5272
1612+ .get_ethtool_stats = fec_enet_get_ethtool_stats,
1613+ .get_strings = fec_enet_get_strings,
1614+ .get_sset_count = fec_enet_get_sset_count,
1615+#endif
14591616 };
14601617
14611618 static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
@@ -1803,6 +1960,12 @@ static int fec_enet_init(struct net_device *ndev) · 341 unmodified lines
18031960 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK);
18041961 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT);
18051962
1963+ if (id_entry->driver_data & FEC_QUIRK_HAS_VLAN) {
1964+ /* enable hw VLAN support */
1965+ ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;
1966+ ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
1967+ }
1968+
18061969 if (id_entry->driver_data & FEC_QUIRK_HAS_CSUM) {
18071970 /* enable hw accelerator */
18081971 ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM
@@ -1865,8 +2028,6 @@ fec_probe(struct platform_device *pdev) · 56 unmodified lines
18652028 struct resource *r;
18662029 const struct of_device_id *of_id;
18672030 static int dev_id;
1868− struct pinctrl *pinctrl;
1869− struct regulator *reg_phy;
18702031
18712032 of_id = of_match_device(fec_dt_ids, &pdev->dev);
18722033 if (of_id)
@@ -1893,17 +2054,17 @@ fec_probe(struct platform_device *pdev) · 20 unmodified lines
18932054 fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG;
18942055 #endif
18952056
1896− fep->hwp = devm_request_and_ioremap(&pdev->dev, r);
2057+ fep->hwp = devm_ioremap_resource(&pdev->dev, r);
2058+ if (IS_ERR(fep->hwp)) {
2059+ ret = PTR_ERR(fep->hwp);
2060+ goto failed_ioremap;
2061+ }
2062+
18972063 fep->pdev = pdev;
18982064 fep->dev_id = dev_id++;
18992065
19002066 fep->bufdesc_ex = 0;
19012067
1902− if (!fep->hwp) {
1903− ret = -ENOMEM;
1904− goto failed_ioremap;
1905− }
1906−
19072068 platform_set_drvdata(pdev, ndev);
19082069
19092070 ret = of_get_phy_mode(pdev->dev.of_node);
@@ -1917,12 +2078,6 @@ fec_probe(struct platform_device *pdev) · 7 unmodified lines
19172078 fep->phy_interface = ret;
19182079 }
19192080
1920− pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
1921− if (IS_ERR(pinctrl)) {
1922− ret = PTR_ERR(pinctrl);
1923− goto failed_pin;
1924− }
1925−
19262081 fep->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
19272082 if (IS_ERR(fep->clk_ipg)) {
19282083 ret = PTR_ERR(fep->clk_ipg);
@@ -1953,20 +2108,22 @@ fec_probe(struct platform_device *pdev) · 24 unmodified lines
19532108 clk_prepare_enable(fep->clk_enet_out);
19542109 clk_prepare_enable(fep->clk_ptp);
19552110
1956− reg_phy = devm_regulator_get(&pdev->dev, "phy");
1957− if (!IS_ERR(reg_phy)) {
1958− ret = regulator_enable(reg_phy);
2111+ fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
2112+ if (!IS_ERR(fep->reg_phy)) {
2113+ ret = regulator_enable(fep->reg_phy);
19592114 if (ret) {
19602115 dev_err(&pdev->dev,
19612116 "Failed to enable phy regulator: %d\n", ret);
19622117 goto failed_regulator;
19632118 }
2119+ } else {
2120+ fep->reg_phy = NULL;
19642121 }
19652122
19662123 fec_reset_phy(pdev);
19672124
19682125 if (fep->bufdesc_ex)
1969− fec_ptp_init(ndev, pdev);
2126+ fec_ptp_init(pdev);
19702127
19712128 ret = fec_enet_init(ndev);
19722129 if (ret)
@@ -2010,19 +2167,20 @@ fec_probe(struct platform_device *pdev) · 37 unmodified lines
20102167 failed_register:
20112168 fec_enet_mii_remove(fep);
20122169 failed_mii_init:
2013−failed_init:
2170+failed_irq:
20142171 for (i = 0; i < FEC_IRQ_NUM; i++) {
20152172 irq = platform_get_irq(pdev, i);
20162173 if (irq > 0)
20172174 free_irq(irq, ndev);
20182175 }
2019−failed_irq:
2176+failed_init:
2177+ if (fep->reg_phy)
2178+ regulator_disable(fep->reg_phy);
20202179 failed_regulator:
20212180 clk_disable_unprepare(fep->clk_ahb);
20222181 clk_disable_unprepare(fep->clk_ipg);
20232182 clk_disable_unprepare(fep->clk_enet_out);
20242183 clk_disable_unprepare(fep->clk_ptp);
2025−failed_pin:
20262184 failed_clk:
20272185 failed_ioremap:
20282186 free_netdev(ndev);
@@ -2041,21 +2199,21 @@ fec_drv_remove(struct platform_device *pdev) · 12 unmodified lines
20412199 unregister_netdev(ndev);
20422200 fec_enet_mii_remove(fep);
20432201 del_timer_sync(&fep->time_keep);
2202+ for (i = 0; i < FEC_IRQ_NUM; i++) {
2203+ int irq = platform_get_irq(pdev, i);
2204+ if (irq > 0)
2205+ free_irq(irq, ndev);
2206+ }
2207+ if (fep->reg_phy)
2208+ regulator_disable(fep->reg_phy);
20442209 clk_disable_unprepare(fep->clk_ptp);
20452210 if (fep->ptp_clock)
20462211 ptp_clock_unregister(fep->ptp_clock);
20472212 clk_disable_unprepare(fep->clk_enet_out);
20482213 clk_disable_unprepare(fep->clk_ahb);
20492214 clk_disable_unprepare(fep->clk_ipg);
2050− for (i = 0; i < FEC_IRQ_NUM; i++) {
2051− int irq = platform_get_irq(pdev, i);
2052− if (irq > 0)
2053− free_irq(irq, ndev);
2054− }
20552215 free_netdev(ndev);
20562216
2057− platform_set_drvdata(pdev, NULL);
2058−
20592217 return 0;
20602218 }
20612219
@@ -2074,6 +2232,9 @@ fec_suspend(struct device *dev) · 12 unmodified lines
20742232 clk_disable_unprepare(fep->clk_ahb);
20752233 clk_disable_unprepare(fep->clk_ipg);
20762234
2235+ if (fep->reg_phy)
2236+ regulator_disable(fep->reg_phy);
2237+
20772238 return 0;
20782239 }
20792240
@@ -2082,6 +2243,13 @@ fec_resume(struct device *dev) · 2 unmodified lines
20822243 {
20832244 struct net_device *ndev = dev_get_drvdata(dev);
20842245 struct fec_enet_private *fep = netdev_priv(ndev);
2246+ int ret;
2247+
2248+ if (fep->reg_phy) {
2249+ ret = regulator_enable(fep->reg_phy);
2250+ if (ret)
2251+ return ret;
2252+ }
20852253
20862254 clk_prepare_enable(fep->clk_enet_out);
20872255 clk_prepare_enable(fep->clk_ahb);
drivers/net/ethernet/freescale/fec_mpc52xx.c+4−5
@@ -981,7 +981,7 @@ static int mpc52xx_fec_probe(struct platform_device *op) · 980 unmodified lines
981981 goto err_node;
982982
983983 /* We're done ! */
984− dev_set_drvdata(&op->dev, ndev);
984+ platform_set_drvdata(op, ndev);
985985 netdev_info(ndev, "%s MAC %pM\n",
986986 op->dev.of_node->full_name, ndev->dev_addr);
987987
@@ -1010,7 +1010,7 @@ mpc52xx_fec_remove(struct platform_device *op) · 22 unmodified lines
10101010 struct net_device *ndev;
10111011 struct mpc52xx_fec_priv *priv;
10121012
1013− ndev = dev_get_drvdata(&op->dev);
1013+ ndev = platform_get_drvdata(op);
10141014 priv = netdev_priv(ndev);
10151015
10161016 unregister_netdev(ndev);
@@ -1030,14 +1030,13 @@ mpc52xx_fec_remove(struct platform_device *op) · 13 unmodified lines
10301030
10311031 free_netdev(ndev);
10321032
1033− dev_set_drvdata(&op->dev, NULL);
10341033 return 0;
10351034 }
10361035
10371036 #ifdef CONFIG_PM
10381037 static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state)
10391038 {
1040− struct net_device *dev = dev_get_drvdata(&op->dev);
1039+ struct net_device *dev = platform_get_drvdata(op);
10411040
10421041 if (netif_running(dev))
10431042 mpc52xx_fec_close(dev);
@@ -1047,7 +1046,7 @@ static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state · 3 unmodified lines
10471046
10481047 static int mpc52xx_fec_of_resume(struct platform_device *op)
10491048 {
1050− struct net_device *dev = dev_get_drvdata(&op->dev);
1049+ struct net_device *dev = platform_get_drvdata(op);
10511050
10521051 mpc52xx_fec_hw_init(dev);
10531052 mpc52xx_fec_reset_stats(dev);
drivers/net/ethernet/freescale/fec_ptp.c+2−1
@@ -347,8 +347,9 @@ static void fec_time_keep(unsigned long _data) · 346 unmodified lines
347347 * cyclecounter init routine and exits.
348348 */
349349
350−void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev)
350+void fec_ptp_init(struct platform_device *pdev)
351351 {
352+ struct net_device *ndev = platform_get_drvdata(pdev);
352353 struct fec_enet_private *fep = netdev_priv(ndev);
353354
354355 fep->ptp_caps.owner = THIS_MODULE;
drivers/net/ethernet/freescale/fs_enet/Kconfig+0−1
@@ -1,7 +1,6 @@
11 config FS_ENET
22 tristate "Freescale Ethernet Driver"
33 depends on NET_VENDOR_FREESCALE && (CPM1 || CPM2 || PPC_MPC512x)
4− select NET_CORE
54 select MII
65 select PHYLIB
76
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c+2−3
@@ -1048,7 +1048,7 @@ static int fs_enet_probe(struct platform_device *ofdev) · 1047 unmodified lines
10481048 }
10491049
10501050 SET_NETDEV_DEV(ndev, &ofdev->dev);
1051− dev_set_drvdata(&ofdev->dev, ndev);
1051+ platform_set_drvdata(ofdev, ndev);
10521052
10531053 fep = netdev_priv(ndev);
10541054 fep->dev = &ofdev->dev;
@@ -1106,7 +1106,6 @@ out_cleanup_data: · 51 unmodified lines
11061106 fep->ops->cleanup_data(ndev);
11071107 out_free_dev:
11081108 free_netdev(ndev);
1109− dev_set_drvdata(&ofdev->dev, NULL);
11101109 out_put:
11111110 of_node_put(fpi->phy_node);
11121111 out_free_fpi:
@@ -1116,7 +1115,7 @@ out_free_fpi: · 3 unmodified lines
11161115
11171116 static int fs_enet_remove(struct platform_device *ofdev)
11181117 {
1119− struct net_device *ndev = dev_get_drvdata(&ofdev->dev);
1118+ struct net_device *ndev = platform_get_drvdata(ofdev);
11201119 struct fs_enet_private *fep = netdev_priv(ndev);
11211120
11221121 unregister_netdev(ndev);
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c+2−4
@@ -179,7 +179,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) · 178 unmodified lines
179179 }
180180
181181 new_bus->parent = &ofdev->dev;
182− dev_set_drvdata(&ofdev->dev, new_bus);
182+ platform_set_drvdata(ofdev, new_bus);
183183
184184 ret = of_mdiobus_register(new_bus, ofdev->dev.of_node);
185185 if (ret)
@@ -188,7 +188,6 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) · 2 unmodified lines
188188 return 0;
189189
190190 out_free_irqs:
191− dev_set_drvdata(&ofdev->dev, NULL);
192191 kfree(new_bus->irq);
193192 out_unmap_regs:
194193 iounmap(bitbang->dir);
@@ -202,11 +201,10 @@ out: · 7 unmodified lines
202201
203202 static int fs_enet_mdio_remove(struct platform_device *ofdev)
204203 {
205− struct mii_bus *bus = dev_get_drvdata(&ofdev->dev);
204+ struct mii_bus *bus = platform_get_drvdata(ofdev);
206205 struct bb_info *bitbang = bus->priv;
207206
208207 mdiobus_unregister(bus);
209− dev_set_drvdata(&ofdev->dev, NULL);
210208 kfree(bus->irq);
211209 free_mdio_bitbang(bus);
212210 iounmap(bitbang->dir);
drivers/net/ethernet/freescale/fs_enet/mii-fec.c+2−4
@@ -180,7 +180,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) · 179 unmodified lines
180180 }
181181
182182 new_bus->parent = &ofdev->dev;
183− dev_set_drvdata(&ofdev->dev, new_bus);
183+ platform_set_drvdata(ofdev, new_bus);
184184
185185 ret = of_mdiobus_register(new_bus, ofdev->dev.of_node);
186186 if (ret)
@@ -189,7 +189,6 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) · 2 unmodified lines
189189 return 0;
190190
191191 out_free_irqs:
192− dev_set_drvdata(&ofdev->dev, NULL);
193192 kfree(new_bus->irq);
194193 out_unmap_regs:
195194 iounmap(fec->fecp);
@@ -204,11 +203,10 @@ out: · 8 unmodified lines
204203
205204 static int fs_enet_mdio_remove(struct platform_device *ofdev)
206205 {
207− struct mii_bus *bus = dev_get_drvdata(&ofdev->dev);
206+ struct mii_bus *bus = platform_get_drvdata(ofdev);
208207 struct fec_info *fec = bus->priv;
209208
210209 mdiobus_unregister(bus);
211− dev_set_drvdata(&ofdev->dev, NULL);
212210 kfree(bus->irq);
213211 iounmap(fec->fecp);
214212 kfree(fec);
drivers/net/ethernet/freescale/gianfar.c+51−6
@@ -128,6 +128,7 @@ static void gfar_set_multi(struct net_device *dev); · 127 unmodified lines
128128 static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
129129 static void gfar_configure_serdes(struct net_device *dev);
130130 static int gfar_poll(struct napi_struct *napi, int budget);
131+static int gfar_poll_sq(struct napi_struct *napi, int budget);
131132 #ifdef CONFIG_NET_POLL_CONTROLLER
132133 static void gfar_netpoll(struct net_device *dev);
133134 #endif
@@ -1000,7 +1001,7 @@ static int gfar_probe(struct platform_device *ofdev) · 866 unmodified lines
10001001 spin_lock_init(&priv->bflock);
10011002 INIT_WORK(&priv->reset_task, gfar_reset_task);
10021003
1003− dev_set_drvdata(&ofdev->dev, priv);
1004+ platform_set_drvdata(ofdev, priv);
10041005 regs = priv->gfargrp[0].regs;
10051006
10061007 gfar_detect_errata(priv);
@@ -1038,9 +1039,13 @@ static int gfar_probe(struct platform_device *ofdev) · 31 unmodified lines
10381039 dev->ethtool_ops = &gfar_ethtool_ops;
10391040
10401041 /* Register for napi ...We are registering NAPI for each grp */
1041− for (i = 0; i < priv->num_grps; i++)
1042− netif_napi_add(dev, &priv->gfargrp[i].napi, gfar_poll,
1042+ if (priv->mode == SQ_SG_MODE)
1043+ netif_napi_add(dev, &priv->gfargrp[0].napi, gfar_poll_sq,
10431044 GFAR_DEV_WEIGHT);
1045+ else
1046+ for (i = 0; i < priv->num_grps; i++)
1047+ netif_napi_add(dev, &priv->gfargrp[i].napi, gfar_poll,
1048+ GFAR_DEV_WEIGHT);
10441049
10451050 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) {
10461051 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
@@ -1240,15 +1245,13 @@ register_fail: · 193 unmodified lines
12401245
12411246 static int gfar_remove(struct platform_device *ofdev)
12421247 {
1243− struct gfar_private *priv = dev_get_drvdata(&ofdev->dev);
1248+ struct gfar_private *priv = platform_get_drvdata(ofdev);

60 more lines aren’t shown here.

drivers/net/ethernet/freescale/gianfar_ptp.c+2−2

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

drivers/net/ethernet/freescale/ucc_geth.c+2−2

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

drivers/net/ethernet/freescale/xgmac_mdio.c+2−2

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

drivers/net/ethernet/ibm/Kconfig+1−2

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

drivers/net/ethernet/ibm/ehea/ehea_main.c+2−2

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

drivers/net/ethernet/ibm/emac/mal.c+2−4

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

drivers/net/ethernet/ibm/emac/rgmii.c+8−10

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

drivers/net/ethernet/ibm/emac/tah.c+6−8

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

drivers/net/ethernet/ibm/emac/zmii.c+8−10

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

drivers/net/ethernet/icplus/Kconfig+0−1

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

drivers/net/ethernet/icplus/ipg.c+1−12

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

drivers/net/ethernet/intel/Kconfig+0−1

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

drivers/net/ethernet/intel/e100.c+2−2

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

drivers/net/ethernet/intel/e1000e/80003es2lan.c+12−12

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

drivers/net/ethernet/intel/e1000e/82571.c+15−15

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

drivers/net/ethernet/intel/e1000e/ethtool.c+17−17

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

drivers/net/ethernet/intel/e1000e/hw.h+17−17

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

drivers/net/ethernet/intel/e1000e/ich8lan.c+31−31

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

drivers/net/ethernet/intel/e1000e/netdev.c+27−28

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

drivers/net/ethernet/intel/e1000e/nvm.c+0−1

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

drivers/net/ethernet/intel/e1000e/phy.c+11−11

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

drivers/net/ethernet/intel/igb/e1000_82575.c+115−5

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

drivers/net/ethernet/intel/igb/e1000_defines.h+20−16

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

drivers/net/ethernet/intel/igb/e1000_hw.h+2−0

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

drivers/net/ethernet/intel/igb/e1000_i210.h+3−3

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

drivers/net/ethernet/intel/igb/e1000_mac.c+35−10

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

drivers/net/ethernet/intel/igb/e1000_phy.c+124−0

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

drivers/net/ethernet/intel/igb/e1000_phy.h+20−0

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

drivers/net/ethernet/intel/igb/igb.h+7−7

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

drivers/net/ethernet/intel/igb/igb_ethtool.c+35−39

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

drivers/net/ethernet/intel/igb/igb_main.c+6−3

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

drivers/net/ethernet/intel/ixgbe/ixgbe.h+134−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c+23−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h+2−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.h+1−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c+3−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c+40−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c+2−0

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

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+61−8

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

drivers/net/ethernet/jme.c+0−1

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

drivers/net/ethernet/korina.c+1−6

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

drivers/net/ethernet/marvell/mv643xx_eth.c+192−17

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

drivers/net/ethernet/marvell/mvneta.c+35−11

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

drivers/net/ethernet/marvell/pxa168_eth.c+1−2

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

drivers/net/ethernet/marvell/skge.c+1−1

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

drivers/net/ethernet/marvell/sky2.c+1−1

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

drivers/net/ethernet/mellanox/mlx4/cmd.c+191−5

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

drivers/net/ethernet/mellanox/mlx4/en_cq.c+3−0

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

drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c+0−3

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

drivers/net/ethernet/mellanox/mlx4/en_ethtool.c+19−1

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

drivers/net/ethernet/mellanox/mlx4/en_main.c+1−1

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

drivers/net/ethernet/mellanox/mlx4/en_netdev.c+75−13

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

drivers/net/ethernet/mellanox/mlx4/en_rx.c+102−82

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

drivers/net/ethernet/mellanox/mlx4/en_tx.c+1−1

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

drivers/net/ethernet/mellanox/mlx4/eq.c+7−2

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

drivers/net/ethernet/mellanox/mlx4/fw.c+12−1

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

drivers/net/ethernet/mellanox/mlx4/main.c+8−3

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

drivers/net/ethernet/mellanox/mlx4/mlx4.h+22−0

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

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+136−9

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

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c+158−5

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

drivers/net/ethernet/micrel/Kconfig+0−4

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

drivers/net/ethernet/micrel/ks8695net.c+0−1

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

drivers/net/ethernet/micrel/ks8842.c+0−1

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

drivers/net/ethernet/micrel/ks8851_mll.c+26−8

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

drivers/net/ethernet/myricom/myri10ge/myri10ge.c+1−1

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

drivers/net/ethernet/netx-eth.c+1−4

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

drivers/net/ethernet/nuvoton/Kconfig+0−1

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

drivers/net/ethernet/nuvoton/w90p910_ether.c+0−2

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

drivers/net/ethernet/nvidia/forcedeth.c+2−15

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

drivers/net/ethernet/nxp/lpc_eth.c+0−2

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

drivers/net/ethernet/octeon/octeon_mgmt.c+2−2

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

drivers/net/ethernet/oki-semi/pch_gbe/Kconfig+0−1

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h+2−0

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_api.c+44−26

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c+1−1

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c+175−152

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c+40−23

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.c+16−10

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

drivers/net/ethernet/packetengines/Kconfig+0−1

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

drivers/net/ethernet/qlogic/netxen/netxen_nic.h+9−5

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

drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h+3−0

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

drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c+93−40

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic.h+53−6

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c+266−80

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h+12−1

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c+47−12

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c+39−23

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c+116−56

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c+5−1

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h+1−0

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c+88−15

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h+7−1

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+110−116

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c+218−7

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h+4−0

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c+59−1

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c+36−0

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c+78−48

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

drivers/net/ethernet/qlogic/qlge/qlge_main.c+1−12

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

drivers/net/ethernet/rdc/Kconfig+0−1

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

drivers/net/ethernet/realtek/8139cp.c+1−1

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

drivers/net/ethernet/realtek/Kconfig+0−3

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

drivers/net/ethernet/renesas/Kconfig+0−7

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

drivers/net/ethernet/renesas/sh_eth.c+219−302

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

drivers/net/ethernet/renesas/sh_eth.h+17−12

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

drivers/net/ethernet/s6gmac.c+0−1

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

drivers/net/ethernet/seeq/sgiseeq.c+0−1

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

drivers/net/ethernet/sfc/efx.c+7−35

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

drivers/net/ethernet/sfc/efx.h+1−0

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

drivers/net/ethernet/sfc/ethtool.c+15−1

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

drivers/net/ethernet/sfc/filter.c+14−1

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

drivers/net/ethernet/sfc/net_driver.h+4−1

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

drivers/net/ethernet/sfc/nic.c+64−10

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

drivers/net/ethernet/sfc/nic.h+2−2

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

drivers/net/ethernet/sfc/ptp.c+5−8

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

drivers/net/ethernet/sfc/rx.c+25−10

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

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

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

drivers/net/ethernet/sgi/Kconfig+0−1

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

drivers/net/ethernet/sgi/ioc3-eth.c+1−13

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

drivers/net/ethernet/sgi/meth.c+0−1

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

drivers/net/ethernet/silan/sc92031.c+1−13

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

drivers/net/ethernet/sis/Kconfig+0−2

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

drivers/net/ethernet/sis/sis190.c+1−12

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

drivers/net/ethernet/smsc/Kconfig+1−6

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

drivers/net/ethernet/smsc/smc911x.c+0−2

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

drivers/net/ethernet/smsc/smc91x.c+0−3

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

drivers/net/ethernet/smsc/smsc911x.c+0−2

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

drivers/net/ethernet/stmicro/stmmac/Kconfig+0−1

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

drivers/net/ethernet/stmicro/stmmac/common.h+0−10

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

drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c+19−38

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

drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c+4−6

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

drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c+0−4

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

drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c+4−4

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

drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c+25−47

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

drivers/net/ethernet/stmicro/stmmac/enh_desc.c+26−69

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

drivers/net/ethernet/stmicro/stmmac/norm_desc.c+1−3

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

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+56−104

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

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c+46−2

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

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+29−5

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

drivers/net/ethernet/sun/cassini.c+8−10

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

drivers/net/ethernet/sun/niu.c+2−3

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

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

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

drivers/net/ethernet/sun/sungem.c+1−12

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

drivers/net/ethernet/sun/sunhme.c+2−2

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

drivers/net/ethernet/sun/sunqe.c+4−6

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

drivers/net/ethernet/ti/cpsw.c+4−3

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

drivers/net/ethernet/ti/davinci_cpdma.c+5−0

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

drivers/net/ethernet/ti/davinci_emac.c+32−87

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

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

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

drivers/net/ethernet/ti/tlan.c+1−2

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

drivers/net/ethernet/ti/tlan.h+0−1

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

drivers/net/ethernet/toshiba/tc35815.c+1−13

This diff is large: its 20 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/via/Kconfig+1−4

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

drivers/net/ethernet/via/via-velocity.c+331−176

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

drivers/net/ethernet/via/via-velocity.h+5−3

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

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

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

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

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

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

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

drivers/net/ethernet/xilinx/ll_temac_main.c+2−3

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

drivers/net/ethernet/xilinx/xilinx_axienet_main.c+2−4

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

drivers/net/ethernet/xilinx/xilinx_emaclite.c+116−120

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

drivers/net/ethernet/xscale/ixp4xx_eth.c+0−2

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

drivers/net/fddi/skfp/skfddi.c+1−12

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

drivers/net/hamradio/bpqether.c+4−3

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

drivers/net/hippi/rrunner.c+1−12

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

drivers/net/irda/bfin_sir.c+0−1

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

drivers/net/irda/sh_irda.c+0−1

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

drivers/net/irda/sh_sir.c+0−1

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

drivers/net/macvlan.c+11−1

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

drivers/net/macvtap.c+255−86

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

drivers/net/netconsole.c+2−3

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

drivers/net/nlmon.c+181−0

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

drivers/net/phy/Kconfig+10−0

This diff is large: its 17 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/at803x.c+88−40

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

drivers/net/phy/bcm63xx.c+2−2

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

drivers/net/phy/marvell.c+99−9

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

drivers/net/phy/mdio-sun4i.c+194−0

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

drivers/net/phy/phy.c+16−10

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

drivers/net/phy/phy_device.c+9−2

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

drivers/net/phy/spi_ks8995.c+1−13

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

drivers/net/phy/vitesse.c+26−12

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

drivers/net/ppp/pppoe.c+1−1

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

drivers/net/team/team.c+53−33

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

drivers/net/team/team_mode_loadbalance.c+1−2

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

drivers/net/team/team_mode_roundrobin.c+2−1

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

drivers/net/tun.c+5−7

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

drivers/net/usb/Kconfig+0−4

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

drivers/net/usb/ax88179_178a.c+3−2

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

drivers/net/usb/cdc_ether.c+17−5

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

drivers/net/usb/ipheth.c+5−0

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

drivers/net/usb/kalmia.c+15−30

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

drivers/net/usb/qmi_wwan.c+3−1

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

drivers/net/usb/r8152.c+1−13

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

drivers/net/veth.c+0−7

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

drivers/net/virtio_net.c+3−2

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

drivers/net/vxlan.c+508−280

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

drivers/net/wan/dlci.c+1−1

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

drivers/net/wan/hdlc.c+1−1

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

drivers/net/wan/ixp4xx_hss.c+0−1

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

drivers/net/wan/lapbether.c+1−1

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

drivers/net/wireless/Kconfig+1−0

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

drivers/net/wireless/Makefile+2−0

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

drivers/net/wireless/ath/Kconfig+1−0

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

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

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

drivers/net/wireless/ath/ath.h+6−7

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

drivers/net/wireless/ath/ath10k/Kconfig+39−0

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

drivers/net/wireless/ath/ath10k/Makefile+20−0

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

drivers/net/wireless/ath/ath10k/bmi.c+295−0

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

drivers/net/wireless/ath/ath10k/bmi.h+224−0

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

drivers/net/wireless/ath/ath10k/ce.c+1189−0

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

drivers/net/wireless/ath/ath10k/ce.h+516−0

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

drivers/net/wireless/ath/ath10k/core.c+665−0

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

drivers/net/wireless/ath/ath10k/core.h+369−0

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

drivers/net/wireless/ath/ath10k/debug.c+503−0

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

drivers/net/wireless/ath/ath10k/debug.h+90−0

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

drivers/net/wireless/ath/ath10k/hif.h+137−0

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

drivers/net/wireless/ath/ath10k/htc.c+1000−0

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

drivers/net/wireless/ath/ath10k/htc.h+368−0

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

drivers/net/wireless/ath/ath10k/htt.c+152−0

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

drivers/net/wireless/ath/ath10k/htt.h+1338−0

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

drivers/net/wireless/ath/ath10k/htt_rx.c+1167−0

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

drivers/net/wireless/ath/ath10k/htt_tx.c+510−0

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

drivers/net/wireless/ath/ath10k/hw.h+304−0

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

drivers/net/wireless/ath/ath10k/mac.c+3069−0

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

drivers/net/wireless/ath/ath10k/mac.h+61−0

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

drivers/net/wireless/ath/ath10k/pci.c+2507−0

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

drivers/net/wireless/ath/ath10k/pci.h+355−0

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

drivers/net/wireless/ath/ath10k/rx_desc.h+990−0

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

drivers/net/wireless/ath/ath10k/targaddrs.h+449−0

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

drivers/net/wireless/ath/ath10k/trace.c+20−0

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

drivers/net/wireless/ath/ath10k/trace.h+170−0

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

drivers/net/wireless/ath/ath10k/txrx.c+417−0

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

drivers/net/wireless/ath/ath10k/txrx.h+39−0

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

drivers/net/wireless/ath/ath10k/wmi.c+2081−0

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

drivers/net/wireless/ath/ath10k/wmi.h+3052−0

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

drivers/net/wireless/ath/ath5k/ahb.c+0−2

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

drivers/net/wireless/ath/ath5k/base.c+65−14

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

drivers/net/wireless/ath/ath5k/base.h+8−6

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

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

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

drivers/net/wireless/ath/ath6kl/cfg80211.c+32−19

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

drivers/net/wireless/ath/ath6kl/debug.c+1−7

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

drivers/net/wireless/ath/ath6kl/init.c+7−7

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

drivers/net/wireless/ath/ath6kl/sdio.c+6−6

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

drivers/net/wireless/ath/ath6kl/usb.c+27−9

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

drivers/net/wireless/ath/ath9k/Kconfig+0−8

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

drivers/net/wireless/ath/ath9k/ahb.c+0−2

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

drivers/net/wireless/ath/ath9k/ani.c+35−54

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

drivers/net/wireless/ath/ath9k/ani.h+2−21

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

drivers/net/wireless/ath/ath9k/ar5008_phy.c+3−3

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

drivers/net/wireless/ath/ath9k/ar9002_hw.c+0−4

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

drivers/net/wireless/ath/ath9k/ar9002_initvals.h+0−14

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

drivers/net/wireless/ath/ath9k/ar9003_eeprom.c+25−8

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

drivers/net/wireless/ath/ath9k/ar9003_hw.c+79−1

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

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

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

drivers/net/wireless/ath/ath9k/ar9003_paprd.c+11−8

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

drivers/net/wireless/ath/ath9k/ar9003_phy.c+102−5

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

drivers/net/wireless/ath/ath9k/ar9003_phy.h+4−2

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

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

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

drivers/net/wireless/ath/ath9k/ar9462_2p1_initvals.h+1774−0

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

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

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

drivers/net/wireless/ath/ath9k/beacon.c+7−24

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

drivers/net/wireless/ath/ath9k/calib.c+0−1

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

drivers/net/wireless/ath/ath9k/debug.c+70−360

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

drivers/net/wireless/ath/ath9k/debug.h+0−59

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

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

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

drivers/net/wireless/ath/ath9k/hif_usb.c+7−1

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

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

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

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

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

drivers/net/wireless/ath/ath9k/htc_drv_debug.c+83−16

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

drivers/net/wireless/ath/ath9k/htc_drv_init.c+16−1

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

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

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

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

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

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

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

drivers/net/wireless/ath/ath9k/hw.h+9−11

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

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

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

drivers/net/wireless/ath/ath9k/link.c+2−7

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

drivers/net/wireless/ath/ath9k/mac.c+12−4

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

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

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

drivers/net/wireless/ath/ath9k/main.c+9−46

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

drivers/net/wireless/ath/ath9k/pci.c+101−0

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

drivers/net/wireless/ath/ath9k/recv.c+3−6

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

drivers/net/wireless/ath/ath9k/reg.h+11−2

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

drivers/net/wireless/ath/ath9k/wow.c+29−139

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

drivers/net/wireless/ath/ath9k/xmit.c+273−70

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

drivers/net/wireless/ath/carl9170/carl9170.h+3−0

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

drivers/net/wireless/ath/carl9170/main.c+3−0

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

drivers/net/wireless/ath/carl9170/tx.c+104−78

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

drivers/net/wireless/ath/regd.c+3−3

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

drivers/net/wireless/ath/wil6210/Kconfig+12−0

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

drivers/net/wireless/ath/wil6210/Makefile+13−8

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

drivers/net/wireless/ath/wil6210/cfg80211.c+36−2

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

drivers/net/wireless/ath/wil6210/debug.c+69−0

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

drivers/net/wireless/ath/wil6210/debugfs.c+7−1

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

drivers/net/wireless/ath/wil6210/interrupt.c+15−14

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

drivers/net/wireless/ath/wil6210/main.c+16−48

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

drivers/net/wireless/ath/wil6210/netdev.c+54−0

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

drivers/net/wireless/ath/wil6210/trace.c+20−0

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

drivers/net/wireless/ath/wil6210/trace.h+235−0

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

drivers/net/wireless/ath/wil6210/txrx.c+121−84

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

drivers/net/wireless/ath/wil6210/txrx.h+30−6

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

drivers/net/wireless/ath/wil6210/wil6210.h+19−9

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

drivers/net/wireless/ath/wil6210/wmi.c+18−42

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

drivers/net/wireless/b43/Kconfig+4−8

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

drivers/net/wireless/b43/main.c+10−2

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

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c+239−63

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

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c+4−113

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

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

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

drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c+3−0

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

drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c+12−6

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

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

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

drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c+19−33

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

drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c+17−159

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

drivers/net/wireless/brcm80211/brcmfmac/fweh.h+2−1

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

drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c+444−499

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

drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h+1−0

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

drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h+4−16

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

drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h+21−0

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

drivers/net/wireless/brcm80211/brcmfmac/usb.c+8−0

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

drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c+13−5

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

drivers/net/wireless/brcm80211/brcmsmac/ampdu.c+1−1

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

drivers/net/wireless/cw1200/Kconfig+30−0

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

drivers/net/wireless/cw1200/Makefile+21−0

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

drivers/net/wireless/cw1200/bh.c+619−0

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

drivers/net/wireless/cw1200/bh.h+28−0

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

drivers/net/wireless/cw1200/cw1200.h+323−0

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

drivers/net/wireless/cw1200/cw1200_sdio.c+425−0

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

drivers/net/wireless/cw1200/cw1200_spi.c+471−0

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

drivers/net/wireless/cw1200/debug.c+428−0

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

drivers/net/wireless/cw1200/debug.h+93−0

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

drivers/net/wireless/cw1200/fwio.c+520−0

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

drivers/net/wireless/cw1200/fwio.h+39−0

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

drivers/net/wireless/cw1200/hwbus.h+33−0

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

drivers/net/wireless/cw1200/hwio.c+312−0

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

drivers/net/wireless/cw1200/hwio.h+247−0

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

drivers/net/wireless/cw1200/main.c+605−0

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

drivers/net/wireless/cw1200/pm.c+367−0

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

drivers/net/wireless/cw1200/pm.h+43−0

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

drivers/net/wireless/cw1200/queue.c+583−0

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

drivers/net/wireless/cw1200/queue.h+116−0

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

drivers/net/wireless/cw1200/scan.c+461−0

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

drivers/net/wireless/cw1200/scan.h+56−0

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

drivers/net/wireless/cw1200/sta.c+2403−0

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

drivers/net/wireless/cw1200/sta.h+123−0

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

drivers/net/wireless/cw1200/txrx.c+1473−0

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

drivers/net/wireless/cw1200/txrx.h+106−0

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

drivers/net/wireless/cw1200/wsm.c+1822−0

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

drivers/net/wireless/cw1200/wsm.h+1870−0

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

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

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

drivers/net/wireless/ipw2x00/ipw2200.c+1−0

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

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

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

drivers/net/wireless/iwlegacy/3945-mac.c+3−2

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

drivers/net/wireless/iwlegacy/3945.c+18−0

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

drivers/net/wireless/iwlegacy/4965-mac.c+22−3

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

drivers/net/wireless/iwlegacy/commands.h+0−8

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

drivers/net/wireless/iwlegacy/common.c+11−0

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

drivers/net/wireless/iwlegacy/common.h+37−4

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

drivers/net/wireless/iwlwifi/Kconfig+0−10

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

drivers/net/wireless/iwlwifi/Makefile+4−3

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

drivers/net/wireless/iwlwifi/dvm/Makefile+0−1

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

drivers/net/wireless/iwlwifi/dvm/agn.h+12−46

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

drivers/net/wireless/iwlwifi/dvm/calib.c+4−4

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

drivers/net/wireless/iwlwifi/dvm/commands.h+0−12

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

drivers/net/wireless/iwlwifi/dvm/dev.h+55−18

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

drivers/net/wireless/iwlwifi/dvm/devices.c+100−7

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

drivers/net/wireless/iwlwifi/dvm/lib.c+10−16

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

drivers/net/wireless/iwlwifi/dvm/mac80211.c+22−15

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

drivers/net/wireless/iwlwifi/dvm/main.c+27−40

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

drivers/net/wireless/iwlwifi/dvm/power.c+3−3

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

drivers/net/wireless/iwlwifi/dvm/rs.c+16−35

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

drivers/net/wireless/iwlwifi/dvm/rx.c+13−29

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

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

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

drivers/net/wireless/iwlwifi/dvm/testmode.c+0−471

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

drivers/net/wireless/iwlwifi/dvm/tt.c+1−1

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

drivers/net/wireless/iwlwifi/dvm/tx.c+6−18

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

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

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

drivers/net/wireless/iwlwifi/iwl-1000.c+0−3

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

drivers/net/wireless/iwlwifi/iwl-2000.c+3−36

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

drivers/net/wireless/iwlwifi/iwl-5000.c+0−4

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

drivers/net/wireless/iwlwifi/iwl-6000.c+2−30

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

drivers/net/wireless/iwlwifi/iwl-7000.c+47−18

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

drivers/net/wireless/iwlwifi/iwl-config.h+11−43

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

drivers/net/wireless/iwlwifi/iwl-csr.h+19−0

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

drivers/net/wireless/iwlwifi/iwl-debug.h+4−0

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

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

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

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

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

drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c+8−7

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

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

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

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

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

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

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

drivers/net/wireless/iwlwifi/iwl-nvm-parse.c+12−8

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

drivers/net/wireless/iwlwifi/iwl-nvm-parse.h+1−1

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

drivers/net/wireless/iwlwifi/iwl-phy-db.c+6−33

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

drivers/net/wireless/iwlwifi/iwl-prph.h+12−0

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

drivers/net/wireless/iwlwifi/iwl-test.c+0−852

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

drivers/net/wireless/iwlwifi/iwl-test.h+0−161

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

drivers/net/wireless/iwlwifi/iwl-testmode.h+0−309

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

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

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

drivers/net/wireless/iwlwifi/mvm/Makefile+1−1

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

drivers/net/wireless/iwlwifi/mvm/bt-coex.c+25−4

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

drivers/net/wireless/iwlwifi/mvm/d3.c+179−18

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

drivers/net/wireless/iwlwifi/mvm/debugfs.c+443−10

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

drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h+3−1

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

drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h+7−1

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

drivers/net/wireless/iwlwifi/mvm/fw-api-power.h+95−3

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

drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h+6−4

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

drivers/net/wireless/iwlwifi/mvm/fw-api.h+233−0

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

drivers/net/wireless/iwlwifi/mvm/fw.c+36−1

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

drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c+86−11

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

drivers/net/wireless/iwlwifi/mvm/mac80211.c+213−86

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

drivers/net/wireless/iwlwifi/mvm/mvm.h+194−10

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

drivers/net/wireless/iwlwifi/mvm/nvm.c+199−13

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

drivers/net/wireless/iwlwifi/mvm/ops.c+32−5

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

drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c+22−54

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

drivers/net/wireless/iwlwifi/mvm/power.c+211−7

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

drivers/net/wireless/iwlwifi/mvm/quota.c+16−9

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

drivers/net/wireless/iwlwifi/mvm/rs.c+152−19

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

drivers/net/wireless/iwlwifi/mvm/rs.h+17−0

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

drivers/net/wireless/iwlwifi/mvm/rx.c+22−0

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

drivers/net/wireless/iwlwifi/mvm/scan.c+0−6

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

drivers/net/wireless/iwlwifi/mvm/sta.c+10−14

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

drivers/net/wireless/iwlwifi/mvm/sta.h+6−2

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

drivers/net/wireless/iwlwifi/mvm/tt.c+530−0

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

drivers/net/wireless/iwlwifi/mvm/tx.c+3−4

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

drivers/net/wireless/iwlwifi/mvm/utils.c+41−0

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

drivers/net/wireless/iwlwifi/pcie/drv.c+51−3

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

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

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

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

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

drivers/net/wireless/iwlwifi/pcie/trans.c+42−26

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

drivers/net/wireless/iwlwifi/pcie/tx.c+30−10

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

drivers/net/wireless/libertas/mesh.c+1−1

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

drivers/net/wireless/mwifiex/11h.c+101−0

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

drivers/net/wireless/mwifiex/Kconfig+2−2

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

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

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

drivers/net/wireless/mwifiex/cfg80211.c+99−23

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

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

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

drivers/net/wireless/mwifiex/fw.h+33−0

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

drivers/net/wireless/mwifiex/init.c+19−96

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

drivers/net/wireless/mwifiex/join.c+4−3

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

drivers/net/wireless/mwifiex/main.c+98−3

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

drivers/net/wireless/mwifiex/main.h+31−1

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

drivers/net/wireless/mwifiex/scan.c+46−14

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

drivers/net/wireless/mwifiex/sdio.c+326−137

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

drivers/net/wireless/mwifiex/sdio.h+226−114

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

drivers/net/wireless/mwifiex/sta_cmd.c+62−0

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

drivers/net/wireless/mwifiex/sta_cmdresp.c+17−0

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

drivers/net/wireless/mwifiex/sta_event.c+11−0

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

drivers/net/wireless/mwifiex/sta_ioctl.c+30−22

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

drivers/net/wireless/mwifiex/uap_cmd.c+21−0

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

drivers/net/wireless/mwifiex/uap_event.c+19−6

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

drivers/net/wireless/mwifiex/wmm.c+4−1

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

drivers/net/wireless/mwl8k.c+9−2

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

drivers/net/wireless/orinoco/orinoco_pci.h+1−1

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

drivers/net/wireless/orinoco/orinoco_usb.c+2−1

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

drivers/net/wireless/p54/p54spi.c+8−29

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

drivers/net/wireless/rt2x00/rt2400pci.c+37−29

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

drivers/net/wireless/rt2x00/rt2500pci.c+37−29

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

drivers/net/wireless/rt2x00/rt2500usb.c+37−29

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

drivers/net/wireless/rt2x00/rt2800.h+7−5

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

drivers/net/wireless/rt2x00/rt2800lib.c+528−307

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

drivers/net/wireless/rt2x00/rt2800pci.c+40−28

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

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

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

drivers/net/wireless/rt2x00/rt2x00.h+4−5

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

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

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

drivers/net/wireless/rt2x00/rt2x00pci.c+8−1

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

drivers/net/wireless/rt2x00/rt2x00queue.c+14−18

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

drivers/net/wireless/rt2x00/rt2x00queue.h+2−19

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

drivers/net/wireless/rt2x00/rt61pci.c+36−24

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

drivers/net/wireless/rt2x00/rt73usb.c+35−23

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

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

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

drivers/net/wireless/rtlwifi/rtl8192cu/rf.c+1−1

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

drivers/net/wireless/rtlwifi/rtl8192cu/sw.c+1−0

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

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

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

drivers/net/wireless/rtlwifi/rtl8723ae/sw.c+3−3

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

drivers/net/wireless/ti/wl1251/spi.c+4−26

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

drivers/net/wireless/ti/wl18xx/main.c+45−2

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

drivers/net/wireless/ti/wl18xx/reg.h+15−0

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

drivers/net/wireless/ti/wlcore/Makefile+1−1

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

drivers/net/wireless/ti/wlcore/main.c+66−218

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

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

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

drivers/net/wireless/ti/wlcore/spi.c+1−13

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

drivers/net/wireless/ti/wlcore/sysfs.c+216−0

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

drivers/net/wireless/ti/wlcore/sysfs.h+28−0

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

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

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

drivers/net/xen-netback/common.h+11−3

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

drivers/net/xen-netback/interface.c+87−15

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

drivers/net/xen-netback/netback.c+32−10

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

drivers/net/xen-netback/xenbus.c+42−11

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

drivers/net/xen-netfront.c+188−65

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

drivers/nfc/Kconfig+10−0

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

drivers/nfc/Makefile+1−0

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

drivers/nfc/mei_phy.c+3−3

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

drivers/nfc/microread/microread.c+2−4

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

drivers/nfc/nfcsim.c+541−0

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

drivers/nfc/nfcwilink.c+5−13

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

drivers/nfc/pn533.c+22−9

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

drivers/nfc/pn544/pn544.c+20−20

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

drivers/of/of_net.c+1−0

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

drivers/s390/net/netiucv.c+0−20

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

drivers/s390/net/qeth_core.h+1−1

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

drivers/s390/net/qeth_core_main.c+13−10

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

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c+1−1

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

drivers/scsi/fcoe/fcoe.c+1−1

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

drivers/scsi/fcoe/fcoe_transport.c+1−1

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

drivers/scsi/libiscsi_tcp.c+0−1

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

drivers/ssb/driver_chipcommon_sflash.c+30−4

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

drivers/ssb/main.c+8−0

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

drivers/ssb/pcihost_wrapper.c+1−1

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

drivers/ssb/sprom.c+1−1

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

drivers/ssb/ssb_private.h+4−0

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

drivers/staging/csr/netdev.c+1−1

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

drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c+1−1

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

drivers/staging/ft1000/ft1000-usb/ft1000_proc.c+1−1

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

drivers/staging/rtl8192u/r8192U_core.c+2−2

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

drivers/staging/silicom/Kconfig+3−4

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

drivers/staging/silicom/bpctl_mod.c+1−1

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

drivers/vhost/net.c+7−2

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

drivers/virtio/virtio_ring.c+44−12

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

fs/select.c+57−5

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

include/linux/bcma/bcma.h+1−0

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

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

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

include/linux/can/platform/flexcan.h+0−20

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

include/linux/filter.h+2−2

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

include/linux/ieee80211.h+10−0

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

include/linux/if_link.h+1−0

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

include/linux/if_macvlan.h+9−3

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

include/linux/if_team.h+11−0

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

include/linux/if_vlan.h+0−2

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

include/linux/igmp.h+1−0

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

include/linux/inetdevice.h+5−0

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

include/linux/jiffies.h+4−0

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

include/linux/ktime.h+13−0

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

include/linux/marvell_phy.h+2−0

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

include/linux/mlx4/cmd.h+2−1

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

include/linux/mlx4/device.h+2−1

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

include/linux/mlx4/qp.h+36−0

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

include/linux/mv643xx_eth.h+2−0

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

include/linux/net.h+3−3

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

include/linux/netdev_features.h+3−1

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

include/linux/netdevice.h+83−2

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

include/linux/netfilter.h+1−1

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

include/linux/netlink.h+27−0

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

include/linux/netpoll.h+2−2

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

include/linux/phy.h+27−0

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

include/linux/platform_data/brcmfmac-sdio.h+5−0

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

include/linux/platform_data/net-cw1200.h+81−0

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

include/linux/sched.h+9−0

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

include/linux/skbuff.h+20−117

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

include/linux/ssb/ssb_driver_mips.h+15−0

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

include/linux/ssb/ssb_regs.h+1−0

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

include/linux/stmmac.h+4−0

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

include/linux/tcp.h+0−1

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

include/linux/virtio.h+4−0

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

include/net/act_api.h+1−1

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

include/net/addrconf.h+4−0

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

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

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

include/net/bluetooth/hci_core.h+11−18

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

include/net/bluetooth/l2cap.h+1−1

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

include/net/cfg80211.h+141−95

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

include/net/gen_stats.h+5−5

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

include/net/gre.h+31−0

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

include/net/ieee80211_radiotap.h+7−0

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

include/net/if_inet6.h+10−3

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

include/net/inet_ecn.h+4−2

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

include/net/inet_sock.h+0−1

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

include/net/ip_fib.h+3−2

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

include/net/ip_tunnels.h+24−12

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

include/net/ip_vs.h+52−40

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

include/net/ipv6.h+8−2

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

include/net/ll_poll.h+183−0

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

include/net/mac80211.h+21−6

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

include/net/ndisc.h+1−1

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

include/net/net_namespace.h+13−0

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

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

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

include/net/netns/x_tables.h+6−0

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

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

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

include/net/nfc/nci_core.h+55−3

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

include/net/nfc/nfc.h+30−5

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

include/net/ping.h+62−3

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

include/net/sch_generic.h+9−8

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

include/net/sctp/checksum.h+5−0

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

include/net/sctp/sctp.h+0−111

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

include/net/sctp/structs.h+3−3

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

include/net/sock.h+15−6

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

include/net/tcp.h+15−14

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

include/net/transp_v6.h+40−39

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

include/net/udp.h+5−3

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

include/uapi/asm-generic/poll.h+2−0

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

include/uapi/asm-generic/socket.h+2−0

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

include/uapi/linux/ethtool.h+2−2

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

include/uapi/linux/gen_stats.h+11−0

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

include/uapi/linux/if_arp.h+1−0

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

include/uapi/linux/if_link.h+15−0

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

include/uapi/linux/if_pppox.h+2−2

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

include/uapi/linux/if_tun.h+2−0

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

include/uapi/linux/ip_vs.h+6−0

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

include/uapi/linux/netfilter/nfnetlink_queue.h+2−0

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

include/uapi/linux/netfilter/xt_socket.h+7−0

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

include/uapi/linux/nfc.h+17−1

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

include/uapi/linux/nl80211.h+37−0

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

include/uapi/linux/openvswitch.h+19−1

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

include/uapi/linux/rtnetlink.h+2−0

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

include/uapi/linux/snmp.h+2−0

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

include/uapi/linux/tipc.h+1−1

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

include/uapi/linux/tipc_config.h+1−1

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

include/xen/interface/io/netif.h+12−0

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

kernel/sysctl_binary.c+0−1

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

lib/vsprintf.c+122−2

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

net/8021q/vlan.c+1−1

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

net/Kconfig+17−0

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

net/Makefile+1−0

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

net/appletalk/aarp.c+1−1

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

net/appletalk/ddp.c+1−1

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

net/atm/clip.c+5−3

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

net/atm/mpc.c+2−4

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

net/ax25/af_ax25.c+3−3

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

net/ax25/sysctl_net_ax25.c+1−1

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

net/batman-adv/Makefile+0−1

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

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

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

net/batman-adv/bridge_loop_avoidance.c+51−43

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

net/batman-adv/bridge_loop_avoidance.h+7−5

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

net/batman-adv/distributed-arp-table.c+39−43

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

net/batman-adv/hard-interface.c+58−40

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

net/batman-adv/icmp_socket.c+2−2

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

net/batman-adv/main.c+0−1

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

net/batman-adv/main.h+17−1

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

net/batman-adv/network-coding.c+14−8

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

net/batman-adv/network-coding.h+2−4

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

net/batman-adv/originator.c+3−3

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

net/batman-adv/originator.h+1−1

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

net/batman-adv/ring_buffer.c+0−51

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

net/batman-adv/ring_buffer.h+0−27

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

net/batman-adv/routing.c+19−45

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

net/batman-adv/routing.h+0−1

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

net/batman-adv/send.c+24−12

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

net/batman-adv/send.h+3−3

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

net/batman-adv/soft-interface.c+3−3

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

net/batman-adv/translation-table.c+49−25

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

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

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

net/batman-adv/types.h+4−2

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

net/batman-adv/unicast.c+1−1

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

net/batman-adv/vis.c+10−9

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

net/bluetooth/hci_core.c+60−132

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

net/bluetooth/hci_event.c+6−65

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

net/bluetooth/hidp/core.c+4−10

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

net/bluetooth/l2cap_core.c+81−40

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

net/bluetooth/l2cap_sock.c+2−2

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

net/bluetooth/mgmt.c+155−74

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

net/bridge/br_device.c+11−10

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

net/bridge/br_fdb.c+5−0

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

net/bridge/br_forward.c+9−5

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

net/bridge/br_if.c+1−1

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

net/bridge/br_input.c+10−5

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

net/bridge/br_mdb.c+1−1

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

net/bridge/br_multicast.c+44−30

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

net/bridge/br_netfilter.c+2−2

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

net/bridge/br_netlink.c+9−1

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

net/bridge/br_notify.c+1−1

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

net/bridge/br_private.h+7−2

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

net/bridge/br_sysfs_br.c+26−0

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

net/bridge/br_sysfs_if.c+4−0

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

net/bridge/netfilter/ebt_ulog.c+6−0

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

net/bridge/netfilter/ebtables.c+3−3

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

net/caif/caif_dev.c+2−2

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

net/caif/caif_usb.c+2−2

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

net/can/af_can.c+2−2

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

net/can/bcm.c+2−2

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

net/can/gw.c+2−2

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

net/can/raw.c+2−2

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

net/core/datagram.c+5−0

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

net/core/dev.c+192−46

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

net/core/drop_monitor.c+2−2

This diff is large: its 12 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+22−2

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

net/core/fib_rules.c+2−2

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

net/core/gen_estimator.c+6−6

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

net/core/gen_stats.c+17−5

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

net/core/link_watch.c+3−0

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

net/core/neighbour.c+19−15

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

net/core/net-procfs.c+14−2

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

net/core/netpoll.c+5−11

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

net/core/netprio_cgroup.c+1−1

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

net/core/pktgen.c+40−41

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

net/core/rtnetlink.c+21−11

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

net/core/skbuff.c+43−26

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

net/core/sock.c+26−0

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

net/core/sysctl_net_core.c+137−2

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

net/decnet/af_decnet.c+2−2

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

net/decnet/dn_dev.c+3−3

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

net/decnet/sysctl_net_decnet.c+3−3

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

net/ieee802154/6lowpan.c+2−3

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

net/ipv4/Kconfig+3−8

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

net/ipv4/Makefile+4−3

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

net/ipv4/af_inet.c+6−20

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

net/ipv4/ah4.c+2−5

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

net/ipv4/arp.c+7−1

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

net/ipv4/devinet.c+5−4

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

net/ipv4/esp4.c+2−5

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

net/ipv4/fib_frontend.c+2−2

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

net/ipv4/fib_semantics.c+2−1

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

net/ipv4/gre.c+0−253

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

net/ipv4/gre_demux.c+414−0

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

net/ipv4/gre_offload.c+127−0

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

net/ipv4/icmp.c+30−21

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

net/ipv4/igmp.c+71−8

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

net/ipv4/inet_fragment.c+0−2

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

net/ipv4/ip_gre.c+35−223

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

net/ipv4/ip_tunnel.c+79−98

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

net/ipv4/ip_tunnel_core.c+122−0

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

net/ipv4/ip_vti.c+0−7

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

net/ipv4/ipcomp.c+2−5

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

net/ipv4/ipip.c+13−7

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

net/ipv4/ipmr.c+2−2

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

net/ipv4/netfilter/Kconfig+1−1

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

net/ipv4/netfilter/ipt_MASQUERADE.c+5−2

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

net/ipv4/netfilter/ipt_ULOG.c+6−0

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

net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c+1−1

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

net/ipv4/ping.c+451−190

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

net/ipv4/proc.c+1−0

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

net/ipv4/route.c+101−43

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

net/ipv4/sysctl_net_ipv4.c+16−15

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

net/ipv4/tcp.c+28−316

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

net/ipv4/tcp_input.c+224−293

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

net/ipv4/tcp_ipv4.c+4−74

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

net/ipv4/tcp_minisocks.c+2−4

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

net/ipv4/tcp_offload.c+332−0

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

net/ipv4/tcp_output.c+22−17

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

net/ipv4/udp.c+13−77

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

net/ipv4/udp_offload.c+100−0

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

net/ipv4/xfrm4_tunnel.c+1−1

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

net/ipv6/Makefile+1−1

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

net/ipv6/addrconf.c+190−114

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

net/ipv6/addrconf_core.c+1−0

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

net/ipv6/af_inet6.c+12−0

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

net/ipv6/datagram.c+27−0

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

net/ipv6/exthdrs_core.c+1−1

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

net/ipv6/icmp.c+16−7

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

net/ipv6/ip6_offload.c+1−0

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

net/ipv6/ip6_output.c+10−6

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

net/ipv6/ip6mr.c+1−1

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

net/ipv6/mcast.c+65−10

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

net/ipv6/mip6.c+4−2

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

net/ipv6/ndisc.c+6−5

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

net/ipv6/netfilter/ip6t_MASQUERADE.c+4−2

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

net/ipv6/output_core.c+2−1

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

net/ipv6/ping.c+277−0

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

net/ipv6/raw.c+10−38

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

net/ipv6/route.c+15−9

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

net/ipv6/sit.c+166−45

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

net/ipv6/sysctl_net_ipv6.c+2−2

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

net/ipv6/tcp_ipv6.c+2−0

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

net/ipv6/udp.c+20−42

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

net/ipv6/udp_offload.c+2−1

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

net/ipx/af_ipx.c+1−1

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

net/irda/irsysctl.c+3−3

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

net/iucv/af_iucv.c+1−1

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

net/l2tp/l2tp_core.c+90−24

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

net/l2tp/l2tp_core.h+5−0

This diff is large: its 12 lines aren’t shown here.

net/l2tp/l2tp_ppp.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/mac80211/aes_ccm.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/mac80211/cfg.c+43−24

This diff is large: its 168 lines aren’t shown here.

net/mac80211/debugfs_netdev.c+8−7

This diff is large: its 65 lines aren’t shown here.

net/mac80211/driver-ops.h+2−1

This diff is large: its 10 lines aren’t shown here.

net/mac80211/ht.c+5−3

This diff is large: its 36 lines aren’t shown here.

net/mac80211/ibss.c+42−72

This diff is large: its 394 lines aren’t shown here.

net/mac80211/ieee80211_i.h+25−12

This diff is large: its 112 lines aren’t shown here.

net/mac80211/iface.c+25−9

This diff is large: its 95 lines aren’t shown here.

net/mac80211/key.c+12−12

This diff is large: its 63 lines aren’t shown here.

net/mac80211/key.h+2−13

This diff is large: its 34 lines aren’t shown here.

net/mac80211/main.c+3−4

This diff is large: its 28 lines aren’t shown here.

net/mac80211/mesh.c+69−38

This diff is large: its 221 lines aren’t shown here.

net/mac80211/mesh.h+4−3

This diff is large: its 41 lines aren’t shown here.

net/mac80211/mesh_plink.c+7−1

This diff is large: its 16 lines aren’t shown here.

net/mac80211/mlme.c+174−262

This diff is large: its 1153 lines aren’t shown here.

net/mac80211/rate.c+7−1

This diff is large: its 16 lines aren’t shown here.

net/mac80211/rx.c+34−22

This diff is large: its 120 lines aren’t shown here.

net/mac80211/scan.c+9−0

This diff is large: its 16 lines aren’t shown here.

net/mac80211/sta_info.c+7−1

This diff is large: its 43 lines aren’t shown here.

net/mac80211/sta_info.h+9−0

This diff is large: its 30 lines aren’t shown here.

net/mac80211/tx.c+3−8

This diff is large: its 30 lines aren’t shown here.

net/mac80211/util.c+11−30

This diff is large: its 71 lines aren’t shown here.

net/mac80211/vht.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/mac80211/wep.c+25−23

This diff is large: its 144 lines aren’t shown here.

net/mac80211/wpa.c+36−32

This diff is large: its 177 lines aren’t shown here.

net/mpls/Kconfig+9−0

This diff is large: its 10 lines aren’t shown here.

net/mpls/Makefile+4−0

This diff is large: its 5 lines aren’t shown here.

net/mpls/mpls_gso.c+108−0

This diff is large: its 109 lines aren’t shown here.

net/netfilter/core.c+15−6

This diff is large: its 33 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_conn.c+20−15

This diff is large: its 93 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_core.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_ctl.c+28−7

This diff is large: its 102 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_dh.c+4−6

This diff is large: its 31 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_lblc.c+6−8

This diff is large: its 47 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_lblcr.c+6−8

This diff is large: its 47 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_lc.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_nq.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_proto_sctp.c+157−703

This diff is large: its 907 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_proto_tcp.c+8−6

This diff is large: its 62 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_rr.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_sed.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_sh.c+88−20

This diff is large: its 170 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_sync.c+16−3

This diff is large: its 40 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_wlc.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_wrr.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/nf_conntrack_ftp.c+54−19

This diff is large: its 151 lines aren’t shown here.

net/netfilter/nf_conntrack_netlink.c+23−7

This diff is large: its 83 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_tcp.c+6−0

This diff is large: its 13 lines aren’t shown here.

net/netfilter/nf_conntrack_standalone.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/netfilter/nf_log.c+2−4

This diff is large: its 20 lines aren’t shown here.

net/netfilter/nf_nat_helper.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/nfnetlink_cthelper.c+12−4

This diff is large: its 41 lines aren’t shown here.

net/netfilter/nfnetlink_cttimeout.c+4−2

This diff is large: its 13 lines aren’t shown here.

net/netfilter/nfnetlink_queue_core.c+29−18

This diff is large: its 126 lines aren’t shown here.

net/netfilter/xt_CT.c+6−4

This diff is large: its 39 lines aren’t shown here.

net/netfilter/xt_TEE.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/xt_rateest.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/xt_socket.c+78−18

This diff is large: its 175 lines aren’t shown here.

net/netlabel/netlabel_unlabeled.c+3−4

This diff is large: its 22 lines aren’t shown here.

net/netlink/af_netlink.c+168−10

This diff is large: its 325 lines aren’t shown here.

net/netlink/af_netlink.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/netrom/af_netrom.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netrom/sysctl_net_netrom.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/nfc/core.c+221−3

This diff is large: its 283 lines aren’t shown here.

net/nfc/hci/core.c+59−16

This diff is large: its 132 lines aren’t shown here.

net/nfc/llcp.h+2−1

This diff is large: its 17 lines aren’t shown here.

net/nfc/llcp_commands.c+1−21

This diff is large: its 36 lines aren’t shown here.

net/nfc/llcp_core.c+14−2

This diff is large: its 51 lines aren’t shown here.

net/nfc/llcp_sock.c+14−5

This diff is large: its 60 lines aren’t shown here.

net/nfc/nci/Kconfig+10−0

This diff is large: its 14 lines aren’t shown here.

net/nfc/nci/Makefile+3−1

This diff is large: its 8 lines aren’t shown here.

net/nfc/nci/core.c+24−13

This diff is large: its 111 lines aren’t shown here.

net/nfc/nci/data.c+0−2

This diff is large: its 9 lines aren’t shown here.

net/nfc/nci/spi.c+378−0

This diff is large: its 379 lines aren’t shown here.

net/nfc/netlink.c+182−1

This diff is large: its 218 lines aren’t shown here.

net/nfc/nfc.h+11−0

This diff is large: its 30 lines aren’t shown here.

net/openvswitch/Kconfig+14−0

This diff is large: its 18 lines aren’t shown here.

net/openvswitch/Makefile+2−1

This diff is large: its 8 lines aren’t shown here.

net/openvswitch/actions.c+8−0

This diff is large: its 25 lines aren’t shown here.

net/openvswitch/datapath.c+304−67

This diff is large: its 584 lines aren’t shown here.

net/openvswitch/datapath.h+4−0

This diff is large: its 21 lines aren’t shown here.

net/openvswitch/dp_notify.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/openvswitch/flow.c+180−31

This diff is large: its 369 lines aren’t shown here.

net/openvswitch/flow.h+41−6

This diff is large: its 80 lines aren’t shown here.

net/openvswitch/vport-gre.c+275−0

This diff is large: its 276 lines aren’t shown here.

net/openvswitch/vport-internal_dev.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/openvswitch/vport-netdev.c+5−4

This diff is large: its 31 lines aren’t shown here.

net/openvswitch/vport-netdev.h+0−1

This diff is large: its 7 lines aren’t shown here.

net/openvswitch/vport.c+30−4

This diff is large: its 80 lines aren’t shown here.

net/openvswitch/vport.h+18−5

This diff is large: its 63 lines aren’t shown here.

net/packet/af_packet.c+3−2

This diff is large: its 14 lines aren’t shown here.

net/phonet/pn_dev.c+2−2

This diff is large: its 12 lines aren’t shown here.

net/phonet/sysctl.c+2−2

This diff is large: its 16 lines aren’t shown here.

net/rds/ib_sysctl.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/rds/iw_sysctl.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/rds/sysctl.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/rose/af_rose.c+3−3

This diff is large: its 14 lines aren’t shown here.

net/rose/sysctl_net_rose.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/act_mirred.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_cbq.c+1−1

This diff is large: its 9 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+20−24

This diff is large: its 58 lines aren’t shown here.

net/sched/sch_hfsc.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_htb.c+140−121

This diff is large: its 496 lines aren’t shown here.

net/sched/sch_netem.c+87−24

This diff is large: its 204 lines aren’t shown here.

net/sched/sch_qfq.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_tbf.c+45−2

This diff is large: its 60 lines aren’t shown here.

net/sctp/Kconfig+2−9

This diff is large: its 25 lines aren’t shown here.

net/sctp/associola.c+38−46

This diff is large: its 191 lines aren’t shown here.

net/sctp/bind_addr.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sctp/chunk.c+4−3

This diff is large: its 21 lines aren’t shown here.

net/sctp/debug.c+0−4

This diff is large: its 11 lines aren’t shown here.

net/sctp/endpointola.c+15−10

This diff is large: its 50 lines aren’t shown here.

net/sctp/input.c+6−6

This diff is large: its 46 lines aren’t shown here.

net/sctp/inqueue.c+4−5

This diff is large: its 20 lines aren’t shown here.

net/sctp/ipv6.c+16−13

This diff is large: its 88 lines aren’t shown here.

net/sctp/output.c+17−23

This diff is large: its 103 lines aren’t shown here.

net/sctp/outqueue.c+49−165

This diff is large: its 338 lines aren’t shown here.

net/sctp/proc.c+9−3

This diff is large: its 19 lines aren’t shown here.

net/sctp/protocol.c+29−27

This diff is large: its 153 lines aren’t shown here.

net/sctp/sm_make_chunk.c+26−28

This diff is large: its 143 lines aren’t shown here.

net/sctp/sm_sideeffect.c+50−57

This diff is large: its 235 lines aren’t shown here.

net/sctp/sm_statefuns.c+51−34

This diff is large: its 247 lines aren’t shown here.

net/sctp/socket.c+138−151

This diff is large: its 795 lines aren’t shown here.

net/sctp/sysctl.c+5−5

This diff is large: its 41 lines aren’t shown here.

net/sctp/transport.c+25−26

This diff is large: its 100 lines aren’t shown here.

net/sctp/tsnmap.c+5−5

This diff is large: its 24 lines aren’t shown here.

net/sctp/ulpevent.c+5−5

This diff is large: its 24 lines aren’t shown here.

net/socket.c+21−2

This diff is large: its 50 lines aren’t shown here.

net/sunrpc/sysctl.c+5−5

This diff is large: its 45 lines aren’t shown here.

net/sunrpc/xprtrdma/svc_rdma.c+4−4

This diff is large: its 36 lines aren’t shown here.

net/sunrpc/xprtrdma/transport.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/sunrpc/xprtsock.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/tipc/Makefile+2−1

This diff is large: its 9 lines aren’t shown here.

net/tipc/bcast.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/tipc/bcast.h+2−1

This diff is large: its 10 lines aren’t shown here.

net/tipc/config.c+48−71

This diff is large: its 192 lines aren’t shown here.

net/tipc/core.c+15−7

This diff is large: its 74 lines aren’t shown here.

net/tipc/core.h+15−2

This diff is large: its 38 lines aren’t shown here.

net/tipc/discover.c+3−4

This diff is large: its 21 lines aren’t shown here.

net/tipc/eth_media.c+5−14

This diff is large: its 48 lines aren’t shown here.

net/tipc/ib_media.c+4−13

This diff is large: its 39 lines aren’t shown here.

net/tipc/link.c+26−62

This diff is large: its 196 lines aren’t shown here.

net/tipc/msg.c+7−12

This diff is large: its 40 lines aren’t shown here.

net/tipc/msg.h+4−4

This diff is large: its 14 lines aren’t shown here.

net/tipc/name_table.c+5−5

This diff is large: its 45 lines aren’t shown here.

net/tipc/name_table.h+6−5

This diff is large: its 21 lines aren’t shown here.

net/tipc/node_subscr.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/tipc/port.c+11−309

This diff is large: its 404 lines aren’t shown here.

net/tipc/port.h+12−73

This diff is large: its 150 lines aren’t shown here.

net/tipc/server.c+596−0

This diff is large: its 597 lines aren’t shown here.

net/tipc/server.h+94−0

This diff is large: its 95 lines aren’t shown here.

net/tipc/socket.c+116−30

This diff is large: its 302 lines aren’t shown here.

net/tipc/subscr.c+97−251

This diff is large: its 532 lines aren’t shown here.

net/tipc/subscr.h+10−11

This diff is large: its 58 lines aren’t shown here.

net/tipc/sysctl.c+64−0

This diff is large: its 65 lines aren’t shown here.

net/unix/sysctl_net_unix.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/vmw_vsock/af_vsock.c+24−31

This diff is large: its 100 lines aren’t shown here.

net/vmw_vsock/vmci_transport.c+9−9

This diff is large: its 34 lines aren’t shown here.

net/wireless/chan.c+49−8

This diff is large: its 108 lines aren’t shown here.

net/wireless/core.c+71−199

This diff is large: its 581 lines aren’t shown here.

net/wireless/core.h+35−88

This diff is large: its 242 lines aren’t shown here.

net/wireless/debugfs.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/wireless/ibss.c+2−14

This diff is large: its 91 lines aren’t shown here.

net/wireless/mesh.c+13−2

This diff is large: its 53 lines aren’t shown here.

net/wireless/mlme.c+140−293

This diff is large: its 624 lines aren’t shown here.

net/wireless/nl80211.c+415−399

This diff is large: its 2013 lines aren’t shown here.

net/wireless/reg.c+45−93

This diff is large: its 389 lines aren’t shown here.

net/wireless/scan.c+34−17

This diff is large: its 166 lines aren’t shown here.

net/wireless/sme.c+292−360

This diff is large: its 937 lines aren’t shown here.

net/wireless/sysfs.c+6−2

This diff is large: its 40 lines aren’t shown here.

net/wireless/trace.h+34−12

This diff is large: its 59 lines aren’t shown here.

net/wireless/util.c+28−11

This diff is large: its 101 lines aren’t shown here.

net/wireless/wext-compat.c+4−18

This diff is large: its 68 lines aren’t shown here.

net/wireless/wext-sme.c+15−34

This diff is large: its 141 lines aren’t shown here.

net/x25/af_x25.c+9−8

This diff is large: its 44 lines aren’t shown here.

net/xfrm/xfrm_input.c+5−0

This diff is large: its 12 lines aren’t shown here.

net/xfrm/xfrm_output.c+4−5

This diff is large: its 28 lines aren’t shown here.

net/xfrm/xfrm_policy.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/xfrm/xfrm_proc.c+1−0

This diff is large: its 8 lines aren’t shown here.

security/selinux/netif.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/net/psock_tpacket.c+20−39

This diff is large: its 128 lines aren’t shown here.