History

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

Pull networking updates from David Miller: 1) More iov_iter conversion work from Al Viro. [ The "crypto: switch af_alg_make_sg() to iov_iter" commit was wrong, and this pull actually adds an extra commit on top of the branch I'm pulling to fix that up, so that the pre-merge state is ok. - Linus ] 2) Various optimizations to the ipv4 forwarding information base trie lookup implementation. From Alexander Duyck. 3) Remove sock_iocb altogether, from CHristoph Hellwig. 4) Allow congestion control algorithm selection via routing metrics. From Daniel Borkmann. 5) Make ipv4 uncached route list per-cpu, from Eric Dumazet. 6) Handle rfs hash collisions more gracefully, also from Eric Dumazet. 7) Add xmit_more support to r8169, e1000, and e1000e drivers. From Florian Westphal. 8) Transparent Ethernet Bridging support for GRO, from Jesse Gross. 9) Add BPF packet actions to packet scheduler, from Jiri Pirko. 10) Add support for uniqu flow IDs to openvswitch, from Joe Stringer. 11) New NetCP ethernet driver, from Muralidharan Karicheri and Wingman Kwok. 12) More sanely handle out-of-window dupacks, which can result in serious ACK storms. From Neal Cardwell. 13) Various rhashtable bug fixes and enhancements, from Herbert Xu, Patrick McHardy, and Thomas Graf. 14) Support xmit_more in be2net, from Sathya Perla. 15) Group Policy extensions for vxlan, from Thomas Graf. 16) Remove Checksum Offload support for vxlan, from Tom Herbert. 17) Like ipv4, support lockless transmit over ipv6 UDP sockets. From Vlad Yasevich. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1494+1 commits) crypto: fix af_alg_make_sg() conversion to iov_iter ipv4: Namespecify TCP PMTU mechanism i40e: Fix for stats init function call in Rx setup tcp: don't include Fast Open option in SYN-ACK on pure SYN-data openvswitch: Only set TUNNEL_VXLAN_OPT if VXLAN-GBP metadata is set ipv6: Make __ipv6_select_ident static ipv6: Fix fragment id assignment on LE arches. bridge: Fix inability to add non-vlan fdb entry net: Mellanox: Delete unnecessary checks before the function call "vunmap" cxgb4: Add support in cxgb4 to get expansion rom version via ethtool ethtool: rename reserved1 memeber in ethtool_drvinfo for expansion ROM version net: dsa: Remove redundant phy_attach() IB/mlx4: Reset flow support for IB kernel ULPs IB/mlx4: Always use the correct port for mirrored multicast attachments net/bonding: Fix potential bad memory access during bonding events tipc: remove tipc_snprintf tipc: nl compat add noop and remove legacy nl framework tipc: convert legacy nl stats show to nl compat tipc: convert legacy nl net id get to nl compat tipc: convert legacy nl net id set to nl compat ...

Linus Torvalds committed 11 years ago

Commit c5ce28d2 parents 29afc4e 9399f0c1236 files · +72067 −29395Browse files

Unified · Split

1236 files
  1. Documentation/DocBook/80211.tmpl +2 −3
  2. Documentation/devicetree/bindings/net/amd-xgbe-phy.txt +21 −0
  3. Documentation/devicetree/bindings/net/davicom-dm9000.txt +4 −0
  4. Documentation/devicetree/bindings/net/fsl-fec.txt +2 −0
  5. Documentation/devicetree/bindings/net/fsl-tsec-phy.txt +10 −1
  6. Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt +88 −0
  7. Documentation/devicetree/bindings/net/keystone-netcp.txt +197 −0
  8. Documentation/devicetree/bindings/net/nfc/st21nfca.txt +9 −2
  9. Documentation/devicetree/bindings/net/nfc/st21nfcb.txt +2 −2
  10. Documentation/devicetree/bindings/net/rockchip-dwmac.txt +68 −0
  11. Documentation/devicetree/bindings/net/sti-dwmac.txt +5 −9
  12. Documentation/devicetree/bindings/net/stmmac.txt +1 −0
  13. Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +30 −0
  14. Documentation/devicetree/bindings/phy/phy-miphy365x.txt +8 −7
  15. Documentation/devicetree/bindings/phy/phy-stih407-usb.txt +2 −8
  16. Documentation/kernel-parameters.txt +12 −0
  17. Documentation/networking/filter.txt +2 −2
  18. Documentation/networking/ip-sysctl.txt +29 −0
  19. Documentation/networking/nf_conntrack-sysctl.txt +2 −1
  20. Documentation/networking/openvswitch.txt +13 −0
  21. Documentation/networking/timestamping.txt +21 −0
  22. Documentation/networking/timestamping/txtimestamp.c +26 −12
  23. Documentation/rfkill.txt +3 −0
  24. Documentation/sysctl/net.txt +8 −0
  25. MAINTAINERS +17 −2
  26. arch/arm/boot/dts/am3517.dtsi +1 −0
  27. arch/arm/boot/dts/rk3288-evb-rk808.dts +23 −0
  28. arch/arm/boot/dts/rk3288-evb.dtsi +19 −0
  29. arch/arm/boot/dts/rk3288.dtsi +54 −0
  30. arch/arm/boot/dts/stih407-family.dtsi +9 −0
  31. arch/arm/boot/dts/stih410.dtsi +70 −0
  32. arch/arm/boot/dts/stih415.dtsi +6 −6
  33. arch/arm/boot/dts/stih416.dtsi +11 −11
  34. arch/arm/configs/multi_v7_defconfig +1 −0
  35. arch/arm/mach-sa1100/assabet.c +1 −1
  36. arch/arm/mach-sa1100/collie.c +1 −1
  37. arch/arm/mach-sa1100/h3100.c +1 −1
  38. arch/arm/mach-sa1100/h3600.c +1 −1
  39. arch/microblaze/kernel/timer.c +1 −0
  40. crypto/af_alg.c +11 −29
  41. crypto/algif_hash.c +17 −28
  42. crypto/algif_skcipher.c +32 −41
  43. drivers/acpi/event.c +1 −6
  44. drivers/atm/eni.c +19 −14
  45. drivers/atm/fore200e.c +14 −8
  46. drivers/atm/he.c +64 −61
  47. drivers/atm/he.h +2 −2
  48. drivers/atm/horizon.c +0 −24
  49. drivers/atm/idt77252.c +57 −50
  50. drivers/atm/iphase.c +28 −26
  51. drivers/atm/lanai.c +5 −18
  52. drivers/atm/nicstar.c +30 −30
  53. drivers/atm/solos-pci.c +13 −13
  54. drivers/atm/zatm.c +11 −6
  55. drivers/bcma/bcma_private.h +11 −7
  56. drivers/bcma/driver_chipcommon.c +14 −6
  57. drivers/bcma/driver_pci.c +44 −24
  58. drivers/bcma/host_pci.c +4 −2
  59. drivers/bcma/host_soc.c +1 −1
  60. drivers/bcma/main.c +37 −39
  61. drivers/bcma/scan.c +5 −62
  62. drivers/bcma/sprom.c +2 −1
  63. drivers/bluetooth/ath3k.c +10 −0
  64. drivers/bluetooth/bfusb.c +2 −0
  65. drivers/bluetooth/btmrvl_drv.h +3 −2
  66. drivers/bluetooth/btmrvl_main.c +25 −7
  67. drivers/bluetooth/btmrvl_sdio.c +5 −1
  68. drivers/bluetooth/btusb.c +696 −14
  69. drivers/clk/rockchip/clk-rk3288.c +7 −7
  70. drivers/clocksource/arm_arch_timer.c +1 −0
  71. drivers/infiniband/hw/cxgb4/cm.c +59 −59
  72. drivers/infiniband/hw/cxgb4/cq.c +30 −30
  73. drivers/infiniband/hw/cxgb4/device.c +6 −6
  74. drivers/infiniband/hw/cxgb4/ev.c +6 −6
  75. drivers/infiniband/hw/cxgb4/mem.c +11 −11
  76. drivers/infiniband/hw/cxgb4/qp.c +31 −31
  77. drivers/infiniband/hw/cxgb4/t4.h +63 −63
  78. drivers/infiniband/hw/cxgb4/t4fw_ri_api.h +406 −406
  79. drivers/infiniband/hw/mlx4/ah.c +1 −0
  80. drivers/infiniband/hw/mlx4/alias_GUID.c +1 −1
  81. drivers/infiniband/hw/mlx4/cq.c +57 −0
  82. drivers/infiniband/hw/mlx4/mad.c +2 −1
  83. drivers/infiniband/hw/mlx4/main.c +221 −25
  84. drivers/infiniband/hw/mlx4/mlx4_ib.h +25 −1
  85. drivers/infiniband/hw/mlx4/mr.c +4 −2
  86. drivers/infiniband/hw/mlx4/qp.c +73 −17
  87. drivers/infiniband/hw/mlx4/srq.c +8 −0
  88. drivers/infiniband/hw/mlx4/sysfs.c +3 −3
  89. drivers/infiniband/hw/mlx5/mem.c +1 −1
  90. drivers/infiniband/hw/nes/nes_nic.c +7 −6
  91. drivers/isdn/hardware/mISDN/mISDNipac.c +9 −3
  92. drivers/isdn/hardware/mISDN/w6692.c +3 −3
  93. drivers/isdn/hisax/hfc4s8s_l1.c +0 −21
  94. drivers/isdn/isdnloop/isdnloop.c +30 −34
  95. drivers/isdn/sc/init.c +6 −9
  96. drivers/misc/vmw_vmci/vmci_queue_pair.c +8 −8
  97. drivers/net/arcnet/com20020-pci.c +3 −0
  98. drivers/net/bonding/bond_3ad.c +42 −13
  99. drivers/net/bonding/bond_main.c +88 −33
  100. drivers/net/bonding/bond_options.c +3 −3
  101. drivers/net/can/at91_can.c +0 −2
  102. drivers/net/can/bfin_can.c +1 −0
  103. drivers/net/can/c_can/c_can.c +1 −1
  104. drivers/net/can/cc770/cc770.c +1 −0
  105. drivers/net/can/dev.c +3 −2
  106. drivers/net/can/flexcan.c +0 −2
  107. drivers/net/can/janz-ican3.c +3 −4
  108. drivers/net/can/m_can/m_can.c +1 −0
  109. drivers/net/can/pch_can.c +1 −0
  110. drivers/net/can/rcar_can.c +1 −0
  111. drivers/net/can/softing/softing_main.c +1 −0
  112. drivers/net/can/spi/mcp251x.c +1 −0
  113. drivers/net/can/ti_hecc.c +1 −0
  114. drivers/net/can/usb/Kconfig +18 −4
  115. drivers/net/can/usb/ems_usb.c +1 −0
  116. drivers/net/can/usb/esd_usb2.c +1 −0
  117. drivers/net/can/usb/kvaser_usb.c +541 −182
  118. drivers/net/can/usb/peak_usb/Makefile +1 −1
  119. drivers/net/can/usb/peak_usb/pcan_ucan.h +222 −0
  120. drivers/net/can/usb/peak_usb/pcan_usb.c +3 −1
  121. drivers/net/can/usb/peak_usb/pcan_usb_core.c +65 −18
  122. drivers/net/can/usb/peak_usb/pcan_usb_core.h +19 −7
  123. drivers/net/can/usb/peak_usb/pcan_usb_fd.c +1095 −0
  124. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +7 −13
  125. drivers/net/can/usb/peak_usb/pcan_usb_pro.h +13 −0
  126. drivers/net/can/usb/usb_8dev.c +1 −0
  127. drivers/net/dsa/bcm_sf2.c +64 −24
  128. drivers/net/dsa/bcm_sf2_regs.h +4 −0
  129. drivers/net/dsa/mv88e6131.c +2 −1
  130. drivers/net/dsa/mv88e6352.c +5 −8
  131. drivers/net/dsa/mv88e6xxx.c +9 −0
  132. drivers/net/ethernet/3com/typhoon.c +2 −2
  133. drivers/net/ethernet/alteon/acenic.c +4 −4
  134. drivers/net/ethernet/amd/Kconfig +1 −1
  135. drivers/net/ethernet/amd/amd8111e.c +2 −2
  136. drivers/net/ethernet/amd/pcnet32.c +1 −1
  137. drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +1 −1
  138. drivers/net/ethernet/amd/xgbe/xgbe-desc.c +1 −31
  139. drivers/net/ethernet/amd/xgbe/xgbe-dev.c +56 −10
  140. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +38 −40
  141. drivers/net/ethernet/amd/xgbe/xgbe-main.c +159 −44
  142. drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +8 −21
  143. drivers/net/ethernet/amd/xgbe/xgbe-ptp.c +3 −9
  144. drivers/net/ethernet/amd/xgbe/xgbe.h +21 −10
  145. drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +70 −24
  146. drivers/net/ethernet/apm/xgene/xgene_enet_main.c +83 −26
  147. drivers/net/ethernet/apm/xgene/xgene_enet_main.h +3 −0
  148. drivers/net/ethernet/atheros/atl1c/atl1c_main.c +2 −2
  149. drivers/net/ethernet/atheros/atl1e/atl1e_main.c +4 −5
  150. drivers/net/ethernet/atheros/atlx/atl1.c +2 −2
  151. drivers/net/ethernet/atheros/atlx/atl2.c +6 −8
  152. drivers/net/ethernet/broadcom/bnx2.c +2 −2
  153. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 −5
  154. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +2 −2
  155. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +5 −9
  156. drivers/net/ethernet/broadcom/tg3.c +13 −16
  157. drivers/net/ethernet/brocade/bna/bnad.c +2 −2
  158. drivers/net/ethernet/cadence/macb.c +70 −14
  159. drivers/net/ethernet/cadence/macb.h +388 −243
  160. drivers/net/ethernet/chelsio/cxgb/sge.c +2 −2
  161. drivers/net/ethernet/chelsio/cxgb3/mc5.c +0 −16
  162. drivers/net/ethernet/chelsio/cxgb3/sge.c +3 −3
  163. drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +3 −3
  164. drivers/net/ethernet/chelsio/cxgb4/Makefile +1 −1
  165. drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c +317 −0
  166. drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h +41 −0
  167. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +159 −10
  168. drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +97 −3
  169. drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +11 −0
  170. drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +1916 −1
  171. drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h +33 −0
  172. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +294 −709
  173. drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +0 −3
  174. drivers/net/ethernet/chelsio/cxgb4/l2t.c +7 −6
  175. drivers/net/ethernet/chelsio/cxgb4/sge.c +121 −149
  176. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1067 −476
  177. drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +24 −0
  178. drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +273 −94
  179. drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +1 −0
  180. drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +2358 −1034
  181. drivers/net/ethernet/chelsio/cxgb4/t4_values.h +124 −0
  182. drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +101 −0
  183. drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h +48 −0
  184. drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +20 −24
  185. drivers/net/ethernet/chelsio/cxgb4vf/sge.c +29 −28
  186. drivers/net/ethernet/chelsio/cxgb4vf/t4vf_defs.h +2 −2
  187. drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +22 −21
  188. drivers/net/ethernet/cirrus/ep93xx_eth.c +2 −4
  189. drivers/net/ethernet/cisco/enic/enic.h +15 −1
  190. drivers/net/ethernet/cisco/enic/enic_dev.c +0 −56
  191. drivers/net/ethernet/cisco/enic/enic_dev.h +0 −5
  192. drivers/net/ethernet/cisco/enic/enic_ethtool.c +19 −2
  193. drivers/net/ethernet/cisco/enic/enic_main.c +116 −63
  194. drivers/net/ethernet/cisco/enic/vnic_stats.h +5 −0
  195. drivers/net/ethernet/cisco/enic/vnic_wq.c +3 −0
  196. drivers/net/ethernet/cisco/enic/vnic_wq.h +1 −0
  197. drivers/net/ethernet/davicom/dm9000.c +40 −0
  198. drivers/net/ethernet/dec/tulip/winbond-840.c +1 −1
  199. drivers/net/ethernet/emulex/benet/be.h +23 −180
  200. drivers/net/ethernet/emulex/benet/be_cmds.c +160 −71
  201. drivers/net/ethernet/emulex/benet/be_cmds.h +211 −7
  202. drivers/net/ethernet/emulex/benet/be_ethtool.c +8 −8
  203. drivers/net/ethernet/emulex/benet/be_hw.h +11 −229
  204. drivers/net/ethernet/emulex/benet/be_main.c +610 −341
  205. drivers/net/ethernet/freescale/Kconfig +2 −1
  206. drivers/net/ethernet/freescale/fec.h +3 −0
  207. drivers/net/ethernet/freescale/fec_main.c +119 −26
  208. drivers/net/ethernet/freescale/fec_ptp.c +1 −15
  209. drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +65 −30
  210. drivers/net/ethernet/freescale/fs_enet/fs_enet.h +1 −0
  211. drivers/net/ethernet/freescale/gianfar.c +9 −8
  212. drivers/net/ethernet/freescale/gianfar.h +1 −1
  213. drivers/net/ethernet/freescale/xgmac_mdio.c +73 −57
  214. drivers/net/ethernet/hisilicon/Kconfig +9 −0
  215. drivers/net/ethernet/hisilicon/Makefile +1 −0
  216. drivers/net/ethernet/hisilicon/hip04_eth.c +971 −0
  217. drivers/net/ethernet/hisilicon/hip04_mdio.c +186 −0
  218. drivers/net/ethernet/ibm/ehea/ehea_main.c +2 −2
  219. drivers/net/ethernet/ibm/emac/core.c +1 −1
  220. drivers/net/ethernet/intel/Kconfig +11 −0
  221. drivers/net/ethernet/intel/e1000/e1000_ethtool.c +2 −1
  222. drivers/net/ethernet/intel/e1000/e1000_main.c +12 −8
  223. drivers/net/ethernet/intel/e1000e/e1000.h +1 −1
  224. drivers/net/ethernet/intel/e1000e/netdev.c +24 −17
  225. drivers/net/ethernet/intel/e1000e/ptp.c +1 −4
  226. drivers/net/ethernet/intel/fm10k/fm10k_main.c +25 −19
  227. drivers/net/ethernet/intel/fm10k/fm10k_mbx.c +2 −3
  228. drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +7 −8
  229. drivers/net/ethernet/intel/fm10k/fm10k_pf.c +2 −5
  230. drivers/net/ethernet/intel/fm10k/fm10k_ptp.c +0 −3
  231. drivers/net/ethernet/intel/fm10k/fm10k_type.h +1 −1
  232. drivers/net/ethernet/intel/i40e/i40e.h +6 −4
  233. drivers/net/ethernet/intel/i40e/i40e_adminq.h +1 −1
  234. drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +138 −14
  235. drivers/net/ethernet/intel/i40e/i40e_common.c +134 −2
  236. drivers/net/ethernet/intel/i40e/i40e_debugfs.c +0 −1
  237. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +42 −1
  238. drivers/net/ethernet/intel/i40e/i40e_fcoe.c +7 −11
  239. drivers/net/ethernet/intel/i40e/i40e_main.c +108 −41
  240. drivers/net/ethernet/intel/i40e/i40e_prototype.h +5 −0
  241. drivers/net/ethernet/intel/i40e/i40e_ptp.c +31 −13
  242. drivers/net/ethernet/intel/i40e/i40e_txrx.c +9 −4
  243. drivers/net/ethernet/intel/i40e/i40e_type.h +9 −1
  244. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +21 −13
  245. drivers/net/ethernet/intel/i40evf/i40e_adminq.h +1 −1
  246. drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +94 −14
  247. drivers/net/ethernet/intel/i40evf/i40e_txrx.c +40 −4
  248. drivers/net/ethernet/intel/i40evf/i40e_txrx.h +1 −0
  249. drivers/net/ethernet/intel/i40evf/i40e_type.h +7 −1
  250. drivers/net/ethernet/intel/i40evf/i40evf_main.c +58 −54
  251. drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +3 −3
  252. drivers/net/ethernet/intel/igb/igb.h +10 −1
  253. drivers/net/ethernet/intel/igb/igb_main.c +104 −53
  254. drivers/net/ethernet/intel/igb/igb_ptp.c +253 −14
  255. drivers/net/ethernet/intel/igbvf/netdev.c +3 −2
  256. drivers/net/ethernet/intel/ixgb/ixgb_main.c +2 −2
  257. drivers/net/ethernet/intel/ixgbe/ixgbe.h +4 −1
  258. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +113 −5
  259. drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +2 −11
  260. drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +8 −8
  261. drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +12 −0
  262. drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +0 −3
  263. drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +59 −31
  264. drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +28 −8
  265. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +341 −158
  266. drivers/net/ethernet/intel/ixgbevf/regs.h +10 −0
  267. drivers/net/ethernet/jme.c +2 −2
  268. drivers/net/ethernet/marvell/sky2.c +3 −3
  269. drivers/net/ethernet/mellanox/mlx4/alloc.c +10 −7
  270. drivers/net/ethernet/mellanox/mlx4/catas.c +225 −69
  271. drivers/net/ethernet/mellanox/mlx4/cmd.c +328 −94
  272. drivers/net/ethernet/mellanox/mlx4/en_clock.c +4 −6
  273. drivers/net/ethernet/mellanox/mlx4/en_cq.c +2 −2
  274. drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +9 −11
  275. drivers/net/ethernet/mellanox/mlx4/en_main.c +10 −2
  276. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +181 −1
  277. drivers/net/ethernet/mellanox/mlx4/en_resources.c +6 −2
  278. drivers/net/ethernet/mellanox/mlx4/en_rx.c +9 −4
  279. drivers/net/ethernet/mellanox/mlx4/en_tx.c +8 −8
  280. drivers/net/ethernet/mellanox/mlx4/eq.c +58 −42
  281. drivers/net/ethernet/mellanox/mlx4/fw.c +121 −23
  282. drivers/net/ethernet/mellanox/mlx4/fw.h +1 −0
  283. drivers/net/ethernet/mellanox/mlx4/icm.c +6 −5
  284. drivers/net/ethernet/mellanox/mlx4/intf.c +58 −4
  285. drivers/net/ethernet/mellanox/mlx4/main.c +408 −81
  286. drivers/net/ethernet/mellanox/mlx4/mcg.c +6 −0
  287. drivers/net/ethernet/mellanox/mlx4/mlx4.h +22 −9
  288. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +5 −0
  289. drivers/net/ethernet/mellanox/mlx4/mr.c +11 −14
  290. drivers/net/ethernet/mellanox/mlx4/pd.c +4 −3
  291. drivers/net/ethernet/mellanox/mlx4/port.c +9 −8
  292. drivers/net/ethernet/mellanox/mlx4/qp.c +2 −0
  293. drivers/net/ethernet/mellanox/mlx4/reset.c +14 −9
  294. drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +31 −26
  295. drivers/net/ethernet/mellanox/mlx5/core/alloc.c +1 −1
  296. drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +3 −3
  297. drivers/net/ethernet/mellanox/mlx5/core/main.c +6 −6
  298. drivers/net/ethernet/micrel/ksz884x.c +1 −3
  299. drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 −2
  300. drivers/net/ethernet/natsemi/ns83820.c +2 −2
  301. drivers/net/ethernet/neterion/s2io.c +2 −2
  302. drivers/net/ethernet/neterion/vxge/vxge-config.c +1 −1
  303. drivers/net/ethernet/neterion/vxge/vxge-main.c +2 −2
  304. drivers/net/ethernet/nvidia/forcedeth.c +2 −2
  305. drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +3 −5
  306. drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +13 −12
  307. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +8 −16
  308. drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +1 −2
  309. drivers/net/ethernet/qlogic/qlge/qlge_main.c +3 −3
  310. drivers/net/ethernet/realtek/8139cp.c +2 −2
  311. drivers/net/ethernet/realtek/r8169.c +11 −5
  312. drivers/net/ethernet/renesas/sh_eth.c +39 −9
  313. drivers/net/ethernet/renesas/sh_eth.h +14 −16
  314. drivers/net/ethernet/rocker/rocker.c +169 −8
  315. drivers/net/ethernet/rocker/rocker.h +21 −0
  316. drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +48 −21
  317. drivers/net/ethernet/smsc/Kconfig +6 −4
  318. drivers/net/ethernet/smsc/smc91x.h +21 −0
  319. drivers/net/ethernet/stmicro/stmmac/Makefile +1 −1
  320. drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +437 −0
  321. drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +7 −6
  322. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +22 −4
  323. drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +112 −1
  324. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +4 −0
  325. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +1 −0
  326. drivers/net/ethernet/sun/niu.c +1 −2
  327. drivers/net/ethernet/sun/sunvnet.c +51 −39
  328. drivers/net/ethernet/tehuti/tehuti.c +2 −2
  329. drivers/net/ethernet/ti/Kconfig +25 −0
  330. drivers/net/ethernet/ti/Makefile +10 −1
  331. drivers/net/ethernet/ti/cpsw-common.c +55 −0
  332. drivers/net/ethernet/ti/cpsw.c +53 −58
  333. drivers/net/ethernet/ti/cpsw.h +2 −0
  334. drivers/net/ethernet/ti/cpsw_ale.c +24 −2
  335. drivers/net/ethernet/ti/cpts.c +1 −4
  336. drivers/net/ethernet/ti/cpts.h +1 −0
  337. drivers/net/ethernet/ti/davinci_emac.c +55 −1
  338. drivers/net/ethernet/ti/netcp.h +229 −0
  339. drivers/net/ethernet/ti/netcp_core.c +2149 −0
  340. drivers/net/ethernet/ti/netcp_ethss.c +2159 −0
  341. drivers/net/ethernet/ti/netcp_sgmii.c +131 −0
  342. drivers/net/ethernet/ti/netcp_xgbepcsr.c +501 −0
  343. drivers/net/ethernet/ti/tlan.c +7 −7
  344. drivers/net/ethernet/via/via-rhine.c +5 −4
  345. drivers/net/ethernet/via/via-velocity.c +2 −2
  346. drivers/net/fddi/skfp/smt.c +0 −12
  347. drivers/net/hyperv/netvsc.c +6 −5
  348. drivers/net/hyperv/rndis_filter.c +15 −9
  349. drivers/net/ieee802154/at86rf230.c +49 −33
  350. drivers/net/ieee802154/cc2520.c +11 −26
  351. drivers/net/ieee802154/mrf24j40.c +3 −3
  352. drivers/net/ipvlan/ipvlan_core.c +1 −1
  353. drivers/net/irda/ali-ircc.c +3 −8
  354. drivers/net/irda/ali-ircc.h +2 −3
  355. drivers/net/irda/au1k_ir.c +0 −3
  356. drivers/net/irda/irda-usb.c +2 −8
  357. drivers/net/irda/irda-usb.h +2 −3
  358. drivers/net/irda/kingsun-sir.c +0 −3
  359. drivers/net/irda/ks959-sir.c +0 −3
  360. drivers/net/irda/mcs7780.c +0 −2
  361. drivers/net/irda/mcs7780.h +0 −1
  362. drivers/net/irda/nsc-ircc.c +2 −5
  363. drivers/net/irda/nsc-ircc.h +2 −3
  364. drivers/net/irda/sa1100_ir.c +1 −1
  365. drivers/net/irda/stir4200.c +7 −9
  366. drivers/net/irda/via-ircc.h +0 −4
  367. drivers/net/irda/vlsi_ir.c +13 −33
  368. drivers/net/irda/vlsi_ir.h +1 −1
  369. drivers/net/macvlan.c +6 −0
  370. drivers/net/macvtap.c +3 −3
  371. drivers/net/mii.c +7 −5
  372. drivers/net/phy/Kconfig +1 −1
  373. drivers/net/phy/amd-xgbe-phy.c +634 −347
  374. drivers/net/phy/fixed_phy.c +1 −1
  375. drivers/net/phy/mdio_bus.c +8 −6
  376. drivers/net/phy/phy.c +3 −0
  377. drivers/net/phy/phy_device.c +18 −4
  378. drivers/net/team/team.c +4 −8
  379. drivers/net/tun.c +20 −17
  380. drivers/net/usb/hso.c +49 −57
  381. drivers/net/usb/r8152.c +139 −90
  382. drivers/net/usb/usbnet.c +8 −9
  383. drivers/net/veth.c +9 −0
  384. drivers/net/virtio_net.c +6 −0
  385. drivers/net/vmxnet3/vmxnet3_defs.h +2 −1
  386. drivers/net/vmxnet3/vmxnet3_drv.c +32 −22
  387. drivers/net/vmxnet3/vmxnet3_ethtool.c +21 −8
  388. drivers/net/vmxnet3/vmxnet3_int.h +4 −2
  389. drivers/net/vxlan.c +331 −109
  390. drivers/net/wireless/adm8211.c +1 −0
  391. drivers/net/wireless/ath/ath.h +1 −0
  392. drivers/net/wireless/ath/ath10k/Makefile +5 −1
  393. drivers/net/wireless/ath/ath10k/ce.c +8 −6
  394. drivers/net/wireless/ath/ath10k/ce.h +1 −1
  395. drivers/net/wireless/ath/ath10k/core.c +250 −72
  396. drivers/net/wireless/ath/ath10k/core.h +50 −11
  397. drivers/net/wireless/ath/ath10k/debug.c +107 −15
  398. drivers/net/wireless/ath/ath10k/debug.h +10 −1
  399. drivers/net/wireless/ath/ath10k/debugfs_sta.c +243 −0
  400. drivers/net/wireless/ath/ath10k/htc.c +2 −4
  401. drivers/net/wireless/ath/ath10k/htt.c +1 −2
  402. drivers/net/wireless/ath/ath10k/htt.h +82 −5
  403. drivers/net/wireless/ath/ath10k/htt_rx.c +366 −36
  404. drivers/net/wireless/ath/ath10k/htt_tx.c +38 −61
  405. drivers/net/wireless/ath/ath10k/hw.c +58 −0
  406. drivers/net/wireless/ath/ath10k/hw.h +119 −17
  407. drivers/net/wireless/ath/ath10k/mac.c +508 −158
  408. drivers/net/wireless/ath/ath10k/pci.c +152 −18
  409. drivers/net/wireless/ath/ath10k/pci.h +6 −1
  410. drivers/net/wireless/ath/ath10k/rx_desc.h +24 −1
  411. drivers/net/wireless/ath/ath10k/spectral.c +1 −0
  412. drivers/net/wireless/ath/ath10k/targaddrs.h +5 −0
  413. drivers/net/wireless/ath/ath10k/testmode.c +4 −1
  414. drivers/net/wireless/ath/ath10k/thermal.c +244 −0
  415. drivers/net/wireless/ath/ath10k/thermal.h +58 −0
  416. drivers/net/wireless/ath/ath10k/trace.h +68 −0
  417. drivers/net/wireless/ath/ath10k/txrx.c +7 −2
  418. drivers/net/wireless/ath/ath10k/wmi-ops.h +1064 −0
  419. drivers/net/wireless/ath/ath10k/wmi-tlv.c +2696 −0
  420. drivers/net/wireless/ath/ath10k/wmi-tlv.h +1444 −0
  421. drivers/net/wireless/ath/ath10k/wmi.c +1671 −647
  422. drivers/net/wireless/ath/ath10k/wmi.h +361 −88
  423. drivers/net/wireless/ath/ath5k/ahb.c +0 −1
  424. drivers/net/wireless/ath/ath5k/mac80211-ops.c +8 −8
  425. drivers/net/wireless/ath/ath5k/pcu.c +1 −0
  426. drivers/net/wireless/ath/ath5k/reset.c +1 −1
  427. drivers/net/wireless/ath/ath6kl/cfg80211.c +9 −8
  428. drivers/net/wireless/ath/ath6kl/main.c +0 −1
  429. drivers/net/wireless/ath/ath9k/ahb.c +4 −0
  430. drivers/net/wireless/ath/ath9k/ani.c +2 −1
  431. drivers/net/wireless/ath/ath9k/ar5008_phy.c +80 −0
  432. drivers/net/wireless/ath/ath9k/ar9003_calib.c +48 −13
  433. drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +10 −5
  434. drivers/net/wireless/ath/ath9k/ar9003_hw.c +60 −1
  435. drivers/net/wireless/ath/ath9k/ar9003_phy.c +37 −10
  436. drivers/net/wireless/ath/ath9k/ar9003_phy.h +11 −8
  437. drivers/net/wireless/ath/ath9k/ar9003_wow.c +155 −160
  438. drivers/net/wireless/ath/ath9k/ar953x_initvals.h +2 −2
  439. drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h +2 −2
  440. drivers/net/wireless/ath/ath9k/ar956x_initvals.h +1046 −0
  441. drivers/net/wireless/ath/ath9k/ath9k.h +6 −9
  442. drivers/net/wireless/ath/ath9k/common-spectral.c +1 −1
  443. drivers/net/wireless/ath/ath9k/debug.c +163 −100
  444. drivers/net/wireless/ath/ath9k/eeprom_4k.c +14 −0
  445. drivers/net/wireless/ath/ath9k/eeprom_9287.c +15 −0
  446. drivers/net/wireless/ath/ath9k/eeprom_def.c +14 −0
  447. drivers/net/wireless/ath/ath9k/gpio.c +1 −1
  448. drivers/net/wireless/ath/ath9k/htc.h +3 −0
  449. drivers/net/wireless/ath/ath9k/htc_drv_gpio.c +4 −0
  450. drivers/net/wireless/ath/ath9k/htc_drv_init.c +4 −0
  451. drivers/net/wireless/ath/ath9k/htc_hst.c +1 −5
  452. drivers/net/wireless/ath/ath9k/hw.c +36 −17
  453. drivers/net/wireless/ath/ath9k/hw.h +22 −18
  454. drivers/net/wireless/ath/ath9k/init.c +3 −2
  455. drivers/net/wireless/ath/ath9k/link.c +8 −8
  456. drivers/net/wireless/ath/ath9k/mac.c +2 −1
  457. drivers/net/wireless/ath/ath9k/main.c +0 −9
  458. drivers/net/wireless/ath/ath9k/pci.c +89 −1
  459. drivers/net/wireless/ath/ath9k/recv.c +2 −1
  460. drivers/net/wireless/ath/ath9k/reg.h +9 −120
  461. drivers/net/wireless/ath/ath9k/reg_wow.h +128 −0
  462. drivers/net/wireless/ath/ath9k/wow.c +107 −121
  463. drivers/net/wireless/ath/ath9k/xmit.c +66 −17
  464. drivers/net/wireless/ath/carl9170/cmd.c +6 −6
  465. drivers/net/wireless/ath/carl9170/main.c +3 −3
  466. drivers/net/wireless/ath/dfs_pattern_detector.c +1 −1
  467. drivers/net/wireless/ath/wcn36xx/dxe.c +3 −0
  468. drivers/net/wireless/ath/wcn36xx/main.c +15 −1
  469. drivers/net/wireless/ath/wcn36xx/smd.c +71 −2
  470. drivers/net/wireless/ath/wcn36xx/txrx.c +65 −18
  471. drivers/net/wireless/ath/wcn36xx/txrx.h +8 −1
  472. drivers/net/wireless/ath/wcn36xx/wcn36xx.h +20 −0
  473. drivers/net/wireless/ath/wil6210/Kconfig +0 −9
  474. drivers/net/wireless/ath/wil6210/Makefile +0 −1
  475. drivers/net/wireless/ath/wil6210/cfg80211.c +144 −35
  476. drivers/net/wireless/ath/wil6210/debugfs.c +148 −16
  477. drivers/net/wireless/ath/wil6210/ethtool.c +34 −12
  478. drivers/net/wireless/ath/wil6210/interrupt.c +93 −16
  479. drivers/net/wireless/ath/wil6210/main.c +101 −104
  480. drivers/net/wireless/ath/wil6210/netdev.c +9 −6
  481. drivers/net/wireless/ath/wil6210/pcie_bus.c +45 −20
  482. drivers/net/wireless/ath/wil6210/rx_reorder.c +266 −11
  483. drivers/net/wireless/ath/wil6210/txrx.c +109 −42
  484. drivers/net/wireless/ath/wil6210/txrx.h +104 −54
  485. drivers/net/wireless/ath/wil6210/wil6210.h +163 −20
  486. drivers/net/wireless/ath/wil6210/wil_platform.c +1 −11
  487. drivers/net/wireless/ath/wil6210/wil_platform_msm.c +0 −257
  488. drivers/net/wireless/ath/wil6210/wmi.c +189 −50
  489. drivers/net/wireless/ath/wil6210/wmi.h +62 −8
  490. drivers/net/wireless/atmel.c +1 −11
  491. drivers/net/wireless/b43/Kconfig +9 −0
  492. drivers/net/wireless/b43/Makefile +1 −0
  493. drivers/net/wireless/b43/b43.h +3 −0
  494. drivers/net/wireless/b43/main.c +60 −11
  495. drivers/net/wireless/b43/phy_ac.c +92 −0
  496. drivers/net/wireless/b43/phy_ac.h +38 −0
  497. drivers/net/wireless/b43/phy_common.c +8 −1
  498. drivers/net/wireless/b43/phy_common.h +2 −0
  499. drivers/net/wireless/b43legacy/radio.c +0 −19
  500. drivers/net/wireless/b43legacy/radio.h +0 −1
  501. drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +37 −53
  502. drivers/net/wireless/brcm80211/brcmfmac/bus.h +4 −20
  503. drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +182 −45
  504. drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h +5 −0
  505. drivers/net/wireless/brcm80211/brcmfmac/chip.c +1 −14
  506. drivers/net/wireless/brcm80211/brcmfmac/common.c +32 −2
  507. drivers/net/wireless/brcm80211/brcmfmac/common.h +10 −14
  508. drivers/net/wireless/brcm80211/brcmfmac/commonring.h +2 −0
  509. drivers/net/wireless/brcm80211/brcmfmac/core.c +36 −6
  510. drivers/net/wireless/brcm80211/brcmfmac/core.h +31 −3
  511. drivers/net/wireless/brcm80211/brcmfmac/firmware.c +5 −1
  512. drivers/net/wireless/brcm80211/brcmfmac/flowring.c +2 −4
  513. drivers/net/wireless/brcm80211/brcmfmac/fwil.c +1 −1
  514. drivers/net/wireless/brcm80211/brcmfmac/fwil.h +5 −0
  515. drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +55 −0
  516. drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c +36 −18
  517. drivers/net/wireless/brcm80211/brcmfmac/pcie.c +6 −6
  518. drivers/net/wireless/brcm80211/brcmfmac/sdio.c +83 −95
  519. drivers/net/wireless/brcm80211/brcmfmac/sdio.h +10 −2
  520. drivers/net/wireless/brcm80211/brcmfmac/usb.c +4 −2
  521. drivers/net/wireless/brcm80211/brcmsmac/debug.c +1 −1
  522. drivers/net/wireless/brcm80211/brcmutil/utils.c +30 −2
  523. drivers/net/wireless/brcm80211/include/brcm_hw_ids.h +1 −11
  524. drivers/net/wireless/brcm80211/include/brcmu_utils.h +4 −0
  525. drivers/net/wireless/cw1200/fwio.c +24 −16
  526. drivers/net/wireless/cw1200/main.c +2 −4
  527. drivers/net/wireless/cw1200/pm.c +2 −3
  528. drivers/net/wireless/cw1200/queue.c +1 −3
  529. drivers/net/wireless/cw1200/scan.c +4 −4
  530. drivers/net/wireless/cw1200/sta.c +3 −1
  531. drivers/net/wireless/hostap/hostap_ap.c +1 −1
  532. drivers/net/wireless/iwlegacy/3945-mac.c +1 −3
  533. drivers/net/wireless/iwlegacy/4965-mac.c +3 −6
  534. drivers/net/wireless/iwlwifi/dvm/main.c +6 −25
  535. drivers/net/wireless/iwlwifi/dvm/tt.c +4 −9
  536. drivers/net/wireless/iwlwifi/dvm/tx.c +1 −1
  537. drivers/net/wireless/iwlwifi/dvm/ucode.c +1 −1
  538. drivers/net/wireless/iwlwifi/iwl-7000.c +22 −1
  539. drivers/net/wireless/iwlwifi/iwl-8000.c +29 −2
  540. drivers/net/wireless/iwlwifi/iwl-config.h +15 −2
  541. drivers/net/wireless/iwlwifi/iwl-csr.h +2 −0
  542. drivers/net/wireless/iwlwifi/iwl-drv.c +13 −75
  543. drivers/net/wireless/iwlwifi/iwl-drv.h +0 −1
  544. drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h +41 −2
  545. drivers/net/wireless/iwlwifi/iwl-fw-file.h +12 −6
  546. drivers/net/wireless/iwlwifi/iwl-fw.h +4 −0
  547. drivers/net/wireless/iwlwifi/iwl-io.c +7 −3
  548. drivers/net/wireless/iwlwifi/iwl-modparams.h +2 −2
  549. drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +6 −0
  550. drivers/net/wireless/iwlwifi/iwl-prph.h +27 −25
  551. drivers/net/wireless/iwlwifi/iwl-scd.h +33 −8
  552. drivers/net/wireless/iwlwifi/iwl-trans.h +37 −13
  553. drivers/net/wireless/iwlwifi/mvm/coex.c +10 −10
  554. drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +10 −10
  555. drivers/net/wireless/iwlwifi/mvm/constants.h +32 −3
  556. drivers/net/wireless/iwlwifi/mvm/d3.c +47 −4
  557. drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +32 −1
  558. drivers/net/wireless/iwlwifi/mvm/debugfs.c +161 −86
  559. drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +19 −1
  560. drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h +38 −2
  561. drivers/net/wireless/iwlwifi/mvm/fw-api-stats.h +277 −0
  562. drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h +39 −0
  563. drivers/net/wireless/iwlwifi/mvm/fw-api.h +36 −265
  564. drivers/net/wireless/iwlwifi/mvm/fw.c +103 −14
  565. drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +15 −9
  566. drivers/net/wireless/iwlwifi/mvm/mac80211.c +294 −68
  567. drivers/net/wireless/iwlwifi/mvm/mvm.h +76 −12
  568. drivers/net/wireless/iwlwifi/mvm/nvm.c +3 −1
  569. drivers/net/wireless/iwlwifi/mvm/ops.c +54 −29
  570. drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +2 −2
  571. drivers/net/wireless/iwlwifi/mvm/rs.c +388 −163
  572. drivers/net/wireless/iwlwifi/mvm/rs.h +13 −40
  573. drivers/net/wireless/iwlwifi/mvm/rx.c +7 −3
  574. drivers/net/wireless/iwlwifi/mvm/scan.c +52 −16
  575. drivers/net/wireless/iwlwifi/mvm/sta.c +27 −17
  576. drivers/net/wireless/iwlwifi/mvm/tdls.c +47 −16
  577. drivers/net/wireless/iwlwifi/mvm/tt.c +6 −1
  578. drivers/net/wireless/iwlwifi/mvm/tx.c +9 −3
  579. drivers/net/wireless/iwlwifi/mvm/utils.c +40 −39
  580. drivers/net/wireless/iwlwifi/pcie/drv.c +2 −0
  581. drivers/net/wireless/iwlwifi/pcie/internal.h +13 −5
  582. drivers/net/wireless/iwlwifi/pcie/trans.c +69 −9
  583. drivers/net/wireless/iwlwifi/pcie/tx.c +68 −32
  584. drivers/net/wireless/libertas/cfg.c +6 −6
  585. drivers/net/wireless/mac80211_hwsim.c +17 −16
  586. drivers/net/wireless/mwifiex/11h.c +196 −2
  587. drivers/net/wireless/mwifiex/11n.c +3 −3
  588. drivers/net/wireless/mwifiex/11n.h +11 −3
  589. drivers/net/wireless/mwifiex/11n_aggr.c +12 −3
  590. drivers/net/wireless/mwifiex/11n_rxreorder.c +7 −9
  591. drivers/net/wireless/mwifiex/Makefile +2 −0
  592. drivers/net/wireless/mwifiex/cfg80211.c +699 −252
  593. drivers/net/wireless/mwifiex/cfp.c +20 −2
  594. drivers/net/wireless/mwifiex/cmdevt.c +15 −31
  595. drivers/net/wireless/mwifiex/debugfs.c +108 −173
  596. drivers/net/wireless/mwifiex/decl.h +52 −3
  597. drivers/net/wireless/mwifiex/ethtool.c +15 −1
  598. drivers/net/wireless/mwifiex/fw.h +61 −0
  599. drivers/net/wireless/mwifiex/ie.c +55 −34
  600. drivers/net/wireless/mwifiex/init.c +33 −2
  601. drivers/net/wireless/mwifiex/ioctl.h +10 −1
  602. drivers/net/wireless/mwifiex/main.c +132 −15
  603. drivers/net/wireless/mwifiex/main.h +77 −7
  604. drivers/net/wireless/mwifiex/pcie.c +5 −2
  605. drivers/net/wireless/mwifiex/pcie.h +3 −0
  606. drivers/net/wireless/mwifiex/scan.c +11 −5
  607. drivers/net/wireless/mwifiex/sdio.c +107 −4
  608. drivers/net/wireless/mwifiex/sdio.h +49 −0
  609. drivers/net/wireless/mwifiex/sta_cmd.c +18 −6
  610. drivers/net/wireless/mwifiex/sta_cmdresp.c +7 −0
  611. drivers/net/wireless/mwifiex/sta_event.c +17 −1
  612. drivers/net/wireless/mwifiex/sta_ioctl.c +6 −32
  613. drivers/net/wireless/mwifiex/sta_rx.c +9 −0
  614. drivers/net/wireless/mwifiex/sta_tx.c +17 −11
  615. drivers/net/wireless/mwifiex/tdls.c +32 −3
  616. drivers/net/wireless/mwifiex/txrx.c +1 −1
  617. drivers/net/wireless/mwifiex/uap_cmd.c +70 −0
  618. drivers/net/wireless/mwifiex/uap_event.c +49 −1
  619. drivers/net/wireless/mwifiex/uap_txrx.c +15 −13
  620. drivers/net/wireless/mwifiex/usb.c +26 −1
  621. drivers/net/wireless/mwifiex/usb.h +4 −7
  622. drivers/net/wireless/mwifiex/util.c +221 −1
  623. drivers/net/wireless/mwifiex/util.h +20 −0
  624. drivers/net/wireless/mwifiex/wmm.c +3 −0
  625. drivers/net/wireless/mwl8k.c +6 −6
  626. drivers/net/wireless/orinoco/Kconfig +2 −1
  627. drivers/net/wireless/orinoco/main.c +1 −1
  628. drivers/net/wireless/orinoco/orinoco_pci.c +1 −1
  629. drivers/net/wireless/orinoco/orinoco_plx.c +1 −1
  630. drivers/net/wireless/orinoco/orinoco_tmd.c +1 −1
  631. drivers/net/wireless/orinoco/orinoco_usb.c +1 −3
  632. drivers/net/wireless/p54/eeprom.c +3 −3
  633. drivers/net/wireless/p54/fwio.c +6 −3
  634. drivers/net/wireless/p54/main.c +6 −4
  635. drivers/net/wireless/p54/p54pci.c +5 −2
  636. drivers/net/wireless/p54/txrx.c +6 −6
  637. drivers/net/wireless/rndis_wlan.c +2 −2
  638. drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +1 −3
  639. drivers/net/wireless/rt2x00/rt2800lib.c +6 −6
  640. drivers/net/wireless/rt2x00/rt2x00config.c +2 −2
  641. drivers/net/wireless/rt2x00/rt2x00dev.c +9 −9
  642. drivers/net/wireless/rt2x00/rt2x00firmware.c +1 −1
  643. drivers/net/wireless/rt2x00/rt2x00mac.c +1 −1
  644. drivers/net/wireless/rt2x00/rt2x00queue.c +9 −9
  645. drivers/net/wireless/rt2x00/rt2x00usb.c +4 −4
  646. drivers/net/wireless/rtlwifi/base.c +114 −42
  647. drivers/net/wireless/rtlwifi/base.h +2 −2
  648. drivers/net/wireless/rtlwifi/core.c +70 −2
  649. drivers/net/wireless/rtlwifi/core.h +42 −0
  650. drivers/net/wireless/rtlwifi/pci.c +23 −8
  651. drivers/net/wireless/rtlwifi/pci.h +7 −0
  652. drivers/net/wireless/rtlwifi/rtl8188ee/dm.c +3 −33
  653. drivers/net/wireless/rtlwifi/rtl8188ee/dm.h +0 −41
  654. drivers/net/wireless/rtlwifi/rtl8188ee/trx.c +2 −160
  655. drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +8 −37
  656. drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h +0 −38
  657. drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h +1 −0
  658. drivers/net/wireless/rtlwifi/rtl8192ce/dm.c +1 −0
  659. drivers/net/wireless/rtlwifi/rtl8192ce/dm.h +0 −13
  660. drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +81 −84
  661. drivers/net/wireless/rtlwifi/rtl8192ce/phy.c +3 −2
  662. drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +15 −15
  663. drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +6 −7
  664. drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +4 −0
  665. drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +2 −2
  666. drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +14 −14
  667. drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +9 −11
  668. drivers/net/wireless/rtlwifi/rtl8192de/dm.c +4 −29
  669. drivers/net/wireless/rtlwifi/rtl8192de/dm.h +0 −38
  670. drivers/net/wireless/rtlwifi/rtl8192de/fw.c +0 −17
  671. drivers/net/wireless/rtlwifi/rtl8192de/fw.h +0 −1
  672. drivers/net/wireless/rtlwifi/rtl8192de/hw.c +1 −1
  673. drivers/net/wireless/rtlwifi/rtl8192de/sw.c +15 −15
  674. drivers/net/wireless/rtlwifi/rtl8192de/trx.c +13 −14
  675. drivers/net/wireless/rtlwifi/rtl8192ee/dm.c +14 −41
  676. drivers/net/wireless/rtlwifi/rtl8192ee/dm.h +0 −16
  677. drivers/net/wireless/rtlwifi/rtl8192ee/fw.c +1 −5
  678. drivers/net/wireless/rtlwifi/rtl8192ee/hw.c +140 −26
  679. drivers/net/wireless/rtlwifi/rtl8192ee/reg.h +2 −0
  680. drivers/net/wireless/rtlwifi/rtl8192ee/sw.c +1 −2
  681. drivers/net/wireless/rtlwifi/rtl8192ee/trx.c +18 −182
  682. drivers/net/wireless/rtlwifi/rtl8192ee/trx.h +7 −5
  683. drivers/net/wireless/rtlwifi/rtl8192se/def.h +4 −4
  684. drivers/net/wireless/rtlwifi/rtl8192se/dm.c +4 −3
  685. drivers/net/wireless/rtlwifi/rtl8192se/dm.h +0 −28
  686. drivers/net/wireless/rtlwifi/rtl8192se/sw.c +15 −15
  687. drivers/net/wireless/rtlwifi/rtl8192se/trx.c +11 −12
  688. drivers/net/wireless/rtlwifi/rtl8723ae/dm.c +9 −33
  689. drivers/net/wireless/rtlwifi/rtl8723ae/dm.h +0 −38
  690. drivers/net/wireless/rtlwifi/rtl8723ae/trx.c +2 −160
  691. drivers/net/wireless/rtlwifi/rtl8723be/dm.c +14 −41
  692. drivers/net/wireless/rtlwifi/rtl8723be/dm.h +0 −33
  693. drivers/net/wireless/rtlwifi/rtl8723be/phy.c +0 −25
  694. drivers/net/wireless/rtlwifi/rtl8723be/phy.h +0 −2
  695. drivers/net/wireless/rtlwifi/rtl8723be/sw.c +6 −4
  696. drivers/net/wireless/rtlwifi/rtl8723be/trx.c +2 −160
  697. drivers/net/wireless/rtlwifi/rtl8821ae/def.h +0 −54
  698. drivers/net/wireless/rtlwifi/rtl8821ae/dm.c +16 −42
  699. drivers/net/wireless/rtlwifi/rtl8821ae/dm.h +0 −41
  700. drivers/net/wireless/rtlwifi/rtl8821ae/pwrseq.h +2 −2
  701. drivers/net/wireless/rtlwifi/rtl8821ae/sw.c +24 −50
  702. drivers/net/wireless/rtlwifi/rtl8821ae/trx.c +3 −229
  703. drivers/net/wireless/rtlwifi/wifi.h +59 −40
  704. drivers/net/wireless/ti/wl1251/main.c +2 −3
  705. drivers/net/wireless/ti/wl12xx/main.c +4 −0
  706. drivers/net/wireless/ti/wl18xx/acx.c +88 −0
  707. drivers/net/wireless/ti/wl18xx/acx.h +45 −1
  708. drivers/net/wireless/ti/wl18xx/cmd.c +90 −3
  709. drivers/net/wireless/ti/wl18xx/cmd.h +27 −0
  710. drivers/net/wireless/ti/wl18xx/conf.h +22 −1
  711. drivers/net/wireless/ti/wl18xx/debugfs.c +43 −0
  712. drivers/net/wireless/ti/wl18xx/event.c +21 −0
  713. drivers/net/wireless/ti/wl18xx/event.h +13 −1
  714. drivers/net/wireless/ti/wl18xx/main.c +22 −15
  715. drivers/net/wireless/ti/wl18xx/wl18xx.h +2 −2
  716. drivers/net/wireless/ti/wlcore/acx.c +1 −1
  717. drivers/net/wireless/ti/wlcore/cmd.c +12 −8
  718. drivers/net/wireless/ti/wlcore/cmd.h +8 −0
  719. drivers/net/wireless/ti/wlcore/conf.h +6 −1
  720. drivers/net/wireless/ti/wlcore/debugfs.c +1 −8
  721. drivers/net/wireless/ti/wlcore/event.c +8 −3
  722. drivers/net/wireless/ti/wlcore/hw_ops.h +45 −3
  723. drivers/net/wireless/ti/wlcore/init.c +6 −2
  724. drivers/net/wireless/ti/wlcore/main.c +349 −56
  725. drivers/net/wireless/ti/wlcore/ps.c +2 −6
  726. drivers/net/wireless/ti/wlcore/vendor_cmd.c +1 −1
  727. drivers/net/wireless/ti/wlcore/wlcore.h +10 −2
  728. drivers/net/wireless/ti/wlcore/wlcore_i.h +7 −0
  729. drivers/net/xen-netback/common.h +0 −1
  730. drivers/net/xen-netback/interface.c +1 −1
  731. drivers/net/xen-netback/netback.c +3 −104
  732. drivers/net/xen-netfront.c +89 −169
  733. drivers/nfc/microread/microread.c +2 −1
  734. drivers/nfc/pn544/i2c.c +121 −12
  735. drivers/nfc/pn544/pn544.c +2 −1
  736. drivers/nfc/st21nfca/Makefile +1 −1
  737. drivers/nfc/st21nfca/i2c.c +17 −6
  738. drivers/nfc/st21nfca/st21nfca.c +142 −44
  739. drivers/nfc/st21nfca/st21nfca.h +16 −5
  740. drivers/nfc/st21nfca/st21nfca_se.c +411 −0
  741. drivers/nfc/st21nfca/st21nfca_se.h +63 −0
  742. drivers/nfc/st21nfcb/Makefile +1 −1
  743. drivers/nfc/st21nfcb/i2c.c +12 −7
  744. drivers/nfc/st21nfcb/ndlc.c +1 −2
  745. drivers/nfc/st21nfcb/st21nfcb.c +10 −1
  746. drivers/nfc/st21nfcb/st21nfcb.h +2 −0
  747. drivers/nfc/st21nfcb/st21nfcb_se.c +707 −0
  748. drivers/nfc/st21nfcb/st21nfcb_se.h +61 −0
  749. drivers/phy/phy-miphy365x.c +10 −19
  750. drivers/phy/phy-stih407-usb.c +14 −11
  751. drivers/s390/net/claw.c +2 −4
  752. drivers/s390/net/ctcm_fsms.c +7 −11
  753. drivers/s390/net/ctcm_main.c +2 −2
  754. drivers/s390/net/ctcm_main.h +1 −1
  755. drivers/s390/net/ctcm_sysfs.c +2 −2
  756. drivers/s390/net/lcs.c +2 −4
  757. drivers/s390/net/netiucv.c +6 −9
  758. drivers/s390/net/qeth_core.h +0 −1
  759. drivers/s390/net/qeth_core_sys.c +18 −27
  760. drivers/s390/net/qeth_l2_main.c +2 −4
  761. drivers/s390/net/qeth_l3_main.c +6 −9
  762. drivers/s390/net/qeth_l3_sys.c +18 −27
  763. drivers/scsi/csiostor/Makefile +1 −1
  764. drivers/scsi/csiostor/csio_hw.c +591 −584
  765. drivers/scsi/csiostor/csio_hw.h +5 −44
  766. drivers/scsi/csiostor/csio_hw_chip.h +29 −36
  767. drivers/scsi/csiostor/csio_hw_t4.c +0 −404
  768. drivers/scsi/csiostor/csio_hw_t5.c +75 −75
  769. drivers/scsi/csiostor/csio_init.c +2 −4
  770. drivers/scsi/csiostor/csio_isr.c +1 −1
  771. drivers/scsi/csiostor/csio_lnode.c +1 −1
  772. drivers/scsi/csiostor/csio_mb.c +29 −27
  773. drivers/scsi/csiostor/csio_scsi.c +2 −2
  774. drivers/scsi/csiostor/csio_wr.c +80 −77
  775. drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +31 −10
  776. drivers/scsi/pmcraid.c +1 −7
  777. drivers/ssb/main.c +0 −19
  778. drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +5 −5
  779. drivers/staging/wlan-ng/cfg80211.c +2 −2
  780. drivers/target/target_core_user.c +1 −3
  781. drivers/thermal/thermal_core.c +1 −5
  782. drivers/vhost/net.c +23 −60
  783. drivers/vhost/scsi.c +1 −1
  784. drivers/vhost/vhost.c +4 −2
  785. fs/afs/rxrpc.c +7 −7
  786. fs/dlm/netlink.c +1 −6
  787. include/clocksource/arm_arch_timer.h +1 −1
  788. include/crypto/if_alg.h +1 −2
  789. include/dt-bindings/clock/rk3288-cru.h +3 −0
  790. include/linux/bcma/bcma.h +1 −0
  791. include/linux/bcma/bcma_driver_pci.h +2 −0
  792. include/linux/bcma/bcma_regs.h +2 −0
  793. include/linux/bcma/bcma_soc.h +0 −2
  794. include/linux/clocksource.h +0 −102
  795. include/linux/etherdevice.h +4 −0
  796. include/linux/fec.h +1 −0
  797. include/linux/ieee80211.h +27 −0
  798. include/linux/if_bridge.h +0 −18
  799. include/linux/if_vlan.h +7 −7
  800. include/linux/ipv6.h +8 −5
  801. include/linux/list_nulls.h +5 −1
  802. include/linux/mlx4/cmd.h +13 −3
  803. include/linux/mlx4/device.h +56 −5
  804. include/linux/mlx4/driver.h +19 −0
  805. include/linux/mlx4/qp.h +1 −0
  806. include/linux/mmc/sdio_ids.h +4 −2
  807. include/linux/netdev_features.h +5 −1
  808. include/linux/netdevice.h +67 −21
  809. include/linux/phy.h +12 −0
  810. include/linux/platform_data/irda-sa11x0.h +0 −0
  811. include/linux/platform_data/st21nfca.h +2 −0
  812. include/linux/platform_data/st21nfcb.h +1 −3
  813. include/linux/rhashtable.h +231 −77
  814. include/linux/skbuff.h +33 −11
  815. include/linux/socket.h +0 −7
  816. include/linux/spinlock.h +8 −0
  817. include/linux/spinlock_api_smp.h +2 −0
  818. include/linux/spinlock_api_up.h +1 −0
  819. include/linux/ssb/ssb_regs.h +1 −0
  820. include/linux/tcp.h +6 −0
  821. include/linux/timecounter.h +139 −0
  822. include/linux/types.h +3 −0
  823. include/linux/udp.h +1 −15
  824. include/linux/uio.h +0 −6
  825. include/linux/vmw_vmci_api.h +1 −1
  826. include/net/addrconf.h +3 −0
  827. include/net/bluetooth/bluetooth.h +1 −1
  828. include/net/bluetooth/hci.h +81 −2
  829. include/net/bluetooth/hci_core.h +20 −32
  830. include/net/bluetooth/l2cap.h +1 −0
  831. include/net/bluetooth/mgmt.h +0 −4
  832. include/net/bluetooth/rfcomm.h +0 −2
  833. include/net/bond_3ad.h +0 −1
  834. include/net/bonding.h +18 −0
  835. include/net/cfg80211.h +179 −114
  836. include/net/cfg802154.h +9 −1
  837. include/net/genetlink.h +19 −2
  838. include/net/geneve.h +3 −4
  839. include/net/gro_cells.h +12 −17
  840. include/net/ieee802154_netdev.h +3 −1
  841. include/net/inet_connection_sock.h +2 −1
  842. include/net/inet_sock.h +28 −1
  843. include/net/ip.h +6 −1
  844. include/net/ip6_fib.h +7 −3
  845. include/net/ip6_tunnel.h +1 −0
  846. include/net/ip_fib.h +29 −21
  847. include/net/ip_tunnels.h +5 −1
  848. include/net/ipv6.h +19 −2
  849. include/net/mac80211.h +73 −27
  850. include/net/mac802154.h +4 −1
  851. include/net/net_namespace.h +4 −0
  852. include/net/netfilter/nf_conntrack.h +0 −2
  853. include/net/netlink.h +4 −6
  854. include/net/netns/ipv4.h +4 −1
  855. include/net/nfc/hci.h +21 −4
  856. include/net/nfc/nci.h +97 −0
  857. include/net/nfc/nci_core.h +130 −7
  858. include/net/nfc/nfc.h +27 −0
  859. include/net/nl802154.h +44 −1
  860. include/net/ping.h +1 −1
  861. include/net/pkt_sched.h +12 −0
  862. include/net/regulatory.h +19 −0
  863. include/net/route.h +2 −0
  864. include/net/rtnetlink.h +2 −0
  865. include/net/sock.h +10 −56
  866. include/net/switchdev.h +78 −1
  867. include/net/tc_act/tc_bpf.h +25 −0
  868. include/net/tc_act/tc_connmark.h +14 −0
  869. include/net/tcp.h +69 −3
  870. include/net/udp_tunnel.h +8 −8
  871. include/net/udplite.h +1 −2
  872. include/net/vxlan.h +98 −5
  873. include/trace/events/net.h +4 −4
  874. include/uapi/linux/Kbuild +1 −0
  875. include/uapi/linux/ethtool.h +3 −1
  876. include/uapi/linux/if_bridge.h +2 −0
  877. include/uapi/linux/if_link.h +4 −0
  878. include/uapi/linux/in.h +1 −0
  879. include/uapi/linux/ipv6.h +6 −1
  880. include/uapi/linux/l2tp.h +1 −0
  881. include/uapi/linux/libc-compat.h +6 −0
  882. include/uapi/linux/neighbour.h +1 −0
  883. include/uapi/linux/net_namespace.h +23 −0
  884. include/uapi/linux/net_tstamp.h +2 −1
  885. include/uapi/linux/nfc.h +1 −0
  886. include/uapi/linux/nl80211.h +176 −31
  887. include/uapi/linux/openvswitch.h +52 −1
  888. include/uapi/linux/pkt_sched.h +2 −0
  889. include/uapi/linux/rtnetlink.h +8 −0
  890. include/uapi/linux/snmp.h +6 −0
  891. include/uapi/linux/tc_act/Kbuild +1 −0
  892. include/uapi/linux/tc_act/tc_bpf.h +31 −0
  893. include/uapi/linux/tc_act/tc_connmark.h +22 −0
  894. include/uapi/linux/tipc_config.h +20 −0
  895. include/xen/page.h +5 −0
  896. kernel/locking/spinlock.c +8 −0
  897. kernel/taskstats.c +2 −11
  898. kernel/time/Makefile +1 −1
  899. kernel/time/clocksource.c +0 −76
  900. kernel/time/timecounter.c +112 −0
  901. lib/Kconfig.debug +1 −1
  902. lib/Makefile +2 −1
  903. lib/iovec.c +0 −87
  904. lib/rhashtable.c +751 −419
  905. lib/test_rhashtable.c +227 −0
  906. net/8021q/vlan_core.c +1 −1
  907. net/8021q/vlan_netlink.c +8 −0
  908. net/batman-adv/Kconfig +1 −0
  909. net/batman-adv/bat_iv_ogm.c +7 −8
  910. net/batman-adv/bitarray.c +0 −1
  911. net/batman-adv/bitarray.h +1 −2
  912. net/batman-adv/bridge_loop_avoidance.c +7 −10
  913. net/batman-adv/debugfs.c +1 −1
  914. net/batman-adv/distributed-arp-table.c +1 −0
  915. net/batman-adv/distributed-arp-table.h +1 −3
  916. net/batman-adv/fragmentation.c +0 −1
  917. net/batman-adv/fragmentation.h +1 −2
  918. net/batman-adv/gateway_client.c +1 −0
  919. net/batman-adv/main.c +6 −4
  920. net/batman-adv/main.h +7 −8
  921. net/batman-adv/multicast.h +0 −3
  922. net/batman-adv/network-coding.c +1 −2
  923. net/batman-adv/originator.c +0 −1
  924. net/batman-adv/originator.h +0 −1
  925. net/batman-adv/packet.h +3 −2
  926. net/batman-adv/routing.c +1 −2
  927. net/batman-adv/soft-interface.c +0 −1
  928. net/batman-adv/sysfs.c +0 −1
  929. net/batman-adv/translation-table.c +3 −5
  930. net/batman-adv/types.h +1 −3
  931. net/bluetooth/6lowpan.c +31 −35
  932. net/bluetooth/Kconfig +27 −0
  933. net/bluetooth/Makefile +3 −1
  934. net/bluetooth/af_bluetooth.c +6 −0
  935. net/bluetooth/bnep/core.c +3 −4
  936. net/bluetooth/cmtp/capi.c +0 −6
  937. net/bluetooth/hci_conn.c +5 −16
  938. net/bluetooth/hci_core.c +236 −1681
  939. net/bluetooth/hci_debugfs.c +1056 −0
  940. net/bluetooth/hci_debugfs.h +26 −0
  941. net/bluetooth/hci_event.c +214 −34
  942. net/bluetooth/hci_request.c +556 −0
  943. net/bluetooth/hci_request.h +54 −0
  944. net/bluetooth/hci_sock.c +42 −65
  945. net/bluetooth/l2cap_core.c +32 −23
  946. net/bluetooth/l2cap_sock.c +6 −5
  947. net/bluetooth/mgmt.c +449 −168
  948. net/bluetooth/rfcomm/core.c +2 −2
  949. net/bluetooth/rfcomm/sock.c +6 −5
  950. net/bluetooth/sco.c +5 −5
  951. net/bluetooth/selftest.c +244 −0
  952. net/bluetooth/selftest.h +45 −0
  953. net/bluetooth/smp.c +454 −14
  954. net/bluetooth/smp.h +13 −0
  955. net/bridge/br.c +51 −1
  956. net/bridge/br_fdb.c +17 −43
  957. net/bridge/br_if.c +9 −2
  958. net/bridge/br_mdb.c +3 −2
  959. net/bridge/br_netfilter.c +6 −6
  960. net/bridge/br_netlink.c +230 −70
  961. net/bridge/br_private.h +8 −4
  962. net/bridge/br_vlan.c +2 −2
  963. net/bridge/netfilter/ebt_vlan.c +2 −2
  964. net/bridge/netfilter/ebtables.c +1 −1
  965. net/can/gw.c +2 −1
  966. net/core/Makefile +1 −1
  967. net/core/dev.c +146 −81
  968. net/core/ethtool.c +34 −11
  969. net/core/fib_rules.c +2 −1
  970. net/core/flow.c +1 −1
  971. net/core/flow_dissector.c +20 −1
  972. net/core/iovec.c +0 −137
  973. net/core/neighbour.c +12 −8
  974. net/core/net_namespace.c +213 −0
  975. net/core/netpoll.c +1 −1
  976. net/core/pktgen.c +8 −8
  977. net/core/rtnetlink.c +98 −58
  978. net/core/skbuff.c +42 −17
  979. net/core/sock.c +3 −0
  980. net/core/sysctl_net_core.c +11 −2
  981. net/decnet/dn_dev.c +2 −1
  982. net/decnet/dn_fib.c +2 −1
  983. net/decnet/dn_route.c +3 −5
  984. net/decnet/dn_table.c +5 −2
  985. net/dsa/dsa.c +1 −1
  986. net/dsa/slave.c +0 −13
  987. net/ethernet/eth.c +92 −0
  988. net/ieee802154/6lowpan/6lowpan_i.h +72 −0
  989. net/ieee802154/6lowpan/Kconfig +5 −0
  990. net/ieee802154/6lowpan/Makefile +3 −0
  991. net/ieee802154/6lowpan/core.c +304 −0
  992. net/ieee802154/6lowpan/reassembly.c +1 −1
  993. net/ieee802154/6lowpan/rx.c +171 −0
  994. net/ieee802154/6lowpan/tx.c +271 −0
  995. net/ieee802154/6lowpan_rtnl.c +0 −729
  996. net/ieee802154/Kconfig +13 −5
  997. net/ieee802154/Makefile +4 −4
  998. net/ieee802154/af802154.h +0 −33
  999. net/ieee802154/af_ieee802154.c +0 −369
  1000. net/ieee802154/dgram.c +0 −549
  1001. net/ieee802154/netlink.c +2 −10
  1002. net/ieee802154/nl-mac.c +4 −3
  1003. net/ieee802154/nl-phy.c +2 −1
  1004. net/ieee802154/nl802154.c +47 −5
  1005. net/ieee802154/raw.c +0 −270
  1006. net/ieee802154/rdev-ops.h +7 −0
  1007. net/ieee802154/reassembly.h +0 −41
  1008. net/ieee802154/socket.c +1125 −0
  1009. net/ieee802154/sysfs.c +1 −1
  1010. net/ipv4/af_inet.c +0 −2
  1011. net/ipv4/devinet.c +9 −7
  1012. net/ipv4/fib_frontend.c +16 −13
  1013. net/ipv4/fib_lookup.h +0 −1
  1014. net/ipv4/fib_rules.c +10 −12
  1015. net/ipv4/fib_semantics.c +14 −21
  1016. net/ipv4/fib_trie.c +934 −1026
  1017. net/ipv4/fou.c +11 −21
  1018. net/ipv4/geneve.c +136 −75
  1019. net/ipv4/icmp.c +8 −9
  1020. net/ipv4/inet_diag.c +6 −3
  1021. net/ipv4/ip_gre.c +9 −6
  1022. net/ipv4/ip_output.c +2 −4
  1023. net/ipv4/ip_sockglue.c +83 −32
  1024. net/ipv4/ip_tunnel.c +8 −0
  1025. net/ipv4/ip_vti.c +1 −0
  1026. net/ipv4/ipconfig.c +3 −3
  1027. net/ipv4/ipip.c +7 −6
  1028. net/ipv4/ipmr.c +2 −1
  1029. net/ipv4/ping.c +8 −9
  1030. net/ipv4/proc.c +6 −0
  1031. net/ipv4/raw.c +3 −4
  1032. net/ipv4/route.c +36 −15
  1033. net/ipv4/sysctl_net_ipv4.c +21 −14
  1034. net/ipv4/tcp.c +106 −127
  1035. net/ipv4/tcp_cong.c +95 −26
  1036. net/ipv4/tcp_fastopen.c +8 −5
  1037. net/ipv4/tcp_input.c +51 −37
  1038. net/ipv4/tcp_ipv4.c +3 −0
  1039. net/ipv4/tcp_metrics.c +2 −1
  1040. net/ipv4/tcp_minisocks.c +56 −10
  1041. net/ipv4/tcp_output.c +41 −9
  1042. net/ipv4/tcp_timer.c +5 −2
  1043. net/ipv4/udp.c +2 −2
  1044. net/ipv4/udp_offload.c +5 −2
  1045. net/ipv4/udp_tunnel.c +7 −7
  1046. net/ipv6/addrconf.c +65 −17
  1047. net/ipv6/addrlabel.c +3 −2
  1048. net/ipv6/datagram.c +2 −3
  1049. net/ipv6/icmp.c +1 −1
  1050. net/ipv6/ip6_fib.c +35 −34
  1051. net/ipv6/ip6_gre.c +2 −0
  1052. net/ipv6/ip6_output.c +241 −119
  1053. net/ipv6/ip6_tunnel.c +9 −0
  1054. net/ipv6/ip6_udp_tunnel.c +6 −6
  1055. net/ipv6/ip6_vti.c +1 −0
  1056. net/ipv6/ip6mr.c +2 −1
  1057. net/ipv6/ipv6_sockglue.c +2 −6
  1058. net/ipv6/ndisc.c +4 −2
  1059. net/ipv6/output_core.c +3 −2
  1060. net/ipv6/ping.c +1 −2
  1061. net/ipv6/raw.c +3 −4
  1062. net/ipv6/route.c +64 −13
  1063. net/ipv6/sit.c +1 −0
  1064. net/ipv6/tcp_ipv6.c +2 −0
  1065. net/ipv6/udp.c +61 −32
  1066. net/irda/irlap.c +5 −3
  1067. net/l2tp/l2tp_netlink.c +95 −12
  1068. net/mac80211/Kconfig +1 −0
  1069. net/mac80211/Makefile +2 −0
  1070. net/mac80211/aes_ccm.c +12 −9
  1071. net/mac80211/aes_ccm.h +7 −3
  1072. net/mac80211/aes_cmac.c +26 −8
  1073. net/mac80211/aes_cmac.h +4 −1
  1074. net/mac80211/aes_gcm.c +95 −0
  1075. net/mac80211/aes_gcm.h +22 −0
  1076. net/mac80211/aes_gmac.c +84 −0
  1077. net/mac80211/aes_gmac.h +20 −0
  1078. net/mac80211/cfg.c +71 −19
  1079. net/mac80211/chan.c +34 −7
  1080. net/mac80211/debugfs.c +0 −2
  1081. net/mac80211/debugfs_key.c +55 −0
  1082. net/mac80211/driver-ops.h +15 −15
  1083. net/mac80211/ethtool.c +13 −13
  1084. net/mac80211/ibss.c +9 −2
  1085. net/mac80211/ieee80211_i.h +38 −6
  1086. net/mac80211/iface.c +5 −9
  1087. net/mac80211/key.c +180 −14
  1088. net/mac80211/key.h +18 −0
  1089. net/mac80211/main.c +68 −43
  1090. net/mac80211/mlme.c +70 −26
  1091. net/mac80211/offchannel.c +2 −2
  1092. net/mac80211/pm.c +1 −1
  1093. net/mac80211/rc80211_minstrel.c +3 −3
  1094. net/mac80211/rc80211_minstrel.h +8 −7
  1095. net/mac80211/rx.c +53 −16
  1096. net/mac80211/scan.c +9 −4
  1097. net/mac80211/spectmgmt.c +0 −4
  1098. net/mac80211/sta_info.c +140 −49
  1099. net/mac80211/sta_info.h +12 −0
  1100. net/mac80211/status.c +20 −6
  1101. net/mac80211/tdls.c +42 −27
  1102. net/mac80211/trace.h +7 −26
  1103. net/mac80211/tx.c +23 −2
  1104. net/mac80211/util.c +54 −29
  1105. net/mac80211/vht.c +38 −35
  1106. net/mac80211/wpa.c +433 −10
  1107. net/mac80211/wpa.h +17 −2
  1108. net/mac802154/cfg.c +22 −4
  1109. net/mac802154/driver-ops.h +3 −2
  1110. net/mac802154/iface.c +86 −14
  1111. net/mac802154/mac_cmd.c +3 −3
  1112. net/mpls/mpls_gso.c +2 −2
  1113. net/netfilter/ipvs/ip_vs_ctl.c +6 −3
  1114. net/netfilter/nf_conntrack_core.c +8 −9
  1115. net/netfilter/nf_conntrack_netlink.c +64 −25
  1116. net/netfilter/nf_conntrack_seqadj.c +3 −3
  1117. net/netfilter/nf_log.c +1 −2
  1118. net/netfilter/nf_tables_api.c +12 −6
  1119. net/netfilter/nfnetlink.c +7 −8
  1120. net/netfilter/nfnetlink_cthelper.c +2 −2
  1121. net/netfilter/nft_hash.c +84 −61
  1122. net/netfilter/xt_osf.c +85 −84
  1123. net/netlabel/netlabel_cipso_v4.c +3 −3
  1124. net/netlabel/netlabel_mgmt.c +28 −28
  1125. net/netlabel/netlabel_unlabeled.c +2 −1
  1126. net/netlink/af_netlink.c +122 −128
  1127. net/netlink/af_netlink.h +1 −1
  1128. net/netlink/diag.c +9 −6
  1129. net/netlink/genetlink.c +4 −2
  1130. net/nfc/core.c +21 −2
  1131. net/nfc/hci/command.c +4 −19
  1132. net/nfc/hci/core.c +72 −25
  1133. net/nfc/hci/hci.h +8 −2
  1134. net/nfc/hci/hcp.c +0 −11
  1135. net/nfc/nci/Makefile +1 −1
  1136. net/nfc/nci/core.c +154 −15
  1137. net/nfc/nci/data.c +41 −15
  1138. net/nfc/nci/hci.c +694 −0
  1139. net/nfc/nci/ntf.c +67 −10
  1140. net/nfc/nci/rsp.c +119 −1
  1141. net/nfc/netlink.c +54 −5
  1142. net/nfc/nfc.h +2 −0
  1143. net/openvswitch/actions.c +237 −140
  1144. net/openvswitch/datapath.c +159 −78
  1145. net/openvswitch/flow.c +3 −3
  1146. net/openvswitch/flow.h +32 −10
  1147. net/openvswitch/flow_netlink.c +418 −129
  1148. net/openvswitch/flow_netlink.h +11 −2
  1149. net/openvswitch/flow_table.c +178 −50
  1150. net/openvswitch/flow_table.h +6 −2
  1151. net/openvswitch/vport-geneve.c +14 −18
  1152. net/openvswitch/vport-gre.c +3 −11
  1153. net/openvswitch/vport-vxlan.c +92 −18
  1154. net/openvswitch/vport-vxlan.h +11 −0
  1155. net/openvswitch/vport.c +3 −9
  1156. net/openvswitch/vport.h +18 −0
  1157. net/packet/af_packet.c +7 −7
  1158. net/packet/diag.c +2 −1
  1159. net/phonet/pn_netlink.c +9 −11
  1160. net/rds/ib_send.c +2 −2
  1161. net/rds/iw_cm.c +2 −2
  1162. net/rds/iw_send.c +2 −2
  1163. net/rds/message.c +4 −4
  1164. net/rfkill/rfkill-gpio.c +1 −0
  1165. net/rxrpc/ar-error.c +5 −0
  1166. net/rxrpc/ar-output.c +10 −36
  1167. net/sched/Kconfig +24 −0
  1168. net/sched/Makefile +2 −0
  1169. net/sched/act_bpf.c +208 −0
  1170. net/sched/act_connmark.c +192 −0
  1171. net/sched/act_csum.c +1 −1
  1172. net/sched/cls_basic.c +5 −2
  1173. net/sched/cls_bpf.c +9 −9
  1174. net/sched/cls_flow.c +4 −4
  1175. net/sched/em_ipset.c +1 −1
  1176. net/sched/em_meta.c +2 −2
  1177. net/sched/sch_api.c +1 −1
  1178. net/sched/sch_dsmark.c +3 −3
  1179. net/sched/sch_fq.c +27 −6
  1180. net/sched/sch_teql.c +2 −9
  1181. net/sctp/associola.c +1 −2
  1182. net/socket.c +30 −93
  1183. net/switchdev/switchdev.c +175 −0
  1184. net/tipc/Kconfig +0 −12
  1185. net/tipc/Makefile +3 −3
  1186. net/tipc/addr.c +44 −1
  1187. net/tipc/addr.h +8 −37
  1188. net/tipc/bcast.c +211 −288
  1189. net/tipc/bcast.h +74 −41
  1190. net/tipc/bearer.c +75 −130
  1191. net/tipc/bearer.h +23 −20
  1192. net/tipc/config.c +0 −342
  1193. net/tipc/config.h +0 −67
  1194. net/tipc/core.c +71 −83
  1195. net/tipc/core.h +39 −132
  1196. net/tipc/discover.c +51 −39
  1197. net/tipc/discover.h +5 −3
  1198. net/tipc/link.c +283 −598
  1199. net/tipc/link.h +29 −18
  1200. net/tipc/log.c +0 −55
  1201. net/tipc/msg.c +106 −47
  1202. net/tipc/msg.h +127 −16
  1203. net/tipc/name_distr.c +85 −60
  1204. net/tipc/name_distr.h +8 −8
  1205. net/tipc/name_table.c +139 −259
  1206. net/tipc/name_table.h +31 −18
  1207. net/tipc/net.c +32 −24
  1208. net/tipc/net.h +2 −2
  1209. net/tipc/netlink.c +5 −59
  1210. net/tipc/netlink.h +6 −1
  1211. net/tipc/netlink_compat.c +1084 −0
  1212. net/tipc/node.c +110 −226
  1213. net/tipc/node.h +30 −23
  1214. net/tipc/server.c +4 −2
  1215. net/tipc/server.h +11 −6
  1216. net/tipc/socket.c +453 −562
  1217. net/tipc/socket.h +13 −7
  1218. net/tipc/subscr.c +75 −56
  1219. net/tipc/subscr.h +8 −6
  1220. net/unix/af_unix.c +29 −44
  1221. net/unix/diag.c +2 −1
  1222. net/vmw_vsock/vmci_transport.c +1 −2
  1223. net/wireless/core.c +31 −3
  1224. net/wireless/core.h +10 −1
  1225. net/wireless/nl80211.c +494 −232
  1226. net/wireless/nl80211.h +15 −1
  1227. net/wireless/reg.c +155 −5
  1228. net/wireless/reg.h +1 −0
  1229. net/wireless/scan.c +8 −5
  1230. net/wireless/trace.h +17 −14
  1231. net/wireless/util.c +77 −20
  1232. net/wireless/wext-compat.c +5 −5
  1233. net/xfrm/xfrm_algo.c +0 −5
  1234. net/xfrm/xfrm_user.c +18 −9
  1235. sound/pci/hda/hda_priv.h +1 −1
  1236. virt/kvm/arm/arch_timer.c +2 −1
Documentation/DocBook/80211.tmpl+2−3
@@ -113,7 +113,6 @@ · 112 unmodified lines
113113 !Finclude/net/cfg80211.h cfg80211_beacon_data
114114 !Finclude/net/cfg80211.h cfg80211_ap_settings
115115 !Finclude/net/cfg80211.h station_parameters
116−!Finclude/net/cfg80211.h station_info_flags
117116 !Finclude/net/cfg80211.h rate_info_flags
118117 !Finclude/net/cfg80211.h rate_info
119118 !Finclude/net/cfg80211.h station_info
@@ -435,7 +434,6 @@ · 315 unmodified lines
435434 <section id="ps-client">
436435 <title>support for powersaving clients</title>
437436 !Pinclude/net/mac80211.h AP support for powersaving clients
438− </section>
439437 !Finclude/net/mac80211.h ieee80211_get_buffered_bc
440438 !Finclude/net/mac80211.h ieee80211_beacon_get
441439 !Finclude/net/mac80211.h ieee80211_sta_eosp
@@ -444,6 +442,7 @@ · 2 unmodified lines
444442 !Finclude/net/mac80211.h ieee80211_sta_ps_transition_ni
445443 !Finclude/net/mac80211.h ieee80211_sta_set_buffered
446444 !Finclude/net/mac80211.h ieee80211_sta_block_awake
445+ </section>
447446 </chapter>
448447
449448 <chapter id="multi-iface">
@@ -488,8 +487,8 @@ · 38 unmodified lines
488487 <title>RX A-MPDU aggregation</title>
489488 !Pnet/mac80211/agg-rx.c RX A-MPDU aggregation
490489 !Cnet/mac80211/agg-rx.c
491− </sect1>
492490 !Finclude/net/mac80211.h ieee80211_ampdu_mlme_action
491+ </sect1>
493492 </chapter>
494493
495494 <chapter id="smps">
Documentation/devicetree/bindings/net/amd-xgbe-phy.txt+21−0
@@ -7,17 +7,38 @@ Required properties: · 6 unmodified lines
77 - SerDes Rx/Tx registers
88 - SerDes integration registers (1/2)
99 - SerDes integration registers (2/2)
10+- interrupt-parent: Should be the phandle for the interrupt controller
11+ that services interrupts for this device
12+- interrupts: Should contain the amd-xgbe-phy interrupt.
1013
1114 Optional properties:
1215 - amd,speed-set: Speed capabilities of the device
1316 0 - 1GbE and 10GbE (default)
1417 1 - 2.5GbE and 10GbE
1518
19+The following optional properties are represented by an array with each
20+value corresponding to a particular speed. The first array value represents
21+the setting for the 1GbE speed, the second value for the 2.5GbE speed and
22+the third value for the 10GbE speed. All three values are required if the
23+property is used.
24+- amd,serdes-blwc: Baseline wandering correction enablement
25+ 0 - Off
26+ 1 - On
27+- amd,serdes-cdr-rate: CDR rate speed selection
28+- amd,serdes-pq-skew: PQ (data sampling) skew
29+- amd,serdes-tx-amp: TX amplitude boost
30+
1631 Example:
1732 xgbe_phy@e1240800 {
1833 compatible = "amd,xgbe-phy-seattle-v1a", "ethernet-phy-ieee802.3-c45";
1934 reg = <0 0xe1240800 0 0x00400>,
2035 <0 0xe1250000 0 0x00060>,
2136 <0 0xe1250080 0 0x00004>;
37+ interrupt-parent = <&gic>;
38+ interrupts = <0 323 4>;
2239 amd,speed-set = <0>;
40+ amd,serdes-blwc = <1>, <1>, <0>;
41+ amd,serdes-cdr-rate = <2>, <2>, <7>;
42+ amd,serdes-pq-skew = <10>, <10>, <30>;
43+ amd,serdes-tx-amp = <15>, <15>, <10>;
2344 };
Documentation/devicetree/bindings/net/davicom-dm9000.txt+4−0
@@ -11,6 +11,8 @@ Required properties: · 10 unmodified lines
1111 Optional properties:
1212 - davicom,no-eeprom : Configuration EEPROM is not available
1313 - davicom,ext-phy : Use external PHY
14+- reset-gpios : phandle of gpio that will be used to reset chip during probe
15+- vcc-supply : phandle of regulator that will be used to enable power to chip
1416
1517 Example:
1618
@@ -21,4 +23,6 @@ Example: · 4 unmodified lines
2123 interrupts = <7 4>;
2224 local-mac-address = [00 00 de ad be ef];
2325 davicom,no-eeprom;
26+ reset-gpios = <&gpf 12 GPIO_ACTIVE_LOW>;
27+ vcc-supply = <&eth0_power>;
2428 };
Documentation/devicetree/bindings/net/fsl-fec.txt+2−0
@@ -22,6 +22,8 @@ Optional properties: · 21 unmodified lines
2222 - fsl,num-rx-queues : The property is valid for enet-avb IP, which supports
2323 hw multi queues. Should specify the rx queue number, otherwise set rx queue
2424 number to 1.
25+- fsl,magic-packet : If present, indicates that the hardware supports waking
26+ up via magic packet.
2527
2628 Optional subnodes:
2729 - mdio : specifies the mdio bus in the FEC, used as a container for phy nodes
Documentation/devicetree/bindings/net/fsl-tsec-phy.txt+10−1
@@ -8,7 +8,16 @@ of how to define a PHY. · 7 unmodified lines
88 Required properties:
99 - reg : Offset and length of the register set for the device
1010 - compatible : Should define the compatible device type for the
11− mdio. Currently, this is most likely to be "fsl,gianfar-mdio"
11+ mdio. Currently supported strings/devices are:
12+ - "fsl,gianfar-tbi"
13+ - "fsl,gianfar-mdio"
14+ - "fsl,etsec2-tbi"
15+ - "fsl,etsec2-mdio"
16+ - "fsl,ucc-mdio"
17+ - "fsl,fman-mdio"
18+ When device_type is "mdio", the following strings are also considered:
19+ - "gianfar"
20+ - "ucc_geth_phy"
1221
1322 Example:
1423
Documentation/devicetree/bindings/net/hisilicon-hip04-net.txt+88−0
@@ -0,0 +1,88 @@
1+Hisilicon hip04 Ethernet Controller
2+
3+* Ethernet controller node
4+
5+Required properties:
6+- compatible: should be "hisilicon,hip04-mac".
7+- reg: address and length of the register set for the device.
8+- interrupts: interrupt for the device.
9+- port-handle: <phandle port channel>
10+ phandle, specifies a reference to the syscon ppe node
11+ port, port number connected to the controller
12+ channel, recv channel start from channel * number (RX_DESC_NUM)
13+- phy-mode: see ethernet.txt [1].
14+
15+Optional properties:
16+- phy-handle: see ethernet.txt [1].
17+
18+[1] Documentation/devicetree/bindings/net/ethernet.txt
19+
20+
21+* Ethernet ppe node:
22+Control rx & tx fifos of all ethernet controllers.
23+Have 2048 recv channels shared by all ethernet controllers, only if no overlap.
24+Each controller's recv channel start from channel * number (RX_DESC_NUM).
25+
26+Required properties:
27+- compatible: "hisilicon,hip04-ppe", "syscon".
28+- reg: address and length of the register set for the device.
29+
30+
31+* MDIO bus node:
32+
33+Required properties:
34+
35+- compatible: should be "hisilicon,hip04-mdio".
36+- Inherits from MDIO bus node binding [2]
37+[2] Documentation/devicetree/bindings/net/phy.txt
38+
39+Example:
40+ mdio {
41+ compatible = "hisilicon,hip04-mdio";
42+ reg = <0x28f1000 0x1000>;
43+ #address-cells = <1>;
44+ #size-cells = <0>;
45+
46+ phy0: ethernet-phy@0 {
47+ compatible = "ethernet-phy-ieee802.3-c22";
48+ reg = <0>;
49+ marvell,reg-init = <18 0x14 0 0x8001>;
50+ };
51+
52+ phy1: ethernet-phy@1 {
53+ compatible = "ethernet-phy-ieee802.3-c22";
54+ reg = <1>;
55+ marvell,reg-init = <18 0x14 0 0x8001>;
56+ };
57+ };
58+
59+ ppe: ppe@28c0000 {
60+ compatible = "hisilicon,hip04-ppe", "syscon";
61+ reg = <0x28c0000 0x10000>;
62+ };
63+
64+ fe: ethernet@28b0000 {
65+ compatible = "hisilicon,hip04-mac";
66+ reg = <0x28b0000 0x10000>;
67+ interrupts = <0 413 4>;
68+ phy-mode = "mii";
69+ port-handle = <&ppe 31 0>;
70+ };
71+
72+ ge0: ethernet@2800000 {
73+ compatible = "hisilicon,hip04-mac";
74+ reg = <0x2800000 0x10000>;
75+ interrupts = <0 402 4>;
76+ phy-mode = "sgmii";
77+ port-handle = <&ppe 0 1>;
78+ phy-handle = <&phy0>;
79+ };
80+
81+ ge8: ethernet@2880000 {
82+ compatible = "hisilicon,hip04-mac";
83+ reg = <0x2880000 0x10000>;
84+ interrupts = <0 410 4>;
85+ phy-mode = "sgmii";
86+ port-handle = <&ppe 8 2>;
87+ phy-handle = <&phy1>;
88+ };
Documentation/devicetree/bindings/net/keystone-netcp.txt+197−0
@@ -0,0 +1,197 @@
1+This document describes the device tree bindings associated with the
2+keystone network coprocessor(NetCP) driver support.
3+
4+The network coprocessor (NetCP) is a hardware accelerator that processes
5+Ethernet packets. NetCP has a gigabit Ethernet (GbE) subsytem with a ethernet
6+switch sub-module to send and receive packets. NetCP also includes a packet
7+accelerator (PA) module to perform packet classification operations such as
8+header matching, and packet modification operations such as checksum
9+generation. NetCP can also optionally include a Security Accelerator (SA)
10+capable of performing IPSec operations on ingress/egress packets.
11+
12+Keystone II SoC's also have a 10 Gigabit Ethernet Subsystem (XGbE) which
13+includes a 3-port Ethernet switch sub-module capable of 10Gb/s and 1Gb/s rates
14+per Ethernet port.
15+
16+Keystone NetCP driver has a plug-in module architecture where each of the NetCP
17+sub-modules exist as a loadable kernel module which plug in to the netcp core.
18+These sub-modules are represented as "netcp-devices" in the dts bindings. It is
19+mandatory to have the ethernet switch sub-module for the ethernet interface to
20+be operational. Any other sub-module like the PA is optional.
21+
22+NetCP Ethernet SubSystem Layout:
23+
24+-----------------------------
25+ NetCP subsystem(10G or 1G)
26+-----------------------------
27+ |
28+ |-> NetCP Devices -> |
29+ | |-> GBE/XGBE Switch
30+ | |
31+ | |-> Packet Accelerator
32+ | |
33+ | |-> Security Accelerator
34+ |
35+ |
36+ |
37+ |-> NetCP Interfaces -> |
38+ |-> Ethernet Port 0
39+ |
40+ |-> Ethernet Port 1
41+ |
42+ |-> Ethernet Port 2
43+ |
44+ |-> Ethernet Port 3
45+
46+
47+NetCP subsystem properties:
48+Required properties:
49+- compatible: Should be "ti,netcp-1.0"
50+- clocks: phandle to the reference clocks for the subsystem.
51+- dma-id: Navigator packet dma instance id.
52+
53+Optional properties:
54+- reg: register location and the size for the following register
55+ regions in the specified order.
56+ - Efuse MAC address register
57+- dma-coherent: Present if dma operations are coherent
58+- big-endian: Keystone devices can be operated in a mode where the DSP is in
59+ the big endian mode. In such cases enable this option. This
60+ option should also be enabled if the ARM is operated in
61+ big endian mode with the DSP in little endian.
62+
63+NetCP device properties: Device specification for NetCP sub-modules.
64+1Gb/10Gb (gbe/xgbe) ethernet switch sub-module specifications.
65+Required properties:
66+- label: Must be "netcp-gbe" for 1Gb & "netcp-xgbe" for 10Gb.
67+- reg: register location and the size for the following register
68+ regions in the specified order.
69+ - subsystem registers
70+ - serdes registers
71+- tx-channel: the navigator packet dma channel name for tx.
72+- tx-queue: the navigator queue number associated with the tx dma channel.
73+- interfaces: specification for each of the switch port to be registered as a
74+ network interface in the stack.
75+-- slave-port: Switch port number, 0 based numbering.
76+-- link-interface: type of link interface, supported options are
77+ - mac<->mac auto negotiate mode: 0
78+ - mac<->phy mode: 1
79+ - mac<->mac forced mode: 2
80+ - mac<->fiber mode: 3
81+ - mac<->phy mode with no mdio: 4
82+ - 10Gb mac<->phy mode : 10
83+ - 10Gb mac<->mac forced mode : 11
84+----phy-handle: phandle to PHY device
85+
86+Optional properties:
87+- enable-ale: NetCP driver keeps the address learning feature in the ethernet
88+ switch module disabled. This attribute is to enable the address
89+ learning.
90+- secondary-slave-ports: specification for each of the switch port not be
91+ registered as a network interface. NetCP driver
92+ will only initialize these ports and attach PHY
93+ driver to them if needed.
94+
95+NetCP interface properties: Interface specification for NetCP sub-modules.
96+Required properties:
97+- rx-channel: the navigator packet dma channel name for rx.
98+- rx-queue: the navigator queue number associated with rx dma channel.
99+- rx-pool: specifies the number of descriptors to be used & the region-id
100+ for creating the rx descriptor pool.
101+- tx-pool: specifies the number of descriptors to be used & the region-id
102+ for creating the tx descriptor pool.
103+- rx-queue-depth: number of descriptors in each of the free descriptor
104+ queue (FDQ) for the pktdma Rx flow. There can be at
105+ present a maximum of 4 queues per Rx flow.
106+- rx-buffer-size: the buffer size for each of the Rx flow FDQ.
107+- tx-completion-queue: the navigator queue number where the descriptors are
108+ recycled after Tx DMA completion.
109+
110+Optional properties:
111+- efuse-mac: If this is 1, then the MAC address for the interface is
112+ obtained from the device efuse mac address register
113+- local-mac-address: the driver is designed to use the of_get_mac_address api
114+ only if efuse-mac is 0. When efuse-mac is 0, the MAC
115+ address is obtained from local-mac-address. If this
116+ attribute is not present, then the driver will use a
117+ random MAC address.
118+- "netcp-device label": phandle to the device specification for each of NetCP
119+ sub-module attached to this interface.
120+
121+Example binding:
122+
123+netcp: netcp@2090000 {
124+ reg = <0x2620110 0x8>;
125+ reg-names = "efuse";
126+ compatible = "ti,netcp-1.0";
127+ #address-cells = <1>;
128+ #size-cells = <1>;
129+ ranges;
130+
131+ clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
132+ dma-coherent;
133+ /* big-endian; */
134+ dma-id = <0>;
135+
136+ netcp-devices {
137+ #address-cells = <1>;
138+ #size-cells = <1>;
139+ ranges;
140+ gbe@0x2090000 {
141+ label = "netcp-gbe";
142+ reg = <0x2090000 0xf00>;
143+ /* enable-ale; */
144+ tx-queue = <648>;
145+ tx-channel = <8>;
146+
147+ interfaces {
148+ gbe0: interface-0 {
149+ slave-port = <0>;
150+ link-interface = <4>;
151+ };
152+ gbe1: interface-1 {
153+ slave-port = <1>;
154+ link-interface = <4>;
155+ };
156+ };
157+
158+ secondary-slave-ports {
159+ port-2 {
160+ slave-port = <2>;
161+ link-interface = <2>;
162+ };
163+ port-3 {
164+ slave-port = <3>;
165+ link-interface = <2>;
166+ };
167+ };
168+ };
169+ };
170+
171+ netcp-interfaces {
172+ interface-0 {
173+ rx-channel = <22>;
174+ rx-pool = <1024 12>;
175+ tx-pool = <1024 12>;
176+ rx-queue-depth = <128 128 0 0>;
177+ rx-buffer-size = <1518 4096 0 0>;
178+ rx-queue = <8704>;
179+ tx-completion-queue = <8706>;
180+ efuse-mac = <1>;
181+ netcp-gbe = <&gbe0>;
182+
183+ };
184+ interface-1 {
185+ rx-channel = <23>;
186+ rx-pool = <1024 12>;
187+ tx-pool = <1024 12>;
188+ rx-queue-depth = <128 128 0 0>;
189+ rx-buffer-size = <1518 4096 0 0>;
190+ rx-queue = <8705>;
191+ tx-completion-queue = <8707>;
192+ efuse-mac = <0>;
193+ local-mac-address = [02 18 31 7e 3e 6f];
194+ netcp-gbe = <&gbe1>;
195+ };
196+ };
197+};
Documentation/devicetree/bindings/net/nfc/st21nfca.txt+9−2
@@ -1,7 +1,7 @@
11 * STMicroelectronics SAS. ST21NFCA NFC Controller
22
33 Required properties:
4−- compatible: Should be "st,st21nfca_i2c".
4+- compatible: Should be "st,st21nfca-i2c".
55 - clock-frequency: I²C work frequency.
66 - reg: address on the bus
77 - interrupt-parent: phandle for the interrupt gpio controller
@@ -11,6 +11,10 @@ Required properties: · 3 unmodified lines
1111 Optional SoC Specific Properties:
1212 - pinctrl-names: Contains only one value - "default".
1313 - pintctrl-0: Specifies the pin control groups used for this controller.
14+- ese-present: Specifies that an ese is physically connected to the nfc
15+controller.
16+- uicc-present: Specifies that the uicc swp signal can be physically
17+connected to the nfc controller.
1418
1519 Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2):
1620
@@ -20,7 +24,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): · 3 unmodified lines
2024
2125 st21nfca: st21nfca@1 {
2226
23− compatible = "st,st21nfca_i2c";
27+ compatible = "st,st21nfca-i2c";
2428
2529 reg = <0x01>;
2630 clock-frequency = <400000>;
@@ -29,5 +33,8 @@ Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): · 2 unmodified lines
2933 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
3034
3135 enable-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;
36+
37+ ese-present;
38+ uicc-present;
3239 };
3340 };
Documentation/devicetree/bindings/net/nfc/st21nfcb.txt+2−2
@@ -1,7 +1,7 @@
11 * STMicroelectronics SAS. ST21NFCB NFC Controller
22
33 Required properties:
4−- compatible: Should be "st,st21nfcb_i2c".
4+- compatible: Should be "st,st21nfcb-i2c".
55 - clock-frequency: I²C work frequency.
66 - reg: address on the bus
77 - interrupt-parent: phandle for the interrupt gpio controller
@@ -20,7 +20,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCB on I2C2): · 12 unmodified lines
2020
2121 st21nfcb: st21nfcb@8 {
2222
23− compatible = "st,st21nfcb_i2c";
23+ compatible = "st,st21nfcb-i2c";
2424
2525 reg = <0x08>;
2626 clock-frequency = <400000>;
Documentation/devicetree/bindings/net/rockchip-dwmac.txt+68−0
@@ -0,0 +1,68 @@
1+Rockchip SoC RK3288 10/100/1000 Ethernet driver(GMAC)
2+
3+The device node has following properties.
4+
5+Required properties:
6+ - compatible: Can be "rockchip,rk3288-gmac".
7+ - reg: addresses and length of the register sets for the device.
8+ - interrupts: Should contain the GMAC interrupts.
9+ - interrupt-names: Should contain the interrupt names "macirq".
10+ - rockchip,grf: phandle to the syscon grf used to control speed and mode.
11+ - clocks: <&cru SCLK_MAC>: clock selector for main clock, from PLL or PHY.
12+ <&cru SCLK_MAC_PLL>: PLL clock for SCLK_MAC
13+ <&cru SCLK_MAC_RX>: clock gate for RX
14+ <&cru SCLK_MAC_TX>: clock gate for TX
15+ <&cru SCLK_MACREF>: clock gate for RMII referce clock
16+ <&cru SCLK_MACREF_OUT> clock gate for RMII reference clock output
17+ <&cru ACLK_GMAC>: AXI clock gate for GMAC
18+ <&cru PCLK_GMAC>: APB clock gate for GMAC
19+ - clock-names: One name for each entry in the clocks property.
20+ - phy-mode: See ethernet.txt file in the same directory.
21+ - pinctrl-names: Names corresponding to the numbered pinctrl states.
22+ - pinctrl-0: pin-control mode. can be <&rgmii_pins> or <&rmii_pins>.
23+ - clock_in_out: For RGMII, it must be "input", means main clock(125MHz)
24+ is not sourced from SoC's PLL, but input from PHY; For RMII, "input" means
25+ PHY provides the reference clock(50MHz), "output" means GMAC provides the
26+ reference clock.
27+ - snps,reset-gpio gpio number for phy reset.
28+ - snps,reset-active-low boolean flag to indicate if phy reset is active low.
29+ - assigned-clocks: main clock, should be <&cru SCLK_MAC>;
30+ - assigned-clock-parents = parent of main clock.
31+ can be <&ext_gmac> or <&cru SCLK_MAC_PLL>.
32+
33+Optional properties:
34+ - tx_delay: Delay value for TXD timing. Range value is 0~0x7F, 0x30 as default.
35+ - rx_delay: Delay value for RXD timing. Range value is 0~0x7F, 0x10 as default.
36+ - phy-supply: phandle to a regulator if the PHY needs one
37+
38+Example:
39+
40+gmac: ethernet@ff290000 {
41+ compatible = "rockchip,rk3288-gmac";
42+ reg = <0xff290000 0x10000>;
43+ interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
44+ interrupt-names = "macirq";
45+ rockchip,grf = <&grf>;
46+ clocks = <&cru SCLK_MAC>,
47+ <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>,
48+ <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>,
49+ <&cru ACLK_GMAC>, <&cru PCLK_GMAC>;
50+ clock-names = "stmmaceth",
51+ "mac_clk_rx", "mac_clk_tx",
52+ "clk_mac_ref", "clk_mac_refout",
53+ "aclk_mac", "pclk_mac";
54+ phy-mode = "rgmii";
55+ pinctrl-names = "default";
56+ pinctrl-0 = <&rgmii_pins /*&rmii_pins*/>;
57+
58+ clock_in_out = "input";
59+ snps,reset-gpio = <&gpio4 7 0>;
60+ snps,reset-active-low;
61+
62+ assigned-clocks = <&cru SCLK_MAC>;
63+ assigned-clock-parents = <&ext_gmac>;
64+ tx_delay = <0x30>;
65+ rx_delay = <0x10>;
66+
67+ status = "ok";
68+};
Documentation/devicetree/bindings/net/sti-dwmac.txt+5−9
@@ -9,14 +9,10 @@ The device node has following properties. · 8 unmodified lines
99 Required properties:
1010 - compatible : Can be "st,stih415-dwmac", "st,stih416-dwmac",
1111 "st,stih407-dwmac", "st,stid127-dwmac".
12− - reg : Offset of the glue configuration register map in system
13− configuration regmap pointed by st,syscon property and size.
14− - st,syscon : Should be phandle to system configuration node which
15− encompases this glue registers.
12+ - st,syscon : Should be phandle/offset pair. The phandle to the syscon node which
13+ encompases the glue register, and the offset of the control register.
1614 - st,gmac_en: this is to enable the gmac into a dedicated sysctl control
1715 register available on STiH407 SoC.
18− - sti-ethconf: this is the gmac glue logic register to enable the GMAC,
19− select among the different modes and program the clk retiming.
2016 - pinctrl-0: pin-control for all the MII mode supported.
2117
2218 Optional properties:
@@ -40,10 +36,10 @@ ethernet0: dwmac@9630000 { · 17 unmodified lines
4036 device_type = "network";
4137 status = "disabled";
4238 compatible = "st,stih407-dwmac", "snps,dwmac", "snps,dwmac-3.710";
43− reg = <0x9630000 0x8000>, <0x80 0x4>;
44− reg-names = "stmmaceth", "sti-ethconf";
39+ reg = <0x9630000 0x8000>;
40+ reg-names = "stmmaceth";
4541
46− st,syscon = <&syscfg_sbc_reg>;
42+ st,syscon = <&syscfg_sbc_reg 0x80>;
4743 st,gmac_en;
4844 resets = <&softreset STIH407_ETH1_SOFTRESET>;
4945 reset-names = "stmmaceth";
Documentation/devicetree/bindings/net/stmmac.txt+1−0
@@ -43,6 +43,7 @@ Optional properties: · 42 unmodified lines
4343 available this clock is used for programming the Timestamp Addend Register.
4444 If not passed then the system clock will be used and this is fine on some
4545 platforms.
46+- snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register.
4647
4748 Examples:
4849
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt+30−0
@@ -0,0 +1,30 @@
1+* Qualcomm Atheros ath10k wireless devices
2+
3+For ath10k devices the calibration data can be provided through Device
4+Tree. The node is a child node of the PCI controller.
5+
6+Required properties:
7+-compatible : Should be "qcom,ath10k"
8+
9+Optional properties:
10+- qcom,ath10k-calibration-data : calibration data as an array, the
11+ length can vary between hw versions
12+
13+
14+Example:
15+
16+pci {
17+ pcie@0 {
18+ reg = <0 0 0 0 0>;
19+ #interrupt-cells = <1>;
20+ #size-cells = <2>;
21+ #address-cells = <3>;
22+ device_type = "pci";
23+
24+ ath10k@0,0 {
25+ reg = <0 0 0 0 0>;
26+ device_type = "pci";
27+ qcom,ath10k-calibration-data = [ 01 02 03 ... ];
28+ };
29+ };
30+};
Documentation/devicetree/bindings/phy/phy-miphy365x.txt+8−7
@@ -6,8 +6,10 @@ for SATA and PCIe. · 5 unmodified lines
66
77 Required properties (controller (parent) node):
88 - compatible : Should be "st,miphy365x-phy"
9−- st,syscfg : Should be a phandle of the system configuration register group
10− which contain the SATA, PCIe mode setting bits
9+- st,syscfg : Phandle / integer array property. Phandle of sysconfig group
10+ containing the miphy registers and integer array should contain
11+ an entry for each port sub-node, specifying the control
12+ register offset inside the sysconfig group.
1113
1214 Required nodes : A sub-node is required for each channel the controller
1315 provides. Address range information including the usual
@@ -26,7 +28,6 @@ Required properties (port (child) node): · 12 unmodified lines
2628 registers filled in "reg":
2729 - sata: For SATA devices
2830 - pcie: For PCIe devices
29− - syscfg: To specify the syscfg based config register
3031
3132 Optional properties (port (child) node):
3233 - st,sata-gen : Generation of locally attached SATA IP. Expected values
@@ -39,20 +40,20 @@ Example: · 6 unmodified lines
3940
4041 miphy365x_phy: miphy365x@fe382000 {
4142 compatible = "st,miphy365x-phy";
42− st,syscfg = <&syscfg_rear>;
43+ st,syscfg = <&syscfg_rear 0x824 0x828>;
4344 #address-cells = <1>;
4445 #size-cells = <1>;
4546 ranges;
4647
4748 phy_port0: port@fe382000 {
48− reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>;
49− reg-names = "sata", "pcie", "syscfg";
49+ reg = <0xfe382000 0x100>, <0xfe394000 0x100>;
50+ reg-names = "sata", "pcie";
5051 #phy-cells = <1>;
5152 st,sata-gen = <3>;
5253 };
5354
5455 phy_port1: port@fe38a000 {
55− reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>;;
56+ reg = <0xfe38a000 0x100>, <0xfe804000 0x100>;;
5657 reg-names = "sata", "pcie", "syscfg";
5758 #phy-cells = <1>;
5859 st,pcie-tx-pol-inv;
Documentation/devicetree/bindings/phy/phy-stih407-usb.txt+2−8
@@ -5,10 +5,7 @@ host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC fa · 4 unmodified lines
55
66 Required properties:
77 - compatible : should be "st,stih407-usb2-phy"
8−- reg : contain the offset and length of the system configuration registers
9− used as glue logic to control & parameter phy
10−- reg-names : the names of the system configuration registers in "reg", should be "param" and "reg"
11−- st,syscfg : sysconfig register to manage phy parameter at driver level
8+- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets
129 - resets : list of phandle and reset specifier pairs. There should be two entries, one
1310 for the whole phy and one for the port
1411 - reset-names : list of reset signal names. Should be "global" and "port"
@@ -19,11 +16,8 @@ Example: · 4 unmodified lines
1916
2017 usb2_picophy0: usbpicophy@f8 {
2118 compatible = "st,stih407-usb2-phy";
22− reg = <0xf8 0x04>, /* syscfg 5062 */
23− <0xf4 0x04>; /* syscfg 5061 */
24− reg-names = "param", "ctrl";
2519 #phy-cells = <0>;
26− st,syscfg = <&syscfg_core>;
20+ st,syscfg = <&syscfg_core 0x100 0xf4>;
2721 resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
2822 <&picophyreset STIH407_PICOPHY0_RESET>;
2923 reset-names = "global", "port";
Documentation/kernel-parameters.txt+12−0
@@ -3210,6 +3210,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 3209 unmodified lines
32103210
32113211 retain_initrd [RAM] Keep initrd memory after extraction
32123212
3213+ rfkill.default_state=
3214+ 0 "airplane mode". All wifi, bluetooth, wimax, gps, fm,
3215+ etc. communication is blocked by default.
3216+ 1 Unblocked.
3217+
3218+ rfkill.master_switch_mode=
3219+ 0 The "airplane mode" button does nothing.
3220+ 1 The "airplane mode" button toggles between everything
3221+ blocked and the previous configuration.
3222+ 2 The "airplane mode" button toggles between everything
3223+ blocked and everything unblocked.
3224+
32133225 rhash_entries= [KNL,NET]
32143226 Set number of hash buckets for route cache
32153227
Documentation/networking/filter.txt+2−2
@@ -279,8 +279,8 @@ Possible BPF extensions are shown in the following table: · 278 unmodified lines
279279 hatype skb->dev->type
280280 rxhash skb->hash
281281 cpu raw_smp_processor_id()
282− vlan_tci vlan_tx_tag_get(skb)
283− vlan_pr vlan_tx_tag_present(skb)
282+ vlan_tci skb_vlan_tag_get(skb)
283+ vlan_pr skb_vlan_tag_present(skb)
284284 rand prandom_u32()
285285
286286 These extensions can also be prefixed with '#'.
Documentation/networking/ip-sysctl.txt+29−0
@@ -290,6 +290,28 @@ tcp_frto - INTEGER · 289 unmodified lines
290290
291291 By default it's enabled with a non-zero value. 0 disables F-RTO.
292292
293+tcp_invalid_ratelimit - INTEGER
294+ Limit the maximal rate for sending duplicate acknowledgments
295+ in response to incoming TCP packets that are for an existing
296+ connection but that are invalid due to any of these reasons:
297+
298+ (a) out-of-window sequence number,
299+ (b) out-of-window acknowledgment number, or
300+ (c) PAWS (Protection Against Wrapped Sequence numbers) check failure
301+
302+ This can help mitigate simple "ack loop" DoS attacks, wherein
303+ a buggy or malicious middlebox or man-in-the-middle can
304+ rewrite TCP header fields in manner that causes each endpoint
305+ to think that the other is sending invalid TCP segments, thus
306+ causing each side to send an unterminating stream of duplicate
307+ acknowledgments for invalid segments.
308+
309+ Using 0 disables rate-limiting of dupacks in response to
310+ invalid segments; otherwise this value specifies the minimal
311+ space between sending such dupacks, in milliseconds.
312+
313+ Default: 500 (milliseconds).
314+
293315 tcp_keepalive_time - INTEGER
294316 How often TCP sends out keepalive messages when keepalive is enabled.
295317 Default: 2hours.
@@ -1287,6 +1309,13 @@ accept_ra_rtr_pref - BOOLEAN · 991 unmodified lines
12871309 Functional default: enabled if accept_ra is enabled.
12881310 disabled if accept_ra is disabled.
12891311
1312+accept_ra_mtu - BOOLEAN
1313+ Apply the MTU value specified in RA option 5 (RFC4861). If
1314+ disabled, the MTU specified in the RA will be ignored.
1315+
1316+ Functional default: enabled if accept_ra is enabled.
1317+ disabled if accept_ra is disabled.
1318+
12901319 accept_redirects - BOOLEAN
12911320 Accept Redirects.
12921321
Documentation/networking/nf_conntrack-sysctl.txt+2−1
@@ -11,7 +11,8 @@ nf_conntrack_buckets - INTEGER (read-only) · 10 unmodified lines
1111 Size of hash table. If not specified as parameter during module
1212 loading, the default size is calculated by dividing total memory
1313 by 16384 to determine the number of buckets but the hash table will
14− never have fewer than 32 or more than 16384 buckets.
14+ never have fewer than 32 and limited to 16384 buckets. For systems
15+ with more than 4GB of memory it will be 65536 buckets.
1516
1617 nf_conntrack_checksum - BOOLEAN
1718 0 - disabled
Documentation/networking/openvswitch.txt+13−0
@@ -131,6 +131,19 @@ performs best-effort detection of overlapping wildcarded flows and may reject · 130 unmodified lines
131131 some but not all of them. However, this behavior may change in future versions.
132132
133133
134+Unique flow identifiers
135+-----------------------
136+
137+An alternative to using the original match portion of a key as the handle for
138+flow identification is a unique flow identifier, or "UFID". UFIDs are optional
139+for both the kernel and user space program.
140+
141+User space programs that support UFID are expected to provide it during flow
142+setup in addition to the flow, then refer to the flow using the UFID for all
143+future operations. The kernel is not required to index flows by the original
144+flow key if a UFID is specified.
145+
146+
134147 Basic rule for evolving flow keys
135148 ---------------------------------
136149
Documentation/networking/timestamping.txt+21−0
@@ -162,6 +162,27 @@ SOF_TIMESTAMPING_OPT_CMSG: · 161 unmodified lines
162162 option IP_PKTINFO simultaneously.
163163
164164
165+SOF_TIMESTAMPING_OPT_TSONLY:
166+
167+ Applies to transmit timestamps only. Makes the kernel return the
168+ timestamp as a cmsg alongside an empty packet, as opposed to
169+ alongside the original packet. This reduces the amount of memory
170+ charged to the socket's receive budget (SO_RCVBUF) and delivers
171+ the timestamp even if sysctl net.core.tstamp_allow_data is 0.
172+ This option disables SOF_TIMESTAMPING_OPT_CMSG.
173+
174+
175+New applications are encouraged to pass SOF_TIMESTAMPING_OPT_ID to
176+disambiguate timestamps and SOF_TIMESTAMPING_OPT_TSONLY to operate
177+regardless of the setting of sysctl net.core.tstamp_allow_data.
178+
179+An exception is when a process needs additional cmsg data, for
180+instance SOL_IP/IP_PKTINFO to detect the egress network interface.
181+Then pass option SOF_TIMESTAMPING_OPT_CMSG. This option depends on
182+having access to the contents of the original packet, so cannot be
183+combined with SOF_TIMESTAMPING_OPT_TSONLY.
184+
185+
165186 1.4 Bytestream Timestamps
166187
167188 The SO_TIMESTAMPING interface supports timestamping of bytes in a
Documentation/networking/timestamping/txtimestamp.c+26−12
@@ -30,6 +30,8 @@ · 29 unmodified lines
3030 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
3131 */
3232
33+#define _GNU_SOURCE
34+
3335 #include <arpa/inet.h>
3436 #include <asm/types.h>
3537 #include <error.h>
@@ -59,14 +61,6 @@ · 23 unmodified lines
5961 #include <time.h>
6062 #include <unistd.h>
6163
62−/* ugly hack to work around netinet/in.h and linux/ipv6.h conflicts */
63−#ifndef in6_pktinfo
64−struct in6_pktinfo {
65− struct in6_addr ipi6_addr;
66− int ipi6_ifindex;
67−};
68−#endif
69−
7064 /* command line parameters */
7165 static int cfg_proto = SOCK_STREAM;
7266 static int cfg_ipproto = IPPROTO_TCP;
@@ -76,6 +70,7 @@ static int do_ipv6 = 1; · 3 unmodified lines
7670 static int cfg_payload_len = 10;
7771 static bool cfg_show_payload;
7872 static bool cfg_do_pktinfo;
73+static bool cfg_loop_nodata;
7974 static uint16_t dest_port = 9000;
8075
8176 static struct sockaddr_in daddr;
@@ -147,6 +142,9 @@ static void print_payload(char *data, int len) · 65 unmodified lines
147142 {
148143 int i;
149144
145+ if (!len)
146+ return;
147+
150148 if (len > 70)
151149 len = 70;
152150
@@ -183,6 +181,7 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len) · 30 unmodified lines
183181 struct sock_extended_err *serr = NULL;
184182 struct scm_timestamping *tss = NULL;
185183 struct cmsghdr *cm;
184+ int batch = 0;
186185
187186 for (cm = CMSG_FIRSTHDR(msg);
188187 cm && cm->cmsg_len;
@@ -215,10 +214,18 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len) · 26 unmodified lines
215214 } else
216215 fprintf(stderr, "unknown cmsg %d,%d\n",
217216 cm->cmsg_level, cm->cmsg_type);
217+
218+ if (serr && tss) {
219+ print_timestamp(tss, serr->ee_info, serr->ee_data,
220+ payload_len);
221+ serr = NULL;
222+ tss = NULL;
223+ batch++;
224+ }
218225 }
219226
220− if (serr && tss)
221− print_timestamp(tss, serr->ee_info, serr->ee_data, payload_len);
227+ if (batch > 1)
228+ fprintf(stderr, "batched %d timestamps\n", batch);
222229 }
223230
224231 static int recv_errmsg(int fd)
@@ -250,7 +257,7 @@ static int recv_errmsg(int fd) · 25 unmodified lines
250257 if (ret == -1 && errno != EAGAIN)
251258 error(1, errno, "recvmsg");
252259
253− if (ret > 0) {
260+ if (ret >= 0) {
254261 __recv_errmsg_cmsg(&msg, ret);
255262 if (cfg_show_payload)
256263 print_payload(data, cfg_payload_len);
@@ -315,6 +322,9 @@ static void do_test(int family, unsigned int opt) · 58 unmodified lines
315322 opt |= SOF_TIMESTAMPING_SOFTWARE |
316323 SOF_TIMESTAMPING_OPT_CMSG |
317324 SOF_TIMESTAMPING_OPT_ID;
325+ if (cfg_loop_nodata)
326+ opt |= SOF_TIMESTAMPING_OPT_TSONLY;
327+
318328 if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING,
319329 (char *) &opt, sizeof(opt)))
320330 error(1, 0, "setsockopt timestamping");
@@ -384,6 +394,7 @@ static void __attribute__((noreturn)) usage(const char *filepath) · 63 unmodified lines
384394 " -h: show this message\n"
385395 " -I: request PKTINFO\n"
386396 " -l N: send N bytes at a time\n"
397+ " -n: set no-payload option\n"
387398 " -r: use raw\n"
388399 " -R: use raw (IP_HDRINCL)\n"
389400 " -p N: connect to port N\n"
@@ -398,7 +409,7 @@ static void parse_opt(int argc, char **argv) · 8 unmodified lines
398409 int proto_count = 0;
399410 char c;
400411
401− while ((c = getopt(argc, argv, "46hIl:p:rRux")) != -1) {
412+ while ((c = getopt(argc, argv, "46hIl:np:rRux")) != -1) {
402413 switch (c) {
403414 case '4':
404415 do_ipv6 = 0;
@@ -409,6 +420,9 @@ static void parse_opt(int argc, char **argv) · 4 unmodified lines
409420 case 'I':
410421 cfg_do_pktinfo = true;
411422 break;
423+ case 'n':
424+ cfg_loop_nodata = true;
425+ break;
412426 case 'r':
413427 proto_count++;
414428 cfg_proto = SOCK_RAW;
Documentation/rfkill.txt+3−0
@@ -25,6 +25,9 @@ whether they can be changed or not: · 24 unmodified lines
2525 - soft block: writable radio block (need not be readable) that is set by
2626 the system software.
2727
28+The rfkill subsystem has two parameters, rfkill.default_state and
29+rfkill.master_switch_mode, which are documented in kernel-parameters.txt.
30+
2831
2932 2. Implementation details
3033
Documentation/sysctl/net.txt+8−0
@@ -97,6 +97,14 @@ rmem_max · 96 unmodified lines
9797
9898 The maximum receive socket buffer size in bytes.
9999
100+tstamp_allow_data
101+-----------------
102+Allow processes to receive tx timestamps looped together with the original
103+packet contents. If disabled, transmit timestamp requests from unprivileged
104+processes are dropped unless socket option SOF_TIMESTAMPING_OPT_TSONLY is set.
105+Default: 1 (on)
106+
107+
100108 wmem_default
101109 ------------
102110
MAINTAINERS+17−2
@@ -1661,7 +1661,6 @@ M: Jiri Slaby <jirislaby@gmail.com> · 1660 unmodified lines
16611661 M: Nick Kossifidis <mickflemm@gmail.com>
16621662 M: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
16631663 L: linux-wireless@vger.kernel.org
1664−L: ath5k-devel@lists.ath5k.org
16651664 W: http://wireless.kernel.org/en/users/Drivers/ath5k
16661665 S: Maintained
16671666 F: drivers/net/wireless/ath/ath5k/
@@ -6652,6 +6651,7 @@ F: include/linux/netdevice.h · 4984 unmodified lines
66526651 F: include/uapi/linux/in.h
66536652 F: include/uapi/linux/net.h
66546653 F: include/uapi/linux/netdevice.h
6654+F: include/uapi/linux/net_namespace.h
66556655 F: tools/net/
66566656 F: tools/testing/selftests/net/
66576657 F: lib/random32.c
@@ -7090,11 +7090,12 @@ F: arch/openrisc/ · 432 unmodified lines
70907090
70917091 OPENVSWITCH
70927092 M: Pravin Shelar <pshelar@nicira.com>
7093+L: netdev@vger.kernel.org
70937094 L: dev@openvswitch.org
70947095 W: http://openvswitch.org
7095−T: git git://git.kernel.org/pub/scm/linux/kernel/git/pshelar/openvswitch.git
70967096 S: Maintained
70977097 F: net/openvswitch/
7098+F: include/uapi/linux/openvswitch.h
70987099
70997100 OPL4 DRIVER
71007101 M: Clemens Ladisch <clemens@ladisch.de>
@@ -8097,6 +8098,13 @@ S: Maintained · 996 unmodified lines
80978098 F: Documentation/rfkill.txt
80988099 F: net/rfkill/
80998100
8101+RHASHTABLE
8102+M: Thomas Graf <tgraf@suug.ch>
8103+L: netdev@vger.kernel.org
8104+S: Maintained
8105+F: lib/rhashtable.c
8106+F: include/linux/rhashtable.h
8107+
81008108 RICOH SMARTMEDIA/XD DRIVER
81018109 M: Maxim Levitsky <maximlevitsky@gmail.com>
81028110 S: Maintained
@@ -9655,6 +9663,13 @@ F: drivers/power/lp8788-charger.c · 1552 unmodified lines
96559663 F: drivers/regulator/lp8788-*.c
96569664 F: include/linux/mfd/lp8788*.h
96579665
9666+TI NETCP ETHERNET DRIVER
9667+M: Wingman Kwok <w-kwok2@ti.com>
9668+M: Murali Karicheri <m-karicheri2@ti.com>
9669+L: netdev@vger.kernel.org
9670+S: Maintained
9671+F: drivers/net/ethernet/ti/netcp*
9672+
96589673 TI TWL4030 SERIES SOC CODEC DRIVER
96599674 M: Peter Ujfalusi <peter.ujfalusi@ti.com>
96609675 L: alsa-devel@alsa-project.org (moderated for non-subscribers)
arch/arm/boot/dts/am3517.dtsi+1−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 status = "disabled";
3232 reg = <0x5c000000 0x30000>;
3333 interrupts = <67 68 69 70>;
34+ syscon = <&omap3_scm_general>;
3435 ti,davinci-ctrl-reg-offset = <0x10000>;
3536 ti,davinci-ctrl-mod-reg-offset = <0>;
3637 ti,davinci-ctrl-ram-offset = <0x20000>;
arch/arm/boot/dts/rk3288-evb-rk808.dts+23−0
@@ -15,6 +15,13 @@ · 14 unmodified lines
1515
1616 / {
1717 compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288";
18+
19+ ext_gmac: external-gmac-clock {
20+ compatible = "fixed-clock";
21+ clock-frequency = <125000000>;
22+ clock-output-names = "ext_gmac";
23+ #clock-cells = <0>;
24+ };
1825 };
1926
2027 &cpu0 {
@@ -152,3 +159,19 @@ · 131 unmodified lines
152159 };
153160 };
154161 };
162+
163+&gmac {
164+ phy-supply = <&vcc_phy>;
165+ phy-mode = "rgmii";
166+ clock_in_out = "input";
167+ snps,reset-gpio = <&gpio4 7 0>;
168+ snps,reset-active-low;
169+ snps,reset-delays-us = <0 10000 1000000>;
170+ assigned-clocks = <&cru SCLK_MAC>;
171+ assigned-clock-parents = <&ext_gmac>;
172+ pinctrl-names = "default";
173+ pinctrl-0 = <&rgmii_pins>;
174+ tx_delay = <0x30>;
175+ rx_delay = <0x10>;
176+ status = "ok";
177+};
arch/arm/boot/dts/rk3288-evb.dtsi+19−0
@@ -90,6 +90,19 @@ · 89 unmodified lines
9090 regulator-always-on;
9191 regulator-boot-on;
9292 };
93+
94+ vcc_phy: vcc-phy-regulator {
95+ compatible = "regulator-fixed";
96+ enable-active-high;
97+ gpio = <&gpio0 6 GPIO_ACTIVE_HIGH>;
98+ pinctrl-names = "default";
99+ pinctrl-0 = <&eth_phy_pwr>;
100+ regulator-name = "vcc_phy";
101+ regulator-min-microvolt = <3300000>;
102+ regulator-max-microvolt = <3300000>;
103+ regulator-always-on;
104+ regulator-boot-on;
105+ };
93106 };
94107
95108 &emmc {
@@ -208,6 +221,12 @@ · 112 unmodified lines
208221 rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
209222 };
210223 };
224+
225+ eth_phy {
226+ eth_phy_pwr: eth-phy-pwr {
227+ rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
228+ };
229+ };
211230 };
212231
213232 &usb_host0_ehci {
arch/arm/boot/dts/rk3288.dtsi+54−0
@@ -380,6 +380,22 @@ · 379 unmodified lines
380380 status = "disabled";
381381 };
382382
383+ gmac: ethernet@ff290000 {
384+ compatible = "rockchip,rk3288-gmac";
385+ reg = <0xff290000 0x10000>;
386+ interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
387+ interrupt-names = "macirq";
388+ rockchip,grf = <&grf>;
389+ clocks = <&cru SCLK_MAC>,
390+ <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>,
391+ <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>,
392+ <&cru ACLK_GMAC>, <&cru PCLK_GMAC>;
393+ clock-names = "stmmaceth",
394+ "mac_clk_rx", "mac_clk_tx",
395+ "clk_mac_ref", "clk_mac_refout",
396+ "aclk_mac", "pclk_mac";
397+ };
398+
383399 usb_host0_ehci: usb@ff500000 {
384400 compatible = "generic-ehci";
385401 reg = <0xff500000 0x100>;
@@ -725,6 +741,11 @@ · 339 unmodified lines
725741 bias-disable;
726742 };
727743
744+ pcfg_pull_none_12ma: pcfg-pull-none-12ma {
745+ bias-disable;
746+ drive-strength = <12>;
747+ };
748+
728749 i2c0 {
729750 i2c0_xfer: i2c0-xfer {
730751 rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>,
@@ -1068,5 +1089,38 @@ · 337 unmodified lines
10681089 rockchip,pins = <7 23 3 &pcfg_pull_none>;
10691090 };
10701091 };
1092+
1093+ gmac {
1094+ rgmii_pins: rgmii-pins {
1095+ rockchip,pins = <3 30 3 &pcfg_pull_none>,
1096+ <3 31 3 &pcfg_pull_none>,
1097+ <3 26 3 &pcfg_pull_none>,
1098+ <3 27 3 &pcfg_pull_none>,
1099+ <3 28 3 &pcfg_pull_none_12ma>,
1100+ <3 29 3 &pcfg_pull_none_12ma>,
1101+ <3 24 3 &pcfg_pull_none_12ma>,
1102+ <3 25 3 &pcfg_pull_none_12ma>,
1103+ <4 0 3 &pcfg_pull_none>,
1104+ <4 5 3 &pcfg_pull_none>,
1105+ <4 6 3 &pcfg_pull_none>,
1106+ <4 9 3 &pcfg_pull_none_12ma>,
1107+ <4 4 3 &pcfg_pull_none_12ma>,
1108+ <4 1 3 &pcfg_pull_none>,
1109+ <4 3 3 &pcfg_pull_none>;
1110+ };
1111+
1112+ rmii_pins: rmii-pins {
1113+ rockchip,pins = <3 30 3 &pcfg_pull_none>,
1114+ <3 31 3 &pcfg_pull_none>,
1115+ <3 28 3 &pcfg_pull_none>,
1116+ <3 29 3 &pcfg_pull_none>,
1117+ <4 0 3 &pcfg_pull_none>,
1118+ <4 5 3 &pcfg_pull_none>,
1119+ <4 4 3 &pcfg_pull_none>,
1120+ <4 1 3 &pcfg_pull_none>,
1121+ <4 2 3 &pcfg_pull_none>,
1122+ <4 3 3 &pcfg_pull_none>;
1123+ };
1124+ };
10711125 };
10721126 };
arch/arm/boot/dts/stih407-family.dtsi+9−0
@@ -274,5 +274,14 @@ · 273 unmodified lines
274274
275275 status = "disabled";
276276 };
277+
278+ usb2_picophy0: phy1 {
279+ compatible = "st,stih407-usb2-phy";
280+ #phy-cells = <0>;
281+ st,syscfg = <&syscfg_core 0x100 0xf4>;
282+ resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
283+ <&picophyreset STIH407_PICOPHY0_RESET>;
284+ reset-names = "global", "port";
285+ };
277286 };
278287 };
arch/arm/boot/dts/stih410.dtsi+70−0
@@ -10,5 +10,75 @@ · 9 unmodified lines
1010 #include "stih407-family.dtsi"
1111 #include "stih410-pinctrl.dtsi"
1212 / {
13+ soc {
14+ usb2_picophy1: phy2 {
15+ compatible = "st,stih407-usb2-phy";
16+ #phy-cells = <0>;
17+ st,syscfg = <&syscfg_core 0xf8 0xf4>;
18+ resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
19+ <&picophyreset STIH407_PICOPHY0_RESET>;
20+ reset-names = "global", "port";
21+ };
1322
23+ usb2_picophy2: phy3 {
24+ compatible = "st,stih407-usb2-phy";
25+ #phy-cells = <0>;
26+ st,syscfg = <&syscfg_core 0xfc 0xf4>;
27+ resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
28+ <&picophyreset STIH407_PICOPHY1_RESET>;
29+ reset-names = "global", "port";
30+ };
31+
32+ ohci0: usb@9a03c00 {
33+ compatible = "st,st-ohci-300x";
34+ reg = <0x9a03c00 0x100>;
35+ interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>;
36+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
37+ resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
38+ <&softreset STIH407_USB2_PORT0_SOFTRESET>;
39+ reset-names = "power", "softreset";
40+ phys = <&usb2_picophy1>;
41+ phy-names = "usb";
42+ };
43+
44+ ehci0: usb@9a03e00 {
45+ compatible = "st,st-ehci-300x";
46+ reg = <0x9a03e00 0x100>;
47+ interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
48+ pinctrl-names = "default";
49+ pinctrl-0 = <&pinctrl_usb0>;
50+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
51+ resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
52+ <&softreset STIH407_USB2_PORT0_SOFTRESET>;
53+ reset-names = "power", "softreset";
54+ phys = <&usb2_picophy1>;
55+ phy-names = "usb";
56+ };
57+
58+ ohci1: usb@9a83c00 {
59+ compatible = "st,st-ohci-300x";
60+ reg = <0x9a83c00 0x100>;
61+ interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>;
62+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
63+ resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
64+ <&softreset STIH407_USB2_PORT1_SOFTRESET>;
65+ reset-names = "power", "softreset";
66+ phys = <&usb2_picophy2>;
67+ phy-names = "usb";
68+ };
69+
70+ ehci1: usb@9a83e00 {
71+ compatible = "st,st-ehci-300x";
72+ reg = <0x9a83e00 0x100>;
73+ interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
74+ pinctrl-names = "default";
75+ pinctrl-0 = <&pinctrl_usb1>;
76+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
77+ resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
78+ <&softreset STIH407_USB2_PORT1_SOFTRESET>;
79+ reset-names = "power", "softreset";
80+ phys = <&usb2_picophy2>;
81+ phy-names = "usb";
82+ };
83+ };
1484 };
arch/arm/boot/dts/stih415.dtsi+6−6
@@ -153,8 +153,8 @@ · 152 unmodified lines
153153 compatible = "st,stih415-dwmac", "snps,dwmac", "snps,dwmac-3.610";
154154 status = "disabled";
155155
156− reg = <0xfe810000 0x8000>, <0x148 0x4>;
157− reg-names = "stmmaceth", "sti-ethconf";
156+ reg = <0xfe810000 0x8000>;
157+ reg-names = "stmmaceth";
158158
159159 interrupts = <0 147 0>, <0 148 0>, <0 149 0>;
160160 interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
@@ -165,7 +165,7 @@ · 4 unmodified lines
165165 snps,mixed-burst;
166166 snps,force_sf_dma_mode;
167167
168− st,syscon = <&syscfg_rear>;
168+ st,syscon = <&syscfg_rear 0x148>;
169169
170170 pinctrl-names = "default";
171171 pinctrl-0 = <&pinctrl_mii0>;
@@ -177,8 +177,8 @@ · 5 unmodified lines
177177 device_type = "network";
178178 compatible = "st,stih415-dwmac", "snps,dwmac", "snps,dwmac-3.610";
179179 status = "disabled";
180− reg = <0xfef08000 0x8000>, <0x74 0x4>;
181− reg-names = "stmmaceth", "sti-ethconf";
180+ reg = <0xfef08000 0x8000>;
181+ reg-names = "stmmaceth";
182182 interrupts = <0 150 0>, <0 151 0>, <0 152 0>;
183183 interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
184184
@@ -186,7 +186,7 @@ · 1 unmodified line
186186 snps,mixed-burst;
187187 snps,force_sf_dma_mode;
188188
189− st,syscon = <&syscfg_sbc>;
189+ st,syscon = <&syscfg_sbc 0x74>;
190190
191191 resets = <&softreset STIH415_ETH1_SOFTRESET>;
192192 reset-names = "stmmaceth";
arch/arm/boot/dts/stih416.dtsi+11−11
@@ -163,8 +163,8 @@ · 162 unmodified lines
163163 device_type = "network";
164164 compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710";
165165 status = "disabled";
166− reg = <0xfe810000 0x8000>, <0x8bc 0x4>;
167− reg-names = "stmmaceth", "sti-ethconf";
166+ reg = <0xfe810000 0x8000>;
167+ reg-names = "stmmaceth";
168168
169169 interrupts = <0 133 0>, <0 134 0>, <0 135 0>;
170170 interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
@@ -172,7 +172,7 @@ · 1 unmodified line
172172 snps,pbl = <32>;
173173 snps,mixed-burst;
174174
175− st,syscon = <&syscfg_rear>;
175+ st,syscon = <&syscfg_rear 0x8bc>;
176176 resets = <&softreset STIH416_ETH0_SOFTRESET>;
177177 reset-names = "stmmaceth";
178178 pinctrl-names = "default";
@@ -185,15 +185,15 @@ · 6 unmodified lines
185185 device_type = "network";
186186 compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710";
187187 status = "disabled";
188− reg = <0xfef08000 0x8000>, <0x7f0 0x4>;
189− reg-names = "stmmaceth", "sti-ethconf";
188+ reg = <0xfef08000 0x8000>;
189+ reg-names = "stmmaceth";
190190 interrupts = <0 136 0>, <0 137 0>, <0 138 0>;
191191 interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
192192
193193 snps,pbl = <32>;
194194 snps,mixed-burst;
195195
196− st,syscon = <&syscfg_sbc>;
196+ st,syscon = <&syscfg_sbc 0x7f0>;
197197
198198 resets = <&softreset STIH416_ETH1_SOFTRESET>;
199199 reset-names = "stmmaceth";
@@ -283,21 +283,21 @@ · 83 unmodified lines
283283
284284 miphy365x_phy: phy@fe382000 {
285285 compatible = "st,miphy365x-phy";
286− st,syscfg = <&syscfg_rear>;
286+ st,syscfg = <&syscfg_rear 0x824 0x828>;
287287 #address-cells = <1>;
288288 #size-cells = <1>;
289289 ranges;
290290
291291 phy_port0: port@fe382000 {
292292 #phy-cells = <1>;
293− reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>;
294− reg-names = "sata", "pcie", "syscfg";
293+ reg = <0xfe382000 0x100>, <0xfe394000 0x100>;
294+ reg-names = "sata", "pcie";
295295 };
296296
297297 phy_port1: port@fe38a000 {
298298 #phy-cells = <1>;
299− reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>;
300− reg-names = "sata", "pcie", "syscfg";
299+ reg = <0xfe38a000 0x100>, <0xfe804000 0x100>;
300+ reg-names = "sata", "pcie";
301301 };
302302 };
303303
arch/arm/configs/multi_v7_defconfig+1−0
@@ -456,6 +456,7 @@ CONFIG_OMAP_USB2=y · 455 unmodified lines
456456 CONFIG_TI_PIPE3=y
457457 CONFIG_PHY_MIPHY365X=y
458458 CONFIG_PHY_STIH41X_USB=y
459+CONFIG_PHY_STIH407_USB=y
459460 CONFIG_PHY_SUN4I_USB=y
460461 CONFIG_EXT4_FS=y
461462 CONFIG_AUTOFS4_FS=y
arch/arm/mach-sa1100/assabet.c+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737
3838 #include <asm/mach/arch.h>
3939 #include <asm/mach/flash.h>
40−#include <asm/mach/irda.h>
40+#include <linux/platform_data/irda-sa11x0.h>
4141 #include <asm/mach/map.h>
4242 #include <mach/assabet.h>
4343 #include <linux/platform_data/mfd-mcp-sa11x0.h>
arch/arm/mach-sa1100/collie.c+1−1
@@ -43,7 +43,7 @@ · 42 unmodified lines
4343 #include <asm/mach/arch.h>
4444 #include <asm/mach/flash.h>
4545 #include <asm/mach/map.h>
46−#include <asm/mach/irda.h>
46+#include <linux/platform_data/irda-sa11x0.h>
4747
4848 #include <asm/hardware/scoop.h>
4949 #include <asm/mach/sharpsl_param.h>
arch/arm/mach-sa1100/h3100.c+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818
1919 #include <asm/mach-types.h>
2020 #include <asm/mach/arch.h>
21−#include <asm/mach/irda.h>
21+#include <linux/platform_data/irda-sa11x0.h>
2222
2323 #include <mach/h3xxx.h>
2424 #include <mach/irqs.h>
arch/arm/mach-sa1100/h3600.c+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818
1919 #include <asm/mach-types.h>
2020 #include <asm/mach/arch.h>
21−#include <asm/mach/irda.h>
21+#include <linux/platform_data/irda-sa11x0.h>
2222
2323 #include <mach/h3xxx.h>
2424 #include <mach/irqs.h>
arch/microblaze/kernel/timer.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/clockchips.h>
1818 #include <linux/of_address.h>
1919 #include <linux/of_irq.h>
20+#include <linux/timecounter.h>
2021 #include <asm/cpuinfo.h>
2122
2223 static void __iomem *timer_baseaddr;
crypto/af_alg.c+11−29
@@ -338,49 +338,31 @@ static const struct net_proto_family alg_family = { · 337 unmodified lines
338338 .owner = THIS_MODULE,
339339 };
340340
341−int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len,
342− int write)
341+int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
343342 {
344− unsigned long from = (unsigned long)addr;
345− unsigned long npages;
346− unsigned off;
347− int err;
348− int i;
349−
350− err = -EFAULT;
351− if (!access_ok(write ? VERIFY_READ : VERIFY_WRITE, addr, len))
352− goto out;
353−
354− off = from & ~PAGE_MASK;
355− npages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
356− if (npages > ALG_MAX_PAGES)
357− npages = ALG_MAX_PAGES;
343+ size_t off;
344+ ssize_t n;
345+ int npages, i;
358346
359− err = get_user_pages_fast(from, npages, write, sgl->pages);
360− if (err < 0)
361− goto out;
347+ n = iov_iter_get_pages(iter, sgl->pages, len, ALG_MAX_PAGES, &off);
348+ if (n < 0)
349+ return n;
362350
363− npages = err;
364− err = -EINVAL;
351+ npages = (off + n + PAGE_SIZE - 1) >> PAGE_SHIFT;
365352 if (WARN_ON(npages == 0))
366− goto out;
367−
368− err = 0;
353+ return -EINVAL;
369354
370355 sg_init_table(sgl->sg, npages);
371356
372− for (i = 0; i < npages; i++) {
357+ for (i = 0, len = n; i < npages; i++) {
373358 int plen = min_t(int, len, PAGE_SIZE - off);
374359
375360 sg_set_page(sgl->sg + i, sgl->pages[i], plen, off);
376361
377362 off = 0;
378363 len -= plen;
379− err += plen;
380364 }
381−
382−out:
383− return err;
365+ return n;
384366 }
385367 EXPORT_SYMBOL_GPL(af_alg_make_sg);
386368
crypto/algif_hash.c+17−28
@@ -41,8 +41,6 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock, · 40 unmodified lines
4141 struct sock *sk = sock->sk;
4242 struct alg_sock *ask = alg_sk(sk);
4343 struct hash_ctx *ctx = ask->private;
44− unsigned long iovlen;
45− const struct iovec *iov;
4644 long copied = 0;
4745 int err;
4846
@@ -58,37 +56,28 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock, · 9 unmodified lines
5856
5957 ctx->more = 0;
6058
61− for (iov = msg->msg_iter.iov, iovlen = msg->msg_iter.nr_segs; iovlen > 0;
62− iovlen--, iov++) {
63− unsigned long seglen = iov->iov_len;
64− char __user *from = iov->iov_base;
59+ while (iov_iter_count(&msg->msg_iter)) {
60+ int len = iov_iter_count(&msg->msg_iter);
6561
66− while (seglen) {
67− int len = min_t(unsigned long, seglen, limit);
68− int newlen;
62+ if (len > limit)
63+ len = limit;
6964
70− newlen = af_alg_make_sg(&ctx->sgl, from, len, 0);
71− if (newlen < 0) {
72− err = copied ? 0 : newlen;
73− goto unlock;
74− }
75−
76− ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL,
77− newlen);
78−
79− err = af_alg_wait_for_completion(
80− crypto_ahash_update(&ctx->req),
81− &ctx->completion);
65+ len = af_alg_make_sg(&ctx->sgl, &msg->msg_iter, len);
66+ if (len < 0) {
67+ err = copied ? 0 : len;
68+ goto unlock;
69+ }
8270
83− af_alg_free_sg(&ctx->sgl);
71+ ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len);
8472
85− if (err)
86− goto unlock;
73+ err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req),
74+ &ctx->completion);
75+ af_alg_free_sg(&ctx->sgl);
76+ if (err)
77+ goto unlock;
8778
88− seglen -= newlen;
89− from += newlen;
90− copied += newlen;
91− }
79+ copied += len;
80+ iov_iter_advance(&msg->msg_iter, len);
9281 }
9382
9483 err = 0;
crypto/algif_skcipher.c+32−41
@@ -426,67 +426,58 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock, · 425 unmodified lines
426426 &ctx->req));
427427 struct skcipher_sg_list *sgl;
428428 struct scatterlist *sg;
429− unsigned long iovlen;
430− const struct iovec *iov;
431429 int err = -EAGAIN;
432430 int used;
433431 long copied = 0;
434432
435433 lock_sock(sk);
436− for (iov = msg->msg_iter.iov, iovlen = msg->msg_iter.nr_segs; iovlen > 0;
437− iovlen--, iov++) {
438− unsigned long seglen = iov->iov_len;
439− char __user *from = iov->iov_base;
440−
441− while (seglen) {
442− sgl = list_first_entry(&ctx->tsgl,
443− struct skcipher_sg_list, list);
444− sg = sgl->sg;
445−
446− while (!sg->length)
447− sg++;
448−
449− if (!ctx->used) {
450− err = skcipher_wait_for_data(sk, flags);
451− if (err)
452− goto unlock;
453− }
434+ while (iov_iter_count(&msg->msg_iter)) {
435+ sgl = list_first_entry(&ctx->tsgl,
436+ struct skcipher_sg_list, list);
437+ sg = sgl->sg;
454438
455− used = min_t(unsigned long, ctx->used, seglen);
439+ while (!sg->length)
440+ sg++;
456441
457− used = af_alg_make_sg(&ctx->rsgl, from, used, 1);
458− err = used;
459− if (err < 0)
442+ if (!ctx->used) {
443+ err = skcipher_wait_for_data(sk, flags);
444+ if (err)
460445 goto unlock;
446+ }
447+
448+ used = min_t(unsigned long, ctx->used, iov_iter_count(&msg->msg_iter));
449+
450+ used = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, used);
451+ err = used;
452+ if (err < 0)
453+ goto unlock;
461454
462− if (ctx->more || used < ctx->used)
463− used -= used % bs;
455+ if (ctx->more || used < ctx->used)
456+ used -= used % bs;
464457
465− err = -EINVAL;
466− if (!used)
467− goto free;
458+ err = -EINVAL;
459+ if (!used)
460+ goto free;
468461
469− ablkcipher_request_set_crypt(&ctx->req, sg,
470− ctx->rsgl.sg, used,
471− ctx->iv);
462+ ablkcipher_request_set_crypt(&ctx->req, sg,
463+ ctx->rsgl.sg, used,
464+ ctx->iv);
472465
473− err = af_alg_wait_for_completion(
466+ err = af_alg_wait_for_completion(
474467 ctx->enc ?
475468 crypto_ablkcipher_encrypt(&ctx->req) :
476469 crypto_ablkcipher_decrypt(&ctx->req),
477470 &ctx->completion);
478471
479472 free:
480− af_alg_free_sg(&ctx->rsgl);
473+ af_alg_free_sg(&ctx->rsgl);
481474
482− if (err)
483− goto unlock;
475+ if (err)
476+ goto unlock;
484477
485− copied += used;
486− from += used;
487− seglen -= used;
488− skcipher_pull_sgl(sk, used);
489− }
478+ copied += used;
479+ skcipher_pull_sgl(sk, used);
480+ iov_iter_advance(&msg->msg_iter, used);
490481 }
491482
492483 err = 0;
drivers/acpi/event.c+1−6
@@ -100,7 +100,6 @@ int acpi_bus_generate_netlink_event(const char *device_class, · 99 unmodified lines
100100 struct acpi_genl_event *event;
101101 void *msg_header;
102102 int size;
103− int result;
104103
105104 /* allocate memory */
106105 size = nla_total_size(sizeof(struct acpi_genl_event)) +
@@ -137,11 +136,7 @@ int acpi_bus_generate_netlink_event(const char *device_class, · 30 unmodified lines
137136 event->data = data;
138137
139138 /* send multicast genetlink message */
140− result = genlmsg_end(skb, msg_header);
141− if (result < 0) {
142− nlmsg_free(skb);
143− return result;
144− }
139+ genlmsg_end(skb, msg_header);
145140
146141 genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC);
147142 return 0;
drivers/atm/eni.c+19−14
@@ -354,9 +354,9 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, · 353 unmodified lines
354354 eni_vcc = ENI_VCC(vcc);
355355 paddr = 0; /* GCC, shut up */
356356 if (skb) {
357− paddr = pci_map_single(eni_dev->pci_dev,skb->data,skb->len,
358− PCI_DMA_FROMDEVICE);
359− if (pci_dma_mapping_error(eni_dev->pci_dev, paddr))
357+ paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len,
358+ DMA_FROM_DEVICE);
359+ if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr))
360360 goto dma_map_error;
361361 ENI_PRV_PADDR(skb) = paddr;
362362 if (paddr & 3)
@@ -481,8 +481,8 @@ rx_enqueued++; · 118 unmodified lines
481481
482482 trouble:
483483 if (paddr)
484− pci_unmap_single(eni_dev->pci_dev,paddr,skb->len,
485− PCI_DMA_FROMDEVICE);
484+ dma_unmap_single(&eni_dev->pci_dev->dev,paddr,skb->len,
485+ DMA_FROM_DEVICE);
486486 dma_map_error:
487487 if (skb) dev_kfree_skb_irq(skb);
488488 return -1;
@@ -758,8 +758,8 @@ rx_dequeued++; · 269 unmodified lines
758758 }
759759 eni_vcc->rxing--;
760760 eni_vcc->rx_pos = ENI_PRV_POS(skb) & (eni_vcc->words-1);
761− pci_unmap_single(eni_dev->pci_dev,ENI_PRV_PADDR(skb),skb->len,
762− PCI_DMA_TODEVICE);
761+ dma_unmap_single(&eni_dev->pci_dev->dev,ENI_PRV_PADDR(skb),skb->len,
762+ DMA_TO_DEVICE);
763763 if (!skb->len) dev_kfree_skb_irq(skb);
764764 else {
765765 EVENT("pushing (len=%ld)\n",skb->len,0);
@@ -1112,8 +1112,8 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags); · 346 unmodified lines
11121112 vcc->dev->number);
11131113 return enq_jam;
11141114 }
1115− paddr = pci_map_single(eni_dev->pci_dev,skb->data,skb->len,
1116− PCI_DMA_TODEVICE);
1115+ paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len,
1116+ DMA_TO_DEVICE);
11171117 ENI_PRV_PADDR(skb) = paddr;
11181118 /* prepare DMA queue entries */
11191119 j = 0;
@@ -1226,8 +1226,8 @@ static void dequeue_tx(struct atm_dev *dev) · 106 unmodified lines
12261226 break;
12271227 }
12281228 ENI_VCC(vcc)->txing -= ENI_PRV_SIZE(skb);
1229− pci_unmap_single(eni_dev->pci_dev,ENI_PRV_PADDR(skb),skb->len,
1230− PCI_DMA_TODEVICE);
1229+ dma_unmap_single(&eni_dev->pci_dev->dev,ENI_PRV_PADDR(skb),skb->len,
1230+ DMA_TO_DEVICE);
12311231 if (vcc->pop) vcc->pop(vcc,skb);
12321232 else dev_kfree_skb_irq(skb);
12331233 atomic_inc(&vcc->stats->tx);
@@ -2240,13 +2240,18 @@ static int eni_init_one(struct pci_dev *pci_dev, · 1006 unmodified lines
22402240 if (rc < 0)
22412241 goto out;
22422242
2243+ rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
2244+ if (rc < 0)
2245+ goto out;
2246+
22432247 rc = -ENOMEM;
22442248 eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL);
22452249 if (!eni_dev)
22462250 goto err_disable;
22472251
22482252 zero = &eni_dev->zero;
2249− zero->addr = pci_alloc_consistent(pci_dev, ENI_ZEROES_SIZE, &zero->dma);
2253+ zero->addr = dma_alloc_coherent(&pci_dev->dev,
2254+ ENI_ZEROES_SIZE, &zero->dma, GFP_KERNEL);
22502255 if (!zero->addr)
22512256 goto err_kfree;
22522257
@@ -2277,7 +2282,7 @@ err_eni_release: · 24 unmodified lines
22772282 err_unregister:
22782283 atm_dev_deregister(dev);
22792284 err_free_consistent:
2280− pci_free_consistent(pci_dev, ENI_ZEROES_SIZE, zero->addr, zero->dma);
2285+ dma_free_coherent(&pci_dev->dev, ENI_ZEROES_SIZE, zero->addr, zero->dma);
22812286 err_kfree:
22822287 kfree(eni_dev);
22832288 err_disable:
@@ -2302,7 +2307,7 @@ static void eni_remove_one(struct pci_dev *pdev) · 18 unmodified lines
23022307
23032308 eni_do_release(dev);
23042309 atm_dev_deregister(dev);
2305− pci_free_consistent(pdev, ENI_ZEROES_SIZE, zero->addr, zero->dma);
2310+ dma_free_coherent(&pdev->dev, ENI_ZEROES_SIZE, zero->addr, zero->dma);
23062311 kfree(ed);
23072312 pci_disable_device(pdev);
23082313 }
drivers/atm/fore200e.c+14−8
@@ -425,7 +425,7 @@ static void fore200e_pca_write(u32 val, volatile u32 __iomem *addr) · 424 unmodified lines
425425 static u32
426426 fore200e_pca_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction)
427427 {
428− u32 dma_addr = pci_map_single((struct pci_dev*)fore200e->bus_dev, virt_addr, size, direction);
428+ u32 dma_addr = dma_map_single(&((struct pci_dev *) fore200e->bus_dev)->dev, virt_addr, size, direction);
429429
430430 DPRINTK(3, "PCI DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d, --> dma_addr = 0x%08x\n",
431431 virt_addr, size, direction, dma_addr);
@@ -440,7 +440,7 @@ fore200e_pca_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int di · 8 unmodified lines
440440 DPRINTK(3, "PCI DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d\n",
441441 dma_addr, size, direction);
442442
443− pci_unmap_single((struct pci_dev*)fore200e->bus_dev, dma_addr, size, direction);
443+ dma_unmap_single(&((struct pci_dev *) fore200e->bus_dev)->dev, dma_addr, size, direction);
444444 }
445445
446446
@@ -449,7 +449,7 @@ fore200e_pca_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size, · 2 unmodified lines
449449 {
450450 DPRINTK(3, "PCI DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);
451451
452− pci_dma_sync_single_for_cpu((struct pci_dev*)fore200e->bus_dev, dma_addr, size, direction);
452+ dma_sync_single_for_cpu(&((struct pci_dev *) fore200e->bus_dev)->dev, dma_addr, size, direction);
453453 }
454454
455455 static void
@@ -457,7 +457,7 @@ fore200e_pca_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int si · 1 unmodified line
457457 {
458458 DPRINTK(3, "PCI DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);
459459
460− pci_dma_sync_single_for_device((struct pci_dev*)fore200e->bus_dev, dma_addr, size, direction);
460+ dma_sync_single_for_device(&((struct pci_dev *) fore200e->bus_dev)->dev, dma_addr, size, direction);
461461 }
462462
463463
@@ -470,9 +470,10 @@ fore200e_pca_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, · 6 unmodified lines
470470 {
471471 /* returned chunks are page-aligned */
472472 chunk->alloc_size = size * nbr;
473− chunk->alloc_addr = pci_alloc_consistent((struct pci_dev*)fore200e->bus_dev,
474− chunk->alloc_size,
475− &chunk->dma_addr);
473+ chunk->alloc_addr = dma_alloc_coherent(&((struct pci_dev *) fore200e->bus_dev)->dev,
474+ chunk->alloc_size,
475+ &chunk->dma_addr,
476+ GFP_KERNEL);
476477
477478 if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0))
478479 return -ENOMEM;
@@ -488,7 +489,7 @@ fore200e_pca_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, · 9 unmodified lines
488489 static void
489490 fore200e_pca_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk)
490491 {
491− pci_free_consistent((struct pci_dev*)fore200e->bus_dev,
492+ dma_free_coherent(&((struct pci_dev *) fore200e->bus_dev)->dev,
492493 chunk->alloc_size,
493494 chunk->alloc_addr,
494495 chunk->dma_addr);
@@ -2707,6 +2708,11 @@ static int fore200e_pca_detect(struct pci_dev *pci_dev, · 2212 unmodified lines
27072708 err = -EINVAL;
27082709 goto out;
27092710 }
2711+
2712+ if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32))) {
2713+ err = -EINVAL;
2714+ goto out;
2715+ }
27102716
27112717 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL);
27122718 if (fore200e == NULL) {
drivers/atm/he.c+64−61
@@ -359,7 +359,7 @@ static int he_init_one(struct pci_dev *pci_dev, · 358 unmodified lines
359359
360360 if (pci_enable_device(pci_dev))
361361 return -EIO;
362− if (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)) != 0) {
362+ if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)) != 0) {
363363 printk(KERN_WARNING "he: no suitable dma available\n");
364364 err = -EIO;
365365 goto init_one_failure;
@@ -533,9 +533,9 @@ static void he_init_tx_lbfp(struct he_dev *he_dev) · 167 unmodified lines
533533
534534 static int he_init_tpdrq(struct he_dev *he_dev)
535535 {
536− he_dev->tpdrq_base = pci_zalloc_consistent(he_dev->pci_dev,
537− CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
538− &he_dev->tpdrq_phys);
536+ he_dev->tpdrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
537+ CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
538+ &he_dev->tpdrq_phys, GFP_KERNEL);
539539 if (he_dev->tpdrq_base == NULL) {
540540 hprintk("failed to alloc tpdrq\n");
541541 return -ENOMEM;
@@ -796,16 +796,16 @@ static int he_init_group(struct he_dev *he_dev, int group) · 254 unmodified lines
796796 }
797797
798798 /* large buffer pool */
799− he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev,
799+ he_dev->rbpl_pool = dma_pool_create("rbpl", &he_dev->pci_dev->dev,
800800 CONFIG_RBPL_BUFSIZE, 64, 0);
801801 if (he_dev->rbpl_pool == NULL) {
802802 hprintk("unable to create rbpl pool\n");
803803 goto out_free_rbpl_virt;
804804 }
805805
806− he_dev->rbpl_base = pci_zalloc_consistent(he_dev->pci_dev,
807− CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
808− &he_dev->rbpl_phys);
806+ he_dev->rbpl_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
807+ CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
808+ &he_dev->rbpl_phys, GFP_KERNEL);
809809 if (he_dev->rbpl_base == NULL) {
810810 hprintk("failed to alloc rbpl_base\n");
811811 goto out_destroy_rbpl_pool;
@@ -815,7 +815,7 @@ static int he_init_group(struct he_dev *he_dev, int group) · 3 unmodified lines
815815
816816 for (i = 0; i < CONFIG_RBPL_SIZE; ++i) {
817817
818− heb = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &mapping);
818+ heb = dma_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL, &mapping);
819819 if (!heb)
820820 goto out_free_rbpl;
821821 heb->mapping = mapping;
@@ -842,9 +842,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 20 unmodified lines
842842
843843 /* rx buffer ready queue */
844844
845− he_dev->rbrq_base = pci_zalloc_consistent(he_dev->pci_dev,
846− CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
847− &he_dev->rbrq_phys);
845+ he_dev->rbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
846+ CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
847+ &he_dev->rbrq_phys, GFP_KERNEL);
848848 if (he_dev->rbrq_base == NULL) {
849849 hprintk("failed to allocate rbrq\n");
850850 goto out_free_rbpl;
@@ -866,9 +866,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 15 unmodified lines
866866
867867 /* tx buffer ready queue */
868868
869− he_dev->tbrq_base = pci_zalloc_consistent(he_dev->pci_dev,
870− CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
871− &he_dev->tbrq_phys);
869+ he_dev->tbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
870+ CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
871+ &he_dev->tbrq_phys, GFP_KERNEL);
872872 if (he_dev->tbrq_base == NULL) {
873873 hprintk("failed to allocate tbrq\n");
874874 goto out_free_rbpq_base;
@@ -884,18 +884,18 @@ static int he_init_group(struct he_dev *he_dev, int group) · 9 unmodified lines
884884 return 0;
885885
886886 out_free_rbpq_base:
887− pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE *
888− sizeof(struct he_rbrq), he_dev->rbrq_base,
889− he_dev->rbrq_phys);
887+ dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBRQ_SIZE *
888+ sizeof(struct he_rbrq), he_dev->rbrq_base,
889+ he_dev->rbrq_phys);
890890 out_free_rbpl:
891891 list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry)
892− pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
892+ dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
893893
894− pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE *
895− sizeof(struct he_rbp), he_dev->rbpl_base,
896− he_dev->rbpl_phys);
894+ dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBPL_SIZE *
895+ sizeof(struct he_rbp), he_dev->rbpl_base,
896+ he_dev->rbpl_phys);
897897 out_destroy_rbpl_pool:
898− pci_pool_destroy(he_dev->rbpl_pool);
898+ dma_pool_destroy(he_dev->rbpl_pool);
899899 out_free_rbpl_virt:
900900 kfree(he_dev->rbpl_virt);
901901 out_free_rbpl_table:
@@ -911,8 +911,11 @@ static int he_init_irq(struct he_dev *he_dev) · 9 unmodified lines
911911 /* 2.9.3.5 tail offset for each interrupt queue is located after the
912912 end of the interrupt queue */
913913
914− he_dev->irq_base = pci_alloc_consistent(he_dev->pci_dev,
915− (CONFIG_IRQ_SIZE+1) * sizeof(struct he_irq), &he_dev->irq_phys);
914+ he_dev->irq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
915+ (CONFIG_IRQ_SIZE + 1)
916+ * sizeof(struct he_irq),
917+ &he_dev->irq_phys,
918+ GFP_KERNEL);
916919 if (he_dev->irq_base == NULL) {
917920 hprintk("failed to allocate irq\n");
918921 return -ENOMEM;
@@ -1419,10 +1422,10 @@ static int he_start(struct atm_dev *dev) · 500 unmodified lines
14191422
14201423 he_init_tpdrq(he_dev);
14211424
1422− he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev,
1423− sizeof(struct he_tpd), TPD_ALIGNMENT, 0);
1425+ he_dev->tpd_pool = dma_pool_create("tpd", &he_dev->pci_dev->dev,
1426+ sizeof(struct he_tpd), TPD_ALIGNMENT, 0);
14241427 if (he_dev->tpd_pool == NULL) {
1425− hprintk("unable to create tpd pci_pool\n");
1428+ hprintk("unable to create tpd dma_pool\n");
14261429 return -ENOMEM;
14271430 }
14281431
@@ -1459,9 +1462,9 @@ static int he_start(struct atm_dev *dev) · 30 unmodified lines
14591462
14601463 /* host status page */
14611464
1462− he_dev->hsp = pci_zalloc_consistent(he_dev->pci_dev,
1463− sizeof(struct he_hsp),
1464− &he_dev->hsp_phys);
1465+ he_dev->hsp = dma_zalloc_coherent(&he_dev->pci_dev->dev,
1466+ sizeof(struct he_hsp),
1467+ &he_dev->hsp_phys, GFP_KERNEL);
14651468 if (he_dev->hsp == NULL) {
14661469 hprintk("failed to allocate host status page\n");
14671470 return -ENOMEM;
@@ -1558,41 +1561,41 @@ he_stop(struct he_dev *he_dev) · 90 unmodified lines
15581561 free_irq(he_dev->irq, he_dev);
15591562
15601563 if (he_dev->irq_base)
1561− pci_free_consistent(he_dev->pci_dev, (CONFIG_IRQ_SIZE+1)
1562− * sizeof(struct he_irq), he_dev->irq_base, he_dev->irq_phys);
1564+ dma_free_coherent(&he_dev->pci_dev->dev, (CONFIG_IRQ_SIZE + 1)
1565+ * sizeof(struct he_irq), he_dev->irq_base, he_dev->irq_phys);
15631566
15641567 if (he_dev->hsp)
1565− pci_free_consistent(he_dev->pci_dev, sizeof(struct he_hsp),
1566− he_dev->hsp, he_dev->hsp_phys);
1568+ dma_free_coherent(&he_dev->pci_dev->dev, sizeof(struct he_hsp),
1569+ he_dev->hsp, he_dev->hsp_phys);
15671570
15681571 if (he_dev->rbpl_base) {
15691572 list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry)
1570− pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
1573+ dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
15711574
1572− pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE
1573− * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys);
1575+ dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBPL_SIZE
1576+ * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys);
15741577 }
15751578
15761579 kfree(he_dev->rbpl_virt);
15771580 kfree(he_dev->rbpl_table);
15781581
15791582 if (he_dev->rbpl_pool)
1580− pci_pool_destroy(he_dev->rbpl_pool);
1583+ dma_pool_destroy(he_dev->rbpl_pool);
15811584
15821585 if (he_dev->rbrq_base)
1583− pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
1584− he_dev->rbrq_base, he_dev->rbrq_phys);
1586+ dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
1587+ he_dev->rbrq_base, he_dev->rbrq_phys);
15851588
15861589 if (he_dev->tbrq_base)
1587− pci_free_consistent(he_dev->pci_dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
1588− he_dev->tbrq_base, he_dev->tbrq_phys);
1590+ dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
1591+ he_dev->tbrq_base, he_dev->tbrq_phys);
15891592
15901593 if (he_dev->tpdrq_base)
1591− pci_free_consistent(he_dev->pci_dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
1592− he_dev->tpdrq_base, he_dev->tpdrq_phys);
1594+ dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
1595+ he_dev->tpdrq_base, he_dev->tpdrq_phys);
15931596
15941597 if (he_dev->tpd_pool)
1595− pci_pool_destroy(he_dev->tpd_pool);
1598+ dma_pool_destroy(he_dev->tpd_pool);
15961599
15971600 if (he_dev->pci_dev) {
15981601 pci_read_config_word(he_dev->pci_dev, PCI_COMMAND, &command);
@@ -1610,7 +1613,7 @@ __alloc_tpd(struct he_dev *he_dev) · 11 unmodified lines
16101613 struct he_tpd *tpd;
16111614 dma_addr_t mapping;
16121615
1613− tpd = pci_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC|GFP_DMA, &mapping);
1616+ tpd = dma_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC, &mapping);
16141617 if (tpd == NULL)
16151618 return NULL;
16161619
@@ -1681,7 +1684,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) · 64 unmodified lines
16811684 if (!RBRQ_HBUF_ERR(he_dev->rbrq_head)) {
16821685 clear_bit(i, he_dev->rbpl_table);
16831686 list_del(&heb->entry);
1684− pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
1687+ dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
16851688 }
16861689
16871690 goto next_rbrq_entry;
@@ -1774,7 +1777,7 @@ return_host_buffers: · 86 unmodified lines
17741777 ++pdus_assembled;
17751778
17761779 list_for_each_entry_safe(heb, next, &he_vcc->buffers, entry)
1777− pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
1780+ dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
17781781 INIT_LIST_HEAD(&he_vcc->buffers);
17791782 he_vcc->pdu_len = 0;
17801783
@@ -1843,10 +1846,10 @@ he_service_tbrq(struct he_dev *he_dev, int group) · 62 unmodified lines
18431846
18441847 for (slot = 0; slot < TPD_MAXIOV; ++slot) {
18451848 if (tpd->iovec[slot].addr)
1846− pci_unmap_single(he_dev->pci_dev,
1849+ dma_unmap_single(&he_dev->pci_dev->dev,
18471850 tpd->iovec[slot].addr,
18481851 tpd->iovec[slot].len & TPD_LEN_MASK,
1849− PCI_DMA_TODEVICE);
1852+ DMA_TO_DEVICE);
18501853 if (tpd->iovec[slot].len & TPD_LST)
18511854 break;
18521855
@@ -1861,7 +1864,7 @@ he_service_tbrq(struct he_dev *he_dev, int group) · 8 unmodified lines
18611864
18621865 next_tbrq_entry:
18631866 if (tpd)
1864− pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status));
1867+ dma_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status));
18651868 he_dev->tbrq_head = (struct he_tbrq *)
18661869 ((unsigned long) he_dev->tbrq_base |
18671870 TBRQ_MASK(he_dev->tbrq_head + 1));
@@ -1905,7 +1908,7 @@ he_service_rbpl(struct he_dev *he_dev, int group) · 37 unmodified lines
19051908 }
19061909 he_dev->rbpl_hint = i + 1;
19071910
1908− heb = pci_pool_alloc(he_dev->rbpl_pool, GFP_ATOMIC|GFP_DMA, &mapping);
1911+ heb = dma_pool_alloc(he_dev->rbpl_pool, GFP_ATOMIC, &mapping);
19091912 if (!heb)
19101913 break;
19111914 heb->mapping = mapping;
@@ -2084,10 +2087,10 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid) · 172 unmodified lines
20842087 */
20852088 for (slot = 0; slot < TPD_MAXIOV; ++slot) {
20862089 if (tpd->iovec[slot].addr)
2087− pci_unmap_single(he_dev->pci_dev,
2090+ dma_unmap_single(&he_dev->pci_dev->dev,
20882091 tpd->iovec[slot].addr,
20892092 tpd->iovec[slot].len & TPD_LEN_MASK,
2090− PCI_DMA_TODEVICE);
2093+ DMA_TO_DEVICE);
20912094 }
20922095 if (tpd->skb) {
20932096 if (tpd->vcc->pop)
@@ -2096,7 +2099,7 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid) · 2 unmodified lines
20962099 dev_kfree_skb_any(tpd->skb);
20972100 atomic_inc(&tpd->vcc->stats->tx_err);
20982101 }
2099− pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status));
2102+ dma_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status));
21002103 return;
21012104 }
21022105 }
@@ -2550,8 +2553,8 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) · 447 unmodified lines
25502553 }
25512554
25522555 #ifdef USE_SCATTERGATHER
2553− tpd->iovec[slot].addr = pci_map_single(he_dev->pci_dev, skb->data,
2554− skb_headlen(skb), PCI_DMA_TODEVICE);
2556+ tpd->iovec[slot].addr = dma_map_single(&he_dev->pci_dev->dev, skb->data,
2557+ skb_headlen(skb), DMA_TO_DEVICE);
25552558 tpd->iovec[slot].len = skb_headlen(skb);
25562559 ++slot;
25572560
@@ -2579,9 +2582,9 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) · 21 unmodified lines
25792582 slot = 0;
25802583 }
25812584
2582− tpd->iovec[slot].addr = pci_map_single(he_dev->pci_dev,
2585+ tpd->iovec[slot].addr = dma_map_single(&he_dev->pci_dev->dev,
25832586 (void *) page_address(frag->page) + frag->page_offset,
2584− frag->size, PCI_DMA_TODEVICE);
2587+ frag->size, DMA_TO_DEVICE);
25852588 tpd->iovec[slot].len = frag->size;
25862589 ++slot;
25872590
@@ -2589,7 +2592,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) · 1 unmodified line
25892592
25902593 tpd->iovec[slot - 1].len |= TPD_LST;
25912594 #else
2592− tpd->address0 = pci_map_single(he_dev->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE);
2595+ tpd->address0 = dma_map_single(&he_dev->pci_dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
25932596 tpd->length0 = skb->len | TPD_LST;
25942597 #endif
25952598 tpd->status |= TPD_INT;
drivers/atm/he.h+2−2
@@ -281,7 +281,7 @@ struct he_dev { · 280 unmodified lines
281281 int irq_peak;
282282
283283 struct tasklet_struct tasklet;
284− struct pci_pool *tpd_pool;
284+ struct dma_pool *tpd_pool;
285285 struct list_head outstanding_tpds;
286286
287287 dma_addr_t tpdrq_phys;
@@ -296,7 +296,7 @@ struct he_dev { · 8 unmodified lines
296296 struct he_buff **rbpl_virt;
297297 unsigned long *rbpl_table;
298298 unsigned long rbpl_hint;
299− struct pci_pool *rbpl_pool;
299+ struct dma_pool *rbpl_pool;
300300 dma_addr_t rbpl_phys;
301301 struct he_rbp *rbpl_base, *rbpl_tail;
302302 struct list_head rbpl_outstanding;
drivers/atm/horizon.c+0−24
@@ -458,12 +458,6 @@ static inline void update_tx_channel_config (hrz_dev * dev, short chan, u8 mode, · 457 unmodified lines
458458 return;
459459 }
460460
461−static inline u16 query_tx_channel_config (hrz_dev * dev, short chan, u8 mode) {
462− wr_regw (dev, TX_CHANNEL_CONFIG_COMMAND_OFF,
463− chan * TX_CHANNEL_CONFIG_MULT | mode);
464− return rd_regw (dev, TX_CHANNEL_CONFIG_DATA_OFF);
465−}
466−
467461 /********** dump functions **********/
468462
469463 static inline void dump_skb (char * prefix, unsigned int vc, struct sk_buff * skb) {
@@ -513,16 +507,6 @@ static inline void dump_framer (hrz_dev * dev) { · 43 unmodified lines
513507
514508 /* RX channels are 10 bit integers, these fns are quite paranoid */
515509
516−static inline int channel_to_vpivci (const u16 channel, short * vpi, int * vci) {
517− unsigned short vci_bits = 10 - vpi_bits;
518− if ((channel & RX_CHANNEL_MASK) == channel) {
519− *vci = channel & ((~0)<<vci_bits);
520− *vpi = channel >> vci_bits;
521− return channel ? 0 : -EINVAL;
522− }
523− return -EINVAL;
524−}
525−
526510 static inline int vpivci_to_channel (u16 * channel, const short vpi, const int vci) {
527511 unsigned short vci_bits = 10 - vpi_bits;
528512 if (0 <= vpi && vpi < 1<<vpi_bits && 0 <= vci && vci < 1<<vci_bits) {
@@ -1260,14 +1244,6 @@ static u32 rx_queue_entry_next (hrz_dev * dev) { · 731 unmodified lines
12601244 return rx_queue_entry;
12611245 }
12621246
1263−/********** handle RX disabled by device **********/
1264−
1265−static inline void rx_disabled_handler (hrz_dev * dev) {
1266− wr_regw (dev, RX_CONFIG_OFF, rd_regw (dev, RX_CONFIG_OFF) | RX_ENABLE);
1267− // count me please
1268− PRINTK (KERN_WARNING, "RX was disabled!");
1269−}
1270−
12711247 /********** handle RX data received by device **********/
12721248
12731249 // called from IRQ handler
drivers/atm/idt77252.c+57−50
@@ -641,7 +641,8 @@ alloc_scq(struct idt77252_dev *card, int class) · 640 unmodified lines
641641 scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL);
642642 if (!scq)
643643 return NULL;
644− scq->base = pci_zalloc_consistent(card->pcidev, SCQ_SIZE, &scq->paddr);
644+ scq->base = dma_zalloc_coherent(&card->pcidev->dev, SCQ_SIZE,
645+ &scq->paddr, GFP_KERNEL);
645646 if (scq->base == NULL) {
646647 kfree(scq);
647648 return NULL;
@@ -669,12 +670,12 @@ free_scq(struct idt77252_dev *card, struct scq_info *scq) · 21 unmodified lines
669670 struct sk_buff *skb;
670671 struct atm_vcc *vcc;
671672
672− pci_free_consistent(card->pcidev, SCQ_SIZE,
673− scq->base, scq->paddr);
673+ dma_free_coherent(&card->pcidev->dev, SCQ_SIZE,
674+ scq->base, scq->paddr);
674675
675676 while ((skb = skb_dequeue(&scq->transmit))) {
676− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
677− skb->len, PCI_DMA_TODEVICE);
677+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
678+ skb->len, DMA_TO_DEVICE);
678679
679680 vcc = ATM_SKB(skb)->vcc;
680681 if (vcc->pop)
@@ -684,8 +685,8 @@ free_scq(struct idt77252_dev *card, struct scq_info *scq) · 3 unmodified lines
684685 }
685686
686687 while ((skb = skb_dequeue(&scq->pending))) {
687− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
688− skb->len, PCI_DMA_TODEVICE);
688+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
689+ skb->len, DMA_TO_DEVICE);
689690
690691 vcc = ATM_SKB(skb)->vcc;
691692 if (vcc->pop)
@@ -800,8 +801,8 @@ drain_scq(struct idt77252_dev *card, struct vc_map *vc) · 108 unmodified lines
800801 if (skb) {
801802 TXPRINTK("%s: freeing skb at %p.\n", card->name, skb);
802803
803− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
804− skb->len, PCI_DMA_TODEVICE);
804+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
805+ skb->len, DMA_TO_DEVICE);
805806
806807 vcc = ATM_SKB(skb)->vcc;
807808
@@ -846,8 +847,8 @@ queue_skb(struct idt77252_dev *card, struct vc_map *vc, · 38 unmodified lines
846847 tbd = &IDT77252_PRV_TBD(skb);
847848 vcc = ATM_SKB(skb)->vcc;
848849
849− IDT77252_PRV_PADDR(skb) = pci_map_single(card->pcidev, skb->data,
850− skb->len, PCI_DMA_TODEVICE);
850+ IDT77252_PRV_PADDR(skb) = dma_map_single(&card->pcidev->dev, skb->data,
851+ skb->len, DMA_TO_DEVICE);
851852
852853 error = -EINVAL;
853854
@@ -924,8 +925,8 @@ done: · 70 unmodified lines
924925 return 0;
925926
926927 errout:
927− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
928− skb->len, PCI_DMA_TODEVICE);
928+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
929+ skb->len, DMA_TO_DEVICE);
929930 return error;
930931 }
931932
@@ -970,8 +971,8 @@ init_rsq(struct idt77252_dev *card) · 38 unmodified lines
970971 {
971972 struct rsq_entry *rsqe;
972973
973− card->rsq.base = pci_zalloc_consistent(card->pcidev, RSQSIZE,
974− &card->rsq.paddr);
974+ card->rsq.base = dma_zalloc_coherent(&card->pcidev->dev, RSQSIZE,
975+ &card->rsq.paddr, GFP_KERNEL);
975976 if (card->rsq.base == NULL) {
976977 printk("%s: can't allocate RSQ.\n", card->name);
977978 return -1;
@@ -1001,8 +1002,8 @@ init_rsq(struct idt77252_dev *card) · 23 unmodified lines
10011002 static void
10021003 deinit_rsq(struct idt77252_dev *card)
10031004 {
1004− pci_free_consistent(card->pcidev, RSQSIZE,
1005− card->rsq.base, card->rsq.paddr);
1005+ dma_free_coherent(&card->pcidev->dev, RSQSIZE,
1006+ card->rsq.base, card->rsq.paddr);
10061007 }
10071008
10081009 static void
@@ -1057,9 +1058,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) · 48 unmodified lines
10571058
10581059 vcc = vc->rx_vcc;
10591060
1060− pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(skb),
1061− skb_end_pointer(skb) - skb->data,
1062− PCI_DMA_FROMDEVICE);
1061+ dma_sync_single_for_cpu(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
1062+ skb_end_pointer(skb) - skb->data,
1063+ DMA_FROM_DEVICE);
10631064
10641065 if ((vcc->qos.aal == ATM_AAL0) ||
10651066 (vcc->qos.aal == ATM_AAL34)) {
@@ -1180,9 +1181,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) · 114 unmodified lines
11801181 return;
11811182 }
11821183
1183− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
1184+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
11841185 skb_end_pointer(skb) - skb->data,
1185− PCI_DMA_FROMDEVICE);
1186+ DMA_FROM_DEVICE);
11861187 sb_pool_remove(card, skb);
11871188
11881189 skb_trim(skb, len);
@@ -1254,9 +1255,9 @@ idt77252_rx_raw(struct idt77252_dev *card) · 65 unmodified lines
12541255 head = IDT77252_PRV_PADDR(queue) + (queue->data - queue->head - 16);
12551256 tail = readl(SAR_REG_RAWCT);
12561257
1257− pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(queue),
1258− skb_end_offset(queue) - 16,
1259− PCI_DMA_FROMDEVICE);
1258+ dma_sync_single_for_cpu(&card->pcidev->dev, IDT77252_PRV_PADDR(queue),
1259+ skb_end_offset(queue) - 16,
1260+ DMA_FROM_DEVICE);
12601261
12611262 while (head != tail) {
12621263 unsigned int vpi, vci;
@@ -1348,11 +1349,11 @@ drop: · 85 unmodified lines
13481349 if (next) {
13491350 card->raw_cell_head = next;
13501351 queue = card->raw_cell_head;
1351− pci_dma_sync_single_for_cpu(card->pcidev,
1352− IDT77252_PRV_PADDR(queue),
1353− (skb_end_pointer(queue) -
1354− queue->data),
1355− PCI_DMA_FROMDEVICE);
1352+ dma_sync_single_for_cpu(&card->pcidev->dev,
1353+ IDT77252_PRV_PADDR(queue),
1354+ (skb_end_pointer(queue) -
1355+ queue->data),
1356+ DMA_FROM_DEVICE);
13561357 } else {
13571358 card->raw_cell_head = NULL;
13581359 printk("%s: raw cell queue overrun\n",
@@ -1375,8 +1376,8 @@ init_tsq(struct idt77252_dev *card) · 16 unmodified lines
13751376 {
13761377 struct tsq_entry *tsqe;
13771378
1378− card->tsq.base = pci_alloc_consistent(card->pcidev, RSQSIZE,
1379− &card->tsq.paddr);
1379+ card->tsq.base = dma_alloc_coherent(&card->pcidev->dev, RSQSIZE,
1380+ &card->tsq.paddr, GFP_KERNEL);
13801381 if (card->tsq.base == NULL) {
13811382 printk("%s: can't allocate TSQ.\n", card->name);
13821383 return -1;
@@ -1398,8 +1399,8 @@ init_tsq(struct idt77252_dev *card) · 15 unmodified lines
13981399 static void
13991400 deinit_tsq(struct idt77252_dev *card)
14001401 {
1401− pci_free_consistent(card->pcidev, TSQSIZE,
1402− card->tsq.base, card->tsq.paddr);
1402+ dma_free_coherent(&card->pcidev->dev, TSQSIZE,
1403+ card->tsq.base, card->tsq.paddr);
14031404 }
14041405
14051406 static void
@@ -1861,9 +1862,9 @@ add_rx_skb(struct idt77252_dev *card, int queue, · 455 unmodified lines
18611862 goto outfree;
18621863 }
18631864
1864− paddr = pci_map_single(card->pcidev, skb->data,
1865+ paddr = dma_map_single(&card->pcidev->dev, skb->data,
18651866 skb_end_pointer(skb) - skb->data,
1866− PCI_DMA_FROMDEVICE);
1867+ DMA_FROM_DEVICE);
18671868 IDT77252_PRV_PADDR(skb) = paddr;
18681869
18691870 if (push_rx_skb(card, skb, queue)) {
@@ -1875,8 +1876,8 @@ add_rx_skb(struct idt77252_dev *card, int queue, · 5 unmodified lines
18751876 return;
18761877
18771878 outunmap:
1878− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
1879− skb_end_pointer(skb) - skb->data, PCI_DMA_FROMDEVICE);
1879+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
1880+ skb_end_pointer(skb) - skb->data, DMA_FROM_DEVICE);
18801881
18811882 handle = IDT77252_PRV_POOL(skb);
18821883 card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL;
@@ -1892,15 +1893,15 @@ recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb) · 9 unmodified lines
18921893 u32 handle = IDT77252_PRV_POOL(skb);
18931894 int err;
18941895
1895− pci_dma_sync_single_for_device(card->pcidev, IDT77252_PRV_PADDR(skb),
1896− skb_end_pointer(skb) - skb->data,
1897− PCI_DMA_FROMDEVICE);
1896+ dma_sync_single_for_device(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
1897+ skb_end_pointer(skb) - skb->data,
1898+ DMA_FROM_DEVICE);
18981899
18991900 err = push_rx_skb(card, skb, POOL_QUEUE(handle));
19001901 if (err) {
1901− pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
1902+ dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
19021903 skb_end_pointer(skb) - skb->data,
1903− PCI_DMA_FROMDEVICE);
1904+ DMA_FROM_DEVICE);
19041905 sb_pool_remove(card, skb);
19051906 dev_kfree_skb(skb);
19061907 }
@@ -3058,11 +3059,11 @@ deinit_card(struct idt77252_dev *card) · 1151 unmodified lines
30583059 for (j = 0; j < FBQ_SIZE; j++) {
30593060 skb = card->sbpool[i].skb[j];
30603061 if (skb) {
3061− pci_unmap_single(card->pcidev,
3062+ dma_unmap_single(&card->pcidev->dev,
30623063 IDT77252_PRV_PADDR(skb),
30633064 (skb_end_pointer(skb) -
30643065 skb->data),
3065− PCI_DMA_FROMDEVICE);
3066+ DMA_FROM_DEVICE);
30663067 card->sbpool[i].skb[j] = NULL;
30673068 dev_kfree_skb(skb);
30683069 }
@@ -3076,8 +3077,8 @@ deinit_card(struct idt77252_dev *card) · 7 unmodified lines
30763077 vfree(card->vcs);
30773078
30783079 if (card->raw_cell_hnd) {
3079− pci_free_consistent(card->pcidev, 2 * sizeof(u32),
3080− card->raw_cell_hnd, card->raw_cell_paddr);
3080+ dma_free_coherent(&card->pcidev->dev, 2 * sizeof(u32),
3081+ card->raw_cell_hnd, card->raw_cell_paddr);
30813082 }
30823083
30833084 if (card->rsq.base) {
@@ -3397,9 +3398,10 @@ static int init_card(struct atm_dev *dev) · 313 unmodified lines
33973398 writel(0, SAR_REG_GP);
33983399
33993400 /* Initialize RAW Cell Handle Register */
3400− card->raw_cell_hnd = pci_zalloc_consistent(card->pcidev,
3401− 2 * sizeof(u32),
3402− &card->raw_cell_paddr);
3401+ card->raw_cell_hnd = dma_zalloc_coherent(&card->pcidev->dev,
3402+ 2 * sizeof(u32),
3403+ &card->raw_cell_paddr,
3404+ GFP_KERNEL);
34033405 if (!card->raw_cell_hnd) {
34043406 printk("%s: memory allocation failure.\n", card->name);
34053407 deinit_card(card);
@@ -3611,6 +3613,11 @@ static int idt77252_init_one(struct pci_dev *pcidev, · 205 unmodified lines
36113613 return err;
36123614 }
36133615
3616+ if ((err = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)))) {
3617+ printk("idt77252: can't enable DMA for PCI device at %s\n", pci_name(pcidev));
3618+ return err;
3619+ }
3620+
36143621 card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
36153622 if (!card) {
36163623 printk("idt77252-%d: can't allocate private data\n", index);
drivers/atm/iphase.c+28−26
@@ -1185,8 +1185,8 @@ static int rx_pkt(struct atm_dev *dev) · 1184 unmodified lines
11851185
11861186 /* Build the DLE structure */
11871187 wr_ptr = iadev->rx_dle_q.write;
1188− wr_ptr->sys_pkt_addr = pci_map_single(iadev->pci, skb->data,
1189− len, PCI_DMA_FROMDEVICE);
1188+ wr_ptr->sys_pkt_addr = dma_map_single(&iadev->pci->dev, skb->data,
1189+ len, DMA_FROM_DEVICE);
11901190 wr_ptr->local_pkt_addr = buf_addr;
11911191 wr_ptr->bytes = len; /* We don't know this do we ?? */
11921192 wr_ptr->mode = DMA_INT_ENABLE;
@@ -1306,8 +1306,8 @@ static void rx_dle_intr(struct atm_dev *dev) · 113 unmodified lines
13061306 u_short length;
13071307 struct ia_vcc *ia_vcc;
13081308
1309− pci_unmap_single(iadev->pci, iadev->rx_dle_q.write->sys_pkt_addr,
1310− len, PCI_DMA_FROMDEVICE);
1309+ dma_unmap_single(&iadev->pci->dev, iadev->rx_dle_q.write->sys_pkt_addr,
1310+ len, DMA_FROM_DEVICE);
13111311 /* no VCC related housekeeping done as yet. lets see */
13121312 vcc = ATM_SKB(skb)->vcc;
13131313 if (!vcc) {
@@ -1430,8 +1430,8 @@ static int rx_init(struct atm_dev *dev) · 116 unmodified lines
14301430 // spin_lock_init(&iadev->rx_lock);
14311431
14321432 /* Allocate 4k bytes - more aligned than needed (4k boundary) */
1433− dle_addr = pci_alloc_consistent(iadev->pci, DLE_TOTAL_SIZE,
1434− &iadev->rx_dle_dma);
1433+ dle_addr = dma_alloc_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE,
1434+ &iadev->rx_dle_dma, GFP_KERNEL);
14351435 if (!dle_addr) {
14361436 printk(KERN_ERR DEV_LABEL "can't allocate DLEs\n");
14371437 goto err_out;
@@ -1631,8 +1631,8 @@ static int rx_init(struct atm_dev *dev) · 193 unmodified lines
16311631 return 0;
16321632
16331633 err_free_dle:
1634− pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->rx_dle_q.start,
1635− iadev->rx_dle_dma);
1634+ dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->rx_dle_q.start,
1635+ iadev->rx_dle_dma);
16361636 err_out:
16371637 return -ENOMEM;
16381638 }
@@ -1702,8 +1702,8 @@ static void tx_dle_intr(struct atm_dev *dev) · 63 unmodified lines
17021702
17031703 /* Revenge of the 2 dle (skb + trailer) used in ia_pkt_tx() */
17041704 if (!((dle - iadev->tx_dle_q.start)%(2*sizeof(struct dle)))) {
1705− pci_unmap_single(iadev->pci, dle->sys_pkt_addr, skb->len,
1706− PCI_DMA_TODEVICE);
1705+ dma_unmap_single(&iadev->pci->dev, dle->sys_pkt_addr, skb->len,
1706+ DMA_TO_DEVICE);
17071707 }
17081708 vcc = ATM_SKB(skb)->vcc;
17091709 if (!vcc) {
@@ -1917,8 +1917,8 @@ static int tx_init(struct atm_dev *dev) · 207 unmodified lines
19171917 readw(iadev->seg_reg+SEG_MASK_REG));)
19181918
19191919 /* Allocate 4k (boundary aligned) bytes */
1920− dle_addr = pci_alloc_consistent(iadev->pci, DLE_TOTAL_SIZE,
1921− &iadev->tx_dle_dma);
1920+ dle_addr = dma_alloc_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE,
1921+ &iadev->tx_dle_dma, GFP_KERNEL);
19221922 if (!dle_addr) {
19231923 printk(KERN_ERR DEV_LABEL "can't allocate DLEs\n");
19241924 goto err_out;
@@ -1989,8 +1989,10 @@ static int tx_init(struct atm_dev *dev) · 64 unmodified lines
19891989 goto err_free_tx_bufs;
19901990 }
19911991 iadev->tx_buf[i].cpcs = cpcs;
1992− iadev->tx_buf[i].dma_addr = pci_map_single(iadev->pci,
1993− cpcs, sizeof(*cpcs), PCI_DMA_TODEVICE);
1992+ iadev->tx_buf[i].dma_addr = dma_map_single(&iadev->pci->dev,
1993+ cpcs,
1994+ sizeof(*cpcs),
1995+ DMA_TO_DEVICE);
19941996 }
19951997 iadev->desc_tbl = kmalloc(iadev->num_tx_desc *
19961998 sizeof(struct desc_tbl_t), GFP_KERNEL);
@@ -2198,14 +2200,14 @@ err_free_tx_bufs: · 201 unmodified lines
21982200 while (--i >= 0) {
21992201 struct cpcs_trailer_desc *desc = iadev->tx_buf + i;
22002202
2201− pci_unmap_single(iadev->pci, desc->dma_addr,
2202− sizeof(*desc->cpcs), PCI_DMA_TODEVICE);
2203+ dma_unmap_single(&iadev->pci->dev, desc->dma_addr,
2204+ sizeof(*desc->cpcs), DMA_TO_DEVICE);
22032205 kfree(desc->cpcs);
22042206 }
22052207 kfree(iadev->tx_buf);
22062208 err_free_dle:
2207− pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->tx_dle_q.start,
2208− iadev->tx_dle_dma);
2209+ dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->tx_dle_q.start,
2210+ iadev->tx_dle_dma);
22092211 err_out:
22102212 return -ENOMEM;
22112213 }
@@ -2476,20 +2478,20 @@ static void ia_free_tx(IADEV *iadev) · 264 unmodified lines
24762478 for (i = 0; i < iadev->num_tx_desc; i++) {
24772479 struct cpcs_trailer_desc *desc = iadev->tx_buf + i;
24782480
2479− pci_unmap_single(iadev->pci, desc->dma_addr,
2480− sizeof(*desc->cpcs), PCI_DMA_TODEVICE);
2481+ dma_unmap_single(&iadev->pci->dev, desc->dma_addr,
2482+ sizeof(*desc->cpcs), DMA_TO_DEVICE);
24812483 kfree(desc->cpcs);
24822484 }
24832485 kfree(iadev->tx_buf);
2484− pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->tx_dle_q.start,
2485− iadev->tx_dle_dma);
2486+ dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->tx_dle_q.start,
2487+ iadev->tx_dle_dma);
24862488 }
24872489
24882490 static void ia_free_rx(IADEV *iadev)
24892491 {
24902492 kfree(iadev->rx_open);
2491− pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->rx_dle_q.start,
2492− iadev->rx_dle_dma);
2493+ dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->rx_dle_q.start,
2494+ iadev->rx_dle_dma);
24932495 }
24942496
24952497 static int ia_start(struct atm_dev *dev)
@@ -3009,8 +3011,8 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) { · 513 unmodified lines
30093011 /* Build the DLE structure */
30103012 wr_ptr = iadev->tx_dle_q.write;
30113013 memset((caddr_t)wr_ptr, 0, sizeof(*wr_ptr));
3012− wr_ptr->sys_pkt_addr = pci_map_single(iadev->pci, skb->data,
3013− skb->len, PCI_DMA_TODEVICE);
3014+ wr_ptr->sys_pkt_addr = dma_map_single(&iadev->pci->dev, skb->data,
3015+ skb->len, DMA_TO_DEVICE);
30143016 wr_ptr->local_pkt_addr = (buf_desc_ptr->buf_start_hi << 16) |
30153017 buf_desc_ptr->buf_start_lo;
30163018 /* wr_ptr->bytes = swap_byte_order(total_len); didn't seem to affect?? */
drivers/atm/lanai.c+5−18
@@ -346,7 +346,8 @@ static void lanai_buf_allocate(struct lanai_buffer *buf, · 345 unmodified lines
346346 * everything, but the way the lanai uses DMA memory would
347347 * make that a terrific pain. This is much simpler.
348348 */
349− buf->start = pci_alloc_consistent(pci, size, &buf->dmaaddr);
349+ buf->start = dma_alloc_coherent(&pci->dev,
350+ size, &buf->dmaaddr, GFP_KERNEL);
350351 if (buf->start != NULL) { /* Success */
351352 /* Lanai requires 256-byte alignment of DMA bufs */
352353 APRINTK((buf->dmaaddr & ~0xFFFFFF00) == 0,
@@ -372,8 +373,8 @@ static void lanai_buf_deallocate(struct lanai_buffer *buf, · 19 unmodified lines
372373 struct pci_dev *pci)
373374 {
374375 if (buf->start != NULL) {
375− pci_free_consistent(pci, lanai_buf_size(buf),
376− buf->start, buf->dmaaddr);
376+ dma_free_coherent(&pci->dev, lanai_buf_size(buf),
377+ buf->start, buf->dmaaddr);
377378 buf->start = buf->end = buf->ptr = NULL;
378379 }
379380 }
@@ -681,15 +682,6 @@ static inline int aal5_size(int size) · 301 unmodified lines
681682 return cells * 48;
682683 }
683684
684−/* How many bytes can we send if we have "space" space, assuming we have
685− * to send full cells
686− */
687−static inline int aal5_spacefor(int space)
688−{
689− int cells = space / 48;
690− return cells * 48;
691−}
692−
693685 /* -------------------- FREE AN ATM SKB: */
694686
695687 static inline void lanai_free_skb(struct atm_vcc *atmvcc, struct sk_buff *skb)
@@ -1953,12 +1945,7 @@ static int lanai_pci_start(struct lanai_dev *lanai) · 1257 unmodified lines
19531945 return -ENXIO;
19541946 }
19551947 pci_set_master(pci);
1956− if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) != 0) {
1957− printk(KERN_WARNING DEV_LABEL
1958− "(itf %d): No suitable DMA available.\n", lanai->number);
1959− return -EBUSY;
1960− }
1961− if (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) != 0) {
1948+ if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32)) != 0) {
19621949 printk(KERN_WARNING DEV_LABEL
19631950 "(itf %d): No suitable DMA available.\n", lanai->number);
19641951 return -EBUSY;
drivers/atm/nicstar.c+30−30
@@ -252,10 +252,10 @@ static void nicstar_remove_one(struct pci_dev *pcidev) · 251 unmodified lines
252252 free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc);
253253 }
254254 idr_destroy(&card->idr);
255− pci_free_consistent(card->pcidev, NS_RSQSIZE + NS_RSQ_ALIGNMENT,
256− card->rsq.org, card->rsq.dma);
257− pci_free_consistent(card->pcidev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
258− card->tsq.org, card->tsq.dma);
255+ dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT,
256+ card->rsq.org, card->rsq.dma);
257+ dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
258+ card->tsq.org, card->tsq.dma);
259259 free_irq(card->pcidev->irq, card);
260260 iounmap(card->membase);
261261 kfree(card);
@@ -370,8 +370,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev) · 108 unmodified lines
370370 ns_init_card_error(card, error);
371371 return error;
372372 }
373− if ((pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)) != 0) ||
374− (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32)) != 0)) {
373+ if (dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)) != 0) {
375374 printk(KERN_WARNING
376375 "nicstar%d: No suitable DMA available.\n", i);
377376 error = 2;
@@ -535,9 +534,9 @@ static int ns_init_card(int i, struct pci_dev *pcidev) · 157 unmodified lines
535534 writel(0x00000000, card->membase + VPM);
536535
537536 /* Initialize TSQ */
538− card->tsq.org = pci_alloc_consistent(card->pcidev,
539− NS_TSQSIZE + NS_TSQ_ALIGNMENT,
540− &card->tsq.dma);
537+ card->tsq.org = dma_alloc_coherent(&card->pcidev->dev,
538+ NS_TSQSIZE + NS_TSQ_ALIGNMENT,
539+ &card->tsq.dma, GFP_KERNEL);
541540 if (card->tsq.org == NULL) {
542541 printk("nicstar%d: can't allocate TSQ.\n", i);
543542 error = 10;
@@ -554,9 +553,9 @@ static int ns_init_card(int i, struct pci_dev *pcidev) · 10 unmodified lines
554553 PRINTK("nicstar%d: TSQ base at 0x%p.\n", i, card->tsq.base);
555554
556555 /* Initialize RSQ */
557− card->rsq.org = pci_alloc_consistent(card->pcidev,
558− NS_RSQSIZE + NS_RSQ_ALIGNMENT,
559− &card->rsq.dma);
556+ card->rsq.org = dma_alloc_coherent(&card->pcidev->dev,
557+ NS_RSQSIZE + NS_RSQ_ALIGNMENT,
558+ &card->rsq.dma, GFP_KERNEL);
560559 if (card->rsq.org == NULL) {
561560 printk("nicstar%d: can't allocate RSQ.\n", i);
562561 error = 11;
@@ -874,7 +873,8 @@ static scq_info *get_scq(ns_dev *card, int size, u32 scd) · 311 unmodified lines
874873 scq = kmalloc(sizeof(scq_info), GFP_KERNEL);
875874 if (!scq)
876875 return NULL;
877− scq->org = pci_alloc_consistent(card->pcidev, 2 * size, &scq->dma);
876+ scq->org = dma_alloc_coherent(&card->pcidev->dev,
877+ 2 * size, &scq->dma, GFP_KERNEL);
878878 if (!scq->org) {
879879 kfree(scq);
880880 return NULL;
@@ -936,10 +936,10 @@ static void free_scq(ns_dev *card, scq_info *scq, struct atm_vcc *vcc) · 55 unmodified lines
936936 }
937937 }
938938 kfree(scq->skb);
939− pci_free_consistent(card->pcidev,
940− 2 * (scq->num_entries == VBR_SCQ_NUM_ENTRIES ?
941− VBR_SCQSIZE : CBR_SCQSIZE),
942− scq->org, scq->dma);
939+ dma_free_coherent(&card->pcidev->dev,
940+ 2 * (scq->num_entries == VBR_SCQ_NUM_ENTRIES ?
941+ VBR_SCQSIZE : CBR_SCQSIZE),
942+ scq->org, scq->dma);
943943 kfree(scq);
944944 }
945945
@@ -957,11 +957,11 @@ static void push_rxbufs(ns_dev * card, struct sk_buff *skb) · 11 unmodified lines
957957 handle2 = NULL;
958958 addr2 = 0;
959959 handle1 = skb;
960− addr1 = pci_map_single(card->pcidev,
960+ addr1 = dma_map_single(&card->pcidev->dev,
961961 skb->data,
962962 (NS_PRV_BUFTYPE(skb) == BUF_SM
963963 ? NS_SMSKBSIZE : NS_LGSKBSIZE),
964− PCI_DMA_TODEVICE);
964+ DMA_TO_DEVICE);
965965 NS_PRV_DMA(skb) = addr1; /* save so we can unmap later */
966966
967967 #ifdef GENERAL_DEBUG
@@ -1670,8 +1670,8 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb) · 702 unmodified lines
16701670
16711671 ATM_SKB(skb)->vcc = vcc;
16721672
1673− NS_PRV_DMA(skb) = pci_map_single(card->pcidev, skb->data,
1674− skb->len, PCI_DMA_TODEVICE);
1673+ NS_PRV_DMA(skb) = dma_map_single(&card->pcidev->dev, skb->data,
1674+ skb->len, DMA_TO_DEVICE);
16751675
16761676 if (vcc->qos.aal == ATM_AAL5) {
16771677 buflen = (skb->len + 47 + 8) / 48 * 48; /* Multiple of 48 */
@@ -1930,10 +1930,10 @@ static void drain_scq(ns_dev * card, scq_info * scq, int pos) · 252 unmodified lines
19301930 XPRINTK("nicstar%d: freeing skb at 0x%p (index %d).\n",
19311931 card->index, skb, i);
19321932 if (skb != NULL) {
1933− pci_unmap_single(card->pcidev,
1933+ dma_unmap_single(&card->pcidev->dev,
19341934 NS_PRV_DMA(skb),
19351935 skb->len,
1936− PCI_DMA_TODEVICE);
1936+ DMA_TO_DEVICE);
19371937 vcc = ATM_SKB(skb)->vcc;
19381938 if (vcc && vcc->pop != NULL) {
19391939 vcc->pop(vcc, skb);
@@ -1992,16 +1992,16 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe) · 52 unmodified lines
19921992 return;
19931993 }
19941994 idr_remove(&card->idr, id);
1995− pci_dma_sync_single_for_cpu(card->pcidev,
1996− NS_PRV_DMA(skb),
1997− (NS_PRV_BUFTYPE(skb) == BUF_SM
1998− ? NS_SMSKBSIZE : NS_LGSKBSIZE),
1999− PCI_DMA_FROMDEVICE);
2000− pci_unmap_single(card->pcidev,
1995+ dma_sync_single_for_cpu(&card->pcidev->dev,
1996+ NS_PRV_DMA(skb),
1997+ (NS_PRV_BUFTYPE(skb) == BUF_SM
1998+ ? NS_SMSKBSIZE : NS_LGSKBSIZE),
1999+ DMA_FROM_DEVICE);
2000+ dma_unmap_single(&card->pcidev->dev,
20012001 NS_PRV_DMA(skb),
20022002 (NS_PRV_BUFTYPE(skb) == BUF_SM
20032003 ? NS_SMSKBSIZE : NS_LGSKBSIZE),
2004− PCI_DMA_FROMDEVICE);
2004+ DMA_FROM_DEVICE);
20052005 vpi = ns_rsqe_vpi(rsqe);
20062006 vci = ns_rsqe_vci(rsqe);
20072007 if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits) {
drivers/atm/solos-pci.c+13−13
@@ -785,8 +785,8 @@ static void solos_bh(unsigned long card_arg) · 784 unmodified lines
785785 skb = card->rx_skb[port];
786786 card->rx_skb[port] = NULL;
787787
788− pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr,
789− RX_DMA_SIZE, PCI_DMA_FROMDEVICE);
788+ dma_unmap_single(&card->dev->dev, SKB_CB(skb)->dma_addr,
789+ RX_DMA_SIZE, DMA_FROM_DEVICE);
790790
791791 header = (void *)skb->data;
792792 size = le16_to_cpu(header->size);
@@ -872,8 +872,8 @@ static void solos_bh(unsigned long card_arg) · 79 unmodified lines
872872 struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, GFP_ATOMIC);
873873 if (skb) {
874874 SKB_CB(skb)->dma_addr =
875− pci_map_single(card->dev, skb->data,
876− RX_DMA_SIZE, PCI_DMA_FROMDEVICE);
875+ dma_map_single(&card->dev->dev, skb->data,
876+ RX_DMA_SIZE, DMA_FROM_DEVICE);
877877 iowrite32(SKB_CB(skb)->dma_addr,
878878 card->config_regs + RX_DMA_ADDR(port));
879879 card->rx_skb[port] = skb;
@@ -1069,8 +1069,8 @@ static uint32_t fpga_tx(struct solos_card *card) · 189 unmodified lines
10691069 if (tx_pending & 1) {
10701070 struct sk_buff *oldskb = card->tx_skb[port];
10711071 if (oldskb) {
1072− pci_unmap_single(card->dev, SKB_CB(oldskb)->dma_addr,
1073− oldskb->len, PCI_DMA_TODEVICE);
1072+ dma_unmap_single(&card->dev->dev, SKB_CB(oldskb)->dma_addr,
1073+ oldskb->len, DMA_TO_DEVICE);
10741074 card->tx_skb[port] = NULL;
10751075 }
10761076 spin_lock(&card->tx_queue_lock);
@@ -1089,8 +1089,8 @@ static uint32_t fpga_tx(struct solos_card *card) · 12 unmodified lines
10891089 data = card->dma_bounce + (BUF_SIZE * port);
10901090 memcpy(data, skb->data, skb->len);
10911091 }
1092− SKB_CB(skb)->dma_addr = pci_map_single(card->dev, data,
1093− skb->len, PCI_DMA_TODEVICE);
1092+ SKB_CB(skb)->dma_addr = dma_map_single(&card->dev->dev, data,
1093+ skb->len, DMA_TO_DEVICE);
10941094 card->tx_skb[port] = skb;
10951095 iowrite32(SKB_CB(skb)->dma_addr,
10961096 card->config_regs + TX_DMA_ADDR(port));
@@ -1210,7 +1210,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) · 113 unmodified lines
12101210 goto out;
12111211 }
12121212
1213− err = pci_set_dma_mask(dev, DMA_BIT_MASK(32));
1213+ err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
12141214 if (err) {
12151215 dev_warn(&dev->dev, "Failed to set 32-bit DMA mask\n");
12161216 goto out;
@@ -1411,14 +1411,14 @@ static void atm_remove(struct solos_card *card) · 194 unmodified lines
14111411
14121412 skb = card->rx_skb[i];
14131413 if (skb) {
1414− pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr,
1415− RX_DMA_SIZE, PCI_DMA_FROMDEVICE);
1414+ dma_unmap_single(&card->dev->dev, SKB_CB(skb)->dma_addr,
1415+ RX_DMA_SIZE, DMA_FROM_DEVICE);
14161416 dev_kfree_skb(skb);
14171417 }
14181418 skb = card->tx_skb[i];
14191419 if (skb) {
1420− pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr,
1421− skb->len, PCI_DMA_TODEVICE);
1420+ dma_unmap_single(&card->dev->dev, SKB_CB(skb)->dma_addr,
1421+ skb->len, DMA_TO_DEVICE);
14221422 dev_kfree_skb(skb);
14231423 }
14241424 while ((skb = skb_dequeue(&card->tx_queue[i])))
drivers/atm/zatm.c+11−6
@@ -1306,19 +1306,20 @@ static int zatm_start(struct atm_dev *dev) · 1305 unmodified lines
13061306
13071307 if (!mbx_entries[i])
13081308 continue;
1309− mbx = pci_alloc_consistent(pdev, 2*MBX_SIZE(i), &mbx_dma);
1309+ mbx = dma_alloc_coherent(&pdev->dev,
1310+ 2 * MBX_SIZE(i), &mbx_dma, GFP_KERNEL);
13101311 if (!mbx) {
13111312 error = -ENOMEM;
13121313 goto out;
13131314 }
13141315 /*
1315− * Alignment provided by pci_alloc_consistent() isn't enough
1316+ * Alignment provided by dma_alloc_coherent() isn't enough
13161317 * for this device.
13171318 */
13181319 if (((unsigned long)mbx ^ mbx_dma) & 0xffff) {
13191320 printk(KERN_ERR DEV_LABEL "(itf %d): system "
13201321 "bus incompatible with driver\n", dev->number);
1321− pci_free_consistent(pdev, 2*MBX_SIZE(i), mbx, mbx_dma);
1322+ dma_free_coherent(&pdev->dev, 2*MBX_SIZE(i), mbx, mbx_dma);
13221323 error = -ENODEV;
13231324 goto out;
13241325 }
@@ -1354,9 +1355,9 @@ out_tx: · 29 unmodified lines
13541355 kfree(zatm_dev->tx_map);
13551356 out:
13561357 while (i-- > 0) {
1357− pci_free_consistent(pdev, 2*MBX_SIZE(i),
1358− (void *)zatm_dev->mbx_start[i],
1359− zatm_dev->mbx_dma[i]);
1358+ dma_free_coherent(&pdev->dev, 2 * MBX_SIZE(i),
1359+ (void *)zatm_dev->mbx_start[i],
1360+ zatm_dev->mbx_dma[i]);
13601361 }
13611362 free_irq(zatm_dev->irq, dev);
13621363 goto done;
@@ -1608,6 +1609,10 @@ static int zatm_init_one(struct pci_dev *pci_dev, · 245 unmodified lines
16081609 if (ret < 0)
16091610 goto out_disable;
16101611
1612+ ret = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
1613+ if (ret < 0)
1614+ goto out_disable;
1615+
16111616 zatm_dev->pci_dev = pci_dev;
16121617 dev->dev_data = zatm_dev;
16131618 zatm_dev->copper = (int)ent->driver_data;
drivers/bcma/bcma_private.h+11−7
@@ -25,22 +25,18 @@ struct bcma_bus; · 24 unmodified lines
2525 bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
2626 int timeout);
2727 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
28+void bcma_init_bus(struct bcma_bus *bus);
2829 int bcma_bus_register(struct bcma_bus *bus);
2930 void bcma_bus_unregister(struct bcma_bus *bus);
30−int __init bcma_bus_early_register(struct bcma_bus *bus,
31− struct bcma_device *core_cc,
32− struct bcma_device *core_mips);
31+int __init bcma_bus_early_register(struct bcma_bus *bus);
3332 #ifdef CONFIG_PM
3433 int bcma_bus_suspend(struct bcma_bus *bus);
3534 int bcma_bus_resume(struct bcma_bus *bus);
3635 #endif
3736
3837 /* scan.c */
38+void bcma_detect_chip(struct bcma_bus *bus);
3939 int bcma_bus_scan(struct bcma_bus *bus);
40−int __init bcma_bus_scan_early(struct bcma_bus *bus,
41− struct bcma_device_id *match,
42− struct bcma_device *core);
43−void bcma_init_bus(struct bcma_bus *bus);
4440
4541 /* sprom.c */
4642 int bcma_sprom_get(struct bcma_bus *bus);
@@ -111,6 +107,14 @@ extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); · 64 unmodified lines
111107 #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
112108 bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
113109 void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
110+#else
111+static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
112+{
113+ return false;
114+}
115+static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
116+{
117+}
114118 #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
115119
116120 #ifdef CONFIG_BCMA_DRIVER_GPIO
drivers/bcma/driver_chipcommon.c+14−6
@@ -79,7 +79,9 @@ static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc) · 78 unmodified lines
7979
8080 if (cc->capabilities & BCMA_CC_CAP_PMU) {
8181 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
82− /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */
82+ /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP
83+ * clock
84+ */
8385 return bcma_chipco_get_alp_clock(cc) / 4000;
8486 else
8587 /* based on 32KHz ILP clock */
@@ -97,7 +99,8 @@ int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc) · 11 unmodified lines
9799 wdt.driver_data = cc;
98100 wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt;
99101 wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt;
100− wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
102+ wdt.max_timer_ms =
103+ bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
101104
102105 pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
103106 cc->core->bus->num, &wdt,
@@ -175,7 +178,6 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) · 71 unmodified lines
175178 u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
176179 {
177180 u32 maxt;
178− enum bcma_clkmode clkmode;
179181
180182 maxt = bcma_chipco_watchdog_get_max_timer(cc);
181183 if (cc->capabilities & BCMA_CC_CAP_PMU) {
@@ -185,8 +187,13 @@ u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) · 3 unmodified lines
185187 ticks = maxt;
186188 bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks);
187189 } else {
188− clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC;
189− bcma_core_set_clockmode(cc->core, clkmode);
190+ struct bcma_bus *bus = cc->core->bus;
191+
192+ if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 &&
193+ bus->chipinfo.id != BCMA_CHIP_ID_BCM53018)
194+ bcma_core_set_clockmode(cc->core,
195+ ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC);
196+
190197 if (ticks > maxt)
191198 ticks = maxt;
192199 /* instant NMI */
@@ -335,7 +342,8 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc) · 142 unmodified lines
335342 | BCMA_CC_CORECTL_UARTCLKEN);
336343 }
337344 } else {
338− bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", ccrev);
345+ bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n",
346+ ccrev);
339347 return;
340348 }
341349
drivers/bcma/driver_pci.c+44−24
@@ -144,6 +144,47 @@ static u16 bcma_pcie_mdio_writeread(struct bcma_drv_pci *pc, u16 device, · 143 unmodified lines
144144 return bcma_pcie_mdio_read(pc, device, address);
145145 }
146146
147+/**************************************************
148+ * Early init.
149+ **************************************************/
150+
151+static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc)
152+{
153+ struct bcma_device *core = pc->core;
154+ u16 val16, core_index;
155+ uint regoff;
156+
157+ regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET);
158+ core_index = (u16)core->core_index;
159+
160+ val16 = pcicore_read16(pc, regoff);
161+ if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT)
162+ != core_index) {
163+ val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) |
164+ (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK);
165+ pcicore_write16(pc, regoff, val16);
166+ }
167+}
168+
169+/*
170+ * Apply some early fixes required before accessing SPROM.
171+ * See also si_pci_fixcfg.
172+ */
173+void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
174+{
175+ if (pc->early_setup_done)
176+ return;
177+
178+ pc->hostmode = bcma_core_pci_is_in_hostmode(pc);
179+ if (pc->hostmode)
180+ goto out;
181+
182+ bcma_core_pci_fixcfg(pc);
183+
184+out:
185+ pc->early_setup_done = true;
186+}
187+
147188 /**************************************************
148189 * Workarounds.
149190 **************************************************/
@@ -175,24 +216,6 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) · 25 unmodified lines
175216 tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN);
176217 }
177218
178−static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc)
179−{
180− struct bcma_device *core = pc->core;
181− u16 val16, core_index;
182− uint regoff;
183−
184− regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET);
185− core_index = (u16)core->core_index;
186−
187− val16 = pcicore_read16(pc, regoff);
188− if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT)
189− != core_index) {
190− val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) |
191− (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK);
192− pcicore_write16(pc, regoff, val16);
193− }
194−}
195−
196219 /* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */
197220 /* Needs to happen when coming out of 'standby'/'hibernate' */
198221 static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc)
@@ -216,7 +239,6 @@ static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) · 17 unmodified lines
216239
217240 static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
218241 {
219− bcma_core_pci_fixcfg(pc);
220242 bcma_pcicore_serdes_workaround(pc);
221243 bcma_core_pci_config_fixup(pc);
222244 }
@@ -226,13 +248,11 @@ void bcma_core_pci_init(struct bcma_drv_pci *pc) · 3 unmodified lines
226248 if (pc->setup_done)
227249 return;
228250
229−#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
230− pc->hostmode = bcma_core_pci_is_in_hostmode(pc);
251+ bcma_core_pci_early_init(pc);
252+
231253 if (pc->hostmode)
232254 bcma_core_pci_hostmode_init(pc);
233−#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
234−
235− if (!pc->hostmode)
255+ else
236256 bcma_core_pci_clientmode_init(pc);
237257 }
238258
drivers/bcma/host_pci.c+4−2
@@ -13,10 +13,12 @@ · 12 unmodified lines
1313
1414 static void bcma_host_pci_switch_core(struct bcma_device *core)
1515 {
16+ int win2 = core->bus->host_is_pcie2 ?
17+ BCMA_PCIE2_BAR0_WIN2 : BCMA_PCI_BAR0_WIN2;
18+
1619 pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN,
1720 core->addr);
18− pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN2,
19− core->wrap);
21+ pci_write_config_dword(core->bus->host_pci, win2, core->wrap);
2022 core->bus->mapped_core = core;
2123 bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id);
2224 }
drivers/bcma/host_soc.c+1−1
@@ -193,7 +193,7 @@ int __init bcma_host_soc_init(struct bcma_soc *soc) · 192 unmodified lines
193193 int err;
194194
195195 /* Scan bus and initialize it */
196− err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
196+ err = bcma_bus_early_register(bus);
197197 if (err)
198198 iounmap(bus->mmio);
199199
drivers/bcma/main.c+37−39
@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) · 267 unmodified lines
268268 }
269269 }
270270
271+void bcma_init_bus(struct bcma_bus *bus)
272+{
273+ mutex_lock(&bcma_buses_mutex);
274+ bus->num = bcma_bus_next_num++;
275+ mutex_unlock(&bcma_buses_mutex);
276+
277+ INIT_LIST_HEAD(&bus->cores);
278+ bus->nr_cores = 0;
279+
280+ bcma_detect_chip(bus);
281+}
282+
271283 static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
272284 {
273285 int err;
@@ -356,12 +368,19 @@ static void bcma_unregister_cores(struct bcma_bus *bus) · 82 unmodified lines
356368 struct bcma_device *core, *tmp;
357369
358370 list_for_each_entry_safe(core, tmp, &bus->cores, list) {
371+ if (!core->dev_registered)
372+ continue;
359373 list_del(&core->list);
360− if (core->dev_registered)
361− device_unregister(&core->dev);
374+ device_unregister(&core->dev);
362375 }
363376 if (bus->hosttype == BCMA_HOSTTYPE_SOC)
364377 platform_device_unregister(bus->drv_cc.watchdog);
378+
379+ /* Now noone uses internally-handled cores, we can free them */
380+ list_for_each_entry_safe(core, tmp, &bus->cores, list) {
381+ list_del(&core->list);
382+ kfree(core);
383+ }
365384 }
366385
367386 int bcma_bus_register(struct bcma_bus *bus)
@@ -369,10 +388,6 @@ int bcma_bus_register(struct bcma_bus *bus) · 1 unmodified line
369388 int err;
370389 struct bcma_device *core;
371390
372− mutex_lock(&bcma_buses_mutex);
373− bus->num = bcma_bus_next_num++;
374− mutex_unlock(&bcma_buses_mutex);
375−
376391 /* Scan for devices (cores) */
377392 err = bcma_bus_scan(bus);
378393 if (err) {
@@ -387,6 +402,13 @@ int bcma_bus_register(struct bcma_bus *bus) · 8 unmodified lines
387402 bcma_core_chipcommon_early_init(&bus->drv_cc);
388403 }
389404
405+ /* Early init PCIE core */
406+ core = bcma_find_core(bus, BCMA_CORE_PCIE);
407+ if (core) {
408+ bus->drv_pci[0].core = core;
409+ bcma_core_pci_early_init(&bus->drv_pci[0]);
410+ }
411+
390412 /* Cores providing flash access go before SPROM init */
391413 list_for_each_entry(core, &bus->cores, list) {
392414 if (bcma_is_core_needed_early(core->id.id))
@@ -459,7 +481,6 @@ int bcma_bus_register(struct bcma_bus *bus) · 66 unmodified lines
459481
460482 void bcma_bus_unregister(struct bcma_bus *bus)
461483 {
462− struct bcma_device *cores[3];
463484 int err;
464485
465486 err = bcma_gpio_unregister(&bus->drv_cc);
@@ -470,46 +491,23 @@ void bcma_bus_unregister(struct bcma_bus *bus) · 4 unmodified lines
470491
471492 bcma_core_chipcommon_b_free(&bus->drv_cc_b);
472493
473− cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
474− cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE);
475− cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
476−
477494 bcma_unregister_cores(bus);
478−
479− kfree(cores[2]);
480− kfree(cores[1]);
481− kfree(cores[0]);
482495 }
483496
484−int __init bcma_bus_early_register(struct bcma_bus *bus,
485− struct bcma_device *core_cc,
486− struct bcma_device *core_mips)
497+/*
498+ * This is a special version of bus registration function designed for SoCs.
499+ * It scans bus and performs basic initialization of main cores only.
500+ * Please note it requires memory allocation, however it won't try to sleep.
501+ */
502+int __init bcma_bus_early_register(struct bcma_bus *bus)
487503 {
488504 int err;
489505 struct bcma_device *core;
490− struct bcma_device_id match;
491506
492− match.manuf = BCMA_MANUF_BCM;
493− match.id = bcma_cc_core_id(bus);
494− match.class = BCMA_CL_SIM;
495− match.rev = BCMA_ANY_REV;
496−
497− /* Scan for chip common core */
498− err = bcma_bus_scan_early(bus, &match, core_cc);
499− if (err) {
500− bcma_err(bus, "Failed to scan for common core: %d\n", err);
501− return -1;
502− }
503−
504− match.manuf = BCMA_MANUF_MIPS;
505− match.id = BCMA_CORE_MIPS_74K;
506− match.class = BCMA_CL_SIM;
507− match.rev = BCMA_ANY_REV;
508−
509− /* Scan for mips core */
510− err = bcma_bus_scan_early(bus, &match, core_mips);
507+ /* Scan for devices (cores) */
508+ err = bcma_bus_scan(bus);
511509 if (err) {
512− bcma_err(bus, "Failed to scan for mips core: %d\n", err);
510+ bcma_err(bus, "Failed to scan bus: %d\n", err);
513511 return -1;
514512 }
515513
drivers/bcma/scan.c+5−62
@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, · 434 unmodified lines
435435 return 0;
436436 }
437437
438−void bcma_init_bus(struct bcma_bus *bus)
438+void bcma_detect_chip(struct bcma_bus *bus)
439439 {
440440 s32 tmp;
441441 struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
442442 char chip_id[8];
443443
444− INIT_LIST_HEAD(&bus->cores);
445− bus->nr_cores = 0;
446−
447444 bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
448445
449446 tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);
@@ -464,6 +461,10 @@ int bcma_bus_scan(struct bcma_bus *bus) · 14 unmodified lines
464461
465462 int err, core_num = 0;
466463
464+ /* Skip if bus was already scanned (e.g. during early register) */
465+ if (bus->nr_cores)
466+ return 0;
467+
467468 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
468469 if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
469470 eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
@@ -522,61 +523,3 @@ out: · 52 unmodified lines
522523
523524 return err;
524525 }
525−
526−int __init bcma_bus_scan_early(struct bcma_bus *bus,
527− struct bcma_device_id *match,
528− struct bcma_device *core)
529−{
530− u32 erombase;
531− u32 __iomem *eromptr, *eromend;
532−
533− int err = -ENODEV;
534− int core_num = 0;
535−
536− erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
537− if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
538− eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
539− if (!eromptr)
540− return -ENOMEM;
541− } else {
542− eromptr = bus->mmio;
543− }
544−
545− eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32);
546−
547− bcma_scan_switch_core(bus, erombase);
548−
549− while (eromptr < eromend) {
550− memset(core, 0, sizeof(*core));
551− INIT_LIST_HEAD(&core->list);
552− core->bus = bus;
553−
554− err = bcma_get_next_core(bus, &eromptr, match, core_num, core);
555− if (err == -ENODEV) {
556− core_num++;
557− continue;
558− } else if (err == -ENXIO)
559− continue;
560− else if (err == -ESPIPE)
561− break;
562− else if (err < 0)
563− goto out;
564−
565− core->core_index = core_num++;
566− bus->nr_cores++;
567− bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
568− core->core_index, bcma_device_name(&core->id),
569− core->id.manuf, core->id.id, core->id.rev,
570− core->id.class);
571−
572− list_add_tail(&core->list, &bus->cores);
573− err = 0;
574− break;
575− }
576−
577−out:
578− if (bus->hosttype == BCMA_HOSTTYPE_SOC)
579− iounmap(eromptr);
580−
581− return err;
582−}
drivers/bcma/sprom.c+2−1
@@ -579,7 +579,8 @@ int bcma_sprom_get(struct bcma_bus *bus) · 578 unmodified lines
579579 u16 offset = BCMA_CC_SPROM;
580580 u16 *sprom;
581581 size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4,
582− SSB_SPROMSIZE_WORDS_R10, };
582+ SSB_SPROMSIZE_WORDS_R10,
583+ SSB_SPROMSIZE_WORDS_R11, };
583584 int i, err = 0;
584585
585586 if (!bus->drv_cc.core)
drivers/bluetooth/ath3k.c+10−0
@@ -108,6 +108,7 @@ static const struct usb_device_id ath3k_table[] = { · 107 unmodified lines
108108 { USB_DEVICE(0x13d3, 0x3393) },
109109 { USB_DEVICE(0x13d3, 0x3402) },
110110 { USB_DEVICE(0x13d3, 0x3408) },
111+ { USB_DEVICE(0x13d3, 0x3423) },
111112 { USB_DEVICE(0x13d3, 0x3432) },
112113
113114 /* Atheros AR5BBU12 with sflash firmware */
@@ -162,6 +163,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 48 unmodified lines
162163 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
163164 { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
164165 { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
166+ { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
165167 { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
166168
167169 /* Atheros AR5BBU22 with sflash firmware */
@@ -174,6 +176,8 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 6 unmodified lines
174176 #define USB_REQ_DFU_DNLOAD 1
175177 #define BULK_SIZE 4096
176178 #define FW_HDR_SIZE 20
179+#define TIMEGAP_USEC_MIN 50
180+#define TIMEGAP_USEC_MAX 100
177181
178182 static int ath3k_load_firmware(struct usb_device *udev,
179183 const struct firmware *firmware)
@@ -205,6 +209,9 @@ static int ath3k_load_firmware(struct usb_device *udev, · 25 unmodified lines
205209 pipe = usb_sndbulkpipe(udev, 0x02);
206210
207211 while (count) {
212+ /* workaround the compatibility issue with xHCI controller*/
213+ usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);
214+
208215 size = min_t(uint, count, BULK_SIZE);
209216 memcpy(send_buf, firmware->data + sent, size);
210217
@@ -302,6 +309,9 @@ static int ath3k_load_fwfile(struct usb_device *udev, · 91 unmodified lines
302309 pipe = usb_sndbulkpipe(udev, 0x02);
303310
304311 while (count) {
312+ /* workaround the compatibility issue with xHCI controller*/
313+ usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);
314+
305315 size = min_t(uint, count, BULK_SIZE);
306316 memcpy(send_buf, firmware->data + sent, size);
307317
drivers/bluetooth/bfusb.c+2−0
@@ -696,6 +696,8 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 695 unmodified lines
696696 hdev->flush = bfusb_flush;
697697 hdev->send = bfusb_send_frame;
698698
699+ set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);
700+
699701 if (hci_register_dev(hdev) < 0) {
700702 BT_ERR("Can't register HCI device");
701703 hci_free_dev(hdev);
drivers/bluetooth/btmrvl_drv.h+3−2
@@ -28,9 +28,9 @@ · 27 unmodified lines
2828 #define BTM_UPLD_SIZE 2312
2929
3030 /* Time to wait until Host Sleep state change in millisecond */
31−#define WAIT_UNTIL_HS_STATE_CHANGED 5000
31+#define WAIT_UNTIL_HS_STATE_CHANGED msecs_to_jiffies(5000)
3232 /* Time to wait for command response in millisecond */
33−#define WAIT_UNTIL_CMD_RESP 5000
33+#define WAIT_UNTIL_CMD_RESP msecs_to_jiffies(5000)
3434
3535 enum rdwr_status {
3636 RDWR_STATUS_SUCCESS = 0,
@@ -104,6 +104,7 @@ struct btmrvl_private { · 67 unmodified lines
104104 #ifdef CONFIG_DEBUG_FS
105105 void *debugfs_data;
106106 #endif
107+ bool surprise_removed;
107108 };
108109
109110 #define MRVL_VENDOR_PKT 0xFE
drivers/bluetooth/btmrvl_main.c+25−7
@@ -178,6 +178,11 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, · 177 unmodified lines
178178 struct sk_buff *skb;
179179 struct hci_command_hdr *hdr;
180180
181+ if (priv->surprise_removed) {
182+ BT_ERR("Card is removed");
183+ return -EFAULT;
184+ }
185+
181186 skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_ATOMIC);
182187 if (skb == NULL) {
183188 BT_ERR("No free skb");
@@ -202,10 +207,14 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, · 18 unmodified lines
202207 wake_up_interruptible(&priv->main_thread.wait_q);
203208
204209 if (!wait_event_interruptible_timeout(priv->adapter->cmd_wait_q,
205− priv->adapter->cmd_complete,
206− msecs_to_jiffies(WAIT_UNTIL_CMD_RESP)))
210+ priv->adapter->cmd_complete ||
211+ priv->surprise_removed,
212+ WAIT_UNTIL_CMD_RESP))
207213 return -ETIMEDOUT;
208214
215+ if (priv->surprise_removed)
216+ return -EFAULT;
217+
209218 return 0;
210219 }
211220
@@ -287,9 +296,10 @@ int btmrvl_enable_hs(struct btmrvl_private *priv) · 75 unmodified lines
287296 }
288297
289298 ret = wait_event_interruptible_timeout(adapter->event_hs_wait_q,
290− adapter->hs_state,
291− msecs_to_jiffies(WAIT_UNTIL_HS_STATE_CHANGED));
292− if (ret < 0) {
299+ adapter->hs_state ||
300+ priv->surprise_removed,
301+ WAIT_UNTIL_HS_STATE_CHANGED);
302+ if (ret < 0 || priv->surprise_removed) {
293303 BT_ERR("event_hs_wait_q terminated (%d): %d,%d,%d",
294304 ret, adapter->hs_state, adapter->ps_state,
295305 adapter->wakeup_tries);
@@ -538,8 +548,11 @@ static int btmrvl_check_device_tree(struct btmrvl_private *priv) · 242 unmodified lines
538548 static int btmrvl_setup(struct hci_dev *hdev)
539549 {
540550 struct btmrvl_private *priv = hci_get_drvdata(hdev);
551+ int ret;
541552
542− btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
553+ ret = btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
554+ if (ret)
555+ return ret;
543556
544557 priv->btmrvl_dev.gpio_gap = 0xffff;
545558
@@ -597,7 +610,7 @@ static int btmrvl_service_main_thread(void *data) · 51 unmodified lines
597610 add_wait_queue(&thread->wait_q, &wait);
598611
599612 set_current_state(TASK_INTERRUPTIBLE);
600− if (kthread_should_stop()) {
613+ if (kthread_should_stop() || priv->surprise_removed) {
601614 BT_DBG("main_thread: break from main thread");
602615 break;
603616 }
@@ -616,6 +629,11 @@ static int btmrvl_service_main_thread(void *data) · 12 unmodified lines
616629
617630 BT_DBG("main_thread woke up");
618631
632+ if (kthread_should_stop() || priv->surprise_removed) {
633+ BT_DBG("main_thread: break from main thread");
634+ break;
635+ }
636+
619637 spin_lock_irqsave(&priv->driver_lock, flags);
620638 if (adapter->int_count) {
621639 adapter->int_count = 0;
drivers/bluetooth/btmrvl_sdio.c+5−1
@@ -573,7 +573,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) · 572 unmodified lines
573573 offset += txlen;
574574 } while (true);
575575
576− BT_DBG("FW download over, size %d bytes", offset);
576+ BT_INFO("FW download over, size %d bytes", offset);
577577
578578 ret = 0;
579579
@@ -798,6 +798,9 @@ static void btmrvl_sdio_interrupt(struct sdio_func *func) · 218 unmodified lines
798798
799799 priv = card->priv;
800800
801+ if (priv->surprise_removed)
802+ return;
803+
801804 if (card->reg->int_read_to_clear)
802805 ret = btmrvl_sdio_read_to_clear(card, &ireg);
803806 else
@@ -1466,6 +1469,7 @@ static void btmrvl_sdio_remove(struct sdio_func *func) · 662 unmodified lines
14661469 btmrvl_sdio_disable_host_int(card);
14671470 }
14681471 BT_DBG("unregester dev");
1472+ card->priv->surprise_removed = true;
14691473 btmrvl_sdio_unregister_dev(card);
14701474 btmrvl_remove_card(card->priv);
14711475 }
drivers/bluetooth/btusb.c+696−14
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828 #include <net/bluetooth/bluetooth.h>
2929 #include <net/bluetooth/hci_core.h>
3030
31−#define VERSION "0.6"
31+#define VERSION "0.7"
3232
3333 static bool disable_scofix;
3434 static bool force_scofix;
@@ -49,11 +49,17 @@ static struct usb_driver btusb_driver; · 14 unmodified lines
4949 #define BTUSB_INTEL_BOOT 0x200
5050 #define BTUSB_BCM_PATCHRAM 0x400
5151 #define BTUSB_MARVELL 0x800
52+#define BTUSB_SWAVE 0x1000
53+#define BTUSB_INTEL_NEW 0x2000
54+#define BTUSB_AMP 0x4000
5255
5356 static const struct usb_device_id btusb_table[] = {
5457 /* Generic Bluetooth USB device */
5558 { USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
5659
60+ /* Generic Bluetooth AMP device */
61+ { USB_DEVICE_INFO(0xe0, 0x01, 0x04), .driver_info = BTUSB_AMP },
62+
5763 /* Apple-specific (Broadcom) devices */
5864 { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) },
5965
@@ -85,7 +91,7 @@ static const struct usb_device_id btusb_table[] = { · 25 unmodified lines
8591 { USB_DEVICE(0x05ac, 0x8281) },
8692
8793 /* AVM BlueFRITZ! USB v2.0 */
88− { USB_DEVICE(0x057c, 0x3800) },
94+ { USB_DEVICE(0x057c, 0x3800), .driver_info = BTUSB_SWAVE },
8995
9096 /* Bluetooth Ultraport Module from IBM */
9197 { USB_DEVICE(0x04bf, 0x030a) },
@@ -109,16 +115,24 @@ static const struct usb_device_id btusb_table[] = { · 17 unmodified lines
109115 { USB_DEVICE(0x13d3, 0x3404),
110116 .driver_info = BTUSB_BCM_PATCHRAM },
111117
118+ /* Broadcom BCM20702B0 (Dynex/Insignia) */
119+ { USB_DEVICE(0x19ff, 0x0239), .driver_info = BTUSB_BCM_PATCHRAM },
120+
112121 /* Foxconn - Hon Hai */
113122 { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01),
114123 .driver_info = BTUSB_BCM_PATCHRAM },
115124
125+ /* Lite-On Technology - Broadcom based */
126+ { USB_VENDOR_AND_INTERFACE_INFO(0x04ca, 0xff, 0x01, 0x01),
127+ .driver_info = BTUSB_BCM_PATCHRAM },
128+
116129 /* Broadcom devices with vendor specific id */
117130 { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01),
118131 .driver_info = BTUSB_BCM_PATCHRAM },
119132
120133 /* ASUSTek Computer - Broadcom based */
121− { USB_VENDOR_AND_INTERFACE_INFO(0x0b05, 0xff, 0x01, 0x01) },
134+ { USB_VENDOR_AND_INTERFACE_INFO(0x0b05, 0xff, 0x01, 0x01),
135+ .driver_info = BTUSB_BCM_PATCHRAM },
122136
123137 /* Belkin F8065bf - Broadcom based */
124138 { USB_VENDOR_AND_INTERFACE_INFO(0x050d, 0xff, 0x01, 0x01) },
@@ -188,6 +202,7 @@ static const struct usb_device_id blacklist_table[] = { · 63 unmodified lines
188202 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
189203 { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
190204 { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
205+ { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
191206 { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
192207
193208 /* Atheros AR5BBU12 with sflash firmware */
@@ -237,6 +252,9 @@ static const struct usb_device_id blacklist_table[] = { · 43 unmodified lines
237252 /* CONWISE Technology based adapters with buggy SCO support */
238253 { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC },
239254
255+ /* Roper Class 1 Bluetooth Dongle (Silicon Wave based) */
256+ { USB_DEVICE(0x1300, 0x0001), .driver_info = BTUSB_SWAVE },
257+
240258 /* Digianswer devices */
241259 { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
242260 { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
@@ -249,13 +267,18 @@ static const struct usb_device_id blacklist_table[] = { · 6 unmodified lines
249267 { USB_DEVICE(0x16d3, 0x0002),
250268 .driver_info = BTUSB_SNIFFER | BTUSB_BROKEN_ISOC },
251269
252− /* Intel Bluetooth device */
270+ /* Marvell Bluetooth devices */
271+ { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
272+ { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
273+
274+ /* Intel Bluetooth devices */
253275 { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL },
254276 { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL },
277+ { USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_NEW },
255278
256− /* Marvell device */
257− { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
258− { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
279+ /* Other Intel Bluetooth devices */
280+ { USB_VENDOR_AND_INTERFACE_INFO(0x8087, 0xe0, 0x01, 0x01),
281+ .driver_info = BTUSB_IGNORE },
259282
260283 { } /* Terminating entry */
261284 };
@@ -267,6 +290,11 @@ static const struct usb_device_id blacklist_table[] = { · 5 unmodified lines
267290 #define BTUSB_ISOC_RUNNING 2
268291 #define BTUSB_SUSPENDING 3
269292 #define BTUSB_DID_ISO_RESUME 4
293+#define BTUSB_BOOTLOADER 5
294+#define BTUSB_DOWNLOADING 6
295+#define BTUSB_FIRMWARE_LOADED 7
296+#define BTUSB_FIRMWARE_FAILED 8
297+#define BTUSB_BOOTING 9
270298
271299 struct btusb_data {
272300 struct hci_dev *hdev;
@@ -300,14 +328,26 @@ struct btusb_data { · 27 unmodified lines
300328 struct usb_endpoint_descriptor *isoc_rx_ep;
301329
302330 __u8 cmdreq_type;
331+ __u8 cmdreq;
303332
304333 unsigned int sco_num;
305334 int isoc_altsetting;
306335 int suspend_count;
307336
337+ int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb);
308338 int (*recv_bulk)(struct btusb_data *data, void *buffer, int count);
309339 };
310340
341+static int btusb_wait_on_bit_timeout(void *word, int bit, unsigned long timeout,
342+ unsigned mode)
343+{
344+ might_sleep();
345+ if (!test_bit(bit, word))
346+ return 0;
347+ return out_of_line_wait_on_bit_timeout(word, bit, bit_wait_timeout,
348+ mode, timeout);
349+}
350+
311351 static inline void btusb_free_frags(struct btusb_data *data)
312352 {
313353 unsigned long flags;
@@ -370,7 +410,7 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count) · 56 unmodified lines
370410
371411 if (bt_cb(skb)->expect == 0) {
372412 /* Complete frame */
373− hci_recv_frame(data->hdev, skb);
413+ data->recv_event(data->hdev, skb);
374414 skb = NULL;
375415 }
376416 }
@@ -952,7 +992,7 @@ static struct urb *alloc_ctrl_urb(struct hci_dev *hdev, struct sk_buff *skb) · 575 unmodified lines
952992 }
953993
954994 dr->bRequestType = data->cmdreq_type;
955− dr->bRequest = 0;
995+ dr->bRequest = data->cmdreq;
956996 dr->wIndex = 0;
957997 dr->wValue = 0;
958998 dr->wLength = __cpu_to_le16(skb->len);
@@ -1290,6 +1330,26 @@ struct intel_version { · 331 unmodified lines
12901330 u8 fw_patch_num;
12911331 } __packed;
12921332
1333+struct intel_boot_params {
1334+ __u8 status;
1335+ __u8 otp_format;
1336+ __u8 otp_content;
1337+ __u8 otp_patch;
1338+ __le16 dev_revid;
1339+ __u8 secure_boot;
1340+ __u8 key_from_hdr;
1341+ __u8 key_type;
1342+ __u8 otp_lock;
1343+ __u8 api_lock;
1344+ __u8 debug_lock;
1345+ bdaddr_t otp_bdaddr;
1346+ __u8 min_fw_build_nn;
1347+ __u8 min_fw_build_cw;
1348+ __u8 min_fw_build_yy;
1349+ __u8 limited_cce;
1350+ __u8 unlocked_state;
1351+} __packed;
1352+
12931353 static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev,
12941354 struct intel_version *ver)
12951355 {
@@ -1698,6 +1758,562 @@ exit_mfg_deactivate: · 402 unmodified lines
16981758 return 0;
16991759 }
17001760
1761+static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
1762+{
1763+ struct sk_buff *skb;
1764+ struct hci_event_hdr *hdr;
1765+ struct hci_ev_cmd_complete *evt;
1766+
1767+ skb = bt_skb_alloc(sizeof(*hdr) + sizeof(*evt) + 1, GFP_ATOMIC);
1768+ if (!skb)
1769+ return -ENOMEM;
1770+
1771+ hdr = (struct hci_event_hdr *)skb_put(skb, sizeof(*hdr));
1772+ hdr->evt = HCI_EV_CMD_COMPLETE;
1773+ hdr->plen = sizeof(*evt) + 1;
1774+
1775+ evt = (struct hci_ev_cmd_complete *)skb_put(skb, sizeof(*evt));
1776+ evt->ncmd = 0x01;
1777+ evt->opcode = cpu_to_le16(opcode);
1778+
1779+ *skb_put(skb, 1) = 0x00;
1780+
1781+ bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
1782+
1783+ return hci_recv_frame(hdev, skb);
1784+}
1785+
1786+static int btusb_recv_bulk_intel(struct btusb_data *data, void *buffer,
1787+ int count)
1788+{
1789+ /* When the device is in bootloader mode, then it can send
1790+ * events via the bulk endpoint. These events are treated the
1791+ * same way as the ones received from the interrupt endpoint.
1792+ */
1793+ if (test_bit(BTUSB_BOOTLOADER, &data->flags))
1794+ return btusb_recv_intr(data, buffer, count);
1795+
1796+ return btusb_recv_bulk(data, buffer, count);
1797+}
1798+
1799+static int btusb_recv_event_intel(struct hci_dev *hdev, struct sk_buff *skb)
1800+{
1801+ struct btusb_data *data = hci_get_drvdata(hdev);
1802+
1803+ if (test_bit(BTUSB_BOOTLOADER, &data->flags)) {
1804+ struct hci_event_hdr *hdr = (void *)skb->data;
1805+
1806+ /* When the firmware loading completes the device sends
1807+ * out a vendor specific event indicating the result of
1808+ * the firmware loading.
1809+ */
1810+ if (skb->len == 7 && hdr->evt == 0xff && hdr->plen == 0x05 &&
1811+ skb->data[2] == 0x06) {
1812+ if (skb->data[3] != 0x00)
1813+ test_bit(BTUSB_FIRMWARE_FAILED, &data->flags);
1814+
1815+ if (test_and_clear_bit(BTUSB_DOWNLOADING,
1816+ &data->flags) &&
1817+ test_bit(BTUSB_FIRMWARE_LOADED, &data->flags)) {
1818+ smp_mb__after_atomic();
1819+ wake_up_bit(&data->flags, BTUSB_DOWNLOADING);
1820+ }
1821+ }
1822+
1823+ /* When switching to the operational firmware the device
1824+ * sends a vendor specific event indicating that the bootup
1825+ * completed.
1826+ */
1827+ if (skb->len == 9 && hdr->evt == 0xff && hdr->plen == 0x07 &&
1828+ skb->data[2] == 0x02) {
1829+ if (test_and_clear_bit(BTUSB_BOOTING, &data->flags)) {
1830+ smp_mb__after_atomic();
1831+ wake_up_bit(&data->flags, BTUSB_BOOTING);
1832+ }
1833+ }
1834+ }
1835+
1836+ return hci_recv_frame(hdev, skb);
1837+}
1838+
1839+static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
1840+{
1841+ struct btusb_data *data = hci_get_drvdata(hdev);
1842+ struct urb *urb;
1843+
1844+ BT_DBG("%s", hdev->name);
1845+
1846+ if (!test_bit(HCI_RUNNING, &hdev->flags))
1847+ return -EBUSY;
1848+
1849+ switch (bt_cb(skb)->pkt_type) {
1850+ case HCI_COMMAND_PKT:
1851+ if (test_bit(BTUSB_BOOTLOADER, &data->flags)) {
1852+ struct hci_command_hdr *cmd = (void *)skb->data;
1853+ __u16 opcode = le16_to_cpu(cmd->opcode);
1854+
1855+ /* When in bootloader mode and the command 0xfc09
1856+ * is received, it needs to be send down the
1857+ * bulk endpoint. So allocate a bulk URB instead.
1858+ */
1859+ if (opcode == 0xfc09)
1860+ urb = alloc_bulk_urb(hdev, skb);
1861+ else
1862+ urb = alloc_ctrl_urb(hdev, skb);
1863+
1864+ /* When the 0xfc01 command is issued to boot into
1865+ * the operational firmware, it will actually not
1866+ * send a command complete event. To keep the flow
1867+ * control working inject that event here.
1868+ */
1869+ if (opcode == 0xfc01)
1870+ inject_cmd_complete(hdev, opcode);
1871+ } else {
1872+ urb = alloc_ctrl_urb(hdev, skb);
1873+ }
1874+ if (IS_ERR(urb))
1875+ return PTR_ERR(urb);
1876+
1877+ hdev->stat.cmd_tx++;
1878+ return submit_or_queue_tx_urb(hdev, urb);
1879+
1880+ case HCI_ACLDATA_PKT:
1881+ urb = alloc_bulk_urb(hdev, skb);
1882+ if (IS_ERR(urb))
1883+ return PTR_ERR(urb);
1884+
1885+ hdev->stat.acl_tx++;
1886+ return submit_or_queue_tx_urb(hdev, urb);
1887+
1888+ case HCI_SCODATA_PKT:
1889+ if (hci_conn_num(hdev, SCO_LINK) < 1)
1890+ return -ENODEV;
1891+
1892+ urb = alloc_isoc_urb(hdev, skb);
1893+ if (IS_ERR(urb))
1894+ return PTR_ERR(urb);
1895+
1896+ hdev->stat.sco_tx++;
1897+ return submit_tx_urb(hdev, urb);
1898+ }
1899+
1900+ return -EILSEQ;
1901+}
1902+
1903+static int btusb_intel_secure_send(struct hci_dev *hdev, u8 fragment_type,
1904+ u32 plen, const void *param)
1905+{
1906+ while (plen > 0) {
1907+ struct sk_buff *skb;
1908+ u8 cmd_param[253], fragment_len = (plen > 252) ? 252 : plen;
1909+
1910+ cmd_param[0] = fragment_type;
1911+ memcpy(cmd_param + 1, param, fragment_len);
1912+
1913+ skb = __hci_cmd_sync(hdev, 0xfc09, fragment_len + 1,
1914+ cmd_param, HCI_INIT_TIMEOUT);
1915+ if (IS_ERR(skb))
1916+ return PTR_ERR(skb);
1917+
1918+ kfree_skb(skb);
1919+
1920+ plen -= fragment_len;
1921+ param += fragment_len;
1922+ }
1923+
1924+ return 0;
1925+}
1926+
1927+static void btusb_intel_version_info(struct hci_dev *hdev,
1928+ struct intel_version *ver)
1929+{
1930+ const char *variant;
1931+
1932+ switch (ver->fw_variant) {
1933+ case 0x06:
1934+ variant = "Bootloader";
1935+ break;
1936+ case 0x23:
1937+ variant = "Firmware";
1938+ break;
1939+ default:
1940+ return;
1941+ }
1942+
1943+ BT_INFO("%s: %s revision %u.%u build %u week %u %u", hdev->name,
1944+ variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f,
1945+ ver->fw_build_num, ver->fw_build_ww, 2000 + ver->fw_build_yy);
1946+}
1947+
1948+static int btusb_setup_intel_new(struct hci_dev *hdev)
1949+{
1950+ static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
1951+ 0x00, 0x08, 0x04, 0x00 };
1952+ struct btusb_data *data = hci_get_drvdata(hdev);
1953+ struct sk_buff *skb;
1954+ struct intel_version *ver;
1955+ struct intel_boot_params *params;
1956+ const struct firmware *fw;
1957+ const u8 *fw_ptr;
1958+ char fwname[64];
1959+ ktime_t calltime, delta, rettime;
1960+ unsigned long long duration;
1961+ int err;
1962+
1963+ BT_DBG("%s", hdev->name);
1964+
1965+ calltime = ktime_get();
1966+
1967+ /* Read the Intel version information to determine if the device
1968+ * is in bootloader mode or if it already has operational firmware
1969+ * loaded.
1970+ */
1971+ skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT);
1972+ if (IS_ERR(skb)) {
1973+ BT_ERR("%s: Reading Intel version information failed (%ld)",
1974+ hdev->name, PTR_ERR(skb));
1975+ return PTR_ERR(skb);
1976+ }
1977+
1978+ if (skb->len != sizeof(*ver)) {
1979+ BT_ERR("%s: Intel version event size mismatch", hdev->name);
1980+ kfree_skb(skb);
1981+ return -EILSEQ;
1982+ }
1983+
1984+ ver = (struct intel_version *)skb->data;
1985+ if (ver->status) {
1986+ BT_ERR("%s: Intel version command failure (%02x)",
1987+ hdev->name, ver->status);
1988+ err = -bt_to_errno(ver->status);
1989+ kfree_skb(skb);
1990+ return err;
1991+ }
1992+
1993+ /* The hardware platform number has a fixed value of 0x37 and
1994+ * for now only accept this single value.
1995+ */
1996+ if (ver->hw_platform != 0x37) {
1997+ BT_ERR("%s: Unsupported Intel hardware platform (%u)",
1998+ hdev->name, ver->hw_platform);
1999+ kfree_skb(skb);
2000+ return -EINVAL;
2001+ }
2002+
2003+ /* At the moment only the hardware variant iBT 3.0 (LnP/SfP) is
2004+ * supported by this firmware loading method. This check has been
2005+ * put in place to ensure correct forward compatibility options
2006+ * when newer hardware variants come along.
2007+ */
2008+ if (ver->hw_variant != 0x0b) {
2009+ BT_ERR("%s: Unsupported Intel hardware variant (%u)",
2010+ hdev->name, ver->hw_variant);
2011+ kfree_skb(skb);
2012+ return -EINVAL;
2013+ }
2014+
2015+ btusb_intel_version_info(hdev, ver);
2016+
2017+ /* The firmware variant determines if the device is in bootloader
2018+ * mode or is running operational firmware. The value 0x06 identifies
2019+ * the bootloader and the value 0x23 identifies the operational
2020+ * firmware.
2021+ *
2022+ * When the operational firmware is already present, then only
2023+ * the check for valid Bluetooth device address is needed. This
2024+ * determines if the device will be added as configured or
2025+ * unconfigured controller.
2026+ *
2027+ * It is not possible to use the Secure Boot Parameters in this
2028+ * case since that command is only available in bootloader mode.
2029+ */
2030+ if (ver->fw_variant == 0x23) {
2031+ kfree_skb(skb);
2032+ clear_bit(BTUSB_BOOTLOADER, &data->flags);
2033+ btusb_check_bdaddr_intel(hdev);
2034+ return 0;
2035+ }
2036+
2037+ /* If the device is not in bootloader mode, then the only possible
2038+ * choice is to return an error and abort the device initialization.
2039+ */
2040+ if (ver->fw_variant != 0x06) {
2041+ BT_ERR("%s: Unsupported Intel firmware variant (%u)",
2042+ hdev->name, ver->fw_variant);
2043+ kfree_skb(skb);
2044+ return -ENODEV;
2045+ }
2046+
2047+ kfree_skb(skb);
2048+
2049+ /* Read the secure boot parameters to identify the operating
2050+ * details of the bootloader.
2051+ */
2052+ skb = __hci_cmd_sync(hdev, 0xfc0d, 0, NULL, HCI_INIT_TIMEOUT);
2053+ if (IS_ERR(skb)) {
2054+ BT_ERR("%s: Reading Intel boot parameters failed (%ld)",
2055+ hdev->name, PTR_ERR(skb));
2056+ return PTR_ERR(skb);
2057+ }
2058+
2059+ if (skb->len != sizeof(*params)) {
2060+ BT_ERR("%s: Intel boot parameters size mismatch", hdev->name);
2061+ kfree_skb(skb);
2062+ return -EILSEQ;
2063+ }
2064+
2065+ params = (struct intel_boot_params *)skb->data;
2066+ if (params->status) {
2067+ BT_ERR("%s: Intel boot parameters command failure (%02x)",
2068+ hdev->name, params->status);
2069+ err = -bt_to_errno(params->status);
2070+ kfree_skb(skb);
2071+ return err;
2072+ }
2073+
2074+ BT_INFO("%s: Device revision is %u", hdev->name,
2075+ le16_to_cpu(params->dev_revid));
2076+
2077+ BT_INFO("%s: Secure boot is %s", hdev->name,
2078+ params->secure_boot ? "enabled" : "disabled");
2079+
2080+ BT_INFO("%s: Minimum firmware build %u week %u %u", hdev->name,
2081+ params->min_fw_build_nn, params->min_fw_build_cw,
2082+ 2000 + params->min_fw_build_yy);
2083+
2084+ /* It is required that every single firmware fragment is acknowledged
2085+ * with a command complete event. If the boot parameters indicate
2086+ * that this bootloader does not send them, then abort the setup.
2087+ */
2088+ if (params->limited_cce != 0x00) {
2089+ BT_ERR("%s: Unsupported Intel firmware loading method (%u)",
2090+ hdev->name, params->limited_cce);
2091+ kfree_skb(skb);
2092+ return -EINVAL;
2093+ }
2094+
2095+ /* If the OTP has no valid Bluetooth device address, then there will
2096+ * also be no valid address for the operational firmware.
2097+ */
2098+ if (!bacmp(&params->otp_bdaddr, BDADDR_ANY)) {
2099+ BT_INFO("%s: No device address configured", hdev->name);
2100+ set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
2101+ }
2102+
2103+ /* With this Intel bootloader only the hardware variant and device
2104+ * revision information are used to select the right firmware.
2105+ *
2106+ * Currently this bootloader support is limited to hardware variant
2107+ * iBT 3.0 (LnP/SfP) which is identified by the value 11 (0x0b).
2108+ */
2109+ snprintf(fwname, sizeof(fwname), "intel/ibt-11-%u.sfi",
2110+ le16_to_cpu(params->dev_revid));
2111+
2112+ err = request_firmware(&fw, fwname, &hdev->dev);
2113+ if (err < 0) {
2114+ BT_ERR("%s: Failed to load Intel firmware file (%d)",
2115+ hdev->name, err);
2116+ kfree_skb(skb);
2117+ return err;
2118+ }
2119+
2120+ BT_INFO("%s: Found device firmware: %s", hdev->name, fwname);
2121+
2122+ kfree_skb(skb);
2123+
2124+ if (fw->size < 644) {
2125+ BT_ERR("%s: Invalid size of firmware file (%zu)",
2126+ hdev->name, fw->size);
2127+ err = -EBADF;
2128+ goto done;
2129+ }
2130+
2131+ set_bit(BTUSB_DOWNLOADING, &data->flags);
2132+
2133+ /* Start the firmware download transaction with the Init fragment
2134+ * represented by the 128 bytes of CSS header.
2135+ */
2136+ err = btusb_intel_secure_send(hdev, 0x00, 128, fw->data);
2137+ if (err < 0) {
2138+ BT_ERR("%s: Failed to send firmware header (%d)",
2139+ hdev->name, err);
2140+ goto done;
2141+ }
2142+
2143+ /* Send the 256 bytes of public key information from the firmware
2144+ * as the PKey fragment.
2145+ */
2146+ err = btusb_intel_secure_send(hdev, 0x03, 256, fw->data + 128);
2147+ if (err < 0) {
2148+ BT_ERR("%s: Failed to send firmware public key (%d)",
2149+ hdev->name, err);
2150+ goto done;
2151+ }
2152+
2153+ /* Send the 256 bytes of signature information from the firmware
2154+ * as the Sign fragment.
2155+ */
2156+ err = btusb_intel_secure_send(hdev, 0x02, 256, fw->data + 388);
2157+ if (err < 0) {
2158+ BT_ERR("%s: Failed to send firmware signature (%d)",
2159+ hdev->name, err);
2160+ goto done;
2161+ }
2162+
2163+ fw_ptr = fw->data + 644;
2164+
2165+ while (fw_ptr - fw->data < fw->size) {
2166+ struct hci_command_hdr *cmd = (void *)fw_ptr;
2167+ u8 cmd_len;
2168+
2169+ cmd_len = sizeof(*cmd) + cmd->plen;
2170+
2171+ /* Send each command from the firmware data buffer as
2172+ * a single Data fragment.
2173+ */
2174+ err = btusb_intel_secure_send(hdev, 0x01, cmd_len, fw_ptr);
2175+ if (err < 0) {
2176+ BT_ERR("%s: Failed to send firmware data (%d)",
2177+ hdev->name, err);
2178+ goto done;
2179+ }
2180+
2181+ fw_ptr += cmd_len;
2182+ }
2183+
2184+ set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
2185+
2186+ BT_INFO("%s: Waiting for firmware download to complete", hdev->name);
2187+
2188+ /* Before switching the device into operational mode and with that
2189+ * booting the loaded firmware, wait for the bootloader notification
2190+ * that all fragments have been successfully received.
2191+ *
2192+ * When the event processing receives the notification, then the
2193+ * BTUSB_DOWNLOADING flag will be cleared.
2194+ *
2195+ * The firmware loading should not take longer than 5 seconds
2196+ * and thus just timeout if that happens and fail the setup
2197+ * of this device.
2198+ */
2199+ err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING,
2200+ msecs_to_jiffies(5000),
2201+ TASK_INTERRUPTIBLE);
2202+ if (err == 1) {
2203+ BT_ERR("%s: Firmware loading interrupted", hdev->name);
2204+ err = -EINTR;
2205+ goto done;
2206+ }
2207+
2208+ if (err) {
2209+ BT_ERR("%s: Firmware loading timeout", hdev->name);
2210+ err = -ETIMEDOUT;
2211+ goto done;
2212+ }
2213+
2214+ if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) {
2215+ BT_ERR("%s: Firmware loading failed", hdev->name);
2216+ err = -ENOEXEC;
2217+ goto done;
2218+ }
2219+
2220+ rettime = ktime_get();
2221+ delta = ktime_sub(rettime, calltime);
2222+ duration = (unsigned long long) ktime_to_ns(delta) >> 10;
2223+
2224+ BT_INFO("%s: Firmware loaded in %llu usecs", hdev->name, duration);
2225+
2226+done:
2227+ release_firmware(fw);
2228+
2229+ if (err < 0)
2230+ return err;
2231+
2232+ calltime = ktime_get();
2233+
2234+ set_bit(BTUSB_BOOTING, &data->flags);
2235+
2236+ skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(reset_param), reset_param,
2237+ HCI_INIT_TIMEOUT);
2238+ if (IS_ERR(skb))
2239+ return PTR_ERR(skb);
2240+
2241+ kfree_skb(skb);
2242+
2243+ /* The bootloader will not indicate when the device is ready. This
2244+ * is done by the operational firmware sending bootup notification.
2245+ *
2246+ * Booting into operational firmware should not take longer than
2247+ * 1 second. However if that happens, then just fail the setup
2248+ * since something went wrong.
2249+ */
2250+ BT_INFO("%s: Waiting for device to boot", hdev->name);
2251+
2252+ err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_BOOTING,
2253+ msecs_to_jiffies(1000),
2254+ TASK_INTERRUPTIBLE);
2255+
2256+ if (err == 1) {
2257+ BT_ERR("%s: Device boot interrupted", hdev->name);
2258+ return -EINTR;
2259+ }
2260+
2261+ if (err) {
2262+ BT_ERR("%s: Device boot timeout", hdev->name);
2263+ return -ETIMEDOUT;
2264+ }
2265+
2266+ rettime = ktime_get();
2267+ delta = ktime_sub(rettime, calltime);
2268+ duration = (unsigned long long) ktime_to_ns(delta) >> 10;
2269+
2270+ BT_INFO("%s: Device booted in %llu usecs", hdev->name, duration);
2271+
2272+ clear_bit(BTUSB_BOOTLOADER, &data->flags);
2273+
2274+ return 0;
2275+}
2276+
2277+static void btusb_hw_error_intel(struct hci_dev *hdev, u8 code)
2278+{
2279+ struct sk_buff *skb;
2280+ u8 type = 0x00;
2281+
2282+ BT_ERR("%s: Hardware error 0x%2.2x", hdev->name, code);
2283+
2284+ skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
2285+ if (IS_ERR(skb)) {
2286+ BT_ERR("%s: Reset after hardware error failed (%ld)",
2287+ hdev->name, PTR_ERR(skb));
2288+ return;
2289+ }
2290+ kfree_skb(skb);
2291+
2292+ skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT);
2293+ if (IS_ERR(skb)) {
2294+ BT_ERR("%s: Retrieving Intel exception info failed (%ld)",
2295+ hdev->name, PTR_ERR(skb));
2296+ return;
2297+ }
2298+
2299+ if (skb->len != 13) {
2300+ BT_ERR("%s: Exception info size mismatch", hdev->name);
2301+ kfree_skb(skb);
2302+ return;
2303+ }
2304+
2305+ if (skb->data[0] != 0x00) {
2306+ BT_ERR("%s: Exception info command failure (%02x)",
2307+ hdev->name, skb->data[0]);
2308+ kfree_skb(skb);
2309+ return;
2310+ }
2311+
2312+ BT_ERR("%s: Exception info %s", hdev->name, (char *)(skb->data + 1));
2313+
2314+ kfree_skb(skb);
2315+}
2316+
17012317 static int btusb_set_bdaddr_intel(struct hci_dev *hdev, const bdaddr_t *bdaddr)
17022318 {
17032319 struct sk_buff *skb;
@@ -1943,6 +2559,31 @@ static int btusb_set_bdaddr_bcm(struct hci_dev *hdev, const bdaddr_t *bdaddr) · 239 unmodified lines
19432559 return 0;
19442560 }
19452561
2562+static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev,
2563+ const bdaddr_t *bdaddr)
2564+{
2565+ struct sk_buff *skb;
2566+ u8 buf[10];
2567+ long ret;
2568+
2569+ buf[0] = 0x01;
2570+ buf[1] = 0x01;
2571+ buf[2] = 0x00;
2572+ buf[3] = sizeof(bdaddr_t);
2573+ memcpy(buf + 4, bdaddr, sizeof(bdaddr_t));
2574+
2575+ skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);
2576+ if (IS_ERR(skb)) {
2577+ ret = PTR_ERR(skb);
2578+ BT_ERR("%s: Change address command failed (%ld)",
2579+ hdev->name, ret);
2580+ return ret;
2581+ }
2582+ kfree_skb(skb);
2583+
2584+ return 0;
2585+}
2586+
19462587 static int btusb_probe(struct usb_interface *intf,
19472588 const struct usb_device_id *id)
19482589 {
@@ -2003,7 +2644,13 @@ static int btusb_probe(struct usb_interface *intf, · 54 unmodified lines
20032644 if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep)
20042645 return -ENODEV;
20052646
2006− data->cmdreq_type = USB_TYPE_CLASS;
2647+ if (id->driver_info & BTUSB_AMP) {
2648+ data->cmdreq_type = USB_TYPE_CLASS | 0x01;
2649+ data->cmdreq = 0x2b;
2650+ } else {
2651+ data->cmdreq_type = USB_TYPE_CLASS;
2652+ data->cmdreq = 0x00;
2653+ }
20072654
20082655 data->udev = interface_to_usbdev(intf);
20092656 data->intf = intf;
@@ -2019,7 +2666,14 @@ static int btusb_probe(struct usb_interface *intf, · 9 unmodified lines
20192666 init_usb_anchor(&data->isoc_anchor);
20202667 spin_lock_init(&data->rxlock);
20212668
2022− data->recv_bulk = btusb_recv_bulk;
2669+ if (id->driver_info & BTUSB_INTEL_NEW) {
2670+ data->recv_event = btusb_recv_event_intel;
2671+ data->recv_bulk = btusb_recv_bulk_intel;
2672+ set_bit(BTUSB_BOOTLOADER, &data->flags);
2673+ } else {
2674+ data->recv_event = hci_recv_frame;
2675+ data->recv_bulk = btusb_recv_bulk;
2676+ }
20232677
20242678 hdev = hci_alloc_dev();
20252679 if (!hdev)
@@ -2028,6 +2682,11 @@ static int btusb_probe(struct usb_interface *intf, · 2 unmodified lines
20282682 hdev->bus = HCI_USB;
20292683 hci_set_drvdata(hdev, data);
20302684
2685+ if (id->driver_info & BTUSB_AMP)
2686+ hdev->dev_type = HCI_AMP;
2687+ else
2688+ hdev->dev_type = HCI_BREDR;
2689+
20312690 data->hdev = hdev;
20322691
20332692 SET_HCIDEV_DEV(hdev, &intf->dev);
@@ -2050,16 +2709,40 @@ static int btusb_probe(struct usb_interface *intf, · 16 unmodified lines
20502709 if (id->driver_info & BTUSB_INTEL) {
20512710 hdev->setup = btusb_setup_intel;
20522711 hdev->set_bdaddr = btusb_set_bdaddr_intel;
2712+ set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
2713+ }
2714+
2715+ if (id->driver_info & BTUSB_INTEL_NEW) {
2716+ hdev->send = btusb_send_frame_intel;
2717+ hdev->setup = btusb_setup_intel_new;
2718+ hdev->hw_error = btusb_hw_error_intel;
2719+ hdev->set_bdaddr = btusb_set_bdaddr_intel;
2720+ set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
20532721 }
20542722
20552723 if (id->driver_info & BTUSB_MARVELL)
20562724 hdev->set_bdaddr = btusb_set_bdaddr_marvell;
20572725
2726+ if (id->driver_info & BTUSB_SWAVE) {
2727+ set_bit(HCI_QUIRK_FIXUP_INQUIRY_MODE, &hdev->quirks);
2728+ set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);
2729+ }
2730+
20582731 if (id->driver_info & BTUSB_INTEL_BOOT)
20592732 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
20602733
2061− /* Interface numbers are hardcoded in the specification */
2062− data->isoc = usb_ifnum_to_if(data->udev, 1);
2734+ if (id->driver_info & BTUSB_ATH3012) {
2735+ hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
2736+ set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
2737+ }
2738+
2739+ if (id->driver_info & BTUSB_AMP) {
2740+ /* AMP controllers do not support SCO packets */
2741+ data->isoc = NULL;
2742+ } else {
2743+ /* Interface numbers are hardcoded in the specification */
2744+ data->isoc = usb_ifnum_to_if(data->udev, 1);
2745+ }
20632746
20642747 if (!reset)
20652748 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
@@ -2153,7 +2836,6 @@ static void btusb_disconnect(struct usb_interface *intf) · 87 unmodified lines
21532836 else if (data->isoc)
21542837 usb_driver_release_interface(&btusb_driver, data->isoc);
21552838
2156− btusb_free_frags(data);
21572839 hci_free_dev(hdev);
21582840 }
21592841
drivers/clk/rockchip/clk-rk3288.c+7−7
@@ -190,7 +190,7 @@ PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" }; · 189 unmodified lines
190190 PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" };
191191 PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" };
192192 PNAME(mux_cif_out_p) = { "cif_src", "xin24m" };
193−PNAME(mux_macref_p) = { "mac_src", "ext_gmac" };
193+PNAME(mux_mac_p) = { "mac_pll_src", "ext_gmac" };
194194 PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" };
195195 PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" };
196196 PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" };
@@ -575,18 +575,18 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { · 378 unmodified lines
575575 MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, 0,
576576 RK3288_CLKSEL_CON(3), 8, 2, MFLAGS),
577577
578− COMPOSITE(0, "mac_src", mux_pll_src_npll_cpll_gpll_p, 0,
578+ COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0,
579579 RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS,
580580 RK3288_CLKGATE_CON(2), 5, GFLAGS),
581− MUX(0, "macref", mux_macref_p, 0,
581+ MUX(SCLK_MAC, "mac_clk", mux_mac_p, 0,
582582 RK3288_CLKSEL_CON(21), 4, 1, MFLAGS),
583− GATE(0, "sclk_macref_out", "macref", 0,
583+ GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 0,
584584 RK3288_CLKGATE_CON(5), 3, GFLAGS),
585− GATE(SCLK_MACREF, "sclk_macref", "macref", 0,
585+ GATE(SCLK_MACREF, "sclk_macref", "mac_clk", 0,
586586 RK3288_CLKGATE_CON(5), 2, GFLAGS),
587− GATE(SCLK_MAC_RX, "sclk_mac_rx", "macref", 0,
587+ GATE(SCLK_MAC_RX, "sclk_mac_rx", "mac_clk", 0,
588588 RK3288_CLKGATE_CON(5), 0, GFLAGS),
589− GATE(SCLK_MAC_TX, "sclk_mac_tx", "macref", 0,
589+ GATE(SCLK_MAC_TX, "sclk_mac_tx", "mac_clk", 0,
590590 RK3288_CLKGATE_CON(5), 1, GFLAGS),
591591
592592 COMPOSITE(0, "hsadc_src", mux_pll_src_cpll_gpll_p, 0,
drivers/clocksource/arm_arch_timer.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/cpu.h>
1616 #include <linux/cpu_pm.h>
1717 #include <linux/clockchips.h>
18+#include <linux/clocksource.h>
1819 #include <linux/interrupt.h>
1920 #include <linux/of_irq.h>
2021 #include <linux/of_address.h>
drivers/infiniband/hw/cxgb4/cm.c+59−59
@@ -235,19 +235,19 @@ static void release_tid(struct c4iw_rdev *rdev, u32 hwtid, struct sk_buff *skb) · 234 unmodified lines
235235
236236 static void set_emss(struct c4iw_ep *ep, u16 opt)
237237 {
238− ep->emss = ep->com.dev->rdev.lldi.mtus[GET_TCPOPT_MSS(opt)] -
238+ ep->emss = ep->com.dev->rdev.lldi.mtus[TCPOPT_MSS_G(opt)] -
239239 ((AF_INET == ep->com.remote_addr.ss_family) ?
240240 sizeof(struct iphdr) : sizeof(struct ipv6hdr)) -
241241 sizeof(struct tcphdr);
242242 ep->mss = ep->emss;
243− if (GET_TCPOPT_TSTAMP(opt))
243+ if (TCPOPT_TSTAMP_G(opt))
244244 ep->emss -= round_up(TCPOLEN_TIMESTAMP, 4);
245245 if (ep->emss < 128)
246246 ep->emss = 128;
247247 if (ep->emss & 7)
248248 PDBG("Warning: misaligned mtu idx %u mss %u emss=%u\n",
249− GET_TCPOPT_MSS(opt), ep->mss, ep->emss);
250− PDBG("%s mss_idx %u mss %u emss=%u\n", __func__, GET_TCPOPT_MSS(opt),
249+ TCPOPT_MSS_G(opt), ep->mss, ep->emss);
250+ PDBG("%s mss_idx %u mss %u emss=%u\n", __func__, TCPOPT_MSS_G(opt),
251251 ep->mss, ep->emss);
252252 }
253253
@@ -652,29 +652,29 @@ static int send_connect(struct c4iw_ep *ep) · 398 unmodified lines
652652 if (win > RCV_BUFSIZ_M)
653653 win = RCV_BUFSIZ_M;
654654
655− opt0 = (nocong ? NO_CONG(1) : 0) |
655+ opt0 = (nocong ? NO_CONG_F : 0) |
656656 KEEP_ALIVE_F |
657− DELACK(1) |
657+ DELACK_F |
658658 WND_SCALE_V(wscale) |
659659 MSS_IDX_V(mtu_idx) |
660660 L2T_IDX_V(ep->l2t->idx) |
661661 TX_CHAN_V(ep->tx_chan) |
662662 SMAC_SEL_V(ep->smac_idx) |
663− DSCP(ep->tos) |
663+ DSCP_V(ep->tos) |
664664 ULP_MODE_V(ULP_MODE_TCPDDP) |
665665 RCV_BUFSIZ_V(win);
666666 opt2 = RX_CHANNEL_V(0) |
667− CCTRL_ECN(enable_ecn) |
667+ CCTRL_ECN_V(enable_ecn) |
668668 RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid);
669669 if (enable_tcp_timestamps)
670− opt2 |= TSTAMPS_EN(1);
670+ opt2 |= TSTAMPS_EN_F;
671671 if (enable_tcp_sack)
672− opt2 |= SACK_EN(1);
672+ opt2 |= SACK_EN_F;
673673 if (wscale && enable_tcp_window_scaling)
674674 opt2 |= WND_SCALE_EN_F;
675675 if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) {
676676 opt2 |= T5_OPT_2_VALID_F;
677− opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE);
677+ opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE);
678678 opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */
679679 }
680680 t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure);
@@ -1042,7 +1042,7 @@ static int act_establish(struct c4iw_dev *dev, struct sk_buff *skb) · 361 unmodified lines
10421042 struct c4iw_ep *ep;
10431043 struct cpl_act_establish *req = cplhdr(skb);
10441044 unsigned int tid = GET_TID(req);
1045− unsigned int atid = GET_TID_TID(ntohl(req->tos_atid));
1045+ unsigned int atid = TID_TID_G(ntohl(req->tos_atid));
10461046 struct tid_info *t = dev->rdev.lldi.tids;
10471047
10481048 ep = lookup_atid(t, atid);
@@ -1258,8 +1258,8 @@ static int update_rx_credits(struct c4iw_ep *ep, u32 credits) · 209 unmodified lines
12581258 OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK,
12591259 ep->hwtid));
12601260 req->credit_dack = cpu_to_be32(credits | RX_FORCE_ACK_F |
1261− F_RX_DACK_CHANGE |
1262− V_RX_DACK_MODE(dack_mode));
1261+ RX_DACK_CHANGE_F |
1262+ RX_DACK_MODE_V(dack_mode));
12631263 set_wr_txq(skb, CPL_PRIORITY_ACK, ep->ctrlq_idx);
12641264 c4iw_ofld_send(&ep->com.dev->rdev, skb);
12651265 return credits;
@@ -1751,7 +1751,7 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) · 485 unmodified lines
17511751 skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
17521752 req = (struct fw_ofld_connection_wr *)__skb_put(skb, sizeof(*req));
17531753 memset(req, 0, sizeof(*req));
1754− req->op_compl = htonl(V_WR_OP(FW_OFLD_CONNECTION_WR));
1754+ req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
17551755 req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
17561756 req->le.filter = cpu_to_be32(cxgb4_select_ntuple(
17571757 ep->com.dev->rdev.lldi.ports[0],
@@ -1782,27 +1782,27 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) · 24 unmodified lines
17821782 if (win > RCV_BUFSIZ_M)
17831783 win = RCV_BUFSIZ_M;
17841784
1785− req->tcb.opt0 = (__force __be64) (TCAM_BYPASS(1) |
1786− (nocong ? NO_CONG(1) : 0) |
1785+ req->tcb.opt0 = (__force __be64) (TCAM_BYPASS_F |
1786+ (nocong ? NO_CONG_F : 0) |
17871787 KEEP_ALIVE_F |
1788− DELACK(1) |
1788+ DELACK_F |
17891789 WND_SCALE_V(wscale) |
17901790 MSS_IDX_V(mtu_idx) |
17911791 L2T_IDX_V(ep->l2t->idx) |
17921792 TX_CHAN_V(ep->tx_chan) |
17931793 SMAC_SEL_V(ep->smac_idx) |
1794− DSCP(ep->tos) |
1794+ DSCP_V(ep->tos) |
17951795 ULP_MODE_V(ULP_MODE_TCPDDP) |
17961796 RCV_BUFSIZ_V(win));
1797− req->tcb.opt2 = (__force __be32) (PACE(1) |
1798− TX_QUEUE(ep->com.dev->rdev.lldi.tx_modq[ep->tx_chan]) |
1797+ req->tcb.opt2 = (__force __be32) (PACE_V(1) |
1798+ TX_QUEUE_V(ep->com.dev->rdev.lldi.tx_modq[ep->tx_chan]) |
17991799 RX_CHANNEL_V(0) |
1800− CCTRL_ECN(enable_ecn) |
1800+ CCTRL_ECN_V(enable_ecn) |
18011801 RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid));
18021802 if (enable_tcp_timestamps)
1803− req->tcb.opt2 |= (__force __be32)TSTAMPS_EN(1);
1803+ req->tcb.opt2 |= (__force __be32)TSTAMPS_EN_F;
18041804 if (enable_tcp_sack)
1805− req->tcb.opt2 |= (__force __be32)SACK_EN(1);
1805+ req->tcb.opt2 |= (__force __be32)SACK_EN_F;
18061806 if (wscale && enable_tcp_window_scaling)
18071807 req->tcb.opt2 |= (__force __be32)WND_SCALE_EN_F;
18081808 req->tcb.opt0 = cpu_to_be64((__force u64)req->tcb.opt0);
@@ -2023,10 +2023,10 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) · 214 unmodified lines
20232023 {
20242024 struct c4iw_ep *ep;
20252025 struct cpl_act_open_rpl *rpl = cplhdr(skb);
2026− unsigned int atid = GET_TID_TID(GET_AOPEN_ATID(
2027− ntohl(rpl->atid_status)));
2026+ unsigned int atid = TID_TID_G(AOPEN_ATID_G(
2027+ ntohl(rpl->atid_status)));
20282028 struct tid_info *t = dev->rdev.lldi.tids;
2029− int status = GET_AOPEN_STATUS(ntohl(rpl->atid_status));
2029+ int status = AOPEN_STATUS_G(ntohl(rpl->atid_status));
20302030 struct sockaddr_in *la;
20312031 struct sockaddr_in *ra;
20322032 struct sockaddr_in6 *la6;
@@ -2064,7 +2064,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) · 31 unmodified lines
20642064 if (ep->com.local_addr.ss_family == AF_INET &&
20652065 dev->rdev.lldi.enable_fw_ofld_conn) {
20662066 send_fw_act_open_req(ep,
2067− GET_TID_TID(GET_AOPEN_ATID(
2067+ TID_TID_G(AOPEN_ATID_G(
20682068 ntohl(rpl->atid_status))));
20692069 return 0;
20702070 }
@@ -2181,39 +2181,39 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, · 110 unmodified lines
21812181 win = ep->rcv_win >> 10;
21822182 if (win > RCV_BUFSIZ_M)
21832183 win = RCV_BUFSIZ_M;
2184− opt0 = (nocong ? NO_CONG(1) : 0) |
2184+ opt0 = (nocong ? NO_CONG_F : 0) |
21852185 KEEP_ALIVE_F |
2186− DELACK(1) |
2186+ DELACK_F |
21872187 WND_SCALE_V(wscale) |
21882188 MSS_IDX_V(mtu_idx) |
21892189 L2T_IDX_V(ep->l2t->idx) |
21902190 TX_CHAN_V(ep->tx_chan) |
21912191 SMAC_SEL_V(ep->smac_idx) |
2192− DSCP(ep->tos >> 2) |
2192+ DSCP_V(ep->tos >> 2) |
21932193 ULP_MODE_V(ULP_MODE_TCPDDP) |
21942194 RCV_BUFSIZ_V(win);
21952195 opt2 = RX_CHANNEL_V(0) |
21962196 RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid);
21972197
21982198 if (enable_tcp_timestamps && req->tcpopt.tstamp)
2199− opt2 |= TSTAMPS_EN(1);
2199+ opt2 |= TSTAMPS_EN_F;
22002200 if (enable_tcp_sack && req->tcpopt.sack)
2201− opt2 |= SACK_EN(1);
2201+ opt2 |= SACK_EN_F;
22022202 if (wscale && enable_tcp_window_scaling)
22032203 opt2 |= WND_SCALE_EN_F;
22042204 if (enable_ecn) {
22052205 const struct tcphdr *tcph;
22062206 u32 hlen = ntohl(req->hdr_len);
22072207
2208− tcph = (const void *)(req + 1) + G_ETH_HDR_LEN(hlen) +
2209− G_IP_HDR_LEN(hlen);
2208+ tcph = (const void *)(req + 1) + ETH_HDR_LEN_G(hlen) +
2209+ IP_HDR_LEN_G(hlen);
22102210 if (tcph->ece && tcph->cwr)
2211− opt2 |= CCTRL_ECN(1);
2211+ opt2 |= CCTRL_ECN_V(1);
22122212 }
22132213 if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) {
22142214 u32 isn = (prandom_u32() & ~7UL) - 1;
22152215 opt2 |= T5_OPT_2_VALID_F;
2216− opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE);
2216+ opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE);
22172217 opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */
22182218 rpl5 = (void *)rpl;
22192219 memset(&rpl5->iss, 0, roundup(sizeof(*rpl5)-sizeof(*rpl), 16));
@@ -2245,8 +2245,8 @@ static void get_4tuple(struct cpl_pass_accept_req *req, int *iptype, · 25 unmodified lines
22452245 __u8 *local_ip, __u8 *peer_ip,
22462246 __be16 *local_port, __be16 *peer_port)
22472247 {
2248− int eth_len = G_ETH_HDR_LEN(be32_to_cpu(req->hdr_len));
2249− int ip_len = G_IP_HDR_LEN(be32_to_cpu(req->hdr_len));
2248+ int eth_len = ETH_HDR_LEN_G(be32_to_cpu(req->hdr_len));
2249+ int ip_len = IP_HDR_LEN_G(be32_to_cpu(req->hdr_len));
22502250 struct iphdr *ip = (struct iphdr *)((u8 *)(req + 1) + eth_len);
22512251 struct ipv6hdr *ip6 = (struct ipv6hdr *)((u8 *)(req + 1) + eth_len);
22522252 struct tcphdr *tcp = (struct tcphdr *)
@@ -2277,7 +2277,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) · 24 unmodified lines
22772277 {
22782278 struct c4iw_ep *child_ep = NULL, *parent_ep;
22792279 struct cpl_pass_accept_req *req = cplhdr(skb);
2280− unsigned int stid = GET_POPEN_TID(ntohl(req->tos_stid));
2280+ unsigned int stid = PASS_OPEN_TID_G(ntohl(req->tos_stid));
22812281 struct tid_info *t = dev->rdev.lldi.tids;
22822282 unsigned int hwtid = GET_TID(req);
22832283 struct dst_entry *dst;
@@ -2310,14 +2310,14 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) · 26 unmodified lines
23102310 ntohs(peer_port), peer_mss);
23112311 dst = find_route(dev, *(__be32 *)local_ip, *(__be32 *)peer_ip,
23122312 local_port, peer_port,
2313− GET_POPEN_TOS(ntohl(req->tos_stid)));
2313+ PASS_OPEN_TOS_G(ntohl(req->tos_stid)));
23142314 } else {
23152315 PDBG("%s parent ep %p hwtid %u laddr %pI6 raddr %pI6 lport %d rport %d peer_mss %d\n"
23162316 , __func__, parent_ep, hwtid,
23172317 local_ip, peer_ip, ntohs(local_port),
23182318 ntohs(peer_port), peer_mss);
23192319 dst = find_route6(dev, local_ip, peer_ip, local_port, peer_port,
2320− PASS_OPEN_TOS(ntohl(req->tos_stid)),
2320+ PASS_OPEN_TOS_G(ntohl(req->tos_stid)),
23212321 ((struct sockaddr_in6 *)
23222322 &parent_ep->com.local_addr)->sin6_scope_id);
23232323 }
@@ -2375,7 +2375,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) · 51 unmodified lines
23752375 }
23762376 c4iw_get_ep(&parent_ep->com);
23772377 child_ep->parent_ep = parent_ep;
2378− child_ep->tos = GET_POPEN_TOS(ntohl(req->tos_stid));
2378+ child_ep->tos = PASS_OPEN_TOS_G(ntohl(req->tos_stid));
23792379 child_ep->dst = dst;
23802380 child_ep->hwtid = hwtid;
23812381
@@ -3500,24 +3500,24 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos) · 1118 unmodified lines
35003500
35013501 req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req));
35023502 memset(req, 0, sizeof(*req));
3503− req->l2info = cpu_to_be16(V_SYN_INTF(intf) |
3504− V_SYN_MAC_IDX(G_RX_MACIDX(
3503+ req->l2info = cpu_to_be16(SYN_INTF_V(intf) |
3504+ SYN_MAC_IDX_V(RX_MACIDX_G(
35053505 (__force int) htonl(l2info))) |
3506− F_SYN_XACT_MATCH);
3506+ SYN_XACT_MATCH_F);
35073507 eth_hdr_len = is_t4(dev->rdev.lldi.adapter_type) ?
3508− G_RX_ETHHDR_LEN((__force int) htonl(l2info)) :
3509− G_RX_T5_ETHHDR_LEN((__force int) htonl(l2info));
3510− req->hdr_len = cpu_to_be32(V_SYN_RX_CHAN(G_RX_CHAN(
3508+ RX_ETHHDR_LEN_G((__force int)htonl(l2info)) :
3509+ RX_T5_ETHHDR_LEN_G((__force int)htonl(l2info));
3510+ req->hdr_len = cpu_to_be32(SYN_RX_CHAN_V(RX_CHAN_G(
35113511 (__force int) htonl(l2info))) |
3512− V_TCP_HDR_LEN(G_RX_TCPHDR_LEN(
3512+ TCP_HDR_LEN_V(RX_TCPHDR_LEN_G(
35133513 (__force int) htons(hdr_len))) |
3514− V_IP_HDR_LEN(G_RX_IPHDR_LEN(
3514+ IP_HDR_LEN_V(RX_IPHDR_LEN_G(
35153515 (__force int) htons(hdr_len))) |
3516− V_ETH_HDR_LEN(G_RX_ETHHDR_LEN(eth_hdr_len)));
3516+ ETH_HDR_LEN_V(RX_ETHHDR_LEN_G(eth_hdr_len)));
35173517 req->vlan = (__force __be16) vlantag;
35183518 req->len = (__force __be16) len;
3519− req->tos_stid = cpu_to_be32(PASS_OPEN_TID(stid) |
3520− PASS_OPEN_TOS(tos));
3519+ req->tos_stid = cpu_to_be32(PASS_OPEN_TID_V(stid) |
3520+ PASS_OPEN_TOS_V(tos));
35213521 req->tcpopt.mss = htons(tmp_opt.mss_clamp);
35223522 if (tmp_opt.wscale_ok)
35233523 req->tcpopt.wsf = tmp_opt.snd_wscale;
@@ -3542,7 +3542,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, · 18 unmodified lines
35423542 req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL);
35433543 req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req));
35443544 memset(req, 0, sizeof(*req));
3545− req->op_compl = htonl(V_WR_OP(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F);
3545+ req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F);
35463546 req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
35473547 req->le.version_cpl = htonl(FW_OFLD_CONNECTION_WR_CPL_F);
35483548 req->le.filter = (__force __be32) filter;
@@ -3556,7 +3556,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, · 7 unmodified lines
35563556 htonl(FW_OFLD_CONNECTION_WR_T_STATE_V(TCP_SYN_RECV) |
35573557 FW_OFLD_CONNECTION_WR_RCV_SCALE_V(cpl->tcpopt.wsf) |
35583558 FW_OFLD_CONNECTION_WR_ASTID_V(
3559− GET_PASS_OPEN_TID(ntohl(cpl->tos_stid))));
3559+ PASS_OPEN_TID_G(ntohl(cpl->tos_stid))));
35603560
35613561 /*
35623562 * We store the qid in opt2 which will be used by the firmware
@@ -3613,7 +3613,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) · 50 unmodified lines
36133613 struct neighbour *neigh;
36143614
36153615 /* Drop all non-SYN packets */
3616− if (!(cpl->l2info & cpu_to_be32(F_RXF_SYN)))
3616+ if (!(cpl->l2info & cpu_to_be32(RXF_SYN_F)))
36173617 goto reject;
36183618
36193619 /*
@@ -3635,8 +3635,8 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) · 15 unmodified lines
36353635 }
36363636
36373637 eth_hdr_len = is_t4(dev->rdev.lldi.adapter_type) ?
3638− G_RX_ETHHDR_LEN(htonl(cpl->l2info)) :
3639− G_RX_T5_ETHHDR_LEN(htonl(cpl->l2info));
3638+ RX_ETHHDR_LEN_G(htonl(cpl->l2info)) :
3639+ RX_T5_ETHHDR_LEN_G(htonl(cpl->l2info));
36403640 if (eth_hdr_len == ETH_HLEN) {
36413641 eh = (struct ethhdr *)(req + 1);
36423642 iph = (struct iphdr *)(eh + 1);
drivers/infiniband/hw/cxgb4/cq.c+30−30
@@ -52,7 +52,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 51 unmodified lines
5252 memset(res_wr, 0, wr_len);
5353 res_wr->op_nres = cpu_to_be32(
5454 FW_WR_OP_V(FW_RI_RES_WR) |
55− V_FW_RI_RES_WR_NRES(1) |
55+ FW_RI_RES_WR_NRES_V(1) |
5656 FW_WR_COMPL_F);
5757 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16));
5858 res_wr->cookie = (unsigned long) &wr_wait;
@@ -122,7 +122,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 63 unmodified lines
122122 memset(res_wr, 0, wr_len);
123123 res_wr->op_nres = cpu_to_be32(
124124 FW_WR_OP_V(FW_RI_RES_WR) |
125− V_FW_RI_RES_WR_NRES(1) |
125+ FW_RI_RES_WR_NRES_V(1) |
126126 FW_WR_COMPL_F);
127127 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16));
128128 res_wr->cookie = (unsigned long) &wr_wait;
@@ -131,17 +131,17 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 2 unmodified lines
131131 res->u.cq.op = FW_RI_RES_OP_WRITE;
132132 res->u.cq.iqid = cpu_to_be32(cq->cqid);
133133 res->u.cq.iqandst_to_iqandstindex = cpu_to_be32(
134− V_FW_RI_RES_WR_IQANUS(0) |
135− V_FW_RI_RES_WR_IQANUD(1) |
136− F_FW_RI_RES_WR_IQANDST |
137− V_FW_RI_RES_WR_IQANDSTINDEX(
134+ FW_RI_RES_WR_IQANUS_V(0) |
135+ FW_RI_RES_WR_IQANUD_V(1) |
136+ FW_RI_RES_WR_IQANDST_F |
137+ FW_RI_RES_WR_IQANDSTINDEX_V(
138138 rdev->lldi.ciq_ids[cq->vector]));
139139 res->u.cq.iqdroprss_to_iqesize = cpu_to_be16(
140− F_FW_RI_RES_WR_IQDROPRSS |
141− V_FW_RI_RES_WR_IQPCIECH(2) |
142− V_FW_RI_RES_WR_IQINTCNTTHRESH(0) |
143− F_FW_RI_RES_WR_IQO |
144− V_FW_RI_RES_WR_IQESIZE(1));
140+ FW_RI_RES_WR_IQDROPRSS_F |
141+ FW_RI_RES_WR_IQPCIECH_V(2) |
142+ FW_RI_RES_WR_IQINTCNTTHRESH_V(0) |
143+ FW_RI_RES_WR_IQO_F |
144+ FW_RI_RES_WR_IQESIZE_V(1));
145145 res->u.cq.iqsize = cpu_to_be16(cq->size);
146146 res->u.cq.iqaddr = cpu_to_be64(cq->dma_addr);
147147
@@ -182,12 +182,12 @@ static void insert_recv_cqe(struct t4_wq *wq, struct t4_cq *cq) · 34 unmodified lines
182182 PDBG("%s wq %p cq %p sw_cidx %u sw_pidx %u\n", __func__,
183183 wq, cq, cq->sw_cidx, cq->sw_pidx);
184184 memset(&cqe, 0, sizeof(cqe));
185− cqe.header = cpu_to_be32(V_CQE_STATUS(T4_ERR_SWFLUSH) |
186− V_CQE_OPCODE(FW_RI_SEND) |
187− V_CQE_TYPE(0) |
188− V_CQE_SWCQE(1) |
189− V_CQE_QPID(wq->sq.qid));
190− cqe.bits_type_ts = cpu_to_be64(V_CQE_GENBIT((u64)cq->gen));
185+ cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) |
186+ CQE_OPCODE_V(FW_RI_SEND) |
187+ CQE_TYPE_V(0) |
188+ CQE_SWCQE_V(1) |
189+ CQE_QPID_V(wq->sq.qid));
190+ cqe.bits_type_ts = cpu_to_be64(CQE_GENBIT_V((u64)cq->gen));
191191 cq->sw_queue[cq->sw_pidx] = cqe;
192192 t4_swcq_produce(cq);
193193 }
@@ -215,13 +215,13 @@ static void insert_sq_cqe(struct t4_wq *wq, struct t4_cq *cq, · 21 unmodified lines
215215 PDBG("%s wq %p cq %p sw_cidx %u sw_pidx %u\n", __func__,
216216 wq, cq, cq->sw_cidx, cq->sw_pidx);
217217 memset(&cqe, 0, sizeof(cqe));
218− cqe.header = cpu_to_be32(V_CQE_STATUS(T4_ERR_SWFLUSH) |
219− V_CQE_OPCODE(swcqe->opcode) |
220− V_CQE_TYPE(1) |
221− V_CQE_SWCQE(1) |
222− V_CQE_QPID(wq->sq.qid));
218+ cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) |
219+ CQE_OPCODE_V(swcqe->opcode) |
220+ CQE_TYPE_V(1) |
221+ CQE_SWCQE_V(1) |
222+ CQE_QPID_V(wq->sq.qid));
223223 CQE_WRID_SQ_IDX(&cqe) = swcqe->idx;
224− cqe.bits_type_ts = cpu_to_be64(V_CQE_GENBIT((u64)cq->gen));
224+ cqe.bits_type_ts = cpu_to_be64(CQE_GENBIT_V((u64)cq->gen));
225225 cq->sw_queue[cq->sw_pidx] = cqe;
226226 t4_swcq_produce(cq);
227227 }
@@ -284,7 +284,7 @@ static void flush_completed_wrs(struct t4_wq *wq, struct t4_cq *cq) · 56 unmodified lines
284284 */
285285 PDBG("%s moving cqe into swcq sq idx %u cq idx %u\n",
286286 __func__, cidx, cq->sw_pidx);
287− swsqe->cqe.header |= htonl(V_CQE_SWCQE(1));
287+ swsqe->cqe.header |= htonl(CQE_SWCQE_V(1));
288288 cq->sw_queue[cq->sw_pidx] = swsqe->cqe;
289289 t4_swcq_produce(cq);
290290 swsqe->flushed = 1;
@@ -301,10 +301,10 @@ static void create_read_req_cqe(struct t4_wq *wq, struct t4_cqe *hw_cqe, · 10 unmodified lines
301301 {
302302 read_cqe->u.scqe.cidx = wq->sq.oldest_read->idx;
303303 read_cqe->len = htonl(wq->sq.oldest_read->read_len);
304− read_cqe->header = htonl(V_CQE_QPID(CQE_QPID(hw_cqe)) |
305− V_CQE_SWCQE(SW_CQE(hw_cqe)) |
306− V_CQE_OPCODE(FW_RI_READ_REQ) |
307− V_CQE_TYPE(1));
304+ read_cqe->header = htonl(CQE_QPID_V(CQE_QPID(hw_cqe)) |
305+ CQE_SWCQE_V(SW_CQE(hw_cqe)) |
306+ CQE_OPCODE_V(FW_RI_READ_REQ) |
307+ CQE_TYPE_V(1));
308308 read_cqe->bits_type_ts = hw_cqe->bits_type_ts;
309309 }
310310
@@ -400,7 +400,7 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp) · 89 unmodified lines
400400 } else {
401401 swcqe = &chp->cq.sw_queue[chp->cq.sw_pidx];
402402 *swcqe = *hw_cqe;
403− swcqe->header |= cpu_to_be32(V_CQE_SWCQE(1));
403+ swcqe->header |= cpu_to_be32(CQE_SWCQE_V(1));
404404 t4_swcq_produce(&chp->cq);
405405 }
406406 next_cqe:
@@ -576,7 +576,7 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe, · 169 unmodified lines
576576 }
577577 if (unlikely((CQE_WRID_MSN(hw_cqe) != (wq->rq.msn)))) {
578578 t4_set_wq_in_error(wq);
579− hw_cqe->header |= htonl(V_CQE_STATUS(T4_ERR_MSN));
579+ hw_cqe->header |= htonl(CQE_STATUS_V(T4_ERR_MSN));
580580 goto proc_cqe;
581581 }
582582 goto proc_cqe;
drivers/infiniband/hw/cxgb4/device.c+6−6
@@ -380,12 +380,12 @@ static int dump_stag(int id, void *p, void *data) · 379 unmodified lines
380380 "stag: idx 0x%x valid %d key 0x%x state %d pdid %d "
381381 "perm 0x%x ps %d len 0x%llx va 0x%llx\n",
382382 (u32)id<<8,
383− G_FW_RI_TPTE_VALID(ntohl(tpte.valid_to_pdid)),
384− G_FW_RI_TPTE_STAGKEY(ntohl(tpte.valid_to_pdid)),
385− G_FW_RI_TPTE_STAGSTATE(ntohl(tpte.valid_to_pdid)),
386− G_FW_RI_TPTE_PDID(ntohl(tpte.valid_to_pdid)),
387− G_FW_RI_TPTE_PERM(ntohl(tpte.locread_to_qpid)),
388− G_FW_RI_TPTE_PS(ntohl(tpte.locread_to_qpid)),
383+ FW_RI_TPTE_VALID_G(ntohl(tpte.valid_to_pdid)),
384+ FW_RI_TPTE_STAGKEY_G(ntohl(tpte.valid_to_pdid)),
385+ FW_RI_TPTE_STAGSTATE_G(ntohl(tpte.valid_to_pdid)),
386+ FW_RI_TPTE_PDID_G(ntohl(tpte.valid_to_pdid)),
387+ FW_RI_TPTE_PERM_G(ntohl(tpte.locread_to_qpid)),
388+ FW_RI_TPTE_PS_G(ntohl(tpte.locread_to_qpid)),
389389 ((u64)ntohl(tpte.len_hi) << 32) | ntohl(tpte.len_lo),
390390 ((u64)ntohl(tpte.va_hi) << 32) | ntohl(tpte.va_lo_fbo));
391391 if (cc < space)
drivers/infiniband/hw/cxgb4/ev.c+6−6
@@ -50,12 +50,12 @@ static void print_tpte(struct c4iw_dev *dev, u32 stag) · 49 unmodified lines
5050 PDBG("stag idx 0x%x valid %d key 0x%x state %d pdid %d "
5151 "perm 0x%x ps %d len 0x%llx va 0x%llx\n",
5252 stag & 0xffffff00,
53− G_FW_RI_TPTE_VALID(ntohl(tpte.valid_to_pdid)),
54− G_FW_RI_TPTE_STAGKEY(ntohl(tpte.valid_to_pdid)),
55− G_FW_RI_TPTE_STAGSTATE(ntohl(tpte.valid_to_pdid)),
56− G_FW_RI_TPTE_PDID(ntohl(tpte.valid_to_pdid)),
57− G_FW_RI_TPTE_PERM(ntohl(tpte.locread_to_qpid)),
58− G_FW_RI_TPTE_PS(ntohl(tpte.locread_to_qpid)),
53+ FW_RI_TPTE_VALID_G(ntohl(tpte.valid_to_pdid)),
54+ FW_RI_TPTE_STAGKEY_G(ntohl(tpte.valid_to_pdid)),
55+ FW_RI_TPTE_STAGSTATE_G(ntohl(tpte.valid_to_pdid)),
56+ FW_RI_TPTE_PDID_G(ntohl(tpte.valid_to_pdid)),
57+ FW_RI_TPTE_PERM_G(ntohl(tpte.locread_to_qpid)),
58+ FW_RI_TPTE_PS_G(ntohl(tpte.locread_to_qpid)),
5959 ((u64)ntohl(tpte.len_hi) << 32) | ntohl(tpte.len_lo),
6060 ((u64)ntohl(tpte.va_hi) << 32) | ntohl(tpte.va_lo_fbo));
6161 }
drivers/infiniband/hw/cxgb4/mem.c+11−11
@@ -86,14 +86,14 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr, · 85 unmodified lines
8686 req->wr.wr_lo = wait ? (__force __be64)(unsigned long) &wr_wait : 0L;
8787 req->wr.wr_mid = cpu_to_be32(FW_WR_LEN16_V(DIV_ROUND_UP(wr_len, 16)));
8888 req->cmd = cpu_to_be32(ULPTX_CMD_V(ULP_TX_MEM_WRITE));
89− req->cmd |= cpu_to_be32(V_T5_ULP_MEMIO_ORDER(1));
89+ req->cmd |= cpu_to_be32(T5_ULP_MEMIO_ORDER_V(1));
9090 req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN_V(len>>5));
9191 req->len16 = cpu_to_be32(DIV_ROUND_UP(wr_len-sizeof(req->wr), 16));
9292 req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR_V(addr));
9393
9494 sgl = (struct ulptx_sgl *)(req + 1);
9595 sgl->cmd_nsge = cpu_to_be32(ULPTX_CMD_V(ULP_TX_SC_DSGL) |
96− ULPTX_NSGE(1));
96+ ULPTX_NSGE_V(1));
9797 sgl->len0 = cpu_to_be32(len);
9898 sgl->addr0 = cpu_to_be64(data);
9999
@@ -286,17 +286,17 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, · 186 unmodified lines
286286 if (reset_tpt_entry)
287287 memset(&tpt, 0, sizeof(tpt));
288288 else {
289− tpt.valid_to_pdid = cpu_to_be32(F_FW_RI_TPTE_VALID |
290− V_FW_RI_TPTE_STAGKEY((*stag & M_FW_RI_TPTE_STAGKEY)) |
291− V_FW_RI_TPTE_STAGSTATE(stag_state) |
292− V_FW_RI_TPTE_STAGTYPE(type) | V_FW_RI_TPTE_PDID(pdid));
293− tpt.locread_to_qpid = cpu_to_be32(V_FW_RI_TPTE_PERM(perm) |
294− (bind_enabled ? F_FW_RI_TPTE_MWBINDEN : 0) |
295− V_FW_RI_TPTE_ADDRTYPE((zbva ? FW_RI_ZERO_BASED_TO :
289+ tpt.valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F |
290+ FW_RI_TPTE_STAGKEY_V((*stag & FW_RI_TPTE_STAGKEY_M)) |
291+ FW_RI_TPTE_STAGSTATE_V(stag_state) |
292+ FW_RI_TPTE_STAGTYPE_V(type) | FW_RI_TPTE_PDID_V(pdid));
293+ tpt.locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) |
294+ (bind_enabled ? FW_RI_TPTE_MWBINDEN_F : 0) |
295+ FW_RI_TPTE_ADDRTYPE_V((zbva ? FW_RI_ZERO_BASED_TO :
296296 FW_RI_VA_BASED_TO))|
297− V_FW_RI_TPTE_PS(page_size));
297+ FW_RI_TPTE_PS_V(page_size));
298298 tpt.nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32(
299− V_FW_RI_TPTE_PBLADDR(PBL_OFF(rdev, pbl_addr)>>3));
299+ FW_RI_TPTE_PBLADDR_V(PBL_OFF(rdev, pbl_addr)>>3));
300300 tpt.len_lo = cpu_to_be32((u32)(len & 0xffffffffUL));
301301 tpt.va_hi = cpu_to_be32((u32)(to >> 32));
302302 tpt.va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL));
drivers/infiniband/hw/cxgb4/qp.c+31−31
@@ -272,7 +272,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 271 unmodified lines
272272 memset(res_wr, 0, wr_len);
273273 res_wr->op_nres = cpu_to_be32(
274274 FW_WR_OP_V(FW_RI_RES_WR) |
275− V_FW_RI_RES_WR_NRES(2) |
275+ FW_RI_RES_WR_NRES_V(2) |
276276 FW_WR_COMPL_F);
277277 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16));
278278 res_wr->cookie = (unsigned long) &wr_wait;
@@ -287,19 +287,19 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 8 unmodified lines
287287 rdev->hw_queue.t4_eq_status_entries;
288288
289289 res->u.sqrq.fetchszm_to_iqid = cpu_to_be32(
290− V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */
291− V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */
292− V_FW_RI_RES_WR_PCIECHN(0) | /* set by uP at ri_init time */
293− (t4_sq_onchip(&wq->sq) ? F_FW_RI_RES_WR_ONCHIP : 0) |
294− V_FW_RI_RES_WR_IQID(scq->cqid));
290+ FW_RI_RES_WR_HOSTFCMODE_V(0) | /* no host cidx updates */
291+ FW_RI_RES_WR_CPRIO_V(0) | /* don't keep in chip cache */
292+ FW_RI_RES_WR_PCIECHN_V(0) | /* set by uP at ri_init time */
293+ (t4_sq_onchip(&wq->sq) ? FW_RI_RES_WR_ONCHIP_F : 0) |
294+ FW_RI_RES_WR_IQID_V(scq->cqid));
295295 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32(
296− V_FW_RI_RES_WR_DCAEN(0) |
297− V_FW_RI_RES_WR_DCACPU(0) |
298− V_FW_RI_RES_WR_FBMIN(2) |
299− V_FW_RI_RES_WR_FBMAX(2) |
300− V_FW_RI_RES_WR_CIDXFTHRESHO(0) |
301− V_FW_RI_RES_WR_CIDXFTHRESH(0) |
302− V_FW_RI_RES_WR_EQSIZE(eqsize));
296+ FW_RI_RES_WR_DCAEN_V(0) |
297+ FW_RI_RES_WR_DCACPU_V(0) |
298+ FW_RI_RES_WR_FBMIN_V(2) |
299+ FW_RI_RES_WR_FBMAX_V(2) |
300+ FW_RI_RES_WR_CIDXFTHRESHO_V(0) |
301+ FW_RI_RES_WR_CIDXFTHRESH_V(0) |
302+ FW_RI_RES_WR_EQSIZE_V(eqsize));
303303 res->u.sqrq.eqid = cpu_to_be32(wq->sq.qid);
304304 res->u.sqrq.eqaddr = cpu_to_be64(wq->sq.dma_addr);
305305 res++;
@@ -312,18 +312,18 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 6 unmodified lines
312312 eqsize = wq->rq.size * T4_RQ_NUM_SLOTS +
313313 rdev->hw_queue.t4_eq_status_entries;
314314 res->u.sqrq.fetchszm_to_iqid = cpu_to_be32(
315− V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */
316− V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */
317− V_FW_RI_RES_WR_PCIECHN(0) | /* set by uP at ri_init time */
318− V_FW_RI_RES_WR_IQID(rcq->cqid));
315+ FW_RI_RES_WR_HOSTFCMODE_V(0) | /* no host cidx updates */
316+ FW_RI_RES_WR_CPRIO_V(0) | /* don't keep in chip cache */
317+ FW_RI_RES_WR_PCIECHN_V(0) | /* set by uP at ri_init time */
318+ FW_RI_RES_WR_IQID_V(rcq->cqid));
319319 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32(
320− V_FW_RI_RES_WR_DCAEN(0) |
321− V_FW_RI_RES_WR_DCACPU(0) |
322− V_FW_RI_RES_WR_FBMIN(2) |
323− V_FW_RI_RES_WR_FBMAX(2) |
324− V_FW_RI_RES_WR_CIDXFTHRESHO(0) |
325− V_FW_RI_RES_WR_CIDXFTHRESH(0) |
326− V_FW_RI_RES_WR_EQSIZE(eqsize));
320+ FW_RI_RES_WR_DCAEN_V(0) |
321+ FW_RI_RES_WR_DCACPU_V(0) |
322+ FW_RI_RES_WR_FBMIN_V(2) |
323+ FW_RI_RES_WR_FBMAX_V(2) |
324+ FW_RI_RES_WR_CIDXFTHRESHO_V(0) |
325+ FW_RI_RES_WR_CIDXFTHRESH_V(0) |
326+ FW_RI_RES_WR_EQSIZE_V(eqsize));
327327 res->u.sqrq.eqid = cpu_to_be32(wq->rq.qid);
328328 res->u.sqrq.eqaddr = cpu_to_be64(wq->rq.dma_addr);
329329
@@ -444,19 +444,19 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, · 114 unmodified lines
444444 case IB_WR_SEND:
445445 if (wr->send_flags & IB_SEND_SOLICITED)
446446 wqe->send.sendop_pkd = cpu_to_be32(
447− V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND_WITH_SE));
447+ FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND_WITH_SE));
448448 else
449449 wqe->send.sendop_pkd = cpu_to_be32(
450− V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND));
450+ FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND));
451451 wqe->send.stag_inv = 0;
452452 break;
453453 case IB_WR_SEND_WITH_INV:
454454 if (wr->send_flags & IB_SEND_SOLICITED)
455455 wqe->send.sendop_pkd = cpu_to_be32(
456− V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND_WITH_SE_INV));
456+ FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND_WITH_SE_INV));
457457 else
458458 wqe->send.sendop_pkd = cpu_to_be32(
459− V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND_WITH_INV));
459+ FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND_WITH_INV));
460460 wqe->send.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey);
461461 break;
462462
@@ -1283,8 +1283,8 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw_qp *qhp) · 820 unmodified lines
12831283
12841284 wqe->u.init.type = FW_RI_TYPE_INIT;
12851285 wqe->u.init.mpareqbit_p2ptype =
1286− V_FW_RI_WR_MPAREQBIT(qhp->attr.mpa_attr.initiator) |
1287− V_FW_RI_WR_P2PTYPE(qhp->attr.mpa_attr.p2p_type);
1286+ FW_RI_WR_MPAREQBIT_V(qhp->attr.mpa_attr.initiator) |
1287+ FW_RI_WR_P2PTYPE_V(qhp->attr.mpa_attr.p2p_type);
12881288 wqe->u.init.mpa_attrs = FW_RI_MPA_IETF_ENABLE;
12891289 if (qhp->attr.mpa_attr.recv_marker_enabled)
12901290 wqe->u.init.mpa_attrs |= FW_RI_MPA_RX_MARKER_ENABLE;
@@ -1776,7 +1776,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, · 485 unmodified lines
17761776 if (mm5) {
17771777 mm5->key = uresp.ma_sync_key;
17781778 mm5->addr = (pci_resource_start(rhp->rdev.lldi.pdev, 0)
1779− + A_PCIE_MA_SYNC) & PAGE_MASK;
1779+ + PCIE_MA_SYNC_A) & PAGE_MASK;
17801780 mm5->len = PAGE_SIZE;
17811781 insert_mmap(ucontext, mm5);
17821782 }
drivers/infiniband/hw/cxgb4/t4.h+63−63
@@ -41,7 +41,7 @@ · 40 unmodified lines
4141 #define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */
4242 #define T4_STAG_UNSET 0xffffffff
4343 #define T4_FW_MAJ 0
44−#define A_PCIE_MA_SYNC 0x30b4
44+#define PCIE_MA_SYNC_A 0x30b4
4545
4646 struct t4_status_page {
4747 __be32 rsvd1; /* flit 0 - hw owns */
@@ -184,44 +184,44 @@ struct t4_cqe { · 136 unmodified lines
184184
185185 /* macros for flit 0 of the cqe */
186186
187−#define S_CQE_QPID 12
188−#define M_CQE_QPID 0xFFFFF
189−#define G_CQE_QPID(x) ((((x) >> S_CQE_QPID)) & M_CQE_QPID)
190−#define V_CQE_QPID(x) ((x)<<S_CQE_QPID)
191−
192−#define S_CQE_SWCQE 11
193−#define M_CQE_SWCQE 0x1
194−#define G_CQE_SWCQE(x) ((((x) >> S_CQE_SWCQE)) & M_CQE_SWCQE)
195−#define V_CQE_SWCQE(x) ((x)<<S_CQE_SWCQE)
196−
197−#define S_CQE_STATUS 5
198−#define M_CQE_STATUS 0x1F
199−#define G_CQE_STATUS(x) ((((x) >> S_CQE_STATUS)) & M_CQE_STATUS)
200−#define V_CQE_STATUS(x) ((x)<<S_CQE_STATUS)
201−
202−#define S_CQE_TYPE 4
203−#define M_CQE_TYPE 0x1
204−#define G_CQE_TYPE(x) ((((x) >> S_CQE_TYPE)) & M_CQE_TYPE)
205−#define V_CQE_TYPE(x) ((x)<<S_CQE_TYPE)
206−
207−#define S_CQE_OPCODE 0
208−#define M_CQE_OPCODE 0xF
209−#define G_CQE_OPCODE(x) ((((x) >> S_CQE_OPCODE)) & M_CQE_OPCODE)
210−#define V_CQE_OPCODE(x) ((x)<<S_CQE_OPCODE)
211−
212−#define SW_CQE(x) (G_CQE_SWCQE(be32_to_cpu((x)->header)))
213−#define CQE_QPID(x) (G_CQE_QPID(be32_to_cpu((x)->header)))
214−#define CQE_TYPE(x) (G_CQE_TYPE(be32_to_cpu((x)->header)))
187+#define CQE_QPID_S 12
188+#define CQE_QPID_M 0xFFFFF
189+#define CQE_QPID_G(x) ((((x) >> CQE_QPID_S)) & CQE_QPID_M)
190+#define CQE_QPID_V(x) ((x)<<CQE_QPID_S)
191+
192+#define CQE_SWCQE_S 11
193+#define CQE_SWCQE_M 0x1
194+#define CQE_SWCQE_G(x) ((((x) >> CQE_SWCQE_S)) & CQE_SWCQE_M)
195+#define CQE_SWCQE_V(x) ((x)<<CQE_SWCQE_S)
196+
197+#define CQE_STATUS_S 5
198+#define CQE_STATUS_M 0x1F
199+#define CQE_STATUS_G(x) ((((x) >> CQE_STATUS_S)) & CQE_STATUS_M)
200+#define CQE_STATUS_V(x) ((x)<<CQE_STATUS_S)
201+
202+#define CQE_TYPE_S 4
203+#define CQE_TYPE_M 0x1
204+#define CQE_TYPE_G(x) ((((x) >> CQE_TYPE_S)) & CQE_TYPE_M)
205+#define CQE_TYPE_V(x) ((x)<<CQE_TYPE_S)
206+
207+#define CQE_OPCODE_S 0
208+#define CQE_OPCODE_M 0xF
209+#define CQE_OPCODE_G(x) ((((x) >> CQE_OPCODE_S)) & CQE_OPCODE_M)
210+#define CQE_OPCODE_V(x) ((x)<<CQE_OPCODE_S)
211+
212+#define SW_CQE(x) (CQE_SWCQE_G(be32_to_cpu((x)->header)))
213+#define CQE_QPID(x) (CQE_QPID_G(be32_to_cpu((x)->header)))
214+#define CQE_TYPE(x) (CQE_TYPE_G(be32_to_cpu((x)->header)))
215215 #define SQ_TYPE(x) (CQE_TYPE((x)))
216216 #define RQ_TYPE(x) (!CQE_TYPE((x)))
217−#define CQE_STATUS(x) (G_CQE_STATUS(be32_to_cpu((x)->header)))
218−#define CQE_OPCODE(x) (G_CQE_OPCODE(be32_to_cpu((x)->header)))
217+#define CQE_STATUS(x) (CQE_STATUS_G(be32_to_cpu((x)->header)))
218+#define CQE_OPCODE(x) (CQE_OPCODE_G(be32_to_cpu((x)->header)))
219219
220220 #define CQE_SEND_OPCODE(x)( \
221− (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND) || \
222− (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE) || \
223− (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_INV) || \
224− (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE_INV))
221+ (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND) || \
222+ (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE) || \
223+ (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_INV) || \
224+ (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE_INV))
225225
226226 #define CQE_LEN(x) (be32_to_cpu((x)->len))
227227
@@ -237,25 +237,25 @@ struct t4_cqe { · 9 unmodified lines
237237 #define CQE_WRID_LOW(x) (be32_to_cpu((x)->u.gen.wrid_low))
238238
239239 /* macros for flit 3 of the cqe */
240−#define S_CQE_GENBIT 63
241−#define M_CQE_GENBIT 0x1
242−#define G_CQE_GENBIT(x) (((x) >> S_CQE_GENBIT) & M_CQE_GENBIT)
243−#define V_CQE_GENBIT(x) ((x)<<S_CQE_GENBIT)
240+#define CQE_GENBIT_S 63
241+#define CQE_GENBIT_M 0x1
242+#define CQE_GENBIT_G(x) (((x) >> CQE_GENBIT_S) & CQE_GENBIT_M)
243+#define CQE_GENBIT_V(x) ((x)<<CQE_GENBIT_S)
244244
245−#define S_CQE_OVFBIT 62
246−#define M_CQE_OVFBIT 0x1
247−#define G_CQE_OVFBIT(x) ((((x) >> S_CQE_OVFBIT)) & M_CQE_OVFBIT)
245+#define CQE_OVFBIT_S 62
246+#define CQE_OVFBIT_M 0x1
247+#define CQE_OVFBIT_G(x) ((((x) >> CQE_OVFBIT_S)) & CQE_OVFBIT_M)
248248
249−#define S_CQE_IQTYPE 60
250−#define M_CQE_IQTYPE 0x3
251−#define G_CQE_IQTYPE(x) ((((x) >> S_CQE_IQTYPE)) & M_CQE_IQTYPE)
249+#define CQE_IQTYPE_S 60
250+#define CQE_IQTYPE_M 0x3
251+#define CQE_IQTYPE_G(x) ((((x) >> CQE_IQTYPE_S)) & CQE_IQTYPE_M)
252252
253−#define M_CQE_TS 0x0fffffffffffffffULL
254−#define G_CQE_TS(x) ((x) & M_CQE_TS)
253+#define CQE_TS_M 0x0fffffffffffffffULL
254+#define CQE_TS_G(x) ((x) & CQE_TS_M)
255255
256−#define CQE_OVFBIT(x) ((unsigned)G_CQE_OVFBIT(be64_to_cpu((x)->bits_type_ts)))
257−#define CQE_GENBIT(x) ((unsigned)G_CQE_GENBIT(be64_to_cpu((x)->bits_type_ts)))
258−#define CQE_TS(x) (G_CQE_TS(be64_to_cpu((x)->bits_type_ts)))
256+#define CQE_OVFBIT(x) ((unsigned)CQE_OVFBIT_G(be64_to_cpu((x)->bits_type_ts)))
257+#define CQE_GENBIT(x) ((unsigned)CQE_GENBIT_G(be64_to_cpu((x)->bits_type_ts)))
258+#define CQE_TS(x) (CQE_TS_G(be64_to_cpu((x)->bits_type_ts)))
259259
260260 struct t4_swsqe {
261261 u64 wr_id;
@@ -465,14 +465,14 @@ static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc, u8 t5, · 203 unmodified lines
465465 } else {
466466 PDBG("%s: DB wq->sq.pidx = %d\n",
467467 __func__, wq->sq.pidx);
468− writel(PIDX_T5(inc), wq->sq.udb);
468+ writel(PIDX_T5_V(inc), wq->sq.udb);
469469 }
470470
471471 /* Flush user doorbell area writes. */
472472 wmb();
473473 return;
474474 }
475− writel(QID(wq->sq.qid) | PIDX(inc), wq->db);
475+ writel(QID_V(wq->sq.qid) | PIDX_V(inc), wq->db);
476476 }
477477
478478 static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5,
@@ -489,14 +489,14 @@ static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, · 10 unmodified lines
489489 } else {
490490 PDBG("%s: DB wq->rq.pidx = %d\n",
491491 __func__, wq->rq.pidx);
492− writel(PIDX_T5(inc), wq->rq.udb);
492+ writel(PIDX_T5_V(inc), wq->rq.udb);
493493 }
494494
495495 /* Flush user doorbell area writes. */
496496 wmb();
497497 return;
498498 }
499− writel(QID(wq->rq.qid) | PIDX(inc), wq->db);
499+ writel(QID_V(wq->rq.qid) | PIDX_V(inc), wq->db);
500500 }
501501
502502 static inline int t4_wq_in_error(struct t4_wq *wq)
@@ -561,14 +561,14 @@ static inline int t4_arm_cq(struct t4_cq *cq, int se) · 58 unmodified lines
561561 u32 val;
562562
563563 set_bit(CQ_ARMED, &cq->flags);
564− while (cq->cidx_inc > CIDXINC_MASK) {
565− val = SEINTARM(0) | CIDXINC(CIDXINC_MASK) | TIMERREG(7) |
566− INGRESSQID(cq->cqid);
564+ while (cq->cidx_inc > CIDXINC_M) {
565+ val = SEINTARM_V(0) | CIDXINC_V(CIDXINC_M) | TIMERREG_V(7) |
566+ INGRESSQID_V(cq->cqid);
567567 writel(val, cq->gts);
568− cq->cidx_inc -= CIDXINC_MASK;
568+ cq->cidx_inc -= CIDXINC_M;
569569 }
570− val = SEINTARM(se) | CIDXINC(cq->cidx_inc) | TIMERREG(6) |
571− INGRESSQID(cq->cqid);
570+ val = SEINTARM_V(se) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(6) |
571+ INGRESSQID_V(cq->cqid);
572572 writel(val, cq->gts);
573573 cq->cidx_inc = 0;
574574 return 0;
@@ -597,11 +597,11 @@ static inline void t4_swcq_consume(struct t4_cq *cq) · 22 unmodified lines
597597 static inline void t4_hwcq_consume(struct t4_cq *cq)
598598 {
599599 cq->bits_type_ts = cq->queue[cq->cidx].bits_type_ts;
600− if (++cq->cidx_inc == (cq->size >> 4) || cq->cidx_inc == CIDXINC_MASK) {
600+ if (++cq->cidx_inc == (cq->size >> 4) || cq->cidx_inc == CIDXINC_M) {
601601 u32 val;
602602
603− val = SEINTARM(0) | CIDXINC(cq->cidx_inc) | TIMERREG(7) |
604− INGRESSQID(cq->cqid);
603+ val = SEINTARM_V(0) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(7) |
604+ INGRESSQID_V(cq->cqid);
605605 writel(val, cq->gts);
606606 cq->cidx_inc = 0;
607607 }
drivers/infiniband/hw/cxgb4/t4fw_ri_api.h+406−406
@@ -162,102 +162,102 @@ struct fw_ri_tpte { · 161 unmodified lines
162162 __be32 len_hi;
163163 };
164164
165−#define S_FW_RI_TPTE_VALID 31
166−#define M_FW_RI_TPTE_VALID 0x1
167−#define V_FW_RI_TPTE_VALID(x) ((x) << S_FW_RI_TPTE_VALID)
168−#define G_FW_RI_TPTE_VALID(x) \
169− (((x) >> S_FW_RI_TPTE_VALID) & M_FW_RI_TPTE_VALID)
170−#define F_FW_RI_TPTE_VALID V_FW_RI_TPTE_VALID(1U)
171−
172−#define S_FW_RI_TPTE_STAGKEY 23
173−#define M_FW_RI_TPTE_STAGKEY 0xff
174−#define V_FW_RI_TPTE_STAGKEY(x) ((x) << S_FW_RI_TPTE_STAGKEY)
175−#define G_FW_RI_TPTE_STAGKEY(x) \
176− (((x) >> S_FW_RI_TPTE_STAGKEY) & M_FW_RI_TPTE_STAGKEY)
177−
178−#define S_FW_RI_TPTE_STAGSTATE 22
179−#define M_FW_RI_TPTE_STAGSTATE 0x1
180−#define V_FW_RI_TPTE_STAGSTATE(x) ((x) << S_FW_RI_TPTE_STAGSTATE)
181−#define G_FW_RI_TPTE_STAGSTATE(x) \
182− (((x) >> S_FW_RI_TPTE_STAGSTATE) & M_FW_RI_TPTE_STAGSTATE)
183−#define F_FW_RI_TPTE_STAGSTATE V_FW_RI_TPTE_STAGSTATE(1U)
184−
185−#define S_FW_RI_TPTE_STAGTYPE 20
186−#define M_FW_RI_TPTE_STAGTYPE 0x3
187−#define V_FW_RI_TPTE_STAGTYPE(x) ((x) << S_FW_RI_TPTE_STAGTYPE)
188−#define G_FW_RI_TPTE_STAGTYPE(x) \
189− (((x) >> S_FW_RI_TPTE_STAGTYPE) & M_FW_RI_TPTE_STAGTYPE)
190−
191−#define S_FW_RI_TPTE_PDID 0
192−#define M_FW_RI_TPTE_PDID 0xfffff
193−#define V_FW_RI_TPTE_PDID(x) ((x) << S_FW_RI_TPTE_PDID)
194−#define G_FW_RI_TPTE_PDID(x) \
195− (((x) >> S_FW_RI_TPTE_PDID) & M_FW_RI_TPTE_PDID)
196−
197−#define S_FW_RI_TPTE_PERM 28
198−#define M_FW_RI_TPTE_PERM 0xf
199−#define V_FW_RI_TPTE_PERM(x) ((x) << S_FW_RI_TPTE_PERM)
200−#define G_FW_RI_TPTE_PERM(x) \
201− (((x) >> S_FW_RI_TPTE_PERM) & M_FW_RI_TPTE_PERM)
202−
203−#define S_FW_RI_TPTE_REMINVDIS 27
204−#define M_FW_RI_TPTE_REMINVDIS 0x1
205−#define V_FW_RI_TPTE_REMINVDIS(x) ((x) << S_FW_RI_TPTE_REMINVDIS)
206−#define G_FW_RI_TPTE_REMINVDIS(x) \
207− (((x) >> S_FW_RI_TPTE_REMINVDIS) & M_FW_RI_TPTE_REMINVDIS)
208−#define F_FW_RI_TPTE_REMINVDIS V_FW_RI_TPTE_REMINVDIS(1U)
209−
210−#define S_FW_RI_TPTE_ADDRTYPE 26
211−#define M_FW_RI_TPTE_ADDRTYPE 1
212−#define V_FW_RI_TPTE_ADDRTYPE(x) ((x) << S_FW_RI_TPTE_ADDRTYPE)
213−#define G_FW_RI_TPTE_ADDRTYPE(x) \
214− (((x) >> S_FW_RI_TPTE_ADDRTYPE) & M_FW_RI_TPTE_ADDRTYPE)
215−#define F_FW_RI_TPTE_ADDRTYPE V_FW_RI_TPTE_ADDRTYPE(1U)
216−
217−#define S_FW_RI_TPTE_MWBINDEN 25
218−#define M_FW_RI_TPTE_MWBINDEN 0x1
219−#define V_FW_RI_TPTE_MWBINDEN(x) ((x) << S_FW_RI_TPTE_MWBINDEN)
220−#define G_FW_RI_TPTE_MWBINDEN(x) \
221− (((x) >> S_FW_RI_TPTE_MWBINDEN) & M_FW_RI_TPTE_MWBINDEN)
222−#define F_FW_RI_TPTE_MWBINDEN V_FW_RI_TPTE_MWBINDEN(1U)
223−
224−#define S_FW_RI_TPTE_PS 20
225−#define M_FW_RI_TPTE_PS 0x1f
226−#define V_FW_RI_TPTE_PS(x) ((x) << S_FW_RI_TPTE_PS)
227−#define G_FW_RI_TPTE_PS(x) \
228− (((x) >> S_FW_RI_TPTE_PS) & M_FW_RI_TPTE_PS)
229−
230−#define S_FW_RI_TPTE_QPID 0
231−#define M_FW_RI_TPTE_QPID 0xfffff
232−#define V_FW_RI_TPTE_QPID(x) ((x) << S_FW_RI_TPTE_QPID)
233−#define G_FW_RI_TPTE_QPID(x) \
234− (((x) >> S_FW_RI_TPTE_QPID) & M_FW_RI_TPTE_QPID)
235−
236−#define S_FW_RI_TPTE_NOSNOOP 30
237−#define M_FW_RI_TPTE_NOSNOOP 0x1
238−#define V_FW_RI_TPTE_NOSNOOP(x) ((x) << S_FW_RI_TPTE_NOSNOOP)
239−#define G_FW_RI_TPTE_NOSNOOP(x) \
240− (((x) >> S_FW_RI_TPTE_NOSNOOP) & M_FW_RI_TPTE_NOSNOOP)
241−#define F_FW_RI_TPTE_NOSNOOP V_FW_RI_TPTE_NOSNOOP(1U)
242−
243−#define S_FW_RI_TPTE_PBLADDR 0
244−#define M_FW_RI_TPTE_PBLADDR 0x1fffffff
245−#define V_FW_RI_TPTE_PBLADDR(x) ((x) << S_FW_RI_TPTE_PBLADDR)
246−#define G_FW_RI_TPTE_PBLADDR(x) \
247− (((x) >> S_FW_RI_TPTE_PBLADDR) & M_FW_RI_TPTE_PBLADDR)
248−
249−#define S_FW_RI_TPTE_DCA 24
250−#define M_FW_RI_TPTE_DCA 0x1f
251−#define V_FW_RI_TPTE_DCA(x) ((x) << S_FW_RI_TPTE_DCA)
252−#define G_FW_RI_TPTE_DCA(x) \
253− (((x) >> S_FW_RI_TPTE_DCA) & M_FW_RI_TPTE_DCA)
254−
255−#define S_FW_RI_TPTE_MWBCNT_PSTAG 0
256−#define M_FW_RI_TPTE_MWBCNT_PSTAG 0xffffff
257−#define V_FW_RI_TPTE_MWBCNT_PSTAT(x) \
258− ((x) << S_FW_RI_TPTE_MWBCNT_PSTAG)
259−#define G_FW_RI_TPTE_MWBCNT_PSTAG(x) \
260− (((x) >> S_FW_RI_TPTE_MWBCNT_PSTAG) & M_FW_RI_TPTE_MWBCNT_PSTAG)
165+#define FW_RI_TPTE_VALID_S 31
166+#define FW_RI_TPTE_VALID_M 0x1
167+#define FW_RI_TPTE_VALID_V(x) ((x) << FW_RI_TPTE_VALID_S)
168+#define FW_RI_TPTE_VALID_G(x) \
169+ (((x) >> FW_RI_TPTE_VALID_S) & FW_RI_TPTE_VALID_M)
170+#define FW_RI_TPTE_VALID_F FW_RI_TPTE_VALID_V(1U)
171+
172+#define FW_RI_TPTE_STAGKEY_S 23
173+#define FW_RI_TPTE_STAGKEY_M 0xff
174+#define FW_RI_TPTE_STAGKEY_V(x) ((x) << FW_RI_TPTE_STAGKEY_S)
175+#define FW_RI_TPTE_STAGKEY_G(x) \
176+ (((x) >> FW_RI_TPTE_STAGKEY_S) & FW_RI_TPTE_STAGKEY_M)
177+
178+#define FW_RI_TPTE_STAGSTATE_S 22
179+#define FW_RI_TPTE_STAGSTATE_M 0x1
180+#define FW_RI_TPTE_STAGSTATE_V(x) ((x) << FW_RI_TPTE_STAGSTATE_S)
181+#define FW_RI_TPTE_STAGSTATE_G(x) \
182+ (((x) >> FW_RI_TPTE_STAGSTATE_S) & FW_RI_TPTE_STAGSTATE_M)
183+#define FW_RI_TPTE_STAGSTATE_F FW_RI_TPTE_STAGSTATE_V(1U)
184+
185+#define FW_RI_TPTE_STAGTYPE_S 20
186+#define FW_RI_TPTE_STAGTYPE_M 0x3
187+#define FW_RI_TPTE_STAGTYPE_V(x) ((x) << FW_RI_TPTE_STAGTYPE_S)
188+#define FW_RI_TPTE_STAGTYPE_G(x) \
189+ (((x) >> FW_RI_TPTE_STAGTYPE_S) & FW_RI_TPTE_STAGTYPE_M)
190+
191+#define FW_RI_TPTE_PDID_S 0
192+#define FW_RI_TPTE_PDID_M 0xfffff
193+#define FW_RI_TPTE_PDID_V(x) ((x) << FW_RI_TPTE_PDID_S)
194+#define FW_RI_TPTE_PDID_G(x) \
195+ (((x) >> FW_RI_TPTE_PDID_S) & FW_RI_TPTE_PDID_M)
196+
197+#define FW_RI_TPTE_PERM_S 28
198+#define FW_RI_TPTE_PERM_M 0xf
199+#define FW_RI_TPTE_PERM_V(x) ((x) << FW_RI_TPTE_PERM_S)
200+#define FW_RI_TPTE_PERM_G(x) \
201+ (((x) >> FW_RI_TPTE_PERM_S) & FW_RI_TPTE_PERM_M)
202+
203+#define FW_RI_TPTE_REMINVDIS_S 27
204+#define FW_RI_TPTE_REMINVDIS_M 0x1
205+#define FW_RI_TPTE_REMINVDIS_V(x) ((x) << FW_RI_TPTE_REMINVDIS_S)
206+#define FW_RI_TPTE_REMINVDIS_G(x) \
207+ (((x) >> FW_RI_TPTE_REMINVDIS_S) & FW_RI_TPTE_REMINVDIS_M)
208+#define FW_RI_TPTE_REMINVDIS_F FW_RI_TPTE_REMINVDIS_V(1U)
209+
210+#define FW_RI_TPTE_ADDRTYPE_S 26
211+#define FW_RI_TPTE_ADDRTYPE_M 1
212+#define FW_RI_TPTE_ADDRTYPE_V(x) ((x) << FW_RI_TPTE_ADDRTYPE_S)
213+#define FW_RI_TPTE_ADDRTYPE_G(x) \
214+ (((x) >> FW_RI_TPTE_ADDRTYPE_S) & FW_RI_TPTE_ADDRTYPE_M)
215+#define FW_RI_TPTE_ADDRTYPE_F FW_RI_TPTE_ADDRTYPE_V(1U)
216+
217+#define FW_RI_TPTE_MWBINDEN_S 25
218+#define FW_RI_TPTE_MWBINDEN_M 0x1
219+#define FW_RI_TPTE_MWBINDEN_V(x) ((x) << FW_RI_TPTE_MWBINDEN_S)
220+#define FW_RI_TPTE_MWBINDEN_G(x) \
221+ (((x) >> FW_RI_TPTE_MWBINDEN_S) & FW_RI_TPTE_MWBINDEN_M)
222+#define FW_RI_TPTE_MWBINDEN_F FW_RI_TPTE_MWBINDEN_V(1U)
223+
224+#define FW_RI_TPTE_PS_S 20
225+#define FW_RI_TPTE_PS_M 0x1f
226+#define FW_RI_TPTE_PS_V(x) ((x) << FW_RI_TPTE_PS_S)
227+#define FW_RI_TPTE_PS_G(x) \
228+ (((x) >> FW_RI_TPTE_PS_S) & FW_RI_TPTE_PS_M)
229+
230+#define FW_RI_TPTE_QPID_S 0
231+#define FW_RI_TPTE_QPID_M 0xfffff
232+#define FW_RI_TPTE_QPID_V(x) ((x) << FW_RI_TPTE_QPID_S)
233+#define FW_RI_TPTE_QPID_G(x) \
234+ (((x) >> FW_RI_TPTE_QPID_S) & FW_RI_TPTE_QPID_M)
235+
236+#define FW_RI_TPTE_NOSNOOP_S 30
237+#define FW_RI_TPTE_NOSNOOP_M 0x1
238+#define FW_RI_TPTE_NOSNOOP_V(x) ((x) << FW_RI_TPTE_NOSNOOP_S)
239+#define FW_RI_TPTE_NOSNOOP_G(x) \
240+ (((x) >> FW_RI_TPTE_NOSNOOP_S) & FW_RI_TPTE_NOSNOOP_M)
241+#define FW_RI_TPTE_NOSNOOP_F FW_RI_TPTE_NOSNOOP_V(1U)
242+
243+#define FW_RI_TPTE_PBLADDR_S 0
244+#define FW_RI_TPTE_PBLADDR_M 0x1fffffff
245+#define FW_RI_TPTE_PBLADDR_V(x) ((x) << FW_RI_TPTE_PBLADDR_S)
246+#define FW_RI_TPTE_PBLADDR_G(x) \
247+ (((x) >> FW_RI_TPTE_PBLADDR_S) & FW_RI_TPTE_PBLADDR_M)
248+
249+#define FW_RI_TPTE_DCA_S 24
250+#define FW_RI_TPTE_DCA_M 0x1f
251+#define FW_RI_TPTE_DCA_V(x) ((x) << FW_RI_TPTE_DCA_S)
252+#define FW_RI_TPTE_DCA_G(x) \
253+ (((x) >> FW_RI_TPTE_DCA_S) & FW_RI_TPTE_DCA_M)
254+
255+#define FW_RI_TPTE_MWBCNT_PSTAG_S 0
256+#define FW_RI_TPTE_MWBCNT_PSTAG_M 0xffffff
257+#define FW_RI_TPTE_MWBCNT_PSTAT_V(x) \
258+ ((x) << FW_RI_TPTE_MWBCNT_PSTAG_S)
259+#define FW_RI_TPTE_MWBCNT_PSTAG_G(x) \
260+ (((x) >> FW_RI_TPTE_MWBCNT_PSTAG_S) & FW_RI_TPTE_MWBCNT_PSTAG_M)
261261
262262 enum fw_ri_res_type {
263263 FW_RI_RES_TYPE_SQ,
@@ -308,222 +308,222 @@ struct fw_ri_res_wr { · 44 unmodified lines
308308 #endif
309309 };
310310
311−#define S_FW_RI_RES_WR_NRES 0
312−#define M_FW_RI_RES_WR_NRES 0xff
313−#define V_FW_RI_RES_WR_NRES(x) ((x) << S_FW_RI_RES_WR_NRES)
314−#define G_FW_RI_RES_WR_NRES(x) \
315− (((x) >> S_FW_RI_RES_WR_NRES) & M_FW_RI_RES_WR_NRES)
316−
317−#define S_FW_RI_RES_WR_FETCHSZM 26
318−#define M_FW_RI_RES_WR_FETCHSZM 0x1
319−#define V_FW_RI_RES_WR_FETCHSZM(x) ((x) << S_FW_RI_RES_WR_FETCHSZM)
320−#define G_FW_RI_RES_WR_FETCHSZM(x) \
321− (((x) >> S_FW_RI_RES_WR_FETCHSZM) & M_FW_RI_RES_WR_FETCHSZM)
322−#define F_FW_RI_RES_WR_FETCHSZM V_FW_RI_RES_WR_FETCHSZM(1U)
323−
324−#define S_FW_RI_RES_WR_STATUSPGNS 25
325−#define M_FW_RI_RES_WR_STATUSPGNS 0x1
326−#define V_FW_RI_RES_WR_STATUSPGNS(x) ((x) << S_FW_RI_RES_WR_STATUSPGNS)
327−#define G_FW_RI_RES_WR_STATUSPGNS(x) \
328− (((x) >> S_FW_RI_RES_WR_STATUSPGNS) & M_FW_RI_RES_WR_STATUSPGNS)
329−#define F_FW_RI_RES_WR_STATUSPGNS V_FW_RI_RES_WR_STATUSPGNS(1U)
330−
331−#define S_FW_RI_RES_WR_STATUSPGRO 24
332−#define M_FW_RI_RES_WR_STATUSPGRO 0x1
333−#define V_FW_RI_RES_WR_STATUSPGRO(x) ((x) << S_FW_RI_RES_WR_STATUSPGRO)
334−#define G_FW_RI_RES_WR_STATUSPGRO(x) \
335− (((x) >> S_FW_RI_RES_WR_STATUSPGRO) & M_FW_RI_RES_WR_STATUSPGRO)
336−#define F_FW_RI_RES_WR_STATUSPGRO V_FW_RI_RES_WR_STATUSPGRO(1U)
337−
338−#define S_FW_RI_RES_WR_FETCHNS 23
339−#define M_FW_RI_RES_WR_FETCHNS 0x1
340−#define V_FW_RI_RES_WR_FETCHNS(x) ((x) << S_FW_RI_RES_WR_FETCHNS)
341−#define G_FW_RI_RES_WR_FETCHNS(x) \
342− (((x) >> S_FW_RI_RES_WR_FETCHNS) & M_FW_RI_RES_WR_FETCHNS)
343−#define F_FW_RI_RES_WR_FETCHNS V_FW_RI_RES_WR_FETCHNS(1U)
344−
345−#define S_FW_RI_RES_WR_FETCHRO 22
346−#define M_FW_RI_RES_WR_FETCHRO 0x1
347−#define V_FW_RI_RES_WR_FETCHRO(x) ((x) << S_FW_RI_RES_WR_FETCHRO)
348−#define G_FW_RI_RES_WR_FETCHRO(x) \
349− (((x) >> S_FW_RI_RES_WR_FETCHRO) & M_FW_RI_RES_WR_FETCHRO)
350−#define F_FW_RI_RES_WR_FETCHRO V_FW_RI_RES_WR_FETCHRO(1U)
351−
352−#define S_FW_RI_RES_WR_HOSTFCMODE 20
353−#define M_FW_RI_RES_WR_HOSTFCMODE 0x3
354−#define V_FW_RI_RES_WR_HOSTFCMODE(x) ((x) << S_FW_RI_RES_WR_HOSTFCMODE)
355−#define G_FW_RI_RES_WR_HOSTFCMODE(x) \
356− (((x) >> S_FW_RI_RES_WR_HOSTFCMODE) & M_FW_RI_RES_WR_HOSTFCMODE)
357−
358−#define S_FW_RI_RES_WR_CPRIO 19
359−#define M_FW_RI_RES_WR_CPRIO 0x1
360−#define V_FW_RI_RES_WR_CPRIO(x) ((x) << S_FW_RI_RES_WR_CPRIO)
361−#define G_FW_RI_RES_WR_CPRIO(x) \
362− (((x) >> S_FW_RI_RES_WR_CPRIO) & M_FW_RI_RES_WR_CPRIO)
363−#define F_FW_RI_RES_WR_CPRIO V_FW_RI_RES_WR_CPRIO(1U)
364−
365−#define S_FW_RI_RES_WR_ONCHIP 18
366−#define M_FW_RI_RES_WR_ONCHIP 0x1
367−#define V_FW_RI_RES_WR_ONCHIP(x) ((x) << S_FW_RI_RES_WR_ONCHIP)
368−#define G_FW_RI_RES_WR_ONCHIP(x) \
369− (((x) >> S_FW_RI_RES_WR_ONCHIP) & M_FW_RI_RES_WR_ONCHIP)
370−#define F_FW_RI_RES_WR_ONCHIP V_FW_RI_RES_WR_ONCHIP(1U)
371−
372−#define S_FW_RI_RES_WR_PCIECHN 16
373−#define M_FW_RI_RES_WR_PCIECHN 0x3
374−#define V_FW_RI_RES_WR_PCIECHN(x) ((x) << S_FW_RI_RES_WR_PCIECHN)
375−#define G_FW_RI_RES_WR_PCIECHN(x) \
376− (((x) >> S_FW_RI_RES_WR_PCIECHN) & M_FW_RI_RES_WR_PCIECHN)
377−
378−#define S_FW_RI_RES_WR_IQID 0
379−#define M_FW_RI_RES_WR_IQID 0xffff
380−#define V_FW_RI_RES_WR_IQID(x) ((x) << S_FW_RI_RES_WR_IQID)
381−#define G_FW_RI_RES_WR_IQID(x) \
382− (((x) >> S_FW_RI_RES_WR_IQID) & M_FW_RI_RES_WR_IQID)
383−
384−#define S_FW_RI_RES_WR_DCAEN 31
385−#define M_FW_RI_RES_WR_DCAEN 0x1
386−#define V_FW_RI_RES_WR_DCAEN(x) ((x) << S_FW_RI_RES_WR_DCAEN)
387−#define G_FW_RI_RES_WR_DCAEN(x) \
388− (((x) >> S_FW_RI_RES_WR_DCAEN) & M_FW_RI_RES_WR_DCAEN)
389−#define F_FW_RI_RES_WR_DCAEN V_FW_RI_RES_WR_DCAEN(1U)
390−
391−#define S_FW_RI_RES_WR_DCACPU 26
392−#define M_FW_RI_RES_WR_DCACPU 0x1f
393−#define V_FW_RI_RES_WR_DCACPU(x) ((x) << S_FW_RI_RES_WR_DCACPU)
394−#define G_FW_RI_RES_WR_DCACPU(x) \
395− (((x) >> S_FW_RI_RES_WR_DCACPU) & M_FW_RI_RES_WR_DCACPU)
396−
397−#define S_FW_RI_RES_WR_FBMIN 23
398−#define M_FW_RI_RES_WR_FBMIN 0x7
399−#define V_FW_RI_RES_WR_FBMIN(x) ((x) << S_FW_RI_RES_WR_FBMIN)
400−#define G_FW_RI_RES_WR_FBMIN(x) \
401− (((x) >> S_FW_RI_RES_WR_FBMIN) & M_FW_RI_RES_WR_FBMIN)
402−
403−#define S_FW_RI_RES_WR_FBMAX 20
404−#define M_FW_RI_RES_WR_FBMAX 0x7
405−#define V_FW_RI_RES_WR_FBMAX(x) ((x) << S_FW_RI_RES_WR_FBMAX)
406−#define G_FW_RI_RES_WR_FBMAX(x) \
407− (((x) >> S_FW_RI_RES_WR_FBMAX) & M_FW_RI_RES_WR_FBMAX)
408−
409−#define S_FW_RI_RES_WR_CIDXFTHRESHO 19
410−#define M_FW_RI_RES_WR_CIDXFTHRESHO 0x1
411−#define V_FW_RI_RES_WR_CIDXFTHRESHO(x) ((x) << S_FW_RI_RES_WR_CIDXFTHRESHO)
412−#define G_FW_RI_RES_WR_CIDXFTHRESHO(x) \
413− (((x) >> S_FW_RI_RES_WR_CIDXFTHRESHO) & M_FW_RI_RES_WR_CIDXFTHRESHO)
414−#define F_FW_RI_RES_WR_CIDXFTHRESHO V_FW_RI_RES_WR_CIDXFTHRESHO(1U)
415−
416−#define S_FW_RI_RES_WR_CIDXFTHRESH 16
417−#define M_FW_RI_RES_WR_CIDXFTHRESH 0x7
418−#define V_FW_RI_RES_WR_CIDXFTHRESH(x) ((x) << S_FW_RI_RES_WR_CIDXFTHRESH)
419−#define G_FW_RI_RES_WR_CIDXFTHRESH(x) \
420− (((x) >> S_FW_RI_RES_WR_CIDXFTHRESH) & M_FW_RI_RES_WR_CIDXFTHRESH)
421−
422−#define S_FW_RI_RES_WR_EQSIZE 0
423−#define M_FW_RI_RES_WR_EQSIZE 0xffff
424−#define V_FW_RI_RES_WR_EQSIZE(x) ((x) << S_FW_RI_RES_WR_EQSIZE)
425−#define G_FW_RI_RES_WR_EQSIZE(x) \
426− (((x) >> S_FW_RI_RES_WR_EQSIZE) & M_FW_RI_RES_WR_EQSIZE)
427−
428−#define S_FW_RI_RES_WR_IQANDST 15
429−#define M_FW_RI_RES_WR_IQANDST 0x1
430−#define V_FW_RI_RES_WR_IQANDST(x) ((x) << S_FW_RI_RES_WR_IQANDST)
431−#define G_FW_RI_RES_WR_IQANDST(x) \
432− (((x) >> S_FW_RI_RES_WR_IQANDST) & M_FW_RI_RES_WR_IQANDST)
433−#define F_FW_RI_RES_WR_IQANDST V_FW_RI_RES_WR_IQANDST(1U)
434−
435−#define S_FW_RI_RES_WR_IQANUS 14
436−#define M_FW_RI_RES_WR_IQANUS 0x1
437−#define V_FW_RI_RES_WR_IQANUS(x) ((x) << S_FW_RI_RES_WR_IQANUS)
438−#define G_FW_RI_RES_WR_IQANUS(x) \
439− (((x) >> S_FW_RI_RES_WR_IQANUS) & M_FW_RI_RES_WR_IQANUS)
440−#define F_FW_RI_RES_WR_IQANUS V_FW_RI_RES_WR_IQANUS(1U)
441−
442−#define S_FW_RI_RES_WR_IQANUD 12
443−#define M_FW_RI_RES_WR_IQANUD 0x3
444−#define V_FW_RI_RES_WR_IQANUD(x) ((x) << S_FW_RI_RES_WR_IQANUD)
445−#define G_FW_RI_RES_WR_IQANUD(x) \
446− (((x) >> S_FW_RI_RES_WR_IQANUD) & M_FW_RI_RES_WR_IQANUD)
447−
448−#define S_FW_RI_RES_WR_IQANDSTINDEX 0
449−#define M_FW_RI_RES_WR_IQANDSTINDEX 0xfff
450−#define V_FW_RI_RES_WR_IQANDSTINDEX(x) ((x) << S_FW_RI_RES_WR_IQANDSTINDEX)
451−#define G_FW_RI_RES_WR_IQANDSTINDEX(x) \
452− (((x) >> S_FW_RI_RES_WR_IQANDSTINDEX) & M_FW_RI_RES_WR_IQANDSTINDEX)
453−
454−#define S_FW_RI_RES_WR_IQDROPRSS 15
455−#define M_FW_RI_RES_WR_IQDROPRSS 0x1
456−#define V_FW_RI_RES_WR_IQDROPRSS(x) ((x) << S_FW_RI_RES_WR_IQDROPRSS)
457−#define G_FW_RI_RES_WR_IQDROPRSS(x) \
458− (((x) >> S_FW_RI_RES_WR_IQDROPRSS) & M_FW_RI_RES_WR_IQDROPRSS)
459−#define F_FW_RI_RES_WR_IQDROPRSS V_FW_RI_RES_WR_IQDROPRSS(1U)
460−
461−#define S_FW_RI_RES_WR_IQGTSMODE 14
462−#define M_FW_RI_RES_WR_IQGTSMODE 0x1
463−#define V_FW_RI_RES_WR_IQGTSMODE(x) ((x) << S_FW_RI_RES_WR_IQGTSMODE)
464−#define G_FW_RI_RES_WR_IQGTSMODE(x) \
465− (((x) >> S_FW_RI_RES_WR_IQGTSMODE) & M_FW_RI_RES_WR_IQGTSMODE)
466−#define F_FW_RI_RES_WR_IQGTSMODE V_FW_RI_RES_WR_IQGTSMODE(1U)
467−
468−#define S_FW_RI_RES_WR_IQPCIECH 12
469−#define M_FW_RI_RES_WR_IQPCIECH 0x3
470−#define V_FW_RI_RES_WR_IQPCIECH(x) ((x) << S_FW_RI_RES_WR_IQPCIECH)
471−#define G_FW_RI_RES_WR_IQPCIECH(x) \
472− (((x) >> S_FW_RI_RES_WR_IQPCIECH) & M_FW_RI_RES_WR_IQPCIECH)
473−
474−#define S_FW_RI_RES_WR_IQDCAEN 11
475−#define M_FW_RI_RES_WR_IQDCAEN 0x1
476−#define V_FW_RI_RES_WR_IQDCAEN(x) ((x) << S_FW_RI_RES_WR_IQDCAEN)
477−#define G_FW_RI_RES_WR_IQDCAEN(x) \
478− (((x) >> S_FW_RI_RES_WR_IQDCAEN) & M_FW_RI_RES_WR_IQDCAEN)
479−#define F_FW_RI_RES_WR_IQDCAEN V_FW_RI_RES_WR_IQDCAEN(1U)
480−
481−#define S_FW_RI_RES_WR_IQDCACPU 6
482−#define M_FW_RI_RES_WR_IQDCACPU 0x1f
483−#define V_FW_RI_RES_WR_IQDCACPU(x) ((x) << S_FW_RI_RES_WR_IQDCACPU)
484−#define G_FW_RI_RES_WR_IQDCACPU(x) \
485− (((x) >> S_FW_RI_RES_WR_IQDCACPU) & M_FW_RI_RES_WR_IQDCACPU)
486−
487−#define S_FW_RI_RES_WR_IQINTCNTTHRESH 4
488−#define M_FW_RI_RES_WR_IQINTCNTTHRESH 0x3
489−#define V_FW_RI_RES_WR_IQINTCNTTHRESH(x) \
490− ((x) << S_FW_RI_RES_WR_IQINTCNTTHRESH)
491−#define G_FW_RI_RES_WR_IQINTCNTTHRESH(x) \
492− (((x) >> S_FW_RI_RES_WR_IQINTCNTTHRESH) & M_FW_RI_RES_WR_IQINTCNTTHRESH)
493−
494−#define S_FW_RI_RES_WR_IQO 3
495−#define M_FW_RI_RES_WR_IQO 0x1
496−#define V_FW_RI_RES_WR_IQO(x) ((x) << S_FW_RI_RES_WR_IQO)
497−#define G_FW_RI_RES_WR_IQO(x) \
498− (((x) >> S_FW_RI_RES_WR_IQO) & M_FW_RI_RES_WR_IQO)
499−#define F_FW_RI_RES_WR_IQO V_FW_RI_RES_WR_IQO(1U)
500−
501−#define S_FW_RI_RES_WR_IQCPRIO 2
502−#define M_FW_RI_RES_WR_IQCPRIO 0x1
503−#define V_FW_RI_RES_WR_IQCPRIO(x) ((x) << S_FW_RI_RES_WR_IQCPRIO)
504−#define G_FW_RI_RES_WR_IQCPRIO(x) \
505− (((x) >> S_FW_RI_RES_WR_IQCPRIO) & M_FW_RI_RES_WR_IQCPRIO)
506−#define F_FW_RI_RES_WR_IQCPRIO V_FW_RI_RES_WR_IQCPRIO(1U)
507−
508−#define S_FW_RI_RES_WR_IQESIZE 0
509−#define M_FW_RI_RES_WR_IQESIZE 0x3
510−#define V_FW_RI_RES_WR_IQESIZE(x) ((x) << S_FW_RI_RES_WR_IQESIZE)
511−#define G_FW_RI_RES_WR_IQESIZE(x) \
512− (((x) >> S_FW_RI_RES_WR_IQESIZE) & M_FW_RI_RES_WR_IQESIZE)
513−
514−#define S_FW_RI_RES_WR_IQNS 31
515−#define M_FW_RI_RES_WR_IQNS 0x1
516−#define V_FW_RI_RES_WR_IQNS(x) ((x) << S_FW_RI_RES_WR_IQNS)
517−#define G_FW_RI_RES_WR_IQNS(x) \
518− (((x) >> S_FW_RI_RES_WR_IQNS) & M_FW_RI_RES_WR_IQNS)
519−#define F_FW_RI_RES_WR_IQNS V_FW_RI_RES_WR_IQNS(1U)
520−
521−#define S_FW_RI_RES_WR_IQRO 30
522−#define M_FW_RI_RES_WR_IQRO 0x1
523−#define V_FW_RI_RES_WR_IQRO(x) ((x) << S_FW_RI_RES_WR_IQRO)
524−#define G_FW_RI_RES_WR_IQRO(x) \
525− (((x) >> S_FW_RI_RES_WR_IQRO) & M_FW_RI_RES_WR_IQRO)
526−#define F_FW_RI_RES_WR_IQRO V_FW_RI_RES_WR_IQRO(1U)
311+#define FW_RI_RES_WR_NRES_S 0
312+#define FW_RI_RES_WR_NRES_M 0xff
313+#define FW_RI_RES_WR_NRES_V(x) ((x) << FW_RI_RES_WR_NRES_S)
314+#define FW_RI_RES_WR_NRES_G(x) \
315+ (((x) >> FW_RI_RES_WR_NRES_S) & FW_RI_RES_WR_NRES_M)
316+
317+#define FW_RI_RES_WR_FETCHSZM_S 26
318+#define FW_RI_RES_WR_FETCHSZM_M 0x1
319+#define FW_RI_RES_WR_FETCHSZM_V(x) ((x) << FW_RI_RES_WR_FETCHSZM_S)
320+#define FW_RI_RES_WR_FETCHSZM_G(x) \
321+ (((x) >> FW_RI_RES_WR_FETCHSZM_S) & FW_RI_RES_WR_FETCHSZM_M)
322+#define FW_RI_RES_WR_FETCHSZM_F FW_RI_RES_WR_FETCHSZM_V(1U)
323+
324+#define FW_RI_RES_WR_STATUSPGNS_S 25
325+#define FW_RI_RES_WR_STATUSPGNS_M 0x1
326+#define FW_RI_RES_WR_STATUSPGNS_V(x) ((x) << FW_RI_RES_WR_STATUSPGNS_S)
327+#define FW_RI_RES_WR_STATUSPGNS_G(x) \
328+ (((x) >> FW_RI_RES_WR_STATUSPGNS_S) & FW_RI_RES_WR_STATUSPGNS_M)
329+#define FW_RI_RES_WR_STATUSPGNS_F FW_RI_RES_WR_STATUSPGNS_V(1U)
330+
331+#define FW_RI_RES_WR_STATUSPGRO_S 24
332+#define FW_RI_RES_WR_STATUSPGRO_M 0x1
333+#define FW_RI_RES_WR_STATUSPGRO_V(x) ((x) << FW_RI_RES_WR_STATUSPGRO_S)
334+#define FW_RI_RES_WR_STATUSPGRO_G(x) \
335+ (((x) >> FW_RI_RES_WR_STATUSPGRO_S) & FW_RI_RES_WR_STATUSPGRO_M)
336+#define FW_RI_RES_WR_STATUSPGRO_F FW_RI_RES_WR_STATUSPGRO_V(1U)
337+
338+#define FW_RI_RES_WR_FETCHNS_S 23
339+#define FW_RI_RES_WR_FETCHNS_M 0x1
340+#define FW_RI_RES_WR_FETCHNS_V(x) ((x) << FW_RI_RES_WR_FETCHNS_S)
341+#define FW_RI_RES_WR_FETCHNS_G(x) \
342+ (((x) >> FW_RI_RES_WR_FETCHNS_S) & FW_RI_RES_WR_FETCHNS_M)
343+#define FW_RI_RES_WR_FETCHNS_F FW_RI_RES_WR_FETCHNS_V(1U)
344+
345+#define FW_RI_RES_WR_FETCHRO_S 22
346+#define FW_RI_RES_WR_FETCHRO_M 0x1
347+#define FW_RI_RES_WR_FETCHRO_V(x) ((x) << FW_RI_RES_WR_FETCHRO_S)
348+#define FW_RI_RES_WR_FETCHRO_G(x) \
349+ (((x) >> FW_RI_RES_WR_FETCHRO_S) & FW_RI_RES_WR_FETCHRO_M)
350+#define FW_RI_RES_WR_FETCHRO_F FW_RI_RES_WR_FETCHRO_V(1U)
351+
352+#define FW_RI_RES_WR_HOSTFCMODE_S 20
353+#define FW_RI_RES_WR_HOSTFCMODE_M 0x3
354+#define FW_RI_RES_WR_HOSTFCMODE_V(x) ((x) << FW_RI_RES_WR_HOSTFCMODE_S)
355+#define FW_RI_RES_WR_HOSTFCMODE_G(x) \
356+ (((x) >> FW_RI_RES_WR_HOSTFCMODE_S) & FW_RI_RES_WR_HOSTFCMODE_M)
357+
358+#define FW_RI_RES_WR_CPRIO_S 19
359+#define FW_RI_RES_WR_CPRIO_M 0x1
360+#define FW_RI_RES_WR_CPRIO_V(x) ((x) << FW_RI_RES_WR_CPRIO_S)
361+#define FW_RI_RES_WR_CPRIO_G(x) \
362+ (((x) >> FW_RI_RES_WR_CPRIO_S) & FW_RI_RES_WR_CPRIO_M)
363+#define FW_RI_RES_WR_CPRIO_F FW_RI_RES_WR_CPRIO_V(1U)
364+
365+#define FW_RI_RES_WR_ONCHIP_S 18
366+#define FW_RI_RES_WR_ONCHIP_M 0x1
367+#define FW_RI_RES_WR_ONCHIP_V(x) ((x) << FW_RI_RES_WR_ONCHIP_S)
368+#define FW_RI_RES_WR_ONCHIP_G(x) \
369+ (((x) >> FW_RI_RES_WR_ONCHIP_S) & FW_RI_RES_WR_ONCHIP_M)
370+#define FW_RI_RES_WR_ONCHIP_F FW_RI_RES_WR_ONCHIP_V(1U)
371+
372+#define FW_RI_RES_WR_PCIECHN_S 16
373+#define FW_RI_RES_WR_PCIECHN_M 0x3
374+#define FW_RI_RES_WR_PCIECHN_V(x) ((x) << FW_RI_RES_WR_PCIECHN_S)
375+#define FW_RI_RES_WR_PCIECHN_G(x) \
376+ (((x) >> FW_RI_RES_WR_PCIECHN_S) & FW_RI_RES_WR_PCIECHN_M)
377+
378+#define FW_RI_RES_WR_IQID_S 0
379+#define FW_RI_RES_WR_IQID_M 0xffff
380+#define FW_RI_RES_WR_IQID_V(x) ((x) << FW_RI_RES_WR_IQID_S)
381+#define FW_RI_RES_WR_IQID_G(x) \
382+ (((x) >> FW_RI_RES_WR_IQID_S) & FW_RI_RES_WR_IQID_M)
383+
384+#define FW_RI_RES_WR_DCAEN_S 31
385+#define FW_RI_RES_WR_DCAEN_M 0x1
386+#define FW_RI_RES_WR_DCAEN_V(x) ((x) << FW_RI_RES_WR_DCAEN_S)
387+#define FW_RI_RES_WR_DCAEN_G(x) \
388+ (((x) >> FW_RI_RES_WR_DCAEN_S) & FW_RI_RES_WR_DCAEN_M)
389+#define FW_RI_RES_WR_DCAEN_F FW_RI_RES_WR_DCAEN_V(1U)
390+
391+#define FW_RI_RES_WR_DCACPU_S 26
392+#define FW_RI_RES_WR_DCACPU_M 0x1f
393+#define FW_RI_RES_WR_DCACPU_V(x) ((x) << FW_RI_RES_WR_DCACPU_S)
394+#define FW_RI_RES_WR_DCACPU_G(x) \
395+ (((x) >> FW_RI_RES_WR_DCACPU_S) & FW_RI_RES_WR_DCACPU_M)
396+
397+#define FW_RI_RES_WR_FBMIN_S 23
398+#define FW_RI_RES_WR_FBMIN_M 0x7
399+#define FW_RI_RES_WR_FBMIN_V(x) ((x) << FW_RI_RES_WR_FBMIN_S)
400+#define FW_RI_RES_WR_FBMIN_G(x) \
401+ (((x) >> FW_RI_RES_WR_FBMIN_S) & FW_RI_RES_WR_FBMIN_M)
402+
403+#define FW_RI_RES_WR_FBMAX_S 20
404+#define FW_RI_RES_WR_FBMAX_M 0x7
405+#define FW_RI_RES_WR_FBMAX_V(x) ((x) << FW_RI_RES_WR_FBMAX_S)
406+#define FW_RI_RES_WR_FBMAX_G(x) \
407+ (((x) >> FW_RI_RES_WR_FBMAX_S) & FW_RI_RES_WR_FBMAX_M)
408+
409+#define FW_RI_RES_WR_CIDXFTHRESHO_S 19
410+#define FW_RI_RES_WR_CIDXFTHRESHO_M 0x1
411+#define FW_RI_RES_WR_CIDXFTHRESHO_V(x) ((x) << FW_RI_RES_WR_CIDXFTHRESHO_S)
412+#define FW_RI_RES_WR_CIDXFTHRESHO_G(x) \
413+ (((x) >> FW_RI_RES_WR_CIDXFTHRESHO_S) & FW_RI_RES_WR_CIDXFTHRESHO_M)
414+#define FW_RI_RES_WR_CIDXFTHRESHO_F FW_RI_RES_WR_CIDXFTHRESHO_V(1U)
415+
416+#define FW_RI_RES_WR_CIDXFTHRESH_S 16
417+#define FW_RI_RES_WR_CIDXFTHRESH_M 0x7
418+#define FW_RI_RES_WR_CIDXFTHRESH_V(x) ((x) << FW_RI_RES_WR_CIDXFTHRESH_S)
419+#define FW_RI_RES_WR_CIDXFTHRESH_G(x) \
420+ (((x) >> FW_RI_RES_WR_CIDXFTHRESH_S) & FW_RI_RES_WR_CIDXFTHRESH_M)
421+
422+#define FW_RI_RES_WR_EQSIZE_S 0
423+#define FW_RI_RES_WR_EQSIZE_M 0xffff
424+#define FW_RI_RES_WR_EQSIZE_V(x) ((x) << FW_RI_RES_WR_EQSIZE_S)
425+#define FW_RI_RES_WR_EQSIZE_G(x) \
426+ (((x) >> FW_RI_RES_WR_EQSIZE_S) & FW_RI_RES_WR_EQSIZE_M)
427+
428+#define FW_RI_RES_WR_IQANDST_S 15
429+#define FW_RI_RES_WR_IQANDST_M 0x1
430+#define FW_RI_RES_WR_IQANDST_V(x) ((x) << FW_RI_RES_WR_IQANDST_S)
431+#define FW_RI_RES_WR_IQANDST_G(x) \
432+ (((x) >> FW_RI_RES_WR_IQANDST_S) & FW_RI_RES_WR_IQANDST_M)
433+#define FW_RI_RES_WR_IQANDST_F FW_RI_RES_WR_IQANDST_V(1U)
434+
435+#define FW_RI_RES_WR_IQANUS_S 14
436+#define FW_RI_RES_WR_IQANUS_M 0x1
437+#define FW_RI_RES_WR_IQANUS_V(x) ((x) << FW_RI_RES_WR_IQANUS_S)
438+#define FW_RI_RES_WR_IQANUS_G(x) \
439+ (((x) >> FW_RI_RES_WR_IQANUS_S) & FW_RI_RES_WR_IQANUS_M)
440+#define FW_RI_RES_WR_IQANUS_F FW_RI_RES_WR_IQANUS_V(1U)
441+
442+#define FW_RI_RES_WR_IQANUD_S 12
443+#define FW_RI_RES_WR_IQANUD_M 0x3
444+#define FW_RI_RES_WR_IQANUD_V(x) ((x) << FW_RI_RES_WR_IQANUD_S)
445+#define FW_RI_RES_WR_IQANUD_G(x) \
446+ (((x) >> FW_RI_RES_WR_IQANUD_S) & FW_RI_RES_WR_IQANUD_M)
447+
448+#define FW_RI_RES_WR_IQANDSTINDEX_S 0
449+#define FW_RI_RES_WR_IQANDSTINDEX_M 0xfff
450+#define FW_RI_RES_WR_IQANDSTINDEX_V(x) ((x) << FW_RI_RES_WR_IQANDSTINDEX_S)
451+#define FW_RI_RES_WR_IQANDSTINDEX_G(x) \
452+ (((x) >> FW_RI_RES_WR_IQANDSTINDEX_S) & FW_RI_RES_WR_IQANDSTINDEX_M)
453+
454+#define FW_RI_RES_WR_IQDROPRSS_S 15
455+#define FW_RI_RES_WR_IQDROPRSS_M 0x1
456+#define FW_RI_RES_WR_IQDROPRSS_V(x) ((x) << FW_RI_RES_WR_IQDROPRSS_S)
457+#define FW_RI_RES_WR_IQDROPRSS_G(x) \
458+ (((x) >> FW_RI_RES_WR_IQDROPRSS_S) & FW_RI_RES_WR_IQDROPRSS_M)
459+#define FW_RI_RES_WR_IQDROPRSS_F FW_RI_RES_WR_IQDROPRSS_V(1U)
460+
461+#define FW_RI_RES_WR_IQGTSMODE_S 14
462+#define FW_RI_RES_WR_IQGTSMODE_M 0x1
463+#define FW_RI_RES_WR_IQGTSMODE_V(x) ((x) << FW_RI_RES_WR_IQGTSMODE_S)
464+#define FW_RI_RES_WR_IQGTSMODE_G(x) \
465+ (((x) >> FW_RI_RES_WR_IQGTSMODE_S) & FW_RI_RES_WR_IQGTSMODE_M)
466+#define FW_RI_RES_WR_IQGTSMODE_F FW_RI_RES_WR_IQGTSMODE_V(1U)
467+
468+#define FW_RI_RES_WR_IQPCIECH_S 12
469+#define FW_RI_RES_WR_IQPCIECH_M 0x3
470+#define FW_RI_RES_WR_IQPCIECH_V(x) ((x) << FW_RI_RES_WR_IQPCIECH_S)
471+#define FW_RI_RES_WR_IQPCIECH_G(x) \
472+ (((x) >> FW_RI_RES_WR_IQPCIECH_S) & FW_RI_RES_WR_IQPCIECH_M)
473+
474+#define FW_RI_RES_WR_IQDCAEN_S 11
475+#define FW_RI_RES_WR_IQDCAEN_M 0x1
476+#define FW_RI_RES_WR_IQDCAEN_V(x) ((x) << FW_RI_RES_WR_IQDCAEN_S)
477+#define FW_RI_RES_WR_IQDCAEN_G(x) \
478+ (((x) >> FW_RI_RES_WR_IQDCAEN_S) & FW_RI_RES_WR_IQDCAEN_M)
479+#define FW_RI_RES_WR_IQDCAEN_F FW_RI_RES_WR_IQDCAEN_V(1U)
480+
481+#define FW_RI_RES_WR_IQDCACPU_S 6
482+#define FW_RI_RES_WR_IQDCACPU_M 0x1f
483+#define FW_RI_RES_WR_IQDCACPU_V(x) ((x) << FW_RI_RES_WR_IQDCACPU_S)
484+#define FW_RI_RES_WR_IQDCACPU_G(x) \
485+ (((x) >> FW_RI_RES_WR_IQDCACPU_S) & FW_RI_RES_WR_IQDCACPU_M)
486+
487+#define FW_RI_RES_WR_IQINTCNTTHRESH_S 4
488+#define FW_RI_RES_WR_IQINTCNTTHRESH_M 0x3
489+#define FW_RI_RES_WR_IQINTCNTTHRESH_V(x) \
490+ ((x) << FW_RI_RES_WR_IQINTCNTTHRESH_S)
491+#define FW_RI_RES_WR_IQINTCNTTHRESH_G(x) \
492+ (((x) >> FW_RI_RES_WR_IQINTCNTTHRESH_S) & FW_RI_RES_WR_IQINTCNTTHRESH_M)
493+
494+#define FW_RI_RES_WR_IQO_S 3
495+#define FW_RI_RES_WR_IQO_M 0x1
496+#define FW_RI_RES_WR_IQO_V(x) ((x) << FW_RI_RES_WR_IQO_S)
497+#define FW_RI_RES_WR_IQO_G(x) \
498+ (((x) >> FW_RI_RES_WR_IQO_S) & FW_RI_RES_WR_IQO_M)
499+#define FW_RI_RES_WR_IQO_F FW_RI_RES_WR_IQO_V(1U)
500+
501+#define FW_RI_RES_WR_IQCPRIO_S 2
502+#define FW_RI_RES_WR_IQCPRIO_M 0x1
503+#define FW_RI_RES_WR_IQCPRIO_V(x) ((x) << FW_RI_RES_WR_IQCPRIO_S)
504+#define FW_RI_RES_WR_IQCPRIO_G(x) \
505+ (((x) >> FW_RI_RES_WR_IQCPRIO_S) & FW_RI_RES_WR_IQCPRIO_M)
506+#define FW_RI_RES_WR_IQCPRIO_F FW_RI_RES_WR_IQCPRIO_V(1U)
507+
508+#define FW_RI_RES_WR_IQESIZE_S 0
509+#define FW_RI_RES_WR_IQESIZE_M 0x3
510+#define FW_RI_RES_WR_IQESIZE_V(x) ((x) << FW_RI_RES_WR_IQESIZE_S)
511+#define FW_RI_RES_WR_IQESIZE_G(x) \
512+ (((x) >> FW_RI_RES_WR_IQESIZE_S) & FW_RI_RES_WR_IQESIZE_M)
513+
514+#define FW_RI_RES_WR_IQNS_S 31
515+#define FW_RI_RES_WR_IQNS_M 0x1
516+#define FW_RI_RES_WR_IQNS_V(x) ((x) << FW_RI_RES_WR_IQNS_S)
517+#define FW_RI_RES_WR_IQNS_G(x) \
518+ (((x) >> FW_RI_RES_WR_IQNS_S) & FW_RI_RES_WR_IQNS_M)
519+#define FW_RI_RES_WR_IQNS_F FW_RI_RES_WR_IQNS_V(1U)
520+
521+#define FW_RI_RES_WR_IQRO_S 30
522+#define FW_RI_RES_WR_IQRO_M 0x1
523+#define FW_RI_RES_WR_IQRO_V(x) ((x) << FW_RI_RES_WR_IQRO_S)
524+#define FW_RI_RES_WR_IQRO_G(x) \
525+ (((x) >> FW_RI_RES_WR_IQRO_S) & FW_RI_RES_WR_IQRO_M)
526+#define FW_RI_RES_WR_IQRO_F FW_RI_RES_WR_IQRO_V(1U)
527527
528528 struct fw_ri_rdma_write_wr {
529529 __u8 opcode;
@@ -562,11 +562,11 @@ struct fw_ri_send_wr { · 32 unmodified lines
562562 #endif
563563 };
564564
565−#define S_FW_RI_SEND_WR_SENDOP 0
566−#define M_FW_RI_SEND_WR_SENDOP 0xf
567−#define V_FW_RI_SEND_WR_SENDOP(x) ((x) << S_FW_RI_SEND_WR_SENDOP)
568−#define G_FW_RI_SEND_WR_SENDOP(x) \
569− (((x) >> S_FW_RI_SEND_WR_SENDOP) & M_FW_RI_SEND_WR_SENDOP)
565+#define FW_RI_SEND_WR_SENDOP_S 0
566+#define FW_RI_SEND_WR_SENDOP_M 0xf
567+#define FW_RI_SEND_WR_SENDOP_V(x) ((x) << FW_RI_SEND_WR_SENDOP_S)
568+#define FW_RI_SEND_WR_SENDOP_G(x) \
569+ (((x) >> FW_RI_SEND_WR_SENDOP_S) & FW_RI_SEND_WR_SENDOP_M)
570570
571571 struct fw_ri_rdma_read_wr {
572572 __u8 opcode;
@@ -612,25 +612,25 @@ struct fw_ri_bind_mw_wr { · 39 unmodified lines
612612 __be64 r4;
613613 };
614614
615−#define S_FW_RI_BIND_MW_WR_QPBINDE 6
616−#define M_FW_RI_BIND_MW_WR_QPBINDE 0x1
617−#define V_FW_RI_BIND_MW_WR_QPBINDE(x) ((x) << S_FW_RI_BIND_MW_WR_QPBINDE)
618−#define G_FW_RI_BIND_MW_WR_QPBINDE(x) \
619− (((x) >> S_FW_RI_BIND_MW_WR_QPBINDE) & M_FW_RI_BIND_MW_WR_QPBINDE)
620−#define F_FW_RI_BIND_MW_WR_QPBINDE V_FW_RI_BIND_MW_WR_QPBINDE(1U)
615+#define FW_RI_BIND_MW_WR_QPBINDE_S 6
616+#define FW_RI_BIND_MW_WR_QPBINDE_M 0x1
617+#define FW_RI_BIND_MW_WR_QPBINDE_V(x) ((x) << FW_RI_BIND_MW_WR_QPBINDE_S)
618+#define FW_RI_BIND_MW_WR_QPBINDE_G(x) \
619+ (((x) >> FW_RI_BIND_MW_WR_QPBINDE_S) & FW_RI_BIND_MW_WR_QPBINDE_M)
620+#define FW_RI_BIND_MW_WR_QPBINDE_F FW_RI_BIND_MW_WR_QPBINDE_V(1U)
621621
622−#define S_FW_RI_BIND_MW_WR_NS 5
623−#define M_FW_RI_BIND_MW_WR_NS 0x1
624−#define V_FW_RI_BIND_MW_WR_NS(x) ((x) << S_FW_RI_BIND_MW_WR_NS)
625−#define G_FW_RI_BIND_MW_WR_NS(x) \
626− (((x) >> S_FW_RI_BIND_MW_WR_NS) & M_FW_RI_BIND_MW_WR_NS)
627−#define F_FW_RI_BIND_MW_WR_NS V_FW_RI_BIND_MW_WR_NS(1U)
622+#define FW_RI_BIND_MW_WR_NS_S 5
623+#define FW_RI_BIND_MW_WR_NS_M 0x1
624+#define FW_RI_BIND_MW_WR_NS_V(x) ((x) << FW_RI_BIND_MW_WR_NS_S)
625+#define FW_RI_BIND_MW_WR_NS_G(x) \
626+ (((x) >> FW_RI_BIND_MW_WR_NS_S) & FW_RI_BIND_MW_WR_NS_M)
627+#define FW_RI_BIND_MW_WR_NS_F FW_RI_BIND_MW_WR_NS_V(1U)
628628
629−#define S_FW_RI_BIND_MW_WR_DCACPU 0
630−#define M_FW_RI_BIND_MW_WR_DCACPU 0x1f
631−#define V_FW_RI_BIND_MW_WR_DCACPU(x) ((x) << S_FW_RI_BIND_MW_WR_DCACPU)
632−#define G_FW_RI_BIND_MW_WR_DCACPU(x) \
633− (((x) >> S_FW_RI_BIND_MW_WR_DCACPU) & M_FW_RI_BIND_MW_WR_DCACPU)
629+#define FW_RI_BIND_MW_WR_DCACPU_S 0
630+#define FW_RI_BIND_MW_WR_DCACPU_M 0x1f
631+#define FW_RI_BIND_MW_WR_DCACPU_V(x) ((x) << FW_RI_BIND_MW_WR_DCACPU_S)
632+#define FW_RI_BIND_MW_WR_DCACPU_G(x) \
633+ (((x) >> FW_RI_BIND_MW_WR_DCACPU_S) & FW_RI_BIND_MW_WR_DCACPU_M)
634634
635635 struct fw_ri_fr_nsmr_wr {
636636 __u8 opcode;
@@ -649,25 +649,25 @@ struct fw_ri_fr_nsmr_wr { · 12 unmodified lines
649649 __be32 va_lo_fbo;
650650 };
651651
652−#define S_FW_RI_FR_NSMR_WR_QPBINDE 6
653−#define M_FW_RI_FR_NSMR_WR_QPBINDE 0x1
654−#define V_FW_RI_FR_NSMR_WR_QPBINDE(x) ((x) << S_FW_RI_FR_NSMR_WR_QPBINDE)
655−#define G_FW_RI_FR_NSMR_WR_QPBINDE(x) \
656− (((x) >> S_FW_RI_FR_NSMR_WR_QPBINDE) & M_FW_RI_FR_NSMR_WR_QPBINDE)
657−#define F_FW_RI_FR_NSMR_WR_QPBINDE V_FW_RI_FR_NSMR_WR_QPBINDE(1U)
652+#define FW_RI_FR_NSMR_WR_QPBINDE_S 6
653+#define FW_RI_FR_NSMR_WR_QPBINDE_M 0x1
654+#define FW_RI_FR_NSMR_WR_QPBINDE_V(x) ((x) << FW_RI_FR_NSMR_WR_QPBINDE_S)
655+#define FW_RI_FR_NSMR_WR_QPBINDE_G(x) \
656+ (((x) >> FW_RI_FR_NSMR_WR_QPBINDE_S) & FW_RI_FR_NSMR_WR_QPBINDE_M)
657+#define FW_RI_FR_NSMR_WR_QPBINDE_F FW_RI_FR_NSMR_WR_QPBINDE_V(1U)
658658
659−#define S_FW_RI_FR_NSMR_WR_NS 5
660−#define M_FW_RI_FR_NSMR_WR_NS 0x1
661−#define V_FW_RI_FR_NSMR_WR_NS(x) ((x) << S_FW_RI_FR_NSMR_WR_NS)
662−#define G_FW_RI_FR_NSMR_WR_NS(x) \
663− (((x) >> S_FW_RI_FR_NSMR_WR_NS) & M_FW_RI_FR_NSMR_WR_NS)
664−#define F_FW_RI_FR_NSMR_WR_NS V_FW_RI_FR_NSMR_WR_NS(1U)
659+#define FW_RI_FR_NSMR_WR_NS_S 5
660+#define FW_RI_FR_NSMR_WR_NS_M 0x1
661+#define FW_RI_FR_NSMR_WR_NS_V(x) ((x) << FW_RI_FR_NSMR_WR_NS_S)
662+#define FW_RI_FR_NSMR_WR_NS_G(x) \
663+ (((x) >> FW_RI_FR_NSMR_WR_NS_S) & FW_RI_FR_NSMR_WR_NS_M)
664+#define FW_RI_FR_NSMR_WR_NS_F FW_RI_FR_NSMR_WR_NS_V(1U)
665665
666−#define S_FW_RI_FR_NSMR_WR_DCACPU 0
667−#define M_FW_RI_FR_NSMR_WR_DCACPU 0x1f
668−#define V_FW_RI_FR_NSMR_WR_DCACPU(x) ((x) << S_FW_RI_FR_NSMR_WR_DCACPU)
669−#define G_FW_RI_FR_NSMR_WR_DCACPU(x) \
670− (((x) >> S_FW_RI_FR_NSMR_WR_DCACPU) & M_FW_RI_FR_NSMR_WR_DCACPU)
666+#define FW_RI_FR_NSMR_WR_DCACPU_S 0
667+#define FW_RI_FR_NSMR_WR_DCACPU_M 0x1f
668+#define FW_RI_FR_NSMR_WR_DCACPU_V(x) ((x) << FW_RI_FR_NSMR_WR_DCACPU_S)
669+#define FW_RI_FR_NSMR_WR_DCACPU_G(x) \
670+ (((x) >> FW_RI_FR_NSMR_WR_DCACPU_S) & FW_RI_FR_NSMR_WR_DCACPU_M)
671671
672672 struct fw_ri_inv_lstag_wr {
673673 __u8 opcode;
@@ -740,18 +740,18 @@ struct fw_ri_wr { · 66 unmodified lines
740740 } u;
741741 };
742742
743−#define S_FW_RI_WR_MPAREQBIT 7
744−#define M_FW_RI_WR_MPAREQBIT 0x1
745−#define V_FW_RI_WR_MPAREQBIT(x) ((x) << S_FW_RI_WR_MPAREQBIT)
746−#define G_FW_RI_WR_MPAREQBIT(x) \
747− (((x) >> S_FW_RI_WR_MPAREQBIT) & M_FW_RI_WR_MPAREQBIT)
748−#define F_FW_RI_WR_MPAREQBIT V_FW_RI_WR_MPAREQBIT(1U)
743+#define FW_RI_WR_MPAREQBIT_S 7
744+#define FW_RI_WR_MPAREQBIT_M 0x1
745+#define FW_RI_WR_MPAREQBIT_V(x) ((x) << FW_RI_WR_MPAREQBIT_S)
746+#define FW_RI_WR_MPAREQBIT_G(x) \
747+ (((x) >> FW_RI_WR_MPAREQBIT_S) & FW_RI_WR_MPAREQBIT_M)
748+#define FW_RI_WR_MPAREQBIT_F FW_RI_WR_MPAREQBIT_V(1U)
749749
750−#define S_FW_RI_WR_P2PTYPE 0
751−#define M_FW_RI_WR_P2PTYPE 0xf
752−#define V_FW_RI_WR_P2PTYPE(x) ((x) << S_FW_RI_WR_P2PTYPE)
753−#define G_FW_RI_WR_P2PTYPE(x) \
754− (((x) >> S_FW_RI_WR_P2PTYPE) & M_FW_RI_WR_P2PTYPE)
750+#define FW_RI_WR_P2PTYPE_S 0
751+#define FW_RI_WR_P2PTYPE_M 0xf
752+#define FW_RI_WR_P2PTYPE_V(x) ((x) << FW_RI_WR_P2PTYPE_S)
753+#define FW_RI_WR_P2PTYPE_G(x) \
754+ (((x) >> FW_RI_WR_P2PTYPE_S) & FW_RI_WR_P2PTYPE_M)
755755
756756 struct tcp_options {
757757 __be16 mss;
@@ -783,58 +783,58 @@ struct cpl_pass_accept_req { · 25 unmodified lines
783783 };
784784
785785 /* cpl_pass_accept_req.hdr_len fields */
786−#define S_SYN_RX_CHAN 0
787−#define M_SYN_RX_CHAN 0xF
788−#define V_SYN_RX_CHAN(x) ((x) << S_SYN_RX_CHAN)
789−#define G_SYN_RX_CHAN(x) (((x) >> S_SYN_RX_CHAN) & M_SYN_RX_CHAN)
790−
791−#define S_TCP_HDR_LEN 10
792−#define M_TCP_HDR_LEN 0x3F
793−#define V_TCP_HDR_LEN(x) ((x) << S_TCP_HDR_LEN)
794−#define G_TCP_HDR_LEN(x) (((x) >> S_TCP_HDR_LEN) & M_TCP_HDR_LEN)
795−
796−#define S_IP_HDR_LEN 16
797−#define M_IP_HDR_LEN 0x3FF
798−#define V_IP_HDR_LEN(x) ((x) << S_IP_HDR_LEN)
799−#define G_IP_HDR_LEN(x) (((x) >> S_IP_HDR_LEN) & M_IP_HDR_LEN)
800−
801−#define S_ETH_HDR_LEN 26
802−#define M_ETH_HDR_LEN 0x1F
803−#define V_ETH_HDR_LEN(x) ((x) << S_ETH_HDR_LEN)
804−#define G_ETH_HDR_LEN(x) (((x) >> S_ETH_HDR_LEN) & M_ETH_HDR_LEN)
786+#define SYN_RX_CHAN_S 0
787+#define SYN_RX_CHAN_M 0xF
788+#define SYN_RX_CHAN_V(x) ((x) << SYN_RX_CHAN_S)
789+#define SYN_RX_CHAN_G(x) (((x) >> SYN_RX_CHAN_S) & SYN_RX_CHAN_M)
790+
791+#define TCP_HDR_LEN_S 10
792+#define TCP_HDR_LEN_M 0x3F
793+#define TCP_HDR_LEN_V(x) ((x) << TCP_HDR_LEN_S)
794+#define TCP_HDR_LEN_G(x) (((x) >> TCP_HDR_LEN_S) & TCP_HDR_LEN_M)
795+
796+#define IP_HDR_LEN_S 16
797+#define IP_HDR_LEN_M 0x3FF
798+#define IP_HDR_LEN_V(x) ((x) << IP_HDR_LEN_S)
799+#define IP_HDR_LEN_G(x) (((x) >> IP_HDR_LEN_S) & IP_HDR_LEN_M)
800+
801+#define ETH_HDR_LEN_S 26
802+#define ETH_HDR_LEN_M 0x1F
803+#define ETH_HDR_LEN_V(x) ((x) << ETH_HDR_LEN_S)
804+#define ETH_HDR_LEN_G(x) (((x) >> ETH_HDR_LEN_S) & ETH_HDR_LEN_M)
805805
806806 /* cpl_pass_accept_req.l2info fields */
807−#define S_SYN_MAC_IDX 0
808−#define M_SYN_MAC_IDX 0x1FF
809−#define V_SYN_MAC_IDX(x) ((x) << S_SYN_MAC_IDX)
810−#define G_SYN_MAC_IDX(x) (((x) >> S_SYN_MAC_IDX) & M_SYN_MAC_IDX)
807+#define SYN_MAC_IDX_S 0
808+#define SYN_MAC_IDX_M 0x1FF
809+#define SYN_MAC_IDX_V(x) ((x) << SYN_MAC_IDX_S)
810+#define SYN_MAC_IDX_G(x) (((x) >> SYN_MAC_IDX_S) & SYN_MAC_IDX_M)
811811
812−#define S_SYN_XACT_MATCH 9
813−#define V_SYN_XACT_MATCH(x) ((x) << S_SYN_XACT_MATCH)
814−#define F_SYN_XACT_MATCH V_SYN_XACT_MATCH(1U)
812+#define SYN_XACT_MATCH_S 9
813+#define SYN_XACT_MATCH_V(x) ((x) << SYN_XACT_MATCH_S)
814+#define SYN_XACT_MATCH_F SYN_XACT_MATCH_V(1U)
815815
816−#define S_SYN_INTF 12
817−#define M_SYN_INTF 0xF
818−#define V_SYN_INTF(x) ((x) << S_SYN_INTF)
819−#define G_SYN_INTF(x) (((x) >> S_SYN_INTF) & M_SYN_INTF)
816+#define SYN_INTF_S 12
817+#define SYN_INTF_M 0xF
818+#define SYN_INTF_V(x) ((x) << SYN_INTF_S)
819+#define SYN_INTF_G(x) (((x) >> SYN_INTF_S) & SYN_INTF_M)
820820
821821 struct ulptx_idata {
822822 __be32 cmd_more;
823823 __be32 len;
824824 };
825825
826−#define S_ULPTX_NSGE 0
827−#define M_ULPTX_NSGE 0xFFFF
828−#define V_ULPTX_NSGE(x) ((x) << S_ULPTX_NSGE)
826+#define ULPTX_NSGE_S 0
827+#define ULPTX_NSGE_M 0xFFFF
828+#define ULPTX_NSGE_V(x) ((x) << ULPTX_NSGE_S)
829829
830−#define S_RX_DACK_MODE 29
831−#define M_RX_DACK_MODE 0x3
832−#define V_RX_DACK_MODE(x) ((x) << S_RX_DACK_MODE)
833−#define G_RX_DACK_MODE(x) (((x) >> S_RX_DACK_MODE) & M_RX_DACK_MODE)
830+#define RX_DACK_MODE_S 29
831+#define RX_DACK_MODE_M 0x3
832+#define RX_DACK_MODE_V(x) ((x) << RX_DACK_MODE_S)
833+#define RX_DACK_MODE_G(x) (((x) >> RX_DACK_MODE_S) & RX_DACK_MODE_M)
834834
835−#define S_RX_DACK_CHANGE 31
836−#define V_RX_DACK_CHANGE(x) ((x) << S_RX_DACK_CHANGE)
837−#define F_RX_DACK_CHANGE V_RX_DACK_CHANGE(1U)
835+#define RX_DACK_CHANGE_S 31
836+#define RX_DACK_CHANGE_V(x) ((x) << RX_DACK_CHANGE_S)
837+#define RX_DACK_CHANGE_F RX_DACK_CHANGE_V(1U)
838838
839839 enum { /* TCP congestion control algorithms */
840840 CONG_ALG_RENO,
@@ -843,10 +843,10 @@ enum { /* TCP congestion control algorithms */ · 2 unmodified lines
843843 CONG_ALG_HIGHSPEED
844844 };
845845
846−#define S_CONG_CNTRL 14
847−#define M_CONG_CNTRL 0x3
848−#define V_CONG_CNTRL(x) ((x) << S_CONG_CNTRL)
849−#define G_CONG_CNTRL(x) (((x) >> S_CONG_CNTRL) & M_CONG_CNTRL)
846+#define CONG_CNTRL_S 14
847+#define CONG_CNTRL_M 0x3
848+#define CONG_CNTRL_V(x) ((x) << CONG_CNTRL_S)
849+#define CONG_CNTRL_G(x) (((x) >> CONG_CNTRL_S) & CONG_CNTRL_M)
850850
851851 #define CONG_CNTRL_VALID (1 << 18)
852852
drivers/infiniband/hw/mlx4/ah.c+1−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include <linux/slab.h>
3737 #include <linux/inet.h>
3838 #include <linux/string.h>
39+#include <linux/mlx4/driver.h>
3940
4041 #include "mlx4_ib.h"
4142
drivers/infiniband/hw/mlx4/alias_GUID.c+1−1
@@ -154,7 +154,7 @@ void mlx4_ib_notify_slaves_on_guid_change(struct mlx4_ib_dev *dev, · 153 unmodified lines
154154 continue;
155155
156156 slave_id = (block_num * NUM_ALIAS_GUID_IN_REC) + i ;
157− if (slave_id >= dev->dev->num_vfs + 1)
157+ if (slave_id >= dev->dev->persist->num_vfs + 1)
158158 return;
159159 tmp_cur_ag = *(__be64 *)&p_data[i * GUID_REC_SIZE];
160160 form_cache_ag = get_cached_alias_guid(dev, port_num,
drivers/infiniband/hw/mlx4/cq.c+57−0
@@ -188,6 +188,8 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector · 187 unmodified lines
188188 spin_lock_init(&cq->lock);
189189 cq->resize_buf = NULL;
190190 cq->resize_umem = NULL;
191+ INIT_LIST_HEAD(&cq->send_qp_list);
192+ INIT_LIST_HEAD(&cq->recv_qp_list);
191193
192194 if (context) {
193195 struct mlx4_ib_create_cq ucmd;
@@ -594,6 +596,55 @@ static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct · 400 unmodified lines
594596 return 0;
595597 }
596598
599+static void mlx4_ib_qp_sw_comp(struct mlx4_ib_qp *qp, int num_entries,
600+ struct ib_wc *wc, int *npolled, int is_send)
601+{
602+ struct mlx4_ib_wq *wq;
603+ unsigned cur;
604+ int i;
605+
606+ wq = is_send ? &qp->sq : &qp->rq;
607+ cur = wq->head - wq->tail;
608+
609+ if (cur == 0)
610+ return;
611+
612+ for (i = 0; i < cur && *npolled < num_entries; i++) {
613+ wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
614+ wc->status = IB_WC_WR_FLUSH_ERR;
615+ wc->vendor_err = MLX4_CQE_SYNDROME_WR_FLUSH_ERR;
616+ wq->tail++;
617+ (*npolled)++;
618+ wc->qp = &qp->ibqp;
619+ wc++;
620+ }
621+}
622+
623+static void mlx4_ib_poll_sw_comp(struct mlx4_ib_cq *cq, int num_entries,
624+ struct ib_wc *wc, int *npolled)
625+{
626+ struct mlx4_ib_qp *qp;
627+
628+ *npolled = 0;
629+ /* Find uncompleted WQEs belonging to that cq and retrun
630+ * simulated FLUSH_ERR completions
631+ */
632+ list_for_each_entry(qp, &cq->send_qp_list, cq_send_list) {
633+ mlx4_ib_qp_sw_comp(qp, num_entries, wc, npolled, 1);
634+ if (*npolled >= num_entries)
635+ goto out;
636+ }
637+
638+ list_for_each_entry(qp, &cq->recv_qp_list, cq_recv_list) {
639+ mlx4_ib_qp_sw_comp(qp, num_entries, wc + *npolled, npolled, 0);
640+ if (*npolled >= num_entries)
641+ goto out;
642+ }
643+
644+out:
645+ return;
646+}
647+
597648 static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
598649 struct mlx4_ib_qp **cur_qp,
599650 struct ib_wc *wc)
@@ -836,8 +887,13 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 236 unmodified lines
836887 unsigned long flags;
837888 int npolled;
838889 int err = 0;
890+ struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device);
839891
840892 spin_lock_irqsave(&cq->lock, flags);
893+ if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) {
894+ mlx4_ib_poll_sw_comp(cq, num_entries, wc, &npolled);
895+ goto out;
896+ }
841897
842898 for (npolled = 0; npolled < num_entries; ++npolled) {
843899 err = mlx4_ib_poll_one(cq, &cur_qp, wc + npolled);
@@ -847,6 +903,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 3 unmodified lines
847903
848904 mlx4_cq_set_ci(&cq->mcq);
849905
906+out:
850907 spin_unlock_irqrestore(&cq->lock, flags);
851908
852909 if (err == 0 || err == -EAGAIN)
drivers/infiniband/hw/mlx4/mad.c+2−1
@@ -1951,7 +1951,8 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, · 1950 unmodified lines
19511951 ctx->ib_dev = &dev->ib_dev;
19521952
19531953 for (i = 0;
1954− i < min(dev->dev->caps.sqp_demux, (u16)(dev->dev->num_vfs + 1));
1954+ i < min(dev->dev->caps.sqp_demux,
1955+ (u16)(dev->dev->persist->num_vfs + 1));
19551956 i++) {
19561957 struct mlx4_active_ports actv_ports =
19571958 mlx4_get_active_ports(dev->dev, i);
drivers/infiniband/hw/mlx4/main.c+221−25
@@ -198,7 +198,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 197 unmodified lines
198198
199199 props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) &
200200 0xffffff;
201− props->vendor_part_id = dev->dev->pdev->device;
201+ props->vendor_part_id = dev->dev->persist->pdev->device;
202202 props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32));
203203 memcpy(&props->sys_image_guid, out_mad->data + 4, 8);
204204
@@ -351,6 +351,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 146 unmodified lines
351351 enum ib_mtu tmp;
352352 struct mlx4_cmd_mailbox *mailbox;
353353 int err = 0;
354+ int is_bonded = mlx4_is_bonded(mdev->dev);
354355
355356 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
356357 if (IS_ERR(mailbox))
@@ -374,8 +375,12 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 17 unmodified lines
374375 props->state = IB_PORT_DOWN;
375376 props->phys_state = state_to_phys_state(props->state);
376377 props->active_mtu = IB_MTU_256;
378+ if (is_bonded)
379+ rtnl_lock(); /* required to get upper dev */
377380 spin_lock_bh(&iboe->lock);
378381 ndev = iboe->netdevs[port - 1];
382+ if (ndev && is_bonded)
383+ ndev = netdev_master_upper_dev_get(ndev);
379384 if (!ndev)
380385 goto out_unlock;
381386
@@ -387,6 +392,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 5 unmodified lines
387392 props->phys_state = state_to_phys_state(props->state);
388393 out_unlock:
389394 spin_unlock_bh(&iboe->lock);
395+ if (is_bonded)
396+ rtnl_unlock();
390397 out:
391398 mlx4_free_cmd_mailbox(mdev->dev, mailbox);
392399 return err;
@@ -844,7 +851,7 @@ int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, · 451 unmodified lines
844851
845852 struct mlx4_ib_steering {
846853 struct list_head list;
847− u64 reg_id;
854+ struct mlx4_flow_reg_id reg_id;
848855 union ib_gid gid;
849856 };
850857
@@ -1135,9 +1142,11 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 284 unmodified lines
11351142 struct ib_flow_attr *flow_attr,
11361143 int domain)
11371144 {
1138− int err = 0, i = 0;
1145+ int err = 0, i = 0, j = 0;
11391146 struct mlx4_ib_flow *mflow;
11401147 enum mlx4_net_trans_promisc_mode type[2];
1148+ struct mlx4_dev *dev = (to_mdev(qp->device))->dev;
1149+ int is_bonded = mlx4_is_bonded(dev);
11411150
11421151 memset(type, 0, sizeof(type));
11431152
@@ -1172,26 +1181,58 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 28 unmodified lines
11721181
11731182 while (i < ARRAY_SIZE(type) && type[i]) {
11741183 err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i],
1175− &mflow->reg_id[i]);
1184+ &mflow->reg_id[i].id);
11761185 if (err)
11771186 goto err_create_flow;
11781187 i++;
1188+ if (is_bonded) {
1189+ /* Application always sees one port so the mirror rule
1190+ * must be on port #2
1191+ */
1192+ flow_attr->port = 2;
1193+ err = __mlx4_ib_create_flow(qp, flow_attr,
1194+ domain, type[j],
1195+ &mflow->reg_id[j].mirror);
1196+ flow_attr->port = 1;
1197+ if (err)
1198+ goto err_create_flow;
1199+ j++;
1200+ }
1201+
11791202 }
11801203
11811204 if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) {
1182− err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]);
1205+ err = mlx4_ib_tunnel_steer_add(qp, flow_attr,
1206+ &mflow->reg_id[i].id);
11831207 if (err)
11841208 goto err_create_flow;
11851209 i++;
1210+ if (is_bonded) {
1211+ flow_attr->port = 2;
1212+ err = mlx4_ib_tunnel_steer_add(qp, flow_attr,
1213+ &mflow->reg_id[j].mirror);
1214+ flow_attr->port = 1;
1215+ if (err)
1216+ goto err_create_flow;
1217+ j++;
1218+ }
1219+ /* function to create mirror rule */
11861220 }
11871221
11881222 return &mflow->ibflow;
11891223
11901224 err_create_flow:
11911225 while (i) {
1192− (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, mflow->reg_id[i]);
1226+ (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev,
1227+ mflow->reg_id[i].id);
11931228 i--;
11941229 }
1230+
1231+ while (j) {
1232+ (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev,
1233+ mflow->reg_id[j].mirror);
1234+ j--;
1235+ }
11951236 err_free:
11961237 kfree(mflow);
11971238 return ERR_PTR(err);
@@ -1204,10 +1245,16 @@ static int mlx4_ib_destroy_flow(struct ib_flow *flow_id) · 6 unmodified lines
12041245 struct mlx4_ib_dev *mdev = to_mdev(flow_id->qp->device);
12051246 struct mlx4_ib_flow *mflow = to_mflow(flow_id);
12061247
1207− while (i < ARRAY_SIZE(mflow->reg_id) && mflow->reg_id[i]) {
1208− err = __mlx4_ib_destroy_flow(mdev->dev, mflow->reg_id[i]);
1248+ while (i < ARRAY_SIZE(mflow->reg_id) && mflow->reg_id[i].id) {
1249+ err = __mlx4_ib_destroy_flow(mdev->dev, mflow->reg_id[i].id);
12091250 if (err)
12101251 ret = err;
1252+ if (mflow->reg_id[i].mirror) {
1253+ err = __mlx4_ib_destroy_flow(mdev->dev,
1254+ mflow->reg_id[i].mirror);
1255+ if (err)
1256+ ret = err;
1257+ }
12111258 i++;
12121259 }
12131260
@@ -1219,11 +1266,12 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 5 unmodified lines
12191266 {
12201267 int err;
12211268 struct mlx4_ib_dev *mdev = to_mdev(ibqp->device);
1269+ struct mlx4_dev *dev = mdev->dev;
12221270 struct mlx4_ib_qp *mqp = to_mqp(ibqp);
1223− u64 reg_id;
12241271 struct mlx4_ib_steering *ib_steering = NULL;
12251272 enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ?
12261273 MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6;
1274+ struct mlx4_flow_reg_id reg_id;
12271275
12281276 if (mdev->dev->caps.steering_mode ==
12291277 MLX4_STEERING_MODE_DEVICE_MANAGED) {
@@ -1235,10 +1283,21 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 5 unmodified lines
12351283 err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw, mqp->port,
12361284 !!(mqp->flags &
12371285 MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK),
1238− prot, &reg_id);
1286+ prot, &reg_id.id);
12391287 if (err)
12401288 goto err_malloc;
12411289
1290+ reg_id.mirror = 0;
1291+ if (mlx4_is_bonded(dev)) {
1292+ err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw,
1293+ (mqp->port == 1) ? 2 : 1,
1294+ !!(mqp->flags &
1295+ MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK),
1296+ prot, &reg_id.mirror);
1297+ if (err)
1298+ goto err_add;
1299+ }
1300+
12421301 err = add_gid_entry(ibqp, gid);
12431302 if (err)
12441303 goto err_add;
@@ -1254,7 +1313,10 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 9 unmodified lines
12541313
12551314 err_add:
12561315 mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw,
1257− prot, reg_id);
1316+ prot, reg_id.id);
1317+ if (reg_id.mirror)
1318+ mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw,
1319+ prot, reg_id.mirror);
12581320 err_malloc:
12591321 kfree(ib_steering);
12601322
@@ -1281,10 +1343,12 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 20 unmodified lines
12811343 {
12821344 int err;
12831345 struct mlx4_ib_dev *mdev = to_mdev(ibqp->device);
1346+ struct mlx4_dev *dev = mdev->dev;
12841347 struct mlx4_ib_qp *mqp = to_mqp(ibqp);
12851348 struct net_device *ndev;
12861349 struct mlx4_ib_gid_entry *ge;
1287− u64 reg_id = 0;
1350+ struct mlx4_flow_reg_id reg_id = {0, 0};
1351+
12881352 enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ?
12891353 MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6;
12901354
@@ -1309,10 +1373,17 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 18 unmodified lines
13091373 }
13101374
13111375 err = mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw,
1312− prot, reg_id);
1376+ prot, reg_id.id);
13131377 if (err)
13141378 return err;
13151379
1380+ if (mlx4_is_bonded(dev)) {
1381+ err = mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw,
1382+ prot, reg_id.mirror);
1383+ if (err)
1384+ return err;
1385+ }
1386+
13161387 mutex_lock(&mqp->mutex);
13171388 ge = find_gid_entry(mqp, gid->raw);
13181389 if (ge) {
@@ -1376,7 +1447,7 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr, · 57 unmodified lines
13761447 {
13771448 struct mlx4_ib_dev *dev =
13781449 container_of(device, struct mlx4_ib_dev, ib_dev.dev);
1379− return sprintf(buf, "MT%d\n", dev->dev->pdev->device);
1450+ return sprintf(buf, "MT%d\n", dev->dev->persist->pdev->device);
13801451 }
13811452
13821453 static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr,
@@ -1440,6 +1511,7 @@ static void update_gids_task(struct work_struct *work) · 57 unmodified lines
14401511 union ib_gid *gids;
14411512 int err;
14421513 struct mlx4_dev *dev = gw->dev->dev;
1514+ int is_bonded = mlx4_is_bonded(dev);
14431515
14441516 if (!gw->dev->ib_active)
14451517 return;
@@ -1459,7 +1531,10 @@ static void update_gids_task(struct work_struct *work) · 13 unmodified lines
14591531 if (err)
14601532 pr_warn("set port command failed\n");
14611533 else
1462− mlx4_ib_dispatch_event(gw->dev, gw->port, IB_EVENT_GID_CHANGE);
1534+ if ((gw->port == 1) || !is_bonded)
1535+ mlx4_ib_dispatch_event(gw->dev,
1536+ is_bonded ? 1 : gw->port,
1537+ IB_EVENT_GID_CHANGE);
14631538
14641539 mlx4_free_cmd_mailbox(dev, mailbox);
14651540 kfree(gw);
@@ -1875,7 +1950,8 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, · 409 unmodified lines
18751950 * don't want the bond IP based gids in the table since
18761951 * flows that select port by gid may get the down port.
18771952 */
1878− if (port_state == IB_PORT_DOWN) {
1953+ if (port_state == IB_PORT_DOWN &&
1954+ !mlx4_is_bonded(ibdev->dev)) {
18791955 reset_gid_table(ibdev, port);
18801956 mlx4_ib_set_default_gid(ibdev,
18811957 curr_netdev,
@@ -1938,7 +2014,8 @@ static void init_pkeys(struct mlx4_ib_dev *ibdev) · 56 unmodified lines
19382014 int i;
19392015
19402016 if (mlx4_is_master(ibdev->dev)) {
1941− for (slave = 0; slave <= ibdev->dev->num_vfs; ++slave) {
2017+ for (slave = 0; slave <= ibdev->dev->persist->num_vfs;
2018+ ++slave) {
19422019 for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) {
19432020 for (i = 0;
19442021 i < ibdev->dev->phys_caps.pkey_phys_table_len[port];
@@ -1995,7 +2072,7 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) · 50 unmodified lines
19952072 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) {
19962073 for (j = 0; j < eq_per_port; j++) {
19972074 snprintf(name, sizeof(name), "mlx4-ib-%d-%d@%s",
1998− i, j, dev->pdev->bus->name);
2075+ i, j, dev->persist->pdev->bus->name);
19992076 /* Set IRQ for specific name (per ring) */
20002077 if (mlx4_assign_eq(dev, name, NULL,
20012078 &ibdev->eq_table[eq])) {
@@ -2046,6 +2123,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 44 unmodified lines
20462123 int err;
20472124 struct mlx4_ib_iboe *iboe;
20482125 int ib_num_ports = 0;
2126+ int num_req_counters;
20492127
20502128 pr_info_once("%s", mlx4_ib_version);
20512129
@@ -2059,7 +2137,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 7 unmodified lines
20592137
20602138 ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev);
20612139 if (!ibdev) {
2062− dev_err(&dev->pdev->dev, "Device struct alloc failed\n");
2140+ dev_err(&dev->persist->pdev->dev,
2141+ "Device struct alloc failed\n");
20632142 return NULL;
20642143 }
20652144
@@ -2078,15 +2157,17 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 12 unmodified lines
20782157 MLX4_INIT_DOORBELL_LOCK(&ibdev->uar_lock);
20792158
20802159 ibdev->dev = dev;
2160+ ibdev->bond_next_port = 0;
20812161
20822162 strlcpy(ibdev->ib_dev.name, "mlx4_%d", IB_DEVICE_NAME_MAX);
20832163 ibdev->ib_dev.owner = THIS_MODULE;
20842164 ibdev->ib_dev.node_type = RDMA_NODE_IB_CA;
20852165 ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey;
20862166 ibdev->num_ports = num_ports;
2087− ibdev->ib_dev.phys_port_cnt = ibdev->num_ports;
2167+ ibdev->ib_dev.phys_port_cnt = mlx4_is_bonded(dev) ?
2168+ 1 : ibdev->num_ports;
20882169 ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors;
2089− ibdev->ib_dev.dma_device = &dev->pdev->dev;
2170+ ibdev->ib_dev.dma_device = &dev->persist->pdev->dev;
20902171
20912172 if (dev->caps.userspace_caps)
20922173 ibdev->ib_dev.uverbs_abi_ver = MLX4_IB_UVERBS_ABI_VERSION;
@@ -2205,7 +2286,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 112 unmodified lines
22052286 if (init_node_data(ibdev))
22062287 goto err_map;
22072288
2208− for (i = 0; i < ibdev->num_ports; ++i) {
2289+ num_req_counters = mlx4_is_bonded(dev) ? 1 : ibdev->num_ports;
2290+ for (i = 0; i < num_req_counters; ++i) {
22092291 mutex_init(&ibdev->qp1_proxy_lock[i]);
22102292 if (mlx4_ib_port_link_layer(&ibdev->ib_dev, i + 1) ==
22112293 IB_LINK_LAYER_ETHERNET) {
@@ -2216,12 +2298,18 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 4 unmodified lines
22162298 ibdev->counters[i] = -1;
22172299 }
22182300 }
2301+ if (mlx4_is_bonded(dev))
2302+ for (i = 1; i < ibdev->num_ports ; ++i)
2303+ ibdev->counters[i] = ibdev->counters[0];
2304+
22192305
22202306 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
22212307 ib_num_ports++;
22222308
22232309 spin_lock_init(&ibdev->sm_lock);
22242310 mutex_init(&ibdev->cap_mask_mutex);
2311+ INIT_LIST_HEAD(&ibdev->qp_list);
2312+ spin_lock_init(&ibdev->reset_flow_resource_lock);
22252313
22262314 if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED &&
22272315 ib_num_ports) {
@@ -2237,7 +2325,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 9 unmodified lines
22372325 sizeof(long),
22382326 GFP_KERNEL);
22392327 if (!ibdev->ib_uc_qpns_bitmap) {
2240− dev_err(&dev->pdev->dev, "bit map alloc failed\n");
2328+ dev_err(&dev->persist->pdev->dev,
2329+ "bit map alloc failed\n");
22412330 goto err_steer_qp_release;
22422331 }
22432332
@@ -2535,6 +2624,99 @@ out: · 291 unmodified lines
25352624 return;
25362625 }
25372626
2627+static void mlx4_ib_handle_catas_error(struct mlx4_ib_dev *ibdev)
2628+{
2629+ struct mlx4_ib_qp *mqp;
2630+ unsigned long flags_qp;
2631+ unsigned long flags_cq;
2632+ struct mlx4_ib_cq *send_mcq, *recv_mcq;
2633+ struct list_head cq_notify_list;
2634+ struct mlx4_cq *mcq;
2635+ unsigned long flags;
2636+
2637+ pr_warn("mlx4_ib_handle_catas_error was started\n");
2638+ INIT_LIST_HEAD(&cq_notify_list);
2639+
2640+ /* Go over qp list reside on that ibdev, sync with create/destroy qp.*/
2641+ spin_lock_irqsave(&ibdev->reset_flow_resource_lock, flags);
2642+
2643+ list_for_each_entry(mqp, &ibdev->qp_list, qps_list) {
2644+ spin_lock_irqsave(&mqp->sq.lock, flags_qp);
2645+ if (mqp->sq.tail != mqp->sq.head) {
2646+ send_mcq = to_mcq(mqp->ibqp.send_cq);
2647+ spin_lock_irqsave(&send_mcq->lock, flags_cq);
2648+ if (send_mcq->mcq.comp &&
2649+ mqp->ibqp.send_cq->comp_handler) {
2650+ if (!send_mcq->mcq.reset_notify_added) {
2651+ send_mcq->mcq.reset_notify_added = 1;
2652+ list_add_tail(&send_mcq->mcq.reset_notify,
2653+ &cq_notify_list);
2654+ }
2655+ }
2656+ spin_unlock_irqrestore(&send_mcq->lock, flags_cq);
2657+ }
2658+ spin_unlock_irqrestore(&mqp->sq.lock, flags_qp);
2659+ /* Now, handle the QP's receive queue */
2660+ spin_lock_irqsave(&mqp->rq.lock, flags_qp);
2661+ /* no handling is needed for SRQ */
2662+ if (!mqp->ibqp.srq) {
2663+ if (mqp->rq.tail != mqp->rq.head) {
2664+ recv_mcq = to_mcq(mqp->ibqp.recv_cq);
2665+ spin_lock_irqsave(&recv_mcq->lock, flags_cq);
2666+ if (recv_mcq->mcq.comp &&
2667+ mqp->ibqp.recv_cq->comp_handler) {
2668+ if (!recv_mcq->mcq.reset_notify_added) {
2669+ recv_mcq->mcq.reset_notify_added = 1;
2670+ list_add_tail(&recv_mcq->mcq.reset_notify,
2671+ &cq_notify_list);
2672+ }
2673+ }
2674+ spin_unlock_irqrestore(&recv_mcq->lock,
2675+ flags_cq);
2676+ }
2677+ }
2678+ spin_unlock_irqrestore(&mqp->rq.lock, flags_qp);
2679+ }
2680+
2681+ list_for_each_entry(mcq, &cq_notify_list, reset_notify) {
2682+ mcq->comp(mcq);
2683+ }
2684+ spin_unlock_irqrestore(&ibdev->reset_flow_resource_lock, flags);
2685+ pr_warn("mlx4_ib_handle_catas_error ended\n");
2686+}
2687+
2688+static void handle_bonded_port_state_event(struct work_struct *work)
2689+{
2690+ struct ib_event_work *ew =
2691+ container_of(work, struct ib_event_work, work);
2692+ struct mlx4_ib_dev *ibdev = ew->ib_dev;
2693+ enum ib_port_state bonded_port_state = IB_PORT_NOP;
2694+ int i;
2695+ struct ib_event ibev;
2696+
2697+ kfree(ew);
2698+ spin_lock_bh(&ibdev->iboe.lock);
2699+ for (i = 0; i < MLX4_MAX_PORTS; ++i) {
2700+ struct net_device *curr_netdev = ibdev->iboe.netdevs[i];
2701+
2702+ enum ib_port_state curr_port_state =
2703+ (netif_running(curr_netdev) &&
2704+ netif_carrier_ok(curr_netdev)) ?
2705+ IB_PORT_ACTIVE : IB_PORT_DOWN;
2706+
2707+ bonded_port_state = (bonded_port_state != IB_PORT_ACTIVE) ?
2708+ curr_port_state : IB_PORT_ACTIVE;
2709+ }
2710+ spin_unlock_bh(&ibdev->iboe.lock);
2711+
2712+ ibev.device = &ibdev->ib_dev;
2713+ ibev.element.port_num = 1;
2714+ ibev.event = (bonded_port_state == IB_PORT_ACTIVE) ?
2715+ IB_EVENT_PORT_ACTIVE : IB_EVENT_PORT_ERR;
2716+
2717+ ib_dispatch_event(&ibev);
2718+}
2719+
25382720 static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
25392721 enum mlx4_dev_event event, unsigned long param)
25402722 {
@@ -2544,6 +2726,18 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 3 unmodified lines
25442726 struct ib_event_work *ew;
25452727 int p = 0;
25462728
2729+ if (mlx4_is_bonded(dev) &&
2730+ ((event == MLX4_DEV_EVENT_PORT_UP) ||
2731+ (event == MLX4_DEV_EVENT_PORT_DOWN))) {
2732+ ew = kmalloc(sizeof(*ew), GFP_ATOMIC);
2733+ if (!ew)
2734+ return;
2735+ INIT_WORK(&ew->work, handle_bonded_port_state_event);
2736+ ew->ib_dev = ibdev;
2737+ queue_work(wq, &ew->work);
2738+ return;
2739+ }
2740+
25472741 if (event == MLX4_DEV_EVENT_PORT_MGMT_CHANGE)
25482742 eqe = (struct mlx4_eqe *)param;
25492743 else
@@ -2570,6 +2764,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 20 unmodified lines
25702764 case MLX4_DEV_EVENT_CATASTROPHIC_ERROR:
25712765 ibdev->ib_active = false;
25722766 ibev.event = IB_EVENT_DEVICE_FATAL;
2767+ mlx4_ib_handle_catas_error(ibdev);
25732768 break;
25742769
25752770 case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:
@@ -2604,7 +2799,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 28 unmodified lines
26042799 }
26052800
26062801 ibev.device = ibdev_ptr;
2607− ibev.element.port_num = (u8) p;
2802+ ibev.element.port_num = mlx4_is_bonded(ibdev->dev) ? 1 : (u8)p;
26082803
26092804 ib_dispatch_event(&ibev);
26102805 }
@@ -2613,7 +2808,8 @@ static struct mlx4_interface mlx4_ib_interface = { · 2 unmodified lines
26132808 .add = mlx4_ib_add,
26142809 .remove = mlx4_ib_remove,
26152810 .event = mlx4_ib_event,
2616− .protocol = MLX4_PROT_IB_IPV6
2811+ .protocol = MLX4_PROT_IB_IPV6,
2812+ .flags = MLX4_INTFF_BONDING
26172813 };
26182814
26192815 static int __init mlx4_ib_init(void)
drivers/infiniband/hw/mlx4/mlx4_ib.h+25−1
@@ -110,6 +110,9 @@ struct mlx4_ib_cq { · 109 unmodified lines
110110 struct mutex resize_mutex;
111111 struct ib_umem *umem;
112112 struct ib_umem *resize_umem;
113+ /* List of qps that it serves.*/
114+ struct list_head send_qp_list;
115+ struct list_head recv_qp_list;
113116 };
114117
115118 struct mlx4_ib_mr {
@@ -134,10 +137,17 @@ struct mlx4_ib_fmr { · 18 unmodified lines
134137 struct mlx4_fmr mfmr;
135138 };
136139
140+#define MAX_REGS_PER_FLOW 2
141+
142+struct mlx4_flow_reg_id {
143+ u64 id;
144+ u64 mirror;
145+};
146+
137147 struct mlx4_ib_flow {
138148 struct ib_flow ibflow;
139149 /* translating DMFS verbs sniffer rule to FW API requires two reg IDs */
140− u64 reg_id[2];
150+ struct mlx4_flow_reg_id reg_id[MAX_REGS_PER_FLOW];
141151 };
142152
143153 struct mlx4_ib_wq {
@@ -293,6 +303,9 @@ struct mlx4_ib_qp { · 149 unmodified lines
293303 struct mlx4_roce_smac_vlan_info pri;
294304 struct mlx4_roce_smac_vlan_info alt;
295305 u64 reg_id;
306+ struct list_head qps_list;
307+ struct list_head cq_recv_list;
308+ struct list_head cq_send_list;
296309 };
297310
298311 struct mlx4_ib_srq {
@@ -527,6 +540,10 @@ struct mlx4_ib_dev { · 228 unmodified lines
527540 struct mlx4_ib_qp *qp1_proxy[MLX4_MAX_PORTS];
528541 /* lock when destroying qp1_proxy and getting netdev events */
529542 struct mutex qp1_proxy_lock[MLX4_MAX_PORTS];
543+ u8 bond_next_port;
544+ /* protect resources needed as part of reset flow */
545+ spinlock_t reset_flow_resource_lock;
546+ struct list_head qp_list;
530547 };
531548
532549 struct ib_event_work {
@@ -622,6 +639,13 @@ static inline struct mlx4_ib_ah *to_mah(struct ib_ah *ibah) · 89 unmodified lines
622639 return container_of(ibah, struct mlx4_ib_ah, ibah);
623640 }
624641
642+static inline u8 mlx4_ib_bond_next_port(struct mlx4_ib_dev *dev)
643+{
644+ dev->bond_next_port = (dev->bond_next_port + 1) % dev->num_ports;
645+
646+ return dev->bond_next_port + 1;
647+}
648+
625649 int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev);
626650 void mlx4_ib_close_sriov(struct mlx4_ib_dev *dev);
627651
drivers/infiniband/hw/mlx4/mr.c+4−2
@@ -401,7 +401,8 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device · 400 unmodified lines
401401 if (!mfrpl->ibfrpl.page_list)
402402 goto err_free;
403403
404− mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->pdev->dev,
404+ mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->persist->
405+ pdev->dev,
405406 size, &mfrpl->map,
406407 GFP_KERNEL);
407408 if (!mfrpl->mapped_page_list)
@@ -423,7 +424,8 @@ void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list) · 15 unmodified lines
423424 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list);
424425 int size = page_list->max_page_list_len * sizeof (u64);
425426
426− dma_free_coherent(&dev->dev->pdev->dev, size, mfrpl->mapped_page_list,
427+ dma_free_coherent(&dev->dev->persist->pdev->dev, size,
428+ mfrpl->mapped_page_list,
427429 mfrpl->map);
428430 kfree(mfrpl->ibfrpl.page_list);
429431 kfree(mfrpl);
drivers/infiniband/hw/mlx4/qp.c+73−17
@@ -40,11 +40,17 @@ · 39 unmodified lines
4040 #include <rdma/ib_addr.h>
4141 #include <rdma/ib_mad.h>
4242
43+#include <linux/mlx4/driver.h>
4344 #include <linux/mlx4/qp.h>
4445
4546 #include "mlx4_ib.h"
4647 #include "user.h"
4748
49+static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq,
50+ struct mlx4_ib_cq *recv_cq);
51+static void mlx4_ib_unlock_cqs(struct mlx4_ib_cq *send_cq,
52+ struct mlx4_ib_cq *recv_cq);
53+
4854 enum {
4955 MLX4_IB_ACK_REQ_FREQ = 8,
5056 };
@@ -93,17 +99,6 @@ enum { · 42 unmodified lines
9399 #ifndef ETH_ALEN
94100 #define ETH_ALEN 6
95101 #endif
96−static inline u64 mlx4_mac_to_u64(u8 *addr)
97−{
98− u64 mac = 0;
99− int i;
100−
101− for (i = 0; i < ETH_ALEN; i++) {
102− mac <<= 8;
103− mac |= addr[i];
104− }
105− return mac;
106−}
107102
108103 static const __be32 mlx4_ib_opcode[] = {
109104 [IB_WR_SEND] = cpu_to_be32(MLX4_OPCODE_SEND),
@@ -628,6 +623,8 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, · 518 unmodified lines
628623 struct mlx4_ib_sqp *sqp;
629624 struct mlx4_ib_qp *qp;
630625 enum mlx4_ib_qp_type qp_type = (enum mlx4_ib_qp_type) init_attr->qp_type;
626+ struct mlx4_ib_cq *mcq;
627+ unsigned long flags;
631628
632629 /* When tunneling special qps, we use a plain UD qp */
633630 if (sqpn) {
@@ -838,6 +835,24 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, · 204 unmodified lines
838835 qp->mqp.event = mlx4_ib_qp_event;
839836 if (!*caller_qp)
840837 *caller_qp = qp;
838+
839+ spin_lock_irqsave(&dev->reset_flow_resource_lock, flags);
840+ mlx4_ib_lock_cqs(to_mcq(init_attr->send_cq),
841+ to_mcq(init_attr->recv_cq));
842+ /* Maintain device to QPs access, needed for further handling
843+ * via reset flow
844+ */
845+ list_add_tail(&qp->qps_list, &dev->qp_list);
846+ /* Maintain CQ to QPs access, needed for further handling
847+ * via reset flow
848+ */
849+ mcq = to_mcq(init_attr->send_cq);
850+ list_add_tail(&qp->cq_send_list, &mcq->send_qp_list);
851+ mcq = to_mcq(init_attr->recv_cq);
852+ list_add_tail(&qp->cq_recv_list, &mcq->recv_qp_list);
853+ mlx4_ib_unlock_cqs(to_mcq(init_attr->send_cq),
854+ to_mcq(init_attr->recv_cq));
855+ spin_unlock_irqrestore(&dev->reset_flow_resource_lock, flags);
841856 return 0;
842857
843858 err_qpn:
@@ -896,13 +911,13 @@ static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *recv · 52 unmodified lines
896911 __acquires(&send_cq->lock) __acquires(&recv_cq->lock)
897912 {
898913 if (send_cq == recv_cq) {
899− spin_lock_irq(&send_cq->lock);
914+ spin_lock(&send_cq->lock);
900915 __acquire(&recv_cq->lock);
901916 } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) {
902− spin_lock_irq(&send_cq->lock);
917+ spin_lock(&send_cq->lock);
903918 spin_lock_nested(&recv_cq->lock, SINGLE_DEPTH_NESTING);
904919 } else {
905− spin_lock_irq(&recv_cq->lock);
920+ spin_lock(&recv_cq->lock);
906921 spin_lock_nested(&send_cq->lock, SINGLE_DEPTH_NESTING);
907922 }
908923 }
@@ -912,13 +927,13 @@ static void mlx4_ib_unlock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *re · 3 unmodified lines
912927 {
913928 if (send_cq == recv_cq) {
914929 __release(&recv_cq->lock);
915− spin_unlock_irq(&send_cq->lock);
930+ spin_unlock(&send_cq->lock);
916931 } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) {
917932 spin_unlock(&recv_cq->lock);
918− spin_unlock_irq(&send_cq->lock);
933+ spin_unlock(&send_cq->lock);
919934 } else {
920935 spin_unlock(&send_cq->lock);
921− spin_unlock_irq(&recv_cq->lock);
936+ spin_unlock(&recv_cq->lock);
922937 }
923938 }
924939
@@ -963,6 +978,7 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 38 unmodified lines
963978 int is_user)
964979 {
965980 struct mlx4_ib_cq *send_cq, *recv_cq;
981+ unsigned long flags;
966982
967983 if (qp->state != IB_QPS_RESET) {
968984 if (mlx4_qp_modify(dev->dev, NULL, to_mlx4_state(qp->state),
@@ -994,8 +1010,13 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 25 unmodified lines
9941010
9951011 get_cqs(qp, &send_cq, &recv_cq);
9961012
1013+ spin_lock_irqsave(&dev->reset_flow_resource_lock, flags);
9971014 mlx4_ib_lock_cqs(send_cq, recv_cq);
9981015
1016+ /* del from lists under both locks above to protect reset flow paths */
1017+ list_del(&qp->qps_list);
1018+ list_del(&qp->cq_send_list);
1019+ list_del(&qp->cq_recv_list);
9991020 if (!is_user) {
10001021 __mlx4_ib_cq_clean(recv_cq, qp->mqp.qpn,
10011022 qp->ibqp.srq ? to_msrq(qp->ibqp.srq): NULL);
@@ -1006,6 +1027,7 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 4 unmodified lines
10061027 mlx4_qp_remove(dev->dev, &qp->mqp);
10071028
10081029 mlx4_ib_unlock_cqs(send_cq, recv_cq);
1030+ spin_unlock_irqrestore(&dev->reset_flow_resource_lock, flags);
10091031
10101032 mlx4_qp_free(dev->dev, &qp->mqp);
10111033
@@ -1915,6 +1937,22 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 903 unmodified lines
19151937 goto out;
19161938 }
19171939
1940+ if (mlx4_is_bonded(dev->dev) && (attr_mask & IB_QP_PORT)) {
1941+ if ((cur_state == IB_QPS_RESET) && (new_state == IB_QPS_INIT)) {
1942+ if ((ibqp->qp_type == IB_QPT_RC) ||
1943+ (ibqp->qp_type == IB_QPT_UD) ||
1944+ (ibqp->qp_type == IB_QPT_UC) ||
1945+ (ibqp->qp_type == IB_QPT_RAW_PACKET) ||
1946+ (ibqp->qp_type == IB_QPT_XRC_INI)) {
1947+ attr->port_num = mlx4_ib_bond_next_port(dev);
1948+ }
1949+ } else {
1950+ /* no sense in changing port_num
1951+ * when ports are bonded */
1952+ attr_mask &= ~IB_QP_PORT;
1953+ }
1954+ }
1955+
19181956 if ((attr_mask & IB_QP_PORT) &&
19191957 (attr->port_num == 0 || attr->port_num > dev->num_ports)) {
19201958 pr_debug("qpn 0x%x: invalid port number (%d) specified "
@@ -1965,6 +2003,9 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 44 unmodified lines
19652003
19662004 err = __mlx4_ib_modify_qp(ibqp, attr, attr_mask, cur_state, new_state);
19672005
2006+ if (mlx4_is_bonded(dev->dev) && (attr_mask & IB_QP_PORT))
2007+ attr->port_num = 1;
2008+
19682009 out:
19692010 mutex_unlock(&qp->mutex);
19702011 return err;
@@ -2609,8 +2650,15 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 638 unmodified lines
26092650 __be32 uninitialized_var(lso_hdr_sz);
26102651 __be32 blh;
26112652 int i;
2653+ struct mlx4_ib_dev *mdev = to_mdev(ibqp->device);
26122654
26132655 spin_lock_irqsave(&qp->sq.lock, flags);
2656+ if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) {
2657+ err = -EIO;
2658+ *bad_wr = wr;
2659+ nreq = 0;
2660+ goto out;
2661+ }
26142662
26152663 ind = qp->sq_next_wqe;
26162664
@@ -2908,10 +2956,18 @@ int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 291 unmodified lines
29082956 int ind;
29092957 int max_gs;
29102958 int i;
2959+ struct mlx4_ib_dev *mdev = to_mdev(ibqp->device);
29112960
29122961 max_gs = qp->rq.max_gs;
29132962 spin_lock_irqsave(&qp->rq.lock, flags);
29142963
2964+ if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) {
2965+ err = -EIO;
2966+ *bad_wr = wr;
2967+ nreq = 0;
2968+ goto out;
2969+ }
2970+
29152971 ind = qp->rq.head & (qp->rq.wqe_cnt - 1);
29162972
29172973 for (nreq = 0; wr; ++nreq, wr = wr->next) {
drivers/infiniband/hw/mlx4/srq.c+8−0
@@ -316,8 +316,15 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, · 315 unmodified lines
316316 int err = 0;
317317 int nreq;
318318 int i;
319+ struct mlx4_ib_dev *mdev = to_mdev(ibsrq->device);
319320
320321 spin_lock_irqsave(&srq->lock, flags);
322+ if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) {
323+ err = -EIO;
324+ *bad_wr = wr;
325+ nreq = 0;
326+ goto out;
327+ }
321328
322329 for (nreq = 0; wr; ++nreq, wr = wr->next) {
323330 if (unlikely(wr->num_sge > srq->msrq.max_gs)) {
@@ -362,6 +369,7 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, · 38 unmodified lines
362369
363370 *srq->db.db = cpu_to_be32(srq->wqe_ctr);
364371 }
372+out:
365373
366374 spin_unlock_irqrestore(&srq->lock, flags);
367375
drivers/infiniband/hw/mlx4/sysfs.c+3−3
@@ -375,7 +375,7 @@ static void get_name(struct mlx4_ib_dev *dev, char *name, int i, int max) · 374 unmodified lines
375375 char base_name[9];
376376
377377 /* pci_name format is: bus:dev:func -> xxxx:yy:zz.n */
378− strlcpy(name, pci_name(dev->dev->pdev), max);
378+ strlcpy(name, pci_name(dev->dev->persist->pdev), max);
379379 strncpy(base_name, name, 8); /*till xxxx:yy:*/
380380 base_name[8] = '\0';
381381 /* with no ARI only 3 last bits are used so when the fn is higher than 8
@@ -792,7 +792,7 @@ static int register_pkey_tree(struct mlx4_ib_dev *device) · 410 unmodified lines
792792 if (!mlx4_is_master(device->dev))
793793 return 0;
794794
795− for (i = 0; i <= device->dev->num_vfs; ++i)
795+ for (i = 0; i <= device->dev->persist->num_vfs; ++i)
796796 register_one_pkey_tree(device, i);
797797
798798 return 0;
@@ -807,7 +807,7 @@ static void unregister_pkey_tree(struct mlx4_ib_dev *device) · 8 unmodified lines
807807 if (!mlx4_is_master(device->dev))
808808 return;
809809
810− for (slave = device->dev->num_vfs; slave >= 0; --slave) {
810+ for (slave = device->dev->persist->num_vfs; slave >= 0; --slave) {
811811 list_for_each_entry_safe(p, t,
812812 &device->pkeys.pkey_port_list[slave],
813813 entry) {
drivers/infiniband/hw/mlx5/mem.c+1−1
@@ -81,7 +81,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, · 80 unmodified lines
8181 for (k = 0; k < len; k++) {
8282 if (!(i & mask)) {
8383 tmp = (unsigned long)pfn;
84− m = min(m, find_first_bit(&tmp, sizeof(tmp)));
84+ m = min_t(unsigned long, m, find_first_bit(&tmp, sizeof(tmp)));
8585 skip = 1 << m;
8686 mask = skip - 1;
8787 base = pfn;
drivers/infiniband/hw/nes/nes_nic.c+7−6
@@ -373,11 +373,11 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev) · 372 unmodified lines
373373 wqe_fragment_length = (__le16 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX];
374374
375375 /* setup the VLAN tag if present */
376− if (vlan_tx_tag_present(skb)) {
376+ if (skb_vlan_tag_present(skb)) {
377377 nes_debug(NES_DBG_NIC_TX, "%s: VLAN packet to send... VLAN = %08X\n",
378− netdev->name, vlan_tx_tag_get(skb));
378+ netdev->name, skb_vlan_tag_get(skb));
379379 wqe_misc = NES_NIC_SQ_WQE_TAGVALUE_ENABLE;
380− wqe_fragment_length[0] = (__force __le16) vlan_tx_tag_get(skb);
380+ wqe_fragment_length[0] = (__force __le16) skb_vlan_tag_get(skb);
381381 } else
382382 wqe_misc = 0;
383383
@@ -576,11 +576,12 @@ tso_sq_no_longer_full: · 192 unmodified lines
576576 wqe_fragment_length =
577577 (__le16 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX];
578578 /* setup the VLAN tag if present */
579− if (vlan_tx_tag_present(skb)) {
579+ if (skb_vlan_tag_present(skb)) {
580580 nes_debug(NES_DBG_NIC_TX, "%s: VLAN packet to send... VLAN = %08X\n",
581− netdev->name, vlan_tx_tag_get(skb) );
581+ netdev->name,
582+ skb_vlan_tag_get(skb));
582583 wqe_misc = NES_NIC_SQ_WQE_TAGVALUE_ENABLE;
583− wqe_fragment_length[0] = (__force __le16) vlan_tx_tag_get(skb);
584+ wqe_fragment_length[0] = (__force __le16) skb_vlan_tag_get(skb);
584585 } else
585586 wqe_misc = 0;
586587
drivers/isdn/hardware/mISDN/mISDNipac.c+9−3
@@ -754,10 +754,10 @@ dbusy_timer_handler(struct isac_hw *isac) · 753 unmodified lines
754754 }
755755
756756 static int
757−open_dchannel(struct isac_hw *isac, struct channel_req *rq)
757+open_dchannel_caller(struct isac_hw *isac, struct channel_req *rq, void *caller)
758758 {
759759 pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
760− isac->dch.dev.id, __builtin_return_address(1));
760+ isac->dch.dev.id, caller);
761761 if (rq->protocol != ISDN_P_TE_S0)
762762 return -EINVAL;
763763 if (rq->adr.channel == 1)
@@ -771,6 +771,12 @@ open_dchannel(struct isac_hw *isac, struct channel_req *rq) · 7 unmodified lines
771771 return 0;
772772 }
773773
774+static int
775+open_dchannel(struct isac_hw *isac, struct channel_req *rq)
776+{
777+ return open_dchannel_caller(isac, rq, __builtin_return_address(0));
778+}
779+
774780 static const char *ISACVer[] =
775781 {"2086/2186 V1.1", "2085 B1", "2085 B2",
776782 "2085 V2.3"};
@@ -1548,7 +1554,7 @@ ipac_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg) · 771 unmodified lines
15481554 case OPEN_CHANNEL:
15491555 rq = arg;
15501556 if (rq->protocol == ISDN_P_TE_S0)
1551− err = open_dchannel(isac, rq);
1557+ err = open_dchannel_caller(isac, rq, __builtin_return_address(0));
15521558 else
15531559 err = open_bchannel(ipac, rq);
15541560 if (err)
drivers/isdn/hardware/mISDN/w6692.c+3−3
@@ -1176,10 +1176,10 @@ w6692_l1callback(struct dchannel *dch, u32 cmd) · 1175 unmodified lines
11761176 }
11771177
11781178 static int
1179−open_dchannel(struct w6692_hw *card, struct channel_req *rq)
1179+open_dchannel(struct w6692_hw *card, struct channel_req *rq, void *caller)
11801180 {
11811181 pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
1182− card->dch.dev.id, __builtin_return_address(1));
1182+ card->dch.dev.id, caller);
11831183 if (rq->protocol != ISDN_P_TE_S0)
11841184 return -EINVAL;
11851185 if (rq->adr.channel == 1)
@@ -1207,7 +1207,7 @@ w6692_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg) · 21 unmodified lines
12071207 case OPEN_CHANNEL:
12081208 rq = arg;
12091209 if (rq->protocol == ISDN_P_TE_S0)
1210− err = open_dchannel(card, rq);
1210+ err = open_dchannel(card, rq, __builtin_return_address(0));
12111211 else
12121212 err = open_bchannel(card, rq);
12131213 if (err)
drivers/isdn/hisax/hfc4s8s_l1.c+0−21
@@ -224,20 +224,6 @@ fWrite_hfc8(hfc4s8s_hw *a, u_char c) · 223 unmodified lines
224224 outb(c, a->iobase);
225225 }
226226
227−static inline void
228−Write_hfc16(hfc4s8s_hw *a, u_char b, u_short c)
229−{
230− SetRegAddr(a, b);
231− outw(c, a->iobase);
232−}
233−
234−static inline void
235−Write_hfc32(hfc4s8s_hw *a, u_char b, u_long c)
236−{
237− SetRegAddr(a, b);
238− outl(c, a->iobase);
239−}
240−
241227 static inline void
242228 fWrite_hfc32(hfc4s8s_hw *a, u_long c)
243229 {
@@ -265,13 +251,6 @@ Read_hfc16(hfc4s8s_hw *a, u_char b) · 21 unmodified lines
265251 return (inw((volatile u_int) a->iobase));
266252 }
267253
268−static inline u_long
269−Read_hfc32(hfc4s8s_hw *a, u_char b)
270−{
271− SetRegAddr(a, b);
272− return (inl((volatile u_int) a->iobase));
273−}
274−
275254 static inline u_long
276255 fRead_hfc32(hfc4s8s_hw *a)
277256 {
drivers/isdn/isdnloop/isdnloop.c+30−34
@@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch) · 58 unmodified lines
5959 isdn_ctrl cmd;
6060
6161 while (card->sndcount[ch]) {
62− if ((skb = skb_dequeue(&card->bqueue[ch]))) {
62+ skb = skb_dequeue(&card->bqueue[ch]);
63+ if (skb) {
6364 len = skb->len;
6465 card->sndcount[ch] -= len;
6566 ack = *(skb->head); /* used as scratch area */
@@ -149,8 +150,7 @@ typedef struct isdnloop_stat { · 83 unmodified lines
149150 int action;
150151 } isdnloop_stat;
151152 /* *INDENT-OFF* */
152−static isdnloop_stat isdnloop_stat_table[] =
153−{
153+static isdnloop_stat isdnloop_stat_table[] = {
154154 {"BCON_", ISDN_STAT_BCONN, 1}, /* B-Channel connected */
155155 {"BDIS_", ISDN_STAT_BHUP, 2}, /* B-Channel disconnected */
156156 {"DCON_", ISDN_STAT_DCONN, 0}, /* D-Channel connected */
@@ -317,7 +317,8 @@ isdnloop_polldchan(unsigned long data) · 160 unmodified lines
317317 u_char *p;
318318 isdn_ctrl cmd;
319319
320− if ((skb = skb_dequeue(&card->dqueue)))
320+ skb = skb_dequeue(&card->dqueue);
321+ if (skb)
321322 avail = skb->len;
322323 else
323324 avail = 0;
@@ -471,8 +472,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch) · 147 unmodified lines
471472 {
472473 struct sk_buff *skb;
473474 int len = strlen(s) + ((ch >= 0) ? 3 : 0);
474−
475− if (!(skb = dev_alloc_skb(len))) {
475+ skb = dev_alloc_skb(len);
476+ if (!skb) {
476477 printk(KERN_WARNING "isdnloop: Out of memory in isdnloop_fake\n");
477478 return 1;
478479 }
@@ -483,8 +484,7 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch) · 4 unmodified lines
483484 return 0;
484485 }
485486 /* *INDENT-OFF* */
486−static isdnloop_stat isdnloop_cmd_table[] =
487−{
487+static isdnloop_stat isdnloop_cmd_table[] = {
488488 {"BCON_R", 0, 1}, /* B-Channel connect */
489489 {"BCON_I", 0, 17}, /* B-Channel connect ind */
490490 {"BDIS_R", 0, 2}, /* B-Channel disconnect */
@@ -525,10 +525,8 @@ isdnloop_fake_err(isdnloop_card *card) · 34 unmodified lines
525525 isdnloop_fake(card, "NAK", -1);
526526 }
527527
528−static u_char ctable_eu[] =
529−{0x00, 0x11, 0x01, 0x12};
530−static u_char ctable_1t[] =
531−{0x00, 0x3b, 0x01, 0x3a};
528+static u_char ctable_eu[] = {0x00, 0x11, 0x01, 0x12};
529+static u_char ctable_1t[] = {0x00, 0x3b, 0x01, 0x3a};
532530
533531 /*
534532 * Assemble a simplified cause message depending on the
@@ -554,9 +552,9 @@ isdnloop_unicause(isdnloop_card *card, int loc, int cau) · 19 unmodified lines
554552 sprintf(buf, "%02X44", ctable_1t[cau]);
555553 break;
556554 default:
557− return ("0000");
555+ return "0000";
558556 }
559− return (buf);
557+ return buf;
560558 }
561559
562560 /*
@@ -647,10 +645,8 @@ isdnloop_kill_ctimer(isdnloop_card *card, int ch) · 84 unmodified lines
647645 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
648646 }
649647
650−static u_char si2bit[] =
651−{0, 1, 0, 0, 0, 2, 0, 4, 0, 0};
652−static u_char bit2si[] =
653−{1, 5, 7};
648+static u_char si2bit[] = {0, 1, 0, 0, 0, 2, 0, 4, 0, 0};
649+static u_char bit2si[] = {1, 5, 7};
654650
655651 /*
656652 * Try finding a listener for an outgoing call.
@@ -754,17 +750,17 @@ isdnloop_vstphone(isdnloop_card *card, char *phone, int caller) · 97 unmodified lines
754750 if (caller) {
755751 for (i = 0; i < 2; i++)
756752 if (!(strcmp(card->s0num[i], phone)))
757− return (phone);
758− return (card->s0num[0]);
753+ return phone;
754+ return card->s0num[0];
759755 }
760− return (phone);
756+ return phone;
761757 break;
762758 case ISDN_PTYPE_1TR6:
763759 if (caller) {
764760 sprintf(nphone, "%s%c", card->s0num[0], phone[0]);
765− return (nphone);
761+ return nphone;
766762 } else
767− return (&phone[strlen(phone) - 1]);
763+ return &phone[strlen(phone) - 1];
768764 break;
769765 }
770766 return "";
@@ -1148,14 +1144,14 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card) · 377 unmodified lines
11481144 case ISDNLOOP_IOCTL_STARTUP:
11491145 if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef)))
11501146 return -EFAULT;
1151− return (isdnloop_start(card, (isdnloop_sdef *) a));
1147+ return isdnloop_start(card, (isdnloop_sdef *) a);
11521148 break;
11531149 case ISDNLOOP_IOCTL_ADDCARD:
11541150 if (copy_from_user((char *)&cdef,
11551151 (char *)a,
11561152 sizeof(cdef)))
11571153 return -EFAULT;
1158− return (isdnloop_addcard(cdef.id1));
1154+ return isdnloop_addcard(cdef.id1);
11591155 break;
11601156 case ISDNLOOP_IOCTL_LEASEDCFG:
11611157 if (a) {
@@ -1377,7 +1373,7 @@ if_command(isdn_ctrl *c) · 215 unmodified lines
13771373 isdnloop_card *card = isdnloop_findcard(c->driver);
13781374
13791375 if (card)
1380− return (isdnloop_command(c, card));
1376+ return isdnloop_command(c, card);
13811377 printk(KERN_ERR
13821378 "isdnloop: if_command called with invalid driverId!\n");
13831379 return -ENODEV;
@@ -1391,7 +1387,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int channel) · 7 unmodified lines
13911387 if (card) {
13921388 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
13931389 return -ENODEV;
1394− return (isdnloop_writecmd(buf, len, 1, card));
1390+ return isdnloop_writecmd(buf, len, 1, card);
13951391 }
13961392 printk(KERN_ERR
13971393 "isdnloop: if_writecmd called with invalid driverId!\n");
@@ -1406,7 +1402,7 @@ if_readstatus(u_char __user *buf, int len, int id, int channel) · 8 unmodified lines
14061402 if (card) {
14071403 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
14081404 return -ENODEV;
1409− return (isdnloop_readstatus(buf, len, card));
1405+ return isdnloop_readstatus(buf, len, card);
14101406 }
14111407 printk(KERN_ERR
14121408 "isdnloop: if_readstatus called with invalid driverId!\n");
@@ -1423,7 +1419,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb) · 10 unmodified lines
14231419 return -ENODEV;
14241420 /* ack request stored in skb scratch area */
14251421 *(skb->head) = ack;
1426− return (isdnloop_sendbuf(channel, skb, card));
1422+ return isdnloop_sendbuf(channel, skb, card);
14271423 }
14281424 printk(KERN_ERR
14291425 "isdnloop: if_sendbuf called with invalid driverId!\n");
@@ -1439,8 +1435,8 @@ isdnloop_initcard(char *id) · 9 unmodified lines
14391435 {
14401436 isdnloop_card *card;
14411437 int i;
1442−
1443− if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
1438+ card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
1439+ if (!card) {
14441440 printk(KERN_WARNING
14451441 "isdnloop: (%s) Could not allocate card-struct.\n", id);
14461442 return (isdnloop_card *) 0;
@@ -1489,8 +1485,8 @@ static int · 42 unmodified lines
14891485 isdnloop_addcard(char *id1)
14901486 {
14911487 isdnloop_card *card;
1492−
1493− if (!(card = isdnloop_initcard(id1))) {
1488+ card = isdnloop_initcard(id1);
1489+ if (!card) {
14941490 return -EIO;
14951491 }
14961492 printk(KERN_INFO
@@ -1503,7 +1499,7 @@ static int __init · 6 unmodified lines
15031499 isdnloop_init(void)
15041500 {
15051501 if (isdnloop_id)
1506− return (isdnloop_addcard(isdnloop_id));
1502+ return isdnloop_addcard(isdnloop_id);
15071503
15081504 return 0;
15091505 }
drivers/isdn/sc/init.c+6−9
@@ -30,7 +30,7 @@ static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCo · 29 unmodified lines
3030 static unsigned int io[] = {0, 0, 0, 0};
3131 static unsigned char irq[] = {0, 0, 0, 0};
3232 static unsigned long ram[] = {0, 0, 0, 0};
33−static bool do_reset = 0;
33+static bool do_reset;
3434
3535 module_param_array(io, int, NULL, 0);
3636 module_param_array(irq, byte, NULL, 0);
@@ -104,13 +104,12 @@ static int __init sc_init(void) · 67 unmodified lines
104104 io[b] + 0x400 * EXP_PAGE0);
105105 continue;
106106 }
107− }
108− else {
107+ } else {
109108 /*
110109 * Yes, probe for I/O Base
111110 */
112111 if (probe_exhasted) {
113− pr_debug("All probe addresses exhasted, skipping\n");
112+ pr_debug("All probe addresses exhausted, skipping\n");
114113 continue;
115114 }
116115 pr_debug("Probing for I/O...\n");
@@ -169,8 +168,7 @@ static int __init sc_init(void) · 52 unmodified lines
169168 model = identify_board(ram[b], io[b]);
170169 release_region(ram[b], SRAM_PAGESIZE);
171170 }
172− }
173− else {
171+ } else {
174172 /*
175173 * Yes, probe for free RAM and look for
176174 * a signature and id the board model
@@ -187,7 +185,7 @@ static int __init sc_init(void) · 10 unmodified lines
187185 ram[b] = i;
188186 break;
189187 }
190− pr_debug(" Unidentifed or inaccessible\n");
188+ pr_debug(" Unidentified or inaccessible\n");
191189 continue;
192190 }
193191 pr_debug(" request failed\n");
@@ -337,8 +335,7 @@ static int __init sc_init(void) · 143 unmodified lines
337335 sc_adapter[cinst]->interrupt = irq[b];
338336 if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler,
339337 0, interface->id,
340− (void *)(unsigned long) cinst))
341− {
338+ (void *)(unsigned long) cinst)) {
342339 kfree(sc_adapter[cinst]->channel);
343340 indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */
344341 kfree(interface);
drivers/misc/vmw_vmci/vmci_queue_pair.c+8−8
@@ -370,12 +370,12 @@ static int __qp_memcpy_to_queue(struct vmci_queue *queue, · 369 unmodified lines
370370 to_copy = size - bytes_copied;
371371
372372 if (is_iovec) {
373− struct iovec *iov = (struct iovec *)src;
373+ struct msghdr *msg = (struct msghdr *)src;
374374 int err;
375375
376376 /* The iovec will track bytes_copied internally. */
377− err = memcpy_fromiovec((u8 *)va + page_offset,
378− iov, to_copy);
377+ err = memcpy_from_msg((u8 *)va + page_offset,
378+ msg, to_copy);
379379 if (err != 0) {
380380 if (kernel_if->host)
381381 kunmap(kernel_if->u.h.page[page_index]);
@@ -580,7 +580,7 @@ static int qp_memcpy_from_queue(void *dest, · 198 unmodified lines
580580 */
581581 static int qp_memcpy_to_queue_iov(struct vmci_queue *queue,
582582 u64 queue_offset,
583− const void *src,
583+ const void *msg,
584584 size_t src_offset, size_t size)
585585 {
586586
@@ -588,7 +588,7 @@ static int qp_memcpy_to_queue_iov(struct vmci_queue *queue, · 1 unmodified line
588588 * We ignore src_offset because src is really a struct iovec * and will
589589 * maintain offset internally.
590590 */
591− return __qp_memcpy_to_queue(queue, queue_offset, src, size, true);
591+ return __qp_memcpy_to_queue(queue, queue_offset, msg, size, true);
592592 }
593593
594594 /*
@@ -3223,13 +3223,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_peek); · 2628 unmodified lines
32233223 * of bytes enqueued or < 0 on error.
32243224 */
32253225 ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
3226− void *iov,
3226+ struct msghdr *msg,
32273227 size_t iov_size,
32283228 int buf_type)
32293229 {
32303230 ssize_t result;
32313231
3232− if (!qpair || !iov)
3232+ if (!qpair)
32333233 return VMCI_ERROR_INVALID_ARGS;
32343234
32353235 qp_lock(qpair);
@@ -3238,7 +3238,7 @@ ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, · 2 unmodified lines
32383238 result = qp_enqueue_locked(qpair->produce_q,
32393239 qpair->consume_q,
32403240 qpair->produce_q_size,
3241− iov, iov_size,
3241+ msg, iov_size,
32423242 qp_memcpy_to_queue_iov);
32433243
32443244 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY &&
drivers/net/arcnet/com20020-pci.c+3−0
@@ -78,6 +78,9 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i · 77 unmodified lines
7878
7979 priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv),
8080 GFP_KERNEL);
81+ if (!priv)
82+ return -ENOMEM;
83+
8184 ci = (struct com20020_pci_card_info *)id->driver_data;
8285 priv->ci = ci;
8386
drivers/net/bonding/bond_3ad.c+42−13
@@ -467,11 +467,14 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port) · 466 unmodified lines
467467 /* set the partner sync. to on if the partner is sync,
468468 * and the port is matched
469469 */
470− if ((port->sm_vars & AD_PORT_MATCHED)
471− && (lacpdu->actor_state & AD_STATE_SYNCHRONIZATION))
470+ if ((port->sm_vars & AD_PORT_MATCHED) &&
471+ (lacpdu->actor_state & AD_STATE_SYNCHRONIZATION)) {
472472 partner->port_state |= AD_STATE_SYNCHRONIZATION;
473− else
473+ pr_debug("%s partner sync=1\n", port->slave->dev->name);
474+ } else {
474475 partner->port_state &= ~AD_STATE_SYNCHRONIZATION;
476+ pr_debug("%s partner sync=0\n", port->slave->dev->name);
477+ }
475478 }
476479 }
477480
@@ -726,6 +729,8 @@ static inline void __update_lacpdu_from_port(struct port *port) · 248 unmodified lines
726729 lacpdu->actor_port_priority = htons(port->actor_port_priority);
727730 lacpdu->actor_port = htons(port->actor_port_number);
728731 lacpdu->actor_state = port->actor_oper_port_state;
732+ pr_debug("update lacpdu: %s, actor port state %x\n",
733+ port->slave->dev->name, port->actor_oper_port_state);
729734
730735 /* lacpdu->reserved_3_1 initialized
731736 * lacpdu->tlv_type_partner_info initialized
@@ -898,7 +903,9 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 166 unmodified lines
898903 if ((port->sm_vars & AD_PORT_SELECTED) &&
899904 (port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) &&
900905 !__check_agg_selection_timer(port)) {
901− port->sm_mux_state = AD_MUX_COLLECTING_DISTRIBUTING;
906+ if (port->aggregator->is_active)
907+ port->sm_mux_state =
908+ AD_MUX_COLLECTING_DISTRIBUTING;
902909 } else if (!(port->sm_vars & AD_PORT_SELECTED) ||
903910 (port->sm_vars & AD_PORT_STANDBY)) {
904911 /* if UNSELECTED or STANDBY */
@@ -910,12 +917,16 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 5 unmodified lines
910917 */
911918 __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
912919 port->sm_mux_state = AD_MUX_DETACHED;
920+ } else if (port->aggregator->is_active) {
921+ port->actor_oper_port_state |=
922+ AD_STATE_SYNCHRONIZATION;
913923 }
914924 break;
915925 case AD_MUX_COLLECTING_DISTRIBUTING:
916926 if (!(port->sm_vars & AD_PORT_SELECTED) ||
917927 (port->sm_vars & AD_PORT_STANDBY) ||
918− !(port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION)) {
928+ !(port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) ||
929+ !(port->actor_oper_port_state & AD_STATE_SYNCHRONIZATION)) {
919930 port->sm_mux_state = AD_MUX_ATTACHED;
920931 } else {
921932 /* if port state hasn't changed make
@@ -937,8 +948,10 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 15 unmodified lines
937948
938949 /* check if the state machine was changed */
939950 if (port->sm_mux_state != last_state) {
940− pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n",
941− port->actor_port_number, last_state,
951+ pr_debug("Mux Machine: Port=%d (%s), Last State=%d, Curr State=%d\n",
952+ port->actor_port_number,
953+ port->slave->dev->name,
954+ last_state,
942955 port->sm_mux_state);
943956 switch (port->sm_mux_state) {
944957 case AD_MUX_DETACHED:
@@ -953,7 +966,12 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 8 unmodified lines
953966 port->sm_mux_timer_counter = __ad_timer_to_ticks(AD_WAIT_WHILE_TIMER, 0);
954967 break;
955968 case AD_MUX_ATTACHED:
956− port->actor_oper_port_state |= AD_STATE_SYNCHRONIZATION;
969+ if (port->aggregator->is_active)
970+ port->actor_oper_port_state |=
971+ AD_STATE_SYNCHRONIZATION;
972+ else
973+ port->actor_oper_port_state &=
974+ ~AD_STATE_SYNCHRONIZATION;
957975 port->actor_oper_port_state &= ~AD_STATE_COLLECTING;
958976 port->actor_oper_port_state &= ~AD_STATE_DISTRIBUTING;
959977 ad_disable_collecting_distributing(port,
@@ -963,6 +981,7 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 3 unmodified lines
963981 case AD_MUX_COLLECTING_DISTRIBUTING:
964982 port->actor_oper_port_state |= AD_STATE_COLLECTING;
965983 port->actor_oper_port_state |= AD_STATE_DISTRIBUTING;
984+ port->actor_oper_port_state |= AD_STATE_SYNCHRONIZATION;
966985 ad_enable_collecting_distributing(port,
967986 update_slave_arr);
968987 port->ntt = true;
@@ -1044,8 +1063,10 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) · 75 unmodified lines
10441063
10451064 /* check if the State machine was changed or new lacpdu arrived */
10461065 if ((port->sm_rx_state != last_state) || (lacpdu)) {
1047− pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n",
1048− port->actor_port_number, last_state,
1066+ pr_debug("Rx Machine: Port=%d (%s), Last State=%d, Curr State=%d\n",
1067+ port->actor_port_number,
1068+ port->slave->dev->name,
1069+ last_state,
10491070 port->sm_rx_state);
10501071 switch (port->sm_rx_state) {
10511072 case AD_RX_INITIALIZE:
@@ -1394,6 +1415,9 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) · 342 unmodified lines
13941415
13951416 aggregator = __get_first_agg(port);
13961417 ad_agg_selection_logic(aggregator, update_slave_arr);
1418+
1419+ if (!port->aggregator->is_active)
1420+ port->actor_oper_port_state &= ~AD_STATE_SYNCHRONIZATION;
13971421 }
13981422
13991423 /* Decide if "agg" is a better choice for the new active aggregator that
@@ -2195,8 +2219,10 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, · 795 unmodified lines
21952219 switch (lacpdu->subtype) {
21962220 case AD_TYPE_LACPDU:
21972221 ret = RX_HANDLER_CONSUMED;
2198− netdev_dbg(slave->bond->dev, "Received LACPDU on port %d\n",
2199− port->actor_port_number);
2222+ netdev_dbg(slave->bond->dev,
2223+ "Received LACPDU on port %d slave %s\n",
2224+ port->actor_port_number,
2225+ slave->dev->name);
22002226 /* Protect against concurrent state machines */
22012227 spin_lock(&slave->bond->mode_lock);
22022228 ad_rx_machine(lacpdu, port);
@@ -2288,7 +2314,10 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave) · 85 unmodified lines
22882314 port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS;
22892315 port->actor_oper_port_key = port->actor_admin_port_key |=
22902316 __get_duplex(port);
2291− netdev_dbg(slave->bond->dev, "Port %d changed duplex\n", port->actor_port_number);
2317+ netdev_dbg(slave->bond->dev, "Port %d slave %s changed duplex\n",
2318+ port->actor_port_number, slave->dev->name);
2319+ if (port->actor_oper_port_key & AD_DUPLEX_KEY_MASKS)
2320+ port->sm_vars |= AD_PORT_LACP_ENABLED;
22922321 /* there is no need to reselect a new aggregator, just signal the
22932322 * state machines to reinitialize
22942323 */
drivers/net/bonding/bond_main.c+88−33
@@ -77,6 +77,7 @@ · 76 unmodified lines
7777 #include <net/pkt_sched.h>
7878 #include <linux/rculist.h>
7979 #include <net/flow_keys.h>
80+#include <net/switchdev.h>
8081 #include <net/bonding.h>
8182 #include <net/bond_3ad.h>
8283 #include <net/bond_alb.h>
@@ -334,7 +335,7 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, · 251 unmodified lines
334335 *
335336 * Returns zero if carrier state does not change, nonzero if it does.
336337 */
337−static int bond_set_carrier(struct bonding *bond)
338+int bond_set_carrier(struct bonding *bond)
338339 {
339340 struct list_head *iter;
340341 struct slave *slave;
@@ -789,7 +790,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) · 448 unmodified lines
789790 }
790791
791792 new_active->delay = 0;
792− new_active->link = BOND_LINK_UP;
793+ bond_set_slave_link_state(new_active, BOND_LINK_UP);
793794
794795 if (BOND_MODE(bond) == BOND_MODE_8023AD)
795796 bond_3ad_handle_link_change(new_active, BOND_LINK_UP);
@@ -979,7 +980,11 @@ static netdev_features_t bond_fix_features(struct net_device *dev, · 183 unmodified lines
979980 netdev_features_t mask;
980981 struct slave *slave;
981982
982− mask = features;
983+ /* If any slave has the offload feature flag set,
984+ * set the offload flag on the bond.
985+ */
986+ mask = features | NETIF_F_HW_SWITCH_OFFLOAD;
987+
983988 features &= ~NETIF_F_ONE_FOR_ALL;
984989 features |= NETIF_F_ALL_FOR_ALL;
985990
@@ -998,7 +1003,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev, · 12 unmodified lines
9981003 NETIF_F_HIGHDMA | NETIF_F_LRO)
9991004
10001005 #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\
1001− NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL)
1006+ NETIF_F_TSO)
10021007
10031008 static void bond_compute_features(struct bonding *bond)
10041009 {
@@ -1034,7 +1039,7 @@ static void bond_compute_features(struct bonding *bond) · 29 unmodified lines
10341039
10351040 done:
10361041 bond_dev->vlan_features = vlan_features;
1037− bond_dev->hw_enc_features = enc_features;
1042+ bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL;
10381043 bond_dev->hard_header_len = max_hard_header_len;
10391044 bond_dev->gso_max_segs = gso_max_segs;
10401045 netif_set_gso_max_size(bond_dev, gso_max_size);
@@ -1176,6 +1181,56 @@ static void bond_free_slave(struct slave *slave) · 135 unmodified lines
11761181 kfree(slave);
11771182 }
11781183
1184+static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info)
1185+{
1186+ info->bond_mode = BOND_MODE(bond);
1187+ info->miimon = bond->params.miimon;
1188+ info->num_slaves = bond->slave_cnt;
1189+}
1190+
1191+static void bond_fill_ifslave(struct slave *slave, struct ifslave *info)
1192+{
1193+ strcpy(info->slave_name, slave->dev->name);
1194+ info->link = slave->link;
1195+ info->state = bond_slave_state(slave);
1196+ info->link_failure_count = slave->link_failure_count;
1197+}
1198+
1199+static void bond_netdev_notify(struct net_device *dev,
1200+ struct netdev_bonding_info *info)
1201+{
1202+ rtnl_lock();
1203+ netdev_bonding_info_change(dev, info);
1204+ rtnl_unlock();
1205+}
1206+
1207+static void bond_netdev_notify_work(struct work_struct *_work)
1208+{
1209+ struct netdev_notify_work *w =
1210+ container_of(_work, struct netdev_notify_work, work.work);
1211+
1212+ bond_netdev_notify(w->dev, &w->bonding_info);
1213+ dev_put(w->dev);
1214+ kfree(w);
1215+}
1216+
1217+void bond_queue_slave_event(struct slave *slave)
1218+{
1219+ struct bonding *bond = slave->bond;
1220+ struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC);
1221+
1222+ if (!nnw)
1223+ return;
1224+
1225+ dev_hold(slave->dev);
1226+ nnw->dev = slave->dev;
1227+ bond_fill_ifslave(slave, &nnw->bonding_info.slave);
1228+ bond_fill_ifbond(bond, &nnw->bonding_info.master);
1229+ INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work);
1230+
1231+ queue_delayed_work(slave->bond->wq, &nnw->work, 0);
1232+}
1233+
11791234 /* enslave device <slave> to bond device <master> */
11801235 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
11811236 {
@@ -1439,19 +1494,22 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 257 unmodified lines
14391494 if (bond->params.miimon) {
14401495 if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) {
14411496 if (bond->params.updelay) {
1442− new_slave->link = BOND_LINK_BACK;
1497+ bond_set_slave_link_state(new_slave,
1498+ BOND_LINK_BACK);
14431499 new_slave->delay = bond->params.updelay;
14441500 } else {
1445− new_slave->link = BOND_LINK_UP;
1501+ bond_set_slave_link_state(new_slave,
1502+ BOND_LINK_UP);
14461503 }
14471504 } else {
1448− new_slave->link = BOND_LINK_DOWN;
1505+ bond_set_slave_link_state(new_slave, BOND_LINK_DOWN);
14491506 }
14501507 } else if (bond->params.arp_interval) {
1451− new_slave->link = (netif_carrier_ok(slave_dev) ?
1452− BOND_LINK_UP : BOND_LINK_DOWN);
1508+ bond_set_slave_link_state(new_slave,
1509+ (netif_carrier_ok(slave_dev) ?
1510+ BOND_LINK_UP : BOND_LINK_DOWN));
14531511 } else {
1454− new_slave->link = BOND_LINK_UP;
1512+ bond_set_slave_link_state(new_slave, BOND_LINK_UP);
14551513 }
14561514
14571515 if (new_slave->link != BOND_LINK_DOWN)
@@ -1567,6 +1625,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 109 unmodified lines
15671625 new_slave->link != BOND_LINK_DOWN ? "an up" : "a down");
15681626
15691627 /* enslave is successful */
1628+ bond_queue_slave_event(new_slave);
15701629 return 0;
15711630
15721631 /* Undo stages on error */
@@ -1816,11 +1875,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, · 243 unmodified lines
18161875 static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
18171876 {
18181877 struct bonding *bond = netdev_priv(bond_dev);
1819−
1820− info->bond_mode = BOND_MODE(bond);
1821− info->miimon = bond->params.miimon;
1822− info->num_slaves = bond->slave_cnt;
1823−
1878+ bond_fill_ifbond(bond, info);
18241879 return 0;
18251880 }
18261881
@@ -1834,10 +1889,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in · 7 unmodified lines
18341889 bond_for_each_slave(bond, slave, iter) {
18351890 if (i++ == (int)info->slave_id) {
18361891 res = 0;
1837− strcpy(info->slave_name, slave->dev->name);
1838− info->link = slave->link;
1839− info->state = bond_slave_state(slave);
1840− info->link_failure_count = slave->link_failure_count;
1892+ bond_fill_ifslave(slave, info);
18411893 break;
18421894 }
18431895 }
@@ -1867,7 +1919,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 23 unmodified lines
18671919 if (link_state)
18681920 continue;
18691921
1870− slave->link = BOND_LINK_FAIL;
1922+ bond_set_slave_link_state(slave, BOND_LINK_FAIL);
18711923 slave->delay = bond->params.downdelay;
18721924 if (slave->delay) {
18731925 netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n",
@@ -1882,7 +1934,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 8 unmodified lines
18821934 case BOND_LINK_FAIL:
18831935 if (link_state) {
18841936 /* recovered before downdelay expired */
1885− slave->link = BOND_LINK_UP;
1937+ bond_set_slave_link_state(slave, BOND_LINK_UP);
18861938 slave->last_link_up = jiffies;
18871939 netdev_info(bond->dev, "link status up again after %d ms for interface %s\n",
18881940 (bond->params.downdelay - slave->delay) *
@@ -1904,7 +1956,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 15 unmodified lines
19041956 if (!link_state)
19051957 continue;
19061958
1907− slave->link = BOND_LINK_BACK;
1959+ bond_set_slave_link_state(slave, BOND_LINK_BACK);
19081960 slave->delay = bond->params.updelay;
19091961
19101962 if (slave->delay) {
@@ -1917,7 +1969,8 @@ static int bond_miimon_inspect(struct bonding *bond) · 6 unmodified lines
19171969 /*FALLTHRU*/
19181970 case BOND_LINK_BACK:
19191971 if (!link_state) {
1920− slave->link = BOND_LINK_DOWN;
1972+ bond_set_slave_link_state(slave,
1973+ BOND_LINK_DOWN);
19211974 netdev_info(bond->dev, "link status down again after %d ms for interface %s\n",
19221975 (bond->params.updelay - slave->delay) *
19231976 bond->params.miimon,
@@ -1955,7 +2008,7 @@ static void bond_miimon_commit(struct bonding *bond) · 31 unmodified lines
19552008 continue;
19562009
19572010 case BOND_LINK_UP:
1958− slave->link = BOND_LINK_UP;
2011+ bond_set_slave_link_state(slave, BOND_LINK_UP);
19592012 slave->last_link_up = jiffies;
19602013
19612014 primary = rtnl_dereference(bond->primary_slave);
@@ -1995,7 +2048,7 @@ static void bond_miimon_commit(struct bonding *bond) · 33 unmodified lines
19952048 if (slave->link_failure_count < UINT_MAX)
19962049 slave->link_failure_count++;
19972050
1998− slave->link = BOND_LINK_DOWN;
2051+ bond_set_slave_link_state(slave, BOND_LINK_DOWN);
19992052
20002053 if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
20012054 BOND_MODE(bond) == BOND_MODE_8023AD)
@@ -2578,7 +2631,7 @@ static void bond_ab_arp_commit(struct bonding *bond) · 576 unmodified lines
25782631 struct slave *current_arp_slave;
25792632
25802633 current_arp_slave = rtnl_dereference(bond->current_arp_slave);
2581− slave->link = BOND_LINK_UP;
2634+ bond_set_slave_link_state(slave, BOND_LINK_UP);
25822635 if (current_arp_slave) {
25832636 bond_set_slave_inactive_flags(
25842637 current_arp_slave,
@@ -2601,7 +2654,7 @@ static void bond_ab_arp_commit(struct bonding *bond) · 16 unmodified lines
26012654 if (slave->link_failure_count < UINT_MAX)
26022655 slave->link_failure_count++;
26032656
2604− slave->link = BOND_LINK_DOWN;
2657+ bond_set_slave_link_state(slave, BOND_LINK_DOWN);
26052658 bond_set_slave_inactive_flags(slave,
26062659 BOND_SLAVE_NOTIFY_NOW);
26072660
@@ -2680,7 +2733,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) · 72 unmodified lines
26802733 * up when it is actually down
26812734 */
26822735 if (!bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) {
2683− slave->link = BOND_LINK_DOWN;
2736+ bond_set_slave_link_state(slave, BOND_LINK_DOWN);
26842737 if (slave->link_failure_count < UINT_MAX)
26852738 slave->link_failure_count++;
26862739
@@ -2700,7 +2753,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) · 13 unmodified lines
27002753 if (!new_slave)
27012754 goto check_state;
27022755
2703− new_slave->link = BOND_LINK_BACK;
2756+ bond_set_slave_link_state(new_slave, BOND_LINK_BACK);
27042757 bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER);
27052758 bond_arp_send_all(bond, new_slave);
27062759 new_slave->last_link_up = jiffies;
@@ -3066,7 +3119,7 @@ static int bond_open(struct net_device *bond_dev) · 359 unmodified lines
30663119 slave != rcu_access_pointer(bond->curr_active_slave)) {
30673120 bond_set_slave_inactive_flags(slave,
30683121 BOND_SLAVE_NOTIFY_NOW);
3069− } else {
3122+ } else if (BOND_MODE(bond) != BOND_MODE_8023AD) {
30703123 bond_set_slave_active_flags(slave,
30713124 BOND_SLAVE_NOTIFY_NOW);
30723125 }
@@ -3734,7 +3787,7 @@ out: · 661 unmodified lines
37343787 * usable slave array is formed in the control path. The xmit function
37353788 * just calculates hash and sends the packet out.
37363789 */
3737−int bond_3ad_xor_xmit(struct sk_buff *skb, struct net_device *dev)
3790+static int bond_3ad_xor_xmit(struct sk_buff *skb, struct net_device *dev)
37383791 {
37393792 struct bonding *bond = netdev_priv(dev);
37403793 struct slave *slave;
@@ -3952,6 +4005,8 @@ static const struct net_device_ops bond_netdev_ops = { · 211 unmodified lines
39524005 .ndo_add_slave = bond_enslave,
39534006 .ndo_del_slave = bond_release,
39544007 .ndo_fix_features = bond_fix_features,
4008+ .ndo_bridge_setlink = ndo_dflt_netdev_switch_port_bridge_setlink,
4009+ .ndo_bridge_dellink = ndo_dflt_netdev_switch_port_bridge_dellink,
39554010 };
39564011
39574012 static const struct device_type bond_type = {
@@ -4010,7 +4065,7 @@ void bond_setup(struct net_device *bond_dev) · 52 unmodified lines
40104065 NETIF_F_HW_VLAN_CTAG_FILTER;
40114066
40124067 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
4013− bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
4068+ bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
40144069 bond_dev->features |= bond_dev->hw_features;
40154070 }
40164071
drivers/net/bonding/bond_options.c+3−3
@@ -186,7 +186,7 @@ static const struct bond_opt_value bond_tlb_dynamic_lb_tbl[] = { · 185 unmodified lines
186186 { NULL, -1, 0}
187187 };
188188
189−static const struct bond_option bond_opts[] = {
189+static const struct bond_option bond_opts[BOND_OPT_LAST] = {
190190 [BOND_OPT_MODE] = {
191191 .id = BOND_OPT_MODE,
192192 .name = "mode",
@@ -379,8 +379,7 @@ static const struct bond_option bond_opts[] = { · 186 unmodified lines
379379 .values = bond_tlb_dynamic_lb_tbl,
380380 .flags = BOND_OPTFLAG_IFDOWN,
381381 .set = bond_option_tlb_dynamic_lb_set,
382− },
383− { }
382+ }
384383 };
385384
386385 /* Searches for an option by name */
@@ -1182,6 +1181,7 @@ static int bond_option_min_links_set(struct bonding *bond, · 795 unmodified lines
11821181 netdev_info(bond->dev, "Setting min links value to %llu\n",
11831182 newval->value);
11841183 bond->params.min_links = newval->value;
1184+ bond_set_carrier(bond);
11851185
11861186 return 0;
11871187 }
drivers/net/can/at91_can.c+0−2
@@ -138,7 +138,6 @@ struct at91_devtype_data { · 137 unmodified lines
138138
139139 struct at91_priv {
140140 struct can_priv can; /* must be the first member! */
141− struct net_device *dev;
142141 struct napi_struct napi;
143142
144143 void __iomem *reg_base;
@@ -1350,7 +1349,6 @@ static int at91_can_probe(struct platform_device *pdev) · 1205 unmodified lines
13501349 priv->can.do_get_berr_counter = at91_get_berr_counter;
13511350 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
13521351 CAN_CTRLMODE_LISTENONLY;
1353− priv->dev = dev;
13541352 priv->reg_base = addr;
13551353 priv->devtype_data = *devtype_data;
13561354 priv->clk = clk;
drivers/net/can/bfin_can.c+1−0
@@ -352,6 +352,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) · 351 unmodified lines
352352 netdev_dbg(dev, "bus-off mode interrupt\n");
353353 state = CAN_STATE_BUS_OFF;
354354 cf->can_id |= CAN_ERR_BUSOFF;
355+ priv->can.can_stats.bus_off++;
355356 can_bus_off(dev);
356357 }
357358
drivers/net/can/c_can/c_can.c+1−1
@@ -869,7 +869,7 @@ static int c_can_handle_state_change(struct net_device *dev, · 868 unmodified lines
869869 case C_CAN_BUS_OFF:
870870 /* bus-off state */
871871 priv->can.state = CAN_STATE_BUS_OFF;
872− can_bus_off(dev);
872+ priv->can.can_stats.bus_off++;
873873 break;
874874 default:
875875 break;
drivers/net/can/cc770/cc770.c+1−0
@@ -535,6 +535,7 @@ static int cc770_err(struct net_device *dev, u8 status) · 534 unmodified lines
535535 cc770_write_reg(priv, control, CTRL_INI);
536536 cf->can_id |= CAN_ERR_BUSOFF;
537537 priv->can.state = CAN_STATE_BUS_OFF;
538+ priv->can.can_stats.bus_off++;
538539 can_bus_off(dev);
539540 } else if (status & STAT_WARN) {
540541 cf->can_id |= CAN_ERR_CRTL;
drivers/net/can/dev.c+3−2
@@ -289,9 +289,11 @@ static void can_update_state_error_stats(struct net_device *dev, · 288 unmodified lines
289289 priv->can_stats.error_passive++;
290290 break;
291291 case CAN_STATE_BUS_OFF:
292+ priv->can_stats.bus_off++;
293+ break;
292294 default:
293295 break;
294− };
296+ }
295297 }
296298
297299 static int can_tx_state_to_frame(struct net_device *dev, enum can_state state)
@@ -544,7 +546,6 @@ void can_bus_off(struct net_device *dev) · 246 unmodified lines
544546 netdev_dbg(dev, "bus-off\n");
545547
546548 netif_carrier_off(dev);
547− priv->can_stats.bus_off++;
548549
549550 if (priv->restart_ms)
550551 mod_timer(&priv->restart_timer,
drivers/net/can/flexcan.c+0−2
@@ -247,7 +247,6 @@ struct flexcan_devtype_data { · 246 unmodified lines
247247
248248 struct flexcan_priv {
249249 struct can_priv can;
250− struct net_device *dev;
251250 struct napi_struct napi;
252251
253252 void __iomem *base;
@@ -1220,7 +1219,6 @@ static int flexcan_probe(struct platform_device *pdev) · 966 unmodified lines
12201219 CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_3_SAMPLES |
12211220 CAN_CTRLMODE_BERR_REPORTING;
12221221 priv->base = base;
1223− priv->dev = dev;
12241222 priv->clk_ipg = clk_ipg;
12251223 priv->clk_per = clk_per;
12261224 priv->pdata = dev_get_platdata(&pdev->dev);
drivers/net/can/janz-ican3.c+3−4
@@ -1008,6 +1008,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) · 1007 unmodified lines
10081008 if (status & SR_BS) {
10091009 state = CAN_STATE_BUS_OFF;
10101010 cf->can_id |= CAN_ERR_BUSOFF;
1011+ mod->can.can_stats.bus_off++;
10111012 can_bus_off(dev);
10121013 } else if (status & SR_ES) {
10131014 if (rxerr >= 128 || txerr >= 128)
@@ -1678,8 +1679,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev, · 664 unmodified lines
16781679 if (ret)
16791680 return ret;
16801681
1681− ret = wait_for_completion_timeout(&mod->buserror_comp, HZ);
1682− if (ret == 0) {
1682+ if (!wait_for_completion_timeout(&mod->buserror_comp, HZ)) {
16831683 netdev_info(mod->ndev, "%s timed out\n", __func__);
16841684 return -ETIMEDOUT;
16851685 }
@@ -1704,8 +1704,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev, · 18 unmodified lines
17041704 if (ret)
17051705 return ret;
17061706
1707− ret = wait_for_completion_timeout(&mod->termination_comp, HZ);
1708− if (ret == 0) {
1707+ if (!wait_for_completion_timeout(&mod->termination_comp, HZ)) {
17091708 netdev_info(mod->ndev, "%s timed out\n", __func__);
17101709 return -ETIMEDOUT;
17111710 }
drivers/net/can/m_can/m_can.c+1−0
@@ -589,6 +589,7 @@ static int m_can_handle_state_change(struct net_device *dev, · 588 unmodified lines
589589 /* bus-off state */
590590 priv->can.state = CAN_STATE_BUS_OFF;
591591 m_can_disable_all_interrupts(priv);
592+ priv->can.can_stats.bus_off++;
592593 can_bus_off(dev);
593594 break;
594595 default:
drivers/net/can/pch_can.c+1−0
@@ -505,6 +505,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) · 504 unmodified lines
505505 pch_can_set_rx_all(priv, 0);
506506 state = CAN_STATE_BUS_OFF;
507507 cf->can_id |= CAN_ERR_BUSOFF;
508+ priv->can.can_stats.bus_off++;
508509 can_bus_off(ndev);
509510 }
510511
drivers/net/can/rcar_can.c+1−0
@@ -331,6 +331,7 @@ static void rcar_can_error(struct net_device *ndev) · 330 unmodified lines
331331 priv->can.state = CAN_STATE_BUS_OFF;
332332 /* Clear interrupt condition */
333333 writeb(~RCAR_CAN_EIFR_BOEIF, &priv->regs->eifr);
334+ priv->can.can_stats.bus_off++;
334335 can_bus_off(ndev);
335336 if (skb)
336337 cf->can_id |= CAN_ERR_BUSOFF;
drivers/net/can/softing/softing_main.c+1−0
@@ -261,6 +261,7 @@ static int softing_handle_1(struct softing *card) · 260 unmodified lines
261261 ++priv->can.can_stats.error_passive;
262262 else if (can_state == CAN_STATE_BUS_OFF) {
263263 /* this calls can_close_cleanup() */
264+ ++priv->can.can_stats.bus_off;
264265 can_bus_off(netdev);
265266 netif_stop_queue(netdev);
266267 }
drivers/net/can/spi/mcp251x.c+1−0
@@ -905,6 +905,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) · 904 unmodified lines
905905 if (priv->can.state == CAN_STATE_BUS_OFF) {
906906 if (priv->can.restart_ms == 0) {
907907 priv->force_quit = 1;
908+ priv->can.can_stats.bus_off++;
908909 can_bus_off(net);
909910 mcp251x_hw_sleep(spi);
910911 break;
drivers/net/can/ti_hecc.c+1−0
@@ -715,6 +715,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 714 unmodified lines
715715 hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
716716 /* Disable all interrupts in bus-off to avoid int hog */
717717 hecc_write(priv, HECC_CANGIM, 0);
718+ ++priv->can.can_stats.bus_off;
718719 can_bus_off(ndev);
719720 }
720721
drivers/net/can/usb/Kconfig+18−4
@@ -25,7 +25,7 @@ config CAN_KVASER_USB · 24 unmodified lines
2525 tristate "Kvaser CAN/USB interface"
2626 ---help---
2727 This driver adds support for Kvaser CAN/USB devices like Kvaser
28− Leaf Light.
28+ Leaf Light and Kvaser USBcan II.
2929
3030 The driver provides support for the following devices:
3131 - Kvaser Leaf Light
@@ -46,6 +46,12 @@ config CAN_KVASER_USB · 14 unmodified lines
4646 - Kvaser USBcan R
4747 - Kvaser Leaf Light v2
4848 - Kvaser Mini PCI Express HS
49+ - Kvaser USBcan II HS/HS
50+ - Kvaser USBcan II HS/LS
51+ - Kvaser USBcan Rugged ("USBcan Rev B")
52+ - Kvaser Memorator HS/HS
53+ - Kvaser Memorator HS/LS
54+ - Scania VCI2 (if you have the Kvaser logo on top)
4955
5056 If unsure, say N.
5157
@@ -53,10 +59,18 @@ config CAN_KVASER_USB · 1 unmodified line
5359 module will be called kvaser_usb.
5460
5561 config CAN_PEAK_USB
56− tristate "PEAK PCAN-USB/USB Pro interfaces"
62+ tristate "PEAK PCAN-USB/USB Pro interfaces for CAN 2.0b/CAN-FD"
5763 ---help---
58− This driver supports the PCAN-USB and PCAN-USB Pro adapters
59− from PEAK-System Technik (http://www.peak-system.com).
64+ This driver supports the PEAK-System Technik USB adapters that enable
65+ access to the CAN bus, with repect to the CAN 2.0b and/or CAN-FD
66+ standards, that is:
67+
68+ PCAN-USB single CAN 2.0b channel USB adapter
69+ PCAN-USB Pro dual CAN 2.0b channels USB adapter
70+ PCAN-USB FD single CAN-FD channel USB adapter
71+ PCAN-USB Pro FD dual CAN-FD channels USB adapter
72+
73+ (see also http://www.peak-system.com).
6074
6175 config CAN_8DEV_USB
6276 tristate "8 devices USB2CAN interface"
drivers/net/can/usb/ems_usb.c+1−0
@@ -347,6 +347,7 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) · 346 unmodified lines
347347 dev->can.state = CAN_STATE_BUS_OFF;
348348 cf->can_id |= CAN_ERR_BUSOFF;
349349
350+ dev->can.can_stats.bus_off++;
350351 can_bus_off(dev->netdev);
351352 } else if (state & SJA1000_SR_ES) {
352353 dev->can.state = CAN_STATE_ERROR_WARNING;
drivers/net/can/usb/esd_usb2.c+1−0
@@ -250,6 +250,7 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, · 249 unmodified lines
250250 case ESD_BUSSTATE_BUSOFF:
251251 priv->can.state = CAN_STATE_BUS_OFF;
252252 cf->can_id |= CAN_ERR_BUSOFF;
253+ priv->can.can_stats.bus_off++;
253254 can_bus_off(priv->netdev);
254255 break;
255256 case ESD_BUSSTATE_WARN:
drivers/net/can/usb/kvaser_usb.c+541−182
@@ -6,10 +6,12 @@ · 5 unmodified lines
66 * Parts of this driver are based on the following:
77 * - Kvaser linux leaf driver (version 4.78)
88 * - CAN driver for esd CAN-USB/2
9+ * - Kvaser linux usbcanII driver (version 5.3)
910 *
1011 * Copyright (C) 2002-2006 KVASER AB, Sweden. All rights reserved.
1112 * Copyright (C) 2010 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh
1213 * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>
14+ * Copyright (C) 2015 Valeo S.A.
1315 */
1416
1517 #include <linux/completion.h>
@@ -30,8 +32,9 @@ · 14 unmodified lines
3032 #define RX_BUFFER_SIZE 3072
3133 #define CAN_USB_CLOCK 8000000
3234 #define MAX_NET_DEVICES 3
35+#define MAX_USBCAN_NET_DEVICES 2
3336
34−/* Kvaser USB devices */
37+/* Kvaser Leaf USB devices */
3538 #define KVASER_VENDOR_ID 0x0bfd
3639 #define USB_LEAF_DEVEL_PRODUCT_ID 10
3740 #define USB_LEAF_LITE_PRODUCT_ID 11
@@ -56,6 +59,24 @@ · 18 unmodified lines
5659 #define USB_LEAF_LITE_V2_PRODUCT_ID 288
5760 #define USB_MINI_PCIE_HS_PRODUCT_ID 289
5861
62+static inline bool kvaser_is_leaf(const struct usb_device_id *id)
63+{
64+ return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID &&
65+ id->idProduct <= USB_MINI_PCIE_HS_PRODUCT_ID;
66+}
67+
68+/* Kvaser USBCan-II devices */
69+#define USB_USBCAN_REVB_PRODUCT_ID 2
70+#define USB_VCI2_PRODUCT_ID 3
71+#define USB_USBCAN2_PRODUCT_ID 4
72+#define USB_MEMORATOR_PRODUCT_ID 5
73+
74+static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
75+{
76+ return id->idProduct >= USB_USBCAN_REVB_PRODUCT_ID &&
77+ id->idProduct <= USB_MEMORATOR_PRODUCT_ID;
78+}
79+
5980 /* USB devices features */
6081 #define KVASER_HAS_SILENT_MODE BIT(0)
6182 #define KVASER_HAS_TXRX_ERRORS BIT(1)
@@ -73,7 +94,7 @@ · 11 unmodified lines
7394 #define MSG_FLAG_TX_ACK BIT(6)
7495 #define MSG_FLAG_TX_REQUEST BIT(7)
7596
76−/* Can states */
97+/* Can states (M16C CxSTRH register) */
7798 #define M16C_STATE_BUS_RESET BIT(0)
7899 #define M16C_STATE_BUS_ERROR BIT(4)
79100 #define M16C_STATE_BUS_PASSIVE BIT(5)
@@ -98,7 +119,11 @@ · 18 unmodified lines
98119 #define CMD_START_CHIP_REPLY 27
99120 #define CMD_STOP_CHIP 28
100121 #define CMD_STOP_CHIP_REPLY 29
101−#define CMD_GET_CARD_INFO2 32
122+
123+#define CMD_LEAF_GET_CARD_INFO2 32
124+#define CMD_USBCAN_RESET_CLOCK 32
125+#define CMD_USBCAN_CLOCK_OVERFLOW_EVENT 33
126+
102127 #define CMD_GET_CARD_INFO 34
103128 #define CMD_GET_CARD_INFO_REPLY 35
104129 #define CMD_GET_SOFTWARE_INFO 38
@@ -108,8 +133,9 @@ · 3 unmodified lines
108133 #define CMD_RESET_ERROR_COUNTER 49
109134 #define CMD_TX_ACKNOWLEDGE 50
110135 #define CMD_CAN_ERROR_EVENT 51
111−#define CMD_USB_THROTTLE 77
112−#define CMD_LOG_MESSAGE 106
136+
137+#define CMD_LEAF_USB_THROTTLE 77
138+#define CMD_LEAF_LOG_MESSAGE 106
113139
114140 /* error factors */
115141 #define M16C_EF_ACKE BIT(0)
@@ -121,6 +147,14 @@ · 5 unmodified lines
121147 #define M16C_EF_RCVE BIT(6)
122148 #define M16C_EF_TRE BIT(7)
123149
150+/* Only Leaf-based devices can report M16C error factors,
151+ * thus define our own error status flags for USBCANII
152+ */
153+#define USBCAN_ERROR_STATE_NONE 0
154+#define USBCAN_ERROR_STATE_TX_ERROR BIT(0)
155+#define USBCAN_ERROR_STATE_RX_ERROR BIT(1)
156+#define USBCAN_ERROR_STATE_BUSERROR BIT(2)
157+
124158 /* bittiming parameters */
125159 #define KVASER_USB_TSEG1_MIN 1
126160 #define KVASER_USB_TSEG1_MAX 16
@@ -137,9 +171,18 @@ · 10 unmodified lines
137171 #define KVASER_CTRL_MODE_SELFRECEPTION 3
138172 #define KVASER_CTRL_MODE_OFF 4
139173
140−/* log message */
174+/* Extended CAN identifier flag */
141175 #define KVASER_EXTENDED_FRAME BIT(31)
142176
177+/* Kvaser USB CAN dongles are divided into two major families:
178+ * - Leaf: Based on Renesas M32C, running firmware labeled as 'filo'
179+ * - UsbcanII: Based on Renesas M16C, running firmware labeled as 'helios'
180+ */
181+enum kvaser_usb_family {
182+ KVASER_LEAF,
183+ KVASER_USBCAN,
184+};
185+
143186 struct kvaser_msg_simple {
144187 u8 tid;
145188 u8 channel;
@@ -148,30 +191,55 @@ struct kvaser_msg_simple { · 2 unmodified lines
148191 struct kvaser_msg_cardinfo {
149192 u8 tid;
150193 u8 nchannels;
151− __le32 serial_number;
152− __le32 padding;
194+ union {
195+ struct {
196+ __le32 serial_number;
197+ __le32 padding;
198+ } __packed leaf0;
199+ struct {
200+ __le32 serial_number_low;
201+ __le32 serial_number_high;
202+ } __packed usbcan0;
203+ } __packed;
153204 __le32 clock_resolution;
154205 __le32 mfgdate;
155206 u8 ean[8];
156207 u8 hw_revision;
157− u8 usb_hs_mode;
158− __le16 padding2;
208+ union {
209+ struct {
210+ u8 usb_hs_mode;
211+ } __packed leaf1;
212+ struct {
213+ u8 padding;
214+ } __packed usbcan1;
215+ } __packed;
216+ __le16 padding;
159217 } __packed;
160218
161219 struct kvaser_msg_cardinfo2 {
162220 u8 tid;
163− u8 channel;
221+ u8 reserved;
164222 u8 pcb_id[24];
165223 __le32 oem_unlock_code;
166224 } __packed;
167225
168−struct kvaser_msg_softinfo {
226+struct leaf_msg_softinfo {
169227 u8 tid;
170− u8 channel;
228+ u8 padding0;
171229 __le32 sw_options;
172230 __le32 fw_version;
173231 __le16 max_outstanding_tx;
174− __le16 padding[9];
232+ __le16 padding1[9];
233+} __packed;
234+
235+struct usbcan_msg_softinfo {
236+ u8 tid;
237+ u8 fw_name[5];
238+ __le16 max_outstanding_tx;
239+ u8 padding[6];
240+ __le32 fw_version;
241+ __le16 checksum;
242+ __le16 sw_options;
175243 } __packed;
176244
177245 struct kvaser_msg_busparams {
@@ -188,36 +256,86 @@ struct kvaser_msg_tx_can { · 10 unmodified lines
188256 u8 channel;
189257 u8 tid;
190258 u8 msg[14];
191− u8 padding;
192− u8 flags;
259+ union {
260+ struct {
261+ u8 padding;
262+ u8 flags;
263+ } __packed leaf;
264+ struct {
265+ u8 flags;
266+ u8 padding;
267+ } __packed usbcan;
268+ } __packed;
269+} __packed;
270+
271+struct kvaser_msg_rx_can_header {
272+ u8 channel;
273+ u8 flag;
193274 } __packed;
194275
195−struct kvaser_msg_rx_can {
276+struct leaf_msg_rx_can {
196277 u8 channel;
197278 u8 flag;
279+
198280 __le16 time[3];
199281 u8 msg[14];
200282 } __packed;
201283
202−struct kvaser_msg_chip_state_event {
284+struct usbcan_msg_rx_can {
285+ u8 channel;
286+ u8 flag;
287+
288+ u8 msg[14];
289+ __le16 time;
290+} __packed;
291+
292+struct leaf_msg_chip_state_event {
203293 u8 tid;
204294 u8 channel;
295+
205296 __le16 time[3];
206297 u8 tx_errors_count;
207298 u8 rx_errors_count;
299+
208300 u8 status;
209301 u8 padding[3];
210302 } __packed;
211303
212−struct kvaser_msg_tx_acknowledge {
304+struct usbcan_msg_chip_state_event {
305+ u8 tid;
306+ u8 channel;
307+
308+ u8 tx_errors_count;
309+ u8 rx_errors_count;
310+ __le16 time;
311+
312+ u8 status;
313+ u8 padding[3];
314+} __packed;
315+
316+struct kvaser_msg_tx_acknowledge_header {
213317 u8 channel;
214318 u8 tid;
319+} __packed;
320+
321+struct leaf_msg_tx_acknowledge {
322+ u8 channel;
323+ u8 tid;
324+
215325 __le16 time[3];
216326 u8 flags;
217327 u8 time_offset;
218328 } __packed;
219329
220−struct kvaser_msg_error_event {
330+struct usbcan_msg_tx_acknowledge {
331+ u8 channel;
332+ u8 tid;
333+
334+ __le16 time;
335+ __le16 padding;
336+} __packed;
337+
338+struct leaf_msg_error_event {
221339 u8 tid;
222340 u8 flags;
223341 __le16 time[3];
@@ -229,6 +347,18 @@ struct kvaser_msg_error_event { · 5 unmodified lines
229347 u8 error_factor;
230348 } __packed;
231349
350+struct usbcan_msg_error_event {
351+ u8 tid;
352+ u8 padding;
353+ u8 tx_errors_count_ch0;
354+ u8 rx_errors_count_ch0;
355+ u8 tx_errors_count_ch1;
356+ u8 rx_errors_count_ch1;
357+ u8 status_ch0;
358+ u8 status_ch1;
359+ __le16 time;
360+} __packed;
361+
232362 struct kvaser_msg_ctrl_mode {
233363 u8 tid;
234364 u8 channel;
@@ -243,7 +373,7 @@ struct kvaser_msg_flush_queue { · 8 unmodified lines
243373 u8 padding[3];
244374 } __packed;
245375
246−struct kvaser_msg_log_message {
376+struct leaf_msg_log_message {
247377 u8 channel;
248378 u8 flags;
249379 __le16 time[3];
@@ -260,19 +390,57 @@ struct kvaser_msg { · 10 unmodified lines
260390 struct kvaser_msg_simple simple;
261391 struct kvaser_msg_cardinfo cardinfo;
262392 struct kvaser_msg_cardinfo2 cardinfo2;
263− struct kvaser_msg_softinfo softinfo;
264393 struct kvaser_msg_busparams busparams;
394+
395+ struct kvaser_msg_rx_can_header rx_can_header;
396+ struct kvaser_msg_tx_acknowledge_header tx_acknowledge_header;
397+
398+ union {
399+ struct leaf_msg_softinfo softinfo;
400+ struct leaf_msg_rx_can rx_can;
401+ struct leaf_msg_chip_state_event chip_state_event;
402+ struct leaf_msg_tx_acknowledge tx_acknowledge;
403+ struct leaf_msg_error_event error_event;
404+ struct leaf_msg_log_message log_message;
405+ } __packed leaf;
406+
407+ union {
408+ struct usbcan_msg_softinfo softinfo;
409+ struct usbcan_msg_rx_can rx_can;
410+ struct usbcan_msg_chip_state_event chip_state_event;
411+ struct usbcan_msg_tx_acknowledge tx_acknowledge;
412+ struct usbcan_msg_error_event error_event;
413+ } __packed usbcan;
414+
265415 struct kvaser_msg_tx_can tx_can;
266− struct kvaser_msg_rx_can rx_can;
267− struct kvaser_msg_chip_state_event chip_state_event;
268− struct kvaser_msg_tx_acknowledge tx_acknowledge;
269− struct kvaser_msg_error_event error_event;
270416 struct kvaser_msg_ctrl_mode ctrl_mode;
271417 struct kvaser_msg_flush_queue flush_queue;
272− struct kvaser_msg_log_message log_message;
273418 } u;
274419 } __packed;
275420
421+/* Summary of a kvaser error event, for a unified Leaf/Usbcan error
422+ * handling. Some discrepancies between the two families exist:
423+ *
424+ * - USBCAN firmware does not report M16C "error factors"
425+ * - USBCAN controllers has difficulties reporting if the raised error
426+ * event is for ch0 or ch1. They leave such arbitration to the OS
427+ * driver by letting it compare error counters with previous values
428+ * and decide the error event's channel. Thus for USBCAN, the channel
429+ * field is only advisory.
430+ */
431+struct kvaser_usb_error_summary {
432+ u8 channel, status, txerr, rxerr;
433+ union {
434+ struct {
435+ u8 error_factor;
436+ } leaf;
437+ struct {
438+ u8 other_ch_status;
439+ u8 error_state;
440+ } usbcan;
441+ };
442+};
443+
276444 struct kvaser_usb_tx_urb_context {
277445 struct kvaser_usb_net_priv *priv;
278446 u32 echo_index;
@@ -288,6 +456,7 @@ struct kvaser_usb { · 9 unmodified lines
288456
289457 u32 fw_version;
290458 unsigned int nchannels;
459+ enum kvaser_usb_family family;
291460
292461 bool rxinitdone;
293462 void *rxbuf[MAX_RX_URBS];
@@ -311,6 +480,7 @@ struct kvaser_usb_net_priv { · 17 unmodified lines
311480 };
312481
313482 static const struct usb_device_id kvaser_usb_table[] = {
483+ /* Leaf family IDs */
314484 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID) },
315485 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID) },
316486 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_PRODUCT_ID),
@@ -360,6 +530,17 @@ static const struct usb_device_id kvaser_usb_table[] = { · 43 unmodified lines
360530 .driver_info = KVASER_HAS_TXRX_ERRORS },
361531 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) },
362532 { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) },
533+
534+ /* USBCANII family IDs */
535+ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID),
536+ .driver_info = KVASER_HAS_TXRX_ERRORS },
537+ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_REVB_PRODUCT_ID),
538+ .driver_info = KVASER_HAS_TXRX_ERRORS },
539+ { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMORATOR_PRODUCT_ID),
540+ .driver_info = KVASER_HAS_TXRX_ERRORS },
541+ { USB_DEVICE(KVASER_VENDOR_ID, USB_VCI2_PRODUCT_ID),
542+ .driver_info = KVASER_HAS_TXRX_ERRORS },
543+
363544 { }
364545 };
365546 MODULE_DEVICE_TABLE(usb, kvaser_usb_table);
@@ -463,7 +644,14 @@ static int kvaser_usb_get_software_info(struct kvaser_usb *dev) · 97 unmodified lines
463644 if (err)
464645 return err;
465646
466− dev->fw_version = le32_to_cpu(msg.u.softinfo.fw_version);
647+ switch (dev->family) {
648+ case KVASER_LEAF:
649+ dev->fw_version = le32_to_cpu(msg.u.leaf.softinfo.fw_version);
650+ break;
651+ case KVASER_USBCAN:
652+ dev->fw_version = le32_to_cpu(msg.u.usbcan.softinfo.fw_version);
653+ break;
654+ }
467655
468656 return 0;
469657 }
@@ -482,7 +670,9 @@ static int kvaser_usb_get_card_info(struct kvaser_usb *dev) · 12 unmodified lines
482670 return err;
483671
484672 dev->nchannels = msg.u.cardinfo.nchannels;
485− if (dev->nchannels > MAX_NET_DEVICES)
673+ if ((dev->nchannels > MAX_NET_DEVICES) ||
674+ (dev->family == KVASER_USBCAN &&
675+ dev->nchannels > MAX_USBCAN_NET_DEVICES))
486676 return -EINVAL;
487677
488678 return 0;
@@ -496,8 +686,10 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, · 7 unmodified lines
496686 struct kvaser_usb_net_priv *priv;
497687 struct sk_buff *skb;
498688 struct can_frame *cf;
499− u8 channel = msg->u.tx_acknowledge.channel;
500− u8 tid = msg->u.tx_acknowledge.tid;
689+ u8 channel, tid;
690+
691+ channel = msg->u.tx_acknowledge_header.channel;
692+ tid = msg->u.tx_acknowledge_header.tid;
501693
502694 if (channel >= dev->nchannels) {
503695 dev_err(dev->udev->dev.parent,
@@ -615,158 +807,280 @@ static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) · 111 unmodified lines
615807 priv->tx_contexts[i].echo_index = MAX_TX_URBS;
616808 }
617809
618−static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
619− const struct kvaser_msg *msg)
810+static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,
811+ const struct kvaser_usb_error_summary *es,
812+ struct can_frame *cf)
620813 {
621− struct can_frame *cf;
622− struct sk_buff *skb;
623− struct net_device_stats *stats;
624− struct kvaser_usb_net_priv *priv;
625− unsigned int new_state;
626− u8 channel, status, txerr, rxerr, error_factor;
814+ struct kvaser_usb *dev = priv->dev;
815+ struct net_device_stats *stats = &priv->netdev->stats;
816+ enum can_state cur_state, new_state, tx_state, rx_state;
627817
628− switch (msg->id) {
629− case CMD_CAN_ERROR_EVENT:
630− channel = msg->u.error_event.channel;
631− status = msg->u.error_event.status;
632− txerr = msg->u.error_event.tx_errors_count;
633− rxerr = msg->u.error_event.rx_errors_count;
634− error_factor = msg->u.error_event.error_factor;
635− break;
636− case CMD_LOG_MESSAGE:
637− channel = msg->u.log_message.channel;
638− status = msg->u.log_message.data[0];
639− txerr = msg->u.log_message.data[2];
640− rxerr = msg->u.log_message.data[3];
641− error_factor = msg->u.log_message.data[1];
818+ netdev_dbg(priv->netdev, "Error status: 0x%02x\n", es->status);
819+
820+ new_state = cur_state = priv->can.state;
821+
822+ if (es->status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET))
823+ new_state = CAN_STATE_BUS_OFF;
824+ else if (es->status & M16C_STATE_BUS_PASSIVE)
825+ new_state = CAN_STATE_ERROR_PASSIVE;
826+ else if (es->status & M16C_STATE_BUS_ERROR) {
827+ /* Guard against spurious error events after a busoff */
828+ if (cur_state < CAN_STATE_BUS_OFF) {
829+ if ((es->txerr >= 128) || (es->rxerr >= 128))
830+ new_state = CAN_STATE_ERROR_PASSIVE;
831+ else if ((es->txerr >= 96) || (es->rxerr >= 96))
832+ new_state = CAN_STATE_ERROR_WARNING;
833+ else if (cur_state > CAN_STATE_ERROR_ACTIVE)
834+ new_state = CAN_STATE_ERROR_ACTIVE;
835+ }
836+ }
837+
838+ if (!es->status)
839+ new_state = CAN_STATE_ERROR_ACTIVE;
840+
841+ if (new_state != cur_state) {
842+ tx_state = (es->txerr >= es->rxerr) ? new_state : 0;
843+ rx_state = (es->txerr <= es->rxerr) ? new_state : 0;
844+
845+ can_change_state(priv->netdev, cf, tx_state, rx_state);
846+ }
847+
848+ if (priv->can.restart_ms &&
849+ (cur_state >= CAN_STATE_BUS_OFF) &&
850+ (new_state < CAN_STATE_BUS_OFF)) {
851+ priv->can.can_stats.restarts++;
852+ }
853+
854+ switch (dev->family) {
855+ case KVASER_LEAF:
856+ if (es->leaf.error_factor) {
857+ priv->can.can_stats.bus_error++;
858+ stats->rx_errors++;
859+ }
642860 break;
643− case CMD_CHIP_STATE_EVENT:
644− channel = msg->u.chip_state_event.channel;
645− status = msg->u.chip_state_event.status;
646− txerr = msg->u.chip_state_event.tx_errors_count;
647− rxerr = msg->u.chip_state_event.rx_errors_count;
648− error_factor = 0;
861+ case KVASER_USBCAN:
862+ if (es->usbcan.error_state & USBCAN_ERROR_STATE_TX_ERROR)
863+ stats->tx_errors++;
864+ if (es->usbcan.error_state & USBCAN_ERROR_STATE_RX_ERROR)
865+ stats->rx_errors++;
866+ if (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR) {
867+ priv->can.can_stats.bus_error++;
868+ }
649869 break;
650− default:
651− dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n",
652− msg->id);
653− return;
654870 }
655871
656− if (channel >= dev->nchannels) {
872+ priv->bec.txerr = es->txerr;
873+ priv->bec.rxerr = es->rxerr;
874+}
875+
876+static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
877+ const struct kvaser_usb_error_summary *es)
878+{
879+ struct can_frame *cf, tmp_cf = { .can_id = CAN_ERR_FLAG, .can_dlc = CAN_ERR_DLC };
880+ struct sk_buff *skb;
881+ struct net_device_stats *stats;
882+ struct kvaser_usb_net_priv *priv;
883+ enum can_state old_state, new_state;
884+
885+ if (es->channel >= dev->nchannels) {
657886 dev_err(dev->udev->dev.parent,
658− "Invalid channel number (%d)\n", channel);
887+ "Invalid channel number (%d)\n", es->channel);
659888 return;
660889 }
661890
662− priv = dev->nets[channel];
891+ priv = dev->nets[es->channel];
663892 stats = &priv->netdev->stats;
664893
894+ /* Update all of the can interface's state and error counters before
895+ * trying any memory allocation that can actually fail with -ENOMEM.
896+ *
897+ * We send a temporary stack-allocated error can frame to
898+ * can_change_state() for the very same reason.
899+ *
900+ * TODO: Split can_change_state() responsibility between updating the
901+ * can interface's state and counters, and the setting up of can error
902+ * frame ID and data to userspace. Remove stack allocation afterwards.
903+ */
904+ old_state = priv->can.state;
905+ kvaser_usb_rx_error_update_can_state(priv, es, &tmp_cf);
906+ new_state = priv->can.state;
907+
665908 skb = alloc_can_err_skb(priv->netdev, &cf);
666909 if (!skb) {
667910 stats->rx_dropped++;
668911 return;
669912 }
913+ memcpy(cf, &tmp_cf, sizeof(*cf));
914+
915+ if (new_state != old_state) {
916+ if (es->status &
917+ (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {
918+ if (!priv->can.restart_ms)
919+ kvaser_usb_simple_msg_async(priv, CMD_STOP_CHIP);
920+ netif_carrier_off(priv->netdev);
921+ }
670922
671− new_state = priv->can.state;
672−
673− netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status);
923+ if (priv->can.restart_ms &&
924+ (old_state >= CAN_STATE_BUS_OFF) &&
925+ (new_state < CAN_STATE_BUS_OFF)) {
926+ cf->can_id |= CAN_ERR_RESTARTED;
927+ netif_carrier_on(priv->netdev);
928+ }
929+ }
674930
675− if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {
676− cf->can_id |= CAN_ERR_BUSOFF;
931+ switch (dev->family) {
932+ case KVASER_LEAF:
933+ if (es->leaf.error_factor) {
934+ cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
935+
936+ if (es->leaf.error_factor & M16C_EF_ACKE)
937+ cf->data[3] |= (CAN_ERR_PROT_LOC_ACK);
938+ if (es->leaf.error_factor & M16C_EF_CRCE)
939+ cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |
940+ CAN_ERR_PROT_LOC_CRC_DEL);
941+ if (es->leaf.error_factor & M16C_EF_FORME)
942+ cf->data[2] |= CAN_ERR_PROT_FORM;
943+ if (es->leaf.error_factor & M16C_EF_STFE)
944+ cf->data[2] |= CAN_ERR_PROT_STUFF;
945+ if (es->leaf.error_factor & M16C_EF_BITE0)
946+ cf->data[2] |= CAN_ERR_PROT_BIT0;
947+ if (es->leaf.error_factor & M16C_EF_BITE1)
948+ cf->data[2] |= CAN_ERR_PROT_BIT1;
949+ if (es->leaf.error_factor & M16C_EF_TRE)
950+ cf->data[2] |= CAN_ERR_PROT_TX;
951+ }
952+ break;
953+ case KVASER_USBCAN:
954+ if (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR) {
955+ cf->can_id |= CAN_ERR_BUSERROR;
956+ }
957+ break;
958+ }
677959
678− priv->can.can_stats.bus_off++;
679− if (!priv->can.restart_ms)
680− kvaser_usb_simple_msg_async(priv, CMD_STOP_CHIP);
960+ cf->data[6] = es->txerr;
961+ cf->data[7] = es->rxerr;
681962
682− netif_carrier_off(priv->netdev);
963+ stats->rx_packets++;
964+ stats->rx_bytes += cf->can_dlc;
965+ netif_rx(skb);
966+}
683967
684− new_state = CAN_STATE_BUS_OFF;
685− } else if (status & M16C_STATE_BUS_PASSIVE) {
686− if (priv->can.state != CAN_STATE_ERROR_PASSIVE) {
687− cf->can_id |= CAN_ERR_CRTL;
688−
689− if (txerr || rxerr)
690− cf->data[1] = (txerr > rxerr)
691− ? CAN_ERR_CRTL_TX_PASSIVE
692− : CAN_ERR_CRTL_RX_PASSIVE;
693− else
694− cf->data[1] = CAN_ERR_CRTL_TX_PASSIVE |
695− CAN_ERR_CRTL_RX_PASSIVE;
696−
697− priv->can.can_stats.error_passive++;
698− }
968+/* For USBCAN, report error to userspace iff the channels's errors counter
969+ * has changed, or we're the only channel seeing a bus error state.
970+ */
971+static void kvaser_usbcan_conditionally_rx_error(const struct kvaser_usb *dev,
972+ struct kvaser_usb_error_summary *es)
973+{
974+ struct kvaser_usb_net_priv *priv;
975+ int channel;
976+ bool report_error;
699977
700− new_state = CAN_STATE_ERROR_PASSIVE;
701− } else if (status & M16C_STATE_BUS_ERROR) {
702− if ((priv->can.state < CAN_STATE_ERROR_WARNING) &&
703− ((txerr >= 96) || (rxerr >= 96))) {
704− cf->can_id |= CAN_ERR_CRTL;
705− cf->data[1] = (txerr > rxerr)
706− ? CAN_ERR_CRTL_TX_WARNING
707− : CAN_ERR_CRTL_RX_WARNING;
708−
709− priv->can.can_stats.error_warning++;
710− new_state = CAN_STATE_ERROR_WARNING;
711− } else if ((priv->can.state > CAN_STATE_ERROR_ACTIVE) &&
712− ((txerr < 96) && (rxerr < 96))) {
713− cf->can_id |= CAN_ERR_PROT;
714− cf->data[2] = CAN_ERR_PROT_ACTIVE;
715−
716− new_state = CAN_STATE_ERROR_ACTIVE;
717− }
978+ channel = es->channel;
979+ if (channel >= dev->nchannels) {
980+ dev_err(dev->udev->dev.parent,
981+ "Invalid channel number (%d)\n", channel);
982+ return;
718983 }
719984
720− if (!status) {
721− cf->can_id |= CAN_ERR_PROT;
722− cf->data[2] = CAN_ERR_PROT_ACTIVE;
985+ priv = dev->nets[channel];
986+ report_error = false;
723987
724− new_state = CAN_STATE_ERROR_ACTIVE;
988+ if (es->txerr != priv->bec.txerr) {
989+ es->usbcan.error_state |= USBCAN_ERROR_STATE_TX_ERROR;
990+ report_error = true;
991+ }
992+ if (es->rxerr != priv->bec.rxerr) {
993+ es->usbcan.error_state |= USBCAN_ERROR_STATE_RX_ERROR;
994+ report_error = true;
995+ }
996+ if ((es->status & M16C_STATE_BUS_ERROR) &&
997+ !(es->usbcan.other_ch_status & M16C_STATE_BUS_ERROR)) {
998+ es->usbcan.error_state |= USBCAN_ERROR_STATE_BUSERROR;
999+ report_error = true;
7251000 }
7261001
727− if (priv->can.restart_ms &&
728− (priv->can.state >= CAN_STATE_BUS_OFF) &&
729− (new_state < CAN_STATE_BUS_OFF)) {
730− cf->can_id |= CAN_ERR_RESTARTED;
731− netif_carrier_on(priv->netdev);
1002+ if (report_error)
1003+ kvaser_usb_rx_error(dev, es);
1004+}
7321005
733− priv->can.can_stats.restarts++;
734− }
1006+static void kvaser_usbcan_rx_error(const struct kvaser_usb *dev,
1007+ const struct kvaser_msg *msg)
1008+{
1009+ struct kvaser_usb_error_summary es = { };
7351010
736− if (error_factor) {
737− priv->can.can_stats.bus_error++;
738− stats->rx_errors++;
1011+ switch (msg->id) {
1012+ /* Sometimes errors are sent as unsolicited chip state events */
1013+ case CMD_CHIP_STATE_EVENT:
1014+ es.channel = msg->u.usbcan.chip_state_event.channel;
1015+ es.status = msg->u.usbcan.chip_state_event.status;
1016+ es.txerr = msg->u.usbcan.chip_state_event.tx_errors_count;
1017+ es.rxerr = msg->u.usbcan.chip_state_event.rx_errors_count;
1018+ kvaser_usbcan_conditionally_rx_error(dev, &es);
1019+ break;
7391020
740− cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
741−
742− if (error_factor & M16C_EF_ACKE)
743− cf->data[3] |= (CAN_ERR_PROT_LOC_ACK);
744− if (error_factor & M16C_EF_CRCE)
745− cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |
746− CAN_ERR_PROT_LOC_CRC_DEL);
747− if (error_factor & M16C_EF_FORME)
748− cf->data[2] |= CAN_ERR_PROT_FORM;
749− if (error_factor & M16C_EF_STFE)
750− cf->data[2] |= CAN_ERR_PROT_STUFF;
751− if (error_factor & M16C_EF_BITE0)
752− cf->data[2] |= CAN_ERR_PROT_BIT0;
753− if (error_factor & M16C_EF_BITE1)
754− cf->data[2] |= CAN_ERR_PROT_BIT1;
755− if (error_factor & M16C_EF_TRE)
756− cf->data[2] |= CAN_ERR_PROT_TX;
757− }
1021+ case CMD_CAN_ERROR_EVENT:
1022+ es.channel = 0;
1023+ es.status = msg->u.usbcan.error_event.status_ch0;
1024+ es.txerr = msg->u.usbcan.error_event.tx_errors_count_ch0;
1025+ es.rxerr = msg->u.usbcan.error_event.rx_errors_count_ch0;
1026+ es.usbcan.other_ch_status =
1027+ msg->u.usbcan.error_event.status_ch1;
1028+ kvaser_usbcan_conditionally_rx_error(dev, &es);
1029+
1030+ /* The USBCAN firmware supports up to 2 channels.
1031+ * Now that ch0 was checked, check if ch1 has any errors.
1032+ */
1033+ if (dev->nchannels == MAX_USBCAN_NET_DEVICES) {
1034+ es.channel = 1;
1035+ es.status = msg->u.usbcan.error_event.status_ch1;
1036+ es.txerr = msg->u.usbcan.error_event.tx_errors_count_ch1;
1037+ es.rxerr = msg->u.usbcan.error_event.rx_errors_count_ch1;
1038+ es.usbcan.other_ch_status =
1039+ msg->u.usbcan.error_event.status_ch0;
1040+ kvaser_usbcan_conditionally_rx_error(dev, &es);
1041+ }
1042+ break;
7581043
759− cf->data[6] = txerr;
760− cf->data[7] = rxerr;
1044+ default:
1045+ dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n",
1046+ msg->id);
1047+ }
1048+}
7611049
762− priv->bec.txerr = txerr;
763− priv->bec.rxerr = rxerr;
1050+static void kvaser_leaf_rx_error(const struct kvaser_usb *dev,
1051+ const struct kvaser_msg *msg)
1052+{
1053+ struct kvaser_usb_error_summary es = { };
7641054
765− priv->can.state = new_state;
1055+ switch (msg->id) {
1056+ case CMD_CAN_ERROR_EVENT:
1057+ es.channel = msg->u.leaf.error_event.channel;
1058+ es.status = msg->u.leaf.error_event.status;
1059+ es.txerr = msg->u.leaf.error_event.tx_errors_count;
1060+ es.rxerr = msg->u.leaf.error_event.rx_errors_count;
1061+ es.leaf.error_factor = msg->u.leaf.error_event.error_factor;
1062+ break;
1063+ case CMD_LEAF_LOG_MESSAGE:
1064+ es.channel = msg->u.leaf.log_message.channel;
1065+ es.status = msg->u.leaf.log_message.data[0];
1066+ es.txerr = msg->u.leaf.log_message.data[2];
1067+ es.rxerr = msg->u.leaf.log_message.data[3];
1068+ es.leaf.error_factor = msg->u.leaf.log_message.data[1];
1069+ break;
1070+ case CMD_CHIP_STATE_EVENT:
1071+ es.channel = msg->u.leaf.chip_state_event.channel;
1072+ es.status = msg->u.leaf.chip_state_event.status;
1073+ es.txerr = msg->u.leaf.chip_state_event.tx_errors_count;
1074+ es.rxerr = msg->u.leaf.chip_state_event.rx_errors_count;
1075+ es.leaf.error_factor = 0;
1076+ break;
1077+ default:
1078+ dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n",
1079+ msg->id);
1080+ return;
1081+ }
7661082
767− stats->rx_packets++;
768− stats->rx_bytes += cf->can_dlc;
769− netif_rx(skb);
1083+ kvaser_usb_rx_error(dev, &es);
7701084 }
7711085
7721086 static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv,
@@ -776,16 +1090,19 @@ static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, · 3 unmodified lines
7761090 struct sk_buff *skb;
7771091 struct net_device_stats *stats = &priv->netdev->stats;
7781092
779− if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME |
1093+ if (msg->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |
7801094 MSG_FLAG_NERR)) {
7811095 netdev_err(priv->netdev, "Unknow error (flags: 0x%02x)\n",
782− msg->u.rx_can.flag);
1096+ msg->u.rx_can_header.flag);
7831097
7841098 stats->rx_errors++;
7851099 return;
7861100 }
7871101
788− if (msg->u.rx_can.flag & MSG_FLAG_OVERRUN) {
1102+ if (msg->u.rx_can_header.flag & MSG_FLAG_OVERRUN) {
1103+ stats->rx_over_errors++;
1104+ stats->rx_errors++;
1105+
7891106 skb = alloc_can_err_skb(priv->netdev, &cf);
7901107 if (!skb) {
7911108 stats->rx_dropped++;
@@ -795,9 +1112,6 @@ static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, · 3 unmodified lines
7951112 cf->can_id |= CAN_ERR_CRTL;
7961113 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
7971114
798− stats->rx_over_errors++;
799− stats->rx_errors++;
800−
8011115 stats->rx_packets++;
8021116 stats->rx_bytes += cf->can_dlc;
8031117 netif_rx(skb);
@@ -811,7 +1125,8 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, · 7 unmodified lines
8111125 struct can_frame *cf;
8121126 struct sk_buff *skb;
8131127 struct net_device_stats *stats;
814− u8 channel = msg->u.rx_can.channel;
1128+ u8 channel = msg->u.rx_can_header.channel;
1129+ const u8 *rx_msg = NULL; /* GCC */
8151130
8161131 if (channel >= dev->nchannels) {
8171132 dev_err(dev->udev->dev.parent,
@@ -822,60 +1137,68 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, · 4 unmodified lines
8221137 priv = dev->nets[channel];
8231138 stats = &priv->netdev->stats;
8241139
825− if ((msg->u.rx_can.flag & MSG_FLAG_ERROR_FRAME) &&
826− (msg->id == CMD_LOG_MESSAGE)) {
827− kvaser_usb_rx_error(dev, msg);
1140+ if ((msg->u.rx_can_header.flag & MSG_FLAG_ERROR_FRAME) &&
1141+ (dev->family == KVASER_LEAF && msg->id == CMD_LEAF_LOG_MESSAGE)) {
1142+ kvaser_leaf_rx_error(dev, msg);
8281143 return;
829− } else if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME |
830− MSG_FLAG_NERR |
831− MSG_FLAG_OVERRUN)) {
1144+ } else if (msg->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |
1145+ MSG_FLAG_NERR |
1146+ MSG_FLAG_OVERRUN)) {
8321147 kvaser_usb_rx_can_err(priv, msg);
8331148 return;
834− } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) {
1149+ } else if (msg->u.rx_can_header.flag & ~MSG_FLAG_REMOTE_FRAME) {
8351150 netdev_warn(priv->netdev,
8361151 "Unhandled frame (flags: 0x%02x)",
837− msg->u.rx_can.flag);
1152+ msg->u.rx_can_header.flag);
8381153 return;
8391154 }
8401155
1156+ switch (dev->family) {
1157+ case KVASER_LEAF:
1158+ rx_msg = msg->u.leaf.rx_can.msg;
1159+ break;
1160+ case KVASER_USBCAN:
1161+ rx_msg = msg->u.usbcan.rx_can.msg;
1162+ break;
1163+ }
1164+
8411165 skb = alloc_can_skb(priv->netdev, &cf);
8421166 if (!skb) {
8431167 stats->tx_dropped++;
8441168 return;
8451169 }
8461170
847− if (msg->id == CMD_LOG_MESSAGE) {
848− cf->can_id = le32_to_cpu(msg->u.log_message.id);
1171+ if (dev->family == KVASER_LEAF && msg->id == CMD_LEAF_LOG_MESSAGE) {
1172+ cf->can_id = le32_to_cpu(msg->u.leaf.log_message.id);
8491173 if (cf->can_id & KVASER_EXTENDED_FRAME)
8501174 cf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG;
8511175 else
8521176 cf->can_id &= CAN_SFF_MASK;
8531177
854− cf->can_dlc = get_can_dlc(msg->u.log_message.dlc);
1178+ cf->can_dlc = get_can_dlc(msg->u.leaf.log_message.dlc);
8551179
856− if (msg->u.log_message.flags & MSG_FLAG_REMOTE_FRAME)
1180+ if (msg->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME)
8571181 cf->can_id |= CAN_RTR_FLAG;
8581182 else
859− memcpy(cf->data, &msg->u.log_message.data,
1183+ memcpy(cf->data, &msg->u.leaf.log_message.data,
8601184 cf->can_dlc);
8611185 } else {
862− cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) |
863− (msg->u.rx_can.msg[1] & 0x3f);
1186+ cf->can_id = ((rx_msg[0] & 0x1f) << 6) | (rx_msg[1] & 0x3f);
8641187
8651188 if (msg->id == CMD_RX_EXT_MESSAGE) {
8661189 cf->can_id <<= 18;
867− cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) |
868− ((msg->u.rx_can.msg[3] & 0xff) << 6) |
869− (msg->u.rx_can.msg[4] & 0x3f);
1190+ cf->can_id |= ((rx_msg[2] & 0x0f) << 14) |
1191+ ((rx_msg[3] & 0xff) << 6) |
1192+ (rx_msg[4] & 0x3f);
8701193 cf->can_id |= CAN_EFF_FLAG;
8711194 }
8721195
873− cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]);
1196+ cf->can_dlc = get_can_dlc(rx_msg[5]);
8741197
875− if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME)
1198+ if (msg->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME)
8761199 cf->can_id |= CAN_RTR_FLAG;
8771200 else
878− memcpy(cf->data, &msg->u.rx_can.msg[6],
1201+ memcpy(cf->data, &rx_msg[6],
8791202 cf->can_dlc);
8801203 }
8811204
@@ -938,21 +1261,35 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, · 56 unmodified lines
9381261
9391262 case CMD_RX_STD_MESSAGE:
9401263 case CMD_RX_EXT_MESSAGE:
941− case CMD_LOG_MESSAGE:
1264+ kvaser_usb_rx_can_msg(dev, msg);
1265+ break;
1266+
1267+ case CMD_LEAF_LOG_MESSAGE:
1268+ if (dev->family != KVASER_LEAF)
1269+ goto warn;
9421270 kvaser_usb_rx_can_msg(dev, msg);
9431271 break;
9441272
9451273 case CMD_CHIP_STATE_EVENT:
9461274 case CMD_CAN_ERROR_EVENT:
947− kvaser_usb_rx_error(dev, msg);
1275+ if (dev->family == KVASER_LEAF)
1276+ kvaser_leaf_rx_error(dev, msg);
1277+ else
1278+ kvaser_usbcan_rx_error(dev, msg);
9481279 break;
9491280
9501281 case CMD_TX_ACKNOWLEDGE:
9511282 kvaser_usb_tx_acknowledge(dev, msg);
9521283 break;
9531284
1285+ /* Ignored messages */
1286+ case CMD_USBCAN_CLOCK_OVERFLOW_EVENT:
1287+ if (dev->family != KVASER_USBCAN)
1288+ goto warn;
1289+ break;
1290+
9541291 default:
955− dev_warn(dev->udev->dev.parent,
1292+warn: dev_warn(dev->udev->dev.parent,
9561293 "Unhandled message (%d)\n", msg->id);
9571294 break;
9581295 }
@@ -1172,7 +1509,7 @@ static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) · 213 unmodified lines
11721509 dev->rxbuf[i],
11731510 dev->rxbuf_dma[i]);
11741511
1175− for (i = 0; i < MAX_NET_DEVICES; i++) {
1512+ for (i = 0; i < dev->nchannels; i++) {
11761513 struct kvaser_usb_net_priv *priv = dev->nets[i];
11771514
11781515 if (priv)
@@ -1280,6 +1617,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, · 101 unmodified lines
12801617 struct kvaser_msg *msg;
12811618 int i, err;
12821619 int ret = NETDEV_TX_OK;
1620+ u8 *msg_tx_can_flags = NULL; /* GCC */
12831621
12841622 if (can_dropped_invalid_skb(netdev, skb))
12851623 return NETDEV_TX_OK;
@@ -1301,9 +1639,19 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, · 15 unmodified lines
13011639
13021640 msg = buf;
13031641 msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_tx_can);
1304− msg->u.tx_can.flags = 0;
13051642 msg->u.tx_can.channel = priv->channel;
13061643
1644+ switch (dev->family) {
1645+ case KVASER_LEAF:
1646+ msg_tx_can_flags = &msg->u.tx_can.leaf.flags;
1647+ break;
1648+ case KVASER_USBCAN:
1649+ msg_tx_can_flags = &msg->u.tx_can.usbcan.flags;
1650+ break;
1651+ }
1652+
1653+ *msg_tx_can_flags = 0;
1654+
13071655 if (cf->can_id & CAN_EFF_FLAG) {
13081656 msg->id = CMD_TX_EXT_MESSAGE;
13091657 msg->u.tx_can.msg[0] = (cf->can_id >> 24) & 0x1f;
@@ -1321,7 +1669,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, · 11 unmodified lines
13211669 memcpy(&msg->u.tx_can.msg[6], cf->data, cf->can_dlc);
13221670
13231671 if (cf->can_id & CAN_RTR_FLAG)
1324− msg->u.tx_can.flags |= MSG_FLAG_REMOTE_FRAME;
1672+ *msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME;
13251673
13261674 for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) {
13271675 if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) {
@@ -1590,6 +1938,17 @@ static int kvaser_usb_probe(struct usb_interface *intf, · 262 unmodified lines
15901938 if (!dev)
15911939 return -ENOMEM;
15921940
1941+ if (kvaser_is_leaf(id)) {
1942+ dev->family = KVASER_LEAF;
1943+ } else if (kvaser_is_usbcan(id)) {
1944+ dev->family = KVASER_USBCAN;
1945+ } else {
1946+ dev_err(&intf->dev,
1947+ "Product ID (%d) does not belong to any known Kvaser USB family",
1948+ id->idProduct);
1949+ return -ENODEV;
1950+ }
1951+
15931952 err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
15941953 if (err) {
15951954 dev_err(&intf->dev, "Cannot get usb endpoint(s)");
drivers/net/can/usb/peak_usb/Makefile+1−1
@@ -1,2 +1,2 @@
11 obj-$(CONFIG_CAN_PEAK_USB) += peak_usb.o
2−peak_usb-y = pcan_usb_core.o pcan_usb.o pcan_usb_pro.o
2+peak_usb-y = pcan_usb_core.o pcan_usb.o pcan_usb_pro.o pcan_usb_fd.o
drivers/net/can/usb/peak_usb/pcan_ucan.h+222−0
@@ -0,0 +1,222 @@
1+/*
2+ * CAN driver for PEAK System micro-CAN based adapters
3+ *
4+ * Copyright (C) 2003-2011 PEAK System-Technik GmbH
5+ * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify it
8+ * under the terms of the GNU General Public License as published
9+ * by the Free Software Foundation; version 2 of the License.
10+ *
11+ * This program is distributed in the hope that it will be useful, but
12+ * WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+ * General Public License for more details.
15+ */
16+#ifndef PUCAN_H
17+#define PUCAN_H
18+
19+/* uCAN commands opcodes list (low-order 10 bits) */
20+#define PUCAN_CMD_NOP 0x000
21+#define PUCAN_CMD_RESET_MODE 0x001
22+#define PUCAN_CMD_NORMAL_MODE 0x002
23+#define PUCAN_CMD_LISTEN_ONLY_MODE 0x003
24+#define PUCAN_CMD_TIMING_SLOW 0x004
25+#define PUCAN_CMD_TIMING_FAST 0x005
26+#define PUCAN_CMD_FILTER_STD 0x008
27+#define PUCAN_CMD_TX_ABORT 0x009
28+#define PUCAN_CMD_WR_ERR_CNT 0x00a
29+#define PUCAN_CMD_RX_FRAME_ENABLE 0x00b
30+#define PUCAN_CMD_RX_FRAME_DISABLE 0x00c
31+#define PUCAN_CMD_END_OF_COLLECTION 0x3ff
32+
33+/* uCAN received messages list */
34+#define PUCAN_MSG_CAN_RX 0x0001
35+#define PUCAN_MSG_ERROR 0x0002
36+#define PUCAN_MSG_STATUS 0x0003
37+#define PUCAN_MSG_BUSLOAD 0x0004
38+#define PUCAN_MSG_CAN_TX 0x1000
39+
40+/* uCAN command common header */
41+struct __packed pucan_command {
42+ __le16 opcode_channel;
43+ u16 args[3];
44+};
45+
46+/* uCAN TIMING_SLOW command fields */
47+#define PUCAN_TSLOW_SJW_T(s, t) (((s) & 0xf) | ((!!(t)) << 7))
48+#define PUCAN_TSLOW_TSEG2(t) ((t) & 0xf)
49+#define PUCAN_TSLOW_TSEG1(t) ((t) & 0x3f)
50+#define PUCAN_TSLOW_BRP(b) ((b) & 0x3ff)
51+
52+struct __packed pucan_timing_slow {
53+ __le16 opcode_channel;
54+
55+ u8 ewl; /* Error Warning limit */
56+ u8 sjw_t; /* Sync Jump Width + Triple sampling */
57+ u8 tseg2; /* Timing SEGment 2 */
58+ u8 tseg1; /* Timing SEGment 1 */
59+
60+ __le16 brp; /* BaudRate Prescaler */
61+};
62+
63+/* uCAN TIMING_FAST command fields */
64+#define PUCAN_TFAST_SJW(s) ((s) & 0x3)
65+#define PUCAN_TFAST_TSEG2(t) ((t) & 0x7)
66+#define PUCAN_TFAST_TSEG1(t) ((t) & 0xf)
67+#define PUCAN_TFAST_BRP(b) ((b) & 0x3ff)
68+
69+struct __packed pucan_timing_fast {
70+ __le16 opcode_channel;
71+
72+ u8 unused;
73+ u8 sjw; /* Sync Jump Width */
74+ u8 tseg2; /* Timing SEGment 2 */
75+ u8 tseg1; /* Timing SEGment 1 */
76+
77+ __le16 brp; /* BaudRate Prescaler */
78+};
79+
80+/* uCAN FILTER_STD command fields */
81+#define PUCAN_FLTSTD_ROW_IDX_BITS 6
82+
83+struct __packed pucan_filter_std {
84+ __le16 opcode_channel;
85+
86+ __le16 idx;
87+ __le32 mask; /* CAN-ID bitmask in idx range */
88+};
89+
90+/* uCAN WR_ERR_CNT command fields */
91+#define PUCAN_WRERRCNT_TE 0x4000 /* Tx error cntr write Enable */
92+#define PUCAN_WRERRCNT_RE 0x8000 /* Rx error cntr write Enable */
93+
94+struct __packed pucan_wr_err_cnt {
95+ __le16 opcode_channel;
96+
97+ __le16 sel_mask;
98+ u8 tx_counter; /* Tx error counter new value */
99+ u8 rx_counter; /* Rx error counter new value */
100+
101+ u16 unused;
102+};
103+
104+/* uCAN RX_FRAME_ENABLE command fields */
105+#define PUCAN_FLTEXT_ERROR 0x0001
106+#define PUCAN_FLTEXT_BUSLOAD 0x0002
107+
108+struct __packed pucan_filter_ext {
109+ __le16 opcode_channel;
110+
111+ __le16 ext_mask;
112+ u32 unused;
113+};
114+
115+/* uCAN received messages global format */
116+struct __packed pucan_msg {
117+ __le16 size;
118+ __le16 type;
119+ __le32 ts_low;
120+ __le32 ts_high;
121+};
122+
123+/* uCAN flags for CAN/CANFD messages */
124+#define PUCAN_MSG_SELF_RECEIVE 0x80
125+#define PUCAN_MSG_ERROR_STATE_IND 0x40 /* error state indicator */
126+#define PUCAN_MSG_BITRATE_SWITCH 0x20 /* bitrate switch */
127+#define PUCAN_MSG_EXT_DATA_LEN 0x10 /* extended data length */
128+#define PUCAN_MSG_SINGLE_SHOT 0x08
129+#define PUCAN_MSG_LOOPED_BACK 0x04
130+#define PUCAN_MSG_EXT_ID 0x02
131+#define PUCAN_MSG_RTR 0x01
132+
133+struct __packed pucan_rx_msg {
134+ __le16 size;
135+ __le16 type;
136+ __le32 ts_low;
137+ __le32 ts_high;
138+ __le32 tag_low;
139+ __le32 tag_high;
140+ u8 channel_dlc;
141+ u8 client;
142+ __le16 flags;
143+ __le32 can_id;
144+ u8 d[0];
145+};
146+
147+/* uCAN error types */
148+#define PUCAN_ERMSG_BIT_ERROR 0
149+#define PUCAN_ERMSG_FORM_ERROR 1
150+#define PUCAN_ERMSG_STUFF_ERROR 2
151+#define PUCAN_ERMSG_OTHER_ERROR 3
152+#define PUCAN_ERMSG_ERR_CNT_DEC 4
153+
154+struct __packed pucan_error_msg {
155+ __le16 size;
156+ __le16 type;
157+ __le32 ts_low;
158+ __le32 ts_high;
159+ u8 channel_type_d;
160+ u8 code_g;
161+ u8 tx_err_cnt;
162+ u8 rx_err_cnt;
163+};
164+
165+#define PUCAN_BUS_PASSIVE 0x20
166+#define PUCAN_BUS_WARNING 0x40
167+#define PUCAN_BUS_BUSOFF 0x80
168+
169+struct __packed pucan_status_msg {
170+ __le16 size;
171+ __le16 type;
172+ __le32 ts_low;
173+ __le32 ts_high;
174+ u8 channel_p_w_b;
175+ u8 unused[3];
176+};
177+
178+/* uCAN transmitted message format */
179+#define PUCAN_MSG_CHANNEL_DLC(c, d) (((c) & 0xf) | ((d) << 4))
180+
181+struct __packed pucan_tx_msg {
182+ __le16 size;
183+ __le16 type;
184+ __le32 tag_low;
185+ __le32 tag_high;
186+ u8 channel_dlc;
187+ u8 client;
188+ __le16 flags;
189+ __le32 can_id;
190+ u8 d[0];
191+};
192+
193+/* build the cmd opcode_channel field with respect to the correct endianness */
194+static inline __le16 pucan_cmd_opcode_channel(struct peak_usb_device *dev,
195+ int opcode)
196+{
197+ return cpu_to_le16(((dev->ctrl_idx) << 12) | ((opcode) & 0x3ff));
198+}
199+
200+/* return the channel number part from any received message channel_dlc field */
201+static inline int pucan_msg_get_channel(struct pucan_rx_msg *rm)
202+{
203+ return rm->channel_dlc & 0xf;
204+}
205+
206+/* return the dlc value from any received message channel_dlc field */
207+static inline int pucan_msg_get_dlc(struct pucan_rx_msg *rm)
208+{
209+ return rm->channel_dlc >> 4;
210+}
211+
212+static inline int pucan_ermsg_get_channel(struct pucan_error_msg *em)
213+{
214+ return em->channel_type_d & 0x0f;
215+}
216+
217+static inline int pucan_stmsg_get_channel(struct pucan_status_msg *sm)
218+{
219+ return sm->channel_p_w_b & 0x0f;
220+}
221+
222+#endif
drivers/net/can/usb/peak_usb/pcan_usb.c+3−1
@@ -488,6 +488,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 487 unmodified lines
488488 switch (new_state) {
489489 case CAN_STATE_BUS_OFF:
490490 cf->can_id |= CAN_ERR_BUSOFF;
491+ mc->pdev->dev.can.can_stats.bus_off++;
491492 can_bus_off(mc->netdev);
492493 break;
493494
@@ -854,10 +855,11 @@ static int pcan_usb_probe(struct usb_interface *intf) · 360 unmodified lines
854855 /*
855856 * describe the PCAN-USB adapter
856857 */
857−struct peak_usb_adapter pcan_usb = {
858+const struct peak_usb_adapter pcan_usb = {
858859 .name = "PCAN-USB",
859860 .device_id = PCAN_USB_PRODUCT_ID,
860861 .ctrl_count = 1,
862+ .ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
861863 .clock = {
862864 .freq = PCAN_USB_CRYSTAL_HZ / 2 ,
863865 },
drivers/net/can/usb/peak_usb/pcan_usb_core.c+65−18
@@ -37,16 +37,19 @@ MODULE_LICENSE("GPL v2"); · 36 unmodified lines
3737 static struct usb_device_id peak_usb_table[] = {
3838 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USB_PRODUCT_ID)},
3939 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPRO_PRODUCT_ID)},
40+ {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBFD_PRODUCT_ID)},
41+ {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPROFD_PRODUCT_ID)},
4042 {} /* Terminating entry */
4143 };
4244
4345 MODULE_DEVICE_TABLE(usb, peak_usb_table);
4446
4547 /* List of supported PCAN-USB adapters (NULL terminated list) */
46−static struct peak_usb_adapter *peak_usb_adapters_list[] = {
48+static const struct peak_usb_adapter *const peak_usb_adapters_list[] = {
4749 &pcan_usb,
4850 &pcan_usb_pro,
49− NULL,
51+ &pcan_usb_fd,
52+ &pcan_usb_pro_fd,
5053 };
5154
5255 /*
@@ -65,7 +68,7 @@ void pcan_dump_mem(char *prompt, void *p, int l) · 12 unmodified lines
6568 * initialize a time_ref object with usb adapter own settings
6669 */
6770 void peak_usb_init_time_ref(struct peak_time_ref *time_ref,
68− struct peak_usb_adapter *adapter)
71+ const struct peak_usb_adapter *adapter)
6972 {
7073 if (time_ref) {
7174 memset(time_ref, 0, sizeof(struct peak_time_ref));
@@ -164,6 +167,21 @@ void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, · 92 unmodified lines
164167 }
165168 }
166169
170+/*
171+ * post received skb after having set any hw timestamp
172+ */
173+int peak_usb_netif_rx(struct sk_buff *skb,
174+ struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high)
175+{
176+ struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
177+ struct timeval tv;
178+
179+ peak_usb_get_ts_tv(time_ref, ts_low, &tv);
180+ hwts->hwtstamp = timeval_to_ktime(tv);
181+
182+ return netif_rx(skb);
183+}
184+
167185 /*
168186 * callback for bulk Rx urb
169187 */
@@ -253,7 +271,7 @@ static void peak_usb_write_bulk_callback(struct urb *urb) · 83 unmodified lines
253271 case 0:
254272 /* transmission complete */
255273 netdev->stats.tx_packets++;
256− netdev->stats.tx_bytes += context->dlc;
274+ netdev->stats.tx_bytes += context->data_len;
257275
258276 /* prevent tx timeout */
259277 netdev->trans_start = jiffies;
@@ -289,7 +307,7 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb, · 29 unmodified lines
289307 struct peak_usb_device *dev = netdev_priv(netdev);
290308 struct peak_tx_urb_context *context = NULL;
291309 struct net_device_stats *stats = &netdev->stats;
292− struct can_frame *cf = (struct can_frame *)skb->data;
310+ struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
293311 struct urb *urb;
294312 u8 *obuf;
295313 int i, err;
@@ -322,7 +340,9 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb, · 26 unmodified lines
322340 }
323341
324342 context->echo_index = i;
325− context->dlc = cf->can_dlc;
343+
344+ /* Note: this works with CANFD frames too */
345+ context->data_len = cfd->len;
326346
327347 usb_anchor_urb(urb, &dev->tx_submitted);
328348
@@ -679,19 +699,43 @@ static int peak_usb_set_mode(struct net_device *netdev, enum can_mode mode) · 350 unmodified lines
679699 }
680700
681701 /*
682− * candev callback used to set device bitrate.
702+ * candev callback used to set device nominal/arbitration bitrate.
683703 */
684704 static int peak_usb_set_bittiming(struct net_device *netdev)
685705 {
686706 struct peak_usb_device *dev = netdev_priv(netdev);
687− struct can_bittiming *bt = &dev->can.bittiming;
707+ const struct peak_usb_adapter *pa = dev->adapter;
688708
689− if (dev->adapter->dev_set_bittiming) {
690− int err = dev->adapter->dev_set_bittiming(dev, bt);
709+ if (pa->dev_set_bittiming) {
710+ struct can_bittiming *bt = &dev->can.bittiming;
711+ int err = pa->dev_set_bittiming(dev, bt);
691712
692713 if (err)
693714 netdev_info(netdev, "couldn't set bitrate (err %d)\n",
694− err);
715+ err);
716+ return err;
717+ }
718+
719+ return 0;
720+}
721+
722+/*
723+ * candev callback used to set device data bitrate.
724+ */
725+static int peak_usb_set_data_bittiming(struct net_device *netdev)
726+{
727+ struct peak_usb_device *dev = netdev_priv(netdev);
728+ const struct peak_usb_adapter *pa = dev->adapter;
729+
730+ if (pa->dev_set_data_bittiming) {
731+ struct can_bittiming *bt = &dev->can.data_bittiming;
732+ int err = pa->dev_set_data_bittiming(dev, bt);
733+
734+ if (err)
735+ netdev_info(netdev,
736+ "couldn't set data bitrate (err %d)\n",
737+ err);
738+
695739 return err;
696740 }
697741
@@ -709,7 +753,7 @@ static const struct net_device_ops peak_usb_netdev_ops = { · 11 unmodified lines
709753 * create one device which is attached to CAN controller #ctrl_idx of the
710754 * usb adapter.
711755 */
712−static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
756+static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
713757 struct usb_interface *intf, int ctrl_idx)
714758 {
715759 struct usb_device *usb_dev = interface_to_usbdev(intf);
@@ -750,9 +794,11 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, · 34 unmodified lines
750794 dev->can.clock = peak_usb_adapter->clock;
751795 dev->can.bittiming_const = &peak_usb_adapter->bittiming_const;
752796 dev->can.do_set_bittiming = peak_usb_set_bittiming;
797+ dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const;
798+ dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming;
753799 dev->can.do_set_mode = peak_usb_set_mode;
754− dev->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
755− CAN_CTRLMODE_LISTENONLY;
800+ dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter;
801+ dev->can.ctrlmode_supported = peak_usb_adapter->ctrlmode_supported;
756802
757803 netdev->netdev_ops = &peak_usb_netdev_ops;
758804
@@ -857,17 +903,18 @@ static int peak_usb_probe(struct usb_interface *intf, · 98 unmodified lines
857903 {
858904 struct usb_device *usb_dev = interface_to_usbdev(intf);
859905 const u16 usb_id_product = le16_to_cpu(usb_dev->descriptor.idProduct);
860− struct peak_usb_adapter *peak_usb_adapter, **pp;
906+ const struct peak_usb_adapter *peak_usb_adapter = NULL;
861907 int i, err = -ENOMEM;
862908
863909 usb_dev = interface_to_usbdev(intf);
864910
865911 /* get corresponding PCAN-USB adapter */
866− for (pp = peak_usb_adapters_list; *pp; pp++)
867− if ((*pp)->device_id == usb_id_product)
912+ for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++)
913+ if (peak_usb_adapters_list[i]->device_id == usb_id_product) {
914+ peak_usb_adapter = peak_usb_adapters_list[i];
868915 break;
916+ }
869917
870− peak_usb_adapter = *pp;
871918 if (!peak_usb_adapter) {
872919 /* should never come except device_id bad usage in this file */
873920 pr_err("%s: didn't find device id. 0x%x in devices list\n",
drivers/net/can/usb/peak_usb/pcan_usb_core.h+19−7
@@ -25,6 +25,8 @@ · 24 unmodified lines
2525 /* supported device ids. */
2626 #define PCAN_USB_PRODUCT_ID 0x000c
2727 #define PCAN_USBPRO_PRODUCT_ID 0x000d
28+#define PCAN_USBPROFD_PRODUCT_ID 0x0011
29+#define PCAN_USBFD_PRODUCT_ID 0x0012
2830
2931 #define PCAN_USB_DRIVER_NAME "peak_usb"
3032
@@ -44,8 +46,10 @@ struct peak_usb_device; · 13 unmodified lines
4446 struct peak_usb_adapter {
4547 char *name;
4648 u32 device_id;
49+ u32 ctrlmode_supported;
4750 struct can_clock clock;
4851 const struct can_bittiming_const bittiming_const;
52+ const struct can_bittiming_const data_bittiming_const;
4953 unsigned int ctrl_count;
5054
5155 int (*intf_probe)(struct usb_interface *intf);
@@ -57,6 +61,8 @@ struct peak_usb_adapter { · 5 unmodified lines
5761 int (*dev_close)(struct peak_usb_device *dev);
5862 int (*dev_set_bittiming)(struct peak_usb_device *dev,
5963 struct can_bittiming *bt);
64+ int (*dev_set_data_bittiming)(struct peak_usb_device *dev,
65+ struct can_bittiming *bt);
6066 int (*dev_set_bus)(struct peak_usb_device *dev, u8 onoff);
6167 int (*dev_get_device_id)(struct peak_usb_device *dev, u32 *device_id);
6268 int (*dev_decode_buf)(struct peak_usb_device *dev, struct urb *urb);
@@ -66,6 +72,8 @@ struct peak_usb_adapter { · 3 unmodified lines
6672 int (*dev_stop)(struct peak_usb_device *dev);
6773 int (*dev_restart_async)(struct peak_usb_device *dev, struct urb *urb,
6874 u8 *buf);
75+ int (*do_get_berr_counter)(const struct net_device *netdev,
76+ struct can_berr_counter *bec);
6977 u8 ep_msg_in;
7078 u8 ep_msg_out[PCAN_USB_MAX_CHANNEL];
7179 u8 ts_used_bits;
@@ -78,21 +86,23 @@ struct peak_usb_adapter { · 6 unmodified lines
7886 int sizeof_dev_private;
7987 };
8088
81−extern struct peak_usb_adapter pcan_usb;
82−extern struct peak_usb_adapter pcan_usb_pro;
89+extern const struct peak_usb_adapter pcan_usb;
90+extern const struct peak_usb_adapter pcan_usb_pro;
91+extern const struct peak_usb_adapter pcan_usb_fd;
92+extern const struct peak_usb_adapter pcan_usb_pro_fd;
8393
8494 struct peak_time_ref {
8595 struct timeval tv_host_0, tv_host;
8696 u32 ts_dev_1, ts_dev_2;
8797 u64 ts_total;
8898 u32 tick_count;
89− struct peak_usb_adapter *adapter;
99+ const struct peak_usb_adapter *adapter;
90100 };
91101
92102 struct peak_tx_urb_context {
93103 struct peak_usb_device *dev;
94104 u32 echo_index;
95− u8 dlc;
105+ u8 data_len;
96106 struct urb *urb;
97107 };
98108
@@ -102,7 +112,7 @@ struct peak_tx_urb_context { · 3 unmodified lines
102112 /* PEAK-System USB device */
103113 struct peak_usb_device {
104114 struct can_priv can;
105− struct peak_usb_adapter *adapter;
115+ const struct peak_usb_adapter *adapter;
106116 unsigned int ctrl_idx;
107117 u32 state;
108118
@@ -134,12 +144,14 @@ void pcan_dump_mem(char *prompt, void *p, int l); · 25 unmodified lines
134144
135145 /* common timestamp management */
136146 void peak_usb_init_time_ref(struct peak_time_ref *time_ref,
137− struct peak_usb_adapter *adapter);
147+ const struct peak_usb_adapter *adapter);
138148 void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
139149 void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
140150 void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts,
141151 struct timeval *tv);
142−
152+int peak_usb_netif_rx(struct sk_buff *skb,
153+ struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high);
143154 void peak_usb_async_complete(struct urb *urb);
144155 void peak_usb_restart_complete(struct peak_usb_device *dev);
156+
145157 #endif
drivers/net/can/usb/peak_usb/pcan_usb_fd.c+1095−0
@@ -0,0 +1,1095 @@
1+/*
2+ * CAN driver for PEAK System PCAN-USB FD / PCAN-USB Pro FD adapter
3+ *
4+ * Copyright (C) 2013-2014 Stephane Grosjean <s.grosjean@peak-system.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify it
7+ * under the terms of the GNU General Public License as published
8+ * by the Free Software Foundation; version 2 of the License.
9+ *
10+ * This program is distributed in the hope that it will be useful, but
11+ * WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+ * General Public License for more details.
14+ */
15+#include <linux/netdevice.h>
16+#include <linux/usb.h>
17+#include <linux/module.h>
18+
19+#include <linux/can.h>
20+#include <linux/can/dev.h>
21+#include <linux/can/error.h>
22+
23+#include "pcan_usb_core.h"
24+#include "pcan_usb_pro.h"
25+#include "pcan_ucan.h"
26+
27+MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB FD adapter");
28+MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro FD adapter");
29+
30+#define PCAN_USBPROFD_CHANNEL_COUNT 2
31+#define PCAN_USBFD_CHANNEL_COUNT 1
32+
33+/* PCAN-USB Pro FD adapter internal clock (Hz) */
34+#define PCAN_UFD_CRYSTAL_HZ 80000000
35+
36+#define PCAN_UFD_CMD_BUFFER_SIZE 512
37+#define PCAN_UFD_LOSPD_PKT_SIZE 64
38+
39+/* PCAN-USB Pro FD command timeout (ms.) */
40+#define PCAN_UFD_CMD_TIMEOUT_MS 1000
41+
42+/* PCAN-USB Pro FD rx/tx buffers size */
43+#define PCAN_UFD_RX_BUFFER_SIZE 2048
44+#define PCAN_UFD_TX_BUFFER_SIZE 512
45+
46+/* read some versions info from the hw devcie */
47+struct __packed pcan_ufd_fw_info {
48+ __le16 size_of; /* sizeof this */
49+ __le16 type; /* type of this structure */
50+ u8 hw_type; /* Type of hardware (HW_TYPE_xxx) */
51+ u8 bl_version[3]; /* Bootloader version */
52+ u8 hw_version; /* Hardware version (PCB) */
53+ u8 fw_version[3]; /* Firmware version */
54+ __le32 dev_id[2]; /* "device id" per CAN */
55+ __le32 ser_no; /* S/N */
56+ __le32 flags; /* special functions */
57+};
58+
59+/* handle device specific info used by the netdevices */
60+struct pcan_usb_fd_if {
61+ struct peak_usb_device *dev[PCAN_USB_MAX_CHANNEL];
62+ struct pcan_ufd_fw_info fw_info;
63+ struct peak_time_ref time_ref;
64+ int cm_ignore_count;
65+ int dev_opened_count;
66+};
67+
68+/* device information */
69+struct pcan_usb_fd_device {
70+ struct peak_usb_device dev;
71+ struct can_berr_counter bec;
72+ struct pcan_usb_fd_if *usb_if;
73+ u8 *cmd_buffer_addr;
74+};
75+
76+/* Extended USB commands (non uCAN commands) */
77+
78+/* Clock Modes command */
79+#define PCAN_UFD_CMD_CLK_SET 0x80
80+
81+#define PCAN_UFD_CLK_80MHZ 0x0
82+#define PCAN_UFD_CLK_60MHZ 0x1
83+#define PCAN_UFD_CLK_40MHZ 0x2
84+#define PCAN_UFD_CLK_30MHZ 0x3
85+#define PCAN_UFD_CLK_24MHZ 0x4
86+#define PCAN_UFD_CLK_20MHZ 0x5
87+#define PCAN_UFD_CLK_DEF PCAN_UFD_CLK_80MHZ
88+
89+struct __packed pcan_ufd_clock {
90+ __le16 opcode_channel;
91+
92+ u8 mode;
93+ u8 unused[5];
94+};
95+
96+/* LED control command */
97+#define PCAN_UFD_CMD_LED_SET 0x86
98+
99+#define PCAN_UFD_LED_DEV 0x00
100+#define PCAN_UFD_LED_FAST 0x01
101+#define PCAN_UFD_LED_SLOW 0x02
102+#define PCAN_UFD_LED_ON 0x03
103+#define PCAN_UFD_LED_OFF 0x04
104+#define PCAN_UFD_LED_DEF PCAN_UFD_LED_DEV
105+
106+struct __packed pcan_ufd_led {
107+ __le16 opcode_channel;
108+
109+ u8 mode;
110+ u8 unused[5];
111+};
112+
113+/* Extended usage of uCAN commands CMD_RX_FRAME_xxxABLE for PCAN-USB Pro FD */
114+#define PCAN_UFD_FLTEXT_CALIBRATION 0x8000
115+
116+struct __packed pcan_ufd_filter_ext {
117+ __le16 opcode_channel;
118+
119+ __le16 ext_mask;
120+ u16 unused;
121+ __le16 usb_mask;
122+};
123+
124+/* Extended usage of uCAN messages for PCAN-USB Pro FD */
125+#define PCAN_UFD_MSG_CALIBRATION 0x100
126+
127+struct __packed pcan_ufd_ts_msg {
128+ __le16 size;
129+ __le16 type;
130+ __le32 ts_low;
131+ __le32 ts_high;
132+ __le16 usb_frame_index;
133+ u16 unused;
134+};
135+
136+#define PCAN_UFD_MSG_OVERRUN 0x101
137+
138+#define PCAN_UFD_OVMSG_CHANNEL(o) ((o)->channel & 0xf)
139+
140+struct __packed pcan_ufd_ovr_msg {
141+ __le16 size;
142+ __le16 type;
143+ __le32 ts_low;
144+ __le32 ts_high;
145+ u8 channel;
146+ u8 unused[3];
147+};
148+
149+static inline int pufd_omsg_get_channel(struct pcan_ufd_ovr_msg *om)
150+{
151+ return om->channel & 0xf;
152+}
153+
154+/* Clock mode frequency values */
155+static const u32 pcan_usb_fd_clk_freq[6] = {
156+ [PCAN_UFD_CLK_80MHZ] = 80000000,
157+ [PCAN_UFD_CLK_60MHZ] = 60000000,
158+ [PCAN_UFD_CLK_40MHZ] = 40000000,
159+ [PCAN_UFD_CLK_30MHZ] = 30000000,
160+ [PCAN_UFD_CLK_24MHZ] = 24000000,
161+ [PCAN_UFD_CLK_20MHZ] = 20000000
162+};
163+
164+/* return a device USB interface */
165+static inline
166+struct pcan_usb_fd_if *pcan_usb_fd_dev_if(struct peak_usb_device *dev)
167+{
168+ struct pcan_usb_fd_device *pdev =
169+ container_of(dev, struct pcan_usb_fd_device, dev);
170+ return pdev->usb_if;
171+}
172+
173+/* return a device USB commands buffer */
174+static inline void *pcan_usb_fd_cmd_buffer(struct peak_usb_device *dev)
175+{
176+ struct pcan_usb_fd_device *pdev =
177+ container_of(dev, struct pcan_usb_fd_device, dev);
178+ return pdev->cmd_buffer_addr;
179+}
180+
181+/* send PCAN-USB Pro FD commands synchronously */
182+static int pcan_usb_fd_send_cmd(struct peak_usb_device *dev, void *cmd_tail)
183+{
184+ void *cmd_head = pcan_usb_fd_cmd_buffer(dev);
185+ int err;
186+ u8 *packet_ptr;
187+ int i, n = 1, packet_len;
188+ ptrdiff_t cmd_len;
189+
190+ /* usb device unregistered? */
191+ if (!(dev->state & PCAN_USB_STATE_CONNECTED))
192+ return 0;
193+
194+ /* if a packet is not filled completely by commands, the command list
195+ * is terminated with an "end of collection" record.
196+ */
197+ cmd_len = cmd_tail - cmd_head;
198+ if (cmd_len <= (PCAN_UFD_CMD_BUFFER_SIZE - sizeof(u64))) {
199+ memset(cmd_tail, 0xff, sizeof(u64));
200+ cmd_len += sizeof(u64);
201+ }
202+
203+ packet_ptr = cmd_head;
204+
205+ /* firmware is not able to re-assemble 512 bytes buffer in full-speed */
206+ if ((dev->udev->speed != USB_SPEED_HIGH) &&
207+ (cmd_len > PCAN_UFD_LOSPD_PKT_SIZE)) {
208+ packet_len = PCAN_UFD_LOSPD_PKT_SIZE;
209+ n += cmd_len / packet_len;
210+ } else {
211+ packet_len = cmd_len;
212+ }
213+
214+ for (i = 0; i < n; i++) {
215+ err = usb_bulk_msg(dev->udev,
216+ usb_sndbulkpipe(dev->udev,
217+ PCAN_USBPRO_EP_CMDOUT),
218+ packet_ptr, packet_len,
219+ NULL, PCAN_UFD_CMD_TIMEOUT_MS);
220+ if (err) {
221+ netdev_err(dev->netdev,
222+ "sending command failure: %d\n", err);
223+ break;
224+ }
225+
226+ packet_ptr += packet_len;
227+ }
228+
229+ return err;
230+}
231+
232+/* build the commands list in the given buffer, to enter operational mode */
233+static int pcan_usb_fd_build_restart_cmd(struct peak_usb_device *dev, u8 *buf)
234+{
235+ struct pucan_wr_err_cnt *prc;
236+ struct pucan_command *cmd;
237+ u8 *pc = buf;
238+
239+ /* 1st, reset error counters: */
240+ prc = (struct pucan_wr_err_cnt *)pc;
241+ prc->opcode_channel = pucan_cmd_opcode_channel(dev,
242+ PUCAN_CMD_WR_ERR_CNT);
243+
244+ /* select both counters */
245+ prc->sel_mask = cpu_to_le16(PUCAN_WRERRCNT_TE|PUCAN_WRERRCNT_RE);
246+
247+ /* and reset their values */
248+ prc->tx_counter = 0;
249+ prc->rx_counter = 0;
250+
251+ /* moves the pointer forward */
252+ pc += sizeof(struct pucan_wr_err_cnt);
253+
254+ /* next, go back to operational mode */
255+ cmd = (struct pucan_command *)pc;
256+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
257+ (dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) ?
258+ PUCAN_CMD_LISTEN_ONLY_MODE :
259+ PUCAN_CMD_NORMAL_MODE);
260+ pc += sizeof(struct pucan_command);
261+
262+ return pc - buf;
263+}
264+
265+/* set CAN bus on/off */
266+static int pcan_usb_fd_set_bus(struct peak_usb_device *dev, u8 onoff)
267+{
268+ u8 *pc = pcan_usb_fd_cmd_buffer(dev);
269+ int l;
270+
271+ if (onoff) {
272+ /* build the cmds list to enter operational mode */
273+ l = pcan_usb_fd_build_restart_cmd(dev, pc);
274+ } else {
275+ struct pucan_command *cmd = (struct pucan_command *)pc;
276+
277+ /* build cmd to go back to reset mode */
278+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
279+ PUCAN_CMD_RESET_MODE);
280+ l = sizeof(struct pucan_command);
281+ }
282+
283+ /* send the command */
284+ return pcan_usb_fd_send_cmd(dev, pc + l);
285+}
286+
287+/* set filtering masks:
288+ *
289+ * idx in range [0..63] selects a row #idx, all rows otherwise
290+ * mask in range [0..0xffffffff] defines up to 32 CANIDs in the row(s)
291+ *
292+ * Each bit of this 64 x 32 bits array defines a CANID value:
293+ *
294+ * bit[i,j] = 1 implies that CANID=(i x 32)+j will be received, while
295+ * bit[i,j] = 0 implies that CANID=(i x 32)+j will be discarded.
296+ */
297+static int pcan_usb_fd_set_filter_std(struct peak_usb_device *dev, int idx,
298+ u32 mask)
299+{
300+ struct pucan_filter_std *cmd = pcan_usb_fd_cmd_buffer(dev);
301+ int i, n;
302+
303+ /* select all rows when idx is out of range [0..63] */
304+ if ((idx < 0) || (idx >= (1 << PUCAN_FLTSTD_ROW_IDX_BITS))) {
305+ n = 1 << PUCAN_FLTSTD_ROW_IDX_BITS;
306+ idx = 0;
307+
308+ /* select the row (and only the row) otherwise */
309+ } else {
310+ n = idx + 1;
311+ }
312+
313+ for (i = idx; i < n; i++, cmd++) {
314+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
315+ PUCAN_CMD_FILTER_STD);
316+ cmd->idx = cpu_to_le16(i);
317+ cmd->mask = cpu_to_le32(mask);
318+ }
319+
320+ /* send the command */
321+ return pcan_usb_fd_send_cmd(dev, cmd);
322+}
323+
324+/* set/unset notifications filter:
325+ *
326+ * onoff sets(1)/unset(0) notifications
327+ * mask each bit defines a kind of notification to set/unset
328+ */
329+static int pcan_usb_fd_set_filter_ext(struct peak_usb_device *dev,
330+ bool onoff, u16 ext_mask, u16 usb_mask)
331+{
332+ struct pcan_ufd_filter_ext *cmd = pcan_usb_fd_cmd_buffer(dev);
333+
334+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
335+ (onoff) ? PUCAN_CMD_RX_FRAME_ENABLE :
336+ PUCAN_CMD_RX_FRAME_DISABLE);
337+
338+ cmd->ext_mask = cpu_to_le16(ext_mask);
339+ cmd->usb_mask = cpu_to_le16(usb_mask);
340+
341+ /* send the command */
342+ return pcan_usb_fd_send_cmd(dev, ++cmd);
343+}
344+
345+/* setup LED control */
346+static int pcan_usb_fd_set_can_led(struct peak_usb_device *dev, u8 led_mode)
347+{
348+ struct pcan_ufd_led *cmd = pcan_usb_fd_cmd_buffer(dev);
349+
350+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
351+ PCAN_UFD_CMD_LED_SET);
352+ cmd->mode = led_mode;
353+
354+ /* send the command */
355+ return pcan_usb_fd_send_cmd(dev, ++cmd);
356+}
357+
358+/* set CAN clock domain */
359+static int pcan_usb_fd_set_clock_domain(struct peak_usb_device *dev,
360+ u8 clk_mode)
361+{
362+ struct pcan_ufd_clock *cmd = pcan_usb_fd_cmd_buffer(dev);
363+
364+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
365+ PCAN_UFD_CMD_CLK_SET);
366+ cmd->mode = clk_mode;
367+
368+ /* send the command */
369+ return pcan_usb_fd_send_cmd(dev, ++cmd);
370+}
371+
372+/* set bittiming for CAN and CAN-FD header */
373+static int pcan_usb_fd_set_bittiming_slow(struct peak_usb_device *dev,
374+ struct can_bittiming *bt)
375+{
376+ struct pucan_timing_slow *cmd = pcan_usb_fd_cmd_buffer(dev);
377+
378+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
379+ PUCAN_CMD_TIMING_SLOW);
380+ cmd->sjw_t = PUCAN_TSLOW_SJW_T(bt->sjw - 1,
381+ dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES);
382+
383+ cmd->tseg2 = PUCAN_TSLOW_TSEG2(bt->phase_seg2 - 1);
384+ cmd->tseg1 = PUCAN_TSLOW_TSEG1(bt->prop_seg + bt->phase_seg1 - 1);
385+ cmd->brp = cpu_to_le16(PUCAN_TSLOW_BRP(bt->brp - 1));
386+
387+ cmd->ewl = 96; /* default */
388+
389+ /* send the command */
390+ return pcan_usb_fd_send_cmd(dev, ++cmd);
391+}
392+
393+/* set CAN-FD bittiming for data */
394+static int pcan_usb_fd_set_bittiming_fast(struct peak_usb_device *dev,
395+ struct can_bittiming *bt)
396+{
397+ struct pucan_timing_fast *cmd = pcan_usb_fd_cmd_buffer(dev);
398+
399+ cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
400+ PUCAN_CMD_TIMING_FAST);
401+ cmd->sjw = PUCAN_TFAST_SJW(bt->sjw - 1);
402+ cmd->tseg2 = PUCAN_TFAST_TSEG2(bt->phase_seg2 - 1);
403+ cmd->tseg1 = PUCAN_TFAST_TSEG1(bt->prop_seg + bt->phase_seg1 - 1);
404+ cmd->brp = cpu_to_le16(PUCAN_TFAST_BRP(bt->brp - 1));
405+
406+ /* send the command */
407+ return pcan_usb_fd_send_cmd(dev, ++cmd);
408+}
409+
410+/* handle restart but in asynchronously way
411+ * (uses PCAN-USB Pro code to complete asynchronous request)
412+ */
413+static int pcan_usb_fd_restart_async(struct peak_usb_device *dev,
414+ struct urb *urb, u8 *buf)
415+{
416+ u8 *pc = buf;
417+
418+ /* build the entire cmds list in the provided buffer, to go back into
419+ * operational mode.
420+ */
421+ pc += pcan_usb_fd_build_restart_cmd(dev, pc);
422+
423+ /* add EOC */
424+ memset(pc, 0xff, sizeof(struct pucan_command));
425+ pc += sizeof(struct pucan_command);
426+
427+ /* complete the URB */
428+ usb_fill_bulk_urb(urb, dev->udev,
429+ usb_sndbulkpipe(dev->udev, PCAN_USBPRO_EP_CMDOUT),
430+ buf, pc - buf,
431+ pcan_usb_pro_restart_complete, dev);
432+
433+ /* and submit it. */
434+ return usb_submit_urb(urb, GFP_ATOMIC);
435+}
436+
437+static int pcan_usb_fd_drv_loaded(struct peak_usb_device *dev, bool loaded)
438+{
439+ struct pcan_usb_fd_device *pdev =
440+ container_of(dev, struct pcan_usb_fd_device, dev);
441+
442+ pdev->cmd_buffer_addr[0] = 0;
443+ pdev->cmd_buffer_addr[1] = !!loaded;
444+
445+ return pcan_usb_pro_send_req(dev,
446+ PCAN_USBPRO_REQ_FCT,
447+ PCAN_USBPRO_FCT_DRVLD,
448+ pdev->cmd_buffer_addr,
449+ PCAN_USBPRO_FCT_DRVLD_REQ_LEN);
450+}
451+
452+static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if,
453+ struct pucan_msg *rx_msg)
454+{
455+ struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg;
456+ struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)];
457+ struct net_device *netdev = dev->netdev;
458+ struct canfd_frame *cfd;
459+ struct sk_buff *skb;
460+ const u16 rx_msg_flags = le16_to_cpu(rm->flags);
461+
462+ if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) {
463+ /* CANFD frame case */
464+ skb = alloc_canfd_skb(netdev, &cfd);
465+ if (!skb)
466+ return -ENOMEM;
467+
468+ if (rx_msg_flags & PUCAN_MSG_BITRATE_SWITCH)
469+ cfd->flags |= CANFD_BRS;
470+
471+ if (rx_msg_flags & PUCAN_MSG_ERROR_STATE_IND)
472+ cfd->flags |= CANFD_ESI;
473+
474+ cfd->len = can_dlc2len(get_canfd_dlc(pucan_msg_get_dlc(rm)));
475+ } else {
476+ /* CAN 2.0 frame case */
477+ skb = alloc_can_skb(netdev, (struct can_frame **)&cfd);
478+ if (!skb)
479+ return -ENOMEM;
480+
481+ cfd->len = get_can_dlc(pucan_msg_get_dlc(rm));
482+ }
483+
484+ cfd->can_id = le32_to_cpu(rm->can_id);
485+
486+ if (rx_msg_flags & PUCAN_MSG_EXT_ID)
487+ cfd->can_id |= CAN_EFF_FLAG;
488+
489+ if (rx_msg_flags & PUCAN_MSG_RTR)
490+ cfd->can_id |= CAN_RTR_FLAG;
491+ else
492+ memcpy(cfd->data, rm->d, cfd->len);
493+
494+ peak_usb_netif_rx(skb, &usb_if->time_ref,
495+ le32_to_cpu(rm->ts_low), le32_to_cpu(rm->ts_high));
496+
497+ netdev->stats.rx_packets++;
498+ netdev->stats.rx_bytes += cfd->len;
499+
500+ return 0;
501+}
502+
503+/* handle uCAN status message */
504+static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
505+ struct pucan_msg *rx_msg)
506+{
507+ struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg;
508+ struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
509+ struct pcan_usb_fd_device *pdev =
510+ container_of(dev, struct pcan_usb_fd_device, dev);
511+ enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
512+ enum can_state rx_state, tx_state;
513+ struct net_device *netdev = dev->netdev;
514+ struct can_frame *cf;
515+ struct sk_buff *skb;
516+
517+ /* nothing should be sent while in BUS_OFF state */
518+ if (dev->can.state == CAN_STATE_BUS_OFF)
519+ return 0;
520+
521+ if (sm->channel_p_w_b & PUCAN_BUS_BUSOFF) {
522+ new_state = CAN_STATE_BUS_OFF;
523+ } else if (sm->channel_p_w_b & PUCAN_BUS_PASSIVE) {
524+ new_state = CAN_STATE_ERROR_PASSIVE;
525+ } else if (sm->channel_p_w_b & PUCAN_BUS_WARNING) {
526+ new_state = CAN_STATE_ERROR_WARNING;
527+ } else {
528+ /* no error bit (so, no error skb, back to active state) */
529+ dev->can.state = CAN_STATE_ERROR_ACTIVE;
530+ pdev->bec.txerr = 0;
531+ pdev->bec.rxerr = 0;
532+ return 0;
533+ }
534+
535+ /* state hasn't changed */
536+ if (new_state == dev->can.state)
537+ return 0;
538+
539+ /* handle bus state change */
540+ tx_state = (pdev->bec.txerr >= pdev->bec.rxerr) ? new_state : 0;
541+ rx_state = (pdev->bec.txerr <= pdev->bec.rxerr) ? new_state : 0;
542+
543+ /* allocate an skb to store the error frame */
544+ skb = alloc_can_err_skb(netdev, &cf);
545+ if (skb)
546+ can_change_state(netdev, cf, tx_state, rx_state);
547+
548+ /* things must be done even in case of OOM */
549+ if (new_state == CAN_STATE_BUS_OFF)
550+ can_bus_off(netdev);
551+
552+ if (!skb)
553+ return -ENOMEM;
554+
555+ peak_usb_netif_rx(skb, &usb_if->time_ref,
556+ le32_to_cpu(sm->ts_low), le32_to_cpu(sm->ts_high));
557+
558+ netdev->stats.rx_packets++;
559+ netdev->stats.rx_bytes += cf->can_dlc;
560+
561+ return 0;
562+}
563+
564+/* handle uCAN error message */
565+static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if,
566+ struct pucan_msg *rx_msg)
567+{
568+ struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg;
569+ struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)];
570+ struct pcan_usb_fd_device *pdev =
571+ container_of(dev, struct pcan_usb_fd_device, dev);
572+
573+ /* keep a trace of tx and rx error counters for later use */
574+ pdev->bec.txerr = er->tx_err_cnt;
575+ pdev->bec.rxerr = er->rx_err_cnt;
576+
577+ return 0;
578+}
579+
580+/* handle uCAN overrun message */
581+static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
582+ struct pucan_msg *rx_msg)
583+{
584+ struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg;
585+ struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)];
586+ struct net_device *netdev = dev->netdev;
587+ struct can_frame *cf;
588+ struct sk_buff *skb;
589+
590+ /* allocate an skb to store the error frame */
591+ skb = alloc_can_err_skb(netdev, &cf);
592+ if (!skb)
593+ return -ENOMEM;
594+
595+ cf->can_id |= CAN_ERR_CRTL;
596+ cf->data[1] |= CAN_ERR_CRTL_RX_OVERFLOW;
597+
598+ peak_usb_netif_rx(skb, &usb_if->time_ref,
599+ le32_to_cpu(ov->ts_low), le32_to_cpu(ov->ts_high));
600+
601+ netdev->stats.rx_over_errors++;
602+ netdev->stats.rx_errors++;
603+
604+ return 0;
605+}
606+
607+/* handle USB calibration message */
608+static void pcan_usb_fd_decode_ts(struct pcan_usb_fd_if *usb_if,
609+ struct pucan_msg *rx_msg)
610+{
611+ struct pcan_ufd_ts_msg *ts = (struct pcan_ufd_ts_msg *)rx_msg;
612+
613+ /* should wait until clock is stabilized */
614+ if (usb_if->cm_ignore_count > 0)
615+ usb_if->cm_ignore_count--;
616+ else
617+ peak_usb_set_ts_now(&usb_if->time_ref, le32_to_cpu(ts->ts_low));
618+}
619+
620+/* callback for bulk IN urb */
621+static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb)
622+{
623+ struct pcan_usb_fd_if *usb_if = pcan_usb_fd_dev_if(dev);
624+ struct net_device *netdev = dev->netdev;
625+ struct pucan_msg *rx_msg;
626+ u8 *msg_ptr, *msg_end;
627+ int err = 0;
628+
629+ /* loop reading all the records from the incoming message */
630+ msg_ptr = urb->transfer_buffer;
631+ msg_end = urb->transfer_buffer + urb->actual_length;
632+ for (; msg_ptr < msg_end;) {
633+ u16 rx_msg_type, rx_msg_size;
634+
635+ rx_msg = (struct pucan_msg *)msg_ptr;
636+ if (!rx_msg->size) {
637+ /* null packet found: end of list */
638+ break;
639+ }
640+
641+ rx_msg_size = le16_to_cpu(rx_msg->size);
642+ rx_msg_type = le16_to_cpu(rx_msg->type);
643+
644+ /* check if the record goes out of current packet */
645+ if (msg_ptr + rx_msg_size > msg_end) {
646+ netdev_err(netdev,
647+ "got frag rec: should inc usb rx buf sze\n");
648+ err = -EBADMSG;
649+ break;
650+ }
651+
652+ switch (rx_msg_type) {
653+ case PUCAN_MSG_CAN_RX:
654+ err = pcan_usb_fd_decode_canmsg(usb_if, rx_msg);
655+ if (err < 0)
656+ goto fail;
657+ break;
658+
659+ case PCAN_UFD_MSG_CALIBRATION:
660+ pcan_usb_fd_decode_ts(usb_if, rx_msg);
661+ break;
662+
663+ case PUCAN_MSG_ERROR:
664+ err = pcan_usb_fd_decode_error(usb_if, rx_msg);
665+ if (err < 0)
666+ goto fail;
667+ break;
668+
669+ case PUCAN_MSG_STATUS:
670+ err = pcan_usb_fd_decode_status(usb_if, rx_msg);
671+ if (err < 0)
672+ goto fail;
673+ break;
674+
675+ case PCAN_UFD_MSG_OVERRUN:
676+ err = pcan_usb_fd_decode_overrun(usb_if, rx_msg);
677+ if (err < 0)
678+ goto fail;
679+ break;
680+
681+ default:
682+ netdev_err(netdev,
683+ "unhandled msg type 0x%02x (%d): ignored\n",
684+ rx_msg_type, rx_msg_type);
685+ break;
686+ }
687+
688+ msg_ptr += rx_msg_size;
689+ }
690+
691+fail:
692+ if (err)
693+ pcan_dump_mem("received msg",
694+ urb->transfer_buffer, urb->actual_length);
695+ return err;
696+}
697+
698+/* CAN/CANFD frames encoding callback */
699+static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev,
700+ struct sk_buff *skb, u8 *obuf, size_t *size)
701+{
702+ struct pucan_tx_msg *tx_msg = (struct pucan_tx_msg *)obuf;
703+ struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
704+ u16 tx_msg_size, tx_msg_flags;
705+ u8 can_dlc;
706+
707+ tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4);
708+ tx_msg->size = cpu_to_le16(tx_msg_size);
709+ tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX);
710+
711+ tx_msg_flags = 0;
712+ if (cfd->can_id & CAN_EFF_FLAG) {
713+ tx_msg_flags |= PUCAN_MSG_EXT_ID;
714+ tx_msg->can_id = cpu_to_le32(cfd->can_id & CAN_EFF_MASK);
715+ } else {
716+ tx_msg->can_id = cpu_to_le32(cfd->can_id & CAN_SFF_MASK);
717+ }
718+
719+ if (can_is_canfd_skb(skb)) {
720+ /* considering a CANFD frame */
721+ can_dlc = can_len2dlc(cfd->len);
722+
723+ tx_msg_flags |= PUCAN_MSG_EXT_DATA_LEN;
724+
725+ if (cfd->flags & CANFD_BRS)
726+ tx_msg_flags |= PUCAN_MSG_BITRATE_SWITCH;
727+
728+ if (cfd->flags & CANFD_ESI)
729+ tx_msg_flags |= PUCAN_MSG_ERROR_STATE_IND;
730+ } else {
731+ /* CAND 2.0 frames */
732+ can_dlc = cfd->len;
733+
734+ if (cfd->can_id & CAN_RTR_FLAG)
735+ tx_msg_flags |= PUCAN_MSG_RTR;
736+ }
737+
738+ tx_msg->flags = cpu_to_le16(tx_msg_flags);
739+ tx_msg->channel_dlc = PUCAN_MSG_CHANNEL_DLC(dev->ctrl_idx, can_dlc);
740+ memcpy(tx_msg->d, cfd->data, cfd->len);
741+
742+ /* add null size message to tag the end (messages are 32-bits aligned)
743+ */
744+ tx_msg = (struct pucan_tx_msg *)(obuf + tx_msg_size);
745+
746+ tx_msg->size = 0;
747+
748+ /* set the whole size of the USB packet to send */
749+ *size = tx_msg_size + sizeof(u32);
750+
751+ return 0;
752+}
753+
754+/* start the interface (last chance before set bus on) */
755+static int pcan_usb_fd_start(struct peak_usb_device *dev)
756+{
757+ struct pcan_usb_fd_device *pdev =
758+ container_of(dev, struct pcan_usb_fd_device, dev);
759+ int err;
760+
761+ /* set filter mode: all acceptance */
762+ err = pcan_usb_fd_set_filter_std(dev, -1, 0xffffffff);
763+ if (err)
764+ return err;
765+
766+ /* opening first device: */
767+ if (pdev->usb_if->dev_opened_count == 0) {
768+ /* reset time_ref */
769+ peak_usb_init_time_ref(&pdev->usb_if->time_ref,
770+ &pcan_usb_pro_fd);
771+
772+ /* enable USB calibration messages */
773+ err = pcan_usb_fd_set_filter_ext(dev, 1,
774+ PUCAN_FLTEXT_ERROR,
775+ PCAN_UFD_FLTEXT_CALIBRATION);
776+ }
777+
778+ pdev->usb_if->dev_opened_count++;
779+
780+ /* reset cached error counters */
781+ pdev->bec.txerr = 0;
782+ pdev->bec.rxerr = 0;
783+
784+ return err;
785+}
786+
787+/* socket callback used to copy berr counters values receieved through USB */
788+static int pcan_usb_fd_get_berr_counter(const struct net_device *netdev,
789+ struct can_berr_counter *bec)
790+{
791+ struct peak_usb_device *dev = netdev_priv(netdev);
792+ struct pcan_usb_fd_device *pdev =
793+ container_of(dev, struct pcan_usb_fd_device, dev);
794+
795+ *bec = pdev->bec;
796+
797+ /* must return 0 */
798+ return 0;
799+}
800+
801+/* stop interface (last chance before set bus off) */
802+static int pcan_usb_fd_stop(struct peak_usb_device *dev)
803+{
804+ struct pcan_usb_fd_device *pdev =
805+ container_of(dev, struct pcan_usb_fd_device, dev);
806+
807+ /* turn off special msgs for that interface if no other dev opened */
808+ if (pdev->usb_if->dev_opened_count == 1)
809+ pcan_usb_fd_set_filter_ext(dev, 0,
810+ PUCAN_FLTEXT_ERROR,
811+ PCAN_UFD_FLTEXT_CALIBRATION);
812+ pdev->usb_if->dev_opened_count--;
813+
814+ return 0;
815+}
816+
817+/* called when probing, to initialize a device object */
818+static int pcan_usb_fd_init(struct peak_usb_device *dev)
819+{
820+ struct pcan_usb_fd_device *pdev =
821+ container_of(dev, struct pcan_usb_fd_device, dev);
822+ int i, err = -ENOMEM;
823+
824+ /* do this for 1st channel only */
825+ if (!dev->prev_siblings) {
826+ /* allocate netdevices common structure attached to first one */
827+ pdev->usb_if = kzalloc(sizeof(*pdev->usb_if), GFP_KERNEL);
828+ if (!pdev->usb_if)
829+ goto err_out;
830+
831+ /* allocate command buffer once for all for the interface */
832+ pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE,
833+ GFP_KERNEL);
834+ if (!pdev->cmd_buffer_addr)
835+ goto err_out_1;
836+
837+ /* number of ts msgs to ignore before taking one into account */
838+ pdev->usb_if->cm_ignore_count = 5;
839+
840+ err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO,
841+ PCAN_USBPRO_INFO_FW,
842+ &pdev->usb_if->fw_info,
843+ sizeof(pdev->usb_if->fw_info));
844+ if (err) {
845+ dev_err(dev->netdev->dev.parent,
846+ "unable to read %s firmware info (err %d)\n",
847+ dev->adapter->name, err);
848+ goto err_out_2;
849+ }
850+
851+ /* explicit use of dev_xxx() instead of netdev_xxx() here:
852+ * information displayed are related to the device itself, not
853+ * to the canx (channel) device.
854+ */
855+ dev_info(dev->netdev->dev.parent,
856+ "PEAK-System %s v%u fw v%u.%u.%u (%u channels)\n",
857+ dev->adapter->name, pdev->usb_if->fw_info.hw_version,
858+ pdev->usb_if->fw_info.fw_version[0],
859+ pdev->usb_if->fw_info.fw_version[1],
860+ pdev->usb_if->fw_info.fw_version[2],
861+ dev->adapter->ctrl_count);
862+
863+ /* the currently supported hw is non-ISO */
864+ dev->can.ctrlmode = CAN_CTRLMODE_FD_NON_ISO;
865+
866+ /* tell the hardware the can driver is running */
867+ err = pcan_usb_fd_drv_loaded(dev, 1);
868+ if (err) {
869+ dev_err(dev->netdev->dev.parent,
870+ "unable to tell %s driver is loaded (err %d)\n",
871+ dev->adapter->name, err);
872+ goto err_out_2;
873+ }
874+ } else {
875+ /* otherwise, simply copy previous sibling's values */
876+ struct pcan_usb_fd_device *ppdev =
877+ container_of(dev->prev_siblings,
878+ struct pcan_usb_fd_device, dev);
879+
880+ pdev->usb_if = ppdev->usb_if;
881+ pdev->cmd_buffer_addr = ppdev->cmd_buffer_addr;
882+ }
883+
884+ pdev->usb_if->dev[dev->ctrl_idx] = dev;
885+ dev->device_number =
886+ le32_to_cpu(pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]);
887+
888+ /* set clock domain */
889+ for (i = 0; i < ARRAY_SIZE(pcan_usb_fd_clk_freq); i++)
890+ if (dev->adapter->clock.freq == pcan_usb_fd_clk_freq[i])
891+ break;
892+
893+ if (i >= ARRAY_SIZE(pcan_usb_fd_clk_freq)) {
894+ dev_warn(dev->netdev->dev.parent,
895+ "incompatible clock frequencies\n");
896+ err = -EINVAL;
897+ goto err_out_2;
898+ }
899+
900+ pcan_usb_fd_set_clock_domain(dev, i);
901+
902+ /* set LED in default state (end of init phase) */
903+ pcan_usb_fd_set_can_led(dev, PCAN_UFD_LED_DEF);
904+
905+ return 0;
906+
907+err_out_2:
908+ kfree(pdev->cmd_buffer_addr);
909+err_out_1:
910+ kfree(pdev->usb_if);
911+err_out:
912+ return err;
913+}
914+
915+/* called when driver module is being unloaded */
916+static void pcan_usb_fd_exit(struct peak_usb_device *dev)
917+{
918+ struct pcan_usb_fd_device *pdev =
919+ container_of(dev, struct pcan_usb_fd_device, dev);
920+
921+ /* when rmmod called before unplug and if down, should reset things
922+ * before leaving
923+ */
924+ if (dev->can.state != CAN_STATE_STOPPED) {
925+ /* set bus off on the corresponding channel */
926+ pcan_usb_fd_set_bus(dev, 0);
927+ }
928+
929+ /* switch off corresponding CAN LEDs */
930+ pcan_usb_fd_set_can_led(dev, PCAN_UFD_LED_OFF);
931+
932+ /* if channel #0 (only) */
933+ if (dev->ctrl_idx == 0) {
934+ /* turn off calibration message if any device were opened */
935+ if (pdev->usb_if->dev_opened_count > 0)
936+ pcan_usb_fd_set_filter_ext(dev, 0,
937+ PUCAN_FLTEXT_ERROR,
938+ PCAN_UFD_FLTEXT_CALIBRATION);
939+
940+ /* tell USB adapter that the driver is being unloaded */
941+ pcan_usb_fd_drv_loaded(dev, 0);
942+ }
943+}
944+
945+/* called when the USB adapter is unplugged */
946+static void pcan_usb_fd_free(struct peak_usb_device *dev)
947+{
948+ /* last device: can free shared objects now */
949+ if (!dev->prev_siblings && !dev->next_siblings) {
950+ struct pcan_usb_fd_device *pdev =
951+ container_of(dev, struct pcan_usb_fd_device, dev);
952+
953+ /* free commands buffer */
954+ kfree(pdev->cmd_buffer_addr);
955+
956+ /* free usb interface object */
957+ kfree(pdev->usb_if);
958+ }
959+}
960+
961+/* describes the PCAN-USB FD adapter */
962+const struct peak_usb_adapter pcan_usb_fd = {
963+ .name = "PCAN-USB FD",
964+ .device_id = PCAN_USBFD_PRODUCT_ID,
965+ .ctrl_count = PCAN_USBFD_CHANNEL_COUNT,
966+ .ctrlmode_supported = CAN_CTRLMODE_FD |
967+ CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
968+ .clock = {
969+ .freq = PCAN_UFD_CRYSTAL_HZ,
970+ },
971+ .bittiming_const = {
972+ .name = "pcan_usb_fd",
973+ .tseg1_min = 1,
974+ .tseg1_max = 64,
975+ .tseg2_min = 1,
976+ .tseg2_max = 16,
977+ .sjw_max = 16,
978+ .brp_min = 1,
979+ .brp_max = 1024,
980+ .brp_inc = 1,
981+ },
982+ .data_bittiming_const = {
983+ .name = "pcan_usb_fd",
984+ .tseg1_min = 1,
985+ .tseg1_max = 16,
986+ .tseg2_min = 1,
987+ .tseg2_max = 8,
988+ .sjw_max = 4,
989+ .brp_min = 1,
990+ .brp_max = 1024,
991+ .brp_inc = 1,
992+ },
993+
994+ /* size of device private data */
995+ .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
996+
997+ /* timestamps usage */
998+ .ts_used_bits = 32,
999+ .ts_period = 1000000, /* calibration period in ts. */
1000+ .us_per_ts_scale = 1, /* us = (ts * scale) >> shift */
1001+ .us_per_ts_shift = 0,
1002+
1003+ /* give here messages in/out endpoints */
1004+ .ep_msg_in = PCAN_USBPRO_EP_MSGIN,
1005+ .ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0},
1006+
1007+ /* size of rx/tx usb buffers */
1008+ .rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE,
1009+ .tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE,
1010+
1011+ /* device callbacks */
1012+ .intf_probe = pcan_usb_pro_probe, /* same as PCAN-USB Pro */
1013+ .dev_init = pcan_usb_fd_init,
1014+
1015+ .dev_exit = pcan_usb_fd_exit,
1016+ .dev_free = pcan_usb_fd_free,
1017+ .dev_set_bus = pcan_usb_fd_set_bus,
1018+ .dev_set_bittiming = pcan_usb_fd_set_bittiming_slow,
1019+ .dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast,
1020+ .dev_decode_buf = pcan_usb_fd_decode_buf,
1021+ .dev_start = pcan_usb_fd_start,
1022+ .dev_stop = pcan_usb_fd_stop,
1023+ .dev_restart_async = pcan_usb_fd_restart_async,
1024+ .dev_encode_msg = pcan_usb_fd_encode_msg,
1025+
1026+ .do_get_berr_counter = pcan_usb_fd_get_berr_counter,
1027+};
1028+
1029+/* describes the PCAN-USB Pro FD adapter */
1030+const struct peak_usb_adapter pcan_usb_pro_fd = {
1031+ .name = "PCAN-USB Pro FD",
1032+ .device_id = PCAN_USBPROFD_PRODUCT_ID,
1033+ .ctrl_count = PCAN_USBPROFD_CHANNEL_COUNT,
1034+ .ctrlmode_supported = CAN_CTRLMODE_FD |
1035+ CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
1036+ .clock = {
1037+ .freq = PCAN_UFD_CRYSTAL_HZ,
1038+ },
1039+ .bittiming_const = {
1040+ .name = "pcan_usb_pro_fd",
1041+ .tseg1_min = 1,
1042+ .tseg1_max = 64,
1043+ .tseg2_min = 1,
1044+ .tseg2_max = 16,
1045+ .sjw_max = 16,
1046+ .brp_min = 1,
1047+ .brp_max = 1024,
1048+ .brp_inc = 1,
1049+ },
1050+ .data_bittiming_const = {
1051+ .name = "pcan_usb_pro_fd",
1052+ .tseg1_min = 1,
1053+ .tseg1_max = 16,
1054+ .tseg2_min = 1,
1055+ .tseg2_max = 8,
1056+ .sjw_max = 4,
1057+ .brp_min = 1,
1058+ .brp_max = 1024,
1059+ .brp_inc = 1,
1060+ },
1061+
1062+ /* size of device private data */
1063+ .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
1064+
1065+ /* timestamps usage */
1066+ .ts_used_bits = 32,
1067+ .ts_period = 1000000, /* calibration period in ts. */
1068+ .us_per_ts_scale = 1, /* us = (ts * scale) >> shift */
1069+ .us_per_ts_shift = 0,
1070+
1071+ /* give here messages in/out endpoints */
1072+ .ep_msg_in = PCAN_USBPRO_EP_MSGIN,
1073+ .ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0, PCAN_USBPRO_EP_MSGOUT_1},
1074+
1075+ /* size of rx/tx usb buffers */
1076+ .rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE,
1077+ .tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE,
1078+
1079+ /* device callbacks */
1080+ .intf_probe = pcan_usb_pro_probe, /* same as PCAN-USB Pro */
1081+ .dev_init = pcan_usb_fd_init,
1082+
1083+ .dev_exit = pcan_usb_fd_exit,
1084+ .dev_free = pcan_usb_fd_free,
1085+ .dev_set_bus = pcan_usb_fd_set_bus,
1086+ .dev_set_bittiming = pcan_usb_fd_set_bittiming_slow,
1087+ .dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast,
1088+ .dev_decode_buf = pcan_usb_fd_decode_buf,
1089+ .dev_start = pcan_usb_fd_start,
1090+ .dev_stop = pcan_usb_fd_stop,
1091+ .dev_restart_async = pcan_usb_fd_restart_async,
1092+ .dev_encode_msg = pcan_usb_fd_encode_msg,
1093+
1094+ .do_get_berr_counter = pcan_usb_fd_get_berr_counter,
1095+};
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+7−13
@@ -27,14 +27,6 @@ · 26 unmodified lines
2727
2828 MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter");
2929
30−/* PCAN-USB Pro Endpoints */
31−#define PCAN_USBPRO_EP_CMDOUT 1
32−#define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN)
33−#define PCAN_USBPRO_EP_MSGOUT_0 2
34−#define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN)
35−#define PCAN_USBPRO_EP_MSGOUT_1 3
36−#define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN)
37−
3830 #define PCAN_USBPRO_CHANNEL_COUNT 2
3931
4032 /* PCAN-USB Pro adapter internal clock (MHz) */
@@ -322,8 +314,8 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev, · 281 unmodified lines
322314 return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err;
323315 }
324316
325−static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
326− int req_value, void *req_addr, int req_size)
317+int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
318+ int req_value, void *req_addr, int req_size)
327319 {
328320 int err;
329321 u8 req_type;
@@ -475,7 +467,7 @@ static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev, · 145 unmodified lines
475467 return pcan_usb_pro_set_bitrate(dev, ccbt);
476468 }
477469
478−static void pcan_usb_pro_restart_complete(struct urb *urb)
470+void pcan_usb_pro_restart_complete(struct urb *urb)
479471 {
480472 /* can delete usb resources */
481473 peak_usb_async_complete(urb);
@@ -634,6 +626,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, · 152 unmodified lines
634626 switch (new_state) {
635627 case CAN_STATE_BUS_OFF:
636628 can_frame->can_id |= CAN_ERR_BUSOFF;
629+ dev->can.can_stats.bus_off++;
637630 can_bus_off(netdev);
638631 break;
639632
@@ -977,7 +970,7 @@ static void pcan_usb_pro_free(struct peak_usb_device *dev) · 337 unmodified lines
977970 /*
978971 * probe function for new PCAN-USB Pro usb interface
979972 */
980−static int pcan_usb_pro_probe(struct usb_interface *intf)
973+int pcan_usb_pro_probe(struct usb_interface *intf)
981974 {
982975 struct usb_host_interface *if_desc;
983976 int i;
@@ -1011,10 +1004,11 @@ static int pcan_usb_pro_probe(struct usb_interface *intf) · 27 unmodified lines
10111004 /*
10121005 * describe the PCAN-USB Pro adapter
10131006 */
1014−struct peak_usb_adapter pcan_usb_pro = {
1007+const struct peak_usb_adapter pcan_usb_pro = {
10151008 .name = "PCAN-USB Pro",
10161009 .device_id = PCAN_USBPRO_PRODUCT_ID,
10171010 .ctrl_count = PCAN_USBPRO_CHANNEL_COUNT,
1011+ .ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
10181012 .clock = {
10191013 .freq = PCAN_USBPRO_CRYSTAL_HZ,
10201014 },
drivers/net/can/usb/peak_usb/pcan_usb_pro.h+13−0
@@ -27,6 +27,14 @@ · 26 unmodified lines
2727 #define PCAN_USBPRO_INFO_BL 0
2828 #define PCAN_USBPRO_INFO_FW 1
2929
30+/* PCAN-USB Pro (FD) Endpoints */
31+#define PCAN_USBPRO_EP_CMDOUT 1
32+#define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN)
33+#define PCAN_USBPRO_EP_MSGOUT_0 2
34+#define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN)
35+#define PCAN_USBPRO_EP_MSGOUT_1 3
36+#define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN)
37+
3038 /* Vendor Request value for XXX_FCT */
3139 #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */
3240 #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16
@@ -176,4 +184,9 @@ union pcan_usb_pro_rec { · 143 unmodified lines
176184 struct pcan_usb_pro_txmsg tx_msg;
177185 };
178186
187+int pcan_usb_pro_probe(struct usb_interface *intf);
188+int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
189+ int req_value, void *req_addr, int req_size);
190+void pcan_usb_pro_restart_complete(struct urb *urb);
191+
179192 #endif
drivers/net/can/usb/usb_8dev.c+1−0
@@ -377,6 +377,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, · 376 unmodified lines
377377 case USB_8DEV_STATUSMSG_BUSOFF:
378378 priv->can.state = CAN_STATE_BUS_OFF;
379379 cf->can_id |= CAN_ERR_BUSOFF;
380+ priv->can.can_stats.bus_off++;
380381 can_bus_off(priv->netdev);
381382 break;
382383 case USB_8DEV_STATUSMSG_OVERRUN:
drivers/net/dsa/bcm_sf2.c+64−24
@@ -233,6 +233,35 @@ static void bcm_sf2_eee_enable_set(struct dsa_switch *ds, int port, bool enable) · 232 unmodified lines
233233 core_writel(priv, reg, CORE_EEE_EN_CTRL);
234234 }
235235
236+static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)
237+{
238+ struct bcm_sf2_priv *priv = ds_to_priv(ds);
239+ u32 reg;
240+
241+ reg = reg_readl(priv, REG_SPHY_CNTRL);
242+ if (enable) {
243+ reg |= PHY_RESET;
244+ reg &= ~(EXT_PWR_DOWN | IDDQ_BIAS | CK25_DIS);
245+ reg_writel(priv, reg, REG_SPHY_CNTRL);
246+ udelay(21);
247+ reg = reg_readl(priv, REG_SPHY_CNTRL);
248+ reg &= ~PHY_RESET;
249+ } else {
250+ reg |= EXT_PWR_DOWN | IDDQ_BIAS | PHY_RESET;
251+ reg_writel(priv, reg, REG_SPHY_CNTRL);
252+ mdelay(1);
253+ reg |= CK25_DIS;
254+ }
255+ reg_writel(priv, reg, REG_SPHY_CNTRL);
256+
257+ /* Use PHY-driven LED signaling */
258+ if (!enable) {
259+ reg = reg_readl(priv, REG_LED_CNTRL(0));
260+ reg |= SPDLNK_SRC_SEL;
261+ reg_writel(priv, reg, REG_LED_CNTRL(0));
262+ }
263+}
264+
236265 static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
237266 struct phy_device *phy)
238267 {
@@ -248,6 +277,24 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, · 9 unmodified lines
248277 /* Clear the Rx and Tx disable bits and set to no spanning tree */
249278 core_writel(priv, 0, CORE_G_PCTL_PORT(port));
250279
280+ /* Re-enable the GPHY and re-apply workarounds */
281+ if (port == 0 && priv->hw_params.num_gphy == 1) {
282+ bcm_sf2_gphy_enable_set(ds, true);
283+ if (phy) {
284+ /* if phy_stop() has been called before, phy
285+ * will be in halted state, and phy_start()
286+ * will call resume.
287+ *
288+ * the resume path does not configure back
289+ * autoneg settings, and since we hard reset
290+ * the phy manually here, we need to reset the
291+ * state machine also.
292+ */
293+ phy->state = PHY_READY;
294+ phy_init_hw(phy);
295+ }
296+ }
297+
251298 /* Enable port 7 interrupts to get notified */
252299 if (port == 7)
253300 intrl2_1_mask_clear(priv, P_IRQ_MASK(P7_IRQ_OFF));
@@ -281,6 +328,9 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, · 27 unmodified lines
281328 intrl2_1_writel(priv, P_IRQ_MASK(P7_IRQ_OFF), INTRL2_CPU_CLEAR);
282329 }
283330
331+ if (port == 0 && priv->hw_params.num_gphy == 1)
332+ bcm_sf2_gphy_enable_set(ds, false);
333+
284334 if (dsa_is_cpu_port(ds, port))
285335 off = CORE_IMP_CTL;
286336 else
@@ -400,6 +450,16 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) · 113 unmodified lines
400450 return 0;
401451 }
402452
453+static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv)
454+{
455+ intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
456+ intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
457+ intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
458+ intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
459+ intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
460+ intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
461+}
462+
403463 static int bcm_sf2_sw_setup(struct dsa_switch *ds)
404464 {
405465 const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME;
@@ -440,12 +500,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) · 34 unmodified lines
440500 }
441501
442502 /* Disable all interrupts and request them */
443− intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
444− intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
445− intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
446− intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
447− intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
448− intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
503+ bcm_sf2_intr_disable(priv);
449504
450505 ret = request_irq(priv->irq0, bcm_sf2_switch_0_isr, 0,
451506 "switch_0", priv);
@@ -747,12 +802,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) · 295 unmodified lines
747802 struct bcm_sf2_priv *priv = ds_to_priv(ds);
748803 unsigned int port;
749804
750− intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
751− intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
752− intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
753− intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
754− intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
755− intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
805+ bcm_sf2_intr_disable(priv);
756806
757807 /* Disable all ports physically present including the IMP
758808 * port, the other ones have already been disabled during
@@ -771,7 +821,6 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) · 12 unmodified lines
771821 {
772822 struct bcm_sf2_priv *priv = ds_to_priv(ds);
773823 unsigned int port;
774− u32 reg;
775824 int ret;
776825
777826 ret = bcm_sf2_sw_rst(priv);
@@ -780,17 +829,8 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) · 2 unmodified lines
780829 return ret;
781830 }
782831
783− /* Reinitialize the single GPHY */
784− if (priv->hw_params.num_gphy == 1) {
785− reg = reg_readl(priv, REG_SPHY_CNTRL);
786− reg |= PHY_RESET;
787− reg &= ~(EXT_PWR_DOWN | IDDQ_BIAS);
788− reg_writel(priv, reg, REG_SPHY_CNTRL);
789− udelay(21);
790− reg = reg_readl(priv, REG_SPHY_CNTRL);
791− reg &= ~PHY_RESET;
792− reg_writel(priv, reg, REG_SPHY_CNTRL);
793− }
832+ if (priv->hw_params.num_gphy == 1)
833+ bcm_sf2_gphy_enable_set(ds, true);
794834
795835 for (port = 0; port < DSA_MAX_PORTS; port++) {
796836 if ((1 << port) & ds->phys_port_mask)
drivers/net/dsa/bcm_sf2_regs.h+4−0
@@ -61,6 +61,10 @@ · 60 unmodified lines
6161 #define LPI_COUNT_SHIFT 9
6262 #define LPI_COUNT_MASK 0x3F
6363
64+#define REG_LED_CNTRL_BASE 0x90
65+#define REG_LED_CNTRL(x) (REG_LED_CNTRL_BASE + (x) * 4)
66+#define SPDLNK_SRC_SEL (1 << 24)
67+
6468 /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */
6569 #define INTRL2_CPU_STATUS 0x00
6670 #define INTRL2_CPU_SET 0x04
drivers/net/dsa/mv88e6131.c+2−1
@@ -139,7 +139,8 @@ static int mv88e6131_setup_global(struct dsa_switch *ds) · 138 unmodified lines
139139 int nexthop;
140140
141141 nexthop = 0x1f;
142− if (i != ds->index && i < ds->dst->pd->nr_chips)
142+ if (ds->pd->rtable &&
143+ i != ds->index && i < ds->dst->pd->nr_chips)
143144 nexthop = ds->pd->rtable[i] & 0x1f;
144145
145146 REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop);
drivers/net/dsa/mv88e6352.c+5−8
@@ -22,17 +22,14 @@ · 21 unmodified lines
2222 #include <net/dsa.h>
2323 #include "mv88e6xxx.h"
2424
25−static int mv88e6352_wait(struct dsa_switch *ds, int reg, u16 mask)
25+static int mv88e6352_wait(struct dsa_switch *ds, int reg, int offset, u16 mask)
2626 {
2727 unsigned long timeout = jiffies + HZ / 10;
2828
2929 while (time_before(jiffies, timeout)) {
3030 int ret;
3131
32− ret = REG_READ(REG_GLOBAL2, reg);
33− if (ret < 0)
34− return ret;
35−
32+ ret = REG_READ(reg, offset);
3633 if (!(ret & mask))
3734 return 0;
3835
@@ -43,17 +40,17 @@ static int mv88e6352_wait(struct dsa_switch *ds, int reg, u16 mask) · 4 unmodified lines
4340
4441 static inline int mv88e6352_phy_wait(struct dsa_switch *ds)
4542 {
46− return mv88e6352_wait(ds, 0x18, 0x8000);
43+ return mv88e6352_wait(ds, REG_GLOBAL2, 0x18, 0x8000);
4744 }
4845
4946 static inline int mv88e6352_eeprom_load_wait(struct dsa_switch *ds)
5047 {
51− return mv88e6352_wait(ds, 0x14, 0x0800);
48+ return mv88e6352_wait(ds, REG_GLOBAL2, 0x14, 0x0800);
5249 }
5350
5451 static inline int mv88e6352_eeprom_busy_wait(struct dsa_switch *ds)
5552 {
56− return mv88e6352_wait(ds, 0x14, 0x8000);
53+ return mv88e6352_wait(ds, REG_GLOBAL2, 0x14, 0x8000);
5754 }
5855
5956 static int __mv88e6352_phy_read(struct dsa_switch *ds, int addr, int regnum)
drivers/net/dsa/mv88e6xxx.c+9−0
@@ -85,6 +85,12 @@ int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg) · 84 unmodified lines
8585 ret = __mv88e6xxx_reg_read(bus, ds->pd->sw_addr, addr, reg);
8686 mutex_unlock(&ps->smi_mutex);
8787
88+ if (ret < 0)
89+ return ret;
90+
91+ dev_dbg(ds->master_dev, "<- addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n",
92+ addr, reg, ret);
93+
8894 return ret;
8995 }
9096
@@ -128,6 +134,9 @@ int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val) · 37 unmodified lines
128134 if (bus == NULL)
129135 return -EINVAL;
130136
137+ dev_dbg(ds->master_dev, "-> addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n",
138+ addr, reg, val);
139+
131140 mutex_lock(&ps->smi_mutex);
132141 ret = __mv88e6xxx_reg_write(bus, ds->pd->sw_addr, addr, reg, val);
133142 mutex_unlock(&ps->smi_mutex);
drivers/net/ethernet/3com/typhoon.c+2−2
@@ -769,11 +769,11 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) · 768 unmodified lines
769769 first_txd->processFlags |= TYPHOON_TX_PF_IP_CHKSUM;
770770 }
771771
772− if(vlan_tx_tag_present(skb)) {
772+ if (skb_vlan_tag_present(skb)) {
773773 first_txd->processFlags |=
774774 TYPHOON_TX_PF_INSERT_VLAN | TYPHOON_TX_PF_VLAN_PRIORITY;
775775 first_txd->processFlags |=
776− cpu_to_le32(htons(vlan_tx_tag_get(skb)) <<
776+ cpu_to_le32(htons(skb_vlan_tag_get(skb)) <<
777777 TYPHOON_TX_PF_VLAN_TAG_SHIFT);
778778 }
779779
drivers/net/ethernet/alteon/acenic.c+4−4
@@ -2429,9 +2429,9 @@ restart: · 2428 unmodified lines
24292429 flagsize = (skb->len << 16) | (BD_FLG_END);
24302430 if (skb->ip_summed == CHECKSUM_PARTIAL)
24312431 flagsize |= BD_FLG_TCP_UDP_SUM;
2432− if (vlan_tx_tag_present(skb)) {
2432+ if (skb_vlan_tag_present(skb)) {
24332433 flagsize |= BD_FLG_VLAN_TAG;
2434− vlan_tag = vlan_tx_tag_get(skb);
2434+ vlan_tag = skb_vlan_tag_get(skb);
24352435 }
24362436 desc = ap->tx_ring + idx;
24372437 idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap);
@@ -2450,9 +2450,9 @@ restart: · 12 unmodified lines
24502450 flagsize = (skb_headlen(skb) << 16);
24512451 if (skb->ip_summed == CHECKSUM_PARTIAL)
24522452 flagsize |= BD_FLG_TCP_UDP_SUM;
2453− if (vlan_tx_tag_present(skb)) {
2453+ if (skb_vlan_tag_present(skb)) {
24542454 flagsize |= BD_FLG_VLAN_TAG;
2455− vlan_tag = vlan_tx_tag_get(skb);
2455+ vlan_tag = skb_vlan_tag_get(skb);
24562456 }
24572457
24582458 ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag);
drivers/net/ethernet/amd/Kconfig+1−1
@@ -179,7 +179,7 @@ config SUNLANCE · 178 unmodified lines
179179
180180 config AMD_XGBE
181181 tristate "AMD 10GbE Ethernet driver"
182− depends on OF_NET && HAS_IOMEM
182+ depends on (OF_NET || ACPI) && HAS_IOMEM
183183 select PHYLIB
184184 select AMD_XGBE_PHY
185185 select BITREVERSE
drivers/net/ethernet/amd/amd8111e.c+2−2
@@ -1299,11 +1299,11 @@ static netdev_tx_t amd8111e_start_xmit(struct sk_buff *skb, · 1298 unmodified lines
12991299 lp->tx_ring[tx_index].tx_flags = 0;
13001300
13011301 #if AMD8111E_VLAN_TAG_USED
1302− if (vlan_tx_tag_present(skb)) {
1302+ if (skb_vlan_tag_present(skb)) {
13031303 lp->tx_ring[tx_index].tag_ctrl_cmd |=
13041304 cpu_to_le16(TCC_VLAN_INSERT);
13051305 lp->tx_ring[tx_index].tag_ctrl_info =
1306− cpu_to_le16(vlan_tx_tag_get(skb));
1306+ cpu_to_le16(skb_vlan_tag_get(skb));
13071307
13081308 }
13091309 #endif
drivers/net/ethernet/amd/pcnet32.c+1−1
@@ -2806,7 +2806,7 @@ static void pcnet32_check_media(struct net_device *dev, int verbose) · 2805 unmodified lines
28062806
28072807 /*
28082808 * Check for loss of link and link establishment.
2809− * Can not use mii_check_media because it does nothing if mode is forced.
2809+ * Could possibly be changed to use mii_check_media instead.
28102810 */
28112811
28122812 static void pcnet32_watchdog(struct net_device *dev)
drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c+1−1
@@ -328,7 +328,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata) · 327 unmodified lines
328328
329329 buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name);
330330 pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
331− if (pdata->xgbe_debugfs == NULL) {
331+ if (!pdata->xgbe_debugfs) {
332332 netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
333333 return;
334334 }
drivers/net/ethernet/amd/xgbe/xgbe-desc.c+1−31
@@ -422,7 +422,6 @@ static void xgbe_wrapper_rx_descriptor_init(struct xgbe_prv_data *pdata) · 421 unmodified lines
422422
423423 ring->cur = 0;
424424 ring->dirty = 0;
425− memset(&ring->rx, 0, sizeof(ring->rx));
426425
427426 hw_if->rx_desc_init(channel);
428427 }
@@ -621,35 +620,6 @@ err_out: · 192 unmodified lines
621620 return 0;
622621 }
623622
624−static void xgbe_realloc_rx_buffer(struct xgbe_channel *channel)
625−{
626− struct xgbe_prv_data *pdata = channel->pdata;
627− struct xgbe_hw_if *hw_if = &pdata->hw_if;
628− struct xgbe_ring *ring = channel->rx_ring;
629− struct xgbe_ring_data *rdata;
630− int i;
631−
632− DBGPR("-->xgbe_realloc_rx_buffer: rx_ring->rx.realloc_index = %u\n",
633− ring->rx.realloc_index);
634−
635− for (i = 0; i < ring->dirty; i++) {
636− rdata = XGBE_GET_DESC_DATA(ring, ring->rx.realloc_index);
637−
638− /* Reset rdata values */
639− xgbe_unmap_rdata(pdata, rdata);
640−
641− if (xgbe_map_rx_buffer(pdata, ring, rdata))
642− break;
643−
644− hw_if->rx_desc_reset(rdata);
645−
646− ring->rx.realloc_index++;
647− }
648− ring->dirty = 0;
649−
650− DBGPR("<--xgbe_realloc_rx_buffer\n");
651−}
652−
653623 void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *desc_if)
654624 {
655625 DBGPR("-->xgbe_init_function_ptrs_desc\n");
@@ -657,7 +627,7 @@ void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *desc_if) · 1 unmodified line
657627 desc_if->alloc_ring_resources = xgbe_alloc_ring_resources;
658628 desc_if->free_ring_resources = xgbe_free_ring_resources;
659629 desc_if->map_tx_skb = xgbe_map_tx_skb;
660− desc_if->realloc_rx_buffer = xgbe_realloc_rx_buffer;
630+ desc_if->map_rx_buffer = xgbe_map_rx_buffer;
661631 desc_if->unmap_rdata = xgbe_unmap_rdata;
662632 desc_if->wrapper_tx_desc_init = xgbe_wrapper_tx_descriptor_init;
663633 desc_if->wrapper_rx_desc_init = xgbe_wrapper_rx_descriptor_init;
drivers/net/ethernet/amd/xgbe/xgbe-dev.c+56−10
@@ -115,6 +115,7 @@ · 114 unmodified lines
115115 */
116116
117117 #include <linux/phy.h>
118+#include <linux/mdio.h>
118119 #include <linux/clk.h>
119120 #include <linux/bitrev.h>
120121 #include <linux/crc32.h>
@@ -130,7 +131,7 @@ static unsigned int xgbe_usec_to_riwt(struct xgbe_prv_data *pdata, · 9 unmodified lines
130131
131132 DBGPR("-->xgbe_usec_to_riwt\n");
132133
133− rate = clk_get_rate(pdata->sysclk);
134+ rate = pdata->sysclk_rate;
134135
135136 /*
136137 * Convert the input usec value to the watchdog timer value. Each
@@ -153,7 +154,7 @@ static unsigned int xgbe_riwt_to_usec(struct xgbe_prv_data *pdata, · 16 unmodified lines
153154
154155 DBGPR("-->xgbe_riwt_to_usec\n");
155156
156− rate = clk_get_rate(pdata->sysclk);
157+ rate = pdata->sysclk_rate;
157158
158159 /*
159160 * Convert the input watchdog timer value to the usec value. Each
@@ -673,6 +674,9 @@ static void xgbe_enable_mac_interrupts(struct xgbe_prv_data *pdata) · 513 unmodified lines
673674
674675 static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata)
675676 {
677+ if (XGMAC_IOREAD_BITS(pdata, MAC_TCR, SS) == 0x3)
678+ return 0;
679+
676680 XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0x3);
677681
678682 return 0;
@@ -680,6 +684,9 @@ static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) · 1 unmodified line
680684
681685 static int xgbe_set_gmii_2500_speed(struct xgbe_prv_data *pdata)
682686 {
687+ if (XGMAC_IOREAD_BITS(pdata, MAC_TCR, SS) == 0x2)
688+ return 0;
689+
683690 XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0x2);
684691
685692 return 0;
@@ -687,6 +694,9 @@ static int xgbe_set_gmii_2500_speed(struct xgbe_prv_data *pdata) · 1 unmodified line
687694
688695 static int xgbe_set_xgmii_speed(struct xgbe_prv_data *pdata)
689696 {
697+ if (XGMAC_IOREAD_BITS(pdata, MAC_TCR, SS) == 0)
698+ return 0;
699+
690700 XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0);
691701
692702 return 0;
@@ -881,6 +891,23 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad, · 188 unmodified lines
881891 else
882892 mmd_address = (pdata->mdio_mmd << 16) | (mmd_reg & 0xffff);
883893
894+ /* If the PCS is changing modes, match the MAC speed to it */
895+ if (((mmd_address >> 16) == MDIO_MMD_PCS) &&
896+ ((mmd_address & 0xffff) == MDIO_CTRL2)) {
897+ struct phy_device *phydev = pdata->phydev;
898+
899+ if (mmd_data & MDIO_PCS_CTRL2_TYPE) {
900+ /* KX mode */
901+ if (phydev->supported & SUPPORTED_1000baseKX_Full)
902+ xgbe_set_gmii_speed(pdata);
903+ else
904+ xgbe_set_gmii_2500_speed(pdata);
905+ } else {
906+ /* KR mode */
907+ xgbe_set_xgmii_speed(pdata);
908+ }
909+ }
910+
884911 /* The PCS registers are accessed using mmio. The underlying APB3
885912 * management interface uses indirect addressing to access the MMD
886913 * register sets. This requires accessing of the PCS register in two
@@ -1359,6 +1386,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 472 unmodified lines
13591386 unsigned int tso_context, vlan_context;
13601387 unsigned int tx_set_ic;
13611388 int start_index = ring->cur;
1389+ int cur_index = ring->cur;
13621390 int i;
13631391
13641392 DBGPR("-->xgbe_dev_xmit\n");
@@ -1401,7 +1429,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 36 unmodified lines
14011429 else
14021430 tx_set_ic = 0;
14031431
1404− rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
1432+ rdata = XGBE_GET_DESC_DATA(ring, cur_index);
14051433 rdesc = rdata->rdesc;
14061434
14071435 /* Create a context descriptor if this is a TSO packet */
@@ -1444,8 +1472,8 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 36 unmodified lines
14441472 ring->tx.cur_vlan_ctag = packet->vlan_ctag;
14451473 }
14461474
1447− ring->cur++;
1448− rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
1475+ cur_index++;
1476+ rdata = XGBE_GET_DESC_DATA(ring, cur_index);
14491477 rdesc = rdata->rdesc;
14501478 }
14511479
@@ -1473,7 +1501,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 21 unmodified lines
14731501 XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, CTXT, 0);
14741502
14751503 /* Set OWN bit if not the first descriptor */
1476− if (ring->cur != start_index)
1504+ if (cur_index != start_index)
14771505 XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, OWN, 1);
14781506
14791507 if (tso) {
@@ -1497,9 +1525,9 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 17 unmodified lines
14971525 packet->length);
14981526 }
14991527
1500− for (i = ring->cur - start_index + 1; i < packet->rdesc_count; i++) {
1501− ring->cur++;
1502− rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
1528+ for (i = cur_index - start_index + 1; i < packet->rdesc_count; i++) {
1529+ cur_index++;
1530+ rdata = XGBE_GET_DESC_DATA(ring, cur_index);
15031531 rdesc = rdata->rdesc;
15041532
15051533 /* Update buffer address */
@@ -1551,7 +1579,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 45 unmodified lines
15511579 /* Make sure ownership is written to the descriptor */
15521580 wmb();
15531581
1554− ring->cur++;
1582+ ring->cur = cur_index + 1;
15551583 if (!packet->skb->xmit_more ||
15561584 netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev,
15571585 channel->queue_index)))
@@ -2107,6 +2135,23 @@ static void xgbe_config_jumbo_enable(struct xgbe_prv_data *pdata) · 549 unmodified lines
21072135 XGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val);
21082136 }
21092137
2138+static void xgbe_config_mac_speed(struct xgbe_prv_data *pdata)
2139+{
2140+ switch (pdata->phy_speed) {
2141+ case SPEED_10000:
2142+ xgbe_set_xgmii_speed(pdata);
2143+ break;
2144+
2145+ case SPEED_2500:
2146+ xgbe_set_gmii_2500_speed(pdata);
2147+ break;
2148+
2149+ case SPEED_1000:
2150+ xgbe_set_gmii_speed(pdata);
2151+ break;
2152+ }
2153+}
2154+
21102155 static void xgbe_config_checksum_offload(struct xgbe_prv_data *pdata)
21112156 {
21122157 if (pdata->netdev->features & NETIF_F_RXCSUM)
@@ -2757,6 +2802,7 @@ static int xgbe_init(struct xgbe_prv_data *pdata) · 644 unmodified lines
27572802 xgbe_config_mac_address(pdata);
27582803 xgbe_config_jumbo_enable(pdata);
27592804 xgbe_config_flow_control(pdata);
2805+ xgbe_config_mac_speed(pdata);
27602806 xgbe_config_checksum_offload(pdata);
27612807 xgbe_config_vlan_support(pdata);
27622808 xgbe_config_mmc(pdata);
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+38−40
@@ -225,6 +225,11 @@ static inline unsigned int xgbe_tx_avail_desc(struct xgbe_ring *ring) · 224 unmodified lines
225225 return (ring->rdesc_count - (ring->cur - ring->dirty));
226226 }
227227
228+static inline unsigned int xgbe_rx_dirty_desc(struct xgbe_ring *ring)
229+{
230+ return (ring->cur - ring->dirty);
231+}
232+
228233 static int xgbe_maybe_stop_tx_queue(struct xgbe_channel *channel,
229234 struct xgbe_ring *ring, unsigned int count)
230235 {
@@ -337,12 +342,13 @@ static irqreturn_t xgbe_isr(int irq, void *data) · 106 unmodified lines
337342 dma_ch_isr = XGMAC_DMA_IOREAD(channel, DMA_CH_SR);
338343 DBGPR(" DMA_CH%u_ISR = %08x\n", i, dma_ch_isr);
339344
340− /* If we get a TI or RI interrupt that means per channel DMA
341− * interrupts are not enabled, so we use the private data napi
342− * structure, not the per channel napi structure
345+ /* The TI or RI interrupt bits may still be set even if using
346+ * per channel DMA interrupts. Check to be sure those are not
347+ * enabled before using the private data napi structure.
343348 */
344− if (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) ||
345− XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI)) {
349+ if (!pdata->per_channel_irq &&
350+ (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) ||
351+ XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI))) {
346352 if (napi_schedule_prep(&pdata->napi)) {
347353 /* Disable Tx and Rx interrupts */
348354 xgbe_disable_rx_tx_ints(pdata);
@@ -410,17 +416,13 @@ static enum hrtimer_restart xgbe_tx_timer(struct hrtimer *timer) · 61 unmodified lines
410416 struct xgbe_channel *channel = container_of(timer,
411417 struct xgbe_channel,
412418 tx_timer);
413− struct xgbe_ring *ring = channel->tx_ring;
414419 struct xgbe_prv_data *pdata = channel->pdata;
415420 struct napi_struct *napi;
416− unsigned long flags;
417421
418422 DBGPR("-->xgbe_tx_timer\n");
419423
420424 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi;
421425
422− spin_lock_irqsave(&ring->lock, flags);
423−
424426 if (napi_schedule_prep(napi)) {
425427 /* Disable Tx and Rx interrupts */
426428 if (pdata->per_channel_irq)
@@ -434,8 +436,6 @@ static enum hrtimer_restart xgbe_tx_timer(struct hrtimer *timer) · 7 unmodified lines
434436
435437 channel->tx_timer_active = 0;
436438
437− spin_unlock_irqrestore(&ring->lock, flags);
438−
439439 DBGPR("<--xgbe_tx_timer\n");
440440
441441 return HRTIMER_NORESTART;
@@ -694,7 +694,7 @@ static void xgbe_adjust_link(struct net_device *netdev) · 252 unmodified lines
694694 struct phy_device *phydev = pdata->phydev;
695695 int new_state = 0;
696696
697− if (phydev == NULL)
697+ if (!phydev)
698698 return;
699699
700700 if (phydev->link) {
@@ -929,7 +929,7 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) · 228 unmodified lines
929929 DBGPR("<--xgbe_stop\n");
930930 }
931931
932−static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset)
932+static void xgbe_restart_dev(struct xgbe_prv_data *pdata)
933933 {
934934 struct xgbe_channel *channel;
935935 struct xgbe_hw_if *hw_if = &pdata->hw_if;
@@ -952,9 +952,8 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset) · 16 unmodified lines
952952 xgbe_free_tx_data(pdata);
953953 xgbe_free_rx_data(pdata);
954954
955− /* Issue software reset to device if requested */
956− if (reset)
957− hw_if->exit(pdata);
955+ /* Issue software reset to device */
956+ hw_if->exit(pdata);
958957
959958 xgbe_start(pdata);
960959
@@ -969,7 +968,7 @@ static void xgbe_restart(struct work_struct *work) · 8 unmodified lines
969968
970969 rtnl_lock();
971970
972− xgbe_restart_dev(pdata, 1);
971+ xgbe_restart_dev(pdata);
973972
974973 rtnl_unlock();
975974 }
@@ -1167,8 +1166,8 @@ static void xgbe_prep_tx_tstamp(struct xgbe_prv_data *pdata, · 191 unmodified lines
11671166
11681167 static void xgbe_prep_vlan(struct sk_buff *skb, struct xgbe_packet_data *packet)
11691168 {
1170− if (vlan_tx_tag_present(skb))
1171− packet->vlan_ctag = vlan_tx_tag_get(skb);
1169+ if (skb_vlan_tag_present(skb))
1170+ packet->vlan_ctag = skb_vlan_tag_get(skb);
11721171 }
11731172
11741173 static int xgbe_prep_tso(struct sk_buff *skb, struct xgbe_packet_data *packet)
@@ -1249,9 +1248,9 @@ static void xgbe_packet_info(struct xgbe_prv_data *pdata, · 74 unmodified lines
12491248 XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES,
12501249 CSUM_ENABLE, 1);
12511250
1252− if (vlan_tx_tag_present(skb)) {
1251+ if (skb_vlan_tag_present(skb)) {
12531252 /* VLAN requires an extra descriptor if tag is different */
1254− if (vlan_tx_tag_get(skb) != ring->tx.cur_vlan_ctag)
1253+ if (skb_vlan_tag_get(skb) != ring->tx.cur_vlan_ctag)
12551254 /* We can share with the TSO context descriptor */
12561255 if (!context_desc) {
12571256 context_desc = 1;
@@ -1448,7 +1447,6 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) · 190 unmodified lines
14481447 struct xgbe_ring *ring;
14491448 struct xgbe_packet_data *packet;
14501449 struct netdev_queue *txq;
1451− unsigned long flags;
14521450 int ret;
14531451
14541452 DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len);
@@ -1460,8 +1458,6 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) · 5 unmodified lines
14601458
14611459 ret = NETDEV_TX_OK;
14621460
1463− spin_lock_irqsave(&ring->lock, flags);
1464−
14651461 if (skb->len == 0) {
14661462 netdev_err(netdev, "empty skb received from stack\n");
14671463 dev_kfree_skb_any(skb);
@@ -1508,10 +1504,6 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) · 40 unmodified lines
15081504 ret = NETDEV_TX_OK;
15091505
15101506 tx_netdev_return:
1511− spin_unlock_irqrestore(&ring->lock, flags);
1512−
1513− DBGPR("<--xgbe_xmit\n");
1514−
15151507 return ret;
15161508 }
15171509
@@ -1589,7 +1581,7 @@ static int xgbe_change_mtu(struct net_device *netdev, int mtu) · 71 unmodified lines
15891581 pdata->rx_buf_size = ret;
15901582 netdev->mtu = mtu;
15911583
1592− xgbe_restart_dev(pdata, 0);
1584+ xgbe_restart_dev(pdata);
15931585
15941586 DBGPR("<--xgbe_change_mtu\n");
15951587
@@ -1778,15 +1770,28 @@ struct net_device_ops *xgbe_get_netdev_ops(void) · 182 unmodified lines
17781770 static void xgbe_rx_refresh(struct xgbe_channel *channel)
17791771 {
17801772 struct xgbe_prv_data *pdata = channel->pdata;
1773+ struct xgbe_hw_if *hw_if = &pdata->hw_if;
17811774 struct xgbe_desc_if *desc_if = &pdata->desc_if;
17821775 struct xgbe_ring *ring = channel->rx_ring;
17831776 struct xgbe_ring_data *rdata;
17841777
1785− desc_if->realloc_rx_buffer(channel);
1778+ while (ring->dirty != ring->cur) {
1779+ rdata = XGBE_GET_DESC_DATA(ring, ring->dirty);
1780+
1781+ /* Reset rdata values */
1782+ desc_if->unmap_rdata(pdata, rdata);
1783+
1784+ if (desc_if->map_rx_buffer(pdata, ring, rdata))
1785+ break;
1786+
1787+ hw_if->rx_desc_reset(rdata);
1788+
1789+ ring->dirty++;
1790+ }
17861791
17871792 /* Update the Rx Tail Pointer Register with address of
17881793 * the last cleaned entry */
1789− rdata = XGBE_GET_DESC_DATA(ring, ring->rx.realloc_index - 1);
1794+ rdata = XGBE_GET_DESC_DATA(ring, ring->dirty - 1);
17901795 XGMAC_DMA_IOWRITE(channel, DMA_CH_RDTR_LO,
17911796 lower_32_bits(rdata->rdesc_dma));
17921797 }
@@ -1826,7 +1831,6 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 33 unmodified lines
18261831 struct xgbe_ring_desc *rdesc;
18271832 struct net_device *netdev = pdata->netdev;
18281833 struct netdev_queue *txq;
1829− unsigned long flags;
18301834 int processed = 0;
18311835 unsigned int tx_packets = 0, tx_bytes = 0;
18321836
@@ -1838,8 +1842,6 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 5 unmodified lines
18381842
18391843 txq = netdev_get_tx_queue(netdev, channel->queue_index);
18401844
1841− spin_lock_irqsave(&ring->lock, flags);
1842−
18431845 while ((processed < XGBE_TX_DESC_MAX_PROC) &&
18441846 (ring->dirty != ring->cur)) {
18451847 rdata = XGBE_GET_DESC_DATA(ring, ring->dirty);
@@ -1870,7 +1872,7 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 24 unmodified lines
18701872 }
18711873
18721874 if (!processed)
1873− goto unlock;
1875+ return 0;
18741876
18751877 netdev_tx_completed_queue(txq, tx_packets, tx_bytes);
18761878
@@ -1882,9 +1884,6 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 5 unmodified lines
18821884
18831885 DBGPR("<--xgbe_tx_poll: processed=%d\n", processed);
18841886
1885−unlock:
1886− spin_unlock_irqrestore(&ring->lock, flags);
1887−
18881887 return processed;
18891888 }
18901889
@@ -1936,7 +1935,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) · 45 unmodified lines
19361935 read_again:
19371936 rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
19381937
1939− if (ring->dirty > (XGBE_RX_DESC_CNT >> 3))
1938+ if (xgbe_rx_dirty_desc(ring) > (XGBE_RX_DESC_CNT >> 3))
19401939 xgbe_rx_refresh(channel);
19411940
19421941 if (hw_if->dev_read(channel))
@@ -1944,7 +1943,6 @@ read_again: · 1 unmodified line
19441943
19451944 received++;
19461945 ring->cur++;
1947− ring->dirty++;
19481946
19491947 incomplete = XGMAC_GET_BITS(packet->attributes,
19501948 RX_PACKET_ATTRIBUTES,
drivers/net/ethernet/amd/xgbe/xgbe-main.c+159−44
@@ -123,7 +123,10 @@ · 122 unmodified lines
123123 #include <linux/io.h>
124124 #include <linux/of.h>
125125 #include <linux/of_net.h>
126+#include <linux/of_address.h>
126127 #include <linux/clk.h>
128+#include <linux/property.h>
129+#include <linux/acpi.h>
127130
128131 #include "xgbe.h"
129132 #include "xgbe-common.h"
@@ -148,6 +151,7 @@ static void xgbe_default_config(struct xgbe_prv_data *pdata) · 18 unmodified lines
148151 pdata->pause_autoneg = 1;
149152 pdata->tx_pause = 1;
150153 pdata->rx_pause = 1;
154+ pdata->phy_speed = SPEED_UNKNOWN;
151155 pdata->power_down = 0;
152156 pdata->default_autoneg = AUTONEG_ENABLE;
153157 pdata->default_speed = SPEED_10000;
@@ -161,6 +165,96 @@ static void xgbe_init_all_fptrs(struct xgbe_prv_data *pdata) · 7 unmodified lines
161165 xgbe_init_function_ptrs_desc(&pdata->desc_if);
162166 }
163167
168+#ifdef CONFIG_ACPI
169+static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
170+{
171+ struct acpi_device *adev = pdata->adev;
172+ struct device *dev = pdata->dev;
173+ u32 property;
174+ acpi_handle handle;
175+ acpi_status status;
176+ unsigned long long data;
177+ int cca;
178+ int ret;
179+
180+ /* Obtain the system clock setting */
181+ ret = device_property_read_u32(dev, XGBE_ACPI_DMA_FREQ, &property);
182+ if (ret) {
183+ dev_err(dev, "unable to obtain %s property\n",
184+ XGBE_ACPI_DMA_FREQ);
185+ return ret;
186+ }
187+ pdata->sysclk_rate = property;
188+
189+ /* Obtain the PTP clock setting */
190+ ret = device_property_read_u32(dev, XGBE_ACPI_PTP_FREQ, &property);
191+ if (ret) {
192+ dev_err(dev, "unable to obtain %s property\n",
193+ XGBE_ACPI_PTP_FREQ);
194+ return ret;
195+ }
196+ pdata->ptpclk_rate = property;
197+
198+ /* Retrieve the device cache coherency value */
199+ handle = adev->handle;
200+ do {
201+ status = acpi_evaluate_integer(handle, "_CCA", NULL, &data);
202+ if (!ACPI_FAILURE(status)) {
203+ cca = data;
204+ break;
205+ }
206+
207+ status = acpi_get_parent(handle, &handle);
208+ } while (!ACPI_FAILURE(status));
209+
210+ if (ACPI_FAILURE(status)) {
211+ dev_err(dev, "error obtaining acpi coherency value\n");
212+ return -EINVAL;
213+ }
214+ pdata->coherent = !!cca;
215+
216+ return 0;
217+}
218+#else /* CONFIG_ACPI */
219+static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
220+{
221+ return -EINVAL;
222+}
223+#endif /* CONFIG_ACPI */
224+
225+#ifdef CONFIG_OF
226+static int xgbe_of_support(struct xgbe_prv_data *pdata)
227+{
228+ struct device *dev = pdata->dev;
229+
230+ /* Obtain the system clock setting */
231+ pdata->sysclk = devm_clk_get(dev, XGBE_DMA_CLOCK);
232+ if (IS_ERR(pdata->sysclk)) {
233+ dev_err(dev, "dma devm_clk_get failed\n");
234+ return PTR_ERR(pdata->sysclk);
235+ }
236+ pdata->sysclk_rate = clk_get_rate(pdata->sysclk);
237+
238+ /* Obtain the PTP clock setting */
239+ pdata->ptpclk = devm_clk_get(dev, XGBE_PTP_CLOCK);
240+ if (IS_ERR(pdata->ptpclk)) {
241+ dev_err(dev, "ptp devm_clk_get failed\n");
242+ return PTR_ERR(pdata->ptpclk);
243+ }
244+ pdata->ptpclk_rate = clk_get_rate(pdata->ptpclk);
245+
246+ /* Retrieve the device cache coherency value */
247+ pdata->coherent = of_dma_is_coherent(dev->of_node);
248+
249+ return 0;
250+}
251+#else /* CONFIG_OF */
252+static int xgbe_of_support(struct xgbe_prv_data *pdata)
253+{
254+ return -EINVAL;
255+}
256+#endif /*CONFIG_OF */
257+
164258 static int xgbe_probe(struct platform_device *pdev)
165259 {
166260 struct xgbe_prv_data *pdata;
@@ -169,7 +263,7 @@ static int xgbe_probe(struct platform_device *pdev) · 2 unmodified lines
169263 struct net_device *netdev;
170264 struct device *dev = &pdev->dev;
171265 struct resource *res;
172− const u8 *mac_addr;
266+ const char *phy_mode;
173267 unsigned int i;
174268 int ret;
175269
@@ -186,6 +280,7 @@ static int xgbe_probe(struct platform_device *pdev) · 10 unmodified lines
186280 pdata = netdev_priv(netdev);
187281 pdata->netdev = netdev;
188282 pdata->pdev = pdev;
283+ pdata->adev = ACPI_COMPANION(dev);
189284 pdata->dev = dev;
190285 platform_set_drvdata(pdev, netdev);
191286
@@ -194,6 +289,9 @@ static int xgbe_probe(struct platform_device *pdev) · 2 unmodified lines
194289 mutex_init(&pdata->rss_mutex);
195290 spin_lock_init(&pdata->tstamp_lock);
196291
292+ /* Check if we should use ACPI or DT */
293+ pdata->use_acpi = (!pdata->adev || acpi_disabled) ? 0 : 1;
294+
197295 /* Set and validate the number of descriptors for a ring */
198296 BUILD_BUG_ON_NOT_POWER_OF_2(XGBE_TX_DESC_CNT);
199297 pdata->tx_desc_count = XGBE_TX_DESC_CNT;
@@ -212,22 +310,6 @@ static int xgbe_probe(struct platform_device *pdev) · 12 unmodified lines
212310 goto err_io;
213311 }
214312
215− /* Obtain the system clock setting */
216− pdata->sysclk = devm_clk_get(dev, XGBE_DMA_CLOCK);
217− if (IS_ERR(pdata->sysclk)) {
218− dev_err(dev, "dma devm_clk_get failed\n");
219− ret = PTR_ERR(pdata->sysclk);
220− goto err_io;
221− }
222−
223− /* Obtain the PTP clock setting */
224− pdata->ptpclk = devm_clk_get(dev, XGBE_PTP_CLOCK);
225− if (IS_ERR(pdata->ptpclk)) {
226− dev_err(dev, "ptp devm_clk_get failed\n");
227− ret = PTR_ERR(pdata->ptpclk);
228− goto err_io;
229− }
230−
231313 /* Obtain the mmio areas for the device */
232314 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
233315 pdata->xgmac_regs = devm_ioremap_resource(dev, res);
@@ -247,16 +329,42 @@ static int xgbe_probe(struct platform_device *pdev) · 13 unmodified lines
247329 }
248330 DBGPR(" xpcs_regs = %p\n", pdata->xpcs_regs);
249331
250− /* Set the DMA mask */
251− if (!dev->dma_mask)
252− dev->dma_mask = &dev->coherent_dma_mask;
253− ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
254− if (ret) {
255− dev_err(dev, "dma_set_mask_and_coherent failed\n");
332+ /* Retrieve the MAC address */
333+ ret = device_property_read_u8_array(dev, XGBE_MAC_ADDR_PROPERTY,
334+ pdata->mac_addr,
335+ sizeof(pdata->mac_addr));
336+ if (ret || !is_valid_ether_addr(pdata->mac_addr)) {
337+ dev_err(dev, "invalid %s property\n", XGBE_MAC_ADDR_PROPERTY);
338+ if (!ret)
339+ ret = -EINVAL;
256340 goto err_io;
257341 }
258342
259− if (of_property_read_bool(dev->of_node, "dma-coherent")) {
343+ /* Retrieve the PHY mode - it must be "xgmii" */
344+ ret = device_property_read_string(dev, XGBE_PHY_MODE_PROPERTY,
345+ &phy_mode);
346+ if (ret || strcmp(phy_mode, phy_modes(PHY_INTERFACE_MODE_XGMII))) {
347+ dev_err(dev, "invalid %s property\n", XGBE_PHY_MODE_PROPERTY);
348+ if (!ret)
349+ ret = -EINVAL;
350+ goto err_io;
351+ }
352+ pdata->phy_mode = PHY_INTERFACE_MODE_XGMII;
353+
354+ /* Check for per channel interrupt support */
355+ if (device_property_present(dev, XGBE_DMA_IRQS_PROPERTY))
356+ pdata->per_channel_irq = 1;
357+
358+ /* Obtain device settings unique to ACPI/OF */
359+ if (pdata->use_acpi)
360+ ret = xgbe_acpi_support(pdata);
361+ else
362+ ret = xgbe_of_support(pdata);
363+ if (ret)
364+ goto err_io;
365+
366+ /* Set the DMA coherency values */
367+ if (pdata->coherent) {
260368 pdata->axdomain = XGBE_DMA_OS_AXDOMAIN;
261369 pdata->arcache = XGBE_DMA_OS_ARCACHE;
262370 pdata->awcache = XGBE_DMA_OS_AWCACHE;
@@ -266,10 +374,16 @@ static int xgbe_probe(struct platform_device *pdev) · 3 unmodified lines
266374 pdata->awcache = XGBE_DMA_SYS_AWCACHE;
267375 }
268376
269− /* Check for per channel interrupt support */
270− if (of_property_read_bool(dev->of_node, XGBE_DMA_IRQS))
271− pdata->per_channel_irq = 1;
377+ /* Set the DMA mask */
378+ if (!dev->dma_mask)
379+ dev->dma_mask = &dev->coherent_dma_mask;
380+ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
381+ if (ret) {
382+ dev_err(dev, "dma_set_mask_and_coherent failed\n");
383+ goto err_io;
384+ }
272385
386+ /* Get the device interrupt */
273387 ret = platform_get_irq(pdev, 0);
274388 if (ret < 0) {
275389 dev_err(dev, "platform_get_irq 0 failed\n");
@@ -279,6 +393,7 @@ static int xgbe_probe(struct platform_device *pdev) · 3 unmodified lines
279393
280394 netdev->irq = pdata->dev_irq;
281395 netdev->base_addr = (unsigned long)pdata->xgmac_regs;
396+ memcpy(netdev->dev_addr, pdata->mac_addr, netdev->addr_len);
282397
283398 /* Set all the function pointers */
284399 xgbe_init_all_fptrs(pdata);
@@ -291,23 +406,6 @@ static int xgbe_probe(struct platform_device *pdev) · 6 unmodified lines
291406 /* Populate the hardware features */
292407 xgbe_get_all_hw_features(pdata);
293408
294− /* Retrieve the MAC address */
295− mac_addr = of_get_mac_address(dev->of_node);
296− if (!mac_addr) {
297− dev_err(dev, "invalid mac address for this device\n");
298− ret = -EINVAL;
299− goto err_io;
300− }
301− memcpy(netdev->dev_addr, mac_addr, netdev->addr_len);
302−
303− /* Retrieve the PHY mode - it must be "xgmii" */
304− pdata->phy_mode = of_get_phy_mode(dev->of_node);
305− if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) {
306− dev_err(dev, "invalid phy-mode specified for this device\n");
307− ret = -EINVAL;
308− goto err_io;
309− }
310−
311409 /* Set default configuration data */
312410 xgbe_default_config(pdata);
313411
@@ -491,18 +589,35 @@ static int xgbe_resume(struct device *dev) · 177 unmodified lines
491589 }
492590 #endif /* CONFIG_PM */
493591
592+#ifdef CONFIG_ACPI
593+static const struct acpi_device_id xgbe_acpi_match[] = {
594+ { "AMDI8001", 0 },
595+ {},
596+};
597+
598+MODULE_DEVICE_TABLE(acpi, xgbe_acpi_match);
599+#endif
600+
601+#ifdef CONFIG_OF
494602 static const struct of_device_id xgbe_of_match[] = {
495603 { .compatible = "amd,xgbe-seattle-v1a", },
496604 {},
497605 };
498606
499607 MODULE_DEVICE_TABLE(of, xgbe_of_match);
608+#endif
609+
500610 static SIMPLE_DEV_PM_OPS(xgbe_pm_ops, xgbe_suspend, xgbe_resume);
501611
502612 static struct platform_driver xgbe_driver = {
503613 .driver = {
504614 .name = "amd-xgbe",
615+#ifdef CONFIG_ACPI
616+ .acpi_match_table = xgbe_acpi_match,
617+#endif
618+#ifdef CONFIG_OF
505619 .of_match_table = xgbe_of_match,
620+#endif
506621 .pm = &xgbe_pm_ops,
507622 },
508623 .probe = xgbe_probe,
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c+8−21
@@ -205,25 +205,16 @@ void xgbe_dump_phy_registers(struct xgbe_prv_data *pdata) · 204 unmodified lines
205205
206206 int xgbe_mdio_register(struct xgbe_prv_data *pdata)
207207 {
208− struct device_node *phy_node;
209208 struct mii_bus *mii;
210209 struct phy_device *phydev;
211210 int ret = 0;
212211
213212 DBGPR("-->xgbe_mdio_register\n");
214213
215− /* Retrieve the phy-handle */
216− phy_node = of_parse_phandle(pdata->dev->of_node, "phy-handle", 0);
217− if (!phy_node) {
218− dev_err(pdata->dev, "unable to parse phy-handle\n");
219− return -EINVAL;
220− }
221−
222214 mii = mdiobus_alloc();
223− if (mii == NULL) {
215+ if (!mii) {
224216 dev_err(pdata->dev, "mdiobus_alloc failed\n");
225− ret = -ENOMEM;
226− goto err_node_get;
217+ return -ENOMEM;
227218 }
228219
229220 /* Register on the MDIO bus (don't probe any PHYs) */
@@ -252,18 +243,19 @@ int xgbe_mdio_register(struct xgbe_prv_data *pdata) · 22 unmodified lines
252243 request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
253244 MDIO_ID_ARGS(phydev->c45_ids.device_ids[MDIO_MMD_PCS]));
254245
255− of_node_get(phy_node);
256− phydev->dev.of_node = phy_node;
257246 ret = phy_device_register(phydev);
258247 if (ret) {
259248 dev_err(pdata->dev, "phy_device_register failed\n");
260− of_node_put(phy_node);
249+ goto err_phy_device;
250+ }
251+ if (!phydev->dev.driver) {
252+ dev_err(pdata->dev, "phy driver probe failed\n");
253+ ret = -EIO;
261254 goto err_phy_device;
262255 }
263256
264257 /* Add a reference to the PHY driver so it can't be unloaded */
265− pdata->phy_module = phydev->dev.driver ?
266− phydev->dev.driver->owner : NULL;
258+ pdata->phy_module = phydev->dev.driver->owner;
267259 if (!try_module_get(pdata->phy_module)) {
268260 dev_err(pdata->dev, "try_module_get failed\n");
269261 ret = -EIO;
@@ -283,8 +275,6 @@ int xgbe_mdio_register(struct xgbe_prv_data *pdata) · 13 unmodified lines
283275
284276 pdata->phydev = phydev;
285277
286− of_node_put(phy_node);
287−
288278 DBGPHY_REGS(pdata);
289279
290280 DBGPR("<--xgbe_mdio_register\n");
@@ -300,9 +290,6 @@ err_mdiobus_register: · 9 unmodified lines
300290 err_mdiobus_alloc:
301291 mdiobus_free(mii);
302292
303−err_node_get:
304− of_node_put(phy_node);
305−
306293 return ret;
307294 }
308295
drivers/net/ethernet/amd/xgbe/xgbe-ptp.c+3−9
@@ -171,15 +171,9 @@ static int xgbe_adjtime(struct ptp_clock_info *info, s64 delta) · 170 unmodified lines
171171 struct xgbe_prv_data,
172172 ptp_clock_info);
173173 unsigned long flags;
174− u64 nsec;
175174
176175 spin_lock_irqsave(&pdata->tstamp_lock, flags);
177−
178− nsec = timecounter_read(&pdata->tstamp_tc);
179−
180− nsec += delta;
181− timecounter_init(&pdata->tstamp_tc, &pdata->tstamp_cc, nsec);
182−
176+ timecounter_adjtime(&pdata->tstamp_tc, delta);
183177 spin_unlock_irqrestore(&pdata->tstamp_lock, flags);
184178
185179 return 0;
@@ -239,7 +233,7 @@ void xgbe_ptp_register(struct xgbe_prv_data *pdata) · 53 unmodified lines
239233 snprintf(info->name, sizeof(info->name), "%s",
240234 netdev_name(pdata->netdev));
241235 info->owner = THIS_MODULE;
242− info->max_adj = clk_get_rate(pdata->ptpclk);
236+ info->max_adj = pdata->ptpclk_rate;
243237 info->adjfreq = xgbe_adjfreq;
244238 info->adjtime = xgbe_adjtime;
245239 info->gettime = xgbe_gettime;
@@ -260,7 +254,7 @@ void xgbe_ptp_register(struct xgbe_prv_data *pdata) · 14 unmodified lines
260254 */
261255 dividend = 50000000;
262256 dividend <<= 32;
263− pdata->tstamp_addend = div_u64(dividend, clk_get_rate(pdata->ptpclk));
257+ pdata->tstamp_addend = div_u64(dividend, pdata->ptpclk_rate);
264258
265259 /* Setup the timecounter */
266260 cc->read = xgbe_cc_read;
drivers/net/ethernet/amd/xgbe/xgbe.h+21−10
@@ -124,7 +124,7 @@ · 123 unmodified lines
124124 #include <linux/if_vlan.h>
125125 #include <linux/bitops.h>
126126 #include <linux/ptp_clock_kernel.h>
127−#include <linux/clocksource.h>
127+#include <linux/timecounter.h>
128128 #include <linux/net_tstamp.h>
129129 #include <net/dcbnl.h>
130130
@@ -182,10 +182,18 @@ · 51 unmodified lines
182182 #define XGBE_PHY_NAME "amd_xgbe_phy"
183183 #define XGBE_PRTAD 0
184184
185+/* Common property names */
186+#define XGBE_MAC_ADDR_PROPERTY "mac-address"
187+#define XGBE_PHY_MODE_PROPERTY "phy-mode"
188+#define XGBE_DMA_IRQS_PROPERTY "amd,per-channel-interrupt"
189+
185190 /* Device-tree clock names */
186191 #define XGBE_DMA_CLOCK "dma_clk"
187192 #define XGBE_PTP_CLOCK "ptp_clk"
188−#define XGBE_DMA_IRQS "amd,per-channel-interrupt"
193+
194+/* ACPI property names */
195+#define XGBE_ACPI_DMA_FREQ "amd,dma-freq"
196+#define XGBE_ACPI_PTP_FREQ "amd,ptp-freq"
189197
190198 /* Timestamp support - values based on 50MHz PTP clock
191199 * 50MHz => 20 nsec
@@ -361,8 +369,7 @@ struct xgbe_ring { · 169 unmodified lines
361369 * cur - Tx: index of descriptor to be used for current transfer
362370 * Rx: index of descriptor to check for packet availability
363371 * dirty - Tx: index of descriptor to check for transfer complete
364− * Rx: count of descriptors in which a packet has been received
365− * (used with skb_realloc_index to refresh the ring)
372+ * Rx: index of descriptor to check for buffer reallocation
366373 */
367374 unsigned int cur;
368375 unsigned int dirty;
@@ -377,11 +384,6 @@ struct xgbe_ring { · 8 unmodified lines
377384 unsigned short cur_mss;
378385 unsigned short cur_vlan_ctag;
379386 } tx;
380−
381− struct {
382− unsigned int realloc_index;
383− unsigned int realloc_threshold;
384− } rx;
385387 };
386388 } ____cacheline_aligned;
387389
@@ -596,7 +598,8 @@ struct xgbe_desc_if { · 208 unmodified lines
596598 int (*alloc_ring_resources)(struct xgbe_prv_data *);
597599 void (*free_ring_resources)(struct xgbe_prv_data *);
598600 int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *);
599− void (*realloc_rx_buffer)(struct xgbe_channel *);
601+ int (*map_rx_buffer)(struct xgbe_prv_data *, struct xgbe_ring *,
602+ struct xgbe_ring_data *);
600603 void (*unmap_rdata)(struct xgbe_prv_data *, struct xgbe_ring_data *);
601604 void (*wrapper_tx_desc_init)(struct xgbe_prv_data *);
602605 void (*wrapper_rx_desc_init)(struct xgbe_prv_data *);
@@ -650,8 +653,12 @@ struct xgbe_hw_features { · 47 unmodified lines
650653 struct xgbe_prv_data {
651654 struct net_device *netdev;
652655 struct platform_device *pdev;
656+ struct acpi_device *adev;
653657 struct device *dev;
654658
659+ /* ACPI or DT flag */
660+ unsigned int use_acpi;
661+
655662 /* XGMAC/XPCS related mmio registers */
656663 void __iomem *xgmac_regs; /* XGMAC CSRs */
657664 void __iomem *xpcs_regs; /* XPCS MMD registers */
@@ -672,6 +679,7 @@ struct xgbe_prv_data { · 14 unmodified lines
672679 struct xgbe_desc_if desc_if;
673680
674681 /* AXI DMA settings */
682+ unsigned int coherent;
675683 unsigned int axdomain;
676684 unsigned int arcache;
677685 unsigned int awcache;
@@ -739,6 +747,7 @@ struct xgbe_prv_data { · 61 unmodified lines
739747 unsigned int phy_rx_pause;
740748
741749 /* Netdev related settings */
750+ unsigned char mac_addr[ETH_ALEN];
742751 netdev_features_t netdev_features;
743752 struct napi_struct napi;
744753 struct xgbe_mmc_stats mmc_stats;
@@ -748,7 +757,9 @@ struct xgbe_prv_data { · 3 unmodified lines
748757
749758 /* Device clocks */
750759 struct clk *sysclk;
760+ unsigned long sysclk_rate;
751761 struct clk *ptpclk;
762+ unsigned long ptpclk_rate;
752763
753764 /* Timestamp support */
754765 spinlock_t tstamp_lock;
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c+70−24
@@ -593,10 +593,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata) · 592 unmodified lines
593593 if (!xgene_ring_mgr_init(pdata))
594594 return -ENODEV;
595595
596− clk_prepare_enable(pdata->clk);
597− clk_disable_unprepare(pdata->clk);
598− clk_prepare_enable(pdata->clk);
599− xgene_enet_ecc_init(pdata);
596+ if (!efi_enabled(EFI_BOOT)) {
597+ clk_prepare_enable(pdata->clk);
598+ clk_disable_unprepare(pdata->clk);
599+ clk_prepare_enable(pdata->clk);
600+ xgene_enet_ecc_init(pdata);
601+ }
600602 xgene_enet_config_ring_if_assoc(pdata);
601603
602604 /* Enable auto-incr for scanning */
@@ -663,15 +665,20 @@ static int xgene_enet_phy_connect(struct net_device *ndev) · 60 unmodified lines
663665 struct phy_device *phy_dev;
664666 struct device *dev = &pdata->pdev->dev;
665667
666− phy_np = of_parse_phandle(dev->of_node, "phy-handle", 0);
667− if (!phy_np) {
668− netdev_dbg(ndev, "No phy-handle found\n");
669− return -ENODEV;
668+ if (dev->of_node) {
669+ phy_np = of_parse_phandle(dev->of_node, "phy-handle", 0);
670+ if (!phy_np) {
671+ netdev_dbg(ndev, "No phy-handle found in DT\n");
672+ return -ENODEV;
673+ }
674+ pdata->phy_dev = of_phy_find_device(phy_np);
670675 }
671676
672− phy_dev = of_phy_connect(ndev, phy_np, &xgene_enet_adjust_link,
673− 0, pdata->phy_mode);
674− if (!phy_dev) {
677+ phy_dev = pdata->phy_dev;
678+
679+ if (!phy_dev ||
680+ phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
681+ pdata->phy_mode)) {
675682 netdev_err(ndev, "Could not connect to PHY\n");
676683 return -ENODEV;
677684 }
@@ -681,32 +688,71 @@ static int xgene_enet_phy_connect(struct net_device *ndev) · 3 unmodified lines
681688 ~SUPPORTED_100baseT_Half &
682689 ~SUPPORTED_1000baseT_Half;
683690 phy_dev->advertising = phy_dev->supported;
684− pdata->phy_dev = phy_dev;
685691
686692 return 0;
687693 }
688694
689−int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)
695+static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
696+ struct mii_bus *mdio)
690697 {
691− struct net_device *ndev = pdata->ndev;
692698 struct device *dev = &pdata->pdev->dev;
699+ struct net_device *ndev = pdata->ndev;
700+ struct phy_device *phy;
693701 struct device_node *child_np;
694702 struct device_node *mdio_np = NULL;
695− struct mii_bus *mdio_bus;
696703 int ret;
704+ u32 phy_id;
705+
706+ if (dev->of_node) {
707+ for_each_child_of_node(dev->of_node, child_np) {
708+ if (of_device_is_compatible(child_np,
709+ "apm,xgene-mdio")) {
710+ mdio_np = child_np;
711+ break;
712+ }
713+ }
697714
698− for_each_child_of_node(dev->of_node, child_np) {
699− if (of_device_is_compatible(child_np, "apm,xgene-mdio")) {
700− mdio_np = child_np;
701− break;
715+ if (!mdio_np) {
716+ netdev_dbg(ndev, "No mdio node in the dts\n");
717+ return -ENXIO;
702718 }
703− }
704719
705− if (!mdio_np) {
706− netdev_dbg(ndev, "No mdio node in the dts\n");
707− return -ENXIO;
720+ return of_mdiobus_register(mdio, mdio_np);
708721 }
709722
723+ /* Mask out all PHYs from auto probing. */
724+ mdio->phy_mask = ~0;
725+
726+ /* Register the MDIO bus */
727+ ret = mdiobus_register(mdio);
728+ if (ret)
729+ return ret;
730+
731+ ret = device_property_read_u32(dev, "phy-channel", &phy_id);
732+ if (ret)
733+ ret = device_property_read_u32(dev, "phy-addr", &phy_id);
734+ if (ret)
735+ return -EINVAL;
736+
737+ phy = get_phy_device(mdio, phy_id, true);
738+ if (!phy || IS_ERR(phy))
739+ return -EIO;
740+
741+ ret = phy_device_register(phy);
742+ if (ret)
743+ phy_device_free(phy);
744+ else
745+ pdata->phy_dev = phy;
746+
747+ return ret;
748+}
749+
750+int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)
751+{
752+ struct net_device *ndev = pdata->ndev;
753+ struct mii_bus *mdio_bus;
754+ int ret;
755+
710756 mdio_bus = mdiobus_alloc();
711757 if (!mdio_bus)
712758 return -ENOMEM;
@@ -720,7 +766,7 @@ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata) · 7 unmodified lines
720766 mdio_bus->priv = pdata;
721767 mdio_bus->parent = &ndev->dev;
722768
723− ret = of_mdiobus_register(mdio_bus, mdio_np);
769+ ret = xgene_mdiobus_register(pdata, mdio_bus);
724770 if (ret) {
725771 netdev_err(ndev, "Failed to register MDIO bus\n");
726772 mdiobus_free(mdio_bus);
drivers/net/ethernet/apm/xgene/xgene_enet_main.c+83−26
@@ -24,6 +24,10 @@ · 23 unmodified lines
2424 #include "xgene_enet_sgmac.h"
2525 #include "xgene_enet_xgmac.h"
2626
27+#define RES_ENET_CSR 0
28+#define RES_RING_CSR 1
29+#define RES_RING_CMD 2
30+
2731 static void xgene_enet_init_bufpool(struct xgene_enet_desc_ring *buf_pool)
2832 {
2933 struct xgene_enet_raw_desc16 *raw_desc;
@@ -748,6 +752,41 @@ static const struct net_device_ops xgene_ndev_ops = { · 718 unmodified lines
748752 .ndo_set_mac_address = xgene_enet_set_mac_address,
749753 };
750754
755+static int xgene_get_mac_address(struct device *dev,
756+ unsigned char *addr)
757+{
758+ int ret;
759+
760+ ret = device_property_read_u8_array(dev, "local-mac-address", addr, 6);
761+ if (ret)
762+ ret = device_property_read_u8_array(dev, "mac-address",
763+ addr, 6);
764+ if (ret)
765+ return -ENODEV;
766+
767+ return ETH_ALEN;
768+}
769+
770+static int xgene_get_phy_mode(struct device *dev)
771+{
772+ int i, ret;
773+ char *modestr;
774+
775+ ret = device_property_read_string(dev, "phy-connection-type",
776+ (const char **)&modestr);
777+ if (ret)
778+ ret = device_property_read_string(dev, "phy-mode",
779+ (const char **)&modestr);
780+ if (ret)
781+ return -ENODEV;
782+
783+ for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++) {
784+ if (!strcasecmp(modestr, phy_modes(i)))
785+ return i;
786+ }
787+ return -ENODEV;
788+}
789+
751790 static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
752791 {
753792 struct platform_device *pdev;
@@ -755,32 +794,45 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 1 unmodified line
755794 struct device *dev;
756795 struct resource *res;
757796 void __iomem *base_addr;
758− const char *mac;
759797 int ret;
760798
761799 pdev = pdata->pdev;
762800 dev = &pdev->dev;
763801 ndev = pdata->ndev;
764802
765− res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "enet_csr");
766− pdata->base_addr = devm_ioremap_resource(dev, res);
767− if (IS_ERR(pdata->base_addr)) {
803+ res = platform_get_resource(pdev, IORESOURCE_MEM, RES_ENET_CSR);
804+ if (!res) {
805+ dev_err(dev, "Resource enet_csr not defined\n");
806+ return -ENODEV;
807+ }
808+ pdata->base_addr = devm_ioremap(dev, res->start, resource_size(res));
809+ if (!pdata->base_addr) {
768810 dev_err(dev, "Unable to retrieve ENET Port CSR region\n");
769− return PTR_ERR(pdata->base_addr);
811+ return -ENOMEM;
770812 }
771813
772− res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_csr");
773− pdata->ring_csr_addr = devm_ioremap_resource(dev, res);
774− if (IS_ERR(pdata->ring_csr_addr)) {
814+ res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CSR);
815+ if (!res) {
816+ dev_err(dev, "Resource ring_csr not defined\n");
817+ return -ENODEV;
818+ }
819+ pdata->ring_csr_addr = devm_ioremap(dev, res->start,
820+ resource_size(res));
821+ if (!pdata->ring_csr_addr) {
775822 dev_err(dev, "Unable to retrieve ENET Ring CSR region\n");
776− return PTR_ERR(pdata->ring_csr_addr);
823+ return -ENOMEM;
777824 }
778825
779− res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_cmd");
780− pdata->ring_cmd_addr = devm_ioremap_resource(dev, res);
781− if (IS_ERR(pdata->ring_cmd_addr)) {
826+ res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CMD);
827+ if (!res) {
828+ dev_err(dev, "Resource ring_cmd not defined\n");
829+ return -ENODEV;
830+ }
831+ pdata->ring_cmd_addr = devm_ioremap(dev, res->start,
832+ resource_size(res));
833+ if (!pdata->ring_cmd_addr) {
782834 dev_err(dev, "Unable to retrieve ENET Ring command region\n");
783− return PTR_ERR(pdata->ring_cmd_addr);
835+ return -ENOMEM;
784836 }
785837
786838 ret = platform_get_irq(pdev, 0);
@@ -791,14 +843,12 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 4 unmodified lines
791843 }
792844 pdata->rx_irq = ret;
793845
794− mac = of_get_mac_address(dev->of_node);
795− if (mac)
796− memcpy(ndev->dev_addr, mac, ndev->addr_len);
797− else
846+ if (xgene_get_mac_address(dev, ndev->dev_addr) != ETH_ALEN)
798847 eth_hw_addr_random(ndev);
848+
799849 memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
800850
801− pdata->phy_mode = of_get_phy_mode(pdev->dev.of_node);
851+ pdata->phy_mode = xgene_get_phy_mode(dev);
802852 if (pdata->phy_mode < 0) {
803853 dev_err(dev, "Unable to get phy-connection-type\n");
804854 return pdata->phy_mode;
@@ -811,11 +861,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 6 unmodified lines
811861 }
812862
813863 pdata->clk = devm_clk_get(&pdev->dev, NULL);
814− ret = IS_ERR(pdata->clk);
815864 if (IS_ERR(pdata->clk)) {
816− dev_err(&pdev->dev, "can't get clock\n");
817− ret = PTR_ERR(pdata->clk);
818− return ret;
865+ /* Firmware may have set up the clock already. */
866+ pdata->clk = NULL;
819867 }
820868
821869 base_addr = pdata->base_addr;
@@ -926,7 +974,7 @@ static int xgene_enet_probe(struct platform_device *pdev) · 104 unmodified lines
926974 goto err;
927975 }
928976
929− ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
977+ ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
930978 if (ret) {
931979 netdev_err(ndev, "No usable DMA configuration\n");
932980 goto err;
@@ -974,17 +1022,26 @@ static int xgene_enet_remove(struct platform_device *pdev) · 41 unmodified lines
9741022 return 0;
9751023 }
9761024
977−static struct of_device_id xgene_enet_match[] = {
1025+#ifdef CONFIG_ACPI
1026+static const struct acpi_device_id xgene_enet_acpi_match[] = {
1027+ { "APMC0D05", },
1028+ { }
1029+};
1030+MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match);
1031+#endif
1032+
1033+static struct of_device_id xgene_enet_of_match[] = {
9781034 {.compatible = "apm,xgene-enet",},
9791035 {},
9801036 };
9811037
982−MODULE_DEVICE_TABLE(of, xgene_enet_match);
1038+MODULE_DEVICE_TABLE(of, xgene_enet_of_match);
9831039
9841040 static struct platform_driver xgene_enet_driver = {
9851041 .driver = {
9861042 .name = "xgene-enet",
987− .of_match_table = xgene_enet_match,
1043+ .of_match_table = of_match_ptr(xgene_enet_of_match),
1044+ .acpi_match_table = ACPI_PTR(xgene_enet_acpi_match),
9881045 },
9891046 .probe = xgene_enet_probe,
9901047 .remove = xgene_enet_remove,
drivers/net/ethernet/apm/xgene/xgene_enet_main.h+3−0
@@ -22,7 +22,10 @@ · 21 unmodified lines
2222 #ifndef __XGENE_ENET_MAIN_H__
2323 #define __XGENE_ENET_MAIN_H__
2424
25+#include <linux/acpi.h>
2526 #include <linux/clk.h>
27+#include <linux/efi.h>
28+#include <linux/io.h>
2629 #include <linux/of_platform.h>
2730 #include <linux/of_net.h>
2831 #include <linux/of_mdio.h>
drivers/net/ethernet/atheros/atl1c/atl1c_main.c+2−2
@@ -2235,8 +2235,8 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, · 2234 unmodified lines
22352235 return NETDEV_TX_OK;
22362236 }
22372237
2238− if (unlikely(vlan_tx_tag_present(skb))) {
2239− u16 vlan = vlan_tx_tag_get(skb);
2238+ if (unlikely(skb_vlan_tag_present(skb))) {
2239+ u16 vlan = skb_vlan_tag_get(skb);
22402240 __le16 tag;
22412241
22422242 vlan = cpu_to_le16(vlan);
drivers/net/ethernet/atheros/atl1e/atl1e_main.c+4−5
@@ -1892,8 +1892,8 @@ static netdev_tx_t atl1e_xmit_frame(struct sk_buff *skb, · 1891 unmodified lines
18921892
18931893 tpd = atl1e_get_tpd(adapter);
18941894
1895− if (vlan_tx_tag_present(skb)) {
1896− u16 vlan_tag = vlan_tx_tag_get(skb);
1895+ if (skb_vlan_tag_present(skb)) {
1896+ u16 vlan_tag = skb_vlan_tag_get(skb);
18971897 u16 atl1e_vlan_tag;
18981898
18991899 tpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT;
@@ -2373,9 +2373,8 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 473 unmodified lines
23732373
23742374 netif_napi_add(netdev, &adapter->napi, atl1e_clean, 64);
23752375
2376− init_timer(&adapter->phy_config_timer);
2377− adapter->phy_config_timer.function = atl1e_phy_config;
2378− adapter->phy_config_timer.data = (unsigned long) adapter;
2376+ setup_timer(&adapter->phy_config_timer, atl1e_phy_config,
2377+ (unsigned long)adapter);
23792378
23802379 /* get user settings */
23812380 atl1e_check_options(adapter);
drivers/net/ethernet/atheros/atlx/atl1.c+2−2
@@ -2415,8 +2415,8 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb, · 2414 unmodified lines
24152415 (u16) atomic_read(&tpd_ring->next_to_use));
24162416 memset(ptpd, 0, sizeof(struct tx_packet_desc));
24172417
2418− if (vlan_tx_tag_present(skb)) {
2419− vlan_tag = vlan_tx_tag_get(skb);
2418+ if (skb_vlan_tag_present(skb)) {
2419+ vlan_tag = skb_vlan_tag_get(skb);
24202420 vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) |
24212421 ((vlan_tag >> 9) & 0x8);
24222422 ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT;
drivers/net/ethernet/atheros/atlx/atl2.c+6−8
@@ -887,8 +887,8 @@ static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb, · 886 unmodified lines
887887 offset = ((u32)(skb->len-copy_len + 3) & ~3);
888888 }
889889 #ifdef NETIF_F_HW_VLAN_CTAG_TX
890− if (vlan_tx_tag_present(skb)) {
891− u16 vlan_tag = vlan_tx_tag_get(skb);
890+ if (skb_vlan_tag_present(skb)) {
891+ u16 vlan_tag = skb_vlan_tag_get(skb);
892892 vlan_tag = (vlan_tag << 4) |
893893 (vlan_tag >> 13) |
894894 ((vlan_tag >> 9) & 0x8);
@@ -1436,13 +1436,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 541 unmodified lines
14361436
14371437 atl2_check_options(adapter);
14381438
1439− init_timer(&adapter->watchdog_timer);
1440− adapter->watchdog_timer.function = atl2_watchdog;
1441− adapter->watchdog_timer.data = (unsigned long) adapter;
1439+ setup_timer(&adapter->watchdog_timer, atl2_watchdog,
1440+ (unsigned long)adapter);
14421441
1443− init_timer(&adapter->phy_config_timer);
1444− adapter->phy_config_timer.function = atl2_phy_config;
1445− adapter->phy_config_timer.data = (unsigned long) adapter;
1442+ setup_timer(&adapter->phy_config_timer, atl2_phy_config,
1443+ (unsigned long)adapter);
14461444
14471445 INIT_WORK(&adapter->reset_task, atl2_reset_task);
14481446 INIT_WORK(&adapter->link_chg_task, atl2_link_chg_task);
drivers/net/ethernet/broadcom/bnx2.c+2−2
@@ -6597,9 +6597,9 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) · 6596 unmodified lines
65976597 vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
65986598 }
65996599
6600− if (vlan_tx_tag_present(skb)) {
6600+ if (skb_vlan_tag_present(skb)) {
66016601 vlan_tag_flags |=
6602− (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
6602+ (TX_BD_FLAGS_VLAN_TAG | (skb_vlan_tag_get(skb) << 16));
66036603 }
66046604
66056605 if ((mss = skb_shinfo(skb)->gso_size)) {
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+1−5
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222
2323 #include <linux/ptp_clock_kernel.h>
2424 #include <linux/net_tstamp.h>
25−#include <linux/clocksource.h>
25+#include <linux/timecounter.h>
2626
2727 /* compilation time flags */
2828
@@ -1138,12 +1138,8 @@ struct bnx2x_port { · 1109 unmodified lines
11381138 u32 link_config[LINK_CONFIG_SIZE];
11391139
11401140 u32 supported[LINK_CONFIG_SIZE];
1141−/* link settings - missing defines */
1142−#define SUPPORTED_2500baseX_Full (1 << 15)
11431141
11441142 u32 advertising[LINK_CONFIG_SIZE];
1145−/* link settings - missing defines */
1146−#define ADVERTISED_2500baseX_Full (1 << 15)
11471143
11481144 u32 phy_addr;
11491145
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+2−2
@@ -3865,9 +3865,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3864 unmodified lines
38653865 "sending pkt %u @%p next_idx %u bd %u @%p\n",
38663866 pkt_prod, tx_buf, txdata->tx_pkt_prod, bd_prod, tx_start_bd);
38673867
3868− if (vlan_tx_tag_present(skb)) {
3868+ if (skb_vlan_tag_present(skb)) {
38693869 tx_start_bd->vlan_or_ethertype =
3870− cpu_to_le16(vlan_tx_tag_get(skb));
3870+ cpu_to_le16(skb_vlan_tag_get(skb));
38713871 tx_start_bd->bd_flags.as_bitfield |=
38723872 (X_ETH_OUTBAND_VLAN << ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
38733873 } else {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+5−9
@@ -9169,7 +9169,7 @@ static void bnx2x_disable_ptp(struct bnx2x *bp) · 9168 unmodified lines
91699169 }
91709170
91719171 /* Called during unload, to stop PTP-related stuff */
9172−void bnx2x_stop_ptp(struct bnx2x *bp)
9172+static void bnx2x_stop_ptp(struct bnx2x *bp)
91739173 {
91749174 /* Cancel PTP work queue. Should be done after the Tx queues are
91759175 * drained to prevent additional scheduling.
@@ -13267,14 +13267,10 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 4091 unmodified lines
1326713267 static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
1326813268 {
1326913269 struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
13270− u64 now;
1327113270
1327213271 DP(BNX2X_MSG_PTP, "PTP adjtime called, delta = %llx\n", delta);
1327313272
13274− now = timecounter_read(&bp->timecounter);
13275− now += delta;
13276− /* Re-init the timecounter */
13277− timecounter_init(&bp->timecounter, &bp->cyclecounter, now);
13273+ timecounter_adjtime(&bp->timecounter, delta);
1327813274
1327913275 return 0;
1328013276 }
@@ -13322,7 +13318,7 @@ static int bnx2x_ptp_enable(struct ptp_clock_info *ptp, · 41 unmodified lines
1332213318 return -ENOTSUPP;
1332313319 }
1332413320
13325−void bnx2x_register_phc(struct bnx2x *bp)
13321+static void bnx2x_register_phc(struct bnx2x *bp)
1332613322 {
1332713323 /* Fill the ptp_clock_info struct and register PTP clock*/
1332813324 bp->ptp_clock_info.owner = THIS_MODULE;
@@ -14614,7 +14610,7 @@ static void bnx2x_init_cyclecounter(struct bnx2x *bp) · 1285 unmodified lines
1461414610 {
1461514611 memset(&bp->cyclecounter, 0, sizeof(bp->cyclecounter));
1461614612 bp->cyclecounter.read = bnx2x_cyclecounter_read;
14617− bp->cyclecounter.mask = CLOCKSOURCE_MASK(64);
14613+ bp->cyclecounter.mask = CYCLECOUNTER_MASK(64);
1461814614 bp->cyclecounter.shift = 1;
1461914615 bp->cyclecounter.mult = 1;
1462014616 }
@@ -14639,7 +14635,7 @@ static int bnx2x_send_reset_timesync_ramrod(struct bnx2x *bp) · 18 unmodified lines
1463914635 return bnx2x_func_state_change(bp, &func_params);
1464014636 }
1464114637
14642−int bnx2x_enable_ptp_packets(struct bnx2x *bp)
14638+static int bnx2x_enable_ptp_packets(struct bnx2x *bp)
1464314639 {
1464414640 struct bnx2x_queue_state_params q_params;
1464514641 int rc, i;
drivers/net/ethernet/broadcom/tg3.c+13−16
@@ -8008,9 +8008,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · 8007 unmodified lines
80088008 !mss && skb->len > VLAN_ETH_FRAME_LEN)
80098009 base_flags |= TXD_FLAG_JMB_PKT;
80108010
8011− if (vlan_tx_tag_present(skb)) {
8011+ if (skb_vlan_tag_present(skb)) {
80128012 base_flags |= TXD_FLAG_VLAN;
8013− vlan = vlan_tx_tag_get(skb);
8013+ vlan = skb_vlan_tag_get(skb);
80148014 }
80158015
80168016 if ((unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) &&
@@ -11573,11 +11573,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 3556 unmodified lines
1157311573 tg3_flag_set(tp, INIT_COMPLETE);
1157411574 tg3_enable_ints(tp);
1157511575
11576− if (init)
11577− tg3_ptp_init(tp);
11578− else
11579− tg3_ptp_resume(tp);
11580−
11576+ tg3_ptp_resume(tp);
1158111577
1158211578 tg3_full_unlock(tp);
1158311579
@@ -11698,13 +11694,6 @@ static int tg3_open(struct net_device *dev) · 114 unmodified lines
1169811694 pci_set_power_state(tp->pdev, PCI_D3hot);
1169911695 }
1170011696
11701− if (tg3_flag(tp, PTP_CAPABLE)) {
11702− tp->ptp_clock = ptp_clock_register(&tp->ptp_info,
11703− &tp->pdev->dev);
11704− if (IS_ERR(tp->ptp_clock))
11705− tp->ptp_clock = NULL;
11706− }
11707−
1170811697 return err;
1170911698 }
1171011699
@@ -11718,8 +11707,6 @@ static int tg3_close(struct net_device *dev) · 7 unmodified lines
1171811707 return -EAGAIN;
1171911708 }
1172011709
11721− tg3_ptp_fini(tp);
11722−
1172311710 tg3_stop(tp);
1172411711
1172511712 /* Clear stats across close / open calls */
@@ -17897,6 +17884,14 @@ static int tg3_init_one(struct pci_dev *pdev, · 6171 unmodified lines
1789717884 goto err_out_apeunmap;
1789817885 }
1789917886
17887+ if (tg3_flag(tp, PTP_CAPABLE)) {
17888+ tg3_ptp_init(tp);
17889+ tp->ptp_clock = ptp_clock_register(&tp->ptp_info,
17890+ &tp->pdev->dev);
17891+ if (IS_ERR(tp->ptp_clock))
17892+ tp->ptp_clock = NULL;
17893+ }
17894+
1790017895 netdev_info(dev, "Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n",
1790117896 tp->board_part_number,
1790217897 tg3_chip_rev_id(tp),
@@ -17972,6 +17967,8 @@ static void tg3_remove_one(struct pci_dev *pdev) · 69 unmodified lines
1797217967 if (dev) {
1797317968 struct tg3 *tp = netdev_priv(dev);
1797417969
17970+ tg3_ptp_fini(tp);
17971+
1797517972 release_firmware(tp->fw);
1797617973
1797717974 tg3_reset_task_cancel(tp);
drivers/net/ethernet/brocade/bna/bnad.c+2−2
@@ -2824,8 +2824,8 @@ bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb, · 2823 unmodified lines
28242824 u32 gso_size;
28252825 u16 vlan_tag = 0;
28262826
2827− if (vlan_tx_tag_present(skb)) {
2828− vlan_tag = (u16)vlan_tx_tag_get(skb);
2827+ if (skb_vlan_tag_present(skb)) {
2828+ vlan_tag = (u16)skb_vlan_tag_get(skb);
28292829 flags |= (BNA_TXQ_WI_CF_INS_PRIO | BNA_TXQ_WI_CF_INS_VLAN);
28302830 }
28312831 if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) {
drivers/net/ethernet/cadence/macb.c+70−14
@@ -1691,7 +1691,7 @@ static int hash_get_index(__u8 *addr) · 1690 unmodified lines
16911691
16921692 for (j = 0; j < 6; j++) {
16931693 for (i = 0, bitval = 0; i < 8; i++)
1694− bitval ^= hash_bit_value(i*6 + j, addr);
1694+ bitval ^= hash_bit_value(i * 6 + j, addr);
16951695
16961696 hash_index |= (bitval << j);
16971697 }
@@ -1827,12 +1827,23 @@ static int macb_close(struct net_device *dev) · 129 unmodified lines
18271827
18281828 static void gem_update_stats(struct macb *bp)
18291829 {
1830− u32 __iomem *reg = bp->regs + GEM_OTX;
1830+ int i;
18311831 u32 *p = &bp->hw_stats.gem.tx_octets_31_0;
1832− u32 *end = &bp->hw_stats.gem.rx_udp_checksum_errors + 1;
18331832
1834− for (; p < end; p++, reg++)
1835− *p += __raw_readl(reg);
1833+ for (i = 0; i < GEM_STATS_LEN; ++i, ++p) {
1834+ u32 offset = gem_statistics[i].offset;
1835+ u64 val = __raw_readl(bp->regs + offset);
1836+
1837+ bp->ethtool_stats[i] += val;
1838+ *p += val;
1839+
1840+ if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) {
1841+ /* Add GEM_OCTTXH, GEM_OCTRXH */
1842+ val = __raw_readl(bp->regs + offset + 4);
1843+ bp->ethtool_stats[i] += ((u64)val) << 32;
1844+ *(++p) += val;
1845+ }
1846+ }
18361847 }
18371848
18381849 static struct net_device_stats *gem_get_stats(struct macb *bp)
@@ -1873,6 +1884,39 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) · 34 unmodified lines
18731884 return nstat;
18741885 }
18751886
1887+static void gem_get_ethtool_stats(struct net_device *dev,
1888+ struct ethtool_stats *stats, u64 *data)
1889+{
1890+ struct macb *bp;
1891+
1892+ bp = netdev_priv(dev);
1893+ gem_update_stats(bp);
1894+ memcpy(data, &bp->ethtool_stats, sizeof(u64) * GEM_STATS_LEN);
1895+}
1896+
1897+static int gem_get_sset_count(struct net_device *dev, int sset)
1898+{
1899+ switch (sset) {
1900+ case ETH_SS_STATS:
1901+ return GEM_STATS_LEN;
1902+ default:
1903+ return -EOPNOTSUPP;
1904+ }
1905+}
1906+
1907+static void gem_get_ethtool_strings(struct net_device *dev, u32 sset, u8 *p)
1908+{
1909+ int i;
1910+
1911+ switch (sset) {
1912+ case ETH_SS_STATS:
1913+ for (i = 0; i < GEM_STATS_LEN; i++, p += ETH_GSTRING_LEN)
1914+ memcpy(p, gem_statistics[i].stat_string,
1915+ ETH_GSTRING_LEN);
1916+ break;
1917+ }
1918+}
1919+
18761920 struct net_device_stats *macb_get_stats(struct net_device *dev)
18771921 {
18781922 struct macb *bp = netdev_priv(dev);
@@ -1991,6 +2035,18 @@ const struct ethtool_ops macb_ethtool_ops = { · 112 unmodified lines
19912035 };
19922036 EXPORT_SYMBOL_GPL(macb_ethtool_ops);
19932037
2038+static const struct ethtool_ops gem_ethtool_ops = {
2039+ .get_settings = macb_get_settings,
2040+ .set_settings = macb_set_settings,
2041+ .get_regs_len = macb_get_regs_len,
2042+ .get_regs = macb_get_regs,
2043+ .get_link = ethtool_op_get_link,
2044+ .get_ts_info = ethtool_op_get_ts_info,
2045+ .get_ethtool_stats = gem_get_ethtool_stats,
2046+ .get_strings = gem_get_ethtool_strings,
2047+ .get_sset_count = gem_get_sset_count,
2048+};
2049+
19942050 int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
19952051 {
19962052 struct macb *bp = netdev_priv(dev);
@@ -2148,7 +2204,7 @@ static void macb_probe_queues(void __iomem *mem, · 151 unmodified lines
21482204 (*num_queues)++;
21492205 }
21502206
2151−static int __init macb_probe(struct platform_device *pdev)
2207+static int macb_probe(struct platform_device *pdev)
21522208 {
21532209 struct macb_platform_data *pdata;
21542210 struct resource *regs;
@@ -2278,7 +2334,6 @@ static int __init macb_probe(struct platform_device *pdev) · 123 unmodified lines
22782334
22792335 dev->netdev_ops = &macb_netdev_ops;
22802336 netif_napi_add(dev, &bp->napi, macb_poll, 64);
2281− dev->ethtool_ops = &macb_ethtool_ops;
22822337
22832338 dev->base_addr = regs->start;
22842339
@@ -2292,12 +2347,14 @@ static int __init macb_probe(struct platform_device *pdev) · 7 unmodified lines
22922347 bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers;
22932348 bp->macbgem_ops.mog_init_rings = gem_init_rings;
22942349 bp->macbgem_ops.mog_rx = gem_rx;
2350+ dev->ethtool_ops = &gem_ethtool_ops;
22952351 } else {
22962352 bp->max_tx_length = MACB_MAX_TX_LEN;
22972353 bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers;
22982354 bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers;
22992355 bp->macbgem_ops.mog_init_rings = macb_init_rings;
23002356 bp->macbgem_ops.mog_rx = macb_rx;
2357+ dev->ethtool_ops = &macb_ethtool_ops;
23012358 }
23022359
23032360 /* Set features */
@@ -2386,7 +2443,7 @@ err_out: · 82 unmodified lines
23862443 return err;
23872444 }
23882445
2389−static int __exit macb_remove(struct platform_device *pdev)
2446+static int macb_remove(struct platform_device *pdev)
23902447 {
23912448 struct net_device *dev;
23922449 struct macb *bp;
@@ -2411,8 +2468,7 @@ static int __exit macb_remove(struct platform_device *pdev) · 18 unmodified lines
24112468 return 0;
24122469 }
24132470
2414−#ifdef CONFIG_PM
2415−static int macb_suspend(struct device *dev)
2471+static int __maybe_unused macb_suspend(struct device *dev)
24162472 {
24172473 struct platform_device *pdev = to_platform_device(dev);
24182474 struct net_device *netdev = platform_get_drvdata(pdev);
@@ -2429,7 +2485,7 @@ static int macb_suspend(struct device *dev) · 10 unmodified lines
24292485 return 0;
24302486 }
24312487
2432−static int macb_resume(struct device *dev)
2488+static int __maybe_unused macb_resume(struct device *dev)
24332489 {
24342490 struct platform_device *pdev = to_platform_device(dev);
24352491 struct net_device *netdev = platform_get_drvdata(pdev);
@@ -2444,12 +2500,12 @@ static int macb_resume(struct device *dev) · 8 unmodified lines
24442500
24452501 return 0;
24462502 }
2447−#endif
24482503
24492504 static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume);
24502505
24512506 static struct platform_driver macb_driver = {
2452− .remove = __exit_p(macb_remove),
2507+ .probe = macb_probe,
2508+ .remove = macb_remove,
24532509 .driver = {
24542510 .name = "macb",
24552511 .of_match_table = of_match_ptr(macb_dt_ids),
@@ -2457,7 +2513,7 @@ static struct platform_driver macb_driver = { · 1 unmodified line
24572513 },
24582514 };
24592515
2460−module_platform_driver_probe(macb_driver, macb_probe);
2516+module_platform_driver(macb_driver);
24612517
24622518 MODULE_LICENSE("GPL");
24632519 MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver");
drivers/net/ethernet/cadence/macb.h+388−243
@@ -15,263 +15,309 @@ · 14 unmodified lines
1515 #define MACB_MAX_QUEUES 8
1616
1717 /* MACB register offsets */
18−#define MACB_NCR 0x0000
19−#define MACB_NCFGR 0x0004
20−#define MACB_NSR 0x0008
21−#define MACB_TAR 0x000c /* AT91RM9200 only */
22−#define MACB_TCR 0x0010 /* AT91RM9200 only */
23−#define MACB_TSR 0x0014
24−#define MACB_RBQP 0x0018
25−#define MACB_TBQP 0x001c
26−#define MACB_RSR 0x0020
27−#define MACB_ISR 0x0024
28−#define MACB_IER 0x0028
29−#define MACB_IDR 0x002c
30−#define MACB_IMR 0x0030
31−#define MACB_MAN 0x0034
32−#define MACB_PTR 0x0038
33−#define MACB_PFR 0x003c
34−#define MACB_FTO 0x0040
35−#define MACB_SCF 0x0044
36−#define MACB_MCF 0x0048
37−#define MACB_FRO 0x004c
38−#define MACB_FCSE 0x0050
39−#define MACB_ALE 0x0054
40−#define MACB_DTF 0x0058
41−#define MACB_LCOL 0x005c
42−#define MACB_EXCOL 0x0060
43−#define MACB_TUND 0x0064
44−#define MACB_CSE 0x0068
45−#define MACB_RRE 0x006c
46−#define MACB_ROVR 0x0070
47−#define MACB_RSE 0x0074
48−#define MACB_ELE 0x0078
49−#define MACB_RJA 0x007c
50−#define MACB_USF 0x0080
51−#define MACB_STE 0x0084
52−#define MACB_RLE 0x0088
53−#define MACB_TPF 0x008c
54−#define MACB_HRB 0x0090
55−#define MACB_HRT 0x0094
56−#define MACB_SA1B 0x0098
57−#define MACB_SA1T 0x009c
58−#define MACB_SA2B 0x00a0
59−#define MACB_SA2T 0x00a4
60−#define MACB_SA3B 0x00a8
61−#define MACB_SA3T 0x00ac
62−#define MACB_SA4B 0x00b0
63−#define MACB_SA4T 0x00b4
64−#define MACB_TID 0x00b8
65−#define MACB_TPQ 0x00bc
66−#define MACB_USRIO 0x00c0
67−#define MACB_WOL 0x00c4
68−#define MACB_MID 0x00fc
18+#define MACB_NCR 0x0000 /* Network Control */
19+#define MACB_NCFGR 0x0004 /* Network Config */
20+#define MACB_NSR 0x0008 /* Network Status */
21+#define MACB_TAR 0x000c /* AT91RM9200 only */
22+#define MACB_TCR 0x0010 /* AT91RM9200 only */
23+#define MACB_TSR 0x0014 /* Transmit Status */
24+#define MACB_RBQP 0x0018 /* RX Q Base Address */
25+#define MACB_TBQP 0x001c /* TX Q Base Address */
26+#define MACB_RSR 0x0020 /* Receive Status */
27+#define MACB_ISR 0x0024 /* Interrupt Status */
28+#define MACB_IER 0x0028 /* Interrupt Enable */
29+#define MACB_IDR 0x002c /* Interrupt Disable */
30+#define MACB_IMR 0x0030 /* Interrupt Mask */
31+#define MACB_MAN 0x0034 /* PHY Maintenance */
32+#define MACB_PTR 0x0038
33+#define MACB_PFR 0x003c
34+#define MACB_FTO 0x0040
35+#define MACB_SCF 0x0044
36+#define MACB_MCF 0x0048
37+#define MACB_FRO 0x004c
38+#define MACB_FCSE 0x0050
39+#define MACB_ALE 0x0054
40+#define MACB_DTF 0x0058
41+#define MACB_LCOL 0x005c
42+#define MACB_EXCOL 0x0060
43+#define MACB_TUND 0x0064
44+#define MACB_CSE 0x0068
45+#define MACB_RRE 0x006c
46+#define MACB_ROVR 0x0070
47+#define MACB_RSE 0x0074
48+#define MACB_ELE 0x0078
49+#define MACB_RJA 0x007c
50+#define MACB_USF 0x0080
51+#define MACB_STE 0x0084
52+#define MACB_RLE 0x0088
53+#define MACB_TPF 0x008c
54+#define MACB_HRB 0x0090
55+#define MACB_HRT 0x0094
56+#define MACB_SA1B 0x0098
57+#define MACB_SA1T 0x009c
58+#define MACB_SA2B 0x00a0
59+#define MACB_SA2T 0x00a4
60+#define MACB_SA3B 0x00a8
61+#define MACB_SA3T 0x00ac
62+#define MACB_SA4B 0x00b0
63+#define MACB_SA4T 0x00b4
64+#define MACB_TID 0x00b8
65+#define MACB_TPQ 0x00bc
66+#define MACB_USRIO 0x00c0
67+#define MACB_WOL 0x00c4
68+#define MACB_MID 0x00fc
6969
7070 /* GEM register offsets. */
71−#define GEM_NCFGR 0x0004
72−#define GEM_USRIO 0x000c
73−#define GEM_DMACFG 0x0010
74−#define GEM_HRB 0x0080
75−#define GEM_HRT 0x0084
76−#define GEM_SA1B 0x0088
77−#define GEM_SA1T 0x008C
78−#define GEM_SA2B 0x0090
79−#define GEM_SA2T 0x0094
80−#define GEM_SA3B 0x0098
81−#define GEM_SA3T 0x009C
82−#define GEM_SA4B 0x00A0
83−#define GEM_SA4T 0x00A4
84−#define GEM_OTX 0x0100
85−#define GEM_DCFG1 0x0280
86−#define GEM_DCFG2 0x0284
87−#define GEM_DCFG3 0x0288
88−#define GEM_DCFG4 0x028c
89−#define GEM_DCFG5 0x0290
90−#define GEM_DCFG6 0x0294
91−#define GEM_DCFG7 0x0298
92−
93−#define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2))
94−#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
95−#define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2))
96−#define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2))
97−#define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2))
98−#define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2))
71+#define GEM_NCFGR 0x0004 /* Network Config */
72+#define GEM_USRIO 0x000c /* User IO */
73+#define GEM_DMACFG 0x0010 /* DMA Configuration */
74+#define GEM_HRB 0x0080 /* Hash Bottom */
75+#define GEM_HRT 0x0084 /* Hash Top */
76+#define GEM_SA1B 0x0088 /* Specific1 Bottom */
77+#define GEM_SA1T 0x008C /* Specific1 Top */
78+#define GEM_SA2B 0x0090 /* Specific2 Bottom */
79+#define GEM_SA2T 0x0094 /* Specific2 Top */
80+#define GEM_SA3B 0x0098 /* Specific3 Bottom */
81+#define GEM_SA3T 0x009C /* Specific3 Top */
82+#define GEM_SA4B 0x00A0 /* Specific4 Bottom */
83+#define GEM_SA4T 0x00A4 /* Specific4 Top */
84+#define GEM_OTX 0x0100 /* Octets transmitted */
85+#define GEM_OCTTXL 0x0100 /* Octets transmitted [31:0] */
86+#define GEM_OCTTXH 0x0104 /* Octets transmitted [47:32] */
87+#define GEM_TXCNT 0x0108 /* Frames Transmitted counter */
88+#define GEM_TXBCCNT 0x010c /* Broadcast Frames counter */
89+#define GEM_TXMCCNT 0x0110 /* Multicast Frames counter */
90+#define GEM_TXPAUSECNT 0x0114 /* Pause Frames Transmitted Counter */
91+#define GEM_TX64CNT 0x0118 /* 64 byte Frames TX counter */
92+#define GEM_TX65CNT 0x011c /* 65-127 byte Frames TX counter */
93+#define GEM_TX128CNT 0x0120 /* 128-255 byte Frames TX counter */
94+#define GEM_TX256CNT 0x0124 /* 256-511 byte Frames TX counter */
95+#define GEM_TX512CNT 0x0128 /* 512-1023 byte Frames TX counter */
96+#define GEM_TX1024CNT 0x012c /* 1024-1518 byte Frames TX counter */
97+#define GEM_TX1519CNT 0x0130 /* 1519+ byte Frames TX counter */
98+#define GEM_TXURUNCNT 0x0134 /* TX under run error counter */
99+#define GEM_SNGLCOLLCNT 0x0138 /* Single Collision Frame Counter */
100+#define GEM_MULTICOLLCNT 0x013c /* Multiple Collision Frame Counter */
101+#define GEM_EXCESSCOLLCNT 0x0140 /* Excessive Collision Frame Counter */
102+#define GEM_LATECOLLCNT 0x0144 /* Late Collision Frame Counter */
103+#define GEM_TXDEFERCNT 0x0148 /* Deferred Transmission Frame Counter */
104+#define GEM_TXCSENSECNT 0x014c /* Carrier Sense Error Counter */
105+#define GEM_ORX 0x0150 /* Octets received */
106+#define GEM_OCTRXL 0x0150 /* Octets received [31:0] */
107+#define GEM_OCTRXH 0x0154 /* Octets received [47:32] */
108+#define GEM_RXCNT 0x0158 /* Frames Received Counter */
109+#define GEM_RXBROADCNT 0x015c /* Broadcast Frames Received Counter */
110+#define GEM_RXMULTICNT 0x0160 /* Multicast Frames Received Counter */
111+#define GEM_RXPAUSECNT 0x0164 /* Pause Frames Received Counter */
112+#define GEM_RX64CNT 0x0168 /* 64 byte Frames RX Counter */
113+#define GEM_RX65CNT 0x016c /* 65-127 byte Frames RX Counter */
114+#define GEM_RX128CNT 0x0170 /* 128-255 byte Frames RX Counter */
115+#define GEM_RX256CNT 0x0174 /* 256-511 byte Frames RX Counter */
116+#define GEM_RX512CNT 0x0178 /* 512-1023 byte Frames RX Counter */
117+#define GEM_RX1024CNT 0x017c /* 1024-1518 byte Frames RX Counter */
118+#define GEM_RX1519CNT 0x0180 /* 1519+ byte Frames RX Counter */
119+#define GEM_RXUNDRCNT 0x0184 /* Undersize Frames Received Counter */
120+#define GEM_RXOVRCNT 0x0188 /* Oversize Frames Received Counter */
121+#define GEM_RXJABCNT 0x018c /* Jabbers Received Counter */
122+#define GEM_RXFCSCNT 0x0190 /* Frame Check Sequence Error Counter */
123+#define GEM_RXLENGTHCNT 0x0194 /* Length Field Error Counter */
124+#define GEM_RXSYMBCNT 0x0198 /* Symbol Error Counter */
125+#define GEM_RXALIGNCNT 0x019c /* Alignment Error Counter */
126+#define GEM_RXRESERRCNT 0x01a0 /* Receive Resource Error Counter */
127+#define GEM_RXORCNT 0x01a4 /* Receive Overrun Counter */
128+#define GEM_RXIPCCNT 0x01a8 /* IP header Checksum Error Counter */
129+#define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error Counter */
130+#define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error Counter */
131+#define GEM_DCFG1 0x0280 /* Design Config 1 */
132+#define GEM_DCFG2 0x0284 /* Design Config 2 */
133+#define GEM_DCFG3 0x0288 /* Design Config 3 */
134+#define GEM_DCFG4 0x028c /* Design Config 4 */
135+#define GEM_DCFG5 0x0290 /* Design Config 5 */
136+#define GEM_DCFG6 0x0294 /* Design Config 6 */
137+#define GEM_DCFG7 0x0298 /* Design Config 7 */
138+
139+#define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2))
140+#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
141+#define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2))
142+#define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2))
143+#define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2))
144+#define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2))
99145
100146 /* Bitfields in NCR */
101−#define MACB_LB_OFFSET 0
102−#define MACB_LB_SIZE 1
103−#define MACB_LLB_OFFSET 1
104−#define MACB_LLB_SIZE 1
105−#define MACB_RE_OFFSET 2
106−#define MACB_RE_SIZE 1
107−#define MACB_TE_OFFSET 3
108−#define MACB_TE_SIZE 1
109−#define MACB_MPE_OFFSET 4
110−#define MACB_MPE_SIZE 1
111−#define MACB_CLRSTAT_OFFSET 5
112−#define MACB_CLRSTAT_SIZE 1
113−#define MACB_INCSTAT_OFFSET 6
114−#define MACB_INCSTAT_SIZE 1
115−#define MACB_WESTAT_OFFSET 7
116−#define MACB_WESTAT_SIZE 1
117−#define MACB_BP_OFFSET 8
118−#define MACB_BP_SIZE 1
119−#define MACB_TSTART_OFFSET 9
120−#define MACB_TSTART_SIZE 1
121−#define MACB_THALT_OFFSET 10
122−#define MACB_THALT_SIZE 1
123−#define MACB_NCR_TPF_OFFSET 11
124−#define MACB_NCR_TPF_SIZE 1
125−#define MACB_TZQ_OFFSET 12
126−#define MACB_TZQ_SIZE 1
147+#define MACB_LB_OFFSET 0 /* reserved */
148+#define MACB_LB_SIZE 1
149+#define MACB_LLB_OFFSET 1 /* Loop back local */
150+#define MACB_LLB_SIZE 1
151+#define MACB_RE_OFFSET 2 /* Receive enable */
152+#define MACB_RE_SIZE 1
153+#define MACB_TE_OFFSET 3 /* Transmit enable */
154+#define MACB_TE_SIZE 1
155+#define MACB_MPE_OFFSET 4 /* Management port enable */
156+#define MACB_MPE_SIZE 1
157+#define MACB_CLRSTAT_OFFSET 5 /* Clear stats regs */
158+#define MACB_CLRSTAT_SIZE 1
159+#define MACB_INCSTAT_OFFSET 6 /* Incremental stats regs */
160+#define MACB_INCSTAT_SIZE 1
161+#define MACB_WESTAT_OFFSET 7 /* Write enable stats regs */
162+#define MACB_WESTAT_SIZE 1
163+#define MACB_BP_OFFSET 8 /* Back pressure */
164+#define MACB_BP_SIZE 1
165+#define MACB_TSTART_OFFSET 9 /* Start transmission */
166+#define MACB_TSTART_SIZE 1
167+#define MACB_THALT_OFFSET 10 /* Transmit halt */
168+#define MACB_THALT_SIZE 1
169+#define MACB_NCR_TPF_OFFSET 11 /* Transmit pause frame */
170+#define MACB_NCR_TPF_SIZE 1
171+#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */
172+#define MACB_TZQ_SIZE 1
127173
128174 /* Bitfields in NCFGR */
129−#define MACB_SPD_OFFSET 0
130−#define MACB_SPD_SIZE 1
131−#define MACB_FD_OFFSET 1
132−#define MACB_FD_SIZE 1
133−#define MACB_BIT_RATE_OFFSET 2
134−#define MACB_BIT_RATE_SIZE 1
135−#define MACB_JFRAME_OFFSET 3
136−#define MACB_JFRAME_SIZE 1
137−#define MACB_CAF_OFFSET 4
138−#define MACB_CAF_SIZE 1
139−#define MACB_NBC_OFFSET 5
140−#define MACB_NBC_SIZE 1
141−#define MACB_NCFGR_MTI_OFFSET 6
142−#define MACB_NCFGR_MTI_SIZE 1
143−#define MACB_UNI_OFFSET 7
144−#define MACB_UNI_SIZE 1
145−#define MACB_BIG_OFFSET 8
146−#define MACB_BIG_SIZE 1
147−#define MACB_EAE_OFFSET 9
148−#define MACB_EAE_SIZE 1
149−#define MACB_CLK_OFFSET 10
150−#define MACB_CLK_SIZE 2
151−#define MACB_RTY_OFFSET 12
152−#define MACB_RTY_SIZE 1
153−#define MACB_PAE_OFFSET 13
154−#define MACB_PAE_SIZE 1
155−#define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */
156−#define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */
157−#define MACB_RBOF_OFFSET 14
158−#define MACB_RBOF_SIZE 2
159−#define MACB_RLCE_OFFSET 16
160−#define MACB_RLCE_SIZE 1
161−#define MACB_DRFCS_OFFSET 17
162−#define MACB_DRFCS_SIZE 1
163−#define MACB_EFRHD_OFFSET 18
164−#define MACB_EFRHD_SIZE 1
165−#define MACB_IRXFCS_OFFSET 19
166−#define MACB_IRXFCS_SIZE 1
175+#define MACB_SPD_OFFSET 0 /* Speed */
176+#define MACB_SPD_SIZE 1
177+#define MACB_FD_OFFSET 1 /* Full duplex */
178+#define MACB_FD_SIZE 1
179+#define MACB_BIT_RATE_OFFSET 2 /* Discard non-VLAN frames */
180+#define MACB_BIT_RATE_SIZE 1
181+#define MACB_JFRAME_OFFSET 3 /* reserved */
182+#define MACB_JFRAME_SIZE 1
183+#define MACB_CAF_OFFSET 4 /* Copy all frames */
184+#define MACB_CAF_SIZE 1
185+#define MACB_NBC_OFFSET 5 /* No broadcast */
186+#define MACB_NBC_SIZE 1
187+#define MACB_NCFGR_MTI_OFFSET 6 /* Multicast hash enable */
188+#define MACB_NCFGR_MTI_SIZE 1
189+#define MACB_UNI_OFFSET 7 /* Unicast hash enable */
190+#define MACB_UNI_SIZE 1
191+#define MACB_BIG_OFFSET 8 /* Receive 1536 byte frames */
192+#define MACB_BIG_SIZE 1
193+#define MACB_EAE_OFFSET 9 /* External address match enable */
194+#define MACB_EAE_SIZE 1
195+#define MACB_CLK_OFFSET 10
196+#define MACB_CLK_SIZE 2
197+#define MACB_RTY_OFFSET 12 /* Retry test */
198+#define MACB_RTY_SIZE 1
199+#define MACB_PAE_OFFSET 13 /* Pause enable */
200+#define MACB_PAE_SIZE 1
201+#define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */
202+#define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */
203+#define MACB_RBOF_OFFSET 14 /* Receive buffer offset */
204+#define MACB_RBOF_SIZE 2
205+#define MACB_RLCE_OFFSET 16 /* Length field error frame discard */
206+#define MACB_RLCE_SIZE 1
207+#define MACB_DRFCS_OFFSET 17 /* FCS remove */
208+#define MACB_DRFCS_SIZE 1
209+#define MACB_EFRHD_OFFSET 18
210+#define MACB_EFRHD_SIZE 1
211+#define MACB_IRXFCS_OFFSET 19
212+#define MACB_IRXFCS_SIZE 1
167213
168214 /* GEM specific NCFGR bitfields. */
169−#define GEM_GBE_OFFSET 10
170−#define GEM_GBE_SIZE 1
171−#define GEM_CLK_OFFSET 18
172−#define GEM_CLK_SIZE 3
173−#define GEM_DBW_OFFSET 21
174−#define GEM_DBW_SIZE 2
175−#define GEM_RXCOEN_OFFSET 24
176−#define GEM_RXCOEN_SIZE 1
215+#define GEM_GBE_OFFSET 10 /* Gigabit mode enable */
216+#define GEM_GBE_SIZE 1
217+#define GEM_CLK_OFFSET 18 /* MDC clock division */
218+#define GEM_CLK_SIZE 3
219+#define GEM_DBW_OFFSET 21 /* Data bus width */
220+#define GEM_DBW_SIZE 2
221+#define GEM_RXCOEN_OFFSET 24
222+#define GEM_RXCOEN_SIZE 1
177223
178224 /* Constants for data bus width. */
179−#define GEM_DBW32 0
180−#define GEM_DBW64 1
181−#define GEM_DBW128 2
225+#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus width */
226+#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus width */
227+#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus width */
182228
183229 /* Bitfields in DMACFG. */
184−#define GEM_FBLDO_OFFSET 0
185−#define GEM_FBLDO_SIZE 5
186−#define GEM_ENDIA_OFFSET 7
187−#define GEM_ENDIA_SIZE 1
188−#define GEM_RXBMS_OFFSET 8
189−#define GEM_RXBMS_SIZE 2
190−#define GEM_TXPBMS_OFFSET 10
191−#define GEM_TXPBMS_SIZE 1
192−#define GEM_TXCOEN_OFFSET 11
193−#define GEM_TXCOEN_SIZE 1
194−#define GEM_RXBS_OFFSET 16
195−#define GEM_RXBS_SIZE 8
196−#define GEM_DDRP_OFFSET 24
197−#define GEM_DDRP_SIZE 1
230+#define GEM_FBLDO_OFFSET 0 /* fixed burst length for DMA */
231+#define GEM_FBLDO_SIZE 5
232+#define GEM_ENDIA_OFFSET 7 /* endian swap mode for packet data access */
233+#define GEM_ENDIA_SIZE 1
234+#define GEM_RXBMS_OFFSET 8 /* RX packet buffer memory size select */
235+#define GEM_RXBMS_SIZE 2
236+#define GEM_TXPBMS_OFFSET 10 /* TX packet buffer memory size select */
237+#define GEM_TXPBMS_SIZE 1
238+#define GEM_TXCOEN_OFFSET 11 /* TX IP/TCP/UDP checksum gen offload */
239+#define GEM_TXCOEN_SIZE 1
240+#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size */
241+#define GEM_RXBS_SIZE 8
242+#define GEM_DDRP_OFFSET 24 /* disc_when_no_ahb */
243+#define GEM_DDRP_SIZE 1
198244
199245
200246 /* Bitfields in NSR */
201−#define MACB_NSR_LINK_OFFSET 0
202−#define MACB_NSR_LINK_SIZE 1
203−#define MACB_MDIO_OFFSET 1
204−#define MACB_MDIO_SIZE 1
205−#define MACB_IDLE_OFFSET 2
206−#define MACB_IDLE_SIZE 1
247+#define MACB_NSR_LINK_OFFSET 0 /* pcs_link_state */
248+#define MACB_NSR_LINK_SIZE 1
249+#define MACB_MDIO_OFFSET 1 /* status of the mdio_in pin */
250+#define MACB_MDIO_SIZE 1
251+#define MACB_IDLE_OFFSET 2 /* The PHY management logic is idle */
252+#define MACB_IDLE_SIZE 1
207253
208254 /* Bitfields in TSR */
209−#define MACB_UBR_OFFSET 0
210−#define MACB_UBR_SIZE 1
211−#define MACB_COL_OFFSET 1
212−#define MACB_COL_SIZE 1
213−#define MACB_TSR_RLE_OFFSET 2
214−#define MACB_TSR_RLE_SIZE 1
215−#define MACB_TGO_OFFSET 3
216−#define MACB_TGO_SIZE 1
217−#define MACB_BEX_OFFSET 4
218−#define MACB_BEX_SIZE 1
219−#define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */
220−#define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */
221−#define MACB_COMP_OFFSET 5
222−#define MACB_COMP_SIZE 1
223−#define MACB_UND_OFFSET 6
224−#define MACB_UND_SIZE 1
255+#define MACB_UBR_OFFSET 0 /* Used bit read */
256+#define MACB_UBR_SIZE 1
257+#define MACB_COL_OFFSET 1 /* Collision occurred */
258+#define MACB_COL_SIZE 1
259+#define MACB_TSR_RLE_OFFSET 2 /* Retry limit exceeded */
260+#define MACB_TSR_RLE_SIZE 1
261+#define MACB_TGO_OFFSET 3 /* Transmit go */
262+#define MACB_TGO_SIZE 1
263+#define MACB_BEX_OFFSET 4 /* TX frame corruption due to AHB error */
264+#define MACB_BEX_SIZE 1
265+#define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */
266+#define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */
267+#define MACB_COMP_OFFSET 5 /* Trnasmit complete */
268+#define MACB_COMP_SIZE 1
269+#define MACB_UND_OFFSET 6 /* Trnasmit under run */
270+#define MACB_UND_SIZE 1
225271
226272 /* Bitfields in RSR */
227−#define MACB_BNA_OFFSET 0
228−#define MACB_BNA_SIZE 1
229−#define MACB_REC_OFFSET 1
230−#define MACB_REC_SIZE 1
231−#define MACB_OVR_OFFSET 2
232−#define MACB_OVR_SIZE 1
273+#define MACB_BNA_OFFSET 0 /* Buffer not available */
274+#define MACB_BNA_SIZE 1
275+#define MACB_REC_OFFSET 1 /* Frame received */
276+#define MACB_REC_SIZE 1
277+#define MACB_OVR_OFFSET 2 /* Receive overrun */
278+#define MACB_OVR_SIZE 1
233279
234280 /* Bitfields in ISR/IER/IDR/IMR */
235−#define MACB_MFD_OFFSET 0
236−#define MACB_MFD_SIZE 1
237−#define MACB_RCOMP_OFFSET 1
238−#define MACB_RCOMP_SIZE 1
239−#define MACB_RXUBR_OFFSET 2
240−#define MACB_RXUBR_SIZE 1
241−#define MACB_TXUBR_OFFSET 3
242−#define MACB_TXUBR_SIZE 1
243−#define MACB_ISR_TUND_OFFSET 4
244−#define MACB_ISR_TUND_SIZE 1
245−#define MACB_ISR_RLE_OFFSET 5
246−#define MACB_ISR_RLE_SIZE 1
247−#define MACB_TXERR_OFFSET 6
248−#define MACB_TXERR_SIZE 1
249−#define MACB_TCOMP_OFFSET 7
250−#define MACB_TCOMP_SIZE 1
251−#define MACB_ISR_LINK_OFFSET 9
252−#define MACB_ISR_LINK_SIZE 1
253−#define MACB_ISR_ROVR_OFFSET 10
254−#define MACB_ISR_ROVR_SIZE 1
255−#define MACB_HRESP_OFFSET 11
256−#define MACB_HRESP_SIZE 1
257−#define MACB_PFR_OFFSET 12
258−#define MACB_PFR_SIZE 1
259−#define MACB_PTZ_OFFSET 13
260−#define MACB_PTZ_SIZE 1
281+#define MACB_MFD_OFFSET 0 /* Management frame sent */
282+#define MACB_MFD_SIZE 1
283+#define MACB_RCOMP_OFFSET 1 /* Receive complete */
284+#define MACB_RCOMP_SIZE 1
285+#define MACB_RXUBR_OFFSET 2 /* RX used bit read */
286+#define MACB_RXUBR_SIZE 1
287+#define MACB_TXUBR_OFFSET 3 /* TX used bit read */
288+#define MACB_TXUBR_SIZE 1
289+#define MACB_ISR_TUND_OFFSET 4 /* Enable TX buffer under run interrupt */
290+#define MACB_ISR_TUND_SIZE 1
291+#define MACB_ISR_RLE_OFFSET 5 /* EN retry exceeded/late coll interrupt */
292+#define MACB_ISR_RLE_SIZE 1
293+#define MACB_TXERR_OFFSET 6 /* EN TX frame corrupt from error interrupt */
294+#define MACB_TXERR_SIZE 1
295+#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete interrupt */
296+#define MACB_TCOMP_SIZE 1
297+#define MACB_ISR_LINK_OFFSET 9 /* Enable link change interrupt */
298+#define MACB_ISR_LINK_SIZE 1
299+#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun interrupt */
300+#define MACB_ISR_ROVR_SIZE 1
301+#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK interrupt */
302+#define MACB_HRESP_SIZE 1
303+#define MACB_PFR_OFFSET 12 /* Enable pause frame w/ quantum interrupt */
304+#define MACB_PFR_SIZE 1
305+#define MACB_PTZ_OFFSET 13 /* Enable pause time zero interrupt */
306+#define MACB_PTZ_SIZE 1
261307
262308 /* Bitfields in MAN */
263−#define MACB_DATA_OFFSET 0
264−#define MACB_DATA_SIZE 16
265−#define MACB_CODE_OFFSET 16
266−#define MACB_CODE_SIZE 2
267−#define MACB_REGA_OFFSET 18
268−#define MACB_REGA_SIZE 5
269−#define MACB_PHYA_OFFSET 23
270−#define MACB_PHYA_SIZE 5
271−#define MACB_RW_OFFSET 28
272−#define MACB_RW_SIZE 2
273−#define MACB_SOF_OFFSET 30
274−#define MACB_SOF_SIZE 2
309+#define MACB_DATA_OFFSET 0 /* data */
310+#define MACB_DATA_SIZE 16
311+#define MACB_CODE_OFFSET 16 /* Must be written to 10 */
312+#define MACB_CODE_SIZE 2
313+#define MACB_REGA_OFFSET 18 /* Register address */
314+#define MACB_REGA_SIZE 5
315+#define MACB_PHYA_OFFSET 23 /* PHY address */
316+#define MACB_PHYA_SIZE 5
317+#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01 is write. */
318+#define MACB_RW_SIZE 2
319+#define MACB_SOF_OFFSET 30 /* Must be written to 1 for Clause 22 */
320+#define MACB_SOF_SIZE 2
275321
276322 /* Bitfields in USRIO (AVR32) */
277323 #define MACB_MII_OFFSET 0
@@ -286,7 +332,7 @@ · 8 unmodified lines
286332 /* Bitfields in USRIO (AT91) */
287333 #define MACB_RMII_OFFSET 0
288334 #define MACB_RMII_SIZE 1
289−#define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */
335+#define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */
290336 #define GEM_RGMII_SIZE 1
291337 #define MACB_CLKEN_OFFSET 1
292338 #define MACB_CLKEN_SIZE 1
@@ -389,8 +435,7 @@ · 96 unmodified lines
389435 #define queue_writel(queue, reg, value) \
390436 __raw_writel((value), (queue)->bp->regs + (queue)->reg)
391437
392−/*
393− * Conditional GEM/MACB macros. These perform the operation to the correct
438+/* Conditional GEM/MACB macros. These perform the operation to the correct
394439 * register dependent on whether the device is a GEM or a MACB. For registers
395440 * and bitfields that are common across both devices, use macb_{read,write}l
396441 * to avoid the cost of the conditional.
@@ -413,8 +458,7 @@ · 16 unmodified lines
413458 __v; \
414459 })
415460
416−/**
417− * struct macb_dma_desc - Hardware DMA descriptor
461+/* struct macb_dma_desc - Hardware DMA descriptor
418462 * @addr: DMA address of data buffer
419463 * @ctrl: Control and status bits
420464 */
@@ -503,8 +547,7 @@ struct macb_dma_desc { · 82 unmodified lines
503547 /* limit RX checksum offload to TCP and UDP packets */
504548 #define GEM_RX_CSUM_CHECKED_MASK 2
505549
506−/**
507− * struct macb_tx_skb - data about an skb which is being transmitted
550+/* struct macb_tx_skb - data about an skb which is being transmitted
508551 * @skb: skb currently being transmitted, only set for the last buffer
509552 * of the frame
510553 * @mapping: DMA address of the skb's fragment buffer
@@ -519,8 +562,7 @@ struct macb_tx_skb { · 8 unmodified lines
519562 bool mapped_as_page;
520563 };
521564
522−/*
523− * Hardware-collected statistics. Used when updating the network
565+/* Hardware-collected statistics. Used when updating the network
524566 * device stats by a periodic timer.
525567 */
526568 struct macb_stats {
@@ -595,6 +637,107 @@ struct gem_stats { · 68 unmodified lines
595637 u32 rx_udp_checksum_errors;
596638 };
597639
640+/* Describes the name and offset of an individual statistic register, as
641+ * returned by `ethtool -S`. Also describes which net_device_stats statistics
642+ * this register should contribute to.
643+ */
644+struct gem_statistic {
645+ char stat_string[ETH_GSTRING_LEN];
646+ int offset;
647+ u32 stat_bits;
648+};
649+
650+/* Bitfield defs for net_device_stat statistics */
651+#define GEM_NDS_RXERR_OFFSET 0
652+#define GEM_NDS_RXLENERR_OFFSET 1
653+#define GEM_NDS_RXOVERERR_OFFSET 2
654+#define GEM_NDS_RXCRCERR_OFFSET 3
655+#define GEM_NDS_RXFRAMEERR_OFFSET 4
656+#define GEM_NDS_RXFIFOERR_OFFSET 5
657+#define GEM_NDS_TXERR_OFFSET 6
658+#define GEM_NDS_TXABORTEDERR_OFFSET 7
659+#define GEM_NDS_TXCARRIERERR_OFFSET 8
660+#define GEM_NDS_TXFIFOERR_OFFSET 9
661+#define GEM_NDS_COLLISIONS_OFFSET 10
662+
663+#define GEM_STAT_TITLE(name, title) GEM_STAT_TITLE_BITS(name, title, 0)
664+#define GEM_STAT_TITLE_BITS(name, title, bits) { \
665+ .stat_string = title, \
666+ .offset = GEM_##name, \
667+ .stat_bits = bits \
668+}
669+
670+/* list of gem statistic registers. The names MUST match the
671+ * corresponding GEM_* definitions.
672+ */
673+static const struct gem_statistic gem_statistics[] = {
674+ GEM_STAT_TITLE(OCTTXL, "tx_octets"), /* OCTTXH combined with OCTTXL */
675+ GEM_STAT_TITLE(TXCNT, "tx_frames"),
676+ GEM_STAT_TITLE(TXBCCNT, "tx_broadcast_frames"),
677+ GEM_STAT_TITLE(TXMCCNT, "tx_multicast_frames"),
678+ GEM_STAT_TITLE(TXPAUSECNT, "tx_pause_frames"),
679+ GEM_STAT_TITLE(TX64CNT, "tx_64_byte_frames"),
680+ GEM_STAT_TITLE(TX65CNT, "tx_65_127_byte_frames"),
681+ GEM_STAT_TITLE(TX128CNT, "tx_128_255_byte_frames"),
682+ GEM_STAT_TITLE(TX256CNT, "tx_256_511_byte_frames"),
683+ GEM_STAT_TITLE(TX512CNT, "tx_512_1023_byte_frames"),
684+ GEM_STAT_TITLE(TX1024CNT, "tx_1024_1518_byte_frames"),
685+ GEM_STAT_TITLE(TX1519CNT, "tx_greater_than_1518_byte_frames"),
686+ GEM_STAT_TITLE_BITS(TXURUNCNT, "tx_underrun",
687+ GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_TXFIFOERR)),
688+ GEM_STAT_TITLE_BITS(SNGLCOLLCNT, "tx_single_collision_frames",
689+ GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)),
690+ GEM_STAT_TITLE_BITS(MULTICOLLCNT, "tx_multiple_collision_frames",
691+ GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)),
692+ GEM_STAT_TITLE_BITS(EXCESSCOLLCNT, "tx_excessive_collisions",
693+ GEM_BIT(NDS_TXERR)|
694+ GEM_BIT(NDS_TXABORTEDERR)|
695+ GEM_BIT(NDS_COLLISIONS)),
696+ GEM_STAT_TITLE_BITS(LATECOLLCNT, "tx_late_collisions",
697+ GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)),
698+ GEM_STAT_TITLE(TXDEFERCNT, "tx_deferred_frames"),
699+ GEM_STAT_TITLE_BITS(TXCSENSECNT, "tx_carrier_sense_errors",
700+ GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)),
701+ GEM_STAT_TITLE(OCTRXL, "rx_octets"), /* OCTRXH combined with OCTRXL */
702+ GEM_STAT_TITLE(RXCNT, "rx_frames"),
703+ GEM_STAT_TITLE(RXBROADCNT, "rx_broadcast_frames"),
704+ GEM_STAT_TITLE(RXMULTICNT, "rx_multicast_frames"),
705+ GEM_STAT_TITLE(RXPAUSECNT, "rx_pause_frames"),
706+ GEM_STAT_TITLE(RX64CNT, "rx_64_byte_frames"),
707+ GEM_STAT_TITLE(RX65CNT, "rx_65_127_byte_frames"),
708+ GEM_STAT_TITLE(RX128CNT, "rx_128_255_byte_frames"),
709+ GEM_STAT_TITLE(RX256CNT, "rx_256_511_byte_frames"),
710+ GEM_STAT_TITLE(RX512CNT, "rx_512_1023_byte_frames"),
711+ GEM_STAT_TITLE(RX1024CNT, "rx_1024_1518_byte_frames"),
712+ GEM_STAT_TITLE(RX1519CNT, "rx_greater_than_1518_byte_frames"),
713+ GEM_STAT_TITLE_BITS(RXUNDRCNT, "rx_undersized_frames",
714+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXLENERR)),
715+ GEM_STAT_TITLE_BITS(RXOVRCNT, "rx_oversize_frames",
716+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXLENERR)),
717+ GEM_STAT_TITLE_BITS(RXJABCNT, "rx_jabbers",
718+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXLENERR)),
719+ GEM_STAT_TITLE_BITS(RXFCSCNT, "rx_frame_check_sequence_errors",
720+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXCRCERR)),
721+ GEM_STAT_TITLE_BITS(RXLENGTHCNT, "rx_length_field_frame_errors",
722+ GEM_BIT(NDS_RXERR)),
723+ GEM_STAT_TITLE_BITS(RXSYMBCNT, "rx_symbol_errors",
724+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXFRAMEERR)),
725+ GEM_STAT_TITLE_BITS(RXALIGNCNT, "rx_alignment_errors",
726+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXOVERERR)),
727+ GEM_STAT_TITLE_BITS(RXRESERRCNT, "rx_resource_errors",
728+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXOVERERR)),
729+ GEM_STAT_TITLE_BITS(RXORCNT, "rx_overruns",
730+ GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXFIFOERR)),
731+ GEM_STAT_TITLE_BITS(RXIPCCNT, "rx_ip_header_checksum_errors",
732+ GEM_BIT(NDS_RXERR)),
733+ GEM_STAT_TITLE_BITS(RXTCPCCNT, "rx_tcp_checksum_errors",
734+ GEM_BIT(NDS_RXERR)),
735+ GEM_STAT_TITLE_BITS(RXUDPCCNT, "rx_udp_checksum_errors",
736+ GEM_BIT(NDS_RXERR)),
737+};
738+
739+#define GEM_STATS_LEN ARRAY_SIZE(gem_statistics)
740+
598741 struct macb;
599742
600743 struct macb_or_gem_ops {
@@ -673,6 +816,8 @@ struct macb { · 72 unmodified lines
673816 dma_addr_t skb_physaddr; /* phys addr from pci_map_single */
674817 int skb_length; /* saved skb length for pci_unmap_single */
675818 unsigned int max_tx_length;
819+
820+ u64 ethtool_stats[GEM_STATS_LEN];
676821 };
677822
678823 extern const struct ethtool_ops macb_ethtool_ops;
drivers/net/ethernet/chelsio/cxgb/sge.c+2−2
@@ -1860,9 +1860,9 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) · 1859 unmodified lines
18601860 }
18611861 cpl->iff = dev->if_port;
18621862
1863− if (vlan_tx_tag_present(skb)) {
1863+ if (skb_vlan_tag_present(skb)) {
18641864 cpl->vlan_valid = 1;
1865− cpl->vlan = htons(vlan_tx_tag_get(skb));
1865+ cpl->vlan = htons(skb_vlan_tag_get(skb));
18661866 st->vlan_insert++;
18671867 } else
18681868 cpl->vlan_valid = 0;
drivers/net/ethernet/chelsio/cxgb3/mc5.c+0−16
@@ -97,14 +97,6 @@ static int mc5_cmd_write(struct adapter *adapter, u32 cmd) · 96 unmodified lines
9797 F_DBGIRSPVALID, 1, MAX_WRITE_ATTEMPTS, 1);
9898 }
9999
100−static inline void dbgi_wr_addr3(struct adapter *adapter, u32 v1, u32 v2,
101− u32 v3)
102−{
103− t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_ADDR0, v1);
104− t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_ADDR1, v2);
105− t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_ADDR2, v3);
106−}
107−
108100 static inline void dbgi_wr_data3(struct adapter *adapter, u32 v1, u32 v2,
109101 u32 v3)
110102 {
@@ -113,14 +105,6 @@ static inline void dbgi_wr_data3(struct adapter *adapter, u32 v1, u32 v2, · 2 unmodified lines
113105 t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_DATA2, v3);
114106 }
115107
116−static inline void dbgi_rd_rsp3(struct adapter *adapter, u32 *v1, u32 *v2,
117− u32 *v3)
118−{
119− *v1 = t3_read_reg(adapter, A_MC5_DB_DBGI_RSP_DATA0);
120− *v2 = t3_read_reg(adapter, A_MC5_DB_DBGI_RSP_DATA1);
121− *v3 = t3_read_reg(adapter, A_MC5_DB_DBGI_RSP_DATA2);
122−}
123−
124108 /*
125109 * Write data to the TCAM register at address (0, 0, addr_lo) using the TCAM
126110 * command cmd. The data to be written must have been set up by the caller.
drivers/net/ethernet/chelsio/cxgb3/sge.c+3−3
@@ -1148,8 +1148,8 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 1147 unmodified lines
11481148 cpl->len = htonl(skb->len);
11491149 cntrl = V_TXPKT_INTF(pi->port_id);
11501150
1151− if (vlan_tx_tag_present(skb))
1152− cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(vlan_tx_tag_get(skb));
1151+ if (skb_vlan_tag_present(skb))
1152+ cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(skb_vlan_tag_get(skb));
11531153
11541154 tso_info = V_LSO_MSS(skb_shinfo(skb)->gso_size);
11551155 if (tso_info) {
@@ -1282,7 +1282,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 126 unmodified lines
12821282 qs->port_stats[SGE_PSTAT_TX_CSUM]++;
12831283 if (skb_shinfo(skb)->gso_size)
12841284 qs->port_stats[SGE_PSTAT_TSO]++;
1285− if (vlan_tx_tag_present(skb))
1285+ if (skb_vlan_tag_present(skb))
12861286 qs->port_stats[SGE_PSTAT_VLANINS]++;
12871287
12881288 /*
drivers/net/ethernet/chelsio/cxgb3/t3_hw.c+3−3
@@ -727,9 +727,9 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) · 726 unmodified lines
727727 p->xauicfg[1] = simple_strtoul(vpd.xaui1cfg_data, NULL, 16);
728728 }
729729
730− for (i = 0; i < 6; i++)
731− p->eth_base[i] = hex_to_bin(vpd.na_data[2 * i]) * 16 +
732− hex_to_bin(vpd.na_data[2 * i + 1]);
730+ ret = hex2bin(p->eth_base, vpd.na_data, 6);
731+ if (ret < 0)
732+ return -EINVAL;
733733 return 0;
734734 }
735735
drivers/net/ethernet/chelsio/cxgb4/Makefile+1−1
@@ -4,6 +4,6 @@ · 3 unmodified lines
44
55 obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
66
7−cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o
7+cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o
88 cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o
99 cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o
drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c+317−0
@@ -0,0 +1,317 @@
1+/*
2+ * This file is part of the Chelsio T4 Ethernet driver for Linux.
3+ * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved.
4+ *
5+ * Written by Deepak (deepak.s@chelsio.com)
6+ *
7+ * This program is distributed in the hope that it will be useful, but WITHOUT
8+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9+ * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this
10+ * release for licensing terms and conditions.
11+ */
12+
13+#include <linux/module.h>
14+#include <linux/netdevice.h>
15+#include <linux/jhash.h>
16+#include <linux/if_vlan.h>
17+#include <net/addrconf.h>
18+#include "cxgb4.h"
19+#include "clip_tbl.h"
20+
21+static inline unsigned int ipv4_clip_hash(struct clip_tbl *c, const u32 *key)
22+{
23+ unsigned int clipt_size_half = c->clipt_size / 2;
24+
25+ return jhash_1word(*key, 0) % clipt_size_half;
26+}
27+
28+static inline unsigned int ipv6_clip_hash(struct clip_tbl *d, const u32 *key)
29+{
30+ unsigned int clipt_size_half = d->clipt_size / 2;
31+ u32 xor = key[0] ^ key[1] ^ key[2] ^ key[3];
32+
33+ return clipt_size_half +
34+ (jhash_1word(xor, 0) % clipt_size_half);
35+}
36+
37+static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr,
38+ int addr_len)
39+{
40+ return addr_len == 4 ? ipv4_clip_hash(ctbl, addr) :
41+ ipv6_clip_hash(ctbl, addr);
42+}
43+
44+static int clip6_get_mbox(const struct net_device *dev,
45+ const struct in6_addr *lip)
46+{
47+ struct adapter *adap = netdev2adap(dev);
48+ struct fw_clip_cmd c;
49+
50+ memset(&c, 0, sizeof(c));
51+ c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) |
52+ FW_CMD_REQUEST_F | FW_CMD_WRITE_F);
53+ c.alloc_to_len16 = htonl(FW_CLIP_CMD_ALLOC_F | FW_LEN16(c));
54+ *(__be64 *)&c.ip_hi = *(__be64 *)(lip->s6_addr);
55+ *(__be64 *)&c.ip_lo = *(__be64 *)(lip->s6_addr + 8);
56+ return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false);
57+}
58+
59+static int clip6_release_mbox(const struct net_device *dev,
60+ const struct in6_addr *lip)
61+{
62+ struct adapter *adap = netdev2adap(dev);
63+ struct fw_clip_cmd c;
64+
65+ memset(&c, 0, sizeof(c));
66+ c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) |
67+ FW_CMD_REQUEST_F | FW_CMD_READ_F);
68+ c.alloc_to_len16 = htonl(FW_CLIP_CMD_FREE_F | FW_LEN16(c));
69+ *(__be64 *)&c.ip_hi = *(__be64 *)(lip->s6_addr);
70+ *(__be64 *)&c.ip_lo = *(__be64 *)(lip->s6_addr + 8);
71+ return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false);
72+}
73+
74+int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6)
75+{
76+ struct adapter *adap = netdev2adap(dev);
77+ struct clip_tbl *ctbl = adap->clipt;
78+ struct clip_entry *ce, *cte;
79+ u32 *addr = (u32 *)lip;
80+ int hash;
81+ int addr_len;
82+ int ret = 0;
83+
84+ if (!ctbl)
85+ return 0;
86+
87+ if (v6)
88+ addr_len = 16;
89+ else
90+ addr_len = 4;
91+
92+ hash = clip_addr_hash(ctbl, addr, addr_len);
93+
94+ read_lock_bh(&ctbl->lock);
95+ list_for_each_entry(cte, &ctbl->hash_list[hash], list) {
96+ if (addr_len == cte->addr_len &&
97+ memcmp(lip, cte->addr, cte->addr_len) == 0) {
98+ ce = cte;
99+ read_unlock_bh(&ctbl->lock);
100+ goto found;
101+ }
102+ }
103+ read_unlock_bh(&ctbl->lock);
104+
105+ write_lock_bh(&ctbl->lock);
106+ if (!list_empty(&ctbl->ce_free_head)) {
107+ ce = list_first_entry(&ctbl->ce_free_head,
108+ struct clip_entry, list);
109+ list_del(&ce->list);
110+ INIT_LIST_HEAD(&ce->list);
111+ spin_lock_init(&ce->lock);
112+ atomic_set(&ce->refcnt, 0);
113+ atomic_dec(&ctbl->nfree);
114+ ce->addr_len = addr_len;
115+ memcpy(ce->addr, lip, addr_len);
116+ list_add_tail(&ce->list, &ctbl->hash_list[hash]);
117+ if (v6) {
118+ ret = clip6_get_mbox(dev, (const struct in6_addr *)lip);
119+ if (ret) {
120+ write_unlock_bh(&ctbl->lock);
121+ return ret;
122+ }
123+ }
124+ } else {
125+ write_unlock_bh(&ctbl->lock);
126+ return -ENOMEM;
127+ }
128+ write_unlock_bh(&ctbl->lock);
129+found:
130+ atomic_inc(&ce->refcnt);
131+
132+ return 0;
133+}
134+EXPORT_SYMBOL(cxgb4_clip_get);
135+
136+void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6)
137+{
138+ struct adapter *adap = netdev2adap(dev);
139+ struct clip_tbl *ctbl = adap->clipt;
140+ struct clip_entry *ce, *cte;
141+ u32 *addr = (u32 *)lip;
142+ int hash;
143+ int addr_len;
144+
145+ if (v6)
146+ addr_len = 16;
147+ else
148+ addr_len = 4;
149+
150+ hash = clip_addr_hash(ctbl, addr, addr_len);
151+
152+ read_lock_bh(&ctbl->lock);
153+ list_for_each_entry(cte, &ctbl->hash_list[hash], list) {
154+ if (addr_len == cte->addr_len &&
155+ memcmp(lip, cte->addr, cte->addr_len) == 0) {
156+ ce = cte;
157+ read_unlock_bh(&ctbl->lock);
158+ goto found;
159+ }
160+ }
161+ read_unlock_bh(&ctbl->lock);
162+
163+ return;
164+found:
165+ write_lock_bh(&ctbl->lock);
166+ spin_lock_bh(&ce->lock);
167+ if (atomic_dec_and_test(&ce->refcnt)) {
168+ list_del(&ce->list);
169+ INIT_LIST_HEAD(&ce->list);
170+ list_add_tail(&ce->list, &ctbl->ce_free_head);
171+ atomic_inc(&ctbl->nfree);
172+ if (v6)
173+ clip6_release_mbox(dev, (const struct in6_addr *)lip);
174+ }
175+ spin_unlock_bh(&ce->lock);
176+ write_unlock_bh(&ctbl->lock);
177+}
178+EXPORT_SYMBOL(cxgb4_clip_release);
179+
180+/* Retrieves IPv6 addresses from a root device (bond, vlan) associated with
181+ * a physical device.
182+ * The physical device reference is needed to send the actul CLIP command.
183+ */
184+static int cxgb4_update_dev_clip(struct net_device *root_dev,
185+ struct net_device *dev)
186+{
187+ struct inet6_dev *idev = NULL;
188+ struct inet6_ifaddr *ifa;
189+ int ret = 0;
190+
191+ idev = __in6_dev_get(root_dev);
192+ if (!idev)
193+ return ret;
194+
195+ read_lock_bh(&idev->lock);
196+ list_for_each_entry(ifa, &idev->addr_list, if_list) {
197+ ret = cxgb4_clip_get(dev, (const u32 *)ifa->addr.s6_addr, 1);
198+ if (ret < 0)
199+ break;
200+ }
201+ read_unlock_bh(&idev->lock);
202+
203+ return ret;
204+}
205+
206+int cxgb4_update_root_dev_clip(struct net_device *dev)
207+{
208+ struct net_device *root_dev = NULL;
209+ int i, ret = 0;
210+
211+ /* First populate the real net device's IPv6 addresses */
212+ ret = cxgb4_update_dev_clip(dev, dev);
213+ if (ret)
214+ return ret;
215+
216+ /* Parse all bond and vlan devices layered on top of the physical dev */
217+ root_dev = netdev_master_upper_dev_get_rcu(dev);
218+ if (root_dev) {
219+ ret = cxgb4_update_dev_clip(root_dev, dev);
220+ if (ret)
221+ return ret;
222+ }
223+
224+ for (i = 0; i < VLAN_N_VID; i++) {
225+ root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i);
226+ if (!root_dev)
227+ continue;
228+
229+ ret = cxgb4_update_dev_clip(root_dev, dev);
230+ if (ret)
231+ break;
232+ }
233+
234+ return ret;
235+}
236+EXPORT_SYMBOL(cxgb4_update_root_dev_clip);
237+
238+int clip_tbl_show(struct seq_file *seq, void *v)
239+{
240+ struct adapter *adapter = seq->private;
241+ struct clip_tbl *ctbl = adapter->clipt;
242+ struct clip_entry *ce;
243+ char ip[60];
244+ int i;
245+
246+ read_lock_bh(&ctbl->lock);
247+
248+ seq_puts(seq, "IP Address Users\n");
249+ for (i = 0 ; i < ctbl->clipt_size; ++i) {
250+ list_for_each_entry(ce, &ctbl->hash_list[i], list) {
251+ ip[0] = '\0';
252+ if (ce->addr_len == 16)
253+ sprintf(ip, "%pI6c", ce->addr);
254+ else
255+ sprintf(ip, "%pI4c", ce->addr);
256+ seq_printf(seq, "%-25s %u\n", ip,
257+ atomic_read(&ce->refcnt));
258+ }
259+ }
260+ seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree));
261+
262+ read_unlock_bh(&ctbl->lock);
263+
264+ return 0;
265+}
266+
267+struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
268+ unsigned int clipt_end)
269+{
270+ struct clip_entry *cl_list;
271+ struct clip_tbl *ctbl;
272+ unsigned int clipt_size;
273+ int i;
274+
275+ if (clipt_start >= clipt_end)
276+ return NULL;
277+ clipt_size = clipt_end - clipt_start + 1;
278+ if (clipt_size < CLIPT_MIN_HASH_BUCKETS)
279+ return NULL;
280+
281+ ctbl = t4_alloc_mem(sizeof(*ctbl) +
282+ clipt_size*sizeof(struct list_head));
283+ if (!ctbl)
284+ return NULL;
285+
286+ ctbl->clipt_start = clipt_start;
287+ ctbl->clipt_size = clipt_size;
288+ INIT_LIST_HEAD(&ctbl->ce_free_head);
289+
290+ atomic_set(&ctbl->nfree, clipt_size);
291+ rwlock_init(&ctbl->lock);
292+
293+ for (i = 0; i < ctbl->clipt_size; ++i)
294+ INIT_LIST_HEAD(&ctbl->hash_list[i]);
295+
296+ cl_list = t4_alloc_mem(clipt_size*sizeof(struct clip_entry));
297+ ctbl->cl_list = (void *)cl_list;
298+
299+ for (i = 0; i < clipt_size; i++) {
300+ INIT_LIST_HEAD(&cl_list[i].list);
301+ list_add_tail(&cl_list[i].list, &ctbl->ce_free_head);
302+ }
303+
304+ return ctbl;
305+}
306+
307+void t4_cleanup_clip_tbl(struct adapter *adap)
308+{
309+ struct clip_tbl *ctbl = adap->clipt;
310+
311+ if (ctbl) {
312+ if (ctbl->cl_list)
313+ t4_free_mem(ctbl->cl_list);
314+ t4_free_mem(ctbl);
315+ }
316+}
317+EXPORT_SYMBOL(t4_cleanup_clip_tbl);
drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h+41−0
@@ -0,0 +1,41 @@
1+/*
2+ * This file is part of the Chelsio T4 Ethernet driver for Linux.
3+ * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved.
4+ *
5+ * Written by Deepak (deepak.s@chelsio.com)
6+ *
7+ * This program is distributed in the hope that it will be useful, but WITHOUT
8+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9+ * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this
10+ * release for licensing terms and conditions.
11+ */
12+
13+struct clip_entry {
14+ spinlock_t lock; /* Hold while modifying clip reference */
15+ atomic_t refcnt;
16+ struct list_head list;
17+ u32 addr[4];
18+ int addr_len;
19+};
20+
21+struct clip_tbl {
22+ unsigned int clipt_start;
23+ unsigned int clipt_size;
24+ rwlock_t lock;
25+ atomic_t nfree;
26+ struct list_head ce_free_head;
27+ void *cl_list;
28+ struct list_head hash_list[0];
29+};
30+
31+enum {
32+ CLIPT_MIN_HASH_BUCKETS = 2,
33+};
34+
35+struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
36+ unsigned int clipt_end);
37+int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6);
38+void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6);
39+int clip_tbl_show(struct seq_file *seq, void *v);
40+int cxgb4_update_root_dev_clip(struct net_device *dev);
41+void t4_cleanup_clip_tbl(struct adapter *adap);
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+159−10
@@ -49,16 +49,6 @@ · 48 unmodified lines
4949 #include <asm/io.h>
5050 #include "cxgb4_uld.h"
5151
52−#define T4FW_VERSION_MAJOR 0x01
53−#define T4FW_VERSION_MINOR 0x0C
54−#define T4FW_VERSION_MICRO 0x19
55−#define T4FW_VERSION_BUILD 0x00
56−
57−#define T5FW_VERSION_MAJOR 0x01
58−#define T5FW_VERSION_MINOR 0x0C
59−#define T5FW_VERSION_MICRO 0x19
60−#define T5FW_VERSION_BUILD 0x00
61−
6252 #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
6353
6454 enum {
@@ -231,6 +221,7 @@ struct sge_params { · 166 unmodified lines
231221 struct tp_params {
232222 unsigned int ntxchan; /* # of Tx channels */
233223 unsigned int tre; /* log2 of core clocks per TP tick */
224+ unsigned int la_mask; /* what events are recorded by TP LA */
234225 unsigned short tx_modq_map; /* TX modulation scheduler queue to */
235226 /* channel map */
236227
@@ -290,11 +281,21 @@ enum chip_type { · 53 unmodified lines
290281 T5_LAST_REV = T5_A1,
291282 };
292283
284+struct devlog_params {
285+ u32 memtype; /* which memory (EDC0, EDC1, MC) */
286+ u32 start; /* start of log in firmware memory */
287+ u32 size; /* size of log */
288+};
289+
293290 struct adapter_params {
294291 struct sge_params sge;
295292 struct tp_params tp;
296293 struct vpd_params vpd;
297294 struct pci_params pci;
295+ struct devlog_params devlog;
296+ enum pcie_memwin drv_memwin;
297+
298+ unsigned int cim_la_size;
298299
299300 unsigned int sf_size; /* serial flash size in bytes */
300301 unsigned int sf_nsec; /* # of flash sectors */
@@ -476,6 +477,22 @@ struct sge_rspq { /* state for an SGE response queue */ · 175 unmodified lines
476477 struct adapter *adap;
477478 struct net_device *netdev; /* associated net device */
478479 rspq_handler_t handler;
480+#ifdef CONFIG_NET_RX_BUSY_POLL
481+#define CXGB_POLL_STATE_IDLE 0
482+#define CXGB_POLL_STATE_NAPI BIT(0) /* NAPI owns this poll */
483+#define CXGB_POLL_STATE_POLL BIT(1) /* poll owns this poll */
484+#define CXGB_POLL_STATE_NAPI_YIELD BIT(2) /* NAPI yielded this poll */
485+#define CXGB_POLL_STATE_POLL_YIELD BIT(3) /* poll yielded this poll */
486+#define CXGB_POLL_YIELD (CXGB_POLL_STATE_NAPI_YIELD | \
487+ CXGB_POLL_STATE_POLL_YIELD)
488+#define CXGB_POLL_LOCKED (CXGB_POLL_STATE_NAPI | \
489+ CXGB_POLL_STATE_POLL)
490+#define CXGB_POLL_USER_PEND (CXGB_POLL_STATE_POLL | \
491+ CXGB_POLL_STATE_POLL_YIELD)
492+ unsigned int bpoll_state;
493+ spinlock_t bpoll_lock; /* lock for busy poll */
494+#endif /* CONFIG_NET_RX_BUSY_POLL */
495+
479496 };
480497
481498 struct sge_eth_stats { /* Ethernet queue statistics */
@@ -658,6 +675,9 @@ struct adapter { · 176 unmodified lines
658675 unsigned int l2t_start;
659676 unsigned int l2t_end;
660677 struct l2t_data *l2t;
678+ unsigned int clipt_start;
679+ unsigned int clipt_end;
680+ struct clip_tbl *clipt;
661681 void *uld_handle[CXGB4_ULD_MAX];
662682 struct list_head list_node;
663683 struct list_head rcu_node;
@@ -877,6 +897,102 @@ static inline struct adapter *netdev2adap(const struct net_device *dev) · 213 unmodified lines
877897 return netdev2pinfo(dev)->adapter;
878898 }
879899
900+#ifdef CONFIG_NET_RX_BUSY_POLL
901+static inline void cxgb_busy_poll_init_lock(struct sge_rspq *q)
902+{
903+ spin_lock_init(&q->bpoll_lock);
904+ q->bpoll_state = CXGB_POLL_STATE_IDLE;
905+}
906+
907+static inline bool cxgb_poll_lock_napi(struct sge_rspq *q)
908+{
909+ bool rc = true;
910+
911+ spin_lock(&q->bpoll_lock);
912+ if (q->bpoll_state & CXGB_POLL_LOCKED) {
913+ q->bpoll_state |= CXGB_POLL_STATE_NAPI_YIELD;
914+ rc = false;
915+ } else {
916+ q->bpoll_state = CXGB_POLL_STATE_NAPI;
917+ }
918+ spin_unlock(&q->bpoll_lock);
919+ return rc;
920+}
921+
922+static inline bool cxgb_poll_unlock_napi(struct sge_rspq *q)
923+{
924+ bool rc = false;
925+
926+ spin_lock(&q->bpoll_lock);
927+ if (q->bpoll_state & CXGB_POLL_STATE_POLL_YIELD)
928+ rc = true;
929+ q->bpoll_state = CXGB_POLL_STATE_IDLE;
930+ spin_unlock(&q->bpoll_lock);
931+ return rc;
932+}
933+
934+static inline bool cxgb_poll_lock_poll(struct sge_rspq *q)
935+{
936+ bool rc = true;
937+
938+ spin_lock_bh(&q->bpoll_lock);
939+ if (q->bpoll_state & CXGB_POLL_LOCKED) {
940+ q->bpoll_state |= CXGB_POLL_STATE_POLL_YIELD;
941+ rc = false;
942+ } else {
943+ q->bpoll_state |= CXGB_POLL_STATE_POLL;
944+ }
945+ spin_unlock_bh(&q->bpoll_lock);
946+ return rc;
947+}
948+
949+static inline bool cxgb_poll_unlock_poll(struct sge_rspq *q)
950+{
951+ bool rc = false;
952+
953+ spin_lock_bh(&q->bpoll_lock);
954+ if (q->bpoll_state & CXGB_POLL_STATE_POLL_YIELD)
955+ rc = true;
956+ q->bpoll_state = CXGB_POLL_STATE_IDLE;
957+ spin_unlock_bh(&q->bpoll_lock);
958+ return rc;
959+}
960+
961+static inline bool cxgb_poll_busy_polling(struct sge_rspq *q)
962+{
963+ return q->bpoll_state & CXGB_POLL_USER_PEND;
964+}
965+#else
966+static inline void cxgb_busy_poll_init_lock(struct sge_rspq *q)
967+{
968+}
969+
970+static inline bool cxgb_poll_lock_napi(struct sge_rspq *q)
971+{
972+ return true;
973+}
974+
975+static inline bool cxgb_poll_unlock_napi(struct sge_rspq *q)
976+{
977+ return false;
978+}
979+
980+static inline bool cxgb_poll_lock_poll(struct sge_rspq *q)
981+{
982+ return false;
983+}
984+
985+static inline bool cxgb_poll_unlock_poll(struct sge_rspq *q)
986+{
987+ return false;
988+}
989+
990+static inline bool cxgb_poll_busy_polling(struct sge_rspq *q)
991+{
992+ return false;
993+}
994+#endif /* CONFIG_NET_RX_BUSY_POLL */
995+
880996 void t4_os_portmod_changed(const struct adapter *adap, int port_id);
881997 void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
882998
@@ -905,6 +1021,7 @@ irqreturn_t t4_sge_intr_msix(int irq, void *cookie); · 22 unmodified lines
9051021 int t4_sge_init(struct adapter *adap);
9061022 void t4_sge_start(struct adapter *adap);
9071023 void t4_sge_stop(struct adapter *adap);
1024+int cxgb_busy_poll(struct napi_struct *napi);
9081025 extern int dbfifo_int_thresh;
9091026
9101027 #define for_each_port(adapter, iter) \
@@ -995,12 +1112,16 @@ static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, · 84 unmodified lines
9951112
9961113 int t4_seeprom_wp(struct adapter *adapter, bool enable);
9971114 int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
1115+int t4_read_flash(struct adapter *adapter, unsigned int addr,
1116+ unsigned int nwords, u32 *data, int byte_oriented);
9981117 int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
1118+int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op);
9991119 int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
10001120 const u8 *fw_data, unsigned int size, int force);
10011121 unsigned int t4_flash_cfg_addr(struct adapter *adapter);
10021122 int t4_get_fw_version(struct adapter *adapter, u32 *vers);
10031123 int t4_get_tp_version(struct adapter *adapter, u32 *vers);
1124+int t4_get_exprom_version(struct adapter *adapter, u32 *vers);
10041125 int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
10051126 const u8 *fw_data, unsigned int fw_size,
10061127 struct fw_hdr *card_fw, enum dev_state state, int *reset);
@@ -1013,6 +1134,8 @@ int cxgb4_t4_bar2_sge_qregs(struct adapter *adapter, · 6 unmodified lines
10131134 u64 *pbar2_qoffset,
10141135 unsigned int *pbar2_qid);
10151136
1137+unsigned int qtimer_val(const struct adapter *adap,
1138+ const struct sge_rspq *q);
10161139 int t4_init_sge_params(struct adapter *adapter);
10171140 int t4_init_tp_params(struct adapter *adap);
10181141 int t4_filter_field_shift(const struct adapter *adap, int filter_sel);
@@ -1022,20 +1145,46 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, · 3 unmodified lines
10221145 int start, int n, const u16 *rspq, unsigned int nrspq);
10231146 int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode,
10241147 unsigned int flags);
1148+int t4_read_rss(struct adapter *adapter, u16 *entries);
1149+void t4_read_rss_key(struct adapter *adapter, u32 *key);
1150+void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx);
1151+void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index,
1152+ u32 *valp);
1153+void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index,
1154+ u32 *vfl, u32 *vfh);
1155+u32 t4_read_rss_pf_map(struct adapter *adapter);
1156+u32 t4_read_rss_pf_mask(struct adapter *adapter);
1157+
10251158 int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data,
10261159 u64 *parity);
10271160 int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data,
10281161 u64 *parity);
1162+void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
1163+void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
1164+int t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data,
1165+ size_t n);
1166+int t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data,
1167+ size_t n);
1168+int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n,
1169+ unsigned int *valp);
1170+int t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n,
1171+ const unsigned int *valp);
1172+int t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr);
1173+void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres);
10291174 const char *t4_get_port_type_description(enum fw_port_type port_type);
10301175 void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
10311176 void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
1177+void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]);
10321178 void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
10331179 unsigned int mask, unsigned int val);
1180+void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr);
10341181 void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
10351182 struct tp_tcp_stats *v6);
10361183 void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
10371184 const unsigned short *alpha, const unsigned short *beta);
10381185
1186+void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf);
1187+
10391188 void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid);
10401189
10411190 void t4_wol_magic_enable(struct adapter *adap, unsigned int port,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c+97−3
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222
2323 /* DCBx version control
2424 */
25−char *dcb_ver_array[] = {
25+static const char * const dcb_ver_array[] = {
2626 "Unknown",
2727 "DCBx-CIN",
2828 "DCBx-CEE 1.01",
@@ -428,7 +428,10 @@ static void cxgb4_getpgtccfg(struct net_device *dev, int tc, · 399 unmodified lines
428428 }
429429 *pgid = (be32_to_cpu(pcmd.u.dcb.pgid.pgid) >> (tc * 4)) & 0xf;
430430
431− INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id);
431+ if (local)
432+ INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id);
433+ else
434+ INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id);
432435 pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE;
433436 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
434437 if (err != FW_PORT_DCB_CFG_SUCCESS) {
@@ -900,6 +903,88 @@ cxgb4_ieee_negotiation_complete(struct net_device *dev, · 465 unmodified lines
900903 (dcb->supported & DCB_CAP_DCBX_VER_IEEE));
901904 }
902905
906+static int cxgb4_ieee_read_ets(struct net_device *dev, struct ieee_ets *ets,
907+ int local)
908+{
909+ struct port_info *pi = netdev2pinfo(dev);
910+ struct port_dcb_info *dcb = &pi->dcb;
911+ struct adapter *adap = pi->adapter;
912+ uint32_t tc_info;
913+ struct fw_port_cmd pcmd;
914+ int i, bwg, err;
915+
916+ if (!(dcb->msgs & (CXGB4_DCB_FW_PGID | CXGB4_DCB_FW_PGRATE)))
917+ return 0;
918+
919+ ets->ets_cap = dcb->pg_num_tcs_supported;
920+
921+ if (local) {
922+ ets->willing = 1;
923+ INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id);
924+ } else {
925+ INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id);
926+ }
927+
928+ pcmd.u.dcb.pgid.type = FW_PORT_DCB_TYPE_PGID;
929+ err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
930+ if (err != FW_PORT_DCB_CFG_SUCCESS) {
931+ dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err);
932+ return err;
933+ }
934+
935+ tc_info = be32_to_cpu(pcmd.u.dcb.pgid.pgid);
936+
937+ if (local)
938+ INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id);
939+ else
940+ INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id);
941+
942+ pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE;
943+ err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
944+ if (err != FW_PORT_DCB_CFG_SUCCESS) {
945+ dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n",
946+ -err);
947+ return err;
948+ }
949+
950+ for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
951+ bwg = (tc_info >> ((7 - i) * 4)) & 0xF;
952+ ets->prio_tc[i] = bwg;
953+ ets->tc_tx_bw[i] = pcmd.u.dcb.pgrate.pgrate[i];
954+ ets->tc_rx_bw[i] = ets->tc_tx_bw[i];
955+ ets->tc_tsa[i] = pcmd.u.dcb.pgrate.tsa[i];
956+ }
957+
958+ return 0;
959+}
960+
961+static int cxgb4_ieee_get_ets(struct net_device *dev, struct ieee_ets *ets)
962+{
963+ return cxgb4_ieee_read_ets(dev, ets, 1);
964+}
965+
966+/* We reuse this for peer PFC as well, as we can't have it enabled one way */
967+static int cxgb4_ieee_get_pfc(struct net_device *dev, struct ieee_pfc *pfc)
968+{
969+ struct port_info *pi = netdev2pinfo(dev);
970+ struct port_dcb_info *dcb = &pi->dcb;
971+
972+ memset(pfc, 0, sizeof(struct ieee_pfc));
973+
974+ if (!(dcb->msgs & CXGB4_DCB_FW_PFC))
975+ return 0;
976+
977+ pfc->pfc_cap = dcb->pfc_num_tcs_supported;
978+ pfc->pfc_en = bitswap_1(dcb->pfcen);
979+
980+ return 0;
981+}
982+
983+static int cxgb4_ieee_peer_ets(struct net_device *dev, struct ieee_ets *ets)
984+{
985+ return cxgb4_ieee_read_ets(dev, ets, 0);
986+}
987+
903988 /* Fill in the Application User Priority Map associated with the
904989 * specified Application.
905990 * Priority for IEEE dcb_app is an integer, with 0 being a valid value
@@ -1106,14 +1191,23 @@ static int cxgb4_cee_peer_getpfc(struct net_device *dev, struct cee_pfc *pfc) · 200 unmodified lines
11061191 struct port_info *pi = netdev2pinfo(dev);
11071192
11081193 cxgb4_getnumtcs(dev, DCB_NUMTCS_ATTR_PFC, &(pfc->tcs_supported));
1109− pfc->pfc_en = pi->dcb.pfcen;
1194+
1195+ /* Firmware sends this to us in a formwat that is a bit flipped version
1196+ * of spec, correct it before we send it to host. This is taken care of
1197+ * by bit shifting in other uses of pfcen
1198+ */
1199+ pfc->pfc_en = bitswap_1(pi->dcb.pfcen);
11101200
11111201 return 0;
11121202 }
11131203
11141204 const struct dcbnl_rtnl_ops cxgb4_dcb_ops = {
1205+ .ieee_getets = cxgb4_ieee_get_ets,
1206+ .ieee_getpfc = cxgb4_ieee_get_pfc,
11151207 .ieee_getapp = cxgb4_ieee_getapp,
11161208 .ieee_setapp = cxgb4_ieee_setapp,
1209+ .ieee_peer_getets = cxgb4_ieee_peer_ets,
1210+ .ieee_peer_getpfc = cxgb4_ieee_get_pfc,
11171211
11181212 /* CEE std */
11191213 .getstate = cxgb4_getstate,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h+11−0
@@ -136,6 +136,17 @@ void cxgb4_dcb_handle_fw_update(struct adapter *, const struct fw_port_cmd *); · 135 unmodified lines
136136 void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *);
137137 extern const struct dcbnl_rtnl_ops cxgb4_dcb_ops;
138138
139+static inline __u8 bitswap_1(unsigned char val)
140+{
141+ return ((val & 0x80) >> 7) |
142+ ((val & 0x40) >> 5) |
143+ ((val & 0x20) >> 3) |
144+ ((val & 0x10) >> 1) |
145+ ((val & 0x08) << 1) |
146+ ((val & 0x04) << 3) |
147+ ((val & 0x02) << 5) |
148+ ((val & 0x01) << 7);
149+}
139150 #define CXGB4_DCB_ENABLED true
140151
141152 #else /* !CONFIG_CHELSIO_T4_DCB */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c+1916−1
@@ -36,13 +36,1867 @@ · 35 unmodified lines
3636 #include <linux/debugfs.h>
3737 #include <linux/string_helpers.h>
3838 #include <linux/sort.h>
39+#include <linux/ctype.h>
3940
4041 #include "cxgb4.h"
4142 #include "t4_regs.h"
43+#include "t4_values.h"
4244 #include "t4fw_api.h"
4345 #include "cxgb4_debugfs.h"
46+#include "clip_tbl.h"
4447 #include "l2t.h"
4548
49+/* generic seq_file support for showing a table of size rows x width. */
50+static void *seq_tab_get_idx(struct seq_tab *tb, loff_t pos)
51+{
52+ pos -= tb->skip_first;
53+ return pos >= tb->rows ? NULL : &tb->data[pos * tb->width];
54+}
55+
56+static void *seq_tab_start(struct seq_file *seq, loff_t *pos)
57+{
58+ struct seq_tab *tb = seq->private;
59+
60+ if (tb->skip_first && *pos == 0)
61+ return SEQ_START_TOKEN;
62+
63+ return seq_tab_get_idx(tb, *pos);
64+}
65+
66+static void *seq_tab_next(struct seq_file *seq, void *v, loff_t *pos)
67+{
68+ v = seq_tab_get_idx(seq->private, *pos + 1);
69+ if (v)
70+ ++*pos;
71+ return v;
72+}
73+
74+static void seq_tab_stop(struct seq_file *seq, void *v)
75+{
76+}
77+
78+static int seq_tab_show(struct seq_file *seq, void *v)
79+{
80+ const struct seq_tab *tb = seq->private;
81+
82+ return tb->show(seq, v, ((char *)v - tb->data) / tb->width);
83+}
84+
85+static const struct seq_operations seq_tab_ops = {
86+ .start = seq_tab_start,
87+ .next = seq_tab_next,
88+ .stop = seq_tab_stop,
89+ .show = seq_tab_show
90+};
91+
92+struct seq_tab *seq_open_tab(struct file *f, unsigned int rows,
93+ unsigned int width, unsigned int have_header,
94+ int (*show)(struct seq_file *seq, void *v, int i))
95+{
96+ struct seq_tab *p;
97+
98+ p = __seq_open_private(f, &seq_tab_ops, sizeof(*p) + rows * width);
99+ if (p) {
100+ p->show = show;
101+ p->rows = rows;
102+ p->width = width;
103+ p->skip_first = have_header != 0;
104+ }
105+ return p;
106+}
107+
108+/* Trim the size of a seq_tab to the supplied number of rows. The operation is
109+ * irreversible.
110+ */
111+static int seq_tab_trim(struct seq_tab *p, unsigned int new_rows)
112+{
113+ if (new_rows > p->rows)
114+ return -EINVAL;
115+ p->rows = new_rows;
116+ return 0;
117+}
118+
119+static int cim_la_show(struct seq_file *seq, void *v, int idx)
120+{
121+ if (v == SEQ_START_TOKEN)
122+ seq_puts(seq, "Status Data PC LS0Stat LS0Addr "
123+ " LS0Data\n");
124+ else {
125+ const u32 *p = v;
126+
127+ seq_printf(seq,
128+ " %02x %x%07x %x%07x %08x %08x %08x%08x%08x%08x\n",
129+ (p[0] >> 4) & 0xff, p[0] & 0xf, p[1] >> 4,
130+ p[1] & 0xf, p[2] >> 4, p[2] & 0xf, p[3], p[4], p[5],
131+ p[6], p[7]);
132+ }
133+ return 0;
134+}
135+
136+static int cim_la_show_3in1(struct seq_file *seq, void *v, int idx)
137+{
138+ if (v == SEQ_START_TOKEN) {
139+ seq_puts(seq, "Status Data PC\n");
140+ } else {
141+ const u32 *p = v;
142+
143+ seq_printf(seq, " %02x %08x %08x\n", p[5] & 0xff, p[6],
144+ p[7]);
145+ seq_printf(seq, " %02x %02x%06x %02x%06x\n",
146+ (p[3] >> 8) & 0xff, p[3] & 0xff, p[4] >> 8,
147+ p[4] & 0xff, p[5] >> 8);
148+ seq_printf(seq, " %02x %x%07x %x%07x\n", (p[0] >> 4) & 0xff,
149+ p[0] & 0xf, p[1] >> 4, p[1] & 0xf, p[2] >> 4);
150+ }
151+ return 0;
152+}
153+
154+static int cim_la_open(struct inode *inode, struct file *file)
155+{
156+ int ret;
157+ unsigned int cfg;
158+ struct seq_tab *p;
159+ struct adapter *adap = inode->i_private;
160+
161+ ret = t4_cim_read(adap, UP_UP_DBG_LA_CFG_A, 1, &cfg);
162+ if (ret)
163+ return ret;
164+
165+ p = seq_open_tab(file, adap->params.cim_la_size / 8, 8 * sizeof(u32), 1,
166+ cfg & UPDBGLACAPTPCONLY_F ?
167+ cim_la_show_3in1 : cim_la_show);
168+ if (!p)
169+ return -ENOMEM;
170+
171+ ret = t4_cim_read_la(adap, (u32 *)p->data, NULL);
172+ if (ret)
173+ seq_release_private(inode, file);
174+ return ret;
175+}
176+
177+static const struct file_operations cim_la_fops = {
178+ .owner = THIS_MODULE,
179+ .open = cim_la_open,
180+ .read = seq_read,
181+ .llseek = seq_lseek,
182+ .release = seq_release_private
183+};
184+
185+static int cim_qcfg_show(struct seq_file *seq, void *v)
186+{
187+ static const char * const qname[] = {
188+ "TP0", "TP1", "ULP", "SGE0", "SGE1", "NC-SI",
189+ "ULP0", "ULP1", "ULP2", "ULP3", "SGE", "NC-SI",
190+ "SGE0-RX", "SGE1-RX"
191+ };
192+
193+ int i;
194+ struct adapter *adap = seq->private;
195+ u16 base[CIM_NUM_IBQ + CIM_NUM_OBQ_T5];
196+ u16 size[CIM_NUM_IBQ + CIM_NUM_OBQ_T5];
197+ u32 stat[(4 * (CIM_NUM_IBQ + CIM_NUM_OBQ_T5))];
198+ u16 thres[CIM_NUM_IBQ];
199+ u32 obq_wr_t4[2 * CIM_NUM_OBQ], *wr;
200+ u32 obq_wr_t5[2 * CIM_NUM_OBQ_T5];
201+ u32 *p = stat;
202+ int cim_num_obq = is_t4(adap->params.chip) ?
203+ CIM_NUM_OBQ : CIM_NUM_OBQ_T5;
204+
205+ i = t4_cim_read(adap, is_t4(adap->params.chip) ? UP_IBQ_0_RDADDR_A :
206+ UP_IBQ_0_SHADOW_RDADDR_A,
207+ ARRAY_SIZE(stat), stat);
208+ if (!i) {
209+ if (is_t4(adap->params.chip)) {
210+ i = t4_cim_read(adap, UP_OBQ_0_REALADDR_A,
211+ ARRAY_SIZE(obq_wr_t4), obq_wr_t4);
212+ wr = obq_wr_t4;
213+ } else {
214+ i = t4_cim_read(adap, UP_OBQ_0_SHADOW_REALADDR_A,
215+ ARRAY_SIZE(obq_wr_t5), obq_wr_t5);
216+ wr = obq_wr_t5;
217+ }
218+ }
219+ if (i)
220+ return i;
221+
222+ t4_read_cimq_cfg(adap, base, size, thres);
223+
224+ seq_printf(seq,
225+ " Queue Base Size Thres RdPtr WrPtr SOP EOP Avail\n");
226+ for (i = 0; i < CIM_NUM_IBQ; i++, p += 4)
227+ seq_printf(seq, "%7s %5x %5u %5u %6x %4x %4u %4u %5u\n",
228+ qname[i], base[i], size[i], thres[i],
229+ IBQRDADDR_G(p[0]), IBQWRADDR_G(p[1]),
230+ QUESOPCNT_G(p[3]), QUEEOPCNT_G(p[3]),
231+ QUEREMFLITS_G(p[2]) * 16);
232+ for ( ; i < CIM_NUM_IBQ + cim_num_obq; i++, p += 4, wr += 2)
233+ seq_printf(seq, "%7s %5x %5u %12x %4x %4u %4u %5u\n",
234+ qname[i], base[i], size[i],
235+ QUERDADDR_G(p[0]) & 0x3fff, wr[0] - base[i],
236+ QUESOPCNT_G(p[3]), QUEEOPCNT_G(p[3]),
237+ QUEREMFLITS_G(p[2]) * 16);
238+ return 0;
239+}
240+
241+static int cim_qcfg_open(struct inode *inode, struct file *file)
242+{
243+ return single_open(file, cim_qcfg_show, inode->i_private);
244+}
245+
246+static const struct file_operations cim_qcfg_fops = {
247+ .owner = THIS_MODULE,
248+ .open = cim_qcfg_open,
249+ .read = seq_read,
250+ .llseek = seq_lseek,
251+ .release = single_release,
252+};
253+
254+static int cimq_show(struct seq_file *seq, void *v, int idx)
255+{
256+ const u32 *p = v;
257+
258+ seq_printf(seq, "%#06x: %08x %08x %08x %08x\n", idx * 16, p[0], p[1],
259+ p[2], p[3]);
260+ return 0;
261+}
262+
263+static int cim_ibq_open(struct inode *inode, struct file *file)
264+{
265+ int ret;
266+ struct seq_tab *p;
267+ unsigned int qid = (uintptr_t)inode->i_private & 7;
268+ struct adapter *adap = inode->i_private - qid;
269+
270+ p = seq_open_tab(file, CIM_IBQ_SIZE, 4 * sizeof(u32), 0, cimq_show);
271+ if (!p)
272+ return -ENOMEM;
273+
274+ ret = t4_read_cim_ibq(adap, qid, (u32 *)p->data, CIM_IBQ_SIZE * 4);
275+ if (ret < 0)
276+ seq_release_private(inode, file);
277+ else
278+ ret = 0;
279+ return ret;
280+}
281+
282+static const struct file_operations cim_ibq_fops = {
283+ .owner = THIS_MODULE,
284+ .open = cim_ibq_open,
285+ .read = seq_read,
286+ .llseek = seq_lseek,
287+ .release = seq_release_private
288+};
289+
290+static int cim_obq_open(struct inode *inode, struct file *file)
291+{
292+ int ret;
293+ struct seq_tab *p;
294+ unsigned int qid = (uintptr_t)inode->i_private & 7;
295+ struct adapter *adap = inode->i_private - qid;
296+
297+ p = seq_open_tab(file, 6 * CIM_OBQ_SIZE, 4 * sizeof(u32), 0, cimq_show);
298+ if (!p)
299+ return -ENOMEM;
300+
301+ ret = t4_read_cim_obq(adap, qid, (u32 *)p->data, 6 * CIM_OBQ_SIZE * 4);
302+ if (ret < 0) {
303+ seq_release_private(inode, file);
304+ } else {
305+ seq_tab_trim(p, ret / 4);
306+ ret = 0;
307+ }
308+ return ret;
309+}
310+
311+static const struct file_operations cim_obq_fops = {
312+ .owner = THIS_MODULE,
313+ .open = cim_obq_open,
314+ .read = seq_read,
315+ .llseek = seq_lseek,
316+ .release = seq_release_private
317+};
318+
319+struct field_desc {
320+ const char *name;
321+ unsigned int start;
322+ unsigned int width;
323+};
324+
325+static void field_desc_show(struct seq_file *seq, u64 v,
326+ const struct field_desc *p)
327+{
328+ char buf[32];
329+ int line_size = 0;
330+
331+ while (p->name) {
332+ u64 mask = (1ULL << p->width) - 1;
333+ int len = scnprintf(buf, sizeof(buf), "%s: %llu", p->name,
334+ ((unsigned long long)v >> p->start) & mask);
335+
336+ if (line_size + len >= 79) {
337+ line_size = 8;
338+ seq_puts(seq, "\n ");
339+ }
340+ seq_printf(seq, "%s ", buf);
341+ line_size += len + 1;
342+ p++;
343+ }
344+ seq_putc(seq, '\n');
345+}
346+
347+static struct field_desc tp_la0[] = {
348+ { "RcfOpCodeOut", 60, 4 },
349+ { "State", 56, 4 },
350+ { "WcfState", 52, 4 },
351+ { "RcfOpcSrcOut", 50, 2 },
352+ { "CRxError", 49, 1 },
353+ { "ERxError", 48, 1 },
354+ { "SanityFailed", 47, 1 },
355+ { "SpuriousMsg", 46, 1 },
356+ { "FlushInputMsg", 45, 1 },
357+ { "FlushInputCpl", 44, 1 },
358+ { "RssUpBit", 43, 1 },
359+ { "RssFilterHit", 42, 1 },
360+ { "Tid", 32, 10 },
361+ { "InitTcb", 31, 1 },
362+ { "LineNumber", 24, 7 },
363+ { "Emsg", 23, 1 },
364+ { "EdataOut", 22, 1 },
365+ { "Cmsg", 21, 1 },
366+ { "CdataOut", 20, 1 },
367+ { "EreadPdu", 19, 1 },
368+ { "CreadPdu", 18, 1 },
369+ { "TunnelPkt", 17, 1 },
370+ { "RcfPeerFin", 16, 1 },
371+ { "RcfReasonOut", 12, 4 },
372+ { "TxCchannel", 10, 2 },
373+ { "RcfTxChannel", 8, 2 },
374+ { "RxEchannel", 6, 2 },
375+ { "RcfRxChannel", 5, 1 },
376+ { "RcfDataOutSrdy", 4, 1 },
377+ { "RxDvld", 3, 1 },
378+ { "RxOoDvld", 2, 1 },
379+ { "RxCongestion", 1, 1 },
380+ { "TxCongestion", 0, 1 },
381+ { NULL }
382+};
383+
384+static int tp_la_show(struct seq_file *seq, void *v, int idx)
385+{
386+ const u64 *p = v;
387+
388+ field_desc_show(seq, *p, tp_la0);
389+ return 0;
390+}
391+
392+static int tp_la_show2(struct seq_file *seq, void *v, int idx)
393+{
394+ const u64 *p = v;
395+
396+ if (idx)
397+ seq_putc(seq, '\n');
398+ field_desc_show(seq, p[0], tp_la0);
399+ if (idx < (TPLA_SIZE / 2 - 1) || p[1] != ~0ULL)
400+ field_desc_show(seq, p[1], tp_la0);
401+ return 0;
402+}
403+
404+static int tp_la_show3(struct seq_file *seq, void *v, int idx)
405+{
406+ static struct field_desc tp_la1[] = {
407+ { "CplCmdIn", 56, 8 },
408+ { "CplCmdOut", 48, 8 },
409+ { "ESynOut", 47, 1 },
410+ { "EAckOut", 46, 1 },
411+ { "EFinOut", 45, 1 },
412+ { "ERstOut", 44, 1 },
413+ { "SynIn", 43, 1 },
414+ { "AckIn", 42, 1 },
415+ { "FinIn", 41, 1 },
416+ { "RstIn", 40, 1 },
417+ { "DataIn", 39, 1 },
418+ { "DataInVld", 38, 1 },
419+ { "PadIn", 37, 1 },
420+ { "RxBufEmpty", 36, 1 },
421+ { "RxDdp", 35, 1 },
422+ { "RxFbCongestion", 34, 1 },
423+ { "TxFbCongestion", 33, 1 },
424+ { "TxPktSumSrdy", 32, 1 },
425+ { "RcfUlpType", 28, 4 },
426+ { "Eread", 27, 1 },
427+ { "Ebypass", 26, 1 },
428+ { "Esave", 25, 1 },
429+ { "Static0", 24, 1 },
430+ { "Cread", 23, 1 },
431+ { "Cbypass", 22, 1 },
432+ { "Csave", 21, 1 },
433+ { "CPktOut", 20, 1 },
434+ { "RxPagePoolFull", 18, 2 },
435+ { "RxLpbkPkt", 17, 1 },
436+ { "TxLpbkPkt", 16, 1 },
437+ { "RxVfValid", 15, 1 },
438+ { "SynLearned", 14, 1 },
439+ { "SetDelEntry", 13, 1 },
440+ { "SetInvEntry", 12, 1 },
441+ { "CpcmdDvld", 11, 1 },
442+ { "CpcmdSave", 10, 1 },
443+ { "RxPstructsFull", 8, 2 },
444+ { "EpcmdDvld", 7, 1 },
445+ { "EpcmdFlush", 6, 1 },
446+ { "EpcmdTrimPrefix", 5, 1 },
447+ { "EpcmdTrimPostfix", 4, 1 },
448+ { "ERssIp4Pkt", 3, 1 },
449+ { "ERssIp6Pkt", 2, 1 },
450+ { "ERssTcpUdpPkt", 1, 1 },
451+ { "ERssFceFipPkt", 0, 1 },
452+ { NULL }
453+ };
454+ static struct field_desc tp_la2[] = {
455+ { "CplCmdIn", 56, 8 },
456+ { "MpsVfVld", 55, 1 },
457+ { "MpsPf", 52, 3 },
458+ { "MpsVf", 44, 8 },
459+ { "SynIn", 43, 1 },
460+ { "AckIn", 42, 1 },
461+ { "FinIn", 41, 1 },
462+ { "RstIn", 40, 1 },
463+ { "DataIn", 39, 1 },
464+ { "DataInVld", 38, 1 },
465+ { "PadIn", 37, 1 },
466+ { "RxBufEmpty", 36, 1 },
467+ { "RxDdp", 35, 1 },
468+ { "RxFbCongestion", 34, 1 },
469+ { "TxFbCongestion", 33, 1 },
470+ { "TxPktSumSrdy", 32, 1 },
471+ { "RcfUlpType", 28, 4 },
472+ { "Eread", 27, 1 },
473+ { "Ebypass", 26, 1 },
474+ { "Esave", 25, 1 },
475+ { "Static0", 24, 1 },
476+ { "Cread", 23, 1 },
477+ { "Cbypass", 22, 1 },
478+ { "Csave", 21, 1 },
479+ { "CPktOut", 20, 1 },
480+ { "RxPagePoolFull", 18, 2 },
481+ { "RxLpbkPkt", 17, 1 },
482+ { "TxLpbkPkt", 16, 1 },
483+ { "RxVfValid", 15, 1 },
484+ { "SynLearned", 14, 1 },
485+ { "SetDelEntry", 13, 1 },
486+ { "SetInvEntry", 12, 1 },
487+ { "CpcmdDvld", 11, 1 },
488+ { "CpcmdSave", 10, 1 },
489+ { "RxPstructsFull", 8, 2 },
490+ { "EpcmdDvld", 7, 1 },
491+ { "EpcmdFlush", 6, 1 },
492+ { "EpcmdTrimPrefix", 5, 1 },
493+ { "EpcmdTrimPostfix", 4, 1 },
494+ { "ERssIp4Pkt", 3, 1 },
495+ { "ERssIp6Pkt", 2, 1 },
496+ { "ERssTcpUdpPkt", 1, 1 },
497+ { "ERssFceFipPkt", 0, 1 },
498+ { NULL }
499+ };
500+ const u64 *p = v;
501+
502+ if (idx)
503+ seq_putc(seq, '\n');
504+ field_desc_show(seq, p[0], tp_la0);
505+ if (idx < (TPLA_SIZE / 2 - 1) || p[1] != ~0ULL)
506+ field_desc_show(seq, p[1], (p[0] & BIT(17)) ? tp_la2 : tp_la1);
507+ return 0;
508+}
509+
510+static int tp_la_open(struct inode *inode, struct file *file)
511+{
512+ struct seq_tab *p;
513+ struct adapter *adap = inode->i_private;
514+
515+ switch (DBGLAMODE_G(t4_read_reg(adap, TP_DBG_LA_CONFIG_A))) {
516+ case 2:
517+ p = seq_open_tab(file, TPLA_SIZE / 2, 2 * sizeof(u64), 0,
518+ tp_la_show2);
519+ break;
520+ case 3:
521+ p = seq_open_tab(file, TPLA_SIZE / 2, 2 * sizeof(u64), 0,
522+ tp_la_show3);
523+ break;
524+ default:
525+ p = seq_open_tab(file, TPLA_SIZE, sizeof(u64), 0, tp_la_show);
526+ }
527+ if (!p)
528+ return -ENOMEM;
529+
530+ t4_tp_read_la(adap, (u64 *)p->data, NULL);
531+ return 0;
532+}
533+
534+static ssize_t tp_la_write(struct file *file, const char __user *buf,
535+ size_t count, loff_t *pos)
536+{
537+ int err;
538+ char s[32];
539+ unsigned long val;
540+ size_t size = min(sizeof(s) - 1, count);
541+ struct adapter *adap = FILE_DATA(file)->i_private;
542+
543+ if (copy_from_user(s, buf, size))
544+ return -EFAULT;
545+ s[size] = '\0';
546+ err = kstrtoul(s, 0, &val);
547+ if (err)
548+ return err;
549+ if (val > 0xffff)
550+ return -EINVAL;
551+ adap->params.tp.la_mask = val << 16;
552+ t4_set_reg_field(adap, TP_DBG_LA_CONFIG_A, 0xffff0000U,
553+ adap->params.tp.la_mask);
554+ return count;
555+}
556+
557+static const struct file_operations tp_la_fops = {
558+ .owner = THIS_MODULE,
559+ .open = tp_la_open,
560+ .read = seq_read,
561+ .llseek = seq_lseek,
562+ .release = seq_release_private,
563+ .write = tp_la_write
564+};
565+
566+static int ulprx_la_show(struct seq_file *seq, void *v, int idx)
567+{
568+ const u32 *p = v;
569+
570+ if (v == SEQ_START_TOKEN)
571+ seq_puts(seq, " Pcmd Type Message"
572+ " Data\n");
573+ else
574+ seq_printf(seq, "%08x%08x %4x %08x %08x%08x%08x%08x\n",
575+ p[1], p[0], p[2], p[3], p[7], p[6], p[5], p[4]);
576+ return 0;
577+}
578+
579+static int ulprx_la_open(struct inode *inode, struct file *file)
580+{
581+ struct seq_tab *p;
582+ struct adapter *adap = inode->i_private;
583+
584+ p = seq_open_tab(file, ULPRX_LA_SIZE, 8 * sizeof(u32), 1,
585+ ulprx_la_show);
586+ if (!p)
587+ return -ENOMEM;
588+
589+ t4_ulprx_read_la(adap, (u32 *)p->data);
590+ return 0;
591+}
592+
593+static const struct file_operations ulprx_la_fops = {
594+ .owner = THIS_MODULE,
595+ .open = ulprx_la_open,
596+ .read = seq_read,
597+ .llseek = seq_lseek,
598+ .release = seq_release_private
599+};
600+
601+/* Show the PM memory stats. These stats include:
602+ *
603+ * TX:
604+ * Read: memory read operation
605+ * Write Bypass: cut-through
606+ * Bypass + mem: cut-through and save copy
607+ *
608+ * RX:
609+ * Read: memory read
610+ * Write Bypass: cut-through
611+ * Flush: payload trim or drop
612+ */
613+static int pm_stats_show(struct seq_file *seq, void *v)
614+{
615+ static const char * const tx_pm_stats[] = {
616+ "Read:", "Write bypass:", "Write mem:", "Bypass + mem:"
617+ };
618+ static const char * const rx_pm_stats[] = {
619+ "Read:", "Write bypass:", "Write mem:", "Flush:"
620+ };
621+
622+ int i;
623+ u32 tx_cnt[PM_NSTATS], rx_cnt[PM_NSTATS];
624+ u64 tx_cyc[PM_NSTATS], rx_cyc[PM_NSTATS];
625+ struct adapter *adap = seq->private;
626+
627+ t4_pmtx_get_stats(adap, tx_cnt, tx_cyc);
628+ t4_pmrx_get_stats(adap, rx_cnt, rx_cyc);
629+
630+ seq_printf(seq, "%13s %10s %20s\n", " ", "Tx pcmds", "Tx bytes");
631+ for (i = 0; i < PM_NSTATS - 1; i++)
632+ seq_printf(seq, "%-13s %10u %20llu\n",
633+ tx_pm_stats[i], tx_cnt[i], tx_cyc[i]);
634+
635+ seq_printf(seq, "%13s %10s %20s\n", " ", "Rx pcmds", "Rx bytes");
636+ for (i = 0; i < PM_NSTATS - 1; i++)
637+ seq_printf(seq, "%-13s %10u %20llu\n",
638+ rx_pm_stats[i], rx_cnt[i], rx_cyc[i]);
639+ return 0;
640+}
641+
642+static int pm_stats_open(struct inode *inode, struct file *file)
643+{
644+ return single_open(file, pm_stats_show, inode->i_private);
645+}
646+
647+static ssize_t pm_stats_clear(struct file *file, const char __user *buf,
648+ size_t count, loff_t *pos)
649+{
650+ struct adapter *adap = FILE_DATA(file)->i_private;
651+
652+ t4_write_reg(adap, PM_RX_STAT_CONFIG_A, 0);
653+ t4_write_reg(adap, PM_TX_STAT_CONFIG_A, 0);
654+ return count;
655+}
656+
657+static const struct file_operations pm_stats_debugfs_fops = {
658+ .owner = THIS_MODULE,
659+ .open = pm_stats_open,
660+ .read = seq_read,
661+ .llseek = seq_lseek,
662+ .release = single_release,
663+ .write = pm_stats_clear
664+};
665+
666+static int cctrl_tbl_show(struct seq_file *seq, void *v)
667+{
668+ static const char * const dec_fac[] = {
669+ "0.5", "0.5625", "0.625", "0.6875", "0.75", "0.8125", "0.875",
670+ "0.9375" };
671+
672+ int i;
673+ u16 incr[NMTUS][NCCTRL_WIN];
674+ struct adapter *adap = seq->private;
675+
676+ t4_read_cong_tbl(adap, incr);
677+
678+ for (i = 0; i < NCCTRL_WIN; ++i) {
679+ seq_printf(seq, "%2d: %4u %4u %4u %4u %4u %4u %4u %4u\n", i,
680+ incr[0][i], incr[1][i], incr[2][i], incr[3][i],
681+ incr[4][i], incr[5][i], incr[6][i], incr[7][i]);
682+ seq_printf(seq, "%8u %4u %4u %4u %4u %4u %4u %4u %5u %s\n",
683+ incr[8][i], incr[9][i], incr[10][i], incr[11][i],
684+ incr[12][i], incr[13][i], incr[14][i], incr[15][i],
685+ adap->params.a_wnd[i],
686+ dec_fac[adap->params.b_wnd[i]]);
687+ }
688+ return 0;
689+}
690+
691+DEFINE_SIMPLE_DEBUGFS_FILE(cctrl_tbl);
692+
693+/* Format a value in a unit that differs from the value's native unit by the
694+ * given factor.
695+ */
696+static char *unit_conv(char *buf, size_t len, unsigned int val,
697+ unsigned int factor)
698+{
699+ unsigned int rem = val % factor;
700+
701+ if (rem == 0) {
702+ snprintf(buf, len, "%u", val / factor);
703+ } else {
704+ while (rem % 10 == 0)
705+ rem /= 10;
706+ snprintf(buf, len, "%u.%u", val / factor, rem);
707+ }
708+ return buf;
709+}
710+
711+static int clk_show(struct seq_file *seq, void *v)
712+{
713+ char buf[32];
714+ struct adapter *adap = seq->private;
715+ unsigned int cclk_ps = 1000000000 / adap->params.vpd.cclk; /* in ps */
716+ u32 res = t4_read_reg(adap, TP_TIMER_RESOLUTION_A);
717+ unsigned int tre = TIMERRESOLUTION_G(res);
718+ unsigned int dack_re = DELAYEDACKRESOLUTION_G(res);
719+ unsigned long long tp_tick_us = (cclk_ps << tre) / 1000000; /* in us */
720+
721+ seq_printf(seq, "Core clock period: %s ns\n",
722+ unit_conv(buf, sizeof(buf), cclk_ps, 1000));
723+ seq_printf(seq, "TP timer tick: %s us\n",
724+ unit_conv(buf, sizeof(buf), (cclk_ps << tre), 1000000));
725+ seq_printf(seq, "TCP timestamp tick: %s us\n",
726+ unit_conv(buf, sizeof(buf),
727+ (cclk_ps << TIMESTAMPRESOLUTION_G(res)), 1000000));
728+ seq_printf(seq, "DACK tick: %s us\n",
729+ unit_conv(buf, sizeof(buf), (cclk_ps << dack_re), 1000000));
730+ seq_printf(seq, "DACK timer: %u us\n",
731+ ((cclk_ps << dack_re) / 1000000) *
732+ t4_read_reg(adap, TP_DACK_TIMER_A));
733+ seq_printf(seq, "Retransmit min: %llu us\n",
734+ tp_tick_us * t4_read_reg(adap, TP_RXT_MIN_A));
735+ seq_printf(seq, "Retransmit max: %llu us\n",
736+ tp_tick_us * t4_read_reg(adap, TP_RXT_MAX_A));
737+ seq_printf(seq, "Persist timer min: %llu us\n",
738+ tp_tick_us * t4_read_reg(adap, TP_PERS_MIN_A));
739+ seq_printf(seq, "Persist timer max: %llu us\n",
740+ tp_tick_us * t4_read_reg(adap, TP_PERS_MAX_A));
741+ seq_printf(seq, "Keepalive idle timer: %llu us\n",
742+ tp_tick_us * t4_read_reg(adap, TP_KEEP_IDLE_A));
743+ seq_printf(seq, "Keepalive interval: %llu us\n",
744+ tp_tick_us * t4_read_reg(adap, TP_KEEP_INTVL_A));
745+ seq_printf(seq, "Initial SRTT: %llu us\n",
746+ tp_tick_us * INITSRTT_G(t4_read_reg(adap, TP_INIT_SRTT_A)));
747+ seq_printf(seq, "FINWAIT2 timer: %llu us\n",
748+ tp_tick_us * t4_read_reg(adap, TP_FINWAIT2_TIMER_A));
749+
750+ return 0;
751+}
752+
753+DEFINE_SIMPLE_DEBUGFS_FILE(clk);
754+
755+/* Firmware Device Log dump. */
756+static const char * const devlog_level_strings[] = {
757+ [FW_DEVLOG_LEVEL_EMERG] = "EMERG",
758+ [FW_DEVLOG_LEVEL_CRIT] = "CRIT",
759+ [FW_DEVLOG_LEVEL_ERR] = "ERR",
760+ [FW_DEVLOG_LEVEL_NOTICE] = "NOTICE",
761+ [FW_DEVLOG_LEVEL_INFO] = "INFO",
762+ [FW_DEVLOG_LEVEL_DEBUG] = "DEBUG"
763+};
764+
765+static const char * const devlog_facility_strings[] = {
766+ [FW_DEVLOG_FACILITY_CORE] = "CORE",
767+ [FW_DEVLOG_FACILITY_SCHED] = "SCHED",
768+ [FW_DEVLOG_FACILITY_TIMER] = "TIMER",
769+ [FW_DEVLOG_FACILITY_RES] = "RES",
770+ [FW_DEVLOG_FACILITY_HW] = "HW",
771+ [FW_DEVLOG_FACILITY_FLR] = "FLR",
772+ [FW_DEVLOG_FACILITY_DMAQ] = "DMAQ",
773+ [FW_DEVLOG_FACILITY_PHY] = "PHY",
774+ [FW_DEVLOG_FACILITY_MAC] = "MAC",
775+ [FW_DEVLOG_FACILITY_PORT] = "PORT",
776+ [FW_DEVLOG_FACILITY_VI] = "VI",
777+ [FW_DEVLOG_FACILITY_FILTER] = "FILTER",
778+ [FW_DEVLOG_FACILITY_ACL] = "ACL",
779+ [FW_DEVLOG_FACILITY_TM] = "TM",
780+ [FW_DEVLOG_FACILITY_QFC] = "QFC",
781+ [FW_DEVLOG_FACILITY_DCB] = "DCB",
782+ [FW_DEVLOG_FACILITY_ETH] = "ETH",
783+ [FW_DEVLOG_FACILITY_OFLD] = "OFLD",
784+ [FW_DEVLOG_FACILITY_RI] = "RI",
785+ [FW_DEVLOG_FACILITY_ISCSI] = "ISCSI",
786+ [FW_DEVLOG_FACILITY_FCOE] = "FCOE",
787+ [FW_DEVLOG_FACILITY_FOISCSI] = "FOISCSI",
788+ [FW_DEVLOG_FACILITY_FOFCOE] = "FOFCOE"
789+};
790+
791+/* Information gathered by Device Log Open routine for the display routine.
792+ */
793+struct devlog_info {
794+ unsigned int nentries; /* number of entries in log[] */
795+ unsigned int first; /* first [temporal] entry in log[] */
796+ struct fw_devlog_e log[0]; /* Firmware Device Log */
797+};
798+
799+/* Dump a Firmaware Device Log entry.
800+ */
801+static int devlog_show(struct seq_file *seq, void *v)
802+{
803+ if (v == SEQ_START_TOKEN)
804+ seq_printf(seq, "%10s %15s %8s %8s %s\n",
805+ "Seq#", "Tstamp", "Level", "Facility", "Message");
806+ else {
807+ struct devlog_info *dinfo = seq->private;
808+ int fidx = (uintptr_t)v - 2;
809+ unsigned long index;
810+ struct fw_devlog_e *e;
811+
812+ /* Get a pointer to the log entry to display. Skip unused log
813+ * entries.
814+ */
815+ index = dinfo->first + fidx;
816+ if (index >= dinfo->nentries)
817+ index -= dinfo->nentries;
818+ e = &dinfo->log[index];
819+ if (e->timestamp == 0)
820+ return 0;
821+
822+ /* Print the message. This depends on the firmware using
823+ * exactly the same formating strings as the kernel so we may
824+ * eventually have to put a format interpreter in here ...
825+ */
826+ seq_printf(seq, "%10d %15llu %8s %8s ",
827+ e->seqno, e->timestamp,
828+ (e->level < ARRAY_SIZE(devlog_level_strings)
829+ ? devlog_level_strings[e->level]
830+ : "UNKNOWN"),
831+ (e->facility < ARRAY_SIZE(devlog_facility_strings)
832+ ? devlog_facility_strings[e->facility]
833+ : "UNKNOWN"));
834+ seq_printf(seq, e->fmt, e->params[0], e->params[1],
835+ e->params[2], e->params[3], e->params[4],
836+ e->params[5], e->params[6], e->params[7]);
837+ }
838+ return 0;
839+}
840+
841+/* Sequential File Operations for Device Log.
842+ */
843+static inline void *devlog_get_idx(struct devlog_info *dinfo, loff_t pos)
844+{
845+ if (pos > dinfo->nentries)
846+ return NULL;
847+
848+ return (void *)(uintptr_t)(pos + 1);
849+}
850+
851+static void *devlog_start(struct seq_file *seq, loff_t *pos)
852+{
853+ struct devlog_info *dinfo = seq->private;
854+
855+ return (*pos
856+ ? devlog_get_idx(dinfo, *pos)
857+ : SEQ_START_TOKEN);
858+}
859+
860+static void *devlog_next(struct seq_file *seq, void *v, loff_t *pos)
861+{
862+ struct devlog_info *dinfo = seq->private;
863+
864+ (*pos)++;
865+ return devlog_get_idx(dinfo, *pos);
866+}
867+
868+static void devlog_stop(struct seq_file *seq, void *v)
869+{
870+}
871+
872+static const struct seq_operations devlog_seq_ops = {
873+ .start = devlog_start,
874+ .next = devlog_next,
875+ .stop = devlog_stop,
876+ .show = devlog_show
877+};
878+
879+/* Set up for reading the firmware's device log. We read the entire log here
880+ * and then display it incrementally in devlog_show().
881+ */
882+static int devlog_open(struct inode *inode, struct file *file)
883+{
884+ struct adapter *adap = inode->i_private;
885+ struct devlog_params *dparams = &adap->params.devlog;
886+ struct devlog_info *dinfo;
887+ unsigned int index;
888+ u32 fseqno;
889+ int ret;
890+
891+ /* If we don't know where the log is we can't do anything.
892+ */
893+ if (dparams->start == 0)
894+ return -ENXIO;
895+
896+ /* Allocate the space to read in the firmware's device log and set up
897+ * for the iterated call to our display function.
898+ */
899+ dinfo = __seq_open_private(file, &devlog_seq_ops,
900+ sizeof(*dinfo) + dparams->size);
901+ if (!dinfo)
902+ return -ENOMEM;
903+
904+ /* Record the basic log buffer information and read in the raw log.
905+ */
906+ dinfo->nentries = (dparams->size / sizeof(struct fw_devlog_e));
907+ dinfo->first = 0;
908+ spin_lock(&adap->win0_lock);
909+ ret = t4_memory_rw(adap, adap->params.drv_memwin, dparams->memtype,
910+ dparams->start, dparams->size, (__be32 *)dinfo->log,
911+ T4_MEMORY_READ);
912+ spin_unlock(&adap->win0_lock);
913+ if (ret) {
914+ seq_release_private(inode, file);
915+ return ret;
916+ }
917+
918+ /* Translate log multi-byte integral elements into host native format
919+ * and determine where the first entry in the log is.
920+ */
921+ for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) {
922+ struct fw_devlog_e *e = &dinfo->log[index];
923+ int i;
924+ __u32 seqno;
925+
926+ if (e->timestamp == 0)
927+ continue;
928+
929+ e->timestamp = (__force __be64)be64_to_cpu(e->timestamp);
930+ seqno = be32_to_cpu(e->seqno);
931+ for (i = 0; i < 8; i++)
932+ e->params[i] =
933+ (__force __be32)be32_to_cpu(e->params[i]);
934+
935+ if (seqno < fseqno) {
936+ fseqno = seqno;
937+ dinfo->first = index;
938+ }
939+ }
940+ return 0;
941+}
942+
943+static const struct file_operations devlog_fops = {
944+ .owner = THIS_MODULE,
945+ .open = devlog_open,
946+ .read = seq_read,
947+ .llseek = seq_lseek,
948+ .release = seq_release_private
949+};
950+
951+static int mbox_show(struct seq_file *seq, void *v)
952+{
953+ static const char * const owner[] = { "none", "FW", "driver",
954+ "unknown" };
955+
956+ int i;
957+ unsigned int mbox = (uintptr_t)seq->private & 7;
958+ struct adapter *adap = seq->private - mbox;
959+ void __iomem *addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
960+ unsigned int ctrl_reg = (is_t4(adap->params.chip)
961+ ? CIM_PF_MAILBOX_CTRL_A
962+ : CIM_PF_MAILBOX_CTRL_SHADOW_COPY_A);
963+ void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg);
964+
965+ i = MBOWNER_G(readl(ctrl));
966+ seq_printf(seq, "mailbox owned by %s\n\n", owner[i]);
967+
968+ for (i = 0; i < MBOX_LEN; i += 8)
969+ seq_printf(seq, "%016llx\n",
970+ (unsigned long long)readq(addr + i));
971+ return 0;
972+}
973+
974+static int mbox_open(struct inode *inode, struct file *file)
975+{
976+ return single_open(file, mbox_show, inode->i_private);
977+}
978+
979+static ssize_t mbox_write(struct file *file, const char __user *buf,
980+ size_t count, loff_t *pos)
981+{
982+ int i;
983+ char c = '\n', s[256];
984+ unsigned long long data[8];
985+ const struct inode *ino;
986+ unsigned int mbox;
987+ struct adapter *adap;
988+ void __iomem *addr;
989+ void __iomem *ctrl;
990+
991+ if (count > sizeof(s) - 1 || !count)
992+ return -EINVAL;
993+ if (copy_from_user(s, buf, count))
994+ return -EFAULT;
995+ s[count] = '\0';
996+
997+ if (sscanf(s, "%llx %llx %llx %llx %llx %llx %llx %llx%c", &data[0],
998+ &data[1], &data[2], &data[3], &data[4], &data[5], &data[6],
999+ &data[7], &c) < 8 || c != '\n')
1000+ return -EINVAL;
1001+
1002+ ino = FILE_DATA(file);
1003+ mbox = (uintptr_t)ino->i_private & 7;
1004+ adap = ino->i_private - mbox;
1005+ addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
1006+ ctrl = addr + MBOX_LEN;
1007+
1008+ if (MBOWNER_G(readl(ctrl)) != X_MBOWNER_PL)
1009+ return -EBUSY;
1010+
1011+ for (i = 0; i < 8; i++)
1012+ writeq(data[i], addr + 8 * i);
1013+
1014+ writel(MBMSGVALID_F | MBOWNER_V(X_MBOWNER_FW), ctrl);
1015+ return count;
1016+}
1017+
1018+static const struct file_operations mbox_debugfs_fops = {
1019+ .owner = THIS_MODULE,
1020+ .open = mbox_open,
1021+ .read = seq_read,
1022+ .llseek = seq_lseek,
1023+ .release = single_release,
1024+ .write = mbox_write
1025+};
1026+
1027+static ssize_t flash_read(struct file *file, char __user *buf, size_t count,
1028+ loff_t *ppos)
1029+{
1030+ loff_t pos = *ppos;
1031+ loff_t avail = FILE_DATA(file)->i_size;
1032+ struct adapter *adap = file->private_data;
1033+
1034+ if (pos < 0)
1035+ return -EINVAL;
1036+ if (pos >= avail)
1037+ return 0;
1038+ if (count > avail - pos)
1039+ count = avail - pos;
1040+
1041+ while (count) {
1042+ size_t len;
1043+ int ret, ofst;
1044+ u8 data[256];
1045+
1046+ ofst = pos & 3;
1047+ len = min(count + ofst, sizeof(data));
1048+ ret = t4_read_flash(adap, pos - ofst, (len + 3) / 4,
1049+ (u32 *)data, 1);
1050+ if (ret)
1051+ return ret;
1052+
1053+ len -= ofst;
1054+ if (copy_to_user(buf, data + ofst, len))
1055+ return -EFAULT;
1056+
1057+ buf += len;
1058+ pos += len;
1059+ count -= len;
1060+ }
1061+ count = pos - *ppos;
1062+ *ppos = pos;
1063+ return count;
1064+}
1065+
1066+static const struct file_operations flash_debugfs_fops = {
1067+ .owner = THIS_MODULE,
1068+ .open = mem_open,
1069+ .read = flash_read,
1070+};
1071+
1072+static inline void tcamxy2valmask(u64 x, u64 y, u8 *addr, u64 *mask)
1073+{
1074+ *mask = x | y;
1075+ y = (__force u64)cpu_to_be64(y);
1076+ memcpy(addr, (char *)&y + 2, ETH_ALEN);
1077+}
1078+
1079+static int mps_tcam_show(struct seq_file *seq, void *v)
1080+{
1081+ if (v == SEQ_START_TOKEN)
1082+ seq_puts(seq, "Idx Ethernet address Mask Vld Ports PF"
1083+ " VF Replication "
1084+ "P0 P1 P2 P3 ML\n");
1085+ else {
1086+ u64 mask;
1087+ u8 addr[ETH_ALEN];
1088+ struct adapter *adap = seq->private;
1089+ unsigned int idx = (uintptr_t)v - 2;
1090+ u64 tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx));
1091+ u64 tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx));
1092+ u32 cls_lo = t4_read_reg(adap, MPS_CLS_SRAM_L(idx));
1093+ u32 cls_hi = t4_read_reg(adap, MPS_CLS_SRAM_H(idx));
1094+ u32 rplc[4] = {0, 0, 0, 0};
1095+
1096+ if (tcamx & tcamy) {
1097+ seq_printf(seq, "%3u -\n", idx);
1098+ goto out;
1099+ }
1100+
1101+ if (cls_lo & REPLICATE_F) {
1102+ struct fw_ldst_cmd ldst_cmd;
1103+ int ret;
1104+
1105+ memset(&ldst_cmd, 0, sizeof(ldst_cmd));
1106+ ldst_cmd.op_to_addrspace =
1107+ htonl(FW_CMD_OP_V(FW_LDST_CMD) |
1108+ FW_CMD_REQUEST_F |
1109+ FW_CMD_READ_F |
1110+ FW_LDST_CMD_ADDRSPACE_V(
1111+ FW_LDST_ADDRSPC_MPS));
1112+ ldst_cmd.cycles_to_len16 = htonl(FW_LEN16(ldst_cmd));
1113+ ldst_cmd.u.mps.fid_ctl =
1114+ htons(FW_LDST_CMD_FID_V(FW_LDST_MPS_RPLC) |
1115+ FW_LDST_CMD_CTL_V(idx));
1116+ ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd,
1117+ sizeof(ldst_cmd), &ldst_cmd);
1118+ if (ret)
1119+ dev_warn(adap->pdev_dev, "Can't read MPS "
1120+ "replication map for idx %d: %d\n",
1121+ idx, -ret);
1122+ else {
1123+ rplc[0] = ntohl(ldst_cmd.u.mps.rplc31_0);
1124+ rplc[1] = ntohl(ldst_cmd.u.mps.rplc63_32);
1125+ rplc[2] = ntohl(ldst_cmd.u.mps.rplc95_64);
1126+ rplc[3] = ntohl(ldst_cmd.u.mps.rplc127_96);
1127+ }
1128+ }
1129+
1130+ tcamxy2valmask(tcamx, tcamy, addr, &mask);
1131+ seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x %012llx"
1132+ "%3c %#x%4u%4d",
1133+ idx, addr[0], addr[1], addr[2], addr[3], addr[4],
1134+ addr[5], (unsigned long long)mask,
1135+ (cls_lo & SRAM_VLD_F) ? 'Y' : 'N', PORTMAP_G(cls_hi),
1136+ PF_G(cls_lo),
1137+ (cls_lo & VF_VALID_F) ? VF_G(cls_lo) : -1);
1138+ if (cls_lo & REPLICATE_F)
1139+ seq_printf(seq, " %08x %08x %08x %08x",
1140+ rplc[3], rplc[2], rplc[1], rplc[0]);
1141+ else
1142+ seq_printf(seq, "%36c", ' ');
1143+ seq_printf(seq, "%4u%3u%3u%3u %#x\n",
1144+ SRAM_PRIO0_G(cls_lo), SRAM_PRIO1_G(cls_lo),
1145+ SRAM_PRIO2_G(cls_lo), SRAM_PRIO3_G(cls_lo),
1146+ (cls_lo >> MULTILISTEN0_S) & 0xf);
1147+ }
1148+out: return 0;
1149+}
1150+
1151+static inline void *mps_tcam_get_idx(struct seq_file *seq, loff_t pos)
1152+{
1153+ struct adapter *adap = seq->private;
1154+ int max_mac_addr = is_t4(adap->params.chip) ?
1155+ NUM_MPS_CLS_SRAM_L_INSTANCES :
1156+ NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
1157+ return ((pos <= max_mac_addr) ? (void *)(uintptr_t)(pos + 1) : NULL);
1158+}
1159+
1160+static void *mps_tcam_start(struct seq_file *seq, loff_t *pos)
1161+{
1162+ return *pos ? mps_tcam_get_idx(seq, *pos) : SEQ_START_TOKEN;
1163+}
1164+
1165+static void *mps_tcam_next(struct seq_file *seq, void *v, loff_t *pos)
1166+{
1167+ ++*pos;
1168+ return mps_tcam_get_idx(seq, *pos);
1169+}
1170+
1171+static void mps_tcam_stop(struct seq_file *seq, void *v)
1172+{
1173+}
1174+
1175+static const struct seq_operations mps_tcam_seq_ops = {
1176+ .start = mps_tcam_start,
1177+ .next = mps_tcam_next,
1178+ .stop = mps_tcam_stop,
1179+ .show = mps_tcam_show
1180+};
1181+
1182+static int mps_tcam_open(struct inode *inode, struct file *file)
1183+{
1184+ int res = seq_open(file, &mps_tcam_seq_ops);
1185+
1186+ if (!res) {
1187+ struct seq_file *seq = file->private_data;
1188+
1189+ seq->private = inode->i_private;
1190+ }
1191+ return res;
1192+}
1193+
1194+static const struct file_operations mps_tcam_debugfs_fops = {
1195+ .owner = THIS_MODULE,
1196+ .open = mps_tcam_open,
1197+ .read = seq_read,
1198+ .llseek = seq_lseek,
1199+ .release = seq_release,
1200+};
1201+
1202+/* Display various sensor information.
1203+ */
1204+static int sensors_show(struct seq_file *seq, void *v)
1205+{
1206+ struct adapter *adap = seq->private;
1207+ u32 param[7], val[7];
1208+ int ret;
1209+
1210+ /* Note that if the sensors haven't been initialized and turned on
1211+ * we'll get values of 0, so treat those as "<unknown>" ...
1212+ */
1213+ param[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
1214+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) |
1215+ FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_TMP));
1216+ param[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
1217+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) |
1218+ FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_VDD));
1219+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2,
1220+ param, val);
1221+
1222+ if (ret < 0 || val[0] == 0)
1223+ seq_puts(seq, "Temperature: <unknown>\n");
1224+ else
1225+ seq_printf(seq, "Temperature: %dC\n", val[0]);
1226+
1227+ if (ret < 0 || val[1] == 0)
1228+ seq_puts(seq, "Core VDD: <unknown>\n");
1229+ else
1230+ seq_printf(seq, "Core VDD: %dmV\n", val[1]);
1231+
1232+ return 0;
1233+}
1234+
1235+DEFINE_SIMPLE_DEBUGFS_FILE(sensors);
1236+
1237+#if IS_ENABLED(CONFIG_IPV6)
1238+static int clip_tbl_open(struct inode *inode, struct file *file)
1239+{
1240+ return single_open(file, clip_tbl_show, inode->i_private);
1241+}
1242+
1243+static const struct file_operations clip_tbl_debugfs_fops = {
1244+ .owner = THIS_MODULE,
1245+ .open = clip_tbl_open,
1246+ .read = seq_read,
1247+ .llseek = seq_lseek,
1248+ .release = single_release
1249+};
1250+#endif
1251+
1252+/*RSS Table.
1253+ */
1254+
1255+static int rss_show(struct seq_file *seq, void *v, int idx)
1256+{
1257+ u16 *entry = v;
1258+
1259+ seq_printf(seq, "%4d: %4u %4u %4u %4u %4u %4u %4u %4u\n",
1260+ idx * 8, entry[0], entry[1], entry[2], entry[3], entry[4],
1261+ entry[5], entry[6], entry[7]);
1262+ return 0;
1263+}
1264+
1265+static int rss_open(struct inode *inode, struct file *file)
1266+{
1267+ int ret;
1268+ struct seq_tab *p;
1269+ struct adapter *adap = inode->i_private;
1270+
1271+ p = seq_open_tab(file, RSS_NENTRIES / 8, 8 * sizeof(u16), 0, rss_show);
1272+ if (!p)
1273+ return -ENOMEM;
1274+
1275+ ret = t4_read_rss(adap, (u16 *)p->data);
1276+ if (ret)
1277+ seq_release_private(inode, file);
1278+
1279+ return ret;
1280+}
1281+
1282+static const struct file_operations rss_debugfs_fops = {
1283+ .owner = THIS_MODULE,
1284+ .open = rss_open,
1285+ .read = seq_read,
1286+ .llseek = seq_lseek,
1287+ .release = seq_release_private
1288+};
1289+
1290+/* RSS Configuration.
1291+ */
1292+
1293+/* Small utility function to return the strings "yes" or "no" if the supplied
1294+ * argument is non-zero.
1295+ */
1296+static const char *yesno(int x)
1297+{
1298+ static const char *yes = "yes";
1299+ static const char *no = "no";
1300+
1301+ return x ? yes : no;
1302+}
1303+
1304+static int rss_config_show(struct seq_file *seq, void *v)
1305+{
1306+ struct adapter *adapter = seq->private;
1307+ static const char * const keymode[] = {
1308+ "global",
1309+ "global and per-VF scramble",
1310+ "per-PF and per-VF scramble",
1311+ "per-VF and per-VF scramble",
1312+ };
1313+ u32 rssconf;
1314+
1315+ rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_A);
1316+ seq_printf(seq, "TP_RSS_CONFIG: %#x\n", rssconf);
1317+ seq_printf(seq, " Tnl4TupEnIpv6: %3s\n", yesno(rssconf &
1318+ TNL4TUPENIPV6_F));
1319+ seq_printf(seq, " Tnl2TupEnIpv6: %3s\n", yesno(rssconf &
1320+ TNL2TUPENIPV6_F));
1321+ seq_printf(seq, " Tnl4TupEnIpv4: %3s\n", yesno(rssconf &
1322+ TNL4TUPENIPV4_F));
1323+ seq_printf(seq, " Tnl2TupEnIpv4: %3s\n", yesno(rssconf &
1324+ TNL2TUPENIPV4_F));
1325+ seq_printf(seq, " TnlTcpSel: %3s\n", yesno(rssconf & TNLTCPSEL_F));
1326+ seq_printf(seq, " TnlIp6Sel: %3s\n", yesno(rssconf & TNLIP6SEL_F));
1327+ seq_printf(seq, " TnlVrtSel: %3s\n", yesno(rssconf & TNLVRTSEL_F));
1328+ seq_printf(seq, " TnlMapEn: %3s\n", yesno(rssconf & TNLMAPEN_F));
1329+ seq_printf(seq, " OfdHashSave: %3s\n", yesno(rssconf &
1330+ OFDHASHSAVE_F));
1331+ seq_printf(seq, " OfdVrtSel: %3s\n", yesno(rssconf & OFDVRTSEL_F));
1332+ seq_printf(seq, " OfdMapEn: %3s\n", yesno(rssconf & OFDMAPEN_F));
1333+ seq_printf(seq, " OfdLkpEn: %3s\n", yesno(rssconf & OFDLKPEN_F));
1334+ seq_printf(seq, " Syn4TupEnIpv6: %3s\n", yesno(rssconf &
1335+ SYN4TUPENIPV6_F));
1336+ seq_printf(seq, " Syn2TupEnIpv6: %3s\n", yesno(rssconf &
1337+ SYN2TUPENIPV6_F));
1338+ seq_printf(seq, " Syn4TupEnIpv4: %3s\n", yesno(rssconf &
1339+ SYN4TUPENIPV4_F));
1340+ seq_printf(seq, " Syn2TupEnIpv4: %3s\n", yesno(rssconf &
1341+ SYN2TUPENIPV4_F));
1342+ seq_printf(seq, " Syn4TupEnIpv6: %3s\n", yesno(rssconf &
1343+ SYN4TUPENIPV6_F));
1344+ seq_printf(seq, " SynIp6Sel: %3s\n", yesno(rssconf & SYNIP6SEL_F));
1345+ seq_printf(seq, " SynVrt6Sel: %3s\n", yesno(rssconf & SYNVRTSEL_F));
1346+ seq_printf(seq, " SynMapEn: %3s\n", yesno(rssconf & SYNMAPEN_F));
1347+ seq_printf(seq, " SynLkpEn: %3s\n", yesno(rssconf & SYNLKPEN_F));
1348+ seq_printf(seq, " ChnEn: %3s\n", yesno(rssconf &
1349+ CHANNELENABLE_F));
1350+ seq_printf(seq, " PrtEn: %3s\n", yesno(rssconf &
1351+ PORTENABLE_F));
1352+ seq_printf(seq, " TnlAllLkp: %3s\n", yesno(rssconf &
1353+ TNLALLLOOKUP_F));
1354+ seq_printf(seq, " VrtEn: %3s\n", yesno(rssconf &
1355+ VIRTENABLE_F));
1356+ seq_printf(seq, " CngEn: %3s\n", yesno(rssconf &
1357+ CONGESTIONENABLE_F));
1358+ seq_printf(seq, " HashToeplitz: %3s\n", yesno(rssconf &
1359+ HASHTOEPLITZ_F));
1360+ seq_printf(seq, " Udp4En: %3s\n", yesno(rssconf & UDPENABLE_F));
1361+ seq_printf(seq, " Disable: %3s\n", yesno(rssconf & DISABLE_F));
1362+
1363+ seq_puts(seq, "\n");
1364+
1365+ rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_TNL_A);
1366+ seq_printf(seq, "TP_RSS_CONFIG_TNL: %#x\n", rssconf);
1367+ seq_printf(seq, " MaskSize: %3d\n", MASKSIZE_G(rssconf));
1368+ seq_printf(seq, " MaskFilter: %3d\n", MASKFILTER_G(rssconf));
1369+ if (CHELSIO_CHIP_VERSION(adapter->params.chip) > CHELSIO_T5) {
1370+ seq_printf(seq, " HashAll: %3s\n",
1371+ yesno(rssconf & HASHALL_F));
1372+ seq_printf(seq, " HashEth: %3s\n",
1373+ yesno(rssconf & HASHETH_F));
1374+ }
1375+ seq_printf(seq, " UseWireCh: %3s\n", yesno(rssconf & USEWIRECH_F));
1376+
1377+ seq_puts(seq, "\n");
1378+
1379+ rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_OFD_A);
1380+ seq_printf(seq, "TP_RSS_CONFIG_OFD: %#x\n", rssconf);
1381+ seq_printf(seq, " MaskSize: %3d\n", MASKSIZE_G(rssconf));
1382+ seq_printf(seq, " RRCplMapEn: %3s\n", yesno(rssconf &
1383+ RRCPLMAPEN_F));
1384+ seq_printf(seq, " RRCplQueWidth: %3d\n", RRCPLQUEWIDTH_G(rssconf));
1385+
1386+ seq_puts(seq, "\n");
1387+
1388+ rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_SYN_A);
1389+ seq_printf(seq, "TP_RSS_CONFIG_SYN: %#x\n", rssconf);
1390+ seq_printf(seq, " MaskSize: %3d\n", MASKSIZE_G(rssconf));
1391+ seq_printf(seq, " UseWireCh: %3s\n", yesno(rssconf & USEWIRECH_F));
1392+
1393+ seq_puts(seq, "\n");
1394+
1395+ rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_VRT_A);
1396+ seq_printf(seq, "TP_RSS_CONFIG_VRT: %#x\n", rssconf);
1397+ if (CHELSIO_CHIP_VERSION(adapter->params.chip) > CHELSIO_T5) {
1398+ seq_printf(seq, " KeyWrAddrX: %3d\n",
1399+ KEYWRADDRX_G(rssconf));
1400+ seq_printf(seq, " KeyExtend: %3s\n",
1401+ yesno(rssconf & KEYEXTEND_F));
1402+ }
1403+ seq_printf(seq, " VfRdRg: %3s\n", yesno(rssconf & VFRDRG_F));
1404+ seq_printf(seq, " VfRdEn: %3s\n", yesno(rssconf & VFRDEN_F));
1405+ seq_printf(seq, " VfPerrEn: %3s\n", yesno(rssconf & VFPERREN_F));
1406+ seq_printf(seq, " KeyPerrEn: %3s\n", yesno(rssconf & KEYPERREN_F));
1407+ seq_printf(seq, " DisVfVlan: %3s\n", yesno(rssconf &
1408+ DISABLEVLAN_F));
1409+ seq_printf(seq, " EnUpSwt: %3s\n", yesno(rssconf & ENABLEUP0_F));
1410+ seq_printf(seq, " HashDelay: %3d\n", HASHDELAY_G(rssconf));
1411+ if (CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5)
1412+ seq_printf(seq, " VfWrAddr: %3d\n", VFWRADDR_G(rssconf));
1413+ seq_printf(seq, " KeyMode: %s\n", keymode[KEYMODE_G(rssconf)]);
1414+ seq_printf(seq, " VfWrEn: %3s\n", yesno(rssconf & VFWREN_F));
1415+ seq_printf(seq, " KeyWrEn: %3s\n", yesno(rssconf & KEYWREN_F));
1416+ seq_printf(seq, " KeyWrAddr: %3d\n", KEYWRADDR_G(rssconf));
1417+
1418+ seq_puts(seq, "\n");
1419+
1420+ rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_CNG_A);
1421+ seq_printf(seq, "TP_RSS_CONFIG_CNG: %#x\n", rssconf);
1422+ seq_printf(seq, " ChnCount3: %3s\n", yesno(rssconf & CHNCOUNT3_F));
1423+ seq_printf(seq, " ChnCount2: %3s\n", yesno(rssconf & CHNCOUNT2_F));
1424+ seq_printf(seq, " ChnCount1: %3s\n", yesno(rssconf & CHNCOUNT1_F));
1425+ seq_printf(seq, " ChnCount0: %3s\n", yesno(rssconf & CHNCOUNT0_F));
1426+ seq_printf(seq, " ChnUndFlow3: %3s\n", yesno(rssconf &
1427+ CHNUNDFLOW3_F));
1428+ seq_printf(seq, " ChnUndFlow2: %3s\n", yesno(rssconf &
1429+ CHNUNDFLOW2_F));
1430+ seq_printf(seq, " ChnUndFlow1: %3s\n", yesno(rssconf &
1431+ CHNUNDFLOW1_F));
1432+ seq_printf(seq, " ChnUndFlow0: %3s\n", yesno(rssconf &
1433+ CHNUNDFLOW0_F));
1434+ seq_printf(seq, " RstChn3: %3s\n", yesno(rssconf & RSTCHN3_F));
1435+ seq_printf(seq, " RstChn2: %3s\n", yesno(rssconf & RSTCHN2_F));
1436+ seq_printf(seq, " RstChn1: %3s\n", yesno(rssconf & RSTCHN1_F));
1437+ seq_printf(seq, " RstChn0: %3s\n", yesno(rssconf & RSTCHN0_F));
1438+ seq_printf(seq, " UpdVld: %3s\n", yesno(rssconf & UPDVLD_F));
1439+ seq_printf(seq, " Xoff: %3s\n", yesno(rssconf & XOFF_F));
1440+ seq_printf(seq, " UpdChn3: %3s\n", yesno(rssconf & UPDCHN3_F));
1441+ seq_printf(seq, " UpdChn2: %3s\n", yesno(rssconf & UPDCHN2_F));
1442+ seq_printf(seq, " UpdChn1: %3s\n", yesno(rssconf & UPDCHN1_F));
1443+ seq_printf(seq, " UpdChn0: %3s\n", yesno(rssconf & UPDCHN0_F));
1444+ seq_printf(seq, " Queue: %3d\n", QUEUE_G(rssconf));
1445+
1446+ return 0;
1447+}
1448+
1449+DEFINE_SIMPLE_DEBUGFS_FILE(rss_config);
1450+
1451+/* RSS Secret Key.
1452+ */
1453+
1454+static int rss_key_show(struct seq_file *seq, void *v)
1455+{
1456+ u32 key[10];
1457+
1458+ t4_read_rss_key(seq->private, key);
1459+ seq_printf(seq, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x\n",
1460+ key[9], key[8], key[7], key[6], key[5], key[4], key[3],
1461+ key[2], key[1], key[0]);
1462+ return 0;
1463+}
1464+
1465+static int rss_key_open(struct inode *inode, struct file *file)
1466+{
1467+ return single_open(file, rss_key_show, inode->i_private);
1468+}
1469+
1470+static ssize_t rss_key_write(struct file *file, const char __user *buf,
1471+ size_t count, loff_t *pos)
1472+{
1473+ int i, j;
1474+ u32 key[10];
1475+ char s[100], *p;
1476+ struct adapter *adap = FILE_DATA(file)->i_private;
1477+
1478+ if (count > sizeof(s) - 1)
1479+ return -EINVAL;
1480+ if (copy_from_user(s, buf, count))
1481+ return -EFAULT;
1482+ for (i = count; i > 0 && isspace(s[i - 1]); i--)
1483+ ;
1484+ s[i] = '\0';
1485+
1486+ for (p = s, i = 9; i >= 0; i--) {
1487+ key[i] = 0;
1488+ for (j = 0; j < 8; j++, p++) {
1489+ if (!isxdigit(*p))
1490+ return -EINVAL;
1491+ key[i] = (key[i] << 4) | hex2val(*p);
1492+ }
1493+ }
1494+
1495+ t4_write_rss_key(adap, key, -1);
1496+ return count;
1497+}
1498+
1499+static const struct file_operations rss_key_debugfs_fops = {
1500+ .owner = THIS_MODULE,
1501+ .open = rss_key_open,
1502+ .read = seq_read,
1503+ .llseek = seq_lseek,
1504+ .release = single_release,
1505+ .write = rss_key_write
1506+};
1507+
1508+/* PF RSS Configuration.
1509+ */
1510+
1511+struct rss_pf_conf {
1512+ u32 rss_pf_map;
1513+ u32 rss_pf_mask;
1514+ u32 rss_pf_config;
1515+};
1516+
1517+static int rss_pf_config_show(struct seq_file *seq, void *v, int idx)
1518+{
1519+ struct rss_pf_conf *pfconf;
1520+
1521+ if (v == SEQ_START_TOKEN) {
1522+ /* use the 0th entry to dump the PF Map Index Size */
1523+ pfconf = seq->private + offsetof(struct seq_tab, data);
1524+ seq_printf(seq, "PF Map Index Size = %d\n\n",
1525+ LKPIDXSIZE_G(pfconf->rss_pf_map));
1526+
1527+ seq_puts(seq, " RSS PF VF Hash Tuple Enable Default\n");
1528+ seq_puts(seq, " Enable IPF Mask Mask IPv6 IPv4 UDP Queue\n");
1529+ seq_puts(seq, " PF Map Chn Prt Map Size Size Four Two Four Two Four Ch1 Ch0\n");
1530+ } else {
1531+ #define G_PFnLKPIDX(map, n) \
1532+ (((map) >> PF1LKPIDX_S*(n)) & PF0LKPIDX_M)
1533+ #define G_PFnMSKSIZE(mask, n) \
1534+ (((mask) >> PF1MSKSIZE_S*(n)) & PF1MSKSIZE_M)
1535+
1536+ pfconf = v;
1537+ seq_printf(seq, "%3d %3s %3s %3s %3d %3d %3d %3s %3s %3s %3s %3s %3d %3d\n",
1538+ idx,
1539+ yesno(pfconf->rss_pf_config & MAPENABLE_F),
1540+ yesno(pfconf->rss_pf_config & CHNENABLE_F),
1541+ yesno(pfconf->rss_pf_config & PRTENABLE_F),
1542+ G_PFnLKPIDX(pfconf->rss_pf_map, idx),
1543+ G_PFnMSKSIZE(pfconf->rss_pf_mask, idx),
1544+ IVFWIDTH_G(pfconf->rss_pf_config),
1545+ yesno(pfconf->rss_pf_config & IP6FOURTUPEN_F),
1546+ yesno(pfconf->rss_pf_config & IP6TWOTUPEN_F),
1547+ yesno(pfconf->rss_pf_config & IP4FOURTUPEN_F),
1548+ yesno(pfconf->rss_pf_config & IP4TWOTUPEN_F),
1549+ yesno(pfconf->rss_pf_config & UDPFOURTUPEN_F),
1550+ CH1DEFAULTQUEUE_G(pfconf->rss_pf_config),
1551+ CH0DEFAULTQUEUE_G(pfconf->rss_pf_config));
1552+
1553+ #undef G_PFnLKPIDX
1554+ #undef G_PFnMSKSIZE
1555+ }
1556+ return 0;
1557+}
1558+
1559+static int rss_pf_config_open(struct inode *inode, struct file *file)
1560+{
1561+ struct adapter *adapter = inode->i_private;
1562+ struct seq_tab *p;
1563+ u32 rss_pf_map, rss_pf_mask;
1564+ struct rss_pf_conf *pfconf;
1565+ int pf;
1566+
1567+ p = seq_open_tab(file, 8, sizeof(*pfconf), 1, rss_pf_config_show);
1568+ if (!p)
1569+ return -ENOMEM;
1570+
1571+ pfconf = (struct rss_pf_conf *)p->data;
1572+ rss_pf_map = t4_read_rss_pf_map(adapter);
1573+ rss_pf_mask = t4_read_rss_pf_mask(adapter);
1574+ for (pf = 0; pf < 8; pf++) {
1575+ pfconf[pf].rss_pf_map = rss_pf_map;
1576+ pfconf[pf].rss_pf_mask = rss_pf_mask;
1577+ t4_read_rss_pf_config(adapter, pf, &pfconf[pf].rss_pf_config);
1578+ }
1579+ return 0;
1580+}
1581+
1582+static const struct file_operations rss_pf_config_debugfs_fops = {
1583+ .owner = THIS_MODULE,
1584+ .open = rss_pf_config_open,
1585+ .read = seq_read,
1586+ .llseek = seq_lseek,
1587+ .release = seq_release_private
1588+};
1589+
1590+/* VF RSS Configuration.
1591+ */
1592+
1593+struct rss_vf_conf {
1594+ u32 rss_vf_vfl;
1595+ u32 rss_vf_vfh;
1596+};
1597+
1598+static int rss_vf_config_show(struct seq_file *seq, void *v, int idx)
1599+{
1600+ if (v == SEQ_START_TOKEN) {
1601+ seq_puts(seq, " RSS Hash Tuple Enable\n");
1602+ seq_puts(seq, " Enable IVF Dis Enb IPv6 IPv4 UDP Def Secret Key\n");
1603+ seq_puts(seq, " VF Chn Prt Map VLAN uP Four Two Four Two Four Que Idx Hash\n");
1604+ } else {
1605+ struct rss_vf_conf *vfconf = v;
1606+
1607+ seq_printf(seq, "%3d %3s %3s %3d %3s %3s %3s %3s %3s %3s %3s %4d %3d %#10x\n",
1608+ idx,
1609+ yesno(vfconf->rss_vf_vfh & VFCHNEN_F),
1610+ yesno(vfconf->rss_vf_vfh & VFPRTEN_F),
1611+ VFLKPIDX_G(vfconf->rss_vf_vfh),
1612+ yesno(vfconf->rss_vf_vfh & VFVLNEX_F),
1613+ yesno(vfconf->rss_vf_vfh & VFUPEN_F),
1614+ yesno(vfconf->rss_vf_vfh & VFIP4FOURTUPEN_F),
1615+ yesno(vfconf->rss_vf_vfh & VFIP6TWOTUPEN_F),
1616+ yesno(vfconf->rss_vf_vfh & VFIP4FOURTUPEN_F),
1617+ yesno(vfconf->rss_vf_vfh & VFIP4TWOTUPEN_F),
1618+ yesno(vfconf->rss_vf_vfh & ENABLEUDPHASH_F),
1619+ DEFAULTQUEUE_G(vfconf->rss_vf_vfh),
1620+ KEYINDEX_G(vfconf->rss_vf_vfh),
1621+ vfconf->rss_vf_vfl);
1622+ }
1623+ return 0;
1624+}
1625+
1626+static int rss_vf_config_open(struct inode *inode, struct file *file)
1627+{
1628+ struct adapter *adapter = inode->i_private;
1629+ struct seq_tab *p;
1630+ struct rss_vf_conf *vfconf;
1631+ int vf;
1632+
1633+ p = seq_open_tab(file, 128, sizeof(*vfconf), 1, rss_vf_config_show);
1634+ if (!p)
1635+ return -ENOMEM;
1636+
1637+ vfconf = (struct rss_vf_conf *)p->data;
1638+ for (vf = 0; vf < 128; vf++) {
1639+ t4_read_rss_vf_config(adapter, vf, &vfconf[vf].rss_vf_vfl,
1640+ &vfconf[vf].rss_vf_vfh);
1641+ }
1642+ return 0;
1643+}
1644+
1645+static const struct file_operations rss_vf_config_debugfs_fops = {
1646+ .owner = THIS_MODULE,
1647+ .open = rss_vf_config_open,
1648+ .read = seq_read,
1649+ .llseek = seq_lseek,
1650+ .release = seq_release_private
1651+};
1652+
1653+/**
1654+ * ethqset2pinfo - return port_info of an Ethernet Queue Set
1655+ * @adap: the adapter
1656+ * @qset: Ethernet Queue Set
1657+ */
1658+static inline struct port_info *ethqset2pinfo(struct adapter *adap, int qset)
1659+{
1660+ int pidx;
1661+
1662+ for_each_port(adap, pidx) {
1663+ struct port_info *pi = adap2pinfo(adap, pidx);
1664+
1665+ if (qset >= pi->first_qset &&
1666+ qset < pi->first_qset + pi->nqsets)
1667+ return pi;
1668+ }
1669+
1670+ /* should never happen! */
1671+ BUG_ON(1);
1672+ return NULL;
1673+}
1674+
1675+static int sge_qinfo_show(struct seq_file *seq, void *v)
1676+{
1677+ struct adapter *adap = seq->private;
1678+ int eth_entries = DIV_ROUND_UP(adap->sge.ethqsets, 4);
1679+ int toe_entries = DIV_ROUND_UP(adap->sge.ofldqsets, 4);
1680+ int rdma_entries = DIV_ROUND_UP(adap->sge.rdmaqs, 4);
1681+ int ciq_entries = DIV_ROUND_UP(adap->sge.rdmaciqs, 4);
1682+ int ctrl_entries = DIV_ROUND_UP(MAX_CTRL_QUEUES, 4);
1683+ int i, r = (uintptr_t)v - 1;
1684+ int toe_idx = r - eth_entries;
1685+ int rdma_idx = toe_idx - toe_entries;
1686+ int ciq_idx = rdma_idx - rdma_entries;
1687+ int ctrl_idx = ciq_idx - ciq_entries;
1688+ int fq_idx = ctrl_idx - ctrl_entries;
1689+
1690+ if (r)
1691+ seq_putc(seq, '\n');
1692+
1693+#define S3(fmt_spec, s, v) \
1694+do { \
1695+ seq_printf(seq, "%-12s", s); \
1696+ for (i = 0; i < n; ++i) \
1697+ seq_printf(seq, " %16" fmt_spec, v); \
1698+ seq_putc(seq, '\n'); \
1699+} while (0)
1700+#define S(s, v) S3("s", s, v)
1701+#define T(s, v) S3("u", s, tx[i].v)
1702+#define R(s, v) S3("u", s, rx[i].v)
1703+
1704+ if (r < eth_entries) {
1705+ int base_qset = r * 4;
1706+ const struct sge_eth_rxq *rx = &adap->sge.ethrxq[base_qset];
1707+ const struct sge_eth_txq *tx = &adap->sge.ethtxq[base_qset];
1708+ int n = min(4, adap->sge.ethqsets - 4 * r);
1709+
1710+ S("QType:", "Ethernet");
1711+ S("Interface:",
1712+ rx[i].rspq.netdev ? rx[i].rspq.netdev->name : "N/A");
1713+ T("TxQ ID:", q.cntxt_id);
1714+ T("TxQ size:", q.size);
1715+ T("TxQ inuse:", q.in_use);
1716+ T("TxQ CIDX:", q.cidx);
1717+ T("TxQ PIDX:", q.pidx);
1718+#ifdef CONFIG_CHELSIO_T4_DCB
1719+ T("DCB Prio:", dcb_prio);
1720+ S3("u", "DCB PGID:",
1721+ (ethqset2pinfo(adap, base_qset + i)->dcb.pgid >>
1722+ 4*(7-tx[i].dcb_prio)) & 0xf);
1723+ S3("u", "DCB PFC:",
1724+ (ethqset2pinfo(adap, base_qset + i)->dcb.pfcen >>
1725+ 1*(7-tx[i].dcb_prio)) & 0x1);
1726+#endif
1727+ R("RspQ ID:", rspq.abs_id);
1728+ R("RspQ size:", rspq.size);
1729+ R("RspQE size:", rspq.iqe_len);
1730+ R("RspQ CIDX:", rspq.cidx);
1731+ R("RspQ Gen:", rspq.gen);
1732+ S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq));
1733+ S3("u", "Intr pktcnt:",
1734+ adap->sge.counter_val[rx[i].rspq.pktcnt_idx]);
1735+ R("FL ID:", fl.cntxt_id);
1736+ R("FL size:", fl.size - 8);
1737+ R("FL pend:", fl.pend_cred);
1738+ R("FL avail:", fl.avail);
1739+ R("FL PIDX:", fl.pidx);
1740+ R("FL CIDX:", fl.cidx);
1741+ } else if (toe_idx < toe_entries) {
1742+ const struct sge_ofld_rxq *rx = &adap->sge.ofldrxq[toe_idx * 4];
1743+ const struct sge_ofld_txq *tx = &adap->sge.ofldtxq[toe_idx * 4];
1744+ int n = min(4, adap->sge.ofldqsets - 4 * toe_idx);
1745+
1746+ S("QType:", "TOE");
1747+ T("TxQ ID:", q.cntxt_id);
1748+ T("TxQ size:", q.size);
1749+ T("TxQ inuse:", q.in_use);
1750+ T("TxQ CIDX:", q.cidx);
1751+ T("TxQ PIDX:", q.pidx);
1752+ R("RspQ ID:", rspq.abs_id);
1753+ R("RspQ size:", rspq.size);
1754+ R("RspQE size:", rspq.iqe_len);
1755+ R("RspQ CIDX:", rspq.cidx);
1756+ R("RspQ Gen:", rspq.gen);
1757+ S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq));
1758+ S3("u", "Intr pktcnt:",
1759+ adap->sge.counter_val[rx[i].rspq.pktcnt_idx]);
1760+ R("FL ID:", fl.cntxt_id);
1761+ R("FL size:", fl.size - 8);
1762+ R("FL pend:", fl.pend_cred);
1763+ R("FL avail:", fl.avail);
1764+ R("FL PIDX:", fl.pidx);
1765+ R("FL CIDX:", fl.cidx);
1766+ } else if (rdma_idx < rdma_entries) {
1767+ const struct sge_ofld_rxq *rx =
1768+ &adap->sge.rdmarxq[rdma_idx * 4];
1769+ int n = min(4, adap->sge.rdmaqs - 4 * rdma_idx);
1770+
1771+ S("QType:", "RDMA-CPL");
1772+ R("RspQ ID:", rspq.abs_id);
1773+ R("RspQ size:", rspq.size);
1774+ R("RspQE size:", rspq.iqe_len);
1775+ R("RspQ CIDX:", rspq.cidx);
1776+ R("RspQ Gen:", rspq.gen);
1777+ S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq));
1778+ S3("u", "Intr pktcnt:",
1779+ adap->sge.counter_val[rx[i].rspq.pktcnt_idx]);
1780+ R("FL ID:", fl.cntxt_id);
1781+ R("FL size:", fl.size - 8);
1782+ R("FL pend:", fl.pend_cred);
1783+ R("FL avail:", fl.avail);
1784+ R("FL PIDX:", fl.pidx);
1785+ R("FL CIDX:", fl.cidx);
1786+ } else if (ciq_idx < ciq_entries) {
1787+ const struct sge_ofld_rxq *rx = &adap->sge.rdmaciq[ciq_idx * 4];
1788+ int n = min(4, adap->sge.rdmaciqs - 4 * ciq_idx);
1789+
1790+ S("QType:", "RDMA-CIQ");
1791+ R("RspQ ID:", rspq.abs_id);
1792+ R("RspQ size:", rspq.size);
1793+ R("RspQE size:", rspq.iqe_len);
1794+ R("RspQ CIDX:", rspq.cidx);
1795+ R("RspQ Gen:", rspq.gen);
1796+ S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq));
1797+ S3("u", "Intr pktcnt:",
1798+ adap->sge.counter_val[rx[i].rspq.pktcnt_idx]);
1799+ } else if (ctrl_idx < ctrl_entries) {
1800+ const struct sge_ctrl_txq *tx = &adap->sge.ctrlq[ctrl_idx * 4];
1801+ int n = min(4, adap->params.nports - 4 * ctrl_idx);
1802+
1803+ S("QType:", "Control");
1804+ T("TxQ ID:", q.cntxt_id);
1805+ T("TxQ size:", q.size);
1806+ T("TxQ inuse:", q.in_use);
1807+ T("TxQ CIDX:", q.cidx);
1808+ T("TxQ PIDX:", q.pidx);
1809+ } else if (fq_idx == 0) {
1810+ const struct sge_rspq *evtq = &adap->sge.fw_evtq;
1811+
1812+ seq_printf(seq, "%-12s %16s\n", "QType:", "FW event queue");
1813+ seq_printf(seq, "%-12s %16u\n", "RspQ ID:", evtq->abs_id);
1814+ seq_printf(seq, "%-12s %16u\n", "RspQ size:", evtq->size);
1815+ seq_printf(seq, "%-12s %16u\n", "RspQE size:", evtq->iqe_len);
1816+ seq_printf(seq, "%-12s %16u\n", "RspQ CIDX:", evtq->cidx);
1817+ seq_printf(seq, "%-12s %16u\n", "RspQ Gen:", evtq->gen);
1818+ seq_printf(seq, "%-12s %16u\n", "Intr delay:",
1819+ qtimer_val(adap, evtq));
1820+ seq_printf(seq, "%-12s %16u\n", "Intr pktcnt:",
1821+ adap->sge.counter_val[evtq->pktcnt_idx]);
1822+ }
1823+#undef R
1824+#undef T
1825+#undef S
1826+#undef S3
1827+return 0;
1828+}
1829+
1830+static int sge_queue_entries(const struct adapter *adap)
1831+{
1832+ return DIV_ROUND_UP(adap->sge.ethqsets, 4) +
1833+ DIV_ROUND_UP(adap->sge.ofldqsets, 4) +
1834+ DIV_ROUND_UP(adap->sge.rdmaqs, 4) +
1835+ DIV_ROUND_UP(adap->sge.rdmaciqs, 4) +
1836+ DIV_ROUND_UP(MAX_CTRL_QUEUES, 4) + 1;
1837+}
1838+
1839+static void *sge_queue_start(struct seq_file *seq, loff_t *pos)
1840+{
1841+ int entries = sge_queue_entries(seq->private);
1842+
1843+ return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL;
1844+}
1845+
1846+static void sge_queue_stop(struct seq_file *seq, void *v)
1847+{
1848+}
1849+
1850+static void *sge_queue_next(struct seq_file *seq, void *v, loff_t *pos)
1851+{
1852+ int entries = sge_queue_entries(seq->private);
1853+
1854+ ++*pos;
1855+ return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL;
1856+}
1857+
1858+static const struct seq_operations sge_qinfo_seq_ops = {
1859+ .start = sge_queue_start,
1860+ .next = sge_queue_next,
1861+ .stop = sge_queue_stop,
1862+ .show = sge_qinfo_show
1863+};
1864+
1865+static int sge_qinfo_open(struct inode *inode, struct file *file)
1866+{
1867+ int res = seq_open(file, &sge_qinfo_seq_ops);
1868+
1869+ if (!res) {
1870+ struct seq_file *seq = file->private_data;
1871+
1872+ seq->private = inode->i_private;
1873+ }
1874+ return res;
1875+}
1876+
1877+static const struct file_operations sge_qinfo_debugfs_fops = {
1878+ .owner = THIS_MODULE,
1879+ .open = sge_qinfo_open,
1880+ .read = seq_read,
1881+ .llseek = seq_lseek,
1882+ .release = seq_release,
1883+};
1884+
1885+int mem_open(struct inode *inode, struct file *file)
1886+{
1887+ unsigned int mem;
1888+ struct adapter *adap;
1889+
1890+ file->private_data = inode->i_private;
1891+
1892+ mem = (uintptr_t)file->private_data & 0x3;
1893+ adap = file->private_data - mem;
1894+
1895+ (void)t4_fwcache(adap, FW_PARAM_DEV_FWCACHE_FLUSH);
1896+
1897+ return 0;
1898+}
1899+
461900 static ssize_t mem_read(struct file *file, char __user *buf, size_t count,
471901 loff_t *ppos)
481902 {
@@ -80,7 +1934,6 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, · 31 unmodified lines
801934 *ppos = pos + count;
811935 return count;
821936 }
83−
841937 static const struct file_operations mem_debugfs_fops = {
851938 .owner = THIS_MODULE,
861939 .open = simple_open,
@@ -88,6 +1941,12 @@ static const struct file_operations mem_debugfs_fops = { · 1 unmodified line
881941 .llseek = default_llseek,
891942 };
901943
1944+static void set_debugfs_file_size(struct dentry *de, loff_t size)
1945+{
1946+ if (!IS_ERR(de) && de->d_inode)
1947+ de->d_inode->i_size = size;
1948+}
1949+
911950 static void add_debugfs_mem(struct adapter *adap, const char *name,
921951 unsigned int idx, unsigned int size_mb)
931952 {
@@ -119,14 +1978,65 @@ int t4_setup_debugfs(struct adapter *adap) · 25 unmodified lines
1191978 {
1201979 int i;
1211980 u32 size;
1981+ struct dentry *de;
1221982
1231983 static struct t4_debugfs_entry t4_debugfs_files[] = {
1984+ { "cim_la", &cim_la_fops, S_IRUSR, 0 },
1985+ { "cim_qcfg", &cim_qcfg_fops, S_IRUSR, 0 },
1986+ { "clk", &clk_debugfs_fops, S_IRUSR, 0 },
1987+ { "devlog", &devlog_fops, S_IRUSR, 0 },
1988+ { "mbox0", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 0 },
1989+ { "mbox1", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 1 },
1990+ { "mbox2", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 2 },
1991+ { "mbox3", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 3 },
1992+ { "mbox4", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 4 },
1993+ { "mbox5", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 5 },
1994+ { "mbox6", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 6 },
1995+ { "mbox7", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 7 },
1241996 { "l2t", &t4_l2t_fops, S_IRUSR, 0},
1997+ { "mps_tcam", &mps_tcam_debugfs_fops, S_IRUSR, 0 },
1998+ { "rss", &rss_debugfs_fops, S_IRUSR, 0 },
1999+ { "rss_config", &rss_config_debugfs_fops, S_IRUSR, 0 },
2000+ { "rss_key", &rss_key_debugfs_fops, S_IRUSR, 0 },
2001+ { "rss_pf_config", &rss_pf_config_debugfs_fops, S_IRUSR, 0 },
2002+ { "rss_vf_config", &rss_vf_config_debugfs_fops, S_IRUSR, 0 },
2003+ { "sge_qinfo", &sge_qinfo_debugfs_fops, S_IRUSR, 0 },
2004+ { "ibq_tp0", &cim_ibq_fops, S_IRUSR, 0 },
2005+ { "ibq_tp1", &cim_ibq_fops, S_IRUSR, 1 },
2006+ { "ibq_ulp", &cim_ibq_fops, S_IRUSR, 2 },
2007+ { "ibq_sge0", &cim_ibq_fops, S_IRUSR, 3 },
2008+ { "ibq_sge1", &cim_ibq_fops, S_IRUSR, 4 },
2009+ { "ibq_ncsi", &cim_ibq_fops, S_IRUSR, 5 },
2010+ { "obq_ulp0", &cim_obq_fops, S_IRUSR, 0 },
2011+ { "obq_ulp1", &cim_obq_fops, S_IRUSR, 1 },
2012+ { "obq_ulp2", &cim_obq_fops, S_IRUSR, 2 },
2013+ { "obq_ulp3", &cim_obq_fops, S_IRUSR, 3 },
2014+ { "obq_sge", &cim_obq_fops, S_IRUSR, 4 },
2015+ { "obq_ncsi", &cim_obq_fops, S_IRUSR, 5 },
2016+ { "tp_la", &tp_la_fops, S_IRUSR, 0 },
2017+ { "ulprx_la", &ulprx_la_fops, S_IRUSR, 0 },
2018+ { "sensors", &sensors_debugfs_fops, S_IRUSR, 0 },
2019+ { "pm_stats", &pm_stats_debugfs_fops, S_IRUSR, 0 },
2020+ { "cctrl", &cctrl_tbl_debugfs_fops, S_IRUSR, 0 },
2021+#if IS_ENABLED(CONFIG_IPV6)
2022+ { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 },
2023+#endif
2024+ };
2025+
2026+ /* Debug FS nodes common to all T5 and later adapters.
2027+ */
2028+ static struct t4_debugfs_entry t5_debugfs_files[] = {
2029+ { "obq_sge_rx_q0", &cim_obq_fops, S_IRUSR, 6 },
2030+ { "obq_sge_rx_q1", &cim_obq_fops, S_IRUSR, 7 },
1252031 };
1262032
1272033 add_debugfs_files(adap,
1282034 t4_debugfs_files,
1292035 ARRAY_SIZE(t4_debugfs_files));
2036+ if (!is_t4(adap->params.chip))
2037+ add_debugfs_files(adap,
2038+ t5_debugfs_files,
2039+ ARRAY_SIZE(t5_debugfs_files));
1302040
1312041 i = t4_read_reg(adap, MA_TARGET_MEM_ENABLE_A);
1322042 if (i & EDRAM0_ENABLE_F) {
@@ -154,5 +2064,10 @@ int t4_setup_debugfs(struct adapter *adap) · 21 unmodified lines
1542064 EXT_MEM1_SIZE_G(size));
1552065 }
1562066 }
2067+
2068+ de = debugfs_create_file("flash", S_IRUSR, adap->debugfs_root, adap,
2069+ &flash_debugfs_fops);
2070+ set_debugfs_file_size(de, adap->params.sf_size);
2071+
1572072 return 0;
1582073 }
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h+33−0
@@ -37,6 +37,21 @@ · 36 unmodified lines
3737
3838 #include <linux/export.h>
3939
40+#define FILE_DATA(_file) ((_file)->f_path.dentry->d_inode)
41+
42+#define DEFINE_SIMPLE_DEBUGFS_FILE(name) \
43+static int name##_open(struct inode *inode, struct file *file) \
44+{ \
45+ return single_open(file, name##_show, inode->i_private); \
46+} \
47+static const struct file_operations name##_debugfs_fops = { \
48+ .owner = THIS_MODULE, \
49+ .open = name##_open, \
50+ .read = seq_read, \
51+ .llseek = seq_lseek, \
52+ .release = single_release \
53+}
54+
4055 struct t4_debugfs_entry {
4156 const char *name;
4257 const struct file_operations *ops;
@@ -44,9 +59,27 @@ struct t4_debugfs_entry { · 1 unmodified line
4459 unsigned char data;
4560 };
4661
62+struct seq_tab {
63+ int (*show)(struct seq_file *seq, void *v, int idx);
64+ unsigned int rows; /* # of entries */
65+ unsigned char width; /* size in bytes of each entry */
66+ unsigned char skip_first; /* whether the first line is a header */
67+ char data[0]; /* the table data */
68+};
69+
70+static inline unsigned int hex2val(char c)
71+{
72+ return isdigit(c) ? c - '0' : tolower(c) - 'a' + 10;
73+}
74+
75+struct seq_tab *seq_open_tab(struct file *f, unsigned int rows,
76+ unsigned int width, unsigned int have_header,
77+ int (*show)(struct seq_file *seq, void *v, int i));
78+
4779 int t4_setup_debugfs(struct adapter *adap);
4880 void add_debugfs_files(struct adapter *adap,
4981 struct t4_debugfs_entry *files,
5082 unsigned int nfiles);
83+int mem_open(struct inode *inode, struct file *file);
5184
5285 #endif
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+294−709
@@ -62,14 +62,18 @@ · 61 unmodified lines
6262 #include <net/netevent.h>
6363 #include <net/addrconf.h>
6464 #include <net/bonding.h>
65+#include <net/addrconf.h>
6566 #include <asm/uaccess.h>
6667
6768 #include "cxgb4.h"
6869 #include "t4_regs.h"
70+#include "t4_values.h"
6971 #include "t4_msg.h"
7072 #include "t4fw_api.h"
73+#include "t4fw_version.h"
7174 #include "cxgb4_dcb.h"
7275 #include "cxgb4_debugfs.h"
76+#include "clip_tbl.h"
7377 #include "l2t.h"
7478
7579 #ifdef DRV_VERSION
@@ -78,99 +82,6 @@ · 2 unmodified lines
7882 #define DRV_VERSION "2.0.0-ko"
7983 #define DRV_DESC "Chelsio T4/T5 Network Driver"
8084
81−/*
82− * Max interrupt hold-off timer value in us. Queues fall back to this value
83− * under extreme memory pressure so it's largish to give the system time to
84− * recover.
85− */
86−#define MAX_SGE_TIMERVAL 200U
87−
88−enum {
89− /*
90− * Physical Function provisioning constants.
91− */
92− PFRES_NVI = 4, /* # of Virtual Interfaces */
93− PFRES_NETHCTRL = 128, /* # of EQs used for ETH or CTRL Qs */
94− PFRES_NIQFLINT = 128, /* # of ingress Qs/w Free List(s)/intr
95− */
96− PFRES_NEQ = 256, /* # of egress queues */
97− PFRES_NIQ = 0, /* # of ingress queues */
98− PFRES_TC = 0, /* PCI-E traffic class */
99− PFRES_NEXACTF = 128, /* # of exact MPS filters */
100−
101− PFRES_R_CAPS = FW_CMD_CAP_PF,
102− PFRES_WX_CAPS = FW_CMD_CAP_PF,
103−
104−#ifdef CONFIG_PCI_IOV
105− /*
106− * Virtual Function provisioning constants. We need two extra Ingress
107− * Queues with Interrupt capability to serve as the VF's Firmware
108− * Event Queue and Forwarded Interrupt Queue (when using MSI mode) --
109− * neither will have Free Lists associated with them). For each
110− * Ethernet/Control Egress Queue and for each Free List, we need an
111− * Egress Context.
112− */
113− VFRES_NPORTS = 1, /* # of "ports" per VF */
114− VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */
115−
116− VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */
117− VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */
118− VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */
119− VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */
120− VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
121− VFRES_TC = 0, /* PCI-E traffic class */
122− VFRES_NEXACTF = 16, /* # of exact MPS filters */
123−
124− VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT,
125− VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF,
126−#endif
127−};
128−
129−/*
130− * Provide a Port Access Rights Mask for the specified PF/VF. This is very
131− * static and likely not to be useful in the long run. We really need to
132− * implement some form of persistent configuration which the firmware
133− * controls.
134− */
135−static unsigned int pfvfres_pmask(struct adapter *adapter,
136− unsigned int pf, unsigned int vf)
137−{
138− unsigned int portn, portvec;
139−
140− /*
141− * Give PF's access to all of the ports.
142− */
143− if (vf == 0)
144− return FW_PFVF_CMD_PMASK_M;
145−
146− /*
147− * For VFs, we'll assign them access to the ports based purely on the
148− * PF. We assign active ports in order, wrapping around if there are
149− * fewer active ports than PFs: e.g. active port[pf % nports].
150− * Unfortunately the adapter's port_info structs haven't been
151− * initialized yet so we have to compute this.
152− */
153− if (adapter->params.nports == 0)
154− return 0;
155−
156− portn = pf % adapter->params.nports;
157− portvec = adapter->params.portvec;
158− for (;;) {
159− /*
160− * Isolate the lowest set bit in the port vector. If we're at
161− * the port number that we want, return that as the pmask.
162− * otherwise mask that bit out of the port vector and
163− * decrement our port number ...
164− */
165− unsigned int pmask = portvec ^ (portvec & (portvec-1));
166− if (portn == 0)
167− return pmask;
168− portn--;
169− portvec &= ~pmask;
170− }
171− /*NOTREACHED*/
172−}
173−
17485 enum {
17586 MAX_TXQ_ENTRIES = 16384,
17687 MAX_CTRL_TXQ_ENTRIES = 1024,
@@ -263,7 +174,8 @@ MODULE_PARM_DESC(force_init, "Forcibly become Master PF and initialize adapter") · 86 unmodified lines
263174 static uint force_old_init;
264175
265176 module_param(force_old_init, uint, 0644);
266−MODULE_PARM_DESC(force_old_init, "Force old initialization sequence");
177+MODULE_PARM_DESC(force_old_init, "Force old initialization sequence, deprecated"
178+ " parameter");
267179
268180 static int dflt_msg_enable = DFLT_MSG_ENABLE;
269181
@@ -292,13 +204,14 @@ static unsigned int intr_holdoff[SGE_NTIMERS - 1] = { 5, 10, 20, 50, 100 }; · 22 unmodified lines
292204
293205 module_param_array(intr_holdoff, uint, NULL, 0644);
294206 MODULE_PARM_DESC(intr_holdoff, "values for queue interrupt hold-off timers "
295− "0..4 in microseconds");
207+ "0..4 in microseconds, deprecated parameter");
296208
297209 static unsigned int intr_cnt[SGE_NCOUNTERS - 1] = { 4, 8, 16 };
298210
299211 module_param_array(intr_cnt, uint, NULL, 0644);
300212 MODULE_PARM_DESC(intr_cnt,
301− "thresholds 1..3 for queue interrupt packet counters");
213+ "thresholds 1..3 for queue interrupt packet counters, "
214+ "deprecated parameter");
302215
303216 /*
304217 * Normally we tell the chip to deliver Ingress Packets into our DMA buffers
@@ -318,7 +231,8 @@ static bool vf_acls; · 13 unmodified lines
318231
319232 #ifdef CONFIG_PCI_IOV
320233 module_param(vf_acls, bool, 0644);
321−MODULE_PARM_DESC(vf_acls, "if set enable virtualization L2 ACL enforcement");
234+MODULE_PARM_DESC(vf_acls, "if set enable virtualization L2 ACL enforcement, "
235+ "deprecated parameter");
322236
323237 /* Configure the number of PCI-E Virtual Function which are to be instantiated
324238 * on SR-IOV Capable Physical Functions.
@@ -340,32 +254,11 @@ module_param(select_queue, int, 0644); · 15 unmodified lines
340254 MODULE_PARM_DESC(select_queue,
341255 "Select between kernel provided method of selecting or driver method of selecting TX queue. Default is kernel method.");
342256
343−/*
344− * The filter TCAM has a fixed portion and a variable portion. The fixed
345− * portion can match on source/destination IP IPv4/IPv6 addresses and TCP/UDP
346− * ports. The variable portion is 36 bits which can include things like Exact
347− * Match MAC Index (9 bits), Ether Type (16 bits), IP Protocol (8 bits),
348− * [Inner] VLAN Tag (17 bits), etc. which, if all were somehow selected, would
349− * far exceed the 36-bit budget for this "compressed" header portion of the
350− * filter. Thus, we have a scarce resource which must be carefully managed.
351− *
352− * By default we set this up to mostly match the set of filter matching
353− * capabilities of T3 but with accommodations for some of T4's more
354− * interesting features:
355− *
356− * { IP Fragment (1), MPS Match Type (3), IP Protocol (8),
357− * [Inner] VLAN (17), Port (3), FCoE (1) }
358− */
359−enum {
360− TP_VLAN_PRI_MAP_DEFAULT = HW_TPL_FR_MT_PR_IV_P_FC,
361− TP_VLAN_PRI_MAP_FIRST = FCOE_SHIFT,
362− TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_SHIFT,
363−};
364−
365−static unsigned int tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
257+static unsigned int tp_vlan_pri_map = HW_TPL_FR_MT_PR_IV_P_FC;
366258
367259 module_param(tp_vlan_pri_map, uint, 0644);
368−MODULE_PARM_DESC(tp_vlan_pri_map, "global compressed filter configuration");
260+MODULE_PARM_DESC(tp_vlan_pri_map, "global compressed filter configuration, "
261+ "deprecated parameter");
369262
370263 static struct dentry *cxgb4_debugfs_root;
371264
@@ -671,7 +564,7 @@ static void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl) · 299 unmodified lines
671564 if (idx >= adap->tids.ftid_base && nidx <
672565 (adap->tids.nftids + adap->tids.nsftids)) {
673566 idx = nidx;
674− ret = GET_TCB_COOKIE(rpl->cookie);
567+ ret = TCB_COOKIE_G(rpl->cookie);
675568 f = &adap->tids.ftid_tab[idx];
676569
677570 if (ret == FW_FILTER_WR_FLT_DELETED) {
@@ -723,7 +616,7 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, · 45 unmodified lines
723616
724617 if (likely(opcode == CPL_SGE_EGR_UPDATE)) {
725618 const struct cpl_sge_egr_update *p = (void *)rsp;
726− unsigned int qid = EGR_QID(ntohl(p->opcode_qid));
619+ unsigned int qid = EGR_QID_G(ntohl(p->opcode_qid));
727620 struct sge_txq *txq;
728621
729622 txq = q->adap->sge.egr_map[qid - q->adap->sge.egr_start];
@@ -833,11 +726,11 @@ static void disable_msi(struct adapter *adapter) · 103 unmodified lines
833726 static irqreturn_t t4_nondata_intr(int irq, void *cookie)
834727 {
835728 struct adapter *adap = cookie;
729+ u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A));
836730
837− u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE));
838− if (v & PFSW) {
731+ if (v & PFSW_F) {
839732 adap->swintr = 1;
840− t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE), v);
733+ t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A), v);
841734 }
842735 t4_slow_intr_handler(adap);
843736 return IRQ_HANDLED;
@@ -1030,8 +923,14 @@ static void quiesce_rx(struct adapter *adap) · 186 unmodified lines
1030923 for (i = 0; i < ARRAY_SIZE(adap->sge.ingr_map); i++) {
1031924 struct sge_rspq *q = adap->sge.ingr_map[i];
1032925
1033− if (q && q->handler)
926+ if (q && q->handler) {
1034927 napi_disable(&q->napi);
928+ local_bh_disable();
929+ while (!cxgb_poll_lock_napi(q))
930+ mdelay(1);
931+ local_bh_enable();
932+ }
933+
1035934 }
1036935 }
1037936
@@ -1047,12 +946,14 @@ static void enable_rx(struct adapter *adap) · 9 unmodified lines
1047946
1048947 if (!q)
1049948 continue;
1050− if (q->handler)
949+ if (q->handler) {
950+ cxgb_busy_poll_init_lock(q);
1051951 napi_enable(&q->napi);
952+ }
1052953 /* 0-increment GTS to start the timer and enable interrupts */
1053− t4_write_reg(adap, MYPF_REG(SGE_PF_GTS),
1054− SEINTARM(q->intr_params) |
1055− INGRESSQID(q->cntxt_id));
954+ t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A),
955+ SEINTARM_V(q->intr_params) |
956+ INGRESSQID_V(q->cntxt_id));
1056957 }
1057958 }
1058959
@@ -1176,10 +1077,10 @@ freeout: t4_free_sge_resources(adap); · 117 unmodified lines
11761077 }
11771078
11781079 t4_write_reg(adap, is_t4(adap->params.chip) ?
1179− MPS_TRC_RSS_CONTROL :
1180− MPS_T5_TRC_RSS_CONTROL,
1181− RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) |
1182− QUEUENUMBER(s->ethrxq[0].rspq.abs_id));
1080+ MPS_TRC_RSS_CONTROL_A :
1081+ MPS_T5_TRC_RSS_CONTROL_A,
1082+ RSSCONTROL_V(netdev2pinfo(adap->port[0])->tx_chan) |
1083+ QUEUENUMBER_V(s->ethrxq[0].rspq.abs_id));
11831084 return 0;
11841085 }
11851086
@@ -1518,6 +1419,7 @@ static int get_eeprom_len(struct net_device *dev) · 332 unmodified lines
15181419 static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
15191420 {
15201421 struct adapter *adapter = netdev2adap(dev);
1422+ u32 exprom_vers;
15211423
15221424 strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
15231425 strlcpy(info->version, DRV_VERSION, sizeof(info->version));
@@ -1535,6 +1437,14 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) · 11 unmodified lines
15351437 FW_HDR_FW_VER_MINOR_G(adapter->params.tp_vers),
15361438 FW_HDR_FW_VER_MICRO_G(adapter->params.tp_vers),
15371439 FW_HDR_FW_VER_BUILD_G(adapter->params.tp_vers));
1440+
1441+ if (!t4_get_exprom_version(adapter, &exprom_vers))
1442+ snprintf(info->erom_version, sizeof(info->erom_version),
1443+ "%u.%u.%u.%u",
1444+ FW_HDR_FW_VER_MAJOR_G(exprom_vers),
1445+ FW_HDR_FW_VER_MINOR_G(exprom_vers),
1446+ FW_HDR_FW_VER_MICRO_G(exprom_vers),
1447+ FW_HDR_FW_VER_BUILD_G(exprom_vers));
15381448 }
15391449
15401450 static void get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -1589,9 +1499,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, · 48 unmodified lines
15891499 collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data);
15901500 data += sizeof(struct queue_port_stats) / sizeof(u64);
15911501 if (!is_t4(adapter->params.chip)) {
1592− t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7));
1593− val1 = t4_read_reg(adapter, SGE_STAT_TOTAL);
1594− val2 = t4_read_reg(adapter, SGE_STAT_MATCH);
1502+ t4_write_reg(adapter, SGE_STAT_CFG_A, STATSOURCE_T5_V(7));
1503+ val1 = t4_read_reg(adapter, SGE_STAT_TOTAL_A);
1504+ val2 = t4_read_reg(adapter, SGE_STAT_MATCH_A);
15951505 *data = val1 - val2;
15961506 data++;
15971507 *data = val2;
@@ -2608,8 +2518,8 @@ static int closest_thres(const struct sge *s, int thres) · 1010 unmodified lines
26082518 /*
26092519 * Return a queue's interrupt hold-off time in us. 0 means no timer.
26102520 */
2611−static unsigned int qtimer_val(const struct adapter *adap,
2612− const struct sge_rspq *q)
2521+unsigned int qtimer_val(const struct adapter *adap,
2522+ const struct sge_rspq *q)
26132523 {
26142524 unsigned int idx = q->intr_params >> 1;
26152525
@@ -3346,40 +3256,6 @@ static int tid_init(struct tid_info *t) · 730 unmodified lines
33463256 return 0;
33473257 }
33483258
3349−int cxgb4_clip_get(const struct net_device *dev,
3350− const struct in6_addr *lip)
3351−{
3352− struct adapter *adap;
3353− struct fw_clip_cmd c;
3354−
3355− adap = netdev2adap(dev);
3356− memset(&c, 0, sizeof(c));
3357− c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) |
3358− FW_CMD_REQUEST_F | FW_CMD_WRITE_F);
3359− c.alloc_to_len16 = htonl(FW_CLIP_CMD_ALLOC_F | FW_LEN16(c));
3360− c.ip_hi = *(__be64 *)(lip->s6_addr);
3361− c.ip_lo = *(__be64 *)(lip->s6_addr + 8);
3362− return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false);
3363−}
3364−EXPORT_SYMBOL(cxgb4_clip_get);
3365−
3366−int cxgb4_clip_release(const struct net_device *dev,
3367− const struct in6_addr *lip)
3368−{
3369− struct adapter *adap;
3370− struct fw_clip_cmd c;
3371−
3372− adap = netdev2adap(dev);
3373− memset(&c, 0, sizeof(c));
3374− c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) |
3375− FW_CMD_REQUEST_F | FW_CMD_READ_F);
3376− c.alloc_to_len16 = htonl(FW_CLIP_CMD_FREE_F | FW_LEN16(c));
3377− c.ip_hi = *(__be64 *)(lip->s6_addr);
3378− c.ip_lo = *(__be64 *)(lip->s6_addr + 8);
3379− return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false);
3380−}
3381−EXPORT_SYMBOL(cxgb4_clip_release);
3382−
33833259 /**
33843260 * cxgb4_create_server - create an IP server
33853261 * @dev: the device
@@ -3415,8 +3291,8 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid, · 29 unmodified lines
34153291 req->peer_ip = htonl(0);
34163292 chan = rxq_to_chan(&adap->sge, queue);
34173293 req->opt0 = cpu_to_be64(TX_CHAN_V(chan));
3418− req->opt1 = cpu_to_be64(CONN_POLICY_ASK |
3419− SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue));
3294+ req->opt1 = cpu_to_be64(CONN_POLICY_V(CPL_CONN_POLICY_ASK) |
3295+ SYN_RSS_ENABLE_F | SYN_RSS_QUEUE_V(queue));
34203296 ret = t4_mgmt_tx(adap, skb);
34213297 return net_xmit_eval(ret);
34223298 }
@@ -3458,8 +3334,8 @@ int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, · 35 unmodified lines
34583334 req->peer_ip_lo = cpu_to_be64(0);
34593335 chan = rxq_to_chan(&adap->sge, queue);
34603336 req->opt0 = cpu_to_be64(TX_CHAN_V(chan));
3461− req->opt1 = cpu_to_be64(CONN_POLICY_ASK |
3462− SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue));
3337+ req->opt1 = cpu_to_be64(CONN_POLICY_V(CPL_CONN_POLICY_ASK) |
3338+ SYN_RSS_ENABLE_F | SYN_RSS_QUEUE_V(queue));
34633339 ret = t4_mgmt_tx(adap, skb);
34643340 return net_xmit_eval(ret);
34653341 }
@@ -3482,8 +3358,8 @@ int cxgb4_remove_server(const struct net_device *dev, unsigned int stid, · 16 unmodified lines
34823358 req = (struct cpl_close_listsvr_req *)__skb_put(skb, sizeof(*req));
34833359 INIT_TP_WR(req, 0);
34843360 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, stid));
3485− req->reply_ctrl = htons(NO_REPLY(0) | (ipv6 ? LISTSVR_IPV6(1) :
3486− LISTSVR_IPV6(0)) | QUEUENO(queue));
3361+ req->reply_ctrl = htons(NO_REPLY_V(0) | (ipv6 ? LISTSVR_IPV6_V(1) :
3362+ LISTSVR_IPV6_V(0)) | QUEUENO_V(queue));
34873363 ret = t4_mgmt_tx(adap, skb);
34883364 return net_xmit_eval(ret);
34893365 }
@@ -3600,14 +3476,14 @@ unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo) · 110 unmodified lines
36003476 struct adapter *adap = netdev2adap(dev);
36013477 u32 v1, v2, lp_count, hp_count;
36023478
3603− v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS);
3604− v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2);
3479+ v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A);
3480+ v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A);
36053481 if (is_t4(adap->params.chip)) {
3606− lp_count = G_LP_COUNT(v1);
3607− hp_count = G_HP_COUNT(v1);
3482+ lp_count = LP_COUNT_G(v1);
3483+ hp_count = HP_COUNT_G(v1);
36083484 } else {
3609− lp_count = G_LP_COUNT_T5(v1);
3610− hp_count = G_HP_COUNT_T5(v2);
3485+ lp_count = LP_COUNT_T5_G(v1);
3486+ hp_count = HP_COUNT_T5_G(v2);
36113487 }
36123488 return lpfifo ? lp_count : hp_count;
36133489 }
@@ -3653,10 +3529,10 @@ void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, · 39 unmodified lines
36533529 {
36543530 struct adapter *adap = netdev2adap(dev);
36553531
3656− t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK, tag_mask);
3657− t4_write_reg(adap, ULP_RX_ISCSI_PSZ, HPZ0(pgsz_order[0]) |
3658− HPZ1(pgsz_order[1]) | HPZ2(pgsz_order[2]) |
3659− HPZ3(pgsz_order[3]));
3532+ t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK_A, tag_mask);
3533+ t4_write_reg(adap, ULP_RX_ISCSI_PSZ_A, HPZ0_V(pgsz_order[0]) |
3534+ HPZ1_V(pgsz_order[1]) | HPZ2_V(pgsz_order[2]) |
3535+ HPZ3_V(pgsz_order[3]));
36603536 }
36613537 EXPORT_SYMBOL(cxgb4_iscsi_init);
36623538
@@ -3666,14 +3542,14 @@ int cxgb4_flush_eq_cache(struct net_device *dev) · 3 unmodified lines
36663542 int ret;
36673543
36683544 ret = t4_fwaddrspace_write(adap, adap->mbox,
3669− 0xe1000000 + A_SGE_CTXT_CMD, 0x20000000);
3545+ 0xe1000000 + SGE_CTXT_CMD_A, 0x20000000);
36703546 return ret;
36713547 }
36723548 EXPORT_SYMBOL(cxgb4_flush_eq_cache);
36733549
36743550 static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx)
36753551 {
3676− u32 addr = t4_read_reg(adap, A_SGE_DBQ_CTXT_BADDR) + 24 * qid + 8;
3552+ u32 addr = t4_read_reg(adap, SGE_DBQ_CTXT_BADDR_A) + 24 * qid + 8;
36773553 __be64 indices;
36783554 int ret;
36793555
@@ -3702,14 +3578,20 @@ int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, · 22 unmodified lines
37023578
37033579 if (pidx != hw_pidx) {
37043580 u16 delta;
3581+ u32 val;
37053582
37063583 if (pidx >= hw_pidx)
37073584 delta = pidx - hw_pidx;
37083585 else
37093586 delta = size - hw_pidx + pidx;
3587+
3588+ if (is_t4(adap->params.chip))
3589+ val = PIDX_V(delta);
3590+ else
3591+ val = PIDX_T5_V(delta);
37103592 wmb();
3711− t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
3712− QID(qid) | PIDX(delta));
3593+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A),
3594+ QID_V(qid) | val);
37133595 }
37143596 out:
37153597 return ret;
@@ -3721,8 +3603,8 @@ void cxgb4_disable_db_coalescing(struct net_device *dev) · 5 unmodified lines
37213603 struct adapter *adap;
37223604
37233605 adap = netdev2adap(dev);
3724− t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE,
3725− F_NOCOALESCE);
3606+ t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, NOCOALESCE_F,
3607+ NOCOALESCE_F);
37263608 }
37273609 EXPORT_SYMBOL(cxgb4_disable_db_coalescing);
37283610
@@ -3731,7 +3613,7 @@ void cxgb4_enable_db_coalescing(struct net_device *dev) · 2 unmodified lines
37313613 struct adapter *adap;
37323614
37333615 adap = netdev2adap(dev);
3734− t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE, 0);
3616+ t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, NOCOALESCE_F, 0);
37353617 }
37363618 EXPORT_SYMBOL(cxgb4_enable_db_coalescing);
37373619
@@ -3809,8 +3691,8 @@ u64 cxgb4_read_sge_timestamp(struct net_device *dev) · 71 unmodified lines
38093691 struct adapter *adap;
38103692
38113693 adap = netdev2adap(dev);
3812− lo = t4_read_reg(adap, SGE_TIMESTAMP_LO);
3813− hi = GET_TSVAL(t4_read_reg(adap, SGE_TIMESTAMP_HI));
3694+ lo = t4_read_reg(adap, SGE_TIMESTAMP_LO_A);
3695+ hi = TSVAL_G(t4_read_reg(adap, SGE_TIMESTAMP_HI_A));
38143696
38153697 return ((u64)hi << 32) | (u64)lo;
38163698 }
@@ -3870,14 +3752,14 @@ static void drain_db_fifo(struct adapter *adap, int usecs) · 53 unmodified lines
38703752 u32 v1, v2, lp_count, hp_count;
38713753
38723754 do {
3873− v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS);
3874− v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2);
3755+ v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A);
3756+ v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A);
38753757 if (is_t4(adap->params.chip)) {
3876− lp_count = G_LP_COUNT(v1);
3877− hp_count = G_HP_COUNT(v1);
3758+ lp_count = LP_COUNT_G(v1);
3759+ hp_count = HP_COUNT_G(v1);
38783760 } else {
3879− lp_count = G_LP_COUNT_T5(v1);
3880− hp_count = G_HP_COUNT_T5(v2);
3761+ lp_count = LP_COUNT_T5_G(v1);
3762+ hp_count = HP_COUNT_T5_G(v2);
38813763 }
38823764
38833765 if (lp_count == 0 && hp_count == 0)
@@ -3904,8 +3786,8 @@ static void enable_txq_db(struct adapter *adap, struct sge_txq *q) · 20 unmodified lines
39043786 * are committed before we tell HW about them.
39053787 */
39063788 wmb();
3907− t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
3908− QID(q->cntxt_id) | PIDX(q->db_pidx_inc));
3789+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A),
3790+ QID_V(q->cntxt_id) | PIDX_V(q->db_pidx_inc));
39093791 q->db_pidx_inc = 0;
39103792 }
39113793 q->db_disabled = 0;
@@ -3952,9 +3834,9 @@ static void process_db_full(struct work_struct *work) · 40 unmodified lines
39523834 drain_db_fifo(adap, dbfifo_drain_delay);
39533835 enable_dbs(adap);
39543836 notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY);
3955− t4_set_reg_field(adap, SGE_INT_ENABLE3,
3956− DBFIFO_HP_INT | DBFIFO_LP_INT,
3957− DBFIFO_HP_INT | DBFIFO_LP_INT);
3837+ t4_set_reg_field(adap, SGE_INT_ENABLE3_A,
3838+ DBFIFO_HP_INT_F | DBFIFO_LP_INT_F,
3839+ DBFIFO_HP_INT_F | DBFIFO_LP_INT_F);
39583840 }
39593841
39603842 static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q)
@@ -3968,14 +3850,20 @@ static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) · 7 unmodified lines
39683850 goto out;
39693851 if (q->db_pidx != hw_pidx) {
39703852 u16 delta;
3853+ u32 val;
39713854
39723855 if (q->db_pidx >= hw_pidx)
39733856 delta = q->db_pidx - hw_pidx;
39743857 else
39753858 delta = q->size - hw_pidx + q->db_pidx;
3859+
3860+ if (is_t4(adap->params.chip))
3861+ val = PIDX_V(delta);
3862+ else
3863+ val = PIDX_T5_V(delta);
39763864 wmb();
3977− t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
3978− QID(q->cntxt_id) | PIDX(delta));
3865+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A),
3866+ QID_V(q->cntxt_id) | val);
39793867 }
39803868 out:
39813869 q->db_disabled = 0;
@@ -4024,14 +3912,14 @@ static void process_db_drop(struct work_struct *work) · 42 unmodified lines
40243912 dev_err(adap->pdev_dev, "doorbell drop recovery: "
40253913 "qid=%d, pidx_inc=%d\n", qid, pidx_inc);
40263914 else
4027− writel(PIDX_T5(pidx_inc) | QID(bar2_qid),
3915+ writel(PIDX_T5_V(pidx_inc) | QID_V(bar2_qid),
40283916 adap->bar2 + bar2_qoffset + SGE_UDB_KDOORBELL);
40293917
40303918 /* Re-enable BAR2 WC */
40313919 t4_set_reg_field(adap, 0x10b0, 1<<15, 1<<15);
40323920 }
40333921
4034− t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_DROPPED_DB, 0);
3922+ t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, DROPPED_DB_F, 0);
40353923 }
40363924
40373925 void t4_db_full(struct adapter *adap)
@@ -4039,8 +3927,8 @@ void t4_db_full(struct adapter *adap) · 1 unmodified line
40393927 if (is_t4(adap->params.chip)) {
40403928 disable_dbs(adap);
40413929 notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL);
4042− t4_set_reg_field(adap, SGE_INT_ENABLE3,
4043− DBFIFO_HP_INT | DBFIFO_LP_INT, 0);
3930+ t4_set_reg_field(adap, SGE_INT_ENABLE3_A,
3931+ DBFIFO_HP_INT_F | DBFIFO_LP_INT_F, 0);
40443932 queue_work(adap->workq, &adap->db_full_task);
40453933 }
40463934 }
@@ -4081,7 +3969,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 34 unmodified lines
40813969 lli.nports = adap->params.nports;
40823970 lli.wr_cred = adap->params.ofldq_wr_cred;
40833971 lli.adapter_type = adap->params.chip;
4084− lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2));
3972+ lli.iscsi_iolen = MAXRXDATA_G(t4_read_reg(adap, TP_PARA_REG2_A));
40853973 lli.cclk_ps = 1000000000 / adap->params.vpd.cclk;
40863974 lli.udb_density = 1 << adap->params.sge.eq_qpp;
40873975 lli.ucq_density = 1 << adap->params.sge.iq_qpp;
@@ -4089,8 +3977,8 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 1 unmodified line
40893977 /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */
40903978 for (i = 0; i < NCHAN; i++)
40913979 lli.tx_modq[i] = i;
4092− lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS);
4093− lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL);
3980+ lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS_A);
3981+ lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL_A);
40943982 lli.fw_vers = adap->params.fw_vers;
40953983 lli.dbfifo_int_thresh = dbfifo_int_thresh;
40963984 lli.sge_ingpadboundary = adap->sge.fl_align;
@@ -4220,148 +4108,61 @@ int cxgb4_unregister_uld(enum cxgb4_uld type) · 123 unmodified lines
42204108 }
42214109 EXPORT_SYMBOL(cxgb4_unregister_uld);
42224110
4223−/* Check if netdev on which event is occured belongs to us or not. Return
4224− * success (true) if it belongs otherwise failure (false).
4225− * Called with rcu_read_lock() held.
4226− */
42274111 #if IS_ENABLED(CONFIG_IPV6)
4228−static bool cxgb4_netdev(const struct net_device *netdev)
4112+static int cxgb4_inet6addr_handler(struct notifier_block *this,
4113+ unsigned long event, void *data)
42294114 {
4115+ struct inet6_ifaddr *ifa = data;
4116+ struct net_device *event_dev = ifa->idev->dev;
4117+ const struct device *parent = NULL;
4118+#if IS_ENABLED(CONFIG_BONDING)
42304119 struct adapter *adap;
4231− int i;
4232−
4233− list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node)
4234− for (i = 0; i < MAX_NPORTS; i++)
4235− if (adap->port[i] == netdev)
4236− return true;
4237− return false;
4238−}
4120+#endif
4121+ if (event_dev->priv_flags & IFF_802_1Q_VLAN)
4122+ event_dev = vlan_dev_real_dev(event_dev);
4123+#if IS_ENABLED(CONFIG_BONDING)
4124+ if (event_dev->flags & IFF_MASTER) {
4125+ list_for_each_entry(adap, &adapter_list, list_node) {
4126+ switch (event) {
4127+ case NETDEV_UP:
4128+ cxgb4_clip_get(adap->port[0],
4129+ (const u32 *)ifa, 1);
4130+ break;
4131+ case NETDEV_DOWN:
4132+ cxgb4_clip_release(adap->port[0],
4133+ (const u32 *)ifa, 1);
4134+ break;
4135+ default:
4136+ break;
4137+ }
4138+ }
4139+ return NOTIFY_OK;
4140+ }
4141+#endif
42394142
4240−static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa,
4241− unsigned long event)
4242−{
4243− int ret = NOTIFY_DONE;
4143+ if (event_dev)
4144+ parent = event_dev->dev.parent;
42444145
4245− rcu_read_lock();
4246− if (cxgb4_netdev(event_dev)) {
4146+ if (parent && parent->driver == &cxgb4_driver.driver) {
42474147 switch (event) {
42484148 case NETDEV_UP:
4249− ret = cxgb4_clip_get(event_dev, &ifa->addr);
4250− if (ret < 0) {
4251− rcu_read_unlock();
4252− return ret;
4253− }
4254− ret = NOTIFY_OK;
4149+ cxgb4_clip_get(event_dev, (const u32 *)ifa, 1);
42554150 break;
42564151 case NETDEV_DOWN:
4257− cxgb4_clip_release(event_dev, &ifa->addr);
4258− ret = NOTIFY_OK;
4152+ cxgb4_clip_release(event_dev, (const u32 *)ifa, 1);
42594153 break;
42604154 default:
42614155 break;
42624156 }
42634157 }
4264− rcu_read_unlock();
4265− return ret;
4266−}
4267−
4268−static int cxgb4_inet6addr_handler(struct notifier_block *this,
4269− unsigned long event, void *data)
4270−{
4271− struct inet6_ifaddr *ifa = data;
4272− struct net_device *event_dev;
4273− int ret = NOTIFY_DONE;
4274− struct bonding *bond = netdev_priv(ifa->idev->dev);
4275− struct list_head *iter;
4276− struct slave *slave;
4277− struct pci_dev *first_pdev = NULL;
4278−
4279− if (ifa->idev->dev->priv_flags & IFF_802_1Q_VLAN) {
4280− event_dev = vlan_dev_real_dev(ifa->idev->dev);
4281− ret = clip_add(event_dev, ifa, event);
4282− } else if (ifa->idev->dev->flags & IFF_MASTER) {
4283− /* It is possible that two different adapters are bonded in one
4284− * bond. We need to find such different adapters and add clip
4285− * in all of them only once.
4286− */
4287− bond_for_each_slave(bond, slave, iter) {
4288− if (!first_pdev) {
4289− ret = clip_add(slave->dev, ifa, event);
4290− /* If clip_add is success then only initialize
4291− * first_pdev since it means it is our device
4292− */
4293− if (ret == NOTIFY_OK)
4294− first_pdev = to_pci_dev(
4295− slave->dev->dev.parent);
4296− } else if (first_pdev !=
4297− to_pci_dev(slave->dev->dev.parent))
4298− ret = clip_add(slave->dev, ifa, event);
4299− }
4300− } else
4301− ret = clip_add(ifa->idev->dev, ifa, event);
4302−
4303− return ret;
4158+ return NOTIFY_OK;
43044159 }
43054160
4161+static bool inet6addr_registered;
43064162 static struct notifier_block cxgb4_inet6addr_notifier = {
43074163 .notifier_call = cxgb4_inet6addr_handler
43084164 };
43094165
4310−/* Retrieves IPv6 addresses from a root device (bond, vlan) associated with
4311− * a physical device.
4312− * The physical device reference is needed to send the actul CLIP command.
4313− */
4314−static int update_dev_clip(struct net_device *root_dev, struct net_device *dev)
4315−{
4316− struct inet6_dev *idev = NULL;
4317− struct inet6_ifaddr *ifa;
4318− int ret = 0;
4319−
4320− idev = __in6_dev_get(root_dev);
4321− if (!idev)
4322− return ret;
4323−
4324− read_lock_bh(&idev->lock);
4325− list_for_each_entry(ifa, &idev->addr_list, if_list) {
4326− ret = cxgb4_clip_get(dev, &ifa->addr);
4327− if (ret < 0)
4328− break;
4329− }
4330− read_unlock_bh(&idev->lock);
4331−
4332− return ret;
4333−}
4334−
4335−static int update_root_dev_clip(struct net_device *dev)
4336−{
4337− struct net_device *root_dev = NULL;
4338− int i, ret = 0;
4339−
4340− /* First populate the real net device's IPv6 addresses */
4341− ret = update_dev_clip(dev, dev);
4342− if (ret)
4343− return ret;
4344−
4345− /* Parse all bond and vlan devices layered on top of the physical dev */
4346− root_dev = netdev_master_upper_dev_get_rcu(dev);
4347− if (root_dev) {
4348− ret = update_dev_clip(root_dev, dev);
4349− if (ret)
4350− return ret;
4351− }
4352−
4353− for (i = 0; i < VLAN_N_VID; i++) {
4354− root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i);
4355− if (!root_dev)
4356− continue;
4357−
4358− ret = update_dev_clip(root_dev, dev);
4359− if (ret)
4360− break;
4361− }
4362− return ret;
4363−}
4364−
43654166 static void update_clip(const struct adapter *adap)
43664167 {
43674168 int i;
@@ -4375,7 +4176,7 @@ static void update_clip(const struct adapter *adap) · 7 unmodified lines
43754176 ret = 0;
43764177
43774178 if (dev)
4378− ret = update_root_dev_clip(dev);
4179+ ret = cxgb4_update_root_dev_clip(dev);
43794180
43804181 if (ret < 0)
43814182 break;
@@ -4567,13 +4368,13 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, · 185 unmodified lines
45674368 f->fs.val.lip[i] = val[i];
45684369 f->fs.mask.lip[i] = ~0;
45694370 }
4570− if (adap->params.tp.vlan_pri_map & F_PORT) {
4371+ if (adap->params.tp.vlan_pri_map & PORT_F) {
45714372 f->fs.val.iport = port;
45724373 f->fs.mask.iport = mask;
45734374 }
45744375 }
45754376
4576− if (adap->params.tp.vlan_pri_map & F_PROTOCOL) {
4377+ if (adap->params.tp.vlan_pri_map & PROTOCOL_F) {
45774378 f->fs.val.proto = IPPROTO_TCP;
45784379 f->fs.mask.proto = ~0;
45794380 }
@@ -4779,11 +4580,15 @@ static const struct net_device_ops cxgb4_netdev_ops = { · 199 unmodified lines
47794580 #ifdef CONFIG_NET_POLL_CONTROLLER
47804581 .ndo_poll_controller = cxgb_netpoll,
47814582 #endif
4583+#ifdef CONFIG_NET_RX_BUSY_POLL
4584+ .ndo_busy_poll = cxgb_busy_poll,
4585+#endif
4586+
47824587 };
47834588
47844589 void t4_fatal_err(struct adapter *adap)
47854590 {
4786− t4_set_reg_field(adap, SGE_CONTROL, GLOBALENABLE, 0);
4591+ t4_set_reg_field(adap, SGE_CONTROL_A, GLOBALENABLE_F, 0);
47874592 t4_intr_disable(adap);
47884593 dev_alert(adap->pdev_dev, "encountered fatal error, adapter stopped\n");
47894594 }
@@ -4858,16 +4663,16 @@ static void setup_memwin(struct adapter *adap) · 68 unmodified lines
48584663 mem_win2_base = MEMWIN2_BASE_T5;
48594664 mem_win2_aperture = MEMWIN2_APERTURE_T5;
48604665 }
4861− t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 0),
4862− mem_win0_base | BIR(0) |
4863− WINDOW(ilog2(MEMWIN0_APERTURE) - 10));
4864− t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 1),
4865− mem_win1_base | BIR(0) |
4866− WINDOW(ilog2(MEMWIN1_APERTURE) - 10));
4867− t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2),
4868− mem_win2_base | BIR(0) |
4869− WINDOW(ilog2(mem_win2_aperture) - 10));
4870− t4_read_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2));
4666+ t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 0),
4667+ mem_win0_base | BIR_V(0) |
4668+ WINDOW_V(ilog2(MEMWIN0_APERTURE) - 10));
4669+ t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 1),
4670+ mem_win1_base | BIR_V(0) |
4671+ WINDOW_V(ilog2(MEMWIN1_APERTURE) - 10));
4672+ t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 2),
4673+ mem_win2_base | BIR_V(0) |
4674+ WINDOW_V(ilog2(mem_win2_aperture) - 10));
4675+ t4_read_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 2));
48714676 }
48724677
48734678 static void setup_memwin_rdma(struct adapter *adap)
@@ -4881,13 +4686,13 @@ static void setup_memwin_rdma(struct adapter *adap) · 7 unmodified lines
48814686 start += OCQ_WIN_OFFSET(adap->pdev, &adap->vres);
48824687 sz_kb = roundup_pow_of_two(adap->vres.ocq.size) >> 10;
48834688 t4_write_reg(adap,
4884− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 3),
4885− start | BIR(1) | WINDOW(ilog2(sz_kb)));
4689+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 3),
4690+ start | BIR_V(1) | WINDOW_V(ilog2(sz_kb)));
48864691 t4_write_reg(adap,
4887− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, 3),
4692+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, 3),
48884693 adap->vres.ocq.start);
48894694 t4_read_reg(adap,
4890− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, 3));
4695+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, 3));
48914696 }
48924697 }
48934698
@@ -4936,38 +4741,38 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) · 42 unmodified lines
49364741 t4_sge_init(adap);
49374742
49384743 /* tweak some settings */
4939− t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849);
4940− t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12));
4941− t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG);
4942− v = t4_read_reg(adap, TP_PIO_DATA);
4943− t4_write_reg(adap, TP_PIO_DATA, v & ~CSUM_HAS_PSEUDO_HDR);
4744+ t4_write_reg(adap, TP_SHIFT_CNT_A, 0x64f8849);
4745+ t4_write_reg(adap, ULP_RX_TDDP_PSZ_A, HPZ0_V(PAGE_SHIFT - 12));
4746+ t4_write_reg(adap, TP_PIO_ADDR_A, TP_INGRESS_CONFIG_A);
4747+ v = t4_read_reg(adap, TP_PIO_DATA_A);
4748+ t4_write_reg(adap, TP_PIO_DATA_A, v & ~CSUM_HAS_PSEUDO_HDR_F);
49444749
49454750 /* first 4 Tx modulation queues point to consecutive Tx channels */
49464751 adap->params.tp.tx_modq_map = 0xE4;
4947− t4_write_reg(adap, A_TP_TX_MOD_QUEUE_REQ_MAP,
4948− V_TX_MOD_QUEUE_REQ_MAP(adap->params.tp.tx_modq_map));
4752+ t4_write_reg(adap, TP_TX_MOD_QUEUE_REQ_MAP_A,
4753+ TX_MOD_QUEUE_REQ_MAP_V(adap->params.tp.tx_modq_map));
49494754
49504755 /* associate each Tx modulation queue with consecutive Tx channels */
49514756 v = 0x84218421;
4952− t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA,
4953− &v, 1, A_TP_TX_SCHED_HDR);
4954− t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA,
4955− &v, 1, A_TP_TX_SCHED_FIFO);
4956− t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA,
4957− &v, 1, A_TP_TX_SCHED_PCMD);
4757+ t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A,
4758+ &v, 1, TP_TX_SCHED_HDR_A);
4759+ t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A,
4760+ &v, 1, TP_TX_SCHED_FIFO_A);
4761+ t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A,
4762+ &v, 1, TP_TX_SCHED_PCMD_A);
49584763
49594764 #define T4_TX_MODQ_10G_WEIGHT_DEFAULT 16 /* in KB units */
49604765 if (is_offload(adap)) {
4961− t4_write_reg(adap, A_TP_TX_MOD_QUEUE_WEIGHT0,
4962− V_TX_MODQ_WEIGHT0(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4963− V_TX_MODQ_WEIGHT1(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4964− V_TX_MODQ_WEIGHT2(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4965− V_TX_MODQ_WEIGHT3(T4_TX_MODQ_10G_WEIGHT_DEFAULT));
4966− t4_write_reg(adap, A_TP_TX_MOD_CHANNEL_WEIGHT,
4967− V_TX_MODQ_WEIGHT0(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4968− V_TX_MODQ_WEIGHT1(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4969− V_TX_MODQ_WEIGHT2(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4970− V_TX_MODQ_WEIGHT3(T4_TX_MODQ_10G_WEIGHT_DEFAULT));
4766+ t4_write_reg(adap, TP_TX_MOD_QUEUE_WEIGHT0_A,
4767+ TX_MODQ_WEIGHT0_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4768+ TX_MODQ_WEIGHT1_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4769+ TX_MODQ_WEIGHT2_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4770+ TX_MODQ_WEIGHT3_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT));
4771+ t4_write_reg(adap, TP_TX_MOD_CHANNEL_WEIGHT_A,
4772+ TX_MODQ_WEIGHT0_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4773+ TX_MODQ_WEIGHT1_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4774+ TX_MODQ_WEIGHT2_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) |
4775+ TX_MODQ_WEIGHT3_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT));
49714776 }
49724777
49734778 /* get basic stuff going */
@@ -5013,16 +4818,16 @@ static int adap_init0_tweaks(struct adapter *adapter) · 39 unmodified lines
50134818 rx_dma_offset);
50144819 rx_dma_offset = 2;
50154820 }
5016− t4_set_reg_field(adapter, SGE_CONTROL,
5017− PKTSHIFT_MASK,
5018− PKTSHIFT(rx_dma_offset));
4821+ t4_set_reg_field(adapter, SGE_CONTROL_A,
4822+ PKTSHIFT_V(PKTSHIFT_M),
4823+ PKTSHIFT_V(rx_dma_offset));
50194824
50204825 /*
50214826 * Don't include the "IP Pseudo Header" in CPL_RX_PKT checksums: Linux
50224827 * adds the pseudo header itself.
50234828 */
5024− t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG,
5025− CSUM_HAS_PSEUDO_HDR, 0);
4829+ t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG_A,
4830+ CSUM_HAS_PSEUDO_HDR_F, 0);
50264831
50274832 return 0;
50284833 }
@@ -5046,7 +4851,7 @@ static int adap_init0_config(struct adapter *adapter, int reset) · 17 unmodified lines
50464851 */
50474852 if (reset) {
50484853 ret = t4_fw_reset(adapter, adapter->mbox,
5049− PIORSTMODE | PIORST);
4854+ PIORSTMODE_F | PIORST_F);
50504855 if (ret < 0)
50514856 goto bye;
50524857 }
@@ -5212,12 +5017,9 @@ static int adap_init0_config(struct adapter *adapter, int reset) · 159 unmodified lines
52125017 if (ret < 0)
52135018 goto bye;
52145019
5215− /*
5216− * Return successfully and note that we're operating with parameters
5217− * not supplied by the driver, rather than from hard-wired
5218− * initialization constants burried in the driver.
5020+ /* Emit Firmware Configuration File information and return
5021+ * successfully.
52195022 */
5220− adapter->flags |= USING_SOFT_PARAMS;
52215023 dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\
52225024 "Configuration File \"%s\", version %#x, computed checksum %#x\n",
52235025 config_name, finiver, cfcsum);
@@ -5235,249 +5037,6 @@ bye: · 11 unmodified lines
52355037 return ret;
52365038 }
52375039
5238−/*
5239− * Attempt to initialize the adapter via hard-coded, driver supplied
5240− * parameters ...
5241− */
5242−static int adap_init0_no_config(struct adapter *adapter, int reset)
5243−{
5244− struct sge *s = &adapter->sge;
5245− struct fw_caps_config_cmd caps_cmd;
5246− u32 v;
5247− int i, ret;
5248−
5249− /*
5250− * Reset device if necessary
5251− */
5252− if (reset) {
5253− ret = t4_fw_reset(adapter, adapter->mbox,
5254− PIORSTMODE | PIORST);
5255− if (ret < 0)
5256− goto bye;
5257− }
5258−
5259− /*
5260− * Get device capabilities and select which we'll be using.
5261− */
5262− memset(&caps_cmd, 0, sizeof(caps_cmd));
5263− caps_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_CAPS_CONFIG_CMD) |
5264− FW_CMD_REQUEST_F | FW_CMD_READ_F);
5265− caps_cmd.cfvalid_to_len16 = htonl(FW_LEN16(caps_cmd));
5266− ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
5267− &caps_cmd);
5268− if (ret < 0)
5269− goto bye;
5270−
5271− if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) {
5272− if (!vf_acls)
5273− caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM);
5274− else
5275− caps_cmd.niccaps = htons(FW_CAPS_CONFIG_NIC_VM);
5276− } else if (vf_acls) {
5277− dev_err(adapter->pdev_dev, "virtualization ACLs not supported");
5278− goto bye;
5279− }
5280− caps_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_CAPS_CONFIG_CMD) |
5281− FW_CMD_REQUEST_F | FW_CMD_WRITE_F);
5282− ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
5283− NULL);
5284− if (ret < 0)
5285− goto bye;
5286−
5287− /*
5288− * Tweak configuration based on system architecture, module
5289− * parameters, etc.
5290− */
5291− ret = adap_init0_tweaks(adapter);
5292− if (ret < 0)
5293− goto bye;
5294−
5295− /*
5296− * Select RSS Global Mode we want to use. We use "Basic Virtual"
5297− * mode which maps each Virtual Interface to its own section of
5298− * the RSS Table and we turn on all map and hash enables ...
5299− */
5300− adapter->flags |= RSS_TNLALLLOOKUP;
5301− ret = t4_config_glbl_rss(adapter, adapter->mbox,
5302− FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL,
5303− FW_RSS_GLB_CONFIG_CMD_TNLMAPEN_F |
5304− FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ_F |
5305− ((adapter->flags & RSS_TNLALLLOOKUP) ?
5306− FW_RSS_GLB_CONFIG_CMD_TNLALLLKP_F : 0));
5307− if (ret < 0)
5308− goto bye;
5309−
5310− /*
5311− * Set up our own fundamental resource provisioning ...
5312− */
5313− ret = t4_cfg_pfvf(adapter, adapter->mbox, adapter->fn, 0,
5314− PFRES_NEQ, PFRES_NETHCTRL,
5315− PFRES_NIQFLINT, PFRES_NIQ,
5316− PFRES_TC, PFRES_NVI,
5317− FW_PFVF_CMD_CMASK_M,
5318− pfvfres_pmask(adapter, adapter->fn, 0),
5319− PFRES_NEXACTF,
5320− PFRES_R_CAPS, PFRES_WX_CAPS);
5321− if (ret < 0)
5322− goto bye;
5323−
5324− /*
5325− * Perform low level SGE initialization. We need to do this before we
5326− * send the firmware the INITIALIZE command because that will cause
5327− * any other PF Drivers which are waiting for the Master
5328− * Initialization to proceed forward.
5329− */
5330− for (i = 0; i < SGE_NTIMERS - 1; i++)
5331− s->timer_val[i] = min(intr_holdoff[i], MAX_SGE_TIMERVAL);
5332− s->timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL;
5333− s->counter_val[0] = 1;
5334− for (i = 1; i < SGE_NCOUNTERS; i++)
5335− s->counter_val[i] = min(intr_cnt[i - 1],
5336− THRESHOLD_0_GET(THRESHOLD_0_MASK));
5337− t4_sge_init(adapter);
5338−
5339−#ifdef CONFIG_PCI_IOV
5340− /*
5341− * Provision resource limits for Virtual Functions. We currently
5342− * grant them all the same static resource limits except for the Port
5343− * Access Rights Mask which we're assigning based on the PF. All of
5344− * the static provisioning stuff for both the PF and VF really needs
5345− * to be managed in a persistent manner for each device which the
5346− * firmware controls.
5347− */
5348− {
5349− int pf, vf;
5350−
5351− for (pf = 0; pf < ARRAY_SIZE(num_vf); pf++) {
5352− if (num_vf[pf] <= 0)
5353− continue;
5354−
5355− /* VF numbering starts at 1! */
5356− for (vf = 1; vf <= num_vf[pf]; vf++) {
5357− ret = t4_cfg_pfvf(adapter, adapter->mbox,
5358− pf, vf,
5359− VFRES_NEQ, VFRES_NETHCTRL,
5360− VFRES_NIQFLINT, VFRES_NIQ,
5361− VFRES_TC, VFRES_NVI,
5362− FW_PFVF_CMD_CMASK_M,
5363− pfvfres_pmask(
5364− adapter, pf, vf),
5365− VFRES_NEXACTF,
5366− VFRES_R_CAPS, VFRES_WX_CAPS);
5367− if (ret < 0)
5368− dev_warn(adapter->pdev_dev,
5369− "failed to "\
5370− "provision pf/vf=%d/%d; "
5371− "err=%d\n", pf, vf, ret);
5372− }
5373− }
5374− }
5375−#endif
5376−
5377− /*
5378− * Set up the default filter mode. Later we'll want to implement this
5379− * via a firmware command, etc. ... This needs to be done before the
5380− * firmare initialization command ... If the selected set of fields
5381− * isn't equal to the default value, we'll need to make sure that the
5382− * field selections will fit in the 36-bit budget.
5383− */
5384− if (tp_vlan_pri_map != TP_VLAN_PRI_MAP_DEFAULT) {
5385− int j, bits = 0;
5386−
5387− for (j = TP_VLAN_PRI_MAP_FIRST; j <= TP_VLAN_PRI_MAP_LAST; j++)
5388− switch (tp_vlan_pri_map & (1 << j)) {
5389− case 0:
5390− /* compressed filter field not enabled */
5391− break;
5392− case FCOE_MASK:
5393− bits += 1;
5394− break;
5395− case PORT_MASK:
5396− bits += 3;
5397− break;
5398− case VNIC_ID_MASK:
5399− bits += 17;
5400− break;
5401− case VLAN_MASK:
5402− bits += 17;
5403− break;
5404− case TOS_MASK:
5405− bits += 8;
5406− break;
5407− case PROTOCOL_MASK:
5408− bits += 8;
5409− break;
5410− case ETHERTYPE_MASK:
5411− bits += 16;
5412− break;
5413− case MACMATCH_MASK:
5414− bits += 9;
5415− break;
5416− case MPSHITTYPE_MASK:
5417− bits += 3;
5418− break;
5419− case FRAGMENTATION_MASK:
5420− bits += 1;
5421− break;
5422− }
5423−
5424− if (bits > 36) {
5425− dev_err(adapter->pdev_dev,
5426− "tp_vlan_pri_map=%#x needs %d bits > 36;"\
5427− " using %#x\n", tp_vlan_pri_map, bits,
5428− TP_VLAN_PRI_MAP_DEFAULT);
5429− tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
5430− }
5431− }
5432− v = tp_vlan_pri_map;
5433− t4_write_indirect(adapter, TP_PIO_ADDR, TP_PIO_DATA,
5434− &v, 1, TP_VLAN_PRI_MAP);
5435−
5436− /*
5437− * We need Five Tuple Lookup mode to be set in TP_GLOBAL_CONFIG order
5438− * to support any of the compressed filter fields above. Newer
5439− * versions of the firmware do this automatically but it doesn't hurt
5440− * to set it here. Meanwhile, we do _not_ need to set Lookup Every
5441− * Packet in TP_INGRESS_CONFIG to support matching non-TCP packets
5442− * since the firmware automatically turns this on and off when we have
5443− * a non-zero number of filters active (since it does have a
5444− * performance impact).
5445− */
5446− if (tp_vlan_pri_map)
5447− t4_set_reg_field(adapter, TP_GLOBAL_CONFIG,
5448− FIVETUPLELOOKUP_MASK,
5449− FIVETUPLELOOKUP_MASK);
5450−
5451− /*
5452− * Tweak some settings.
5453− */
5454− t4_write_reg(adapter, TP_SHIFT_CNT, SYNSHIFTMAX(6) |
5455− RXTSHIFTMAXR1(4) | RXTSHIFTMAXR2(15) |
5456− PERSHIFTBACKOFFMAX(8) | PERSHIFTMAX(8) |
5457− KEEPALIVEMAXR1(4) | KEEPALIVEMAXR2(9));
5458−
5459− /*
5460− * Get basic stuff going by issuing the Firmware Initialize command.
5461− * Note that this _must_ be after all PFVF commands ...
5462− */
5463− ret = t4_fw_initialize(adapter, adapter->mbox);
5464− if (ret < 0)
5465− goto bye;
5466−
5467− /*
5468− * Return successfully!
5469− */
5470− dev_info(adapter->pdev_dev, "Successfully configured using built-in "\
5471− "driver parameters\n");
5472− return 0;
5473−
5474− /*
5475− * Something bad happened. Return the error ...
5476− */
5477−bye:
5478− return ret;
5479−}
5480−
54815040 static struct fw_info fw_info_array[] = {
54825041 {
54835042 .chip = CHELSIO_T4,
@@ -5529,6 +5088,8 @@ static int adap_init0(struct adapter *adap) · 45 unmodified lines
55295088 enum dev_state state;
55305089 u32 params[7], val[7];
55315090 struct fw_caps_config_cmd caps_cmd;
5091+ struct fw_devlog_cmd devlog_cmd;
5092+ u32 devlog_meminfo;
55325093 int reset = 1;
55335094
55345095 /* Contact FW, advertising Master capability */
@@ -5590,8 +5151,7 @@ static int adap_init0(struct adapter *adap) · 55 unmodified lines
55905151 state, &reset);
55915152
55925153 /* Cleaning up */
5593− if (fw != NULL)
5594− release_firmware(fw);
5154+ release_firmware(fw);
55955155 t4_free_mem(card_fw);
55965156
55975157 if (ret < 0)
@@ -5609,6 +5169,30 @@ static int adap_init0(struct adapter *adap) · 11 unmodified lines
56095169 if (ret < 0)
56105170 goto bye;
56115171
5172+ /* Read firmware device log parameters. We really need to find a way
5173+ * to get these parameters initialized with some default values (which
5174+ * are likely to be correct) for the case where we either don't
5175+ * attache to the firmware or it's crashed when we probe the adapter.
5176+ * That way we'll still be able to perform early firmware startup
5177+ * debugging ... If the request to get the Firmware's Device Log
5178+ * parameters fails, we'll live so we don't make that a fatal error.
5179+ */
5180+ memset(&devlog_cmd, 0, sizeof(devlog_cmd));
5181+ devlog_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_DEVLOG_CMD) |
5182+ FW_CMD_REQUEST_F | FW_CMD_READ_F);
5183+ devlog_cmd.retval_len16 = htonl(FW_LEN16(devlog_cmd));
5184+ ret = t4_wr_mbox(adap, adap->mbox, &devlog_cmd, sizeof(devlog_cmd),
5185+ &devlog_cmd);
5186+ if (ret == 0) {
5187+ devlog_meminfo =
5188+ ntohl(devlog_cmd.memtype_devlog_memaddr16_devlog);
5189+ adap->params.devlog.memtype =
5190+ FW_DEVLOG_CMD_MEMTYPE_DEVLOG_G(devlog_meminfo);
5191+ adap->params.devlog.start =
5192+ FW_DEVLOG_CMD_MEMADDR16_DEVLOG_G(devlog_meminfo) << 4;
5193+ adap->params.devlog.size = ntohl(devlog_cmd.memsize_devlog);
5194+ }
5195+
56125196 /*
56135197 * Find out what ports are available to us. Note that we need to do
56145198 * this before calling adap_init0_no_config() since it needs nports
@@ -5624,88 +5208,58 @@ static int adap_init0(struct adapter *adap) · 9 unmodified lines
56245208 adap->params.nports = hweight32(port_vec);
56255209 adap->params.portvec = port_vec;
56265210
5627− /*
5628− * If the firmware is initialized already (and we're not forcing a
5629− * master initialization), note that we're living with existing
5630− * adapter parameters. Otherwise, it's time to try initializing the
5631− * adapter ...
5211+ /* If the firmware is initialized already, emit a simply note to that
5212+ * effect. Otherwise, it's time to try initializing the adapter.
56325213 */
56335214 if (state == DEV_STATE_INIT) {
56345215 dev_info(adap->pdev_dev, "Coming up as %s: "\
56355216 "Adapter already initialized\n",
56365217 adap->flags & MASTER_PF ? "MASTER" : "SLAVE");
5637− adap->flags |= USING_SOFT_PARAMS;
56385218 } else {
56395219 dev_info(adap->pdev_dev, "Coming up as MASTER: "\
56405220 "Initializing adapter\n");
5641− /*
5642− * If the firmware doesn't support Configuration
5643− * Files warn user and exit,
5221+
5222+ /* Find out whether we're dealing with a version of the
5223+ * firmware which has configuration file support.
56445224 */
5645− if (ret < 0)
5646− dev_warn(adap->pdev_dev, "Firmware doesn't support "
5647− "configuration file.\n");
5648− if (force_old_init)
5649− ret = adap_init0_no_config(adap, reset);
5650− else {
5651− /*
5652− * Find out whether we're dealing with a version of
5653− * the firmware which has configuration file support.
5654− */
5655− params[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
5656− FW_PARAMS_PARAM_X_V(
5657− FW_PARAMS_PARAM_DEV_CF));
5658− ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1,
5659− params, val);
5660−
5661− /*
5662− * If the firmware doesn't support Configuration
5663− * Files, use the old Driver-based, hard-wired
5664− * initialization. Otherwise, try using the
5665− * Configuration File support and fall back to the
5666− * Driver-based initialization if there's no
5667− * Configuration File found.
5668− */
5669− if (ret < 0)
5670− ret = adap_init0_no_config(adap, reset);
5671− else {
5672− /*
5673− * The firmware provides us with a memory
5674− * buffer where we can load a Configuration
5675− * File from the host if we want to override
5676− * the Configuration File in flash.
5677− */
5225+ params[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
5226+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_CF));
5227+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1,
5228+ params, val);
56785229
5679− ret = adap_init0_config(adap, reset);
5680− if (ret == -ENOENT) {
5681− dev_info(adap->pdev_dev,
5682− "No Configuration File present "
5683− "on adapter. Using hard-wired "
5684− "configuration parameters.\n");
5685− ret = adap_init0_no_config(adap, reset);
5686− }
5687− }
5230+ /* If the firmware doesn't support Configuration Files,
5231+ * return an error.
5232+ */
5233+ if (ret < 0) {
5234+ dev_err(adap->pdev_dev, "firmware doesn't support "
5235+ "Firmware Configuration Files\n");
5236+ goto bye;
5237+ }
5238+
5239+ /* The firmware provides us with a memory buffer where we can
5240+ * load a Configuration File from the host if we want to
5241+ * override the Configuration File in flash.
5242+ */
5243+ ret = adap_init0_config(adap, reset);
5244+ if (ret == -ENOENT) {
5245+ dev_err(adap->pdev_dev, "no Configuration File "
5246+ "present on adapter.\n");
5247+ goto bye;
56885248 }
56895249 if (ret < 0) {
5690− dev_err(adap->pdev_dev,
5691− "could not initialize adapter, error %d\n",
5692− -ret);
5250+ dev_err(adap->pdev_dev, "could not initialize "
5251+ "adapter, error %d\n", -ret);
56935252 goto bye;
56945253 }
56955254 }
56965255
5697− /*
5698− * If we're living with non-hard-coded parameters (either from a
5699− * Firmware Configuration File or values programmed by a different PF
5700− * Driver), give the SGE code a chance to pull in anything that it
5701− * needs ... Note that this must be called after we retrieve our VPD
5702− * parameters in order to know how to convert core ticks to seconds.
5256+ /* Give the SGE code a chance to pull in anything that it needs ...
5257+ * Note that this must be called after we retrieve our VPD parameters
5258+ * in order to know how to convert core ticks to seconds, etc.
57035259 */
5704− if (adap->flags & USING_SOFT_PARAMS) {
5705− ret = t4_sge_init(adap);
5706− if (ret < 0)
5707− goto bye;
5708− }
5260+ ret = t4_sge_init(adap);
5261+ if (ret < 0)
5262+ goto bye;
57095263
57105264 if (is_bypass_device(adap->pdev->device))
57115265 adap->params.bypass = 1;
@@ -5739,6 +5293,14 @@ static int adap_init0(struct adapter *adap) · 27 unmodified lines
57395293 adap->tids.nftids = val[4] - val[3] + 1;
57405294 adap->sge.ingr_start = val[5];
57415295
5296+ params[0] = FW_PARAM_PFVF(CLIP_START);
5297+ params[1] = FW_PARAM_PFVF(CLIP_END);
5298+ ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, val);
5299+ if (ret < 0)
5300+ goto bye;
5301+ adap->clipt_start = val[0];
5302+ adap->clipt_end = val[1];
5303+
57425304 /* query params related to active filter region */
57435305 params[0] = FW_PARAM_PFVF(ACTIVE_FILTER_START);
57445306 params[1] = FW_PARAM_PFVF(ACTIVE_FILTER_END);
@@ -6401,7 +5963,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 656 unmodified lines
64015963 goto out_unmap_bar0;
64025964
64035965 /* We control everything through one PF */
6404− func = SOURCEPF_GET(readl(regs + PL_WHOAMI));
5966+ func = SOURCEPF_G(readl(regs + PL_WHOAMI_A));
64055967 if (func != ent->driver_data) {
64065968 iounmap(regs);
64075969 pci_disable_device(pdev);
@@ -6467,9 +6029,11 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 59 unmodified lines
64676029
64686030
64696031 if (!is_t4(adapter->params.chip)) {
6470− s_qpp = QUEUESPERPAGEPF1 * adapter->fn;
6471− qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter,
6472− SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp);
6032+ s_qpp = (QUEUESPERPAGEPF0_S +
6033+ (QUEUESPERPAGEPF1_S - QUEUESPERPAGEPF0_S) *
6034+ adapter->fn);
6035+ qpp = 1 << QUEUESPERPAGEPF0_G(t4_read_reg(adapter,
6036+ SGE_EGRESS_QUEUES_PER_PAGE_PF_A) >> s_qpp);
64736037 num_seg = PAGE_SIZE / SEGMENT_SIZE;
64746038
64756039 /* Each segment size is 128B. Write coalescing is enabled only
@@ -6557,6 +6121,18 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines
65576121 adapter->params.offload = 0;
65586122 }
65596123
6124+#if IS_ENABLED(CONFIG_IPV6)
6125+ adapter->clipt = t4_init_clip_tbl(adapter->clipt_start,
6126+ adapter->clipt_end);
6127+ if (!adapter->clipt) {
6128+ /* We tolerate a lack of clip_table, giving up
6129+ * some functionality
6130+ */
6131+ dev_warn(&pdev->dev,
6132+ "could not allocate Clip table, continuing\n");
6133+ adapter->params.offload = 0;
6134+ }
6135+#endif
65606136 if (is_offload(adapter) && tid_init(&adapter->tids) < 0) {
65616137 dev_warn(&pdev->dev, "could not allocate TID table, "
65626138 "continuing\n");
@@ -6682,6 +6258,9 @@ static void remove_one(struct pci_dev *pdev) · 119 unmodified lines
66826258 cxgb_down(adapter);
66836259
66846260 free_some_resources(adapter);
6261+#if IS_ENABLED(CONFIG_IPV6)
6262+ t4_cleanup_clip_tbl(adapter);
6263+#endif
66856264 iounmap(adapter->regs);
66866265 if (!is_t4(adapter->params.chip))
66876266 iounmap(adapter->bar2);
@@ -6720,7 +6299,10 @@ static int __init cxgb4_init_module(void) · 32 unmodified lines
67206299 debugfs_remove(cxgb4_debugfs_root);
67216300
67226301 #if IS_ENABLED(CONFIG_IPV6)
6723− register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6302+ if (!inet6addr_registered) {
6303+ register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6304+ inet6addr_registered = true;
6305+ }
67246306 #endif
67256307
67266308 return ret;
@@ -6729,7 +6311,10 @@ static int __init cxgb4_init_module(void) · 2 unmodified lines
67296311 static void __exit cxgb4_cleanup_module(void)
67306312 {
67316313 #if IS_ENABLED(CONFIG_IPV6)
6732− unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6314+ if (inet6addr_registered) {
6315+ unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6316+ inet6addr_registered = false;
6317+ }
67336318 #endif
67346319 pci_unregister_driver(&cxgb4_driver);
67356320 debugfs_remove(cxgb4_debugfs_root); /* NULL ok */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h+0−3
@@ -173,9 +173,6 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, · 172 unmodified lines
173173 unsigned char port, unsigned char mask);
174174 int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid,
175175 unsigned int queue, bool ipv6);
176−int cxgb4_clip_get(const struct net_device *dev, const struct in6_addr *lip);
177−int cxgb4_clip_release(const struct net_device *dev,
178− const struct in6_addr *lip);
179176
180177 static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue)
181178 {
drivers/net/ethernet/chelsio/cxgb4/l2t.c+7−6
@@ -46,6 +46,7 @@ · 45 unmodified lines
4646 #include "t4_msg.h"
4747 #include "t4fw_api.h"
4848 #include "t4_regs.h"
49+#include "t4_values.h"
4950
5051 #define VLAN_NONE 0xfff
5152
@@ -150,8 +151,8 @@ static int write_l2e(struct adapter *adap, struct l2t_entry *e, int sync) · 98 unmodified lines
150151
151152 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ,
152153 e->idx | (sync ? F_SYNC_WR : 0) |
153− TID_QID(adap->sge.fw_evtq.abs_id)));
154− req->params = htons(L2T_W_PORT(e->lport) | L2T_W_NOREPLY(!sync));
154+ TID_QID_V(adap->sge.fw_evtq.abs_id)));
155+ req->params = htons(L2T_W_PORT_V(e->lport) | L2T_W_NOREPLY_V(!sync));
155156 req->l2t_idx = htons(e->idx);
156157 req->vlan = htons(e->vlan);
157158 if (e->neigh && !(e->neigh->dev->flags & IFF_LOOPBACK))
@@ -425,7 +426,7 @@ u64 cxgb4_select_ntuple(struct net_device *dev, · 267 unmodified lines
425426 * in the Compressed Filter Tuple.
426427 */
427428 if (tp->vlan_shift >= 0 && l2t->vlan != VLAN_NONE)
428− ntuple |= (u64)(F_FT_VLAN_VLD | l2t->vlan) << tp->vlan_shift;
429+ ntuple |= (u64)(FT_VLAN_VLD_F | l2t->vlan) << tp->vlan_shift;
429430
430431 if (tp->port_shift >= 0)
431432 ntuple |= (u64)l2t->lport << tp->port_shift;
@@ -439,9 +440,9 @@ u64 cxgb4_select_ntuple(struct net_device *dev, · 7 unmodified lines
439440 u32 pf = FW_VIID_PFN_G(viid);
440441 u32 vld = FW_VIID_VIVLD_G(viid);
441442
442− ntuple |= (u64)(V_FT_VNID_ID_VF(vf) |
443− V_FT_VNID_ID_PF(pf) |
444− V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift;
443+ ntuple |= (u64)(FT_VNID_ID_VF_V(vf) |
444+ FT_VNID_ID_PF_V(pf) |
445+ FT_VNID_ID_VLD_V(vld)) << tp->vnic_shift;
445446 }
446447
447448 return ntuple;
drivers/net/ethernet/chelsio/cxgb4/sge.c+121−149
@@ -43,8 +43,12 @@ · 42 unmodified lines
4343 #include <linux/export.h>
4444 #include <net/ipv6.h>
4545 #include <net/tcp.h>
46+#ifdef CONFIG_NET_RX_BUSY_POLL
47+#include <net/busy_poll.h>
48+#endif /* CONFIG_NET_RX_BUSY_POLL */
4649 #include "cxgb4.h"
4750 #include "t4_regs.h"
51+#include "t4_values.h"
4852 #include "t4_msg.h"
4953 #include "t4fw_api.h"
5054
@@ -521,10 +525,12 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) · 470 unmodified lines
521525 {
522526 u32 val;
523527 if (q->pend_cred >= 8) {
524− val = PIDX(q->pend_cred / 8);
525− if (!is_t4(adap->params.chip))
526− val |= DBTYPE(1);
527− val |= DBPRIO(1);
528+ if (is_t4(adap->params.chip))
529+ val = PIDX_V(q->pend_cred / 8);
530+ else
531+ val = PIDX_T5_V(q->pend_cred / 8) |
532+ DBTYPE_F;
533+ val |= DBPRIO_F;
528534 wmb();
529535
530536 /* If we don't have access to the new User Doorbell (T5+), use
@@ -532,10 +538,10 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) · 1 unmodified line
532538 * mechanism.
533539 */
534540 if (unlikely(q->bar2_addr == NULL)) {
535− t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
536− val | QID(q->cntxt_id));
541+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A),
542+ val | QID_V(q->cntxt_id));
537543 } else {
538− writel(val | QID(q->bar2_qid),
544+ writel(val | QID_V(q->bar2_qid),
539545 q->bar2_addr + SGE_UDB_KDOORBELL);
540546
541547 /* This Write memory Barrier will force the write to
@@ -818,7 +824,8 @@ static void write_sgl(const struct sk_buff *skb, struct sge_txq *q, · 276 unmodified lines
818824 sgl->addr0 = cpu_to_be64(addr[1]);
819825 }
820826
821− sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) | ULPTX_NSGE(nfrags));
827+ sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) |
828+ ULPTX_NSGE_V(nfrags));
822829 if (likely(--nfrags == 0))
823830 return;
824831 /*
@@ -884,7 +891,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 59 unmodified lines
884891 * doorbell mechanism; otherwise use the new BAR2 mechanism.
885892 */
886893 if (unlikely(q->bar2_addr == NULL)) {
887− u32 val = PIDX(n);
894+ u32 val = PIDX_V(n);
888895 unsigned long flags;
889896
890897 /* For T4 we need to participate in the Doorbell Recovery
@@ -892,14 +899,14 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 1 unmodified line
892899 */
893900 spin_lock_irqsave(&q->db_lock, flags);
894901 if (!q->db_disabled)
895− t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
896− QID(q->cntxt_id) | val);
902+ t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A),
903+ QID_V(q->cntxt_id) | val);
897904 else
898905 q->db_pidx_inc += n;
899906 q->db_pidx = q->pidx;
900907 spin_unlock_irqrestore(&q->db_lock, flags);
901908 } else {
902− u32 val = PIDX_T5(n);
909+ u32 val = PIDX_T5_V(n);
903910
904911 /* T4 and later chips share the same PIDX field offset within
905912 * the doorbell, but T5 and later shrank the field in order to
@@ -907,7 +914,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 1 unmodified line
907914 * large in the first place (14 bits) so we just use the T5
908915 * and later limits and warn if a Queue ID is too large.
909916 */
910− WARN_ON(val & DBPRIO(1));
917+ WARN_ON(val & DBPRIO_F);
911918
912919 /* If we're only writing a single TX Descriptor and we can use
913920 * Inferred QID registers, we can use the Write Combining
@@ -923,7 +930,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 9 unmodified lines
923930 (q->bar2_addr + SGE_UDB_WCDOORBELL),
924931 wr);
925932 } else {
926− writel(val | QID(q->bar2_qid),
933+ writel(val | QID_V(q->bar2_qid),
927934 q->bar2_addr + SGE_UDB_KDOORBELL);
928935 }
929936
@@ -1150,9 +1157,9 @@ out_free: dev_kfree_skb_any(skb); · 220 unmodified lines
11501157 cntrl = TXPKT_L4CSUM_DIS | TXPKT_IPCSUM_DIS;
11511158 }
11521159
1153− if (vlan_tx_tag_present(skb)) {
1160+ if (skb_vlan_tag_present(skb)) {
11541161 q->vlan_ins++;
1155− cntrl |= TXPKT_VLAN_VLD | TXPKT_VLAN(vlan_tx_tag_get(skb));
1162+ cntrl |= TXPKT_VLAN_VLD | TXPKT_VLAN(skb_vlan_tag_get(skb));
11561163 }
11571164
11581165 cpl->ctrl0 = htonl(TXPKT_OPCODE(CPL_TX_PKT_XT) |
@@ -1716,6 +1723,7 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, · 557 unmodified lines
17161723 skb->truesize += skb->data_len;
17171724 skb->ip_summed = CHECKSUM_UNNECESSARY;
17181725 skb_record_rx_queue(skb, rxq->rspq.idx);
1726+ skb_mark_napi_id(skb, &rxq->rspq.napi);
17191727 if (rxq->rspq.netdev->features & NETIF_F_RXHASH)
17201728 skb_set_hash(skb, (__force u32)pkt->rsshdr.hash_val,
17211729 PKT_HASH_TYPE_L3);
@@ -1758,7 +1766,8 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 36 unmodified lines
17581766 pkt = (const struct cpl_rx_pkt *)rsp;
17591767 csum_ok = pkt->csum_calc && !pkt->err_vec &&
17601768 (q->netdev->features & NETIF_F_RXCSUM);
1761− if ((pkt->l2info & htonl(RXF_TCP)) &&
1769+ if ((pkt->l2info & htonl(RXF_TCP_F)) &&
1770+ !(cxgb_poll_busy_polling(q)) &&
17621771 (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) {
17631772 do_gro(rxq, si, pkt);
17641773 return 0;
@@ -1780,11 +1789,11 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 15 unmodified lines
17801789
17811790 rxq->stats.pkts++;
17821791
1783− if (csum_ok && (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) {
1792+ if (csum_ok && (pkt->l2info & htonl(RXF_UDP_F | RXF_TCP_F))) {
17841793 if (!pkt->ip_frag) {
17851794 skb->ip_summed = CHECKSUM_UNNECESSARY;
17861795 rxq->stats.rx_cso++;
1787− } else if (pkt->l2info & htonl(RXF_IP)) {
1796+ } else if (pkt->l2info & htonl(RXF_IP_F)) {
17881797 __sum16 c = (__force __sum16)pkt->csum;
17891798 skb->csum = csum_unfold(c);
17901799 skb->ip_summed = CHECKSUM_COMPLETE;
@@ -1797,6 +1806,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 6 unmodified lines
17971806 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan));
17981807 rxq->stats.vlan_ex++;
17991808 }
1809+ skb_mark_napi_id(skb, &q->napi);
18001810 netif_receive_skb(skb);
18011811 return 0;
18021812 }
@@ -1959,6 +1969,38 @@ static int process_responses(struct sge_rspq *q, int budget) · 156 unmodified lines
19591969 return budget - budget_left;
19601970 }
19611971
1972+#ifdef CONFIG_NET_RX_BUSY_POLL
1973+int cxgb_busy_poll(struct napi_struct *napi)
1974+{
1975+ struct sge_rspq *q = container_of(napi, struct sge_rspq, napi);
1976+ unsigned int params, work_done;
1977+ u32 val;
1978+
1979+ if (!cxgb_poll_lock_poll(q))
1980+ return LL_FLUSH_BUSY;
1981+
1982+ work_done = process_responses(q, 4);
1983+ params = QINTR_TIMER_IDX(TIMERREG_COUNTER0_X) | QINTR_CNT_EN;
1984+ q->next_intr_params = params;
1985+ val = CIDXINC_V(work_done) | SEINTARM_V(params);
1986+
1987+ /* If we don't have access to the new User GTS (T5+), use the old
1988+ * doorbell mechanism; otherwise use the new BAR2 mechanism.
1989+ */
1990+ if (unlikely(!q->bar2_addr))
1991+ t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS_A),
1992+ val | INGRESSQID_V((u32)q->cntxt_id));
1993+ else {
1994+ writel(val | INGRESSQID_V(q->bar2_qid),
1995+ q->bar2_addr + SGE_UDB_GTS);
1996+ wmb();
1997+ }
1998+
1999+ cxgb_poll_unlock_poll(q);
2000+ return work_done;
2001+}
2002+#endif /* CONFIG_NET_RX_BUSY_POLL */
2003+
19622004 /**
19632005 * napi_rx_handler - the NAPI handler for Rx processing
19642006 * @napi: the napi instance
@@ -1974,9 +2016,13 @@ static int napi_rx_handler(struct napi_struct *napi, int budget) · 9 unmodified lines
19742016 {
19752017 unsigned int params;
19762018 struct sge_rspq *q = container_of(napi, struct sge_rspq, napi);
1977− int work_done = process_responses(q, budget);
2019+ int work_done;
19782020 u32 val;
19792021
2022+ if (!cxgb_poll_lock_napi(q))
2023+ return budget;
2024+
2025+ work_done = process_responses(q, budget);
19802026 if (likely(work_done < budget)) {
19812027 int timer_index;
19822028
@@ -2001,19 +2047,20 @@ static int napi_rx_handler(struct napi_struct *napi, int budget) · 18 unmodified lines
20012047 } else
20022048 params = QINTR_TIMER_IDX(7);
20032049
2004− val = CIDXINC(work_done) | SEINTARM(params);
2050+ val = CIDXINC_V(work_done) | SEINTARM_V(params);
20052051
20062052 /* If we don't have access to the new User GTS (T5+), use the old
20072053 * doorbell mechanism; otherwise use the new BAR2 mechanism.
20082054 */
20092055 if (unlikely(q->bar2_addr == NULL)) {
2010− t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS),
2011− val | INGRESSQID((u32)q->cntxt_id));
2056+ t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS_A),
2057+ val | INGRESSQID_V((u32)q->cntxt_id));
20122058 } else {
2013− writel(val | INGRESSQID(q->bar2_qid),
2059+ writel(val | INGRESSQID_V(q->bar2_qid),
20142060 q->bar2_addr + SGE_UDB_GTS);
20152061 wmb();
20162062 }
2063+ cxgb_poll_unlock_napi(q);
20172064 return work_done;
20182065 }
20192066
@@ -2056,16 +2103,16 @@ static unsigned int process_intrq(struct adapter *adap) · 36 unmodified lines
20562103 rspq_next(q);
20572104 }
20582105
2059− val = CIDXINC(credits) | SEINTARM(q->intr_params);
2106+ val = CIDXINC_V(credits) | SEINTARM_V(q->intr_params);
20602107
20612108 /* If we don't have access to the new User GTS (T5+), use the old
20622109 * doorbell mechanism; otherwise use the new BAR2 mechanism.
20632110 */
20642111 if (unlikely(q->bar2_addr == NULL)) {
2065− t4_write_reg(adap, MYPF_REG(SGE_PF_GTS),
2066− val | INGRESSQID(q->cntxt_id));
2112+ t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A),
2113+ val | INGRESSQID_V(q->cntxt_id));
20672114 } else {
2068− writel(val | INGRESSQID(q->bar2_qid),
2115+ writel(val | INGRESSQID_V(q->bar2_qid),
20692116 q->bar2_addr + SGE_UDB_GTS);
20702117 wmb();
20712118 }
@@ -2095,7 +2142,7 @@ static irqreturn_t t4_intr_intx(int irq, void *cookie) · 23 unmodified lines
20952142 {
20962143 struct adapter *adap = cookie;
20972144
2098− t4_write_reg(adap, MYPF_REG(PCIE_PF_CLI), 0);
2145+ t4_write_reg(adap, MYPF_REG(PCIE_PF_CLI_A), 0);
20992146 if (t4_slow_intr_handler(adap) | process_intrq(adap))
21002147 return IRQ_HANDLED;
21012148 return IRQ_NONE; /* probably shared interrupt */
@@ -2142,9 +2189,9 @@ static void sge_rx_timer_cb(unsigned long data) · 40 unmodified lines
21422189 }
21432190 }
21442191
2145− t4_write_reg(adap, SGE_DEBUG_INDEX, 13);
2146− idma_same_state_cnt[0] = t4_read_reg(adap, SGE_DEBUG_DATA_HIGH);
2147− idma_same_state_cnt[1] = t4_read_reg(adap, SGE_DEBUG_DATA_LOW);
2192+ t4_write_reg(adap, SGE_DEBUG_INDEX_A, 13);
2193+ idma_same_state_cnt[0] = t4_read_reg(adap, SGE_DEBUG_DATA_HIGH_A);
2194+ idma_same_state_cnt[1] = t4_read_reg(adap, SGE_DEBUG_DATA_LOW_A);
21482195
21492196 for (i = 0; i < 2; i++) {
21502197 u32 debug0, debug11;
@@ -2188,12 +2235,12 @@ static void sge_rx_timer_cb(unsigned long data) · 37 unmodified lines
21882235 /* Read and save the SGE IDMA State and Queue ID information.
21892236 * We do this every time in case it changes across time ...
21902237 */
2191− t4_write_reg(adap, SGE_DEBUG_INDEX, 0);
2192− debug0 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW);
2238+ t4_write_reg(adap, SGE_DEBUG_INDEX_A, 0);
2239+ debug0 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW_A);
21932240 s->idma_state[i] = (debug0 >> (i * 9)) & 0x3f;
21942241
2195− t4_write_reg(adap, SGE_DEBUG_INDEX, 11);
2196− debug11 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW);
2242+ t4_write_reg(adap, SGE_DEBUG_INDEX_A, 11);
2243+ debug11 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW_A);
21972244 s->idma_qid[i] = (debug11 >> (i * 16)) & 0xffff;
21982245
21992246 CH_WARN(adap, "SGE idma%u, queue%u, maybe stuck state%u %dsecs (debug0=%#x, debug11=%#x)\n",
@@ -2337,6 +2384,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, · 137 unmodified lines
23372384 goto err;
23382385
23392386 netif_napi_add(dev, &iq->napi, napi_rx_handler, 64);
2387+ napi_hash_add(&iq->napi);
23402388 iq->cur_desc = iq->desc;
23412389 iq->cidx = 0;
23422390 iq->gen = 1;
@@ -2594,6 +2642,7 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, · 251 unmodified lines
25942642 rq->cntxt_id, fl_id, 0xffff);
25952643 dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len,
25962644 rq->desc, rq->phys_addr);
2645+ napi_hash_del(&rq->napi);
25972646 netif_napi_del(&rq->napi);
25982647 rq->netdev = NULL;
25992648 rq->cntxt_id = rq->abs_id = 0;
@@ -2738,24 +2787,11 @@ void t4_sge_stop(struct adapter *adap) · 138 unmodified lines
27382787 }
27392788
27402789 /**
2741− * t4_sge_init - initialize SGE
2790+ * t4_sge_init_soft - grab core SGE values needed by SGE code
27422791 * @adap: the adapter
27432792 *
2744− * Performs SGE initialization needed every time after a chip reset.
2745− * We do not initialize any of the queues here, instead the driver
2746− * top-level must request them individually.
2747− *
2748− * Called in two different modes:
2749− *
2750− * 1. Perform actual hardware initialization and record hard-coded
2751− * parameters which were used. This gets used when we're the
2752− * Master PF and the Firmware Configuration File support didn't
2753− * work for some reason.
2754− *
2755− * 2. We're not the Master PF or initialization was performed with
2756− * a Firmware Configuration File. In this case we need to grab
2757− * any of the SGE operating parameters that we need to have in
2758− * order to do our job and make sure we can live with them ...
2793+ * We need to grab the SGE operating parameters that we need to have
2794+ * in order to do our job and make sure we can live with them.
27592795 */
27602796
27612797 static int t4_sge_init_soft(struct adapter *adap)
@@ -2770,8 +2806,8 @@ static int t4_sge_init_soft(struct adapter *adap) · 8 unmodified lines
27702806 * process_responses() and that only packet data is going to the
27712807 * Free Lists.
27722808 */
2773− if ((t4_read_reg(adap, SGE_CONTROL) & RXPKTCPLMODE_MASK) !=
2774− RXPKTCPLMODE(X_RXPKTCPLMODE_SPLIT)) {
2809+ if ((t4_read_reg(adap, SGE_CONTROL_A) & RXPKTCPLMODE_F) !=
2810+ RXPKTCPLMODE_V(RXPKTCPLMODE_SPLIT_X)) {
27752811 dev_err(adap->pdev_dev, "bad SGE CPL MODE\n");
27762812 return -EINVAL;
27772813 }
@@ -2785,7 +2821,7 @@ static int t4_sge_init_soft(struct adapter *adap) · 7 unmodified lines
27852821 * XXX meet our needs!
27862822 */
27872823 #define READ_FL_BUF(x) \
2788− t4_read_reg(adap, SGE_FL_BUFFER_SIZE0+(x)*sizeof(u32))
2824+ t4_read_reg(adap, SGE_FL_BUFFER_SIZE0_A+(x)*sizeof(u32))
27892825
27902826 fl_small_pg = READ_FL_BUF(RX_SMALL_PG_BUF);
27912827 fl_large_pg = READ_FL_BUF(RX_LARGE_PG_BUF);
@@ -2823,99 +2859,38 @@ static int t4_sge_init_soft(struct adapter *adap) · 31 unmodified lines
28232859 * Retrieve our RX interrupt holdoff timer values and counter
28242860 * threshold values from the SGE parameters.
28252861 */
2826− timer_value_0_and_1 = t4_read_reg(adap, SGE_TIMER_VALUE_0_AND_1);
2827− timer_value_2_and_3 = t4_read_reg(adap, SGE_TIMER_VALUE_2_AND_3);
2828− timer_value_4_and_5 = t4_read_reg(adap, SGE_TIMER_VALUE_4_AND_5);
2862+ timer_value_0_and_1 = t4_read_reg(adap, SGE_TIMER_VALUE_0_AND_1_A);
2863+ timer_value_2_and_3 = t4_read_reg(adap, SGE_TIMER_VALUE_2_AND_3_A);
2864+ timer_value_4_and_5 = t4_read_reg(adap, SGE_TIMER_VALUE_4_AND_5_A);
28292865 s->timer_val[0] = core_ticks_to_us(adap,
2830− TIMERVALUE0_GET(timer_value_0_and_1));
2866+ TIMERVALUE0_G(timer_value_0_and_1));
28312867 s->timer_val[1] = core_ticks_to_us(adap,
2832− TIMERVALUE1_GET(timer_value_0_and_1));
2868+ TIMERVALUE1_G(timer_value_0_and_1));
28332869 s->timer_val[2] = core_ticks_to_us(adap,
2834− TIMERVALUE2_GET(timer_value_2_and_3));
2870+ TIMERVALUE2_G(timer_value_2_and_3));
28352871 s->timer_val[3] = core_ticks_to_us(adap,
2836− TIMERVALUE3_GET(timer_value_2_and_3));
2872+ TIMERVALUE3_G(timer_value_2_and_3));
28372873 s->timer_val[4] = core_ticks_to_us(adap,
2838− TIMERVALUE4_GET(timer_value_4_and_5));
2874+ TIMERVALUE4_G(timer_value_4_and_5));
28392875 s->timer_val[5] = core_ticks_to_us(adap,
2840− TIMERVALUE5_GET(timer_value_4_and_5));
2876+ TIMERVALUE5_G(timer_value_4_and_5));
28412877
2842− ingress_rx_threshold = t4_read_reg(adap, SGE_INGRESS_RX_THRESHOLD);
2843− s->counter_val[0] = THRESHOLD_0_GET(ingress_rx_threshold);
2844− s->counter_val[1] = THRESHOLD_1_GET(ingress_rx_threshold);
2845− s->counter_val[2] = THRESHOLD_2_GET(ingress_rx_threshold);
2846− s->counter_val[3] = THRESHOLD_3_GET(ingress_rx_threshold);
2847−
2848− return 0;
2849−}
2850−
2851−static int t4_sge_init_hard(struct adapter *adap)
2852−{
2853− struct sge *s = &adap->sge;
2854−
2855− /*
2856− * Set up our basic SGE mode to deliver CPL messages to our Ingress
2857− * Queue and Packet Date to the Free List.
2858− */
2859− t4_set_reg_field(adap, SGE_CONTROL, RXPKTCPLMODE_MASK,
2860− RXPKTCPLMODE_MASK);
2861−
2862− /*
2863− * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows
2864− * and generate an interrupt when this occurs so we can recover.
2865− */
2866− if (is_t4(adap->params.chip)) {
2867− t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS,
2868− V_HP_INT_THRESH(M_HP_INT_THRESH) |
2869− V_LP_INT_THRESH(M_LP_INT_THRESH),
2870− V_HP_INT_THRESH(dbfifo_int_thresh) |
2871− V_LP_INT_THRESH(dbfifo_int_thresh));
2872− } else {
2873− t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS,
2874− V_LP_INT_THRESH_T5(M_LP_INT_THRESH_T5),
2875− V_LP_INT_THRESH_T5(dbfifo_int_thresh));
2876− t4_set_reg_field(adap, SGE_DBFIFO_STATUS2,
2877− V_HP_INT_THRESH_T5(M_HP_INT_THRESH_T5),
2878− V_HP_INT_THRESH_T5(dbfifo_int_thresh));
2879− }
2880− t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_ENABLE_DROP,
2881− F_ENABLE_DROP);
2882−
2883− /*
2884− * SGE_FL_BUFFER_SIZE0 (RX_SMALL_PG_BUF) is set up by
2885− * t4_fixup_host_params().
2886− */
2887− s->fl_pg_order = FL_PG_ORDER;
2888− if (s->fl_pg_order)
2889− t4_write_reg(adap,
2890− SGE_FL_BUFFER_SIZE0+RX_LARGE_PG_BUF*sizeof(u32),
2891− PAGE_SIZE << FL_PG_ORDER);
2892− t4_write_reg(adap, SGE_FL_BUFFER_SIZE0+RX_SMALL_MTU_BUF*sizeof(u32),
2893− FL_MTU_SMALL_BUFSIZE(adap));
2894− t4_write_reg(adap, SGE_FL_BUFFER_SIZE0+RX_LARGE_MTU_BUF*sizeof(u32),
2895− FL_MTU_LARGE_BUFSIZE(adap));
2896−
2897− /*
2898− * Note that the SGE Ingress Packet Count Interrupt Threshold and
2899− * Timer Holdoff values must be supplied by our caller.
2900− */
2901− t4_write_reg(adap, SGE_INGRESS_RX_THRESHOLD,
2902− THRESHOLD_0(s->counter_val[0]) |
2903− THRESHOLD_1(s->counter_val[1]) |
2904− THRESHOLD_2(s->counter_val[2]) |
2905− THRESHOLD_3(s->counter_val[3]));
2906− t4_write_reg(adap, SGE_TIMER_VALUE_0_AND_1,
2907− TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[0])) |
2908− TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[1])));
2909− t4_write_reg(adap, SGE_TIMER_VALUE_2_AND_3,
2910− TIMERVALUE2(us_to_core_ticks(adap, s->timer_val[2])) |
2911− TIMERVALUE3(us_to_core_ticks(adap, s->timer_val[3])));
2912− t4_write_reg(adap, SGE_TIMER_VALUE_4_AND_5,
2913− TIMERVALUE4(us_to_core_ticks(adap, s->timer_val[4])) |
2914− TIMERVALUE5(us_to_core_ticks(adap, s->timer_val[5])));
2878+ ingress_rx_threshold = t4_read_reg(adap, SGE_INGRESS_RX_THRESHOLD_A);
2879+ s->counter_val[0] = THRESHOLD_0_G(ingress_rx_threshold);
2880+ s->counter_val[1] = THRESHOLD_1_G(ingress_rx_threshold);
2881+ s->counter_val[2] = THRESHOLD_2_G(ingress_rx_threshold);
2882+ s->counter_val[3] = THRESHOLD_3_G(ingress_rx_threshold);
29152883
29162884 return 0;
29172885 }
29182886
2887+/**
2888+ * t4_sge_init - initialize SGE
2889+ * @adap: the adapter
2890+ *
2891+ * Perform low-level SGE code initialization needed every time after a
2892+ * chip reset.
2893+ */
29192894 int t4_sge_init(struct adapter *adap)
29202895 {
29212896 struct sge *s = &adap->sge;
@@ -2927,9 +2902,9 @@ int t4_sge_init(struct adapter *adap) · 5 unmodified lines
29272902 * Ingress Padding Boundary and Egress Status Page Size are set up by
29282903 * t4_fixup_host_params().
29292904 */
2930− sge_control = t4_read_reg(adap, SGE_CONTROL);
2931− s->pktshift = PKTSHIFT_GET(sge_control);
2932− s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64;
2905+ sge_control = t4_read_reg(adap, SGE_CONTROL_A);
2906+ s->pktshift = PKTSHIFT_G(sge_control);
2907+ s->stat_len = (sge_control & EGRSTATUSPAGESIZE_F) ? 128 : 64;
29332908
29342909 /* T4 uses a single control field to specify both the PCIe Padding and
29352910 * Packing Boundary. T5 introduced the ability to specify these
@@ -2937,8 +2912,8 @@ int t4_sge_init(struct adapter *adap) · 1 unmodified line
29372912 * within Packed Buffer Mode is the maximum of these two
29382913 * specifications.
29392914 */
2940− ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_control) +
2941− X_INGPADBOUNDARY_SHIFT);
2915+ ingpadboundary = 1 << (INGPADBOUNDARY_G(sge_control) +
2916+ INGPADBOUNDARY_SHIFT_X);
29422917 if (is_t4(adap->params.chip)) {
29432918 s->fl_align = ingpadboundary;
29442919 } else {
@@ -2956,10 +2931,7 @@ int t4_sge_init(struct adapter *adap) · 11 unmodified lines
29562931 s->fl_align = max(ingpadboundary, ingpackboundary);
29572932 }
29582933
2959− if (adap->flags & USING_SOFT_PARAMS)
2960− ret = t4_sge_init_soft(adap);
2961− else
2962− ret = t4_sge_init_hard(adap);
2934+ ret = t4_sge_init_soft(adap);
29632935 if (ret < 0)
29642936 return ret;
29652937
@@ -2975,11 +2947,11 @@ int t4_sge_init(struct adapter *adap) · 9 unmodified lines
29752947 * buffers and a new field which only applies to Packed Mode Free List
29762948 * buffers.
29772949 */
2978− sge_conm_ctrl = t4_read_reg(adap, SGE_CONM_CTRL);
2950+ sge_conm_ctrl = t4_read_reg(adap, SGE_CONM_CTRL_A);
29792951 if (is_t4(adap->params.chip))
2980− egress_threshold = EGRTHRESHOLD_GET(sge_conm_ctrl);
2952+ egress_threshold = EGRTHRESHOLD_G(sge_conm_ctrl);
29812953 else
2982− egress_threshold = EGRTHRESHOLDPACKING_GET(sge_conm_ctrl);
2954+ egress_threshold = EGRTHRESHOLDPACKING_G(sge_conm_ctrl);
29832955 s->fl_starve_thres = 2*egress_threshold + 1;
29842956
29852957 setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap);
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+1067−476
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/delay.h>
3636 #include "cxgb4.h"
3737 #include "t4_regs.h"
38+#include "t4_values.h"
3839 #include "t4fw_api.h"
3940
4041 /**
@@ -149,20 +150,20 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, · 108 unmodified lines
149150 */
150151 void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val)
151152 {
152− u32 req = ENABLE | FUNCTION(adap->fn) | reg;
153+ u32 req = ENABLE_F | FUNCTION_V(adap->fn) | REGISTER_V(reg);
153154
154155 if (is_t4(adap->params.chip))
155− req |= F_LOCALCFG;
156+ req |= LOCALCFG_F;
156157
157− t4_write_reg(adap, PCIE_CFG_SPACE_REQ, req);
158− *val = t4_read_reg(adap, PCIE_CFG_SPACE_DATA);
158+ t4_write_reg(adap, PCIE_CFG_SPACE_REQ_A, req);
159+ *val = t4_read_reg(adap, PCIE_CFG_SPACE_DATA_A);
159160
160161 /* Reset ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a
161162 * Configuration Space read. (None of the other fields matter when
162163 * ENABLE is 0 so a simple register write is easier than a
163164 * read-modify-write via t4_set_reg_field().)
164165 */
165− t4_write_reg(adap, PCIE_CFG_SPACE_REQ, 0);
166+ t4_write_reg(adap, PCIE_CFG_SPACE_REQ_A, 0);
166167 }
167168
168169 /*
@@ -187,8 +188,8 @@ static void t4_report_fw_error(struct adapter *adap) · 18 unmodified lines
187188 };
188189 u32 pcie_fw;
189190
190− pcie_fw = t4_read_reg(adap, MA_PCIE_FW);
191− if (pcie_fw & PCIE_FW_ERR)
191+ pcie_fw = t4_read_reg(adap, PCIE_FW_A);
192+ if (pcie_fw & PCIE_FW_ERR_F)
192193 dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n",
193194 reason[PCIE_FW_EVAL_G(pcie_fw)]);
194195 }
@@ -264,8 +265,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 69 unmodified lines
264265 u64 res;
265266 int i, ms, delay_idx;
266267 const __be64 *p = cmd;
267− u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA);
268− u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL);
268+ u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
269+ u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL_A);
269270
270271 if ((size & 15) || size > MBOX_LEN)
271272 return -EINVAL;
@@ -277,9 +278,9 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 5 unmodified lines
277278 if (adap->pdev->error_state != pci_channel_io_normal)
278279 return -EIO;
279280
280− v = MBOWNER_GET(t4_read_reg(adap, ctl_reg));
281+ v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
281282 for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++)
282− v = MBOWNER_GET(t4_read_reg(adap, ctl_reg));
283+ v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
283284
284285 if (v != MBOX_OWNER_DRV)
285286 return v ? -EBUSY : -ETIMEDOUT;
@@ -287,7 +288,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 1 unmodified line
287288 for (i = 0; i < size; i += 8)
288289 t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p++));
289290
290− t4_write_reg(adap, ctl_reg, MBMSGVALID | MBOWNER(MBOX_OWNER_FW));
291+ t4_write_reg(adap, ctl_reg, MBMSGVALID_F | MBOWNER_V(MBOX_OWNER_FW));
291292 t4_read_reg(adap, ctl_reg); /* flush write */
292293
293294 delay_idx = 0;
@@ -303,8 +304,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 9 unmodified lines
303304 mdelay(ms);
304305
305306 v = t4_read_reg(adap, ctl_reg);
306− if (MBOWNER_GET(v) == MBOX_OWNER_DRV) {
307− if (!(v & MBMSGVALID)) {
307+ if (MBOWNER_G(v) == MBOX_OWNER_DRV) {
308+ if (!(v & MBMSGVALID_F)) {
308309 t4_write_reg(adap, ctl_reg, 0);
309310 continue;
310311 }
@@ -350,27 +351,27 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) · 39 unmodified lines
350351 u32 mc_bist_status_rdata, mc_bist_data_pattern;
351352
352353 if (is_t4(adap->params.chip)) {
353− mc_bist_cmd = MC_BIST_CMD;
354− mc_bist_cmd_addr = MC_BIST_CMD_ADDR;
355− mc_bist_cmd_len = MC_BIST_CMD_LEN;
356− mc_bist_status_rdata = MC_BIST_STATUS_RDATA;
357− mc_bist_data_pattern = MC_BIST_DATA_PATTERN;
354+ mc_bist_cmd = MC_BIST_CMD_A;
355+ mc_bist_cmd_addr = MC_BIST_CMD_ADDR_A;
356+ mc_bist_cmd_len = MC_BIST_CMD_LEN_A;
357+ mc_bist_status_rdata = MC_BIST_STATUS_RDATA_A;
358+ mc_bist_data_pattern = MC_BIST_DATA_PATTERN_A;
358359 } else {
359− mc_bist_cmd = MC_REG(MC_P_BIST_CMD, idx);
360− mc_bist_cmd_addr = MC_REG(MC_P_BIST_CMD_ADDR, idx);
361− mc_bist_cmd_len = MC_REG(MC_P_BIST_CMD_LEN, idx);
362− mc_bist_status_rdata = MC_REG(MC_P_BIST_STATUS_RDATA, idx);
363− mc_bist_data_pattern = MC_REG(MC_P_BIST_DATA_PATTERN, idx);
360+ mc_bist_cmd = MC_REG(MC_P_BIST_CMD_A, idx);
361+ mc_bist_cmd_addr = MC_REG(MC_P_BIST_CMD_ADDR_A, idx);
362+ mc_bist_cmd_len = MC_REG(MC_P_BIST_CMD_LEN_A, idx);
363+ mc_bist_status_rdata = MC_REG(MC_P_BIST_STATUS_RDATA_A, idx);
364+ mc_bist_data_pattern = MC_REG(MC_P_BIST_DATA_PATTERN_A, idx);
364365 }
365366
366− if (t4_read_reg(adap, mc_bist_cmd) & START_BIST)
367+ if (t4_read_reg(adap, mc_bist_cmd) & START_BIST_F)
367368 return -EBUSY;
368369 t4_write_reg(adap, mc_bist_cmd_addr, addr & ~0x3fU);
369370 t4_write_reg(adap, mc_bist_cmd_len, 64);
370371 t4_write_reg(adap, mc_bist_data_pattern, 0xc);
371− t4_write_reg(adap, mc_bist_cmd, BIST_OPCODE(1) | START_BIST |
372− BIST_CMD_GAP(1));
373− i = t4_wait_op_done(adap, mc_bist_cmd, START_BIST, 0, 10, 1);
372+ t4_write_reg(adap, mc_bist_cmd, BIST_OPCODE_V(1) | START_BIST_F |
373+ BIST_CMD_GAP_V(1));
374+ i = t4_wait_op_done(adap, mc_bist_cmd, START_BIST_F, 0, 10, 1);
374375 if (i)
375376 return i;
376377
@@ -403,31 +404,31 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) · 26 unmodified lines
403404 u32 edc_bist_cmd_data_pattern, edc_bist_status_rdata;
404405
405406 if (is_t4(adap->params.chip)) {
406− edc_bist_cmd = EDC_REG(EDC_BIST_CMD, idx);
407− edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR, idx);
408− edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN, idx);
409− edc_bist_cmd_data_pattern = EDC_REG(EDC_BIST_DATA_PATTERN,
410− idx);
411− edc_bist_status_rdata = EDC_REG(EDC_BIST_STATUS_RDATA,
407+ edc_bist_cmd = EDC_REG(EDC_BIST_CMD_A, idx);
408+ edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR_A, idx);
409+ edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN_A, idx);
410+ edc_bist_cmd_data_pattern = EDC_REG(EDC_BIST_DATA_PATTERN_A,
412411 idx);
412+ edc_bist_status_rdata = EDC_REG(EDC_BIST_STATUS_RDATA_A,
413+ idx);
413414 } else {
414− edc_bist_cmd = EDC_REG_T5(EDC_H_BIST_CMD, idx);
415− edc_bist_cmd_addr = EDC_REG_T5(EDC_H_BIST_CMD_ADDR, idx);
416− edc_bist_cmd_len = EDC_REG_T5(EDC_H_BIST_CMD_LEN, idx);
415+ edc_bist_cmd = EDC_REG_T5(EDC_H_BIST_CMD_A, idx);
416+ edc_bist_cmd_addr = EDC_REG_T5(EDC_H_BIST_CMD_ADDR_A, idx);
417+ edc_bist_cmd_len = EDC_REG_T5(EDC_H_BIST_CMD_LEN_A, idx);
417418 edc_bist_cmd_data_pattern =
418− EDC_REG_T5(EDC_H_BIST_DATA_PATTERN, idx);
419+ EDC_REG_T5(EDC_H_BIST_DATA_PATTERN_A, idx);
419420 edc_bist_status_rdata =
420− EDC_REG_T5(EDC_H_BIST_STATUS_RDATA, idx);
421+ EDC_REG_T5(EDC_H_BIST_STATUS_RDATA_A, idx);
421422 }
422423
423− if (t4_read_reg(adap, edc_bist_cmd) & START_BIST)
424+ if (t4_read_reg(adap, edc_bist_cmd) & START_BIST_F)
424425 return -EBUSY;
425426 t4_write_reg(adap, edc_bist_cmd_addr, addr & ~0x3fU);
426427 t4_write_reg(adap, edc_bist_cmd_len, 64);
427428 t4_write_reg(adap, edc_bist_cmd_data_pattern, 0xc);
428429 t4_write_reg(adap, edc_bist_cmd,
429− BIST_OPCODE(1) | BIST_CMD_GAP(1) | START_BIST);
430− i = t4_wait_op_done(adap, edc_bist_cmd, START_BIST, 0, 10, 1);
430+ BIST_OPCODE_V(1) | BIST_CMD_GAP_V(1) | START_BIST_F);
431+ i = t4_wait_op_done(adap, edc_bist_cmd, START_BIST_F, 0, 10, 1);
431432 if (i)
432433 return i;
433434
@@ -505,13 +506,13 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 71 unmodified lines
505506 * the address is relative to BAR0.
506507 */
507508 mem_reg = t4_read_reg(adap,
508− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN,
509+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A,
509510 win));
510− mem_aperture = 1 << (GET_WINDOW(mem_reg) + 10);
511− mem_base = GET_PCIEOFST(mem_reg) << 10;
511+ mem_aperture = 1 << (WINDOW_G(mem_reg) + WINDOW_SHIFT_X);
512+ mem_base = PCIEOFST_G(mem_reg) << PCIEOFST_SHIFT_X;
512513 if (is_t4(adap->params.chip))
513514 mem_base -= adap->t4_bar0;
514− win_pf = is_t4(adap->params.chip) ? 0 : V_PFNUM(adap->fn);
515+ win_pf = is_t4(adap->params.chip) ? 0 : PFNUM_V(adap->fn);
515516
516517 /* Calculate our initial PCI-E Memory Window Position and Offset into
517518 * that Window.
@@ -524,10 +525,10 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 6 unmodified lines
524525 * attempt to use the new value.)
525526 */
526527 t4_write_reg(adap,
527− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, win),
528+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, win),
528529 pos | win_pf);
529530 t4_read_reg(adap,
530− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, win));
531+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, win));
531532
532533 /* Transfer data to/from the adapter as long as there's an integral
533534 * number of 32-bit transfers to complete.
@@ -552,11 +553,11 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 18 unmodified lines
552553 pos += mem_aperture;
553554 offset = 0;
554555 t4_write_reg(adap,
555− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET,
556− win), pos | win_pf);
556+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A,
557+ win), pos | win_pf);
557558 t4_read_reg(adap,
558− PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET,
559− win));
559+ PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A,
560+ win));
560561 }
561562 }
562563
@@ -760,14 +761,13 @@ static int sf1_read(struct adapter *adapter, unsigned int byte_cnt, int cont, · 197 unmodified lines
760761
761762 if (!byte_cnt || byte_cnt > 4)
762763 return -EINVAL;
763− if (t4_read_reg(adapter, SF_OP) & SF_BUSY)
764+ if (t4_read_reg(adapter, SF_OP_A) & SF_BUSY_F)
764765 return -EBUSY;
765− cont = cont ? SF_CONT : 0;
766− lock = lock ? SF_LOCK : 0;
767− t4_write_reg(adapter, SF_OP, lock | cont | BYTECNT(byte_cnt - 1));
768− ret = t4_wait_op_done(adapter, SF_OP, SF_BUSY, 0, SF_ATTEMPTS, 5);
766+ t4_write_reg(adapter, SF_OP_A, SF_LOCK_V(lock) |
767+ SF_CONT_V(cont) | BYTECNT_V(byte_cnt - 1));
768+ ret = t4_wait_op_done(adapter, SF_OP_A, SF_BUSY_F, 0, SF_ATTEMPTS, 5);
769769 if (!ret)
770− *valp = t4_read_reg(adapter, SF_DATA);
770+ *valp = t4_read_reg(adapter, SF_DATA_A);
771771 return ret;
772772 }
773773
@@ -788,14 +788,12 @@ static int sf1_write(struct adapter *adapter, unsigned int byte_cnt, int cont, · 14 unmodified lines
788788 {
789789 if (!byte_cnt || byte_cnt > 4)
790790 return -EINVAL;
791− if (t4_read_reg(adapter, SF_OP) & SF_BUSY)
791+ if (t4_read_reg(adapter, SF_OP_A) & SF_BUSY_F)
792792 return -EBUSY;
793− cont = cont ? SF_CONT : 0;
794− lock = lock ? SF_LOCK : 0;
795− t4_write_reg(adapter, SF_DATA, val);
796− t4_write_reg(adapter, SF_OP, lock |
797− cont | BYTECNT(byte_cnt - 1) | OP_WR);
798− return t4_wait_op_done(adapter, SF_OP, SF_BUSY, 0, SF_ATTEMPTS, 5);
793+ t4_write_reg(adapter, SF_DATA_A, val);
794+ t4_write_reg(adapter, SF_OP_A, SF_LOCK_V(lock) |
795+ SF_CONT_V(cont) | BYTECNT_V(byte_cnt - 1) | OP_V(1));
796+ return t4_wait_op_done(adapter, SF_OP_A, SF_BUSY_F, 0, SF_ATTEMPTS, 5);
799797 }
800798
801799 /**
@@ -837,8 +835,8 @@ static int flash_wait_op(struct adapter *adapter, int attempts, int delay) · 35 unmodified lines
837835 * (i.e., big-endian), otherwise as 32-bit words in the platform's
838836 * natural endianess.
839837 */
840−static int t4_read_flash(struct adapter *adapter, unsigned int addr,
841− unsigned int nwords, u32 *data, int byte_oriented)
838+int t4_read_flash(struct adapter *adapter, unsigned int addr,
839+ unsigned int nwords, u32 *data, int byte_oriented)
842840 {
843841 int ret;
844842
@@ -854,7 +852,7 @@ static int t4_read_flash(struct adapter *adapter, unsigned int addr, · 9 unmodified lines
854852 for ( ; nwords; nwords--, data++) {
855853 ret = sf1_read(adapter, 4, nwords > 1, nwords == 1, data);
856854 if (nwords == 1)
857− t4_write_reg(adapter, SF_OP, 0); /* unlock SF */
855+ t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */
858856 if (ret)
859857 return ret;
860858 if (byte_oriented)
@@ -902,7 +900,7 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 41 unmodified lines
902900 if (ret)
903901 goto unlock;
904902
905− t4_write_reg(adapter, SF_OP, 0); /* unlock SF */
903+ t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */
906904
907905 /* Read the page to verify the write succeeded */
908906 ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, 1);
@@ -918,7 +916,7 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 9 unmodified lines
918916 return 0;
919917
920918 unlock:
921− t4_write_reg(adapter, SF_OP, 0); /* unlock SF */
919+ t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */
922920 return ret;
923921 }
924922
@@ -950,6 +948,43 @@ int t4_get_tp_version(struct adapter *adapter, u32 *vers) · 25 unmodified lines
950948 1, vers, 0);
951949 }
952950
951+/**
952+ * t4_get_exprom_version - return the Expansion ROM version (if any)
953+ * @adapter: the adapter
954+ * @vers: where to place the version
955+ *
956+ * Reads the Expansion ROM header from FLASH and returns the version
957+ * number (if present) through the @vers return value pointer. We return
958+ * this in the Firmware Version Format since it's convenient. Return
959+ * 0 on success, -ENOENT if no Expansion ROM is present.
960+ */
961+int t4_get_exprom_version(struct adapter *adap, u32 *vers)
962+{
963+ struct exprom_header {
964+ unsigned char hdr_arr[16]; /* must start with 0x55aa */
965+ unsigned char hdr_ver[4]; /* Expansion ROM version */
966+ } *hdr;
967+ u32 exprom_header_buf[DIV_ROUND_UP(sizeof(struct exprom_header),
968+ sizeof(u32))];
969+ int ret;
970+
971+ ret = t4_read_flash(adap, FLASH_EXP_ROM_START,
972+ ARRAY_SIZE(exprom_header_buf), exprom_header_buf,
973+ 0);
974+ if (ret)
975+ return ret;
976+
977+ hdr = (struct exprom_header *)exprom_header_buf;
978+ if (hdr->hdr_arr[0] != 0x55 || hdr->hdr_arr[1] != 0xaa)
979+ return -ENOENT;
980+
981+ *vers = (FW_HDR_FW_VER_MAJOR_V(hdr->hdr_ver[0]) |
982+ FW_HDR_FW_VER_MINOR_V(hdr->hdr_ver[1]) |
983+ FW_HDR_FW_VER_MICRO_V(hdr->hdr_ver[2]) |
984+ FW_HDR_FW_VER_BUILD_V(hdr->hdr_ver[3]));
985+ return 0;
986+}
987+
953988 /* Is the given firmware API compatible with the one the driver was compiled
954989 * with?
955990 */
@@ -1113,7 +1148,7 @@ static int t4_flash_erase_sectors(struct adapter *adapter, int start, int end) · 157 unmodified lines
11131148 }
11141149 start++;
11151150 }
1116− t4_write_reg(adapter, SF_OP, 0); /* unlock SF */
1151+ t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */
11171152 return ret;
11181153 }
11191154
@@ -1241,6 +1276,45 @@ out: · 121 unmodified lines
12411276 return ret;
12421277 }
12431278
1279+/**
1280+ * t4_fwcache - firmware cache operation
1281+ * @adap: the adapter
1282+ * @op : the operation (flush or flush and invalidate)
1283+ */
1284+int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op)
1285+{
1286+ struct fw_params_cmd c;
1287+
1288+ memset(&c, 0, sizeof(c));
1289+ c.op_to_vfn =
1290+ cpu_to_be32(FW_CMD_OP_V(FW_PARAMS_CMD) |
1291+ FW_CMD_REQUEST_F | FW_CMD_WRITE_F |
1292+ FW_PARAMS_CMD_PFN_V(adap->fn) |
1293+ FW_PARAMS_CMD_VFN_V(0));
1294+ c.retval_len16 = cpu_to_be32(FW_LEN16(c));
1295+ c.param[0].mnem =
1296+ cpu_to_be32(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
1297+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWCACHE));
1298+ c.param[0].val = (__force __be32)op;
1299+
1300+ return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL);
1301+}
1302+
1303+void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf)
1304+{
1305+ unsigned int i, j;
1306+
1307+ for (i = 0; i < 8; i++) {
1308+ u32 *p = la_buf + i;
1309+
1310+ t4_write_reg(adap, ULP_RX_LA_CTL_A, i);
1311+ j = t4_read_reg(adap, ULP_RX_LA_WRPTR_A);
1312+ t4_write_reg(adap, ULP_RX_LA_RDPTR_A, j);
1313+ for (j = 0; j < ULPRX_LA_SIZE; j++, p += 8)
1314+ *p = t4_read_reg(adap, ULP_RX_LA_RDDATA_A);
1315+ }
1316+}
1317+
12441318 #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\
12451319 FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \
12461320 FW_PORT_CAP_ANEG)
@@ -1365,95 +1439,97 @@ static int t4_handle_intr_status(struct adapter *adapter, unsigned int reg, · 118 unmodified lines
13651439 static void pcie_intr_handler(struct adapter *adapter)
13661440 {
13671441 static const struct intr_info sysbus_intr_info[] = {
1368− { RNPP, "RXNP array parity error", -1, 1 },
1369− { RPCP, "RXPC array parity error", -1, 1 },
1370− { RCIP, "RXCIF array parity error", -1, 1 },
1371− { RCCP, "Rx completions control array parity error", -1, 1 },
1372− { RFTP, "RXFT array parity error", -1, 1 },
1442+ { RNPP_F, "RXNP array parity error", -1, 1 },
1443+ { RPCP_F, "RXPC array parity error", -1, 1 },
1444+ { RCIP_F, "RXCIF array parity error", -1, 1 },
1445+ { RCCP_F, "Rx completions control array parity error", -1, 1 },
1446+ { RFTP_F, "RXFT array parity error", -1, 1 },
13731447 { 0 }
13741448 };
13751449 static const struct intr_info pcie_port_intr_info[] = {
1376− { TPCP, "TXPC array parity error", -1, 1 },
1377− { TNPP, "TXNP array parity error", -1, 1 },
1378− { TFTP, "TXFT array parity error", -1, 1 },
1379− { TCAP, "TXCA array parity error", -1, 1 },
1380− { TCIP, "TXCIF array parity error", -1, 1 },
1381− { RCAP, "RXCA array parity error", -1, 1 },
1382− { OTDD, "outbound request TLP discarded", -1, 1 },
1383− { RDPE, "Rx data parity error", -1, 1 },
1384− { TDUE, "Tx uncorrectable data error", -1, 1 },
1450+ { TPCP_F, "TXPC array parity error", -1, 1 },
1451+ { TNPP_F, "TXNP array parity error", -1, 1 },
1452+ { TFTP_F, "TXFT array parity error", -1, 1 },
1453+ { TCAP_F, "TXCA array parity error", -1, 1 },
1454+ { TCIP_F, "TXCIF array parity error", -1, 1 },
1455+ { RCAP_F, "RXCA array parity error", -1, 1 },
1456+ { OTDD_F, "outbound request TLP discarded", -1, 1 },
1457+ { RDPE_F, "Rx data parity error", -1, 1 },
1458+ { TDUE_F, "Tx uncorrectable data error", -1, 1 },
13851459 { 0 }
13861460 };
13871461 static const struct intr_info pcie_intr_info[] = {
1388− { MSIADDRLPERR, "MSI AddrL parity error", -1, 1 },
1389− { MSIADDRHPERR, "MSI AddrH parity error", -1, 1 },
1390− { MSIDATAPERR, "MSI data parity error", -1, 1 },
1391− { MSIXADDRLPERR, "MSI-X AddrL parity error", -1, 1 },
1392− { MSIXADDRHPERR, "MSI-X AddrH parity error", -1, 1 },
1393− { MSIXDATAPERR, "MSI-X data parity error", -1, 1 },
1394− { MSIXDIPERR, "MSI-X DI parity error", -1, 1 },
1395− { PIOCPLPERR, "PCI PIO completion FIFO parity error", -1, 1 },
1396− { PIOREQPERR, "PCI PIO request FIFO parity error", -1, 1 },
1397− { TARTAGPERR, "PCI PCI target tag FIFO parity error", -1, 1 },
1398− { CCNTPERR, "PCI CMD channel count parity error", -1, 1 },
1399− { CREQPERR, "PCI CMD channel request parity error", -1, 1 },
1400− { CRSPPERR, "PCI CMD channel response parity error", -1, 1 },
1401− { DCNTPERR, "PCI DMA channel count parity error", -1, 1 },
1402− { DREQPERR, "PCI DMA channel request parity error", -1, 1 },
1403− { DRSPPERR, "PCI DMA channel response parity error", -1, 1 },
1404− { HCNTPERR, "PCI HMA channel count parity error", -1, 1 },
1405− { HREQPERR, "PCI HMA channel request parity error", -1, 1 },
1406− { HRSPPERR, "PCI HMA channel response parity error", -1, 1 },
1407− { CFGSNPPERR, "PCI config snoop FIFO parity error", -1, 1 },
1408− { FIDPERR, "PCI FID parity error", -1, 1 },
1409− { INTXCLRPERR, "PCI INTx clear parity error", -1, 1 },
1410− { MATAGPERR, "PCI MA tag parity error", -1, 1 },
1411− { PIOTAGPERR, "PCI PIO tag parity error", -1, 1 },
1412− { RXCPLPERR, "PCI Rx completion parity error", -1, 1 },
1413− { RXWRPERR, "PCI Rx write parity error", -1, 1 },
1414− { RPLPERR, "PCI replay buffer parity error", -1, 1 },
1415− { PCIESINT, "PCI core secondary fault", -1, 1 },
1416− { PCIEPINT, "PCI core primary fault", -1, 1 },
1417− { UNXSPLCPLERR, "PCI unexpected split completion error", -1, 0 },
1462+ { MSIADDRLPERR_F, "MSI AddrL parity error", -1, 1 },
1463+ { MSIADDRHPERR_F, "MSI AddrH parity error", -1, 1 },
1464+ { MSIDATAPERR_F, "MSI data parity error", -1, 1 },
1465+ { MSIXADDRLPERR_F, "MSI-X AddrL parity error", -1, 1 },
1466+ { MSIXADDRHPERR_F, "MSI-X AddrH parity error", -1, 1 },
1467+ { MSIXDATAPERR_F, "MSI-X data parity error", -1, 1 },
1468+ { MSIXDIPERR_F, "MSI-X DI parity error", -1, 1 },
1469+ { PIOCPLPERR_F, "PCI PIO completion FIFO parity error", -1, 1 },
1470+ { PIOREQPERR_F, "PCI PIO request FIFO parity error", -1, 1 },
1471+ { TARTAGPERR_F, "PCI PCI target tag FIFO parity error", -1, 1 },
1472+ { CCNTPERR_F, "PCI CMD channel count parity error", -1, 1 },
1473+ { CREQPERR_F, "PCI CMD channel request parity error", -1, 1 },
1474+ { CRSPPERR_F, "PCI CMD channel response parity error", -1, 1 },
1475+ { DCNTPERR_F, "PCI DMA channel count parity error", -1, 1 },
1476+ { DREQPERR_F, "PCI DMA channel request parity error", -1, 1 },
1477+ { DRSPPERR_F, "PCI DMA channel response parity error", -1, 1 },
1478+ { HCNTPERR_F, "PCI HMA channel count parity error", -1, 1 },
1479+ { HREQPERR_F, "PCI HMA channel request parity error", -1, 1 },
1480+ { HRSPPERR_F, "PCI HMA channel response parity error", -1, 1 },
1481+ { CFGSNPPERR_F, "PCI config snoop FIFO parity error", -1, 1 },
1482+ { FIDPERR_F, "PCI FID parity error", -1, 1 },
1483+ { INTXCLRPERR_F, "PCI INTx clear parity error", -1, 1 },
1484+ { MATAGPERR_F, "PCI MA tag parity error", -1, 1 },
1485+ { PIOTAGPERR_F, "PCI PIO tag parity error", -1, 1 },
1486+ { RXCPLPERR_F, "PCI Rx completion parity error", -1, 1 },
1487+ { RXWRPERR_F, "PCI Rx write parity error", -1, 1 },
1488+ { RPLPERR_F, "PCI replay buffer parity error", -1, 1 },
1489+ { PCIESINT_F, "PCI core secondary fault", -1, 1 },
1490+ { PCIEPINT_F, "PCI core primary fault", -1, 1 },
1491+ { UNXSPLCPLERR_F, "PCI unexpected split completion error",
1492+ -1, 0 },
14181493 { 0 }
14191494 };
14201495
14211496 static struct intr_info t5_pcie_intr_info[] = {
1422− { MSTGRPPERR, "Master Response Read Queue parity error",
1497+ { MSTGRPPERR_F, "Master Response Read Queue parity error",
14231498 -1, 1 },
1424− { MSTTIMEOUTPERR, "Master Timeout FIFO parity error", -1, 1 },
1425− { MSIXSTIPERR, "MSI-X STI SRAM parity error", -1, 1 },
1426− { MSIXADDRLPERR, "MSI-X AddrL parity error", -1, 1 },
1427− { MSIXADDRHPERR, "MSI-X AddrH parity error", -1, 1 },
1428− { MSIXDATAPERR, "MSI-X data parity error", -1, 1 },
1429− { MSIXDIPERR, "MSI-X DI parity error", -1, 1 },
1430− { PIOCPLGRPPERR, "PCI PIO completion Group FIFO parity error",
1499+ { MSTTIMEOUTPERR_F, "Master Timeout FIFO parity error", -1, 1 },
1500+ { MSIXSTIPERR_F, "MSI-X STI SRAM parity error", -1, 1 },
1501+ { MSIXADDRLPERR_F, "MSI-X AddrL parity error", -1, 1 },
1502+ { MSIXADDRHPERR_F, "MSI-X AddrH parity error", -1, 1 },
1503+ { MSIXDATAPERR_F, "MSI-X data parity error", -1, 1 },
1504+ { MSIXDIPERR_F, "MSI-X DI parity error", -1, 1 },
1505+ { PIOCPLGRPPERR_F, "PCI PIO completion Group FIFO parity error",
14311506 -1, 1 },
1432− { PIOREQGRPPERR, "PCI PIO request Group FIFO parity error",
1507+ { PIOREQGRPPERR_F, "PCI PIO request Group FIFO parity error",
14331508 -1, 1 },
1434− { TARTAGPERR, "PCI PCI target tag FIFO parity error", -1, 1 },
1435− { MSTTAGQPERR, "PCI master tag queue parity error", -1, 1 },
1436− { CREQPERR, "PCI CMD channel request parity error", -1, 1 },
1437− { CRSPPERR, "PCI CMD channel response parity error", -1, 1 },
1438− { DREQWRPERR, "PCI DMA channel write request parity error",
1509+ { TARTAGPERR_F, "PCI PCI target tag FIFO parity error", -1, 1 },
1510+ { MSTTAGQPERR_F, "PCI master tag queue parity error", -1, 1 },
1511+ { CREQPERR_F, "PCI CMD channel request parity error", -1, 1 },
1512+ { CRSPPERR_F, "PCI CMD channel response parity error", -1, 1 },
1513+ { DREQWRPERR_F, "PCI DMA channel write request parity error",
14391514 -1, 1 },
1440− { DREQPERR, "PCI DMA channel request parity error", -1, 1 },
1441− { DRSPPERR, "PCI DMA channel response parity error", -1, 1 },
1442− { HREQWRPERR, "PCI HMA channel count parity error", -1, 1 },
1443− { HREQPERR, "PCI HMA channel request parity error", -1, 1 },
1444− { HRSPPERR, "PCI HMA channel response parity error", -1, 1 },
1445− { CFGSNPPERR, "PCI config snoop FIFO parity error", -1, 1 },
1446− { FIDPERR, "PCI FID parity error", -1, 1 },
1447− { VFIDPERR, "PCI INTx clear parity error", -1, 1 },
1448− { MAGRPPERR, "PCI MA group FIFO parity error", -1, 1 },
1449− { PIOTAGPERR, "PCI PIO tag parity error", -1, 1 },
1450− { IPRXHDRGRPPERR, "PCI IP Rx header group parity error",
1515+ { DREQPERR_F, "PCI DMA channel request parity error", -1, 1 },
1516+ { DRSPPERR_F, "PCI DMA channel response parity error", -1, 1 },
1517+ { HREQWRPERR_F, "PCI HMA channel count parity error", -1, 1 },
1518+ { HREQPERR_F, "PCI HMA channel request parity error", -1, 1 },
1519+ { HRSPPERR_F, "PCI HMA channel response parity error", -1, 1 },
1520+ { CFGSNPPERR_F, "PCI config snoop FIFO parity error", -1, 1 },
1521+ { FIDPERR_F, "PCI FID parity error", -1, 1 },
1522+ { VFIDPERR_F, "PCI INTx clear parity error", -1, 1 },
1523+ { MAGRPPERR_F, "PCI MA group FIFO parity error", -1, 1 },
1524+ { PIOTAGPERR_F, "PCI PIO tag parity error", -1, 1 },
1525+ { IPRXHDRGRPPERR_F, "PCI IP Rx header group parity error",
14511526 -1, 1 },
1452− { IPRXDATAGRPPERR, "PCI IP Rx data group parity error", -1, 1 },
1453− { RPLPERR, "PCI IP replay buffer parity error", -1, 1 },
1454− { IPSOTPERR, "PCI IP SOT buffer parity error", -1, 1 },
1455− { TRGT1GRPPERR, "PCI TRGT1 group FIFOs parity error", -1, 1 },
1456− { READRSPERR, "Outbound read error", -1, 0 },
1527+ { IPRXDATAGRPPERR_F, "PCI IP Rx data group parity error",
1528+ -1, 1 },
1529+ { RPLPERR_F, "PCI IP replay buffer parity error", -1, 1 },
1530+ { IPSOTPERR_F, "PCI IP SOT buffer parity error", -1, 1 },
1531+ { TRGT1GRPPERR_F, "PCI TRGT1 group FIFOs parity error", -1, 1 },
1532+ { READRSPERR_F, "Outbound read error", -1, 0 },
14571533 { 0 }
14581534 };
14591535
@@ -1461,15 +1537,15 @@ static void pcie_intr_handler(struct adapter *adapter) · 1 unmodified line
14611537
14621538 if (is_t4(adapter->params.chip))
14631539 fat = t4_handle_intr_status(adapter,
1464− PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS,
1465− sysbus_intr_info) +
1540+ PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS_A,
1541+ sysbus_intr_info) +
14661542 t4_handle_intr_status(adapter,
1467− PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS,
1468− pcie_port_intr_info) +
1469− t4_handle_intr_status(adapter, PCIE_INT_CAUSE,
1543+ PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS_A,
1544+ pcie_port_intr_info) +
1545+ t4_handle_intr_status(adapter, PCIE_INT_CAUSE_A,
14701546 pcie_intr_info);
14711547 else
1472− fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE,
1548+ fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE_A,
14731549 t5_pcie_intr_info);
14741550
14751551 if (fat)
@@ -1483,11 +1559,11 @@ static void tp_intr_handler(struct adapter *adapter) · 7 unmodified lines
14831559 {
14841560 static const struct intr_info tp_intr_info[] = {
14851561 { 0x3fffffff, "TP parity error", -1, 1 },
1486− { FLMTXFLSTEMPTY, "TP out of Tx pages", -1, 1 },
1562+ { FLMTXFLSTEMPTY_F, "TP out of Tx pages", -1, 1 },
14871563 { 0 }
14881564 };
14891565
1490− if (t4_handle_intr_status(adapter, TP_INT_CAUSE, tp_intr_info))
1566+ if (t4_handle_intr_status(adapter, TP_INT_CAUSE_A, tp_intr_info))
14911567 t4_fatal_err(adapter);
14921568 }
14931569
@@ -1499,102 +1575,107 @@ static void sge_intr_handler(struct adapter *adapter) · 5 unmodified lines
14991575 u64 v;
15001576
15011577 static const struct intr_info sge_intr_info[] = {
1502− { ERR_CPL_EXCEED_IQE_SIZE,
1578+ { ERR_CPL_EXCEED_IQE_SIZE_F,
15031579 "SGE received CPL exceeding IQE size", -1, 1 },
1504− { ERR_INVALID_CIDX_INC,
1580+ { ERR_INVALID_CIDX_INC_F,
15051581 "SGE GTS CIDX increment too large", -1, 0 },
1506− { ERR_CPL_OPCODE_0, "SGE received 0-length CPL", -1, 0 },
1507− { DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },
1508− { DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },
1509− { ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },
1510− { ERR_DATA_CPL_ON_HIGH_QID1 | ERR_DATA_CPL_ON_HIGH_QID0,
1582+ { ERR_CPL_OPCODE_0_F, "SGE received 0-length CPL", -1, 0 },
1583+ { DBFIFO_LP_INT_F, NULL, -1, 0, t4_db_full },
1584+ { DBFIFO_HP_INT_F, NULL, -1, 0, t4_db_full },
1585+ { ERR_DROPPED_DB_F, NULL, -1, 0, t4_db_dropped },
1586+ { ERR_DATA_CPL_ON_HIGH_QID1_F | ERR_DATA_CPL_ON_HIGH_QID0_F,
15111587 "SGE IQID > 1023 received CPL for FL", -1, 0 },
1512− { ERR_BAD_DB_PIDX3, "SGE DBP 3 pidx increment too large", -1,
1588+ { ERR_BAD_DB_PIDX3_F, "SGE DBP 3 pidx increment too large", -1,
15131589 0 },
1514− { ERR_BAD_DB_PIDX2, "SGE DBP 2 pidx increment too large", -1,
1590+ { ERR_BAD_DB_PIDX2_F, "SGE DBP 2 pidx increment too large", -1,
15151591 0 },
1516− { ERR_BAD_DB_PIDX1, "SGE DBP 1 pidx increment too large", -1,
1592+ { ERR_BAD_DB_PIDX1_F, "SGE DBP 1 pidx increment too large", -1,
15171593 0 },
1518− { ERR_BAD_DB_PIDX0, "SGE DBP 0 pidx increment too large", -1,
1594+ { ERR_BAD_DB_PIDX0_F, "SGE DBP 0 pidx increment too large", -1,
15191595 0 },
1520− { ERR_ING_CTXT_PRIO,
1596+ { ERR_ING_CTXT_PRIO_F,
15211597 "SGE too many priority ingress contexts", -1, 0 },
1522− { ERR_EGR_CTXT_PRIO,
1598+ { ERR_EGR_CTXT_PRIO_F,
15231599 "SGE too many priority egress contexts", -1, 0 },
1524− { INGRESS_SIZE_ERR, "SGE illegal ingress QID", -1, 0 },
1525− { EGRESS_SIZE_ERR, "SGE illegal egress QID", -1, 0 },
1600+ { INGRESS_SIZE_ERR_F, "SGE illegal ingress QID", -1, 0 },
1601+ { EGRESS_SIZE_ERR_F, "SGE illegal egress QID", -1, 0 },
15261602 { 0 }
15271603 };
15281604
1529− v = (u64)t4_read_reg(adapter, SGE_INT_CAUSE1) |
1530− ((u64)t4_read_reg(adapter, SGE_INT_CAUSE2) << 32);
1605+ v = (u64)t4_read_reg(adapter, SGE_INT_CAUSE1_A) |
1606+ ((u64)t4_read_reg(adapter, SGE_INT_CAUSE2_A) << 32);
15311607 if (v) {
15321608 dev_alert(adapter->pdev_dev, "SGE parity error (%#llx)\n",
15331609 (unsigned long long)v);
1534− t4_write_reg(adapter, SGE_INT_CAUSE1, v);
1535− t4_write_reg(adapter, SGE_INT_CAUSE2, v >> 32);
1610+ t4_write_reg(adapter, SGE_INT_CAUSE1_A, v);
1611+ t4_write_reg(adapter, SGE_INT_CAUSE2_A, v >> 32);
15361612 }
15371613
1538− if (t4_handle_intr_status(adapter, SGE_INT_CAUSE3, sge_intr_info) ||
1614+ if (t4_handle_intr_status(adapter, SGE_INT_CAUSE3_A, sge_intr_info) ||
15391615 v != 0)
15401616 t4_fatal_err(adapter);
15411617 }
15421618
1619+#define CIM_OBQ_INTR (OBQULP0PARERR_F | OBQULP1PARERR_F | OBQULP2PARERR_F |\
1620+ OBQULP3PARERR_F | OBQSGEPARERR_F | OBQNCSIPARERR_F)
1621+#define CIM_IBQ_INTR (IBQTP0PARERR_F | IBQTP1PARERR_F | IBQULPPARERR_F |\
1622+ IBQSGEHIPARERR_F | IBQSGELOPARERR_F | IBQNCSIPARERR_F)
1623+
15431624 /*
15441625 * CIM interrupt handler.
15451626 */
15461627 static void cim_intr_handler(struct adapter *adapter)
15471628 {
15481629 static const struct intr_info cim_intr_info[] = {
1549− { PREFDROPINT, "CIM control register prefetch drop", -1, 1 },
1550− { OBQPARERR, "CIM OBQ parity error", -1, 1 },
1551− { IBQPARERR, "CIM IBQ parity error", -1, 1 },
1552− { MBUPPARERR, "CIM mailbox uP parity error", -1, 1 },
1553− { MBHOSTPARERR, "CIM mailbox host parity error", -1, 1 },
1554− { TIEQINPARERRINT, "CIM TIEQ outgoing parity error", -1, 1 },
1555− { TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 },
1630+ { PREFDROPINT_F, "CIM control register prefetch drop", -1, 1 },
1631+ { CIM_OBQ_INTR, "CIM OBQ parity error", -1, 1 },
1632+ { CIM_IBQ_INTR, "CIM IBQ parity error", -1, 1 },
1633+ { MBUPPARERR_F, "CIM mailbox uP parity error", -1, 1 },
1634+ { MBHOSTPARERR_F, "CIM mailbox host parity error", -1, 1 },
1635+ { TIEQINPARERRINT_F, "CIM TIEQ outgoing parity error", -1, 1 },
1636+ { TIEQOUTPARERRINT_F, "CIM TIEQ incoming parity error", -1, 1 },
15561637 { 0 }
15571638 };
15581639 static const struct intr_info cim_upintr_info[] = {
1559− { RSVDSPACEINT, "CIM reserved space access", -1, 1 },
1560− { ILLTRANSINT, "CIM illegal transaction", -1, 1 },
1561− { ILLWRINT, "CIM illegal write", -1, 1 },
1562− { ILLRDINT, "CIM illegal read", -1, 1 },
1563− { ILLRDBEINT, "CIM illegal read BE", -1, 1 },
1564− { ILLWRBEINT, "CIM illegal write BE", -1, 1 },
1565− { SGLRDBOOTINT, "CIM single read from boot space", -1, 1 },
1566− { SGLWRBOOTINT, "CIM single write to boot space", -1, 1 },
1567− { BLKWRBOOTINT, "CIM block write to boot space", -1, 1 },
1568− { SGLRDFLASHINT, "CIM single read from flash space", -1, 1 },
1569− { SGLWRFLASHINT, "CIM single write to flash space", -1, 1 },
1570− { BLKWRFLASHINT, "CIM block write to flash space", -1, 1 },
1571− { SGLRDEEPROMINT, "CIM single EEPROM read", -1, 1 },
1572− { SGLWREEPROMINT, "CIM single EEPROM write", -1, 1 },
1573− { BLKRDEEPROMINT, "CIM block EEPROM read", -1, 1 },
1574− { BLKWREEPROMINT, "CIM block EEPROM write", -1, 1 },
1575− { SGLRDCTLINT , "CIM single read from CTL space", -1, 1 },
1576− { SGLWRCTLINT , "CIM single write to CTL space", -1, 1 },
1577− { BLKRDCTLINT , "CIM block read from CTL space", -1, 1 },
1578− { BLKWRCTLINT , "CIM block write to CTL space", -1, 1 },
1579− { SGLRDPLINT , "CIM single read from PL space", -1, 1 },
1580− { SGLWRPLINT , "CIM single write to PL space", -1, 1 },
1581− { BLKRDPLINT , "CIM block read from PL space", -1, 1 },
1582− { BLKWRPLINT , "CIM block write to PL space", -1, 1 },
1583− { REQOVRLOOKUPINT , "CIM request FIFO overwrite", -1, 1 },
1584− { RSPOVRLOOKUPINT , "CIM response FIFO overwrite", -1, 1 },
1585− { TIMEOUTINT , "CIM PIF timeout", -1, 1 },
1586− { TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 },
1640+ { RSVDSPACEINT_F, "CIM reserved space access", -1, 1 },
1641+ { ILLTRANSINT_F, "CIM illegal transaction", -1, 1 },
1642+ { ILLWRINT_F, "CIM illegal write", -1, 1 },
1643+ { ILLRDINT_F, "CIM illegal read", -1, 1 },
1644+ { ILLRDBEINT_F, "CIM illegal read BE", -1, 1 },
1645+ { ILLWRBEINT_F, "CIM illegal write BE", -1, 1 },
1646+ { SGLRDBOOTINT_F, "CIM single read from boot space", -1, 1 },
1647+ { SGLWRBOOTINT_F, "CIM single write to boot space", -1, 1 },
1648+ { BLKWRBOOTINT_F, "CIM block write to boot space", -1, 1 },
1649+ { SGLRDFLASHINT_F, "CIM single read from flash space", -1, 1 },
1650+ { SGLWRFLASHINT_F, "CIM single write to flash space", -1, 1 },
1651+ { BLKWRFLASHINT_F, "CIM block write to flash space", -1, 1 },
1652+ { SGLRDEEPROMINT_F, "CIM single EEPROM read", -1, 1 },
1653+ { SGLWREEPROMINT_F, "CIM single EEPROM write", -1, 1 },
1654+ { BLKRDEEPROMINT_F, "CIM block EEPROM read", -1, 1 },
1655+ { BLKWREEPROMINT_F, "CIM block EEPROM write", -1, 1 },
1656+ { SGLRDCTLINT_F, "CIM single read from CTL space", -1, 1 },
1657+ { SGLWRCTLINT_F, "CIM single write to CTL space", -1, 1 },
1658+ { BLKRDCTLINT_F, "CIM block read from CTL space", -1, 1 },
1659+ { BLKWRCTLINT_F, "CIM block write to CTL space", -1, 1 },
1660+ { SGLRDPLINT_F, "CIM single read from PL space", -1, 1 },
1661+ { SGLWRPLINT_F, "CIM single write to PL space", -1, 1 },
1662+ { BLKRDPLINT_F, "CIM block read from PL space", -1, 1 },
1663+ { BLKWRPLINT_F, "CIM block write to PL space", -1, 1 },
1664+ { REQOVRLOOKUPINT_F, "CIM request FIFO overwrite", -1, 1 },
1665+ { RSPOVRLOOKUPINT_F, "CIM response FIFO overwrite", -1, 1 },
1666+ { TIMEOUTINT_F, "CIM PIF timeout", -1, 1 },
1667+ { TIMEOUTMAINT_F, "CIM PIF MA timeout", -1, 1 },
15871668 { 0 }
15881669 };
15891670
15901671 int fat;
15911672
1592− if (t4_read_reg(adapter, MA_PCIE_FW) & PCIE_FW_ERR)
1673+ if (t4_read_reg(adapter, PCIE_FW_A) & PCIE_FW_ERR_F)
15931674 t4_report_fw_error(adapter);
15941675
1595− fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE,
1676+ fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE_A,
15961677 cim_intr_info) +
1597− t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE,
1678+ t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE_A,
15981679 cim_upintr_info);
15991680 if (fat)
16001681 t4_fatal_err(adapter);
@@ -1611,7 +1692,7 @@ static void ulprx_intr_handler(struct adapter *adapter) · 10 unmodified lines
16111692 { 0 }
16121693 };
16131694
1614− if (t4_handle_intr_status(adapter, ULP_RX_INT_CAUSE, ulprx_intr_info))
1695+ if (t4_handle_intr_status(adapter, ULP_RX_INT_CAUSE_A, ulprx_intr_info))
16151696 t4_fatal_err(adapter);
16161697 }
16171698
@@ -1621,19 +1702,19 @@ static void ulprx_intr_handler(struct adapter *adapter) · 3 unmodified lines
16211702 static void ulptx_intr_handler(struct adapter *adapter)
16221703 {
16231704 static const struct intr_info ulptx_intr_info[] = {
1624− { PBL_BOUND_ERR_CH3, "ULPTX channel 3 PBL out of bounds", -1,
1705+ { PBL_BOUND_ERR_CH3_F, "ULPTX channel 3 PBL out of bounds", -1,
16251706 0 },
1626− { PBL_BOUND_ERR_CH2, "ULPTX channel 2 PBL out of bounds", -1,
1707+ { PBL_BOUND_ERR_CH2_F, "ULPTX channel 2 PBL out of bounds", -1,
16271708 0 },
1628− { PBL_BOUND_ERR_CH1, "ULPTX channel 1 PBL out of bounds", -1,
1709+ { PBL_BOUND_ERR_CH1_F, "ULPTX channel 1 PBL out of bounds", -1,
16291710 0 },
1630− { PBL_BOUND_ERR_CH0, "ULPTX channel 0 PBL out of bounds", -1,
1711+ { PBL_BOUND_ERR_CH0_F, "ULPTX channel 0 PBL out of bounds", -1,
16311712 0 },
16321713 { 0xfffffff, "ULPTX parity error", -1, 1 },
16331714 { 0 }
16341715 };
16351716
1636− if (t4_handle_intr_status(adapter, ULP_TX_INT_CAUSE, ulptx_intr_info))
1717+ if (t4_handle_intr_status(adapter, ULP_TX_INT_CAUSE_A, ulptx_intr_info))
16371718 t4_fatal_err(adapter);
16381719 }
16391720
@@ -1643,19 +1724,20 @@ static void ulptx_intr_handler(struct adapter *adapter) · 3 unmodified lines
16431724 static void pmtx_intr_handler(struct adapter *adapter)
16441725 {
16451726 static const struct intr_info pmtx_intr_info[] = {
1646− { PCMD_LEN_OVFL0, "PMTX channel 0 pcmd too large", -1, 1 },
1647− { PCMD_LEN_OVFL1, "PMTX channel 1 pcmd too large", -1, 1 },
1648− { PCMD_LEN_OVFL2, "PMTX channel 2 pcmd too large", -1, 1 },
1649− { ZERO_C_CMD_ERROR, "PMTX 0-length pcmd", -1, 1 },
1650− { PMTX_FRAMING_ERROR, "PMTX framing error", -1, 1 },
1651− { OESPI_PAR_ERROR, "PMTX oespi parity error", -1, 1 },
1652− { DB_OPTIONS_PAR_ERROR, "PMTX db_options parity error", -1, 1 },
1653− { ICSPI_PAR_ERROR, "PMTX icspi parity error", -1, 1 },
1654− { C_PCMD_PAR_ERROR, "PMTX c_pcmd parity error", -1, 1},
1727+ { PCMD_LEN_OVFL0_F, "PMTX channel 0 pcmd too large", -1, 1 },
1728+ { PCMD_LEN_OVFL1_F, "PMTX channel 1 pcmd too large", -1, 1 },
1729+ { PCMD_LEN_OVFL2_F, "PMTX channel 2 pcmd too large", -1, 1 },
1730+ { ZERO_C_CMD_ERROR_F, "PMTX 0-length pcmd", -1, 1 },
1731+ { PMTX_FRAMING_ERROR_F, "PMTX framing error", -1, 1 },
1732+ { OESPI_PAR_ERROR_F, "PMTX oespi parity error", -1, 1 },
1733+ { DB_OPTIONS_PAR_ERROR_F, "PMTX db_options parity error",
1734+ -1, 1 },
1735+ { ICSPI_PAR_ERROR_F, "PMTX icspi parity error", -1, 1 },
1736+ { PMTX_C_PCMD_PAR_ERROR_F, "PMTX c_pcmd parity error", -1, 1},
16551737 { 0 }
16561738 };
16571739
1658− if (t4_handle_intr_status(adapter, PM_TX_INT_CAUSE, pmtx_intr_info))
1740+ if (t4_handle_intr_status(adapter, PM_TX_INT_CAUSE_A, pmtx_intr_info))
16591741 t4_fatal_err(adapter);
16601742 }
16611743
@@ -1665,16 +1747,17 @@ static void pmtx_intr_handler(struct adapter *adapter) · 3 unmodified lines
16651747 static void pmrx_intr_handler(struct adapter *adapter)
16661748 {
16671749 static const struct intr_info pmrx_intr_info[] = {
1668− { ZERO_E_CMD_ERROR, "PMRX 0-length pcmd", -1, 1 },
1669− { PMRX_FRAMING_ERROR, "PMRX framing error", -1, 1 },
1670− { OCSPI_PAR_ERROR, "PMRX ocspi parity error", -1, 1 },
1671− { DB_OPTIONS_PAR_ERROR, "PMRX db_options parity error", -1, 1 },
1672− { IESPI_PAR_ERROR, "PMRX iespi parity error", -1, 1 },
1673− { E_PCMD_PAR_ERROR, "PMRX e_pcmd parity error", -1, 1},
1750+ { ZERO_E_CMD_ERROR_F, "PMRX 0-length pcmd", -1, 1 },
1751+ { PMRX_FRAMING_ERROR_F, "PMRX framing error", -1, 1 },
1752+ { OCSPI_PAR_ERROR_F, "PMRX ocspi parity error", -1, 1 },
1753+ { DB_OPTIONS_PAR_ERROR_F, "PMRX db_options parity error",
1754+ -1, 1 },
1755+ { IESPI_PAR_ERROR_F, "PMRX iespi parity error", -1, 1 },
1756+ { PMRX_E_PCMD_PAR_ERROR_F, "PMRX e_pcmd parity error", -1, 1},
16741757 { 0 }
16751758 };
16761759
1677− if (t4_handle_intr_status(adapter, PM_RX_INT_CAUSE, pmrx_intr_info))
1760+ if (t4_handle_intr_status(adapter, PM_RX_INT_CAUSE_A, pmrx_intr_info))
16781761 t4_fatal_err(adapter);
16791762 }
16801763
@@ -1684,16 +1767,16 @@ static void pmrx_intr_handler(struct adapter *adapter) · 3 unmodified lines
16841767 static void cplsw_intr_handler(struct adapter *adapter)
16851768 {
16861769 static const struct intr_info cplsw_intr_info[] = {
1687− { CIM_OP_MAP_PERR, "CPLSW CIM op_map parity error", -1, 1 },
1688− { CIM_OVFL_ERROR, "CPLSW CIM overflow", -1, 1 },
1689− { TP_FRAMING_ERROR, "CPLSW TP framing error", -1, 1 },
1690− { SGE_FRAMING_ERROR, "CPLSW SGE framing error", -1, 1 },
1691− { CIM_FRAMING_ERROR, "CPLSW CIM framing error", -1, 1 },
1692− { ZERO_SWITCH_ERROR, "CPLSW no-switch error", -1, 1 },
1770+ { CIM_OP_MAP_PERR_F, "CPLSW CIM op_map parity error", -1, 1 },
1771+ { CIM_OVFL_ERROR_F, "CPLSW CIM overflow", -1, 1 },
1772+ { TP_FRAMING_ERROR_F, "CPLSW TP framing error", -1, 1 },
1773+ { SGE_FRAMING_ERROR_F, "CPLSW SGE framing error", -1, 1 },
1774+ { CIM_FRAMING_ERROR_F, "CPLSW CIM framing error", -1, 1 },
1775+ { ZERO_SWITCH_ERROR_F, "CPLSW no-switch error", -1, 1 },
16931776 { 0 }
16941777 };
16951778
1696− if (t4_handle_intr_status(adapter, CPL_INTR_CAUSE, cplsw_intr_info))
1779+ if (t4_handle_intr_status(adapter, CPL_INTR_CAUSE_A, cplsw_intr_info))
16971780 t4_fatal_err(adapter);
16981781 }
16991782
@@ -1703,15 +1786,15 @@ static void cplsw_intr_handler(struct adapter *adapter) · 3 unmodified lines
17031786 static void le_intr_handler(struct adapter *adap)
17041787 {
17051788 static const struct intr_info le_intr_info[] = {
1706− { LIPMISS, "LE LIP miss", -1, 0 },
1707− { LIP0, "LE 0 LIP error", -1, 0 },
1708− { PARITYERR, "LE parity error", -1, 1 },
1709− { UNKNOWNCMD, "LE unknown command", -1, 1 },
1710− { REQQPARERR, "LE request queue parity error", -1, 1 },
1789+ { LIPMISS_F, "LE LIP miss", -1, 0 },
1790+ { LIP0_F, "LE 0 LIP error", -1, 0 },
1791+ { PARITYERR_F, "LE parity error", -1, 1 },
1792+ { UNKNOWNCMD_F, "LE unknown command", -1, 1 },
1793+ { REQQPARERR_F, "LE request queue parity error", -1, 1 },
17111794 { 0 }
17121795 };
17131796
1714− if (t4_handle_intr_status(adap, LE_DB_INT_CAUSE, le_intr_info))
1797+ if (t4_handle_intr_status(adap, LE_DB_INT_CAUSE_A, le_intr_info))
17151798 t4_fatal_err(adap);
17161799 }
17171800
@@ -1725,19 +1808,22 @@ static void mps_intr_handler(struct adapter *adapter) · 7 unmodified lines
17251808 { 0 }
17261809 };
17271810 static const struct intr_info mps_tx_intr_info[] = {
1728− { TPFIFO, "MPS Tx TP FIFO parity error", -1, 1 },
1729− { NCSIFIFO, "MPS Tx NC-SI FIFO parity error", -1, 1 },
1730− { TXDATAFIFO, "MPS Tx data FIFO parity error", -1, 1 },
1731− { TXDESCFIFO, "MPS Tx desc FIFO parity error", -1, 1 },
1732− { BUBBLE, "MPS Tx underflow", -1, 1 },
1733− { SECNTERR, "MPS Tx SOP/EOP error", -1, 1 },
1734− { FRMERR, "MPS Tx framing error", -1, 1 },
1811+ { TPFIFO_V(TPFIFO_M), "MPS Tx TP FIFO parity error", -1, 1 },
1812+ { NCSIFIFO_F, "MPS Tx NC-SI FIFO parity error", -1, 1 },
1813+ { TXDATAFIFO_V(TXDATAFIFO_M), "MPS Tx data FIFO parity error",
1814+ -1, 1 },
1815+ { TXDESCFIFO_V(TXDESCFIFO_M), "MPS Tx desc FIFO parity error",
1816+ -1, 1 },
1817+ { BUBBLE_F, "MPS Tx underflow", -1, 1 },
1818+ { SECNTERR_F, "MPS Tx SOP/EOP error", -1, 1 },
1819+ { FRMERR_F, "MPS Tx framing error", -1, 1 },
17351820 { 0 }
17361821 };
17371822 static const struct intr_info mps_trc_intr_info[] = {
1738− { FILTMEM, "MPS TRC filter parity error", -1, 1 },
1739− { PKTFIFO, "MPS TRC packet FIFO parity error", -1, 1 },
1740− { MISCPERR, "MPS TRC misc parity error", -1, 1 },
1823+ { FILTMEM_V(FILTMEM_M), "MPS TRC filter parity error", -1, 1 },
1824+ { PKTFIFO_V(PKTFIFO_M), "MPS TRC packet FIFO parity error",
1825+ -1, 1 },
1826+ { MISCPERR_F, "MPS TRC misc parity error", -1, 1 },
17411827 { 0 }
17421828 };
17431829 static const struct intr_info mps_stat_sram_intr_info[] = {
@@ -1753,37 +1839,37 @@ static void mps_intr_handler(struct adapter *adapter) · 9 unmodified lines
17531839 { 0 }
17541840 };
17551841 static const struct intr_info mps_cls_intr_info[] = {
1756− { MATCHSRAM, "MPS match SRAM parity error", -1, 1 },
1757− { MATCHTCAM, "MPS match TCAM parity error", -1, 1 },
1758− { HASHSRAM, "MPS hash SRAM parity error", -1, 1 },
1842+ { MATCHSRAM_F, "MPS match SRAM parity error", -1, 1 },
1843+ { MATCHTCAM_F, "MPS match TCAM parity error", -1, 1 },
1844+ { HASHSRAM_F, "MPS hash SRAM parity error", -1, 1 },
17591845 { 0 }
17601846 };
17611847
17621848 int fat;
17631849
1764− fat = t4_handle_intr_status(adapter, MPS_RX_PERR_INT_CAUSE,
1850+ fat = t4_handle_intr_status(adapter, MPS_RX_PERR_INT_CAUSE_A,
17651851 mps_rx_intr_info) +
1766− t4_handle_intr_status(adapter, MPS_TX_INT_CAUSE,
1852+ t4_handle_intr_status(adapter, MPS_TX_INT_CAUSE_A,
17671853 mps_tx_intr_info) +
1768− t4_handle_intr_status(adapter, MPS_TRC_INT_CAUSE,
1854+ t4_handle_intr_status(adapter, MPS_TRC_INT_CAUSE_A,
17691855 mps_trc_intr_info) +
1770− t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_SRAM,
1856+ t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_SRAM_A,
17711857 mps_stat_sram_intr_info) +
1772− t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_TX_FIFO,
1858+ t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_TX_FIFO_A,
17731859 mps_stat_tx_intr_info) +
1774− t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_RX_FIFO,
1860+ t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_RX_FIFO_A,
17751861 mps_stat_rx_intr_info) +
1776− t4_handle_intr_status(adapter, MPS_CLS_INT_CAUSE,
1862+ t4_handle_intr_status(adapter, MPS_CLS_INT_CAUSE_A,
17771863 mps_cls_intr_info);
17781864
1779− t4_write_reg(adapter, MPS_INT_CAUSE, CLSINT | TRCINT |
1780− RXINT | TXINT | STATINT);
1781− t4_read_reg(adapter, MPS_INT_CAUSE); /* flush */
1865+ t4_write_reg(adapter, MPS_INT_CAUSE_A, 0);
1866+ t4_read_reg(adapter, MPS_INT_CAUSE_A); /* flush */
17821867 if (fat)
17831868 t4_fatal_err(adapter);
17841869 }
17851870
1786−#define MEM_INT_MASK (PERR_INT_CAUSE | ECC_CE_INT_CAUSE | ECC_UE_INT_CAUSE)
1871+#define MEM_INT_MASK (PERR_INT_CAUSE_F | ECC_CE_INT_CAUSE_F | \
1872+ ECC_UE_INT_CAUSE_F)
17871873
17881874 /*
17891875 * EDC/MC interrupt handler.
@@ -1795,40 +1881,40 @@ static void mem_intr_handler(struct adapter *adapter, int idx) · 5 unmodified lines
17951881 unsigned int addr, cnt_addr, v;
17961882
17971883 if (idx <= MEM_EDC1) {
1798− addr = EDC_REG(EDC_INT_CAUSE, idx);
1799− cnt_addr = EDC_REG(EDC_ECC_STATUS, idx);
1884+ addr = EDC_REG(EDC_INT_CAUSE_A, idx);
1885+ cnt_addr = EDC_REG(EDC_ECC_STATUS_A, idx);
18001886 } else if (idx == MEM_MC) {
18011887 if (is_t4(adapter->params.chip)) {
1802− addr = MC_INT_CAUSE;
1803− cnt_addr = MC_ECC_STATUS;
1888+ addr = MC_INT_CAUSE_A;
1889+ cnt_addr = MC_ECC_STATUS_A;
18041890 } else {
1805− addr = MC_P_INT_CAUSE;
1806− cnt_addr = MC_P_ECC_STATUS;
1891+ addr = MC_P_INT_CAUSE_A;
1892+ cnt_addr = MC_P_ECC_STATUS_A;
18071893 }
18081894 } else {
1809− addr = MC_REG(MC_P_INT_CAUSE, 1);
1810− cnt_addr = MC_REG(MC_P_ECC_STATUS, 1);
1895+ addr = MC_REG(MC_P_INT_CAUSE_A, 1);
1896+ cnt_addr = MC_REG(MC_P_ECC_STATUS_A, 1);
18111897 }
18121898
18131899 v = t4_read_reg(adapter, addr) & MEM_INT_MASK;
1814− if (v & PERR_INT_CAUSE)
1900+ if (v & PERR_INT_CAUSE_F)
18151901 dev_alert(adapter->pdev_dev, "%s FIFO parity error\n",
18161902 name[idx]);
1817− if (v & ECC_CE_INT_CAUSE) {
1818− u32 cnt = ECC_CECNT_GET(t4_read_reg(adapter, cnt_addr));
1903+ if (v & ECC_CE_INT_CAUSE_F) {
1904+ u32 cnt = ECC_CECNT_G(t4_read_reg(adapter, cnt_addr));
18191905
1820− t4_write_reg(adapter, cnt_addr, ECC_CECNT_MASK);
1906+ t4_write_reg(adapter, cnt_addr, ECC_CECNT_V(ECC_CECNT_M));
18211907 if (printk_ratelimit())
18221908 dev_warn(adapter->pdev_dev,
18231909 "%u %s correctable ECC data error%s\n",
18241910 cnt, name[idx], cnt > 1 ? "s" : "");
18251911 }
1826− if (v & ECC_UE_INT_CAUSE)
1912+ if (v & ECC_UE_INT_CAUSE_F)
18271913 dev_alert(adapter->pdev_dev,
18281914 "%s uncorrectable ECC data error\n", name[idx]);
18291915
18301916 t4_write_reg(adapter, addr, v);
1831− if (v & (PERR_INT_CAUSE | ECC_UE_INT_CAUSE))
1917+ if (v & (PERR_INT_CAUSE_F | ECC_UE_INT_CAUSE_F))
18321918 t4_fatal_err(adapter);
18331919 }
18341920
@@ -1837,26 +1923,26 @@ static void mem_intr_handler(struct adapter *adapter, int idx) · 2 unmodified lines
18371923 */
18381924 static void ma_intr_handler(struct adapter *adap)
18391925 {
1840− u32 v, status = t4_read_reg(adap, MA_INT_CAUSE);
1926+ u32 v, status = t4_read_reg(adap, MA_INT_CAUSE_A);
18411927
1842− if (status & MEM_PERR_INT_CAUSE) {
1928+ if (status & MEM_PERR_INT_CAUSE_F) {
18431929 dev_alert(adap->pdev_dev,
18441930 "MA parity error, parity status %#x\n",
1845− t4_read_reg(adap, MA_PARITY_ERROR_STATUS));
1931+ t4_read_reg(adap, MA_PARITY_ERROR_STATUS1_A));
18461932 if (is_t5(adap->params.chip))
18471933 dev_alert(adap->pdev_dev,
18481934 "MA parity error, parity status %#x\n",
18491935 t4_read_reg(adap,
1850− MA_PARITY_ERROR_STATUS2));
1936+ MA_PARITY_ERROR_STATUS2_A));
18511937 }
1852− if (status & MEM_WRAP_INT_CAUSE) {
1853− v = t4_read_reg(adap, MA_INT_WRAP_STATUS);
1938+ if (status & MEM_WRAP_INT_CAUSE_F) {
1939+ v = t4_read_reg(adap, MA_INT_WRAP_STATUS_A);
18541940 dev_alert(adap->pdev_dev, "MA address wrap-around error by "
18551941 "client %u to address %#x\n",
1856− MEM_WRAP_CLIENT_NUM_GET(v),
1857− MEM_WRAP_ADDRESS_GET(v) << 4);
1942+ MEM_WRAP_CLIENT_NUM_G(v),
1943+ MEM_WRAP_ADDRESS_G(v) << 4);
18581944 }
1859− t4_write_reg(adap, MA_INT_CAUSE, status);
1945+ t4_write_reg(adap, MA_INT_CAUSE_A, status);
18601946 t4_fatal_err(adap);
18611947 }
18621948
@@ -1866,13 +1952,13 @@ static void ma_intr_handler(struct adapter *adap) · 3 unmodified lines
18661952 static void smb_intr_handler(struct adapter *adap)
18671953 {
18681954 static const struct intr_info smb_intr_info[] = {
1869− { MSTTXFIFOPARINT, "SMB master Tx FIFO parity error", -1, 1 },
1870− { MSTRXFIFOPARINT, "SMB master Rx FIFO parity error", -1, 1 },
1871− { SLVFIFOPARINT, "SMB slave FIFO parity error", -1, 1 },
1955+ { MSTTXFIFOPARINT_F, "SMB master Tx FIFO parity error", -1, 1 },
1956+ { MSTRXFIFOPARINT_F, "SMB master Rx FIFO parity error", -1, 1 },
1957+ { SLVFIFOPARINT_F, "SMB slave FIFO parity error", -1, 1 },
18721958 { 0 }
18731959 };
18741960
1875− if (t4_handle_intr_status(adap, SMB_INT_CAUSE, smb_intr_info))
1961+ if (t4_handle_intr_status(adap, SMB_INT_CAUSE_A, smb_intr_info))
18761962 t4_fatal_err(adap);
18771963 }
18781964
@@ -1882,14 +1968,14 @@ static void smb_intr_handler(struct adapter *adap) · 3 unmodified lines
18821968 static void ncsi_intr_handler(struct adapter *adap)
18831969 {
18841970 static const struct intr_info ncsi_intr_info[] = {
1885− { CIM_DM_PRTY_ERR, "NC-SI CIM parity error", -1, 1 },
1886− { MPS_DM_PRTY_ERR, "NC-SI MPS parity error", -1, 1 },
1887− { TXFIFO_PRTY_ERR, "NC-SI Tx FIFO parity error", -1, 1 },
1888− { RXFIFO_PRTY_ERR, "NC-SI Rx FIFO parity error", -1, 1 },
1971+ { CIM_DM_PRTY_ERR_F, "NC-SI CIM parity error", -1, 1 },
1972+ { MPS_DM_PRTY_ERR_F, "NC-SI MPS parity error", -1, 1 },
1973+ { TXFIFO_PRTY_ERR_F, "NC-SI Tx FIFO parity error", -1, 1 },
1974+ { RXFIFO_PRTY_ERR_F, "NC-SI Rx FIFO parity error", -1, 1 },
18891975 { 0 }
18901976 };
18911977
1892− if (t4_handle_intr_status(adap, NCSI_INT_CAUSE, ncsi_intr_info))
1978+ if (t4_handle_intr_status(adap, NCSI_INT_CAUSE_A, ncsi_intr_info))
18931979 t4_fatal_err(adap);
18941980 }
18951981
@@ -1901,23 +1987,23 @@ static void xgmac_intr_handler(struct adapter *adap, int port) · 5 unmodified lines
19011987 u32 v, int_cause_reg;
19021988
19031989 if (is_t4(adap->params.chip))
1904− int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE);
1990+ int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE_A);
19051991 else
1906− int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE);
1992+ int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE_A);
19071993
19081994 v = t4_read_reg(adap, int_cause_reg);
19091995
1910− v &= TXFIFO_PRTY_ERR | RXFIFO_PRTY_ERR;
1996+ v &= TXFIFO_PRTY_ERR_F | RXFIFO_PRTY_ERR_F;
19111997 if (!v)
19121998 return;
19131999
1914− if (v & TXFIFO_PRTY_ERR)
2000+ if (v & TXFIFO_PRTY_ERR_F)
19152001 dev_alert(adap->pdev_dev, "XGMAC %d Tx FIFO parity error\n",
19162002 port);
1917− if (v & RXFIFO_PRTY_ERR)
2003+ if (v & RXFIFO_PRTY_ERR_F)
19182004 dev_alert(adap->pdev_dev, "XGMAC %d Rx FIFO parity error\n",
19192005 port);
1920− t4_write_reg(adap, PORT_REG(port, XGMAC_PORT_INT_CAUSE), v);
2006+ t4_write_reg(adap, PORT_REG(port, XGMAC_PORT_INT_CAUSE_A), v);
19212007 t4_fatal_err(adap);
19222008 }
19232009
@@ -1927,19 +2013,19 @@ static void xgmac_intr_handler(struct adapter *adap, int port) · 3 unmodified lines
19272013 static void pl_intr_handler(struct adapter *adap)
19282014 {
19292015 static const struct intr_info pl_intr_info[] = {
1930− { FATALPERR, "T4 fatal parity error", -1, 1 },
1931− { PERRVFID, "PL VFID_MAP parity error", -1, 1 },
2016+ { FATALPERR_F, "T4 fatal parity error", -1, 1 },
2017+ { PERRVFID_F, "PL VFID_MAP parity error", -1, 1 },
19322018 { 0 }
19332019 };
19342020
1935− if (t4_handle_intr_status(adap, PL_PL_INT_CAUSE, pl_intr_info))
2021+ if (t4_handle_intr_status(adap, PL_PL_INT_CAUSE_A, pl_intr_info))
19362022 t4_fatal_err(adap);
19372023 }
19382024
1939−#define PF_INTR_MASK (PFSW)
1940−#define GLBL_INTR_MASK (CIM | MPS | PL | PCIE | MC | EDC0 | \
1941− EDC1 | LE | TP | MA | PM_TX | PM_RX | ULP_RX | \
1942− CPL_SWITCH | SGE | ULP_TX)
2025+#define PF_INTR_MASK (PFSW_F)
2026+#define GLBL_INTR_MASK (CIM_F | MPS_F | PL_F | PCIE_F | MC_F | EDC0_F | \
2027+ EDC1_F | LE_F | TP_F | MA_F | PM_TX_F | PM_RX_F | ULP_RX_F | \
2028+ CPL_SWITCH_F | SGE_F | ULP_TX_F)
19432029
19442030 /**
19452031 * t4_slow_intr_handler - control path interrupt handler
@@ -1951,60 +2037,60 @@ static void pl_intr_handler(struct adapter *adap) · 5 unmodified lines
19512037 */
19522038 int t4_slow_intr_handler(struct adapter *adapter)
19532039 {
1954− u32 cause = t4_read_reg(adapter, PL_INT_CAUSE);
2040+ u32 cause = t4_read_reg(adapter, PL_INT_CAUSE_A);
19552041
19562042 if (!(cause & GLBL_INTR_MASK))
19572043 return 0;
1958− if (cause & CIM)
2044+ if (cause & CIM_F)
19592045 cim_intr_handler(adapter);
1960− if (cause & MPS)
2046+ if (cause & MPS_F)
19612047 mps_intr_handler(adapter);
1962− if (cause & NCSI)
2048+ if (cause & NCSI_F)
19632049 ncsi_intr_handler(adapter);
1964− if (cause & PL)
2050+ if (cause & PL_F)
19652051 pl_intr_handler(adapter);
1966− if (cause & SMB)
2052+ if (cause & SMB_F)
19672053 smb_intr_handler(adapter);
1968− if (cause & XGMAC0)
2054+ if (cause & XGMAC0_F)
19692055 xgmac_intr_handler(adapter, 0);
1970− if (cause & XGMAC1)
2056+ if (cause & XGMAC1_F)
19712057 xgmac_intr_handler(adapter, 1);
1972− if (cause & XGMAC_KR0)
2058+ if (cause & XGMAC_KR0_F)
19732059 xgmac_intr_handler(adapter, 2);
1974− if (cause & XGMAC_KR1)
2060+ if (cause & XGMAC_KR1_F)
19752061 xgmac_intr_handler(adapter, 3);
1976− if (cause & PCIE)
2062+ if (cause & PCIE_F)
19772063 pcie_intr_handler(adapter);
1978− if (cause & MC)
2064+ if (cause & MC_F)
19792065 mem_intr_handler(adapter, MEM_MC);
1980− if (!is_t4(adapter->params.chip) && (cause & MC1))
2066+ if (!is_t4(adapter->params.chip) && (cause & MC1_S))
19812067 mem_intr_handler(adapter, MEM_MC1);
1982− if (cause & EDC0)

1150 more lines aren’t shown here.

drivers/net/ethernet/chelsio/cxgb4/t4_hw.h+24−0

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

drivers/net/ethernet/chelsio/cxgb4/t4_msg.h+273−94

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

drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h+1−0

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

drivers/net/ethernet/chelsio/cxgb4/t4_regs.h+2358−1034

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

drivers/net/ethernet/chelsio/cxgb4/t4_values.h+124−0

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

drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h+101−0

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

drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h+48−0

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

drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c+20−24

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

drivers/net/ethernet/chelsio/cxgb4vf/sge.c+29−28

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

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_defs.h+2−2

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

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c+22−21

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

drivers/net/ethernet/cirrus/ep93xx_eth.c+2−4

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

drivers/net/ethernet/cisco/enic/enic.h+15−1

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

drivers/net/ethernet/cisco/enic/enic_dev.c+0−56

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

drivers/net/ethernet/cisco/enic/enic_dev.h+0−5

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

drivers/net/ethernet/cisco/enic/enic_ethtool.c+19−2

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

drivers/net/ethernet/cisco/enic/enic_main.c+116−63

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

drivers/net/ethernet/cisco/enic/vnic_stats.h+5−0

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

drivers/net/ethernet/cisco/enic/vnic_wq.c+3−0

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

drivers/net/ethernet/cisco/enic/vnic_wq.h+1−0

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

drivers/net/ethernet/davicom/dm9000.c+40−0

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

drivers/net/ethernet/dec/tulip/winbond-840.c+1−1

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

drivers/net/ethernet/emulex/benet/be.h+23−180

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

drivers/net/ethernet/emulex/benet/be_cmds.c+160−71

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

drivers/net/ethernet/emulex/benet/be_cmds.h+211−7

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

drivers/net/ethernet/emulex/benet/be_ethtool.c+8−8

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

drivers/net/ethernet/emulex/benet/be_hw.h+11−229

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

drivers/net/ethernet/emulex/benet/be_main.c+610−341

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

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

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

drivers/net/ethernet/freescale/fec.h+3−0

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

drivers/net/ethernet/freescale/fec_main.c+119−26

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

drivers/net/ethernet/freescale/fec_ptp.c+1−15

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

drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c+65−30

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

drivers/net/ethernet/freescale/fs_enet/fs_enet.h+1−0

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

drivers/net/ethernet/freescale/gianfar.c+9−8

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

drivers/net/ethernet/freescale/gianfar.h+1−1

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

drivers/net/ethernet/freescale/xgmac_mdio.c+73−57

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

drivers/net/ethernet/hisilicon/Kconfig+9−0

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

drivers/net/ethernet/hisilicon/Makefile+1−0

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

drivers/net/ethernet/hisilicon/hip04_eth.c+971−0

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

drivers/net/ethernet/hisilicon/hip04_mdio.c+186−0

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

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

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

drivers/net/ethernet/ibm/emac/core.c+1−1

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

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

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

drivers/net/ethernet/intel/e1000/e1000_ethtool.c+2−1

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

drivers/net/ethernet/intel/e1000/e1000_main.c+12−8

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

drivers/net/ethernet/intel/e1000e/e1000.h+1−1

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

drivers/net/ethernet/intel/e1000e/netdev.c+24−17

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

drivers/net/ethernet/intel/e1000e/ptp.c+1−4

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

drivers/net/ethernet/intel/fm10k/fm10k_main.c+25−19

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

drivers/net/ethernet/intel/fm10k/fm10k_mbx.c+2−3

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

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c+7−8

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

drivers/net/ethernet/intel/fm10k/fm10k_pf.c+2−5

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

drivers/net/ethernet/intel/fm10k/fm10k_ptp.c+0−3

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

drivers/net/ethernet/intel/fm10k/fm10k_type.h+1−1

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

drivers/net/ethernet/intel/i40e/i40e.h+6−4

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

drivers/net/ethernet/intel/i40e/i40e_adminq.h+1−1

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

drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h+138−14

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

drivers/net/ethernet/intel/i40e/i40e_common.c+134−2

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

drivers/net/ethernet/intel/i40e/i40e_debugfs.c+0−1

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

drivers/net/ethernet/intel/i40e/i40e_ethtool.c+42−1

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

drivers/net/ethernet/intel/i40e/i40e_fcoe.c+7−11

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

drivers/net/ethernet/intel/i40e/i40e_main.c+108−41

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

drivers/net/ethernet/intel/i40e/i40e_prototype.h+5−0

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

drivers/net/ethernet/intel/i40e/i40e_ptp.c+31−13

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

drivers/net/ethernet/intel/i40e/i40e_txrx.c+9−4

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

drivers/net/ethernet/intel/i40e/i40e_type.h+9−1

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

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+21−13

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

drivers/net/ethernet/intel/i40evf/i40e_adminq.h+1−1

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

drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h+94−14

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

drivers/net/ethernet/intel/i40evf/i40e_txrx.c+40−4

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

drivers/net/ethernet/intel/i40evf/i40e_txrx.h+1−0

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

drivers/net/ethernet/intel/i40evf/i40e_type.h+7−1

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

drivers/net/ethernet/intel/i40evf/i40evf_main.c+58−54

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

drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c+3−3

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

drivers/net/ethernet/intel/igb/igb.h+10−1

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

drivers/net/ethernet/intel/igb/igb_main.c+104−53

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

drivers/net/ethernet/intel/igb/igb_ptp.c+253−14

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

drivers/net/ethernet/intel/igbvf/netdev.c+3−2

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

drivers/net/ethernet/intel/ixgb/ixgb_main.c+2−2

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

drivers/net/ethernet/intel/ixgbe/ixgbe.h+4−1

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

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+113−5

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

drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c+2−11

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

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c+8−8

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

drivers/net/ethernet/intel/ixgbe/ixgbe_type.h+12−0

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

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

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

drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c+59−31

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

drivers/net/ethernet/intel/ixgbevf/ixgbevf.h+28−8

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

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+341−158

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

drivers/net/ethernet/intel/ixgbevf/regs.h+10−0

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

drivers/net/ethernet/jme.c+2−2

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

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

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

drivers/net/ethernet/mellanox/mlx4/alloc.c+10−7

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

drivers/net/ethernet/mellanox/mlx4/catas.c+225−69

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

drivers/net/ethernet/mellanox/mlx4/cmd.c+328−94

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

drivers/net/ethernet/mellanox/mlx4/en_clock.c+4−6

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

drivers/net/ethernet/mellanox/mlx4/en_cq.c+2−2

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

drivers/net/ethernet/mellanox/mlx4/en_ethtool.c+9−11

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

drivers/net/ethernet/mellanox/mlx4/en_main.c+10−2

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

drivers/net/ethernet/mellanox/mlx4/en_netdev.c+181−1

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

drivers/net/ethernet/mellanox/mlx4/en_resources.c+6−2

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

drivers/net/ethernet/mellanox/mlx4/en_rx.c+9−4

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

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

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

drivers/net/ethernet/mellanox/mlx4/eq.c+58−42

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

drivers/net/ethernet/mellanox/mlx4/fw.c+121−23

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

drivers/net/ethernet/mellanox/mlx4/fw.h+1−0

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

drivers/net/ethernet/mellanox/mlx4/icm.c+6−5

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

drivers/net/ethernet/mellanox/mlx4/intf.c+58−4

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

drivers/net/ethernet/mellanox/mlx4/main.c+408−81

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

drivers/net/ethernet/mellanox/mlx4/mcg.c+6−0

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

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

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

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+5−0

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

drivers/net/ethernet/mellanox/mlx4/mr.c+11−14

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

drivers/net/ethernet/mellanox/mlx4/pd.c+4−3

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

drivers/net/ethernet/mellanox/mlx4/port.c+9−8

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

drivers/net/ethernet/mellanox/mlx4/qp.c+2−0

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

drivers/net/ethernet/mellanox/mlx4/reset.c+14−9

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

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c+31−26

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

drivers/net/ethernet/mellanox/mlx5/core/alloc.c+1−1

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

drivers/net/ethernet/mellanox/mlx5/core/debugfs.c+3−3

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

drivers/net/ethernet/mellanox/mlx5/core/main.c+6−6

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

drivers/net/ethernet/micrel/ksz884x.c+1−3

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

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

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

drivers/net/ethernet/natsemi/ns83820.c+2−2

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

drivers/net/ethernet/neterion/s2io.c+2−2

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

drivers/net/ethernet/neterion/vxge/vxge-config.c+1−1

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

drivers/net/ethernet/neterion/vxge/vxge-main.c+2−2

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

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

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

drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c+3−5

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c+13−12

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+8−16

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

drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c+1−2

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

drivers/net/ethernet/qlogic/qlge/qlge_main.c+3−3

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

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

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

drivers/net/ethernet/realtek/r8169.c+11−5

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

drivers/net/ethernet/renesas/sh_eth.c+39−9

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

drivers/net/ethernet/renesas/sh_eth.h+14−16

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

drivers/net/ethernet/rocker/rocker.c+169−8

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

drivers/net/ethernet/rocker/rocker.h+21−0

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

drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c+48−21

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

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

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

drivers/net/ethernet/smsc/smc91x.h+21−0

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

drivers/net/ethernet/stmicro/stmmac/Makefile+1−1

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

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c+437−0

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

drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c+7−6

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

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+22−4

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

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

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

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

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

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h+1−0

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

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

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

drivers/net/ethernet/sun/sunvnet.c+51−39

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

drivers/net/ethernet/tehuti/tehuti.c+2−2

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

drivers/net/ethernet/ti/Kconfig+25−0

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

drivers/net/ethernet/ti/Makefile+10−1

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

drivers/net/ethernet/ti/cpsw-common.c+55−0

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

drivers/net/ethernet/ti/cpsw.c+53−58

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

drivers/net/ethernet/ti/cpsw.h+2−0

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

drivers/net/ethernet/ti/cpsw_ale.c+24−2

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

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

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

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

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

drivers/net/ethernet/ti/davinci_emac.c+55−1

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

drivers/net/ethernet/ti/netcp.h+229−0

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

drivers/net/ethernet/ti/netcp_core.c+2149−0

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

drivers/net/ethernet/ti/netcp_ethss.c+2159−0

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

drivers/net/ethernet/ti/netcp_sgmii.c+131−0

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

drivers/net/ethernet/ti/netcp_xgbepcsr.c+501−0

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

drivers/net/ethernet/ti/tlan.c+7−7

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

drivers/net/ethernet/via/via-rhine.c+5−4

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

drivers/net/ethernet/via/via-velocity.c+2−2

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

drivers/net/fddi/skfp/smt.c+0−12

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

drivers/net/hyperv/netvsc.c+6−5

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

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

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

drivers/net/ieee802154/at86rf230.c+49−33

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

drivers/net/ieee802154/cc2520.c+11−26

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

drivers/net/ieee802154/mrf24j40.c+3−3

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

drivers/net/ipvlan/ipvlan_core.c+1−1

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

drivers/net/irda/ali-ircc.c+3−8

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

drivers/net/irda/ali-ircc.h+2−3

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

drivers/net/irda/au1k_ir.c+0−3

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

drivers/net/irda/irda-usb.c+2−8

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

drivers/net/irda/irda-usb.h+2−3

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

drivers/net/irda/kingsun-sir.c+0−3

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

drivers/net/irda/ks959-sir.c+0−3

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

drivers/net/irda/mcs7780.c+0−2

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

drivers/net/irda/mcs7780.h+0−1

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

drivers/net/irda/nsc-ircc.c+2−5

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

drivers/net/irda/nsc-ircc.h+2−3

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

drivers/net/irda/sa1100_ir.c+1−1

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

drivers/net/irda/stir4200.c+7−9

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

drivers/net/irda/via-ircc.h+0−4

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

drivers/net/irda/vlsi_ir.c+13−33

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

drivers/net/irda/vlsi_ir.h+1−1

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

drivers/net/macvlan.c+6−0

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

drivers/net/macvtap.c+3−3

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

drivers/net/mii.c+7−5

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

drivers/net/phy/Kconfig+1−1

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

drivers/net/phy/amd-xgbe-phy.c+634−347

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

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

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

drivers/net/phy/mdio_bus.c+8−6

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

drivers/net/phy/phy.c+3−0

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

drivers/net/phy/phy_device.c+18−4

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

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

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

drivers/net/tun.c+20−17

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

drivers/net/usb/hso.c+49−57

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

drivers/net/usb/r8152.c+139−90

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

drivers/net/usb/usbnet.c+8−9

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

drivers/net/veth.c+9−0

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

drivers/net/virtio_net.c+6−0

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

drivers/net/vmxnet3/vmxnet3_defs.h+2−1

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

drivers/net/vmxnet3/vmxnet3_drv.c+32−22

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

drivers/net/vmxnet3/vmxnet3_ethtool.c+21−8

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

drivers/net/vmxnet3/vmxnet3_int.h+4−2

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

drivers/net/vxlan.c+331−109

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

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

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

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

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

drivers/net/wireless/ath/ath10k/Makefile+5−1

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

drivers/net/wireless/ath/ath10k/ce.c+8−6

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

drivers/net/wireless/ath/ath10k/ce.h+1−1

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

drivers/net/wireless/ath/ath10k/core.c+250−72

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

drivers/net/wireless/ath/ath10k/core.h+50−11

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

drivers/net/wireless/ath/ath10k/debug.c+107−15

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

drivers/net/wireless/ath/ath10k/debug.h+10−1

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

drivers/net/wireless/ath/ath10k/debugfs_sta.c+243−0

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

drivers/net/wireless/ath/ath10k/htc.c+2−4

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

drivers/net/wireless/ath/ath10k/htt.c+1−2

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

drivers/net/wireless/ath/ath10k/htt.h+82−5

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

drivers/net/wireless/ath/ath10k/htt_rx.c+366−36

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

drivers/net/wireless/ath/ath10k/htt_tx.c+38−61

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

drivers/net/wireless/ath/ath10k/hw.c+58−0

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

drivers/net/wireless/ath/ath10k/hw.h+119−17

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

drivers/net/wireless/ath/ath10k/mac.c+508−158

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

drivers/net/wireless/ath/ath10k/pci.c+152−18

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

drivers/net/wireless/ath/ath10k/pci.h+6−1

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

drivers/net/wireless/ath/ath10k/rx_desc.h+24−1

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

drivers/net/wireless/ath/ath10k/spectral.c+1−0

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

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

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

drivers/net/wireless/ath/ath10k/testmode.c+4−1

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

drivers/net/wireless/ath/ath10k/thermal.c+244−0

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

drivers/net/wireless/ath/ath10k/thermal.h+58−0

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

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

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

drivers/net/wireless/ath/ath10k/txrx.c+7−2

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

drivers/net/wireless/ath/ath10k/wmi-ops.h+1064−0

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

drivers/net/wireless/ath/ath10k/wmi-tlv.c+2696−0

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

drivers/net/wireless/ath/ath10k/wmi-tlv.h+1444−0

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

drivers/net/wireless/ath/ath10k/wmi.c+1671−647

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

drivers/net/wireless/ath/ath10k/wmi.h+361−88

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

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

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

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

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

drivers/net/wireless/ath/ath5k/pcu.c+1−0

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

drivers/net/wireless/ath/ath5k/reset.c+1−1

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

drivers/net/wireless/ath/ath6kl/cfg80211.c+9−8

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

drivers/net/wireless/ath/ath6kl/main.c+0−1

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

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

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

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

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

drivers/net/wireless/ath/ath9k/ar5008_phy.c+80−0

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

drivers/net/wireless/ath/ath9k/ar9003_calib.c+48−13

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

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

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

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

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

drivers/net/wireless/ath/ath9k/ar9003_phy.c+37−10

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

drivers/net/wireless/ath/ath9k/ar9003_phy.h+11−8

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

drivers/net/wireless/ath/ath9k/ar9003_wow.c+155−160

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

drivers/net/wireless/ath/ath9k/ar953x_initvals.h+2−2

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

drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h+2−2

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

drivers/net/wireless/ath/ath9k/ar956x_initvals.h+1046−0

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

drivers/net/wireless/ath/ath9k/ath9k.h+6−9

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

drivers/net/wireless/ath/ath9k/common-spectral.c+1−1

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

drivers/net/wireless/ath/ath9k/debug.c+163−100

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

drivers/net/wireless/ath/ath9k/eeprom_4k.c+14−0

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

drivers/net/wireless/ath/ath9k/eeprom_9287.c+15−0

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

drivers/net/wireless/ath/ath9k/eeprom_def.c+14−0

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

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

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

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

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

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

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

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

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

drivers/net/wireless/ath/ath9k/htc_hst.c+1−5

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

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

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

drivers/net/wireless/ath/ath9k/hw.h+22−18

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

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

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

drivers/net/wireless/ath/ath9k/link.c+8−8

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

drivers/net/wireless/ath/ath9k/mac.c+2−1

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

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

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

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

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

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

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

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

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

drivers/net/wireless/ath/ath9k/reg_wow.h+128−0

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

drivers/net/wireless/ath/ath9k/wow.c+107−121

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

drivers/net/wireless/ath/ath9k/xmit.c+66−17

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

drivers/net/wireless/ath/carl9170/cmd.c+6−6

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

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

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

drivers/net/wireless/ath/dfs_pattern_detector.c+1−1

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

drivers/net/wireless/ath/wcn36xx/dxe.c+3−0

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

drivers/net/wireless/ath/wcn36xx/main.c+15−1

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

drivers/net/wireless/ath/wcn36xx/smd.c+71−2

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

drivers/net/wireless/ath/wcn36xx/txrx.c+65−18

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

drivers/net/wireless/ath/wcn36xx/txrx.h+8−1

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

drivers/net/wireless/ath/wcn36xx/wcn36xx.h+20−0

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

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

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

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

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

drivers/net/wireless/ath/wil6210/cfg80211.c+144−35

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

drivers/net/wireless/ath/wil6210/debugfs.c+148−16

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

drivers/net/wireless/ath/wil6210/ethtool.c+34−12

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

drivers/net/wireless/ath/wil6210/interrupt.c+93−16

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

drivers/net/wireless/ath/wil6210/main.c+101−104

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

drivers/net/wireless/ath/wil6210/netdev.c+9−6

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

drivers/net/wireless/ath/wil6210/pcie_bus.c+45−20

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

drivers/net/wireless/ath/wil6210/rx_reorder.c+266−11

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

drivers/net/wireless/ath/wil6210/txrx.c+109−42

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

drivers/net/wireless/ath/wil6210/txrx.h+104−54

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

drivers/net/wireless/ath/wil6210/wil6210.h+163−20

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

drivers/net/wireless/ath/wil6210/wil_platform.c+1−11

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

drivers/net/wireless/ath/wil6210/wil_platform_msm.c+0−257

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

drivers/net/wireless/ath/wil6210/wmi.c+189−50

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

drivers/net/wireless/ath/wil6210/wmi.h+62−8

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

drivers/net/wireless/atmel.c+1−11

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

drivers/net/wireless/b43/Kconfig+9−0

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

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

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

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

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

drivers/net/wireless/b43/main.c+60−11

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

drivers/net/wireless/b43/phy_ac.c+92−0

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

drivers/net/wireless/b43/phy_ac.h+38−0

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

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

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

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

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

drivers/net/wireless/b43legacy/radio.c+0−19

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

drivers/net/wireless/b43legacy/radio.h+0−1

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

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c+37−53

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

drivers/net/wireless/brcm80211/brcmfmac/bus.h+4−20

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

drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c+182−45

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

drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h+5−0

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

drivers/net/wireless/brcm80211/brcmfmac/chip.c+1−14

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

drivers/net/wireless/brcm80211/brcmfmac/common.c+32−2

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

drivers/net/wireless/brcm80211/brcmfmac/common.hrenamed from drivers/net/wireless/ath/wil6210/wil_platform_msm.h+10−14

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

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

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

drivers/net/wireless/brcm80211/brcmfmac/core.c+36−6

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

drivers/net/wireless/brcm80211/brcmfmac/core.h+31−3

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

drivers/net/wireless/brcm80211/brcmfmac/firmware.c+5−1

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

drivers/net/wireless/brcm80211/brcmfmac/flowring.c+2−4

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

drivers/net/wireless/brcm80211/brcmfmac/fwil.c+1−1

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

drivers/net/wireless/brcm80211/brcmfmac/fwil.h+5−0

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

drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h+55−0

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

drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c+36−18

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

drivers/net/wireless/brcm80211/brcmfmac/pcie.c+6−6

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

drivers/net/wireless/brcm80211/brcmfmac/sdio.c+83−95

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

drivers/net/wireless/brcm80211/brcmfmac/sdio.h+10−2

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

drivers/net/wireless/brcm80211/brcmfmac/usb.c+4−2

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

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

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

drivers/net/wireless/brcm80211/brcmutil/utils.c+30−2

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

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

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

drivers/net/wireless/brcm80211/include/brcmu_utils.h+4−0

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

drivers/net/wireless/cw1200/fwio.c+24−16

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

drivers/net/wireless/cw1200/main.c+2−4

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

drivers/net/wireless/cw1200/pm.c+2−3

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

drivers/net/wireless/cw1200/queue.c+1−3

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

drivers/net/wireless/cw1200/scan.c+4−4

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

drivers/net/wireless/cw1200/sta.c+3−1

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

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

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

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

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

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

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

drivers/net/wireless/iwlwifi/dvm/main.c+6−25

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

drivers/net/wireless/iwlwifi/dvm/tt.c+4−9

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

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

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

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

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

drivers/net/wireless/iwlwifi/iwl-7000.c+22−1

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

drivers/net/wireless/iwlwifi/iwl-8000.c+29−2

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

drivers/net/wireless/iwlwifi/iwl-config.h+15−2

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

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

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

drivers/net/wireless/iwlwifi/iwl-drv.c+13−75

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

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

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

drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h+41−2

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

drivers/net/wireless/iwlwifi/iwl-fw-file.h+12−6

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

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

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

drivers/net/wireless/iwlwifi/iwl-io.c+7−3

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

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

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

drivers/net/wireless/iwlwifi/iwl-nvm-parse.c+6−0

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

drivers/net/wireless/iwlwifi/iwl-prph.h+27−25

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

drivers/net/wireless/iwlwifi/iwl-scd.h+33−8

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

drivers/net/wireless/iwlwifi/iwl-trans.h+37−13

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

drivers/net/wireless/iwlwifi/mvm/coex.c+10−10

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

drivers/net/wireless/iwlwifi/mvm/coex_legacy.c+10−10

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

drivers/net/wireless/iwlwifi/mvm/constants.h+32−3

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

drivers/net/wireless/iwlwifi/mvm/d3.c+47−4

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

drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c+32−1

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

drivers/net/wireless/iwlwifi/mvm/debugfs.c+161−86

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

drivers/net/wireless/iwlwifi/mvm/fw-api-power.h+19−1

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

drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h+38−2

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

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

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

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

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

drivers/net/wireless/iwlwifi/mvm/fw-api.h+36−265

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

drivers/net/wireless/iwlwifi/mvm/fw.c+103−14

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

drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c+15−9

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

drivers/net/wireless/iwlwifi/mvm/mac80211.c+294−68

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

drivers/net/wireless/iwlwifi/mvm/mvm.h+76−12

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

drivers/net/wireless/iwlwifi/mvm/nvm.c+3−1

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

drivers/net/wireless/iwlwifi/mvm/ops.c+54−29

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

drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c+2−2

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

drivers/net/wireless/iwlwifi/mvm/rs.c+388−163

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

drivers/net/wireless/iwlwifi/mvm/rs.h+13−40

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

drivers/net/wireless/iwlwifi/mvm/rx.c+7−3

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

drivers/net/wireless/iwlwifi/mvm/scan.c+52−16

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

drivers/net/wireless/iwlwifi/mvm/sta.c+27−17

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

drivers/net/wireless/iwlwifi/mvm/tdls.c+47−16

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

drivers/net/wireless/iwlwifi/mvm/tt.c+6−1

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

drivers/net/wireless/iwlwifi/mvm/tx.c+9−3

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

drivers/net/wireless/iwlwifi/mvm/utils.c+40−39

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

drivers/net/wireless/iwlwifi/pcie/drv.c+2−0

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

drivers/net/wireless/iwlwifi/pcie/internal.h+13−5

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

drivers/net/wireless/iwlwifi/pcie/trans.c+69−9

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

drivers/net/wireless/iwlwifi/pcie/tx.c+68−32

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

drivers/net/wireless/libertas/cfg.c+6−6

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

drivers/net/wireless/mac80211_hwsim.c+17−16

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

drivers/net/wireless/mwifiex/11h.c+196−2

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

drivers/net/wireless/mwifiex/11n.c+3−3

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

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

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

drivers/net/wireless/mwifiex/11n_aggr.c+12−3

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

drivers/net/wireless/mwifiex/11n_rxreorder.c+7−9

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

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

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

drivers/net/wireless/mwifiex/cfg80211.c+699−252

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

drivers/net/wireless/mwifiex/cfp.c+20−2

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

drivers/net/wireless/mwifiex/cmdevt.c+15−31

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

drivers/net/wireless/mwifiex/debugfs.c+108−173

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

drivers/net/wireless/mwifiex/decl.h+52−3

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

drivers/net/wireless/mwifiex/ethtool.c+15−1

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

drivers/net/wireless/mwifiex/fw.h+61−0

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

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

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

drivers/net/wireless/mwifiex/init.c+33−2

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

drivers/net/wireless/mwifiex/ioctl.h+10−1

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

drivers/net/wireless/mwifiex/main.c+132−15

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

drivers/net/wireless/mwifiex/main.h+77−7

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

drivers/net/wireless/mwifiex/pcie.c+5−2

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

drivers/net/wireless/mwifiex/pcie.h+3−0

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

drivers/net/wireless/mwifiex/scan.c+11−5

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

drivers/net/wireless/mwifiex/sdio.c+107−4

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

drivers/net/wireless/mwifiex/sdio.h+49−0

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

drivers/net/wireless/mwifiex/sta_cmd.c+18−6

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

drivers/net/wireless/mwifiex/sta_cmdresp.c+7−0

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

drivers/net/wireless/mwifiex/sta_event.c+17−1

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

drivers/net/wireless/mwifiex/sta_ioctl.c+6−32

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

drivers/net/wireless/mwifiex/sta_rx.c+9−0

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

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

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

drivers/net/wireless/mwifiex/tdls.c+32−3

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

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

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

drivers/net/wireless/mwifiex/uap_cmd.c+70−0

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

drivers/net/wireless/mwifiex/uap_event.c+49−1

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

drivers/net/wireless/mwifiex/uap_txrx.c+15−13

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

drivers/net/wireless/mwifiex/usb.c+26−1

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

drivers/net/wireless/mwifiex/usb.h+4−7

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

drivers/net/wireless/mwifiex/util.c+221−1

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

drivers/net/wireless/mwifiex/util.h+20−0

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

drivers/net/wireless/mwifiex/wmm.c+3−0

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

drivers/net/wireless/mwl8k.c+6−6

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

drivers/net/wireless/orinoco/Kconfig+2−1

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

drivers/net/wireless/orinoco/main.c+1−1

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

drivers/net/wireless/orinoco/orinoco_pci.c+1−1

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

drivers/net/wireless/orinoco/orinoco_plx.c+1−1

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

drivers/net/wireless/orinoco/orinoco_tmd.c+1−1

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

drivers/net/wireless/orinoco/orinoco_usb.c+1−3

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

drivers/net/wireless/p54/eeprom.c+3−3

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

drivers/net/wireless/p54/fwio.c+6−3

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

drivers/net/wireless/p54/main.c+6−4

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

drivers/net/wireless/p54/p54pci.c+5−2

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

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

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

drivers/net/wireless/rndis_wlan.c+2−2

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

drivers/net/wireless/rsi/rsi_91x_sdio_ops.c+1−3

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

drivers/net/wireless/rt2x00/rt2800lib.c+6−6

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

drivers/net/wireless/rt2x00/rt2x00config.c+2−2

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

drivers/net/wireless/rt2x00/rt2x00dev.c+9−9

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

drivers/net/wireless/rt2x00/rt2x00firmware.c+1−1

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

drivers/net/wireless/rt2x00/rt2x00mac.c+1−1

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

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

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

drivers/net/wireless/rt2x00/rt2x00usb.c+4−4

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

drivers/net/wireless/rtlwifi/base.c+114−42

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

drivers/net/wireless/rtlwifi/base.h+2−2

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

drivers/net/wireless/rtlwifi/core.c+70−2

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

drivers/net/wireless/rtlwifi/core.h+42−0

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

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

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

drivers/net/wireless/rtlwifi/pci.h+7−0

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

drivers/net/wireless/rtlwifi/rtl8188ee/dm.c+3−33

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

drivers/net/wireless/rtlwifi/rtl8188ee/dm.h+0−41

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

drivers/net/wireless/rtlwifi/rtl8188ee/trx.c+2−160

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

drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c+8−37

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

drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h+0−38

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

drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h+1−0

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

drivers/net/wireless/rtlwifi/rtl8192ce/dm.c+1−0

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

drivers/net/wireless/rtlwifi/rtl8192ce/dm.h+0−13

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

drivers/net/wireless/rtlwifi/rtl8192ce/hw.c+81−84

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

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

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

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

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

drivers/net/wireless/rtlwifi/rtl8192ce/trx.c+6−7

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

drivers/net/wireless/rtlwifi/rtl8192cu/hw.c+4−0

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

drivers/net/wireless/rtlwifi/rtl8192cu/mac.c+2−2

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

drivers/net/wireless/rtlwifi/rtl8192cu/sw.c+14−14

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

drivers/net/wireless/rtlwifi/rtl8192cu/trx.c+9−11

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

drivers/net/wireless/rtlwifi/rtl8192de/dm.c+4−29

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

drivers/net/wireless/rtlwifi/rtl8192de/dm.h+0−38

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

drivers/net/wireless/rtlwifi/rtl8192de/fw.c+0−17

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

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

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

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

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

drivers/net/wireless/rtlwifi/rtl8192de/sw.c+15−15

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

drivers/net/wireless/rtlwifi/rtl8192de/trx.c+13−14

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

drivers/net/wireless/rtlwifi/rtl8192ee/dm.c+14−41

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

drivers/net/wireless/rtlwifi/rtl8192ee/dm.h+0−16

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

drivers/net/wireless/rtlwifi/rtl8192ee/fw.c+1−5

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

drivers/net/wireless/rtlwifi/rtl8192ee/hw.c+140−26

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

drivers/net/wireless/rtlwifi/rtl8192ee/reg.h+2−0

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

drivers/net/wireless/rtlwifi/rtl8192ee/sw.c+1−2

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

drivers/net/wireless/rtlwifi/rtl8192ee/trx.c+18−182

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

drivers/net/wireless/rtlwifi/rtl8192ee/trx.h+7−5

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

drivers/net/wireless/rtlwifi/rtl8192se/def.h+4−4

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

drivers/net/wireless/rtlwifi/rtl8192se/dm.c+4−3

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

drivers/net/wireless/rtlwifi/rtl8192se/dm.h+0−28

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

drivers/net/wireless/rtlwifi/rtl8192se/sw.c+15−15

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

drivers/net/wireless/rtlwifi/rtl8192se/trx.c+11−12

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

drivers/net/wireless/rtlwifi/rtl8723ae/dm.c+9−33

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

drivers/net/wireless/rtlwifi/rtl8723ae/dm.h+0−38

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

drivers/net/wireless/rtlwifi/rtl8723ae/trx.c+2−160

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

drivers/net/wireless/rtlwifi/rtl8723be/dm.c+14−41

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

drivers/net/wireless/rtlwifi/rtl8723be/dm.h+0−33

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

drivers/net/wireless/rtlwifi/rtl8723be/phy.c+0−25

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

drivers/net/wireless/rtlwifi/rtl8723be/phy.h+0−2

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

drivers/net/wireless/rtlwifi/rtl8723be/sw.c+6−4

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

drivers/net/wireless/rtlwifi/rtl8723be/trx.c+2−160

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

drivers/net/wireless/rtlwifi/rtl8821ae/def.h+0−54

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

drivers/net/wireless/rtlwifi/rtl8821ae/dm.c+16−42

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

drivers/net/wireless/rtlwifi/rtl8821ae/dm.h+0−41

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

drivers/net/wireless/rtlwifi/rtl8821ae/pwrseq.h+2−2

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

drivers/net/wireless/rtlwifi/rtl8821ae/sw.c+24−50

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

drivers/net/wireless/rtlwifi/rtl8821ae/trx.c+3−229

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

drivers/net/wireless/rtlwifi/wifi.h+59−40

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

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

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

drivers/net/wireless/ti/wl12xx/main.c+4−0

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

drivers/net/wireless/ti/wl18xx/acx.c+88−0

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

drivers/net/wireless/ti/wl18xx/acx.h+45−1

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

drivers/net/wireless/ti/wl18xx/cmd.c+90−3

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

drivers/net/wireless/ti/wl18xx/cmd.h+27−0

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

drivers/net/wireless/ti/wl18xx/conf.h+22−1

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

drivers/net/wireless/ti/wl18xx/debugfs.c+43−0

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

drivers/net/wireless/ti/wl18xx/event.c+21−0

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

drivers/net/wireless/ti/wl18xx/event.h+13−1

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

drivers/net/wireless/ti/wl18xx/main.c+22−15

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

drivers/net/wireless/ti/wl18xx/wl18xx.h+2−2

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

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

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

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

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

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

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

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

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

drivers/net/wireless/ti/wlcore/debugfs.c+1−8

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

drivers/net/wireless/ti/wlcore/event.c+8−3

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

drivers/net/wireless/ti/wlcore/hw_ops.h+45−3

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

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

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

drivers/net/wireless/ti/wlcore/main.c+349−56

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

drivers/net/wireless/ti/wlcore/ps.c+2−6

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

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

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

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

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

drivers/net/wireless/ti/wlcore/wlcore_i.h+7−0

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

drivers/net/xen-netback/common.h+0−1

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

drivers/net/xen-netback/interface.c+1−1

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

drivers/net/xen-netback/netback.c+3−104

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

drivers/net/xen-netfront.c+89−169

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

drivers/nfc/microread/microread.c+2−1

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

drivers/nfc/pn544/i2c.c+121−12

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

drivers/nfc/pn544/pn544.c+2−1

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

drivers/nfc/st21nfca/Makefile+1−1

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

drivers/nfc/st21nfca/i2c.c+17−6

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

drivers/nfc/st21nfca/st21nfca.c+142−44

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

drivers/nfc/st21nfca/st21nfca.h+16−5

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

drivers/nfc/st21nfca/st21nfca_se.c+411−0

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

drivers/nfc/st21nfca/st21nfca_se.h+63−0

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

drivers/nfc/st21nfcb/Makefile+1−1

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

drivers/nfc/st21nfcb/i2c.c+12−7

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

drivers/nfc/st21nfcb/ndlc.c+1−2

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

drivers/nfc/st21nfcb/st21nfcb.c+10−1

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

drivers/nfc/st21nfcb/st21nfcb.h+2−0

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

drivers/nfc/st21nfcb/st21nfcb_se.c+707−0

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

drivers/nfc/st21nfcb/st21nfcb_se.h+61−0

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

drivers/phy/phy-miphy365x.c+10−19

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

drivers/phy/phy-stih407-usb.c+14−11

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

drivers/s390/net/claw.c+2−4

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

drivers/s390/net/ctcm_fsms.c+7−11

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

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

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

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

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

drivers/s390/net/ctcm_sysfs.c+2−2

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

drivers/s390/net/lcs.c+2−4

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

drivers/s390/net/netiucv.c+6−9

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

drivers/s390/net/qeth_core.h+0−1

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

drivers/s390/net/qeth_core_sys.c+18−27

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

drivers/s390/net/qeth_l2_main.c+2−4

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

drivers/s390/net/qeth_l3_main.c+6−9

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

drivers/s390/net/qeth_l3_sys.c+18−27

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

drivers/scsi/csiostor/Makefile+1−1

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

drivers/scsi/csiostor/csio_hw.c+591−584

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

drivers/scsi/csiostor/csio_hw.h+5−44

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

drivers/scsi/csiostor/csio_hw_chip.h+29−36

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

drivers/scsi/csiostor/csio_hw_t4.c+0−404

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

drivers/scsi/csiostor/csio_hw_t5.c+75−75

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

drivers/scsi/csiostor/csio_init.c+2−4

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

drivers/scsi/csiostor/csio_isr.c+1−1

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

drivers/scsi/csiostor/csio_lnode.c+1−1

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

drivers/scsi/csiostor/csio_mb.c+29−27

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

drivers/scsi/csiostor/csio_scsi.c+2−2

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

drivers/scsi/csiostor/csio_wr.c+80−77

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

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c+31−10

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

drivers/scsi/pmcraid.c+1−7

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

drivers/ssb/main.c+0−19

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

drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c+5−5

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

drivers/staging/wlan-ng/cfg80211.c+2−2

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

drivers/target/target_core_user.c+1−3

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

drivers/thermal/thermal_core.c+1−5

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

drivers/vhost/net.c+23−60

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

drivers/vhost/scsi.c+1−1

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

drivers/vhost/vhost.c+4−2

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

fs/afs/rxrpc.c+7−7

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

fs/dlm/netlink.c+1−6

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

include/clocksource/arm_arch_timer.h+1−1

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

include/crypto/if_alg.h+1−2

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

include/dt-bindings/clock/rk3288-cru.h+3−0

This diff is large: its 10 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_pci.h+2−0

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

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

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

include/linux/bcma/bcma_soc.h+0−2

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

include/linux/clocksource.h+0−102

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

include/linux/etherdevice.h+4−0

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

include/linux/fec.h+1−0

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

include/linux/ieee80211.h+27−0

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

include/linux/if_bridge.h+0−18

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

include/linux/if_vlan.h+7−7

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

include/linux/ipv6.h+8−5

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

include/linux/list_nulls.h+5−1

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

include/linux/mlx4/cmd.h+13−3

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

include/linux/mlx4/device.h+56−5

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

include/linux/mlx4/driver.h+19−0

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

include/linux/mlx4/qp.h+1−0

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

include/linux/mmc/sdio_ids.h+4−2

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

include/linux/netdev_features.h+5−1

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

include/linux/netdevice.h+67−21

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

include/linux/phy.h+12−0

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

include/linux/platform_data/irda-sa11x0.hrenamed from arch/arm/include/asm/mach/irda.h+0−0

File renamed without changes.

include/linux/platform_data/st21nfca.h+2−0

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

include/linux/platform_data/st21nfcb.h+1−3

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

include/linux/rhashtable.h+231−77

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

include/linux/skbuff.h+33−11

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

include/linux/socket.h+0−7

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

include/linux/spinlock.h+8−0

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

include/linux/spinlock_api_smp.h+2−0

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

include/linux/spinlock_api_up.h+1−0

This diff is large: its 8 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/tcp.h+6−0

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

include/linux/timecounter.h+139−0

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

include/linux/types.h+3−0

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

include/linux/udp.h+1−15

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

include/linux/uio.h+0−6

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

include/linux/vmw_vmci_api.h+1−1

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

include/net/addrconf.h+3−0

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

include/net/bluetooth/bluetooth.h+1−1

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

include/net/bluetooth/hci.h+81−2

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

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

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

include/net/bluetooth/l2cap.h+1−0

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

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

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

include/net/bluetooth/rfcomm.h+0−2

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

include/net/bond_3ad.h+0−1

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

include/net/bonding.h+18−0

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

include/net/cfg80211.h+179−114

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

include/net/cfg802154.h+9−1

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

include/net/genetlink.h+19−2

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

include/net/geneve.h+3−4

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

include/net/gro_cells.h+12−17

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

include/net/ieee802154_netdev.h+3−1

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

include/net/inet_connection_sock.h+2−1

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

include/net/inet_sock.h+28−1

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

include/net/ip.h+6−1

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

include/net/ip6_fib.h+7−3

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

include/net/ip6_tunnel.h+1−0

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

include/net/ip_fib.h+29−21

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

include/net/ip_tunnels.h+5−1

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

include/net/ipv6.h+19−2

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

include/net/mac80211.h+73−27

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

include/net/mac802154.h+4−1

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

include/net/net_namespace.h+4−0

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

include/net/netfilter/nf_conntrack.h+0−2

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

include/net/netlink.h+4−6

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

include/net/netns/ipv4.h+4−1

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

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

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

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

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

include/net/nfc/nci_core.h+130−7

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

include/net/nfc/nfc.h+27−0

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

include/net/nl802154.h+44−1

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

include/net/ping.h+1−1

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

include/net/pkt_sched.h+12−0

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

include/net/regulatory.h+19−0

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

include/net/route.h+2−0

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

include/net/rtnetlink.h+2−0

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

include/net/sock.h+10−56

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

include/net/switchdev.h+78−1

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

include/net/tc_act/tc_bpf.h+25−0

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

include/net/tc_act/tc_connmark.h+14−0

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

include/net/tcp.h+69−3

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

include/net/udp_tunnel.h+8−8

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

include/net/udplite.h+1−2

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

include/net/vxlan.h+98−5

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

include/trace/events/net.h+4−4

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

include/uapi/linux/Kbuild+1−0

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

include/uapi/linux/ethtool.h+3−1

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

include/uapi/linux/if_bridge.h+2−0

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

include/uapi/linux/if_link.h+4−0

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

include/uapi/linux/in.h+1−0

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

include/uapi/linux/ipv6.h+6−1

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

include/uapi/linux/l2tp.h+1−0

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

include/uapi/linux/libc-compat.h+6−0

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

include/uapi/linux/neighbour.h+1−0

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

include/uapi/linux/net_namespace.h+23−0

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

include/uapi/linux/net_tstamp.h+2−1

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

include/uapi/linux/nfc.h+1−0

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

include/uapi/linux/nl80211.h+176−31

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

include/uapi/linux/openvswitch.h+52−1

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

include/uapi/linux/pkt_sched.h+2−0

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

include/uapi/linux/rtnetlink.h+8−0

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

include/uapi/linux/snmp.h+6−0

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

include/uapi/linux/tc_act/Kbuild+1−0

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

include/uapi/linux/tc_act/tc_bpf.h+31−0

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

include/uapi/linux/tc_act/tc_connmark.h+22−0

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

include/uapi/linux/tipc_config.h+20−0

This diff is large: its 27 lines aren’t shown here.

include/xen/page.h+5−0

This diff is large: its 12 lines aren’t shown here.

kernel/locking/spinlock.c+8−0

This diff is large: its 15 lines aren’t shown here.

kernel/taskstats.c+2−11

This diff is large: its 28 lines aren’t shown here.

kernel/time/Makefile+1−1

This diff is large: its 8 lines aren’t shown here.

kernel/time/clocksource.c+0−76

This diff is large: its 83 lines aren’t shown here.

kernel/time/timecounter.c+112−0

This diff is large: its 113 lines aren’t shown here.

lib/Kconfig.debug+1−1

This diff is large: its 9 lines aren’t shown here.

lib/Makefile+2−1

This diff is large: its 17 lines aren’t shown here.

lib/iovec.c+0−87

This diff is large: its 88 lines aren’t shown here.

lib/rhashtable.c+751−419

This diff is large: its 1465 lines aren’t shown here.

lib/test_rhashtable.c+227−0

This diff is large: its 228 lines aren’t shown here.

net/8021q/vlan_core.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/8021q/vlan_netlink.c+8−0

This diff is large: its 22 lines aren’t shown here.

net/batman-adv/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/bat_iv_ogm.c+7−8

This diff is large: its 63 lines aren’t shown here.

net/batman-adv/bitarray.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/bitarray.h+1−2

This diff is large: its 10 lines aren’t shown here.

net/batman-adv/bridge_loop_avoidance.c+7−10

This diff is large: its 103 lines aren’t shown here.

net/batman-adv/debugfs.c+1−1

This diff is large: its 16 lines aren’t shown here.

net/batman-adv/distributed-arp-table.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/distributed-arp-table.h+1−3

This diff is large: its 11 lines aren’t shown here.

net/batman-adv/fragmentation.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/fragmentation.h+1−2

This diff is large: its 10 lines aren’t shown here.

net/batman-adv/gateway_client.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/main.c+6−4

This diff is large: its 41 lines aren’t shown here.

net/batman-adv/main.h+7−8

This diff is large: its 36 lines aren’t shown here.

net/batman-adv/multicast.h+0−3

This diff is large: its 21 lines aren’t shown here.

net/batman-adv/network-coding.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/batman-adv/originator.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/originator.h+0−1

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/packet.h+3−2

This diff is large: its 26 lines aren’t shown here.

net/batman-adv/routing.c+1−2

This diff is large: its 17 lines aren’t shown here.

net/batman-adv/soft-interface.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/sysfs.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/batman-adv/translation-table.c+3−5

This diff is large: its 29 lines aren’t shown here.

net/batman-adv/types.h+1−3

This diff is large: its 25 lines aren’t shown here.

net/bluetooth/6lowpan.c+31−35

This diff is large: its 161 lines aren’t shown here.

net/bluetooth/Kconfig+27−0

This diff is large: its 32 lines aren’t shown here.

net/bluetooth/Makefile+3−1

This diff is large: its 10 lines aren’t shown here.

net/bluetooth/af_bluetooth.c+6−0

This diff is large: its 20 lines aren’t shown here.

net/bluetooth/bnep/core.c+3−4

This diff is large: its 17 lines aren’t shown here.

net/bluetooth/cmtp/capi.c+0−6

This diff is large: its 27 lines aren’t shown here.

net/bluetooth/hci_conn.c+5−16

This diff is large: its 54 lines aren’t shown here.

net/bluetooth/hci_core.c+236−1681

This diff is large: its 2216 lines aren’t shown here.

net/bluetooth/hci_debugfs.c+1056−0

This diff is large: its 1057 lines aren’t shown here.

net/bluetooth/hci_debugfs.h+26−0

This diff is large: its 27 lines aren’t shown here.

net/bluetooth/hci_event.c+214−34

This diff is large: its 399 lines aren’t shown here.

net/bluetooth/hci_request.c+556−0

This diff is large: its 557 lines aren’t shown here.

net/bluetooth/hci_request.h+54−0

This diff is large: its 55 lines aren’t shown here.

net/bluetooth/hci_sock.c+42−65

This diff is large: its 144 lines aren’t shown here.

net/bluetooth/l2cap_core.c+32−23

This diff is large: its 163 lines aren’t shown here.

net/bluetooth/l2cap_sock.c+6−5

This diff is large: its 41 lines aren’t shown here.

net/bluetooth/mgmt.c+449−168

This diff is large: its 1196 lines aren’t shown here.

net/bluetooth/rfcomm/core.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/bluetooth/rfcomm/sock.c+6−5

This diff is large: its 41 lines aren’t shown here.

net/bluetooth/sco.c+5−5

This diff is large: its 40 lines aren’t shown here.

net/bluetooth/selftest.c+244−0

This diff is large: its 245 lines aren’t shown here.

net/bluetooth/selftest.h+45−0

This diff is large: its 46 lines aren’t shown here.

net/bluetooth/smp.c+454−14

This diff is large: its 557 lines aren’t shown here.

net/bluetooth/smp.h+13−0

This diff is large: its 18 lines aren’t shown here.

net/bridge/br.c+51−1

This diff is large: its 90 lines aren’t shown here.

net/bridge/br_fdb.c+17−43

This diff is large: its 146 lines aren’t shown here.

net/bridge/br_if.c+9−2

This diff is large: its 27 lines aren’t shown here.

net/bridge/br_mdb.c+3−2

This diff is large: its 19 lines aren’t shown here.

net/bridge/br_netfilter.c+6−6

This diff is large: its 36 lines aren’t shown here.

net/bridge/br_netlink.c+230−70

This diff is large: its 403 lines aren’t shown here.

net/bridge/br_private.h+8−4

This diff is large: its 33 lines aren’t shown here.

net/bridge/br_vlan.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/bridge/netfilter/ebt_vlan.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/bridge/netfilter/ebtables.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/can/gw.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/core/Makefile+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/dev.c+146−81

This diff is large: its 416 lines aren’t shown here.

net/core/ethtool.c+34−11

This diff is large: its 77 lines aren’t shown here.

net/core/fib_rules.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/core/flow.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/flow_dissector.c+20−1

This diff is large: its 42 lines aren’t shown here.

net/core/iovec.c+0−137

This diff is large: its 138 lines aren’t shown here.

net/core/neighbour.c+12−8

This diff is large: its 76 lines aren’t shown here.

net/core/net_namespace.c+213−0

This diff is large: its 262 lines aren’t shown here.

net/core/netpoll.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/pktgen.c+8−8

This diff is large: its 58 lines aren’t shown here.

net/core/rtnetlink.c+98−58

This diff is large: its 358 lines aren’t shown here.

net/core/skbuff.c+42−17

This diff is large: its 141 lines aren’t shown here.

net/core/sock.c+3−0

This diff is large: its 17 lines aren’t shown here.

net/core/sysctl_net_core.c+11−2

This diff is large: its 34 lines aren’t shown here.

net/decnet/dn_dev.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/decnet/dn_fib.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/decnet/dn_route.c+3−5

This diff is large: its 29 lines aren’t shown here.

net/decnet/dn_table.c+5−2

This diff is large: its 28 lines aren’t shown here.

net/dsa/dsa.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/dsa/slave.c+0−13

This diff is large: its 19 lines aren’t shown here.

net/ethernet/eth.c+92−0

This diff is large: its 96 lines aren’t shown here.

net/ieee802154/6lowpan/6lowpan_i.h+72−0

This diff is large: its 73 lines aren’t shown here.

net/ieee802154/6lowpan/Kconfig+5−0

This diff is large: its 6 lines aren’t shown here.

net/ieee802154/6lowpan/Makefile+3−0

This diff is large: its 4 lines aren’t shown here.

net/ieee802154/6lowpan/core.c+304−0

This diff is large: its 305 lines aren’t shown here.

net/ieee802154/6lowpan/reassembly.crenamed from net/ieee802154/reassembly.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ieee802154/6lowpan/rx.c+171−0

This diff is large: its 172 lines aren’t shown here.

net/ieee802154/6lowpan/tx.c+271−0

This diff is large: its 272 lines aren’t shown here.

net/ieee802154/6lowpan_rtnl.c+0−729

This diff is large: its 730 lines aren’t shown here.

net/ieee802154/Kconfig+13−5

This diff is large: its 27 lines aren’t shown here.

net/ieee802154/Makefile+4−4

This diff is large: its 14 lines aren’t shown here.

net/ieee802154/af802154.h+0−33

This diff is large: its 34 lines aren’t shown here.

net/ieee802154/af_ieee802154.c+0−369

This diff is large: its 370 lines aren’t shown here.

net/ieee802154/dgram.c+0−549

This diff is large: its 550 lines aren’t shown here.

net/ieee802154/netlink.c+2−10

This diff is large: its 30 lines aren’t shown here.

net/ieee802154/nl-mac.c+4−3

This diff is large: its 28 lines aren’t shown here.

net/ieee802154/nl-phy.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/ieee802154/nl802154.c+47−5

This diff is large: its 94 lines aren’t shown here.

net/ieee802154/raw.c+0−270

This diff is large: its 271 lines aren’t shown here.

net/ieee802154/rdev-ops.h+7−0

This diff is large: its 14 lines aren’t shown here.

net/ieee802154/reassembly.h+0−41

This diff is large: its 42 lines aren’t shown here.

net/ieee802154/socket.c+1125−0

This diff is large: its 1126 lines aren’t shown here.

net/ieee802154/sysfs.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/af_inet.c+0−2

This diff is large: its 9 lines aren’t shown here.

net/ipv4/devinet.c+9−7

This diff is large: its 65 lines aren’t shown here.

net/ipv4/fib_frontend.c+16−13

This diff is large: its 104 lines aren’t shown here.

net/ipv4/fib_lookup.h+0−1

This diff is large: its 8 lines aren’t shown here.

net/ipv4/fib_rules.c+10−12

This diff is large: its 38 lines aren’t shown here.

net/ipv4/fib_semantics.c+14−21

This diff is large: its 63 lines aren’t shown here.

net/ipv4/fib_trie.c+934−1026

This diff is large: its 2612 lines aren’t shown here.

net/ipv4/fou.c+11−21

This diff is large: its 95 lines aren’t shown here.

net/ipv4/geneve.c+136−75

This diff is large: its 363 lines aren’t shown here.

net/ipv4/icmp.c+8−9

This diff is large: its 52 lines aren’t shown here.

net/ipv4/inet_diag.c+6−3

This diff is large: its 30 lines aren’t shown here.

net/ipv4/ip_gre.c+9−6

This diff is large: its 54 lines aren’t shown here.

net/ipv4/ip_output.c+2−4

This diff is large: its 16 lines aren’t shown here.

net/ipv4/ip_sockglue.c+83−32

This diff is large: its 198 lines aren’t shown here.

net/ipv4/ip_tunnel.c+8−0

This diff is large: its 15 lines aren’t shown here.

net/ipv4/ip_vti.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv4/ipconfig.c+3−3

This diff is large: its 21 lines aren’t shown here.

net/ipv4/ipip.c+7−6

This diff is large: its 38 lines aren’t shown here.

net/ipv4/ipmr.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/ipv4/ping.c+8−9

This diff is large: its 36 lines aren’t shown here.

net/ipv4/proc.c+6−0

This diff is large: its 13 lines aren’t shown here.

net/ipv4/raw.c+3−4

This diff is large: its 28 lines aren’t shown here.

net/ipv4/route.c+36−15

This diff is large: its 109 lines aren’t shown here.

net/ipv4/sysctl_net_ipv4.c+21−14

This diff is large: its 56 lines aren’t shown here.

net/ipv4/tcp.c+106−127

This diff is large: its 287 lines aren’t shown here.

net/ipv4/tcp_cong.c+95−26

This diff is large: its 179 lines aren’t shown here.

net/ipv4/tcp_fastopen.c+8−5

This diff is large: its 35 lines aren’t shown here.

net/ipv4/tcp_input.c+51−37

This diff is large: its 186 lines aren’t shown here.

net/ipv4/tcp_ipv4.c+3−0

This diff is large: its 17 lines aren’t shown here.

net/ipv4/tcp_metrics.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/ipv4/tcp_minisocks.c+56−10

This diff is large: its 122 lines aren’t shown here.

net/ipv4/tcp_output.c+41−9

This diff is large: its 112 lines aren’t shown here.

net/ipv4/tcp_timer.c+5−2

This diff is large: its 23 lines aren’t shown here.

net/ipv4/udp.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/ipv4/udp_offload.c+5−2

This diff is large: its 21 lines aren’t shown here.

net/ipv4/udp_tunnel.c+7−7

This diff is large: its 36 lines aren’t shown here.

net/ipv6/addrconf.c+65−17

This diff is large: its 248 lines aren’t shown here.

net/ipv6/addrlabel.c+3−2

This diff is large: its 19 lines aren’t shown here.

net/ipv6/datagram.c+2−3

This diff is large: its 19 lines aren’t shown here.

net/ipv6/icmp.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv6/ip6_fib.c+35−34

This diff is large: its 125 lines aren’t shown here.

net/ipv6/ip6_gre.c+2−0

This diff is large: its 16 lines aren’t shown here.

net/ipv6/ip6_output.c+241−119

This diff is large: its 507 lines aren’t shown here.

net/ipv6/ip6_tunnel.c+9−0

This diff is large: its 23 lines aren’t shown here.

net/ipv6/ip6_udp_tunnel.c+6−6

This diff is large: its 29 lines aren’t shown here.

net/ipv6/ip6_vti.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/ip6mr.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/ipv6/ipv6_sockglue.c+2−6

This diff is large: its 16 lines aren’t shown here.

net/ipv6/ndisc.c+4−2

This diff is large: its 20 lines aren’t shown here.

net/ipv6/output_core.c+3−2

This diff is large: its 19 lines aren’t shown here.

net/ipv6/ping.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/ipv6/raw.c+3−4

This diff is large: its 28 lines aren’t shown here.

net/ipv6/route.c+64−13

This diff is large: its 140 lines aren’t shown here.

net/ipv6/sit.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/tcp_ipv6.c+2−0

This diff is large: its 9 lines aren’t shown here.

net/ipv6/udp.c+61−32

This diff is large: its 192 lines aren’t shown here.

net/irda/irlap.c+5−3

This diff is large: its 27 lines aren’t shown here.

net/l2tp/l2tp_netlink.c+95−12

This diff is large: its 236 lines aren’t shown here.

net/mac80211/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

net/mac80211/Makefile+2−0

This diff is large: its 10 lines aren’t shown here.

net/mac80211/aes_ccm.c+12−9

This diff is large: its 64 lines aren’t shown here.

net/mac80211/aes_ccm.h+7−3

This diff is large: its 19 lines aren’t shown here.

net/mac80211/aes_cmac.c+26−8

This diff is large: its 71 lines aren’t shown here.

net/mac80211/aes_cmac.h+4−1

This diff is large: its 14 lines aren’t shown here.

net/mac80211/aes_gcm.c+95−0

This diff is large: its 96 lines aren’t shown here.

net/mac80211/aes_gcm.h+22−0

This diff is large: its 23 lines aren’t shown here.

net/mac80211/aes_gmac.c+84−0

This diff is large: its 85 lines aren’t shown here.

net/mac80211/aes_gmac.h+20−0

This diff is large: its 21 lines aren’t shown here.

net/mac80211/cfg.c+71−19

This diff is large: its 194 lines aren’t shown here.

net/mac80211/chan.c+34−7

This diff is large: its 90 lines aren’t shown here.

net/mac80211/debugfs.c+0−2

This diff is large: its 9 lines aren’t shown here.

net/mac80211/debugfs_key.c+55−0

This diff is large: its 117 lines aren’t shown here.

net/mac80211/driver-ops.h+15−15

This diff is large: its 44 lines aren’t shown here.

net/mac80211/ethtool.c+13−13

This diff is large: its 55 lines aren’t shown here.

net/mac80211/ibss.c+9−2

This diff is large: its 19 lines aren’t shown here.

net/mac80211/ieee80211_i.h+38−6

This diff is large: its 88 lines aren’t shown here.

net/mac80211/iface.c+5−9

This diff is large: its 36 lines aren’t shown here.

net/mac80211/key.c+180−14

This diff is large: its 361 lines aren’t shown here.

net/mac80211/key.h+18−0

This diff is large: its 25 lines aren’t shown here.

net/mac80211/main.c+68−43

This diff is large: its 201 lines aren’t shown here.

net/mac80211/mlme.c+70−26

This diff is large: its 215 lines aren’t shown here.

net/mac80211/offchannel.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/mac80211/pm.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/mac80211/rc80211_minstrel.c+3−3

This diff is large: its 16 lines aren’t shown here.

net/mac80211/rc80211_minstrel.h+8−7

This diff is large: its 41 lines aren’t shown here.

net/mac80211/rx.c+53−16

This diff is large: its 148 lines aren’t shown here.

net/mac80211/scan.c+9−4

This diff is large: its 48 lines aren’t shown here.

net/mac80211/spectmgmt.c+0−4

This diff is large: its 20 lines aren’t shown here.

net/mac80211/sta_info.c+140−49

This diff is large: its 310 lines aren’t shown here.

net/mac80211/sta_info.h+12−0

This diff is large: its 26 lines aren’t shown here.

net/mac80211/status.c+20−6

This diff is large: its 86 lines aren’t shown here.

net/mac80211/tdls.c+42−27

This diff is large: its 124 lines aren’t shown here.

net/mac80211/trace.h+7−26

This diff is large: its 47 lines aren’t shown here.

net/mac80211/tx.c+23−2

This diff is large: its 69 lines aren’t shown here.

net/mac80211/util.c+54−29

This diff is large: its 174 lines aren’t shown here.

net/mac80211/vht.c+38−35

This diff is large: its 90 lines aren’t shown here.

net/mac80211/wpa.c+433−10

This diff is large: its 531 lines aren’t shown here.

net/mac80211/wpa.h+17−2

This diff is large: its 35 lines aren’t shown here.

net/mac802154/cfg.c+22−4

This diff is large: its 47 lines aren’t shown here.

net/mac802154/driver-ops.h+3−2

This diff is large: its 19 lines aren’t shown here.

net/mac802154/iface.c+86−14

This diff is large: its 126 lines aren’t shown here.

net/mac802154/mac_cmd.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/mpls/mpls_gso.c+2−2

This diff is large: its 17 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_ctl.c+6−3

This diff is large: its 30 lines aren’t shown here.

net/netfilter/nf_conntrack_core.c+8−9

This diff is large: its 35 lines aren’t shown here.

net/netfilter/nf_conntrack_netlink.c+64−25

This diff is large: its 143 lines aren’t shown here.

net/netfilter/nf_conntrack_seqadj.c+3−3

This diff is large: its 13 lines aren’t shown here.

net/netfilter/nf_log.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/netfilter/nf_tables_api.c+12−6

This diff is large: its 60 lines aren’t shown here.

net/netfilter/nfnetlink.c+7−8

This diff is large: its 52 lines aren’t shown here.

net/netfilter/nfnetlink_cthelper.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/netfilter/nft_hash.c+84−61

This diff is large: its 205 lines aren’t shown here.

net/netfilter/xt_osf.c+85−84

This diff is large: its 203 lines aren’t shown here.

net/netlabel/netlabel_cipso_v4.c+3−3

This diff is large: its 20 lines aren’t shown here.

net/netlabel/netlabel_mgmt.c+28−28

This diff is large: its 176 lines aren’t shown here.

net/netlabel/netlabel_unlabeled.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netlink/af_netlink.c+122−128

This diff is large: its 485 lines aren’t shown here.

net/netlink/af_netlink.h+1−1

This diff is large: its 15 lines aren’t shown here.

net/netlink/diag.c+9−6

This diff is large: its 57 lines aren’t shown here.

net/netlink/genetlink.c+4−2

This diff is large: its 20 lines aren’t shown here.

net/nfc/core.c+21−2

This diff is large: its 44 lines aren’t shown here.

net/nfc/hci/command.c+4−19

This diff is large: its 51 lines aren’t shown here.

net/nfc/hci/core.c+72−25

This diff is large: its 160 lines aren’t shown here.

net/nfc/hci/hci.h+8−2

This diff is large: its 24 lines aren’t shown here.

net/nfc/hci/hcp.c+0−11

This diff is large: its 18 lines aren’t shown here.

net/nfc/nci/Makefile+1−1

This diff is large: its 8 lines aren’t shown here.

net/nfc/nci/core.c+154−15

This diff is large: its 281 lines aren’t shown here.

net/nfc/nci/data.c+41−15

This diff is large: its 153 lines aren’t shown here.

net/nfc/nci/hci.c+694−0

This diff is large: its 695 lines aren’t shown here.

net/nfc/nci/ntf.c+67−10

This diff is large: its 160 lines aren’t shown here.

net/nfc/nci/rsp.c+119−1

This diff is large: its 154 lines aren’t shown here.

net/nfc/netlink.c+54−5

This diff is large: its 94 lines aren’t shown here.

net/nfc/nfc.h+2−0

This diff is large: its 9 lines aren’t shown here.

net/openvswitch/actions.c+237−140

This diff is large: its 584 lines aren’t shown here.

net/openvswitch/datapath.c+159−78

This diff is large: its 529 lines aren’t shown here.

net/openvswitch/flow.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/openvswitch/flow.h+32−10

This diff is large: its 95 lines aren’t shown here.

net/openvswitch/flow_netlink.c+418−129

This diff is large: its 841 lines aren’t shown here.

net/openvswitch/flow_netlink.h+11−2

This diff is large: its 28 lines aren’t shown here.

net/openvswitch/flow_table.c+178−50

This diff is large: its 430 lines aren’t shown here.

net/openvswitch/flow_table.h+6−2

This diff is large: its 25 lines aren’t shown here.

net/openvswitch/vport-geneve.c+14−18

This diff is large: its 77 lines aren’t shown here.

net/openvswitch/vport-gre.c+3−11

This diff is large: its 35 lines aren’t shown here.

net/openvswitch/vport-vxlan.c+92−18

This diff is large: its 196 lines aren’t shown here.

net/openvswitch/vport-vxlan.h+11−0

This diff is large: its 12 lines aren’t shown here.

net/openvswitch/vport.c+3−9

This diff is large: its 26 lines aren’t shown here.

net/openvswitch/vport.h+18−0

This diff is large: its 23 lines aren’t shown here.

net/packet/af_packet.c+7−7

This diff is large: its 42 lines aren’t shown here.

net/packet/diag.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/phonet/pn_netlink.c+9−11

This diff is large: its 53 lines aren’t shown here.

net/rds/ib_send.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/rds/iw_cm.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/rds/iw_send.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/rds/message.c+4−4

This diff is large: its 22 lines aren’t shown here.

net/rfkill/rfkill-gpio.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/rxrpc/ar-error.c+5−0

This diff is large: its 12 lines aren’t shown here.

net/rxrpc/ar-output.c+10−36

This diff is large: its 114 lines aren’t shown here.

net/sched/Kconfig+24−0

This diff is large: its 31 lines aren’t shown here.

net/sched/Makefile+2−0

This diff is large: its 9 lines aren’t shown here.

net/sched/act_bpf.c+208−0

This diff is large: its 209 lines aren’t shown here.

net/sched/act_connmark.c+192−0

This diff is large: its 193 lines aren’t shown here.

net/sched/act_csum.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/cls_basic.c+5−2

This diff is large: its 15 lines aren’t shown here.

net/sched/cls_bpf.c+9−9

This diff is large: its 65 lines aren’t shown here.

net/sched/cls_flow.c+4−4

This diff is large: its 36 lines aren’t shown here.

net/sched/em_ipset.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/em_meta.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/sched/sch_api.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_dsmark.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/sched/sch_fq.c+27−6

This diff is large: its 105 lines aren’t shown here.

net/sched/sch_teql.c+2−9

This diff is large: its 25 lines aren’t shown here.

net/sctp/associola.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/socket.c+30−93

This diff is large: its 205 lines aren’t shown here.

net/switchdev/switchdev.c+175−0

This diff is large: its 186 lines aren’t shown here.

net/tipc/Kconfig+0−12

This diff is large: its 19 lines aren’t shown here.

net/tipc/Makefile+3−3

This diff is large: its 15 lines aren’t shown here.

net/tipc/addr.c+44−1

This diff is large: its 53 lines aren’t shown here.

net/tipc/addr.h+8−37

This diff is large: its 59 lines aren’t shown here.

net/tipc/bcast.c+211−288

This diff is large: its 955 lines aren’t shown here.

net/tipc/bcast.h+74−41

This diff is large: its 150 lines aren’t shown here.

net/tipc/bearer.c+75−130

This diff is large: its 518 lines aren’t shown here.

net/tipc/bearer.h+23−20

This diff is large: its 94 lines aren’t shown here.

net/tipc/config.c+0−342

This diff is large: its 343 lines aren’t shown here.

net/tipc/config.h+0−67

This diff is large: its 68 lines aren’t shown here.

net/tipc/core.c+71−83

This diff is large: its 213 lines aren’t shown here.

net/tipc/core.h+39−132

This diff is large: its 199 lines aren’t shown here.

net/tipc/discover.c+51−39

This diff is large: its 257 lines aren’t shown here.

net/tipc/discover.h+5−3

This diff is large: its 17 lines aren’t shown here.

net/tipc/link.c+283−598

This diff is large: its 1523 lines aren’t shown here.

net/tipc/link.h+29−18

This diff is large: its 128 lines aren’t shown here.

net/tipc/log.c+0−55

This diff is large: its 56 lines aren’t shown here.

net/tipc/msg.c+106−47

This diff is large: its 296 lines aren’t shown here.

net/tipc/msg.h+127−16

This diff is large: its 182 lines aren’t shown here.

net/tipc/name_distr.c+85−60

This diff is large: its 336 lines aren’t shown here.

net/tipc/name_distr.h+8−8

This diff is large: its 22 lines aren’t shown here.

net/tipc/name_table.c+139−259

This diff is large: its 719 lines aren’t shown here.

net/tipc/name_table.h+31−18

This diff is large: its 74 lines aren’t shown here.

net/tipc/net.c+32−24

This diff is large: its 151 lines aren’t shown here.

net/tipc/net.h+2−2

This diff is large: its 12 lines aren’t shown here.

net/tipc/netlink.c+5−59

This diff is large: its 113 lines aren’t shown here.

net/tipc/netlink.h+6−1

This diff is large: its 19 lines aren’t shown here.

net/tipc/netlink_compat.c+1084−0

This diff is large: its 1085 lines aren’t shown here.

net/tipc/node.c+110−226

This diff is large: its 591 lines aren’t shown here.

net/tipc/node.h+30−23

This diff is large: its 140 lines aren’t shown here.

net/tipc/server.c+4−2

This diff is large: its 27 lines aren’t shown here.

net/tipc/server.h+11−6

This diff is large: its 43 lines aren’t shown here.

net/tipc/socket.c+453−562

This diff is large: its 1674 lines aren’t shown here.

net/tipc/socket.h+13−7

This diff is large: its 33 lines aren’t shown here.

net/tipc/subscr.c+75−56

This diff is large: its 263 lines aren’t shown here.

net/tipc/subscr.h+8−6

This diff is large: its 44 lines aren’t shown here.

net/unix/af_unix.c+29−44

This diff is large: its 230 lines aren’t shown here.

net/unix/diag.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/vmw_vsock/vmci_transport.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/wireless/core.c+31−3

This diff is large: its 90 lines aren’t shown here.

net/wireless/core.h+10−1

This diff is large: its 32 lines aren’t shown here.

net/wireless/nl80211.c+494−232

This diff is large: its 1169 lines aren’t shown here.

net/wireless/nl80211.h+15−1

This diff is large: its 23 lines aren’t shown here.

net/wireless/reg.c+155−5

This diff is large: its 239 lines aren’t shown here.

net/wireless/reg.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/wireless/scan.c+8−5

This diff is large: its 48 lines aren’t shown here.

net/wireless/trace.h+17−14

This diff is large: its 52 lines aren’t shown here.

net/wireless/util.c+77−20

This diff is large: its 147 lines aren’t shown here.

net/wireless/wext-compat.c+5−5

This diff is large: its 39 lines aren’t shown here.

net/xfrm/xfrm_algo.c+0−5

This diff is large: its 12 lines aren’t shown here.

net/xfrm/xfrm_user.c+18−9

This diff is large: its 90 lines aren’t shown here.

sound/pci/hda/hda_priv.h+1−1

This diff is large: its 9 lines aren’t shown here.

virt/kvm/arm/arch_timer.c+2−1

This diff is large: its 10 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t