History

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

Pull networking updates from David Miller: "Highlights: 1) Maintain the TCP retransmit queue using an rbtree, with 1GB windows at 100Gb this really has become necessary. From Eric Dumazet. 2) Multi-program support for cgroup+bpf, from Alexei Starovoitov. 3) Perform broadcast flooding in hardware in mv88e6xxx, from Andrew Lunn. 4) Add meter action support to openvswitch, from Andy Zhou. 5) Add a data meta pointer for BPF accessible packets, from Daniel Borkmann. 6) Namespace-ify almost all TCP sysctl knobs, from Eric Dumazet. 7) Turn on Broadcom Tags in b53 driver, from Florian Fainelli. 8) More work to move the RTNL mutex down, from Florian Westphal. 9) Add 'bpftool' utility, to help with bpf program introspection. From Jakub Kicinski. 10) Add new 'cpumap' type for XDP_REDIRECT action, from Jesper Dangaard Brouer. 11) Support 'blocks' of transformations in the packet scheduler which can span multiple network devices, from Jiri Pirko. 12) TC flower offload support in cxgb4, from Kumar Sanghvi. 13) Priority based stream scheduler for SCTP, from Marcelo Ricardo Leitner. 14) Thunderbolt networking driver, from Amir Levy and Mika Westerberg. 15) Add RED qdisc offloadability, and use it in mlxsw driver. From Nogah Frankel. 16) eBPF based device controller for cgroup v2, from Roman Gushchin. 17) Add some fundamental tracepoints for TCP, from Song Liu. 18) Remove garbage collection from ipv6 route layer, this is a significant accomplishment. From Wei Wang. 19) Add multicast route offload support to mlxsw, from Yotam Gigi" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2177 commits) tcp: highest_sack fix geneve: fix fill_info when link down bpf: fix lockdep splat net: cdc_ncm: GetNtbFormat endian fix openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start netem: remove unnecessary 64 bit modulus netem: use 64 bit divide by rate tcp: Namespace-ify sysctl_tcp_default_congestion_control net: Protect iterations over net::fib_notifier_ops in fib_seq_sum() ipv6: set all.accept_dad to 0 by default uapi: fix linux/tls.h userspace compilation error usbnet: ipheth: prevent TX queue timeouts when device not ready vhost_net: conditionally enable tx polling uapi: fix linux/rxrpc.h userspace compilation errors net: stmmac: fix LPI transitioning for dwmac4 atm: horizon: Fix irq release error net-sysfs: trigger netlink notification on ifalias change via sysfs openvswitch: Using kfree_rcu() to simplify the code openvswitch: Make local function ovs_nsh_key_attr_size() static openvswitch: Fix return value check in ovs_meter_cmd_features() ...

Linus Torvalds committed 9 years ago

Commit 5bbcc0f2 parents 892204e 50895b91617 files · +91535 −27255Browse files

Unified · Split

1617 files
  1. Documentation/ABI/testing/sysfs-bus-thunderbolt +48 −0
  2. Documentation/admin-guide/thunderbolt.rst +24 −0
  3. Documentation/bpf/bpf_design_QA.txt +156 −0
  4. Documentation/devicetree/bindings/net/bluetooth.txt +5 −0
  5. Documentation/devicetree/bindings/net/dsa/lan9303.txt +2 −2
  6. Documentation/devicetree/bindings/net/fsl-fec.txt +13 −0
  7. Documentation/devicetree/bindings/net/renesas,ravb.txt +3 −1
  8. Documentation/devicetree/bindings/net/sh_eth.txt +12 −2
  9. Documentation/devicetree/bindings/net/stmmac.txt +1 −1
  10. Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt +8 −0
  11. Documentation/driver-api/80211/cfg80211.rst +0 −3
  12. Documentation/networking/dsa/lan9303.txt +37 −0
  13. Documentation/networking/gtp.txt +99 −4
  14. Documentation/networking/ila.txt +285 −0
  15. Documentation/networking/ip-sysctl.txt +35 −2
  16. Documentation/networking/ipvlan.txt +38 −4
  17. Documentation/networking/netdev-FAQ.txt +4 −1
  18. Documentation/networking/netvsc.txt +4 −4
  19. Documentation/networking/regulatory.txt +10 −20
  20. Documentation/networking/rxrpc.txt +51 −2
  21. Documentation/networking/vrf.txt +9 −4
  22. MAINTAINERS +31 −11
  23. arch/blackfin/mach-bf518/boards/ezbrd.c +0 −47
  24. arch/blackfin/mach-bf518/boards/tcm-bf518.c +0 −1
  25. arch/um/drivers/net_kern.c +4 −5
  26. drivers/atm/fore200e.c +8 −0
  27. drivers/atm/horizon.c +1 −1
  28. drivers/atm/idt77105.c +0 −2
  29. drivers/atm/idt77252.c +12 −9
  30. drivers/atm/idt77252.h +3 −0
  31. drivers/atm/iphase.c +3 −3
  32. drivers/atm/suni.c +4 −6
  33. drivers/bcma/Kconfig +9 −9
  34. drivers/bcma/driver_mips.c +8 −4
  35. drivers/bluetooth/Kconfig +2 −1
  36. drivers/bluetooth/bcm203x.c +1 −1
  37. drivers/bluetooth/bluecard_cs.c +3 −4
  38. drivers/bluetooth/bpa10x.c +6 −9
  39. drivers/bluetooth/bt3c_cs.c +1 −1
  40. drivers/bluetooth/btbcm.c +53 −53
  41. drivers/bluetooth/btintel.c +21 −21
  42. drivers/bluetooth/btmrvl_sdio.c +3 −3
  43. drivers/bluetooth/btqca.c +3 −3
  44. drivers/bluetooth/btqcomsmd.c +45 −0
  45. drivers/bluetooth/btrtl.c +11 −10
  46. drivers/bluetooth/btusb.c +126 −106
  47. drivers/bluetooth/hci_ath.c +33 −18
  48. drivers/bluetooth/hci_bcm.c +147 −116
  49. drivers/bluetooth/hci_bcsp.c +6 −4
  50. drivers/bluetooth/hci_h4.c +1 −1
  51. drivers/bluetooth/hci_h5.c +6 −4
  52. drivers/bluetooth/hci_ldisc.c +31 −18
  53. drivers/bluetooth/hci_ll.c +1 −1
  54. drivers/bluetooth/hci_qca.c +14 −15
  55. drivers/bluetooth/hci_serdev.c +4 −5
  56. drivers/bluetooth/hci_uart.h +1 −1
  57. drivers/connector/cn_queue.c +2 −2
  58. drivers/connector/connector.c +1 −1
  59. drivers/infiniband/hw/qedr/Kconfig +1 −0
  60. drivers/infiniband/ulp/ipoib/ipoib_ib.c +12 −3
  61. drivers/isdn/gigaset/bas-gigaset.c +19 −25
  62. drivers/isdn/gigaset/common.c +3 −4
  63. drivers/isdn/hardware/eicon/message.c +58 −12
  64. drivers/isdn/hardware/mISDN/hfcpci.c +4 −6
  65. drivers/isdn/hardware/mISDN/mISDNipac.c +3 −4
  66. drivers/isdn/hardware/mISDN/w6692.c +3 −4
  67. drivers/isdn/hisax/amd7930_fn.c +3 −3
  68. drivers/isdn/hisax/arcofi.c +3 −3
  69. drivers/isdn/hisax/diva.c +4 −5
  70. drivers/isdn/hisax/elsa.c +5 −5
  71. drivers/isdn/hisax/fsm.c +3 −4
  72. drivers/isdn/hisax/hfc4s8s_l1.c +3 −3
  73. drivers/isdn/hisax/hfc_2bds0.c +2 −2
  74. drivers/isdn/hisax/hfc_pci.c +5 −4
  75. drivers/isdn/hisax/hfc_sx.c +5 −4
  76. drivers/isdn/hisax/hfc_usb.c +6 −4
  77. drivers/isdn/hisax/hfcscard.c +3 −2
  78. drivers/isdn/hisax/icc.c +3 −3
  79. drivers/isdn/hisax/ipacx.c +4 −4
  80. drivers/isdn/hisax/isac.c +3 −3
  81. drivers/isdn/hisax/isar.c +4 −5
  82. drivers/isdn/hisax/isdnl3.c +3 −3
  83. drivers/isdn/hisax/saphir.c +3 −4
  84. drivers/isdn/hisax/teleint.c +3 −2
  85. drivers/isdn/hisax/w6692.c +3 −4
  86. drivers/isdn/isdnloop/isdnloop.c +14 −19
  87. drivers/isdn/mISDN/dsp.h +1 −1
  88. drivers/isdn/mISDN/dsp_core.c +2 −4
  89. drivers/isdn/mISDN/dsp_tones.c +2 −4
  90. drivers/isdn/mISDN/fsm.c +3 −4
  91. drivers/isdn/mISDN/l1oip_core.c +9 −16
  92. drivers/isdn/mISDN/timerdev.c +3 −3
  93. drivers/net/Kconfig +12 −0
  94. drivers/net/Makefile +3 −0
  95. drivers/net/appletalk/cops.c +6 −7
  96. drivers/net/appletalk/ltpc.c +5 −13
  97. drivers/net/arcnet/arcnet.c +4 −5
  98. drivers/net/bonding/bond_main.c +28 −14
  99. drivers/net/bonding/bond_options.c +1 −1
  100. drivers/net/caif/caif_hsi.c +6 −9
  101. drivers/net/can/grcan.c +8 −13
  102. drivers/net/can/sja1000/peak_pcmcia.c +3 −5
  103. drivers/net/can/usb/peak_usb/pcan_usb.c +6 −5
  104. drivers/net/dsa/b53/Kconfig +2 −0
  105. drivers/net/dsa/b53/b53_common.c +198 −37
  106. drivers/net/dsa/b53/b53_priv.h +31 −115
  107. drivers/net/dsa/b53/b53_regs.h +48 −0
  108. drivers/net/dsa/bcm_sf2.c +48 −192
  109. drivers/net/dsa/bcm_sf2.h +1 −2
  110. drivers/net/dsa/bcm_sf2_cfp.c +920 −276
  111. drivers/net/dsa/bcm_sf2_regs.h +36 −13
  112. drivers/net/dsa/dsa_loop.c +2 −9
  113. drivers/net/dsa/lan9303-core.c +515 −42
  114. drivers/net/dsa/lan9303.h +1 −20
  115. drivers/net/dsa/lan9303_i2c.c +1 −1
  116. drivers/net/dsa/lan9303_mdio.c +4 −3
  117. drivers/net/dsa/microchip/ksz_common.c +2 −1
  118. drivers/net/dsa/mt7530.c +11 −10
  119. drivers/net/dsa/mv88e6060.c +30 −21
  120. drivers/net/dsa/mv88e6xxx/chip.c +127 −83
  121. drivers/net/dsa/mv88e6xxx/global1.c +35 −0
  122. drivers/net/dsa/mv88e6xxx/global1.h +2 −0
  123. drivers/net/dsa/qca8k.c +7 −8
  124. drivers/net/dummy.c +2 −2
  125. drivers/net/eql.c +1 −3
  126. drivers/net/ethernet/3com/3c515.c +5 −5
  127. drivers/net/ethernet/3com/3c574_cs.c +6 −7
  128. drivers/net/ethernet/3com/3c589_cs.c +5 −5
  129. drivers/net/ethernet/3com/3c59x.c +10 −10
  130. drivers/net/ethernet/8390/axnet_cs.c +5 −5
  131. drivers/net/ethernet/8390/pcnet_cs.c +6 −5
  132. drivers/net/ethernet/adi/bfin_mac.c +2 −3
  133. drivers/net/ethernet/agere/et131x.c +2 −3
  134. drivers/net/ethernet/alacritech/slicoss.c +1 −1
  135. drivers/net/ethernet/amazon/ena/ena_admin_defs.h +6 −0
  136. drivers/net/ethernet/amazon/ena/ena_com.c +10 −6
  137. drivers/net/ethernet/amazon/ena/ena_ethtool.c +3 −2
  138. drivers/net/ethernet/amazon/ena/ena_netdev.c +107 −90
  139. drivers/net/ethernet/amazon/ena/ena_netdev.h +6 −6
  140. drivers/net/ethernet/amd/a2065.c +10 −4
  141. drivers/net/ethernet/amd/am79c961a.c +5 −6
  142. drivers/net/ethernet/amd/am79c961a.h +1 −0
  143. drivers/net/ethernet/amd/amd8111e.c +3 −5
  144. drivers/net/ethernet/amd/declance.c +7 −5
  145. drivers/net/ethernet/amd/pcnet32.c +5 −6
  146. drivers/net/ethernet/amd/sunlance.c +4 −5
  147. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +7 −9
  148. drivers/net/ethernet/apple/bmac.c +5 −7
  149. drivers/net/ethernet/apple/mace.c +5 −7
  150. drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +4 −4
  151. drivers/net/ethernet/broadcom/Kconfig +1 −0
  152. drivers/net/ethernet/broadcom/b44.c +1 −3
  153. drivers/net/ethernet/broadcom/bcm63xx_enet.c +38 −70
  154. drivers/net/ethernet/broadcom/bcm63xx_enet.h +0 −1
  155. drivers/net/ethernet/broadcom/bcmsysport.c +126 −4
  156. drivers/net/ethernet/broadcom/bcmsysport.h +11 −1
  157. drivers/net/ethernet/broadcom/bgmac-bcma.c +7 −1
  158. drivers/net/ethernet/broadcom/bgmac-platform.c +1 −0
  159. drivers/net/ethernet/broadcom/bgmac.c +16 −0
  160. drivers/net/ethernet/broadcom/bnx2.c +1 −3
  161. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 −1
  162. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +11 −6
  163. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +1 −6
  164. drivers/net/ethernet/broadcom/bnxt/Makefile +2 −1
  165. drivers/net/ethernet/broadcom/bnxt/bnxt.c +138 −93
  166. drivers/net/ethernet/broadcom/bnxt/bnxt.h +40 −9
  167. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +65 −0
  168. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +39 −0
  169. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +85 −35
  170. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h +2 −0
  171. drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +396 −24
  172. drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +862 −84
  173. drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h +80 −8
  174. drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +43 −53
  175. drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h +3 −34
  176. drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +2 −1
  177. drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h +1 −1
  178. drivers/net/ethernet/broadcom/genet/bcmgenet.c +77 −195
  179. drivers/net/ethernet/broadcom/genet/bcmgenet.h +0 −2
  180. drivers/net/ethernet/broadcom/genet/bcmmii.c +7 −27
  181. drivers/net/ethernet/broadcom/tg3.c +1 −3
  182. drivers/net/ethernet/brocade/bna/bnad.c +19 −24
  183. drivers/net/ethernet/cadence/macb_main.c +9 −2
  184. drivers/net/ethernet/cavium/Kconfig +1 −0
  185. drivers/net/ethernet/cavium/liquidio/Makefile +1 −1
  186. drivers/net/ethernet/cavium/liquidio/lio_core.c +8 −14
  187. drivers/net/ethernet/cavium/liquidio/lio_main.c +339 −43
  188. drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +17 −11
  189. drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c +695 −0
  190. drivers/net/ethernet/cavium/liquidio/lio_vf_rep.h +49 −0
  191. drivers/net/ethernet/cavium/liquidio/liquidio_common.h +66 −2
  192. drivers/net/ethernet/cavium/liquidio/liquidio_image.h +1 −0
  193. drivers/net/ethernet/cavium/liquidio/octeon_config.h +2 −0
  194. drivers/net/ethernet/cavium/liquidio/octeon_console.c +29 −3
  195. drivers/net/ethernet/cavium/liquidio/octeon_device.c +14 −1
  196. drivers/net/ethernet/cavium/liquidio/octeon_device.h +24 −0
  197. drivers/net/ethernet/cavium/liquidio/octeon_droq.c +2 −2
  198. drivers/net/ethernet/cavium/liquidio/octeon_droq.h +3 −0
  199. drivers/net/ethernet/cavium/liquidio/octeon_iq.h +3 −0
  200. drivers/net/ethernet/cavium/liquidio/octeon_main.h +1 −1
  201. drivers/net/ethernet/cavium/liquidio/octeon_network.h +3 −0
  202. drivers/net/ethernet/cavium/liquidio/octeon_nic.c +3 −2
  203. drivers/net/ethernet/cavium/liquidio/octeon_nic.h +2 −1
  204. drivers/net/ethernet/cavium/liquidio/request_manager.c +16 −4
  205. drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +11 −13
  206. drivers/net/ethernet/cavium/thunder/nic_main.c +30 −56
  207. drivers/net/ethernet/cavium/thunder/nicvf_main.c +3 −2
  208. drivers/net/ethernet/chelsio/cxgb/sge.c +13 −17
  209. drivers/net/ethernet/chelsio/cxgb3/sge.c +98 −32
  210. drivers/net/ethernet/chelsio/cxgb4/Makefile +4 −1
  211. drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c +6 −7
  212. drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h +3 −1
  213. drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c +54 −0
  214. drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +384 −0
  215. drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h +90 −0
  216. drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +1929 −0
  217. drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h +169 −0
  218. drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h +87 −0
  219. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +89 −16
  220. drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c +403 −0
  221. drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h +44 −0
  222. drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +11 −4
  223. drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +1 −0
  224. drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +7 −6
  225. drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +64 −39
  226. drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +1031 −24
  227. drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.h +8 −0
  228. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +122 −13
  229. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +876 −0
  230. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.h +120 −0
  231. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +2 −2
  232. drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +6 −1
  233. drivers/net/ethernet/chelsio/cxgb4/l2t.c +2 −2
  234. drivers/net/ethernet/chelsio/cxgb4/sge.c +6 −6
  235. drivers/net/ethernet/chelsio/cxgb4/smt.c +247 −0
  236. drivers/net/ethernet/chelsio/cxgb4/smt.h +76 −0
  237. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +502 −135
  238. drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +8 −0
  239. drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +47 −2
  240. drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +9 −0
  241. drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +118 −0
  242. drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h +69 −0
  243. drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +79 −2
  244. drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +58 −0
  245. drivers/net/ethernet/chelsio/cxgb4vf/sge.c +6 −6
  246. drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +3 −3
  247. drivers/net/ethernet/cisco/enic/enic.h +1 −1
  248. drivers/net/ethernet/cisco/enic/enic_clsf.h +2 −3
  249. drivers/net/ethernet/cisco/enic/enic_ethtool.c +77 −0
  250. drivers/net/ethernet/cisco/enic/enic_main.c +2 −3
  251. drivers/net/ethernet/cisco/enic/vnic_rq.c +2 −14
  252. drivers/net/ethernet/dec/tulip/de2104x.c +9 −12
  253. drivers/net/ethernet/dec/tulip/de4x5.c +6 −7
  254. drivers/net/ethernet/dec/tulip/dmfe.c +5 −7
  255. drivers/net/ethernet/dec/tulip/interrupt.c +3 −3
  256. drivers/net/ethernet/dec/tulip/pnic.c +3 −3
  257. drivers/net/ethernet/dec/tulip/pnic2.c +3 −3
  258. drivers/net/ethernet/dec/tulip/timer.c +6 −6
  259. drivers/net/ethernet/dec/tulip/tulip.h +6 −6
  260. drivers/net/ethernet/dec/tulip/tulip_core.c +6 −8
  261. drivers/net/ethernet/dec/tulip/uli526x.c +5 −7
  262. drivers/net/ethernet/dec/tulip/winbond-840.c +5 −7
  263. drivers/net/ethernet/dlink/dl2k.c +6 −6
  264. drivers/net/ethernet/dlink/sundance.c +5 −7
  265. drivers/net/ethernet/faraday/ftgmac100.c +26 −0
  266. drivers/net/ethernet/faraday/ftmac100.c +3 −2
  267. drivers/net/ethernet/fealnx.c +10 −14
  268. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +78 −78
  269. drivers/net/ethernet/freescale/fec.h +1 −2
  270. drivers/net/ethernet/freescale/fec_main.c +22 −9
  271. drivers/net/ethernet/freescale/fec_ptp.c +48 −34
  272. drivers/net/ethernet/freescale/fman/Makefile +6 −6
  273. drivers/net/ethernet/freescale/fman/fman_port.c +2 −0
  274. drivers/net/ethernet/freescale/fman/mac.c +38 −107
  275. drivers/net/ethernet/freescale/fman/mac.h +3 −3
  276. drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 −2
  277. drivers/net/ethernet/freescale/fs_enet/fs_enet.h +0 −1
  278. drivers/net/ethernet/freescale/ucc_geth.c +3 −2
  279. drivers/net/ethernet/hisilicon/Kconfig +12 −3
  280. drivers/net/ethernet/hisilicon/hns/hns_enet.c +3 −4
  281. drivers/net/ethernet/hisilicon/hns3/hnae3.h +41 −0
  282. drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile +4 −0
  283. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +41 −23
  284. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +85 −65
  285. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +347 −0
  286. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.h +21 −0
  287. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1047 −365
  288. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +40 −13
  289. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +10 −0
  290. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +217 −43
  291. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +15 −0
  292. drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c +100 −0
  293. drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +410 −94
  294. drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h +21 −1
  295. drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c +434 −51
  296. drivers/net/ethernet/huawei/hinic/hinic_rx.c +9 −9
  297. drivers/net/ethernet/huawei/hinic/hinic_tx.c +12 −2
  298. drivers/net/ethernet/ibm/ibmvnic.c +478 −43
  299. drivers/net/ethernet/ibm/ibmvnic.h +57 −3
  300. drivers/net/ethernet/intel/e100.c +5 −6
  301. drivers/net/ethernet/intel/e1000e/defines.h +1 −0
  302. drivers/net/ethernet/intel/e1000e/e1000.h +0 −4
  303. drivers/net/ethernet/intel/e1000e/mac.c +8 −3
  304. drivers/net/ethernet/intel/e1000e/netdev.c +51 −41
  305. drivers/net/ethernet/intel/e1000e/param.c +15 −1
  306. drivers/net/ethernet/intel/e1000e/phy.c +4 −3
  307. drivers/net/ethernet/intel/fm10k/fm10k.h +48 −12
  308. drivers/net/ethernet/intel/fm10k/fm10k_common.c +3 −3
  309. drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c +2 −2
  310. drivers/net/ethernet/intel/fm10k/fm10k_iov.c +154 −22
  311. drivers/net/ethernet/intel/fm10k/fm10k_main.c +4 −2
  312. drivers/net/ethernet/intel/fm10k/fm10k_mbx.c +2 −2
  313. drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +164 −45
  314. drivers/net/ethernet/intel/fm10k/fm10k_pci.c +372 −110
  315. drivers/net/ethernet/intel/fm10k/fm10k_pf.c +6 −6
  316. drivers/net/ethernet/intel/fm10k/fm10k_pf.h +2 −1
  317. drivers/net/ethernet/intel/i40e/i40e.h +162 −54
  318. drivers/net/ethernet/intel/i40e/i40e_adminq.c +12 −0
  319. drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +203 −7
  320. drivers/net/ethernet/intel/i40e/i40e_common.c +407 −42
  321. drivers/net/ethernet/intel/i40e/i40e_debugfs.c +5 −6
  322. drivers/net/ethernet/intel/i40e/i40e_diag.c +3 −1
  323. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +614 −291
  324. drivers/net/ethernet/intel/i40e/i40e_main.c +2793 −637
  325. drivers/net/ethernet/intel/i40e/i40e_nvm.c +7 −13
  326. drivers/net/ethernet/intel/i40e/i40e_prototype.h +26 −1
  327. drivers/net/ethernet/intel/i40e/i40e_register.h +1 −1
  328. drivers/net/ethernet/intel/i40e/i40e_txrx.c +13 −40
  329. drivers/net/ethernet/intel/i40e/i40e_txrx.h +9 −4
  330. drivers/net/ethernet/intel/i40e/i40e_type.h +36 −0
  331. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +175 −84
  332. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +3 −3
  333. drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +175 −7
  334. drivers/net/ethernet/intel/i40evf/i40e_common.c +69 −0
  335. drivers/net/ethernet/intel/i40evf/i40e_prototype.h +9 −0
  336. drivers/net/ethernet/intel/i40evf/i40e_txrx.c +7 −9
  337. drivers/net/ethernet/intel/i40evf/i40e_txrx.h +7 −4
  338. drivers/net/ethernet/intel/i40evf/i40e_type.h +23 −0
  339. drivers/net/ethernet/intel/i40evf/i40evf.h +19 −15
  340. drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +37 −1
  341. drivers/net/ethernet/intel/i40evf/i40evf_main.c +127 −66
  342. drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +43 −2
  343. drivers/net/ethernet/intel/igb/e1000_defines.h +23 −0
  344. drivers/net/ethernet/intel/igb/e1000_regs.h +8 −0
  345. drivers/net/ethernet/intel/igb/igb.h +6 −0
  346. drivers/net/ethernet/intel/igb/igb_main.c +357 −10
  347. drivers/net/ethernet/intel/igbvf/netdev.c +3 −4
  348. drivers/net/ethernet/intel/ixgb/ixgb_main.c +4 −6
  349. drivers/net/ethernet/intel/ixgbe/ixgbe.h +9 −0
  350. drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +4 −4
  351. drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +35 −19
  352. drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +9 −2
  353. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +253 −70
  354. drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +12 −7
  355. drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +10 −4
  356. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +4 −4
  357. drivers/net/ethernet/korina.c +82 −156
  358. drivers/net/ethernet/marvell/mvneta.c +8 −5
  359. drivers/net/ethernet/marvell/mvpp2.c +369 −46
  360. drivers/net/ethernet/marvell/pxa168_eth.c +2 −3
  361. drivers/net/ethernet/mediatek/mtk_eth_soc.c +5 −3
  362. drivers/net/ethernet/mediatek/mtk_eth_soc.h +3 −1
  363. drivers/net/ethernet/mellanox/mlx4/Kconfig +8 −0
  364. drivers/net/ethernet/mellanox/mlx4/catas.c +1 −3
  365. drivers/net/ethernet/mellanox/mlx4/cq.c +4 −4
  366. drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +8 −3
  367. drivers/net/ethernet/mellanox/mlx4/en_main.c +3 −3
  368. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +6 −5
  369. drivers/net/ethernet/mellanox/mlx4/en_resources.c +1 −1
  370. drivers/net/ethernet/mellanox/mlx4/en_rx.c +3 −3
  371. drivers/net/ethernet/mellanox/mlx4/en_tx.c +32 −16
  372. drivers/net/ethernet/mellanox/mlx4/fw.c +3 −3
  373. drivers/net/ethernet/mellanox/mlx4/main.c +2 −0
  374. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +4 −2
  375. drivers/net/ethernet/mellanox/mlx4/qp.c +5 −5
  376. drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 −1
  377. drivers/net/ethernet/mellanox/mlx4/srq.c +4 −4
  378. drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 −1
  379. drivers/net/ethernet/mellanox/mlx5/core/Makefile +3 −3
  380. drivers/net/ethernet/mellanox/mlx5/core/cq.c +8 −8
  381. drivers/net/ethernet/mellanox/mlx5/core/en.h +52 −39
  382. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +1 −1
  383. drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +5 −5
  384. drivers/net/ethernet/mellanox/mlx5/core/en_clock.c +0 −619
  385. drivers/net/ethernet/mellanox/mlx5/core/en_common.c +13 −0
  386. drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +264 −1
  387. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +59 −256
  388. drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +126 −45
  389. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +200 −44
  390. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +57 −17
  391. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +46 −13
  392. drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c +6 −2
  393. drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +899 −0
  394. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +11 −280
  395. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +13 −2
  396. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +30 −4
  397. drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 −2
  398. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 −1
  399. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +3 −3
  400. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +11 −2
  401. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +2 −2
  402. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +660 −338
  403. drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +16 −5
  404. drivers/net/ethernet/mellanox/mlx5/core/fw.c +10 −0
  405. drivers/net/ethernet/mellanox/mlx5/core/health.c +3 −5
  406. drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +5 −0
  407. drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +179 −93
  408. drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h +36 −0
  409. drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c +350 −0
  410. drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +525 −0
  411. drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h +51 −0
  412. drivers/net/ethernet/mellanox/mlx5/core/main.c +4 −0
  413. drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +3 −0
  414. drivers/net/ethernet/mellanox/mlx5/core/port.c +111 −0
  415. drivers/net/ethernet/mellanox/mlxsw/Makefile +3 −1
  416. drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +98 −8
  417. drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h +8 −3
  418. drivers/net/ethernet/mellanox/mlxsw/reg.h +774 −43
  419. drivers/net/ethernet/mellanox/mlxsw/resources.h +2 −0
  420. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +251 −84
  421. drivers/net/ethernet/mellanox/mlxsw/spectrum.h +76 −13
  422. drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c +8 −98
  423. drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c +129 −0
  424. drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.h +44 −0
  425. drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +5 −1
  426. drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c +423 −11
  427. drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.h +1 −0
  428. drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +8 −2
  429. drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c +169 −14
  430. drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h +12 −1
  431. drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c +256 −35
  432. drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +1012 −0
  433. drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.h +134 −0
  434. drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c +839 −0
  435. drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.h +43 −0
  436. drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +276 −0
  437. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1314 −234
  438. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h +44 −7
  439. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +409 −105
  440. drivers/net/ethernet/mellanox/mlxsw/trap.h +6 −0
  441. drivers/net/ethernet/micrel/ksz884x.c +9 −9
  442. drivers/net/ethernet/natsemi/natsemi.c +5 −7
  443. drivers/net/ethernet/natsemi/ns83820.c +4 −6
  444. drivers/net/ethernet/neterion/s2io.c +4 −9
  445. drivers/net/ethernet/neterion/s2io.h +1 −1
  446. drivers/net/ethernet/neterion/vxge/vxge-main.c +7 −14
  447. drivers/net/ethernet/neterion/vxge/vxge-main.h +3 −5
  448. drivers/net/ethernet/neterion/vxge/vxge-traffic.c +0 −19
  449. drivers/net/ethernet/netronome/nfp/Makefile +5 −3
  450. drivers/net/ethernet/netronome/nfp/bpf/jit.c +819 −480
  451. drivers/net/ethernet/netronome/nfp/bpf/main.c +75 −53
  452. drivers/net/ethernet/netronome/nfp/bpf/main.h +41 −73
  453. drivers/net/ethernet/netronome/nfp/bpf/offload.c +113 −165
  454. drivers/net/ethernet/netronome/nfp/bpf/verifier.c +70 −53
  455. drivers/net/ethernet/netronome/nfp/flower/action.c +381 −39
  456. drivers/net/ethernet/netronome/nfp/flower/cmsg.c +14 −11
  457. drivers/net/ethernet/netronome/nfp/flower/cmsg.h +135 −11
  458. drivers/net/ethernet/netronome/nfp/flower/main.c +17 −12
  459. drivers/net/ethernet/netronome/nfp/flower/main.h +35 −0
  460. drivers/net/ethernet/netronome/nfp/flower/match.c +106 −8
  461. drivers/net/ethernet/netronome/nfp/flower/metadata.c +1 −1
  462. drivers/net/ethernet/netronome/nfp/flower/offload.c +117 −36
  463. drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +804 −0
  464. drivers/net/ethernet/netronome/nfp/nfp_app.c +11 −16
  465. drivers/net/ethernet/netronome/nfp/nfp_app.h +45 −0
  466. drivers/net/ethernet/netronome/nfp/nfp_asm.c +257 −0
  467. drivers/net/ethernet/netronome/nfp/nfp_asm.h +227 −80
  468. drivers/net/ethernet/netronome/nfp/nfp_main.c +27 −1
  469. drivers/net/ethernet/netronome/nfp/nfp_net.h +3 −2
  470. drivers/net/ethernet/netronome/nfp/nfp_net_common.c +39 −36
  471. drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h +1 −1
  472. drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +133 −13
  473. drivers/net/ethernet/netronome/nfp/nfp_net_main.c +7 −1
  474. drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +47 −0
  475. drivers/net/ethernet/netronome/nfp/nfp_net_repr.h +1 −0
  476. drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c +7 −1
  477. drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c +5 −0
  478. drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h +36 −0
  479. drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c +79 −8
  480. drivers/net/ethernet/nuvoton/w90p910_ether.c +4 −5
  481. drivers/net/ethernet/nvidia/forcedeth.c +115 −78
  482. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h +1 −2
  483. drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +16 −26
  484. drivers/net/ethernet/packetengines/hamachi.c +7 −9
  485. drivers/net/ethernet/packetengines/yellowfin.c +5 −7
  486. drivers/net/ethernet/qlogic/Kconfig +3 −0
  487. drivers/net/ethernet/qlogic/qed/Makefile +2 −1
  488. drivers/net/ethernet/qlogic/qed/qed_cxt.c +6 −0
  489. drivers/net/ethernet/qlogic/qed/qed_dcbx.c +1 −1
  490. drivers/net/ethernet/qlogic/qed/qed_iwarp.c +748 −1
  491. drivers/net/ethernet/qlogic/qed/qed_iwarp.h +43 −1
  492. drivers/net/ethernet/qlogic/qed/qed_ll2.c +89 −14
  493. drivers/net/ethernet/qlogic/qed/qed_ll2.h +4 −6
  494. drivers/net/ethernet/qlogic/qed/qed_mcp.c +4 −4
  495. drivers/net/ethernet/qlogic/qed/qed_ooo.c +13 −3
  496. drivers/net/ethernet/qlogic/qed/qed_ooo.h +1 −1
  497. drivers/net/ethernet/qlogic/qed/qed_rdma.c +15 −9
  498. drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +1 −0
  499. drivers/net/ethernet/qlogic/qede/qede.h +1 −1
  500. drivers/net/ethernet/qlogic/qede/qede_filter.c +1 −1
  501. drivers/net/ethernet/qlogic/qede/qede_fp.c +1 −0
  502. drivers/net/ethernet/qlogic/qede/qede_main.c +2 −2
  503. drivers/net/ethernet/qlogic/qla3xxx.c +1 −3
  504. drivers/net/ethernet/qlogic/qlge/qlge_mpi.c +0 −1
  505. drivers/net/ethernet/qualcomm/emac/emac-mac.c +3 −13
  506. drivers/net/ethernet/qualcomm/emac/emac-sgmii.c +6 −9
  507. drivers/net/ethernet/qualcomm/emac/emac.c +9 −18
  508. drivers/net/ethernet/qualcomm/rmnet/Kconfig +1 −0
  509. drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +128 −40
  510. drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h +26 −9
  511. drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +56 −99
  512. drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h +1 −2
  513. drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +1 −2
  514. drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c +3 −5
  515. drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h +0 −8
  516. drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +92 −28
  517. drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h +4 −3
  518. drivers/net/ethernet/realtek/atp.c +7 −7
  519. drivers/net/ethernet/realtek/r8169.c +234 −6
  520. drivers/net/ethernet/renesas/ravb_main.c +64 −26
  521. drivers/net/ethernet/renesas/sh_eth.c +17 −15
  522. drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +7 −9
  523. drivers/net/ethernet/seeq/ether3.c +6 −5
  524. drivers/net/ethernet/seeq/ether3.h +1 −0
  525. drivers/net/ethernet/sfc/ef10.c +13 −5
  526. drivers/net/ethernet/sfc/efx.c +12 −8
  527. drivers/net/ethernet/sfc/efx.h +1 −1
  528. drivers/net/ethernet/sfc/falcon/efx.c +2 −4
  529. drivers/net/ethernet/sfc/falcon/efx.h +1 −1
  530. drivers/net/ethernet/sfc/falcon/falcon.c +6 −5
  531. drivers/net/ethernet/sfc/falcon/nic.h +2 −0
  532. drivers/net/ethernet/sfc/falcon/rx.c +2 −2
  533. drivers/net/ethernet/sfc/falcon/tx.c +1 −1
  534. drivers/net/ethernet/sfc/farch.c +4 −0
  535. drivers/net/ethernet/sfc/mcdi.c +4 −5
  536. drivers/net/ethernet/sfc/mcdi_port.c +4 −0
  537. drivers/net/ethernet/sfc/ptp.c +0 −2
  538. drivers/net/ethernet/sfc/rx.c +2 −2
  539. drivers/net/ethernet/sfc/tx.c +1 −1
  540. drivers/net/ethernet/sgi/ioc3-eth.c +3 −5
  541. drivers/net/ethernet/sis/sis190.c +4 −6
  542. drivers/net/ethernet/sis/sis900.c +5 −7
  543. drivers/net/ethernet/smsc/epic100.c +5 −7
  544. drivers/net/ethernet/smsc/smc91c92_cs.c +5 −5
  545. drivers/net/ethernet/stmicro/stmmac/Kconfig +1 −0
  546. drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c +10 −12
  547. drivers/net/ethernet/stmicro/stmmac/common.h +3 −2
  548. drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +1 −13
  549. drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +231 −130
  550. drivers/net/ethernet/stmicro/stmmac/dwmac4.h +8 −1
  551. drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +19 −0
  552. drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +18 −9
  553. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +49 −10
  554. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 −4
  555. drivers/net/ethernet/sun/cassini.c +3 −5
  556. drivers/net/ethernet/sun/ldmvsw.c +2 −3
  557. drivers/net/ethernet/sun/niu.c +4 −8
  558. drivers/net/ethernet/sun/sunbmac.c +4 −6
  559. drivers/net/ethernet/sun/sungem.c +3 −5
  560. drivers/net/ethernet/sun/sunhme.c +4 −6
  561. drivers/net/ethernet/sun/sunvnet.c +1 −2
  562. drivers/net/ethernet/sun/sunvnet_common.c +2 −2
  563. drivers/net/ethernet/sun/sunvnet_common.h +1 −1
  564. drivers/net/ethernet/ti/cpsw_ale.c +1 −3
  565. drivers/net/ethernet/ti/netcp_core.c +1 −1
  566. drivers/net/ethernet/ti/netcp_ethss.c +2 −3
  567. drivers/net/ethernet/ti/tlan.c +13 −19
  568. drivers/net/ethernet/toshiba/spider_net.c +5 −7
  569. drivers/net/ethernet/tundra/tsi108_eth.c +5 −5
  570. drivers/net/geneve.c +14 −30
  571. drivers/net/hamradio/6pack.c +13 −21
  572. drivers/net/hamradio/baycom_epp.c +46 −4
  573. drivers/net/hamradio/baycom_par.c +44 −4
  574. drivers/net/hamradio/mkiss.c +2 −2
  575. drivers/net/hamradio/scc.c +35 −34
  576. drivers/net/hamradio/yam.c +2 −2
  577. drivers/net/hippi/rrunner.c +4 −6
  578. drivers/net/hyperv/hyperv_net.h +13 −4
  579. drivers/net/hyperv/netvsc.c +51 −37
  580. drivers/net/hyperv/netvsc_drv.c +86 −28
  581. drivers/net/hyperv/rndis_filter.c +8 −5
  582. drivers/net/ieee802154/adf7242.c +4 −4
  583. drivers/net/ieee802154/atusb.c +313 −79
  584. drivers/net/ieee802154/atusb.h +8 −0
  585. drivers/net/ieee802154/ca8210.c +11 −11
  586. drivers/net/ieee802154/cc2520.c +10 −11
  587. drivers/net/ieee802154/mrf24j40.c +1 −1
  588. drivers/net/ifb.c +3 −0
  589. drivers/net/ipvlan/ipvlan.h +31 −0
  590. drivers/net/ipvlan/ipvlan_core.c +19 −7
  591. drivers/net/ipvlan/ipvlan_main.c +60 −10
  592. drivers/net/macsec.c +14 −13
  593. drivers/net/macvlan.c +17 −14
  594. drivers/net/macvtap.c +1 −1
  595. drivers/net/ntb_netdev.c +4 −4
  596. drivers/net/phy/Kconfig +15 −2
  597. drivers/net/phy/Makefile +2 −0
  598. drivers/net/phy/at803x.c +1 −1
  599. drivers/net/phy/broadcom.c +6 −0
  600. drivers/net/phy/dp83822.c +344 −0
  601. drivers/net/phy/dp83848.c +0 −3
  602. drivers/net/phy/phy_led_triggers.c +50 −13
  603. drivers/net/phy/phylink.c +8 −8
  604. drivers/net/phy/realtek.c +51 −5
  605. drivers/net/phy/sfp-bus.c +3 −8
  606. drivers/net/phy/sfp.c +14 −15
  607. drivers/net/phy/uPD60620.c +109 −0
  608. drivers/net/plip/plip.c +13 −0
  609. drivers/net/ppp/ppp_async.c +5 −5
  610. drivers/net/ppp/ppp_generic.c +15 −11
  611. drivers/net/ppp/ppp_synctty.c +6 −5
  612. drivers/net/slip/slip.c +2 −6
  613. drivers/net/team/team.c +3 −2
  614. drivers/net/team/team_mode_loadbalance.c +7 −1
  615. drivers/net/thunderbolt.c +1363 −0
  616. drivers/net/tun.c +268 −42
  617. drivers/net/usb/asix_common.c +1 −1
  618. drivers/net/usb/catc.c +3 −5
  619. drivers/net/usb/cdc_ncm.c +2 −2
  620. drivers/net/usb/hso.c +0 −2
  621. drivers/net/usb/ipheth.c +21 −9
  622. drivers/net/usb/lan78xx.c +3 −7
  623. drivers/net/usb/qmi_wwan.c +1 −1
  624. drivers/net/usb/sierra_net.c +4 −8
  625. drivers/net/usb/usbnet.c +5 −7
  626. drivers/net/virtio_net. +0 −0
  627. drivers/net/virtio_net.c +69 −21
  628. drivers/net/vrf.c +17 −7
  629. drivers/net/vxlan.c +17 −18
  630. drivers/net/wan/dscc4.c +0 −22
  631. drivers/net/wan/hdlc_cisco.c +6 −7
  632. drivers/net/wan/hdlc_fr.c +6 −5
  633. drivers/net/wan/hdlc_ppp.c +1 −3
  634. drivers/net/wan/lmc/lmc_main.c +5 −7
  635. drivers/net/wan/sbni.c +8 −13
  636. drivers/net/wan/sdla.c +5 −9
  637. drivers/net/wan/wanxl.c +0 −1
  638. drivers/net/wan/x25_asy.c +1 −0
  639. drivers/net/wireless/ath/ar5523/ar5523.c +3 −4
  640. drivers/net/wireless/ath/ath10k/core.c +13 −0
  641. drivers/net/wireless/ath/ath10k/core.h +3 −0
  642. drivers/net/wireless/ath/ath10k/htt_rx.c +3 −3
  643. drivers/net/wireless/ath/ath10k/hw.c +9 −4
  644. drivers/net/wireless/ath/ath10k/hw.h +5 −2
  645. drivers/net/wireless/ath/ath10k/mac.c +111 −57
  646. drivers/net/wireless/ath/ath10k/pci.c +22 −24
  647. drivers/net/wireless/ath/ath10k/pci.h +1 −1
  648. drivers/net/wireless/ath/ath10k/spectral.c +1 −1
  649. drivers/net/wireless/ath/ath10k/wmi.c +2 −1
  650. drivers/net/wireless/ath/ath10k/wmi.h +1 −0
  651. drivers/net/wireless/ath/ath6kl/cfg80211.c +2 −4
  652. drivers/net/wireless/ath/ath6kl/core.h +1 −1
  653. drivers/net/wireless/ath/ath6kl/main.c +2 −3
  654. drivers/net/wireless/ath/ath6kl/txrx.c +3 −5
  655. drivers/net/wireless/ath/ath6kl/wmi.c +2 −2
  656. drivers/net/wireless/ath/ath6kl/wmi.h +1 −1
  657. drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +2 −3
  658. drivers/net/wireless/ath/ath9k/ar9003_mac.c +2 −2
  659. drivers/net/wireless/ath/ath9k/ath9k.h +2 −2
  660. drivers/net/wireless/ath/ath9k/channel.c +9 −10
  661. drivers/net/wireless/ath/ath9k/debug.c +2 −2
  662. drivers/net/wireless/ath/ath9k/dfs.c +1 −1
  663. drivers/net/wireless/ath/ath9k/gpio.c +6 −8
  664. drivers/net/wireless/ath/ath9k/hif_usb.c +4 −4
  665. drivers/net/wireless/ath/ath9k/htc.h +1 −1
  666. drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +1 −1
  667. drivers/net/wireless/ath/ath9k/htc_drv_init.c +13 −14
  668. drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 −1
  669. drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +5 −5
  670. drivers/net/wireless/ath/ath9k/init.c +6 −6
  671. drivers/net/wireless/ath/ath9k/link.c +5 −5
  672. drivers/net/wireless/ath/ath9k/main.c +12 −10
  673. drivers/net/wireless/ath/ath9k/mci.c +1 −1
  674. drivers/net/wireless/ath/ath9k/tx99.c +5 −0
  675. drivers/net/wireless/ath/ath9k/wmi.c +2 −2
  676. drivers/net/wireless/ath/wcn36xx/main.c +11 −1
  677. drivers/net/wireless/ath/wcn36xx/wcn36xx.h +6 −0
  678. drivers/net/wireless/ath/wil6210/debugfs.c +0 −45
  679. drivers/net/wireless/ath/wil6210/main.c +7 −8
  680. drivers/net/wireless/ath/wil6210/p2p.c +2 −2
  681. drivers/net/wireless/ath/wil6210/wil6210.h +1 −1
  682. drivers/net/wireless/atmel/atmel.c +4 −7
  683. drivers/net/wireless/broadcom/b43/phy_g.c +1 −1
  684. drivers/net/wireless/broadcom/b43/phy_ht.c +3 −3
  685. drivers/net/wireless/broadcom/b43legacy/radio.c +1 −1
  686. drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +10 −0
  687. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +27 −140
  688. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +0 −2
  689. drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +157 −0
  690. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +40 −0
  691. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +3 −0
  692. drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +0 −5
  693. drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +31 −0
  694. drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +4 −10
  695. drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +19 −0
  696. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +31 −8
  697. drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +18 −0
  698. drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c +1 −1
  699. drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +796 −879
  700. drivers/net/wireless/intel/iwlegacy/3945-mac.c +1 −1
  701. drivers/net/wireless/intel/iwlegacy/3945-rs.c +3 −7
  702. drivers/net/wireless/intel/iwlegacy/4965-mac.c +5 −6
  703. drivers/net/wireless/intel/iwlegacy/4965-rs.c +0 −2
  704. drivers/net/wireless/intel/iwlegacy/common.c +2 −2
  705. drivers/net/wireless/intel/iwlegacy/common.h +1 −1
  706. drivers/net/wireless/intel/iwlwifi/Makefile +1 −0
  707. drivers/net/wireless/intel/iwlwifi/cfg/8000.c +2 −52
  708. drivers/net/wireless/intel/iwlwifi/cfg/9000.c +2 −1
  709. drivers/net/wireless/intel/iwlwifi/cfg/a000.c +53 −51
  710. drivers/net/wireless/intel/iwlwifi/fw/acpi.c +210 −0
  711. drivers/net/wireless/intel/iwlwifi/fw/acpi.h +138 −0
  712. drivers/net/wireless/intel/iwlwifi/fw/api/binding.h +38 −3
  713. drivers/net/wireless/intel/iwlwifi/fw/api/commands.h +1 −0
  714. drivers/net/wireless/intel/iwlwifi/fw/api/debug.h +9 −0
  715. drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h +0 −67
  716. drivers/net/wireless/intel/iwlwifi/fw/api/paging.h +0 −24
  717. drivers/net/wireless/intel/iwlwifi/fw/api/power.h +1 −2
  718. drivers/net/wireless/intel/iwlwifi/fw/api/sta.h +0 −4
  719. drivers/net/wireless/intel/iwlwifi/fw/api/tx.h +2 −2
  720. drivers/net/wireless/intel/iwlwifi/fw/dbg.c +15 −0
  721. drivers/net/wireless/intel/iwlwifi/fw/file.h +4 −1
  722. drivers/net/wireless/intel/iwlwifi/fw/img.h +0 −8
  723. drivers/net/wireless/intel/iwlwifi/fw/paging.c +12 −91
  724. drivers/net/wireless/intel/iwlwifi/iwl-config.h +4 −3
  725. drivers/net/wireless/intel/iwlwifi/iwl-csr.h +0 −2
  726. drivers/net/wireless/intel/iwlwifi/iwl-debug.h +1 −0
  727. drivers/net/wireless/intel/iwlwifi/iwl-drv.c +4 −9
  728. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +2 −89
  729. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +0 −17
  730. drivers/net/wireless/intel/iwlwifi/iwl-trans.c +16 −0
  731. drivers/net/wireless/intel/iwlwifi/iwl-trans.h +13 −45
  732. drivers/net/wireless/intel/iwlwifi/mvm/d3.c +10 −6
  733. drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +0 −76
  734. drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +32 −0
  735. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +58 −184
  736. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +48 −66
  737. drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +74 −31
  738. drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +2 −1
  739. drivers/net/wireless/intel/iwlwifi/mvm/ops.c +12 −11
  740. drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c +1 −0
  741. drivers/net/wireless/intel/iwlwifi/mvm/quota.c +35 −24
  742. drivers/net/wireless/intel/iwlwifi/mvm/rs.c +3 −7
  743. drivers/net/wireless/intel/iwlwifi/mvm/rx.c +3 −4
  744. drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +58 −20
  745. drivers/net/wireless/intel/iwlwifi/mvm/sta.c +65 −28
  746. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +11 −2
  747. drivers/net/wireless/intel/iwlwifi/mvm/utils.c +29 −84
  748. drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +1 −1
  749. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +56 −138
  750. drivers/net/wireless/intel/iwlwifi/pcie/internal.h +4 −0
  751. drivers/net/wireless/intel/iwlwifi/pcie/trans.c +90 −0
  752. drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +7 −6
  753. drivers/net/wireless/intel/iwlwifi/pcie/tx.c +22 −2
  754. drivers/net/wireless/intersil/orinoco/orinoco_usb.c +0 −2
  755. drivers/net/wireless/intersil/p54/main.c +3 −4
  756. drivers/net/wireless/mac80211_hwsim.c +96 −96
  757. drivers/net/wireless/marvell/libertas/cfg.c +0 −3
  758. drivers/net/wireless/marvell/libertas/if_usb.c +3 −3
  759. drivers/net/wireless/marvell/libertas/main.c +9 −12
  760. drivers/net/wireless/marvell/libertas_tf/if_usb.c +3 −3
  761. drivers/net/wireless/marvell/libertas_tf/main.c +3 −4
  762. drivers/net/wireless/marvell/mwifiex/11n.c +0 −9
  763. drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +3 −10
  764. drivers/net/wireless/marvell/mwifiex/cfg80211.c +42 −34
  765. drivers/net/wireless/marvell/mwifiex/cmdevt.c +6 −9
  766. drivers/net/wireless/marvell/mwifiex/fw.h +3 −1
  767. drivers/net/wireless/marvell/mwifiex/init.c +3 −8
  768. drivers/net/wireless/marvell/mwifiex/main.c +1 −2
  769. drivers/net/wireless/marvell/mwifiex/main.h +2 −3
  770. drivers/net/wireless/marvell/mwifiex/scan.c +2 −3
  771. drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +1 −5
  772. drivers/net/wireless/marvell/mwifiex/sta_event.c +2 −4
  773. drivers/net/wireless/marvell/mwifiex/tdls.c +3 −11
  774. drivers/net/wireless/marvell/mwifiex/usb.c +4 −5
  775. drivers/net/wireless/marvell/mwifiex/wmm.c +2 −1
  776. drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +51 −208
  777. drivers/net/wireless/quantenna/qtnfmac/commands.c +315 −161
  778. drivers/net/wireless/quantenna/qtnfmac/commands.h +6 −5
  779. drivers/net/wireless/quantenna/qtnfmac/core.c +29 −3
  780. drivers/net/wireless/quantenna/qtnfmac/core.h +7 −32
  781. drivers/net/wireless/quantenna/qtnfmac/event.c +59 −72
  782. drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +9 −6
  783. drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h +1 −0
  784. drivers/net/wireless/quantenna/qtnfmac/qlink.h +189 −87
  785. drivers/net/wireless/quantenna/qtnfmac/qlink_util.c +105 −8
  786. drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +7 −0
  787. drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +4 −3
  788. drivers/net/wireless/ralink/rt2x00/rt2x00dump.h +1 −1
  789. drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +3 −3
  790. drivers/net/wireless/ray_cs.c +24 −29
  791. drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +4 −1
  792. drivers/net/wireless/realtek/rtlwifi/base.c +105 −27
  793. drivers/net/wireless/realtek/rtlwifi/base.h +6 −2
  794. drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c +5 −8
  795. drivers/net/wireless/realtek/rtlwifi/core.c +11 −11
  796. drivers/net/wireless/realtek/rtlwifi/pci.c +171 −168
  797. drivers/net/wireless/realtek/rtlwifi/pci.h +19 −22
  798. drivers/net/wireless/realtek/rtlwifi/ps.c +1 −1
  799. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +6 −3
  800. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h +1 −1
  801. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c +12 −9
  802. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h +5 −3
  803. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c +9 −9
  804. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c +3 −2
  805. drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h +2 −1
  806. drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c +5 −4
  807. drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h +4 −4
  808. drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c +5 −1
  809. drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c +3 −2
  810. drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h +2 −1
  811. drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c +3 −3
  812. drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h +1 −1
  813. drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c +1 −1
  814. drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c +5 −4
  815. drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h +4 −2
  816. drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c +5 −1
  817. drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +2 −1
  818. drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +2 −1
  819. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c +2 −1
  820. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c +4 −2
  821. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c +32 −11
  822. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h +4 −2
  823. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c +8 −1
  824. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +27 −22
  825. drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h +23 −117
  826. drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c +2 −1
  827. drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c +4 −4
  828. drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h +3 −2
  829. drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c +6 −2
  830. drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c +2 −1
  831. drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.h +2 −1
  832. drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c +7 −7
  833. drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h +4 −2
  834. drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c +5 −1
  835. drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c +3 −2
  836. drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h +2 −1
  837. drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c +2 −1
  838. drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +8 −8
  839. drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h +3 −2
  840. drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +5 −1
  841. drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c +3 −2
  842. drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h +2 −1
  843. drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c +2 −1
  844. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c +1 −1
  845. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +14 −19
  846. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h +3 −2
  847. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +5 −1
  848. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c +3 −2
  849. drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h +2 −1
  850. drivers/net/wireless/realtek/rtlwifi/usb.c +0 −17
  851. drivers/net/wireless/realtek/rtlwifi/wifi.h +39 −33
  852. drivers/net/wireless/rsi/rsi_91x_core.c +37 −4
  853. drivers/net/wireless/rsi/rsi_91x_debugfs.c +6 −13
  854. drivers/net/wireless/rsi/rsi_91x_hal.c +61 −33
  855. drivers/net/wireless/rsi/rsi_91x_mac80211.c +480 −97
  856. drivers/net/wireless/rsi/rsi_91x_main.c +32 −1
  857. drivers/net/wireless/rsi/rsi_91x_mgmt.c +82 −29
  858. drivers/net/wireless/rsi/rsi_91x_ps.c +8 −8
  859. drivers/net/wireless/rsi/rsi_91x_sdio.c +265 −4
  860. drivers/net/wireless/rsi/rsi_91x_usb.c +2 −2
  861. drivers/net/wireless/rsi/rsi_common.h +6 −1
  862. drivers/net/wireless/rsi/rsi_hal.h +4 −2
  863. drivers/net/wireless/rsi/rsi_main.h +30 −6
  864. drivers/net/wireless/rsi/rsi_mgmt.h +47 −7
  865. drivers/net/wireless/rsi/rsi_ps.h +3 −4
  866. drivers/net/wireless/rsi/rsi_sdio.h +2 −0
  867. drivers/net/wireless/st/cw1200/main.c +1 −2
  868. drivers/net/wireless/st/cw1200/pm.c +2 −3
  869. drivers/net/wireless/st/cw1200/queue.c +3 −3
  870. drivers/net/wireless/st/cw1200/sta.c +2 −3
  871. drivers/net/wireless/st/cw1200/sta.h +1 −1
  872. drivers/net/wireless/zydas/zd1201.c +1 −2
  873. drivers/net/xen-netback/common.h +1 −1
  874. drivers/net/xen-netback/interface.c +1 −2
  875. drivers/net/xen-netback/netback.c +2 −4
  876. drivers/nfc/fdp/fdp.c +1 −1
  877. drivers/nfc/microread/i2c.c +1 −1
  878. drivers/nfc/nfcmrvl/i2c.c +1 −1
  879. drivers/nfc/nxp-nci/i2c.c +1 −1
  880. drivers/nfc/pn533/i2c.c +1 −1
  881. drivers/nfc/pn544/i2c.c +1 −1
  882. drivers/nfc/s3fwrn5/firmware.c +1 −1
  883. drivers/nfc/s3fwrn5/i2c.c +1 −1
  884. drivers/nfc/st-nci/i2c.c +1 −1
  885. drivers/nfc/st21nfca/i2c.c +1 −1
  886. drivers/pcmcia/electra_cf.c +7 −5
  887. drivers/s390/net/fsm.c +2 −6
  888. drivers/s390/net/qeth_core.h +20 −18
  889. drivers/s390/net/qeth_core_main.c +71 −139
  890. drivers/s390/net/qeth_core_mpc.c +3 −1
  891. drivers/s390/net/qeth_core_mpc.h +72 −1
  892. drivers/s390/net/qeth_core_sys.c +1 −3
  893. drivers/s390/net/qeth_l2.h +6 −0
  894. drivers/s390/net/qeth_l2_main.c +507 −50
  895. drivers/s390/net/qeth_l2_sys.c +193 −22
  896. drivers/s390/net/qeth_l3_main.c +17 −20
  897. drivers/s390/net/qeth_l3_sys.c +12 −33
  898. drivers/scsi/qedi/Kconfig +1 −0
  899. drivers/thunderbolt/Makefile +1 −1
  900. drivers/thunderbolt/ctl.c +18 −28
  901. drivers/thunderbolt/ctl.h +2 −1
  902. drivers/thunderbolt/domain.c +193 −4
  903. drivers/thunderbolt/icm.c +216 −2
  904. drivers/thunderbolt/nhi.c +315 −97
  905. drivers/thunderbolt/nhi.h +3 −138
  906. drivers/thunderbolt/nhi_regs.h +4 −7
  907. drivers/thunderbolt/property.c +670 −0
  908. drivers/thunderbolt/switch.c +5 −2
  909. drivers/thunderbolt/tb.h +35 −53
  910. drivers/thunderbolt/tb_msgs.h +137 −31
  911. drivers/thunderbolt/xdomain.c +1570 −0
  912. drivers/vhost/net.c +5 −9
  913. fs/afs/internal.h +1 −0
  914. fs/afs/rxrpc.c +33 −9
  915. include/linux/avf/virtchnl.h +20 −0
  916. include/linux/bpf-cgroup.h +51 −18
  917. include/linux/bpf.h +162 −12
  918. include/linux/bpf_types.h +18 −14
  919. include/linux/bpf_verifier.h +40 −7
  920. include/linux/brcmphy.h +1 −0
  921. include/linux/byteorder/generic.h +16 −0
  922. include/linux/connector.h +2 −2
  923. include/linux/device_cgroup.h +63 −4
  924. include/linux/dsa/lan9303.h +38 −0
  925. include/linux/dynamic_queue_limits.h +1 −1
  926. include/linux/etherdevice.h +1 −0
  927. include/linux/ethtool.h +10 −0
  928. include/linux/filter.h +26 −6
  929. include/linux/ieee80211.h +1 −0
  930. include/linux/if_arp.h +1 −1
  931. include/linux/if_bridge.h +6 −0
  932. include/linux/if_frad.h +1 −0
  933. include/linux/if_macvlan.h +2 −16
  934. include/linux/if_phonet.h +1 −1
  935. include/linux/if_tap.h +4 −0
  936. include/linux/inetdevice.h +2 −0
  937. include/linux/ipv6.h +1 −0
  938. include/linux/lsm_hooks.h +54 −0
  939. include/linux/mlx4/device.h +4 −4
  940. include/linux/mlx5/cq.h +2 −2
  941. include/linux/mlx5/device.h +31 −0
  942. include/linux/mlx5/driver.h +33 −0
  943. include/linux/mlx5/mlx5_ifc.h +59 −1
  944. include/linux/mlx5/port.h +5 −0
  945. include/linux/mlx5/qp.h +1 −0
  946. include/linux/mod_devicetable.h +26 −0
  947. include/linux/mroute.h +46 −0
  948. include/linux/netdevice.h +90 −30
  949. include/linux/netlink.h +0 −3
  950. include/linux/of.h +50 −12
  951. include/linux/once.h +3 −3
  952. include/linux/phy.h +2 −0
  953. include/linux/qed/qed_ll2_if.h +8 −0
  954. include/linux/rtnetlink.h +3 −1
  955. include/linux/security.h +48 −0
  956. include/linux/skbuff.h +102 −32
  957. include/linux/tcp.h +17 −7
  958. include/linux/thunderbolt.h +598 −0
  959. include/linux/trace_events.h +39 −4
  960. include/net/act_api.h +35 −2
  961. include/net/addrconf.h +4 −6
  962. include/net/af_rxrpc.h +5 −2
  963. include/net/af_vsock.h +17 −3
  964. include/net/bluetooth/bluetooth.h +3 −0
  965. include/net/bluetooth/hci.h +1 −1
  966. include/net/bonding.h +2 −5
  967. include/net/cfg80211.h +21 −19
  968. include/net/dn.h +0 −7
  969. include/net/dn_nsp.h +0 −1
  970. include/net/dsa.h +106 −26
  971. include/net/dst.h +9 −8
  972. include/net/dst_metadata.h +4 −2
  973. include/net/fib_notifier.h +3 −0
  974. include/net/flow_dissector.h +6 −6
  975. include/net/fq.h +7 −0
  976. include/net/fq_impl.h +62 −10
  977. include/net/inet_connection_sock.h +3 −3
  978. include/net/inet_ecn.h +0 −5
  979. include/net/inet_frag.h +1 −1
  980. include/net/inet_sock.h +2 −1
  981. include/net/ip6_fib.h +63 −16
  982. include/net/ip6_route.h +5 −0
  983. include/net/ip_fib.h +0 −3
  984. include/net/ip_tunnels.h +2 −1
  985. include/net/ipv6.h +42 −3
  986. include/net/llc_c_ac.h +4 −4
  987. include/net/mac80211.h +7 −1
  988. include/net/neighbour.h +2 −2
  989. include/net/netevent.h +1 −0
  990. include/net/netfilter/ipv4/nf_conntrack_ipv4.h +1 −1
  991. include/net/netfilter/ipv6/nf_conntrack_ipv6.h +1 −1
  992. include/net/netfilter/nf_conntrack_l4proto.h +18 −7
  993. include/net/netfilter/nf_tables.h +5 −0
  994. include/net/netns/ipv4.h +41 −0
  995. include/net/netns/ipv6.h +9 −0
  996. include/net/nsh.h +3 −0
  997. include/net/phonet/phonet.h +4 −2
  998. include/net/pkt_cls.h +204 −29
  999. include/net/pkt_sched.h +12 −9
  1000. include/net/request_sock.h +2 −0
  1001. include/net/rtnetlink.h +0 −5
  1002. include/net/sch_generic.h +46 −5
  1003. include/net/sctp/sm.h +5 −5
  1004. include/net/sctp/stream_sched.h +72 −0
  1005. include/net/sctp/structs.h +59 −4
  1006. include/net/sock.h +31 −4
  1007. include/net/switchdev.h +2 −0
  1008. include/net/tc_act/tc_gact.h +5 −0
  1009. include/net/tc_act/tc_ife.h +9 −3
  1010. include/net/tc_act/tc_mirred.h +1 −0
  1011. include/net/tc_act/tc_vlan.h +37 −9
  1012. include/net/tcp.h +86 −138
  1013. include/net/tipc.h +62 −0
  1014. include/net/tls.h +22 −1
  1015. include/net/xfrm.h +4 −4
  1016. include/trace/events/bpf.h +4 −1
  1017. include/trace/events/fib6.h +3 −3
  1018. include/trace/events/sock.h +1 −1
  1019. include/trace/events/tcp.h +299 −0
  1020. include/trace/events/xdp.h +78 −2
  1021. include/trace/perf.h +3 −3
  1022. include/uapi/linux/batman_adv.h +290 −79
  1023. include/uapi/linux/bpf.h +150 −8
  1024. include/uapi/linux/dcbnl.h +1 −0
  1025. include/uapi/linux/if_link.h +8 −0
  1026. include/uapi/linux/if_tun.h +2 −0
  1027. include/uapi/linux/if_tunnel.h +1 −0
  1028. include/uapi/linux/ila.h +21 −0
  1029. include/uapi/linux/in6.h +1 −0
  1030. include/uapi/linux/ip6_tunnel.h +2 −0
  1031. include/uapi/linux/ipv6.h +1 −0
  1032. include/uapi/linux/ipv6_route.h +1 −1
  1033. include/uapi/linux/nfc.h +2 −0
  1034. include/uapi/linux/nl80211.h +65 −17
  1035. include/uapi/linux/openvswitch.h +88 −0
  1036. include/uapi/linux/pkt_sched.h +63 −0
  1037. include/uapi/linux/qrtr.h +35 −0
  1038. include/uapi/linux/rtnetlink.h +2 −0
  1039. include/uapi/linux/rxrpc.h +5 −5
  1040. include/uapi/linux/sctp.h +16 −0
  1041. include/uapi/linux/snmp.h +0 −1
  1042. include/uapi/linux/tc_act/tc_mirred.h +3 −3
  1043. include/uapi/linux/tcp.h +2 −0
  1044. include/uapi/linux/tipc.h +15 −0
  1045. include/uapi/linux/tls.h +0 −4
  1046. include/uapi/linux/vm_sockets_diag.h +33 −0
  1047. kernel/bpf/Makefile +3 −0
  1048. kernel/bpf/arraymap.c +5 −1
  1049. kernel/bpf/cgroup.c +443 −127
  1050. kernel/bpf/core.c +177 −3
  1051. kernel/bpf/cpumap.c +706 −0
  1052. kernel/bpf/devmap.c +4 −1
  1053. kernel/bpf/disasm.c +214 −0
  1054. kernel/bpf/disasm.h +32 −0
  1055. kernel/bpf/hashtab.c +3 −2
  1056. kernel/bpf/inode.c +10 −5
  1057. kernel/bpf/lpm_trie.c +94 −4
  1058. kernel/bpf/offload.c +194 −0
  1059. kernel/bpf/percpu_freelist.c +6 −2
  1060. kernel/bpf/sockmap.c +6 −3
  1061. kernel/bpf/stackmap.c +4 −1
  1062. kernel/bpf/syscall.c +289 −36
  1063. kernel/bpf/verifier.c +797 −683
  1064. kernel/cgroup/cgroup.c +31 −7
  1065. kernel/events/core.c +10 −21
  1066. kernel/trace/bpf_trace.c +163 −14
  1067. kernel/trace/trace_kprobe.c +2 −4
  1068. kernel/trace/trace_syscalls.c +19 −15
  1069. kernel/trace/trace_uprobe.c +1 −2
  1070. lib/dynamic_queue_limits.c +1 −2
  1071. lib/kobject_uevent.c +51 −43
  1072. lib/nlattr.c +16 −3
  1073. lib/once.c +4 −4
  1074. lib/test_rhashtable.c +270 −23
  1075. net/8021q/vlan.c +6 −3
  1076. net/8021q/vlan.h +1 −1
  1077. net/8021q/vlan_netlink.c +2 −1
  1078. net/atm/clip.c +2 −2
  1079. net/atm/lec.c +9 −10
  1080. net/atm/mpc.c +6 −5
  1081. net/ax25/af_ax25.c +3 −4
  1082. net/ax25/ax25_ds_timer.c +4 −5
  1083. net/ax25/ax25_timer.c +20 −21
  1084. net/batman-adv/bat_iv_ogm.c +12 −12
  1085. net/batman-adv/bat_v.c +5 −6
  1086. net/batman-adv/bat_v_elp.c +3 −3
  1087. net/batman-adv/bat_v_ogm.c +6 −6
  1088. net/batman-adv/distributed-arp-table.c +2 −2
  1089. net/batman-adv/gateway_client.c +4 −4
  1090. net/batman-adv/gateway_common.c +9 −9
  1091. net/batman-adv/hard-interface.c +7 −7
  1092. net/batman-adv/icmp_socket.c +2 −2
  1093. net/batman-adv/main.c +6 −6
  1094. net/batman-adv/main.h +1 −1
  1095. net/batman-adv/multicast.c +1 −1
  1096. net/batman-adv/originator.c +13 −13
  1097. net/batman-adv/routing.c +3 −3
  1098. net/batman-adv/send.c +3 −3
  1099. net/batman-adv/soft-interface.c +6 −4
  1100. net/batman-adv/sysfs.c +2 −2
  1101. net/batman-adv/tp_meter.c +1 −1
  1102. net/bluetooth/a2mp.c +1 −1
  1103. net/bluetooth/amp.c +2 −2
  1104. net/bluetooth/ecdh_helper.c +116 −112
  1105. net/bluetooth/ecdh_helper.h +6 −3
  1106. net/bluetooth/hci_conn.c +3 −3
  1107. net/bluetooth/hci_core.c +17 −18
  1108. net/bluetooth/hci_event.c +24 −22
  1109. net/bluetooth/hci_request.c +14 −7
  1110. net/bluetooth/hci_request.h +1 −0
  1111. net/bluetooth/hci_sock.c +11 −6
  1112. net/bluetooth/hci_sysfs.c +1 −1
  1113. net/bluetooth/mgmt.c +31 −26
  1114. net/bluetooth/selftest.c +37 −11
  1115. net/bluetooth/smp.c +93 −56
  1116. net/bpf/test_run.c +2 −1
  1117. net/bridge/Makefile +1 −1
  1118. net/bridge/br.c +1 −1
  1119. net/bridge/br_arp_nd_proxy.c +469 −0
  1120. net/bridge/br_device.c +24 −3
  1121. net/bridge/br_forward.c +1 −1
  1122. net/bridge/br_if.c +18 −6
  1123. net/bridge/br_input.c +18 −59
  1124. net/bridge/br_ioctl.c +2 −2
  1125. net/bridge/br_mdb.c +50 −4
  1126. net/bridge/br_multicast.c +94 −47
  1127. net/bridge/br_netlink.c +84 −45
  1128. net/bridge/br_netlink_tunnel.c +9 −5
  1129. net/bridge/br_private.h +32 −8
  1130. net/bridge/br_private_tunnel.h +2 −1
  1131. net/bridge/br_stp.c +3 −3
  1132. net/bridge/br_stp_if.c +2 −2
  1133. net/bridge/br_stp_timer.c +20 −30
  1134. net/bridge/br_sysfs_if.c +21 −1
  1135. net/bridge/br_vlan.c +57 −21
  1136. net/bridge/netfilter/ebtables.c +1 −2
  1137. net/can/af_can.c +2 −2
  1138. net/can/af_can.h +1 −1
  1139. net/can/proc.c +4 −4
  1140. net/core/datagram.c +1 −1
  1141. net/core/dev.c +216 −127
  1142. net/core/dst.c +16 −0
  1143. net/core/ethtool.c +16 −0
  1144. net/core/fib_notifier.c +9 −1
  1145. net/core/fib_rules.c +12 −3
  1146. net/core/filter.c +280 −56
  1147. net/core/flow_dissector.c +115 −15
  1148. net/core/lwt_bpf.c +1 −1
  1149. net/core/neighbour.c +9 −9
  1150. net/core/net-sysfs.c +19 −9
  1151. net/core/net-traces.c +3 −0
  1152. net/core/net_namespace.c +1 −0
  1153. net/core/pktgen.c +12 −4
  1154. net/core/rtnetlink.c +304 −144
  1155. net/core/skbuff.c +31 −26
  1156. net/core/sock.c +8 −27
  1157. net/dccp/ccids/ccid2.c +5 −5
  1158. net/dccp/ccids/ccid2.h +1 −0
  1159. net/dccp/ccids/ccid3.c +6 −5
  1160. net/dccp/ccids/ccid3.h +1 −0
  1161. net/dccp/ccids/lib/packet_history.c +1 −3
  1162. net/dccp/input.c +1 −0
  1163. net/dccp/options.c +1 −1
  1164. net/dccp/timer.c +17 −13
  1165. net/decnet/af_decnet.c +3 −4
  1166. net/decnet/dn_dev.c +5 −7
  1167. net/decnet/dn_nsp_in.c +2 −6
  1168. net/decnet/dn_nsp_out.c +2 −16
  1169. net/decnet/dn_route.c +4 −4
  1170. net/decnet/dn_table.c +1 −0
  1171. net/dsa/Kconfig +4 −0
  1172. net/dsa/Makefile +2 −1
  1173. net/dsa/dsa.c +32 −73
  1174. net/dsa/dsa2.c +428 −481
  1175. net/dsa/dsa_priv.h +50 −21
  1176. net/dsa/legacy.c +31 −54
  1177. net/dsa/master.c +143 −0
  1178. net/dsa/port.c +99 −6
  1179. net/dsa/slave.c +256 −345
  1180. net/dsa/switch.c +1 −1
  1181. net/dsa/tag_brcm.c +69 −21
  1182. net/dsa/tag_dsa.c +8 −20
  1183. net/dsa/tag_edsa.c +8 −20
  1184. net/dsa/tag_ksz.c +5 −8
  1185. net/dsa/tag_lan9303.c +33 −22
  1186. net/dsa/tag_mtk.c +5 −15
  1187. net/dsa/tag_qca.c +5 −17
  1188. net/dsa/tag_trailer.c +5 −8
  1189. net/hsr/hsr_device.c +4 −5
  1190. net/hsr/hsr_framereg.c +2 −4
  1191. net/hsr/hsr_framereg.h +1 −1
  1192. net/ieee802154/6lowpan/reassembly.c +3 −2
  1193. net/ieee802154/netlink.c +3 −3
  1194. net/ipv4/af_inet.c +7 −5
  1195. net/ipv4/arp.c +1 −0
  1196. net/ipv4/devinet.c +26 −17
  1197. net/ipv4/fib_frontend.c +29 −5
  1198. net/ipv4/fib_semantics.c +5 −14
  1199. net/ipv4/fib_trie.c +18 −24
  1200. net/ipv4/icmp.c +15 −5
  1201. net/ipv4/inet_connection_sock.c +27 −30
  1202. net/ipv4/inet_fragment.c +2 −2
  1203. net/ipv4/inet_timewait_sock.c +3 −4
  1204. net/ipv4/inetpeer.c +7 −4
  1205. net/ipv4/ip_fragment.c +3 −2
  1206. net/ipv4/ip_gre.c +66 −22
  1207. net/ipv4/ip_tunnel.c +9 −3
  1208. net/ipv4/ip_vti.c +3 −13
  1209. net/ipv4/ipip.c +3 −4
  1210. net/ipv4/ipmr.c +252 −10
  1211. net/ipv4/netfilter/arp_tables.c +20 −2
  1212. net/ipv4/netfilter/ip_tables.c +21 −2
  1213. net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +1 −1
  1214. net/ipv4/netfilter/nf_conntrack_proto_icmp.c +16 −12
  1215. net/ipv4/netfilter/nf_nat_l3proto_ipv4.c +2 −1
  1216. net/ipv4/proc.c +0 −1
  1217. net/ipv4/route.c +2 −3
  1218. net/ipv4/syncookies.c +1 −1
  1219. net/ipv4/sysctl_net_ipv4.c +271 −249
  1220. net/ipv4/tcp.c +132 −35
  1221. net/ipv4/tcp_cdg.c +1 −1
  1222. net/ipv4/tcp_cong.c +36 −40
  1223. net/ipv4/tcp_fastopen.c +101 −59
  1224. net/ipv4/tcp_input.c +266 −331
  1225. net/ipv4/tcp_ipv4.c +64 −5
  1226. net/ipv4/tcp_metrics.c +11 −11
  1227. net/ipv4/tcp_minisocks.c +29 −12
  1228. net/ipv4/tcp_nv.c +42 −5
  1229. net/ipv4/tcp_output.c +192 −132
  1230. net/ipv4/tcp_recovery.c +65 −37
  1231. net/ipv4/tcp_timer.c +41 −36
  1232. net/ipv4/tcp_vegas.c +1 −1
  1233. net/ipv4/udp.c +1 −2
  1234. net/ipv6/addrconf.c +200 −181
  1235. net/ipv6/addrconf_core.c +5 −4
  1236. net/ipv6/addrlabel.c +45 −101
  1237. net/ipv6/af_inet6.c +4 −0
  1238. net/ipv6/ah6.c +1 −0
  1239. net/ipv6/esp6.c +4 −4
  1240. net/ipv6/exthdrs.c +57 −16
  1241. net/ipv6/exthdrs_core.c +1 −4
  1242. net/ipv6/icmp.c +20 −30
  1243. net/ipv6/ila/ila.h +1 −11
  1244. net/ipv6/ila/ila_common.c +57 −47
  1245. net/ipv6/ila/ila_lwt.c +91 −20
  1246. net/ipv6/ila/ila_xlat.c +18 −8
  1247. net/ipv6/ip6_fib.c +370 −297
  1248. net/ipv6/ip6_gre.c +12 −16
  1249. net/ipv6/ip6_tunnel.c +42 −47
  1250. net/ipv6/ip6_vti.c +14 −9
  1251. net/ipv6/ip6mr.c +5 −0
  1252. net/ipv6/ipv6_sockglue.c +12 −0
  1253. net/ipv6/ndisc.c +13 −5
  1254. net/ipv6/netfilter/ip6_tables.c +20 −2
  1255. net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +1 −1
  1256. net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +15 −9
  1257. net/ipv6/netfilter/nf_conntrack_reasm.c +3 −2
  1258. net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +2 −1
  1259. net/ipv6/output_core.c +0 −31
  1260. net/ipv6/ping.c +2 −3
  1261. net/ipv6/raw.c +4 −0
  1262. net/ipv6/reassembly.c +3 −2
  1263. net/ipv6/route.c +766 −174
  1264. net/ipv6/sit.c +27 −13
  1265. net/ipv6/syncookies.c +1 −1
  1266. net/ipv6/sysctl_net_ipv6.c +32 −0
  1267. net/ipv6/tcp_ipv6.c +12 −5
  1268. net/ipv6/xfrm6_policy.c +1 −0
  1269. net/ipv6/xfrm6_tunnel.c +8 −0
  1270. net/ipx/af_ipx.c +1 −0
  1271. net/kcm/kcmsock.c +1 −1
  1272. net/key/af_key.c +1 −1
  1273. net/l2tp/l2tp_core.c +16 −67
  1274. net/l2tp/l2tp_core.h +8 −29
  1275. net/l2tp/l2tp_debugfs.c +1 −3
  1276. net/l2tp/l2tp_eth.c +76 −30
  1277. net/l2tp/l2tp_ip.c +1 −3
  1278. net/l2tp/l2tp_ip6.c +1 −3
  1279. net/l2tp/l2tp_netlink.c +10 −14
  1280. net/l2tp/l2tp_ppp.c +165 −155
  1281. net/lapb/lapb_iface.c +2 −2
  1282. net/lapb/lapb_timer.c +8 −10
  1283. net/llc/llc_c_ac.c +17 −10
  1284. net/llc/llc_conn.c +4 −8
  1285. net/mac80211/Makefile +1 −2
  1286. net/mac80211/aead_api.c +20 −20
  1287. net/mac80211/aead_api.h +27 −0
  1288. net/mac80211/aes_ccm.h +31 −11
  1289. net/mac80211/aes_gcm.c +0 −109
  1290. net/mac80211/aes_gcm.h +30 −8
  1291. net/mac80211/agg-rx.c +2 −2
  1292. net/mac80211/ht.c +7 −5
  1293. net/mac80211/ieee80211_i.h +2 −0
  1294. net/mac80211/iface.c +6 −23
  1295. net/mac80211/mesh.c +1 −2
  1296. net/mac80211/mesh.h +1 −0
  1297. net/mac80211/mesh_hwmp.c +4 −4
  1298. net/mac80211/mesh_plink.c +5 −8
  1299. net/mac80211/mlme.c +10 −23
  1300. net/mac80211/scan.c +28 −9
  1301. net/mac80211/sta_info.c +35 −26
  1302. net/mac80211/sta_info.h +3 −1
  1303. net/mac80211/tx.c +34 −0
  1304. net/mac80211/util.c +11 −14
  1305. net/mac80211/vht.c +10 −0
  1306. net/mac80211/wpa.c +2 −2
  1307. net/mac802154/llsec.c +10 −4
  1308. net/mpls/Kconfig +1 −0
  1309. net/mpls/af_mpls.c +36 −0
  1310. net/ncsi/ncsi-aen.c +14 −1
  1311. net/ncsi/ncsi-manage.c +58 −20
  1312. net/ncsi/ncsi-rsp.c +23 −18
  1313. net/netfilter/ipset/ip_set_bitmap_gen.h +5 −5
  1314. net/netfilter/ipset/ip_set_bitmap_ip.c +2 −0
  1315. net/netfilter/ipset/ip_set_bitmap_ipmac.c +2 −0
  1316. net/netfilter/ipset/ip_set_bitmap_port.c +2 −0
  1317. net/netfilter/ipset/ip_set_hash_gen.h +7 −5
  1318. net/netfilter/ipset/ip_set_hash_ipportnet.c +1 −1
  1319. net/netfilter/ipset/ip_set_list_set.c +8 −9
  1320. net/netfilter/ipset/pfxlen.c +137 −258
  1321. net/netfilter/ipvs/ip_vs_conn.c +1 −1
  1322. net/netfilter/ipvs/ip_vs_ctl.c +6 −2
  1323. net/netfilter/nf_conntrack_core.c +10 −5
  1324. net/netfilter/nf_conntrack_h323_asn1.c +41 −40
  1325. net/netfilter/nf_conntrack_netlink.c +7 −3
  1326. net/netfilter/nf_conntrack_proto.c +82 −4
  1327. net/netfilter/nf_conntrack_proto_dccp.c +6 −15
  1328. net/netfilter/nf_conntrack_proto_generic.c +0 −1
  1329. net/netfilter/nf_conntrack_proto_gre.c +0 −1
  1330. net/netfilter/nf_conntrack_proto_sctp.c +1 −3
  1331. net/netfilter/nf_conntrack_proto_tcp.c +28 −34
  1332. net/netfilter/nf_conntrack_proto_udp.c +19 −22
  1333. net/netfilter/nf_nat_core.c +3 −6
  1334. net/netfilter/nf_tables_api.c +132 −63
  1335. net/netfilter/nft_ct.c +3 −36
  1336. net/netfilter/nft_set_bitmap.c +18 −0
  1337. net/netfilter/nft_set_hash.c +40 −1
  1338. net/netfilter/nft_set_rbtree.c +73 −0
  1339. net/netfilter/x_tables.c +18 −3
  1340. net/netfilter/xt_bpf.c +1 −1
  1341. net/netfilter/xt_connlimit.c +20 −35
  1342. net/netlink/af_netlink.c +22 −26
  1343. net/netlink/af_netlink.h +1 −0
  1344. net/netrom/af_netrom.c +3 −3
  1345. net/netrom/nr_in.c +1 −1
  1346. net/netrom/nr_route.c +19 −43
  1347. net/netrom/nr_timer.c +24 −24
  1348. net/nfc/core.c +4 −7
  1349. net/nfc/digital_core.c +1 −0
  1350. net/nfc/hci/core.c +3 −5
  1351. net/nfc/hci/llc_shdlc.c +9 −17
  1352. net/nfc/llcp_core.c +6 −10
  1353. net/nfc/netlink.c +29 −0
  1354. net/nsh/nsh.c +60 −0
  1355. net/openvswitch/Kconfig +1 −0
  1356. net/openvswitch/Makefile +1 −0
  1357. net/openvswitch/actions.c +126 −0
  1358. net/openvswitch/conntrack.c +12 −0
  1359. net/openvswitch/conntrack.h +7 −0
  1360. net/openvswitch/datapath.c +46 −44
  1361. net/openvswitch/datapath.h +37 −2
  1362. net/openvswitch/dp_notify.c +2 −2
  1363. net/openvswitch/flow.c +51 −0
  1364. net/openvswitch/flow.h +7 −0
  1365. net/openvswitch/flow_netlink.c +402 −3
  1366. net/openvswitch/flow_netlink.h +5 −0
  1367. net/openvswitch/meter.c +597 −0
  1368. net/openvswitch/meter.h +54 −0
  1369. net/openvswitch/vport-netdev.c +2 −1
  1370. net/packet/af_packet.c +8 −17
  1371. net/phonet/af_phonet.c +9 −8
  1372. net/phonet/datagram.c +1 −1
  1373. net/phonet/pep.c +1 −1
  1374. net/phonet/pn_dev.c +3 −0
  1375. net/qrtr/qrtr.c +206 −171
  1376. net/rds/ib.c +6 −5
  1377. net/rds/ib.h +0 −2
  1378. net/rds/ib_rdma.c +2 −2
  1379. net/rose/af_rose.c +9 −8
  1380. net/rose/rose_in.c +1 −0
  1381. net/rose/rose_link.c +7 −9
  1382. net/rose/rose_loopback.c +3 −6
  1383. net/rose/rose_route.c +6 −4
  1384. net/rose/rose_timer.c +17 −22
  1385. net/rxrpc/af_rxrpc.c +41 −1
  1386. net/rxrpc/ar-internal.h +1 −0
  1387. net/rxrpc/call_event.c +1 −1
  1388. net/rxrpc/call_object.c +1 −0
  1389. net/rxrpc/input.c +1 −2
  1390. net/rxrpc/output.c +15 −4
  1391. net/rxrpc/peer_object.c +13 −0
  1392. net/rxrpc/recvmsg.c +6 −1
  1393. net/rxrpc/sendmsg.c +82 −26
  1394. net/sched/Kconfig +11 −0
  1395. net/sched/Makefile +1 −0
  1396. net/sched/act_api.c +221 −0
  1397. net/sched/act_bpf.c +2 −2
  1398. net/sched/act_ife.c +95 −58
  1399. net/sched/act_meta_mark.c +1 −1
  1400. net/sched/act_meta_skbprio.c +1 −1
  1401. net/sched/act_meta_skbtcindex.c +1 −1
  1402. net/sched/act_mirred.c +5 −8
  1403. net/sched/act_vlan.c +55 −26
  1404. net/sched/cls_api.c +264 −54
  1405. net/sched/cls_basic.c +22 −16
  1406. net/sched/cls_bpf.c +56 −43
  1407. net/sched/cls_flow.c +8 −6
  1408. net/sched/cls_flower.c +20 −56
  1409. net/sched/cls_fw.c +4 −1
  1410. net/sched/cls_matchall.c +30 −28
  1411. net/sched/cls_tcindex.c +4 −1
  1412. net/sched/cls_u32.c +105 −82
  1413. net/sched/ematch.c +1 −1
  1414. net/sched/sch_api.c +5 −4
  1415. net/sched/sch_atm.c +2 −2
  1416. net/sched/sch_cbq.c +2 −1
  1417. net/sched/sch_cbs.c +373 −0
  1418. net/sched/sch_drr.c +2 −1
  1419. net/sched/sch_dsmark.c +1 −1
  1420. net/sched/sch_fq_codel.c +2 −1
  1421. net/sched/sch_generic.c +58 −12
  1422. net/sched/sch_hfsc.c +3 −2
  1423. net/sched/sch_htb.c +8 −2
  1424. net/sched/sch_ingress.c +42 −7
  1425. net/sched/sch_mq.c +1 −9
  1426. net/sched/sch_mqprio.c +230 −43
  1427. net/sched/sch_multiq.c +2 −1
  1428. net/sched/sch_netem.c +121 −46
  1429. net/sched/sch_pie.c +6 −4
  1430. net/sched/sch_prio.c +2 −1
  1431. net/sched/sch_qfq.c +2 −1
  1432. net/sched/sch_red.c +89 −4
  1433. net/sched/sch_sfb.c +2 −1
  1434. net/sched/sch_sfq.c +7 −6
  1435. net/sctp/Makefile +2 −1
  1436. net/sctp/associola.c +1 −2
  1437. net/sctp/chunk.c +3 −3
  1438. net/sctp/outqueue.c +34 −29
  1439. net/sctp/protocol.c +3 −4
  1440. net/sctp/sm_sideeffect.c +55 −33
  1441. net/sctp/socket.c +173 −6
  1442. net/sctp/stream.c +166 −36
  1443. net/sctp/stream_sched.c +275 −0
  1444. net/sctp/stream_sched_prio.c +347 −0
  1445. net/sctp/stream_sched_rr.c +201 −0
  1446. net/sctp/transport.c +5 −8
  1447. net/smc/af_smc.c +31 −11
  1448. net/smc/smc_cdc.c +4 −3
  1449. net/smc/smc_cdc.h +2 −1
  1450. net/smc/smc_close.c +2 −1
  1451. net/smc/smc_core.c +8 −4
  1452. net/smc/smc_ib.c +9 −17
  1453. net/smc/smc_tx.c +2 −4
  1454. net/sunrpc/sched.c +4 −4
  1455. net/sunrpc/svc.c +1 −1
  1456. net/sunrpc/svc_xprt.c +4 −5
  1457. net/sunrpc/xprt.c +4 −5
  1458. net/switchdev/switchdev.c +2 −0
  1459. net/tipc/Makefile +1 −1
  1460. net/tipc/bcast.c +9 −9
  1461. net/tipc/core.h +5 −0
  1462. net/tipc/discover.c +3 −3
  1463. net/tipc/group.c +871 −0
  1464. net/tipc/group.h +73 −0
  1465. net/tipc/link.c +21 −13
  1466. net/tipc/monitor.c +13 −4
  1467. net/tipc/msg.c +7 −0
  1468. net/tipc/msg.h +120 −8
  1469. net/tipc/name_table.c +119 −57
  1470. net/tipc/name_table.h +20 −8
  1471. net/tipc/node.c +41 −9
  1472. net/tipc/node.h +4 −1
  1473. net/tipc/server.c +94 −27
  1474. net/tipc/server.h +4 −1
  1475. net/tipc/socket.c +651 −194
  1476. net/tipc/subscr.c +3 −3
  1477. net/tls/tls_main.c +57 −39
  1478. net/tls/tls_sw.c +4 −20
  1479. net/unix/af_unix.c +1 −0
  1480. net/vmw_vsock/Kconfig +10 −0
  1481. net/vmw_vsock/Makefile +3 −0
  1482. net/vmw_vsock/af_vsock.c +37 −36
  1483. net/vmw_vsock/diag.c +186 −0
  1484. net/vmw_vsock/hyperv_transport.c +6 −7
  1485. net/vmw_vsock/virtio_transport.c +1 −1
  1486. net/vmw_vsock/virtio_transport_common.c +11 −11
  1487. net/vmw_vsock/vmci_transport.c +17 −18
  1488. net/vmw_vsock/vmci_transport_notify.c +1 −1
  1489. net/vmw_vsock/vmci_transport_notify_qstate.c +1 −1
  1490. net/wireless/.gitignore +2 −1
  1491. net/wireless/Kconfig +34 −24
  1492. net/wireless/Makefile +20 −4
  1493. net/wireless/certs/sforshee.x509 +0 −0
  1494. net/wireless/chan.c +1 −3
  1495. net/wireless/core.c +1 −1
  1496. net/wireless/core.h +5 −0
  1497. net/wireless/db.txt +0 −17
  1498. net/wireless/genregdb.awk +0 −158
  1499. net/wireless/nl80211.c +136 −63
  1500. net/wireless/nl80211.h +2 −0
  1501. net/wireless/reg.c +411 −41
  1502. net/wireless/reg.h +14 −0
  1503. net/wireless/regdb.h +0 −23
  1504. net/wireless/sme.c +44 −1
  1505. net/wireless/util.c +63 −139
  1506. net/x25/af_x25.c +5 −4
  1507. net/x25/x25_facilities.c +1 −1
  1508. net/x25/x25_in.c +1 −0
  1509. net/x25/x25_timer.c +9 −9
  1510. net/xfrm/xfrm_policy.c +8 −9
  1511. net/xfrm/xfrm_user.c +58 −47
  1512. samples/bpf/Makefile +21 −5
  1513. samples/bpf/README.rst +10 −0
  1514. samples/bpf/bpf_load.c +2 −0
  1515. samples/bpf/map_perf_test_kern.c +1 −1
  1516. samples/bpf/map_perf_test_user.c +2 −1
  1517. samples/bpf/syscall_tp_user.c +53 −13
  1518. samples/bpf/tcp_basertt_kern.c +78 −0
  1519. samples/bpf/tcp_bpf.readme +26 −0
  1520. samples/bpf/tcp_bufs_kern.c +8 −6
  1521. samples/bpf/tcp_clamp_kern.c +13 −11
  1522. samples/bpf/tcp_cong_kern.c +4 −2
  1523. samples/bpf/tcp_iw_kern.c +8 −6
  1524. samples/bpf/tcp_rwnd_kern.c +4 −2
  1525. samples/bpf/tcp_synrto_kern.c +4 −2
  1526. samples/bpf/test_cgrp2_attach2.c +219 −5
  1527. samples/bpf/trace_event_kern.c +10 −0
  1528. samples/bpf/trace_event_user.c +8 −5
  1529. samples/bpf/tracex6_kern.c +26 −0
  1530. samples/bpf/tracex6_user.c +12 −1
  1531. samples/bpf/xdp1_user.c +8 −0
  1532. samples/bpf/xdp_monitor_kern.c +46 −14
  1533. samples/bpf/xdp_monitor_user.c +95 −28
  1534. samples/bpf/xdp_redirect_cpu_kern.c +609 −0
  1535. samples/bpf/xdp_redirect_cpu_user.c +697 −0
  1536. samples/bpf/xdp_redirect_map_user.c +7 −0
  1537. samples/bpf/xdp_router_ipv4_kern.c +186 −0
  1538. samples/bpf/xdp_router_ipv4_user.c +660 −0
  1539. samples/pktgen/functions.sh +43 −0
  1540. samples/pktgen/pktgen.conf-1-1-ip6 +0 −61
  1541. samples/pktgen/pktgen.conf-1-1-ip6-rdos +0 −64
  1542. samples/pktgen/pktgen.conf-1-2 +0 −70
  1543. samples/pktgen/pktgen_sample03_burst_single_flow.sh +1 −1
  1544. samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh +97 −0
  1545. scripts/mod/devicetable-offsets.c +7 −0
  1546. scripts/mod/file2alias.c +25 −0
  1547. security/device_cgroup.c +24 −67
  1548. security/security.c +32 −0
  1549. security/selinux/hooks.c +160 −0
  1550. security/selinux/include/classmap.h +2 −0
  1551. security/selinux/include/objsec.h +4 −0
  1552. tools/Makefile +7 −7
  1553. tools/bpf/Makefile +15 −3
  1554. tools/bpf/bpf_asm.c +0 −0
  1555. tools/bpf/bpf_dbg.c +0 −0
  1556. tools/bpf/bpf_exp.l +0 −0
  1557. tools/bpf/bpf_exp.y +0 −0
  1558. tools/bpf/bpf_jit_disasm.c +2 −1
  1559. tools/bpf/bpftool/Documentation/Makefile +34 −0
  1560. tools/bpf/bpftool/Documentation/bpftool-map.rst +131 −0
  1561. tools/bpf/bpftool/Documentation/bpftool-prog.rst +150 −0
  1562. tools/bpf/bpftool/Documentation/bpftool.rst +56 −0
  1563. tools/bpf/bpftool/Makefile +92 −0
  1564. tools/bpf/bpftool/bash-completion/bpftool +354 −0
  1565. tools/bpf/bpftool/common.c +405 −0
  1566. tools/bpf/bpftool/jit_disasm.c +162 −0
  1567. tools/bpf/bpftool/json_writer.c +356 −0
  1568. tools/bpf/bpftool/json_writer.h +72 −0
  1569. tools/bpf/bpftool/main.c +331 −0
  1570. tools/bpf/bpftool/main.h +122 −0
  1571. tools/bpf/bpftool/map.c +899 −0
  1572. tools/bpf/bpftool/prog.c +703 −0
  1573. tools/include/uapi/linux/bpf.h +150 −8
  1574. tools/lib/bpf/bpf.c +76 −13
  1575. tools/lib/bpf/bpf.h +19 −8
  1576. tools/lib/bpf/libbpf.c +124 −55
  1577. tools/lib/bpf/libbpf.h +1 −0
  1578. tools/testing/selftests/bpf/Makefile +19 −6
  1579. tools/testing/selftests/bpf/bpf_helpers.h +60 −7
  1580. tools/testing/selftests/bpf/cgroup_helpers.c +2 −2
  1581. tools/testing/selftests/bpf/cgroup_helpers.h +0 −0
  1582. tools/testing/selftests/bpf/dev_cgroup.c +60 −0
  1583. tools/testing/selftests/bpf/sockmap_parse_prog.c +0 −3
  1584. tools/testing/selftests/bpf/sockmap_verdict_prog.c +0 −2
  1585. tools/testing/selftests/bpf/test_dev_cgroup.c +93 −0
  1586. tools/testing/selftests/bpf/test_lpm_map.c +196 −5
  1587. tools/testing/selftests/bpf/test_maps.c +48 −0
  1588. tools/testing/selftests/bpf/test_progs.c +159 −36
  1589. tools/testing/selftests/bpf/test_verifier.c +959 −105
  1590. tools/testing/selftests/bpf/test_verifier_log.c +171 −0
  1591. tools/testing/selftests/bpf/test_xdp_meta.c +53 −0
  1592. tools/testing/selftests/bpf/test_xdp_meta.sh +51 −0
  1593. tools/testing/selftests/net/rtnetlink.sh +271 −0
  1594. tools/testing/selftests/tc-testing/.gitignore +1 −0
  1595. tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt +12 −0
  1596. tools/testing/selftests/tc-testing/creating-testcases/example.json +55 −0
  1597. tools/testing/selftests/tc-testing/creating-testcases/template.json +13 −2
  1598. tools/testing/selftests/tc-testing/tc-tests/actions/gact.json +469 −0
  1599. tools/testing/selftests/tc-testing/tc-tests/actions/ife.json +52 −0
  1600. tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json +223 −0
  1601. tools/testing/selftests/tc-testing/tc-tests/actions/police.json +527 −0
  1602. tools/testing/selftests/tc-testing/tc-tests/actions/simple.json +130 −0
  1603. tools/testing/selftests/tc-testing/tc-tests/actions/skbedit.json +320 −0
  1604. tools/testing/selftests/tc-testing/tc-tests/actions/skbmod.json +372 −0
  1605. tools/testing/selftests/tc-testing/tc-tests/actions/tests.json +0 −1165
  1606. tools/testing/selftests/tc-testing/tdc.py +17 −12
  1607. tools/testing/selftests/tc-testing/tdc_config.py +14 −0
  1608. tools/testing/selftests/tc-testing/tdc_config_local_template.py +23 −0
  1609. tools/testing/selftests/tc-testing/tdc_helper.py +2 −2
  1610. tools/testing/vsock/.gitignore +2 −0
  1611. tools/testing/vsock/Makefile +9 −0
  1612. tools/testing/vsock/README +36 −0
  1613. tools/testing/vsock/control.c +219 −0
  1614. tools/testing/vsock/control.h +13 −0
  1615. tools/testing/vsock/timeout.c +64 −0
  1616. tools/testing/vsock/timeout.h +14 −0
  1617. tools/testing/vsock/vsock_diag_test.c +681 −0
Documentation/ABI/testing/sysfs-bus-thunderbolt+48−0
@@ -110,3 +110,51 @@ Description: When new NVM image is written to the non-active NVM · 109 unmodified lines
110 is directly the status value from the DMA configuration110 is directly the status value from the DMA configuration
111 based mailbox before the device is power cycled. Writing111 based mailbox before the device is power cycled. Writing
112 0 here clears the status.112 0 here clears the status.
113
114What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/key
115Date: Jan 2018
116KernelVersion: 4.15
117Contact: thunderbolt-software@lists.01.org
118Description: This contains name of the property directory the XDomain
119 service exposes. This entry describes the protocol in
120 question. Following directories are already reserved by
121 the Apple XDomain specification:
122
123 network: IP/ethernet over Thunderbolt
124 targetdm: Target disk mode protocol over Thunderbolt
125 extdisp: External display mode protocol over Thunderbolt
126
127What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/modalias
128Date: Jan 2018
129KernelVersion: 4.15
130Contact: thunderbolt-software@lists.01.org
131Description: Stores the same MODALIAS value emitted by uevent for
132 the XDomain service. Format: tbtsvc:kSpNvNrN
133
134What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcid
135Date: Jan 2018
136KernelVersion: 4.15
137Contact: thunderbolt-software@lists.01.org
138Description: This contains XDomain protocol identifier the XDomain
139 service supports.
140
141What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcvers
142Date: Jan 2018
143KernelVersion: 4.15
144Contact: thunderbolt-software@lists.01.org
145Description: This contains XDomain protocol version the XDomain
146 service supports.
147
148What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcrevs
149Date: Jan 2018
150KernelVersion: 4.15
151Contact: thunderbolt-software@lists.01.org
152Description: This contains XDomain software version the XDomain
153 service supports.
154
155What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcstns
156Date: Jan 2018
157KernelVersion: 4.15
158Contact: thunderbolt-software@lists.01.org
159Description: This contains XDomain service specific settings as
160 bitmask. Format: %x
Documentation/admin-guide/thunderbolt.rst+24−0
@@ -197,3 +197,27 @@ information is missing. · 196 unmodified lines
197 197
198To recover from this mode, one needs to flash a valid NVM image to the198To recover from this mode, one needs to flash a valid NVM image to the
199host host controller in the same way it is done in the previous chapter.199host host controller in the same way it is done in the previous chapter.
200
201Networking over Thunderbolt cable
202---------------------------------
203Thunderbolt technology allows software communication across two hosts
204connected by a Thunderbolt cable.
205
206It is possible to tunnel any kind of traffic over Thunderbolt link but
207currently we only support Apple ThunderboltIP protocol.
208
209If the other host is running Windows or macOS only thing you need to
210do is to connect Thunderbolt cable between the two hosts, the
211``thunderbolt-net`` is loaded automatically. If the other host is also
212Linux you should load ``thunderbolt-net`` manually on one host (it does
213not matter which one)::
214
215 # modprobe thunderbolt-net
216
217This triggers module load on the other host automatically. If the driver
218is built-in to the kernel image, there is no need to do anything.
219
220The driver will create one virtual ethernet interface per Thunderbolt
221port which are named like ``thunderbolt0`` and so on. From this point
222you can either use standard userspace tools like ``ifconfig`` to
223configure the interface or let your GUI to handle it automatically.
Documentation/bpf/bpf_design_QA.txt+156−0
@@ -0,0 +1,156 @@
1BPF extensibility and applicability to networking, tracing, security
2in the linux kernel and several user space implementations of BPF
3virtual machine led to a number of misunderstanding on what BPF actually is.
4This short QA is an attempt to address that and outline a direction
5of where BPF is heading long term.
6
7Q: Is BPF a generic instruction set similar to x64 and arm64?
8A: NO.
9
10Q: Is BPF a generic virtual machine ?
11A: NO.
12
13BPF is generic instruction set _with_ C calling convention.
14
15Q: Why C calling convention was chosen?
16A: Because BPF programs are designed to run in the linux kernel
17 which is written in C, hence BPF defines instruction set compatible
18 with two most used architectures x64 and arm64 (and takes into
19 consideration important quirks of other architectures) and
20 defines calling convention that is compatible with C calling
21 convention of the linux kernel on those architectures.
22
23Q: can multiple return values be supported in the future?
24A: NO. BPF allows only register R0 to be used as return value.
25
26Q: can more than 5 function arguments be supported in the future?
27A: NO. BPF calling convention only allows registers R1-R5 to be used
28 as arguments. BPF is not a standalone instruction set.
29 (unlike x64 ISA that allows msft, cdecl and other conventions)
30
31Q: can BPF programs access instruction pointer or return address?
32A: NO.
33
34Q: can BPF programs access stack pointer ?
35A: NO. Only frame pointer (register R10) is accessible.
36 From compiler point of view it's necessary to have stack pointer.
37 For example LLVM defines register R11 as stack pointer in its
38 BPF backend, but it makes sure that generated code never uses it.
39
40Q: Does C-calling convention diminishes possible use cases?
41A: YES. BPF design forces addition of major functionality in the form
42 of kernel helper functions and kernel objects like BPF maps with
43 seamless interoperability between them. It lets kernel call into
44 BPF programs and programs call kernel helpers with zero overhead.
45 As all of them were native C code. That is particularly the case
46 for JITed BPF programs that are indistinguishable from
47 native kernel C code.
48
49Q: Does it mean that 'innovative' extensions to BPF code are disallowed?
50A: Soft yes. At least for now until BPF core has support for
51 bpf-to-bpf calls, indirect calls, loops, global variables,
52 jump tables, read only sections and all other normal constructs
53 that C code can produce.
54
55Q: Can loops be supported in a safe way?
56A: It's not clear yet. BPF developers are trying to find a way to
57 support bounded loops where the verifier can guarantee that
58 the program terminates in less than 4096 instructions.
59
60Q: How come LD_ABS and LD_IND instruction are present in BPF whereas
61 C code cannot express them and has to use builtin intrinsics?
62A: This is artifact of compatibility with classic BPF. Modern
63 networking code in BPF performs better without them.
64 See 'direct packet access'.
65
66Q: It seems not all BPF instructions are one-to-one to native CPU.
67 For example why BPF_JNE and other compare and jumps are not cpu-like?
68A: This was necessary to avoid introducing flags into ISA which are
69 impossible to make generic and efficient across CPU architectures.
70
71Q: why BPF_DIV instruction doesn't map to x64 div?
72A: Because if we picked one-to-one relationship to x64 it would have made
73 it more complicated to support on arm64 and other archs. Also it
74 needs div-by-zero runtime check.
75
76Q: why there is no BPF_SDIV for signed divide operation?
77A: Because it would be rarely used. llvm errors in such case and
78 prints a suggestion to use unsigned divide instead
79
80Q: Why BPF has implicit prologue and epilogue?
81A: Because architectures like sparc have register windows and in general
82 there are enough subtle differences between architectures, so naive
83 store return address into stack won't work. Another reason is BPF has
84 to be safe from division by zero (and legacy exception path
85 of LD_ABS insn). Those instructions need to invoke epilogue and
86 return implicitly.
87
88Q: Why BPF_JLT and BPF_JLE instructions were not introduced in the beginning?
89A: Because classic BPF didn't have them and BPF authors felt that compiler
90 workaround would be acceptable. Turned out that programs lose performance
91 due to lack of these compare instructions and they were added.
92 These two instructions is a perfect example what kind of new BPF
93 instructions are acceptable and can be added in the future.
94 These two already had equivalent instructions in native CPUs.
95 New instructions that don't have one-to-one mapping to HW instructions
96 will not be accepted.
97
98Q: BPF 32-bit subregisters have a requirement to zero upper 32-bits of BPF
99 registers which makes BPF inefficient virtual machine for 32-bit
100 CPU architectures and 32-bit HW accelerators. Can true 32-bit registers
101 be added to BPF in the future?
102A: NO. The first thing to improve performance on 32-bit archs is to teach
103 LLVM to generate code that uses 32-bit subregisters. Then second step
104 is to teach verifier to mark operations where zero-ing upper bits
105 is unnecessary. Then JITs can take advantage of those markings and
106 drastically reduce size of generated code and improve performance.
107
108Q: Does BPF have a stable ABI?
109A: YES. BPF instructions, arguments to BPF programs, set of helper
110 functions and their arguments, recognized return codes are all part
111 of ABI. However when tracing programs are using bpf_probe_read() helper
112 to walk kernel internal datastructures and compile with kernel
113 internal headers these accesses can and will break with newer
114 kernels. The union bpf_attr -> kern_version is checked at load time
115 to prevent accidentally loading kprobe-based bpf programs written
116 for a different kernel. Networking programs don't do kern_version check.
117
118Q: How much stack space a BPF program uses?
119A: Currently all program types are limited to 512 bytes of stack
120 space, but the verifier computes the actual amount of stack used
121 and both interpreter and most JITed code consume necessary amount.
122
123Q: Can BPF be offloaded to HW?
124A: YES. BPF HW offload is supported by NFP driver.
125
126Q: Does classic BPF interpreter still exist?
127A: NO. Classic BPF programs are converted into extend BPF instructions.
128
129Q: Can BPF call arbitrary kernel functions?
130A: NO. BPF programs can only call a set of helper functions which
131 is defined for every program type.
132
133Q: Can BPF overwrite arbitrary kernel memory?
134A: NO. Tracing bpf programs can _read_ arbitrary memory with bpf_probe_read()
135 and bpf_probe_read_str() helpers. Networking programs cannot read
136 arbitrary memory, since they don't have access to these helpers.
137 Programs can never read or write arbitrary memory directly.
138
139Q: Can BPF overwrite arbitrary user memory?
140A: Sort-of. Tracing BPF programs can overwrite the user memory
141 of the current task with bpf_probe_write_user(). Every time such
142 program is loaded the kernel will print warning message, so
143 this helper is only useful for experiments and prototypes.
144 Tracing BPF programs are root only.
145
146Q: When bpf_trace_printk() helper is used the kernel prints nasty
147 warning message. Why is that?
148A: This is done to nudge program authors into better interfaces when
149 programs need to pass data to user space. Like bpf_perf_event_output()
150 can be used to efficiently stream data via perf ring buffer.
151 BPF maps can be used for asynchronous data sharing between kernel
152 and user space. bpf_trace_printk() should only be used for debugging.
153
154Q: Can BPF functionality such as new program or map types, new
155 helpers, etc be added out of kernel module code?
156A: NO.
Documentation/devicetree/bindings/net/bluetooth.txt+5−0
@@ -0,0 +1,5 @@
1The following properties are common to the Bluetooth controllers:
2
3- local-bd-address: array of 6 bytes, specifies the BD address that was
4 uniquely assigned to the Bluetooth device, formatted with least significant
5 byte first (little-endian).
Documentation/devicetree/bindings/net/dsa/lan9303.txt+2−2
@@ -52,7 +52,7 @@ I2C managed mode: · 51 unmodified lines
52 52
53 port@1 { /* external port 1 */53 port@1 { /* external port 1 */
54 reg = <1>;54 reg = <1>;
55 label = "lan1;55 label = "lan1";
56 };56 };
57 57
58 port@2 { /* external port 2 */58 port@2 { /* external port 2 */
@@ -89,7 +89,7 @@ MDIO managed mode: · 30 unmodified lines
89 89
90 port@1 { /* external port 1 */90 port@1 { /* external port 1 */
91 reg = <1>;91 reg = <1>;
92 label = "lan1;92 label = "lan1";
93 };93 };
94 94
95 port@2 { /* external port 2 */95 port@2 { /* external port 2 */
Documentation/devicetree/bindings/net/fsl-fec.txt+13−0
@@ -34,6 +34,19 @@ Optional properties: · 33 unmodified lines
34- fsl,err006687-workaround-present: If present indicates that the system has34- fsl,err006687-workaround-present: If present indicates that the system has
35 the hardware workaround for ERR006687 applied and does not need a software35 the hardware workaround for ERR006687 applied and does not need a software
36 workaround.36 workaround.
37 -interrupt-names: names of the interrupts listed in interrupts property in
38 the same order. The defaults if not specified are
39 __Number of interrupts__ __Default__
40 1 "int0"
41 2 "int0", "pps"
42 3 "int0", "int1", "int2"
43 4 "int0", "int1", "int2", "pps"
44 The order may be changed as long as they correspond to the interrupts
45 property. Currently, only i.mx7 uses "int1" and "int2". They correspond to
46 tx/rx queues 1 and 2. "int0" will be used for queue 0 and ENET_MII interrupts.
47 For imx6sx, "int0" handles all 3 queues and ENET_MII. "pps" is for the pulse
48 per second interrupt associated with 1588 precision time protocol(PTP).
49
37 50
38Optional subnodes:51Optional subnodes:
39- mdio : specifies the mdio bus in the FEC, used as a container for phy nodes52- mdio : specifies the mdio bus in the FEC, used as a container for phy nodes
Documentation/devicetree/bindings/net/renesas,ravb.txt+3−1
@@ -17,6 +17,8 @@ Required properties: · 16 unmodified lines
17 17
18 - "renesas,etheravb-r8a7795" for the R8A7795 SoC.18 - "renesas,etheravb-r8a7795" for the R8A7795 SoC.
19 - "renesas,etheravb-r8a7796" for the R8A7796 SoC.19 - "renesas,etheravb-r8a7796" for the R8A7796 SoC.
20 - "renesas,etheravb-r8a77970" for the R8A77970 SoC.
21 - "renesas,etheravb-r8a77995" for the R8A77995 SoC.
20 - "renesas,etheravb-rcar-gen3" as a fallback for the above22 - "renesas,etheravb-rcar-gen3" as a fallback for the above
21 R-Car Gen3 devices.23 R-Car Gen3 devices.
22 24
@@ -40,7 +42,7 @@ Optional properties: · 17 unmodified lines
40- interrupt-parent: the phandle for the interrupt controller that services42- interrupt-parent: the phandle for the interrupt controller that services
41 interrupts for this device.43 interrupts for this device.
42- interrupt-names: A list of interrupt names.44- interrupt-names: A list of interrupt names.
43 For the R8A779[56] SoCs this property is mandatory;45 For the R-Car Gen 3 SoCs this property is mandatory;
44 it should include one entry per channel, named "ch%u",46 it should include one entry per channel, named "ch%u",
45 where %u is the channel number ranging from 0 to 24.47 where %u is the channel number ranging from 0 to 24.
46 For other SoCs this property is optional; if present48 For other SoCs this property is optional; if present
Documentation/devicetree/bindings/net/sh_eth.txt+12−2
@@ -4,7 +4,8 @@ This file provides information on what the device node for the SH EtherMAC · 3 unmodified lines
4interface contains.4interface contains.
5 5
6Required properties:6Required properties:
7- compatible: "renesas,gether-r8a7740" if the device is a part of R8A7740 SoC.7- compatible: Must contain one or more of the following:
8 "renesas,gether-r8a7740" if the device is a part of R8A7740 SoC.
8 "renesas,ether-r8a7743" if the device is a part of R8A7743 SoC.9 "renesas,ether-r8a7743" if the device is a part of R8A7743 SoC.
9 "renesas,ether-r8a7745" if the device is a part of R8A7745 SoC.10 "renesas,ether-r8a7745" if the device is a part of R8A7745 SoC.
10 "renesas,ether-r8a7778" if the device is a part of R8A7778 SoC.11 "renesas,ether-r8a7778" if the device is a part of R8A7778 SoC.
@@ -14,6 +15,14 @@ Required properties: · 3 unmodified lines
14 "renesas,ether-r8a7793" if the device is a part of R8A7793 SoC.15 "renesas,ether-r8a7793" if the device is a part of R8A7793 SoC.
15 "renesas,ether-r8a7794" if the device is a part of R8A7794 SoC.16 "renesas,ether-r8a7794" if the device is a part of R8A7794 SoC.
16 "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC.17 "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC.
18 "renesas,rcar-gen1-ether" for a generic R-Car Gen1 device.
19 "renesas,rcar-gen2-ether" for a generic R-Car Gen2 or RZ/G1
20 device.
21
22 When compatible with the generic version, nodes must list
23 the SoC-specific version corresponding to the platform
24 first followed by the generic version.
25
17- reg: offset and length of (1) the E-DMAC/feLic register block (required),26- reg: offset and length of (1) the E-DMAC/feLic register block (required),
18 (2) the TSU register block (optional).27 (2) the TSU register block (optional).
19- interrupts: interrupt specifier for the sole interrupt.28- interrupts: interrupt specifier for the sole interrupt.
@@ -36,7 +45,8 @@ Optional properties: · 16 unmodified lines
36Example (Lager board):45Example (Lager board):
37 46
38 ethernet@ee700000 {47 ethernet@ee700000 {
39 compatible = "renesas,ether-r8a7790";48 compatible = "renesas,ether-r8a7790",
49 "renesas,rcar-gen2-ether";
40 reg = <0 0xee700000 0 0x400>;50 reg = <0 0xee700000 0 0x400>;
41 interrupt-parent = <&gic>;51 interrupt-parent = <&gic>;
42 interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;52 interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
Documentation/devicetree/bindings/net/stmmac.txt+1−1
@@ -12,7 +12,7 @@ Required properties: · 11 unmodified lines
12 Valid interrupt names are:12 Valid interrupt names are:
13 - "macirq" (combined signal for various interrupt events)13 - "macirq" (combined signal for various interrupt events)
14 - "eth_wake_irq" (the interrupt to manage the remote wake-up packet detection)14 - "eth_wake_irq" (the interrupt to manage the remote wake-up packet detection)
15 - "eth_lpi" (the interrupt that occurs when Tx or Rx enters/exits LPI state)15 - "eth_lpi" (the interrupt that occurs when Rx exits the LPI state)
16- phy-mode: See ethernet.txt file in the same directory.16- phy-mode: See ethernet.txt file in the same directory.
17- snps,reset-gpio gpio number for phy reset.17- snps,reset-gpio gpio number for phy reset.
18- snps,reset-active-low boolean flag to indicate if phy reset is active low.18- snps,reset-active-low boolean flag to indicate if phy reset is active low.
Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt+8−0
@@ -37,6 +37,11 @@ The following properties are defined to the bluetooth node: · 36 unmodified lines
37 Definition: must be:37 Definition: must be:
38 "qcom,wcnss-bt"38 "qcom,wcnss-bt"
39 39
40- local-bd-address:
41 Usage: optional
42 Value type: <u8 array>
43 Definition: see Documentation/devicetree/bindings/net/bluetooth.txt
44
40== WiFi45== WiFi
41The following properties are defined to the WiFi node:46The following properties are defined to the WiFi node:
42 47
@@ -91,6 +96,9 @@ smd { · 48 unmodified lines
91 96
92 bt {97 bt {
93 compatible = "qcom,wcnss-bt";98 compatible = "qcom,wcnss-bt";
99
100 /* BD address 00:11:22:33:44:55 */
101 local-bd-address = [ 55 44 33 22 11 00 ];
94 };102 };
95 103
96 wlan {104 wlan {
Documentation/driver-api/80211/cfg80211.rst+0−3
@@ -299,9 +299,6 @@ Data path helpers · 298 unmodified lines
299.. kernel-doc:: include/net/cfg80211.h299.. kernel-doc:: include/net/cfg80211.h
300 :functions: ieee80211_data_to_8023300 :functions: ieee80211_data_to_8023
301 301
302.. kernel-doc:: include/net/cfg80211.h
303 :functions: ieee80211_data_from_8023
304
305.. kernel-doc:: include/net/cfg80211.h302.. kernel-doc:: include/net/cfg80211.h
306 :functions: ieee80211_amsdu_to_8023s303 :functions: ieee80211_amsdu_to_8023s
307 304
Documentation/networking/dsa/lan9303.txt+37−0
@@ -0,0 +1,37 @@
1LAN9303 Ethernet switch driver
2==============================
3
4The LAN9303 is a three port 10/100 Mbps ethernet switch with integrated phys for
5the two external ethernet ports. The third port is an RMII/MII interface to a
6host master network interface (e.g. fixed link).
7
8
9Driver details
10==============
11
12The driver is implemented as a DSA driver, see
13Documentation/networking/dsa/dsa.txt.
14
15See Documentation/devicetree/bindings/net/dsa/lan9303.txt for device tree
16binding.
17
18The LAN9303 can be managed both via MDIO and I2C, both supported by this driver.
19
20At startup the driver configures the device to provide two separate network
21interfaces (which is the default state of a DSA device). Due to HW limitations,
22no HW MAC learning takes place in this mode.
23
24When both user ports are joined to the same bridge, the normal HW MAC learning
25is enabled. This means that unicast traffic is forwarded in HW. Broadcast and
26multicast is flooded in HW. STP is also supported in this mode. The driver
27support fdb/mdb operations as well, meaning IGMP snooping is supported.
28
29If one of the user ports leave the bridge, the ports goes back to the initial
30separated operation.
31
32
33Driver limitations
34==================
35
36 - Support for VLAN filtering is not implemented
37 - The HW does not support VLAN-specific fdb entries
Documentation/networking/gtp.txt+99−4
@@ -1,6 +1,7 @@
1The Linux kernel GTP tunneling module1The Linux kernel GTP tunneling module
2======================================================================2======================================================================
3Documentation by Harald Welte <laforge@gnumonks.org>3Documentation by Harald Welte <laforge@gnumonks.org> and
4 Andreas Schultz <aschultz@tpip.net>
4 5
5In 'drivers/net/gtp.c' you are finding a kernel-level implementation6In 'drivers/net/gtp.c' you are finding a kernel-level implementation
6of a GTP tunnel endpoint.7of a GTP tunnel endpoint.
@@ -91,9 +92,13 @@ http://git.osmocom.org/libgtpnl/ · 84 unmodified lines
91 92
92== Protocol Versions ==93== Protocol Versions ==
93 94
94There are two different versions of GTP-U: v0 and v1. Both are95There are two different versions of GTP-U: v0 [GSM TS 09.60] and v1
95implemented in the Kernel GTP module. Version 0 is a legacy version,96[3GPP TS 29.281]. Both are implemented in the Kernel GTP module.
96and deprecated from recent 3GPP specifications.97Version 0 is a legacy version, and deprecated from recent 3GPP
98specifications.
99
100GTP-U uses UDP for transporting PDUs. The receiving UDP port is 2151
101for GTPv1-U and 3386 for GTPv0-U.
97 102
98There are three versions of GTP-C: v0, v1, and v2. As the kernel103There are three versions of GTP-C: v0, v1, and v2. As the kernel
99doesn't implement GTP-C, we don't have to worry about this. It's the104doesn't implement GTP-C, we don't have to worry about this. It's the
@@ -133,3 +138,93 @@ doe to a lack of user interest, it never got merged. · 33 unmodified lines
133In 2015, Andreas Schultz came to the rescue and fixed lots more bugs,138In 2015, Andreas Schultz came to the rescue and fixed lots more bugs,
134extended it with new features and finally pushed all of us to get it139extended it with new features and finally pushed all of us to get it
135mainline, where it was merged in 4.7.0.140mainline, where it was merged in 4.7.0.
141
142== Architectural Details ==
143
144=== Local GTP-U entity and tunnel identification ===
145
146GTP-U uses UDP for transporting PDU's. The receiving UDP port is 2152
147for GTPv1-U and 3386 for GTPv0-U.
148
149There is only one GTP-U entity (and therefor SGSN/GGSN/S-GW/PDN-GW
150instance) per IP address. Tunnel Endpoint Identifier (TEID) are unique
151per GTP-U entity.
152
153A specific tunnel is only defined by the destination entity. Since the
154destination port is constant, only the destination IP and TEID define
155a tunnel. The source IP and Port have no meaning for the tunnel.
156
157Therefore:
158
159 * when sending, the remote entity is defined by the remote IP and
160 the tunnel endpoint id. The source IP and port have no meaning and
161 can be changed at any time.
162
163 * when receiving the local entity is defined by the local
164 destination IP and the tunnel endpoint id. The source IP and port
165 have no meaning and can change at any time.
166
167[3GPP TS 29.281] Section 4.3.0 defines this so:
168
169> The TEID in the GTP-U header is used to de-multiplex traffic
170> incoming from remote tunnel endpoints so that it is delivered to the
171> User plane entities in a way that allows multiplexing of different
172> users, different packet protocols and different QoS levels.
173> Therefore no two remote GTP-U endpoints shall send traffic to a
174> GTP-U protocol entity using the same TEID value except
175> for data forwarding as part of mobility procedures.
176
177The definition above only defines that two remote GTP-U endpoints
178*should not* send to the same TEID, it *does not* forbid or exclude
179such a scenario. In fact, the mentioned mobility procedures make it
180necessary that the GTP-U entity accepts traffic for TEIDs from
181multiple or unknown peers.
182
183Therefore, the receiving side identifies tunnels exclusively based on
184TEIDs, not based on the source IP!
185
186== APN vs. Network Device ==
187
188The GTP-U driver creates a Linux network device for each Gi/SGi
189interface.
190
191[3GPP TS 29.281] calls the Gi/SGi reference point an interface. This
192may lead to the impression that the GGSN/P-GW can have only one such
193interface.
194
195Correct is that the Gi/SGi reference point defines the interworking
196between +the 3GPP packet domain (PDN) based on GTP-U tunnel and IP
197based networks.
198
199There is no provision in any of the 3GPP documents that limits the
200number of Gi/SGi interfaces implemented by a GGSN/P-GW.
201
202[3GPP TS 29.061] Section 11.3 makes it clear that the selection of a
203specific Gi/SGi interfaces is made through the Access Point Name
204(APN):
205
206> 2. each private network manages its own addressing. In general this
207> will result in different private networks having overlapping
208> address ranges. A logically separate connection (e.g. an IP in IP
209> tunnel or layer 2 virtual circuit) is used between the GGSN/P-GW
210> and each private network.
211>
212> In this case the IP address alone is not necessarily unique. The
213> pair of values, Access Point Name (APN) and IPv4 address and/or
214> IPv6 prefixes, is unique.
215
216In order to support the overlapping address range use case, each APN
217is mapped to a separate Gi/SGi interface (network device).
218
219NOTE: The Access Point Name is purely a control plane (GTP-C) concept.
220At the GTP-U level, only Tunnel Endpoint Identifiers are present in
221GTP-U packets and network devices are known
222
223Therefore for a given UE the mapping in IP to PDN network is:
224 * network device + MS IP -> Peer IP + Peer TEID,
225
226and from PDN to IP network:
227 * local GTP-U IP + TEID -> network device
228
229Furthermore, before a received T-PDU is injected into the network
230device the MS IP is checked against the IP recorded in PDP context.
Documentation/networking/ila.txt+285−0
@@ -0,0 +1,285 @@
1Identifier Locator Addressing (ILA)
2
3
4Introduction
5============
6
7Identifier-locator addressing (ILA) is a technique used with IPv6 that
8differentiates between location and identity of a network node. Part of an
9address expresses the immutable identity of the node, and another part
10indicates the location of the node which can be dynamic. Identifier-locator
11addressing can be used to efficiently implement overlay networks for
12network virtualization as well as solutions for use cases in mobility.
13
14ILA can be thought of as means to implement an overlay network without
15encapsulation. This is accomplished by performing network address
16translation on destination addresses as a packet traverses a network. To
17the network, an ILA translated packet appears to be no different than any
18other IPv6 packet. For instance, if the transport protocol is TCP then an
19ILA translated packet looks like just another TCP/IPv6 packet. The
20advantage of this is that ILA is transparent to the network so that
21optimizations in the network, such as ECMP, RSS, GRO, GSO, etc., just work.
22
23The ILA protocol is described in Internet-Draft draft-herbert-intarea-ila.
24
25
26ILA terminology
27===============
28
29 - Identifier A number that identifies an addressable node in the network
30 independent of its location. ILA identifiers are sixty-four
31 bit values.
32
33 - Locator A network prefix that routes to a physical host. Locators
34 provide the topological location of an addressed node. ILA
35 locators are sixty-four bit prefixes.
36
37 - ILA mapping
38 A mapping of an ILA identifier to a locator (or to a
39 locator and meta data). An ILA domain maintains a database
40 that contains mappings for all destinations in the domain.
41
42 - SIR address
43 An IPv6 address composed of a SIR prefix (upper sixty-
44 four bits) and an identifier (lower sixty-four bits).
45 SIR addresses are visible to applications and provide a
46 means for them to address nodes independent of their
47 location.
48
49 - ILA address
50 An IPv6 address composed of a locator (upper sixty-four
51 bits) and an identifier (low order sixty-four bits). ILA
52 addresses are never visible to an application.
53
54 - ILA host An end host that is capable of performing ILA translations
55 on transmit or receive.
56
57 - ILA router A network node that performs ILA translation and forwarding
58 of translated packets.
59
60 - ILA forwarding cache
61 A type of ILA router that only maintains a working set
62 cache of mappings.
63
64 - ILA node A network node capable of performing ILA translations. This
65 can be an ILA router, ILA forwarding cache, or ILA host.
66
67
68Operation
69=========
70
71There are two fundamental operations with ILA:
72
73 - Translate a SIR address to an ILA address. This is performed on ingress
74 to an ILA overlay.
75
76 - Translate an ILA address to a SIR address. This is performed on egress
77 from the ILA overlay.
78
79ILA can be deployed either on end hosts or intermediate devices in the
80network; these are provided by "ILA hosts" and "ILA routers" respectively.
81Configuration and datapath for these two points of deployment is somewhat
82different.
83
84The diagram below illustrates the flow of packets through ILA as well
85as showing ILA hosts and routers.
86
87 +--------+ +--------+
88 | Host A +-+ +--->| Host B |
89 | | | (2) ILA (') | |
90 +--------+ | ...addressed.... ( ) +--------+
91 V +---+--+ . packet . +---+--+ (_)
92 (1) SIR | | ILA |----->-------->---->| ILA | | (3) SIR
93 addressed +->|router| . . |router|->-+ addressed
94 packet +---+--+ . IPv6 . +---+--+ packet
95 / . Network .
96 / . . +--+-++--------+
97 +--------+ / . . |ILA || Host |
98 | Host +--+ . .- -|host|| |
99 | | . . +--+-++--------+
100 +--------+ ................
101
102
103Transport checksum handling
104===========================
105
106When an address is translated by ILA, an encapsulated transport checksum
107that includes the translated address in a pseudo header may be rendered
108incorrect on the wire. This is a problem for intermediate devices,
109including checksum offload in NICs, that process the checksum. There are
110three options to deal with this:
111
112- no action Allow the checksum to be incorrect on the wire. Before
113 a receiver verifies a checksum the ILA to SIR address
114 translation must be done.
115
116- adjust transport checksum
117 When ILA translation is performed the packet is parsed
118 and if a transport layer checksum is found then it is
119 adjusted to reflect the correct checksum per the
120 translated address.
121
122- checksum neutral mapping
123 When an address is translated the difference can be offset
124 elsewhere in a part of the packet that is covered by the
125 the checksum. The low order sixteen bits of the identifier
126 are used. This method is preferred since it doesn't require
127 parsing a packet beyond the IP header and in most cases the
128 adjustment can be precomputed and saved with the mapping.
129
130Note that the checksum neutral adjustment affects the low order sixteen
131bits of the identifier. When ILA to SIR address translation is done on
132egress the low order bits are restored to the original value which
133restores the identifier as it was originally sent.
134
135
136Identifier types
137================
138
139ILA defines different types of identifiers for different use cases.
140
141The defined types are:
142
143 0: interface identifier
144
145 1: locally unique identifier
146
147 2: virtual networking identifier for IPv4 address
148
149 3: virtual networking identifier for IPv6 unicast address
150
151 4: virtual networking identifier for IPv6 multicast address
152
153 5: non-local address identifier
154
155In the current implementation of kernel ILA only locally unique identifiers
156(LUID) are supported. LUID allows for a generic, unformatted 64 bit
157identifier.
158
159
160Identifier formats
161==================
162
163Kernel ILA supports two optional fields in an identifier for formatting:
164"C-bit" and "identifier type". The presence of these fields is determined
165by configuration as demonstrated below.
166
167If the identifier type is present it occupies the three highest order
168bits of an identifier. The possible values are given in the above list.
169
170If the C-bit is present, this is used as an indication that checksum
171neutral mapping has been done. The C-bit can only be set in an
172ILA address, never a SIR address.
173
174In the simplest format the identifier types, C-bit, and checksum
175adjustment value are not present so an identifier is considered an
176unstructured sixty-four bit value.
177
178 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
179 | Identifier |
180 + +
181 | |
182 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
183
184The checksum neutral adjustment may be configured to always be
185present using neutral-map-auto. In this case there is no C-bit, but the
186checksum adjustment is in the low order 16 bits. The identifier is
187still sixty-four bits.
188
189 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
190 | Identifier |
191 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
192 | | Checksum-neutral adjustment |
193 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
194
195The C-bit may used to explicitly indicate that checksum neutral
196mapping has been applied to an ILA address. The format is:
197
198 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
199 | |C| Identifier |
200 | +-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
201 | | Checksum-neutral adjustment |
202 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
203
204The identifier type field may be present to indicate the identifier
205type. If it is not present then the type is inferred based on mapping
206configuration. The checksum neutral adjustment may automatically
207used with the identifier type as illustrated below.
208
209 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
210 | Type| Identifier |
211 +-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
212 | | Checksum-neutral adjustment |
213 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
214
215If the identifier type and the C-bit can be present simultaneously so
216the identifier format would be:
217
218 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219 | Type|C| Identifier |
220 +-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
221 | | Checksum-neutral adjustment |
222 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
223
224
225Configuration
226=============
227
228There are two methods to configure ILA mappings. One is by using LWT routes
229and the other is ila_xlat (called from NFHOOK PREROUTING hook). ila_xlat
230is intended to be used in the receive path for ILA hosts .
231
232An ILA router has also been implemented in XDP. Description of that is
233outside the scope of this document.
234
235The usage of for ILA LWT routes is:
236
237ip route add DEST/128 encap ila LOC csum-mode MODE ident-type TYPE via ADDR
238
239Destination (DEST) can either be a SIR address (for an ILA host or ingress
240ILA router) or an ILA address (egress ILA router). LOC is the sixty-four
241bit locator (with format W:X:Y:Z) that overwrites the upper sixty-four
242bits of the destination address. Checksum MODE is one of "no-action",
243"adj-transport", "neutral-map", and "neutral-map-auto". If neutral-map is
244set then the C-bit will be present. Identifier TYPE one of "luid" or
245"use-format." In the case of use-format, the identifier type field is
246present and the effective type is taken from that.
247
248The usage of ila_xlat is:
249
250ip ila add loc_match MATCH loc LOC csum-mode MODE ident-type TYPE
251
252MATCH indicates the incoming locator that must be matched to apply
253a the translaiton. LOC is the locator that overwrites the upper
254sixty-four bits of the destination address. MODE and TYPE have the
255same meanings as described above.
256
257
258Some examples
259=============
260
261# Configure an ILA route that uses checksum neutral mapping as well
262# as type field. Note that the type field is set in the SIR address
263# (the 2000 implies type is 1 which is LUID).
264ip route add 3333:0:0:1:2000:0:1:87/128 encap ila 2001:0:87:0 \
265 csum-mode neutral-map ident-type use-format
266
267# Configure an ILA LWT route that uses auto checksum neutral mapping
268# (no C-bit) and configure identifier type to be LUID so that the
269# identifier type field will not be present.
270ip route add 3333:0:0:1:2000:0:2:87/128 encap ila 2001:0:87:1 \
271 csum-mode neutral-map-auto ident-type luid
272
273ila_xlat configuration
274
275# Configure an ILA to SIR mapping that matches a locator and overwrites
276# it with a SIR address (3333:0:0:1 in this example). The C-bit and
277# identifier field are used.
278ip ila add loc_match 2001:0:119:0 loc 3333:0:0:1 \
279 csum-mode neutral-map-auto ident-type use-format
280
281# Configure an ILA to SIR mapping where checksum neutral is automatically
282# set without the C-bit and the identifier type is configured to be LUID
283# so that the identifier type field is not present.
284ip ila add loc_match 2001:0:119:0 loc 3333:0:0:1 \
285 csum-mode neutral-map-auto ident-type use-format
Documentation/networking/ip-sysctl.txt+35−2
@@ -289,8 +289,7 @@ tcp_ecn_fallback - BOOLEAN · 288 unmodified lines
289 Default: 1 (fallback enabled)289 Default: 1 (fallback enabled)
290 290
291tcp_fack - BOOLEAN291tcp_fack - BOOLEAN
292 Enable FACK congestion avoidance and fast retransmission.292 This is a legacy option, it has no effect anymore.
293 The value is not used, if tcp_sack is not enabled.
294 293
295tcp_fin_timeout - INTEGER294tcp_fin_timeout - INTEGER
296 The length of time an orphaned (no longer referenced by any295 The length of time an orphaned (no longer referenced by any
@@ -454,6 +453,7 @@ tcp_recovery - INTEGER · 157 unmodified lines
454 453
455 RACK: 0x1 enables the RACK loss detection for fast detection of lost454 RACK: 0x1 enables the RACK loss detection for fast detection of lost
456 retransmissions and tail drops.455 retransmissions and tail drops.
456 RACK: 0x2 makes RACK's reordering window static (min_rtt/4).
457 457
458 Default: 0x1458 Default: 0x1
459 459
@@ -1385,6 +1385,30 @@ mld_qrv - INTEGER · 925 unmodified lines
1385 Default: 2 (as specified by RFC3810 9.1)1385 Default: 2 (as specified by RFC3810 9.1)
1386 Minimum: 1 (as specified by RFC6636 4.5)1386 Minimum: 1 (as specified by RFC6636 4.5)
1387 1387
1388max_dst_opts_cnt - INTEGER
1389 Maximum number of non-padding TLVs allowed in a Destination
1390 options extension header. If this value is less than zero
1391 then unknown options are disallowed and the number of known
1392 TLVs allowed is the absolute value of this number.
1393 Default: 8
1394
1395max_hbh_opts_cnt - INTEGER
1396 Maximum number of non-padding TLVs allowed in a Hop-by-Hop
1397 options extension header. If this value is less than zero
1398 then unknown options are disallowed and the number of known
1399 TLVs allowed is the absolute value of this number.
1400 Default: 8
1401
1402max dst_opts_len - INTEGER
1403 Maximum length allowed for a Destination options extension
1404 header.
1405 Default: INT_MAX (unlimited)
1406
1407max hbh_opts_len - INTEGER
1408 Maximum length allowed for a Hop-by-Hop options extension
1409 header.
1410 Default: INT_MAX (unlimited)
1411
1388IPv6 Fragmentation:1412IPv6 Fragmentation:
1389 1413
1390ip6frag_high_thresh - INTEGER1414ip6frag_high_thresh - INTEGER
@@ -1707,6 +1731,15 @@ ndisc_notify - BOOLEAN · 316 unmodified lines
1707 1 - Generate unsolicited neighbour advertisements when device is brought1731 1 - Generate unsolicited neighbour advertisements when device is brought
1708 up or hardware address changes.1732 up or hardware address changes.
1709 1733
1734ndisc_tclass - INTEGER
1735 The IPv6 Traffic Class to use by default when sending IPv6 Neighbor
1736 Discovery (Router Solicitation, Router Advertisement, Neighbor
1737 Solicitation, Neighbor Advertisement, Redirect) messages.
1738 These 8 bits can be interpreted as 6 high order bits holding the DSCP
1739 value and 2 low order bits representing ECN (which you probably want
1740 to leave cleared).
1741 0 - (default)
1742
1710mldv1_unsolicited_report_interval - INTEGER1743mldv1_unsolicited_report_interval - INTEGER
1711 The interval in milliseconds in which the next unsolicited1744 The interval in milliseconds in which the next unsolicited
1712 MLDv1 report retransmit will take place.1745 MLDv1 report retransmit will take place.
Documentation/networking/ipvlan.txt+38−4
@@ -22,9 +22,21 @@ The driver can be built into the kernel (CONFIG_IPVLAN=y) or as a module · 21 unmodified lines
22 There are no module parameters for this driver and it can be configured22 There are no module parameters for this driver and it can be configured
23using IProute2/ip utility.23using IProute2/ip utility.
24 24
25 ip link add link <master-dev> name <slave-dev> type ipvlan mode { l2 | l3 | l3s }25 ip link add link <master> name <slave> type ipvlan [ mode MODE ] [ FLAGS ]
26 26 where
27 e.g. ip link add link eth0 name ipvl0 type ipvlan mode l227 MODE: l3 (default) | l3s | l2
28 FLAGS: bridge (default) | private | vepa
29
30 e.g.
31 (a) Following will create IPvlan link with eth0 as master in
32 L3 bridge mode
33 bash# ip link add link eth0 name ipvl0 type ipvlan
34 (b) This command will create IPvlan link in L2 bridge mode.
35 bash# ip link add link eth0 name ipvl0 type ipvlan mode l2 bridge
36 (c) This command will create an IPvlan device in L2 private mode.
37 bash# ip link add link eth0 name ipvlan type ipvlan mode l2 private
38 (d) This command will create an IPvlan device in L2 vepa mode.
39 bash# ip link add link eth0 name ipvlan type ipvlan mode l2 vepa
28 40
29 41
304. Operating modes:424. Operating modes:
@@ -54,7 +66,29 @@ works in this mode and hence it is L3-symmetric (L3s). This will have slightly l · 23 unmodified lines
54performance but that shouldn't matter since you are choosing this mode over plain-L366performance but that shouldn't matter since you are choosing this mode over plain-L3
55mode to make conn-tracking work.67mode to make conn-tracking work.
56 68
575. What to choose (macvlan vs. ipvlan)?695. Mode flags:
70 At this time following mode flags are available
71
725.1 bridge:
73 This is the default option. To configure the IPvlan port in this mode,
74user can choose to either add this option on the command-line or don't specify
75anything. This is the traditional mode where slaves can cross-talk among
76themseleves apart from talking through the master device.
77
785.2 private:
79 If this option is added to the command-line, the port is set in private
80mode. i.e. port wont allow cross communication between slaves.
81
825.3 vepa:
83 If this is added to the command-line, the port is set in VEPA mode.
84i.e. port will offload switching functionality to the external entity as
85described in 802.1Qbg
86Note: VEPA mode in IPvlan has limitations. IPvlan uses the mac-address of the
87master-device, so the packets which are emitted in this mode for the adjacent
88neighbor will have source and destination mac same. This will make the switch /
89router send the redirect message.
90
916. What to choose (macvlan vs. ipvlan)?
58 These two devices are very similar in many regards and the specific use92 These two devices are very similar in many regards and the specific use
59case could very well define which device to choose. if one of the following93case could very well define which device to choose. if one of the following
60situations defines your use case then you can choose to use ipvlan -94situations defines your use case then you can choose to use ipvlan -
Documentation/networking/netdev-FAQ.txt+4−1
@@ -64,7 +64,10 @@ A: To understand this, you need to know a bit of background information · 63 unmodified lines
64 64
65 If you aren't subscribed to netdev and/or are simply unsure if net-next65 If you aren't subscribed to netdev and/or are simply unsure if net-next
66 has re-opened yet, simply check the net-next git repository link above for66 has re-opened yet, simply check the net-next git repository link above for
67 any new networking-related commits.67 any new networking-related commits. You may also check the following
68 website for the current status:
69
70 http://vger.kernel.org/~davem/net-next.html
68 71
69 The "net" tree continues to collect fixes for the vX.Y content, and72 The "net" tree continues to collect fixes for the vX.Y content, and
70 is fed back to Linus at regular (~weekly) intervals. Meaning that the73 is fed back to Linus at regular (~weekly) intervals. Meaning that the
Documentation/networking/netvsc.txt+4−4
@@ -19,12 +19,12 @@ Features · 18 unmodified lines
19 19
20 Receive Side Scaling20 Receive Side Scaling
21 --------------------21 --------------------
22 Hyper-V supports receive side scaling. For TCP, packets are22 Hyper-V supports receive side scaling. For TCP & UDP, packets can
23 distributed among available queues based on IP address and port23 be distributed among available queues based on IP address and port
24 number.24 number.
25 25
26 For UDP, we can switch UDP hash level between L3 and L4 by ethtool26 For TCP & UDP, we can switch hash level between L3 and L4 by ethtool
27 command. UDP over IPv4 and v6 can be set differently. The default27 command. TCP/UDP over IPv4 and v6 can be set differently. The default
28 hash level is L4. We currently only allow switching TX hash level28 hash level is L4. We currently only allow switching TX hash level
29 from within the guests.29 from within the guests.
30 30
Documentation/networking/regulatory.txt+10−20
@@ -19,6 +19,14 @@ core regulatory domain all wireless devices should adhere to. · 18 unmodified lines
19How to get regulatory domains to the kernel19How to get regulatory domains to the kernel
20-------------------------------------------20-------------------------------------------
21 21
22When the regulatory domain is first set up, the kernel will request a
23database file (regulatory.db) containing all the regulatory rules. It
24will then use that database when it needs to look up the rules for a
25given country.
26
27How to get regulatory domains to the kernel (old CRDA solution)
28---------------------------------------------------------------
29
22Userspace gets a regulatory domain in the kernel by having30Userspace gets a regulatory domain in the kernel by having
23a userspace agent build it and send it via nl80211. Only31a userspace agent build it and send it via nl80211. Only
24expected regulatory domains will be respected by the kernel.32expected regulatory domains will be respected by the kernel.
@@ -192,23 +200,5 @@ Then in some part of your code after your wiphy has been registered: · 167 unmodified lines
192Statically compiled regulatory database200Statically compiled regulatory database
193---------------------------------------201---------------------------------------
194 202
195In most situations the userland solution using CRDA as described203When a database should be fixed into the kernel, it can be provided as a
196above is the preferred solution. However in some cases a set of204firmware file at build time that is then linked into the kernel.
197rules built into the kernel itself may be desirable. To account
198for this situation, a configuration option has been provided
199(i.e. CONFIG_CFG80211_INTERNAL_REGDB). With this option enabled,
200the wireless database information contained in net/wireless/db.txt is
201used to generate a data structure encoded in net/wireless/regdb.c.
202That option also enables code in net/wireless/reg.c which queries
203the data in regdb.c as an alternative to using CRDA.
204
205The file net/wireless/db.txt should be kept up-to-date with the db.txt
206file available in the git repository here:
207
208 git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git
209
210Again, most users in most situations should be using the CRDA package
211provided with their distribution, and in most other situations users
212should be building and using CRDA on their own rather than using
213this option. If you are not absolutely sure that you should be using
214CONFIG_CFG80211_INTERNAL_REGDB then _DO_NOT_USE_IT_.
Documentation/networking/rxrpc.txt+51−2
@@ -280,6 +280,18 @@ Interaction with the user of the RxRPC socket: · 279 unmodified lines
280 nominated by a socket option.280 nominated by a socket option.
281 281
282 282
283Notes on sendmsg:
284
285 (*) MSG_WAITALL can be set to tell sendmsg to ignore signals if the peer is
286 making progress at accepting packets within a reasonable time such that we
287 manage to queue up all the data for transmission. This requires the
288 client to accept at least one packet per 2*RTT time period.
289
290 If this isn't set, sendmsg() will return immediately, either returning
291 EINTR/ERESTARTSYS if nothing was consumed or returning the amount of data
292 consumed.
293
294
283Notes on recvmsg:295Notes on recvmsg:
284 296
285 (*) If there's a sequence of data messages belonging to a particular call on297 (*) If there's a sequence of data messages belonging to a particular call on
@@ -782,7 +794,9 @@ The kernel interface functions are as follows: · 496 unmodified lines
782 struct key *key,794 struct key *key,
783 unsigned long user_call_ID,795 unsigned long user_call_ID,
784 s64 tx_total_len,796 s64 tx_total_len,
785 gfp_t gfp);797 gfp_t gfp,
798 rxrpc_notify_rx_t notify_rx,
799 bool upgrade);
786 800
787 This allocates the infrastructure to make a new RxRPC call and assigns801 This allocates the infrastructure to make a new RxRPC call and assigns
788 call and connection numbers. The call will be made on the UDP port that802 call and connection numbers. The call will be made on the UDP port that
@@ -803,6 +817,13 @@ The kernel interface functions are as follows: · 14 unmodified lines
803 allows the kernel to encrypt directly to the packet buffers, thereby817 allows the kernel to encrypt directly to the packet buffers, thereby
804 saving a copy. The value may not be less than -1.818 saving a copy. The value may not be less than -1.
805 819
820 notify_rx is a pointer to a function to be called when events such as
821 incoming data packets or remote aborts happen.
822
823 upgrade should be set to true if a client operation should request that
824 the server upgrade the service to a better one. The resultant service ID
825 is returned by rxrpc_kernel_recv_data().
826
806 If this function is successful, an opaque reference to the RxRPC call is827 If this function is successful, an opaque reference to the RxRPC call is
807 returned. The caller now holds a reference on this and it must be828 returned. The caller now holds a reference on this and it must be
808 properly ended.829 properly ended.
@@ -850,7 +871,8 @@ The kernel interface functions are as follows: · 41 unmodified lines
850 size_t size,871 size_t size,
851 size_t *_offset,872 size_t *_offset,
852 bool want_more,873 bool want_more,
853 u32 *_abort)874 u32 *_abort,
875 u16 *_service)
854 876
855 This is used to receive data from either the reply part of a client call877 This is used to receive data from either the reply part of a client call
856 or the request part of a service call. buf and size specify how much878 or the request part of a service call. buf and size specify how much
@@ -873,6 +895,9 @@ The kernel interface functions are as follows: · 16 unmodified lines
873 If a remote ABORT is detected, the abort code received will be stored in895 If a remote ABORT is detected, the abort code received will be stored in
874 *_abort and ECONNABORTED will be returned.896 *_abort and ECONNABORTED will be returned.
875 897
898 The service ID that the call ended up with is returned into *_service.
899 This can be used to see if a call got a service upgrade.
900
876 (*) Abort a call.901 (*) Abort a call.
877 902
878 void rxrpc_kernel_abort_call(struct socket *sock,903 void rxrpc_kernel_abort_call(struct socket *sock,
@@ -1020,6 +1045,30 @@ The kernel interface functions are as follows: · 141 unmodified lines
1020 1045
1021 It returns 0 if the call was requeued and an error otherwise.1046 It returns 0 if the call was requeued and an error otherwise.
1022 1047
1048 (*) Get call RTT.
1049
1050 u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call);
1051
1052 Get the RTT time to the peer in use by a call. The value returned is in
1053 nanoseconds.
1054
1055 (*) Check call still alive.
1056
1057 u32 rxrpc_kernel_check_life(struct socket *sock,
1058 struct rxrpc_call *call);
1059
1060 This returns a number that is updated when ACKs are received from the peer
1061 (notably including PING RESPONSE ACKs which we can elicit by sending PING
1062 ACKs to see if the call still exists on the server). The caller should
1063 compare the numbers of two calls to see if the call is still alive after
1064 waiting for a suitable interval.
1065
1066 This allows the caller to work out if the server is still contactable and
1067 if the call is still alive on the server whilst waiting for the server to
1068 process a client operation.
1069
1070 This function may transmit a PING ACK.
1071
1023 1072
1024=======================1073=======================
1025CONFIGURABLE PARAMETERS1074CONFIGURABLE PARAMETERS
Documentation/networking/vrf.txt+9−4
@@ -71,7 +71,12 @@ Setup · 70 unmodified lines
71 ip ru add iif vrf-blue table 1071 ip ru add iif vrf-blue table 10
72 72
733. Set the default route for the table (and hence default route for the VRF).733. Set the default route for the table (and hence default route for the VRF).
74 ip route add table 10 unreachable default74 ip route add table 10 unreachable default metric 4278198272
75
76 This high metric value ensures that the default unreachable route can
77 be overridden by a routing protocol suite. FRRouting interprets
78 kernel metrics as a combined admin distance (upper byte) and priority
79 (lower 3 bytes). Thus the above metric translates to [255/8192].
75 80
764. Enslave L3 interfaces to a VRF device.814. Enslave L3 interfaces to a VRF device.
77 ip link set dev eth1 master vrf-blue82 ip link set dev eth1 master vrf-blue
@@ -256,7 +261,7 @@ older form without it. · 178 unmodified lines
256 261
257 For example:262 For example:
258 $ ip route show vrf red263 $ ip route show vrf red
259 prohibit default264 unreachable default metric 4278198272
260 broadcast 10.2.1.0 dev eth1 proto kernel scope link src 10.2.1.2265 broadcast 10.2.1.0 dev eth1 proto kernel scope link src 10.2.1.2
261 10.2.1.0/24 dev eth1 proto kernel scope link src 10.2.1.2266 10.2.1.0/24 dev eth1 proto kernel scope link src 10.2.1.2
262 local 10.2.1.2 dev eth1 proto kernel scope host src 10.2.1.2267 local 10.2.1.2 dev eth1 proto kernel scope host src 10.2.1.2
@@ -282,7 +287,7 @@ older form without it. · 19 unmodified lines
282 ff00::/8 dev red metric 256 pref medium287 ff00::/8 dev red metric 256 pref medium
283 ff00::/8 dev eth1 metric 256 pref medium288 ff00::/8 dev eth1 metric 256 pref medium
284 ff00::/8 dev eth2 metric 256 pref medium289 ff00::/8 dev eth2 metric 256 pref medium
285 290 unreachable default dev lo metric 4278198272 error -101 pref medium
286 291
2878. Route Lookup for a VRF2928. Route Lookup for a VRF
288 293
@@ -331,7 +336,7 @@ function vrf_create · 42 unmodified lines
331 ip link add ${VRF} type vrf table ${TBID}336 ip link add ${VRF} type vrf table ${TBID}
332 337
333 if [ "${VRF}" != "mgmt" ]; then338 if [ "${VRF}" != "mgmt" ]; then
334 ip route add table ${TBID} unreachable default339 ip route add table ${TBID} unreachable default metric 4278198272
335 fi340 fi
336 ip link set dev ${VRF} up341 ip link set dev ${VRF} up
337}342}
MAINTAINERS+31−11
@@ -695,9 +695,9 @@ F: include/linux/altera_uart.h · 694 unmodified lines
695F: include/linux/altera_jtaguart.h695F: include/linux/altera_jtaguart.h
696 696
697AMAZON ETHERNET DRIVERS697AMAZON ETHERNET DRIVERS
698M: Netanel Belgazal <netanel@annapurnalabs.com>698M: Netanel Belgazal <netanel@amazon.com>
699R: Saeed Bishara <saeed@annapurnalabs.com>699R: Saeed Bishara <saeedb@amazon.com>
700R: Zorik Machulsky <zorik@annapurnalabs.com>700R: Zorik Machulsky <zorik@amazon.com>
701L: netdev@vger.kernel.org701L: netdev@vger.kernel.org
702S: Supported702S: Supported
703F: Documentation/networking/ena.txt703F: Documentation/networking/ena.txt
@@ -2712,6 +2712,7 @@ L: linux-kernel@vger.kernel.org · 2008 unmodified lines
2712S: Supported2712S: Supported
2713F: arch/x86/net/bpf_jit*2713F: arch/x86/net/bpf_jit*
2714F: Documentation/networking/filter.txt2714F: Documentation/networking/filter.txt
2715F: Documentation/bpf/
2715F: include/linux/bpf*2716F: include/linux/bpf*
2716F: include/linux/filter.h2717F: include/linux/filter.h
2717F: include/uapi/linux/bpf*2718F: include/uapi/linux/bpf*
@@ -2724,7 +2725,7 @@ F: net/core/filter.c · 6 unmodified lines
2724F: net/sched/act_bpf.c2725F: net/sched/act_bpf.c
2725F: net/sched/cls_bpf.c2726F: net/sched/cls_bpf.c
2726F: samples/bpf/2727F: samples/bpf/
2727F: tools/net/bpf*2728F: tools/bpf/
2728F: tools/testing/selftests/bpf/2729F: tools/testing/selftests/bpf/
2729 2730
2730BROADCOM B44 10/100 ETHERNET DRIVER2731BROADCOM B44 10/100 ETHERNET DRIVER
@@ -2903,6 +2904,7 @@ S: Maintained · 172 unmodified lines
2903F: drivers/phy/broadcom/phy-brcm-usb*2904F: drivers/phy/broadcom/phy-brcm-usb*
2904 2905
2905BROADCOM GENET ETHERNET DRIVER2906BROADCOM GENET ETHERNET DRIVER
2907M: Doug Berger <opendmb@gmail.com>
2906M: Florian Fainelli <f.fainelli@gmail.com>2908M: Florian Fainelli <f.fainelli@gmail.com>
2907L: netdev@vger.kernel.org2909L: netdev@vger.kernel.org
2908S: Supported2910S: Supported
@@ -3088,7 +3090,6 @@ F: arch/c6x/ · 179 unmodified lines
3088 3090
3089CA8210 IEEE-802.15.4 RADIO DRIVER3091CA8210 IEEE-802.15.4 RADIO DRIVER
3090M: Harry Morris <h.morris@cascoda.com>3092M: Harry Morris <h.morris@cascoda.com>
3091M: linuxdev@cascoda.com
3092L: linux-wpan@vger.kernel.org3093L: linux-wpan@vger.kernel.org
3093W: https://github.com/Cascoda/ca8210-linux.git3094W: https://github.com/Cascoda/ca8210-linux.git
3094S: Maintained3095S: Maintained
@@ -3335,17 +3336,22 @@ S: Maintained · 240 unmodified lines
3335F: drivers/auxdisplay/cfag12864bfb.c3336F: drivers/auxdisplay/cfag12864bfb.c
3336F: include/linux/cfag12864b.h3337F: include/linux/cfag12864b.h
3337 3338
3338CFG80211 and NL802113339802.11 (including CFG80211/NL80211)
3339M: Johannes Berg <johannes@sipsolutions.net>3340M: Johannes Berg <johannes@sipsolutions.net>
3340L: linux-wireless@vger.kernel.org3341L: linux-wireless@vger.kernel.org
3341W: http://wireless.kernel.org/3342W: http://wireless.kernel.org/
3342T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git3343T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
3343T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git3344T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
3344S: Maintained3345S: Maintained
3346F: net/wireless/
3345F: include/uapi/linux/nl80211.h3347F: include/uapi/linux/nl80211.h
3348F: include/linux/ieee80211.h
3349F: include/net/wext.h
3346F: include/net/cfg80211.h3350F: include/net/cfg80211.h
3347F: net/wireless/*3351F: include/net/iw_handler.h
3348X: net/wireless/wext*3352F: include/net/ieee80211_radiotap.h
3353F: Documentation/driver-api/80211/cfg80211.rst
3354F: Documentation/networking/regulatory.txt
3349 3355
3350CHAR and MISC DRIVERS3356CHAR and MISC DRIVERS
3351M: Arnd Bergmann <arnd@arndb.de>3357M: Arnd Bergmann <arnd@arndb.de>
@@ -3421,7 +3427,7 @@ F: drivers/scsi/snic/ · 69 unmodified lines
3421CISCO VIC ETHERNET NIC DRIVER3427CISCO VIC ETHERNET NIC DRIVER
3422M: Christian Benvenuti <benve@cisco.com>3428M: Christian Benvenuti <benve@cisco.com>
3423M: Govindarajulu Varadarajan <_govind@gmx.com>3429M: Govindarajulu Varadarajan <_govind@gmx.com>
3424M: Neel Patel <neepatel@cisco.com>3430M: Parvi Kaustubhi <pkaustub@cisco.com>
3425S: Supported3431S: Supported
3426F: drivers/net/ethernet/cisco/enic/3432F: drivers/net/ethernet/cisco/enic/
3427 3433
@@ -8231,6 +8237,7 @@ F: Documentation/networking/mac80211-injection.txt · 4803 unmodified lines
8231F: include/net/mac80211.h8237F: include/net/mac80211.h
8232F: net/mac80211/8238F: net/mac80211/
8233F: drivers/net/wireless/mac80211_hwsim.[ch]8239F: drivers/net/wireless/mac80211_hwsim.[ch]
8240F: Documentation/networking/mac80211_hwsim/README
8234 8241
8235MAILBOX API8242MAILBOX API
8236M: Jassi Brar <jassisinghbrar@gmail.com>8243M: Jassi Brar <jassisinghbrar@gmail.com>
@@ -9425,6 +9432,7 @@ M: Florian Fainelli <f.fainelli@gmail.com> · 1188 unmodified lines
9425S: Maintained9432S: Maintained
9426F: net/dsa/9433F: net/dsa/
9427F: include/net/dsa.h9434F: include/net/dsa.h
9435F: include/linux/dsa/
9428F: drivers/net/dsa/9436F: drivers/net/dsa/
9429 9437
9430NETWORKING [GENERAL]9438NETWORKING [GENERAL]
@@ -9445,8 +9453,8 @@ F: include/uapi/linux/in.h · 14 unmodified lines
9445F: include/uapi/linux/net.h9453F: include/uapi/linux/net.h
9446F: include/uapi/linux/netdevice.h9454F: include/uapi/linux/netdevice.h
9447F: include/uapi/linux/net_namespace.h9455F: include/uapi/linux/net_namespace.h
9448F: tools/net/
9449F: tools/testing/selftests/net/9456F: tools/testing/selftests/net/
9457F: lib/net_utils.c
9450F: lib/random32.c9458F: lib/random32.c
9451 9459
9452NETWORKING [IPSEC]9460NETWORKING [IPSEC]
@@ -11520,6 +11528,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git · 2067 unmodified lines
11520T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git11528T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
11521S: Maintained11529S: Maintained
11522F: Documentation/rfkill.txt11530F: Documentation/rfkill.txt
11531F: Documentation/ABI/stable/sysfs-class-rfkill
11523F: net/rfkill/11532F: net/rfkill/
11524 11533
11525RHASHTABLE11534RHASHTABLE
@@ -13343,6 +13352,15 @@ M: Mika Westerberg <mika.westerberg@linux.intel.com> · 1817 unmodified lines
13343M: Yehezkel Bernat <yehezkel.bernat@intel.com>13352M: Yehezkel Bernat <yehezkel.bernat@intel.com>
13344S: Maintained13353S: Maintained
13345F: drivers/thunderbolt/13354F: drivers/thunderbolt/
13355F: include/linux/thunderbolt.h
13356
13357THUNDERBOLT NETWORK DRIVER
13358M: Michael Jamet <michael.jamet@intel.com>
13359M: Mika Westerberg <mika.westerberg@linux.intel.com>
13360M: Yehezkel Bernat <yehezkel.bernat@intel.com>
13361L: netdev@vger.kernel.org
13362S: Maintained
13363F: drivers/net/thunderbolt.c
13346 13364
13347THUNDERX GPIO DRIVER13365THUNDERX GPIO DRIVER
13348M: David Daney <david.daney@cavium.com>13366M: David Daney <david.daney@cavium.com>
@@ -14322,12 +14340,15 @@ S: Maintained · 973 unmodified lines
14322F: include/linux/virtio_vsock.h14340F: include/linux/virtio_vsock.h
14323F: include/uapi/linux/virtio_vsock.h14341F: include/uapi/linux/virtio_vsock.h
14324F: include/uapi/linux/vsockmon.h14342F: include/uapi/linux/vsockmon.h
14343F: include/uapi/linux/vm_sockets_diag.h
14344F: net/vmw_vsock/diag.c
14325F: net/vmw_vsock/af_vsock_tap.c14345F: net/vmw_vsock/af_vsock_tap.c
14326F: net/vmw_vsock/virtio_transport_common.c14346F: net/vmw_vsock/virtio_transport_common.c
14327F: net/vmw_vsock/virtio_transport.c14347F: net/vmw_vsock/virtio_transport.c
14328F: drivers/net/vsockmon.c14348F: drivers/net/vsockmon.c
14329F: drivers/vhost/vsock.c14349F: drivers/vhost/vsock.c
14330F: drivers/vhost/vsock.h14350F: drivers/vhost/vsock.h
14351F: tools/testing/vsock/
14331 14352
14332VIRTIO CONSOLE DRIVER14353VIRTIO CONSOLE DRIVER
14333M: Amit Shah <amit@kernel.org>14354M: Amit Shah <amit@kernel.org>
@@ -14591,7 +14612,6 @@ L: wil6210@qca.qualcomm.com · 257 unmodified lines
14591S: Supported14612S: Supported
14592W: http://wireless.kernel.org/en/users/Drivers/wil621014613W: http://wireless.kernel.org/en/users/Drivers/wil6210
14593F: drivers/net/wireless/ath/wil6210/14614F: drivers/net/wireless/ath/wil6210/
14594F: include/uapi/linux/wil6210_uapi.h
14595 14615
14596WIMAX STACK14616WIMAX STACK
14597M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>14617M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
arch/blackfin/mach-bf518/boards/ezbrd.c+0−47
@@ -25,7 +25,6 @@ · 24 unmodified lines
25#include <asm/dpmc.h>25#include <asm/dpmc.h>
26#include <asm/bfin_sdh.h>26#include <asm/bfin_sdh.h>
27#include <linux/spi/ad7877.h>27#include <linux/spi/ad7877.h>
28#include <net/dsa.h>
29 28
30/*29/*
31 * Name the Board for the /proc/cpuinfo30 * Name the Board for the /proc/cpuinfo
@@ -105,11 +104,7 @@ static const unsigned short bfin_mac_peripherals[] = { · 73 unmodified lines
105 104
106static struct bfin_phydev_platform_data bfin_phydev_data[] = {105static struct bfin_phydev_platform_data bfin_phydev_data[] = {
107 {106 {
108#if IS_ENABLED(CONFIG_NET_DSA_KSZ8893M)
109 .addr = 3,
110#else
111 .addr = 1,107 .addr = 1,
112#endif
113 .irq = IRQ_MAC_PHYINT,108 .irq = IRQ_MAC_PHYINT,
114 },109 },
115};110};
@@ -119,9 +114,6 @@ static struct bfin_mii_bus_platform_data bfin_mii_bus_data = { · 3 unmodified lines
119 .phydev_data = bfin_phydev_data,114 .phydev_data = bfin_phydev_data,
120 .phy_mode = PHY_INTERFACE_MODE_MII,115 .phy_mode = PHY_INTERFACE_MODE_MII,
121 .mac_peripherals = bfin_mac_peripherals,116 .mac_peripherals = bfin_mac_peripherals,
122#if IS_ENABLED(CONFIG_NET_DSA_KSZ8893M)
123 .phy_mask = 0xfff7, /* Only probe the port phy connect to the on chip MAC */
124#endif
125 .vlan1_mask = 1,117 .vlan1_mask = 1,
126 .vlan2_mask = 2,118 .vlan2_mask = 2,
127};119};
@@ -140,29 +132,6 @@ static struct platform_device bfin_mac_device = { · 12 unmodified lines
140 }132 }
141};133};
142 134
143#if IS_ENABLED(CONFIG_NET_DSA_KSZ8893M)
144static struct dsa_chip_data ksz8893m_switch_chip_data = {
145 .mii_bus = &bfin_mii_bus.dev,
146 .port_names = {
147 NULL,
148 "eth%d",
149 "eth%d",
150 "cpu",
151 },
152};
153static struct dsa_platform_data ksz8893m_switch_data = {
154 .nr_chips = 1,
155 .netdev = &bfin_mac_device.dev,
156 .chip = &ksz8893m_switch_chip_data,
157};
158
159static struct platform_device ksz8893m_switch_device = {
160 .name = "dsa",
161 .id = 0,
162 .num_resources = 0,
163 .dev.platform_data = &ksz8893m_switch_data,
164};
165#endif
166#endif135#endif
167 136
168#if IS_ENABLED(CONFIG_MTD_M25P80)137#if IS_ENABLED(CONFIG_MTD_M25P80)
@@ -228,19 +197,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = { · 59 unmodified lines
228 },197 },
229#endif198#endif
230 199
231#if IS_ENABLED(CONFIG_BFIN_MAC)
232#if IS_ENABLED(CONFIG_NET_DSA_KSZ8893M)
233 {
234 .modalias = "ksz8893m",
235 .max_speed_hz = 5000000,
236 .bus_num = 0,
237 .chip_select = 1,
238 .platform_data = NULL,
239 .mode = SPI_MODE_3,
240 },
241#endif
242#endif
243
244#if IS_ENABLED(CONFIG_MMC_SPI)200#if IS_ENABLED(CONFIG_MMC_SPI)
245 {201 {
246 .modalias = "mmc_spi",202 .modalias = "mmc_spi",
@@ -714,9 +670,6 @@ static struct platform_device *stamp_devices[] __initdata = { · 467 unmodified lines
714#if IS_ENABLED(CONFIG_BFIN_MAC)670#if IS_ENABLED(CONFIG_BFIN_MAC)
715 &bfin_mii_bus,671 &bfin_mii_bus,
716 &bfin_mac_device,672 &bfin_mac_device,
717#if IS_ENABLED(CONFIG_NET_DSA_KSZ8893M)
718 &ksz8893m_switch_device,
719#endif
720#endif673#endif
721 674
722#if IS_ENABLED(CONFIG_SPI_BFIN5XX)675#if IS_ENABLED(CONFIG_SPI_BFIN5XX)
arch/blackfin/mach-bf518/boards/tcm-bf518.c+0−1
@@ -25,7 +25,6 @@ · 24 unmodified lines
25#include <asm/dpmc.h>25#include <asm/dpmc.h>
26#include <asm/bfin_sdh.h>26#include <asm/bfin_sdh.h>
27#include <linux/spi/ad7877.h>27#include <linux/spi/ad7877.h>
28#include <net/dsa.h>
29 28
30/*29/*
31 * Name the Board for the /proc/cpuinfo30 * Name the Board for the /proc/cpuinfo
arch/um/drivers/net_kern.c+4−5
@@ -168,7 +168,6 @@ static int uml_net_open(struct net_device *dev) · 167 unmodified lines
168 goto out_close;168 goto out_close;
169 }169 }
170 170
171 lp->tl.data = (unsigned long) &lp->user;
172 netif_start_queue(dev);171 netif_start_queue(dev);
173 172
174 /* clear buffer - it can happen that the host side of the interface173 /* clear buffer - it can happen that the host side of the interface
@@ -278,10 +277,11 @@ static const struct ethtool_ops uml_net_ethtool_ops = { · 103 unmodified lines
278 .get_ts_info = ethtool_op_get_ts_info,277 .get_ts_info = ethtool_op_get_ts_info,
279};278};
280 279
281static void uml_net_user_timer_expire(unsigned long _conn)280static void uml_net_user_timer_expire(struct timer_list *t)
282{281{
283#ifdef undef282#ifdef undef
284 struct connection *conn = (struct connection *)_conn;283 struct uml_net_private *lp = from_timer(lp, t, tl);
284 struct connection *conn = &lp->user;
285 285
286 dprintk(KERN_INFO "uml_net_user_timer_expire [%p]\n", conn);286 dprintk(KERN_INFO "uml_net_user_timer_expire [%p]\n", conn);
287 do_connect(conn);287 do_connect(conn);
@@ -458,9 +458,8 @@ static void eth_configure(int n, void *init, char *mac, · 170 unmodified lines
458 .add_address = transport->user->add_address,458 .add_address = transport->user->add_address,
459 .delete_address = transport->user->delete_address });459 .delete_address = transport->user->delete_address });
460 460
461 init_timer(&lp->tl);461 timer_setup(&lp->tl, uml_net_user_timer_expire, 0);
462 spin_lock_init(&lp->lock);462 spin_lock_init(&lp->lock);
463 lp->tl.function = uml_net_user_timer_expire;
464 memcpy(lp->mac, dev->dev_addr, sizeof(lp->mac));463 memcpy(lp->mac, dev->dev_addr, sizeof(lp->mac));
465 464
466 if ((transport->user->init != NULL) &&465 if ((transport->user->init != NULL) &&
drivers/atm/fore200e.c+8−0
@@ -358,26 +358,33 @@ fore200e_shutdown(struct fore200e* fore200e) · 357 unmodified lines
358 case FORE200E_STATE_COMPLETE:358 case FORE200E_STATE_COMPLETE:
359 kfree(fore200e->stats);359 kfree(fore200e->stats);
360 360
361 /* fall through */
361 case FORE200E_STATE_IRQ:362 case FORE200E_STATE_IRQ:
362 free_irq(fore200e->irq, fore200e->atm_dev);363 free_irq(fore200e->irq, fore200e->atm_dev);
363 364
365 /* fall through */
364 case FORE200E_STATE_ALLOC_BUF:366 case FORE200E_STATE_ALLOC_BUF:
365 fore200e_free_rx_buf(fore200e);367 fore200e_free_rx_buf(fore200e);
366 368
369 /* fall through */
367 case FORE200E_STATE_INIT_BSQ:370 case FORE200E_STATE_INIT_BSQ:
368 fore200e_uninit_bs_queue(fore200e);371 fore200e_uninit_bs_queue(fore200e);
369 372
373 /* fall through */
370 case FORE200E_STATE_INIT_RXQ:374 case FORE200E_STATE_INIT_RXQ:
371 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_rxq.status);375 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_rxq.status);
372 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_rxq.rpd);376 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_rxq.rpd);
373 377
378 /* fall through */
374 case FORE200E_STATE_INIT_TXQ:379 case FORE200E_STATE_INIT_TXQ:
375 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_txq.status);380 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_txq.status);
376 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_txq.tpd);381 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_txq.tpd);
377 382
383 /* fall through */
378 case FORE200E_STATE_INIT_CMDQ:384 case FORE200E_STATE_INIT_CMDQ:
379 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_cmdq.status);385 fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_cmdq.status);
380 386
387 /* fall through */
381 case FORE200E_STATE_INITIALIZE:388 case FORE200E_STATE_INITIALIZE:
382 /* nothing to do for that state */389 /* nothing to do for that state */
383 390
@@ -390,6 +397,7 @@ fore200e_shutdown(struct fore200e* fore200e) · 6 unmodified lines
390 case FORE200E_STATE_MAP:397 case FORE200E_STATE_MAP:
391 fore200e->bus->unmap(fore200e);398 fore200e->bus->unmap(fore200e);
392 399
400 /* fall through */
393 case FORE200E_STATE_CONFIGURE:401 case FORE200E_STATE_CONFIGURE:
394 /* nothing to do for that state */402 /* nothing to do for that state */
395 403
drivers/atm/horizon.c+1−1
@@ -2803,7 +2803,7 @@ out: · 2802 unmodified lines
2803 return err;2803 return err;
2804 2804
2805out_free_irq:2805out_free_irq:
2806 free_irq(dev->irq, dev);2806 free_irq(irq, dev);
2807out_free:2807out_free:
2808 kfree(dev);2808 kfree(dev);
2809out_release:2809out_release:
drivers/atm/idt77105.c+0−2
@@ -306,11 +306,9 @@ static int idt77105_start(struct atm_dev *dev) · 305 unmodified lines
306 if (start_timer) {306 if (start_timer) {
307 start_timer = 0;307 start_timer = 0;
308 308
309 setup_timer(&stats_timer, idt77105_stats_timer_func, 0UL);
310 stats_timer.expires = jiffies+IDT77105_STATS_TIMER_PERIOD;309 stats_timer.expires = jiffies+IDT77105_STATS_TIMER_PERIOD;
311 add_timer(&stats_timer);310 add_timer(&stats_timer);
312 311
313 setup_timer(&restart_timer, idt77105_restart_timer_func, 0UL);
314 restart_timer.expires = jiffies+IDT77105_RESTART_TIMER_PERIOD;312 restart_timer.expires = jiffies+IDT77105_RESTART_TIMER_PERIOD;
315 add_timer(&restart_timer);313 add_timer(&restart_timer);
316 }314 }
drivers/atm/idt77252.c+12−9
@@ -2073,21 +2073,19 @@ idt77252_rate_logindex(struct idt77252_dev *card, int pcr) · 2072 unmodified lines
2073}2073}
2074 2074
2075static void2075static void
2076idt77252_est_timer(unsigned long data)2076idt77252_est_timer(struct timer_list *t)
2077{2077{
2078 struct vc_map *vc = (struct vc_map *)data;2078 struct rate_estimator *est = from_timer(est, t, timer);
2079 struct vc_map *vc = est->vc;
2079 struct idt77252_dev *card = vc->card;2080 struct idt77252_dev *card = vc->card;
2080 struct rate_estimator *est;
2081 unsigned long flags;2081 unsigned long flags;
2082 u32 rate, cps;2082 u32 rate, cps;
2083 u64 ncells;2083 u64 ncells;
2084 u8 lacr;2084 u8 lacr;
2085 2085
2086 spin_lock_irqsave(&vc->lock, flags);2086 spin_lock_irqsave(&vc->lock, flags);
2087 est = vc->estimator;2087 if (!vc->estimator)
2088 if (!est)
2089 goto out;2088 goto out;
2090
2091 ncells = est->cells;2089 ncells = est->cells;
2092 2090
2093 rate = ((u32)(ncells - est->last_cells)) << (7 - est->interval);2091 rate = ((u32)(ncells - est->last_cells)) << (7 - est->interval);
@@ -2126,10 +2124,11 @@ idt77252_init_est(struct vc_map *vc, int pcr) · 32 unmodified lines
2126 est->maxcps = pcr < 0 ? -pcr : pcr;2124 est->maxcps = pcr < 0 ? -pcr : pcr;
2127 est->cps = est->maxcps;2125 est->cps = est->maxcps;
2128 est->avcps = est->cps << 5;2126 est->avcps = est->cps << 5;
2127 est->vc = vc;
2129 2128
2130 est->interval = 2; /* XXX: make this configurable */2129 est->interval = 2; /* XXX: make this configurable */
2131 est->ewma_log = 2; /* XXX: make this configurable */2130 est->ewma_log = 2; /* XXX: make this configurable */
2132 setup_timer(&est->timer, idt77252_est_timer, (unsigned long)vc);2131 timer_setup(&est->timer, idt77252_est_timer, 0);
2133 mod_timer(&est->timer, jiffies + ((HZ / 4) << est->interval));2132 mod_timer(&est->timer, jiffies + ((HZ / 4) << est->interval));
2134 2133
2135 return est;2134 return est;
@@ -2209,16 +2208,20 @@ static int · 73 unmodified lines
2209idt77252_init_ubr(struct idt77252_dev *card, struct vc_map *vc,2208idt77252_init_ubr(struct idt77252_dev *card, struct vc_map *vc,
2210 struct atm_vcc *vcc, struct atm_qos *qos)2209 struct atm_vcc *vcc, struct atm_qos *qos)
2211{2210{
2211 struct rate_estimator *est = NULL;
2212 unsigned long flags;2212 unsigned long flags;
2213 int tcr;2213 int tcr;
2214 2214
2215 spin_lock_irqsave(&vc->lock, flags);2215 spin_lock_irqsave(&vc->lock, flags);
2216 if (vc->estimator) {2216 if (vc->estimator) {
2217 del_timer(&vc->estimator->timer);2217 est = vc->estimator;
2218 kfree(vc->estimator);
2219 vc->estimator = NULL;2218 vc->estimator = NULL;
2220 }2219 }
2221 spin_unlock_irqrestore(&vc->lock, flags);2220 spin_unlock_irqrestore(&vc->lock, flags);
2221 if (est) {
2222 del_timer_sync(&est->timer);
2223 kfree(est);
2224 }
2222 2225
2223 tcr = atm_pcr_goal(&qos->txtp);2226 tcr = atm_pcr_goal(&qos->txtp);
2224 if (tcr == 0)2227 if (tcr == 0)
drivers/atm/idt77252.h+3−0
@@ -184,6 +184,8 @@ struct aal1 { · 183 unmodified lines
184 unsigned char sequence;184 unsigned char sequence;
185};185};
186 186
187struct vc_map;
188
187struct rate_estimator {189struct rate_estimator {
188 struct timer_list timer;190 struct timer_list timer;
189 unsigned int interval;191 unsigned int interval;
@@ -193,6 +195,7 @@ struct rate_estimator { · 3 unmodified lines
193 long avcps;195 long avcps;
194 u32 cps;196 u32 cps;
195 u32 maxcps;197 u32 maxcps;
198 struct vc_map *vc;
196};199};
197 200
198struct vc_map {201struct vc_map {
drivers/atm/iphase.c+3−3
@@ -880,7 +880,7 @@ static void ia_phy_write(struct iadev_priv *iadev, · 879 unmodified lines
880 880
881static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev)881static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev)
882{882{
883 static const struct ia_reg suni_ds3_init [] = {883 static const struct ia_reg suni_ds3_init[] = {
884 { SUNI_DS3_FRM_INTR_ENBL, 0x17 },884 { SUNI_DS3_FRM_INTR_ENBL, 0x17 },
885 { SUNI_DS3_FRM_CFG, 0x01 },885 { SUNI_DS3_FRM_CFG, 0x01 },
886 { SUNI_DS3_TRAN_CFG, 0x01 },886 { SUNI_DS3_TRAN_CFG, 0x01 },
@@ -898,7 +898,7 @@ static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev) · 11 unmodified lines
898 898
899static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev)899static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev)
900{900{
901 static const struct ia_reg suni_e3_init [] = {901 static const struct ia_reg suni_e3_init[] = {
902 { SUNI_E3_FRM_FRAM_OPTIONS, 0x04 },902 { SUNI_E3_FRM_FRAM_OPTIONS, 0x04 },
903 { SUNI_E3_FRM_MAINT_OPTIONS, 0x20 },903 { SUNI_E3_FRM_MAINT_OPTIONS, 0x20 },
904 { SUNI_E3_FRM_FRAM_INTR_ENBL, 0x1d },904 { SUNI_E3_FRM_FRAM_INTR_ENBL, 0x1d },
@@ -918,7 +918,7 @@ static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev) · 13 unmodified lines
918 918
919static void ia_suni_pm7345_init(struct iadev_priv *iadev)919static void ia_suni_pm7345_init(struct iadev_priv *iadev)
920{920{
921 static const struct ia_reg suni_init [] = {921 static const struct ia_reg suni_init[] = {
922 /* Enable RSOP loss of signal interrupt. */922 /* Enable RSOP loss of signal interrupt. */
923 { SUNI_INTR_ENBL, 0x28 },923 { SUNI_INTR_ENBL, 0x28 },
924 /* Clear error counters. */924 /* Clear error counters. */
drivers/atm/suni.c+4−6
@@ -53,7 +53,7 @@ static DEFINE_SPINLOCK(sunis_lock); · 52 unmodified lines
53 if (atomic_read(&stats->s) < 0) atomic_set(&stats->s,INT_MAX);53 if (atomic_read(&stats->s) < 0) atomic_set(&stats->s,INT_MAX);
54 54
55 55
56static void suni_hz(unsigned long from_timer)56static void suni_hz(struct timer_list *timer)
57{57{
58 struct suni_priv *walk;58 struct suni_priv *walk;
59 struct atm_dev *dev;59 struct atm_dev *dev;
@@ -85,7 +85,7 @@ static void suni_hz(unsigned long from_timer) · 25 unmodified lines
85 ((GET(TACP_TCC) & 0xff) << 8) |85 ((GET(TACP_TCC) & 0xff) << 8) |
86 ((GET(TACP_TCCM) & 7) << 16));86 ((GET(TACP_TCCM) & 7) << 16));
87 }87 }
88 if (from_timer) mod_timer(&poll_timer,jiffies+HZ);88 if (timer) mod_timer(&poll_timer,jiffies+HZ);
89}89}
90 90
91 91
@@ -322,13 +322,11 @@ static int suni_start(struct atm_dev *dev) · 230 unmodified lines
322 printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,322 printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,
323 dev->number);323 dev->number);
324 PRIV(dev)->loop_mode = ATM_LM_NONE;324 PRIV(dev)->loop_mode = ATM_LM_NONE;
325 suni_hz(0); /* clear SUNI counters */325 suni_hz(NULL); /* clear SUNI counters */
326 (void) fetch_stats(dev,NULL,1); /* clear kernel counters */326 (void) fetch_stats(dev,NULL,1); /* clear kernel counters */
327 if (first) {327 if (first) {
328 init_timer(&poll_timer);328 timer_setup(&poll_timer, suni_hz, 0);
329 poll_timer.expires = jiffies+HZ;329 poll_timer.expires = jiffies+HZ;
330 poll_timer.function = suni_hz;
331 poll_timer.data = 1;
332#if 0330#if 0
333printk(KERN_DEBUG "[u] p=0x%lx,n=0x%lx\n",(unsigned long) poll_timer.list.prev,331printk(KERN_DEBUG "[u] p=0x%lx,n=0x%lx\n",(unsigned long) poll_timer.list.prev,
334 (unsigned long) poll_timer.list.next);332 (unsigned long) poll_timer.list.next);
drivers/bcma/Kconfig+9−9
@@ -11,14 +11,15 @@ menuconfig BCMA · 10 unmodified lines
11 Bus driver for Broadcom specific Advanced Microcontroller Bus11 Bus driver for Broadcom specific Advanced Microcontroller Bus
12 Architecture.12 Architecture.
13 13
14if BCMA
15
14# Support for Block-I/O. SELECT this from the driver that needs it.16# Support for Block-I/O. SELECT this from the driver that needs it.
15config BCMA_BLOCKIO17config BCMA_BLOCKIO
16 bool18 bool
17 depends on BCMA
18 19
19config BCMA_HOST_PCI_POSSIBLE20config BCMA_HOST_PCI_POSSIBLE
20 bool21 bool
21 depends on BCMA && PCI = y22 depends on PCI = y
22 default y23 default y
23 24
24config BCMA_HOST_PCI25config BCMA_HOST_PCI
@@ -29,7 +30,6 @@ config BCMA_HOST_PCI · 4 unmodified lines
29 30
30config BCMA_HOST_SOC31config BCMA_HOST_SOC
31 bool "Support for BCMA in a SoC"32 bool "Support for BCMA in a SoC"
32 depends on BCMA
33 help33 help
34 Host interface for a Broadcom AIX bus directly mapped into34 Host interface for a Broadcom AIX bus directly mapped into
35 the memory. This only works with the Broadcom SoCs from the35 the memory. This only works with the Broadcom SoCs from the
@@ -39,7 +39,7 @@ config BCMA_HOST_SOC · 3 unmodified lines
39 39
40config BCMA_DRIVER_PCI40config BCMA_DRIVER_PCI
41 bool "BCMA Broadcom PCI core driver"41 bool "BCMA Broadcom PCI core driver"
42 depends on BCMA && PCI42 depends on PCI
43 default y43 default y
44 help44 help
45 BCMA bus may have many versions of PCIe core. This driver45 BCMA bus may have many versions of PCIe core. This driver
@@ -55,13 +55,13 @@ config BCMA_DRIVER_PCI · 9 unmodified lines
55 55
56config BCMA_DRIVER_PCI_HOSTMODE56config BCMA_DRIVER_PCI_HOSTMODE
57 bool "Driver for PCI core working in hostmode"57 bool "Driver for PCI core working in hostmode"
58 depends on BCMA && MIPS && BCMA_DRIVER_PCI58 depends on MIPS && BCMA_DRIVER_PCI
59 help59 help
60 PCI core hostmode operation (external PCI bus).60 PCI core hostmode operation (external PCI bus).
61 61
62config BCMA_DRIVER_MIPS62config BCMA_DRIVER_MIPS
63 bool "BCMA Broadcom MIPS core driver"63 bool "BCMA Broadcom MIPS core driver"
64 depends on BCMA && MIPS64 depends on MIPS
65 help65 help
66 Driver for the Broadcom MIPS core attached to Broadcom specific66 Driver for the Broadcom MIPS core attached to Broadcom specific
67 Advanced Microcontroller Bus.67 Advanced Microcontroller Bus.
@@ -92,7 +92,6 @@ config BCMA_NFLASH · 24 unmodified lines
92 92
93config BCMA_DRIVER_GMAC_CMN93config BCMA_DRIVER_GMAC_CMN
94 bool "BCMA Broadcom GBIT MAC COMMON core driver"94 bool "BCMA Broadcom GBIT MAC COMMON core driver"
95 depends on BCMA
96 help95 help
97 Driver for the Broadcom GBIT MAC COMMON core attached to Broadcom96 Driver for the Broadcom GBIT MAC COMMON core attached to Broadcom
98 specific Advanced Microcontroller Bus.97 specific Advanced Microcontroller Bus.
@@ -101,7 +100,7 @@ config BCMA_DRIVER_GMAC_CMN · 2 unmodified lines
101 100
102config BCMA_DRIVER_GPIO101config BCMA_DRIVER_GPIO
103 bool "BCMA GPIO driver"102 bool "BCMA GPIO driver"
104 depends on BCMA && GPIOLIB103 depends on GPIOLIB
105 select GPIOLIB_IRQCHIP if BCMA_HOST_SOC104 select GPIOLIB_IRQCHIP if BCMA_HOST_SOC
106 help105 help
107 Driver to provide access to the GPIO pins of the bcma bus.106 Driver to provide access to the GPIO pins of the bcma bus.
@@ -110,8 +109,9 @@ config BCMA_DRIVER_GPIO · 2 unmodified lines
110 109
111config BCMA_DEBUG110config BCMA_DEBUG
112 bool "BCMA debugging"111 bool "BCMA debugging"
113 depends on BCMA
114 help112 help
115 This turns on additional debugging messages.113 This turns on additional debugging messages.
116 114
117 If unsure, say N115 If unsure, say N
116
117endif # BCMA
drivers/bcma/driver_mips.c+8−4
@@ -184,10 +184,14 @@ static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq) · 183 unmodified lines
184{184{
185 int i;185 int i;
186 static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};186 static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
187 printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);187 char interrupts[20];
188 for (i = 0; i <= 6; i++)188 char *ints = interrupts;
189 printk(" %s%s", irq_name[i], i == irq ? "*" : " ");189
190 printk("\n");190 for (i = 0; i < ARRAY_SIZE(irq_name); i++)
191 ints += sprintf(ints, " %s%c",
192 irq_name[i], i == irq ? '*' : ' ');
193
194 bcma_debug(dev->bus, "core 0x%04x, irq:%s\n", dev->id.id, interrupts);
191}195}
192 196
193static void bcma_core_mips_dump_irq(struct bcma_bus *bus)197static void bcma_core_mips_dump_irq(struct bcma_bus *bus)
drivers/bluetooth/Kconfig+2−1
@@ -66,6 +66,7 @@ config BT_HCIBTSDIO · 65 unmodified lines
66 66
67config BT_HCIUART67config BT_HCIUART
68 tristate "HCI UART driver"68 tristate "HCI UART driver"
69 depends on SERIAL_DEV_BUS || !SERIAL_DEV_BUS
69 depends on TTY70 depends on TTY
70 help71 help
71 Bluetooth HCI UART driver.72 Bluetooth HCI UART driver.
@@ -80,7 +81,6 @@ config BT_HCIUART · 8 unmodified lines
80config BT_HCIUART_SERDEV81config BT_HCIUART_SERDEV
81 bool82 bool
82 depends on SERIAL_DEV_BUS && BT_HCIUART83 depends on SERIAL_DEV_BUS && BT_HCIUART
83 depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART
84 default y84 default y
85 85
86config BT_HCIUART_H486config BT_HCIUART_H4
@@ -170,6 +170,7 @@ config BT_HCIUART_BCM · 83 unmodified lines
170 bool "Broadcom protocol support"170 bool "Broadcom protocol support"
171 depends on BT_HCIUART171 depends on BT_HCIUART
172 depends on BT_HCIUART_SERDEV172 depends on BT_HCIUART_SERDEV
173 depends on (!ACPI || SERIAL_DEV_CTRL_TTYPORT)
173 select BT_HCIUART_H4174 select BT_HCIUART_H4
174 select BT_BCM175 select BT_BCM
175 help176 help
drivers/bluetooth/bcm203x.c+1−1
@@ -121,7 +121,7 @@ static void bcm203x_complete(struct urb *urb) · 120 unmodified lines
121 }121 }
122 122
123 data->state = BCM203X_LOAD_FIRMWARE;123 data->state = BCM203X_LOAD_FIRMWARE;
124 124 /* fall through */
125 case BCM203X_LOAD_FIRMWARE:125 case BCM203X_LOAD_FIRMWARE:
126 if (data->fw_sent == data->fw_size) {126 if (data->fw_sent == data->fw_size) {
127 usb_fill_int_urb(urb, udev, usb_rcvintpipe(udev, BCM203X_IN_EP),127 usb_fill_int_urb(urb, udev, usb_rcvintpipe(udev, BCM203X_IN_EP),
drivers/bluetooth/bluecard_cs.c+3−4
@@ -156,9 +156,9 @@ static void bluecard_detach(struct pcmcia_device *p_dev); · 155 unmodified lines
156/* ======================== LED handling routines ======================== */156/* ======================== LED handling routines ======================== */
157 157
158 158
159static void bluecard_activity_led_timeout(u_long arg)159static void bluecard_activity_led_timeout(struct timer_list *t)
160{160{
161 struct bluecard_info *info = (struct bluecard_info *)arg;161 struct bluecard_info *info = from_timer(info, t, timer);
162 unsigned int iobase = info->p_dev->resource[0]->start;162 unsigned int iobase = info->p_dev->resource[0]->start;
163 163
164 if (test_bit(CARD_ACTIVITY, &(info->hw_state))) {164 if (test_bit(CARD_ACTIVITY, &(info->hw_state))) {
@@ -691,8 +691,7 @@ static int bluecard_open(struct bluecard_info *info) · 526 unmodified lines
691 691
692 spin_lock_init(&(info->lock));692 spin_lock_init(&(info->lock));
693 693
694 setup_timer(&(info->timer), &bluecard_activity_led_timeout,694 timer_setup(&info->timer, bluecard_activity_led_timeout, 0);
695 (u_long)info);
696 695
697 skb_queue_head_init(&(info->txq));696 skb_queue_head_init(&(info->txq));
698 697
drivers/bluetooth/bpa10x.c+6−9
@@ -117,7 +117,7 @@ static void bpa10x_rx_complete(struct urb *urb) · 116 unmodified lines
117 bpa10x_recv_pkts,117 bpa10x_recv_pkts,
118 ARRAY_SIZE(bpa10x_recv_pkts));118 ARRAY_SIZE(bpa10x_recv_pkts));
119 if (IS_ERR(data->rx_skb[idx])) {119 if (IS_ERR(data->rx_skb[idx])) {
120 BT_ERR("%s corrupted event packet", hdev->name);120 bt_dev_err(hdev, "corrupted event packet");
121 hdev->stat.err_rx++;121 hdev->stat.err_rx++;
122 data->rx_skb[idx] = NULL;122 data->rx_skb[idx] = NULL;
123 }123 }
@@ -127,8 +127,7 @@ static void bpa10x_rx_complete(struct urb *urb) · 3 unmodified lines
127 127
128 err = usb_submit_urb(urb, GFP_ATOMIC);128 err = usb_submit_urb(urb, GFP_ATOMIC);
129 if (err < 0) {129 if (err < 0) {
130 BT_ERR("%s urb %p failed to resubmit (%d)",130 bt_dev_err(hdev, "urb %p failed to resubmit (%d)", urb, -err);
131 hdev->name, urb, -err);
132 usb_unanchor_urb(urb);131 usb_unanchor_urb(urb);
133 }132 }
134}133}
@@ -164,8 +163,7 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev) · 29 unmodified lines
164 163
165 err = usb_submit_urb(urb, GFP_KERNEL);164 err = usb_submit_urb(urb, GFP_KERNEL);
166 if (err < 0) {165 if (err < 0) {
167 BT_ERR("%s urb %p submission failed (%d)",166 bt_dev_err(hdev, "urb %p submission failed (%d)", urb, -err);
168 hdev->name, urb, -err);
169 usb_unanchor_urb(urb);167 usb_unanchor_urb(urb);
170 }168 }
171 169
@@ -205,8 +203,7 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev) · 33 unmodified lines
205 203
206 err = usb_submit_urb(urb, GFP_KERNEL);204 err = usb_submit_urb(urb, GFP_KERNEL);
207 if (err < 0) {205 if (err < 0) {
208 BT_ERR("%s urb %p submission failed (%d)",206 bt_dev_err(hdev, "urb %p submission failed (%d)", urb, -err);
209 hdev->name, urb, -err);
210 usb_unanchor_urb(urb);207 usb_unanchor_urb(urb);
211 }208 }
212 209
@@ -272,7 +269,7 @@ static int bpa10x_setup(struct hci_dev *hdev) · 59 unmodified lines
272 if (IS_ERR(skb))269 if (IS_ERR(skb))
273 return PTR_ERR(skb);270 return PTR_ERR(skb);
274 271
275 BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));272 bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
276 273
277 hci_set_fw_info(hdev, "%s", skb->data + 1);274 hci_set_fw_info(hdev, "%s", skb->data + 1);
278 275
@@ -348,7 +345,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) · 69 unmodified lines
348 345
349 err = usb_submit_urb(urb, GFP_ATOMIC);346 err = usb_submit_urb(urb, GFP_ATOMIC);
350 if (err < 0) {347 if (err < 0) {
351 BT_ERR("%s urb %p submission failed", hdev->name, urb);348 bt_dev_err(hdev, "urb %p submission failed", urb);
352 kfree(urb->setup_packet);349 kfree(urb->setup_packet);
353 usb_unanchor_urb(urb);350 usb_unanchor_urb(urb);
354 }351 }
drivers/bluetooth/bt3c_cs.c+1−1
@@ -355,7 +355,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst) · 354 unmodified lines
355 } else if ((stat & 0xff) != 0xff) {355 } else if ((stat & 0xff) != 0xff) {
356 if (stat & 0x0020) {356 if (stat & 0x0020) {
357 int status = bt3c_read(iobase, 0x7002) & 0x10;357 int status = bt3c_read(iobase, 0x7002) & 0x10;
358 BT_INFO("%s: Antenna %s", info->hdev->name,358 bt_dev_info(info->hdev, "Antenna %s",
359 status ? "out" : "in");359 status ? "out" : "in");
360 }360 }
361 if (stat & 0x0001)361 if (stat & 0x0001)
drivers/bluetooth/btbcm.c+53−53
@@ -45,13 +45,12 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) · 44 unmodified lines
45 HCI_INIT_TIMEOUT);45 HCI_INIT_TIMEOUT);
46 if (IS_ERR(skb)) {46 if (IS_ERR(skb)) {
47 int err = PTR_ERR(skb);47 int err = PTR_ERR(skb);
48 BT_ERR("%s: BCM: Reading device address failed (%d)",48 bt_dev_err(hdev, "BCM: Reading device address failed (%d)", err);
49 hdev->name, err);
50 return err;49 return err;
51 }50 }
52 51
53 if (skb->len != sizeof(*bda)) {52 if (skb->len != sizeof(*bda)) {
54 BT_ERR("%s: BCM: Device address length mismatch", hdev->name);53 bt_dev_err(hdev, "BCM: Device address length mismatch");
55 kfree_skb(skb);54 kfree_skb(skb);
56 return -EIO;55 return -EIO;
57 }56 }
@@ -74,8 +73,8 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) · 16 unmodified lines
74 if (!bacmp(&bda->bdaddr, BDADDR_BCM20702A0) ||73 if (!bacmp(&bda->bdaddr, BDADDR_BCM20702A0) ||
75 !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) ||74 !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) ||
76 !bacmp(&bda->bdaddr, BDADDR_BCM4330B1)) {75 !bacmp(&bda->bdaddr, BDADDR_BCM4330B1)) {
77 BT_INFO("%s: BCM: Using default device address (%pMR)",76 bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
78 hdev->name, &bda->bdaddr);77 &bda->bdaddr);
79 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);78 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
80 }79 }
81 80
@@ -93,8 +92,7 @@ int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) · 11 unmodified lines
93 skb = __hci_cmd_sync(hdev, 0xfc01, 6, bdaddr, HCI_INIT_TIMEOUT);92 skb = __hci_cmd_sync(hdev, 0xfc01, 6, bdaddr, HCI_INIT_TIMEOUT);
94 if (IS_ERR(skb)) {93 if (IS_ERR(skb)) {
95 err = PTR_ERR(skb);94 err = PTR_ERR(skb);
96 BT_ERR("%s: BCM: Change address command failed (%d)",95 bt_dev_err(hdev, "BCM: Change address command failed (%d)", err);
97 hdev->name, err);
98 return err;96 return err;
99 }97 }
100 kfree_skb(skb);98 kfree_skb(skb);
@@ -116,8 +114,8 @@ int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) · 15 unmodified lines
116 skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT);114 skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT);
117 if (IS_ERR(skb)) {115 if (IS_ERR(skb)) {
118 err = PTR_ERR(skb);116 err = PTR_ERR(skb);
119 BT_ERR("%s: BCM: Download Minidrv command failed (%d)",117 bt_dev_err(hdev, "BCM: Download Minidrv command failed (%d)",
120 hdev->name, err);118 err);
121 goto done;119 goto done;
122 }120 }
123 kfree_skb(skb);121 kfree_skb(skb);
@@ -136,7 +134,7 @@ int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) · 12 unmodified lines
136 fw_size -= sizeof(*cmd);134 fw_size -= sizeof(*cmd);
137 135
138 if (fw_size < cmd->plen) {136 if (fw_size < cmd->plen) {
139 BT_ERR("%s: BCM: Patch is corrupted", hdev->name);137 bt_dev_err(hdev, "BCM: Patch is corrupted");
140 err = -EINVAL;138 err = -EINVAL;
141 goto done;139 goto done;
142 }140 }
@@ -151,8 +149,8 @@ int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) · 8 unmodified lines
151 HCI_INIT_TIMEOUT);149 HCI_INIT_TIMEOUT);
152 if (IS_ERR(skb)) {150 if (IS_ERR(skb)) {
153 err = PTR_ERR(skb);151 err = PTR_ERR(skb);
154 BT_ERR("%s: BCM: Patch command %04x failed (%d)",152 bt_dev_err(hdev, "BCM: Patch command %04x failed (%d)",
155 hdev->name, opcode, err);153 opcode, err);
156 goto done;154 goto done;
157 }155 }
158 kfree_skb(skb);156 kfree_skb(skb);
@@ -173,7 +171,7 @@ static int btbcm_reset(struct hci_dev *hdev) · 14 unmodified lines
173 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);171 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
174 if (IS_ERR(skb)) {172 if (IS_ERR(skb)) {
175 int err = PTR_ERR(skb);173 int err = PTR_ERR(skb);
176 BT_ERR("%s: BCM: Reset failed (%d)", hdev->name, err);174 bt_dev_err(hdev, "BCM: Reset failed (%d)", err);
177 return err;175 return err;
178 }176 }
179 kfree_skb(skb);177 kfree_skb(skb);
@@ -191,13 +189,13 @@ static struct sk_buff *btbcm_read_local_name(struct hci_dev *hdev) · 11 unmodified lines
191 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_NAME, 0, NULL,189 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_NAME, 0, NULL,
192 HCI_INIT_TIMEOUT);190 HCI_INIT_TIMEOUT);
193 if (IS_ERR(skb)) {191 if (IS_ERR(skb)) {
194 BT_ERR("%s: BCM: Reading local name failed (%ld)",192 bt_dev_err(hdev, "BCM: Reading local name failed (%ld)",
195 hdev->name, PTR_ERR(skb));193 PTR_ERR(skb));
196 return skb;194 return skb;
197 }195 }
198 196
199 if (skb->len != sizeof(struct hci_rp_read_local_name)) {197 if (skb->len != sizeof(struct hci_rp_read_local_name)) {
200 BT_ERR("%s: BCM: Local name length mismatch", hdev->name);198 bt_dev_err(hdev, "BCM: Local name length mismatch");
201 kfree_skb(skb);199 kfree_skb(skb);
202 return ERR_PTR(-EIO);200 return ERR_PTR(-EIO);
203 }201 }
@@ -212,13 +210,13 @@ static struct sk_buff *btbcm_read_local_version(struct hci_dev *hdev) · 8 unmodified lines
212 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,210 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
213 HCI_INIT_TIMEOUT);211 HCI_INIT_TIMEOUT);
214 if (IS_ERR(skb)) {212 if (IS_ERR(skb)) {
215 BT_ERR("%s: BCM: Reading local version info failed (%ld)",213 bt_dev_err(hdev, "BCM: Reading local version info failed (%ld)",
216 hdev->name, PTR_ERR(skb));214 PTR_ERR(skb));
217 return skb;215 return skb;
218 }216 }
219 217
220 if (skb->len != sizeof(struct hci_rp_read_local_version)) {218 if (skb->len != sizeof(struct hci_rp_read_local_version)) {
221 BT_ERR("%s: BCM: Local version length mismatch", hdev->name);219 bt_dev_err(hdev, "BCM: Local version length mismatch");
222 kfree_skb(skb);220 kfree_skb(skb);
223 return ERR_PTR(-EIO);221 return ERR_PTR(-EIO);
224 }222 }
@@ -232,13 +230,13 @@ static struct sk_buff *btbcm_read_verbose_config(struct hci_dev *hdev) · 7 unmodified lines
232 230
233 skb = __hci_cmd_sync(hdev, 0xfc79, 0, NULL, HCI_INIT_TIMEOUT);231 skb = __hci_cmd_sync(hdev, 0xfc79, 0, NULL, HCI_INIT_TIMEOUT);
234 if (IS_ERR(skb)) {232 if (IS_ERR(skb)) {
235 BT_ERR("%s: BCM: Read verbose config info failed (%ld)",233 bt_dev_err(hdev, "BCM: Read verbose config info failed (%ld)",
236 hdev->name, PTR_ERR(skb));234 PTR_ERR(skb));
237 return skb;235 return skb;
238 }236 }
239 237
240 if (skb->len != 7) {238 if (skb->len != 7) {
241 BT_ERR("%s: BCM: Verbose config length mismatch", hdev->name);239 bt_dev_err(hdev, "BCM: Verbose config length mismatch");
242 kfree_skb(skb);240 kfree_skb(skb);
243 return ERR_PTR(-EIO);241 return ERR_PTR(-EIO);
244 }242 }
@@ -252,14 +250,13 @@ static struct sk_buff *btbcm_read_controller_features(struct hci_dev *hdev) · 7 unmodified lines
252 250
253 skb = __hci_cmd_sync(hdev, 0xfc6e, 0, NULL, HCI_INIT_TIMEOUT);251 skb = __hci_cmd_sync(hdev, 0xfc6e, 0, NULL, HCI_INIT_TIMEOUT);
254 if (IS_ERR(skb)) {252 if (IS_ERR(skb)) {
255 BT_ERR("%s: BCM: Read controller features failed (%ld)",253 bt_dev_err(hdev, "BCM: Read controller features failed (%ld)",
256 hdev->name, PTR_ERR(skb));254 PTR_ERR(skb));
257 return skb;255 return skb;
258 }256 }
259 257
260 if (skb->len != 9) {258 if (skb->len != 9) {
261 BT_ERR("%s: BCM: Controller features length mismatch",259 bt_dev_err(hdev, "BCM: Controller features length mismatch");
262 hdev->name);
263 kfree_skb(skb);260 kfree_skb(skb);
264 return ERR_PTR(-EIO);261 return ERR_PTR(-EIO);
265 }262 }
@@ -273,13 +270,13 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · 7 unmodified lines
273 270
274 skb = __hci_cmd_sync(hdev, 0xfc5a, 0, NULL, HCI_INIT_TIMEOUT);271 skb = __hci_cmd_sync(hdev, 0xfc5a, 0, NULL, HCI_INIT_TIMEOUT);
275 if (IS_ERR(skb)) {272 if (IS_ERR(skb)) {
276 BT_ERR("%s: BCM: Read USB product info failed (%ld)",273 bt_dev_err(hdev, "BCM: Read USB product info failed (%ld)",
277 hdev->name, PTR_ERR(skb));274 PTR_ERR(skb));
278 return skb;275 return skb;
279 }276 }
280 277
281 if (skb->len != 5) {278 if (skb->len != 5) {
282 BT_ERR("%s: BCM: USB product length mismatch", hdev->name);279 bt_dev_err(hdev, "BCM: USB product length mismatch");
283 kfree_skb(skb);280 kfree_skb(skb);
284 return ERR_PTR(-EIO);281 return ERR_PTR(-EIO);
285 }282 }
@@ -296,7 +293,7 @@ static int btbcm_read_info(struct hci_dev *hdev) · 10 unmodified lines
296 if (IS_ERR(skb))293 if (IS_ERR(skb))
297 return PTR_ERR(skb);294 return PTR_ERR(skb);
298 295
299 BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);296 bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
300 kfree_skb(skb);297 kfree_skb(skb);
301 298
302 /* Read Controller Features */299 /* Read Controller Features */
@@ -304,7 +301,7 @@ static int btbcm_read_info(struct hci_dev *hdev) · 1 unmodified line
304 if (IS_ERR(skb))301 if (IS_ERR(skb))
305 return PTR_ERR(skb);302 return PTR_ERR(skb);
306 303
307 BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);304 bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
308 kfree_skb(skb);305 kfree_skb(skb);
309 306
310 /* Read Local Name */307 /* Read Local Name */
@@ -312,7 +309,7 @@ static int btbcm_read_info(struct hci_dev *hdev) · 1 unmodified line
312 if (IS_ERR(skb))309 if (IS_ERR(skb))
313 return PTR_ERR(skb);310 return PTR_ERR(skb);
314 311
315 BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));312 bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
316 kfree_skb(skb);313 kfree_skb(skb);
317 314
318 return 0;315 return 0;
@@ -327,6 +324,8 @@ static const struct { · 8 unmodified lines
327 { 0x4406, "BCM4324B3" }, /* 002.004.006 */324 { 0x4406, "BCM4324B3" }, /* 002.004.006 */
328 { 0x610c, "BCM4354" }, /* 003.001.012 */325 { 0x610c, "BCM4354" }, /* 003.001.012 */
329 { 0x2209, "BCM43430A1" }, /* 001.002.009 */326 { 0x2209, "BCM43430A1" }, /* 001.002.009 */
327 { 0x6119, "BCM4345C0" }, /* 003.001.025 */
328 { 0x230f, "BCM4356A2" }, /* 001.003.015 */
330 { }329 { }
331};330};
332 331
@@ -361,6 +360,7 @@ int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len) · 28 unmodified lines
361 switch ((rev & 0xf000) >> 12) {360 switch ((rev & 0xf000) >> 12) {
362 case 0:361 case 0:
363 case 1:362 case 1:
363 case 2:
364 case 3:364 case 3:
365 for (i = 0; bcm_uart_subver_table[i].name; i++) {365 for (i = 0; bcm_uart_subver_table[i].name; i++) {
366 if (subver == bcm_uart_subver_table[i].subver) {366 if (subver == bcm_uart_subver_table[i].subver) {
@@ -375,9 +375,9 @@ int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len) · 8 unmodified lines
375 return 0;375 return 0;
376 }376 }
377 377
378 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,378 bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u",
379 hw_name ? : "BCM", (subver & 0xe000) >> 13,379 hw_name ? : "BCM", (subver & 0xe000) >> 13,
380 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);380 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
381 381
382 return 0;382 return 0;
383}383}
@@ -405,9 +405,9 @@ int btbcm_finalize(struct hci_dev *hdev) · 21 unmodified lines
405 subver = le16_to_cpu(ver->lmp_subver);405 subver = le16_to_cpu(ver->lmp_subver);
406 kfree_skb(skb);406 kfree_skb(skb);
407 407
408 BT_INFO("%s: BCM (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,408 bt_dev_info(hdev, "BCM (%3.3u.%3.3u.%3.3u) build %4.4u",
409 (subver & 0xe000) >> 13, (subver & 0x1f00) >> 8,409 (subver & 0xe000) >> 13, (subver & 0x1f00) >> 8,
410 (subver & 0x00ff), rev & 0x0fff);410 (subver & 0x00ff), rev & 0x0fff);
411 411
412 btbcm_check_bdaddr(hdev);412 btbcm_check_bdaddr(hdev);
413 413
@@ -502,13 +502,13 @@ int btbcm_setup_patchram(struct hci_dev *hdev) · 88 unmodified lines
502 return 0;502 return 0;
503 }503 }
504 504
505 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,505 bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u",
506 hw_name ? : "BCM", (subver & 0xe000) >> 13,506 hw_name ? : "BCM", (subver & 0xe000) >> 13,
507 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);507 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
508 508
509 err = request_firmware(&fw, fw_name, &hdev->dev);509 err = request_firmware(&fw, fw_name, &hdev->dev);
510 if (err < 0) {510 if (err < 0) {
511 BT_INFO("%s: BCM: Patch %s not found", hdev->name, fw_name);511 bt_dev_info(hdev, "BCM: Patch %s not found", fw_name);
512 goto done;512 goto done;
513 }513 }
514 514
@@ -531,16 +531,16 @@ int btbcm_setup_patchram(struct hci_dev *hdev) · 16 unmodified lines
531 subver = le16_to_cpu(ver->lmp_subver);531 subver = le16_to_cpu(ver->lmp_subver);
532 kfree_skb(skb);532 kfree_skb(skb);
533 533
534 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,534 bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u",
535 hw_name ? : "BCM", (subver & 0xe000) >> 13,535 hw_name ? : "BCM", (subver & 0xe000) >> 13,
536 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);536 (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
537 537
538 /* Read Local Name */538 /* Read Local Name */
539 skb = btbcm_read_local_name(hdev);539 skb = btbcm_read_local_name(hdev);
540 if (IS_ERR(skb))540 if (IS_ERR(skb))
541 return PTR_ERR(skb);541 return PTR_ERR(skb);
542 542
543 BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));543 bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
544 kfree_skb(skb);544 kfree_skb(skb);
545 545
546done:546done:
@@ -565,31 +565,31 @@ int btbcm_setup_apple(struct hci_dev *hdev) · 18 unmodified lines
565 /* Read Verbose Config Version Info */565 /* Read Verbose Config Version Info */
566 skb = btbcm_read_verbose_config(hdev);566 skb = btbcm_read_verbose_config(hdev);
567 if (!IS_ERR(skb)) {567 if (!IS_ERR(skb)) {
568 BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name,568 bt_dev_info(hdev, "BCM: chip id %u build %4.4u",
569 skb->data[1], get_unaligned_le16(skb->data + 5));569 skb->data[1], get_unaligned_le16(skb->data + 5));
570 kfree_skb(skb);570 kfree_skb(skb);
571 }571 }
572 572
573 /* Read USB Product Info */573 /* Read USB Product Info */
574 skb = btbcm_read_usb_product(hdev);574 skb = btbcm_read_usb_product(hdev);
575 if (!IS_ERR(skb)) {575 if (!IS_ERR(skb)) {
576 BT_INFO("%s: BCM: product %4.4x:%4.4x", hdev->name,576 bt_dev_info(hdev, "BCM: product %4.4x:%4.4x",
577 get_unaligned_le16(skb->data + 1),577 get_unaligned_le16(skb->data + 1),
578 get_unaligned_le16(skb->data + 3));578 get_unaligned_le16(skb->data + 3));
579 kfree_skb(skb);579 kfree_skb(skb);
580 }580 }
581 581
582 /* Read Controller Features */582 /* Read Controller Features */
583 skb = btbcm_read_controller_features(hdev);583 skb = btbcm_read_controller_features(hdev);
584 if (!IS_ERR(skb)) {584 if (!IS_ERR(skb)) {
585 BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);585 bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
586 kfree_skb(skb);586 kfree_skb(skb);
587 }587 }
588 588
589 /* Read Local Name */589 /* Read Local Name */
590 skb = btbcm_read_local_name(hdev);590 skb = btbcm_read_local_name(hdev);
591 if (!IS_ERR(skb)) {591 if (!IS_ERR(skb)) {
592 BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));592 bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
593 kfree_skb(skb);593 kfree_skb(skb);
594 }594 }
595 595
drivers/bluetooth/btintel.c+21−21
@@ -43,13 +43,13 @@ int btintel_check_bdaddr(struct hci_dev *hdev) · 42 unmodified lines
43 HCI_INIT_TIMEOUT);43 HCI_INIT_TIMEOUT);
44 if (IS_ERR(skb)) {44 if (IS_ERR(skb)) {
45 int err = PTR_ERR(skb);45 int err = PTR_ERR(skb);
46 BT_ERR("%s: Reading Intel device address failed (%d)",46 bt_dev_err(hdev, "Reading Intel device address failed (%d)",
47 hdev->name, err);47 err);
48 return err;48 return err;
49 }49 }
50 50
51 if (skb->len != sizeof(*bda)) {51 if (skb->len != sizeof(*bda)) {
52 BT_ERR("%s: Intel device address length mismatch", hdev->name);52 bt_dev_err(hdev, "Intel device address length mismatch");
53 kfree_skb(skb);53 kfree_skb(skb);
54 return -EIO;54 return -EIO;
55 }55 }
@@ -62,8 +62,8 @@ int btintel_check_bdaddr(struct hci_dev *hdev) · 6 unmodified lines
62 * and that in turn can cause problems with Bluetooth operation.62 * and that in turn can cause problems with Bluetooth operation.
63 */63 */
64 if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) {64 if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) {
65 BT_ERR("%s: Found Intel default device address (%pMR)",65 bt_dev_err(hdev, "Found Intel default device address (%pMR)",
66 hdev->name, &bda->bdaddr);66 &bda->bdaddr);
67 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);67 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
68 }68 }
69 69
@@ -123,8 +123,8 @@ int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) · 53 unmodified lines
123 skb = __hci_cmd_sync(hdev, 0xfc31, 6, bdaddr, HCI_INIT_TIMEOUT);123 skb = __hci_cmd_sync(hdev, 0xfc31, 6, bdaddr, HCI_INIT_TIMEOUT);
124 if (IS_ERR(skb)) {124 if (IS_ERR(skb)) {
125 err = PTR_ERR(skb);125 err = PTR_ERR(skb);
126 BT_ERR("%s: Changing Intel device address failed (%d)",126 bt_dev_err(hdev, "Changing Intel device address failed (%d)",
127 hdev->name, err);127 err);
128 return err;128 return err;
129 }129 }
130 kfree_skb(skb);130 kfree_skb(skb);
@@ -154,8 +154,8 @@ int btintel_set_diag(struct hci_dev *hdev, bool enable) · 23 unmodified lines
154 err = PTR_ERR(skb);154 err = PTR_ERR(skb);
155 if (err == -ENODATA)155 if (err == -ENODATA)
156 goto done;156 goto done;
157 BT_ERR("%s: Changing Intel diagnostic mode failed (%d)",157 bt_dev_err(hdev, "Changing Intel diagnostic mode failed (%d)",
158 hdev->name, err);158 err);
159 return err;159 return err;
160 }160 }
161 kfree_skb(skb);161 kfree_skb(skb);
@@ -189,30 +189,30 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code) · 27 unmodified lines
189 struct sk_buff *skb;189 struct sk_buff *skb;
190 u8 type = 0x00;190 u8 type = 0x00;
191 191
192 BT_ERR("%s: Hardware error 0x%2.2x", hdev->name, code);192 bt_dev_err(hdev, "Hardware error 0x%2.2x", code);
193 193
194 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);194 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
195 if (IS_ERR(skb)) {195 if (IS_ERR(skb)) {
196 BT_ERR("%s: Reset after hardware error failed (%ld)",196 bt_dev_err(hdev, "Reset after hardware error failed (%ld)",
197 hdev->name, PTR_ERR(skb));197 PTR_ERR(skb));
198 return;198 return;
199 }199 }
200 kfree_skb(skb);200 kfree_skb(skb);
201 201
202 skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT);202 skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT);
203 if (IS_ERR(skb)) {203 if (IS_ERR(skb)) {
204 BT_ERR("%s: Retrieving Intel exception info failed (%ld)",204 bt_dev_err(hdev, "Retrieving Intel exception info failed (%ld)",
205 hdev->name, PTR_ERR(skb));205 PTR_ERR(skb));
206 return;206 return;
207 }207 }
208 208
209 if (skb->len != 13) {209 if (skb->len != 13) {
210 BT_ERR("%s: Exception info size mismatch", hdev->name);210 bt_dev_err(hdev, "Exception info size mismatch");
211 kfree_skb(skb);211 kfree_skb(skb);
212 return;212 return;
213 }213 }
214 214
215 BT_ERR("%s: Exception info %s", hdev->name, (char *)(skb->data + 1));215 bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1));
216 216
217 kfree_skb(skb);217 kfree_skb(skb);
218}218}
@@ -233,9 +233,10 @@ void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver) · 14 unmodified lines
233 return;233 return;
234 }234 }
235 235
236 BT_INFO("%s: %s revision %u.%u build %u week %u %u", hdev->name,236 bt_dev_info(hdev, "%s revision %u.%u build %u week %u %u",
237 variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f,237 variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f,
238 ver->fw_build_num, ver->fw_build_ww, 2000 + ver->fw_build_yy);238 ver->fw_build_num, ver->fw_build_ww,
239 2000 + ver->fw_build_yy);
239}240}
240EXPORT_SYMBOL_GPL(btintel_version_info);241EXPORT_SYMBOL_GPL(btintel_version_info);
241 242
@@ -321,8 +322,7 @@ int btintel_set_event_mask(struct hci_dev *hdev, bool debug) · 79 unmodified lines
321 skb = __hci_cmd_sync(hdev, 0xfc52, 8, mask, HCI_INIT_TIMEOUT);322 skb = __hci_cmd_sync(hdev, 0xfc52, 8, mask, HCI_INIT_TIMEOUT);
322 if (IS_ERR(skb)) {323 if (IS_ERR(skb)) {
323 err = PTR_ERR(skb);324 err = PTR_ERR(skb);
324 BT_ERR("%s: Setting Intel event mask failed (%d)",325 bt_dev_err(hdev, "Setting Intel event mask failed (%d)", err);
325 hdev->name, err);
326 return err;326 return err;
327 }327 }
328 kfree_skb(skb);328 kfree_skb(skb);
drivers/bluetooth/btmrvl_sdio.c+3−3
@@ -64,7 +64,7 @@ static irqreturn_t btmrvl_wake_irq_bt(int irq, void *priv) · 63 unmodified lines
64 struct btmrvl_sdio_card *card = priv;64 struct btmrvl_sdio_card *card = priv;
65 struct btmrvl_plt_wake_cfg *cfg = card->plt_wake_cfg;65 struct btmrvl_plt_wake_cfg *cfg = card->plt_wake_cfg;
66 66
67 pr_info("%s: wake by bt", __func__);67 pr_info("%s: wake by bt\n", __func__);
68 cfg->wake_by_bt = true;68 cfg->wake_by_bt = true;
69 disable_irq_nosync(irq);69 disable_irq_nosync(irq);
70 70
@@ -87,7 +87,7 @@ static int btmrvl_sdio_probe_of(struct device *dev, · 16 unmodified lines
87 87
88 if (!dev->of_node ||88 if (!dev->of_node ||
89 !of_match_node(btmrvl_sdio_of_match_table, dev->of_node)) {89 !of_match_node(btmrvl_sdio_of_match_table, dev->of_node)) {
90 pr_err("sdio platform data not available");90 pr_err("sdio platform data not available\n");
91 return -1;91 return -1;
92 }92 }
93 93
@@ -99,7 +99,7 @@ static int btmrvl_sdio_probe_of(struct device *dev, · 5 unmodified lines
99 if (cfg && card->plt_of_node) {99 if (cfg && card->plt_of_node) {
100 cfg->irq_bt = irq_of_parse_and_map(card->plt_of_node, 0);100 cfg->irq_bt = irq_of_parse_and_map(card->plt_of_node, 0);
101 if (!cfg->irq_bt) {101 if (!cfg->irq_bt) {
102 dev_err(dev, "fail to parse irq_bt from device tree");102 dev_err(dev, "fail to parse irq_bt from device tree\n");
103 cfg->irq_bt = -1;103 cfg->irq_bt = -1;
104 } else {104 } else {
105 ret = devm_request_irq(dev, cfg->irq_bt,105 ret = devm_request_irq(dev, cfg->irq_bt,
drivers/bluetooth/btqca.c+3−3
@@ -287,7 +287,7 @@ static int rome_download_firmware(struct hci_dev *hdev, · 286 unmodified lines
287 const struct firmware *fw;287 const struct firmware *fw;
288 int ret;288 int ret;
289 289
290 BT_INFO("%s: ROME Downloading %s", hdev->name, config->fwname);290 bt_dev_info(hdev, "ROME Downloading %s", config->fwname);
291 291
292 ret = request_firmware(&fw, config->fwname, &hdev->dev);292 ret = request_firmware(&fw, config->fwname, &hdev->dev);
293 if (ret) {293 if (ret) {
@@ -351,7 +351,7 @@ int qca_uart_setup_rome(struct hci_dev *hdev, uint8_t baudrate) · 57 unmodified lines
351 return err;351 return err;
352 }352 }
353 353
354 BT_INFO("%s: ROME controller version 0x%08x", hdev->name, rome_ver);354 bt_dev_info(hdev, "ROME controller version 0x%08x", rome_ver);
355 355
356 /* Download rampatch file */356 /* Download rampatch file */
357 config.type = TLV_TYPE_PATCH;357 config.type = TLV_TYPE_PATCH;
@@ -380,7 +380,7 @@ int qca_uart_setup_rome(struct hci_dev *hdev, uint8_t baudrate) · 22 unmodified lines
380 return err;380 return err;
381 }381 }
382 382
383 BT_INFO("%s: ROME setup on UART is completed", hdev->name);383 bt_dev_info(hdev, "ROME setup on UART is completed");
384 384
385 return 0;385 return 0;
386}386}
drivers/bluetooth/btqcomsmd.c+45−0
@@ -15,6 +15,8 @@ · 14 unmodified lines
15#include <linux/module.h>15#include <linux/module.h>
16#include <linux/slab.h>16#include <linux/slab.h>
17#include <linux/rpmsg.h>17#include <linux/rpmsg.h>
18#include <linux/of.h>
19
18#include <linux/soc/qcom/wcnss_ctrl.h>20#include <linux/soc/qcom/wcnss_ctrl.h>
19#include <linux/platform_device.h>21#include <linux/platform_device.h>
20 22
@@ -26,6 +28,7 @@ · 5 unmodified lines
26struct btqcomsmd {28struct btqcomsmd {
27 struct hci_dev *hdev;29 struct hci_dev *hdev;
28 30
31 bdaddr_t bdaddr;
29 struct rpmsg_endpoint *acl_channel;32 struct rpmsg_endpoint *acl_channel;
30 struct rpmsg_endpoint *cmd_channel;33 struct rpmsg_endpoint *cmd_channel;
31};34};
@@ -100,6 +103,38 @@ static int btqcomsmd_close(struct hci_dev *hdev) · 68 unmodified lines
100 return 0;103 return 0;
101}104}
102 105
106static int btqcomsmd_setup(struct hci_dev *hdev)
107{
108 struct btqcomsmd *btq = hci_get_drvdata(hdev);
109 struct sk_buff *skb;
110 int err;
111
112 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
113 if (IS_ERR(skb))
114 return PTR_ERR(skb);
115 kfree_skb(skb);
116
117 /* Devices do not have persistent storage for BD address. If no
118 * BD address has been retrieved during probe, mark the device
119 * as having an invalid BD address.
120 */
121 if (!bacmp(&btq->bdaddr, BDADDR_ANY)) {
122 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
123 return 0;
124 }
125
126 /* When setting a configured BD address fails, mark the device
127 * as having an invalid BD address.
128 */
129 err = qca_set_bdaddr_rome(hdev, &btq->bdaddr);
130 if (err) {
131 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
132 return 0;
133 }
134
135 return 0;
136}
137
103static int btqcomsmd_probe(struct platform_device *pdev)138static int btqcomsmd_probe(struct platform_device *pdev)
104{139{
105 struct btqcomsmd *btq;140 struct btqcomsmd *btq;
@@ -123,6 +158,15 @@ static int btqcomsmd_probe(struct platform_device *pdev) · 17 unmodified lines
123 if (IS_ERR(btq->cmd_channel))158 if (IS_ERR(btq->cmd_channel))
124 return PTR_ERR(btq->cmd_channel);159 return PTR_ERR(btq->cmd_channel);
125 160
161 /* The local-bd-address property is usually injected by the
162 * bootloader which has access to the allocated BD address.
163 */
164 if (!of_property_read_u8_array(pdev->dev.of_node, "local-bd-address",
165 (u8 *)&btq->bdaddr, sizeof(bdaddr_t))) {
166 dev_info(&pdev->dev, "BD address %pMR retrieved from device-tree",
167 &btq->bdaddr);
168 }
169
126 hdev = hci_alloc_dev();170 hdev = hci_alloc_dev();
127 if (!hdev)171 if (!hdev)
128 return -ENOMEM;172 return -ENOMEM;
@@ -135,6 +179,7 @@ static int btqcomsmd_probe(struct platform_device *pdev) · 6 unmodified lines
135 hdev->open = btqcomsmd_open;179 hdev->open = btqcomsmd_open;
136 hdev->close = btqcomsmd_close;180 hdev->close = btqcomsmd_close;
137 hdev->send = btqcomsmd_send;181 hdev->send = btqcomsmd_send;
182 hdev->setup = btqcomsmd_setup;
138 hdev->set_bdaddr = qca_set_bdaddr_rome;183 hdev->set_bdaddr = qca_set_bdaddr_rome;
139 184
140 ret = hci_register_dev(hdev);185 ret = hci_register_dev(hdev);
drivers/bluetooth/btrtl.c+11−10
@@ -55,8 +55,8 @@ static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version) · 54 unmodified lines
55 }55 }
56 56
57 rom_version = (struct rtl_rom_version_evt *)skb->data;57 rom_version = (struct rtl_rom_version_evt *)skb->data;
58 BT_INFO("%s: rom_version status=%x version=%x",58 bt_dev_info(hdev, "rom_version status=%x version=%x",
59 hdev->name, rom_version->status, rom_version->version);59 rom_version->status, rom_version->version);
60 60
61 *version = rom_version->version;61 *version = rom_version->version;
62 62
@@ -273,7 +273,7 @@ static int rtl_load_config(struct hci_dev *hdev, const char *name, u8 **buff) · 210 unmodified lines
273 const struct firmware *fw;273 const struct firmware *fw;
274 int ret;274 int ret;
275 275
276 BT_INFO("%s: rtl: loading %s", hdev->name, name);276 bt_dev_info(hdev, "rtl: loading %s", name);
277 ret = request_firmware(&fw, name, &hdev->dev);277 ret = request_firmware(&fw, name, &hdev->dev);
278 if (ret < 0)278 if (ret < 0)
279 return ret;279 return ret;
@@ -292,7 +292,7 @@ static int btrtl_setup_rtl8723a(struct hci_dev *hdev) · 12 unmodified lines
292 const struct firmware *fw;292 const struct firmware *fw;
293 int ret;293 int ret;
294 294
295 BT_INFO("%s: rtl: loading rtl_bt/rtl8723a_fw.bin", hdev->name);295 bt_dev_info(hdev, "rtl: loading rtl_bt/rtl8723a_fw.bin");
296 ret = request_firmware(&fw, "rtl_bt/rtl8723a_fw.bin", &hdev->dev);296 ret = request_firmware(&fw, "rtl_bt/rtl8723a_fw.bin", &hdev->dev);
297 if (ret < 0) {297 if (ret < 0) {
298 BT_ERR("%s: Failed to load rtl_bt/rtl8723a_fw.bin", hdev->name);298 BT_ERR("%s: Failed to load rtl_bt/rtl8723a_fw.bin", hdev->name);
@@ -363,7 +363,7 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver, · 64 unmodified lines
363 } else363 } else
364 cfg_sz = 0;364 cfg_sz = 0;
365 365
366 BT_INFO("%s: rtl: loading %s", hdev->name, fw_name);366 bt_dev_info(hdev, "rtl: loading %s", fw_name);
367 ret = request_firmware(&fw, fw_name, &hdev->dev);367 ret = request_firmware(&fw, fw_name, &hdev->dev);
368 if (ret < 0) {368 if (ret < 0) {
369 BT_ERR("%s: Failed to load %s", hdev->name, fw_name);369 BT_ERR("%s: Failed to load %s", hdev->name, fw_name);
@@ -390,7 +390,7 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver, · 20 unmodified lines
390 fw_data = tbuff;390 fw_data = tbuff;
391 }391 }
392 392
393 BT_INFO("cfg_sz %d, total size %d", cfg_sz, ret);393 bt_dev_info(hdev, "cfg_sz %d, total size %d", cfg_sz, ret);
394 394
395 ret = rtl_download_firmware(hdev, fw_data, ret);395 ret = rtl_download_firmware(hdev, fw_data, ret);
396 396
@@ -436,9 +436,10 @@ int btrtl_setup_realtek(struct hci_dev *hdev) · 39 unmodified lines
436 return -PTR_ERR(skb);436 return -PTR_ERR(skb);
437 437
438 resp = (struct hci_rp_read_local_version *)skb->data;438 resp = (struct hci_rp_read_local_version *)skb->data;
439 BT_INFO("%s: rtl: examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x "439 bt_dev_info(hdev, "rtl: examining hci_ver=%02x hci_rev=%04x "
440 "lmp_subver=%04x", hdev->name, resp->hci_ver, resp->hci_rev,440 "lmp_ver=%02x lmp_subver=%04x",
441 resp->lmp_ver, resp->lmp_subver);441 resp->hci_ver, resp->hci_rev,
442 resp->lmp_ver, resp->lmp_subver);
442 443
443 lmp_subver = le16_to_cpu(resp->lmp_subver);444 lmp_subver = le16_to_cpu(resp->lmp_subver);
444 kfree_skb(skb);445 kfree_skb(skb);
@@ -466,7 +467,7 @@ int btrtl_setup_realtek(struct hci_dev *hdev) · 21 unmodified lines
466 return btrtl_setup_rtl8723b(hdev, lmp_subver,467 return btrtl_setup_rtl8723b(hdev, lmp_subver,
467 "rtl_bt/rtl8822b_fw.bin");468 "rtl_bt/rtl8822b_fw.bin");
468 default:469 default:
469 BT_INFO("rtl: assuming no firmware upload needed.");470 bt_dev_info(hdev, "rtl: assuming no firmware upload needed");
470 return 0;471 return 0;
471 }472 }
472}473}
drivers/bluetooth/btusb.c+126−106
@@ -66,7 +66,6 @@ static struct usb_driver btusb_driver; · 65 unmodified lines
66#define BTUSB_BCM2045 0x4000066#define BTUSB_BCM2045 0x40000
67#define BTUSB_IFNUM_2 0x8000067#define BTUSB_IFNUM_2 0x80000
68#define BTUSB_CW6622 0x10000068#define BTUSB_CW6622 0x100000
69#define BTUSB_BCM_NO_PRODID 0x200000
70 69
71static const struct usb_device_id btusb_table[] = {70static const struct usb_device_id btusb_table[] = {
72 /* Generic Bluetooth USB device */71 /* Generic Bluetooth USB device */
@@ -171,10 +170,6 @@ static const struct usb_device_id btusb_table[] = { · 98 unmodified lines
171 { USB_VENDOR_AND_INTERFACE_INFO(0x0930, 0xff, 0x01, 0x01),170 { USB_VENDOR_AND_INTERFACE_INFO(0x0930, 0xff, 0x01, 0x01),
172 .driver_info = BTUSB_BCM_PATCHRAM },171 .driver_info = BTUSB_BCM_PATCHRAM },
173 172
174 /* Broadcom devices with missing product id */
175 { USB_DEVICE_AND_INTERFACE_INFO(0x0000, 0x0000, 0xff, 0x01, 0x01),
176 .driver_info = BTUSB_BCM_PATCHRAM | BTUSB_BCM_NO_PRODID },
177
178 /* Intel Bluetooth USB Bootloader (RAM module) */173 /* Intel Bluetooth USB Bootloader (RAM module) */
179 { USB_DEVICE(0x8087, 0x0a5a),174 { USB_DEVICE(0x8087, 0x0a5a),
180 .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },175 .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
@@ -272,6 +267,7 @@ static const struct usb_device_id blacklist_table[] = { · 91 unmodified lines
272 { USB_DEVICE(0x0cf3, 0xe301), .driver_info = BTUSB_QCA_ROME },267 { USB_DEVICE(0x0cf3, 0xe301), .driver_info = BTUSB_QCA_ROME },
273 { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME },268 { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME },
274 { USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME },269 { USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME },
270 { USB_DEVICE(0x0489, 0xe09f), .driver_info = BTUSB_QCA_ROME },
275 { USB_DEVICE(0x0489, 0xe0a2), .driver_info = BTUSB_QCA_ROME },271 { USB_DEVICE(0x0489, 0xe0a2), .driver_info = BTUSB_QCA_ROME },
276 { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME },272 { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME },
277 { USB_DEVICE(0x04ca, 0x3016), .driver_info = BTUSB_QCA_ROME },273 { USB_DEVICE(0x04ca, 0x3016), .driver_info = BTUSB_QCA_ROME },
@@ -401,6 +397,7 @@ struct btusb_data { · 123 unmodified lines
401 struct usb_interface *intf;397 struct usb_interface *intf;
402 struct usb_interface *isoc;398 struct usb_interface *isoc;
403 struct usb_interface *diag;399 struct usb_interface *diag;
400 unsigned isoc_ifnum;
404 401
405 unsigned long flags;402 unsigned long flags;
406 403
@@ -647,7 +644,7 @@ static void btusb_intr_complete(struct urb *urb) · 240 unmodified lines
647 644
648 if (btusb_recv_intr(data, urb->transfer_buffer,645 if (btusb_recv_intr(data, urb->transfer_buffer,
649 urb->actual_length) < 0) {646 urb->actual_length) < 0) {
650 BT_ERR("%s corrupted event packet", hdev->name);647 bt_dev_err(hdev, "corrupted event packet");
651 hdev->stat.err_rx++;648 hdev->stat.err_rx++;
652 }649 }
653 } else if (urb->status == -ENOENT) {650 } else if (urb->status == -ENOENT) {
@@ -667,8 +664,8 @@ static void btusb_intr_complete(struct urb *urb) · 13 unmodified lines
667 * -ENODEV: device got disconnected664 * -ENODEV: device got disconnected
668 */665 */
669 if (err != -EPERM && err != -ENODEV)666 if (err != -EPERM && err != -ENODEV)
670 BT_ERR("%s urb %p failed to resubmit (%d)",667 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
671 hdev->name, urb, -err);668 urb, -err);
672 usb_unanchor_urb(urb);669 usb_unanchor_urb(urb);
673 }670 }
674}671}
@@ -710,8 +707,8 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · 35 unmodified lines
710 err = usb_submit_urb(urb, mem_flags);707 err = usb_submit_urb(urb, mem_flags);
711 if (err < 0) {708 if (err < 0) {
712 if (err != -EPERM && err != -ENODEV)709 if (err != -EPERM && err != -ENODEV)
713 BT_ERR("%s urb %p submission failed (%d)",710 bt_dev_err(hdev, "urb %p submission failed (%d)",
714 hdev->name, urb, -err);711 urb, -err);
715 usb_unanchor_urb(urb);712 usb_unanchor_urb(urb);
716 }713 }
717 714
@@ -737,7 +734,7 @@ static void btusb_bulk_complete(struct urb *urb) · 19 unmodified lines
737 734
738 if (data->recv_bulk(data, urb->transfer_buffer,735 if (data->recv_bulk(data, urb->transfer_buffer,
739 urb->actual_length) < 0) {736 urb->actual_length) < 0) {
740 BT_ERR("%s corrupted ACL packet", hdev->name);737 bt_dev_err(hdev, "corrupted ACL packet");
741 hdev->stat.err_rx++;738 hdev->stat.err_rx++;
742 }739 }
743 } else if (urb->status == -ENOENT) {740 } else if (urb->status == -ENOENT) {
@@ -757,8 +754,8 @@ static void btusb_bulk_complete(struct urb *urb) · 13 unmodified lines
757 * -ENODEV: device got disconnected754 * -ENODEV: device got disconnected
758 */755 */
759 if (err != -EPERM && err != -ENODEV)756 if (err != -EPERM && err != -ENODEV)
760 BT_ERR("%s urb %p failed to resubmit (%d)",757 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
761 hdev->name, urb, -err);758 urb, -err);
762 usb_unanchor_urb(urb);759 usb_unanchor_urb(urb);
763 }760 }
764}761}
@@ -799,8 +796,8 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) · 34 unmodified lines
799 err = usb_submit_urb(urb, mem_flags);796 err = usb_submit_urb(urb, mem_flags);
800 if (err < 0) {797 if (err < 0) {
801 if (err != -EPERM && err != -ENODEV)798 if (err != -EPERM && err != -ENODEV)
802 BT_ERR("%s urb %p submission failed (%d)",799 bt_dev_err(hdev, "urb %p submission failed (%d)",
803 hdev->name, urb, -err);800 urb, -err);
804 usb_unanchor_urb(urb);801 usb_unanchor_urb(urb);
805 }802 }
806 803
@@ -833,7 +830,7 @@ static void btusb_isoc_complete(struct urb *urb) · 26 unmodified lines
833 830
834 if (btusb_recv_isoc(data, urb->transfer_buffer + offset,831 if (btusb_recv_isoc(data, urb->transfer_buffer + offset,
835 length) < 0) {832 length) < 0) {
836 BT_ERR("%s corrupted SCO packet", hdev->name);833 bt_dev_err(hdev, "corrupted SCO packet");
837 hdev->stat.err_rx++;834 hdev->stat.err_rx++;
838 }835 }
839 }836 }
@@ -853,8 +850,8 @@ static void btusb_isoc_complete(struct urb *urb) · 13 unmodified lines
853 * -ENODEV: device got disconnected850 * -ENODEV: device got disconnected
854 */851 */
855 if (err != -EPERM && err != -ENODEV)852 if (err != -EPERM && err != -ENODEV)
856 BT_ERR("%s urb %p failed to resubmit (%d)",853 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
857 hdev->name, urb, -err);854 urb, -err);
858 usb_unanchor_urb(urb);855 usb_unanchor_urb(urb);
859 }856 }
860}857}
@@ -921,8 +918,8 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) · 60 unmodified lines
921 err = usb_submit_urb(urb, mem_flags);918 err = usb_submit_urb(urb, mem_flags);
922 if (err < 0) {919 if (err < 0) {
923 if (err != -EPERM && err != -ENODEV)920 if (err != -EPERM && err != -ENODEV)
924 BT_ERR("%s urb %p submission failed (%d)",921 bt_dev_err(hdev, "urb %p submission failed (%d)",
925 hdev->name, urb, -err);922 urb, -err);
926 usb_unanchor_urb(urb);923 usb_unanchor_urb(urb);
927 }924 }
928 925
@@ -966,8 +963,8 @@ static void btusb_diag_complete(struct urb *urb) · 37 unmodified lines
966 * -ENODEV: device got disconnected963 * -ENODEV: device got disconnected
967 */964 */
968 if (err != -EPERM && err != -ENODEV)965 if (err != -EPERM && err != -ENODEV)
969 BT_ERR("%s urb %p failed to resubmit (%d)",966 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
970 hdev->name, urb, -err);967 urb, -err);
971 usb_unanchor_urb(urb);968 usb_unanchor_urb(urb);
972 }969 }
973}970}
@@ -1008,8 +1005,8 @@ static int btusb_submit_diag_urb(struct hci_dev *hdev, gfp_t mem_flags) · 34 unmodified lines
1008 err = usb_submit_urb(urb, mem_flags);1005 err = usb_submit_urb(urb, mem_flags);
1009 if (err < 0) {1006 if (err < 0) {
1010 if (err != -EPERM && err != -ENODEV)1007 if (err != -EPERM && err != -ENODEV)
1011 BT_ERR("%s urb %p submission failed (%d)",1008 bt_dev_err(hdev, "urb %p submission failed (%d)",
1012 hdev->name, urb, -err);1009 urb, -err);
1013 usb_unanchor_urb(urb);1010 usb_unanchor_urb(urb);
1014 }1011 }
1015 1012
@@ -1270,8 +1267,8 @@ static int submit_tx_urb(struct hci_dev *hdev, struct urb *urb) · 254 unmodified lines
1270 err = usb_submit_urb(urb, GFP_KERNEL);1267 err = usb_submit_urb(urb, GFP_KERNEL);
1271 if (err < 0) {1268 if (err < 0) {
1272 if (err != -EPERM && err != -ENODEV)1269 if (err != -EPERM && err != -ENODEV)
1273 BT_ERR("%s urb %p submission failed (%d)",1270 bt_dev_err(hdev, "urb %p submission failed (%d)",
1274 hdev->name, urb, -err);1271 urb, -err);
1275 kfree(urb->setup_packet);1272 kfree(urb->setup_packet);
1276 usb_unanchor_urb(urb);1273 usb_unanchor_urb(urb);
1277 } else {1274 } else {
@@ -1364,9 +1361,9 @@ static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting) · 86 unmodified lines
1364 if (!data->isoc)1361 if (!data->isoc)
1365 return -ENODEV;1362 return -ENODEV;
1366 1363
1367 err = usb_set_interface(data->udev, 1, altsetting);1364 err = usb_set_interface(data->udev, data->isoc_ifnum, altsetting);
1368 if (err < 0) {1365 if (err < 0) {
1369 BT_ERR("%s setting interface failed (%d)", hdev->name, -err);1366 bt_dev_err(hdev, "setting interface failed (%d)", -err);
1370 return err;1367 return err;
1371 }1368 }
1372 1369
@@ -1390,7 +1387,7 @@ static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting) · 17 unmodified lines
1390 }1387 }
1391 1388
1392 if (!data->isoc_tx_ep || !data->isoc_rx_ep) {1389 if (!data->isoc_tx_ep || !data->isoc_rx_ep) {
1393 BT_ERR("%s invalid SCO descriptors", hdev->name);1390 bt_dev_err(hdev, "invalid SCO descriptors");
1394 return -ENODEV;1391 return -ENODEV;
1395 }1392 }
1396 1393
@@ -1485,7 +1482,7 @@ static int btusb_setup_bcm92035(struct hci_dev *hdev) · 88 unmodified lines
1485 1482
1486 skb = __hci_cmd_sync(hdev, 0xfc3b, 1, &val, HCI_INIT_TIMEOUT);1483 skb = __hci_cmd_sync(hdev, 0xfc3b, 1, &val, HCI_INIT_TIMEOUT);
1487 if (IS_ERR(skb))1484 if (IS_ERR(skb))
1488 BT_ERR("BCM92035 command failed (%ld)", -PTR_ERR(skb));1485 bt_dev_err(hdev, "BCM92035 command failed (%ld)", PTR_ERR(skb));
1489 else1486 else
1490 kfree_skb(skb);1487 kfree_skb(skb);
1491 1488
@@ -1503,12 +1500,12 @@ static int btusb_setup_csr(struct hci_dev *hdev) · 11 unmodified lines
1503 HCI_INIT_TIMEOUT);1500 HCI_INIT_TIMEOUT);
1504 if (IS_ERR(skb)) {1501 if (IS_ERR(skb)) {
1505 int err = PTR_ERR(skb);1502 int err = PTR_ERR(skb);
1506 BT_ERR("%s: CSR: Local version failed (%d)", hdev->name, err);1503 bt_dev_err(hdev, "CSR: Local version failed (%d)", err);
1507 return err;1504 return err;
1508 }1505 }
1509 1506
1510 if (skb->len != sizeof(struct hci_rp_read_local_version)) {1507 if (skb->len != sizeof(struct hci_rp_read_local_version)) {
1511 BT_ERR("%s: CSR: Local version length mismatch", hdev->name);1508 bt_dev_err(hdev, "CSR: Local version length mismatch");
1512 kfree_skb(skb);1509 kfree_skb(skb);
1513 return -EIO;1510 return -EIO;
1514 }1511 }
@@ -1570,7 +1567,7 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, · 55 unmodified lines
1570 }1567 }
1571 }1568 }
1572 1569
1573 BT_INFO("%s: Intel Bluetooth firmware file: %s", hdev->name, fwname);1570 bt_dev_info(hdev, "Intel Bluetooth firmware file: %s", fwname);
1574 1571
1575 return fw;1572 return fw;
1576}1573}
@@ -1726,18 +1723,18 @@ static int btusb_setup_intel(struct hci_dev *hdev) · 149 unmodified lines
1726 if (err)1723 if (err)
1727 return err;1724 return err;
1728 1725
1729 BT_INFO("%s: read Intel version: %02x%02x%02x%02x%02x%02x%02x%02x%02x",1726 bt_dev_info(hdev, "read Intel version: %02x%02x%02x%02x%02x%02x%02x%02x%02x",
1730 hdev->name, ver.hw_platform, ver.hw_variant, ver.hw_revision,1727 ver.hw_platform, ver.hw_variant, ver.hw_revision,
1731 ver.fw_variant, ver.fw_revision, ver.fw_build_num,1728 ver.fw_variant, ver.fw_revision, ver.fw_build_num,
1732 ver.fw_build_ww, ver.fw_build_yy, ver.fw_patch_num);1729 ver.fw_build_ww, ver.fw_build_yy, ver.fw_patch_num);
1733 1730
1734 /* fw_patch_num indicates the version of patch the device currently1731 /* fw_patch_num indicates the version of patch the device currently
1735 * have. If there is no patch data in the device, it is always 0x00.1732 * have. If there is no patch data in the device, it is always 0x00.
1736 * So, if it is other than 0x00, no need to patch the device again.1733 * So, if it is other than 0x00, no need to patch the device again.
1737 */1734 */
1738 if (ver.fw_patch_num) {1735 if (ver.fw_patch_num) {
1739 BT_INFO("%s: Intel device is already patched. patch num: %02x",1736 bt_dev_info(hdev, "Intel device is already patched. "
1740 hdev->name, ver.fw_patch_num);1737 "patch num: %02x", ver.fw_patch_num);
1741 goto complete;1738 goto complete;
1742 }1739 }
1743 1740
@@ -1805,8 +1802,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) · 61 unmodified lines
1805 if (err)1802 if (err)
1806 return err;1803 return err;
1807 1804
1808 BT_INFO("%s: Intel Bluetooth firmware patch completed and activated",1805 bt_dev_info(hdev, "Intel firmware patch completed and activated");
1809 hdev->name);
1810 1806
1811 goto complete;1807 goto complete;
1812 1808
@@ -1816,7 +1812,7 @@ exit_mfg_disable: · 3 unmodified lines
1816 if (err)1812 if (err)
1817 return err;1813 return err;
1818 1814
1819 BT_INFO("%s: Intel Bluetooth firmware patch completed", hdev->name);1815 bt_dev_info(hdev, "Intel firmware patch completed");
1820 1816
1821 goto complete;1817 goto complete;
1822 1818
@@ -1830,8 +1826,7 @@ exit_mfg_deactivate: · 7 unmodified lines
1830 if (err)1826 if (err)
1831 return err;1827 return err;
1832 1828
1833 BT_INFO("%s: Intel Bluetooth firmware patch completed and deactivated",1829 bt_dev_info(hdev, "Intel firmware patch completed and deactivated");
1834 hdev->name);
1835 1830
1836complete:1831complete:
1837 /* Set the event mask for Intel specific vendor events. This enables1832 /* Set the event mask for Intel specific vendor events. This enables
@@ -2112,24 +2107,24 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) · 274 unmodified lines
2112 2107
2113 params = (struct intel_boot_params *)skb->data;2108 params = (struct intel_boot_params *)skb->data;
2114 2109
2115 BT_INFO("%s: Device revision is %u", hdev->name,2110 bt_dev_info(hdev, "Device revision is %u",
2116 le16_to_cpu(params->dev_revid));2111 le16_to_cpu(params->dev_revid));
2117 2112
2118 BT_INFO("%s: Secure boot is %s", hdev->name,2113 bt_dev_info(hdev, "Secure boot is %s",
2119 params->secure_boot ? "enabled" : "disabled");2114 params->secure_boot ? "enabled" : "disabled");
2120 2115
2121 BT_INFO("%s: OTP lock is %s", hdev->name,2116 bt_dev_info(hdev, "OTP lock is %s",
2122 params->otp_lock ? "enabled" : "disabled");2117 params->otp_lock ? "enabled" : "disabled");
2123 2118
2124 BT_INFO("%s: API lock is %s", hdev->name,2119 bt_dev_info(hdev, "API lock is %s",
2125 params->api_lock ? "enabled" : "disabled");2120 params->api_lock ? "enabled" : "disabled");
2126 2121
2127 BT_INFO("%s: Debug lock is %s", hdev->name,2122 bt_dev_info(hdev, "Debug lock is %s",
2128 params->debug_lock ? "enabled" : "disabled");2123 params->debug_lock ? "enabled" : "disabled");
2129 2124
2130 BT_INFO("%s: Minimum firmware build %u week %u %u", hdev->name,2125 bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
2131 params->min_fw_build_nn, params->min_fw_build_cw,2126 params->min_fw_build_nn, params->min_fw_build_cw,
2132 2000 + params->min_fw_build_yy);2127 2000 + params->min_fw_build_yy);
2133 2128
2134 /* It is required that every single firmware fragment is acknowledged2129 /* It is required that every single firmware fragment is acknowledged
2135 * with a command complete event. If the boot parameters indicate2130 * with a command complete event. If the boot parameters indicate
@@ -2146,24 +2141,49 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) · 10 unmodified lines
2146 * also be no valid address for the operational firmware.2141 * also be no valid address for the operational firmware.
2147 */2142 */
2148 if (!bacmp(&params->otp_bdaddr, BDADDR_ANY)) {2143 if (!bacmp(&params->otp_bdaddr, BDADDR_ANY)) {
2149 BT_INFO("%s: No device address configured", hdev->name);2144 bt_dev_info(hdev, "No device address configured");
2150 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);2145 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
2151 }2146 }
2152 2147
2153 /* With this Intel bootloader only the hardware variant and device2148 /* With this Intel bootloader only the hardware variant and device
2154 * revision information are used to select the right firmware.2149 * revision information are used to select the right firmware for SfP
2150 * and WsP.
2155 *2151 *
2156 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi.2152 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi.
2157 *2153 *
2158 * Currently the supported hardware variants are:2154 * Currently the supported hardware variants are:
2159 * 11 (0x0b) for iBT3.0 (LnP/SfP)2155 * 11 (0x0b) for iBT3.0 (LnP/SfP)
2160 * 12 (0x0c) for iBT3.5 (WsP)2156 * 12 (0x0c) for iBT3.5 (WsP)
2157 *
2158 * For ThP/JfP and for future SKU's, the FW name varies based on HW
2159 * variant, HW revision and FW revision, as these are dependent on CNVi
2160 * and RF Combination.
2161 *
2161 * 17 (0x11) for iBT3.5 (JfP)2162 * 17 (0x11) for iBT3.5 (JfP)
2162 * 18 (0x12) for iBT3.5 (ThP)2163 * 18 (0x12) for iBT3.5 (ThP)
2164 *
2165 * The firmware file name for these will be
2166 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi.
2167 *
2163 */2168 */
2164 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi",2169 switch (ver.hw_variant) {
2165 le16_to_cpu(ver.hw_variant),2170 case 0x0b: /* SfP */
2166 le16_to_cpu(params->dev_revid));2171 case 0x0c: /* WsP */
2172 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi",
2173 le16_to_cpu(ver.hw_variant),
2174 le16_to_cpu(params->dev_revid));
2175 break;
2176 case 0x11: /* JfP */
2177 case 0x12: /* ThP */
2178 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi",
2179 le16_to_cpu(ver.hw_variant),
2180 le16_to_cpu(ver.hw_revision),
2181 le16_to_cpu(ver.fw_revision));
2182 break;
2183 default:
2184 BT_ERR("%s: Unsupported Intel firmware naming", hdev->name);
2185 return -EINVAL;
2186 }
2167 2187
2168 err = request_firmware(&fw, fwname, &hdev->dev);2188 err = request_firmware(&fw, fwname, &hdev->dev);
2169 if (err < 0) {2189 if (err < 0) {
@@ -2173,14 +2193,29 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) · 3 unmodified lines
2173 return err;2193 return err;
2174 }2194 }
2175 2195
2176 BT_INFO("%s: Found device firmware: %s", hdev->name, fwname);2196 bt_dev_info(hdev, "Found device firmware: %s", fwname);
2177 2197
2178 /* Save the DDC file name for later use to apply once the firmware2198 /* Save the DDC file name for later use to apply once the firmware
2179 * downloading is done.2199 * downloading is done.
2180 */2200 */
2181 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc",2201 switch (ver.hw_variant) {
2182 le16_to_cpu(ver.hw_variant),2202 case 0x0b: /* SfP */
2183 le16_to_cpu(params->dev_revid));2203 case 0x0c: /* WsP */
2204 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc",
2205 le16_to_cpu(ver.hw_variant),
2206 le16_to_cpu(params->dev_revid));
2207 break;
2208 case 0x11: /* JfP */
2209 case 0x12: /* ThP */
2210 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc",
2211 le16_to_cpu(ver.hw_variant),
2212 le16_to_cpu(ver.hw_revision),
2213 le16_to_cpu(ver.fw_revision));
2214 break;
2215 default:
2216 BT_ERR("%s: Unsupported Intel firmware naming", hdev->name);
2217 return -EINVAL;
2218 }
2184 2219
2185 kfree_skb(skb);2220 kfree_skb(skb);
2186 2221
@@ -2254,7 +2289,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) · 67 unmodified lines
2254 2289
2255 set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);2290 set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
2256 2291
2257 BT_INFO("%s: Waiting for firmware download to complete", hdev->name);2292 bt_dev_info(hdev, "Waiting for firmware download to complete");
2258 2293
2259 /* Before switching the device into operational mode and with that2294 /* Before switching the device into operational mode and with that
2260 * booting the loaded firmware, wait for the bootloader notification2295 * booting the loaded firmware, wait for the bootloader notification
@@ -2291,7 +2326,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) · 30 unmodified lines
2291 delta = ktime_sub(rettime, calltime);2326 delta = ktime_sub(rettime, calltime);
2292 duration = (unsigned long long) ktime_to_ns(delta) >> 10;2327 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
2293 2328
2294 BT_INFO("%s: Firmware loaded in %llu usecs", hdev->name, duration);2329 bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
2295 2330
2296done:2331done:
2297 release_firmware(fw);2332 release_firmware(fw);
@@ -2317,7 +2352,7 @@ done: · 19 unmodified lines
2317 * 1 second. However if that happens, then just fail the setup2352 * 1 second. However if that happens, then just fail the setup
2318 * since something went wrong.2353 * since something went wrong.
2319 */2354 */
2320 BT_INFO("%s: Waiting for device to boot", hdev->name);2355 bt_dev_info(hdev, "Waiting for device to boot");
2321 2356
2322 err = wait_on_bit_timeout(&data->flags, BTUSB_BOOTING,2357 err = wait_on_bit_timeout(&data->flags, BTUSB_BOOTING,
2323 TASK_INTERRUPTIBLE,2358 TASK_INTERRUPTIBLE,
@@ -2337,7 +2372,7 @@ done: · 13 unmodified lines
2337 delta = ktime_sub(rettime, calltime);2372 delta = ktime_sub(rettime, calltime);
2338 duration = (unsigned long long) ktime_to_ns(delta) >> 10;2373 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
2339 2374
2340 BT_INFO("%s: Device booted in %llu usecs", hdev->name, duration);2375 bt_dev_info(hdev, "Device booted in %llu usecs", duration);
2341 2376
2342 clear_bit(BTUSB_BOOTLOADER, &data->flags);2377 clear_bit(BTUSB_BOOTLOADER, &data->flags);
2343 2378
@@ -2440,8 +2475,8 @@ static int btusb_set_bdaddr_marvell(struct hci_dev *hdev, · 96 unmodified lines
2440 skb = __hci_cmd_sync(hdev, 0xfc22, sizeof(buf), buf, HCI_INIT_TIMEOUT);2475 skb = __hci_cmd_sync(hdev, 0xfc22, sizeof(buf), buf, HCI_INIT_TIMEOUT);
2441 if (IS_ERR(skb)) {2476 if (IS_ERR(skb)) {
2442 ret = PTR_ERR(skb);2477 ret = PTR_ERR(skb);
2443 BT_ERR("%s: changing Marvell device address failed (%ld)",2478 bt_dev_err(hdev, "changing Marvell device address failed (%ld)",
2444 hdev->name, ret);2479 ret);
2445 return ret;2480 return ret;
2446 }2481 }
2447 kfree_skb(skb);2482 kfree_skb(skb);
@@ -2465,8 +2500,7 @@ static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev, · 17 unmodified lines
2465 skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);2500 skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);
2466 if (IS_ERR(skb)) {2501 if (IS_ERR(skb)) {
2467 ret = PTR_ERR(skb);2502 ret = PTR_ERR(skb);
2468 BT_ERR("%s: Change address command failed (%ld)",2503 bt_dev_err(hdev, "Change address command failed (%ld)", ret);
2469 hdev->name, ret);
2470 return ret;2504 return ret;
2471 }2505 }
2472 kfree_skb(skb);2506 kfree_skb(skb);
@@ -2532,7 +2566,7 @@ static int btusb_qca_send_vendor_req(struct hci_dev *hdev, u8 request, · 59 unmodified lines
2532 err = usb_control_msg(udev, pipe, request, USB_TYPE_VENDOR | USB_DIR_IN,2566 err = usb_control_msg(udev, pipe, request, USB_TYPE_VENDOR | USB_DIR_IN,
2533 0, 0, buf, size, USB_CTRL_SET_TIMEOUT);2567 0, 0, buf, size, USB_CTRL_SET_TIMEOUT);
2534 if (err < 0) {2568 if (err < 0) {
2535 BT_ERR("%s: Failed to access otp area (%d)", hdev->name, err);2569 bt_dev_err(hdev, "Failed to access otp area (%d)", err);
2536 goto done;2570 goto done;
2537 }2571 }
2538 2572
@@ -2572,7 +2606,7 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev, · 33 unmodified lines
2572 err = usb_control_msg(udev, pipe, QCA_DFU_DOWNLOAD, USB_TYPE_VENDOR,2606 err = usb_control_msg(udev, pipe, QCA_DFU_DOWNLOAD, USB_TYPE_VENDOR,
2573 0, 0, buf, size, USB_CTRL_SET_TIMEOUT);2607 0, 0, buf, size, USB_CTRL_SET_TIMEOUT);
2574 if (err < 0) {2608 if (err < 0) {
2575 BT_ERR("%s: Failed to send headers (%d)", hdev->name, err);2609 bt_dev_err(hdev, "Failed to send headers (%d)", err);
2576 goto done;2610 goto done;
2577 }2611 }
2578 2612
@@ -2588,13 +2622,13 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev, · 9 unmodified lines
2588 err = usb_bulk_msg(udev, pipe, buf, size, &len,2622 err = usb_bulk_msg(udev, pipe, buf, size, &len,
2589 QCA_DFU_TIMEOUT);2623 QCA_DFU_TIMEOUT);
2590 if (err < 0) {2624 if (err < 0) {
2591 BT_ERR("%s: Failed to send body at %zd of %zd (%d)",2625 bt_dev_err(hdev, "Failed to send body at %zd of %zd (%d)",
2592 hdev->name, sent, firmware->size, err);2626 sent, firmware->size, err);
2593 break;2627 break;
2594 }2628 }
2595 2629
2596 if (size != len) {2630 if (size != len) {
2597 BT_ERR("%s: Failed to get bulk buffer", hdev->name);2631 bt_dev_err(hdev, "Failed to get bulk buffer");
2598 err = -EILSEQ;2632 err = -EILSEQ;
2599 break;2633 break;
2600 }2634 }
@@ -2626,24 +2660,23 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev, · 25 unmodified lines
2626 2660
2627 err = request_firmware(&fw, fwname, &hdev->dev);2661 err = request_firmware(&fw, fwname, &hdev->dev);
2628 if (err) {2662 if (err) {
2629 BT_ERR("%s: failed to request rampatch file: %s (%d)",2663 bt_dev_err(hdev, "failed to request rampatch file: %s (%d)",
2630 hdev->name, fwname, err);2664 fwname, err);
2631 return err;2665 return err;
2632 }2666 }
2633 2667
2634 BT_INFO("%s: using rampatch file: %s", hdev->name, fwname);2668 bt_dev_info(hdev, "using rampatch file: %s", fwname);
2635 2669
2636 rver = (struct qca_rampatch_version *)(fw->data + info->ver_offset);2670 rver = (struct qca_rampatch_version *)(fw->data + info->ver_offset);
2637 rver_rom = le16_to_cpu(rver->rom_version);2671 rver_rom = le16_to_cpu(rver->rom_version);
2638 rver_patch = le16_to_cpu(rver->patch_version);2672 rver_patch = le16_to_cpu(rver->patch_version);
2639 2673
2640 BT_INFO("%s: QCA: patch rome 0x%x build 0x%x, firmware rome 0x%x "2674 bt_dev_info(hdev, "QCA: patch rome 0x%x build 0x%x, "
2641 "build 0x%x", hdev->name, rver_rom, rver_patch, ver_rom,2675 "firmware rome 0x%x build 0x%x",
2642 ver_patch);2676 rver_rom, rver_patch, ver_rom, ver_patch);
2643 2677
2644 if (rver_rom != ver_rom || rver_patch <= ver_patch) {2678 if (rver_rom != ver_rom || rver_patch <= ver_patch) {
2645 BT_ERR("%s: rampatch file version did not match with firmware",2679 bt_dev_err(hdev, "rampatch file version did not match with firmware");
2646 hdev->name);
2647 err = -EINVAL;2680 err = -EINVAL;
2648 goto done;2681 goto done;
2649 }2682 }
@@ -2669,12 +2702,12 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, · 19 unmodified lines
2669 2702
2670 err = request_firmware(&fw, fwname, &hdev->dev);2703 err = request_firmware(&fw, fwname, &hdev->dev);
2671 if (err) {2704 if (err) {
2672 BT_ERR("%s: failed to request NVM file: %s (%d)",2705 bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
2673 hdev->name, fwname, err);2706 fwname, err);
2674 return err;2707 return err;
2675 }2708 }
2676 2709
2677 BT_INFO("%s: using NVM file: %s", hdev->name, fwname);2710 bt_dev_info(hdev, "using NVM file: %s", fwname);
2678 2711
2679 err = btusb_setup_qca_download_fw(hdev, fw, info->nvm_hdr);2712 err = btusb_setup_qca_download_fw(hdev, fw, info->nvm_hdr);
2680 2713
@@ -2702,8 +2735,7 @@ static int btusb_setup_qca(struct hci_dev *hdev) · 21 unmodified lines
2702 info = &qca_devices_table[i];2735 info = &qca_devices_table[i];
2703 }2736 }
2704 if (!info) {2737 if (!info) {
2705 BT_ERR("%s: don't support firmware rome 0x%x", hdev->name,2738 bt_dev_err(hdev, "don't support firmware rome 0x%x", ver_rom);
2706 ver_rom);
2707 return -ENODEV;2739 return -ENODEV;
2708 }2740 }
2709 2741
@@ -2757,7 +2789,7 @@ static inline int __set_diag_interface(struct hci_dev *hdev) · 47 unmodified lines
2757 }2789 }
2758 2790
2759 if (!data->diag_tx_ep || !data->diag_rx_ep) {2791 if (!data->diag_tx_ep || !data->diag_rx_ep) {
2760 BT_ERR("%s invalid diagnostic descriptors", hdev->name);2792 bt_dev_err(hdev, "invalid diagnostic descriptors");
2761 return -ENODEV;2793 return -ENODEV;
2762 }2794 }
2763 2795
@@ -2909,19 +2941,6 @@ static int btusb_probe(struct usb_interface *intf, · 145 unmodified lines
2909 if (id->driver_info == BTUSB_IGNORE)2941 if (id->driver_info == BTUSB_IGNORE)
2910 return -ENODEV;2942 return -ENODEV;
2911 2943
2912 if (id->driver_info & BTUSB_BCM_NO_PRODID) {
2913 struct usb_device *udev = interface_to_usbdev(intf);
2914
2915 /* For the broken Broadcom devices that show 0000:0000
2916 * as USB vendor and product information, check that the
2917 * manufacturer string identifies them as Broadcom based
2918 * devices.
2919 */
2920 if (!udev->manufacturer ||
2921 strcmp(udev->manufacturer, "Broadcom Corp"))
2922 return -ENODEV;
2923 }
2924
2925 if (id->driver_info & BTUSB_ATH3012) {2944 if (id->driver_info & BTUSB_ATH3012) {
2926 struct usb_device *udev = interface_to_usbdev(intf);2945 struct usb_device *udev = interface_to_usbdev(intf);
2927 2946
@@ -3124,6 +3143,7 @@ static int btusb_probe(struct usb_interface *intf, · 196 unmodified lines
3124 } else {3143 } else {
3125 /* Interface orders are hardcoded in the specification */3144 /* Interface orders are hardcoded in the specification */
3126 data->isoc = usb_ifnum_to_if(data->udev, ifnum_base + 1);3145 data->isoc = usb_ifnum_to_if(data->udev, ifnum_base + 1);
3146 data->isoc_ifnum = ifnum_base + 1;
3127 }3147 }
3128 3148
3129 if (!reset)3149 if (!reset)
drivers/bluetooth/hci_ath.c+33−18
@@ -50,6 +50,17 @@ struct ath_struct { · 49 unmodified lines
50 struct work_struct ctxtsw;50 struct work_struct ctxtsw;
51};51};
52 52
53#define OP_WRITE_TAG 0x01
54
55#define INDEX_BDADDR 0x01
56
57struct ath_vendor_cmd {
58 __u8 opcode;
59 __le16 index;
60 __u8 len;
61 __u8 data[251];
62} __packed;
63
53static int ath_wakeup_ar3k(struct tty_struct *tty)64static int ath_wakeup_ar3k(struct tty_struct *tty)
54{65{
55 int status = tty->driver->ops->tiocmget(tty);66 int status = tty->driver->ops->tiocmget(tty);
@@ -144,30 +155,34 @@ static int ath_flush(struct hci_uart *hu) · 88 unmodified lines
144 return 0;155 return 0;
145}156}
146 157
147static int ath_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)158static int ath_vendor_cmd(struct hci_dev *hdev, uint8_t opcode, uint16_t index,
159 const void *data, size_t dlen)
148{160{
149 struct sk_buff *skb;161 struct sk_buff *skb;
150 u8 buf[10];162 struct ath_vendor_cmd cmd;
151 int err;163
152 164 if (dlen > sizeof(cmd.data))
153 buf[0] = 0x01;165 return -EINVAL;
154 buf[1] = 0x01;166
155 buf[2] = 0x00;167 cmd.opcode = opcode;
156 buf[3] = sizeof(bdaddr_t);168 cmd.index = cpu_to_le16(index);
157 memcpy(buf + 4, bdaddr, sizeof(bdaddr_t));169 cmd.len = dlen;
158 170 memcpy(cmd.data, data, dlen);
159 skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);171
160 if (IS_ERR(skb)) {172 skb = __hci_cmd_sync(hdev, 0xfc0b, dlen + 4, &cmd, HCI_INIT_TIMEOUT);
161 err = PTR_ERR(skb);173 if (IS_ERR(skb))
162 BT_ERR("%s: Change address command failed (%d)",174 return PTR_ERR(skb);
163 hdev->name, err);
164 return err;
165 }
166 kfree_skb(skb);175 kfree_skb(skb);
167 176
168 return 0;177 return 0;
169}178}
170 179
180static int ath_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
181{
182 return ath_vendor_cmd(hdev, OP_WRITE_TAG, INDEX_BDADDR, bdaddr,
183 sizeof(*bdaddr));
184}
185
171static int ath_setup(struct hci_uart *hu)186static int ath_setup(struct hci_uart *hu)
172{187{
173 BT_DBG("hu %p", hu);188 BT_DBG("hu %p", hu);
@@ -191,7 +206,7 @@ static int ath_recv(struct hci_uart *hu, const void *data, int count) · 17 unmodified lines
191 ath_recv_pkts, ARRAY_SIZE(ath_recv_pkts));206 ath_recv_pkts, ARRAY_SIZE(ath_recv_pkts));
192 if (IS_ERR(ath->rx_skb)) {207 if (IS_ERR(ath->rx_skb)) {
193 int err = PTR_ERR(ath->rx_skb);208 int err = PTR_ERR(ath->rx_skb);
194 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);209 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
195 ath->rx_skb = NULL;210 ath->rx_skb = NULL;
196 return err;211 return err;
197 }212 }
drivers/bluetooth/hci_bcm.c+147−116
@@ -52,11 +52,13 @@ · 51 unmodified lines
52 52
53#define BCM_AUTOSUSPEND_DELAY 5000 /* default autosleep delay */53#define BCM_AUTOSUSPEND_DELAY 5000 /* default autosleep delay */
54 54
55/* platform device driver resources */55/* device driver resources */
56struct bcm_device {56struct bcm_device {
57 /* Must be the first member, hci_serdev.c expects this. */
58 struct hci_uart serdev_hu;
57 struct list_head list;59 struct list_head list;
58 60
59 struct platform_device *pdev;61 struct device *dev;
60 62
61 const char *name;63 const char *name;
62 struct gpio_desc *device_wakeup;64 struct gpio_desc *device_wakeup;
@@ -68,7 +70,7 @@ struct bcm_device { · 5 unmodified lines
68 u32 init_speed;70 u32 init_speed;
69 u32 oper_speed;71 u32 oper_speed;
70 int irq;72 int irq;
71 u8 irq_polarity;73 bool irq_active_low;
72 74
73#ifdef CONFIG_PM75#ifdef CONFIG_PM
74 struct hci_uart *hu;76 struct hci_uart *hu;
@@ -76,11 +78,6 @@ struct bcm_device { · 1 unmodified line
76#endif78#endif
77};79};
78 80
79/* serdev driver resources */
80struct bcm_serdev {
81 struct hci_uart hu;
82};
83
84/* generic bcm uart resources */81/* generic bcm uart resources */
85struct bcm_data {82struct bcm_data {
86 struct sk_buff *rx_skb;83 struct sk_buff *rx_skb;
@@ -155,6 +152,12 @@ static bool bcm_device_exists(struct bcm_device *device) · 68 unmodified lines
155{152{
156 struct list_head *p;153 struct list_head *p;
157 154
155#ifdef CONFIG_PM
156 /* Devices using serdev always exist */
157 if (device && device->hu && device->hu->serdev)
158 return true;
159#endif
160
158 list_for_each(p, &bcm_device_list) {161 list_for_each(p, &bcm_device_list) {
159 struct bcm_device *dev = list_entry(p, struct bcm_device, list);162 struct bcm_device *dev = list_entry(p, struct bcm_device, list);
160 163
@@ -188,9 +191,9 @@ static irqreturn_t bcm_host_wake(int irq, void *data) · 27 unmodified lines
188 191
189 bt_dev_dbg(bdev, "Host wake IRQ");192 bt_dev_dbg(bdev, "Host wake IRQ");
190 193
191 pm_runtime_get(&bdev->pdev->dev);194 pm_runtime_get(bdev->dev);
192 pm_runtime_mark_last_busy(&bdev->pdev->dev);195 pm_runtime_mark_last_busy(bdev->dev);
193 pm_runtime_put_autosuspend(&bdev->pdev->dev);196 pm_runtime_put_autosuspend(bdev->dev);
194 197
195 return IRQ_HANDLED;198 return IRQ_HANDLED;
196}199}
@@ -200,7 +203,6 @@ static int bcm_request_irq(struct bcm_data *bcm) · 3 unmodified lines
200 struct bcm_device *bdev = bcm->dev;203 struct bcm_device *bdev = bcm->dev;
201 int err;204 int err;
202 205
203 /* If this is not a platform device, do not enable PM functionalities */
204 mutex_lock(&bcm_device_lock);206 mutex_lock(&bcm_device_lock);
205 if (!bcm_device_exists(bdev)) {207 if (!bcm_device_exists(bdev)) {
206 err = -ENODEV;208 err = -ENODEV;
@@ -212,18 +214,20 @@ static int bcm_request_irq(struct bcm_data *bcm) · 5 unmodified lines
212 goto unlock;214 goto unlock;
213 }215 }
214 216
215 err = devm_request_irq(&bdev->pdev->dev, bdev->irq, bcm_host_wake,217 err = devm_request_irq(bdev->dev, bdev->irq, bcm_host_wake,
216 IRQF_TRIGGER_RISING, "host_wake", bdev);218 bdev->irq_active_low ? IRQF_TRIGGER_FALLING :
219 IRQF_TRIGGER_RISING,
220 "host_wake", bdev);
217 if (err)221 if (err)
218 goto unlock;222 goto unlock;
219 223
220 device_init_wakeup(&bdev->pdev->dev, true);224 device_init_wakeup(bdev->dev, true);
221 225
222 pm_runtime_set_autosuspend_delay(&bdev->pdev->dev,226 pm_runtime_set_autosuspend_delay(bdev->dev,
223 BCM_AUTOSUSPEND_DELAY);227 BCM_AUTOSUSPEND_DELAY);
224 pm_runtime_use_autosuspend(&bdev->pdev->dev);228 pm_runtime_use_autosuspend(bdev->dev);
225 pm_runtime_set_active(&bdev->pdev->dev);229 pm_runtime_set_active(bdev->dev);
226 pm_runtime_enable(&bdev->pdev->dev);230 pm_runtime_enable(bdev->dev);
227 231
228unlock:232unlock:
229 mutex_unlock(&bcm_device_lock);233 mutex_unlock(&bcm_device_lock);
@@ -253,7 +257,7 @@ static int bcm_setup_sleep(struct hci_uart *hu) · 23 unmodified lines
253 struct sk_buff *skb;257 struct sk_buff *skb;
254 struct bcm_set_sleep_mode sleep_params = default_sleep_params;258 struct bcm_set_sleep_mode sleep_params = default_sleep_params;
255 259
256 sleep_params.host_wake_active = !bcm->dev->irq_polarity;260 sleep_params.host_wake_active = !bcm->dev->irq_active_low;
257 261
258 skb = __hci_cmd_sync(hu->hdev, 0xfc27, sizeof(sleep_params),262 skb = __hci_cmd_sync(hu->hdev, 0xfc27, sizeof(sleep_params),
259 &sleep_params, HCI_INIT_TIMEOUT);263 &sleep_params, HCI_INIT_TIMEOUT);
@@ -311,18 +315,17 @@ static int bcm_open(struct hci_uart *hu) · 51 unmodified lines
311 315
312 hu->priv = bcm;316 hu->priv = bcm;
313 317
314 /* If this is a serdev defined device, then only use318 mutex_lock(&bcm_device_lock);
315 * serdev open primitive and skip the rest.319
316 */
317 if (hu->serdev) {320 if (hu->serdev) {
318 serdev_device_open(hu->serdev);321 serdev_device_open(hu->serdev);
322 bcm->dev = serdev_device_get_drvdata(hu->serdev);
319 goto out;323 goto out;
320 }324 }
321 325
322 if (!hu->tty->dev)326 if (!hu->tty->dev)
323 goto out;327 goto out;
324 328
325 mutex_lock(&bcm_device_lock);
326 list_for_each(p, &bcm_device_list) {329 list_for_each(p, &bcm_device_list) {
327 struct bcm_device *dev = list_entry(p, struct bcm_device, list);330 struct bcm_device *dev = list_entry(p, struct bcm_device, list);
328 331
@@ -330,50 +333,56 @@ static int bcm_open(struct hci_uart *hu) · 1 unmodified line
330 * platform device (saved during device probe) and333 * platform device (saved during device probe) and
331 * parent of tty device used by hci_uart334 * parent of tty device used by hci_uart
332 */335 */
333 if (hu->tty->dev->parent == dev->pdev->dev.parent) {336 if (hu->tty->dev->parent == dev->dev->parent) {
334 bcm->dev = dev;337 bcm->dev = dev;
335 hu->init_speed = dev->init_speed;
336 hu->oper_speed = dev->oper_speed;
337#ifdef CONFIG_PM338#ifdef CONFIG_PM
338 dev->hu = hu;339 dev->hu = hu;
339#endif340#endif
340 bcm_gpio_set_power(bcm->dev, true);
341 break;341 break;
342 }342 }
343 }343 }
344 344
345 mutex_unlock(&bcm_device_lock);
346out:345out:
346 if (bcm->dev) {
347 hu->init_speed = bcm->dev->init_speed;
348 hu->oper_speed = bcm->dev->oper_speed;
349 bcm_gpio_set_power(bcm->dev, true);
350 }
351
352 mutex_unlock(&bcm_device_lock);
347 return 0;353 return 0;
348}354}
349 355
350static int bcm_close(struct hci_uart *hu)356static int bcm_close(struct hci_uart *hu)
351{357{
352 struct bcm_data *bcm = hu->priv;358 struct bcm_data *bcm = hu->priv;
353 struct bcm_device *bdev = bcm->dev;359 struct bcm_device *bdev = NULL;
354 360
355 bt_dev_dbg(hu->hdev, "hu %p", hu);361 bt_dev_dbg(hu->hdev, "hu %p", hu);
356 362
357 /* If this is a serdev defined device, only use serdev
358 * close primitive and then continue as usual.
359 */
360 if (hu->serdev)
361 serdev_device_close(hu->serdev);
362
363 /* Protect bcm->dev against removal of the device or driver */363 /* Protect bcm->dev against removal of the device or driver */
364 mutex_lock(&bcm_device_lock);364 mutex_lock(&bcm_device_lock);
365 if (bcm_device_exists(bdev)) {365
366 if (hu->serdev) {
367 serdev_device_close(hu->serdev);
368 bdev = serdev_device_get_drvdata(hu->serdev);
369 } else if (bcm_device_exists(bcm->dev)) {
370 bdev = bcm->dev;
371#ifdef CONFIG_PM
372 bdev->hu = NULL;
373#endif
374 }
375
376 if (bdev) {
366 bcm_gpio_set_power(bdev, false);377 bcm_gpio_set_power(bdev, false);
367#ifdef CONFIG_PM378#ifdef CONFIG_PM
368 pm_runtime_disable(&bdev->pdev->dev);379 pm_runtime_disable(bdev->dev);
369 pm_runtime_set_suspended(&bdev->pdev->dev);380 pm_runtime_set_suspended(bdev->dev);
370 381
371 if (device_can_wakeup(&bdev->pdev->dev)) {382 if (device_can_wakeup(bdev->dev)) {
372 devm_free_irq(&bdev->pdev->dev, bdev->irq, bdev);383 devm_free_irq(bdev->dev, bdev->irq, bdev);
373 device_init_wakeup(&bdev->pdev->dev, false);384 device_init_wakeup(bdev->dev, false);
374 }385 }
375
376 bdev->hu = NULL;
377#endif386#endif
378 }387 }
379 mutex_unlock(&bcm_device_lock);388 mutex_unlock(&bcm_device_lock);
@@ -504,9 +513,9 @@ static int bcm_recv(struct hci_uart *hu, const void *data, int count) · 124 unmodified lines
504 /* Delay auto-suspend when receiving completed packet */513 /* Delay auto-suspend when receiving completed packet */
505 mutex_lock(&bcm_device_lock);514 mutex_lock(&bcm_device_lock);
506 if (bcm->dev && bcm_device_exists(bcm->dev)) {515 if (bcm->dev && bcm_device_exists(bcm->dev)) {
507 pm_runtime_get(&bcm->dev->pdev->dev);516 pm_runtime_get(bcm->dev->dev);
508 pm_runtime_mark_last_busy(&bcm->dev->pdev->dev);517 pm_runtime_mark_last_busy(bcm->dev->dev);
509 pm_runtime_put_autosuspend(&bcm->dev->pdev->dev);518 pm_runtime_put_autosuspend(bcm->dev->dev);
510 }519 }
511 mutex_unlock(&bcm_device_lock);520 mutex_unlock(&bcm_device_lock);
512 }521 }
@@ -537,15 +546,15 @@ static struct sk_buff *bcm_dequeue(struct hci_uart *hu) · 24 unmodified lines
537 546
538 if (bcm_device_exists(bcm->dev)) {547 if (bcm_device_exists(bcm->dev)) {
539 bdev = bcm->dev;548 bdev = bcm->dev;
540 pm_runtime_get_sync(&bdev->pdev->dev);549 pm_runtime_get_sync(bdev->dev);
541 /* Shall be resumed here */550 /* Shall be resumed here */
542 }551 }
543 552
544 skb = skb_dequeue(&bcm->txq);553 skb = skb_dequeue(&bcm->txq);
545 554
546 if (bdev) {555 if (bdev) {
547 pm_runtime_mark_last_busy(&bdev->pdev->dev);556 pm_runtime_mark_last_busy(bdev->dev);
548 pm_runtime_put_autosuspend(&bdev->pdev->dev);557 pm_runtime_put_autosuspend(bdev->dev);
549 }558 }
550 559
551 mutex_unlock(&bcm_device_lock);560 mutex_unlock(&bcm_device_lock);
@@ -556,7 +565,7 @@ static struct sk_buff *bcm_dequeue(struct hci_uart *hu) · 4 unmodified lines
556#ifdef CONFIG_PM565#ifdef CONFIG_PM
557static int bcm_suspend_device(struct device *dev)566static int bcm_suspend_device(struct device *dev)
558{567{
559 struct bcm_device *bdev = platform_get_drvdata(to_platform_device(dev));568 struct bcm_device *bdev = dev_get_drvdata(dev);
560 569
561 bt_dev_dbg(bdev, "");570 bt_dev_dbg(bdev, "");
562 571
@@ -579,7 +588,7 @@ static int bcm_suspend_device(struct device *dev) · 16 unmodified lines
579 588
580static int bcm_resume_device(struct device *dev)589static int bcm_resume_device(struct device *dev)
581{590{
582 struct bcm_device *bdev = platform_get_drvdata(to_platform_device(dev));591 struct bcm_device *bdev = dev_get_drvdata(dev);
583 592
584 bt_dev_dbg(bdev, "");593 bt_dev_dbg(bdev, "");
585 594
@@ -601,16 +610,18 @@ static int bcm_resume_device(struct device *dev) · 15 unmodified lines
601#endif610#endif
602 611
603#ifdef CONFIG_PM_SLEEP612#ifdef CONFIG_PM_SLEEP
604/* Platform suspend callback */613/* suspend callback */
605static int bcm_suspend(struct device *dev)614static int bcm_suspend(struct device *dev)
606{615{
607 struct bcm_device *bdev = platform_get_drvdata(to_platform_device(dev));616 struct bcm_device *bdev = dev_get_drvdata(dev);
608 int error;617 int error;
609 618
610 bt_dev_dbg(bdev, "suspend: is_suspended %d", bdev->is_suspended);619 bt_dev_dbg(bdev, "suspend: is_suspended %d", bdev->is_suspended);
611 620
612 /* bcm_suspend can be called at any time as long as platform device is621 /*
613 * bound, so it should use bcm_device_lock to protect access to hci_uart622 * When used with a device instantiated as platform_device, bcm_suspend
623 * can be called at any time as long as the platform device is bound,
624 * so it should use bcm_device_lock to protect access to hci_uart
614 * and device_wake-up GPIO.625 * and device_wake-up GPIO.
615 */626 */
616 mutex_lock(&bcm_device_lock);627 mutex_lock(&bcm_device_lock);
@@ -621,7 +632,7 @@ static int bcm_suspend(struct device *dev) · 4 unmodified lines
621 if (pm_runtime_active(dev))632 if (pm_runtime_active(dev))
622 bcm_suspend_device(dev);633 bcm_suspend_device(dev);
623 634
624 if (device_may_wakeup(&bdev->pdev->dev)) {635 if (device_may_wakeup(dev)) {
625 error = enable_irq_wake(bdev->irq);636 error = enable_irq_wake(bdev->irq);
626 if (!error)637 if (!error)
627 bt_dev_dbg(bdev, "BCM irq: enabled");638 bt_dev_dbg(bdev, "BCM irq: enabled");
@@ -633,15 +644,17 @@ unlock: · 5 unmodified lines
633 return 0;644 return 0;
634}645}
635 646
636/* Platform resume callback */647/* resume callback */
637static int bcm_resume(struct device *dev)648static int bcm_resume(struct device *dev)
638{649{
639 struct bcm_device *bdev = platform_get_drvdata(to_platform_device(dev));650 struct bcm_device *bdev = dev_get_drvdata(dev);
640 651
641 bt_dev_dbg(bdev, "resume: is_suspended %d", bdev->is_suspended);652 bt_dev_dbg(bdev, "resume: is_suspended %d", bdev->is_suspended);
642 653
643 /* bcm_resume can be called at any time as long as platform device is654 /*
644 * bound, so it should use bcm_device_lock to protect access to hci_uart655 * When used with a device instantiated as platform_device, bcm_resume
656 * can be called at any time as long as platform device is bound,
657 * so it should use bcm_device_lock to protect access to hci_uart
645 * and device_wake-up GPIO.658 * and device_wake-up GPIO.
646 */659 */
647 mutex_lock(&bcm_device_lock);660 mutex_lock(&bcm_device_lock);
@@ -649,7 +662,7 @@ static int bcm_resume(struct device *dev) · 1 unmodified line
649 if (!bdev->hu)662 if (!bdev->hu)
650 goto unlock;663 goto unlock;
651 664
652 if (device_may_wakeup(&bdev->pdev->dev)) {665 if (device_may_wakeup(dev)) {
653 disable_irq_wake(bdev->irq);666 disable_irq_wake(bdev->irq);
654 bt_dev_dbg(bdev, "BCM irq: disabled");667 bt_dev_dbg(bdev, "BCM irq: disabled");
655 }668 }
@@ -690,10 +703,8 @@ static const struct acpi_gpio_mapping acpi_bcm_int_first_gpios[] = { · 34 unmodified lines
690};703};
691 704
692#ifdef CONFIG_ACPI705#ifdef CONFIG_ACPI
693static u8 acpi_active_low = ACPI_ACTIVE_LOW;
694
695/* IRQ polarity of some chipsets are not defined correctly in ACPI table. */706/* IRQ polarity of some chipsets are not defined correctly in ACPI table. */
696static const struct dmi_system_id bcm_wrong_irq_dmi_table[] = {707static const struct dmi_system_id bcm_active_low_irq_dmi_table[] = {
697 {708 {
698 .ident = "Asus T100TA",709 .ident = "Asus T100TA",
699 .matches = {710 .matches = {
@@ -701,7 +712,6 @@ static const struct dmi_system_id bcm_wrong_irq_dmi_table[] = { · 1 unmodified line
701 "ASUSTeK COMPUTER INC."),712 "ASUSTeK COMPUTER INC."),
702 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),713 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
703 },714 },
704 .driver_data = &acpi_active_low,
705 },715 },
706 {716 {
707 .ident = "Asus T100CHI",717 .ident = "Asus T100CHI",
@@ -710,7 +720,6 @@ static const struct dmi_system_id bcm_wrong_irq_dmi_table[] = { · 2 unmodified lines
710 "ASUSTeK COMPUTER INC."),720 "ASUSTeK COMPUTER INC."),
711 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100CHI"),721 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100CHI"),
712 },722 },
713 .driver_data = &acpi_active_low,
714 },723 },
715 { /* Handle ThinkPad 8 tablets with BCM2E55 chipset ACPI ID */724 { /* Handle ThinkPad 8 tablets with BCM2E55 chipset ACPI ID */
716 .ident = "Lenovo ThinkPad 8",725 .ident = "Lenovo ThinkPad 8",
@@ -718,7 +727,13 @@ static const struct dmi_system_id bcm_wrong_irq_dmi_table[] = { · 1 unmodified line
718 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),727 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
719 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 8"),728 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 8"),
720 },729 },
721 .driver_data = &acpi_active_low,730 },
731 {
732 .ident = "MINIX Z83-4",
733 .matches = {
734 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"),
735 DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
736 },
722 },737 },
723 { }738 { }
724};739};
@@ -733,13 +748,13 @@ static int bcm_resource(struct acpi_resource *ares, void *data) · 8 unmodified lines
733 switch (ares->type) {748 switch (ares->type) {
734 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:749 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
735 irq = &ares->data.extended_irq;750 irq = &ares->data.extended_irq;
736 dev->irq_polarity = irq->polarity;751 dev->irq_active_low = irq->polarity == ACPI_ACTIVE_LOW;
737 break;752 break;
738 753
739 case ACPI_RESOURCE_TYPE_GPIO:754 case ACPI_RESOURCE_TYPE_GPIO:
740 gpio = &ares->data.gpio;755 gpio = &ares->data.gpio;
741 if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT)756 if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT)
742 dev->irq_polarity = gpio->polarity;757 dev->irq_active_low = gpio->polarity == ACPI_ACTIVE_LOW;
743 break;758 break;
744 759
745 case ACPI_RESOURCE_TYPE_SERIAL_BUS:760 case ACPI_RESOURCE_TYPE_SERIAL_BUS:
@@ -754,36 +769,32 @@ static int bcm_resource(struct acpi_resource *ares, void *data) · 8 unmodified lines
754 break;769 break;
755 }770 }
756 771
757 /* Always tell the ACPI core to skip this resource */772 return 0;
758 return 1;
759}773}
760#endif /* CONFIG_ACPI */774#endif /* CONFIG_ACPI */
761 775
762static int bcm_platform_probe(struct bcm_device *dev)776static int bcm_get_resources(struct bcm_device *dev)
763{777{
764 struct platform_device *pdev = dev->pdev;778 dev->name = dev_name(dev->dev);
765
766 dev->name = dev_name(&pdev->dev);
767 779
768 dev->clk = devm_clk_get(&pdev->dev, NULL);780 dev->clk = devm_clk_get(dev->dev, NULL);
769 781
770 dev->device_wakeup = devm_gpiod_get_optional(&pdev->dev,782 dev->device_wakeup = devm_gpiod_get_optional(dev->dev,
771 "device-wakeup",783 "device-wakeup",
772 GPIOD_OUT_LOW);784 GPIOD_OUT_LOW);
773 if (IS_ERR(dev->device_wakeup))785 if (IS_ERR(dev->device_wakeup))
774 return PTR_ERR(dev->device_wakeup);786 return PTR_ERR(dev->device_wakeup);
775 787
776 dev->shutdown = devm_gpiod_get_optional(&pdev->dev, "shutdown",788 dev->shutdown = devm_gpiod_get_optional(dev->dev, "shutdown",
777 GPIOD_OUT_LOW);789 GPIOD_OUT_LOW);
778 if (IS_ERR(dev->shutdown))790 if (IS_ERR(dev->shutdown))
779 return PTR_ERR(dev->shutdown);791 return PTR_ERR(dev->shutdown);
780 792
781 /* IRQ can be declared in ACPI table as Interrupt or GpioInt */793 /* IRQ can be declared in ACPI table as Interrupt or GpioInt */
782 dev->irq = platform_get_irq(pdev, 0);
783 if (dev->irq <= 0) {794 if (dev->irq <= 0) {
784 struct gpio_desc *gpio;795 struct gpio_desc *gpio;
785 796
786 gpio = devm_gpiod_get_optional(&pdev->dev, "host-wakeup",797 gpio = devm_gpiod_get_optional(dev->dev, "host-wakeup",
787 GPIOD_IN);798 GPIOD_IN);
788 if (IS_ERR(gpio))799 if (IS_ERR(gpio))
789 return PTR_ERR(gpio);800 return PTR_ERR(gpio);
@@ -791,54 +802,48 @@ static int bcm_platform_probe(struct bcm_device *dev) · 1 unmodified line
791 dev->irq = gpiod_to_irq(gpio);802 dev->irq = gpiod_to_irq(gpio);
792 }803 }
793 804
794 dev_info(&pdev->dev, "BCM irq: %d\n", dev->irq);805 dev_info(dev->dev, "BCM irq: %d\n", dev->irq);
795
796 /* Make sure at-least one of the GPIO is defined and that
797 * a name is specified for this instance
798 */
799 if ((!dev->device_wakeup && !dev->shutdown) || !dev->name) {
800 dev_err(&pdev->dev, "invalid platform data\n");
801 return -EINVAL;
802 }
803
804 return 0;806 return 0;
805}807}
806 808
807#ifdef CONFIG_ACPI809#ifdef CONFIG_ACPI
808static int bcm_acpi_probe(struct bcm_device *dev)810static int bcm_acpi_probe(struct bcm_device *dev)
809{811{
810 struct platform_device *pdev = dev->pdev;
811 LIST_HEAD(resources);812 LIST_HEAD(resources);
812 const struct dmi_system_id *dmi_id;813 const struct dmi_system_id *dmi_id;
813 const struct acpi_gpio_mapping *gpio_mapping = acpi_bcm_int_last_gpios;814 const struct acpi_gpio_mapping *gpio_mapping = acpi_bcm_int_last_gpios;
814 const struct acpi_device_id *id;815 const struct acpi_device_id *id;
816 struct resource_entry *entry;
815 int ret;817 int ret;
816 818
817 /* Retrieve GPIO data */819 /* Retrieve GPIO data */
818 id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);820 id = acpi_match_device(dev->dev->driver->acpi_match_table, dev->dev);
819 if (id)821 if (id)
820 gpio_mapping = (const struct acpi_gpio_mapping *) id->driver_data;822 gpio_mapping = (const struct acpi_gpio_mapping *) id->driver_data;
821 823
822 ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, gpio_mapping);824 ret = devm_acpi_dev_add_driver_gpios(dev->dev, gpio_mapping);
823 if (ret)
824 return ret;
825
826 ret = bcm_platform_probe(dev);
827 if (ret)825 if (ret)
828 return ret;826 return ret;
829 827
830 /* Retrieve UART ACPI info */828 /* Retrieve UART ACPI info */
831 ret = acpi_dev_get_resources(ACPI_COMPANION(&dev->pdev->dev),829 ret = acpi_dev_get_resources(ACPI_COMPANION(dev->dev),
832 &resources, bcm_resource, dev);830 &resources, bcm_resource, dev);
833 if (ret < 0)831 if (ret < 0)
834 return ret;832 return ret;
833
834 resource_list_for_each_entry(entry, &resources) {
835 if (resource_type(entry->res) == IORESOURCE_IRQ) {
836 dev->irq = entry->res->start;
837 break;
838 }
839 }
835 acpi_dev_free_resource_list(&resources);840 acpi_dev_free_resource_list(&resources);
836 841
837 dmi_id = dmi_first_match(bcm_wrong_irq_dmi_table);842 dmi_id = dmi_first_match(bcm_active_low_irq_dmi_table);
838 if (dmi_id) {843 if (dmi_id) {
839 bt_dev_warn(dev, "%s: Overwriting IRQ polarity to active low",844 dev_warn(dev->dev, "%s: Overwriting IRQ polarity to active low",
840 dmi_id->ident);845 dmi_id->ident);
841 dev->irq_polarity = *(u8 *)dmi_id->driver_data;846 dev->irq_active_low = true;
842 }847 }
843 848
844 return 0;849 return 0;
@@ -850,6 +855,12 @@ static int bcm_acpi_probe(struct bcm_device *dev) · 5 unmodified lines
850}855}
851#endif /* CONFIG_ACPI */856#endif /* CONFIG_ACPI */
852 857
858static int bcm_of_probe(struct bcm_device *bdev)
859{
860 device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
861 return 0;
862}
863
853static int bcm_probe(struct platform_device *pdev)864static int bcm_probe(struct platform_device *pdev)
854{865{
855 struct bcm_device *dev;866 struct bcm_device *dev;
@@ -859,12 +870,16 @@ static int bcm_probe(struct platform_device *pdev) · 3 unmodified lines
859 if (!dev)870 if (!dev)
860 return -ENOMEM;871 return -ENOMEM;
861 872
862 dev->pdev = pdev;873 dev->dev = &pdev->dev;
874 dev->irq = platform_get_irq(pdev, 0);
863 875
864 if (has_acpi_companion(&pdev->dev))876 if (has_acpi_companion(&pdev->dev)) {
865 ret = bcm_acpi_probe(dev);877 ret = bcm_acpi_probe(dev);
866 else878 if (ret)
867 ret = bcm_platform_probe(dev);879 return ret;
880 }
881
882 ret = bcm_get_resources(dev);
868 if (ret)883 if (ret)
869 return ret;884 return ret;
870 885
@@ -926,14 +941,16 @@ static const struct acpi_device_id bcm_acpi_match[] = { · 55 unmodified lines
926 { "BCM2E71", (kernel_ulong_t)&acpi_bcm_int_last_gpios },941 { "BCM2E71", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
927 { "BCM2E7B", (kernel_ulong_t)&acpi_bcm_int_last_gpios },942 { "BCM2E7B", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
928 { "BCM2E7C", (kernel_ulong_t)&acpi_bcm_int_last_gpios },943 { "BCM2E7C", (kernel_ulong_t)&acpi_bcm_int_last_gpios },
944 { "BCM2E7E", (kernel_ulong_t)&acpi_bcm_int_first_gpios },
929 { "BCM2E95", (kernel_ulong_t)&acpi_bcm_int_first_gpios },945 { "BCM2E95", (kernel_ulong_t)&acpi_bcm_int_first_gpios },
930 { "BCM2E96", (kernel_ulong_t)&acpi_bcm_int_first_gpios },946 { "BCM2E96", (kernel_ulong_t)&acpi_bcm_int_first_gpios },
947 { "BCM2EA4", (kernel_ulong_t)&acpi_bcm_int_first_gpios },
931 { },948 { },
932};949};
933MODULE_DEVICE_TABLE(acpi, bcm_acpi_match);950MODULE_DEVICE_TABLE(acpi, bcm_acpi_match);
934#endif951#endif
935 952
936/* Platform suspend and resume callbacks */953/* suspend and resume callbacks */
937static const struct dev_pm_ops bcm_pm_ops = {954static const struct dev_pm_ops bcm_pm_ops = {
938 SET_SYSTEM_SLEEP_PM_OPS(bcm_suspend, bcm_resume)955 SET_SYSTEM_SLEEP_PM_OPS(bcm_suspend, bcm_resume)
939 SET_RUNTIME_PM_OPS(bcm_suspend_device, bcm_resume_device, NULL)956 SET_RUNTIME_PM_OPS(bcm_suspend_device, bcm_resume_device, NULL)
@@ -951,29 +968,41 @@ static struct platform_driver bcm_driver = { · 11 unmodified lines
951 968
952static int bcm_serdev_probe(struct serdev_device *serdev)969static int bcm_serdev_probe(struct serdev_device *serdev)
953{970{
954 struct bcm_serdev *bcmdev;971 struct bcm_device *bcmdev;
955 u32 speed;
956 int err;972 int err;
957 973
958 bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);974 bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);
959 if (!bcmdev)975 if (!bcmdev)
960 return -ENOMEM;976 return -ENOMEM;
961 977
962 bcmdev->hu.serdev = serdev;978 bcmdev->dev = &serdev->dev;
979#ifdef CONFIG_PM
980 bcmdev->hu = &bcmdev->serdev_hu;
981#endif
982 bcmdev->serdev_hu.serdev = serdev;
963 serdev_device_set_drvdata(serdev, bcmdev);983 serdev_device_set_drvdata(serdev, bcmdev);
964 984
965 err = device_property_read_u32(&serdev->dev, "max-speed", &speed);985 if (has_acpi_companion(&serdev->dev))
966 if (!err)986 err = bcm_acpi_probe(bcmdev);
967 bcmdev->hu.oper_speed = speed;987 else
988 err = bcm_of_probe(bcmdev);
989 if (err)
990 return err;
991
992 err = bcm_get_resources(bcmdev);
993 if (err)
994 return err;
995
996 bcm_gpio_set_power(bcmdev, false);
968 997
969 return hci_uart_register_device(&bcmdev->hu, &bcm_proto);998 return hci_uart_register_device(&bcmdev->serdev_hu, &bcm_proto);
970}999}
971 1000
972static void bcm_serdev_remove(struct serdev_device *serdev)1001static void bcm_serdev_remove(struct serdev_device *serdev)
973{1002{
974 struct bcm_serdev *bcmdev = serdev_device_get_drvdata(serdev);1003 struct bcm_device *bcmdev = serdev_device_get_drvdata(serdev);
975 1004
976 hci_uart_unregister_device(&bcmdev->hu);1005 hci_uart_unregister_device(&bcmdev->serdev_hu);
977}1006}
978 1007
979#ifdef CONFIG_OF1008#ifdef CONFIG_OF
@@ -990,6 +1019,8 @@ static struct serdev_device_driver bcm_serdev_driver = { · 10 unmodified lines
990 .driver = {1019 .driver = {
991 .name = "hci_uart_bcm",1020 .name = "hci_uart_bcm",
992 .of_match_table = of_match_ptr(bcm_bluetooth_of_match),1021 .of_match_table = of_match_ptr(bcm_bluetooth_of_match),
1022 .acpi_match_table = ACPI_PTR(bcm_acpi_match),
1023 .pm = &bcm_pm_ops,
993 },1024 },
994};1025};
995 1026
drivers/bluetooth/hci_bcsp.c+6−4
@@ -65,6 +65,7 @@ struct bcsp_struct { · 64 unmodified lines
65 u8 rxseq_txack; /* rxseq == txack. */65 u8 rxseq_txack; /* rxseq == txack. */
66 u8 rxack; /* Last packet sent by us that the peer ack'ed */66 u8 rxack; /* Last packet sent by us that the peer ack'ed */
67 struct timer_list tbcsp;67 struct timer_list tbcsp;
68 struct hci_uart *hu;
68 69
69 enum {70 enum {
70 BCSP_W4_PKT_DELIMITER,71 BCSP_W4_PKT_DELIMITER,
@@ -697,10 +698,10 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count) · 626 unmodified lines
697}698}
698 699
699 /* Arrange to retransmit all messages in the relq. */700 /* Arrange to retransmit all messages in the relq. */
700static void bcsp_timed_event(unsigned long arg)701static void bcsp_timed_event(struct timer_list *t)
701{702{
702 struct hci_uart *hu = (struct hci_uart *)arg;703 struct bcsp_struct *bcsp = from_timer(bcsp, t, tbcsp);
703 struct bcsp_struct *bcsp = hu->priv;704 struct hci_uart *hu = bcsp->hu;
704 struct sk_buff *skb;705 struct sk_buff *skb;
705 unsigned long flags;706 unsigned long flags;
706 707
@@ -729,11 +730,12 @@ static int bcsp_open(struct hci_uart *hu) · 22 unmodified lines
729 return -ENOMEM;730 return -ENOMEM;
730 731
731 hu->priv = bcsp;732 hu->priv = bcsp;
733 bcsp->hu = hu;
732 skb_queue_head_init(&bcsp->unack);734 skb_queue_head_init(&bcsp->unack);
733 skb_queue_head_init(&bcsp->rel);735 skb_queue_head_init(&bcsp->rel);
734 skb_queue_head_init(&bcsp->unrel);736 skb_queue_head_init(&bcsp->unrel);
735 737
736 setup_timer(&bcsp->tbcsp, bcsp_timed_event, (u_long)hu);738 timer_setup(&bcsp->tbcsp, bcsp_timed_event, 0);
737 739
738 bcsp->rx_state = BCSP_W4_PKT_DELIMITER;740 bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
739 741
drivers/bluetooth/hci_h4.c+1−1
@@ -132,7 +132,7 @@ static int h4_recv(struct hci_uart *hu, const void *data, int count) · 131 unmodified lines
132 h4_recv_pkts, ARRAY_SIZE(h4_recv_pkts));132 h4_recv_pkts, ARRAY_SIZE(h4_recv_pkts));
133 if (IS_ERR(h4->rx_skb)) {133 if (IS_ERR(h4->rx_skb)) {
134 int err = PTR_ERR(h4->rx_skb);134 int err = PTR_ERR(h4->rx_skb);
135 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);135 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
136 h4->rx_skb = NULL;136 h4->rx_skb = NULL;
137 return err;137 return err;
138 }138 }
drivers/bluetooth/hci_h5.c+6−4
@@ -78,6 +78,7 @@ struct h5 { · 77 unmodified lines
78 int (*rx_func)(struct hci_uart *hu, u8 c);78 int (*rx_func)(struct hci_uart *hu, u8 c);
79 79
80 struct timer_list timer; /* Retransmission timer */80 struct timer_list timer; /* Retransmission timer */
81 struct hci_uart *hu; /* Parent HCI UART */
81 82
82 u8 tx_seq; /* Next seq number to send */83 u8 tx_seq; /* Next seq number to send */
83 u8 tx_ack; /* Next ack number to send */84 u8 tx_ack; /* Next ack number to send */
@@ -120,12 +121,12 @@ static u8 h5_cfg_field(struct h5 *h5) · 36 unmodified lines
120 return h5->tx_win & 0x07;121 return h5->tx_win & 0x07;
121}122}
122 123
123static void h5_timed_event(unsigned long arg)124static void h5_timed_event(struct timer_list *t)
124{125{
125 const unsigned char sync_req[] = { 0x01, 0x7e };126 const unsigned char sync_req[] = { 0x01, 0x7e };
126 unsigned char conf_req[3] = { 0x03, 0xfc };127 unsigned char conf_req[3] = { 0x03, 0xfc };
127 struct hci_uart *hu = (struct hci_uart *)arg;128 struct h5 *h5 = from_timer(h5, t, timer);
128 struct h5 *h5 = hu->priv;129 struct hci_uart *hu = h5->hu;
129 struct sk_buff *skb;130 struct sk_buff *skb;
130 unsigned long flags;131 unsigned long flags;
131 132
@@ -197,6 +198,7 @@ static int h5_open(struct hci_uart *hu) · 65 unmodified lines
197 return -ENOMEM;198 return -ENOMEM;
198 199
199 hu->priv = h5;200 hu->priv = h5;
201 h5->hu = hu;
200 202
201 skb_queue_head_init(&h5->unack);203 skb_queue_head_init(&h5->unack);
202 skb_queue_head_init(&h5->rel);204 skb_queue_head_init(&h5->rel);
@@ -204,7 +206,7 @@ static int h5_open(struct hci_uart *hu) · 1 unmodified line
204 206
205 h5_reset_rx(h5);207 h5_reset_rx(h5);
206 208
207 setup_timer(&h5->timer, h5_timed_event, (unsigned long)hu);209 timer_setup(&h5->timer, h5_timed_event, 0);
208 210
209 h5->tx_win = H5_TX_WIN_MAX;211 h5->tx_win = H5_TX_WIN_MAX;
210 212
drivers/bluetooth/hci_ldisc.c+31−18
@@ -41,6 +41,7 @@ · 40 unmodified lines
41#include <linux/ioctl.h>41#include <linux/ioctl.h>
42#include <linux/skbuff.h>42#include <linux/skbuff.h>
43#include <linux/firmware.h>43#include <linux/firmware.h>
44#include <linux/serdev.h>
44 45
45#include <net/bluetooth/bluetooth.h>46#include <net/bluetooth/bluetooth.h>
46#include <net/bluetooth/hci_core.h>47#include <net/bluetooth/hci_core.h>
@@ -114,12 +115,12 @@ static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu) · 67 unmodified lines
114 struct sk_buff *skb = hu->tx_skb;115 struct sk_buff *skb = hu->tx_skb;
115 116
116 if (!skb) {117 if (!skb) {
117 read_lock(&hu->proto_lock);118 percpu_down_read(&hu->proto_lock);
118 119
119 if (test_bit(HCI_UART_PROTO_READY, &hu->flags))120 if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
120 skb = hu->proto->dequeue(hu);121 skb = hu->proto->dequeue(hu);
121 122
122 read_unlock(&hu->proto_lock);123 percpu_up_read(&hu->proto_lock);
123 } else {124 } else {
124 hu->tx_skb = NULL;125 hu->tx_skb = NULL;
125 }126 }
@@ -129,7 +130,14 @@ static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu) · 3 unmodified lines
129 130
130int hci_uart_tx_wakeup(struct hci_uart *hu)131int hci_uart_tx_wakeup(struct hci_uart *hu)
131{132{
132 read_lock(&hu->proto_lock);133 /* This may be called in an IRQ context, so we can't sleep. Therefore
134 * we try to acquire the lock only, and if that fails we assume the
135 * tty is being closed because that is the only time the write lock is
136 * acquired. If, however, at some point in the future the write lock
137 * is also acquired in other situations, then this must be revisited.
138 */
139 if (!percpu_down_read_trylock(&hu->proto_lock))
140 return 0;
133 141
134 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))142 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))
135 goto no_schedule;143 goto no_schedule;
@@ -144,7 +152,7 @@ int hci_uart_tx_wakeup(struct hci_uart *hu) · 8 unmodified lines
144 schedule_work(&hu->write_work);152 schedule_work(&hu->write_work);
145 153
146no_schedule:154no_schedule:
147 read_unlock(&hu->proto_lock);155 percpu_up_read(&hu->proto_lock);
148 156
149 return 0;157 return 0;
150}158}
@@ -246,12 +254,12 @@ static int hci_uart_flush(struct hci_dev *hdev) · 95 unmodified lines
246 tty_ldisc_flush(tty);254 tty_ldisc_flush(tty);
247 tty_driver_flush_buffer(tty);255 tty_driver_flush_buffer(tty);
248 256
249 read_lock(&hu->proto_lock);257 percpu_down_read(&hu->proto_lock);
250 258
251 if (test_bit(HCI_UART_PROTO_READY, &hu->flags))259 if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
252 hu->proto->flush(hu);260 hu->proto->flush(hu);
253 261
254 read_unlock(&hu->proto_lock);262 percpu_up_read(&hu->proto_lock);
255 263
256 return 0;264 return 0;
257}265}
@@ -274,15 +282,15 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb) · 16 unmodified lines
274 BT_DBG("%s: type %d len %d", hdev->name, hci_skb_pkt_type(skb),282 BT_DBG("%s: type %d len %d", hdev->name, hci_skb_pkt_type(skb),
275 skb->len);283 skb->len);
276 284
277 read_lock(&hu->proto_lock);285 percpu_down_read(&hu->proto_lock);
278 286
279 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) {287 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) {
280 read_unlock(&hu->proto_lock);288 percpu_up_read(&hu->proto_lock);
281 return -EUNATCH;289 return -EUNATCH;
282 }290 }
283 291
284 hu->proto->enqueue(hu, skb);292 hu->proto->enqueue(hu, skb);
285 read_unlock(&hu->proto_lock);293 percpu_up_read(&hu->proto_lock);
286 294
287 hci_uart_tx_wakeup(hu);295 hci_uart_tx_wakeup(hu);
288 296
@@ -298,6 +306,12 @@ void hci_uart_set_flow_control(struct hci_uart *hu, bool enable) · 9 unmodified lines
298 unsigned int set = 0;306 unsigned int set = 0;
299 unsigned int clear = 0;307 unsigned int clear = 0;
300 308
309 if (hu->serdev) {
310 serdev_device_set_flow_control(hu->serdev, !enable);
311 serdev_device_set_rts(hu->serdev, !enable);
312 return;
313 }
314
301 if (enable) {315 if (enable) {
302 /* Disable hardware flow control */316 /* Disable hardware flow control */
303 ktermios = tty->termios;317 ktermios = tty->termios;
@@ -479,7 +493,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) · 175 unmodified lines
479 INIT_WORK(&hu->init_ready, hci_uart_init_work);493 INIT_WORK(&hu->init_ready, hci_uart_init_work);
480 INIT_WORK(&hu->write_work, hci_uart_write_work);494 INIT_WORK(&hu->write_work, hci_uart_write_work);
481 495
482 rwlock_init(&hu->proto_lock);496 percpu_init_rwsem(&hu->proto_lock);
483 497
484 /* Flush any pending characters in the driver */498 /* Flush any pending characters in the driver */
485 tty_driver_flush_buffer(tty);499 tty_driver_flush_buffer(tty);
@@ -496,7 +510,6 @@ static void hci_uart_tty_close(struct tty_struct *tty) · 10 unmodified lines
496{510{
497 struct hci_uart *hu = tty->disc_data;511 struct hci_uart *hu = tty->disc_data;
498 struct hci_dev *hdev;512 struct hci_dev *hdev;
499 unsigned long flags;
500 513
501 BT_DBG("tty %p", tty);514 BT_DBG("tty %p", tty);
502 515
@@ -510,12 +523,12 @@ static void hci_uart_tty_close(struct tty_struct *tty) · 7 unmodified lines
510 if (hdev)523 if (hdev)
511 hci_uart_close(hdev);524 hci_uart_close(hdev);
512 525
513 cancel_work_sync(&hu->write_work);
514
515 if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) {526 if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) {
516 write_lock_irqsave(&hu->proto_lock, flags);527 percpu_down_write(&hu->proto_lock);
517 clear_bit(HCI_UART_PROTO_READY, &hu->flags);528 clear_bit(HCI_UART_PROTO_READY, &hu->flags);
518 write_unlock_irqrestore(&hu->proto_lock, flags);529 percpu_up_write(&hu->proto_lock);
530
531 cancel_work_sync(&hu->write_work);
519 532
520 if (hdev) {533 if (hdev) {
521 if (test_bit(HCI_UART_REGISTERED, &hu->flags))534 if (test_bit(HCI_UART_REGISTERED, &hu->flags))
@@ -575,10 +588,10 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, · 53 unmodified lines
575 if (!hu || tty != hu->tty)588 if (!hu || tty != hu->tty)
576 return;589 return;
577 590
578 read_lock(&hu->proto_lock);591 percpu_down_read(&hu->proto_lock);
579 592
580 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) {593 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) {
581 read_unlock(&hu->proto_lock);594 percpu_up_read(&hu->proto_lock);
582 return;595 return;
583 }596 }
584 597
@@ -586,7 +599,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, · 1 unmodified line
586 * tty caller599 * tty caller
587 */600 */
588 hu->proto->recv(hu, data, count);601 hu->proto->recv(hu, data, count);
589 read_unlock(&hu->proto_lock);602 percpu_up_read(&hu->proto_lock);
590 603
591 if (hu->hdev)604 if (hu->hdev)
592 hu->hdev->stat.byte_rx += count;605 hu->hdev->stat.byte_rx += count;
drivers/bluetooth/hci_ll.c+1−1
@@ -242,7 +242,7 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu) · 241 unmodified lines
242 * perfectly safe to always send one.242 * perfectly safe to always send one.
243 */243 */
244 BT_DBG("dual wake-up-indication");244 BT_DBG("dual wake-up-indication");
245 /* deliberate fall-through - do not add break */245 /* fall through */
246 case HCILL_ASLEEP:246 case HCILL_ASLEEP:
247 /* acknowledge device wake up */247 /* acknowledge device wake up */
248 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {248 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
drivers/bluetooth/hci_qca.c+14−15
@@ -307,10 +307,10 @@ static void qca_wq_serial_tx_clock_vote_off(struct work_struct *work) · 306 unmodified lines
307 serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_OFF, hu);307 serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_OFF, hu);
308}308}
309 309
310static void hci_ibs_tx_idle_timeout(unsigned long arg)310static void hci_ibs_tx_idle_timeout(struct timer_list *t)
311{311{
312 struct hci_uart *hu = (struct hci_uart *)arg;312 struct qca_data *qca = from_timer(qca, t, tx_idle_timer);
313 struct qca_data *qca = hu->priv;313 struct hci_uart *hu = qca->hu;
314 unsigned long flags;314 unsigned long flags;
315 315
316 BT_DBG("hu %p idle timeout in %d state", hu, qca->tx_ibs_state);316 BT_DBG("hu %p idle timeout in %d state", hu, qca->tx_ibs_state);
@@ -342,10 +342,10 @@ static void hci_ibs_tx_idle_timeout(unsigned long arg) · 25 unmodified lines
342 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);342 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
343}343}
344 344
345static void hci_ibs_wake_retrans_timeout(unsigned long arg)345static void hci_ibs_wake_retrans_timeout(struct timer_list *t)
346{346{
347 struct hci_uart *hu = (struct hci_uart *)arg;347 struct qca_data *qca = from_timer(qca, t, wake_retrans_timer);
348 struct qca_data *qca = hu->priv;348 struct hci_uart *hu = qca->hu;
349 unsigned long flags, retrans_delay;349 unsigned long flags, retrans_delay;
350 bool retransmit = false;350 bool retransmit = false;
351 351
@@ -438,11 +438,10 @@ static int qca_open(struct hci_uart *hu) · 86 unmodified lines
438 438
439 hu->priv = qca;439 hu->priv = qca;
440 440
441 setup_timer(&qca->wake_retrans_timer, hci_ibs_wake_retrans_timeout,441 timer_setup(&qca->wake_retrans_timer, hci_ibs_wake_retrans_timeout, 0);
442 (u_long)hu);
443 qca->wake_retrans = IBS_WAKE_RETRANS_TIMEOUT_MS;442 qca->wake_retrans = IBS_WAKE_RETRANS_TIMEOUT_MS;
444 443
445 setup_timer(&qca->tx_idle_timer, hci_ibs_tx_idle_timeout, (u_long)hu);444 timer_setup(&qca->tx_idle_timer, hci_ibs_tx_idle_timeout, 0);
446 qca->tx_idle_delay = IBS_TX_IDLE_TIMEOUT_MS;445 qca->tx_idle_delay = IBS_TX_IDLE_TIMEOUT_MS;
447 446
448 BT_DBG("HCI_UART_QCA open, tx_idle_delay=%u, wake_retrans=%u",447 BT_DBG("HCI_UART_QCA open, tx_idle_delay=%u, wake_retrans=%u",
@@ -801,7 +800,7 @@ static int qca_recv(struct hci_uart *hu, const void *data, int count) · 352 unmodified lines
801 qca_recv_pkts, ARRAY_SIZE(qca_recv_pkts));800 qca_recv_pkts, ARRAY_SIZE(qca_recv_pkts));
802 if (IS_ERR(qca->rx_skb)) {801 if (IS_ERR(qca->rx_skb)) {
803 int err = PTR_ERR(qca->rx_skb);802 int err = PTR_ERR(qca->rx_skb);
804 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);803 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
805 qca->rx_skb = NULL;804 qca->rx_skb = NULL;
806 return err;805 return err;
807 }806 }
@@ -864,7 +863,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) · 56 unmodified lines
864 863
865 skb = bt_skb_alloc(sizeof(cmd), GFP_ATOMIC);864 skb = bt_skb_alloc(sizeof(cmd), GFP_ATOMIC);
866 if (!skb) {865 if (!skb) {
867 BT_ERR("Failed to allocate memory for baudrate packet");866 bt_dev_err(hdev, "Failed to allocate baudrate packet");
868 return -ENOMEM;867 return -ENOMEM;
869 }868 }
870 869
@@ -893,7 +892,7 @@ static int qca_setup(struct hci_uart *hu) · 22 unmodified lines
893 unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;892 unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
894 int ret;893 int ret;
895 894
896 BT_INFO("%s: ROME setup", hdev->name);895 bt_dev_info(hdev, "ROME setup");
897 896
898 /* Patch downloading has to be done without IBS mode */897 /* Patch downloading has to be done without IBS mode */
899 clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);898 clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
@@ -918,11 +917,11 @@ static int qca_setup(struct hci_uart *hu) · 18 unmodified lines
918 if (speed) {917 if (speed) {
919 qca_baudrate = qca_get_baudrate_value(speed);918 qca_baudrate = qca_get_baudrate_value(speed);
920 919
921 BT_INFO("%s: Set UART speed to %d", hdev->name, speed);920 bt_dev_info(hdev, "Set UART speed to %d", speed);
922 ret = qca_set_baudrate(hdev, qca_baudrate);921 ret = qca_set_baudrate(hdev, qca_baudrate);
923 if (ret) {922 if (ret) {
924 BT_ERR("%s: Failed to change the baud rate (%d)",923 bt_dev_err(hdev, "Failed to change the baud rate (%d)",
925 hdev->name, ret);924 ret);
926 return ret;925 return ret;
927 }926 }
928 hci_uart_set_baudrate(hu, speed);927 hci_uart_set_baudrate(hu, speed);
drivers/bluetooth/hci_serdev.c+4−5
@@ -185,7 +185,7 @@ static int hci_uart_setup(struct hci_dev *hdev) · 184 unmodified lines
185 if (hu->proto->set_baudrate && speed) {185 if (hu->proto->set_baudrate && speed) {
186 err = hu->proto->set_baudrate(hu, speed);186 err = hu->proto->set_baudrate(hu, speed);
187 if (err)187 if (err)
188 BT_ERR("%s: failed to set baudrate", hdev->name);188 bt_dev_err(hdev, "Failed to set baudrate");
189 else189 else
190 serdev_device_set_baudrate(hu->serdev, speed);190 serdev_device_set_baudrate(hu->serdev, speed);
191 }191 }
@@ -199,14 +199,13 @@ static int hci_uart_setup(struct hci_dev *hdev) · 7 unmodified lines
199 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,199 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
200 HCI_INIT_TIMEOUT);200 HCI_INIT_TIMEOUT);
201 if (IS_ERR(skb)) {201 if (IS_ERR(skb)) {
202 BT_ERR("%s: Reading local version information failed (%ld)",202 bt_dev_err(hdev, "Reading local version info failed (%ld)",
203 hdev->name, PTR_ERR(skb));203 PTR_ERR(skb));
204 return 0;204 return 0;
205 }205 }
206 206
207 if (skb->len != sizeof(*ver)) {207 if (skb->len != sizeof(*ver)) {
208 BT_ERR("%s: Event length mismatch for version information",208 bt_dev_err(hdev, "Event length mismatch for version info");
209 hdev->name);
210 }209 }
211 210
212 kfree_skb(skb);211 kfree_skb(skb);
drivers/bluetooth/hci_uart.h+1−1
@@ -87,7 +87,7 @@ struct hci_uart { · 86 unmodified lines
87 struct work_struct write_work;87 struct work_struct write_work;
88 88
89 const struct hci_uart_proto *proto;89 const struct hci_uart_proto *proto;
90 rwlock_t proto_lock; /* Stop work for proto close */90 struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */
91 void *priv;91 void *priv;
92 92
93 struct sk_buff *tx_skb;93 struct sk_buff *tx_skb;
drivers/connector/cn_queue.c+2−2
@@ -45,7 +45,7 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, · 44 unmodified lines
45 return NULL;45 return NULL;
46 }46 }
47 47
48 atomic_set(&cbq->refcnt, 1);48 refcount_set(&cbq->refcnt, 1);
49 49
50 atomic_inc(&dev->refcnt);50 atomic_inc(&dev->refcnt);
51 cbq->pdev = dev;51 cbq->pdev = dev;
@@ -58,7 +58,7 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, · 6 unmodified lines
58 58
59void cn_queue_release_callback(struct cn_callback_entry *cbq)59void cn_queue_release_callback(struct cn_callback_entry *cbq)
60{60{
61 if (!atomic_dec_and_test(&cbq->refcnt))61 if (!refcount_dec_and_test(&cbq->refcnt))
62 return;62 return;
63 63
64 atomic_dec(&cbq->pdev->refcnt);64 atomic_dec(&cbq->pdev->refcnt);
drivers/connector/connector.c+1−1
@@ -157,7 +157,7 @@ static int cn_call_callback(struct sk_buff *skb) · 156 unmodified lines
157 spin_lock_bh(&dev->cbdev->queue_lock);157 spin_lock_bh(&dev->cbdev->queue_lock);
158 list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) {158 list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) {
159 if (cn_cb_equal(&i->id.id, &msg->id)) {159 if (cn_cb_equal(&i->id.id, &msg->id)) {
160 atomic_inc(&i->refcnt);160 refcount_inc(&i->refcnt);
161 cbq = i;161 cbq = i;
162 break;162 break;
163 }163 }
drivers/infiniband/hw/qedr/Kconfig+1−0
@@ -2,6 +2,7 @@ config INFINIBAND_QEDR · 1 unmodified line
2 tristate "QLogic RoCE driver"2 tristate "QLogic RoCE driver"
3 depends on 64BIT && QEDE3 depends on 64BIT && QEDE
4 select QED_LL24 select QED_LL2
5 select QED_OOO
5 select QED_RDMA6 select QED_RDMA
6 ---help---7 ---help---
7 This driver provides low-level InfiniBand over Ethernet8 This driver provides low-level InfiniBand over Ethernet
drivers/infiniband/ulp/ipoib/ipoib_ib.c+12−3
@@ -893,13 +893,17 @@ dev_stop: · 892 unmodified lines
893void ipoib_pkey_dev_check_presence(struct net_device *dev)893void ipoib_pkey_dev_check_presence(struct net_device *dev)
894{894{
895 struct ipoib_dev_priv *priv = ipoib_priv(dev);895 struct ipoib_dev_priv *priv = ipoib_priv(dev);
896 struct rdma_netdev *rn = netdev_priv(dev);
896 897
897 if (!(priv->pkey & 0x7fff) ||898 if (!(priv->pkey & 0x7fff) ||
898 ib_find_pkey(priv->ca, priv->port, priv->pkey,899 ib_find_pkey(priv->ca, priv->port, priv->pkey,
899 &priv->pkey_index))900 &priv->pkey_index)) {
900 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);901 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
901 else902 } else {
903 if (rn->set_id)
904 rn->set_id(dev, priv->pkey_index);
902 set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);905 set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
906 }
903}907}
904 908
905void ipoib_ib_dev_up(struct net_device *dev)909void ipoib_ib_dev_up(struct net_device *dev)
@@ -1203,10 +1207,15 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, · 297 unmodified lines
1203 ipoib_ib_dev_down(dev);1207 ipoib_ib_dev_down(dev);
1204 1208
1205 if (level == IPOIB_FLUSH_HEAVY) {1209 if (level == IPOIB_FLUSH_HEAVY) {
1210 rtnl_lock();
1206 if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))1211 if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
1207 ipoib_ib_dev_stop(dev);1212 ipoib_ib_dev_stop(dev);
1208 if (ipoib_ib_dev_open(dev) != 0)1213
1214 result = ipoib_ib_dev_open(dev);
1215 rtnl_unlock();
1216 if (result)
1209 return;1217 return;
1218
1210 if (netif_queue_stopped(dev))1219 if (netif_queue_stopped(dev))
1211 netif_start_queue(dev);1220 netif_start_queue(dev);
1212 }1221 }
drivers/isdn/gigaset/bas-gigaset.c+19−25
@@ -89,6 +89,7 @@ static int start_cbsend(struct cardstate *); · 88 unmodified lines
89 89
90struct bas_cardstate {90struct bas_cardstate {
91 struct usb_device *udev; /* USB device pointer */91 struct usb_device *udev; /* USB device pointer */
92 struct cardstate *cs;
92 struct usb_interface *interface; /* interface for this device */93 struct usb_interface *interface; /* interface for this device */
93 unsigned char minor; /* starting minor number */94 unsigned char minor; /* starting minor number */
94 95
@@ -433,10 +434,10 @@ static void check_pending(struct bas_cardstate *ucs) · 338 unmodified lines
433 * argument:434 * argument:
434 * controller state structure435 * controller state structure
435 */436 */
436static void cmd_in_timeout(unsigned long data)437static void cmd_in_timeout(struct timer_list *t)
437{438{
438 struct cardstate *cs = (struct cardstate *) data;439 struct bas_cardstate *ucs = from_timer(ucs, t, timer_cmd_in);
439 struct bas_cardstate *ucs = cs->hw.bas;440 struct cardstate *cs = ucs->cs;
440 int rc;441 int rc;
441 442
442 if (!ucs->rcvbuf_size) {443 if (!ucs->rcvbuf_size) {
@@ -639,10 +640,10 @@ static void int_in_work(struct work_struct *work) · 196 unmodified lines
639 * argument:640 * argument:
640 * controller state structure641 * controller state structure
641 */642 */
642static void int_in_resubmit(unsigned long data)643static void int_in_resubmit(struct timer_list *t)
643{644{
644 struct cardstate *cs = (struct cardstate *) data;645 struct bas_cardstate *ucs = from_timer(ucs, t, timer_int_in);
645 struct bas_cardstate *ucs = cs->hw.bas;646 struct cardstate *cs = ucs->cs;
646 int rc;647 int rc;
647 648
648 if (ucs->retry_int_in++ >= BAS_RETRY) {649 if (ucs->retry_int_in++ >= BAS_RETRY) {
@@ -1441,10 +1442,10 @@ error: · 792 unmodified lines
1441 * argument:1442 * argument:
1442 * controller state structure1443 * controller state structure
1443 */1444 */
1444static void req_timeout(unsigned long data)1445static void req_timeout(struct timer_list *t)
1445{1446{
1446 struct cardstate *cs = (struct cardstate *) data;1447 struct bas_cardstate *ucs = from_timer(ucs, t, timer_ctrl);
1447 struct bas_cardstate *ucs = cs->hw.bas;1448 struct cardstate *cs = ucs->cs;
1448 int pending;1449 int pending;
1449 unsigned long flags;1450 unsigned long flags;
1450 1451
@@ -1837,10 +1838,10 @@ static void write_command_callback(struct urb *urb) · 386 unmodified lines
1837 * argument:1838 * argument:
1838 * controller state structure1839 * controller state structure
1839 */1840 */
1840static void atrdy_timeout(unsigned long data)1841static void atrdy_timeout(struct timer_list *t)
1841{1842{
1842 struct cardstate *cs = (struct cardstate *) data;1843 struct bas_cardstate *ucs = from_timer(ucs, t, timer_atrdy);
1843 struct bas_cardstate *ucs = cs->hw.bas;1844 struct cardstate *cs = ucs->cs;
1844 1845
1845 dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");1846 dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");
1846 1847
@@ -2200,7 +2201,7 @@ static int gigaset_initcshw(struct cardstate *cs) · 353 unmodified lines
2200{2201{
2201 struct bas_cardstate *ucs;2202 struct bas_cardstate *ucs;
2202 2203
2203 cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL);2204 cs->hw.bas = ucs = kzalloc(sizeof(*ucs), GFP_KERNEL);
2204 if (!ucs) {2205 if (!ucs) {
2205 pr_err("out of memory\n");2206 pr_err("out of memory\n");
2206 return -ENOMEM;2207 return -ENOMEM;
@@ -2212,19 +2213,12 @@ static int gigaset_initcshw(struct cardstate *cs) · 5 unmodified lines
2212 return -ENOMEM;2213 return -ENOMEM;
2213 }2214 }
2214 2215
2215 ucs->urb_cmd_in = NULL;
2216 ucs->urb_cmd_out = NULL;
2217 ucs->rcvbuf = NULL;
2218 ucs->rcvbuf_size = 0;
2219
2220 spin_lock_init(&ucs->lock);2216 spin_lock_init(&ucs->lock);
2221 ucs->pending = 0;2217 ucs->cs = cs;
2222 2218 timer_setup(&ucs->timer_ctrl, req_timeout, 0);
2223 ucs->basstate = 0;2219 timer_setup(&ucs->timer_atrdy, atrdy_timeout, 0);
2224 setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);2220 timer_setup(&ucs->timer_cmd_in, cmd_in_timeout, 0);
2225 setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);2221 timer_setup(&ucs->timer_int_in, int_in_resubmit, 0);
2226 setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);
2227 setup_timer(&ucs->timer_int_in, int_in_resubmit, (unsigned long) cs);
2228 init_waitqueue_head(&ucs->waitqueue);2222 init_waitqueue_head(&ucs->waitqueue);
2229 INIT_WORK(&ucs->int_in_wq, int_in_work);2223 INIT_WORK(&ucs->int_in_wq, int_in_work);
2230 2224
drivers/isdn/gigaset/common.c+3−4
@@ -153,9 +153,9 @@ static int test_timeout(struct at_state_t *at_state) · 152 unmodified lines
153 return 1;153 return 1;
154}154}
155 155
156static void timer_tick(unsigned long data)156static void timer_tick(struct timer_list *t)
157{157{
158 struct cardstate *cs = (struct cardstate *) data;158 struct cardstate *cs = from_timer(cs, t, timer);
159 unsigned long flags;159 unsigned long flags;
160 unsigned channel;160 unsigned channel;
161 struct at_state_t *at_state;161 struct at_state_t *at_state;
@@ -687,7 +687,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, · 525 unmodified lines
687 cs->ignoreframes = ignoreframes;687 cs->ignoreframes = ignoreframes;
688 INIT_LIST_HEAD(&cs->temp_at_states);688 INIT_LIST_HEAD(&cs->temp_at_states);
689 cs->running = 0;689 cs->running = 0;
690 init_timer(&cs->timer); /* clear next & prev */690 timer_setup(&cs->timer, timer_tick, 0);
691 spin_lock_init(&cs->ev_lock);691 spin_lock_init(&cs->ev_lock);
692 cs->ev_tail = 0;692 cs->ev_tail = 0;
693 cs->ev_head = 0;693 cs->ev_head = 0;
@@ -768,7 +768,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, · 74 unmodified lines
768 spin_lock_irqsave(&cs->lock, flags);768 spin_lock_irqsave(&cs->lock, flags);
769 cs->running = 1;769 cs->running = 1;
770 spin_unlock_irqrestore(&cs->lock, flags);770 spin_unlock_irqrestore(&cs->lock, flags);
771 setup_timer(&cs->timer, timer_tick, (unsigned long) cs);
772 cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK);771 cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK);
773 add_timer(&cs->timer);772 add_timer(&cs->timer);
774 773
drivers/isdn/hardware/eicon/message.c+58−12
@@ -4501,6 +4501,7 @@ static void control_rc(PLCI *plci, byte req, byte rc, byte ch, byte global_req, · 4500 unmodified lines
4501 plci->channels++;4501 plci->channels++;
4502 a->ncci_state[ncci] = OUTG_CON_PENDING;4502 a->ncci_state[ncci] = OUTG_CON_PENDING;
4503 }4503 }
4504 /* fall through */
4504 4505
4505 default:4506 default:
4506 if (plci->internal_command_queue[0])4507 if (plci->internal_command_queue[0])
@@ -7020,6 +7021,7 @@ static void nl_ind(PLCI *plci) · 2513 unmodified lines
7020 plci->NL.RNum = 1;7021 plci->NL.RNum = 1;
7021 return;7022 return;
7022 }7023 }
7024 /* fall through */
7023 case N_BDATA:7025 case N_BDATA:
7024 case N_DATA:7026 case N_DATA:
7025 if (((a->ncci_state[ncci] != CONNECTED) && (plci->B2_prot == 1)) /* transparent */7027 if (((a->ncci_state[ncci] != CONNECTED) && (plci->B2_prot == 1)) /* transparent */
@@ -9626,9 +9628,9 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 2600 unmodified lines
9626 {9628 {
9627 9629
9628 case DTMF_LISTEN_TONE_START:9630 case DTMF_LISTEN_TONE_START:
9629 mask <<= 1;9631 mask <<= 1; /* fall through */
9630 case DTMF_LISTEN_MF_START:9632 case DTMF_LISTEN_MF_START:
9631 mask <<= 1;9633 mask <<= 1; /* fall through */
9632 9634
9633 case DTMF_LISTEN_START:9635 case DTMF_LISTEN_START:
9634 switch (internal_command)9636 switch (internal_command)
@@ -9636,6 +9638,7 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 1 unmodified line
9636 default:9638 default:
9637 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |9639 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |
9638 B1_FACILITY_DTMFR), DTMF_COMMAND_1);9640 B1_FACILITY_DTMFR), DTMF_COMMAND_1);
9641 /* fall through */
9639 case DTMF_COMMAND_1:9642 case DTMF_COMMAND_1:
9640 if (adjust_b_process(Id, plci, Rc) != GOOD)9643 if (adjust_b_process(Id, plci, Rc) != GOOD)
9641 {9644 {
@@ -9646,6 +9649,7 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
9646 }9649 }
9647 if (plci->internal_command)9650 if (plci->internal_command)
9648 return;9651 return;
9652 /* fall through */
9649 case DTMF_COMMAND_2:9653 case DTMF_COMMAND_2:
9650 if (plci_nl_busy(plci))9654 if (plci_nl_busy(plci))
9651 {9655 {
@@ -9673,9 +9677,9 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 21 unmodified lines
9673 9677
9674 9678
9675 case DTMF_LISTEN_TONE_STOP:9679 case DTMF_LISTEN_TONE_STOP:
9676 mask <<= 1;9680 mask <<= 1; /* fall through */
9677 case DTMF_LISTEN_MF_STOP:9681 case DTMF_LISTEN_MF_STOP:
9678 mask <<= 1;9682 mask <<= 1; /* fall through */
9679 9683
9680 case DTMF_LISTEN_STOP:9684 case DTMF_LISTEN_STOP:
9681 switch (internal_command)9685 switch (internal_command)
@@ -9710,6 +9714,7 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 28 unmodified lines
9710*/9714*/
9711 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities &9715 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities &
9712 ~(B1_FACILITY_DTMFX | B1_FACILITY_DTMFR)), DTMF_COMMAND_3);9716 ~(B1_FACILITY_DTMFX | B1_FACILITY_DTMFR)), DTMF_COMMAND_3);
9717 /* fall through */
9713 case DTMF_COMMAND_3:9718 case DTMF_COMMAND_3:
9714 if (adjust_b_process(Id, plci, Rc) != GOOD)9719 if (adjust_b_process(Id, plci, Rc) != GOOD)
9715 {9720 {
@@ -9726,9 +9731,9 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 10 unmodified lines
9726 9731
9727 9732
9728 case DTMF_SEND_TONE:9733 case DTMF_SEND_TONE:
9729 mask <<= 1;9734 mask <<= 1; /* fall through */
9730 case DTMF_SEND_MF:9735 case DTMF_SEND_MF:
9731 mask <<= 1;9736 mask <<= 1; /* fall through */
9732 9737
9733 case DTMF_DIGITS_SEND:9738 case DTMF_DIGITS_SEND:
9734 switch (internal_command)9739 switch (internal_command)
@@ -9737,6 +9742,7 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 2 unmodified lines
9737 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |9742 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |
9738 ((plci->dtmf_parameter_length != 0) ? B1_FACILITY_DTMFX | B1_FACILITY_DTMFR : B1_FACILITY_DTMFX)),9743 ((plci->dtmf_parameter_length != 0) ? B1_FACILITY_DTMFX | B1_FACILITY_DTMFR : B1_FACILITY_DTMFX)),
9739 DTMF_COMMAND_1);9744 DTMF_COMMAND_1);
9745 /* fall through */
9740 case DTMF_COMMAND_1:9746 case DTMF_COMMAND_1:
9741 if (adjust_b_process(Id, plci, Rc) != GOOD)9747 if (adjust_b_process(Id, plci, Rc) != GOOD)
9742 {9748 {
@@ -9747,6 +9753,7 @@ static void dtmf_command(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
9747 }9753 }
9748 if (plci->internal_command)9754 if (plci->internal_command)
9749 return;9755 return;
9756 /* fall through */
9750 case DTMF_COMMAND_2:9757 case DTMF_COMMAND_2:
9751 if (plci_nl_busy(plci))9758 if (plci_nl_busy(plci))
9752 {9759 {
@@ -9863,7 +9870,7 @@ static byte dtmf_request(dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI *plci · 110 unmodified lines
9863 9870
9864 case DTMF_LISTEN_TONE_START:9871 case DTMF_LISTEN_TONE_START:
9865 case DTMF_LISTEN_TONE_STOP:9872 case DTMF_LISTEN_TONE_STOP:
9866 mask <<= 1;9873 mask <<= 1; /* fall through */
9867 case DTMF_LISTEN_MF_START:9874 case DTMF_LISTEN_MF_START:
9868 case DTMF_LISTEN_MF_STOP:9875 case DTMF_LISTEN_MF_STOP:
9869 mask <<= 1;9876 mask <<= 1;
@@ -9875,6 +9882,7 @@ static byte dtmf_request(dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI *plci · 5 unmodified lines
9875 PUT_WORD(&result[1], DTMF_UNKNOWN_REQUEST);9882 PUT_WORD(&result[1], DTMF_UNKNOWN_REQUEST);
9876 break;9883 break;
9877 }9884 }
9885 /* fall through */
9878 9886
9879 case DTMF_LISTEN_START:9887 case DTMF_LISTEN_START:
9880 case DTMF_LISTEN_STOP:9888 case DTMF_LISTEN_STOP:
@@ -9904,7 +9912,7 @@ static byte dtmf_request(dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI *plci · 23 unmodified lines
9904 9912
9905 9913
9906 case DTMF_SEND_TONE:9914 case DTMF_SEND_TONE:
9907 mask <<= 1;9915 mask <<= 1; /* fall through */
9908 case DTMF_SEND_MF:9916 case DTMF_SEND_MF:
9909 mask <<= 1;9917 mask <<= 1;
9910 if (!((plci->requested_options_conn | plci->requested_options | plci->adapter->requested_options_table[appl->Id - 1])9918 if (!((plci->requested_options_conn | plci->requested_options | plci->adapter->requested_options_table[appl->Id - 1])
@@ -9915,6 +9923,7 @@ static byte dtmf_request(dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI *plci · 4 unmodified lines
9915 PUT_WORD(&result[1], DTMF_UNKNOWN_REQUEST);9923 PUT_WORD(&result[1], DTMF_UNKNOWN_REQUEST);
9916 break;9924 break;
9917 }9925 }
9926 /* fall through */
9918 9927
9919 case DTMF_DIGITS_SEND:9928 case DTMF_DIGITS_SEND:
9920 if (api_parse(&msg[1].info[1], msg[1].length, "wwws", dtmf_parms))9929 if (api_parse(&msg[1].info[1], msg[1].length, "wwws", dtmf_parms))
@@ -11315,6 +11324,7 @@ static word mixer_restore_config(dword Id, PLCI *plci, byte Rc) · 1394 unmodified lines
11315 }11324 }
11316 plci->adjust_b_state = ADJUST_B_RESTORE_MIXER_5;11325 plci->adjust_b_state = ADJUST_B_RESTORE_MIXER_5;
11317 Rc = OK;11326 Rc = OK;
11327 /* fall through */
11318 case ADJUST_B_RESTORE_MIXER_2:11328 case ADJUST_B_RESTORE_MIXER_2:
11319 case ADJUST_B_RESTORE_MIXER_3:11329 case ADJUST_B_RESTORE_MIXER_3:
11320 case ADJUST_B_RESTORE_MIXER_4:11330 case ADJUST_B_RESTORE_MIXER_4:
@@ -11344,10 +11354,12 @@ static word mixer_restore_config(dword Id, PLCI *plci, byte Rc) · 23 unmodified lines
11344 plci->internal_command = plci->adjust_b_command;11354 plci->internal_command = plci->adjust_b_command;
11345 break;11355 break;
11346 }11356 }
11357 /* fall through */
11347 case ADJUST_B_RESTORE_MIXER_5:11358 case ADJUST_B_RESTORE_MIXER_5:
11348 xconnect_write_coefs(plci, plci->adjust_b_command);11359 xconnect_write_coefs(plci, plci->adjust_b_command);
11349 plci->adjust_b_state = ADJUST_B_RESTORE_MIXER_6;11360 plci->adjust_b_state = ADJUST_B_RESTORE_MIXER_6;
11350 Rc = OK;11361 Rc = OK;
11362 /* fall through */
11351 case ADJUST_B_RESTORE_MIXER_6:11363 case ADJUST_B_RESTORE_MIXER_6:
11352 if (!xconnect_write_coefs_process(Id, plci, Rc))11364 if (!xconnect_write_coefs_process(Id, plci, Rc))
11353 {11365 {
@@ -11392,6 +11404,7 @@ static void mixer_command(dword Id, PLCI *plci, byte Rc) · 38 unmodified lines
11392 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |11404 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |
11393 B1_FACILITY_MIXER), MIXER_COMMAND_1);11405 B1_FACILITY_MIXER), MIXER_COMMAND_1);
11394 }11406 }
11407 /* fall through */
11395 case MIXER_COMMAND_1:11408 case MIXER_COMMAND_1:
11396 if (plci->li_channel_bits & LI_CHANNEL_INVOLVED)11409 if (plci->li_channel_bits & LI_CHANNEL_INVOLVED)
11397 {11410 {
@@ -11419,6 +11432,7 @@ static void mixer_command(dword Id, PLCI *plci, byte Rc) · 21 unmodified lines
11419 mixer_indication_coefs_set(Id, plci);11432 mixer_indication_coefs_set(Id, plci);
11420 } while (plci->li_plci_b_read_pos != plci->li_plci_b_req_pos);11433 } while (plci->li_plci_b_read_pos != plci->li_plci_b_req_pos);
11421 }11434 }
11435 /* fall through */
11422 case MIXER_COMMAND_2:11436 case MIXER_COMMAND_2:
11423 if ((plci->li_channel_bits & LI_CHANNEL_INVOLVED)11437 if ((plci->li_channel_bits & LI_CHANNEL_INVOLVED)
11424 || ((get_b1_facilities(plci, plci->B1_resource) & B1_FACILITY_MIXER)11438 || ((get_b1_facilities(plci, plci->B1_resource) & B1_FACILITY_MIXER)
@@ -11450,6 +11464,7 @@ static void mixer_command(dword Id, PLCI *plci, byte Rc) · 25 unmodified lines
11450 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities &11464 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities &
11451 ~B1_FACILITY_MIXER), MIXER_COMMAND_3);11465 ~B1_FACILITY_MIXER), MIXER_COMMAND_3);
11452 }11466 }
11467 /* fall through */
11453 case MIXER_COMMAND_3:11468 case MIXER_COMMAND_3:
11454 if (!(plci->li_channel_bits & LI_CHANNEL_INVOLVED))11469 if (!(plci->li_channel_bits & LI_CHANNEL_INVOLVED))
11455 {11470 {
@@ -12602,6 +12617,7 @@ static void ec_command(dword Id, PLCI *plci, byte Rc) · 1146 unmodified lines
12602 default:12617 default:
12603 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |12618 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities |
12604 B1_FACILITY_EC), EC_COMMAND_1);12619 B1_FACILITY_EC), EC_COMMAND_1);
12620 /* fall through */
12605 case EC_COMMAND_1:12621 case EC_COMMAND_1:
12606 if (adjust_b_process(Id, plci, Rc) != GOOD)12622 if (adjust_b_process(Id, plci, Rc) != GOOD)
12607 {12623 {
@@ -12612,6 +12628,7 @@ static void ec_command(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
12612 }12628 }
12613 if (plci->internal_command)12629 if (plci->internal_command)
12614 return;12630 return;
12631 /* fall through */
12615 case EC_COMMAND_2:12632 case EC_COMMAND_2:
12616 if (plci->sig_req)12633 if (plci->sig_req)
12617 {12634 {
@@ -12650,6 +12667,7 @@ static void ec_command(dword Id, PLCI *plci, byte Rc) · 32 unmodified lines
12650 return;12667 return;
12651 }12668 }
12652 Rc = OK;12669 Rc = OK;
12670 /* fall through */
12653 case EC_COMMAND_2:12671 case EC_COMMAND_2:
12654 if ((Rc != OK) && (Rc != OK_FC))12672 if ((Rc != OK) && (Rc != OK_FC))
12655 {12673 {
@@ -12660,6 +12678,7 @@ static void ec_command(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
12660 }12678 }
12661 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities &12679 adjust_b1_resource(Id, plci, NULL, (word)(plci->B1_facilities &
12662 ~B1_FACILITY_EC), EC_COMMAND_3);12680 ~B1_FACILITY_EC), EC_COMMAND_3);
12681 /* fall through */
12663 case EC_COMMAND_3:12682 case EC_COMMAND_3:
12664 if (adjust_b_process(Id, plci, Rc) != GOOD)12683 if (adjust_b_process(Id, plci, Rc) != GOOD)
12665 {12684 {
@@ -13485,6 +13504,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 819 unmodified lines
13485 }13504 }
13486 plci->adjust_b_state = ADJUST_B_SAVE_MIXER_1;13505 plci->adjust_b_state = ADJUST_B_SAVE_MIXER_1;
13487 Rc = OK;13506 Rc = OK;
13507 /* fall through */
13488 case ADJUST_B_SAVE_MIXER_1:13508 case ADJUST_B_SAVE_MIXER_1:
13489 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)13509 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)
13490 {13510 {
@@ -13496,6 +13516,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 5 unmodified lines
13496 }13516 }
13497 plci->adjust_b_state = ADJUST_B_SAVE_DTMF_1;13517 plci->adjust_b_state = ADJUST_B_SAVE_DTMF_1;
13498 Rc = OK;13518 Rc = OK;
13519 /* fall through */
13499 case ADJUST_B_SAVE_DTMF_1:13520 case ADJUST_B_SAVE_DTMF_1:
13500 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)13521 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)
13501 {13522 {
@@ -13506,6 +13527,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
13506 13527
13507 }13528 }
13508 plci->adjust_b_state = ADJUST_B_REMOVE_L23_1;13529 plci->adjust_b_state = ADJUST_B_REMOVE_L23_1;
13530 /* fall through */
13509 case ADJUST_B_REMOVE_L23_1:13531 case ADJUST_B_REMOVE_L23_1:
13510 if ((plci->adjust_b_mode & ADJUST_B_MODE_REMOVE_L23)13532 if ((plci->adjust_b_mode & ADJUST_B_MODE_REMOVE_L23)
13511 && plci->NL.Id && !plci->nl_remove_id)13533 && plci->NL.Id && !plci->nl_remove_id)
@@ -13530,6 +13552,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 18 unmodified lines
13530 }13552 }
13531 plci->adjust_b_state = ADJUST_B_REMOVE_L23_2;13553 plci->adjust_b_state = ADJUST_B_REMOVE_L23_2;
13532 Rc = OK;13554 Rc = OK;
13555 /* fall through */
13533 case ADJUST_B_REMOVE_L23_2:13556 case ADJUST_B_REMOVE_L23_2:
13534 if ((Rc != OK) && (Rc != OK_FC))13557 if ((Rc != OK) && (Rc != OK_FC))
13535 {13558 {
@@ -13548,6 +13571,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 12 unmodified lines
13548 }13571 }
13549 plci->adjust_b_state = ADJUST_B_SAVE_EC_1;13572 plci->adjust_b_state = ADJUST_B_SAVE_EC_1;
13550 Rc = OK;13573 Rc = OK;
13574 /* fall through */
13551 case ADJUST_B_SAVE_EC_1:13575 case ADJUST_B_SAVE_EC_1:
13552 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)13576 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)
13553 {13577 {
@@ -13559,6 +13583,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 5 unmodified lines
13559 }13583 }
13560 plci->adjust_b_state = ADJUST_B_SAVE_DTMF_PARAMETER_1;13584 plci->adjust_b_state = ADJUST_B_SAVE_DTMF_PARAMETER_1;
13561 Rc = OK;13585 Rc = OK;
13586 /* fall through */
13562 case ADJUST_B_SAVE_DTMF_PARAMETER_1:13587 case ADJUST_B_SAVE_DTMF_PARAMETER_1:
13563 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)13588 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)
13564 {13589 {
@@ -13570,6 +13595,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 5 unmodified lines
13570 }13595 }
13571 plci->adjust_b_state = ADJUST_B_SAVE_VOICE_1;13596 plci->adjust_b_state = ADJUST_B_SAVE_VOICE_1;
13572 Rc = OK;13597 Rc = OK;
13598 /* fall through */
13573 case ADJUST_B_SAVE_VOICE_1:13599 case ADJUST_B_SAVE_VOICE_1:
13574 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)13600 if (plci->adjust_b_mode & ADJUST_B_MODE_SAVE)
13575 {13601 {
@@ -13578,6 +13604,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 2 unmodified lines
13578 break;13604 break;
13579 }13605 }
13580 plci->adjust_b_state = ADJUST_B_SWITCH_L1_1;13606 plci->adjust_b_state = ADJUST_B_SWITCH_L1_1;
13607 /* fall through */
13581 case ADJUST_B_SWITCH_L1_1:13608 case ADJUST_B_SWITCH_L1_1:
13582 if (plci->adjust_b_mode & ADJUST_B_MODE_SWITCH_L1)13609 if (plci->adjust_b_mode & ADJUST_B_MODE_SWITCH_L1)
13583 {13610 {
@@ -13608,6 +13635,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 24 unmodified lines
13608 }13635 }
13609 plci->adjust_b_state = ADJUST_B_SWITCH_L1_2;13636 plci->adjust_b_state = ADJUST_B_SWITCH_L1_2;
13610 Rc = OK;13637 Rc = OK;
13638 /* fall through */
13611 case ADJUST_B_SWITCH_L1_2:13639 case ADJUST_B_SWITCH_L1_2:
13612 if ((Rc != OK) && (Rc != OK_FC))13640 if ((Rc != OK) && (Rc != OK_FC))
13613 {13641 {
@@ -13619,6 +13647,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 5 unmodified lines
13619 }13647 }
13620 plci->adjust_b_state = ADJUST_B_RESTORE_VOICE_1;13648 plci->adjust_b_state = ADJUST_B_RESTORE_VOICE_1;
13621 Rc = OK;13649 Rc = OK;
13650 /* fall through */
13622 case ADJUST_B_RESTORE_VOICE_1:13651 case ADJUST_B_RESTORE_VOICE_1:
13623 case ADJUST_B_RESTORE_VOICE_2:13652 case ADJUST_B_RESTORE_VOICE_2:
13624 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)13653 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)
@@ -13629,6 +13658,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
13629 }13658 }
13630 plci->adjust_b_state = ADJUST_B_RESTORE_DTMF_PARAMETER_1;13659 plci->adjust_b_state = ADJUST_B_RESTORE_DTMF_PARAMETER_1;
13631 Rc = OK;13660 Rc = OK;
13661 /* fall through */
13632 case ADJUST_B_RESTORE_DTMF_PARAMETER_1:13662 case ADJUST_B_RESTORE_DTMF_PARAMETER_1:
13633 case ADJUST_B_RESTORE_DTMF_PARAMETER_2:13663 case ADJUST_B_RESTORE_DTMF_PARAMETER_2:
13634 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)13664 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)
@@ -13641,6 +13671,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 6 unmodified lines
13641 }13671 }
13642 plci->adjust_b_state = ADJUST_B_RESTORE_EC_1;13672 plci->adjust_b_state = ADJUST_B_RESTORE_EC_1;
13643 Rc = OK;13673 Rc = OK;
13674 /* fall through */
13644 case ADJUST_B_RESTORE_EC_1:13675 case ADJUST_B_RESTORE_EC_1:
13645 case ADJUST_B_RESTORE_EC_2:13676 case ADJUST_B_RESTORE_EC_2:
13646 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)13677 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)
@@ -13652,6 +13683,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 5 unmodified lines
13652 13683
13653 }13684 }
13654 plci->adjust_b_state = ADJUST_B_ASSIGN_L23_1;13685 plci->adjust_b_state = ADJUST_B_ASSIGN_L23_1;
13686 /* fall through */
13655 case ADJUST_B_ASSIGN_L23_1:13687 case ADJUST_B_ASSIGN_L23_1:
13656 if (plci->adjust_b_mode & ADJUST_B_MODE_ASSIGN_L23)13688 if (plci->adjust_b_mode & ADJUST_B_MODE_ASSIGN_L23)
13657 {13689 {
@@ -13681,6 +13713,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 23 unmodified lines
13681 }13713 }
13682 plci->adjust_b_state = ADJUST_B_ASSIGN_L23_2;13714 plci->adjust_b_state = ADJUST_B_ASSIGN_L23_2;
13683 Rc = ASSIGN_OK;13715 Rc = ASSIGN_OK;
13716 /* fall through */
13684 case ADJUST_B_ASSIGN_L23_2:13717 case ADJUST_B_ASSIGN_L23_2:
13685 if ((Rc != OK) && (Rc != OK_FC) && (Rc != ASSIGN_OK))13718 if ((Rc != OK) && (Rc != OK_FC) && (Rc != ASSIGN_OK))
13686 {13719 {
@@ -13703,6 +13736,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 16 unmodified lines
13703 break;13736 break;
13704 }13737 }
13705 plci->adjust_b_state = ADJUST_B_CONNECT_1;13738 plci->adjust_b_state = ADJUST_B_CONNECT_1;
13739 /* fall through */
13706 case ADJUST_B_CONNECT_1:13740 case ADJUST_B_CONNECT_1:
13707 if (plci->adjust_b_mode & ADJUST_B_MODE_CONNECT)13741 if (plci->adjust_b_mode & ADJUST_B_MODE_CONNECT)
13708 {13742 {
@@ -13716,6 +13750,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 7 unmodified lines
13716 }13750 }
13717 plci->adjust_b_state = ADJUST_B_RESTORE_DTMF_1;13751 plci->adjust_b_state = ADJUST_B_RESTORE_DTMF_1;
13718 Rc = OK;13752 Rc = OK;
13753 /* fall through */
13719 case ADJUST_B_CONNECT_2:13754 case ADJUST_B_CONNECT_2:
13720 case ADJUST_B_CONNECT_3:13755 case ADJUST_B_CONNECT_3:
13721 case ADJUST_B_CONNECT_4:13756 case ADJUST_B_CONNECT_4:
@@ -13751,6 +13786,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 29 unmodified lines
13751 break;13786 break;
13752 }13787 }
13753 Rc = OK;13788 Rc = OK;
13789 /* fall through */
13754 case ADJUST_B_RESTORE_DTMF_1:13790 case ADJUST_B_RESTORE_DTMF_1:
13755 case ADJUST_B_RESTORE_DTMF_2:13791 case ADJUST_B_RESTORE_DTMF_2:
13756 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)13792 if (plci->adjust_b_mode & ADJUST_B_MODE_RESTORE)
@@ -13763,6 +13799,7 @@ static word adjust_b_process(dword Id, PLCI *plci, byte Rc) · 6 unmodified lines
13763 }13799 }
13764 plci->adjust_b_state = ADJUST_B_RESTORE_MIXER_1;13800 plci->adjust_b_state = ADJUST_B_RESTORE_MIXER_1;
13765 Rc = OK;13801 Rc = OK;
13802 /* fall through */
13766 case ADJUST_B_RESTORE_MIXER_1:13803 case ADJUST_B_RESTORE_MIXER_1:
13767 case ADJUST_B_RESTORE_MIXER_2:13804 case ADJUST_B_RESTORE_MIXER_2:
13768 case ADJUST_B_RESTORE_MIXER_3:13805 case ADJUST_B_RESTORE_MIXER_3:
@@ -13827,6 +13864,7 @@ static void adjust_b_restore(dword Id, PLCI *plci, byte Rc) · 58 unmodified lines
13827 break;13864 break;
13828 }13865 }
13829 Rc = OK;13866 Rc = OK;
13867 /* fall through */
13830 case ADJUST_B_RESTORE_1:13868 case ADJUST_B_RESTORE_1:
13831 if ((Rc != OK) && (Rc != OK_FC))13869 if ((Rc != OK) && (Rc != OK_FC))
13832 {13870 {
@@ -13841,6 +13879,7 @@ static void adjust_b_restore(dword Id, PLCI *plci, byte Rc) · 8 unmodified lines
13841 plci->adjust_b_state = ADJUST_B_START;13879 plci->adjust_b_state = ADJUST_B_START;
13842 dbug(1, dprintf("[%06lx] %s,%d: Adjust B restore...",13880 dbug(1, dprintf("[%06lx] %s,%d: Adjust B restore...",
13843 UnMapId(Id), (char *)(FILE_), __LINE__));13881 UnMapId(Id), (char *)(FILE_), __LINE__));
13882 /* fall through */
13844 case ADJUST_B_RESTORE_2:13883 case ADJUST_B_RESTORE_2:
13845 if (adjust_b_process(Id, plci, Rc) != GOOD)13884 if (adjust_b_process(Id, plci, Rc) != GOOD)
13846 {13885 {
@@ -13877,6 +13916,7 @@ static void reset_b3_command(dword Id, PLCI *plci, byte Rc) · 30 unmodified lines
13877 plci->adjust_b_state = ADJUST_B_START;13916 plci->adjust_b_state = ADJUST_B_START;
13878 dbug(1, dprintf("[%06lx] %s,%d: Reset B3...",13917 dbug(1, dprintf("[%06lx] %s,%d: Reset B3...",
13879 UnMapId(Id), (char *)(FILE_), __LINE__));13918 UnMapId(Id), (char *)(FILE_), __LINE__));
13919 /* fall through */
13880 case RESET_B3_COMMAND_1:13920 case RESET_B3_COMMAND_1:
13881 Info = adjust_b_process(Id, plci, Rc);13921 Info = adjust_b_process(Id, plci, Rc);
13882 if (Info != GOOD)13922 if (Info != GOOD)
@@ -13930,6 +13970,7 @@ static void select_b_command(dword Id, PLCI *plci, byte Rc) · 47 unmodified lines
13930 plci->adjust_b_state = ADJUST_B_START;13970 plci->adjust_b_state = ADJUST_B_START;
13931 dbug(1, dprintf("[%06lx] %s,%d: Select B protocol...",13971 dbug(1, dprintf("[%06lx] %s,%d: Select B protocol...",
13932 UnMapId(Id), (char *)(FILE_), __LINE__));13972 UnMapId(Id), (char *)(FILE_), __LINE__));
13973 /* fall through */
13933 case SELECT_B_COMMAND_1:13974 case SELECT_B_COMMAND_1:
13934 Info = adjust_b_process(Id, plci, Rc);13975 Info = adjust_b_process(Id, plci, Rc);
13935 if (Info != GOOD)13976 if (Info != GOOD)
@@ -13965,7 +14006,7 @@ static void fax_connect_ack_command(dword Id, PLCI *plci, byte Rc) · 29 unmodified lines
13965 switch (internal_command)14006 switch (internal_command)
13966 {14007 {
13967 default:14008 default:
13968 plci->command = 0;14009 plci->command = 0; /* fall through */
13969 case FAX_CONNECT_ACK_COMMAND_1:14010 case FAX_CONNECT_ACK_COMMAND_1:
13970 if (plci_nl_busy(plci))14011 if (plci_nl_busy(plci))
13971 {14012 {
@@ -14013,6 +14054,7 @@ static void fax_edata_ack_command(dword Id, PLCI *plci, byte Rc) · 41 unmodified lines
14013 {14054 {
14014 default:14055 default:
14015 plci->command = 0;14056 plci->command = 0;
14057 /* fall through */
14016 case FAX_EDATA_ACK_COMMAND_1:14058 case FAX_EDATA_ACK_COMMAND_1:
14017 if (plci_nl_busy(plci))14059 if (plci_nl_busy(plci))
14018 {14060 {
@@ -14052,7 +14094,7 @@ static void fax_connect_info_command(dword Id, PLCI *plci, byte Rc) · 33 unmodified lines
14052 switch (internal_command)14094 switch (internal_command)
14053 {14095 {
14054 default:14096 default:
14055 plci->command = 0;14097 plci->command = 0; /* fall through */
14056 case FAX_CONNECT_INFO_COMMAND_1:14098 case FAX_CONNECT_INFO_COMMAND_1:
14057 if (plci_nl_busy(plci))14099 if (plci_nl_busy(plci))
14058 {14100 {
@@ -14112,6 +14154,7 @@ static void fax_adjust_b23_command(dword Id, PLCI *plci, byte Rc) · 53 unmodified lines
14112 plci->adjust_b_state = ADJUST_B_START;14154 plci->adjust_b_state = ADJUST_B_START;
14113 dbug(1, dprintf("[%06lx] %s,%d: FAX adjust B23...",14155 dbug(1, dprintf("[%06lx] %s,%d: FAX adjust B23...",
14114 UnMapId(Id), (char *)(FILE_), __LINE__));14156 UnMapId(Id), (char *)(FILE_), __LINE__));
14157 /* fall through */
14115 case FAX_ADJUST_B23_COMMAND_1:14158 case FAX_ADJUST_B23_COMMAND_1:
14116 Info = adjust_b_process(Id, plci, Rc);14159 Info = adjust_b_process(Id, plci, Rc);
14117 if (Info != GOOD)14160 if (Info != GOOD)
@@ -14122,6 +14165,7 @@ static void fax_adjust_b23_command(dword Id, PLCI *plci, byte Rc) · 4 unmodified lines
14122 }14165 }
14123 if (plci->internal_command)14166 if (plci->internal_command)
14124 return;14167 return;
14168 /* fall through */
14125 case FAX_ADJUST_B23_COMMAND_2:14169 case FAX_ADJUST_B23_COMMAND_2:
14126 if (plci_nl_busy(plci))14170 if (plci_nl_busy(plci))
14127 {14171 {
@@ -14194,7 +14238,7 @@ static void rtp_connect_b3_req_command(dword Id, PLCI *plci, byte Rc) · 66 unmodified lines
14194 switch (internal_command)14238 switch (internal_command)
14195 {14239 {
14196 default:14240 default:
14197 plci->command = 0;14241 plci->command = 0; /* fall through */
14198 case RTP_CONNECT_B3_REQ_COMMAND_1:14242 case RTP_CONNECT_B3_REQ_COMMAND_1:
14199 if (plci_nl_busy(plci))14243 if (plci_nl_busy(plci))
14200 {14244 {
@@ -14245,7 +14289,7 @@ static void rtp_connect_b3_res_command(dword Id, PLCI *plci, byte Rc) · 44 unmodified lines
14245 switch (internal_command)14289 switch (internal_command)
14246 {14290 {
14247 default:14291 default:
14248 plci->command = 0;14292 plci->command = 0; /* fall through */
14249 case RTP_CONNECT_B3_RES_COMMAND_1:14293 case RTP_CONNECT_B3_RES_COMMAND_1:
14250 if (plci_nl_busy(plci))14294 if (plci_nl_busy(plci))
14251 {14295 {
@@ -14310,6 +14354,7 @@ static void hold_save_command(dword Id, PLCI *plci, byte Rc) · 58 unmodified lines
14310 plci->adjust_b_state = ADJUST_B_START;14354 plci->adjust_b_state = ADJUST_B_START;
14311 dbug(1, dprintf("[%06lx] %s,%d: HOLD save...",14355 dbug(1, dprintf("[%06lx] %s,%d: HOLD save...",
14312 UnMapId(Id), (char *)(FILE_), __LINE__));14356 UnMapId(Id), (char *)(FILE_), __LINE__));
14357 /* fall through */
14313 case HOLD_SAVE_COMMAND_1:14358 case HOLD_SAVE_COMMAND_1:
14314 Info = adjust_b_process(Id, plci, Rc);14359 Info = adjust_b_process(Id, plci, Rc);
14315 if (Info != GOOD)14360 if (Info != GOOD)
@@ -14349,6 +14394,7 @@ static void retrieve_restore_command(dword Id, PLCI *plci, byte Rc) · 33 unmodified lines
14349 plci->adjust_b_state = ADJUST_B_START;14394 plci->adjust_b_state = ADJUST_B_START;
14350 dbug(1, dprintf("[%06lx] %s,%d: RETRIEVE restore...",14395 dbug(1, dprintf("[%06lx] %s,%d: RETRIEVE restore...",
14351 UnMapId(Id), (char *)(FILE_), __LINE__));14396 UnMapId(Id), (char *)(FILE_), __LINE__));
14397 /* fall through */
14352 case RETRIEVE_RESTORE_COMMAND_1:14398 case RETRIEVE_RESTORE_COMMAND_1:
14353 Info = adjust_b_process(Id, plci, Rc);14399 Info = adjust_b_process(Id, plci, Rc);
14354 if (Info != GOOD)14400 if (Info != GOOD)
drivers/isdn/hardware/mISDN/hfcpci.c+4−6
@@ -2265,7 +2265,7 @@ static struct pci_driver hfc_driver = { · 2264 unmodified lines
2265};2265};
2266 2266
2267static int2267static int
2268_hfcpci_softirq(struct device *dev, void *arg)2268_hfcpci_softirq(struct device *dev, void *unused)
2269{2269{
2270 struct hfc_pci *hc = dev_get_drvdata(dev);2270 struct hfc_pci *hc = dev_get_drvdata(dev);
2271 struct bchannel *bch;2271 struct bchannel *bch;
@@ -2290,9 +2290,9 @@ _hfcpci_softirq(struct device *dev, void *arg) · 18 unmodified lines
2290}2290}
2291 2291
2292static void2292static void
2293hfcpci_softirq(void *arg)2293hfcpci_softirq(struct timer_list *unused)
2294{2294{
2295 WARN_ON_ONCE(driver_for_each_device(&hfc_driver.driver, NULL, arg,2295 WARN_ON_ONCE(driver_for_each_device(&hfc_driver.driver, NULL, NULL,
2296 _hfcpci_softirq) != 0);2296 _hfcpci_softirq) != 0);
2297 2297
2298 /* if next event would be in the past ... */2298 /* if next event would be in the past ... */
@@ -2327,9 +2327,7 @@ HFC_init(void) · 28 unmodified lines
2327 if (poll != HFCPCI_BTRANS_THRESHOLD) {2327 if (poll != HFCPCI_BTRANS_THRESHOLD) {
2328 printk(KERN_INFO "%s: Using alternative poll value of %d\n",2328 printk(KERN_INFO "%s: Using alternative poll value of %d\n",
2329 __func__, poll);2329 __func__, poll);
2330 hfc_tl.function = (void *)hfcpci_softirq;2330 timer_setup(&hfc_tl, hfcpci_softirq, 0);
2331 hfc_tl.data = 0;
2332 init_timer(&hfc_tl);
2333 hfc_tl.expires = jiffies + tics;2331 hfc_tl.expires = jiffies + tics;
2334 hfc_jiffies = hfc_tl.expires;2332 hfc_jiffies = hfc_tl.expires;
2335 add_timer(&hfc_tl);2333 add_timer(&hfc_tl);
drivers/isdn/hardware/mISDN/mISDNipac.c+3−4
@@ -172,7 +172,6 @@ isac_fill_fifo(struct isac_hw *isac) · 171 unmodified lines
172 pr_debug("%s: %s dbusytimer running\n", isac->name, __func__);172 pr_debug("%s: %s dbusytimer running\n", isac->name, __func__);
173 del_timer(&isac->dch.timer);173 del_timer(&isac->dch.timer);
174 }174 }
175 init_timer(&isac->dch.timer);
176 isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);175 isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
177 add_timer(&isac->dch.timer);176 add_timer(&isac->dch.timer);
178 if (isac->dch.debug & DEBUG_HW_DFIFO) {177 if (isac->dch.debug & DEBUG_HW_DFIFO) {
@@ -727,8 +726,9 @@ isac_release(struct isac_hw *isac) · 548 unmodified lines
727}726}
728 727
729static void728static void
730dbusy_timer_handler(struct isac_hw *isac)729dbusy_timer_handler(struct timer_list *t)
731{730{
731 struct isac_hw *isac = from_timer(isac, t, dch.timer);
732 int rbch, star;732 int rbch, star;
733 u_long flags;733 u_long flags;
734 734
@@ -796,8 +796,7 @@ isac_init(struct isac_hw *isac) · 61 unmodified lines
796 }796 }
797 isac->mon_tx = NULL;797 isac->mon_tx = NULL;
798 isac->mon_rx = NULL;798 isac->mon_rx = NULL;
799 setup_timer(&isac->dch.timer, (void *)dbusy_timer_handler,799 timer_setup(&isac->dch.timer, dbusy_timer_handler, 0);
800 (long)isac);
801 isac->mocr = 0xaa;800 isac->mocr = 0xaa;
802 if (isac->type & IPAC_TYPE_ISACX) {801 if (isac->type & IPAC_TYPE_ISACX) {
803 /* Disable all IRQ */802 /* Disable all IRQ */
drivers/isdn/hardware/mISDN/w6692.c+3−4
@@ -311,7 +311,6 @@ W6692_fill_Dfifo(struct w6692_hw *card) · 310 unmodified lines
311 pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name);311 pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name);
312 del_timer(&dch->timer);312 del_timer(&dch->timer);
313 }313 }
314 init_timer(&dch->timer);
315 dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);314 dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
316 add_timer(&dch->timer);315 add_timer(&dch->timer);
317 if (debug & DEBUG_HW_DFIFO) {316 if (debug & DEBUG_HW_DFIFO) {
@@ -819,8 +818,9 @@ w6692_irq(int intno, void *dev_id) · 501 unmodified lines
819}818}
820 819
821static void820static void
822dbusy_timer_handler(struct dchannel *dch)821dbusy_timer_handler(struct timer_list *t)
823{822{
823 struct dchannel *dch = from_timer(dch, t, timer);
824 struct w6692_hw *card = dch->hw;824 struct w6692_hw *card = dch->hw;
825 int rbch, star;825 int rbch, star;
826 u_long flags;826 u_long flags;
@@ -852,8 +852,7 @@ static void initW6692(struct w6692_hw *card) · 25 unmodified lines
852{852{
853 u8 val;853 u8 val;
854 854
855 setup_timer(&card->dch.timer, (void *)dbusy_timer_handler,855 timer_setup(&card->dch.timer, dbusy_timer_handler, 0);
856 (u_long)&card->dch);
857 w6692_mode(&card->bc[0], ISDN_P_NONE);856 w6692_mode(&card->bc[0], ISDN_P_NONE);
858 w6692_mode(&card->bc[1], ISDN_P_NONE);857 w6692_mode(&card->bc[1], ISDN_P_NONE);
859 WriteW6692(card, W_D_CTL, 0x00);858 WriteW6692(card, W_D_CTL, 0x00);
drivers/isdn/hisax/amd7930_fn.c+3−3
@@ -398,7 +398,6 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs) · 397 unmodified lines
398 debugl1(cs, "Amd7930: fill_Dfifo dbusytimer running");398 debugl1(cs, "Amd7930: fill_Dfifo dbusytimer running");
399 del_timer(&cs->dbusytimer);399 del_timer(&cs->dbusytimer);
400 }400 }
401 init_timer(&cs->dbusytimer);
402 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);401 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
403 add_timer(&cs->dbusytimer);402 add_timer(&cs->dbusytimer);
404 403
@@ -686,8 +685,9 @@ DC_Close_Amd7930(struct IsdnCardState *cs) { · 281 unmodified lines
686 685
687 686
688static void687static void
689dbusy_timer_handler(struct IsdnCardState *cs)688dbusy_timer_handler(struct timer_list *t)
690{689{
690 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer);
691 u_long flags;691 u_long flags;
692 struct PStack *stptr;692 struct PStack *stptr;
693 WORD dtcr, der;693 WORD dtcr, der;
@@ -790,5 +790,5 @@ void Amd7930_init(struct IsdnCardState *cs) · 96 unmodified lines
790void setup_Amd7930(struct IsdnCardState *cs)790void setup_Amd7930(struct IsdnCardState *cs)
791{791{
792 INIT_WORK(&cs->tqueue, Amd7930_bh);792 INIT_WORK(&cs->tqueue, Amd7930_bh);
793 setup_timer(&cs->dbusytimer, (void *)dbusy_timer_handler, (long)cs);793 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0);
794}794}
drivers/isdn/hisax/arcofi.c+3−3
@@ -23,7 +23,6 @@ add_arcofi_timer(struct IsdnCardState *cs) { · 22 unmodified lines
23 if (test_and_set_bit(FLG_ARCOFI_TIMER, &cs->HW_Flags)) {23 if (test_and_set_bit(FLG_ARCOFI_TIMER, &cs->HW_Flags)) {
24 del_timer(&cs->dc.isac.arcofitimer);24 del_timer(&cs->dc.isac.arcofitimer);
25 }25 }
26 init_timer(&cs->dc.isac.arcofitimer);
27 cs->dc.isac.arcofitimer.expires = jiffies + ((ARCOFI_TIMER_VALUE * HZ) / 1000);26 cs->dc.isac.arcofitimer.expires = jiffies + ((ARCOFI_TIMER_VALUE * HZ) / 1000);
28 add_timer(&cs->dc.isac.arcofitimer);27 add_timer(&cs->dc.isac.arcofitimer);
29}28}
@@ -112,7 +111,8 @@ arcofi_fsm(struct IsdnCardState *cs, int event, void *data) { · 82 unmodified lines
112}111}
113 112
114static void113static void
115arcofi_timer(struct IsdnCardState *cs) {114arcofi_timer(struct timer_list *t) {
115 struct IsdnCardState *cs = from_timer(cs, t, dc.isac.arcofitimer);
116 arcofi_fsm(cs, ARCOFI_TIMEOUT, NULL);116 arcofi_fsm(cs, ARCOFI_TIMEOUT, NULL);
117}117}
118 118
@@ -125,7 +125,7 @@ clear_arcofi(struct IsdnCardState *cs) { · 6 unmodified lines
125 125
126void126void
127init_arcofi(struct IsdnCardState *cs) {127init_arcofi(struct IsdnCardState *cs) {
128 setup_timer(&cs->dc.isac.arcofitimer, (void *)arcofi_timer, (long)cs);128 timer_setup(&cs->dc.isac.arcofitimer, arcofi_timer, 0);
129 init_waitqueue_head(&cs->dc.isac.arcofi_wait);129 init_waitqueue_head(&cs->dc.isac.arcofi_wait);
130 test_and_set_bit(HW_ARCOFI, &cs->HW_Flags);130 test_and_set_bit(HW_ARCOFI, &cs->HW_Flags);
131}131}
drivers/isdn/hisax/diva.c+4−5
@@ -798,8 +798,9 @@ reset_diva(struct IsdnCardState *cs) · 797 unmodified lines
798#define DIVA_ASSIGN 1798#define DIVA_ASSIGN 1
799 799
800static void800static void
801diva_led_handler(struct IsdnCardState *cs)801diva_led_handler(struct timer_list *t)
802{802{
803 struct IsdnCardState *cs = from_timer(cs, t, hw.diva.tl);
803 int blink = 0;804 int blink = 0;
804 805
805 if ((cs->subtyp == DIVA_IPAC_ISA) ||806 if ((cs->subtyp == DIVA_IPAC_ISA) ||
@@ -828,7 +829,6 @@ diva_led_handler(struct IsdnCardState *cs) · 22 unmodified lines
828 829
829 byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);830 byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
830 if (blink) {831 if (blink) {
831 init_timer(&cs->hw.diva.tl);
832 cs->hw.diva.tl.expires = jiffies + ((blink * HZ) / 1000);832 cs->hw.diva.tl.expires = jiffies + ((blink * HZ) / 1000);
833 add_timer(&cs->hw.diva.tl);833 add_timer(&cs->hw.diva.tl);
834 }834 }
@@ -900,7 +900,7 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) · 65 unmodified lines
900 (cs->subtyp != DIVA_IPAC_PCI) &&900 (cs->subtyp != DIVA_IPAC_PCI) &&
901 (cs->subtyp != DIVA_IPACX_PCI)) {901 (cs->subtyp != DIVA_IPACX_PCI)) {
902 spin_lock_irqsave(&cs->lock, flags);902 spin_lock_irqsave(&cs->lock, flags);
903 diva_led_handler(cs);903 diva_led_handler(&cs->hw.diva.tl);
904 spin_unlock_irqrestore(&cs->lock, flags);904 spin_unlock_irqrestore(&cs->lock, flags);
905 }905 }
906 return (0);906 return (0);
@@ -978,8 +978,7 @@ static int setup_diva_common(struct IsdnCardState *cs) · 71 unmodified lines
978 printk(KERN_INFO "Diva: IPACX Design Id: %x\n",978 printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
979 MemReadISAC_IPACX(cs, IPACX_ID) & 0x3F);979 MemReadISAC_IPACX(cs, IPACX_ID) & 0x3F);
980 } else { /* DIVA 2.0 */980 } else { /* DIVA 2.0 */
981 setup_timer(&cs->hw.diva.tl, (void *)diva_led_handler,981 timer_setup(&cs->hw.diva.tl, diva_led_handler, 0);
982 (long)cs);
983 cs->readisac = &ReadISAC;982 cs->readisac = &ReadISAC;
984 cs->writeisac = &WriteISAC;983 cs->writeisac = &WriteISAC;
985 cs->readisacfifo = &ReadISACfifo;984 cs->readisacfifo = &ReadISACfifo;
drivers/isdn/hisax/elsa.c+5−5
@@ -606,8 +606,9 @@ check_arcofi(struct IsdnCardState *cs) · 605 unmodified lines
606#endif /* ARCOFI_USE */606#endif /* ARCOFI_USE */
607 607
608static void608static void
609elsa_led_handler(struct IsdnCardState *cs)609elsa_led_handler(struct timer_list *t)
610{610{
611 struct IsdnCardState *cs = from_timer(cs, t, hw.elsa.tl);
611 int blink = 0;612 int blink = 0;
612 613
613 if (cs->subtyp == ELSA_PCMCIA || cs->subtyp == ELSA_PCMCIA_IPAC)614 if (cs->subtyp == ELSA_PCMCIA || cs->subtyp == ELSA_PCMCIA_IPAC)
@@ -640,7 +641,6 @@ elsa_led_handler(struct IsdnCardState *cs) · 26 unmodified lines
640 } else641 } else
641 byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);642 byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
642 if (blink) {643 if (blink) {
643 init_timer(&cs->hw.elsa.tl);
644 cs->hw.elsa.tl.expires = jiffies + ((blink * HZ) / 1000);644 cs->hw.elsa.tl.expires = jiffies + ((blink * HZ) / 1000);
645 add_timer(&cs->hw.elsa.tl);645 add_timer(&cs->hw.elsa.tl);
646 }646 }
@@ -715,7 +715,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) · 68 unmodified lines
715 init_modem(cs);715 init_modem(cs);
716 }716 }
717#endif717#endif
718 elsa_led_handler(cs);718 elsa_led_handler(&cs->hw.elsa.tl);
719 return (ret);719 return (ret);
720 case (MDL_REMOVE | REQUEST):720 case (MDL_REMOVE | REQUEST):
721 cs->hw.elsa.status &= 0;721 cs->hw.elsa.status &= 0;
@@ -767,7 +767,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) · 45 unmodified lines
767 else767 else
768 cs->hw.elsa.status &= ~ELSA_BAD_PWR;768 cs->hw.elsa.status &= ~ELSA_BAD_PWR;
769 }769 }
770 elsa_led_handler(cs);770 elsa_led_handler(&cs->hw.elsa.tl);
771 return (ret);771 return (ret);
772}772}
773 773
@@ -1147,7 +1147,7 @@ static int setup_elsa_common(struct IsdnCard *card) · 373 unmodified lines
1147 init_arcofi(cs);1147 init_arcofi(cs);
1148#endif1148#endif
1149 setup_isac(cs);1149 setup_isac(cs);
1150 setup_timer(&cs->hw.elsa.tl, (void *)elsa_led_handler, (long)cs);1150 timer_setup(&cs->hw.elsa.tl, elsa_led_handler, 0);
1151 /* Teste Timer */1151 /* Teste Timer */
1152 if (cs->hw.elsa.timer) {1152 if (cs->hw.elsa.timer) {
1153 byteout(cs->hw.elsa.trig, 0xff);1153 byteout(cs->hw.elsa.trig, 0xff);
drivers/isdn/hisax/fsm.c+3−4
@@ -85,8 +85,9 @@ FsmChangeState(struct FsmInst *fi, int newstate) · 84 unmodified lines
85}85}
86 86
87static void87static void
88FsmExpireTimer(struct FsmTimer *ft)88FsmExpireTimer(struct timer_list *t)
89{89{
90 struct FsmTimer *ft = from_timer(ft, t, tl);
90#if FSM_TIMER_DEBUG91#if FSM_TIMER_DEBUG
91 if (ft->fi->debug)92 if (ft->fi->debug)
92 ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);93 ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);
@@ -102,7 +103,7 @@ FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft) · 9 unmodified lines
102 if (ft->fi->debug)103 if (ft->fi->debug)
103 ft->fi->printdebug(ft->fi, "FsmInitTimer %lx", (long) ft);104 ft->fi->printdebug(ft->fi, "FsmInitTimer %lx", (long) ft);
104#endif105#endif
105 setup_timer(&ft->tl, (void *)FsmExpireTimer, (long)ft);106 timer_setup(&ft->tl, FsmExpireTimer, 0);
106}107}
107 108
108void109void
@@ -131,7 +132,6 @@ FsmAddTimer(struct FsmTimer *ft, · 22 unmodified lines
131 ft->fi->printdebug(ft->fi, "FsmAddTimer already active!");132 ft->fi->printdebug(ft->fi, "FsmAddTimer already active!");
132 return -1;133 return -1;
133 }134 }
134 init_timer(&ft->tl);
135 ft->event = event;135 ft->event = event;
136 ft->arg = arg;136 ft->arg = arg;
137 ft->tl.expires = jiffies + (millisec * HZ) / 1000;137 ft->tl.expires = jiffies + (millisec * HZ) / 1000;
@@ -152,7 +152,6 @@ FsmRestartTimer(struct FsmTimer *ft, · 14 unmodified lines
152 152
153 if (timer_pending(&ft->tl))153 if (timer_pending(&ft->tl))
154 del_timer(&ft->tl);154 del_timer(&ft->tl);
155 init_timer(&ft->tl);
156 ft->event = event;155 ft->event = event;
157 ft->arg = arg;156 ft->arg = arg;
158 ft->tl.expires = jiffies + (millisec * HZ) / 1000;157 ft->tl.expires = jiffies + (millisec * HZ) / 1000;
drivers/isdn/hisax/hfc4s8s_l1.c+3−3
@@ -591,8 +591,9 @@ bch_l2l1(struct hisax_if *ifc, int pr, void *arg) · 590 unmodified lines
591/* layer 1 timer function */591/* layer 1 timer function */
592/**************************/592/**************************/
593static void593static void
594hfc_l1_timer(struct hfc4s8s_l1 *l1)594hfc_l1_timer(struct timer_list *t)
595{595{
596 struct hfc4s8s_l1 *l1 = from_timer(l1, t, l1_timer);
596 u_long flags;597 u_long flags;
597 598
598 if (!l1->enabled)599 if (!l1->enabled)
@@ -1396,8 +1397,7 @@ setup_instance(hfc4s8s_hw *hw) · 797 unmodified lines
1396 l1p = hw->l1 + i;1397 l1p = hw->l1 + i;
1397 spin_lock_init(&l1p->lock);1398 spin_lock_init(&l1p->lock);
1398 l1p->hw = hw;1399 l1p->hw = hw;
1399 setup_timer(&l1p->l1_timer, (void *)hfc_l1_timer,1400 timer_setup(&l1p->l1_timer, hfc_l1_timer, 0);
1400 (long)(l1p));
1401 l1p->st_num = i;1401 l1p->st_num = i;
1402 skb_queue_head_init(&l1p->d_tx_queue);1402 skb_queue_head_init(&l1p->d_tx_queue);
1403 l1p->d_if.ifc.priv = hw->l1 + i;1403 l1p->d_if.ifc.priv = hw->l1 + i;
drivers/isdn/hisax/hfc_2bds0.c+2−2
@@ -1014,7 +1014,7 @@ setstack_hfcd(struct PStack *st, struct IsdnCardState *cs) · 1013 unmodified lines
1014}1014}
1015 1015
1016static void1016static void
1017hfc_dbusy_timer(struct IsdnCardState *cs)1017hfc_dbusy_timer(struct timer_list *t)
1018{1018{
1019}1019}
1020 1020
@@ -1073,6 +1073,6 @@ set_cs_func(struct IsdnCardState *cs) · 52 unmodified lines
1073 cs->writeisacfifo = &dummyf;1073 cs->writeisacfifo = &dummyf;
1074 cs->BC_Read_Reg = &ReadReg;1074 cs->BC_Read_Reg = &ReadReg;
1075 cs->BC_Write_Reg = &WriteReg;1075 cs->BC_Write_Reg = &WriteReg;
1076 setup_timer(&cs->dbusytimer, (void *)hfc_dbusy_timer, (long)cs);1076 timer_setup(&cs->dbusytimer, hfc_dbusy_timer, 0);
1077 INIT_WORK(&cs->tqueue, hfcd_bh);1077 INIT_WORK(&cs->tqueue, hfcd_bh);
1078}1078}
drivers/isdn/hisax/hfc_pci.c+5−4
@@ -165,8 +165,9 @@ reset_hfcpci(struct IsdnCardState *cs) · 164 unmodified lines
165/* Timer function called when kernel timer expires */165/* Timer function called when kernel timer expires */
166/***************************************************/166/***************************************************/
167static void167static void
168hfcpci_Timer(struct IsdnCardState *cs)168hfcpci_Timer(struct timer_list *t)
169{169{
170 struct IsdnCardState *cs = from_timer(cs, t, hw.hfcpci.timer);
170 cs->hw.hfcpci.timer.expires = jiffies + 75;171 cs->hw.hfcpci.timer.expires = jiffies + 75;
171 /* WD RESET */172 /* WD RESET */
172/* WriteReg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcpci.ctmt | 0x80);173/* WriteReg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcpci.ctmt | 0x80);
@@ -1095,7 +1096,7 @@ hfcpci_interrupt(int intno, void *dev_id) · 922 unmodified lines
1095/* timer callback for D-chan busy resolution. Currently no function */1096/* timer callback for D-chan busy resolution. Currently no function */
1096/********************************************************************/1097/********************************************************************/
1097static void1098static void
1098hfcpci_dbusy_timer(struct IsdnCardState *cs)1099hfcpci_dbusy_timer(struct timer_list *t)
1099{1100{
1100}1101}
1101 1102
@@ -1582,7 +1583,7 @@ inithfcpci(struct IsdnCardState *cs) · 480 unmodified lines
1582 cs->bcs[1].BC_SetStack = setstack_2b;1583 cs->bcs[1].BC_SetStack = setstack_2b;
1583 cs->bcs[0].BC_Close = close_hfcpci;1584 cs->bcs[0].BC_Close = close_hfcpci;
1584 cs->bcs[1].BC_Close = close_hfcpci;1585 cs->bcs[1].BC_Close = close_hfcpci;
1585 setup_timer(&cs->dbusytimer, (void *)hfcpci_dbusy_timer, (long)cs);1586 timer_setup(&cs->dbusytimer, hfcpci_dbusy_timer, 0);
1586 mode_hfcpci(cs->bcs, 0, 0);1587 mode_hfcpci(cs->bcs, 0, 0);
1587 mode_hfcpci(cs->bcs + 1, 0, 1);1588 mode_hfcpci(cs->bcs + 1, 0, 1);
1588}1589}
@@ -1744,7 +1745,7 @@ setup_hfcpci(struct IsdnCard *card) · 155 unmodified lines
1744 cs->BC_Write_Reg = NULL;1745 cs->BC_Write_Reg = NULL;
1745 cs->irq_func = &hfcpci_interrupt;1746 cs->irq_func = &hfcpci_interrupt;
1746 cs->irq_flags |= IRQF_SHARED;1747 cs->irq_flags |= IRQF_SHARED;
1747 setup_timer(&cs->hw.hfcpci.timer, (void *)hfcpci_Timer, (long)cs);1748 timer_setup(&cs->hw.hfcpci.timer, hfcpci_Timer, 0);
1748 cs->cardmsg = &hfcpci_card_msg;1749 cs->cardmsg = &hfcpci_card_msg;
1749 cs->auxcmd = &hfcpci_auxcmd;1750 cs->auxcmd = &hfcpci_auxcmd;
1750 1751
drivers/isdn/hisax/hfc_sx.c+5−4
@@ -418,8 +418,9 @@ reset_hfcsx(struct IsdnCardState *cs) · 417 unmodified lines
418/* Timer function called when kernel timer expires */418/* Timer function called when kernel timer expires */
419/***************************************************/419/***************************************************/
420static void420static void
421hfcsx_Timer(struct IsdnCardState *cs)421hfcsx_Timer(struct timer_list *t)
422{422{
423 struct IsdnCardState *cs = from_timer(cs, t, hw.hfcsx.timer);
423 cs->hw.hfcsx.timer.expires = jiffies + 75;424 cs->hw.hfcsx.timer.expires = jiffies + 75;
424 /* WD RESET */425 /* WD RESET */
425/* WriteReg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcsx.ctmt | 0x80);426/* WriteReg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcsx.ctmt | 0x80);
@@ -860,7 +861,7 @@ hfcsx_interrupt(int intno, void *dev_id) · 434 unmodified lines
860/* timer callback for D-chan busy resolution. Currently no function */861/* timer callback for D-chan busy resolution. Currently no function */
861/********************************************************************/862/********************************************************************/
862static void863static void
863hfcsx_dbusy_timer(struct IsdnCardState *cs)864hfcsx_dbusy_timer(struct timer_list *t)
864{865{
865}866}
866 867
@@ -1495,7 +1496,7 @@ int setup_hfcsx(struct IsdnCard *card) · 628 unmodified lines
1495 } else1496 } else
1496 return (0); /* no valid card type */1497 return (0); /* no valid card type */
1497 1498
1498 setup_timer(&cs->dbusytimer, (void *)hfcsx_dbusy_timer, (long)cs);1499 timer_setup(&cs->dbusytimer, hfcsx_dbusy_timer, 0);
1499 INIT_WORK(&cs->tqueue, hfcsx_bh);1500 INIT_WORK(&cs->tqueue, hfcsx_bh);
1500 cs->readisac = NULL;1501 cs->readisac = NULL;
1501 cs->writeisac = NULL;1502 cs->writeisac = NULL;
@@ -1507,7 +1508,7 @@ int setup_hfcsx(struct IsdnCard *card) · 5 unmodified lines
1507 1508
1508 cs->hw.hfcsx.b_fifo_size = 0; /* fifo size still unknown */1509 cs->hw.hfcsx.b_fifo_size = 0; /* fifo size still unknown */
1509 cs->hw.hfcsx.cirm = ccd_sp_irqtab[cs->irq & 0xF]; /* RAM not evaluated */1510 cs->hw.hfcsx.cirm = ccd_sp_irqtab[cs->irq & 0xF]; /* RAM not evaluated */
1510 setup_timer(&cs->hw.hfcsx.timer, (void *)hfcsx_Timer, (long)cs);1511 timer_setup(&cs->hw.hfcsx.timer, hfcsx_Timer, 0);
1511 1512
1512 reset_hfcsx(cs);1513 reset_hfcsx(cs);
1513 cs->cardmsg = &hfcsx_card_msg;1514 cs->cardmsg = &hfcsx_card_msg;
drivers/isdn/hisax/hfc_usb.c+6−4
@@ -343,8 +343,9 @@ handle_led(hfcusb_data *hfc, int event) · 342 unmodified lines
343 343
344/* ISDN l1 timer T3 expires */344/* ISDN l1 timer T3 expires */
345static void345static void
346l1_timer_expire_t3(hfcusb_data *hfc)346l1_timer_expire_t3(struct timer_list *t)
347{347{
348 hfcusb_data *hfc = from_timer(hfc, t, t3_timer);
348 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,349 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,
349 NULL);350 NULL);
350 351
@@ -360,8 +361,9 @@ l1_timer_expire_t3(hfcusb_data *hfc) · 9 unmodified lines
360 361
361/* ISDN l1 timer T4 expires */362/* ISDN l1 timer T4 expires */
362static void363static void
363l1_timer_expire_t4(hfcusb_data *hfc)364l1_timer_expire_t4(struct timer_list *t)
364{365{
366 hfcusb_data *hfc = from_timer(hfc, t, t4_timer);
365 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,367 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,
366 NULL);368 NULL);
367 369
@@ -1165,10 +1167,10 @@ hfc_usb_init(hfcusb_data *hfc) · 797 unmodified lines
1165 hfc->old_led_state = 0;1167 hfc->old_led_state = 0;
1166 1168
1167 /* init the t3 timer */1169 /* init the t3 timer */
1168 setup_timer(&hfc->t3_timer, (void *)l1_timer_expire_t3, (long)hfc);1170 timer_setup(&hfc->t3_timer, l1_timer_expire_t3, 0);
1169 1171
1170 /* init the t4 timer */1172 /* init the t4 timer */
1171 setup_timer(&hfc->t4_timer, (void *)l1_timer_expire_t4, (long)hfc);1173 timer_setup(&hfc->t4_timer, l1_timer_expire_t4, 0);
1172 1174
1173 /* init the background machinery for control requests */1175 /* init the background machinery for control requests */
1174 hfc->ctrl_read.bRequestType = 0xc0;1176 hfc->ctrl_read.bRequestType = 0xc0;
drivers/isdn/hisax/hfcscard.c+3−2
@@ -41,8 +41,9 @@ hfcs_interrupt(int intno, void *dev_id) · 40 unmodified lines
41}41}
42 42
43static void43static void
44hfcs_Timer(struct IsdnCardState *cs)44hfcs_Timer(struct timer_list *t)
45{45{
46 struct IsdnCardState *cs = from_timer(cs, t, hw.hfcD.timer);
46 cs->hw.hfcD.timer.expires = jiffies + 75;47 cs->hw.hfcD.timer.expires = jiffies + 75;
47 /* WD RESET */48 /* WD RESET */
48/* WriteReg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcD.ctmt | 0x80);49/* WriteReg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcD.ctmt | 0x80);
@@ -253,7 +254,7 @@ int setup_hfcs(struct IsdnCard *card) · 204 unmodified lines
253 outb(0x57, cs->hw.hfcD.addr | 1);254 outb(0x57, cs->hw.hfcD.addr | 1);
254 }255 }
255 set_cs_func(cs);256 set_cs_func(cs);
256 setup_timer(&cs->hw.hfcD.timer, (void *)hfcs_Timer, (long)cs);257 timer_setup(&cs->hw.hfcD.timer, hfcs_Timer, 0);
257 cs->cardmsg = &hfcs_card_msg;258 cs->cardmsg = &hfcs_card_msg;
258 cs->irq_func = &hfcs_interrupt;259 cs->irq_func = &hfcs_interrupt;
259 return (1);260 return (1);
drivers/isdn/hisax/icc.c+3−3
@@ -168,7 +168,6 @@ icc_fill_fifo(struct IsdnCardState *cs) · 167 unmodified lines
168 debugl1(cs, "icc_fill_fifo dbusytimer running");168 debugl1(cs, "icc_fill_fifo dbusytimer running");
169 del_timer(&cs->dbusytimer);169 del_timer(&cs->dbusytimer);
170 }170 }
171 init_timer(&cs->dbusytimer);
172 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);171 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
173 add_timer(&cs->dbusytimer);172 add_timer(&cs->dbusytimer);
174 if (cs->debug & L1_DEB_ISAC_FIFO) {173 if (cs->debug & L1_DEB_ISAC_FIFO) {
@@ -580,8 +579,9 @@ DC_Close_icc(struct IsdnCardState *cs) { · 405 unmodified lines
580}579}
581 580
582static void581static void
583dbusy_timer_handler(struct IsdnCardState *cs)582dbusy_timer_handler(struct timer_list *t)
584{583{
584 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer);
585 struct PStack *stptr;585 struct PStack *stptr;
586 int rbch, star;586 int rbch, star;
587 587
@@ -676,5 +676,5 @@ clear_pending_icc_ints(struct IsdnCardState *cs) · 88 unmodified lines
676void setup_icc(struct IsdnCardState *cs)676void setup_icc(struct IsdnCardState *cs)
677{677{
678 INIT_WORK(&cs->tqueue, icc_bh);678 INIT_WORK(&cs->tqueue, icc_bh);
679 setup_timer(&cs->dbusytimer, (void *)dbusy_timer_handler, (long)cs);679 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0);
680}680}
drivers/isdn/hisax/ipacx.c+4−4
@@ -35,7 +35,7 @@ · 34 unmodified lines
35static void ph_command(struct IsdnCardState *cs, unsigned int command);35static void ph_command(struct IsdnCardState *cs, unsigned int command);
36static inline void cic_int(struct IsdnCardState *cs);36static inline void cic_int(struct IsdnCardState *cs);
37static void dch_l2l1(struct PStack *st, int pr, void *arg);37static void dch_l2l1(struct PStack *st, int pr, void *arg);
38static void dbusy_timer_handler(struct IsdnCardState *cs);38static void dbusy_timer_handler(struct timer_list *t);
39static void dch_empty_fifo(struct IsdnCardState *cs, int count);39static void dch_empty_fifo(struct IsdnCardState *cs, int count);
40static void dch_fill_fifo(struct IsdnCardState *cs);40static void dch_fill_fifo(struct IsdnCardState *cs);
41static inline void dch_int(struct IsdnCardState *cs);41static inline void dch_int(struct IsdnCardState *cs);
@@ -198,8 +198,9 @@ dch_l2l1(struct PStack *st, int pr, void *arg) · 156 unmodified lines
198//----------------------------------------------------------198//----------------------------------------------------------
199//----------------------------------------------------------199//----------------------------------------------------------
200static void200static void
201dbusy_timer_handler(struct IsdnCardState *cs)201dbusy_timer_handler(struct timer_list *t)
202{202{
203 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer);
203 struct PStack *st;204 struct PStack *st;
204 int rbchd, stard;205 int rbchd, stard;
205 206
@@ -298,7 +299,6 @@ dch_fill_fifo(struct IsdnCardState *cs) · 92 unmodified lines
298 debugl1(cs, "dch_fill_fifo dbusytimer running");299 debugl1(cs, "dch_fill_fifo dbusytimer running");
299 del_timer(&cs->dbusytimer);300 del_timer(&cs->dbusytimer);
300 }301 }
301 init_timer(&cs->dbusytimer);
302 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);302 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
303 add_timer(&cs->dbusytimer);303 add_timer(&cs->dbusytimer);
304 304
@@ -424,7 +424,7 @@ dch_init(struct IsdnCardState *cs) · 119 unmodified lines
424 424
425 cs->setstack_d = dch_setstack;425 cs->setstack_d = dch_setstack;
426 426
427 setup_timer(&cs->dbusytimer, (void *)dbusy_timer_handler, (long)cs);427 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0);
428 428
429 cs->writeisac(cs, IPACX_TR_CONF0, 0x00); // clear LDD429 cs->writeisac(cs, IPACX_TR_CONF0, 0x00); // clear LDD
430 cs->writeisac(cs, IPACX_TR_CONF2, 0x00); // enable transmitter430 cs->writeisac(cs, IPACX_TR_CONF2, 0x00); // enable transmitter
drivers/isdn/hisax/isac.c+3−3
@@ -171,7 +171,6 @@ isac_fill_fifo(struct IsdnCardState *cs) · 170 unmodified lines
171 debugl1(cs, "isac_fill_fifo dbusytimer running");171 debugl1(cs, "isac_fill_fifo dbusytimer running");
172 del_timer(&cs->dbusytimer);172 del_timer(&cs->dbusytimer);
173 }173 }
174 init_timer(&cs->dbusytimer);
175 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);174 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
176 add_timer(&cs->dbusytimer);175 add_timer(&cs->dbusytimer);
177 if (cs->debug & L1_DEB_ISAC_FIFO) {176 if (cs->debug & L1_DEB_ISAC_FIFO) {
@@ -584,8 +583,9 @@ DC_Close_isac(struct IsdnCardState *cs) · 406 unmodified lines
584}583}
585 584
586static void585static void
587dbusy_timer_handler(struct IsdnCardState *cs)586dbusy_timer_handler(struct timer_list *t)
588{587{
588 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer);
589 struct PStack *stptr;589 struct PStack *stptr;
590 int rbch, star;590 int rbch, star;
591 591
@@ -677,5 +677,5 @@ void clear_pending_isac_ints(struct IsdnCardState *cs) · 85 unmodified lines
677void setup_isac(struct IsdnCardState *cs)677void setup_isac(struct IsdnCardState *cs)
678{678{
679 INIT_WORK(&cs->tqueue, isac_bh);679 INIT_WORK(&cs->tqueue, isac_bh);
680 setup_timer(&cs->dbusytimer, (void *)dbusy_timer_handler, (long)cs);680 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0);
681}681}
drivers/isdn/hisax/isar.c+4−5
@@ -1267,7 +1267,8 @@ isar_int_main(struct IsdnCardState *cs) · 1266 unmodified lines
1267}1267}
1268 1268
1269static void1269static void
1270ftimer_handler(struct BCState *bcs) {1270ftimer_handler(struct timer_list *t) {
1271 struct BCState *bcs = from_timer(bcs, t, hw.isar.ftimer);
1271 if (bcs->cs->debug)1272 if (bcs->cs->debug)
1272 debugl1(bcs->cs, "ftimer flags %04lx",1273 debugl1(bcs->cs, "ftimer flags %04lx",
1273 bcs->Flag);1274 bcs->Flag);
@@ -1902,8 +1903,6 @@ void initisar(struct IsdnCardState *cs) · 628 unmodified lines
1902 cs->bcs[1].BC_SetStack = setstack_isar;1903 cs->bcs[1].BC_SetStack = setstack_isar;
1903 cs->bcs[0].BC_Close = close_isarstate;1904 cs->bcs[0].BC_Close = close_isarstate;
1904 cs->bcs[1].BC_Close = close_isarstate;1905 cs->bcs[1].BC_Close = close_isarstate;
1905 setup_timer(&cs->bcs[0].hw.isar.ftimer, (void *)ftimer_handler,1906 timer_setup(&cs->bcs[0].hw.isar.ftimer, ftimer_handler, 0);
1906 (long)&cs->bcs[0]);1907 timer_setup(&cs->bcs[1].hw.isar.ftimer, ftimer_handler, 0);
1907 setup_timer(&cs->bcs[1].hw.isar.ftimer, (void *)ftimer_handler,
1908 (long)&cs->bcs[1]);
1909}1908}
drivers/isdn/hisax/isdnl3.c+3−3
@@ -160,8 +160,9 @@ newl3state(struct l3_process *pc, int state) · 159 unmodified lines
160}160}
161 161
162static void162static void
163L3ExpireTimer(struct L3Timer *t)163L3ExpireTimer(struct timer_list *timer)
164{164{
165 struct L3Timer *t = from_timer(t, timer, tl);
165 t->pc->st->lli.l4l3(t->pc->st, t->event, t->pc);166 t->pc->st->lli.l4l3(t->pc->st, t->event, t->pc);
166}167}
167 168
@@ -169,7 +170,7 @@ void · 1 unmodified line
169L3InitTimer(struct l3_process *pc, struct L3Timer *t)170L3InitTimer(struct l3_process *pc, struct L3Timer *t)
170{171{
171 t->pc = pc;172 t->pc = pc;
172 setup_timer(&t->tl, (void *)L3ExpireTimer, (long)t);173 timer_setup(&t->tl, L3ExpireTimer, 0);
173}174}
174 175
175void176void
@@ -186,7 +187,6 @@ L3AddTimer(struct L3Timer *t, · 10 unmodified lines
186 printk(KERN_WARNING "L3AddTimer: timer already active!\n");187 printk(KERN_WARNING "L3AddTimer: timer already active!\n");
187 return -1;188 return -1;
188 }189 }
189 init_timer(&t->tl);
190 t->event = event;190 t->event = event;
191 t->tl.expires = jiffies + (millisec * HZ) / 1000;191 t->tl.expires = jiffies + (millisec * HZ) / 1000;
192 add_timer(&t->tl);192 add_timer(&t->tl);
drivers/isdn/hisax/saphir.c+3−4
@@ -159,8 +159,9 @@ Start_ISAC: · 158 unmodified lines
159}159}
160 160
161static void161static void
162SaphirWatchDog(struct IsdnCardState *cs)162SaphirWatchDog(struct timer_list *t)
163{163{
164 struct IsdnCardState *cs = from_timer(cs, t, hw.saphir.timer);
164 u_long flags;165 u_long flags;
165 166
166 spin_lock_irqsave(&cs->lock, flags);167 spin_lock_irqsave(&cs->lock, flags);
@@ -268,9 +269,7 @@ int setup_saphir(struct IsdnCard *card) · 101 unmodified lines
268 cs->irq, cs->hw.saphir.cfg_reg);269 cs->irq, cs->hw.saphir.cfg_reg);
269 270
270 setup_isac(cs);271 setup_isac(cs);
271 cs->hw.saphir.timer.function = (void *) SaphirWatchDog;272 timer_setup(&cs->hw.saphir.timer, SaphirWatchDog, 0);
272 cs->hw.saphir.timer.data = (long) cs;
273 init_timer(&cs->hw.saphir.timer);
274 cs->hw.saphir.timer.expires = jiffies + 4 * HZ;273 cs->hw.saphir.timer.expires = jiffies + 4 * HZ;
275 add_timer(&cs->hw.saphir.timer);274 add_timer(&cs->hw.saphir.timer);
276 if (saphir_reset(cs)) {275 if (saphir_reset(cs)) {
drivers/isdn/hisax/teleint.c+3−2
@@ -179,8 +179,9 @@ Start_ISAC: · 178 unmodified lines
179}179}
180 180
181static void181static void
182TeleInt_Timer(struct IsdnCardState *cs)182TeleInt_Timer(struct timer_list *t)
183{183{
184 struct IsdnCardState *cs = from_timer(cs, t, hw.hfc.timer);
184 int stat = 0;185 int stat = 0;
185 u_long flags;186 u_long flags;
186 187
@@ -278,7 +279,7 @@ int setup_TeleInt(struct IsdnCard *card) · 91 unmodified lines
278 cs->bcs[0].hw.hfc.send = NULL;279 cs->bcs[0].hw.hfc.send = NULL;
279 cs->bcs[1].hw.hfc.send = NULL;280 cs->bcs[1].hw.hfc.send = NULL;
280 cs->hw.hfc.fifosize = 7 * 1024 + 512;281 cs->hw.hfc.fifosize = 7 * 1024 + 512;
281 setup_timer(&cs->hw.hfc.timer, (void *)TeleInt_Timer, (long)cs);282 timer_setup(&cs->hw.hfc.timer, TeleInt_Timer, 0);
282 if (!request_region(cs->hw.hfc.addr, 2, "TeleInt isdn")) {283 if (!request_region(cs->hw.hfc.addr, 2, "TeleInt isdn")) {
283 printk(KERN_WARNING284 printk(KERN_WARNING
284 "HiSax: TeleInt config port %x-%x already in use\n",285 "HiSax: TeleInt config port %x-%x already in use\n",
drivers/isdn/hisax/w6692.c+3−4
@@ -188,7 +188,6 @@ W6692_fill_fifo(struct IsdnCardState *cs) · 187 unmodified lines
188 debugl1(cs, "W6692_fill_fifo dbusytimer running");188 debugl1(cs, "W6692_fill_fifo dbusytimer running");
189 del_timer(&cs->dbusytimer);189 del_timer(&cs->dbusytimer);
190 }190 }
191 init_timer(&cs->dbusytimer);
192 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);191 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
193 add_timer(&cs->dbusytimer);192 add_timer(&cs->dbusytimer);
194 if (cs->debug & L1_DEB_ISAC_FIFO) {193 if (cs->debug & L1_DEB_ISAC_FIFO) {
@@ -684,8 +683,9 @@ DC_Close_W6692(struct IsdnCardState *cs) · 489 unmodified lines
684}683}
685 684
686static void685static void
687dbusy_timer_handler(struct IsdnCardState *cs)686dbusy_timer_handler(struct timer_list *t)
688{687{
688 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer);
689 struct PStack *stptr;689 struct PStack *stptr;
690 int rbch, star;690 int rbch, star;
691 u_long flags;691 u_long flags;
@@ -904,8 +904,7 @@ static void initW6692(struct IsdnCardState *cs, int part) · 212 unmodified lines
904 if (part & 1) {904 if (part & 1) {
905 cs->setstack_d = setstack_W6692;905 cs->setstack_d = setstack_W6692;
906 cs->DC_Close = DC_Close_W6692;906 cs->DC_Close = DC_Close_W6692;
907 setup_timer(&cs->dbusytimer, (void *)dbusy_timer_handler,907 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0);
908 (long)cs);
909 resetW6692(cs);908 resetW6692(cs);
910 ph_command(cs, W_L1CMD_RST);909 ph_command(cs, W_L1CMD_RST);
911 cs->dc.w6692.ph_state = W_L1CMD_RST;910 cs->dc.w6692.ph_state = W_L1CMD_RST;
drivers/isdn/isdnloop/isdnloop.c+14−19
@@ -90,9 +90,9 @@ isdnloop_bchan_send(isdnloop_card *card, int ch) · 89 unmodified lines
90 * data = pointer to card struct, set by kernel timer.data90 * data = pointer to card struct, set by kernel timer.data
91 */91 */
92static void92static void
93isdnloop_pollbchan(unsigned long data)93isdnloop_pollbchan(struct timer_list *t)
94{94{
95 isdnloop_card *card = (isdnloop_card *) data;95 isdnloop_card *card = from_timer(card, t, rb_timer);
96 unsigned long flags;96 unsigned long flags;
97 97
98 if (card->flags & ISDNLOOP_FLAGS_B1ACTIVE)98 if (card->flags & ISDNLOOP_FLAGS_B1ACTIVE)
@@ -305,9 +305,9 @@ isdnloop_putmsg(isdnloop_card *card, unsigned char c) · 206 unmodified lines
305 * data = pointer to card struct305 * data = pointer to card struct
306 */306 */
307static void307static void
308isdnloop_polldchan(unsigned long data)308isdnloop_polldchan(struct timer_list *t)
309{309{
310 isdnloop_card *card = (isdnloop_card *) data;310 isdnloop_card *card = from_timer(card, t, st_timer);
311 struct sk_buff *skb;311 struct sk_buff *skb;
312 int avail;312 int avail;
313 int left;313 int left;
@@ -373,8 +373,6 @@ isdnloop_polldchan(unsigned long data) · 59 unmodified lines
373 card->flags |= ISDNLOOP_FLAGS_RBTIMER;373 card->flags |= ISDNLOOP_FLAGS_RBTIMER;
374 spin_lock_irqsave(&card->isdnloop_lock, flags);374 spin_lock_irqsave(&card->isdnloop_lock, flags);
375 del_timer(&card->rb_timer);375 del_timer(&card->rb_timer);
376 card->rb_timer.function = isdnloop_pollbchan;
377 card->rb_timer.data = (unsigned long) card;
378 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;376 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;
379 add_timer(&card->rb_timer);377 add_timer(&card->rb_timer);
380 spin_unlock_irqrestore(&card->isdnloop_lock, flags);378 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
@@ -588,9 +586,10 @@ isdnloop_atimeout(isdnloop_card *card, int ch) · 207 unmodified lines
588 * Wrapper for isdnloop_atimeout().586 * Wrapper for isdnloop_atimeout().
589 */587 */
590static void588static void
591isdnloop_atimeout0(unsigned long data)589isdnloop_atimeout0(struct timer_list *t)
592{590{
593 isdnloop_card *card = (isdnloop_card *) data;591 isdnloop_card *card = from_timer(card, t, c_timer[0]);
592
594 isdnloop_atimeout(card, 0);593 isdnloop_atimeout(card, 0);
595}594}
596 595
@@ -598,9 +597,10 @@ isdnloop_atimeout0(unsigned long data) · 1 unmodified line
598 * Wrapper for isdnloop_atimeout().597 * Wrapper for isdnloop_atimeout().
599 */598 */
600static void599static void
601isdnloop_atimeout1(unsigned long data)600isdnloop_atimeout1(struct timer_list *t)
602{601{
603 isdnloop_card *card = (isdnloop_card *) data;602 isdnloop_card *card = from_timer(card, t, c_timer[1]);
603
604 isdnloop_atimeout(card, 1);604 isdnloop_atimeout(card, 1);
605}605}
606 606
@@ -617,13 +617,9 @@ isdnloop_start_ctimer(isdnloop_card *card, int ch) · 10 unmodified lines
617 unsigned long flags;617 unsigned long flags;
618 618
619 spin_lock_irqsave(&card->isdnloop_lock, flags);619 spin_lock_irqsave(&card->isdnloop_lock, flags);
620 init_timer(&card->c_timer[ch]);620 timer_setup(&card->c_timer[ch], ch ? isdnloop_atimeout1
621 : isdnloop_atimeout0, 0);
621 card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT;622 card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT;
622 if (ch)
623 card->c_timer[ch].function = isdnloop_atimeout1;
624 else
625 card->c_timer[ch].function = isdnloop_atimeout0;
626 card->c_timer[ch].data = (unsigned long) card;
627 add_timer(&card->c_timer[ch]);623 add_timer(&card->c_timer[ch]);
628 spin_unlock_irqrestore(&card->isdnloop_lock, flags);624 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
629}625}
@@ -1113,10 +1109,9 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp) · 483 unmodified lines
1113 sdef.ptype);1109 sdef.ptype);
1114 return -EINVAL;1110 return -EINVAL;
1115 }1111 }
1116 init_timer(&card->st_timer);1112 timer_setup(&card->rb_timer, isdnloop_pollbchan, 0);
1113 timer_setup(&card->st_timer, isdnloop_polldchan, 0);
1117 card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD;1114 card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD;
1118 card->st_timer.function = isdnloop_polldchan;
1119 card->st_timer.data = (unsigned long) card;
1120 add_timer(&card->st_timer);1115 add_timer(&card->st_timer);
1121 card->flags |= ISDNLOOP_FLAGS_RUNNING;1116 card->flags |= ISDNLOOP_FLAGS_RUNNING;
1122 spin_unlock_irqrestore(&card->isdnloop_lock, flags);1117 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
drivers/isdn/mISDN/dsp.h+1−1
@@ -259,7 +259,7 @@ extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len, · 258 unmodified lines
259 259
260extern int dsp_tone(struct dsp *dsp, int tone);260extern int dsp_tone(struct dsp *dsp, int tone);
261extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len);261extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len);
262extern void dsp_tone_timeout(void *arg);262extern void dsp_tone_timeout(struct timer_list *t);
263 263
264extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len);264extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len);
265extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len);265extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len);
drivers/isdn/mISDN/dsp_core.c+2−4
@@ -1092,7 +1092,7 @@ dspcreate(struct channel_req *crq) · 1091 unmodified lines
1092 ndsp->pcm_bank_tx = -1;1092 ndsp->pcm_bank_tx = -1;
1093 ndsp->hfc_conf = -1; /* current conference number */1093 ndsp->hfc_conf = -1; /* current conference number */
1094 /* set tone timer */1094 /* set tone timer */
1095 setup_timer(&ndsp->tone.tl, (void *)dsp_tone_timeout, (long)ndsp);1095 timer_setup(&ndsp->tone.tl, dsp_tone_timeout, 0);
1096 1096
1097 if (dtmfthreshold < 20 || dtmfthreshold > 500)1097 if (dtmfthreshold < 20 || dtmfthreshold > 500)
1098 dtmfthreshold = 200;1098 dtmfthreshold = 200;
@@ -1202,9 +1202,7 @@ static int __init dsp_init(void) · 103 unmodified lines
1202 }1202 }
1203 1203
1204 /* set sample timer */1204 /* set sample timer */
1205 dsp_spl_tl.function = (void *)dsp_cmx_send;1205 timer_setup(&dsp_spl_tl, (void *)dsp_cmx_send, 0);
1206 dsp_spl_tl.data = 0;
1207 init_timer(&dsp_spl_tl);
1208 dsp_spl_tl.expires = jiffies + dsp_tics;1206 dsp_spl_tl.expires = jiffies + dsp_tics;
1209 dsp_spl_jiffies = dsp_spl_tl.expires;1207 dsp_spl_jiffies = dsp_spl_tl.expires;
1210 add_timer(&dsp_spl_tl);1208 add_timer(&dsp_spl_tl);
drivers/isdn/mISDN/dsp_tones.c+2−4
@@ -457,9 +457,9 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len) · 456 unmodified lines
457 * timer expires *457 * timer expires *
458 *****************/458 *****************/
459void459void
460dsp_tone_timeout(void *arg)460dsp_tone_timeout(struct timer_list *t)
461{461{
462 struct dsp *dsp = arg;462 struct dsp *dsp = from_timer(dsp, t, tone.tl);
463 struct dsp_tone *tone = &dsp->tone;463 struct dsp_tone *tone = &dsp->tone;
464 struct pattern *pat = (struct pattern *)tone->pattern;464 struct pattern *pat = (struct pattern *)tone->pattern;
465 int index = tone->index;465 int index = tone->index;
@@ -478,7 +478,6 @@ dsp_tone_timeout(void *arg) · 12 unmodified lines
478 else478 else
479 dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index]));479 dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index]));
480 /* set timer */480 /* set timer */
481 init_timer(&tone->tl);
482 tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000;481 tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000;
483 add_timer(&tone->tl);482 add_timer(&tone->tl);
484}483}
@@ -541,7 +540,6 @@ dsp_tone(struct dsp *dsp, int tone) · 56 unmodified lines
541 /* set timer */540 /* set timer */
542 if (timer_pending(&tonet->tl))541 if (timer_pending(&tonet->tl))
543 del_timer(&tonet->tl);542 del_timer(&tonet->tl);
544 init_timer(&tonet->tl);
545 tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000;543 tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000;
546 add_timer(&tonet->tl);544 add_timer(&tonet->tl);
547 } else {545 } else {
drivers/isdn/mISDN/fsm.c+3−4
@@ -100,8 +100,9 @@ mISDN_FsmChangeState(struct FsmInst *fi, int newstate) · 99 unmodified lines
100EXPORT_SYMBOL(mISDN_FsmChangeState);100EXPORT_SYMBOL(mISDN_FsmChangeState);
101 101
102static void102static void
103FsmExpireTimer(struct FsmTimer *ft)103FsmExpireTimer(struct timer_list *t)
104{104{
105 struct FsmTimer *ft = from_timer(ft, t, tl);
105#if FSM_TIMER_DEBUG106#if FSM_TIMER_DEBUG
106 if (ft->fi->debug)107 if (ft->fi->debug)
107 ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);108 ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);
@@ -117,7 +118,7 @@ mISDN_FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft) · 9 unmodified lines
117 if (ft->fi->debug)118 if (ft->fi->debug)
118 ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft);119 ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft);
119#endif120#endif
120 setup_timer(&ft->tl, (void *)FsmExpireTimer, (long)ft);121 timer_setup(&ft->tl, FsmExpireTimer, 0);
121}122}
122EXPORT_SYMBOL(mISDN_FsmInitTimer);123EXPORT_SYMBOL(mISDN_FsmInitTimer);
123 124
@@ -153,7 +154,6 @@ mISDN_FsmAddTimer(struct FsmTimer *ft, · 29 unmodified lines
153 }154 }
154 return -1;155 return -1;
155 }156 }
156 init_timer(&ft->tl);
157 ft->event = event;157 ft->event = event;
158 ft->arg = arg;158 ft->arg = arg;
159 ft->tl.expires = jiffies + (millisec * HZ) / 1000;159 ft->tl.expires = jiffies + (millisec * HZ) / 1000;
@@ -175,7 +175,6 @@ mISDN_FsmRestartTimer(struct FsmTimer *ft, · 15 unmodified lines
175 175
176 if (timer_pending(&ft->tl))176 if (timer_pending(&ft->tl))
177 del_timer(&ft->tl);177 del_timer(&ft->tl);
178 init_timer(&ft->tl);
179 ft->event = event;178 ft->event = event;
180 ft->arg = arg;179 ft->arg = arg;
181 ft->tl.expires = jiffies + (millisec * HZ) / 1000;180 ft->tl.expires = jiffies + (millisec * HZ) / 1000;
drivers/isdn/mISDN/l1oip_core.c+9−16
@@ -440,14 +440,8 @@ l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, · 439 unmodified lines
440 440
441#ifdef REORDER_DEBUG441#ifdef REORDER_DEBUG
442 if (hc->chan[channel].disorder_flag) {442 if (hc->chan[channel].disorder_flag) {
443 struct sk_buff *skb;443 swap(hc->chan[channel].disorder_skb, nskb);
444 int cnt;444 swap(hc->chan[channel].disorder_cnt, rx_counter);
445 skb = hc->chan[channel].disorder_skb;
446 hc->chan[channel].disorder_skb = nskb;
447 nskb = skb;
448 cnt = hc->chan[channel].disorder_cnt;
449 hc->chan[channel].disorder_cnt = rx_counter;
450 rx_counter = cnt;
451 }445 }
452 hc->chan[channel].disorder_flag ^= 1;446 hc->chan[channel].disorder_flag ^= 1;
453 if (nskb)447 if (nskb)
@@ -842,17 +836,18 @@ l1oip_send_bh(struct work_struct *work) · 388 unmodified lines
842 * timer stuff836 * timer stuff
843 */837 */
844static void838static void
845l1oip_keepalive(void *data)839l1oip_keepalive(struct timer_list *t)
846{840{
847 struct l1oip *hc = (struct l1oip *)data;841 struct l1oip *hc = from_timer(hc, t, keep_tl);
848 842
849 schedule_work(&hc->workq);843 schedule_work(&hc->workq);
850}844}
851 845
852static void846static void
853l1oip_timeout(void *data)847l1oip_timeout(struct timer_list *t)
854{848{
855 struct l1oip *hc = (struct l1oip *)data;849 struct l1oip *hc = from_timer(hc, t,
850 timeout_tl);
856 struct dchannel *dch = hc->chan[hc->d_idx].dch;851 struct dchannel *dch = hc->chan[hc->d_idx].dch;
857 852
858 if (debug & DEBUG_L1OIP_MSG)853 if (debug & DEBUG_L1OIP_MSG)
@@ -1437,13 +1432,11 @@ init_card(struct l1oip *hc, int pri, int bundle) · 578 unmodified lines
1437 if (ret)1432 if (ret)
1438 return ret;1433 return ret;
1439 1434
1440 hc->keep_tl.function = (void *)l1oip_keepalive;1435 timer_setup(&hc->keep_tl, l1oip_keepalive, 0);
1441 hc->keep_tl.data = (ulong)hc;
1442 init_timer(&hc->keep_tl);
1443 hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */1436 hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */
1444 add_timer(&hc->keep_tl);1437 add_timer(&hc->keep_tl);
1445 1438
1446 setup_timer(&hc->timeout_tl, (void *)l1oip_timeout, (ulong)hc);1439 timer_setup(&hc->timeout_tl, l1oip_timeout, 0);
1447 hc->timeout_on = 0; /* state that we have timer off */1440 hc->timeout_on = 0; /* state that we have timer off */
1448 1441
1449 return 0;1442 return 0;
drivers/isdn/mISDN/timerdev.c+3−3
@@ -162,9 +162,9 @@ mISDN_poll(struct file *filep, poll_table *wait) · 161 unmodified lines
162}162}
163 163
164static void164static void
165dev_expire_timer(unsigned long data)165dev_expire_timer(struct timer_list *t)
166{166{
167 struct mISDNtimer *timer = (void *)data;167 struct mISDNtimer *timer = from_timer(timer, t, tl);
168 u_long flags;168 u_long flags;
169 169
170 spin_lock_irqsave(&timer->dev->lock, flags);170 spin_lock_irqsave(&timer->dev->lock, flags);
@@ -189,7 +189,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout) · 18 unmodified lines
189 if (!timer)189 if (!timer)
190 return -ENOMEM;190 return -ENOMEM;
191 timer->dev = dev;191 timer->dev = dev;
192 setup_timer(&timer->tl, dev_expire_timer, (long)timer);192 timer_setup(&timer->tl, dev_expire_timer, 0);
193 spin_lock_irq(&dev->lock);193 spin_lock_irq(&dev->lock);
194 id = timer->id = dev->next_id++;194 id = timer->id = dev->next_id++;
195 if (dev->next_id < 0)195 if (dev->next_id < 0)
drivers/net/Kconfig+12−0
@@ -483,6 +483,18 @@ config FUJITSU_ES · 482 unmodified lines
483 This driver provides support for Extended Socket network device483 This driver provides support for Extended Socket network device
484 on Extended Partitioning of FUJITSU PRIMEQUEST 2000 E2 series.484 on Extended Partitioning of FUJITSU PRIMEQUEST 2000 E2 series.
485 485
486config THUNDERBOLT_NET
487 tristate "Networking over Thunderbolt cable"
488 depends on THUNDERBOLT && INET
489 help
490 Select this if you want to create network between two
491 computers over a Thunderbolt cable. The driver supports Apple
492 ThunderboltIP protocol and allows communication with any host
493 supporting the same protocol including Windows and macOS.
494
495 To compile this driver a module, choose M here. The module will be
496 called thunderbolt-net.
497
486source "drivers/net/hyperv/Kconfig"498source "drivers/net/hyperv/Kconfig"
487 499
488endif # NETDEVICES500endif # NETDEVICES
drivers/net/Makefile+3−0
@@ -75,3 +75,6 @@ obj-$(CONFIG_HYPERV_NET) += hyperv/ · 74 unmodified lines
75obj-$(CONFIG_NTB_NETDEV) += ntb_netdev.o75obj-$(CONFIG_NTB_NETDEV) += ntb_netdev.o
76 76
77obj-$(CONFIG_FUJITSU_ES) += fjes/77obj-$(CONFIG_FUJITSU_ES) += fjes/
78
79thunderbolt-net-y += thunderbolt.o
80obj-$(CONFIG_THUNDERBOLT_NET) += thunderbolt-net.o
drivers/net/appletalk/cops.c+6−7
@@ -155,6 +155,7 @@ static int cops_irqlist[] = { · 154 unmodified lines
155};155};
156 156
157static struct timer_list cops_timer;157static struct timer_list cops_timer;
158static struct net_device *cops_timer_dev;
158 159
159/* use 0 for production, 1 for verification, 2 for debug, 3 for verbose debug */160/* use 0 for production, 1 for verification, 2 for debug, 3 for verbose debug */
160#ifndef COPS_DEBUG161#ifndef COPS_DEBUG
@@ -187,7 +188,7 @@ static void cops_load (struct net_device *dev); · 26 unmodified lines
187static int cops_nodeid (struct net_device *dev, int nodeid);188static int cops_nodeid (struct net_device *dev, int nodeid);
188 189
189static irqreturn_t cops_interrupt (int irq, void *dev_id);190static irqreturn_t cops_interrupt (int irq, void *dev_id);
190static void cops_poll (unsigned long ltdev);191static void cops_poll(struct timer_list *t);
191static void cops_timeout(struct net_device *dev);192static void cops_timeout(struct net_device *dev);
192static void cops_rx (struct net_device *dev);193static void cops_rx (struct net_device *dev);
193static netdev_tx_t cops_send_packet (struct sk_buff *skb,194static netdev_tx_t cops_send_packet (struct sk_buff *skb,
@@ -424,9 +425,8 @@ static int cops_open(struct net_device *dev) · 230 unmodified lines
424 */425 */
425 if(lp->board==TANGENT) /* Poll 20 times per second */426 if(lp->board==TANGENT) /* Poll 20 times per second */
426 {427 {
427 init_timer(&cops_timer);428 cops_timer_dev = dev;
428 cops_timer.function = cops_poll;429 timer_setup(&cops_timer, cops_poll, 0);
429 cops_timer.data = (unsigned long)dev;
430 cops_timer.expires = jiffies + HZ/20;430 cops_timer.expires = jiffies + HZ/20;
431 add_timer(&cops_timer);431 add_timer(&cops_timer);
432 } 432 }
@@ -673,12 +673,11 @@ static int cops_nodeid (struct net_device *dev, int nodeid) · 240 unmodified lines
673 * Poll the Tangent type cards to see if we have work.673 * Poll the Tangent type cards to see if we have work.
674 */674 */
675 675
676static void cops_poll(unsigned long ltdev)676static void cops_poll(struct timer_list *unused)
677{677{
678 int ioaddr, status;678 int ioaddr, status;
679 int boguscount = 0;679 int boguscount = 0;
680 680 struct net_device *dev = cops_timer_dev;
681 struct net_device *dev = (struct net_device *)ltdev;
682 681
683 del_timer(&cops_timer);682 del_timer(&cops_timer);
684 683
drivers/net/appletalk/ltpc.c+5−13
@@ -694,6 +694,7 @@ static int do_read(struct net_device *dev, void *cbuf, int cbuflen, · 693 unmodified lines
694/* end of idle handlers -- what should be seen is do_read, do_write */694/* end of idle handlers -- what should be seen is do_read, do_write */
695 695
696static struct timer_list ltpc_timer;696static struct timer_list ltpc_timer;
697static struct net_device *ltpc_timer_dev;
697 698
698static netdev_tx_t ltpc_xmit(struct sk_buff *skb, struct net_device *dev);699static netdev_tx_t ltpc_xmit(struct sk_buff *skb, struct net_device *dev);
699 700
@@ -867,10 +868,8 @@ static void set_multicast_list(struct net_device *dev) · 167 unmodified lines
867 868
868static int ltpc_poll_counter;869static int ltpc_poll_counter;
869 870
870static void ltpc_poll(unsigned long l)871static void ltpc_poll(struct timer_list *unused)
871{872{
872 struct net_device *dev = (struct net_device *) l;
873
874 del_timer(&ltpc_timer);873 del_timer(&ltpc_timer);
875 874
876 if(debug & DEBUG_VERBOSE) {875 if(debug & DEBUG_VERBOSE) {
@@ -880,14 +879,10 @@ static void ltpc_poll(unsigned long l) · 3 unmodified lines
880 }879 }
881 ltpc_poll_counter--;880 ltpc_poll_counter--;
882 }881 }
883
884 if (!dev)
885 return; /* we've been downed */
886 882
887 /* poll 20 times per second */883 /* poll 20 times per second */
888 idle(dev);884 idle(ltpc_timer_dev);
889 ltpc_timer.expires = jiffies + HZ/20;885 ltpc_timer.expires = jiffies + HZ/20;
890
891 add_timer(&ltpc_timer);886 add_timer(&ltpc_timer);
892}887}
893 888
@@ -1165,9 +1160,8 @@ struct net_device * __init ltpc_probe(void) · 271 unmodified lines
1165 dev->irq = 0;1160 dev->irq = 0;
1166 /* polled mode -- 20 times per second */1161 /* polled mode -- 20 times per second */
1167 /* this is really, really slow... should it poll more often? */1162 /* this is really, really slow... should it poll more often? */
1168 init_timer(&ltpc_timer);1163 ltpc_timer_dev = dev;
1169 ltpc_timer.function=ltpc_poll;1164 timer_setup(&ltpc_timer, ltpc_poll, 0);
1170 ltpc_timer.data = (unsigned long) dev;
1171 1165
1172 ltpc_timer.expires = jiffies + HZ/20;1166 ltpc_timer.expires = jiffies + HZ/20;
1173 add_timer(&ltpc_timer);1167 add_timer(&ltpc_timer);
@@ -1254,8 +1248,6 @@ static void __exit ltpc_cleanup(void) · 80 unmodified lines
1254 if(debug & DEBUG_VERBOSE) printk("unregister_netdev\n");1248 if(debug & DEBUG_VERBOSE) printk("unregister_netdev\n");
1255 unregister_netdev(dev_ltpc);1249 unregister_netdev(dev_ltpc);
1256 1250
1257 ltpc_timer.data = 0; /* signal the poll routine that we're done */
1258
1259 del_timer_sync(&ltpc_timer);1251 del_timer_sync(&ltpc_timer);
1260 1252
1261 if(debug & DEBUG_VERBOSE) printk("freeing irq\n");1253 if(debug & DEBUG_VERBOSE) printk("freeing irq\n");
drivers/net/arcnet/arcnet.c+4−5
@@ -382,9 +382,10 @@ static void arcdev_setup(struct net_device *dev) · 381 unmodified lines
382 dev->flags = IFF_BROADCAST;382 dev->flags = IFF_BROADCAST;
383}383}
384 384
385static void arcnet_timer(unsigned long data)385static void arcnet_timer(struct timer_list *t)
386{386{
387 struct net_device *dev = (struct net_device *)data;387 struct arcnet_local *lp = from_timer(lp, t, timer);
388 struct net_device *dev = lp->dev;
388 389
389 if (!netif_carrier_ok(dev)) {390 if (!netif_carrier_ok(dev)) {
390 netif_carrier_on(dev);391 netif_carrier_on(dev);
@@ -450,9 +451,7 @@ struct net_device *alloc_arcdev(const char *name) · 59 unmodified lines
450 451
451 lp->dev = dev;452 lp->dev = dev;
452 spin_lock_init(&lp->lock);453 spin_lock_init(&lp->lock);
453 init_timer(&lp->timer);454 timer_setup(&lp->timer, arcnet_timer, 0);
454 lp->timer.data = (unsigned long) dev;
455 lp->timer.function = arcnet_timer;
456 }455 }
457 456
458 return dev;457 return dev;
drivers/net/bonding/bond_main.c+28−14
@@ -1217,25 +1217,21 @@ static enum netdev_lag_tx_type bond_lag_tx_type(struct bonding *bond) · 1216 unmodified lines
1217 }1217 }
1218}1218}
1219 1219
1220static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave)1220static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave,
1221 struct netlink_ext_ack *extack)
1221{1222{
1222 struct netdev_lag_upper_info lag_upper_info;1223 struct netdev_lag_upper_info lag_upper_info;
1223 int err;
1224 1224
1225 lag_upper_info.tx_type = bond_lag_tx_type(bond);1225 lag_upper_info.tx_type = bond_lag_tx_type(bond);
1226 err = netdev_master_upper_dev_link(slave->dev, bond->dev, slave,1226
1227 &lag_upper_info);1227 return netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
1228 if (err)1228 &lag_upper_info, extack);
1229 return err;
1230 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
1231 return 0;
1232}1229}
1233 1230
1234static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave)1231static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave)
1235{1232{
1236 netdev_upper_dev_unlink(slave->dev, bond->dev);1233 netdev_upper_dev_unlink(slave->dev, bond->dev);
1237 slave->dev->flags &= ~IFF_SLAVE;1234 slave->dev->flags &= ~IFF_SLAVE;
1238 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
1239}1235}
1240 1236
1241static struct slave *bond_alloc_slave(struct bonding *bond)1237static struct slave *bond_alloc_slave(struct bonding *bond)
@@ -1328,7 +1324,8 @@ void bond_lower_state_changed(struct slave *slave) · 86 unmodified lines
1328}1324}
1329 1325
1330/* enslave device <slave> to bond device <master> */1326/* enslave device <slave> to bond device <master> */
1331int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)1327int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1328 struct netlink_ext_ack *extack)
1332{1329{
1333 struct bonding *bond = netdev_priv(bond_dev);1330 struct bonding *bond = netdev_priv(bond_dev);
1334 const struct net_device_ops *slave_ops = slave_dev->netdev_ops;1331 const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
@@ -1346,12 +1343,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 11 unmodified lines
1346 1343
1347 /* already in-use? */1344 /* already in-use? */
1348 if (netdev_is_rx_handler_busy(slave_dev)) {1345 if (netdev_is_rx_handler_busy(slave_dev)) {
1346 NL_SET_ERR_MSG(extack, "Device is in use and cannot be enslaved");
1349 netdev_err(bond_dev,1347 netdev_err(bond_dev,
1350 "Error: Device is in use and cannot be enslaved\n");1348 "Error: Device is in use and cannot be enslaved\n");
1351 return -EBUSY;1349 return -EBUSY;
1352 }1350 }
1353 1351
1354 if (bond_dev == slave_dev) {1352 if (bond_dev == slave_dev) {
1353 NL_SET_ERR_MSG(extack, "Cannot enslave bond to itself.");
1355 netdev_err(bond_dev, "cannot enslave bond to itself.\n");1354 netdev_err(bond_dev, "cannot enslave bond to itself.\n");
1356 return -EPERM;1355 return -EPERM;
1357 }1356 }
@@ -1362,6 +1361,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 4 unmodified lines
1362 netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n",1361 netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n",
1363 slave_dev->name);1362 slave_dev->name);
1364 if (vlan_uses_dev(bond_dev)) {1363 if (vlan_uses_dev(bond_dev)) {
1364 NL_SET_ERR_MSG(extack, "Can not enslave VLAN challenged device to VLAN enabled bond");
1365 netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",1365 netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
1366 slave_dev->name, bond_dev->name);1366 slave_dev->name, bond_dev->name);
1367 return -EPERM;1367 return -EPERM;
@@ -1381,6 +1381,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 13 unmodified lines
1381 * enslaving it; the old ifenslave will not.1381 * enslaving it; the old ifenslave will not.
1382 */1382 */
1383 if (slave_dev->flags & IFF_UP) {1383 if (slave_dev->flags & IFF_UP) {
1384 NL_SET_ERR_MSG(extack, "Device can not be enslaved while up");
1384 netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n",1385 netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n",
1385 slave_dev->name);1386 slave_dev->name);
1386 return -EPERM;1387 return -EPERM;
@@ -1421,6 +1422,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 34 unmodified lines
1421 bond_dev);1422 bond_dev);
1422 }1423 }
1423 } else if (bond_dev->type != slave_dev->type) {1424 } else if (bond_dev->type != slave_dev->type) {
1425 NL_SET_ERR_MSG(extack, "Device type is different from other slaves");
1424 netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n",1426 netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n",
1425 slave_dev->name, slave_dev->type, bond_dev->type);1427 slave_dev->name, slave_dev->type, bond_dev->type);
1426 return -EINVAL;1428 return -EINVAL;
@@ -1428,6 +1430,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 1 unmodified line
1428 1430
1429 if (slave_dev->type == ARPHRD_INFINIBAND &&1431 if (slave_dev->type == ARPHRD_INFINIBAND &&
1430 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {1432 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
1433 NL_SET_ERR_MSG(extack, "Only active-backup mode is supported for infiniband slaves");
1431 netdev_warn(bond_dev, "Type (%d) supports only active-backup mode\n",1434 netdev_warn(bond_dev, "Type (%d) supports only active-backup mode\n",
1432 slave_dev->type);1435 slave_dev->type);
1433 res = -EOPNOTSUPP;1436 res = -EOPNOTSUPP;
@@ -1443,6 +1446,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 9 unmodified lines
1443 bond->params.fail_over_mac = BOND_FOM_ACTIVE;1446 bond->params.fail_over_mac = BOND_FOM_ACTIVE;
1444 netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n");1447 netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n");
1445 } else {1448 } else {
1449 NL_SET_ERR_MSG(extack, "Slave device does not support setting the MAC address, but fail_over_mac is not set to active");
1446 netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");1450 netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");
1447 res = -EOPNOTSUPP;1451 res = -EOPNOTSUPP;
1448 goto err_undo_flags;1452 goto err_undo_flags;
@@ -1709,7 +1713,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 260 unmodified lines
1709 goto err_detach;1713 goto err_detach;
1710 }1714 }
1711 1715
1712 res = bond_master_upper_dev_link(bond, new_slave);1716 res = bond_master_upper_dev_link(bond, new_slave, extack);
1713 if (res) {1717 if (res) {
1714 netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res);1718 netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res);
1715 goto err_unregister;1719 goto err_unregister;
@@ -2492,7 +2496,8 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, · 776 unmodified lines
2492 struct slave *curr_active_slave, *curr_arp_slave;2496 struct slave *curr_active_slave, *curr_arp_slave;
2493 unsigned char *arp_ptr;2497 unsigned char *arp_ptr;
2494 __be32 sip, tip;2498 __be32 sip, tip;
2495 int alen, is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP);2499 int is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP);
2500 unsigned int alen;
2496 2501
2497 if (!slave_do_arp_validate(bond, slave)) {2502 if (!slave_do_arp_validate(bond, slave)) {
2498 if ((slave_do_arp_validate_only(bond) && is_arp) ||2503 if ((slave_do_arp_validate_only(bond) && is_arp) ||
@@ -3073,7 +3078,16 @@ static int bond_slave_netdev_event(unsigned long event, · 574 unmodified lines
3073 break;3078 break;
3074 case NETDEV_UP:3079 case NETDEV_UP:
3075 case NETDEV_CHANGE:3080 case NETDEV_CHANGE:
3076 bond_update_speed_duplex(slave);3081 /* For 802.3ad mode only:
3082 * Getting invalid Speed/Duplex values here will put slave
3083 * in weird state. So mark it as link-down for the time
3084 * being and let link-monitoring (miimon) set it right when
3085 * correct speeds/duplex are available.
3086 */
3087 if (bond_update_speed_duplex(slave) &&
3088 BOND_MODE(bond) == BOND_MODE_8023AD)
3089 slave->link = BOND_LINK_DOWN;
3090
3077 if (BOND_MODE(bond) == BOND_MODE_8023AD)3091 if (BOND_MODE(bond) == BOND_MODE_8023AD)
3078 bond_3ad_adapter_speed_duplex_changed(slave);3092 bond_3ad_adapter_speed_duplex_changed(slave);
3079 /* Fallthrough */3093 /* Fallthrough */
@@ -3483,7 +3497,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd · 403 unmodified lines
3483 switch (cmd) {3497 switch (cmd) {
3484 case BOND_ENSLAVE_OLD:3498 case BOND_ENSLAVE_OLD:
3485 case SIOCBONDENSLAVE:3499 case SIOCBONDENSLAVE:
3486 res = bond_enslave(bond_dev, slave_dev);3500 res = bond_enslave(bond_dev, slave_dev, NULL);
3487 break;3501 break;
3488 case BOND_RELEASE_OLD:3502 case BOND_RELEASE_OLD:
3489 case SIOCBONDRELEASE:3503 case SIOCBONDRELEASE:
drivers/net/bonding/bond_options.c+1−1
@@ -1383,7 +1383,7 @@ static int bond_option_slaves_set(struct bonding *bond, · 1382 unmodified lines
1383 switch (command[0]) {1383 switch (command[0]) {
1384 case '+':1384 case '+':
1385 netdev_dbg(bond->dev, "Adding slave %s\n", dev->name);1385 netdev_dbg(bond->dev, "Adding slave %s\n", dev->name);
1386 ret = bond_enslave(bond->dev, dev);1386 ret = bond_enslave(bond->dev, dev, NULL);
1387 break;1387 break;
1388 1388
1389 case '-':1389 case '-':
drivers/net/caif/caif_hsi.c+6−9
@@ -1211,17 +1211,14 @@ static int cfhsi_open(struct net_device *ndev) · 1210 unmodified lines
1211 init_waitqueue_head(&cfhsi->flush_fifo_wait);1211 init_waitqueue_head(&cfhsi->flush_fifo_wait);
1212 1212
1213 /* Setup the inactivity timer. */1213 /* Setup the inactivity timer. */
1214 init_timer(&cfhsi->inactivity_timer);1214 setup_timer(&cfhsi->inactivity_timer, cfhsi_inactivity_tout,
1215 cfhsi->inactivity_timer.data = (unsigned long)cfhsi;1215 (unsigned long)cfhsi);
1216 cfhsi->inactivity_timer.function = cfhsi_inactivity_tout;
1217 /* Setup the slowpath RX timer. */1216 /* Setup the slowpath RX timer. */
1218 init_timer(&cfhsi->rx_slowpath_timer);1217 setup_timer(&cfhsi->rx_slowpath_timer, cfhsi_rx_slowpath,
1219 cfhsi->rx_slowpath_timer.data = (unsigned long)cfhsi;1218 (unsigned long)cfhsi);
1220 cfhsi->rx_slowpath_timer.function = cfhsi_rx_slowpath;
1221 /* Setup the aggregation timer. */1219 /* Setup the aggregation timer. */
1222 init_timer(&cfhsi->aggregation_timer);1220 setup_timer(&cfhsi->aggregation_timer, cfhsi_aggregation_tout,
1223 cfhsi->aggregation_timer.data = (unsigned long)cfhsi;1221 (unsigned long)cfhsi);
1224 cfhsi->aggregation_timer.function = cfhsi_aggregation_tout;
1225 1222
1226 /* Activate HSI interface. */1223 /* Activate HSI interface. */
1227 res = cfhsi->ops->cfhsi_up(cfhsi->ops);1224 res = cfhsi->ops->cfhsi_up(cfhsi->ops);
drivers/net/can/grcan.c+8−13
@@ -807,10 +807,10 @@ static irqreturn_t grcan_interrupt(int irq, void *dev_id) · 806 unmodified lines
807 * is not ONGOING (TX might be stuck in ONGOING due to a harwrware bug807 * is not ONGOING (TX might be stuck in ONGOING due to a harwrware bug
808 * for single shot)808 * for single shot)
809 */809 */
810static void grcan_running_reset(unsigned long data)810static void grcan_running_reset(struct timer_list *t)
811{811{
812 struct net_device *dev = (struct net_device *)data;812 struct grcan_priv *priv = from_timer(priv, t, rr_timer);
813 struct grcan_priv *priv = netdev_priv(dev);813 struct net_device *dev = priv->dev;
814 struct grcan_registers __iomem *regs = priv->regs;814 struct grcan_registers __iomem *regs = priv->regs;
815 unsigned long flags;815 unsigned long flags;
816 816
@@ -898,10 +898,10 @@ static inline void grcan_reset_timer(struct timer_list *timer, __u32 bitrate) · 81 unmodified lines
898}898}
899 899
900/* Disable channels and schedule a running reset */900/* Disable channels and schedule a running reset */
901static void grcan_initiate_running_reset(unsigned long data)901static void grcan_initiate_running_reset(struct timer_list *t)
902{902{
903 struct net_device *dev = (struct net_device *)data;903 struct grcan_priv *priv = from_timer(priv, t, hang_timer);
904 struct grcan_priv *priv = netdev_priv(dev);904 struct net_device *dev = priv->dev;
905 struct grcan_registers __iomem *regs = priv->regs;905 struct grcan_registers __iomem *regs = priv->regs;
906 unsigned long flags;906 unsigned long flags;
907 907
@@ -1626,13 +1626,8 @@ static int grcan_setup_netdev(struct platform_device *ofdev, · 718 unmodified lines
1626 spin_lock_init(&priv->lock);1626 spin_lock_init(&priv->lock);
1627 1627
1628 if (priv->need_txbug_workaround) {1628 if (priv->need_txbug_workaround) {
1629 init_timer(&priv->rr_timer);1629 timer_setup(&priv->rr_timer, grcan_running_reset, 0);
1630 priv->rr_timer.function = grcan_running_reset;1630 timer_setup(&priv->hang_timer, grcan_initiate_running_reset, 0);
1631 priv->rr_timer.data = (unsigned long)dev;
1632
1633 init_timer(&priv->hang_timer);
1634 priv->hang_timer.function = grcan_initiate_running_reset;
1635 priv->hang_timer.data = (unsigned long)dev;
1636 }1631 }
1637 1632
1638 netif_napi_add(dev, &priv->napi, grcan_poll, GRCAN_NAPI_WEIGHT);1633 netif_napi_add(dev, &priv->napi, grcan_poll, GRCAN_NAPI_WEIGHT);
drivers/net/can/sja1000/peak_pcmcia.c+3−5
@@ -381,9 +381,9 @@ static inline void pcan_set_can_power(struct pcan_pccard *card, int onoff) · 380 unmodified lines
381/*381/*
382 * set leds state according to channel activity382 * set leds state according to channel activity
383 */383 */
384static void pcan_led_timer(unsigned long arg)384static void pcan_led_timer(struct timer_list *t)
385{385{
386 struct pcan_pccard *card = (struct pcan_pccard *)arg;386 struct pcan_pccard *card = from_timer(card, t, led_timer);
387 struct net_device *netdev;387 struct net_device *netdev;
388 int i, up_count = 0;388 int i, up_count = 0;
389 u8 ccr;389 u8 ccr;
@@ -692,9 +692,7 @@ static int pcan_probe(struct pcmcia_device *pdev) · 302 unmodified lines
692 }692 }
693 693
694 /* init the timer which controls the leds */694 /* init the timer which controls the leds */
695 init_timer(&card->led_timer);695 timer_setup(&card->led_timer, pcan_led_timer, 0);
696 card->led_timer.function = pcan_led_timer;
697 card->led_timer.data = (unsigned long)card;
698 696
699 /* request the given irq */697 /* request the given irq */
700 err = request_irq(pdev->irq, &pcan_isr, IRQF_SHARED, PCC_NAME, card);698 err = request_irq(pdev->irq, &pcan_isr, IRQF_SHARED, PCC_NAME, card);
drivers/net/can/usb/peak_usb/pcan_usb.c+6−5
@@ -259,10 +259,13 @@ static int pcan_usb_write_mode(struct peak_usb_device *dev, u8 onoff) · 258 unmodified lines
259/*259/*
260 * handle end of waiting for the device to reset260 * handle end of waiting for the device to reset
261 */261 */
262static void pcan_usb_restart(unsigned long arg)262static void pcan_usb_restart(struct timer_list *t)
263{263{
264 struct pcan_usb *pdev = from_timer(pdev, t, restart_timer);
265 struct peak_usb_device *dev = &pdev->dev;
266
264 /* notify candev and netdev */267 /* notify candev and netdev */
265 peak_usb_restart_complete((struct peak_usb_device *)arg);268 peak_usb_restart_complete(dev);
266}269}
267 270
268/*271/*
@@ -798,9 +801,7 @@ static int pcan_usb_init(struct peak_usb_device *dev) · 529 unmodified lines
798 int err;801 int err;
799 802
800 /* initialize a timer needed to wait for hardware restart */803 /* initialize a timer needed to wait for hardware restart */
801 init_timer(&pdev->restart_timer);804 timer_setup(&pdev->restart_timer, pcan_usb_restart, 0);
802 pdev->restart_timer.function = pcan_usb_restart;
803 pdev->restart_timer.data = (unsigned long)dev;
804 805
805 /*806 /*
806 * explicit use of dev_xxx() instead of netdev_xxx() here:807 * explicit use of dev_xxx() instead of netdev_xxx() here:
drivers/net/dsa/b53/Kconfig+2−0
@@ -1,6 +1,8 @@
1menuconfig B531menuconfig B53
2 tristate "Broadcom BCM53xx managed switch support"2 tristate "Broadcom BCM53xx managed switch support"
3 depends on NET_DSA3 depends on NET_DSA
4 select NET_DSA_TAG_BRCM
5 select NET_DSA_TAG_BRCM_PREPEND
4 help6 help
5 This driver adds support for Broadcom managed switch chips. It supports7 This driver adds support for Broadcom managed switch chips. It supports
6 BCM5325E, BCM5365, BCM539x, BCM53115 and BCM53125 as well as BCM63XX8 BCM5325E, BCM5365, BCM539x, BCM53115 and BCM53125 as well as BCM63XX
drivers/net/dsa/b53/b53_common.c+198−37
@@ -325,7 +325,6 @@ static void b53_get_vlan_entry(struct b53_device *dev, u16 vid, · 324 unmodified lines
325 325
326static void b53_set_forwarding(struct b53_device *dev, int enable)326static void b53_set_forwarding(struct b53_device *dev, int enable)
327{327{
328 struct dsa_switch *ds = dev->ds;
329 u8 mgmt;328 u8 mgmt;
330 329
331 b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt);330 b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt);
@@ -337,14 +336,11 @@ static void b53_set_forwarding(struct b53_device *dev, int enable) · 5 unmodified lines
337 336
338 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);337 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
339 338
340 /* Include IMP port in dumb forwarding mode when no tagging protocol is339 /* Include IMP port in dumb forwarding mode
341 * set
342 */340 */
343 if (ds->ops->get_tag_protocol(ds) == DSA_TAG_PROTO_NONE) {341 b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, &mgmt);
344 b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, &mgmt);342 mgmt |= B53_MII_DUMB_FWDG_EN;
345 mgmt |= B53_MII_DUMB_FWDG_EN;343 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt);
346 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt);
347 }
348}344}
349 345
350static void b53_enable_vlan(struct b53_device *dev, bool enable)346static void b53_enable_vlan(struct b53_device *dev, bool enable)
@@ -484,7 +480,7 @@ static int b53_fast_age_vlan(struct b53_device *dev, u16 vid) · 133 unmodified lines
484 return b53_flush_arl(dev, FAST_AGE_VLAN);480 return b53_flush_arl(dev, FAST_AGE_VLAN);
485}481}
486 482
487static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)483void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
488{484{
489 struct b53_device *dev = ds->priv;485 struct b53_device *dev = ds->priv;
490 unsigned int i;486 unsigned int i;
@@ -500,12 +496,12 @@ static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) · 9 unmodified lines
500 b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), pvlan);496 b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), pvlan);
501 }497 }
502}498}
499EXPORT_SYMBOL(b53_imp_vlan_setup);
503 500
504static int b53_enable_port(struct dsa_switch *ds, int port,501int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
505 struct phy_device *phy)
506{502{
507 struct b53_device *dev = ds->priv;503 struct b53_device *dev = ds->priv;
508 unsigned int cpu_port = dev->cpu_port;504 unsigned int cpu_port = ds->ports[port].cpu_dp->index;
509 u16 pvlan;505 u16 pvlan;
510 506
511 /* Clear the Rx and Tx disable bits and set to no spanning tree */507 /* Clear the Rx and Tx disable bits and set to no spanning tree */
@@ -523,11 +519,15 @@ static int b53_enable_port(struct dsa_switch *ds, int port, · 11 unmodified lines
523 519
524 b53_imp_vlan_setup(ds, cpu_port);520 b53_imp_vlan_setup(ds, cpu_port);
525 521
522 /* If EEE was enabled, restore it */
523 if (dev->ports[port].eee.eee_enabled)
524 b53_eee_enable_set(ds, port, true);
525
526 return 0;526 return 0;
527}527}
528EXPORT_SYMBOL(b53_enable_port);
528 529
529static void b53_disable_port(struct dsa_switch *ds, int port,530void b53_disable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
530 struct phy_device *phy)
531{531{
532 struct b53_device *dev = ds->priv;532 struct b53_device *dev = ds->priv;
533 u8 reg;533 u8 reg;
@@ -537,20 +537,80 @@ static void b53_disable_port(struct dsa_switch *ds, int port, · 3 unmodified lines
537 reg |= PORT_CTRL_RX_DISABLE | PORT_CTRL_TX_DISABLE;537 reg |= PORT_CTRL_RX_DISABLE | PORT_CTRL_TX_DISABLE;
538 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), reg);538 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), reg);
539}539}
540EXPORT_SYMBOL(b53_disable_port);
540 541
541static void b53_enable_cpu_port(struct b53_device *dev)542void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
543{
544 bool tag_en = !(ds->ops->get_tag_protocol(ds, port) ==
545 DSA_TAG_PROTO_NONE);
546 struct b53_device *dev = ds->priv;
547 u8 hdr_ctl, val;
548 u16 reg;
549
550 /* Resolve which bit controls the Broadcom tag */
551 switch (port) {
552 case 8:
553 val = BRCM_HDR_P8_EN;
554 break;
555 case 7:
556 val = BRCM_HDR_P7_EN;
557 break;
558 case 5:
559 val = BRCM_HDR_P5_EN;
560 break;
561 default:
562 val = 0;
563 break;
564 }
565
566 /* Enable Broadcom tags for IMP port */
567 b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl);
568 if (tag_en)
569 hdr_ctl |= val;
570 else
571 hdr_ctl &= ~val;
572 b53_write8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, hdr_ctl);
573
574 /* Registers below are only accessible on newer devices */
575 if (!is58xx(dev))
576 return;
577
578 /* Enable reception Broadcom tag for CPU TX (switch RX) to
579 * allow us to tag outgoing frames
580 */
581 b53_read16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_RX_DIS, &reg);
582 if (tag_en)
583 reg &= ~BIT(port);
584 else
585 reg |= BIT(port);
586 b53_write16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_RX_DIS, reg);
587
588 /* Enable transmission of Broadcom tags from the switch (CPU RX) to
589 * allow delivering frames to the per-port net_devices
590 */
591 b53_read16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_TX_DIS, &reg);
592 if (tag_en)
593 reg &= ~BIT(port);
594 else
595 reg |= BIT(port);
596 b53_write16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_TX_DIS, reg);
597}
598EXPORT_SYMBOL(b53_brcm_hdr_setup);
599
600static void b53_enable_cpu_port(struct b53_device *dev, int port)
542{601{
543 unsigned int cpu_port = dev->cpu_port;
544 u8 port_ctrl;602 u8 port_ctrl;
545 603
546 /* BCM5325 CPU port is at 8 */604 /* BCM5325 CPU port is at 8 */
547 if ((is5325(dev) || is5365(dev)) && cpu_port == B53_CPU_PORT_25)605 if ((is5325(dev) || is5365(dev)) && port == B53_CPU_PORT_25)
548 cpu_port = B53_CPU_PORT;606 port = B53_CPU_PORT;
549 607
550 port_ctrl = PORT_CTRL_RX_BCST_EN |608 port_ctrl = PORT_CTRL_RX_BCST_EN |
551 PORT_CTRL_RX_MCST_EN |609 PORT_CTRL_RX_MCST_EN |
552 PORT_CTRL_RX_UCST_EN;610 PORT_CTRL_RX_UCST_EN;
553 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(cpu_port), port_ctrl);611 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), port_ctrl);
612
613 b53_brcm_hdr_setup(dev->ds, port);
554}614}
555 615
556static void b53_enable_mib(struct b53_device *dev)616static void b53_enable_mib(struct b53_device *dev)
@@ -562,8 +622,9 @@ static void b53_enable_mib(struct b53_device *dev) · 5 unmodified lines
562 b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc);622 b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc);
563}623}
564 624
565static int b53_configure_vlan(struct b53_device *dev)625int b53_configure_vlan(struct dsa_switch *ds)
566{626{
627 struct b53_device *dev = ds->priv;
567 struct b53_vlan vl = { 0 };628 struct b53_vlan vl = { 0 };
568 int i;629 int i;
569 630
@@ -586,6 +647,7 @@ static int b53_configure_vlan(struct b53_device *dev) · 16 unmodified lines
586 647
587 return 0;648 return 0;
588}649}
650EXPORT_SYMBOL(b53_configure_vlan);
589 651
590static void b53_switch_reset_gpio(struct b53_device *dev)652static void b53_switch_reset_gpio(struct b53_device *dev)
591{653{
@@ -700,7 +762,7 @@ static int b53_apply_config(struct b53_device *priv) · 108 unmodified lines
700 /* disable switching */762 /* disable switching */
701 b53_set_forwarding(priv, 0);763 b53_set_forwarding(priv, 0);
702 764
703 b53_configure_vlan(priv);765 b53_configure_vlan(priv->ds);
704 766
705 /* enable switching */767 /* enable switching */
706 b53_set_forwarding(priv, 1);768 b53_set_forwarding(priv, 1);
@@ -816,12 +878,13 @@ static int b53_setup(struct dsa_switch *ds) · 109 unmodified lines
816 if (ret)878 if (ret)
817 dev_err(ds->dev, "failed to apply configuration\n");879 dev_err(ds->dev, "failed to apply configuration\n");
818 880
881 /* Configure IMP/CPU port, disable unused ports. Enabled
882 * ports will be configured with .port_enable
883 */
819 for (port = 0; port < dev->num_ports; port++) {884 for (port = 0; port < dev->num_ports; port++) {
820 if (BIT(port) & ds->enabled_port_mask)885 if (dsa_is_cpu_port(ds, port))
821 b53_enable_port(ds, port, NULL);886 b53_enable_cpu_port(dev, port);
822 else if (dsa_is_cpu_port(ds, port))887 else if (dsa_is_unused_port(ds, port))
823 b53_enable_cpu_port(dev);
824 else
825 b53_disable_port(ds, port, NULL);888 b53_disable_port(ds, port, NULL);
826 }889 }
827 890
@@ -832,6 +895,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, · 4 unmodified lines
832 struct phy_device *phydev)895 struct phy_device *phydev)
833{896{
834 struct b53_device *dev = ds->priv;897 struct b53_device *dev = ds->priv;
898 struct ethtool_eee *p = &dev->ports[port].eee;
835 u8 rgmii_ctrl = 0, reg = 0, off;899 u8 rgmii_ctrl = 0, reg = 0, off;
836 900
837 if (!phy_is_pseudo_fixed_link(phydev))901 if (!phy_is_pseudo_fixed_link(phydev))
@@ -953,6 +1017,9 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, · 115 unmodified lines
953 b53_write8(dev, B53_CTRL_PAGE, po_reg, gmii_po);1017 b53_write8(dev, B53_CTRL_PAGE, po_reg, gmii_po);
954 }1018 }
955 }1019 }
1020
1021 /* Re-negotiate EEE if it was enabled already */
1022 p->eee_enabled = b53_eee_init(ds, port, phydev);
956}1023}
957 1024
958int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)1025int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
@@ -986,7 +1053,6 @@ void b53_vlan_add(struct dsa_switch *ds, int port, · 27 unmodified lines
986 struct b53_device *dev = ds->priv;1053 struct b53_device *dev = ds->priv;
987 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;1054 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
988 bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;1055 bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
989 unsigned int cpu_port = dev->cpu_port;
990 struct b53_vlan *vl;1056 struct b53_vlan *vl;
991 u16 vid;1057 u16 vid;
992 1058
@@ -995,12 +1061,11 @@ void b53_vlan_add(struct dsa_switch *ds, int port, · 2 unmodified lines
995 1061
996 b53_get_vlan_entry(dev, vid, vl);1062 b53_get_vlan_entry(dev, vid, vl);
997 1063
998 vl->members |= BIT(port) | BIT(cpu_port);1064 vl->members |= BIT(port);
999 if (untagged)1065 if (untagged)
1000 vl->untag |= BIT(port);1066 vl->untag |= BIT(port);
1001 else1067 else
1002 vl->untag &= ~BIT(port);1068 vl->untag &= ~BIT(port);
1003 vl->untag &= ~BIT(cpu_port);
1004 1069
1005 b53_set_vlan_entry(dev, vid, vl);1070 b53_set_vlan_entry(dev, vid, vl);
1006 b53_fast_age_vlan(dev, vid);1071 b53_fast_age_vlan(dev, vid);
@@ -1280,7 +1345,7 @@ EXPORT_SYMBOL(b53_fdb_dump); · 273 unmodified lines
1280int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br)1345int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br)
1281{1346{
1282 struct b53_device *dev = ds->priv;1347 struct b53_device *dev = ds->priv;
1283 s8 cpu_port = ds->dst->cpu_dp->index;1348 s8 cpu_port = ds->ports[port].cpu_dp->index;
1284 u16 pvlan, reg;1349 u16 pvlan, reg;
1285 unsigned int i;1350 unsigned int i;
1286 1351
@@ -1298,7 +1363,7 @@ int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) · 11 unmodified lines
1298 b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), &pvlan);1363 b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), &pvlan);
1299 1364
1300 b53_for_each_port(dev, i) {1365 b53_for_each_port(dev, i) {
1301 if (ds->ports[i].bridge_dev != br)1366 if (dsa_to_port(ds, i)->bridge_dev != br)
1302 continue;1367 continue;
1303 1368
1304 /* Add this local port to the remote port VLAN control1369 /* Add this local port to the remote port VLAN control
@@ -1326,7 +1391,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) · 21 unmodified lines
1326{1391{
1327 struct b53_device *dev = ds->priv;1392 struct b53_device *dev = ds->priv;
1328 struct b53_vlan *vl = &dev->vlans[0];1393 struct b53_vlan *vl = &dev->vlans[0];
1329 s8 cpu_port = ds->dst->cpu_dp->index;1394 s8 cpu_port = ds->ports[port].cpu_dp->index;
1330 unsigned int i;1395 unsigned int i;
1331 u16 pvlan, reg, pvid;1396 u16 pvlan, reg, pvid;
1332 1397
@@ -1334,7 +1399,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) · 1 unmodified line
1334 1399
1335 b53_for_each_port(dev, i) {1400 b53_for_each_port(dev, i) {
1336 /* Don't touch the remaining ports */1401 /* Don't touch the remaining ports */
1337 if (ds->ports[i].bridge_dev != br)1402 if (dsa_to_port(ds, i)->bridge_dev != br)
1338 continue;1403 continue;
1339 1404
1340 b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), &reg);1405 b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), &reg);
@@ -1364,8 +1429,8 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) · 23 unmodified lines
1364 b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);1429 b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
1365 } else {1430 } else {
1366 b53_get_vlan_entry(dev, pvid, vl);1431 b53_get_vlan_entry(dev, pvid, vl);
1367 vl->members |= BIT(port) | BIT(dev->cpu_port);1432 vl->members |= BIT(port) | BIT(cpu_port);
1368 vl->untag |= BIT(port) | BIT(dev->cpu_port);1433 vl->untag |= BIT(port) | BIT(cpu_port);
1369 b53_set_vlan_entry(dev, pvid, vl);1434 b53_set_vlan_entry(dev, pvid, vl);
1370 }1435 }
1371}1436}
@@ -1414,9 +1479,40 @@ void b53_br_fast_age(struct dsa_switch *ds, int port) · 42 unmodified lines
1414}1479}
1415EXPORT_SYMBOL(b53_br_fast_age);1480EXPORT_SYMBOL(b53_br_fast_age);
1416 1481
1417static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)1482static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port)
1483{
1484 /* Broadcom switches will accept enabling Broadcom tags on the
1485 * following ports: 5, 7 and 8, any other port is not supported
1486 */
1487 switch (port) {
1488 case B53_CPU_PORT_25:
1489 case 7:
1490 case B53_CPU_PORT:
1491 return true;
1492 }
1493
1494 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", port);
1495 return false;
1496}
1497
1498static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds,
1499 int port)
1418{1500{
1419 return DSA_TAG_PROTO_NONE;1501 struct b53_device *dev = ds->priv;
1502
1503 /* Older models support a different tag format that we do not
1504 * support in net/dsa/tag_brcm.c yet.
1505 */
1506 if (is5325(dev) || is5365(dev) || !b53_can_enable_brcm_tags(ds, port))
1507 return DSA_TAG_PROTO_NONE;
1508
1509 /* Broadcom BCM58xx chips have a flow accelerator on Port 8
1510 * which requires us to use the prepended Broadcom tag type
1511 */
1512 if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT)
1513 return DSA_TAG_PROTO_BRCM_PREPEND;
1514
1515 return DSA_TAG_PROTO_BRCM;
1420}1516}
1421 1517
1422int b53_mirror_add(struct dsa_switch *ds, int port,1518int b53_mirror_add(struct dsa_switch *ds, int port,
@@ -1484,6 +1580,69 @@ void b53_mirror_del(struct dsa_switch *ds, int port, · 61 unmodified lines
1484}1580}
1485EXPORT_SYMBOL(b53_mirror_del);1581EXPORT_SYMBOL(b53_mirror_del);
1486 1582
1583void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable)
1584{
1585 struct b53_device *dev = ds->priv;
1586 u16 reg;
1587
1588 b53_read16(dev, B53_EEE_PAGE, B53_EEE_EN_CTRL, &reg);
1589 if (enable)
1590 reg |= BIT(port);
1591 else
1592 reg &= ~BIT(port);
1593 b53_write16(dev, B53_EEE_PAGE, B53_EEE_EN_CTRL, reg);
1594}
1595EXPORT_SYMBOL(b53_eee_enable_set);
1596
1597
1598/* Returns 0 if EEE was not enabled, or 1 otherwise
1599 */
1600int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
1601{
1602 int ret;
1603
1604 ret = phy_init_eee(phy, 0);
1605 if (ret)
1606 return 0;
1607
1608 b53_eee_enable_set(ds, port, true);
1609
1610 return 1;
1611}
1612EXPORT_SYMBOL(b53_eee_init);
1613
1614int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
1615{
1616 struct b53_device *dev = ds->priv;
1617 struct ethtool_eee *p = &dev->ports[port].eee;
1618 u16 reg;
1619
1620 if (is5325(dev) || is5365(dev))
1621 return -EOPNOTSUPP;
1622
1623 b53_read16(dev, B53_EEE_PAGE, B53_EEE_LPI_INDICATE, &reg);
1624 e->eee_enabled = p->eee_enabled;
1625 e->eee_active = !!(reg & BIT(port));
1626
1627 return 0;
1628}
1629EXPORT_SYMBOL(b53_get_mac_eee);
1630
1631int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
1632{
1633 struct b53_device *dev = ds->priv;
1634 struct ethtool_eee *p = &dev->ports[port].eee;
1635
1636 if (is5325(dev) || is5365(dev))
1637 return -EOPNOTSUPP;
1638
1639 p->eee_enabled = e->eee_enabled;
1640 b53_eee_enable_set(ds, port, e->eee_enabled);
1641
1642 return 0;
1643}
1644EXPORT_SYMBOL(b53_set_mac_eee);
1645
1487static const struct dsa_switch_ops b53_switch_ops = {1646static const struct dsa_switch_ops b53_switch_ops = {
1488 .get_tag_protocol = b53_get_tag_protocol,1647 .get_tag_protocol = b53_get_tag_protocol,
1489 .setup = b53_setup,1648 .setup = b53_setup,
@@ -1495,6 +1654,8 @@ static const struct dsa_switch_ops b53_switch_ops = { · 5 unmodified lines
1495 .adjust_link = b53_adjust_link,1654 .adjust_link = b53_adjust_link,
1496 .port_enable = b53_enable_port,1655 .port_enable = b53_enable_port,
1497 .port_disable = b53_disable_port,1656 .port_disable = b53_disable_port,
1657 .get_mac_eee = b53_get_mac_eee,
1658 .set_mac_eee = b53_set_mac_eee,
1498 .port_bridge_join = b53_br_join,1659 .port_bridge_join = b53_br_join,
1499 .port_bridge_leave = b53_br_leave,1660 .port_bridge_leave = b53_br_leave,
1500 .port_stp_state_set = b53_br_set_stp_state,1661 .port_stp_state_set = b53_br_set_stp_state,
drivers/net/dsa/b53/b53_priv.h+31−115
@@ -70,6 +70,7 @@ enum { · 69 unmodified lines
70 70
71struct b53_port {71struct b53_port {
72 u16 vlan_ctl_mask;72 u16 vlan_ctl_mask;
73 struct ethtool_eee eee;
73};74};
74 75
75struct b53_vlan {76struct b53_vlan {
@@ -186,11 +187,6 @@ static inline int is58xx(struct b53_device *dev) · 110 unmodified lines
186#define B53_CPU_PORT_25 5187#define B53_CPU_PORT_25 5
187#define B53_CPU_PORT 8188#define B53_CPU_PORT 8
188 189
189static inline int is_cpu_port(struct b53_device *dev, int port)
190{
191 return dev->cpu_port;
192}
193
194struct b53_device *b53_switch_alloc(struct device *base,190struct b53_device *b53_switch_alloc(struct device *base,
195 const struct b53_io_ops *ops,191 const struct b53_io_ops *ops,
196 void *priv);192 void *priv);
@@ -204,119 +200,30 @@ static inline void b53_switch_remove(struct b53_device *dev) · 7 unmodified lines
204 dsa_unregister_switch(dev->ds);200 dsa_unregister_switch(dev->ds);
205}201}
206 202
207static inline int b53_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)203#define b53_build_op(type_op_size, val_type) \
208{204static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \
209 int ret;205 u8 reg, val_type val) \
210 206{ \
211 mutex_lock(&dev->reg_mutex);207 int ret; \
212 ret = dev->ops->read8(dev, page, reg, val);208 \
213 mutex_unlock(&dev->reg_mutex);209 mutex_lock(&dev->reg_mutex); \
214 210 ret = dev->ops->type_op_size(dev, page, reg, val); \
215 return ret;211 mutex_unlock(&dev->reg_mutex); \
212 \
213 return ret; \
216}214}
217 215
218static inline int b53_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)216b53_build_op(read8, u8 *);
219{217b53_build_op(read16, u16 *);
220 int ret;218b53_build_op(read32, u32 *);
221 219b53_build_op(read48, u64 *);
222 mutex_lock(&dev->reg_mutex);220b53_build_op(read64, u64 *);
223 ret = dev->ops->read16(dev, page, reg, val);
224 mutex_unlock(&dev->reg_mutex);
225
226 return ret;
227}
228
229static inline int b53_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)
230{
231 int ret;
232
233 mutex_lock(&dev->reg_mutex);
234 ret = dev->ops->read32(dev, page, reg, val);
235 mutex_unlock(&dev->reg_mutex);
236
237 return ret;
238}
239
240static inline int b53_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
241{
242 int ret;
243
244 mutex_lock(&dev->reg_mutex);
245 ret = dev->ops->read48(dev, page, reg, val);
246 mutex_unlock(&dev->reg_mutex);
247
248 return ret;
249}
250
251static inline int b53_read64(struct b53_device *dev, u8 page, u8 reg, u64 *val)
252{
253 int ret;
254
255 mutex_lock(&dev->reg_mutex);
256 ret = dev->ops->read64(dev, page, reg, val);
257 mutex_unlock(&dev->reg_mutex);
258
259 return ret;
260}
261 221
262static inline int b53_write8(struct b53_device *dev, u8 page, u8 reg, u8 value)222b53_build_op(write8, u8);
263{223b53_build_op(write16, u16);
264 int ret;224b53_build_op(write32, u32);
265 225b53_build_op(write48, u64);
266 mutex_lock(&dev->reg_mutex);226b53_build_op(write64, u64);
267 ret = dev->ops->write8(dev, page, reg, value);
268 mutex_unlock(&dev->reg_mutex);
269
270 return ret;
271}
272
273static inline int b53_write16(struct b53_device *dev, u8 page, u8 reg,
274 u16 value)
275{
276 int ret;
277
278 mutex_lock(&dev->reg_mutex);
279 ret = dev->ops->write16(dev, page, reg, value);
280 mutex_unlock(&dev->reg_mutex);
281
282 return ret;
283}
284
285static inline int b53_write32(struct b53_device *dev, u8 page, u8 reg,
286 u32 value)
287{
288 int ret;
289
290 mutex_lock(&dev->reg_mutex);
291 ret = dev->ops->write32(dev, page, reg, value);
292 mutex_unlock(&dev->reg_mutex);
293
294 return ret;
295}
296
297static inline int b53_write48(struct b53_device *dev, u8 page, u8 reg,
298 u64 value)
299{
300 int ret;
301
302 mutex_lock(&dev->reg_mutex);
303 ret = dev->ops->write48(dev, page, reg, value);
304 mutex_unlock(&dev->reg_mutex);
305
306 return ret;
307}
308
309static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg,
310 u64 value)
311{
312 int ret;
313
314 mutex_lock(&dev->reg_mutex);
315 ret = dev->ops->write64(dev, page, reg, value);
316 mutex_unlock(&dev->reg_mutex);
317
318 return ret;
319}
320 227
321struct b53_arl_entry {228struct b53_arl_entry {
322 u8 port;229 u8 port;
@@ -377,6 +284,8 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev) · 54 unmodified lines
377#endif284#endif
378 285
379/* Exported functions towards other drivers */286/* Exported functions towards other drivers */
287void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
288int b53_configure_vlan(struct dsa_switch *ds);
380void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);289void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
381void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);290void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
382int b53_get_sset_count(struct dsa_switch *ds);291int b53_get_sset_count(struct dsa_switch *ds);
@@ -403,5 +312,12 @@ int b53_mirror_add(struct dsa_switch *ds, int port, · 20 unmodified lines
403 struct dsa_mall_mirror_tc_entry *mirror, bool ingress);312 struct dsa_mall_mirror_tc_entry *mirror, bool ingress);
404void b53_mirror_del(struct dsa_switch *ds, int port,313void b53_mirror_del(struct dsa_switch *ds, int port,
405 struct dsa_mall_mirror_tc_entry *mirror);314 struct dsa_mall_mirror_tc_entry *mirror);
315int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
316void b53_disable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
317void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
318void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable);
319int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
320int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
321int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
406 322
407#endif323#endif
drivers/net/dsa/b53/b53_regs.h+48−0
@@ -50,6 +50,9 @@ · 49 unmodified lines
50/* Jumbo Frame Registers */50/* Jumbo Frame Registers */
51#define B53_JUMBO_PAGE 0x4051#define B53_JUMBO_PAGE 0x40
52 52
53/* EEE Control Registers Page */
54#define B53_EEE_PAGE 0x92
55
53/* CFP Configuration Registers Page */56/* CFP Configuration Registers Page */
54#define B53_CFP_PAGE 0xa157#define B53_CFP_PAGE 0xa1
55 58
@@ -210,6 +213,7 @@ · 154 unmodified lines
210#define B53_BRCM_HDR 0x03213#define B53_BRCM_HDR 0x03
211#define BRCM_HDR_P8_EN BIT(0) /* Enable tagging on port 8 */214#define BRCM_HDR_P8_EN BIT(0) /* Enable tagging on port 8 */
212#define BRCM_HDR_P5_EN BIT(1) /* Enable tagging on port 5 */215#define BRCM_HDR_P5_EN BIT(1) /* Enable tagging on port 5 */
216#define BRCM_HDR_P7_EN BIT(2) /* Enable tagging on port 7 */
213 217
214/* Mirror capture control register (16 bit) */218/* Mirror capture control register (16 bit) */
215#define B53_MIR_CAP_CTL 0x10219#define B53_MIR_CAP_CTL 0x10
@@ -249,6 +253,12 @@ · 33 unmodified lines
249/* Revision ID register (8 bit) */253/* Revision ID register (8 bit) */
250#define B53_REV_ID 0x40254#define B53_REV_ID 0x40
251 255
256/* Broadcom header RX control (16 bit) */
257#define B53_BRCM_HDR_RX_DIS 0x60
258
259/* Broadcom header TX control (16 bit) */
260#define B53_BRCM_HDR_TX_DIS 0x62
261
252/*************************************************************************262/*************************************************************************
253 * ARL Access Page Registers263 * ARL Access Page Registers
254 *************************************************************************/264 *************************************************************************/
@@ -464,6 +474,44 @@ · 209 unmodified lines
464#define JMS_MIN_SIZE 1518474#define JMS_MIN_SIZE 1518
465#define JMS_MAX_SIZE 9724475#define JMS_MAX_SIZE 9724
466 476
477/*************************************************************************
478 * EEE Configuration Page Registers
479 *************************************************************************/
480
481/* EEE Enable control register (16 bit) */
482#define B53_EEE_EN_CTRL 0x00
483
484/* EEE LPI assert status register (16 bit) */
485#define B53_EEE_LPI_ASSERT_STS 0x02
486
487/* EEE LPI indicate status register (16 bit) */
488#define B53_EEE_LPI_INDICATE 0x4
489
490/* EEE Receiving idle symbols status register (16 bit) */
491#define B53_EEE_RX_IDLE_SYM_STS 0x6
492
493/* EEE Pipeline timer register (32 bit) */
494#define B53_EEE_PIP_TIMER 0xC
495
496/* EEE Sleep timer Gig register (32 bit) */
497#define B53_EEE_SLEEP_TIMER_GIG(i) (0x10 + 4 * (i))
498
499/* EEE Sleep timer FE register (32 bit) */
500#define B53_EEE_SLEEP_TIMER_FE(i) (0x34 + 4 * (i))
501
502/* EEE Minimum LP timer Gig register (32 bit) */
503#define B53_EEE_MIN_LP_TIMER_GIG(i) (0x58 + 4 * (i))
504
505/* EEE Minimum LP timer FE register (32 bit) */
506#define B53_EEE_MIN_LP_TIMER_FE(i) (0x7c + 4 * (i))
507
508/* EEE Wake timer Gig register (16 bit) */
509#define B53_EEE_WAKE_TIMER_GIG(i) (0xa0 + 2 * (i))
510
511/* EEE Wake timer FE register (16 bit) */
512#define B53_EEE_WAKE_TIMER_FE(i) (0xb2 + 2 * (i))
513
514
467/*************************************************************************515/*************************************************************************
468 * CFP Configuration Page Registers516 * CFP Configuration Page Registers
469 *************************************************************************/517 *************************************************************************/
drivers/net/dsa/bcm_sf2.c+48−192
@@ -35,71 +35,12 @@ · 34 unmodified lines
35#include "b53/b53_priv.h"35#include "b53/b53_priv.h"
36#include "b53/b53_regs.h"36#include "b53/b53_regs.h"
37 37
38static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds)38static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds,
39 int port)
39{40{
40 return DSA_TAG_PROTO_BRCM;41 return DSA_TAG_PROTO_BRCM;
41}42}
42 43
43static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
44{
45 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
46 unsigned int i;
47 u32 reg;
48
49 /* Enable the IMP Port to be in the same VLAN as the other ports
50 * on a per-port basis such that we only have Port i and IMP in
51 * the same VLAN.
52 */
53 for (i = 0; i < priv->hw_params.num_ports; i++) {
54 if (!((1 << i) & ds->enabled_port_mask))
55 continue;
56
57 reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
58 reg |= (1 << cpu_port);
59 core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(i));
60 }
61}
62
63static void bcm_sf2_brcm_hdr_setup(struct bcm_sf2_priv *priv, int port)
64{
65 u32 reg, val;
66
67 /* Resolve which bit controls the Broadcom tag */
68 switch (port) {
69 case 8:
70 val = BRCM_HDR_EN_P8;
71 break;
72 case 7:
73 val = BRCM_HDR_EN_P7;
74 break;
75 case 5:
76 val = BRCM_HDR_EN_P5;
77 break;
78 default:
79 val = 0;
80 break;
81 }
82
83 /* Enable Broadcom tags for IMP port */
84 reg = core_readl(priv, CORE_BRCM_HDR_CTRL);
85 reg |= val;
86 core_writel(priv, reg, CORE_BRCM_HDR_CTRL);
87
88 /* Enable reception Broadcom tag for CPU TX (switch RX) to
89 * allow us to tag outgoing frames
90 */
91 reg = core_readl(priv, CORE_BRCM_HDR_RX_DIS);
92 reg &= ~(1 << port);
93 core_writel(priv, reg, CORE_BRCM_HDR_RX_DIS);
94
95 /* Enable transmission of Broadcom tags from the switch (CPU RX) to
96 * allow delivering frames to the per-port net_devices
97 */
98 reg = core_readl(priv, CORE_BRCM_HDR_TX_DIS);
99 reg &= ~(1 << port);
100 core_writel(priv, reg, CORE_BRCM_HDR_TX_DIS);
101}
102
103static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)44static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
104{45{
105 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);46 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
@@ -138,7 +79,7 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 32 unmodified lines
138 reg |= i << (PRT_TO_QID_SHIFT * i);79 reg |= i << (PRT_TO_QID_SHIFT * i);
139 core_writel(priv, reg, CORE_PORT_TC2_QOS_MAP_PORT(port));80 core_writel(priv, reg, CORE_PORT_TC2_QOS_MAP_PORT(port));
140 81
141 bcm_sf2_brcm_hdr_setup(priv, port);82 b53_brcm_hdr_setup(ds, port);
142 83
143 /* Force link status for IMP port */84 /* Force link status for IMP port */
144 reg = core_readl(priv, offset);85 reg = core_readl(priv, offset);
@@ -146,19 +87,6 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 1 unmodified line
146 core_writel(priv, reg, offset);87 core_writel(priv, reg, offset);
147}88}
148 89
149static void bcm_sf2_eee_enable_set(struct dsa_switch *ds, int port, bool enable)
150{
151 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
152 u32 reg;
153
154 reg = core_readl(priv, CORE_EEE_EN_CTRL);
155 if (enable)
156 reg |= 1 << port;
157 else
158 reg &= ~(1 << port);
159 core_writel(priv, reg, CORE_EEE_EN_CTRL);
160}
161
162static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)90static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)
163{91{
164 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);92 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
@@ -236,7 +164,6 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, · 71 unmodified lines
236 struct phy_device *phy)164 struct phy_device *phy)
237{165{
238 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);166 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
239 s8 cpu_port = ds->dst->cpu_dp->index;
240 unsigned int i;167 unsigned int i;
241 u32 reg;168 u32 reg;
242 169
@@ -247,7 +174,7 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, · 4 unmodified lines
247 174
248 /* Enable Broadcom tags for that port if requested */175 /* Enable Broadcom tags for that port if requested */
249 if (priv->brcm_tag_mask & BIT(port))176 if (priv->brcm_tag_mask & BIT(port))
250 bcm_sf2_brcm_hdr_setup(priv, port);177 b53_brcm_hdr_setup(ds, port);
251 178
252 /* Configure Traffic Class to QoS mapping, allow each priority to map179 /* Configure Traffic Class to QoS mapping, allow each priority to map
253 * to a different queue number180 * to a different queue number
@@ -257,9 +184,6 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, · 3 unmodified lines
257 reg |= i << (PRT_TO_QID_SHIFT * i);184 reg |= i << (PRT_TO_QID_SHIFT * i);
258 core_writel(priv, reg, CORE_PORT_TC2_QOS_MAP_PORT(port));185 core_writel(priv, reg, CORE_PORT_TC2_QOS_MAP_PORT(port));
259 186
260 /* Clear the Rx and Tx disable bits and set to no spanning tree */
261 core_writel(priv, 0, CORE_G_PCTL_PORT(port));
262
263 /* Re-enable the GPHY and re-apply workarounds */187 /* Re-enable the GPHY and re-apply workarounds */
264 if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1) {188 if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1) {
265 bcm_sf2_gphy_enable_set(ds, true);189 bcm_sf2_gphy_enable_set(ds, true);
@@ -282,23 +206,20 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, · 16 unmodified lines
282 if (port == priv->moca_port)206 if (port == priv->moca_port)
283 bcm_sf2_port_intr_enable(priv, port);207 bcm_sf2_port_intr_enable(priv, port);
284 208
285 /* Set this port, and only this one to be in the default VLAN,209 /* Set per-queue pause threshold to 32 */
286 * if member of a bridge, restore its membership prior to210 core_writel(priv, 32, CORE_TXQ_THD_PAUSE_QN_PORT(port));
287 * bringing down this port.211
288 */212 /* Set ACB threshold to 24 */
289 reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port));213 for (i = 0; i < SF2_NUM_EGRESS_QUEUES; i++) {
290 reg &= ~PORT_VLAN_CTRL_MASK;214 reg = acb_readl(priv, ACB_QUEUE_CFG(port *
291 reg |= (1 << port);215 SF2_NUM_EGRESS_QUEUES + i));
292 reg |= priv->dev->ports[port].vlan_ctl_mask;216 reg &= ~XOFF_THRESHOLD_MASK;
293 core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(port));217 reg |= 24;
294 218 acb_writel(priv, reg, ACB_QUEUE_CFG(port *
295 bcm_sf2_imp_vlan_setup(ds, cpu_port);219 SF2_NUM_EGRESS_QUEUES + i));
296 220 }
297 /* If EEE was enabled, restore it */
298 if (priv->port_sts[port].eee.eee_enabled)
299 bcm_sf2_eee_enable_set(ds, port, true);
300 221
301 return 0;222 return b53_enable_port(ds, port, phy);
302}223}
303 224
304static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,225static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
@@ -321,9 +242,7 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, · 16 unmodified lines
321 else242 else
322 off = CORE_G_PCTL_PORT(port);243 off = CORE_G_PCTL_PORT(port);
323 244
324 reg = core_readl(priv, off);245 b53_disable_port(ds, port, phy);
325 reg |= RX_DIS | TX_DIS;
326 core_writel(priv, reg, off);
327 246
328 /* Power down the port memory */247 /* Power down the port memory */
329 reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);248 reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);
@@ -331,47 +250,6 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, · 1 unmodified line
331 core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);250 core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
332}251}
333 252
334/* Returns 0 if EEE was not enabled, or 1 otherwise
335 */
336static int bcm_sf2_eee_init(struct dsa_switch *ds, int port,
337 struct phy_device *phy)
338{
339 int ret;
340
341 ret = phy_init_eee(phy, 0);
342 if (ret)
343 return 0;
344
345 bcm_sf2_eee_enable_set(ds, port, true);
346
347 return 1;
348}
349
350static int bcm_sf2_sw_get_mac_eee(struct dsa_switch *ds, int port,
351 struct ethtool_eee *e)
352{
353 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
354 struct ethtool_eee *p = &priv->port_sts[port].eee;
355 u32 reg;
356
357 reg = core_readl(priv, CORE_EEE_LPI_INDICATE);
358 e->eee_enabled = p->eee_enabled;
359 e->eee_active = !!(reg & (1 << port));
360
361 return 0;
362}
363
364static int bcm_sf2_sw_set_mac_eee(struct dsa_switch *ds, int port,
365 struct ethtool_eee *e)
366{
367 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
368 struct ethtool_eee *p = &priv->port_sts[port].eee;
369
370 p->eee_enabled = e->eee_enabled;
371 bcm_sf2_eee_enable_set(ds, port, e->eee_enabled);
372
373 return 0;
374}
375 253
376static int bcm_sf2_sw_indir_rw(struct bcm_sf2_priv *priv, int op, int addr,254static int bcm_sf2_sw_indir_rw(struct bcm_sf2_priv *priv, int op, int addr,
377 int regnum, u16 val)255 int regnum, u16 val)
@@ -606,7 +484,7 @@ static void bcm_sf2_sw_adjust_link(struct dsa_switch *ds, int port, · 228 unmodified lines
606 struct phy_device *phydev)484 struct phy_device *phydev)
607{485{
608 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);486 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
609 struct ethtool_eee *p = &priv->port_sts[port].eee;487 struct ethtool_eee *p = &priv->dev->ports[port].eee;
610 u32 id_mode_dis = 0, port_mode;488 u32 id_mode_dis = 0, port_mode;
611 const char *str = NULL;489 const char *str = NULL;
612 u32 reg, offset;490 u32 reg, offset;
@@ -688,7 +566,7 @@ force_link: · 75 unmodified lines
688 core_writel(priv, reg, offset);566 core_writel(priv, reg, offset);
689 567
690 if (!phydev->is_pseudo_fixed_link)568 if (!phydev->is_pseudo_fixed_link)
691 p->eee_enabled = bcm_sf2_eee_init(ds, port, phydev);569 p->eee_enabled = b53_eee_init(ds, port, phydev);
692}570}
693 571
694static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port,572static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port,
@@ -724,7 +602,7 @@ static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, · 29 unmodified lines
724 * state machine and make it go in PHY_FORCING state instead.602 * state machine and make it go in PHY_FORCING state instead.
725 */603 */
726 if (!status->link)604 if (!status->link)
727 netif_carrier_off(ds->ports[port].netdev);605 netif_carrier_off(ds->ports[port].slave);
728 status->duplex = 1;606 status->duplex = 1;
729 } else {607 } else {
730 status->link = 1;608 status->link = 1;
@@ -749,6 +627,20 @@ static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, · 18 unmodified lines
749 status->pause = 1;627 status->pause = 1;
750}628}
751 629
630static void bcm_sf2_enable_acb(struct dsa_switch *ds)
631{
632 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
633 u32 reg;
634
635 /* Enable ACB globally */
636 reg = acb_readl(priv, ACB_CONTROL);
637 reg |= (ACB_FLUSH_MASK << ACB_FLUSH_SHIFT);
638 acb_writel(priv, reg, ACB_CONTROL);
639 reg &= ~(ACB_FLUSH_MASK << ACB_FLUSH_SHIFT);
640 reg |= ACB_EN | ACB_ALGORITHM;
641 acb_writel(priv, reg, ACB_CONTROL);
642}
643
752static int bcm_sf2_sw_suspend(struct dsa_switch *ds)644static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
753{645{
754 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);646 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
@@ -761,8 +653,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) · 6 unmodified lines
761 * bcm_sf2_sw_setup653 * bcm_sf2_sw_setup
762 */654 */
763 for (port = 0; port < DSA_MAX_PORTS; port++) {655 for (port = 0; port < DSA_MAX_PORTS; port++) {
764 if ((1 << port) & ds->enabled_port_mask ||656 if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port))
765 dsa_is_cpu_port(ds, port))
766 bcm_sf2_port_disable(ds, port, NULL);657 bcm_sf2_port_disable(ds, port, NULL);
767 }658 }
768 659
@@ -785,19 +676,21 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) · 16 unmodified lines
785 bcm_sf2_gphy_enable_set(ds, true);676 bcm_sf2_gphy_enable_set(ds, true);
786 677
787 for (port = 0; port < DSA_MAX_PORTS; port++) {678 for (port = 0; port < DSA_MAX_PORTS; port++) {
788 if ((1 << port) & ds->enabled_port_mask)679 if (dsa_is_user_port(ds, port))
789 bcm_sf2_port_setup(ds, port, NULL);680 bcm_sf2_port_setup(ds, port, NULL);
790 else if (dsa_is_cpu_port(ds, port))681 else if (dsa_is_cpu_port(ds, port))
791 bcm_sf2_imp_setup(ds, port);682 bcm_sf2_imp_setup(ds, port);
792 }683 }
793 684
685 bcm_sf2_enable_acb(ds);
686
794 return 0;687 return 0;
795}688}
796 689
797static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,690static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
798 struct ethtool_wolinfo *wol)691 struct ethtool_wolinfo *wol)
799{692{
800 struct net_device *p = ds->dst->cpu_dp->netdev;693 struct net_device *p = ds->ports[port].cpu_dp->master;
801 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);694 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
802 struct ethtool_wolinfo pwol;695 struct ethtool_wolinfo pwol;
803 696
@@ -820,9 +713,9 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, · 16 unmodified lines
820static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,713static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
821 struct ethtool_wolinfo *wol)714 struct ethtool_wolinfo *wol)
822{715{
823 struct net_device *p = ds->dst->cpu_dp->netdev;716 struct net_device *p = ds->ports[port].cpu_dp->master;
824 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);717 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
825 s8 cpu_port = ds->dst->cpu_dp->index;718 s8 cpu_port = ds->ports[port].cpu_dp->index;
826 struct ethtool_wolinfo pwol;719 struct ethtool_wolinfo pwol;
827 720
828 p->ethtool_ops->get_wol(p, &pwol);721 p->ethtool_ops->get_wol(p, &pwol);
@@ -846,45 +739,6 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, · 17 unmodified lines
846 return p->ethtool_ops->set_wol(p, wol);739 return p->ethtool_ops->set_wol(p, wol);
847}740}
848 741
849static int bcm_sf2_vlan_op_wait(struct bcm_sf2_priv *priv)
850{
851 unsigned int timeout = 10;
852 u32 reg;
853
854 do {
855 reg = core_readl(priv, CORE_ARLA_VTBL_RWCTRL);
856 if (!(reg & ARLA_VTBL_STDN))
857 return 0;
858
859 usleep_range(1000, 2000);
860 } while (timeout--);
861
862 return -ETIMEDOUT;
863}
864
865static int bcm_sf2_vlan_op(struct bcm_sf2_priv *priv, u8 op)
866{
867 core_writel(priv, ARLA_VTBL_STDN | op, CORE_ARLA_VTBL_RWCTRL);
868
869 return bcm_sf2_vlan_op_wait(priv);
870}
871
872static void bcm_sf2_sw_configure_vlan(struct dsa_switch *ds)
873{
874 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
875 unsigned int port;
876
877 /* Clear all VLANs */
878 bcm_sf2_vlan_op(priv, ARLA_VTBL_CMD_CLEAR);
879
880 for (port = 0; port < priv->hw_params.num_ports; port++) {
881 if (!((1 << port) & ds->enabled_port_mask))
882 continue;
883
884 core_writel(priv, 1, CORE_DEFAULT_1Q_TAG_P(port));
885 }
886}
887
888static int bcm_sf2_sw_setup(struct dsa_switch *ds)742static int bcm_sf2_sw_setup(struct dsa_switch *ds)
889{743{
890 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);744 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
@@ -893,7 +747,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) · 2 unmodified lines
893 /* Enable all valid ports and disable those unused */747 /* Enable all valid ports and disable those unused */
894 for (port = 0; port < priv->hw_params.num_ports; port++) {748 for (port = 0; port < priv->hw_params.num_ports; port++) {
895 /* IMP port receives special treatment */749 /* IMP port receives special treatment */
896 if ((1 << port) & ds->enabled_port_mask)750 if (dsa_is_user_port(ds, port))
897 bcm_sf2_port_setup(ds, port, NULL);751 bcm_sf2_port_setup(ds, port, NULL);
898 else if (dsa_is_cpu_port(ds, port))752 else if (dsa_is_cpu_port(ds, port))
899 bcm_sf2_imp_setup(ds, port);753 bcm_sf2_imp_setup(ds, port);
@@ -901,7 +755,8 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) · 1 unmodified line
901 bcm_sf2_port_disable(ds, port, NULL);755 bcm_sf2_port_disable(ds, port, NULL);
902 }756 }
903 757
904 bcm_sf2_sw_configure_vlan(ds);758 b53_configure_vlan(ds);
759 bcm_sf2_enable_acb(ds);
905 760
906 return 0;761 return 0;
907}762}
@@ -1020,8 +875,8 @@ static const struct dsa_switch_ops bcm_sf2_ops = { · 112 unmodified lines
1020 .set_wol = bcm_sf2_sw_set_wol,875 .set_wol = bcm_sf2_sw_set_wol,
1021 .port_enable = bcm_sf2_port_setup,876 .port_enable = bcm_sf2_port_setup,
1022 .port_disable = bcm_sf2_port_disable,877 .port_disable = bcm_sf2_port_disable,
1023 .get_mac_eee = bcm_sf2_sw_get_mac_eee,878 .get_mac_eee = b53_get_mac_eee,
1024 .set_mac_eee = bcm_sf2_sw_set_mac_eee,879 .set_mac_eee = b53_set_mac_eee,
1025 .port_bridge_join = b53_br_join,880 .port_bridge_join = b53_br_join,
1026 .port_bridge_leave = b53_br_leave,881 .port_bridge_leave = b53_br_leave,
1027 .port_stp_state_set = b53_br_set_stp_state,882 .port_stp_state_set = b53_br_set_stp_state,
@@ -1173,6 +1028,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) · 145 unmodified lines
1173 * permanently used1028 * permanently used
1174 */1029 */
1175 set_bit(0, priv->cfp.used);1030 set_bit(0, priv->cfp.used);
1031 set_bit(0, priv->cfp.unique);
1176 1032
1177 bcm_sf2_identify_ports(priv, dn->child);1033 bcm_sf2_identify_ports(priv, dn->child);
1178 1034
drivers/net/dsa/bcm_sf2.h+1−2
@@ -48,14 +48,13 @@ struct bcm_sf2_hw_params { · 47 unmodified lines
48 48
49struct bcm_sf2_port_status {49struct bcm_sf2_port_status {
50 unsigned int link;50 unsigned int link;
51
52 struct ethtool_eee eee;
53};51};
54 52
55struct bcm_sf2_cfp_priv {53struct bcm_sf2_cfp_priv {
56 /* Mutex protecting concurrent accesses to the CFP registers */54 /* Mutex protecting concurrent accesses to the CFP registers */
57 struct mutex lock;55 struct mutex lock;
58 DECLARE_BITMAP(used, CFP_NUM_RULES);56 DECLARE_BITMAP(used, CFP_NUM_RULES);
57 DECLARE_BITMAP(unique, CFP_NUM_RULES);
59 unsigned int rules_cnt;58 unsigned int rules_cnt;
60};59};
61 60
drivers/net/dsa/bcm_sf2_cfp.c+920−276
@@ -20,37 +20,102 @@ · 19 unmodified lines
20#include "bcm_sf2.h"20#include "bcm_sf2.h"
21#include "bcm_sf2_regs.h"21#include "bcm_sf2_regs.h"
22 22
23struct cfp_udf_layout {23struct cfp_udf_slice_layout {
24 u8 slices[UDF_NUM_SLICES];24 u8 slices[UDFS_PER_SLICE];
25 u32 mask_value;25 u32 mask_value;
26 u32 base_offset;
27};
26 28
29struct cfp_udf_layout {
30 struct cfp_udf_slice_layout udfs[UDF_NUM_SLICES];
27};31};
28 32
33static const u8 zero_slice[UDFS_PER_SLICE] = { };
34
29/* UDF slices layout for a TCPv4/UDPv4 specification */35/* UDF slices layout for a TCPv4/UDPv4 specification */
30static const struct cfp_udf_layout udf_tcpip4_layout = {36static const struct cfp_udf_layout udf_tcpip4_layout = {
31 .slices = {37 .udfs = {
32 /* End of L2, byte offset 12, src IP[0:15] */38 [1] = {
33 CFG_UDF_EOL2 | 6,39 .slices = {
34 /* End of L2, byte offset 14, src IP[16:31] */40 /* End of L2, byte offset 12, src IP[0:15] */
35 CFG_UDF_EOL2 | 7,41 CFG_UDF_EOL2 | 6,
36 /* End of L2, byte offset 16, dst IP[0:15] */42 /* End of L2, byte offset 14, src IP[16:31] */
37 CFG_UDF_EOL2 | 8,43 CFG_UDF_EOL2 | 7,
38 /* End of L2, byte offset 18, dst IP[16:31] */44 /* End of L2, byte offset 16, dst IP[0:15] */
39 CFG_UDF_EOL2 | 9,45 CFG_UDF_EOL2 | 8,
40 /* End of L3, byte offset 0, src port */46 /* End of L2, byte offset 18, dst IP[16:31] */
41 CFG_UDF_EOL3 | 0,47 CFG_UDF_EOL2 | 9,
42 /* End of L3, byte offset 2, dst port */48 /* End of L3, byte offset 0, src port */
43 CFG_UDF_EOL3 | 1,49 CFG_UDF_EOL3 | 0,
44 0, 0, 050 /* End of L3, byte offset 2, dst port */
51 CFG_UDF_EOL3 | 1,
52 0, 0, 0
53 },
54 .mask_value = L3_FRAMING_MASK | IPPROTO_MASK | IP_FRAG,
55 .base_offset = CORE_UDF_0_A_0_8_PORT_0 + UDF_SLICE_OFFSET,
56 },
57 },
58};
59
60/* UDF slices layout for a TCPv6/UDPv6 specification */
61static const struct cfp_udf_layout udf_tcpip6_layout = {
62 .udfs = {
63 [0] = {
64 .slices = {
65 /* End of L2, byte offset 8, src IP[0:15] */
66 CFG_UDF_EOL2 | 4,
67 /* End of L2, byte offset 10, src IP[16:31] */
68 CFG_UDF_EOL2 | 5,
69 /* End of L2, byte offset 12, src IP[32:47] */
70 CFG_UDF_EOL2 | 6,
71 /* End of L2, byte offset 14, src IP[48:63] */
72 CFG_UDF_EOL2 | 7,
73 /* End of L2, byte offset 16, src IP[64:79] */
74 CFG_UDF_EOL2 | 8,
75 /* End of L2, byte offset 18, src IP[80:95] */
76 CFG_UDF_EOL2 | 9,
77 /* End of L2, byte offset 20, src IP[96:111] */
78 CFG_UDF_EOL2 | 10,
79 /* End of L2, byte offset 22, src IP[112:127] */
80 CFG_UDF_EOL2 | 11,
81 /* End of L3, byte offset 0, src port */
82 CFG_UDF_EOL3 | 0,
83 },
84 .mask_value = L3_FRAMING_MASK | IPPROTO_MASK | IP_FRAG,
85 .base_offset = CORE_UDF_0_B_0_8_PORT_0,
86 },
87 [3] = {
88 .slices = {
89 /* End of L2, byte offset 24, dst IP[0:15] */
90 CFG_UDF_EOL2 | 12,
91 /* End of L2, byte offset 26, dst IP[16:31] */
92 CFG_UDF_EOL2 | 13,
93 /* End of L2, byte offset 28, dst IP[32:47] */
94 CFG_UDF_EOL2 | 14,
95 /* End of L2, byte offset 30, dst IP[48:63] */
96 CFG_UDF_EOL2 | 15,
97 /* End of L2, byte offset 32, dst IP[64:79] */
98 CFG_UDF_EOL2 | 16,
99 /* End of L2, byte offset 34, dst IP[80:95] */
100 CFG_UDF_EOL2 | 17,
101 /* End of L2, byte offset 36, dst IP[96:111] */
102 CFG_UDF_EOL2 | 18,
103 /* End of L2, byte offset 38, dst IP[112:127] */
104 CFG_UDF_EOL2 | 19,
105 /* End of L3, byte offset 2, dst port */
106 CFG_UDF_EOL3 | 1,
107 },
108 .mask_value = L3_FRAMING_MASK | IPPROTO_MASK | IP_FRAG,
109 .base_offset = CORE_UDF_0_D_0_11_PORT_0,
110 },
45 },111 },
46 .mask_value = L3_FRAMING_MASK | IPPROTO_MASK | IP_FRAG,
47};112};
48 113
49static inline unsigned int bcm_sf2_get_num_udf_slices(const u8 *layout)114static inline unsigned int bcm_sf2_get_num_udf_slices(const u8 *layout)
50{115{
51 unsigned int i, count = 0;116 unsigned int i, count = 0;
52 117
53 for (i = 0; i < UDF_NUM_SLICES; i++) {118 for (i = 0; i < UDFS_PER_SLICE; i++) {
54 if (layout[i] != 0)119 if (layout[i] != 0)
55 count++;120 count++;
56 }121 }
@@ -58,15 +123,42 @@ static inline unsigned int bcm_sf2_get_num_udf_slices(const u8 *layout) · 1 unmodified line
58 return count;123 return count;
59}124}
60 125
126static inline u32 udf_upper_bits(unsigned int num_udf)
127{
128 return GENMASK(num_udf - 1, 0) >> (UDFS_PER_SLICE - 1);
129}
130
131static inline u32 udf_lower_bits(unsigned int num_udf)
132{
133 return (u8)GENMASK(num_udf - 1, 0);
134}
135
136static unsigned int bcm_sf2_get_slice_number(const struct cfp_udf_layout *l,
137 unsigned int start)
138{
139 const struct cfp_udf_slice_layout *slice_layout;
140 unsigned int slice_idx;
141
142 for (slice_idx = start; slice_idx < UDF_NUM_SLICES; slice_idx++) {
143 slice_layout = &l->udfs[slice_idx];
144 if (memcmp(slice_layout->slices, zero_slice,
145 sizeof(zero_slice)))
146 break;
147 }
148
149 return slice_idx;
150}
151
61static void bcm_sf2_cfp_udf_set(struct bcm_sf2_priv *priv,152static void bcm_sf2_cfp_udf_set(struct bcm_sf2_priv *priv,
62 unsigned int slice_num,153 const struct cfp_udf_layout *layout,
63 const u8 *layout)154 unsigned int slice_num)
64{155{
65 u32 offset = CORE_UDF_0_A_0_8_PORT_0 + slice_num * UDF_SLICE_OFFSET;156 u32 offset = layout->udfs[slice_num].base_offset;
66 unsigned int i;157 unsigned int i;
67 158
68 for (i = 0; i < UDF_NUM_SLICES; i++)159 for (i = 0; i < UDFS_PER_SLICE; i++)
69 core_writel(priv, layout[i], offset + i * 4);160 core_writel(priv, layout->udfs[slice_num].slices[i],
161 offset + i * 4);
70}162}
71 163
72static int bcm_sf2_cfp_op(struct bcm_sf2_priv *priv, unsigned int op)164static int bcm_sf2_cfp_op(struct bcm_sf2_priv *priv, unsigned int op)
@@ -112,104 +204,80 @@ static inline unsigned int bcm_sf2_cfp_rule_size(struct bcm_sf2_priv *priv) · 39 unmodified lines
112 return priv->num_cfp_rules - 1;204 return priv->num_cfp_rules - 1;
113}205}
114 206
115static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,207static int bcm_sf2_cfp_act_pol_set(struct bcm_sf2_priv *priv,
116 struct ethtool_rx_flow_spec *fs)208 unsigned int rule_index,
209 unsigned int port_num,
210 unsigned int queue_num,
211 bool fwd_map_change)
117{212{
118 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
119 struct ethtool_tcpip4_spec *v4_spec;
120 const struct cfp_udf_layout *layout;
121 unsigned int slice_num, rule_index;
122 unsigned int queue_num, port_num;
123 u8 ip_proto, ip_frag;
124 u8 num_udf;
125 u32 reg;
126 int ret;213 int ret;
214 u32 reg;
127 215
128 /* Check for unsupported extensions */216 /* Replace ARL derived destination with DST_MAP derived, define
129 if ((fs->flow_type & FLOW_EXT) &&217 * which port and queue this should be forwarded to.
130 (fs->m_ext.vlan_etype || fs->m_ext.data[1]))218 */
131 return -EINVAL;219 if (fwd_map_change)
132 220 reg = CHANGE_FWRD_MAP_IB_REP_ARL |
133 if (fs->location != RX_CLS_LOC_ANY &&221 BIT(port_num + DST_MAP_IB_SHIFT) |
134 test_bit(fs->location, priv->cfp.used))222 CHANGE_TC | queue_num << NEW_TC_SHIFT;
135 return -EBUSY;223 else
136 224 reg = 0;
137 if (fs->location != RX_CLS_LOC_ANY &&
138 fs->location > bcm_sf2_cfp_rule_size(priv))
139 return -EINVAL;
140 225
141 ip_frag = be32_to_cpu(fs->m_ext.data[0]);226 core_writel(priv, reg, CORE_ACT_POL_DATA0);
142 227
143 /* We do not support discarding packets, check that the228 /* Set classification ID that needs to be put in Broadcom tag */
144 * destination port is enabled and that we are within the229 core_writel(priv, rule_index << CHAIN_ID_SHIFT, CORE_ACT_POL_DATA1);
145 * number of ports supported by the switch
146 */
147 port_num = fs->ring_cookie / 8;
148 230
149 if (fs->ring_cookie == RX_CLS_FLOW_DISC ||231 core_writel(priv, 0, CORE_ACT_POL_DATA2);
150 !(BIT(port_num) & ds->enabled_port_mask) ||
151 port_num >= priv->hw_params.num_ports)
152 return -EINVAL;
153 232
154 switch (fs->flow_type & ~FLOW_EXT) {233 /* Configure policer RAM now */
155 case TCP_V4_FLOW:234 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | ACT_POL_RAM);
156 ip_proto = IPPROTO_TCP;235 if (ret) {
157 v4_spec = &fs->h_u.tcp_ip4_spec;236 pr_err("Policer entry at %d failed\n", rule_index);
158 break;237 return ret;
159 case UDP_V4_FLOW:
160 ip_proto = IPPROTO_UDP;
161 v4_spec = &fs->h_u.udp_ip4_spec;
162 break;
163 default:
164 return -EINVAL;
165 }238 }
166 239
167 /* We only use one UDF slice for now */240 /* Disable the policer */
168 slice_num = 1;241 core_writel(priv, POLICER_MODE_DISABLE, CORE_RATE_METER0);
169 layout = &udf_tcpip4_layout;
170 num_udf = bcm_sf2_get_num_udf_slices(layout->slices);
171
172 /* Apply the UDF layout for this filter */
173 bcm_sf2_cfp_udf_set(priv, slice_num, layout->slices);
174 242
175 /* Apply to all packets received through this port */243 /* Now the rate meter */
176 core_writel(priv, BIT(port), CORE_CFP_DATA_PORT(7));244 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | RATE_METER_RAM);
245 if (ret) {
246 pr_err("Meter entry at %d failed\n", rule_index);
247 return ret;
248 }
177 249
178 /* S-Tag status [31:30]250 return 0;
179 * C-Tag status [29:28]251}
180 * L2 framing [27:26]
181 * L3 framing [25:24]
182 * IP ToS [23:16]
183 * IP proto [15:08]
184 * IP Fragm [7]
185 * Non 1st frag [6]
186 * IP Authen [5]
187 * TTL range [4:3]
188 * PPPoE session [2]
189 * Reserved [1]
190 * UDF_Valid[8] [0]
191 */
192 core_writel(priv, v4_spec->tos << 16 | ip_proto << 8 | ip_frag << 7,
193 CORE_CFP_DATA_PORT(6));
194 252
195 /* UDF_Valid[7:0] [31:24]253static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv,
196 * S-Tag [23:8]254 struct ethtool_tcpip4_spec *v4_spec,
197 * C-Tag [7:0]255 unsigned int slice_num,
198 */256 bool mask)
199 core_writel(priv, GENMASK(num_udf - 1, 0) << 24, CORE_CFP_DATA_PORT(5));257{
258 u32 reg, offset;
200 259
201 /* C-Tag [31:24]260 /* C-Tag [31:24]
202 * UDF_n_A8 [23:8]261 * UDF_n_A8 [23:8]
203 * UDF_n_A7 [7:0]262 * UDF_n_A7 [7:0]
204 */263 */
205 core_writel(priv, 0, CORE_CFP_DATA_PORT(4));264 reg = 0;
265 if (mask)
266 offset = CORE_CFP_MASK_PORT(4);
267 else
268 offset = CORE_CFP_DATA_PORT(4);
269 core_writel(priv, reg, offset);
206 270
207 /* UDF_n_A7 [31:24]271 /* UDF_n_A7 [31:24]
208 * UDF_n_A6 [23:8]272 * UDF_n_A6 [23:8]
209 * UDF_n_A5 [7:0]273 * UDF_n_A5 [7:0]
210 */274 */
211 core_writel(priv, be16_to_cpu(v4_spec->pdst) >> 8,275 reg = be16_to_cpu(v4_spec->pdst) >> 8;
212 CORE_CFP_DATA_PORT(3));276 if (mask)
277 offset = CORE_CFP_MASK_PORT(3);
278 else
279 offset = CORE_CFP_DATA_PORT(3);
280 core_writel(priv, reg, offset);
213 281
214 /* UDF_n_A5 [31:24]282 /* UDF_n_A5 [31:24]
215 * UDF_n_A4 [23:8]283 * UDF_n_A4 [23:8]
@@ -218,7 +286,11 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, · 2 unmodified lines
218 reg = (be16_to_cpu(v4_spec->pdst) & 0xff) << 24 |286 reg = (be16_to_cpu(v4_spec->pdst) & 0xff) << 24 |
219 (u32)be16_to_cpu(v4_spec->psrc) << 8 |287 (u32)be16_to_cpu(v4_spec->psrc) << 8 |
220 (be32_to_cpu(v4_spec->ip4dst) & 0x0000ff00) >> 8;288 (be32_to_cpu(v4_spec->ip4dst) & 0x0000ff00) >> 8;
221 core_writel(priv, reg, CORE_CFP_DATA_PORT(2));289 if (mask)
290 offset = CORE_CFP_MASK_PORT(2);
291 else
292 offset = CORE_CFP_DATA_PORT(2);
293 core_writel(priv, reg, offset);
222 294
223 /* UDF_n_A3 [31:24]295 /* UDF_n_A3 [31:24]
224 * UDF_n_A2 [23:8]296 * UDF_n_A2 [23:8]
@@ -227,7 +299,11 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, · 2 unmodified lines
227 reg = (u32)(be32_to_cpu(v4_spec->ip4dst) & 0xff) << 24 |299 reg = (u32)(be32_to_cpu(v4_spec->ip4dst) & 0xff) << 24 |
228 (u32)(be32_to_cpu(v4_spec->ip4dst) >> 16) << 8 |300 (u32)(be32_to_cpu(v4_spec->ip4dst) >> 16) << 8 |
229 (be32_to_cpu(v4_spec->ip4src) & 0x0000ff00) >> 8;301 (be32_to_cpu(v4_spec->ip4src) & 0x0000ff00) >> 8;
230 core_writel(priv, reg, CORE_CFP_DATA_PORT(1));302 if (mask)
303 offset = CORE_CFP_MASK_PORT(1);
304 else
305 offset = CORE_CFP_DATA_PORT(1);
306 core_writel(priv, reg, offset);
231 307
232 /* UDF_n_A1 [31:24]308 /* UDF_n_A1 [31:24]
233 * UDF_n_A0 [23:8]309 * UDF_n_A0 [23:8]
@@ -238,25 +314,42 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, · 4 unmodified lines
238 reg = (u32)(be32_to_cpu(v4_spec->ip4src) & 0xff) << 24 |314 reg = (u32)(be32_to_cpu(v4_spec->ip4src) & 0xff) << 24 |
239 (u32)(be32_to_cpu(v4_spec->ip4src) >> 16) << 8 |315 (u32)(be32_to_cpu(v4_spec->ip4src) >> 16) << 8 |
240 SLICE_NUM(slice_num) | SLICE_VALID;316 SLICE_NUM(slice_num) | SLICE_VALID;
241 core_writel(priv, reg, CORE_CFP_DATA_PORT(0));317 if (mask)
242 318 offset = CORE_CFP_MASK_PORT(0);
243 /* Source port map match */319 else
244 core_writel(priv, 0xff, CORE_CFP_MASK_PORT(7));320 offset = CORE_CFP_DATA_PORT(0);
245 321 core_writel(priv, reg, offset);
246 /* Mask with the specific layout for IPv4 packets */322}
247 core_writel(priv, layout->mask_value, CORE_CFP_MASK_PORT(6));
248 323
249 /* Mask all but valid UDFs */324static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port,
250 core_writel(priv, GENMASK(num_udf - 1, 0) << 24, CORE_CFP_MASK_PORT(5));325 unsigned int port_num,
326 unsigned int queue_num,
327 struct ethtool_rx_flow_spec *fs)
328{
329 struct ethtool_tcpip4_spec *v4_spec, *v4_m_spec;
330 const struct cfp_udf_layout *layout;
331 unsigned int slice_num, rule_index;
332 u8 ip_proto, ip_frag;
333 u8 num_udf;
334 u32 reg;
335 int ret;
251 336
252 /* Mask all */337 switch (fs->flow_type & ~FLOW_EXT) {
253 core_writel(priv, 0, CORE_CFP_MASK_PORT(4));338 case TCP_V4_FLOW:
339 ip_proto = IPPROTO_TCP;
340 v4_spec = &fs->h_u.tcp_ip4_spec;
341 v4_m_spec = &fs->m_u.tcp_ip4_spec;
342 break;
343 case UDP_V4_FLOW:
344 ip_proto = IPPROTO_UDP;
345 v4_spec = &fs->h_u.udp_ip4_spec;
346 v4_m_spec = &fs->m_u.udp_ip4_spec;
347 break;
348 default:
349 return -EINVAL;
350 }
254 351
255 /* All other UDFs should be matched with the filter */352 ip_frag = be32_to_cpu(fs->m_ext.data[0]);
256 core_writel(priv, 0xff, CORE_CFP_MASK_PORT(3));
257 core_writel(priv, 0xffffffff, CORE_CFP_MASK_PORT(2));
258 core_writel(priv, 0xffffffff, CORE_CFP_MASK_PORT(1));
259 core_writel(priv, 0xffffff0f, CORE_CFP_MASK_PORT(0));
260 353
261 /* Locate the first rule available */354 /* Locate the first rule available */
262 if (fs->location == RX_CLS_LOC_ANY)355 if (fs->location == RX_CLS_LOC_ANY)
@@ -265,52 +358,73 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, · 2 unmodified lines
265 else358 else
266 rule_index = fs->location;359 rule_index = fs->location;
267 360
268 /* Insert into TCAM now */361 layout = &udf_tcpip4_layout;
269 bcm_sf2_cfp_rule_addr_set(priv, rule_index);362 /* We only use one UDF slice for now */
363 slice_num = bcm_sf2_get_slice_number(layout, 0);
364 if (slice_num == UDF_NUM_SLICES)
365 return -EINVAL;
270 366
271 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | TCAM_SEL);367 num_udf = bcm_sf2_get_num_udf_slices(layout->udfs[slice_num].slices);
272 if (ret) {
273 pr_err("TCAM entry at addr %d failed\n", rule_index);
274 return ret;
275 }
276 368
277 /* Replace ARL derived destination with DST_MAP derived, define369 /* Apply the UDF layout for this filter */
278 * which port and queue this should be forwarded to.370 bcm_sf2_cfp_udf_set(priv, layout, slice_num);
279 *371
280 * We have a small oddity where Port 6 just does not have a372 /* Apply to all packets received through this port */
281 * valid bit here (so we subtract by one).373 core_writel(priv, BIT(port), CORE_CFP_DATA_PORT(7));
374
375 /* Source port map match */
376 core_writel(priv, 0xff, CORE_CFP_MASK_PORT(7));
377
378 /* S-Tag status [31:30]
379 * C-Tag status [29:28]
380 * L2 framing [27:26]
381 * L3 framing [25:24]
382 * IP ToS [23:16]
383 * IP proto [15:08]
384 * IP Fragm [7]
385 * Non 1st frag [6]
386 * IP Authen [5]
387 * TTL range [4:3]
388 * PPPoE session [2]
389 * Reserved [1]
390 * UDF_Valid[8] [0]
282 */391 */
283 queue_num = fs->ring_cookie % 8;392 core_writel(priv, v4_spec->tos << IPTOS_SHIFT |
284 if (port_num >= 7)393 ip_proto << IPPROTO_SHIFT | ip_frag << IP_FRAG_SHIFT |
285 port_num -= 1;394 udf_upper_bits(num_udf),
395 CORE_CFP_DATA_PORT(6));
286 396
287 reg = CHANGE_FWRD_MAP_IB_REP_ARL | BIT(port_num + DST_MAP_IB_SHIFT) |397 /* Mask with the specific layout for IPv4 packets */
288 CHANGE_TC | queue_num << NEW_TC_SHIFT;398 core_writel(priv, layout->udfs[slice_num].mask_value |
399 udf_upper_bits(num_udf), CORE_CFP_MASK_PORT(6));
289 400
290 core_writel(priv, reg, CORE_ACT_POL_DATA0);401 /* UDF_Valid[7:0] [31:24]
402 * S-Tag [23:8]
403 * C-Tag [7:0]
404 */
405 core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5));
291 406
292 /* Set classification ID that needs to be put in Broadcom tag */407 /* Mask all but valid UDFs */
293 core_writel(priv, rule_index << CHAIN_ID_SHIFT,408 core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5));
294 CORE_ACT_POL_DATA1);
295 409
296 core_writel(priv, 0, CORE_ACT_POL_DATA2);410 /* Program the match and the mask */
411 bcm_sf2_cfp_slice_ipv4(priv, v4_spec, slice_num, false);
412 bcm_sf2_cfp_slice_ipv4(priv, v4_m_spec, SLICE_NUM_MASK, true);
297 413
298 /* Configure policer RAM now */414 /* Insert into TCAM now */
299 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | ACT_POL_RAM);415 bcm_sf2_cfp_rule_addr_set(priv, rule_index);
416
417 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | TCAM_SEL);
300 if (ret) {418 if (ret) {
301 pr_err("Policer entry at %d failed\n", rule_index);419 pr_err("TCAM entry at addr %d failed\n", rule_index);
302 return ret;420 return ret;
303 }421 }
304 422
305 /* Disable the policer */423 /* Insert into Action and policer RAMs now */
306 core_writel(priv, POLICER_MODE_DISABLE, CORE_RATE_METER0);424 ret = bcm_sf2_cfp_act_pol_set(priv, rule_index, port_num,
307 425 queue_num, true);
308 /* Now the rate meter */426 if (ret)
309 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | RATE_METER_RAM);
310 if (ret) {
311 pr_err("Meter entry at %d failed\n", rule_index);
312 return ret;427 return ret;
313 }
314 428
315 /* Turn on CFP for this rule now */429 /* Turn on CFP for this rule now */
316 reg = core_readl(priv, CORE_CFP_CTL_REG);430 reg = core_readl(priv, CORE_CFP_CTL_REG);
@@ -319,143 +433,480 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, · 2 unmodified lines
319 433
320 /* Flag the rule as being used and return it */434 /* Flag the rule as being used and return it */
321 set_bit(rule_index, priv->cfp.used);435 set_bit(rule_index, priv->cfp.used);
436 set_bit(rule_index, priv->cfp.unique);
322 fs->location = rule_index;437 fs->location = rule_index;
323 438
324 return 0;439 return 0;
325}440}
326 441
327static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port,442static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv,
328 u32 loc)443 const __be32 *ip6_addr, const __be16 port,
444 unsigned int slice_num,
445 bool mask)
329{446{
330 int ret;447 u32 reg, tmp, val, offset;
331 u32 reg;
332
333 /* Refuse deletion of unused rules, and the default reserved rule */
334 if (!test_bit(loc, priv->cfp.used) || loc == 0)
335 return -EINVAL;
336
337 /* Indicate which rule we want to read */
338 bcm_sf2_cfp_rule_addr_set(priv, loc);
339 448
340 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | TCAM_SEL);449 /* C-Tag [31:24]
341 if (ret)450 * UDF_n_B8 [23:8] (port)
342 return ret;451 * UDF_n_B7 (upper) [7:0] (addr[15:8])
452 */
453 reg = be32_to_cpu(ip6_addr[3]);
454 val = (u32)be16_to_cpu(port) << 8 | ((reg >> 8) & 0xff);
455 if (mask)
456 offset = CORE_CFP_MASK_PORT(4);
457 else
458 offset = CORE_CFP_DATA_PORT(4);
459 core_writel(priv, val, offset);
343 460
344 /* Clear its valid bits */461 /* UDF_n_B7 (lower) [31:24] (addr[7:0])
345 reg = core_readl(priv, CORE_CFP_DATA_PORT(0));462 * UDF_n_B6 [23:8] (addr[31:16])
346 reg &= ~SLICE_VALID;463 * UDF_n_B5 (upper) [7:0] (addr[47:40])
347 core_writel(priv, reg, CORE_CFP_DATA_PORT(0));464 */
465 tmp = be32_to_cpu(ip6_addr[2]);
466 val = (u32)(reg & 0xff) << 24 | (u32)(reg >> 16) << 8 |
467 ((tmp >> 8) & 0xff);
468 if (mask)
469 offset = CORE_CFP_MASK_PORT(3);
470 else
471 offset = CORE_CFP_DATA_PORT(3);
472 core_writel(priv, val, offset);
348 473
349 /* Write back this entry into the TCAM now */474 /* UDF_n_B5 (lower) [31:24] (addr[39:32])
350 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | TCAM_SEL);475 * UDF_n_B4 [23:8] (addr[63:48])
351 if (ret)476 * UDF_n_B3 (upper) [7:0] (addr[79:72])
352 return ret;477 */
478 reg = be32_to_cpu(ip6_addr[1]);
479 val = (u32)(tmp & 0xff) << 24 | (u32)(tmp >> 16) << 8 |
480 ((reg >> 8) & 0xff);
481 if (mask)
482 offset = CORE_CFP_MASK_PORT(2);
483 else
484 offset = CORE_CFP_DATA_PORT(2);
485 core_writel(priv, val, offset);
353 486
354 clear_bit(loc, priv->cfp.used);487 /* UDF_n_B3 (lower) [31:24] (addr[71:64])
488 * UDF_n_B2 [23:8] (addr[95:80])
489 * UDF_n_B1 (upper) [7:0] (addr[111:104])
490 */
491 tmp = be32_to_cpu(ip6_addr[0]);
492 val = (u32)(reg & 0xff) << 24 | (u32)(reg >> 16) << 8 |
493 ((tmp >> 8) & 0xff);
494 if (mask)
495 offset = CORE_CFP_MASK_PORT(1);
496 else
497 offset = CORE_CFP_DATA_PORT(1);
498 core_writel(priv, val, offset);
355 499
356 return 0;500 /* UDF_n_B1 (lower) [31:24] (addr[103:96])
501 * UDF_n_B0 [23:8] (addr[127:112])
502 * Reserved [7:4]
503 * Slice ID [3:2]
504 * Slice valid [1:0]
505 */
506 reg = (u32)(tmp & 0xff) << 24 | (u32)(tmp >> 16) << 8 |
507 SLICE_NUM(slice_num) | SLICE_VALID;
508 if (mask)
509 offset = CORE_CFP_MASK_PORT(0);
510 else
511 offset = CORE_CFP_DATA_PORT(0);
512 core_writel(priv, reg, offset);
357}513}
358 514
359static void bcm_sf2_invert_masks(struct ethtool_rx_flow_spec *flow)515static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port,
516 unsigned int port_num,
517 unsigned int queue_num,
518 struct ethtool_rx_flow_spec *fs)
360{519{
361 unsigned int i;520 struct ethtool_tcpip6_spec *v6_spec, *v6_m_spec;
362 521 unsigned int slice_num, rule_index[2];
363 for (i = 0; i < sizeof(flow->m_u); i++)522 const struct cfp_udf_layout *layout;
364 flow->m_u.hdata[i] ^= 0xff;523 u8 ip_proto, ip_frag;
524 int ret = 0;
525 u8 num_udf;
526 u32 reg;
365 527
366 flow->m_ext.vlan_etype ^= cpu_to_be16(~0);528 switch (fs->flow_type & ~FLOW_EXT) {
367 flow->m_ext.vlan_tci ^= cpu_to_be16(~0);529 case TCP_V6_FLOW:
368 flow->m_ext.data[0] ^= cpu_to_be32(~0);530 ip_proto = IPPROTO_TCP;
369 flow->m_ext.data[1] ^= cpu_to_be32(~0);531 v6_spec = &fs->h_u.tcp_ip6_spec;
370}532 v6_m_spec = &fs->m_u.tcp_ip6_spec;
533 break;
534 case UDP_V6_FLOW:
535 ip_proto = IPPROTO_UDP;
536 v6_spec = &fs->h_u.udp_ip6_spec;
537 v6_m_spec = &fs->m_u.udp_ip6_spec;
538 break;
539 default:
540 return -EINVAL;
541 }
371 542
372static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port,543 ip_frag = be32_to_cpu(fs->m_ext.data[0]);
373 struct ethtool_rxnfc *nfc, bool search)
374{
375 struct ethtool_tcpip4_spec *v4_spec;
376 unsigned int queue_num;
377 u16 src_dst_port;
378 u32 reg, ipv4;
379 int ret;
380 544
381 if (!search) {545 layout = &udf_tcpip6_layout;
382 bcm_sf2_cfp_rule_addr_set(priv, nfc->fs.location);546 slice_num = bcm_sf2_get_slice_number(layout, 0);
547 if (slice_num == UDF_NUM_SLICES)
548 return -EINVAL;
383 549
384 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | ACT_POL_RAM);550 num_udf = bcm_sf2_get_num_udf_slices(layout->udfs[slice_num].slices);
385 if (ret)551
386 return ret;552 /* Negotiate two indexes, one for the second half which we are chained
553 * from, which is what we will return to user-space, and a second one
554 * which is used to store its first half. That first half does not
555 * allow any choice of placement, so it just needs to find the next
556 * available bit. We return the second half as fs->location because
557 * that helps with the rule lookup later on since the second half is
558 * chained from its first half, we can easily identify IPv6 CFP rules
559 * by looking whether they carry a CHAIN_ID.
560 *
561 * We also want the second half to have a lower rule_index than its
562 * first half because the HW search is by incrementing addresses.
563 */
564 if (fs->location == RX_CLS_LOC_ANY)
565 rule_index[0] = find_first_zero_bit(priv->cfp.used,
566 bcm_sf2_cfp_rule_size(priv));
567 else
568 rule_index[0] = fs->location;
387 569
388 reg = core_readl(priv, CORE_ACT_POL_DATA0);570 /* Flag it as used (cleared on error path) such that we can immediately
571 * obtain a second one to chain from.
572 */
573 set_bit(rule_index[0], priv->cfp.used);
389 574
390 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | TCAM_SEL);575 rule_index[1] = find_first_zero_bit(priv->cfp.used,
391 if (ret)576 bcm_sf2_cfp_rule_size(priv));
392 return ret;577 if (rule_index[1] > bcm_sf2_cfp_rule_size(priv)) {
393 } else {578 ret = -ENOSPC;
394 reg = core_readl(priv, CORE_ACT_POL_DATA0);579 goto out_err;
395 }580 }
396 581
397 /* Extract the destination port */582 /* Apply the UDF layout for this filter */
398 nfc->fs.ring_cookie = fls((reg >> DST_MAP_IB_SHIFT) &583 bcm_sf2_cfp_udf_set(priv, layout, slice_num);
399 DST_MAP_IB_MASK) - 1;
400 584
401 /* There is no Port 6, so we compensate for that here */585 /* Apply to all packets received through this port */
402 if (nfc->fs.ring_cookie >= 6)586 core_writel(priv, BIT(port), CORE_CFP_DATA_PORT(7));
403 nfc->fs.ring_cookie++;
404 nfc->fs.ring_cookie *= 8;
405 587
406 /* Extract the destination queue */588 /* Source port map match */
407 queue_num = (reg >> NEW_TC_SHIFT) & NEW_TC_MASK;589 core_writel(priv, 0xff, CORE_CFP_MASK_PORT(7));
408 nfc->fs.ring_cookie += queue_num;
409 590
410 /* Extract the IP protocol */591 /* S-Tag status [31:30]
411 reg = core_readl(priv, CORE_CFP_DATA_PORT(6));592 * C-Tag status [29:28]
412 switch ((reg & IPPROTO_MASK) >> IPPROTO_SHIFT) {593 * L2 framing [27:26]
413 case IPPROTO_TCP:594 * L3 framing [25:24]
414 nfc->fs.flow_type = TCP_V4_FLOW;595 * IP ToS [23:16]
415 v4_spec = &nfc->fs.h_u.tcp_ip4_spec;596 * IP proto [15:08]
597 * IP Fragm [7]
598 * Non 1st frag [6]
599 * IP Authen [5]
600 * TTL range [4:3]
601 * PPPoE session [2]
602 * Reserved [1]
603 * UDF_Valid[8] [0]
604 */
605 reg = 1 << L3_FRAMING_SHIFT | ip_proto << IPPROTO_SHIFT |
606 ip_frag << IP_FRAG_SHIFT | udf_upper_bits(num_udf);
607 core_writel(priv, reg, CORE_CFP_DATA_PORT(6));
608
609 /* Mask with the specific layout for IPv6 packets including
610 * UDF_Valid[8]
611 */
612 reg = layout->udfs[slice_num].mask_value | udf_upper_bits(num_udf);
613 core_writel(priv, reg, CORE_CFP_MASK_PORT(6));
614
615 /* UDF_Valid[7:0] [31:24]
616 * S-Tag [23:8]
617 * C-Tag [7:0]
618 */
619 core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5));
620
621 /* Mask all but valid UDFs */
622 core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5));
623
624 /* Slice the IPv6 source address and port */
625 bcm_sf2_cfp_slice_ipv6(priv, v6_spec->ip6src, v6_spec->psrc,
626 slice_num, false);
627 bcm_sf2_cfp_slice_ipv6(priv, v6_m_spec->ip6src, v6_m_spec->psrc,
628 slice_num, true);
629
630 /* Insert into TCAM now because we need to insert a second rule */
631 bcm_sf2_cfp_rule_addr_set(priv, rule_index[0]);
632
633 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | TCAM_SEL);
634 if (ret) {
635 pr_err("TCAM entry at addr %d failed\n", rule_index[0]);
636 goto out_err;
637 }
638
639 /* Insert into Action and policer RAMs now */
640 ret = bcm_sf2_cfp_act_pol_set(priv, rule_index[0], port_num,
641 queue_num, false);
642 if (ret)
643 goto out_err;
644
645 /* Now deal with the second slice to chain this rule */
646 slice_num = bcm_sf2_get_slice_number(layout, slice_num + 1);
647 if (slice_num == UDF_NUM_SLICES) {
648 ret = -EINVAL;
649 goto out_err;
650 }
651
652 num_udf = bcm_sf2_get_num_udf_slices(layout->udfs[slice_num].slices);
653
654 /* Apply the UDF layout for this filter */
655 bcm_sf2_cfp_udf_set(priv, layout, slice_num);
656
657 /* Chained rule, source port match is coming from the rule we are
658 * chained from.
659 */
660 core_writel(priv, 0, CORE_CFP_DATA_PORT(7));
661 core_writel(priv, 0, CORE_CFP_MASK_PORT(7));
662
663 /*
664 * CHAIN ID [31:24] chain to previous slice
665 * Reserved [23:20]
666 * UDF_Valid[11:8] [19:16]
667 * UDF_Valid[7:0] [15:8]
668 * UDF_n_D11 [7:0]
669 */
670 reg = rule_index[0] << 24 | udf_upper_bits(num_udf) << 16 |
671 udf_lower_bits(num_udf) << 8;
672 core_writel(priv, reg, CORE_CFP_DATA_PORT(6));
673
674 /* Mask all except chain ID, UDF Valid[8] and UDF Valid[7:0] */
675 reg = XCESS_ADDR_MASK << 24 | udf_upper_bits(num_udf) << 16 |
676 udf_lower_bits(num_udf) << 8;
677 core_writel(priv, reg, CORE_CFP_MASK_PORT(6));
678
679 /* Don't care */
680 core_writel(priv, 0, CORE_CFP_DATA_PORT(5));
681
682 /* Mask all */
683 core_writel(priv, 0, CORE_CFP_MASK_PORT(5));
684
685 bcm_sf2_cfp_slice_ipv6(priv, v6_spec->ip6dst, v6_spec->pdst, slice_num,
686 false);
687 bcm_sf2_cfp_slice_ipv6(priv, v6_m_spec->ip6dst, v6_m_spec->pdst,
688 SLICE_NUM_MASK, true);
689
690 /* Insert into TCAM now */
691 bcm_sf2_cfp_rule_addr_set(priv, rule_index[1]);
692
693 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | TCAM_SEL);
694 if (ret) {
695 pr_err("TCAM entry at addr %d failed\n", rule_index[1]);
696 goto out_err;
697 }
698
699 /* Insert into Action and policer RAMs now, set chain ID to
700 * the one we are chained to
701 */
702 ret = bcm_sf2_cfp_act_pol_set(priv, rule_index[0], port_num,
703 queue_num, true);
704 if (ret)
705 goto out_err;
706
707 /* Turn on CFP for this rule now */
708 reg = core_readl(priv, CORE_CFP_CTL_REG);
709 reg |= BIT(port);
710 core_writel(priv, reg, CORE_CFP_CTL_REG);
711
712 /* Flag the second half rule as being used now, return it as the
713 * location, and flag it as unique while dumping rules
714 */
715 set_bit(rule_index[1], priv->cfp.used);
716 set_bit(rule_index[1], priv->cfp.unique);
717 fs->location = rule_index[1];
718
719 return ret;
720
721out_err:
722 clear_bit(rule_index[0], priv->cfp.used);
723 return ret;
724}
725
726static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
727 struct ethtool_rx_flow_spec *fs)
728{
729 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
730 unsigned int queue_num, port_num;
731 int ret = -EINVAL;
732
733 /* Check for unsupported extensions */
734 if ((fs->flow_type & FLOW_EXT) && (fs->m_ext.vlan_etype ||
735 fs->m_ext.data[1]))
736 return -EINVAL;
737
738 if (fs->location != RX_CLS_LOC_ANY &&
739 test_bit(fs->location, priv->cfp.used))
740 return -EBUSY;
741
742 if (fs->location != RX_CLS_LOC_ANY &&
743 fs->location > bcm_sf2_cfp_rule_size(priv))
744 return -EINVAL;
745
746 /* We do not support discarding packets, check that the
747 * destination port is enabled and that we are within the
748 * number of ports supported by the switch
749 */
750 port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
751
752 if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
753 !dsa_is_user_port(ds, port_num) ||
754 port_num >= priv->hw_params.num_ports)
755 return -EINVAL;
756 /*
757 * We have a small oddity where Port 6 just does not have a
758 * valid bit here (so we substract by one).
759 */
760 queue_num = fs->ring_cookie % SF2_NUM_EGRESS_QUEUES;
761 if (port_num >= 7)
762 port_num -= 1;
763
764 switch (fs->flow_type & ~FLOW_EXT) {
765 case TCP_V4_FLOW:
766 case UDP_V4_FLOW:
767 ret = bcm_sf2_cfp_ipv4_rule_set(priv, port, port_num,
768 queue_num, fs);
416 break;769 break;
417 case IPPROTO_UDP:770 case TCP_V6_FLOW:
418 nfc->fs.flow_type = UDP_V4_FLOW;771 case UDP_V6_FLOW:
419 v4_spec = &nfc->fs.h_u.udp_ip4_spec;772 ret = bcm_sf2_cfp_ipv6_rule_set(priv, port, port_num,
773 queue_num, fs);
420 break;774 break;
421 default:775 default:
422 /* Clear to exit the search process */776 break;
423 if (search)
424 core_readl(priv, CORE_CFP_DATA_PORT(7));
425 return -EINVAL;
426 }777 }
427 778
428 v4_spec->tos = (reg >> 16) & IPPROTO_MASK;779 return ret;
429 nfc->fs.m_ext.data[0] = cpu_to_be32((reg >> 7) & 1);780}
781
782static int bcm_sf2_cfp_rule_del_one(struct bcm_sf2_priv *priv, int port,
783 u32 loc, u32 *next_loc)
784{
785 int ret;
786 u32 reg;
430 787
431 reg = core_readl(priv, CORE_CFP_DATA_PORT(3));788 /* Refuse deletion of unused rules, and the default reserved rule */
789 if (!test_bit(loc, priv->cfp.used) || loc == 0)
790 return -EINVAL;
791
792 /* Indicate which rule we want to read */
793 bcm_sf2_cfp_rule_addr_set(priv, loc);
794
795 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | TCAM_SEL);
796 if (ret)
797 return ret;
798
799 /* Check if this is possibly an IPv6 rule that would
800 * indicate we need to delete its companion rule
801 * as well
802 */
803 reg = core_readl(priv, CORE_CFP_DATA_PORT(6));
804 if (next_loc)
805 *next_loc = (reg >> 24) & CHAIN_ID_MASK;
806
807 /* Clear its valid bits */
808 reg = core_readl(priv, CORE_CFP_DATA_PORT(0));
809 reg &= ~SLICE_VALID;
810 core_writel(priv, reg, CORE_CFP_DATA_PORT(0));
811
812 /* Write back this entry into the TCAM now */
813 ret = bcm_sf2_cfp_op(priv, OP_SEL_WRITE | TCAM_SEL);
814 if (ret)
815 return ret;
816
817 clear_bit(loc, priv->cfp.used);
818 clear_bit(loc, priv->cfp.unique);
819
820 return 0;
821}
822
823static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port,
824 u32 loc)
825{
826 u32 next_loc = 0;
827 int ret;
828
829 ret = bcm_sf2_cfp_rule_del_one(priv, port, loc, &next_loc);
830 if (ret)
831 return ret;
832
833 /* If this was an IPv6 rule, delete is companion rule too */
834 if (next_loc)
835 ret = bcm_sf2_cfp_rule_del_one(priv, port, next_loc, NULL);
836
837 return ret;
838}
839
840static void bcm_sf2_invert_masks(struct ethtool_rx_flow_spec *flow)
841{
842 unsigned int i;
843
844 for (i = 0; i < sizeof(flow->m_u); i++)
845 flow->m_u.hdata[i] ^= 0xff;
846
847 flow->m_ext.vlan_etype ^= cpu_to_be16(~0);
848 flow->m_ext.vlan_tci ^= cpu_to_be16(~0);
849 flow->m_ext.data[0] ^= cpu_to_be32(~0);
850 flow->m_ext.data[1] ^= cpu_to_be32(~0);
851}
852
853static int bcm_sf2_cfp_unslice_ipv4(struct bcm_sf2_priv *priv,
854 struct ethtool_tcpip4_spec *v4_spec,
855 bool mask)
856{
857 u32 reg, offset, ipv4;
858 u16 src_dst_port;
859
860 if (mask)
861 offset = CORE_CFP_MASK_PORT(3);
862 else
863 offset = CORE_CFP_DATA_PORT(3);
864
865 reg = core_readl(priv, offset);
432 /* src port [15:8] */866 /* src port [15:8] */
433 src_dst_port = reg << 8;867 src_dst_port = reg << 8;
434 868
435 reg = core_readl(priv, CORE_CFP_DATA_PORT(2));869 if (mask)
870 offset = CORE_CFP_MASK_PORT(2);
871 else
872 offset = CORE_CFP_DATA_PORT(2);
873
874 reg = core_readl(priv, offset);
436 /* src port [7:0] */875 /* src port [7:0] */
437 src_dst_port |= (reg >> 24);876 src_dst_port |= (reg >> 24);
438 877
439 v4_spec->pdst = cpu_to_be16(src_dst_port);878 v4_spec->pdst = cpu_to_be16(src_dst_port);
440 nfc->fs.m_u.tcp_ip4_spec.pdst = cpu_to_be16(~0);
441 v4_spec->psrc = cpu_to_be16((u16)(reg >> 8));879 v4_spec->psrc = cpu_to_be16((u16)(reg >> 8));
442 nfc->fs.m_u.tcp_ip4_spec.psrc = cpu_to_be16(~0);
443 880
444 /* IPv4 dst [15:8] */881 /* IPv4 dst [15:8] */
445 ipv4 = (reg & 0xff) << 8;882 ipv4 = (reg & 0xff) << 8;
446 reg = core_readl(priv, CORE_CFP_DATA_PORT(1));883
884 if (mask)
885 offset = CORE_CFP_MASK_PORT(1);
886 else
887 offset = CORE_CFP_DATA_PORT(1);
888
889 reg = core_readl(priv, offset);
447 /* IPv4 dst [31:16] */890 /* IPv4 dst [31:16] */
448 ipv4 |= ((reg >> 8) & 0xffff) << 16;891 ipv4 |= ((reg >> 8) & 0xffff) << 16;
449 /* IPv4 dst [7:0] */892 /* IPv4 dst [7:0] */
450 ipv4 |= (reg >> 24) & 0xff;893 ipv4 |= (reg >> 24) & 0xff;
451 v4_spec->ip4dst = cpu_to_be32(ipv4);894 v4_spec->ip4dst = cpu_to_be32(ipv4);
452 nfc->fs.m_u.tcp_ip4_spec.ip4dst = cpu_to_be32(~0);
453 895
454 /* IPv4 src [15:8] */896 /* IPv4 src [15:8] */
455 ipv4 = (reg & 0xff) << 8;897 ipv4 = (reg & 0xff) << 8;
456 reg = core_readl(priv, CORE_CFP_DATA_PORT(0));
457 898
458 if (!(reg & SLICE_VALID))899 if (mask)
900 offset = CORE_CFP_MASK_PORT(0);
901 else
902 offset = CORE_CFP_DATA_PORT(0);
903 reg = core_readl(priv, offset);
904
905 /* Once the TCAM is programmed, the mask reflects the slice number
906 * being matched, don't bother checking it when reading back the
907 * mask spec
908 */
909 if (!mask && !(reg & SLICE_VALID))
459 return -EINVAL;910 return -EINVAL;
460 911
461 /* IPv4 src [7:0] */912 /* IPv4 src [7:0] */
@@ -463,7 +914,233 @@ static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port, · 1 unmodified line
463 /* IPv4 src [31:16] */914 /* IPv4 src [31:16] */
464 ipv4 |= ((reg >> 8) & 0xffff) << 16;915 ipv4 |= ((reg >> 8) & 0xffff) << 16;
465 v4_spec->ip4src = cpu_to_be32(ipv4);916 v4_spec->ip4src = cpu_to_be32(ipv4);
466 nfc->fs.m_u.tcp_ip4_spec.ip4src = cpu_to_be32(~0);917
918 return 0;
919}
920
921static int bcm_sf2_cfp_ipv4_rule_get(struct bcm_sf2_priv *priv, int port,
922 struct ethtool_rx_flow_spec *fs)
923{
924 struct ethtool_tcpip4_spec *v4_spec = NULL, *v4_m_spec = NULL;
925 u32 reg;
926 int ret;
927
928 reg = core_readl(priv, CORE_CFP_DATA_PORT(6));
929
930 switch ((reg & IPPROTO_MASK) >> IPPROTO_SHIFT) {
931 case IPPROTO_TCP:
932 fs->flow_type = TCP_V4_FLOW;
933 v4_spec = &fs->h_u.tcp_ip4_spec;
934 v4_m_spec = &fs->m_u.tcp_ip4_spec;
935 break;
936 case IPPROTO_UDP:
937 fs->flow_type = UDP_V4_FLOW;
938 v4_spec = &fs->h_u.udp_ip4_spec;
939 v4_m_spec = &fs->m_u.udp_ip4_spec;
940 break;
941 default:
942 return -EINVAL;
943 }
944
945 fs->m_ext.data[0] = cpu_to_be32((reg >> IP_FRAG_SHIFT) & 1);
946 v4_spec->tos = (reg >> IPTOS_SHIFT) & IPTOS_MASK;
947
948 ret = bcm_sf2_cfp_unslice_ipv4(priv, v4_spec, false);
949 if (ret)
950 return ret;
951
952 return bcm_sf2_cfp_unslice_ipv4(priv, v4_m_spec, true);
953}
954
955static int bcm_sf2_cfp_unslice_ipv6(struct bcm_sf2_priv *priv,
956 __be32 *ip6_addr, __be16 *port,
957 bool mask)
958{
959 u32 reg, tmp, offset;
960
961 /* C-Tag [31:24]
962 * UDF_n_B8 [23:8] (port)
963 * UDF_n_B7 (upper) [7:0] (addr[15:8])
964 */
965 if (mask)
966 offset = CORE_CFP_MASK_PORT(4);
967 else
968 offset = CORE_CFP_DATA_PORT(4);
969 reg = core_readl(priv, offset);
970 *port = cpu_to_be32(reg) >> 8;
971 tmp = (u32)(reg & 0xff) << 8;
972
973 /* UDF_n_B7 (lower) [31:24] (addr[7:0])
974 * UDF_n_B6 [23:8] (addr[31:16])
975 * UDF_n_B5 (upper) [7:0] (addr[47:40])
976 */
977 if (mask)
978 offset = CORE_CFP_MASK_PORT(3);
979 else
980 offset = CORE_CFP_DATA_PORT(3);
981 reg = core_readl(priv, offset);
982 tmp |= (reg >> 24) & 0xff;
983 tmp |= (u32)((reg >> 8) << 16);
984 ip6_addr[3] = cpu_to_be32(tmp);
985 tmp = (u32)(reg & 0xff) << 8;
986
987 /* UDF_n_B5 (lower) [31:24] (addr[39:32])
988 * UDF_n_B4 [23:8] (addr[63:48])
989 * UDF_n_B3 (upper) [7:0] (addr[79:72])
990 */
991 if (mask)
992 offset = CORE_CFP_MASK_PORT(2);
993 else
994 offset = CORE_CFP_DATA_PORT(2);
995 reg = core_readl(priv, offset);
996 tmp |= (reg >> 24) & 0xff;
997 tmp |= (u32)((reg >> 8) << 16);
998 ip6_addr[2] = cpu_to_be32(tmp);
999 tmp = (u32)(reg & 0xff) << 8;
1000
1001 /* UDF_n_B3 (lower) [31:24] (addr[71:64])
1002 * UDF_n_B2 [23:8] (addr[95:80])
1003 * UDF_n_B1 (upper) [7:0] (addr[111:104])
1004 */
1005 if (mask)
1006 offset = CORE_CFP_MASK_PORT(1);
1007 else
1008 offset = CORE_CFP_DATA_PORT(1);
1009 reg = core_readl(priv, offset);
1010 tmp |= (reg >> 24) & 0xff;
1011 tmp |= (u32)((reg >> 8) << 16);
1012 ip6_addr[1] = cpu_to_be32(tmp);
1013 tmp = (u32)(reg & 0xff) << 8;
1014
1015 /* UDF_n_B1 (lower) [31:24] (addr[103:96])
1016 * UDF_n_B0 [23:8] (addr[127:112])
1017 * Reserved [7:4]
1018 * Slice ID [3:2]
1019 * Slice valid [1:0]
1020 */
1021 if (mask)
1022 offset = CORE_CFP_MASK_PORT(0);
1023 else
1024 offset = CORE_CFP_DATA_PORT(0);
1025 reg = core_readl(priv, offset);
1026 tmp |= (reg >> 24) & 0xff;
1027 tmp |= (u32)((reg >> 8) << 16);
1028 ip6_addr[0] = cpu_to_be32(tmp);
1029
1030 if (!mask && !(reg & SLICE_VALID))
1031 return -EINVAL;
1032
1033 return 0;
1034}
1035
1036static int bcm_sf2_cfp_ipv6_rule_get(struct bcm_sf2_priv *priv, int port,
1037 struct ethtool_rx_flow_spec *fs,
1038 u32 next_loc)
1039{
1040 struct ethtool_tcpip6_spec *v6_spec = NULL, *v6_m_spec = NULL;
1041 u32 reg;
1042 int ret;
1043
1044 /* UDPv6 and TCPv6 both use ethtool_tcpip6_spec so we are fine
1045 * assuming tcp_ip6_spec here being an union.
1046 */
1047 v6_spec = &fs->h_u.tcp_ip6_spec;
1048 v6_m_spec = &fs->m_u.tcp_ip6_spec;
1049
1050 /* Read the second half first */
1051 ret = bcm_sf2_cfp_unslice_ipv6(priv, v6_spec->ip6dst, &v6_spec->pdst,
1052 false);
1053 if (ret)
1054 return ret;
1055
1056 ret = bcm_sf2_cfp_unslice_ipv6(priv, v6_m_spec->ip6dst,
1057 &v6_m_spec->pdst, true);
1058 if (ret)
1059 return ret;
1060
1061 /* Read last to avoid next entry clobbering the results during search
1062 * operations. We would not have the port enabled for this rule, so
1063 * don't bother checking it.
1064 */
1065 (void)core_readl(priv, CORE_CFP_DATA_PORT(7));
1066
1067 /* The slice number is valid, so read the rule we are chained from now
1068 * which is our first half.
1069 */
1070 bcm_sf2_cfp_rule_addr_set(priv, next_loc);
1071 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | TCAM_SEL);
1072 if (ret)
1073 return ret;
1074
1075 reg = core_readl(priv, CORE_CFP_DATA_PORT(6));
1076
1077 switch ((reg & IPPROTO_MASK) >> IPPROTO_SHIFT) {
1078 case IPPROTO_TCP:
1079 fs->flow_type = TCP_V6_FLOW;
1080 break;
1081 case IPPROTO_UDP:
1082 fs->flow_type = UDP_V6_FLOW;
1083 break;
1084 default:
1085 return -EINVAL;
1086 }
1087
1088 ret = bcm_sf2_cfp_unslice_ipv6(priv, v6_spec->ip6src, &v6_spec->psrc,
1089 false);
1090 if (ret)
1091 return ret;
1092
1093 return bcm_sf2_cfp_unslice_ipv6(priv, v6_m_spec->ip6src,
1094 &v6_m_spec->psrc, true);
1095}
1096
1097static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port,
1098 struct ethtool_rxnfc *nfc)
1099{
1100 u32 reg, ipv4_or_chain_id;
1101 unsigned int queue_num;
1102 int ret;
1103
1104 bcm_sf2_cfp_rule_addr_set(priv, nfc->fs.location);
1105
1106 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | ACT_POL_RAM);
1107 if (ret)
1108 return ret;
1109
1110 reg = core_readl(priv, CORE_ACT_POL_DATA0);
1111
1112 ret = bcm_sf2_cfp_op(priv, OP_SEL_READ | TCAM_SEL);
1113 if (ret)
1114 return ret;
1115
1116 /* Extract the destination port */
1117 nfc->fs.ring_cookie = fls((reg >> DST_MAP_IB_SHIFT) &
1118 DST_MAP_IB_MASK) - 1;
1119
1120 /* There is no Port 6, so we compensate for that here */
1121 if (nfc->fs.ring_cookie >= 6)
1122 nfc->fs.ring_cookie++;
1123 nfc->fs.ring_cookie *= SF2_NUM_EGRESS_QUEUES;
1124
1125 /* Extract the destination queue */
1126 queue_num = (reg >> NEW_TC_SHIFT) & NEW_TC_MASK;
1127 nfc->fs.ring_cookie += queue_num;
1128
1129 /* Extract the L3_FRAMING or CHAIN_ID */
1130 reg = core_readl(priv, CORE_CFP_DATA_PORT(6));
1131
1132 /* With IPv6 rules this would contain a non-zero chain ID since
1133 * we reserve entry 0 and it cannot be used. So if we read 0 here
1134 * this means an IPv4 rule.
1135 */
1136 ipv4_or_chain_id = (reg >> L3_FRAMING_SHIFT) & 0xff;
1137 if (ipv4_or_chain_id == 0)
1138 ret = bcm_sf2_cfp_ipv4_rule_get(priv, port, &nfc->fs);
1139 else
1140 ret = bcm_sf2_cfp_ipv6_rule_get(priv, port, &nfc->fs,
1141 ipv4_or_chain_id);
1142 if (ret)
1143 return ret;
467 1144
468 /* Read last to avoid next entry clobbering the results during search1145 /* Read last to avoid next entry clobbering the results during search
469 * operations1146 * operations
@@ -486,44 +1163,11 @@ static int bcm_sf2_cfp_rule_get_all(struct bcm_sf2_priv *priv, · 16 unmodified lines
486 u32 *rule_locs)1163 u32 *rule_locs)
487{1164{
488 unsigned int index = 1, rules_cnt = 0;1165 unsigned int index = 1, rules_cnt = 0;
489 int ret;
490 u32 reg;
491
492 /* Do not poll on OP_STR_DONE to be self-clearing for search
493 * operations, we cannot use bcm_sf2_cfp_op here because it completes
494 * on clearing OP_STR_DONE which won't clear until the entire search
495 * operation is over.
496 */
497 reg = core_readl(priv, CORE_CFP_ACC);
498 reg &= ~(XCESS_ADDR_MASK << XCESS_ADDR_SHIFT);
499 reg |= index << XCESS_ADDR_SHIFT;
500 reg &= ~(OP_SEL_MASK | RAM_SEL_MASK);
501 reg |= OP_SEL_SEARCH | TCAM_SEL | OP_STR_DONE;
502 core_writel(priv, reg, CORE_CFP_ACC);
503 1166
504 do {1167 for_each_set_bit_from(index, priv->cfp.unique, priv->num_cfp_rules) {
505 /* Wait for results to be ready */1168 rule_locs[rules_cnt] = index;
506 reg = core_readl(priv, CORE_CFP_ACC);1169 rules_cnt++;
507 1170 }
508 /* Extract the address we are searching */
509 index = reg >> XCESS_ADDR_SHIFT;
510 index &= XCESS_ADDR_MASK;
511
512 /* We have a valid search result, so flag it accordingly */
513 if (reg & SEARCH_STS) {
514 ret = bcm_sf2_cfp_rule_get(priv, port, nfc, true);
515 if (ret)
516 continue;
517
518 rule_locs[rules_cnt] = index;
519 rules_cnt++;
520 }
521
522 /* Search is over break out */
523 if (!(reg & OP_STR_DONE))
524 break;
525
526 } while (index < priv->num_cfp_rules);
527 1171
528 /* Put the TCAM size here */1172 /* Put the TCAM size here */
529 nfc->data = bcm_sf2_cfp_rule_size(priv);1173 nfc->data = bcm_sf2_cfp_rule_size(priv);
@@ -543,13 +1187,13 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port, · 13 unmodified lines
543 switch (nfc->cmd) {1187 switch (nfc->cmd) {
544 case ETHTOOL_GRXCLSRLCNT:1188 case ETHTOOL_GRXCLSRLCNT:
545 /* Subtract the default, unusable rule */1189 /* Subtract the default, unusable rule */
546 nfc->rule_cnt = bitmap_weight(priv->cfp.used,1190 nfc->rule_cnt = bitmap_weight(priv->cfp.unique,
547 priv->num_cfp_rules) - 1;1191 priv->num_cfp_rules) - 1;
548 /* We support specifying rule locations */1192 /* We support specifying rule locations */
549 nfc->data |= RX_CLS_LOC_SPECIAL;1193 nfc->data |= RX_CLS_LOC_SPECIAL;
550 break;1194 break;
551 case ETHTOOL_GRXCLSRULE:1195 case ETHTOOL_GRXCLSRULE:
552 ret = bcm_sf2_cfp_rule_get(priv, port, nfc, false);1196 ret = bcm_sf2_cfp_rule_get(priv, port, nfc);
553 break;1197 break;
554 case ETHTOOL_GRXCLSRLALL:1198 case ETHTOOL_GRXCLSRLALL:
555 ret = bcm_sf2_cfp_rule_get_all(priv, port, nfc, rule_locs);1199 ret = bcm_sf2_cfp_rule_get_all(priv, port, nfc, rule_locs);
drivers/net/dsa/bcm_sf2_regs.h+36−13
@@ -115,6 +115,24 @@ enum bcm_sf2_reg_offs { · 114 unmodified lines
115#define P7_IRQ_OFF 0115#define P7_IRQ_OFF 0
116#define P_IRQ_OFF(x) ((6 - (x)) * P_NUM_IRQ)116#define P_IRQ_OFF(x) ((6 - (x)) * P_NUM_IRQ)
117 117
118/* Register set relative to 'ACB' */
119#define ACB_CONTROL 0x00
120#define ACB_EN (1 << 0)
121#define ACB_ALGORITHM (1 << 1)
122#define ACB_FLUSH_SHIFT 2
123#define ACB_FLUSH_MASK 0x3
124
125#define ACB_QUEUE_0_CFG 0x08
126#define XOFF_THRESHOLD_MASK 0x7ff
127#define XON_EN (1 << 11)
128#define TOTAL_XOFF_THRESHOLD_SHIFT 12
129#define TOTAL_XOFF_THRESHOLD_MASK 0x7ff
130#define TOTAL_XOFF_EN (1 << 23)
131#define TOTAL_XON_EN (1 << 24)
132#define PKTLEN_SHIFT 25
133#define PKTLEN_MASK 0x3f
134#define ACB_QUEUE_CFG(x) (ACB_QUEUE_0_CFG + ((x) * 0x4))
135
118/* Register set relative to 'CORE' */136/* Register set relative to 'CORE' */
119#define CORE_G_PCTL_PORT0 0x00000137#define CORE_G_PCTL_PORT0 0x00000
120#define CORE_G_PCTL_PORT(x) (CORE_G_PCTL_PORT0 + (x * 0x4))138#define CORE_G_PCTL_PORT(x) (CORE_G_PCTL_PORT0 + (x * 0x4))
@@ -205,16 +223,8 @@ enum bcm_sf2_reg_offs { · 84 unmodified lines
205 223
206#define CORE_IMP0_PRT_ID 0x0804224#define CORE_IMP0_PRT_ID 0x0804
207 225
208#define CORE_BRCM_HDR_CTRL 0x0080c
209#define BRCM_HDR_EN_P8 (1 << 0)
210#define BRCM_HDR_EN_P5 (1 << 1)
211#define BRCM_HDR_EN_P7 (1 << 2)
212
213#define CORE_RST_MIB_CNT_EN 0x0950226#define CORE_RST_MIB_CNT_EN 0x0950
214 227
215#define CORE_BRCM_HDR_RX_DIS 0x0980
216#define CORE_BRCM_HDR_TX_DIS 0x0988
217
218#define CORE_ARLA_VTBL_RWCTRL 0x1600228#define CORE_ARLA_VTBL_RWCTRL 0x1600
219#define ARLA_VTBL_CMD_WRITE 0229#define ARLA_VTBL_CMD_WRITE 0
220#define ARLA_VTBL_CMD_READ 1230#define ARLA_VTBL_CMD_READ 1
@@ -245,6 +255,11 @@ enum bcm_sf2_reg_offs { · 24 unmodified lines
245#define CORE_PORT_VLAN_CTL_PORT(x) (0xc400 + ((x) * 0x8))255#define CORE_PORT_VLAN_CTL_PORT(x) (0xc400 + ((x) * 0x8))
246#define PORT_VLAN_CTRL_MASK 0x1ff256#define PORT_VLAN_CTRL_MASK 0x1ff
247 257
258#define CORE_TXQ_THD_PAUSE_QN_PORT_0 0x2c80
259#define TXQ_PAUSE_THD_MASK 0x7ff
260#define CORE_TXQ_THD_PAUSE_QN_PORT(x) (CORE_TXQ_THD_PAUSE_QN_PORT_0 + \
261 (x) * 0x8)
262
248#define CORE_DEFAULT_1Q_TAG_P(x) (0xd040 + ((x) * 8))263#define CORE_DEFAULT_1Q_TAG_P(x) (0xd040 + ((x) * 8))
249#define CFI_SHIFT 12264#define CFI_SHIFT 12
250#define PRI_SHIFT 13265#define PRI_SHIFT 13
@@ -252,9 +267,6 @@ enum bcm_sf2_reg_offs { · 1 unmodified line
252 267
253#define CORE_JOIN_ALL_VLAN_EN 0xd140268#define CORE_JOIN_ALL_VLAN_EN 0xd140
254 269
255#define CORE_EEE_EN_CTRL 0x24800
256#define CORE_EEE_LPI_INDICATE 0x24810
257
258#define CORE_CFP_ACC 0x28000270#define CORE_CFP_ACC 0x28000
259#define OP_STR_DONE (1 << 0)271#define OP_STR_DONE (1 << 0)
260#define OP_SEL_SHIFT 1272#define OP_SEL_SHIFT 1
@@ -290,14 +302,18 @@ enum bcm_sf2_reg_offs { · 29 unmodified lines
290/* UDF_DATA7 */302/* UDF_DATA7 */
291#define L3_FRAMING_SHIFT 24303#define L3_FRAMING_SHIFT 24
292#define L3_FRAMING_MASK (0x3 << L3_FRAMING_SHIFT)304#define L3_FRAMING_MASK (0x3 << L3_FRAMING_SHIFT)
305#define IPTOS_SHIFT 16
306#define IPTOS_MASK 0xff
293#define IPPROTO_SHIFT 8307#define IPPROTO_SHIFT 8
294#define IPPROTO_MASK (0xff << IPPROTO_SHIFT)308#define IPPROTO_MASK (0xff << IPPROTO_SHIFT)
295#define IP_FRAG (1 << 7)309#define IP_FRAG_SHIFT 7
310#define IP_FRAG (1 << IP_FRAG_SHIFT)
296 311
297/* UDF_DATA0 */312/* UDF_DATA0 */
298#define SLICE_VALID 3313#define SLICE_VALID 3
299#define SLICE_NUM_SHIFT 2314#define SLICE_NUM_SHIFT 2
300#define SLICE_NUM(x) ((x) << SLICE_NUM_SHIFT)315#define SLICE_NUM(x) ((x) << SLICE_NUM_SHIFT)
316#define SLICE_NUM_MASK 0x3
301 317
302#define CORE_CFP_MASK_PORT_0 0x280c0318#define CORE_CFP_MASK_PORT_0 0x280c0
303 319
@@ -393,8 +409,15 @@ enum bcm_sf2_reg_offs { · 89 unmodified lines
393#define CFG_UDF_EOL2 (2 << CFG_UDF_OFFSET_BASE_SHIFT)409#define CFG_UDF_EOL2 (2 << CFG_UDF_OFFSET_BASE_SHIFT)
394#define CFG_UDF_EOL3 (3 << CFG_UDF_OFFSET_BASE_SHIFT)410#define CFG_UDF_EOL3 (3 << CFG_UDF_OFFSET_BASE_SHIFT)
395 411
412/* IPv6 slices */
413#define CORE_UDF_0_B_0_8_PORT_0 0x28500
414
415/* IPv6 chained slices */
416#define CORE_UDF_0_D_0_11_PORT_0 0x28680
417
396/* Number of slices for IPv4, IPv6 and non-IP */418/* Number of slices for IPv4, IPv6 and non-IP */
397#define UDF_NUM_SLICES 9419#define UDF_NUM_SLICES 4
420#define UDFS_PER_SLICE 9
398 421
399/* Spacing between different slices */422/* Spacing between different slices */
400#define UDF_SLICE_OFFSET 0x40423#define UDF_SLICE_OFFSET 0x40
drivers/net/dsa/dsa_loop.c+2−9
@@ -64,7 +64,8 @@ struct dsa_loop_priv { · 63 unmodified lines
64 64
65static struct phy_device *phydevs[PHY_MAX_ADDR];65static struct phy_device *phydevs[PHY_MAX_ADDR];
66 66
67static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds)67static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,
68 int port)
68{69{
69 dev_dbg(ds->dev, "%s\n", __func__);70 dev_dbg(ds->dev, "%s\n", __func__);
70 71
@@ -110,13 +111,6 @@ static void dsa_loop_get_ethtool_stats(struct dsa_switch *ds, int port, · 39 unmodified lines
110 data[i] = ps->ports[port].mib[i].val;111 data[i] = ps->ports[port].mib[i].val;
111}112}
112 113
113static int dsa_loop_set_addr(struct dsa_switch *ds, u8 *addr)
114{
115 dev_dbg(ds->dev, "%s\n", __func__);
116
117 return 0;
118}
119
120static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)114static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)
121{115{
122 struct dsa_loop_priv *ps = ds->priv;116 struct dsa_loop_priv *ps = ds->priv;
@@ -263,7 +257,6 @@ static const struct dsa_switch_ops dsa_loop_driver = { · 140 unmodified lines
263 .get_strings = dsa_loop_get_strings,257 .get_strings = dsa_loop_get_strings,
264 .get_ethtool_stats = dsa_loop_get_ethtool_stats,258 .get_ethtool_stats = dsa_loop_get_ethtool_stats,
265 .get_sset_count = dsa_loop_get_sset_count,259 .get_sset_count = dsa_loop_get_sset_count,
266 .set_addr = dsa_loop_set_addr,
267 .phy_read = dsa_loop_phy_read,260 .phy_read = dsa_loop_phy_read,
268 .phy_write = dsa_loop_phy_write,261 .phy_write = dsa_loop_phy_write,
269 .port_bridge_join = dsa_loop_port_bridge_join,262 .port_bridge_join = dsa_loop_port_bridge_join,
drivers/net/dsa/lan9303-core.c+515−42
@@ -17,6 +17,9 @@ · 16 unmodified lines
17#include <linux/regmap.h>17#include <linux/regmap.h>
18#include <linux/mutex.h>18#include <linux/mutex.h>
19#include <linux/mii.h>19#include <linux/mii.h>
20#include <linux/phy.h>
21#include <linux/if_bridge.h>
22#include <linux/etherdevice.h>
20 23
21#include "lan9303.h"24#include "lan9303.h"
22 25
@@ -57,6 +60,7 @@ · 34 unmodified lines
57#define LAN9303_SWITCH_CSR_CMD_LANES (BIT(19) | BIT(18) | BIT(17) | BIT(16))60#define LAN9303_SWITCH_CSR_CMD_LANES (BIT(19) | BIT(18) | BIT(17) | BIT(16))
58#define LAN9303_VIRT_PHY_BASE 0x7061#define LAN9303_VIRT_PHY_BASE 0x70
59#define LAN9303_VIRT_SPECIAL_CTRL 0x7762#define LAN9303_VIRT_SPECIAL_CTRL 0x77
63#define LAN9303_VIRT_SPECIAL_TURBO BIT(10) /*Turbo MII Enable*/
60 64
61/*13.4 Switch Fabric Control and Status Registers65/*13.4 Switch Fabric Control and Status Registers
62 * Accessed indirectly via SWITCH_CSR_CMD, SWITCH_CSR_DATA.66 * Accessed indirectly via SWITCH_CSR_CMD, SWITCH_CSR_DATA.
@@ -121,6 +125,21 @@ · 58 unmodified lines
121#define LAN9303_MAC_RX_CFG_2 0x0c01125#define LAN9303_MAC_RX_CFG_2 0x0c01
122#define LAN9303_MAC_TX_CFG_2 0x0c40126#define LAN9303_MAC_TX_CFG_2 0x0c40
123#define LAN9303_SWE_ALR_CMD 0x1800127#define LAN9303_SWE_ALR_CMD 0x1800
128# define LAN9303_ALR_CMD_MAKE_ENTRY BIT(2)
129# define LAN9303_ALR_CMD_GET_FIRST BIT(1)
130# define LAN9303_ALR_CMD_GET_NEXT BIT(0)
131#define LAN9303_SWE_ALR_WR_DAT_0 0x1801
132#define LAN9303_SWE_ALR_WR_DAT_1 0x1802
133# define LAN9303_ALR_DAT1_VALID BIT(26)
134# define LAN9303_ALR_DAT1_END_OF_TABL BIT(25)
135# define LAN9303_ALR_DAT1_AGE_OVERRID BIT(25)
136# define LAN9303_ALR_DAT1_STATIC BIT(24)
137# define LAN9303_ALR_DAT1_PORT_BITOFFS 16
138# define LAN9303_ALR_DAT1_PORT_MASK (7 << LAN9303_ALR_DAT1_PORT_BITOFFS)
139#define LAN9303_SWE_ALR_RD_DAT_0 0x1805
140#define LAN9303_SWE_ALR_RD_DAT_1 0x1806
141#define LAN9303_SWE_ALR_CMD_STS 0x1808
142# define ALR_STS_MAKE_PEND BIT(0)
124#define LAN9303_SWE_VLAN_CMD 0x180b143#define LAN9303_SWE_VLAN_CMD 0x180b
125# define LAN9303_SWE_VLAN_CMD_RNW BIT(5)144# define LAN9303_SWE_VLAN_CMD_RNW BIT(5)
126# define LAN9303_SWE_VLAN_CMD_PVIDNVLAN BIT(4)145# define LAN9303_SWE_VLAN_CMD_PVIDNVLAN BIT(4)
@@ -134,6 +153,8 @@ · 7 unmodified lines
134# define LAN9303_SWE_VLAN_UNTAG_PORT0 BIT(12)153# define LAN9303_SWE_VLAN_UNTAG_PORT0 BIT(12)
135#define LAN9303_SWE_VLAN_CMD_STS 0x1810154#define LAN9303_SWE_VLAN_CMD_STS 0x1810
136#define LAN9303_SWE_GLB_INGRESS_CFG 0x1840155#define LAN9303_SWE_GLB_INGRESS_CFG 0x1840
156# define LAN9303_SWE_GLB_INGR_IGMP_TRAP BIT(7)
157# define LAN9303_SWE_GLB_INGR_IGMP_PORT(p) BIT(10 + p)
137#define LAN9303_SWE_PORT_STATE 0x1843158#define LAN9303_SWE_PORT_STATE 0x1843
138# define LAN9303_SWE_PORT_STATE_FORWARDING_PORT2 (0)159# define LAN9303_SWE_PORT_STATE_FORWARDING_PORT2 (0)
139# define LAN9303_SWE_PORT_STATE_LEARNING_PORT2 BIT(5)160# define LAN9303_SWE_PORT_STATE_LEARNING_PORT2 BIT(5)
@@ -144,6 +165,7 @@ · 4 unmodified lines
144# define LAN9303_SWE_PORT_STATE_FORWARDING_PORT0 (0)165# define LAN9303_SWE_PORT_STATE_FORWARDING_PORT0 (0)
145# define LAN9303_SWE_PORT_STATE_LEARNING_PORT0 BIT(1)166# define LAN9303_SWE_PORT_STATE_LEARNING_PORT0 BIT(1)
146# define LAN9303_SWE_PORT_STATE_BLOCKING_PORT0 BIT(0)167# define LAN9303_SWE_PORT_STATE_BLOCKING_PORT0 BIT(0)
168# define LAN9303_SWE_PORT_STATE_DISABLED_PORT0 (3)
147#define LAN9303_SWE_PORT_MIRROR 0x1846169#define LAN9303_SWE_PORT_MIRROR 0x1846
148# define LAN9303_SWE_PORT_MIRROR_SNIFF_ALL BIT(8)170# define LAN9303_SWE_PORT_MIRROR_SNIFF_ALL BIT(8)
149# define LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT2 BIT(7)171# define LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT2 BIT(7)
@@ -154,7 +176,9 @@ · 4 unmodified lines
154# define LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT0 BIT(2)176# define LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT0 BIT(2)
155# define LAN9303_SWE_PORT_MIRROR_ENABLE_RX_MIRRORING BIT(1)177# define LAN9303_SWE_PORT_MIRROR_ENABLE_RX_MIRRORING BIT(1)
156# define LAN9303_SWE_PORT_MIRROR_ENABLE_TX_MIRRORING BIT(0)178# define LAN9303_SWE_PORT_MIRROR_ENABLE_TX_MIRRORING BIT(0)
179# define LAN9303_SWE_PORT_MIRROR_DISABLED 0
157#define LAN9303_SWE_INGRESS_PORT_TYPE 0x1847180#define LAN9303_SWE_INGRESS_PORT_TYPE 0x1847
181#define LAN9303_SWE_INGRESS_PORT_TYPE_VLAN 3
158#define LAN9303_BM_CFG 0x1c00182#define LAN9303_BM_CFG 0x1c00
159#define LAN9303_BM_EGRSS_PORT_TYPE 0x1c0c183#define LAN9303_BM_EGRSS_PORT_TYPE 0x1c0c
160# define LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT2 (BIT(17) | BIT(16))184# define LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT2 (BIT(17) | BIT(16))
@@ -262,7 +286,7 @@ static int lan9303_indirect_phy_wait_for_completion(struct lan9303 *chip) · 101 unmodified lines
262 }286 }
263 if (!(reg & LAN9303_PMI_ACCESS_MII_BUSY))287 if (!(reg & LAN9303_PMI_ACCESS_MII_BUSY))
264 return 0;288 return 0;
265 msleep(1);289 usleep_range(1000, 2000);
266 }290 }
267 291
268 return -EIO;292 return -EIO;
@@ -354,7 +378,7 @@ static int lan9303_switch_wait_for_completion(struct lan9303 *chip) · 85 unmodified lines
354 }378 }
355 if (!(reg & LAN9303_SWITCH_CSR_CMD_BUSY))379 if (!(reg & LAN9303_SWITCH_CSR_CMD_BUSY))
356 return 0;380 return 0;
357 msleep(1);381 usleep_range(1000, 2000);
358 }382 }
359 383
360 return -EIO;384 return -EIO;
@@ -428,6 +452,21 @@ on_error: · 67 unmodified lines
428 return ret;452 return ret;
429}453}
430 454
455static int lan9303_write_switch_reg_mask(struct lan9303 *chip, u16 regnum,
456 u32 val, u32 mask)
457{
458 int ret;
459 u32 reg;
460
461 ret = lan9303_read_switch_reg(chip, regnum, &reg);
462 if (ret)
463 return ret;
464
465 reg = (reg & ~mask) | val;
466
467 return lan9303_write_switch_reg(chip, regnum, reg);
468}
469
431static int lan9303_write_switch_port(struct lan9303 *chip, int port,470static int lan9303_write_switch_port(struct lan9303 *chip, int port,
432 u16 regnum, u32 val)471 u16 regnum, u32 val)
433{472{
@@ -472,6 +511,220 @@ static int lan9303_detect_phy_setup(struct lan9303 *chip) · 38 unmodified lines
472 return 0;511 return 0;
473}512}
474 513
514/* Map ALR-port bits to port bitmap, and back */
515static const int alrport_2_portmap[] = {1, 2, 4, 0, 3, 5, 6, 7 };
516static const int portmap_2_alrport[] = {3, 0, 1, 4, 2, 5, 6, 7 };
517
518/* Return pointer to first free ALR cache entry, return NULL if none */
519static struct lan9303_alr_cache_entry *
520lan9303_alr_cache_find_free(struct lan9303 *chip)
521{
522 int i;
523 struct lan9303_alr_cache_entry *entr = chip->alr_cache;
524
525 for (i = 0; i < LAN9303_NUM_ALR_RECORDS; i++, entr++)
526 if (entr->port_map == 0)
527 return entr;
528
529 return NULL;
530}
531
532/* Return pointer to ALR cache entry matching MAC address */
533static struct lan9303_alr_cache_entry *
534lan9303_alr_cache_find_mac(struct lan9303 *chip, const u8 *mac_addr)
535{
536 int i;
537 struct lan9303_alr_cache_entry *entr = chip->alr_cache;
538
539 BUILD_BUG_ON_MSG(sizeof(struct lan9303_alr_cache_entry) & 1,
540 "ether_addr_equal require u16 alignment");
541
542 for (i = 0; i < LAN9303_NUM_ALR_RECORDS; i++, entr++)
543 if (ether_addr_equal(entr->mac_addr, mac_addr))
544 return entr;
545
546 return NULL;
547}
548
549/* Wait a while until mask & reg == value. Otherwise return timeout. */
550static int lan9303_csr_reg_wait(struct lan9303 *chip, int regno,
551 int mask, char value)
552{
553 int i;
554
555 for (i = 0; i < 0x1000; i++) {
556 u32 reg;
557
558 lan9303_read_switch_reg(chip, regno, &reg);
559 if ((reg & mask) == value)
560 return 0;
561 usleep_range(1000, 2000);
562 }
563 return -ETIMEDOUT;
564}
565
566static int lan9303_alr_make_entry_raw(struct lan9303 *chip, u32 dat0, u32 dat1)
567{
568 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_WR_DAT_0, dat0);
569 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_WR_DAT_1, dat1);
570 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD,
571 LAN9303_ALR_CMD_MAKE_ENTRY);
572 lan9303_csr_reg_wait(chip, LAN9303_SWE_ALR_CMD_STS, ALR_STS_MAKE_PEND,
573 0);
574 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD, 0);
575
576 return 0;
577}
578
579typedef void alr_loop_cb_t(struct lan9303 *chip, u32 dat0, u32 dat1,
580 int portmap, void *ctx);
581
582static void lan9303_alr_loop(struct lan9303 *chip, alr_loop_cb_t *cb, void *ctx)
583{
584 int i;
585
586 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD,
587 LAN9303_ALR_CMD_GET_FIRST);
588 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD, 0);
589
590 for (i = 1; i < LAN9303_NUM_ALR_RECORDS; i++) {
591 u32 dat0, dat1;
592 int alrport, portmap;
593
594 lan9303_read_switch_reg(chip, LAN9303_SWE_ALR_RD_DAT_0, &dat0);
595 lan9303_read_switch_reg(chip, LAN9303_SWE_ALR_RD_DAT_1, &dat1);
596 if (dat1 & LAN9303_ALR_DAT1_END_OF_TABL)
597 break;
598
599 alrport = (dat1 & LAN9303_ALR_DAT1_PORT_MASK) >>
600 LAN9303_ALR_DAT1_PORT_BITOFFS;
601 portmap = alrport_2_portmap[alrport];
602
603 cb(chip, dat0, dat1, portmap, ctx);
604
605 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD,
606 LAN9303_ALR_CMD_GET_NEXT);
607 lan9303_write_switch_reg(chip, LAN9303_SWE_ALR_CMD, 0);
608 }
609}
610
611static void alr_reg_to_mac(u32 dat0, u32 dat1, u8 mac[6])
612{
613 mac[0] = (dat0 >> 0) & 0xff;
614 mac[1] = (dat0 >> 8) & 0xff;
615 mac[2] = (dat0 >> 16) & 0xff;
616 mac[3] = (dat0 >> 24) & 0xff;
617 mac[4] = (dat1 >> 0) & 0xff;
618 mac[5] = (dat1 >> 8) & 0xff;
619}
620
621struct del_port_learned_ctx {
622 int port;
623};
624
625/* Clear learned (non-static) entry on given port */
626static void alr_loop_cb_del_port_learned(struct lan9303 *chip, u32 dat0,
627 u32 dat1, int portmap, void *ctx)
628{
629 struct del_port_learned_ctx *del_ctx = ctx;
630 int port = del_ctx->port;
631
632 if (((BIT(port) & portmap) == 0) || (dat1 & LAN9303_ALR_DAT1_STATIC))
633 return;
634
635 /* learned entries has only one port, we can just delete */
636 dat1 &= ~LAN9303_ALR_DAT1_VALID; /* delete entry */
637 lan9303_alr_make_entry_raw(chip, dat0, dat1);
638}
639
640struct port_fdb_dump_ctx {
641 int port;
642 void *data;
643 dsa_fdb_dump_cb_t *cb;
644};
645
646static void alr_loop_cb_fdb_port_dump(struct lan9303 *chip, u32 dat0,
647 u32 dat1, int portmap, void *ctx)
648{
649 struct port_fdb_dump_ctx *dump_ctx = ctx;
650 u8 mac[ETH_ALEN];
651 bool is_static;
652
653 if ((BIT(dump_ctx->port) & portmap) == 0)
654 return;
655
656 alr_reg_to_mac(dat0, dat1, mac);
657 is_static = !!(dat1 & LAN9303_ALR_DAT1_STATIC);
658 dump_ctx->cb(mac, 0, is_static, dump_ctx->data);
659}
660
661/* Set a static ALR entry. Delete entry if port_map is zero */
662static void lan9303_alr_set_entry(struct lan9303 *chip, const u8 *mac,
663 u8 port_map, bool stp_override)
664{
665 u32 dat0, dat1, alr_port;
666
667 dev_dbg(chip->dev, "%s(%pM, %d)\n", __func__, mac, port_map);
668 dat1 = LAN9303_ALR_DAT1_STATIC;
669 if (port_map)
670 dat1 |= LAN9303_ALR_DAT1_VALID;
671 /* otherwise no ports: delete entry */
672 if (stp_override)
673 dat1 |= LAN9303_ALR_DAT1_AGE_OVERRID;
674
675 alr_port = portmap_2_alrport[port_map & 7];
676 dat1 &= ~LAN9303_ALR_DAT1_PORT_MASK;
677 dat1 |= alr_port << LAN9303_ALR_DAT1_PORT_BITOFFS;
678
679 dat0 = 0;
680 dat0 |= (mac[0] << 0);
681 dat0 |= (mac[1] << 8);
682 dat0 |= (mac[2] << 16);
683 dat0 |= (mac[3] << 24);
684
685 dat1 |= (mac[4] << 0);
686 dat1 |= (mac[5] << 8);
687
688 lan9303_alr_make_entry_raw(chip, dat0, dat1);
689}
690
691/* Add port to static ALR entry, create new static entry if needed */
692static int lan9303_alr_add_port(struct lan9303 *chip, const u8 *mac, int port,
693 bool stp_override)
694{
695 struct lan9303_alr_cache_entry *entr;
696
697 entr = lan9303_alr_cache_find_mac(chip, mac);
698 if (!entr) { /*New entry */
699 entr = lan9303_alr_cache_find_free(chip);
700 if (!entr)
701 return -ENOSPC;
702 ether_addr_copy(entr->mac_addr, mac);
703 }
704 entr->port_map |= BIT(port);
705 entr->stp_override = stp_override;
706 lan9303_alr_set_entry(chip, mac, entr->port_map, stp_override);
707
708 return 0;
709}
710
711/* Delete static port from ALR entry, delete entry if last port */
712static int lan9303_alr_del_port(struct lan9303 *chip, const u8 *mac, int port)
713{
714 struct lan9303_alr_cache_entry *entr;
715
716 entr = lan9303_alr_cache_find_mac(chip, mac);
717 if (!entr)
718 return 0; /* no static entry found */
719
720 entr->port_map &= ~BIT(port);
721 if (entr->port_map == 0) /* zero means its free again */
722 eth_zero_addr(entr->mac_addr);
723 lan9303_alr_set_entry(chip, mac, entr->port_map, entr->stp_override);
724
725 return 0;
726}
727
475static int lan9303_disable_processing_port(struct lan9303 *chip,728static int lan9303_disable_processing_port(struct lan9303 *chip,
476 unsigned int port)729 unsigned int port)
477{730{
@@ -508,16 +761,36 @@ static int lan9303_enable_processing_port(struct lan9303 *chip, · 30 unmodified lines
508 LAN9303_MAC_TX_CFG_X_TX_ENABLE);761 LAN9303_MAC_TX_CFG_X_TX_ENABLE);
509}762}
510 763
764/* forward special tagged packets from port 0 to port 1 *or* port 2 */
765static int lan9303_setup_tagging(struct lan9303 *chip)
766{
767 int ret;
768 u32 val;
769 /* enable defining the destination port via special VLAN tagging
770 * for port 0
771 */
772 ret = lan9303_write_switch_reg(chip, LAN9303_SWE_INGRESS_PORT_TYPE,
773 LAN9303_SWE_INGRESS_PORT_TYPE_VLAN);
774 if (ret)
775 return ret;
776
777 /* tag incoming packets at port 1 and 2 on their way to port 0 to be
778 * able to discover their source port
779 */
780 val = LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0;
781 return lan9303_write_switch_reg(chip, LAN9303_BM_EGRSS_PORT_TYPE, val);
782}
783
511/* We want a special working switch:784/* We want a special working switch:
512 * - do not forward packets between port 1 and 2785 * - do not forward packets between port 1 and 2
513 * - forward everything from port 1 to port 0786 * - forward everything from port 1 to port 0
514 * - forward everything from port 2 to port 0787 * - forward everything from port 2 to port 0
515 * - forward special tagged packets from port 0 to port 1 *or* port 2
516 */788 */
517static int lan9303_separate_ports(struct lan9303 *chip)789static int lan9303_separate_ports(struct lan9303 *chip)
518{790{
519 int ret;791 int ret;
520 792
793 lan9303_alr_del_port(chip, eth_stp_addr, 0);
521 ret = lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_MIRROR,794 ret = lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_MIRROR,
522 LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT0 |795 LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT0 |
523 LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT1 |796 LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT1 |
@@ -527,22 +800,6 @@ static int lan9303_separate_ports(struct lan9303 *chip) · 3 unmodified lines
527 if (ret)800 if (ret)
528 return ret;801 return ret;
529 802
530 /* enable defining the destination port via special VLAN tagging
531 * for port 0
532 */
533 ret = lan9303_write_switch_reg(chip, LAN9303_SWE_INGRESS_PORT_TYPE,
534 0x03);
535 if (ret)
536 return ret;
537
538 /* tag incoming packets at port 1 and 2 on their way to port 0 to be
539 * able to discover their source port
540 */
541 ret = lan9303_write_switch_reg(chip, LAN9303_BM_EGRSS_PORT_TYPE,
542 LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0);
543 if (ret)
544 return ret;
545
546 /* prevent port 1 and 2 from forwarding packets by their own */803 /* prevent port 1 and 2 from forwarding packets by their own */
547 return lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_STATE,804 return lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_STATE,
548 LAN9303_SWE_PORT_STATE_FORWARDING_PORT0 |805 LAN9303_SWE_PORT_STATE_FORWARDING_PORT0 |
@@ -550,6 +807,17 @@ static int lan9303_separate_ports(struct lan9303 *chip) · 1 unmodified line
550 LAN9303_SWE_PORT_STATE_BLOCKING_PORT2);807 LAN9303_SWE_PORT_STATE_BLOCKING_PORT2);
551}808}
552 809
810static void lan9303_bridge_ports(struct lan9303 *chip)
811{
812 /* ports bridged: remove mirroring */
813 lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_MIRROR,
814 LAN9303_SWE_PORT_MIRROR_DISABLED);
815
816 lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_STATE,
817 chip->swe_port_state);
818 lan9303_alr_add_port(chip, eth_stp_addr, 0, true);
819}
820
553static int lan9303_handle_reset(struct lan9303 *chip)821static int lan9303_handle_reset(struct lan9303 *chip)
554{822{
555 if (!chip->reset_gpio)823 if (!chip->reset_gpio)
@@ -569,7 +837,7 @@ static int lan9303_disable_processing(struct lan9303 *chip) · 13 unmodified lines
569{837{
570 int p;838 int p;
571 839
572 for (p = 0; p < LAN9303_NUM_PORTS; p++) {840 for (p = 1; p < LAN9303_NUM_PORTS; p++) {
573 int ret = lan9303_disable_processing_port(chip, p);841 int ret = lan9303_disable_processing_port(chip, p);
574 842
575 if (ret)843 if (ret)
@@ -626,7 +894,8 @@ static int lan9303_check_device(struct lan9303 *chip) · 50 unmodified lines
626 894
627/* ---------------------------- DSA -----------------------------------*/895/* ---------------------------- DSA -----------------------------------*/
628 896
629static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds)897static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds,
898 int port)
630{899{
631 return DSA_TAG_PROTO_LAN9303;900 return DSA_TAG_PROTO_LAN9303;
632}901}
@@ -642,6 +911,10 @@ static int lan9303_setup(struct dsa_switch *ds) · 9 unmodified lines
642 return -EINVAL;911 return -EINVAL;
643 }912 }
644 913
914 ret = lan9303_setup_tagging(chip);
915 if (ret)
916 dev_err(chip->dev, "failed to setup port tagging %d\n", ret);
917
645 ret = lan9303_separate_ports(chip);918 ret = lan9303_separate_ports(chip);
646 if (ret)919 if (ret)
647 dev_err(chip->dev, "failed to separate ports %d\n", ret);920 dev_err(chip->dev, "failed to separate ports %d\n", ret);
@@ -650,6 +923,15 @@ static int lan9303_setup(struct dsa_switch *ds) · 2 unmodified lines
650 if (ret)923 if (ret)
651 dev_err(chip->dev, "failed to re-enable switching %d\n", ret);924 dev_err(chip->dev, "failed to re-enable switching %d\n", ret);
652 925
926 /* Trap IGMP to port 0 */
927 ret = lan9303_write_switch_reg_mask(chip, LAN9303_SWE_GLB_INGRESS_CFG,
928 LAN9303_SWE_GLB_INGR_IGMP_TRAP |
929 LAN9303_SWE_GLB_INGR_IGMP_PORT(0),
930 LAN9303_SWE_GLB_INGR_IGMP_PORT(1) |
931 LAN9303_SWE_GLB_INGR_IGMP_PORT(2));
932 if (ret)
933 dev_err(chip->dev, "failed to setup IGMP trap %d\n", ret);
934
653 return 0;935 return 0;
654}936}
655 937
@@ -760,22 +1042,49 @@ static int lan9303_phy_write(struct dsa_switch *ds, int phy, int regnum, · 104 unmodified lines
760 return chip->ops->phy_write(chip, phy, regnum, val);1042 return chip->ops->phy_write(chip, phy, regnum, val);
761}1043}
762 1044
763static int lan9303_port_enable(struct dsa_switch *ds, int port,1045static void lan9303_adjust_link(struct dsa_switch *ds, int port,
764 struct phy_device *phy)1046 struct phy_device *phydev)
765{1047{
766 struct lan9303 *chip = ds->priv;1048 struct lan9303 *chip = ds->priv;
1049 int ctl, res;
767 1050
768 /* enable internal packet processing */1051 if (!phy_is_pseudo_fixed_link(phydev))
769 switch (port) {1052 return;
770 case 1:1053
771 case 2:1054 ctl = lan9303_phy_read(ds, port, MII_BMCR);
772 return lan9303_enable_processing_port(chip, port);1055
773 default:1056 ctl &= ~BMCR_ANENABLE;
774 dev_dbg(chip->dev,1057
775 "Error: request to power up invalid port %d\n", port);1058 if (phydev->speed == SPEED_100)
1059 ctl |= BMCR_SPEED100;
1060 else if (phydev->speed == SPEED_10)
1061 ctl &= ~BMCR_SPEED100;
1062 else
1063 dev_err(ds->dev, "unsupported speed: %d\n", phydev->speed);
1064
1065 if (phydev->duplex == DUPLEX_FULL)
1066 ctl |= BMCR_FULLDPLX;
1067 else
1068 ctl &= ~BMCR_FULLDPLX;
1069
1070 res = lan9303_phy_write(ds, port, MII_BMCR, ctl);
1071
1072 if (port == chip->phy_addr_sel_strap) {
1073 /* Virtual Phy: Remove Turbo 200Mbit mode */
1074 lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, &ctl);
1075
1076 ctl &= ~LAN9303_VIRT_SPECIAL_TURBO;
1077 res = regmap_write(chip->regmap,
1078 LAN9303_VIRT_SPECIAL_CTRL, ctl);
776 }1079 }
1080}
777 1081
778 return -ENODEV;1082static int lan9303_port_enable(struct dsa_switch *ds, int port,
1083 struct phy_device *phy)
1084{
1085 struct lan9303 *chip = ds->priv;
1086
1087 return lan9303_enable_processing_port(chip, port);
779}1088}
780 1089
781static void lan9303_port_disable(struct dsa_switch *ds, int port,1090static void lan9303_port_disable(struct dsa_switch *ds, int port,
@@ -783,18 +1092,171 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port, · 1 unmodified line
783{1092{
784 struct lan9303 *chip = ds->priv;1093 struct lan9303 *chip = ds->priv;
785 1094
786 /* disable internal packet processing */1095 lan9303_disable_processing_port(chip, port);
787 switch (port) {1096 lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,
788 case 1:1097 MII_BMCR, BMCR_PDOWN);
789 case 2:1098}
790 lan9303_disable_processing_port(chip, port);1099
791 lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,1100static int lan9303_port_bridge_join(struct dsa_switch *ds, int port,
792 MII_BMCR, BMCR_PDOWN);1101 struct net_device *br)
1102{
1103 struct lan9303 *chip = ds->priv;
1104
1105 dev_dbg(chip->dev, "%s(port %d)\n", __func__, port);
1106 if (dsa_to_port(ds, 1)->bridge_dev == dsa_to_port(ds, 2)->bridge_dev) {
1107 lan9303_bridge_ports(chip);
1108 chip->is_bridged = true; /* unleash stp_state_set() */
1109 }
1110
1111 return 0;
1112}
1113
1114static void lan9303_port_bridge_leave(struct dsa_switch *ds, int port,
1115 struct net_device *br)
1116{
1117 struct lan9303 *chip = ds->priv;
1118
1119 dev_dbg(chip->dev, "%s(port %d)\n", __func__, port);
1120 if (chip->is_bridged) {
1121 lan9303_separate_ports(chip);
1122 chip->is_bridged = false;
1123 }
1124}
1125
1126static void lan9303_port_stp_state_set(struct dsa_switch *ds, int port,
1127 u8 state)
1128{
1129 int portmask, portstate;
1130 struct lan9303 *chip = ds->priv;
1131
1132 dev_dbg(chip->dev, "%s(port %d, state %d)\n",
1133 __func__, port, state);
1134
1135 switch (state) {
1136 case BR_STATE_DISABLED:
1137 portstate = LAN9303_SWE_PORT_STATE_DISABLED_PORT0;
1138 break;
1139 case BR_STATE_BLOCKING:
1140 case BR_STATE_LISTENING:
1141 portstate = LAN9303_SWE_PORT_STATE_BLOCKING_PORT0;
1142 break;
1143 case BR_STATE_LEARNING:
1144 portstate = LAN9303_SWE_PORT_STATE_LEARNING_PORT0;
1145 break;
1146 case BR_STATE_FORWARDING:
1147 portstate = LAN9303_SWE_PORT_STATE_FORWARDING_PORT0;
793 break;1148 break;
794 default:1149 default:
795 dev_dbg(chip->dev,1150 portstate = LAN9303_SWE_PORT_STATE_DISABLED_PORT0;
796 "Error: request to power down invalid port %d\n", port);1151 dev_err(chip->dev, "unknown stp state: port %d, state %d\n",
1152 port, state);
797 }1153 }
1154
1155 portmask = 0x3 << (port * 2);
1156 portstate <<= (port * 2);
1157
1158 chip->swe_port_state = (chip->swe_port_state & ~portmask) | portstate;
1159
1160 if (chip->is_bridged)
1161 lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_STATE,
1162 chip->swe_port_state);
1163 /* else: touching SWE_PORT_STATE would break port separation */
1164}
1165
1166static void lan9303_port_fast_age(struct dsa_switch *ds, int port)
1167{
1168 struct lan9303 *chip = ds->priv;
1169 struct del_port_learned_ctx del_ctx = {
1170 .port = port,
1171 };
1172
1173 dev_dbg(chip->dev, "%s(%d)\n", __func__, port);
1174 lan9303_alr_loop(chip, alr_loop_cb_del_port_learned, &del_ctx);
1175}
1176
1177static int lan9303_port_fdb_add(struct dsa_switch *ds, int port,
1178 const unsigned char *addr, u16 vid)
1179{
1180 struct lan9303 *chip = ds->priv;
1181
1182 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, addr, vid);
1183 if (vid)
1184 return -EOPNOTSUPP;
1185
1186 return lan9303_alr_add_port(chip, addr, port, false);
1187}
1188
1189static int lan9303_port_fdb_del(struct dsa_switch *ds, int port,
1190 const unsigned char *addr, u16 vid)
1191
1192{
1193 struct lan9303 *chip = ds->priv;
1194
1195 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, addr, vid);
1196 if (vid)
1197 return -EOPNOTSUPP;
1198 lan9303_alr_del_port(chip, addr, port);
1199
1200 return 0;
1201}
1202
1203static int lan9303_port_fdb_dump(struct dsa_switch *ds, int port,
1204 dsa_fdb_dump_cb_t *cb, void *data)
1205{
1206 struct lan9303 *chip = ds->priv;
1207 struct port_fdb_dump_ctx dump_ctx = {
1208 .port = port,
1209 .data = data,
1210 .cb = cb,
1211 };
1212
1213 dev_dbg(chip->dev, "%s(%d)\n", __func__, port);
1214 lan9303_alr_loop(chip, alr_loop_cb_fdb_port_dump, &dump_ctx);
1215
1216 return 0;
1217}
1218
1219static int lan9303_port_mdb_prepare(struct dsa_switch *ds, int port,
1220 const struct switchdev_obj_port_mdb *mdb,
1221 struct switchdev_trans *trans)
1222{
1223 struct lan9303 *chip = ds->priv;
1224
1225 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, mdb->addr,
1226 mdb->vid);
1227 if (mdb->vid)
1228 return -EOPNOTSUPP;
1229 if (lan9303_alr_cache_find_mac(chip, mdb->addr))
1230 return 0;
1231 if (!lan9303_alr_cache_find_free(chip))
1232 return -ENOSPC;
1233
1234 return 0;
1235}
1236
1237static void lan9303_port_mdb_add(struct dsa_switch *ds, int port,
1238 const struct switchdev_obj_port_mdb *mdb,
1239 struct switchdev_trans *trans)
1240{
1241 struct lan9303 *chip = ds->priv;
1242
1243 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, mdb->addr,
1244 mdb->vid);
1245 lan9303_alr_add_port(chip, mdb->addr, port, false);
1246}
1247
1248static int lan9303_port_mdb_del(struct dsa_switch *ds, int port,
1249 const struct switchdev_obj_port_mdb *mdb)
1250{
1251 struct lan9303 *chip = ds->priv;
1252
1253 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, mdb->addr,
1254 mdb->vid);
1255 if (mdb->vid)
1256 return -EOPNOTSUPP;
1257 lan9303_alr_del_port(chip, mdb->addr, port);
1258
1259 return 0;
798}1260}
799 1261
800static const struct dsa_switch_ops lan9303_switch_ops = {1262static const struct dsa_switch_ops lan9303_switch_ops = {
@@ -803,10 +1265,21 @@ static const struct dsa_switch_ops lan9303_switch_ops = { · 2 unmodified lines
803 .get_strings = lan9303_get_strings,1265 .get_strings = lan9303_get_strings,
804 .phy_read = lan9303_phy_read,1266 .phy_read = lan9303_phy_read,
805 .phy_write = lan9303_phy_write,1267 .phy_write = lan9303_phy_write,
1268 .adjust_link = lan9303_adjust_link,
806 .get_ethtool_stats = lan9303_get_ethtool_stats,1269 .get_ethtool_stats = lan9303_get_ethtool_stats,
807 .get_sset_count = lan9303_get_sset_count,1270 .get_sset_count = lan9303_get_sset_count,
808 .port_enable = lan9303_port_enable,1271 .port_enable = lan9303_port_enable,
809 .port_disable = lan9303_port_disable,1272 .port_disable = lan9303_port_disable,
1273 .port_bridge_join = lan9303_port_bridge_join,
1274 .port_bridge_leave = lan9303_port_bridge_leave,
1275 .port_stp_state_set = lan9303_port_stp_state_set,
1276 .port_fast_age = lan9303_port_fast_age,
1277 .port_fdb_add = lan9303_port_fdb_add,
1278 .port_fdb_del = lan9303_port_fdb_del,
1279 .port_fdb_dump = lan9303_port_fdb_dump,
1280 .port_mdb_prepare = lan9303_port_mdb_prepare,
1281 .port_mdb_add = lan9303_port_mdb_add,
1282 .port_mdb_del = lan9303_port_mdb_del,
810};1283};
811 1284
812static int lan9303_register_switch(struct lan9303 *chip)1285static int lan9303_register_switch(struct lan9303 *chip)
@@ -828,7 +1301,7 @@ static void lan9303_probe_reset_gpio(struct lan9303 *chip, · 15 unmodified lines
828 chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",1301 chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
829 GPIOD_OUT_LOW);1302 GPIOD_OUT_LOW);
830 1303
831 if (!chip->reset_gpio) {1304 if (IS_ERR(chip->reset_gpio)) {
832 dev_dbg(chip->dev, "No reset GPIO defined\n");1305 dev_dbg(chip->dev, "No reset GPIO defined\n");
833 return;1306 return;
834 }1307 }
drivers/net/dsa/lan9303.h+1−20
@@ -3,26 +3,7 @@ · 2 unmodified lines
3#include <linux/device.h>3#include <linux/device.h>
4#include <net/dsa.h>4#include <net/dsa.h>
5 5
6struct lan9303;6#include <linux/dsa/lan9303.h>
7
8struct lan9303_phy_ops {
9 /* PHY 1 and 2 access*/
10 int (*phy_read)(struct lan9303 *chip, int port, int regnum);
11 int (*phy_write)(struct lan9303 *chip, int port,
12 int regnum, u16 val);
13};
14
15struct lan9303 {
16 struct device *dev;
17 struct regmap *regmap;
18 struct regmap_irq_chip_data *irq_data;
19 struct gpio_desc *reset_gpio;
20 u32 reset_duration; /* in [ms] */
21 bool phy_addr_sel_strap;
22 struct dsa_switch *ds;
23 struct mutex indirect_mutex; /* protect indexed register access */
24 const struct lan9303_phy_ops *ops;
25};
26 7
27extern const struct regmap_access_table lan9303_register_set;8extern const struct regmap_access_table lan9303_register_set;
28extern const struct lan9303_phy_ops lan9303_indirect_phy_ops;9extern const struct lan9303_phy_ops lan9303_indirect_phy_ops;
drivers/net/dsa/lan9303_i2c.c+1−1
@@ -50,7 +50,7 @@ static int lan9303_i2c_probe(struct i2c_client *client, · 49 unmodified lines
50 return -ENOMEM;50 return -ENOMEM;
51 51
52 sw_dev->chip.regmap = devm_regmap_init_i2c(client,52 sw_dev->chip.regmap = devm_regmap_init_i2c(client,
53 &lan9303_i2c_regmap_config);53 &lan9303_i2c_regmap_config);
54 if (IS_ERR(sw_dev->chip.regmap)) {54 if (IS_ERR(sw_dev->chip.regmap)) {
55 ret = PTR_ERR(sw_dev->chip.regmap);55 ret = PTR_ERR(sw_dev->chip.regmap);
56 dev_err(&client->dev, "Failed to allocate register map: %d\n",56 dev_err(&client->dev, "Failed to allocate register map: %d\n",
drivers/net/dsa/lan9303_mdio.c+4−3
@@ -67,14 +67,15 @@ static int lan9303_mdio_read(void *ctx, uint32_t reg, uint32_t *val) · 66 unmodified lines
67 return 0;67 return 0;
68}68}
69 69
70int lan9303_mdio_phy_write(struct lan9303 *chip, int phy, int reg, u16 val)70static int lan9303_mdio_phy_write(struct lan9303 *chip, int phy, int reg,
71 u16 val)
71{72{
72 struct lan9303_mdio *sw_dev = dev_get_drvdata(chip->dev);73 struct lan9303_mdio *sw_dev = dev_get_drvdata(chip->dev);
73 74
74 return mdiobus_write_nested(sw_dev->device->bus, phy, reg, val);75 return mdiobus_write_nested(sw_dev->device->bus, phy, reg, val);
75}76}
76 77
77int lan9303_mdio_phy_read(struct lan9303 *chip, int phy, int reg)78static int lan9303_mdio_phy_read(struct lan9303 *chip, int phy, int reg)
78{79{
79 struct lan9303_mdio *sw_dev = dev_get_drvdata(chip->dev);80 struct lan9303_mdio *sw_dev = dev_get_drvdata(chip->dev);
80 81
@@ -115,7 +116,7 @@ static int lan9303_mdio_probe(struct mdio_device *mdiodev) · 34 unmodified lines
115 return -ENOMEM;116 return -ENOMEM;
116 117
117 sw_dev->chip.regmap = devm_regmap_init(&mdiodev->dev, NULL, sw_dev,118 sw_dev->chip.regmap = devm_regmap_init(&mdiodev->dev, NULL, sw_dev,
118 &lan9303_mdio_regmap_config);119 &lan9303_mdio_regmap_config);
119 if (IS_ERR(sw_dev->chip.regmap)) {120 if (IS_ERR(sw_dev->chip.regmap)) {
120 ret = PTR_ERR(sw_dev->chip.regmap);121 ret = PTR_ERR(sw_dev->chip.regmap);
121 dev_err(&mdiodev->dev, "regmap init failed: %d\n", ret);122 dev_err(&mdiodev->dev, "regmap init failed: %d\n", ret);
drivers/net/dsa/microchip/ksz_common.c+2−1
@@ -394,7 +394,8 @@ static int ksz_setup(struct dsa_switch *ds) · 393 unmodified lines
394 return 0;394 return 0;
395}395}
396 396
397static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds)397static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
398 int port)
398{399{
399 return DSA_TAG_PROTO_KSZ;400 return DSA_TAG_PROTO_KSZ;
400}401}
drivers/net/dsa/mt7530.c+11−10
@@ -564,7 +564,8 @@ static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum) · 563 unmodified lines
564 return mdiobus_read_nested(priv->bus, port, regnum);564 return mdiobus_read_nested(priv->bus, port, regnum);
565}565}
566 566
567int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)567static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum,
568 u16 val)
568{569{
569 struct mt7530_priv *priv = ds->priv;570 struct mt7530_priv *priv = ds->priv;
570 571
@@ -687,7 +688,7 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv, · 116 unmodified lines
687 * the switch688 * the switch
688 */689 */
689 mt7530_write(priv, MT7530_PCR_P(port),690 mt7530_write(priv, MT7530_PCR_P(port),
690 PCR_MATRIX(priv->ds->enabled_port_mask));691 PCR_MATRIX(dsa_user_ports(priv->ds)));
691 692
692 return 0;693 return 0;
693}694}
@@ -780,8 +781,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port, · 86 unmodified lines
780 * same bridge. If the port is disabled, port matrix is kept781 * same bridge. If the port is disabled, port matrix is kept
781 * and not being setup until the port becomes enabled.782 * and not being setup until the port becomes enabled.
782 */783 */
783 if (ds->enabled_port_mask & BIT(i) && i != port) {784 if (dsa_is_user_port(ds, i) && i != port) {
784 if (ds->ports[i].bridge_dev != bridge)785 if (dsa_to_port(ds, i)->bridge_dev != bridge)
785 continue;786 continue;
786 if (priv->ports[i].enable)787 if (priv->ports[i].enable)
787 mt7530_set(priv, MT7530_PCR_P(i),788 mt7530_set(priv, MT7530_PCR_P(i),
@@ -817,8 +818,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, · 29 unmodified lines
817 * in the same bridge. If the port is disabled, port matrix818 * in the same bridge. If the port is disabled, port matrix
818 * is kept and not being setup until the port becomes enabled.819 * is kept and not being setup until the port becomes enabled.
819 */820 */
820 if (ds->enabled_port_mask & BIT(i) && i != port) {821 if (dsa_is_user_port(ds, i) && i != port) {
821 if (ds->ports[i].bridge_dev != bridge)822 if (dsa_to_port(ds, i)->bridge_dev != bridge)
822 continue;823 continue;
823 if (priv->ports[i].enable)824 if (priv->ports[i].enable)
824 mt7530_clear(priv, MT7530_PCR_P(i),825 mt7530_clear(priv, MT7530_PCR_P(i),
@@ -906,11 +907,11 @@ err: · 81 unmodified lines
906}907}
907 908
908static enum dsa_tag_protocol909static enum dsa_tag_protocol
909mtk_get_tag_protocol(struct dsa_switch *ds)910mtk_get_tag_protocol(struct dsa_switch *ds, int port)
910{911{
911 struct mt7530_priv *priv = ds->priv;912 struct mt7530_priv *priv = ds->priv;
912 913
913 if (!dsa_is_cpu_port(ds, MT7530_CPU_PORT)) {914 if (port != MT7530_CPU_PORT) {
914 dev_warn(priv->dev,915 dev_warn(priv->dev,
915 "port not matched with tagging CPU port\n");916 "port not matched with tagging CPU port\n");
916 return DSA_TAG_PROTO_NONE;917 return DSA_TAG_PROTO_NONE;
@@ -928,11 +929,11 @@ mt7530_setup(struct dsa_switch *ds) · 11 unmodified lines
928 struct device_node *dn;929 struct device_node *dn;
929 struct mt7530_dummy_poll p;930 struct mt7530_dummy_poll p;
930 931
931 /* The parent node of cpu_dp->netdev which holds the common system932 /* The parent node of master netdev which holds the common system
932 * controller also is the container for two GMACs nodes representing933 * controller also is the container for two GMACs nodes representing
933 * as two netdev instances.934 * as two netdev instances.
934 */935 */
935 dn = ds->dst->cpu_dp->netdev->dev.of_node->parent;936 dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent;
936 priv->ethernet = syscon_node_to_regmap(dn);937 priv->ethernet = syscon_node_to_regmap(dn);
937 if (IS_ERR(priv->ethernet))938 if (IS_ERR(priv->ethernet))
938 return PTR_ERR(priv->ethernet);939 return PTR_ERR(priv->ethernet);
drivers/net/dsa/mv88e6060.c+30−21
@@ -9,6 +9,7 @@ · 8 unmodified lines
9 */9 */
10 10
11#include <linux/delay.h>11#include <linux/delay.h>
12#include <linux/etherdevice.h>
12#include <linux/jiffies.h>13#include <linux/jiffies.h>
13#include <linux/list.h>14#include <linux/list.h>
14#include <linux/module.h>15#include <linux/module.h>
@@ -69,7 +70,8 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr) · 54 unmodified lines
69 return NULL;70 return NULL;
70}71}
71 72
72static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds)73static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds,
74 int port)
73{75{
74 return DSA_TAG_PROTO_TRAILER;76 return DSA_TAG_PROTO_TRAILER;
75}77}
@@ -174,9 +176,8 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p) · 98 unmodified lines
174 */176 */
175 REG_WRITE(addr, PORT_VLAN_MAP,177 REG_WRITE(addr, PORT_VLAN_MAP,
176 ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |178 ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
177 (dsa_is_cpu_port(ds, p) ?179 (dsa_is_cpu_port(ds, p) ? dsa_user_ports(ds) :
178 ds->enabled_port_mask :180 BIT(dsa_to_port(ds, p)->cpu_dp->index)));
179 BIT(ds->dst->cpu_dp->index)));
180 181
181 /* Port Association Vector: when learning source addresses182 /* Port Association Vector: when learning source addresses
182 * of packets, add the address to the address database using183 * of packets, add the address to the address database using
@@ -188,6 +189,27 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p) · 5 unmodified lines
188 return 0;189 return 0;
189}190}
190 191
192static int mv88e6060_setup_addr(struct dsa_switch *ds)
193{
194 u8 addr[ETH_ALEN];
195 u16 val;
196
197 eth_random_addr(addr);
198
199 val = addr[0] << 8 | addr[1];
200
201 /* The multicast bit is always transmitted as a zero, so the switch uses
202 * bit 8 for "DiffAddr", where 0 means all ports transmit the same SA.
203 */
204 val &= 0xfeff;
205
206 REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, val);
207 REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
208 REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
209
210 return 0;
211}
212
191static int mv88e6060_setup(struct dsa_switch *ds)213static int mv88e6060_setup(struct dsa_switch *ds)
192{214{
193 int ret;215 int ret;
@@ -203,6 +225,10 @@ static int mv88e6060_setup(struct dsa_switch *ds) · 9 unmodified lines
203 if (ret < 0)225 if (ret < 0)
204 return ret;226 return ret;
205 227
228 ret = mv88e6060_setup_addr(ds);
229 if (ret < 0)
230 return ret;
231
206 for (i = 0; i < MV88E6060_PORTS; i++) {232 for (i = 0; i < MV88E6060_PORTS; i++) {
207 ret = mv88e6060_setup_port(ds, i);233 ret = mv88e6060_setup_port(ds, i);
208 if (ret < 0)234 if (ret < 0)
@@ -212,22 +238,6 @@ static int mv88e6060_setup(struct dsa_switch *ds) · 3 unmodified lines
212 return 0;238 return 0;
213}239}
214 240
215static int mv88e6060_set_addr(struct dsa_switch *ds, u8 *addr)
216{
217 u16 val = addr[0] << 8 | addr[1];
218
219 /* The multicast bit is always transmitted as a zero, so the switch uses
220 * bit 8 for "DiffAddr", where 0 means all ports transmit the same SA.
221 */
222 val &= 0xfeff;
223
224 REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, val);
225 REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
226 REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
227
228 return 0;
229}
230
231static int mv88e6060_port_to_phy_addr(int port)241static int mv88e6060_port_to_phy_addr(int port)
232{242{
233 if (port >= 0 && port < MV88E6060_PORTS)243 if (port >= 0 && port < MV88E6060_PORTS)
@@ -262,7 +272,6 @@ static const struct dsa_switch_ops mv88e6060_switch_ops = { · 28 unmodified lines
262 .get_tag_protocol = mv88e6060_get_tag_protocol,272 .get_tag_protocol = mv88e6060_get_tag_protocol,
263 .probe = mv88e6060_drv_probe,273 .probe = mv88e6060_drv_probe,
264 .setup = mv88e6060_setup,274 .setup = mv88e6060_setup,
265 .set_addr = mv88e6060_set_addr,
266 .phy_read = mv88e6060_phy_read,275 .phy_read = mv88e6060_phy_read,
267 .phy_write = mv88e6060_phy_write,276 .phy_write = mv88e6060_phy_write,
268};277};
drivers/net/dsa/mv88e6xxx/chip.c+127−83
@@ -851,7 +851,7 @@ static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port) · 850 unmodified lines
851 for (i = 0; i < mv88e6xxx_num_ports(chip); ++i)851 for (i = 0; i < mv88e6xxx_num_ports(chip); ++i)
852 if (dsa_is_cpu_port(chip->ds, i) ||852 if (dsa_is_cpu_port(chip->ds, i) ||
853 dsa_is_dsa_port(chip->ds, i) ||853 dsa_is_dsa_port(chip->ds, i) ||
854 (br && chip->ds->ports[i].bridge_dev == br))854 (br && dsa_to_port(chip->ds, i)->bridge_dev == br))
855 pvlan |= BIT(i);855 pvlan |= BIT(i);
856 856
857 return pvlan;857 return pvlan;
@@ -932,6 +932,19 @@ static int mv88e6xxx_irl_setup(struct mv88e6xxx_chip *chip) · 74 unmodified lines
932 return 0;932 return 0;
933}933}
934 934
935static int mv88e6xxx_mac_setup(struct mv88e6xxx_chip *chip)
936{
937 if (chip->info->ops->set_switch_mac) {
938 u8 addr[ETH_ALEN];
939
940 eth_random_addr(addr);
941
942 return chip->info->ops->set_switch_mac(chip, addr);
943 }
944
945 return 0;
946}
947
935static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port)948static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port)
936{949{
937 u16 pvlan = 0;950 u16 pvlan = 0;
@@ -1124,23 +1137,23 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, · 186 unmodified lines
1124 if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i))1137 if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i))
1125 continue;1138 continue;
1126 1139
1127 if (!ds->ports[port].netdev)1140 if (!ds->ports[i].slave)
1128 continue;1141 continue;
1129 1142
1130 if (vlan.member[i] ==1143 if (vlan.member[i] ==
1131 MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)1144 MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
1132 continue;1145 continue;
1133 1146
1134 if (ds->ports[i].bridge_dev ==1147 if (dsa_to_port(ds, i)->bridge_dev ==
1135 ds->ports[port].bridge_dev)1148 ds->ports[port].bridge_dev)
1136 break; /* same bridge, check next VLAN */1149 break; /* same bridge, check next VLAN */
1137 1150
1138 if (!ds->ports[i].bridge_dev)1151 if (!dsa_to_port(ds, i)->bridge_dev)
1139 continue;1152 continue;
1140 1153
1141 dev_err(ds->dev, "p%d: hw VLAN %d already used by %s\n",1154 dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n",
1142 port, vlan.vid,1155 port, vlan.vid, i,
1143 netdev_name(ds->ports[i].bridge_dev));1156 netdev_name(dsa_to_port(ds, i)->bridge_dev));
1144 err = -EOPNOTSUPP;1157 err = -EOPNOTSUPP;
1145 goto unlock;1158 goto unlock;
1146 }1159 }
@@ -1195,6 +1208,73 @@ mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, · 48 unmodified lines
1195 return 0;1208 return 0;
1196}1209}
1197 1210
1211static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
1212 const unsigned char *addr, u16 vid,
1213 u8 state)
1214{
1215 struct mv88e6xxx_vtu_entry vlan;
1216 struct mv88e6xxx_atu_entry entry;
1217 int err;
1218
1219 /* Null VLAN ID corresponds to the port private database */
1220 if (vid == 0)
1221 err = mv88e6xxx_port_get_fid(chip, port, &vlan.fid);
1222 else
1223 err = mv88e6xxx_vtu_get(chip, vid, &vlan, false);
1224 if (err)
1225 return err;
1226
1227 entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
1228 ether_addr_copy(entry.mac, addr);
1229 eth_addr_dec(entry.mac);
1230
1231 err = mv88e6xxx_g1_atu_getnext(chip, vlan.fid, &entry);
1232 if (err)
1233 return err;
1234
1235 /* Initialize a fresh ATU entry if it isn't found */
1236 if (entry.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED ||
1237 !ether_addr_equal(entry.mac, addr)) {
1238 memset(&entry, 0, sizeof(entry));
1239 ether_addr_copy(entry.mac, addr);
1240 }
1241
1242 /* Purge the ATU entry only if no port is using it anymore */
1243 if (state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) {
1244 entry.portvec &= ~BIT(port);
1245 if (!entry.portvec)
1246 entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
1247 } else {
1248 entry.portvec |= BIT(port);
1249 entry.state = state;
1250 }
1251
1252 return mv88e6xxx_g1_atu_loadpurge(chip, vlan.fid, &entry);
1253}
1254
1255static int mv88e6xxx_port_add_broadcast(struct mv88e6xxx_chip *chip, int port,
1256 u16 vid)
1257{
1258 const char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
1259 u8 state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC;
1260
1261 return mv88e6xxx_port_db_load_purge(chip, port, broadcast, vid, state);
1262}
1263
1264static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid)
1265{
1266 int port;
1267 int err;
1268
1269 for (port = 0; port < mv88e6xxx_num_ports(chip); port++) {
1270 err = mv88e6xxx_port_add_broadcast(chip, port, vid);
1271 if (err)
1272 return err;
1273 }
1274
1275 return 0;
1276}
1277
1198static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,1278static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,
1199 u16 vid, u8 member)1279 u16 vid, u8 member)
1200{1280{
@@ -1207,7 +1287,11 @@ static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port, · 6 unmodified lines
1207 1287
1208 vlan.member[port] = member;1288 vlan.member[port] = member;
1209 1289
1210 return mv88e6xxx_vtu_loadpurge(chip, &vlan);1290 err = mv88e6xxx_vtu_loadpurge(chip, &vlan);
1291 if (err)
1292 return err;
1293
1294 return mv88e6xxx_broadcast_setup(chip, vid);
1211}1295}
1212 1296
1213static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,1297static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
@@ -1311,50 +1395,6 @@ unlock: · 97 unmodified lines
1311 return err;1395 return err;
1312}1396}
1313 1397
1314static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
1315 const unsigned char *addr, u16 vid,
1316 u8 state)
1317{
1318 struct mv88e6xxx_vtu_entry vlan;
1319 struct mv88e6xxx_atu_entry entry;
1320 int err;
1321
1322 /* Null VLAN ID corresponds to the port private database */
1323 if (vid == 0)
1324 err = mv88e6xxx_port_get_fid(chip, port, &vlan.fid);
1325 else
1326 err = mv88e6xxx_vtu_get(chip, vid, &vlan, false);
1327 if (err)
1328 return err;
1329
1330 entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
1331 ether_addr_copy(entry.mac, addr);
1332 eth_addr_dec(entry.mac);
1333
1334 err = mv88e6xxx_g1_atu_getnext(chip, vlan.fid, &entry);
1335 if (err)
1336 return err;
1337
1338 /* Initialize a fresh ATU entry if it isn't found */
1339 if (entry.state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED ||
1340 !ether_addr_equal(entry.mac, addr)) {
1341 memset(&entry, 0, sizeof(entry));
1342 ether_addr_copy(entry.mac, addr);
1343 }
1344
1345 /* Purge the ATU entry only if no port is using it anymore */
1346 if (state == MV88E6XXX_G1_ATU_DATA_STATE_UNUSED) {
1347 entry.portvec &= ~BIT(port);
1348 if (!entry.portvec)
1349 entry.state = MV88E6XXX_G1_ATU_DATA_STATE_UNUSED;
1350 } else {
1351 entry.portvec |= BIT(port);
1352 entry.state = state;
1353 }
1354
1355 return mv88e6xxx_g1_atu_loadpurge(chip, vlan.fid, &entry);
1356}
1357
1358static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,1398static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
1359 const unsigned char *addr, u16 vid)1399 const unsigned char *addr, u16 vid)
1360{1400{
@@ -1663,7 +1703,7 @@ static int mv88e6xxx_setup_port_mode(struct mv88e6xxx_chip *chip, int port) · 302 unmodified lines
1663 if (dsa_is_dsa_port(chip->ds, port))1703 if (dsa_is_dsa_port(chip->ds, port))
1664 return mv88e6xxx_set_port_mode_dsa(chip, port);1704 return mv88e6xxx_set_port_mode_dsa(chip, port);
1665 1705
1666 if (dsa_is_normal_port(chip->ds, port))1706 if (dsa_is_user_port(chip->ds, port))
1667 return mv88e6xxx_set_port_mode_normal(chip, port);1707 return mv88e6xxx_set_port_mode_normal(chip, port);
1668 1708
1669 /* Setup CPU port mode depending on its supported tag format */1709 /* Setup CPU port mode depending on its supported tag format */
@@ -1964,19 +2004,7 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip) · 294 unmodified lines
1964 if (err)2004 if (err)
1965 return err;2005 return err;
1966 2006
1967 /* Clear the statistics counters for all ports */2007 return mv88e6xxx_g1_stats_clear(chip);
1968 err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP,
1969 MV88E6XXX_G1_STATS_OP_BUSY |
1970 MV88E6XXX_G1_STATS_OP_FLUSH_ALL);
1971 if (err)
1972 return err;
1973
1974 /* Wait for the flush to complete. */
1975 err = mv88e6xxx_g1_stats_wait(chip);
1976 if (err)
1977 return err;
1978
1979 return 0;
1980}2008}
1981 2009
1982static int mv88e6xxx_setup(struct dsa_switch *ds)2010static int mv88e6xxx_setup(struct dsa_switch *ds)
@@ -1992,6 +2020,9 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) · 9 unmodified lines
1992 2020
1993 /* Setup Switch Port Registers */2021 /* Setup Switch Port Registers */
1994 for (i = 0; i < mv88e6xxx_num_ports(chip); i++) {2022 for (i = 0; i < mv88e6xxx_num_ports(chip); i++) {
2023 if (dsa_is_unused_port(ds, i))
2024 continue;
2025
1995 err = mv88e6xxx_setup_port(chip, i);2026 err = mv88e6xxx_setup_port(chip, i);
1996 if (err)2027 if (err)
1997 goto unlock;2028 goto unlock;
@@ -2013,6 +2044,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) · 15 unmodified lines
2013 if (err)2044 if (err)
2014 goto unlock;2045 goto unlock;
2015 2046
2047 err = mv88e6xxx_mac_setup(chip);
2048 if (err)
2049 goto unlock;
2050
2016 err = mv88e6xxx_phy_setup(chip);2051 err = mv88e6xxx_phy_setup(chip);
2017 if (err)2052 if (err)
2018 goto unlock;2053 goto unlock;
@@ -2029,6 +2064,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) · 10 unmodified lines
2029 if (err)2064 if (err)
2030 goto unlock;2065 goto unlock;
2031 2066
2067 err = mv88e6xxx_broadcast_setup(chip, 0);
2068 if (err)
2069 goto unlock;
2070
2032 err = mv88e6xxx_pot_setup(chip);2071 err = mv88e6xxx_pot_setup(chip);
2033 if (err)2072 if (err)
2034 goto unlock;2073 goto unlock;
@@ -2043,21 +2082,6 @@ unlock: · 8 unmodified lines
2043 return err;2082 return err;
2044}2083}
2045 2084
2046static int mv88e6xxx_set_addr(struct dsa_switch *ds, u8 *addr)
2047{
2048 struct mv88e6xxx_chip *chip = ds->priv;
2049 int err;
2050
2051 if (!chip->info->ops->set_switch_mac)
2052 return -EOPNOTSUPP;
2053
2054 mutex_lock(&chip->reg_lock);
2055 err = chip->info->ops->set_switch_mac(chip, addr);
2056 mutex_unlock(&chip->reg_lock);
2057
2058 return err;
2059}
2060
2061static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)2085static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
2062{2086{
2063 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;2087 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;
@@ -2263,6 +2287,7 @@ static const struct mv88e6xxx_ops mv88e6085_ops = { · 199 unmodified lines
2263 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2287 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2264 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2288 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2265 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,2289 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
2290 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2266 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2291 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2267 .stats_get_strings = mv88e6095_stats_get_strings,2292 .stats_get_strings = mv88e6095_stats_get_strings,
2268 .stats_get_stats = mv88e6095_stats_get_stats,2293 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2290,6 +2315,7 @@ static const struct mv88e6xxx_ops mv88e6095_ops = { · 21 unmodified lines
2290 .port_set_egress_floods = mv88e6185_port_set_egress_floods,2315 .port_set_egress_floods = mv88e6185_port_set_egress_floods,
2291 .port_set_upstream_port = mv88e6095_port_set_upstream_port,2316 .port_set_upstream_port = mv88e6095_port_set_upstream_port,
2292 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,2317 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
2318 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2293 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2319 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2294 .stats_get_strings = mv88e6095_stats_get_strings,2320 .stats_get_strings = mv88e6095_stats_get_strings,
2295 .stats_get_stats = mv88e6095_stats_get_stats,2321 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2320,6 +2346,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { · 24 unmodified lines
2320 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2346 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2321 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2347 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2322 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,2348 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
2349 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2323 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2350 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2324 .stats_get_strings = mv88e6095_stats_get_strings,2351 .stats_get_strings = mv88e6095_stats_get_strings,
2325 .stats_get_stats = mv88e6095_stats_get_stats,2352 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2347,6 +2374,7 @@ static const struct mv88e6xxx_ops mv88e6123_ops = { · 21 unmodified lines
2347 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2374 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2348 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2375 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2349 .stats_snapshot = mv88e6320_g1_stats_snapshot,2376 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2377 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2350 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2378 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2351 .stats_get_strings = mv88e6095_stats_get_strings,2379 .stats_get_strings = mv88e6095_stats_get_strings,
2352 .stats_get_stats = mv88e6095_stats_get_stats,2380 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2377,6 +2405,7 @@ static const struct mv88e6xxx_ops mv88e6131_ops = { · 24 unmodified lines
2377 .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,2405 .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
2378 .port_pause_limit = mv88e6097_port_pause_limit,2406 .port_pause_limit = mv88e6097_port_pause_limit,
2379 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,2407 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
2408 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2380 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2409 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2381 .stats_get_strings = mv88e6095_stats_get_strings,2410 .stats_get_strings = mv88e6095_stats_get_strings,
2382 .stats_get_stats = mv88e6095_stats_get_stats,2411 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2413,6 +2442,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { · 30 unmodified lines
2413 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2442 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2414 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2443 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2415 .stats_snapshot = mv88e6390_g1_stats_snapshot,2444 .stats_snapshot = mv88e6390_g1_stats_snapshot,
2445 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2416 .stats_get_sset_count = mv88e6320_stats_get_sset_count,2446 .stats_get_sset_count = mv88e6320_stats_get_sset_count,
2417 .stats_get_strings = mv88e6320_stats_get_strings,2447 .stats_get_strings = mv88e6320_stats_get_strings,
2418 .stats_get_stats = mv88e6390_stats_get_stats,2448 .stats_get_stats = mv88e6390_stats_get_stats,
@@ -2445,6 +2475,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { · 26 unmodified lines
2445 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2475 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2446 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2476 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2447 .stats_snapshot = mv88e6320_g1_stats_snapshot,2477 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2478 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2448 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2479 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2449 .stats_get_strings = mv88e6095_stats_get_strings,2480 .stats_get_strings = mv88e6095_stats_get_strings,
2450 .stats_get_stats = mv88e6095_stats_get_stats,2481 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2470,6 +2501,7 @@ static const struct mv88e6xxx_ops mv88e6165_ops = { · 19 unmodified lines
2470 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2501 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2471 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2502 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2472 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,2503 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
2504 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2473 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2505 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2474 .stats_get_strings = mv88e6095_stats_get_strings,2506 .stats_get_strings = mv88e6095_stats_get_strings,
2475 .stats_get_stats = mv88e6095_stats_get_stats,2507 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2503,6 +2535,7 @@ static const struct mv88e6xxx_ops mv88e6171_ops = { · 27 unmodified lines
2503 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2535 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2504 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2536 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2505 .stats_snapshot = mv88e6320_g1_stats_snapshot,2537 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2538 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2506 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2539 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2507 .stats_get_strings = mv88e6095_stats_get_strings,2540 .stats_get_strings = mv88e6095_stats_get_strings,
2508 .stats_get_stats = mv88e6095_stats_get_stats,2541 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2538,6 +2571,7 @@ static const struct mv88e6xxx_ops mv88e6172_ops = { · 29 unmodified lines
2538 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2571 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2539 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2572 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2540 .stats_snapshot = mv88e6320_g1_stats_snapshot,2573 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2574 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2541 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2575 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2542 .stats_get_strings = mv88e6095_stats_get_strings,2576 .stats_get_strings = mv88e6095_stats_get_strings,
2543 .stats_get_stats = mv88e6095_stats_get_stats,2577 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2572,6 +2606,7 @@ static const struct mv88e6xxx_ops mv88e6175_ops = { · 28 unmodified lines
2572 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2606 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2573 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2607 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2574 .stats_snapshot = mv88e6320_g1_stats_snapshot,2608 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2609 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2575 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2610 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2576 .stats_get_strings = mv88e6095_stats_get_strings,2611 .stats_get_strings = mv88e6095_stats_get_strings,
2577 .stats_get_stats = mv88e6095_stats_get_stats,2612 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2607,6 +2642,7 @@ static const struct mv88e6xxx_ops mv88e6176_ops = { · 29 unmodified lines
2607 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2642 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2608 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2643 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2609 .stats_snapshot = mv88e6320_g1_stats_snapshot,2644 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2645 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2610 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2646 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2611 .stats_get_strings = mv88e6095_stats_get_strings,2647 .stats_get_strings = mv88e6095_stats_get_strings,
2612 .stats_get_stats = mv88e6095_stats_get_stats,2648 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2634,6 +2670,7 @@ static const struct mv88e6xxx_ops mv88e6185_ops = { · 21 unmodified lines
2634 .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting,2670 .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting,
2635 .port_set_upstream_port = mv88e6095_port_set_upstream_port,2671 .port_set_upstream_port = mv88e6095_port_set_upstream_port,
2636 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,2672 .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
2673 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2637 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2674 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2638 .stats_get_strings = mv88e6095_stats_get_strings,2675 .stats_get_strings = mv88e6095_stats_get_strings,
2639 .stats_get_stats = mv88e6095_stats_get_stats,2676 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2775,6 +2812,7 @@ static const struct mv88e6xxx_ops mv88e6240_ops = { · 135 unmodified lines
2775 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2812 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2776 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2813 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2777 .stats_snapshot = mv88e6320_g1_stats_snapshot,2814 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2815 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2778 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2816 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2779 .stats_get_strings = mv88e6095_stats_get_strings,2817 .stats_get_strings = mv88e6095_stats_get_strings,
2780 .stats_get_stats = mv88e6095_stats_get_stats,2818 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2846,6 +2884,7 @@ static const struct mv88e6xxx_ops mv88e6320_ops = { · 65 unmodified lines
2846 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2884 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2847 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2885 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2848 .stats_snapshot = mv88e6320_g1_stats_snapshot,2886 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2887 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2849 .stats_get_sset_count = mv88e6320_stats_get_sset_count,2888 .stats_get_sset_count = mv88e6320_stats_get_sset_count,
2850 .stats_get_strings = mv88e6320_stats_get_strings,2889 .stats_get_strings = mv88e6320_stats_get_strings,
2851 .stats_get_stats = mv88e6320_stats_get_stats,2890 .stats_get_stats = mv88e6320_stats_get_stats,
@@ -2879,6 +2918,7 @@ static const struct mv88e6xxx_ops mv88e6321_ops = { · 27 unmodified lines
2879 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2918 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2880 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2919 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2881 .stats_snapshot = mv88e6320_g1_stats_snapshot,2920 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2921 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2882 .stats_get_sset_count = mv88e6320_stats_get_sset_count,2922 .stats_get_sset_count = mv88e6320_stats_get_sset_count,
2883 .stats_get_strings = mv88e6320_stats_get_strings,2923 .stats_get_strings = mv88e6320_stats_get_strings,
2884 .stats_get_stats = mv88e6320_stats_get_stats,2924 .stats_get_stats = mv88e6320_stats_get_stats,
@@ -2911,6 +2951,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { · 26 unmodified lines
2911 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2951 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2912 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2952 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2913 .stats_snapshot = mv88e6390_g1_stats_snapshot,2953 .stats_snapshot = mv88e6390_g1_stats_snapshot,
2954 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2914 .stats_get_sset_count = mv88e6320_stats_get_sset_count,2955 .stats_get_sset_count = mv88e6320_stats_get_sset_count,
2915 .stats_get_strings = mv88e6320_stats_get_strings,2956 .stats_get_strings = mv88e6320_stats_get_strings,
2916 .stats_get_stats = mv88e6390_stats_get_stats,2957 .stats_get_stats = mv88e6390_stats_get_stats,
@@ -2944,6 +2985,7 @@ static const struct mv88e6xxx_ops mv88e6350_ops = { · 27 unmodified lines
2944 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,2985 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2945 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,2986 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2946 .stats_snapshot = mv88e6320_g1_stats_snapshot,2987 .stats_snapshot = mv88e6320_g1_stats_snapshot,
2988 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2947 .stats_get_sset_count = mv88e6095_stats_get_sset_count,2989 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2948 .stats_get_strings = mv88e6095_stats_get_strings,2990 .stats_get_strings = mv88e6095_stats_get_strings,
2949 .stats_get_stats = mv88e6095_stats_get_stats,2991 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -2977,6 +3019,7 @@ static const struct mv88e6xxx_ops mv88e6351_ops = { · 27 unmodified lines
2977 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,3019 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
2978 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,3020 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
2979 .stats_snapshot = mv88e6320_g1_stats_snapshot,3021 .stats_snapshot = mv88e6320_g1_stats_snapshot,
3022 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
2980 .stats_get_sset_count = mv88e6095_stats_get_sset_count,3023 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
2981 .stats_get_strings = mv88e6095_stats_get_strings,3024 .stats_get_strings = mv88e6095_stats_get_strings,
2982 .stats_get_stats = mv88e6095_stats_get_stats,3025 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -3012,6 +3055,7 @@ static const struct mv88e6xxx_ops mv88e6352_ops = { · 29 unmodified lines
3012 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,3055 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
3013 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,3056 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
3014 .stats_snapshot = mv88e6320_g1_stats_snapshot,3057 .stats_snapshot = mv88e6320_g1_stats_snapshot,
3058 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
3015 .stats_get_sset_count = mv88e6095_stats_get_sset_count,3059 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
3016 .stats_get_strings = mv88e6095_stats_get_strings,3060 .stats_get_strings = mv88e6095_stats_get_strings,
3017 .stats_get_stats = mv88e6095_stats_get_stats,3061 .stats_get_stats = mv88e6095_stats_get_stats,
@@ -3687,7 +3731,8 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip, · 669 unmodified lines
3687 return 0;3731 return 0;
3688}3732}
3689 3733
3690static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds)3734static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
3735 int port)
3691{3736{
3692 struct mv88e6xxx_chip *chip = ds->priv;3737 struct mv88e6xxx_chip *chip = ds->priv;
3693 3738
@@ -3785,7 +3830,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { · 91 unmodified lines
3785 .probe = mv88e6xxx_drv_probe,3830 .probe = mv88e6xxx_drv_probe,
3786 .get_tag_protocol = mv88e6xxx_get_tag_protocol,3831 .get_tag_protocol = mv88e6xxx_get_tag_protocol,
3787 .setup = mv88e6xxx_setup,3832 .setup = mv88e6xxx_setup,
3788 .set_addr = mv88e6xxx_set_addr,
3789 .adjust_link = mv88e6xxx_adjust_link,3833 .adjust_link = mv88e6xxx_adjust_link,
3790 .get_strings = mv88e6xxx_get_strings,3834 .get_strings = mv88e6xxx_get_strings,
3791 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,3835 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,
drivers/net/dsa/mv88e6xxx/global1.c+35−0
@@ -374,6 +374,22 @@ int mv88e6xxx_g1_stats_wait(struct mv88e6xxx_chip *chip) · 373 unmodified lines
374 MV88E6XXX_G1_STATS_OP_BUSY);374 MV88E6XXX_G1_STATS_OP_BUSY);
375}375}
376 376
377int mv88e6095_g1_stats_set_histogram(struct mv88e6xxx_chip *chip)
378{
379 u16 val;
380 int err;
381
382 err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STATS_OP, &val);
383 if (err)
384 return err;
385
386 val |= MV88E6XXX_G1_STATS_OP_HIST_RX_TX;
387
388 err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val);
389
390 return err;
391}
392
377int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)393int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
378{394{
379 int err;395 int err;
@@ -444,3 +460,22 @@ void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val) · 64 unmodified lines
444 460
445 *val = value | reg;461 *val = value | reg;
446}462}
463
464int mv88e6xxx_g1_stats_clear(struct mv88e6xxx_chip *chip)
465{
466 int err;
467 u16 val;
468
469 err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STATS_OP, &val);
470 if (err)
471 return err;
472
473 val |= MV88E6XXX_G1_STATS_OP_BUSY | MV88E6XXX_G1_STATS_OP_FLUSH_ALL;
474
475 err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val);
476 if (err)
477 return err;
478
479 /* Wait for the flush to complete. */
480 return mv88e6xxx_g1_stats_wait(chip);
481}
drivers/net/dsa/mv88e6xxx/global1.h+2−0
@@ -235,8 +235,10 @@ int mv88e6xxx_g1_stats_wait(struct mv88e6xxx_chip *chip); · 234 unmodified lines
235int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port);235int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port);
236int mv88e6320_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port);236int mv88e6320_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port);
237int mv88e6390_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port);237int mv88e6390_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port);
238int mv88e6095_g1_stats_set_histogram(struct mv88e6xxx_chip *chip);
238int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip);239int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip);
239void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val);240void mv88e6xxx_g1_stats_read(struct mv88e6xxx_chip *chip, int stat, u32 *val);
241int mv88e6xxx_g1_stats_clear(struct mv88e6xxx_chip *chip);
240int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port);242int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port);
241int mv88e6390_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port);243int mv88e6390_g1_set_egress_port(struct mv88e6xxx_chip *chip, int port);
242int mv88e6095_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port);244int mv88e6095_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port);
drivers/net/dsa/qca8k.c+7−8
@@ -506,7 +506,7 @@ qca8k_setup(struct dsa_switch *ds) · 505 unmodified lines
506 pr_warn("regmap initialization failed");506 pr_warn("regmap initialization failed");
507 507
508 /* Initialize CPU port pad mode (xMII type, delays...) */508 /* Initialize CPU port pad mode (xMII type, delays...) */
509 phy_mode = of_get_phy_mode(ds->dst->cpu_dp->dn);509 phy_mode = of_get_phy_mode(ds->ports[QCA8K_CPU_PORT].dn);
510 if (phy_mode < 0) {510 if (phy_mode < 0) {
511 pr_err("Can't find phy-mode for master device\n");511 pr_err("Can't find phy-mode for master device\n");
512 return phy_mode;512 return phy_mode;
@@ -536,7 +536,7 @@ qca8k_setup(struct dsa_switch *ds) · 23 unmodified lines
536 536
537 /* Disable MAC by default on all user ports */537 /* Disable MAC by default on all user ports */
538 for (i = 1; i < QCA8K_NUM_PORTS; i++)538 for (i = 1; i < QCA8K_NUM_PORTS; i++)
539 if (ds->enabled_port_mask & BIT(i))539 if (dsa_is_user_port(ds, i))
540 qca8k_port_set_status(priv, i, 0);540 qca8k_port_set_status(priv, i, 0);
541 541
542 /* Forward all unknown frames to CPU port for Linux processing */542 /* Forward all unknown frames to CPU port for Linux processing */
@@ -551,12 +551,11 @@ qca8k_setup(struct dsa_switch *ds) · 8 unmodified lines
551 /* CPU port gets connected to all user ports of the switch */551 /* CPU port gets connected to all user ports of the switch */
552 if (dsa_is_cpu_port(ds, i)) {552 if (dsa_is_cpu_port(ds, i)) {
553 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),553 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
554 QCA8K_PORT_LOOKUP_MEMBER,554 QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
555 ds->enabled_port_mask);
556 }555 }
557 556
558 /* Invividual user ports get connected to CPU port only */557 /* Invividual user ports get connected to CPU port only */
559 if (ds->enabled_port_mask & BIT(i)) {558 if (dsa_is_user_port(ds, i)) {
560 int shift = 16 * (i % 2);559 int shift = 16 * (i % 2);
561 560
562 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),561 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
@@ -700,7 +699,7 @@ qca8k_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *br) · 137 unmodified lines
700 int i;699 int i;
701 700
702 for (i = 1; i < QCA8K_NUM_PORTS; i++) {701 for (i = 1; i < QCA8K_NUM_PORTS; i++) {
703 if (ds->ports[i].bridge_dev != br)702 if (dsa_to_port(ds, i)->bridge_dev != br)
704 continue;703 continue;
705 /* Add this port to the portvlan mask of the other ports704 /* Add this port to the portvlan mask of the other ports
706 * in the bridge705 * in the bridge
@@ -725,7 +724,7 @@ qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br) · 18 unmodified lines
725 int i;724 int i;
726 725
727 for (i = 1; i < QCA8K_NUM_PORTS; i++) {726 for (i = 1; i < QCA8K_NUM_PORTS; i++) {
728 if (ds->ports[i].bridge_dev != br)727 if (dsa_to_port(ds, i)->bridge_dev != br)
729 continue;728 continue;
730 /* Remove this port to the portvlan mask of the other ports729 /* Remove this port to the portvlan mask of the other ports
731 * in the bridge730 * in the bridge
@@ -824,7 +823,7 @@ qca8k_port_fdb_dump(struct dsa_switch *ds, int port, · 92 unmodified lines
824}823}
825 824
826static enum dsa_tag_protocol825static enum dsa_tag_protocol
827qca8k_get_tag_protocol(struct dsa_switch *ds)826qca8k_get_tag_protocol(struct dsa_switch *ds, int port)
828{827{
829 return DSA_TAG_PROTO_QCA;828 return DSA_TAG_PROTO_QCA;
830}829}
drivers/net/dummy.c+2−2
@@ -353,7 +353,7 @@ static void dummy_setup(struct net_device *dev) · 352 unmodified lines
353 eth_hw_addr_random(dev);353 eth_hw_addr_random(dev);
354 354
355 dev->min_mtu = 0;355 dev->min_mtu = 0;
356 dev->max_mtu = ETH_MAX_MTU;356 dev->max_mtu = 0;
357}357}
358 358
359static int dummy_validate(struct nlattr *tb[], struct nlattr *data[],359static int dummy_validate(struct nlattr *tb[], struct nlattr *data[],
@@ -388,7 +388,7 @@ static int __init dummy_init_one(void) · 28 unmodified lines
388 int err;388 int err;
389 389
390 dev_dummy = alloc_netdev(sizeof(struct dummy_priv),390 dev_dummy = alloc_netdev(sizeof(struct dummy_priv),
391 "dummy%d", NET_NAME_UNKNOWN, dummy_setup);391 "dummy%d", NET_NAME_ENUM, dummy_setup);
392 if (!dev_dummy)392 if (!dev_dummy)
393 return -ENOMEM;393 return -ENOMEM;
394 394
drivers/net/eql.c+1−3
@@ -178,10 +178,8 @@ static void __init eql_setup(struct net_device *dev) · 177 unmodified lines
178{178{
179 equalizer_t *eql = netdev_priv(dev);179 equalizer_t *eql = netdev_priv(dev);
180 180
181 init_timer(&eql->timer);181 setup_timer(&eql->timer, eql_timer, (unsigned long)eql);
182 eql->timer.data = (unsigned long) eql;
183 eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL;182 eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL;
184 eql->timer.function = eql_timer;
185 183
186 spin_lock_init(&eql->queue.lock);184 spin_lock_init(&eql->queue.lock);
187 INIT_LIST_HEAD(&eql->queue.all_slaves);185 INIT_LIST_HEAD(&eql->queue.all_slaves);
drivers/net/ethernet/3com/3c515.c+5−5
@@ -367,7 +367,7 @@ static struct net_device *corkscrew_scan(int unit); · 366 unmodified lines
367static int corkscrew_setup(struct net_device *dev, int ioaddr,367static int corkscrew_setup(struct net_device *dev, int ioaddr,
368 struct pnp_dev *idev, int card_number);368 struct pnp_dev *idev, int card_number);
369static int corkscrew_open(struct net_device *dev);369static int corkscrew_open(struct net_device *dev);
370static void corkscrew_timer(unsigned long arg);370static void corkscrew_timer(struct timer_list *t);
371static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,371static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
372 struct net_device *dev);372 struct net_device *dev);
373static int corkscrew_rx(struct net_device *dev);373static int corkscrew_rx(struct net_device *dev);
@@ -627,7 +627,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr, · 253 unmodified lines
627 627
628 spin_lock_init(&vp->lock);628 spin_lock_init(&vp->lock);
629 629
630 setup_timer(&vp->timer, corkscrew_timer, (unsigned long) dev);630 timer_setup(&vp->timer, corkscrew_timer, 0);
631 631
632 /* Read the station address from the EEPROM. */632 /* Read the station address from the EEPROM. */
633 EL3WINDOW(0);633 EL3WINDOW(0);
@@ -869,11 +869,11 @@ static int corkscrew_open(struct net_device *dev) · 235 unmodified lines
869 return 0;869 return 0;
870}870}
871 871
872static void corkscrew_timer(unsigned long data)872static void corkscrew_timer(struct timer_list *t)
873{873{
874#ifdef AUTOMEDIA874#ifdef AUTOMEDIA
875 struct net_device *dev = (struct net_device *) data;875 struct corkscrew_private *vp = from_timer(vp, t, timer);
876 struct corkscrew_private *vp = netdev_priv(dev);876 struct net_device *dev = vp->our_dev;
877 int ioaddr = dev->base_addr;877 int ioaddr = dev->base_addr;
878 unsigned long flags;878 unsigned long flags;
879 int ok = 0;879 int ok = 0;
drivers/net/ethernet/3com/3c574_cs.c+6−7
@@ -225,7 +225,7 @@ static unsigned short read_eeprom(unsigned int ioaddr, int index); · 224 unmodified lines
225static void tc574_wait_for_completion(struct net_device *dev, int cmd);225static void tc574_wait_for_completion(struct net_device *dev, int cmd);
226 226
227static void tc574_reset(struct net_device *dev);227static void tc574_reset(struct net_device *dev);
228static void media_check(unsigned long arg);228static void media_check(struct timer_list *t);
229static int el3_open(struct net_device *dev);229static int el3_open(struct net_device *dev);
230static netdev_tx_t el3_start_xmit(struct sk_buff *skb,230static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
231 struct net_device *dev);231 struct net_device *dev);
@@ -377,7 +377,7 @@ static int tc574_config(struct pcmcia_device *link) · 145 unmodified lines
377 lp->autoselect = config & Autoselect ? 1 : 0;377 lp->autoselect = config & Autoselect ? 1 : 0;
378 }378 }
379 379
380 init_timer(&lp->media);380 timer_setup(&lp->media, media_check, 0);
381 381
382 {382 {
383 int phy;383 int phy;
@@ -681,8 +681,6 @@ static int el3_open(struct net_device *dev) · 297 unmodified lines
681 netif_start_queue(dev);681 netif_start_queue(dev);
682 682
683 tc574_reset(dev);683 tc574_reset(dev);
684 lp->media.function = media_check;
685 lp->media.data = (unsigned long) dev;
686 lp->media.expires = jiffies + HZ;684 lp->media.expires = jiffies + HZ;
687 add_timer(&lp->media);685 add_timer(&lp->media);
688 686
@@ -859,10 +857,10 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) · 170 unmodified lines
859 (and as a last resort, poll the NIC for events), and to monitor857 (and as a last resort, poll the NIC for events), and to monitor
860 the MII, reporting changes in cable status.858 the MII, reporting changes in cable status.
861*/859*/
862static void media_check(unsigned long arg)860static void media_check(struct timer_list *t)
863{861{
864 struct net_device *dev = (struct net_device *) arg;862 struct el3_private *lp = from_timer(lp, t, media);
865 struct el3_private *lp = netdev_priv(dev);863 struct net_device *dev = lp->p_dev->priv;
866 unsigned int ioaddr = dev->base_addr;864 unsigned int ioaddr = dev->base_addr;
867 unsigned long flags;865 unsigned long flags;
868 unsigned short /* cable, */ media, partner;866 unsigned short /* cable, */ media, partner;
@@ -1048,6 +1046,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · 179 unmodified lines
1048 switch(cmd) {1046 switch(cmd) {
1049 case SIOCGMIIPHY: /* Get the address of the PHY in use. */1047 case SIOCGMIIPHY: /* Get the address of the PHY in use. */
1050 data->phy_id = phy;1048 data->phy_id = phy;
1049 /* fall through */
1051 case SIOCGMIIREG: /* Read the specified MII register. */1050 case SIOCGMIIREG: /* Read the specified MII register. */
1052 {1051 {
1053 int saved_window;1052 int saved_window;
drivers/net/ethernet/3com/3c589_cs.c+5−5
@@ -163,7 +163,7 @@ static void tc589_release(struct pcmcia_device *link); · 162 unmodified lines
163 163
164static u16 read_eeprom(unsigned int ioaddr, int index);164static u16 read_eeprom(unsigned int ioaddr, int index);
165static void tc589_reset(struct net_device *dev);165static void tc589_reset(struct net_device *dev);
166static void media_check(unsigned long arg);166static void media_check(struct timer_list *t);
167static int el3_config(struct net_device *dev, struct ifmap *map);167static int el3_config(struct net_device *dev, struct ifmap *map);
168static int el3_open(struct net_device *dev);168static int el3_open(struct net_device *dev);
169static netdev_tx_t el3_start_xmit(struct sk_buff *skb,169static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
@@ -517,7 +517,7 @@ static int el3_open(struct net_device *dev) · 347 unmodified lines
517 netif_start_queue(dev);517 netif_start_queue(dev);
518 518
519 tc589_reset(dev);519 tc589_reset(dev);
520 setup_timer(&lp->media, media_check, (unsigned long)dev);520 timer_setup(&lp->media, media_check, 0);
521 mod_timer(&lp->media, jiffies + HZ);521 mod_timer(&lp->media, jiffies + HZ);
522 522
523 dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",523 dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
@@ -676,10 +676,10 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) · 152 unmodified lines
676 return IRQ_RETVAL(handled);676 return IRQ_RETVAL(handled);
677}677}
678 678
679static void media_check(unsigned long arg)679static void media_check(struct timer_list *t)
680{680{
681 struct net_device *dev = (struct net_device *)(arg);681 struct el3_private *lp = from_timer(lp, t, media);
682 struct el3_private *lp = netdev_priv(dev);682 struct net_device *dev = lp->p_dev->priv;
683 unsigned int ioaddr = dev->base_addr;683 unsigned int ioaddr = dev->base_addr;
684 u16 media, errs;684 u16 media, errs;
685 unsigned long flags;685 unsigned long flags;
drivers/net/ethernet/3com/3c59x.c+10−10
@@ -759,8 +759,8 @@ static int vortex_open(struct net_device *dev); · 758 unmodified lines
759static void mdio_sync(struct vortex_private *vp, int bits);759static void mdio_sync(struct vortex_private *vp, int bits);
760static int mdio_read(struct net_device *dev, int phy_id, int location);760static int mdio_read(struct net_device *dev, int phy_id, int location);
761static void mdio_write(struct net_device *vp, int phy_id, int location, int value);761static void mdio_write(struct net_device *vp, int phy_id, int location, int value);
762static void vortex_timer(unsigned long arg);762static void vortex_timer(struct timer_list *t);
763static void rx_oom_timer(unsigned long arg);763static void rx_oom_timer(struct timer_list *t);
764static netdev_tx_t vortex_start_xmit(struct sk_buff *skb,764static netdev_tx_t vortex_start_xmit(struct sk_buff *skb,
765 struct net_device *dev);765 struct net_device *dev);
766static netdev_tx_t boomerang_start_xmit(struct sk_buff *skb,766static netdev_tx_t boomerang_start_xmit(struct sk_buff *skb,
@@ -1599,9 +1599,9 @@ vortex_up(struct net_device *dev) · 832 unmodified lines
1599 dev->name, media_tbl[dev->if_port].name);1599 dev->name, media_tbl[dev->if_port].name);
1600 }1600 }
1601 1601
1602 setup_timer(&vp->timer, vortex_timer, (unsigned long)dev);1602 timer_setup(&vp->timer, vortex_timer, 0);
1603 mod_timer(&vp->timer, RUN_AT(media_tbl[dev->if_port].wait));1603 mod_timer(&vp->timer, RUN_AT(media_tbl[dev->if_port].wait));
1604 setup_timer(&vp->rx_oom_timer, rx_oom_timer, (unsigned long)dev);1604 timer_setup(&vp->rx_oom_timer, rx_oom_timer, 0);
1605 1605
1606 if (vortex_debug > 1)1606 if (vortex_debug > 1)
1607 pr_debug("%s: Initial media type %s.\n",1607 pr_debug("%s: Initial media type %s.\n",
@@ -1784,10 +1784,10 @@ out: · 176 unmodified lines
1784}1784}
1785 1785
1786static void1786static void
1787vortex_timer(unsigned long data)1787vortex_timer(struct timer_list *t)
1788{1788{
1789 struct net_device *dev = (struct net_device *)data;1789 struct vortex_private *vp = from_timer(vp, t, timer);
1790 struct vortex_private *vp = netdev_priv(dev);1790 struct net_device *dev = vp->mii.dev;
1791 void __iomem *ioaddr = vp->ioaddr;1791 void __iomem *ioaddr = vp->ioaddr;
1792 int next_tick = 60*HZ;1792 int next_tick = 60*HZ;
1793 int ok = 0;1793 int ok = 0;
@@ -2687,10 +2687,10 @@ boomerang_rx(struct net_device *dev) · 893 unmodified lines
2687 * for some memory. Otherwise there is no way to restart the rx process.2687 * for some memory. Otherwise there is no way to restart the rx process.
2688 */2688 */
2689static void2689static void
2690rx_oom_timer(unsigned long arg)2690rx_oom_timer(struct timer_list *t)
2691{2691{
2692 struct net_device *dev = (struct net_device *)arg;2692 struct vortex_private *vp = from_timer(vp, t, rx_oom_timer);
2693 struct vortex_private *vp = netdev_priv(dev);2693 struct net_device *dev = vp->mii.dev;
2694 2694
2695 spin_lock_irq(&vp->lock);2695 spin_lock_irq(&vp->lock);
2696 if ((vp->cur_rx - vp->dirty_rx) == RX_RING_SIZE) /* This test is redundant, but makes me feel good */2696 if ((vp->cur_rx - vp->dirty_rx) == RX_RING_SIZE) /* This test is redundant, but makes me feel good */
drivers/net/ethernet/8390/axnet_cs.c+5−5
@@ -85,7 +85,7 @@ static struct net_device_stats *get_stats(struct net_device *dev); · 84 unmodified lines
85static void set_multicast_list(struct net_device *dev);85static void set_multicast_list(struct net_device *dev);
86static void axnet_tx_timeout(struct net_device *dev);86static void axnet_tx_timeout(struct net_device *dev);
87static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);87static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);
88static void ei_watchdog(u_long arg);88static void ei_watchdog(struct timer_list *t);
89static void axnet_reset_8390(struct net_device *dev);89static void axnet_reset_8390(struct net_device *dev);
90 90
91static int mdio_read(unsigned int addr, int phy_id, int loc);91static int mdio_read(unsigned int addr, int phy_id, int loc);
@@ -483,7 +483,7 @@ static int axnet_open(struct net_device *dev) · 391 unmodified lines
483 link->open++;483 link->open++;
484 484
485 info->link_status = 0x00;485 info->link_status = 0x00;
486 setup_timer(&info->watchdog, ei_watchdog, (u_long)dev);486 timer_setup(&info->watchdog, ei_watchdog, 0);
487 mod_timer(&info->watchdog, jiffies + HZ);487 mod_timer(&info->watchdog, jiffies + HZ);
488 488
489 return ax_open(dev);489 return ax_open(dev);
@@ -547,10 +547,10 @@ static irqreturn_t ei_irq_wrapper(int irq, void *dev_id) · 57 unmodified lines
547 return ax_interrupt(irq, dev_id);547 return ax_interrupt(irq, dev_id);
548}548}
549 549
550static void ei_watchdog(u_long arg)550static void ei_watchdog(struct timer_list *t)
551{551{
552 struct net_device *dev = (struct net_device *)(arg);552 struct axnet_dev *info = from_timer(info, t, watchdog);
553 struct axnet_dev *info = PRIV(dev);553 struct net_device *dev = info->p_dev->priv;
554 unsigned int nic_base = dev->base_addr;554 unsigned int nic_base = dev->base_addr;
555 unsigned int mii_addr = nic_base + AXNET_MII_EEP;555 unsigned int mii_addr = nic_base + AXNET_MII_EEP;
556 u_short link;556 u_short link;
drivers/net/ethernet/8390/pcnet_cs.c+6−5
@@ -99,7 +99,7 @@ static int pcnet_open(struct net_device *dev); · 98 unmodified lines
99static int pcnet_close(struct net_device *dev);99static int pcnet_close(struct net_device *dev);
100static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);100static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
101static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);101static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);
102static void ei_watchdog(u_long arg);102static void ei_watchdog(struct timer_list *t);
103static void pcnet_reset_8390(struct net_device *dev);103static void pcnet_reset_8390(struct net_device *dev);
104static int set_config(struct net_device *dev, struct ifmap *map);104static int set_config(struct net_device *dev, struct ifmap *map);
105static int setup_shmem_window(struct pcmcia_device *link, int start_pg,105static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
@@ -917,7 +917,7 @@ static int pcnet_open(struct net_device *dev) · 811 unmodified lines
917 917
918 info->phy_id = info->eth_phy;918 info->phy_id = info->eth_phy;
919 info->link_status = 0x00;919 info->link_status = 0x00;
920 setup_timer(&info->watchdog, ei_watchdog, (u_long)dev);920 timer_setup(&info->watchdog, ei_watchdog, 0);
921 mod_timer(&info->watchdog, jiffies + HZ);921 mod_timer(&info->watchdog, jiffies + HZ);
922 922
923 return ei_open(dev);923 return ei_open(dev);
@@ -1006,10 +1006,10 @@ static irqreturn_t ei_irq_wrapper(int irq, void *dev_id) · 82 unmodified lines
1006 return ret;1006 return ret;
1007}1007}
1008 1008
1009static void ei_watchdog(u_long arg)1009static void ei_watchdog(struct timer_list *t)
1010{1010{
1011 struct net_device *dev = (struct net_device *)arg;1011 struct pcnet_dev *info = from_timer(info, t, watchdog);
1012 struct pcnet_dev *info = PRIV(dev);1012 struct net_device *dev = info->p_dev->priv;
1013 unsigned int nic_base = dev->base_addr;1013 unsigned int nic_base = dev->base_addr;
1014 unsigned int mii_addr = nic_base + DLINK_GPIO;1014 unsigned int mii_addr = nic_base + DLINK_GPIO;
1015 u_short link;1015 u_short link;
@@ -1107,6 +1107,7 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · 91 unmodified lines
1107 switch (cmd) {1107 switch (cmd) {
1108 case SIOCGMIIPHY:1108 case SIOCGMIIPHY:
1109 data->phy_id = info->phy_id;1109 data->phy_id = info->phy_id;
1110 /* fall through */
1110 case SIOCGMIIREG: /* Read MII PHY register. */1111 case SIOCGMIIREG: /* Read MII PHY register. */
1111 data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);1112 data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
1112 return 0;1113 return 0;
drivers/net/ethernet/adi/bfin_mac.c+2−3
@@ -1650,9 +1650,8 @@ static int bfin_mac_probe(struct platform_device *pdev) · 1649 unmodified lines
1650 ndev->netdev_ops = &bfin_mac_netdev_ops;1650 ndev->netdev_ops = &bfin_mac_netdev_ops;
1651 ndev->ethtool_ops = &bfin_mac_ethtool_ops;1651 ndev->ethtool_ops = &bfin_mac_ethtool_ops;
1652 1652
1653 init_timer(&lp->tx_reclaim_timer);1653 setup_timer(&lp->tx_reclaim_timer, tx_reclaim_skb_timeout,
1654 lp->tx_reclaim_timer.data = (unsigned long)lp;1654 (unsigned long)lp);
1655 lp->tx_reclaim_timer.function = tx_reclaim_skb_timeout;
1656 1655
1657 lp->flags = 0;1656 lp->flags = 0;
1658 netif_napi_add(ndev, &lp->napi, bfin_mac_poll, CONFIG_BFIN_RX_DESC_NUM);1657 netif_napi_add(ndev, &lp->napi, bfin_mac_poll, CONFIG_BFIN_RX_DESC_NUM);
drivers/net/ethernet/agere/et131x.c+2−3
@@ -3624,11 +3624,10 @@ static int et131x_open(struct net_device *netdev) · 3623 unmodified lines
3624 int result;3624 int result;
3625 3625
3626 /* Start the timer to track NIC errors */3626 /* Start the timer to track NIC errors */
3627 init_timer(&adapter->error_timer);3627 setup_timer(&adapter->error_timer, et131x_error_timer_handler,
3628 (unsigned long)adapter);
3628 adapter->error_timer.expires = jiffies +3629 adapter->error_timer.expires = jiffies +
3629 msecs_to_jiffies(TX_ERROR_PERIOD);3630 msecs_to_jiffies(TX_ERROR_PERIOD);
3630 adapter->error_timer.function = et131x_error_timer_handler;
3631 adapter->error_timer.data = (unsigned long)adapter;
3632 add_timer(&adapter->error_timer);3631 add_timer(&adapter->error_timer);
3633 3632
3634 result = request_irq(irq, et131x_isr,3633 result = request_irq(irq, et131x_isr,
drivers/net/ethernet/alacritech/slicoss.c+1−1
@@ -355,10 +355,10 @@ static void slic_xmit_complete(struct slic_device *sdev) · 354 unmodified lines
355{355{
356 struct slic_tx_queue *txq = &sdev->txq;356 struct slic_tx_queue *txq = &sdev->txq;
357 struct net_device *dev = sdev->netdev;357 struct net_device *dev = sdev->netdev;
358 unsigned int idx = txq->done_idx;
359 struct slic_tx_buffer *buff;358 struct slic_tx_buffer *buff;
360 unsigned int frames = 0;359 unsigned int frames = 0;
361 unsigned int bytes = 0;360 unsigned int bytes = 0;
361 unsigned int idx;
362 362
363 /* Limit processing to SLIC_MAX_TX_COMPLETIONS frames to avoid that new363 /* Limit processing to SLIC_MAX_TX_COMPLETIONS frames to avoid that new
364 * completions during processing keeps the loop running endlessly.364 * completions during processing keeps the loop running endlessly.
drivers/net/ethernet/amazon/ena/ena_admin_defs.h+6−0
@@ -627,6 +627,12 @@ enum ena_admin_flow_hash_proto { · 626 unmodified lines
627 627
628 ENA_ADMIN_RSS_NOT_IP = 7,628 ENA_ADMIN_RSS_NOT_IP = 7,
629 629
630 /* TCPv6 with extension header */
631 ENA_ADMIN_RSS_TCP6_EX = 8,
632
633 /* IPv6 with extension header */
634 ENA_ADMIN_RSS_IP6_EX = 9,
635
630 ENA_ADMIN_RSS_PROTO_NUM = 16,636 ENA_ADMIN_RSS_PROTO_NUM = 16,
631};637};
632 638
drivers/net/ethernet/amazon/ena/ena_com.c+10−6
@@ -63,6 +63,8 @@ · 62 unmodified lines
63 63
64#define ENA_REGS_ADMIN_INTR_MASK 164#define ENA_REGS_ADMIN_INTR_MASK 1
65 65
66#define ENA_POLL_MS 5
67
66/*****************************************************************************/68/*****************************************************************************/
67/*****************************************************************************/69/*****************************************************************************/
68/*****************************************************************************/70/*****************************************************************************/
@@ -315,7 +317,7 @@ static struct ena_comp_ctx *ena_com_submit_admin_cmd(struct ena_com_admin_queue · 246 unmodified lines
315 cmd_size_in_bytes,317 cmd_size_in_bytes,
316 comp,318 comp,
317 comp_size_in_bytes);319 comp_size_in_bytes);
318 if (unlikely(IS_ERR(comp_ctx)))320 if (IS_ERR(comp_ctx))
319 admin_queue->running_state = false;321 admin_queue->running_state = false;
320 spin_unlock_irqrestore(&admin_queue->q_lock, flags);322 spin_unlock_irqrestore(&admin_queue->q_lock, flags);
321 323
@@ -533,7 +535,7 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c · 211 unmodified lines
533 goto err;535 goto err;
534 }536 }
535 537
536 msleep(100);538 msleep(ENA_POLL_MS);
537 }539 }
538 540
539 if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) {541 if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) {
@@ -746,6 +748,9 @@ static int wait_for_reset_state(struct ena_com_dev *ena_dev, u32 timeout, · 206 unmodified lines
746{748{
747 u32 val, i;749 u32 val, i;
748 750
751 /* Convert timeout from resolution of 100ms to ENA_POLL_MS */
752 timeout = (timeout * 100) / ENA_POLL_MS;
753
749 for (i = 0; i < timeout; i++) {754 for (i = 0; i < timeout; i++) {
750 val = ena_com_reg_bar_read32(ena_dev, ENA_REGS_DEV_STS_OFF);755 val = ena_com_reg_bar_read32(ena_dev, ENA_REGS_DEV_STS_OFF);
751 756
@@ -758,8 +763,7 @@ static int wait_for_reset_state(struct ena_com_dev *ena_dev, u32 timeout, · 6 unmodified lines
758 exp_state)763 exp_state)
759 return 0;764 return 0;
760 765
761 /* The resolution of the timeout is 100ms */766 msleep(ENA_POLL_MS);
762 msleep(100);
763 }767 }
764 768
765 return -ETIME;769 return -ETIME;
@@ -1130,7 +1134,7 @@ int ena_com_execute_admin_command(struct ena_com_admin_queue *admin_queue, · 364 unmodified lines
1130 1134
1131 comp_ctx = ena_com_submit_admin_cmd(admin_queue, cmd, cmd_size,1135 comp_ctx = ena_com_submit_admin_cmd(admin_queue, cmd, cmd_size,
1132 comp, comp_size);1136 comp, comp_size);
1133 if (unlikely(IS_ERR(comp_ctx))) {1137 if (IS_ERR(comp_ctx)) {
1134 if (comp_ctx == ERR_PTR(-ENODEV))1138 if (comp_ctx == ERR_PTR(-ENODEV))
1135 pr_debug("Failed to submit command [%ld]\n",1139 pr_debug("Failed to submit command [%ld]\n",
1136 PTR_ERR(comp_ctx));1140 PTR_ERR(comp_ctx));
@@ -1253,7 +1257,7 @@ void ena_com_wait_for_abort_completion(struct ena_com_dev *ena_dev) · 116 unmodified lines
1253 spin_lock_irqsave(&admin_queue->q_lock, flags);1257 spin_lock_irqsave(&admin_queue->q_lock, flags);
1254 while (atomic_read(&admin_queue->outstanding_cmds) != 0) {1258 while (atomic_read(&admin_queue->outstanding_cmds) != 0) {
1255 spin_unlock_irqrestore(&admin_queue->q_lock, flags);1259 spin_unlock_irqrestore(&admin_queue->q_lock, flags);
1256 msleep(20);1260 msleep(ENA_POLL_MS);
1257 spin_lock_irqsave(&admin_queue->q_lock, flags);1261 spin_lock_irqsave(&admin_queue->q_lock, flags);
1258 }1262 }
1259 spin_unlock_irqrestore(&admin_queue->q_lock, flags);1263 spin_unlock_irqrestore(&admin_queue->q_lock, flags);
drivers/net/ethernet/amazon/ena/ena_ethtool.c+3−2
@@ -60,8 +60,8 @@ struct ena_stats { · 59 unmodified lines
60 60
61static const struct ena_stats ena_stats_global_strings[] = {61static const struct ena_stats ena_stats_global_strings[] = {
62 ENA_STAT_GLOBAL_ENTRY(tx_timeout),62 ENA_STAT_GLOBAL_ENTRY(tx_timeout),
63 ENA_STAT_GLOBAL_ENTRY(io_suspend),63 ENA_STAT_GLOBAL_ENTRY(suspend),
64 ENA_STAT_GLOBAL_ENTRY(io_resume),64 ENA_STAT_GLOBAL_ENTRY(resume),
65 ENA_STAT_GLOBAL_ENTRY(wd_expired),65 ENA_STAT_GLOBAL_ENTRY(wd_expired),
66 ENA_STAT_GLOBAL_ENTRY(interface_up),66 ENA_STAT_GLOBAL_ENTRY(interface_up),
67 ENA_STAT_GLOBAL_ENTRY(interface_down),67 ENA_STAT_GLOBAL_ENTRY(interface_down),
@@ -81,6 +81,7 @@ static const struct ena_stats ena_stats_tx_strings[] = { · 13 unmodified lines
81 ENA_STAT_TX_ENTRY(doorbells),81 ENA_STAT_TX_ENTRY(doorbells),
82 ENA_STAT_TX_ENTRY(prepare_ctx_err),82 ENA_STAT_TX_ENTRY(prepare_ctx_err),
83 ENA_STAT_TX_ENTRY(bad_req_id),83 ENA_STAT_TX_ENTRY(bad_req_id),
84 ENA_STAT_TX_ENTRY(missed_tx),
84};85};
85 86
86static const struct ena_stats ena_stats_rx_strings[] = {87static const struct ena_stats ena_stats_rx_strings[] = {
drivers/net/ethernet/amazon/ena/ena_netdev.c+107−90
@@ -2361,38 +2361,6 @@ static const struct net_device_ops ena_netdev_ops = { · 2360 unmodified lines
2361#endif /* CONFIG_NET_POLL_CONTROLLER */2361#endif /* CONFIG_NET_POLL_CONTROLLER */
2362};2362};
2363 2363
2364static void ena_device_io_suspend(struct work_struct *work)
2365{
2366 struct ena_adapter *adapter =
2367 container_of(work, struct ena_adapter, suspend_io_task);
2368 struct net_device *netdev = adapter->netdev;
2369
2370 /* ena_napi_disable_all disables only the IO handling.
2371 * We are still subject to AENQ keep alive watchdog.
2372 */
2373 u64_stats_update_begin(&adapter->syncp);
2374 adapter->dev_stats.io_suspend++;
2375 u64_stats_update_begin(&adapter->syncp);
2376 ena_napi_disable_all(adapter);
2377 netif_tx_lock(netdev);
2378 netif_device_detach(netdev);
2379 netif_tx_unlock(netdev);
2380}
2381
2382static void ena_device_io_resume(struct work_struct *work)
2383{
2384 struct ena_adapter *adapter =
2385 container_of(work, struct ena_adapter, resume_io_task);
2386 struct net_device *netdev = adapter->netdev;
2387
2388 u64_stats_update_begin(&adapter->syncp);
2389 adapter->dev_stats.io_resume++;
2390 u64_stats_update_end(&adapter->syncp);
2391
2392 netif_device_attach(netdev);
2393 ena_napi_enable_all(adapter);
2394}
2395
2396static int ena_device_validate_params(struct ena_adapter *adapter,2364static int ena_device_validate_params(struct ena_adapter *adapter,
2397 struct ena_com_dev_get_features_ctx *get_feat_ctx)2365 struct ena_com_dev_get_features_ctx *get_feat_ctx)
2398{2366{
@@ -2561,38 +2529,31 @@ err_disable_msix: · 162 unmodified lines
2561 return rc;2529 return rc;
2562}2530}
2563 2531
2564static void ena_fw_reset_device(struct work_struct *work)2532static void ena_destroy_device(struct ena_adapter *adapter)
2565{2533{
2566 struct ena_com_dev_get_features_ctx get_feat_ctx;
2567 struct ena_adapter *adapter =
2568 container_of(work, struct ena_adapter, reset_task);
2569 struct net_device *netdev = adapter->netdev;2534 struct net_device *netdev = adapter->netdev;
2570 struct ena_com_dev *ena_dev = adapter->ena_dev;2535 struct ena_com_dev *ena_dev = adapter->ena_dev;
2571 struct pci_dev *pdev = adapter->pdev;2536 bool dev_up;
2572 bool dev_up, wd_state;
2573 int rc;
2574
2575 if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
2576 dev_err(&pdev->dev,
2577 "device reset schedule while reset bit is off\n");
2578 return;
2579 }
2580 2537
2581 netif_carrier_off(netdev);2538 netif_carrier_off(netdev);
2582 2539
2583 del_timer_sync(&adapter->timer_service);2540 del_timer_sync(&adapter->timer_service);
2584 2541
2585 rtnl_lock();
2586
2587 dev_up = test_bit(ENA_FLAG_DEV_UP, &adapter->flags);2542 dev_up = test_bit(ENA_FLAG_DEV_UP, &adapter->flags);
2543 adapter->dev_up_before_reset = dev_up;
2544
2588 ena_com_set_admin_running_state(ena_dev, false);2545 ena_com_set_admin_running_state(ena_dev, false);
2589 2546
2590 /* After calling ena_close the tx queues and the napi
2591 * are disabled so no one can interfere or touch the
2592 * data structures
2593 */
2594 ena_close(netdev);2547 ena_close(netdev);
2595 2548
2549 /* Before releasing the ENA resources, a device reset is required.
2550 * (to prevent the device from accessing them).
2551 * In case the reset flag is set and the device is up, ena_close
2552 * already perform the reset, so it can be skipped.
2553 */
2554 if (!(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags) && dev_up))
2555 ena_com_dev_reset(adapter->ena_dev, adapter->reset_reason);
2556
2596 ena_free_mgmnt_irq(adapter);2557 ena_free_mgmnt_irq(adapter);
2597 2558
2598 ena_disable_msix(adapter);2559 ena_disable_msix(adapter);
@@ -2606,9 +2567,17 @@ static void ena_fw_reset_device(struct work_struct *work) · 7 unmodified lines
2606 ena_com_mmio_reg_read_request_destroy(ena_dev);2567 ena_com_mmio_reg_read_request_destroy(ena_dev);
2607 2568
2608 adapter->reset_reason = ENA_REGS_RESET_NORMAL;2569 adapter->reset_reason = ENA_REGS_RESET_NORMAL;
2570
2609 clear_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);2571 clear_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2572}
2610 2573
2611 /* Finish with the destroy part. Start the init part */2574static int ena_restore_device(struct ena_adapter *adapter)
2575{
2576 struct ena_com_dev_get_features_ctx get_feat_ctx;
2577 struct ena_com_dev *ena_dev = adapter->ena_dev;
2578 struct pci_dev *pdev = adapter->pdev;
2579 bool wd_state;
2580 int rc;
2612 2581
2613 rc = ena_device_init(ena_dev, adapter->pdev, &get_feat_ctx, &wd_state);2582 rc = ena_device_init(ena_dev, adapter->pdev, &get_feat_ctx, &wd_state);
2614 if (rc) {2583 if (rc) {
@@ -2630,7 +2599,7 @@ static void ena_fw_reset_device(struct work_struct *work) · 15 unmodified lines
2630 goto err_device_destroy;2599 goto err_device_destroy;
2631 }2600 }
2632 /* If the interface was up before the reset bring it up */2601 /* If the interface was up before the reset bring it up */
2633 if (dev_up) {2602 if (adapter->dev_up_before_reset) {
2634 rc = ena_up(adapter);2603 rc = ena_up(adapter);
2635 if (rc) {2604 if (rc) {
2636 dev_err(&pdev->dev, "Failed to create I/O queues\n");2605 dev_err(&pdev->dev, "Failed to create I/O queues\n");
@@ -2639,24 +2608,38 @@ static void ena_fw_reset_device(struct work_struct *work) · 2 unmodified lines
2639 }2608 }
2640 2609
2641 mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));2610 mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
2642
2643 rtnl_unlock();
2644
2645 dev_err(&pdev->dev, "Device reset completed successfully\n");2611 dev_err(&pdev->dev, "Device reset completed successfully\n");
2646 2612
2647 return;2613 return rc;
2648err_disable_msix:2614err_disable_msix:
2649 ena_free_mgmnt_irq(adapter);2615 ena_free_mgmnt_irq(adapter);
2650 ena_disable_msix(adapter);2616 ena_disable_msix(adapter);
2651err_device_destroy:2617err_device_destroy:
2652 ena_com_admin_destroy(ena_dev);2618 ena_com_admin_destroy(ena_dev);
2653err:2619err:
2654 rtnl_unlock();
2655
2656 clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);2620 clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
2657 2621
2658 dev_err(&pdev->dev,2622 dev_err(&pdev->dev,
2659 "Reset attempt failed. Can not reset the device\n");2623 "Reset attempt failed. Can not reset the device\n");
2624
2625 return rc;
2626}
2627
2628static void ena_fw_reset_device(struct work_struct *work)
2629{
2630 struct ena_adapter *adapter =
2631 container_of(work, struct ena_adapter, reset_task);
2632 struct pci_dev *pdev = adapter->pdev;
2633
2634 if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
2635 dev_err(&pdev->dev,
2636 "device reset schedule while reset bit is off\n");
2637 return;
2638 }
2639 rtnl_lock();
2640 ena_destroy_device(adapter);
2641 ena_restore_device(adapter);
2642 rtnl_unlock();
2660}2643}
2661 2644
2662static int check_missing_comp_in_queue(struct ena_adapter *adapter,2645static int check_missing_comp_in_queue(struct ena_adapter *adapter,
@@ -2665,7 +2648,7 @@ static int check_missing_comp_in_queue(struct ena_adapter *adapter, · 2 unmodified lines
2665 struct ena_tx_buffer *tx_buf;2648 struct ena_tx_buffer *tx_buf;
2666 unsigned long last_jiffies;2649 unsigned long last_jiffies;
2667 u32 missed_tx = 0;2650 u32 missed_tx = 0;
2668 int i;2651 int i, rc = 0;
2669 2652
2670 for (i = 0; i < tx_ring->ring_size; i++) {2653 for (i = 0; i < tx_ring->ring_size; i++) {
2671 tx_buf = &tx_ring->tx_buffer_info[i];2654 tx_buf = &tx_ring->tx_buffer_info[i];
@@ -2679,21 +2662,25 @@ static int check_missing_comp_in_queue(struct ena_adapter *adapter, · 7 unmodified lines
2679 2662
2680 tx_buf->print_once = 1;2663 tx_buf->print_once = 1;
2681 missed_tx++;2664 missed_tx++;
2682
2683 if (unlikely(missed_tx > adapter->missing_tx_completion_threshold)) {
2684 netif_err(adapter, tx_err, adapter->netdev,
2685 "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2686 missed_tx,
2687 adapter->missing_tx_completion_threshold);
2688 adapter->reset_reason =
2689 ENA_REGS_RESET_MISS_TX_CMPL;
2690 set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2691 return -EIO;
2692 }
2693 }2665 }
2694 }2666 }
2695 2667
2696 return 0;2668 if (unlikely(missed_tx > adapter->missing_tx_completion_threshold)) {
2669 netif_err(adapter, tx_err, adapter->netdev,
2670 "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2671 missed_tx,
2672 adapter->missing_tx_completion_threshold);
2673 adapter->reset_reason =
2674 ENA_REGS_RESET_MISS_TX_CMPL;
2675 set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2676 rc = -EIO;
2677 }
2678
2679 u64_stats_update_begin(&tx_ring->syncp);
2680 tx_ring->tx_stats.missed_tx = missed_tx;
2681 u64_stats_update_end(&tx_ring->syncp);
2682
2683 return rc;
2697}2684}
2698 2685
2699static void check_for_missing_tx_completions(struct ena_adapter *adapter)2686static void check_for_missing_tx_completions(struct ena_adapter *adapter)
@@ -3276,8 +3263,6 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 576 unmodified lines
3276 goto err_rss;3263 goto err_rss;
3277 }3264 }
3278 3265
3279 INIT_WORK(&adapter->suspend_io_task, ena_device_io_suspend);
3280 INIT_WORK(&adapter->resume_io_task, ena_device_io_resume);
3281 INIT_WORK(&adapter->reset_task, ena_fw_reset_device);3266 INIT_WORK(&adapter->reset_task, ena_fw_reset_device);
3282 3267
3283 adapter->last_keep_alive_jiffies = jiffies;3268 adapter->last_keep_alive_jiffies = jiffies;
@@ -3311,8 +3296,6 @@ err_free_msix: · 27 unmodified lines
3311err_worker_destroy:3296err_worker_destroy:
3312 ena_com_destroy_interrupt_moderation(ena_dev);3297 ena_com_destroy_interrupt_moderation(ena_dev);
3313 del_timer(&adapter->timer_service);3298 del_timer(&adapter->timer_service);
3314 cancel_work_sync(&adapter->suspend_io_task);
3315 cancel_work_sync(&adapter->resume_io_task);
3316err_netdev_destroy:3299err_netdev_destroy:
3317 free_netdev(netdev);3300 free_netdev(netdev);
3318err_device_destroy:3301err_device_destroy:
@@ -3382,10 +3365,6 @@ static void ena_remove(struct pci_dev *pdev) · 63 unmodified lines
3382 3365
3383 cancel_work_sync(&adapter->reset_task);3366 cancel_work_sync(&adapter->reset_task);
3384 3367
3385 cancel_work_sync(&adapter->suspend_io_task);
3386
3387 cancel_work_sync(&adapter->resume_io_task);
3388
3389 /* Reset the device only if the device is running. */3368 /* Reset the device only if the device is running. */
3390 if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))3369 if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
3391 ena_com_dev_reset(ena_dev, adapter->reset_reason);3370 ena_com_dev_reset(ena_dev, adapter->reset_reason);
@@ -3419,11 +3398,59 @@ static void ena_remove(struct pci_dev *pdev) · 27 unmodified lines
3419 vfree(ena_dev);3398 vfree(ena_dev);
3420}3399}
3421 3400
3401#ifdef CONFIG_PM
3402/* ena_suspend - PM suspend callback
3403 * @pdev: PCI device information struct
3404 * @state:power state
3405 */
3406static int ena_suspend(struct pci_dev *pdev, pm_message_t state)
3407{
3408 struct ena_adapter *adapter = pci_get_drvdata(pdev);
3409
3410 u64_stats_update_begin(&adapter->syncp);
3411 adapter->dev_stats.suspend++;
3412 u64_stats_update_end(&adapter->syncp);
3413
3414 rtnl_lock();
3415 if (unlikely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
3416 dev_err(&pdev->dev,
3417 "ignoring device reset request as the device is being suspended\n");
3418 clear_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
3419 }
3420 ena_destroy_device(adapter);
3421 rtnl_unlock();
3422 return 0;
3423}
3424
3425/* ena_resume - PM resume callback
3426 * @pdev: PCI device information struct
3427 *
3428 */
3429static int ena_resume(struct pci_dev *pdev)
3430{
3431 struct ena_adapter *adapter = pci_get_drvdata(pdev);
3432 int rc;
3433
3434 u64_stats_update_begin(&adapter->syncp);
3435 adapter->dev_stats.resume++;
3436 u64_stats_update_end(&adapter->syncp);
3437
3438 rtnl_lock();
3439 rc = ena_restore_device(adapter);
3440 rtnl_unlock();
3441 return rc;
3442}
3443#endif
3444
3422static struct pci_driver ena_pci_driver = {3445static struct pci_driver ena_pci_driver = {
3423 .name = DRV_MODULE_NAME,3446 .name = DRV_MODULE_NAME,
3424 .id_table = ena_pci_tbl,3447 .id_table = ena_pci_tbl,
3425 .probe = ena_probe,3448 .probe = ena_probe,
3426 .remove = ena_remove,3449 .remove = ena_remove,
3450#ifdef CONFIG_PM
3451 .suspend = ena_suspend,
3452 .resume = ena_resume,
3453#endif
3427 .sriov_configure = ena_sriov_configure,3454 .sriov_configure = ena_sriov_configure,
3428};3455};
3429 3456
@@ -3504,16 +3531,6 @@ static void ena_notification(void *adapter_data, · 74 unmodified lines
3504 ENA_ADMIN_NOTIFICATION);3531 ENA_ADMIN_NOTIFICATION);
3505 3532
3506 switch (aenq_e->aenq_common_desc.syndrom) {3533 switch (aenq_e->aenq_common_desc.syndrom) {
3507 case ENA_ADMIN_SUSPEND:
3508 /* Suspend just the IO queues.
3509 * We deliberately don't suspend admin so the timer and
3510 * the keep_alive events should remain.
3511 */
3512 queue_work(ena_wq, &adapter->suspend_io_task);
3513 break;
3514 case ENA_ADMIN_RESUME:
3515 queue_work(ena_wq, &adapter->resume_io_task);
3516 break;
3517 case ENA_ADMIN_UPDATE_HINTS:3534 case ENA_ADMIN_UPDATE_HINTS:
3518 hints = (struct ena_admin_ena_hw_hints *)3535 hints = (struct ena_admin_ena_hw_hints *)
3519 (&aenq_e->inline_data_w4);3536 (&aenq_e->inline_data_w4);
drivers/net/ethernet/amazon/ena/ena_netdev.h+6−6
@@ -44,7 +44,7 @@ · 43 unmodified lines
44#include "ena_eth_com.h"44#include "ena_eth_com.h"
45 45
46#define DRV_MODULE_VER_MAJOR 146#define DRV_MODULE_VER_MAJOR 1
47#define DRV_MODULE_VER_MINOR 247#define DRV_MODULE_VER_MINOR 3
48#define DRV_MODULE_VER_SUBMINOR 048#define DRV_MODULE_VER_SUBMINOR 0
49 49
50#define DRV_MODULE_NAME "ena"50#define DRV_MODULE_NAME "ena"
@@ -52,7 +52,7 @@ · 1 unmodified line
52#define DRV_MODULE_VERSION \52#define DRV_MODULE_VERSION \
53 __stringify(DRV_MODULE_VER_MAJOR) "." \53 __stringify(DRV_MODULE_VER_MAJOR) "." \
54 __stringify(DRV_MODULE_VER_MINOR) "." \54 __stringify(DRV_MODULE_VER_MINOR) "." \
55 __stringify(DRV_MODULE_VER_SUBMINOR) "k"55 __stringify(DRV_MODULE_VER_SUBMINOR) "K"
56#endif56#endif
57 57
58#define DEVICE_NAME "Elastic Network Adapter (ENA)"58#define DEVICE_NAME "Elastic Network Adapter (ENA)"
@@ -185,6 +185,7 @@ struct ena_stats_tx { · 126 unmodified lines
185 u64 tx_poll;185 u64 tx_poll;
186 u64 doorbells;186 u64 doorbells;
187 u64 bad_req_id;187 u64 bad_req_id;
188 u64 missed_tx;
188};189};
189 190
190struct ena_stats_rx {191struct ena_stats_rx {
@@ -257,8 +258,8 @@ struct ena_ring { · 66 unmodified lines
257 258
258struct ena_stats_dev {259struct ena_stats_dev {
259 u64 tx_timeout;260 u64 tx_timeout;
260 u64 io_suspend;261 u64 suspend;
261 u64 io_resume;262 u64 resume;
262 u64 wd_expired;263 u64 wd_expired;
263 u64 interface_up;264 u64 interface_up;
264 u64 interface_down;265 u64 interface_down;
@@ -326,11 +327,10 @@ struct ena_adapter { · 61 unmodified lines
326 327
327 /* timer service */328 /* timer service */
328 struct work_struct reset_task;329 struct work_struct reset_task;
329 struct work_struct suspend_io_task;
330 struct work_struct resume_io_task;
331 struct timer_list timer_service;330 struct timer_list timer_service;
332 331
333 bool wd_state;332 bool wd_state;
333 bool dev_up_before_reset;
334 unsigned long last_keep_alive_jiffies;334 unsigned long last_keep_alive_jiffies;
335 335
336 struct u64_stats_sync syncp;336 struct u64_stats_sync syncp;
drivers/net/ethernet/amd/a2065.c+10−4
@@ -123,6 +123,7 @@ struct lance_private { · 122 unmodified lines
123 int burst_sizes; /* ledma SBus burst sizes */123 int burst_sizes; /* ledma SBus burst sizes */
124#endif124#endif
125 struct timer_list multicast_timer;125 struct timer_list multicast_timer;
126 struct net_device *dev;
126};127};
127 128
128#define LANCE_ADDR(x) ((int)(x) & ~0xff000000)129#define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
@@ -638,6 +639,13 @@ static void lance_set_multicast(struct net_device *dev) · 509 unmodified lines
638 netif_wake_queue(dev);639 netif_wake_queue(dev);
639}640}
640 641
642static void lance_set_multicast_retry(struct timer_list *t)
643{
644 struct lance_private *lp = from_timer(lp, t, multicast_timer);
645
646 lance_set_multicast(lp->dev);
647}
648
641static int a2065_init_one(struct zorro_dev *z,649static int a2065_init_one(struct zorro_dev *z,
642 const struct zorro_device_id *ent);650 const struct zorro_device_id *ent);
643static void a2065_remove_one(struct zorro_dev *z);651static void a2065_remove_one(struct zorro_dev *z);
@@ -728,15 +736,13 @@ static int a2065_init_one(struct zorro_dev *z, · 84 unmodified lines
728 priv->lance_log_tx_bufs = LANCE_LOG_TX_BUFFERS;736 priv->lance_log_tx_bufs = LANCE_LOG_TX_BUFFERS;
729 priv->rx_ring_mod_mask = RX_RING_MOD_MASK;737 priv->rx_ring_mod_mask = RX_RING_MOD_MASK;
730 priv->tx_ring_mod_mask = TX_RING_MOD_MASK;738 priv->tx_ring_mod_mask = TX_RING_MOD_MASK;
739 priv->dev = dev;
731 740
732 dev->netdev_ops = &lance_netdev_ops;741 dev->netdev_ops = &lance_netdev_ops;
733 dev->watchdog_timeo = 5*HZ;742 dev->watchdog_timeo = 5*HZ;
734 dev->dma = 0;743 dev->dma = 0;
735 744
736 init_timer(&priv->multicast_timer);745 timer_setup(&priv->multicast_timer, lance_set_multicast_retry, 0);
737 priv->multicast_timer.data = (unsigned long) dev;
738 priv->multicast_timer.function =
739 (void (*)(unsigned long))lance_set_multicast;
740 746
741 err = register_netdev(dev);747 err = register_netdev(dev);
742 if (err) {748 if (err) {
drivers/net/ethernet/amd/am79c961a.c+5−6
@@ -302,10 +302,10 @@ am79c961_init_for_open(struct net_device *dev) · 301 unmodified lines
302 write_rreg (dev->base_addr, CSR0, CSR0_IENA|CSR0_STRT);302 write_rreg (dev->base_addr, CSR0, CSR0_IENA|CSR0_STRT);
303}303}
304 304
305static void am79c961_timer(unsigned long data)305static void am79c961_timer(struct timer_list *t)
306{306{
307 struct net_device *dev = (struct net_device *)data;307 struct dev_priv *priv = from_timer(priv, t, timer);
308 struct dev_priv *priv = netdev_priv(dev);308 struct net_device *dev = priv->dev;
309 unsigned int lnkstat, carrier;309 unsigned int lnkstat, carrier;
310 unsigned long flags;310 unsigned long flags;
311 311
@@ -728,9 +728,8 @@ static int am79c961_probe(struct platform_device *pdev) · 416 unmodified lines
728 am79c961_banner();728 am79c961_banner();
729 729
730 spin_lock_init(&priv->chip_lock);730 spin_lock_init(&priv->chip_lock);
731 init_timer(&priv->timer);731 priv->dev = dev;
732 priv->timer.data = (unsigned long)dev;732 timer_setup(&priv->timer, am79c961_timer, 0);
733 priv->timer.function = am79c961_timer;
734 733
735 if (am79c961_hw_init(dev))734 if (am79c961_hw_init(dev))
736 goto release;735 goto release;
drivers/net/ethernet/amd/am79c961a.h+1−0
@@ -140,6 +140,7 @@ struct dev_priv { · 139 unmodified lines
140 unsigned long txhdr;140 unsigned long txhdr;
141 spinlock_t chip_lock;141 spinlock_t chip_lock;
142 struct timer_list timer;142 struct timer_list timer;
143 struct net_device *dev;
143};144};
144 145
145#endif146#endif
drivers/net/ethernet/amd/amd8111e.c+3−5
@@ -1669,9 +1669,9 @@ static int amd8111e_resume(struct pci_dev *pci_dev) · 1668 unmodified lines
1669 return 0;1669 return 0;
1670}1670}
1671 1671
1672static void amd8111e_config_ipg(struct net_device *dev)1672static void amd8111e_config_ipg(struct timer_list *t)
1673{1673{
1674 struct amd8111e_priv *lp = netdev_priv(dev);1674 struct amd8111e_priv *lp = from_timer(lp, t, ipg_data.ipg_timer);
1675 struct ipg_info *ipg_data = &lp->ipg_data;1675 struct ipg_info *ipg_data = &lp->ipg_data;
1676 void __iomem *mmio = lp->mmio;1676 void __iomem *mmio = lp->mmio;
1677 unsigned int prev_col_cnt = ipg_data->col_cnt;1677 unsigned int prev_col_cnt = ipg_data->col_cnt;
@@ -1883,9 +1883,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, · 205 unmodified lines
1883 1883
1884 /* Initialize software ipg timer */1884 /* Initialize software ipg timer */
1885 if(lp->options & OPTION_DYN_IPG_ENABLE){1885 if(lp->options & OPTION_DYN_IPG_ENABLE){
1886 init_timer(&lp->ipg_data.ipg_timer);1886 timer_setup(&lp->ipg_data.ipg_timer, amd8111e_config_ipg, 0);
1887 lp->ipg_data.ipg_timer.data = (unsigned long) dev;
1888 lp->ipg_data.ipg_timer.function = (void *)&amd8111e_config_ipg;
1889 lp->ipg_data.ipg_timer.expires = jiffies +1887 lp->ipg_data.ipg_timer.expires = jiffies +
1890 IPG_CONVERGE_JIFFIES;1888 IPG_CONVERGE_JIFFIES;
1891 lp->ipg_data.ipg = DEFAULT_IPG;1889 lp->ipg_data.ipg = DEFAULT_IPG;
drivers/net/ethernet/amd/declance.c+7−5
@@ -260,6 +260,7 @@ struct lance_private { · 259 unmodified lines
260 unsigned short busmaster_regval;260 unsigned short busmaster_regval;
261 261
262 struct timer_list multicast_timer;262 struct timer_list multicast_timer;
263 struct net_device *dev;
263 264
264 /* Pointers to the ring buffers as seen from the CPU */265 /* Pointers to the ring buffers as seen from the CPU */
265 char *rx_buf_ptr_cpu[RX_RING_SIZE];266 char *rx_buf_ptr_cpu[RX_RING_SIZE];
@@ -1000,9 +1001,10 @@ static void lance_set_multicast(struct net_device *dev) · 734 unmodified lines
1000 netif_wake_queue(dev);1001 netif_wake_queue(dev);
1001}1002}
1002 1003
1003static void lance_set_multicast_retry(unsigned long _opaque)1004static void lance_set_multicast_retry(struct timer_list *t)
1004{1005{
1005 struct net_device *dev = (struct net_device *) _opaque;1006 struct lance_private *lp = from_timer(lp, t, multicast_timer);
1007 struct net_device *dev = lp->dev;
1006 1008
1007 lance_set_multicast(dev);1009 lance_set_multicast(dev);
1008}1010}
@@ -1246,9 +1248,9 @@ static int dec_lance_probe(struct device *bdev, const int type) · 237 unmodified lines
1246 * can occur from interrupts (ex. IPv6). So we1248 * can occur from interrupts (ex. IPv6). So we
1247 * use a timer to try again later when necessary. -DaveM1249 * use a timer to try again later when necessary. -DaveM
1248 */1250 */
1249 init_timer(&lp->multicast_timer);1251 lp->dev = dev;
1250 lp->multicast_timer.data = (unsigned long) dev;1252 timer_setup(&lp->multicast_timer, lance_set_multicast_retry, 0);
1251 lp->multicast_timer.function = lance_set_multicast_retry;1253
1252 1254
1253 ret = register_netdev(dev);1255 ret = register_netdev(dev);
1254 if (ret) {1256 if (ret) {
drivers/net/ethernet/amd/pcnet32.c+5−6
@@ -321,7 +321,7 @@ static struct net_device_stats *pcnet32_get_stats(struct net_device *); · 320 unmodified lines
321static void pcnet32_load_multicast(struct net_device *dev);321static void pcnet32_load_multicast(struct net_device *dev);
322static void pcnet32_set_multicast_list(struct net_device *);322static void pcnet32_set_multicast_list(struct net_device *);
323static int pcnet32_ioctl(struct net_device *, struct ifreq *, int);323static int pcnet32_ioctl(struct net_device *, struct ifreq *, int);
324static void pcnet32_watchdog(struct net_device *);324static void pcnet32_watchdog(struct timer_list *);
325static int mdio_read(struct net_device *dev, int phy_id, int reg_num);325static int mdio_read(struct net_device *dev, int phy_id, int reg_num);
326static void mdio_write(struct net_device *dev, int phy_id, int reg_num,326static void mdio_write(struct net_device *dev, int phy_id, int reg_num,
327 int val);327 int val);
@@ -1970,9 +1970,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) · 1642 unmodified lines
1970 lp->options |= PCNET32_PORT_MII;1970 lp->options |= PCNET32_PORT_MII;
1971 }1971 }
1972 1972
1973 init_timer(&lp->watchdog_timer);1973 timer_setup(&lp->watchdog_timer, pcnet32_watchdog, 0);
1974 lp->watchdog_timer.data = (unsigned long)dev;
1975 lp->watchdog_timer.function = (void *)&pcnet32_watchdog;
1976 1974
1977 /* The PCNET32-specific entries in the device structure. */1975 /* The PCNET32-specific entries in the device structure. */
1978 dev->netdev_ops = &pcnet32_netdev_ops;1976 dev->netdev_ops = &pcnet32_netdev_ops;
@@ -2902,9 +2900,10 @@ static void pcnet32_check_media(struct net_device *dev, int verbose) · 923 unmodified lines
2902 * Could possibly be changed to use mii_check_media instead.2900 * Could possibly be changed to use mii_check_media instead.
2903 */2901 */
2904 2902
2905static void pcnet32_watchdog(struct net_device *dev)2903static void pcnet32_watchdog(struct timer_list *t)
2906{2904{
2907 struct pcnet32_private *lp = netdev_priv(dev);2905 struct pcnet32_private *lp = from_timer(lp, t, watchdog_timer);
2906 struct net_device *dev = lp->dev;
2908 unsigned long flags;2907 unsigned long flags;
2909 2908
2910 /* Print the link status if it has changed */2909 /* Print the link status if it has changed */
drivers/net/ethernet/amd/sunlance.c+4−5
@@ -1248,9 +1248,10 @@ static void lance_set_multicast(struct net_device *dev) · 1247 unmodified lines
1248 netif_wake_queue(dev);1248 netif_wake_queue(dev);
1249}1249}
1250 1250
1251static void lance_set_multicast_retry(unsigned long _opaque)1251static void lance_set_multicast_retry(struct timer_list *t)
1252{1252{
1253 struct net_device *dev = (struct net_device *) _opaque;1253 struct lance_private *lp = from_timer(lp, t, multicast_timer);
1254 struct net_device *dev = lp->dev;
1254 1255
1255 lance_set_multicast(dev);1256 lance_set_multicast(dev);
1256}1257}
@@ -1459,9 +1460,7 @@ no_link_test: · 202 unmodified lines
1459 * can occur from interrupts (ex. IPv6). So we1460 * can occur from interrupts (ex. IPv6). So we
1460 * use a timer to try again later when necessary. -DaveM1461 * use a timer to try again later when necessary. -DaveM
1461 */1462 */
1462 init_timer(&lp->multicast_timer);1463 timer_setup(&lp->multicast_timer, lance_set_multicast_retry, 0);
1463 lp->multicast_timer.data = (unsigned long) dev;
1464 lp->multicast_timer.function = lance_set_multicast_retry;
1465 1464
1466 if (register_netdev(dev)) {1465 if (register_netdev(dev)) {
1467 printk(KERN_ERR "SunLance: Cannot register device.\n");1466 printk(KERN_ERR "SunLance: Cannot register device.\n");
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+7−9
@@ -642,9 +642,9 @@ static irqreturn_t xgbe_dma_isr(int irq, void *data) · 641 unmodified lines
642 return IRQ_HANDLED;642 return IRQ_HANDLED;
643}643}
644 644
645static void xgbe_tx_timer(unsigned long data)645static void xgbe_tx_timer(struct timer_list *t)
646{646{
647 struct xgbe_channel *channel = (struct xgbe_channel *)data;647 struct xgbe_channel *channel = from_timer(channel, t, tx_timer);
648 struct xgbe_prv_data *pdata = channel->pdata;648 struct xgbe_prv_data *pdata = channel->pdata;
649 struct napi_struct *napi;649 struct napi_struct *napi;
650 650
@@ -680,9 +680,9 @@ static void xgbe_service(struct work_struct *work) · 29 unmodified lines
680 pdata->phy_if.phy_status(pdata);680 pdata->phy_if.phy_status(pdata);
681}681}
682 682
683static void xgbe_service_timer(unsigned long data)683static void xgbe_service_timer(struct timer_list *t)
684{684{
685 struct xgbe_prv_data *pdata = (struct xgbe_prv_data *)data;685 struct xgbe_prv_data *pdata = from_timer(pdata, t, service_timer);
686 686
687 queue_work(pdata->dev_workqueue, &pdata->service_work);687 queue_work(pdata->dev_workqueue, &pdata->service_work);
688 688
@@ -694,16 +694,14 @@ static void xgbe_init_timers(struct xgbe_prv_data *pdata) · 5 unmodified lines
694 struct xgbe_channel *channel;694 struct xgbe_channel *channel;
695 unsigned int i;695 unsigned int i;
696 696
697 setup_timer(&pdata->service_timer, xgbe_service_timer,697 timer_setup(&pdata->service_timer, xgbe_service_timer, 0);
698 (unsigned long)pdata);
699 698
700 for (i = 0; i < pdata->channel_count; i++) {699 for (i = 0; i < pdata->channel_count; i++) {
701 channel = pdata->channel[i];700 channel = pdata->channel[i];
702 if (!channel->tx_ring)701 if (!channel->tx_ring)
703 break;702 break;
704 703
705 setup_timer(&channel->tx_timer, xgbe_tx_timer,704 timer_setup(&channel->tx_timer, xgbe_tx_timer, 0);
706 (unsigned long)channel);
707 }705 }
708}706}
709 707
@@ -2208,7 +2206,7 @@ static int xgbe_setup_tc(struct net_device *netdev, enum tc_setup_type type, · 1498 unmodified lines
2208 struct tc_mqprio_qopt *mqprio = type_data;2206 struct tc_mqprio_qopt *mqprio = type_data;
2209 u8 tc;2207 u8 tc;
2210 2208
2211 if (type != TC_SETUP_MQPRIO)2209 if (type != TC_SETUP_QDISC_MQPRIO)
2212 return -EOPNOTSUPP;2210 return -EOPNOTSUPP;
2213 2211
2214 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;2212 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
drivers/net/ethernet/apple/bmac.c+5−7
@@ -157,7 +157,7 @@ static irqreturn_t bmac_misc_intr(int irq, void *dev_id); · 156 unmodified lines
157static irqreturn_t bmac_txdma_intr(int irq, void *dev_id);157static irqreturn_t bmac_txdma_intr(int irq, void *dev_id);
158static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id);158static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id);
159static void bmac_set_timeout(struct net_device *dev);159static void bmac_set_timeout(struct net_device *dev);
160static void bmac_tx_timeout(unsigned long data);160static void bmac_tx_timeout(struct timer_list *t);
161static int bmac_output(struct sk_buff *skb, struct net_device *dev);161static int bmac_output(struct sk_buff *skb, struct net_device *dev);
162static void bmac_start(struct net_device *dev);162static void bmac_start(struct net_device *dev);
163 163
@@ -555,8 +555,6 @@ static inline void bmac_set_timeout(struct net_device *dev) · 391 unmodified lines
555 if (bp->timeout_active)555 if (bp->timeout_active)
556 del_timer(&bp->tx_timeout);556 del_timer(&bp->tx_timeout);
557 bp->tx_timeout.expires = jiffies + TX_TIMEOUT;557 bp->tx_timeout.expires = jiffies + TX_TIMEOUT;
558 bp->tx_timeout.function = bmac_tx_timeout;
559 bp->tx_timeout.data = (unsigned long) dev;
560 add_timer(&bp->tx_timeout);558 add_timer(&bp->tx_timeout);
561 bp->timeout_active = 1;559 bp->timeout_active = 1;
562 spin_unlock_irqrestore(&bp->lock, flags);560 spin_unlock_irqrestore(&bp->lock, flags);
@@ -1321,7 +1319,7 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) · 758 unmodified lines
1321 bp->queue = (struct sk_buff_head *)(bp->rx_cmds + N_RX_RING + 1);1319 bp->queue = (struct sk_buff_head *)(bp->rx_cmds + N_RX_RING + 1);
1322 skb_queue_head_init(bp->queue);1320 skb_queue_head_init(bp->queue);
1323 1321
1324 init_timer(&bp->tx_timeout);1322 timer_setup(&bp->tx_timeout, bmac_tx_timeout, 0);
1325 1323
1326 ret = request_irq(dev->irq, bmac_misc_intr, 0, "BMAC-misc", dev);1324 ret = request_irq(dev->irq, bmac_misc_intr, 0, "BMAC-misc", dev);
1327 if (ret) {1325 if (ret) {
@@ -1471,10 +1469,10 @@ bmac_output(struct sk_buff *skb, struct net_device *dev) · 143 unmodified lines
1471 return NETDEV_TX_OK;1469 return NETDEV_TX_OK;
1472}1470}
1473 1471
1474static void bmac_tx_timeout(unsigned long data)1472static void bmac_tx_timeout(struct timer_list *t)
1475{1473{
1476 struct net_device *dev = (struct net_device *) data;1474 struct bmac_data *bp = from_timer(bp, t, tx_timeout);
1477 struct bmac_data *bp = netdev_priv(dev);1475 struct net_device *dev = macio_get_drvdata(bp->mdev);
1478 volatile struct dbdma_regs __iomem *td = bp->tx_dma;1476 volatile struct dbdma_regs __iomem *td = bp->tx_dma;
1479 volatile struct dbdma_regs __iomem *rd = bp->rx_dma;1477 volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
1480 volatile struct dbdma_cmd *cp;1478 volatile struct dbdma_cmd *cp;
drivers/net/ethernet/apple/mace.c+5−7
@@ -86,7 +86,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id); · 85 unmodified lines
86static irqreturn_t mace_txdma_intr(int irq, void *dev_id);86static irqreturn_t mace_txdma_intr(int irq, void *dev_id);
87static irqreturn_t mace_rxdma_intr(int irq, void *dev_id);87static irqreturn_t mace_rxdma_intr(int irq, void *dev_id);
88static void mace_set_timeout(struct net_device *dev);88static void mace_set_timeout(struct net_device *dev);
89static void mace_tx_timeout(unsigned long data);89static void mace_tx_timeout(struct timer_list *t);
90static inline void dbdma_reset(volatile struct dbdma_regs __iomem *dma);90static inline void dbdma_reset(volatile struct dbdma_regs __iomem *dma);
91static inline void mace_clean_rings(struct mace_data *mp);91static inline void mace_clean_rings(struct mace_data *mp);
92static void __mace_set_address(struct net_device *dev, void *addr);92static void __mace_set_address(struct net_device *dev, void *addr);
@@ -196,7 +196,7 @@ static int mace_probe(struct macio_dev *mdev, const struct of_device_id *match) · 103 unmodified lines
196 196
197 memset((char *) mp->tx_cmds, 0,197 memset((char *) mp->tx_cmds, 0,
198 (NCMDS_TX*N_TX_RING + N_RX_RING + 2) * sizeof(struct dbdma_cmd));198 (NCMDS_TX*N_TX_RING + N_RX_RING + 2) * sizeof(struct dbdma_cmd));
199 init_timer(&mp->tx_timeout);199 timer_setup(&mp->tx_timeout, mace_tx_timeout, 0);
200 spin_lock_init(&mp->lock);200 spin_lock_init(&mp->lock);
201 mp->timeout_active = 0;201 mp->timeout_active = 0;
202 202
@@ -521,8 +521,6 @@ static inline void mace_set_timeout(struct net_device *dev) · 318 unmodified lines
521 if (mp->timeout_active)521 if (mp->timeout_active)
522 del_timer(&mp->tx_timeout);522 del_timer(&mp->tx_timeout);
523 mp->tx_timeout.expires = jiffies + TX_TIMEOUT;523 mp->tx_timeout.expires = jiffies + TX_TIMEOUT;
524 mp->tx_timeout.function = mace_tx_timeout;
525 mp->tx_timeout.data = (unsigned long) dev;
526 add_timer(&mp->tx_timeout);524 add_timer(&mp->tx_timeout);
527 mp->timeout_active = 1;525 mp->timeout_active = 1;
528}526}
@@ -801,10 +799,10 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) · 272 unmodified lines
801 return IRQ_HANDLED;799 return IRQ_HANDLED;
802}800}
803 801
804static void mace_tx_timeout(unsigned long data)802static void mace_tx_timeout(struct timer_list *t)
805{803{
806 struct net_device *dev = (struct net_device *) data;804 struct mace_data *mp = from_timer(mp, t, tx_timeout);
807 struct mace_data *mp = netdev_priv(dev);805 struct net_device *dev = macio_get_drvdata(mp->mdev);
808 volatile struct mace __iomem *mb = mp->mace;806 volatile struct mace __iomem *mb = mp->mace;
809 volatile struct dbdma_regs __iomem *td = mp->tx_dma;807 volatile struct dbdma_regs __iomem *td = mp->tx_dma;
810 volatile struct dbdma_regs __iomem *rd = mp->rx_dma;808 volatile struct dbdma_regs __iomem *rd = mp->rx_dma;
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c+4−4
@@ -221,8 +221,8 @@ static int aq_ethtool_get_rxnfc(struct net_device *ndev, · 220 unmodified lines
221 return err;221 return err;
222}222}
223 223
224int aq_ethtool_get_coalesce(struct net_device *ndev,224static int aq_ethtool_get_coalesce(struct net_device *ndev,
225 struct ethtool_coalesce *coal)225 struct ethtool_coalesce *coal)
226{226{
227 struct aq_nic_s *aq_nic = netdev_priv(ndev);227 struct aq_nic_s *aq_nic = netdev_priv(ndev);
228 struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);228 struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
@@ -242,8 +242,8 @@ int aq_ethtool_get_coalesce(struct net_device *ndev, · 13 unmodified lines
242 return 0;242 return 0;
243}243}
244 244
245int aq_ethtool_set_coalesce(struct net_device *ndev,245static int aq_ethtool_set_coalesce(struct net_device *ndev,
246 struct ethtool_coalesce *coal)246 struct ethtool_coalesce *coal)
247{247{
248 struct aq_nic_s *aq_nic = netdev_priv(ndev);248 struct aq_nic_s *aq_nic = netdev_priv(ndev);
249 struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);249 struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
drivers/net/ethernet/broadcom/Kconfig+1−0
@@ -184,6 +184,7 @@ config BGMAC_PLATFORM · 183 unmodified lines
184config SYSTEMPORT184config SYSTEMPORT
185 tristate "Broadcom SYSTEMPORT internal MAC support"185 tristate "Broadcom SYSTEMPORT internal MAC support"
186 depends on OF186 depends on OF
187 depends on NET_DSA || !NET_DSA
187 select MII188 select MII
188 select PHYLIB189 select PHYLIB
189 select FIXED_PHY190 select FIXED_PHY
drivers/net/ethernet/broadcom/b44.c+1−3
@@ -1474,10 +1474,8 @@ static int b44_open(struct net_device *dev) · 1473 unmodified lines
1474 goto out;1474 goto out;
1475 }1475 }
1476 1476
1477 init_timer(&bp->timer);1477 setup_timer(&bp->timer, b44_timer, (unsigned long)bp);
1478 bp->timer.expires = jiffies + HZ;1478 bp->timer.expires = jiffies + HZ;
1479 bp->timer.data = (unsigned long) bp;
1480 bp->timer.function = b44_timer;
1481 add_timer(&bp->timer);1479 add_timer(&bp->timer);
1482 1480
1483 b44_enable_ints(bp);1481 b44_enable_ints(bp);
drivers/net/ethernet/broadcom/bcm63xx_enet.c+38−70
@@ -295,16 +295,13 @@ static int bcm_enet_refill_rx(struct net_device *dev) · 294 unmodified lines
295/*295/*
296 * timer callback to defer refill rx queue in case we're OOM296 * timer callback to defer refill rx queue in case we're OOM
297 */297 */
298static void bcm_enet_refill_rx_timer(unsigned long data)298static void bcm_enet_refill_rx_timer(struct timer_list *t)
299{299{
300 struct net_device *dev;300 struct bcm_enet_priv *priv = from_timer(priv, t, rx_timeout);
301 struct bcm_enet_priv *priv;301 struct net_device *dev = priv->net_dev;
302
303 dev = (struct net_device *)data;
304 priv = netdev_priv(dev);
305 302
306 spin_lock(&priv->rx_lock);303 spin_lock(&priv->rx_lock);
307 bcm_enet_refill_rx((struct net_device *)data);304 bcm_enet_refill_rx(dev);
308 spin_unlock(&priv->rx_lock);305 spin_unlock(&priv->rx_lock);
309}306}
310 307
@@ -1062,7 +1059,8 @@ static int bcm_enet_open(struct net_device *dev) · 751 unmodified lines
1062 val = enet_readl(priv, ENET_CTL_REG);1059 val = enet_readl(priv, ENET_CTL_REG);
1063 val |= ENET_CTL_ENABLE_MASK;1060 val |= ENET_CTL_ENABLE_MASK;
1064 enet_writel(priv, val, ENET_CTL_REG);1061 enet_writel(priv, val, ENET_CTL_REG);
1065 enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);1062 if (priv->dma_has_sram)
1063 enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
1066 enet_dmac_writel(priv, priv->dma_chan_en_mask,1064 enet_dmac_writel(priv, priv->dma_chan_en_mask,
1067 ENETDMAC_CHANCFG, priv->rx_chan);1065 ENETDMAC_CHANCFG, priv->rx_chan);
1068 1066
@@ -1721,10 +1719,8 @@ static int bcm_enet_probe(struct platform_device *pdev) · 652 unmodified lines
1721 const char *clk_name;1719 const char *clk_name;
1722 int i, ret;1720 int i, ret;
1723 1721
1724 /* stop if shared driver failed, assume driver->probe will be
1725 * called in the same order we register devices (correct ?) */
1726 if (!bcm_enet_shared_base[0])1722 if (!bcm_enet_shared_base[0])
1727 return -ENODEV;1723 return -EPROBE_DEFER;
1728 1724
1729 res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);1725 res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1730 res_irq_rx = platform_get_resource(pdev, IORESOURCE_IRQ, 1);1726 res_irq_rx = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
@@ -1768,12 +1764,14 @@ static int bcm_enet_probe(struct platform_device *pdev) · 37 unmodified lines
1768 clk_name = "enet1";1764 clk_name = "enet1";
1769 }1765 }
1770 1766
1771 priv->mac_clk = clk_get(&pdev->dev, clk_name);1767 priv->mac_clk = devm_clk_get(&pdev->dev, clk_name);
1772 if (IS_ERR(priv->mac_clk)) {1768 if (IS_ERR(priv->mac_clk)) {
1773 ret = PTR_ERR(priv->mac_clk);1769 ret = PTR_ERR(priv->mac_clk);
1774 goto out;1770 goto out;
1775 }1771 }
1776 clk_prepare_enable(priv->mac_clk);1772 ret = clk_prepare_enable(priv->mac_clk);
1773 if (ret)
1774 goto out;
1777 1775
1778 /* initialize default and fetch platform data */1776 /* initialize default and fetch platform data */
1779 priv->rx_ring_size = BCMENET_DEF_RX_DESC;1777 priv->rx_ring_size = BCMENET_DEF_RX_DESC;
@@ -1801,13 +1799,15 @@ static int bcm_enet_probe(struct platform_device *pdev) · 21 unmodified lines
1801 1799
1802 if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {1800 if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {
1803 /* using internal PHY, enable clock */1801 /* using internal PHY, enable clock */
1804 priv->phy_clk = clk_get(&pdev->dev, "ephy");1802 priv->phy_clk = devm_clk_get(&pdev->dev, "ephy");
1805 if (IS_ERR(priv->phy_clk)) {1803 if (IS_ERR(priv->phy_clk)) {
1806 ret = PTR_ERR(priv->phy_clk);1804 ret = PTR_ERR(priv->phy_clk);
1807 priv->phy_clk = NULL;1805 priv->phy_clk = NULL;
1808 goto out_put_clk_mac;1806 goto out_disable_clk_mac;
1809 }1807 }
1810 clk_prepare_enable(priv->phy_clk);1808 ret = clk_prepare_enable(priv->phy_clk);
1809 if (ret)
1810 goto out_disable_clk_mac;
1811 }1811 }
1812 1812
1813 /* do minimal hardware init to be able to probe mii bus */1813 /* do minimal hardware init to be able to probe mii bus */
@@ -1857,9 +1857,7 @@ static int bcm_enet_probe(struct platform_device *pdev) · 43 unmodified lines
1857 spin_lock_init(&priv->rx_lock);1857 spin_lock_init(&priv->rx_lock);
1858 1858
1859 /* init rx timeout (used for oom) */1859 /* init rx timeout (used for oom) */
1860 init_timer(&priv->rx_timeout);1860 timer_setup(&priv->rx_timeout, bcm_enet_refill_rx_timer, 0);
1861 priv->rx_timeout.function = bcm_enet_refill_rx_timer;
1862 priv->rx_timeout.data = (unsigned long)dev;
1863 1861
1864 /* init the mib update lock&work */1862 /* init the mib update lock&work */
1865 mutex_init(&priv->mib_update_lock);1863 mutex_init(&priv->mib_update_lock);
@@ -1901,14 +1899,10 @@ out_free_mdio: · 35 unmodified lines
1901out_uninit_hw:1899out_uninit_hw:
1902 /* turn off mdc clock */1900 /* turn off mdc clock */
1903 enet_writel(priv, 0, ENET_MIISC_REG);1901 enet_writel(priv, 0, ENET_MIISC_REG);
1904 if (priv->phy_clk) {1902 clk_disable_unprepare(priv->phy_clk);
1905 clk_disable_unprepare(priv->phy_clk);
1906 clk_put(priv->phy_clk);
1907 }
1908 1903
1909out_put_clk_mac:1904out_disable_clk_mac:
1910 clk_disable_unprepare(priv->mac_clk);1905 clk_disable_unprepare(priv->mac_clk);
1911 clk_put(priv->mac_clk);
1912out:1906out:
1913 free_netdev(dev);1907 free_netdev(dev);
1914 return ret;1908 return ret;
@@ -1944,12 +1938,8 @@ static int bcm_enet_remove(struct platform_device *pdev) · 29 unmodified lines
1944 }1938 }
1945 1939
1946 /* disable hw block clocks */1940 /* disable hw block clocks */
1947 if (priv->phy_clk) {1941 clk_disable_unprepare(priv->phy_clk);
1948 clk_disable_unprepare(priv->phy_clk);
1949 clk_put(priv->phy_clk);
1950 }
1951 clk_disable_unprepare(priv->mac_clk);1942 clk_disable_unprepare(priv->mac_clk);
1952 clk_put(priv->mac_clk);
1953 1943
1954 free_netdev(dev);1944 free_netdev(dev);
1955 return 0;1945 return 0;
@@ -2021,9 +2011,9 @@ static inline int bcm_enet_port_is_rgmii(int portid) · 65 unmodified lines
2021/*2011/*
2022 * enet sw PHY polling2012 * enet sw PHY polling
2023 */2013 */
2024static void swphy_poll_timer(unsigned long data)2014static void swphy_poll_timer(struct timer_list *t)
2025{2015{
2026 struct bcm_enet_priv *priv = (struct bcm_enet_priv *)data;2016 struct bcm_enet_priv *priv = from_timer(priv, t, swphy_poll);
2027 unsigned int i;2017 unsigned int i;
2028 2018
2029 for (i = 0; i < priv->num_ports; i++) {2019 for (i = 0; i < priv->num_ports; i++) {
@@ -2332,11 +2322,8 @@ static int bcm_enetsw_open(struct net_device *dev) · 302 unmodified lines
2332 }2322 }
2333 2323
2334 /* start phy polling timer */2324 /* start phy polling timer */
2335 init_timer(&priv->swphy_poll);2325 timer_setup(&priv->swphy_poll, swphy_poll_timer, 0);
2336 priv->swphy_poll.function = swphy_poll_timer;2326 mod_timer(&priv->swphy_poll, jiffies);
2337 priv->swphy_poll.data = (unsigned long)priv;
2338 priv->swphy_poll.expires = jiffies;
2339 add_timer(&priv->swphy_poll);
2340 return 0;2327 return 0;
2341 2328
2342out:2329out:
@@ -2692,11 +2679,8 @@ static int bcm_enetsw_probe(struct platform_device *pdev) · 349 unmodified lines
2692 struct resource *res_mem;2679 struct resource *res_mem;
2693 int ret, irq_rx, irq_tx;2680 int ret, irq_rx, irq_tx;
2694 2681
2695 /* stop if shared driver failed, assume driver->probe will be
2696 * called in the same order we register devices (correct ?)
2697 */
2698 if (!bcm_enet_shared_base[0])2682 if (!bcm_enet_shared_base[0])
2699 return -ENODEV;2683 return -EPROBE_DEFER;
2700 2684
2701 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);2685 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2702 irq_rx = platform_get_irq(pdev, 0);2686 irq_rx = platform_get_irq(pdev, 0);
@@ -2735,33 +2719,27 @@ static int bcm_enetsw_probe(struct platform_device *pdev) · 32 unmodified lines
2735 if (ret)2719 if (ret)
2736 goto out;2720 goto out;
2737 2721
2738 if (!request_mem_region(res_mem->start, resource_size(res_mem),2722 priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
2739 "bcm63xx_enetsw")) {2723 if (IS_ERR(priv->base)) {
2740 ret = -EBUSY;2724 ret = PTR_ERR(priv->base);
2741 goto out;2725 goto out;
2742 }2726 }
2743 2727
2744 priv->base = ioremap(res_mem->start, resource_size(res_mem));2728 priv->mac_clk = devm_clk_get(&pdev->dev, "enetsw");
2745 if (priv->base == NULL) {
2746 ret = -ENOMEM;
2747 goto out_release_mem;
2748 }
2749
2750 priv->mac_clk = clk_get(&pdev->dev, "enetsw");
2751 if (IS_ERR(priv->mac_clk)) {2729 if (IS_ERR(priv->mac_clk)) {
2752 ret = PTR_ERR(priv->mac_clk);2730 ret = PTR_ERR(priv->mac_clk);
2753 goto out_unmap;2731 goto out;
2754 }2732 }
2755 clk_enable(priv->mac_clk);2733 ret = clk_prepare_enable(priv->mac_clk);
2734 if (ret)
2735 goto out;
2756 2736
2757 priv->rx_chan = 0;2737 priv->rx_chan = 0;
2758 priv->tx_chan = 1;2738 priv->tx_chan = 1;
2759 spin_lock_init(&priv->rx_lock);2739 spin_lock_init(&priv->rx_lock);
2760 2740
2761 /* init rx timeout (used for oom) */2741 /* init rx timeout (used for oom) */
2762 init_timer(&priv->rx_timeout);2742 timer_setup(&priv->rx_timeout, bcm_enet_refill_rx_timer, 0);
2763 priv->rx_timeout.function = bcm_enet_refill_rx_timer;
2764 priv->rx_timeout.data = (unsigned long)dev;
2765 2743
2766 /* register netdevice */2744 /* register netdevice */
2767 dev->netdev_ops = &bcm_enetsw_ops;2745 dev->netdev_ops = &bcm_enetsw_ops;
@@ -2773,7 +2751,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) · 5 unmodified lines
2773 2751
2774 ret = register_netdev(dev);2752 ret = register_netdev(dev);
2775 if (ret)2753 if (ret)
2776 goto out_put_clk;2754 goto out_disable_clk;
2777 2755
2778 netif_carrier_off(dev);2756 netif_carrier_off(dev);
2779 platform_set_drvdata(pdev, dev);2757 platform_set_drvdata(pdev, dev);
@@ -2782,14 +2760,8 @@ static int bcm_enetsw_probe(struct platform_device *pdev) · 2 unmodified lines
2782 2760
2783 return 0;2761 return 0;
2784 2762
2785out_put_clk:2763out_disable_clk:
2786 clk_put(priv->mac_clk);2764 clk_disable_unprepare(priv->mac_clk);
2787
2788out_unmap:
2789 iounmap(priv->base);
2790
2791out_release_mem:
2792 release_mem_region(res_mem->start, resource_size(res_mem));
2793out:2765out:
2794 free_netdev(dev);2766 free_netdev(dev);
2795 return ret;2767 return ret;
@@ -2801,17 +2773,13 @@ static int bcm_enetsw_remove(struct platform_device *pdev) · 5 unmodified lines
2801{2773{
2802 struct bcm_enet_priv *priv;2774 struct bcm_enet_priv *priv;
2803 struct net_device *dev;2775 struct net_device *dev;
2804 struct resource *res;
2805 2776
2806 /* stop netdevice */2777 /* stop netdevice */
2807 dev = platform_get_drvdata(pdev);2778 dev = platform_get_drvdata(pdev);
2808 priv = netdev_priv(dev);2779 priv = netdev_priv(dev);
2809 unregister_netdev(dev);2780 unregister_netdev(dev);
2810 2781
2811 /* release device resources */2782 clk_disable_unprepare(priv->mac_clk);
2812 iounmap(priv->base);
2813 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2814 release_mem_region(res->start, resource_size(res));
2815 2783
2816 free_netdev(dev);2784 free_netdev(dev);
2817 return 0;2785 return 0;
drivers/net/ethernet/broadcom/bcm63xx_enet.h+0−1
@@ -9,7 +9,6 @@ · 8 unmodified lines
9#include <linux/platform_device.h>9#include <linux/platform_device.h>
10 10
11#include <bcm63xx_regs.h>11#include <bcm63xx_regs.h>
12#include <bcm63xx_irq.h>
13#include <bcm63xx_io.h>12#include <bcm63xx_io.h>
14#include <bcm63xx_iudma.h>13#include <bcm63xx_iudma.h>
15 14
drivers/net/ethernet/broadcom/bcmsysport.c+126−4
@@ -1416,9 +1416,24 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, · 1415 unmodified lines
1416 tdma_writel(priv, 0, TDMA_DESC_RING_COUNT(index));1416 tdma_writel(priv, 0, TDMA_DESC_RING_COUNT(index));
1417 tdma_writel(priv, 1, TDMA_DESC_RING_INTR_CONTROL(index));1417 tdma_writel(priv, 1, TDMA_DESC_RING_INTR_CONTROL(index));
1418 tdma_writel(priv, 0, TDMA_DESC_RING_PROD_CONS_INDEX(index));1418 tdma_writel(priv, 0, TDMA_DESC_RING_PROD_CONS_INDEX(index));
1419 tdma_writel(priv, RING_IGNORE_STATUS, TDMA_DESC_RING_MAPPING(index));1419
1420 /* Configure QID and port mapping */
1421 reg = tdma_readl(priv, TDMA_DESC_RING_MAPPING(index));
1422 reg &= ~(RING_QID_MASK | RING_PORT_ID_MASK << RING_PORT_ID_SHIFT);
1423 if (ring->inspect) {
1424 reg |= ring->switch_queue & RING_QID_MASK;
1425 reg |= ring->switch_port << RING_PORT_ID_SHIFT;
1426 } else {
1427 reg |= RING_IGNORE_STATUS;
1428 }
1429 tdma_writel(priv, reg, TDMA_DESC_RING_MAPPING(index));
1420 tdma_writel(priv, 0, TDMA_DESC_RING_PCP_DEI_VID(index));1430 tdma_writel(priv, 0, TDMA_DESC_RING_PCP_DEI_VID(index));
1421 1431
1432 /* Enable ACB algorithm 2 */
1433 reg = tdma_readl(priv, TDMA_CONTROL);
1434 reg |= tdma_control_bit(priv, ACB_ALGO);
1435 tdma_writel(priv, reg, TDMA_CONTROL);
1436
1422 /* Do not use tdma_control_bit() here because TSB_SWAP1 collides1437 /* Do not use tdma_control_bit() here because TSB_SWAP1 collides
1423 * with the original definition of ACB_ALGO1438 * with the original definition of ACB_ALGO
1424 */1439 */
@@ -1447,8 +1462,9 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, · 22 unmodified lines
1447 napi_enable(&ring->napi);1462 napi_enable(&ring->napi);
1448 1463
1449 netif_dbg(priv, hw, priv->netdev,1464 netif_dbg(priv, hw, priv->netdev,
1450 "TDMA cfg, size=%d, desc_cpu=%p\n",1465 "TDMA cfg, size=%d, desc_cpu=%p switch q=%d,port=%d\n",
1451 ring->size, ring->desc_cpu);1466 ring->size, ring->desc_cpu, ring->switch_queue,
1467 ring->switch_port);
1452 1468
1453 return 0;1469 return 0;
1454}1470}
@@ -2013,6 +2029,29 @@ static const struct ethtool_ops bcm_sysport_ethtool_ops = { · 558 unmodified lines
2013 .set_link_ksettings = phy_ethtool_set_link_ksettings,2029 .set_link_ksettings = phy_ethtool_set_link_ksettings,
2014};2030};
2015 2031
2032static u16 bcm_sysport_select_queue(struct net_device *dev, struct sk_buff *skb,
2033 void *accel_priv,
2034 select_queue_fallback_t fallback)
2035{
2036 struct bcm_sysport_priv *priv = netdev_priv(dev);
2037 u16 queue = skb_get_queue_mapping(skb);
2038 struct bcm_sysport_tx_ring *tx_ring;
2039 unsigned int q, port;
2040
2041 if (!netdev_uses_dsa(dev))
2042 return fallback(dev, skb);
2043
2044 /* DSA tagging layer will have configured the correct queue */
2045 q = BRCM_TAG_GET_QUEUE(queue);
2046 port = BRCM_TAG_GET_PORT(queue);
2047 tx_ring = priv->ring_map[q + port * priv->per_port_num_tx_queues];
2048
2049 if (unlikely(!tx_ring))
2050 return fallback(dev, skb);
2051
2052 return tx_ring->index;
2053}
2054
2016static const struct net_device_ops bcm_sysport_netdev_ops = {2055static const struct net_device_ops bcm_sysport_netdev_ops = {
2017 .ndo_start_xmit = bcm_sysport_xmit,2056 .ndo_start_xmit = bcm_sysport_xmit,
2018 .ndo_tx_timeout = bcm_sysport_tx_timeout,2057 .ndo_tx_timeout = bcm_sysport_tx_timeout,
@@ -2025,8 +2064,79 @@ static const struct net_device_ops bcm_sysport_netdev_ops = { · 6 unmodified lines
2025 .ndo_poll_controller = bcm_sysport_poll_controller,2064 .ndo_poll_controller = bcm_sysport_poll_controller,
2026#endif2065#endif
2027 .ndo_get_stats64 = bcm_sysport_get_stats64,2066 .ndo_get_stats64 = bcm_sysport_get_stats64,
2067 .ndo_select_queue = bcm_sysport_select_queue,
2028};2068};
2029 2069
2070static int bcm_sysport_map_queues(struct net_device *dev,
2071 struct dsa_notifier_register_info *info)
2072{
2073 struct bcm_sysport_priv *priv = netdev_priv(dev);
2074 struct bcm_sysport_tx_ring *ring;
2075 struct net_device *slave_dev;
2076 unsigned int num_tx_queues;
2077 unsigned int q, start, port;
2078
2079 /* We can't be setting up queue inspection for non directly attached
2080 * switches
2081 */
2082 if (info->switch_number)
2083 return 0;
2084
2085 if (dev->netdev_ops != &bcm_sysport_netdev_ops)
2086 return 0;
2087
2088 port = info->port_number;
2089 slave_dev = info->info.dev;
2090
2091 /* On SYSTEMPORT Lite we have twice as less queues, so we cannot do a
2092 * 1:1 mapping, we can only do a 2:1 mapping. By reducing the number of
2093 * per-port (slave_dev) network devices queue, we achieve just that.
2094 * This need to happen now before any slave network device is used such
2095 * it accurately reflects the number of real TX queues.
2096 */
2097 if (priv->is_lite)
2098 netif_set_real_num_tx_queues(slave_dev,
2099 slave_dev->num_tx_queues / 2);
2100 num_tx_queues = slave_dev->real_num_tx_queues;
2101
2102 if (priv->per_port_num_tx_queues &&
2103 priv->per_port_num_tx_queues != num_tx_queues)
2104 netdev_warn(slave_dev, "asymetric number of per-port queues\n");
2105
2106 priv->per_port_num_tx_queues = num_tx_queues;
2107
2108 start = find_first_zero_bit(&priv->queue_bitmap, dev->num_tx_queues);
2109 for (q = 0; q < num_tx_queues; q++) {
2110 ring = &priv->tx_rings[q + start];
2111
2112 /* Just remember the mapping actual programming done
2113 * during bcm_sysport_init_tx_ring
2114 */
2115 ring->switch_queue = q;
2116 ring->switch_port = port;
2117 ring->inspect = true;
2118 priv->ring_map[q + port * num_tx_queues] = ring;
2119
2120 /* Set all queues as being used now */
2121 set_bit(q + start, &priv->queue_bitmap);
2122 }
2123
2124 return 0;
2125}
2126
2127static int bcm_sysport_dsa_notifier(struct notifier_block *unused,
2128 unsigned long event, void *ptr)
2129{
2130 struct dsa_notifier_register_info *info;
2131
2132 if (event != DSA_PORT_REGISTER)
2133 return NOTIFY_DONE;
2134
2135 info = ptr;
2136
2137 return notifier_from_errno(bcm_sysport_map_queues(info->master, info));
2138}
2139
2030#define REV_FMT "v%2x.%02x"2140#define REV_FMT "v%2x.%02x"
2031 2141
2032static const struct bcm_sysport_hw_params bcm_sysport_params[] = {2142static const struct bcm_sysport_hw_params bcm_sysport_params[] = {
@@ -2174,10 +2284,18 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 141 unmodified lines
2174 2284
2175 u64_stats_init(&priv->syncp);2285 u64_stats_init(&priv->syncp);
2176 2286
2287 priv->dsa_notifier.notifier_call = bcm_sysport_dsa_notifier;
2288
2289 ret = register_dsa_notifier(&priv->dsa_notifier);
2290 if (ret) {
2291 dev_err(&pdev->dev, "failed to register DSA notifier\n");
2292 goto err_deregister_fixed_link;
2293 }
2294
2177 ret = register_netdev(dev);2295 ret = register_netdev(dev);
2178 if (ret) {2296 if (ret) {
2179 dev_err(&pdev->dev, "failed to register net_device\n");2297 dev_err(&pdev->dev, "failed to register net_device\n");
2180 goto err_deregister_fixed_link;2298 goto err_deregister_notifier;
2181 }2299 }
2182 2300
2183 priv->rev = topctrl_readl(priv, REV_CNTL) & REV_MASK;2301 priv->rev = topctrl_readl(priv, REV_CNTL) & REV_MASK;
@@ -2190,6 +2308,8 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 6 unmodified lines
2190 2308
2191 return 0;2309 return 0;
2192 2310
2311err_deregister_notifier:
2312 unregister_dsa_notifier(&priv->dsa_notifier);
2193err_deregister_fixed_link:2313err_deregister_fixed_link:
2194 if (of_phy_is_fixed_link(dn))2314 if (of_phy_is_fixed_link(dn))
2195 of_phy_deregister_fixed_link(dn);2315 of_phy_deregister_fixed_link(dn);
@@ -2201,11 +2321,13 @@ err_free_netdev: · 5 unmodified lines
2201static int bcm_sysport_remove(struct platform_device *pdev)2321static int bcm_sysport_remove(struct platform_device *pdev)
2202{2322{
2203 struct net_device *dev = dev_get_drvdata(&pdev->dev);2323 struct net_device *dev = dev_get_drvdata(&pdev->dev);
2324 struct bcm_sysport_priv *priv = netdev_priv(dev);
2204 struct device_node *dn = pdev->dev.of_node;2325 struct device_node *dn = pdev->dev.of_node;
2205 2326
2206 /* Not much to do, ndo_close has been called2327 /* Not much to do, ndo_close has been called
2207 * and we use managed allocations2328 * and we use managed allocations
2208 */2329 */
2330 unregister_dsa_notifier(&priv->dsa_notifier);
2209 unregister_netdev(dev);2331 unregister_netdev(dev);
2210 if (of_phy_is_fixed_link(dn))2332 if (of_phy_is_fixed_link(dn))
2211 of_phy_deregister_fixed_link(dn);2333 of_phy_deregister_fixed_link(dn);
drivers/net/ethernet/broadcom/bcmsysport.h+11−1
@@ -404,7 +404,7 @@ struct bcm_rsb { · 403 unmodified lines
404#define RING_CONS_INDEX_MASK 0xffff404#define RING_CONS_INDEX_MASK 0xffff
405 405
406#define RING_MAPPING 0x14406#define RING_MAPPING 0x14
407#define RING_QID_MASK 0x3407#define RING_QID_MASK 0x7
408#define RING_PORT_ID_SHIFT 3408#define RING_PORT_ID_SHIFT 3
409#define RING_PORT_ID_MASK 0x7409#define RING_PORT_ID_MASK 0x7
410#define RING_IGNORE_STATUS (1 << 6)410#define RING_IGNORE_STATUS (1 << 6)
@@ -712,6 +712,9 @@ struct bcm_sysport_tx_ring { · 301 unmodified lines
712 struct bcm_sysport_priv *priv; /* private context backpointer */712 struct bcm_sysport_priv *priv; /* private context backpointer */
713 unsigned long packets; /* packets statistics */713 unsigned long packets; /* packets statistics */
714 unsigned long bytes; /* bytes statistics */714 unsigned long bytes; /* bytes statistics */
715 unsigned int switch_queue; /* switch port queue number */
716 unsigned int switch_port; /* switch port queue number */
717 bool inspect; /* inspect switch port and queue */
715};718};
716 719
717/* Driver private structure */720/* Driver private structure */
@@ -765,5 +768,12 @@ struct bcm_sysport_priv { · 47 unmodified lines
765 768
766 /* For atomic update generic 64bit value on 32bit Machine */769 /* For atomic update generic 64bit value on 32bit Machine */
767 struct u64_stats_sync syncp;770 struct u64_stats_sync syncp;
771
772 /* map information between switch port queues and local queues */
773 struct notifier_block dsa_notifier;
774 unsigned int per_port_num_tx_queues;
775 unsigned long queue_bitmap;
776 struct bcm_sysport_tx_ring *ring_map[DSA_MAX_PORTS * 8];
777
768};778};
769#endif /* __BCM_SYSPORT_H */779#endif /* __BCM_SYSPORT_H */
drivers/net/ethernet/broadcom/bgmac-bcma.c+7−1
@@ -184,13 +184,19 @@ static int bgmac_probe(struct bcma_device *core) · 183 unmodified lines
184 184
185 if (!bgmac_is_bcm4707_family(core) &&185 if (!bgmac_is_bcm4707_family(core) &&
186 !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {186 !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
187 struct phy_device *phydev;
188
187 mii_bus = bcma_mdio_mii_register(bgmac);189 mii_bus = bcma_mdio_mii_register(bgmac);
188 if (IS_ERR(mii_bus)) {190 if (IS_ERR(mii_bus)) {
189 err = PTR_ERR(mii_bus);191 err = PTR_ERR(mii_bus);
190 goto err;192 goto err;
191 }193 }
192
193 bgmac->mii_bus = mii_bus;194 bgmac->mii_bus = mii_bus;
195
196 phydev = mdiobus_get_phy(bgmac->mii_bus, bgmac->phyaddr);
197 if (ci->id == BCMA_CHIP_ID_BCM53573 && phydev &&
198 (phydev->drv->phy_id & phydev->drv->phy_id_mask) == PHY_ID_BCM54210E)
199 phydev->dev_flags |= PHY_BRCM_EN_MASTER_MODE;
194 }200 }
195 201
196 if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {202 if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
drivers/net/ethernet/broadcom/bgmac-platform.c+1−0
@@ -131,6 +131,7 @@ static void bgmac_nicpm_speed_set(struct net_device *net_dev) · 130 unmodified lines
131 switch (bgmac->net_dev->phydev->speed) {131 switch (bgmac->net_dev->phydev->speed) {
132 default:132 default:
133 netdev_err(net_dev, "Unsupported speed. Defaulting to 1000Mb\n");133 netdev_err(net_dev, "Unsupported speed. Defaulting to 1000Mb\n");
134 /* fall through */
134 case SPEED_1000:135 case SPEED_1000:
135 val |= NICPM_IOMUX_CTRL_SPD_1000M << NICPM_IOMUX_CTRL_SPD_SHIFT;136 val |= NICPM_IOMUX_CTRL_SPD_1000M << NICPM_IOMUX_CTRL_SPD_SHIFT;
136 break;137 break;
drivers/net/ethernet/broadcom/bgmac.c+16−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/bcm47xx_nvram.h>15#include <linux/bcm47xx_nvram.h>
16#include <linux/phy.h>16#include <linux/phy.h>
17#include <linux/phy_fixed.h>17#include <linux/phy_fixed.h>
18#include <net/dsa.h>
18#include "bgmac.h"19#include "bgmac.h"
19 20
20static bool bgmac_wait_value(struct bgmac *bgmac, u16 reg, u32 mask,21static bool bgmac_wait_value(struct bgmac *bgmac, u16 reg, u32 mask,
@@ -127,6 +128,8 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring, · 106 unmodified lines
127 dma_desc->ctl1 = cpu_to_le32(ctl1);128 dma_desc->ctl1 = cpu_to_le32(ctl1);
128}129}
129 130
131#define ENET_BRCM_TAG_LEN 4
132
130static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,133static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
131 struct bgmac_dma_ring *ring,134 struct bgmac_dma_ring *ring,
132 struct sk_buff *skb)135 struct sk_buff *skb)
@@ -139,6 +142,18 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, · 6 unmodified lines
139 u32 flags;142 u32 flags;
140 int i;143 int i;
141 144
145 /* The Ethernet switch we are interfaced with needs packets to be at
146 * least 64 bytes (including FCS) otherwise they will be discarded when
147 * they enter the switch port logic. When Broadcom tags are enabled, we
148 * need to make sure that packets are at least 68 bytes
149 * (including FCS and tag) because the length verification is done after
150 * the Broadcom tag is stripped off the ingress packet.
151 */
152 if (netdev_uses_dsa(net_dev)) {
153 if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN))
154 goto err_stats;
155 }
156
142 if (skb->len > BGMAC_DESC_CTL1_LEN) {157 if (skb->len > BGMAC_DESC_CTL1_LEN) {
143 netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);158 netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
144 goto err_drop;159 goto err_drop;
@@ -225,6 +240,7 @@ err_dma_head: · 80 unmodified lines
225 240
226err_drop:241err_drop:
227 dev_kfree_skb(skb);242 dev_kfree_skb(skb);
243err_stats:
228 net_dev->stats.tx_dropped++;244 net_dev->stats.tx_dropped++;
229 net_dev->stats.tx_errors++;245 net_dev->stats.tx_errors++;
230 return NETDEV_TX_OK;246 return NETDEV_TX_OK;
drivers/net/ethernet/broadcom/bnx2.c+1−3
@@ -8462,10 +8462,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 8461 unmodified lines
8462 bnx2_set_default_link(bp);8462 bnx2_set_default_link(bp);
8463 bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;8463 bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;
8464 8464
8465 init_timer(&bp->timer);8465 setup_timer(&bp->timer, bnx2_timer, (unsigned long)bp);
8466 bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL);8466 bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL);
8467 bp->timer.data = (unsigned long) bp;
8468 bp->timer.function = bnx2_timer;
8469 8467
8470#ifdef BCM_CNIC8468#ifdef BCM_CNIC
8471 if (bnx2_shmem_rd(bp, BNX2_ISCSI_INITIATOR) & BNX2_ISCSI_INITIATOR_EN)8469 if (bnx2_shmem_rd(bp, BNX2_ISCSI_INITIATOR) & BNX2_ISCSI_INITIATOR_EN)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+1−1
@@ -4289,7 +4289,7 @@ int __bnx2x_setup_tc(struct net_device *dev, enum tc_setup_type type, · 4288 unmodified lines
4289{4289{
4290 struct tc_mqprio_qopt *mqprio = type_data;4290 struct tc_mqprio_qopt *mqprio = type_data;
4291 4291
4292 if (type != TC_SETUP_MQPRIO)4292 if (type != TC_SETUP_QDISC_MQPRIO)
4293 return -EOPNOTSUPP;4293 return -EOPNOTSUPP;
4294 4294
4295 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;4295 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+11−6
@@ -9332,7 +9332,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link) · 9331 unmodified lines
9332 /* Schedule the rx_mode command */9332 /* Schedule the rx_mode command */
9333 if (test_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state))9333 if (test_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state))
9334 set_bit(BNX2X_FILTER_RX_MODE_SCHED, &bp->sp_state);9334 set_bit(BNX2X_FILTER_RX_MODE_SCHED, &bp->sp_state);
9335 else9335 else if (bp->slowpath)
9336 bnx2x_set_storm_rx_mode(bp);9336 bnx2x_set_storm_rx_mode(bp);
9337 9337
9338 /* Cleanup multicast configuration */9338 /* Cleanup multicast configuration */
@@ -10271,8 +10271,15 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work) · 932 unmodified lines
10271 smp_mb();10271 smp_mb();
10272 10272
10273 bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);10273 bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
10274 bnx2x_nic_load(bp, LOAD_NORMAL);10274 /* When ret value shows failure of allocation failure,
10275 10275 * the nic is rebooted again. If open still fails, a error
10276 * message to notify the user.
10277 */
10278 if (bnx2x_nic_load(bp, LOAD_NORMAL) == -ENOMEM) {
10279 bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
10280 if (bnx2x_nic_load(bp, LOAD_NORMAL))
10281 BNX2X_ERR("Open the NIC fails again!\n");
10282 }
10276 rtnl_unlock();10283 rtnl_unlock();
10277 return;10284 return;
10278 }10285 }
@@ -12414,10 +12421,8 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 2135 unmodified lines
12414 12421
12415 bp->current_interval = CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ;12422 bp->current_interval = CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ;
12416 12423
12417 init_timer(&bp->timer);12424 setup_timer(&bp->timer, bnx2x_timer, (unsigned long)bp);
12418 bp->timer.expires = jiffies + bp->current_interval;12425 bp->timer.expires = jiffies + bp->current_interval;
12419 bp->timer.data = (unsigned long) bp;
12420 bp->timer.function = bnx2x_timer;
12421 12426
12422 if (SHMEM2_HAS(bp, dcbx_lldp_params_offset) &&12427 if (SHMEM2_HAS(bp, dcbx_lldp_params_offset) &&
12423 SHMEM2_HAS(bp, dcbx_lldp_dcbx_stat_offset) &&12428 SHMEM2_HAS(bp, dcbx_lldp_dcbx_stat_offset) &&
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+1−6
@@ -1074,11 +1074,6 @@ static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf) · 1073 unmodified lines
1074 }1074 }
1075}1075}
1076 1076
1077static int bnx2x_ari_enabled(struct pci_dev *dev)
1078{
1079 return dev->bus->self && dev->bus->self->ari_enabled;
1080}
1081
1082static int1077static int
1083bnx2x_get_vf_igu_cam_info(struct bnx2x *bp)1078bnx2x_get_vf_igu_cam_info(struct bnx2x *bp)
1084{1079{
@@ -1212,7 +1207,7 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, · 127 unmodified lines
1212 1207
1213 err = -EIO;1208 err = -EIO;
1214 /* verify ari is enabled */1209 /* verify ari is enabled */
1215 if (!bnx2x_ari_enabled(bp->pdev)) {1210 if (!pci_ari_enabled(bp->pdev->bus)) {
1216 BNX2X_ERR("ARI not supported (check pci bridge ARI forwarding), SRIOV can not be enabled\n");1211 BNX2X_ERR("ARI not supported (check pci bridge ARI forwarding), SRIOV can not be enabled\n");
1217 return 0;1212 return 0;
1218 }1213 }
drivers/net/ethernet/broadcom/bnxt/Makefile+2−1
@@ -1,3 +1,4 @@
1obj-$(CONFIG_BNXT) += bnxt_en.o1obj-$(CONFIG_BNXT) += bnxt_en.o
2 2
3bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o bnxt_tc.o3bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o bnxt_devlink.o
4bnxt_en-$(CONFIG_BNXT_FLOWER_OFFLOAD) += bnxt_tc.o
drivers/net/ethernet/broadcom/bnxt/bnxt.c+138−93
@@ -61,6 +61,7 @@ · 60 unmodified lines
61#include "bnxt_xdp.h"61#include "bnxt_xdp.h"
62#include "bnxt_vfr.h"62#include "bnxt_vfr.h"
63#include "bnxt_tc.h"63#include "bnxt_tc.h"
64#include "bnxt_devlink.h"
64 65
65#define BNXT_TX_TIMEOUT (5 * HZ)66#define BNXT_TX_TIMEOUT (5 * HZ)
66 67
@@ -107,9 +108,11 @@ enum board_idx { · 40 unmodified lines
107 BCM57452,108 BCM57452,
108 BCM57454,109 BCM57454,
109 BCM58802,110 BCM58802,
111 BCM58804,
110 BCM58808,112 BCM58808,
111 NETXTREME_E_VF,113 NETXTREME_E_VF,
112 NETXTREME_C_VF,114 NETXTREME_C_VF,
115 NETXTREME_S_VF,
113};116};
114 117
115/* indexed by enum above */118/* indexed by enum above */
@@ -145,9 +148,11 @@ static const struct { · 29 unmodified lines
145 [BCM57452] = { "Broadcom BCM57452 NetXtreme-E 10Gb/25Gb/40Gb/50Gb Ethernet" },148 [BCM57452] = { "Broadcom BCM57452 NetXtreme-E 10Gb/25Gb/40Gb/50Gb Ethernet" },
146 [BCM57454] = { "Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet" },149 [BCM57454] = { "Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet" },
147 [BCM58802] = { "Broadcom BCM58802 NetXtreme-S 10Gb/25Gb/40Gb/50Gb Ethernet" },150 [BCM58802] = { "Broadcom BCM58802 NetXtreme-S 10Gb/25Gb/40Gb/50Gb Ethernet" },
151 [BCM58804] = { "Broadcom BCM58804 NetXtreme-S 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet" },
148 [BCM58808] = { "Broadcom BCM58808 NetXtreme-S 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet" },152 [BCM58808] = { "Broadcom BCM58808 NetXtreme-S 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet" },
149 [NETXTREME_E_VF] = { "Broadcom NetXtreme-E Ethernet Virtual Function" },153 [NETXTREME_E_VF] = { "Broadcom NetXtreme-E Ethernet Virtual Function" },
150 [NETXTREME_C_VF] = { "Broadcom NetXtreme-C Ethernet Virtual Function" },154 [NETXTREME_C_VF] = { "Broadcom NetXtreme-C Ethernet Virtual Function" },
155 [NETXTREME_S_VF] = { "Broadcom NetXtreme-S Ethernet Virtual Function" },
151};156};
152 157
153static const struct pci_device_id bnxt_pci_tbl[] = {158static const struct pci_device_id bnxt_pci_tbl[] = {
@@ -185,6 +190,7 @@ static const struct pci_device_id bnxt_pci_tbl[] = { · 31 unmodified lines
185 { PCI_VDEVICE(BROADCOM, 0x16f0), .driver_data = BCM58808 },190 { PCI_VDEVICE(BROADCOM, 0x16f0), .driver_data = BCM58808 },
186 { PCI_VDEVICE(BROADCOM, 0x16f1), .driver_data = BCM57452 },191 { PCI_VDEVICE(BROADCOM, 0x16f1), .driver_data = BCM57452 },
187 { PCI_VDEVICE(BROADCOM, 0xd802), .driver_data = BCM58802 },192 { PCI_VDEVICE(BROADCOM, 0xd802), .driver_data = BCM58802 },
193 { PCI_VDEVICE(BROADCOM, 0xd804), .driver_data = BCM58804 },
188#ifdef CONFIG_BNXT_SRIOV194#ifdef CONFIG_BNXT_SRIOV
189 { PCI_VDEVICE(BROADCOM, 0x1606), .driver_data = NETXTREME_E_VF },195 { PCI_VDEVICE(BROADCOM, 0x1606), .driver_data = NETXTREME_E_VF },
190 { PCI_VDEVICE(BROADCOM, 0x1609), .driver_data = NETXTREME_E_VF },196 { PCI_VDEVICE(BROADCOM, 0x1609), .driver_data = NETXTREME_E_VF },
@@ -194,6 +200,7 @@ static const struct pci_device_id bnxt_pci_tbl[] = { · 3 unmodified lines
194 { PCI_VDEVICE(BROADCOM, 0x16dc), .driver_data = NETXTREME_E_VF },200 { PCI_VDEVICE(BROADCOM, 0x16dc), .driver_data = NETXTREME_E_VF },
195 { PCI_VDEVICE(BROADCOM, 0x16e1), .driver_data = NETXTREME_C_VF },201 { PCI_VDEVICE(BROADCOM, 0x16e1), .driver_data = NETXTREME_C_VF },
196 { PCI_VDEVICE(BROADCOM, 0x16e5), .driver_data = NETXTREME_C_VF },202 { PCI_VDEVICE(BROADCOM, 0x16e5), .driver_data = NETXTREME_C_VF },
203 { PCI_VDEVICE(BROADCOM, 0xd800), .driver_data = NETXTREME_S_VF },
197#endif204#endif
198 { 0 }205 { 0 }
199};206};
@@ -218,7 +225,8 @@ static struct workqueue_struct *bnxt_pf_wq; · 18 unmodified lines
218 225
219static bool bnxt_vf_pciid(enum board_idx idx)226static bool bnxt_vf_pciid(enum board_idx idx)
220{227{
221 return (idx == NETXTREME_C_VF || idx == NETXTREME_E_VF);228 return (idx == NETXTREME_C_VF || idx == NETXTREME_E_VF ||
229 idx == NETXTREME_S_VF);
222}230}
223 231
224#define DB_CP_REARM_FLAGS (DB_KEY_CP | DB_IDX_VALID)232#define DB_CP_REARM_FLAGS (DB_KEY_CP | DB_IDX_VALID)
@@ -1509,7 +1517,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons, · 1284 unmodified lines
1509 (struct rx_tpa_end_cmp *)rxcmp,1517 (struct rx_tpa_end_cmp *)rxcmp,
1510 (struct rx_tpa_end_cmp_ext *)rxcmp1, event);1518 (struct rx_tpa_end_cmp_ext *)rxcmp1, event);
1511 1519
1512 if (unlikely(IS_ERR(skb)))1520 if (IS_ERR(skb))
1513 return -EBUSY;1521 return -EBUSY;
1514 1522
1515 rc = -ENOMEM;1523 rc = -ENOMEM;
@@ -2827,7 +2835,8 @@ int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode) · 1311 unmodified lines
2827 if (page_mode) {2835 if (page_mode) {
2828 if (bp->dev->mtu > BNXT_MAX_PAGE_MODE_MTU)2836 if (bp->dev->mtu > BNXT_MAX_PAGE_MODE_MTU)
2829 return -EOPNOTSUPP;2837 return -EOPNOTSUPP;
2830 bp->dev->max_mtu = BNXT_MAX_PAGE_MODE_MTU;2838 bp->dev->max_mtu =
2839 min_t(u16, bp->max_mtu, BNXT_MAX_PAGE_MODE_MTU);
2831 bp->flags &= ~BNXT_FLAG_AGG_RINGS;2840 bp->flags &= ~BNXT_FLAG_AGG_RINGS;
2832 bp->flags |= BNXT_FLAG_NO_AGG_RINGS | BNXT_FLAG_RX_PAGE_MODE;2841 bp->flags |= BNXT_FLAG_NO_AGG_RINGS | BNXT_FLAG_RX_PAGE_MODE;
2833 bp->dev->hw_features &= ~NETIF_F_LRO;2842 bp->dev->hw_features &= ~NETIF_F_LRO;
@@ -2835,7 +2844,7 @@ int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode) · 1 unmodified line
2835 bp->rx_dir = DMA_BIDIRECTIONAL;2844 bp->rx_dir = DMA_BIDIRECTIONAL;
2836 bp->rx_skb_func = bnxt_rx_page_skb;2845 bp->rx_skb_func = bnxt_rx_page_skb;
2837 } else {2846 } else {
2838 bp->dev->max_mtu = BNXT_MAX_MTU;2847 bp->dev->max_mtu = bp->max_mtu;
2839 bp->flags &= ~BNXT_FLAG_RX_PAGE_MODE;2848 bp->flags &= ~BNXT_FLAG_RX_PAGE_MODE;
2840 bp->rx_dir = DMA_FROM_DEVICE;2849 bp->rx_dir = DMA_FROM_DEVICE;
2841 bp->rx_skb_func = bnxt_rx_skb;2850 bp->rx_skb_func = bnxt_rx_skb;
@@ -4528,19 +4537,46 @@ static int bnxt_hwrm_check_tx_rings(struct bnxt *bp, int tx_rings) · 1686 unmodified lines
4528 return 0;4537 return 0;
4529}4538}
4530 4539
4531static void bnxt_hwrm_set_coal_params(struct bnxt *bp, u32 max_bufs,4540static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
4532 u32 buf_tmrs, u16 flags,
4533 struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req)4541 struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req)
4534{4542{
4543 u16 val, tmr, max, flags;
4544
4545 max = hw_coal->bufs_per_record * 128;
4546 if (hw_coal->budget)
4547 max = hw_coal->bufs_per_record * hw_coal->budget;
4548
4549 val = clamp_t(u16, hw_coal->coal_bufs, 1, max);
4550 req->num_cmpl_aggr_int = cpu_to_le16(val);
4551
4552 /* This is a 6-bit value and must not be 0, or we'll get non stop IRQ */
4553 val = min_t(u16, val, 63);
4554 req->num_cmpl_dma_aggr = cpu_to_le16(val);
4555
4556 /* This is a 6-bit value and must not be 0, or we'll get non stop IRQ */
4557 val = clamp_t(u16, hw_coal->coal_bufs_irq, 1, 63);
4558 req->num_cmpl_dma_aggr_during_int = cpu_to_le16(val);
4559
4560 tmr = BNXT_USEC_TO_COAL_TIMER(hw_coal->coal_ticks);
4561 tmr = max_t(u16, tmr, 1);
4562 req->int_lat_tmr_max = cpu_to_le16(tmr);
4563
4564 /* min timer set to 1/2 of interrupt timer */
4565 val = tmr / 2;
4566 req->int_lat_tmr_min = cpu_to_le16(val);
4567
4568 /* buf timer set to 1/4 of interrupt timer */
4569 val = max_t(u16, tmr / 4, 1);
4570 req->cmpl_aggr_dma_tmr = cpu_to_le16(val);
4571
4572 tmr = BNXT_USEC_TO_COAL_TIMER(hw_coal->coal_ticks_irq);
4573 tmr = max_t(u16, tmr, 1);
4574 req->cmpl_aggr_dma_tmr_during_int = cpu_to_le16(tmr);
4575
4576 flags = RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
4577 if (hw_coal->idle_thresh && hw_coal->coal_ticks < hw_coal->idle_thresh)
4578 flags |= RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_RING_IDLE;
4535 req->flags = cpu_to_le16(flags);4579 req->flags = cpu_to_le16(flags);
4536 req->num_cmpl_dma_aggr = cpu_to_le16((u16)max_bufs);
4537 req->num_cmpl_dma_aggr_during_int = cpu_to_le16(max_bufs >> 16);
4538 req->cmpl_aggr_dma_tmr = cpu_to_le16((u16)buf_tmrs);
4539 req->cmpl_aggr_dma_tmr_during_int = cpu_to_le16(buf_tmrs >> 16);
4540 /* Minimum time between 2 interrupts set to buf_tmr x 2 */
4541 req->int_lat_tmr_min = cpu_to_le16((u16)buf_tmrs * 2);
4542 req->int_lat_tmr_max = cpu_to_le16((u16)buf_tmrs * 4);
4543 req->num_cmpl_aggr_int = cpu_to_le16((u16)max_bufs * 4);
4544}4580}
4545 4581
4546int bnxt_hwrm_set_coal(struct bnxt *bp)4582int bnxt_hwrm_set_coal(struct bnxt *bp)
@@ -4548,51 +4584,14 @@ int bnxt_hwrm_set_coal(struct bnxt *bp) · 1 unmodified line
4548 int i, rc = 0;4584 int i, rc = 0;
4549 struct hwrm_ring_cmpl_ring_cfg_aggint_params_input req_rx = {0},4585 struct hwrm_ring_cmpl_ring_cfg_aggint_params_input req_rx = {0},
4550 req_tx = {0}, *req;4586 req_tx = {0}, *req;
4551 u16 max_buf, max_buf_irq;
4552 u16 buf_tmr, buf_tmr_irq;
4553 u32 flags;
4554 4587
4555 bnxt_hwrm_cmd_hdr_init(bp, &req_rx,4588 bnxt_hwrm_cmd_hdr_init(bp, &req_rx,
4556 HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS, -1, -1);4589 HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS, -1, -1);
4557 bnxt_hwrm_cmd_hdr_init(bp, &req_tx,4590 bnxt_hwrm_cmd_hdr_init(bp, &req_tx,
4558 HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS, -1, -1);4591 HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS, -1, -1);
4559 4592
4560 /* Each rx completion (2 records) should be DMAed immediately.4593 bnxt_hwrm_set_coal_params(&bp->rx_coal, &req_rx);
4561 * DMA 1/4 of the completion buffers at a time.4594 bnxt_hwrm_set_coal_params(&bp->tx_coal, &req_tx);
4562 */
4563 max_buf = min_t(u16, bp->rx_coal_bufs / 4, 2);
4564 /* max_buf must not be zero */
4565 max_buf = clamp_t(u16, max_buf, 1, 63);
4566 max_buf_irq = clamp_t(u16, bp->rx_coal_bufs_irq, 1, 63);
4567 buf_tmr = BNXT_USEC_TO_COAL_TIMER(bp->rx_coal_ticks);
4568 /* buf timer set to 1/4 of interrupt timer */
4569 buf_tmr = max_t(u16, buf_tmr / 4, 1);
4570 buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(bp->rx_coal_ticks_irq);
4571 buf_tmr_irq = max_t(u16, buf_tmr_irq, 1);
4572
4573 flags = RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
4574
4575 /* RING_IDLE generates more IRQs for lower latency. Enable it only
4576 * if coal_ticks is less than 25 us.
4577 */
4578 if (bp->rx_coal_ticks < 25)
4579 flags |= RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_RING_IDLE;
4580
4581 bnxt_hwrm_set_coal_params(bp, max_buf_irq << 16 | max_buf,
4582 buf_tmr_irq << 16 | buf_tmr, flags, &req_rx);
4583
4584 /* max_buf must not be zero */
4585 max_buf = clamp_t(u16, bp->tx_coal_bufs, 1, 63);
4586 max_buf_irq = clamp_t(u16, bp->tx_coal_bufs_irq, 1, 63);
4587 buf_tmr = BNXT_USEC_TO_COAL_TIMER(bp->tx_coal_ticks);
4588 /* buf timer set to 1/4 of interrupt timer */
4589 buf_tmr = max_t(u16, buf_tmr / 4, 1);
4590 buf_tmr_irq = BNXT_USEC_TO_COAL_TIMER(bp->tx_coal_ticks_irq);
4591 buf_tmr_irq = max_t(u16, buf_tmr_irq, 1);
4592
4593 flags = RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
4594 bnxt_hwrm_set_coal_params(bp, max_buf_irq << 16 | max_buf,
4595 buf_tmr_irq << 16 | buf_tmr, flags, &req_tx);
4596 4595
4597 mutex_lock(&bp->hwrm_cmd_lock);4596 mutex_lock(&bp->hwrm_cmd_lock);
4598 for (i = 0; i < bp->cp_nr_rings; i++) {4597 for (i = 0; i < bp->cp_nr_rings; i++) {
@@ -4724,6 +4723,10 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp) · 125 unmodified lines
4724 else4723 else
4725 bp->br_mode = BRIDGE_MODE_UNDEF;4724 bp->br_mode = BRIDGE_MODE_UNDEF;
4726 4725
4726 bp->max_mtu = le16_to_cpu(resp->max_mtu_configured);
4727 if (!bp->max_mtu)
4728 bp->max_mtu = BNXT_MAX_MTU;
4729
4727func_qcfg_exit:4730func_qcfg_exit:
4728 mutex_unlock(&bp->hwrm_cmd_lock);4731 mutex_unlock(&bp->hwrm_cmd_lock);
4729 return rc;4732 return rc;
@@ -4884,9 +4887,9 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp) · 154 unmodified lines
4884 resp->hwrm_intf_upd);4887 resp->hwrm_intf_upd);
4885 netdev_warn(bp->dev, "Please update firmware with HWRM interface 1.0.0 or newer.\n");4888 netdev_warn(bp->dev, "Please update firmware with HWRM interface 1.0.0 or newer.\n");
4886 }4889 }
4887 snprintf(bp->fw_ver_str, BC_HWRM_STR_LEN, "%d.%d.%d/%d.%d.%d",4890 snprintf(bp->fw_ver_str, BC_HWRM_STR_LEN, "%d.%d.%d.%d",
4888 resp->hwrm_fw_maj, resp->hwrm_fw_min, resp->hwrm_fw_bld,4891 resp->hwrm_fw_maj, resp->hwrm_fw_min, resp->hwrm_fw_bld,
4889 resp->hwrm_intf_maj, resp->hwrm_intf_min, resp->hwrm_intf_upd);4892 resp->hwrm_fw_rsvd);
4890 4893
4891 bp->hwrm_cmd_timeout = le16_to_cpu(resp->def_req_timeout);4894 bp->hwrm_cmd_timeout = le16_to_cpu(resp->def_req_timeout);
4892 if (!bp->hwrm_cmd_timeout)4895 if (!bp->hwrm_cmd_timeout)
@@ -4912,16 +4915,14 @@ hwrm_ver_get_exit: · 19 unmodified lines
4912 4915
4913int bnxt_hwrm_fw_set_time(struct bnxt *bp)4916int bnxt_hwrm_fw_set_time(struct bnxt *bp)
4914{4917{
4915#if IS_ENABLED(CONFIG_RTC_LIB)
4916 struct hwrm_fw_set_time_input req = {0};4918 struct hwrm_fw_set_time_input req = {0};
4917 struct rtc_time tm;4919 struct tm tm;
4918 struct timeval tv;4920 time64_t now = ktime_get_real_seconds();
4919 4921
4920 if (bp->hwrm_spec_code < 0x10400)4922 if (bp->hwrm_spec_code < 0x10400)
4921 return -EOPNOTSUPP;4923 return -EOPNOTSUPP;
4922 4924
4923 do_gettimeofday(&tv);4925 time64_to_tm(now, 0, &tm);
4924 rtc_time_to_tm(tv.tv_sec, &tm);
4925 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_SET_TIME, -1, -1);4926 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_SET_TIME, -1, -1);
4926 req.year = cpu_to_le16(1900 + tm.tm_year);4927 req.year = cpu_to_le16(1900 + tm.tm_year);
4927 req.month = 1 + tm.tm_mon;4928 req.month = 1 + tm.tm_mon;
@@ -4930,9 +4931,6 @@ int bnxt_hwrm_fw_set_time(struct bnxt *bp) · 2 unmodified lines
4930 req.minute = tm.tm_min;4931 req.minute = tm.tm_min;
4931 req.second = tm.tm_sec;4932 req.second = tm.tm_sec;
4932 return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);4933 return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
4933#else
4934 return -EOPNOTSUPP;
4935#endif
4936}4934}
4937 4935
4938static int bnxt_hwrm_port_qstats(struct bnxt *bp)4936static int bnxt_hwrm_port_qstats(struct bnxt *bp)
@@ -6980,6 +6978,11 @@ static void bnxt_timer(unsigned long data) · 2041 unmodified lines
6980 set_bit(BNXT_PERIODIC_STATS_SP_EVENT, &bp->sp_event);6978 set_bit(BNXT_PERIODIC_STATS_SP_EVENT, &bp->sp_event);
6981 bnxt_queue_sp_work(bp);6979 bnxt_queue_sp_work(bp);
6982 }6980 }
6981
6982 if (bnxt_tc_flower_enabled(bp)) {
6983 set_bit(BNXT_FLOW_STATS_SP_EVENT, &bp->sp_event);
6984 bnxt_queue_sp_work(bp);
6985 }
6983bnxt_restart_timer:6986bnxt_restart_timer:
6984 mod_timer(&bp->timer, jiffies + bp->current_interval);6987 mod_timer(&bp->timer, jiffies + bp->current_interval);
6985}6988}
@@ -7070,6 +7073,10 @@ static void bnxt_sp_task(struct work_struct *work) · 84 unmodified lines
7070 bnxt_get_port_module_status(bp);7073 bnxt_get_port_module_status(bp);
7071 mutex_unlock(&bp->link_lock);7074 mutex_unlock(&bp->link_lock);
7072 }7075 }
7076
7077 if (test_and_clear_bit(BNXT_FLOW_STATS_SP_EVENT, &bp->sp_event))
7078 bnxt_tc_flow_stats_work(bp);
7079
7073 /* These functions below will clear BNXT_STATE_IN_SP_TASK. They7080 /* These functions below will clear BNXT_STATE_IN_SP_TASK. They
7074 * must be the last functions to be called before exiting.7081 * must be the last functions to be called before exiting.
7075 */7082 */
@@ -7133,6 +7140,32 @@ static void bnxt_cleanup_pci(struct bnxt *bp) · 57 unmodified lines
7133 pci_disable_device(bp->pdev);7140 pci_disable_device(bp->pdev);
7134}7141}
7135 7142
7143static void bnxt_init_dflt_coal(struct bnxt *bp)
7144{
7145 struct bnxt_coal *coal;
7146
7147 /* Tick values in micro seconds.
7148 * 1 coal_buf x bufs_per_record = 1 completion record.
7149 */
7150 coal = &bp->rx_coal;
7151 coal->coal_ticks = 14;
7152 coal->coal_bufs = 30;
7153 coal->coal_ticks_irq = 1;
7154 coal->coal_bufs_irq = 2;
7155 coal->idle_thresh = 25;
7156 coal->bufs_per_record = 2;
7157 coal->budget = 64; /* NAPI budget */
7158
7159 coal = &bp->tx_coal;
7160 coal->coal_ticks = 28;
7161 coal->coal_bufs = 30;
7162 coal->coal_ticks_irq = 2;
7163 coal->coal_bufs_irq = 2;
7164 coal->bufs_per_record = 1;
7165
7166 bp->stats_coal_ticks = BNXT_DEF_STATS_COAL_TICKS;
7167}
7168
7136static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)7169static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
7137{7170{
7138 int rc;7171 int rc;
@@ -7201,22 +7234,9 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) · 62 unmodified lines
7201 bp->rx_ring_size = BNXT_DEFAULT_RX_RING_SIZE;7234 bp->rx_ring_size = BNXT_DEFAULT_RX_RING_SIZE;
7202 bp->tx_ring_size = BNXT_DEFAULT_TX_RING_SIZE;7235 bp->tx_ring_size = BNXT_DEFAULT_TX_RING_SIZE;
7203 7236
7204 /* tick values in micro seconds */7237 bnxt_init_dflt_coal(bp);
7205 bp->rx_coal_ticks = 12;
7206 bp->rx_coal_bufs = 30;
7207 bp->rx_coal_ticks_irq = 1;
7208 bp->rx_coal_bufs_irq = 2;
7209 7238
7210 bp->tx_coal_ticks = 25;7239 setup_timer(&bp->timer, bnxt_timer, (unsigned long)bp);
7211 bp->tx_coal_bufs = 30;
7212 bp->tx_coal_ticks_irq = 2;
7213 bp->tx_coal_bufs_irq = 2;
7214
7215 bp->stats_coal_ticks = BNXT_DEF_STATS_COAL_TICKS;
7216
7217 init_timer(&bp->timer);
7218 bp->timer.data = (unsigned long)bp;
7219 bp->timer.function = bnxt_timer;
7220 bp->current_interval = BNXT_TIMER_INTERVAL;7240 bp->current_interval = BNXT_TIMER_INTERVAL;
7221 7241
7222 clear_bit(BNXT_STATE_OPEN, &bp->state);7242 clear_bit(BNXT_STATE_OPEN, &bp->state);
@@ -7243,13 +7263,13 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p) · 20 unmodified lines
7243 if (!is_valid_ether_addr(addr->sa_data))7263 if (!is_valid_ether_addr(addr->sa_data))
7244 return -EADDRNOTAVAIL;7264 return -EADDRNOTAVAIL;
7245 7265
7266 if (ether_addr_equal(addr->sa_data, dev->dev_addr))
7267 return 0;
7268
7246 rc = bnxt_approve_mac(bp, addr->sa_data);7269 rc = bnxt_approve_mac(bp, addr->sa_data);
7247 if (rc)7270 if (rc)
7248 return rc;7271 return rc;
7249 7272
7250 if (ether_addr_equal(addr->sa_data, dev->dev_addr))
7251 return 0;
7252
7253 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);7273 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
7254 if (netif_running(dev)) {7274 if (netif_running(dev)) {
7255 bnxt_close_nic(bp, false, false);7275 bnxt_close_nic(bp, false, false);
@@ -7321,24 +7341,49 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc) · 65 unmodified lines
7321 return 0;7341 return 0;
7322}7342}
7323 7343
7324static int bnxt_setup_flower(struct net_device *dev,7344static int bnxt_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
7325 struct tc_cls_flower_offload *cls_flower)7345 void *cb_priv)
7346{
7347 struct bnxt *bp = cb_priv;
7348
7349 if (!bnxt_tc_flower_enabled(bp) || !tc_can_offload(bp->dev))
7350 return -EOPNOTSUPP;
7351
7352 switch (type) {
7353 case TC_SETUP_CLSFLOWER:
7354 return bnxt_tc_setup_flower(bp, bp->pf.fw_fid, type_data);
7355 default:
7356 return -EOPNOTSUPP;
7357 }
7358}
7359
7360static int bnxt_setup_tc_block(struct net_device *dev,
7361 struct tc_block_offload *f)
7326{7362{
7327 struct bnxt *bp = netdev_priv(dev);7363 struct bnxt *bp = netdev_priv(dev);
7328 7364
7329 if (BNXT_VF(bp))7365 if (f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
7330 return -EOPNOTSUPP;7366 return -EOPNOTSUPP;
7331 7367
7332 return bnxt_tc_setup_flower(bp, bp->pf.fw_fid, cls_flower);7368 switch (f->command) {
7369 case TC_BLOCK_BIND:
7370 return tcf_block_cb_register(f->block, bnxt_setup_tc_block_cb,
7371 bp, bp);
7372 case TC_BLOCK_UNBIND:
7373 tcf_block_cb_unregister(f->block, bnxt_setup_tc_block_cb, bp);
7374 return 0;
7375 default:
7376 return -EOPNOTSUPP;
7377 }
7333}7378}
7334 7379
7335static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,7380static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,
7336 void *type_data)7381 void *type_data)
7337{7382{
7338 switch (type) {7383 switch (type) {
7339 case TC_SETUP_CLSFLOWER:7384 case TC_SETUP_BLOCK:
7340 return bnxt_setup_flower(dev, type_data);7385 return bnxt_setup_tc_block(dev, type_data);
7341 case TC_SETUP_MQPRIO: {7386 case TC_SETUP_QDISC_MQPRIO: {
7342 struct tc_mqprio_qopt *mqprio = type_data;7387 struct tc_mqprio_qopt *mqprio = type_data;
7343 7388
7344 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;7389 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
@@ -7725,7 +7770,7 @@ static const struct net_device_ops bnxt_netdev_ops = { · 380 unmodified lines
7725#endif7770#endif
7726 .ndo_udp_tunnel_add = bnxt_udp_tunnel_add,7771 .ndo_udp_tunnel_add = bnxt_udp_tunnel_add,
7727 .ndo_udp_tunnel_del = bnxt_udp_tunnel_del,7772 .ndo_udp_tunnel_del = bnxt_udp_tunnel_del,
7728 .ndo_xdp = bnxt_xdp,7773 .ndo_bpf = bnxt_xdp,
7729 .ndo_bridge_getlink = bnxt_bridge_getlink,7774 .ndo_bridge_getlink = bnxt_bridge_getlink,
7730 .ndo_bridge_setlink = bnxt_bridge_setlink,7775 .ndo_bridge_setlink = bnxt_bridge_setlink,
7731 .ndo_get_phys_port_name = bnxt_get_phys_port_name7776 .ndo_get_phys_port_name = bnxt_get_phys_port_name
@@ -8064,10 +8109,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 332 unmodified lines
8064 dev->features |= dev->hw_features | NETIF_F_HIGHDMA;8109 dev->features |= dev->hw_features | NETIF_F_HIGHDMA;
8065 dev->priv_flags |= IFF_UNICAST_FLT;8110 dev->priv_flags |= IFF_UNICAST_FLT;
8066 8111
8067 /* MTU range: 60 - 9500 */
8068 dev->min_mtu = ETH_ZLEN;
8069 dev->max_mtu = BNXT_MAX_MTU;
8070
8071#ifdef CONFIG_BNXT_SRIOV8112#ifdef CONFIG_BNXT_SRIOV
8072 init_waitqueue_head(&bp->sriov_cfg_wait);8113 init_waitqueue_head(&bp->sriov_cfg_wait);
8073 mutex_init(&bp->sriov_lock);8114 mutex_init(&bp->sriov_lock);
@@ -8115,6 +8156,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 41 unmodified lines
8115 bnxt_ethtool_init(bp);8156 bnxt_ethtool_init(bp);
8116 bnxt_dcb_init(bp);8157 bnxt_dcb_init(bp);
8117 8158
8159 /* MTU range: 60 - FW defined max */
8160 dev->min_mtu = ETH_ZLEN;
8161 dev->max_mtu = bp->max_mtu;
8162
8118 rc = bnxt_probe_phy(bp);8163 rc = bnxt_probe_phy(bp);
8119 if (rc)8164 if (rc)
8120 goto init_err_pci_clean;8165 goto init_err_pci_clean;
drivers/net/ethernet/broadcom/bnxt/bnxt.h+40−9
@@ -944,6 +944,22 @@ struct bnxt_test_info { · 943 unmodified lines
944#define BNXT_CAG_REG_LEGACY_INT_STATUS 0x4014944#define BNXT_CAG_REG_LEGACY_INT_STATUS 0x4014
945#define BNXT_CAG_REG_BASE 0x300000945#define BNXT_CAG_REG_BASE 0x300000
946 946
947struct bnxt_coal {
948 u16 coal_ticks;
949 u16 coal_ticks_irq;
950 u16 coal_bufs;
951 u16 coal_bufs_irq;
952 /* RING_IDLE enabled when coal ticks < idle_thresh */
953 u16 idle_thresh;
954 u8 bufs_per_record;
955 u8 budget;
956};
957
958struct bnxt_tc_flow_stats {
959 u64 packets;
960 u64 bytes;
961};
962
947struct bnxt_tc_info {963struct bnxt_tc_info {
948 bool enabled;964 bool enabled;
949 965
@@ -954,12 +970,29 @@ struct bnxt_tc_info { · 4 unmodified lines
954 /* hash table to store L2 keys of TC flows */970 /* hash table to store L2 keys of TC flows */
955 struct rhashtable l2_table;971 struct rhashtable l2_table;
956 struct rhashtable_params l2_ht_params;972 struct rhashtable_params l2_ht_params;
973 /* hash table to store L2 keys for TC tunnel decap */
974 struct rhashtable decap_l2_table;
975 struct rhashtable_params decap_l2_ht_params;
976 /* hash table to store tunnel decap entries */
977 struct rhashtable decap_table;
978 struct rhashtable_params decap_ht_params;
979 /* hash table to store tunnel encap entries */
980 struct rhashtable encap_table;
981 struct rhashtable_params encap_ht_params;
957 982
958 /* lock to atomically add/del an l2 node when a flow is983 /* lock to atomically add/del an l2 node when a flow is
959 * added or deleted.984 * added or deleted.
960 */985 */
961 struct mutex lock;986 struct mutex lock;
962 987
988 /* Fields used for batching stats query */
989 struct rhashtable_iter iter;
990#define BNXT_FLOW_STATS_BATCH_MAX 10
991 struct bnxt_tc_stats_batch {
992 void *flow_node;
993 struct bnxt_tc_flow_stats hw_stats;
994 } stats_batch[BNXT_FLOW_STATS_BATCH_MAX];
995
963 /* Stat counter mask (width) */996 /* Stat counter mask (width) */
964 u64 bytes_mask;997 u64 bytes_mask;
965 u64 packets_mask;998 u64 packets_mask;
@@ -1013,6 +1046,7 @@ struct bnxt { · 47 unmodified lines
1013#define CHIP_NUM_5745X 0xd7301046#define CHIP_NUM_5745X 0xd730
1014 1047
1015#define CHIP_NUM_58802 0xd8021048#define CHIP_NUM_58802 0xd802
1049#define CHIP_NUM_58804 0xd804
1016#define CHIP_NUM_58808 0xd8081050#define CHIP_NUM_58808 0xd808
1017 1051
1018#define BNXT_CHIP_NUM_5730X(chip_num) \1052#define BNXT_CHIP_NUM_5730X(chip_num) \
@@ -1048,6 +1082,7 @@ struct bnxt { · 29 unmodified lines
1048 1082
1049#define BNXT_CHIP_NUM_588XX(chip_num) \1083#define BNXT_CHIP_NUM_588XX(chip_num) \
1050 ((chip_num) == CHIP_NUM_58802 || \1084 ((chip_num) == CHIP_NUM_58802 || \
1085 (chip_num) == CHIP_NUM_58804 || \
1051 (chip_num) == CHIP_NUM_58808)1086 (chip_num) == CHIP_NUM_58808)
1052 1087
1053 struct net_device *dev;1088 struct net_device *dev;
@@ -1170,6 +1205,7 @@ struct bnxt { · 116 unmodified lines
1170 int nr_vnics;1205 int nr_vnics;
1171 u32 rss_hash_cfg;1206 u32 rss_hash_cfg;
1172 1207
1208 u16 max_mtu;
1173 u8 max_tc;1209 u8 max_tc;
1174 u8 max_lltc; /* lossless TCs */1210 u8 max_lltc; /* lossless TCs */
1175 struct bnxt_queue_info q_info[BNXT_MAX_QUEUE];1211 struct bnxt_queue_info q_info[BNXT_MAX_QUEUE];
@@ -1232,14 +1268,8 @@ struct bnxt { · 56 unmodified lines
1232 u8 port_count;1268 u8 port_count;
1233 u16 br_mode;1269 u16 br_mode;
1234 1270
1235 u16 rx_coal_ticks;1271 struct bnxt_coal rx_coal;
1236 u16 rx_coal_ticks_irq;1272 struct bnxt_coal tx_coal;
1237 u16 rx_coal_bufs;
1238 u16 rx_coal_bufs_irq;
1239 u16 tx_coal_ticks;
1240 u16 tx_coal_ticks_irq;
1241 u16 tx_coal_bufs;
1242 u16 tx_coal_bufs_irq;
1243 1273
1244#define BNXT_USEC_TO_COAL_TIMER(x) ((x) * 25 / 2)1274#define BNXT_USEC_TO_COAL_TIMER(x) ((x) * 25 / 2)
1245 1275
@@ -1265,6 +1295,7 @@ struct bnxt { · 19 unmodified lines
1265#define BNXT_GENEVE_ADD_PORT_SP_EVENT 121295#define BNXT_GENEVE_ADD_PORT_SP_EVENT 12
1266#define BNXT_GENEVE_DEL_PORT_SP_EVENT 131296#define BNXT_GENEVE_DEL_PORT_SP_EVENT 13
1267#define BNXT_LINK_SPEED_CHNG_SP_EVENT 141297#define BNXT_LINK_SPEED_CHNG_SP_EVENT 14
1298#define BNXT_FLOW_STATS_SP_EVENT 15
1268 1299
1269 struct bnxt_pf_info pf;1300 struct bnxt_pf_info pf;
1270#ifdef CONFIG_BNXT_SRIOV1301#ifdef CONFIG_BNXT_SRIOV
@@ -1315,7 +1346,7 @@ struct bnxt { · 44 unmodified lines
1315 enum devlink_eswitch_mode eswitch_mode;1346 enum devlink_eswitch_mode eswitch_mode;
1316 struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */1347 struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */
1317 u16 *cfa_code_map; /* cfa_code -> vf_idx map */1348 u16 *cfa_code_map; /* cfa_code -> vf_idx map */
1318 struct bnxt_tc_info tc_info;1349 struct bnxt_tc_info *tc_info;
1319};1350};
1320 1351
1321#define BNXT_RX_STATS_OFFSET(counter) \1352#define BNXT_RX_STATS_OFFSET(counter) \
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c+65−0
@@ -0,0 +1,65 @@
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2017 Broadcom Limited
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 */
9
10#include <linux/pci.h>
11#include <linux/netdevice.h>
12#include "bnxt_hsi.h"
13#include "bnxt.h"
14#include "bnxt_vfr.h"
15#include "bnxt_devlink.h"
16
17static const struct devlink_ops bnxt_dl_ops = {
18#ifdef CONFIG_BNXT_SRIOV
19 .eswitch_mode_set = bnxt_dl_eswitch_mode_set,
20 .eswitch_mode_get = bnxt_dl_eswitch_mode_get,
21#endif /* CONFIG_BNXT_SRIOV */
22};
23
24int bnxt_dl_register(struct bnxt *bp)
25{
26 struct devlink *dl;
27 int rc;
28
29 if (!pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV))
30 return 0;
31
32 if (bp->hwrm_spec_code < 0x10803) {
33 netdev_warn(bp->dev, "Firmware does not support SR-IOV E-Switch SWITCHDEV mode.\n");
34 return -ENOTSUPP;
35 }
36
37 dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl));
38 if (!dl) {
39 netdev_warn(bp->dev, "devlink_alloc failed");
40 return -ENOMEM;
41 }
42
43 bnxt_link_bp_to_dl(bp, dl);
44 bp->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY;
45 rc = devlink_register(dl, &bp->pdev->dev);
46 if (rc) {
47 bnxt_link_bp_to_dl(bp, NULL);
48 devlink_free(dl);
49 netdev_warn(bp->dev, "devlink_register failed. rc=%d", rc);
50 return rc;
51 }
52
53 return 0;
54}
55
56void bnxt_dl_unregister(struct bnxt *bp)
57{
58 struct devlink *dl = bp->dl;
59
60 if (!dl)
61 return;
62
63 devlink_unregister(dl);
64 devlink_free(dl);
65}
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h+39−0
@@ -0,0 +1,39 @@
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2017 Broadcom Limited
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef BNXT_DEVLINK_H
11#define BNXT_DEVLINK_H
12
13/* Struct to hold housekeeping info needed by devlink interface */
14struct bnxt_dl {
15 struct bnxt *bp; /* back ptr to the controlling dev */
16};
17
18static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
19{
20 return ((struct bnxt_dl *)devlink_priv(dl))->bp;
21}
22
23/* To clear devlink pointer from bp, pass NULL dl */
24static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl)
25{
26 bp->dl = dl;
27
28 /* add a back pointer in dl to bp */
29 if (dl) {
30 struct bnxt_dl *bp_dl = devlink_priv(dl);
31
32 bp_dl->bp = bp;
33 }
34}
35
36int bnxt_dl_register(struct bnxt *bp);
37void bnxt_dl_unregister(struct bnxt *bp);
38
39#endif /* BNXT_DEVLINK_H */
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+85−35
@@ -26,8 +26,6 @@ · 25 unmodified lines
26#define FLASH_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)26#define FLASH_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)
27#define INSTALL_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)27#define INSTALL_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)
28 28
29static char *bnxt_get_pkgver(struct net_device *dev, char *buf, size_t buflen);
30
31static u32 bnxt_get_msglevel(struct net_device *dev)29static u32 bnxt_get_msglevel(struct net_device *dev)
32{30{
33 struct bnxt *bp = netdev_priv(dev);31 struct bnxt *bp = netdev_priv(dev);
@@ -46,19 +44,24 @@ static int bnxt_get_coalesce(struct net_device *dev, · 12 unmodified lines
46 struct ethtool_coalesce *coal)44 struct ethtool_coalesce *coal)
47{45{
48 struct bnxt *bp = netdev_priv(dev);46 struct bnxt *bp = netdev_priv(dev);
47 struct bnxt_coal *hw_coal;
48 u16 mult;
49 49
50 memset(coal, 0, sizeof(*coal));50 memset(coal, 0, sizeof(*coal));
51 51
52 coal->rx_coalesce_usecs = bp->rx_coal_ticks;52 hw_coal = &bp->rx_coal;
53 /* 2 completion records per rx packet */53 mult = hw_coal->bufs_per_record;
54 coal->rx_max_coalesced_frames = bp->rx_coal_bufs / 2;54 coal->rx_coalesce_usecs = hw_coal->coal_ticks;
55 coal->rx_coalesce_usecs_irq = bp->rx_coal_ticks_irq;55 coal->rx_max_coalesced_frames = hw_coal->coal_bufs / mult;
56 coal->rx_max_coalesced_frames_irq = bp->rx_coal_bufs_irq / 2;56 coal->rx_coalesce_usecs_irq = hw_coal->coal_ticks_irq;
57 coal->rx_max_coalesced_frames_irq = hw_coal->coal_bufs_irq / mult;
57 58
58 coal->tx_coalesce_usecs = bp->tx_coal_ticks;59 hw_coal = &bp->tx_coal;
59 coal->tx_max_coalesced_frames = bp->tx_coal_bufs;60 mult = hw_coal->bufs_per_record;
60 coal->tx_coalesce_usecs_irq = bp->tx_coal_ticks_irq;61 coal->tx_coalesce_usecs = hw_coal->coal_ticks;
61 coal->tx_max_coalesced_frames_irq = bp->tx_coal_bufs_irq;62 coal->tx_max_coalesced_frames = hw_coal->coal_bufs / mult;
63 coal->tx_coalesce_usecs_irq = hw_coal->coal_ticks_irq;
64 coal->tx_max_coalesced_frames_irq = hw_coal->coal_bufs_irq / mult;
62 65
63 coal->stats_block_coalesce_usecs = bp->stats_coal_ticks;66 coal->stats_block_coalesce_usecs = bp->stats_coal_ticks;
64 67
@@ -70,18 +73,23 @@ static int bnxt_set_coalesce(struct net_device *dev, · 5 unmodified lines
70{73{
71 struct bnxt *bp = netdev_priv(dev);74 struct bnxt *bp = netdev_priv(dev);
72 bool update_stats = false;75 bool update_stats = false;
76 struct bnxt_coal *hw_coal;
73 int rc = 0;77 int rc = 0;
74 78 u16 mult;
75 bp->rx_coal_ticks = coal->rx_coalesce_usecs;79
76 /* 2 completion records per rx packet */80 hw_coal = &bp->rx_coal;
77 bp->rx_coal_bufs = coal->rx_max_coalesced_frames * 2;81 mult = hw_coal->bufs_per_record;
78 bp->rx_coal_ticks_irq = coal->rx_coalesce_usecs_irq;82 hw_coal->coal_ticks = coal->rx_coalesce_usecs;
79 bp->rx_coal_bufs_irq = coal->rx_max_coalesced_frames_irq * 2;83 hw_coal->coal_bufs = coal->rx_max_coalesced_frames * mult;
80 84 hw_coal->coal_ticks_irq = coal->rx_coalesce_usecs_irq;
81 bp->tx_coal_ticks = coal->tx_coalesce_usecs;85 hw_coal->coal_bufs_irq = coal->rx_max_coalesced_frames_irq * mult;
82 bp->tx_coal_bufs = coal->tx_max_coalesced_frames;86
83 bp->tx_coal_ticks_irq = coal->tx_coalesce_usecs_irq;87 hw_coal = &bp->tx_coal;
84 bp->tx_coal_bufs_irq = coal->tx_max_coalesced_frames_irq;88 mult = hw_coal->bufs_per_record;
89 hw_coal->coal_ticks = coal->tx_coalesce_usecs;
90 hw_coal->coal_bufs = coal->tx_max_coalesced_frames * mult;
91 hw_coal->coal_ticks_irq = coal->tx_coalesce_usecs_irq;
92 hw_coal->coal_bufs_irq = coal->tx_max_coalesced_frames_irq * mult;
85 93
86 if (bp->stats_coal_ticks != coal->stats_block_coalesce_usecs) {94 if (bp->stats_coal_ticks != coal->stats_block_coalesce_usecs) {
87 u32 stats_ticks = coal->stats_block_coalesce_usecs;95 u32 stats_ticks = coal->stats_block_coalesce_usecs;
@@ -822,20 +830,10 @@ static void bnxt_get_drvinfo(struct net_device *dev, · 734 unmodified lines
822 struct ethtool_drvinfo *info)830 struct ethtool_drvinfo *info)
823{831{
824 struct bnxt *bp = netdev_priv(dev);832 struct bnxt *bp = netdev_priv(dev);
825 char *pkglog;
826 char *pkgver = NULL;
827 833
828 pkglog = kmalloc(BNX_PKG_LOG_MAX_LENGTH, GFP_KERNEL);
829 if (pkglog)
830 pkgver = bnxt_get_pkgver(dev, pkglog, BNX_PKG_LOG_MAX_LENGTH);
831 strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));834 strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
832 strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));835 strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
833 if (pkgver && *pkgver != 0 && isdigit(*pkgver))836 strlcpy(info->fw_version, bp->fw_ver_str, sizeof(info->fw_version));
834 snprintf(info->fw_version, sizeof(info->fw_version) - 1,
835 "%s pkg %s", bp->fw_ver_str, pkgver);
836 else
837 strlcpy(info->fw_version, bp->fw_ver_str,
838 sizeof(info->fw_version));
839 strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));837 strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));
840 info->n_stats = bnxt_get_num_stats(bp);838 info->n_stats = bnxt_get_num_stats(bp);
841 info->testinfo_len = bp->num_tests;839 info->testinfo_len = bp->num_tests;
@@ -843,7 +841,6 @@ static void bnxt_get_drvinfo(struct net_device *dev, · 1 unmodified line
843 info->eedump_len = 0;841 info->eedump_len = 0;
844 /* TODO CHIMP FW: reg dump details */842 /* TODO CHIMP FW: reg dump details */
845 info->regdump_len = 0;843 info->regdump_len = 0;
846 kfree(pkglog);
847}844}
848 845
849static void bnxt_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)846static void bnxt_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -1350,7 +1347,6 @@ static int bnxt_firmware_reset(struct net_device *dev, · 500 unmodified lines
1350 1347
1351 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_RESET, -1, -1);1348 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_RESET, -1, -1);
1352 1349
1353 /* TODO: Support ASAP ChiMP self-reset (e.g. upon PF driver unload) */
1354 /* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */1350 /* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */
1355 /* (e.g. when firmware isn't already running) */1351 /* (e.g. when firmware isn't already running) */
1356 switch (dir_type) {1352 switch (dir_type) {
@@ -1376,6 +1372,10 @@ static int bnxt_firmware_reset(struct net_device *dev, · 19 unmodified lines
1376 case BNX_DIR_TYPE_BONO_PATCH:1372 case BNX_DIR_TYPE_BONO_PATCH:
1377 req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE;1373 req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE;
1378 break;1374 break;
1375 case BNXT_FW_RESET_CHIP:
1376 req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP;
1377 req.selfrst_status = FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP;
1378 break;
1379 default:1379 default:
1380 return -EINVAL;1380 return -EINVAL;
1381 }1381 }
@@ -1773,6 +1773,9 @@ static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset, · 391 unmodified lines
1773 dma_addr_t dma_handle;1773 dma_addr_t dma_handle;
1774 struct hwrm_nvm_read_input req = {0};1774 struct hwrm_nvm_read_input req = {0};
1775 1775
1776 if (!length)
1777 return -EINVAL;
1778
1776 buf = dma_alloc_coherent(&bp->pdev->dev, length, &dma_handle,1779 buf = dma_alloc_coherent(&bp->pdev->dev, length, &dma_handle,
1777 GFP_KERNEL);1780 GFP_KERNEL);
1778 if (!buf) {1781 if (!buf) {
@@ -2495,13 +2498,59 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 716 unmodified lines
2495 }2498 }
2496}2499}
2497 2500
2501static int bnxt_reset(struct net_device *dev, u32 *flags)
2502{
2503 struct bnxt *bp = netdev_priv(dev);
2504 int rc = 0;
2505
2506 if (!BNXT_PF(bp)) {
2507 netdev_err(dev, "Reset is not supported from a VF\n");
2508 return -EOPNOTSUPP;
2509 }
2510
2511 if (pci_vfs_assigned(bp->pdev)) {
2512 netdev_err(dev,
2513 "Reset not allowed when VFs are assigned to VMs\n");
2514 return -EBUSY;
2515 }
2516
2517 if (*flags == ETH_RESET_ALL) {
2518 /* This feature is not supported in older firmware versions */
2519 if (bp->hwrm_spec_code < 0x10803)
2520 return -EOPNOTSUPP;
2521
2522 rc = bnxt_firmware_reset(dev, BNXT_FW_RESET_CHIP);
2523 if (!rc)
2524 netdev_info(dev, "Reset request successful. Reload driver to complete reset\n");
2525 } else {
2526 rc = -EINVAL;
2527 }
2528
2529 return rc;
2530}
2531
2498void bnxt_ethtool_init(struct bnxt *bp)2532void bnxt_ethtool_init(struct bnxt *bp)
2499{2533{
2500 struct hwrm_selftest_qlist_output *resp = bp->hwrm_cmd_resp_addr;2534 struct hwrm_selftest_qlist_output *resp = bp->hwrm_cmd_resp_addr;
2501 struct hwrm_selftest_qlist_input req = {0};2535 struct hwrm_selftest_qlist_input req = {0};
2502 struct bnxt_test_info *test_info;2536 struct bnxt_test_info *test_info;
2537 struct net_device *dev = bp->dev;
2538 char *pkglog;
2503 int i, rc;2539 int i, rc;
2504 2540
2541 pkglog = kzalloc(BNX_PKG_LOG_MAX_LENGTH, GFP_KERNEL);
2542 if (pkglog) {
2543 char *pkgver;
2544 int len;
2545
2546 pkgver = bnxt_get_pkgver(dev, pkglog, BNX_PKG_LOG_MAX_LENGTH);
2547 if (pkgver && *pkgver != 0 && isdigit(*pkgver)) {
2548 len = strlen(bp->fw_ver_str);
2549 snprintf(bp->fw_ver_str + len, FW_VER_STR_LEN - len - 1,
2550 "/pkg %s", pkgver);
2551 }
2552 kfree(pkglog);
2553 }
2505 if (bp->hwrm_spec_code < 0x10704 || !BNXT_SINGLE_PF(bp))2554 if (bp->hwrm_spec_code < 0x10704 || !BNXT_SINGLE_PF(bp))
2506 return;2555 return;
2507 2556
@@ -2592,4 +2641,5 @@ const struct ethtool_ops bnxt_ethtool_ops = { · 84 unmodified lines
2592 .nway_reset = bnxt_nway_reset,2641 .nway_reset = bnxt_nway_reset,
2593 .set_phys_id = bnxt_set_phys_id,2642 .set_phys_id = bnxt_set_phys_id,
2594 .self_test = bnxt_self_test,2643 .self_test = bnxt_self_test,
2644 .reset = bnxt_reset,
2595};2645};
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h+2−0
@@ -34,6 +34,8 @@ struct bnxt_led_cfg { · 33 unmodified lines
34#define BNXT_LED_DFLT_ENABLES(x) \34#define BNXT_LED_DFLT_ENABLES(x) \
35 cpu_to_le32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))35 cpu_to_le32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
36 36
37#define BNXT_FW_RESET_CHIP 0xffff
38
37extern const struct ethtool_ops bnxt_ethtool_ops;39extern const struct ethtool_ops bnxt_ethtool_ops;
38 40
39u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);41u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h+396−24
@@ -11,21 +11,21 @@ · 10 unmodified lines
11#ifndef BNXT_HSI_H11#ifndef BNXT_HSI_H
12#define BNXT_HSI_H12#define BNXT_HSI_H
13 13
14/* HSI and HWRM Specification 1.8.1 */14/* HSI and HWRM Specification 1.8.3 */
15#define HWRM_VERSION_MAJOR 115#define HWRM_VERSION_MAJOR 1
16#define HWRM_VERSION_MINOR 816#define HWRM_VERSION_MINOR 8
17#define HWRM_VERSION_UPDATE 117#define HWRM_VERSION_UPDATE 3
18 18
19#define HWRM_VERSION_RSVD 4 /* non-zero means beta version */19#define HWRM_VERSION_RSVD 1 /* non-zero means beta version */
20 20
21#define HWRM_VERSION_STR "1.8.1.4"21#define HWRM_VERSION_STR "1.8.3.1"
22/*22/*
23 * Following is the signature for HWRM message field that indicates not23 * Following is the signature for HWRM message field that indicates not
24 * applicable (All F's). Need to cast it the size of the field if needed.24 * applicable (All F's). Need to cast it the size of the field if needed.
25 */25 */
26#define HWRM_NA_SIGNATURE ((__le32)(-1))26#define HWRM_NA_SIGNATURE ((__le32)(-1))
27#define HWRM_MAX_REQ_LEN (128) /* hwrm_func_buf_rgtr */27#define HWRM_MAX_REQ_LEN (128) /* hwrm_func_buf_rgtr */
28#define HWRM_MAX_RESP_LEN (248) /* hwrm_selftest_qlist */28#define HWRM_MAX_RESP_LEN (280) /* hwrm_selftest_qlist */
29#define HW_HASH_INDEX_SIZE 0x80 /* 7 bit indirection table index. */29#define HW_HASH_INDEX_SIZE 0x80 /* 7 bit indirection table index. */
30#define HW_HASH_KEY_SIZE 4030#define HW_HASH_KEY_SIZE 40
31#define HWRM_RESP_VALID_KEY 1 /* valid key for HWRM response */31#define HWRM_RESP_VALID_KEY 1 /* valid key for HWRM response */
@@ -111,6 +111,7 @@ struct hwrm_async_event_cmpl { · 79 unmodified lines
111 #define ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE 0x31UL111 #define ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE 0x31UL
112 #define ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE 0x32UL112 #define ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE 0x32UL
113 #define ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE 0x33UL113 #define ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE 0x33UL
114 #define ASYNC_EVENT_CMPL_EVENT_ID_LLFC_PFC_CHANGE 0x34UL
114 #define ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR 0xffUL115 #define ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR 0xffUL
115 __le32 event_data2;116 __le32 event_data2;
116 u8 opaque_v;117 u8 opaque_v;
@@ -835,8 +836,7 @@ struct hwrm_func_qcfg_output { · 718 unmodified lines
835 u8 port_pf_cnt;836 u8 port_pf_cnt;
836 #define FUNC_QCFG_RESP_PORT_PF_CNT_UNAVAIL 0x0UL837 #define FUNC_QCFG_RESP_PORT_PF_CNT_UNAVAIL 0x0UL
837 __le16 dflt_vnic_id;838 __le16 dflt_vnic_id;
838 u8 unused_0;839 __le16 max_mtu_configured;
839 u8 unused_1;
840 __le32 min_bw;840 __le32 min_bw;
841 #define FUNC_QCFG_RESP_MIN_BW_BW_VALUE_MASK 0xfffffffUL841 #define FUNC_QCFG_RESP_MIN_BW_BW_VALUE_MASK 0xfffffffUL
842 #define FUNC_QCFG_RESP_MIN_BW_BW_VALUE_SFT 0842 #define FUNC_QCFG_RESP_MIN_BW_BW_VALUE_SFT 0
@@ -873,12 +873,12 @@ struct hwrm_func_qcfg_output { · 30 unmodified lines
873 #define FUNC_QCFG_RESP_EVB_MODE_NO_EVB 0x0UL873 #define FUNC_QCFG_RESP_EVB_MODE_NO_EVB 0x0UL
874 #define FUNC_QCFG_RESP_EVB_MODE_VEB 0x1UL874 #define FUNC_QCFG_RESP_EVB_MODE_VEB 0x1UL
875 #define FUNC_QCFG_RESP_EVB_MODE_VEPA 0x2UL875 #define FUNC_QCFG_RESP_EVB_MODE_VEPA 0x2UL
876 u8 unused_2;876 u8 unused_0;
877 __le16 alloc_vfs;877 __le16 alloc_vfs;
878 __le32 alloc_mcast_filters;878 __le32 alloc_mcast_filters;
879 __le32 alloc_hw_ring_grps;879 __le32 alloc_hw_ring_grps;
880 __le16 alloc_sp_tx_rings;880 __le16 alloc_sp_tx_rings;
881 u8 unused_3;881 u8 unused_1;
882 u8 valid;882 u8 valid;
883};883};
884 884
@@ -3407,6 +3407,7 @@ struct hwrm_vnic_cfg_input { · 2522 unmodified lines
3407 #define VNIC_CFG_REQ_FLAGS_ROCE_DUAL_VNIC_MODE 0x8UL3407 #define VNIC_CFG_REQ_FLAGS_ROCE_DUAL_VNIC_MODE 0x8UL
3408 #define VNIC_CFG_REQ_FLAGS_ROCE_ONLY_VNIC_MODE 0x10UL3408 #define VNIC_CFG_REQ_FLAGS_ROCE_ONLY_VNIC_MODE 0x10UL
3409 #define VNIC_CFG_REQ_FLAGS_RSS_DFLT_CR_MODE 0x20UL3409 #define VNIC_CFG_REQ_FLAGS_RSS_DFLT_CR_MODE 0x20UL
3410 #define VNIC_CFG_REQ_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_MODE 0x40UL
3410 __le32 enables;3411 __le32 enables;
3411 #define VNIC_CFG_REQ_ENABLES_DFLT_RING_GRP 0x1UL3412 #define VNIC_CFG_REQ_ENABLES_DFLT_RING_GRP 0x1UL
3412 #define VNIC_CFG_REQ_ENABLES_RSS_RULE 0x2UL3413 #define VNIC_CFG_REQ_ENABLES_RSS_RULE 0x2UL
@@ -3463,6 +3464,7 @@ struct hwrm_vnic_qcaps_output { · 50 unmodified lines
3463 #define VNIC_QCAPS_RESP_FLAGS_ROCE_DUAL_VNIC_CAP 0x8UL3464 #define VNIC_QCAPS_RESP_FLAGS_ROCE_DUAL_VNIC_CAP 0x8UL
3464 #define VNIC_QCAPS_RESP_FLAGS_ROCE_ONLY_VNIC_CAP 0x10UL3465 #define VNIC_QCAPS_RESP_FLAGS_ROCE_ONLY_VNIC_CAP 0x10UL
3465 #define VNIC_QCAPS_RESP_FLAGS_RSS_DFLT_CR_CAP 0x20UL3466 #define VNIC_QCAPS_RESP_FLAGS_RSS_DFLT_CR_CAP 0x20UL
3467 #define VNIC_QCAPS_RESP_FLAGS_ROCE_MIRROING_CAPABLE_VNIC_CAP 0x40UL
3466 __le32 unused_2;3468 __le32 unused_2;
3467 u8 unused_3;3469 u8 unused_3;
3468 u8 unused_4;3470 u8 unused_4;
@@ -3994,6 +3996,7 @@ struct hwrm_cfa_l2_filter_alloc_input { · 525 unmodified lines
3994 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL3996 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL
3995 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL3997 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL
3996 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL3998 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL
3999 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
3997 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL4000 #define CFA_L2_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL
3998 u8 unused_7;4001 u8 unused_7;
3999 __le16 dst_id;4002 __le16 dst_id;
@@ -4122,6 +4125,14 @@ struct hwrm_cfa_l2_set_rx_mask_output { · 122 unmodified lines
4122 u8 valid;4125 u8 valid;
4123};4126};
4124 4127
4128/* Command specific Error Codes (8 bytes) */
4129struct hwrm_cfa_l2_set_rx_mask_cmd_err {
4130 u8 code;
4131 #define CFA_L2_SET_RX_MASK_CMD_ERR_CODE_UNKNOWN 0x0UL
4132 #define CFA_L2_SET_RX_MASK_CMD_ERR_CODE_NTUPLE_FILTER_CONFLICT_ERR 0x1UL
4133 u8 unused_0[7];
4134};
4135
4125/* hwrm_cfa_tunnel_filter_alloc */4136/* hwrm_cfa_tunnel_filter_alloc */
4126/* Input (88 bytes) */4137/* Input (88 bytes) */
4127struct hwrm_cfa_tunnel_filter_alloc_input {4138struct hwrm_cfa_tunnel_filter_alloc_input {
@@ -4161,6 +4172,7 @@ struct hwrm_cfa_tunnel_filter_alloc_input { · 33 unmodified lines
4161 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL4172 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL
4162 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL4173 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL
4163 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL4174 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL
4175 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
4164 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL4176 #define CFA_TUNNEL_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL
4165 u8 unused_0;4177 u8 unused_0;
4166 __le32 vni;4178 __le32 vni;
@@ -4323,6 +4335,7 @@ struct hwrm_cfa_ntuple_filter_alloc_input { · 156 unmodified lines
4323 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL4335 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL
4324 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL4336 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL
4325 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL4337 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL
4338 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
4326 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL4339 #define CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL
4327 u8 pri_hint;4340 u8 pri_hint;
4328 #define CFA_NTUPLE_FILTER_ALLOC_REQ_PRI_HINT_NO_PREFER 0x0UL4341 #define CFA_NTUPLE_FILTER_ALLOC_REQ_PRI_HINT_NO_PREFER 0x0UL
@@ -4355,6 +4368,14 @@ struct hwrm_cfa_ntuple_filter_alloc_output { · 26 unmodified lines
4355 u8 valid;4368 u8 valid;
4356};4369};
4357 4370
4371/* Command specific Error Codes (8 bytes) */
4372struct hwrm_cfa_ntuple_filter_alloc_cmd_err {
4373 u8 code;
4374 #define CFA_NTUPLE_FILTER_ALLOC_CMD_ERR_CODE_UNKNOWN 0x0UL
4375 #define CFA_NTUPLE_FILTER_ALLOC_CMD_ERR_CODE_RX_MASK_VLAN_CONFLICT_ERR 0x1UL
4376 u8 unused_0[7];
4377};
4378
4358/* hwrm_cfa_ntuple_filter_free */4379/* hwrm_cfa_ntuple_filter_free */
4359/* Input (24 bytes) */4380/* Input (24 bytes) */
4360struct hwrm_cfa_ntuple_filter_free_input {4381struct hwrm_cfa_ntuple_filter_free_input {
@@ -4413,6 +4434,116 @@ struct hwrm_cfa_ntuple_filter_cfg_output { · 52 unmodified lines
4413 u8 valid;4434 u8 valid;
4414};4435};
4415 4436
4437/* hwrm_cfa_decap_filter_alloc */
4438/* Input (104 bytes) */
4439struct hwrm_cfa_decap_filter_alloc_input {
4440 __le16 req_type;
4441 __le16 cmpl_ring;
4442 __le16 seq_id;
4443 __le16 target_id;
4444 __le64 resp_addr;
4445 __le32 flags;
4446 #define CFA_DECAP_FILTER_ALLOC_REQ_FLAGS_OVS_TUNNEL 0x1UL
4447 __le32 enables;
4448 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_TUNNEL_TYPE 0x1UL
4449 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_TUNNEL_ID 0x2UL
4450 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_MACADDR 0x4UL
4451 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_MACADDR 0x8UL
4452 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_OVLAN_VID 0x10UL
4453 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_IVLAN_VID 0x20UL
4454 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_T_OVLAN_VID 0x40UL
4455 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_T_IVLAN_VID 0x80UL
4456 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_ETHERTYPE 0x100UL
4457 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_IPADDR 0x200UL
4458 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_IPADDR 0x400UL
4459 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_IPADDR_TYPE 0x800UL
4460 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_IP_PROTOCOL 0x1000UL
4461 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_PORT 0x2000UL
4462 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_PORT 0x4000UL
4463 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_ID 0x8000UL
4464 #define CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_MIRROR_VNIC_ID 0x10000UL
4465 __be32 tunnel_id;
4466 u8 tunnel_type;
4467 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_NONTUNNEL 0x0UL
4468 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_VXLAN 0x1UL
4469 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_NVGRE 0x2UL
4470 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_L2GRE 0x3UL
4471 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPIP 0x4UL
4472 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_GENEVE 0x5UL
4473 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_MPLS 0x6UL
4474 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_STT 0x7UL
4475 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_IPGRE 0x8UL
4476 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
4477 #define CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL 0xffUL
4478 u8 unused_0;
4479 __le16 unused_1;
4480 u8 src_macaddr[6];
4481 u8 unused_2;
4482 u8 unused_3;
4483 u8 dst_macaddr[6];
4484 __be16 ovlan_vid;
4485 __be16 ivlan_vid;
4486 __be16 t_ovlan_vid;
4487 __be16 t_ivlan_vid;
4488 __be16 ethertype;
4489 u8 ip_addr_type;
4490 #define CFA_DECAP_FILTER_ALLOC_REQ_IP_ADDR_TYPE_UNKNOWN 0x0UL
4491 #define CFA_DECAP_FILTER_ALLOC_REQ_IP_ADDR_TYPE_IPV4 0x4UL
4492 #define CFA_DECAP_FILTER_ALLOC_REQ_IP_ADDR_TYPE_IPV6 0x6UL
4493 u8 ip_protocol;
4494 #define CFA_DECAP_FILTER_ALLOC_REQ_IP_PROTOCOL_UNKNOWN 0x0UL
4495 #define CFA_DECAP_FILTER_ALLOC_REQ_IP_PROTOCOL_TCP 0x6UL
4496 #define CFA_DECAP_FILTER_ALLOC_REQ_IP_PROTOCOL_UDP 0x11UL
4497 u8 unused_4;
4498 u8 unused_5;
4499 u8 unused_6[3];
4500 u8 unused_7;
4501 __be32 src_ipaddr[4];
4502 __be32 dst_ipaddr[4];
4503 __be16 src_port;
4504 __be16 dst_port;
4505 __le16 dst_id;
4506 __le16 l2_ctxt_ref_id;
4507};
4508
4509/* Output (16 bytes) */
4510struct hwrm_cfa_decap_filter_alloc_output {
4511 __le16 error_code;
4512 __le16 req_type;
4513 __le16 seq_id;
4514 __le16 resp_len;
4515 __le32 decap_filter_id;
4516 u8 unused_0;
4517 u8 unused_1;
4518 u8 unused_2;
4519 u8 valid;
4520};
4521
4522/* hwrm_cfa_decap_filter_free */
4523/* Input (24 bytes) */
4524struct hwrm_cfa_decap_filter_free_input {
4525 __le16 req_type;
4526 __le16 cmpl_ring;
4527 __le16 seq_id;
4528 __le16 target_id;
4529 __le64 resp_addr;
4530 __le32 decap_filter_id;
4531 __le32 unused_0;
4532};
4533
4534/* Output (16 bytes) */
4535struct hwrm_cfa_decap_filter_free_output {
4536 __le16 error_code;
4537 __le16 req_type;
4538 __le16 seq_id;
4539 __le16 resp_len;
4540 __le32 unused_0;
4541 u8 unused_1;
4542 u8 unused_2;
4543 u8 unused_3;
4544 u8 valid;
4545};
4546
4416/* hwrm_cfa_flow_alloc */4547/* hwrm_cfa_flow_alloc */
4417/* Input (128 bytes) */4548/* Input (128 bytes) */
4418struct hwrm_cfa_flow_alloc_input {4549struct hwrm_cfa_flow_alloc_input {
@@ -4634,6 +4765,7 @@ struct hwrm_tunnel_dst_port_query_input { · 215 unmodified lines
4634 u8 tunnel_type;4765 u8 tunnel_type;
4635 #define TUNNEL_DST_PORT_QUERY_REQ_TUNNEL_TYPE_VXLAN 0x1UL4766 #define TUNNEL_DST_PORT_QUERY_REQ_TUNNEL_TYPE_VXLAN 0x1UL
4636 #define TUNNEL_DST_PORT_QUERY_REQ_TUNNEL_TYPE_GENEVE 0x5UL4767 #define TUNNEL_DST_PORT_QUERY_REQ_TUNNEL_TYPE_GENEVE 0x5UL
4768 #define TUNNEL_DST_PORT_QUERY_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
4637 u8 unused_0[7];4769 u8 unused_0[7];
4638};4770};
4639 4771
@@ -4662,9 +4794,10 @@ struct hwrm_tunnel_dst_port_alloc_input { · 22 unmodified lines
4662 u8 tunnel_type;4794 u8 tunnel_type;
4663 #define TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN 0x1UL4795 #define TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN 0x1UL
4664 #define TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE 0x5UL4796 #define TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE 0x5UL
4797 #define TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
4665 u8 unused_0;4798 u8 unused_0;
4666 __be16 tunnel_dst_port_val;4799 __be16 tunnel_dst_port_val;
4667 __le32 unused_1;4800 __be32 unused_1;
4668};4801};
4669 4802
4670/* Output (16 bytes) */4803/* Output (16 bytes) */
@@ -4693,6 +4826,7 @@ struct hwrm_tunnel_dst_port_free_input { · 22 unmodified lines
4693 u8 tunnel_type;4826 u8 tunnel_type;
4694 #define TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN 0x1UL4827 #define TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN 0x1UL
4695 #define TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE 0x5UL4828 #define TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE 0x5UL
4829 #define TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN_V4 0x9UL
4696 u8 unused_0;4830 u8 unused_0;
4697 __le16 tunnel_dst_port_id;4831 __le16 tunnel_dst_port_id;
4698 __le32 unused_1;4832 __le32 unused_1;
@@ -4848,6 +4982,8 @@ struct hwrm_fw_reset_input { · 149 unmodified lines
4848 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_NETCTRL 0x2UL4982 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_NETCTRL 0x2UL
4849 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE 0x3UL4983 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE 0x3UL
4850 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_HOST 0x4UL4984 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_HOST 0x4UL
4985 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_AP 0x5UL
4986 #define FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP 0x6UL
4851 u8 selfrst_status;4987 u8 selfrst_status;
4852 #define FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE 0x0UL4988 #define FW_RESET_REQ_SELFRST_STATUS_SELFRSTNONE 0x0UL
4853 #define FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP 0x1UL4989 #define FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP 0x1UL
@@ -4888,6 +5024,8 @@ struct hwrm_fw_qstatus_input { · 34 unmodified lines
4888 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_NETCTRL 0x2UL5024 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_NETCTRL 0x2UL
4889 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_ROCE 0x3UL5025 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_ROCE 0x3UL
4890 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_HOST 0x4UL5026 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_HOST 0x4UL
5027 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_AP 0x5UL
5028 #define FW_QSTATUS_REQ_EMBEDDED_PROC_TYPE_CHIP 0x6UL
4891 u8 unused_0[7];5029 u8 unused_0[7];
4892};5030};
4893 5031
@@ -5324,6 +5462,32 @@ struct hwrm_wol_reason_qcfg_output { · 430 unmodified lines
5324 u8 valid;5462 u8 valid;
5325};5463};
5326 5464
5465/* hwrm_dbg_read_direct */
5466/* Input (32 bytes) */
5467struct hwrm_dbg_read_direct_input {
5468 __le16 req_type;
5469 __le16 cmpl_ring;
5470 __le16 seq_id;
5471 __le16 target_id;
5472 __le64 resp_addr;
5473 __le64 host_dest_addr;
5474 __le32 read_addr;
5475 __le32 read_len32;
5476};
5477
5478/* Output (16 bytes) */
5479struct hwrm_dbg_read_direct_output {
5480 __le16 error_code;
5481 __le16 req_type;
5482 __le16 seq_id;
5483 __le16 resp_len;
5484 __le32 unused_0;
5485 u8 unused_1;
5486 u8 unused_2;
5487 u8 unused_3;
5488 u8 valid;
5489};
5490
5327/* hwrm_nvm_read */5491/* hwrm_nvm_read */
5328/* Input (40 bytes) */5492/* Input (40 bytes) */
5329struct hwrm_nvm_read_input {5493struct hwrm_nvm_read_input {
@@ -5676,6 +5840,105 @@ struct hwrm_nvm_install_update_cmd_err { · 346 unmodified lines
5676 u8 unused_0[7];5840 u8 unused_0[7];
5677};5841};
5678 5842
5843/* hwrm_nvm_get_variable */
5844/* Input (40 bytes) */
5845struct hwrm_nvm_get_variable_input {
5846 __le16 req_type;
5847 __le16 cmpl_ring;
5848 __le16 seq_id;
5849 __le16 target_id;
5850 __le64 resp_addr;
5851 __le64 dest_data_addr;
5852 __le16 data_len;
5853 __le16 option_num;
5854 #define NVM_GET_VARIABLE_REQ_OPTION_NUM_RSVD_0 0x0UL
5855 #define NVM_GET_VARIABLE_REQ_OPTION_NUM_RSVD_FFFF 0xffffUL
5856 __le16 dimensions;
5857 __le16 index_0;
5858 __le16 index_1;
5859 __le16 index_2;
5860 __le16 index_3;
5861 u8 flags;
5862 #define NVM_GET_VARIABLE_REQ_FLAGS_FACTORY_DFLT 0x1UL
5863 u8 unused_0;
5864};
5865
5866/* Output (16 bytes) */
5867struct hwrm_nvm_get_variable_output {
5868 __le16 error_code;
5869 __le16 req_type;
5870 __le16 seq_id;
5871 __le16 resp_len;
5872 __le16 data_len;
5873 __le16 option_num;
5874 #define NVM_GET_VARIABLE_RESP_OPTION_NUM_RSVD_0 0x0UL
5875 #define NVM_GET_VARIABLE_RESP_OPTION_NUM_RSVD_FFFF 0xffffUL
5876 u8 unused_0;
5877 u8 unused_1;
5878 u8 unused_2;
5879 u8 valid;
5880};
5881
5882/* Command specific Error Codes (8 bytes) */
5883struct hwrm_nvm_get_variable_cmd_err {
5884 u8 code;
5885 #define NVM_GET_VARIABLE_CMD_ERR_CODE_UNKNOWN 0x0UL
5886 #define NVM_GET_VARIABLE_CMD_ERR_CODE_VAR_NOT_EXIST 0x1UL
5887 #define NVM_GET_VARIABLE_CMD_ERR_CODE_CORRUPT_VAR 0x2UL
5888 #define NVM_GET_VARIABLE_CMD_ERR_CODE_LEN_TOO_SHORT 0x3UL
5889 u8 unused_0[7];
5890};
5891
5892/* hwrm_nvm_set_variable */
5893/* Input (40 bytes) */
5894struct hwrm_nvm_set_variable_input {
5895 __le16 req_type;
5896 __le16 cmpl_ring;
5897 __le16 seq_id;
5898 __le16 target_id;
5899 __le64 resp_addr;
5900 __le64 src_data_addr;
5901 __le16 data_len;
5902 __le16 option_num;
5903 #define NVM_SET_VARIABLE_REQ_OPTION_NUM_RSVD_0 0x0UL
5904 #define NVM_SET_VARIABLE_REQ_OPTION_NUM_RSVD_FFFF 0xffffUL
5905 __le16 dimensions;
5906 __le16 index_0;
5907 __le16 index_1;
5908 __le16 index_2;
5909 __le16 index_3;
5910 u8 flags;
5911 #define NVM_SET_VARIABLE_REQ_FLAGS_FORCE_FLUSH 0x1UL
5912 #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_MASK 0xeUL
5913 #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_SFT 1
5914 #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_NONE (0x0UL << 1)
5915 #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_HMAC_SHA1 (0x1UL << 1)
5916 #define NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_LAST NVM_SET_VARIABLE_REQ_FLAGS_ENCRYPT_MODE_HMAC_SHA1
5917 u8 unused_0;
5918};
5919
5920/* Output (16 bytes) */
5921struct hwrm_nvm_set_variable_output {
5922 __le16 error_code;
5923 __le16 req_type;
5924 __le16 seq_id;
5925 __le16 resp_len;
5926 __le32 unused_0;
5927 u8 unused_1;
5928 u8 unused_2;
5929 u8 unused_3;
5930 u8 valid;
5931};
5932
5933/* Command specific Error Codes (8 bytes) */
5934struct hwrm_nvm_set_variable_cmd_err {
5935 u8 code;
5936 #define NVM_SET_VARIABLE_CMD_ERR_CODE_UNKNOWN 0x0UL
5937 #define NVM_SET_VARIABLE_CMD_ERR_CODE_VAR_NOT_EXIST 0x1UL
5938 #define NVM_SET_VARIABLE_CMD_ERR_CODE_CORRUPT_VAR 0x2UL
5939 u8 unused_0[7];
5940};
5941
5679/* hwrm_selftest_qlist */5942/* hwrm_selftest_qlist */
5680/* Input (16 bytes) */5943/* Input (16 bytes) */
5681struct hwrm_selftest_qlist_input {5944struct hwrm_selftest_qlist_input {
@@ -5686,7 +5949,7 @@ struct hwrm_selftest_qlist_input { · 4 unmodified lines
5686 __le64 resp_addr;5949 __le64 resp_addr;
5687};5950};
5688 5951
5689/* Output (248 bytes) */5952/* Output (280 bytes) */
5690struct hwrm_selftest_qlist_output {5953struct hwrm_selftest_qlist_output {
5691 __le16 error_code;5954 __le16 error_code;
5692 __le16 req_type;5955 __le16 req_type;
@@ -5698,15 +5961,15 @@ struct hwrm_selftest_qlist_output { · 5 unmodified lines
5698 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_LINK_TEST 0x2UL5961 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_LINK_TEST 0x2UL
5699 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_REGISTER_TEST 0x4UL5962 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_REGISTER_TEST 0x4UL
5700 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_MEMORY_TEST 0x8UL5963 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_MEMORY_TEST 0x8UL
5701 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_PCIE_EYE_TEST 0x10UL5964 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_PCIE_SERDES_TEST 0x10UL
5702 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_ETHERNET_EYE_TEST 0x20UL5965 #define SELFTEST_QLIST_RESP_AVAILABLE_TESTS_ETHERNET_SERDES_TEST 0x20UL
5703 u8 offline_tests;5966 u8 offline_tests;
5704 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_NVM_TEST 0x1UL5967 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_NVM_TEST 0x1UL
5705 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_LINK_TEST 0x2UL5968 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_LINK_TEST 0x2UL
5706 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_REGISTER_TEST 0x4UL5969 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_REGISTER_TEST 0x4UL
5707 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_MEMORY_TEST 0x8UL5970 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_MEMORY_TEST 0x8UL
5708 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_PCIE_EYE_TEST 0x10UL5971 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_PCIE_SERDES_TEST 0x10UL
5709 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_ETHERNET_EYE_TEST 0x20UL5972 #define SELFTEST_QLIST_RESP_OFFLINE_TESTS_ETHERNET_SERDES_TEST 0x20UL
5710 u8 unused_0;5973 u8 unused_0;
5711 __le16 test_timeout;5974 __le16 test_timeout;
5712 u8 unused_1;5975 u8 unused_1;
@@ -5719,6 +5982,11 @@ struct hwrm_selftest_qlist_output { · 6 unmodified lines
5719 char test5_name[32];5982 char test5_name[32];
5720 char test6_name[32];5983 char test6_name[32];
5721 char test7_name[32];5984 char test7_name[32];
5985 __le32 unused_3;
5986 u8 unused_4;
5987 u8 unused_5;
5988 u8 unused_6;
5989 u8 valid;
5722};5990};
5723 5991
5724/* hwrm_selftest_exec */5992/* hwrm_selftest_exec */
@@ -5734,8 +6002,8 @@ struct hwrm_selftest_exec_input { · 9 unmodified lines
5734 #define SELFTEST_EXEC_REQ_FLAGS_LINK_TEST 0x2UL6002 #define SELFTEST_EXEC_REQ_FLAGS_LINK_TEST 0x2UL
5735 #define SELFTEST_EXEC_REQ_FLAGS_REGISTER_TEST 0x4UL6003 #define SELFTEST_EXEC_REQ_FLAGS_REGISTER_TEST 0x4UL
5736 #define SELFTEST_EXEC_REQ_FLAGS_MEMORY_TEST 0x8UL6004 #define SELFTEST_EXEC_REQ_FLAGS_MEMORY_TEST 0x8UL
5737 #define SELFTEST_EXEC_REQ_FLAGS_PCIE_EYE_TEST 0x10UL6005 #define SELFTEST_EXEC_REQ_FLAGS_PCIE_SERDES_TEST 0x10UL
5738 #define SELFTEST_EXEC_REQ_FLAGS_ETHERNET_EYE_TEST 0x20UL6006 #define SELFTEST_EXEC_REQ_FLAGS_ETHERNET_SERDES_TEST 0x20UL
5739 u8 unused_0[7];6007 u8 unused_0[7];
5740};6008};
5741 6009
@@ -5750,16 +6018,21 @@ struct hwrm_selftest_exec_output { · 8 unmodified lines
5750 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_LINK_TEST 0x2UL6018 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_LINK_TEST 0x2UL
5751 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_REGISTER_TEST 0x4UL6019 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_REGISTER_TEST 0x4UL
5752 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_MEMORY_TEST 0x8UL6020 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_MEMORY_TEST 0x8UL
5753 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_PCIE_EYE_TEST 0x10UL6021 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_PCIE_SERDES_TEST 0x10UL
5754 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_ETHERNET_EYE_TEST 0x20UL6022 #define SELFTEST_EXEC_RESP_REQUESTED_TESTS_ETHERNET_SERDES_TEST 0x20UL
5755 u8 test_success;6023 u8 test_success;
5756 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_NVM_TEST 0x1UL6024 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_NVM_TEST 0x1UL
5757 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_LINK_TEST 0x2UL6025 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_LINK_TEST 0x2UL
5758 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_REGISTER_TEST 0x4UL6026 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_REGISTER_TEST 0x4UL
5759 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_MEMORY_TEST 0x8UL6027 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_MEMORY_TEST 0x8UL
5760 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_PCIE_EYE_TEST 0x10UL6028 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_PCIE_SERDES_TEST 0x10UL
5761 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_ETHERNET_EYE_TEST 0x20UL6029 #define SELFTEST_EXEC_RESP_TEST_SUCCESS_ETHERNET_SERDES_TEST 0x20UL
5762 __le16 unused_0[3];6030 u8 unused_0;
6031 u8 unused_1;
6032 u8 unused_2;
6033 u8 unused_3;
6034 u8 unused_4;
6035 u8 valid;
5763};6036};
5764 6037
5765/* hwrm_selftest_irq */6038/* hwrm_selftest_irq */
@@ -5772,12 +6045,50 @@ struct hwrm_selftest_irq_input { · 6 unmodified lines
5772 __le64 resp_addr;6045 __le64 resp_addr;
5773};6046};
5774 6047
5775/* Output (8 bytes) */6048/* Output (16 bytes) */
5776struct hwrm_selftest_irq_output {6049struct hwrm_selftest_irq_output {
5777 __le16 error_code;6050 __le16 error_code;
5778 __le16 req_type;6051 __le16 req_type;
5779 __le16 seq_id;6052 __le16 seq_id;
5780 __le16 resp_len;6053 __le16 resp_len;
6054 __le32 unused_0;
6055 u8 unused_1;
6056 u8 unused_2;
6057 u8 unused_3;
6058 u8 valid;
6059};
6060
6061/* hwrm_selftest_retrieve_serdes_data */
6062/* Input (32 bytes) */
6063struct hwrm_selftest_retrieve_serdes_data_input {
6064 __le16 req_type;
6065 __le16 cmpl_ring;
6066 __le16 seq_id;
6067 __le16 target_id;
6068 __le64 resp_addr;
6069 __le64 resp_data_addr;
6070 __le32 resp_data_offset;
6071 __le16 data_len;
6072 u8 flags;
6073 #define SELFTEST_RETRIEVE_SERDES_DATA_REQ_FLAGS_UNUSED_TEST_MASK 0xfUL
6074 #define SELFTEST_RETRIEVE_SERDES_DATA_REQ_FLAGS_UNUSED_TEST_SFT 0
6075 #define SELFTEST_RETRIEVE_SERDES_DATA_REQ_FLAGS_PCIE_SERDES_TEST 0x10UL
6076 #define SELFTEST_RETRIEVE_SERDES_DATA_REQ_FLAGS_ETHERNET_SERDES_TEST 0x20UL
6077 u8 unused_0;
6078};
6079
6080/* Output (16 bytes) */
6081struct hwrm_selftest_retrieve_serdes_data_output {
6082 __le16 error_code;
6083 __le16 req_type;
6084 __le16 seq_id;
6085 __le16 resp_len;
6086 __le16 total_data_len;
6087 __le16 copied_data_len;
6088 u8 unused_0;
6089 u8 unused_1;
6090 u8 unused_2;
6091 u8 valid;
5781};6092};
5782 6093
5783/* Hardware Resource Manager Specification */6094/* Hardware Resource Manager Specification */
@@ -5938,10 +6249,16 @@ struct cmd_nums { · 154 unmodified lines
5938 #define HWRM_CFA_DECAP_FILTER_ALLOC (0x108UL)6249 #define HWRM_CFA_DECAP_FILTER_ALLOC (0x108UL)
5939 #define HWRM_CFA_DECAP_FILTER_FREE (0x109UL)6250 #define HWRM_CFA_DECAP_FILTER_FREE (0x109UL)
5940 #define HWRM_CFA_VLAN_ANTISPOOF_QCFG (0x10aUL)6251 #define HWRM_CFA_VLAN_ANTISPOOF_QCFG (0x10aUL)
6252 #define HWRM_CFA_REDIRECT_TUNNEL_TYPE_ALLOC (0x10bUL)
6253 #define HWRM_CFA_REDIRECT_TUNNEL_TYPE_FREE (0x10cUL)
6254 #define HWRM_CFA_PAIR_ALLOC (0x10dUL)
6255 #define HWRM_CFA_PAIR_FREE (0x10eUL)
6256 #define HWRM_CFA_PAIR_INFO (0x10fUL)
6257 #define HWRM_FW_IPC_MSG (0x110UL)
5941 #define HWRM_SELFTEST_QLIST (0x200UL)6258 #define HWRM_SELFTEST_QLIST (0x200UL)
5942 #define HWRM_SELFTEST_EXEC (0x201UL)6259 #define HWRM_SELFTEST_EXEC (0x201UL)
5943 #define HWRM_SELFTEST_IRQ (0x202UL)6260 #define HWRM_SELFTEST_IRQ (0x202UL)
5944 #define HWRM_SELFTEST_RETREIVE_EYE_DATA (0x203UL)6261 #define HWRM_SELFTEST_RETRIEVE_SERDES_DATA (0x203UL)
5945 #define HWRM_DBG_READ_DIRECT (0xff10UL)6262 #define HWRM_DBG_READ_DIRECT (0xff10UL)
5946 #define HWRM_DBG_READ_INDIRECT (0xff11UL)6263 #define HWRM_DBG_READ_INDIRECT (0xff11UL)
5947 #define HWRM_DBG_WRITE_DIRECT (0xff12UL)6264 #define HWRM_DBG_WRITE_DIRECT (0xff12UL)
@@ -5949,6 +6266,9 @@ struct cmd_nums { · 1 unmodified line
5949 #define HWRM_DBG_DUMP (0xff14UL)6266 #define HWRM_DBG_DUMP (0xff14UL)
5950 #define HWRM_DBG_ERASE_NVM (0xff15UL)6267 #define HWRM_DBG_ERASE_NVM (0xff15UL)
5951 #define HWRM_DBG_CFG (0xff16UL)6268 #define HWRM_DBG_CFG (0xff16UL)
6269 #define HWRM_DBG_COREDUMP_LIST (0xff17UL)
6270 #define HWRM_DBG_COREDUMP_INITIATE (0xff18UL)
6271 #define HWRM_DBG_COREDUMP_RETRIEVE (0xff19UL)
5952 #define HWRM_NVM_FACTORY_DEFAULTS (0xffeeUL)6272 #define HWRM_NVM_FACTORY_DEFAULTS (0xffeeUL)
5953 #define HWRM_NVM_VALIDATE_OPTION (0xffefUL)6273 #define HWRM_NVM_VALIDATE_OPTION (0xffefUL)
5954 #define HWRM_NVM_FLUSH (0xfff0UL)6274 #define HWRM_NVM_FLUSH (0xfff0UL)
@@ -6123,6 +6443,58 @@ struct rx_port_stats { · 168 unmodified lines
6123 __le64 rx_stat_err;6443 __le64 rx_stat_err;
6124};6444};
6125 6445
6446/* VXLAN IPv4 encapsulation structure (16 bytes) */
6447struct hwrm_vxlan_ipv4_hdr {
6448 u8 ver_hlen;
6449 #define VXLAN_IPV4_HDR_VER_HLEN_HEADER_LENGTH_MASK 0xfUL
6450 #define VXLAN_IPV4_HDR_VER_HLEN_HEADER_LENGTH_SFT 0
6451 #define VXLAN_IPV4_HDR_VER_HLEN_VERSION_MASK 0xf0UL
6452 #define VXLAN_IPV4_HDR_VER_HLEN_VERSION_SFT 4
6453 u8 tos;
6454 __be16 ip_id;
6455 __be16 flags_frag_offset;
6456 u8 ttl;
6457 u8 protocol;
6458 __be32 src_ip_addr;
6459 __be32 dest_ip_addr;
6460};
6461
6462/* VXLAN IPv6 encapsulation structure (32 bytes) */
6463struct hwrm_vxlan_ipv6_hdr {
6464 __be32 ver_tc_flow_label;
6465 #define VXLAN_IPV6_HDR_VER_TC_FLOW_LABEL_VER_SFT 0x1cUL
6466 #define VXLAN_IPV6_HDR_VER_TC_FLOW_LABEL_VER_MASK 0xf0000000UL
6467 #define VXLAN_IPV6_HDR_VER_TC_FLOW_LABEL_TC_SFT 0x14UL
6468 #define VXLAN_IPV6_HDR_VER_TC_FLOW_LABEL_TC_MASK 0xff00000UL
6469 #define VXLAN_IPV6_HDR_VER_TC_FLOW_LABEL_FLOW_LABEL_SFT 0x0UL
6470 #define VXLAN_IPV6_HDR_VER_TC_FLOW_LABEL_FLOW_LABEL_MASK 0xfffffUL
6471 __be16 payload_len;
6472 u8 next_hdr;
6473 u8 ttl;
6474 __be32 src_ip_addr[4];
6475 __be32 dest_ip_addr[4];
6476};
6477
6478/* VXLAN encapsulation structure (72 bytes) */
6479struct hwrm_cfa_encap_data_vxlan {
6480 u8 src_mac_addr[6];
6481 __le16 unused_0;
6482 u8 dst_mac_addr[6];
6483 u8 num_vlan_tags;
6484 u8 unused_1;
6485 __be16 ovlan_tpid;
6486 __be16 ovlan_tci;
6487 __be16 ivlan_tpid;
6488 __be16 ivlan_tci;
6489 __le32 l3[10];
6490 #define CFA_ENCAP_DATA_VXLAN_L3_VER_MASK 0xfUL
6491 #define CFA_ENCAP_DATA_VXLAN_L3_VER_IPV4 0x4UL
6492 #define CFA_ENCAP_DATA_VXLAN_L3_VER_IPV6 0x6UL
6493 __be16 src_port;
6494 __be16 dst_port;
6495 __be32 vni;
6496};
6497
6126/* Periodic Statistics Context DMA to host (160 bytes) */6498/* Periodic Statistics Context DMA to host (160 bytes) */
6127struct ctx_hw_stats {6499struct ctx_hw_stats {
6128 __le64 rx_ucast_pkts;6500 __le64 rx_ucast_pkts;
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c+862−84
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include <net/tc_act/tc_skbedit.h>16#include <net/tc_act/tc_skbedit.h>
17#include <net/tc_act/tc_mirred.h>17#include <net/tc_act/tc_mirred.h>
18#include <net/tc_act/tc_vlan.h>18#include <net/tc_act/tc_vlan.h>
19#include <net/tc_act/tc_tunnel_key.h>
19 20
20#include "bnxt_hsi.h"21#include "bnxt_hsi.h"
21#include "bnxt.h"22#include "bnxt.h"
@@ -23,8 +24,6 @@ · 1 unmodified line
23#include "bnxt_tc.h"24#include "bnxt_tc.h"
24#include "bnxt_vfr.h"25#include "bnxt_vfr.h"
25 26
26#ifdef CONFIG_BNXT_FLOWER_OFFLOAD
27
28#define BNXT_FID_INVALID 0xffff27#define BNXT_FID_INVALID 0xffff
29#define VLAN_TCI(vid, prio) ((vid) | ((prio) << VLAN_PRIO_SHIFT))28#define VLAN_TCI(vid, prio) ((vid) | ((prio) << VLAN_PRIO_SHIFT))
30 29
@@ -91,6 +90,23 @@ static void bnxt_tc_parse_vlan(struct bnxt *bp, · 60 unmodified lines
91 }90 }
92}91}
93 92
93static int bnxt_tc_parse_tunnel_set(struct bnxt *bp,
94 struct bnxt_tc_actions *actions,
95 const struct tc_action *tc_act)
96{
97 struct ip_tunnel_info *tun_info = tcf_tunnel_info(tc_act);
98 struct ip_tunnel_key *tun_key = &tun_info->key;
99
100 if (ip_tunnel_info_af(tun_info) != AF_INET) {
101 netdev_info(bp->dev, "only IPv4 tunnel-encap is supported");
102 return -EOPNOTSUPP;
103 }
104
105 actions->tun_encap_key = *tun_key;
106 actions->flags |= BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP;
107 return 0;
108}
109
94static int bnxt_tc_parse_actions(struct bnxt *bp,110static int bnxt_tc_parse_actions(struct bnxt *bp,
95 struct bnxt_tc_actions *actions,111 struct bnxt_tc_actions *actions,
96 struct tcf_exts *tc_exts)112 struct tcf_exts *tc_exts)
@@ -125,9 +141,35 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, · 28 unmodified lines
125 bnxt_tc_parse_vlan(bp, actions, tc_act);141 bnxt_tc_parse_vlan(bp, actions, tc_act);
126 continue;142 continue;
127 }143 }
144
145 /* Tunnel encap */
146 if (is_tcf_tunnel_set(tc_act)) {
147 rc = bnxt_tc_parse_tunnel_set(bp, actions, tc_act);
148 if (rc)
149 return rc;
150 continue;
151 }
152
153 /* Tunnel decap */
154 if (is_tcf_tunnel_release(tc_act)) {
155 actions->flags |= BNXT_TC_ACTION_FLAG_TUNNEL_DECAP;
156 continue;
157 }
128 }158 }
129 159
130 return 0;160 if (rc)
161 return rc;
162
163 /* Tunnel encap/decap action must be accompanied by a redirect action */
164 if ((actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP ||
165 actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP) &&
166 !(actions->flags & BNXT_TC_ACTION_FLAG_FWD)) {
167 netdev_info(bp->dev,
168 "error: no redir action along with encap/decap");
169 return -EINVAL;
170 }
171
172 return rc;
131}173}
132 174
133#define GET_KEY(flow_cmd, key_type) \175#define GET_KEY(flow_cmd, key_type) \
@@ -254,6 +296,54 @@ static int bnxt_tc_parse_flow(struct bnxt *bp, · 120 unmodified lines
254 flow->l4_mask.icmp.code = mask->code;296 flow->l4_mask.icmp.code = mask->code;
255 }297 }
256 298
299 if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
300 struct flow_dissector_key_control *key =
301 GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_CONTROL);
302
303 addr_type = key->addr_type;
304 }
305
306 if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS)) {
307 struct flow_dissector_key_ipv4_addrs *key =
308 GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS);
309 struct flow_dissector_key_ipv4_addrs *mask =
310 GET_MASK(tc_flow_cmd,
311 FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS);
312
313 flow->flags |= BNXT_TC_FLOW_FLAGS_TUNL_IPV4_ADDRS;
314 flow->tun_key.u.ipv4.dst = key->dst;
315 flow->tun_mask.u.ipv4.dst = mask->dst;
316 flow->tun_key.u.ipv4.src = key->src;
317 flow->tun_mask.u.ipv4.src = mask->src;
318 } else if (dissector_uses_key(dissector,
319 FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS)) {
320 return -EOPNOTSUPP;
321 }
322
323 if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_ENC_KEYID)) {
324 struct flow_dissector_key_keyid *key =
325 GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_KEYID);
326 struct flow_dissector_key_keyid *mask =
327 GET_MASK(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_KEYID);
328
329 flow->flags |= BNXT_TC_FLOW_FLAGS_TUNL_ID;
330 flow->tun_key.tun_id = key32_to_tunnel_id(key->keyid);
331 flow->tun_mask.tun_id = key32_to_tunnel_id(mask->keyid);
332 }
333
334 if (dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_ENC_PORTS)) {
335 struct flow_dissector_key_ports *key =
336 GET_KEY(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_PORTS);
337 struct flow_dissector_key_ports *mask =
338 GET_MASK(tc_flow_cmd, FLOW_DISSECTOR_KEY_ENC_PORTS);
339
340 flow->flags |= BNXT_TC_FLOW_FLAGS_TUNL_PORTS;
341 flow->tun_key.tp_dst = key->dst;
342 flow->tun_mask.tp_dst = mask->dst;
343 flow->tun_key.tp_src = key->src;
344 flow->tun_mask.tp_src = mask->src;
345 }
346
257 return bnxt_tc_parse_actions(bp, &flow->actions, tc_flow_cmd->exts);347 return bnxt_tc_parse_actions(bp, &flow->actions, tc_flow_cmd->exts);
258}348}
259 349
@@ -295,7 +385,8 @@ static bool is_wildcard(void *mask, int len) · 35 unmodified lines
295}385}
296 386
297static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow,387static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow,
298 __le16 ref_flow_handle, __le16 *flow_handle)388 __le16 ref_flow_handle,
389 __le32 tunnel_handle, __le16 *flow_handle)
299{390{
300 struct hwrm_cfa_flow_alloc_output *resp = bp->hwrm_cmd_resp_addr;391 struct hwrm_cfa_flow_alloc_output *resp = bp->hwrm_cmd_resp_addr;
301 struct bnxt_tc_actions *actions = &flow->actions;392 struct bnxt_tc_actions *actions = &flow->actions;
@@ -309,6 +400,14 @@ static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow, · 7 unmodified lines
309 400
310 req.src_fid = cpu_to_le16(flow->src_fid);401 req.src_fid = cpu_to_le16(flow->src_fid);
311 req.ref_flow_handle = ref_flow_handle;402 req.ref_flow_handle = ref_flow_handle;
403
404 if (actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP ||
405 actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP) {
406 req.tunnel_handle = tunnel_handle;
407 flow_flags |= CFA_FLOW_ALLOC_REQ_FLAGS_TUNNEL;
408 action_flags |= CFA_FLOW_ALLOC_REQ_ACTION_FLAGS_TUNNEL;
409 }
410
312 req.ethertype = flow->l2_key.ether_type;411 req.ethertype = flow->l2_key.ether_type;
313 req.ip_proto = flow->l4_key.ip_proto;412 req.ip_proto = flow->l4_key.ip_proto;
314 413
@@ -405,78 +504,153 @@ static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow, · 90 unmodified lines
405 return rc;504 return rc;
406}505}
407 506
408/* Add val to accum while handling a possible wraparound507static int hwrm_cfa_decap_filter_alloc(struct bnxt *bp,
409 * of val. Eventhough val is of type u64, its actual width508 struct bnxt_tc_flow *flow,
410 * is denoted by mask and will wrap-around beyond that width.509 struct bnxt_tc_l2_key *l2_info,
411 */510 __le32 ref_decap_handle,
412static void accumulate_val(u64 *accum, u64 val, u64 mask)511 __le32 *decap_filter_handle)
413{512{
414#define low_bits(x, mask) ((x) & (mask))513 struct hwrm_cfa_decap_filter_alloc_output *resp =
415#define high_bits(x, mask) ((x) & ~(mask))514 bp->hwrm_cmd_resp_addr;
416 bool wrapped = val < low_bits(*accum, mask);515 struct hwrm_cfa_decap_filter_alloc_input req = { 0 };
516 struct ip_tunnel_key *tun_key = &flow->tun_key;
517 u32 enables = 0;
518 int rc;
417 519
418 *accum = high_bits(*accum, mask) + val;520 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_CFA_DECAP_FILTER_ALLOC, -1, -1);
419 if (wrapped)
420 *accum += (mask + 1);
421}
422 521
423/* The HW counters' width is much less than 64bits.522 req.flags = cpu_to_le32(CFA_DECAP_FILTER_ALLOC_REQ_FLAGS_OVS_TUNNEL);
424 * Handle possible wrap-around while updating the stat counters523 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_TUNNEL_TYPE |
425 */524 CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_IP_PROTOCOL;
426static void bnxt_flow_stats_fix_wraparound(struct bnxt_tc_info *tc_info,525 req.tunnel_type = CFA_DECAP_FILTER_ALLOC_REQ_TUNNEL_TYPE_VXLAN;
427 struct bnxt_tc_flow_stats *stats,526 req.ip_protocol = CFA_DECAP_FILTER_ALLOC_REQ_IP_PROTOCOL_UDP;
428 struct bnxt_tc_flow_stats *hw_stats)527
429{528 if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_ID) {
430 accumulate_val(&stats->bytes, hw_stats->bytes, tc_info->bytes_mask);529 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_TUNNEL_ID;
431 accumulate_val(&stats->packets, hw_stats->packets,530 /* tunnel_id is wrongly defined in hsi defn. as __le32 */
432 tc_info->packets_mask);531 req.tunnel_id = tunnel_id_to_key32(tun_key->tun_id);
532 }
533
534 if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS) {
535 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_MACADDR |
536 CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_MACADDR;
537 ether_addr_copy(req.dst_macaddr, l2_info->dmac);
538 ether_addr_copy(req.src_macaddr, l2_info->smac);
539 }
540 if (l2_info->num_vlans) {
541 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_T_IVLAN_VID;
542 req.t_ivlan_vid = l2_info->inner_vlan_tci;
543 }
544
545 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_ETHERTYPE;
546 req.ethertype = htons(ETH_P_IP);
547
548 if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_IPV4_ADDRS) {
549 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_IPADDR |
550 CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_IPADDR |
551 CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_IPADDR_TYPE;
552 req.ip_addr_type = CFA_DECAP_FILTER_ALLOC_REQ_IP_ADDR_TYPE_IPV4;
553 req.dst_ipaddr[0] = tun_key->u.ipv4.dst;
554 req.src_ipaddr[0] = tun_key->u.ipv4.src;
555 }
556
557 if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_PORTS) {
558 enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_PORT;
559 req.dst_port = tun_key->tp_dst;
560 }
561
562 /* Eventhough the decap_handle returned by hwrm_cfa_decap_filter_alloc
563 * is defined as __le32, l2_ctxt_ref_id is defined in HSI as __le16.
564 */
565 req.l2_ctxt_ref_id = (__force __le16)ref_decap_handle;
566 req.enables = cpu_to_le32(enables);
567
568 mutex_lock(&bp->hwrm_cmd_lock);
569 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
570 if (!rc)
571 *decap_filter_handle = resp->decap_filter_id;
572 else
573 netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);
574 mutex_unlock(&bp->hwrm_cmd_lock);
575
576 return rc;
433}577}
434 578
435/* Fix possible wraparound of the stats queried from HW, calculate579static int hwrm_cfa_decap_filter_free(struct bnxt *bp,
436 * the delta from prev_stats, and also update the prev_stats.580 __le32 decap_filter_handle)
437 * The HW flow stats are fetched under the hwrm_cmd_lock mutex.
438 * This routine is best called while under the mutex so that the
439 * stats processing happens atomically.
440 */
441static void bnxt_flow_stats_calc(struct bnxt_tc_info *tc_info,
442 struct bnxt_tc_flow *flow,
443 struct bnxt_tc_flow_stats *stats)
444{581{
445 struct bnxt_tc_flow_stats *acc_stats, *prev_stats;582 struct hwrm_cfa_decap_filter_free_input req = { 0 };
583 int rc;
446 584
447 acc_stats = &flow->stats;585 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_CFA_DECAP_FILTER_FREE, -1, -1);
448 bnxt_flow_stats_fix_wraparound(tc_info, acc_stats, stats);586 req.decap_filter_id = decap_filter_handle;
449 587
450 prev_stats = &flow->prev_stats;588 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
451 stats->bytes = acc_stats->bytes - prev_stats->bytes;589 if (rc)
452 stats->packets = acc_stats->packets - prev_stats->packets;590 netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);
453 *prev_stats = *acc_stats;591 return rc;
454}592}
455 593
456static int bnxt_hwrm_cfa_flow_stats_get(struct bnxt *bp,594static int hwrm_cfa_encap_record_alloc(struct bnxt *bp,
457 __le16 flow_handle,595 struct ip_tunnel_key *encap_key,
458 struct bnxt_tc_flow *flow,596 struct bnxt_tc_l2_key *l2_info,
459 struct bnxt_tc_flow_stats *stats)597 __le32 *encap_record_handle)
460{598{
461 struct hwrm_cfa_flow_stats_output *resp = bp->hwrm_cmd_resp_addr;599 struct hwrm_cfa_encap_record_alloc_output *resp =
462 struct hwrm_cfa_flow_stats_input req = { 0 };600 bp->hwrm_cmd_resp_addr;
601 struct hwrm_cfa_encap_record_alloc_input req = { 0 };
602 struct hwrm_cfa_encap_data_vxlan *encap =
603 (struct hwrm_cfa_encap_data_vxlan *)&req.encap_data;
604 struct hwrm_vxlan_ipv4_hdr *encap_ipv4 =
605 (struct hwrm_vxlan_ipv4_hdr *)encap->l3;
463 int rc;606 int rc;
464 607
465 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_CFA_FLOW_STATS, -1, -1);608 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_CFA_ENCAP_RECORD_ALLOC, -1, -1);
466 req.num_flows = cpu_to_le16(1);
467 req.flow_handle_0 = flow_handle;
468 609
469 mutex_lock(&bp->hwrm_cmd_lock);610 req.encap_type = CFA_ENCAP_RECORD_ALLOC_REQ_ENCAP_TYPE_VXLAN;
470 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);611
471 if (!rc) {612 ether_addr_copy(encap->dst_mac_addr, l2_info->dmac);
472 stats->packets = le64_to_cpu(resp->packet_0);613 ether_addr_copy(encap->src_mac_addr, l2_info->smac);
473 stats->bytes = le64_to_cpu(resp->byte_0);614 if (l2_info->num_vlans) {
474 bnxt_flow_stats_calc(&bp->tc_info, flow, stats);615 encap->num_vlan_tags = l2_info->num_vlans;
475 } else {616 encap->ovlan_tci = l2_info->inner_vlan_tci;
476 netdev_info(bp->dev, "error rc=%d", rc);617 encap->ovlan_tpid = l2_info->inner_vlan_tpid;
477 }618 }
478 619
620 encap_ipv4->ver_hlen = 4 << VXLAN_IPV4_HDR_VER_HLEN_VERSION_SFT;
621 encap_ipv4->ver_hlen |= 5 << VXLAN_IPV4_HDR_VER_HLEN_HEADER_LENGTH_SFT;
622 encap_ipv4->ttl = encap_key->ttl;
623
624 encap_ipv4->dest_ip_addr = encap_key->u.ipv4.dst;
625 encap_ipv4->src_ip_addr = encap_key->u.ipv4.src;
626 encap_ipv4->protocol = IPPROTO_UDP;
627
628 encap->dst_port = encap_key->tp_dst;
629 encap->vni = tunnel_id_to_key32(encap_key->tun_id);
630
631 mutex_lock(&bp->hwrm_cmd_lock);
632 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
633 if (!rc)
634 *encap_record_handle = resp->encap_record_id;
635 else
636 netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);
479 mutex_unlock(&bp->hwrm_cmd_lock);637 mutex_unlock(&bp->hwrm_cmd_lock);
638
639 return rc;
640}
641
642static int hwrm_cfa_encap_record_free(struct bnxt *bp,
643 __le32 encap_record_handle)
644{
645 struct hwrm_cfa_encap_record_free_input req = { 0 };
646 int rc;
647
648 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_CFA_ENCAP_RECORD_FREE, -1, -1);
649 req.encap_record_id = encap_record_handle;
650
651 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
652 if (rc)
653 netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);
480 return rc;654 return rc;
481}655}
482 656
@@ -484,7 +658,7 @@ static int bnxt_tc_put_l2_node(struct bnxt *bp, · 1 unmodified line
484 struct bnxt_tc_flow_node *flow_node)658 struct bnxt_tc_flow_node *flow_node)
485{659{
486 struct bnxt_tc_l2_node *l2_node = flow_node->l2_node;660 struct bnxt_tc_l2_node *l2_node = flow_node->l2_node;
487 struct bnxt_tc_info *tc_info = &bp->tc_info;661 struct bnxt_tc_info *tc_info = bp->tc_info;
488 int rc;662 int rc;
489 663
490 /* remove flow_node from the L2 shared flow list */664 /* remove flow_node from the L2 shared flow list */
@@ -521,7 +695,7 @@ bnxt_tc_get_l2_node(struct bnxt *bp, struct rhashtable *l2_table, · 30 unmodified lines
521 rc = rhashtable_insert_fast(l2_table, &l2_node->node,695 rc = rhashtable_insert_fast(l2_table, &l2_node->node,
522 ht_params);696 ht_params);
523 if (rc) {697 if (rc) {
524 kfree(l2_node);698 kfree_rcu(l2_node, rcu);
525 netdev_err(bp->dev,699 netdev_err(bp->dev,
526 "Error: %s: rhashtable_insert_fast: %d",700 "Error: %s: rhashtable_insert_fast: %d",
527 __func__, rc);701 __func__, rc);
@@ -540,7 +714,7 @@ bnxt_tc_get_ref_flow_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, · 12 unmodified lines
540 struct bnxt_tc_flow_node *flow_node,714 struct bnxt_tc_flow_node *flow_node,
541 __le16 *ref_flow_handle)715 __le16 *ref_flow_handle)
542{716{
543 struct bnxt_tc_info *tc_info = &bp->tc_info;717 struct bnxt_tc_info *tc_info = bp->tc_info;
544 struct bnxt_tc_flow_node *ref_flow_node;718 struct bnxt_tc_flow_node *ref_flow_node;
545 struct bnxt_tc_l2_node *l2_node;719 struct bnxt_tc_l2_node *l2_node;
546 720
@@ -590,10 +764,386 @@ static bool bnxt_tc_can_offload(struct bnxt *bp, struct bnxt_tc_flow *flow) · 43 unmodified lines
590 return true;764 return true;
591}765}
592 766
767/* Returns the final refcount of the node on success
768 * or a -ve error code on failure
769 */
770static int bnxt_tc_put_tunnel_node(struct bnxt *bp,
771 struct rhashtable *tunnel_table,
772 struct rhashtable_params *ht_params,
773 struct bnxt_tc_tunnel_node *tunnel_node)
774{
775 int rc;
776
777 if (--tunnel_node->refcount == 0) {
778 rc = rhashtable_remove_fast(tunnel_table, &tunnel_node->node,
779 *ht_params);
780 if (rc) {
781 netdev_err(bp->dev, "rhashtable_remove_fast rc=%d", rc);
782 rc = -1;
783 }
784 kfree_rcu(tunnel_node, rcu);
785 return rc;
786 } else {
787 return tunnel_node->refcount;
788 }
789}
790
791/* Get (or add) either encap or decap tunnel node from/to the supplied
792 * hash table.
793 */
794static struct bnxt_tc_tunnel_node *
795bnxt_tc_get_tunnel_node(struct bnxt *bp, struct rhashtable *tunnel_table,
796 struct rhashtable_params *ht_params,
797 struct ip_tunnel_key *tun_key)
798{
799 struct bnxt_tc_tunnel_node *tunnel_node;
800 int rc;
801
802 tunnel_node = rhashtable_lookup_fast(tunnel_table, tun_key, *ht_params);
803 if (!tunnel_node) {
804 tunnel_node = kzalloc(sizeof(*tunnel_node), GFP_KERNEL);
805 if (!tunnel_node) {
806 rc = -ENOMEM;
807 goto err;
808 }
809
810 tunnel_node->key = *tun_key;
811 tunnel_node->tunnel_handle = INVALID_TUNNEL_HANDLE;
812 rc = rhashtable_insert_fast(tunnel_table, &tunnel_node->node,
813 *ht_params);
814 if (rc) {
815 kfree_rcu(tunnel_node, rcu);
816 goto err;
817 }
818 }
819 tunnel_node->refcount++;
820 return tunnel_node;
821err:
822 netdev_info(bp->dev, "error rc=%d", rc);
823 return NULL;
824}
825
826static int bnxt_tc_get_ref_decap_handle(struct bnxt *bp,
827 struct bnxt_tc_flow *flow,
828 struct bnxt_tc_l2_key *l2_key,
829 struct bnxt_tc_flow_node *flow_node,
830 __le32 *ref_decap_handle)
831{
832 struct bnxt_tc_info *tc_info = bp->tc_info;
833 struct bnxt_tc_flow_node *ref_flow_node;
834 struct bnxt_tc_l2_node *decap_l2_node;
835
836 decap_l2_node = bnxt_tc_get_l2_node(bp, &tc_info->decap_l2_table,
837 tc_info->decap_l2_ht_params,
838 l2_key);
839 if (!decap_l2_node)
840 return -1;
841
842 /* If any other flow is using this decap_l2_node, use it's decap_handle
843 * as the ref_decap_handle
844 */
845 if (decap_l2_node->refcount > 0) {
846 ref_flow_node =
847 list_first_entry(&decap_l2_node->common_l2_flows,
848 struct bnxt_tc_flow_node,
849 decap_l2_list_node);
850 *ref_decap_handle = ref_flow_node->decap_node->tunnel_handle;
851 } else {
852 *ref_decap_handle = INVALID_TUNNEL_HANDLE;
853 }
854
855 /* Insert the l2_node into the flow_node so that subsequent flows
856 * with a matching decap l2 key can use the decap_filter_handle of
857 * this flow as their ref_decap_handle
858 */
859 flow_node->decap_l2_node = decap_l2_node;
860 list_add(&flow_node->decap_l2_list_node,
861 &decap_l2_node->common_l2_flows);
862 decap_l2_node->refcount++;
863 return 0;
864}
865
866static void bnxt_tc_put_decap_l2_node(struct bnxt *bp,
867 struct bnxt_tc_flow_node *flow_node)
868{
869 struct bnxt_tc_l2_node *decap_l2_node = flow_node->decap_l2_node;
870 struct bnxt_tc_info *tc_info = bp->tc_info;
871 int rc;
872
873 /* remove flow_node from the decap L2 sharing flow list */
874 list_del(&flow_node->decap_l2_list_node);
875 if (--decap_l2_node->refcount == 0) {
876 rc = rhashtable_remove_fast(&tc_info->decap_l2_table,
877 &decap_l2_node->node,
878 tc_info->decap_l2_ht_params);
879 if (rc)
880 netdev_err(bp->dev, "rhashtable_remove_fast rc=%d", rc);
881 kfree_rcu(decap_l2_node, rcu);
882 }
883}
884
885static void bnxt_tc_put_decap_handle(struct bnxt *bp,
886 struct bnxt_tc_flow_node *flow_node)
887{
888 __le32 decap_handle = flow_node->decap_node->tunnel_handle;
889 struct bnxt_tc_info *tc_info = bp->tc_info;
890 int rc;
891
892 if (flow_node->decap_l2_node)
893 bnxt_tc_put_decap_l2_node(bp, flow_node);
894
895 rc = bnxt_tc_put_tunnel_node(bp, &tc_info->decap_table,
896 &tc_info->decap_ht_params,
897 flow_node->decap_node);
898 if (!rc && decap_handle != INVALID_TUNNEL_HANDLE)
899 hwrm_cfa_decap_filter_free(bp, decap_handle);
900}
901
902static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp,
903 struct ip_tunnel_key *tun_key,
904 struct bnxt_tc_l2_key *l2_info,
905 struct net_device *real_dst_dev)
906{
907#ifdef CONFIG_INET
908 struct flowi4 flow = { {0} };
909 struct net_device *dst_dev;
910 struct neighbour *nbr;
911 struct rtable *rt;
912 int rc;
913
914 flow.flowi4_proto = IPPROTO_UDP;
915 flow.fl4_dport = tun_key->tp_dst;
916 flow.daddr = tun_key->u.ipv4.dst;
917
918 rt = ip_route_output_key(dev_net(real_dst_dev), &flow);
919 if (IS_ERR(rt)) {
920 netdev_info(bp->dev, "no route to %pI4b", &flow.daddr);
921 return -EOPNOTSUPP;
922 }
923
924 /* The route must either point to the real_dst_dev or a dst_dev that
925 * uses the real_dst_dev.
926 */
927 dst_dev = rt->dst.dev;
928 if (is_vlan_dev(dst_dev)) {
929#if IS_ENABLED(CONFIG_VLAN_8021Q)
930 struct vlan_dev_priv *vlan = vlan_dev_priv(dst_dev);
931
932 if (vlan->real_dev != real_dst_dev) {
933 netdev_info(bp->dev,
934 "dst_dev(%s) doesn't use PF-if(%s)",
935 netdev_name(dst_dev),
936 netdev_name(real_dst_dev));
937 rc = -EOPNOTSUPP;
938 goto put_rt;
939 }
940 l2_info->inner_vlan_tci = htons(vlan->vlan_id);
941 l2_info->inner_vlan_tpid = vlan->vlan_proto;
942 l2_info->num_vlans = 1;
943#endif
944 } else if (dst_dev != real_dst_dev) {
945 netdev_info(bp->dev,
946 "dst_dev(%s) for %pI4b is not PF-if(%s)",
947 netdev_name(dst_dev), &flow.daddr,
948 netdev_name(real_dst_dev));
949 rc = -EOPNOTSUPP;
950 goto put_rt;
951 }
952
953 nbr = dst_neigh_lookup(&rt->dst, &flow.daddr);
954 if (!nbr) {
955 netdev_info(bp->dev, "can't lookup neighbor for %pI4b",
956 &flow.daddr);
957 rc = -EOPNOTSUPP;
958 goto put_rt;
959 }
960
961 tun_key->u.ipv4.src = flow.saddr;
962 tun_key->ttl = ip4_dst_hoplimit(&rt->dst);
963 neigh_ha_snapshot(l2_info->dmac, nbr, dst_dev);
964 ether_addr_copy(l2_info->smac, dst_dev->dev_addr);
965 neigh_release(nbr);
966 ip_rt_put(rt);
967
968 return 0;
969put_rt:
970 ip_rt_put(rt);
971 return rc;
972#else
973 return -EOPNOTSUPP;
974#endif
975}
976
977static int bnxt_tc_get_decap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow,
978 struct bnxt_tc_flow_node *flow_node,
979 __le32 *decap_filter_handle)
980{
981 struct ip_tunnel_key *decap_key = &flow->tun_key;
982 struct bnxt_tc_info *tc_info = bp->tc_info;
983 struct bnxt_tc_l2_key l2_info = { {0} };
984 struct bnxt_tc_tunnel_node *decap_node;
985 struct ip_tunnel_key tun_key = { 0 };
986 struct bnxt_tc_l2_key *decap_l2_info;
987 __le32 ref_decap_handle;
988 int rc;
989
990 /* Check if there's another flow using the same tunnel decap.
991 * If not, add this tunnel to the table and resolve the other
992 * tunnel header fileds
993 */
994 decap_node = bnxt_tc_get_tunnel_node(bp, &tc_info->decap_table,
995 &tc_info->decap_ht_params,
996 decap_key);
997 if (!decap_node)
998 return -ENOMEM;
999
1000 flow_node->decap_node = decap_node;
1001
1002 if (decap_node->tunnel_handle != INVALID_TUNNEL_HANDLE)
1003 goto done;
1004
1005 /* Resolve the L2 fields for tunnel decap
1006 * Resolve the route for remote vtep (saddr) of the decap key
1007 * Find it's next-hop mac addrs
1008 */
1009 tun_key.u.ipv4.dst = flow->tun_key.u.ipv4.src;
1010 tun_key.tp_dst = flow->tun_key.tp_dst;
1011 rc = bnxt_tc_resolve_tunnel_hdrs(bp, &tun_key, &l2_info, bp->dev);
1012 if (rc)
1013 goto put_decap;
1014
1015 decap_key->ttl = tun_key.ttl;
1016 decap_l2_info = &decap_node->l2_info;
1017 ether_addr_copy(decap_l2_info->dmac, l2_info.smac);
1018 ether_addr_copy(decap_l2_info->smac, l2_info.dmac);
1019 if (l2_info.num_vlans) {
1020 decap_l2_info->num_vlans = l2_info.num_vlans;
1021 decap_l2_info->inner_vlan_tpid = l2_info.inner_vlan_tpid;
1022 decap_l2_info->inner_vlan_tci = l2_info.inner_vlan_tci;
1023 }
1024 flow->flags |= BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS;
1025
1026 /* For getting a decap_filter_handle we first need to check if
1027 * there are any other decap flows that share the same tunnel L2
1028 * key and if so, pass that flow's decap_filter_handle as the
1029 * ref_decap_handle for this flow.
1030 */
1031 rc = bnxt_tc_get_ref_decap_handle(bp, flow, decap_l2_info, flow_node,
1032 &ref_decap_handle);
1033 if (rc)
1034 goto put_decap;
1035
1036 /* Issue the hwrm cmd to allocate a decap filter handle */
1037 rc = hwrm_cfa_decap_filter_alloc(bp, flow, decap_l2_info,
1038 ref_decap_handle,
1039 &decap_node->tunnel_handle);
1040 if (rc)
1041 goto put_decap_l2;
1042
1043done:
1044 *decap_filter_handle = decap_node->tunnel_handle;
1045 return 0;
1046
1047put_decap_l2:
1048 bnxt_tc_put_decap_l2_node(bp, flow_node);
1049put_decap:
1050 bnxt_tc_put_tunnel_node(bp, &tc_info->decap_table,
1051 &tc_info->decap_ht_params,
1052 flow_node->decap_node);
1053 return rc;
1054}
1055
1056static void bnxt_tc_put_encap_handle(struct bnxt *bp,
1057 struct bnxt_tc_tunnel_node *encap_node)
1058{
1059 __le32 encap_handle = encap_node->tunnel_handle;
1060 struct bnxt_tc_info *tc_info = bp->tc_info;
1061 int rc;
1062
1063 rc = bnxt_tc_put_tunnel_node(bp, &tc_info->encap_table,
1064 &tc_info->encap_ht_params, encap_node);
1065 if (!rc && encap_handle != INVALID_TUNNEL_HANDLE)
1066 hwrm_cfa_encap_record_free(bp, encap_handle);
1067}
1068
1069/* Lookup the tunnel encap table and check if there's an encap_handle
1070 * alloc'd already.
1071 * If not, query L2 info via a route lookup and issue an encap_record_alloc
1072 * cmd to FW.
1073 */
1074static int bnxt_tc_get_encap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow,
1075 struct bnxt_tc_flow_node *flow_node,
1076 __le32 *encap_handle)
1077{
1078 struct ip_tunnel_key *encap_key = &flow->actions.tun_encap_key;
1079 struct bnxt_tc_info *tc_info = bp->tc_info;
1080 struct bnxt_tc_tunnel_node *encap_node;
1081 int rc;
1082
1083 /* Check if there's another flow using the same tunnel encap.
1084 * If not, add this tunnel to the table and resolve the other
1085 * tunnel header fileds
1086 */
1087 encap_node = bnxt_tc_get_tunnel_node(bp, &tc_info->encap_table,
1088 &tc_info->encap_ht_params,
1089 encap_key);
1090 if (!encap_node)
1091 return -ENOMEM;
1092
1093 flow_node->encap_node = encap_node;
1094
1095 if (encap_node->tunnel_handle != INVALID_TUNNEL_HANDLE)
1096 goto done;
1097
1098 rc = bnxt_tc_resolve_tunnel_hdrs(bp, encap_key, &encap_node->l2_info,
1099 flow->actions.dst_dev);
1100 if (rc)
1101 goto put_encap;
1102
1103 /* Allocate a new tunnel encap record */
1104 rc = hwrm_cfa_encap_record_alloc(bp, encap_key, &encap_node->l2_info,
1105 &encap_node->tunnel_handle);
1106 if (rc)
1107 goto put_encap;
1108
1109done:
1110 *encap_handle = encap_node->tunnel_handle;
1111 return 0;
1112
1113put_encap:
1114 bnxt_tc_put_tunnel_node(bp, &tc_info->encap_table,
1115 &tc_info->encap_ht_params, encap_node);
1116 return rc;
1117}
1118
1119static void bnxt_tc_put_tunnel_handle(struct bnxt *bp,
1120 struct bnxt_tc_flow *flow,
1121 struct bnxt_tc_flow_node *flow_node)
1122{
1123 if (flow->actions.flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP)
1124 bnxt_tc_put_decap_handle(bp, flow_node);
1125 else if (flow->actions.flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP)
1126 bnxt_tc_put_encap_handle(bp, flow_node->encap_node);
1127}
1128
1129static int bnxt_tc_get_tunnel_handle(struct bnxt *bp,
1130 struct bnxt_tc_flow *flow,
1131 struct bnxt_tc_flow_node *flow_node,
1132 __le32 *tunnel_handle)
1133{
1134 if (flow->actions.flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP)
1135 return bnxt_tc_get_decap_handle(bp, flow, flow_node,
1136 tunnel_handle);
1137 else if (flow->actions.flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP)
1138 return bnxt_tc_get_encap_handle(bp, flow, flow_node,
1139 tunnel_handle);
1140 else
1141 return 0;
1142}
593static int __bnxt_tc_del_flow(struct bnxt *bp,1143static int __bnxt_tc_del_flow(struct bnxt *bp,
594 struct bnxt_tc_flow_node *flow_node)1144 struct bnxt_tc_flow_node *flow_node)
595{1145{
596 struct bnxt_tc_info *tc_info = &bp->tc_info;1146 struct bnxt_tc_info *tc_info = bp->tc_info;
597 int rc;1147 int rc;
598 1148
599 /* send HWRM cmd to free the flow-id */1149 /* send HWRM cmd to free the flow-id */
@@ -601,6 +1151,9 @@ static int __bnxt_tc_del_flow(struct bnxt *bp, · 1 unmodified line
601 1151
602 mutex_lock(&tc_info->lock);1152 mutex_lock(&tc_info->lock);
603 1153
1154 /* release references to any tunnel encap/decap nodes */
1155 bnxt_tc_put_tunnel_handle(bp, &flow_node->flow, flow_node);
1156
604 /* release reference to l2 node */1157 /* release reference to l2 node */
605 bnxt_tc_put_l2_node(bp, flow_node);1158 bnxt_tc_put_l2_node(bp, flow_node);
606 1159
@@ -633,8 +1186,9 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, · 26 unmodified lines
633 struct tc_cls_flower_offload *tc_flow_cmd)1186 struct tc_cls_flower_offload *tc_flow_cmd)
634{1187{
635 struct bnxt_tc_flow_node *new_node, *old_node;1188 struct bnxt_tc_flow_node *new_node, *old_node;
636 struct bnxt_tc_info *tc_info = &bp->tc_info;1189 struct bnxt_tc_info *tc_info = bp->tc_info;
637 struct bnxt_tc_flow *flow;1190 struct bnxt_tc_flow *flow;
1191 __le32 tunnel_handle = 0;
638 __le16 ref_flow_handle;1192 __le16 ref_flow_handle;
639 int rc;1193 int rc;
640 1194
@@ -672,12 +1226,19 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, · 31 unmodified lines
672 if (rc)1226 if (rc)
673 goto unlock;1227 goto unlock;
674 1228
1229 /* If the flow involves tunnel encap/decap, get tunnel_handle */
1230 rc = bnxt_tc_get_tunnel_handle(bp, flow, new_node, &tunnel_handle);
1231 if (rc)
1232 goto put_l2;
1233
675 /* send HWRM cmd to alloc the flow */1234 /* send HWRM cmd to alloc the flow */
676 rc = bnxt_hwrm_cfa_flow_alloc(bp, flow, ref_flow_handle,1235 rc = bnxt_hwrm_cfa_flow_alloc(bp, flow, ref_flow_handle,
677 &new_node->flow_handle);1236 tunnel_handle, &new_node->flow_handle);
678 if (rc)1237 if (rc)
679 goto put_l2;1238 goto put_tunnel;
680 1239
1240 flow->lastused = jiffies;
1241 spin_lock_init(&flow->stats_lock);
681 /* add new flow to flow-table */1242 /* add new flow to flow-table */
682 rc = rhashtable_insert_fast(&tc_info->flow_table, &new_node->node,1243 rc = rhashtable_insert_fast(&tc_info->flow_table, &new_node->node,
683 tc_info->flow_ht_params);1244 tc_info->flow_ht_params);
@@ -689,12 +1250,14 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, · 5 unmodified lines
689 1250
690hwrm_flow_free:1251hwrm_flow_free:
691 bnxt_hwrm_cfa_flow_free(bp, new_node->flow_handle);1252 bnxt_hwrm_cfa_flow_free(bp, new_node->flow_handle);
1253put_tunnel:
1254 bnxt_tc_put_tunnel_handle(bp, flow, new_node);
692put_l2:1255put_l2:
693 bnxt_tc_put_l2_node(bp, new_node);1256 bnxt_tc_put_l2_node(bp, new_node);
694unlock:1257unlock:
695 mutex_unlock(&tc_info->lock);1258 mutex_unlock(&tc_info->lock);
696free_node:1259free_node:
697 kfree(new_node);1260 kfree_rcu(new_node, rcu);
698done:1261done:
699 netdev_err(bp->dev, "Error: %s: cookie=0x%lx error=%d",1262 netdev_err(bp->dev, "Error: %s: cookie=0x%lx error=%d",
700 __func__, tc_flow_cmd->cookie, rc);1263 __func__, tc_flow_cmd->cookie, rc);
@@ -704,7 +1267,7 @@ done: · 3 unmodified lines
704static int bnxt_tc_del_flow(struct bnxt *bp,1267static int bnxt_tc_del_flow(struct bnxt *bp,
705 struct tc_cls_flower_offload *tc_flow_cmd)1268 struct tc_cls_flower_offload *tc_flow_cmd)
706{1269{
707 struct bnxt_tc_info *tc_info = &bp->tc_info;1270 struct bnxt_tc_info *tc_info = bp->tc_info;
708 struct bnxt_tc_flow_node *flow_node;1271 struct bnxt_tc_flow_node *flow_node;
709 1272
710 flow_node = rhashtable_lookup_fast(&tc_info->flow_table,1273 flow_node = rhashtable_lookup_fast(&tc_info->flow_table,
@@ -722,10 +1285,11 @@ static int bnxt_tc_del_flow(struct bnxt *bp, · 11 unmodified lines
722static int bnxt_tc_get_flow_stats(struct bnxt *bp,1285static int bnxt_tc_get_flow_stats(struct bnxt *bp,
723 struct tc_cls_flower_offload *tc_flow_cmd)1286 struct tc_cls_flower_offload *tc_flow_cmd)
724{1287{
725 struct bnxt_tc_info *tc_info = &bp->tc_info;1288 struct bnxt_tc_flow_stats stats, *curr_stats, *prev_stats;
1289 struct bnxt_tc_info *tc_info = bp->tc_info;
726 struct bnxt_tc_flow_node *flow_node;1290 struct bnxt_tc_flow_node *flow_node;
727 struct bnxt_tc_flow_stats stats;1291 struct bnxt_tc_flow *flow;
728 int rc;1292 unsigned long lastused;
729 1293
730 flow_node = rhashtable_lookup_fast(&tc_info->flow_table,1294 flow_node = rhashtable_lookup_fast(&tc_info->flow_table,
731 &tc_flow_cmd->cookie,1295 &tc_flow_cmd->cookie,
@@ -736,22 +1300,189 @@ static int bnxt_tc_get_flow_stats(struct bnxt *bp, · 4 unmodified lines
736 return -1;1300 return -1;
737 }1301 }
738 1302
739 rc = bnxt_hwrm_cfa_flow_stats_get(bp, flow_node->flow_handle,1303 flow = &flow_node->flow;
740 &flow_node->flow, &stats);1304 curr_stats = &flow->stats;
1305 prev_stats = &flow->prev_stats;
1306
1307 spin_lock(&flow->stats_lock);
1308 stats.packets = curr_stats->packets - prev_stats->packets;
1309 stats.bytes = curr_stats->bytes - prev_stats->bytes;
1310 *prev_stats = *curr_stats;
1311 lastused = flow->lastused;
1312 spin_unlock(&flow->stats_lock);
1313
1314 tcf_exts_stats_update(tc_flow_cmd->exts, stats.bytes, stats.packets,
1315 lastused);
1316 return 0;
1317}
1318
1319static int
1320bnxt_hwrm_cfa_flow_stats_get(struct bnxt *bp, int num_flows,
1321 struct bnxt_tc_stats_batch stats_batch[])
1322{
1323 struct hwrm_cfa_flow_stats_output *resp = bp->hwrm_cmd_resp_addr;
1324 struct hwrm_cfa_flow_stats_input req = { 0 };
1325 __le16 *req_flow_handles = &req.flow_handle_0;
1326 int rc, i;
1327
1328 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_CFA_FLOW_STATS, -1, -1);
1329 req.num_flows = cpu_to_le16(num_flows);
1330 for (i = 0; i < num_flows; i++) {
1331 struct bnxt_tc_flow_node *flow_node = stats_batch[i].flow_node;
1332
1333 req_flow_handles[i] = flow_node->flow_handle;
1334 }
1335
1336 mutex_lock(&bp->hwrm_cmd_lock);
1337 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1338 if (!rc) {
1339 __le64 *resp_packets = &resp->packet_0;
1340 __le64 *resp_bytes = &resp->byte_0;
1341
1342 for (i = 0; i < num_flows; i++) {
1343 stats_batch[i].hw_stats.packets =
1344 le64_to_cpu(resp_packets[i]);
1345 stats_batch[i].hw_stats.bytes =
1346 le64_to_cpu(resp_bytes[i]);
1347 }
1348 } else {
1349 netdev_info(bp->dev, "error rc=%d", rc);
1350 }
1351
1352 mutex_unlock(&bp->hwrm_cmd_lock);
1353 return rc;
1354}
1355
1356/* Add val to accum while handling a possible wraparound
1357 * of val. Eventhough val is of type u64, its actual width
1358 * is denoted by mask and will wrap-around beyond that width.
1359 */
1360static void accumulate_val(u64 *accum, u64 val, u64 mask)
1361{
1362#define low_bits(x, mask) ((x) & (mask))
1363#define high_bits(x, mask) ((x) & ~(mask))
1364 bool wrapped = val < low_bits(*accum, mask);
1365
1366 *accum = high_bits(*accum, mask) + val;
1367 if (wrapped)
1368 *accum += (mask + 1);
1369}
1370
1371/* The HW counters' width is much less than 64bits.
1372 * Handle possible wrap-around while updating the stat counters
1373 */
1374static void bnxt_flow_stats_accum(struct bnxt_tc_info *tc_info,
1375 struct bnxt_tc_flow_stats *acc_stats,
1376 struct bnxt_tc_flow_stats *hw_stats)
1377{
1378 accumulate_val(&acc_stats->bytes, hw_stats->bytes, tc_info->bytes_mask);
1379 accumulate_val(&acc_stats->packets, hw_stats->packets,
1380 tc_info->packets_mask);
1381}
1382
1383static int
1384bnxt_tc_flow_stats_batch_update(struct bnxt *bp, int num_flows,
1385 struct bnxt_tc_stats_batch stats_batch[])
1386{
1387 struct bnxt_tc_info *tc_info = bp->tc_info;
1388 int rc, i;
1389
1390 rc = bnxt_hwrm_cfa_flow_stats_get(bp, num_flows, stats_batch);
741 if (rc)1391 if (rc)
742 return rc;1392 return rc;
743 1393
744 tcf_exts_stats_update(tc_flow_cmd->exts, stats.bytes, stats.packets, 0);1394 for (i = 0; i < num_flows; i++) {
1395 struct bnxt_tc_flow_node *flow_node = stats_batch[i].flow_node;
1396 struct bnxt_tc_flow *flow = &flow_node->flow;
1397
1398 spin_lock(&flow->stats_lock);
1399 bnxt_flow_stats_accum(tc_info, &flow->stats,
1400 &stats_batch[i].hw_stats);
1401 if (flow->stats.packets != flow->prev_stats.packets)
1402 flow->lastused = jiffies;
1403 spin_unlock(&flow->stats_lock);
1404 }
1405
745 return 0;1406 return 0;
746}1407}
747 1408
1409static int
1410bnxt_tc_flow_stats_batch_prep(struct bnxt *bp,
1411 struct bnxt_tc_stats_batch stats_batch[],
1412 int *num_flows)
1413{
1414 struct bnxt_tc_info *tc_info = bp->tc_info;
1415 struct rhashtable_iter *iter = &tc_info->iter;
1416 void *flow_node;
1417 int rc, i;
1418
1419 rc = rhashtable_walk_start(iter);
1420 if (rc && rc != -EAGAIN) {
1421 i = 0;
1422 goto done;
1423 }
1424
1425 rc = 0;
1426 for (i = 0; i < BNXT_FLOW_STATS_BATCH_MAX; i++) {
1427 flow_node = rhashtable_walk_next(iter);
1428 if (IS_ERR(flow_node)) {
1429 i = 0;
1430 if (PTR_ERR(flow_node) == -EAGAIN) {
1431 continue;
1432 } else {
1433 rc = PTR_ERR(flow_node);
1434 goto done;
1435 }
1436 }
1437
1438 /* No more flows */
1439 if (!flow_node)
1440 goto done;
1441
1442 stats_batch[i].flow_node = flow_node;
1443 }
1444done:
1445 rhashtable_walk_stop(iter);
1446 *num_flows = i;
1447 return rc;
1448}
1449
1450void bnxt_tc_flow_stats_work(struct bnxt *bp)
1451{
1452 struct bnxt_tc_info *tc_info = bp->tc_info;
1453 int num_flows, rc;
1454
1455 num_flows = atomic_read(&tc_info->flow_table.nelems);
1456 if (!num_flows)
1457 return;
1458
1459 rhashtable_walk_enter(&tc_info->flow_table, &tc_info->iter);
1460
1461 for (;;) {
1462 rc = bnxt_tc_flow_stats_batch_prep(bp, tc_info->stats_batch,
1463 &num_flows);
1464 if (rc) {
1465 if (rc == -EAGAIN)
1466 continue;
1467 break;
1468 }
1469
1470 if (!num_flows)
1471 break;
1472
1473 bnxt_tc_flow_stats_batch_update(bp, num_flows,
1474 tc_info->stats_batch);
1475 }
1476
1477 rhashtable_walk_exit(&tc_info->iter);
1478}
1479
748int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,1480int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,
749 struct tc_cls_flower_offload *cls_flower)1481 struct tc_cls_flower_offload *cls_flower)
750{1482{
751 int rc = 0;1483 int rc = 0;
752 1484
753 if (!is_classid_clsact_ingress(cls_flower->common.classid) ||1485 if (cls_flower->common.chain_index)
754 cls_flower->common.chain_index)
755 return -EOPNOTSUPP;1486 return -EOPNOTSUPP;
756 1487
757 switch (cls_flower->command) {1488 switch (cls_flower->command) {
@@ -784,19 +1515,37 @@ static const struct rhashtable_params bnxt_tc_l2_ht_params = { · 26 unmodified lines
784 .automatic_shrinking = true1515 .automatic_shrinking = true
785};1516};
786 1517
1518static const struct rhashtable_params bnxt_tc_decap_l2_ht_params = {
1519 .head_offset = offsetof(struct bnxt_tc_l2_node, node),
1520 .key_offset = offsetof(struct bnxt_tc_l2_node, key),
1521 .key_len = BNXT_TC_L2_KEY_LEN,
1522 .automatic_shrinking = true
1523};
1524
1525static const struct rhashtable_params bnxt_tc_tunnel_ht_params = {
1526 .head_offset = offsetof(struct bnxt_tc_tunnel_node, node),
1527 .key_offset = offsetof(struct bnxt_tc_tunnel_node, key),
1528 .key_len = sizeof(struct ip_tunnel_key),
1529 .automatic_shrinking = true
1530};
1531
787/* convert counter width in bits to a mask */1532/* convert counter width in bits to a mask */
788#define mask(width) ((u64)~0 >> (64 - (width)))1533#define mask(width) ((u64)~0 >> (64 - (width)))
789 1534
790int bnxt_init_tc(struct bnxt *bp)1535int bnxt_init_tc(struct bnxt *bp)
791{1536{
792 struct bnxt_tc_info *tc_info = &bp->tc_info;1537 struct bnxt_tc_info *tc_info;
793 int rc;1538 int rc;
794 1539
795 if (bp->hwrm_spec_code < 0x10800) {1540 if (bp->hwrm_spec_code < 0x10803) {
796 netdev_warn(bp->dev,1541 netdev_warn(bp->dev,
797 "Firmware does not support TC flower offload.\n");1542 "Firmware does not support TC flower offload.\n");
798 return -ENOTSUPP;1543 return -ENOTSUPP;
799 }1544 }
1545
1546 tc_info = kzalloc(sizeof(*tc_info), GFP_KERNEL);
1547 if (!tc_info)
1548 return -ENOMEM;
800 mutex_init(&tc_info->lock);1549 mutex_init(&tc_info->lock);
801 1550
802 /* Counter widths are programmed by FW */1551 /* Counter widths are programmed by FW */
@@ -806,33 +1555,62 @@ int bnxt_init_tc(struct bnxt *bp) · 3 unmodified lines
806 tc_info->flow_ht_params = bnxt_tc_flow_ht_params;1555 tc_info->flow_ht_params = bnxt_tc_flow_ht_params;
807 rc = rhashtable_init(&tc_info->flow_table, &tc_info->flow_ht_params);1556 rc = rhashtable_init(&tc_info->flow_table, &tc_info->flow_ht_params);
808 if (rc)1557 if (rc)
809 return rc;1558 goto free_tc_info;
810 1559
811 tc_info->l2_ht_params = bnxt_tc_l2_ht_params;1560 tc_info->l2_ht_params = bnxt_tc_l2_ht_params;
812 rc = rhashtable_init(&tc_info->l2_table, &tc_info->l2_ht_params);1561 rc = rhashtable_init(&tc_info->l2_table, &tc_info->l2_ht_params);
813 if (rc)1562 if (rc)
814 goto destroy_flow_table;1563 goto destroy_flow_table;
815 1564
1565 tc_info->decap_l2_ht_params = bnxt_tc_decap_l2_ht_params;
1566 rc = rhashtable_init(&tc_info->decap_l2_table,
1567 &tc_info->decap_l2_ht_params);
1568 if (rc)
1569 goto destroy_l2_table;
1570
1571 tc_info->decap_ht_params = bnxt_tc_tunnel_ht_params;
1572 rc = rhashtable_init(&tc_info->decap_table,
1573 &tc_info->decap_ht_params);
1574 if (rc)
1575 goto destroy_decap_l2_table;
1576
1577 tc_info->encap_ht_params = bnxt_tc_tunnel_ht_params;
1578 rc = rhashtable_init(&tc_info->encap_table,
1579 &tc_info->encap_ht_params);
1580 if (rc)
1581 goto destroy_decap_table;
1582
816 tc_info->enabled = true;1583 tc_info->enabled = true;
817 bp->dev->hw_features |= NETIF_F_HW_TC;1584 bp->dev->hw_features |= NETIF_F_HW_TC;
818 bp->dev->features |= NETIF_F_HW_TC;1585 bp->dev->features |= NETIF_F_HW_TC;
1586 bp->tc_info = tc_info;
819 return 0;1587 return 0;
820 1588
1589destroy_decap_table:
1590 rhashtable_destroy(&tc_info->decap_table);
1591destroy_decap_l2_table:
1592 rhashtable_destroy(&tc_info->decap_l2_table);
1593destroy_l2_table:
1594 rhashtable_destroy(&tc_info->l2_table);
821destroy_flow_table:1595destroy_flow_table:
822 rhashtable_destroy(&tc_info->flow_table);1596 rhashtable_destroy(&tc_info->flow_table);
1597free_tc_info:
1598 kfree(tc_info);
823 return rc;1599 return rc;
824}1600}
825 1601
826void bnxt_shutdown_tc(struct bnxt *bp)1602void bnxt_shutdown_tc(struct bnxt *bp)
827{1603{
828 struct bnxt_tc_info *tc_info = &bp->tc_info;1604 struct bnxt_tc_info *tc_info = bp->tc_info;
829 1605
830 if (!tc_info->enabled)1606 if (!bnxt_tc_flower_enabled(bp))
831 return;1607 return;
832 1608
833 rhashtable_destroy(&tc_info->flow_table);1609 rhashtable_destroy(&tc_info->flow_table);
834 rhashtable_destroy(&tc_info->l2_table);1610 rhashtable_destroy(&tc_info->l2_table);
1611 rhashtable_destroy(&tc_info->decap_l2_table);
1612 rhashtable_destroy(&tc_info->decap_table);
1613 rhashtable_destroy(&tc_info->encap_table);
1614 kfree(tc_info);
1615 bp->tc_info = NULL;
835}1616}
836
837#else
838#endif
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h+80−8
@@ -12,6 +12,8 @@ · 11 unmodified lines
12 12
13#ifdef CONFIG_BNXT_FLOWER_OFFLOAD13#ifdef CONFIG_BNXT_FLOWER_OFFLOAD
14 14
15#include <net/ip_tunnels.h>
16
15/* Structs used for storing the filter/actions of the TC cmd.17/* Structs used for storing the filter/actions of the TC cmd.
16 */18 */
17struct bnxt_tc_l2_key {19struct bnxt_tc_l2_key {
@@ -50,6 +52,13 @@ struct bnxt_tc_l4_key { · 32 unmodified lines
50 };52 };
51};53};
52 54
55struct bnxt_tc_tunnel_key {
56 struct bnxt_tc_l2_key l2;
57 struct bnxt_tc_l3_key l3;
58 struct bnxt_tc_l4_key l4;
59 __be32 id;
60};
61
53struct bnxt_tc_actions {62struct bnxt_tc_actions {
54 u32 flags;63 u32 flags;
55#define BNXT_TC_ACTION_FLAG_FWD BIT(0)64#define BNXT_TC_ACTION_FLAG_FWD BIT(0)
@@ -57,16 +66,16 @@ struct bnxt_tc_actions { · 1 unmodified line
57#define BNXT_TC_ACTION_FLAG_PUSH_VLAN BIT(3)66#define BNXT_TC_ACTION_FLAG_PUSH_VLAN BIT(3)
58#define BNXT_TC_ACTION_FLAG_POP_VLAN BIT(4)67#define BNXT_TC_ACTION_FLAG_POP_VLAN BIT(4)
59#define BNXT_TC_ACTION_FLAG_DROP BIT(5)68#define BNXT_TC_ACTION_FLAG_DROP BIT(5)
69#define BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP BIT(6)
70#define BNXT_TC_ACTION_FLAG_TUNNEL_DECAP BIT(7)
60 71
61 u16 dst_fid;72 u16 dst_fid;
62 struct net_device *dst_dev;73 struct net_device *dst_dev;
63 __be16 push_vlan_tpid;74 __be16 push_vlan_tpid;
64 __be16 push_vlan_tci;75 __be16 push_vlan_tci;
65};
66 76
67struct bnxt_tc_flow_stats {77 /* tunnel encap */
68 u64 packets;78 struct ip_tunnel_key tun_encap_key;
69 u64 bytes;
70};79};
71 80
72struct bnxt_tc_flow {81struct bnxt_tc_flow {
@@ -76,6 +85,16 @@ struct bnxt_tc_flow { · 3 unmodified lines
76#define BNXT_TC_FLOW_FLAGS_IPV6_ADDRS BIT(3)85#define BNXT_TC_FLOW_FLAGS_IPV6_ADDRS BIT(3)
77#define BNXT_TC_FLOW_FLAGS_PORTS BIT(4)86#define BNXT_TC_FLOW_FLAGS_PORTS BIT(4)
78#define BNXT_TC_FLOW_FLAGS_ICMP BIT(5)87#define BNXT_TC_FLOW_FLAGS_ICMP BIT(5)
88#define BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS BIT(6)
89#define BNXT_TC_FLOW_FLAGS_TUNL_IPV4_ADDRS BIT(7)
90#define BNXT_TC_FLOW_FLAGS_TUNL_IPV6_ADDRS BIT(8)
91#define BNXT_TC_FLOW_FLAGS_TUNL_PORTS BIT(9)
92#define BNXT_TC_FLOW_FLAGS_TUNL_ID BIT(10)
93#define BNXT_TC_FLOW_FLAGS_TUNNEL (BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS | \
94 BNXT_TC_FLOW_FLAGS_TUNL_IPV4_ADDRS | \
95 BNXT_TC_FLOW_FLAGS_TUNL_IPV6_ADDRS |\
96 BNXT_TC_FLOW_FLAGS_TUNL_PORTS |\
97 BNXT_TC_FLOW_FLAGS_TUNL_ID)
79 98
80 /* flow applicable to pkts ingressing on this fid */99 /* flow applicable to pkts ingressing on this fid */
81 u16 src_fid;100 u16 src_fid;
@@ -85,6 +104,8 @@ struct bnxt_tc_flow { · 3 unmodified lines
85 struct bnxt_tc_l3_key l3_mask;104 struct bnxt_tc_l3_key l3_mask;
86 struct bnxt_tc_l4_key l4_key;105 struct bnxt_tc_l4_key l4_key;
87 struct bnxt_tc_l4_key l4_mask;106 struct bnxt_tc_l4_key l4_mask;
107 struct ip_tunnel_key tun_key;
108 struct ip_tunnel_key tun_mask;
88 109
89 struct bnxt_tc_actions actions;110 struct bnxt_tc_actions actions;
90 111
@@ -93,13 +114,39 @@ struct bnxt_tc_flow { · 2 unmodified lines
93 /* previous snap-shot of stats */114 /* previous snap-shot of stats */
94 struct bnxt_tc_flow_stats prev_stats;115 struct bnxt_tc_flow_stats prev_stats;
95 unsigned long lastused; /* jiffies */116 unsigned long lastused; /* jiffies */
117 /* for calculating delta from prev_stats and
118 * updating prev_stats atomically.
119 */
120 spinlock_t stats_lock;
121};
122
123/* Tunnel encap/decap hash table
124 * This table is used to maintain a list of flows that use
125 * the same tunnel encap/decap params (ip_daddrs, vni, udp_dport)
126 * and the FW returned handle.
127 * A separate table is maintained for encap and decap
128 */
129struct bnxt_tc_tunnel_node {
130 struct ip_tunnel_key key;
131 struct rhash_head node;
132
133 /* tunnel l2 info */
134 struct bnxt_tc_l2_key l2_info;
135
136#define INVALID_TUNNEL_HANDLE cpu_to_le32(0xffffffff)
137 /* tunnel handle returned by FW */
138 __le32 tunnel_handle;
139
140 u32 refcount;
141 struct rcu_head rcu;
96};142};
97 143
98/* L2 hash table144/* L2 hash table
99 * This data-struct is used for L2-flow table.145 * The same data-struct is used for L2-flow table and L2-tunnel table.
100 * The L2 part of a flow is stored in a hash table.146 * The L2 part of a flow or tunnel is stored in a hash table.
101 * A flow that shares the same L2 key/mask with an147 * A flow that shares the same L2 key/mask with an
102 * already existing flow must refer to it's flow handle.148 * already existing flow/tunnel must refer to it's flow handle or
149 * decap_filter_id respectively.
103 */150 */
104struct bnxt_tc_l2_node {151struct bnxt_tc_l2_node {
105 /* hash key: first 16b of key */152 /* hash key: first 16b of key */
@@ -110,7 +157,7 @@ struct bnxt_tc_l2_node { · 4 unmodified lines
110 /* a linked list of flows that share the same l2 key */157 /* a linked list of flows that share the same l2 key */
111 struct list_head common_l2_flows;158 struct list_head common_l2_flows;
112 159
113 /* number of flows sharing the l2 key */160 /* number of flows/tunnels sharing the l2 key */
114 u16 refcount;161 u16 refcount;
115 162
116 struct rcu_head rcu;163 struct rcu_head rcu;
@@ -130,6 +177,16 @@ struct bnxt_tc_flow_node { · 13 unmodified lines
130 /* for the shared_flows list maintained in l2_node */177 /* for the shared_flows list maintained in l2_node */
131 struct list_head l2_list_node;178 struct list_head l2_list_node;
132 179
180 /* tunnel encap related */
181 struct bnxt_tc_tunnel_node *encap_node;
182
183 /* tunnel decap related */
184 struct bnxt_tc_tunnel_node *decap_node;
185 /* L2 node in tunnel-l2 hashtable that shares flow's tunnel l2 key */
186 struct bnxt_tc_l2_node *decap_l2_node;
187 /* for the shared_flows list maintained in tunnel decap l2_node */
188 struct list_head decap_l2_list_node;
189
133 struct rcu_head rcu;190 struct rcu_head rcu;
134};191};
135 192
@@ -137,6 +194,12 @@ int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid, · 1 unmodified line
137 struct tc_cls_flower_offload *cls_flower);194 struct tc_cls_flower_offload *cls_flower);
138int bnxt_init_tc(struct bnxt *bp);195int bnxt_init_tc(struct bnxt *bp);
139void bnxt_shutdown_tc(struct bnxt *bp);196void bnxt_shutdown_tc(struct bnxt *bp);
197void bnxt_tc_flow_stats_work(struct bnxt *bp);
198
199static inline bool bnxt_tc_flower_enabled(struct bnxt *bp)
200{
201 return bp->tc_info && bp->tc_info->enabled;
202}
140 203
141#else /* CONFIG_BNXT_FLOWER_OFFLOAD */204#else /* CONFIG_BNXT_FLOWER_OFFLOAD */
142 205
@@ -154,5 +217,14 @@ static inline int bnxt_init_tc(struct bnxt *bp) · 11 unmodified lines
154static inline void bnxt_shutdown_tc(struct bnxt *bp)217static inline void bnxt_shutdown_tc(struct bnxt *bp)
155{218{
156}219}
220
221static inline void bnxt_tc_flow_stats_work(struct bnxt *bp)
222{
223}
224
225static inline bool bnxt_tc_flower_enabled(struct bnxt *bp)
226{
227 return false;
228}
157#endif /* CONFIG_BNXT_FLOWER_OFFLOAD */229#endif /* CONFIG_BNXT_FLOWER_OFFLOAD */
158#endif /* BNXT_TC_H */230#endif /* BNXT_TC_H */
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c+43−53
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include "bnxt_hsi.h"16#include "bnxt_hsi.h"
17#include "bnxt.h"17#include "bnxt.h"
18#include "bnxt_vfr.h"18#include "bnxt_vfr.h"
19#include "bnxt_devlink.h"
19#include "bnxt_tc.h"20#include "bnxt_tc.h"
20 21
21#ifdef CONFIG_BNXT_SRIOV22#ifdef CONFIG_BNXT_SRIOV
@@ -115,13 +116,17 @@ bnxt_vf_rep_get_stats64(struct net_device *dev, · 93 unmodified lines
115 stats->tx_bytes = vf_rep->tx_stats.bytes;116 stats->tx_bytes = vf_rep->tx_stats.bytes;
116}117}
117 118
118static int bnxt_vf_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,119static int bnxt_vf_rep_setup_tc_block_cb(enum tc_setup_type type,
119 void *type_data)120 void *type_data,
121 void *cb_priv)
120{122{
121 struct bnxt_vf_rep *vf_rep = netdev_priv(dev);123 struct bnxt_vf_rep *vf_rep = cb_priv;
122 struct bnxt *bp = vf_rep->bp;124 struct bnxt *bp = vf_rep->bp;
123 int vf_fid = bp->pf.vf[vf_rep->vf_idx].fw_fid;125 int vf_fid = bp->pf.vf[vf_rep->vf_idx].fw_fid;
124 126
127 if (!bnxt_tc_flower_enabled(vf_rep->bp) || !tc_can_offload(bp->dev))
128 return -EOPNOTSUPP;
129
125 switch (type) {130 switch (type) {
126 case TC_SETUP_CLSFLOWER:131 case TC_SETUP_CLSFLOWER:
127 return bnxt_tc_setup_flower(bp, vf_fid, type_data);132 return bnxt_tc_setup_flower(bp, vf_fid, type_data);
@@ -130,6 +135,39 @@ static int bnxt_vf_rep_setup_tc(struct net_device *dev, enum tc_setup_type type, · 2 unmodified lines
130 }135 }
131}136}
132 137
138static int bnxt_vf_rep_setup_tc_block(struct net_device *dev,
139 struct tc_block_offload *f)
140{
141 struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
142
143 if (f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
144 return -EOPNOTSUPP;
145
146 switch (f->command) {
147 case TC_BLOCK_BIND:
148 return tcf_block_cb_register(f->block,
149 bnxt_vf_rep_setup_tc_block_cb,
150 vf_rep, vf_rep);
151 case TC_BLOCK_UNBIND:
152 tcf_block_cb_unregister(f->block,
153 bnxt_vf_rep_setup_tc_block_cb, vf_rep);
154 return 0;
155 default:
156 return -EOPNOTSUPP;
157 }
158}
159
160static int bnxt_vf_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
161 void *type_data)
162{
163 switch (type) {
164 case TC_SETUP_BLOCK:
165 return bnxt_vf_rep_setup_tc_block(dev, type_data);
166 default:
167 return -EOPNOTSUPP;
168 }
169}
170
133struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code)171struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code)
134{172{
135 u16 vf_idx;173 u16 vf_idx;
@@ -416,7 +454,7 @@ err: · 280 unmodified lines
416}454}
417 455
418/* Devlink related routines */456/* Devlink related routines */
419static int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode)457int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode)
420{458{
421 struct bnxt *bp = bnxt_get_bp_from_dl(devlink);459 struct bnxt *bp = bnxt_get_bp_from_dl(devlink);
422 460
@@ -424,7 +462,7 @@ static int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode) · 1 unmodified line
424 return 0;462 return 0;
425}463}
426 464
427static int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode)465int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode)
428{466{
429 struct bnxt *bp = bnxt_get_bp_from_dl(devlink);467 struct bnxt *bp = bnxt_get_bp_from_dl(devlink);
430 int rc = 0;468 int rc = 0;
@@ -462,52 +500,4 @@ done: · 31 unmodified lines
462 return rc;500 return rc;
463}501}
464 502
465static const struct devlink_ops bnxt_dl_ops = {
466 .eswitch_mode_set = bnxt_dl_eswitch_mode_set,
467 .eswitch_mode_get = bnxt_dl_eswitch_mode_get
468};
469
470int bnxt_dl_register(struct bnxt *bp)
471{
472 struct devlink *dl;
473 int rc;
474
475 if (!pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV))
476 return 0;
477
478 if (bp->hwrm_spec_code < 0x10800) {
479 netdev_warn(bp->dev, "Firmware does not support SR-IOV E-Switch SWITCHDEV mode.\n");
480 return -ENOTSUPP;
481 }
482
483 dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl));
484 if (!dl) {
485 netdev_warn(bp->dev, "devlink_alloc failed");
486 return -ENOMEM;
487 }
488
489 bnxt_link_bp_to_dl(bp, dl);
490 bp->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY;
491 rc = devlink_register(dl, &bp->pdev->dev);
492 if (rc) {
493 bnxt_link_bp_to_dl(bp, NULL);
494 devlink_free(dl);
495 netdev_warn(bp->dev, "devlink_register failed. rc=%d", rc);
496 return rc;
497 }
498
499 return 0;
500}
501
502void bnxt_dl_unregister(struct bnxt *bp)
503{
504 struct devlink *dl = bp->dl;
505
506 if (!dl)
507 return;
508
509 devlink_unregister(dl);
510 devlink_free(dl);
511}
512
513#endif503#endif
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h+3−34
@@ -14,31 +14,6 @@ · 13 unmodified lines
14 14
15#define MAX_CFA_CODE 6553615#define MAX_CFA_CODE 65536
16 16
17/* Struct to hold housekeeping info needed by devlink interface */
18struct bnxt_dl {
19 struct bnxt *bp; /* back ptr to the controlling dev */
20};
21
22static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
23{
24 return ((struct bnxt_dl *)devlink_priv(dl))->bp;
25}
26
27/* To clear devlink pointer from bp, pass NULL dl */
28static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl)
29{
30 bp->dl = dl;
31
32 /* add a back pointer in dl to bp */
33 if (dl) {
34 struct bnxt_dl *bp_dl = devlink_priv(dl);
35
36 bp_dl->bp = bp;
37 }
38}
39
40int bnxt_dl_register(struct bnxt *bp);
41void bnxt_dl_unregister(struct bnxt *bp);
42void bnxt_vf_reps_destroy(struct bnxt *bp);17void bnxt_vf_reps_destroy(struct bnxt *bp);
43void bnxt_vf_reps_close(struct bnxt *bp);18void bnxt_vf_reps_close(struct bnxt *bp);
44void bnxt_vf_reps_open(struct bnxt *bp);19void bnxt_vf_reps_open(struct bnxt *bp);
@@ -53,16 +28,10 @@ static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev) · 8 unmodified lines
53 return bp->pf.vf[vf_rep->vf_idx].fw_fid;28 return bp->pf.vf[vf_rep->vf_idx].fw_fid;
54}29}
55 30
56#else31int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode);
57 32int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode);
58static inline int bnxt_dl_register(struct bnxt *bp)
59{
60 return 0;
61}
62 33
63static inline void bnxt_dl_unregister(struct bnxt *bp)34#else
64{
65}
66 35
67static inline void bnxt_vf_reps_close(struct bnxt *bp)36static inline void bnxt_vf_reps_close(struct bnxt *bp)
68{37{
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c+2−1
@@ -94,6 +94,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, · 93 unmodified lines
94 94
95 xdp.data_hard_start = *data_ptr - offset;95 xdp.data_hard_start = *data_ptr - offset;
96 xdp.data = *data_ptr;96 xdp.data = *data_ptr;
97 xdp_set_data_meta_invalid(&xdp);
97 xdp.data_end = *data_ptr + *len;98 xdp.data_end = *data_ptr + *len;
98 orig_data = xdp.data;99 orig_data = xdp.data;
99 mapping = rx_buf->mapping - bp->rx_dma_offset;100 mapping = rx_buf->mapping - bp->rx_dma_offset;
@@ -207,7 +208,7 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) · 107 unmodified lines
207 return 0;208 return 0;
208}209}
209 210
210int bnxt_xdp(struct net_device *dev, struct netdev_xdp *xdp)211int bnxt_xdp(struct net_device *dev, struct netdev_bpf *xdp)
211{212{
212 struct bnxt *bp = netdev_priv(dev);213 struct bnxt *bp = netdev_priv(dev);
213 int rc;214 int rc;
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h+1−1
@@ -16,6 +16,6 @@ void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts); · 15 unmodified lines
16bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,16bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
17 struct page *page, u8 **data_ptr, unsigned int *len,17 struct page *page, u8 **data_ptr, unsigned int *len,
18 u8 *event);18 u8 *event);
19int bnxt_xdp(struct net_device *dev, struct netdev_xdp *xdp);19int bnxt_xdp(struct net_device *dev, struct netdev_bpf *xdp);
20 20
21#endif21#endif
drivers/net/ethernet/broadcom/genet/bcmgenet.c+77−195
@@ -488,15 +488,13 @@ static void bcmgenet_complete(struct net_device *dev) · 487 unmodified lines
488static int bcmgenet_get_link_ksettings(struct net_device *dev,488static int bcmgenet_get_link_ksettings(struct net_device *dev,
489 struct ethtool_link_ksettings *cmd)489 struct ethtool_link_ksettings *cmd)
490{490{
491 struct bcmgenet_priv *priv = netdev_priv(dev);
492
493 if (!netif_running(dev))491 if (!netif_running(dev))
494 return -EINVAL;492 return -EINVAL;
495 493
496 if (!priv->phydev)494 if (!dev->phydev)
497 return -ENODEV;495 return -ENODEV;
498 496
499 phy_ethtool_ksettings_get(priv->phydev, cmd);497 phy_ethtool_ksettings_get(dev->phydev, cmd);
500 498
501 return 0;499 return 0;
502}500}
@@ -504,15 +502,13 @@ static int bcmgenet_get_link_ksettings(struct net_device *dev, · 1 unmodified line
504static int bcmgenet_set_link_ksettings(struct net_device *dev,502static int bcmgenet_set_link_ksettings(struct net_device *dev,
505 const struct ethtool_link_ksettings *cmd)503 const struct ethtool_link_ksettings *cmd)
506{504{
507 struct bcmgenet_priv *priv = netdev_priv(dev);
508
509 if (!netif_running(dev))505 if (!netif_running(dev))
510 return -EINVAL;506 return -EINVAL;
511 507
512 if (!priv->phydev)508 if (!dev->phydev)
513 return -ENODEV;509 return -ENODEV;
514 510
515 return phy_ethtool_ksettings_set(priv->phydev, cmd);511 return phy_ethtool_ksettings_set(dev->phydev, cmd);
516}512}
517 513
518static int bcmgenet_set_rx_csum(struct net_device *dev,514static int bcmgenet_set_rx_csum(struct net_device *dev,
@@ -1042,11 +1038,14 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_eee *e) · 523 unmodified lines
1042 if (GENET_IS_V1(priv))1038 if (GENET_IS_V1(priv))
1043 return -EOPNOTSUPP;1039 return -EOPNOTSUPP;
1044 1040
1041 if (!dev->phydev)
1042 return -ENODEV;
1043
1045 e->eee_enabled = p->eee_enabled;1044 e->eee_enabled = p->eee_enabled;
1046 e->eee_active = p->eee_active;1045 e->eee_active = p->eee_active;
1047 e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);1046 e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);
1048 1047
1049 return phy_ethtool_get_eee(priv->phydev, e);1048 return phy_ethtool_get_eee(dev->phydev, e);
1050}1049}
1051 1050
1052static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)1051static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
@@ -1058,12 +1057,15 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e) · 5 unmodified lines
1058 if (GENET_IS_V1(priv))1057 if (GENET_IS_V1(priv))
1059 return -EOPNOTSUPP;1058 return -EOPNOTSUPP;
1060 1059
1060 if (!dev->phydev)
1061 return -ENODEV;
1062
1061 p->eee_enabled = e->eee_enabled;1063 p->eee_enabled = e->eee_enabled;
1062 1064
1063 if (!p->eee_enabled) {1065 if (!p->eee_enabled) {
1064 bcmgenet_eee_enable_set(dev, false);1066 bcmgenet_eee_enable_set(dev, false);
1065 } else {1067 } else {
1066 ret = phy_init_eee(priv->phydev, 0);1068 ret = phy_init_eee(dev->phydev, 0);
1067 if (ret) {1069 if (ret) {
1068 netif_err(priv, hw, dev, "EEE initialization failed\n");1070 netif_err(priv, hw, dev, "EEE initialization failed\n");
1069 return ret;1071 return ret;
@@ -1073,7 +1075,7 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e) · 3 unmodified lines
1073 bcmgenet_eee_enable_set(dev, true);1075 bcmgenet_eee_enable_set(dev, true);
1074 }1076 }
1075 1077
1076 return phy_ethtool_set_eee(priv->phydev, e);1078 return phy_ethtool_set_eee(dev->phydev, e);
1077}1079}
1078 1080
1079/* standard ethtool support functions. */1081/* standard ethtool support functions. */
@@ -1107,7 +1109,7 @@ static int bcmgenet_power_down(struct bcmgenet_priv *priv, · 27 unmodified lines
1107 1109
1108 switch (mode) {1110 switch (mode) {
1109 case GENET_POWER_CABLE_SENSE:1111 case GENET_POWER_CABLE_SENSE:
1110 phy_detach(priv->phydev);1112 phy_detach(priv->dev->phydev);
1111 break;1113 break;
1112 1114
1113 case GENET_POWER_WOL_MAGIC:1115 case GENET_POWER_WOL_MAGIC:
@@ -1172,7 +1174,6 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv, · 58 unmodified lines
1172 }1174 }
1173 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);1175 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
1174 bcmgenet_phy_power_set(priv->dev, true);1176 bcmgenet_phy_power_set(priv->dev, true);
1175 bcmgenet_mii_reset(priv->dev);
1176 break;1177 break;
1177 1178
1178 case GENET_POWER_CABLE_SENSE:1179 case GENET_POWER_CABLE_SENSE:
@@ -1193,15 +1194,13 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv, · 14 unmodified lines
1193/* ioctl handle special commands that are not present in ethtool. */1194/* ioctl handle special commands that are not present in ethtool. */
1194static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)1195static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1195{1196{
1196 struct bcmgenet_priv *priv = netdev_priv(dev);
1197
1198 if (!netif_running(dev))1197 if (!netif_running(dev))
1199 return -EINVAL;1198 return -EINVAL;
1200 1199
1201 if (!priv->phydev)1200 if (!dev->phydev)
1202 return -ENODEV;1201 return -ENODEV;
1203 1202
1204 return phy_mii_ioctl(priv->phydev, rq, cmd);1203 return phy_mii_ioctl(dev->phydev, rq, cmd);
1205}1204}
1206 1205
1207static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,1206static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,
@@ -1405,11 +1404,10 @@ static unsigned int bcmgenet_tx_reclaim(struct net_device *dev, · 197 unmodified lines
1405 struct bcmgenet_tx_ring *ring)1404 struct bcmgenet_tx_ring *ring)
1406{1405{
1407 unsigned int released;1406 unsigned int released;
1408 unsigned long flags;
1409 1407
1410 spin_lock_irqsave(&ring->lock, flags);1408 spin_lock_bh(&ring->lock);
1411 released = __bcmgenet_tx_reclaim(dev, ring);1409 released = __bcmgenet_tx_reclaim(dev, ring);
1412 spin_unlock_irqrestore(&ring->lock, flags);1410 spin_unlock_bh(&ring->lock);
1413 1411
1414 return released;1412 return released;
1415}1413}
@@ -1420,15 +1418,14 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget) · 4 unmodified lines
1420 container_of(napi, struct bcmgenet_tx_ring, napi);1418 container_of(napi, struct bcmgenet_tx_ring, napi);
1421 unsigned int work_done = 0;1419 unsigned int work_done = 0;
1422 struct netdev_queue *txq;1420 struct netdev_queue *txq;
1423 unsigned long flags;
1424 1421
1425 spin_lock_irqsave(&ring->lock, flags);1422 spin_lock(&ring->lock);
1426 work_done = __bcmgenet_tx_reclaim(ring->priv->dev, ring);1423 work_done = __bcmgenet_tx_reclaim(ring->priv->dev, ring);
1427 if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {1424 if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
1428 txq = netdev_get_tx_queue(ring->priv->dev, ring->queue);1425 txq = netdev_get_tx_queue(ring->priv->dev, ring->queue);
1429 netif_tx_wake_queue(txq);1426 netif_tx_wake_queue(txq);
1430 }1427 }
1431 spin_unlock_irqrestore(&ring->lock, flags);1428 spin_unlock(&ring->lock);
1432 1429
1433 if (work_done == 0) {1430 if (work_done == 0) {
1434 napi_complete(napi);1431 napi_complete(napi);
@@ -1523,7 +1520,6 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) · 88 unmodified lines
1523 struct bcmgenet_tx_ring *ring = NULL;1520 struct bcmgenet_tx_ring *ring = NULL;
1524 struct enet_cb *tx_cb_ptr;1521 struct enet_cb *tx_cb_ptr;
1525 struct netdev_queue *txq;1522 struct netdev_queue *txq;
1526 unsigned long flags = 0;
1527 int nr_frags, index;1523 int nr_frags, index;
1528 dma_addr_t mapping;1524 dma_addr_t mapping;
1529 unsigned int size;1525 unsigned int size;
@@ -1550,7 +1546,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) · 20 unmodified lines
1550 1546
1551 nr_frags = skb_shinfo(skb)->nr_frags;1547 nr_frags = skb_shinfo(skb)->nr_frags;
1552 1548
1553 spin_lock_irqsave(&ring->lock, flags);1549 spin_lock(&ring->lock);
1554 if (ring->free_bds <= (nr_frags + 1)) {1550 if (ring->free_bds <= (nr_frags + 1)) {
1555 if (!netif_tx_queue_stopped(txq)) {1551 if (!netif_tx_queue_stopped(txq)) {
1556 netif_tx_stop_queue(txq);1552 netif_tx_stop_queue(txq);
@@ -1584,8 +1580,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) · 27 unmodified lines
1584 for (i = 0; i <= nr_frags; i++) {1580 for (i = 0; i <= nr_frags; i++) {
1585 tx_cb_ptr = bcmgenet_get_txcb(priv, ring);1581 tx_cb_ptr = bcmgenet_get_txcb(priv, ring);
1586 1582
1587 if (unlikely(!tx_cb_ptr))1583 BUG_ON(!tx_cb_ptr);
1588 BUG();
1589 1584
1590 if (!i) {1585 if (!i) {
1591 /* Transmit single SKB or head of fragment list */1586 /* Transmit single SKB or head of fragment list */
@@ -1645,7 +1640,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) · 53 unmodified lines
1645 bcmgenet_tdma_ring_writel(priv, ring->index,1640 bcmgenet_tdma_ring_writel(priv, ring->index,
1646 ring->prod_index, TDMA_PROD_INDEX);1641 ring->prod_index, TDMA_PROD_INDEX);
1647out:1642out:
1648 spin_unlock_irqrestore(&ring->lock, flags);1643 spin_unlock(&ring->lock);
1649 1644
1650 return ret;1645 return ret;
1651 1646
@@ -1935,12 +1930,8 @@ static void umac_enable_set(struct bcmgenet_priv *priv, u32 mask, bool enable) · 283 unmodified lines
1935 usleep_range(1000, 2000);1930 usleep_range(1000, 2000);
1936}1931}
1937 1932
1938static int reset_umac(struct bcmgenet_priv *priv)1933static void reset_umac(struct bcmgenet_priv *priv)
1939{1934{
1940 struct device *kdev = &priv->pdev->dev;
1941 unsigned int timeout = 0;
1942 u32 reg;
1943
1944 /* 7358a0/7552a0: bad default in RBUF_FLUSH_CTRL.umac_sw_rst */1935 /* 7358a0/7552a0: bad default in RBUF_FLUSH_CTRL.umac_sw_rst */
1945 bcmgenet_rbuf_ctrl_set(priv, 0);1936 bcmgenet_rbuf_ctrl_set(priv, 0);
1946 udelay(10);1937 udelay(10);
@@ -1948,23 +1939,10 @@ static int reset_umac(struct bcmgenet_priv *priv) · 1 unmodified line
1948 /* disable MAC while updating its registers */1939 /* disable MAC while updating its registers */
1949 bcmgenet_umac_writel(priv, 0, UMAC_CMD);1940 bcmgenet_umac_writel(priv, 0, UMAC_CMD);
1950 1941
1951 /* issue soft reset, wait for it to complete */1942 /* issue soft reset with (rg)mii loopback to ensure a stable rxclk */
1952 bcmgenet_umac_writel(priv, CMD_SW_RESET, UMAC_CMD);1943 bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);
1953 while (timeout++ < 1000) {1944 udelay(2);
1954 reg = bcmgenet_umac_readl(priv, UMAC_CMD);1945 bcmgenet_umac_writel(priv, 0, UMAC_CMD);
1955 if (!(reg & CMD_SW_RESET))
1956 return 0;
1957
1958 udelay(1);
1959 }
1960
1961 if (timeout == 1000) {
1962 dev_err(kdev,
1963 "timeout waiting for MAC to come out of reset\n");
1964 return -ETIMEDOUT;
1965 }
1966
1967 return 0;
1968}1946}
1969 1947
1970static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)1948static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
@@ -1994,20 +1972,16 @@ static void bcmgenet_link_intr_enable(struct bcmgenet_priv *priv) · 23 unmodified lines
1994 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);1972 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
1995}1973}
1996 1974
1997static int init_umac(struct bcmgenet_priv *priv)1975static void init_umac(struct bcmgenet_priv *priv)
1998{1976{
1999 struct device *kdev = &priv->pdev->dev;1977 struct device *kdev = &priv->pdev->dev;
2000 int ret;
2001 u32 reg;1978 u32 reg;
2002 u32 int0_enable = 0;1979 u32 int0_enable = 0;
2003 1980
2004 dev_dbg(&priv->pdev->dev, "bcmgenet: init_umac\n");1981 dev_dbg(&priv->pdev->dev, "bcmgenet: init_umac\n");
2005 1982
2006 ret = reset_umac(priv);1983 reset_umac(priv);
2007 if (ret)
2008 return ret;
2009 1984
2010 bcmgenet_umac_writel(priv, 0, UMAC_CMD);
2011 /* clear tx/rx counter */1985 /* clear tx/rx counter */
2012 bcmgenet_umac_writel(priv,1986 bcmgenet_umac_writel(priv,
2013 MIB_RESET_RX | MIB_RESET_TX | MIB_RESET_RUNT,1987 MIB_RESET_RX | MIB_RESET_TX | MIB_RESET_RUNT,
@@ -2046,8 +2020,6 @@ static int init_umac(struct bcmgenet_priv *priv) · 32 unmodified lines
2046 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);2020 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
2047 2021
2048 dev_dbg(kdev, "done init umac\n");2022 dev_dbg(kdev, "done init umac\n");
2049
2050 return 0;
2051}2023}
2052 2024
2053/* Initialize a Tx ring along with corresponding hardware registers */2025/* Initialize a Tx ring along with corresponding hardware registers */
@@ -2104,6 +2076,10 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, · 50 unmodified lines
2104 TDMA_WRITE_PTR);2076 TDMA_WRITE_PTR);
2105 bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1,2077 bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1,
2106 DMA_END_ADDR);2078 DMA_END_ADDR);
2079
2080 /* Initialize Tx NAPI */
2081 netif_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll,
2082 NAPI_POLL_WEIGHT);
2107}2083}
2108 2084
2109/* Initialize a RDMA ring */2085/* Initialize a RDMA ring */
@@ -2135,6 +2111,10 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv, · 25 unmodified lines
2135 if (ret)2111 if (ret)
2136 return ret;2112 return ret;
2137 2113
2114 /* Initialize Rx NAPI */
2115 netif_napi_add(priv->dev, &ring->napi, bcmgenet_rx_poll,
2116 NAPI_POLL_WEIGHT);
2117
2138 bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_PROD_INDEX);2118 bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_PROD_INDEX);
2139 bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_CONS_INDEX);2119 bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_CONS_INDEX);
2140 bcmgenet_rdma_ring_writel(priv, index, 1, DMA_MBUF_DONE_THRESH);2120 bcmgenet_rdma_ring_writel(priv, index, 1, DMA_MBUF_DONE_THRESH);
@@ -2159,50 +2139,27 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv, · 18 unmodified lines
2159 return ret;2139 return ret;
2160}2140}
2161 2141
2162static void bcmgenet_init_tx_napi(struct bcmgenet_priv *priv)
2163{
2164 unsigned int i;
2165 struct bcmgenet_tx_ring *ring;
2166
2167 for (i = 0; i < priv->hw_params->tx_queues; ++i) {
2168 ring = &priv->tx_rings[i];
2169 netif_tx_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll, 64);
2170 }
2171
2172 ring = &priv->tx_rings[DESC_INDEX];
2173 netif_tx_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll, 64);
2174}
2175
2176static void bcmgenet_enable_tx_napi(struct bcmgenet_priv *priv)2142static void bcmgenet_enable_tx_napi(struct bcmgenet_priv *priv)
2177{2143{
2178 unsigned int i;2144 unsigned int i;
2179 u32 int0_enable = UMAC_IRQ_TXDMA_DONE;
2180 u32 int1_enable = 0;
2181 struct bcmgenet_tx_ring *ring;2145 struct bcmgenet_tx_ring *ring;
2182 2146
2183 for (i = 0; i < priv->hw_params->tx_queues; ++i) {2147 for (i = 0; i < priv->hw_params->tx_queues; ++i) {
2184 ring = &priv->tx_rings[i];2148 ring = &priv->tx_rings[i];
2185 napi_enable(&ring->napi);2149 napi_enable(&ring->napi);
2186 int1_enable |= (1 << i);2150 ring->int_enable(ring);
2187 }2151 }
2188 2152
2189 ring = &priv->tx_rings[DESC_INDEX];2153 ring = &priv->tx_rings[DESC_INDEX];
2190 napi_enable(&ring->napi);2154 napi_enable(&ring->napi);
2191 2155 ring->int_enable(ring);
2192 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
2193 bcmgenet_intrl2_1_writel(priv, int1_enable, INTRL2_CPU_MASK_CLEAR);
2194}2156}
2195 2157
2196static void bcmgenet_disable_tx_napi(struct bcmgenet_priv *priv)2158static void bcmgenet_disable_tx_napi(struct bcmgenet_priv *priv)
2197{2159{
2198 unsigned int i;2160 unsigned int i;
2199 u32 int0_disable = UMAC_IRQ_TXDMA_DONE;
2200 u32 int1_disable = 0xffff;
2201 struct bcmgenet_tx_ring *ring;2161 struct bcmgenet_tx_ring *ring;
2202 2162
2203 bcmgenet_intrl2_0_writel(priv, int0_disable, INTRL2_CPU_MASK_SET);
2204 bcmgenet_intrl2_1_writel(priv, int1_disable, INTRL2_CPU_MASK_SET);
2205
2206 for (i = 0; i < priv->hw_params->tx_queues; ++i) {2163 for (i = 0; i < priv->hw_params->tx_queues; ++i) {
2207 ring = &priv->tx_rings[i];2164 ring = &priv->tx_rings[i];
2208 napi_disable(&ring->napi);2165 napi_disable(&ring->napi);
@@ -2286,9 +2243,6 @@ static void bcmgenet_init_tx_queues(struct net_device *dev) · 77 unmodified lines
2286 bcmgenet_tdma_writel(priv, dma_priority[1], DMA_PRIORITY_1);2243 bcmgenet_tdma_writel(priv, dma_priority[1], DMA_PRIORITY_1);
2287 bcmgenet_tdma_writel(priv, dma_priority[2], DMA_PRIORITY_2);2244 bcmgenet_tdma_writel(priv, dma_priority[2], DMA_PRIORITY_2);
2288 2245
2289 /* Initialize Tx NAPI */
2290 bcmgenet_init_tx_napi(priv);
2291
2292 /* Enable Tx queues */2246 /* Enable Tx queues */
2293 bcmgenet_tdma_writel(priv, ring_cfg, DMA_RING_CFG);2247 bcmgenet_tdma_writel(priv, ring_cfg, DMA_RING_CFG);
2294 2248
@@ -2298,50 +2252,27 @@ static void bcmgenet_init_tx_queues(struct net_device *dev) · 3 unmodified lines
2298 bcmgenet_tdma_writel(priv, dma_ctrl, DMA_CTRL);2252 bcmgenet_tdma_writel(priv, dma_ctrl, DMA_CTRL);
2299}2253}
2300 2254
2301static void bcmgenet_init_rx_napi(struct bcmgenet_priv *priv)
2302{
2303 unsigned int i;
2304 struct bcmgenet_rx_ring *ring;
2305
2306 for (i = 0; i < priv->hw_params->rx_queues; ++i) {
2307 ring = &priv->rx_rings[i];
2308 netif_napi_add(priv->dev, &ring->napi, bcmgenet_rx_poll, 64);
2309 }
2310
2311 ring = &priv->rx_rings[DESC_INDEX];
2312 netif_napi_add(priv->dev, &ring->napi, bcmgenet_rx_poll, 64);
2313}
2314
2315static void bcmgenet_enable_rx_napi(struct bcmgenet_priv *priv)2255static void bcmgenet_enable_rx_napi(struct bcmgenet_priv *priv)
2316{2256{
2317 unsigned int i;2257 unsigned int i;
2318 u32 int0_enable = UMAC_IRQ_RXDMA_DONE;
2319 u32 int1_enable = 0;
2320 struct bcmgenet_rx_ring *ring;2258 struct bcmgenet_rx_ring *ring;
2321 2259
2322 for (i = 0; i < priv->hw_params->rx_queues; ++i) {2260 for (i = 0; i < priv->hw_params->rx_queues; ++i) {
2323 ring = &priv->rx_rings[i];2261 ring = &priv->rx_rings[i];
2324 napi_enable(&ring->napi);2262 napi_enable(&ring->napi);
2325 int1_enable |= (1 << (UMAC_IRQ1_RX_INTR_SHIFT + i));2263 ring->int_enable(ring);
2326 }2264 }
2327 2265
2328 ring = &priv->rx_rings[DESC_INDEX];2266 ring = &priv->rx_rings[DESC_INDEX];
2329 napi_enable(&ring->napi);2267 napi_enable(&ring->napi);
2330 2268 ring->int_enable(ring);
2331 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
2332 bcmgenet_intrl2_1_writel(priv, int1_enable, INTRL2_CPU_MASK_CLEAR);
2333}2269}
2334 2270
2335static void bcmgenet_disable_rx_napi(struct bcmgenet_priv *priv)2271static void bcmgenet_disable_rx_napi(struct bcmgenet_priv *priv)
2336{2272{
2337 unsigned int i;2273 unsigned int i;
2338 u32 int0_disable = UMAC_IRQ_RXDMA_DONE;
2339 u32 int1_disable = 0xffff << UMAC_IRQ1_RX_INTR_SHIFT;
2340 struct bcmgenet_rx_ring *ring;2274 struct bcmgenet_rx_ring *ring;
2341 2275
2342 bcmgenet_intrl2_0_writel(priv, int0_disable, INTRL2_CPU_MASK_SET);
2343 bcmgenet_intrl2_1_writel(priv, int1_disable, INTRL2_CPU_MASK_SET);
2344
2345 for (i = 0; i < priv->hw_params->rx_queues; ++i) {2276 for (i = 0; i < priv->hw_params->rx_queues; ++i) {
2346 ring = &priv->rx_rings[i];2277 ring = &priv->rx_rings[i];
2347 napi_disable(&ring->napi);2278 napi_disable(&ring->napi);
@@ -2414,9 +2345,6 @@ static int bcmgenet_init_rx_queues(struct net_device *dev) · 66 unmodified lines
2414 ring_cfg |= (1 << DESC_INDEX);2345 ring_cfg |= (1 << DESC_INDEX);
2415 dma_ctrl |= (1 << (DESC_INDEX + DMA_RING_BUF_EN_SHIFT));2346 dma_ctrl |= (1 << (DESC_INDEX + DMA_RING_BUF_EN_SHIFT));
2416 2347
2417 /* Initialize Rx NAPI */
2418 bcmgenet_init_rx_napi(priv);
2419
2420 /* Enable rings */2348 /* Enable rings */
2421 bcmgenet_rdma_writel(priv, ring_cfg, DMA_RING_CFG);2349 bcmgenet_rdma_writel(priv, ring_cfg, DMA_RING_CFG);
2422 2350
@@ -2505,9 +2433,6 @@ static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) · 82 unmodified lines
2505 bcmgenet_fini_rx_napi(priv);2433 bcmgenet_fini_rx_napi(priv);
2506 bcmgenet_fini_tx_napi(priv);2434 bcmgenet_fini_tx_napi(priv);
2507 2435
2508 /* disable DMA */
2509 bcmgenet_dma_teardown(priv);
2510
2511 for (i = 0; i < priv->num_tx_bds; i++) {2436 for (i = 0; i < priv->num_tx_bds; i++) {
2512 cb = priv->tx_cbs + i;2437 cb = priv->tx_cbs + i;
2513 skb = bcmgenet_free_tx_cb(&priv->pdev->dev, cb);2438 skb = bcmgenet_free_tx_cb(&priv->pdev->dev, cb);
@@ -2590,27 +2515,20 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) · 76 unmodified lines
2590/* Interrupt bottom half */2515/* Interrupt bottom half */
2591static void bcmgenet_irq_task(struct work_struct *work)2516static void bcmgenet_irq_task(struct work_struct *work)
2592{2517{
2593 unsigned long flags;
2594 unsigned int status;2518 unsigned int status;
2595 struct bcmgenet_priv *priv = container_of(2519 struct bcmgenet_priv *priv = container_of(
2596 work, struct bcmgenet_priv, bcmgenet_irq_work);2520 work, struct bcmgenet_priv, bcmgenet_irq_work);
2597 2521
2598 netif_dbg(priv, intr, priv->dev, "%s\n", __func__);2522 netif_dbg(priv, intr, priv->dev, "%s\n", __func__);
2599 2523
2600 spin_lock_irqsave(&priv->lock, flags);2524 spin_lock_irq(&priv->lock);
2601 status = priv->irq0_stat;2525 status = priv->irq0_stat;
2602 priv->irq0_stat = 0;2526 priv->irq0_stat = 0;
2603 spin_unlock_irqrestore(&priv->lock, flags);2527 spin_unlock_irq(&priv->lock);
2604
2605 if (status & UMAC_IRQ_MPD_R) {
2606 netif_dbg(priv, wol, priv->dev,
2607 "magic packet detected, waking up\n");
2608 bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC);
2609 }
2610 2528
2611 /* Link UP/DOWN event */2529 /* Link UP/DOWN event */
2612 if (status & UMAC_IRQ_LINK_EVENT)2530 if (status & UMAC_IRQ_LINK_EVENT)
2613 phy_mac_interrupt(priv->phydev,2531 phy_mac_interrupt(priv->dev->phydev,
2614 !!(status & UMAC_IRQ_LINK_UP));2532 !!(status & UMAC_IRQ_LINK_UP));
2615}2533}
2616 2534
@@ -2698,23 +2616,13 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) · 81 unmodified lines
2698 }2616 }
2699 }2617 }
2700 2618
2701 if (priv->irq0_stat & (UMAC_IRQ_PHY_DET_R |
2702 UMAC_IRQ_PHY_DET_F |
2703 UMAC_IRQ_LINK_EVENT |
2704 UMAC_IRQ_HFB_SM |
2705 UMAC_IRQ_HFB_MM)) {
2706 /* all other interested interrupts handled in bottom half */
2707 schedule_work(&priv->bcmgenet_irq_work);
2708 }
2709
2710 if ((priv->hw_params->flags & GENET_HAS_MDIO_INTR) &&2619 if ((priv->hw_params->flags & GENET_HAS_MDIO_INTR) &&
2711 status & (UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR)) {2620 status & (UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR)) {
2712 wake_up(&priv->wq);2621 wake_up(&priv->wq);
2713 }2622 }
2714 2623
2715 /* all other interested interrupts handled in bottom half */2624 /* all other interested interrupts handled in bottom half */
2716 status &= (UMAC_IRQ_LINK_EVENT |2625 status &= UMAC_IRQ_LINK_EVENT;
2717 UMAC_IRQ_MPD_R);
2718 if (status) {2626 if (status) {
2719 /* Save irq status for bottom-half processing. */2627 /* Save irq status for bottom-half processing. */
2720 spin_lock_irqsave(&priv->lock, flags);2628 spin_lock_irqsave(&priv->lock, flags);
@@ -2849,16 +2757,16 @@ static void bcmgenet_netif_start(struct net_device *dev) · 128 unmodified lines
2849 2757
2850 /* Start the network engine */2758 /* Start the network engine */
2851 bcmgenet_enable_rx_napi(priv);2759 bcmgenet_enable_rx_napi(priv);
2852 bcmgenet_enable_tx_napi(priv);
2853 2760
2854 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, true);2761 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, true);
2855 2762
2856 netif_tx_start_all_queues(dev);2763 netif_tx_start_all_queues(dev);
2764 bcmgenet_enable_tx_napi(priv);
2857 2765
2858 /* Monitor link interrupts now */2766 /* Monitor link interrupts now */
2859 bcmgenet_link_intr_enable(priv);2767 bcmgenet_link_intr_enable(priv);
2860 2768
2861 phy_start(priv->phydev);2769 phy_start(dev->phydev);
2862}2770}
2863 2771
2864static int bcmgenet_open(struct net_device *dev)2772static int bcmgenet_open(struct net_device *dev)
@@ -2882,12 +2790,7 @@ static int bcmgenet_open(struct net_device *dev) · 17 unmodified lines
2882 /* take MAC out of reset */2790 /* take MAC out of reset */
2883 bcmgenet_umac_reset(priv);2791 bcmgenet_umac_reset(priv);
2884 2792
2885 ret = init_umac(priv);2793 init_umac(priv);
2886 if (ret)
2887 goto err_clk_disable;
2888
2889 /* disable ethernet MAC while updating its registers */
2890 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
2891 2794
2892 /* Make sure we reflect the value of CRC_CMD_FWD */2795 /* Make sure we reflect the value of CRC_CMD_FWD */
2893 reg = bcmgenet_umac_readl(priv, UMAC_CMD);2796 reg = bcmgenet_umac_readl(priv, UMAC_CMD);
@@ -2946,6 +2849,7 @@ err_irq1: · 52 unmodified lines
2946err_irq0:2849err_irq0:
2947 free_irq(priv->irq0, priv);2850 free_irq(priv->irq0, priv);
2948err_fini_dma:2851err_fini_dma:
2852 bcmgenet_dma_teardown(priv);
2949 bcmgenet_fini_dma(priv);2853 bcmgenet_fini_dma(priv);
2950err_clk_disable:2854err_clk_disable:
2951 if (priv->internal_phy)2855 if (priv->internal_phy)
@@ -2958,11 +2862,20 @@ static void bcmgenet_netif_stop(struct net_device *dev) · 6 unmodified lines
2958{2862{
2959 struct bcmgenet_priv *priv = netdev_priv(dev);2863 struct bcmgenet_priv *priv = netdev_priv(dev);
2960 2864
2865 bcmgenet_disable_tx_napi(priv);
2961 netif_tx_stop_all_queues(dev);2866 netif_tx_stop_all_queues(dev);
2962 phy_stop(priv->phydev);2867
2963 bcmgenet_intr_disable(priv);2868 /* Disable MAC receive */
2869 umac_enable_set(priv, CMD_RX_EN, false);
2870
2871 bcmgenet_dma_teardown(priv);
2872
2873 /* Disable MAC transmit. TX DMA disabled must be done before this */
2874 umac_enable_set(priv, CMD_TX_EN, false);
2875
2876 phy_stop(dev->phydev);
2964 bcmgenet_disable_rx_napi(priv);2877 bcmgenet_disable_rx_napi(priv);
2965 bcmgenet_disable_tx_napi(priv);2878 bcmgenet_intr_disable(priv);
2966 2879
2967 /* Wait for pending work items to complete. Since interrupts are2880 /* Wait for pending work items to complete. Since interrupts are
2968 * disabled no new work will be scheduled.2881 * disabled no new work will be scheduled.
@@ -2973,33 +2886,23 @@ static void bcmgenet_netif_stop(struct net_device *dev) · 4 unmodified lines
2973 priv->old_speed = -1;2886 priv->old_speed = -1;
2974 priv->old_duplex = -1;2887 priv->old_duplex = -1;
2975 priv->old_pause = -1;2888 priv->old_pause = -1;
2889
2890 /* tx reclaim */
2891 bcmgenet_tx_reclaim_all(dev);
2892 bcmgenet_fini_dma(priv);
2976}2893}
2977 2894
2978static int bcmgenet_close(struct net_device *dev)2895static int bcmgenet_close(struct net_device *dev)
2979{2896{
2980 struct bcmgenet_priv *priv = netdev_priv(dev);2897 struct bcmgenet_priv *priv = netdev_priv(dev);
2981 int ret;2898 int ret = 0;
2982 2899
2983 netif_dbg(priv, ifdown, dev, "bcmgenet_close\n");2900 netif_dbg(priv, ifdown, dev, "bcmgenet_close\n");
2984 2901
2985 bcmgenet_netif_stop(dev);2902 bcmgenet_netif_stop(dev);
2986 2903
2987 /* Really kill the PHY state machine and disconnect from it */2904 /* Really kill the PHY state machine and disconnect from it */
2988 phy_disconnect(priv->phydev);2905 phy_disconnect(dev->phydev);
2989
2990 /* Disable MAC receive */
2991 umac_enable_set(priv, CMD_RX_EN, false);
2992
2993 ret = bcmgenet_dma_teardown(priv);
2994 if (ret)
2995 return ret;
2996
2997 /* Disable MAC transmit. TX DMA disabled must be done before this */
2998 umac_enable_set(priv, CMD_TX_EN, false);
2999
3000 /* tx reclaim */
3001 bcmgenet_tx_reclaim_all(dev);
3002 bcmgenet_fini_dma(priv);
3003 2906
3004 free_irq(priv->irq0, priv);2907 free_irq(priv->irq0, priv);
3005 free_irq(priv->irq1, priv);2908 free_irq(priv->irq1, priv);
@@ -3018,7 +2921,6 @@ static void bcmgenet_dump_tx_queue(struct bcmgenet_tx_ring *ring) · 12 unmodified lines
3018 u32 p_index, c_index, intsts, intmsk;2921 u32 p_index, c_index, intsts, intmsk;
3019 struct netdev_queue *txq;2922 struct netdev_queue *txq;
3020 unsigned int free_bds;2923 unsigned int free_bds;
3021 unsigned long flags;
3022 bool txq_stopped;2924 bool txq_stopped;
3023 2925
3024 if (!netif_msg_tx_err(priv))2926 if (!netif_msg_tx_err(priv))
@@ -3026,7 +2928,7 @@ static void bcmgenet_dump_tx_queue(struct bcmgenet_tx_ring *ring) · 1 unmodified line
3026 2928
3027 txq = netdev_get_tx_queue(priv->dev, ring->queue);2929 txq = netdev_get_tx_queue(priv->dev, ring->queue);
3028 2930
3029 spin_lock_irqsave(&ring->lock, flags);2931 spin_lock(&ring->lock);
3030 if (ring->index == DESC_INDEX) {2932 if (ring->index == DESC_INDEX) {
3031 intsts = ~bcmgenet_intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS);2933 intsts = ~bcmgenet_intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS);
3032 intmsk = UMAC_IRQ_TXDMA_DONE | UMAC_IRQ_TXDMA_MBDONE;2934 intmsk = UMAC_IRQ_TXDMA_DONE | UMAC_IRQ_TXDMA_MBDONE;
@@ -3038,7 +2940,7 @@ static void bcmgenet_dump_tx_queue(struct bcmgenet_tx_ring *ring) · 5 unmodified lines
3038 p_index = bcmgenet_tdma_ring_readl(priv, ring->index, TDMA_PROD_INDEX);2940 p_index = bcmgenet_tdma_ring_readl(priv, ring->index, TDMA_PROD_INDEX);
3039 txq_stopped = netif_tx_queue_stopped(txq);2941 txq_stopped = netif_tx_queue_stopped(txq);
3040 free_bds = ring->free_bds;2942 free_bds = ring->free_bds;
3041 spin_unlock_irqrestore(&ring->lock, flags);2943 spin_unlock(&ring->lock);
3042 2944
3043 netif_err(priv, tx_err, priv->dev, "Ring %d queue %d status summary\n"2945 netif_err(priv, tx_err, priv->dev, "Ring %d queue %d status summary\n"
3044 "TX queue status: %s, interrupts: %s\n"2946 "TX queue status: %s, interrupts: %s\n"
@@ -3564,9 +3466,7 @@ static int bcmgenet_probe(struct platform_device *pdev) · 519 unmodified lines
3564 !strcasecmp(phy_mode_str, "internal"))3466 !strcasecmp(phy_mode_str, "internal"))
3565 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);3467 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
3566 3468
3567 err = reset_umac(priv);3469 reset_umac(priv);
3568 if (err)
3569 goto err_clk_disable;
3570 3470
3571 err = bcmgenet_mii_init(dev);3471 err = bcmgenet_mii_init(dev);
3572 if (err)3472 if (err)
@@ -3614,7 +3514,7 @@ static int bcmgenet_suspend(struct device *d) · 41 unmodified lines
3614{3514{
3615 struct net_device *dev = dev_get_drvdata(d);3515 struct net_device *dev = dev_get_drvdata(d);
3616 struct bcmgenet_priv *priv = netdev_priv(dev);3516 struct bcmgenet_priv *priv = netdev_priv(dev);
3617 int ret;3517 int ret = 0;
3618 3518
3619 if (!netif_running(dev))3519 if (!netif_running(dev))
3620 return 0;3520 return 0;
@@ -3622,24 +3522,10 @@ static int bcmgenet_suspend(struct device *d) · 1 unmodified line
3622 bcmgenet_netif_stop(dev);3522 bcmgenet_netif_stop(dev);
3623 3523
3624 if (!device_may_wakeup(d))3524 if (!device_may_wakeup(d))
3625 phy_suspend(priv->phydev);3525 phy_suspend(dev->phydev);
3626 3526
3627 netif_device_detach(dev);3527 netif_device_detach(dev);
3628 3528
3629 /* Disable MAC receive */
3630 umac_enable_set(priv, CMD_RX_EN, false);
3631
3632 ret = bcmgenet_dma_teardown(priv);
3633 if (ret)
3634 return ret;
3635
3636 /* Disable MAC transmit. TX DMA disabled must be done before this */
3637 umac_enable_set(priv, CMD_TX_EN, false);
3638
3639 /* tx reclaim */
3640 bcmgenet_tx_reclaim_all(dev);
3641 bcmgenet_fini_dma(priv);
3642
3643 /* Prepare the device for Wake-on-LAN and switch to the slow clock */3529 /* Prepare the device for Wake-on-LAN and switch to the slow clock */
3644 if (device_may_wakeup(d) && priv->wolopts) {3530 if (device_may_wakeup(d) && priv->wolopts) {
3645 ret = bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);3531 ret = bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);
@@ -3678,21 +3564,17 @@ static int bcmgenet_resume(struct device *d) · 32 unmodified lines
3678 3564
3679 bcmgenet_umac_reset(priv);3565 bcmgenet_umac_reset(priv);
3680 3566
3681 ret = init_umac(priv);3567 init_umac(priv);
3682 if (ret)
3683 goto out_clk_disable;
3684 3568
3685 /* From WOL-enabled suspend, switch to regular clock */3569 /* From WOL-enabled suspend, switch to regular clock */
3686 if (priv->wolopts)3570 if (priv->wolopts)
3687 clk_disable_unprepare(priv->clk_wol);3571 clk_disable_unprepare(priv->clk_wol);
3688 3572
3689 phy_init_hw(priv->phydev);3573 phy_init_hw(dev->phydev);
3574
3690 /* Speed settings must be restored */3575 /* Speed settings must be restored */
3691 bcmgenet_mii_config(priv->dev, false);3576 bcmgenet_mii_config(priv->dev, false);
3692 3577
3693 /* disable ethernet MAC while updating its registers */
3694 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
3695
3696 bcmgenet_set_hw_addr(priv, dev->dev_addr);3578 bcmgenet_set_hw_addr(priv, dev->dev_addr);
3697 3579
3698 if (priv->internal_phy) {3580 if (priv->internal_phy) {
@@ -3720,7 +3602,7 @@ static int bcmgenet_resume(struct device *d) · 21 unmodified lines
3720 netif_device_attach(dev);3602 netif_device_attach(dev);
3721 3603
3722 if (!device_may_wakeup(d))3604 if (!device_may_wakeup(d))
3723 phy_resume(priv->phydev);3605 phy_resume(dev->phydev);
3724 3606
3725 if (priv->eee.eee_enabled)3607 if (priv->eee.eee_enabled)
3726 bcmgenet_eee_enable_set(dev, true);3608 bcmgenet_eee_enable_set(dev, true);
drivers/net/ethernet/broadcom/genet/bcmgenet.h+0−2
@@ -617,7 +617,6 @@ struct bcmgenet_priv { · 616 unmodified lines
617 617
618 /* MDIO bus variables */618 /* MDIO bus variables */
619 wait_queue_head_t wq;619 wait_queue_head_t wq;
620 struct phy_device *phydev;
621 bool internal_phy;620 bool internal_phy;
622 struct device_node *phy_dn;621 struct device_node *phy_dn;
623 struct device_node *mdio_dn;622 struct device_node *mdio_dn;
@@ -711,7 +710,6 @@ int bcmgenet_mii_init(struct net_device *dev); · 87 unmodified lines
711int bcmgenet_mii_config(struct net_device *dev, bool init);710int bcmgenet_mii_config(struct net_device *dev, bool init);
712int bcmgenet_mii_probe(struct net_device *dev);711int bcmgenet_mii_probe(struct net_device *dev);
713void bcmgenet_mii_exit(struct net_device *dev);712void bcmgenet_mii_exit(struct net_device *dev);
714void bcmgenet_mii_reset(struct net_device *dev);
715void bcmgenet_phy_power_set(struct net_device *dev, bool enable);713void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
716void bcmgenet_mii_setup(struct net_device *dev);714void bcmgenet_mii_setup(struct net_device *dev);
717 715
drivers/net/ethernet/broadcom/genet/bcmmii.c+7−27
@@ -34,7 +34,7 @@ · 33 unmodified lines
34void bcmgenet_mii_setup(struct net_device *dev)34void bcmgenet_mii_setup(struct net_device *dev)
35{35{
36 struct bcmgenet_priv *priv = netdev_priv(dev);36 struct bcmgenet_priv *priv = netdev_priv(dev);
37 struct phy_device *phydev = priv->phydev;37 struct phy_device *phydev = dev->phydev;
38 u32 reg, cmd_bits = 0;38 u32 reg, cmd_bits = 0;
39 bool status_changed = false;39 bool status_changed = false;
40 40
@@ -121,22 +121,6 @@ static int bcmgenet_fixed_phy_link_update(struct net_device *dev, · 80 unmodified lines
121 return 0;121 return 0;
122}122}
123 123
124/* Perform a voluntary PHY software reset, since the EPHY is very finicky about
125 * not doing it and will start corrupting packets
126 */
127void bcmgenet_mii_reset(struct net_device *dev)
128{
129 struct bcmgenet_priv *priv = netdev_priv(dev);
130
131 if (GENET_IS_V4(priv))
132 return;
133
134 if (priv->phydev) {
135 phy_init_hw(priv->phydev);
136 phy_start_aneg(priv->phydev);
137 }
138}
139
140void bcmgenet_phy_power_set(struct net_device *dev, bool enable)124void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
141{125{
142 struct bcmgenet_priv *priv = netdev_priv(dev);126 struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -182,14 +166,14 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) · 39 unmodified lines
182 }166 }
183 167
184 if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)168 if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
185 fixed_phy_set_link_update(priv->phydev,169 fixed_phy_set_link_update(priv->dev->phydev,
186 bcmgenet_fixed_phy_link_update);170 bcmgenet_fixed_phy_link_update);
187}171}
188 172
189int bcmgenet_mii_config(struct net_device *dev, bool init)173int bcmgenet_mii_config(struct net_device *dev, bool init)
190{174{
191 struct bcmgenet_priv *priv = netdev_priv(dev);175 struct bcmgenet_priv *priv = netdev_priv(dev);
192 struct phy_device *phydev = priv->phydev;176 struct phy_device *phydev = dev->phydev;
193 struct device *kdev = &priv->pdev->dev;177 struct device *kdev = &priv->pdev->dev;
194 const char *phy_name = NULL;178 const char *phy_name = NULL;
195 u32 id_mode_dis = 0;179 u32 id_mode_dis = 0;
@@ -236,7 +220,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 40 unmodified lines
236 * capabilities, use that knowledge to also configure the220 * capabilities, use that knowledge to also configure the
237 * Reverse MII interface correctly.221 * Reverse MII interface correctly.
238 */222 */
239 if ((priv->phydev->supported & PHY_BASIC_FEATURES) ==223 if ((dev->phydev->supported & PHY_BASIC_FEATURES) ==
240 PHY_BASIC_FEATURES)224 PHY_BASIC_FEATURES)
241 port_ctrl = PORT_MODE_EXT_RVMII_25;225 port_ctrl = PORT_MODE_EXT_RVMII_25;
242 else226 else
@@ -306,7 +290,7 @@ int bcmgenet_mii_probe(struct net_device *dev) · 63 unmodified lines
306 return -ENODEV;290 return -ENODEV;
307 }291 }
308 } else {292 } else {
309 phydev = priv->phydev;293 phydev = dev->phydev;
310 phydev->dev_flags = phy_flags;294 phydev->dev_flags = phy_flags;
311 295
312 ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,296 ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
@@ -317,8 +301,6 @@ int bcmgenet_mii_probe(struct net_device *dev) · 4 unmodified lines
317 }301 }
318 }302 }
319 303
320 priv->phydev = phydev;
321
322 /* Configure port multiplexer based on what the probed PHY device since304 /* Configure port multiplexer based on what the probed PHY device since
323 * reading the 'max-speed' property determines the maximum supported305 * reading the 'max-speed' property determines the maximum supported
324 * PHY speed which is needed for bcmgenet_mii_config() to configure306 * PHY speed which is needed for bcmgenet_mii_config() to configure
@@ -326,7 +308,7 @@ int bcmgenet_mii_probe(struct net_device *dev) · 1 unmodified line
326 */308 */
327 ret = bcmgenet_mii_config(dev, true);309 ret = bcmgenet_mii_config(dev, true);
328 if (ret) {310 if (ret) {
329 phy_disconnect(priv->phydev);311 phy_disconnect(dev->phydev);
330 return ret;312 return ret;
331 }313 }
332 314
@@ -336,7 +318,7 @@ int bcmgenet_mii_probe(struct net_device *dev) · 3 unmodified lines
336 * Ethernet MAC ISRs318 * Ethernet MAC ISRs
337 */319 */
338 if (priv->internal_phy)320 if (priv->internal_phy)
339 priv->phydev->irq = PHY_IGNORE_INTERRUPT;321 dev->phydev->irq = PHY_IGNORE_INTERRUPT;
340 322
341 return 0;323 return 0;
342}324}
@@ -545,7 +527,6 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv) · 202 unmodified lines
545 527
546 }528 }
547 529
548 priv->phydev = phydev;
549 priv->phy_interface = pd->phy_interface;530 priv->phy_interface = pd->phy_interface;
550 531
551 return 0;532 return 0;
@@ -590,5 +571,4 @@ void bcmgenet_mii_exit(struct net_device *dev) · 38 unmodified lines
590 of_phy_deregister_fixed_link(dn);571 of_phy_deregister_fixed_link(dn);
591 of_node_put(priv->phy_dn);572 of_node_put(priv->phy_dn);
592 platform_device_unregister(priv->mii_pdev);573 platform_device_unregister(priv->mii_pdev);
593 platform_device_put(priv->mii_pdev);
594}574}
drivers/net/ethernet/broadcom/tg3.c+1−3
@@ -11087,9 +11087,7 @@ static void tg3_timer_init(struct tg3 *tp) · 11086 unmodified lines
11087 tp->asf_multiplier = (HZ / tp->timer_offset) *11087 tp->asf_multiplier = (HZ / tp->timer_offset) *
11088 TG3_FW_UPDATE_FREQ_SEC;11088 TG3_FW_UPDATE_FREQ_SEC;
11089 11089
11090 init_timer(&tp->timer);11090 setup_timer(&tp->timer, tg3_timer, (unsigned long)tp);
11091 tp->timer.data = (unsigned long) tp;
11092 tp->timer.function = tg3_timer;
11093}11091}
11094 11092
11095static void tg3_timer_start(struct tg3 *tp)11093static void tg3_timer_start(struct tg3 *tp)
drivers/net/ethernet/brocade/bna/bnad.c+19−24
@@ -1693,9 +1693,9 @@ err_return: · 1692 unmodified lines
1693/* Timer callbacks */1693/* Timer callbacks */
1694/* a) IOC timer */1694/* a) IOC timer */
1695static void1695static void
1696bnad_ioc_timeout(unsigned long data)1696bnad_ioc_timeout(struct timer_list *t)
1697{1697{
1698 struct bnad *bnad = (struct bnad *)data;1698 struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.ioc_timer);
1699 unsigned long flags;1699 unsigned long flags;
1700 1700
1701 spin_lock_irqsave(&bnad->bna_lock, flags);1701 spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1704,9 +1704,9 @@ bnad_ioc_timeout(unsigned long data) · 2 unmodified lines
1704}1704}
1705 1705
1706static void1706static void
1707bnad_ioc_hb_check(unsigned long data)1707bnad_ioc_hb_check(struct timer_list *t)
1708{1708{
1709 struct bnad *bnad = (struct bnad *)data;1709 struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.hb_timer);
1710 unsigned long flags;1710 unsigned long flags;
1711 1711
1712 spin_lock_irqsave(&bnad->bna_lock, flags);1712 spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1715,9 +1715,9 @@ bnad_ioc_hb_check(unsigned long data) · 2 unmodified lines
1715}1715}
1716 1716
1717static void1717static void
1718bnad_iocpf_timeout(unsigned long data)1718bnad_iocpf_timeout(struct timer_list *t)
1719{1719{
1720 struct bnad *bnad = (struct bnad *)data;1720 struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.iocpf_timer);
1721 unsigned long flags;1721 unsigned long flags;
1722 1722
1723 spin_lock_irqsave(&bnad->bna_lock, flags);1723 spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1726,9 +1726,9 @@ bnad_iocpf_timeout(unsigned long data) · 2 unmodified lines
1726}1726}
1727 1727
1728static void1728static void
1729bnad_iocpf_sem_timeout(unsigned long data)1729bnad_iocpf_sem_timeout(struct timer_list *t)
1730{1730{
1731 struct bnad *bnad = (struct bnad *)data;1731 struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.sem_timer);
1732 unsigned long flags;1732 unsigned long flags;
1733 1733
1734 spin_lock_irqsave(&bnad->bna_lock, flags);1734 spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1748,9 +1748,9 @@ bnad_iocpf_sem_timeout(unsigned long data) · 13 unmodified lines
1748 1748
1749/* b) Dynamic Interrupt Moderation Timer */1749/* b) Dynamic Interrupt Moderation Timer */
1750static void1750static void
1751bnad_dim_timeout(unsigned long data)1751bnad_dim_timeout(struct timer_list *t)
1752{1752{
1753 struct bnad *bnad = (struct bnad *)data;1753 struct bnad *bnad = from_timer(bnad, t, dim_timer);
1754 struct bnad_rx_info *rx_info;1754 struct bnad_rx_info *rx_info;
1755 struct bnad_rx_ctrl *rx_ctrl;1755 struct bnad_rx_ctrl *rx_ctrl;
1756 int i, j;1756 int i, j;
@@ -1781,9 +1781,9 @@ bnad_dim_timeout(unsigned long data) · 24 unmodified lines
1781 1781
1782/* c) Statistics Timer */1782/* c) Statistics Timer */
1783static void1783static void
1784bnad_stats_timeout(unsigned long data)1784bnad_stats_timeout(struct timer_list *t)
1785{1785{
1786 struct bnad *bnad = (struct bnad *)data;1786 struct bnad *bnad = from_timer(bnad, t, stats_timer);
1787 unsigned long flags;1787 unsigned long flags;
1788 1788
1789 if (!netif_running(bnad->netdev) ||1789 if (!netif_running(bnad->netdev) ||
@@ -1804,8 +1804,7 @@ bnad_dim_timer_start(struct bnad *bnad) · 14 unmodified lines
1804{1804{
1805 if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED &&1805 if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED &&
1806 !test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) {1806 !test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) {
1807 setup_timer(&bnad->dim_timer, bnad_dim_timeout,1807 timer_setup(&bnad->dim_timer, bnad_dim_timeout, 0);
1808 (unsigned long)bnad);
1809 set_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags);1808 set_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags);
1810 mod_timer(&bnad->dim_timer,1809 mod_timer(&bnad->dim_timer,
1811 jiffies + msecs_to_jiffies(BNAD_DIM_TIMER_FREQ));1810 jiffies + msecs_to_jiffies(BNAD_DIM_TIMER_FREQ));
@@ -1823,8 +1822,7 @@ bnad_stats_timer_start(struct bnad *bnad) · 11 unmodified lines
1823 1822
1824 spin_lock_irqsave(&bnad->bna_lock, flags);1823 spin_lock_irqsave(&bnad->bna_lock, flags);
1825 if (!test_and_set_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) {1824 if (!test_and_set_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) {
1826 setup_timer(&bnad->stats_timer, bnad_stats_timeout,1825 timer_setup(&bnad->stats_timer, bnad_stats_timeout, 0);
1827 (unsigned long)bnad);
1828 mod_timer(&bnad->stats_timer,1826 mod_timer(&bnad->stats_timer,
1829 jiffies + msecs_to_jiffies(BNAD_STATS_TIMER_FREQ));1827 jiffies + msecs_to_jiffies(BNAD_STATS_TIMER_FREQ));
1830 }1828 }
@@ -3692,14 +3690,11 @@ bnad_pci_probe(struct pci_dev *pdev, · 1861 unmodified lines
3692 goto res_free;3690 goto res_free;
3693 3691
3694 /* Set up timers */3692 /* Set up timers */
3695 setup_timer(&bnad->bna.ioceth.ioc.ioc_timer, bnad_ioc_timeout,3693 timer_setup(&bnad->bna.ioceth.ioc.ioc_timer, bnad_ioc_timeout, 0);
3696 (unsigned long)bnad);3694 timer_setup(&bnad->bna.ioceth.ioc.hb_timer, bnad_ioc_hb_check, 0);
3697 setup_timer(&bnad->bna.ioceth.ioc.hb_timer, bnad_ioc_hb_check,3695 timer_setup(&bnad->bna.ioceth.ioc.iocpf_timer, bnad_iocpf_timeout, 0);
3698 (unsigned long)bnad);3696 timer_setup(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout,
3699 setup_timer(&bnad->bna.ioceth.ioc.iocpf_timer, bnad_iocpf_timeout,3697 0);
3700 (unsigned long)bnad);
3701 setup_timer(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout,
3702 (unsigned long)bnad);
3703 3698
3704 /*3699 /*
3705 * Start the chip3700 * Start the chip
drivers/net/ethernet/cadence/macb_main.c+9−2
@@ -611,6 +611,9 @@ static int macb_mii_init(struct macb *bp) · 610 unmodified lines
611err_out_unregister_bus:611err_out_unregister_bus:
612 mdiobus_unregister(bp->mii_bus);612 mdiobus_unregister(bp->mii_bus);
613err_out_free_mdiobus:613err_out_free_mdiobus:
614 of_node_put(bp->phy_node);
615 if (np && of_phy_is_fixed_link(np))
616 of_phy_deregister_fixed_link(np);
614 mdiobus_free(bp->mii_bus);617 mdiobus_free(bp->mii_bus);
615err_out:618err_out:
616 return err;619 return err;
@@ -1218,8 +1221,6 @@ static int macb_poll(struct napi_struct *napi, int budget) · 601 unmodified lines
1218 status = macb_readl(bp, RSR);1221 status = macb_readl(bp, RSR);
1219 macb_writel(bp, RSR, status);1222 macb_writel(bp, RSR, status);
1220 1223
1221 work_done = 0;
1222
1223 netdev_vdbg(bp->dev, "poll: status = %08lx, budget = %d\n",1224 netdev_vdbg(bp->dev, "poll: status = %08lx, budget = %d\n",
1224 (unsigned long)status, budget);1225 (unsigned long)status, budget);
1225 1226
@@ -3552,6 +3553,9 @@ static int macb_probe(struct platform_device *pdev) · 2326 unmodified lines
3552err_out_unregister_mdio:3553err_out_unregister_mdio:
3553 phy_disconnect(dev->phydev);3554 phy_disconnect(dev->phydev);
3554 mdiobus_unregister(bp->mii_bus);3555 mdiobus_unregister(bp->mii_bus);
3556 of_node_put(bp->phy_node);
3557 if (np && of_phy_is_fixed_link(np))
3558 of_phy_deregister_fixed_link(np);
3555 mdiobus_free(bp->mii_bus);3559 mdiobus_free(bp->mii_bus);
3556 3560
3557 /* Shutdown the PHY if there is a GPIO reset */3561 /* Shutdown the PHY if there is a GPIO reset */
@@ -3574,6 +3578,7 @@ static int macb_remove(struct platform_device *pdev) · 16 unmodified lines
3574{3578{
3575 struct net_device *dev;3579 struct net_device *dev;
3576 struct macb *bp;3580 struct macb *bp;
3581 struct device_node *np = pdev->dev.of_node;
3577 3582
3578 dev = platform_get_drvdata(pdev);3583 dev = platform_get_drvdata(pdev);
3579 3584
@@ -3582,6 +3587,8 @@ static int macb_remove(struct platform_device *pdev) · 2 unmodified lines
3582 if (dev->phydev)3587 if (dev->phydev)
3583 phy_disconnect(dev->phydev);3588 phy_disconnect(dev->phydev);
3584 mdiobus_unregister(bp->mii_bus);3589 mdiobus_unregister(bp->mii_bus);
3590 if (np && of_phy_is_fixed_link(np))
3591 of_phy_deregister_fixed_link(np);
3585 dev->phydev = NULL;3592 dev->phydev = NULL;
3586 mdiobus_free(bp->mii_bus);3593 mdiobus_free(bp->mii_bus);
3587 3594
drivers/net/ethernet/cavium/Kconfig+1−0
@@ -53,6 +53,7 @@ config THUNDER_NIC_RGX · 52 unmodified lines
53config LIQUIDIO53config LIQUIDIO
54 tristate "Cavium LiquidIO support"54 tristate "Cavium LiquidIO support"
55 depends on 64BIT55 depends on 64BIT
56 depends on MAY_USE_DEVLINK
56 imply PTP_1588_CLOCK57 imply PTP_1588_CLOCK
57 select FW_LOADER58 select FW_LOADER
58 select LIBCRC32C59 select LIBCRC32C
drivers/net/ethernet/cavium/liquidio/Makefile+1−1
@@ -18,7 +18,7 @@ liquidio-$(CONFIG_LIQUIDIO) += lio_ethtool.o \ · 17 unmodified lines
18 octeon_droq.o \18 octeon_droq.o \
19 octeon_nic.o19 octeon_nic.o
20 20
21liquidio-objs := lio_main.o octeon_console.o $(liquidio-y)21liquidio-objs := lio_main.o octeon_console.o lio_vf_rep.o $(liquidio-y)
22 22
23obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o23obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o
24 24
drivers/net/ethernet/cavium/liquidio/lio_core.c+8−14
@@ -91,7 +91,7 @@ void octeon_update_tx_completion_counters(void *buf, int reqtype, · 90 unmodified lines
91 *bytes_compl += skb->len;91 *bytes_compl += skb->len;
92}92}
93 93
94void octeon_report_sent_bytes_to_bql(void *buf, int reqtype)94int octeon_report_sent_bytes_to_bql(void *buf, int reqtype)
95{95{
96 struct octnet_buf_free_info *finfo;96 struct octnet_buf_free_info *finfo;
97 struct sk_buff *skb;97 struct sk_buff *skb;
@@ -112,11 +112,13 @@ void octeon_report_sent_bytes_to_bql(void *buf, int reqtype) · 14 unmodified lines
112 break;112 break;
113 113
114 default:114 default:
115 return;115 return 0;
116 }116 }
117 117
118 txq = netdev_get_tx_queue(skb->dev, skb_get_queue_mapping(skb));118 txq = netdev_get_tx_queue(skb->dev, skb_get_queue_mapping(skb));
119 netdev_tx_sent_queue(txq, skb->len);119 netdev_tx_sent_queue(txq, skb->len);
120
121 return netif_xmit_stopped(txq);
120}122}
121 123
122void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr)124void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr)
@@ -141,6 +143,7 @@ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr) · 18 unmodified lines
141 switch (nctrl->ncmd.s.cmd) {143 switch (nctrl->ncmd.s.cmd) {
142 case OCTNET_CMD_CHANGE_DEVFLAGS:144 case OCTNET_CMD_CHANGE_DEVFLAGS:
143 case OCTNET_CMD_SET_MULTI_LIST:145 case OCTNET_CMD_SET_MULTI_LIST:
146 case OCTNET_CMD_SET_UC_LIST:
144 break;147 break;
145 148
146 case OCTNET_CMD_CHANGE_MACADDR:149 case OCTNET_CMD_CHANGE_MACADDR:
@@ -464,7 +467,6 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)), · 317 unmodified lines
464 if (netdev) {467 if (netdev) {
465 struct lio *lio = GET_LIO(netdev);468 struct lio *lio = GET_LIO(netdev);
466 struct octeon_device *oct = lio->oct_dev;469 struct octeon_device *oct = lio->oct_dev;
467 int packet_was_received;
468 470
469 /* Do not proceed if the interface is not in RUNNING state. */471 /* Do not proceed if the interface is not in RUNNING state. */
470 if (!ifstate_check(lio, LIO_IFSTATE_RUNNING)) {472 if (!ifstate_check(lio, LIO_IFSTATE_RUNNING)) {
@@ -567,18 +569,10 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)), · 96 unmodified lines
567 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vtag);569 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vtag);
568 }570 }
569 571
570 packet_was_received = (napi_gro_receive(napi, skb) != GRO_DROP);572 napi_gro_receive(napi, skb);
571
572 if (packet_was_received) {
573 droq->stats.rx_bytes_received += len;
574 droq->stats.rx_pkts_received++;
575 } else {
576 droq->stats.rx_dropped++;
577 netif_info(lio, rx_err, lio->netdev,
578 "droq:%d error rx_dropped:%llu\n",
579 droq->q_no, droq->stats.rx_dropped);
580 }
581 573
574 droq->stats.rx_bytes_received += len;
575 droq->stats.rx_pkts_received++;
582 } else {576 } else {
583 recv_buffer_free(skb);577 recv_buffer_free(skb);
584 }578 }
drivers/net/ethernet/cavium/liquidio/lio_main.c+339−43
@@ -21,6 +21,7 @@ · 20 unmodified lines
21#include <linux/firmware.h>21#include <linux/firmware.h>
22#include <net/vxlan.h>22#include <net/vxlan.h>
23#include <linux/kthread.h>23#include <linux/kthread.h>
24#include <net/switchdev.h>
24#include "liquidio_common.h"25#include "liquidio_common.h"
25#include "octeon_droq.h"26#include "octeon_droq.h"
26#include "octeon_iq.h"27#include "octeon_iq.h"
@@ -34,6 +35,7 @@ · 7 unmodified lines
34#include "cn68xx_device.h"35#include "cn68xx_device.h"
35#include "cn23xx_pf_device.h"36#include "cn23xx_pf_device.h"
36#include "liquidio_image.h"37#include "liquidio_image.h"
38#include "lio_vf_rep.h"
37 39
38MODULE_AUTHOR("Cavium Networks, <support@cavium.com>");40MODULE_AUTHOR("Cavium Networks, <support@cavium.com>");
39MODULE_DESCRIPTION("Cavium LiquidIO Intelligent Server Adapter Driver");41MODULE_DESCRIPTION("Cavium LiquidIO Intelligent Server Adapter Driver");
@@ -59,9 +61,9 @@ static int debug = -1; · 19 unmodified lines
59module_param(debug, int, 0644);61module_param(debug, int, 0644);
60MODULE_PARM_DESC(debug, "NETIF_MSG debug bits");62MODULE_PARM_DESC(debug, "NETIF_MSG debug bits");
61 63
62static char fw_type[LIO_MAX_FW_TYPE_LEN] = LIO_FW_NAME_TYPE_NIC;64static char fw_type[LIO_MAX_FW_TYPE_LEN] = LIO_FW_NAME_TYPE_AUTO;
63module_param_string(fw_type, fw_type, sizeof(fw_type), 0444);65module_param_string(fw_type, fw_type, sizeof(fw_type), 0444);
64MODULE_PARM_DESC(fw_type, "Type of firmware to be loaded. Default \"nic\". Use \"none\" to load firmware from flash.");66MODULE_PARM_DESC(fw_type, "Type of firmware to be loaded (default is \"auto\"), which uses firmware in flash, if present, else loads \"nic\".");
65 67
66static u32 console_bitmask;68static u32 console_bitmask;
67module_param(console_bitmask, int, 0644);69module_param(console_bitmask, int, 0644);
@@ -83,6 +85,11 @@ static int octeon_console_debug_enabled(u32 console) · 15 unmodified lines
83 85
84/* runtime link query interval */86/* runtime link query interval */
85#define LIQUIDIO_LINK_QUERY_INTERVAL_MS 100087#define LIQUIDIO_LINK_QUERY_INTERVAL_MS 1000
88/* update localtime to octeon firmware every 60 seconds.
89 * make firmware to use same time reference, so that it will be easy to
90 * correlate firmware logged events/errors with host events, for debugging.
91 */
92#define LIO_SYNC_OCTEON_TIME_INTERVAL_MS 60000
86 93
87struct liquidio_if_cfg_context {94struct liquidio_if_cfg_context {
88 int octeon_id;95 int octeon_id;
@@ -901,6 +908,121 @@ static inline void update_link_status(struct net_device *netdev, · 812 unmodified lines
901 }908 }
902}909}
903 910
911/**
912 * lio_sync_octeon_time_cb - callback that is invoked when soft command
913 * sent by lio_sync_octeon_time() has completed successfully or failed
914 *
915 * @oct - octeon device structure
916 * @status - indicates success or failure
917 * @buf - pointer to the command that was sent to firmware
918 **/
919static void lio_sync_octeon_time_cb(struct octeon_device *oct,
920 u32 status, void *buf)
921{
922 struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
923
924 if (status)
925 dev_err(&oct->pci_dev->dev,
926 "Failed to sync time to octeon; error=%d\n", status);
927
928 octeon_free_soft_command(oct, sc);
929}
930
931/**
932 * lio_sync_octeon_time - send latest localtime to octeon firmware so that
933 * firmware will correct it's time, in case there is a time skew
934 *
935 * @work: work scheduled to send time update to octeon firmware
936 **/
937static void lio_sync_octeon_time(struct work_struct *work)
938{
939 struct cavium_wk *wk = (struct cavium_wk *)work;
940 struct lio *lio = (struct lio *)wk->ctxptr;
941 struct octeon_device *oct = lio->oct_dev;
942 struct octeon_soft_command *sc;
943 struct timespec64 ts;
944 struct lio_time *lt;
945 int ret;
946
947 sc = octeon_alloc_soft_command(oct, sizeof(struct lio_time), 0, 0);
948 if (!sc) {
949 dev_err(&oct->pci_dev->dev,
950 "Failed to sync time to octeon: soft command allocation failed\n");
951 return;
952 }
953
954 lt = (struct lio_time *)sc->virtdptr;
955
956 /* Get time of the day */
957 getnstimeofday64(&ts);
958 lt->sec = ts.tv_sec;
959 lt->nsec = ts.tv_nsec;
960 octeon_swap_8B_data((u64 *)lt, (sizeof(struct lio_time)) / 8);
961
962 sc->iq_no = lio->linfo.txpciq[0].s.q_no;
963 octeon_prepare_soft_command(oct, sc, OPCODE_NIC,
964 OPCODE_NIC_SYNC_OCTEON_TIME, 0, 0, 0);
965
966 sc->callback = lio_sync_octeon_time_cb;
967 sc->callback_arg = sc;
968 sc->wait_time = 1000;
969
970 ret = octeon_send_soft_command(oct, sc);
971 if (ret == IQ_SEND_FAILED) {
972 dev_err(&oct->pci_dev->dev,
973 "Failed to sync time to octeon: failed to send soft command\n");
974 octeon_free_soft_command(oct, sc);
975 }
976
977 queue_delayed_work(lio->sync_octeon_time_wq.wq,
978 &lio->sync_octeon_time_wq.wk.work,
979 msecs_to_jiffies(LIO_SYNC_OCTEON_TIME_INTERVAL_MS));
980}
981
982/**
983 * setup_sync_octeon_time_wq - Sets up the work to periodically update
984 * local time to octeon firmware
985 *
986 * @netdev - network device which should send time update to firmware
987 **/
988static inline int setup_sync_octeon_time_wq(struct net_device *netdev)
989{
990 struct lio *lio = GET_LIO(netdev);
991 struct octeon_device *oct = lio->oct_dev;
992
993 lio->sync_octeon_time_wq.wq =
994 alloc_workqueue("update-octeon-time", WQ_MEM_RECLAIM, 0);
995 if (!lio->sync_octeon_time_wq.wq) {
996 dev_err(&oct->pci_dev->dev, "Unable to create wq to update octeon time\n");
997 return -1;
998 }
999 INIT_DELAYED_WORK(&lio->sync_octeon_time_wq.wk.work,
1000 lio_sync_octeon_time);
1001 lio->sync_octeon_time_wq.wk.ctxptr = lio;
1002 queue_delayed_work(lio->sync_octeon_time_wq.wq,
1003 &lio->sync_octeon_time_wq.wk.work,
1004 msecs_to_jiffies(LIO_SYNC_OCTEON_TIME_INTERVAL_MS));
1005
1006 return 0;
1007}
1008
1009/**
1010 * cleanup_sync_octeon_time_wq - stop scheduling and destroy the work created
1011 * to periodically update local time to octeon firmware
1012 *
1013 * @netdev - network device which should send time update to firmware
1014 **/
1015static inline void cleanup_sync_octeon_time_wq(struct net_device *netdev)
1016{
1017 struct lio *lio = GET_LIO(netdev);
1018 struct cavium_wq *time_wq = &lio->sync_octeon_time_wq;
1019
1020 if (time_wq->wq) {
1021 cancel_delayed_work_sync(&time_wq->wk.work);
1022 destroy_workqueue(time_wq->wq);
1023 }
1024}
1025
904static struct octeon_device *get_other_octeon_device(struct octeon_device *oct)1026static struct octeon_device *get_other_octeon_device(struct octeon_device *oct)
905{1027{
906 struct octeon_device *other_oct;1028 struct octeon_device *other_oct;
@@ -1076,19 +1198,13 @@ liquidio_probe(struct pci_dev *pdev, · 169 unmodified lines
1076 }1198 }
1077 1199
1078 if (OCTEON_CN23XX_PF(oct_dev)) {1200 if (OCTEON_CN23XX_PF(oct_dev)) {
1079 u64 scratch1;
1080 u8 bus, device, function;1201 u8 bus, device, function;
1081 1202
1082 scratch1 = octeon_read_csr64(oct_dev, CN23XX_SLI_SCRATCH1);1203 if (atomic_read(oct_dev->adapter_refcount) == 1) {
1083 if (!(scratch1 & 4ULL)) {1204 /* Each NIC gets one watchdog kernel thread. The first
1084 /* Bit 2 of SLI_SCRATCH_1 is a flag that indicates that1205 * PF (of each NIC) that gets pci_driver->probe()'d
1085 * the lio watchdog kernel thread is running for this1206 * creates that thread.
1086 * NIC. Each NIC gets one watchdog kernel thread.
1087 */1207 */
1088 scratch1 |= 4ULL;
1089 octeon_write_csr64(oct_dev, CN23XX_SLI_SCRATCH1,
1090 scratch1);
1091
1092 bus = pdev->bus->number;1208 bus = pdev->bus->number;
1093 device = PCI_SLOT(pdev->devfn);1209 device = PCI_SLOT(pdev->devfn);
1094 function = PCI_FUNC(pdev->devfn);1210 function = PCI_FUNC(pdev->devfn);
@@ -1115,10 +1231,10 @@ liquidio_probe(struct pci_dev *pdev, · 20 unmodified lines
1115 return 0;1231 return 0;
1116}1232}
1117 1233
1118static bool fw_type_is_none(void)1234static bool fw_type_is_auto(void)
1119{1235{
1120 return strncmp(fw_type, LIO_FW_NAME_TYPE_NONE,1236 return strncmp(fw_type, LIO_FW_NAME_TYPE_AUTO,
1121 sizeof(LIO_FW_NAME_TYPE_NONE)) == 0;1237 sizeof(LIO_FW_NAME_TYPE_AUTO)) == 0;
1122}1238}
1123 1239
1124/**1240/**
@@ -1302,7 +1418,7 @@ static void octeon_destroy_resources(struct octeon_device *oct) · 177 unmodified lines
1302 * Implementation note: only soft-reset the device1418 * Implementation note: only soft-reset the device
1303 * if it is a CN6XXX OR the LAST CN23XX device.1419 * if it is a CN6XXX OR the LAST CN23XX device.
1304 */1420 */
1305 if (fw_type_is_none())1421 if (atomic_read(oct->adapter_fw_state) == FW_IS_PRELOADED)
1306 octeon_pci_flr(oct);1422 octeon_pci_flr(oct);
1307 else if (OCTEON_CN6XXX(oct) || !refcount)1423 else if (OCTEON_CN6XXX(oct) || !refcount)
1308 oct->fn_list.soft_reset(oct);1424 oct->fn_list.soft_reset(oct);
@@ -1455,6 +1571,7 @@ static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx) · 146 unmodified lines
1455 if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)1571 if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)
1456 unregister_netdev(netdev);1572 unregister_netdev(netdev);
1457 1573
1574 cleanup_sync_octeon_time_wq(netdev);
1458 cleanup_link_status_change_wq(netdev);1575 cleanup_link_status_change_wq(netdev);
1459 1576
1460 cleanup_rx_oom_poll_fn(netdev);1577 cleanup_rx_oom_poll_fn(netdev);
@@ -1487,6 +1604,8 @@ static int liquidio_stop_nic_module(struct octeon_device *oct) · 26 unmodified lines
1487 oct->cmd_resp_state = OCT_DRV_OFFLINE;1604 oct->cmd_resp_state = OCT_DRV_OFFLINE;
1488 spin_unlock_bh(&oct->cmd_resp_wqlock);1605 spin_unlock_bh(&oct->cmd_resp_wqlock);
1489 1606
1607 lio_vf_rep_destroy(oct);
1608
1490 for (i = 0; i < oct->ifcount; i++) {1609 for (i = 0; i < oct->ifcount; i++) {
1491 lio = GET_LIO(oct->props[i].netdev);1610 lio = GET_LIO(oct->props[i].netdev);
1492 for (j = 0; j < oct->num_oqs; j++)1611 for (j = 0; j < oct->num_oqs; j++)
@@ -1497,6 +1616,12 @@ static int liquidio_stop_nic_module(struct octeon_device *oct) · 4 unmodified lines
1497 for (i = 0; i < oct->ifcount; i++)1616 for (i = 0; i < oct->ifcount; i++)
1498 liquidio_destroy_nic_device(oct, i);1617 liquidio_destroy_nic_device(oct, i);
1499 1618
1619 if (oct->devlink) {
1620 devlink_unregister(oct->devlink);
1621 devlink_free(oct->devlink);
1622 oct->devlink = NULL;
1623 }
1624
1500 dev_dbg(&oct->pci_dev->dev, "Network interfaces stopped\n");1625 dev_dbg(&oct->pci_dev->dev, "Network interfaces stopped\n");
1501 return 0;1626 return 0;
1502}1627}
@@ -1514,6 +1639,10 @@ static void liquidio_remove(struct pci_dev *pdev) · 11 unmodified lines
1514 if (oct_dev->watchdog_task)1639 if (oct_dev->watchdog_task)
1515 kthread_stop(oct_dev->watchdog_task);1640 kthread_stop(oct_dev->watchdog_task);
1516 1641
1642 if (!oct_dev->octeon_id &&
1643 oct_dev->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP)
1644 lio_vf_rep_modexit();
1645
1517 if (oct_dev->app_mode && (oct_dev->app_mode == CVM_DRV_NIC_APP))1646 if (oct_dev->app_mode && (oct_dev->app_mode == CVM_DRV_NIC_APP))
1518 liquidio_stop_nic_module(oct_dev);1647 liquidio_stop_nic_module(oct_dev);
1519 1648
@@ -1934,10 +2063,12 @@ static int load_firmware(struct octeon_device *oct) · 414 unmodified lines
1934 char fw_name[LIO_MAX_FW_FILENAME_LEN];2063 char fw_name[LIO_MAX_FW_FILENAME_LEN];
1935 char *tmp_fw_type;2064 char *tmp_fw_type;
1936 2065
1937 if (fw_type[0] == '\0')2066 if (fw_type_is_auto()) {
1938 tmp_fw_type = LIO_FW_NAME_TYPE_NIC;2067 tmp_fw_type = LIO_FW_NAME_TYPE_NIC;
1939 else2068 strncpy(fw_type, tmp_fw_type, sizeof(fw_type));
2069 } else {
1940 tmp_fw_type = fw_type;2070 tmp_fw_type = fw_type;
2071 }
1941 2072
1942 sprintf(fw_name, "%s%s%s_%s%s", LIO_FW_DIR, LIO_FW_BASE_NAME,2073 sprintf(fw_name, "%s%s%s_%s%s", LIO_FW_DIR, LIO_FW_BASE_NAME,
1943 octeon_get_conf(oct)->card_name, tmp_fw_type,2074 octeon_get_conf(oct)->card_name, tmp_fw_type,
@@ -2477,7 +2608,8 @@ static void handle_timestamp(struct octeon_device *oct, · 533 unmodified lines
2477 */2608 */
2478static inline int send_nic_timestamp_pkt(struct octeon_device *oct,2609static inline int send_nic_timestamp_pkt(struct octeon_device *oct,
2479 struct octnic_data_pkt *ndata,2610 struct octnic_data_pkt *ndata,
2480 struct octnet_buf_free_info *finfo)2611 struct octnet_buf_free_info *finfo,
2612 int xmit_more)
2481{2613{
2482 int retval;2614 int retval;
2483 struct octeon_soft_command *sc;2615 struct octeon_soft_command *sc;
@@ -2512,7 +2644,7 @@ static inline int send_nic_timestamp_pkt(struct octeon_device *oct, · 28 unmodified lines
2512 len = (u32)((struct octeon_instr_ih2 *)2644 len = (u32)((struct octeon_instr_ih2 *)
2513 (&sc->cmd.cmd2.ih2))->dlengsz;2645 (&sc->cmd.cmd2.ih2))->dlengsz;
2514 2646
2515 ring_doorbell = 1;2647 ring_doorbell = !xmit_more;
2516 2648
2517 retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd,2649 retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd,
2518 sc, len, ndata->reqtype);2650 sc, len, ndata->reqtype);
@@ -2546,7 +2678,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 27 unmodified lines
2546 union tx_info *tx_info;2678 union tx_info *tx_info;
2547 int status = 0;2679 int status = 0;
2548 int q_idx = 0, iq_no = 0;2680 int q_idx = 0, iq_no = 0;
2549 int j;2681 int j, xmit_more = 0;
2550 u64 dptr = 0;2682 u64 dptr = 0;
2551 u32 tag = 0;2683 u32 tag = 0;
2552 2684
@@ -2751,17 +2883,19 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 198 unmodified lines
2751 irh->vlan = skb_vlan_tag_get(skb) & 0xfff;2883 irh->vlan = skb_vlan_tag_get(skb) & 0xfff;
2752 }2884 }
2753 2885
2886 xmit_more = skb->xmit_more;
2887
2754 if (unlikely(cmdsetup.s.timestamp))2888 if (unlikely(cmdsetup.s.timestamp))
2755 status = send_nic_timestamp_pkt(oct, &ndata, finfo);2889 status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);
2756 else2890 else
2757 status = octnet_send_nic_data_pkt(oct, &ndata);2891 status = octnet_send_nic_data_pkt(oct, &ndata, xmit_more);
2758 if (status == IQ_SEND_FAILED)2892 if (status == IQ_SEND_FAILED)
2759 goto lio_xmit_failed;2893 goto lio_xmit_failed;
2760 2894
2761 netif_info(lio, tx_queued, lio->netdev, "Transmit queued successfully\n");2895 netif_info(lio, tx_queued, lio->netdev, "Transmit queued successfully\n");
2762 2896
2763 if (status == IQ_SEND_STOP)2897 if (status == IQ_SEND_STOP)
2764 stop_q(lio->netdev, q_idx);2898 stop_q(netdev, q_idx);
2765 2899
2766 netif_trans_update(netdev);2900 netif_trans_update(netdev);
2767 2901
@@ -2780,6 +2914,9 @@ lio_xmit_failed: · 12 unmodified lines
2780 if (dptr)2914 if (dptr)
2781 dma_unmap_single(&oct->pci_dev->dev, dptr,2915 dma_unmap_single(&oct->pci_dev->dev, dptr,
2782 ndata.datasize, DMA_TO_DEVICE);2916 ndata.datasize, DMA_TO_DEVICE);
2917
2918 octeon_ring_doorbell_locked(oct, iq_no);
2919
2783 tx_buffer_free(skb);2920 tx_buffer_free(skb);
2784 return NETDEV_TX_OK;2921 return NETDEV_TX_OK;
2785}2922}
@@ -3186,6 +3323,86 @@ static int liquidio_set_vf_link_state(struct net_device *netdev, int vfidx, · 400 unmodified lines
3186 return 0;3323 return 0;
3187}3324}
3188 3325
3326static int
3327liquidio_eswitch_mode_get(struct devlink *devlink, u16 *mode)
3328{
3329 struct lio_devlink_priv *priv;
3330 struct octeon_device *oct;
3331
3332 priv = devlink_priv(devlink);
3333 oct = priv->oct;
3334
3335 *mode = oct->eswitch_mode;
3336
3337 return 0;
3338}
3339
3340static int
3341liquidio_eswitch_mode_set(struct devlink *devlink, u16 mode)
3342{
3343 struct lio_devlink_priv *priv;
3344 struct octeon_device *oct;
3345 int ret = 0;
3346
3347 priv = devlink_priv(devlink);
3348 oct = priv->oct;
3349
3350 if (!(oct->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP))
3351 return -EINVAL;
3352
3353 if (oct->eswitch_mode == mode)
3354 return 0;
3355
3356 switch (mode) {
3357 case DEVLINK_ESWITCH_MODE_SWITCHDEV:
3358 oct->eswitch_mode = mode;
3359 ret = lio_vf_rep_create(oct);
3360 break;
3361
3362 case DEVLINK_ESWITCH_MODE_LEGACY:
3363 lio_vf_rep_destroy(oct);
3364 oct->eswitch_mode = mode;
3365 break;
3366
3367 default:
3368 ret = -EINVAL;
3369 }
3370
3371 return ret;
3372}
3373
3374static const struct devlink_ops liquidio_devlink_ops = {
3375 .eswitch_mode_get = liquidio_eswitch_mode_get,
3376 .eswitch_mode_set = liquidio_eswitch_mode_set,
3377};
3378
3379static int
3380lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
3381{
3382 struct lio *lio = GET_LIO(dev);
3383 struct octeon_device *oct = lio->oct_dev;
3384
3385 if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
3386 return -EOPNOTSUPP;
3387
3388 switch (attr->id) {
3389 case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
3390 attr->u.ppid.id_len = ETH_ALEN;
3391 ether_addr_copy(attr->u.ppid.id,
3392 (void *)&lio->linfo.hw_addr + 2);
3393 break;
3394
3395 default:
3396 return -EOPNOTSUPP;
3397 }
3398
3399 return 0;
3400}
3401
3402static const struct switchdev_ops lio_pf_switchdev_ops = {
3403 .switchdev_port_attr_get = lio_pf_switchdev_attr_get,
3404};
3405
3189static const struct net_device_ops lionetdevops = {3406static const struct net_device_ops lionetdevops = {
3190 .ndo_open = liquidio_open,3407 .ndo_open = liquidio_open,
3191 .ndo_stop = liquidio_stop,3408 .ndo_stop = liquidio_stop,
@@ -3303,7 +3520,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) · 111 unmodified lines
3303{3520{
3304 struct lio *lio = NULL;3521 struct lio *lio = NULL;
3305 struct net_device *netdev;3522 struct net_device *netdev;
3306 u8 mac[6], i, j;3523 u8 mac[6], i, j, *fw_ver;
3307 struct octeon_soft_command *sc;3524 struct octeon_soft_command *sc;
3308 struct liquidio_if_cfg_context *ctx;3525 struct liquidio_if_cfg_context *ctx;
3309 struct liquidio_if_cfg_resp *resp;3526 struct liquidio_if_cfg_resp *resp;
@@ -3315,6 +3532,8 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) · 5 unmodified lines
3315 u32 resp_size, ctx_size, data_size;3532 u32 resp_size, ctx_size, data_size;
3316 u32 ifidx_or_pfnum;3533 u32 ifidx_or_pfnum;
3317 struct lio_version *vdata;3534 struct lio_version *vdata;
3535 struct devlink *devlink;
3536 struct lio_devlink_priv *lio_devlink;
3318 3537
3319 /* This is to handle link status changes */3538 /* This is to handle link status changes */
3320 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC,3539 octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC,
@@ -3414,6 +3633,22 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) · 93 unmodified lines
3414 goto setup_nic_dev_fail;3633 goto setup_nic_dev_fail;
3415 }3634 }
3416 3635
3636 /* Verify f/w version (in case of 'auto' loading from flash) */
3637 fw_ver = octeon_dev->fw_info.liquidio_firmware_version;
3638 if (memcmp(LIQUIDIO_BASE_VERSION,
3639 fw_ver,
3640 strlen(LIQUIDIO_BASE_VERSION))) {
3641 dev_err(&octeon_dev->pci_dev->dev,
3642 "Unmatched firmware version. Expected %s.x, got %s.\n",
3643 LIQUIDIO_BASE_VERSION, fw_ver);
3644 goto setup_nic_dev_fail;
3645 } else if (atomic_read(octeon_dev->adapter_fw_state) ==
3646 FW_IS_PRELOADED) {
3647 dev_info(&octeon_dev->pci_dev->dev,
3648 "Using auto-loaded firmware version %s.\n",
3649 fw_ver);
3650 }
3651
3417 octeon_swap_8B_data((u64 *)(&resp->cfg_info),3652 octeon_swap_8B_data((u64 *)(&resp->cfg_info),
3418 (sizeof(struct liquidio_if_cfg_info)) >> 3);3653 (sizeof(struct liquidio_if_cfg_info)) >> 3);
3419 3654
@@ -3444,6 +3679,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) · 24 unmodified lines
3444 * netdev tasks.3679 * netdev tasks.
3445 */3680 */
3446 netdev->netdev_ops = &lionetdevops;3681 netdev->netdev_ops = &lionetdevops;
3682 SWITCHDEV_SET_OPS(netdev, &lio_pf_switchdev_ops);
3447 3683
3448 lio = GET_LIO(netdev);3684 lio = GET_LIO(netdev);
3449 3685
@@ -3593,6 +3829,11 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) · 143 unmodified lines
3593 if (setup_link_status_change_wq(netdev))3829 if (setup_link_status_change_wq(netdev))
3594 goto setup_nic_dev_fail;3830 goto setup_nic_dev_fail;
3595 3831
3832 if ((octeon_dev->fw_info.app_cap_flags &
3833 LIQUIDIO_TIME_SYNC_CAP) &&
3834 setup_sync_octeon_time_wq(netdev))
3835 goto setup_nic_dev_fail;
3836
3596 if (setup_rx_oom_poll_fn(netdev))3837 if (setup_rx_oom_poll_fn(netdev))
3597 goto setup_nic_dev_fail;3838 goto setup_nic_dev_fail;
3598 3839
@@ -3625,6 +3866,26 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) · 26 unmodified lines
3625 octeon_free_soft_command(octeon_dev, sc);3866 octeon_free_soft_command(octeon_dev, sc);
3626 }3867 }
3627 3868
3869 devlink = devlink_alloc(&liquidio_devlink_ops,
3870 sizeof(struct lio_devlink_priv));
3871 if (!devlink) {
3872 dev_err(&octeon_dev->pci_dev->dev, "devlink alloc failed\n");
3873 goto setup_nic_wait_intr;
3874 }
3875
3876 lio_devlink = devlink_priv(devlink);
3877 lio_devlink->oct = octeon_dev;
3878
3879 if (devlink_register(devlink, &octeon_dev->pci_dev->dev)) {
3880 devlink_free(devlink);
3881 dev_err(&octeon_dev->pci_dev->dev,
3882 "devlink registration failed\n");
3883 goto setup_nic_wait_intr;
3884 }
3885
3886 octeon_dev->devlink = devlink;
3887 octeon_dev->eswitch_mode = DEVLINK_ESWITCH_MODE_LEGACY;
3888
3628 return 0;3889 return 0;
3629 3890
3630setup_nic_dev_fail:3891setup_nic_dev_fail:
@@ -3719,6 +3980,7 @@ static int liquidio_enable_sriov(struct pci_dev *dev, int num_vfs) · 88 unmodified lines
3719 }3980 }
3720 3981
3721 if (!num_vfs) {3982 if (!num_vfs) {
3983 lio_vf_rep_destroy(oct);
3722 ret = lio_pci_sriov_disable(oct);3984 ret = lio_pci_sriov_disable(oct);
3723 } else if (num_vfs > oct->sriov_info.max_vfs) {3985 } else if (num_vfs > oct->sriov_info.max_vfs) {
3724 dev_err(&oct->pci_dev->dev,3986 dev_err(&oct->pci_dev->dev,
@@ -3730,6 +3992,10 @@ static int liquidio_enable_sriov(struct pci_dev *dev, int num_vfs) · 5 unmodified lines
3730 ret = octeon_enable_sriov(oct);3992 ret = octeon_enable_sriov(oct);
3731 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d num_vfs:%d\n",3993 dev_info(&oct->pci_dev->dev, "oct->pf_num:%d num_vfs:%d\n",
3732 oct->pf_num, num_vfs);3994 oct->pf_num, num_vfs);
3995 ret = lio_vf_rep_create(oct);
3996 if (ret)
3997 dev_info(&oct->pci_dev->dev,
3998 "vf representor create failed");
3733 }3999 }
3734 4000
3735 return ret;4001 return ret;
@@ -3767,6 +4033,18 @@ static int liquidio_init_nic_module(struct octeon_device *oct) · 31 unmodified lines
3767 goto octnet_init_failure;4033 goto octnet_init_failure;
3768 }4034 }
3769 4035
4036 /* Call vf_rep_modinit if the firmware is switchdev capable
4037 * and do it from the first liquidio function probed.
4038 */
4039 if (!oct->octeon_id &&
4040 oct->fw_info.app_cap_flags & LIQUIDIO_SWITCHDEV_CAP) {
4041 retval = lio_vf_rep_modinit();
4042 if (retval) {
4043 liquidio_stop_nic_module(oct);
4044 goto octnet_init_failure;
4045 }
4046 }
4047
3770 liquidio_ptp_init(oct);4048 liquidio_ptp_init(oct);
3771 4049
3772 dev_dbg(&oct->pci_dev->dev, "Network interfaces ready\n");4050 dev_dbg(&oct->pci_dev->dev, "Network interfaces ready\n");
@@ -3882,9 +4160,9 @@ octeon_recv_vf_drv_notice(struct octeon_recv_info *recv_info, void *buf) · 109 unmodified lines
3882static int octeon_device_init(struct octeon_device *octeon_dev)4160static int octeon_device_init(struct octeon_device *octeon_dev)
3883{4161{
3884 int j, ret;4162 int j, ret;
3885 int fw_loaded = 0;
3886 char bootcmd[] = "\n";4163 char bootcmd[] = "\n";
3887 char *dbg_enb = NULL;4164 char *dbg_enb = NULL;
4165 enum lio_fw_state fw_state;
3888 struct octeon_device_priv *oct_priv =4166 struct octeon_device_priv *oct_priv =
3889 (struct octeon_device_priv *)octeon_dev->priv;4167 (struct octeon_device_priv *)octeon_dev->priv;
3890 atomic_set(&octeon_dev->status, OCT_DEV_BEGIN_STATE);4168 atomic_set(&octeon_dev->status, OCT_DEV_BEGIN_STATE);
@@ -3916,24 +4194,40 @@ static int octeon_device_init(struct octeon_device *octeon_dev) · 25 unmodified lines
3916 4194
3917 octeon_dev->app_mode = CVM_DRV_INVALID_APP;4195 octeon_dev->app_mode = CVM_DRV_INVALID_APP;
3918 4196
3919 if (OCTEON_CN23XX_PF(octeon_dev)) {4197 /* CN23XX supports preloaded firmware if the following is true:
3920 if (!cn23xx_fw_loaded(octeon_dev) && !fw_type_is_none()) {4198 *
3921 fw_loaded = 0;4199 * The adapter indicates that firmware is currently running AND
3922 /* Do a soft reset of the Octeon device. */4200 * 'fw_type' is 'auto'.
3923 if (octeon_dev->fn_list.soft_reset(octeon_dev))4201 *
3924 return 1;4202 * (default state is NEEDS_TO_BE_LOADED, override it if appropriate).
3925 /* things might have changed */4203 */
3926 if (!cn23xx_fw_loaded(octeon_dev))4204 if (OCTEON_CN23XX_PF(octeon_dev) &&
3927 fw_loaded = 0;4205 cn23xx_fw_loaded(octeon_dev) && fw_type_is_auto()) {
3928 else4206 atomic_cmpxchg(octeon_dev->adapter_fw_state,
3929 fw_loaded = 1;4207 FW_NEEDS_TO_BE_LOADED, FW_IS_PRELOADED);
3930 } else {
3931 fw_loaded = 1;
3932 }
3933 } else if (octeon_dev->fn_list.soft_reset(octeon_dev)) {
3934 return 1;
3935 }4208 }
3936 4209
4210 /* If loading firmware, only first device of adapter needs to do so. */
4211 fw_state = atomic_cmpxchg(octeon_dev->adapter_fw_state,
4212 FW_NEEDS_TO_BE_LOADED,
4213 FW_IS_BEING_LOADED);
4214
4215 /* Here, [local variable] 'fw_state' is set to one of:
4216 *
4217 * FW_IS_PRELOADED: No firmware is to be loaded (see above)
4218 * FW_NEEDS_TO_BE_LOADED: The driver's first instance will load
4219 * firmware to the adapter.
4220 * FW_IS_BEING_LOADED: The driver's second instance will not load
4221 * firmware to the adapter.
4222 */
4223
4224 /* Prior to f/w load, perform a soft reset of the Octeon device;
4225 * if error resetting, return w/error.
4226 */
4227 if (fw_state == FW_NEEDS_TO_BE_LOADED)
4228 if (octeon_dev->fn_list.soft_reset(octeon_dev))
4229 return 1;
4230
3937 /* Initialize the dispatch mechanism used to push packets arriving on4231 /* Initialize the dispatch mechanism used to push packets arriving on
3938 * Octeon Output queues.4232 * Octeon Output queues.
3939 */4233 */
@@ -4063,7 +4357,7 @@ static int octeon_device_init(struct octeon_device *octeon_dev) · 123 unmodified lines
4063 4357
4064 atomic_set(&octeon_dev->status, OCT_DEV_IO_QUEUES_DONE);4358 atomic_set(&octeon_dev->status, OCT_DEV_IO_QUEUES_DONE);
4065 4359
4066 if ((!OCTEON_CN23XX_PF(octeon_dev)) || !fw_loaded) {4360 if (fw_state == FW_NEEDS_TO_BE_LOADED) {
4067 dev_dbg(&octeon_dev->pci_dev->dev, "Waiting for DDR initialization...\n");4361 dev_dbg(&octeon_dev->pci_dev->dev, "Waiting for DDR initialization...\n");
4068 if (!ddr_timeout) {4362 if (!ddr_timeout) {
4069 dev_info(&octeon_dev->pci_dev->dev,4363 dev_info(&octeon_dev->pci_dev->dev,
@@ -4125,6 +4419,8 @@ static int octeon_device_init(struct octeon_device *octeon_dev) · 55 unmodified lines
4125 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n");4419 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n");
4126 return 1;4420 return 1;
4127 }4421 }
4422
4423 atomic_set(octeon_dev->adapter_fw_state, FW_HAS_BEEN_LOADED);
4128 }4424 }
4129 4425
4130 handshake[octeon_dev->octeon_id].init_ok = 1;4426 handshake[octeon_dev->octeon_id].init_ok = 1;
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c+17−11
@@ -435,8 +435,7 @@ static void delete_glists(struct lio *lio) · 434 unmodified lines
435 do {435 do {
436 g = (struct octnic_gather *)436 g = (struct octnic_gather *)
437 list_delete_head(&lio->glist[i]);437 list_delete_head(&lio->glist[i]);
438 if (g)438 kfree(g);
439 kfree(g);
440 } while (g);439 } while (g);
441 440
442 if (lio->glists_virt_base && lio->glists_virt_base[i] &&441 if (lio->glists_virt_base && lio->glists_virt_base[i] &&
@@ -748,7 +747,7 @@ static void octeon_destroy_resources(struct octeon_device *oct) · 305 unmodified lines
748 747
749 if (lio_wait_for_oq_pkts(oct))748 if (lio_wait_for_oq_pkts(oct))
750 dev_err(&oct->pci_dev->dev, "OQ had pending packets\n");749 dev_err(&oct->pci_dev->dev, "OQ had pending packets\n");
751 750 /* fall through */
752 case OCT_DEV_INTR_SET_DONE:751 case OCT_DEV_INTR_SET_DONE:
753 /* Disable interrupts */752 /* Disable interrupts */
754 oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);753 oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
@@ -1289,6 +1288,9 @@ static int liquidio_stop(struct net_device *netdev) · 534 unmodified lines
1289 struct octeon_device *oct = lio->oct_dev;1288 struct octeon_device *oct = lio->oct_dev;
1290 struct napi_struct *napi, *n;1289 struct napi_struct *napi, *n;
1291 1290
1291 /* tell Octeon to stop forwarding packets to host */
1292 send_rx_ctrl_cmd(lio, 0);
1293
1292 if (oct->props[lio->ifidx].napi_enabled) {1294 if (oct->props[lio->ifidx].napi_enabled) {
1293 list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)1295 list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
1294 napi_disable(napi);1296 napi_disable(napi);
@@ -1306,9 +1308,6 @@ static int liquidio_stop(struct net_device *netdev) · 11 unmodified lines
1306 netif_carrier_off(netdev);1308 netif_carrier_off(netdev);
1307 lio->link_changes++;1309 lio->link_changes++;
1308 1310
1309 /* tell Octeon to stop forwarding packets to host */
1310 send_rx_ctrl_cmd(lio, 0);
1311
1312 ifstate_reset(lio, LIO_IFSTATE_RUNNING);1311 ifstate_reset(lio, LIO_IFSTATE_RUNNING);
1313 1312
1314 txqs_stop(netdev);1313 txqs_stop(netdev);
@@ -1691,7 +1690,8 @@ static void handle_timestamp(struct octeon_device *oct, u32 status, void *buf) · 376 unmodified lines
1691 */1690 */
1692static int send_nic_timestamp_pkt(struct octeon_device *oct,1691static int send_nic_timestamp_pkt(struct octeon_device *oct,
1693 struct octnic_data_pkt *ndata,1692 struct octnic_data_pkt *ndata,
1694 struct octnet_buf_free_info *finfo)1693 struct octnet_buf_free_info *finfo,
1694 int xmit_more)
1695{1695{
1696 struct octeon_soft_command *sc;1696 struct octeon_soft_command *sc;
1697 int ring_doorbell;1697 int ring_doorbell;
@@ -1721,7 +1721,7 @@ static int send_nic_timestamp_pkt(struct octeon_device *oct, · 23 unmodified lines
1721 1721
1722 len = (u32)((struct octeon_instr_ih3 *)(&sc->cmd.cmd3.ih3))->dlengsz;1722 len = (u32)((struct octeon_instr_ih3 *)(&sc->cmd.cmd3.ih3))->dlengsz;
1723 1723
1724 ring_doorbell = 1;1724 ring_doorbell = !xmit_more;
1725 1725
1726 retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd,1726 retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd,
1727 sc, len, ndata->reqtype);1727 sc, len, ndata->reqtype);
@@ -1753,6 +1753,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 25 unmodified lines
1753 struct octeon_device *oct;1753 struct octeon_device *oct;
1754 int q_idx = 0, iq_no = 0;1754 int q_idx = 0, iq_no = 0;
1755 union tx_info *tx_info;1755 union tx_info *tx_info;
1756 int xmit_more = 0;
1756 struct lio *lio;1757 struct lio *lio;
1757 int status = 0;1758 int status = 0;
1758 u64 dptr = 0;1759 u64 dptr = 0;
@@ -1941,10 +1942,12 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 182 unmodified lines
1941 irh->vlan = skb_vlan_tag_get(skb) & VLAN_VID_MASK;1942 irh->vlan = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
1942 }1943 }
1943 1944
1945 xmit_more = skb->xmit_more;
1946
1944 if (unlikely(cmdsetup.s.timestamp))1947 if (unlikely(cmdsetup.s.timestamp))
1945 status = send_nic_timestamp_pkt(oct, &ndata, finfo);1948 status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);
1946 else1949 else
1947 status = octnet_send_nic_data_pkt(oct, &ndata);1950 status = octnet_send_nic_data_pkt(oct, &ndata, xmit_more);
1948 if (status == IQ_SEND_FAILED)1951 if (status == IQ_SEND_FAILED)
1949 goto lio_xmit_failed;1952 goto lio_xmit_failed;
1950 1953
@@ -1953,7 +1956,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) · 2 unmodified lines
1953 if (status == IQ_SEND_STOP) {1956 if (status == IQ_SEND_STOP) {
1954 dev_err(&oct->pci_dev->dev, "Rcvd IQ_SEND_STOP signal; stopping IQ-%d\n",1957 dev_err(&oct->pci_dev->dev, "Rcvd IQ_SEND_STOP signal; stopping IQ-%d\n",
1955 iq_no);1958 iq_no);
1956 stop_q(lio->netdev, q_idx);1959 stop_q(netdev, q_idx);
1957 }1960 }
1958 1961
1959 netif_trans_update(netdev);1962 netif_trans_update(netdev);
@@ -1973,6 +1976,9 @@ lio_xmit_failed: · 13 unmodified lines
1973 if (dptr)1976 if (dptr)
1974 dma_unmap_single(&oct->pci_dev->dev, dptr,1977 dma_unmap_single(&oct->pci_dev->dev, dptr,
1975 ndata.datasize, DMA_TO_DEVICE);1978 ndata.datasize, DMA_TO_DEVICE);
1979
1980 octeon_ring_doorbell_locked(oct, iq_no);
1981
1976 tx_buffer_free(skb);1982 tx_buffer_free(skb);
1977 return NETDEV_TX_OK;1983 return NETDEV_TX_OK;
1978}1984}
drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c+695−0
@@ -0,0 +1,695 @@
1/**********************************************************************
2 * Author: Cavium, Inc.
3 *
4 * Contact: support@cavium.com
5 * Please include "LiquidIO" in the subject.
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more details.
17 ***********************************************************************/
18#include <linux/pci.h>
19#include <linux/if_vlan.h>
20#include "liquidio_common.h"
21#include "octeon_droq.h"
22#include "octeon_iq.h"
23#include "response_manager.h"
24#include "octeon_device.h"
25#include "octeon_nic.h"
26#include "octeon_main.h"
27#include "octeon_network.h"
28#include <net/switchdev.h>
29#include "lio_vf_rep.h"
30#include "octeon_network.h"
31
32static int lio_vf_rep_open(struct net_device *ndev);
33static int lio_vf_rep_stop(struct net_device *ndev);
34static int lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev);
35static void lio_vf_rep_tx_timeout(struct net_device *netdev);
36static int lio_vf_rep_phys_port_name(struct net_device *dev,
37 char *buf, size_t len);
38static void lio_vf_rep_get_stats64(struct net_device *dev,
39 struct rtnl_link_stats64 *stats64);
40static int lio_vf_rep_change_mtu(struct net_device *ndev, int new_mtu);
41
42static const struct net_device_ops lio_vf_rep_ndev_ops = {
43 .ndo_open = lio_vf_rep_open,
44 .ndo_stop = lio_vf_rep_stop,
45 .ndo_start_xmit = lio_vf_rep_pkt_xmit,
46 .ndo_tx_timeout = lio_vf_rep_tx_timeout,
47 .ndo_get_phys_port_name = lio_vf_rep_phys_port_name,
48 .ndo_get_stats64 = lio_vf_rep_get_stats64,
49 .ndo_change_mtu = lio_vf_rep_change_mtu,
50};
51
52static void
53lio_vf_rep_send_sc_complete(struct octeon_device *oct,
54 u32 status, void *ptr)
55{
56 struct octeon_soft_command *sc = (struct octeon_soft_command *)ptr;
57 struct lio_vf_rep_sc_ctx *ctx =
58 (struct lio_vf_rep_sc_ctx *)sc->ctxptr;
59 struct lio_vf_rep_resp *resp =
60 (struct lio_vf_rep_resp *)sc->virtrptr;
61
62 if (status != OCTEON_REQUEST_TIMEOUT && READ_ONCE(resp->status))
63 WRITE_ONCE(resp->status, 0);
64
65 complete(&ctx->complete);
66}
67
68static int
69lio_vf_rep_send_soft_command(struct octeon_device *oct,
70 void *req, int req_size,
71 void *resp, int resp_size)
72{
73 int tot_resp_size = sizeof(struct lio_vf_rep_resp) + resp_size;
74 int ctx_size = sizeof(struct lio_vf_rep_sc_ctx);
75 struct octeon_soft_command *sc = NULL;
76 struct lio_vf_rep_resp *rep_resp;
77 struct lio_vf_rep_sc_ctx *ctx;
78 void *sc_req;
79 int err;
80
81 sc = (struct octeon_soft_command *)
82 octeon_alloc_soft_command(oct, req_size,
83 tot_resp_size, ctx_size);
84 if (!sc)
85 return -ENOMEM;
86
87 ctx = (struct lio_vf_rep_sc_ctx *)sc->ctxptr;
88 memset(ctx, 0, ctx_size);
89 init_completion(&ctx->complete);
90
91 sc_req = (struct lio_vf_rep_req *)sc->virtdptr;
92 memcpy(sc_req, req, req_size);
93
94 rep_resp = (struct lio_vf_rep_resp *)sc->virtrptr;
95 memset(rep_resp, 0, tot_resp_size);
96 WRITE_ONCE(rep_resp->status, 1);
97
98 sc->iq_no = 0;
99 octeon_prepare_soft_command(oct, sc, OPCODE_NIC,
100 OPCODE_NIC_VF_REP_CMD, 0, 0, 0);
101 sc->callback = lio_vf_rep_send_sc_complete;
102 sc->callback_arg = sc;
103 sc->wait_time = LIO_VF_REP_REQ_TMO_MS;
104
105 err = octeon_send_soft_command(oct, sc);
106 if (err == IQ_SEND_FAILED)
107 goto free_buff;
108
109 wait_for_completion_timeout(&ctx->complete,
110 msecs_to_jiffies
111 (2 * LIO_VF_REP_REQ_TMO_MS));
112 err = READ_ONCE(rep_resp->status) ? -EBUSY : 0;
113 if (err)
114 dev_err(&oct->pci_dev->dev, "VF rep send config failed\n");
115
116 if (resp)
117 memcpy(resp, (rep_resp + 1), resp_size);
118free_buff:
119 octeon_free_soft_command(oct, sc);
120
121 return err;
122}
123
124static int
125lio_vf_rep_open(struct net_device *ndev)
126{
127 struct lio_vf_rep_desc *vf_rep = netdev_priv(ndev);
128 struct lio_vf_rep_req rep_cfg;
129 struct octeon_device *oct;
130 int ret;
131
132 oct = vf_rep->oct;
133
134 memset(&rep_cfg, 0, sizeof(rep_cfg));
135 rep_cfg.req_type = LIO_VF_REP_REQ_STATE;
136 rep_cfg.ifidx = vf_rep->ifidx;
137 rep_cfg.rep_state.state = LIO_VF_REP_STATE_UP;
138
139 ret = lio_vf_rep_send_soft_command(oct, &rep_cfg,
140 sizeof(rep_cfg), NULL, 0);
141
142 if (ret) {
143 dev_err(&oct->pci_dev->dev,
144 "VF_REP open failed with err %d\n", ret);
145 return -EIO;
146 }
147
148 atomic_set(&vf_rep->ifstate, (atomic_read(&vf_rep->ifstate) |
149 LIO_IFSTATE_RUNNING));
150
151 netif_carrier_on(ndev);
152 netif_start_queue(ndev);
153
154 return 0;
155}
156
157static int
158lio_vf_rep_stop(struct net_device *ndev)
159{
160 struct lio_vf_rep_desc *vf_rep = netdev_priv(ndev);
161 struct lio_vf_rep_req rep_cfg;
162 struct octeon_device *oct;
163 int ret;
164
165 oct = vf_rep->oct;
166
167 memset(&rep_cfg, 0, sizeof(rep_cfg));
168 rep_cfg.req_type = LIO_VF_REP_REQ_STATE;
169 rep_cfg.ifidx = vf_rep->ifidx;
170 rep_cfg.rep_state.state = LIO_VF_REP_STATE_DOWN;
171
172 ret = lio_vf_rep_send_soft_command(oct, &rep_cfg,
173 sizeof(rep_cfg), NULL, 0);
174
175 if (ret) {
176 dev_err(&oct->pci_dev->dev,
177 "VF_REP dev stop failed with err %d\n", ret);
178 return -EIO;
179 }
180
181 atomic_set(&vf_rep->ifstate, (atomic_read(&vf_rep->ifstate) &
182 ~LIO_IFSTATE_RUNNING));
183
184 netif_tx_disable(ndev);
185 netif_carrier_off(ndev);
186
187 return 0;
188}
189
190static void
191lio_vf_rep_tx_timeout(struct net_device *ndev)
192{
193 netif_trans_update(ndev);
194
195 netif_wake_queue(ndev);
196}
197
198static void
199lio_vf_rep_get_stats64(struct net_device *dev,
200 struct rtnl_link_stats64 *stats64)
201{
202 struct lio_vf_rep_desc *vf_rep = netdev_priv(dev);
203
204 stats64->tx_packets = vf_rep->stats.tx_packets;
205 stats64->tx_bytes = vf_rep->stats.tx_bytes;
206 stats64->tx_dropped = vf_rep->stats.tx_dropped;
207
208 stats64->rx_packets = vf_rep->stats.rx_packets;
209 stats64->rx_bytes = vf_rep->stats.rx_bytes;
210 stats64->rx_dropped = vf_rep->stats.rx_dropped;
211}
212
213static int
214lio_vf_rep_change_mtu(struct net_device *ndev, int new_mtu)
215{
216 struct lio_vf_rep_desc *vf_rep = netdev_priv(ndev);
217 struct lio_vf_rep_req rep_cfg;
218 struct octeon_device *oct;
219 int ret;
220
221 oct = vf_rep->oct;
222
223 memset(&rep_cfg, 0, sizeof(rep_cfg));
224 rep_cfg.req_type = LIO_VF_REP_REQ_MTU;
225 rep_cfg.ifidx = vf_rep->ifidx;
226 rep_cfg.rep_mtu.mtu = cpu_to_be32(new_mtu);
227
228 ret = lio_vf_rep_send_soft_command(oct, &rep_cfg,
229 sizeof(rep_cfg), NULL, 0);
230 if (ret) {
231 dev_err(&oct->pci_dev->dev,
232 "Change MTU failed with err %d\n", ret);
233 return -EIO;
234 }
235
236 ndev->mtu = new_mtu;
237
238 return 0;
239}
240
241static int
242lio_vf_rep_phys_port_name(struct net_device *dev,
243 char *buf, size_t len)
244{
245 struct lio_vf_rep_desc *vf_rep = netdev_priv(dev);
246 struct octeon_device *oct = vf_rep->oct;
247 int ret;
248
249 ret = snprintf(buf, len, "pf%dvf%d", oct->pf_num,
250 vf_rep->ifidx - oct->pf_num * 64 - 1);
251 if (ret >= len)
252 return -EOPNOTSUPP;
253
254 return 0;
255}
256
257static struct net_device *
258lio_vf_rep_get_ndev(struct octeon_device *oct, int ifidx)
259{
260 int vf_id, max_vfs = CN23XX_MAX_VFS_PER_PF + 1;
261 int vfid_mask = max_vfs - 1;
262
263 if (ifidx <= oct->pf_num * max_vfs ||
264 ifidx >= oct->pf_num * max_vfs + max_vfs)
265 return NULL;
266
267 /* ifidx 1-63 for PF0 VFs
268 * ifidx 65-127 for PF1 VFs
269 */
270 vf_id = (ifidx & vfid_mask) - 1;
271
272 return oct->vf_rep_list.ndev[vf_id];
273}
274
275static void
276lio_vf_rep_copy_packet(struct octeon_device *oct,
277 struct sk_buff *skb,
278 int len)
279{
280 if (likely(len > MIN_SKB_SIZE)) {
281 struct octeon_skb_page_info *pg_info;
282 unsigned char *va;
283
284 pg_info = ((struct octeon_skb_page_info *)(skb->cb));
285 if (pg_info->page) {
286 va = page_address(pg_info->page) +
287 pg_info->page_offset;
288 memcpy(skb->data, va, MIN_SKB_SIZE);
289 skb_put(skb, MIN_SKB_SIZE);
290 }
291
292 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
293 pg_info->page,
294 pg_info->page_offset + MIN_SKB_SIZE,
295 len - MIN_SKB_SIZE,
296 LIO_RXBUFFER_SZ);
297 } else {
298 struct octeon_skb_page_info *pg_info =
299 ((struct octeon_skb_page_info *)(skb->cb));
300
301 skb_copy_to_linear_data(skb, page_address(pg_info->page) +
302 pg_info->page_offset, len);
303 skb_put(skb, len);
304 put_page(pg_info->page);
305 }
306}
307
308static int
309lio_vf_rep_pkt_recv(struct octeon_recv_info *recv_info, void *buf)
310{
311 struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt;
312 struct lio_vf_rep_desc *vf_rep;
313 struct net_device *vf_ndev;
314 struct octeon_device *oct;
315 union octeon_rh *rh;
316 struct sk_buff *skb;
317 int i, ifidx;
318
319 oct = lio_get_device(recv_pkt->octeon_id);
320 if (!oct)
321 goto free_buffers;
322
323 skb = recv_pkt->buffer_ptr[0];
324 rh = &recv_pkt->rh;
325 ifidx = rh->r.ossp;
326
327 vf_ndev = lio_vf_rep_get_ndev(oct, ifidx);
328 if (!vf_ndev)
329 goto free_buffers;
330
331 vf_rep = netdev_priv(vf_ndev);
332 if (!(atomic_read(&vf_rep->ifstate) & LIO_IFSTATE_RUNNING) ||
333 recv_pkt->buffer_count > 1)
334 goto free_buffers;
335
336 skb->dev = vf_ndev;
337
338 /* Multiple buffers are not used for vf_rep packets.
339 * So just buffer_size[0] is valid.
340 */
341 lio_vf_rep_copy_packet(oct, skb, recv_pkt->buffer_size[0]);
342
343 skb_pull(skb, rh->r_dh.len * BYTES_PER_DHLEN_UNIT);
344 skb->protocol = eth_type_trans(skb, skb->dev);
345 skb->ip_summed = CHECKSUM_NONE;
346
347 netif_rx(skb);
348
349 octeon_free_recv_info(recv_info);
350
351 return 0;
352
353free_buffers:
354 for (i = 0; i < recv_pkt->buffer_count; i++)
355 recv_buffer_free(recv_pkt->buffer_ptr[i]);
356
357 octeon_free_recv_info(recv_info);
358
359 return 0;
360}
361
362static void
363lio_vf_rep_packet_sent_callback(struct octeon_device *oct,
364 u32 status, void *buf)
365{
366 struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
367 struct sk_buff *skb = sc->ctxptr;
368 struct net_device *ndev = skb->dev;
369
370 dma_unmap_single(&oct->pci_dev->dev, sc->dmadptr,
371 sc->datasize, DMA_TO_DEVICE);
372 dev_kfree_skb_any(skb);
373 octeon_free_soft_command(oct, sc);
374
375 if (octnet_iq_is_full(oct, sc->iq_no))
376 return;
377
378 if (netif_queue_stopped(ndev))
379 netif_wake_queue(ndev);
380}
381
382static int
383lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev)
384{
385 struct lio_vf_rep_desc *vf_rep = netdev_priv(ndev);
386 struct net_device *parent_ndev = vf_rep->parent_ndev;
387 struct octeon_device *oct = vf_rep->oct;
388 struct octeon_instr_pki_ih3 *pki_ih3;
389 struct octeon_soft_command *sc;
390 struct lio *parent_lio;
391 int status;
392
393 parent_lio = GET_LIO(parent_ndev);
394
395 if (!(atomic_read(&vf_rep->ifstate) & LIO_IFSTATE_RUNNING) ||
396 skb->len <= 0)
397 goto xmit_failed;
398
399 if (octnet_iq_is_full(vf_rep->oct, parent_lio->txq)) {
400 dev_err(&oct->pci_dev->dev, "VF rep: Device IQ full\n");
401 netif_stop_queue(ndev);
402 return NETDEV_TX_BUSY;
403 }
404
405 sc = (struct octeon_soft_command *)
406 octeon_alloc_soft_command(oct, 0, 0, 0);
407 if (!sc) {
408 dev_err(&oct->pci_dev->dev, "VF rep: Soft command alloc failed\n");
409 goto xmit_failed;
410 }
411
412 /* Multiple buffers are not used for vf_rep packets. */
413 if (skb_shinfo(skb)->nr_frags != 0) {
414 dev_err(&oct->pci_dev->dev, "VF rep: nr_frags != 0. Dropping packet\n");
415 goto xmit_failed;
416 }
417
418 sc->dmadptr = dma_map_single(&oct->pci_dev->dev,
419 skb->data, skb->len, DMA_TO_DEVICE);
420 if (dma_mapping_error(&oct->pci_dev->dev, sc->dmadptr)) {
421 dev_err(&oct->pci_dev->dev, "VF rep: DMA mapping failed\n");
422 goto xmit_failed;
423 }
424
425 sc->virtdptr = skb->data;
426 sc->datasize = skb->len;
427 sc->ctxptr = skb;
428 sc->iq_no = parent_lio->txq;
429
430 octeon_prepare_soft_command(oct, sc, OPCODE_NIC, OPCODE_NIC_VF_REP_PKT,
431 vf_rep->ifidx, 0, 0);
432 pki_ih3 = (struct octeon_instr_pki_ih3 *)&sc->cmd.cmd3.pki_ih3;
433 pki_ih3->tagtype = ORDERED_TAG;
434
435 sc->callback = lio_vf_rep_packet_sent_callback;
436 sc->callback_arg = sc;
437
438 status = octeon_send_soft_command(oct, sc);
439 if (status == IQ_SEND_FAILED) {
440 dma_unmap_single(&oct->pci_dev->dev, sc->dmadptr,
441 sc->datasize, DMA_TO_DEVICE);
442 goto xmit_failed;
443 }
444
445 if (status == IQ_SEND_STOP)
446 netif_stop_queue(ndev);
447
448 netif_trans_update(ndev);
449
450 return NETDEV_TX_OK;
451
452xmit_failed:
453 dev_kfree_skb_any(skb);
454
455 return NETDEV_TX_OK;
456}
457
458static int
459lio_vf_rep_attr_get(struct net_device *dev, struct switchdev_attr *attr)
460{
461 struct lio_vf_rep_desc *vf_rep = netdev_priv(dev);
462 struct net_device *parent_ndev = vf_rep->parent_ndev;
463 struct lio *lio = GET_LIO(parent_ndev);
464
465 switch (attr->id) {
466 case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
467 attr->u.ppid.id_len = ETH_ALEN;
468 ether_addr_copy(attr->u.ppid.id,
469 (void *)&lio->linfo.hw_addr + 2);
470 break;
471
472 default:
473 return -EOPNOTSUPP;
474 }
475
476 return 0;
477}
478
479static const struct switchdev_ops lio_vf_rep_switchdev_ops = {
480 .switchdev_port_attr_get = lio_vf_rep_attr_get,
481};
482
483static void
484lio_vf_rep_fetch_stats(struct work_struct *work)
485{
486 struct cavium_wk *wk = (struct cavium_wk *)work;
487 struct lio_vf_rep_desc *vf_rep = wk->ctxptr;
488 struct lio_vf_rep_stats stats;
489 struct lio_vf_rep_req rep_cfg;
490 struct octeon_device *oct;
491 int ret;
492
493 oct = vf_rep->oct;
494
495 memset(&rep_cfg, 0, sizeof(rep_cfg));
496 rep_cfg.req_type = LIO_VF_REP_REQ_STATS;
497 rep_cfg.ifidx = vf_rep->ifidx;
498
499 ret = lio_vf_rep_send_soft_command(oct, &rep_cfg, sizeof(rep_cfg),
500 &stats, sizeof(stats));
501
502 if (!ret) {
503 octeon_swap_8B_data((u64 *)&stats, (sizeof(stats) >> 3));
504 memcpy(&vf_rep->stats, &stats, sizeof(stats));
505 }
506
507 schedule_delayed_work(&vf_rep->stats_wk.work,
508 msecs_to_jiffies(LIO_VF_REP_STATS_POLL_TIME_MS));
509}
510
511int
512lio_vf_rep_create(struct octeon_device *oct)
513{
514 struct lio_vf_rep_desc *vf_rep;
515 struct net_device *ndev;
516 int i, num_vfs;
517
518 if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
519 return 0;
520
521 if (!oct->sriov_info.sriov_enabled)
522 return 0;
523
524 num_vfs = oct->sriov_info.num_vfs_alloced;
525
526 oct->vf_rep_list.num_vfs = 0;
527 for (i = 0; i < num_vfs; i++) {
528 ndev = alloc_etherdev(sizeof(struct lio_vf_rep_desc));
529
530 if (!ndev) {
531 dev_err(&oct->pci_dev->dev,
532 "VF rep device %d creation failed\n", i);
533 goto cleanup;
534 }
535
536 ndev->min_mtu = LIO_MIN_MTU_SIZE;
537 ndev->max_mtu = LIO_MAX_MTU_SIZE;
538 ndev->netdev_ops = &lio_vf_rep_ndev_ops;
539 SWITCHDEV_SET_OPS(ndev, &lio_vf_rep_switchdev_ops);
540
541 vf_rep = netdev_priv(ndev);
542 memset(vf_rep, 0, sizeof(*vf_rep));
543
544 vf_rep->ndev = ndev;
545 vf_rep->oct = oct;
546 vf_rep->parent_ndev = oct->props[0].netdev;
547 vf_rep->ifidx = (oct->pf_num * 64) + i + 1;
548
549 eth_hw_addr_random(ndev);
550
551 if (register_netdev(ndev)) {
552 dev_err(&oct->pci_dev->dev, "VF rep nerdev registration failed\n");
553
554 free_netdev(ndev);
555 goto cleanup;
556 }
557
558 netif_carrier_off(ndev);
559
560 INIT_DELAYED_WORK(&vf_rep->stats_wk.work,
561 lio_vf_rep_fetch_stats);
562 vf_rep->stats_wk.ctxptr = (void *)vf_rep;
563 schedule_delayed_work(&vf_rep->stats_wk.work,
564 msecs_to_jiffies
565 (LIO_VF_REP_STATS_POLL_TIME_MS));
566 oct->vf_rep_list.num_vfs++;
567 oct->vf_rep_list.ndev[i] = ndev;
568 }
569
570 if (octeon_register_dispatch_fn(oct, OPCODE_NIC,
571 OPCODE_NIC_VF_REP_PKT,
572 lio_vf_rep_pkt_recv, oct)) {
573 dev_err(&oct->pci_dev->dev, "VF rep Dispatch func registration failed\n");
574
575 goto cleanup;
576 }
577
578 return 0;
579
580cleanup:
581 for (i = 0; i < oct->vf_rep_list.num_vfs; i++) {
582 ndev = oct->vf_rep_list.ndev[i];
583 oct->vf_rep_list.ndev[i] = NULL;
584 if (ndev) {
585 vf_rep = netdev_priv(ndev);
586 cancel_delayed_work_sync
587 (&vf_rep->stats_wk.work);
588 unregister_netdev(ndev);
589 free_netdev(ndev);
590 }
591 }
592
593 oct->vf_rep_list.num_vfs = 0;
594
595 return -1;
596}
597
598void
599lio_vf_rep_destroy(struct octeon_device *oct)
600{
601 struct lio_vf_rep_desc *vf_rep;
602 struct net_device *ndev;
603 int i;
604
605 if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
606 return;
607
608 if (!oct->sriov_info.sriov_enabled)
609 return;
610
611 for (i = 0; i < oct->vf_rep_list.num_vfs; i++) {
612 ndev = oct->vf_rep_list.ndev[i];
613 oct->vf_rep_list.ndev[i] = NULL;
614 if (ndev) {
615 vf_rep = netdev_priv(ndev);
616 cancel_delayed_work_sync
617 (&vf_rep->stats_wk.work);
618 netif_tx_disable(ndev);
619 netif_carrier_off(ndev);
620
621 unregister_netdev(ndev);
622 free_netdev(ndev);
623 }
624 }
625
626 oct->vf_rep_list.num_vfs = 0;
627}
628
629static int
630lio_vf_rep_netdev_event(struct notifier_block *nb,
631 unsigned long event, void *ptr)
632{
633 struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
634 struct lio_vf_rep_desc *vf_rep;
635 struct lio_vf_rep_req rep_cfg;
636 struct octeon_device *oct;
637 int ret;
638
639 switch (event) {
640 case NETDEV_REGISTER:
641 case NETDEV_CHANGENAME:
642 break;
643
644 default:
645 return NOTIFY_DONE;
646 }
647
648 if (ndev->netdev_ops != &lio_vf_rep_ndev_ops)
649 return NOTIFY_DONE;
650
651 vf_rep = netdev_priv(ndev);
652 oct = vf_rep->oct;
653
654 if (strlen(ndev->name) > LIO_IF_NAME_SIZE) {
655 dev_err(&oct->pci_dev->dev,
656 "Device name change sync failed as the size is > %d\n",
657 LIO_IF_NAME_SIZE);
658 return NOTIFY_DONE;
659 }
660
661 memset(&rep_cfg, 0, sizeof(rep_cfg));
662 rep_cfg.req_type = LIO_VF_REP_REQ_DEVNAME;
663 rep_cfg.ifidx = vf_rep->ifidx;
664 strncpy(rep_cfg.rep_name.name, ndev->name, LIO_IF_NAME_SIZE);
665
666 ret = lio_vf_rep_send_soft_command(oct, &rep_cfg,
667 sizeof(rep_cfg), NULL, 0);
668 if (ret)
669 dev_err(&oct->pci_dev->dev,
670 "vf_rep netdev name change failed with err %d\n", ret);
671
672 return NOTIFY_DONE;
673}
674
675static struct notifier_block lio_vf_rep_netdev_notifier = {
676 .notifier_call = lio_vf_rep_netdev_event,
677};
678
679int
680lio_vf_rep_modinit(void)
681{
682 if (register_netdevice_notifier(&lio_vf_rep_netdev_notifier)) {
683 pr_err("netdev notifier registration failed\n");
684 return -EFAULT;
685 }
686
687 return 0;
688}
689
690void
691lio_vf_rep_modexit(void)
692{
693 if (unregister_netdevice_notifier(&lio_vf_rep_netdev_notifier))
694 pr_err("netdev notifier unregister failed\n");
695}
drivers/net/ethernet/cavium/liquidio/lio_vf_rep.h+49−0
@@ -0,0 +1,49 @@
1/**********************************************************************
2 * Author: Cavium, Inc.
3 *
4 * Contact: support@cavium.com
5 * Please include "LiquidIO" in the subject.
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * This file may also be available under a different license from Cavium.
20 * Contact Cavium, Inc. for more information
21 **********************************************************************/
22
23/*! \file octeon_vf_main.h
24 * \brief Host Driver: This file defines vf_rep related macros and structures
25 */
26#ifndef __LIO_VF_REP_H__
27#define __LIO_VF_REP_H__
28#define LIO_VF_REP_REQ_TMO_MS 5000
29#define LIO_VF_REP_STATS_POLL_TIME_MS 200
30
31struct lio_vf_rep_desc {
32 struct net_device *parent_ndev;
33 struct net_device *ndev;
34 struct octeon_device *oct;
35 struct lio_vf_rep_stats stats;
36 struct cavium_wk stats_wk;
37 atomic_t ifstate;
38 int ifidx;
39};
40
41struct lio_vf_rep_sc_ctx {
42 struct completion complete;
43};
44
45int lio_vf_rep_create(struct octeon_device *oct);
46void lio_vf_rep_destroy(struct octeon_device *oct);
47int lio_vf_rep_modinit(void);
48void lio_vf_rep_modexit(void);
49#endif
drivers/net/ethernet/cavium/liquidio/liquidio_common.h+66−2
@@ -27,8 +27,8 @@ · 26 unmodified lines
27 27
28#define LIQUIDIO_PACKAGE ""28#define LIQUIDIO_PACKAGE ""
29#define LIQUIDIO_BASE_MAJOR_VERSION 129#define LIQUIDIO_BASE_MAJOR_VERSION 1
30#define LIQUIDIO_BASE_MINOR_VERSION 630#define LIQUIDIO_BASE_MINOR_VERSION 7
31#define LIQUIDIO_BASE_MICRO_VERSION 131#define LIQUIDIO_BASE_MICRO_VERSION 0
32#define LIQUIDIO_BASE_VERSION __stringify(LIQUIDIO_BASE_MAJOR_VERSION) "." \32#define LIQUIDIO_BASE_VERSION __stringify(LIQUIDIO_BASE_MAJOR_VERSION) "." \
33 __stringify(LIQUIDIO_BASE_MINOR_VERSION)33 __stringify(LIQUIDIO_BASE_MINOR_VERSION)
34#define LIQUIDIO_MICRO_VERSION "." __stringify(LIQUIDIO_BASE_MICRO_VERSION)34#define LIQUIDIO_MICRO_VERSION "." __stringify(LIQUIDIO_BASE_MICRO_VERSION)
@@ -84,10 +84,14 @@ enum octeon_tag_type { · 49 unmodified lines
84#define OPCODE_NIC_IF_CFG 0x0984#define OPCODE_NIC_IF_CFG 0x09
85#define OPCODE_NIC_VF_DRV_NOTICE 0x0A85#define OPCODE_NIC_VF_DRV_NOTICE 0x0A
86#define OPCODE_NIC_INTRMOD_PARAMS 0x0B86#define OPCODE_NIC_INTRMOD_PARAMS 0x0B
87#define OPCODE_NIC_SYNC_OCTEON_TIME 0x14
87#define VF_DRV_LOADED 188#define VF_DRV_LOADED 1
88#define VF_DRV_REMOVED -189#define VF_DRV_REMOVED -1
89#define VF_DRV_MACADDR_CHANGED 290#define VF_DRV_MACADDR_CHANGED 2
90 91
92#define OPCODE_NIC_VF_REP_PKT 0x15
93#define OPCODE_NIC_VF_REP_CMD 0x16
94
91#define CORE_DRV_TEST_SCATTER_OP 0xFFF595#define CORE_DRV_TEST_SCATTER_OP 0xFFF5
92 96
93/* Application codes advertised by the core driver initialization packet. */97/* Application codes advertised by the core driver initialization packet. */
@@ -108,6 +112,10 @@ enum octeon_tag_type { · 14 unmodified lines
108 112
109#define SCR2_BIT_FW_LOADED 63113#define SCR2_BIT_FW_LOADED 63
110 114
115/* App specific capabilities from firmware to pf driver */
116#define LIQUIDIO_TIME_SYNC_CAP 0x1
117#define LIQUIDIO_SWITCHDEV_CAP 0x2
118
111static inline u32 incr_index(u32 index, u32 count, u32 max)119static inline u32 incr_index(u32 index, u32 count, u32 max)
112{120{
113 if ((index + count) >= max)121 if ((index + count) >= max)
@@ -901,4 +909,60 @@ union oct_nic_if_cfg { · 787 unmodified lines
901 } s;909 } s;
902};910};
903 911
912struct lio_time {
913 s64 sec; /* seconds */
914 s64 nsec; /* nanoseconds */
915};
916
917struct lio_vf_rep_stats {
918 u64 tx_packets;
919 u64 tx_bytes;
920 u64 tx_dropped;
921
922 u64 rx_packets;
923 u64 rx_bytes;
924 u64 rx_dropped;
925};
926
927enum lio_vf_rep_req_type {
928 LIO_VF_REP_REQ_NONE,
929 LIO_VF_REP_REQ_STATE,
930 LIO_VF_REP_REQ_MTU,
931 LIO_VF_REP_REQ_STATS,
932 LIO_VF_REP_REQ_DEVNAME
933};
934
935enum {
936 LIO_VF_REP_STATE_DOWN,
937 LIO_VF_REP_STATE_UP
938};
939
940#define LIO_IF_NAME_SIZE 16
941struct lio_vf_rep_req {
942 u8 req_type;
943 u8 ifidx;
944 u8 rsvd[6];
945
946 union {
947 struct lio_vf_rep_name {
948 char name[LIO_IF_NAME_SIZE];
949 } rep_name;
950
951 struct lio_vf_rep_mtu {
952 u32 mtu;
953 u32 rsvd;
954 } rep_mtu;
955
956 struct lio_vf_rep_state {
957 u8 state;
958 u8 rsvd[7];
959 } rep_state;
960 };
961};
962
963struct lio_vf_rep_resp {
964 u64 rh;
965 u8 status;
966 u8 rsvd[7];
967};
904#endif968#endif
drivers/net/ethernet/cavium/liquidio/liquidio_image.h+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#define LIO_FW_BASE_NAME "lio_"24#define LIO_FW_BASE_NAME "lio_"
25#define LIO_FW_NAME_SUFFIX ".bin"25#define LIO_FW_NAME_SUFFIX ".bin"
26#define LIO_FW_NAME_TYPE_NIC "nic"26#define LIO_FW_NAME_TYPE_NIC "nic"
27#define LIO_FW_NAME_TYPE_AUTO "auto"
27#define LIO_FW_NAME_TYPE_NONE "none"28#define LIO_FW_NAME_TYPE_NONE "none"
28#define LIO_MAX_FIRMWARE_VERSION_LEN 1629#define LIO_MAX_FIRMWARE_VERSION_LEN 16
29 30
drivers/net/ethernet/cavium/liquidio/octeon_config.h+2−0
@@ -37,6 +37,8 @@ · 36 unmodified lines
37#define MAX_OCTEON_LINKS MAX_OCTEON_NICIF37#define MAX_OCTEON_LINKS MAX_OCTEON_NICIF
38#define MAX_OCTEON_MULTICAST_ADDR 3238#define MAX_OCTEON_MULTICAST_ADDR 32
39 39
40#define MAX_OCTEON_FILL_COUNT 8
41
40/* CN6xxx IQ configuration macros */42/* CN6xxx IQ configuration macros */
41#define CN6XXX_MAX_INPUT_QUEUES 3243#define CN6XXX_MAX_INPUT_QUEUES 32
42#define CN6XXX_MAX_IQ_DESCRIPTORS 204844#define CN6XXX_MAX_IQ_DESCRIPTORS 2048
drivers/net/ethernet/cavium/liquidio/octeon_console.c+29−3
@@ -803,15 +803,18 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num, · 802 unmodified lines
803}803}
804 804
805#define FBUF_SIZE (4 * 1024 * 1024)805#define FBUF_SIZE (4 * 1024 * 1024)
806#define MAX_BOOTTIME_SIZE 80
806 807
807int octeon_download_firmware(struct octeon_device *oct, const u8 *data,808int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
808 size_t size)809 size_t size)
809{810{
810 int ret = 0;811 struct octeon_firmware_file_header *h;
812 char boottime[MAX_BOOTTIME_SIZE];
813 struct timespec64 ts;
811 u32 crc32_result;814 u32 crc32_result;
812 u64 load_addr;815 u64 load_addr;
813 u32 image_len;816 u32 image_len;
814 struct octeon_firmware_file_header *h;817 int ret = 0;
815 u32 i, rem;818 u32 i, rem;
816 819
817 if (size < sizeof(struct octeon_firmware_file_header)) {820 if (size < sizeof(struct octeon_firmware_file_header)) {
@@ -890,11 +893,34 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data, · 72 unmodified lines
890 load_addr += size;893 load_addr += size;
891 }894 }
892 }895 }
896
897 /* Pass date and time information to NIC at the time of loading
898 * firmware and periodically update the host time to NIC firmware.
899 * This is to make NIC firmware use the same time reference as Host,
900 * so that it is easy to correlate logs from firmware and host for
901 * debugging.
902 *
903 * Octeon always uses UTC time. so timezone information is not sent.
904 */
905 getnstimeofday64(&ts);
906 ret = snprintf(boottime, MAX_BOOTTIME_SIZE,
907 " time_sec=%lld time_nsec=%ld",
908 (s64)ts.tv_sec, ts.tv_nsec);
909 if ((sizeof(h->bootcmd) - strnlen(h->bootcmd, sizeof(h->bootcmd))) <
910 ret) {
911 dev_err(&oct->pci_dev->dev, "Boot command buffer too small\n");
912 return -EINVAL;
913 }
914 strncat(h->bootcmd, boottime,
915 sizeof(h->bootcmd) - strnlen(h->bootcmd, sizeof(h->bootcmd)));
916
893 dev_info(&oct->pci_dev->dev, "Writing boot command: %s\n",917 dev_info(&oct->pci_dev->dev, "Writing boot command: %s\n",
894 h->bootcmd);918 h->bootcmd);
895 919
896 /* Invoke the bootcmd */920 /* Invoke the bootcmd */
897 ret = octeon_console_send_cmd(oct, h->bootcmd, 50);921 ret = octeon_console_send_cmd(oct, h->bootcmd, 50);
922 if (ret)
923 dev_info(&oct->pci_dev->dev, "Boot command send failed\n");
898 924
899 return 0;925 return ret;
900}926}
drivers/net/ethernet/cavium/liquidio/octeon_device.c+14−1
@@ -541,6 +541,7 @@ static char oct_dev_app_str[CVM_DRV_APP_COUNT + 1][32] = { · 540 unmodified lines
541 541
542static struct octeon_device *octeon_device[MAX_OCTEON_DEVICES];542static struct octeon_device *octeon_device[MAX_OCTEON_DEVICES];
543static atomic_t adapter_refcounts[MAX_OCTEON_DEVICES];543static atomic_t adapter_refcounts[MAX_OCTEON_DEVICES];
544static atomic_t adapter_fw_states[MAX_OCTEON_DEVICES];
544 545
545static u32 octeon_device_count;546static u32 octeon_device_count;
546/* locks device array (i.e. octeon_device[]) */547/* locks device array (i.e. octeon_device[]) */
@@ -770,6 +771,10 @@ int octeon_register_device(struct octeon_device *oct, · 223 unmodified lines
770 oct->adapter_refcount = &adapter_refcounts[oct->octeon_id];771 oct->adapter_refcount = &adapter_refcounts[oct->octeon_id];
771 atomic_set(oct->adapter_refcount, 0);772 atomic_set(oct->adapter_refcount, 0);
772 773
774 /* Like the reference count, the f/w state is shared 'per-adapter' */
775 oct->adapter_fw_state = &adapter_fw_states[oct->octeon_id];
776 atomic_set(oct->adapter_fw_state, FW_NEEDS_TO_BE_LOADED);
777
773 spin_lock(&octeon_devices_lock);778 spin_lock(&octeon_devices_lock);
774 for (idx = (int)oct->octeon_id - 1; idx >= 0; idx--) {779 for (idx = (int)oct->octeon_id - 1; idx >= 0; idx--) {
775 if (!octeon_device[idx]) {780 if (!octeon_device[idx]) {
@@ -780,11 +785,15 @@ int octeon_register_device(struct octeon_device *oct, · 4 unmodified lines
780 atomic_inc(oct->adapter_refcount);785 atomic_inc(oct->adapter_refcount);
781 return 1; /* here, refcount is guaranteed to be 1 */786 return 1; /* here, refcount is guaranteed to be 1 */
782 }787 }
783 /* if another device is at same bus/dev, use its refcounter */788 /* If another device is at same bus/dev, use its refcounter
789 * (and f/w state variable).
790 */
784 if ((octeon_device[idx]->loc.bus == bus) &&791 if ((octeon_device[idx]->loc.bus == bus) &&
785 (octeon_device[idx]->loc.dev == dev)) {792 (octeon_device[idx]->loc.dev == dev)) {
786 oct->adapter_refcount =793 oct->adapter_refcount =
787 octeon_device[idx]->adapter_refcount;794 octeon_device[idx]->adapter_refcount;
795 oct->adapter_fw_state =
796 octeon_device[idx]->adapter_fw_state;
788 break;797 break;
789 }798 }
790 }799 }
@@ -1171,6 +1180,10 @@ octeon_register_dispatch_fn(struct octeon_device *oct, · 380 unmodified lines
1171 spin_unlock_bh(&oct->dispatch.lock);1180 spin_unlock_bh(&oct->dispatch.lock);
1172 1181
1173 } else {1182 } else {
1183 if (pfn == fn &&
1184 octeon_get_dispatch_arg(oct, opcode, subcode) == fn_arg)
1185 return 0;
1186
1174 dev_err(&oct->pci_dev->dev,1187 dev_err(&oct->pci_dev->dev,
1175 "Found previously registered dispatch fn for opcode/subcode: %x/%x\n",1188 "Found previously registered dispatch fn for opcode/subcode: %x/%x\n",
1176 opcode, subcode);1189 opcode, subcode);
drivers/net/ethernet/cavium/liquidio/octeon_device.h+24−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
23#define _OCTEON_DEVICE_H_23#define _OCTEON_DEVICE_H_
24 24
25#include <linux/interrupt.h>25#include <linux/interrupt.h>
26#include <net/devlink.h>
26 27
27/** PCI VendorId Device Id */28/** PCI VendorId Device Id */
28#define OCTEON_CN68XX_PCIID 0x91177d29#define OCTEON_CN68XX_PCIID 0x91177d
@@ -50,6 +51,13 @@ enum octeon_pci_swap_mode { · 21 unmodified lines
50 OCTEON_PCI_32BIT_LW_SWAP = 351 OCTEON_PCI_32BIT_LW_SWAP = 3
51};52};
52 53
54enum lio_fw_state {
55 FW_IS_PRELOADED = 0,
56 FW_NEEDS_TO_BE_LOADED = 1,
57 FW_IS_BEING_LOADED = 2,
58 FW_HAS_BEEN_LOADED = 3,
59};
60
53enum {61enum {
54 OCTEON_CONFIG_TYPE_DEFAULT = 0,62 OCTEON_CONFIG_TYPE_DEFAULT = 0,
55 NUM_OCTEON_CONFS,63 NUM_OCTEON_CONFS,
@@ -384,6 +392,15 @@ struct octeon_ioq_vector { · 328 unmodified lines
384 u32 ioq_num;392 u32 ioq_num;
385};393};
386 394
395struct lio_vf_rep_list {
396 int num_vfs;
397 struct net_device *ndev[CN23XX_MAX_VFS_PER_PF];
398};
399
400struct lio_devlink_priv {
401 struct octeon_device *oct;
402};
403
387/** The Octeon device.404/** The Octeon device.
388 * Each Octeon device has this structure to represent all its405 * Each Octeon device has this structure to represent all its
389 * components.406 * components.
@@ -557,7 +574,14 @@ struct octeon_device { · 167 unmodified lines
557 } loc;574 } loc;
558 575
559 atomic_t *adapter_refcount; /* reference count of adapter */576 atomic_t *adapter_refcount; /* reference count of adapter */
577
578 atomic_t *adapter_fw_state; /* per-adapter, lio_fw_state */
579
560 bool ptp_enable;580 bool ptp_enable;
581
582 struct lio_vf_rep_list vf_rep_list;
583 struct devlink *devlink;
584 enum devlink_eswitch_mode eswitch_mode;
561};585};
562 586
563#define OCT_DRV_ONLINE 1587#define OCT_DRV_ONLINE 1
drivers/net/ethernet/cavium/liquidio/octeon_droq.c+2−2
@@ -52,8 +52,8 @@ struct __dispatch { · 51 unmodified lines
52 * @return Failure: NULL52 * @return Failure: NULL
53 *53 *
54 */54 */
55static inline void *octeon_get_dispatch_arg(struct octeon_device *octeon_dev,55void *octeon_get_dispatch_arg(struct octeon_device *octeon_dev,
56 u16 opcode, u16 subcode)56 u16 opcode, u16 subcode)
57{57{
58 int idx;58 int idx;
59 struct list_head *dispatch;59 struct list_head *dispatch;
drivers/net/ethernet/cavium/liquidio/octeon_droq.h+3−0
@@ -400,6 +400,9 @@ int octeon_register_dispatch_fn(struct octeon_device *oct, · 399 unmodified lines
400 u16 subcode,400 u16 subcode,
401 octeon_dispatch_fn_t fn, void *fn_arg);401 octeon_dispatch_fn_t fn, void *fn_arg);
402 402
403void *octeon_get_dispatch_arg(struct octeon_device *oct,
404 u16 opcode, u16 subcode);
405
403void octeon_droq_print_stats(void);406void octeon_droq_print_stats(void);
404 407
405u32 octeon_droq_check_hw_for_pkts(struct octeon_droq *droq);408u32 octeon_droq_check_hw_for_pkts(struct octeon_droq *droq);
drivers/net/ethernet/cavium/liquidio/octeon_iq.h+3−0
@@ -343,6 +343,9 @@ int octeon_delete_instr_queue(struct octeon_device *octeon_dev, u32 iq_no); · 342 unmodified lines
343 343
344int lio_wait_for_instr_fetch(struct octeon_device *oct);344int lio_wait_for_instr_fetch(struct octeon_device *oct);
345 345
346void
347octeon_ring_doorbell_locked(struct octeon_device *oct, u32 iq_no);
348
346int349int
347octeon_register_reqtype_free_fn(struct octeon_device *oct, int reqtype,350octeon_register_reqtype_free_fn(struct octeon_device *oct, int reqtype,
348 void (*fn)(void *));351 void (*fn)(void *));
drivers/net/ethernet/cavium/liquidio/octeon_main.h+1−1
@@ -63,7 +63,7 @@ struct octnet_buf_free_info { · 62 unmodified lines
63};63};
64 64
65/* BQL-related functions */65/* BQL-related functions */
66void octeon_report_sent_bytes_to_bql(void *buf, int reqtype);66int octeon_report_sent_bytes_to_bql(void *buf, int reqtype);
67void octeon_update_tx_completion_counters(void *buf, int reqtype,67void octeon_update_tx_completion_counters(void *buf, int reqtype,
68 unsigned int *pkts_compl,68 unsigned int *pkts_compl,
69 unsigned int *bytes_compl);69 unsigned int *bytes_compl);
drivers/net/ethernet/cavium/liquidio/octeon_network.h+3−0
@@ -136,6 +136,9 @@ struct lio { · 135 unmodified lines
136 /* work queue for link status */136 /* work queue for link status */
137 struct cavium_wq link_status_wq;137 struct cavium_wq link_status_wq;
138 138
139 /* work queue to regularly send local time to octeon firmware */
140 struct cavium_wq sync_octeon_time_wq;
141
139 int netdev_uc_count;142 int netdev_uc_count;
140};143};
141 144
drivers/net/ethernet/cavium/liquidio/octeon_nic.c+3−2
@@ -82,9 +82,10 @@ octeon_alloc_soft_command_resp(struct octeon_device *oct, · 81 unmodified lines
82}82}
83 83
84int octnet_send_nic_data_pkt(struct octeon_device *oct,84int octnet_send_nic_data_pkt(struct octeon_device *oct,
85 struct octnic_data_pkt *ndata)85 struct octnic_data_pkt *ndata,
86 int xmit_more)
86{87{
87 int ring_doorbell = 1;88 int ring_doorbell = !xmit_more;
88 89
89 return octeon_send_command(oct, ndata->q_no, ring_doorbell, &ndata->cmd,90 return octeon_send_command(oct, ndata->q_no, ring_doorbell, &ndata->cmd,
90 ndata->buf, ndata->datasize,91 ndata->buf, ndata->datasize,
drivers/net/ethernet/cavium/liquidio/octeon_nic.h+2−1
@@ -279,7 +279,8 @@ octeon_alloc_soft_command_resp(struct octeon_device *oct, · 278 unmodified lines
279 * queue should be stopped, and IQ_SEND_OK if it sent okay.279 * queue should be stopped, and IQ_SEND_OK if it sent okay.
280 */280 */
281int octnet_send_nic_data_pkt(struct octeon_device *oct,281int octnet_send_nic_data_pkt(struct octeon_device *oct,
282 struct octnic_data_pkt *ndata);282 struct octnic_data_pkt *ndata,
283 int xmit_more);
283 284
284/** Send a NIC control packet to the device285/** Send a NIC control packet to the device
285 * @param oct - octeon device pointer286 * @param oct - octeon device pointer
drivers/net/ethernet/cavium/liquidio/request_manager.c+16−4
@@ -278,6 +278,18 @@ ring_doorbell(struct octeon_device *oct, struct octeon_instr_queue *iq) · 277 unmodified lines
278 }278 }
279}279}
280 280
281void
282octeon_ring_doorbell_locked(struct octeon_device *oct, u32 iq_no)
283{
284 struct octeon_instr_queue *iq;
285
286 iq = oct->instr_queue[iq_no];
287 spin_lock(&iq->post_lock);
288 if (iq->fill_cnt)
289 ring_doorbell(oct, iq);
290 spin_unlock(&iq->post_lock);
291}
292
281static inline void __copy_cmd_into_iq(struct octeon_instr_queue *iq,293static inline void __copy_cmd_into_iq(struct octeon_instr_queue *iq,
282 u8 *cmd)294 u8 *cmd)
283{295{
@@ -477,8 +489,6 @@ octeon_flush_iq(struct octeon_device *oct, struct octeon_instr_queue *iq, · 193 unmodified lines
477 }489 }
478 490
479 tot_inst_processed += inst_processed;491 tot_inst_processed += inst_processed;
480 inst_processed = 0;
481
482 } while (tot_inst_processed < napi_budget);492 } while (tot_inst_processed < napi_budget);
483 493
484 if (napi_budget && (tot_inst_processed >= napi_budget))494 if (napi_budget && (tot_inst_processed >= napi_budget))
@@ -543,6 +553,7 @@ octeon_send_command(struct octeon_device *oct, u32 iq_no, · 58 unmodified lines
543 u32 force_db, void *cmd, void *buf,553 u32 force_db, void *cmd, void *buf,
544 u32 datasize, u32 reqtype)554 u32 datasize, u32 reqtype)
545{555{
556 int xmit_stopped;
546 struct iq_post_status st;557 struct iq_post_status st;
547 struct octeon_instr_queue *iq = oct->instr_queue[iq_no];558 struct octeon_instr_queue *iq = oct->instr_queue[iq_no];
548 559
@@ -554,12 +565,13 @@ octeon_send_command(struct octeon_device *oct, u32 iq_no, · 5 unmodified lines
554 st = __post_command2(iq, cmd);565 st = __post_command2(iq, cmd);
555 566
556 if (st.status != IQ_SEND_FAILED) {567 if (st.status != IQ_SEND_FAILED) {
557 octeon_report_sent_bytes_to_bql(buf, reqtype);568 xmit_stopped = octeon_report_sent_bytes_to_bql(buf, reqtype);
558 __add_to_request_list(iq, st.index, buf, reqtype);569 __add_to_request_list(iq, st.index, buf, reqtype);
559 INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, bytes_sent, datasize);570 INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, bytes_sent, datasize);
560 INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_posted, 1);571 INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_posted, 1);
561 572
562 if (force_db)573 if (iq->fill_cnt >= MAX_OCTEON_FILL_COUNT || force_db ||
574 xmit_stopped || st.status == IQ_SEND_STOP)
563 ring_doorbell(oct, iq);575 ring_doorbell(oct, iq);
564 } else {576 } else {
565 INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_dropped, 1);577 INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_dropped, 1);
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c+11−13
@@ -705,14 +705,15 @@ static int octeon_mgmt_ioctl_hwtstamp(struct net_device *netdev, · 704 unmodified lines
705 u64 clock_comp = (NSEC_PER_SEC << 32) / octeon_get_io_clock_rate();705 u64 clock_comp = (NSEC_PER_SEC << 32) / octeon_get_io_clock_rate();
706 if (!ptp.s.ptp_en)706 if (!ptp.s.ptp_en)
707 cvmx_write_csr(CVMX_MIO_PTP_CLOCK_COMP, clock_comp);707 cvmx_write_csr(CVMX_MIO_PTP_CLOCK_COMP, clock_comp);
708 pr_info("PTP Clock: Using sclk reference at %lld Hz\n",708 netdev_info(netdev,
709 (NSEC_PER_SEC << 32) / clock_comp);709 "PTP Clock using sclk reference @ %lldHz\n",
710 (NSEC_PER_SEC << 32) / clock_comp);
710 } else {711 } else {
711 /* The clock is already programmed to use a GPIO */712 /* The clock is already programmed to use a GPIO */
712 u64 clock_comp = cvmx_read_csr(CVMX_MIO_PTP_CLOCK_COMP);713 u64 clock_comp = cvmx_read_csr(CVMX_MIO_PTP_CLOCK_COMP);
713 pr_info("PTP Clock: Using GPIO %d at %lld Hz\n",714 netdev_info(netdev,
714 ptp.s.ext_clk_in,715 "PTP Clock using GPIO%d @ %lld Hz\n",
715 (NSEC_PER_SEC << 32) / clock_comp);716 ptp.s.ext_clk_in, (NSEC_PER_SEC << 32) / clock_comp);
716 }717 }
717 718
718 /* Enable the clock if it wasn't done already */719 /* Enable the clock if it wasn't done already */
@@ -926,14 +927,11 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev) · 207 unmodified lines
926 spin_unlock_irqrestore(&p->lock, flags);927 spin_unlock_irqrestore(&p->lock, flags);
927 928
928 if (link_changed != 0) {929 if (link_changed != 0) {
929 if (link_changed > 0) {930 if (link_changed > 0)
930 pr_info("%s: Link is up - %d/%s\n", netdev->name,931 netdev_info(netdev, "Link is up - %d/%s\n",
931 phydev->speed,932 phydev->speed, phydev->duplex == DUPLEX_FULL ? "Full" : "Half");
932 phydev->duplex == DUPLEX_FULL ?933 else
933 "Full" : "Half");934 netdev_info(netdev, "Link is down\n");
934 } else {
935 pr_info("%s: Link is down\n", netdev->name);
936 }
937 }935 }
938}936}
939 937
drivers/net/ethernet/cavium/thunder/nic_main.c+30−56
@@ -361,17 +361,8 @@ static void nic_set_lmac_vf_mapping(struct nicpf *nic) · 360 unmodified lines
361 }361 }
362}362}
363 363
364static void nic_free_lmacmem(struct nicpf *nic)364static void nic_get_hw_info(struct nicpf *nic)
365{365{
366 kfree(nic->vf_lmac_map);
367 kfree(nic->link);
368 kfree(nic->duplex);
369 kfree(nic->speed);
370}
371
372static int nic_get_hw_info(struct nicpf *nic)
373{
374 u8 max_lmac;
375 u16 sdevid;366 u16 sdevid;
376 struct hw_info *hw = nic->hw;367 struct hw_info *hw = nic->hw;
377 368
@@ -419,41 +410,16 @@ static int nic_get_hw_info(struct nicpf *nic) · 41 unmodified lines
419 break;410 break;
420 }411 }
421 hw->tl4_cnt = MAX_QUEUES_PER_QSET * pci_sriov_get_totalvfs(nic->pdev);412 hw->tl4_cnt = MAX_QUEUES_PER_QSET * pci_sriov_get_totalvfs(nic->pdev);
422
423 /* Allocate memory for LMAC tracking elements */
424 max_lmac = hw->bgx_cnt * MAX_LMAC_PER_BGX;
425 nic->vf_lmac_map = kmalloc_array(max_lmac, sizeof(u8), GFP_KERNEL);
426 if (!nic->vf_lmac_map)
427 goto error;
428 nic->link = kmalloc_array(max_lmac, sizeof(u8), GFP_KERNEL);
429 if (!nic->link)
430 goto error;
431 nic->duplex = kmalloc_array(max_lmac, sizeof(u8), GFP_KERNEL);
432 if (!nic->duplex)
433 goto error;
434 nic->speed = kmalloc_array(max_lmac, sizeof(u32), GFP_KERNEL);
435 if (!nic->speed)
436 goto error;
437 return 0;
438
439error:
440 nic_free_lmacmem(nic);
441 return -ENOMEM;
442}413}
443 414
444#define BGX0_BLOCK 8415#define BGX0_BLOCK 8
445#define BGX1_BLOCK 9416#define BGX1_BLOCK 9
446 417
447static int nic_init_hw(struct nicpf *nic)418static void nic_init_hw(struct nicpf *nic)
448{419{
449 int i, err;420 int i;
450 u64 cqm_cfg;421 u64 cqm_cfg;
451 422
452 /* Get HW capability info */
453 err = nic_get_hw_info(nic);
454 if (err)
455 return err;
456
457 /* Enable NIC HW block */423 /* Enable NIC HW block */
458 nic_reg_write(nic, NIC_PF_CFG, 0x3);424 nic_reg_write(nic, NIC_PF_CFG, 0x3);
459 425
@@ -498,8 +464,6 @@ static int nic_init_hw(struct nicpf *nic) · 38 unmodified lines
498 cqm_cfg = nic_reg_read(nic, NIC_PF_CQM_CFG);464 cqm_cfg = nic_reg_read(nic, NIC_PF_CQM_CFG);
499 if (cqm_cfg < NICPF_CQM_MIN_DROP_LEVEL)465 if (cqm_cfg < NICPF_CQM_MIN_DROP_LEVEL)
500 nic_reg_write(nic, NIC_PF_CQM_CFG, NICPF_CQM_MIN_DROP_LEVEL);466 nic_reg_write(nic, NIC_PF_CQM_CFG, NICPF_CQM_MIN_DROP_LEVEL);
501
502 return 0;
503}467}
504 468
505/* Channel parse index configuration */469/* Channel parse index configuration */
@@ -584,9 +548,6 @@ static void nic_config_cpi(struct nicpf *nic, struct cpi_cfg_msg *cfg) · 78 unmodified lines
584static void nic_send_rss_size(struct nicpf *nic, int vf)548static void nic_send_rss_size(struct nicpf *nic, int vf)
585{549{
586 union nic_mbx mbx = {};550 union nic_mbx mbx = {};
587 u64 *msg;
588
589 msg = (u64 *)&mbx;
590 551
591 mbx.rss_size.msg = NIC_MBOX_MSG_RSS_SIZE;552 mbx.rss_size.msg = NIC_MBOX_MSG_RSS_SIZE;
592 mbx.rss_size.ind_tbl_size = nic->hw->rss_ind_tbl_size;553 mbx.rss_size.ind_tbl_size = nic->hw->rss_ind_tbl_size;
@@ -608,7 +569,6 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) · 15 unmodified lines
608 rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset;569 rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset;
609 570
610 rssi = rssi_base;571 rssi = rssi_base;
611 qset = cfg->vf_id;
612 572
613 for (; rssi < (rssi_base + cfg->tbl_len); rssi++) {573 for (; rssi < (rssi_base + cfg->tbl_len); rssi++) {
614 u8 svf = cfg->ind_tbl[idx] >> 3;574 u8 svf = cfg->ind_tbl[idx] >> 3;
@@ -1273,6 +1233,7 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 658 unmodified lines
1273{1233{
1274 struct device *dev = &pdev->dev;1234 struct device *dev = &pdev->dev;
1275 struct nicpf *nic;1235 struct nicpf *nic;
1236 u8 max_lmac;
1276 int err;1237 int err;
1277 1238
1278 BUILD_BUG_ON(sizeof(union nic_mbx) > 16);1239 BUILD_BUG_ON(sizeof(union nic_mbx) > 16);
@@ -1282,10 +1243,8 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 3 unmodified lines
1282 return -ENOMEM;1243 return -ENOMEM;
1283 1244
1284 nic->hw = devm_kzalloc(dev, sizeof(struct hw_info), GFP_KERNEL);1245 nic->hw = devm_kzalloc(dev, sizeof(struct hw_info), GFP_KERNEL);
1285 if (!nic->hw) {1246 if (!nic->hw)
1286 devm_kfree(dev, nic);
1287 return -ENOMEM;1247 return -ENOMEM;
1288 }
1289 1248
1290 pci_set_drvdata(pdev, nic);1249 pci_set_drvdata(pdev, nic);
1291 1250
@@ -1326,11 +1285,33 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 34 unmodified lines
1326 1285
1327 nic->node = nic_get_node_id(pdev);1286 nic->node = nic_get_node_id(pdev);
1328 1287
1329 /* Initialize hardware */1288 /* Get HW capability info */
1330 err = nic_init_hw(nic);1289 nic_get_hw_info(nic);
1331 if (err)1290
1291 /* Allocate memory for LMAC tracking elements */
1292 err = -ENOMEM;
1293 max_lmac = nic->hw->bgx_cnt * MAX_LMAC_PER_BGX;
1294
1295 nic->vf_lmac_map = devm_kmalloc_array(dev, max_lmac, sizeof(u8),
1296 GFP_KERNEL);
1297 if (!nic->vf_lmac_map)
1298 goto err_release_regions;
1299
1300 nic->link = devm_kmalloc_array(dev, max_lmac, sizeof(u8), GFP_KERNEL);
1301 if (!nic->link)
1302 goto err_release_regions;
1303
1304 nic->duplex = devm_kmalloc_array(dev, max_lmac, sizeof(u8), GFP_KERNEL);
1305 if (!nic->duplex)
1306 goto err_release_regions;
1307
1308 nic->speed = devm_kmalloc_array(dev, max_lmac, sizeof(u32), GFP_KERNEL);
1309 if (!nic->speed)
1332 goto err_release_regions;1310 goto err_release_regions;
1333 1311
1312 /* Initialize hardware */
1313 nic_init_hw(nic);
1314
1334 nic_set_lmac_vf_mapping(nic);1315 nic_set_lmac_vf_mapping(nic);
1335 1316
1336 /* Register interrupts */1317 /* Register interrupts */
@@ -1364,9 +1345,6 @@ err_unregister_interrupts: · 27 unmodified lines
1364err_release_regions:1345err_release_regions:
1365 pci_release_regions(pdev);1346 pci_release_regions(pdev);
1366err_disable_device:1347err_disable_device:
1367 nic_free_lmacmem(nic);
1368 devm_kfree(dev, nic->hw);
1369 devm_kfree(dev, nic);
1370 pci_disable_device(pdev);1348 pci_disable_device(pdev);
1371 pci_set_drvdata(pdev, NULL);1349 pci_set_drvdata(pdev, NULL);
1372 return err;1350 return err;
@@ -1388,10 +1366,6 @@ static void nic_remove(struct pci_dev *pdev) · 15 unmodified lines
1388 nic_unregister_interrupts(nic);1366 nic_unregister_interrupts(nic);
1389 pci_release_regions(pdev);1367 pci_release_regions(pdev);
1390 1368
1391 nic_free_lmacmem(nic);
1392 devm_kfree(&pdev->dev, nic->hw);
1393 devm_kfree(&pdev->dev, nic);
1394
1395 pci_disable_device(pdev);1369 pci_disable_device(pdev);
1396 pci_set_drvdata(pdev, NULL);1370 pci_set_drvdata(pdev, NULL);
1397}1371}
drivers/net/ethernet/cavium/thunder/nicvf_main.c+3−2
@@ -523,6 +523,7 @@ static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog, · 522 unmodified lines
523 523
524 xdp.data_hard_start = page_address(page);524 xdp.data_hard_start = page_address(page);
525 xdp.data = (void *)cpu_addr;525 xdp.data = (void *)cpu_addr;
526 xdp_set_data_meta_invalid(&xdp);
526 xdp.data_end = xdp.data + len;527 xdp.data_end = xdp.data + len;
527 orig_data = xdp.data;528 orig_data = xdp.data;
528 529
@@ -1740,7 +1741,7 @@ static int nicvf_xdp_setup(struct nicvf *nic, struct bpf_prog *prog) · 1211 unmodified lines
1740 return 0;1741 return 0;
1741}1742}
1742 1743
1743static int nicvf_xdp(struct net_device *netdev, struct netdev_xdp *xdp)1744static int nicvf_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
1744{1745{
1745 struct nicvf *nic = netdev_priv(netdev);1746 struct nicvf *nic = netdev_priv(netdev);
1746 1747
@@ -1773,7 +1774,7 @@ static const struct net_device_ops nicvf_netdev_ops = { · 26 unmodified lines
1773 .ndo_tx_timeout = nicvf_tx_timeout,1774 .ndo_tx_timeout = nicvf_tx_timeout,
1774 .ndo_fix_features = nicvf_fix_features,1775 .ndo_fix_features = nicvf_fix_features,
1775 .ndo_set_features = nicvf_set_features,1776 .ndo_set_features = nicvf_set_features,
1776 .ndo_xdp = nicvf_xdp,1777 .ndo_bpf = nicvf_xdp,
1777};1778};
1778 1779
1779static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)1780static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
drivers/net/ethernet/chelsio/cxgb/sge.c+13−17
@@ -1882,10 +1882,10 @@ send: · 1881 unmodified lines
1882/*1882/*
1883 * Callback for the Tx buffer reclaim timer. Runs with softirqs disabled.1883 * Callback for the Tx buffer reclaim timer. Runs with softirqs disabled.
1884 */1884 */
1885static void sge_tx_reclaim_cb(unsigned long data)1885static void sge_tx_reclaim_cb(struct timer_list *t)
1886{1886{
1887 int i;1887 int i;
1888 struct sge *sge = (struct sge *)data;1888 struct sge *sge = from_timer(sge, t, tx_reclaim_timer);
1889 1889
1890 for (i = 0; i < SGE_CMDQ_N; ++i) {1890 for (i = 0; i < SGE_CMDQ_N; ++i) {
1891 struct cmdQ *q = &sge->cmdQ[i];1891 struct cmdQ *q = &sge->cmdQ[i];
@@ -1978,10 +1978,10 @@ void t1_sge_start(struct sge *sge) · 86 unmodified lines
1978/*1978/*
1979 * Callback for the T2 ESPI 'stuck packet feature' workaorund1979 * Callback for the T2 ESPI 'stuck packet feature' workaorund
1980 */1980 */
1981static void espibug_workaround_t204(unsigned long data)1981static void espibug_workaround_t204(struct timer_list *t)
1982{1982{
1983 struct adapter *adapter = (struct adapter *)data;1983 struct sge *sge = from_timer(sge, t, espibug_timer);
1984 struct sge *sge = adapter->sge;1984 struct adapter *adapter = sge->adapter;
1985 unsigned int nports = adapter->params.nports;1985 unsigned int nports = adapter->params.nports;
1986 u32 seop[MAX_NPORTS];1986 u32 seop[MAX_NPORTS];
1987 1987
@@ -2021,10 +2021,10 @@ static void espibug_workaround_t204(unsigned long data) · 33 unmodified lines
2021 mod_timer(&sge->espibug_timer, jiffies + sge->espibug_timeout);2021 mod_timer(&sge->espibug_timer, jiffies + sge->espibug_timeout);
2022}2022}
2023 2023
2024static void espibug_workaround(unsigned long data)2024static void espibug_workaround(struct timer_list *t)
2025{2025{
2026 struct adapter *adapter = (struct adapter *)data;2026 struct sge *sge = from_timer(sge, t, espibug_timer);
2027 struct sge *sge = adapter->sge;2027 struct adapter *adapter = sge->adapter;
2028 2028
2029 if (netif_running(adapter->port[0].dev)) {2029 if (netif_running(adapter->port[0].dev)) {
2030 struct sk_buff *skb = sge->espibug_skb[0];2030 struct sk_buff *skb = sge->espibug_skb[0];
@@ -2075,19 +2075,15 @@ struct sge *t1_sge_create(struct adapter *adapter, struct sge_params *p) · 44 unmodified lines
2075 goto nomem_port;2075 goto nomem_port;
2076 }2076 }
2077 2077
2078 init_timer(&sge->tx_reclaim_timer);2078 timer_setup(&sge->tx_reclaim_timer, sge_tx_reclaim_cb, 0);
2079 sge->tx_reclaim_timer.data = (unsigned long)sge;
2080 sge->tx_reclaim_timer.function = sge_tx_reclaim_cb;
2081 2079
2082 if (is_T2(sge->adapter)) {2080 if (is_T2(sge->adapter)) {
2083 init_timer(&sge->espibug_timer);2081 timer_setup(&sge->espibug_timer,
2082 adapter->params.nports > 1 ? espibug_workaround_t204 : espibug_workaround,
2083 0);
2084 2084
2085 if (adapter->params.nports > 1) {2085 if (adapter->params.nports > 1)
2086 tx_sched_init(sge);2086 tx_sched_init(sge);
2087 sge->espibug_timer.function = espibug_workaround_t204;
2088 } else
2089 sge->espibug_timer.function = espibug_workaround;
2090 sge->espibug_timer.data = (unsigned long)sge->adapter;
2091 2087
2092 sge->espibug_timeout = 1;2088 sge->espibug_timeout = 1;
2093 /* for T204, every 10ms */2089 /* for T204, every 10ms */
drivers/net/ethernet/chelsio/cxgb3/sge.c+98−32
@@ -455,6 +455,11 @@ static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q, · 454 unmodified lines
455 q->pg_chunk.offset = 0;455 q->pg_chunk.offset = 0;
456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page,456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page,
457 0, q->alloc_size, PCI_DMA_FROMDEVICE);457 0, q->alloc_size, PCI_DMA_FROMDEVICE);
458 if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) {
459 __free_pages(q->pg_chunk.page, order);
460 q->pg_chunk.page = NULL;
461 return -EIO;
462 }
458 q->pg_chunk.mapping = mapping;463 q->pg_chunk.mapping = mapping;
459 }464 }
460 sd->pg_chunk = q->pg_chunk;465 sd->pg_chunk = q->pg_chunk;
@@ -949,40 +954,78 @@ static inline unsigned int calc_tx_descs(const struct sk_buff *skb) · 488 unmodified lines
949 return flits_to_desc(flits);954 return flits_to_desc(flits);
950}955}
951 956
957/* map_skb - map a packet main body and its page fragments
958 * @pdev: the PCI device
959 * @skb: the packet
960 * @addr: placeholder to save the mapped addresses
961 *
962 * map the main body of an sk_buff and its page fragments, if any.
963 */
964static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb,
965 dma_addr_t *addr)
966{
967 const skb_frag_t *fp, *end;
968 const struct skb_shared_info *si;
969
970 if (skb_headlen(skb)) {
971 *addr = pci_map_single(pdev, skb->data, skb_headlen(skb),
972 PCI_DMA_TODEVICE);
973 if (pci_dma_mapping_error(pdev, *addr))
974 goto out_err;
975 addr++;
976 }
977
978 si = skb_shinfo(skb);
979 end = &si->frags[si->nr_frags];
980
981 for (fp = si->frags; fp < end; fp++) {
982 *addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp),
983 DMA_TO_DEVICE);
984 if (pci_dma_mapping_error(pdev, *addr))
985 goto unwind;
986 addr++;
987 }
988 return 0;
989
990unwind:
991 while (fp-- > si->frags)
992 dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp),
993 DMA_TO_DEVICE);
994
995 pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE);
996out_err:
997 return -ENOMEM;
998}
999
952/**1000/**
953 * make_sgl - populate a scatter/gather list for a packet1001 * write_sgl - populate a scatter/gather list for a packet
954 * @skb: the packet1002 * @skb: the packet
955 * @sgp: the SGL to populate1003 * @sgp: the SGL to populate
956 * @start: start address of skb main body data to include in the SGL1004 * @start: start address of skb main body data to include in the SGL
957 * @len: length of skb main body data to include in the SGL1005 * @len: length of skb main body data to include in the SGL
958 * @pdev: the PCI device1006 * @addr: the list of the mapped addresses
959 *1007 *
960 * Generates a scatter/gather list for the buffers that make up a packet1008 * Copies the scatter/gather list for the buffers that make up a packet
961 * and returns the SGL size in 8-byte words. The caller must size the SGL1009 * and returns the SGL size in 8-byte words. The caller must size the SGL
962 * appropriately.1010 * appropriately.
963 */1011 */
964static inline unsigned int make_sgl(const struct sk_buff *skb,1012static inline unsigned int write_sgl(const struct sk_buff *skb,
965 struct sg_ent *sgp, unsigned char *start,1013 struct sg_ent *sgp, unsigned char *start,
966 unsigned int len, struct pci_dev *pdev)1014 unsigned int len, const dma_addr_t *addr)
967{1015{
968 dma_addr_t mapping;1016 unsigned int i, j = 0, k = 0, nfrags;
969 unsigned int i, j = 0, nfrags;
970 1017
971 if (len) {1018 if (len) {
972 mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE);
973 sgp->len[0] = cpu_to_be32(len);1019 sgp->len[0] = cpu_to_be32(len);
974 sgp->addr[0] = cpu_to_be64(mapping);1020 sgp->addr[j++] = cpu_to_be64(addr[k++]);
975 j = 1;
976 }1021 }
977 1022
978 nfrags = skb_shinfo(skb)->nr_frags;1023 nfrags = skb_shinfo(skb)->nr_frags;
979 for (i = 0; i < nfrags; i++) {1024 for (i = 0; i < nfrags; i++) {
980 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];1025 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
981 1026
982 mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),
983 DMA_TO_DEVICE);
984 sgp->len[j] = cpu_to_be32(skb_frag_size(frag));1027 sgp->len[j] = cpu_to_be32(skb_frag_size(frag));
985 sgp->addr[j] = cpu_to_be64(mapping);1028 sgp->addr[j] = cpu_to_be64(addr[k++]);
986 j ^= 1;1029 j ^= 1;
987 if (j == 0)1030 if (j == 0)
988 ++sgp;1031 ++sgp;
@@ -1138,7 +1181,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 149 unmodified lines
1138 const struct port_info *pi,1181 const struct port_info *pi,
1139 unsigned int pidx, unsigned int gen,1182 unsigned int pidx, unsigned int gen,
1140 struct sge_txq *q, unsigned int ndesc,1183 struct sge_txq *q, unsigned int ndesc,
1141 unsigned int compl)1184 unsigned int compl, const dma_addr_t *addr)
1142{1185{
1143 unsigned int flits, sgl_flits, cntrl, tso_info;1186 unsigned int flits, sgl_flits, cntrl, tso_info;
1144 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1];1187 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1];
@@ -1196,7 +1239,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 51 unmodified lines
1196 }1239 }
1197 1240
1198 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;1241 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1199 sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev);1242 sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr);
1200 1243
1201 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen,1244 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen,
1202 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl),1245 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl),
@@ -1227,6 +1270,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 24 unmodified lines
1227 struct netdev_queue *txq;1270 struct netdev_queue *txq;
1228 struct sge_qset *qs;1271 struct sge_qset *qs;
1229 struct sge_txq *q;1272 struct sge_txq *q;
1273 dma_addr_t addr[MAX_SKB_FRAGS + 1];
1230 1274
1231 /*1275 /*
1232 * The chip min packet length is 9 octets but play safe and reject1276 * The chip min packet length is 9 octets but play safe and reject
@@ -1255,6 +1299,14 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines
1255 return NETDEV_TX_BUSY;1299 return NETDEV_TX_BUSY;
1256 }1300 }
1257 1301
1302 /* Check if ethernet packet can't be sent as immediate data */
1303 if (skb->len > (WR_LEN - sizeof(struct cpl_tx_pkt))) {
1304 if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) {
1305 dev_kfree_skb(skb);
1306 return NETDEV_TX_OK;
1307 }
1308 }
1309
1258 q->in_use += ndesc;1310 q->in_use += ndesc;
1259 if (unlikely(credits - ndesc < q->stop_thres)) {1311 if (unlikely(credits - ndesc < q->stop_thres)) {
1260 t3_stop_tx_queue(txq, qs, q);1312 t3_stop_tx_queue(txq, qs, q);
@@ -1312,7 +1364,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 51 unmodified lines
1312 if (likely(!skb_shared(skb)))1364 if (likely(!skb_shared(skb)))
1313 skb_orphan(skb);1365 skb_orphan(skb);
1314 1366
1315 write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl);1367 write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr);
1316 check_ring_tx_db(adap, q);1368 check_ring_tx_db(adap, q);
1317 return NETDEV_TX_OK;1369 return NETDEV_TX_OK;
1318}1370}
@@ -1577,7 +1629,8 @@ static void setup_deferred_unmapping(struct sk_buff *skb, struct pci_dev *pdev, · 258 unmodified lines
1577 */1629 */
1578static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,1630static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
1579 struct sge_txq *q, unsigned int pidx,1631 struct sge_txq *q, unsigned int pidx,
1580 unsigned int gen, unsigned int ndesc)1632 unsigned int gen, unsigned int ndesc,
1633 const dma_addr_t *addr)
1581{1634{
1582 unsigned int sgl_flits, flits;1635 unsigned int sgl_flits, flits;
1583 struct work_request_hdr *from;1636 struct work_request_hdr *from;
@@ -1598,10 +1651,9 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, · 14 unmodified lines
1598 1651
1599 flits = skb_transport_offset(skb) / 8;1652 flits = skb_transport_offset(skb) / 8;
1600 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;1653 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1601 sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),1654 sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb),
1602 skb_tail_pointer(skb) -1655 skb_tail_pointer(skb) - skb_transport_header(skb),
1603 skb_transport_header(skb),1656 addr);
1604 adap->pdev);
1605 if (need_skb_unmap()) {1657 if (need_skb_unmap()) {
1606 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);1658 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
1607 skb->destructor = deferred_unmap_destructor;1659 skb->destructor = deferred_unmap_destructor;
@@ -1659,6 +1711,12 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 51 unmodified lines
1659 goto again;1711 goto again;
1660 }1712 }
1661 1713
1714 if (!immediate(skb) &&
1715 map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) {
1716 spin_unlock(&q->lock);
1717 return NET_XMIT_SUCCESS;
1718 }
1719
1662 gen = q->gen;1720 gen = q->gen;
1663 q->in_use += ndesc;1721 q->in_use += ndesc;
1664 pidx = q->pidx;1722 pidx = q->pidx;
@@ -1669,7 +1727,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 4 unmodified lines
1669 }1727 }
1670 spin_unlock(&q->lock);1728 spin_unlock(&q->lock);
1671 1729
1672 write_ofld_wr(adap, skb, q, pidx, gen, ndesc);1730 write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head);
1673 check_ring_tx_db(adap, q);1731 check_ring_tx_db(adap, q);
1674 return NET_XMIT_SUCCESS;1732 return NET_XMIT_SUCCESS;
1675}1733}
@@ -1687,6 +1745,7 @@ static void restart_offloadq(unsigned long data) · 11 unmodified lines
1687 struct sge_txq *q = &qs->txq[TXQ_OFLD];1745 struct sge_txq *q = &qs->txq[TXQ_OFLD];
1688 const struct port_info *pi = netdev_priv(qs->netdev);1746 const struct port_info *pi = netdev_priv(qs->netdev);
1689 struct adapter *adap = pi->adapter;1747 struct adapter *adap = pi->adapter;
1748 unsigned int written = 0;
1690 1749
1691 spin_lock(&q->lock);1750 spin_lock(&q->lock);
1692again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);1751again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);
@@ -1706,10 +1765,15 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 13 unmodified lines
1706 break;1765 break;
1707 }1766 }
1708 1767
1768 if (!immediate(skb) &&
1769 map_skb(adap->pdev, skb, (dma_addr_t *)skb->head))
1770 break;
1771
1709 gen = q->gen;1772 gen = q->gen;
1710 q->in_use += ndesc;1773 q->in_use += ndesc;
1711 pidx = q->pidx;1774 pidx = q->pidx;
1712 q->pidx += ndesc;1775 q->pidx += ndesc;
1776 written += ndesc;
1713 if (q->pidx >= q->size) {1777 if (q->pidx >= q->size) {
1714 q->pidx -= q->size;1778 q->pidx -= q->size;
1715 q->gen ^= 1;1779 q->gen ^= 1;
@@ -1717,7 +1781,8 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 1 unmodified line
1717 __skb_unlink(skb, &q->sendq);1781 __skb_unlink(skb, &q->sendq);
1718 spin_unlock(&q->lock);1782 spin_unlock(&q->lock);
1719 1783
1720 write_ofld_wr(adap, skb, q, pidx, gen, ndesc);1784 write_ofld_wr(adap, skb, q, pidx, gen, ndesc,
1785 (dma_addr_t *)skb->head);
1721 spin_lock(&q->lock);1786 spin_lock(&q->lock);
1722 }1787 }
1723 spin_unlock(&q->lock);1788 spin_unlock(&q->lock);
@@ -1727,8 +1792,9 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); · 3 unmodified lines
1727 set_bit(TXQ_LAST_PKT_DB, &q->flags);1792 set_bit(TXQ_LAST_PKT_DB, &q->flags);
1728#endif1793#endif
1729 wmb();1794 wmb();
1730 t3_write_reg(adap, A_SG_KDOORBELL,1795 if (likely(written))
1731 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));1796 t3_write_reg(adap, A_SG_KDOORBELL,
1797 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
1732}1798}
1733 1799
1734/**1800/**
@@ -2853,9 +2919,9 @@ void t3_sge_err_intr_handler(struct adapter *adapter) · 1118 unmodified lines
2853 * bother cleaning them up here.2919 * bother cleaning them up here.
2854 *2920 *
2855 */2921 */
2856static void sge_timer_tx(unsigned long data)2922static void sge_timer_tx(struct timer_list *t)
2857{2923{
2858 struct sge_qset *qs = (struct sge_qset *)data;2924 struct sge_qset *qs = from_timer(qs, t, tx_reclaim_timer);
2859 struct port_info *pi = netdev_priv(qs->netdev);2925 struct port_info *pi = netdev_priv(qs->netdev);
2860 struct adapter *adap = pi->adapter;2926 struct adapter *adap = pi->adapter;
2861 unsigned int tbd[SGE_TXQ_PER_SET] = {0, 0};2927 unsigned int tbd[SGE_TXQ_PER_SET] = {0, 0};
@@ -2893,10 +2959,10 @@ static void sge_timer_tx(unsigned long data) · 31 unmodified lines
2893 * starved.2959 * starved.
2894 *2960 *
2895 */2961 */
2896static void sge_timer_rx(unsigned long data)2962static void sge_timer_rx(struct timer_list *t)
2897{2963{
2898 spinlock_t *lock;2964 spinlock_t *lock;
2899 struct sge_qset *qs = (struct sge_qset *)data;2965 struct sge_qset *qs = from_timer(qs, t, rx_reclaim_timer);
2900 struct port_info *pi = netdev_priv(qs->netdev);2966 struct port_info *pi = netdev_priv(qs->netdev);
2901 struct adapter *adap = pi->adapter;2967 struct adapter *adap = pi->adapter;
2902 u32 status;2968 u32 status;
@@ -2976,8 +3042,8 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, · 73 unmodified lines
2976 struct sge_qset *q = &adapter->sge.qs[id];3042 struct sge_qset *q = &adapter->sge.qs[id];
2977 3043
2978 init_qset_cntxt(q, id);3044 init_qset_cntxt(q, id);
2979 setup_timer(&q->tx_reclaim_timer, sge_timer_tx, (unsigned long)q);3045 timer_setup(&q->tx_reclaim_timer, sge_timer_tx, 0);
2980 setup_timer(&q->rx_reclaim_timer, sge_timer_rx, (unsigned long)q);3046 timer_setup(&q->rx_reclaim_timer, sge_timer_rx, 0);
2981 3047
2982 q->fl[0].desc = alloc_ring(adapter->pdev, p->fl_size,3048 q->fl[0].desc = alloc_ring(adapter->pdev, p->fl_size,
2983 sizeof(struct rx_desc),3049 sizeof(struct rx_desc),
drivers/net/ethernet/chelsio/cxgb4/Makefile+4−1
@@ -5,7 +5,10 @@ · 4 unmodified lines
5 5
6obj-$(CONFIG_CHELSIO_T4) += cxgb4.o6obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
7 7
8cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o cxgb4_ptp.o8cxgb4-objs := cxgb4_main.o l2t.o smt.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o \
9 cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \
10 cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o \
11 cudbg_common.o cudbg_lib.o
9cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o12cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o
10cxgb4-$(CONFIG_CHELSIO_T4_FCOE) += cxgb4_fcoe.o13cxgb4-$(CONFIG_CHELSIO_T4_FCOE) += cxgb4_fcoe.o
11cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o14cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o
drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c+6−7
@@ -96,7 +96,8 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) · 95 unmodified lines
96 if (!ret) {96 if (!ret) {
97 ce = cte;97 ce = cte;
98 read_unlock_bh(&ctbl->lock);98 read_unlock_bh(&ctbl->lock);
99 goto found;99 refcount_inc(&ce->refcnt);
100 return 0;
100 }101 }
101 }102 }
102 read_unlock_bh(&ctbl->lock);103 read_unlock_bh(&ctbl->lock);
@@ -108,7 +109,7 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) · 5 unmodified lines
108 list_del(&ce->list);109 list_del(&ce->list);
109 INIT_LIST_HEAD(&ce->list);110 INIT_LIST_HEAD(&ce->list);
110 spin_lock_init(&ce->lock);111 spin_lock_init(&ce->lock);
111 atomic_set(&ce->refcnt, 0);112 refcount_set(&ce->refcnt, 0);
112 atomic_dec(&ctbl->nfree);113 atomic_dec(&ctbl->nfree);
113 list_add_tail(&ce->list, &ctbl->hash_list[hash]);114 list_add_tail(&ce->list, &ctbl->hash_list[hash]);
114 if (v6) {115 if (v6) {
@@ -138,9 +139,7 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) · 23 unmodified lines
138 return -ENOMEM;139 return -ENOMEM;
139 }140 }
140 write_unlock_bh(&ctbl->lock);141 write_unlock_bh(&ctbl->lock);
141found:142 refcount_set(&ce->refcnt, 1);
142 atomic_inc(&ce->refcnt);
143
144 return 0;143 return 0;
145}144}
146EXPORT_SYMBOL(cxgb4_clip_get);145EXPORT_SYMBOL(cxgb4_clip_get);
@@ -179,7 +178,7 @@ void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6) · 32 unmodified lines
179found:178found:
180 write_lock_bh(&ctbl->lock);179 write_lock_bh(&ctbl->lock);
181 spin_lock_bh(&ce->lock);180 spin_lock_bh(&ce->lock);
182 if (atomic_dec_and_test(&ce->refcnt)) {181 if (refcount_dec_and_test(&ce->refcnt)) {
183 list_del(&ce->list);182 list_del(&ce->list);
184 INIT_LIST_HEAD(&ce->list);183 INIT_LIST_HEAD(&ce->list);
185 list_add_tail(&ce->list, &ctbl->ce_free_head);184 list_add_tail(&ce->list, &ctbl->ce_free_head);
@@ -266,7 +265,7 @@ int clip_tbl_show(struct seq_file *seq, void *v) · 80 unmodified lines
266 ip[0] = '\0';265 ip[0] = '\0';
267 sprintf(ip, "%pISc", &ce->addr);266 sprintf(ip, "%pISc", &ce->addr);
268 seq_printf(seq, "%-25s %u\n", ip,267 seq_printf(seq, "%-25s %u\n", ip,
269 atomic_read(&ce->refcnt));268 refcount_read(&ce->refcnt));
270 }269 }
271 }270 }
272 seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree));271 seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree));
drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h+3−1
@@ -10,9 +10,11 @@ · 9 unmodified lines
10 * release for licensing terms and conditions.10 * release for licensing terms and conditions.
11 */11 */
12 12
13#include <linux/refcount.h>
14
13struct clip_entry {15struct clip_entry {
14 spinlock_t lock; /* Hold while modifying clip reference */16 spinlock_t lock; /* Hold while modifying clip reference */
15 atomic_t refcnt;17 refcount_t refcnt;
16 struct list_head list;18 struct list_head list;
17 union {19 union {
18 struct sockaddr_in addr;20 struct sockaddr_in addr;
drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c+54−0
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 */
17
18#include "cxgb4.h"
19#include "cudbg_if.h"
20#include "cudbg_lib_common.h"
21
22int cudbg_get_buff(struct cudbg_buffer *pdbg_buff, u32 size,
23 struct cudbg_buffer *pin_buff)
24{
25 u32 offset;
26
27 offset = pdbg_buff->offset;
28 if (offset + size > pdbg_buff->size)
29 return CUDBG_STATUS_NO_MEM;
30
31 pin_buff->data = (char *)pdbg_buff->data + offset;
32 pin_buff->offset = offset;
33 pin_buff->size = size;
34 pdbg_buff->size -= size;
35 return 0;
36}
37
38void cudbg_put_buff(struct cudbg_buffer *pin_buff,
39 struct cudbg_buffer *pdbg_buff)
40{
41 pdbg_buff->size += pin_buff->size;
42 pin_buff->data = NULL;
43 pin_buff->offset = 0;
44 pin_buff->size = 0;
45}
46
47void cudbg_update_buff(struct cudbg_buffer *pin_buff,
48 struct cudbg_buffer *pout_buff)
49{
50 /* We already write to buffer provided by ethool, so just
51 * increment offset to next free space.
52 */
53 pout_buff->offset += pin_buff->size;
54}
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h+384−0
@@ -0,0 +1,384 @@
1/*
2 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 */
17
18#ifndef __CUDBG_ENTITY_H__
19#define __CUDBG_ENTITY_H__
20
21#define EDC0_FLAG 3
22#define EDC1_FLAG 4
23
24#define CUDBG_ENTITY_SIGNATURE 0xCCEDB001
25
26struct card_mem {
27 u16 size_edc0;
28 u16 size_edc1;
29 u16 mem_flag;
30};
31
32struct cudbg_mbox_log {
33 struct mbox_cmd entry;
34 u32 hi[MBOX_LEN / 8];
35 u32 lo[MBOX_LEN / 8];
36};
37
38struct cudbg_cim_qcfg {
39 u8 chip;
40 u16 base[CIM_NUM_IBQ + CIM_NUM_OBQ_T5];
41 u16 size[CIM_NUM_IBQ + CIM_NUM_OBQ_T5];
42 u16 thres[CIM_NUM_IBQ];
43 u32 obq_wr[2 * CIM_NUM_OBQ_T5];
44 u32 stat[4 * (CIM_NUM_IBQ + CIM_NUM_OBQ_T5)];
45};
46
47struct cudbg_rss_vf_conf {
48 u32 rss_vf_vfl;
49 u32 rss_vf_vfh;
50};
51
52struct cudbg_pm_stats {
53 u32 tx_cnt[T6_PM_NSTATS];
54 u32 rx_cnt[T6_PM_NSTATS];
55 u64 tx_cyc[T6_PM_NSTATS];
56 u64 rx_cyc[T6_PM_NSTATS];
57};
58
59struct cudbg_hw_sched {
60 u32 kbps[NTX_SCHED];
61 u32 ipg[NTX_SCHED];
62 u32 pace_tab[NTX_SCHED];
63 u32 mode;
64 u32 map;
65};
66
67struct ireg_field {
68 u32 ireg_addr;
69 u32 ireg_data;
70 u32 ireg_local_offset;
71 u32 ireg_offset_range;
72};
73
74struct ireg_buf {
75 struct ireg_field tp_pio;
76 u32 outbuf[32];
77};
78
79struct cudbg_ulprx_la {
80 u32 data[ULPRX_LA_SIZE * 8];
81 u32 size;
82};
83
84struct cudbg_tp_la {
85 u32 size;
86 u32 mode;
87 u8 data[0];
88};
89
90struct cudbg_cim_pif_la {
91 int size;
92 u8 data[0];
93};
94
95struct cudbg_clk_info {
96 u64 retransmit_min;
97 u64 retransmit_max;
98 u64 persist_timer_min;
99 u64 persist_timer_max;
100 u64 keepalive_idle_timer;
101 u64 keepalive_interval;
102 u64 initial_srtt;
103 u64 finwait2_timer;
104 u32 dack_timer;
105 u32 res;
106 u32 cclk_ps;
107 u32 tre;
108 u32 dack_re;
109};
110
111struct cudbg_tid_info_region {
112 u32 ntids;
113 u32 nstids;
114 u32 stid_base;
115 u32 hash_base;
116
117 u32 natids;
118 u32 nftids;
119 u32 ftid_base;
120 u32 aftid_base;
121 u32 aftid_end;
122
123 u32 sftid_base;
124 u32 nsftids;
125
126 u32 uotid_base;
127 u32 nuotids;
128
129 u32 sb;
130 u32 flags;
131 u32 le_db_conf;
132 u32 ip_users;
133 u32 ipv6_users;
134
135 u32 hpftid_base;
136 u32 nhpftids;
137};
138
139#define CUDBG_TID_INFO_REV 1
140
141struct cudbg_tid_info_region_rev1 {
142 struct cudbg_ver_hdr ver_hdr;
143 struct cudbg_tid_info_region tid;
144 u32 tid_start;
145 u32 reserved[16];
146};
147
148#define CUDBG_MAX_FL_QIDS 1024
149
150struct cudbg_ch_cntxt {
151 u32 cntxt_type;
152 u32 cntxt_id;
153 u32 data[SGE_CTXT_SIZE / 4];
154};
155
156#define CUDBG_MAX_RPLC_SIZE 128
157
158struct cudbg_mps_tcam {
159 u64 mask;
160 u32 rplc[8];
161 u32 idx;
162 u32 cls_lo;
163 u32 cls_hi;
164 u32 rplc_size;
165 u32 vniy;
166 u32 vnix;
167 u32 dip_hit;
168 u32 vlan_vld;
169 u32 repli;
170 u16 ivlan;
171 u8 addr[ETH_ALEN];
172 u8 lookup_type;
173 u8 port_num;
174 u8 reserved[2];
175};
176
177#define CUDBG_VPD_PF_SIZE 0x800
178#define CUDBG_SCFG_VER_ADDR 0x06
179#define CUDBG_SCFG_VER_LEN 4
180#define CUDBG_VPD_VER_ADDR 0x18c7
181#define CUDBG_VPD_VER_LEN 2
182
183struct cudbg_vpd_data {
184 u8 sn[SERNUM_LEN + 1];
185 u8 bn[PN_LEN + 1];
186 u8 na[MACADDR_LEN + 1];
187 u8 mn[ID_LEN + 1];
188 u16 fw_major;
189 u16 fw_minor;
190 u16 fw_micro;
191 u16 fw_build;
192 u32 scfg_vers;
193 u32 vpd_vers;
194};
195
196#define CUDBG_MAX_TCAM_TID 0x800
197
198enum cudbg_le_entry_types {
199 LE_ET_UNKNOWN = 0,
200 LE_ET_TCAM_CON = 1,
201 LE_ET_TCAM_SERVER = 2,
202 LE_ET_TCAM_FILTER = 3,
203 LE_ET_TCAM_CLIP = 4,
204 LE_ET_TCAM_ROUTING = 5,
205 LE_ET_HASH_CON = 6,
206 LE_ET_INVALID_TID = 8,
207};
208
209struct cudbg_tcam {
210 u32 filter_start;
211 u32 server_start;
212 u32 clip_start;
213 u32 routing_start;
214 u32 tid_hash_base;
215 u32 max_tid;
216};
217
218struct cudbg_tid_data {
219 u32 tid;
220 u32 dbig_cmd;
221 u32 dbig_conf;
222 u32 dbig_rsp_stat;
223 u32 data[NUM_LE_DB_DBGI_RSP_DATA_INSTANCES];
224};
225
226#define CUDBG_NUM_ULPTX 11
227#define CUDBG_NUM_ULPTX_READ 512
228
229struct cudbg_ulptx_la {
230 u32 rdptr[CUDBG_NUM_ULPTX];
231 u32 wrptr[CUDBG_NUM_ULPTX];
232 u32 rddata[CUDBG_NUM_ULPTX];
233 u32 rd_data[CUDBG_NUM_ULPTX][CUDBG_NUM_ULPTX_READ];
234};
235
236#define CUDBG_CHAC_PBT_ADDR 0x2800
237#define CUDBG_CHAC_PBT_LRF 0x3000
238#define CUDBG_CHAC_PBT_DATA 0x3800
239#define CUDBG_PBT_DYNAMIC_ENTRIES 8
240#define CUDBG_PBT_STATIC_ENTRIES 16
241#define CUDBG_LRF_ENTRIES 8
242#define CUDBG_PBT_DATA_ENTRIES 512
243
244struct cudbg_pbt_tables {
245 u32 pbt_dynamic[CUDBG_PBT_DYNAMIC_ENTRIES];
246 u32 pbt_static[CUDBG_PBT_STATIC_ENTRIES];
247 u32 lrf_table[CUDBG_LRF_ENTRIES];
248 u32 pbt_data[CUDBG_PBT_DATA_ENTRIES];
249};
250
251#define IREG_NUM_ELEM 4
252
253static const u32 t6_tp_pio_array[][IREG_NUM_ELEM] = {
254 {0x7e40, 0x7e44, 0x020, 28}, /* t6_tp_pio_regs_20_to_3b */
255 {0x7e40, 0x7e44, 0x040, 10}, /* t6_tp_pio_regs_40_to_49 */
256 {0x7e40, 0x7e44, 0x050, 10}, /* t6_tp_pio_regs_50_to_59 */
257 {0x7e40, 0x7e44, 0x060, 14}, /* t6_tp_pio_regs_60_to_6d */
258 {0x7e40, 0x7e44, 0x06F, 1}, /* t6_tp_pio_regs_6f */
259 {0x7e40, 0x7e44, 0x070, 6}, /* t6_tp_pio_regs_70_to_75 */
260 {0x7e40, 0x7e44, 0x130, 18}, /* t6_tp_pio_regs_130_to_141 */
261 {0x7e40, 0x7e44, 0x145, 19}, /* t6_tp_pio_regs_145_to_157 */
262 {0x7e40, 0x7e44, 0x160, 1}, /* t6_tp_pio_regs_160 */
263 {0x7e40, 0x7e44, 0x230, 25}, /* t6_tp_pio_regs_230_to_248 */
264 {0x7e40, 0x7e44, 0x24a, 3}, /* t6_tp_pio_regs_24c */
265 {0x7e40, 0x7e44, 0x8C0, 1} /* t6_tp_pio_regs_8c0 */
266};
267
268static const u32 t5_tp_pio_array[][IREG_NUM_ELEM] = {
269 {0x7e40, 0x7e44, 0x020, 28}, /* t5_tp_pio_regs_20_to_3b */
270 {0x7e40, 0x7e44, 0x040, 19}, /* t5_tp_pio_regs_40_to_52 */
271 {0x7e40, 0x7e44, 0x054, 2}, /* t5_tp_pio_regs_54_to_55 */
272 {0x7e40, 0x7e44, 0x060, 13}, /* t5_tp_pio_regs_60_to_6c */
273 {0x7e40, 0x7e44, 0x06F, 1}, /* t5_tp_pio_regs_6f */
274 {0x7e40, 0x7e44, 0x120, 4}, /* t5_tp_pio_regs_120_to_123 */
275 {0x7e40, 0x7e44, 0x12b, 2}, /* t5_tp_pio_regs_12b_to_12c */
276 {0x7e40, 0x7e44, 0x12f, 21}, /* t5_tp_pio_regs_12f_to_143 */
277 {0x7e40, 0x7e44, 0x145, 19}, /* t5_tp_pio_regs_145_to_157 */
278 {0x7e40, 0x7e44, 0x230, 25}, /* t5_tp_pio_regs_230_to_248 */
279 {0x7e40, 0x7e44, 0x8C0, 1} /* t5_tp_pio_regs_8c0 */
280};
281
282static const u32 t6_tp_tm_pio_array[][IREG_NUM_ELEM] = {
283 {0x7e18, 0x7e1c, 0x0, 12}
284};
285
286static const u32 t5_tp_tm_pio_array[][IREG_NUM_ELEM] = {
287 {0x7e18, 0x7e1c, 0x0, 12}
288};
289
290static const u32 t6_tp_mib_index_array[6][IREG_NUM_ELEM] = {
291 {0x7e50, 0x7e54, 0x0, 13},
292 {0x7e50, 0x7e54, 0x10, 6},
293 {0x7e50, 0x7e54, 0x18, 21},
294 {0x7e50, 0x7e54, 0x30, 32},
295 {0x7e50, 0x7e54, 0x50, 22},
296 {0x7e50, 0x7e54, 0x68, 12}
297};
298
299static const u32 t5_tp_mib_index_array[9][IREG_NUM_ELEM] = {
300 {0x7e50, 0x7e54, 0x0, 13},
301 {0x7e50, 0x7e54, 0x10, 6},
302 {0x7e50, 0x7e54, 0x18, 8},
303 {0x7e50, 0x7e54, 0x20, 13},
304 {0x7e50, 0x7e54, 0x30, 16},
305 {0x7e50, 0x7e54, 0x40, 16},
306 {0x7e50, 0x7e54, 0x50, 16},
307 {0x7e50, 0x7e54, 0x60, 6},
308 {0x7e50, 0x7e54, 0x68, 4}
309};
310
311static const u32 t5_sge_dbg_index_array[2][IREG_NUM_ELEM] = {
312 {0x10cc, 0x10d0, 0x0, 16},
313 {0x10cc, 0x10d4, 0x0, 16},
314};
315
316static const u32 t5_pcie_pdbg_array[][IREG_NUM_ELEM] = {
317 {0x5a04, 0x5a0c, 0x00, 0x20}, /* t5_pcie_pdbg_regs_00_to_20 */
318 {0x5a04, 0x5a0c, 0x21, 0x20}, /* t5_pcie_pdbg_regs_21_to_40 */
319 {0x5a04, 0x5a0c, 0x41, 0x10}, /* t5_pcie_pdbg_regs_41_to_50 */
320};
321
322static const u32 t5_pcie_cdbg_array[][IREG_NUM_ELEM] = {
323 {0x5a10, 0x5a18, 0x00, 0x20}, /* t5_pcie_cdbg_regs_00_to_20 */
324 {0x5a10, 0x5a18, 0x21, 0x18}, /* t5_pcie_cdbg_regs_21_to_37 */
325};
326
327static const u32 t5_pm_rx_array[][IREG_NUM_ELEM] = {
328 {0x8FD0, 0x8FD4, 0x10000, 0x20}, /* t5_pm_rx_regs_10000_to_10020 */
329 {0x8FD0, 0x8FD4, 0x10021, 0x0D}, /* t5_pm_rx_regs_10021_to_1002c */
330};
331
332static const u32 t5_pm_tx_array[][IREG_NUM_ELEM] = {
333 {0x8FF0, 0x8FF4, 0x10000, 0x20}, /* t5_pm_tx_regs_10000_to_10020 */
334 {0x8FF0, 0x8FF4, 0x10021, 0x1D}, /* t5_pm_tx_regs_10021_to_1003c */
335};
336
337static const u32 t6_ma_ireg_array[][IREG_NUM_ELEM] = {
338 {0x78f8, 0x78fc, 0xa000, 23}, /* t6_ma_regs_a000_to_a016 */
339 {0x78f8, 0x78fc, 0xa400, 30}, /* t6_ma_regs_a400_to_a41e */
340 {0x78f8, 0x78fc, 0xa800, 20} /* t6_ma_regs_a800_to_a813 */
341};
342
343static const u32 t6_ma_ireg_array2[][IREG_NUM_ELEM] = {
344 {0x78f8, 0x78fc, 0xe400, 17}, /* t6_ma_regs_e400_to_e600 */
345 {0x78f8, 0x78fc, 0xe640, 13} /* t6_ma_regs_e640_to_e7c0 */
346};
347
348static const u32 t6_up_cim_reg_array[][IREG_NUM_ELEM] = {
349 {0x7b50, 0x7b54, 0x2000, 0x20}, /* up_cim_2000_to_207c */
350 {0x7b50, 0x7b54, 0x2080, 0x1d}, /* up_cim_2080_to_20fc */
351 {0x7b50, 0x7b54, 0x00, 0x20}, /* up_cim_00_to_7c */
352 {0x7b50, 0x7b54, 0x80, 0x20}, /* up_cim_80_to_fc */
353 {0x7b50, 0x7b54, 0x100, 0x11}, /* up_cim_100_to_14c */
354 {0x7b50, 0x7b54, 0x200, 0x10}, /* up_cim_200_to_23c */
355 {0x7b50, 0x7b54, 0x240, 0x2}, /* up_cim_240_to_244 */
356 {0x7b50, 0x7b54, 0x250, 0x2}, /* up_cim_250_to_254 */
357 {0x7b50, 0x7b54, 0x260, 0x2}, /* up_cim_260_to_264 */
358 {0x7b50, 0x7b54, 0x270, 0x2}, /* up_cim_270_to_274 */
359 {0x7b50, 0x7b54, 0x280, 0x20}, /* up_cim_280_to_2fc */
360 {0x7b50, 0x7b54, 0x300, 0x20}, /* up_cim_300_to_37c */
361 {0x7b50, 0x7b54, 0x380, 0x14}, /* up_cim_380_to_3cc */
362
363};
364
365static const u32 t5_up_cim_reg_array[][IREG_NUM_ELEM] = {
366 {0x7b50, 0x7b54, 0x2000, 0x20}, /* up_cim_2000_to_207c */
367 {0x7b50, 0x7b54, 0x2080, 0x19}, /* up_cim_2080_to_20ec */
368 {0x7b50, 0x7b54, 0x00, 0x20}, /* up_cim_00_to_7c */
369 {0x7b50, 0x7b54, 0x80, 0x20}, /* up_cim_80_to_fc */
370 {0x7b50, 0x7b54, 0x100, 0x11}, /* up_cim_100_to_14c */
371 {0x7b50, 0x7b54, 0x200, 0x10}, /* up_cim_200_to_23c */
372 {0x7b50, 0x7b54, 0x240, 0x2}, /* up_cim_240_to_244 */
373 {0x7b50, 0x7b54, 0x250, 0x2}, /* up_cim_250_to_254 */
374 {0x7b50, 0x7b54, 0x260, 0x2}, /* up_cim_260_to_264 */
375 {0x7b50, 0x7b54, 0x270, 0x2}, /* up_cim_270_to_274 */
376 {0x7b50, 0x7b54, 0x280, 0x20}, /* up_cim_280_to_2fc */
377 {0x7b50, 0x7b54, 0x300, 0x20}, /* up_cim_300_to_37c */
378 {0x7b50, 0x7b54, 0x380, 0x14}, /* up_cim_380_to_3cc */
379};
380
381static const u32 t6_hma_ireg_array[][IREG_NUM_ELEM] = {
382 {0x51320, 0x51324, 0xa000, 32} /* t6_hma_regs_a000_to_a01f */
383};
384#endif /* __CUDBG_ENTITY_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h+90−0
@@ -0,0 +1,90 @@
1/*
2 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 */
17
18#ifndef __CUDBG_IF_H__
19#define __CUDBG_IF_H__
20
21/* Error codes */
22#define CUDBG_STATUS_NO_MEM -19
23#define CUDBG_STATUS_ENTITY_NOT_FOUND -24
24#define CUDBG_SYSTEM_ERROR -29
25#define CUDBG_STATUS_CCLK_NOT_DEFINED -32
26
27#define CUDBG_MAJOR_VERSION 1
28#define CUDBG_MINOR_VERSION 14
29
30enum cudbg_dbg_entity_type {
31 CUDBG_REG_DUMP = 1,
32 CUDBG_DEV_LOG = 2,
33 CUDBG_CIM_LA = 3,
34 CUDBG_CIM_MA_LA = 4,
35 CUDBG_CIM_QCFG = 5,
36 CUDBG_CIM_IBQ_TP0 = 6,
37 CUDBG_CIM_IBQ_TP1 = 7,
38 CUDBG_CIM_IBQ_ULP = 8,
39 CUDBG_CIM_IBQ_SGE0 = 9,
40 CUDBG_CIM_IBQ_SGE1 = 10,
41 CUDBG_CIM_IBQ_NCSI = 11,
42 CUDBG_CIM_OBQ_ULP0 = 12,
43 CUDBG_CIM_OBQ_ULP1 = 13,
44 CUDBG_CIM_OBQ_ULP2 = 14,
45 CUDBG_CIM_OBQ_ULP3 = 15,
46 CUDBG_CIM_OBQ_SGE = 16,
47 CUDBG_CIM_OBQ_NCSI = 17,
48 CUDBG_EDC0 = 18,
49 CUDBG_EDC1 = 19,
50 CUDBG_RSS = 22,
51 CUDBG_RSS_VF_CONF = 25,
52 CUDBG_PATH_MTU = 27,
53 CUDBG_PM_STATS = 30,
54 CUDBG_HW_SCHED = 31,
55 CUDBG_TP_INDIRECT = 36,
56 CUDBG_SGE_INDIRECT = 37,
57 CUDBG_ULPRX_LA = 41,
58 CUDBG_TP_LA = 43,
59 CUDBG_CIM_PIF_LA = 45,
60 CUDBG_CLK = 46,
61 CUDBG_CIM_OBQ_RXQ0 = 47,
62 CUDBG_CIM_OBQ_RXQ1 = 48,
63 CUDBG_PCIE_INDIRECT = 50,
64 CUDBG_PM_INDIRECT = 51,
65 CUDBG_TID_INFO = 54,
66 CUDBG_DUMP_CONTEXT = 56,
67 CUDBG_MPS_TCAM = 57,
68 CUDBG_VPD_DATA = 58,
69 CUDBG_LE_TCAM = 59,
70 CUDBG_CCTRL = 60,
71 CUDBG_MA_INDIRECT = 61,
72 CUDBG_ULPTX_LA = 62,
73 CUDBG_UP_CIM_INDIRECT = 64,
74 CUDBG_PBT_TABLE = 65,
75 CUDBG_MBOX_LOG = 66,
76 CUDBG_HMA_INDIRECT = 67,
77 CUDBG_MAX_ENTITY = 70,
78};
79
80struct cudbg_init {
81 struct adapter *adap; /* Pointer to adapter structure */
82 void *outbuf; /* Output buffer */
83 u32 outbuf_size; /* Output buffer size */
84};
85
86static inline unsigned int cudbg_mbytes_to_bytes(unsigned int size)
87{
88 return size * 1024 * 1024;
89}
90#endif /* __CUDBG_IF_H__ */
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c+1929−0
@@ -0,0 +1,1929 @@
1/*
2 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 */
17
18#include "t4_regs.h"
19#include "cxgb4.h"
20#include "cudbg_if.h"
21#include "cudbg_lib_common.h"
22#include "cudbg_lib.h"
23#include "cudbg_entity.h"
24
25static void cudbg_write_and_release_buff(struct cudbg_buffer *pin_buff,
26 struct cudbg_buffer *dbg_buff)
27{
28 cudbg_update_buff(pin_buff, dbg_buff);
29 cudbg_put_buff(pin_buff, dbg_buff);
30}
31
32static int is_fw_attached(struct cudbg_init *pdbg_init)
33{
34 struct adapter *padap = pdbg_init->adap;
35
36 if (!(padap->flags & FW_OK) || padap->use_bd)
37 return 0;
38
39 return 1;
40}
41
42/* This function will add additional padding bytes into debug_buffer to make it
43 * 4 byte aligned.
44 */
45void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
46 struct cudbg_entity_hdr *entity_hdr)
47{
48 u8 zero_buf[4] = {0};
49 u8 padding, remain;
50
51 remain = (dbg_buff->offset - entity_hdr->start_offset) % 4;
52 padding = 4 - remain;
53 if (remain) {
54 memcpy(((u8 *)dbg_buff->data) + dbg_buff->offset, &zero_buf,
55 padding);
56 dbg_buff->offset += padding;
57 entity_hdr->num_pad = padding;
58 }
59 entity_hdr->size = dbg_buff->offset - entity_hdr->start_offset;
60}
61
62struct cudbg_entity_hdr *cudbg_get_entity_hdr(void *outbuf, int i)
63{
64 struct cudbg_hdr *cudbg_hdr = (struct cudbg_hdr *)outbuf;
65
66 return (struct cudbg_entity_hdr *)
67 ((char *)outbuf + cudbg_hdr->hdr_len +
68 (sizeof(struct cudbg_entity_hdr) * (i - 1)));
69}
70
71static int cudbg_read_vpd_reg(struct adapter *padap, u32 addr, u32 len,
72 void *dest)
73{
74 int vaddr, rc;
75
76 vaddr = t4_eeprom_ptov(addr, padap->pf, EEPROMPFSIZE);
77 if (vaddr < 0)
78 return vaddr;
79
80 rc = pci_read_vpd(padap->pdev, vaddr, len, dest);
81 if (rc < 0)
82 return rc;
83
84 return 0;
85}
86
87int cudbg_collect_reg_dump(struct cudbg_init *pdbg_init,
88 struct cudbg_buffer *dbg_buff,
89 struct cudbg_error *cudbg_err)
90{
91 struct adapter *padap = pdbg_init->adap;
92 struct cudbg_buffer temp_buff = { 0 };
93 u32 buf_size = 0;
94 int rc = 0;
95
96 if (is_t4(padap->params.chip))
97 buf_size = T4_REGMAP_SIZE;
98 else if (is_t5(padap->params.chip) || is_t6(padap->params.chip))
99 buf_size = T5_REGMAP_SIZE;
100
101 rc = cudbg_get_buff(dbg_buff, buf_size, &temp_buff);
102 if (rc)
103 return rc;
104 t4_get_regs(padap, (void *)temp_buff.data, temp_buff.size);
105 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
106 return rc;
107}
108
109int cudbg_collect_fw_devlog(struct cudbg_init *pdbg_init,
110 struct cudbg_buffer *dbg_buff,
111 struct cudbg_error *cudbg_err)
112{
113 struct adapter *padap = pdbg_init->adap;
114 struct cudbg_buffer temp_buff = { 0 };
115 struct devlog_params *dparams;
116 int rc = 0;
117
118 rc = t4_init_devlog_params(padap);
119 if (rc < 0) {
120 cudbg_err->sys_err = rc;
121 return rc;
122 }
123
124 dparams = &padap->params.devlog;
125 rc = cudbg_get_buff(dbg_buff, dparams->size, &temp_buff);
126 if (rc)
127 return rc;
128
129 /* Collect FW devlog */
130 if (dparams->start != 0) {
131 spin_lock(&padap->win0_lock);
132 rc = t4_memory_rw(padap, padap->params.drv_memwin,
133 dparams->memtype, dparams->start,
134 dparams->size,
135 (__be32 *)(char *)temp_buff.data,
136 1);
137 spin_unlock(&padap->win0_lock);
138 if (rc) {
139 cudbg_err->sys_err = rc;
140 cudbg_put_buff(&temp_buff, dbg_buff);
141 return rc;
142 }
143 }
144 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
145 return rc;
146}
147
148int cudbg_collect_cim_la(struct cudbg_init *pdbg_init,
149 struct cudbg_buffer *dbg_buff,
150 struct cudbg_error *cudbg_err)
151{
152 struct adapter *padap = pdbg_init->adap;
153 struct cudbg_buffer temp_buff = { 0 };
154 int size, rc;
155 u32 cfg = 0;
156
157 if (is_t6(padap->params.chip)) {
158 size = padap->params.cim_la_size / 10 + 1;
159 size *= 11 * sizeof(u32);
160 } else {
161 size = padap->params.cim_la_size / 8;
162 size *= 8 * sizeof(u32);
163 }
164
165 size += sizeof(cfg);
166 rc = cudbg_get_buff(dbg_buff, size, &temp_buff);
167 if (rc)
168 return rc;
169
170 rc = t4_cim_read(padap, UP_UP_DBG_LA_CFG_A, 1, &cfg);
171 if (rc) {
172 cudbg_err->sys_err = rc;
173 cudbg_put_buff(&temp_buff, dbg_buff);
174 return rc;
175 }
176
177 memcpy((char *)temp_buff.data, &cfg, sizeof(cfg));
178 rc = t4_cim_read_la(padap,
179 (u32 *)((char *)temp_buff.data + sizeof(cfg)),
180 NULL);
181 if (rc < 0) {
182 cudbg_err->sys_err = rc;
183 cudbg_put_buff(&temp_buff, dbg_buff);
184 return rc;
185 }
186 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
187 return rc;
188}
189
190int cudbg_collect_cim_ma_la(struct cudbg_init *pdbg_init,
191 struct cudbg_buffer *dbg_buff,
192 struct cudbg_error *cudbg_err)
193{
194 struct adapter *padap = pdbg_init->adap;
195 struct cudbg_buffer temp_buff = { 0 };
196 int size, rc;
197
198 size = 2 * CIM_MALA_SIZE * 5 * sizeof(u32);
199 rc = cudbg_get_buff(dbg_buff, size, &temp_buff);
200 if (rc)
201 return rc;
202
203 t4_cim_read_ma_la(padap,
204 (u32 *)temp_buff.data,
205 (u32 *)((char *)temp_buff.data +
206 5 * CIM_MALA_SIZE));
207 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
208 return rc;
209}
210
211int cudbg_collect_cim_qcfg(struct cudbg_init *pdbg_init,
212 struct cudbg_buffer *dbg_buff,
213 struct cudbg_error *cudbg_err)
214{
215 struct adapter *padap = pdbg_init->adap;
216 struct cudbg_buffer temp_buff = { 0 };
217 struct cudbg_cim_qcfg *cim_qcfg_data;
218 int rc;
219
220 rc = cudbg_get_buff(dbg_buff, sizeof(struct cudbg_cim_qcfg),
221 &temp_buff);
222 if (rc)
223 return rc;
224
225 cim_qcfg_data = (struct cudbg_cim_qcfg *)temp_buff.data;
226 cim_qcfg_data->chip = padap->params.chip;
227 rc = t4_cim_read(padap, UP_IBQ_0_RDADDR_A,
228 ARRAY_SIZE(cim_qcfg_data->stat), cim_qcfg_data->stat);
229 if (rc) {
230 cudbg_err->sys_err = rc;
231 cudbg_put_buff(&temp_buff, dbg_buff);
232 return rc;
233 }
234
235 rc = t4_cim_read(padap, UP_OBQ_0_REALADDR_A,
236 ARRAY_SIZE(cim_qcfg_data->obq_wr),
237 cim_qcfg_data->obq_wr);
238 if (rc) {
239 cudbg_err->sys_err = rc;
240 cudbg_put_buff(&temp_buff, dbg_buff);
241 return rc;
242 }
243
244 t4_read_cimq_cfg(padap, cim_qcfg_data->base, cim_qcfg_data->size,
245 cim_qcfg_data->thres);
246 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
247 return rc;
248}
249
250static int cudbg_read_cim_ibq(struct cudbg_init *pdbg_init,
251 struct cudbg_buffer *dbg_buff,
252 struct cudbg_error *cudbg_err, int qid)
253{
254 struct adapter *padap = pdbg_init->adap;
255 struct cudbg_buffer temp_buff = { 0 };
256 int no_of_read_words, rc = 0;
257 u32 qsize;
258
259 /* collect CIM IBQ */
260 qsize = CIM_IBQ_SIZE * 4 * sizeof(u32);
261 rc = cudbg_get_buff(dbg_buff, qsize, &temp_buff);
262 if (rc)
263 return rc;
264
265 /* t4_read_cim_ibq will return no. of read words or error */
266 no_of_read_words = t4_read_cim_ibq(padap, qid,
267 (u32 *)temp_buff.data, qsize);
268 /* no_of_read_words is less than or equal to 0 means error */
269 if (no_of_read_words <= 0) {
270 if (!no_of_read_words)
271 rc = CUDBG_SYSTEM_ERROR;
272 else
273 rc = no_of_read_words;
274 cudbg_err->sys_err = rc;
275 cudbg_put_buff(&temp_buff, dbg_buff);
276 return rc;
277 }
278 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
279 return rc;
280}
281
282int cudbg_collect_cim_ibq_tp0(struct cudbg_init *pdbg_init,
283 struct cudbg_buffer *dbg_buff,
284 struct cudbg_error *cudbg_err)
285{
286 return cudbg_read_cim_ibq(pdbg_init, dbg_buff, cudbg_err, 0);
287}
288
289int cudbg_collect_cim_ibq_tp1(struct cudbg_init *pdbg_init,
290 struct cudbg_buffer *dbg_buff,
291 struct cudbg_error *cudbg_err)
292{
293 return cudbg_read_cim_ibq(pdbg_init, dbg_buff, cudbg_err, 1);
294}
295
296int cudbg_collect_cim_ibq_ulp(struct cudbg_init *pdbg_init,
297 struct cudbg_buffer *dbg_buff,
298 struct cudbg_error *cudbg_err)
299{
300 return cudbg_read_cim_ibq(pdbg_init, dbg_buff, cudbg_err, 2);
301}
302
303int cudbg_collect_cim_ibq_sge0(struct cudbg_init *pdbg_init,
304 struct cudbg_buffer *dbg_buff,
305 struct cudbg_error *cudbg_err)
306{
307 return cudbg_read_cim_ibq(pdbg_init, dbg_buff, cudbg_err, 3);
308}
309
310int cudbg_collect_cim_ibq_sge1(struct cudbg_init *pdbg_init,
311 struct cudbg_buffer *dbg_buff,
312 struct cudbg_error *cudbg_err)
313{
314 return cudbg_read_cim_ibq(pdbg_init, dbg_buff, cudbg_err, 4);
315}
316
317int cudbg_collect_cim_ibq_ncsi(struct cudbg_init *pdbg_init,
318 struct cudbg_buffer *dbg_buff,
319 struct cudbg_error *cudbg_err)
320{
321 return cudbg_read_cim_ibq(pdbg_init, dbg_buff, cudbg_err, 5);
322}
323
324u32 cudbg_cim_obq_size(struct adapter *padap, int qid)
325{
326 u32 value;
327
328 t4_write_reg(padap, CIM_QUEUE_CONFIG_REF_A, OBQSELECT_F |
329 QUENUMSELECT_V(qid));
330 value = t4_read_reg(padap, CIM_QUEUE_CONFIG_CTRL_A);
331 value = CIMQSIZE_G(value) * 64; /* size in number of words */
332 return value * sizeof(u32);
333}
334
335static int cudbg_read_cim_obq(struct cudbg_init *pdbg_init,
336 struct cudbg_buffer *dbg_buff,
337 struct cudbg_error *cudbg_err, int qid)
338{
339 struct adapter *padap = pdbg_init->adap;
340 struct cudbg_buffer temp_buff = { 0 };
341 int no_of_read_words, rc = 0;
342 u32 qsize;
343
344 /* collect CIM OBQ */
345 qsize = cudbg_cim_obq_size(padap, qid);
346 rc = cudbg_get_buff(dbg_buff, qsize, &temp_buff);
347 if (rc)
348 return rc;
349
350 /* t4_read_cim_obq will return no. of read words or error */
351 no_of_read_words = t4_read_cim_obq(padap, qid,
352 (u32 *)temp_buff.data, qsize);
353 /* no_of_read_words is less than or equal to 0 means error */
354 if (no_of_read_words <= 0) {
355 if (!no_of_read_words)
356 rc = CUDBG_SYSTEM_ERROR;
357 else
358 rc = no_of_read_words;
359 cudbg_err->sys_err = rc;
360 cudbg_put_buff(&temp_buff, dbg_buff);
361 return rc;
362 }
363 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
364 return rc;
365}
366
367int cudbg_collect_cim_obq_ulp0(struct cudbg_init *pdbg_init,
368 struct cudbg_buffer *dbg_buff,
369 struct cudbg_error *cudbg_err)
370{
371 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 0);
372}
373
374int cudbg_collect_cim_obq_ulp1(struct cudbg_init *pdbg_init,
375 struct cudbg_buffer *dbg_buff,
376 struct cudbg_error *cudbg_err)
377{
378 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 1);
379}
380
381int cudbg_collect_cim_obq_ulp2(struct cudbg_init *pdbg_init,
382 struct cudbg_buffer *dbg_buff,
383 struct cudbg_error *cudbg_err)
384{
385 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 2);
386}
387
388int cudbg_collect_cim_obq_ulp3(struct cudbg_init *pdbg_init,
389 struct cudbg_buffer *dbg_buff,
390 struct cudbg_error *cudbg_err)
391{
392 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 3);
393}
394
395int cudbg_collect_cim_obq_sge(struct cudbg_init *pdbg_init,
396 struct cudbg_buffer *dbg_buff,
397 struct cudbg_error *cudbg_err)
398{
399 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 4);
400}
401
402int cudbg_collect_cim_obq_ncsi(struct cudbg_init *pdbg_init,
403 struct cudbg_buffer *dbg_buff,
404 struct cudbg_error *cudbg_err)
405{
406 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 5);
407}
408
409int cudbg_collect_obq_sge_rx_q0(struct cudbg_init *pdbg_init,
410 struct cudbg_buffer *dbg_buff,
411 struct cudbg_error *cudbg_err)
412{
413 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 6);
414}
415
416int cudbg_collect_obq_sge_rx_q1(struct cudbg_init *pdbg_init,
417 struct cudbg_buffer *dbg_buff,
418 struct cudbg_error *cudbg_err)
419{
420 return cudbg_read_cim_obq(pdbg_init, dbg_buff, cudbg_err, 7);
421}
422
423static int cudbg_read_fw_mem(struct cudbg_init *pdbg_init,
424 struct cudbg_buffer *dbg_buff, u8 mem_type,
425 unsigned long tot_len,
426 struct cudbg_error *cudbg_err)
427{
428 unsigned long bytes, bytes_left, bytes_read = 0;
429 struct adapter *padap = pdbg_init->adap;
430 struct cudbg_buffer temp_buff = { 0 };
431 int rc = 0;
432
433 bytes_left = tot_len;
434 while (bytes_left > 0) {
435 bytes = min_t(unsigned long, bytes_left,
436 (unsigned long)CUDBG_CHUNK_SIZE);
437 rc = cudbg_get_buff(dbg_buff, bytes, &temp_buff);
438 if (rc)
439 return rc;
440 spin_lock(&padap->win0_lock);
441 rc = t4_memory_rw(padap, MEMWIN_NIC, mem_type,
442 bytes_read, bytes,
443 (__be32 *)temp_buff.data,
444 1);
445 spin_unlock(&padap->win0_lock);
446 if (rc) {
447 cudbg_err->sys_err = rc;
448 cudbg_put_buff(&temp_buff, dbg_buff);
449 return rc;
450 }
451 bytes_left -= bytes;
452 bytes_read += bytes;
453 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
454 }
455 return rc;
456}
457
458static void cudbg_collect_mem_info(struct cudbg_init *pdbg_init,
459 struct card_mem *mem_info)
460{
461 struct adapter *padap = pdbg_init->adap;
462 u32 value;
463
464 value = t4_read_reg(padap, MA_EDRAM0_BAR_A);
465 value = EDRAM0_SIZE_G(value);
466 mem_info->size_edc0 = (u16)value;
467
468 value = t4_read_reg(padap, MA_EDRAM1_BAR_A);
469 value = EDRAM1_SIZE_G(value);
470 mem_info->size_edc1 = (u16)value;
471
472 value = t4_read_reg(padap, MA_TARGET_MEM_ENABLE_A);
473 if (value & EDRAM0_ENABLE_F)
474 mem_info->mem_flag |= (1 << EDC0_FLAG);
475 if (value & EDRAM1_ENABLE_F)
476 mem_info->mem_flag |= (1 << EDC1_FLAG);
477}
478
479static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init,
480 struct cudbg_error *cudbg_err)
481{
482 struct adapter *padap = pdbg_init->adap;
483 int rc;
484
485 if (is_fw_attached(pdbg_init)) {
486 /* Flush uP dcache before reading edcX/mcX */
487 rc = t4_fwcache(padap, FW_PARAM_DEV_FWCACHE_FLUSH);
488 if (rc)
489 cudbg_err->sys_warn = rc;
490 }
491}
492
493static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
494 struct cudbg_buffer *dbg_buff,
495 struct cudbg_error *cudbg_err,
496 u8 mem_type)
497{
498 struct card_mem mem_info = {0};
499 unsigned long flag, size;
500 int rc;
501
502 cudbg_t4_fwcache(pdbg_init, cudbg_err);
503 cudbg_collect_mem_info(pdbg_init, &mem_info);
504 switch (mem_type) {
505 case MEM_EDC0:
506 flag = (1 << EDC0_FLAG);
507 size = cudbg_mbytes_to_bytes(mem_info.size_edc0);
508 break;
509 case MEM_EDC1:
510 flag = (1 << EDC1_FLAG);
511 size = cudbg_mbytes_to_bytes(mem_info.size_edc1);
512 break;
513 default:
514 rc = CUDBG_STATUS_ENTITY_NOT_FOUND;
515 goto err;
516 }
517
518 if (mem_info.mem_flag & flag) {
519 rc = cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type,
520 size, cudbg_err);
521 if (rc)
522 goto err;
523 } else {
524 rc = CUDBG_STATUS_ENTITY_NOT_FOUND;
525 goto err;
526 }
527err:
528 return rc;
529}
530
531int cudbg_collect_edc0_meminfo(struct cudbg_init *pdbg_init,
532 struct cudbg_buffer *dbg_buff,
533 struct cudbg_error *cudbg_err)
534{
535 return cudbg_collect_mem_region(pdbg_init, dbg_buff, cudbg_err,
536 MEM_EDC0);
537}
538
539int cudbg_collect_edc1_meminfo(struct cudbg_init *pdbg_init,
540 struct cudbg_buffer *dbg_buff,
541 struct cudbg_error *cudbg_err)
542{
543 return cudbg_collect_mem_region(pdbg_init, dbg_buff, cudbg_err,
544 MEM_EDC1);
545}
546
547int cudbg_collect_rss(struct cudbg_init *pdbg_init,
548 struct cudbg_buffer *dbg_buff,
549 struct cudbg_error *cudbg_err)
550{
551 struct adapter *padap = pdbg_init->adap;
552 struct cudbg_buffer temp_buff = { 0 };
553 int rc;
554
555 rc = cudbg_get_buff(dbg_buff, RSS_NENTRIES * sizeof(u16), &temp_buff);
556 if (rc)
557 return rc;
558
559 rc = t4_read_rss(padap, (u16 *)temp_buff.data);
560 if (rc) {
561 cudbg_err->sys_err = rc;
562 cudbg_put_buff(&temp_buff, dbg_buff);
563 return rc;
564 }
565 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
566 return rc;
567}
568
569int cudbg_collect_rss_vf_config(struct cudbg_init *pdbg_init,
570 struct cudbg_buffer *dbg_buff,
571 struct cudbg_error *cudbg_err)
572{
573 struct adapter *padap = pdbg_init->adap;
574 struct cudbg_buffer temp_buff = { 0 };
575 struct cudbg_rss_vf_conf *vfconf;
576 int vf, rc, vf_count;
577
578 vf_count = padap->params.arch.vfcount;
579 rc = cudbg_get_buff(dbg_buff,
580 vf_count * sizeof(struct cudbg_rss_vf_conf),
581 &temp_buff);
582 if (rc)
583 return rc;
584
585 vfconf = (struct cudbg_rss_vf_conf *)temp_buff.data;
586 for (vf = 0; vf < vf_count; vf++)
587 t4_read_rss_vf_config(padap, vf, &vfconf[vf].rss_vf_vfl,
588 &vfconf[vf].rss_vf_vfh, true);
589 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
590 return rc;
591}
592
593int cudbg_collect_path_mtu(struct cudbg_init *pdbg_init,
594 struct cudbg_buffer *dbg_buff,
595 struct cudbg_error *cudbg_err)
596{
597 struct adapter *padap = pdbg_init->adap;
598 struct cudbg_buffer temp_buff = { 0 };
599 int rc;
600
601 rc = cudbg_get_buff(dbg_buff, NMTUS * sizeof(u16), &temp_buff);
602 if (rc)
603 return rc;
604
605 t4_read_mtu_tbl(padap, (u16 *)temp_buff.data, NULL);
606 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
607 return rc;
608}
609
610int cudbg_collect_pm_stats(struct cudbg_init *pdbg_init,
611 struct cudbg_buffer *dbg_buff,
612 struct cudbg_error *cudbg_err)
613{
614 struct adapter *padap = pdbg_init->adap;
615 struct cudbg_buffer temp_buff = { 0 };
616 struct cudbg_pm_stats *pm_stats_buff;
617 int rc;
618
619 rc = cudbg_get_buff(dbg_buff, sizeof(struct cudbg_pm_stats),
620 &temp_buff);
621 if (rc)
622 return rc;
623
624 pm_stats_buff = (struct cudbg_pm_stats *)temp_buff.data;
625 t4_pmtx_get_stats(padap, pm_stats_buff->tx_cnt, pm_stats_buff->tx_cyc);
626 t4_pmrx_get_stats(padap, pm_stats_buff->rx_cnt, pm_stats_buff->rx_cyc);
627 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
628 return rc;
629}
630
631int cudbg_collect_hw_sched(struct cudbg_init *pdbg_init,
632 struct cudbg_buffer *dbg_buff,
633 struct cudbg_error *cudbg_err)
634{
635 struct adapter *padap = pdbg_init->adap;
636 struct cudbg_buffer temp_buff = { 0 };
637 struct cudbg_hw_sched *hw_sched_buff;
638 int i, rc = 0;
639
640 if (!padap->params.vpd.cclk)
641 return CUDBG_STATUS_CCLK_NOT_DEFINED;
642
643 rc = cudbg_get_buff(dbg_buff, sizeof(struct cudbg_hw_sched),
644 &temp_buff);
645 hw_sched_buff = (struct cudbg_hw_sched *)temp_buff.data;
646 hw_sched_buff->map = t4_read_reg(padap, TP_TX_MOD_QUEUE_REQ_MAP_A);
647 hw_sched_buff->mode = TIMERMODE_G(t4_read_reg(padap, TP_MOD_CONFIG_A));
648 t4_read_pace_tbl(padap, hw_sched_buff->pace_tab);
649 for (i = 0; i < NTX_SCHED; ++i)
650 t4_get_tx_sched(padap, i, &hw_sched_buff->kbps[i],
651 &hw_sched_buff->ipg[i], true);
652 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
653 return rc;
654}
655
656int cudbg_collect_tp_indirect(struct cudbg_init *pdbg_init,
657 struct cudbg_buffer *dbg_buff,
658 struct cudbg_error *cudbg_err)
659{
660 struct adapter *padap = pdbg_init->adap;
661 struct cudbg_buffer temp_buff = { 0 };
662 struct ireg_buf *ch_tp_pio;
663 int i, rc, n = 0;
664 u32 size;
665
666 if (is_t5(padap->params.chip))
667 n = sizeof(t5_tp_pio_array) +
668 sizeof(t5_tp_tm_pio_array) +
669 sizeof(t5_tp_mib_index_array);
670 else
671 n = sizeof(t6_tp_pio_array) +
672 sizeof(t6_tp_tm_pio_array) +
673 sizeof(t6_tp_mib_index_array);
674
675 n = n / (IREG_NUM_ELEM * sizeof(u32));
676 size = sizeof(struct ireg_buf) * n;
677 rc = cudbg_get_buff(dbg_buff, size, &temp_buff);
678 if (rc)
679 return rc;
680
681 ch_tp_pio = (struct ireg_buf *)temp_buff.data;
682
683 /* TP_PIO */
684 if (is_t5(padap->params.chip))
685 n = sizeof(t5_tp_pio_array) / (IREG_NUM_ELEM * sizeof(u32));
686 else if (is_t6(padap->params.chip))
687 n = sizeof(t6_tp_pio_array) / (IREG_NUM_ELEM * sizeof(u32));
688
689 for (i = 0; i < n; i++) {
690 struct ireg_field *tp_pio = &ch_tp_pio->tp_pio;
691 u32 *buff = ch_tp_pio->outbuf;
692
693 if (is_t5(padap->params.chip)) {
694 tp_pio->ireg_addr = t5_tp_pio_array[i][0];
695 tp_pio->ireg_data = t5_tp_pio_array[i][1];
696 tp_pio->ireg_local_offset = t5_tp_pio_array[i][2];
697 tp_pio->ireg_offset_range = t5_tp_pio_array[i][3];
698 } else if (is_t6(padap->params.chip)) {
699 tp_pio->ireg_addr = t6_tp_pio_array[i][0];
700 tp_pio->ireg_data = t6_tp_pio_array[i][1];
701 tp_pio->ireg_local_offset = t6_tp_pio_array[i][2];
702 tp_pio->ireg_offset_range = t6_tp_pio_array[i][3];
703 }
704 t4_tp_pio_read(padap, buff, tp_pio->ireg_offset_range,
705 tp_pio->ireg_local_offset, true);
706 ch_tp_pio++;
707 }
708
709 /* TP_TM_PIO */
710 if (is_t5(padap->params.chip))
711 n = sizeof(t5_tp_tm_pio_array) / (IREG_NUM_ELEM * sizeof(u32));
712 else if (is_t6(padap->params.chip))
713 n = sizeof(t6_tp_tm_pio_array) / (IREG_NUM_ELEM * sizeof(u32));
714
715 for (i = 0; i < n; i++) {
716 struct ireg_field *tp_pio = &ch_tp_pio->tp_pio;
717 u32 *buff = ch_tp_pio->outbuf;
718
719 if (is_t5(padap->params.chip)) {
720 tp_pio->ireg_addr = t5_tp_tm_pio_array[i][0];
721 tp_pio->ireg_data = t5_tp_tm_pio_array[i][1];
722 tp_pio->ireg_local_offset = t5_tp_tm_pio_array[i][2];
723 tp_pio->ireg_offset_range = t5_tp_tm_pio_array[i][3];
724 } else if (is_t6(padap->params.chip)) {
725 tp_pio->ireg_addr = t6_tp_tm_pio_array[i][0];
726 tp_pio->ireg_data = t6_tp_tm_pio_array[i][1];
727 tp_pio->ireg_local_offset = t6_tp_tm_pio_array[i][2];
728 tp_pio->ireg_offset_range = t6_tp_tm_pio_array[i][3];
729 }
730 t4_tp_tm_pio_read(padap, buff, tp_pio->ireg_offset_range,
731 tp_pio->ireg_local_offset, true);
732 ch_tp_pio++;
733 }
734
735 /* TP_MIB_INDEX */
736 if (is_t5(padap->params.chip))
737 n = sizeof(t5_tp_mib_index_array) /
738 (IREG_NUM_ELEM * sizeof(u32));
739 else if (is_t6(padap->params.chip))
740 n = sizeof(t6_tp_mib_index_array) /
741 (IREG_NUM_ELEM * sizeof(u32));
742
743 for (i = 0; i < n ; i++) {
744 struct ireg_field *tp_pio = &ch_tp_pio->tp_pio;
745 u32 *buff = ch_tp_pio->outbuf;
746
747 if (is_t5(padap->params.chip)) {
748 tp_pio->ireg_addr = t5_tp_mib_index_array[i][0];
749 tp_pio->ireg_data = t5_tp_mib_index_array[i][1];
750 tp_pio->ireg_local_offset =
751 t5_tp_mib_index_array[i][2];
752 tp_pio->ireg_offset_range =
753 t5_tp_mib_index_array[i][3];
754 } else if (is_t6(padap->params.chip)) {
755 tp_pio->ireg_addr = t6_tp_mib_index_array[i][0];
756 tp_pio->ireg_data = t6_tp_mib_index_array[i][1];
757 tp_pio->ireg_local_offset =
758 t6_tp_mib_index_array[i][2];
759 tp_pio->ireg_offset_range =
760 t6_tp_mib_index_array[i][3];
761 }
762 t4_tp_mib_read(padap, buff, tp_pio->ireg_offset_range,
763 tp_pio->ireg_local_offset, true);
764 ch_tp_pio++;
765 }
766 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
767 return rc;
768}
769
770int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init,
771 struct cudbg_buffer *dbg_buff,
772 struct cudbg_error *cudbg_err)
773{
774 struct adapter *padap = pdbg_init->adap;
775 struct cudbg_buffer temp_buff = { 0 };
776 struct ireg_buf *ch_sge_dbg;
777 int i, rc;
778
779 rc = cudbg_get_buff(dbg_buff, sizeof(*ch_sge_dbg) * 2, &temp_buff);
780 if (rc)
781 return rc;
782
783 ch_sge_dbg = (struct ireg_buf *)temp_buff.data;
784 for (i = 0; i < 2; i++) {
785 struct ireg_field *sge_pio = &ch_sge_dbg->tp_pio;
786 u32 *buff = ch_sge_dbg->outbuf;
787
788 sge_pio->ireg_addr = t5_sge_dbg_index_array[i][0];
789 sge_pio->ireg_data = t5_sge_dbg_index_array[i][1];
790 sge_pio->ireg_local_offset = t5_sge_dbg_index_array[i][2];
791 sge_pio->ireg_offset_range = t5_sge_dbg_index_array[i][3];
792 t4_read_indirect(padap,
793 sge_pio->ireg_addr,
794 sge_pio->ireg_data,
795 buff,
796 sge_pio->ireg_offset_range,
797 sge_pio->ireg_local_offset);
798 ch_sge_dbg++;
799 }
800 cudbg_write_and_release_buff(&temp_buff, dbg_buff);
801 return rc;
802}

1127 more lines aren’t shown here.

drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h+169−0

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

drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h+87−0

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+89−16

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c+403−0

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h+44−0

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c+11−4

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

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

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c+7−6

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c+64−39

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c+1031−24

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.h+8−0

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+122−13

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c+876−0

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.h+120−0

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c+2−2

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

drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h+6−1

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

drivers/net/ethernet/chelsio/cxgb4/l2t.c+2−2

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

drivers/net/ethernet/chelsio/cxgb4/sge.c+6−6

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

drivers/net/ethernet/chelsio/cxgb4/smt.c+247−0

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

drivers/net/ethernet/chelsio/cxgb4/smt.h+76−0

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

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+502−135

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

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

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

drivers/net/ethernet/chelsio/cxgb4/t4_msg.h+47−2

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

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

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

drivers/net/ethernet/chelsio/cxgb4/t4_regs.h+118−0

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

drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h+69−0

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

drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h+79−2

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

drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c+58−0

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

drivers/net/ethernet/chelsio/cxgb4vf/sge.c+6−6

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

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c+3−3

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

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

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

drivers/net/ethernet/cisco/enic/enic_clsf.h+2−3

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

drivers/net/ethernet/cisco/enic/enic_ethtool.c+77−0

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

drivers/net/ethernet/cisco/enic/enic_main.c+2−3

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

drivers/net/ethernet/cisco/enic/vnic_rq.c+2−14

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

drivers/net/ethernet/dec/tulip/de2104x.c+9−12

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

drivers/net/ethernet/dec/tulip/de4x5.c+6−7

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

drivers/net/ethernet/dec/tulip/dmfe.c+5−7

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

drivers/net/ethernet/dec/tulip/interrupt.c+3−3

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

drivers/net/ethernet/dec/tulip/pnic.c+3−3

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

drivers/net/ethernet/dec/tulip/pnic2.c+3−3

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

drivers/net/ethernet/dec/tulip/timer.c+6−6

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

drivers/net/ethernet/dec/tulip/tulip.h+6−6

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

drivers/net/ethernet/dec/tulip/tulip_core.c+6−8

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

drivers/net/ethernet/dec/tulip/uli526x.c+5−7

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

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

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

drivers/net/ethernet/dlink/dl2k.c+6−6

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

drivers/net/ethernet/dlink/sundance.c+5−7

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

drivers/net/ethernet/faraday/ftgmac100.c+26−0

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

drivers/net/ethernet/faraday/ftmac100.c+3−2

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

drivers/net/ethernet/fealnx.c+10−14

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

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+78−78

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

drivers/net/ethernet/freescale/fec.h+1−2

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

drivers/net/ethernet/freescale/fec_main.c+22−9

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

drivers/net/ethernet/freescale/fec_ptp.c+48−34

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

drivers/net/ethernet/freescale/fman/Makefile+6−6

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

drivers/net/ethernet/freescale/fman/fman_port.c+2−0

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

drivers/net/ethernet/freescale/fman/mac.c+38−107

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

drivers/net/ethernet/freescale/fman/mac.h+3−3

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

drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c+0−2

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

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

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

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

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

drivers/net/ethernet/hisilicon/Kconfig+12−3

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

drivers/net/ethernet/hisilicon/hns/hns_enet.c+3−4

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

drivers/net/ethernet/hisilicon/hns3/hnae3.h+41−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile+4−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c+41−23

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h+85−65

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c+347−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.h+21−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+1047−365

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h+40−13

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c+10−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c+217−43

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h+15−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_dcbnl.c+100−0

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c+410−94

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h+21−1

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

drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c+434−51

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

drivers/net/ethernet/huawei/hinic/hinic_rx.c+9−9

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

drivers/net/ethernet/huawei/hinic/hinic_tx.c+12−2

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

drivers/net/ethernet/ibm/ibmvnic.c+478−43

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

drivers/net/ethernet/ibm/ibmvnic.h+57−3

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

drivers/net/ethernet/intel/e100.c+5−6

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

drivers/net/ethernet/intel/e1000e/defines.h+1−0

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

drivers/net/ethernet/intel/e1000e/e1000.h+0−4

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

drivers/net/ethernet/intel/e1000e/mac.c+8−3

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

drivers/net/ethernet/intel/e1000e/netdev.c+51−41

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

drivers/net/ethernet/intel/e1000e/param.c+15−1

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

drivers/net/ethernet/intel/e1000e/phy.c+4−3

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

drivers/net/ethernet/intel/fm10k/fm10k.h+48−12

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

drivers/net/ethernet/intel/fm10k/fm10k_common.c+3−3

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

drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c+2−2

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

drivers/net/ethernet/intel/fm10k/fm10k_iov.c+154−22

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

drivers/net/ethernet/intel/fm10k/fm10k_main.c+4−2

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

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

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

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c+164−45

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

drivers/net/ethernet/intel/fm10k/fm10k_pci.c+372−110

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

drivers/net/ethernet/intel/fm10k/fm10k_pf.c+6−6

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

drivers/net/ethernet/intel/fm10k/fm10k_pf.h+2−1

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

drivers/net/ethernet/intel/i40e/i40e.h+162−54

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

drivers/net/ethernet/intel/i40e/i40e_adminq.c+12−0

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

drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h+203−7

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

drivers/net/ethernet/intel/i40e/i40e_common.c+407−42

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

drivers/net/ethernet/intel/i40e/i40e_debugfs.c+5−6

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

drivers/net/ethernet/intel/i40e/i40e_diag.c+3−1

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

drivers/net/ethernet/intel/i40e/i40e_ethtool.c+614−291

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

drivers/net/ethernet/intel/i40e/i40e_main.c+2793−637

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

drivers/net/ethernet/intel/i40e/i40e_nvm.c+7−13

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

drivers/net/ethernet/intel/i40e/i40e_prototype.h+26−1

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

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

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

drivers/net/ethernet/intel/i40e/i40e_txrx.c+13−40

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

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

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

drivers/net/ethernet/intel/i40e/i40e_type.h+36−0

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

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+175−84

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

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h+3−3

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

drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h+175−7

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

drivers/net/ethernet/intel/i40evf/i40e_common.c+69−0

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

drivers/net/ethernet/intel/i40evf/i40e_prototype.h+9−0

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

drivers/net/ethernet/intel/i40evf/i40e_txrx.c+7−9

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

drivers/net/ethernet/intel/i40evf/i40e_txrx.h+7−4

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

drivers/net/ethernet/intel/i40evf/i40e_type.h+23−0

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

drivers/net/ethernet/intel/i40evf/i40evf.h+19−15

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

drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c+37−1

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

drivers/net/ethernet/intel/i40evf/i40evf_main.c+127−66

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

drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c+43−2

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

drivers/net/ethernet/intel/igb/e1000_defines.h+23−0

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

drivers/net/ethernet/intel/igb/e1000_regs.h+8−0

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

drivers/net/ethernet/intel/igb/igb.h+6−0

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

drivers/net/ethernet/intel/igb/igb_main.c+357−10

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

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

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

drivers/net/ethernet/intel/ixgb/ixgb_main.c+4−6

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

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

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

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c+4−4

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

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c+35−19

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

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

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

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+253−70

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

drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c+12−7

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

drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c+10−4

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

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+4−4

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

drivers/net/ethernet/korina.c+82−156

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

drivers/net/ethernet/marvell/mvneta.c+8−5

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

drivers/net/ethernet/marvell/mvpp2.c+369−46

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

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

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

drivers/net/ethernet/mediatek/mtk_eth_soc.c+5−3

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

drivers/net/ethernet/mediatek/mtk_eth_soc.h+3−1

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

drivers/net/ethernet/mellanox/mlx4/Kconfig+8−0

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

drivers/net/ethernet/mellanox/mlx4/catas.c+1−3

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

drivers/net/ethernet/mellanox/mlx4/cq.c+4−4

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

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

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

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

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

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

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

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

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

drivers/net/ethernet/mellanox/mlx4/en_rx.c+3−3

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

drivers/net/ethernet/mellanox/mlx4/en_tx.c+32−16

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

drivers/net/ethernet/mellanox/mlx4/fw.c+3−3

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

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

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

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+4−2

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

drivers/net/ethernet/mellanox/mlx4/qp.c+5−5

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

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

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

drivers/net/ethernet/mellanox/mlx4/srq.c+4−4

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

drivers/net/ethernet/mellanox/mlx5/core/Kconfig+1−1

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

drivers/net/ethernet/mellanox/mlx5/core/Makefile+3−3

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

drivers/net/ethernet/mellanox/mlx5/core/cq.c+8−8

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

drivers/net/ethernet/mellanox/mlx5/core/en.h+52−39

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

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

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

drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c+5−5

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

drivers/net/ethernet/mellanox/mlx5/core/en_clock.c+0−619

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

drivers/net/ethernet/mellanox/mlx5/core/en_common.c+13−0

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

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

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

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+59−256

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

drivers/net/ethernet/mellanox/mlx5/core/en_fs.c+126−45

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

drivers/net/ethernet/mellanox/mlx5/core/en_main.c+200−44

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

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+57−17

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

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+46−13

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

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

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

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c+899−0

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

drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+11−280

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

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+13−2

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

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+30−4

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

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

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

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

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

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

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

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c+11−2

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

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h+2−2

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

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+660−338

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

drivers/net/ethernet/mellanox/mlx5/core/fs_core.h+16−5

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

drivers/net/ethernet/mellanox/mlx5/core/fw.c+10−0

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

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

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

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c+5−0

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

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c+179−93

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

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h+36−0

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

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c+350−0

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

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c+525−0

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

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h+51−0

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

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

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

drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h+3−0

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

drivers/net/ethernet/mellanox/mlx5/core/port.c+111−0

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

drivers/net/ethernet/mellanox/mlxsw/Makefile+3−1

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

drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c+98−8

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

drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h+8−3

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

drivers/net/ethernet/mellanox/mlxsw/reg.h+774−43

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

drivers/net/ethernet/mellanox/mlxsw/resources.h+2−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum.c+251−84

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

drivers/net/ethernet/mellanox/mlxsw/spectrum.h+76−13

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c+8−98

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c+129−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.h+44−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c+5−1

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c+423−11

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.h+1−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c+8−2

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c+169−14

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h+12−1

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c+256−35

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c+1012−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.h+134−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c+839−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.h+43−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c+276−0

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+1314−234

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h+44−7

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

drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c+409−105

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

drivers/net/ethernet/mellanox/mlxsw/trap.h+6−0

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

drivers/net/ethernet/micrel/ksz884x.c+9−9

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

drivers/net/ethernet/natsemi/natsemi.c+5−7

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

drivers/net/ethernet/natsemi/ns83820.c+4−6

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

drivers/net/ethernet/neterion/s2io.c+4−9

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

drivers/net/ethernet/neterion/s2io.h+1−1

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

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

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

drivers/net/ethernet/neterion/vxge/vxge-main.h+3−5

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

drivers/net/ethernet/neterion/vxge/vxge-traffic.c+0−19

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

drivers/net/ethernet/netronome/nfp/Makefile+5−3

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

drivers/net/ethernet/netronome/nfp/bpf/jit.c+819−480

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

drivers/net/ethernet/netronome/nfp/bpf/main.c+75−53

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

drivers/net/ethernet/netronome/nfp/bpf/main.h+41−73

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

drivers/net/ethernet/netronome/nfp/bpf/offload.c+113−165

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

drivers/net/ethernet/netronome/nfp/bpf/verifier.c+70−53

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

drivers/net/ethernet/netronome/nfp/flower/action.c+381−39

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

drivers/net/ethernet/netronome/nfp/flower/cmsg.c+14−11

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

drivers/net/ethernet/netronome/nfp/flower/cmsg.h+135−11

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

drivers/net/ethernet/netronome/nfp/flower/main.c+17−12

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

drivers/net/ethernet/netronome/nfp/flower/main.h+35−0

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

drivers/net/ethernet/netronome/nfp/flower/match.c+106−8

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

drivers/net/ethernet/netronome/nfp/flower/metadata.c+1−1

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

drivers/net/ethernet/netronome/nfp/flower/offload.c+117−36

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

drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c+804−0

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

drivers/net/ethernet/netronome/nfp/nfp_app.c+11−16

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

drivers/net/ethernet/netronome/nfp/nfp_app.h+45−0

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

drivers/net/ethernet/netronome/nfp/nfp_asm.c+257−0

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

drivers/net/ethernet/netronome/nfp/nfp_asm.h+227−80

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

drivers/net/ethernet/netronome/nfp/nfp_main.c+27−1

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

drivers/net/ethernet/netronome/nfp/nfp_net.h+3−2

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

drivers/net/ethernet/netronome/nfp/nfp_net_common.c+39−36

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

drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h+1−1

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

drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c+133−13

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

drivers/net/ethernet/netronome/nfp/nfp_net_main.c+7−1

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

drivers/net/ethernet/netronome/nfp/nfp_net_repr.c+47−0

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

drivers/net/ethernet/netronome/nfp/nfp_net_repr.h+1−0

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

drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c+7−1

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

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c+5−0

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

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h+36−0

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

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c+79−8

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

drivers/net/ethernet/nuvoton/w90p910_ether.c+4−5

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

drivers/net/ethernet/nvidia/forcedeth.c+115−78

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

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

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

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c+16−26

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

drivers/net/ethernet/packetengines/hamachi.c+7−9

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

drivers/net/ethernet/packetengines/yellowfin.c+5−7

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

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

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

drivers/net/ethernet/qlogic/qed/Makefile+2−1

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

drivers/net/ethernet/qlogic/qed/qed_cxt.c+6−0

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

drivers/net/ethernet/qlogic/qed/qed_dcbx.c+1−1

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

drivers/net/ethernet/qlogic/qed/qed_iwarp.c+748−1

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

drivers/net/ethernet/qlogic/qed/qed_iwarp.h+43−1

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

drivers/net/ethernet/qlogic/qed/qed_ll2.c+89−14

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

drivers/net/ethernet/qlogic/qed/qed_ll2.h+4−6

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

drivers/net/ethernet/qlogic/qed/qed_mcp.c+4−4

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

drivers/net/ethernet/qlogic/qed/qed_ooo.c+13−3

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

drivers/net/ethernet/qlogic/qed/qed_ooo.h+1−1

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

drivers/net/ethernet/qlogic/qed/qed_rdma.c+15−9

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

drivers/net/ethernet/qlogic/qed/qed_sp_commands.c+1−0

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

drivers/net/ethernet/qlogic/qede/qede.h+1−1

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

drivers/net/ethernet/qlogic/qede/qede_filter.c+1−1

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

drivers/net/ethernet/qlogic/qede/qede_fp.c+1−0

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

drivers/net/ethernet/qlogic/qede/qede_main.c+2−2

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

drivers/net/ethernet/qlogic/qla3xxx.c+1−3

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

drivers/net/ethernet/qlogic/qlge/qlge_mpi.c+0−1

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

drivers/net/ethernet/qualcomm/emac/emac-mac.c+3−13

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

drivers/net/ethernet/qualcomm/emac/emac-sgmii.c+6−9

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

drivers/net/ethernet/qualcomm/emac/emac.c+9−18

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

drivers/net/ethernet/qualcomm/rmnet/Kconfig+1−0

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c+128−40

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h+26−9

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c+56−99

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h+1−2

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h+1−2

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c+3−5

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h+0−8

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c+92−28

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

drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h+4−3

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

drivers/net/ethernet/realtek/atp.c+7−7

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

drivers/net/ethernet/realtek/r8169.c+234−6

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

drivers/net/ethernet/renesas/ravb_main.c+64−26

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

drivers/net/ethernet/renesas/sh_eth.c+17−15

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

drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c+7−9

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

drivers/net/ethernet/seeq/ether3.c+6−5

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

drivers/net/ethernet/seeq/ether3.h+1−0

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

drivers/net/ethernet/sfc/ef10.c+13−5

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

drivers/net/ethernet/sfc/efx.c+12−8

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

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

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

drivers/net/ethernet/sfc/falcon/efx.c+2−4

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

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

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

drivers/net/ethernet/sfc/falcon/falcon.c+6−5

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

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

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

drivers/net/ethernet/sfc/falcon/rx.c+2−2

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

drivers/net/ethernet/sfc/falcon/tx.c+1−1

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

drivers/net/ethernet/sfc/farch.c+4−0

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

drivers/net/ethernet/sfc/mcdi.c+4−5

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

drivers/net/ethernet/sfc/mcdi_port.c+4−0

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

drivers/net/ethernet/sfc/ptp.c+0−2

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

drivers/net/ethernet/sfc/rx.c+2−2

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

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

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

drivers/net/ethernet/sgi/ioc3-eth.c+3−5

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

drivers/net/ethernet/sis/sis190.c+4−6

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

drivers/net/ethernet/sis/sis900.c+5−7

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

drivers/net/ethernet/smsc/epic100.c+5−7

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

drivers/net/ethernet/smsc/smc91c92_cs.c+5−5

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

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

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

drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c+10−12

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

drivers/net/ethernet/stmicro/stmmac/common.h+3−2

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

drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c+1−13

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

drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+231−130

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

drivers/net/ethernet/stmicro/stmmac/dwmac4.h+8−1

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

drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c+19−0

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

drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c+18−9

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

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+49−10

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

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

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

drivers/net/ethernet/sun/cassini.c+3−5

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

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

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

drivers/net/ethernet/sun/niu.c+4−8

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

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

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

drivers/net/ethernet/sun/sungem.c+3−5

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

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

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

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

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

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

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

drivers/net/ethernet/sun/sunvnet_common.h+1−1

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

drivers/net/ethernet/ti/cpsw_ale.c+1−3

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

drivers/net/ethernet/ti/netcp_core.c+1−1

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

drivers/net/ethernet/ti/netcp_ethss.c+2−3

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

drivers/net/ethernet/ti/tlan.c+13−19

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

drivers/net/ethernet/toshiba/spider_net.c+5−7

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

drivers/net/ethernet/tundra/tsi108_eth.c+5−5

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

drivers/net/geneve.c+14−30

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

drivers/net/hamradio/6pack.c+13−21

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

drivers/net/hamradio/baycom_epp.c+46−4

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

drivers/net/hamradio/baycom_par.c+44−4

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

drivers/net/hamradio/mkiss.c+2−2

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

drivers/net/hamradio/scc.c+35−34

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

drivers/net/hamradio/yam.c+2−2

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

drivers/net/hippi/rrunner.c+4−6

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

drivers/net/hyperv/hyperv_net.h+13−4

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

drivers/net/hyperv/netvsc.c+51−37

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

drivers/net/hyperv/netvsc_drv.c+86−28

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

drivers/net/hyperv/rndis_filter.c+8−5

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

drivers/net/ieee802154/adf7242.c+4−4

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

drivers/net/ieee802154/atusb.c+313−79

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

drivers/net/ieee802154/atusb.h+8−0

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

drivers/net/ieee802154/ca8210.c+11−11

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

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

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

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

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

drivers/net/ifb.c+3−0

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

drivers/net/ipvlan/ipvlan.h+31−0

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

drivers/net/ipvlan/ipvlan_core.c+19−7

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

drivers/net/ipvlan/ipvlan_main.c+60−10

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

drivers/net/macsec.c+14−13

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

drivers/net/macvlan.c+17−14

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

drivers/net/macvtap.c+1−1

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

drivers/net/ntb_netdev.c+4−4

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

drivers/net/phy/Kconfig+15−2

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

drivers/net/phy/Makefile+2−0

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

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

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

drivers/net/phy/broadcom.c+6−0

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

drivers/net/phy/dp83822.c+344−0

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

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

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

drivers/net/phy/phy_led_triggers.c+50−13

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

drivers/net/phy/phylink.c+8−8

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

drivers/net/phy/realtek.c+51−5

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

drivers/net/phy/sfp-bus.c+3−8

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

drivers/net/phy/sfp.c+14−15

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

drivers/net/phy/uPD60620.c+109−0

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

drivers/net/plip/plip.c+13−0

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

drivers/net/ppp/ppp_async.c+5−5

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

drivers/net/ppp/ppp_generic.c+15−11

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

drivers/net/ppp/ppp_synctty.c+6−5

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

drivers/net/slip/slip.c+2−6

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

drivers/net/team/team.c+3−2

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

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

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

drivers/net/thunderbolt.c+1363−0

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

drivers/net/tun.c+268−42

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

drivers/net/usb/asix_common.c+1−1

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

drivers/net/usb/catc.c+3−5

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

drivers/net/usb/cdc_ncm.c+2−2

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

drivers/net/usb/hso.c+0−2

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

drivers/net/usb/ipheth.c+21−9

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

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

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

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

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

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

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

drivers/net/usb/usbnet.c+5−7

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

drivers/net/virtio_net.+0−0

Empty file added.

drivers/net/virtio_net.c+69−21

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

drivers/net/vrf.c+17−7

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

drivers/net/vxlan.c+17−18

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

drivers/net/wan/dscc4.c+0−22

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

drivers/net/wan/hdlc_cisco.c+6−7

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

drivers/net/wan/hdlc_fr.c+6−5

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

drivers/net/wan/hdlc_ppp.c+1−3

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

drivers/net/wan/lmc/lmc_main.c+5−7

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

drivers/net/wan/sbni.c+8−13

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

drivers/net/wan/sdla.c+5−9

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

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

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

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

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

drivers/net/wireless/ath/ar5523/ar5523.c+3−4

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

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

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

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

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

drivers/net/wireless/ath/ath10k/htt_rx.c+3−3

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

drivers/net/wireless/ath/ath10k/hw.c+9−4

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

drivers/net/wireless/ath/ath10k/hw.h+5−2

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

drivers/net/wireless/ath/ath10k/mac.c+111−57

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

drivers/net/wireless/ath/ath10k/pci.c+22−24

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

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

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

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

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

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

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

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

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

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

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

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

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

drivers/net/wireless/ath/ath6kl/main.c+2−3

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

drivers/net/wireless/ath/ath6kl/txrx.c+3−5

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

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

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

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

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

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

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

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

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

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

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

drivers/net/wireless/ath/ath9k/channel.c+9−10

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

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

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

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

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

drivers/net/wireless/ath/ath9k/gpio.c+6−8

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

drivers/net/wireless/ath/ath9k/hif_usb.c+4−4

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

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

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

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

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

drivers/net/wireless/ath/ath9k/htc_drv_init.c+13−14

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

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

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

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

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

drivers/net/wireless/ath/ath9k/init.c+6−6

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

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

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

drivers/net/wireless/ath/ath9k/main.c+12−10

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

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

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

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

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

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

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

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

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

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

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

drivers/net/wireless/ath/wil6210/debugfs.c+0−45

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

drivers/net/wireless/ath/wil6210/main.c+7−8

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

drivers/net/wireless/ath/wil6210/p2p.c+2−2

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

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

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

drivers/net/wireless/atmel/atmel.c+4−7

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

drivers/net/wireless/broadcom/b43/phy_g.c+1−1

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

drivers/net/wireless/broadcom/b43/phy_ht.c+3−3

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

drivers/net/wireless/broadcom/b43legacy/radio.c+1−1

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h+10−0

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+27−140

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

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

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c+157−0

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c+40−0

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

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

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c+0−5

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

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

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c+4−10

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c+19−0

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

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c+31−8

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

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

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

drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c+1−1

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

drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c+796−879

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

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

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

drivers/net/wireless/intel/iwlegacy/3945-rs.c+3−7

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

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

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

drivers/net/wireless/intel/iwlegacy/4965-rs.c+0−2

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

drivers/net/wireless/intel/iwlegacy/common.c+2−2

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

drivers/net/wireless/intel/iwlegacy/common.h+1−1

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

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

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

drivers/net/wireless/intel/iwlwifi/cfg/8000.c+2−52

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

drivers/net/wireless/intel/iwlwifi/cfg/9000.c+2−1

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

drivers/net/wireless/intel/iwlwifi/cfg/a000.c+53−51

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

drivers/net/wireless/intel/iwlwifi/fw/acpi.c+210−0

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

drivers/net/wireless/intel/iwlwifi/fw/acpi.h+138−0

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

drivers/net/wireless/intel/iwlwifi/fw/api/binding.h+38−3

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

drivers/net/wireless/intel/iwlwifi/fw/api/commands.h+1−0

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

drivers/net/wireless/intel/iwlwifi/fw/api/debug.h+9−0

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

drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h+0−67

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

drivers/net/wireless/intel/iwlwifi/fw/api/paging.h+0−24

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

drivers/net/wireless/intel/iwlwifi/fw/api/power.h+1−2

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

drivers/net/wireless/intel/iwlwifi/fw/api/sta.h+0−4

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

drivers/net/wireless/intel/iwlwifi/fw/api/tx.h+2−2

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

drivers/net/wireless/intel/iwlwifi/fw/dbg.c+15−0

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

drivers/net/wireless/intel/iwlwifi/fw/file.h+4−1

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

drivers/net/wireless/intel/iwlwifi/fw/img.h+0−8

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

drivers/net/wireless/intel/iwlwifi/fw/paging.c+12−91

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

drivers/net/wireless/intel/iwlwifi/iwl-config.h+4−3

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

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

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

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

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

drivers/net/wireless/intel/iwlwifi/iwl-drv.c+4−9

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

drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c+2−89

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

drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h+0−17

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

drivers/net/wireless/intel/iwlwifi/iwl-trans.c+16−0

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

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

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

drivers/net/wireless/intel/iwlwifi/mvm/d3.c+10−6

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

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c+0−76

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

drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c+32−0

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

drivers/net/wireless/intel/iwlwifi/mvm/fw.c+58−184

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

drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+48−66

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

drivers/net/wireless/intel/iwlwifi/mvm/mvm.h+74−31

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

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

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

drivers/net/wireless/intel/iwlwifi/mvm/ops.c+12−11

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

drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c+1−0

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

drivers/net/wireless/intel/iwlwifi/mvm/quota.c+35−24

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

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

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

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

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

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c+58−20

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

drivers/net/wireless/intel/iwlwifi/mvm/sta.c+65−28

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

drivers/net/wireless/intel/iwlwifi/mvm/tx.c+11−2

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

drivers/net/wireless/intel/iwlwifi/mvm/utils.c+29−84

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

drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c+1−1

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

drivers/net/wireless/intel/iwlwifi/pcie/drv.c+56−138

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

drivers/net/wireless/intel/iwlwifi/pcie/internal.h+4−0

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

drivers/net/wireless/intel/iwlwifi/pcie/trans.c+90−0

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

drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c+7−6

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

drivers/net/wireless/intel/iwlwifi/pcie/tx.c+22−2

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

drivers/net/wireless/intersil/orinoco/orinoco_usb.c+0−2

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

drivers/net/wireless/intersil/p54/main.c+3−4

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

drivers/net/wireless/mac80211_hwsim.c+96−96

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

drivers/net/wireless/marvell/libertas/cfg.c+0−3

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

drivers/net/wireless/marvell/libertas/if_usb.c+3−3

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

drivers/net/wireless/marvell/libertas/main.c+9−12

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

drivers/net/wireless/marvell/libertas_tf/if_usb.c+3−3

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

drivers/net/wireless/marvell/libertas_tf/main.c+3−4

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

drivers/net/wireless/marvell/mwifiex/11n.c+0−9

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

drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c+3−10

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

drivers/net/wireless/marvell/mwifiex/cfg80211.c+42−34

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

drivers/net/wireless/marvell/mwifiex/cmdevt.c+6−9

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

drivers/net/wireless/marvell/mwifiex/fw.h+3−1

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

drivers/net/wireless/marvell/mwifiex/init.c+3−8

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

drivers/net/wireless/marvell/mwifiex/main.c+1−2

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

drivers/net/wireless/marvell/mwifiex/main.h+2−3

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

drivers/net/wireless/marvell/mwifiex/scan.c+2−3

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

drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c+1−5

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

drivers/net/wireless/marvell/mwifiex/sta_event.c+2−4

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

drivers/net/wireless/marvell/mwifiex/tdls.c+3−11

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

drivers/net/wireless/marvell/mwifiex/usb.c+4−5

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

drivers/net/wireless/marvell/mwifiex/wmm.c+2−1

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

drivers/net/wireless/quantenna/qtnfmac/cfg80211.c+51−208

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

drivers/net/wireless/quantenna/qtnfmac/commands.c+315−161

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

drivers/net/wireless/quantenna/qtnfmac/commands.h+6−5

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

drivers/net/wireless/quantenna/qtnfmac/core.c+29−3

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

drivers/net/wireless/quantenna/qtnfmac/core.h+7−32

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

drivers/net/wireless/quantenna/qtnfmac/event.c+59−72

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

drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c+9−6

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

drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h+1−0

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

drivers/net/wireless/quantenna/qtnfmac/qlink.h+189−87

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

drivers/net/wireless/quantenna/qtnfmac/qlink_util.c+105−8

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

drivers/net/wireless/quantenna/qtnfmac/qlink_util.h+7−0

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

drivers/net/wireless/ralink/rt2x00/rt2x00debug.c+4−3

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

drivers/net/wireless/ralink/rt2x00/rt2x00dump.h+1−1

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

drivers/net/wireless/ralink/rt2x00/rt2x00usb.c+3−3

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

drivers/net/wireless/ray_cs.c+24−29

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

drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c+4−1

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

drivers/net/wireless/realtek/rtlwifi/base.c+105−27

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

drivers/net/wireless/realtek/rtlwifi/base.h+6−2

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

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c+5−8

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

drivers/net/wireless/realtek/rtlwifi/core.c+11−11

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

drivers/net/wireless/realtek/rtlwifi/pci.c+171−168

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

drivers/net/wireless/realtek/rtlwifi/pci.h+19−22

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

drivers/net/wireless/realtek/rtlwifi/ps.c+1−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c+6−3

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

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h+1−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c+12−9

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

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h+5−3

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

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c+9−9

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h+2−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c+5−4

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h+4−4

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

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

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

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

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c+3−3

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

drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h+1−1

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c+5−4

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

drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h+4−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c+5−1

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

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

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c+2−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c+4−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c+32−11

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h+4−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c+8−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c+27−22

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

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h+23−117

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

drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c+2−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c+4−4

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

drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h+3−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c+6−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c+2−1

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c+7−7

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

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h+4−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c+5−1

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h+2−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c+2−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c+8−8

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

drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h+3−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c+5−1

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h+2−1

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c+1−1

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c+14−19

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h+3−2

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c+5−1

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

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

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h+2−1

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

drivers/net/wireless/realtek/rtlwifi/usb.c+0−17

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

drivers/net/wireless/realtek/rtlwifi/wifi.h+39−33

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

drivers/net/wireless/rsi/rsi_91x_core.c+37−4

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

drivers/net/wireless/rsi/rsi_91x_debugfs.c+6−13

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

drivers/net/wireless/rsi/rsi_91x_hal.c+61−33

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

drivers/net/wireless/rsi/rsi_91x_mac80211.c+480−97

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

drivers/net/wireless/rsi/rsi_91x_main.c+32−1

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

drivers/net/wireless/rsi/rsi_91x_mgmt.c+82−29

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

drivers/net/wireless/rsi/rsi_91x_ps.c+8−8

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

drivers/net/wireless/rsi/rsi_91x_sdio.c+265−4

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

drivers/net/wireless/rsi/rsi_91x_usb.c+2−2

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

drivers/net/wireless/rsi/rsi_common.h+6−1

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

drivers/net/wireless/rsi/rsi_hal.h+4−2

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

drivers/net/wireless/rsi/rsi_main.h+30−6

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

drivers/net/wireless/rsi/rsi_mgmt.h+47−7

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

drivers/net/wireless/rsi/rsi_ps.h+3−4

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

drivers/net/wireless/rsi/rsi_sdio.h+2−0

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

drivers/net/wireless/st/cw1200/main.c+1−2

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

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

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

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

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

drivers/net/wireless/st/cw1200/sta.c+2−3

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

drivers/net/wireless/st/cw1200/sta.h+1−1

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

drivers/net/wireless/zydas/zd1201.c+1−2

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

drivers/net/xen-netback/common.h+1−1

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

drivers/net/xen-netback/interface.c+1−2

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

drivers/net/xen-netback/netback.c+2−4

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

drivers/nfc/fdp/fdp.c+1−1

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

drivers/nfc/microread/i2c.c+1−1

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

drivers/nfc/nfcmrvl/i2c.c+1−1

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

drivers/nfc/nxp-nci/i2c.c+1−1

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

drivers/nfc/pn533/i2c.c+1−1

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

drivers/nfc/pn544/i2c.c+1−1

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

drivers/nfc/s3fwrn5/firmware.c+1−1

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

drivers/nfc/s3fwrn5/i2c.c+1−1

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

drivers/nfc/st-nci/i2c.c+1−1

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

drivers/nfc/st21nfca/i2c.c+1−1

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

drivers/pcmcia/electra_cf.c+7−5

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

drivers/s390/net/fsm.c+2−6

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

drivers/s390/net/qeth_core.h+20−18

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

drivers/s390/net/qeth_core_main.c+71−139

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

drivers/s390/net/qeth_core_mpc.c+3−1

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

drivers/s390/net/qeth_core_mpc.h+72−1

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

drivers/s390/net/qeth_core_sys.c+1−3

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

drivers/s390/net/qeth_l2.h+6−0

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

drivers/s390/net/qeth_l2_main.c+507−50

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

drivers/s390/net/qeth_l2_sys.c+193−22

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

drivers/s390/net/qeth_l3_main.c+17−20

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

drivers/s390/net/qeth_l3_sys.c+12−33

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

drivers/scsi/qedi/Kconfig+1−0

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

drivers/thunderbolt/Makefile+1−1

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

drivers/thunderbolt/ctl.c+18−28

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

drivers/thunderbolt/ctl.h+2−1

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

drivers/thunderbolt/domain.c+193−4

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

drivers/thunderbolt/icm.c+216−2

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

drivers/thunderbolt/nhi.c+315−97

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

drivers/thunderbolt/nhi.h+3−138

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

drivers/thunderbolt/nhi_regs.h+4−7

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

drivers/thunderbolt/property.c+670−0

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

drivers/thunderbolt/switch.c+5−2

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

drivers/thunderbolt/tb.h+35−53

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

drivers/thunderbolt/tb_msgs.h+137−31

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

drivers/thunderbolt/xdomain.c+1570−0

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

drivers/vhost/net.c+5−9

This diff is large: its 49 lines aren’t shown here.

fs/afs/internal.h+1−0

This diff is large: its 8 lines aren’t shown here.

fs/afs/rxrpc.c+33−9

This diff is large: its 100 lines aren’t shown here.

include/linux/avf/virtchnl.h+20−0

This diff is large: its 48 lines aren’t shown here.

include/linux/bpf-cgroup.h+51−18

This diff is large: its 104 lines aren’t shown here.

include/linux/bpf.h+162−12

This diff is large: its 298 lines aren’t shown here.

include/linux/bpf_types.h+18−14

This diff is large: its 46 lines aren’t shown here.

include/linux/bpf_verifier.h+40−7

This diff is large: its 85 lines aren’t shown here.

include/linux/brcmphy.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/byteorder/generic.h+16−0

This diff is large: its 21 lines aren’t shown here.

include/linux/connector.h+2−2

This diff is large: its 18 lines aren’t shown here.

include/linux/device_cgroup.h+63−4

This diff is large: its 81 lines aren’t shown here.

include/linux/dsa/lan9303.h+38−0

This diff is large: its 39 lines aren’t shown here.

include/linux/dynamic_queue_limits.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/etherdevice.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/ethtool.h+10−0

This diff is large: its 17 lines aren’t shown here.

include/linux/filter.h+26−6

This diff is large: its 66 lines aren’t shown here.

include/linux/ieee80211.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/if_arp.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/if_bridge.h+6−0

This diff is large: its 27 lines aren’t shown here.

include/linux/if_frad.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/if_macvlan.h+2−16

This diff is large: its 39 lines aren’t shown here.

include/linux/if_phonet.h+1−1

This diff is large: its 7 lines aren’t shown here.

include/linux/if_tap.h+4−0

This diff is large: its 11 lines aren’t shown here.

include/linux/inetdevice.h+2−0

This diff is large: its 16 lines aren’t shown here.

include/linux/ipv6.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/lsm_hooks.h+54−0

This diff is large: its 75 lines aren’t shown here.

include/linux/mlx4/device.h+4−4

This diff is large: its 36 lines aren’t shown here.

include/linux/mlx5/cq.h+2−2

This diff is large: its 18 lines aren’t shown here.

include/linux/mlx5/device.h+31−0

This diff is large: its 64 lines aren’t shown here.

include/linux/mlx5/driver.h+33−0

This diff is large: its 77 lines aren’t shown here.

include/linux/mlx5/mlx5_ifc.h+59−1

This diff is large: its 81 lines aren’t shown here.

include/linux/mlx5/port.h+5−0

This diff is large: its 10 lines aren’t shown here.

include/linux/mlx5/qp.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/mod_devicetable.h+26−0

This diff is large: its 32 lines aren’t shown here.

include/linux/mroute.h+46−0

This diff is large: its 110 lines aren’t shown here.

include/linux/netdevice.h+90−30

This diff is large: its 305 lines aren’t shown here.

include/linux/netlink.h+0−3

This diff is large: its 10 lines aren’t shown here.

include/linux/of.h+50−12

This diff is large: its 100 lines aren’t shown here.

include/linux/once.h+3−3

This diff is large: its 20 lines aren’t shown here.

include/linux/phy.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/linux/qed/qed_ll2_if.h+8−0

This diff is large: its 41 lines aren’t shown here.

include/linux/rtnetlink.h+3−1

This diff is large: its 13 lines aren’t shown here.

include/linux/security.h+48−0

This diff is large: its 55 lines aren’t shown here.

include/linux/skbuff.h+102−32

This diff is large: its 214 lines aren’t shown here.

include/linux/tcp.h+17−7

This diff is large: its 80 lines aren’t shown here.

include/linux/thunderbolt.h+598−0

This diff is large: its 599 lines aren’t shown here.

include/linux/trace_events.h+39−4

This diff is large: its 74 lines aren’t shown here.

include/net/act_api.h+35−2

This diff is large: its 49 lines aren’t shown here.

include/net/addrconf.h+4−6

This diff is large: its 33 lines aren’t shown here.

include/net/af_rxrpc.h+5−2

This diff is large: its 29 lines aren’t shown here.

include/net/af_vsock.h+17−3

This diff is large: its 36 lines aren’t shown here.

include/net/bluetooth/bluetooth.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/net/bluetooth/hci.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/net/bonding.h+2−5

This diff is large: its 42 lines aren’t shown here.

include/net/cfg80211.h+21−19

This diff is large: its 82 lines aren’t shown here.

include/net/dn.h+0−7

This diff is large: its 14 lines aren’t shown here.

include/net/dn_nsp.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/net/dsa.h+106−26

This diff is large: its 226 lines aren’t shown here.

include/net/dst.h+9−8

This diff is large: its 35 lines aren’t shown here.

include/net/dst_metadata.h+4−2

This diff is large: its 27 lines aren’t shown here.

include/net/fib_notifier.h+3−0

This diff is large: its 17 lines aren’t shown here.

include/net/flow_dissector.h+6−6

This diff is large: its 34 lines aren’t shown here.

include/net/fq.h+7−0

This diff is large: its 14 lines aren’t shown here.

include/net/fq_impl.h+62−10

This diff is large: its 101 lines aren’t shown here.

include/net/inet_connection_sock.h+3−3

This diff is large: its 13 lines aren’t shown here.

include/net/inet_ecn.h+0−5

This diff is large: its 12 lines aren’t shown here.

include/net/inet_frag.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/net/inet_sock.h+2−1

This diff is large: its 10 lines aren’t shown here.

include/net/ip6_fib.h+63−16

This diff is large: its 169 lines aren’t shown here.

include/net/ip6_route.h+5−0

This diff is large: its 12 lines aren’t shown here.

include/net/ip_fib.h+0−3

This diff is large: its 10 lines aren’t shown here.

include/net/ip_tunnels.h+2−1

This diff is large: its 10 lines aren’t shown here.

include/net/ipv6.h+42−3

This diff is large: its 66 lines aren’t shown here.

include/net/llc_c_ac.h+4−4

This diff is large: its 15 lines aren’t shown here.

include/net/mac80211.h+7−1

This diff is large: its 16 lines aren’t shown here.

include/net/neighbour.h+2−2

This diff is large: its 11 lines aren’t shown here.

include/net/netevent.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/net/netfilter/ipv4/nf_conntrack_ipv4.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/net/netfilter/ipv6/nf_conntrack_ipv6.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/net/netfilter/nf_conntrack_l4proto.h+18−7

This diff is large: its 50 lines aren’t shown here.

include/net/netfilter/nf_tables.h+5−0

This diff is large: its 19 lines aren’t shown here.

include/net/netns/ipv4.h+41−0

This diff is large: its 71 lines aren’t shown here.

include/net/netns/ipv6.h+9−0

This diff is large: its 23 lines aren’t shown here.

include/net/nsh.h+3−0

This diff is large: its 8 lines aren’t shown here.

include/net/phonet/phonet.h+4−2

This diff is large: its 13 lines aren’t shown here.

include/net/pkt_cls.h+204−29

This diff is large: its 346 lines aren’t shown here.

include/net/pkt_sched.h+12−9

This diff is large: its 38 lines aren’t shown here.

include/net/request_sock.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/net/rtnetlink.h+0−5

This diff is large: its 19 lines aren’t shown here.

include/net/sch_generic.h+46−5

This diff is large: its 93 lines aren’t shown here.

include/net/sctp/sm.h+5−5

This diff is large: its 24 lines aren’t shown here.

include/net/sctp/stream_sched.h+72−0

This diff is large: its 73 lines aren’t shown here.

include/net/sctp/structs.h+59−4

This diff is large: its 108 lines aren’t shown here.

include/net/sock.h+31−4

This diff is large: its 86 lines aren’t shown here.

include/net/switchdev.h+2−0

This diff is large: its 16 lines aren’t shown here.

include/net/tc_act/tc_gact.h+5−0

This diff is large: its 12 lines aren’t shown here.

include/net/tc_act/tc_ife.h+9−3

This diff is large: its 30 lines aren’t shown here.

include/net/tc_act/tc_mirred.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/net/tc_act/tc_vlan.h+37−9

This diff is large: its 73 lines aren’t shown here.

include/net/tcp.h+86−138

This diff is large: its 449 lines aren’t shown here.

include/net/tipc.h+62−0

This diff is large: its 63 lines aren’t shown here.

include/net/tls.h+22−1

This diff is large: its 58 lines aren’t shown here.

include/net/xfrm.h+4−4

This diff is large: its 27 lines aren’t shown here.

include/trace/events/bpf.h+4−1

This diff is large: its 19 lines aren’t shown here.

include/trace/events/fib6.h+3−3

This diff is large: its 21 lines aren’t shown here.

include/trace/events/sock.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/trace/events/tcp.h+299−0

This diff is large: its 300 lines aren’t shown here.

include/trace/events/xdp.h+78−2

This diff is large: its 93 lines aren’t shown here.

include/trace/perf.h+3−3

This diff is large: its 20 lines aren’t shown here.

include/uapi/linux/batman_adv.h+290−79

This diff is large: its 472 lines aren’t shown here.

include/uapi/linux/bpf.h+150−8

This diff is large: its 316 lines aren’t shown here.

include/uapi/linux/dcbnl.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/uapi/linux/if_link.h+8−0

This diff is large: its 36 lines aren’t shown here.

include/uapi/linux/if_tun.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/uapi/linux/if_tunnel.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/uapi/linux/ila.h+21−0

This diff is large: its 35 lines aren’t shown here.

include/uapi/linux/in6.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/uapi/linux/ip6_tunnel.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/uapi/linux/ipv6.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/uapi/linux/ipv6_route.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/uapi/linux/nfc.h+2−0

This diff is large: its 16 lines aren’t shown here.

include/uapi/linux/nl80211.h+65−17

This diff is large: its 151 lines aren’t shown here.

include/uapi/linux/openvswitch.h+88−0

This diff is large: its 135 lines aren’t shown here.

include/uapi/linux/pkt_sched.h+63−0

This diff is large: its 110 lines aren’t shown here.

include/uapi/linux/qrtr.h+35−0

This diff is large: its 46 lines aren’t shown here.

include/uapi/linux/rtnetlink.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/uapi/linux/rxrpc.h+5−5

This diff is large: its 18 lines aren’t shown here.

include/uapi/linux/sctp.h+16−0

This diff is large: its 35 lines aren’t shown here.

include/uapi/linux/snmp.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/uapi/linux/tc_act/tc_mirred.h+3−3

This diff is large: its 23 lines aren’t shown here.

include/uapi/linux/tcp.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/uapi/linux/tipc.h+15−0

This diff is large: its 22 lines aren’t shown here.

include/uapi/linux/tls.h+0−4

This diff is large: its 11 lines aren’t shown here.

include/uapi/linux/vm_sockets_diag.h+33−0

This diff is large: its 34 lines aren’t shown here.

kernel/bpf/Makefile+3−0

This diff is large: its 12 lines aren’t shown here.

kernel/bpf/arraymap.c+5−1

This diff is large: its 20 lines aren’t shown here.

kernel/bpf/cgroup.c+443−127

This diff is large: its 649 lines aren’t shown here.

kernel/bpf/core.c+177−3

This diff is large: its 216 lines aren’t shown here.

kernel/bpf/cpumap.c+706−0

This diff is large: its 707 lines aren’t shown here.

kernel/bpf/devmap.c+4−1

This diff is large: its 19 lines aren’t shown here.

kernel/bpf/disasm.c+214−0

This diff is large: its 215 lines aren’t shown here.

kernel/bpf/disasm.h+32−0

This diff is large: its 33 lines aren’t shown here.

kernel/bpf/hashtab.c+3−2

This diff is large: its 12 lines aren’t shown here.

kernel/bpf/inode.c+10−5

This diff is large: its 53 lines aren’t shown here.

kernel/bpf/lpm_trie.c+94−4

This diff is large: its 113 lines aren’t shown here.

kernel/bpf/offload.c+194−0

This diff is large: its 195 lines aren’t shown here.

kernel/bpf/percpu_freelist.c+6−2

This diff is large: its 30 lines aren’t shown here.

kernel/bpf/sockmap.c+6−3

This diff is large: its 37 lines aren’t shown here.

kernel/bpf/stackmap.c+4−1

This diff is large: its 19 lines aren’t shown here.

kernel/bpf/syscall.c+289−36

This diff is large: its 677 lines aren’t shown here.

kernel/bpf/verifier.c+797−683

This diff is large: its 2984 lines aren’t shown here.

kernel/cgroup/cgroup.c+31−7

This diff is large: its 74 lines aren’t shown here.

kernel/events/core.c+10−21

This diff is large: its 71 lines aren’t shown here.

kernel/trace/bpf_trace.c+163−14

This diff is large: its 296 lines aren’t shown here.

kernel/trace/trace_kprobe.c+2−4

This diff is large: its 30 lines aren’t shown here.

kernel/trace/trace_syscalls.c+19−15

This diff is large: its 106 lines aren’t shown here.

kernel/trace/trace_uprobe.c+1−2

This diff is large: its 15 lines aren’t shown here.

lib/dynamic_queue_limits.c+1−2

This diff is large: its 14 lines aren’t shown here.

lib/kobject_uevent.c+51−43

This diff is large: its 115 lines aren’t shown here.

lib/nlattr.c+16−3

This diff is large: its 50 lines aren’t shown here.

lib/once.c+4−4

This diff is large: its 32 lines aren’t shown here.

lib/test_rhashtable.c+270−23

This diff is large: its 456 lines aren’t shown here.

net/8021q/vlan.c+6−3

This diff is large: its 37 lines aren’t shown here.

net/8021q/vlan.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/8021q/vlan_netlink.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/atm/clip.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/atm/lec.c+9−10

This diff is large: its 73 lines aren’t shown here.

net/atm/mpc.c+6−5

This diff is large: its 38 lines aren’t shown here.

net/ax25/af_ax25.c+3−4

This diff is large: its 22 lines aren’t shown here.

net/ax25/ax25_ds_timer.c+4−5

This diff is large: its 31 lines aren’t shown here.

net/ax25/ax25_timer.c+20−21

This diff is large: its 92 lines aren’t shown here.

net/batman-adv/bat_iv_ogm.c+12−12

This diff is large: its 80 lines aren’t shown here.

net/batman-adv/bat_v.c+5−6

This diff is large: its 45 lines aren’t shown here.

net/batman-adv/bat_v_elp.c+3−3

This diff is large: its 20 lines aren’t shown here.

net/batman-adv/bat_v_ogm.c+6−6

This diff is large: its 40 lines aren’t shown here.

net/batman-adv/distributed-arp-table.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/batman-adv/gateway_client.c+4−4

This diff is large: its 26 lines aren’t shown here.

net/batman-adv/gateway_common.c+9−9

This diff is large: its 52 lines aren’t shown here.

net/batman-adv/hard-interface.c+7−7

This diff is large: its 42 lines aren’t shown here.

net/batman-adv/icmp_socket.c+2−2

This diff is large: its 13 lines aren’t shown here.

net/batman-adv/main.c+6−6

This diff is large: its 28 lines aren’t shown here.

net/batman-adv/main.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/batman-adv/multicast.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/batman-adv/originator.c+13−13

This diff is large: its 47 lines aren’t shown here.

net/batman-adv/routing.c+3−3

This diff is large: its 26 lines aren’t shown here.

net/batman-adv/send.c+3−3

This diff is large: its 20 lines aren’t shown here.

net/batman-adv/soft-interface.c+6−4

This diff is large: its 35 lines aren’t shown here.

net/batman-adv/sysfs.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/batman-adv/tp_meter.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/bluetooth/a2mp.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/bluetooth/amp.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/bluetooth/ecdh_helper.c+116−112

This diff is large: its 285 lines aren’t shown here.

net/bluetooth/ecdh_helper.h+6−3

This diff is large: its 15 lines aren’t shown here.

net/bluetooth/hci_conn.c+3−3

This diff is large: its 20 lines aren’t shown here.

net/bluetooth/hci_core.c+17−18

This diff is large: its 126 lines aren’t shown here.

net/bluetooth/hci_event.c+24−22

This diff is large: its 169 lines aren’t shown here.

net/bluetooth/hci_request.c+14−7

This diff is large: its 70 lines aren’t shown here.

net/bluetooth/hci_request.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/bluetooth/hci_sock.c+11−6

This diff is large: its 43 lines aren’t shown here.

net/bluetooth/hci_sysfs.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/bluetooth/mgmt.c+31−26

This diff is large: its 187 lines aren’t shown here.

net/bluetooth/selftest.c+37−11

This diff is large: its 99 lines aren’t shown here.

net/bluetooth/smp.c+93−56

This diff is large: its 405 lines aren’t shown here.

net/bpf/test_run.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/bridge/Makefile+1−1

This diff is large: its 9 lines aren’t shown here.

net/bridge/br.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/bridge/br_arp_nd_proxy.c+469−0

This diff is large: its 470 lines aren’t shown here.

net/bridge/br_device.c+24−3

This diff is large: its 64 lines aren’t shown here.

net/bridge/br_forward.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/bridge/br_if.c+18−6

This diff is large: its 79 lines aren’t shown here.

net/bridge/br_input.c+18−59

This diff is large: its 104 lines aren’t shown here.

net/bridge/br_ioctl.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/bridge/br_mdb.c+50−4

This diff is large: its 92 lines aren’t shown here.

net/bridge/br_multicast.c+94−47

This diff is large: its 320 lines aren’t shown here.

net/bridge/br_netlink.c+84−45

This diff is large: its 300 lines aren’t shown here.

net/bridge/br_netlink_tunnel.c+9−5

This diff is large: its 51 lines aren’t shown here.

net/bridge/br_private.h+32−8

This diff is large: its 117 lines aren’t shown here.

net/bridge/br_private_tunnel.h+2−1

This diff is large: its 10 lines aren’t shown here.

net/bridge/br_stp.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/bridge/br_stp_if.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/bridge/br_stp_timer.c+20−30

This diff is large: its 113 lines aren’t shown here.

net/bridge/br_sysfs_if.c+21−1

This diff is large: its 50 lines aren’t shown here.

net/bridge/br_vlan.c+57−21

This diff is large: its 247 lines aren’t shown here.

net/bridge/netfilter/ebtables.c+1−2

This diff is large: its 11 lines aren’t shown here.

net/can/af_can.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/can/af_can.h+1−1

This diff is large: its 8 lines aren’t shown here.

net/can/proc.c+4−4

This diff is large: its 30 lines aren’t shown here.

net/core/datagram.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/dev.c+216−127

This diff is large: its 722 lines aren’t shown here.

net/core/dst.c+16−0

This diff is large: its 20 lines aren’t shown here.

net/core/ethtool.c+16−0

This diff is large: its 23 lines aren’t shown here.

net/core/fib_notifier.c+9−1

This diff is large: its 31 lines aren’t shown here.

net/core/fib_rules.c+12−3

This diff is large: its 48 lines aren’t shown here.

net/core/filter.c+280−56

This diff is large: its 653 lines aren’t shown here.

net/core/flow_dissector.c+115−15

This diff is large: its 191 lines aren’t shown here.

net/core/lwt_bpf.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/core/neighbour.c+9−9

This diff is large: its 81 lines aren’t shown here.

net/core/net-sysfs.c+19−9

This diff is large: its 59 lines aren’t shown here.

net/core/net-traces.c+3−0

This diff is large: its 14 lines aren’t shown here.

net/core/net_namespace.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/core/pktgen.c+12−4

This diff is large: its 38 lines aren’t shown here.

net/core/rtnetlink.c+304−144

This diff is large: its 900 lines aren’t shown here.

net/core/skbuff.c+31−26

This diff is large: its 145 lines aren’t shown here.

net/core/sock.c+8−27

This diff is large: its 76 lines aren’t shown here.

net/dccp/ccids/ccid2.c+5−5

This diff is large: its 25 lines aren’t shown here.

net/dccp/ccids/ccid2.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/dccp/ccids/ccid3.c+6−5

This diff is large: its 26 lines aren’t shown here.

net/dccp/ccids/ccid3.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/dccp/ccids/lib/packet_history.c+1−3

This diff is large: its 12 lines aren’t shown here.

net/dccp/input.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/dccp/options.c+1−1

This diff is large: its 10 lines aren’t shown here.

net/dccp/timer.c+17−13

This diff is large: its 68 lines aren’t shown here.

net/decnet/af_decnet.c+3−4

This diff is large: its 32 lines aren’t shown here.

net/decnet/dn_dev.c+5−7

This diff is large: its 37 lines aren’t shown here.

net/decnet/dn_nsp_in.c+2−6

This diff is large: its 15 lines aren’t shown here.

net/decnet/dn_nsp_out.c+2−16

This diff is large: its 32 lines aren’t shown here.

net/decnet/dn_route.c+4−4

This diff is large: its 36 lines aren’t shown here.

net/decnet/dn_table.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/dsa/Kconfig+4−0

This diff is large: its 18 lines aren’t shown here.

net/dsa/Makefile+2−1

This diff is large: its 13 lines aren’t shown here.

net/dsa/dsa.c+32−73

This diff is large: its 179 lines aren’t shown here.

net/dsa/dsa2.c+428−481

This diff is large: its 1202 lines aren’t shown here.

net/dsa/dsa_priv.h+50−21

This diff is large: its 138 lines aren’t shown here.

net/dsa/legacy.c+31−54

This diff is large: its 210 lines aren’t shown here.

net/dsa/master.c+143−0

This diff is large: its 144 lines aren’t shown here.

net/dsa/port.c+99−6

This diff is large: its 155 lines aren’t shown here.

net/dsa/slave.c+256−345

This diff is large: its 1181 lines aren’t shown here.

net/dsa/switch.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/dsa/tag_brcm.c+69−21

This diff is large: its 143 lines aren’t shown here.

net/dsa/tag_dsa.c+8−20

This diff is large: its 70 lines aren’t shown here.

net/dsa/tag_edsa.c+8−20

This diff is large: its 70 lines aren’t shown here.

net/dsa/tag_ksz.c+5−8

This diff is large: its 44 lines aren’t shown here.

net/dsa/tag_lan9303.c+33−22

This diff is large: its 106 lines aren’t shown here.

net/dsa/tag_mtk.c+5−15

This diff is large: its 51 lines aren’t shown here.

net/dsa/tag_qca.c+5−17

This diff is large: its 53 lines aren’t shown here.

net/dsa/tag_trailer.c+5−8

This diff is large: its 45 lines aren’t shown here.

net/hsr/hsr_device.c+4−5

This diff is large: its 27 lines aren’t shown here.

net/hsr/hsr_framereg.c+2−4

This diff is large: its 19 lines aren’t shown here.

net/hsr/hsr_framereg.h+1−1

This diff is large: its 9 lines aren’t shown here.

net/ieee802154/6lowpan/reassembly.c+3−2

This diff is large: its 16 lines aren’t shown here.

net/ieee802154/netlink.c+3−3

This diff is large: its 20 lines aren’t shown here.

net/ipv4/af_inet.c+7−5

This diff is large: its 42 lines aren’t shown here.

net/ipv4/arp.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv4/devinet.c+26−17

This diff is large: its 117 lines aren’t shown here.

net/ipv4/fib_frontend.c+29−5

This diff is large: its 74 lines aren’t shown here.

net/ipv4/fib_semantics.c+5−14

This diff is large: its 64 lines aren’t shown here.

net/ipv4/fib_trie.c+18−24

This diff is large: its 98 lines aren’t shown here.

net/ipv4/icmp.c+15−5

This diff is large: its 49 lines aren’t shown here.

net/ipv4/inet_connection_sock.c+27−30

This diff is large: its 127 lines aren’t shown here.

net/ipv4/inet_fragment.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/ipv4/inet_timewait_sock.c+3−4

This diff is large: its 22 lines aren’t shown here.

net/ipv4/inetpeer.c+7−4

This diff is large: its 22 lines aren’t shown here.

net/ipv4/ip_fragment.c+3−2

This diff is large: its 16 lines aren’t shown here.

net/ipv4/ip_gre.c+66−22

This diff is large: its 184 lines aren’t shown here.

net/ipv4/ip_tunnel.c+9−3

This diff is large: its 26 lines aren’t shown here.

net/ipv4/ip_vti.c+3−13

This diff is large: its 35 lines aren’t shown here.

net/ipv4/ipip.c+3−4

This diff is large: its 19 lines aren’t shown here.

net/ipv4/ipmr.c+252−10

This diff is large: its 460 lines aren’t shown here.

net/ipv4/netfilter/arp_tables.c+20−2

This diff is large: its 36 lines aren’t shown here.

net/ipv4/netfilter/ip_tables.c+21−2

This diff is large: its 37 lines aren’t shown here.

net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/netfilter/nf_conntrack_proto_icmp.c+16−12

This diff is large: its 70 lines aren’t shown here.

net/ipv4/netfilter/nf_nat_l3proto_ipv4.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/ipv4/proc.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/ipv4/route.c+2−3

This diff is large: its 26 lines aren’t shown here.

net/ipv4/syncookies.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/sysctl_net_ipv4.c+271−249

This diff is large: its 650 lines aren’t shown here.

net/ipv4/tcp.c+132−35

This diff is large: its 389 lines aren’t shown here.

net/ipv4/tcp_cdg.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/tcp_cong.c+36−40

This diff is large: its 152 lines aren’t shown here.

net/ipv4/tcp_fastopen.c+101−59

This diff is large: its 328 lines aren’t shown here.

net/ipv4/tcp_input.c+266−331

This diff is large: its 1595 lines aren’t shown here.

net/ipv4/tcp_ipv4.c+64−5

This diff is large: its 142 lines aren’t shown here.

net/ipv4/tcp_metrics.c+11−11

This diff is large: its 65 lines aren’t shown here.

net/ipv4/tcp_minisocks.c+29−12

This diff is large: its 123 lines aren’t shown here.

net/ipv4/tcp_nv.c+42−5

This diff is large: its 106 lines aren’t shown here.

net/ipv4/tcp_output.c+192−132

This diff is large: its 810 lines aren’t shown here.

net/ipv4/tcp_recovery.c+65−37

This diff is large: its 135 lines aren’t shown here.

net/ipv4/tcp_timer.c+41−36

This diff is large: its 184 lines aren’t shown here.

net/ipv4/tcp_vegas.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/udp.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/ipv6/addrconf.c+200−181

This diff is large: its 978 lines aren’t shown here.

net/ipv6/addrconf_core.c+5−4

This diff is large: its 33 lines aren’t shown here.

net/ipv6/addrlabel.c+45−101

This diff is large: its 304 lines aren’t shown here.

net/ipv6/af_inet6.c+4−0

This diff is large: its 11 lines aren’t shown here.

net/ipv6/ah6.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/esp6.c+4−4

This diff is large: its 28 lines aren’t shown here.

net/ipv6/exthdrs.c+57−16

This diff is large: its 173 lines aren’t shown here.

net/ipv6/exthdrs_core.c+1−4

This diff is large: its 33 lines aren’t shown here.

net/ipv6/icmp.c+20−30

This diff is large: its 118 lines aren’t shown here.

net/ipv6/ila/ila.h+1−11

This diff is large: its 26 lines aren’t shown here.

net/ipv6/ila/ila_common.c+57−47

This diff is large: its 155 lines aren’t shown here.

net/ipv6/ila/ila_lwt.c+91−20

This diff is large: its 201 lines aren’t shown here.

net/ipv6/ila/ila_xlat.c+18−8

This diff is large: its 73 lines aren’t shown here.

net/ipv6/ip6_fib.c+370−297

This diff is large: its 1464 lines aren’t shown here.

net/ipv6/ip6_gre.c+12−16

This diff is large: its 81 lines aren’t shown here.

net/ipv6/ip6_tunnel.c+42−47

This diff is large: its 232 lines aren’t shown here.

net/ipv6/ip6_vti.c+14−9

This diff is large: its 57 lines aren’t shown here.

net/ipv6/ip6mr.c+5−0

This diff is large: its 19 lines aren’t shown here.

net/ipv6/ipv6_sockglue.c+12−0

This diff is large: its 26 lines aren’t shown here.

net/ipv6/ndisc.c+13−5

This diff is large: its 58 lines aren’t shown here.

net/ipv6/netfilter/ip6_tables.c+20−2

This diff is large: its 36 lines aren’t shown here.

net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c+15−9

This diff is large: its 58 lines aren’t shown here.

net/ipv6/netfilter/nf_conntrack_reasm.c+3−2

This diff is large: its 16 lines aren’t shown here.

net/ipv6/netfilter/nf_nat_l3proto_ipv6.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/ipv6/output_core.c+0−31

This diff is large: its 38 lines aren’t shown here.

net/ipv6/ping.c+2−3

This diff is large: its 12 lines aren’t shown here.

net/ipv6/raw.c+4−0

This diff is large: its 32 lines aren’t shown here.

net/ipv6/reassembly.c+3−2

This diff is large: its 16 lines aren’t shown here.

net/ipv6/route.c+766−174

This diff is large: its 1417 lines aren’t shown here.

net/ipv6/sit.c+27−13

This diff is large: its 117 lines aren’t shown here.

net/ipv6/syncookies.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv6/sysctl_net_ipv6.c+32−0

This diff is large: its 46 lines aren’t shown here.

net/ipv6/tcp_ipv6.c+12−5

This diff is large: its 53 lines aren’t shown here.

net/ipv6/xfrm6_policy.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/xfrm6_tunnel.c+8−0

This diff is large: its 15 lines aren’t shown here.

net/ipx/af_ipx.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/kcm/kcmsock.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/key/af_key.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/l2tp/l2tp_core.c+16−67

This diff is large: its 275 lines aren’t shown here.

net/l2tp/l2tp_core.h+8−29

This diff is large: its 75 lines aren’t shown here.

net/l2tp/l2tp_debugfs.c+1−3

This diff is large: its 18 lines aren’t shown here.

net/l2tp/l2tp_eth.c+76−30

This diff is large: its 210 lines aren’t shown here.

net/l2tp/l2tp_ip.c+1−3

This diff is large: its 18 lines aren’t shown here.

net/l2tp/l2tp_ip6.c+1−3

This diff is large: its 18 lines aren’t shown here.

net/l2tp/l2tp_netlink.c+10−14

This diff is large: its 100 lines aren’t shown here.

net/l2tp/l2tp_ppp.c+165−155

This diff is large: its 675 lines aren’t shown here.

net/lapb/lapb_iface.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/lapb/lapb_timer.c+8−10

This diff is large: its 53 lines aren’t shown here.

net/llc/llc_c_ac.c+17−10

This diff is large: its 52 lines aren’t shown here.

net/llc/llc_conn.c+4−8

This diff is large: its 25 lines aren’t shown here.

net/mac80211/Makefile+1−2

This diff is large: its 17 lines aren’t shown here.

net/mac80211/aead_api.crenamed from net/mac80211/aes_ccm.c+20−20

This diff is large: its 108 lines aren’t shown here.

net/mac80211/aead_api.h+27−0

This diff is large: its 28 lines aren’t shown here.

net/mac80211/aes_ccm.h+31−11

This diff is large: its 51 lines aren’t shown here.

net/mac80211/aes_gcm.c+0−109

This diff is large: its 110 lines aren’t shown here.

net/mac80211/aes_gcm.h+30−8

This diff is large: its 47 lines aren’t shown here.

net/mac80211/agg-rx.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/mac80211/ht.c+7−5

This diff is large: its 21 lines aren’t shown here.

net/mac80211/ieee80211_i.h+2−0

This diff is large: its 9 lines aren’t shown here.

net/mac80211/iface.c+6−23

This diff is large: its 66 lines aren’t shown here.

net/mac80211/mesh.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/mac80211/mesh.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/mac80211/mesh_hwmp.c+4−4

This diff is large: its 22 lines aren’t shown here.

net/mac80211/mesh_plink.c+5−8

This diff is large: its 43 lines aren’t shown here.

net/mac80211/mlme.c+10−23

This diff is large: its 90 lines aren’t shown here.

net/mac80211/scan.c+28−9

This diff is large: its 63 lines aren’t shown here.

net/mac80211/sta_info.c+35−26

This diff is large: its 92 lines aren’t shown here.

net/mac80211/sta_info.h+3−1

This diff is large: its 25 lines aren’t shown here.

net/mac80211/tx.c+34−0

This diff is large: its 41 lines aren’t shown here.

net/mac80211/util.c+11−14

This diff is large: its 52 lines aren’t shown here.

net/mac80211/vht.c+10−0

This diff is large: its 17 lines aren’t shown here.

net/mac80211/wpa.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/mac802154/llsec.c+10−4

This diff is large: its 32 lines aren’t shown here.

net/mpls/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

net/mpls/af_mpls.c+36−0

This diff is large: its 64 lines aren’t shown here.

net/ncsi/ncsi-aen.c+14−1

This diff is large: its 39 lines aren’t shown here.

net/ncsi/ncsi-manage.c+58−20

This diff is large: its 274 lines aren’t shown here.

net/ncsi/ncsi-rsp.c+23−18

This diff is large: its 145 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_gen.h+5−5

This diff is large: its 28 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_ip.c+2−0

This diff is large: its 16 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_ipmac.c+2−0

This diff is large: its 16 lines aren’t shown here.

net/netfilter/ipset/ip_set_bitmap_port.c+2−0

This diff is large: its 16 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_gen.h+7−5

This diff is large: its 44 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_ipportnet.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/ipset/ip_set_list_set.c+8−9

This diff is large: its 63 lines aren’t shown here.

net/netfilter/ipset/pfxlen.c+137−258

This diff is large: its 416 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_conn.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_ctl.c+6−2

This diff is large: its 35 lines aren’t shown here.

net/netfilter/nf_conntrack_core.c+10−5

This diff is large: its 44 lines aren’t shown here.

net/netfilter/nf_conntrack_h323_asn1.c+41−40

This diff is large: its 250 lines aren’t shown here.

net/netfilter/nf_conntrack_netlink.c+7−3

This diff is large: its 28 lines aren’t shown here.

net/netfilter/nf_conntrack_proto.c+82−4

This diff is large: its 130 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_dccp.c+6−15

This diff is large: its 66 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_generic.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_gre.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_sctp.c+1−3

This diff is large: its 18 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_tcp.c+28−34

This diff is large: its 165 lines aren’t shown here.

net/netfilter/nf_conntrack_proto_udp.c+19−22

This diff is large: its 107 lines aren’t shown here.

net/netfilter/nf_nat_core.c+3−6

This diff is large: its 21 lines aren’t shown here.

net/netfilter/nf_tables_api.c+132−63

This diff is large: its 223 lines aren’t shown here.

net/netfilter/nft_ct.c+3−36

This diff is large: its 67 lines aren’t shown here.

net/netfilter/nft_set_bitmap.c+18−0

This diff is large: its 32 lines aren’t shown here.

net/netfilter/nft_set_hash.c+40−1

This diff is large: its 83 lines aren’t shown here.

net/netfilter/nft_set_rbtree.c+73−0

This diff is large: its 87 lines aren’t shown here.

net/netfilter/x_tables.c+18−3

This diff is large: its 40 lines aren’t shown here.

net/netfilter/xt_bpf.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/xt_connlimit.c+20−35

This diff is large: its 142 lines aren’t shown here.

net/netlink/af_netlink.c+22−26

This diff is large: its 115 lines aren’t shown here.

net/netlink/af_netlink.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/netrom/af_netrom.c+3−3

This diff is large: its 21 lines aren’t shown here.

net/netrom/nr_in.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netrom/nr_route.c+19−43

This diff is large: its 98 lines aren’t shown here.

net/netrom/nr_timer.c+24−24

This diff is large: its 101 lines aren’t shown here.

net/nfc/core.c+4−7

This diff is large: its 33 lines aren’t shown here.

net/nfc/digital_core.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/nfc/hci/core.c+3−5

This diff is large: its 23 lines aren’t shown here.

net/nfc/hci/llc_shdlc.c+9−17

This diff is large: its 55 lines aren’t shown here.

net/nfc/llcp_core.c+6−10

This diff is large: its 46 lines aren’t shown here.

net/nfc/netlink.c+29−0

This diff is large: its 43 lines aren’t shown here.

net/nsh/nsh.c+60−0

This diff is large: its 67 lines aren’t shown here.

net/openvswitch/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

net/openvswitch/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

net/openvswitch/actions.c+126−0

This diff is large: its 168 lines aren’t shown here.

net/openvswitch/conntrack.c+12−0

This diff is large: its 26 lines aren’t shown here.

net/openvswitch/conntrack.h+7−0

This diff is large: its 21 lines aren’t shown here.

net/openvswitch/datapath.c+46−44

This diff is large: its 237 lines aren’t shown here.

net/openvswitch/datapath.h+37−2

This diff is large: its 67 lines aren’t shown here.

net/openvswitch/dp_notify.c+2−2

This diff is large: its 11 lines aren’t shown here.

net/openvswitch/flow.c+51−0

This diff is large: its 72 lines aren’t shown here.

net/openvswitch/flow.h+7−0

This diff is large: its 28 lines aren’t shown here.

net/openvswitch/flow_netlink.c+402−3

This diff is large: its 572 lines aren’t shown here.

net/openvswitch/flow_netlink.h+5−0

This diff is large: its 10 lines aren’t shown here.

net/openvswitch/meter.c+597−0

This diff is large: its 598 lines aren’t shown here.

net/openvswitch/meter.h+54−0

This diff is large: its 55 lines aren’t shown here.

net/openvswitch/vport-netdev.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/packet/af_packet.c+8−17

This diff is large: its 60 lines aren’t shown here.

net/phonet/af_phonet.c+9−8

This diff is large: its 61 lines aren’t shown here.

net/phonet/datagram.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/phonet/pep.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/phonet/pn_dev.c+3−0

This diff is large: its 11 lines aren’t shown here.

net/qrtr/qrtr.c+206−171

This diff is large: its 618 lines aren’t shown here.

net/rds/ib.c+6−5

This diff is large: its 25 lines aren’t shown here.

net/rds/ib.h+0−2

This diff is large: its 9 lines aren’t shown here.

net/rds/ib_rdma.c+2−2

This diff is large: its 14 lines aren’t shown here.

net/rose/af_rose.c+9−8

This diff is large: its 46 lines aren’t shown here.

net/rose/rose_in.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/rose/rose_link.c+7−9

This diff is large: its 48 lines aren’t shown here.

net/rose/rose_loopback.c+3−6

This diff is large: its 37 lines aren’t shown here.

net/rose/rose_route.c+6−4

This diff is large: its 38 lines aren’t shown here.

net/rose/rose_timer.c+17−22

This diff is large: its 110 lines aren’t shown here.

net/rxrpc/af_rxrpc.c+41−1

This diff is large: its 96 lines aren’t shown here.

net/rxrpc/ar-internal.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/rxrpc/call_event.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/rxrpc/call_object.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/rxrpc/input.c+1−2

This diff is large: its 17 lines aren’t shown here.

net/rxrpc/output.c+15−4

This diff is large: its 47 lines aren’t shown here.

net/rxrpc/peer_object.c+13−0

This diff is large: its 17 lines aren’t shown here.

net/rxrpc/recvmsg.c+6−1

This diff is large: its 36 lines aren’t shown here.

net/rxrpc/sendmsg.c+82−26

This diff is large: its 142 lines aren’t shown here.

net/sched/Kconfig+11−0

This diff is large: its 18 lines aren’t shown here.

net/sched/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

net/sched/act_api.c+221−0

This diff is large: its 237 lines aren’t shown here.

net/sched/act_bpf.c+2−2

This diff is large: its 14 lines aren’t shown here.

net/sched/act_ife.c+95−58

This diff is large: its 352 lines aren’t shown here.

net/sched/act_meta_mark.c+1−1

This diff is large: its 6 lines aren’t shown here.

net/sched/act_meta_skbprio.c+1−1

This diff is large: its 6 lines aren’t shown here.

net/sched/act_meta_skbtcindex.c+1−1

This diff is large: its 6 lines aren’t shown here.

net/sched/act_mirred.c+5−8

This diff is large: its 36 lines aren’t shown here.

net/sched/act_vlan.c+55−26

This diff is large: its 183 lines aren’t shown here.

net/sched/cls_api.c+264−54

This diff is large: its 555 lines aren’t shown here.

net/sched/cls_basic.c+22−16

This diff is large: its 103 lines aren’t shown here.

net/sched/cls_bpf.c+56−43

This diff is large: its 248 lines aren’t shown here.

net/sched/cls_flow.c+8−6

This diff is large: its 36 lines aren’t shown here.

net/sched/cls_flower.c+20−56

This diff is large: its 133 lines aren’t shown here.

net/sched/cls_fw.c+4−1

This diff is large: its 21 lines aren’t shown here.

net/sched/cls_matchall.c+30−28

This diff is large: its 104 lines aren’t shown here.

net/sched/cls_tcindex.c+4−1

This diff is large: its 21 lines aren’t shown here.

net/sched/cls_u32.c+105−82

This diff is large: its 387 lines aren’t shown here.

net/sched/ematch.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_api.c+5−4

This diff is large: its 31 lines aren’t shown here.

net/sched/sch_atm.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/sched/sch_cbq.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_cbs.c+373−0

This diff is large: its 374 lines aren’t shown here.

net/sched/sch_drr.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_dsmark.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sched/sch_fq_codel.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_generic.c+58−12

This diff is large: its 112 lines aren’t shown here.

net/sched/sch_hfsc.c+3−2

This diff is large: its 26 lines aren’t shown here.

net/sched/sch_htb.c+8−2

This diff is large: its 52 lines aren’t shown here.

net/sched/sch_ingress.c+42−7

This diff is large: its 107 lines aren’t shown here.

net/sched/sch_mq.c+1−9

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_mqprio.c+230−43

This diff is large: its 407 lines aren’t shown here.

net/sched/sch_multiq.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_netem.c+121−46

This diff is large: its 375 lines aren’t shown here.

net/sched/sch_pie.c+6−4

This diff is large: its 32 lines aren’t shown here.

net/sched/sch_prio.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_qfq.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_red.c+89−4

This diff is large: its 163 lines aren’t shown here.

net/sched/sch_sfb.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/sched/sch_sfq.c+7−6

This diff is large: its 43 lines aren’t shown here.

net/sctp/Makefile+2−1

This diff is large: its 10 lines aren’t shown here.

net/sctp/associola.c+1−2

This diff is large: its 10 lines aren’t shown here.

net/sctp/chunk.c+3−3

This diff is large: its 22 lines aren’t shown here.

net/sctp/outqueue.c+34−29

This diff is large: its 161 lines aren’t shown here.

net/sctp/protocol.c+3−4

This diff is large: its 22 lines aren’t shown here.

net/sctp/sm_sideeffect.c+55−33

This diff is large: its 175 lines aren’t shown here.

net/sctp/socket.c+173−6

This diff is large: its 245 lines aren’t shown here.

net/sctp/stream.c+166−36

This diff is large: its 302 lines aren’t shown here.

net/sctp/stream_sched.c+275−0

This diff is large: its 276 lines aren’t shown here.

net/sctp/stream_sched_prio.c+347−0

This diff is large: its 348 lines aren’t shown here.

net/sctp/stream_sched_rr.c+201−0

This diff is large: its 202 lines aren’t shown here.

net/sctp/transport.c+5−8

This diff is large: its 20 lines aren’t shown here.

net/smc/af_smc.c+31−11

This diff is large: its 162 lines aren’t shown here.

net/smc/smc_cdc.c+4−3

This diff is large: its 24 lines aren’t shown here.

net/smc/smc_cdc.h+2−1

This diff is large: its 10 lines aren’t shown here.

net/smc/smc_close.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/smc/smc_core.c+8−4

This diff is large: its 19 lines aren’t shown here.

net/smc/smc_ib.c+9−17

This diff is large: its 43 lines aren’t shown here.

net/smc/smc_tx.c+2−4

This diff is large: its 20 lines aren’t shown here.

net/sunrpc/sched.c+4−4

This diff is large: its 30 lines aren’t shown here.

net/sunrpc/svc.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/sunrpc/svc_xprt.c+4−5

This diff is large: its 31 lines aren’t shown here.

net/sunrpc/xprt.c+4−5

This diff is large: its 25 lines aren’t shown here.

net/switchdev/switchdev.c+2−0

This diff is large: its 9 lines aren’t shown here.

net/tipc/Makefile+1−1

This diff is large: its 9 lines aren’t shown here.

net/tipc/bcast.c+9−9

This diff is large: its 52 lines aren’t shown here.

net/tipc/core.h+5−0

This diff is large: its 12 lines aren’t shown here.

net/tipc/discover.c+3−3

This diff is large: its 21 lines aren’t shown here.

net/tipc/group.c+871−0

This diff is large: its 872 lines aren’t shown here.

net/tipc/group.h+73−0

This diff is large: its 74 lines aren’t shown here.

net/tipc/link.c+21−13

This diff is large: its 129 lines aren’t shown here.

net/tipc/monitor.c+13−4

This diff is large: its 47 lines aren’t shown here.

net/tipc/msg.c+7−0

This diff is large: its 11 lines aren’t shown here.

net/tipc/msg.h+120−8

This diff is large: its 228 lines aren’t shown here.

net/tipc/name_table.c+119−57

This diff is large: its 247 lines aren’t shown here.

net/tipc/name_table.h+20−8

This diff is large: its 54 lines aren’t shown here.

net/tipc/node.c+41−9

This diff is large: its 114 lines aren’t shown here.

net/tipc/node.h+4−1

This diff is large: its 26 lines aren’t shown here.

net/tipc/server.c+94−27

This diff is large: its 171 lines aren’t shown here.

net/tipc/server.h+4−1

This diff is large: its 18 lines aren’t shown here.

net/tipc/socket.c+651−194

This diff is large: its 1265 lines aren’t shown here.

net/tipc/subscr.c+3−3

This diff is large: its 21 lines aren’t shown here.

net/tls/tls_main.c+57−39

This diff is large: its 178 lines aren’t shown here.

net/tls/tls_sw.c+4−20

This diff is large: its 66 lines aren’t shown here.

net/unix/af_unix.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/vmw_vsock/Kconfig+10−0

This diff is large: its 17 lines aren’t shown here.

net/vmw_vsock/Makefile+3−0

This diff is large: its 16 lines aren’t shown here.

net/vmw_vsock/af_vsock.c+37−36

This diff is large: its 254 lines aren’t shown here.

net/vmw_vsock/diag.c+186−0

This diff is large: its 187 lines aren’t shown here.

net/vmw_vsock/hyperv_transport.c+6−7

This diff is large: its 48 lines aren’t shown here.

net/vmw_vsock/virtio_transport.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/vmw_vsock/virtio_transport_common.c+11−11

This diff is large: its 79 lines aren’t shown here.

net/vmw_vsock/vmci_transport.c+17−18

This diff is large: its 148 lines aren’t shown here.

net/vmw_vsock/vmci_transport_notify.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/vmw_vsock/vmci_transport_notify_qstate.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/wireless/.gitignore+2−1

This diff is large: its 4 lines aren’t shown here.

net/wireless/Kconfig+34−24

This diff is large: its 84 lines aren’t shown here.

net/wireless/Makefile+20−4

This diff is large: its 32 lines aren’t shown here.

net/wireless/certs/sforshee.x509+0−0

Binary file not shown.

net/wireless/chan.c+1−3

This diff is large: its 18 lines aren’t shown here.

net/wireless/core.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/wireless/core.h+5−0

This diff is large: its 26 lines aren’t shown here.

net/wireless/db.txt+0−17

This diff is large: its 18 lines aren’t shown here.

net/wireless/genregdb.awk+0−158

This diff is large: its 159 lines aren’t shown here.

net/wireless/nl80211.c+136−63

This diff is large: its 263 lines aren’t shown here.

net/wireless/nl80211.h+2−0

This diff is large: its 9 lines aren’t shown here.

net/wireless/reg.c+411−41

This diff is large: its 528 lines aren’t shown here.

net/wireless/reg.h+14−0

This diff is large: its 25 lines aren’t shown here.

net/wireless/regdb.h+0−23

This diff is large: its 24 lines aren’t shown here.

net/wireless/sme.c+44−1

This diff is large: its 59 lines aren’t shown here.

net/wireless/util.c+63−139

This diff is large: its 254 lines aren’t shown here.

net/x25/af_x25.c+5−4

This diff is large: its 24 lines aren’t shown here.

net/x25/x25_facilities.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/x25/x25_in.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/x25/x25_timer.c+9−9

This diff is large: its 48 lines aren’t shown here.

net/xfrm/xfrm_policy.c+8−9

This diff is large: its 50 lines aren’t shown here.

net/xfrm/xfrm_user.c+58−47

This diff is large: its 366 lines aren’t shown here.

samples/bpf/Makefile+21−5

This diff is large: its 108 lines aren’t shown here.

samples/bpf/README.rst+10−0

This diff is large: its 14 lines aren’t shown here.

samples/bpf/bpf_load.c+2−0

This diff is large: its 16 lines aren’t shown here.

samples/bpf/map_perf_test_kern.c+1−1

This diff is large: its 9 lines aren’t shown here.

samples/bpf/map_perf_test_user.c+2−1

This diff is large: its 17 lines aren’t shown here.

samples/bpf/syscall_tp_user.c+53−13

This diff is large: its 92 lines aren’t shown here.

samples/bpf/tcp_basertt_kern.c+78−0

This diff is large: its 79 lines aren’t shown here.

samples/bpf/tcp_bpf.readme+26−0

This diff is large: its 27 lines aren’t shown here.

samples/bpf/tcp_bufs_kern.c+8−6

This diff is large: its 35 lines aren’t shown here.

samples/bpf/tcp_clamp_kern.c+13−11

This diff is large: its 45 lines aren’t shown here.

samples/bpf/tcp_cong_kern.c+4−2

This diff is large: its 13 lines aren’t shown here.

samples/bpf/tcp_iw_kern.c+8−6

This diff is large: its 35 lines aren’t shown here.

samples/bpf/tcp_rwnd_kern.c+4−2

This diff is large: its 13 lines aren’t shown here.

samples/bpf/tcp_synrto_kern.c+4−2

This diff is large: its 13 lines aren’t shown here.

samples/bpf/test_cgrp2_attach2.c+219−5

This diff is large: its 245 lines aren’t shown here.

samples/bpf/trace_event_kern.c+10−0

This diff is large: its 28 lines aren’t shown here.

samples/bpf/trace_event_user.c+8−5

This diff is large: its 61 lines aren’t shown here.

samples/bpf/tracex6_kern.c+26−0

This diff is large: its 39 lines aren’t shown here.

samples/bpf/tracex6_user.c+12−1

This diff is large: its 28 lines aren’t shown here.

samples/bpf/xdp1_user.c+8−0

This diff is large: its 29 lines aren’t shown here.

samples/bpf/xdp_monitor_kern.c+46−14

This diff is large: its 82 lines aren’t shown here.

samples/bpf/xdp_monitor_user.c+95−28

This diff is large: its 235 lines aren’t shown here.

samples/bpf/xdp_redirect_cpu_kern.c+609−0

This diff is large: its 610 lines aren’t shown here.

samples/bpf/xdp_redirect_cpu_user.c+697−0

This diff is large: its 698 lines aren’t shown here.

samples/bpf/xdp_redirect_map_user.c+7−0

This diff is large: its 28 lines aren’t shown here.

samples/bpf/xdp_router_ipv4_kern.c+186−0

This diff is large: its 187 lines aren’t shown here.

samples/bpf/xdp_router_ipv4_user.c+660−0

This diff is large: its 661 lines aren’t shown here.

samples/pktgen/functions.sh+43−0

This diff is large: its 47 lines aren’t shown here.

samples/pktgen/pktgen.conf-1-1-ip6+0−61

This diff is large: its 62 lines aren’t shown here.

samples/pktgen/pktgen.conf-1-1-ip6-rdos+0−64

This diff is large: its 65 lines aren’t shown here.

samples/pktgen/pktgen.conf-1-2+0−70

This diff is large: its 71 lines aren’t shown here.

samples/pktgen/pktgen_sample03_burst_single_flow.sh+1−1

This diff is large: its 9 lines aren’t shown here.

samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh+97−0

This diff is large: its 98 lines aren’t shown here.

scripts/mod/devicetable-offsets.c+7−0

This diff is large: its 13 lines aren’t shown here.

scripts/mod/file2alias.c+25−0

This diff is large: its 32 lines aren’t shown here.

security/device_cgroup.c+24−67

This diff is large: its 191 lines aren’t shown here.

security/security.c+32−0

This diff is large: its 43 lines aren’t shown here.

security/selinux/hooks.c+160−0

This diff is large: its 202 lines aren’t shown here.

security/selinux/include/classmap.h+2−0

This diff is large: its 9 lines aren’t shown here.

security/selinux/include/objsec.h+4−0

This diff is large: its 11 lines aren’t shown here.

tools/Makefile+7−7

This diff is large: its 63 lines aren’t shown here.

tools/bpf/Makefilerenamed from tools/net/Makefile+15−3

This diff is large: its 41 lines aren’t shown here.

tools/bpf/bpf_asm.crenamed from tools/net/bpf_asm.c+0−0

File renamed without changes.

tools/bpf/bpf_dbg.crenamed from tools/net/bpf_dbg.c+0−0

File renamed without changes.

tools/bpf/bpf_exp.lrenamed from tools/net/bpf_exp.l+0−0

File renamed without changes.

tools/bpf/bpf_exp.yrenamed from tools/net/bpf_exp.y+0−0

File renamed without changes.

tools/bpf/bpf_jit_disasm.crenamed from tools/net/bpf_jit_disasm.c+2−1

This diff is large: its 17 lines aren’t shown here.

tools/bpf/bpftool/Documentation/Makefile+34−0

This diff is large: its 35 lines aren’t shown here.

tools/bpf/bpftool/Documentation/bpftool-map.rst+131−0

This diff is large: its 132 lines aren’t shown here.

tools/bpf/bpftool/Documentation/bpftool-prog.rst+150−0

This diff is large: its 151 lines aren’t shown here.

tools/bpf/bpftool/Documentation/bpftool.rst+56−0

This diff is large: its 57 lines aren’t shown here.

tools/bpf/bpftool/Makefile+92−0

This diff is large: its 93 lines aren’t shown here.

tools/bpf/bpftool/bash-completion/bpftool+354−0

This diff is large: its 355 lines aren’t shown here.

tools/bpf/bpftool/common.c+405−0

This diff is large: its 406 lines aren’t shown here.

tools/bpf/bpftool/jit_disasm.c+162−0

This diff is large: its 163 lines aren’t shown here.

tools/bpf/bpftool/json_writer.c+356−0

This diff is large: its 357 lines aren’t shown here.

tools/bpf/bpftool/json_writer.h+72−0

This diff is large: its 73 lines aren’t shown here.

tools/bpf/bpftool/main.c+331−0

This diff is large: its 332 lines aren’t shown here.

tools/bpf/bpftool/main.h+122−0

This diff is large: its 123 lines aren’t shown here.

tools/bpf/bpftool/map.c+899−0

This diff is large: its 900 lines aren’t shown here.

tools/bpf/bpftool/prog.c+703−0

This diff is large: its 704 lines aren’t shown here.

tools/include/uapi/linux/bpf.h+150−8

This diff is large: its 316 lines aren’t shown here.

tools/lib/bpf/bpf.c+76−13

This diff is large: its 164 lines aren’t shown here.

tools/lib/bpf/bpf.h+19−8

This diff is large: its 52 lines aren’t shown here.

tools/lib/bpf/libbpf.c+124−55

This diff is large: its 327 lines aren’t shown here.

tools/lib/bpf/libbpf.h+1−0

This diff is large: its 8 lines aren’t shown here.

tools/testing/selftests/bpf/Makefile+19−6

This diff is large: its 45 lines aren’t shown here.

tools/testing/selftests/bpf/bpf_helpers.h+60−7

This diff is large: its 141 lines aren’t shown here.

tools/testing/selftests/bpf/cgroup_helpers.crenamed from samples/bpf/cgroup_helpers.c+2−2

This diff is large: its 18 lines aren’t shown here.

tools/testing/selftests/bpf/cgroup_helpers.hrenamed from samples/bpf/cgroup_helpers.h+0−0

File renamed without changes.

tools/testing/selftests/bpf/dev_cgroup.c+60−0

This diff is large: its 61 lines aren’t shown here.

tools/testing/selftests/bpf/sockmap_parse_prog.c+0−3

This diff is large: its 10 lines aren’t shown here.

tools/testing/selftests/bpf/sockmap_verdict_prog.c+0−2

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/bpf/test_dev_cgroup.c+93−0

This diff is large: its 94 lines aren’t shown here.

tools/testing/selftests/bpf/test_lpm_map.c+196−5

This diff is large: its 272 lines aren’t shown here.

tools/testing/selftests/bpf/test_maps.c+48−0

This diff is large: its 62 lines aren’t shown here.

tools/testing/selftests/bpf/test_progs.c+159−36

This diff is large: its 298 lines aren’t shown here.

tools/testing/selftests/bpf/test_verifier.c+959−105

This diff is large: its 1253 lines aren’t shown here.

tools/testing/selftests/bpf/test_verifier_log.c+171−0

This diff is large: its 172 lines aren’t shown here.

tools/testing/selftests/bpf/test_xdp_meta.c+53−0

This diff is large: its 54 lines aren’t shown here.

tools/testing/selftests/bpf/test_xdp_meta.sh+51−0

This diff is large: its 52 lines aren’t shown here.

tools/testing/selftests/net/rtnetlink.sh+271−0

This diff is large: its 313 lines aren’t shown here.

tools/testing/selftests/tc-testing/.gitignore+1−0

This diff is large: its 3 lines aren’t shown here.

tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt+12−0

This diff is large: its 26 lines aren’t shown here.

tools/testing/selftests/tc-testing/creating-testcases/example.json+55−0

This diff is large: its 56 lines aren’t shown here.

tools/testing/selftests/tc-testing/creating-testcases/template.json+13−2

This diff is large: its 29 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/gact.json+469−0

This diff is large: its 470 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/ife.json+52−0

This diff is large: its 53 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json+223−0

This diff is large: its 224 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/police.json+527−0

This diff is large: its 528 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/simple.json+130−0

This diff is large: its 131 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/skbedit.json+320−0

This diff is large: its 321 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/skbmod.json+372−0

This diff is large: its 373 lines aren’t shown here.

tools/testing/selftests/tc-testing/tc-tests/actions/tests.json+0−1165

This diff is large: its 1166 lines aren’t shown here.

tools/testing/selftests/tc-testing/tdc.py+17−12

This diff is large: its 60 lines aren’t shown here.

tools/testing/selftests/tc-testing/tdc_config.py+14−0

This diff is large: its 18 lines aren’t shown here.

tools/testing/selftests/tc-testing/tdc_config_local_template.py+23−0

This diff is large: its 24 lines aren’t shown here.

tools/testing/selftests/tc-testing/tdc_helper.py+2−2

This diff is large: its 18 lines aren’t shown here.

tools/testing/vsock/.gitignore+2−0

This diff is large: its 3 lines aren’t shown here.

tools/testing/vsock/Makefile+9−0

This diff is large: its 10 lines aren’t shown here.

tools/testing/vsock/README+36−0

This diff is large: its 37 lines aren’t shown here.

tools/testing/vsock/control.c+219−0

This diff is large: its 220 lines aren’t shown here.

tools/testing/vsock/control.h+13−0

This diff is large: its 14 lines aren’t shown here.

tools/testing/vsock/timeout.c+64−0

This diff is large: its 65 lines aren’t shown here.

tools/testing/vsock/timeout.h+14−0

This diff is large: its 15 lines aren’t shown here.

tools/testing/vsock/vsock_diag_test.c+681−0

This diff is large: its 682 lines aren’t shown here.