Pull networking updates from David Miller: 1) More iov_iter conversion work from Al Viro. [ The "crypto: switch af_alg_make_sg() to iov_iter" commit was wrong, and this pull actually adds an extra commit on top of the branch I'm pulling to fix that up, so that the pre-merge state is ok. - Linus ] 2) Various optimizations to the ipv4 forwarding information base trie lookup implementation. From Alexander Duyck. 3) Remove sock_iocb altogether, from CHristoph Hellwig. 4) Allow congestion control algorithm selection via routing metrics. From Daniel Borkmann. 5) Make ipv4 uncached route list per-cpu, from Eric Dumazet. 6) Handle rfs hash collisions more gracefully, also from Eric Dumazet. 7) Add xmit_more support to r8169, e1000, and e1000e drivers. From Florian Westphal. 8) Transparent Ethernet Bridging support for GRO, from Jesse Gross. 9) Add BPF packet actions to packet scheduler, from Jiri Pirko. 10) Add support for uniqu flow IDs to openvswitch, from Joe Stringer. 11) New NetCP ethernet driver, from Muralidharan Karicheri and Wingman Kwok. 12) More sanely handle out-of-window dupacks, which can result in serious ACK storms. From Neal Cardwell. 13) Various rhashtable bug fixes and enhancements, from Herbert Xu, Patrick McHardy, and Thomas Graf. 14) Support xmit_more in be2net, from Sathya Perla. 15) Group Policy extensions for vxlan, from Thomas Graf. 16) Remove Checksum Offload support for vxlan, from Tom Herbert. 17) Like ipv4, support lockless transmit over ipv6 UDP sockets. From Vlad Yasevich. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1494+1 commits) crypto: fix af_alg_make_sg() conversion to iov_iter ipv4: Namespecify TCP PMTU mechanism i40e: Fix for stats init function call in Rx setup tcp: don't include Fast Open option in SYN-ACK on pure SYN-data openvswitch: Only set TUNNEL_VXLAN_OPT if VXLAN-GBP metadata is set ipv6: Make __ipv6_select_ident static ipv6: Fix fragment id assignment on LE arches. bridge: Fix inability to add non-vlan fdb entry net: Mellanox: Delete unnecessary checks before the function call "vunmap" cxgb4: Add support in cxgb4 to get expansion rom version via ethtool ethtool: rename reserved1 memeber in ethtool_drvinfo for expansion ROM version net: dsa: Remove redundant phy_attach() IB/mlx4: Reset flow support for IB kernel ULPs IB/mlx4: Always use the correct port for mirrored multicast attachments net/bonding: Fix potential bad memory access during bonding events tipc: remove tipc_snprintf tipc: nl compat add noop and remove legacy nl framework tipc: convert legacy nl stats show to nl compat tipc: convert legacy nl net id get to nl compat tipc: convert legacy nl net id set to nl compat ...
Unified · Split
| @@ -113,7 +113,6 @@ · 112 unmodified lines | |||
| 113 | !Finclude/net/cfg80211.h cfg80211_beacon_data | 113 | !Finclude/net/cfg80211.h cfg80211_beacon_data |
| 114 | !Finclude/net/cfg80211.h cfg80211_ap_settings | 114 | !Finclude/net/cfg80211.h cfg80211_ap_settings |
| 115 | !Finclude/net/cfg80211.h station_parameters | 115 | !Finclude/net/cfg80211.h station_parameters |
| 116 | !Finclude/net/cfg80211.h station_info_flags | ||
| 117 | !Finclude/net/cfg80211.h rate_info_flags | 116 | !Finclude/net/cfg80211.h rate_info_flags |
| 118 | !Finclude/net/cfg80211.h rate_info | 117 | !Finclude/net/cfg80211.h rate_info |
| 119 | !Finclude/net/cfg80211.h station_info | 118 | !Finclude/net/cfg80211.h station_info |
| @@ -435,7 +434,6 @@ · 315 unmodified lines | |||
| 435 | <section id="ps-client"> | 434 | <section id="ps-client"> |
| 436 | <title>support for powersaving clients</title> | 435 | <title>support for powersaving clients</title> |
| 437 | !Pinclude/net/mac80211.h AP support for powersaving clients | 436 | !Pinclude/net/mac80211.h AP support for powersaving clients |
| 438 | </section> | ||
| 439 | !Finclude/net/mac80211.h ieee80211_get_buffered_bc | 437 | !Finclude/net/mac80211.h ieee80211_get_buffered_bc |
| 440 | !Finclude/net/mac80211.h ieee80211_beacon_get | 438 | !Finclude/net/mac80211.h ieee80211_beacon_get |
| 441 | !Finclude/net/mac80211.h ieee80211_sta_eosp | 439 | !Finclude/net/mac80211.h ieee80211_sta_eosp |
| @@ -444,6 +442,7 @@ · 2 unmodified lines | |||
| 444 | !Finclude/net/mac80211.h ieee80211_sta_ps_transition_ni | 442 | !Finclude/net/mac80211.h ieee80211_sta_ps_transition_ni |
| 445 | !Finclude/net/mac80211.h ieee80211_sta_set_buffered | 443 | !Finclude/net/mac80211.h ieee80211_sta_set_buffered |
| 446 | !Finclude/net/mac80211.h ieee80211_sta_block_awake | 444 | !Finclude/net/mac80211.h ieee80211_sta_block_awake |
| 445 | </section> | ||
| 447 | </chapter> | 446 | </chapter> |
| 448 | 447 | ||
| 449 | <chapter id="multi-iface"> | 448 | <chapter id="multi-iface"> |
| @@ -488,8 +487,8 @@ · 38 unmodified lines | |||
| 488 | <title>RX A-MPDU aggregation</title> | 487 | <title>RX A-MPDU aggregation</title> |
| 489 | !Pnet/mac80211/agg-rx.c RX A-MPDU aggregation | 488 | !Pnet/mac80211/agg-rx.c RX A-MPDU aggregation |
| 490 | !Cnet/mac80211/agg-rx.c | 489 | !Cnet/mac80211/agg-rx.c |
| 491 | </sect1> | ||
| 492 | !Finclude/net/mac80211.h ieee80211_ampdu_mlme_action | 490 | !Finclude/net/mac80211.h ieee80211_ampdu_mlme_action |
| 491 | </sect1> | ||
| 493 | </chapter> | 492 | </chapter> |
| 494 | 493 | ||
| 495 | <chapter id="smps"> | 494 | <chapter id="smps"> |
| @@ -7,17 +7,38 @@ Required properties: · 6 unmodified lines | |||
| 7 | - SerDes Rx/Tx registers | 7 | - SerDes Rx/Tx registers |
| 8 | - SerDes integration registers (1/2) | 8 | - SerDes integration registers (1/2) |
| 9 | - SerDes integration registers (2/2) | 9 | - SerDes integration registers (2/2) |
| 10 | - interrupt-parent: Should be the phandle for the interrupt controller | ||
| 11 | that services interrupts for this device | ||
| 12 | - interrupts: Should contain the amd-xgbe-phy interrupt. | ||
| 10 | 13 | ||
| 11 | Optional properties: | 14 | Optional properties: |
| 12 | - amd,speed-set: Speed capabilities of the device | 15 | - amd,speed-set: Speed capabilities of the device |
| 13 | 0 - 1GbE and 10GbE (default) | 16 | 0 - 1GbE and 10GbE (default) |
| 14 | 1 - 2.5GbE and 10GbE | 17 | 1 - 2.5GbE and 10GbE |
| 15 | 18 | ||
| 19 | The following optional properties are represented by an array with each | ||
| 20 | value corresponding to a particular speed. The first array value represents | ||
| 21 | the setting for the 1GbE speed, the second value for the 2.5GbE speed and | ||
| 22 | the third value for the 10GbE speed. All three values are required if the | ||
| 23 | property is used. | ||
| 24 | - amd,serdes-blwc: Baseline wandering correction enablement | ||
| 25 | 0 - Off | ||
| 26 | 1 - On | ||
| 27 | - amd,serdes-cdr-rate: CDR rate speed selection | ||
| 28 | - amd,serdes-pq-skew: PQ (data sampling) skew | ||
| 29 | - amd,serdes-tx-amp: TX amplitude boost | ||
| 30 | |||
| 16 | Example: | 31 | Example: |
| 17 | xgbe_phy@e1240800 { | 32 | xgbe_phy@e1240800 { |
| 18 | compatible = "amd,xgbe-phy-seattle-v1a", "ethernet-phy-ieee802.3-c45"; | 33 | compatible = "amd,xgbe-phy-seattle-v1a", "ethernet-phy-ieee802.3-c45"; |
| 19 | reg = <0 0xe1240800 0 0x00400>, | 34 | reg = <0 0xe1240800 0 0x00400>, |
| 20 | <0 0xe1250000 0 0x00060>, | 35 | <0 0xe1250000 0 0x00060>, |
| 21 | <0 0xe1250080 0 0x00004>; | 36 | <0 0xe1250080 0 0x00004>; |
| 37 | interrupt-parent = <&gic>; | ||
| 38 | interrupts = <0 323 4>; | ||
| 22 | amd,speed-set = <0>; | 39 | amd,speed-set = <0>; |
| 40 | amd,serdes-blwc = <1>, <1>, <0>; | ||
| 41 | amd,serdes-cdr-rate = <2>, <2>, <7>; | ||
| 42 | amd,serdes-pq-skew = <10>, <10>, <30>; | ||
| 43 | amd,serdes-tx-amp = <15>, <15>, <10>; | ||
| 23 | }; | 44 | }; |
| @@ -11,6 +11,8 @@ Required properties: · 10 unmodified lines | |||
| 11 | Optional properties: | 11 | Optional properties: |
| 12 | - davicom,no-eeprom : Configuration EEPROM is not available | 12 | - davicom,no-eeprom : Configuration EEPROM is not available |
| 13 | - davicom,ext-phy : Use external PHY | 13 | - davicom,ext-phy : Use external PHY |
| 14 | - reset-gpios : phandle of gpio that will be used to reset chip during probe | ||
| 15 | - vcc-supply : phandle of regulator that will be used to enable power to chip | ||
| 14 | 16 | ||
| 15 | Example: | 17 | Example: |
| 16 | 18 | ||
| @@ -21,4 +23,6 @@ Example: · 4 unmodified lines | |||
| 21 | interrupts = <7 4>; | 23 | interrupts = <7 4>; |
| 22 | local-mac-address = [00 00 de ad be ef]; | 24 | local-mac-address = [00 00 de ad be ef]; |
| 23 | davicom,no-eeprom; | 25 | davicom,no-eeprom; |
| 26 | reset-gpios = <&gpf 12 GPIO_ACTIVE_LOW>; | ||
| 27 | vcc-supply = <ð0_power>; | ||
| 24 | }; | 28 | }; |
| @@ -22,6 +22,8 @@ Optional properties: · 21 unmodified lines | |||
| 22 | - fsl,num-rx-queues : The property is valid for enet-avb IP, which supports | 22 | - fsl,num-rx-queues : The property is valid for enet-avb IP, which supports |
| 23 | hw multi queues. Should specify the rx queue number, otherwise set rx queue | 23 | hw multi queues. Should specify the rx queue number, otherwise set rx queue |
| 24 | number to 1. | 24 | number to 1. |
| 25 | - fsl,magic-packet : If present, indicates that the hardware supports waking | ||
| 26 | up via magic packet. | ||
| 25 | 27 | ||
| 26 | Optional subnodes: | 28 | Optional subnodes: |
| 27 | - mdio : specifies the mdio bus in the FEC, used as a container for phy nodes | 29 | - mdio : specifies the mdio bus in the FEC, used as a container for phy nodes |
| @@ -8,7 +8,16 @@ of how to define a PHY. · 7 unmodified lines | |||
| 8 | Required properties: | 8 | Required properties: |
| 9 | - reg : Offset and length of the register set for the device | 9 | - reg : Offset and length of the register set for the device |
| 10 | - compatible : Should define the compatible device type for the | 10 | - compatible : Should define the compatible device type for the |
| 11 | mdio. Currently, this is most likely to be "fsl,gianfar-mdio" | 11 | mdio. Currently supported strings/devices are: |
| 12 | - "fsl,gianfar-tbi" | ||
| 13 | - "fsl,gianfar-mdio" | ||
| 14 | - "fsl,etsec2-tbi" | ||
| 15 | - "fsl,etsec2-mdio" | ||
| 16 | - "fsl,ucc-mdio" | ||
| 17 | - "fsl,fman-mdio" | ||
| 18 | When device_type is "mdio", the following strings are also considered: | ||
| 19 | - "gianfar" | ||
| 20 | - "ucc_geth_phy" | ||
| 12 | 21 | ||
| 13 | Example: | 22 | Example: |
| 14 | 23 | ||
| @@ -0,0 +1,88 @@ | |||
| 1 | Hisilicon hip04 Ethernet Controller | ||
| 2 | |||
| 3 | * Ethernet controller node | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | - compatible: should be "hisilicon,hip04-mac". | ||
| 7 | - reg: address and length of the register set for the device. | ||
| 8 | - interrupts: interrupt for the device. | ||
| 9 | - port-handle: <phandle port channel> | ||
| 10 | phandle, specifies a reference to the syscon ppe node | ||
| 11 | port, port number connected to the controller | ||
| 12 | channel, recv channel start from channel * number (RX_DESC_NUM) | ||
| 13 | - phy-mode: see ethernet.txt [1]. | ||
| 14 | |||
| 15 | Optional properties: | ||
| 16 | - phy-handle: see ethernet.txt [1]. | ||
| 17 | |||
| 18 | [1] Documentation/devicetree/bindings/net/ethernet.txt | ||
| 19 | |||
| 20 | |||
| 21 | * Ethernet ppe node: | ||
| 22 | Control rx & tx fifos of all ethernet controllers. | ||
| 23 | Have 2048 recv channels shared by all ethernet controllers, only if no overlap. | ||
| 24 | Each controller's recv channel start from channel * number (RX_DESC_NUM). | ||
| 25 | |||
| 26 | Required properties: | ||
| 27 | - compatible: "hisilicon,hip04-ppe", "syscon". | ||
| 28 | - reg: address and length of the register set for the device. | ||
| 29 | |||
| 30 | |||
| 31 | * MDIO bus node: | ||
| 32 | |||
| 33 | Required properties: | ||
| 34 | |||
| 35 | - compatible: should be "hisilicon,hip04-mdio". | ||
| 36 | - Inherits from MDIO bus node binding [2] | ||
| 37 | [2] Documentation/devicetree/bindings/net/phy.txt | ||
| 38 | |||
| 39 | Example: | ||
| 40 | mdio { | ||
| 41 | compatible = "hisilicon,hip04-mdio"; | ||
| 42 | reg = <0x28f1000 0x1000>; | ||
| 43 | #address-cells = <1>; | ||
| 44 | #size-cells = <0>; | ||
| 45 | |||
| 46 | phy0: ethernet-phy@0 { | ||
| 47 | compatible = "ethernet-phy-ieee802.3-c22"; | ||
| 48 | reg = <0>; | ||
| 49 | marvell,reg-init = <18 0x14 0 0x8001>; | ||
| 50 | }; | ||
| 51 | |||
| 52 | phy1: ethernet-phy@1 { | ||
| 53 | compatible = "ethernet-phy-ieee802.3-c22"; | ||
| 54 | reg = <1>; | ||
| 55 | marvell,reg-init = <18 0x14 0 0x8001>; | ||
| 56 | }; | ||
| 57 | }; | ||
| 58 | |||
| 59 | ppe: ppe@28c0000 { | ||
| 60 | compatible = "hisilicon,hip04-ppe", "syscon"; | ||
| 61 | reg = <0x28c0000 0x10000>; | ||
| 62 | }; | ||
| 63 | |||
| 64 | fe: ethernet@28b0000 { | ||
| 65 | compatible = "hisilicon,hip04-mac"; | ||
| 66 | reg = <0x28b0000 0x10000>; | ||
| 67 | interrupts = <0 413 4>; | ||
| 68 | phy-mode = "mii"; | ||
| 69 | port-handle = <&ppe 31 0>; | ||
| 70 | }; | ||
| 71 | |||
| 72 | ge0: ethernet@2800000 { | ||
| 73 | compatible = "hisilicon,hip04-mac"; | ||
| 74 | reg = <0x2800000 0x10000>; | ||
| 75 | interrupts = <0 402 4>; | ||
| 76 | phy-mode = "sgmii"; | ||
| 77 | port-handle = <&ppe 0 1>; | ||
| 78 | phy-handle = <&phy0>; | ||
| 79 | }; | ||
| 80 | |||
| 81 | ge8: ethernet@2880000 { | ||
| 82 | compatible = "hisilicon,hip04-mac"; | ||
| 83 | reg = <0x2880000 0x10000>; | ||
| 84 | interrupts = <0 410 4>; | ||
| 85 | phy-mode = "sgmii"; | ||
| 86 | port-handle = <&ppe 8 2>; | ||
| 87 | phy-handle = <&phy1>; | ||
| 88 | }; | ||
| @@ -0,0 +1,197 @@ | |||
| 1 | This document describes the device tree bindings associated with the | ||
| 2 | keystone network coprocessor(NetCP) driver support. | ||
| 3 | |||
| 4 | The network coprocessor (NetCP) is a hardware accelerator that processes | ||
| 5 | Ethernet packets. NetCP has a gigabit Ethernet (GbE) subsytem with a ethernet | ||
| 6 | switch sub-module to send and receive packets. NetCP also includes a packet | ||
| 7 | accelerator (PA) module to perform packet classification operations such as | ||
| 8 | header matching, and packet modification operations such as checksum | ||
| 9 | generation. NetCP can also optionally include a Security Accelerator (SA) | ||
| 10 | capable of performing IPSec operations on ingress/egress packets. | ||
| 11 | |||
| 12 | Keystone II SoC's also have a 10 Gigabit Ethernet Subsystem (XGbE) which | ||
| 13 | includes a 3-port Ethernet switch sub-module capable of 10Gb/s and 1Gb/s rates | ||
| 14 | per Ethernet port. | ||
| 15 | |||
| 16 | Keystone NetCP driver has a plug-in module architecture where each of the NetCP | ||
| 17 | sub-modules exist as a loadable kernel module which plug in to the netcp core. | ||
| 18 | These sub-modules are represented as "netcp-devices" in the dts bindings. It is | ||
| 19 | mandatory to have the ethernet switch sub-module for the ethernet interface to | ||
| 20 | be operational. Any other sub-module like the PA is optional. | ||
| 21 | |||
| 22 | NetCP Ethernet SubSystem Layout: | ||
| 23 | |||
| 24 | ----------------------------- | ||
| 25 | NetCP subsystem(10G or 1G) | ||
| 26 | ----------------------------- | ||
| 27 | | | ||
| 28 | |-> NetCP Devices -> | | ||
| 29 | | |-> GBE/XGBE Switch | ||
| 30 | | | | ||
| 31 | | |-> Packet Accelerator | ||
| 32 | | | | ||
| 33 | | |-> Security Accelerator | ||
| 34 | | | ||
| 35 | | | ||
| 36 | | | ||
| 37 | |-> NetCP Interfaces -> | | ||
| 38 | |-> Ethernet Port 0 | ||
| 39 | | | ||
| 40 | |-> Ethernet Port 1 | ||
| 41 | | | ||
| 42 | |-> Ethernet Port 2 | ||
| 43 | | | ||
| 44 | |-> Ethernet Port 3 | ||
| 45 | |||
| 46 | |||
| 47 | NetCP subsystem properties: | ||
| 48 | Required properties: | ||
| 49 | - compatible: Should be "ti,netcp-1.0" | ||
| 50 | - clocks: phandle to the reference clocks for the subsystem. | ||
| 51 | - dma-id: Navigator packet dma instance id. | ||
| 52 | |||
| 53 | Optional properties: | ||
| 54 | - reg: register location and the size for the following register | ||
| 55 | regions in the specified order. | ||
| 56 | - Efuse MAC address register | ||
| 57 | - dma-coherent: Present if dma operations are coherent | ||
| 58 | - big-endian: Keystone devices can be operated in a mode where the DSP is in | ||
| 59 | the big endian mode. In such cases enable this option. This | ||
| 60 | option should also be enabled if the ARM is operated in | ||
| 61 | big endian mode with the DSP in little endian. | ||
| 62 | |||
| 63 | NetCP device properties: Device specification for NetCP sub-modules. | ||
| 64 | 1Gb/10Gb (gbe/xgbe) ethernet switch sub-module specifications. | ||
| 65 | Required properties: | ||
| 66 | - label: Must be "netcp-gbe" for 1Gb & "netcp-xgbe" for 10Gb. | ||
| 67 | - reg: register location and the size for the following register | ||
| 68 | regions in the specified order. | ||
| 69 | - subsystem registers | ||
| 70 | - serdes registers | ||
| 71 | - tx-channel: the navigator packet dma channel name for tx. | ||
| 72 | - tx-queue: the navigator queue number associated with the tx dma channel. | ||
| 73 | - interfaces: specification for each of the switch port to be registered as a | ||
| 74 | network interface in the stack. | ||
| 75 | -- slave-port: Switch port number, 0 based numbering. | ||
| 76 | -- link-interface: type of link interface, supported options are | ||
| 77 | - mac<->mac auto negotiate mode: 0 | ||
| 78 | - mac<->phy mode: 1 | ||
| 79 | - mac<->mac forced mode: 2 | ||
| 80 | - mac<->fiber mode: 3 | ||
| 81 | - mac<->phy mode with no mdio: 4 | ||
| 82 | - 10Gb mac<->phy mode : 10 | ||
| 83 | - 10Gb mac<->mac forced mode : 11 | ||
| 84 | ----phy-handle: phandle to PHY device | ||
| 85 | |||
| 86 | Optional properties: | ||
| 87 | - enable-ale: NetCP driver keeps the address learning feature in the ethernet | ||
| 88 | switch module disabled. This attribute is to enable the address | ||
| 89 | learning. | ||
| 90 | - secondary-slave-ports: specification for each of the switch port not be | ||
| 91 | registered as a network interface. NetCP driver | ||
| 92 | will only initialize these ports and attach PHY | ||
| 93 | driver to them if needed. | ||
| 94 | |||
| 95 | NetCP interface properties: Interface specification for NetCP sub-modules. | ||
| 96 | Required properties: | ||
| 97 | - rx-channel: the navigator packet dma channel name for rx. | ||
| 98 | - rx-queue: the navigator queue number associated with rx dma channel. | ||
| 99 | - rx-pool: specifies the number of descriptors to be used & the region-id | ||
| 100 | for creating the rx descriptor pool. | ||
| 101 | - tx-pool: specifies the number of descriptors to be used & the region-id | ||
| 102 | for creating the tx descriptor pool. | ||
| 103 | - rx-queue-depth: number of descriptors in each of the free descriptor | ||
| 104 | queue (FDQ) for the pktdma Rx flow. There can be at | ||
| 105 | present a maximum of 4 queues per Rx flow. | ||
| 106 | - rx-buffer-size: the buffer size for each of the Rx flow FDQ. | ||
| 107 | - tx-completion-queue: the navigator queue number where the descriptors are | ||
| 108 | recycled after Tx DMA completion. | ||
| 109 | |||
| 110 | Optional properties: | ||
| 111 | - efuse-mac: If this is 1, then the MAC address for the interface is | ||
| 112 | obtained from the device efuse mac address register | ||
| 113 | - local-mac-address: the driver is designed to use the of_get_mac_address api | ||
| 114 | only if efuse-mac is 0. When efuse-mac is 0, the MAC | ||
| 115 | address is obtained from local-mac-address. If this | ||
| 116 | attribute is not present, then the driver will use a | ||
| 117 | random MAC address. | ||
| 118 | - "netcp-device label": phandle to the device specification for each of NetCP | ||
| 119 | sub-module attached to this interface. | ||
| 120 | |||
| 121 | Example binding: | ||
| 122 | |||
| 123 | netcp: netcp@2090000 { | ||
| 124 | reg = <0x2620110 0x8>; | ||
| 125 | reg-names = "efuse"; | ||
| 126 | compatible = "ti,netcp-1.0"; | ||
| 127 | #address-cells = <1>; | ||
| 128 | #size-cells = <1>; | ||
| 129 | ranges; | ||
| 130 | |||
| 131 | clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>; | ||
| 132 | dma-coherent; | ||
| 133 | /* big-endian; */ | ||
| 134 | dma-id = <0>; | ||
| 135 | |||
| 136 | netcp-devices { | ||
| 137 | #address-cells = <1>; | ||
| 138 | #size-cells = <1>; | ||
| 139 | ranges; | ||
| 140 | gbe@0x2090000 { | ||
| 141 | label = "netcp-gbe"; | ||
| 142 | reg = <0x2090000 0xf00>; | ||
| 143 | /* enable-ale; */ | ||
| 144 | tx-queue = <648>; | ||
| 145 | tx-channel = <8>; | ||
| 146 | |||
| 147 | interfaces { | ||
| 148 | gbe0: interface-0 { | ||
| 149 | slave-port = <0>; | ||
| 150 | link-interface = <4>; | ||
| 151 | }; | ||
| 152 | gbe1: interface-1 { | ||
| 153 | slave-port = <1>; | ||
| 154 | link-interface = <4>; | ||
| 155 | }; | ||
| 156 | }; | ||
| 157 | |||
| 158 | secondary-slave-ports { | ||
| 159 | port-2 { | ||
| 160 | slave-port = <2>; | ||
| 161 | link-interface = <2>; | ||
| 162 | }; | ||
| 163 | port-3 { | ||
| 164 | slave-port = <3>; | ||
| 165 | link-interface = <2>; | ||
| 166 | }; | ||
| 167 | }; | ||
| 168 | }; | ||
| 169 | }; | ||
| 170 | |||
| 171 | netcp-interfaces { | ||
| 172 | interface-0 { | ||
| 173 | rx-channel = <22>; | ||
| 174 | rx-pool = <1024 12>; | ||
| 175 | tx-pool = <1024 12>; | ||
| 176 | rx-queue-depth = <128 128 0 0>; | ||
| 177 | rx-buffer-size = <1518 4096 0 0>; | ||
| 178 | rx-queue = <8704>; | ||
| 179 | tx-completion-queue = <8706>; | ||
| 180 | efuse-mac = <1>; | ||
| 181 | netcp-gbe = <&gbe0>; | ||
| 182 | |||
| 183 | }; | ||
| 184 | interface-1 { | ||
| 185 | rx-channel = <23>; | ||
| 186 | rx-pool = <1024 12>; | ||
| 187 | tx-pool = <1024 12>; | ||
| 188 | rx-queue-depth = <128 128 0 0>; | ||
| 189 | rx-buffer-size = <1518 4096 0 0>; | ||
| 190 | rx-queue = <8705>; | ||
| 191 | tx-completion-queue = <8707>; | ||
| 192 | efuse-mac = <0>; | ||
| 193 | local-mac-address = [02 18 31 7e 3e 6f]; | ||
| 194 | netcp-gbe = <&gbe1>; | ||
| 195 | }; | ||
| 196 | }; | ||
| 197 | }; | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | * STMicroelectronics SAS. ST21NFCA NFC Controller | 1 | * STMicroelectronics SAS. ST21NFCA NFC Controller |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: Should be "st,st21nfca_i2c". | 4 | - compatible: Should be "st,st21nfca-i2c". |
| 5 | - clock-frequency: I²C work frequency. | 5 | - clock-frequency: I²C work frequency. |
| 6 | - reg: address on the bus | 6 | - reg: address on the bus |
| 7 | - interrupt-parent: phandle for the interrupt gpio controller | 7 | - interrupt-parent: phandle for the interrupt gpio controller |
| @@ -11,6 +11,10 @@ Required properties: · 3 unmodified lines | |||
| 11 | Optional SoC Specific Properties: | 11 | Optional SoC Specific Properties: |
| 12 | - pinctrl-names: Contains only one value - "default". | 12 | - pinctrl-names: Contains only one value - "default". |
| 13 | - pintctrl-0: Specifies the pin control groups used for this controller. | 13 | - pintctrl-0: Specifies the pin control groups used for this controller. |
| 14 | - ese-present: Specifies that an ese is physically connected to the nfc | ||
| 15 | controller. | ||
| 16 | - uicc-present: Specifies that the uicc swp signal can be physically | ||
| 17 | connected to the nfc controller. | ||
| 14 | 18 | ||
| 15 | Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): | 19 | Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): |
| 16 | 20 | ||
| @@ -20,7 +24,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): · 3 unmodified lines | |||
| 20 | 24 | ||
| 21 | st21nfca: st21nfca@1 { | 25 | st21nfca: st21nfca@1 { |
| 22 | 26 | ||
| 23 | compatible = "st,st21nfca_i2c"; | 27 | compatible = "st,st21nfca-i2c"; |
| 24 | 28 | ||
| 25 | reg = <0x01>; | 29 | reg = <0x01>; |
| 26 | clock-frequency = <400000>; | 30 | clock-frequency = <400000>; |
| @@ -29,5 +33,8 @@ Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2): · 2 unmodified lines | |||
| 29 | interrupts = <2 IRQ_TYPE_LEVEL_LOW>; | 33 | interrupts = <2 IRQ_TYPE_LEVEL_LOW>; |
| 30 | 34 | ||
| 31 | enable-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>; | 35 | enable-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>; |
| 36 | |||
| 37 | ese-present; | ||
| 38 | uicc-present; | ||
| 32 | }; | 39 | }; |
| 33 | }; | 40 | }; |
| @@ -1,7 +1,7 @@ | |||
| 1 | * STMicroelectronics SAS. ST21NFCB NFC Controller | 1 | * STMicroelectronics SAS. ST21NFCB NFC Controller |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: Should be "st,st21nfcb_i2c". | 4 | - compatible: Should be "st,st21nfcb-i2c". |
| 5 | - clock-frequency: I²C work frequency. | 5 | - clock-frequency: I²C work frequency. |
| 6 | - reg: address on the bus | 6 | - reg: address on the bus |
| 7 | - interrupt-parent: phandle for the interrupt gpio controller | 7 | - interrupt-parent: phandle for the interrupt gpio controller |
| @@ -20,7 +20,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCB on I2C2): · 12 unmodified lines | |||
| 20 | 20 | ||
| 21 | st21nfcb: st21nfcb@8 { | 21 | st21nfcb: st21nfcb@8 { |
| 22 | 22 | ||
| 23 | compatible = "st,st21nfcb_i2c"; | 23 | compatible = "st,st21nfcb-i2c"; |
| 24 | 24 | ||
| 25 | reg = <0x08>; | 25 | reg = <0x08>; |
| 26 | clock-frequency = <400000>; | 26 | clock-frequency = <400000>; |
| @@ -0,0 +1,68 @@ | |||
| 1 | Rockchip SoC RK3288 10/100/1000 Ethernet driver(GMAC) | ||
| 2 | |||
| 3 | The device node has following properties. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | - compatible: Can be "rockchip,rk3288-gmac". | ||
| 7 | - reg: addresses and length of the register sets for the device. | ||
| 8 | - interrupts: Should contain the GMAC interrupts. | ||
| 9 | - interrupt-names: Should contain the interrupt names "macirq". | ||
| 10 | - rockchip,grf: phandle to the syscon grf used to control speed and mode. | ||
| 11 | - clocks: <&cru SCLK_MAC>: clock selector for main clock, from PLL or PHY. | ||
| 12 | <&cru SCLK_MAC_PLL>: PLL clock for SCLK_MAC | ||
| 13 | <&cru SCLK_MAC_RX>: clock gate for RX | ||
| 14 | <&cru SCLK_MAC_TX>: clock gate for TX | ||
| 15 | <&cru SCLK_MACREF>: clock gate for RMII referce clock | ||
| 16 | <&cru SCLK_MACREF_OUT> clock gate for RMII reference clock output | ||
| 17 | <&cru ACLK_GMAC>: AXI clock gate for GMAC | ||
| 18 | <&cru PCLK_GMAC>: APB clock gate for GMAC | ||
| 19 | - clock-names: One name for each entry in the clocks property. | ||
| 20 | - phy-mode: See ethernet.txt file in the same directory. | ||
| 21 | - pinctrl-names: Names corresponding to the numbered pinctrl states. | ||
| 22 | - pinctrl-0: pin-control mode. can be <&rgmii_pins> or <&rmii_pins>. | ||
| 23 | - clock_in_out: For RGMII, it must be "input", means main clock(125MHz) | ||
| 24 | is not sourced from SoC's PLL, but input from PHY; For RMII, "input" means | ||
| 25 | PHY provides the reference clock(50MHz), "output" means GMAC provides the | ||
| 26 | reference clock. | ||
| 27 | - snps,reset-gpio gpio number for phy reset. | ||
| 28 | - snps,reset-active-low boolean flag to indicate if phy reset is active low. | ||
| 29 | - assigned-clocks: main clock, should be <&cru SCLK_MAC>; | ||
| 30 | - assigned-clock-parents = parent of main clock. | ||
| 31 | can be <&ext_gmac> or <&cru SCLK_MAC_PLL>. | ||
| 32 | |||
| 33 | Optional properties: | ||
| 34 | - tx_delay: Delay value for TXD timing. Range value is 0~0x7F, 0x30 as default. | ||
| 35 | - rx_delay: Delay value for RXD timing. Range value is 0~0x7F, 0x10 as default. | ||
| 36 | - phy-supply: phandle to a regulator if the PHY needs one | ||
| 37 | |||
| 38 | Example: | ||
| 39 | |||
| 40 | gmac: ethernet@ff290000 { | ||
| 41 | compatible = "rockchip,rk3288-gmac"; | ||
| 42 | reg = <0xff290000 0x10000>; | ||
| 43 | interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>; | ||
| 44 | interrupt-names = "macirq"; | ||
| 45 | rockchip,grf = <&grf>; | ||
| 46 | clocks = <&cru SCLK_MAC>, | ||
| 47 | <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>, | ||
| 48 | <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>, | ||
| 49 | <&cru ACLK_GMAC>, <&cru PCLK_GMAC>; | ||
| 50 | clock-names = "stmmaceth", | ||
| 51 | "mac_clk_rx", "mac_clk_tx", | ||
| 52 | "clk_mac_ref", "clk_mac_refout", | ||
| 53 | "aclk_mac", "pclk_mac"; | ||
| 54 | phy-mode = "rgmii"; | ||
| 55 | pinctrl-names = "default"; | ||
| 56 | pinctrl-0 = <&rgmii_pins /*&rmii_pins*/>; | ||
| 57 | |||
| 58 | clock_in_out = "input"; | ||
| 59 | snps,reset-gpio = <&gpio4 7 0>; | ||
| 60 | snps,reset-active-low; | ||
| 61 | |||
| 62 | assigned-clocks = <&cru SCLK_MAC>; | ||
| 63 | assigned-clock-parents = <&ext_gmac>; | ||
| 64 | tx_delay = <0x30>; | ||
| 65 | rx_delay = <0x10>; | ||
| 66 | |||
| 67 | status = "ok"; | ||
| 68 | }; | ||
| @@ -9,14 +9,10 @@ The device node has following properties. · 8 unmodified lines | |||
| 9 | Required properties: | 9 | Required properties: |
| 10 | - compatible : Can be "st,stih415-dwmac", "st,stih416-dwmac", | 10 | - compatible : Can be "st,stih415-dwmac", "st,stih416-dwmac", |
| 11 | "st,stih407-dwmac", "st,stid127-dwmac". | 11 | "st,stih407-dwmac", "st,stid127-dwmac". |
| 12 | - reg : Offset of the glue configuration register map in system | 12 | - st,syscon : Should be phandle/offset pair. The phandle to the syscon node which |
| 13 | configuration regmap pointed by st,syscon property and size. | 13 | encompases the glue register, and the offset of the control register. |
| 14 | - st,syscon : Should be phandle to system configuration node which | ||
| 15 | encompases this glue registers. | ||
| 16 | - st,gmac_en: this is to enable the gmac into a dedicated sysctl control | 14 | - st,gmac_en: this is to enable the gmac into a dedicated sysctl control |
| 17 | register available on STiH407 SoC. | 15 | register available on STiH407 SoC. |
| 18 | - sti-ethconf: this is the gmac glue logic register to enable the GMAC, | ||
| 19 | select among the different modes and program the clk retiming. | ||
| 20 | - pinctrl-0: pin-control for all the MII mode supported. | 16 | - pinctrl-0: pin-control for all the MII mode supported. |
| 21 | 17 | ||
| 22 | Optional properties: | 18 | Optional properties: |
| @@ -40,10 +36,10 @@ ethernet0: dwmac@9630000 { · 17 unmodified lines | |||
| 40 | device_type = "network"; | 36 | device_type = "network"; |
| 41 | status = "disabled"; | 37 | status = "disabled"; |
| 42 | compatible = "st,stih407-dwmac", "snps,dwmac", "snps,dwmac-3.710"; | 38 | compatible = "st,stih407-dwmac", "snps,dwmac", "snps,dwmac-3.710"; |
| 43 | reg = <0x9630000 0x8000>, <0x80 0x4>; | 39 | reg = <0x9630000 0x8000>; |
| 44 | reg-names = "stmmaceth", "sti-ethconf"; | 40 | reg-names = "stmmaceth"; |
| 45 | 41 | ||
| 46 | st,syscon = <&syscfg_sbc_reg>; | 42 | st,syscon = <&syscfg_sbc_reg 0x80>; |
| 47 | st,gmac_en; | 43 | st,gmac_en; |
| 48 | resets = <&softreset STIH407_ETH1_SOFTRESET>; | 44 | resets = <&softreset STIH407_ETH1_SOFTRESET>; |
| 49 | reset-names = "stmmaceth"; | 45 | reset-names = "stmmaceth"; |
| @@ -43,6 +43,7 @@ Optional properties: · 42 unmodified lines | |||
| 43 | available this clock is used for programming the Timestamp Addend Register. | 43 | available this clock is used for programming the Timestamp Addend Register. |
| 44 | If not passed then the system clock will be used and this is fine on some | 44 | If not passed then the system clock will be used and this is fine on some |
| 45 | platforms. | 45 | platforms. |
| 46 | - snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register. | ||
| 46 | 47 | ||
| 47 | Examples: | 48 | Examples: |
| 48 | 49 | ||
| @@ -0,0 +1,30 @@ | |||
| 1 | * Qualcomm Atheros ath10k wireless devices | ||
| 2 | |||
| 3 | For ath10k devices the calibration data can be provided through Device | ||
| 4 | Tree. The node is a child node of the PCI controller. | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | -compatible : Should be "qcom,ath10k" | ||
| 8 | |||
| 9 | Optional properties: | ||
| 10 | - qcom,ath10k-calibration-data : calibration data as an array, the | ||
| 11 | length can vary between hw versions | ||
| 12 | |||
| 13 | |||
| 14 | Example: | ||
| 15 | |||
| 16 | pci { | ||
| 17 | pcie@0 { | ||
| 18 | reg = <0 0 0 0 0>; | ||
| 19 | #interrupt-cells = <1>; | ||
| 20 | #size-cells = <2>; | ||
| 21 | #address-cells = <3>; | ||
| 22 | device_type = "pci"; | ||
| 23 | |||
| 24 | ath10k@0,0 { | ||
| 25 | reg = <0 0 0 0 0>; | ||
| 26 | device_type = "pci"; | ||
| 27 | qcom,ath10k-calibration-data = [ 01 02 03 ... ]; | ||
| 28 | }; | ||
| 29 | }; | ||
| 30 | }; | ||
| @@ -6,8 +6,10 @@ for SATA and PCIe. · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | Required properties (controller (parent) node): | 7 | Required properties (controller (parent) node): |
| 8 | - compatible : Should be "st,miphy365x-phy" | 8 | - compatible : Should be "st,miphy365x-phy" |
| 9 | - st,syscfg : Should be a phandle of the system configuration register group | 9 | - st,syscfg : Phandle / integer array property. Phandle of sysconfig group |
| 10 | which contain the SATA, PCIe mode setting bits | 10 | containing the miphy registers and integer array should contain |
| 11 | an entry for each port sub-node, specifying the control | ||
| 12 | register offset inside the sysconfig group. | ||
| 11 | 13 | ||
| 12 | Required nodes : A sub-node is required for each channel the controller | 14 | Required nodes : A sub-node is required for each channel the controller |
| 13 | provides. Address range information including the usual | 15 | provides. Address range information including the usual |
| @@ -26,7 +28,6 @@ Required properties (port (child) node): · 12 unmodified lines | |||
| 26 | registers filled in "reg": | 28 | registers filled in "reg": |
| 27 | - sata: For SATA devices | 29 | - sata: For SATA devices |
| 28 | - pcie: For PCIe devices | 30 | - pcie: For PCIe devices |
| 29 | - syscfg: To specify the syscfg based config register | ||
| 30 | 31 | ||
| 31 | Optional properties (port (child) node): | 32 | Optional properties (port (child) node): |
| 32 | - st,sata-gen : Generation of locally attached SATA IP. Expected values | 33 | - st,sata-gen : Generation of locally attached SATA IP. Expected values |
| @@ -39,20 +40,20 @@ Example: · 6 unmodified lines | |||
| 39 | 40 | ||
| 40 | miphy365x_phy: miphy365x@fe382000 { | 41 | miphy365x_phy: miphy365x@fe382000 { |
| 41 | compatible = "st,miphy365x-phy"; | 42 | compatible = "st,miphy365x-phy"; |
| 42 | st,syscfg = <&syscfg_rear>; | 43 | st,syscfg = <&syscfg_rear 0x824 0x828>; |
| 43 | #address-cells = <1>; | 44 | #address-cells = <1>; |
| 44 | #size-cells = <1>; | 45 | #size-cells = <1>; |
| 45 | ranges; | 46 | ranges; |
| 46 | 47 | ||
| 47 | phy_port0: port@fe382000 { | 48 | phy_port0: port@fe382000 { |
| 48 | reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>; | 49 | reg = <0xfe382000 0x100>, <0xfe394000 0x100>; |
| 49 | reg-names = "sata", "pcie", "syscfg"; | 50 | reg-names = "sata", "pcie"; |
| 50 | #phy-cells = <1>; | 51 | #phy-cells = <1>; |
| 51 | st,sata-gen = <3>; | 52 | st,sata-gen = <3>; |
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | phy_port1: port@fe38a000 { | 55 | phy_port1: port@fe38a000 { |
| 55 | reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>;; | 56 | reg = <0xfe38a000 0x100>, <0xfe804000 0x100>;; |
| 56 | reg-names = "sata", "pcie", "syscfg"; | 57 | reg-names = "sata", "pcie", "syscfg"; |
| 57 | #phy-cells = <1>; | 58 | #phy-cells = <1>; |
| 58 | st,pcie-tx-pol-inv; | 59 | st,pcie-tx-pol-inv; |
| @@ -5,10 +5,7 @@ host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC fa · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | Required properties: | 6 | Required properties: |
| 7 | - compatible : should be "st,stih407-usb2-phy" | 7 | - compatible : should be "st,stih407-usb2-phy" |
| 8 | - reg : contain the offset and length of the system configuration registers | 8 | - st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets |
| 9 | used as glue logic to control & parameter phy | ||
| 10 | - reg-names : the names of the system configuration registers in "reg", should be "param" and "reg" | ||
| 11 | - st,syscfg : sysconfig register to manage phy parameter at driver level | ||
| 12 | - resets : list of phandle and reset specifier pairs. There should be two entries, one | 9 | - resets : list of phandle and reset specifier pairs. There should be two entries, one |
| 13 | for the whole phy and one for the port | 10 | for the whole phy and one for the port |
| 14 | - reset-names : list of reset signal names. Should be "global" and "port" | 11 | - reset-names : list of reset signal names. Should be "global" and "port" |
| @@ -19,11 +16,8 @@ Example: · 4 unmodified lines | |||
| 19 | 16 | ||
| 20 | usb2_picophy0: usbpicophy@f8 { | 17 | usb2_picophy0: usbpicophy@f8 { |
| 21 | compatible = "st,stih407-usb2-phy"; | 18 | compatible = "st,stih407-usb2-phy"; |
| 22 | reg = <0xf8 0x04>, /* syscfg 5062 */ | ||
| 23 | <0xf4 0x04>; /* syscfg 5061 */ | ||
| 24 | reg-names = "param", "ctrl"; | ||
| 25 | #phy-cells = <0>; | 19 | #phy-cells = <0>; |
| 26 | st,syscfg = <&syscfg_core>; | 20 | st,syscfg = <&syscfg_core 0x100 0xf4>; |
| 27 | resets = <&softreset STIH407_PICOPHY_SOFTRESET>, | 21 | resets = <&softreset STIH407_PICOPHY_SOFTRESET>, |
| 28 | <&picophyreset STIH407_PICOPHY0_RESET>; | 22 | <&picophyreset STIH407_PICOPHY0_RESET>; |
| 29 | reset-names = "global", "port"; | 23 | reset-names = "global", "port"; |
| @@ -3210,6 +3210,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 3209 unmodified lines | |||
| 3210 | 3210 | ||
| 3211 | retain_initrd [RAM] Keep initrd memory after extraction | 3211 | retain_initrd [RAM] Keep initrd memory after extraction |
| 3212 | 3212 | ||
| 3213 | rfkill.default_state= | ||
| 3214 | 0 "airplane mode". All wifi, bluetooth, wimax, gps, fm, | ||
| 3215 | etc. communication is blocked by default. | ||
| 3216 | 1 Unblocked. | ||
| 3217 | |||
| 3218 | rfkill.master_switch_mode= | ||
| 3219 | 0 The "airplane mode" button does nothing. | ||
| 3220 | 1 The "airplane mode" button toggles between everything | ||
| 3221 | blocked and the previous configuration. | ||
| 3222 | 2 The "airplane mode" button toggles between everything | ||
| 3223 | blocked and everything unblocked. | ||
| 3224 | |||
| 3213 | rhash_entries= [KNL,NET] | 3225 | rhash_entries= [KNL,NET] |
| 3214 | Set number of hash buckets for route cache | 3226 | Set number of hash buckets for route cache |
| 3215 | 3227 | ||
| @@ -279,8 +279,8 @@ Possible BPF extensions are shown in the following table: · 278 unmodified lines | |||
| 279 | hatype skb->dev->type | 279 | hatype skb->dev->type |
| 280 | rxhash skb->hash | 280 | rxhash skb->hash |
| 281 | cpu raw_smp_processor_id() | 281 | cpu raw_smp_processor_id() |
| 282 | vlan_tci vlan_tx_tag_get(skb) | 282 | vlan_tci skb_vlan_tag_get(skb) |
| 283 | vlan_pr vlan_tx_tag_present(skb) | 283 | vlan_pr skb_vlan_tag_present(skb) |
| 284 | rand prandom_u32() | 284 | rand prandom_u32() |
| 285 | 285 | ||
| 286 | These extensions can also be prefixed with '#'. | 286 | These extensions can also be prefixed with '#'. |
| @@ -290,6 +290,28 @@ tcp_frto - INTEGER · 289 unmodified lines | |||
| 290 | 290 | ||
| 291 | By default it's enabled with a non-zero value. 0 disables F-RTO. | 291 | By default it's enabled with a non-zero value. 0 disables F-RTO. |
| 292 | 292 | ||
| 293 | tcp_invalid_ratelimit - INTEGER | ||
| 294 | Limit the maximal rate for sending duplicate acknowledgments | ||
| 295 | in response to incoming TCP packets that are for an existing | ||
| 296 | connection but that are invalid due to any of these reasons: | ||
| 297 | |||
| 298 | (a) out-of-window sequence number, | ||
| 299 | (b) out-of-window acknowledgment number, or | ||
| 300 | (c) PAWS (Protection Against Wrapped Sequence numbers) check failure | ||
| 301 | |||
| 302 | This can help mitigate simple "ack loop" DoS attacks, wherein | ||
| 303 | a buggy or malicious middlebox or man-in-the-middle can | ||
| 304 | rewrite TCP header fields in manner that causes each endpoint | ||
| 305 | to think that the other is sending invalid TCP segments, thus | ||
| 306 | causing each side to send an unterminating stream of duplicate | ||
| 307 | acknowledgments for invalid segments. | ||
| 308 | |||
| 309 | Using 0 disables rate-limiting of dupacks in response to | ||
| 310 | invalid segments; otherwise this value specifies the minimal | ||
| 311 | space between sending such dupacks, in milliseconds. | ||
| 312 | |||
| 313 | Default: 500 (milliseconds). | ||
| 314 | |||
| 293 | tcp_keepalive_time - INTEGER | 315 | tcp_keepalive_time - INTEGER |
| 294 | How often TCP sends out keepalive messages when keepalive is enabled. | 316 | How often TCP sends out keepalive messages when keepalive is enabled. |
| 295 | Default: 2hours. | 317 | Default: 2hours. |
| @@ -1287,6 +1309,13 @@ accept_ra_rtr_pref - BOOLEAN · 991 unmodified lines | |||
| 1287 | Functional default: enabled if accept_ra is enabled. | 1309 | Functional default: enabled if accept_ra is enabled. |
| 1288 | disabled if accept_ra is disabled. | 1310 | disabled if accept_ra is disabled. |
| 1289 | 1311 | ||
| 1312 | accept_ra_mtu - BOOLEAN | ||
| 1313 | Apply the MTU value specified in RA option 5 (RFC4861). If | ||
| 1314 | disabled, the MTU specified in the RA will be ignored. | ||
| 1315 | |||
| 1316 | Functional default: enabled if accept_ra is enabled. | ||
| 1317 | disabled if accept_ra is disabled. | ||
| 1318 | |||
| 1290 | accept_redirects - BOOLEAN | 1319 | accept_redirects - BOOLEAN |
| 1291 | Accept Redirects. | 1320 | Accept Redirects. |
| 1292 | 1321 | ||
| @@ -11,7 +11,8 @@ nf_conntrack_buckets - INTEGER (read-only) · 10 unmodified lines | |||
| 11 | Size of hash table. If not specified as parameter during module | 11 | Size of hash table. If not specified as parameter during module |
| 12 | loading, the default size is calculated by dividing total memory | 12 | loading, the default size is calculated by dividing total memory |
| 13 | by 16384 to determine the number of buckets but the hash table will | 13 | by 16384 to determine the number of buckets but the hash table will |
| 14 | never have fewer than 32 or more than 16384 buckets. | 14 | never have fewer than 32 and limited to 16384 buckets. For systems |
| 15 | with more than 4GB of memory it will be 65536 buckets. | ||
| 15 | 16 | ||
| 16 | nf_conntrack_checksum - BOOLEAN | 17 | nf_conntrack_checksum - BOOLEAN |
| 17 | 0 - disabled | 18 | 0 - disabled |
| @@ -131,6 +131,19 @@ performs best-effort detection of overlapping wildcarded flows and may reject · 130 unmodified lines | |||
| 131 | some but not all of them. However, this behavior may change in future versions. | 131 | some but not all of them. However, this behavior may change in future versions. |
| 132 | 132 | ||
| 133 | 133 | ||
| 134 | Unique flow identifiers | ||
| 135 | ----------------------- | ||
| 136 | |||
| 137 | An alternative to using the original match portion of a key as the handle for | ||
| 138 | flow identification is a unique flow identifier, or "UFID". UFIDs are optional | ||
| 139 | for both the kernel and user space program. | ||
| 140 | |||
| 141 | User space programs that support UFID are expected to provide it during flow | ||
| 142 | setup in addition to the flow, then refer to the flow using the UFID for all | ||
| 143 | future operations. The kernel is not required to index flows by the original | ||
| 144 | flow key if a UFID is specified. | ||
| 145 | |||
| 146 | |||
| 134 | Basic rule for evolving flow keys | 147 | Basic rule for evolving flow keys |
| 135 | --------------------------------- | 148 | --------------------------------- |
| 136 | 149 | ||
| @@ -162,6 +162,27 @@ SOF_TIMESTAMPING_OPT_CMSG: · 161 unmodified lines | |||
| 162 | option IP_PKTINFO simultaneously. | 162 | option IP_PKTINFO simultaneously. |
| 163 | 163 | ||
| 164 | 164 | ||
| 165 | SOF_TIMESTAMPING_OPT_TSONLY: | ||
| 166 | |||
| 167 | Applies to transmit timestamps only. Makes the kernel return the | ||
| 168 | timestamp as a cmsg alongside an empty packet, as opposed to | ||
| 169 | alongside the original packet. This reduces the amount of memory | ||
| 170 | charged to the socket's receive budget (SO_RCVBUF) and delivers | ||
| 171 | the timestamp even if sysctl net.core.tstamp_allow_data is 0. | ||
| 172 | This option disables SOF_TIMESTAMPING_OPT_CMSG. | ||
| 173 | |||
| 174 | |||
| 175 | New applications are encouraged to pass SOF_TIMESTAMPING_OPT_ID to | ||
| 176 | disambiguate timestamps and SOF_TIMESTAMPING_OPT_TSONLY to operate | ||
| 177 | regardless of the setting of sysctl net.core.tstamp_allow_data. | ||
| 178 | |||
| 179 | An exception is when a process needs additional cmsg data, for | ||
| 180 | instance SOL_IP/IP_PKTINFO to detect the egress network interface. | ||
| 181 | Then pass option SOF_TIMESTAMPING_OPT_CMSG. This option depends on | ||
| 182 | having access to the contents of the original packet, so cannot be | ||
| 183 | combined with SOF_TIMESTAMPING_OPT_TSONLY. | ||
| 184 | |||
| 185 | |||
| 165 | 1.4 Bytestream Timestamps | 186 | 1.4 Bytestream Timestamps |
| 166 | 187 | ||
| 167 | The SO_TIMESTAMPING interface supports timestamping of bytes in a | 188 | The SO_TIMESTAMPING interface supports timestamping of bytes in a |
| @@ -30,6 +30,8 @@ · 29 unmodified lines | |||
| 30 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 30 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | #define _GNU_SOURCE | ||
| 34 | |||
| 33 | #include <arpa/inet.h> | 35 | #include <arpa/inet.h> |
| 34 | #include <asm/types.h> | 36 | #include <asm/types.h> |
| 35 | #include <error.h> | 37 | #include <error.h> |
| @@ -59,14 +61,6 @@ · 23 unmodified lines | |||
| 59 | #include <time.h> | 61 | #include <time.h> |
| 60 | #include <unistd.h> | 62 | #include <unistd.h> |
| 61 | 63 | ||
| 62 | /* ugly hack to work around netinet/in.h and linux/ipv6.h conflicts */ | ||
| 63 | #ifndef in6_pktinfo | ||
| 64 | struct in6_pktinfo { | ||
| 65 | struct in6_addr ipi6_addr; | ||
| 66 | int ipi6_ifindex; | ||
| 67 | }; | ||
| 68 | #endif | ||
| 69 | |||
| 70 | /* command line parameters */ | 64 | /* command line parameters */ |
| 71 | static int cfg_proto = SOCK_STREAM; | 65 | static int cfg_proto = SOCK_STREAM; |
| 72 | static int cfg_ipproto = IPPROTO_TCP; | 66 | static int cfg_ipproto = IPPROTO_TCP; |
| @@ -76,6 +70,7 @@ static int do_ipv6 = 1; · 3 unmodified lines | |||
| 76 | static int cfg_payload_len = 10; | 70 | static int cfg_payload_len = 10; |
| 77 | static bool cfg_show_payload; | 71 | static bool cfg_show_payload; |
| 78 | static bool cfg_do_pktinfo; | 72 | static bool cfg_do_pktinfo; |
| 73 | static bool cfg_loop_nodata; | ||
| 79 | static uint16_t dest_port = 9000; | 74 | static uint16_t dest_port = 9000; |
| 80 | 75 | ||
| 81 | static struct sockaddr_in daddr; | 76 | static struct sockaddr_in daddr; |
| @@ -147,6 +142,9 @@ static void print_payload(char *data, int len) · 65 unmodified lines | |||
| 147 | { | 142 | { |
| 148 | int i; | 143 | int i; |
| 149 | 144 | ||
| 145 | if (!len) | ||
| 146 | return; | ||
| 147 | |||
| 150 | if (len > 70) | 148 | if (len > 70) |
| 151 | len = 70; | 149 | len = 70; |
| 152 | 150 | ||
| @@ -183,6 +181,7 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len) · 30 unmodified lines | |||
| 183 | struct sock_extended_err *serr = NULL; | 181 | struct sock_extended_err *serr = NULL; |
| 184 | struct scm_timestamping *tss = NULL; | 182 | struct scm_timestamping *tss = NULL; |
| 185 | struct cmsghdr *cm; | 183 | struct cmsghdr *cm; |
| 184 | int batch = 0; | ||
| 186 | 185 | ||
| 187 | for (cm = CMSG_FIRSTHDR(msg); | 186 | for (cm = CMSG_FIRSTHDR(msg); |
| 188 | cm && cm->cmsg_len; | 187 | cm && cm->cmsg_len; |
| @@ -215,10 +214,18 @@ static void __recv_errmsg_cmsg(struct msghdr *msg, int payload_len) · 26 unmodified lines | |||
| 215 | } else | 214 | } else |
| 216 | fprintf(stderr, "unknown cmsg %d,%d\n", | 215 | fprintf(stderr, "unknown cmsg %d,%d\n", |
| 217 | cm->cmsg_level, cm->cmsg_type); | 216 | cm->cmsg_level, cm->cmsg_type); |
| 217 | |||
| 218 | if (serr && tss) { | ||
| 219 | print_timestamp(tss, serr->ee_info, serr->ee_data, | ||
| 220 | payload_len); | ||
| 221 | serr = NULL; | ||
| 222 | tss = NULL; | ||
| 223 | batch++; | ||
| 224 | } | ||
| 218 | } | 225 | } |
| 219 | 226 | ||
| 220 | if (serr && tss) | 227 | if (batch > 1) |
| 221 | print_timestamp(tss, serr->ee_info, serr->ee_data, payload_len); | 228 | fprintf(stderr, "batched %d timestamps\n", batch); |
| 222 | } | 229 | } |
| 223 | 230 | ||
| 224 | static int recv_errmsg(int fd) | 231 | static int recv_errmsg(int fd) |
| @@ -250,7 +257,7 @@ static int recv_errmsg(int fd) · 25 unmodified lines | |||
| 250 | if (ret == -1 && errno != EAGAIN) | 257 | if (ret == -1 && errno != EAGAIN) |
| 251 | error(1, errno, "recvmsg"); | 258 | error(1, errno, "recvmsg"); |
| 252 | 259 | ||
| 253 | if (ret > 0) { | 260 | if (ret >= 0) { |
| 254 | __recv_errmsg_cmsg(&msg, ret); | 261 | __recv_errmsg_cmsg(&msg, ret); |
| 255 | if (cfg_show_payload) | 262 | if (cfg_show_payload) |
| 256 | print_payload(data, cfg_payload_len); | 263 | print_payload(data, cfg_payload_len); |
| @@ -315,6 +322,9 @@ static void do_test(int family, unsigned int opt) · 58 unmodified lines | |||
| 315 | opt |= SOF_TIMESTAMPING_SOFTWARE | | 322 | opt |= SOF_TIMESTAMPING_SOFTWARE | |
| 316 | SOF_TIMESTAMPING_OPT_CMSG | | 323 | SOF_TIMESTAMPING_OPT_CMSG | |
| 317 | SOF_TIMESTAMPING_OPT_ID; | 324 | SOF_TIMESTAMPING_OPT_ID; |
| 325 | if (cfg_loop_nodata) | ||
| 326 | opt |= SOF_TIMESTAMPING_OPT_TSONLY; | ||
| 327 | |||
| 318 | if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, | 328 | if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, |
| 319 | (char *) &opt, sizeof(opt))) | 329 | (char *) &opt, sizeof(opt))) |
| 320 | error(1, 0, "setsockopt timestamping"); | 330 | error(1, 0, "setsockopt timestamping"); |
| @@ -384,6 +394,7 @@ static void __attribute__((noreturn)) usage(const char *filepath) · 63 unmodified lines | |||
| 384 | " -h: show this message\n" | 394 | " -h: show this message\n" |
| 385 | " -I: request PKTINFO\n" | 395 | " -I: request PKTINFO\n" |
| 386 | " -l N: send N bytes at a time\n" | 396 | " -l N: send N bytes at a time\n" |
| 397 | " -n: set no-payload option\n" | ||
| 387 | " -r: use raw\n" | 398 | " -r: use raw\n" |
| 388 | " -R: use raw (IP_HDRINCL)\n" | 399 | " -R: use raw (IP_HDRINCL)\n" |
| 389 | " -p N: connect to port N\n" | 400 | " -p N: connect to port N\n" |
| @@ -398,7 +409,7 @@ static void parse_opt(int argc, char **argv) · 8 unmodified lines | |||
| 398 | int proto_count = 0; | 409 | int proto_count = 0; |
| 399 | char c; | 410 | char c; |
| 400 | 411 | ||
| 401 | while ((c = getopt(argc, argv, "46hIl:p:rRux")) != -1) { | 412 | while ((c = getopt(argc, argv, "46hIl:np:rRux")) != -1) { |
| 402 | switch (c) { | 413 | switch (c) { |
| 403 | case '4': | 414 | case '4': |
| 404 | do_ipv6 = 0; | 415 | do_ipv6 = 0; |
| @@ -409,6 +420,9 @@ static void parse_opt(int argc, char **argv) · 4 unmodified lines | |||
| 409 | case 'I': | 420 | case 'I': |
| 410 | cfg_do_pktinfo = true; | 421 | cfg_do_pktinfo = true; |
| 411 | break; | 422 | break; |
| 423 | case 'n': | ||
| 424 | cfg_loop_nodata = true; | ||
| 425 | break; | ||
| 412 | case 'r': | 426 | case 'r': |
| 413 | proto_count++; | 427 | proto_count++; |
| 414 | cfg_proto = SOCK_RAW; | 428 | cfg_proto = SOCK_RAW; |
| @@ -25,6 +25,9 @@ whether they can be changed or not: · 24 unmodified lines | |||
| 25 | - soft block: writable radio block (need not be readable) that is set by | 25 | - soft block: writable radio block (need not be readable) that is set by |
| 26 | the system software. | 26 | the system software. |
| 27 | 27 | ||
| 28 | The rfkill subsystem has two parameters, rfkill.default_state and | ||
| 29 | rfkill.master_switch_mode, which are documented in kernel-parameters.txt. | ||
| 30 | |||
| 28 | 31 | ||
| 29 | 2. Implementation details | 32 | 2. Implementation details |
| 30 | 33 | ||
| @@ -97,6 +97,14 @@ rmem_max · 96 unmodified lines | |||
| 97 | 97 | ||
| 98 | The maximum receive socket buffer size in bytes. | 98 | The maximum receive socket buffer size in bytes. |
| 99 | 99 | ||
| 100 | tstamp_allow_data | ||
| 101 | ----------------- | ||
| 102 | Allow processes to receive tx timestamps looped together with the original | ||
| 103 | packet contents. If disabled, transmit timestamp requests from unprivileged | ||
| 104 | processes are dropped unless socket option SOF_TIMESTAMPING_OPT_TSONLY is set. | ||
| 105 | Default: 1 (on) | ||
| 106 | |||
| 107 | |||
| 100 | wmem_default | 108 | wmem_default |
| 101 | ------------ | 109 | ------------ |
| 102 | 110 | ||
| @@ -1661,7 +1661,6 @@ M: Jiri Slaby <jirislaby@gmail.com> · 1660 unmodified lines | |||
| 1661 | M: Nick Kossifidis <mickflemm@gmail.com> | 1661 | M: Nick Kossifidis <mickflemm@gmail.com> |
| 1662 | M: "Luis R. Rodriguez" <mcgrof@do-not-panic.com> | 1662 | M: "Luis R. Rodriguez" <mcgrof@do-not-panic.com> |
| 1663 | L: linux-wireless@vger.kernel.org | 1663 | L: linux-wireless@vger.kernel.org |
| 1664 | L: ath5k-devel@lists.ath5k.org | ||
| 1665 | W: http://wireless.kernel.org/en/users/Drivers/ath5k | 1664 | W: http://wireless.kernel.org/en/users/Drivers/ath5k |
| 1666 | S: Maintained | 1665 | S: Maintained |
| 1667 | F: drivers/net/wireless/ath/ath5k/ | 1666 | F: drivers/net/wireless/ath/ath5k/ |
| @@ -6652,6 +6651,7 @@ F: include/linux/netdevice.h · 4984 unmodified lines | |||
| 6652 | F: include/uapi/linux/in.h | 6651 | F: include/uapi/linux/in.h |
| 6653 | F: include/uapi/linux/net.h | 6652 | F: include/uapi/linux/net.h |
| 6654 | F: include/uapi/linux/netdevice.h | 6653 | F: include/uapi/linux/netdevice.h |
| 6654 | F: include/uapi/linux/net_namespace.h | ||
| 6655 | F: tools/net/ | 6655 | F: tools/net/ |
| 6656 | F: tools/testing/selftests/net/ | 6656 | F: tools/testing/selftests/net/ |
| 6657 | F: lib/random32.c | 6657 | F: lib/random32.c |
| @@ -7090,11 +7090,12 @@ F: arch/openrisc/ · 432 unmodified lines | |||
| 7090 | 7090 | ||
| 7091 | OPENVSWITCH | 7091 | OPENVSWITCH |
| 7092 | M: Pravin Shelar <pshelar@nicira.com> | 7092 | M: Pravin Shelar <pshelar@nicira.com> |
| 7093 | L: netdev@vger.kernel.org | ||
| 7093 | L: dev@openvswitch.org | 7094 | L: dev@openvswitch.org |
| 7094 | W: http://openvswitch.org | 7095 | W: http://openvswitch.org |
| 7095 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/pshelar/openvswitch.git | ||
| 7096 | S: Maintained | 7096 | S: Maintained |
| 7097 | F: net/openvswitch/ | 7097 | F: net/openvswitch/ |
| 7098 | F: include/uapi/linux/openvswitch.h | ||
| 7098 | 7099 | ||
| 7099 | OPL4 DRIVER | 7100 | OPL4 DRIVER |
| 7100 | M: Clemens Ladisch <clemens@ladisch.de> | 7101 | M: Clemens Ladisch <clemens@ladisch.de> |
| @@ -8097,6 +8098,13 @@ S: Maintained · 996 unmodified lines | |||
| 8097 | F: Documentation/rfkill.txt | 8098 | F: Documentation/rfkill.txt |
| 8098 | F: net/rfkill/ | 8099 | F: net/rfkill/ |
| 8099 | 8100 | ||
| 8101 | RHASHTABLE | ||
| 8102 | M: Thomas Graf <tgraf@suug.ch> | ||
| 8103 | L: netdev@vger.kernel.org | ||
| 8104 | S: Maintained | ||
| 8105 | F: lib/rhashtable.c | ||
| 8106 | F: include/linux/rhashtable.h | ||
| 8107 | |||
| 8100 | RICOH SMARTMEDIA/XD DRIVER | 8108 | RICOH SMARTMEDIA/XD DRIVER |
| 8101 | M: Maxim Levitsky <maximlevitsky@gmail.com> | 8109 | M: Maxim Levitsky <maximlevitsky@gmail.com> |
| 8102 | S: Maintained | 8110 | S: Maintained |
| @@ -9655,6 +9663,13 @@ F: drivers/power/lp8788-charger.c · 1552 unmodified lines | |||
| 9655 | F: drivers/regulator/lp8788-*.c | 9663 | F: drivers/regulator/lp8788-*.c |
| 9656 | F: include/linux/mfd/lp8788*.h | 9664 | F: include/linux/mfd/lp8788*.h |
| 9657 | 9665 | ||
| 9666 | TI NETCP ETHERNET DRIVER | ||
| 9667 | M: Wingman Kwok <w-kwok2@ti.com> | ||
| 9668 | M: Murali Karicheri <m-karicheri2@ti.com> | ||
| 9669 | L: netdev@vger.kernel.org | ||
| 9670 | S: Maintained | ||
| 9671 | F: drivers/net/ethernet/ti/netcp* | ||
| 9672 | |||
| 9658 | TI TWL4030 SERIES SOC CODEC DRIVER | 9673 | TI TWL4030 SERIES SOC CODEC DRIVER |
| 9659 | M: Peter Ujfalusi <peter.ujfalusi@ti.com> | 9674 | M: Peter Ujfalusi <peter.ujfalusi@ti.com> |
| 9660 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 9675 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | |||
| 31 | status = "disabled"; | 31 | status = "disabled"; |
| 32 | reg = <0x5c000000 0x30000>; | 32 | reg = <0x5c000000 0x30000>; |
| 33 | interrupts = <67 68 69 70>; | 33 | interrupts = <67 68 69 70>; |
| 34 | syscon = <&omap3_scm_general>; | ||
| 34 | ti,davinci-ctrl-reg-offset = <0x10000>; | 35 | ti,davinci-ctrl-reg-offset = <0x10000>; |
| 35 | ti,davinci-ctrl-mod-reg-offset = <0>; | 36 | ti,davinci-ctrl-mod-reg-offset = <0>; |
| 36 | ti,davinci-ctrl-ram-offset = <0x20000>; | 37 | ti,davinci-ctrl-ram-offset = <0x20000>; |
| @@ -15,6 +15,13 @@ · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | / { | 16 | / { |
| 17 | compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288"; | 17 | compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288"; |
| 18 | |||
| 19 | ext_gmac: external-gmac-clock { | ||
| 20 | compatible = "fixed-clock"; | ||
| 21 | clock-frequency = <125000000>; | ||
| 22 | clock-output-names = "ext_gmac"; | ||
| 23 | #clock-cells = <0>; | ||
| 24 | }; | ||
| 18 | }; | 25 | }; |
| 19 | 26 | ||
| 20 | &cpu0 { | 27 | &cpu0 { |
| @@ -152,3 +159,19 @@ · 131 unmodified lines | |||
| 152 | }; | 159 | }; |
| 153 | }; | 160 | }; |
| 154 | }; | 161 | }; |
| 162 | |||
| 163 | &gmac { | ||
| 164 | phy-supply = <&vcc_phy>; | ||
| 165 | phy-mode = "rgmii"; | ||
| 166 | clock_in_out = "input"; | ||
| 167 | snps,reset-gpio = <&gpio4 7 0>; | ||
| 168 | snps,reset-active-low; | ||
| 169 | snps,reset-delays-us = <0 10000 1000000>; | ||
| 170 | assigned-clocks = <&cru SCLK_MAC>; | ||
| 171 | assigned-clock-parents = <&ext_gmac>; | ||
| 172 | pinctrl-names = "default"; | ||
| 173 | pinctrl-0 = <&rgmii_pins>; | ||
| 174 | tx_delay = <0x30>; | ||
| 175 | rx_delay = <0x10>; | ||
| 176 | status = "ok"; | ||
| 177 | }; | ||
| @@ -90,6 +90,19 @@ · 89 unmodified lines | |||
| 90 | regulator-always-on; | 90 | regulator-always-on; |
| 91 | regulator-boot-on; | 91 | regulator-boot-on; |
| 92 | }; | 92 | }; |
| 93 | |||
| 94 | vcc_phy: vcc-phy-regulator { | ||
| 95 | compatible = "regulator-fixed"; | ||
| 96 | enable-active-high; | ||
| 97 | gpio = <&gpio0 6 GPIO_ACTIVE_HIGH>; | ||
| 98 | pinctrl-names = "default"; | ||
| 99 | pinctrl-0 = <ð_phy_pwr>; | ||
| 100 | regulator-name = "vcc_phy"; | ||
| 101 | regulator-min-microvolt = <3300000>; | ||
| 102 | regulator-max-microvolt = <3300000>; | ||
| 103 | regulator-always-on; | ||
| 104 | regulator-boot-on; | ||
| 105 | }; | ||
| 93 | }; | 106 | }; |
| 94 | 107 | ||
| 95 | &emmc { | 108 | &emmc { |
| @@ -208,6 +221,12 @@ · 112 unmodified lines | |||
| 208 | rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>; | 221 | rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>; |
| 209 | }; | 222 | }; |
| 210 | }; | 223 | }; |
| 224 | |||
| 225 | eth_phy { | ||
| 226 | eth_phy_pwr: eth-phy-pwr { | ||
| 227 | rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>; | ||
| 228 | }; | ||
| 229 | }; | ||
| 211 | }; | 230 | }; |
| 212 | 231 | ||
| 213 | &usb_host0_ehci { | 232 | &usb_host0_ehci { |
| @@ -380,6 +380,22 @@ · 379 unmodified lines | |||
| 380 | status = "disabled"; | 380 | status = "disabled"; |
| 381 | }; | 381 | }; |
| 382 | 382 | ||
| 383 | gmac: ethernet@ff290000 { | ||
| 384 | compatible = "rockchip,rk3288-gmac"; | ||
| 385 | reg = <0xff290000 0x10000>; | ||
| 386 | interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>; | ||
| 387 | interrupt-names = "macirq"; | ||
| 388 | rockchip,grf = <&grf>; | ||
| 389 | clocks = <&cru SCLK_MAC>, | ||
| 390 | <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>, | ||
| 391 | <&cru SCLK_MACREF>, <&cru SCLK_MACREF_OUT>, | ||
| 392 | <&cru ACLK_GMAC>, <&cru PCLK_GMAC>; | ||
| 393 | clock-names = "stmmaceth", | ||
| 394 | "mac_clk_rx", "mac_clk_tx", | ||
| 395 | "clk_mac_ref", "clk_mac_refout", | ||
| 396 | "aclk_mac", "pclk_mac"; | ||
| 397 | }; | ||
| 398 | |||
| 383 | usb_host0_ehci: usb@ff500000 { | 399 | usb_host0_ehci: usb@ff500000 { |
| 384 | compatible = "generic-ehci"; | 400 | compatible = "generic-ehci"; |
| 385 | reg = <0xff500000 0x100>; | 401 | reg = <0xff500000 0x100>; |
| @@ -725,6 +741,11 @@ · 339 unmodified lines | |||
| 725 | bias-disable; | 741 | bias-disable; |
| 726 | }; | 742 | }; |
| 727 | 743 | ||
| 744 | pcfg_pull_none_12ma: pcfg-pull-none-12ma { | ||
| 745 | bias-disable; | ||
| 746 | drive-strength = <12>; | ||
| 747 | }; | ||
| 748 | |||
| 728 | i2c0 { | 749 | i2c0 { |
| 729 | i2c0_xfer: i2c0-xfer { | 750 | i2c0_xfer: i2c0-xfer { |
| 730 | rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>, | 751 | rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>, |
| @@ -1068,5 +1089,38 @@ · 337 unmodified lines | |||
| 1068 | rockchip,pins = <7 23 3 &pcfg_pull_none>; | 1089 | rockchip,pins = <7 23 3 &pcfg_pull_none>; |
| 1069 | }; | 1090 | }; |
| 1070 | }; | 1091 | }; |
| 1092 | |||
| 1093 | gmac { | ||
| 1094 | rgmii_pins: rgmii-pins { | ||
| 1095 | rockchip,pins = <3 30 3 &pcfg_pull_none>, | ||
| 1096 | <3 31 3 &pcfg_pull_none>, | ||
| 1097 | <3 26 3 &pcfg_pull_none>, | ||
| 1098 | <3 27 3 &pcfg_pull_none>, | ||
| 1099 | <3 28 3 &pcfg_pull_none_12ma>, | ||
| 1100 | <3 29 3 &pcfg_pull_none_12ma>, | ||
| 1101 | <3 24 3 &pcfg_pull_none_12ma>, | ||
| 1102 | <3 25 3 &pcfg_pull_none_12ma>, | ||
| 1103 | <4 0 3 &pcfg_pull_none>, | ||
| 1104 | <4 5 3 &pcfg_pull_none>, | ||
| 1105 | <4 6 3 &pcfg_pull_none>, | ||
| 1106 | <4 9 3 &pcfg_pull_none_12ma>, | ||
| 1107 | <4 4 3 &pcfg_pull_none_12ma>, | ||
| 1108 | <4 1 3 &pcfg_pull_none>, | ||
| 1109 | <4 3 3 &pcfg_pull_none>; | ||
| 1110 | }; | ||
| 1111 | |||
| 1112 | rmii_pins: rmii-pins { | ||
| 1113 | rockchip,pins = <3 30 3 &pcfg_pull_none>, | ||
| 1114 | <3 31 3 &pcfg_pull_none>, | ||
| 1115 | <3 28 3 &pcfg_pull_none>, | ||
| 1116 | <3 29 3 &pcfg_pull_none>, | ||
| 1117 | <4 0 3 &pcfg_pull_none>, | ||
| 1118 | <4 5 3 &pcfg_pull_none>, | ||
| 1119 | <4 4 3 &pcfg_pull_none>, | ||
| 1120 | <4 1 3 &pcfg_pull_none>, | ||
| 1121 | <4 2 3 &pcfg_pull_none>, | ||
| 1122 | <4 3 3 &pcfg_pull_none>; | ||
| 1123 | }; | ||
| 1124 | }; | ||
| 1071 | }; | 1125 | }; |
| 1072 | }; | 1126 | }; |
| @@ -274,5 +274,14 @@ · 273 unmodified lines | |||
| 274 | 274 | ||
| 275 | status = "disabled"; | 275 | status = "disabled"; |
| 276 | }; | 276 | }; |
| 277 | |||
| 278 | usb2_picophy0: phy1 { | ||
| 279 | compatible = "st,stih407-usb2-phy"; | ||
| 280 | #phy-cells = <0>; | ||
| 281 | st,syscfg = <&syscfg_core 0x100 0xf4>; | ||
| 282 | resets = <&softreset STIH407_PICOPHY_SOFTRESET>, | ||
| 283 | <&picophyreset STIH407_PICOPHY0_RESET>; | ||
| 284 | reset-names = "global", "port"; | ||
| 285 | }; | ||
| 277 | }; | 286 | }; |
| 278 | }; | 287 | }; |
| @@ -10,5 +10,75 @@ · 9 unmodified lines | |||
| 10 | #include "stih407-family.dtsi" | 10 | #include "stih407-family.dtsi" |
| 11 | #include "stih410-pinctrl.dtsi" | 11 | #include "stih410-pinctrl.dtsi" |
| 12 | / { | 12 | / { |
| 13 | soc { | ||
| 14 | usb2_picophy1: phy2 { | ||
| 15 | compatible = "st,stih407-usb2-phy"; | ||
| 16 | #phy-cells = <0>; | ||
| 17 | st,syscfg = <&syscfg_core 0xf8 0xf4>; | ||
| 18 | resets = <&softreset STIH407_PICOPHY_SOFTRESET>, | ||
| 19 | <&picophyreset STIH407_PICOPHY0_RESET>; | ||
| 20 | reset-names = "global", "port"; | ||
| 21 | }; | ||
| 13 | 22 | ||
| 23 | usb2_picophy2: phy3 { | ||
| 24 | compatible = "st,stih407-usb2-phy"; | ||
| 25 | #phy-cells = <0>; | ||
| 26 | st,syscfg = <&syscfg_core 0xfc 0xf4>; | ||
| 27 | resets = <&softreset STIH407_PICOPHY_SOFTRESET>, | ||
| 28 | <&picophyreset STIH407_PICOPHY1_RESET>; | ||
| 29 | reset-names = "global", "port"; | ||
| 30 | }; | ||
| 31 | |||
| 32 | ohci0: usb@9a03c00 { | ||
| 33 | compatible = "st,st-ohci-300x"; | ||
| 34 | reg = <0x9a03c00 0x100>; | ||
| 35 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; | ||
| 36 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | ||
| 37 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | ||
| 38 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | ||
| 39 | reset-names = "power", "softreset"; | ||
| 40 | phys = <&usb2_picophy1>; | ||
| 41 | phy-names = "usb"; | ||
| 42 | }; | ||
| 43 | |||
| 44 | ehci0: usb@9a03e00 { | ||
| 45 | compatible = "st,st-ehci-300x"; | ||
| 46 | reg = <0x9a03e00 0x100>; | ||
| 47 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; | ||
| 48 | pinctrl-names = "default"; | ||
| 49 | pinctrl-0 = <&pinctrl_usb0>; | ||
| 50 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | ||
| 51 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | ||
| 52 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | ||
| 53 | reset-names = "power", "softreset"; | ||
| 54 | phys = <&usb2_picophy1>; | ||
| 55 | phy-names = "usb"; | ||
| 56 | }; | ||
| 57 | |||
| 58 | ohci1: usb@9a83c00 { | ||
| 59 | compatible = "st,st-ohci-300x"; | ||
| 60 | reg = <0x9a83c00 0x100>; | ||
| 61 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; | ||
| 62 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | ||
| 63 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | ||
| 64 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | ||
| 65 | reset-names = "power", "softreset"; | ||
| 66 | phys = <&usb2_picophy2>; | ||
| 67 | phy-names = "usb"; | ||
| 68 | }; | ||
| 69 | |||
| 70 | ehci1: usb@9a83e00 { | ||
| 71 | compatible = "st,st-ehci-300x"; | ||
| 72 | reg = <0x9a83e00 0x100>; | ||
| 73 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; | ||
| 74 | pinctrl-names = "default"; | ||
| 75 | pinctrl-0 = <&pinctrl_usb1>; | ||
| 76 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | ||
| 77 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | ||
| 78 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | ||
| 79 | reset-names = "power", "softreset"; | ||
| 80 | phys = <&usb2_picophy2>; | ||
| 81 | phy-names = "usb"; | ||
| 82 | }; | ||
| 83 | }; | ||
| 14 | }; | 84 | }; |
| @@ -153,8 +153,8 @@ · 152 unmodified lines | |||
| 153 | compatible = "st,stih415-dwmac", "snps,dwmac", "snps,dwmac-3.610"; | 153 | compatible = "st,stih415-dwmac", "snps,dwmac", "snps,dwmac-3.610"; |
| 154 | status = "disabled"; | 154 | status = "disabled"; |
| 155 | 155 | ||
| 156 | reg = <0xfe810000 0x8000>, <0x148 0x4>; | 156 | reg = <0xfe810000 0x8000>; |
| 157 | reg-names = "stmmaceth", "sti-ethconf"; | 157 | reg-names = "stmmaceth"; |
| 158 | 158 | ||
| 159 | interrupts = <0 147 0>, <0 148 0>, <0 149 0>; | 159 | interrupts = <0 147 0>, <0 148 0>, <0 149 0>; |
| 160 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; | 160 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; |
| @@ -165,7 +165,7 @@ · 4 unmodified lines | |||
| 165 | snps,mixed-burst; | 165 | snps,mixed-burst; |
| 166 | snps,force_sf_dma_mode; | 166 | snps,force_sf_dma_mode; |
| 167 | 167 | ||
| 168 | st,syscon = <&syscfg_rear>; | 168 | st,syscon = <&syscfg_rear 0x148>; |
| 169 | 169 | ||
| 170 | pinctrl-names = "default"; | 170 | pinctrl-names = "default"; |
| 171 | pinctrl-0 = <&pinctrl_mii0>; | 171 | pinctrl-0 = <&pinctrl_mii0>; |
| @@ -177,8 +177,8 @@ · 5 unmodified lines | |||
| 177 | device_type = "network"; | 177 | device_type = "network"; |
| 178 | compatible = "st,stih415-dwmac", "snps,dwmac", "snps,dwmac-3.610"; | 178 | compatible = "st,stih415-dwmac", "snps,dwmac", "snps,dwmac-3.610"; |
| 179 | status = "disabled"; | 179 | status = "disabled"; |
| 180 | reg = <0xfef08000 0x8000>, <0x74 0x4>; | 180 | reg = <0xfef08000 0x8000>; |
| 181 | reg-names = "stmmaceth", "sti-ethconf"; | 181 | reg-names = "stmmaceth"; |
| 182 | interrupts = <0 150 0>, <0 151 0>, <0 152 0>; | 182 | interrupts = <0 150 0>, <0 151 0>, <0 152 0>; |
| 183 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; | 183 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; |
| 184 | 184 | ||
| @@ -186,7 +186,7 @@ · 1 unmodified line | |||
| 186 | snps,mixed-burst; | 186 | snps,mixed-burst; |
| 187 | snps,force_sf_dma_mode; | 187 | snps,force_sf_dma_mode; |
| 188 | 188 | ||
| 189 | st,syscon = <&syscfg_sbc>; | 189 | st,syscon = <&syscfg_sbc 0x74>; |
| 190 | 190 | ||
| 191 | resets = <&softreset STIH415_ETH1_SOFTRESET>; | 191 | resets = <&softreset STIH415_ETH1_SOFTRESET>; |
| 192 | reset-names = "stmmaceth"; | 192 | reset-names = "stmmaceth"; |
| @@ -163,8 +163,8 @@ · 162 unmodified lines | |||
| 163 | device_type = "network"; | 163 | device_type = "network"; |
| 164 | compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710"; | 164 | compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710"; |
| 165 | status = "disabled"; | 165 | status = "disabled"; |
| 166 | reg = <0xfe810000 0x8000>, <0x8bc 0x4>; | 166 | reg = <0xfe810000 0x8000>; |
| 167 | reg-names = "stmmaceth", "sti-ethconf"; | 167 | reg-names = "stmmaceth"; |
| 168 | 168 | ||
| 169 | interrupts = <0 133 0>, <0 134 0>, <0 135 0>; | 169 | interrupts = <0 133 0>, <0 134 0>, <0 135 0>; |
| 170 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; | 170 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; |
| @@ -172,7 +172,7 @@ · 1 unmodified line | |||
| 172 | snps,pbl = <32>; | 172 | snps,pbl = <32>; |
| 173 | snps,mixed-burst; | 173 | snps,mixed-burst; |
| 174 | 174 | ||
| 175 | st,syscon = <&syscfg_rear>; | 175 | st,syscon = <&syscfg_rear 0x8bc>; |
| 176 | resets = <&softreset STIH416_ETH0_SOFTRESET>; | 176 | resets = <&softreset STIH416_ETH0_SOFTRESET>; |
| 177 | reset-names = "stmmaceth"; | 177 | reset-names = "stmmaceth"; |
| 178 | pinctrl-names = "default"; | 178 | pinctrl-names = "default"; |
| @@ -185,15 +185,15 @@ · 6 unmodified lines | |||
| 185 | device_type = "network"; | 185 | device_type = "network"; |
| 186 | compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710"; | 186 | compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710"; |
| 187 | status = "disabled"; | 187 | status = "disabled"; |
| 188 | reg = <0xfef08000 0x8000>, <0x7f0 0x4>; | 188 | reg = <0xfef08000 0x8000>; |
| 189 | reg-names = "stmmaceth", "sti-ethconf"; | 189 | reg-names = "stmmaceth"; |
| 190 | interrupts = <0 136 0>, <0 137 0>, <0 138 0>; | 190 | interrupts = <0 136 0>, <0 137 0>, <0 138 0>; |
| 191 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; | 191 | interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; |
| 192 | 192 | ||
| 193 | snps,pbl = <32>; | 193 | snps,pbl = <32>; |
| 194 | snps,mixed-burst; | 194 | snps,mixed-burst; |
| 195 | 195 | ||
| 196 | st,syscon = <&syscfg_sbc>; | 196 | st,syscon = <&syscfg_sbc 0x7f0>; |
| 197 | 197 | ||
| 198 | resets = <&softreset STIH416_ETH1_SOFTRESET>; | 198 | resets = <&softreset STIH416_ETH1_SOFTRESET>; |
| 199 | reset-names = "stmmaceth"; | 199 | reset-names = "stmmaceth"; |
| @@ -283,21 +283,21 @@ · 83 unmodified lines | |||
| 283 | 283 | ||
| 284 | miphy365x_phy: phy@fe382000 { | 284 | miphy365x_phy: phy@fe382000 { |
| 285 | compatible = "st,miphy365x-phy"; | 285 | compatible = "st,miphy365x-phy"; |
| 286 | st,syscfg = <&syscfg_rear>; | 286 | st,syscfg = <&syscfg_rear 0x824 0x828>; |
| 287 | #address-cells = <1>; | 287 | #address-cells = <1>; |
| 288 | #size-cells = <1>; | 288 | #size-cells = <1>; |
| 289 | ranges; | 289 | ranges; |
| 290 | 290 | ||
| 291 | phy_port0: port@fe382000 { | 291 | phy_port0: port@fe382000 { |
| 292 | #phy-cells = <1>; | 292 | #phy-cells = <1>; |
| 293 | reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>; | 293 | reg = <0xfe382000 0x100>, <0xfe394000 0x100>; |
| 294 | reg-names = "sata", "pcie", "syscfg"; | 294 | reg-names = "sata", "pcie"; |
| 295 | }; | 295 | }; |
| 296 | 296 | ||
| 297 | phy_port1: port@fe38a000 { | 297 | phy_port1: port@fe38a000 { |
| 298 | #phy-cells = <1>; | 298 | #phy-cells = <1>; |
| 299 | reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>; | 299 | reg = <0xfe38a000 0x100>, <0xfe804000 0x100>; |
| 300 | reg-names = "sata", "pcie", "syscfg"; | 300 | reg-names = "sata", "pcie"; |
| 301 | }; | 301 | }; |
| 302 | }; | 302 | }; |
| 303 | 303 | ||
| @@ -456,6 +456,7 @@ CONFIG_OMAP_USB2=y · 455 unmodified lines | |||
| 456 | CONFIG_TI_PIPE3=y | 456 | CONFIG_TI_PIPE3=y |
| 457 | CONFIG_PHY_MIPHY365X=y | 457 | CONFIG_PHY_MIPHY365X=y |
| 458 | CONFIG_PHY_STIH41X_USB=y | 458 | CONFIG_PHY_STIH41X_USB=y |
| 459 | CONFIG_PHY_STIH407_USB=y | ||
| 459 | CONFIG_PHY_SUN4I_USB=y | 460 | CONFIG_PHY_SUN4I_USB=y |
| 460 | CONFIG_EXT4_FS=y | 461 | CONFIG_EXT4_FS=y |
| 461 | CONFIG_AUTOFS4_FS=y | 462 | CONFIG_AUTOFS4_FS=y |
| @@ -37,7 +37,7 @@ · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
| 39 | #include <asm/mach/flash.h> | 39 | #include <asm/mach/flash.h> |
| 40 | #include <asm/mach/irda.h> | 40 | #include <linux/platform_data/irda-sa11x0.h> |
| 41 | #include <asm/mach/map.h> | 41 | #include <asm/mach/map.h> |
| 42 | #include <mach/assabet.h> | 42 | #include <mach/assabet.h> |
| 43 | #include <linux/platform_data/mfd-mcp-sa11x0.h> | 43 | #include <linux/platform_data/mfd-mcp-sa11x0.h> |
| @@ -43,7 +43,7 @@ · 42 unmodified lines | |||
| 43 | #include <asm/mach/arch.h> | 43 | #include <asm/mach/arch.h> |
| 44 | #include <asm/mach/flash.h> | 44 | #include <asm/mach/flash.h> |
| 45 | #include <asm/mach/map.h> | 45 | #include <asm/mach/map.h> |
| 46 | #include <asm/mach/irda.h> | 46 | #include <linux/platform_data/irda-sa11x0.h> |
| 47 | 47 | ||
| 48 | #include <asm/hardware/scoop.h> | 48 | #include <asm/hardware/scoop.h> |
| 49 | #include <asm/mach/sharpsl_param.h> | 49 | #include <asm/mach/sharpsl_param.h> |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | #include <asm/mach-types.h> | 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/irda.h> | 21 | #include <linux/platform_data/irda-sa11x0.h> |
| 22 | 22 | ||
| 23 | #include <mach/h3xxx.h> | 23 | #include <mach/h3xxx.h> |
| 24 | #include <mach/irqs.h> | 24 | #include <mach/irqs.h> |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | #include <asm/mach-types.h> | 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/irda.h> | 21 | #include <linux/platform_data/irda-sa11x0.h> |
| 22 | 22 | ||
| 23 | #include <mach/h3xxx.h> | 23 | #include <mach/h3xxx.h> |
| 24 | #include <mach/irqs.h> | 24 | #include <mach/irqs.h> |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <linux/clockchips.h> | 17 | #include <linux/clockchips.h> |
| 18 | #include <linux/of_address.h> | 18 | #include <linux/of_address.h> |
| 19 | #include <linux/of_irq.h> | 19 | #include <linux/of_irq.h> |
| 20 | #include <linux/timecounter.h> | ||
| 20 | #include <asm/cpuinfo.h> | 21 | #include <asm/cpuinfo.h> |
| 21 | 22 | ||
| 22 | static void __iomem *timer_baseaddr; | 23 | static void __iomem *timer_baseaddr; |
| @@ -338,49 +338,31 @@ static const struct net_proto_family alg_family = { · 337 unmodified lines | |||
| 338 | .owner = THIS_MODULE, | 338 | .owner = THIS_MODULE, |
| 339 | }; | 339 | }; |
| 340 | 340 | ||
| 341 | int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len, | 341 | int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len) |
| 342 | int write) | ||
| 343 | { | 342 | { |
| 344 | unsigned long from = (unsigned long)addr; | 343 | size_t off; |
| 345 | unsigned long npages; | 344 | ssize_t n; |
| 346 | unsigned off; | 345 | int npages, i; |
| 347 | int err; | ||
| 348 | int i; | ||
| 349 | |||
| 350 | err = -EFAULT; | ||
| 351 | if (!access_ok(write ? VERIFY_READ : VERIFY_WRITE, addr, len)) | ||
| 352 | goto out; | ||
| 353 | |||
| 354 | off = from & ~PAGE_MASK; | ||
| 355 | npages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
| 356 | if (npages > ALG_MAX_PAGES) | ||
| 357 | npages = ALG_MAX_PAGES; | ||
| 358 | 346 | ||
| 359 | err = get_user_pages_fast(from, npages, write, sgl->pages); | 347 | n = iov_iter_get_pages(iter, sgl->pages, len, ALG_MAX_PAGES, &off); |
| 360 | if (err < 0) | 348 | if (n < 0) |
| 361 | goto out; | 349 | return n; |
| 362 | 350 | ||
| 363 | npages = err; | 351 | npages = (off + n + PAGE_SIZE - 1) >> PAGE_SHIFT; |
| 364 | err = -EINVAL; | ||
| 365 | if (WARN_ON(npages == 0)) | 352 | if (WARN_ON(npages == 0)) |
| 366 | goto out; | 353 | return -EINVAL; |
| 367 | |||
| 368 | err = 0; | ||
| 369 | 354 | ||
| 370 | sg_init_table(sgl->sg, npages); | 355 | sg_init_table(sgl->sg, npages); |
| 371 | 356 | ||
| 372 | for (i = 0; i < npages; i++) { | 357 | for (i = 0, len = n; i < npages; i++) { |
| 373 | int plen = min_t(int, len, PAGE_SIZE - off); | 358 | int plen = min_t(int, len, PAGE_SIZE - off); |
| 374 | 359 | ||
| 375 | sg_set_page(sgl->sg + i, sgl->pages[i], plen, off); | 360 | sg_set_page(sgl->sg + i, sgl->pages[i], plen, off); |
| 376 | 361 | ||
| 377 | off = 0; | 362 | off = 0; |
| 378 | len -= plen; | 363 | len -= plen; |
| 379 | err += plen; | ||
| 380 | } | 364 | } |
| 381 | 365 | return n; | |
| 382 | out: | ||
| 383 | return err; | ||
| 384 | } | 366 | } |
| 385 | EXPORT_SYMBOL_GPL(af_alg_make_sg); | 367 | EXPORT_SYMBOL_GPL(af_alg_make_sg); |
| 386 | 368 | ||
| @@ -41,8 +41,6 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock, · 40 unmodified lines | |||
| 41 | struct sock *sk = sock->sk; | 41 | struct sock *sk = sock->sk; |
| 42 | struct alg_sock *ask = alg_sk(sk); | 42 | struct alg_sock *ask = alg_sk(sk); |
| 43 | struct hash_ctx *ctx = ask->private; | 43 | struct hash_ctx *ctx = ask->private; |
| 44 | unsigned long iovlen; | ||
| 45 | const struct iovec *iov; | ||
| 46 | long copied = 0; | 44 | long copied = 0; |
| 47 | int err; | 45 | int err; |
| 48 | 46 | ||
| @@ -58,37 +56,28 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock, · 9 unmodified lines | |||
| 58 | 56 | ||
| 59 | ctx->more = 0; | 57 | ctx->more = 0; |
| 60 | 58 | ||
| 61 | for (iov = msg->msg_iter.iov, iovlen = msg->msg_iter.nr_segs; iovlen > 0; | 59 | while (iov_iter_count(&msg->msg_iter)) { |
| 62 | iovlen--, iov++) { | 60 | int len = iov_iter_count(&msg->msg_iter); |
| 63 | unsigned long seglen = iov->iov_len; | ||
| 64 | char __user *from = iov->iov_base; | ||
| 65 | 61 | ||
| 66 | while (seglen) { | 62 | if (len > limit) |
| 67 | int len = min_t(unsigned long, seglen, limit); | 63 | len = limit; |
| 68 | int newlen; | ||
| 69 | 64 | ||
| 70 | newlen = af_alg_make_sg(&ctx->sgl, from, len, 0); | 65 | len = af_alg_make_sg(&ctx->sgl, &msg->msg_iter, len); |
| 71 | if (newlen < 0) { | 66 | if (len < 0) { |
| 72 | err = copied ? 0 : newlen; | 67 | err = copied ? 0 : len; |
| 73 | goto unlock; | 68 | goto unlock; |
| 74 | } | 69 | } |
| 75 | |||
| 76 | ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, | ||
| 77 | newlen); | ||
| 78 | |||
| 79 | err = af_alg_wait_for_completion( | ||
| 80 | crypto_ahash_update(&ctx->req), | ||
| 81 | &ctx->completion); | ||
| 82 | 70 | ||
| 83 | af_alg_free_sg(&ctx->sgl); | 71 | ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len); |
| 84 | 72 | ||
| 85 | if (err) | 73 | err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req), |
| 86 | goto unlock; | 74 | &ctx->completion); |
| 75 | af_alg_free_sg(&ctx->sgl); | ||
| 76 | if (err) | ||
| 77 | goto unlock; | ||
| 87 | 78 | ||
| 88 | seglen -= newlen; | 79 | copied += len; |
| 89 | from += newlen; | 80 | iov_iter_advance(&msg->msg_iter, len); |
| 90 | copied += newlen; | ||
| 91 | } | ||
| 92 | } | 81 | } |
| 93 | 82 | ||
| 94 | err = 0; | 83 | err = 0; |
| @@ -426,67 +426,58 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock, · 425 unmodified lines | |||
| 426 | &ctx->req)); | 426 | &ctx->req)); |
| 427 | struct skcipher_sg_list *sgl; | 427 | struct skcipher_sg_list *sgl; |
| 428 | struct scatterlist *sg; | 428 | struct scatterlist *sg; |
| 429 | unsigned long iovlen; | ||
| 430 | const struct iovec *iov; | ||
| 431 | int err = -EAGAIN; | 429 | int err = -EAGAIN; |
| 432 | int used; | 430 | int used; |
| 433 | long copied = 0; | 431 | long copied = 0; |
| 434 | 432 | ||
| 435 | lock_sock(sk); | 433 | lock_sock(sk); |
| 436 | for (iov = msg->msg_iter.iov, iovlen = msg->msg_iter.nr_segs; iovlen > 0; | 434 | while (iov_iter_count(&msg->msg_iter)) { |
| 437 | iovlen--, iov++) { | 435 | sgl = list_first_entry(&ctx->tsgl, |
| 438 | unsigned long seglen = iov->iov_len; | 436 | struct skcipher_sg_list, list); |
| 439 | char __user *from = iov->iov_base; | 437 | sg = sgl->sg; |
| 440 | |||
| 441 | while (seglen) { | ||
| 442 | sgl = list_first_entry(&ctx->tsgl, | ||
| 443 | struct skcipher_sg_list, list); | ||
| 444 | sg = sgl->sg; | ||
| 445 | |||
| 446 | while (!sg->length) | ||
| 447 | sg++; | ||
| 448 | |||
| 449 | if (!ctx->used) { | ||
| 450 | err = skcipher_wait_for_data(sk, flags); | ||
| 451 | if (err) | ||
| 452 | goto unlock; | ||
| 453 | } | ||
| 454 | 438 | ||
| 455 | used = min_t(unsigned long, ctx->used, seglen); | 439 | while (!sg->length) |
| 440 | sg++; | ||
| 456 | 441 | ||
| 457 | used = af_alg_make_sg(&ctx->rsgl, from, used, 1); | 442 | if (!ctx->used) { |
| 458 | err = used; | 443 | err = skcipher_wait_for_data(sk, flags); |
| 459 | if (err < 0) | 444 | if (err) |
| 460 | goto unlock; | 445 | goto unlock; |
| 446 | } | ||
| 447 | |||
| 448 | used = min_t(unsigned long, ctx->used, iov_iter_count(&msg->msg_iter)); | ||
| 449 | |||
| 450 | used = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, used); | ||
| 451 | err = used; | ||
| 452 | if (err < 0) | ||
| 453 | goto unlock; | ||
| 461 | 454 | ||
| 462 | if (ctx->more || used < ctx->used) | 455 | if (ctx->more || used < ctx->used) |
| 463 | used -= used % bs; | 456 | used -= used % bs; |
| 464 | 457 | ||
| 465 | err = -EINVAL; | 458 | err = -EINVAL; |
| 466 | if (!used) | 459 | if (!used) |
| 467 | goto free; | 460 | goto free; |
| 468 | 461 | ||
| 469 | ablkcipher_request_set_crypt(&ctx->req, sg, | 462 | ablkcipher_request_set_crypt(&ctx->req, sg, |
| 470 | ctx->rsgl.sg, used, | 463 | ctx->rsgl.sg, used, |
| 471 | ctx->iv); | 464 | ctx->iv); |
| 472 | 465 | ||
| 473 | err = af_alg_wait_for_completion( | 466 | err = af_alg_wait_for_completion( |
| 474 | ctx->enc ? | 467 | ctx->enc ? |
| 475 | crypto_ablkcipher_encrypt(&ctx->req) : | 468 | crypto_ablkcipher_encrypt(&ctx->req) : |
| 476 | crypto_ablkcipher_decrypt(&ctx->req), | 469 | crypto_ablkcipher_decrypt(&ctx->req), |
| 477 | &ctx->completion); | 470 | &ctx->completion); |
| 478 | 471 | ||
| 479 | free: | 472 | free: |
| 480 | af_alg_free_sg(&ctx->rsgl); | 473 | af_alg_free_sg(&ctx->rsgl); |
| 481 | 474 | ||
| 482 | if (err) | 475 | if (err) |
| 483 | goto unlock; | 476 | goto unlock; |
| 484 | 477 | ||
| 485 | copied += used; | 478 | copied += used; |
| 486 | from += used; | 479 | skcipher_pull_sgl(sk, used); |
| 487 | seglen -= used; | 480 | iov_iter_advance(&msg->msg_iter, used); |
| 488 | skcipher_pull_sgl(sk, used); | ||
| 489 | } | ||
| 490 | } | 481 | } |
| 491 | 482 | ||
| 492 | err = 0; | 483 | err = 0; |
| @@ -100,7 +100,6 @@ int acpi_bus_generate_netlink_event(const char *device_class, · 99 unmodified lines | |||
| 100 | struct acpi_genl_event *event; | 100 | struct acpi_genl_event *event; |
| 101 | void *msg_header; | 101 | void *msg_header; |
| 102 | int size; | 102 | int size; |
| 103 | int result; | ||
| 104 | 103 | ||
| 105 | /* allocate memory */ | 104 | /* allocate memory */ |
| 106 | size = nla_total_size(sizeof(struct acpi_genl_event)) + | 105 | size = nla_total_size(sizeof(struct acpi_genl_event)) + |
| @@ -137,11 +136,7 @@ int acpi_bus_generate_netlink_event(const char *device_class, · 30 unmodified lines | |||
| 137 | event->data = data; | 136 | event->data = data; |
| 138 | 137 | ||
| 139 | /* send multicast genetlink message */ | 138 | /* send multicast genetlink message */ |
| 140 | result = genlmsg_end(skb, msg_header); | 139 | genlmsg_end(skb, msg_header); |
| 141 | if (result < 0) { | ||
| 142 | nlmsg_free(skb); | ||
| 143 | return result; | ||
| 144 | } | ||
| 145 | 140 | ||
| 146 | genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC); | 141 | genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC); |
| 147 | return 0; | 142 | return 0; |
| @@ -354,9 +354,9 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, · 353 unmodified lines | |||
| 354 | eni_vcc = ENI_VCC(vcc); | 354 | eni_vcc = ENI_VCC(vcc); |
| 355 | paddr = 0; /* GCC, shut up */ | 355 | paddr = 0; /* GCC, shut up */ |
| 356 | if (skb) { | 356 | if (skb) { |
| 357 | paddr = pci_map_single(eni_dev->pci_dev,skb->data,skb->len, | 357 | paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len, |
| 358 | PCI_DMA_FROMDEVICE); | 358 | DMA_FROM_DEVICE); |
| 359 | if (pci_dma_mapping_error(eni_dev->pci_dev, paddr)) | 359 | if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr)) |
| 360 | goto dma_map_error; | 360 | goto dma_map_error; |
| 361 | ENI_PRV_PADDR(skb) = paddr; | 361 | ENI_PRV_PADDR(skb) = paddr; |
| 362 | if (paddr & 3) | 362 | if (paddr & 3) |
| @@ -481,8 +481,8 @@ rx_enqueued++; · 118 unmodified lines | |||
| 481 | 481 | ||
| 482 | trouble: | 482 | trouble: |
| 483 | if (paddr) | 483 | if (paddr) |
| 484 | pci_unmap_single(eni_dev->pci_dev,paddr,skb->len, | 484 | dma_unmap_single(&eni_dev->pci_dev->dev,paddr,skb->len, |
| 485 | PCI_DMA_FROMDEVICE); | 485 | DMA_FROM_DEVICE); |
| 486 | dma_map_error: | 486 | dma_map_error: |
| 487 | if (skb) dev_kfree_skb_irq(skb); | 487 | if (skb) dev_kfree_skb_irq(skb); |
| 488 | return -1; | 488 | return -1; |
| @@ -758,8 +758,8 @@ rx_dequeued++; · 269 unmodified lines | |||
| 758 | } | 758 | } |
| 759 | eni_vcc->rxing--; | 759 | eni_vcc->rxing--; |
| 760 | eni_vcc->rx_pos = ENI_PRV_POS(skb) & (eni_vcc->words-1); | 760 | eni_vcc->rx_pos = ENI_PRV_POS(skb) & (eni_vcc->words-1); |
| 761 | pci_unmap_single(eni_dev->pci_dev,ENI_PRV_PADDR(skb),skb->len, | 761 | dma_unmap_single(&eni_dev->pci_dev->dev,ENI_PRV_PADDR(skb),skb->len, |
| 762 | PCI_DMA_TODEVICE); | 762 | DMA_TO_DEVICE); |
| 763 | if (!skb->len) dev_kfree_skb_irq(skb); | 763 | if (!skb->len) dev_kfree_skb_irq(skb); |
| 764 | else { | 764 | else { |
| 765 | EVENT("pushing (len=%ld)\n",skb->len,0); | 765 | EVENT("pushing (len=%ld)\n",skb->len,0); |
| @@ -1112,8 +1112,8 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags); · 346 unmodified lines | |||
| 1112 | vcc->dev->number); | 1112 | vcc->dev->number); |
| 1113 | return enq_jam; | 1113 | return enq_jam; |
| 1114 | } | 1114 | } |
| 1115 | paddr = pci_map_single(eni_dev->pci_dev,skb->data,skb->len, | 1115 | paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len, |
| 1116 | PCI_DMA_TODEVICE); | 1116 | DMA_TO_DEVICE); |
| 1117 | ENI_PRV_PADDR(skb) = paddr; | 1117 | ENI_PRV_PADDR(skb) = paddr; |
| 1118 | /* prepare DMA queue entries */ | 1118 | /* prepare DMA queue entries */ |
| 1119 | j = 0; | 1119 | j = 0; |
| @@ -1226,8 +1226,8 @@ static void dequeue_tx(struct atm_dev *dev) · 106 unmodified lines | |||
| 1226 | break; | 1226 | break; |
| 1227 | } | 1227 | } |
| 1228 | ENI_VCC(vcc)->txing -= ENI_PRV_SIZE(skb); | 1228 | ENI_VCC(vcc)->txing -= ENI_PRV_SIZE(skb); |
| 1229 | pci_unmap_single(eni_dev->pci_dev,ENI_PRV_PADDR(skb),skb->len, | 1229 | dma_unmap_single(&eni_dev->pci_dev->dev,ENI_PRV_PADDR(skb),skb->len, |
| 1230 | PCI_DMA_TODEVICE); | 1230 | DMA_TO_DEVICE); |
| 1231 | if (vcc->pop) vcc->pop(vcc,skb); | 1231 | if (vcc->pop) vcc->pop(vcc,skb); |
| 1232 | else dev_kfree_skb_irq(skb); | 1232 | else dev_kfree_skb_irq(skb); |
| 1233 | atomic_inc(&vcc->stats->tx); | 1233 | atomic_inc(&vcc->stats->tx); |
| @@ -2240,13 +2240,18 @@ static int eni_init_one(struct pci_dev *pci_dev, · 1006 unmodified lines | |||
| 2240 | if (rc < 0) | 2240 | if (rc < 0) |
| 2241 | goto out; | 2241 | goto out; |
| 2242 | 2242 | ||
| 2243 | rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)); | ||
| 2244 | if (rc < 0) | ||
| 2245 | goto out; | ||
| 2246 | |||
| 2243 | rc = -ENOMEM; | 2247 | rc = -ENOMEM; |
| 2244 | eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL); | 2248 | eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL); |
| 2245 | if (!eni_dev) | 2249 | if (!eni_dev) |
| 2246 | goto err_disable; | 2250 | goto err_disable; |
| 2247 | 2251 | ||
| 2248 | zero = &eni_dev->zero; | 2252 | zero = &eni_dev->zero; |
| 2249 | zero->addr = pci_alloc_consistent(pci_dev, ENI_ZEROES_SIZE, &zero->dma); | 2253 | zero->addr = dma_alloc_coherent(&pci_dev->dev, |
| 2254 | ENI_ZEROES_SIZE, &zero->dma, GFP_KERNEL); | ||
| 2250 | if (!zero->addr) | 2255 | if (!zero->addr) |
| 2251 | goto err_kfree; | 2256 | goto err_kfree; |
| 2252 | 2257 | ||
| @@ -2277,7 +2282,7 @@ err_eni_release: · 24 unmodified lines | |||
| 2277 | err_unregister: | 2282 | err_unregister: |
| 2278 | atm_dev_deregister(dev); | 2283 | atm_dev_deregister(dev); |
| 2279 | err_free_consistent: | 2284 | err_free_consistent: |
| 2280 | pci_free_consistent(pci_dev, ENI_ZEROES_SIZE, zero->addr, zero->dma); | 2285 | dma_free_coherent(&pci_dev->dev, ENI_ZEROES_SIZE, zero->addr, zero->dma); |
| 2281 | err_kfree: | 2286 | err_kfree: |
| 2282 | kfree(eni_dev); | 2287 | kfree(eni_dev); |
| 2283 | err_disable: | 2288 | err_disable: |
| @@ -2302,7 +2307,7 @@ static void eni_remove_one(struct pci_dev *pdev) · 18 unmodified lines | |||
| 2302 | 2307 | ||
| 2303 | eni_do_release(dev); | 2308 | eni_do_release(dev); |
| 2304 | atm_dev_deregister(dev); | 2309 | atm_dev_deregister(dev); |
| 2305 | pci_free_consistent(pdev, ENI_ZEROES_SIZE, zero->addr, zero->dma); | 2310 | dma_free_coherent(&pdev->dev, ENI_ZEROES_SIZE, zero->addr, zero->dma); |
| 2306 | kfree(ed); | 2311 | kfree(ed); |
| 2307 | pci_disable_device(pdev); | 2312 | pci_disable_device(pdev); |
| 2308 | } | 2313 | } |
| @@ -425,7 +425,7 @@ static void fore200e_pca_write(u32 val, volatile u32 __iomem *addr) · 424 unmodified lines | |||
| 425 | static u32 | 425 | static u32 |
| 426 | fore200e_pca_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction) | 426 | fore200e_pca_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction) |
| 427 | { | 427 | { |
| 428 | u32 dma_addr = pci_map_single((struct pci_dev*)fore200e->bus_dev, virt_addr, size, direction); | 428 | u32 dma_addr = dma_map_single(&((struct pci_dev *) fore200e->bus_dev)->dev, virt_addr, size, direction); |
| 429 | 429 | ||
| 430 | DPRINTK(3, "PCI DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d, --> dma_addr = 0x%08x\n", | 430 | DPRINTK(3, "PCI DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d, --> dma_addr = 0x%08x\n", |
| 431 | virt_addr, size, direction, dma_addr); | 431 | virt_addr, size, direction, dma_addr); |
| @@ -440,7 +440,7 @@ fore200e_pca_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int di · 8 unmodified lines | |||
| 440 | DPRINTK(3, "PCI DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d\n", | 440 | DPRINTK(3, "PCI DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d\n", |
| 441 | dma_addr, size, direction); | 441 | dma_addr, size, direction); |
| 442 | 442 | ||
| 443 | pci_unmap_single((struct pci_dev*)fore200e->bus_dev, dma_addr, size, direction); | 443 | dma_unmap_single(&((struct pci_dev *) fore200e->bus_dev)->dev, dma_addr, size, direction); |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | 446 | ||
| @@ -449,7 +449,7 @@ fore200e_pca_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size, · 2 unmodified lines | |||
| 449 | { | 449 | { |
| 450 | DPRINTK(3, "PCI DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); | 450 | DPRINTK(3, "PCI DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); |
| 451 | 451 | ||
| 452 | pci_dma_sync_single_for_cpu((struct pci_dev*)fore200e->bus_dev, dma_addr, size, direction); | 452 | dma_sync_single_for_cpu(&((struct pci_dev *) fore200e->bus_dev)->dev, dma_addr, size, direction); |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | static void | 455 | static void |
| @@ -457,7 +457,7 @@ fore200e_pca_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int si · 1 unmodified line | |||
| 457 | { | 457 | { |
| 458 | DPRINTK(3, "PCI DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); | 458 | DPRINTK(3, "PCI DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); |
| 459 | 459 | ||
| 460 | pci_dma_sync_single_for_device((struct pci_dev*)fore200e->bus_dev, dma_addr, size, direction); | 460 | dma_sync_single_for_device(&((struct pci_dev *) fore200e->bus_dev)->dev, dma_addr, size, direction); |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | 463 | ||
| @@ -470,9 +470,10 @@ fore200e_pca_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, · 6 unmodified lines | |||
| 470 | { | 470 | { |
| 471 | /* returned chunks are page-aligned */ | 471 | /* returned chunks are page-aligned */ |
| 472 | chunk->alloc_size = size * nbr; | 472 | chunk->alloc_size = size * nbr; |
| 473 | chunk->alloc_addr = pci_alloc_consistent((struct pci_dev*)fore200e->bus_dev, | 473 | chunk->alloc_addr = dma_alloc_coherent(&((struct pci_dev *) fore200e->bus_dev)->dev, |
| 474 | chunk->alloc_size, | 474 | chunk->alloc_size, |
| 475 | &chunk->dma_addr); | 475 | &chunk->dma_addr, |
| 476 | GFP_KERNEL); | ||
| 476 | 477 | ||
| 477 | if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0)) | 478 | if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0)) |
| 478 | return -ENOMEM; | 479 | return -ENOMEM; |
| @@ -488,7 +489,7 @@ fore200e_pca_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, · 9 unmodified lines | |||
| 488 | static void | 489 | static void |
| 489 | fore200e_pca_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk) | 490 | fore200e_pca_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk) |
| 490 | { | 491 | { |
| 491 | pci_free_consistent((struct pci_dev*)fore200e->bus_dev, | 492 | dma_free_coherent(&((struct pci_dev *) fore200e->bus_dev)->dev, |
| 492 | chunk->alloc_size, | 493 | chunk->alloc_size, |
| 493 | chunk->alloc_addr, | 494 | chunk->alloc_addr, |
| 494 | chunk->dma_addr); | 495 | chunk->dma_addr); |
| @@ -2707,6 +2708,11 @@ static int fore200e_pca_detect(struct pci_dev *pci_dev, · 2212 unmodified lines | |||
| 2707 | err = -EINVAL; | 2708 | err = -EINVAL; |
| 2708 | goto out; | 2709 | goto out; |
| 2709 | } | 2710 | } |
| 2711 | |||
| 2712 | if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32))) { | ||
| 2713 | err = -EINVAL; | ||
| 2714 | goto out; | ||
| 2715 | } | ||
| 2710 | 2716 | ||
| 2711 | fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL); | 2717 | fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL); |
| 2712 | if (fore200e == NULL) { | 2718 | if (fore200e == NULL) { |
| @@ -359,7 +359,7 @@ static int he_init_one(struct pci_dev *pci_dev, · 358 unmodified lines | |||
| 359 | 359 | ||
| 360 | if (pci_enable_device(pci_dev)) | 360 | if (pci_enable_device(pci_dev)) |
| 361 | return -EIO; | 361 | return -EIO; |
| 362 | if (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)) != 0) { | 362 | if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)) != 0) { |
| 363 | printk(KERN_WARNING "he: no suitable dma available\n"); | 363 | printk(KERN_WARNING "he: no suitable dma available\n"); |
| 364 | err = -EIO; | 364 | err = -EIO; |
| 365 | goto init_one_failure; | 365 | goto init_one_failure; |
| @@ -533,9 +533,9 @@ static void he_init_tx_lbfp(struct he_dev *he_dev) · 167 unmodified lines | |||
| 533 | 533 | ||
| 534 | static int he_init_tpdrq(struct he_dev *he_dev) | 534 | static int he_init_tpdrq(struct he_dev *he_dev) |
| 535 | { | 535 | { |
| 536 | he_dev->tpdrq_base = pci_zalloc_consistent(he_dev->pci_dev, | 536 | he_dev->tpdrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, |
| 537 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), | 537 | CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), |
| 538 | &he_dev->tpdrq_phys); | 538 | &he_dev->tpdrq_phys, GFP_KERNEL); |
| 539 | if (he_dev->tpdrq_base == NULL) { | 539 | if (he_dev->tpdrq_base == NULL) { |
| 540 | hprintk("failed to alloc tpdrq\n"); | 540 | hprintk("failed to alloc tpdrq\n"); |
| 541 | return -ENOMEM; | 541 | return -ENOMEM; |
| @@ -796,16 +796,16 @@ static int he_init_group(struct he_dev *he_dev, int group) · 254 unmodified lines | |||
| 796 | } | 796 | } |
| 797 | 797 | ||
| 798 | /* large buffer pool */ | 798 | /* large buffer pool */ |
| 799 | he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev, | 799 | he_dev->rbpl_pool = dma_pool_create("rbpl", &he_dev->pci_dev->dev, |
| 800 | CONFIG_RBPL_BUFSIZE, 64, 0); | 800 | CONFIG_RBPL_BUFSIZE, 64, 0); |
| 801 | if (he_dev->rbpl_pool == NULL) { | 801 | if (he_dev->rbpl_pool == NULL) { |
| 802 | hprintk("unable to create rbpl pool\n"); | 802 | hprintk("unable to create rbpl pool\n"); |
| 803 | goto out_free_rbpl_virt; | 803 | goto out_free_rbpl_virt; |
| 804 | } | 804 | } |
| 805 | 805 | ||
| 806 | he_dev->rbpl_base = pci_zalloc_consistent(he_dev->pci_dev, | 806 | he_dev->rbpl_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, |
| 807 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), | 807 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), |
| 808 | &he_dev->rbpl_phys); | 808 | &he_dev->rbpl_phys, GFP_KERNEL); |
| 809 | if (he_dev->rbpl_base == NULL) { | 809 | if (he_dev->rbpl_base == NULL) { |
| 810 | hprintk("failed to alloc rbpl_base\n"); | 810 | hprintk("failed to alloc rbpl_base\n"); |
| 811 | goto out_destroy_rbpl_pool; | 811 | goto out_destroy_rbpl_pool; |
| @@ -815,7 +815,7 @@ static int he_init_group(struct he_dev *he_dev, int group) · 3 unmodified lines | |||
| 815 | 815 | ||
| 816 | for (i = 0; i < CONFIG_RBPL_SIZE; ++i) { | 816 | for (i = 0; i < CONFIG_RBPL_SIZE; ++i) { |
| 817 | 817 | ||
| 818 | heb = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &mapping); | 818 | heb = dma_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL, &mapping); |
| 819 | if (!heb) | 819 | if (!heb) |
| 820 | goto out_free_rbpl; | 820 | goto out_free_rbpl; |
| 821 | heb->mapping = mapping; | 821 | heb->mapping = mapping; |
| @@ -842,9 +842,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 20 unmodified lines | |||
| 842 | 842 | ||
| 843 | /* rx buffer ready queue */ | 843 | /* rx buffer ready queue */ |
| 844 | 844 | ||
| 845 | he_dev->rbrq_base = pci_zalloc_consistent(he_dev->pci_dev, | 845 | he_dev->rbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, |
| 846 | CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), | 846 | CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), |
| 847 | &he_dev->rbrq_phys); | 847 | &he_dev->rbrq_phys, GFP_KERNEL); |
| 848 | if (he_dev->rbrq_base == NULL) { | 848 | if (he_dev->rbrq_base == NULL) { |
| 849 | hprintk("failed to allocate rbrq\n"); | 849 | hprintk("failed to allocate rbrq\n"); |
| 850 | goto out_free_rbpl; | 850 | goto out_free_rbpl; |
| @@ -866,9 +866,9 @@ static int he_init_group(struct he_dev *he_dev, int group) · 15 unmodified lines | |||
| 866 | 866 | ||
| 867 | /* tx buffer ready queue */ | 867 | /* tx buffer ready queue */ |
| 868 | 868 | ||
| 869 | he_dev->tbrq_base = pci_zalloc_consistent(he_dev->pci_dev, | 869 | he_dev->tbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, |
| 870 | CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), | 870 | CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
| 871 | &he_dev->tbrq_phys); | 871 | &he_dev->tbrq_phys, GFP_KERNEL); |
| 872 | if (he_dev->tbrq_base == NULL) { | 872 | if (he_dev->tbrq_base == NULL) { |
| 873 | hprintk("failed to allocate tbrq\n"); | 873 | hprintk("failed to allocate tbrq\n"); |
| 874 | goto out_free_rbpq_base; | 874 | goto out_free_rbpq_base; |
| @@ -884,18 +884,18 @@ static int he_init_group(struct he_dev *he_dev, int group) · 9 unmodified lines | |||
| 884 | return 0; | 884 | return 0; |
| 885 | 885 | ||
| 886 | out_free_rbpq_base: | 886 | out_free_rbpq_base: |
| 887 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE * | 887 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBRQ_SIZE * |
| 888 | sizeof(struct he_rbrq), he_dev->rbrq_base, | 888 | sizeof(struct he_rbrq), he_dev->rbrq_base, |
| 889 | he_dev->rbrq_phys); | 889 | he_dev->rbrq_phys); |
| 890 | out_free_rbpl: | 890 | out_free_rbpl: |
| 891 | list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry) | 891 | list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry) |
| 892 | pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping); | 892 | dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping); |
| 893 | 893 | ||
| 894 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE * | 894 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBPL_SIZE * |
| 895 | sizeof(struct he_rbp), he_dev->rbpl_base, | 895 | sizeof(struct he_rbp), he_dev->rbpl_base, |
| 896 | he_dev->rbpl_phys); | 896 | he_dev->rbpl_phys); |
| 897 | out_destroy_rbpl_pool: | 897 | out_destroy_rbpl_pool: |
| 898 | pci_pool_destroy(he_dev->rbpl_pool); | 898 | dma_pool_destroy(he_dev->rbpl_pool); |
| 899 | out_free_rbpl_virt: | 899 | out_free_rbpl_virt: |
| 900 | kfree(he_dev->rbpl_virt); | 900 | kfree(he_dev->rbpl_virt); |
| 901 | out_free_rbpl_table: | 901 | out_free_rbpl_table: |
| @@ -911,8 +911,11 @@ static int he_init_irq(struct he_dev *he_dev) · 9 unmodified lines | |||
| 911 | /* 2.9.3.5 tail offset for each interrupt queue is located after the | 911 | /* 2.9.3.5 tail offset for each interrupt queue is located after the |
| 912 | end of the interrupt queue */ | 912 | end of the interrupt queue */ |
| 913 | 913 | ||
| 914 | he_dev->irq_base = pci_alloc_consistent(he_dev->pci_dev, | 914 | he_dev->irq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev, |
| 915 | (CONFIG_IRQ_SIZE+1) * sizeof(struct he_irq), &he_dev->irq_phys); | 915 | (CONFIG_IRQ_SIZE + 1) |
| 916 | * sizeof(struct he_irq), | ||
| 917 | &he_dev->irq_phys, | ||
| 918 | GFP_KERNEL); | ||
| 916 | if (he_dev->irq_base == NULL) { | 919 | if (he_dev->irq_base == NULL) { |
| 917 | hprintk("failed to allocate irq\n"); | 920 | hprintk("failed to allocate irq\n"); |
| 918 | return -ENOMEM; | 921 | return -ENOMEM; |
| @@ -1419,10 +1422,10 @@ static int he_start(struct atm_dev *dev) · 500 unmodified lines | |||
| 1419 | 1422 | ||
| 1420 | he_init_tpdrq(he_dev); | 1423 | he_init_tpdrq(he_dev); |
| 1421 | 1424 | ||
| 1422 | he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev, | 1425 | he_dev->tpd_pool = dma_pool_create("tpd", &he_dev->pci_dev->dev, |
| 1423 | sizeof(struct he_tpd), TPD_ALIGNMENT, 0); | 1426 | sizeof(struct he_tpd), TPD_ALIGNMENT, 0); |
| 1424 | if (he_dev->tpd_pool == NULL) { | 1427 | if (he_dev->tpd_pool == NULL) { |
| 1425 | hprintk("unable to create tpd pci_pool\n"); | 1428 | hprintk("unable to create tpd dma_pool\n"); |
| 1426 | return -ENOMEM; | 1429 | return -ENOMEM; |
| 1427 | } | 1430 | } |
| 1428 | 1431 | ||
| @@ -1459,9 +1462,9 @@ static int he_start(struct atm_dev *dev) · 30 unmodified lines | |||
| 1459 | 1462 | ||
| 1460 | /* host status page */ | 1463 | /* host status page */ |
| 1461 | 1464 | ||
| 1462 | he_dev->hsp = pci_zalloc_consistent(he_dev->pci_dev, | 1465 | he_dev->hsp = dma_zalloc_coherent(&he_dev->pci_dev->dev, |
| 1463 | sizeof(struct he_hsp), | 1466 | sizeof(struct he_hsp), |
| 1464 | &he_dev->hsp_phys); | 1467 | &he_dev->hsp_phys, GFP_KERNEL); |
| 1465 | if (he_dev->hsp == NULL) { | 1468 | if (he_dev->hsp == NULL) { |
| 1466 | hprintk("failed to allocate host status page\n"); | 1469 | hprintk("failed to allocate host status page\n"); |
| 1467 | return -ENOMEM; | 1470 | return -ENOMEM; |
| @@ -1558,41 +1561,41 @@ he_stop(struct he_dev *he_dev) · 90 unmodified lines | |||
| 1558 | free_irq(he_dev->irq, he_dev); | 1561 | free_irq(he_dev->irq, he_dev); |
| 1559 | 1562 | ||
| 1560 | if (he_dev->irq_base) | 1563 | if (he_dev->irq_base) |
| 1561 | pci_free_consistent(he_dev->pci_dev, (CONFIG_IRQ_SIZE+1) | 1564 | dma_free_coherent(&he_dev->pci_dev->dev, (CONFIG_IRQ_SIZE + 1) |
| 1562 | * sizeof(struct he_irq), he_dev->irq_base, he_dev->irq_phys); | 1565 | * sizeof(struct he_irq), he_dev->irq_base, he_dev->irq_phys); |
| 1563 | 1566 | ||
| 1564 | if (he_dev->hsp) | 1567 | if (he_dev->hsp) |
| 1565 | pci_free_consistent(he_dev->pci_dev, sizeof(struct he_hsp), | 1568 | dma_free_coherent(&he_dev->pci_dev->dev, sizeof(struct he_hsp), |
| 1566 | he_dev->hsp, he_dev->hsp_phys); | 1569 | he_dev->hsp, he_dev->hsp_phys); |
| 1567 | 1570 | ||
| 1568 | if (he_dev->rbpl_base) { | 1571 | if (he_dev->rbpl_base) { |
| 1569 | list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry) | 1572 | list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry) |
| 1570 | pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping); | 1573 | dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping); |
| 1571 | 1574 | ||
| 1572 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE | 1575 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBPL_SIZE |
| 1573 | * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys); | 1576 | * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys); |
| 1574 | } | 1577 | } |
| 1575 | 1578 | ||
| 1576 | kfree(he_dev->rbpl_virt); | 1579 | kfree(he_dev->rbpl_virt); |
| 1577 | kfree(he_dev->rbpl_table); | 1580 | kfree(he_dev->rbpl_table); |
| 1578 | 1581 | ||
| 1579 | if (he_dev->rbpl_pool) | 1582 | if (he_dev->rbpl_pool) |
| 1580 | pci_pool_destroy(he_dev->rbpl_pool); | 1583 | dma_pool_destroy(he_dev->rbpl_pool); |
| 1581 | 1584 | ||
| 1582 | if (he_dev->rbrq_base) | 1585 | if (he_dev->rbrq_base) |
| 1583 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), | 1586 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), |
| 1584 | he_dev->rbrq_base, he_dev->rbrq_phys); | 1587 | he_dev->rbrq_base, he_dev->rbrq_phys); |
| 1585 | 1588 | ||
| 1586 | if (he_dev->tbrq_base) | 1589 | if (he_dev->tbrq_base) |
| 1587 | pci_free_consistent(he_dev->pci_dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), | 1590 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
| 1588 | he_dev->tbrq_base, he_dev->tbrq_phys); | 1591 | he_dev->tbrq_base, he_dev->tbrq_phys); |
| 1589 | 1592 | ||
| 1590 | if (he_dev->tpdrq_base) | 1593 | if (he_dev->tpdrq_base) |
| 1591 | pci_free_consistent(he_dev->pci_dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), | 1594 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
| 1592 | he_dev->tpdrq_base, he_dev->tpdrq_phys); | 1595 | he_dev->tpdrq_base, he_dev->tpdrq_phys); |
| 1593 | 1596 | ||
| 1594 | if (he_dev->tpd_pool) | 1597 | if (he_dev->tpd_pool) |
| 1595 | pci_pool_destroy(he_dev->tpd_pool); | 1598 | dma_pool_destroy(he_dev->tpd_pool); |
| 1596 | 1599 | ||
| 1597 | if (he_dev->pci_dev) { | 1600 | if (he_dev->pci_dev) { |
| 1598 | pci_read_config_word(he_dev->pci_dev, PCI_COMMAND, &command); | 1601 | pci_read_config_word(he_dev->pci_dev, PCI_COMMAND, &command); |
| @@ -1610,7 +1613,7 @@ __alloc_tpd(struct he_dev *he_dev) · 11 unmodified lines | |||
| 1610 | struct he_tpd *tpd; | 1613 | struct he_tpd *tpd; |
| 1611 | dma_addr_t mapping; | 1614 | dma_addr_t mapping; |
| 1612 | 1615 | ||
| 1613 | tpd = pci_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC|GFP_DMA, &mapping); | 1616 | tpd = dma_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC, &mapping); |
| 1614 | if (tpd == NULL) | 1617 | if (tpd == NULL) |
| 1615 | return NULL; | 1618 | return NULL; |
| 1616 | 1619 | ||
| @@ -1681,7 +1684,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) · 64 unmodified lines | |||
| 1681 | if (!RBRQ_HBUF_ERR(he_dev->rbrq_head)) { | 1684 | if (!RBRQ_HBUF_ERR(he_dev->rbrq_head)) { |
| 1682 | clear_bit(i, he_dev->rbpl_table); | 1685 | clear_bit(i, he_dev->rbpl_table); |
| 1683 | list_del(&heb->entry); | 1686 | list_del(&heb->entry); |
| 1684 | pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping); | 1687 | dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping); |
| 1685 | } | 1688 | } |
| 1686 | 1689 | ||
| 1687 | goto next_rbrq_entry; | 1690 | goto next_rbrq_entry; |
| @@ -1774,7 +1777,7 @@ return_host_buffers: · 86 unmodified lines | |||
| 1774 | ++pdus_assembled; | 1777 | ++pdus_assembled; |
| 1775 | 1778 | ||
| 1776 | list_for_each_entry_safe(heb, next, &he_vcc->buffers, entry) | 1779 | list_for_each_entry_safe(heb, next, &he_vcc->buffers, entry) |
| 1777 | pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping); | 1780 | dma_pool_free(he_dev->rbpl_pool, heb, heb->mapping); |
| 1778 | INIT_LIST_HEAD(&he_vcc->buffers); | 1781 | INIT_LIST_HEAD(&he_vcc->buffers); |
| 1779 | he_vcc->pdu_len = 0; | 1782 | he_vcc->pdu_len = 0; |
| 1780 | 1783 | ||
| @@ -1843,10 +1846,10 @@ he_service_tbrq(struct he_dev *he_dev, int group) · 62 unmodified lines | |||
| 1843 | 1846 | ||
| 1844 | for (slot = 0; slot < TPD_MAXIOV; ++slot) { | 1847 | for (slot = 0; slot < TPD_MAXIOV; ++slot) { |
| 1845 | if (tpd->iovec[slot].addr) | 1848 | if (tpd->iovec[slot].addr) |
| 1846 | pci_unmap_single(he_dev->pci_dev, | 1849 | dma_unmap_single(&he_dev->pci_dev->dev, |
| 1847 | tpd->iovec[slot].addr, | 1850 | tpd->iovec[slot].addr, |
| 1848 | tpd->iovec[slot].len & TPD_LEN_MASK, | 1851 | tpd->iovec[slot].len & TPD_LEN_MASK, |
| 1849 | PCI_DMA_TODEVICE); | 1852 | DMA_TO_DEVICE); |
| 1850 | if (tpd->iovec[slot].len & TPD_LST) | 1853 | if (tpd->iovec[slot].len & TPD_LST) |
| 1851 | break; | 1854 | break; |
| 1852 | 1855 | ||
| @@ -1861,7 +1864,7 @@ he_service_tbrq(struct he_dev *he_dev, int group) · 8 unmodified lines | |||
| 1861 | 1864 | ||
| 1862 | next_tbrq_entry: | 1865 | next_tbrq_entry: |
| 1863 | if (tpd) | 1866 | if (tpd) |
| 1864 | pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); | 1867 | dma_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); |
| 1865 | he_dev->tbrq_head = (struct he_tbrq *) | 1868 | he_dev->tbrq_head = (struct he_tbrq *) |
| 1866 | ((unsigned long) he_dev->tbrq_base | | 1869 | ((unsigned long) he_dev->tbrq_base | |
| 1867 | TBRQ_MASK(he_dev->tbrq_head + 1)); | 1870 | TBRQ_MASK(he_dev->tbrq_head + 1)); |
| @@ -1905,7 +1908,7 @@ he_service_rbpl(struct he_dev *he_dev, int group) · 37 unmodified lines | |||
| 1905 | } | 1908 | } |
| 1906 | he_dev->rbpl_hint = i + 1; | 1909 | he_dev->rbpl_hint = i + 1; |
| 1907 | 1910 | ||
| 1908 | heb = pci_pool_alloc(he_dev->rbpl_pool, GFP_ATOMIC|GFP_DMA, &mapping); | 1911 | heb = dma_pool_alloc(he_dev->rbpl_pool, GFP_ATOMIC, &mapping); |
| 1909 | if (!heb) | 1912 | if (!heb) |
| 1910 | break; | 1913 | break; |
| 1911 | heb->mapping = mapping; | 1914 | heb->mapping = mapping; |
| @@ -2084,10 +2087,10 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid) · 172 unmodified lines | |||
| 2084 | */ | 2087 | */ |
| 2085 | for (slot = 0; slot < TPD_MAXIOV; ++slot) { | 2088 | for (slot = 0; slot < TPD_MAXIOV; ++slot) { |
| 2086 | if (tpd->iovec[slot].addr) | 2089 | if (tpd->iovec[slot].addr) |
| 2087 | pci_unmap_single(he_dev->pci_dev, | 2090 | dma_unmap_single(&he_dev->pci_dev->dev, |
| 2088 | tpd->iovec[slot].addr, | 2091 | tpd->iovec[slot].addr, |
| 2089 | tpd->iovec[slot].len & TPD_LEN_MASK, | 2092 | tpd->iovec[slot].len & TPD_LEN_MASK, |
| 2090 | PCI_DMA_TODEVICE); | 2093 | DMA_TO_DEVICE); |
| 2091 | } | 2094 | } |
| 2092 | if (tpd->skb) { | 2095 | if (tpd->skb) { |
| 2093 | if (tpd->vcc->pop) | 2096 | if (tpd->vcc->pop) |
| @@ -2096,7 +2099,7 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid) · 2 unmodified lines | |||
| 2096 | dev_kfree_skb_any(tpd->skb); | 2099 | dev_kfree_skb_any(tpd->skb); |
| 2097 | atomic_inc(&tpd->vcc->stats->tx_err); | 2100 | atomic_inc(&tpd->vcc->stats->tx_err); |
| 2098 | } | 2101 | } |
| 2099 | pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); | 2102 | dma_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); |
| 2100 | return; | 2103 | return; |
| 2101 | } | 2104 | } |
| 2102 | } | 2105 | } |
| @@ -2550,8 +2553,8 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) · 447 unmodified lines | |||
| 2550 | } | 2553 | } |
| 2551 | 2554 | ||
| 2552 | #ifdef USE_SCATTERGATHER | 2555 | #ifdef USE_SCATTERGATHER |
| 2553 | tpd->iovec[slot].addr = pci_map_single(he_dev->pci_dev, skb->data, | 2556 | tpd->iovec[slot].addr = dma_map_single(&he_dev->pci_dev->dev, skb->data, |
| 2554 | skb_headlen(skb), PCI_DMA_TODEVICE); | 2557 | skb_headlen(skb), DMA_TO_DEVICE); |
| 2555 | tpd->iovec[slot].len = skb_headlen(skb); | 2558 | tpd->iovec[slot].len = skb_headlen(skb); |
| 2556 | ++slot; | 2559 | ++slot; |
| 2557 | 2560 | ||
| @@ -2579,9 +2582,9 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) · 21 unmodified lines | |||
| 2579 | slot = 0; | 2582 | slot = 0; |
| 2580 | } | 2583 | } |
| 2581 | 2584 | ||
| 2582 | tpd->iovec[slot].addr = pci_map_single(he_dev->pci_dev, | 2585 | tpd->iovec[slot].addr = dma_map_single(&he_dev->pci_dev->dev, |
| 2583 | (void *) page_address(frag->page) + frag->page_offset, | 2586 | (void *) page_address(frag->page) + frag->page_offset, |
| 2584 | frag->size, PCI_DMA_TODEVICE); | 2587 | frag->size, DMA_TO_DEVICE); |
| 2585 | tpd->iovec[slot].len = frag->size; | 2588 | tpd->iovec[slot].len = frag->size; |
| 2586 | ++slot; | 2589 | ++slot; |
| 2587 | 2590 | ||
| @@ -2589,7 +2592,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) · 1 unmodified line | |||
| 2589 | 2592 | ||
| 2590 | tpd->iovec[slot - 1].len |= TPD_LST; | 2593 | tpd->iovec[slot - 1].len |= TPD_LST; |
| 2591 | #else | 2594 | #else |
| 2592 | tpd->address0 = pci_map_single(he_dev->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE); | 2595 | tpd->address0 = dma_map_single(&he_dev->pci_dev->dev, skb->data, skb->len, DMA_TO_DEVICE); |
| 2593 | tpd->length0 = skb->len | TPD_LST; | 2596 | tpd->length0 = skb->len | TPD_LST; |
| 2594 | #endif | 2597 | #endif |
| 2595 | tpd->status |= TPD_INT; | 2598 | tpd->status |= TPD_INT; |
| @@ -281,7 +281,7 @@ struct he_dev { · 280 unmodified lines | |||
| 281 | int irq_peak; | 281 | int irq_peak; |
| 282 | 282 | ||
| 283 | struct tasklet_struct tasklet; | 283 | struct tasklet_struct tasklet; |
| 284 | struct pci_pool *tpd_pool; | 284 | struct dma_pool *tpd_pool; |
| 285 | struct list_head outstanding_tpds; | 285 | struct list_head outstanding_tpds; |
| 286 | 286 | ||
| 287 | dma_addr_t tpdrq_phys; | 287 | dma_addr_t tpdrq_phys; |
| @@ -296,7 +296,7 @@ struct he_dev { · 8 unmodified lines | |||
| 296 | struct he_buff **rbpl_virt; | 296 | struct he_buff **rbpl_virt; |
| 297 | unsigned long *rbpl_table; | 297 | unsigned long *rbpl_table; |
| 298 | unsigned long rbpl_hint; | 298 | unsigned long rbpl_hint; |
| 299 | struct pci_pool *rbpl_pool; | 299 | struct dma_pool *rbpl_pool; |
| 300 | dma_addr_t rbpl_phys; | 300 | dma_addr_t rbpl_phys; |
| 301 | struct he_rbp *rbpl_base, *rbpl_tail; | 301 | struct he_rbp *rbpl_base, *rbpl_tail; |
| 302 | struct list_head rbpl_outstanding; | 302 | struct list_head rbpl_outstanding; |
| @@ -458,12 +458,6 @@ static inline void update_tx_channel_config (hrz_dev * dev, short chan, u8 mode, · 457 unmodified lines | |||
| 458 | return; | 458 | return; |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | static inline u16 query_tx_channel_config (hrz_dev * dev, short chan, u8 mode) { | ||
| 462 | wr_regw (dev, TX_CHANNEL_CONFIG_COMMAND_OFF, | ||
| 463 | chan * TX_CHANNEL_CONFIG_MULT | mode); | ||
| 464 | return rd_regw (dev, TX_CHANNEL_CONFIG_DATA_OFF); | ||
| 465 | } | ||
| 466 | |||
| 467 | /********** dump functions **********/ | 461 | /********** dump functions **********/ |
| 468 | 462 | ||
| 469 | static inline void dump_skb (char * prefix, unsigned int vc, struct sk_buff * skb) { | 463 | static inline void dump_skb (char * prefix, unsigned int vc, struct sk_buff * skb) { |
| @@ -513,16 +507,6 @@ static inline void dump_framer (hrz_dev * dev) { · 43 unmodified lines | |||
| 513 | 507 | ||
| 514 | /* RX channels are 10 bit integers, these fns are quite paranoid */ | 508 | /* RX channels are 10 bit integers, these fns are quite paranoid */ |
| 515 | 509 | ||
| 516 | static inline int channel_to_vpivci (const u16 channel, short * vpi, int * vci) { | ||
| 517 | unsigned short vci_bits = 10 - vpi_bits; | ||
| 518 | if ((channel & RX_CHANNEL_MASK) == channel) { | ||
| 519 | *vci = channel & ((~0)<<vci_bits); | ||
| 520 | *vpi = channel >> vci_bits; | ||
| 521 | return channel ? 0 : -EINVAL; | ||
| 522 | } | ||
| 523 | return -EINVAL; | ||
| 524 | } | ||
| 525 | |||
| 526 | static inline int vpivci_to_channel (u16 * channel, const short vpi, const int vci) { | 510 | static inline int vpivci_to_channel (u16 * channel, const short vpi, const int vci) { |
| 527 | unsigned short vci_bits = 10 - vpi_bits; | 511 | unsigned short vci_bits = 10 - vpi_bits; |
| 528 | if (0 <= vpi && vpi < 1<<vpi_bits && 0 <= vci && vci < 1<<vci_bits) { | 512 | if (0 <= vpi && vpi < 1<<vpi_bits && 0 <= vci && vci < 1<<vci_bits) { |
| @@ -1260,14 +1244,6 @@ static u32 rx_queue_entry_next (hrz_dev * dev) { · 731 unmodified lines | |||
| 1260 | return rx_queue_entry; | 1244 | return rx_queue_entry; |
| 1261 | } | 1245 | } |
| 1262 | 1246 | ||
| 1263 | /********** handle RX disabled by device **********/ | ||
| 1264 | |||
| 1265 | static inline void rx_disabled_handler (hrz_dev * dev) { | ||
| 1266 | wr_regw (dev, RX_CONFIG_OFF, rd_regw (dev, RX_CONFIG_OFF) | RX_ENABLE); | ||
| 1267 | // count me please | ||
| 1268 | PRINTK (KERN_WARNING, "RX was disabled!"); | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | /********** handle RX data received by device **********/ | 1247 | /********** handle RX data received by device **********/ |
| 1272 | 1248 | ||
| 1273 | // called from IRQ handler | 1249 | // called from IRQ handler |
| @@ -641,7 +641,8 @@ alloc_scq(struct idt77252_dev *card, int class) · 640 unmodified lines | |||
| 641 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); | 641 | scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL); |
| 642 | if (!scq) | 642 | if (!scq) |
| 643 | return NULL; | 643 | return NULL; |
| 644 | scq->base = pci_zalloc_consistent(card->pcidev, SCQ_SIZE, &scq->paddr); | 644 | scq->base = dma_zalloc_coherent(&card->pcidev->dev, SCQ_SIZE, |
| 645 | &scq->paddr, GFP_KERNEL); | ||
| 645 | if (scq->base == NULL) { | 646 | if (scq->base == NULL) { |
| 646 | kfree(scq); | 647 | kfree(scq); |
| 647 | return NULL; | 648 | return NULL; |
| @@ -669,12 +670,12 @@ free_scq(struct idt77252_dev *card, struct scq_info *scq) · 21 unmodified lines | |||
| 669 | struct sk_buff *skb; | 670 | struct sk_buff *skb; |
| 670 | struct atm_vcc *vcc; | 671 | struct atm_vcc *vcc; |
| 671 | 672 | ||
| 672 | pci_free_consistent(card->pcidev, SCQ_SIZE, | 673 | dma_free_coherent(&card->pcidev->dev, SCQ_SIZE, |
| 673 | scq->base, scq->paddr); | 674 | scq->base, scq->paddr); |
| 674 | 675 | ||
| 675 | while ((skb = skb_dequeue(&scq->transmit))) { | 676 | while ((skb = skb_dequeue(&scq->transmit))) { |
| 676 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 677 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 677 | skb->len, PCI_DMA_TODEVICE); | 678 | skb->len, DMA_TO_DEVICE); |
| 678 | 679 | ||
| 679 | vcc = ATM_SKB(skb)->vcc; | 680 | vcc = ATM_SKB(skb)->vcc; |
| 680 | if (vcc->pop) | 681 | if (vcc->pop) |
| @@ -684,8 +685,8 @@ free_scq(struct idt77252_dev *card, struct scq_info *scq) · 3 unmodified lines | |||
| 684 | } | 685 | } |
| 685 | 686 | ||
| 686 | while ((skb = skb_dequeue(&scq->pending))) { | 687 | while ((skb = skb_dequeue(&scq->pending))) { |
| 687 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 688 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 688 | skb->len, PCI_DMA_TODEVICE); | 689 | skb->len, DMA_TO_DEVICE); |
| 689 | 690 | ||
| 690 | vcc = ATM_SKB(skb)->vcc; | 691 | vcc = ATM_SKB(skb)->vcc; |
| 691 | if (vcc->pop) | 692 | if (vcc->pop) |
| @@ -800,8 +801,8 @@ drain_scq(struct idt77252_dev *card, struct vc_map *vc) · 108 unmodified lines | |||
| 800 | if (skb) { | 801 | if (skb) { |
| 801 | TXPRINTK("%s: freeing skb at %p.\n", card->name, skb); | 802 | TXPRINTK("%s: freeing skb at %p.\n", card->name, skb); |
| 802 | 803 | ||
| 803 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 804 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 804 | skb->len, PCI_DMA_TODEVICE); | 805 | skb->len, DMA_TO_DEVICE); |
| 805 | 806 | ||
| 806 | vcc = ATM_SKB(skb)->vcc; | 807 | vcc = ATM_SKB(skb)->vcc; |
| 807 | 808 | ||
| @@ -846,8 +847,8 @@ queue_skb(struct idt77252_dev *card, struct vc_map *vc, · 38 unmodified lines | |||
| 846 | tbd = &IDT77252_PRV_TBD(skb); | 847 | tbd = &IDT77252_PRV_TBD(skb); |
| 847 | vcc = ATM_SKB(skb)->vcc; | 848 | vcc = ATM_SKB(skb)->vcc; |
| 848 | 849 | ||
| 849 | IDT77252_PRV_PADDR(skb) = pci_map_single(card->pcidev, skb->data, | 850 | IDT77252_PRV_PADDR(skb) = dma_map_single(&card->pcidev->dev, skb->data, |
| 850 | skb->len, PCI_DMA_TODEVICE); | 851 | skb->len, DMA_TO_DEVICE); |
| 851 | 852 | ||
| 852 | error = -EINVAL; | 853 | error = -EINVAL; |
| 853 | 854 | ||
| @@ -924,8 +925,8 @@ done: · 70 unmodified lines | |||
| 924 | return 0; | 925 | return 0; |
| 925 | 926 | ||
| 926 | errout: | 927 | errout: |
| 927 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 928 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 928 | skb->len, PCI_DMA_TODEVICE); | 929 | skb->len, DMA_TO_DEVICE); |
| 929 | return error; | 930 | return error; |
| 930 | } | 931 | } |
| 931 | 932 | ||
| @@ -970,8 +971,8 @@ init_rsq(struct idt77252_dev *card) · 38 unmodified lines | |||
| 970 | { | 971 | { |
| 971 | struct rsq_entry *rsqe; | 972 | struct rsq_entry *rsqe; |
| 972 | 973 | ||
| 973 | card->rsq.base = pci_zalloc_consistent(card->pcidev, RSQSIZE, | 974 | card->rsq.base = dma_zalloc_coherent(&card->pcidev->dev, RSQSIZE, |
| 974 | &card->rsq.paddr); | 975 | &card->rsq.paddr, GFP_KERNEL); |
| 975 | if (card->rsq.base == NULL) { | 976 | if (card->rsq.base == NULL) { |
| 976 | printk("%s: can't allocate RSQ.\n", card->name); | 977 | printk("%s: can't allocate RSQ.\n", card->name); |
| 977 | return -1; | 978 | return -1; |
| @@ -1001,8 +1002,8 @@ init_rsq(struct idt77252_dev *card) · 23 unmodified lines | |||
| 1001 | static void | 1002 | static void |
| 1002 | deinit_rsq(struct idt77252_dev *card) | 1003 | deinit_rsq(struct idt77252_dev *card) |
| 1003 | { | 1004 | { |
| 1004 | pci_free_consistent(card->pcidev, RSQSIZE, | 1005 | dma_free_coherent(&card->pcidev->dev, RSQSIZE, |
| 1005 | card->rsq.base, card->rsq.paddr); | 1006 | card->rsq.base, card->rsq.paddr); |
| 1006 | } | 1007 | } |
| 1007 | 1008 | ||
| 1008 | static void | 1009 | static void |
| @@ -1057,9 +1058,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) · 48 unmodified lines | |||
| 1057 | 1058 | ||
| 1058 | vcc = vc->rx_vcc; | 1059 | vcc = vc->rx_vcc; |
| 1059 | 1060 | ||
| 1060 | pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(skb), | 1061 | dma_sync_single_for_cpu(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 1061 | skb_end_pointer(skb) - skb->data, | 1062 | skb_end_pointer(skb) - skb->data, |
| 1062 | PCI_DMA_FROMDEVICE); | 1063 | DMA_FROM_DEVICE); |
| 1063 | 1064 | ||
| 1064 | if ((vcc->qos.aal == ATM_AAL0) || | 1065 | if ((vcc->qos.aal == ATM_AAL0) || |
| 1065 | (vcc->qos.aal == ATM_AAL34)) { | 1066 | (vcc->qos.aal == ATM_AAL34)) { |
| @@ -1180,9 +1181,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) · 114 unmodified lines | |||
| 1180 | return; | 1181 | return; |
| 1181 | } | 1182 | } |
| 1182 | 1183 | ||
| 1183 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 1184 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 1184 | skb_end_pointer(skb) - skb->data, | 1185 | skb_end_pointer(skb) - skb->data, |
| 1185 | PCI_DMA_FROMDEVICE); | 1186 | DMA_FROM_DEVICE); |
| 1186 | sb_pool_remove(card, skb); | 1187 | sb_pool_remove(card, skb); |
| 1187 | 1188 | ||
| 1188 | skb_trim(skb, len); | 1189 | skb_trim(skb, len); |
| @@ -1254,9 +1255,9 @@ idt77252_rx_raw(struct idt77252_dev *card) · 65 unmodified lines | |||
| 1254 | head = IDT77252_PRV_PADDR(queue) + (queue->data - queue->head - 16); | 1255 | head = IDT77252_PRV_PADDR(queue) + (queue->data - queue->head - 16); |
| 1255 | tail = readl(SAR_REG_RAWCT); | 1256 | tail = readl(SAR_REG_RAWCT); |
| 1256 | 1257 | ||
| 1257 | pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(queue), | 1258 | dma_sync_single_for_cpu(&card->pcidev->dev, IDT77252_PRV_PADDR(queue), |
| 1258 | skb_end_offset(queue) - 16, | 1259 | skb_end_offset(queue) - 16, |
| 1259 | PCI_DMA_FROMDEVICE); | 1260 | DMA_FROM_DEVICE); |
| 1260 | 1261 | ||
| 1261 | while (head != tail) { | 1262 | while (head != tail) { |
| 1262 | unsigned int vpi, vci; | 1263 | unsigned int vpi, vci; |
| @@ -1348,11 +1349,11 @@ drop: · 85 unmodified lines | |||
| 1348 | if (next) { | 1349 | if (next) { |
| 1349 | card->raw_cell_head = next; | 1350 | card->raw_cell_head = next; |
| 1350 | queue = card->raw_cell_head; | 1351 | queue = card->raw_cell_head; |
| 1351 | pci_dma_sync_single_for_cpu(card->pcidev, | 1352 | dma_sync_single_for_cpu(&card->pcidev->dev, |
| 1352 | IDT77252_PRV_PADDR(queue), | 1353 | IDT77252_PRV_PADDR(queue), |
| 1353 | (skb_end_pointer(queue) - | 1354 | (skb_end_pointer(queue) - |
| 1354 | queue->data), | 1355 | queue->data), |
| 1355 | PCI_DMA_FROMDEVICE); | 1356 | DMA_FROM_DEVICE); |
| 1356 | } else { | 1357 | } else { |
| 1357 | card->raw_cell_head = NULL; | 1358 | card->raw_cell_head = NULL; |
| 1358 | printk("%s: raw cell queue overrun\n", | 1359 | printk("%s: raw cell queue overrun\n", |
| @@ -1375,8 +1376,8 @@ init_tsq(struct idt77252_dev *card) · 16 unmodified lines | |||
| 1375 | { | 1376 | { |
| 1376 | struct tsq_entry *tsqe; | 1377 | struct tsq_entry *tsqe; |
| 1377 | 1378 | ||
| 1378 | card->tsq.base = pci_alloc_consistent(card->pcidev, RSQSIZE, | 1379 | card->tsq.base = dma_alloc_coherent(&card->pcidev->dev, RSQSIZE, |
| 1379 | &card->tsq.paddr); | 1380 | &card->tsq.paddr, GFP_KERNEL); |
| 1380 | if (card->tsq.base == NULL) { | 1381 | if (card->tsq.base == NULL) { |
| 1381 | printk("%s: can't allocate TSQ.\n", card->name); | 1382 | printk("%s: can't allocate TSQ.\n", card->name); |
| 1382 | return -1; | 1383 | return -1; |
| @@ -1398,8 +1399,8 @@ init_tsq(struct idt77252_dev *card) · 15 unmodified lines | |||
| 1398 | static void | 1399 | static void |
| 1399 | deinit_tsq(struct idt77252_dev *card) | 1400 | deinit_tsq(struct idt77252_dev *card) |
| 1400 | { | 1401 | { |
| 1401 | pci_free_consistent(card->pcidev, TSQSIZE, | 1402 | dma_free_coherent(&card->pcidev->dev, TSQSIZE, |
| 1402 | card->tsq.base, card->tsq.paddr); | 1403 | card->tsq.base, card->tsq.paddr); |
| 1403 | } | 1404 | } |
| 1404 | 1405 | ||
| 1405 | static void | 1406 | static void |
| @@ -1861,9 +1862,9 @@ add_rx_skb(struct idt77252_dev *card, int queue, · 455 unmodified lines | |||
| 1861 | goto outfree; | 1862 | goto outfree; |
| 1862 | } | 1863 | } |
| 1863 | 1864 | ||
| 1864 | paddr = pci_map_single(card->pcidev, skb->data, | 1865 | paddr = dma_map_single(&card->pcidev->dev, skb->data, |
| 1865 | skb_end_pointer(skb) - skb->data, | 1866 | skb_end_pointer(skb) - skb->data, |
| 1866 | PCI_DMA_FROMDEVICE); | 1867 | DMA_FROM_DEVICE); |
| 1867 | IDT77252_PRV_PADDR(skb) = paddr; | 1868 | IDT77252_PRV_PADDR(skb) = paddr; |
| 1868 | 1869 | ||
| 1869 | if (push_rx_skb(card, skb, queue)) { | 1870 | if (push_rx_skb(card, skb, queue)) { |
| @@ -1875,8 +1876,8 @@ add_rx_skb(struct idt77252_dev *card, int queue, · 5 unmodified lines | |||
| 1875 | return; | 1876 | return; |
| 1876 | 1877 | ||
| 1877 | outunmap: | 1878 | outunmap: |
| 1878 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 1879 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 1879 | skb_end_pointer(skb) - skb->data, PCI_DMA_FROMDEVICE); | 1880 | skb_end_pointer(skb) - skb->data, DMA_FROM_DEVICE); |
| 1880 | 1881 | ||
| 1881 | handle = IDT77252_PRV_POOL(skb); | 1882 | handle = IDT77252_PRV_POOL(skb); |
| 1882 | card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL; | 1883 | card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL; |
| @@ -1892,15 +1893,15 @@ recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb) · 9 unmodified lines | |||
| 1892 | u32 handle = IDT77252_PRV_POOL(skb); | 1893 | u32 handle = IDT77252_PRV_POOL(skb); |
| 1893 | int err; | 1894 | int err; |
| 1894 | 1895 | ||
| 1895 | pci_dma_sync_single_for_device(card->pcidev, IDT77252_PRV_PADDR(skb), | 1896 | dma_sync_single_for_device(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 1896 | skb_end_pointer(skb) - skb->data, | 1897 | skb_end_pointer(skb) - skb->data, |
| 1897 | PCI_DMA_FROMDEVICE); | 1898 | DMA_FROM_DEVICE); |
| 1898 | 1899 | ||
| 1899 | err = push_rx_skb(card, skb, POOL_QUEUE(handle)); | 1900 | err = push_rx_skb(card, skb, POOL_QUEUE(handle)); |
| 1900 | if (err) { | 1901 | if (err) { |
| 1901 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 1902 | dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb), |
| 1902 | skb_end_pointer(skb) - skb->data, | 1903 | skb_end_pointer(skb) - skb->data, |
| 1903 | PCI_DMA_FROMDEVICE); | 1904 | DMA_FROM_DEVICE); |
| 1904 | sb_pool_remove(card, skb); | 1905 | sb_pool_remove(card, skb); |
| 1905 | dev_kfree_skb(skb); | 1906 | dev_kfree_skb(skb); |
| 1906 | } | 1907 | } |
| @@ -3058,11 +3059,11 @@ deinit_card(struct idt77252_dev *card) · 1151 unmodified lines | |||
| 3058 | for (j = 0; j < FBQ_SIZE; j++) { | 3059 | for (j = 0; j < FBQ_SIZE; j++) { |
| 3059 | skb = card->sbpool[i].skb[j]; | 3060 | skb = card->sbpool[i].skb[j]; |
| 3060 | if (skb) { | 3061 | if (skb) { |
| 3061 | pci_unmap_single(card->pcidev, | 3062 | dma_unmap_single(&card->pcidev->dev, |
| 3062 | IDT77252_PRV_PADDR(skb), | 3063 | IDT77252_PRV_PADDR(skb), |
| 3063 | (skb_end_pointer(skb) - | 3064 | (skb_end_pointer(skb) - |
| 3064 | skb->data), | 3065 | skb->data), |
| 3065 | PCI_DMA_FROMDEVICE); | 3066 | DMA_FROM_DEVICE); |
| 3066 | card->sbpool[i].skb[j] = NULL; | 3067 | card->sbpool[i].skb[j] = NULL; |
| 3067 | dev_kfree_skb(skb); | 3068 | dev_kfree_skb(skb); |
| 3068 | } | 3069 | } |
| @@ -3076,8 +3077,8 @@ deinit_card(struct idt77252_dev *card) · 7 unmodified lines | |||
| 3076 | vfree(card->vcs); | 3077 | vfree(card->vcs); |
| 3077 | 3078 | ||
| 3078 | if (card->raw_cell_hnd) { | 3079 | if (card->raw_cell_hnd) { |
| 3079 | pci_free_consistent(card->pcidev, 2 * sizeof(u32), | 3080 | dma_free_coherent(&card->pcidev->dev, 2 * sizeof(u32), |
| 3080 | card->raw_cell_hnd, card->raw_cell_paddr); | 3081 | card->raw_cell_hnd, card->raw_cell_paddr); |
| 3081 | } | 3082 | } |
| 3082 | 3083 | ||
| 3083 | if (card->rsq.base) { | 3084 | if (card->rsq.base) { |
| @@ -3397,9 +3398,10 @@ static int init_card(struct atm_dev *dev) · 313 unmodified lines | |||
| 3397 | writel(0, SAR_REG_GP); | 3398 | writel(0, SAR_REG_GP); |
| 3398 | 3399 | ||
| 3399 | /* Initialize RAW Cell Handle Register */ | 3400 | /* Initialize RAW Cell Handle Register */ |
| 3400 | card->raw_cell_hnd = pci_zalloc_consistent(card->pcidev, | 3401 | card->raw_cell_hnd = dma_zalloc_coherent(&card->pcidev->dev, |
| 3401 | 2 * sizeof(u32), | 3402 | 2 * sizeof(u32), |
| 3402 | &card->raw_cell_paddr); | 3403 | &card->raw_cell_paddr, |
| 3404 | GFP_KERNEL); | ||
| 3403 | if (!card->raw_cell_hnd) { | 3405 | if (!card->raw_cell_hnd) { |
| 3404 | printk("%s: memory allocation failure.\n", card->name); | 3406 | printk("%s: memory allocation failure.\n", card->name); |
| 3405 | deinit_card(card); | 3407 | deinit_card(card); |
| @@ -3611,6 +3613,11 @@ static int idt77252_init_one(struct pci_dev *pcidev, · 205 unmodified lines | |||
| 3611 | return err; | 3613 | return err; |
| 3612 | } | 3614 | } |
| 3613 | 3615 | ||
| 3616 | if ((err = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)))) { | ||
| 3617 | printk("idt77252: can't enable DMA for PCI device at %s\n", pci_name(pcidev)); | ||
| 3618 | return err; | ||
| 3619 | } | ||
| 3620 | |||
| 3614 | card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); | 3621 | card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); |
| 3615 | if (!card) { | 3622 | if (!card) { |
| 3616 | printk("idt77252-%d: can't allocate private data\n", index); | 3623 | printk("idt77252-%d: can't allocate private data\n", index); |
| @@ -1185,8 +1185,8 @@ static int rx_pkt(struct atm_dev *dev) · 1184 unmodified lines | |||
| 1185 | 1185 | ||
| 1186 | /* Build the DLE structure */ | 1186 | /* Build the DLE structure */ |
| 1187 | wr_ptr = iadev->rx_dle_q.write; | 1187 | wr_ptr = iadev->rx_dle_q.write; |
| 1188 | wr_ptr->sys_pkt_addr = pci_map_single(iadev->pci, skb->data, | 1188 | wr_ptr->sys_pkt_addr = dma_map_single(&iadev->pci->dev, skb->data, |
| 1189 | len, PCI_DMA_FROMDEVICE); | 1189 | len, DMA_FROM_DEVICE); |
| 1190 | wr_ptr->local_pkt_addr = buf_addr; | 1190 | wr_ptr->local_pkt_addr = buf_addr; |
| 1191 | wr_ptr->bytes = len; /* We don't know this do we ?? */ | 1191 | wr_ptr->bytes = len; /* We don't know this do we ?? */ |
| 1192 | wr_ptr->mode = DMA_INT_ENABLE; | 1192 | wr_ptr->mode = DMA_INT_ENABLE; |
| @@ -1306,8 +1306,8 @@ static void rx_dle_intr(struct atm_dev *dev) · 113 unmodified lines | |||
| 1306 | u_short length; | 1306 | u_short length; |
| 1307 | struct ia_vcc *ia_vcc; | 1307 | struct ia_vcc *ia_vcc; |
| 1308 | 1308 | ||
| 1309 | pci_unmap_single(iadev->pci, iadev->rx_dle_q.write->sys_pkt_addr, | 1309 | dma_unmap_single(&iadev->pci->dev, iadev->rx_dle_q.write->sys_pkt_addr, |
| 1310 | len, PCI_DMA_FROMDEVICE); | 1310 | len, DMA_FROM_DEVICE); |
| 1311 | /* no VCC related housekeeping done as yet. lets see */ | 1311 | /* no VCC related housekeeping done as yet. lets see */ |
| 1312 | vcc = ATM_SKB(skb)->vcc; | 1312 | vcc = ATM_SKB(skb)->vcc; |
| 1313 | if (!vcc) { | 1313 | if (!vcc) { |
| @@ -1430,8 +1430,8 @@ static int rx_init(struct atm_dev *dev) · 116 unmodified lines | |||
| 1430 | // spin_lock_init(&iadev->rx_lock); | 1430 | // spin_lock_init(&iadev->rx_lock); |
| 1431 | 1431 | ||
| 1432 | /* Allocate 4k bytes - more aligned than needed (4k boundary) */ | 1432 | /* Allocate 4k bytes - more aligned than needed (4k boundary) */ |
| 1433 | dle_addr = pci_alloc_consistent(iadev->pci, DLE_TOTAL_SIZE, | 1433 | dle_addr = dma_alloc_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, |
| 1434 | &iadev->rx_dle_dma); | 1434 | &iadev->rx_dle_dma, GFP_KERNEL); |
| 1435 | if (!dle_addr) { | 1435 | if (!dle_addr) { |
| 1436 | printk(KERN_ERR DEV_LABEL "can't allocate DLEs\n"); | 1436 | printk(KERN_ERR DEV_LABEL "can't allocate DLEs\n"); |
| 1437 | goto err_out; | 1437 | goto err_out; |
| @@ -1631,8 +1631,8 @@ static int rx_init(struct atm_dev *dev) · 193 unmodified lines | |||
| 1631 | return 0; | 1631 | return 0; |
| 1632 | 1632 | ||
| 1633 | err_free_dle: | 1633 | err_free_dle: |
| 1634 | pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->rx_dle_q.start, | 1634 | dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->rx_dle_q.start, |
| 1635 | iadev->rx_dle_dma); | 1635 | iadev->rx_dle_dma); |
| 1636 | err_out: | 1636 | err_out: |
| 1637 | return -ENOMEM; | 1637 | return -ENOMEM; |
| 1638 | } | 1638 | } |
| @@ -1702,8 +1702,8 @@ static void tx_dle_intr(struct atm_dev *dev) · 63 unmodified lines | |||
| 1702 | 1702 | ||
| 1703 | /* Revenge of the 2 dle (skb + trailer) used in ia_pkt_tx() */ | 1703 | /* Revenge of the 2 dle (skb + trailer) used in ia_pkt_tx() */ |
| 1704 | if (!((dle - iadev->tx_dle_q.start)%(2*sizeof(struct dle)))) { | 1704 | if (!((dle - iadev->tx_dle_q.start)%(2*sizeof(struct dle)))) { |
| 1705 | pci_unmap_single(iadev->pci, dle->sys_pkt_addr, skb->len, | 1705 | dma_unmap_single(&iadev->pci->dev, dle->sys_pkt_addr, skb->len, |
| 1706 | PCI_DMA_TODEVICE); | 1706 | DMA_TO_DEVICE); |
| 1707 | } | 1707 | } |
| 1708 | vcc = ATM_SKB(skb)->vcc; | 1708 | vcc = ATM_SKB(skb)->vcc; |
| 1709 | if (!vcc) { | 1709 | if (!vcc) { |
| @@ -1917,8 +1917,8 @@ static int tx_init(struct atm_dev *dev) · 207 unmodified lines | |||
| 1917 | readw(iadev->seg_reg+SEG_MASK_REG));) | 1917 | readw(iadev->seg_reg+SEG_MASK_REG));) |
| 1918 | 1918 | ||
| 1919 | /* Allocate 4k (boundary aligned) bytes */ | 1919 | /* Allocate 4k (boundary aligned) bytes */ |
| 1920 | dle_addr = pci_alloc_consistent(iadev->pci, DLE_TOTAL_SIZE, | 1920 | dle_addr = dma_alloc_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, |
| 1921 | &iadev->tx_dle_dma); | 1921 | &iadev->tx_dle_dma, GFP_KERNEL); |
| 1922 | if (!dle_addr) { | 1922 | if (!dle_addr) { |
| 1923 | printk(KERN_ERR DEV_LABEL "can't allocate DLEs\n"); | 1923 | printk(KERN_ERR DEV_LABEL "can't allocate DLEs\n"); |
| 1924 | goto err_out; | 1924 | goto err_out; |
| @@ -1989,8 +1989,10 @@ static int tx_init(struct atm_dev *dev) · 64 unmodified lines | |||
| 1989 | goto err_free_tx_bufs; | 1989 | goto err_free_tx_bufs; |
| 1990 | } | 1990 | } |
| 1991 | iadev->tx_buf[i].cpcs = cpcs; | 1991 | iadev->tx_buf[i].cpcs = cpcs; |
| 1992 | iadev->tx_buf[i].dma_addr = pci_map_single(iadev->pci, | 1992 | iadev->tx_buf[i].dma_addr = dma_map_single(&iadev->pci->dev, |
| 1993 | cpcs, sizeof(*cpcs), PCI_DMA_TODEVICE); | 1993 | cpcs, |
| 1994 | sizeof(*cpcs), | ||
| 1995 | DMA_TO_DEVICE); | ||
| 1994 | } | 1996 | } |
| 1995 | iadev->desc_tbl = kmalloc(iadev->num_tx_desc * | 1997 | iadev->desc_tbl = kmalloc(iadev->num_tx_desc * |
| 1996 | sizeof(struct desc_tbl_t), GFP_KERNEL); | 1998 | sizeof(struct desc_tbl_t), GFP_KERNEL); |
| @@ -2198,14 +2200,14 @@ err_free_tx_bufs: · 201 unmodified lines | |||
| 2198 | while (--i >= 0) { | 2200 | while (--i >= 0) { |
| 2199 | struct cpcs_trailer_desc *desc = iadev->tx_buf + i; | 2201 | struct cpcs_trailer_desc *desc = iadev->tx_buf + i; |
| 2200 | 2202 | ||
| 2201 | pci_unmap_single(iadev->pci, desc->dma_addr, | 2203 | dma_unmap_single(&iadev->pci->dev, desc->dma_addr, |
| 2202 | sizeof(*desc->cpcs), PCI_DMA_TODEVICE); | 2204 | sizeof(*desc->cpcs), DMA_TO_DEVICE); |
| 2203 | kfree(desc->cpcs); | 2205 | kfree(desc->cpcs); |
| 2204 | } | 2206 | } |
| 2205 | kfree(iadev->tx_buf); | 2207 | kfree(iadev->tx_buf); |
| 2206 | err_free_dle: | 2208 | err_free_dle: |
| 2207 | pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->tx_dle_q.start, | 2209 | dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->tx_dle_q.start, |
| 2208 | iadev->tx_dle_dma); | 2210 | iadev->tx_dle_dma); |
| 2209 | err_out: | 2211 | err_out: |
| 2210 | return -ENOMEM; | 2212 | return -ENOMEM; |
| 2211 | } | 2213 | } |
| @@ -2476,20 +2478,20 @@ static void ia_free_tx(IADEV *iadev) · 264 unmodified lines | |||
| 2476 | for (i = 0; i < iadev->num_tx_desc; i++) { | 2478 | for (i = 0; i < iadev->num_tx_desc; i++) { |
| 2477 | struct cpcs_trailer_desc *desc = iadev->tx_buf + i; | 2479 | struct cpcs_trailer_desc *desc = iadev->tx_buf + i; |
| 2478 | 2480 | ||
| 2479 | pci_unmap_single(iadev->pci, desc->dma_addr, | 2481 | dma_unmap_single(&iadev->pci->dev, desc->dma_addr, |
| 2480 | sizeof(*desc->cpcs), PCI_DMA_TODEVICE); | 2482 | sizeof(*desc->cpcs), DMA_TO_DEVICE); |
| 2481 | kfree(desc->cpcs); | 2483 | kfree(desc->cpcs); |
| 2482 | } | 2484 | } |
| 2483 | kfree(iadev->tx_buf); | 2485 | kfree(iadev->tx_buf); |
| 2484 | pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->tx_dle_q.start, | 2486 | dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->tx_dle_q.start, |
| 2485 | iadev->tx_dle_dma); | 2487 | iadev->tx_dle_dma); |
| 2486 | } | 2488 | } |
| 2487 | 2489 | ||
| 2488 | static void ia_free_rx(IADEV *iadev) | 2490 | static void ia_free_rx(IADEV *iadev) |
| 2489 | { | 2491 | { |
| 2490 | kfree(iadev->rx_open); | 2492 | kfree(iadev->rx_open); |
| 2491 | pci_free_consistent(iadev->pci, DLE_TOTAL_SIZE, iadev->rx_dle_q.start, | 2493 | dma_free_coherent(&iadev->pci->dev, DLE_TOTAL_SIZE, iadev->rx_dle_q.start, |
| 2492 | iadev->rx_dle_dma); | 2494 | iadev->rx_dle_dma); |
| 2493 | } | 2495 | } |
| 2494 | 2496 | ||
| 2495 | static int ia_start(struct atm_dev *dev) | 2497 | static int ia_start(struct atm_dev *dev) |
| @@ -3009,8 +3011,8 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) { · 513 unmodified lines | |||
| 3009 | /* Build the DLE structure */ | 3011 | /* Build the DLE structure */ |
| 3010 | wr_ptr = iadev->tx_dle_q.write; | 3012 | wr_ptr = iadev->tx_dle_q.write; |
| 3011 | memset((caddr_t)wr_ptr, 0, sizeof(*wr_ptr)); | 3013 | memset((caddr_t)wr_ptr, 0, sizeof(*wr_ptr)); |
| 3012 | wr_ptr->sys_pkt_addr = pci_map_single(iadev->pci, skb->data, | 3014 | wr_ptr->sys_pkt_addr = dma_map_single(&iadev->pci->dev, skb->data, |
| 3013 | skb->len, PCI_DMA_TODEVICE); | 3015 | skb->len, DMA_TO_DEVICE); |
| 3014 | wr_ptr->local_pkt_addr = (buf_desc_ptr->buf_start_hi << 16) | | 3016 | wr_ptr->local_pkt_addr = (buf_desc_ptr->buf_start_hi << 16) | |
| 3015 | buf_desc_ptr->buf_start_lo; | 3017 | buf_desc_ptr->buf_start_lo; |
| 3016 | /* wr_ptr->bytes = swap_byte_order(total_len); didn't seem to affect?? */ | 3018 | /* wr_ptr->bytes = swap_byte_order(total_len); didn't seem to affect?? */ |
| @@ -346,7 +346,8 @@ static void lanai_buf_allocate(struct lanai_buffer *buf, · 345 unmodified lines | |||
| 346 | * everything, but the way the lanai uses DMA memory would | 346 | * everything, but the way the lanai uses DMA memory would |
| 347 | * make that a terrific pain. This is much simpler. | 347 | * make that a terrific pain. This is much simpler. |
| 348 | */ | 348 | */ |
| 349 | buf->start = pci_alloc_consistent(pci, size, &buf->dmaaddr); | 349 | buf->start = dma_alloc_coherent(&pci->dev, |
| 350 | size, &buf->dmaaddr, GFP_KERNEL); | ||
| 350 | if (buf->start != NULL) { /* Success */ | 351 | if (buf->start != NULL) { /* Success */ |
| 351 | /* Lanai requires 256-byte alignment of DMA bufs */ | 352 | /* Lanai requires 256-byte alignment of DMA bufs */ |
| 352 | APRINTK((buf->dmaaddr & ~0xFFFFFF00) == 0, | 353 | APRINTK((buf->dmaaddr & ~0xFFFFFF00) == 0, |
| @@ -372,8 +373,8 @@ static void lanai_buf_deallocate(struct lanai_buffer *buf, · 19 unmodified lines | |||
| 372 | struct pci_dev *pci) | 373 | struct pci_dev *pci) |
| 373 | { | 374 | { |
| 374 | if (buf->start != NULL) { | 375 | if (buf->start != NULL) { |
| 375 | pci_free_consistent(pci, lanai_buf_size(buf), | 376 | dma_free_coherent(&pci->dev, lanai_buf_size(buf), |
| 376 | buf->start, buf->dmaaddr); | 377 | buf->start, buf->dmaaddr); |
| 377 | buf->start = buf->end = buf->ptr = NULL; | 378 | buf->start = buf->end = buf->ptr = NULL; |
| 378 | } | 379 | } |
| 379 | } | 380 | } |
| @@ -681,15 +682,6 @@ static inline int aal5_size(int size) · 301 unmodified lines | |||
| 681 | return cells * 48; | 682 | return cells * 48; |
| 682 | } | 683 | } |
| 683 | 684 | ||
| 684 | /* How many bytes can we send if we have "space" space, assuming we have | ||
| 685 | * to send full cells | ||
| 686 | */ | ||
| 687 | static inline int aal5_spacefor(int space) | ||
| 688 | { | ||
| 689 | int cells = space / 48; | ||
| 690 | return cells * 48; | ||
| 691 | } | ||
| 692 | |||
| 693 | /* -------------------- FREE AN ATM SKB: */ | 685 | /* -------------------- FREE AN ATM SKB: */ |
| 694 | 686 | ||
| 695 | static inline void lanai_free_skb(struct atm_vcc *atmvcc, struct sk_buff *skb) | 687 | static inline void lanai_free_skb(struct atm_vcc *atmvcc, struct sk_buff *skb) |
| @@ -1953,12 +1945,7 @@ static int lanai_pci_start(struct lanai_dev *lanai) · 1257 unmodified lines | |||
| 1953 | return -ENXIO; | 1945 | return -ENXIO; |
| 1954 | } | 1946 | } |
| 1955 | pci_set_master(pci); | 1947 | pci_set_master(pci); |
| 1956 | if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) != 0) { | 1948 | if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32)) != 0) { |
| 1957 | printk(KERN_WARNING DEV_LABEL | ||
| 1958 | "(itf %d): No suitable DMA available.\n", lanai->number); | ||
| 1959 | return -EBUSY; | ||
| 1960 | } | ||
| 1961 | if (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) != 0) { | ||
| 1962 | printk(KERN_WARNING DEV_LABEL | 1949 | printk(KERN_WARNING DEV_LABEL |
| 1963 | "(itf %d): No suitable DMA available.\n", lanai->number); | 1950 | "(itf %d): No suitable DMA available.\n", lanai->number); |
| 1964 | return -EBUSY; | 1951 | return -EBUSY; |
| @@ -252,10 +252,10 @@ static void nicstar_remove_one(struct pci_dev *pcidev) · 251 unmodified lines | |||
| 252 | free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc); | 252 | free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc); |
| 253 | } | 253 | } |
| 254 | idr_destroy(&card->idr); | 254 | idr_destroy(&card->idr); |
| 255 | pci_free_consistent(card->pcidev, NS_RSQSIZE + NS_RSQ_ALIGNMENT, | 255 | dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT, |
| 256 | card->rsq.org, card->rsq.dma); | 256 | card->rsq.org, card->rsq.dma); |
| 257 | pci_free_consistent(card->pcidev, NS_TSQSIZE + NS_TSQ_ALIGNMENT, | 257 | dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT, |
| 258 | card->tsq.org, card->tsq.dma); | 258 | card->tsq.org, card->tsq.dma); |
| 259 | free_irq(card->pcidev->irq, card); | 259 | free_irq(card->pcidev->irq, card); |
| 260 | iounmap(card->membase); | 260 | iounmap(card->membase); |
| 261 | kfree(card); | 261 | kfree(card); |
| @@ -370,8 +370,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev) · 108 unmodified lines | |||
| 370 | ns_init_card_error(card, error); | 370 | ns_init_card_error(card, error); |
| 371 | return error; | 371 | return error; |
| 372 | } | 372 | } |
| 373 | if ((pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)) != 0) || | 373 | if (dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)) != 0) { |
| 374 | (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32)) != 0)) { | ||
| 375 | printk(KERN_WARNING | 374 | printk(KERN_WARNING |
| 376 | "nicstar%d: No suitable DMA available.\n", i); | 375 | "nicstar%d: No suitable DMA available.\n", i); |
| 377 | error = 2; | 376 | error = 2; |
| @@ -535,9 +534,9 @@ static int ns_init_card(int i, struct pci_dev *pcidev) · 157 unmodified lines | |||
| 535 | writel(0x00000000, card->membase + VPM); | 534 | writel(0x00000000, card->membase + VPM); |
| 536 | 535 | ||
| 537 | /* Initialize TSQ */ | 536 | /* Initialize TSQ */ |
| 538 | card->tsq.org = pci_alloc_consistent(card->pcidev, | 537 | card->tsq.org = dma_alloc_coherent(&card->pcidev->dev, |
| 539 | NS_TSQSIZE + NS_TSQ_ALIGNMENT, | 538 | NS_TSQSIZE + NS_TSQ_ALIGNMENT, |
| 540 | &card->tsq.dma); | 539 | &card->tsq.dma, GFP_KERNEL); |
| 541 | if (card->tsq.org == NULL) { | 540 | if (card->tsq.org == NULL) { |
| 542 | printk("nicstar%d: can't allocate TSQ.\n", i); | 541 | printk("nicstar%d: can't allocate TSQ.\n", i); |
| 543 | error = 10; | 542 | error = 10; |
| @@ -554,9 +553,9 @@ static int ns_init_card(int i, struct pci_dev *pcidev) · 10 unmodified lines | |||
| 554 | PRINTK("nicstar%d: TSQ base at 0x%p.\n", i, card->tsq.base); | 553 | PRINTK("nicstar%d: TSQ base at 0x%p.\n", i, card->tsq.base); |
| 555 | 554 | ||
| 556 | /* Initialize RSQ */ | 555 | /* Initialize RSQ */ |
| 557 | card->rsq.org = pci_alloc_consistent(card->pcidev, | 556 | card->rsq.org = dma_alloc_coherent(&card->pcidev->dev, |
| 558 | NS_RSQSIZE + NS_RSQ_ALIGNMENT, | 557 | NS_RSQSIZE + NS_RSQ_ALIGNMENT, |
| 559 | &card->rsq.dma); | 558 | &card->rsq.dma, GFP_KERNEL); |
| 560 | if (card->rsq.org == NULL) { | 559 | if (card->rsq.org == NULL) { |
| 561 | printk("nicstar%d: can't allocate RSQ.\n", i); | 560 | printk("nicstar%d: can't allocate RSQ.\n", i); |
| 562 | error = 11; | 561 | error = 11; |
| @@ -874,7 +873,8 @@ static scq_info *get_scq(ns_dev *card, int size, u32 scd) · 311 unmodified lines | |||
| 874 | scq = kmalloc(sizeof(scq_info), GFP_KERNEL); | 873 | scq = kmalloc(sizeof(scq_info), GFP_KERNEL); |
| 875 | if (!scq) | 874 | if (!scq) |
| 876 | return NULL; | 875 | return NULL; |
| 877 | scq->org = pci_alloc_consistent(card->pcidev, 2 * size, &scq->dma); | 876 | scq->org = dma_alloc_coherent(&card->pcidev->dev, |
| 877 | 2 * size, &scq->dma, GFP_KERNEL); | ||
| 878 | if (!scq->org) { | 878 | if (!scq->org) { |
| 879 | kfree(scq); | 879 | kfree(scq); |
| 880 | return NULL; | 880 | return NULL; |
| @@ -936,10 +936,10 @@ static void free_scq(ns_dev *card, scq_info *scq, struct atm_vcc *vcc) · 55 unmodified lines | |||
| 936 | } | 936 | } |
| 937 | } | 937 | } |
| 938 | kfree(scq->skb); | 938 | kfree(scq->skb); |
| 939 | pci_free_consistent(card->pcidev, | 939 | dma_free_coherent(&card->pcidev->dev, |
| 940 | 2 * (scq->num_entries == VBR_SCQ_NUM_ENTRIES ? | 940 | 2 * (scq->num_entries == VBR_SCQ_NUM_ENTRIES ? |
| 941 | VBR_SCQSIZE : CBR_SCQSIZE), | 941 | VBR_SCQSIZE : CBR_SCQSIZE), |
| 942 | scq->org, scq->dma); | 942 | scq->org, scq->dma); |
| 943 | kfree(scq); | 943 | kfree(scq); |
| 944 | } | 944 | } |
| 945 | 945 | ||
| @@ -957,11 +957,11 @@ static void push_rxbufs(ns_dev * card, struct sk_buff *skb) · 11 unmodified lines | |||
| 957 | handle2 = NULL; | 957 | handle2 = NULL; |
| 958 | addr2 = 0; | 958 | addr2 = 0; |
| 959 | handle1 = skb; | 959 | handle1 = skb; |
| 960 | addr1 = pci_map_single(card->pcidev, | 960 | addr1 = dma_map_single(&card->pcidev->dev, |
| 961 | skb->data, | 961 | skb->data, |
| 962 | (NS_PRV_BUFTYPE(skb) == BUF_SM | 962 | (NS_PRV_BUFTYPE(skb) == BUF_SM |
| 963 | ? NS_SMSKBSIZE : NS_LGSKBSIZE), | 963 | ? NS_SMSKBSIZE : NS_LGSKBSIZE), |
| 964 | PCI_DMA_TODEVICE); | 964 | DMA_TO_DEVICE); |
| 965 | NS_PRV_DMA(skb) = addr1; /* save so we can unmap later */ | 965 | NS_PRV_DMA(skb) = addr1; /* save so we can unmap later */ |
| 966 | 966 | ||
| 967 | #ifdef GENERAL_DEBUG | 967 | #ifdef GENERAL_DEBUG |
| @@ -1670,8 +1670,8 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb) · 702 unmodified lines | |||
| 1670 | 1670 | ||
| 1671 | ATM_SKB(skb)->vcc = vcc; | 1671 | ATM_SKB(skb)->vcc = vcc; |
| 1672 | 1672 | ||
| 1673 | NS_PRV_DMA(skb) = pci_map_single(card->pcidev, skb->data, | 1673 | NS_PRV_DMA(skb) = dma_map_single(&card->pcidev->dev, skb->data, |
| 1674 | skb->len, PCI_DMA_TODEVICE); | 1674 | skb->len, DMA_TO_DEVICE); |
| 1675 | 1675 | ||
| 1676 | if (vcc->qos.aal == ATM_AAL5) { | 1676 | if (vcc->qos.aal == ATM_AAL5) { |
| 1677 | buflen = (skb->len + 47 + 8) / 48 * 48; /* Multiple of 48 */ | 1677 | buflen = (skb->len + 47 + 8) / 48 * 48; /* Multiple of 48 */ |
| @@ -1930,10 +1930,10 @@ static void drain_scq(ns_dev * card, scq_info * scq, int pos) · 252 unmodified lines | |||
| 1930 | XPRINTK("nicstar%d: freeing skb at 0x%p (index %d).\n", | 1930 | XPRINTK("nicstar%d: freeing skb at 0x%p (index %d).\n", |
| 1931 | card->index, skb, i); | 1931 | card->index, skb, i); |
| 1932 | if (skb != NULL) { | 1932 | if (skb != NULL) { |
| 1933 | pci_unmap_single(card->pcidev, | 1933 | dma_unmap_single(&card->pcidev->dev, |
| 1934 | NS_PRV_DMA(skb), | 1934 | NS_PRV_DMA(skb), |
| 1935 | skb->len, | 1935 | skb->len, |
| 1936 | PCI_DMA_TODEVICE); | 1936 | DMA_TO_DEVICE); |
| 1937 | vcc = ATM_SKB(skb)->vcc; | 1937 | vcc = ATM_SKB(skb)->vcc; |
| 1938 | if (vcc && vcc->pop != NULL) { | 1938 | if (vcc && vcc->pop != NULL) { |
| 1939 | vcc->pop(vcc, skb); | 1939 | vcc->pop(vcc, skb); |
| @@ -1992,16 +1992,16 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe) · 52 unmodified lines | |||
| 1992 | return; | 1992 | return; |
| 1993 | } | 1993 | } |
| 1994 | idr_remove(&card->idr, id); | 1994 | idr_remove(&card->idr, id); |
| 1995 | pci_dma_sync_single_for_cpu(card->pcidev, | 1995 | dma_sync_single_for_cpu(&card->pcidev->dev, |
| 1996 | NS_PRV_DMA(skb), | 1996 | NS_PRV_DMA(skb), |
| 1997 | (NS_PRV_BUFTYPE(skb) == BUF_SM | 1997 | (NS_PRV_BUFTYPE(skb) == BUF_SM |
| 1998 | ? NS_SMSKBSIZE : NS_LGSKBSIZE), | 1998 | ? NS_SMSKBSIZE : NS_LGSKBSIZE), |
| 1999 | PCI_DMA_FROMDEVICE); | 1999 | DMA_FROM_DEVICE); |
| 2000 | pci_unmap_single(card->pcidev, | 2000 | dma_unmap_single(&card->pcidev->dev, |
| 2001 | NS_PRV_DMA(skb), | 2001 | NS_PRV_DMA(skb), |
| 2002 | (NS_PRV_BUFTYPE(skb) == BUF_SM | 2002 | (NS_PRV_BUFTYPE(skb) == BUF_SM |
| 2003 | ? NS_SMSKBSIZE : NS_LGSKBSIZE), | 2003 | ? NS_SMSKBSIZE : NS_LGSKBSIZE), |
| 2004 | PCI_DMA_FROMDEVICE); | 2004 | DMA_FROM_DEVICE); |
| 2005 | vpi = ns_rsqe_vpi(rsqe); | 2005 | vpi = ns_rsqe_vpi(rsqe); |
| 2006 | vci = ns_rsqe_vci(rsqe); | 2006 | vci = ns_rsqe_vci(rsqe); |
| 2007 | if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits) { | 2007 | if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits) { |
| @@ -785,8 +785,8 @@ static void solos_bh(unsigned long card_arg) · 784 unmodified lines | |||
| 785 | skb = card->rx_skb[port]; | 785 | skb = card->rx_skb[port]; |
| 786 | card->rx_skb[port] = NULL; | 786 | card->rx_skb[port] = NULL; |
| 787 | 787 | ||
| 788 | pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr, | 788 | dma_unmap_single(&card->dev->dev, SKB_CB(skb)->dma_addr, |
| 789 | RX_DMA_SIZE, PCI_DMA_FROMDEVICE); | 789 | RX_DMA_SIZE, DMA_FROM_DEVICE); |
| 790 | 790 | ||
| 791 | header = (void *)skb->data; | 791 | header = (void *)skb->data; |
| 792 | size = le16_to_cpu(header->size); | 792 | size = le16_to_cpu(header->size); |
| @@ -872,8 +872,8 @@ static void solos_bh(unsigned long card_arg) · 79 unmodified lines | |||
| 872 | struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, GFP_ATOMIC); | 872 | struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, GFP_ATOMIC); |
| 873 | if (skb) { | 873 | if (skb) { |
| 874 | SKB_CB(skb)->dma_addr = | 874 | SKB_CB(skb)->dma_addr = |
| 875 | pci_map_single(card->dev, skb->data, | 875 | dma_map_single(&card->dev->dev, skb->data, |
| 876 | RX_DMA_SIZE, PCI_DMA_FROMDEVICE); | 876 | RX_DMA_SIZE, DMA_FROM_DEVICE); |
| 877 | iowrite32(SKB_CB(skb)->dma_addr, | 877 | iowrite32(SKB_CB(skb)->dma_addr, |
| 878 | card->config_regs + RX_DMA_ADDR(port)); | 878 | card->config_regs + RX_DMA_ADDR(port)); |
| 879 | card->rx_skb[port] = skb; | 879 | card->rx_skb[port] = skb; |
| @@ -1069,8 +1069,8 @@ static uint32_t fpga_tx(struct solos_card *card) · 189 unmodified lines | |||
| 1069 | if (tx_pending & 1) { | 1069 | if (tx_pending & 1) { |
| 1070 | struct sk_buff *oldskb = card->tx_skb[port]; | 1070 | struct sk_buff *oldskb = card->tx_skb[port]; |
| 1071 | if (oldskb) { | 1071 | if (oldskb) { |
| 1072 | pci_unmap_single(card->dev, SKB_CB(oldskb)->dma_addr, | 1072 | dma_unmap_single(&card->dev->dev, SKB_CB(oldskb)->dma_addr, |
| 1073 | oldskb->len, PCI_DMA_TODEVICE); | 1073 | oldskb->len, DMA_TO_DEVICE); |
| 1074 | card->tx_skb[port] = NULL; | 1074 | card->tx_skb[port] = NULL; |
| 1075 | } | 1075 | } |
| 1076 | spin_lock(&card->tx_queue_lock); | 1076 | spin_lock(&card->tx_queue_lock); |
| @@ -1089,8 +1089,8 @@ static uint32_t fpga_tx(struct solos_card *card) · 12 unmodified lines | |||
| 1089 | data = card->dma_bounce + (BUF_SIZE * port); | 1089 | data = card->dma_bounce + (BUF_SIZE * port); |
| 1090 | memcpy(data, skb->data, skb->len); | 1090 | memcpy(data, skb->data, skb->len); |
| 1091 | } | 1091 | } |
| 1092 | SKB_CB(skb)->dma_addr = pci_map_single(card->dev, data, | 1092 | SKB_CB(skb)->dma_addr = dma_map_single(&card->dev->dev, data, |
| 1093 | skb->len, PCI_DMA_TODEVICE); | 1093 | skb->len, DMA_TO_DEVICE); |
| 1094 | card->tx_skb[port] = skb; | 1094 | card->tx_skb[port] = skb; |
| 1095 | iowrite32(SKB_CB(skb)->dma_addr, | 1095 | iowrite32(SKB_CB(skb)->dma_addr, |
| 1096 | card->config_regs + TX_DMA_ADDR(port)); | 1096 | card->config_regs + TX_DMA_ADDR(port)); |
| @@ -1210,7 +1210,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) · 113 unmodified lines | |||
| 1210 | goto out; | 1210 | goto out; |
| 1211 | } | 1211 | } |
| 1212 | 1212 | ||
| 1213 | err = pci_set_dma_mask(dev, DMA_BIT_MASK(32)); | 1213 | err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); |
| 1214 | if (err) { | 1214 | if (err) { |
| 1215 | dev_warn(&dev->dev, "Failed to set 32-bit DMA mask\n"); | 1215 | dev_warn(&dev->dev, "Failed to set 32-bit DMA mask\n"); |
| 1216 | goto out; | 1216 | goto out; |
| @@ -1411,14 +1411,14 @@ static void atm_remove(struct solos_card *card) · 194 unmodified lines | |||
| 1411 | 1411 | ||
| 1412 | skb = card->rx_skb[i]; | 1412 | skb = card->rx_skb[i]; |
| 1413 | if (skb) { | 1413 | if (skb) { |
| 1414 | pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr, | 1414 | dma_unmap_single(&card->dev->dev, SKB_CB(skb)->dma_addr, |
| 1415 | RX_DMA_SIZE, PCI_DMA_FROMDEVICE); | 1415 | RX_DMA_SIZE, DMA_FROM_DEVICE); |
| 1416 | dev_kfree_skb(skb); | 1416 | dev_kfree_skb(skb); |
| 1417 | } | 1417 | } |
| 1418 | skb = card->tx_skb[i]; | 1418 | skb = card->tx_skb[i]; |
| 1419 | if (skb) { | 1419 | if (skb) { |
| 1420 | pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr, | 1420 | dma_unmap_single(&card->dev->dev, SKB_CB(skb)->dma_addr, |
| 1421 | skb->len, PCI_DMA_TODEVICE); | 1421 | skb->len, DMA_TO_DEVICE); |
| 1422 | dev_kfree_skb(skb); | 1422 | dev_kfree_skb(skb); |
| 1423 | } | 1423 | } |
| 1424 | while ((skb = skb_dequeue(&card->tx_queue[i]))) | 1424 | while ((skb = skb_dequeue(&card->tx_queue[i]))) |
| @@ -1306,19 +1306,20 @@ static int zatm_start(struct atm_dev *dev) · 1305 unmodified lines | |||
| 1306 | 1306 | ||
| 1307 | if (!mbx_entries[i]) | 1307 | if (!mbx_entries[i]) |
| 1308 | continue; | 1308 | continue; |
| 1309 | mbx = pci_alloc_consistent(pdev, 2*MBX_SIZE(i), &mbx_dma); | 1309 | mbx = dma_alloc_coherent(&pdev->dev, |
| 1310 | 2 * MBX_SIZE(i), &mbx_dma, GFP_KERNEL); | ||
| 1310 | if (!mbx) { | 1311 | if (!mbx) { |
| 1311 | error = -ENOMEM; | 1312 | error = -ENOMEM; |
| 1312 | goto out; | 1313 | goto out; |
| 1313 | } | 1314 | } |
| 1314 | /* | 1315 | /* |
| 1315 | * Alignment provided by pci_alloc_consistent() isn't enough | 1316 | * Alignment provided by dma_alloc_coherent() isn't enough |
| 1316 | * for this device. | 1317 | * for this device. |
| 1317 | */ | 1318 | */ |
| 1318 | if (((unsigned long)mbx ^ mbx_dma) & 0xffff) { | 1319 | if (((unsigned long)mbx ^ mbx_dma) & 0xffff) { |
| 1319 | printk(KERN_ERR DEV_LABEL "(itf %d): system " | 1320 | printk(KERN_ERR DEV_LABEL "(itf %d): system " |
| 1320 | "bus incompatible with driver\n", dev->number); | 1321 | "bus incompatible with driver\n", dev->number); |
| 1321 | pci_free_consistent(pdev, 2*MBX_SIZE(i), mbx, mbx_dma); | 1322 | dma_free_coherent(&pdev->dev, 2*MBX_SIZE(i), mbx, mbx_dma); |
| 1322 | error = -ENODEV; | 1323 | error = -ENODEV; |
| 1323 | goto out; | 1324 | goto out; |
| 1324 | } | 1325 | } |
| @@ -1354,9 +1355,9 @@ out_tx: · 29 unmodified lines | |||
| 1354 | kfree(zatm_dev->tx_map); | 1355 | kfree(zatm_dev->tx_map); |
| 1355 | out: | 1356 | out: |
| 1356 | while (i-- > 0) { | 1357 | while (i-- > 0) { |
| 1357 | pci_free_consistent(pdev, 2*MBX_SIZE(i), | 1358 | dma_free_coherent(&pdev->dev, 2 * MBX_SIZE(i), |
| 1358 | (void *)zatm_dev->mbx_start[i], | 1359 | (void *)zatm_dev->mbx_start[i], |
| 1359 | zatm_dev->mbx_dma[i]); | 1360 | zatm_dev->mbx_dma[i]); |
| 1360 | } | 1361 | } |
| 1361 | free_irq(zatm_dev->irq, dev); | 1362 | free_irq(zatm_dev->irq, dev); |
| 1362 | goto done; | 1363 | goto done; |
| @@ -1608,6 +1609,10 @@ static int zatm_init_one(struct pci_dev *pci_dev, · 245 unmodified lines | |||
| 1608 | if (ret < 0) | 1609 | if (ret < 0) |
| 1609 | goto out_disable; | 1610 | goto out_disable; |
| 1610 | 1611 | ||
| 1612 | ret = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)); | ||
| 1613 | if (ret < 0) | ||
| 1614 | goto out_disable; | ||
| 1615 | |||
| 1611 | zatm_dev->pci_dev = pci_dev; | 1616 | zatm_dev->pci_dev = pci_dev; |
| 1612 | dev->dev_data = zatm_dev; | 1617 | dev->dev_data = zatm_dev; |
| 1613 | zatm_dev->copper = (int)ent->driver_data; | 1618 | zatm_dev->copper = (int)ent->driver_data; |
| @@ -25,22 +25,18 @@ struct bcma_bus; · 24 unmodified lines | |||
| 25 | bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, | 25 | bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, |
| 26 | int timeout); | 26 | int timeout); |
| 27 | void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); | 27 | void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); |
| 28 | void bcma_init_bus(struct bcma_bus *bus); | ||
| 28 | int bcma_bus_register(struct bcma_bus *bus); | 29 | int bcma_bus_register(struct bcma_bus *bus); |
| 29 | void bcma_bus_unregister(struct bcma_bus *bus); | 30 | void bcma_bus_unregister(struct bcma_bus *bus); |
| 30 | int __init bcma_bus_early_register(struct bcma_bus *bus, | 31 | int __init bcma_bus_early_register(struct bcma_bus *bus); |
| 31 | struct bcma_device *core_cc, | ||
| 32 | struct bcma_device *core_mips); | ||
| 33 | #ifdef CONFIG_PM | 32 | #ifdef CONFIG_PM |
| 34 | int bcma_bus_suspend(struct bcma_bus *bus); | 33 | int bcma_bus_suspend(struct bcma_bus *bus); |
| 35 | int bcma_bus_resume(struct bcma_bus *bus); | 34 | int bcma_bus_resume(struct bcma_bus *bus); |
| 36 | #endif | 35 | #endif |
| 37 | 36 | ||
| 38 | /* scan.c */ | 37 | /* scan.c */ |
| 38 | void bcma_detect_chip(struct bcma_bus *bus); | ||
| 39 | int bcma_bus_scan(struct bcma_bus *bus); | 39 | int bcma_bus_scan(struct bcma_bus *bus); |
| 40 | int __init bcma_bus_scan_early(struct bcma_bus *bus, | ||
| 41 | struct bcma_device_id *match, | ||
| 42 | struct bcma_device *core); | ||
| 43 | void bcma_init_bus(struct bcma_bus *bus); | ||
| 44 | 40 | ||
| 45 | /* sprom.c */ | 41 | /* sprom.c */ |
| 46 | int bcma_sprom_get(struct bcma_bus *bus); | 42 | int bcma_sprom_get(struct bcma_bus *bus); |
| @@ -111,6 +107,14 @@ extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); · 64 unmodified lines | |||
| 111 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | 107 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE |
| 112 | bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); | 108 | bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); |
| 113 | void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); | 109 | void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); |
| 110 | #else | ||
| 111 | static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) | ||
| 112 | { | ||
| 113 | return false; | ||
| 114 | } | ||
| 115 | static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) | ||
| 116 | { | ||
| 117 | } | ||
| 114 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | 118 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ |
| 115 | 119 | ||
| 116 | #ifdef CONFIG_BCMA_DRIVER_GPIO | 120 | #ifdef CONFIG_BCMA_DRIVER_GPIO |
| @@ -79,7 +79,9 @@ static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc) · 78 unmodified lines | |||
| 79 | 79 | ||
| 80 | if (cc->capabilities & BCMA_CC_CAP_PMU) { | 80 | if (cc->capabilities & BCMA_CC_CAP_PMU) { |
| 81 | if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) | 81 | if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) |
| 82 | /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ | 82 | /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP |
| 83 | * clock | ||
| 84 | */ | ||
| 83 | return bcma_chipco_get_alp_clock(cc) / 4000; | 85 | return bcma_chipco_get_alp_clock(cc) / 4000; |
| 84 | else | 86 | else |
| 85 | /* based on 32KHz ILP clock */ | 87 | /* based on 32KHz ILP clock */ |
| @@ -97,7 +99,8 @@ int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc) · 11 unmodified lines | |||
| 97 | wdt.driver_data = cc; | 99 | wdt.driver_data = cc; |
| 98 | wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; | 100 | wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; |
| 99 | wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; | 101 | wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; |
| 100 | wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; | 102 | wdt.max_timer_ms = |
| 103 | bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; | ||
| 101 | 104 | ||
| 102 | pdev = platform_device_register_data(NULL, "bcm47xx-wdt", | 105 | pdev = platform_device_register_data(NULL, "bcm47xx-wdt", |
| 103 | cc->core->bus->num, &wdt, | 106 | cc->core->bus->num, &wdt, |
| @@ -175,7 +178,6 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) · 71 unmodified lines | |||
| 175 | u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) | 178 | u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) |
| 176 | { | 179 | { |
| 177 | u32 maxt; | 180 | u32 maxt; |
| 178 | enum bcma_clkmode clkmode; | ||
| 179 | 181 | ||
| 180 | maxt = bcma_chipco_watchdog_get_max_timer(cc); | 182 | maxt = bcma_chipco_watchdog_get_max_timer(cc); |
| 181 | if (cc->capabilities & BCMA_CC_CAP_PMU) { | 183 | if (cc->capabilities & BCMA_CC_CAP_PMU) { |
| @@ -185,8 +187,13 @@ u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) · 3 unmodified lines | |||
| 185 | ticks = maxt; | 187 | ticks = maxt; |
| 186 | bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); | 188 | bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); |
| 187 | } else { | 189 | } else { |
| 188 | clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; | 190 | struct bcma_bus *bus = cc->core->bus; |
| 189 | bcma_core_set_clockmode(cc->core, clkmode); | 191 | |
| 192 | if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 && | ||
| 193 | bus->chipinfo.id != BCMA_CHIP_ID_BCM53018) | ||
| 194 | bcma_core_set_clockmode(cc->core, | ||
| 195 | ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC); | ||
| 196 | |||
| 190 | if (ticks > maxt) | 197 | if (ticks > maxt) |
| 191 | ticks = maxt; | 198 | ticks = maxt; |
| 192 | /* instant NMI */ | 199 | /* instant NMI */ |
| @@ -335,7 +342,8 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc) · 142 unmodified lines | |||
| 335 | | BCMA_CC_CORECTL_UARTCLKEN); | 342 | | BCMA_CC_CORECTL_UARTCLKEN); |
| 336 | } | 343 | } |
| 337 | } else { | 344 | } else { |
| 338 | bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", ccrev); | 345 | bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", |
| 346 | ccrev); | ||
| 339 | return; | 347 | return; |
| 340 | } | 348 | } |
| 341 | 349 | ||
| @@ -144,6 +144,47 @@ static u16 bcma_pcie_mdio_writeread(struct bcma_drv_pci *pc, u16 device, · 143 unmodified lines | |||
| 144 | return bcma_pcie_mdio_read(pc, device, address); | 144 | return bcma_pcie_mdio_read(pc, device, address); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | /************************************************** | ||
| 148 | * Early init. | ||
| 149 | **************************************************/ | ||
| 150 | |||
| 151 | static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) | ||
| 152 | { | ||
| 153 | struct bcma_device *core = pc->core; | ||
| 154 | u16 val16, core_index; | ||
| 155 | uint regoff; | ||
| 156 | |||
| 157 | regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); | ||
| 158 | core_index = (u16)core->core_index; | ||
| 159 | |||
| 160 | val16 = pcicore_read16(pc, regoff); | ||
| 161 | if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) | ||
| 162 | != core_index) { | ||
| 163 | val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | | ||
| 164 | (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); | ||
| 165 | pcicore_write16(pc, regoff, val16); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | /* | ||
| 170 | * Apply some early fixes required before accessing SPROM. | ||
| 171 | * See also si_pci_fixcfg. | ||
| 172 | */ | ||
| 173 | void bcma_core_pci_early_init(struct bcma_drv_pci *pc) | ||
| 174 | { | ||
| 175 | if (pc->early_setup_done) | ||
| 176 | return; | ||
| 177 | |||
| 178 | pc->hostmode = bcma_core_pci_is_in_hostmode(pc); | ||
| 179 | if (pc->hostmode) | ||
| 180 | goto out; | ||
| 181 | |||
| 182 | bcma_core_pci_fixcfg(pc); | ||
| 183 | |||
| 184 | out: | ||
| 185 | pc->early_setup_done = true; | ||
| 186 | } | ||
| 187 | |||
| 147 | /************************************************** | 188 | /************************************************** |
| 148 | * Workarounds. | 189 | * Workarounds. |
| 149 | **************************************************/ | 190 | **************************************************/ |
| @@ -175,24 +216,6 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) · 25 unmodified lines | |||
| 175 | tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); | 216 | tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); |
| 176 | } | 217 | } |
| 177 | 218 | ||
| 178 | static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) | ||
| 179 | { | ||
| 180 | struct bcma_device *core = pc->core; | ||
| 181 | u16 val16, core_index; | ||
| 182 | uint regoff; | ||
| 183 | |||
| 184 | regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); | ||
| 185 | core_index = (u16)core->core_index; | ||
| 186 | |||
| 187 | val16 = pcicore_read16(pc, regoff); | ||
| 188 | if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) | ||
| 189 | != core_index) { | ||
| 190 | val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | | ||
| 191 | (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); | ||
| 192 | pcicore_write16(pc, regoff, val16); | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | /* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */ | 219 | /* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */ |
| 197 | /* Needs to happen when coming out of 'standby'/'hibernate' */ | 220 | /* Needs to happen when coming out of 'standby'/'hibernate' */ |
| 198 | static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) | 221 | static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) |
| @@ -216,7 +239,6 @@ static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) · 17 unmodified lines | |||
| 216 | 239 | ||
| 217 | static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) | 240 | static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) |
| 218 | { | 241 | { |
| 219 | bcma_core_pci_fixcfg(pc); | ||
| 220 | bcma_pcicore_serdes_workaround(pc); | 242 | bcma_pcicore_serdes_workaround(pc); |
| 221 | bcma_core_pci_config_fixup(pc); | 243 | bcma_core_pci_config_fixup(pc); |
| 222 | } | 244 | } |
| @@ -226,13 +248,11 @@ void bcma_core_pci_init(struct bcma_drv_pci *pc) · 3 unmodified lines | |||
| 226 | if (pc->setup_done) | 248 | if (pc->setup_done) |
| 227 | return; | 249 | return; |
| 228 | 250 | ||
| 229 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | 251 | bcma_core_pci_early_init(pc); |
| 230 | pc->hostmode = bcma_core_pci_is_in_hostmode(pc); | 252 | |
| 231 | if (pc->hostmode) | 253 | if (pc->hostmode) |
| 232 | bcma_core_pci_hostmode_init(pc); | 254 | bcma_core_pci_hostmode_init(pc); |
| 233 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | 255 | else |
| 234 | |||
| 235 | if (!pc->hostmode) | ||
| 236 | bcma_core_pci_clientmode_init(pc); | 256 | bcma_core_pci_clientmode_init(pc); |
| 237 | } | 257 | } |
| 238 | 258 | ||
| @@ -13,10 +13,12 @@ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | static void bcma_host_pci_switch_core(struct bcma_device *core) | 14 | static void bcma_host_pci_switch_core(struct bcma_device *core) |
| 15 | { | 15 | { |
| 16 | int win2 = core->bus->host_is_pcie2 ? | ||
| 17 | BCMA_PCIE2_BAR0_WIN2 : BCMA_PCI_BAR0_WIN2; | ||
| 18 | |||
| 16 | pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN, | 19 | pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN, |
| 17 | core->addr); | 20 | core->addr); |
| 18 | pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN2, | 21 | pci_write_config_dword(core->bus->host_pci, win2, core->wrap); |
| 19 | core->wrap); | ||
| 20 | core->bus->mapped_core = core; | 22 | core->bus->mapped_core = core; |
| 21 | bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id); | 23 | bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id); |
| 22 | } | 24 | } |
| @@ -193,7 +193,7 @@ int __init bcma_host_soc_init(struct bcma_soc *soc) · 192 unmodified lines | |||
| 193 | int err; | 193 | int err; |
| 194 | 194 | ||
| 195 | /* Scan bus and initialize it */ | 195 | /* Scan bus and initialize it */ |
| 196 | err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips); | 196 | err = bcma_bus_early_register(bus); |
| 197 | if (err) | 197 | if (err) |
| 198 | iounmap(bus->mmio); | 198 | iounmap(bus->mmio); |
| 199 | 199 | ||
| @@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) · 267 unmodified lines | |||
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | void bcma_init_bus(struct bcma_bus *bus) | ||
| 272 | { | ||
| 273 | mutex_lock(&bcma_buses_mutex); | ||
| 274 | bus->num = bcma_bus_next_num++; | ||
| 275 | mutex_unlock(&bcma_buses_mutex); | ||
| 276 | |||
| 277 | INIT_LIST_HEAD(&bus->cores); | ||
| 278 | bus->nr_cores = 0; | ||
| 279 | |||
| 280 | bcma_detect_chip(bus); | ||
| 281 | } | ||
| 282 | |||
| 271 | static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) | 283 | static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) |
| 272 | { | 284 | { |
| 273 | int err; | 285 | int err; |
| @@ -356,12 +368,19 @@ static void bcma_unregister_cores(struct bcma_bus *bus) · 82 unmodified lines | |||
| 356 | struct bcma_device *core, *tmp; | 368 | struct bcma_device *core, *tmp; |
| 357 | 369 | ||
| 358 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { | 370 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { |
| 371 | if (!core->dev_registered) | ||
| 372 | continue; | ||
| 359 | list_del(&core->list); | 373 | list_del(&core->list); |
| 360 | if (core->dev_registered) | 374 | device_unregister(&core->dev); |
| 361 | device_unregister(&core->dev); | ||
| 362 | } | 375 | } |
| 363 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) | 376 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) |
| 364 | platform_device_unregister(bus->drv_cc.watchdog); | 377 | platform_device_unregister(bus->drv_cc.watchdog); |
| 378 | |||
| 379 | /* Now noone uses internally-handled cores, we can free them */ | ||
| 380 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { | ||
| 381 | list_del(&core->list); | ||
| 382 | kfree(core); | ||
| 383 | } | ||
| 365 | } | 384 | } |
| 366 | 385 | ||
| 367 | int bcma_bus_register(struct bcma_bus *bus) | 386 | int bcma_bus_register(struct bcma_bus *bus) |
| @@ -369,10 +388,6 @@ int bcma_bus_register(struct bcma_bus *bus) · 1 unmodified line | |||
| 369 | int err; | 388 | int err; |
| 370 | struct bcma_device *core; | 389 | struct bcma_device *core; |
| 371 | 390 | ||
| 372 | mutex_lock(&bcma_buses_mutex); | ||
| 373 | bus->num = bcma_bus_next_num++; | ||
| 374 | mutex_unlock(&bcma_buses_mutex); | ||
| 375 | |||
| 376 | /* Scan for devices (cores) */ | 391 | /* Scan for devices (cores) */ |
| 377 | err = bcma_bus_scan(bus); | 392 | err = bcma_bus_scan(bus); |
| 378 | if (err) { | 393 | if (err) { |
| @@ -387,6 +402,13 @@ int bcma_bus_register(struct bcma_bus *bus) · 8 unmodified lines | |||
| 387 | bcma_core_chipcommon_early_init(&bus->drv_cc); | 402 | bcma_core_chipcommon_early_init(&bus->drv_cc); |
| 388 | } | 403 | } |
| 389 | 404 | ||
| 405 | /* Early init PCIE core */ | ||
| 406 | core = bcma_find_core(bus, BCMA_CORE_PCIE); | ||
| 407 | if (core) { | ||
| 408 | bus->drv_pci[0].core = core; | ||
| 409 | bcma_core_pci_early_init(&bus->drv_pci[0]); | ||
| 410 | } | ||
| 411 | |||
| 390 | /* Cores providing flash access go before SPROM init */ | 412 | /* Cores providing flash access go before SPROM init */ |
| 391 | list_for_each_entry(core, &bus->cores, list) { | 413 | list_for_each_entry(core, &bus->cores, list) { |
| 392 | if (bcma_is_core_needed_early(core->id.id)) | 414 | if (bcma_is_core_needed_early(core->id.id)) |
| @@ -459,7 +481,6 @@ int bcma_bus_register(struct bcma_bus *bus) · 66 unmodified lines | |||
| 459 | 481 | ||
| 460 | void bcma_bus_unregister(struct bcma_bus *bus) | 482 | void bcma_bus_unregister(struct bcma_bus *bus) |
| 461 | { | 483 | { |
| 462 | struct bcma_device *cores[3]; | ||
| 463 | int err; | 484 | int err; |
| 464 | 485 | ||
| 465 | err = bcma_gpio_unregister(&bus->drv_cc); | 486 | err = bcma_gpio_unregister(&bus->drv_cc); |
| @@ -470,46 +491,23 @@ void bcma_bus_unregister(struct bcma_bus *bus) · 4 unmodified lines | |||
| 470 | 491 | ||
| 471 | bcma_core_chipcommon_b_free(&bus->drv_cc_b); | 492 | bcma_core_chipcommon_b_free(&bus->drv_cc_b); |
| 472 | 493 | ||
| 473 | cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); | ||
| 474 | cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); | ||
| 475 | cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); | ||
| 476 | |||
| 477 | bcma_unregister_cores(bus); | 494 | bcma_unregister_cores(bus); |
| 478 | |||
| 479 | kfree(cores[2]); | ||
| 480 | kfree(cores[1]); | ||
| 481 | kfree(cores[0]); | ||
| 482 | } | 495 | } |
| 483 | 496 | ||
| 484 | int __init bcma_bus_early_register(struct bcma_bus *bus, | 497 | /* |
| 485 | struct bcma_device *core_cc, | 498 | * This is a special version of bus registration function designed for SoCs. |
| 486 | struct bcma_device *core_mips) | 499 | * It scans bus and performs basic initialization of main cores only. |
| 500 | * Please note it requires memory allocation, however it won't try to sleep. | ||
| 501 | */ | ||
| 502 | int __init bcma_bus_early_register(struct bcma_bus *bus) | ||
| 487 | { | 503 | { |
| 488 | int err; | 504 | int err; |
| 489 | struct bcma_device *core; | 505 | struct bcma_device *core; |
| 490 | struct bcma_device_id match; | ||
| 491 | 506 | ||
| 492 | match.manuf = BCMA_MANUF_BCM; | 507 | /* Scan for devices (cores) */ |
| 493 | match.id = bcma_cc_core_id(bus); | 508 | err = bcma_bus_scan(bus); |
| 494 | match.class = BCMA_CL_SIM; | ||
| 495 | match.rev = BCMA_ANY_REV; | ||
| 496 | |||
| 497 | /* Scan for chip common core */ | ||
| 498 | err = bcma_bus_scan_early(bus, &match, core_cc); | ||
| 499 | if (err) { | ||
| 500 | bcma_err(bus, "Failed to scan for common core: %d\n", err); | ||
| 501 | return -1; | ||
| 502 | } | ||
| 503 | |||
| 504 | match.manuf = BCMA_MANUF_MIPS; | ||
| 505 | match.id = BCMA_CORE_MIPS_74K; | ||
| 506 | match.class = BCMA_CL_SIM; | ||
| 507 | match.rev = BCMA_ANY_REV; | ||
| 508 | |||
| 509 | /* Scan for mips core */ | ||
| 510 | err = bcma_bus_scan_early(bus, &match, core_mips); | ||
| 511 | if (err) { | 509 | if (err) { |
| 512 | bcma_err(bus, "Failed to scan for mips core: %d\n", err); | 510 | bcma_err(bus, "Failed to scan bus: %d\n", err); |
| 513 | return -1; | 511 | return -1; |
| 514 | } | 512 | } |
| 515 | 513 | ||
| @@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, · 434 unmodified lines | |||
| 435 | return 0; | 435 | return 0; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | void bcma_init_bus(struct bcma_bus *bus) | 438 | void bcma_detect_chip(struct bcma_bus *bus) |
| 439 | { | 439 | { |
| 440 | s32 tmp; | 440 | s32 tmp; |
| 441 | struct bcma_chipinfo *chipinfo = &(bus->chipinfo); | 441 | struct bcma_chipinfo *chipinfo = &(bus->chipinfo); |
| 442 | char chip_id[8]; | 442 | char chip_id[8]; |
| 443 | 443 | ||
| 444 | INIT_LIST_HEAD(&bus->cores); | ||
| 445 | bus->nr_cores = 0; | ||
| 446 | |||
| 447 | bcma_scan_switch_core(bus, BCMA_ADDR_BASE); | 444 | bcma_scan_switch_core(bus, BCMA_ADDR_BASE); |
| 448 | 445 | ||
| 449 | tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); | 446 | tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); |
| @@ -464,6 +461,10 @@ int bcma_bus_scan(struct bcma_bus *bus) · 14 unmodified lines | |||
| 464 | 461 | ||
| 465 | int err, core_num = 0; | 462 | int err, core_num = 0; |
| 466 | 463 | ||
| 464 | /* Skip if bus was already scanned (e.g. during early register) */ | ||
| 465 | if (bus->nr_cores) | ||
| 466 | return 0; | ||
| 467 | |||
| 467 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); | 468 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); |
| 468 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) { | 469 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) { |
| 469 | eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); | 470 | eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); |
| @@ -522,61 +523,3 @@ out: · 52 unmodified lines | |||
| 522 | 523 | ||
| 523 | return err; | 524 | return err; |
| 524 | } | 525 | } |
| 525 | |||
| 526 | int __init bcma_bus_scan_early(struct bcma_bus *bus, | ||
| 527 | struct bcma_device_id *match, | ||
| 528 | struct bcma_device *core) | ||
| 529 | { | ||
| 530 | u32 erombase; | ||
| 531 | u32 __iomem *eromptr, *eromend; | ||
| 532 | |||
| 533 | int err = -ENODEV; | ||
| 534 | int core_num = 0; | ||
| 535 | |||
| 536 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); | ||
| 537 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) { | ||
| 538 | eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); | ||
| 539 | if (!eromptr) | ||
| 540 | return -ENOMEM; | ||
| 541 | } else { | ||
| 542 | eromptr = bus->mmio; | ||
| 543 | } | ||
| 544 | |||
| 545 | eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); | ||
| 546 | |||
| 547 | bcma_scan_switch_core(bus, erombase); | ||
| 548 | |||
| 549 | while (eromptr < eromend) { | ||
| 550 | memset(core, 0, sizeof(*core)); | ||
| 551 | INIT_LIST_HEAD(&core->list); | ||
| 552 | core->bus = bus; | ||
| 553 | |||
| 554 | err = bcma_get_next_core(bus, &eromptr, match, core_num, core); | ||
| 555 | if (err == -ENODEV) { | ||
| 556 | core_num++; | ||
| 557 | continue; | ||
| 558 | } else if (err == -ENXIO) | ||
| 559 | continue; | ||
| 560 | else if (err == -ESPIPE) | ||
| 561 | break; | ||
| 562 | else if (err < 0) | ||
| 563 | goto out; | ||
| 564 | |||
| 565 | core->core_index = core_num++; | ||
| 566 | bus->nr_cores++; | ||
| 567 | bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", | ||
| 568 | core->core_index, bcma_device_name(&core->id), | ||
| 569 | core->id.manuf, core->id.id, core->id.rev, | ||
| 570 | core->id.class); | ||
| 571 | |||
| 572 | list_add_tail(&core->list, &bus->cores); | ||
| 573 | err = 0; | ||
| 574 | break; | ||
| 575 | } | ||
| 576 | |||
| 577 | out: | ||
| 578 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) | ||
| 579 | iounmap(eromptr); | ||
| 580 | |||
| 581 | return err; | ||
| 582 | } | ||
| @@ -579,7 +579,8 @@ int bcma_sprom_get(struct bcma_bus *bus) · 578 unmodified lines | |||
| 579 | u16 offset = BCMA_CC_SPROM; | 579 | u16 offset = BCMA_CC_SPROM; |
| 580 | u16 *sprom; | 580 | u16 *sprom; |
| 581 | size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4, | 581 | size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4, |
| 582 | SSB_SPROMSIZE_WORDS_R10, }; | 582 | SSB_SPROMSIZE_WORDS_R10, |
| 583 | SSB_SPROMSIZE_WORDS_R11, }; | ||
| 583 | int i, err = 0; | 584 | int i, err = 0; |
| 584 | 585 | ||
| 585 | if (!bus->drv_cc.core) | 586 | if (!bus->drv_cc.core) |
| @@ -108,6 +108,7 @@ static const struct usb_device_id ath3k_table[] = { · 107 unmodified lines | |||
| 108 | { USB_DEVICE(0x13d3, 0x3393) }, | 108 | { USB_DEVICE(0x13d3, 0x3393) }, |
| 109 | { USB_DEVICE(0x13d3, 0x3402) }, | 109 | { USB_DEVICE(0x13d3, 0x3402) }, |
| 110 | { USB_DEVICE(0x13d3, 0x3408) }, | 110 | { USB_DEVICE(0x13d3, 0x3408) }, |
| 111 | { USB_DEVICE(0x13d3, 0x3423) }, | ||
| 111 | { USB_DEVICE(0x13d3, 0x3432) }, | 112 | { USB_DEVICE(0x13d3, 0x3432) }, |
| 112 | 113 | ||
| 113 | /* Atheros AR5BBU12 with sflash firmware */ | 114 | /* Atheros AR5BBU12 with sflash firmware */ |
| @@ -162,6 +163,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 48 unmodified lines | |||
| 162 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | 163 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
| 163 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, | 164 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, |
| 164 | { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, | 165 | { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, |
| 166 | { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 }, | ||
| 165 | { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, | 167 | { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, |
| 166 | 168 | ||
| 167 | /* Atheros AR5BBU22 with sflash firmware */ | 169 | /* Atheros AR5BBU22 with sflash firmware */ |
| @@ -174,6 +176,8 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 6 unmodified lines | |||
| 174 | #define USB_REQ_DFU_DNLOAD 1 | 176 | #define USB_REQ_DFU_DNLOAD 1 |
| 175 | #define BULK_SIZE 4096 | 177 | #define BULK_SIZE 4096 |
| 176 | #define FW_HDR_SIZE 20 | 178 | #define FW_HDR_SIZE 20 |
| 179 | #define TIMEGAP_USEC_MIN 50 | ||
| 180 | #define TIMEGAP_USEC_MAX 100 | ||
| 177 | 181 | ||
| 178 | static int ath3k_load_firmware(struct usb_device *udev, | 182 | static int ath3k_load_firmware(struct usb_device *udev, |
| 179 | const struct firmware *firmware) | 183 | const struct firmware *firmware) |
| @@ -205,6 +209,9 @@ static int ath3k_load_firmware(struct usb_device *udev, · 25 unmodified lines | |||
| 205 | pipe = usb_sndbulkpipe(udev, 0x02); | 209 | pipe = usb_sndbulkpipe(udev, 0x02); |
| 206 | 210 | ||
| 207 | while (count) { | 211 | while (count) { |
| 212 | /* workaround the compatibility issue with xHCI controller*/ | ||
| 213 | usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); | ||
| 214 | |||
| 208 | size = min_t(uint, count, BULK_SIZE); | 215 | size = min_t(uint, count, BULK_SIZE); |
| 209 | memcpy(send_buf, firmware->data + sent, size); | 216 | memcpy(send_buf, firmware->data + sent, size); |
| 210 | 217 | ||
| @@ -302,6 +309,9 @@ static int ath3k_load_fwfile(struct usb_device *udev, · 91 unmodified lines | |||
| 302 | pipe = usb_sndbulkpipe(udev, 0x02); | 309 | pipe = usb_sndbulkpipe(udev, 0x02); |
| 303 | 310 | ||
| 304 | while (count) { | 311 | while (count) { |
| 312 | /* workaround the compatibility issue with xHCI controller*/ | ||
| 313 | usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); | ||
| 314 | |||
| 305 | size = min_t(uint, count, BULK_SIZE); | 315 | size = min_t(uint, count, BULK_SIZE); |
| 306 | memcpy(send_buf, firmware->data + sent, size); | 316 | memcpy(send_buf, firmware->data + sent, size); |
| 307 | 317 | ||
| @@ -696,6 +696,8 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i · 695 unmodified lines | |||
| 696 | hdev->flush = bfusb_flush; | 696 | hdev->flush = bfusb_flush; |
| 697 | hdev->send = bfusb_send_frame; | 697 | hdev->send = bfusb_send_frame; |
| 698 | 698 | ||
| 699 | set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks); | ||
| 700 | |||
| 699 | if (hci_register_dev(hdev) < 0) { | 701 | if (hci_register_dev(hdev) < 0) { |
| 700 | BT_ERR("Can't register HCI device"); | 702 | BT_ERR("Can't register HCI device"); |
| 701 | hci_free_dev(hdev); | 703 | hci_free_dev(hdev); |
| @@ -28,9 +28,9 @@ · 27 unmodified lines | |||
| 28 | #define BTM_UPLD_SIZE 2312 | 28 | #define BTM_UPLD_SIZE 2312 |
| 29 | 29 | ||
| 30 | /* Time to wait until Host Sleep state change in millisecond */ | 30 | /* Time to wait until Host Sleep state change in millisecond */ |
| 31 | #define WAIT_UNTIL_HS_STATE_CHANGED 5000 | 31 | #define WAIT_UNTIL_HS_STATE_CHANGED msecs_to_jiffies(5000) |
| 32 | /* Time to wait for command response in millisecond */ | 32 | /* Time to wait for command response in millisecond */ |
| 33 | #define WAIT_UNTIL_CMD_RESP 5000 | 33 | #define WAIT_UNTIL_CMD_RESP msecs_to_jiffies(5000) |
| 34 | 34 | ||
| 35 | enum rdwr_status { | 35 | enum rdwr_status { |
| 36 | RDWR_STATUS_SUCCESS = 0, | 36 | RDWR_STATUS_SUCCESS = 0, |
| @@ -104,6 +104,7 @@ struct btmrvl_private { · 67 unmodified lines | |||
| 104 | #ifdef CONFIG_DEBUG_FS | 104 | #ifdef CONFIG_DEBUG_FS |
| 105 | void *debugfs_data; | 105 | void *debugfs_data; |
| 106 | #endif | 106 | #endif |
| 107 | bool surprise_removed; | ||
| 107 | }; | 108 | }; |
| 108 | 109 | ||
| 109 | #define MRVL_VENDOR_PKT 0xFE | 110 | #define MRVL_VENDOR_PKT 0xFE |
| @@ -178,6 +178,11 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, · 177 unmodified lines | |||
| 178 | struct sk_buff *skb; | 178 | struct sk_buff *skb; |
| 179 | struct hci_command_hdr *hdr; | 179 | struct hci_command_hdr *hdr; |
| 180 | 180 | ||
| 181 | if (priv->surprise_removed) { | ||
| 182 | BT_ERR("Card is removed"); | ||
| 183 | return -EFAULT; | ||
| 184 | } | ||
| 185 | |||
| 181 | skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_ATOMIC); | 186 | skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_ATOMIC); |
| 182 | if (skb == NULL) { | 187 | if (skb == NULL) { |
| 183 | BT_ERR("No free skb"); | 188 | BT_ERR("No free skb"); |
| @@ -202,10 +207,14 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, · 18 unmodified lines | |||
| 202 | wake_up_interruptible(&priv->main_thread.wait_q); | 207 | wake_up_interruptible(&priv->main_thread.wait_q); |
| 203 | 208 | ||
| 204 | if (!wait_event_interruptible_timeout(priv->adapter->cmd_wait_q, | 209 | if (!wait_event_interruptible_timeout(priv->adapter->cmd_wait_q, |
| 205 | priv->adapter->cmd_complete, | 210 | priv->adapter->cmd_complete || |
| 206 | msecs_to_jiffies(WAIT_UNTIL_CMD_RESP))) | 211 | priv->surprise_removed, |
| 212 | WAIT_UNTIL_CMD_RESP)) | ||
| 207 | return -ETIMEDOUT; | 213 | return -ETIMEDOUT; |
| 208 | 214 | ||
| 215 | if (priv->surprise_removed) | ||
| 216 | return -EFAULT; | ||
| 217 | |||
| 209 | return 0; | 218 | return 0; |
| 210 | } | 219 | } |
| 211 | 220 | ||
| @@ -287,9 +296,10 @@ int btmrvl_enable_hs(struct btmrvl_private *priv) · 75 unmodified lines | |||
| 287 | } | 296 | } |
| 288 | 297 | ||
| 289 | ret = wait_event_interruptible_timeout(adapter->event_hs_wait_q, | 298 | ret = wait_event_interruptible_timeout(adapter->event_hs_wait_q, |
| 290 | adapter->hs_state, | 299 | adapter->hs_state || |
| 291 | msecs_to_jiffies(WAIT_UNTIL_HS_STATE_CHANGED)); | 300 | priv->surprise_removed, |
| 292 | if (ret < 0) { | 301 | WAIT_UNTIL_HS_STATE_CHANGED); |
| 302 | if (ret < 0 || priv->surprise_removed) { | ||
| 293 | BT_ERR("event_hs_wait_q terminated (%d): %d,%d,%d", | 303 | BT_ERR("event_hs_wait_q terminated (%d): %d,%d,%d", |
| 294 | ret, adapter->hs_state, adapter->ps_state, | 304 | ret, adapter->hs_state, adapter->ps_state, |
| 295 | adapter->wakeup_tries); | 305 | adapter->wakeup_tries); |
| @@ -538,8 +548,11 @@ static int btmrvl_check_device_tree(struct btmrvl_private *priv) · 242 unmodified lines | |||
| 538 | static int btmrvl_setup(struct hci_dev *hdev) | 548 | static int btmrvl_setup(struct hci_dev *hdev) |
| 539 | { | 549 | { |
| 540 | struct btmrvl_private *priv = hci_get_drvdata(hdev); | 550 | struct btmrvl_private *priv = hci_get_drvdata(hdev); |
| 551 | int ret; | ||
| 541 | 552 | ||
| 542 | btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); | 553 | ret = btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); |
| 554 | if (ret) | ||
| 555 | return ret; | ||
| 543 | 556 | ||
| 544 | priv->btmrvl_dev.gpio_gap = 0xffff; | 557 | priv->btmrvl_dev.gpio_gap = 0xffff; |
| 545 | 558 | ||
| @@ -597,7 +610,7 @@ static int btmrvl_service_main_thread(void *data) · 51 unmodified lines | |||
| 597 | add_wait_queue(&thread->wait_q, &wait); | 610 | add_wait_queue(&thread->wait_q, &wait); |
| 598 | 611 | ||
| 599 | set_current_state(TASK_INTERRUPTIBLE); | 612 | set_current_state(TASK_INTERRUPTIBLE); |
| 600 | if (kthread_should_stop()) { | 613 | if (kthread_should_stop() || priv->surprise_removed) { |
| 601 | BT_DBG("main_thread: break from main thread"); | 614 | BT_DBG("main_thread: break from main thread"); |
| 602 | break; | 615 | break; |
| 603 | } | 616 | } |
| @@ -616,6 +629,11 @@ static int btmrvl_service_main_thread(void *data) · 12 unmodified lines | |||
| 616 | 629 | ||
| 617 | BT_DBG("main_thread woke up"); | 630 | BT_DBG("main_thread woke up"); |
| 618 | 631 | ||
| 632 | if (kthread_should_stop() || priv->surprise_removed) { | ||
| 633 | BT_DBG("main_thread: break from main thread"); | ||
| 634 | break; | ||
| 635 | } | ||
| 636 | |||
| 619 | spin_lock_irqsave(&priv->driver_lock, flags); | 637 | spin_lock_irqsave(&priv->driver_lock, flags); |
| 620 | if (adapter->int_count) { | 638 | if (adapter->int_count) { |
| 621 | adapter->int_count = 0; | 639 | adapter->int_count = 0; |
| @@ -573,7 +573,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) · 572 unmodified lines | |||
| 573 | offset += txlen; | 573 | offset += txlen; |
| 574 | } while (true); | 574 | } while (true); |
| 575 | 575 | ||
| 576 | BT_DBG("FW download over, size %d bytes", offset); | 576 | BT_INFO("FW download over, size %d bytes", offset); |
| 577 | 577 | ||
| 578 | ret = 0; | 578 | ret = 0; |
| 579 | 579 | ||
| @@ -798,6 +798,9 @@ static void btmrvl_sdio_interrupt(struct sdio_func *func) · 218 unmodified lines | |||
| 798 | 798 | ||
| 799 | priv = card->priv; | 799 | priv = card->priv; |
| 800 | 800 | ||
| 801 | if (priv->surprise_removed) | ||
| 802 | return; | ||
| 803 | |||
| 801 | if (card->reg->int_read_to_clear) | 804 | if (card->reg->int_read_to_clear) |
| 802 | ret = btmrvl_sdio_read_to_clear(card, &ireg); | 805 | ret = btmrvl_sdio_read_to_clear(card, &ireg); |
| 803 | else | 806 | else |
| @@ -1466,6 +1469,7 @@ static void btmrvl_sdio_remove(struct sdio_func *func) · 662 unmodified lines | |||
| 1466 | btmrvl_sdio_disable_host_int(card); | 1469 | btmrvl_sdio_disable_host_int(card); |
| 1467 | } | 1470 | } |
| 1468 | BT_DBG("unregester dev"); | 1471 | BT_DBG("unregester dev"); |
| 1472 | card->priv->surprise_removed = true; | ||
| 1469 | btmrvl_sdio_unregister_dev(card); | 1473 | btmrvl_sdio_unregister_dev(card); |
| 1470 | btmrvl_remove_card(card->priv); | 1474 | btmrvl_remove_card(card->priv); |
| 1471 | } | 1475 | } |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include <net/bluetooth/bluetooth.h> | 28 | #include <net/bluetooth/bluetooth.h> |
| 29 | #include <net/bluetooth/hci_core.h> | 29 | #include <net/bluetooth/hci_core.h> |
| 30 | 30 | ||
| 31 | #define VERSION "0.6" | 31 | #define VERSION "0.7" |
| 32 | 32 | ||
| 33 | static bool disable_scofix; | 33 | static bool disable_scofix; |
| 34 | static bool force_scofix; | 34 | static bool force_scofix; |
| @@ -49,11 +49,17 @@ static struct usb_driver btusb_driver; · 14 unmodified lines | |||
| 49 | #define BTUSB_INTEL_BOOT 0x200 | 49 | #define BTUSB_INTEL_BOOT 0x200 |
| 50 | #define BTUSB_BCM_PATCHRAM 0x400 | 50 | #define BTUSB_BCM_PATCHRAM 0x400 |
| 51 | #define BTUSB_MARVELL 0x800 | 51 | #define BTUSB_MARVELL 0x800 |
| 52 | #define BTUSB_SWAVE 0x1000 | ||
| 53 | #define BTUSB_INTEL_NEW 0x2000 | ||
| 54 | #define BTUSB_AMP 0x4000 | ||
| 52 | 55 | ||
| 53 | static const struct usb_device_id btusb_table[] = { | 56 | static const struct usb_device_id btusb_table[] = { |
| 54 | /* Generic Bluetooth USB device */ | 57 | /* Generic Bluetooth USB device */ |
| 55 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | 58 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, |
| 56 | 59 | ||
| 60 | /* Generic Bluetooth AMP device */ | ||
| 61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x04), .driver_info = BTUSB_AMP }, | ||
| 62 | |||
| 57 | /* Apple-specific (Broadcom) devices */ | 63 | /* Apple-specific (Broadcom) devices */ |
| 58 | { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) }, | 64 | { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) }, |
| 59 | 65 | ||
| @@ -85,7 +91,7 @@ static const struct usb_device_id btusb_table[] = { · 25 unmodified lines | |||
| 85 | { USB_DEVICE(0x05ac, 0x8281) }, | 91 | { USB_DEVICE(0x05ac, 0x8281) }, |
| 86 | 92 | ||
| 87 | /* AVM BlueFRITZ! USB v2.0 */ | 93 | /* AVM BlueFRITZ! USB v2.0 */ |
| 88 | { USB_DEVICE(0x057c, 0x3800) }, | 94 | { USB_DEVICE(0x057c, 0x3800), .driver_info = BTUSB_SWAVE }, |
| 89 | 95 | ||
| 90 | /* Bluetooth Ultraport Module from IBM */ | 96 | /* Bluetooth Ultraport Module from IBM */ |
| 91 | { USB_DEVICE(0x04bf, 0x030a) }, | 97 | { USB_DEVICE(0x04bf, 0x030a) }, |
| @@ -109,16 +115,24 @@ static const struct usb_device_id btusb_table[] = { · 17 unmodified lines | |||
| 109 | { USB_DEVICE(0x13d3, 0x3404), | 115 | { USB_DEVICE(0x13d3, 0x3404), |
| 110 | .driver_info = BTUSB_BCM_PATCHRAM }, | 116 | .driver_info = BTUSB_BCM_PATCHRAM }, |
| 111 | 117 | ||
| 118 | /* Broadcom BCM20702B0 (Dynex/Insignia) */ | ||
| 119 | { USB_DEVICE(0x19ff, 0x0239), .driver_info = BTUSB_BCM_PATCHRAM }, | ||
| 120 | |||
| 112 | /* Foxconn - Hon Hai */ | 121 | /* Foxconn - Hon Hai */ |
| 113 | { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01), | 122 | { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01), |
| 114 | .driver_info = BTUSB_BCM_PATCHRAM }, | 123 | .driver_info = BTUSB_BCM_PATCHRAM }, |
| 115 | 124 | ||
| 125 | /* Lite-On Technology - Broadcom based */ | ||
| 126 | { USB_VENDOR_AND_INTERFACE_INFO(0x04ca, 0xff, 0x01, 0x01), | ||
| 127 | .driver_info = BTUSB_BCM_PATCHRAM }, | ||
| 128 | |||
| 116 | /* Broadcom devices with vendor specific id */ | 129 | /* Broadcom devices with vendor specific id */ |
| 117 | { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01), | 130 | { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01), |
| 118 | .driver_info = BTUSB_BCM_PATCHRAM }, | 131 | .driver_info = BTUSB_BCM_PATCHRAM }, |
| 119 | 132 | ||
| 120 | /* ASUSTek Computer - Broadcom based */ | 133 | /* ASUSTek Computer - Broadcom based */ |
| 121 | { USB_VENDOR_AND_INTERFACE_INFO(0x0b05, 0xff, 0x01, 0x01) }, | 134 | { USB_VENDOR_AND_INTERFACE_INFO(0x0b05, 0xff, 0x01, 0x01), |
| 135 | .driver_info = BTUSB_BCM_PATCHRAM }, | ||
| 122 | 136 | ||
| 123 | /* Belkin F8065bf - Broadcom based */ | 137 | /* Belkin F8065bf - Broadcom based */ |
| 124 | { USB_VENDOR_AND_INTERFACE_INFO(0x050d, 0xff, 0x01, 0x01) }, | 138 | { USB_VENDOR_AND_INTERFACE_INFO(0x050d, 0xff, 0x01, 0x01) }, |
| @@ -188,6 +202,7 @@ static const struct usb_device_id blacklist_table[] = { · 63 unmodified lines | |||
| 188 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | 202 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
| 189 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, | 203 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, |
| 190 | { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, | 204 | { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, |
| 205 | { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 }, | ||
| 191 | { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, | 206 | { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, |
| 192 | 207 | ||
| 193 | /* Atheros AR5BBU12 with sflash firmware */ | 208 | /* Atheros AR5BBU12 with sflash firmware */ |
| @@ -237,6 +252,9 @@ static const struct usb_device_id blacklist_table[] = { · 43 unmodified lines | |||
| 237 | /* CONWISE Technology based adapters with buggy SCO support */ | 252 | /* CONWISE Technology based adapters with buggy SCO support */ |
| 238 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, | 253 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, |
| 239 | 254 | ||
| 255 | /* Roper Class 1 Bluetooth Dongle (Silicon Wave based) */ | ||
| 256 | { USB_DEVICE(0x1300, 0x0001), .driver_info = BTUSB_SWAVE }, | ||
| 257 | |||
| 240 | /* Digianswer devices */ | 258 | /* Digianswer devices */ |
| 241 | { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, | 259 | { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, |
| 242 | { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE }, | 260 | { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE }, |
| @@ -249,13 +267,18 @@ static const struct usb_device_id blacklist_table[] = { · 6 unmodified lines | |||
| 249 | { USB_DEVICE(0x16d3, 0x0002), | 267 | { USB_DEVICE(0x16d3, 0x0002), |
| 250 | .driver_info = BTUSB_SNIFFER | BTUSB_BROKEN_ISOC }, | 268 | .driver_info = BTUSB_SNIFFER | BTUSB_BROKEN_ISOC }, |
| 251 | 269 | ||
| 252 | /* Intel Bluetooth device */ | 270 | /* Marvell Bluetooth devices */ |
| 271 | { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL }, | ||
| 272 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, | ||
| 273 | |||
| 274 | /* Intel Bluetooth devices */ | ||
| 253 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, | 275 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, |
| 254 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, | 276 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, |
| 277 | { USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_NEW }, | ||
| 255 | 278 | ||
| 256 | /* Marvell device */ | 279 | /* Other Intel Bluetooth devices */ |
| 257 | { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL }, | 280 | { USB_VENDOR_AND_INTERFACE_INFO(0x8087, 0xe0, 0x01, 0x01), |
| 258 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, | 281 | .driver_info = BTUSB_IGNORE }, |
| 259 | 282 | ||
| 260 | { } /* Terminating entry */ | 283 | { } /* Terminating entry */ |
| 261 | }; | 284 | }; |
| @@ -267,6 +290,11 @@ static const struct usb_device_id blacklist_table[] = { · 5 unmodified lines | |||
| 267 | #define BTUSB_ISOC_RUNNING 2 | 290 | #define BTUSB_ISOC_RUNNING 2 |
| 268 | #define BTUSB_SUSPENDING 3 | 291 | #define BTUSB_SUSPENDING 3 |
| 269 | #define BTUSB_DID_ISO_RESUME 4 | 292 | #define BTUSB_DID_ISO_RESUME 4 |
| 293 | #define BTUSB_BOOTLOADER 5 | ||
| 294 | #define BTUSB_DOWNLOADING 6 | ||
| 295 | #define BTUSB_FIRMWARE_LOADED 7 | ||
| 296 | #define BTUSB_FIRMWARE_FAILED 8 | ||
| 297 | #define BTUSB_BOOTING 9 | ||
| 270 | 298 | ||
| 271 | struct btusb_data { | 299 | struct btusb_data { |
| 272 | struct hci_dev *hdev; | 300 | struct hci_dev *hdev; |
| @@ -300,14 +328,26 @@ struct btusb_data { · 27 unmodified lines | |||
| 300 | struct usb_endpoint_descriptor *isoc_rx_ep; | 328 | struct usb_endpoint_descriptor *isoc_rx_ep; |
| 301 | 329 | ||
| 302 | __u8 cmdreq_type; | 330 | __u8 cmdreq_type; |
| 331 | __u8 cmdreq; | ||
| 303 | 332 | ||
| 304 | unsigned int sco_num; | 333 | unsigned int sco_num; |
| 305 | int isoc_altsetting; | 334 | int isoc_altsetting; |
| 306 | int suspend_count; | 335 | int suspend_count; |
| 307 | 336 | ||
| 337 | int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb); | ||
| 308 | int (*recv_bulk)(struct btusb_data *data, void *buffer, int count); | 338 | int (*recv_bulk)(struct btusb_data *data, void *buffer, int count); |
| 309 | }; | 339 | }; |
| 310 | 340 | ||
| 341 | static int btusb_wait_on_bit_timeout(void *word, int bit, unsigned long timeout, | ||
| 342 | unsigned mode) | ||
| 343 | { | ||
| 344 | might_sleep(); | ||
| 345 | if (!test_bit(bit, word)) | ||
| 346 | return 0; | ||
| 347 | return out_of_line_wait_on_bit_timeout(word, bit, bit_wait_timeout, | ||
| 348 | mode, timeout); | ||
| 349 | } | ||
| 350 | |||
| 311 | static inline void btusb_free_frags(struct btusb_data *data) | 351 | static inline void btusb_free_frags(struct btusb_data *data) |
| 312 | { | 352 | { |
| 313 | unsigned long flags; | 353 | unsigned long flags; |
| @@ -370,7 +410,7 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count) · 56 unmodified lines | |||
| 370 | 410 | ||
| 371 | if (bt_cb(skb)->expect == 0) { | 411 | if (bt_cb(skb)->expect == 0) { |
| 372 | /* Complete frame */ | 412 | /* Complete frame */ |
| 373 | hci_recv_frame(data->hdev, skb); | 413 | data->recv_event(data->hdev, skb); |
| 374 | skb = NULL; | 414 | skb = NULL; |
| 375 | } | 415 | } |
| 376 | } | 416 | } |
| @@ -952,7 +992,7 @@ static struct urb *alloc_ctrl_urb(struct hci_dev *hdev, struct sk_buff *skb) · 575 unmodified lines | |||
| 952 | } | 992 | } |
| 953 | 993 | ||
| 954 | dr->bRequestType = data->cmdreq_type; | 994 | dr->bRequestType = data->cmdreq_type; |
| 955 | dr->bRequest = 0; | 995 | dr->bRequest = data->cmdreq; |
| 956 | dr->wIndex = 0; | 996 | dr->wIndex = 0; |
| 957 | dr->wValue = 0; | 997 | dr->wValue = 0; |
| 958 | dr->wLength = __cpu_to_le16(skb->len); | 998 | dr->wLength = __cpu_to_le16(skb->len); |
| @@ -1290,6 +1330,26 @@ struct intel_version { · 331 unmodified lines | |||
| 1290 | u8 fw_patch_num; | 1330 | u8 fw_patch_num; |
| 1291 | } __packed; | 1331 | } __packed; |
| 1292 | 1332 | ||
| 1333 | struct intel_boot_params { | ||
| 1334 | __u8 status; | ||
| 1335 | __u8 otp_format; | ||
| 1336 | __u8 otp_content; | ||
| 1337 | __u8 otp_patch; | ||
| 1338 | __le16 dev_revid; | ||
| 1339 | __u8 secure_boot; | ||
| 1340 | __u8 key_from_hdr; | ||
| 1341 | __u8 key_type; | ||
| 1342 | __u8 otp_lock; | ||
| 1343 | __u8 api_lock; | ||
| 1344 | __u8 debug_lock; | ||
| 1345 | bdaddr_t otp_bdaddr; | ||
| 1346 | __u8 min_fw_build_nn; | ||
| 1347 | __u8 min_fw_build_cw; | ||
| 1348 | __u8 min_fw_build_yy; | ||
| 1349 | __u8 limited_cce; | ||
| 1350 | __u8 unlocked_state; | ||
| 1351 | } __packed; | ||
| 1352 | |||
| 1293 | static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, | 1353 | static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, |
| 1294 | struct intel_version *ver) | 1354 | struct intel_version *ver) |
| 1295 | { | 1355 | { |
| @@ -1698,6 +1758,562 @@ exit_mfg_deactivate: · 402 unmodified lines | |||
| 1698 | return 0; | 1758 | return 0; |
| 1699 | } | 1759 | } |
| 1700 | 1760 | ||
| 1761 | static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) | ||
| 1762 | { | ||
| 1763 | struct sk_buff *skb; | ||
| 1764 | struct hci_event_hdr *hdr; | ||
| 1765 | struct hci_ev_cmd_complete *evt; | ||
| 1766 | |||
| 1767 | skb = bt_skb_alloc(sizeof(*hdr) + sizeof(*evt) + 1, GFP_ATOMIC); | ||
| 1768 | if (!skb) | ||
| 1769 | return -ENOMEM; | ||
| 1770 | |||
| 1771 | hdr = (struct hci_event_hdr *)skb_put(skb, sizeof(*hdr)); | ||
| 1772 | hdr->evt = HCI_EV_CMD_COMPLETE; | ||
| 1773 | hdr->plen = sizeof(*evt) + 1; | ||
| 1774 | |||
| 1775 | evt = (struct hci_ev_cmd_complete *)skb_put(skb, sizeof(*evt)); | ||
| 1776 | evt->ncmd = 0x01; | ||
| 1777 | evt->opcode = cpu_to_le16(opcode); | ||
| 1778 | |||
| 1779 | *skb_put(skb, 1) = 0x00; | ||
| 1780 | |||
| 1781 | bt_cb(skb)->pkt_type = HCI_EVENT_PKT; | ||
| 1782 | |||
| 1783 | return hci_recv_frame(hdev, skb); | ||
| 1784 | } | ||
| 1785 | |||
| 1786 | static int btusb_recv_bulk_intel(struct btusb_data *data, void *buffer, | ||
| 1787 | int count) | ||
| 1788 | { | ||
| 1789 | /* When the device is in bootloader mode, then it can send | ||
| 1790 | * events via the bulk endpoint. These events are treated the | ||
| 1791 | * same way as the ones received from the interrupt endpoint. | ||
| 1792 | */ | ||
| 1793 | if (test_bit(BTUSB_BOOTLOADER, &data->flags)) | ||
| 1794 | return btusb_recv_intr(data, buffer, count); | ||
| 1795 | |||
| 1796 | return btusb_recv_bulk(data, buffer, count); | ||
| 1797 | } | ||
| 1798 | |||
| 1799 | static int btusb_recv_event_intel(struct hci_dev *hdev, struct sk_buff *skb) | ||
| 1800 | { | ||
| 1801 | struct btusb_data *data = hci_get_drvdata(hdev); | ||
| 1802 | |||
| 1803 | if (test_bit(BTUSB_BOOTLOADER, &data->flags)) { | ||
| 1804 | struct hci_event_hdr *hdr = (void *)skb->data; | ||
| 1805 | |||
| 1806 | /* When the firmware loading completes the device sends | ||
| 1807 | * out a vendor specific event indicating the result of | ||
| 1808 | * the firmware loading. | ||
| 1809 | */ | ||
| 1810 | if (skb->len == 7 && hdr->evt == 0xff && hdr->plen == 0x05 && | ||
| 1811 | skb->data[2] == 0x06) { | ||
| 1812 | if (skb->data[3] != 0x00) | ||
| 1813 | test_bit(BTUSB_FIRMWARE_FAILED, &data->flags); | ||
| 1814 | |||
| 1815 | if (test_and_clear_bit(BTUSB_DOWNLOADING, | ||
| 1816 | &data->flags) && | ||
| 1817 | test_bit(BTUSB_FIRMWARE_LOADED, &data->flags)) { | ||
| 1818 | smp_mb__after_atomic(); | ||
| 1819 | wake_up_bit(&data->flags, BTUSB_DOWNLOADING); | ||
| 1820 | } | ||
| 1821 | } | ||
| 1822 | |||
| 1823 | /* When switching to the operational firmware the device | ||
| 1824 | * sends a vendor specific event indicating that the bootup | ||
| 1825 | * completed. | ||
| 1826 | */ | ||
| 1827 | if (skb->len == 9 && hdr->evt == 0xff && hdr->plen == 0x07 && | ||
| 1828 | skb->data[2] == 0x02) { | ||
| 1829 | if (test_and_clear_bit(BTUSB_BOOTING, &data->flags)) { | ||
| 1830 | smp_mb__after_atomic(); | ||
| 1831 | wake_up_bit(&data->flags, BTUSB_BOOTING); | ||
| 1832 | } | ||
| 1833 | } | ||
| 1834 | } | ||
| 1835 | |||
| 1836 | return hci_recv_frame(hdev, skb); | ||
| 1837 | } | ||
| 1838 | |||
| 1839 | static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb) | ||
| 1840 | { | ||
| 1841 | struct btusb_data *data = hci_get_drvdata(hdev); | ||
| 1842 | struct urb *urb; | ||
| 1843 | |||
| 1844 | BT_DBG("%s", hdev->name); | ||
| 1845 | |||
| 1846 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | ||
| 1847 | return -EBUSY; | ||
| 1848 | |||
| 1849 | switch (bt_cb(skb)->pkt_type) { | ||
| 1850 | case HCI_COMMAND_PKT: | ||
| 1851 | if (test_bit(BTUSB_BOOTLOADER, &data->flags)) { | ||
| 1852 | struct hci_command_hdr *cmd = (void *)skb->data; | ||
| 1853 | __u16 opcode = le16_to_cpu(cmd->opcode); | ||
| 1854 | |||
| 1855 | /* When in bootloader mode and the command 0xfc09 | ||
| 1856 | * is received, it needs to be send down the | ||
| 1857 | * bulk endpoint. So allocate a bulk URB instead. | ||
| 1858 | */ | ||
| 1859 | if (opcode == 0xfc09) | ||
| 1860 | urb = alloc_bulk_urb(hdev, skb); | ||
| 1861 | else | ||
| 1862 | urb = alloc_ctrl_urb(hdev, skb); | ||
| 1863 | |||
| 1864 | /* When the 0xfc01 command is issued to boot into | ||
| 1865 | * the operational firmware, it will actually not | ||
| 1866 | * send a command complete event. To keep the flow | ||
| 1867 | * control working inject that event here. | ||
| 1868 | */ | ||
| 1869 | if (opcode == 0xfc01) | ||
| 1870 | inject_cmd_complete(hdev, opcode); | ||
| 1871 | } else { | ||
| 1872 | urb = alloc_ctrl_urb(hdev, skb); | ||
| 1873 | } | ||
| 1874 | if (IS_ERR(urb)) | ||
| 1875 | return PTR_ERR(urb); | ||
| 1876 | |||
| 1877 | hdev->stat.cmd_tx++; | ||
| 1878 | return submit_or_queue_tx_urb(hdev, urb); | ||
| 1879 | |||
| 1880 | case HCI_ACLDATA_PKT: | ||
| 1881 | urb = alloc_bulk_urb(hdev, skb); | ||
| 1882 | if (IS_ERR(urb)) | ||
| 1883 | return PTR_ERR(urb); | ||
| 1884 | |||
| 1885 | hdev->stat.acl_tx++; | ||
| 1886 | return submit_or_queue_tx_urb(hdev, urb); | ||
| 1887 | |||
| 1888 | case HCI_SCODATA_PKT: | ||
| 1889 | if (hci_conn_num(hdev, SCO_LINK) < 1) | ||
| 1890 | return -ENODEV; | ||
| 1891 | |||
| 1892 | urb = alloc_isoc_urb(hdev, skb); | ||
| 1893 | if (IS_ERR(urb)) | ||
| 1894 | return PTR_ERR(urb); | ||
| 1895 | |||
| 1896 | hdev->stat.sco_tx++; | ||
| 1897 | return submit_tx_urb(hdev, urb); | ||
| 1898 | } | ||
| 1899 | |||
| 1900 | return -EILSEQ; | ||
| 1901 | } | ||
| 1902 | |||
| 1903 | static int btusb_intel_secure_send(struct hci_dev *hdev, u8 fragment_type, | ||
| 1904 | u32 plen, const void *param) | ||
| 1905 | { | ||
| 1906 | while (plen > 0) { | ||
| 1907 | struct sk_buff *skb; | ||
| 1908 | u8 cmd_param[253], fragment_len = (plen > 252) ? 252 : plen; | ||
| 1909 | |||
| 1910 | cmd_param[0] = fragment_type; | ||
| 1911 | memcpy(cmd_param + 1, param, fragment_len); | ||
| 1912 | |||
| 1913 | skb = __hci_cmd_sync(hdev, 0xfc09, fragment_len + 1, | ||
| 1914 | cmd_param, HCI_INIT_TIMEOUT); | ||
| 1915 | if (IS_ERR(skb)) | ||
| 1916 | return PTR_ERR(skb); | ||
| 1917 | |||
| 1918 | kfree_skb(skb); | ||
| 1919 | |||
| 1920 | plen -= fragment_len; | ||
| 1921 | param += fragment_len; | ||
| 1922 | } | ||
| 1923 | |||
| 1924 | return 0; | ||
| 1925 | } | ||
| 1926 | |||
| 1927 | static void btusb_intel_version_info(struct hci_dev *hdev, | ||
| 1928 | struct intel_version *ver) | ||
| 1929 | { | ||
| 1930 | const char *variant; | ||
| 1931 | |||
| 1932 | switch (ver->fw_variant) { | ||
| 1933 | case 0x06: | ||
| 1934 | variant = "Bootloader"; | ||
| 1935 | break; | ||
| 1936 | case 0x23: | ||
| 1937 | variant = "Firmware"; | ||
| 1938 | break; | ||
| 1939 | default: | ||
| 1940 | return; | ||
| 1941 | } | ||
| 1942 | |||
| 1943 | BT_INFO("%s: %s revision %u.%u build %u week %u %u", hdev->name, | ||
| 1944 | variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f, | ||
| 1945 | ver->fw_build_num, ver->fw_build_ww, 2000 + ver->fw_build_yy); | ||
| 1946 | } | ||
| 1947 | |||
| 1948 | static int btusb_setup_intel_new(struct hci_dev *hdev) | ||
| 1949 | { | ||
| 1950 | static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01, | ||
| 1951 | 0x00, 0x08, 0x04, 0x00 }; | ||
| 1952 | struct btusb_data *data = hci_get_drvdata(hdev); | ||
| 1953 | struct sk_buff *skb; | ||
| 1954 | struct intel_version *ver; | ||
| 1955 | struct intel_boot_params *params; | ||
| 1956 | const struct firmware *fw; | ||
| 1957 | const u8 *fw_ptr; | ||
| 1958 | char fwname[64]; | ||
| 1959 | ktime_t calltime, delta, rettime; | ||
| 1960 | unsigned long long duration; | ||
| 1961 | int err; | ||
| 1962 | |||
| 1963 | BT_DBG("%s", hdev->name); | ||
| 1964 | |||
| 1965 | calltime = ktime_get(); | ||
| 1966 | |||
| 1967 | /* Read the Intel version information to determine if the device | ||
| 1968 | * is in bootloader mode or if it already has operational firmware | ||
| 1969 | * loaded. | ||
| 1970 | */ | ||
| 1971 | skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT); | ||
| 1972 | if (IS_ERR(skb)) { | ||
| 1973 | BT_ERR("%s: Reading Intel version information failed (%ld)", | ||
| 1974 | hdev->name, PTR_ERR(skb)); | ||
| 1975 | return PTR_ERR(skb); | ||
| 1976 | } | ||
| 1977 | |||
| 1978 | if (skb->len != sizeof(*ver)) { | ||
| 1979 | BT_ERR("%s: Intel version event size mismatch", hdev->name); | ||
| 1980 | kfree_skb(skb); | ||
| 1981 | return -EILSEQ; | ||
| 1982 | } | ||
| 1983 | |||
| 1984 | ver = (struct intel_version *)skb->data; | ||
| 1985 | if (ver->status) { | ||
| 1986 | BT_ERR("%s: Intel version command failure (%02x)", | ||
| 1987 | hdev->name, ver->status); | ||
| 1988 | err = -bt_to_errno(ver->status); | ||
| 1989 | kfree_skb(skb); | ||
| 1990 | return err; | ||
| 1991 | } | ||
| 1992 | |||
| 1993 | /* The hardware platform number has a fixed value of 0x37 and | ||
| 1994 | * for now only accept this single value. | ||
| 1995 | */ | ||
| 1996 | if (ver->hw_platform != 0x37) { | ||
| 1997 | BT_ERR("%s: Unsupported Intel hardware platform (%u)", | ||
| 1998 | hdev->name, ver->hw_platform); | ||
| 1999 | kfree_skb(skb); | ||
| 2000 | return -EINVAL; | ||
| 2001 | } | ||
| 2002 | |||
| 2003 | /* At the moment only the hardware variant iBT 3.0 (LnP/SfP) is | ||
| 2004 | * supported by this firmware loading method. This check has been | ||
| 2005 | * put in place to ensure correct forward compatibility options | ||
| 2006 | * when newer hardware variants come along. | ||
| 2007 | */ | ||
| 2008 | if (ver->hw_variant != 0x0b) { | ||
| 2009 | BT_ERR("%s: Unsupported Intel hardware variant (%u)", | ||
| 2010 | hdev->name, ver->hw_variant); | ||
| 2011 | kfree_skb(skb); | ||
| 2012 | return -EINVAL; | ||
| 2013 | } | ||
| 2014 | |||
| 2015 | btusb_intel_version_info(hdev, ver); | ||
| 2016 | |||
| 2017 | /* The firmware variant determines if the device is in bootloader | ||
| 2018 | * mode or is running operational firmware. The value 0x06 identifies | ||
| 2019 | * the bootloader and the value 0x23 identifies the operational | ||
| 2020 | * firmware. | ||
| 2021 | * | ||
| 2022 | * When the operational firmware is already present, then only | ||
| 2023 | * the check for valid Bluetooth device address is needed. This | ||
| 2024 | * determines if the device will be added as configured or | ||
| 2025 | * unconfigured controller. | ||
| 2026 | * | ||
| 2027 | * It is not possible to use the Secure Boot Parameters in this | ||
| 2028 | * case since that command is only available in bootloader mode. | ||
| 2029 | */ | ||
| 2030 | if (ver->fw_variant == 0x23) { | ||
| 2031 | kfree_skb(skb); | ||
| 2032 | clear_bit(BTUSB_BOOTLOADER, &data->flags); | ||
| 2033 | btusb_check_bdaddr_intel(hdev); | ||
| 2034 | return 0; | ||
| 2035 | } | ||
| 2036 | |||
| 2037 | /* If the device is not in bootloader mode, then the only possible | ||
| 2038 | * choice is to return an error and abort the device initialization. | ||
| 2039 | */ | ||
| 2040 | if (ver->fw_variant != 0x06) { | ||
| 2041 | BT_ERR("%s: Unsupported Intel firmware variant (%u)", | ||
| 2042 | hdev->name, ver->fw_variant); | ||
| 2043 | kfree_skb(skb); | ||
| 2044 | return -ENODEV; | ||
| 2045 | } | ||
| 2046 | |||
| 2047 | kfree_skb(skb); | ||
| 2048 | |||
| 2049 | /* Read the secure boot parameters to identify the operating | ||
| 2050 | * details of the bootloader. | ||
| 2051 | */ | ||
| 2052 | skb = __hci_cmd_sync(hdev, 0xfc0d, 0, NULL, HCI_INIT_TIMEOUT); | ||
| 2053 | if (IS_ERR(skb)) { | ||
| 2054 | BT_ERR("%s: Reading Intel boot parameters failed (%ld)", | ||
| 2055 | hdev->name, PTR_ERR(skb)); | ||
| 2056 | return PTR_ERR(skb); | ||
| 2057 | } | ||
| 2058 | |||
| 2059 | if (skb->len != sizeof(*params)) { | ||
| 2060 | BT_ERR("%s: Intel boot parameters size mismatch", hdev->name); | ||
| 2061 | kfree_skb(skb); | ||
| 2062 | return -EILSEQ; | ||
| 2063 | } | ||
| 2064 | |||
| 2065 | params = (struct intel_boot_params *)skb->data; | ||
| 2066 | if (params->status) { | ||
| 2067 | BT_ERR("%s: Intel boot parameters command failure (%02x)", | ||
| 2068 | hdev->name, params->status); | ||
| 2069 | err = -bt_to_errno(params->status); | ||
| 2070 | kfree_skb(skb); | ||
| 2071 | return err; | ||
| 2072 | } | ||
| 2073 | |||
| 2074 | BT_INFO("%s: Device revision is %u", hdev->name, | ||
| 2075 | le16_to_cpu(params->dev_revid)); | ||
| 2076 | |||
| 2077 | BT_INFO("%s: Secure boot is %s", hdev->name, | ||
| 2078 | params->secure_boot ? "enabled" : "disabled"); | ||
| 2079 | |||
| 2080 | BT_INFO("%s: Minimum firmware build %u week %u %u", hdev->name, | ||
| 2081 | params->min_fw_build_nn, params->min_fw_build_cw, | ||
| 2082 | 2000 + params->min_fw_build_yy); | ||
| 2083 | |||
| 2084 | /* It is required that every single firmware fragment is acknowledged | ||
| 2085 | * with a command complete event. If the boot parameters indicate | ||
| 2086 | * that this bootloader does not send them, then abort the setup. | ||
| 2087 | */ | ||
| 2088 | if (params->limited_cce != 0x00) { | ||
| 2089 | BT_ERR("%s: Unsupported Intel firmware loading method (%u)", | ||
| 2090 | hdev->name, params->limited_cce); | ||
| 2091 | kfree_skb(skb); | ||
| 2092 | return -EINVAL; | ||
| 2093 | } | ||
| 2094 | |||
| 2095 | /* If the OTP has no valid Bluetooth device address, then there will | ||
| 2096 | * also be no valid address for the operational firmware. | ||
| 2097 | */ | ||
| 2098 | if (!bacmp(¶ms->otp_bdaddr, BDADDR_ANY)) { | ||
| 2099 | BT_INFO("%s: No device address configured", hdev->name); | ||
| 2100 | set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); | ||
| 2101 | } | ||
| 2102 | |||
| 2103 | /* With this Intel bootloader only the hardware variant and device | ||
| 2104 | * revision information are used to select the right firmware. | ||
| 2105 | * | ||
| 2106 | * Currently this bootloader support is limited to hardware variant | ||
| 2107 | * iBT 3.0 (LnP/SfP) which is identified by the value 11 (0x0b). | ||
| 2108 | */ | ||
| 2109 | snprintf(fwname, sizeof(fwname), "intel/ibt-11-%u.sfi", | ||
| 2110 | le16_to_cpu(params->dev_revid)); | ||
| 2111 | |||
| 2112 | err = request_firmware(&fw, fwname, &hdev->dev); | ||
| 2113 | if (err < 0) { | ||
| 2114 | BT_ERR("%s: Failed to load Intel firmware file (%d)", | ||
| 2115 | hdev->name, err); | ||
| 2116 | kfree_skb(skb); | ||
| 2117 | return err; | ||
| 2118 | } | ||
| 2119 | |||
| 2120 | BT_INFO("%s: Found device firmware: %s", hdev->name, fwname); | ||
| 2121 | |||
| 2122 | kfree_skb(skb); | ||
| 2123 | |||
| 2124 | if (fw->size < 644) { | ||
| 2125 | BT_ERR("%s: Invalid size of firmware file (%zu)", | ||
| 2126 | hdev->name, fw->size); | ||
| 2127 | err = -EBADF; | ||
| 2128 | goto done; | ||
| 2129 | } | ||
| 2130 | |||
| 2131 | set_bit(BTUSB_DOWNLOADING, &data->flags); | ||
| 2132 | |||
| 2133 | /* Start the firmware download transaction with the Init fragment | ||
| 2134 | * represented by the 128 bytes of CSS header. | ||
| 2135 | */ | ||
| 2136 | err = btusb_intel_secure_send(hdev, 0x00, 128, fw->data); | ||
| 2137 | if (err < 0) { | ||
| 2138 | BT_ERR("%s: Failed to send firmware header (%d)", | ||
| 2139 | hdev->name, err); | ||
| 2140 | goto done; | ||
| 2141 | } | ||
| 2142 | |||
| 2143 | /* Send the 256 bytes of public key information from the firmware | ||
| 2144 | * as the PKey fragment. | ||
| 2145 | */ | ||
| 2146 | err = btusb_intel_secure_send(hdev, 0x03, 256, fw->data + 128); | ||
| 2147 | if (err < 0) { | ||
| 2148 | BT_ERR("%s: Failed to send firmware public key (%d)", | ||
| 2149 | hdev->name, err); | ||
| 2150 | goto done; | ||
| 2151 | } | ||
| 2152 | |||
| 2153 | /* Send the 256 bytes of signature information from the firmware | ||
| 2154 | * as the Sign fragment. | ||
| 2155 | */ | ||
| 2156 | err = btusb_intel_secure_send(hdev, 0x02, 256, fw->data + 388); | ||
| 2157 | if (err < 0) { | ||
| 2158 | BT_ERR("%s: Failed to send firmware signature (%d)", | ||
| 2159 | hdev->name, err); | ||
| 2160 | goto done; | ||
| 2161 | } | ||
| 2162 | |||
| 2163 | fw_ptr = fw->data + 644; | ||
| 2164 | |||
| 2165 | while (fw_ptr - fw->data < fw->size) { | ||
| 2166 | struct hci_command_hdr *cmd = (void *)fw_ptr; | ||
| 2167 | u8 cmd_len; | ||
| 2168 | |||
| 2169 | cmd_len = sizeof(*cmd) + cmd->plen; | ||
| 2170 | |||
| 2171 | /* Send each command from the firmware data buffer as | ||
| 2172 | * a single Data fragment. | ||
| 2173 | */ | ||
| 2174 | err = btusb_intel_secure_send(hdev, 0x01, cmd_len, fw_ptr); | ||
| 2175 | if (err < 0) { | ||
| 2176 | BT_ERR("%s: Failed to send firmware data (%d)", | ||
| 2177 | hdev->name, err); | ||
| 2178 | goto done; | ||
| 2179 | } | ||
| 2180 | |||
| 2181 | fw_ptr += cmd_len; | ||
| 2182 | } | ||
| 2183 | |||
| 2184 | set_bit(BTUSB_FIRMWARE_LOADED, &data->flags); | ||
| 2185 | |||
| 2186 | BT_INFO("%s: Waiting for firmware download to complete", hdev->name); | ||
| 2187 | |||
| 2188 | /* Before switching the device into operational mode and with that | ||
| 2189 | * booting the loaded firmware, wait for the bootloader notification | ||
| 2190 | * that all fragments have been successfully received. | ||
| 2191 | * | ||
| 2192 | * When the event processing receives the notification, then the | ||
| 2193 | * BTUSB_DOWNLOADING flag will be cleared. | ||
| 2194 | * | ||
| 2195 | * The firmware loading should not take longer than 5 seconds | ||
| 2196 | * and thus just timeout if that happens and fail the setup | ||
| 2197 | * of this device. | ||
| 2198 | */ | ||
| 2199 | err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING, | ||
| 2200 | msecs_to_jiffies(5000), | ||
| 2201 | TASK_INTERRUPTIBLE); | ||
| 2202 | if (err == 1) { | ||
| 2203 | BT_ERR("%s: Firmware loading interrupted", hdev->name); | ||
| 2204 | err = -EINTR; | ||
| 2205 | goto done; | ||
| 2206 | } | ||
| 2207 | |||
| 2208 | if (err) { | ||
| 2209 | BT_ERR("%s: Firmware loading timeout", hdev->name); | ||
| 2210 | err = -ETIMEDOUT; | ||
| 2211 | goto done; | ||
| 2212 | } | ||
| 2213 | |||
| 2214 | if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) { | ||
| 2215 | BT_ERR("%s: Firmware loading failed", hdev->name); | ||
| 2216 | err = -ENOEXEC; | ||
| 2217 | goto done; | ||
| 2218 | } | ||
| 2219 | |||
| 2220 | rettime = ktime_get(); | ||
| 2221 | delta = ktime_sub(rettime, calltime); | ||
| 2222 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; | ||
| 2223 | |||
| 2224 | BT_INFO("%s: Firmware loaded in %llu usecs", hdev->name, duration); | ||
| 2225 | |||
| 2226 | done: | ||
| 2227 | release_firmware(fw); | ||
| 2228 | |||
| 2229 | if (err < 0) | ||
| 2230 | return err; | ||
| 2231 | |||
| 2232 | calltime = ktime_get(); | ||
| 2233 | |||
| 2234 | set_bit(BTUSB_BOOTING, &data->flags); | ||
| 2235 | |||
| 2236 | skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(reset_param), reset_param, | ||
| 2237 | HCI_INIT_TIMEOUT); | ||
| 2238 | if (IS_ERR(skb)) | ||
| 2239 | return PTR_ERR(skb); | ||
| 2240 | |||
| 2241 | kfree_skb(skb); | ||
| 2242 | |||
| 2243 | /* The bootloader will not indicate when the device is ready. This | ||
| 2244 | * is done by the operational firmware sending bootup notification. | ||
| 2245 | * | ||
| 2246 | * Booting into operational firmware should not take longer than | ||
| 2247 | * 1 second. However if that happens, then just fail the setup | ||
| 2248 | * since something went wrong. | ||
| 2249 | */ | ||
| 2250 | BT_INFO("%s: Waiting for device to boot", hdev->name); | ||
| 2251 | |||
| 2252 | err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_BOOTING, | ||
| 2253 | msecs_to_jiffies(1000), | ||
| 2254 | TASK_INTERRUPTIBLE); | ||
| 2255 | |||
| 2256 | if (err == 1) { | ||
| 2257 | BT_ERR("%s: Device boot interrupted", hdev->name); | ||
| 2258 | return -EINTR; | ||
| 2259 | } | ||
| 2260 | |||
| 2261 | if (err) { | ||
| 2262 | BT_ERR("%s: Device boot timeout", hdev->name); | ||
| 2263 | return -ETIMEDOUT; | ||
| 2264 | } | ||
| 2265 | |||
| 2266 | rettime = ktime_get(); | ||
| 2267 | delta = ktime_sub(rettime, calltime); | ||
| 2268 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; | ||
| 2269 | |||
| 2270 | BT_INFO("%s: Device booted in %llu usecs", hdev->name, duration); | ||
| 2271 | |||
| 2272 | clear_bit(BTUSB_BOOTLOADER, &data->flags); | ||
| 2273 | |||
| 2274 | return 0; | ||
| 2275 | } | ||
| 2276 | |||
| 2277 | static void btusb_hw_error_intel(struct hci_dev *hdev, u8 code) | ||
| 2278 | { | ||
| 2279 | struct sk_buff *skb; | ||
| 2280 | u8 type = 0x00; | ||
| 2281 | |||
| 2282 | BT_ERR("%s: Hardware error 0x%2.2x", hdev->name, code); | ||
| 2283 | |||
| 2284 | skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); | ||
| 2285 | if (IS_ERR(skb)) { | ||
| 2286 | BT_ERR("%s: Reset after hardware error failed (%ld)", | ||
| 2287 | hdev->name, PTR_ERR(skb)); | ||
| 2288 | return; | ||
| 2289 | } | ||
| 2290 | kfree_skb(skb); | ||
| 2291 | |||
| 2292 | skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT); | ||
| 2293 | if (IS_ERR(skb)) { | ||
| 2294 | BT_ERR("%s: Retrieving Intel exception info failed (%ld)", | ||
| 2295 | hdev->name, PTR_ERR(skb)); | ||
| 2296 | return; | ||
| 2297 | } | ||
| 2298 | |||
| 2299 | if (skb->len != 13) { | ||
| 2300 | BT_ERR("%s: Exception info size mismatch", hdev->name); | ||
| 2301 | kfree_skb(skb); | ||
| 2302 | return; | ||
| 2303 | } | ||
| 2304 | |||
| 2305 | if (skb->data[0] != 0x00) { | ||
| 2306 | BT_ERR("%s: Exception info command failure (%02x)", | ||
| 2307 | hdev->name, skb->data[0]); | ||
| 2308 | kfree_skb(skb); | ||
| 2309 | return; | ||
| 2310 | } | ||
| 2311 | |||
| 2312 | BT_ERR("%s: Exception info %s", hdev->name, (char *)(skb->data + 1)); | ||
| 2313 | |||
| 2314 | kfree_skb(skb); | ||
| 2315 | } | ||
| 2316 | |||
| 1701 | static int btusb_set_bdaddr_intel(struct hci_dev *hdev, const bdaddr_t *bdaddr) | 2317 | static int btusb_set_bdaddr_intel(struct hci_dev *hdev, const bdaddr_t *bdaddr) |
| 1702 | { | 2318 | { |
| 1703 | struct sk_buff *skb; | 2319 | struct sk_buff *skb; |
| @@ -1943,6 +2559,31 @@ static int btusb_set_bdaddr_bcm(struct hci_dev *hdev, const bdaddr_t *bdaddr) · 239 unmodified lines | |||
| 1943 | return 0; | 2559 | return 0; |
| 1944 | } | 2560 | } |
| 1945 | 2561 | ||
| 2562 | static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev, | ||
| 2563 | const bdaddr_t *bdaddr) | ||
| 2564 | { | ||
| 2565 | struct sk_buff *skb; | ||
| 2566 | u8 buf[10]; | ||
| 2567 | long ret; | ||
| 2568 | |||
| 2569 | buf[0] = 0x01; | ||
| 2570 | buf[1] = 0x01; | ||
| 2571 | buf[2] = 0x00; | ||
| 2572 | buf[3] = sizeof(bdaddr_t); | ||
| 2573 | memcpy(buf + 4, bdaddr, sizeof(bdaddr_t)); | ||
| 2574 | |||
| 2575 | skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT); | ||
| 2576 | if (IS_ERR(skb)) { | ||
| 2577 | ret = PTR_ERR(skb); | ||
| 2578 | BT_ERR("%s: Change address command failed (%ld)", | ||
| 2579 | hdev->name, ret); | ||
| 2580 | return ret; | ||
| 2581 | } | ||
| 2582 | kfree_skb(skb); | ||
| 2583 | |||
| 2584 | return 0; | ||
| 2585 | } | ||
| 2586 | |||
| 1946 | static int btusb_probe(struct usb_interface *intf, | 2587 | static int btusb_probe(struct usb_interface *intf, |
| 1947 | const struct usb_device_id *id) | 2588 | const struct usb_device_id *id) |
| 1948 | { | 2589 | { |
| @@ -2003,7 +2644,13 @@ static int btusb_probe(struct usb_interface *intf, · 54 unmodified lines | |||
| 2003 | if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) | 2644 | if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) |
| 2004 | return -ENODEV; | 2645 | return -ENODEV; |
| 2005 | 2646 | ||
| 2006 | data->cmdreq_type = USB_TYPE_CLASS; | 2647 | if (id->driver_info & BTUSB_AMP) { |
| 2648 | data->cmdreq_type = USB_TYPE_CLASS | 0x01; | ||
| 2649 | data->cmdreq = 0x2b; | ||
| 2650 | } else { | ||
| 2651 | data->cmdreq_type = USB_TYPE_CLASS; | ||
| 2652 | data->cmdreq = 0x00; | ||
| 2653 | } | ||
| 2007 | 2654 | ||
| 2008 | data->udev = interface_to_usbdev(intf); | 2655 | data->udev = interface_to_usbdev(intf); |
| 2009 | data->intf = intf; | 2656 | data->intf = intf; |
| @@ -2019,7 +2666,14 @@ static int btusb_probe(struct usb_interface *intf, · 9 unmodified lines | |||
| 2019 | init_usb_anchor(&data->isoc_anchor); | 2666 | init_usb_anchor(&data->isoc_anchor); |
| 2020 | spin_lock_init(&data->rxlock); | 2667 | spin_lock_init(&data->rxlock); |
| 2021 | 2668 | ||
| 2022 | data->recv_bulk = btusb_recv_bulk; | 2669 | if (id->driver_info & BTUSB_INTEL_NEW) { |
| 2670 | data->recv_event = btusb_recv_event_intel; | ||
| 2671 | data->recv_bulk = btusb_recv_bulk_intel; | ||
| 2672 | set_bit(BTUSB_BOOTLOADER, &data->flags); | ||
| 2673 | } else { | ||
| 2674 | data->recv_event = hci_recv_frame; | ||
| 2675 | data->recv_bulk = btusb_recv_bulk; | ||
| 2676 | } | ||
| 2023 | 2677 | ||
| 2024 | hdev = hci_alloc_dev(); | 2678 | hdev = hci_alloc_dev(); |
| 2025 | if (!hdev) | 2679 | if (!hdev) |
| @@ -2028,6 +2682,11 @@ static int btusb_probe(struct usb_interface *intf, · 2 unmodified lines | |||
| 2028 | hdev->bus = HCI_USB; | 2682 | hdev->bus = HCI_USB; |
| 2029 | hci_set_drvdata(hdev, data); | 2683 | hci_set_drvdata(hdev, data); |
| 2030 | 2684 | ||
| 2685 | if (id->driver_info & BTUSB_AMP) | ||
| 2686 | hdev->dev_type = HCI_AMP; | ||
| 2687 | else | ||
| 2688 | hdev->dev_type = HCI_BREDR; | ||
| 2689 | |||
| 2031 | data->hdev = hdev; | 2690 | data->hdev = hdev; |
| 2032 | 2691 | ||
| 2033 | SET_HCIDEV_DEV(hdev, &intf->dev); | 2692 | SET_HCIDEV_DEV(hdev, &intf->dev); |
| @@ -2050,16 +2709,40 @@ static int btusb_probe(struct usb_interface *intf, · 16 unmodified lines | |||
| 2050 | if (id->driver_info & BTUSB_INTEL) { | 2709 | if (id->driver_info & BTUSB_INTEL) { |
| 2051 | hdev->setup = btusb_setup_intel; | 2710 | hdev->setup = btusb_setup_intel; |
| 2052 | hdev->set_bdaddr = btusb_set_bdaddr_intel; | 2711 | hdev->set_bdaddr = btusb_set_bdaddr_intel; |
| 2712 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); | ||
| 2713 | } | ||
| 2714 | |||
| 2715 | if (id->driver_info & BTUSB_INTEL_NEW) { | ||
| 2716 | hdev->send = btusb_send_frame_intel; | ||
| 2717 | hdev->setup = btusb_setup_intel_new; | ||
| 2718 | hdev->hw_error = btusb_hw_error_intel; | ||
| 2719 | hdev->set_bdaddr = btusb_set_bdaddr_intel; | ||
| 2720 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); | ||
| 2053 | } | 2721 | } |
| 2054 | 2722 | ||
| 2055 | if (id->driver_info & BTUSB_MARVELL) | 2723 | if (id->driver_info & BTUSB_MARVELL) |
| 2056 | hdev->set_bdaddr = btusb_set_bdaddr_marvell; | 2724 | hdev->set_bdaddr = btusb_set_bdaddr_marvell; |
| 2057 | 2725 | ||
| 2726 | if (id->driver_info & BTUSB_SWAVE) { | ||
| 2727 | set_bit(HCI_QUIRK_FIXUP_INQUIRY_MODE, &hdev->quirks); | ||
| 2728 | set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks); | ||
| 2729 | } | ||
| 2730 | |||
| 2058 | if (id->driver_info & BTUSB_INTEL_BOOT) | 2731 | if (id->driver_info & BTUSB_INTEL_BOOT) |
| 2059 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | 2732 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); |
| 2060 | 2733 | ||
| 2061 | /* Interface numbers are hardcoded in the specification */ | 2734 | if (id->driver_info & BTUSB_ATH3012) { |
| 2062 | data->isoc = usb_ifnum_to_if(data->udev, 1); | 2735 | hdev->set_bdaddr = btusb_set_bdaddr_ath3012; |
| 2736 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); | ||
| 2737 | } | ||
| 2738 | |||
| 2739 | if (id->driver_info & BTUSB_AMP) { | ||
| 2740 | /* AMP controllers do not support SCO packets */ | ||
| 2741 | data->isoc = NULL; | ||
| 2742 | } else { | ||
| 2743 | /* Interface numbers are hardcoded in the specification */ | ||
| 2744 | data->isoc = usb_ifnum_to_if(data->udev, 1); | ||
| 2745 | } | ||
| 2063 | 2746 | ||
| 2064 | if (!reset) | 2747 | if (!reset) |
| 2065 | set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); | 2748 | set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); |
| @@ -2153,7 +2836,6 @@ static void btusb_disconnect(struct usb_interface *intf) · 87 unmodified lines | |||
| 2153 | else if (data->isoc) | 2836 | else if (data->isoc) |
| 2154 | usb_driver_release_interface(&btusb_driver, data->isoc); | 2837 | usb_driver_release_interface(&btusb_driver, data->isoc); |
| 2155 | 2838 | ||
| 2156 | btusb_free_frags(data); | ||
| 2157 | hci_free_dev(hdev); | 2839 | hci_free_dev(hdev); |
| 2158 | } | 2840 | } |
| 2159 | 2841 | ||
| @@ -190,7 +190,7 @@ PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" }; · 189 unmodified lines | |||
| 190 | PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" }; | 190 | PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" }; |
| 191 | PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" }; | 191 | PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" }; |
| 192 | PNAME(mux_cif_out_p) = { "cif_src", "xin24m" }; | 192 | PNAME(mux_cif_out_p) = { "cif_src", "xin24m" }; |
| 193 | PNAME(mux_macref_p) = { "mac_src", "ext_gmac" }; | 193 | PNAME(mux_mac_p) = { "mac_pll_src", "ext_gmac" }; |
| 194 | PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" }; | 194 | PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" }; |
| 195 | PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; | 195 | PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; |
| 196 | PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" }; | 196 | PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" }; |
| @@ -575,18 +575,18 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { · 378 unmodified lines | |||
| 575 | MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, 0, | 575 | MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, 0, |
| 576 | RK3288_CLKSEL_CON(3), 8, 2, MFLAGS), | 576 | RK3288_CLKSEL_CON(3), 8, 2, MFLAGS), |
| 577 | 577 | ||
| 578 | COMPOSITE(0, "mac_src", mux_pll_src_npll_cpll_gpll_p, 0, | 578 | COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0, |
| 579 | RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS, | 579 | RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS, |
| 580 | RK3288_CLKGATE_CON(2), 5, GFLAGS), | 580 | RK3288_CLKGATE_CON(2), 5, GFLAGS), |
| 581 | MUX(0, "macref", mux_macref_p, 0, | 581 | MUX(SCLK_MAC, "mac_clk", mux_mac_p, 0, |
| 582 | RK3288_CLKSEL_CON(21), 4, 1, MFLAGS), | 582 | RK3288_CLKSEL_CON(21), 4, 1, MFLAGS), |
| 583 | GATE(0, "sclk_macref_out", "macref", 0, | 583 | GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 0, |
| 584 | RK3288_CLKGATE_CON(5), 3, GFLAGS), | 584 | RK3288_CLKGATE_CON(5), 3, GFLAGS), |
| 585 | GATE(SCLK_MACREF, "sclk_macref", "macref", 0, | 585 | GATE(SCLK_MACREF, "sclk_macref", "mac_clk", 0, |
| 586 | RK3288_CLKGATE_CON(5), 2, GFLAGS), | 586 | RK3288_CLKGATE_CON(5), 2, GFLAGS), |
| 587 | GATE(SCLK_MAC_RX, "sclk_mac_rx", "macref", 0, | 587 | GATE(SCLK_MAC_RX, "sclk_mac_rx", "mac_clk", 0, |
| 588 | RK3288_CLKGATE_CON(5), 0, GFLAGS), | 588 | RK3288_CLKGATE_CON(5), 0, GFLAGS), |
| 589 | GATE(SCLK_MAC_TX, "sclk_mac_tx", "macref", 0, | 589 | GATE(SCLK_MAC_TX, "sclk_mac_tx", "mac_clk", 0, |
| 590 | RK3288_CLKGATE_CON(5), 1, GFLAGS), | 590 | RK3288_CLKGATE_CON(5), 1, GFLAGS), |
| 591 | 591 | ||
| 592 | COMPOSITE(0, "hsadc_src", mux_pll_src_cpll_gpll_p, 0, | 592 | COMPOSITE(0, "hsadc_src", mux_pll_src_cpll_gpll_p, 0, |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <linux/cpu.h> | 15 | #include <linux/cpu.h> |
| 16 | #include <linux/cpu_pm.h> | 16 | #include <linux/cpu_pm.h> |
| 17 | #include <linux/clockchips.h> | 17 | #include <linux/clockchips.h> |
| 18 | #include <linux/clocksource.h> | ||
| 18 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 19 | #include <linux/of_irq.h> | 20 | #include <linux/of_irq.h> |
| 20 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
| @@ -235,19 +235,19 @@ static void release_tid(struct c4iw_rdev *rdev, u32 hwtid, struct sk_buff *skb) · 234 unmodified lines | |||
| 235 | 235 | ||
| 236 | static void set_emss(struct c4iw_ep *ep, u16 opt) | 236 | static void set_emss(struct c4iw_ep *ep, u16 opt) |
| 237 | { | 237 | { |
| 238 | ep->emss = ep->com.dev->rdev.lldi.mtus[GET_TCPOPT_MSS(opt)] - | 238 | ep->emss = ep->com.dev->rdev.lldi.mtus[TCPOPT_MSS_G(opt)] - |
| 239 | ((AF_INET == ep->com.remote_addr.ss_family) ? | 239 | ((AF_INET == ep->com.remote_addr.ss_family) ? |
| 240 | sizeof(struct iphdr) : sizeof(struct ipv6hdr)) - | 240 | sizeof(struct iphdr) : sizeof(struct ipv6hdr)) - |
| 241 | sizeof(struct tcphdr); | 241 | sizeof(struct tcphdr); |
| 242 | ep->mss = ep->emss; | 242 | ep->mss = ep->emss; |
| 243 | if (GET_TCPOPT_TSTAMP(opt)) | 243 | if (TCPOPT_TSTAMP_G(opt)) |
| 244 | ep->emss -= round_up(TCPOLEN_TIMESTAMP, 4); | 244 | ep->emss -= round_up(TCPOLEN_TIMESTAMP, 4); |
| 245 | if (ep->emss < 128) | 245 | if (ep->emss < 128) |
| 246 | ep->emss = 128; | 246 | ep->emss = 128; |
| 247 | if (ep->emss & 7) | 247 | if (ep->emss & 7) |
| 248 | PDBG("Warning: misaligned mtu idx %u mss %u emss=%u\n", | 248 | PDBG("Warning: misaligned mtu idx %u mss %u emss=%u\n", |
| 249 | GET_TCPOPT_MSS(opt), ep->mss, ep->emss); | 249 | TCPOPT_MSS_G(opt), ep->mss, ep->emss); |
| 250 | PDBG("%s mss_idx %u mss %u emss=%u\n", __func__, GET_TCPOPT_MSS(opt), | 250 | PDBG("%s mss_idx %u mss %u emss=%u\n", __func__, TCPOPT_MSS_G(opt), |
| 251 | ep->mss, ep->emss); | 251 | ep->mss, ep->emss); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| @@ -652,29 +652,29 @@ static int send_connect(struct c4iw_ep *ep) · 398 unmodified lines | |||
| 652 | if (win > RCV_BUFSIZ_M) | 652 | if (win > RCV_BUFSIZ_M) |
| 653 | win = RCV_BUFSIZ_M; | 653 | win = RCV_BUFSIZ_M; |
| 654 | 654 | ||
| 655 | opt0 = (nocong ? NO_CONG(1) : 0) | | 655 | opt0 = (nocong ? NO_CONG_F : 0) | |
| 656 | KEEP_ALIVE_F | | 656 | KEEP_ALIVE_F | |
| 657 | DELACK(1) | | 657 | DELACK_F | |
| 658 | WND_SCALE_V(wscale) | | 658 | WND_SCALE_V(wscale) | |
| 659 | MSS_IDX_V(mtu_idx) | | 659 | MSS_IDX_V(mtu_idx) | |
| 660 | L2T_IDX_V(ep->l2t->idx) | | 660 | L2T_IDX_V(ep->l2t->idx) | |
| 661 | TX_CHAN_V(ep->tx_chan) | | 661 | TX_CHAN_V(ep->tx_chan) | |
| 662 | SMAC_SEL_V(ep->smac_idx) | | 662 | SMAC_SEL_V(ep->smac_idx) | |
| 663 | DSCP(ep->tos) | | 663 | DSCP_V(ep->tos) | |
| 664 | ULP_MODE_V(ULP_MODE_TCPDDP) | | 664 | ULP_MODE_V(ULP_MODE_TCPDDP) | |
| 665 | RCV_BUFSIZ_V(win); | 665 | RCV_BUFSIZ_V(win); |
| 666 | opt2 = RX_CHANNEL_V(0) | | 666 | opt2 = RX_CHANNEL_V(0) | |
| 667 | CCTRL_ECN(enable_ecn) | | 667 | CCTRL_ECN_V(enable_ecn) | |
| 668 | RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid); | 668 | RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid); |
| 669 | if (enable_tcp_timestamps) | 669 | if (enable_tcp_timestamps) |
| 670 | opt2 |= TSTAMPS_EN(1); | 670 | opt2 |= TSTAMPS_EN_F; |
| 671 | if (enable_tcp_sack) | 671 | if (enable_tcp_sack) |
| 672 | opt2 |= SACK_EN(1); | 672 | opt2 |= SACK_EN_F; |
| 673 | if (wscale && enable_tcp_window_scaling) | 673 | if (wscale && enable_tcp_window_scaling) |
| 674 | opt2 |= WND_SCALE_EN_F; | 674 | opt2 |= WND_SCALE_EN_F; |
| 675 | if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) { | 675 | if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) { |
| 676 | opt2 |= T5_OPT_2_VALID_F; | 676 | opt2 |= T5_OPT_2_VALID_F; |
| 677 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); | 677 | opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE); |
| 678 | opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */ | 678 | opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */ |
| 679 | } | 679 | } |
| 680 | t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure); | 680 | t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure); |
| @@ -1042,7 +1042,7 @@ static int act_establish(struct c4iw_dev *dev, struct sk_buff *skb) · 361 unmodified lines | |||
| 1042 | struct c4iw_ep *ep; | 1042 | struct c4iw_ep *ep; |
| 1043 | struct cpl_act_establish *req = cplhdr(skb); | 1043 | struct cpl_act_establish *req = cplhdr(skb); |
| 1044 | unsigned int tid = GET_TID(req); | 1044 | unsigned int tid = GET_TID(req); |
| 1045 | unsigned int atid = GET_TID_TID(ntohl(req->tos_atid)); | 1045 | unsigned int atid = TID_TID_G(ntohl(req->tos_atid)); |
| 1046 | struct tid_info *t = dev->rdev.lldi.tids; | 1046 | struct tid_info *t = dev->rdev.lldi.tids; |
| 1047 | 1047 | ||
| 1048 | ep = lookup_atid(t, atid); | 1048 | ep = lookup_atid(t, atid); |
| @@ -1258,8 +1258,8 @@ static int update_rx_credits(struct c4iw_ep *ep, u32 credits) · 209 unmodified lines | |||
| 1258 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK, | 1258 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK, |
| 1259 | ep->hwtid)); | 1259 | ep->hwtid)); |
| 1260 | req->credit_dack = cpu_to_be32(credits | RX_FORCE_ACK_F | | 1260 | req->credit_dack = cpu_to_be32(credits | RX_FORCE_ACK_F | |
| 1261 | F_RX_DACK_CHANGE | | 1261 | RX_DACK_CHANGE_F | |
| 1262 | V_RX_DACK_MODE(dack_mode)); | 1262 | RX_DACK_MODE_V(dack_mode)); |
| 1263 | set_wr_txq(skb, CPL_PRIORITY_ACK, ep->ctrlq_idx); | 1263 | set_wr_txq(skb, CPL_PRIORITY_ACK, ep->ctrlq_idx); |
| 1264 | c4iw_ofld_send(&ep->com.dev->rdev, skb); | 1264 | c4iw_ofld_send(&ep->com.dev->rdev, skb); |
| 1265 | return credits; | 1265 | return credits; |
| @@ -1751,7 +1751,7 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) · 485 unmodified lines | |||
| 1751 | skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); | 1751 | skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); |
| 1752 | req = (struct fw_ofld_connection_wr *)__skb_put(skb, sizeof(*req)); | 1752 | req = (struct fw_ofld_connection_wr *)__skb_put(skb, sizeof(*req)); |
| 1753 | memset(req, 0, sizeof(*req)); | 1753 | memset(req, 0, sizeof(*req)); |
| 1754 | req->op_compl = htonl(V_WR_OP(FW_OFLD_CONNECTION_WR)); | 1754 | req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); |
| 1755 | req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); | 1755 | req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); |
| 1756 | req->le.filter = cpu_to_be32(cxgb4_select_ntuple( | 1756 | req->le.filter = cpu_to_be32(cxgb4_select_ntuple( |
| 1757 | ep->com.dev->rdev.lldi.ports[0], | 1757 | ep->com.dev->rdev.lldi.ports[0], |
| @@ -1782,27 +1782,27 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) · 24 unmodified lines | |||
| 1782 | if (win > RCV_BUFSIZ_M) | 1782 | if (win > RCV_BUFSIZ_M) |
| 1783 | win = RCV_BUFSIZ_M; | 1783 | win = RCV_BUFSIZ_M; |
| 1784 | 1784 | ||
| 1785 | req->tcb.opt0 = (__force __be64) (TCAM_BYPASS(1) | | 1785 | req->tcb.opt0 = (__force __be64) (TCAM_BYPASS_F | |
| 1786 | (nocong ? NO_CONG(1) : 0) | | 1786 | (nocong ? NO_CONG_F : 0) | |
| 1787 | KEEP_ALIVE_F | | 1787 | KEEP_ALIVE_F | |
| 1788 | DELACK(1) | | 1788 | DELACK_F | |
| 1789 | WND_SCALE_V(wscale) | | 1789 | WND_SCALE_V(wscale) | |
| 1790 | MSS_IDX_V(mtu_idx) | | 1790 | MSS_IDX_V(mtu_idx) | |
| 1791 | L2T_IDX_V(ep->l2t->idx) | | 1791 | L2T_IDX_V(ep->l2t->idx) | |
| 1792 | TX_CHAN_V(ep->tx_chan) | | 1792 | TX_CHAN_V(ep->tx_chan) | |
| 1793 | SMAC_SEL_V(ep->smac_idx) | | 1793 | SMAC_SEL_V(ep->smac_idx) | |
| 1794 | DSCP(ep->tos) | | 1794 | DSCP_V(ep->tos) | |
| 1795 | ULP_MODE_V(ULP_MODE_TCPDDP) | | 1795 | ULP_MODE_V(ULP_MODE_TCPDDP) | |
| 1796 | RCV_BUFSIZ_V(win)); | 1796 | RCV_BUFSIZ_V(win)); |
| 1797 | req->tcb.opt2 = (__force __be32) (PACE(1) | | 1797 | req->tcb.opt2 = (__force __be32) (PACE_V(1) | |
| 1798 | TX_QUEUE(ep->com.dev->rdev.lldi.tx_modq[ep->tx_chan]) | | 1798 | TX_QUEUE_V(ep->com.dev->rdev.lldi.tx_modq[ep->tx_chan]) | |
| 1799 | RX_CHANNEL_V(0) | | 1799 | RX_CHANNEL_V(0) | |
| 1800 | CCTRL_ECN(enable_ecn) | | 1800 | CCTRL_ECN_V(enable_ecn) | |
| 1801 | RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid)); | 1801 | RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid)); |
| 1802 | if (enable_tcp_timestamps) | 1802 | if (enable_tcp_timestamps) |
| 1803 | req->tcb.opt2 |= (__force __be32)TSTAMPS_EN(1); | 1803 | req->tcb.opt2 |= (__force __be32)TSTAMPS_EN_F; |
| 1804 | if (enable_tcp_sack) | 1804 | if (enable_tcp_sack) |
| 1805 | req->tcb.opt2 |= (__force __be32)SACK_EN(1); | 1805 | req->tcb.opt2 |= (__force __be32)SACK_EN_F; |
| 1806 | if (wscale && enable_tcp_window_scaling) | 1806 | if (wscale && enable_tcp_window_scaling) |
| 1807 | req->tcb.opt2 |= (__force __be32)WND_SCALE_EN_F; | 1807 | req->tcb.opt2 |= (__force __be32)WND_SCALE_EN_F; |
| 1808 | req->tcb.opt0 = cpu_to_be64((__force u64)req->tcb.opt0); | 1808 | req->tcb.opt0 = cpu_to_be64((__force u64)req->tcb.opt0); |
| @@ -2023,10 +2023,10 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) · 214 unmodified lines | |||
| 2023 | { | 2023 | { |
| 2024 | struct c4iw_ep *ep; | 2024 | struct c4iw_ep *ep; |
| 2025 | struct cpl_act_open_rpl *rpl = cplhdr(skb); | 2025 | struct cpl_act_open_rpl *rpl = cplhdr(skb); |
| 2026 | unsigned int atid = GET_TID_TID(GET_AOPEN_ATID( | 2026 | unsigned int atid = TID_TID_G(AOPEN_ATID_G( |
| 2027 | ntohl(rpl->atid_status))); | 2027 | ntohl(rpl->atid_status))); |
| 2028 | struct tid_info *t = dev->rdev.lldi.tids; | 2028 | struct tid_info *t = dev->rdev.lldi.tids; |
| 2029 | int status = GET_AOPEN_STATUS(ntohl(rpl->atid_status)); | 2029 | int status = AOPEN_STATUS_G(ntohl(rpl->atid_status)); |
| 2030 | struct sockaddr_in *la; | 2030 | struct sockaddr_in *la; |
| 2031 | struct sockaddr_in *ra; | 2031 | struct sockaddr_in *ra; |
| 2032 | struct sockaddr_in6 *la6; | 2032 | struct sockaddr_in6 *la6; |
| @@ -2064,7 +2064,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) · 31 unmodified lines | |||
| 2064 | if (ep->com.local_addr.ss_family == AF_INET && | 2064 | if (ep->com.local_addr.ss_family == AF_INET && |
| 2065 | dev->rdev.lldi.enable_fw_ofld_conn) { | 2065 | dev->rdev.lldi.enable_fw_ofld_conn) { |
| 2066 | send_fw_act_open_req(ep, | 2066 | send_fw_act_open_req(ep, |
| 2067 | GET_TID_TID(GET_AOPEN_ATID( | 2067 | TID_TID_G(AOPEN_ATID_G( |
| 2068 | ntohl(rpl->atid_status)))); | 2068 | ntohl(rpl->atid_status)))); |
| 2069 | return 0; | 2069 | return 0; |
| 2070 | } | 2070 | } |
| @@ -2181,39 +2181,39 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, · 110 unmodified lines | |||
| 2181 | win = ep->rcv_win >> 10; | 2181 | win = ep->rcv_win >> 10; |
| 2182 | if (win > RCV_BUFSIZ_M) | 2182 | if (win > RCV_BUFSIZ_M) |
| 2183 | win = RCV_BUFSIZ_M; | 2183 | win = RCV_BUFSIZ_M; |
| 2184 | opt0 = (nocong ? NO_CONG(1) : 0) | | 2184 | opt0 = (nocong ? NO_CONG_F : 0) | |
| 2185 | KEEP_ALIVE_F | | 2185 | KEEP_ALIVE_F | |
| 2186 | DELACK(1) | | 2186 | DELACK_F | |
| 2187 | WND_SCALE_V(wscale) | | 2187 | WND_SCALE_V(wscale) | |
| 2188 | MSS_IDX_V(mtu_idx) | | 2188 | MSS_IDX_V(mtu_idx) | |
| 2189 | L2T_IDX_V(ep->l2t->idx) | | 2189 | L2T_IDX_V(ep->l2t->idx) | |
| 2190 | TX_CHAN_V(ep->tx_chan) | | 2190 | TX_CHAN_V(ep->tx_chan) | |
| 2191 | SMAC_SEL_V(ep->smac_idx) | | 2191 | SMAC_SEL_V(ep->smac_idx) | |
| 2192 | DSCP(ep->tos >> 2) | | 2192 | DSCP_V(ep->tos >> 2) | |
| 2193 | ULP_MODE_V(ULP_MODE_TCPDDP) | | 2193 | ULP_MODE_V(ULP_MODE_TCPDDP) | |
| 2194 | RCV_BUFSIZ_V(win); | 2194 | RCV_BUFSIZ_V(win); |
| 2195 | opt2 = RX_CHANNEL_V(0) | | 2195 | opt2 = RX_CHANNEL_V(0) | |
| 2196 | RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid); | 2196 | RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid); |
| 2197 | 2197 | ||
| 2198 | if (enable_tcp_timestamps && req->tcpopt.tstamp) | 2198 | if (enable_tcp_timestamps && req->tcpopt.tstamp) |
| 2199 | opt2 |= TSTAMPS_EN(1); | 2199 | opt2 |= TSTAMPS_EN_F; |
| 2200 | if (enable_tcp_sack && req->tcpopt.sack) | 2200 | if (enable_tcp_sack && req->tcpopt.sack) |
| 2201 | opt2 |= SACK_EN(1); | 2201 | opt2 |= SACK_EN_F; |
| 2202 | if (wscale && enable_tcp_window_scaling) | 2202 | if (wscale && enable_tcp_window_scaling) |
| 2203 | opt2 |= WND_SCALE_EN_F; | 2203 | opt2 |= WND_SCALE_EN_F; |
| 2204 | if (enable_ecn) { | 2204 | if (enable_ecn) { |
| 2205 | const struct tcphdr *tcph; | 2205 | const struct tcphdr *tcph; |
| 2206 | u32 hlen = ntohl(req->hdr_len); | 2206 | u32 hlen = ntohl(req->hdr_len); |
| 2207 | 2207 | ||
| 2208 | tcph = (const void *)(req + 1) + G_ETH_HDR_LEN(hlen) + | 2208 | tcph = (const void *)(req + 1) + ETH_HDR_LEN_G(hlen) + |
| 2209 | G_IP_HDR_LEN(hlen); | 2209 | IP_HDR_LEN_G(hlen); |
| 2210 | if (tcph->ece && tcph->cwr) | 2210 | if (tcph->ece && tcph->cwr) |
| 2211 | opt2 |= CCTRL_ECN(1); | 2211 | opt2 |= CCTRL_ECN_V(1); |
| 2212 | } | 2212 | } |
| 2213 | if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) { | 2213 | if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) { |
| 2214 | u32 isn = (prandom_u32() & ~7UL) - 1; | 2214 | u32 isn = (prandom_u32() & ~7UL) - 1; |
| 2215 | opt2 |= T5_OPT_2_VALID_F; | 2215 | opt2 |= T5_OPT_2_VALID_F; |
| 2216 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); | 2216 | opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE); |
| 2217 | opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */ | 2217 | opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */ |
| 2218 | rpl5 = (void *)rpl; | 2218 | rpl5 = (void *)rpl; |
| 2219 | memset(&rpl5->iss, 0, roundup(sizeof(*rpl5)-sizeof(*rpl), 16)); | 2219 | memset(&rpl5->iss, 0, roundup(sizeof(*rpl5)-sizeof(*rpl), 16)); |
| @@ -2245,8 +2245,8 @@ static void get_4tuple(struct cpl_pass_accept_req *req, int *iptype, · 25 unmodified lines | |||
| 2245 | __u8 *local_ip, __u8 *peer_ip, | 2245 | __u8 *local_ip, __u8 *peer_ip, |
| 2246 | __be16 *local_port, __be16 *peer_port) | 2246 | __be16 *local_port, __be16 *peer_port) |
| 2247 | { | 2247 | { |
| 2248 | int eth_len = G_ETH_HDR_LEN(be32_to_cpu(req->hdr_len)); | 2248 | int eth_len = ETH_HDR_LEN_G(be32_to_cpu(req->hdr_len)); |
| 2249 | int ip_len = G_IP_HDR_LEN(be32_to_cpu(req->hdr_len)); | 2249 | int ip_len = IP_HDR_LEN_G(be32_to_cpu(req->hdr_len)); |
| 2250 | struct iphdr *ip = (struct iphdr *)((u8 *)(req + 1) + eth_len); | 2250 | struct iphdr *ip = (struct iphdr *)((u8 *)(req + 1) + eth_len); |
| 2251 | struct ipv6hdr *ip6 = (struct ipv6hdr *)((u8 *)(req + 1) + eth_len); | 2251 | struct ipv6hdr *ip6 = (struct ipv6hdr *)((u8 *)(req + 1) + eth_len); |
| 2252 | struct tcphdr *tcp = (struct tcphdr *) | 2252 | struct tcphdr *tcp = (struct tcphdr *) |
| @@ -2277,7 +2277,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) · 24 unmodified lines | |||
| 2277 | { | 2277 | { |
| 2278 | struct c4iw_ep *child_ep = NULL, *parent_ep; | 2278 | struct c4iw_ep *child_ep = NULL, *parent_ep; |
| 2279 | struct cpl_pass_accept_req *req = cplhdr(skb); | 2279 | struct cpl_pass_accept_req *req = cplhdr(skb); |
| 2280 | unsigned int stid = GET_POPEN_TID(ntohl(req->tos_stid)); | 2280 | unsigned int stid = PASS_OPEN_TID_G(ntohl(req->tos_stid)); |
| 2281 | struct tid_info *t = dev->rdev.lldi.tids; | 2281 | struct tid_info *t = dev->rdev.lldi.tids; |
| 2282 | unsigned int hwtid = GET_TID(req); | 2282 | unsigned int hwtid = GET_TID(req); |
| 2283 | struct dst_entry *dst; | 2283 | struct dst_entry *dst; |
| @@ -2310,14 +2310,14 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) · 26 unmodified lines | |||
| 2310 | ntohs(peer_port), peer_mss); | 2310 | ntohs(peer_port), peer_mss); |
| 2311 | dst = find_route(dev, *(__be32 *)local_ip, *(__be32 *)peer_ip, | 2311 | dst = find_route(dev, *(__be32 *)local_ip, *(__be32 *)peer_ip, |
| 2312 | local_port, peer_port, | 2312 | local_port, peer_port, |
| 2313 | GET_POPEN_TOS(ntohl(req->tos_stid))); | 2313 | PASS_OPEN_TOS_G(ntohl(req->tos_stid))); |
| 2314 | } else { | 2314 | } else { |
| 2315 | PDBG("%s parent ep %p hwtid %u laddr %pI6 raddr %pI6 lport %d rport %d peer_mss %d\n" | 2315 | PDBG("%s parent ep %p hwtid %u laddr %pI6 raddr %pI6 lport %d rport %d peer_mss %d\n" |
| 2316 | , __func__, parent_ep, hwtid, | 2316 | , __func__, parent_ep, hwtid, |
| 2317 | local_ip, peer_ip, ntohs(local_port), | 2317 | local_ip, peer_ip, ntohs(local_port), |
| 2318 | ntohs(peer_port), peer_mss); | 2318 | ntohs(peer_port), peer_mss); |
| 2319 | dst = find_route6(dev, local_ip, peer_ip, local_port, peer_port, | 2319 | dst = find_route6(dev, local_ip, peer_ip, local_port, peer_port, |
| 2320 | PASS_OPEN_TOS(ntohl(req->tos_stid)), | 2320 | PASS_OPEN_TOS_G(ntohl(req->tos_stid)), |
| 2321 | ((struct sockaddr_in6 *) | 2321 | ((struct sockaddr_in6 *) |
| 2322 | &parent_ep->com.local_addr)->sin6_scope_id); | 2322 | &parent_ep->com.local_addr)->sin6_scope_id); |
| 2323 | } | 2323 | } |
| @@ -2375,7 +2375,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) · 51 unmodified lines | |||
| 2375 | } | 2375 | } |
| 2376 | c4iw_get_ep(&parent_ep->com); | 2376 | c4iw_get_ep(&parent_ep->com); |
| 2377 | child_ep->parent_ep = parent_ep; | 2377 | child_ep->parent_ep = parent_ep; |
| 2378 | child_ep->tos = GET_POPEN_TOS(ntohl(req->tos_stid)); | 2378 | child_ep->tos = PASS_OPEN_TOS_G(ntohl(req->tos_stid)); |
| 2379 | child_ep->dst = dst; | 2379 | child_ep->dst = dst; |
| 2380 | child_ep->hwtid = hwtid; | 2380 | child_ep->hwtid = hwtid; |
| 2381 | 2381 | ||
| @@ -3500,24 +3500,24 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos) · 1118 unmodified lines | |||
| 3500 | 3500 | ||
| 3501 | req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req)); | 3501 | req = (struct cpl_pass_accept_req *)__skb_push(skb, sizeof(*req)); |
| 3502 | memset(req, 0, sizeof(*req)); | 3502 | memset(req, 0, sizeof(*req)); |
| 3503 | req->l2info = cpu_to_be16(V_SYN_INTF(intf) | | 3503 | req->l2info = cpu_to_be16(SYN_INTF_V(intf) | |
| 3504 | V_SYN_MAC_IDX(G_RX_MACIDX( | 3504 | SYN_MAC_IDX_V(RX_MACIDX_G( |
| 3505 | (__force int) htonl(l2info))) | | 3505 | (__force int) htonl(l2info))) | |
| 3506 | F_SYN_XACT_MATCH); | 3506 | SYN_XACT_MATCH_F); |
| 3507 | eth_hdr_len = is_t4(dev->rdev.lldi.adapter_type) ? | 3507 | eth_hdr_len = is_t4(dev->rdev.lldi.adapter_type) ? |
| 3508 | G_RX_ETHHDR_LEN((__force int) htonl(l2info)) : | 3508 | RX_ETHHDR_LEN_G((__force int)htonl(l2info)) : |
| 3509 | G_RX_T5_ETHHDR_LEN((__force int) htonl(l2info)); | 3509 | RX_T5_ETHHDR_LEN_G((__force int)htonl(l2info)); |
| 3510 | req->hdr_len = cpu_to_be32(V_SYN_RX_CHAN(G_RX_CHAN( | 3510 | req->hdr_len = cpu_to_be32(SYN_RX_CHAN_V(RX_CHAN_G( |
| 3511 | (__force int) htonl(l2info))) | | 3511 | (__force int) htonl(l2info))) | |
| 3512 | V_TCP_HDR_LEN(G_RX_TCPHDR_LEN( | 3512 | TCP_HDR_LEN_V(RX_TCPHDR_LEN_G( |
| 3513 | (__force int) htons(hdr_len))) | | 3513 | (__force int) htons(hdr_len))) | |
| 3514 | V_IP_HDR_LEN(G_RX_IPHDR_LEN( | 3514 | IP_HDR_LEN_V(RX_IPHDR_LEN_G( |
| 3515 | (__force int) htons(hdr_len))) | | 3515 | (__force int) htons(hdr_len))) | |
| 3516 | V_ETH_HDR_LEN(G_RX_ETHHDR_LEN(eth_hdr_len))); | 3516 | ETH_HDR_LEN_V(RX_ETHHDR_LEN_G(eth_hdr_len))); |
| 3517 | req->vlan = (__force __be16) vlantag; | 3517 | req->vlan = (__force __be16) vlantag; |
| 3518 | req->len = (__force __be16) len; | 3518 | req->len = (__force __be16) len; |
| 3519 | req->tos_stid = cpu_to_be32(PASS_OPEN_TID(stid) | | 3519 | req->tos_stid = cpu_to_be32(PASS_OPEN_TID_V(stid) | |
| 3520 | PASS_OPEN_TOS(tos)); | 3520 | PASS_OPEN_TOS_V(tos)); |
| 3521 | req->tcpopt.mss = htons(tmp_opt.mss_clamp); | 3521 | req->tcpopt.mss = htons(tmp_opt.mss_clamp); |
| 3522 | if (tmp_opt.wscale_ok) | 3522 | if (tmp_opt.wscale_ok) |
| 3523 | req->tcpopt.wsf = tmp_opt.snd_wscale; | 3523 | req->tcpopt.wsf = tmp_opt.snd_wscale; |
| @@ -3542,7 +3542,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, · 18 unmodified lines | |||
| 3542 | req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); | 3542 | req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); |
| 3543 | req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req)); | 3543 | req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req)); |
| 3544 | memset(req, 0, sizeof(*req)); | 3544 | memset(req, 0, sizeof(*req)); |
| 3545 | req->op_compl = htonl(V_WR_OP(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F); | 3545 | req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F); |
| 3546 | req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); | 3546 | req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); |
| 3547 | req->le.version_cpl = htonl(FW_OFLD_CONNECTION_WR_CPL_F); | 3547 | req->le.version_cpl = htonl(FW_OFLD_CONNECTION_WR_CPL_F); |
| 3548 | req->le.filter = (__force __be32) filter; | 3548 | req->le.filter = (__force __be32) filter; |
| @@ -3556,7 +3556,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, · 7 unmodified lines | |||
| 3556 | htonl(FW_OFLD_CONNECTION_WR_T_STATE_V(TCP_SYN_RECV) | | 3556 | htonl(FW_OFLD_CONNECTION_WR_T_STATE_V(TCP_SYN_RECV) | |
| 3557 | FW_OFLD_CONNECTION_WR_RCV_SCALE_V(cpl->tcpopt.wsf) | | 3557 | FW_OFLD_CONNECTION_WR_RCV_SCALE_V(cpl->tcpopt.wsf) | |
| 3558 | FW_OFLD_CONNECTION_WR_ASTID_V( | 3558 | FW_OFLD_CONNECTION_WR_ASTID_V( |
| 3559 | GET_PASS_OPEN_TID(ntohl(cpl->tos_stid)))); | 3559 | PASS_OPEN_TID_G(ntohl(cpl->tos_stid)))); |
| 3560 | 3560 | ||
| 3561 | /* | 3561 | /* |
| 3562 | * We store the qid in opt2 which will be used by the firmware | 3562 | * We store the qid in opt2 which will be used by the firmware |
| @@ -3613,7 +3613,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) · 50 unmodified lines | |||
| 3613 | struct neighbour *neigh; | 3613 | struct neighbour *neigh; |
| 3614 | 3614 | ||
| 3615 | /* Drop all non-SYN packets */ | 3615 | /* Drop all non-SYN packets */ |
| 3616 | if (!(cpl->l2info & cpu_to_be32(F_RXF_SYN))) | 3616 | if (!(cpl->l2info & cpu_to_be32(RXF_SYN_F))) |
| 3617 | goto reject; | 3617 | goto reject; |
| 3618 | 3618 | ||
| 3619 | /* | 3619 | /* |
| @@ -3635,8 +3635,8 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) · 15 unmodified lines | |||
| 3635 | } | 3635 | } |
| 3636 | 3636 | ||
| 3637 | eth_hdr_len = is_t4(dev->rdev.lldi.adapter_type) ? | 3637 | eth_hdr_len = is_t4(dev->rdev.lldi.adapter_type) ? |
| 3638 | G_RX_ETHHDR_LEN(htonl(cpl->l2info)) : | 3638 | RX_ETHHDR_LEN_G(htonl(cpl->l2info)) : |
| 3639 | G_RX_T5_ETHHDR_LEN(htonl(cpl->l2info)); | 3639 | RX_T5_ETHHDR_LEN_G(htonl(cpl->l2info)); |
| 3640 | if (eth_hdr_len == ETH_HLEN) { | 3640 | if (eth_hdr_len == ETH_HLEN) { |
| 3641 | eh = (struct ethhdr *)(req + 1); | 3641 | eh = (struct ethhdr *)(req + 1); |
| 3642 | iph = (struct iphdr *)(eh + 1); | 3642 | iph = (struct iphdr *)(eh + 1); |
| @@ -52,7 +52,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 51 unmodified lines | |||
| 52 | memset(res_wr, 0, wr_len); | 52 | memset(res_wr, 0, wr_len); |
| 53 | res_wr->op_nres = cpu_to_be32( | 53 | res_wr->op_nres = cpu_to_be32( |
| 54 | FW_WR_OP_V(FW_RI_RES_WR) | | 54 | FW_WR_OP_V(FW_RI_RES_WR) | |
| 55 | V_FW_RI_RES_WR_NRES(1) | | 55 | FW_RI_RES_WR_NRES_V(1) | |
| 56 | FW_WR_COMPL_F); | 56 | FW_WR_COMPL_F); |
| 57 | res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); | 57 | res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); |
| 58 | res_wr->cookie = (unsigned long) &wr_wait; | 58 | res_wr->cookie = (unsigned long) &wr_wait; |
| @@ -122,7 +122,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 63 unmodified lines | |||
| 122 | memset(res_wr, 0, wr_len); | 122 | memset(res_wr, 0, wr_len); |
| 123 | res_wr->op_nres = cpu_to_be32( | 123 | res_wr->op_nres = cpu_to_be32( |
| 124 | FW_WR_OP_V(FW_RI_RES_WR) | | 124 | FW_WR_OP_V(FW_RI_RES_WR) | |
| 125 | V_FW_RI_RES_WR_NRES(1) | | 125 | FW_RI_RES_WR_NRES_V(1) | |
| 126 | FW_WR_COMPL_F); | 126 | FW_WR_COMPL_F); |
| 127 | res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); | 127 | res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); |
| 128 | res_wr->cookie = (unsigned long) &wr_wait; | 128 | res_wr->cookie = (unsigned long) &wr_wait; |
| @@ -131,17 +131,17 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 2 unmodified lines | |||
| 131 | res->u.cq.op = FW_RI_RES_OP_WRITE; | 131 | res->u.cq.op = FW_RI_RES_OP_WRITE; |
| 132 | res->u.cq.iqid = cpu_to_be32(cq->cqid); | 132 | res->u.cq.iqid = cpu_to_be32(cq->cqid); |
| 133 | res->u.cq.iqandst_to_iqandstindex = cpu_to_be32( | 133 | res->u.cq.iqandst_to_iqandstindex = cpu_to_be32( |
| 134 | V_FW_RI_RES_WR_IQANUS(0) | | 134 | FW_RI_RES_WR_IQANUS_V(0) | |
| 135 | V_FW_RI_RES_WR_IQANUD(1) | | 135 | FW_RI_RES_WR_IQANUD_V(1) | |
| 136 | F_FW_RI_RES_WR_IQANDST | | 136 | FW_RI_RES_WR_IQANDST_F | |
| 137 | V_FW_RI_RES_WR_IQANDSTINDEX( | 137 | FW_RI_RES_WR_IQANDSTINDEX_V( |
| 138 | rdev->lldi.ciq_ids[cq->vector])); | 138 | rdev->lldi.ciq_ids[cq->vector])); |
| 139 | res->u.cq.iqdroprss_to_iqesize = cpu_to_be16( | 139 | res->u.cq.iqdroprss_to_iqesize = cpu_to_be16( |
| 140 | F_FW_RI_RES_WR_IQDROPRSS | | 140 | FW_RI_RES_WR_IQDROPRSS_F | |
| 141 | V_FW_RI_RES_WR_IQPCIECH(2) | | 141 | FW_RI_RES_WR_IQPCIECH_V(2) | |
| 142 | V_FW_RI_RES_WR_IQINTCNTTHRESH(0) | | 142 | FW_RI_RES_WR_IQINTCNTTHRESH_V(0) | |
| 143 | F_FW_RI_RES_WR_IQO | | 143 | FW_RI_RES_WR_IQO_F | |
| 144 | V_FW_RI_RES_WR_IQESIZE(1)); | 144 | FW_RI_RES_WR_IQESIZE_V(1)); |
| 145 | res->u.cq.iqsize = cpu_to_be16(cq->size); | 145 | res->u.cq.iqsize = cpu_to_be16(cq->size); |
| 146 | res->u.cq.iqaddr = cpu_to_be64(cq->dma_addr); | 146 | res->u.cq.iqaddr = cpu_to_be64(cq->dma_addr); |
| 147 | 147 | ||
| @@ -182,12 +182,12 @@ static void insert_recv_cqe(struct t4_wq *wq, struct t4_cq *cq) · 34 unmodified lines | |||
| 182 | PDBG("%s wq %p cq %p sw_cidx %u sw_pidx %u\n", __func__, | 182 | PDBG("%s wq %p cq %p sw_cidx %u sw_pidx %u\n", __func__, |
| 183 | wq, cq, cq->sw_cidx, cq->sw_pidx); | 183 | wq, cq, cq->sw_cidx, cq->sw_pidx); |
| 184 | memset(&cqe, 0, sizeof(cqe)); | 184 | memset(&cqe, 0, sizeof(cqe)); |
| 185 | cqe.header = cpu_to_be32(V_CQE_STATUS(T4_ERR_SWFLUSH) | | 185 | cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) | |
| 186 | V_CQE_OPCODE(FW_RI_SEND) | | 186 | CQE_OPCODE_V(FW_RI_SEND) | |
| 187 | V_CQE_TYPE(0) | | 187 | CQE_TYPE_V(0) | |
| 188 | V_CQE_SWCQE(1) | | 188 | CQE_SWCQE_V(1) | |
| 189 | V_CQE_QPID(wq->sq.qid)); | 189 | CQE_QPID_V(wq->sq.qid)); |
| 190 | cqe.bits_type_ts = cpu_to_be64(V_CQE_GENBIT((u64)cq->gen)); | 190 | cqe.bits_type_ts = cpu_to_be64(CQE_GENBIT_V((u64)cq->gen)); |
| 191 | cq->sw_queue[cq->sw_pidx] = cqe; | 191 | cq->sw_queue[cq->sw_pidx] = cqe; |
| 192 | t4_swcq_produce(cq); | 192 | t4_swcq_produce(cq); |
| 193 | } | 193 | } |
| @@ -215,13 +215,13 @@ static void insert_sq_cqe(struct t4_wq *wq, struct t4_cq *cq, · 21 unmodified lines | |||
| 215 | PDBG("%s wq %p cq %p sw_cidx %u sw_pidx %u\n", __func__, | 215 | PDBG("%s wq %p cq %p sw_cidx %u sw_pidx %u\n", __func__, |
| 216 | wq, cq, cq->sw_cidx, cq->sw_pidx); | 216 | wq, cq, cq->sw_cidx, cq->sw_pidx); |
| 217 | memset(&cqe, 0, sizeof(cqe)); | 217 | memset(&cqe, 0, sizeof(cqe)); |
| 218 | cqe.header = cpu_to_be32(V_CQE_STATUS(T4_ERR_SWFLUSH) | | 218 | cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) | |
| 219 | V_CQE_OPCODE(swcqe->opcode) | | 219 | CQE_OPCODE_V(swcqe->opcode) | |
| 220 | V_CQE_TYPE(1) | | 220 | CQE_TYPE_V(1) | |
| 221 | V_CQE_SWCQE(1) | | 221 | CQE_SWCQE_V(1) | |
| 222 | V_CQE_QPID(wq->sq.qid)); | 222 | CQE_QPID_V(wq->sq.qid)); |
| 223 | CQE_WRID_SQ_IDX(&cqe) = swcqe->idx; | 223 | CQE_WRID_SQ_IDX(&cqe) = swcqe->idx; |
| 224 | cqe.bits_type_ts = cpu_to_be64(V_CQE_GENBIT((u64)cq->gen)); | 224 | cqe.bits_type_ts = cpu_to_be64(CQE_GENBIT_V((u64)cq->gen)); |
| 225 | cq->sw_queue[cq->sw_pidx] = cqe; | 225 | cq->sw_queue[cq->sw_pidx] = cqe; |
| 226 | t4_swcq_produce(cq); | 226 | t4_swcq_produce(cq); |
| 227 | } | 227 | } |
| @@ -284,7 +284,7 @@ static void flush_completed_wrs(struct t4_wq *wq, struct t4_cq *cq) · 56 unmodified lines | |||
| 284 | */ | 284 | */ |
| 285 | PDBG("%s moving cqe into swcq sq idx %u cq idx %u\n", | 285 | PDBG("%s moving cqe into swcq sq idx %u cq idx %u\n", |
| 286 | __func__, cidx, cq->sw_pidx); | 286 | __func__, cidx, cq->sw_pidx); |
| 287 | swsqe->cqe.header |= htonl(V_CQE_SWCQE(1)); | 287 | swsqe->cqe.header |= htonl(CQE_SWCQE_V(1)); |
| 288 | cq->sw_queue[cq->sw_pidx] = swsqe->cqe; | 288 | cq->sw_queue[cq->sw_pidx] = swsqe->cqe; |
| 289 | t4_swcq_produce(cq); | 289 | t4_swcq_produce(cq); |
| 290 | swsqe->flushed = 1; | 290 | swsqe->flushed = 1; |
| @@ -301,10 +301,10 @@ static void create_read_req_cqe(struct t4_wq *wq, struct t4_cqe *hw_cqe, · 10 unmodified lines | |||
| 301 | { | 301 | { |
| 302 | read_cqe->u.scqe.cidx = wq->sq.oldest_read->idx; | 302 | read_cqe->u.scqe.cidx = wq->sq.oldest_read->idx; |
| 303 | read_cqe->len = htonl(wq->sq.oldest_read->read_len); | 303 | read_cqe->len = htonl(wq->sq.oldest_read->read_len); |
| 304 | read_cqe->header = htonl(V_CQE_QPID(CQE_QPID(hw_cqe)) | | 304 | read_cqe->header = htonl(CQE_QPID_V(CQE_QPID(hw_cqe)) | |
| 305 | V_CQE_SWCQE(SW_CQE(hw_cqe)) | | 305 | CQE_SWCQE_V(SW_CQE(hw_cqe)) | |
| 306 | V_CQE_OPCODE(FW_RI_READ_REQ) | | 306 | CQE_OPCODE_V(FW_RI_READ_REQ) | |
| 307 | V_CQE_TYPE(1)); | 307 | CQE_TYPE_V(1)); |
| 308 | read_cqe->bits_type_ts = hw_cqe->bits_type_ts; | 308 | read_cqe->bits_type_ts = hw_cqe->bits_type_ts; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| @@ -400,7 +400,7 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp) · 89 unmodified lines | |||
| 400 | } else { | 400 | } else { |
| 401 | swcqe = &chp->cq.sw_queue[chp->cq.sw_pidx]; | 401 | swcqe = &chp->cq.sw_queue[chp->cq.sw_pidx]; |
| 402 | *swcqe = *hw_cqe; | 402 | *swcqe = *hw_cqe; |
| 403 | swcqe->header |= cpu_to_be32(V_CQE_SWCQE(1)); | 403 | swcqe->header |= cpu_to_be32(CQE_SWCQE_V(1)); |
| 404 | t4_swcq_produce(&chp->cq); | 404 | t4_swcq_produce(&chp->cq); |
| 405 | } | 405 | } |
| 406 | next_cqe: | 406 | next_cqe: |
| @@ -576,7 +576,7 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe, · 169 unmodified lines | |||
| 576 | } | 576 | } |
| 577 | if (unlikely((CQE_WRID_MSN(hw_cqe) != (wq->rq.msn)))) { | 577 | if (unlikely((CQE_WRID_MSN(hw_cqe) != (wq->rq.msn)))) { |
| 578 | t4_set_wq_in_error(wq); | 578 | t4_set_wq_in_error(wq); |
| 579 | hw_cqe->header |= htonl(V_CQE_STATUS(T4_ERR_MSN)); | 579 | hw_cqe->header |= htonl(CQE_STATUS_V(T4_ERR_MSN)); |
| 580 | goto proc_cqe; | 580 | goto proc_cqe; |
| 581 | } | 581 | } |
| 582 | goto proc_cqe; | 582 | goto proc_cqe; |
| @@ -380,12 +380,12 @@ static int dump_stag(int id, void *p, void *data) · 379 unmodified lines | |||
| 380 | "stag: idx 0x%x valid %d key 0x%x state %d pdid %d " | 380 | "stag: idx 0x%x valid %d key 0x%x state %d pdid %d " |
| 381 | "perm 0x%x ps %d len 0x%llx va 0x%llx\n", | 381 | "perm 0x%x ps %d len 0x%llx va 0x%llx\n", |
| 382 | (u32)id<<8, | 382 | (u32)id<<8, |
| 383 | G_FW_RI_TPTE_VALID(ntohl(tpte.valid_to_pdid)), | 383 | FW_RI_TPTE_VALID_G(ntohl(tpte.valid_to_pdid)), |
| 384 | G_FW_RI_TPTE_STAGKEY(ntohl(tpte.valid_to_pdid)), | 384 | FW_RI_TPTE_STAGKEY_G(ntohl(tpte.valid_to_pdid)), |
| 385 | G_FW_RI_TPTE_STAGSTATE(ntohl(tpte.valid_to_pdid)), | 385 | FW_RI_TPTE_STAGSTATE_G(ntohl(tpte.valid_to_pdid)), |
| 386 | G_FW_RI_TPTE_PDID(ntohl(tpte.valid_to_pdid)), | 386 | FW_RI_TPTE_PDID_G(ntohl(tpte.valid_to_pdid)), |
| 387 | G_FW_RI_TPTE_PERM(ntohl(tpte.locread_to_qpid)), | 387 | FW_RI_TPTE_PERM_G(ntohl(tpte.locread_to_qpid)), |
| 388 | G_FW_RI_TPTE_PS(ntohl(tpte.locread_to_qpid)), | 388 | FW_RI_TPTE_PS_G(ntohl(tpte.locread_to_qpid)), |
| 389 | ((u64)ntohl(tpte.len_hi) << 32) | ntohl(tpte.len_lo), | 389 | ((u64)ntohl(tpte.len_hi) << 32) | ntohl(tpte.len_lo), |
| 390 | ((u64)ntohl(tpte.va_hi) << 32) | ntohl(tpte.va_lo_fbo)); | 390 | ((u64)ntohl(tpte.va_hi) << 32) | ntohl(tpte.va_lo_fbo)); |
| 391 | if (cc < space) | 391 | if (cc < space) |
| @@ -50,12 +50,12 @@ static void print_tpte(struct c4iw_dev *dev, u32 stag) · 49 unmodified lines | |||
| 50 | PDBG("stag idx 0x%x valid %d key 0x%x state %d pdid %d " | 50 | PDBG("stag idx 0x%x valid %d key 0x%x state %d pdid %d " |
| 51 | "perm 0x%x ps %d len 0x%llx va 0x%llx\n", | 51 | "perm 0x%x ps %d len 0x%llx va 0x%llx\n", |
| 52 | stag & 0xffffff00, | 52 | stag & 0xffffff00, |
| 53 | G_FW_RI_TPTE_VALID(ntohl(tpte.valid_to_pdid)), | 53 | FW_RI_TPTE_VALID_G(ntohl(tpte.valid_to_pdid)), |
| 54 | G_FW_RI_TPTE_STAGKEY(ntohl(tpte.valid_to_pdid)), | 54 | FW_RI_TPTE_STAGKEY_G(ntohl(tpte.valid_to_pdid)), |
| 55 | G_FW_RI_TPTE_STAGSTATE(ntohl(tpte.valid_to_pdid)), | 55 | FW_RI_TPTE_STAGSTATE_G(ntohl(tpte.valid_to_pdid)), |
| 56 | G_FW_RI_TPTE_PDID(ntohl(tpte.valid_to_pdid)), | 56 | FW_RI_TPTE_PDID_G(ntohl(tpte.valid_to_pdid)), |
| 57 | G_FW_RI_TPTE_PERM(ntohl(tpte.locread_to_qpid)), | 57 | FW_RI_TPTE_PERM_G(ntohl(tpte.locread_to_qpid)), |
| 58 | G_FW_RI_TPTE_PS(ntohl(tpte.locread_to_qpid)), | 58 | FW_RI_TPTE_PS_G(ntohl(tpte.locread_to_qpid)), |
| 59 | ((u64)ntohl(tpte.len_hi) << 32) | ntohl(tpte.len_lo), | 59 | ((u64)ntohl(tpte.len_hi) << 32) | ntohl(tpte.len_lo), |
| 60 | ((u64)ntohl(tpte.va_hi) << 32) | ntohl(tpte.va_lo_fbo)); | 60 | ((u64)ntohl(tpte.va_hi) << 32) | ntohl(tpte.va_lo_fbo)); |
| 61 | } | 61 | } |
| @@ -86,14 +86,14 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr, · 85 unmodified lines | |||
| 86 | req->wr.wr_lo = wait ? (__force __be64)(unsigned long) &wr_wait : 0L; | 86 | req->wr.wr_lo = wait ? (__force __be64)(unsigned long) &wr_wait : 0L; |
| 87 | req->wr.wr_mid = cpu_to_be32(FW_WR_LEN16_V(DIV_ROUND_UP(wr_len, 16))); | 87 | req->wr.wr_mid = cpu_to_be32(FW_WR_LEN16_V(DIV_ROUND_UP(wr_len, 16))); |
| 88 | req->cmd = cpu_to_be32(ULPTX_CMD_V(ULP_TX_MEM_WRITE)); | 88 | req->cmd = cpu_to_be32(ULPTX_CMD_V(ULP_TX_MEM_WRITE)); |
| 89 | req->cmd |= cpu_to_be32(V_T5_ULP_MEMIO_ORDER(1)); | 89 | req->cmd |= cpu_to_be32(T5_ULP_MEMIO_ORDER_V(1)); |
| 90 | req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN_V(len>>5)); | 90 | req->dlen = cpu_to_be32(ULP_MEMIO_DATA_LEN_V(len>>5)); |
| 91 | req->len16 = cpu_to_be32(DIV_ROUND_UP(wr_len-sizeof(req->wr), 16)); | 91 | req->len16 = cpu_to_be32(DIV_ROUND_UP(wr_len-sizeof(req->wr), 16)); |
| 92 | req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR_V(addr)); | 92 | req->lock_addr = cpu_to_be32(ULP_MEMIO_ADDR_V(addr)); |
| 93 | 93 | ||
| 94 | sgl = (struct ulptx_sgl *)(req + 1); | 94 | sgl = (struct ulptx_sgl *)(req + 1); |
| 95 | sgl->cmd_nsge = cpu_to_be32(ULPTX_CMD_V(ULP_TX_SC_DSGL) | | 95 | sgl->cmd_nsge = cpu_to_be32(ULPTX_CMD_V(ULP_TX_SC_DSGL) | |
| 96 | ULPTX_NSGE(1)); | 96 | ULPTX_NSGE_V(1)); |
| 97 | sgl->len0 = cpu_to_be32(len); | 97 | sgl->len0 = cpu_to_be32(len); |
| 98 | sgl->addr0 = cpu_to_be64(data); | 98 | sgl->addr0 = cpu_to_be64(data); |
| 99 | 99 | ||
| @@ -286,17 +286,17 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, · 186 unmodified lines | |||
| 286 | if (reset_tpt_entry) | 286 | if (reset_tpt_entry) |
| 287 | memset(&tpt, 0, sizeof(tpt)); | 287 | memset(&tpt, 0, sizeof(tpt)); |
| 288 | else { | 288 | else { |
| 289 | tpt.valid_to_pdid = cpu_to_be32(F_FW_RI_TPTE_VALID | | 289 | tpt.valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F | |
| 290 | V_FW_RI_TPTE_STAGKEY((*stag & M_FW_RI_TPTE_STAGKEY)) | | 290 | FW_RI_TPTE_STAGKEY_V((*stag & FW_RI_TPTE_STAGKEY_M)) | |
| 291 | V_FW_RI_TPTE_STAGSTATE(stag_state) | | 291 | FW_RI_TPTE_STAGSTATE_V(stag_state) | |
| 292 | V_FW_RI_TPTE_STAGTYPE(type) | V_FW_RI_TPTE_PDID(pdid)); | 292 | FW_RI_TPTE_STAGTYPE_V(type) | FW_RI_TPTE_PDID_V(pdid)); |
| 293 | tpt.locread_to_qpid = cpu_to_be32(V_FW_RI_TPTE_PERM(perm) | | 293 | tpt.locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) | |
| 294 | (bind_enabled ? F_FW_RI_TPTE_MWBINDEN : 0) | | 294 | (bind_enabled ? FW_RI_TPTE_MWBINDEN_F : 0) | |
| 295 | V_FW_RI_TPTE_ADDRTYPE((zbva ? FW_RI_ZERO_BASED_TO : | 295 | FW_RI_TPTE_ADDRTYPE_V((zbva ? FW_RI_ZERO_BASED_TO : |
| 296 | FW_RI_VA_BASED_TO))| | 296 | FW_RI_VA_BASED_TO))| |
| 297 | V_FW_RI_TPTE_PS(page_size)); | 297 | FW_RI_TPTE_PS_V(page_size)); |
| 298 | tpt.nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32( | 298 | tpt.nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32( |
| 299 | V_FW_RI_TPTE_PBLADDR(PBL_OFF(rdev, pbl_addr)>>3)); | 299 | FW_RI_TPTE_PBLADDR_V(PBL_OFF(rdev, pbl_addr)>>3)); |
| 300 | tpt.len_lo = cpu_to_be32((u32)(len & 0xffffffffUL)); | 300 | tpt.len_lo = cpu_to_be32((u32)(len & 0xffffffffUL)); |
| 301 | tpt.va_hi = cpu_to_be32((u32)(to >> 32)); | 301 | tpt.va_hi = cpu_to_be32((u32)(to >> 32)); |
| 302 | tpt.va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL)); | 302 | tpt.va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL)); |
| @@ -272,7 +272,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 271 unmodified lines | |||
| 272 | memset(res_wr, 0, wr_len); | 272 | memset(res_wr, 0, wr_len); |
| 273 | res_wr->op_nres = cpu_to_be32( | 273 | res_wr->op_nres = cpu_to_be32( |
| 274 | FW_WR_OP_V(FW_RI_RES_WR) | | 274 | FW_WR_OP_V(FW_RI_RES_WR) | |
| 275 | V_FW_RI_RES_WR_NRES(2) | | 275 | FW_RI_RES_WR_NRES_V(2) | |
| 276 | FW_WR_COMPL_F); | 276 | FW_WR_COMPL_F); |
| 277 | res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); | 277 | res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); |
| 278 | res_wr->cookie = (unsigned long) &wr_wait; | 278 | res_wr->cookie = (unsigned long) &wr_wait; |
| @@ -287,19 +287,19 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 8 unmodified lines | |||
| 287 | rdev->hw_queue.t4_eq_status_entries; | 287 | rdev->hw_queue.t4_eq_status_entries; |
| 288 | 288 | ||
| 289 | res->u.sqrq.fetchszm_to_iqid = cpu_to_be32( | 289 | res->u.sqrq.fetchszm_to_iqid = cpu_to_be32( |
| 290 | V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */ | 290 | FW_RI_RES_WR_HOSTFCMODE_V(0) | /* no host cidx updates */ |
| 291 | V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */ | 291 | FW_RI_RES_WR_CPRIO_V(0) | /* don't keep in chip cache */ |
| 292 | V_FW_RI_RES_WR_PCIECHN(0) | /* set by uP at ri_init time */ | 292 | FW_RI_RES_WR_PCIECHN_V(0) | /* set by uP at ri_init time */ |
| 293 | (t4_sq_onchip(&wq->sq) ? F_FW_RI_RES_WR_ONCHIP : 0) | | 293 | (t4_sq_onchip(&wq->sq) ? FW_RI_RES_WR_ONCHIP_F : 0) | |
| 294 | V_FW_RI_RES_WR_IQID(scq->cqid)); | 294 | FW_RI_RES_WR_IQID_V(scq->cqid)); |
| 295 | res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( | 295 | res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( |
| 296 | V_FW_RI_RES_WR_DCAEN(0) | | 296 | FW_RI_RES_WR_DCAEN_V(0) | |
| 297 | V_FW_RI_RES_WR_DCACPU(0) | | 297 | FW_RI_RES_WR_DCACPU_V(0) | |
| 298 | V_FW_RI_RES_WR_FBMIN(2) | | 298 | FW_RI_RES_WR_FBMIN_V(2) | |
| 299 | V_FW_RI_RES_WR_FBMAX(2) | | 299 | FW_RI_RES_WR_FBMAX_V(2) | |
| 300 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | | 300 | FW_RI_RES_WR_CIDXFTHRESHO_V(0) | |
| 301 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | | 301 | FW_RI_RES_WR_CIDXFTHRESH_V(0) | |
| 302 | V_FW_RI_RES_WR_EQSIZE(eqsize)); | 302 | FW_RI_RES_WR_EQSIZE_V(eqsize)); |
| 303 | res->u.sqrq.eqid = cpu_to_be32(wq->sq.qid); | 303 | res->u.sqrq.eqid = cpu_to_be32(wq->sq.qid); |
| 304 | res->u.sqrq.eqaddr = cpu_to_be64(wq->sq.dma_addr); | 304 | res->u.sqrq.eqaddr = cpu_to_be64(wq->sq.dma_addr); |
| 305 | res++; | 305 | res++; |
| @@ -312,18 +312,18 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 6 unmodified lines | |||
| 312 | eqsize = wq->rq.size * T4_RQ_NUM_SLOTS + | 312 | eqsize = wq->rq.size * T4_RQ_NUM_SLOTS + |
| 313 | rdev->hw_queue.t4_eq_status_entries; | 313 | rdev->hw_queue.t4_eq_status_entries; |
| 314 | res->u.sqrq.fetchszm_to_iqid = cpu_to_be32( | 314 | res->u.sqrq.fetchszm_to_iqid = cpu_to_be32( |
| 315 | V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */ | 315 | FW_RI_RES_WR_HOSTFCMODE_V(0) | /* no host cidx updates */ |
| 316 | V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */ | 316 | FW_RI_RES_WR_CPRIO_V(0) | /* don't keep in chip cache */ |
| 317 | V_FW_RI_RES_WR_PCIECHN(0) | /* set by uP at ri_init time */ | 317 | FW_RI_RES_WR_PCIECHN_V(0) | /* set by uP at ri_init time */ |
| 318 | V_FW_RI_RES_WR_IQID(rcq->cqid)); | 318 | FW_RI_RES_WR_IQID_V(rcq->cqid)); |
| 319 | res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( | 319 | res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( |
| 320 | V_FW_RI_RES_WR_DCAEN(0) | | 320 | FW_RI_RES_WR_DCAEN_V(0) | |
| 321 | V_FW_RI_RES_WR_DCACPU(0) | | 321 | FW_RI_RES_WR_DCACPU_V(0) | |
| 322 | V_FW_RI_RES_WR_FBMIN(2) | | 322 | FW_RI_RES_WR_FBMIN_V(2) | |
| 323 | V_FW_RI_RES_WR_FBMAX(2) | | 323 | FW_RI_RES_WR_FBMAX_V(2) | |
| 324 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | | 324 | FW_RI_RES_WR_CIDXFTHRESHO_V(0) | |
| 325 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | | 325 | FW_RI_RES_WR_CIDXFTHRESH_V(0) | |
| 326 | V_FW_RI_RES_WR_EQSIZE(eqsize)); | 326 | FW_RI_RES_WR_EQSIZE_V(eqsize)); |
| 327 | res->u.sqrq.eqid = cpu_to_be32(wq->rq.qid); | 327 | res->u.sqrq.eqid = cpu_to_be32(wq->rq.qid); |
| 328 | res->u.sqrq.eqaddr = cpu_to_be64(wq->rq.dma_addr); | 328 | res->u.sqrq.eqaddr = cpu_to_be64(wq->rq.dma_addr); |
| 329 | 329 | ||
| @@ -444,19 +444,19 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, · 114 unmodified lines | |||
| 444 | case IB_WR_SEND: | 444 | case IB_WR_SEND: |
| 445 | if (wr->send_flags & IB_SEND_SOLICITED) | 445 | if (wr->send_flags & IB_SEND_SOLICITED) |
| 446 | wqe->send.sendop_pkd = cpu_to_be32( | 446 | wqe->send.sendop_pkd = cpu_to_be32( |
| 447 | V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND_WITH_SE)); | 447 | FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND_WITH_SE)); |
| 448 | else | 448 | else |
| 449 | wqe->send.sendop_pkd = cpu_to_be32( | 449 | wqe->send.sendop_pkd = cpu_to_be32( |
| 450 | V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND)); | 450 | FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND)); |
| 451 | wqe->send.stag_inv = 0; | 451 | wqe->send.stag_inv = 0; |
| 452 | break; | 452 | break; |
| 453 | case IB_WR_SEND_WITH_INV: | 453 | case IB_WR_SEND_WITH_INV: |
| 454 | if (wr->send_flags & IB_SEND_SOLICITED) | 454 | if (wr->send_flags & IB_SEND_SOLICITED) |
| 455 | wqe->send.sendop_pkd = cpu_to_be32( | 455 | wqe->send.sendop_pkd = cpu_to_be32( |
| 456 | V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND_WITH_SE_INV)); | 456 | FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND_WITH_SE_INV)); |
| 457 | else | 457 | else |
| 458 | wqe->send.sendop_pkd = cpu_to_be32( | 458 | wqe->send.sendop_pkd = cpu_to_be32( |
| 459 | V_FW_RI_SEND_WR_SENDOP(FW_RI_SEND_WITH_INV)); | 459 | FW_RI_SEND_WR_SENDOP_V(FW_RI_SEND_WITH_INV)); |
| 460 | wqe->send.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey); | 460 | wqe->send.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey); |
| 461 | break; | 461 | break; |
| 462 | 462 | ||
| @@ -1283,8 +1283,8 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw_qp *qhp) · 820 unmodified lines | |||
| 1283 | 1283 | ||
| 1284 | wqe->u.init.type = FW_RI_TYPE_INIT; | 1284 | wqe->u.init.type = FW_RI_TYPE_INIT; |
| 1285 | wqe->u.init.mpareqbit_p2ptype = | 1285 | wqe->u.init.mpareqbit_p2ptype = |
| 1286 | V_FW_RI_WR_MPAREQBIT(qhp->attr.mpa_attr.initiator) | | 1286 | FW_RI_WR_MPAREQBIT_V(qhp->attr.mpa_attr.initiator) | |
| 1287 | V_FW_RI_WR_P2PTYPE(qhp->attr.mpa_attr.p2p_type); | 1287 | FW_RI_WR_P2PTYPE_V(qhp->attr.mpa_attr.p2p_type); |
| 1288 | wqe->u.init.mpa_attrs = FW_RI_MPA_IETF_ENABLE; | 1288 | wqe->u.init.mpa_attrs = FW_RI_MPA_IETF_ENABLE; |
| 1289 | if (qhp->attr.mpa_attr.recv_marker_enabled) | 1289 | if (qhp->attr.mpa_attr.recv_marker_enabled) |
| 1290 | wqe->u.init.mpa_attrs |= FW_RI_MPA_RX_MARKER_ENABLE; | 1290 | wqe->u.init.mpa_attrs |= FW_RI_MPA_RX_MARKER_ENABLE; |
| @@ -1776,7 +1776,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, · 485 unmodified lines | |||
| 1776 | if (mm5) { | 1776 | if (mm5) { |
| 1777 | mm5->key = uresp.ma_sync_key; | 1777 | mm5->key = uresp.ma_sync_key; |
| 1778 | mm5->addr = (pci_resource_start(rhp->rdev.lldi.pdev, 0) | 1778 | mm5->addr = (pci_resource_start(rhp->rdev.lldi.pdev, 0) |
| 1779 | + A_PCIE_MA_SYNC) & PAGE_MASK; | 1779 | + PCIE_MA_SYNC_A) & PAGE_MASK; |
| 1780 | mm5->len = PAGE_SIZE; | 1780 | mm5->len = PAGE_SIZE; |
| 1781 | insert_mmap(ucontext, mm5); | 1781 | insert_mmap(ucontext, mm5); |
| 1782 | } | 1782 | } |
| @@ -41,7 +41,7 @@ · 40 unmodified lines | |||
| 41 | #define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */ | 41 | #define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */ |
| 42 | #define T4_STAG_UNSET 0xffffffff | 42 | #define T4_STAG_UNSET 0xffffffff |
| 43 | #define T4_FW_MAJ 0 | 43 | #define T4_FW_MAJ 0 |
| 44 | #define A_PCIE_MA_SYNC 0x30b4 | 44 | #define PCIE_MA_SYNC_A 0x30b4 |
| 45 | 45 | ||
| 46 | struct t4_status_page { | 46 | struct t4_status_page { |
| 47 | __be32 rsvd1; /* flit 0 - hw owns */ | 47 | __be32 rsvd1; /* flit 0 - hw owns */ |
| @@ -184,44 +184,44 @@ struct t4_cqe { · 136 unmodified lines | |||
| 184 | 184 | ||
| 185 | /* macros for flit 0 of the cqe */ | 185 | /* macros for flit 0 of the cqe */ |
| 186 | 186 | ||
| 187 | #define S_CQE_QPID 12 | 187 | #define CQE_QPID_S 12 |
| 188 | #define M_CQE_QPID 0xFFFFF | 188 | #define CQE_QPID_M 0xFFFFF |
| 189 | #define G_CQE_QPID(x) ((((x) >> S_CQE_QPID)) & M_CQE_QPID) | 189 | #define CQE_QPID_G(x) ((((x) >> CQE_QPID_S)) & CQE_QPID_M) |
| 190 | #define V_CQE_QPID(x) ((x)<<S_CQE_QPID) | 190 | #define CQE_QPID_V(x) ((x)<<CQE_QPID_S) |
| 191 | 191 | ||
| 192 | #define S_CQE_SWCQE 11 | 192 | #define CQE_SWCQE_S 11 |
| 193 | #define M_CQE_SWCQE 0x1 | 193 | #define CQE_SWCQE_M 0x1 |
| 194 | #define G_CQE_SWCQE(x) ((((x) >> S_CQE_SWCQE)) & M_CQE_SWCQE) | 194 | #define CQE_SWCQE_G(x) ((((x) >> CQE_SWCQE_S)) & CQE_SWCQE_M) |
| 195 | #define V_CQE_SWCQE(x) ((x)<<S_CQE_SWCQE) | 195 | #define CQE_SWCQE_V(x) ((x)<<CQE_SWCQE_S) |
| 196 | 196 | ||
| 197 | #define S_CQE_STATUS 5 | 197 | #define CQE_STATUS_S 5 |
| 198 | #define M_CQE_STATUS 0x1F | 198 | #define CQE_STATUS_M 0x1F |
| 199 | #define G_CQE_STATUS(x) ((((x) >> S_CQE_STATUS)) & M_CQE_STATUS) | 199 | #define CQE_STATUS_G(x) ((((x) >> CQE_STATUS_S)) & CQE_STATUS_M) |
| 200 | #define V_CQE_STATUS(x) ((x)<<S_CQE_STATUS) | 200 | #define CQE_STATUS_V(x) ((x)<<CQE_STATUS_S) |
| 201 | 201 | ||
| 202 | #define S_CQE_TYPE 4 | 202 | #define CQE_TYPE_S 4 |
| 203 | #define M_CQE_TYPE 0x1 | 203 | #define CQE_TYPE_M 0x1 |
| 204 | #define G_CQE_TYPE(x) ((((x) >> S_CQE_TYPE)) & M_CQE_TYPE) | 204 | #define CQE_TYPE_G(x) ((((x) >> CQE_TYPE_S)) & CQE_TYPE_M) |
| 205 | #define V_CQE_TYPE(x) ((x)<<S_CQE_TYPE) | 205 | #define CQE_TYPE_V(x) ((x)<<CQE_TYPE_S) |
| 206 | 206 | ||
| 207 | #define S_CQE_OPCODE 0 | 207 | #define CQE_OPCODE_S 0 |
| 208 | #define M_CQE_OPCODE 0xF | 208 | #define CQE_OPCODE_M 0xF |
| 209 | #define G_CQE_OPCODE(x) ((((x) >> S_CQE_OPCODE)) & M_CQE_OPCODE) | 209 | #define CQE_OPCODE_G(x) ((((x) >> CQE_OPCODE_S)) & CQE_OPCODE_M) |
| 210 | #define V_CQE_OPCODE(x) ((x)<<S_CQE_OPCODE) | 210 | #define CQE_OPCODE_V(x) ((x)<<CQE_OPCODE_S) |
| 211 | 211 | ||
| 212 | #define SW_CQE(x) (G_CQE_SWCQE(be32_to_cpu((x)->header))) | 212 | #define SW_CQE(x) (CQE_SWCQE_G(be32_to_cpu((x)->header))) |
| 213 | #define CQE_QPID(x) (G_CQE_QPID(be32_to_cpu((x)->header))) | 213 | #define CQE_QPID(x) (CQE_QPID_G(be32_to_cpu((x)->header))) |
| 214 | #define CQE_TYPE(x) (G_CQE_TYPE(be32_to_cpu((x)->header))) | 214 | #define CQE_TYPE(x) (CQE_TYPE_G(be32_to_cpu((x)->header))) |
| 215 | #define SQ_TYPE(x) (CQE_TYPE((x))) | 215 | #define SQ_TYPE(x) (CQE_TYPE((x))) |
| 216 | #define RQ_TYPE(x) (!CQE_TYPE((x))) | 216 | #define RQ_TYPE(x) (!CQE_TYPE((x))) |
| 217 | #define CQE_STATUS(x) (G_CQE_STATUS(be32_to_cpu((x)->header))) | 217 | #define CQE_STATUS(x) (CQE_STATUS_G(be32_to_cpu((x)->header))) |
| 218 | #define CQE_OPCODE(x) (G_CQE_OPCODE(be32_to_cpu((x)->header))) | 218 | #define CQE_OPCODE(x) (CQE_OPCODE_G(be32_to_cpu((x)->header))) |
| 219 | 219 | ||
| 220 | #define CQE_SEND_OPCODE(x)( \ | 220 | #define CQE_SEND_OPCODE(x)( \ |
| 221 | (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND) || \ | 221 | (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND) || \ |
| 222 | (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE) || \ | 222 | (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE) || \ |
| 223 | (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_INV) || \ | 223 | (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_INV) || \ |
| 224 | (G_CQE_OPCODE(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE_INV)) | 224 | (CQE_OPCODE_G(be32_to_cpu((x)->header)) == FW_RI_SEND_WITH_SE_INV)) |
| 225 | 225 | ||
| 226 | #define CQE_LEN(x) (be32_to_cpu((x)->len)) | 226 | #define CQE_LEN(x) (be32_to_cpu((x)->len)) |
| 227 | 227 | ||
| @@ -237,25 +237,25 @@ struct t4_cqe { · 9 unmodified lines | |||
| 237 | #define CQE_WRID_LOW(x) (be32_to_cpu((x)->u.gen.wrid_low)) | 237 | #define CQE_WRID_LOW(x) (be32_to_cpu((x)->u.gen.wrid_low)) |
| 238 | 238 | ||
| 239 | /* macros for flit 3 of the cqe */ | 239 | /* macros for flit 3 of the cqe */ |
| 240 | #define S_CQE_GENBIT 63 | 240 | #define CQE_GENBIT_S 63 |
| 241 | #define M_CQE_GENBIT 0x1 | 241 | #define CQE_GENBIT_M 0x1 |
| 242 | #define G_CQE_GENBIT(x) (((x) >> S_CQE_GENBIT) & M_CQE_GENBIT) | 242 | #define CQE_GENBIT_G(x) (((x) >> CQE_GENBIT_S) & CQE_GENBIT_M) |
| 243 | #define V_CQE_GENBIT(x) ((x)<<S_CQE_GENBIT) | 243 | #define CQE_GENBIT_V(x) ((x)<<CQE_GENBIT_S) |
| 244 | 244 | ||
| 245 | #define S_CQE_OVFBIT 62 | 245 | #define CQE_OVFBIT_S 62 |
| 246 | #define M_CQE_OVFBIT 0x1 | 246 | #define CQE_OVFBIT_M 0x1 |
| 247 | #define G_CQE_OVFBIT(x) ((((x) >> S_CQE_OVFBIT)) & M_CQE_OVFBIT) | 247 | #define CQE_OVFBIT_G(x) ((((x) >> CQE_OVFBIT_S)) & CQE_OVFBIT_M) |
| 248 | 248 | ||
| 249 | #define S_CQE_IQTYPE 60 | 249 | #define CQE_IQTYPE_S 60 |
| 250 | #define M_CQE_IQTYPE 0x3 | 250 | #define CQE_IQTYPE_M 0x3 |
| 251 | #define G_CQE_IQTYPE(x) ((((x) >> S_CQE_IQTYPE)) & M_CQE_IQTYPE) | 251 | #define CQE_IQTYPE_G(x) ((((x) >> CQE_IQTYPE_S)) & CQE_IQTYPE_M) |
| 252 | 252 | ||
| 253 | #define M_CQE_TS 0x0fffffffffffffffULL | 253 | #define CQE_TS_M 0x0fffffffffffffffULL |
| 254 | #define G_CQE_TS(x) ((x) & M_CQE_TS) | 254 | #define CQE_TS_G(x) ((x) & CQE_TS_M) |
| 255 | 255 | ||
| 256 | #define CQE_OVFBIT(x) ((unsigned)G_CQE_OVFBIT(be64_to_cpu((x)->bits_type_ts))) | 256 | #define CQE_OVFBIT(x) ((unsigned)CQE_OVFBIT_G(be64_to_cpu((x)->bits_type_ts))) |
| 257 | #define CQE_GENBIT(x) ((unsigned)G_CQE_GENBIT(be64_to_cpu((x)->bits_type_ts))) | 257 | #define CQE_GENBIT(x) ((unsigned)CQE_GENBIT_G(be64_to_cpu((x)->bits_type_ts))) |
| 258 | #define CQE_TS(x) (G_CQE_TS(be64_to_cpu((x)->bits_type_ts))) | 258 | #define CQE_TS(x) (CQE_TS_G(be64_to_cpu((x)->bits_type_ts))) |
| 259 | 259 | ||
| 260 | struct t4_swsqe { | 260 | struct t4_swsqe { |
| 261 | u64 wr_id; | 261 | u64 wr_id; |
| @@ -465,14 +465,14 @@ static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc, u8 t5, · 203 unmodified lines | |||
| 465 | } else { | 465 | } else { |
| 466 | PDBG("%s: DB wq->sq.pidx = %d\n", | 466 | PDBG("%s: DB wq->sq.pidx = %d\n", |
| 467 | __func__, wq->sq.pidx); | 467 | __func__, wq->sq.pidx); |
| 468 | writel(PIDX_T5(inc), wq->sq.udb); | 468 | writel(PIDX_T5_V(inc), wq->sq.udb); |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | /* Flush user doorbell area writes. */ | 471 | /* Flush user doorbell area writes. */ |
| 472 | wmb(); | 472 | wmb(); |
| 473 | return; | 473 | return; |
| 474 | } | 474 | } |
| 475 | writel(QID(wq->sq.qid) | PIDX(inc), wq->db); | 475 | writel(QID_V(wq->sq.qid) | PIDX_V(inc), wq->db); |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, | 478 | static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, |
| @@ -489,14 +489,14 @@ static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, · 10 unmodified lines | |||
| 489 | } else { | 489 | } else { |
| 490 | PDBG("%s: DB wq->rq.pidx = %d\n", | 490 | PDBG("%s: DB wq->rq.pidx = %d\n", |
| 491 | __func__, wq->rq.pidx); | 491 | __func__, wq->rq.pidx); |
| 492 | writel(PIDX_T5(inc), wq->rq.udb); | 492 | writel(PIDX_T5_V(inc), wq->rq.udb); |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | /* Flush user doorbell area writes. */ | 495 | /* Flush user doorbell area writes. */ |
| 496 | wmb(); | 496 | wmb(); |
| 497 | return; | 497 | return; |
| 498 | } | 498 | } |
| 499 | writel(QID(wq->rq.qid) | PIDX(inc), wq->db); | 499 | writel(QID_V(wq->rq.qid) | PIDX_V(inc), wq->db); |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | static inline int t4_wq_in_error(struct t4_wq *wq) | 502 | static inline int t4_wq_in_error(struct t4_wq *wq) |
| @@ -561,14 +561,14 @@ static inline int t4_arm_cq(struct t4_cq *cq, int se) · 58 unmodified lines | |||
| 561 | u32 val; | 561 | u32 val; |
| 562 | 562 | ||
| 563 | set_bit(CQ_ARMED, &cq->flags); | 563 | set_bit(CQ_ARMED, &cq->flags); |
| 564 | while (cq->cidx_inc > CIDXINC_MASK) { | 564 | while (cq->cidx_inc > CIDXINC_M) { |
| 565 | val = SEINTARM(0) | CIDXINC(CIDXINC_MASK) | TIMERREG(7) | | 565 | val = SEINTARM_V(0) | CIDXINC_V(CIDXINC_M) | TIMERREG_V(7) | |
| 566 | INGRESSQID(cq->cqid); | 566 | INGRESSQID_V(cq->cqid); |
| 567 | writel(val, cq->gts); | 567 | writel(val, cq->gts); |
| 568 | cq->cidx_inc -= CIDXINC_MASK; | 568 | cq->cidx_inc -= CIDXINC_M; |
| 569 | } | 569 | } |
| 570 | val = SEINTARM(se) | CIDXINC(cq->cidx_inc) | TIMERREG(6) | | 570 | val = SEINTARM_V(se) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(6) | |
| 571 | INGRESSQID(cq->cqid); | 571 | INGRESSQID_V(cq->cqid); |
| 572 | writel(val, cq->gts); | 572 | writel(val, cq->gts); |
| 573 | cq->cidx_inc = 0; | 573 | cq->cidx_inc = 0; |
| 574 | return 0; | 574 | return 0; |
| @@ -597,11 +597,11 @@ static inline void t4_swcq_consume(struct t4_cq *cq) · 22 unmodified lines | |||
| 597 | static inline void t4_hwcq_consume(struct t4_cq *cq) | 597 | static inline void t4_hwcq_consume(struct t4_cq *cq) |
| 598 | { | 598 | { |
| 599 | cq->bits_type_ts = cq->queue[cq->cidx].bits_type_ts; | 599 | cq->bits_type_ts = cq->queue[cq->cidx].bits_type_ts; |
| 600 | if (++cq->cidx_inc == (cq->size >> 4) || cq->cidx_inc == CIDXINC_MASK) { | 600 | if (++cq->cidx_inc == (cq->size >> 4) || cq->cidx_inc == CIDXINC_M) { |
| 601 | u32 val; | 601 | u32 val; |
| 602 | 602 | ||
| 603 | val = SEINTARM(0) | CIDXINC(cq->cidx_inc) | TIMERREG(7) | | 603 | val = SEINTARM_V(0) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(7) | |
| 604 | INGRESSQID(cq->cqid); | 604 | INGRESSQID_V(cq->cqid); |
| 605 | writel(val, cq->gts); | 605 | writel(val, cq->gts); |
| 606 | cq->cidx_inc = 0; | 606 | cq->cidx_inc = 0; |
| 607 | } | 607 | } |
| @@ -162,102 +162,102 @@ struct fw_ri_tpte { · 161 unmodified lines | |||
| 162 | __be32 len_hi; | 162 | __be32 len_hi; |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | #define S_FW_RI_TPTE_VALID 31 | 165 | #define FW_RI_TPTE_VALID_S 31 |
| 166 | #define M_FW_RI_TPTE_VALID 0x1 | 166 | #define FW_RI_TPTE_VALID_M 0x1 |
| 167 | #define V_FW_RI_TPTE_VALID(x) ((x) << S_FW_RI_TPTE_VALID) | 167 | #define FW_RI_TPTE_VALID_V(x) ((x) << FW_RI_TPTE_VALID_S) |
| 168 | #define G_FW_RI_TPTE_VALID(x) \ | 168 | #define FW_RI_TPTE_VALID_G(x) \ |
| 169 | (((x) >> S_FW_RI_TPTE_VALID) & M_FW_RI_TPTE_VALID) | 169 | (((x) >> FW_RI_TPTE_VALID_S) & FW_RI_TPTE_VALID_M) |
| 170 | #define F_FW_RI_TPTE_VALID V_FW_RI_TPTE_VALID(1U) | 170 | #define FW_RI_TPTE_VALID_F FW_RI_TPTE_VALID_V(1U) |
| 171 | 171 | ||
| 172 | #define S_FW_RI_TPTE_STAGKEY 23 | 172 | #define FW_RI_TPTE_STAGKEY_S 23 |
| 173 | #define M_FW_RI_TPTE_STAGKEY 0xff | 173 | #define FW_RI_TPTE_STAGKEY_M 0xff |
| 174 | #define V_FW_RI_TPTE_STAGKEY(x) ((x) << S_FW_RI_TPTE_STAGKEY) | 174 | #define FW_RI_TPTE_STAGKEY_V(x) ((x) << FW_RI_TPTE_STAGKEY_S) |
| 175 | #define G_FW_RI_TPTE_STAGKEY(x) \ | 175 | #define FW_RI_TPTE_STAGKEY_G(x) \ |
| 176 | (((x) >> S_FW_RI_TPTE_STAGKEY) & M_FW_RI_TPTE_STAGKEY) | 176 | (((x) >> FW_RI_TPTE_STAGKEY_S) & FW_RI_TPTE_STAGKEY_M) |
| 177 | 177 | ||
| 178 | #define S_FW_RI_TPTE_STAGSTATE 22 | 178 | #define FW_RI_TPTE_STAGSTATE_S 22 |
| 179 | #define M_FW_RI_TPTE_STAGSTATE 0x1 | 179 | #define FW_RI_TPTE_STAGSTATE_M 0x1 |
| 180 | #define V_FW_RI_TPTE_STAGSTATE(x) ((x) << S_FW_RI_TPTE_STAGSTATE) | 180 | #define FW_RI_TPTE_STAGSTATE_V(x) ((x) << FW_RI_TPTE_STAGSTATE_S) |
| 181 | #define G_FW_RI_TPTE_STAGSTATE(x) \ | 181 | #define FW_RI_TPTE_STAGSTATE_G(x) \ |
| 182 | (((x) >> S_FW_RI_TPTE_STAGSTATE) & M_FW_RI_TPTE_STAGSTATE) | 182 | (((x) >> FW_RI_TPTE_STAGSTATE_S) & FW_RI_TPTE_STAGSTATE_M) |
| 183 | #define F_FW_RI_TPTE_STAGSTATE V_FW_RI_TPTE_STAGSTATE(1U) | 183 | #define FW_RI_TPTE_STAGSTATE_F FW_RI_TPTE_STAGSTATE_V(1U) |
| 184 | 184 | ||
| 185 | #define S_FW_RI_TPTE_STAGTYPE 20 | 185 | #define FW_RI_TPTE_STAGTYPE_S 20 |
| 186 | #define M_FW_RI_TPTE_STAGTYPE 0x3 | 186 | #define FW_RI_TPTE_STAGTYPE_M 0x3 |
| 187 | #define V_FW_RI_TPTE_STAGTYPE(x) ((x) << S_FW_RI_TPTE_STAGTYPE) | 187 | #define FW_RI_TPTE_STAGTYPE_V(x) ((x) << FW_RI_TPTE_STAGTYPE_S) |
| 188 | #define G_FW_RI_TPTE_STAGTYPE(x) \ | 188 | #define FW_RI_TPTE_STAGTYPE_G(x) \ |
| 189 | (((x) >> S_FW_RI_TPTE_STAGTYPE) & M_FW_RI_TPTE_STAGTYPE) | 189 | (((x) >> FW_RI_TPTE_STAGTYPE_S) & FW_RI_TPTE_STAGTYPE_M) |
| 190 | 190 | ||
| 191 | #define S_FW_RI_TPTE_PDID 0 | 191 | #define FW_RI_TPTE_PDID_S 0 |
| 192 | #define M_FW_RI_TPTE_PDID 0xfffff | 192 | #define FW_RI_TPTE_PDID_M 0xfffff |
| 193 | #define V_FW_RI_TPTE_PDID(x) ((x) << S_FW_RI_TPTE_PDID) | 193 | #define FW_RI_TPTE_PDID_V(x) ((x) << FW_RI_TPTE_PDID_S) |
| 194 | #define G_FW_RI_TPTE_PDID(x) \ | 194 | #define FW_RI_TPTE_PDID_G(x) \ |
| 195 | (((x) >> S_FW_RI_TPTE_PDID) & M_FW_RI_TPTE_PDID) | 195 | (((x) >> FW_RI_TPTE_PDID_S) & FW_RI_TPTE_PDID_M) |
| 196 | 196 | ||
| 197 | #define S_FW_RI_TPTE_PERM 28 | 197 | #define FW_RI_TPTE_PERM_S 28 |
| 198 | #define M_FW_RI_TPTE_PERM 0xf | 198 | #define FW_RI_TPTE_PERM_M 0xf |
| 199 | #define V_FW_RI_TPTE_PERM(x) ((x) << S_FW_RI_TPTE_PERM) | 199 | #define FW_RI_TPTE_PERM_V(x) ((x) << FW_RI_TPTE_PERM_S) |
| 200 | #define G_FW_RI_TPTE_PERM(x) \ | 200 | #define FW_RI_TPTE_PERM_G(x) \ |
| 201 | (((x) >> S_FW_RI_TPTE_PERM) & M_FW_RI_TPTE_PERM) | 201 | (((x) >> FW_RI_TPTE_PERM_S) & FW_RI_TPTE_PERM_M) |
| 202 | 202 | ||
| 203 | #define S_FW_RI_TPTE_REMINVDIS 27 | 203 | #define FW_RI_TPTE_REMINVDIS_S 27 |
| 204 | #define M_FW_RI_TPTE_REMINVDIS 0x1 | 204 | #define FW_RI_TPTE_REMINVDIS_M 0x1 |
| 205 | #define V_FW_RI_TPTE_REMINVDIS(x) ((x) << S_FW_RI_TPTE_REMINVDIS) | 205 | #define FW_RI_TPTE_REMINVDIS_V(x) ((x) << FW_RI_TPTE_REMINVDIS_S) |
| 206 | #define G_FW_RI_TPTE_REMINVDIS(x) \ | 206 | #define FW_RI_TPTE_REMINVDIS_G(x) \ |
| 207 | (((x) >> S_FW_RI_TPTE_REMINVDIS) & M_FW_RI_TPTE_REMINVDIS) | 207 | (((x) >> FW_RI_TPTE_REMINVDIS_S) & FW_RI_TPTE_REMINVDIS_M) |
| 208 | #define F_FW_RI_TPTE_REMINVDIS V_FW_RI_TPTE_REMINVDIS(1U) | 208 | #define FW_RI_TPTE_REMINVDIS_F FW_RI_TPTE_REMINVDIS_V(1U) |
| 209 | 209 | ||
| 210 | #define S_FW_RI_TPTE_ADDRTYPE 26 | 210 | #define FW_RI_TPTE_ADDRTYPE_S 26 |
| 211 | #define M_FW_RI_TPTE_ADDRTYPE 1 | 211 | #define FW_RI_TPTE_ADDRTYPE_M 1 |
| 212 | #define V_FW_RI_TPTE_ADDRTYPE(x) ((x) << S_FW_RI_TPTE_ADDRTYPE) | 212 | #define FW_RI_TPTE_ADDRTYPE_V(x) ((x) << FW_RI_TPTE_ADDRTYPE_S) |
| 213 | #define G_FW_RI_TPTE_ADDRTYPE(x) \ | 213 | #define FW_RI_TPTE_ADDRTYPE_G(x) \ |
| 214 | (((x) >> S_FW_RI_TPTE_ADDRTYPE) & M_FW_RI_TPTE_ADDRTYPE) | 214 | (((x) >> FW_RI_TPTE_ADDRTYPE_S) & FW_RI_TPTE_ADDRTYPE_M) |
| 215 | #define F_FW_RI_TPTE_ADDRTYPE V_FW_RI_TPTE_ADDRTYPE(1U) | 215 | #define FW_RI_TPTE_ADDRTYPE_F FW_RI_TPTE_ADDRTYPE_V(1U) |
| 216 | 216 | ||
| 217 | #define S_FW_RI_TPTE_MWBINDEN 25 | 217 | #define FW_RI_TPTE_MWBINDEN_S 25 |
| 218 | #define M_FW_RI_TPTE_MWBINDEN 0x1 | 218 | #define FW_RI_TPTE_MWBINDEN_M 0x1 |
| 219 | #define V_FW_RI_TPTE_MWBINDEN(x) ((x) << S_FW_RI_TPTE_MWBINDEN) | 219 | #define FW_RI_TPTE_MWBINDEN_V(x) ((x) << FW_RI_TPTE_MWBINDEN_S) |
| 220 | #define G_FW_RI_TPTE_MWBINDEN(x) \ | 220 | #define FW_RI_TPTE_MWBINDEN_G(x) \ |
| 221 | (((x) >> S_FW_RI_TPTE_MWBINDEN) & M_FW_RI_TPTE_MWBINDEN) | 221 | (((x) >> FW_RI_TPTE_MWBINDEN_S) & FW_RI_TPTE_MWBINDEN_M) |
| 222 | #define F_FW_RI_TPTE_MWBINDEN V_FW_RI_TPTE_MWBINDEN(1U) | 222 | #define FW_RI_TPTE_MWBINDEN_F FW_RI_TPTE_MWBINDEN_V(1U) |
| 223 | 223 | ||
| 224 | #define S_FW_RI_TPTE_PS 20 | 224 | #define FW_RI_TPTE_PS_S 20 |
| 225 | #define M_FW_RI_TPTE_PS 0x1f | 225 | #define FW_RI_TPTE_PS_M 0x1f |
| 226 | #define V_FW_RI_TPTE_PS(x) ((x) << S_FW_RI_TPTE_PS) | 226 | #define FW_RI_TPTE_PS_V(x) ((x) << FW_RI_TPTE_PS_S) |
| 227 | #define G_FW_RI_TPTE_PS(x) \ | 227 | #define FW_RI_TPTE_PS_G(x) \ |
| 228 | (((x) >> S_FW_RI_TPTE_PS) & M_FW_RI_TPTE_PS) | 228 | (((x) >> FW_RI_TPTE_PS_S) & FW_RI_TPTE_PS_M) |
| 229 | 229 | ||
| 230 | #define S_FW_RI_TPTE_QPID 0 | 230 | #define FW_RI_TPTE_QPID_S 0 |
| 231 | #define M_FW_RI_TPTE_QPID 0xfffff | 231 | #define FW_RI_TPTE_QPID_M 0xfffff |
| 232 | #define V_FW_RI_TPTE_QPID(x) ((x) << S_FW_RI_TPTE_QPID) | 232 | #define FW_RI_TPTE_QPID_V(x) ((x) << FW_RI_TPTE_QPID_S) |
| 233 | #define G_FW_RI_TPTE_QPID(x) \ | 233 | #define FW_RI_TPTE_QPID_G(x) \ |
| 234 | (((x) >> S_FW_RI_TPTE_QPID) & M_FW_RI_TPTE_QPID) | 234 | (((x) >> FW_RI_TPTE_QPID_S) & FW_RI_TPTE_QPID_M) |
| 235 | 235 | ||
| 236 | #define S_FW_RI_TPTE_NOSNOOP 30 | 236 | #define FW_RI_TPTE_NOSNOOP_S 30 |
| 237 | #define M_FW_RI_TPTE_NOSNOOP 0x1 | 237 | #define FW_RI_TPTE_NOSNOOP_M 0x1 |
| 238 | #define V_FW_RI_TPTE_NOSNOOP(x) ((x) << S_FW_RI_TPTE_NOSNOOP) | 238 | #define FW_RI_TPTE_NOSNOOP_V(x) ((x) << FW_RI_TPTE_NOSNOOP_S) |
| 239 | #define G_FW_RI_TPTE_NOSNOOP(x) \ | 239 | #define FW_RI_TPTE_NOSNOOP_G(x) \ |
| 240 | (((x) >> S_FW_RI_TPTE_NOSNOOP) & M_FW_RI_TPTE_NOSNOOP) | 240 | (((x) >> FW_RI_TPTE_NOSNOOP_S) & FW_RI_TPTE_NOSNOOP_M) |
| 241 | #define F_FW_RI_TPTE_NOSNOOP V_FW_RI_TPTE_NOSNOOP(1U) | 241 | #define FW_RI_TPTE_NOSNOOP_F FW_RI_TPTE_NOSNOOP_V(1U) |
| 242 | 242 | ||
| 243 | #define S_FW_RI_TPTE_PBLADDR 0 | 243 | #define FW_RI_TPTE_PBLADDR_S 0 |
| 244 | #define M_FW_RI_TPTE_PBLADDR 0x1fffffff | 244 | #define FW_RI_TPTE_PBLADDR_M 0x1fffffff |
| 245 | #define V_FW_RI_TPTE_PBLADDR(x) ((x) << S_FW_RI_TPTE_PBLADDR) | 245 | #define FW_RI_TPTE_PBLADDR_V(x) ((x) << FW_RI_TPTE_PBLADDR_S) |
| 246 | #define G_FW_RI_TPTE_PBLADDR(x) \ | 246 | #define FW_RI_TPTE_PBLADDR_G(x) \ |
| 247 | (((x) >> S_FW_RI_TPTE_PBLADDR) & M_FW_RI_TPTE_PBLADDR) | 247 | (((x) >> FW_RI_TPTE_PBLADDR_S) & FW_RI_TPTE_PBLADDR_M) |
| 248 | 248 | ||
| 249 | #define S_FW_RI_TPTE_DCA 24 | 249 | #define FW_RI_TPTE_DCA_S 24 |
| 250 | #define M_FW_RI_TPTE_DCA 0x1f | 250 | #define FW_RI_TPTE_DCA_M 0x1f |
| 251 | #define V_FW_RI_TPTE_DCA(x) ((x) << S_FW_RI_TPTE_DCA) | 251 | #define FW_RI_TPTE_DCA_V(x) ((x) << FW_RI_TPTE_DCA_S) |
| 252 | #define G_FW_RI_TPTE_DCA(x) \ | 252 | #define FW_RI_TPTE_DCA_G(x) \ |
| 253 | (((x) >> S_FW_RI_TPTE_DCA) & M_FW_RI_TPTE_DCA) | 253 | (((x) >> FW_RI_TPTE_DCA_S) & FW_RI_TPTE_DCA_M) |
| 254 | 254 | ||
| 255 | #define S_FW_RI_TPTE_MWBCNT_PSTAG 0 | 255 | #define FW_RI_TPTE_MWBCNT_PSTAG_S 0 |
| 256 | #define M_FW_RI_TPTE_MWBCNT_PSTAG 0xffffff | 256 | #define FW_RI_TPTE_MWBCNT_PSTAG_M 0xffffff |
| 257 | #define V_FW_RI_TPTE_MWBCNT_PSTAT(x) \ | 257 | #define FW_RI_TPTE_MWBCNT_PSTAT_V(x) \ |
| 258 | ((x) << S_FW_RI_TPTE_MWBCNT_PSTAG) | 258 | ((x) << FW_RI_TPTE_MWBCNT_PSTAG_S) |
| 259 | #define G_FW_RI_TPTE_MWBCNT_PSTAG(x) \ | 259 | #define FW_RI_TPTE_MWBCNT_PSTAG_G(x) \ |
| 260 | (((x) >> S_FW_RI_TPTE_MWBCNT_PSTAG) & M_FW_RI_TPTE_MWBCNT_PSTAG) | 260 | (((x) >> FW_RI_TPTE_MWBCNT_PSTAG_S) & FW_RI_TPTE_MWBCNT_PSTAG_M) |
| 261 | 261 | ||
| 262 | enum fw_ri_res_type { | 262 | enum fw_ri_res_type { |
| 263 | FW_RI_RES_TYPE_SQ, | 263 | FW_RI_RES_TYPE_SQ, |
| @@ -308,222 +308,222 @@ struct fw_ri_res_wr { · 44 unmodified lines | |||
| 308 | #endif | 308 | #endif |
| 309 | }; | 309 | }; |
| 310 | 310 | ||
| 311 | #define S_FW_RI_RES_WR_NRES 0 | 311 | #define FW_RI_RES_WR_NRES_S 0 |
| 312 | #define M_FW_RI_RES_WR_NRES 0xff | 312 | #define FW_RI_RES_WR_NRES_M 0xff |
| 313 | #define V_FW_RI_RES_WR_NRES(x) ((x) << S_FW_RI_RES_WR_NRES) | 313 | #define FW_RI_RES_WR_NRES_V(x) ((x) << FW_RI_RES_WR_NRES_S) |
| 314 | #define G_FW_RI_RES_WR_NRES(x) \ | 314 | #define FW_RI_RES_WR_NRES_G(x) \ |
| 315 | (((x) >> S_FW_RI_RES_WR_NRES) & M_FW_RI_RES_WR_NRES) | 315 | (((x) >> FW_RI_RES_WR_NRES_S) & FW_RI_RES_WR_NRES_M) |
| 316 | 316 | ||
| 317 | #define S_FW_RI_RES_WR_FETCHSZM 26 | 317 | #define FW_RI_RES_WR_FETCHSZM_S 26 |
| 318 | #define M_FW_RI_RES_WR_FETCHSZM 0x1 | 318 | #define FW_RI_RES_WR_FETCHSZM_M 0x1 |
| 319 | #define V_FW_RI_RES_WR_FETCHSZM(x) ((x) << S_FW_RI_RES_WR_FETCHSZM) | 319 | #define FW_RI_RES_WR_FETCHSZM_V(x) ((x) << FW_RI_RES_WR_FETCHSZM_S) |
| 320 | #define G_FW_RI_RES_WR_FETCHSZM(x) \ | 320 | #define FW_RI_RES_WR_FETCHSZM_G(x) \ |
| 321 | (((x) >> S_FW_RI_RES_WR_FETCHSZM) & M_FW_RI_RES_WR_FETCHSZM) | 321 | (((x) >> FW_RI_RES_WR_FETCHSZM_S) & FW_RI_RES_WR_FETCHSZM_M) |
| 322 | #define F_FW_RI_RES_WR_FETCHSZM V_FW_RI_RES_WR_FETCHSZM(1U) | 322 | #define FW_RI_RES_WR_FETCHSZM_F FW_RI_RES_WR_FETCHSZM_V(1U) |
| 323 | 323 | ||
| 324 | #define S_FW_RI_RES_WR_STATUSPGNS 25 | 324 | #define FW_RI_RES_WR_STATUSPGNS_S 25 |
| 325 | #define M_FW_RI_RES_WR_STATUSPGNS 0x1 | 325 | #define FW_RI_RES_WR_STATUSPGNS_M 0x1 |
| 326 | #define V_FW_RI_RES_WR_STATUSPGNS(x) ((x) << S_FW_RI_RES_WR_STATUSPGNS) | 326 | #define FW_RI_RES_WR_STATUSPGNS_V(x) ((x) << FW_RI_RES_WR_STATUSPGNS_S) |
| 327 | #define G_FW_RI_RES_WR_STATUSPGNS(x) \ | 327 | #define FW_RI_RES_WR_STATUSPGNS_G(x) \ |
| 328 | (((x) >> S_FW_RI_RES_WR_STATUSPGNS) & M_FW_RI_RES_WR_STATUSPGNS) | 328 | (((x) >> FW_RI_RES_WR_STATUSPGNS_S) & FW_RI_RES_WR_STATUSPGNS_M) |
| 329 | #define F_FW_RI_RES_WR_STATUSPGNS V_FW_RI_RES_WR_STATUSPGNS(1U) | 329 | #define FW_RI_RES_WR_STATUSPGNS_F FW_RI_RES_WR_STATUSPGNS_V(1U) |
| 330 | 330 | ||
| 331 | #define S_FW_RI_RES_WR_STATUSPGRO 24 | 331 | #define FW_RI_RES_WR_STATUSPGRO_S 24 |
| 332 | #define M_FW_RI_RES_WR_STATUSPGRO 0x1 | 332 | #define FW_RI_RES_WR_STATUSPGRO_M 0x1 |
| 333 | #define V_FW_RI_RES_WR_STATUSPGRO(x) ((x) << S_FW_RI_RES_WR_STATUSPGRO) | 333 | #define FW_RI_RES_WR_STATUSPGRO_V(x) ((x) << FW_RI_RES_WR_STATUSPGRO_S) |
| 334 | #define G_FW_RI_RES_WR_STATUSPGRO(x) \ | 334 | #define FW_RI_RES_WR_STATUSPGRO_G(x) \ |
| 335 | (((x) >> S_FW_RI_RES_WR_STATUSPGRO) & M_FW_RI_RES_WR_STATUSPGRO) | 335 | (((x) >> FW_RI_RES_WR_STATUSPGRO_S) & FW_RI_RES_WR_STATUSPGRO_M) |
| 336 | #define F_FW_RI_RES_WR_STATUSPGRO V_FW_RI_RES_WR_STATUSPGRO(1U) | 336 | #define FW_RI_RES_WR_STATUSPGRO_F FW_RI_RES_WR_STATUSPGRO_V(1U) |
| 337 | 337 | ||
| 338 | #define S_FW_RI_RES_WR_FETCHNS 23 | 338 | #define FW_RI_RES_WR_FETCHNS_S 23 |
| 339 | #define M_FW_RI_RES_WR_FETCHNS 0x1 | 339 | #define FW_RI_RES_WR_FETCHNS_M 0x1 |
| 340 | #define V_FW_RI_RES_WR_FETCHNS(x) ((x) << S_FW_RI_RES_WR_FETCHNS) | 340 | #define FW_RI_RES_WR_FETCHNS_V(x) ((x) << FW_RI_RES_WR_FETCHNS_S) |
| 341 | #define G_FW_RI_RES_WR_FETCHNS(x) \ | 341 | #define FW_RI_RES_WR_FETCHNS_G(x) \ |
| 342 | (((x) >> S_FW_RI_RES_WR_FETCHNS) & M_FW_RI_RES_WR_FETCHNS) | 342 | (((x) >> FW_RI_RES_WR_FETCHNS_S) & FW_RI_RES_WR_FETCHNS_M) |
| 343 | #define F_FW_RI_RES_WR_FETCHNS V_FW_RI_RES_WR_FETCHNS(1U) | 343 | #define FW_RI_RES_WR_FETCHNS_F FW_RI_RES_WR_FETCHNS_V(1U) |
| 344 | 344 | ||
| 345 | #define S_FW_RI_RES_WR_FETCHRO 22 | 345 | #define FW_RI_RES_WR_FETCHRO_S 22 |
| 346 | #define M_FW_RI_RES_WR_FETCHRO 0x1 | 346 | #define FW_RI_RES_WR_FETCHRO_M 0x1 |
| 347 | #define V_FW_RI_RES_WR_FETCHRO(x) ((x) << S_FW_RI_RES_WR_FETCHRO) | 347 | #define FW_RI_RES_WR_FETCHRO_V(x) ((x) << FW_RI_RES_WR_FETCHRO_S) |
| 348 | #define G_FW_RI_RES_WR_FETCHRO(x) \ | 348 | #define FW_RI_RES_WR_FETCHRO_G(x) \ |
| 349 | (((x) >> S_FW_RI_RES_WR_FETCHRO) & M_FW_RI_RES_WR_FETCHRO) | 349 | (((x) >> FW_RI_RES_WR_FETCHRO_S) & FW_RI_RES_WR_FETCHRO_M) |
| 350 | #define F_FW_RI_RES_WR_FETCHRO V_FW_RI_RES_WR_FETCHRO(1U) | 350 | #define FW_RI_RES_WR_FETCHRO_F FW_RI_RES_WR_FETCHRO_V(1U) |
| 351 | 351 | ||
| 352 | #define S_FW_RI_RES_WR_HOSTFCMODE 20 | 352 | #define FW_RI_RES_WR_HOSTFCMODE_S 20 |
| 353 | #define M_FW_RI_RES_WR_HOSTFCMODE 0x3 | 353 | #define FW_RI_RES_WR_HOSTFCMODE_M 0x3 |
| 354 | #define V_FW_RI_RES_WR_HOSTFCMODE(x) ((x) << S_FW_RI_RES_WR_HOSTFCMODE) | 354 | #define FW_RI_RES_WR_HOSTFCMODE_V(x) ((x) << FW_RI_RES_WR_HOSTFCMODE_S) |
| 355 | #define G_FW_RI_RES_WR_HOSTFCMODE(x) \ | 355 | #define FW_RI_RES_WR_HOSTFCMODE_G(x) \ |
| 356 | (((x) >> S_FW_RI_RES_WR_HOSTFCMODE) & M_FW_RI_RES_WR_HOSTFCMODE) | 356 | (((x) >> FW_RI_RES_WR_HOSTFCMODE_S) & FW_RI_RES_WR_HOSTFCMODE_M) |
| 357 | 357 | ||
| 358 | #define S_FW_RI_RES_WR_CPRIO 19 | 358 | #define FW_RI_RES_WR_CPRIO_S 19 |
| 359 | #define M_FW_RI_RES_WR_CPRIO 0x1 | 359 | #define FW_RI_RES_WR_CPRIO_M 0x1 |
| 360 | #define V_FW_RI_RES_WR_CPRIO(x) ((x) << S_FW_RI_RES_WR_CPRIO) | 360 | #define FW_RI_RES_WR_CPRIO_V(x) ((x) << FW_RI_RES_WR_CPRIO_S) |
| 361 | #define G_FW_RI_RES_WR_CPRIO(x) \ | 361 | #define FW_RI_RES_WR_CPRIO_G(x) \ |
| 362 | (((x) >> S_FW_RI_RES_WR_CPRIO) & M_FW_RI_RES_WR_CPRIO) | 362 | (((x) >> FW_RI_RES_WR_CPRIO_S) & FW_RI_RES_WR_CPRIO_M) |
| 363 | #define F_FW_RI_RES_WR_CPRIO V_FW_RI_RES_WR_CPRIO(1U) | 363 | #define FW_RI_RES_WR_CPRIO_F FW_RI_RES_WR_CPRIO_V(1U) |
| 364 | 364 | ||
| 365 | #define S_FW_RI_RES_WR_ONCHIP 18 | 365 | #define FW_RI_RES_WR_ONCHIP_S 18 |
| 366 | #define M_FW_RI_RES_WR_ONCHIP 0x1 | 366 | #define FW_RI_RES_WR_ONCHIP_M 0x1 |
| 367 | #define V_FW_RI_RES_WR_ONCHIP(x) ((x) << S_FW_RI_RES_WR_ONCHIP) | 367 | #define FW_RI_RES_WR_ONCHIP_V(x) ((x) << FW_RI_RES_WR_ONCHIP_S) |
| 368 | #define G_FW_RI_RES_WR_ONCHIP(x) \ | 368 | #define FW_RI_RES_WR_ONCHIP_G(x) \ |
| 369 | (((x) >> S_FW_RI_RES_WR_ONCHIP) & M_FW_RI_RES_WR_ONCHIP) | 369 | (((x) >> FW_RI_RES_WR_ONCHIP_S) & FW_RI_RES_WR_ONCHIP_M) |
| 370 | #define F_FW_RI_RES_WR_ONCHIP V_FW_RI_RES_WR_ONCHIP(1U) | 370 | #define FW_RI_RES_WR_ONCHIP_F FW_RI_RES_WR_ONCHIP_V(1U) |
| 371 | 371 | ||
| 372 | #define S_FW_RI_RES_WR_PCIECHN 16 | 372 | #define FW_RI_RES_WR_PCIECHN_S 16 |
| 373 | #define M_FW_RI_RES_WR_PCIECHN 0x3 | 373 | #define FW_RI_RES_WR_PCIECHN_M 0x3 |
| 374 | #define V_FW_RI_RES_WR_PCIECHN(x) ((x) << S_FW_RI_RES_WR_PCIECHN) | 374 | #define FW_RI_RES_WR_PCIECHN_V(x) ((x) << FW_RI_RES_WR_PCIECHN_S) |
| 375 | #define G_FW_RI_RES_WR_PCIECHN(x) \ | 375 | #define FW_RI_RES_WR_PCIECHN_G(x) \ |
| 376 | (((x) >> S_FW_RI_RES_WR_PCIECHN) & M_FW_RI_RES_WR_PCIECHN) | 376 | (((x) >> FW_RI_RES_WR_PCIECHN_S) & FW_RI_RES_WR_PCIECHN_M) |
| 377 | 377 | ||
| 378 | #define S_FW_RI_RES_WR_IQID 0 | 378 | #define FW_RI_RES_WR_IQID_S 0 |
| 379 | #define M_FW_RI_RES_WR_IQID 0xffff | 379 | #define FW_RI_RES_WR_IQID_M 0xffff |
| 380 | #define V_FW_RI_RES_WR_IQID(x) ((x) << S_FW_RI_RES_WR_IQID) | 380 | #define FW_RI_RES_WR_IQID_V(x) ((x) << FW_RI_RES_WR_IQID_S) |
| 381 | #define G_FW_RI_RES_WR_IQID(x) \ | 381 | #define FW_RI_RES_WR_IQID_G(x) \ |
| 382 | (((x) >> S_FW_RI_RES_WR_IQID) & M_FW_RI_RES_WR_IQID) | 382 | (((x) >> FW_RI_RES_WR_IQID_S) & FW_RI_RES_WR_IQID_M) |
| 383 | 383 | ||
| 384 | #define S_FW_RI_RES_WR_DCAEN 31 | 384 | #define FW_RI_RES_WR_DCAEN_S 31 |
| 385 | #define M_FW_RI_RES_WR_DCAEN 0x1 | 385 | #define FW_RI_RES_WR_DCAEN_M 0x1 |
| 386 | #define V_FW_RI_RES_WR_DCAEN(x) ((x) << S_FW_RI_RES_WR_DCAEN) | 386 | #define FW_RI_RES_WR_DCAEN_V(x) ((x) << FW_RI_RES_WR_DCAEN_S) |
| 387 | #define G_FW_RI_RES_WR_DCAEN(x) \ | 387 | #define FW_RI_RES_WR_DCAEN_G(x) \ |
| 388 | (((x) >> S_FW_RI_RES_WR_DCAEN) & M_FW_RI_RES_WR_DCAEN) | 388 | (((x) >> FW_RI_RES_WR_DCAEN_S) & FW_RI_RES_WR_DCAEN_M) |
| 389 | #define F_FW_RI_RES_WR_DCAEN V_FW_RI_RES_WR_DCAEN(1U) | 389 | #define FW_RI_RES_WR_DCAEN_F FW_RI_RES_WR_DCAEN_V(1U) |
| 390 | 390 | ||
| 391 | #define S_FW_RI_RES_WR_DCACPU 26 | 391 | #define FW_RI_RES_WR_DCACPU_S 26 |
| 392 | #define M_FW_RI_RES_WR_DCACPU 0x1f | 392 | #define FW_RI_RES_WR_DCACPU_M 0x1f |
| 393 | #define V_FW_RI_RES_WR_DCACPU(x) ((x) << S_FW_RI_RES_WR_DCACPU) | 393 | #define FW_RI_RES_WR_DCACPU_V(x) ((x) << FW_RI_RES_WR_DCACPU_S) |
| 394 | #define G_FW_RI_RES_WR_DCACPU(x) \ | 394 | #define FW_RI_RES_WR_DCACPU_G(x) \ |
| 395 | (((x) >> S_FW_RI_RES_WR_DCACPU) & M_FW_RI_RES_WR_DCACPU) | 395 | (((x) >> FW_RI_RES_WR_DCACPU_S) & FW_RI_RES_WR_DCACPU_M) |
| 396 | 396 | ||
| 397 | #define S_FW_RI_RES_WR_FBMIN 23 | 397 | #define FW_RI_RES_WR_FBMIN_S 23 |
| 398 | #define M_FW_RI_RES_WR_FBMIN 0x7 | 398 | #define FW_RI_RES_WR_FBMIN_M 0x7 |
| 399 | #define V_FW_RI_RES_WR_FBMIN(x) ((x) << S_FW_RI_RES_WR_FBMIN) | 399 | #define FW_RI_RES_WR_FBMIN_V(x) ((x) << FW_RI_RES_WR_FBMIN_S) |
| 400 | #define G_FW_RI_RES_WR_FBMIN(x) \ | 400 | #define FW_RI_RES_WR_FBMIN_G(x) \ |
| 401 | (((x) >> S_FW_RI_RES_WR_FBMIN) & M_FW_RI_RES_WR_FBMIN) | 401 | (((x) >> FW_RI_RES_WR_FBMIN_S) & FW_RI_RES_WR_FBMIN_M) |
| 402 | 402 | ||
| 403 | #define S_FW_RI_RES_WR_FBMAX 20 | 403 | #define FW_RI_RES_WR_FBMAX_S 20 |
| 404 | #define M_FW_RI_RES_WR_FBMAX 0x7 | 404 | #define FW_RI_RES_WR_FBMAX_M 0x7 |
| 405 | #define V_FW_RI_RES_WR_FBMAX(x) ((x) << S_FW_RI_RES_WR_FBMAX) | 405 | #define FW_RI_RES_WR_FBMAX_V(x) ((x) << FW_RI_RES_WR_FBMAX_S) |
| 406 | #define G_FW_RI_RES_WR_FBMAX(x) \ | 406 | #define FW_RI_RES_WR_FBMAX_G(x) \ |
| 407 | (((x) >> S_FW_RI_RES_WR_FBMAX) & M_FW_RI_RES_WR_FBMAX) | 407 | (((x) >> FW_RI_RES_WR_FBMAX_S) & FW_RI_RES_WR_FBMAX_M) |
| 408 | 408 | ||
| 409 | #define S_FW_RI_RES_WR_CIDXFTHRESHO 19 | 409 | #define FW_RI_RES_WR_CIDXFTHRESHO_S 19 |
| 410 | #define M_FW_RI_RES_WR_CIDXFTHRESHO 0x1 | 410 | #define FW_RI_RES_WR_CIDXFTHRESHO_M 0x1 |
| 411 | #define V_FW_RI_RES_WR_CIDXFTHRESHO(x) ((x) << S_FW_RI_RES_WR_CIDXFTHRESHO) | 411 | #define FW_RI_RES_WR_CIDXFTHRESHO_V(x) ((x) << FW_RI_RES_WR_CIDXFTHRESHO_S) |
| 412 | #define G_FW_RI_RES_WR_CIDXFTHRESHO(x) \ | 412 | #define FW_RI_RES_WR_CIDXFTHRESHO_G(x) \ |
| 413 | (((x) >> S_FW_RI_RES_WR_CIDXFTHRESHO) & M_FW_RI_RES_WR_CIDXFTHRESHO) | 413 | (((x) >> FW_RI_RES_WR_CIDXFTHRESHO_S) & FW_RI_RES_WR_CIDXFTHRESHO_M) |
| 414 | #define F_FW_RI_RES_WR_CIDXFTHRESHO V_FW_RI_RES_WR_CIDXFTHRESHO(1U) | 414 | #define FW_RI_RES_WR_CIDXFTHRESHO_F FW_RI_RES_WR_CIDXFTHRESHO_V(1U) |
| 415 | 415 | ||
| 416 | #define S_FW_RI_RES_WR_CIDXFTHRESH 16 | 416 | #define FW_RI_RES_WR_CIDXFTHRESH_S 16 |
| 417 | #define M_FW_RI_RES_WR_CIDXFTHRESH 0x7 | 417 | #define FW_RI_RES_WR_CIDXFTHRESH_M 0x7 |
| 418 | #define V_FW_RI_RES_WR_CIDXFTHRESH(x) ((x) << S_FW_RI_RES_WR_CIDXFTHRESH) | 418 | #define FW_RI_RES_WR_CIDXFTHRESH_V(x) ((x) << FW_RI_RES_WR_CIDXFTHRESH_S) |
| 419 | #define G_FW_RI_RES_WR_CIDXFTHRESH(x) \ | 419 | #define FW_RI_RES_WR_CIDXFTHRESH_G(x) \ |
| 420 | (((x) >> S_FW_RI_RES_WR_CIDXFTHRESH) & M_FW_RI_RES_WR_CIDXFTHRESH) | 420 | (((x) >> FW_RI_RES_WR_CIDXFTHRESH_S) & FW_RI_RES_WR_CIDXFTHRESH_M) |
| 421 | 421 | ||
| 422 | #define S_FW_RI_RES_WR_EQSIZE 0 | 422 | #define FW_RI_RES_WR_EQSIZE_S 0 |
| 423 | #define M_FW_RI_RES_WR_EQSIZE 0xffff | 423 | #define FW_RI_RES_WR_EQSIZE_M 0xffff |
| 424 | #define V_FW_RI_RES_WR_EQSIZE(x) ((x) << S_FW_RI_RES_WR_EQSIZE) | 424 | #define FW_RI_RES_WR_EQSIZE_V(x) ((x) << FW_RI_RES_WR_EQSIZE_S) |
| 425 | #define G_FW_RI_RES_WR_EQSIZE(x) \ | 425 | #define FW_RI_RES_WR_EQSIZE_G(x) \ |
| 426 | (((x) >> S_FW_RI_RES_WR_EQSIZE) & M_FW_RI_RES_WR_EQSIZE) | 426 | (((x) >> FW_RI_RES_WR_EQSIZE_S) & FW_RI_RES_WR_EQSIZE_M) |
| 427 | 427 | ||
| 428 | #define S_FW_RI_RES_WR_IQANDST 15 | 428 | #define FW_RI_RES_WR_IQANDST_S 15 |
| 429 | #define M_FW_RI_RES_WR_IQANDST 0x1 | 429 | #define FW_RI_RES_WR_IQANDST_M 0x1 |
| 430 | #define V_FW_RI_RES_WR_IQANDST(x) ((x) << S_FW_RI_RES_WR_IQANDST) | 430 | #define FW_RI_RES_WR_IQANDST_V(x) ((x) << FW_RI_RES_WR_IQANDST_S) |
| 431 | #define G_FW_RI_RES_WR_IQANDST(x) \ | 431 | #define FW_RI_RES_WR_IQANDST_G(x) \ |
| 432 | (((x) >> S_FW_RI_RES_WR_IQANDST) & M_FW_RI_RES_WR_IQANDST) | 432 | (((x) >> FW_RI_RES_WR_IQANDST_S) & FW_RI_RES_WR_IQANDST_M) |
| 433 | #define F_FW_RI_RES_WR_IQANDST V_FW_RI_RES_WR_IQANDST(1U) | 433 | #define FW_RI_RES_WR_IQANDST_F FW_RI_RES_WR_IQANDST_V(1U) |
| 434 | 434 | ||
| 435 | #define S_FW_RI_RES_WR_IQANUS 14 | 435 | #define FW_RI_RES_WR_IQANUS_S 14 |
| 436 | #define M_FW_RI_RES_WR_IQANUS 0x1 | 436 | #define FW_RI_RES_WR_IQANUS_M 0x1 |
| 437 | #define V_FW_RI_RES_WR_IQANUS(x) ((x) << S_FW_RI_RES_WR_IQANUS) | 437 | #define FW_RI_RES_WR_IQANUS_V(x) ((x) << FW_RI_RES_WR_IQANUS_S) |
| 438 | #define G_FW_RI_RES_WR_IQANUS(x) \ | 438 | #define FW_RI_RES_WR_IQANUS_G(x) \ |
| 439 | (((x) >> S_FW_RI_RES_WR_IQANUS) & M_FW_RI_RES_WR_IQANUS) | 439 | (((x) >> FW_RI_RES_WR_IQANUS_S) & FW_RI_RES_WR_IQANUS_M) |
| 440 | #define F_FW_RI_RES_WR_IQANUS V_FW_RI_RES_WR_IQANUS(1U) | 440 | #define FW_RI_RES_WR_IQANUS_F FW_RI_RES_WR_IQANUS_V(1U) |
| 441 | 441 | ||
| 442 | #define S_FW_RI_RES_WR_IQANUD 12 | 442 | #define FW_RI_RES_WR_IQANUD_S 12 |
| 443 | #define M_FW_RI_RES_WR_IQANUD 0x3 | 443 | #define FW_RI_RES_WR_IQANUD_M 0x3 |
| 444 | #define V_FW_RI_RES_WR_IQANUD(x) ((x) << S_FW_RI_RES_WR_IQANUD) | 444 | #define FW_RI_RES_WR_IQANUD_V(x) ((x) << FW_RI_RES_WR_IQANUD_S) |
| 445 | #define G_FW_RI_RES_WR_IQANUD(x) \ | 445 | #define FW_RI_RES_WR_IQANUD_G(x) \ |
| 446 | (((x) >> S_FW_RI_RES_WR_IQANUD) & M_FW_RI_RES_WR_IQANUD) | 446 | (((x) >> FW_RI_RES_WR_IQANUD_S) & FW_RI_RES_WR_IQANUD_M) |
| 447 | 447 | ||
| 448 | #define S_FW_RI_RES_WR_IQANDSTINDEX 0 | 448 | #define FW_RI_RES_WR_IQANDSTINDEX_S 0 |
| 449 | #define M_FW_RI_RES_WR_IQANDSTINDEX 0xfff | 449 | #define FW_RI_RES_WR_IQANDSTINDEX_M 0xfff |
| 450 | #define V_FW_RI_RES_WR_IQANDSTINDEX(x) ((x) << S_FW_RI_RES_WR_IQANDSTINDEX) | 450 | #define FW_RI_RES_WR_IQANDSTINDEX_V(x) ((x) << FW_RI_RES_WR_IQANDSTINDEX_S) |
| 451 | #define G_FW_RI_RES_WR_IQANDSTINDEX(x) \ | 451 | #define FW_RI_RES_WR_IQANDSTINDEX_G(x) \ |
| 452 | (((x) >> S_FW_RI_RES_WR_IQANDSTINDEX) & M_FW_RI_RES_WR_IQANDSTINDEX) | 452 | (((x) >> FW_RI_RES_WR_IQANDSTINDEX_S) & FW_RI_RES_WR_IQANDSTINDEX_M) |
| 453 | 453 | ||
| 454 | #define S_FW_RI_RES_WR_IQDROPRSS 15 | 454 | #define FW_RI_RES_WR_IQDROPRSS_S 15 |
| 455 | #define M_FW_RI_RES_WR_IQDROPRSS 0x1 | 455 | #define FW_RI_RES_WR_IQDROPRSS_M 0x1 |
| 456 | #define V_FW_RI_RES_WR_IQDROPRSS(x) ((x) << S_FW_RI_RES_WR_IQDROPRSS) | 456 | #define FW_RI_RES_WR_IQDROPRSS_V(x) ((x) << FW_RI_RES_WR_IQDROPRSS_S) |
| 457 | #define G_FW_RI_RES_WR_IQDROPRSS(x) \ | 457 | #define FW_RI_RES_WR_IQDROPRSS_G(x) \ |
| 458 | (((x) >> S_FW_RI_RES_WR_IQDROPRSS) & M_FW_RI_RES_WR_IQDROPRSS) | 458 | (((x) >> FW_RI_RES_WR_IQDROPRSS_S) & FW_RI_RES_WR_IQDROPRSS_M) |
| 459 | #define F_FW_RI_RES_WR_IQDROPRSS V_FW_RI_RES_WR_IQDROPRSS(1U) | 459 | #define FW_RI_RES_WR_IQDROPRSS_F FW_RI_RES_WR_IQDROPRSS_V(1U) |
| 460 | 460 | ||
| 461 | #define S_FW_RI_RES_WR_IQGTSMODE 14 | 461 | #define FW_RI_RES_WR_IQGTSMODE_S 14 |
| 462 | #define M_FW_RI_RES_WR_IQGTSMODE 0x1 | 462 | #define FW_RI_RES_WR_IQGTSMODE_M 0x1 |
| 463 | #define V_FW_RI_RES_WR_IQGTSMODE(x) ((x) << S_FW_RI_RES_WR_IQGTSMODE) | 463 | #define FW_RI_RES_WR_IQGTSMODE_V(x) ((x) << FW_RI_RES_WR_IQGTSMODE_S) |
| 464 | #define G_FW_RI_RES_WR_IQGTSMODE(x) \ | 464 | #define FW_RI_RES_WR_IQGTSMODE_G(x) \ |
| 465 | (((x) >> S_FW_RI_RES_WR_IQGTSMODE) & M_FW_RI_RES_WR_IQGTSMODE) | 465 | (((x) >> FW_RI_RES_WR_IQGTSMODE_S) & FW_RI_RES_WR_IQGTSMODE_M) |
| 466 | #define F_FW_RI_RES_WR_IQGTSMODE V_FW_RI_RES_WR_IQGTSMODE(1U) | 466 | #define FW_RI_RES_WR_IQGTSMODE_F FW_RI_RES_WR_IQGTSMODE_V(1U) |
| 467 | 467 | ||
| 468 | #define S_FW_RI_RES_WR_IQPCIECH 12 | 468 | #define FW_RI_RES_WR_IQPCIECH_S 12 |
| 469 | #define M_FW_RI_RES_WR_IQPCIECH 0x3 | 469 | #define FW_RI_RES_WR_IQPCIECH_M 0x3 |
| 470 | #define V_FW_RI_RES_WR_IQPCIECH(x) ((x) << S_FW_RI_RES_WR_IQPCIECH) | 470 | #define FW_RI_RES_WR_IQPCIECH_V(x) ((x) << FW_RI_RES_WR_IQPCIECH_S) |
| 471 | #define G_FW_RI_RES_WR_IQPCIECH(x) \ | 471 | #define FW_RI_RES_WR_IQPCIECH_G(x) \ |
| 472 | (((x) >> S_FW_RI_RES_WR_IQPCIECH) & M_FW_RI_RES_WR_IQPCIECH) | 472 | (((x) >> FW_RI_RES_WR_IQPCIECH_S) & FW_RI_RES_WR_IQPCIECH_M) |
| 473 | 473 | ||
| 474 | #define S_FW_RI_RES_WR_IQDCAEN 11 | 474 | #define FW_RI_RES_WR_IQDCAEN_S 11 |
| 475 | #define M_FW_RI_RES_WR_IQDCAEN 0x1 | 475 | #define FW_RI_RES_WR_IQDCAEN_M 0x1 |
| 476 | #define V_FW_RI_RES_WR_IQDCAEN(x) ((x) << S_FW_RI_RES_WR_IQDCAEN) | 476 | #define FW_RI_RES_WR_IQDCAEN_V(x) ((x) << FW_RI_RES_WR_IQDCAEN_S) |
| 477 | #define G_FW_RI_RES_WR_IQDCAEN(x) \ | 477 | #define FW_RI_RES_WR_IQDCAEN_G(x) \ |
| 478 | (((x) >> S_FW_RI_RES_WR_IQDCAEN) & M_FW_RI_RES_WR_IQDCAEN) | 478 | (((x) >> FW_RI_RES_WR_IQDCAEN_S) & FW_RI_RES_WR_IQDCAEN_M) |
| 479 | #define F_FW_RI_RES_WR_IQDCAEN V_FW_RI_RES_WR_IQDCAEN(1U) | 479 | #define FW_RI_RES_WR_IQDCAEN_F FW_RI_RES_WR_IQDCAEN_V(1U) |
| 480 | 480 | ||
| 481 | #define S_FW_RI_RES_WR_IQDCACPU 6 | 481 | #define FW_RI_RES_WR_IQDCACPU_S 6 |
| 482 | #define M_FW_RI_RES_WR_IQDCACPU 0x1f | 482 | #define FW_RI_RES_WR_IQDCACPU_M 0x1f |
| 483 | #define V_FW_RI_RES_WR_IQDCACPU(x) ((x) << S_FW_RI_RES_WR_IQDCACPU) | 483 | #define FW_RI_RES_WR_IQDCACPU_V(x) ((x) << FW_RI_RES_WR_IQDCACPU_S) |
| 484 | #define G_FW_RI_RES_WR_IQDCACPU(x) \ | 484 | #define FW_RI_RES_WR_IQDCACPU_G(x) \ |
| 485 | (((x) >> S_FW_RI_RES_WR_IQDCACPU) & M_FW_RI_RES_WR_IQDCACPU) | 485 | (((x) >> FW_RI_RES_WR_IQDCACPU_S) & FW_RI_RES_WR_IQDCACPU_M) |
| 486 | 486 | ||
| 487 | #define S_FW_RI_RES_WR_IQINTCNTTHRESH 4 | 487 | #define FW_RI_RES_WR_IQINTCNTTHRESH_S 4 |
| 488 | #define M_FW_RI_RES_WR_IQINTCNTTHRESH 0x3 | 488 | #define FW_RI_RES_WR_IQINTCNTTHRESH_M 0x3 |
| 489 | #define V_FW_RI_RES_WR_IQINTCNTTHRESH(x) \ | 489 | #define FW_RI_RES_WR_IQINTCNTTHRESH_V(x) \ |
| 490 | ((x) << S_FW_RI_RES_WR_IQINTCNTTHRESH) | 490 | ((x) << FW_RI_RES_WR_IQINTCNTTHRESH_S) |
| 491 | #define G_FW_RI_RES_WR_IQINTCNTTHRESH(x) \ | 491 | #define FW_RI_RES_WR_IQINTCNTTHRESH_G(x) \ |
| 492 | (((x) >> S_FW_RI_RES_WR_IQINTCNTTHRESH) & M_FW_RI_RES_WR_IQINTCNTTHRESH) | 492 | (((x) >> FW_RI_RES_WR_IQINTCNTTHRESH_S) & FW_RI_RES_WR_IQINTCNTTHRESH_M) |
| 493 | 493 | ||
| 494 | #define S_FW_RI_RES_WR_IQO 3 | 494 | #define FW_RI_RES_WR_IQO_S 3 |
| 495 | #define M_FW_RI_RES_WR_IQO 0x1 | 495 | #define FW_RI_RES_WR_IQO_M 0x1 |
| 496 | #define V_FW_RI_RES_WR_IQO(x) ((x) << S_FW_RI_RES_WR_IQO) | 496 | #define FW_RI_RES_WR_IQO_V(x) ((x) << FW_RI_RES_WR_IQO_S) |
| 497 | #define G_FW_RI_RES_WR_IQO(x) \ | 497 | #define FW_RI_RES_WR_IQO_G(x) \ |
| 498 | (((x) >> S_FW_RI_RES_WR_IQO) & M_FW_RI_RES_WR_IQO) | 498 | (((x) >> FW_RI_RES_WR_IQO_S) & FW_RI_RES_WR_IQO_M) |
| 499 | #define F_FW_RI_RES_WR_IQO V_FW_RI_RES_WR_IQO(1U) | 499 | #define FW_RI_RES_WR_IQO_F FW_RI_RES_WR_IQO_V(1U) |
| 500 | 500 | ||
| 501 | #define S_FW_RI_RES_WR_IQCPRIO 2 | 501 | #define FW_RI_RES_WR_IQCPRIO_S 2 |
| 502 | #define M_FW_RI_RES_WR_IQCPRIO 0x1 | 502 | #define FW_RI_RES_WR_IQCPRIO_M 0x1 |
| 503 | #define V_FW_RI_RES_WR_IQCPRIO(x) ((x) << S_FW_RI_RES_WR_IQCPRIO) | 503 | #define FW_RI_RES_WR_IQCPRIO_V(x) ((x) << FW_RI_RES_WR_IQCPRIO_S) |
| 504 | #define G_FW_RI_RES_WR_IQCPRIO(x) \ | 504 | #define FW_RI_RES_WR_IQCPRIO_G(x) \ |
| 505 | (((x) >> S_FW_RI_RES_WR_IQCPRIO) & M_FW_RI_RES_WR_IQCPRIO) | 505 | (((x) >> FW_RI_RES_WR_IQCPRIO_S) & FW_RI_RES_WR_IQCPRIO_M) |
| 506 | #define F_FW_RI_RES_WR_IQCPRIO V_FW_RI_RES_WR_IQCPRIO(1U) | 506 | #define FW_RI_RES_WR_IQCPRIO_F FW_RI_RES_WR_IQCPRIO_V(1U) |
| 507 | 507 | ||
| 508 | #define S_FW_RI_RES_WR_IQESIZE 0 | 508 | #define FW_RI_RES_WR_IQESIZE_S 0 |
| 509 | #define M_FW_RI_RES_WR_IQESIZE 0x3 | 509 | #define FW_RI_RES_WR_IQESIZE_M 0x3 |
| 510 | #define V_FW_RI_RES_WR_IQESIZE(x) ((x) << S_FW_RI_RES_WR_IQESIZE) | 510 | #define FW_RI_RES_WR_IQESIZE_V(x) ((x) << FW_RI_RES_WR_IQESIZE_S) |
| 511 | #define G_FW_RI_RES_WR_IQESIZE(x) \ | 511 | #define FW_RI_RES_WR_IQESIZE_G(x) \ |
| 512 | (((x) >> S_FW_RI_RES_WR_IQESIZE) & M_FW_RI_RES_WR_IQESIZE) | 512 | (((x) >> FW_RI_RES_WR_IQESIZE_S) & FW_RI_RES_WR_IQESIZE_M) |
| 513 | 513 | ||
| 514 | #define S_FW_RI_RES_WR_IQNS 31 | 514 | #define FW_RI_RES_WR_IQNS_S 31 |
| 515 | #define M_FW_RI_RES_WR_IQNS 0x1 | 515 | #define FW_RI_RES_WR_IQNS_M 0x1 |
| 516 | #define V_FW_RI_RES_WR_IQNS(x) ((x) << S_FW_RI_RES_WR_IQNS) | 516 | #define FW_RI_RES_WR_IQNS_V(x) ((x) << FW_RI_RES_WR_IQNS_S) |
| 517 | #define G_FW_RI_RES_WR_IQNS(x) \ | 517 | #define FW_RI_RES_WR_IQNS_G(x) \ |
| 518 | (((x) >> S_FW_RI_RES_WR_IQNS) & M_FW_RI_RES_WR_IQNS) | 518 | (((x) >> FW_RI_RES_WR_IQNS_S) & FW_RI_RES_WR_IQNS_M) |
| 519 | #define F_FW_RI_RES_WR_IQNS V_FW_RI_RES_WR_IQNS(1U) | 519 | #define FW_RI_RES_WR_IQNS_F FW_RI_RES_WR_IQNS_V(1U) |
| 520 | 520 | ||
| 521 | #define S_FW_RI_RES_WR_IQRO 30 | 521 | #define FW_RI_RES_WR_IQRO_S 30 |
| 522 | #define M_FW_RI_RES_WR_IQRO 0x1 | 522 | #define FW_RI_RES_WR_IQRO_M 0x1 |
| 523 | #define V_FW_RI_RES_WR_IQRO(x) ((x) << S_FW_RI_RES_WR_IQRO) | 523 | #define FW_RI_RES_WR_IQRO_V(x) ((x) << FW_RI_RES_WR_IQRO_S) |
| 524 | #define G_FW_RI_RES_WR_IQRO(x) \ | 524 | #define FW_RI_RES_WR_IQRO_G(x) \ |
| 525 | (((x) >> S_FW_RI_RES_WR_IQRO) & M_FW_RI_RES_WR_IQRO) | 525 | (((x) >> FW_RI_RES_WR_IQRO_S) & FW_RI_RES_WR_IQRO_M) |
| 526 | #define F_FW_RI_RES_WR_IQRO V_FW_RI_RES_WR_IQRO(1U) | 526 | #define FW_RI_RES_WR_IQRO_F FW_RI_RES_WR_IQRO_V(1U) |
| 527 | 527 | ||
| 528 | struct fw_ri_rdma_write_wr { | 528 | struct fw_ri_rdma_write_wr { |
| 529 | __u8 opcode; | 529 | __u8 opcode; |
| @@ -562,11 +562,11 @@ struct fw_ri_send_wr { · 32 unmodified lines | |||
| 562 | #endif | 562 | #endif |
| 563 | }; | 563 | }; |
| 564 | 564 | ||
| 565 | #define S_FW_RI_SEND_WR_SENDOP 0 | 565 | #define FW_RI_SEND_WR_SENDOP_S 0 |
| 566 | #define M_FW_RI_SEND_WR_SENDOP 0xf | 566 | #define FW_RI_SEND_WR_SENDOP_M 0xf |
| 567 | #define V_FW_RI_SEND_WR_SENDOP(x) ((x) << S_FW_RI_SEND_WR_SENDOP) | 567 | #define FW_RI_SEND_WR_SENDOP_V(x) ((x) << FW_RI_SEND_WR_SENDOP_S) |
| 568 | #define G_FW_RI_SEND_WR_SENDOP(x) \ | 568 | #define FW_RI_SEND_WR_SENDOP_G(x) \ |
| 569 | (((x) >> S_FW_RI_SEND_WR_SENDOP) & M_FW_RI_SEND_WR_SENDOP) | 569 | (((x) >> FW_RI_SEND_WR_SENDOP_S) & FW_RI_SEND_WR_SENDOP_M) |
| 570 | 570 | ||
| 571 | struct fw_ri_rdma_read_wr { | 571 | struct fw_ri_rdma_read_wr { |
| 572 | __u8 opcode; | 572 | __u8 opcode; |
| @@ -612,25 +612,25 @@ struct fw_ri_bind_mw_wr { · 39 unmodified lines | |||
| 612 | __be64 r4; | 612 | __be64 r4; |
| 613 | }; | 613 | }; |
| 614 | 614 | ||
| 615 | #define S_FW_RI_BIND_MW_WR_QPBINDE 6 | 615 | #define FW_RI_BIND_MW_WR_QPBINDE_S 6 |
| 616 | #define M_FW_RI_BIND_MW_WR_QPBINDE 0x1 | 616 | #define FW_RI_BIND_MW_WR_QPBINDE_M 0x1 |
| 617 | #define V_FW_RI_BIND_MW_WR_QPBINDE(x) ((x) << S_FW_RI_BIND_MW_WR_QPBINDE) | 617 | #define FW_RI_BIND_MW_WR_QPBINDE_V(x) ((x) << FW_RI_BIND_MW_WR_QPBINDE_S) |
| 618 | #define G_FW_RI_BIND_MW_WR_QPBINDE(x) \ | 618 | #define FW_RI_BIND_MW_WR_QPBINDE_G(x) \ |
| 619 | (((x) >> S_FW_RI_BIND_MW_WR_QPBINDE) & M_FW_RI_BIND_MW_WR_QPBINDE) | 619 | (((x) >> FW_RI_BIND_MW_WR_QPBINDE_S) & FW_RI_BIND_MW_WR_QPBINDE_M) |
| 620 | #define F_FW_RI_BIND_MW_WR_QPBINDE V_FW_RI_BIND_MW_WR_QPBINDE(1U) | 620 | #define FW_RI_BIND_MW_WR_QPBINDE_F FW_RI_BIND_MW_WR_QPBINDE_V(1U) |
| 621 | 621 | ||
| 622 | #define S_FW_RI_BIND_MW_WR_NS 5 | 622 | #define FW_RI_BIND_MW_WR_NS_S 5 |
| 623 | #define M_FW_RI_BIND_MW_WR_NS 0x1 | 623 | #define FW_RI_BIND_MW_WR_NS_M 0x1 |
| 624 | #define V_FW_RI_BIND_MW_WR_NS(x) ((x) << S_FW_RI_BIND_MW_WR_NS) | 624 | #define FW_RI_BIND_MW_WR_NS_V(x) ((x) << FW_RI_BIND_MW_WR_NS_S) |
| 625 | #define G_FW_RI_BIND_MW_WR_NS(x) \ | 625 | #define FW_RI_BIND_MW_WR_NS_G(x) \ |
| 626 | (((x) >> S_FW_RI_BIND_MW_WR_NS) & M_FW_RI_BIND_MW_WR_NS) | 626 | (((x) >> FW_RI_BIND_MW_WR_NS_S) & FW_RI_BIND_MW_WR_NS_M) |
| 627 | #define F_FW_RI_BIND_MW_WR_NS V_FW_RI_BIND_MW_WR_NS(1U) | 627 | #define FW_RI_BIND_MW_WR_NS_F FW_RI_BIND_MW_WR_NS_V(1U) |
| 628 | 628 | ||
| 629 | #define S_FW_RI_BIND_MW_WR_DCACPU 0 | 629 | #define FW_RI_BIND_MW_WR_DCACPU_S 0 |
| 630 | #define M_FW_RI_BIND_MW_WR_DCACPU 0x1f | 630 | #define FW_RI_BIND_MW_WR_DCACPU_M 0x1f |
| 631 | #define V_FW_RI_BIND_MW_WR_DCACPU(x) ((x) << S_FW_RI_BIND_MW_WR_DCACPU) | 631 | #define FW_RI_BIND_MW_WR_DCACPU_V(x) ((x) << FW_RI_BIND_MW_WR_DCACPU_S) |
| 632 | #define G_FW_RI_BIND_MW_WR_DCACPU(x) \ | 632 | #define FW_RI_BIND_MW_WR_DCACPU_G(x) \ |
| 633 | (((x) >> S_FW_RI_BIND_MW_WR_DCACPU) & M_FW_RI_BIND_MW_WR_DCACPU) | 633 | (((x) >> FW_RI_BIND_MW_WR_DCACPU_S) & FW_RI_BIND_MW_WR_DCACPU_M) |
| 634 | 634 | ||
| 635 | struct fw_ri_fr_nsmr_wr { | 635 | struct fw_ri_fr_nsmr_wr { |
| 636 | __u8 opcode; | 636 | __u8 opcode; |
| @@ -649,25 +649,25 @@ struct fw_ri_fr_nsmr_wr { · 12 unmodified lines | |||
| 649 | __be32 va_lo_fbo; | 649 | __be32 va_lo_fbo; |
| 650 | }; | 650 | }; |
| 651 | 651 | ||
| 652 | #define S_FW_RI_FR_NSMR_WR_QPBINDE 6 | 652 | #define FW_RI_FR_NSMR_WR_QPBINDE_S 6 |
| 653 | #define M_FW_RI_FR_NSMR_WR_QPBINDE 0x1 | 653 | #define FW_RI_FR_NSMR_WR_QPBINDE_M 0x1 |
| 654 | #define V_FW_RI_FR_NSMR_WR_QPBINDE(x) ((x) << S_FW_RI_FR_NSMR_WR_QPBINDE) | 654 | #define FW_RI_FR_NSMR_WR_QPBINDE_V(x) ((x) << FW_RI_FR_NSMR_WR_QPBINDE_S) |
| 655 | #define G_FW_RI_FR_NSMR_WR_QPBINDE(x) \ | 655 | #define FW_RI_FR_NSMR_WR_QPBINDE_G(x) \ |
| 656 | (((x) >> S_FW_RI_FR_NSMR_WR_QPBINDE) & M_FW_RI_FR_NSMR_WR_QPBINDE) | 656 | (((x) >> FW_RI_FR_NSMR_WR_QPBINDE_S) & FW_RI_FR_NSMR_WR_QPBINDE_M) |
| 657 | #define F_FW_RI_FR_NSMR_WR_QPBINDE V_FW_RI_FR_NSMR_WR_QPBINDE(1U) | 657 | #define FW_RI_FR_NSMR_WR_QPBINDE_F FW_RI_FR_NSMR_WR_QPBINDE_V(1U) |
| 658 | 658 | ||
| 659 | #define S_FW_RI_FR_NSMR_WR_NS 5 | 659 | #define FW_RI_FR_NSMR_WR_NS_S 5 |
| 660 | #define M_FW_RI_FR_NSMR_WR_NS 0x1 | 660 | #define FW_RI_FR_NSMR_WR_NS_M 0x1 |
| 661 | #define V_FW_RI_FR_NSMR_WR_NS(x) ((x) << S_FW_RI_FR_NSMR_WR_NS) | 661 | #define FW_RI_FR_NSMR_WR_NS_V(x) ((x) << FW_RI_FR_NSMR_WR_NS_S) |
| 662 | #define G_FW_RI_FR_NSMR_WR_NS(x) \ | 662 | #define FW_RI_FR_NSMR_WR_NS_G(x) \ |
| 663 | (((x) >> S_FW_RI_FR_NSMR_WR_NS) & M_FW_RI_FR_NSMR_WR_NS) | 663 | (((x) >> FW_RI_FR_NSMR_WR_NS_S) & FW_RI_FR_NSMR_WR_NS_M) |
| 664 | #define F_FW_RI_FR_NSMR_WR_NS V_FW_RI_FR_NSMR_WR_NS(1U) | 664 | #define FW_RI_FR_NSMR_WR_NS_F FW_RI_FR_NSMR_WR_NS_V(1U) |
| 665 | 665 | ||
| 666 | #define S_FW_RI_FR_NSMR_WR_DCACPU 0 | 666 | #define FW_RI_FR_NSMR_WR_DCACPU_S 0 |
| 667 | #define M_FW_RI_FR_NSMR_WR_DCACPU 0x1f | 667 | #define FW_RI_FR_NSMR_WR_DCACPU_M 0x1f |
| 668 | #define V_FW_RI_FR_NSMR_WR_DCACPU(x) ((x) << S_FW_RI_FR_NSMR_WR_DCACPU) | 668 | #define FW_RI_FR_NSMR_WR_DCACPU_V(x) ((x) << FW_RI_FR_NSMR_WR_DCACPU_S) |
| 669 | #define G_FW_RI_FR_NSMR_WR_DCACPU(x) \ | 669 | #define FW_RI_FR_NSMR_WR_DCACPU_G(x) \ |
| 670 | (((x) >> S_FW_RI_FR_NSMR_WR_DCACPU) & M_FW_RI_FR_NSMR_WR_DCACPU) | 670 | (((x) >> FW_RI_FR_NSMR_WR_DCACPU_S) & FW_RI_FR_NSMR_WR_DCACPU_M) |
| 671 | 671 | ||
| 672 | struct fw_ri_inv_lstag_wr { | 672 | struct fw_ri_inv_lstag_wr { |
| 673 | __u8 opcode; | 673 | __u8 opcode; |
| @@ -740,18 +740,18 @@ struct fw_ri_wr { · 66 unmodified lines | |||
| 740 | } u; | 740 | } u; |
| 741 | }; | 741 | }; |
| 742 | 742 | ||
| 743 | #define S_FW_RI_WR_MPAREQBIT 7 | 743 | #define FW_RI_WR_MPAREQBIT_S 7 |
| 744 | #define M_FW_RI_WR_MPAREQBIT 0x1 | 744 | #define FW_RI_WR_MPAREQBIT_M 0x1 |
| 745 | #define V_FW_RI_WR_MPAREQBIT(x) ((x) << S_FW_RI_WR_MPAREQBIT) | 745 | #define FW_RI_WR_MPAREQBIT_V(x) ((x) << FW_RI_WR_MPAREQBIT_S) |
| 746 | #define G_FW_RI_WR_MPAREQBIT(x) \ | 746 | #define FW_RI_WR_MPAREQBIT_G(x) \ |
| 747 | (((x) >> S_FW_RI_WR_MPAREQBIT) & M_FW_RI_WR_MPAREQBIT) | 747 | (((x) >> FW_RI_WR_MPAREQBIT_S) & FW_RI_WR_MPAREQBIT_M) |
| 748 | #define F_FW_RI_WR_MPAREQBIT V_FW_RI_WR_MPAREQBIT(1U) | 748 | #define FW_RI_WR_MPAREQBIT_F FW_RI_WR_MPAREQBIT_V(1U) |
| 749 | 749 | ||
| 750 | #define S_FW_RI_WR_P2PTYPE 0 | 750 | #define FW_RI_WR_P2PTYPE_S 0 |
| 751 | #define M_FW_RI_WR_P2PTYPE 0xf | 751 | #define FW_RI_WR_P2PTYPE_M 0xf |
| 752 | #define V_FW_RI_WR_P2PTYPE(x) ((x) << S_FW_RI_WR_P2PTYPE) | 752 | #define FW_RI_WR_P2PTYPE_V(x) ((x) << FW_RI_WR_P2PTYPE_S) |
| 753 | #define G_FW_RI_WR_P2PTYPE(x) \ | 753 | #define FW_RI_WR_P2PTYPE_G(x) \ |
| 754 | (((x) >> S_FW_RI_WR_P2PTYPE) & M_FW_RI_WR_P2PTYPE) | 754 | (((x) >> FW_RI_WR_P2PTYPE_S) & FW_RI_WR_P2PTYPE_M) |
| 755 | 755 | ||
| 756 | struct tcp_options { | 756 | struct tcp_options { |
| 757 | __be16 mss; | 757 | __be16 mss; |
| @@ -783,58 +783,58 @@ struct cpl_pass_accept_req { · 25 unmodified lines | |||
| 783 | }; | 783 | }; |
| 784 | 784 | ||
| 785 | /* cpl_pass_accept_req.hdr_len fields */ | 785 | /* cpl_pass_accept_req.hdr_len fields */ |
| 786 | #define S_SYN_RX_CHAN 0 | 786 | #define SYN_RX_CHAN_S 0 |
| 787 | #define M_SYN_RX_CHAN 0xF | 787 | #define SYN_RX_CHAN_M 0xF |
| 788 | #define V_SYN_RX_CHAN(x) ((x) << S_SYN_RX_CHAN) | 788 | #define SYN_RX_CHAN_V(x) ((x) << SYN_RX_CHAN_S) |
| 789 | #define G_SYN_RX_CHAN(x) (((x) >> S_SYN_RX_CHAN) & M_SYN_RX_CHAN) | 789 | #define SYN_RX_CHAN_G(x) (((x) >> SYN_RX_CHAN_S) & SYN_RX_CHAN_M) |
| 790 | 790 | ||
| 791 | #define S_TCP_HDR_LEN 10 | 791 | #define TCP_HDR_LEN_S 10 |
| 792 | #define M_TCP_HDR_LEN 0x3F | 792 | #define TCP_HDR_LEN_M 0x3F |
| 793 | #define V_TCP_HDR_LEN(x) ((x) << S_TCP_HDR_LEN) | 793 | #define TCP_HDR_LEN_V(x) ((x) << TCP_HDR_LEN_S) |
| 794 | #define G_TCP_HDR_LEN(x) (((x) >> S_TCP_HDR_LEN) & M_TCP_HDR_LEN) | 794 | #define TCP_HDR_LEN_G(x) (((x) >> TCP_HDR_LEN_S) & TCP_HDR_LEN_M) |
| 795 | 795 | ||
| 796 | #define S_IP_HDR_LEN 16 | 796 | #define IP_HDR_LEN_S 16 |
| 797 | #define M_IP_HDR_LEN 0x3FF | 797 | #define IP_HDR_LEN_M 0x3FF |
| 798 | #define V_IP_HDR_LEN(x) ((x) << S_IP_HDR_LEN) | 798 | #define IP_HDR_LEN_V(x) ((x) << IP_HDR_LEN_S) |
| 799 | #define G_IP_HDR_LEN(x) (((x) >> S_IP_HDR_LEN) & M_IP_HDR_LEN) | 799 | #define IP_HDR_LEN_G(x) (((x) >> IP_HDR_LEN_S) & IP_HDR_LEN_M) |
| 800 | 800 | ||
| 801 | #define S_ETH_HDR_LEN 26 | 801 | #define ETH_HDR_LEN_S 26 |
| 802 | #define M_ETH_HDR_LEN 0x1F | 802 | #define ETH_HDR_LEN_M 0x1F |
| 803 | #define V_ETH_HDR_LEN(x) ((x) << S_ETH_HDR_LEN) | 803 | #define ETH_HDR_LEN_V(x) ((x) << ETH_HDR_LEN_S) |
| 804 | #define G_ETH_HDR_LEN(x) (((x) >> S_ETH_HDR_LEN) & M_ETH_HDR_LEN) | 804 | #define ETH_HDR_LEN_G(x) (((x) >> ETH_HDR_LEN_S) & ETH_HDR_LEN_M) |
| 805 | 805 | ||
| 806 | /* cpl_pass_accept_req.l2info fields */ | 806 | /* cpl_pass_accept_req.l2info fields */ |
| 807 | #define S_SYN_MAC_IDX 0 | 807 | #define SYN_MAC_IDX_S 0 |
| 808 | #define M_SYN_MAC_IDX 0x1FF | 808 | #define SYN_MAC_IDX_M 0x1FF |
| 809 | #define V_SYN_MAC_IDX(x) ((x) << S_SYN_MAC_IDX) | 809 | #define SYN_MAC_IDX_V(x) ((x) << SYN_MAC_IDX_S) |
| 810 | #define G_SYN_MAC_IDX(x) (((x) >> S_SYN_MAC_IDX) & M_SYN_MAC_IDX) | 810 | #define SYN_MAC_IDX_G(x) (((x) >> SYN_MAC_IDX_S) & SYN_MAC_IDX_M) |
| 811 | 811 | ||
| 812 | #define S_SYN_XACT_MATCH 9 | 812 | #define SYN_XACT_MATCH_S 9 |
| 813 | #define V_SYN_XACT_MATCH(x) ((x) << S_SYN_XACT_MATCH) | 813 | #define SYN_XACT_MATCH_V(x) ((x) << SYN_XACT_MATCH_S) |
| 814 | #define F_SYN_XACT_MATCH V_SYN_XACT_MATCH(1U) | 814 | #define SYN_XACT_MATCH_F SYN_XACT_MATCH_V(1U) |
| 815 | 815 | ||
| 816 | #define S_SYN_INTF 12 | 816 | #define SYN_INTF_S 12 |
| 817 | #define M_SYN_INTF 0xF | 817 | #define SYN_INTF_M 0xF |
| 818 | #define V_SYN_INTF(x) ((x) << S_SYN_INTF) | 818 | #define SYN_INTF_V(x) ((x) << SYN_INTF_S) |
| 819 | #define G_SYN_INTF(x) (((x) >> S_SYN_INTF) & M_SYN_INTF) | 819 | #define SYN_INTF_G(x) (((x) >> SYN_INTF_S) & SYN_INTF_M) |
| 820 | 820 | ||
| 821 | struct ulptx_idata { | 821 | struct ulptx_idata { |
| 822 | __be32 cmd_more; | 822 | __be32 cmd_more; |
| 823 | __be32 len; | 823 | __be32 len; |
| 824 | }; | 824 | }; |
| 825 | 825 | ||
| 826 | #define S_ULPTX_NSGE 0 | 826 | #define ULPTX_NSGE_S 0 |
| 827 | #define M_ULPTX_NSGE 0xFFFF | 827 | #define ULPTX_NSGE_M 0xFFFF |
| 828 | #define V_ULPTX_NSGE(x) ((x) << S_ULPTX_NSGE) | 828 | #define ULPTX_NSGE_V(x) ((x) << ULPTX_NSGE_S) |
| 829 | 829 | ||
| 830 | #define S_RX_DACK_MODE 29 | 830 | #define RX_DACK_MODE_S 29 |
| 831 | #define M_RX_DACK_MODE 0x3 | 831 | #define RX_DACK_MODE_M 0x3 |
| 832 | #define V_RX_DACK_MODE(x) ((x) << S_RX_DACK_MODE) | 832 | #define RX_DACK_MODE_V(x) ((x) << RX_DACK_MODE_S) |
| 833 | #define G_RX_DACK_MODE(x) (((x) >> S_RX_DACK_MODE) & M_RX_DACK_MODE) | 833 | #define RX_DACK_MODE_G(x) (((x) >> RX_DACK_MODE_S) & RX_DACK_MODE_M) |
| 834 | 834 | ||
| 835 | #define S_RX_DACK_CHANGE 31 | 835 | #define RX_DACK_CHANGE_S 31 |
| 836 | #define V_RX_DACK_CHANGE(x) ((x) << S_RX_DACK_CHANGE) | 836 | #define RX_DACK_CHANGE_V(x) ((x) << RX_DACK_CHANGE_S) |
| 837 | #define F_RX_DACK_CHANGE V_RX_DACK_CHANGE(1U) | 837 | #define RX_DACK_CHANGE_F RX_DACK_CHANGE_V(1U) |
| 838 | 838 | ||
| 839 | enum { /* TCP congestion control algorithms */ | 839 | enum { /* TCP congestion control algorithms */ |
| 840 | CONG_ALG_RENO, | 840 | CONG_ALG_RENO, |
| @@ -843,10 +843,10 @@ enum { /* TCP congestion control algorithms */ · 2 unmodified lines | |||
| 843 | CONG_ALG_HIGHSPEED | 843 | CONG_ALG_HIGHSPEED |
| 844 | }; | 844 | }; |
| 845 | 845 | ||
| 846 | #define S_CONG_CNTRL 14 | 846 | #define CONG_CNTRL_S 14 |
| 847 | #define M_CONG_CNTRL 0x3 | 847 | #define CONG_CNTRL_M 0x3 |
| 848 | #define V_CONG_CNTRL(x) ((x) << S_CONG_CNTRL) | 848 | #define CONG_CNTRL_V(x) ((x) << CONG_CNTRL_S) |
| 849 | #define G_CONG_CNTRL(x) (((x) >> S_CONG_CNTRL) & M_CONG_CNTRL) | 849 | #define CONG_CNTRL_G(x) (((x) >> CONG_CNTRL_S) & CONG_CNTRL_M) |
| 850 | 850 | ||
| 851 | #define CONG_CNTRL_VALID (1 << 18) | 851 | #define CONG_CNTRL_VALID (1 << 18) |
| 852 | 852 | ||
| @@ -36,6 +36,7 @@ · 35 unmodified lines | |||
| 36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| 37 | #include <linux/inet.h> | 37 | #include <linux/inet.h> |
| 38 | #include <linux/string.h> | 38 | #include <linux/string.h> |
| 39 | #include <linux/mlx4/driver.h> | ||
| 39 | 40 | ||
| 40 | #include "mlx4_ib.h" | 41 | #include "mlx4_ib.h" |
| 41 | 42 | ||
| @@ -154,7 +154,7 @@ void mlx4_ib_notify_slaves_on_guid_change(struct mlx4_ib_dev *dev, · 153 unmodified lines | |||
| 154 | continue; | 154 | continue; |
| 155 | 155 | ||
| 156 | slave_id = (block_num * NUM_ALIAS_GUID_IN_REC) + i ; | 156 | slave_id = (block_num * NUM_ALIAS_GUID_IN_REC) + i ; |
| 157 | if (slave_id >= dev->dev->num_vfs + 1) | 157 | if (slave_id >= dev->dev->persist->num_vfs + 1) |
| 158 | return; | 158 | return; |
| 159 | tmp_cur_ag = *(__be64 *)&p_data[i * GUID_REC_SIZE]; | 159 | tmp_cur_ag = *(__be64 *)&p_data[i * GUID_REC_SIZE]; |
| 160 | form_cache_ag = get_cached_alias_guid(dev, port_num, | 160 | form_cache_ag = get_cached_alias_guid(dev, port_num, |
| @@ -188,6 +188,8 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector · 187 unmodified lines | |||
| 188 | spin_lock_init(&cq->lock); | 188 | spin_lock_init(&cq->lock); |
| 189 | cq->resize_buf = NULL; | 189 | cq->resize_buf = NULL; |
| 190 | cq->resize_umem = NULL; | 190 | cq->resize_umem = NULL; |
| 191 | INIT_LIST_HEAD(&cq->send_qp_list); | ||
| 192 | INIT_LIST_HEAD(&cq->recv_qp_list); | ||
| 191 | 193 | ||
| 192 | if (context) { | 194 | if (context) { |
| 193 | struct mlx4_ib_create_cq ucmd; | 195 | struct mlx4_ib_create_cq ucmd; |
| @@ -594,6 +596,55 @@ static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct · 400 unmodified lines | |||
| 594 | return 0; | 596 | return 0; |
| 595 | } | 597 | } |
| 596 | 598 | ||
| 599 | static void mlx4_ib_qp_sw_comp(struct mlx4_ib_qp *qp, int num_entries, | ||
| 600 | struct ib_wc *wc, int *npolled, int is_send) | ||
| 601 | { | ||
| 602 | struct mlx4_ib_wq *wq; | ||
| 603 | unsigned cur; | ||
| 604 | int i; | ||
| 605 | |||
| 606 | wq = is_send ? &qp->sq : &qp->rq; | ||
| 607 | cur = wq->head - wq->tail; | ||
| 608 | |||
| 609 | if (cur == 0) | ||
| 610 | return; | ||
| 611 | |||
| 612 | for (i = 0; i < cur && *npolled < num_entries; i++) { | ||
| 613 | wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; | ||
| 614 | wc->status = IB_WC_WR_FLUSH_ERR; | ||
| 615 | wc->vendor_err = MLX4_CQE_SYNDROME_WR_FLUSH_ERR; | ||
| 616 | wq->tail++; | ||
| 617 | (*npolled)++; | ||
| 618 | wc->qp = &qp->ibqp; | ||
| 619 | wc++; | ||
| 620 | } | ||
| 621 | } | ||
| 622 | |||
| 623 | static void mlx4_ib_poll_sw_comp(struct mlx4_ib_cq *cq, int num_entries, | ||
| 624 | struct ib_wc *wc, int *npolled) | ||
| 625 | { | ||
| 626 | struct mlx4_ib_qp *qp; | ||
| 627 | |||
| 628 | *npolled = 0; | ||
| 629 | /* Find uncompleted WQEs belonging to that cq and retrun | ||
| 630 | * simulated FLUSH_ERR completions | ||
| 631 | */ | ||
| 632 | list_for_each_entry(qp, &cq->send_qp_list, cq_send_list) { | ||
| 633 | mlx4_ib_qp_sw_comp(qp, num_entries, wc, npolled, 1); | ||
| 634 | if (*npolled >= num_entries) | ||
| 635 | goto out; | ||
| 636 | } | ||
| 637 | |||
| 638 | list_for_each_entry(qp, &cq->recv_qp_list, cq_recv_list) { | ||
| 639 | mlx4_ib_qp_sw_comp(qp, num_entries, wc + *npolled, npolled, 0); | ||
| 640 | if (*npolled >= num_entries) | ||
| 641 | goto out; | ||
| 642 | } | ||
| 643 | |||
| 644 | out: | ||
| 645 | return; | ||
| 646 | } | ||
| 647 | |||
| 597 | static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, | 648 | static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, |
| 598 | struct mlx4_ib_qp **cur_qp, | 649 | struct mlx4_ib_qp **cur_qp, |
| 599 | struct ib_wc *wc) | 650 | struct ib_wc *wc) |
| @@ -836,8 +887,13 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 236 unmodified lines | |||
| 836 | unsigned long flags; | 887 | unsigned long flags; |
| 837 | int npolled; | 888 | int npolled; |
| 838 | int err = 0; | 889 | int err = 0; |
| 890 | struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); | ||
| 839 | 891 | ||
| 840 | spin_lock_irqsave(&cq->lock, flags); | 892 | spin_lock_irqsave(&cq->lock, flags); |
| 893 | if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { | ||
| 894 | mlx4_ib_poll_sw_comp(cq, num_entries, wc, &npolled); | ||
| 895 | goto out; | ||
| 896 | } | ||
| 841 | 897 | ||
| 842 | for (npolled = 0; npolled < num_entries; ++npolled) { | 898 | for (npolled = 0; npolled < num_entries; ++npolled) { |
| 843 | err = mlx4_ib_poll_one(cq, &cur_qp, wc + npolled); | 899 | err = mlx4_ib_poll_one(cq, &cur_qp, wc + npolled); |
| @@ -847,6 +903,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 3 unmodified lines | |||
| 847 | 903 | ||
| 848 | mlx4_cq_set_ci(&cq->mcq); | 904 | mlx4_cq_set_ci(&cq->mcq); |
| 849 | 905 | ||
| 906 | out: | ||
| 850 | spin_unlock_irqrestore(&cq->lock, flags); | 907 | spin_unlock_irqrestore(&cq->lock, flags); |
| 851 | 908 | ||
| 852 | if (err == 0 || err == -EAGAIN) | 909 | if (err == 0 || err == -EAGAIN) |
| @@ -1951,7 +1951,8 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, · 1950 unmodified lines | |||
| 1951 | ctx->ib_dev = &dev->ib_dev; | 1951 | ctx->ib_dev = &dev->ib_dev; |
| 1952 | 1952 | ||
| 1953 | for (i = 0; | 1953 | for (i = 0; |
| 1954 | i < min(dev->dev->caps.sqp_demux, (u16)(dev->dev->num_vfs + 1)); | 1954 | i < min(dev->dev->caps.sqp_demux, |
| 1955 | (u16)(dev->dev->persist->num_vfs + 1)); | ||
| 1955 | i++) { | 1956 | i++) { |
| 1956 | struct mlx4_active_ports actv_ports = | 1957 | struct mlx4_active_ports actv_ports = |
| 1957 | mlx4_get_active_ports(dev->dev, i); | 1958 | mlx4_get_active_ports(dev->dev, i); |
| @@ -198,7 +198,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 197 unmodified lines | |||
| 198 | 198 | ||
| 199 | props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) & | 199 | props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) & |
| 200 | 0xffffff; | 200 | 0xffffff; |
| 201 | props->vendor_part_id = dev->dev->pdev->device; | 201 | props->vendor_part_id = dev->dev->persist->pdev->device; |
| 202 | props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32)); | 202 | props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32)); |
| 203 | memcpy(&props->sys_image_guid, out_mad->data + 4, 8); | 203 | memcpy(&props->sys_image_guid, out_mad->data + 4, 8); |
| 204 | 204 | ||
| @@ -351,6 +351,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 146 unmodified lines | |||
| 351 | enum ib_mtu tmp; | 351 | enum ib_mtu tmp; |
| 352 | struct mlx4_cmd_mailbox *mailbox; | 352 | struct mlx4_cmd_mailbox *mailbox; |
| 353 | int err = 0; | 353 | int err = 0; |
| 354 | int is_bonded = mlx4_is_bonded(mdev->dev); | ||
| 354 | 355 | ||
| 355 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); | 356 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); |
| 356 | if (IS_ERR(mailbox)) | 357 | if (IS_ERR(mailbox)) |
| @@ -374,8 +375,12 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 17 unmodified lines | |||
| 374 | props->state = IB_PORT_DOWN; | 375 | props->state = IB_PORT_DOWN; |
| 375 | props->phys_state = state_to_phys_state(props->state); | 376 | props->phys_state = state_to_phys_state(props->state); |
| 376 | props->active_mtu = IB_MTU_256; | 377 | props->active_mtu = IB_MTU_256; |
| 378 | if (is_bonded) | ||
| 379 | rtnl_lock(); /* required to get upper dev */ | ||
| 377 | spin_lock_bh(&iboe->lock); | 380 | spin_lock_bh(&iboe->lock); |
| 378 | ndev = iboe->netdevs[port - 1]; | 381 | ndev = iboe->netdevs[port - 1]; |
| 382 | if (ndev && is_bonded) | ||
| 383 | ndev = netdev_master_upper_dev_get(ndev); | ||
| 379 | if (!ndev) | 384 | if (!ndev) |
| 380 | goto out_unlock; | 385 | goto out_unlock; |
| 381 | 386 | ||
| @@ -387,6 +392,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 5 unmodified lines | |||
| 387 | props->phys_state = state_to_phys_state(props->state); | 392 | props->phys_state = state_to_phys_state(props->state); |
| 388 | out_unlock: | 393 | out_unlock: |
| 389 | spin_unlock_bh(&iboe->lock); | 394 | spin_unlock_bh(&iboe->lock); |
| 395 | if (is_bonded) | ||
| 396 | rtnl_unlock(); | ||
| 390 | out: | 397 | out: |
| 391 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); | 398 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); |
| 392 | return err; | 399 | return err; |
| @@ -844,7 +851,7 @@ int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, · 451 unmodified lines | |||
| 844 | 851 | ||
| 845 | struct mlx4_ib_steering { | 852 | struct mlx4_ib_steering { |
| 846 | struct list_head list; | 853 | struct list_head list; |
| 847 | u64 reg_id; | 854 | struct mlx4_flow_reg_id reg_id; |
| 848 | union ib_gid gid; | 855 | union ib_gid gid; |
| 849 | }; | 856 | }; |
| 850 | 857 | ||
| @@ -1135,9 +1142,11 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 284 unmodified lines | |||
| 1135 | struct ib_flow_attr *flow_attr, | 1142 | struct ib_flow_attr *flow_attr, |
| 1136 | int domain) | 1143 | int domain) |
| 1137 | { | 1144 | { |
| 1138 | int err = 0, i = 0; | 1145 | int err = 0, i = 0, j = 0; |
| 1139 | struct mlx4_ib_flow *mflow; | 1146 | struct mlx4_ib_flow *mflow; |
| 1140 | enum mlx4_net_trans_promisc_mode type[2]; | 1147 | enum mlx4_net_trans_promisc_mode type[2]; |
| 1148 | struct mlx4_dev *dev = (to_mdev(qp->device))->dev; | ||
| 1149 | int is_bonded = mlx4_is_bonded(dev); | ||
| 1141 | 1150 | ||
| 1142 | memset(type, 0, sizeof(type)); | 1151 | memset(type, 0, sizeof(type)); |
| 1143 | 1152 | ||
| @@ -1172,26 +1181,58 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 28 unmodified lines | |||
| 1172 | 1181 | ||
| 1173 | while (i < ARRAY_SIZE(type) && type[i]) { | 1182 | while (i < ARRAY_SIZE(type) && type[i]) { |
| 1174 | err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], | 1183 | err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], |
| 1175 | &mflow->reg_id[i]); | 1184 | &mflow->reg_id[i].id); |
| 1176 | if (err) | 1185 | if (err) |
| 1177 | goto err_create_flow; | 1186 | goto err_create_flow; |
| 1178 | i++; | 1187 | i++; |
| 1188 | if (is_bonded) { | ||
| 1189 | /* Application always sees one port so the mirror rule | ||
| 1190 | * must be on port #2 | ||
| 1191 | */ | ||
| 1192 | flow_attr->port = 2; | ||
| 1193 | err = __mlx4_ib_create_flow(qp, flow_attr, | ||
| 1194 | domain, type[j], | ||
| 1195 | &mflow->reg_id[j].mirror); | ||
| 1196 | flow_attr->port = 1; | ||
| 1197 | if (err) | ||
| 1198 | goto err_create_flow; | ||
| 1199 | j++; | ||
| 1200 | } | ||
| 1201 | |||
| 1179 | } | 1202 | } |
| 1180 | 1203 | ||
| 1181 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { | 1204 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { |
| 1182 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); | 1205 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, |
| 1206 | &mflow->reg_id[i].id); | ||
| 1183 | if (err) | 1207 | if (err) |
| 1184 | goto err_create_flow; | 1208 | goto err_create_flow; |
| 1185 | i++; | 1209 | i++; |
| 1210 | if (is_bonded) { | ||
| 1211 | flow_attr->port = 2; | ||
| 1212 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, | ||
| 1213 | &mflow->reg_id[j].mirror); | ||
| 1214 | flow_attr->port = 1; | ||
| 1215 | if (err) | ||
| 1216 | goto err_create_flow; | ||
| 1217 | j++; | ||
| 1218 | } | ||
| 1219 | /* function to create mirror rule */ | ||
| 1186 | } | 1220 | } |
| 1187 | 1221 | ||
| 1188 | return &mflow->ibflow; | 1222 | return &mflow->ibflow; |
| 1189 | 1223 | ||
| 1190 | err_create_flow: | 1224 | err_create_flow: |
| 1191 | while (i) { | 1225 | while (i) { |
| 1192 | (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, mflow->reg_id[i]); | 1226 | (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, |
| 1227 | mflow->reg_id[i].id); | ||
| 1193 | i--; | 1228 | i--; |
| 1194 | } | 1229 | } |
| 1230 | |||
| 1231 | while (j) { | ||
| 1232 | (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, | ||
| 1233 | mflow->reg_id[j].mirror); | ||
| 1234 | j--; | ||
| 1235 | } | ||
| 1195 | err_free: | 1236 | err_free: |
| 1196 | kfree(mflow); | 1237 | kfree(mflow); |
| 1197 | return ERR_PTR(err); | 1238 | return ERR_PTR(err); |
| @@ -1204,10 +1245,16 @@ static int mlx4_ib_destroy_flow(struct ib_flow *flow_id) · 6 unmodified lines | |||
| 1204 | struct mlx4_ib_dev *mdev = to_mdev(flow_id->qp->device); | 1245 | struct mlx4_ib_dev *mdev = to_mdev(flow_id->qp->device); |
| 1205 | struct mlx4_ib_flow *mflow = to_mflow(flow_id); | 1246 | struct mlx4_ib_flow *mflow = to_mflow(flow_id); |
| 1206 | 1247 | ||
| 1207 | while (i < ARRAY_SIZE(mflow->reg_id) && mflow->reg_id[i]) { | 1248 | while (i < ARRAY_SIZE(mflow->reg_id) && mflow->reg_id[i].id) { |
| 1208 | err = __mlx4_ib_destroy_flow(mdev->dev, mflow->reg_id[i]); | 1249 | err = __mlx4_ib_destroy_flow(mdev->dev, mflow->reg_id[i].id); |
| 1209 | if (err) | 1250 | if (err) |
| 1210 | ret = err; | 1251 | ret = err; |
| 1252 | if (mflow->reg_id[i].mirror) { | ||
| 1253 | err = __mlx4_ib_destroy_flow(mdev->dev, | ||
| 1254 | mflow->reg_id[i].mirror); | ||
| 1255 | if (err) | ||
| 1256 | ret = err; | ||
| 1257 | } | ||
| 1211 | i++; | 1258 | i++; |
| 1212 | } | 1259 | } |
| 1213 | 1260 | ||
| @@ -1219,11 +1266,12 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 5 unmodified lines | |||
| 1219 | { | 1266 | { |
| 1220 | int err; | 1267 | int err; |
| 1221 | struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); | 1268 | struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); |
| 1269 | struct mlx4_dev *dev = mdev->dev; | ||
| 1222 | struct mlx4_ib_qp *mqp = to_mqp(ibqp); | 1270 | struct mlx4_ib_qp *mqp = to_mqp(ibqp); |
| 1223 | u64 reg_id; | ||
| 1224 | struct mlx4_ib_steering *ib_steering = NULL; | 1271 | struct mlx4_ib_steering *ib_steering = NULL; |
| 1225 | enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? | 1272 | enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? |
| 1226 | MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; | 1273 | MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; |
| 1274 | struct mlx4_flow_reg_id reg_id; | ||
| 1227 | 1275 | ||
| 1228 | if (mdev->dev->caps.steering_mode == | 1276 | if (mdev->dev->caps.steering_mode == |
| 1229 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | 1277 | MLX4_STEERING_MODE_DEVICE_MANAGED) { |
| @@ -1235,10 +1283,21 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 5 unmodified lines | |||
| 1235 | err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw, mqp->port, | 1283 | err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw, mqp->port, |
| 1236 | !!(mqp->flags & | 1284 | !!(mqp->flags & |
| 1237 | MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK), | 1285 | MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK), |
| 1238 | prot, ®_id); | 1286 | prot, ®_id.id); |
| 1239 | if (err) | 1287 | if (err) |
| 1240 | goto err_malloc; | 1288 | goto err_malloc; |
| 1241 | 1289 | ||
| 1290 | reg_id.mirror = 0; | ||
| 1291 | if (mlx4_is_bonded(dev)) { | ||
| 1292 | err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw, | ||
| 1293 | (mqp->port == 1) ? 2 : 1, | ||
| 1294 | !!(mqp->flags & | ||
| 1295 | MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK), | ||
| 1296 | prot, ®_id.mirror); | ||
| 1297 | if (err) | ||
| 1298 | goto err_add; | ||
| 1299 | } | ||
| 1300 | |||
| 1242 | err = add_gid_entry(ibqp, gid); | 1301 | err = add_gid_entry(ibqp, gid); |
| 1243 | if (err) | 1302 | if (err) |
| 1244 | goto err_add; | 1303 | goto err_add; |
| @@ -1254,7 +1313,10 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 9 unmodified lines | |||
| 1254 | 1313 | ||
| 1255 | err_add: | 1314 | err_add: |
| 1256 | mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, | 1315 | mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, |
| 1257 | prot, reg_id); | 1316 | prot, reg_id.id); |
| 1317 | if (reg_id.mirror) | ||
| 1318 | mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, | ||
| 1319 | prot, reg_id.mirror); | ||
| 1258 | err_malloc: | 1320 | err_malloc: |
| 1259 | kfree(ib_steering); | 1321 | kfree(ib_steering); |
| 1260 | 1322 | ||
| @@ -1281,10 +1343,12 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 20 unmodified lines | |||
| 1281 | { | 1343 | { |
| 1282 | int err; | 1344 | int err; |
| 1283 | struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); | 1345 | struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); |
| 1346 | struct mlx4_dev *dev = mdev->dev; | ||
| 1284 | struct mlx4_ib_qp *mqp = to_mqp(ibqp); | 1347 | struct mlx4_ib_qp *mqp = to_mqp(ibqp); |
| 1285 | struct net_device *ndev; | 1348 | struct net_device *ndev; |
| 1286 | struct mlx4_ib_gid_entry *ge; | 1349 | struct mlx4_ib_gid_entry *ge; |
| 1287 | u64 reg_id = 0; | 1350 | struct mlx4_flow_reg_id reg_id = {0, 0}; |
| 1351 | |||
| 1288 | enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? | 1352 | enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? |
| 1289 | MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; | 1353 | MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; |
| 1290 | 1354 | ||
| @@ -1309,10 +1373,17 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) · 18 unmodified lines | |||
| 1309 | } | 1373 | } |
| 1310 | 1374 | ||
| 1311 | err = mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, | 1375 | err = mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, |
| 1312 | prot, reg_id); | 1376 | prot, reg_id.id); |
| 1313 | if (err) | 1377 | if (err) |
| 1314 | return err; | 1378 | return err; |
| 1315 | 1379 | ||
| 1380 | if (mlx4_is_bonded(dev)) { | ||
| 1381 | err = mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, | ||
| 1382 | prot, reg_id.mirror); | ||
| 1383 | if (err) | ||
| 1384 | return err; | ||
| 1385 | } | ||
| 1386 | |||
| 1316 | mutex_lock(&mqp->mutex); | 1387 | mutex_lock(&mqp->mutex); |
| 1317 | ge = find_gid_entry(mqp, gid->raw); | 1388 | ge = find_gid_entry(mqp, gid->raw); |
| 1318 | if (ge) { | 1389 | if (ge) { |
| @@ -1376,7 +1447,7 @@ static ssize_t show_hca(struct device *device, struct device_attribute *attr, · 57 unmodified lines | |||
| 1376 | { | 1447 | { |
| 1377 | struct mlx4_ib_dev *dev = | 1448 | struct mlx4_ib_dev *dev = |
| 1378 | container_of(device, struct mlx4_ib_dev, ib_dev.dev); | 1449 | container_of(device, struct mlx4_ib_dev, ib_dev.dev); |
| 1379 | return sprintf(buf, "MT%d\n", dev->dev->pdev->device); | 1450 | return sprintf(buf, "MT%d\n", dev->dev->persist->pdev->device); |
| 1380 | } | 1451 | } |
| 1381 | 1452 | ||
| 1382 | static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr, | 1453 | static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr, |
| @@ -1440,6 +1511,7 @@ static void update_gids_task(struct work_struct *work) · 57 unmodified lines | |||
| 1440 | union ib_gid *gids; | 1511 | union ib_gid *gids; |
| 1441 | int err; | 1512 | int err; |
| 1442 | struct mlx4_dev *dev = gw->dev->dev; | 1513 | struct mlx4_dev *dev = gw->dev->dev; |
| 1514 | int is_bonded = mlx4_is_bonded(dev); | ||
| 1443 | 1515 | ||
| 1444 | if (!gw->dev->ib_active) | 1516 | if (!gw->dev->ib_active) |
| 1445 | return; | 1517 | return; |
| @@ -1459,7 +1531,10 @@ static void update_gids_task(struct work_struct *work) · 13 unmodified lines | |||
| 1459 | if (err) | 1531 | if (err) |
| 1460 | pr_warn("set port command failed\n"); | 1532 | pr_warn("set port command failed\n"); |
| 1461 | else | 1533 | else |
| 1462 | mlx4_ib_dispatch_event(gw->dev, gw->port, IB_EVENT_GID_CHANGE); | 1534 | if ((gw->port == 1) || !is_bonded) |
| 1535 | mlx4_ib_dispatch_event(gw->dev, | ||
| 1536 | is_bonded ? 1 : gw->port, | ||
| 1537 | IB_EVENT_GID_CHANGE); | ||
| 1463 | 1538 | ||
| 1464 | mlx4_free_cmd_mailbox(dev, mailbox); | 1539 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 1465 | kfree(gw); | 1540 | kfree(gw); |
| @@ -1875,7 +1950,8 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, · 409 unmodified lines | |||
| 1875 | * don't want the bond IP based gids in the table since | 1950 | * don't want the bond IP based gids in the table since |
| 1876 | * flows that select port by gid may get the down port. | 1951 | * flows that select port by gid may get the down port. |
| 1877 | */ | 1952 | */ |
| 1878 | if (port_state == IB_PORT_DOWN) { | 1953 | if (port_state == IB_PORT_DOWN && |
| 1954 | !mlx4_is_bonded(ibdev->dev)) { | ||
| 1879 | reset_gid_table(ibdev, port); | 1955 | reset_gid_table(ibdev, port); |
| 1880 | mlx4_ib_set_default_gid(ibdev, | 1956 | mlx4_ib_set_default_gid(ibdev, |
| 1881 | curr_netdev, | 1957 | curr_netdev, |
| @@ -1938,7 +2014,8 @@ static void init_pkeys(struct mlx4_ib_dev *ibdev) · 56 unmodified lines | |||
| 1938 | int i; | 2014 | int i; |
| 1939 | 2015 | ||
| 1940 | if (mlx4_is_master(ibdev->dev)) { | 2016 | if (mlx4_is_master(ibdev->dev)) { |
| 1941 | for (slave = 0; slave <= ibdev->dev->num_vfs; ++slave) { | 2017 | for (slave = 0; slave <= ibdev->dev->persist->num_vfs; |
| 2018 | ++slave) { | ||
| 1942 | for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) { | 2019 | for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) { |
| 1943 | for (i = 0; | 2020 | for (i = 0; |
| 1944 | i < ibdev->dev->phys_caps.pkey_phys_table_len[port]; | 2021 | i < ibdev->dev->phys_caps.pkey_phys_table_len[port]; |
| @@ -1995,7 +2072,7 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) · 50 unmodified lines | |||
| 1995 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) { | 2072 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) { |
| 1996 | for (j = 0; j < eq_per_port; j++) { | 2073 | for (j = 0; j < eq_per_port; j++) { |
| 1997 | snprintf(name, sizeof(name), "mlx4-ib-%d-%d@%s", | 2074 | snprintf(name, sizeof(name), "mlx4-ib-%d-%d@%s", |
| 1998 | i, j, dev->pdev->bus->name); | 2075 | i, j, dev->persist->pdev->bus->name); |
| 1999 | /* Set IRQ for specific name (per ring) */ | 2076 | /* Set IRQ for specific name (per ring) */ |
| 2000 | if (mlx4_assign_eq(dev, name, NULL, | 2077 | if (mlx4_assign_eq(dev, name, NULL, |
| 2001 | &ibdev->eq_table[eq])) { | 2078 | &ibdev->eq_table[eq])) { |
| @@ -2046,6 +2123,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 44 unmodified lines | |||
| 2046 | int err; | 2123 | int err; |
| 2047 | struct mlx4_ib_iboe *iboe; | 2124 | struct mlx4_ib_iboe *iboe; |
| 2048 | int ib_num_ports = 0; | 2125 | int ib_num_ports = 0; |
| 2126 | int num_req_counters; | ||
| 2049 | 2127 | ||
| 2050 | pr_info_once("%s", mlx4_ib_version); | 2128 | pr_info_once("%s", mlx4_ib_version); |
| 2051 | 2129 | ||
| @@ -2059,7 +2137,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 7 unmodified lines | |||
| 2059 | 2137 | ||
| 2060 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); | 2138 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); |
| 2061 | if (!ibdev) { | 2139 | if (!ibdev) { |
| 2062 | dev_err(&dev->pdev->dev, "Device struct alloc failed\n"); | 2140 | dev_err(&dev->persist->pdev->dev, |
| 2141 | "Device struct alloc failed\n"); | ||
| 2063 | return NULL; | 2142 | return NULL; |
| 2064 | } | 2143 | } |
| 2065 | 2144 | ||
| @@ -2078,15 +2157,17 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 12 unmodified lines | |||
| 2078 | MLX4_INIT_DOORBELL_LOCK(&ibdev->uar_lock); | 2157 | MLX4_INIT_DOORBELL_LOCK(&ibdev->uar_lock); |
| 2079 | 2158 | ||
| 2080 | ibdev->dev = dev; | 2159 | ibdev->dev = dev; |
| 2160 | ibdev->bond_next_port = 0; | ||
| 2081 | 2161 | ||
| 2082 | strlcpy(ibdev->ib_dev.name, "mlx4_%d", IB_DEVICE_NAME_MAX); | 2162 | strlcpy(ibdev->ib_dev.name, "mlx4_%d", IB_DEVICE_NAME_MAX); |
| 2083 | ibdev->ib_dev.owner = THIS_MODULE; | 2163 | ibdev->ib_dev.owner = THIS_MODULE; |
| 2084 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; | 2164 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; |
| 2085 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; | 2165 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; |
| 2086 | ibdev->num_ports = num_ports; | 2166 | ibdev->num_ports = num_ports; |
| 2087 | ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; | 2167 | ibdev->ib_dev.phys_port_cnt = mlx4_is_bonded(dev) ? |
| 2168 | 1 : ibdev->num_ports; | ||
| 2088 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; | 2169 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; |
| 2089 | ibdev->ib_dev.dma_device = &dev->pdev->dev; | 2170 | ibdev->ib_dev.dma_device = &dev->persist->pdev->dev; |
| 2090 | 2171 | ||
| 2091 | if (dev->caps.userspace_caps) | 2172 | if (dev->caps.userspace_caps) |
| 2092 | ibdev->ib_dev.uverbs_abi_ver = MLX4_IB_UVERBS_ABI_VERSION; | 2173 | ibdev->ib_dev.uverbs_abi_ver = MLX4_IB_UVERBS_ABI_VERSION; |
| @@ -2205,7 +2286,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 112 unmodified lines | |||
| 2205 | if (init_node_data(ibdev)) | 2286 | if (init_node_data(ibdev)) |
| 2206 | goto err_map; | 2287 | goto err_map; |
| 2207 | 2288 | ||
| 2208 | for (i = 0; i < ibdev->num_ports; ++i) { | 2289 | num_req_counters = mlx4_is_bonded(dev) ? 1 : ibdev->num_ports; |
| 2290 | for (i = 0; i < num_req_counters; ++i) { | ||
| 2209 | mutex_init(&ibdev->qp1_proxy_lock[i]); | 2291 | mutex_init(&ibdev->qp1_proxy_lock[i]); |
| 2210 | if (mlx4_ib_port_link_layer(&ibdev->ib_dev, i + 1) == | 2292 | if (mlx4_ib_port_link_layer(&ibdev->ib_dev, i + 1) == |
| 2211 | IB_LINK_LAYER_ETHERNET) { | 2293 | IB_LINK_LAYER_ETHERNET) { |
| @@ -2216,12 +2298,18 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 4 unmodified lines | |||
| 2216 | ibdev->counters[i] = -1; | 2298 | ibdev->counters[i] = -1; |
| 2217 | } | 2299 | } |
| 2218 | } | 2300 | } |
| 2301 | if (mlx4_is_bonded(dev)) | ||
| 2302 | for (i = 1; i < ibdev->num_ports ; ++i) | ||
| 2303 | ibdev->counters[i] = ibdev->counters[0]; | ||
| 2304 | |||
| 2219 | 2305 | ||
| 2220 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | 2306 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) |
| 2221 | ib_num_ports++; | 2307 | ib_num_ports++; |
| 2222 | 2308 | ||
| 2223 | spin_lock_init(&ibdev->sm_lock); | 2309 | spin_lock_init(&ibdev->sm_lock); |
| 2224 | mutex_init(&ibdev->cap_mask_mutex); | 2310 | mutex_init(&ibdev->cap_mask_mutex); |
| 2311 | INIT_LIST_HEAD(&ibdev->qp_list); | ||
| 2312 | spin_lock_init(&ibdev->reset_flow_resource_lock); | ||
| 2225 | 2313 | ||
| 2226 | if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED && | 2314 | if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED && |
| 2227 | ib_num_ports) { | 2315 | ib_num_ports) { |
| @@ -2237,7 +2325,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) · 9 unmodified lines | |||
| 2237 | sizeof(long), | 2325 | sizeof(long), |
| 2238 | GFP_KERNEL); | 2326 | GFP_KERNEL); |
| 2239 | if (!ibdev->ib_uc_qpns_bitmap) { | 2327 | if (!ibdev->ib_uc_qpns_bitmap) { |
| 2240 | dev_err(&dev->pdev->dev, "bit map alloc failed\n"); | 2328 | dev_err(&dev->persist->pdev->dev, |
| 2329 | "bit map alloc failed\n"); | ||
| 2241 | goto err_steer_qp_release; | 2330 | goto err_steer_qp_release; |
| 2242 | } | 2331 | } |
| 2243 | 2332 | ||
| @@ -2535,6 +2624,99 @@ out: · 291 unmodified lines | |||
| 2535 | return; | 2624 | return; |
| 2536 | } | 2625 | } |
| 2537 | 2626 | ||
| 2627 | static void mlx4_ib_handle_catas_error(struct mlx4_ib_dev *ibdev) | ||
| 2628 | { | ||
| 2629 | struct mlx4_ib_qp *mqp; | ||
| 2630 | unsigned long flags_qp; | ||
| 2631 | unsigned long flags_cq; | ||
| 2632 | struct mlx4_ib_cq *send_mcq, *recv_mcq; | ||
| 2633 | struct list_head cq_notify_list; | ||
| 2634 | struct mlx4_cq *mcq; | ||
| 2635 | unsigned long flags; | ||
| 2636 | |||
| 2637 | pr_warn("mlx4_ib_handle_catas_error was started\n"); | ||
| 2638 | INIT_LIST_HEAD(&cq_notify_list); | ||
| 2639 | |||
| 2640 | /* Go over qp list reside on that ibdev, sync with create/destroy qp.*/ | ||
| 2641 | spin_lock_irqsave(&ibdev->reset_flow_resource_lock, flags); | ||
| 2642 | |||
| 2643 | list_for_each_entry(mqp, &ibdev->qp_list, qps_list) { | ||
| 2644 | spin_lock_irqsave(&mqp->sq.lock, flags_qp); | ||
| 2645 | if (mqp->sq.tail != mqp->sq.head) { | ||
| 2646 | send_mcq = to_mcq(mqp->ibqp.send_cq); | ||
| 2647 | spin_lock_irqsave(&send_mcq->lock, flags_cq); | ||
| 2648 | if (send_mcq->mcq.comp && | ||
| 2649 | mqp->ibqp.send_cq->comp_handler) { | ||
| 2650 | if (!send_mcq->mcq.reset_notify_added) { | ||
| 2651 | send_mcq->mcq.reset_notify_added = 1; | ||
| 2652 | list_add_tail(&send_mcq->mcq.reset_notify, | ||
| 2653 | &cq_notify_list); | ||
| 2654 | } | ||
| 2655 | } | ||
| 2656 | spin_unlock_irqrestore(&send_mcq->lock, flags_cq); | ||
| 2657 | } | ||
| 2658 | spin_unlock_irqrestore(&mqp->sq.lock, flags_qp); | ||
| 2659 | /* Now, handle the QP's receive queue */ | ||
| 2660 | spin_lock_irqsave(&mqp->rq.lock, flags_qp); | ||
| 2661 | /* no handling is needed for SRQ */ | ||
| 2662 | if (!mqp->ibqp.srq) { | ||
| 2663 | if (mqp->rq.tail != mqp->rq.head) { | ||
| 2664 | recv_mcq = to_mcq(mqp->ibqp.recv_cq); | ||
| 2665 | spin_lock_irqsave(&recv_mcq->lock, flags_cq); | ||
| 2666 | if (recv_mcq->mcq.comp && | ||
| 2667 | mqp->ibqp.recv_cq->comp_handler) { | ||
| 2668 | if (!recv_mcq->mcq.reset_notify_added) { | ||
| 2669 | recv_mcq->mcq.reset_notify_added = 1; | ||
| 2670 | list_add_tail(&recv_mcq->mcq.reset_notify, | ||
| 2671 | &cq_notify_list); | ||
| 2672 | } | ||
| 2673 | } | ||
| 2674 | spin_unlock_irqrestore(&recv_mcq->lock, | ||
| 2675 | flags_cq); | ||
| 2676 | } | ||
| 2677 | } | ||
| 2678 | spin_unlock_irqrestore(&mqp->rq.lock, flags_qp); | ||
| 2679 | } | ||
| 2680 | |||
| 2681 | list_for_each_entry(mcq, &cq_notify_list, reset_notify) { | ||
| 2682 | mcq->comp(mcq); | ||
| 2683 | } | ||
| 2684 | spin_unlock_irqrestore(&ibdev->reset_flow_resource_lock, flags); | ||
| 2685 | pr_warn("mlx4_ib_handle_catas_error ended\n"); | ||
| 2686 | } | ||
| 2687 | |||
| 2688 | static void handle_bonded_port_state_event(struct work_struct *work) | ||
| 2689 | { | ||
| 2690 | struct ib_event_work *ew = | ||
| 2691 | container_of(work, struct ib_event_work, work); | ||
| 2692 | struct mlx4_ib_dev *ibdev = ew->ib_dev; | ||
| 2693 | enum ib_port_state bonded_port_state = IB_PORT_NOP; | ||
| 2694 | int i; | ||
| 2695 | struct ib_event ibev; | ||
| 2696 | |||
| 2697 | kfree(ew); | ||
| 2698 | spin_lock_bh(&ibdev->iboe.lock); | ||
| 2699 | for (i = 0; i < MLX4_MAX_PORTS; ++i) { | ||
| 2700 | struct net_device *curr_netdev = ibdev->iboe.netdevs[i]; | ||
| 2701 | |||
| 2702 | enum ib_port_state curr_port_state = | ||
| 2703 | (netif_running(curr_netdev) && | ||
| 2704 | netif_carrier_ok(curr_netdev)) ? | ||
| 2705 | IB_PORT_ACTIVE : IB_PORT_DOWN; | ||
| 2706 | |||
| 2707 | bonded_port_state = (bonded_port_state != IB_PORT_ACTIVE) ? | ||
| 2708 | curr_port_state : IB_PORT_ACTIVE; | ||
| 2709 | } | ||
| 2710 | spin_unlock_bh(&ibdev->iboe.lock); | ||
| 2711 | |||
| 2712 | ibev.device = &ibdev->ib_dev; | ||
| 2713 | ibev.element.port_num = 1; | ||
| 2714 | ibev.event = (bonded_port_state == IB_PORT_ACTIVE) ? | ||
| 2715 | IB_EVENT_PORT_ACTIVE : IB_EVENT_PORT_ERR; | ||
| 2716 | |||
| 2717 | ib_dispatch_event(&ibev); | ||
| 2718 | } | ||
| 2719 | |||
| 2538 | static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, | 2720 | static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, |
| 2539 | enum mlx4_dev_event event, unsigned long param) | 2721 | enum mlx4_dev_event event, unsigned long param) |
| 2540 | { | 2722 | { |
| @@ -2544,6 +2726,18 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 3 unmodified lines | |||
| 2544 | struct ib_event_work *ew; | 2726 | struct ib_event_work *ew; |
| 2545 | int p = 0; | 2727 | int p = 0; |
| 2546 | 2728 | ||
| 2729 | if (mlx4_is_bonded(dev) && | ||
| 2730 | ((event == MLX4_DEV_EVENT_PORT_UP) || | ||
| 2731 | (event == MLX4_DEV_EVENT_PORT_DOWN))) { | ||
| 2732 | ew = kmalloc(sizeof(*ew), GFP_ATOMIC); | ||
| 2733 | if (!ew) | ||
| 2734 | return; | ||
| 2735 | INIT_WORK(&ew->work, handle_bonded_port_state_event); | ||
| 2736 | ew->ib_dev = ibdev; | ||
| 2737 | queue_work(wq, &ew->work); | ||
| 2738 | return; | ||
| 2739 | } | ||
| 2740 | |||
| 2547 | if (event == MLX4_DEV_EVENT_PORT_MGMT_CHANGE) | 2741 | if (event == MLX4_DEV_EVENT_PORT_MGMT_CHANGE) |
| 2548 | eqe = (struct mlx4_eqe *)param; | 2742 | eqe = (struct mlx4_eqe *)param; |
| 2549 | else | 2743 | else |
| @@ -2570,6 +2764,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 20 unmodified lines | |||
| 2570 | case MLX4_DEV_EVENT_CATASTROPHIC_ERROR: | 2764 | case MLX4_DEV_EVENT_CATASTROPHIC_ERROR: |
| 2571 | ibdev->ib_active = false; | 2765 | ibdev->ib_active = false; |
| 2572 | ibev.event = IB_EVENT_DEVICE_FATAL; | 2766 | ibev.event = IB_EVENT_DEVICE_FATAL; |
| 2767 | mlx4_ib_handle_catas_error(ibdev); | ||
| 2573 | break; | 2768 | break; |
| 2574 | 2769 | ||
| 2575 | case MLX4_DEV_EVENT_PORT_MGMT_CHANGE: | 2770 | case MLX4_DEV_EVENT_PORT_MGMT_CHANGE: |
| @@ -2604,7 +2799,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 28 unmodified lines | |||
| 2604 | } | 2799 | } |
| 2605 | 2800 | ||
| 2606 | ibev.device = ibdev_ptr; | 2801 | ibev.device = ibdev_ptr; |
| 2607 | ibev.element.port_num = (u8) p; | 2802 | ibev.element.port_num = mlx4_is_bonded(ibdev->dev) ? 1 : (u8)p; |
| 2608 | 2803 | ||
| 2609 | ib_dispatch_event(&ibev); | 2804 | ib_dispatch_event(&ibev); |
| 2610 | } | 2805 | } |
| @@ -2613,7 +2808,8 @@ static struct mlx4_interface mlx4_ib_interface = { · 2 unmodified lines | |||
| 2613 | .add = mlx4_ib_add, | 2808 | .add = mlx4_ib_add, |
| 2614 | .remove = mlx4_ib_remove, | 2809 | .remove = mlx4_ib_remove, |
| 2615 | .event = mlx4_ib_event, | 2810 | .event = mlx4_ib_event, |
| 2616 | .protocol = MLX4_PROT_IB_IPV6 | 2811 | .protocol = MLX4_PROT_IB_IPV6, |
| 2812 | .flags = MLX4_INTFF_BONDING | ||
| 2617 | }; | 2813 | }; |
| 2618 | 2814 | ||
| 2619 | static int __init mlx4_ib_init(void) | 2815 | static int __init mlx4_ib_init(void) |
| @@ -110,6 +110,9 @@ struct mlx4_ib_cq { · 109 unmodified lines | |||
| 110 | struct mutex resize_mutex; | 110 | struct mutex resize_mutex; |
| 111 | struct ib_umem *umem; | 111 | struct ib_umem *umem; |
| 112 | struct ib_umem *resize_umem; | 112 | struct ib_umem *resize_umem; |
| 113 | /* List of qps that it serves.*/ | ||
| 114 | struct list_head send_qp_list; | ||
| 115 | struct list_head recv_qp_list; | ||
| 113 | }; | 116 | }; |
| 114 | 117 | ||
| 115 | struct mlx4_ib_mr { | 118 | struct mlx4_ib_mr { |
| @@ -134,10 +137,17 @@ struct mlx4_ib_fmr { · 18 unmodified lines | |||
| 134 | struct mlx4_fmr mfmr; | 137 | struct mlx4_fmr mfmr; |
| 135 | }; | 138 | }; |
| 136 | 139 | ||
| 140 | #define MAX_REGS_PER_FLOW 2 | ||
| 141 | |||
| 142 | struct mlx4_flow_reg_id { | ||
| 143 | u64 id; | ||
| 144 | u64 mirror; | ||
| 145 | }; | ||
| 146 | |||
| 137 | struct mlx4_ib_flow { | 147 | struct mlx4_ib_flow { |
| 138 | struct ib_flow ibflow; | 148 | struct ib_flow ibflow; |
| 139 | /* translating DMFS verbs sniffer rule to FW API requires two reg IDs */ | 149 | /* translating DMFS verbs sniffer rule to FW API requires two reg IDs */ |
| 140 | u64 reg_id[2]; | 150 | struct mlx4_flow_reg_id reg_id[MAX_REGS_PER_FLOW]; |
| 141 | }; | 151 | }; |
| 142 | 152 | ||
| 143 | struct mlx4_ib_wq { | 153 | struct mlx4_ib_wq { |
| @@ -293,6 +303,9 @@ struct mlx4_ib_qp { · 149 unmodified lines | |||
| 293 | struct mlx4_roce_smac_vlan_info pri; | 303 | struct mlx4_roce_smac_vlan_info pri; |
| 294 | struct mlx4_roce_smac_vlan_info alt; | 304 | struct mlx4_roce_smac_vlan_info alt; |
| 295 | u64 reg_id; | 305 | u64 reg_id; |
| 306 | struct list_head qps_list; | ||
| 307 | struct list_head cq_recv_list; | ||
| 308 | struct list_head cq_send_list; | ||
| 296 | }; | 309 | }; |
| 297 | 310 | ||
| 298 | struct mlx4_ib_srq { | 311 | struct mlx4_ib_srq { |
| @@ -527,6 +540,10 @@ struct mlx4_ib_dev { · 228 unmodified lines | |||
| 527 | struct mlx4_ib_qp *qp1_proxy[MLX4_MAX_PORTS]; | 540 | struct mlx4_ib_qp *qp1_proxy[MLX4_MAX_PORTS]; |
| 528 | /* lock when destroying qp1_proxy and getting netdev events */ | 541 | /* lock when destroying qp1_proxy and getting netdev events */ |
| 529 | struct mutex qp1_proxy_lock[MLX4_MAX_PORTS]; | 542 | struct mutex qp1_proxy_lock[MLX4_MAX_PORTS]; |
| 543 | u8 bond_next_port; | ||
| 544 | /* protect resources needed as part of reset flow */ | ||
| 545 | spinlock_t reset_flow_resource_lock; | ||
| 546 | struct list_head qp_list; | ||
| 530 | }; | 547 | }; |
| 531 | 548 | ||
| 532 | struct ib_event_work { | 549 | struct ib_event_work { |
| @@ -622,6 +639,13 @@ static inline struct mlx4_ib_ah *to_mah(struct ib_ah *ibah) · 89 unmodified lines | |||
| 622 | return container_of(ibah, struct mlx4_ib_ah, ibah); | 639 | return container_of(ibah, struct mlx4_ib_ah, ibah); |
| 623 | } | 640 | } |
| 624 | 641 | ||
| 642 | static inline u8 mlx4_ib_bond_next_port(struct mlx4_ib_dev *dev) | ||
| 643 | { | ||
| 644 | dev->bond_next_port = (dev->bond_next_port + 1) % dev->num_ports; | ||
| 645 | |||
| 646 | return dev->bond_next_port + 1; | ||
| 647 | } | ||
| 648 | |||
| 625 | int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev); | 649 | int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev); |
| 626 | void mlx4_ib_close_sriov(struct mlx4_ib_dev *dev); | 650 | void mlx4_ib_close_sriov(struct mlx4_ib_dev *dev); |
| 627 | 651 | ||
| @@ -401,7 +401,8 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device · 400 unmodified lines | |||
| 401 | if (!mfrpl->ibfrpl.page_list) | 401 | if (!mfrpl->ibfrpl.page_list) |
| 402 | goto err_free; | 402 | goto err_free; |
| 403 | 403 | ||
| 404 | mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->pdev->dev, | 404 | mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->persist-> |
| 405 | pdev->dev, | ||
| 405 | size, &mfrpl->map, | 406 | size, &mfrpl->map, |
| 406 | GFP_KERNEL); | 407 | GFP_KERNEL); |
| 407 | if (!mfrpl->mapped_page_list) | 408 | if (!mfrpl->mapped_page_list) |
| @@ -423,7 +424,8 @@ void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list) · 15 unmodified lines | |||
| 423 | struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list); | 424 | struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list); |
| 424 | int size = page_list->max_page_list_len * sizeof (u64); | 425 | int size = page_list->max_page_list_len * sizeof (u64); |
| 425 | 426 | ||
| 426 | dma_free_coherent(&dev->dev->pdev->dev, size, mfrpl->mapped_page_list, | 427 | dma_free_coherent(&dev->dev->persist->pdev->dev, size, |
| 428 | mfrpl->mapped_page_list, | ||
| 427 | mfrpl->map); | 429 | mfrpl->map); |
| 428 | kfree(mfrpl->ibfrpl.page_list); | 430 | kfree(mfrpl->ibfrpl.page_list); |
| 429 | kfree(mfrpl); | 431 | kfree(mfrpl); |
| @@ -40,11 +40,17 @@ · 39 unmodified lines | |||
| 40 | #include <rdma/ib_addr.h> | 40 | #include <rdma/ib_addr.h> |
| 41 | #include <rdma/ib_mad.h> | 41 | #include <rdma/ib_mad.h> |
| 42 | 42 | ||
| 43 | #include <linux/mlx4/driver.h> | ||
| 43 | #include <linux/mlx4/qp.h> | 44 | #include <linux/mlx4/qp.h> |
| 44 | 45 | ||
| 45 | #include "mlx4_ib.h" | 46 | #include "mlx4_ib.h" |
| 46 | #include "user.h" | 47 | #include "user.h" |
| 47 | 48 | ||
| 49 | static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, | ||
| 50 | struct mlx4_ib_cq *recv_cq); | ||
| 51 | static void mlx4_ib_unlock_cqs(struct mlx4_ib_cq *send_cq, | ||
| 52 | struct mlx4_ib_cq *recv_cq); | ||
| 53 | |||
| 48 | enum { | 54 | enum { |
| 49 | MLX4_IB_ACK_REQ_FREQ = 8, | 55 | MLX4_IB_ACK_REQ_FREQ = 8, |
| 50 | }; | 56 | }; |
| @@ -93,17 +99,6 @@ enum { · 42 unmodified lines | |||
| 93 | #ifndef ETH_ALEN | 99 | #ifndef ETH_ALEN |
| 94 | #define ETH_ALEN 6 | 100 | #define ETH_ALEN 6 |
| 95 | #endif | 101 | #endif |
| 96 | static inline u64 mlx4_mac_to_u64(u8 *addr) | ||
| 97 | { | ||
| 98 | u64 mac = 0; | ||
| 99 | int i; | ||
| 100 | |||
| 101 | for (i = 0; i < ETH_ALEN; i++) { | ||
| 102 | mac <<= 8; | ||
| 103 | mac |= addr[i]; | ||
| 104 | } | ||
| 105 | return mac; | ||
| 106 | } | ||
| 107 | 102 | ||
| 108 | static const __be32 mlx4_ib_opcode[] = { | 103 | static const __be32 mlx4_ib_opcode[] = { |
| 109 | [IB_WR_SEND] = cpu_to_be32(MLX4_OPCODE_SEND), | 104 | [IB_WR_SEND] = cpu_to_be32(MLX4_OPCODE_SEND), |
| @@ -628,6 +623,8 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, · 518 unmodified lines | |||
| 628 | struct mlx4_ib_sqp *sqp; | 623 | struct mlx4_ib_sqp *sqp; |
| 629 | struct mlx4_ib_qp *qp; | 624 | struct mlx4_ib_qp *qp; |
| 630 | enum mlx4_ib_qp_type qp_type = (enum mlx4_ib_qp_type) init_attr->qp_type; | 625 | enum mlx4_ib_qp_type qp_type = (enum mlx4_ib_qp_type) init_attr->qp_type; |
| 626 | struct mlx4_ib_cq *mcq; | ||
| 627 | unsigned long flags; | ||
| 631 | 628 | ||
| 632 | /* When tunneling special qps, we use a plain UD qp */ | 629 | /* When tunneling special qps, we use a plain UD qp */ |
| 633 | if (sqpn) { | 630 | if (sqpn) { |
| @@ -838,6 +835,24 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, · 204 unmodified lines | |||
| 838 | qp->mqp.event = mlx4_ib_qp_event; | 835 | qp->mqp.event = mlx4_ib_qp_event; |
| 839 | if (!*caller_qp) | 836 | if (!*caller_qp) |
| 840 | *caller_qp = qp; | 837 | *caller_qp = qp; |
| 838 | |||
| 839 | spin_lock_irqsave(&dev->reset_flow_resource_lock, flags); | ||
| 840 | mlx4_ib_lock_cqs(to_mcq(init_attr->send_cq), | ||
| 841 | to_mcq(init_attr->recv_cq)); | ||
| 842 | /* Maintain device to QPs access, needed for further handling | ||
| 843 | * via reset flow | ||
| 844 | */ | ||
| 845 | list_add_tail(&qp->qps_list, &dev->qp_list); | ||
| 846 | /* Maintain CQ to QPs access, needed for further handling | ||
| 847 | * via reset flow | ||
| 848 | */ | ||
| 849 | mcq = to_mcq(init_attr->send_cq); | ||
| 850 | list_add_tail(&qp->cq_send_list, &mcq->send_qp_list); | ||
| 851 | mcq = to_mcq(init_attr->recv_cq); | ||
| 852 | list_add_tail(&qp->cq_recv_list, &mcq->recv_qp_list); | ||
| 853 | mlx4_ib_unlock_cqs(to_mcq(init_attr->send_cq), | ||
| 854 | to_mcq(init_attr->recv_cq)); | ||
| 855 | spin_unlock_irqrestore(&dev->reset_flow_resource_lock, flags); | ||
| 841 | return 0; | 856 | return 0; |
| 842 | 857 | ||
| 843 | err_qpn: | 858 | err_qpn: |
| @@ -896,13 +911,13 @@ static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *recv · 52 unmodified lines | |||
| 896 | __acquires(&send_cq->lock) __acquires(&recv_cq->lock) | 911 | __acquires(&send_cq->lock) __acquires(&recv_cq->lock) |
| 897 | { | 912 | { |
| 898 | if (send_cq == recv_cq) { | 913 | if (send_cq == recv_cq) { |
| 899 | spin_lock_irq(&send_cq->lock); | 914 | spin_lock(&send_cq->lock); |
| 900 | __acquire(&recv_cq->lock); | 915 | __acquire(&recv_cq->lock); |
| 901 | } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) { | 916 | } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) { |
| 902 | spin_lock_irq(&send_cq->lock); | 917 | spin_lock(&send_cq->lock); |
| 903 | spin_lock_nested(&recv_cq->lock, SINGLE_DEPTH_NESTING); | 918 | spin_lock_nested(&recv_cq->lock, SINGLE_DEPTH_NESTING); |
| 904 | } else { | 919 | } else { |
| 905 | spin_lock_irq(&recv_cq->lock); | 920 | spin_lock(&recv_cq->lock); |
| 906 | spin_lock_nested(&send_cq->lock, SINGLE_DEPTH_NESTING); | 921 | spin_lock_nested(&send_cq->lock, SINGLE_DEPTH_NESTING); |
| 907 | } | 922 | } |
| 908 | } | 923 | } |
| @@ -912,13 +927,13 @@ static void mlx4_ib_unlock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *re · 3 unmodified lines | |||
| 912 | { | 927 | { |
| 913 | if (send_cq == recv_cq) { | 928 | if (send_cq == recv_cq) { |
| 914 | __release(&recv_cq->lock); | 929 | __release(&recv_cq->lock); |
| 915 | spin_unlock_irq(&send_cq->lock); | 930 | spin_unlock(&send_cq->lock); |
| 916 | } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) { | 931 | } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) { |
| 917 | spin_unlock(&recv_cq->lock); | 932 | spin_unlock(&recv_cq->lock); |
| 918 | spin_unlock_irq(&send_cq->lock); | 933 | spin_unlock(&send_cq->lock); |
| 919 | } else { | 934 | } else { |
| 920 | spin_unlock(&send_cq->lock); | 935 | spin_unlock(&send_cq->lock); |
| 921 | spin_unlock_irq(&recv_cq->lock); | 936 | spin_unlock(&recv_cq->lock); |
| 922 | } | 937 | } |
| 923 | } | 938 | } |
| 924 | 939 | ||
| @@ -963,6 +978,7 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 38 unmodified lines | |||
| 963 | int is_user) | 978 | int is_user) |
| 964 | { | 979 | { |
| 965 | struct mlx4_ib_cq *send_cq, *recv_cq; | 980 | struct mlx4_ib_cq *send_cq, *recv_cq; |
| 981 | unsigned long flags; | ||
| 966 | 982 | ||
| 967 | if (qp->state != IB_QPS_RESET) { | 983 | if (qp->state != IB_QPS_RESET) { |
| 968 | if (mlx4_qp_modify(dev->dev, NULL, to_mlx4_state(qp->state), | 984 | if (mlx4_qp_modify(dev->dev, NULL, to_mlx4_state(qp->state), |
| @@ -994,8 +1010,13 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 25 unmodified lines | |||
| 994 | 1010 | ||
| 995 | get_cqs(qp, &send_cq, &recv_cq); | 1011 | get_cqs(qp, &send_cq, &recv_cq); |
| 996 | 1012 | ||
| 1013 | spin_lock_irqsave(&dev->reset_flow_resource_lock, flags); | ||
| 997 | mlx4_ib_lock_cqs(send_cq, recv_cq); | 1014 | mlx4_ib_lock_cqs(send_cq, recv_cq); |
| 998 | 1015 | ||
| 1016 | /* del from lists under both locks above to protect reset flow paths */ | ||
| 1017 | list_del(&qp->qps_list); | ||
| 1018 | list_del(&qp->cq_send_list); | ||
| 1019 | list_del(&qp->cq_recv_list); | ||
| 999 | if (!is_user) { | 1020 | if (!is_user) { |
| 1000 | __mlx4_ib_cq_clean(recv_cq, qp->mqp.qpn, | 1021 | __mlx4_ib_cq_clean(recv_cq, qp->mqp.qpn, |
| 1001 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq): NULL); | 1022 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq): NULL); |
| @@ -1006,6 +1027,7 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 4 unmodified lines | |||
| 1006 | mlx4_qp_remove(dev->dev, &qp->mqp); | 1027 | mlx4_qp_remove(dev->dev, &qp->mqp); |
| 1007 | 1028 | ||
| 1008 | mlx4_ib_unlock_cqs(send_cq, recv_cq); | 1029 | mlx4_ib_unlock_cqs(send_cq, recv_cq); |
| 1030 | spin_unlock_irqrestore(&dev->reset_flow_resource_lock, flags); | ||
| 1009 | 1031 | ||
| 1010 | mlx4_qp_free(dev->dev, &qp->mqp); | 1032 | mlx4_qp_free(dev->dev, &qp->mqp); |
| 1011 | 1033 | ||
| @@ -1915,6 +1937,22 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 903 unmodified lines | |||
| 1915 | goto out; | 1937 | goto out; |
| 1916 | } | 1938 | } |
| 1917 | 1939 | ||
| 1940 | if (mlx4_is_bonded(dev->dev) && (attr_mask & IB_QP_PORT)) { | ||
| 1941 | if ((cur_state == IB_QPS_RESET) && (new_state == IB_QPS_INIT)) { | ||
| 1942 | if ((ibqp->qp_type == IB_QPT_RC) || | ||
| 1943 | (ibqp->qp_type == IB_QPT_UD) || | ||
| 1944 | (ibqp->qp_type == IB_QPT_UC) || | ||
| 1945 | (ibqp->qp_type == IB_QPT_RAW_PACKET) || | ||
| 1946 | (ibqp->qp_type == IB_QPT_XRC_INI)) { | ||
| 1947 | attr->port_num = mlx4_ib_bond_next_port(dev); | ||
| 1948 | } | ||
| 1949 | } else { | ||
| 1950 | /* no sense in changing port_num | ||
| 1951 | * when ports are bonded */ | ||
| 1952 | attr_mask &= ~IB_QP_PORT; | ||
| 1953 | } | ||
| 1954 | } | ||
| 1955 | |||
| 1918 | if ((attr_mask & IB_QP_PORT) && | 1956 | if ((attr_mask & IB_QP_PORT) && |
| 1919 | (attr->port_num == 0 || attr->port_num > dev->num_ports)) { | 1957 | (attr->port_num == 0 || attr->port_num > dev->num_ports)) { |
| 1920 | pr_debug("qpn 0x%x: invalid port number (%d) specified " | 1958 | pr_debug("qpn 0x%x: invalid port number (%d) specified " |
| @@ -1965,6 +2003,9 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 44 unmodified lines | |||
| 1965 | 2003 | ||
| 1966 | err = __mlx4_ib_modify_qp(ibqp, attr, attr_mask, cur_state, new_state); | 2004 | err = __mlx4_ib_modify_qp(ibqp, attr, attr_mask, cur_state, new_state); |
| 1967 | 2005 | ||
| 2006 | if (mlx4_is_bonded(dev->dev) && (attr_mask & IB_QP_PORT)) | ||
| 2007 | attr->port_num = 1; | ||
| 2008 | |||
| 1968 | out: | 2009 | out: |
| 1969 | mutex_unlock(&qp->mutex); | 2010 | mutex_unlock(&qp->mutex); |
| 1970 | return err; | 2011 | return err; |
| @@ -2609,8 +2650,15 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 638 unmodified lines | |||
| 2609 | __be32 uninitialized_var(lso_hdr_sz); | 2650 | __be32 uninitialized_var(lso_hdr_sz); |
| 2610 | __be32 blh; | 2651 | __be32 blh; |
| 2611 | int i; | 2652 | int i; |
| 2653 | struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); | ||
| 2612 | 2654 | ||
| 2613 | spin_lock_irqsave(&qp->sq.lock, flags); | 2655 | spin_lock_irqsave(&qp->sq.lock, flags); |
| 2656 | if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { | ||
| 2657 | err = -EIO; | ||
| 2658 | *bad_wr = wr; | ||
| 2659 | nreq = 0; | ||
| 2660 | goto out; | ||
| 2661 | } | ||
| 2614 | 2662 | ||
| 2615 | ind = qp->sq_next_wqe; | 2663 | ind = qp->sq_next_wqe; |
| 2616 | 2664 | ||
| @@ -2908,10 +2956,18 @@ int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 291 unmodified lines | |||
| 2908 | int ind; | 2956 | int ind; |
| 2909 | int max_gs; | 2957 | int max_gs; |
| 2910 | int i; | 2958 | int i; |
| 2959 | struct mlx4_ib_dev *mdev = to_mdev(ibqp->device); | ||
| 2911 | 2960 | ||
| 2912 | max_gs = qp->rq.max_gs; | 2961 | max_gs = qp->rq.max_gs; |
| 2913 | spin_lock_irqsave(&qp->rq.lock, flags); | 2962 | spin_lock_irqsave(&qp->rq.lock, flags); |
| 2914 | 2963 | ||
| 2964 | if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { | ||
| 2965 | err = -EIO; | ||
| 2966 | *bad_wr = wr; | ||
| 2967 | nreq = 0; | ||
| 2968 | goto out; | ||
| 2969 | } | ||
| 2970 | |||
| 2915 | ind = qp->rq.head & (qp->rq.wqe_cnt - 1); | 2971 | ind = qp->rq.head & (qp->rq.wqe_cnt - 1); |
| 2916 | 2972 | ||
| 2917 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 2973 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
| @@ -316,8 +316,15 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, · 315 unmodified lines | |||
| 316 | int err = 0; | 316 | int err = 0; |
| 317 | int nreq; | 317 | int nreq; |
| 318 | int i; | 318 | int i; |
| 319 | struct mlx4_ib_dev *mdev = to_mdev(ibsrq->device); | ||
| 319 | 320 | ||
| 320 | spin_lock_irqsave(&srq->lock, flags); | 321 | spin_lock_irqsave(&srq->lock, flags); |
| 322 | if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { | ||
| 323 | err = -EIO; | ||
| 324 | *bad_wr = wr; | ||
| 325 | nreq = 0; | ||
| 326 | goto out; | ||
| 327 | } | ||
| 321 | 328 | ||
| 322 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 329 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
| 323 | if (unlikely(wr->num_sge > srq->msrq.max_gs)) { | 330 | if (unlikely(wr->num_sge > srq->msrq.max_gs)) { |
| @@ -362,6 +369,7 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, · 38 unmodified lines | |||
| 362 | 369 | ||
| 363 | *srq->db.db = cpu_to_be32(srq->wqe_ctr); | 370 | *srq->db.db = cpu_to_be32(srq->wqe_ctr); |
| 364 | } | 371 | } |
| 372 | out: | ||
| 365 | 373 | ||
| 366 | spin_unlock_irqrestore(&srq->lock, flags); | 374 | spin_unlock_irqrestore(&srq->lock, flags); |
| 367 | 375 | ||
| @@ -375,7 +375,7 @@ static void get_name(struct mlx4_ib_dev *dev, char *name, int i, int max) · 374 unmodified lines | |||
| 375 | char base_name[9]; | 375 | char base_name[9]; |
| 376 | 376 | ||
| 377 | /* pci_name format is: bus:dev:func -> xxxx:yy:zz.n */ | 377 | /* pci_name format is: bus:dev:func -> xxxx:yy:zz.n */ |
| 378 | strlcpy(name, pci_name(dev->dev->pdev), max); | 378 | strlcpy(name, pci_name(dev->dev->persist->pdev), max); |
| 379 | strncpy(base_name, name, 8); /*till xxxx:yy:*/ | 379 | strncpy(base_name, name, 8); /*till xxxx:yy:*/ |
| 380 | base_name[8] = '\0'; | 380 | base_name[8] = '\0'; |
| 381 | /* with no ARI only 3 last bits are used so when the fn is higher than 8 | 381 | /* with no ARI only 3 last bits are used so when the fn is higher than 8 |
| @@ -792,7 +792,7 @@ static int register_pkey_tree(struct mlx4_ib_dev *device) · 410 unmodified lines | |||
| 792 | if (!mlx4_is_master(device->dev)) | 792 | if (!mlx4_is_master(device->dev)) |
| 793 | return 0; | 793 | return 0; |
| 794 | 794 | ||
| 795 | for (i = 0; i <= device->dev->num_vfs; ++i) | 795 | for (i = 0; i <= device->dev->persist->num_vfs; ++i) |
| 796 | register_one_pkey_tree(device, i); | 796 | register_one_pkey_tree(device, i); |
| 797 | 797 | ||
| 798 | return 0; | 798 | return 0; |
| @@ -807,7 +807,7 @@ static void unregister_pkey_tree(struct mlx4_ib_dev *device) · 8 unmodified lines | |||
| 807 | if (!mlx4_is_master(device->dev)) | 807 | if (!mlx4_is_master(device->dev)) |
| 808 | return; | 808 | return; |
| 809 | 809 | ||
| 810 | for (slave = device->dev->num_vfs; slave >= 0; --slave) { | 810 | for (slave = device->dev->persist->num_vfs; slave >= 0; --slave) { |
| 811 | list_for_each_entry_safe(p, t, | 811 | list_for_each_entry_safe(p, t, |
| 812 | &device->pkeys.pkey_port_list[slave], | 812 | &device->pkeys.pkey_port_list[slave], |
| 813 | entry) { | 813 | entry) { |
| @@ -81,7 +81,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, · 80 unmodified lines | |||
| 81 | for (k = 0; k < len; k++) { | 81 | for (k = 0; k < len; k++) { |
| 82 | if (!(i & mask)) { | 82 | if (!(i & mask)) { |
| 83 | tmp = (unsigned long)pfn; | 83 | tmp = (unsigned long)pfn; |
| 84 | m = min(m, find_first_bit(&tmp, sizeof(tmp))); | 84 | m = min_t(unsigned long, m, find_first_bit(&tmp, sizeof(tmp))); |
| 85 | skip = 1 << m; | 85 | skip = 1 << m; |
| 86 | mask = skip - 1; | 86 | mask = skip - 1; |
| 87 | base = pfn; | 87 | base = pfn; |
| @@ -373,11 +373,11 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev) · 372 unmodified lines | |||
| 373 | wqe_fragment_length = (__le16 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX]; | 373 | wqe_fragment_length = (__le16 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX]; |
| 374 | 374 | ||
| 375 | /* setup the VLAN tag if present */ | 375 | /* setup the VLAN tag if present */ |
| 376 | if (vlan_tx_tag_present(skb)) { | 376 | if (skb_vlan_tag_present(skb)) { |
| 377 | nes_debug(NES_DBG_NIC_TX, "%s: VLAN packet to send... VLAN = %08X\n", | 377 | nes_debug(NES_DBG_NIC_TX, "%s: VLAN packet to send... VLAN = %08X\n", |
| 378 | netdev->name, vlan_tx_tag_get(skb)); | 378 | netdev->name, skb_vlan_tag_get(skb)); |
| 379 | wqe_misc = NES_NIC_SQ_WQE_TAGVALUE_ENABLE; | 379 | wqe_misc = NES_NIC_SQ_WQE_TAGVALUE_ENABLE; |
| 380 | wqe_fragment_length[0] = (__force __le16) vlan_tx_tag_get(skb); | 380 | wqe_fragment_length[0] = (__force __le16) skb_vlan_tag_get(skb); |
| 381 | } else | 381 | } else |
| 382 | wqe_misc = 0; | 382 | wqe_misc = 0; |
| 383 | 383 | ||
| @@ -576,11 +576,12 @@ tso_sq_no_longer_full: · 192 unmodified lines | |||
| 576 | wqe_fragment_length = | 576 | wqe_fragment_length = |
| 577 | (__le16 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX]; | 577 | (__le16 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX]; |
| 578 | /* setup the VLAN tag if present */ | 578 | /* setup the VLAN tag if present */ |
| 579 | if (vlan_tx_tag_present(skb)) { | 579 | if (skb_vlan_tag_present(skb)) { |
| 580 | nes_debug(NES_DBG_NIC_TX, "%s: VLAN packet to send... VLAN = %08X\n", | 580 | nes_debug(NES_DBG_NIC_TX, "%s: VLAN packet to send... VLAN = %08X\n", |
| 581 | netdev->name, vlan_tx_tag_get(skb) ); | 581 | netdev->name, |
| 582 | skb_vlan_tag_get(skb)); | ||
| 582 | wqe_misc = NES_NIC_SQ_WQE_TAGVALUE_ENABLE; | 583 | wqe_misc = NES_NIC_SQ_WQE_TAGVALUE_ENABLE; |
| 583 | wqe_fragment_length[0] = (__force __le16) vlan_tx_tag_get(skb); | 584 | wqe_fragment_length[0] = (__force __le16) skb_vlan_tag_get(skb); |
| 584 | } else | 585 | } else |
| 585 | wqe_misc = 0; | 586 | wqe_misc = 0; |
| 586 | 587 | ||
| @@ -754,10 +754,10 @@ dbusy_timer_handler(struct isac_hw *isac) · 753 unmodified lines | |||
| 754 | } | 754 | } |
| 755 | 755 | ||
| 756 | static int | 756 | static int |
| 757 | open_dchannel(struct isac_hw *isac, struct channel_req *rq) | 757 | open_dchannel_caller(struct isac_hw *isac, struct channel_req *rq, void *caller) |
| 758 | { | 758 | { |
| 759 | pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__, | 759 | pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__, |
| 760 | isac->dch.dev.id, __builtin_return_address(1)); | 760 | isac->dch.dev.id, caller); |
| 761 | if (rq->protocol != ISDN_P_TE_S0) | 761 | if (rq->protocol != ISDN_P_TE_S0) |
| 762 | return -EINVAL; | 762 | return -EINVAL; |
| 763 | if (rq->adr.channel == 1) | 763 | if (rq->adr.channel == 1) |
| @@ -771,6 +771,12 @@ open_dchannel(struct isac_hw *isac, struct channel_req *rq) · 7 unmodified lines | |||
| 771 | return 0; | 771 | return 0; |
| 772 | } | 772 | } |
| 773 | 773 | ||
| 774 | static int | ||
| 775 | open_dchannel(struct isac_hw *isac, struct channel_req *rq) | ||
| 776 | { | ||
| 777 | return open_dchannel_caller(isac, rq, __builtin_return_address(0)); | ||
| 778 | } | ||
| 779 | |||
| 774 | static const char *ISACVer[] = | 780 | static const char *ISACVer[] = |
| 775 | {"2086/2186 V1.1", "2085 B1", "2085 B2", | 781 | {"2086/2186 V1.1", "2085 B1", "2085 B2", |
| 776 | "2085 V2.3"}; | 782 | "2085 V2.3"}; |
| @@ -1548,7 +1554,7 @@ ipac_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg) · 771 unmodified lines | |||
| 1548 | case OPEN_CHANNEL: | 1554 | case OPEN_CHANNEL: |
| 1549 | rq = arg; | 1555 | rq = arg; |
| 1550 | if (rq->protocol == ISDN_P_TE_S0) | 1556 | if (rq->protocol == ISDN_P_TE_S0) |
| 1551 | err = open_dchannel(isac, rq); | 1557 | err = open_dchannel_caller(isac, rq, __builtin_return_address(0)); |
| 1552 | else | 1558 | else |
| 1553 | err = open_bchannel(ipac, rq); | 1559 | err = open_bchannel(ipac, rq); |
| 1554 | if (err) | 1560 | if (err) |
| @@ -1176,10 +1176,10 @@ w6692_l1callback(struct dchannel *dch, u32 cmd) · 1175 unmodified lines | |||
| 1176 | } | 1176 | } |
| 1177 | 1177 | ||
| 1178 | static int | 1178 | static int |
| 1179 | open_dchannel(struct w6692_hw *card, struct channel_req *rq) | 1179 | open_dchannel(struct w6692_hw *card, struct channel_req *rq, void *caller) |
| 1180 | { | 1180 | { |
| 1181 | pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__, | 1181 | pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__, |
| 1182 | card->dch.dev.id, __builtin_return_address(1)); | 1182 | card->dch.dev.id, caller); |
| 1183 | if (rq->protocol != ISDN_P_TE_S0) | 1183 | if (rq->protocol != ISDN_P_TE_S0) |
| 1184 | return -EINVAL; | 1184 | return -EINVAL; |
| 1185 | if (rq->adr.channel == 1) | 1185 | if (rq->adr.channel == 1) |
| @@ -1207,7 +1207,7 @@ w6692_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg) · 21 unmodified lines | |||
| 1207 | case OPEN_CHANNEL: | 1207 | case OPEN_CHANNEL: |
| 1208 | rq = arg; | 1208 | rq = arg; |
| 1209 | if (rq->protocol == ISDN_P_TE_S0) | 1209 | if (rq->protocol == ISDN_P_TE_S0) |
| 1210 | err = open_dchannel(card, rq); | 1210 | err = open_dchannel(card, rq, __builtin_return_address(0)); |
| 1211 | else | 1211 | else |
| 1212 | err = open_bchannel(card, rq); | 1212 | err = open_bchannel(card, rq); |
| 1213 | if (err) | 1213 | if (err) |
| @@ -224,20 +224,6 @@ fWrite_hfc8(hfc4s8s_hw *a, u_char c) · 223 unmodified lines | |||
| 224 | outb(c, a->iobase); | 224 | outb(c, a->iobase); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static inline void | ||
| 228 | Write_hfc16(hfc4s8s_hw *a, u_char b, u_short c) | ||
| 229 | { | ||
| 230 | SetRegAddr(a, b); | ||
| 231 | outw(c, a->iobase); | ||
| 232 | } | ||
| 233 | |||
| 234 | static inline void | ||
| 235 | Write_hfc32(hfc4s8s_hw *a, u_char b, u_long c) | ||
| 236 | { | ||
| 237 | SetRegAddr(a, b); | ||
| 238 | outl(c, a->iobase); | ||
| 239 | } | ||
| 240 | |||
| 241 | static inline void | 227 | static inline void |
| 242 | fWrite_hfc32(hfc4s8s_hw *a, u_long c) | 228 | fWrite_hfc32(hfc4s8s_hw *a, u_long c) |
| 243 | { | 229 | { |
| @@ -265,13 +251,6 @@ Read_hfc16(hfc4s8s_hw *a, u_char b) · 21 unmodified lines | |||
| 265 | return (inw((volatile u_int) a->iobase)); | 251 | return (inw((volatile u_int) a->iobase)); |
| 266 | } | 252 | } |
| 267 | 253 | ||
| 268 | static inline u_long | ||
| 269 | Read_hfc32(hfc4s8s_hw *a, u_char b) | ||
| 270 | { | ||
| 271 | SetRegAddr(a, b); | ||
| 272 | return (inl((volatile u_int) a->iobase)); | ||
| 273 | } | ||
| 274 | |||
| 275 | static inline u_long | 254 | static inline u_long |
| 276 | fRead_hfc32(hfc4s8s_hw *a) | 255 | fRead_hfc32(hfc4s8s_hw *a) |
| 277 | { | 256 | { |
| @@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch) · 58 unmodified lines | |||
| 59 | isdn_ctrl cmd; | 59 | isdn_ctrl cmd; |
| 60 | 60 | ||
| 61 | while (card->sndcount[ch]) { | 61 | while (card->sndcount[ch]) { |
| 62 | if ((skb = skb_dequeue(&card->bqueue[ch]))) { | 62 | skb = skb_dequeue(&card->bqueue[ch]); |
| 63 | if (skb) { | ||
| 63 | len = skb->len; | 64 | len = skb->len; |
| 64 | card->sndcount[ch] -= len; | 65 | card->sndcount[ch] -= len; |
| 65 | ack = *(skb->head); /* used as scratch area */ | 66 | ack = *(skb->head); /* used as scratch area */ |
| @@ -149,8 +150,7 @@ typedef struct isdnloop_stat { · 83 unmodified lines | |||
| 149 | int action; | 150 | int action; |
| 150 | } isdnloop_stat; | 151 | } isdnloop_stat; |
| 151 | /* *INDENT-OFF* */ | 152 | /* *INDENT-OFF* */ |
| 152 | static isdnloop_stat isdnloop_stat_table[] = | 153 | static isdnloop_stat isdnloop_stat_table[] = { |
| 153 | { | ||
| 154 | {"BCON_", ISDN_STAT_BCONN, 1}, /* B-Channel connected */ | 154 | {"BCON_", ISDN_STAT_BCONN, 1}, /* B-Channel connected */ |
| 155 | {"BDIS_", ISDN_STAT_BHUP, 2}, /* B-Channel disconnected */ | 155 | {"BDIS_", ISDN_STAT_BHUP, 2}, /* B-Channel disconnected */ |
| 156 | {"DCON_", ISDN_STAT_DCONN, 0}, /* D-Channel connected */ | 156 | {"DCON_", ISDN_STAT_DCONN, 0}, /* D-Channel connected */ |
| @@ -317,7 +317,8 @@ isdnloop_polldchan(unsigned long data) · 160 unmodified lines | |||
| 317 | u_char *p; | 317 | u_char *p; |
| 318 | isdn_ctrl cmd; | 318 | isdn_ctrl cmd; |
| 319 | 319 | ||
| 320 | if ((skb = skb_dequeue(&card->dqueue))) | 320 | skb = skb_dequeue(&card->dqueue); |
| 321 | if (skb) | ||
| 321 | avail = skb->len; | 322 | avail = skb->len; |
| 322 | else | 323 | else |
| 323 | avail = 0; | 324 | avail = 0; |
| @@ -471,8 +472,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch) · 147 unmodified lines | |||
| 471 | { | 472 | { |
| 472 | struct sk_buff *skb; | 473 | struct sk_buff *skb; |
| 473 | int len = strlen(s) + ((ch >= 0) ? 3 : 0); | 474 | int len = strlen(s) + ((ch >= 0) ? 3 : 0); |
| 474 | 475 | skb = dev_alloc_skb(len); | |
| 475 | if (!(skb = dev_alloc_skb(len))) { | 476 | if (!skb) { |
| 476 | printk(KERN_WARNING "isdnloop: Out of memory in isdnloop_fake\n"); | 477 | printk(KERN_WARNING "isdnloop: Out of memory in isdnloop_fake\n"); |
| 477 | return 1; | 478 | return 1; |
| 478 | } | 479 | } |
| @@ -483,8 +484,7 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch) · 4 unmodified lines | |||
| 483 | return 0; | 484 | return 0; |
| 484 | } | 485 | } |
| 485 | /* *INDENT-OFF* */ | 486 | /* *INDENT-OFF* */ |
| 486 | static isdnloop_stat isdnloop_cmd_table[] = | 487 | static isdnloop_stat isdnloop_cmd_table[] = { |
| 487 | { | ||
| 488 | {"BCON_R", 0, 1}, /* B-Channel connect */ | 488 | {"BCON_R", 0, 1}, /* B-Channel connect */ |
| 489 | {"BCON_I", 0, 17}, /* B-Channel connect ind */ | 489 | {"BCON_I", 0, 17}, /* B-Channel connect ind */ |
| 490 | {"BDIS_R", 0, 2}, /* B-Channel disconnect */ | 490 | {"BDIS_R", 0, 2}, /* B-Channel disconnect */ |
| @@ -525,10 +525,8 @@ isdnloop_fake_err(isdnloop_card *card) · 34 unmodified lines | |||
| 525 | isdnloop_fake(card, "NAK", -1); | 525 | isdnloop_fake(card, "NAK", -1); |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | static u_char ctable_eu[] = | 528 | static u_char ctable_eu[] = {0x00, 0x11, 0x01, 0x12}; |
| 529 | {0x00, 0x11, 0x01, 0x12}; | 529 | static u_char ctable_1t[] = {0x00, 0x3b, 0x01, 0x3a}; |
| 530 | static u_char ctable_1t[] = | ||
| 531 | {0x00, 0x3b, 0x01, 0x3a}; | ||
| 532 | 530 | ||
| 533 | /* | 531 | /* |
| 534 | * Assemble a simplified cause message depending on the | 532 | * Assemble a simplified cause message depending on the |
| @@ -554,9 +552,9 @@ isdnloop_unicause(isdnloop_card *card, int loc, int cau) · 19 unmodified lines | |||
| 554 | sprintf(buf, "%02X44", ctable_1t[cau]); | 552 | sprintf(buf, "%02X44", ctable_1t[cau]); |
| 555 | break; | 553 | break; |
| 556 | default: | 554 | default: |
| 557 | return ("0000"); | 555 | return "0000"; |
| 558 | } | 556 | } |
| 559 | return (buf); | 557 | return buf; |
| 560 | } | 558 | } |
| 561 | 559 | ||
| 562 | /* | 560 | /* |
| @@ -647,10 +645,8 @@ isdnloop_kill_ctimer(isdnloop_card *card, int ch) · 84 unmodified lines | |||
| 647 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | 645 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); |
| 648 | } | 646 | } |
| 649 | 647 | ||
| 650 | static u_char si2bit[] = | 648 | static u_char si2bit[] = {0, 1, 0, 0, 0, 2, 0, 4, 0, 0}; |
| 651 | {0, 1, 0, 0, 0, 2, 0, 4, 0, 0}; | 649 | static u_char bit2si[] = {1, 5, 7}; |
| 652 | static u_char bit2si[] = | ||
| 653 | {1, 5, 7}; | ||
| 654 | 650 | ||
| 655 | /* | 651 | /* |
| 656 | * Try finding a listener for an outgoing call. | 652 | * Try finding a listener for an outgoing call. |
| @@ -754,17 +750,17 @@ isdnloop_vstphone(isdnloop_card *card, char *phone, int caller) · 97 unmodified lines | |||
| 754 | if (caller) { | 750 | if (caller) { |
| 755 | for (i = 0; i < 2; i++) | 751 | for (i = 0; i < 2; i++) |
| 756 | if (!(strcmp(card->s0num[i], phone))) | 752 | if (!(strcmp(card->s0num[i], phone))) |
| 757 | return (phone); | 753 | return phone; |
| 758 | return (card->s0num[0]); | 754 | return card->s0num[0]; |
| 759 | } | 755 | } |
| 760 | return (phone); | 756 | return phone; |
| 761 | break; | 757 | break; |
| 762 | case ISDN_PTYPE_1TR6: | 758 | case ISDN_PTYPE_1TR6: |
| 763 | if (caller) { | 759 | if (caller) { |
| 764 | sprintf(nphone, "%s%c", card->s0num[0], phone[0]); | 760 | sprintf(nphone, "%s%c", card->s0num[0], phone[0]); |
| 765 | return (nphone); | 761 | return nphone; |
| 766 | } else | 762 | } else |
| 767 | return (&phone[strlen(phone) - 1]); | 763 | return &phone[strlen(phone) - 1]; |
| 768 | break; | 764 | break; |
| 769 | } | 765 | } |
| 770 | return ""; | 766 | return ""; |
| @@ -1148,14 +1144,14 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card) · 377 unmodified lines | |||
| 1148 | case ISDNLOOP_IOCTL_STARTUP: | 1144 | case ISDNLOOP_IOCTL_STARTUP: |
| 1149 | if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef))) | 1145 | if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef))) |
| 1150 | return -EFAULT; | 1146 | return -EFAULT; |
| 1151 | return (isdnloop_start(card, (isdnloop_sdef *) a)); | 1147 | return isdnloop_start(card, (isdnloop_sdef *) a); |
| 1152 | break; | 1148 | break; |
| 1153 | case ISDNLOOP_IOCTL_ADDCARD: | 1149 | case ISDNLOOP_IOCTL_ADDCARD: |
| 1154 | if (copy_from_user((char *)&cdef, | 1150 | if (copy_from_user((char *)&cdef, |
| 1155 | (char *)a, | 1151 | (char *)a, |
| 1156 | sizeof(cdef))) | 1152 | sizeof(cdef))) |
| 1157 | return -EFAULT; | 1153 | return -EFAULT; |
| 1158 | return (isdnloop_addcard(cdef.id1)); | 1154 | return isdnloop_addcard(cdef.id1); |
| 1159 | break; | 1155 | break; |
| 1160 | case ISDNLOOP_IOCTL_LEASEDCFG: | 1156 | case ISDNLOOP_IOCTL_LEASEDCFG: |
| 1161 | if (a) { | 1157 | if (a) { |
| @@ -1377,7 +1373,7 @@ if_command(isdn_ctrl *c) · 215 unmodified lines | |||
| 1377 | isdnloop_card *card = isdnloop_findcard(c->driver); | 1373 | isdnloop_card *card = isdnloop_findcard(c->driver); |
| 1378 | 1374 | ||
| 1379 | if (card) | 1375 | if (card) |
| 1380 | return (isdnloop_command(c, card)); | 1376 | return isdnloop_command(c, card); |
| 1381 | printk(KERN_ERR | 1377 | printk(KERN_ERR |
| 1382 | "isdnloop: if_command called with invalid driverId!\n"); | 1378 | "isdnloop: if_command called with invalid driverId!\n"); |
| 1383 | return -ENODEV; | 1379 | return -ENODEV; |
| @@ -1391,7 +1387,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int channel) · 7 unmodified lines | |||
| 1391 | if (card) { | 1387 | if (card) { |
| 1392 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1388 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
| 1393 | return -ENODEV; | 1389 | return -ENODEV; |
| 1394 | return (isdnloop_writecmd(buf, len, 1, card)); | 1390 | return isdnloop_writecmd(buf, len, 1, card); |
| 1395 | } | 1391 | } |
| 1396 | printk(KERN_ERR | 1392 | printk(KERN_ERR |
| 1397 | "isdnloop: if_writecmd called with invalid driverId!\n"); | 1393 | "isdnloop: if_writecmd called with invalid driverId!\n"); |
| @@ -1406,7 +1402,7 @@ if_readstatus(u_char __user *buf, int len, int id, int channel) · 8 unmodified lines | |||
| 1406 | if (card) { | 1402 | if (card) { |
| 1407 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1403 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
| 1408 | return -ENODEV; | 1404 | return -ENODEV; |
| 1409 | return (isdnloop_readstatus(buf, len, card)); | 1405 | return isdnloop_readstatus(buf, len, card); |
| 1410 | } | 1406 | } |
| 1411 | printk(KERN_ERR | 1407 | printk(KERN_ERR |
| 1412 | "isdnloop: if_readstatus called with invalid driverId!\n"); | 1408 | "isdnloop: if_readstatus called with invalid driverId!\n"); |
| @@ -1423,7 +1419,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb) · 10 unmodified lines | |||
| 1423 | return -ENODEV; | 1419 | return -ENODEV; |
| 1424 | /* ack request stored in skb scratch area */ | 1420 | /* ack request stored in skb scratch area */ |
| 1425 | *(skb->head) = ack; | 1421 | *(skb->head) = ack; |
| 1426 | return (isdnloop_sendbuf(channel, skb, card)); | 1422 | return isdnloop_sendbuf(channel, skb, card); |
| 1427 | } | 1423 | } |
| 1428 | printk(KERN_ERR | 1424 | printk(KERN_ERR |
| 1429 | "isdnloop: if_sendbuf called with invalid driverId!\n"); | 1425 | "isdnloop: if_sendbuf called with invalid driverId!\n"); |
| @@ -1439,8 +1435,8 @@ isdnloop_initcard(char *id) · 9 unmodified lines | |||
| 1439 | { | 1435 | { |
| 1440 | isdnloop_card *card; | 1436 | isdnloop_card *card; |
| 1441 | int i; | 1437 | int i; |
| 1442 | 1438 | card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL); | |
| 1443 | if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) { | 1439 | if (!card) { |
| 1444 | printk(KERN_WARNING | 1440 | printk(KERN_WARNING |
| 1445 | "isdnloop: (%s) Could not allocate card-struct.\n", id); | 1441 | "isdnloop: (%s) Could not allocate card-struct.\n", id); |
| 1446 | return (isdnloop_card *) 0; | 1442 | return (isdnloop_card *) 0; |
| @@ -1489,8 +1485,8 @@ static int · 42 unmodified lines | |||
| 1489 | isdnloop_addcard(char *id1) | 1485 | isdnloop_addcard(char *id1) |
| 1490 | { | 1486 | { |
| 1491 | isdnloop_card *card; | 1487 | isdnloop_card *card; |
| 1492 | 1488 | card = isdnloop_initcard(id1); | |
| 1493 | if (!(card = isdnloop_initcard(id1))) { | 1489 | if (!card) { |
| 1494 | return -EIO; | 1490 | return -EIO; |
| 1495 | } | 1491 | } |
| 1496 | printk(KERN_INFO | 1492 | printk(KERN_INFO |
| @@ -1503,7 +1499,7 @@ static int __init · 6 unmodified lines | |||
| 1503 | isdnloop_init(void) | 1499 | isdnloop_init(void) |
| 1504 | { | 1500 | { |
| 1505 | if (isdnloop_id) | 1501 | if (isdnloop_id) |
| 1506 | return (isdnloop_addcard(isdnloop_id)); | 1502 | return isdnloop_addcard(isdnloop_id); |
| 1507 | 1503 | ||
| 1508 | return 0; | 1504 | return 0; |
| 1509 | } | 1505 | } |
| @@ -30,7 +30,7 @@ static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCo · 29 unmodified lines | |||
| 30 | static unsigned int io[] = {0, 0, 0, 0}; | 30 | static unsigned int io[] = {0, 0, 0, 0}; |
| 31 | static unsigned char irq[] = {0, 0, 0, 0}; | 31 | static unsigned char irq[] = {0, 0, 0, 0}; |
| 32 | static unsigned long ram[] = {0, 0, 0, 0}; | 32 | static unsigned long ram[] = {0, 0, 0, 0}; |
| 33 | static bool do_reset = 0; | 33 | static bool do_reset; |
| 34 | 34 | ||
| 35 | module_param_array(io, int, NULL, 0); | 35 | module_param_array(io, int, NULL, 0); |
| 36 | module_param_array(irq, byte, NULL, 0); | 36 | module_param_array(irq, byte, NULL, 0); |
| @@ -104,13 +104,12 @@ static int __init sc_init(void) · 67 unmodified lines | |||
| 104 | io[b] + 0x400 * EXP_PAGE0); | 104 | io[b] + 0x400 * EXP_PAGE0); |
| 105 | continue; | 105 | continue; |
| 106 | } | 106 | } |
| 107 | } | 107 | } else { |
| 108 | else { | ||
| 109 | /* | 108 | /* |
| 110 | * Yes, probe for I/O Base | 109 | * Yes, probe for I/O Base |
| 111 | */ | 110 | */ |
| 112 | if (probe_exhasted) { | 111 | if (probe_exhasted) { |
| 113 | pr_debug("All probe addresses exhasted, skipping\n"); | 112 | pr_debug("All probe addresses exhausted, skipping\n"); |
| 114 | continue; | 113 | continue; |
| 115 | } | 114 | } |
| 116 | pr_debug("Probing for I/O...\n"); | 115 | pr_debug("Probing for I/O...\n"); |
| @@ -169,8 +168,7 @@ static int __init sc_init(void) · 52 unmodified lines | |||
| 169 | model = identify_board(ram[b], io[b]); | 168 | model = identify_board(ram[b], io[b]); |
| 170 | release_region(ram[b], SRAM_PAGESIZE); | 169 | release_region(ram[b], SRAM_PAGESIZE); |
| 171 | } | 170 | } |
| 172 | } | 171 | } else { |
| 173 | else { | ||
| 174 | /* | 172 | /* |
| 175 | * Yes, probe for free RAM and look for | 173 | * Yes, probe for free RAM and look for |
| 176 | * a signature and id the board model | 174 | * a signature and id the board model |
| @@ -187,7 +185,7 @@ static int __init sc_init(void) · 10 unmodified lines | |||
| 187 | ram[b] = i; | 185 | ram[b] = i; |
| 188 | break; | 186 | break; |
| 189 | } | 187 | } |
| 190 | pr_debug(" Unidentifed or inaccessible\n"); | 188 | pr_debug(" Unidentified or inaccessible\n"); |
| 191 | continue; | 189 | continue; |
| 192 | } | 190 | } |
| 193 | pr_debug(" request failed\n"); | 191 | pr_debug(" request failed\n"); |
| @@ -337,8 +335,7 @@ static int __init sc_init(void) · 143 unmodified lines | |||
| 337 | sc_adapter[cinst]->interrupt = irq[b]; | 335 | sc_adapter[cinst]->interrupt = irq[b]; |
| 338 | if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler, | 336 | if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler, |
| 339 | 0, interface->id, | 337 | 0, interface->id, |
| 340 | (void *)(unsigned long) cinst)) | 338 | (void *)(unsigned long) cinst)) { |
| 341 | { | ||
| 342 | kfree(sc_adapter[cinst]->channel); | 339 | kfree(sc_adapter[cinst]->channel); |
| 343 | indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ | 340 | indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ |
| 344 | kfree(interface); | 341 | kfree(interface); |
| @@ -370,12 +370,12 @@ static int __qp_memcpy_to_queue(struct vmci_queue *queue, · 369 unmodified lines | |||
| 370 | to_copy = size - bytes_copied; | 370 | to_copy = size - bytes_copied; |
| 371 | 371 | ||
| 372 | if (is_iovec) { | 372 | if (is_iovec) { |
| 373 | struct iovec *iov = (struct iovec *)src; | 373 | struct msghdr *msg = (struct msghdr *)src; |
| 374 | int err; | 374 | int err; |
| 375 | 375 | ||
| 376 | /* The iovec will track bytes_copied internally. */ | 376 | /* The iovec will track bytes_copied internally. */ |
| 377 | err = memcpy_fromiovec((u8 *)va + page_offset, | 377 | err = memcpy_from_msg((u8 *)va + page_offset, |
| 378 | iov, to_copy); | 378 | msg, to_copy); |
| 379 | if (err != 0) { | 379 | if (err != 0) { |
| 380 | if (kernel_if->host) | 380 | if (kernel_if->host) |
| 381 | kunmap(kernel_if->u.h.page[page_index]); | 381 | kunmap(kernel_if->u.h.page[page_index]); |
| @@ -580,7 +580,7 @@ static int qp_memcpy_from_queue(void *dest, · 198 unmodified lines | |||
| 580 | */ | 580 | */ |
| 581 | static int qp_memcpy_to_queue_iov(struct vmci_queue *queue, | 581 | static int qp_memcpy_to_queue_iov(struct vmci_queue *queue, |
| 582 | u64 queue_offset, | 582 | u64 queue_offset, |
| 583 | const void *src, | 583 | const void *msg, |
| 584 | size_t src_offset, size_t size) | 584 | size_t src_offset, size_t size) |
| 585 | { | 585 | { |
| 586 | 586 | ||
| @@ -588,7 +588,7 @@ static int qp_memcpy_to_queue_iov(struct vmci_queue *queue, · 1 unmodified line | |||
| 588 | * We ignore src_offset because src is really a struct iovec * and will | 588 | * We ignore src_offset because src is really a struct iovec * and will |
| 589 | * maintain offset internally. | 589 | * maintain offset internally. |
| 590 | */ | 590 | */ |
| 591 | return __qp_memcpy_to_queue(queue, queue_offset, src, size, true); | 591 | return __qp_memcpy_to_queue(queue, queue_offset, msg, size, true); |
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | /* | 594 | /* |
| @@ -3223,13 +3223,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_peek); · 2628 unmodified lines | |||
| 3223 | * of bytes enqueued or < 0 on error. | 3223 | * of bytes enqueued or < 0 on error. |
| 3224 | */ | 3224 | */ |
| 3225 | ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, | 3225 | ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, |
| 3226 | void *iov, | 3226 | struct msghdr *msg, |
| 3227 | size_t iov_size, | 3227 | size_t iov_size, |
| 3228 | int buf_type) | 3228 | int buf_type) |
| 3229 | { | 3229 | { |
| 3230 | ssize_t result; | 3230 | ssize_t result; |
| 3231 | 3231 | ||
| 3232 | if (!qpair || !iov) | 3232 | if (!qpair) |
| 3233 | return VMCI_ERROR_INVALID_ARGS; | 3233 | return VMCI_ERROR_INVALID_ARGS; |
| 3234 | 3234 | ||
| 3235 | qp_lock(qpair); | 3235 | qp_lock(qpair); |
| @@ -3238,7 +3238,7 @@ ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, · 2 unmodified lines | |||
| 3238 | result = qp_enqueue_locked(qpair->produce_q, | 3238 | result = qp_enqueue_locked(qpair->produce_q, |
| 3239 | qpair->consume_q, | 3239 | qpair->consume_q, |
| 3240 | qpair->produce_q_size, | 3240 | qpair->produce_q_size, |
| 3241 | iov, iov_size, | 3241 | msg, iov_size, |
| 3242 | qp_memcpy_to_queue_iov); | 3242 | qp_memcpy_to_queue_iov); |
| 3243 | 3243 | ||
| 3244 | if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && | 3244 | if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && |
| @@ -78,6 +78,9 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv), | 79 | priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv), |
| 80 | GFP_KERNEL); | 80 | GFP_KERNEL); |
| 81 | if (!priv) | ||
| 82 | return -ENOMEM; | ||
| 83 | |||
| 81 | ci = (struct com20020_pci_card_info *)id->driver_data; | 84 | ci = (struct com20020_pci_card_info *)id->driver_data; |
| 82 | priv->ci = ci; | 85 | priv->ci = ci; |
| 83 | 86 | ||
| @@ -467,11 +467,14 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port) · 466 unmodified lines | |||
| 467 | /* set the partner sync. to on if the partner is sync, | 467 | /* set the partner sync. to on if the partner is sync, |
| 468 | * and the port is matched | 468 | * and the port is matched |
| 469 | */ | 469 | */ |
| 470 | if ((port->sm_vars & AD_PORT_MATCHED) | 470 | if ((port->sm_vars & AD_PORT_MATCHED) && |
| 471 | && (lacpdu->actor_state & AD_STATE_SYNCHRONIZATION)) | 471 | (lacpdu->actor_state & AD_STATE_SYNCHRONIZATION)) { |
| 472 | partner->port_state |= AD_STATE_SYNCHRONIZATION; | 472 | partner->port_state |= AD_STATE_SYNCHRONIZATION; |
| 473 | else | 473 | pr_debug("%s partner sync=1\n", port->slave->dev->name); |
| 474 | } else { | ||
| 474 | partner->port_state &= ~AD_STATE_SYNCHRONIZATION; | 475 | partner->port_state &= ~AD_STATE_SYNCHRONIZATION; |
| 476 | pr_debug("%s partner sync=0\n", port->slave->dev->name); | ||
| 477 | } | ||
| 475 | } | 478 | } |
| 476 | } | 479 | } |
| 477 | 480 | ||
| @@ -726,6 +729,8 @@ static inline void __update_lacpdu_from_port(struct port *port) · 248 unmodified lines | |||
| 726 | lacpdu->actor_port_priority = htons(port->actor_port_priority); | 729 | lacpdu->actor_port_priority = htons(port->actor_port_priority); |
| 727 | lacpdu->actor_port = htons(port->actor_port_number); | 730 | lacpdu->actor_port = htons(port->actor_port_number); |
| 728 | lacpdu->actor_state = port->actor_oper_port_state; | 731 | lacpdu->actor_state = port->actor_oper_port_state; |
| 732 | pr_debug("update lacpdu: %s, actor port state %x\n", | ||
| 733 | port->slave->dev->name, port->actor_oper_port_state); | ||
| 729 | 734 | ||
| 730 | /* lacpdu->reserved_3_1 initialized | 735 | /* lacpdu->reserved_3_1 initialized |
| 731 | * lacpdu->tlv_type_partner_info initialized | 736 | * lacpdu->tlv_type_partner_info initialized |
| @@ -898,7 +903,9 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 166 unmodified lines | |||
| 898 | if ((port->sm_vars & AD_PORT_SELECTED) && | 903 | if ((port->sm_vars & AD_PORT_SELECTED) && |
| 899 | (port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) && | 904 | (port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) && |
| 900 | !__check_agg_selection_timer(port)) { | 905 | !__check_agg_selection_timer(port)) { |
| 901 | port->sm_mux_state = AD_MUX_COLLECTING_DISTRIBUTING; | 906 | if (port->aggregator->is_active) |
| 907 | port->sm_mux_state = | ||
| 908 | AD_MUX_COLLECTING_DISTRIBUTING; | ||
| 902 | } else if (!(port->sm_vars & AD_PORT_SELECTED) || | 909 | } else if (!(port->sm_vars & AD_PORT_SELECTED) || |
| 903 | (port->sm_vars & AD_PORT_STANDBY)) { | 910 | (port->sm_vars & AD_PORT_STANDBY)) { |
| 904 | /* if UNSELECTED or STANDBY */ | 911 | /* if UNSELECTED or STANDBY */ |
| @@ -910,12 +917,16 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 5 unmodified lines | |||
| 910 | */ | 917 | */ |
| 911 | __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator)); | 918 | __set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator)); |
| 912 | port->sm_mux_state = AD_MUX_DETACHED; | 919 | port->sm_mux_state = AD_MUX_DETACHED; |
| 920 | } else if (port->aggregator->is_active) { | ||
| 921 | port->actor_oper_port_state |= | ||
| 922 | AD_STATE_SYNCHRONIZATION; | ||
| 913 | } | 923 | } |
| 914 | break; | 924 | break; |
| 915 | case AD_MUX_COLLECTING_DISTRIBUTING: | 925 | case AD_MUX_COLLECTING_DISTRIBUTING: |
| 916 | if (!(port->sm_vars & AD_PORT_SELECTED) || | 926 | if (!(port->sm_vars & AD_PORT_SELECTED) || |
| 917 | (port->sm_vars & AD_PORT_STANDBY) || | 927 | (port->sm_vars & AD_PORT_STANDBY) || |
| 918 | !(port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION)) { | 928 | !(port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) || |
| 929 | !(port->actor_oper_port_state & AD_STATE_SYNCHRONIZATION)) { | ||
| 919 | port->sm_mux_state = AD_MUX_ATTACHED; | 930 | port->sm_mux_state = AD_MUX_ATTACHED; |
| 920 | } else { | 931 | } else { |
| 921 | /* if port state hasn't changed make | 932 | /* if port state hasn't changed make |
| @@ -937,8 +948,10 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 15 unmodified lines | |||
| 937 | 948 | ||
| 938 | /* check if the state machine was changed */ | 949 | /* check if the state machine was changed */ |
| 939 | if (port->sm_mux_state != last_state) { | 950 | if (port->sm_mux_state != last_state) { |
| 940 | pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n", | 951 | pr_debug("Mux Machine: Port=%d (%s), Last State=%d, Curr State=%d\n", |
| 941 | port->actor_port_number, last_state, | 952 | port->actor_port_number, |
| 953 | port->slave->dev->name, | ||
| 954 | last_state, | ||
| 942 | port->sm_mux_state); | 955 | port->sm_mux_state); |
| 943 | switch (port->sm_mux_state) { | 956 | switch (port->sm_mux_state) { |
| 944 | case AD_MUX_DETACHED: | 957 | case AD_MUX_DETACHED: |
| @@ -953,7 +966,12 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 8 unmodified lines | |||
| 953 | port->sm_mux_timer_counter = __ad_timer_to_ticks(AD_WAIT_WHILE_TIMER, 0); | 966 | port->sm_mux_timer_counter = __ad_timer_to_ticks(AD_WAIT_WHILE_TIMER, 0); |
| 954 | break; | 967 | break; |
| 955 | case AD_MUX_ATTACHED: | 968 | case AD_MUX_ATTACHED: |
| 956 | port->actor_oper_port_state |= AD_STATE_SYNCHRONIZATION; | 969 | if (port->aggregator->is_active) |
| 970 | port->actor_oper_port_state |= | ||
| 971 | AD_STATE_SYNCHRONIZATION; | ||
| 972 | else | ||
| 973 | port->actor_oper_port_state &= | ||
| 974 | ~AD_STATE_SYNCHRONIZATION; | ||
| 957 | port->actor_oper_port_state &= ~AD_STATE_COLLECTING; | 975 | port->actor_oper_port_state &= ~AD_STATE_COLLECTING; |
| 958 | port->actor_oper_port_state &= ~AD_STATE_DISTRIBUTING; | 976 | port->actor_oper_port_state &= ~AD_STATE_DISTRIBUTING; |
| 959 | ad_disable_collecting_distributing(port, | 977 | ad_disable_collecting_distributing(port, |
| @@ -963,6 +981,7 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr) · 3 unmodified lines | |||
| 963 | case AD_MUX_COLLECTING_DISTRIBUTING: | 981 | case AD_MUX_COLLECTING_DISTRIBUTING: |
| 964 | port->actor_oper_port_state |= AD_STATE_COLLECTING; | 982 | port->actor_oper_port_state |= AD_STATE_COLLECTING; |
| 965 | port->actor_oper_port_state |= AD_STATE_DISTRIBUTING; | 983 | port->actor_oper_port_state |= AD_STATE_DISTRIBUTING; |
| 984 | port->actor_oper_port_state |= AD_STATE_SYNCHRONIZATION; | ||
| 966 | ad_enable_collecting_distributing(port, | 985 | ad_enable_collecting_distributing(port, |
| 967 | update_slave_arr); | 986 | update_slave_arr); |
| 968 | port->ntt = true; | 987 | port->ntt = true; |
| @@ -1044,8 +1063,10 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) · 75 unmodified lines | |||
| 1044 | 1063 | ||
| 1045 | /* check if the State machine was changed or new lacpdu arrived */ | 1064 | /* check if the State machine was changed or new lacpdu arrived */ |
| 1046 | if ((port->sm_rx_state != last_state) || (lacpdu)) { | 1065 | if ((port->sm_rx_state != last_state) || (lacpdu)) { |
| 1047 | pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n", | 1066 | pr_debug("Rx Machine: Port=%d (%s), Last State=%d, Curr State=%d\n", |
| 1048 | port->actor_port_number, last_state, | 1067 | port->actor_port_number, |
| 1068 | port->slave->dev->name, | ||
| 1069 | last_state, | ||
| 1049 | port->sm_rx_state); | 1070 | port->sm_rx_state); |
| 1050 | switch (port->sm_rx_state) { | 1071 | switch (port->sm_rx_state) { |
| 1051 | case AD_RX_INITIALIZE: | 1072 | case AD_RX_INITIALIZE: |
| @@ -1394,6 +1415,9 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) · 342 unmodified lines | |||
| 1394 | 1415 | ||
| 1395 | aggregator = __get_first_agg(port); | 1416 | aggregator = __get_first_agg(port); |
| 1396 | ad_agg_selection_logic(aggregator, update_slave_arr); | 1417 | ad_agg_selection_logic(aggregator, update_slave_arr); |
| 1418 | |||
| 1419 | if (!port->aggregator->is_active) | ||
| 1420 | port->actor_oper_port_state &= ~AD_STATE_SYNCHRONIZATION; | ||
| 1397 | } | 1421 | } |
| 1398 | 1422 | ||
| 1399 | /* Decide if "agg" is a better choice for the new active aggregator that | 1423 | /* Decide if "agg" is a better choice for the new active aggregator that |
| @@ -2195,8 +2219,10 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, · 795 unmodified lines | |||
| 2195 | switch (lacpdu->subtype) { | 2219 | switch (lacpdu->subtype) { |
| 2196 | case AD_TYPE_LACPDU: | 2220 | case AD_TYPE_LACPDU: |
| 2197 | ret = RX_HANDLER_CONSUMED; | 2221 | ret = RX_HANDLER_CONSUMED; |
| 2198 | netdev_dbg(slave->bond->dev, "Received LACPDU on port %d\n", | 2222 | netdev_dbg(slave->bond->dev, |
| 2199 | port->actor_port_number); | 2223 | "Received LACPDU on port %d slave %s\n", |
| 2224 | port->actor_port_number, | ||
| 2225 | slave->dev->name); | ||
| 2200 | /* Protect against concurrent state machines */ | 2226 | /* Protect against concurrent state machines */ |
| 2201 | spin_lock(&slave->bond->mode_lock); | 2227 | spin_lock(&slave->bond->mode_lock); |
| 2202 | ad_rx_machine(lacpdu, port); | 2228 | ad_rx_machine(lacpdu, port); |
| @@ -2288,7 +2314,10 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave) · 85 unmodified lines | |||
| 2288 | port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS; | 2314 | port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS; |
| 2289 | port->actor_oper_port_key = port->actor_admin_port_key |= | 2315 | port->actor_oper_port_key = port->actor_admin_port_key |= |
| 2290 | __get_duplex(port); | 2316 | __get_duplex(port); |
| 2291 | netdev_dbg(slave->bond->dev, "Port %d changed duplex\n", port->actor_port_number); | 2317 | netdev_dbg(slave->bond->dev, "Port %d slave %s changed duplex\n", |
| 2318 | port->actor_port_number, slave->dev->name); | ||
| 2319 | if (port->actor_oper_port_key & AD_DUPLEX_KEY_MASKS) | ||
| 2320 | port->sm_vars |= AD_PORT_LACP_ENABLED; | ||
| 2292 | /* there is no need to reselect a new aggregator, just signal the | 2321 | /* there is no need to reselect a new aggregator, just signal the |
| 2293 | * state machines to reinitialize | 2322 | * state machines to reinitialize |
| 2294 | */ | 2323 | */ |
| @@ -77,6 +77,7 @@ · 76 unmodified lines | |||
| 77 | #include <net/pkt_sched.h> | 77 | #include <net/pkt_sched.h> |
| 78 | #include <linux/rculist.h> | 78 | #include <linux/rculist.h> |
| 79 | #include <net/flow_keys.h> | 79 | #include <net/flow_keys.h> |
| 80 | #include <net/switchdev.h> | ||
| 80 | #include <net/bonding.h> | 81 | #include <net/bonding.h> |
| 81 | #include <net/bond_3ad.h> | 82 | #include <net/bond_3ad.h> |
| 82 | #include <net/bond_alb.h> | 83 | #include <net/bond_alb.h> |
| @@ -334,7 +335,7 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, · 251 unmodified lines | |||
| 334 | * | 335 | * |
| 335 | * Returns zero if carrier state does not change, nonzero if it does. | 336 | * Returns zero if carrier state does not change, nonzero if it does. |
| 336 | */ | 337 | */ |
| 337 | static int bond_set_carrier(struct bonding *bond) | 338 | int bond_set_carrier(struct bonding *bond) |
| 338 | { | 339 | { |
| 339 | struct list_head *iter; | 340 | struct list_head *iter; |
| 340 | struct slave *slave; | 341 | struct slave *slave; |
| @@ -789,7 +790,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) · 448 unmodified lines | |||
| 789 | } | 790 | } |
| 790 | 791 | ||
| 791 | new_active->delay = 0; | 792 | new_active->delay = 0; |
| 792 | new_active->link = BOND_LINK_UP; | 793 | bond_set_slave_link_state(new_active, BOND_LINK_UP); |
| 793 | 794 | ||
| 794 | if (BOND_MODE(bond) == BOND_MODE_8023AD) | 795 | if (BOND_MODE(bond) == BOND_MODE_8023AD) |
| 795 | bond_3ad_handle_link_change(new_active, BOND_LINK_UP); | 796 | bond_3ad_handle_link_change(new_active, BOND_LINK_UP); |
| @@ -979,7 +980,11 @@ static netdev_features_t bond_fix_features(struct net_device *dev, · 183 unmodified lines | |||
| 979 | netdev_features_t mask; | 980 | netdev_features_t mask; |
| 980 | struct slave *slave; | 981 | struct slave *slave; |
| 981 | 982 | ||
| 982 | mask = features; | 983 | /* If any slave has the offload feature flag set, |
| 984 | * set the offload flag on the bond. | ||
| 985 | */ | ||
| 986 | mask = features | NETIF_F_HW_SWITCH_OFFLOAD; | ||
| 987 | |||
| 983 | features &= ~NETIF_F_ONE_FOR_ALL; | 988 | features &= ~NETIF_F_ONE_FOR_ALL; |
| 984 | features |= NETIF_F_ALL_FOR_ALL; | 989 | features |= NETIF_F_ALL_FOR_ALL; |
| 985 | 990 | ||
| @@ -998,7 +1003,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev, · 12 unmodified lines | |||
| 998 | NETIF_F_HIGHDMA | NETIF_F_LRO) | 1003 | NETIF_F_HIGHDMA | NETIF_F_LRO) |
| 999 | 1004 | ||
| 1000 | #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\ | 1005 | #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\ |
| 1001 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL) | 1006 | NETIF_F_TSO) |
| 1002 | 1007 | ||
| 1003 | static void bond_compute_features(struct bonding *bond) | 1008 | static void bond_compute_features(struct bonding *bond) |
| 1004 | { | 1009 | { |
| @@ -1034,7 +1039,7 @@ static void bond_compute_features(struct bonding *bond) · 29 unmodified lines | |||
| 1034 | 1039 | ||
| 1035 | done: | 1040 | done: |
| 1036 | bond_dev->vlan_features = vlan_features; | 1041 | bond_dev->vlan_features = vlan_features; |
| 1037 | bond_dev->hw_enc_features = enc_features; | 1042 | bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL; |
| 1038 | bond_dev->hard_header_len = max_hard_header_len; | 1043 | bond_dev->hard_header_len = max_hard_header_len; |
| 1039 | bond_dev->gso_max_segs = gso_max_segs; | 1044 | bond_dev->gso_max_segs = gso_max_segs; |
| 1040 | netif_set_gso_max_size(bond_dev, gso_max_size); | 1045 | netif_set_gso_max_size(bond_dev, gso_max_size); |
| @@ -1176,6 +1181,56 @@ static void bond_free_slave(struct slave *slave) · 135 unmodified lines | |||
| 1176 | kfree(slave); | 1181 | kfree(slave); |
| 1177 | } | 1182 | } |
| 1178 | 1183 | ||
| 1184 | static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info) | ||
| 1185 | { | ||
| 1186 | info->bond_mode = BOND_MODE(bond); | ||
| 1187 | info->miimon = bond->params.miimon; | ||
| 1188 | info->num_slaves = bond->slave_cnt; | ||
| 1189 | } | ||
| 1190 | |||
| 1191 | static void bond_fill_ifslave(struct slave *slave, struct ifslave *info) | ||
| 1192 | { | ||
| 1193 | strcpy(info->slave_name, slave->dev->name); | ||
| 1194 | info->link = slave->link; | ||
| 1195 | info->state = bond_slave_state(slave); | ||
| 1196 | info->link_failure_count = slave->link_failure_count; | ||
| 1197 | } | ||
| 1198 | |||
| 1199 | static void bond_netdev_notify(struct net_device *dev, | ||
| 1200 | struct netdev_bonding_info *info) | ||
| 1201 | { | ||
| 1202 | rtnl_lock(); | ||
| 1203 | netdev_bonding_info_change(dev, info); | ||
| 1204 | rtnl_unlock(); | ||
| 1205 | } | ||
| 1206 | |||
| 1207 | static void bond_netdev_notify_work(struct work_struct *_work) | ||
| 1208 | { | ||
| 1209 | struct netdev_notify_work *w = | ||
| 1210 | container_of(_work, struct netdev_notify_work, work.work); | ||
| 1211 | |||
| 1212 | bond_netdev_notify(w->dev, &w->bonding_info); | ||
| 1213 | dev_put(w->dev); | ||
| 1214 | kfree(w); | ||
| 1215 | } | ||
| 1216 | |||
| 1217 | void bond_queue_slave_event(struct slave *slave) | ||
| 1218 | { | ||
| 1219 | struct bonding *bond = slave->bond; | ||
| 1220 | struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC); | ||
| 1221 | |||
| 1222 | if (!nnw) | ||
| 1223 | return; | ||
| 1224 | |||
| 1225 | dev_hold(slave->dev); | ||
| 1226 | nnw->dev = slave->dev; | ||
| 1227 | bond_fill_ifslave(slave, &nnw->bonding_info.slave); | ||
| 1228 | bond_fill_ifbond(bond, &nnw->bonding_info.master); | ||
| 1229 | INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work); | ||
| 1230 | |||
| 1231 | queue_delayed_work(slave->bond->wq, &nnw->work, 0); | ||
| 1232 | } | ||
| 1233 | |||
| 1179 | /* enslave device <slave> to bond device <master> */ | 1234 | /* enslave device <slave> to bond device <master> */ |
| 1180 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | 1235 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
| 1181 | { | 1236 | { |
| @@ -1439,19 +1494,22 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 257 unmodified lines | |||
| 1439 | if (bond->params.miimon) { | 1494 | if (bond->params.miimon) { |
| 1440 | if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { | 1495 | if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { |
| 1441 | if (bond->params.updelay) { | 1496 | if (bond->params.updelay) { |
| 1442 | new_slave->link = BOND_LINK_BACK; | 1497 | bond_set_slave_link_state(new_slave, |
| 1498 | BOND_LINK_BACK); | ||
| 1443 | new_slave->delay = bond->params.updelay; | 1499 | new_slave->delay = bond->params.updelay; |
| 1444 | } else { | 1500 | } else { |
| 1445 | new_slave->link = BOND_LINK_UP; | 1501 | bond_set_slave_link_state(new_slave, |
| 1502 | BOND_LINK_UP); | ||
| 1446 | } | 1503 | } |
| 1447 | } else { | 1504 | } else { |
| 1448 | new_slave->link = BOND_LINK_DOWN; | 1505 | bond_set_slave_link_state(new_slave, BOND_LINK_DOWN); |
| 1449 | } | 1506 | } |
| 1450 | } else if (bond->params.arp_interval) { | 1507 | } else if (bond->params.arp_interval) { |
| 1451 | new_slave->link = (netif_carrier_ok(slave_dev) ? | 1508 | bond_set_slave_link_state(new_slave, |
| 1452 | BOND_LINK_UP : BOND_LINK_DOWN); | 1509 | (netif_carrier_ok(slave_dev) ? |
| 1510 | BOND_LINK_UP : BOND_LINK_DOWN)); | ||
| 1453 | } else { | 1511 | } else { |
| 1454 | new_slave->link = BOND_LINK_UP; | 1512 | bond_set_slave_link_state(new_slave, BOND_LINK_UP); |
| 1455 | } | 1513 | } |
| 1456 | 1514 | ||
| 1457 | if (new_slave->link != BOND_LINK_DOWN) | 1515 | if (new_slave->link != BOND_LINK_DOWN) |
| @@ -1567,6 +1625,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 109 unmodified lines | |||
| 1567 | new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); | 1625 | new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); |
| 1568 | 1626 | ||
| 1569 | /* enslave is successful */ | 1627 | /* enslave is successful */ |
| 1628 | bond_queue_slave_event(new_slave); | ||
| 1570 | return 0; | 1629 | return 0; |
| 1571 | 1630 | ||
| 1572 | /* Undo stages on error */ | 1631 | /* Undo stages on error */ |
| @@ -1816,11 +1875,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, · 243 unmodified lines | |||
| 1816 | static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) | 1875 | static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) |
| 1817 | { | 1876 | { |
| 1818 | struct bonding *bond = netdev_priv(bond_dev); | 1877 | struct bonding *bond = netdev_priv(bond_dev); |
| 1819 | 1878 | bond_fill_ifbond(bond, info); | |
| 1820 | info->bond_mode = BOND_MODE(bond); | ||
| 1821 | info->miimon = bond->params.miimon; | ||
| 1822 | info->num_slaves = bond->slave_cnt; | ||
| 1823 | |||
| 1824 | return 0; | 1879 | return 0; |
| 1825 | } | 1880 | } |
| 1826 | 1881 | ||
| @@ -1834,10 +1889,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in · 7 unmodified lines | |||
| 1834 | bond_for_each_slave(bond, slave, iter) { | 1889 | bond_for_each_slave(bond, slave, iter) { |
| 1835 | if (i++ == (int)info->slave_id) { | 1890 | if (i++ == (int)info->slave_id) { |
| 1836 | res = 0; | 1891 | res = 0; |
| 1837 | strcpy(info->slave_name, slave->dev->name); | 1892 | bond_fill_ifslave(slave, info); |
| 1838 | info->link = slave->link; | ||
| 1839 | info->state = bond_slave_state(slave); | ||
| 1840 | info->link_failure_count = slave->link_failure_count; | ||
| 1841 | break; | 1893 | break; |
| 1842 | } | 1894 | } |
| 1843 | } | 1895 | } |
| @@ -1867,7 +1919,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 23 unmodified lines | |||
| 1867 | if (link_state) | 1919 | if (link_state) |
| 1868 | continue; | 1920 | continue; |
| 1869 | 1921 | ||
| 1870 | slave->link = BOND_LINK_FAIL; | 1922 | bond_set_slave_link_state(slave, BOND_LINK_FAIL); |
| 1871 | slave->delay = bond->params.downdelay; | 1923 | slave->delay = bond->params.downdelay; |
| 1872 | if (slave->delay) { | 1924 | if (slave->delay) { |
| 1873 | netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n", | 1925 | netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n", |
| @@ -1882,7 +1934,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 8 unmodified lines | |||
| 1882 | case BOND_LINK_FAIL: | 1934 | case BOND_LINK_FAIL: |
| 1883 | if (link_state) { | 1935 | if (link_state) { |
| 1884 | /* recovered before downdelay expired */ | 1936 | /* recovered before downdelay expired */ |
| 1885 | slave->link = BOND_LINK_UP; | 1937 | bond_set_slave_link_state(slave, BOND_LINK_UP); |
| 1886 | slave->last_link_up = jiffies; | 1938 | slave->last_link_up = jiffies; |
| 1887 | netdev_info(bond->dev, "link status up again after %d ms for interface %s\n", | 1939 | netdev_info(bond->dev, "link status up again after %d ms for interface %s\n", |
| 1888 | (bond->params.downdelay - slave->delay) * | 1940 | (bond->params.downdelay - slave->delay) * |
| @@ -1904,7 +1956,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 15 unmodified lines | |||
| 1904 | if (!link_state) | 1956 | if (!link_state) |
| 1905 | continue; | 1957 | continue; |
| 1906 | 1958 | ||
| 1907 | slave->link = BOND_LINK_BACK; | 1959 | bond_set_slave_link_state(slave, BOND_LINK_BACK); |
| 1908 | slave->delay = bond->params.updelay; | 1960 | slave->delay = bond->params.updelay; |
| 1909 | 1961 | ||
| 1910 | if (slave->delay) { | 1962 | if (slave->delay) { |
| @@ -1917,7 +1969,8 @@ static int bond_miimon_inspect(struct bonding *bond) · 6 unmodified lines | |||
| 1917 | /*FALLTHRU*/ | 1969 | /*FALLTHRU*/ |
| 1918 | case BOND_LINK_BACK: | 1970 | case BOND_LINK_BACK: |
| 1919 | if (!link_state) { | 1971 | if (!link_state) { |
| 1920 | slave->link = BOND_LINK_DOWN; | 1972 | bond_set_slave_link_state(slave, |
| 1973 | BOND_LINK_DOWN); | ||
| 1921 | netdev_info(bond->dev, "link status down again after %d ms for interface %s\n", | 1974 | netdev_info(bond->dev, "link status down again after %d ms for interface %s\n", |
| 1922 | (bond->params.updelay - slave->delay) * | 1975 | (bond->params.updelay - slave->delay) * |
| 1923 | bond->params.miimon, | 1976 | bond->params.miimon, |
| @@ -1955,7 +2008,7 @@ static void bond_miimon_commit(struct bonding *bond) · 31 unmodified lines | |||
| 1955 | continue; | 2008 | continue; |
| 1956 | 2009 | ||
| 1957 | case BOND_LINK_UP: | 2010 | case BOND_LINK_UP: |
| 1958 | slave->link = BOND_LINK_UP; | 2011 | bond_set_slave_link_state(slave, BOND_LINK_UP); |
| 1959 | slave->last_link_up = jiffies; | 2012 | slave->last_link_up = jiffies; |
| 1960 | 2013 | ||
| 1961 | primary = rtnl_dereference(bond->primary_slave); | 2014 | primary = rtnl_dereference(bond->primary_slave); |
| @@ -1995,7 +2048,7 @@ static void bond_miimon_commit(struct bonding *bond) · 33 unmodified lines | |||
| 1995 | if (slave->link_failure_count < UINT_MAX) | 2048 | if (slave->link_failure_count < UINT_MAX) |
| 1996 | slave->link_failure_count++; | 2049 | slave->link_failure_count++; |
| 1997 | 2050 | ||
| 1998 | slave->link = BOND_LINK_DOWN; | 2051 | bond_set_slave_link_state(slave, BOND_LINK_DOWN); |
| 1999 | 2052 | ||
| 2000 | if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP || | 2053 | if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP || |
| 2001 | BOND_MODE(bond) == BOND_MODE_8023AD) | 2054 | BOND_MODE(bond) == BOND_MODE_8023AD) |
| @@ -2578,7 +2631,7 @@ static void bond_ab_arp_commit(struct bonding *bond) · 576 unmodified lines | |||
| 2578 | struct slave *current_arp_slave; | 2631 | struct slave *current_arp_slave; |
| 2579 | 2632 | ||
| 2580 | current_arp_slave = rtnl_dereference(bond->current_arp_slave); | 2633 | current_arp_slave = rtnl_dereference(bond->current_arp_slave); |
| 2581 | slave->link = BOND_LINK_UP; | 2634 | bond_set_slave_link_state(slave, BOND_LINK_UP); |
| 2582 | if (current_arp_slave) { | 2635 | if (current_arp_slave) { |
| 2583 | bond_set_slave_inactive_flags( | 2636 | bond_set_slave_inactive_flags( |
| 2584 | current_arp_slave, | 2637 | current_arp_slave, |
| @@ -2601,7 +2654,7 @@ static void bond_ab_arp_commit(struct bonding *bond) · 16 unmodified lines | |||
| 2601 | if (slave->link_failure_count < UINT_MAX) | 2654 | if (slave->link_failure_count < UINT_MAX) |
| 2602 | slave->link_failure_count++; | 2655 | slave->link_failure_count++; |
| 2603 | 2656 | ||
| 2604 | slave->link = BOND_LINK_DOWN; | 2657 | bond_set_slave_link_state(slave, BOND_LINK_DOWN); |
| 2605 | bond_set_slave_inactive_flags(slave, | 2658 | bond_set_slave_inactive_flags(slave, |
| 2606 | BOND_SLAVE_NOTIFY_NOW); | 2659 | BOND_SLAVE_NOTIFY_NOW); |
| 2607 | 2660 | ||
| @@ -2680,7 +2733,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) · 72 unmodified lines | |||
| 2680 | * up when it is actually down | 2733 | * up when it is actually down |
| 2681 | */ | 2734 | */ |
| 2682 | if (!bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { | 2735 | if (!bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { |
| 2683 | slave->link = BOND_LINK_DOWN; | 2736 | bond_set_slave_link_state(slave, BOND_LINK_DOWN); |
| 2684 | if (slave->link_failure_count < UINT_MAX) | 2737 | if (slave->link_failure_count < UINT_MAX) |
| 2685 | slave->link_failure_count++; | 2738 | slave->link_failure_count++; |
| 2686 | 2739 | ||
| @@ -2700,7 +2753,7 @@ static bool bond_ab_arp_probe(struct bonding *bond) · 13 unmodified lines | |||
| 2700 | if (!new_slave) | 2753 | if (!new_slave) |
| 2701 | goto check_state; | 2754 | goto check_state; |
| 2702 | 2755 | ||
| 2703 | new_slave->link = BOND_LINK_BACK; | 2756 | bond_set_slave_link_state(new_slave, BOND_LINK_BACK); |
| 2704 | bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER); | 2757 | bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER); |
| 2705 | bond_arp_send_all(bond, new_slave); | 2758 | bond_arp_send_all(bond, new_slave); |
| 2706 | new_slave->last_link_up = jiffies; | 2759 | new_slave->last_link_up = jiffies; |
| @@ -3066,7 +3119,7 @@ static int bond_open(struct net_device *bond_dev) · 359 unmodified lines | |||
| 3066 | slave != rcu_access_pointer(bond->curr_active_slave)) { | 3119 | slave != rcu_access_pointer(bond->curr_active_slave)) { |
| 3067 | bond_set_slave_inactive_flags(slave, | 3120 | bond_set_slave_inactive_flags(slave, |
| 3068 | BOND_SLAVE_NOTIFY_NOW); | 3121 | BOND_SLAVE_NOTIFY_NOW); |
| 3069 | } else { | 3122 | } else if (BOND_MODE(bond) != BOND_MODE_8023AD) { |
| 3070 | bond_set_slave_active_flags(slave, | 3123 | bond_set_slave_active_flags(slave, |
| 3071 | BOND_SLAVE_NOTIFY_NOW); | 3124 | BOND_SLAVE_NOTIFY_NOW); |
| 3072 | } | 3125 | } |
| @@ -3734,7 +3787,7 @@ out: · 661 unmodified lines | |||
| 3734 | * usable slave array is formed in the control path. The xmit function | 3787 | * usable slave array is formed in the control path. The xmit function |
| 3735 | * just calculates hash and sends the packet out. | 3788 | * just calculates hash and sends the packet out. |
| 3736 | */ | 3789 | */ |
| 3737 | int bond_3ad_xor_xmit(struct sk_buff *skb, struct net_device *dev) | 3790 | static int bond_3ad_xor_xmit(struct sk_buff *skb, struct net_device *dev) |
| 3738 | { | 3791 | { |
| 3739 | struct bonding *bond = netdev_priv(dev); | 3792 | struct bonding *bond = netdev_priv(dev); |
| 3740 | struct slave *slave; | 3793 | struct slave *slave; |
| @@ -3952,6 +4005,8 @@ static const struct net_device_ops bond_netdev_ops = { · 211 unmodified lines | |||
| 3952 | .ndo_add_slave = bond_enslave, | 4005 | .ndo_add_slave = bond_enslave, |
| 3953 | .ndo_del_slave = bond_release, | 4006 | .ndo_del_slave = bond_release, |
| 3954 | .ndo_fix_features = bond_fix_features, | 4007 | .ndo_fix_features = bond_fix_features, |
| 4008 | .ndo_bridge_setlink = ndo_dflt_netdev_switch_port_bridge_setlink, | ||
| 4009 | .ndo_bridge_dellink = ndo_dflt_netdev_switch_port_bridge_dellink, | ||
| 3955 | }; | 4010 | }; |
| 3956 | 4011 | ||
| 3957 | static const struct device_type bond_type = { | 4012 | static const struct device_type bond_type = { |
| @@ -4010,7 +4065,7 @@ void bond_setup(struct net_device *bond_dev) · 52 unmodified lines | |||
| 4010 | NETIF_F_HW_VLAN_CTAG_FILTER; | 4065 | NETIF_F_HW_VLAN_CTAG_FILTER; |
| 4011 | 4066 | ||
| 4012 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); | 4067 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); |
| 4013 | bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | 4068 | bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; |
| 4014 | bond_dev->features |= bond_dev->hw_features; | 4069 | bond_dev->features |= bond_dev->hw_features; |
| 4015 | } | 4070 | } |
| 4016 | 4071 | ||
| @@ -186,7 +186,7 @@ static const struct bond_opt_value bond_tlb_dynamic_lb_tbl[] = { · 185 unmodified lines | |||
| 186 | { NULL, -1, 0} | 186 | { NULL, -1, 0} |
| 187 | }; | 187 | }; |
| 188 | 188 | ||
| 189 | static const struct bond_option bond_opts[] = { | 189 | static const struct bond_option bond_opts[BOND_OPT_LAST] = { |
| 190 | [BOND_OPT_MODE] = { | 190 | [BOND_OPT_MODE] = { |
| 191 | .id = BOND_OPT_MODE, | 191 | .id = BOND_OPT_MODE, |
| 192 | .name = "mode", | 192 | .name = "mode", |
| @@ -379,8 +379,7 @@ static const struct bond_option bond_opts[] = { · 186 unmodified lines | |||
| 379 | .values = bond_tlb_dynamic_lb_tbl, | 379 | .values = bond_tlb_dynamic_lb_tbl, |
| 380 | .flags = BOND_OPTFLAG_IFDOWN, | 380 | .flags = BOND_OPTFLAG_IFDOWN, |
| 381 | .set = bond_option_tlb_dynamic_lb_set, | 381 | .set = bond_option_tlb_dynamic_lb_set, |
| 382 | }, | 382 | } |
| 383 | { } | ||
| 384 | }; | 383 | }; |
| 385 | 384 | ||
| 386 | /* Searches for an option by name */ | 385 | /* Searches for an option by name */ |
| @@ -1182,6 +1181,7 @@ static int bond_option_min_links_set(struct bonding *bond, · 795 unmodified lines | |||
| 1182 | netdev_info(bond->dev, "Setting min links value to %llu\n", | 1181 | netdev_info(bond->dev, "Setting min links value to %llu\n", |
| 1183 | newval->value); | 1182 | newval->value); |
| 1184 | bond->params.min_links = newval->value; | 1183 | bond->params.min_links = newval->value; |
| 1184 | bond_set_carrier(bond); | ||
| 1185 | 1185 | ||
| 1186 | return 0; | 1186 | return 0; |
| 1187 | } | 1187 | } |
| @@ -138,7 +138,6 @@ struct at91_devtype_data { · 137 unmodified lines | |||
| 138 | 138 | ||
| 139 | struct at91_priv { | 139 | struct at91_priv { |
| 140 | struct can_priv can; /* must be the first member! */ | 140 | struct can_priv can; /* must be the first member! */ |
| 141 | struct net_device *dev; | ||
| 142 | struct napi_struct napi; | 141 | struct napi_struct napi; |
| 143 | 142 | ||
| 144 | void __iomem *reg_base; | 143 | void __iomem *reg_base; |
| @@ -1350,7 +1349,6 @@ static int at91_can_probe(struct platform_device *pdev) · 1205 unmodified lines | |||
| 1350 | priv->can.do_get_berr_counter = at91_get_berr_counter; | 1349 | priv->can.do_get_berr_counter = at91_get_berr_counter; |
| 1351 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | | 1350 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | |
| 1352 | CAN_CTRLMODE_LISTENONLY; | 1351 | CAN_CTRLMODE_LISTENONLY; |
| 1353 | priv->dev = dev; | ||
| 1354 | priv->reg_base = addr; | 1352 | priv->reg_base = addr; |
| 1355 | priv->devtype_data = *devtype_data; | 1353 | priv->devtype_data = *devtype_data; |
| 1356 | priv->clk = clk; | 1354 | priv->clk = clk; |
| @@ -352,6 +352,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) · 351 unmodified lines | |||
| 352 | netdev_dbg(dev, "bus-off mode interrupt\n"); | 352 | netdev_dbg(dev, "bus-off mode interrupt\n"); |
| 353 | state = CAN_STATE_BUS_OFF; | 353 | state = CAN_STATE_BUS_OFF; |
| 354 | cf->can_id |= CAN_ERR_BUSOFF; | 354 | cf->can_id |= CAN_ERR_BUSOFF; |
| 355 | priv->can.can_stats.bus_off++; | ||
| 355 | can_bus_off(dev); | 356 | can_bus_off(dev); |
| 356 | } | 357 | } |
| 357 | 358 | ||
| @@ -869,7 +869,7 @@ static int c_can_handle_state_change(struct net_device *dev, · 868 unmodified lines | |||
| 869 | case C_CAN_BUS_OFF: | 869 | case C_CAN_BUS_OFF: |
| 870 | /* bus-off state */ | 870 | /* bus-off state */ |
| 871 | priv->can.state = CAN_STATE_BUS_OFF; | 871 | priv->can.state = CAN_STATE_BUS_OFF; |
| 872 | can_bus_off(dev); | 872 | priv->can.can_stats.bus_off++; |
| 873 | break; | 873 | break; |
| 874 | default: | 874 | default: |
| 875 | break; | 875 | break; |
| @@ -535,6 +535,7 @@ static int cc770_err(struct net_device *dev, u8 status) · 534 unmodified lines | |||
| 535 | cc770_write_reg(priv, control, CTRL_INI); | 535 | cc770_write_reg(priv, control, CTRL_INI); |
| 536 | cf->can_id |= CAN_ERR_BUSOFF; | 536 | cf->can_id |= CAN_ERR_BUSOFF; |
| 537 | priv->can.state = CAN_STATE_BUS_OFF; | 537 | priv->can.state = CAN_STATE_BUS_OFF; |
| 538 | priv->can.can_stats.bus_off++; | ||
| 538 | can_bus_off(dev); | 539 | can_bus_off(dev); |
| 539 | } else if (status & STAT_WARN) { | 540 | } else if (status & STAT_WARN) { |
| 540 | cf->can_id |= CAN_ERR_CRTL; | 541 | cf->can_id |= CAN_ERR_CRTL; |
| @@ -289,9 +289,11 @@ static void can_update_state_error_stats(struct net_device *dev, · 288 unmodified lines | |||
| 289 | priv->can_stats.error_passive++; | 289 | priv->can_stats.error_passive++; |
| 290 | break; | 290 | break; |
| 291 | case CAN_STATE_BUS_OFF: | 291 | case CAN_STATE_BUS_OFF: |
| 292 | priv->can_stats.bus_off++; | ||
| 293 | break; | ||
| 292 | default: | 294 | default: |
| 293 | break; | 295 | break; |
| 294 | }; | 296 | } |
| 295 | } | 297 | } |
| 296 | 298 | ||
| 297 | static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) | 299 | static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) |
| @@ -544,7 +546,6 @@ void can_bus_off(struct net_device *dev) · 246 unmodified lines | |||
| 544 | netdev_dbg(dev, "bus-off\n"); | 546 | netdev_dbg(dev, "bus-off\n"); |
| 545 | 547 | ||
| 546 | netif_carrier_off(dev); | 548 | netif_carrier_off(dev); |
| 547 | priv->can_stats.bus_off++; | ||
| 548 | 549 | ||
| 549 | if (priv->restart_ms) | 550 | if (priv->restart_ms) |
| 550 | mod_timer(&priv->restart_timer, | 551 | mod_timer(&priv->restart_timer, |
| @@ -247,7 +247,6 @@ struct flexcan_devtype_data { · 246 unmodified lines | |||
| 247 | 247 | ||
| 248 | struct flexcan_priv { | 248 | struct flexcan_priv { |
| 249 | struct can_priv can; | 249 | struct can_priv can; |
| 250 | struct net_device *dev; | ||
| 251 | struct napi_struct napi; | 250 | struct napi_struct napi; |
| 252 | 251 | ||
| 253 | void __iomem *base; | 252 | void __iomem *base; |
| @@ -1220,7 +1219,6 @@ static int flexcan_probe(struct platform_device *pdev) · 966 unmodified lines | |||
| 1220 | CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_3_SAMPLES | | 1219 | CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_3_SAMPLES | |
| 1221 | CAN_CTRLMODE_BERR_REPORTING; | 1220 | CAN_CTRLMODE_BERR_REPORTING; |
| 1222 | priv->base = base; | 1221 | priv->base = base; |
| 1223 | priv->dev = dev; | ||
| 1224 | priv->clk_ipg = clk_ipg; | 1222 | priv->clk_ipg = clk_ipg; |
| 1225 | priv->clk_per = clk_per; | 1223 | priv->clk_per = clk_per; |
| 1226 | priv->pdata = dev_get_platdata(&pdev->dev); | 1224 | priv->pdata = dev_get_platdata(&pdev->dev); |
| @@ -1008,6 +1008,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) · 1007 unmodified lines | |||
| 1008 | if (status & SR_BS) { | 1008 | if (status & SR_BS) { |
| 1009 | state = CAN_STATE_BUS_OFF; | 1009 | state = CAN_STATE_BUS_OFF; |
| 1010 | cf->can_id |= CAN_ERR_BUSOFF; | 1010 | cf->can_id |= CAN_ERR_BUSOFF; |
| 1011 | mod->can.can_stats.bus_off++; | ||
| 1011 | can_bus_off(dev); | 1012 | can_bus_off(dev); |
| 1012 | } else if (status & SR_ES) { | 1013 | } else if (status & SR_ES) { |
| 1013 | if (rxerr >= 128 || txerr >= 128) | 1014 | if (rxerr >= 128 || txerr >= 128) |
| @@ -1678,8 +1679,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev, · 664 unmodified lines | |||
| 1678 | if (ret) | 1679 | if (ret) |
| 1679 | return ret; | 1680 | return ret; |
| 1680 | 1681 | ||
| 1681 | ret = wait_for_completion_timeout(&mod->buserror_comp, HZ); | 1682 | if (!wait_for_completion_timeout(&mod->buserror_comp, HZ)) { |
| 1682 | if (ret == 0) { | ||
| 1683 | netdev_info(mod->ndev, "%s timed out\n", __func__); | 1683 | netdev_info(mod->ndev, "%s timed out\n", __func__); |
| 1684 | return -ETIMEDOUT; | 1684 | return -ETIMEDOUT; |
| 1685 | } | 1685 | } |
| @@ -1704,8 +1704,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev, · 18 unmodified lines | |||
| 1704 | if (ret) | 1704 | if (ret) |
| 1705 | return ret; | 1705 | return ret; |
| 1706 | 1706 | ||
| 1707 | ret = wait_for_completion_timeout(&mod->termination_comp, HZ); | 1707 | if (!wait_for_completion_timeout(&mod->termination_comp, HZ)) { |
| 1708 | if (ret == 0) { | ||
| 1709 | netdev_info(mod->ndev, "%s timed out\n", __func__); | 1708 | netdev_info(mod->ndev, "%s timed out\n", __func__); |
| 1710 | return -ETIMEDOUT; | 1709 | return -ETIMEDOUT; |
| 1711 | } | 1710 | } |
| @@ -589,6 +589,7 @@ static int m_can_handle_state_change(struct net_device *dev, · 588 unmodified lines | |||
| 589 | /* bus-off state */ | 589 | /* bus-off state */ |
| 590 | priv->can.state = CAN_STATE_BUS_OFF; | 590 | priv->can.state = CAN_STATE_BUS_OFF; |
| 591 | m_can_disable_all_interrupts(priv); | 591 | m_can_disable_all_interrupts(priv); |
| 592 | priv->can.can_stats.bus_off++; | ||
| 592 | can_bus_off(dev); | 593 | can_bus_off(dev); |
| 593 | break; | 594 | break; |
| 594 | default: | 595 | default: |
| @@ -505,6 +505,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) · 504 unmodified lines | |||
| 505 | pch_can_set_rx_all(priv, 0); | 505 | pch_can_set_rx_all(priv, 0); |
| 506 | state = CAN_STATE_BUS_OFF; | 506 | state = CAN_STATE_BUS_OFF; |
| 507 | cf->can_id |= CAN_ERR_BUSOFF; | 507 | cf->can_id |= CAN_ERR_BUSOFF; |
| 508 | priv->can.can_stats.bus_off++; | ||
| 508 | can_bus_off(ndev); | 509 | can_bus_off(ndev); |
| 509 | } | 510 | } |
| 510 | 511 | ||
| @@ -331,6 +331,7 @@ static void rcar_can_error(struct net_device *ndev) · 330 unmodified lines | |||
| 331 | priv->can.state = CAN_STATE_BUS_OFF; | 331 | priv->can.state = CAN_STATE_BUS_OFF; |
| 332 | /* Clear interrupt condition */ | 332 | /* Clear interrupt condition */ |
| 333 | writeb(~RCAR_CAN_EIFR_BOEIF, &priv->regs->eifr); | 333 | writeb(~RCAR_CAN_EIFR_BOEIF, &priv->regs->eifr); |
| 334 | priv->can.can_stats.bus_off++; | ||
| 334 | can_bus_off(ndev); | 335 | can_bus_off(ndev); |
| 335 | if (skb) | 336 | if (skb) |
| 336 | cf->can_id |= CAN_ERR_BUSOFF; | 337 | cf->can_id |= CAN_ERR_BUSOFF; |
| @@ -261,6 +261,7 @@ static int softing_handle_1(struct softing *card) · 260 unmodified lines | |||
| 261 | ++priv->can.can_stats.error_passive; | 261 | ++priv->can.can_stats.error_passive; |
| 262 | else if (can_state == CAN_STATE_BUS_OFF) { | 262 | else if (can_state == CAN_STATE_BUS_OFF) { |
| 263 | /* this calls can_close_cleanup() */ | 263 | /* this calls can_close_cleanup() */ |
| 264 | ++priv->can.can_stats.bus_off; | ||
| 264 | can_bus_off(netdev); | 265 | can_bus_off(netdev); |
| 265 | netif_stop_queue(netdev); | 266 | netif_stop_queue(netdev); |
| 266 | } | 267 | } |
| @@ -905,6 +905,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) · 904 unmodified lines | |||
| 905 | if (priv->can.state == CAN_STATE_BUS_OFF) { | 905 | if (priv->can.state == CAN_STATE_BUS_OFF) { |
| 906 | if (priv->can.restart_ms == 0) { | 906 | if (priv->can.restart_ms == 0) { |
| 907 | priv->force_quit = 1; | 907 | priv->force_quit = 1; |
| 908 | priv->can.can_stats.bus_off++; | ||
| 908 | can_bus_off(net); | 909 | can_bus_off(net); |
| 909 | mcp251x_hw_sleep(spi); | 910 | mcp251x_hw_sleep(spi); |
| 910 | break; | 911 | break; |
| @@ -715,6 +715,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 714 unmodified lines | |||
| 715 | hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); | 715 | hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); |
| 716 | /* Disable all interrupts in bus-off to avoid int hog */ | 716 | /* Disable all interrupts in bus-off to avoid int hog */ |
| 717 | hecc_write(priv, HECC_CANGIM, 0); | 717 | hecc_write(priv, HECC_CANGIM, 0); |
| 718 | ++priv->can.can_stats.bus_off; | ||
| 718 | can_bus_off(ndev); | 719 | can_bus_off(ndev); |
| 719 | } | 720 | } |
| 720 | 721 | ||
| @@ -25,7 +25,7 @@ config CAN_KVASER_USB · 24 unmodified lines | |||
| 25 | tristate "Kvaser CAN/USB interface" | 25 | tristate "Kvaser CAN/USB interface" |
| 26 | ---help--- | 26 | ---help--- |
| 27 | This driver adds support for Kvaser CAN/USB devices like Kvaser | 27 | This driver adds support for Kvaser CAN/USB devices like Kvaser |
| 28 | Leaf Light. | 28 | Leaf Light and Kvaser USBcan II. |
| 29 | 29 | ||
| 30 | The driver provides support for the following devices: | 30 | The driver provides support for the following devices: |
| 31 | - Kvaser Leaf Light | 31 | - Kvaser Leaf Light |
| @@ -46,6 +46,12 @@ config CAN_KVASER_USB · 14 unmodified lines | |||
| 46 | - Kvaser USBcan R | 46 | - Kvaser USBcan R |
| 47 | - Kvaser Leaf Light v2 | 47 | - Kvaser Leaf Light v2 |
| 48 | - Kvaser Mini PCI Express HS | 48 | - Kvaser Mini PCI Express HS |
| 49 | - Kvaser USBcan II HS/HS | ||
| 50 | - Kvaser USBcan II HS/LS | ||
| 51 | - Kvaser USBcan Rugged ("USBcan Rev B") | ||
| 52 | - Kvaser Memorator HS/HS | ||
| 53 | - Kvaser Memorator HS/LS | ||
| 54 | - Scania VCI2 (if you have the Kvaser logo on top) | ||
| 49 | 55 | ||
| 50 | If unsure, say N. | 56 | If unsure, say N. |
| 51 | 57 | ||
| @@ -53,10 +59,18 @@ config CAN_KVASER_USB · 1 unmodified line | |||
| 53 | module will be called kvaser_usb. | 59 | module will be called kvaser_usb. |
| 54 | 60 | ||
| 55 | config CAN_PEAK_USB | 61 | config CAN_PEAK_USB |
| 56 | tristate "PEAK PCAN-USB/USB Pro interfaces" | 62 | tristate "PEAK PCAN-USB/USB Pro interfaces for CAN 2.0b/CAN-FD" |
| 57 | ---help--- | 63 | ---help--- |
| 58 | This driver supports the PCAN-USB and PCAN-USB Pro adapters | 64 | This driver supports the PEAK-System Technik USB adapters that enable |
| 59 | from PEAK-System Technik (http://www.peak-system.com). | 65 | access to the CAN bus, with repect to the CAN 2.0b and/or CAN-FD |
| 66 | standards, that is: | ||
| 67 | |||
| 68 | PCAN-USB single CAN 2.0b channel USB adapter | ||
| 69 | PCAN-USB Pro dual CAN 2.0b channels USB adapter | ||
| 70 | PCAN-USB FD single CAN-FD channel USB adapter | ||
| 71 | PCAN-USB Pro FD dual CAN-FD channels USB adapter | ||
| 72 | |||
| 73 | (see also http://www.peak-system.com). | ||
| 60 | 74 | ||
| 61 | config CAN_8DEV_USB | 75 | config CAN_8DEV_USB |
| 62 | tristate "8 devices USB2CAN interface" | 76 | tristate "8 devices USB2CAN interface" |
| @@ -347,6 +347,7 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) · 346 unmodified lines | |||
| 347 | dev->can.state = CAN_STATE_BUS_OFF; | 347 | dev->can.state = CAN_STATE_BUS_OFF; |
| 348 | cf->can_id |= CAN_ERR_BUSOFF; | 348 | cf->can_id |= CAN_ERR_BUSOFF; |
| 349 | 349 | ||
| 350 | dev->can.can_stats.bus_off++; | ||
| 350 | can_bus_off(dev->netdev); | 351 | can_bus_off(dev->netdev); |
| 351 | } else if (state & SJA1000_SR_ES) { | 352 | } else if (state & SJA1000_SR_ES) { |
| 352 | dev->can.state = CAN_STATE_ERROR_WARNING; | 353 | dev->can.state = CAN_STATE_ERROR_WARNING; |
| @@ -250,6 +250,7 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, · 249 unmodified lines | |||
| 250 | case ESD_BUSSTATE_BUSOFF: | 250 | case ESD_BUSSTATE_BUSOFF: |
| 251 | priv->can.state = CAN_STATE_BUS_OFF; | 251 | priv->can.state = CAN_STATE_BUS_OFF; |
| 252 | cf->can_id |= CAN_ERR_BUSOFF; | 252 | cf->can_id |= CAN_ERR_BUSOFF; |
| 253 | priv->can.can_stats.bus_off++; | ||
| 253 | can_bus_off(priv->netdev); | 254 | can_bus_off(priv->netdev); |
| 254 | break; | 255 | break; |
| 255 | case ESD_BUSSTATE_WARN: | 256 | case ESD_BUSSTATE_WARN: |
| @@ -6,10 +6,12 @@ · 5 unmodified lines | |||
| 6 | * Parts of this driver are based on the following: | 6 | * Parts of this driver are based on the following: |
| 7 | * - Kvaser linux leaf driver (version 4.78) | 7 | * - Kvaser linux leaf driver (version 4.78) |
| 8 | * - CAN driver for esd CAN-USB/2 | 8 | * - CAN driver for esd CAN-USB/2 |
| 9 | * - Kvaser linux usbcanII driver (version 5.3) | ||
| 9 | * | 10 | * |
| 10 | * Copyright (C) 2002-2006 KVASER AB, Sweden. All rights reserved. | 11 | * Copyright (C) 2002-2006 KVASER AB, Sweden. All rights reserved. |
| 11 | * Copyright (C) 2010 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh | 12 | * Copyright (C) 2010 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh |
| 12 | * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be> | 13 | * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be> |
| 14 | * Copyright (C) 2015 Valeo S.A. | ||
| 13 | */ | 15 | */ |
| 14 | 16 | ||
| 15 | #include <linux/completion.h> | 17 | #include <linux/completion.h> |
| @@ -30,8 +32,9 @@ · 14 unmodified lines | |||
| 30 | #define RX_BUFFER_SIZE 3072 | 32 | #define RX_BUFFER_SIZE 3072 |
| 31 | #define CAN_USB_CLOCK 8000000 | 33 | #define CAN_USB_CLOCK 8000000 |
| 32 | #define MAX_NET_DEVICES 3 | 34 | #define MAX_NET_DEVICES 3 |
| 35 | #define MAX_USBCAN_NET_DEVICES 2 | ||
| 33 | 36 | ||
| 34 | /* Kvaser USB devices */ | 37 | /* Kvaser Leaf USB devices */ |
| 35 | #define KVASER_VENDOR_ID 0x0bfd | 38 | #define KVASER_VENDOR_ID 0x0bfd |
| 36 | #define USB_LEAF_DEVEL_PRODUCT_ID 10 | 39 | #define USB_LEAF_DEVEL_PRODUCT_ID 10 |
| 37 | #define USB_LEAF_LITE_PRODUCT_ID 11 | 40 | #define USB_LEAF_LITE_PRODUCT_ID 11 |
| @@ -56,6 +59,24 @@ · 18 unmodified lines | |||
| 56 | #define USB_LEAF_LITE_V2_PRODUCT_ID 288 | 59 | #define USB_LEAF_LITE_V2_PRODUCT_ID 288 |
| 57 | #define USB_MINI_PCIE_HS_PRODUCT_ID 289 | 60 | #define USB_MINI_PCIE_HS_PRODUCT_ID 289 |
| 58 | 61 | ||
| 62 | static inline bool kvaser_is_leaf(const struct usb_device_id *id) | ||
| 63 | { | ||
| 64 | return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID && | ||
| 65 | id->idProduct <= USB_MINI_PCIE_HS_PRODUCT_ID; | ||
| 66 | } | ||
| 67 | |||
| 68 | /* Kvaser USBCan-II devices */ | ||
| 69 | #define USB_USBCAN_REVB_PRODUCT_ID 2 | ||
| 70 | #define USB_VCI2_PRODUCT_ID 3 | ||
| 71 | #define USB_USBCAN2_PRODUCT_ID 4 | ||
| 72 | #define USB_MEMORATOR_PRODUCT_ID 5 | ||
| 73 | |||
| 74 | static inline bool kvaser_is_usbcan(const struct usb_device_id *id) | ||
| 75 | { | ||
| 76 | return id->idProduct >= USB_USBCAN_REVB_PRODUCT_ID && | ||
| 77 | id->idProduct <= USB_MEMORATOR_PRODUCT_ID; | ||
| 78 | } | ||
| 79 | |||
| 59 | /* USB devices features */ | 80 | /* USB devices features */ |
| 60 | #define KVASER_HAS_SILENT_MODE BIT(0) | 81 | #define KVASER_HAS_SILENT_MODE BIT(0) |
| 61 | #define KVASER_HAS_TXRX_ERRORS BIT(1) | 82 | #define KVASER_HAS_TXRX_ERRORS BIT(1) |
| @@ -73,7 +94,7 @@ · 11 unmodified lines | |||
| 73 | #define MSG_FLAG_TX_ACK BIT(6) | 94 | #define MSG_FLAG_TX_ACK BIT(6) |
| 74 | #define MSG_FLAG_TX_REQUEST BIT(7) | 95 | #define MSG_FLAG_TX_REQUEST BIT(7) |
| 75 | 96 | ||
| 76 | /* Can states */ | 97 | /* Can states (M16C CxSTRH register) */ |
| 77 | #define M16C_STATE_BUS_RESET BIT(0) | 98 | #define M16C_STATE_BUS_RESET BIT(0) |
| 78 | #define M16C_STATE_BUS_ERROR BIT(4) | 99 | #define M16C_STATE_BUS_ERROR BIT(4) |
| 79 | #define M16C_STATE_BUS_PASSIVE BIT(5) | 100 | #define M16C_STATE_BUS_PASSIVE BIT(5) |
| @@ -98,7 +119,11 @@ · 18 unmodified lines | |||
| 98 | #define CMD_START_CHIP_REPLY 27 | 119 | #define CMD_START_CHIP_REPLY 27 |
| 99 | #define CMD_STOP_CHIP 28 | 120 | #define CMD_STOP_CHIP 28 |
| 100 | #define CMD_STOP_CHIP_REPLY 29 | 121 | #define CMD_STOP_CHIP_REPLY 29 |
| 101 | #define CMD_GET_CARD_INFO2 32 | 122 | |
| 123 | #define CMD_LEAF_GET_CARD_INFO2 32 | ||
| 124 | #define CMD_USBCAN_RESET_CLOCK 32 | ||
| 125 | #define CMD_USBCAN_CLOCK_OVERFLOW_EVENT 33 | ||
| 126 | |||
| 102 | #define CMD_GET_CARD_INFO 34 | 127 | #define CMD_GET_CARD_INFO 34 |
| 103 | #define CMD_GET_CARD_INFO_REPLY 35 | 128 | #define CMD_GET_CARD_INFO_REPLY 35 |
| 104 | #define CMD_GET_SOFTWARE_INFO 38 | 129 | #define CMD_GET_SOFTWARE_INFO 38 |
| @@ -108,8 +133,9 @@ · 3 unmodified lines | |||
| 108 | #define CMD_RESET_ERROR_COUNTER 49 | 133 | #define CMD_RESET_ERROR_COUNTER 49 |
| 109 | #define CMD_TX_ACKNOWLEDGE 50 | 134 | #define CMD_TX_ACKNOWLEDGE 50 |
| 110 | #define CMD_CAN_ERROR_EVENT 51 | 135 | #define CMD_CAN_ERROR_EVENT 51 |
| 111 | #define CMD_USB_THROTTLE 77 | 136 | |
| 112 | #define CMD_LOG_MESSAGE 106 | 137 | #define CMD_LEAF_USB_THROTTLE 77 |
| 138 | #define CMD_LEAF_LOG_MESSAGE 106 | ||
| 113 | 139 | ||
| 114 | /* error factors */ | 140 | /* error factors */ |
| 115 | #define M16C_EF_ACKE BIT(0) | 141 | #define M16C_EF_ACKE BIT(0) |
| @@ -121,6 +147,14 @@ · 5 unmodified lines | |||
| 121 | #define M16C_EF_RCVE BIT(6) | 147 | #define M16C_EF_RCVE BIT(6) |
| 122 | #define M16C_EF_TRE BIT(7) | 148 | #define M16C_EF_TRE BIT(7) |
| 123 | 149 | ||
| 150 | /* Only Leaf-based devices can report M16C error factors, | ||
| 151 | * thus define our own error status flags for USBCANII | ||
| 152 | */ | ||
| 153 | #define USBCAN_ERROR_STATE_NONE 0 | ||
| 154 | #define USBCAN_ERROR_STATE_TX_ERROR BIT(0) | ||
| 155 | #define USBCAN_ERROR_STATE_RX_ERROR BIT(1) | ||
| 156 | #define USBCAN_ERROR_STATE_BUSERROR BIT(2) | ||
| 157 | |||
| 124 | /* bittiming parameters */ | 158 | /* bittiming parameters */ |
| 125 | #define KVASER_USB_TSEG1_MIN 1 | 159 | #define KVASER_USB_TSEG1_MIN 1 |
| 126 | #define KVASER_USB_TSEG1_MAX 16 | 160 | #define KVASER_USB_TSEG1_MAX 16 |
| @@ -137,9 +171,18 @@ · 10 unmodified lines | |||
| 137 | #define KVASER_CTRL_MODE_SELFRECEPTION 3 | 171 | #define KVASER_CTRL_MODE_SELFRECEPTION 3 |
| 138 | #define KVASER_CTRL_MODE_OFF 4 | 172 | #define KVASER_CTRL_MODE_OFF 4 |
| 139 | 173 | ||
| 140 | /* log message */ | 174 | /* Extended CAN identifier flag */ |
| 141 | #define KVASER_EXTENDED_FRAME BIT(31) | 175 | #define KVASER_EXTENDED_FRAME BIT(31) |
| 142 | 176 | ||
| 177 | /* Kvaser USB CAN dongles are divided into two major families: | ||
| 178 | * - Leaf: Based on Renesas M32C, running firmware labeled as 'filo' | ||
| 179 | * - UsbcanII: Based on Renesas M16C, running firmware labeled as 'helios' | ||
| 180 | */ | ||
| 181 | enum kvaser_usb_family { | ||
| 182 | KVASER_LEAF, | ||
| 183 | KVASER_USBCAN, | ||
| 184 | }; | ||
| 185 | |||
| 143 | struct kvaser_msg_simple { | 186 | struct kvaser_msg_simple { |
| 144 | u8 tid; | 187 | u8 tid; |
| 145 | u8 channel; | 188 | u8 channel; |
| @@ -148,30 +191,55 @@ struct kvaser_msg_simple { · 2 unmodified lines | |||
| 148 | struct kvaser_msg_cardinfo { | 191 | struct kvaser_msg_cardinfo { |
| 149 | u8 tid; | 192 | u8 tid; |
| 150 | u8 nchannels; | 193 | u8 nchannels; |
| 151 | __le32 serial_number; | 194 | union { |
| 152 | __le32 padding; | 195 | struct { |
| 196 | __le32 serial_number; | ||
| 197 | __le32 padding; | ||
| 198 | } __packed leaf0; | ||
| 199 | struct { | ||
| 200 | __le32 serial_number_low; | ||
| 201 | __le32 serial_number_high; | ||
| 202 | } __packed usbcan0; | ||
| 203 | } __packed; | ||
| 153 | __le32 clock_resolution; | 204 | __le32 clock_resolution; |
| 154 | __le32 mfgdate; | 205 | __le32 mfgdate; |
| 155 | u8 ean[8]; | 206 | u8 ean[8]; |
| 156 | u8 hw_revision; | 207 | u8 hw_revision; |
| 157 | u8 usb_hs_mode; | 208 | union { |
| 158 | __le16 padding2; | 209 | struct { |
| 210 | u8 usb_hs_mode; | ||
| 211 | } __packed leaf1; | ||
| 212 | struct { | ||
| 213 | u8 padding; | ||
| 214 | } __packed usbcan1; | ||
| 215 | } __packed; | ||
| 216 | __le16 padding; | ||
| 159 | } __packed; | 217 | } __packed; |
| 160 | 218 | ||
| 161 | struct kvaser_msg_cardinfo2 { | 219 | struct kvaser_msg_cardinfo2 { |
| 162 | u8 tid; | 220 | u8 tid; |
| 163 | u8 channel; | 221 | u8 reserved; |
| 164 | u8 pcb_id[24]; | 222 | u8 pcb_id[24]; |
| 165 | __le32 oem_unlock_code; | 223 | __le32 oem_unlock_code; |
| 166 | } __packed; | 224 | } __packed; |
| 167 | 225 | ||
| 168 | struct kvaser_msg_softinfo { | 226 | struct leaf_msg_softinfo { |
| 169 | u8 tid; | 227 | u8 tid; |
| 170 | u8 channel; | 228 | u8 padding0; |
| 171 | __le32 sw_options; | 229 | __le32 sw_options; |
| 172 | __le32 fw_version; | 230 | __le32 fw_version; |
| 173 | __le16 max_outstanding_tx; | 231 | __le16 max_outstanding_tx; |
| 174 | __le16 padding[9]; | 232 | __le16 padding1[9]; |
| 233 | } __packed; | ||
| 234 | |||
| 235 | struct usbcan_msg_softinfo { | ||
| 236 | u8 tid; | ||
| 237 | u8 fw_name[5]; | ||
| 238 | __le16 max_outstanding_tx; | ||
| 239 | u8 padding[6]; | ||
| 240 | __le32 fw_version; | ||
| 241 | __le16 checksum; | ||
| 242 | __le16 sw_options; | ||
| 175 | } __packed; | 243 | } __packed; |
| 176 | 244 | ||
| 177 | struct kvaser_msg_busparams { | 245 | struct kvaser_msg_busparams { |
| @@ -188,36 +256,86 @@ struct kvaser_msg_tx_can { · 10 unmodified lines | |||
| 188 | u8 channel; | 256 | u8 channel; |
| 189 | u8 tid; | 257 | u8 tid; |
| 190 | u8 msg[14]; | 258 | u8 msg[14]; |
| 191 | u8 padding; | 259 | union { |
| 192 | u8 flags; | 260 | struct { |
| 261 | u8 padding; | ||
| 262 | u8 flags; | ||
| 263 | } __packed leaf; | ||
| 264 | struct { | ||
| 265 | u8 flags; | ||
| 266 | u8 padding; | ||
| 267 | } __packed usbcan; | ||
| 268 | } __packed; | ||
| 269 | } __packed; | ||
| 270 | |||
| 271 | struct kvaser_msg_rx_can_header { | ||
| 272 | u8 channel; | ||
| 273 | u8 flag; | ||
| 193 | } __packed; | 274 | } __packed; |
| 194 | 275 | ||
| 195 | struct kvaser_msg_rx_can { | 276 | struct leaf_msg_rx_can { |
| 196 | u8 channel; | 277 | u8 channel; |
| 197 | u8 flag; | 278 | u8 flag; |
| 279 | |||
| 198 | __le16 time[3]; | 280 | __le16 time[3]; |
| 199 | u8 msg[14]; | 281 | u8 msg[14]; |
| 200 | } __packed; | 282 | } __packed; |
| 201 | 283 | ||
| 202 | struct kvaser_msg_chip_state_event { | 284 | struct usbcan_msg_rx_can { |
| 285 | u8 channel; | ||
| 286 | u8 flag; | ||
| 287 | |||
| 288 | u8 msg[14]; | ||
| 289 | __le16 time; | ||
| 290 | } __packed; | ||
| 291 | |||
| 292 | struct leaf_msg_chip_state_event { | ||
| 203 | u8 tid; | 293 | u8 tid; |
| 204 | u8 channel; | 294 | u8 channel; |
| 295 | |||
| 205 | __le16 time[3]; | 296 | __le16 time[3]; |
| 206 | u8 tx_errors_count; | 297 | u8 tx_errors_count; |
| 207 | u8 rx_errors_count; | 298 | u8 rx_errors_count; |
| 299 | |||
| 208 | u8 status; | 300 | u8 status; |
| 209 | u8 padding[3]; | 301 | u8 padding[3]; |
| 210 | } __packed; | 302 | } __packed; |
| 211 | 303 | ||
| 212 | struct kvaser_msg_tx_acknowledge { | 304 | struct usbcan_msg_chip_state_event { |
| 305 | u8 tid; | ||
| 306 | u8 channel; | ||
| 307 | |||
| 308 | u8 tx_errors_count; | ||
| 309 | u8 rx_errors_count; | ||
| 310 | __le16 time; | ||
| 311 | |||
| 312 | u8 status; | ||
| 313 | u8 padding[3]; | ||
| 314 | } __packed; | ||
| 315 | |||
| 316 | struct kvaser_msg_tx_acknowledge_header { | ||
| 213 | u8 channel; | 317 | u8 channel; |
| 214 | u8 tid; | 318 | u8 tid; |
| 319 | } __packed; | ||
| 320 | |||
| 321 | struct leaf_msg_tx_acknowledge { | ||
| 322 | u8 channel; | ||
| 323 | u8 tid; | ||
| 324 | |||
| 215 | __le16 time[3]; | 325 | __le16 time[3]; |
| 216 | u8 flags; | 326 | u8 flags; |
| 217 | u8 time_offset; | 327 | u8 time_offset; |
| 218 | } __packed; | 328 | } __packed; |
| 219 | 329 | ||
| 220 | struct kvaser_msg_error_event { | 330 | struct usbcan_msg_tx_acknowledge { |
| 331 | u8 channel; | ||
| 332 | u8 tid; | ||
| 333 | |||
| 334 | __le16 time; | ||
| 335 | __le16 padding; | ||
| 336 | } __packed; | ||
| 337 | |||
| 338 | struct leaf_msg_error_event { | ||
| 221 | u8 tid; | 339 | u8 tid; |
| 222 | u8 flags; | 340 | u8 flags; |
| 223 | __le16 time[3]; | 341 | __le16 time[3]; |
| @@ -229,6 +347,18 @@ struct kvaser_msg_error_event { · 5 unmodified lines | |||
| 229 | u8 error_factor; | 347 | u8 error_factor; |
| 230 | } __packed; | 348 | } __packed; |
| 231 | 349 | ||
| 350 | struct usbcan_msg_error_event { | ||
| 351 | u8 tid; | ||
| 352 | u8 padding; | ||
| 353 | u8 tx_errors_count_ch0; | ||
| 354 | u8 rx_errors_count_ch0; | ||
| 355 | u8 tx_errors_count_ch1; | ||
| 356 | u8 rx_errors_count_ch1; | ||
| 357 | u8 status_ch0; | ||
| 358 | u8 status_ch1; | ||
| 359 | __le16 time; | ||
| 360 | } __packed; | ||
| 361 | |||
| 232 | struct kvaser_msg_ctrl_mode { | 362 | struct kvaser_msg_ctrl_mode { |
| 233 | u8 tid; | 363 | u8 tid; |
| 234 | u8 channel; | 364 | u8 channel; |
| @@ -243,7 +373,7 @@ struct kvaser_msg_flush_queue { · 8 unmodified lines | |||
| 243 | u8 padding[3]; | 373 | u8 padding[3]; |
| 244 | } __packed; | 374 | } __packed; |
| 245 | 375 | ||
| 246 | struct kvaser_msg_log_message { | 376 | struct leaf_msg_log_message { |
| 247 | u8 channel; | 377 | u8 channel; |
| 248 | u8 flags; | 378 | u8 flags; |
| 249 | __le16 time[3]; | 379 | __le16 time[3]; |
| @@ -260,19 +390,57 @@ struct kvaser_msg { · 10 unmodified lines | |||
| 260 | struct kvaser_msg_simple simple; | 390 | struct kvaser_msg_simple simple; |
| 261 | struct kvaser_msg_cardinfo cardinfo; | 391 | struct kvaser_msg_cardinfo cardinfo; |
| 262 | struct kvaser_msg_cardinfo2 cardinfo2; | 392 | struct kvaser_msg_cardinfo2 cardinfo2; |
| 263 | struct kvaser_msg_softinfo softinfo; | ||
| 264 | struct kvaser_msg_busparams busparams; | 393 | struct kvaser_msg_busparams busparams; |
| 394 | |||
| 395 | struct kvaser_msg_rx_can_header rx_can_header; | ||
| 396 | struct kvaser_msg_tx_acknowledge_header tx_acknowledge_header; | ||
| 397 | |||
| 398 | union { | ||
| 399 | struct leaf_msg_softinfo softinfo; | ||
| 400 | struct leaf_msg_rx_can rx_can; | ||
| 401 | struct leaf_msg_chip_state_event chip_state_event; | ||
| 402 | struct leaf_msg_tx_acknowledge tx_acknowledge; | ||
| 403 | struct leaf_msg_error_event error_event; | ||
| 404 | struct leaf_msg_log_message log_message; | ||
| 405 | } __packed leaf; | ||
| 406 | |||
| 407 | union { | ||
| 408 | struct usbcan_msg_softinfo softinfo; | ||
| 409 | struct usbcan_msg_rx_can rx_can; | ||
| 410 | struct usbcan_msg_chip_state_event chip_state_event; | ||
| 411 | struct usbcan_msg_tx_acknowledge tx_acknowledge; | ||
| 412 | struct usbcan_msg_error_event error_event; | ||
| 413 | } __packed usbcan; | ||
| 414 | |||
| 265 | struct kvaser_msg_tx_can tx_can; | 415 | struct kvaser_msg_tx_can tx_can; |
| 266 | struct kvaser_msg_rx_can rx_can; | ||
| 267 | struct kvaser_msg_chip_state_event chip_state_event; | ||
| 268 | struct kvaser_msg_tx_acknowledge tx_acknowledge; | ||
| 269 | struct kvaser_msg_error_event error_event; | ||
| 270 | struct kvaser_msg_ctrl_mode ctrl_mode; | 416 | struct kvaser_msg_ctrl_mode ctrl_mode; |
| 271 | struct kvaser_msg_flush_queue flush_queue; | 417 | struct kvaser_msg_flush_queue flush_queue; |
| 272 | struct kvaser_msg_log_message log_message; | ||
| 273 | } u; | 418 | } u; |
| 274 | } __packed; | 419 | } __packed; |
| 275 | 420 | ||
| 421 | /* Summary of a kvaser error event, for a unified Leaf/Usbcan error | ||
| 422 | * handling. Some discrepancies between the two families exist: | ||
| 423 | * | ||
| 424 | * - USBCAN firmware does not report M16C "error factors" | ||
| 425 | * - USBCAN controllers has difficulties reporting if the raised error | ||
| 426 | * event is for ch0 or ch1. They leave such arbitration to the OS | ||
| 427 | * driver by letting it compare error counters with previous values | ||
| 428 | * and decide the error event's channel. Thus for USBCAN, the channel | ||
| 429 | * field is only advisory. | ||
| 430 | */ | ||
| 431 | struct kvaser_usb_error_summary { | ||
| 432 | u8 channel, status, txerr, rxerr; | ||
| 433 | union { | ||
| 434 | struct { | ||
| 435 | u8 error_factor; | ||
| 436 | } leaf; | ||
| 437 | struct { | ||
| 438 | u8 other_ch_status; | ||
| 439 | u8 error_state; | ||
| 440 | } usbcan; | ||
| 441 | }; | ||
| 442 | }; | ||
| 443 | |||
| 276 | struct kvaser_usb_tx_urb_context { | 444 | struct kvaser_usb_tx_urb_context { |
| 277 | struct kvaser_usb_net_priv *priv; | 445 | struct kvaser_usb_net_priv *priv; |
| 278 | u32 echo_index; | 446 | u32 echo_index; |
| @@ -288,6 +456,7 @@ struct kvaser_usb { · 9 unmodified lines | |||
| 288 | 456 | ||
| 289 | u32 fw_version; | 457 | u32 fw_version; |
| 290 | unsigned int nchannels; | 458 | unsigned int nchannels; |
| 459 | enum kvaser_usb_family family; | ||
| 291 | 460 | ||
| 292 | bool rxinitdone; | 461 | bool rxinitdone; |
| 293 | void *rxbuf[MAX_RX_URBS]; | 462 | void *rxbuf[MAX_RX_URBS]; |
| @@ -311,6 +480,7 @@ struct kvaser_usb_net_priv { · 17 unmodified lines | |||
| 311 | }; | 480 | }; |
| 312 | 481 | ||
| 313 | static const struct usb_device_id kvaser_usb_table[] = { | 482 | static const struct usb_device_id kvaser_usb_table[] = { |
| 483 | /* Leaf family IDs */ | ||
| 314 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID) }, | 484 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID) }, |
| 315 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID) }, | 485 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID) }, |
| 316 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_PRODUCT_ID), | 486 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_PRODUCT_ID), |
| @@ -360,6 +530,17 @@ static const struct usb_device_id kvaser_usb_table[] = { · 43 unmodified lines | |||
| 360 | .driver_info = KVASER_HAS_TXRX_ERRORS }, | 530 | .driver_info = KVASER_HAS_TXRX_ERRORS }, |
| 361 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) }, | 531 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) }, |
| 362 | { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) }, | 532 | { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) }, |
| 533 | |||
| 534 | /* USBCANII family IDs */ | ||
| 535 | { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID), | ||
| 536 | .driver_info = KVASER_HAS_TXRX_ERRORS }, | ||
| 537 | { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_REVB_PRODUCT_ID), | ||
| 538 | .driver_info = KVASER_HAS_TXRX_ERRORS }, | ||
| 539 | { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMORATOR_PRODUCT_ID), | ||
| 540 | .driver_info = KVASER_HAS_TXRX_ERRORS }, | ||
| 541 | { USB_DEVICE(KVASER_VENDOR_ID, USB_VCI2_PRODUCT_ID), | ||
| 542 | .driver_info = KVASER_HAS_TXRX_ERRORS }, | ||
| 543 | |||
| 363 | { } | 544 | { } |
| 364 | }; | 545 | }; |
| 365 | MODULE_DEVICE_TABLE(usb, kvaser_usb_table); | 546 | MODULE_DEVICE_TABLE(usb, kvaser_usb_table); |
| @@ -463,7 +644,14 @@ static int kvaser_usb_get_software_info(struct kvaser_usb *dev) · 97 unmodified lines | |||
| 463 | if (err) | 644 | if (err) |
| 464 | return err; | 645 | return err; |
| 465 | 646 | ||
| 466 | dev->fw_version = le32_to_cpu(msg.u.softinfo.fw_version); | 647 | switch (dev->family) { |
| 648 | case KVASER_LEAF: | ||
| 649 | dev->fw_version = le32_to_cpu(msg.u.leaf.softinfo.fw_version); | ||
| 650 | break; | ||
| 651 | case KVASER_USBCAN: | ||
| 652 | dev->fw_version = le32_to_cpu(msg.u.usbcan.softinfo.fw_version); | ||
| 653 | break; | ||
| 654 | } | ||
| 467 | 655 | ||
| 468 | return 0; | 656 | return 0; |
| 469 | } | 657 | } |
| @@ -482,7 +670,9 @@ static int kvaser_usb_get_card_info(struct kvaser_usb *dev) · 12 unmodified lines | |||
| 482 | return err; | 670 | return err; |
| 483 | 671 | ||
| 484 | dev->nchannels = msg.u.cardinfo.nchannels; | 672 | dev->nchannels = msg.u.cardinfo.nchannels; |
| 485 | if (dev->nchannels > MAX_NET_DEVICES) | 673 | if ((dev->nchannels > MAX_NET_DEVICES) || |
| 674 | (dev->family == KVASER_USBCAN && | ||
| 675 | dev->nchannels > MAX_USBCAN_NET_DEVICES)) | ||
| 486 | return -EINVAL; | 676 | return -EINVAL; |
| 487 | 677 | ||
| 488 | return 0; | 678 | return 0; |
| @@ -496,8 +686,10 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, · 7 unmodified lines | |||
| 496 | struct kvaser_usb_net_priv *priv; | 686 | struct kvaser_usb_net_priv *priv; |
| 497 | struct sk_buff *skb; | 687 | struct sk_buff *skb; |
| 498 | struct can_frame *cf; | 688 | struct can_frame *cf; |
| 499 | u8 channel = msg->u.tx_acknowledge.channel; | 689 | u8 channel, tid; |
| 500 | u8 tid = msg->u.tx_acknowledge.tid; | 690 | |
| 691 | channel = msg->u.tx_acknowledge_header.channel; | ||
| 692 | tid = msg->u.tx_acknowledge_header.tid; | ||
| 501 | 693 | ||
| 502 | if (channel >= dev->nchannels) { | 694 | if (channel >= dev->nchannels) { |
| 503 | dev_err(dev->udev->dev.parent, | 695 | dev_err(dev->udev->dev.parent, |
| @@ -615,158 +807,280 @@ static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) · 111 unmodified lines | |||
| 615 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | 807 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; |
| 616 | } | 808 | } |
| 617 | 809 | ||
| 618 | static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | 810 | static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv *priv, |
| 619 | const struct kvaser_msg *msg) | 811 | const struct kvaser_usb_error_summary *es, |
| 812 | struct can_frame *cf) | ||
| 620 | { | 813 | { |
| 621 | struct can_frame *cf; | 814 | struct kvaser_usb *dev = priv->dev; |
| 622 | struct sk_buff *skb; | 815 | struct net_device_stats *stats = &priv->netdev->stats; |
| 623 | struct net_device_stats *stats; | 816 | enum can_state cur_state, new_state, tx_state, rx_state; |
| 624 | struct kvaser_usb_net_priv *priv; | ||
| 625 | unsigned int new_state; | ||
| 626 | u8 channel, status, txerr, rxerr, error_factor; | ||
| 627 | 817 | ||
| 628 | switch (msg->id) { | 818 | netdev_dbg(priv->netdev, "Error status: 0x%02x\n", es->status); |
| 629 | case CMD_CAN_ERROR_EVENT: | 819 | |
| 630 | channel = msg->u.error_event.channel; | 820 | new_state = cur_state = priv->can.state; |
| 631 | status = msg->u.error_event.status; | 821 | |
| 632 | txerr = msg->u.error_event.tx_errors_count; | 822 | if (es->status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) |
| 633 | rxerr = msg->u.error_event.rx_errors_count; | 823 | new_state = CAN_STATE_BUS_OFF; |
| 634 | error_factor = msg->u.error_event.error_factor; | 824 | else if (es->status & M16C_STATE_BUS_PASSIVE) |
| 635 | break; | 825 | new_state = CAN_STATE_ERROR_PASSIVE; |
| 636 | case CMD_LOG_MESSAGE: | 826 | else if (es->status & M16C_STATE_BUS_ERROR) { |
| 637 | channel = msg->u.log_message.channel; | 827 | /* Guard against spurious error events after a busoff */ |
| 638 | status = msg->u.log_message.data[0]; | 828 | if (cur_state < CAN_STATE_BUS_OFF) { |
| 639 | txerr = msg->u.log_message.data[2]; | 829 | if ((es->txerr >= 128) || (es->rxerr >= 128)) |
| 640 | rxerr = msg->u.log_message.data[3]; | 830 | new_state = CAN_STATE_ERROR_PASSIVE; |
| 641 | error_factor = msg->u.log_message.data[1]; | 831 | else if ((es->txerr >= 96) || (es->rxerr >= 96)) |
| 832 | new_state = CAN_STATE_ERROR_WARNING; | ||
| 833 | else if (cur_state > CAN_STATE_ERROR_ACTIVE) | ||
| 834 | new_state = CAN_STATE_ERROR_ACTIVE; | ||
| 835 | } | ||
| 836 | } | ||
| 837 | |||
| 838 | if (!es->status) | ||
| 839 | new_state = CAN_STATE_ERROR_ACTIVE; | ||
| 840 | |||
| 841 | if (new_state != cur_state) { | ||
| 842 | tx_state = (es->txerr >= es->rxerr) ? new_state : 0; | ||
| 843 | rx_state = (es->txerr <= es->rxerr) ? new_state : 0; | ||
| 844 | |||
| 845 | can_change_state(priv->netdev, cf, tx_state, rx_state); | ||
| 846 | } | ||
| 847 | |||
| 848 | if (priv->can.restart_ms && | ||
| 849 | (cur_state >= CAN_STATE_BUS_OFF) && | ||
| 850 | (new_state < CAN_STATE_BUS_OFF)) { | ||
| 851 | priv->can.can_stats.restarts++; | ||
| 852 | } | ||
| 853 | |||
| 854 | switch (dev->family) { | ||
| 855 | case KVASER_LEAF: | ||
| 856 | if (es->leaf.error_factor) { | ||
| 857 | priv->can.can_stats.bus_error++; | ||
| 858 | stats->rx_errors++; | ||
| 859 | } | ||
| 642 | break; | 860 | break; |
| 643 | case CMD_CHIP_STATE_EVENT: | 861 | case KVASER_USBCAN: |
| 644 | channel = msg->u.chip_state_event.channel; | 862 | if (es->usbcan.error_state & USBCAN_ERROR_STATE_TX_ERROR) |
| 645 | status = msg->u.chip_state_event.status; | 863 | stats->tx_errors++; |
| 646 | txerr = msg->u.chip_state_event.tx_errors_count; | 864 | if (es->usbcan.error_state & USBCAN_ERROR_STATE_RX_ERROR) |
| 647 | rxerr = msg->u.chip_state_event.rx_errors_count; | 865 | stats->rx_errors++; |
| 648 | error_factor = 0; | 866 | if (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR) { |
| 867 | priv->can.can_stats.bus_error++; | ||
| 868 | } | ||
| 649 | break; | 869 | break; |
| 650 | default: | ||
| 651 | dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n", | ||
| 652 | msg->id); | ||
| 653 | return; | ||
| 654 | } | 870 | } |
| 655 | 871 | ||
| 656 | if (channel >= dev->nchannels) { | 872 | priv->bec.txerr = es->txerr; |
| 873 | priv->bec.rxerr = es->rxerr; | ||
| 874 | } | ||
| 875 | |||
| 876 | static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | ||
| 877 | const struct kvaser_usb_error_summary *es) | ||
| 878 | { | ||
| 879 | struct can_frame *cf, tmp_cf = { .can_id = CAN_ERR_FLAG, .can_dlc = CAN_ERR_DLC }; | ||
| 880 | struct sk_buff *skb; | ||
| 881 | struct net_device_stats *stats; | ||
| 882 | struct kvaser_usb_net_priv *priv; | ||
| 883 | enum can_state old_state, new_state; | ||
| 884 | |||
| 885 | if (es->channel >= dev->nchannels) { | ||
| 657 | dev_err(dev->udev->dev.parent, | 886 | dev_err(dev->udev->dev.parent, |
| 658 | "Invalid channel number (%d)\n", channel); | 887 | "Invalid channel number (%d)\n", es->channel); |
| 659 | return; | 888 | return; |
| 660 | } | 889 | } |
| 661 | 890 | ||
| 662 | priv = dev->nets[channel]; | 891 | priv = dev->nets[es->channel]; |
| 663 | stats = &priv->netdev->stats; | 892 | stats = &priv->netdev->stats; |
| 664 | 893 | ||
| 894 | /* Update all of the can interface's state and error counters before | ||
| 895 | * trying any memory allocation that can actually fail with -ENOMEM. | ||
| 896 | * | ||
| 897 | * We send a temporary stack-allocated error can frame to | ||
| 898 | * can_change_state() for the very same reason. | ||
| 899 | * | ||
| 900 | * TODO: Split can_change_state() responsibility between updating the | ||
| 901 | * can interface's state and counters, and the setting up of can error | ||
| 902 | * frame ID and data to userspace. Remove stack allocation afterwards. | ||
| 903 | */ | ||
| 904 | old_state = priv->can.state; | ||
| 905 | kvaser_usb_rx_error_update_can_state(priv, es, &tmp_cf); | ||
| 906 | new_state = priv->can.state; | ||
| 907 | |||
| 665 | skb = alloc_can_err_skb(priv->netdev, &cf); | 908 | skb = alloc_can_err_skb(priv->netdev, &cf); |
| 666 | if (!skb) { | 909 | if (!skb) { |
| 667 | stats->rx_dropped++; | 910 | stats->rx_dropped++; |
| 668 | return; | 911 | return; |
| 669 | } | 912 | } |
| 913 | memcpy(cf, &tmp_cf, sizeof(*cf)); | ||
| 914 | |||
| 915 | if (new_state != old_state) { | ||
| 916 | if (es->status & | ||
| 917 | (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) { | ||
| 918 | if (!priv->can.restart_ms) | ||
| 919 | kvaser_usb_simple_msg_async(priv, CMD_STOP_CHIP); | ||
| 920 | netif_carrier_off(priv->netdev); | ||
| 921 | } | ||
| 670 | 922 | ||
| 671 | new_state = priv->can.state; | 923 | if (priv->can.restart_ms && |
| 672 | 924 | (old_state >= CAN_STATE_BUS_OFF) && | |
| 673 | netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status); | 925 | (new_state < CAN_STATE_BUS_OFF)) { |
| 926 | cf->can_id |= CAN_ERR_RESTARTED; | ||
| 927 | netif_carrier_on(priv->netdev); | ||
| 928 | } | ||
| 929 | } | ||
| 674 | 930 | ||
| 675 | if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) { | 931 | switch (dev->family) { |
| 676 | cf->can_id |= CAN_ERR_BUSOFF; | 932 | case KVASER_LEAF: |
| 933 | if (es->leaf.error_factor) { | ||
| 934 | cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT; | ||
| 935 | |||
| 936 | if (es->leaf.error_factor & M16C_EF_ACKE) | ||
| 937 | cf->data[3] |= (CAN_ERR_PROT_LOC_ACK); | ||
| 938 | if (es->leaf.error_factor & M16C_EF_CRCE) | ||
| 939 | cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | | ||
| 940 | CAN_ERR_PROT_LOC_CRC_DEL); | ||
| 941 | if (es->leaf.error_factor & M16C_EF_FORME) | ||
| 942 | cf->data[2] |= CAN_ERR_PROT_FORM; | ||
| 943 | if (es->leaf.error_factor & M16C_EF_STFE) | ||
| 944 | cf->data[2] |= CAN_ERR_PROT_STUFF; | ||
| 945 | if (es->leaf.error_factor & M16C_EF_BITE0) | ||
| 946 | cf->data[2] |= CAN_ERR_PROT_BIT0; | ||
| 947 | if (es->leaf.error_factor & M16C_EF_BITE1) | ||
| 948 | cf->data[2] |= CAN_ERR_PROT_BIT1; | ||
| 949 | if (es->leaf.error_factor & M16C_EF_TRE) | ||
| 950 | cf->data[2] |= CAN_ERR_PROT_TX; | ||
| 951 | } | ||
| 952 | break; | ||
| 953 | case KVASER_USBCAN: | ||
| 954 | if (es->usbcan.error_state & USBCAN_ERROR_STATE_BUSERROR) { | ||
| 955 | cf->can_id |= CAN_ERR_BUSERROR; | ||
| 956 | } | ||
| 957 | break; | ||
| 958 | } | ||
| 677 | 959 | ||
| 678 | priv->can.can_stats.bus_off++; | 960 | cf->data[6] = es->txerr; |
| 679 | if (!priv->can.restart_ms) | 961 | cf->data[7] = es->rxerr; |
| 680 | kvaser_usb_simple_msg_async(priv, CMD_STOP_CHIP); | ||
| 681 | 962 | ||
| 682 | netif_carrier_off(priv->netdev); | 963 | stats->rx_packets++; |
| 964 | stats->rx_bytes += cf->can_dlc; | ||
| 965 | netif_rx(skb); | ||
| 966 | } | ||
| 683 | 967 | ||
| 684 | new_state = CAN_STATE_BUS_OFF; | 968 | /* For USBCAN, report error to userspace iff the channels's errors counter |
| 685 | } else if (status & M16C_STATE_BUS_PASSIVE) { | 969 | * has changed, or we're the only channel seeing a bus error state. |
| 686 | if (priv->can.state != CAN_STATE_ERROR_PASSIVE) { | 970 | */ |
| 687 | cf->can_id |= CAN_ERR_CRTL; | 971 | static void kvaser_usbcan_conditionally_rx_error(const struct kvaser_usb *dev, |
| 688 | 972 | struct kvaser_usb_error_summary *es) | |
| 689 | if (txerr || rxerr) | 973 | { |
| 690 | cf->data[1] = (txerr > rxerr) | 974 | struct kvaser_usb_net_priv *priv; |
| 691 | ? CAN_ERR_CRTL_TX_PASSIVE | 975 | int channel; |
| 692 | : CAN_ERR_CRTL_RX_PASSIVE; | 976 | bool report_error; |
| 693 | else | ||
| 694 | cf->data[1] = CAN_ERR_CRTL_TX_PASSIVE | | ||
| 695 | CAN_ERR_CRTL_RX_PASSIVE; | ||
| 696 | |||
| 697 | priv->can.can_stats.error_passive++; | ||
| 698 | } | ||
| 699 | 977 | ||
| 700 | new_state = CAN_STATE_ERROR_PASSIVE; | 978 | channel = es->channel; |
| 701 | } else if (status & M16C_STATE_BUS_ERROR) { | 979 | if (channel >= dev->nchannels) { |
| 702 | if ((priv->can.state < CAN_STATE_ERROR_WARNING) && | 980 | dev_err(dev->udev->dev.parent, |
| 703 | ((txerr >= 96) || (rxerr >= 96))) { | 981 | "Invalid channel number (%d)\n", channel); |
| 704 | cf->can_id |= CAN_ERR_CRTL; | 982 | return; |
| 705 | cf->data[1] = (txerr > rxerr) | ||
| 706 | ? CAN_ERR_CRTL_TX_WARNING | ||
| 707 | : CAN_ERR_CRTL_RX_WARNING; | ||
| 708 | |||
| 709 | priv->can.can_stats.error_warning++; | ||
| 710 | new_state = CAN_STATE_ERROR_WARNING; | ||
| 711 | } else if ((priv->can.state > CAN_STATE_ERROR_ACTIVE) && | ||
| 712 | ((txerr < 96) && (rxerr < 96))) { | ||
| 713 | cf->can_id |= CAN_ERR_PROT; | ||
| 714 | cf->data[2] = CAN_ERR_PROT_ACTIVE; | ||
| 715 | |||
| 716 | new_state = CAN_STATE_ERROR_ACTIVE; | ||
| 717 | } | ||
| 718 | } | 983 | } |
| 719 | 984 | ||
| 720 | if (!status) { | 985 | priv = dev->nets[channel]; |
| 721 | cf->can_id |= CAN_ERR_PROT; | 986 | report_error = false; |
| 722 | cf->data[2] = CAN_ERR_PROT_ACTIVE; | ||
| 723 | 987 | ||
| 724 | new_state = CAN_STATE_ERROR_ACTIVE; | 988 | if (es->txerr != priv->bec.txerr) { |
| 989 | es->usbcan.error_state |= USBCAN_ERROR_STATE_TX_ERROR; | ||
| 990 | report_error = true; | ||
| 991 | } | ||
| 992 | if (es->rxerr != priv->bec.rxerr) { | ||
| 993 | es->usbcan.error_state |= USBCAN_ERROR_STATE_RX_ERROR; | ||
| 994 | report_error = true; | ||
| 995 | } | ||
| 996 | if ((es->status & M16C_STATE_BUS_ERROR) && | ||
| 997 | !(es->usbcan.other_ch_status & M16C_STATE_BUS_ERROR)) { | ||
| 998 | es->usbcan.error_state |= USBCAN_ERROR_STATE_BUSERROR; | ||
| 999 | report_error = true; | ||
| 725 | } | 1000 | } |
| 726 | 1001 | ||
| 727 | if (priv->can.restart_ms && | 1002 | if (report_error) |
| 728 | (priv->can.state >= CAN_STATE_BUS_OFF) && | 1003 | kvaser_usb_rx_error(dev, es); |
| 729 | (new_state < CAN_STATE_BUS_OFF)) { | 1004 | } |
| 730 | cf->can_id |= CAN_ERR_RESTARTED; | ||
| 731 | netif_carrier_on(priv->netdev); | ||
| 732 | 1005 | ||
| 733 | priv->can.can_stats.restarts++; | 1006 | static void kvaser_usbcan_rx_error(const struct kvaser_usb *dev, |
| 734 | } | 1007 | const struct kvaser_msg *msg) |
| 1008 | { | ||
| 1009 | struct kvaser_usb_error_summary es = { }; | ||
| 735 | 1010 | ||
| 736 | if (error_factor) { | 1011 | switch (msg->id) { |
| 737 | priv->can.can_stats.bus_error++; | 1012 | /* Sometimes errors are sent as unsolicited chip state events */ |
| 738 | stats->rx_errors++; | 1013 | case CMD_CHIP_STATE_EVENT: |
| 1014 | es.channel = msg->u.usbcan.chip_state_event.channel; | ||
| 1015 | es.status = msg->u.usbcan.chip_state_event.status; | ||
| 1016 | es.txerr = msg->u.usbcan.chip_state_event.tx_errors_count; | ||
| 1017 | es.rxerr = msg->u.usbcan.chip_state_event.rx_errors_count; | ||
| 1018 | kvaser_usbcan_conditionally_rx_error(dev, &es); | ||
| 1019 | break; | ||
| 739 | 1020 | ||
| 740 | cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT; | 1021 | case CMD_CAN_ERROR_EVENT: |
| 741 | 1022 | es.channel = 0; | |
| 742 | if (error_factor & M16C_EF_ACKE) | 1023 | es.status = msg->u.usbcan.error_event.status_ch0; |
| 743 | cf->data[3] |= (CAN_ERR_PROT_LOC_ACK); | 1024 | es.txerr = msg->u.usbcan.error_event.tx_errors_count_ch0; |
| 744 | if (error_factor & M16C_EF_CRCE) | 1025 | es.rxerr = msg->u.usbcan.error_event.rx_errors_count_ch0; |
| 745 | cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | | 1026 | es.usbcan.other_ch_status = |
| 746 | CAN_ERR_PROT_LOC_CRC_DEL); | 1027 | msg->u.usbcan.error_event.status_ch1; |
| 747 | if (error_factor & M16C_EF_FORME) | 1028 | kvaser_usbcan_conditionally_rx_error(dev, &es); |
| 748 | cf->data[2] |= CAN_ERR_PROT_FORM; | 1029 | |
| 749 | if (error_factor & M16C_EF_STFE) | 1030 | /* The USBCAN firmware supports up to 2 channels. |
| 750 | cf->data[2] |= CAN_ERR_PROT_STUFF; | 1031 | * Now that ch0 was checked, check if ch1 has any errors. |
| 751 | if (error_factor & M16C_EF_BITE0) | 1032 | */ |
| 752 | cf->data[2] |= CAN_ERR_PROT_BIT0; | 1033 | if (dev->nchannels == MAX_USBCAN_NET_DEVICES) { |
| 753 | if (error_factor & M16C_EF_BITE1) | 1034 | es.channel = 1; |
| 754 | cf->data[2] |= CAN_ERR_PROT_BIT1; | 1035 | es.status = msg->u.usbcan.error_event.status_ch1; |
| 755 | if (error_factor & M16C_EF_TRE) | 1036 | es.txerr = msg->u.usbcan.error_event.tx_errors_count_ch1; |
| 756 | cf->data[2] |= CAN_ERR_PROT_TX; | 1037 | es.rxerr = msg->u.usbcan.error_event.rx_errors_count_ch1; |
| 757 | } | 1038 | es.usbcan.other_ch_status = |
| 1039 | msg->u.usbcan.error_event.status_ch0; | ||
| 1040 | kvaser_usbcan_conditionally_rx_error(dev, &es); | ||
| 1041 | } | ||
| 1042 | break; | ||
| 758 | 1043 | ||
| 759 | cf->data[6] = txerr; | 1044 | default: |
| 760 | cf->data[7] = rxerr; | 1045 | dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n", |
| 1046 | msg->id); | ||
| 1047 | } | ||
| 1048 | } | ||
| 761 | 1049 | ||
| 762 | priv->bec.txerr = txerr; | 1050 | static void kvaser_leaf_rx_error(const struct kvaser_usb *dev, |
| 763 | priv->bec.rxerr = rxerr; | 1051 | const struct kvaser_msg *msg) |
| 1052 | { | ||
| 1053 | struct kvaser_usb_error_summary es = { }; | ||
| 764 | 1054 | ||
| 765 | priv->can.state = new_state; | 1055 | switch (msg->id) { |
| 1056 | case CMD_CAN_ERROR_EVENT: | ||
| 1057 | es.channel = msg->u.leaf.error_event.channel; | ||
| 1058 | es.status = msg->u.leaf.error_event.status; | ||
| 1059 | es.txerr = msg->u.leaf.error_event.tx_errors_count; | ||
| 1060 | es.rxerr = msg->u.leaf.error_event.rx_errors_count; | ||
| 1061 | es.leaf.error_factor = msg->u.leaf.error_event.error_factor; | ||
| 1062 | break; | ||
| 1063 | case CMD_LEAF_LOG_MESSAGE: | ||
| 1064 | es.channel = msg->u.leaf.log_message.channel; | ||
| 1065 | es.status = msg->u.leaf.log_message.data[0]; | ||
| 1066 | es.txerr = msg->u.leaf.log_message.data[2]; | ||
| 1067 | es.rxerr = msg->u.leaf.log_message.data[3]; | ||
| 1068 | es.leaf.error_factor = msg->u.leaf.log_message.data[1]; | ||
| 1069 | break; | ||
| 1070 | case CMD_CHIP_STATE_EVENT: | ||
| 1071 | es.channel = msg->u.leaf.chip_state_event.channel; | ||
| 1072 | es.status = msg->u.leaf.chip_state_event.status; | ||
| 1073 | es.txerr = msg->u.leaf.chip_state_event.tx_errors_count; | ||
| 1074 | es.rxerr = msg->u.leaf.chip_state_event.rx_errors_count; | ||
| 1075 | es.leaf.error_factor = 0; | ||
| 1076 | break; | ||
| 1077 | default: | ||
| 1078 | dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n", | ||
| 1079 | msg->id); | ||
| 1080 | return; | ||
| 1081 | } | ||
| 766 | 1082 | ||
| 767 | stats->rx_packets++; | 1083 | kvaser_usb_rx_error(dev, &es); |
| 768 | stats->rx_bytes += cf->can_dlc; | ||
| 769 | netif_rx(skb); | ||
| 770 | } | 1084 | } |
| 771 | 1085 | ||
| 772 | static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, | 1086 | static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, |
| @@ -776,16 +1090,19 @@ static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, · 3 unmodified lines | |||
| 776 | struct sk_buff *skb; | 1090 | struct sk_buff *skb; |
| 777 | struct net_device_stats *stats = &priv->netdev->stats; | 1091 | struct net_device_stats *stats = &priv->netdev->stats; |
| 778 | 1092 | ||
| 779 | if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | | 1093 | if (msg->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME | |
| 780 | MSG_FLAG_NERR)) { | 1094 | MSG_FLAG_NERR)) { |
| 781 | netdev_err(priv->netdev, "Unknow error (flags: 0x%02x)\n", | 1095 | netdev_err(priv->netdev, "Unknow error (flags: 0x%02x)\n", |
| 782 | msg->u.rx_can.flag); | 1096 | msg->u.rx_can_header.flag); |
| 783 | 1097 | ||
| 784 | stats->rx_errors++; | 1098 | stats->rx_errors++; |
| 785 | return; | 1099 | return; |
| 786 | } | 1100 | } |
| 787 | 1101 | ||
| 788 | if (msg->u.rx_can.flag & MSG_FLAG_OVERRUN) { | 1102 | if (msg->u.rx_can_header.flag & MSG_FLAG_OVERRUN) { |
| 1103 | stats->rx_over_errors++; | ||
| 1104 | stats->rx_errors++; | ||
| 1105 | |||
| 789 | skb = alloc_can_err_skb(priv->netdev, &cf); | 1106 | skb = alloc_can_err_skb(priv->netdev, &cf); |
| 790 | if (!skb) { | 1107 | if (!skb) { |
| 791 | stats->rx_dropped++; | 1108 | stats->rx_dropped++; |
| @@ -795,9 +1112,6 @@ static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, · 3 unmodified lines | |||
| 795 | cf->can_id |= CAN_ERR_CRTL; | 1112 | cf->can_id |= CAN_ERR_CRTL; |
| 796 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | 1113 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; |
| 797 | 1114 | ||
| 798 | stats->rx_over_errors++; | ||
| 799 | stats->rx_errors++; | ||
| 800 | |||
| 801 | stats->rx_packets++; | 1115 | stats->rx_packets++; |
| 802 | stats->rx_bytes += cf->can_dlc; | 1116 | stats->rx_bytes += cf->can_dlc; |
| 803 | netif_rx(skb); | 1117 | netif_rx(skb); |
| @@ -811,7 +1125,8 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, · 7 unmodified lines | |||
| 811 | struct can_frame *cf; | 1125 | struct can_frame *cf; |
| 812 | struct sk_buff *skb; | 1126 | struct sk_buff *skb; |
| 813 | struct net_device_stats *stats; | 1127 | struct net_device_stats *stats; |
| 814 | u8 channel = msg->u.rx_can.channel; | 1128 | u8 channel = msg->u.rx_can_header.channel; |
| 1129 | const u8 *rx_msg = NULL; /* GCC */ | ||
| 815 | 1130 | ||
| 816 | if (channel >= dev->nchannels) { | 1131 | if (channel >= dev->nchannels) { |
| 817 | dev_err(dev->udev->dev.parent, | 1132 | dev_err(dev->udev->dev.parent, |
| @@ -822,60 +1137,68 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, · 4 unmodified lines | |||
| 822 | priv = dev->nets[channel]; | 1137 | priv = dev->nets[channel]; |
| 823 | stats = &priv->netdev->stats; | 1138 | stats = &priv->netdev->stats; |
| 824 | 1139 | ||
| 825 | if ((msg->u.rx_can.flag & MSG_FLAG_ERROR_FRAME) && | 1140 | if ((msg->u.rx_can_header.flag & MSG_FLAG_ERROR_FRAME) && |
| 826 | (msg->id == CMD_LOG_MESSAGE)) { | 1141 | (dev->family == KVASER_LEAF && msg->id == CMD_LEAF_LOG_MESSAGE)) { |
| 827 | kvaser_usb_rx_error(dev, msg); | 1142 | kvaser_leaf_rx_error(dev, msg); |
| 828 | return; | 1143 | return; |
| 829 | } else if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | | 1144 | } else if (msg->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME | |
| 830 | MSG_FLAG_NERR | | 1145 | MSG_FLAG_NERR | |
| 831 | MSG_FLAG_OVERRUN)) { | 1146 | MSG_FLAG_OVERRUN)) { |
| 832 | kvaser_usb_rx_can_err(priv, msg); | 1147 | kvaser_usb_rx_can_err(priv, msg); |
| 833 | return; | 1148 | return; |
| 834 | } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) { | 1149 | } else if (msg->u.rx_can_header.flag & ~MSG_FLAG_REMOTE_FRAME) { |
| 835 | netdev_warn(priv->netdev, | 1150 | netdev_warn(priv->netdev, |
| 836 | "Unhandled frame (flags: 0x%02x)", | 1151 | "Unhandled frame (flags: 0x%02x)", |
| 837 | msg->u.rx_can.flag); | 1152 | msg->u.rx_can_header.flag); |
| 838 | return; | 1153 | return; |
| 839 | } | 1154 | } |
| 840 | 1155 | ||
| 1156 | switch (dev->family) { | ||
| 1157 | case KVASER_LEAF: | ||
| 1158 | rx_msg = msg->u.leaf.rx_can.msg; | ||
| 1159 | break; | ||
| 1160 | case KVASER_USBCAN: | ||
| 1161 | rx_msg = msg->u.usbcan.rx_can.msg; | ||
| 1162 | break; | ||
| 1163 | } | ||
| 1164 | |||
| 841 | skb = alloc_can_skb(priv->netdev, &cf); | 1165 | skb = alloc_can_skb(priv->netdev, &cf); |
| 842 | if (!skb) { | 1166 | if (!skb) { |
| 843 | stats->tx_dropped++; | 1167 | stats->tx_dropped++; |
| 844 | return; | 1168 | return; |
| 845 | } | 1169 | } |
| 846 | 1170 | ||
| 847 | if (msg->id == CMD_LOG_MESSAGE) { | 1171 | if (dev->family == KVASER_LEAF && msg->id == CMD_LEAF_LOG_MESSAGE) { |
| 848 | cf->can_id = le32_to_cpu(msg->u.log_message.id); | 1172 | cf->can_id = le32_to_cpu(msg->u.leaf.log_message.id); |
| 849 | if (cf->can_id & KVASER_EXTENDED_FRAME) | 1173 | if (cf->can_id & KVASER_EXTENDED_FRAME) |
| 850 | cf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG; | 1174 | cf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG; |
| 851 | else | 1175 | else |
| 852 | cf->can_id &= CAN_SFF_MASK; | 1176 | cf->can_id &= CAN_SFF_MASK; |
| 853 | 1177 | ||
| 854 | cf->can_dlc = get_can_dlc(msg->u.log_message.dlc); | 1178 | cf->can_dlc = get_can_dlc(msg->u.leaf.log_message.dlc); |
| 855 | 1179 | ||
| 856 | if (msg->u.log_message.flags & MSG_FLAG_REMOTE_FRAME) | 1180 | if (msg->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME) |
| 857 | cf->can_id |= CAN_RTR_FLAG; | 1181 | cf->can_id |= CAN_RTR_FLAG; |
| 858 | else | 1182 | else |
| 859 | memcpy(cf->data, &msg->u.log_message.data, | 1183 | memcpy(cf->data, &msg->u.leaf.log_message.data, |
| 860 | cf->can_dlc); | 1184 | cf->can_dlc); |
| 861 | } else { | 1185 | } else { |
| 862 | cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) | | 1186 | cf->can_id = ((rx_msg[0] & 0x1f) << 6) | (rx_msg[1] & 0x3f); |
| 863 | (msg->u.rx_can.msg[1] & 0x3f); | ||
| 864 | 1187 | ||
| 865 | if (msg->id == CMD_RX_EXT_MESSAGE) { | 1188 | if (msg->id == CMD_RX_EXT_MESSAGE) { |
| 866 | cf->can_id <<= 18; | 1189 | cf->can_id <<= 18; |
| 867 | cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) | | 1190 | cf->can_id |= ((rx_msg[2] & 0x0f) << 14) | |
| 868 | ((msg->u.rx_can.msg[3] & 0xff) << 6) | | 1191 | ((rx_msg[3] & 0xff) << 6) | |
| 869 | (msg->u.rx_can.msg[4] & 0x3f); | 1192 | (rx_msg[4] & 0x3f); |
| 870 | cf->can_id |= CAN_EFF_FLAG; | 1193 | cf->can_id |= CAN_EFF_FLAG; |
| 871 | } | 1194 | } |
| 872 | 1195 | ||
| 873 | cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]); | 1196 | cf->can_dlc = get_can_dlc(rx_msg[5]); |
| 874 | 1197 | ||
| 875 | if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME) | 1198 | if (msg->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME) |
| 876 | cf->can_id |= CAN_RTR_FLAG; | 1199 | cf->can_id |= CAN_RTR_FLAG; |
| 877 | else | 1200 | else |
| 878 | memcpy(cf->data, &msg->u.rx_can.msg[6], | 1201 | memcpy(cf->data, &rx_msg[6], |
| 879 | cf->can_dlc); | 1202 | cf->can_dlc); |
| 880 | } | 1203 | } |
| 881 | 1204 | ||
| @@ -938,21 +1261,35 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, · 56 unmodified lines | |||
| 938 | 1261 | ||
| 939 | case CMD_RX_STD_MESSAGE: | 1262 | case CMD_RX_STD_MESSAGE: |
| 940 | case CMD_RX_EXT_MESSAGE: | 1263 | case CMD_RX_EXT_MESSAGE: |
| 941 | case CMD_LOG_MESSAGE: | 1264 | kvaser_usb_rx_can_msg(dev, msg); |
| 1265 | break; | ||
| 1266 | |||
| 1267 | case CMD_LEAF_LOG_MESSAGE: | ||
| 1268 | if (dev->family != KVASER_LEAF) | ||
| 1269 | goto warn; | ||
| 942 | kvaser_usb_rx_can_msg(dev, msg); | 1270 | kvaser_usb_rx_can_msg(dev, msg); |
| 943 | break; | 1271 | break; |
| 944 | 1272 | ||
| 945 | case CMD_CHIP_STATE_EVENT: | 1273 | case CMD_CHIP_STATE_EVENT: |
| 946 | case CMD_CAN_ERROR_EVENT: | 1274 | case CMD_CAN_ERROR_EVENT: |
| 947 | kvaser_usb_rx_error(dev, msg); | 1275 | if (dev->family == KVASER_LEAF) |
| 1276 | kvaser_leaf_rx_error(dev, msg); | ||
| 1277 | else | ||
| 1278 | kvaser_usbcan_rx_error(dev, msg); | ||
| 948 | break; | 1279 | break; |
| 949 | 1280 | ||
| 950 | case CMD_TX_ACKNOWLEDGE: | 1281 | case CMD_TX_ACKNOWLEDGE: |
| 951 | kvaser_usb_tx_acknowledge(dev, msg); | 1282 | kvaser_usb_tx_acknowledge(dev, msg); |
| 952 | break; | 1283 | break; |
| 953 | 1284 | ||
| 1285 | /* Ignored messages */ | ||
| 1286 | case CMD_USBCAN_CLOCK_OVERFLOW_EVENT: | ||
| 1287 | if (dev->family != KVASER_USBCAN) | ||
| 1288 | goto warn; | ||
| 1289 | break; | ||
| 1290 | |||
| 954 | default: | 1291 | default: |
| 955 | dev_warn(dev->udev->dev.parent, | 1292 | warn: dev_warn(dev->udev->dev.parent, |
| 956 | "Unhandled message (%d)\n", msg->id); | 1293 | "Unhandled message (%d)\n", msg->id); |
| 957 | break; | 1294 | break; |
| 958 | } | 1295 | } |
| @@ -1172,7 +1509,7 @@ static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) · 213 unmodified lines | |||
| 1172 | dev->rxbuf[i], | 1509 | dev->rxbuf[i], |
| 1173 | dev->rxbuf_dma[i]); | 1510 | dev->rxbuf_dma[i]); |
| 1174 | 1511 | ||
| 1175 | for (i = 0; i < MAX_NET_DEVICES; i++) { | 1512 | for (i = 0; i < dev->nchannels; i++) { |
| 1176 | struct kvaser_usb_net_priv *priv = dev->nets[i]; | 1513 | struct kvaser_usb_net_priv *priv = dev->nets[i]; |
| 1177 | 1514 | ||
| 1178 | if (priv) | 1515 | if (priv) |
| @@ -1280,6 +1617,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, · 101 unmodified lines | |||
| 1280 | struct kvaser_msg *msg; | 1617 | struct kvaser_msg *msg; |
| 1281 | int i, err; | 1618 | int i, err; |
| 1282 | int ret = NETDEV_TX_OK; | 1619 | int ret = NETDEV_TX_OK; |
| 1620 | u8 *msg_tx_can_flags = NULL; /* GCC */ | ||
| 1283 | 1621 | ||
| 1284 | if (can_dropped_invalid_skb(netdev, skb)) | 1622 | if (can_dropped_invalid_skb(netdev, skb)) |
| 1285 | return NETDEV_TX_OK; | 1623 | return NETDEV_TX_OK; |
| @@ -1301,9 +1639,19 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, · 15 unmodified lines | |||
| 1301 | 1639 | ||
| 1302 | msg = buf; | 1640 | msg = buf; |
| 1303 | msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_tx_can); | 1641 | msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_tx_can); |
| 1304 | msg->u.tx_can.flags = 0; | ||
| 1305 | msg->u.tx_can.channel = priv->channel; | 1642 | msg->u.tx_can.channel = priv->channel; |
| 1306 | 1643 | ||
| 1644 | switch (dev->family) { | ||
| 1645 | case KVASER_LEAF: | ||
| 1646 | msg_tx_can_flags = &msg->u.tx_can.leaf.flags; | ||
| 1647 | break; | ||
| 1648 | case KVASER_USBCAN: | ||
| 1649 | msg_tx_can_flags = &msg->u.tx_can.usbcan.flags; | ||
| 1650 | break; | ||
| 1651 | } | ||
| 1652 | |||
| 1653 | *msg_tx_can_flags = 0; | ||
| 1654 | |||
| 1307 | if (cf->can_id & CAN_EFF_FLAG) { | 1655 | if (cf->can_id & CAN_EFF_FLAG) { |
| 1308 | msg->id = CMD_TX_EXT_MESSAGE; | 1656 | msg->id = CMD_TX_EXT_MESSAGE; |
| 1309 | msg->u.tx_can.msg[0] = (cf->can_id >> 24) & 0x1f; | 1657 | msg->u.tx_can.msg[0] = (cf->can_id >> 24) & 0x1f; |
| @@ -1321,7 +1669,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, · 11 unmodified lines | |||
| 1321 | memcpy(&msg->u.tx_can.msg[6], cf->data, cf->can_dlc); | 1669 | memcpy(&msg->u.tx_can.msg[6], cf->data, cf->can_dlc); |
| 1322 | 1670 | ||
| 1323 | if (cf->can_id & CAN_RTR_FLAG) | 1671 | if (cf->can_id & CAN_RTR_FLAG) |
| 1324 | msg->u.tx_can.flags |= MSG_FLAG_REMOTE_FRAME; | 1672 | *msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME; |
| 1325 | 1673 | ||
| 1326 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { | 1674 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { |
| 1327 | if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { | 1675 | if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { |
| @@ -1590,6 +1938,17 @@ static int kvaser_usb_probe(struct usb_interface *intf, · 262 unmodified lines | |||
| 1590 | if (!dev) | 1938 | if (!dev) |
| 1591 | return -ENOMEM; | 1939 | return -ENOMEM; |
| 1592 | 1940 | ||
| 1941 | if (kvaser_is_leaf(id)) { | ||
| 1942 | dev->family = KVASER_LEAF; | ||
| 1943 | } else if (kvaser_is_usbcan(id)) { | ||
| 1944 | dev->family = KVASER_USBCAN; | ||
| 1945 | } else { | ||
| 1946 | dev_err(&intf->dev, | ||
| 1947 | "Product ID (%d) does not belong to any known Kvaser USB family", | ||
| 1948 | id->idProduct); | ||
| 1949 | return -ENODEV; | ||
| 1950 | } | ||
| 1951 | |||
| 1593 | err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); | 1952 | err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); |
| 1594 | if (err) { | 1953 | if (err) { |
| 1595 | dev_err(&intf->dev, "Cannot get usb endpoint(s)"); | 1954 | dev_err(&intf->dev, "Cannot get usb endpoint(s)"); |
| @@ -1,2 +1,2 @@ | |||
| 1 | obj-$(CONFIG_CAN_PEAK_USB) += peak_usb.o | 1 | obj-$(CONFIG_CAN_PEAK_USB) += peak_usb.o |
| 2 | peak_usb-y = pcan_usb_core.o pcan_usb.o pcan_usb_pro.o | 2 | peak_usb-y = pcan_usb_core.o pcan_usb.o pcan_usb_pro.o pcan_usb_fd.o |
| @@ -0,0 +1,222 @@ | |||
| 1 | /* | ||
| 2 | * CAN driver for PEAK System micro-CAN based adapters | ||
| 3 | * | ||
| 4 | * Copyright (C) 2003-2011 PEAK System-Technik GmbH | ||
| 5 | * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published | ||
| 9 | * by the Free Software Foundation; version 2 of the License. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, but | ||
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * General Public License for more details. | ||
| 15 | */ | ||
| 16 | #ifndef PUCAN_H | ||
| 17 | #define PUCAN_H | ||
| 18 | |||
| 19 | /* uCAN commands opcodes list (low-order 10 bits) */ | ||
| 20 | #define PUCAN_CMD_NOP 0x000 | ||
| 21 | #define PUCAN_CMD_RESET_MODE 0x001 | ||
| 22 | #define PUCAN_CMD_NORMAL_MODE 0x002 | ||
| 23 | #define PUCAN_CMD_LISTEN_ONLY_MODE 0x003 | ||
| 24 | #define PUCAN_CMD_TIMING_SLOW 0x004 | ||
| 25 | #define PUCAN_CMD_TIMING_FAST 0x005 | ||
| 26 | #define PUCAN_CMD_FILTER_STD 0x008 | ||
| 27 | #define PUCAN_CMD_TX_ABORT 0x009 | ||
| 28 | #define PUCAN_CMD_WR_ERR_CNT 0x00a | ||
| 29 | #define PUCAN_CMD_RX_FRAME_ENABLE 0x00b | ||
| 30 | #define PUCAN_CMD_RX_FRAME_DISABLE 0x00c | ||
| 31 | #define PUCAN_CMD_END_OF_COLLECTION 0x3ff | ||
| 32 | |||
| 33 | /* uCAN received messages list */ | ||
| 34 | #define PUCAN_MSG_CAN_RX 0x0001 | ||
| 35 | #define PUCAN_MSG_ERROR 0x0002 | ||
| 36 | #define PUCAN_MSG_STATUS 0x0003 | ||
| 37 | #define PUCAN_MSG_BUSLOAD 0x0004 | ||
| 38 | #define PUCAN_MSG_CAN_TX 0x1000 | ||
| 39 | |||
| 40 | /* uCAN command common header */ | ||
| 41 | struct __packed pucan_command { | ||
| 42 | __le16 opcode_channel; | ||
| 43 | u16 args[3]; | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* uCAN TIMING_SLOW command fields */ | ||
| 47 | #define PUCAN_TSLOW_SJW_T(s, t) (((s) & 0xf) | ((!!(t)) << 7)) | ||
| 48 | #define PUCAN_TSLOW_TSEG2(t) ((t) & 0xf) | ||
| 49 | #define PUCAN_TSLOW_TSEG1(t) ((t) & 0x3f) | ||
| 50 | #define PUCAN_TSLOW_BRP(b) ((b) & 0x3ff) | ||
| 51 | |||
| 52 | struct __packed pucan_timing_slow { | ||
| 53 | __le16 opcode_channel; | ||
| 54 | |||
| 55 | u8 ewl; /* Error Warning limit */ | ||
| 56 | u8 sjw_t; /* Sync Jump Width + Triple sampling */ | ||
| 57 | u8 tseg2; /* Timing SEGment 2 */ | ||
| 58 | u8 tseg1; /* Timing SEGment 1 */ | ||
| 59 | |||
| 60 | __le16 brp; /* BaudRate Prescaler */ | ||
| 61 | }; | ||
| 62 | |||
| 63 | /* uCAN TIMING_FAST command fields */ | ||
| 64 | #define PUCAN_TFAST_SJW(s) ((s) & 0x3) | ||
| 65 | #define PUCAN_TFAST_TSEG2(t) ((t) & 0x7) | ||
| 66 | #define PUCAN_TFAST_TSEG1(t) ((t) & 0xf) | ||
| 67 | #define PUCAN_TFAST_BRP(b) ((b) & 0x3ff) | ||
| 68 | |||
| 69 | struct __packed pucan_timing_fast { | ||
| 70 | __le16 opcode_channel; | ||
| 71 | |||
| 72 | u8 unused; | ||
| 73 | u8 sjw; /* Sync Jump Width */ | ||
| 74 | u8 tseg2; /* Timing SEGment 2 */ | ||
| 75 | u8 tseg1; /* Timing SEGment 1 */ | ||
| 76 | |||
| 77 | __le16 brp; /* BaudRate Prescaler */ | ||
| 78 | }; | ||
| 79 | |||
| 80 | /* uCAN FILTER_STD command fields */ | ||
| 81 | #define PUCAN_FLTSTD_ROW_IDX_BITS 6 | ||
| 82 | |||
| 83 | struct __packed pucan_filter_std { | ||
| 84 | __le16 opcode_channel; | ||
| 85 | |||
| 86 | __le16 idx; | ||
| 87 | __le32 mask; /* CAN-ID bitmask in idx range */ | ||
| 88 | }; | ||
| 89 | |||
| 90 | /* uCAN WR_ERR_CNT command fields */ | ||
| 91 | #define PUCAN_WRERRCNT_TE 0x4000 /* Tx error cntr write Enable */ | ||
| 92 | #define PUCAN_WRERRCNT_RE 0x8000 /* Rx error cntr write Enable */ | ||
| 93 | |||
| 94 | struct __packed pucan_wr_err_cnt { | ||
| 95 | __le16 opcode_channel; | ||
| 96 | |||
| 97 | __le16 sel_mask; | ||
| 98 | u8 tx_counter; /* Tx error counter new value */ | ||
| 99 | u8 rx_counter; /* Rx error counter new value */ | ||
| 100 | |||
| 101 | u16 unused; | ||
| 102 | }; | ||
| 103 | |||
| 104 | /* uCAN RX_FRAME_ENABLE command fields */ | ||
| 105 | #define PUCAN_FLTEXT_ERROR 0x0001 | ||
| 106 | #define PUCAN_FLTEXT_BUSLOAD 0x0002 | ||
| 107 | |||
| 108 | struct __packed pucan_filter_ext { | ||
| 109 | __le16 opcode_channel; | ||
| 110 | |||
| 111 | __le16 ext_mask; | ||
| 112 | u32 unused; | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* uCAN received messages global format */ | ||
| 116 | struct __packed pucan_msg { | ||
| 117 | __le16 size; | ||
| 118 | __le16 type; | ||
| 119 | __le32 ts_low; | ||
| 120 | __le32 ts_high; | ||
| 121 | }; | ||
| 122 | |||
| 123 | /* uCAN flags for CAN/CANFD messages */ | ||
| 124 | #define PUCAN_MSG_SELF_RECEIVE 0x80 | ||
| 125 | #define PUCAN_MSG_ERROR_STATE_IND 0x40 /* error state indicator */ | ||
| 126 | #define PUCAN_MSG_BITRATE_SWITCH 0x20 /* bitrate switch */ | ||
| 127 | #define PUCAN_MSG_EXT_DATA_LEN 0x10 /* extended data length */ | ||
| 128 | #define PUCAN_MSG_SINGLE_SHOT 0x08 | ||
| 129 | #define PUCAN_MSG_LOOPED_BACK 0x04 | ||
| 130 | #define PUCAN_MSG_EXT_ID 0x02 | ||
| 131 | #define PUCAN_MSG_RTR 0x01 | ||
| 132 | |||
| 133 | struct __packed pucan_rx_msg { | ||
| 134 | __le16 size; | ||
| 135 | __le16 type; | ||
| 136 | __le32 ts_low; | ||
| 137 | __le32 ts_high; | ||
| 138 | __le32 tag_low; | ||
| 139 | __le32 tag_high; | ||
| 140 | u8 channel_dlc; | ||
| 141 | u8 client; | ||
| 142 | __le16 flags; | ||
| 143 | __le32 can_id; | ||
| 144 | u8 d[0]; | ||
| 145 | }; | ||
| 146 | |||
| 147 | /* uCAN error types */ | ||
| 148 | #define PUCAN_ERMSG_BIT_ERROR 0 | ||
| 149 | #define PUCAN_ERMSG_FORM_ERROR 1 | ||
| 150 | #define PUCAN_ERMSG_STUFF_ERROR 2 | ||
| 151 | #define PUCAN_ERMSG_OTHER_ERROR 3 | ||
| 152 | #define PUCAN_ERMSG_ERR_CNT_DEC 4 | ||
| 153 | |||
| 154 | struct __packed pucan_error_msg { | ||
| 155 | __le16 size; | ||
| 156 | __le16 type; | ||
| 157 | __le32 ts_low; | ||
| 158 | __le32 ts_high; | ||
| 159 | u8 channel_type_d; | ||
| 160 | u8 code_g; | ||
| 161 | u8 tx_err_cnt; | ||
| 162 | u8 rx_err_cnt; | ||
| 163 | }; | ||
| 164 | |||
| 165 | #define PUCAN_BUS_PASSIVE 0x20 | ||
| 166 | #define PUCAN_BUS_WARNING 0x40 | ||
| 167 | #define PUCAN_BUS_BUSOFF 0x80 | ||
| 168 | |||
| 169 | struct __packed pucan_status_msg { | ||
| 170 | __le16 size; | ||
| 171 | __le16 type; | ||
| 172 | __le32 ts_low; | ||
| 173 | __le32 ts_high; | ||
| 174 | u8 channel_p_w_b; | ||
| 175 | u8 unused[3]; | ||
| 176 | }; | ||
| 177 | |||
| 178 | /* uCAN transmitted message format */ | ||
| 179 | #define PUCAN_MSG_CHANNEL_DLC(c, d) (((c) & 0xf) | ((d) << 4)) | ||
| 180 | |||
| 181 | struct __packed pucan_tx_msg { | ||
| 182 | __le16 size; | ||
| 183 | __le16 type; | ||
| 184 | __le32 tag_low; | ||
| 185 | __le32 tag_high; | ||
| 186 | u8 channel_dlc; | ||
| 187 | u8 client; | ||
| 188 | __le16 flags; | ||
| 189 | __le32 can_id; | ||
| 190 | u8 d[0]; | ||
| 191 | }; | ||
| 192 | |||
| 193 | /* build the cmd opcode_channel field with respect to the correct endianness */ | ||
| 194 | static inline __le16 pucan_cmd_opcode_channel(struct peak_usb_device *dev, | ||
| 195 | int opcode) | ||
| 196 | { | ||
| 197 | return cpu_to_le16(((dev->ctrl_idx) << 12) | ((opcode) & 0x3ff)); | ||
| 198 | } | ||
| 199 | |||
| 200 | /* return the channel number part from any received message channel_dlc field */ | ||
| 201 | static inline int pucan_msg_get_channel(struct pucan_rx_msg *rm) | ||
| 202 | { | ||
| 203 | return rm->channel_dlc & 0xf; | ||
| 204 | } | ||
| 205 | |||
| 206 | /* return the dlc value from any received message channel_dlc field */ | ||
| 207 | static inline int pucan_msg_get_dlc(struct pucan_rx_msg *rm) | ||
| 208 | { | ||
| 209 | return rm->channel_dlc >> 4; | ||
| 210 | } | ||
| 211 | |||
| 212 | static inline int pucan_ermsg_get_channel(struct pucan_error_msg *em) | ||
| 213 | { | ||
| 214 | return em->channel_type_d & 0x0f; | ||
| 215 | } | ||
| 216 | |||
| 217 | static inline int pucan_stmsg_get_channel(struct pucan_status_msg *sm) | ||
| 218 | { | ||
| 219 | return sm->channel_p_w_b & 0x0f; | ||
| 220 | } | ||
| 221 | |||
| 222 | #endif | ||
| @@ -488,6 +488,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 487 unmodified lines | |||
| 488 | switch (new_state) { | 488 | switch (new_state) { |
| 489 | case CAN_STATE_BUS_OFF: | 489 | case CAN_STATE_BUS_OFF: |
| 490 | cf->can_id |= CAN_ERR_BUSOFF; | 490 | cf->can_id |= CAN_ERR_BUSOFF; |
| 491 | mc->pdev->dev.can.can_stats.bus_off++; | ||
| 491 | can_bus_off(mc->netdev); | 492 | can_bus_off(mc->netdev); |
| 492 | break; | 493 | break; |
| 493 | 494 | ||
| @@ -854,10 +855,11 @@ static int pcan_usb_probe(struct usb_interface *intf) · 360 unmodified lines | |||
| 854 | /* | 855 | /* |
| 855 | * describe the PCAN-USB adapter | 856 | * describe the PCAN-USB adapter |
| 856 | */ | 857 | */ |
| 857 | struct peak_usb_adapter pcan_usb = { | 858 | const struct peak_usb_adapter pcan_usb = { |
| 858 | .name = "PCAN-USB", | 859 | .name = "PCAN-USB", |
| 859 | .device_id = PCAN_USB_PRODUCT_ID, | 860 | .device_id = PCAN_USB_PRODUCT_ID, |
| 860 | .ctrl_count = 1, | 861 | .ctrl_count = 1, |
| 862 | .ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY, | ||
| 861 | .clock = { | 863 | .clock = { |
| 862 | .freq = PCAN_USB_CRYSTAL_HZ / 2 , | 864 | .freq = PCAN_USB_CRYSTAL_HZ / 2 , |
| 863 | }, | 865 | }, |
| @@ -37,16 +37,19 @@ MODULE_LICENSE("GPL v2"); · 36 unmodified lines | |||
| 37 | static struct usb_device_id peak_usb_table[] = { | 37 | static struct usb_device_id peak_usb_table[] = { |
| 38 | {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USB_PRODUCT_ID)}, | 38 | {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USB_PRODUCT_ID)}, |
| 39 | {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPRO_PRODUCT_ID)}, | 39 | {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPRO_PRODUCT_ID)}, |
| 40 | {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBFD_PRODUCT_ID)}, | ||
| 41 | {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPROFD_PRODUCT_ID)}, | ||
| 40 | {} /* Terminating entry */ | 42 | {} /* Terminating entry */ |
| 41 | }; | 43 | }; |
| 42 | 44 | ||
| 43 | MODULE_DEVICE_TABLE(usb, peak_usb_table); | 45 | MODULE_DEVICE_TABLE(usb, peak_usb_table); |
| 44 | 46 | ||
| 45 | /* List of supported PCAN-USB adapters (NULL terminated list) */ | 47 | /* List of supported PCAN-USB adapters (NULL terminated list) */ |
| 46 | static struct peak_usb_adapter *peak_usb_adapters_list[] = { | 48 | static const struct peak_usb_adapter *const peak_usb_adapters_list[] = { |
| 47 | &pcan_usb, | 49 | &pcan_usb, |
| 48 | &pcan_usb_pro, | 50 | &pcan_usb_pro, |
| 49 | NULL, | 51 | &pcan_usb_fd, |
| 52 | &pcan_usb_pro_fd, | ||
| 50 | }; | 53 | }; |
| 51 | 54 | ||
| 52 | /* | 55 | /* |
| @@ -65,7 +68,7 @@ void pcan_dump_mem(char *prompt, void *p, int l) · 12 unmodified lines | |||
| 65 | * initialize a time_ref object with usb adapter own settings | 68 | * initialize a time_ref object with usb adapter own settings |
| 66 | */ | 69 | */ |
| 67 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, | 70 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, |
| 68 | struct peak_usb_adapter *adapter) | 71 | const struct peak_usb_adapter *adapter) |
| 69 | { | 72 | { |
| 70 | if (time_ref) { | 73 | if (time_ref) { |
| 71 | memset(time_ref, 0, sizeof(struct peak_time_ref)); | 74 | memset(time_ref, 0, sizeof(struct peak_time_ref)); |
| @@ -164,6 +167,21 @@ void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, · 92 unmodified lines | |||
| 164 | } | 167 | } |
| 165 | } | 168 | } |
| 166 | 169 | ||
| 170 | /* | ||
| 171 | * post received skb after having set any hw timestamp | ||
| 172 | */ | ||
| 173 | int peak_usb_netif_rx(struct sk_buff *skb, | ||
| 174 | struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high) | ||
| 175 | { | ||
| 176 | struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb); | ||
| 177 | struct timeval tv; | ||
| 178 | |||
| 179 | peak_usb_get_ts_tv(time_ref, ts_low, &tv); | ||
| 180 | hwts->hwtstamp = timeval_to_ktime(tv); | ||
| 181 | |||
| 182 | return netif_rx(skb); | ||
| 183 | } | ||
| 184 | |||
| 167 | /* | 185 | /* |
| 168 | * callback for bulk Rx urb | 186 | * callback for bulk Rx urb |
| 169 | */ | 187 | */ |
| @@ -253,7 +271,7 @@ static void peak_usb_write_bulk_callback(struct urb *urb) · 83 unmodified lines | |||
| 253 | case 0: | 271 | case 0: |
| 254 | /* transmission complete */ | 272 | /* transmission complete */ |
| 255 | netdev->stats.tx_packets++; | 273 | netdev->stats.tx_packets++; |
| 256 | netdev->stats.tx_bytes += context->dlc; | 274 | netdev->stats.tx_bytes += context->data_len; |
| 257 | 275 | ||
| 258 | /* prevent tx timeout */ | 276 | /* prevent tx timeout */ |
| 259 | netdev->trans_start = jiffies; | 277 | netdev->trans_start = jiffies; |
| @@ -289,7 +307,7 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb, · 29 unmodified lines | |||
| 289 | struct peak_usb_device *dev = netdev_priv(netdev); | 307 | struct peak_usb_device *dev = netdev_priv(netdev); |
| 290 | struct peak_tx_urb_context *context = NULL; | 308 | struct peak_tx_urb_context *context = NULL; |
| 291 | struct net_device_stats *stats = &netdev->stats; | 309 | struct net_device_stats *stats = &netdev->stats; |
| 292 | struct can_frame *cf = (struct can_frame *)skb->data; | 310 | struct canfd_frame *cfd = (struct canfd_frame *)skb->data; |
| 293 | struct urb *urb; | 311 | struct urb *urb; |
| 294 | u8 *obuf; | 312 | u8 *obuf; |
| 295 | int i, err; | 313 | int i, err; |
| @@ -322,7 +340,9 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb, · 26 unmodified lines | |||
| 322 | } | 340 | } |
| 323 | 341 | ||
| 324 | context->echo_index = i; | 342 | context->echo_index = i; |
| 325 | context->dlc = cf->can_dlc; | 343 | |
| 344 | /* Note: this works with CANFD frames too */ | ||
| 345 | context->data_len = cfd->len; | ||
| 326 | 346 | ||
| 327 | usb_anchor_urb(urb, &dev->tx_submitted); | 347 | usb_anchor_urb(urb, &dev->tx_submitted); |
| 328 | 348 | ||
| @@ -679,19 +699,43 @@ static int peak_usb_set_mode(struct net_device *netdev, enum can_mode mode) · 350 unmodified lines | |||
| 679 | } | 699 | } |
| 680 | 700 | ||
| 681 | /* | 701 | /* |
| 682 | * candev callback used to set device bitrate. | 702 | * candev callback used to set device nominal/arbitration bitrate. |
| 683 | */ | 703 | */ |
| 684 | static int peak_usb_set_bittiming(struct net_device *netdev) | 704 | static int peak_usb_set_bittiming(struct net_device *netdev) |
| 685 | { | 705 | { |
| 686 | struct peak_usb_device *dev = netdev_priv(netdev); | 706 | struct peak_usb_device *dev = netdev_priv(netdev); |
| 687 | struct can_bittiming *bt = &dev->can.bittiming; | 707 | const struct peak_usb_adapter *pa = dev->adapter; |
| 688 | 708 | ||
| 689 | if (dev->adapter->dev_set_bittiming) { | 709 | if (pa->dev_set_bittiming) { |
| 690 | int err = dev->adapter->dev_set_bittiming(dev, bt); | 710 | struct can_bittiming *bt = &dev->can.bittiming; |
| 711 | int err = pa->dev_set_bittiming(dev, bt); | ||
| 691 | 712 | ||
| 692 | if (err) | 713 | if (err) |
| 693 | netdev_info(netdev, "couldn't set bitrate (err %d)\n", | 714 | netdev_info(netdev, "couldn't set bitrate (err %d)\n", |
| 694 | err); | 715 | err); |
| 716 | return err; | ||
| 717 | } | ||
| 718 | |||
| 719 | return 0; | ||
| 720 | } | ||
| 721 | |||
| 722 | /* | ||
| 723 | * candev callback used to set device data bitrate. | ||
| 724 | */ | ||
| 725 | static int peak_usb_set_data_bittiming(struct net_device *netdev) | ||
| 726 | { | ||
| 727 | struct peak_usb_device *dev = netdev_priv(netdev); | ||
| 728 | const struct peak_usb_adapter *pa = dev->adapter; | ||
| 729 | |||
| 730 | if (pa->dev_set_data_bittiming) { | ||
| 731 | struct can_bittiming *bt = &dev->can.data_bittiming; | ||
| 732 | int err = pa->dev_set_data_bittiming(dev, bt); | ||
| 733 | |||
| 734 | if (err) | ||
| 735 | netdev_info(netdev, | ||
| 736 | "couldn't set data bitrate (err %d)\n", | ||
| 737 | err); | ||
| 738 | |||
| 695 | return err; | 739 | return err; |
| 696 | } | 740 | } |
| 697 | 741 | ||
| @@ -709,7 +753,7 @@ static const struct net_device_ops peak_usb_netdev_ops = { · 11 unmodified lines | |||
| 709 | * create one device which is attached to CAN controller #ctrl_idx of the | 753 | * create one device which is attached to CAN controller #ctrl_idx of the |
| 710 | * usb adapter. | 754 | * usb adapter. |
| 711 | */ | 755 | */ |
| 712 | static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, | 756 | static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, |
| 713 | struct usb_interface *intf, int ctrl_idx) | 757 | struct usb_interface *intf, int ctrl_idx) |
| 714 | { | 758 | { |
| 715 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 759 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
| @@ -750,9 +794,11 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, · 34 unmodified lines | |||
| 750 | dev->can.clock = peak_usb_adapter->clock; | 794 | dev->can.clock = peak_usb_adapter->clock; |
| 751 | dev->can.bittiming_const = &peak_usb_adapter->bittiming_const; | 795 | dev->can.bittiming_const = &peak_usb_adapter->bittiming_const; |
| 752 | dev->can.do_set_bittiming = peak_usb_set_bittiming; | 796 | dev->can.do_set_bittiming = peak_usb_set_bittiming; |
| 797 | dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const; | ||
| 798 | dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming; | ||
| 753 | dev->can.do_set_mode = peak_usb_set_mode; | 799 | dev->can.do_set_mode = peak_usb_set_mode; |
| 754 | dev->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | | 800 | dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter; |
| 755 | CAN_CTRLMODE_LISTENONLY; | 801 | dev->can.ctrlmode_supported = peak_usb_adapter->ctrlmode_supported; |
| 756 | 802 | ||
| 757 | netdev->netdev_ops = &peak_usb_netdev_ops; | 803 | netdev->netdev_ops = &peak_usb_netdev_ops; |
| 758 | 804 | ||
| @@ -857,17 +903,18 @@ static int peak_usb_probe(struct usb_interface *intf, · 98 unmodified lines | |||
| 857 | { | 903 | { |
| 858 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 904 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
| 859 | const u16 usb_id_product = le16_to_cpu(usb_dev->descriptor.idProduct); | 905 | const u16 usb_id_product = le16_to_cpu(usb_dev->descriptor.idProduct); |
| 860 | struct peak_usb_adapter *peak_usb_adapter, **pp; | 906 | const struct peak_usb_adapter *peak_usb_adapter = NULL; |
| 861 | int i, err = -ENOMEM; | 907 | int i, err = -ENOMEM; |
| 862 | 908 | ||
| 863 | usb_dev = interface_to_usbdev(intf); | 909 | usb_dev = interface_to_usbdev(intf); |
| 864 | 910 | ||
| 865 | /* get corresponding PCAN-USB adapter */ | 911 | /* get corresponding PCAN-USB adapter */ |
| 866 | for (pp = peak_usb_adapters_list; *pp; pp++) | 912 | for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++) |
| 867 | if ((*pp)->device_id == usb_id_product) | 913 | if (peak_usb_adapters_list[i]->device_id == usb_id_product) { |
| 914 | peak_usb_adapter = peak_usb_adapters_list[i]; | ||
| 868 | break; | 915 | break; |
| 916 | } | ||
| 869 | 917 | ||
| 870 | peak_usb_adapter = *pp; | ||
| 871 | if (!peak_usb_adapter) { | 918 | if (!peak_usb_adapter) { |
| 872 | /* should never come except device_id bad usage in this file */ | 919 | /* should never come except device_id bad usage in this file */ |
| 873 | pr_err("%s: didn't find device id. 0x%x in devices list\n", | 920 | pr_err("%s: didn't find device id. 0x%x in devices list\n", |
| @@ -25,6 +25,8 @@ · 24 unmodified lines | |||
| 25 | /* supported device ids. */ | 25 | /* supported device ids. */ |
| 26 | #define PCAN_USB_PRODUCT_ID 0x000c | 26 | #define PCAN_USB_PRODUCT_ID 0x000c |
| 27 | #define PCAN_USBPRO_PRODUCT_ID 0x000d | 27 | #define PCAN_USBPRO_PRODUCT_ID 0x000d |
| 28 | #define PCAN_USBPROFD_PRODUCT_ID 0x0011 | ||
| 29 | #define PCAN_USBFD_PRODUCT_ID 0x0012 | ||
| 28 | 30 | ||
| 29 | #define PCAN_USB_DRIVER_NAME "peak_usb" | 31 | #define PCAN_USB_DRIVER_NAME "peak_usb" |
| 30 | 32 | ||
| @@ -44,8 +46,10 @@ struct peak_usb_device; · 13 unmodified lines | |||
| 44 | struct peak_usb_adapter { | 46 | struct peak_usb_adapter { |
| 45 | char *name; | 47 | char *name; |
| 46 | u32 device_id; | 48 | u32 device_id; |
| 49 | u32 ctrlmode_supported; | ||
| 47 | struct can_clock clock; | 50 | struct can_clock clock; |
| 48 | const struct can_bittiming_const bittiming_const; | 51 | const struct can_bittiming_const bittiming_const; |
| 52 | const struct can_bittiming_const data_bittiming_const; | ||
| 49 | unsigned int ctrl_count; | 53 | unsigned int ctrl_count; |
| 50 | 54 | ||
| 51 | int (*intf_probe)(struct usb_interface *intf); | 55 | int (*intf_probe)(struct usb_interface *intf); |
| @@ -57,6 +61,8 @@ struct peak_usb_adapter { · 5 unmodified lines | |||
| 57 | int (*dev_close)(struct peak_usb_device *dev); | 61 | int (*dev_close)(struct peak_usb_device *dev); |
| 58 | int (*dev_set_bittiming)(struct peak_usb_device *dev, | 62 | int (*dev_set_bittiming)(struct peak_usb_device *dev, |
| 59 | struct can_bittiming *bt); | 63 | struct can_bittiming *bt); |
| 64 | int (*dev_set_data_bittiming)(struct peak_usb_device *dev, | ||
| 65 | struct can_bittiming *bt); | ||
| 60 | int (*dev_set_bus)(struct peak_usb_device *dev, u8 onoff); | 66 | int (*dev_set_bus)(struct peak_usb_device *dev, u8 onoff); |
| 61 | int (*dev_get_device_id)(struct peak_usb_device *dev, u32 *device_id); | 67 | int (*dev_get_device_id)(struct peak_usb_device *dev, u32 *device_id); |
| 62 | int (*dev_decode_buf)(struct peak_usb_device *dev, struct urb *urb); | 68 | int (*dev_decode_buf)(struct peak_usb_device *dev, struct urb *urb); |
| @@ -66,6 +72,8 @@ struct peak_usb_adapter { · 3 unmodified lines | |||
| 66 | int (*dev_stop)(struct peak_usb_device *dev); | 72 | int (*dev_stop)(struct peak_usb_device *dev); |
| 67 | int (*dev_restart_async)(struct peak_usb_device *dev, struct urb *urb, | 73 | int (*dev_restart_async)(struct peak_usb_device *dev, struct urb *urb, |
| 68 | u8 *buf); | 74 | u8 *buf); |
| 75 | int (*do_get_berr_counter)(const struct net_device *netdev, | ||
| 76 | struct can_berr_counter *bec); | ||
| 69 | u8 ep_msg_in; | 77 | u8 ep_msg_in; |
| 70 | u8 ep_msg_out[PCAN_USB_MAX_CHANNEL]; | 78 | u8 ep_msg_out[PCAN_USB_MAX_CHANNEL]; |
| 71 | u8 ts_used_bits; | 79 | u8 ts_used_bits; |
| @@ -78,21 +86,23 @@ struct peak_usb_adapter { · 6 unmodified lines | |||
| 78 | int sizeof_dev_private; | 86 | int sizeof_dev_private; |
| 79 | }; | 87 | }; |
| 80 | 88 | ||
| 81 | extern struct peak_usb_adapter pcan_usb; | 89 | extern const struct peak_usb_adapter pcan_usb; |
| 82 | extern struct peak_usb_adapter pcan_usb_pro; | 90 | extern const struct peak_usb_adapter pcan_usb_pro; |
| 91 | extern const struct peak_usb_adapter pcan_usb_fd; | ||
| 92 | extern const struct peak_usb_adapter pcan_usb_pro_fd; | ||
| 83 | 93 | ||
| 84 | struct peak_time_ref { | 94 | struct peak_time_ref { |
| 85 | struct timeval tv_host_0, tv_host; | 95 | struct timeval tv_host_0, tv_host; |
| 86 | u32 ts_dev_1, ts_dev_2; | 96 | u32 ts_dev_1, ts_dev_2; |
| 87 | u64 ts_total; | 97 | u64 ts_total; |
| 88 | u32 tick_count; | 98 | u32 tick_count; |
| 89 | struct peak_usb_adapter *adapter; | 99 | const struct peak_usb_adapter *adapter; |
| 90 | }; | 100 | }; |
| 91 | 101 | ||
| 92 | struct peak_tx_urb_context { | 102 | struct peak_tx_urb_context { |
| 93 | struct peak_usb_device *dev; | 103 | struct peak_usb_device *dev; |
| 94 | u32 echo_index; | 104 | u32 echo_index; |
| 95 | u8 dlc; | 105 | u8 data_len; |
| 96 | struct urb *urb; | 106 | struct urb *urb; |
| 97 | }; | 107 | }; |
| 98 | 108 | ||
| @@ -102,7 +112,7 @@ struct peak_tx_urb_context { · 3 unmodified lines | |||
| 102 | /* PEAK-System USB device */ | 112 | /* PEAK-System USB device */ |
| 103 | struct peak_usb_device { | 113 | struct peak_usb_device { |
| 104 | struct can_priv can; | 114 | struct can_priv can; |
| 105 | struct peak_usb_adapter *adapter; | 115 | const struct peak_usb_adapter *adapter; |
| 106 | unsigned int ctrl_idx; | 116 | unsigned int ctrl_idx; |
| 107 | u32 state; | 117 | u32 state; |
| 108 | 118 | ||
| @@ -134,12 +144,14 @@ void pcan_dump_mem(char *prompt, void *p, int l); · 25 unmodified lines | |||
| 134 | 144 | ||
| 135 | /* common timestamp management */ | 145 | /* common timestamp management */ |
| 136 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, | 146 | void peak_usb_init_time_ref(struct peak_time_ref *time_ref, |
| 137 | struct peak_usb_adapter *adapter); | 147 | const struct peak_usb_adapter *adapter); |
| 138 | void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now); | 148 | void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now); |
| 139 | void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now); | 149 | void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now); |
| 140 | void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, | 150 | void peak_usb_get_ts_tv(struct peak_time_ref *time_ref, u32 ts, |
| 141 | struct timeval *tv); | 151 | struct timeval *tv); |
| 142 | 152 | int peak_usb_netif_rx(struct sk_buff *skb, | |
| 153 | struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high); | ||
| 143 | void peak_usb_async_complete(struct urb *urb); | 154 | void peak_usb_async_complete(struct urb *urb); |
| 144 | void peak_usb_restart_complete(struct peak_usb_device *dev); | 155 | void peak_usb_restart_complete(struct peak_usb_device *dev); |
| 156 | |||
| 145 | #endif | 157 | #endif |
| @@ -0,0 +1,1095 @@ | |||
| 1 | /* | ||
| 2 | * CAN driver for PEAK System PCAN-USB FD / PCAN-USB Pro FD adapter | ||
| 3 | * | ||
| 4 | * Copyright (C) 2013-2014 Stephane Grosjean <s.grosjean@peak-system.com> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published | ||
| 8 | * by the Free Software Foundation; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | * General Public License for more details. | ||
| 14 | */ | ||
| 15 | #include <linux/netdevice.h> | ||
| 16 | #include <linux/usb.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | |||
| 19 | #include <linux/can.h> | ||
| 20 | #include <linux/can/dev.h> | ||
| 21 | #include <linux/can/error.h> | ||
| 22 | |||
| 23 | #include "pcan_usb_core.h" | ||
| 24 | #include "pcan_usb_pro.h" | ||
| 25 | #include "pcan_ucan.h" | ||
| 26 | |||
| 27 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB FD adapter"); | ||
| 28 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro FD adapter"); | ||
| 29 | |||
| 30 | #define PCAN_USBPROFD_CHANNEL_COUNT 2 | ||
| 31 | #define PCAN_USBFD_CHANNEL_COUNT 1 | ||
| 32 | |||
| 33 | /* PCAN-USB Pro FD adapter internal clock (Hz) */ | ||
| 34 | #define PCAN_UFD_CRYSTAL_HZ 80000000 | ||
| 35 | |||
| 36 | #define PCAN_UFD_CMD_BUFFER_SIZE 512 | ||
| 37 | #define PCAN_UFD_LOSPD_PKT_SIZE 64 | ||
| 38 | |||
| 39 | /* PCAN-USB Pro FD command timeout (ms.) */ | ||
| 40 | #define PCAN_UFD_CMD_TIMEOUT_MS 1000 | ||
| 41 | |||
| 42 | /* PCAN-USB Pro FD rx/tx buffers size */ | ||
| 43 | #define PCAN_UFD_RX_BUFFER_SIZE 2048 | ||
| 44 | #define PCAN_UFD_TX_BUFFER_SIZE 512 | ||
| 45 | |||
| 46 | /* read some versions info from the hw devcie */ | ||
| 47 | struct __packed pcan_ufd_fw_info { | ||
| 48 | __le16 size_of; /* sizeof this */ | ||
| 49 | __le16 type; /* type of this structure */ | ||
| 50 | u8 hw_type; /* Type of hardware (HW_TYPE_xxx) */ | ||
| 51 | u8 bl_version[3]; /* Bootloader version */ | ||
| 52 | u8 hw_version; /* Hardware version (PCB) */ | ||
| 53 | u8 fw_version[3]; /* Firmware version */ | ||
| 54 | __le32 dev_id[2]; /* "device id" per CAN */ | ||
| 55 | __le32 ser_no; /* S/N */ | ||
| 56 | __le32 flags; /* special functions */ | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* handle device specific info used by the netdevices */ | ||
| 60 | struct pcan_usb_fd_if { | ||
| 61 | struct peak_usb_device *dev[PCAN_USB_MAX_CHANNEL]; | ||
| 62 | struct pcan_ufd_fw_info fw_info; | ||
| 63 | struct peak_time_ref time_ref; | ||
| 64 | int cm_ignore_count; | ||
| 65 | int dev_opened_count; | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* device information */ | ||
| 69 | struct pcan_usb_fd_device { | ||
| 70 | struct peak_usb_device dev; | ||
| 71 | struct can_berr_counter bec; | ||
| 72 | struct pcan_usb_fd_if *usb_if; | ||
| 73 | u8 *cmd_buffer_addr; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /* Extended USB commands (non uCAN commands) */ | ||
| 77 | |||
| 78 | /* Clock Modes command */ | ||
| 79 | #define PCAN_UFD_CMD_CLK_SET 0x80 | ||
| 80 | |||
| 81 | #define PCAN_UFD_CLK_80MHZ 0x0 | ||
| 82 | #define PCAN_UFD_CLK_60MHZ 0x1 | ||
| 83 | #define PCAN_UFD_CLK_40MHZ 0x2 | ||
| 84 | #define PCAN_UFD_CLK_30MHZ 0x3 | ||
| 85 | #define PCAN_UFD_CLK_24MHZ 0x4 | ||
| 86 | #define PCAN_UFD_CLK_20MHZ 0x5 | ||
| 87 | #define PCAN_UFD_CLK_DEF PCAN_UFD_CLK_80MHZ | ||
| 88 | |||
| 89 | struct __packed pcan_ufd_clock { | ||
| 90 | __le16 opcode_channel; | ||
| 91 | |||
| 92 | u8 mode; | ||
| 93 | u8 unused[5]; | ||
| 94 | }; | ||
| 95 | |||
| 96 | /* LED control command */ | ||
| 97 | #define PCAN_UFD_CMD_LED_SET 0x86 | ||
| 98 | |||
| 99 | #define PCAN_UFD_LED_DEV 0x00 | ||
| 100 | #define PCAN_UFD_LED_FAST 0x01 | ||
| 101 | #define PCAN_UFD_LED_SLOW 0x02 | ||
| 102 | #define PCAN_UFD_LED_ON 0x03 | ||
| 103 | #define PCAN_UFD_LED_OFF 0x04 | ||
| 104 | #define PCAN_UFD_LED_DEF PCAN_UFD_LED_DEV | ||
| 105 | |||
| 106 | struct __packed pcan_ufd_led { | ||
| 107 | __le16 opcode_channel; | ||
| 108 | |||
| 109 | u8 mode; | ||
| 110 | u8 unused[5]; | ||
| 111 | }; | ||
| 112 | |||
| 113 | /* Extended usage of uCAN commands CMD_RX_FRAME_xxxABLE for PCAN-USB Pro FD */ | ||
| 114 | #define PCAN_UFD_FLTEXT_CALIBRATION 0x8000 | ||
| 115 | |||
| 116 | struct __packed pcan_ufd_filter_ext { | ||
| 117 | __le16 opcode_channel; | ||
| 118 | |||
| 119 | __le16 ext_mask; | ||
| 120 | u16 unused; | ||
| 121 | __le16 usb_mask; | ||
| 122 | }; | ||
| 123 | |||
| 124 | /* Extended usage of uCAN messages for PCAN-USB Pro FD */ | ||
| 125 | #define PCAN_UFD_MSG_CALIBRATION 0x100 | ||
| 126 | |||
| 127 | struct __packed pcan_ufd_ts_msg { | ||
| 128 | __le16 size; | ||
| 129 | __le16 type; | ||
| 130 | __le32 ts_low; | ||
| 131 | __le32 ts_high; | ||
| 132 | __le16 usb_frame_index; | ||
| 133 | u16 unused; | ||
| 134 | }; | ||
| 135 | |||
| 136 | #define PCAN_UFD_MSG_OVERRUN 0x101 | ||
| 137 | |||
| 138 | #define PCAN_UFD_OVMSG_CHANNEL(o) ((o)->channel & 0xf) | ||
| 139 | |||
| 140 | struct __packed pcan_ufd_ovr_msg { | ||
| 141 | __le16 size; | ||
| 142 | __le16 type; | ||
| 143 | __le32 ts_low; | ||
| 144 | __le32 ts_high; | ||
| 145 | u8 channel; | ||
| 146 | u8 unused[3]; | ||
| 147 | }; | ||
| 148 | |||
| 149 | static inline int pufd_omsg_get_channel(struct pcan_ufd_ovr_msg *om) | ||
| 150 | { | ||
| 151 | return om->channel & 0xf; | ||
| 152 | } | ||
| 153 | |||
| 154 | /* Clock mode frequency values */ | ||
| 155 | static const u32 pcan_usb_fd_clk_freq[6] = { | ||
| 156 | [PCAN_UFD_CLK_80MHZ] = 80000000, | ||
| 157 | [PCAN_UFD_CLK_60MHZ] = 60000000, | ||
| 158 | [PCAN_UFD_CLK_40MHZ] = 40000000, | ||
| 159 | [PCAN_UFD_CLK_30MHZ] = 30000000, | ||
| 160 | [PCAN_UFD_CLK_24MHZ] = 24000000, | ||
| 161 | [PCAN_UFD_CLK_20MHZ] = 20000000 | ||
| 162 | }; | ||
| 163 | |||
| 164 | /* return a device USB interface */ | ||
| 165 | static inline | ||
| 166 | struct pcan_usb_fd_if *pcan_usb_fd_dev_if(struct peak_usb_device *dev) | ||
| 167 | { | ||
| 168 | struct pcan_usb_fd_device *pdev = | ||
| 169 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 170 | return pdev->usb_if; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* return a device USB commands buffer */ | ||
| 174 | static inline void *pcan_usb_fd_cmd_buffer(struct peak_usb_device *dev) | ||
| 175 | { | ||
| 176 | struct pcan_usb_fd_device *pdev = | ||
| 177 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 178 | return pdev->cmd_buffer_addr; | ||
| 179 | } | ||
| 180 | |||
| 181 | /* send PCAN-USB Pro FD commands synchronously */ | ||
| 182 | static int pcan_usb_fd_send_cmd(struct peak_usb_device *dev, void *cmd_tail) | ||
| 183 | { | ||
| 184 | void *cmd_head = pcan_usb_fd_cmd_buffer(dev); | ||
| 185 | int err; | ||
| 186 | u8 *packet_ptr; | ||
| 187 | int i, n = 1, packet_len; | ||
| 188 | ptrdiff_t cmd_len; | ||
| 189 | |||
| 190 | /* usb device unregistered? */ | ||
| 191 | if (!(dev->state & PCAN_USB_STATE_CONNECTED)) | ||
| 192 | return 0; | ||
| 193 | |||
| 194 | /* if a packet is not filled completely by commands, the command list | ||
| 195 | * is terminated with an "end of collection" record. | ||
| 196 | */ | ||
| 197 | cmd_len = cmd_tail - cmd_head; | ||
| 198 | if (cmd_len <= (PCAN_UFD_CMD_BUFFER_SIZE - sizeof(u64))) { | ||
| 199 | memset(cmd_tail, 0xff, sizeof(u64)); | ||
| 200 | cmd_len += sizeof(u64); | ||
| 201 | } | ||
| 202 | |||
| 203 | packet_ptr = cmd_head; | ||
| 204 | |||
| 205 | /* firmware is not able to re-assemble 512 bytes buffer in full-speed */ | ||
| 206 | if ((dev->udev->speed != USB_SPEED_HIGH) && | ||
| 207 | (cmd_len > PCAN_UFD_LOSPD_PKT_SIZE)) { | ||
| 208 | packet_len = PCAN_UFD_LOSPD_PKT_SIZE; | ||
| 209 | n += cmd_len / packet_len; | ||
| 210 | } else { | ||
| 211 | packet_len = cmd_len; | ||
| 212 | } | ||
| 213 | |||
| 214 | for (i = 0; i < n; i++) { | ||
| 215 | err = usb_bulk_msg(dev->udev, | ||
| 216 | usb_sndbulkpipe(dev->udev, | ||
| 217 | PCAN_USBPRO_EP_CMDOUT), | ||
| 218 | packet_ptr, packet_len, | ||
| 219 | NULL, PCAN_UFD_CMD_TIMEOUT_MS); | ||
| 220 | if (err) { | ||
| 221 | netdev_err(dev->netdev, | ||
| 222 | "sending command failure: %d\n", err); | ||
| 223 | break; | ||
| 224 | } | ||
| 225 | |||
| 226 | packet_ptr += packet_len; | ||
| 227 | } | ||
| 228 | |||
| 229 | return err; | ||
| 230 | } | ||
| 231 | |||
| 232 | /* build the commands list in the given buffer, to enter operational mode */ | ||
| 233 | static int pcan_usb_fd_build_restart_cmd(struct peak_usb_device *dev, u8 *buf) | ||
| 234 | { | ||
| 235 | struct pucan_wr_err_cnt *prc; | ||
| 236 | struct pucan_command *cmd; | ||
| 237 | u8 *pc = buf; | ||
| 238 | |||
| 239 | /* 1st, reset error counters: */ | ||
| 240 | prc = (struct pucan_wr_err_cnt *)pc; | ||
| 241 | prc->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 242 | PUCAN_CMD_WR_ERR_CNT); | ||
| 243 | |||
| 244 | /* select both counters */ | ||
| 245 | prc->sel_mask = cpu_to_le16(PUCAN_WRERRCNT_TE|PUCAN_WRERRCNT_RE); | ||
| 246 | |||
| 247 | /* and reset their values */ | ||
| 248 | prc->tx_counter = 0; | ||
| 249 | prc->rx_counter = 0; | ||
| 250 | |||
| 251 | /* moves the pointer forward */ | ||
| 252 | pc += sizeof(struct pucan_wr_err_cnt); | ||
| 253 | |||
| 254 | /* next, go back to operational mode */ | ||
| 255 | cmd = (struct pucan_command *)pc; | ||
| 256 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 257 | (dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) ? | ||
| 258 | PUCAN_CMD_LISTEN_ONLY_MODE : | ||
| 259 | PUCAN_CMD_NORMAL_MODE); | ||
| 260 | pc += sizeof(struct pucan_command); | ||
| 261 | |||
| 262 | return pc - buf; | ||
| 263 | } | ||
| 264 | |||
| 265 | /* set CAN bus on/off */ | ||
| 266 | static int pcan_usb_fd_set_bus(struct peak_usb_device *dev, u8 onoff) | ||
| 267 | { | ||
| 268 | u8 *pc = pcan_usb_fd_cmd_buffer(dev); | ||
| 269 | int l; | ||
| 270 | |||
| 271 | if (onoff) { | ||
| 272 | /* build the cmds list to enter operational mode */ | ||
| 273 | l = pcan_usb_fd_build_restart_cmd(dev, pc); | ||
| 274 | } else { | ||
| 275 | struct pucan_command *cmd = (struct pucan_command *)pc; | ||
| 276 | |||
| 277 | /* build cmd to go back to reset mode */ | ||
| 278 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 279 | PUCAN_CMD_RESET_MODE); | ||
| 280 | l = sizeof(struct pucan_command); | ||
| 281 | } | ||
| 282 | |||
| 283 | /* send the command */ | ||
| 284 | return pcan_usb_fd_send_cmd(dev, pc + l); | ||
| 285 | } | ||
| 286 | |||
| 287 | /* set filtering masks: | ||
| 288 | * | ||
| 289 | * idx in range [0..63] selects a row #idx, all rows otherwise | ||
| 290 | * mask in range [0..0xffffffff] defines up to 32 CANIDs in the row(s) | ||
| 291 | * | ||
| 292 | * Each bit of this 64 x 32 bits array defines a CANID value: | ||
| 293 | * | ||
| 294 | * bit[i,j] = 1 implies that CANID=(i x 32)+j will be received, while | ||
| 295 | * bit[i,j] = 0 implies that CANID=(i x 32)+j will be discarded. | ||
| 296 | */ | ||
| 297 | static int pcan_usb_fd_set_filter_std(struct peak_usb_device *dev, int idx, | ||
| 298 | u32 mask) | ||
| 299 | { | ||
| 300 | struct pucan_filter_std *cmd = pcan_usb_fd_cmd_buffer(dev); | ||
| 301 | int i, n; | ||
| 302 | |||
| 303 | /* select all rows when idx is out of range [0..63] */ | ||
| 304 | if ((idx < 0) || (idx >= (1 << PUCAN_FLTSTD_ROW_IDX_BITS))) { | ||
| 305 | n = 1 << PUCAN_FLTSTD_ROW_IDX_BITS; | ||
| 306 | idx = 0; | ||
| 307 | |||
| 308 | /* select the row (and only the row) otherwise */ | ||
| 309 | } else { | ||
| 310 | n = idx + 1; | ||
| 311 | } | ||
| 312 | |||
| 313 | for (i = idx; i < n; i++, cmd++) { | ||
| 314 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 315 | PUCAN_CMD_FILTER_STD); | ||
| 316 | cmd->idx = cpu_to_le16(i); | ||
| 317 | cmd->mask = cpu_to_le32(mask); | ||
| 318 | } | ||
| 319 | |||
| 320 | /* send the command */ | ||
| 321 | return pcan_usb_fd_send_cmd(dev, cmd); | ||
| 322 | } | ||
| 323 | |||
| 324 | /* set/unset notifications filter: | ||
| 325 | * | ||
| 326 | * onoff sets(1)/unset(0) notifications | ||
| 327 | * mask each bit defines a kind of notification to set/unset | ||
| 328 | */ | ||
| 329 | static int pcan_usb_fd_set_filter_ext(struct peak_usb_device *dev, | ||
| 330 | bool onoff, u16 ext_mask, u16 usb_mask) | ||
| 331 | { | ||
| 332 | struct pcan_ufd_filter_ext *cmd = pcan_usb_fd_cmd_buffer(dev); | ||
| 333 | |||
| 334 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 335 | (onoff) ? PUCAN_CMD_RX_FRAME_ENABLE : | ||
| 336 | PUCAN_CMD_RX_FRAME_DISABLE); | ||
| 337 | |||
| 338 | cmd->ext_mask = cpu_to_le16(ext_mask); | ||
| 339 | cmd->usb_mask = cpu_to_le16(usb_mask); | ||
| 340 | |||
| 341 | /* send the command */ | ||
| 342 | return pcan_usb_fd_send_cmd(dev, ++cmd); | ||
| 343 | } | ||
| 344 | |||
| 345 | /* setup LED control */ | ||
| 346 | static int pcan_usb_fd_set_can_led(struct peak_usb_device *dev, u8 led_mode) | ||
| 347 | { | ||
| 348 | struct pcan_ufd_led *cmd = pcan_usb_fd_cmd_buffer(dev); | ||
| 349 | |||
| 350 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 351 | PCAN_UFD_CMD_LED_SET); | ||
| 352 | cmd->mode = led_mode; | ||
| 353 | |||
| 354 | /* send the command */ | ||
| 355 | return pcan_usb_fd_send_cmd(dev, ++cmd); | ||
| 356 | } | ||
| 357 | |||
| 358 | /* set CAN clock domain */ | ||
| 359 | static int pcan_usb_fd_set_clock_domain(struct peak_usb_device *dev, | ||
| 360 | u8 clk_mode) | ||
| 361 | { | ||
| 362 | struct pcan_ufd_clock *cmd = pcan_usb_fd_cmd_buffer(dev); | ||
| 363 | |||
| 364 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 365 | PCAN_UFD_CMD_CLK_SET); | ||
| 366 | cmd->mode = clk_mode; | ||
| 367 | |||
| 368 | /* send the command */ | ||
| 369 | return pcan_usb_fd_send_cmd(dev, ++cmd); | ||
| 370 | } | ||
| 371 | |||
| 372 | /* set bittiming for CAN and CAN-FD header */ | ||
| 373 | static int pcan_usb_fd_set_bittiming_slow(struct peak_usb_device *dev, | ||
| 374 | struct can_bittiming *bt) | ||
| 375 | { | ||
| 376 | struct pucan_timing_slow *cmd = pcan_usb_fd_cmd_buffer(dev); | ||
| 377 | |||
| 378 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 379 | PUCAN_CMD_TIMING_SLOW); | ||
| 380 | cmd->sjw_t = PUCAN_TSLOW_SJW_T(bt->sjw - 1, | ||
| 381 | dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES); | ||
| 382 | |||
| 383 | cmd->tseg2 = PUCAN_TSLOW_TSEG2(bt->phase_seg2 - 1); | ||
| 384 | cmd->tseg1 = PUCAN_TSLOW_TSEG1(bt->prop_seg + bt->phase_seg1 - 1); | ||
| 385 | cmd->brp = cpu_to_le16(PUCAN_TSLOW_BRP(bt->brp - 1)); | ||
| 386 | |||
| 387 | cmd->ewl = 96; /* default */ | ||
| 388 | |||
| 389 | /* send the command */ | ||
| 390 | return pcan_usb_fd_send_cmd(dev, ++cmd); | ||
| 391 | } | ||
| 392 | |||
| 393 | /* set CAN-FD bittiming for data */ | ||
| 394 | static int pcan_usb_fd_set_bittiming_fast(struct peak_usb_device *dev, | ||
| 395 | struct can_bittiming *bt) | ||
| 396 | { | ||
| 397 | struct pucan_timing_fast *cmd = pcan_usb_fd_cmd_buffer(dev); | ||
| 398 | |||
| 399 | cmd->opcode_channel = pucan_cmd_opcode_channel(dev, | ||
| 400 | PUCAN_CMD_TIMING_FAST); | ||
| 401 | cmd->sjw = PUCAN_TFAST_SJW(bt->sjw - 1); | ||
| 402 | cmd->tseg2 = PUCAN_TFAST_TSEG2(bt->phase_seg2 - 1); | ||
| 403 | cmd->tseg1 = PUCAN_TFAST_TSEG1(bt->prop_seg + bt->phase_seg1 - 1); | ||
| 404 | cmd->brp = cpu_to_le16(PUCAN_TFAST_BRP(bt->brp - 1)); | ||
| 405 | |||
| 406 | /* send the command */ | ||
| 407 | return pcan_usb_fd_send_cmd(dev, ++cmd); | ||
| 408 | } | ||
| 409 | |||
| 410 | /* handle restart but in asynchronously way | ||
| 411 | * (uses PCAN-USB Pro code to complete asynchronous request) | ||
| 412 | */ | ||
| 413 | static int pcan_usb_fd_restart_async(struct peak_usb_device *dev, | ||
| 414 | struct urb *urb, u8 *buf) | ||
| 415 | { | ||
| 416 | u8 *pc = buf; | ||
| 417 | |||
| 418 | /* build the entire cmds list in the provided buffer, to go back into | ||
| 419 | * operational mode. | ||
| 420 | */ | ||
| 421 | pc += pcan_usb_fd_build_restart_cmd(dev, pc); | ||
| 422 | |||
| 423 | /* add EOC */ | ||
| 424 | memset(pc, 0xff, sizeof(struct pucan_command)); | ||
| 425 | pc += sizeof(struct pucan_command); | ||
| 426 | |||
| 427 | /* complete the URB */ | ||
| 428 | usb_fill_bulk_urb(urb, dev->udev, | ||
| 429 | usb_sndbulkpipe(dev->udev, PCAN_USBPRO_EP_CMDOUT), | ||
| 430 | buf, pc - buf, | ||
| 431 | pcan_usb_pro_restart_complete, dev); | ||
| 432 | |||
| 433 | /* and submit it. */ | ||
| 434 | return usb_submit_urb(urb, GFP_ATOMIC); | ||
| 435 | } | ||
| 436 | |||
| 437 | static int pcan_usb_fd_drv_loaded(struct peak_usb_device *dev, bool loaded) | ||
| 438 | { | ||
| 439 | struct pcan_usb_fd_device *pdev = | ||
| 440 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 441 | |||
| 442 | pdev->cmd_buffer_addr[0] = 0; | ||
| 443 | pdev->cmd_buffer_addr[1] = !!loaded; | ||
| 444 | |||
| 445 | return pcan_usb_pro_send_req(dev, | ||
| 446 | PCAN_USBPRO_REQ_FCT, | ||
| 447 | PCAN_USBPRO_FCT_DRVLD, | ||
| 448 | pdev->cmd_buffer_addr, | ||
| 449 | PCAN_USBPRO_FCT_DRVLD_REQ_LEN); | ||
| 450 | } | ||
| 451 | |||
| 452 | static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if, | ||
| 453 | struct pucan_msg *rx_msg) | ||
| 454 | { | ||
| 455 | struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg; | ||
| 456 | struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)]; | ||
| 457 | struct net_device *netdev = dev->netdev; | ||
| 458 | struct canfd_frame *cfd; | ||
| 459 | struct sk_buff *skb; | ||
| 460 | const u16 rx_msg_flags = le16_to_cpu(rm->flags); | ||
| 461 | |||
| 462 | if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) { | ||
| 463 | /* CANFD frame case */ | ||
| 464 | skb = alloc_canfd_skb(netdev, &cfd); | ||
| 465 | if (!skb) | ||
| 466 | return -ENOMEM; | ||
| 467 | |||
| 468 | if (rx_msg_flags & PUCAN_MSG_BITRATE_SWITCH) | ||
| 469 | cfd->flags |= CANFD_BRS; | ||
| 470 | |||
| 471 | if (rx_msg_flags & PUCAN_MSG_ERROR_STATE_IND) | ||
| 472 | cfd->flags |= CANFD_ESI; | ||
| 473 | |||
| 474 | cfd->len = can_dlc2len(get_canfd_dlc(pucan_msg_get_dlc(rm))); | ||
| 475 | } else { | ||
| 476 | /* CAN 2.0 frame case */ | ||
| 477 | skb = alloc_can_skb(netdev, (struct can_frame **)&cfd); | ||
| 478 | if (!skb) | ||
| 479 | return -ENOMEM; | ||
| 480 | |||
| 481 | cfd->len = get_can_dlc(pucan_msg_get_dlc(rm)); | ||
| 482 | } | ||
| 483 | |||
| 484 | cfd->can_id = le32_to_cpu(rm->can_id); | ||
| 485 | |||
| 486 | if (rx_msg_flags & PUCAN_MSG_EXT_ID) | ||
| 487 | cfd->can_id |= CAN_EFF_FLAG; | ||
| 488 | |||
| 489 | if (rx_msg_flags & PUCAN_MSG_RTR) | ||
| 490 | cfd->can_id |= CAN_RTR_FLAG; | ||
| 491 | else | ||
| 492 | memcpy(cfd->data, rm->d, cfd->len); | ||
| 493 | |||
| 494 | peak_usb_netif_rx(skb, &usb_if->time_ref, | ||
| 495 | le32_to_cpu(rm->ts_low), le32_to_cpu(rm->ts_high)); | ||
| 496 | |||
| 497 | netdev->stats.rx_packets++; | ||
| 498 | netdev->stats.rx_bytes += cfd->len; | ||
| 499 | |||
| 500 | return 0; | ||
| 501 | } | ||
| 502 | |||
| 503 | /* handle uCAN status message */ | ||
| 504 | static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if, | ||
| 505 | struct pucan_msg *rx_msg) | ||
| 506 | { | ||
| 507 | struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg; | ||
| 508 | struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)]; | ||
| 509 | struct pcan_usb_fd_device *pdev = | ||
| 510 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 511 | enum can_state new_state = CAN_STATE_ERROR_ACTIVE; | ||
| 512 | enum can_state rx_state, tx_state; | ||
| 513 | struct net_device *netdev = dev->netdev; | ||
| 514 | struct can_frame *cf; | ||
| 515 | struct sk_buff *skb; | ||
| 516 | |||
| 517 | /* nothing should be sent while in BUS_OFF state */ | ||
| 518 | if (dev->can.state == CAN_STATE_BUS_OFF) | ||
| 519 | return 0; | ||
| 520 | |||
| 521 | if (sm->channel_p_w_b & PUCAN_BUS_BUSOFF) { | ||
| 522 | new_state = CAN_STATE_BUS_OFF; | ||
| 523 | } else if (sm->channel_p_w_b & PUCAN_BUS_PASSIVE) { | ||
| 524 | new_state = CAN_STATE_ERROR_PASSIVE; | ||
| 525 | } else if (sm->channel_p_w_b & PUCAN_BUS_WARNING) { | ||
| 526 | new_state = CAN_STATE_ERROR_WARNING; | ||
| 527 | } else { | ||
| 528 | /* no error bit (so, no error skb, back to active state) */ | ||
| 529 | dev->can.state = CAN_STATE_ERROR_ACTIVE; | ||
| 530 | pdev->bec.txerr = 0; | ||
| 531 | pdev->bec.rxerr = 0; | ||
| 532 | return 0; | ||
| 533 | } | ||
| 534 | |||
| 535 | /* state hasn't changed */ | ||
| 536 | if (new_state == dev->can.state) | ||
| 537 | return 0; | ||
| 538 | |||
| 539 | /* handle bus state change */ | ||
| 540 | tx_state = (pdev->bec.txerr >= pdev->bec.rxerr) ? new_state : 0; | ||
| 541 | rx_state = (pdev->bec.txerr <= pdev->bec.rxerr) ? new_state : 0; | ||
| 542 | |||
| 543 | /* allocate an skb to store the error frame */ | ||
| 544 | skb = alloc_can_err_skb(netdev, &cf); | ||
| 545 | if (skb) | ||
| 546 | can_change_state(netdev, cf, tx_state, rx_state); | ||
| 547 | |||
| 548 | /* things must be done even in case of OOM */ | ||
| 549 | if (new_state == CAN_STATE_BUS_OFF) | ||
| 550 | can_bus_off(netdev); | ||
| 551 | |||
| 552 | if (!skb) | ||
| 553 | return -ENOMEM; | ||
| 554 | |||
| 555 | peak_usb_netif_rx(skb, &usb_if->time_ref, | ||
| 556 | le32_to_cpu(sm->ts_low), le32_to_cpu(sm->ts_high)); | ||
| 557 | |||
| 558 | netdev->stats.rx_packets++; | ||
| 559 | netdev->stats.rx_bytes += cf->can_dlc; | ||
| 560 | |||
| 561 | return 0; | ||
| 562 | } | ||
| 563 | |||
| 564 | /* handle uCAN error message */ | ||
| 565 | static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if, | ||
| 566 | struct pucan_msg *rx_msg) | ||
| 567 | { | ||
| 568 | struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg; | ||
| 569 | struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)]; | ||
| 570 | struct pcan_usb_fd_device *pdev = | ||
| 571 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 572 | |||
| 573 | /* keep a trace of tx and rx error counters for later use */ | ||
| 574 | pdev->bec.txerr = er->tx_err_cnt; | ||
| 575 | pdev->bec.rxerr = er->rx_err_cnt; | ||
| 576 | |||
| 577 | return 0; | ||
| 578 | } | ||
| 579 | |||
| 580 | /* handle uCAN overrun message */ | ||
| 581 | static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if, | ||
| 582 | struct pucan_msg *rx_msg) | ||
| 583 | { | ||
| 584 | struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg; | ||
| 585 | struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)]; | ||
| 586 | struct net_device *netdev = dev->netdev; | ||
| 587 | struct can_frame *cf; | ||
| 588 | struct sk_buff *skb; | ||
| 589 | |||
| 590 | /* allocate an skb to store the error frame */ | ||
| 591 | skb = alloc_can_err_skb(netdev, &cf); | ||
| 592 | if (!skb) | ||
| 593 | return -ENOMEM; | ||
| 594 | |||
| 595 | cf->can_id |= CAN_ERR_CRTL; | ||
| 596 | cf->data[1] |= CAN_ERR_CRTL_RX_OVERFLOW; | ||
| 597 | |||
| 598 | peak_usb_netif_rx(skb, &usb_if->time_ref, | ||
| 599 | le32_to_cpu(ov->ts_low), le32_to_cpu(ov->ts_high)); | ||
| 600 | |||
| 601 | netdev->stats.rx_over_errors++; | ||
| 602 | netdev->stats.rx_errors++; | ||
| 603 | |||
| 604 | return 0; | ||
| 605 | } | ||
| 606 | |||
| 607 | /* handle USB calibration message */ | ||
| 608 | static void pcan_usb_fd_decode_ts(struct pcan_usb_fd_if *usb_if, | ||
| 609 | struct pucan_msg *rx_msg) | ||
| 610 | { | ||
| 611 | struct pcan_ufd_ts_msg *ts = (struct pcan_ufd_ts_msg *)rx_msg; | ||
| 612 | |||
| 613 | /* should wait until clock is stabilized */ | ||
| 614 | if (usb_if->cm_ignore_count > 0) | ||
| 615 | usb_if->cm_ignore_count--; | ||
| 616 | else | ||
| 617 | peak_usb_set_ts_now(&usb_if->time_ref, le32_to_cpu(ts->ts_low)); | ||
| 618 | } | ||
| 619 | |||
| 620 | /* callback for bulk IN urb */ | ||
| 621 | static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb) | ||
| 622 | { | ||
| 623 | struct pcan_usb_fd_if *usb_if = pcan_usb_fd_dev_if(dev); | ||
| 624 | struct net_device *netdev = dev->netdev; | ||
| 625 | struct pucan_msg *rx_msg; | ||
| 626 | u8 *msg_ptr, *msg_end; | ||
| 627 | int err = 0; | ||
| 628 | |||
| 629 | /* loop reading all the records from the incoming message */ | ||
| 630 | msg_ptr = urb->transfer_buffer; | ||
| 631 | msg_end = urb->transfer_buffer + urb->actual_length; | ||
| 632 | for (; msg_ptr < msg_end;) { | ||
| 633 | u16 rx_msg_type, rx_msg_size; | ||
| 634 | |||
| 635 | rx_msg = (struct pucan_msg *)msg_ptr; | ||
| 636 | if (!rx_msg->size) { | ||
| 637 | /* null packet found: end of list */ | ||
| 638 | break; | ||
| 639 | } | ||
| 640 | |||
| 641 | rx_msg_size = le16_to_cpu(rx_msg->size); | ||
| 642 | rx_msg_type = le16_to_cpu(rx_msg->type); | ||
| 643 | |||
| 644 | /* check if the record goes out of current packet */ | ||
| 645 | if (msg_ptr + rx_msg_size > msg_end) { | ||
| 646 | netdev_err(netdev, | ||
| 647 | "got frag rec: should inc usb rx buf sze\n"); | ||
| 648 | err = -EBADMSG; | ||
| 649 | break; | ||
| 650 | } | ||
| 651 | |||
| 652 | switch (rx_msg_type) { | ||
| 653 | case PUCAN_MSG_CAN_RX: | ||
| 654 | err = pcan_usb_fd_decode_canmsg(usb_if, rx_msg); | ||
| 655 | if (err < 0) | ||
| 656 | goto fail; | ||
| 657 | break; | ||
| 658 | |||
| 659 | case PCAN_UFD_MSG_CALIBRATION: | ||
| 660 | pcan_usb_fd_decode_ts(usb_if, rx_msg); | ||
| 661 | break; | ||
| 662 | |||
| 663 | case PUCAN_MSG_ERROR: | ||
| 664 | err = pcan_usb_fd_decode_error(usb_if, rx_msg); | ||
| 665 | if (err < 0) | ||
| 666 | goto fail; | ||
| 667 | break; | ||
| 668 | |||
| 669 | case PUCAN_MSG_STATUS: | ||
| 670 | err = pcan_usb_fd_decode_status(usb_if, rx_msg); | ||
| 671 | if (err < 0) | ||
| 672 | goto fail; | ||
| 673 | break; | ||
| 674 | |||
| 675 | case PCAN_UFD_MSG_OVERRUN: | ||
| 676 | err = pcan_usb_fd_decode_overrun(usb_if, rx_msg); | ||
| 677 | if (err < 0) | ||
| 678 | goto fail; | ||
| 679 | break; | ||
| 680 | |||
| 681 | default: | ||
| 682 | netdev_err(netdev, | ||
| 683 | "unhandled msg type 0x%02x (%d): ignored\n", | ||
| 684 | rx_msg_type, rx_msg_type); | ||
| 685 | break; | ||
| 686 | } | ||
| 687 | |||
| 688 | msg_ptr += rx_msg_size; | ||
| 689 | } | ||
| 690 | |||
| 691 | fail: | ||
| 692 | if (err) | ||
| 693 | pcan_dump_mem("received msg", | ||
| 694 | urb->transfer_buffer, urb->actual_length); | ||
| 695 | return err; | ||
| 696 | } | ||
| 697 | |||
| 698 | /* CAN/CANFD frames encoding callback */ | ||
| 699 | static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev, | ||
| 700 | struct sk_buff *skb, u8 *obuf, size_t *size) | ||
| 701 | { | ||
| 702 | struct pucan_tx_msg *tx_msg = (struct pucan_tx_msg *)obuf; | ||
| 703 | struct canfd_frame *cfd = (struct canfd_frame *)skb->data; | ||
| 704 | u16 tx_msg_size, tx_msg_flags; | ||
| 705 | u8 can_dlc; | ||
| 706 | |||
| 707 | tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4); | ||
| 708 | tx_msg->size = cpu_to_le16(tx_msg_size); | ||
| 709 | tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX); | ||
| 710 | |||
| 711 | tx_msg_flags = 0; | ||
| 712 | if (cfd->can_id & CAN_EFF_FLAG) { | ||
| 713 | tx_msg_flags |= PUCAN_MSG_EXT_ID; | ||
| 714 | tx_msg->can_id = cpu_to_le32(cfd->can_id & CAN_EFF_MASK); | ||
| 715 | } else { | ||
| 716 | tx_msg->can_id = cpu_to_le32(cfd->can_id & CAN_SFF_MASK); | ||
| 717 | } | ||
| 718 | |||
| 719 | if (can_is_canfd_skb(skb)) { | ||
| 720 | /* considering a CANFD frame */ | ||
| 721 | can_dlc = can_len2dlc(cfd->len); | ||
| 722 | |||
| 723 | tx_msg_flags |= PUCAN_MSG_EXT_DATA_LEN; | ||
| 724 | |||
| 725 | if (cfd->flags & CANFD_BRS) | ||
| 726 | tx_msg_flags |= PUCAN_MSG_BITRATE_SWITCH; | ||
| 727 | |||
| 728 | if (cfd->flags & CANFD_ESI) | ||
| 729 | tx_msg_flags |= PUCAN_MSG_ERROR_STATE_IND; | ||
| 730 | } else { | ||
| 731 | /* CAND 2.0 frames */ | ||
| 732 | can_dlc = cfd->len; | ||
| 733 | |||
| 734 | if (cfd->can_id & CAN_RTR_FLAG) | ||
| 735 | tx_msg_flags |= PUCAN_MSG_RTR; | ||
| 736 | } | ||
| 737 | |||
| 738 | tx_msg->flags = cpu_to_le16(tx_msg_flags); | ||
| 739 | tx_msg->channel_dlc = PUCAN_MSG_CHANNEL_DLC(dev->ctrl_idx, can_dlc); | ||
| 740 | memcpy(tx_msg->d, cfd->data, cfd->len); | ||
| 741 | |||
| 742 | /* add null size message to tag the end (messages are 32-bits aligned) | ||
| 743 | */ | ||
| 744 | tx_msg = (struct pucan_tx_msg *)(obuf + tx_msg_size); | ||
| 745 | |||
| 746 | tx_msg->size = 0; | ||
| 747 | |||
| 748 | /* set the whole size of the USB packet to send */ | ||
| 749 | *size = tx_msg_size + sizeof(u32); | ||
| 750 | |||
| 751 | return 0; | ||
| 752 | } | ||
| 753 | |||
| 754 | /* start the interface (last chance before set bus on) */ | ||
| 755 | static int pcan_usb_fd_start(struct peak_usb_device *dev) | ||
| 756 | { | ||
| 757 | struct pcan_usb_fd_device *pdev = | ||
| 758 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 759 | int err; | ||
| 760 | |||
| 761 | /* set filter mode: all acceptance */ | ||
| 762 | err = pcan_usb_fd_set_filter_std(dev, -1, 0xffffffff); | ||
| 763 | if (err) | ||
| 764 | return err; | ||
| 765 | |||
| 766 | /* opening first device: */ | ||
| 767 | if (pdev->usb_if->dev_opened_count == 0) { | ||
| 768 | /* reset time_ref */ | ||
| 769 | peak_usb_init_time_ref(&pdev->usb_if->time_ref, | ||
| 770 | &pcan_usb_pro_fd); | ||
| 771 | |||
| 772 | /* enable USB calibration messages */ | ||
| 773 | err = pcan_usb_fd_set_filter_ext(dev, 1, | ||
| 774 | PUCAN_FLTEXT_ERROR, | ||
| 775 | PCAN_UFD_FLTEXT_CALIBRATION); | ||
| 776 | } | ||
| 777 | |||
| 778 | pdev->usb_if->dev_opened_count++; | ||
| 779 | |||
| 780 | /* reset cached error counters */ | ||
| 781 | pdev->bec.txerr = 0; | ||
| 782 | pdev->bec.rxerr = 0; | ||
| 783 | |||
| 784 | return err; | ||
| 785 | } | ||
| 786 | |||
| 787 | /* socket callback used to copy berr counters values receieved through USB */ | ||
| 788 | static int pcan_usb_fd_get_berr_counter(const struct net_device *netdev, | ||
| 789 | struct can_berr_counter *bec) | ||
| 790 | { | ||
| 791 | struct peak_usb_device *dev = netdev_priv(netdev); | ||
| 792 | struct pcan_usb_fd_device *pdev = | ||
| 793 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 794 | |||
| 795 | *bec = pdev->bec; | ||
| 796 | |||
| 797 | /* must return 0 */ | ||
| 798 | return 0; | ||
| 799 | } | ||
| 800 | |||
| 801 | /* stop interface (last chance before set bus off) */ | ||
| 802 | static int pcan_usb_fd_stop(struct peak_usb_device *dev) | ||
| 803 | { | ||
| 804 | struct pcan_usb_fd_device *pdev = | ||
| 805 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 806 | |||
| 807 | /* turn off special msgs for that interface if no other dev opened */ | ||
| 808 | if (pdev->usb_if->dev_opened_count == 1) | ||
| 809 | pcan_usb_fd_set_filter_ext(dev, 0, | ||
| 810 | PUCAN_FLTEXT_ERROR, | ||
| 811 | PCAN_UFD_FLTEXT_CALIBRATION); | ||
| 812 | pdev->usb_if->dev_opened_count--; | ||
| 813 | |||
| 814 | return 0; | ||
| 815 | } | ||
| 816 | |||
| 817 | /* called when probing, to initialize a device object */ | ||
| 818 | static int pcan_usb_fd_init(struct peak_usb_device *dev) | ||
| 819 | { | ||
| 820 | struct pcan_usb_fd_device *pdev = | ||
| 821 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 822 | int i, err = -ENOMEM; | ||
| 823 | |||
| 824 | /* do this for 1st channel only */ | ||
| 825 | if (!dev->prev_siblings) { | ||
| 826 | /* allocate netdevices common structure attached to first one */ | ||
| 827 | pdev->usb_if = kzalloc(sizeof(*pdev->usb_if), GFP_KERNEL); | ||
| 828 | if (!pdev->usb_if) | ||
| 829 | goto err_out; | ||
| 830 | |||
| 831 | /* allocate command buffer once for all for the interface */ | ||
| 832 | pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE, | ||
| 833 | GFP_KERNEL); | ||
| 834 | if (!pdev->cmd_buffer_addr) | ||
| 835 | goto err_out_1; | ||
| 836 | |||
| 837 | /* number of ts msgs to ignore before taking one into account */ | ||
| 838 | pdev->usb_if->cm_ignore_count = 5; | ||
| 839 | |||
| 840 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, | ||
| 841 | PCAN_USBPRO_INFO_FW, | ||
| 842 | &pdev->usb_if->fw_info, | ||
| 843 | sizeof(pdev->usb_if->fw_info)); | ||
| 844 | if (err) { | ||
| 845 | dev_err(dev->netdev->dev.parent, | ||
| 846 | "unable to read %s firmware info (err %d)\n", | ||
| 847 | dev->adapter->name, err); | ||
| 848 | goto err_out_2; | ||
| 849 | } | ||
| 850 | |||
| 851 | /* explicit use of dev_xxx() instead of netdev_xxx() here: | ||
| 852 | * information displayed are related to the device itself, not | ||
| 853 | * to the canx (channel) device. | ||
| 854 | */ | ||
| 855 | dev_info(dev->netdev->dev.parent, | ||
| 856 | "PEAK-System %s v%u fw v%u.%u.%u (%u channels)\n", | ||
| 857 | dev->adapter->name, pdev->usb_if->fw_info.hw_version, | ||
| 858 | pdev->usb_if->fw_info.fw_version[0], | ||
| 859 | pdev->usb_if->fw_info.fw_version[1], | ||
| 860 | pdev->usb_if->fw_info.fw_version[2], | ||
| 861 | dev->adapter->ctrl_count); | ||
| 862 | |||
| 863 | /* the currently supported hw is non-ISO */ | ||
| 864 | dev->can.ctrlmode = CAN_CTRLMODE_FD_NON_ISO; | ||
| 865 | |||
| 866 | /* tell the hardware the can driver is running */ | ||
| 867 | err = pcan_usb_fd_drv_loaded(dev, 1); | ||
| 868 | if (err) { | ||
| 869 | dev_err(dev->netdev->dev.parent, | ||
| 870 | "unable to tell %s driver is loaded (err %d)\n", | ||
| 871 | dev->adapter->name, err); | ||
| 872 | goto err_out_2; | ||
| 873 | } | ||
| 874 | } else { | ||
| 875 | /* otherwise, simply copy previous sibling's values */ | ||
| 876 | struct pcan_usb_fd_device *ppdev = | ||
| 877 | container_of(dev->prev_siblings, | ||
| 878 | struct pcan_usb_fd_device, dev); | ||
| 879 | |||
| 880 | pdev->usb_if = ppdev->usb_if; | ||
| 881 | pdev->cmd_buffer_addr = ppdev->cmd_buffer_addr; | ||
| 882 | } | ||
| 883 | |||
| 884 | pdev->usb_if->dev[dev->ctrl_idx] = dev; | ||
| 885 | dev->device_number = | ||
| 886 | le32_to_cpu(pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]); | ||
| 887 | |||
| 888 | /* set clock domain */ | ||
| 889 | for (i = 0; i < ARRAY_SIZE(pcan_usb_fd_clk_freq); i++) | ||
| 890 | if (dev->adapter->clock.freq == pcan_usb_fd_clk_freq[i]) | ||
| 891 | break; | ||
| 892 | |||
| 893 | if (i >= ARRAY_SIZE(pcan_usb_fd_clk_freq)) { | ||
| 894 | dev_warn(dev->netdev->dev.parent, | ||
| 895 | "incompatible clock frequencies\n"); | ||
| 896 | err = -EINVAL; | ||
| 897 | goto err_out_2; | ||
| 898 | } | ||
| 899 | |||
| 900 | pcan_usb_fd_set_clock_domain(dev, i); | ||
| 901 | |||
| 902 | /* set LED in default state (end of init phase) */ | ||
| 903 | pcan_usb_fd_set_can_led(dev, PCAN_UFD_LED_DEF); | ||
| 904 | |||
| 905 | return 0; | ||
| 906 | |||
| 907 | err_out_2: | ||
| 908 | kfree(pdev->cmd_buffer_addr); | ||
| 909 | err_out_1: | ||
| 910 | kfree(pdev->usb_if); | ||
| 911 | err_out: | ||
| 912 | return err; | ||
| 913 | } | ||
| 914 | |||
| 915 | /* called when driver module is being unloaded */ | ||
| 916 | static void pcan_usb_fd_exit(struct peak_usb_device *dev) | ||
| 917 | { | ||
| 918 | struct pcan_usb_fd_device *pdev = | ||
| 919 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 920 | |||
| 921 | /* when rmmod called before unplug and if down, should reset things | ||
| 922 | * before leaving | ||
| 923 | */ | ||
| 924 | if (dev->can.state != CAN_STATE_STOPPED) { | ||
| 925 | /* set bus off on the corresponding channel */ | ||
| 926 | pcan_usb_fd_set_bus(dev, 0); | ||
| 927 | } | ||
| 928 | |||
| 929 | /* switch off corresponding CAN LEDs */ | ||
| 930 | pcan_usb_fd_set_can_led(dev, PCAN_UFD_LED_OFF); | ||
| 931 | |||
| 932 | /* if channel #0 (only) */ | ||
| 933 | if (dev->ctrl_idx == 0) { | ||
| 934 | /* turn off calibration message if any device were opened */ | ||
| 935 | if (pdev->usb_if->dev_opened_count > 0) | ||
| 936 | pcan_usb_fd_set_filter_ext(dev, 0, | ||
| 937 | PUCAN_FLTEXT_ERROR, | ||
| 938 | PCAN_UFD_FLTEXT_CALIBRATION); | ||
| 939 | |||
| 940 | /* tell USB adapter that the driver is being unloaded */ | ||
| 941 | pcan_usb_fd_drv_loaded(dev, 0); | ||
| 942 | } | ||
| 943 | } | ||
| 944 | |||
| 945 | /* called when the USB adapter is unplugged */ | ||
| 946 | static void pcan_usb_fd_free(struct peak_usb_device *dev) | ||
| 947 | { | ||
| 948 | /* last device: can free shared objects now */ | ||
| 949 | if (!dev->prev_siblings && !dev->next_siblings) { | ||
| 950 | struct pcan_usb_fd_device *pdev = | ||
| 951 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 952 | |||
| 953 | /* free commands buffer */ | ||
| 954 | kfree(pdev->cmd_buffer_addr); | ||
| 955 | |||
| 956 | /* free usb interface object */ | ||
| 957 | kfree(pdev->usb_if); | ||
| 958 | } | ||
| 959 | } | ||
| 960 | |||
| 961 | /* describes the PCAN-USB FD adapter */ | ||
| 962 | const struct peak_usb_adapter pcan_usb_fd = { | ||
| 963 | .name = "PCAN-USB FD", | ||
| 964 | .device_id = PCAN_USBFD_PRODUCT_ID, | ||
| 965 | .ctrl_count = PCAN_USBFD_CHANNEL_COUNT, | ||
| 966 | .ctrlmode_supported = CAN_CTRLMODE_FD | | ||
| 967 | CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY, | ||
| 968 | .clock = { | ||
| 969 | .freq = PCAN_UFD_CRYSTAL_HZ, | ||
| 970 | }, | ||
| 971 | .bittiming_const = { | ||
| 972 | .name = "pcan_usb_fd", | ||
| 973 | .tseg1_min = 1, | ||
| 974 | .tseg1_max = 64, | ||
| 975 | .tseg2_min = 1, | ||
| 976 | .tseg2_max = 16, | ||
| 977 | .sjw_max = 16, | ||
| 978 | .brp_min = 1, | ||
| 979 | .brp_max = 1024, | ||
| 980 | .brp_inc = 1, | ||
| 981 | }, | ||
| 982 | .data_bittiming_const = { | ||
| 983 | .name = "pcan_usb_fd", | ||
| 984 | .tseg1_min = 1, | ||
| 985 | .tseg1_max = 16, | ||
| 986 | .tseg2_min = 1, | ||
| 987 | .tseg2_max = 8, | ||
| 988 | .sjw_max = 4, | ||
| 989 | .brp_min = 1, | ||
| 990 | .brp_max = 1024, | ||
| 991 | .brp_inc = 1, | ||
| 992 | }, | ||
| 993 | |||
| 994 | /* size of device private data */ | ||
| 995 | .sizeof_dev_private = sizeof(struct pcan_usb_fd_device), | ||
| 996 | |||
| 997 | /* timestamps usage */ | ||
| 998 | .ts_used_bits = 32, | ||
| 999 | .ts_period = 1000000, /* calibration period in ts. */ | ||
| 1000 | .us_per_ts_scale = 1, /* us = (ts * scale) >> shift */ | ||
| 1001 | .us_per_ts_shift = 0, | ||
| 1002 | |||
| 1003 | /* give here messages in/out endpoints */ | ||
| 1004 | .ep_msg_in = PCAN_USBPRO_EP_MSGIN, | ||
| 1005 | .ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0}, | ||
| 1006 | |||
| 1007 | /* size of rx/tx usb buffers */ | ||
| 1008 | .rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE, | ||
| 1009 | .tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE, | ||
| 1010 | |||
| 1011 | /* device callbacks */ | ||
| 1012 | .intf_probe = pcan_usb_pro_probe, /* same as PCAN-USB Pro */ | ||
| 1013 | .dev_init = pcan_usb_fd_init, | ||
| 1014 | |||
| 1015 | .dev_exit = pcan_usb_fd_exit, | ||
| 1016 | .dev_free = pcan_usb_fd_free, | ||
| 1017 | .dev_set_bus = pcan_usb_fd_set_bus, | ||
| 1018 | .dev_set_bittiming = pcan_usb_fd_set_bittiming_slow, | ||
| 1019 | .dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast, | ||
| 1020 | .dev_decode_buf = pcan_usb_fd_decode_buf, | ||
| 1021 | .dev_start = pcan_usb_fd_start, | ||
| 1022 | .dev_stop = pcan_usb_fd_stop, | ||
| 1023 | .dev_restart_async = pcan_usb_fd_restart_async, | ||
| 1024 | .dev_encode_msg = pcan_usb_fd_encode_msg, | ||
| 1025 | |||
| 1026 | .do_get_berr_counter = pcan_usb_fd_get_berr_counter, | ||
| 1027 | }; | ||
| 1028 | |||
| 1029 | /* describes the PCAN-USB Pro FD adapter */ | ||
| 1030 | const struct peak_usb_adapter pcan_usb_pro_fd = { | ||
| 1031 | .name = "PCAN-USB Pro FD", | ||
| 1032 | .device_id = PCAN_USBPROFD_PRODUCT_ID, | ||
| 1033 | .ctrl_count = PCAN_USBPROFD_CHANNEL_COUNT, | ||
| 1034 | .ctrlmode_supported = CAN_CTRLMODE_FD | | ||
| 1035 | CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY, | ||
| 1036 | .clock = { | ||
| 1037 | .freq = PCAN_UFD_CRYSTAL_HZ, | ||
| 1038 | }, | ||
| 1039 | .bittiming_const = { | ||
| 1040 | .name = "pcan_usb_pro_fd", | ||
| 1041 | .tseg1_min = 1, | ||
| 1042 | .tseg1_max = 64, | ||
| 1043 | .tseg2_min = 1, | ||
| 1044 | .tseg2_max = 16, | ||
| 1045 | .sjw_max = 16, | ||
| 1046 | .brp_min = 1, | ||
| 1047 | .brp_max = 1024, | ||
| 1048 | .brp_inc = 1, | ||
| 1049 | }, | ||
| 1050 | .data_bittiming_const = { | ||
| 1051 | .name = "pcan_usb_pro_fd", | ||
| 1052 | .tseg1_min = 1, | ||
| 1053 | .tseg1_max = 16, | ||
| 1054 | .tseg2_min = 1, | ||
| 1055 | .tseg2_max = 8, | ||
| 1056 | .sjw_max = 4, | ||
| 1057 | .brp_min = 1, | ||
| 1058 | .brp_max = 1024, | ||
| 1059 | .brp_inc = 1, | ||
| 1060 | }, | ||
| 1061 | |||
| 1062 | /* size of device private data */ | ||
| 1063 | .sizeof_dev_private = sizeof(struct pcan_usb_fd_device), | ||
| 1064 | |||
| 1065 | /* timestamps usage */ | ||
| 1066 | .ts_used_bits = 32, | ||
| 1067 | .ts_period = 1000000, /* calibration period in ts. */ | ||
| 1068 | .us_per_ts_scale = 1, /* us = (ts * scale) >> shift */ | ||
| 1069 | .us_per_ts_shift = 0, | ||
| 1070 | |||
| 1071 | /* give here messages in/out endpoints */ | ||
| 1072 | .ep_msg_in = PCAN_USBPRO_EP_MSGIN, | ||
| 1073 | .ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0, PCAN_USBPRO_EP_MSGOUT_1}, | ||
| 1074 | |||
| 1075 | /* size of rx/tx usb buffers */ | ||
| 1076 | .rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE, | ||
| 1077 | .tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE, | ||
| 1078 | |||
| 1079 | /* device callbacks */ | ||
| 1080 | .intf_probe = pcan_usb_pro_probe, /* same as PCAN-USB Pro */ | ||
| 1081 | .dev_init = pcan_usb_fd_init, | ||
| 1082 | |||
| 1083 | .dev_exit = pcan_usb_fd_exit, | ||
| 1084 | .dev_free = pcan_usb_fd_free, | ||
| 1085 | .dev_set_bus = pcan_usb_fd_set_bus, | ||
| 1086 | .dev_set_bittiming = pcan_usb_fd_set_bittiming_slow, | ||
| 1087 | .dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast, | ||
| 1088 | .dev_decode_buf = pcan_usb_fd_decode_buf, | ||
| 1089 | .dev_start = pcan_usb_fd_start, | ||
| 1090 | .dev_stop = pcan_usb_fd_stop, | ||
| 1091 | .dev_restart_async = pcan_usb_fd_restart_async, | ||
| 1092 | .dev_encode_msg = pcan_usb_fd_encode_msg, | ||
| 1093 | |||
| 1094 | .do_get_berr_counter = pcan_usb_fd_get_berr_counter, | ||
| 1095 | }; | ||
| @@ -27,14 +27,6 @@ · 26 unmodified lines | |||
| 27 | 27 | ||
| 28 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter"); | 28 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter"); |
| 29 | 29 | ||
| 30 | /* PCAN-USB Pro Endpoints */ | ||
| 31 | #define PCAN_USBPRO_EP_CMDOUT 1 | ||
| 32 | #define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN) | ||
| 33 | #define PCAN_USBPRO_EP_MSGOUT_0 2 | ||
| 34 | #define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN) | ||
| 35 | #define PCAN_USBPRO_EP_MSGOUT_1 3 | ||
| 36 | #define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN) | ||
| 37 | |||
| 38 | #define PCAN_USBPRO_CHANNEL_COUNT 2 | 30 | #define PCAN_USBPRO_CHANNEL_COUNT 2 |
| 39 | 31 | ||
| 40 | /* PCAN-USB Pro adapter internal clock (MHz) */ | 32 | /* PCAN-USB Pro adapter internal clock (MHz) */ |
| @@ -322,8 +314,8 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev, · 281 unmodified lines | |||
| 322 | return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err; | 314 | return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err; |
| 323 | } | 315 | } |
| 324 | 316 | ||
| 325 | static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, | 317 | int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, |
| 326 | int req_value, void *req_addr, int req_size) | 318 | int req_value, void *req_addr, int req_size) |
| 327 | { | 319 | { |
| 328 | int err; | 320 | int err; |
| 329 | u8 req_type; | 321 | u8 req_type; |
| @@ -475,7 +467,7 @@ static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev, · 145 unmodified lines | |||
| 475 | return pcan_usb_pro_set_bitrate(dev, ccbt); | 467 | return pcan_usb_pro_set_bitrate(dev, ccbt); |
| 476 | } | 468 | } |
| 477 | 469 | ||
| 478 | static void pcan_usb_pro_restart_complete(struct urb *urb) | 470 | void pcan_usb_pro_restart_complete(struct urb *urb) |
| 479 | { | 471 | { |
| 480 | /* can delete usb resources */ | 472 | /* can delete usb resources */ |
| 481 | peak_usb_async_complete(urb); | 473 | peak_usb_async_complete(urb); |
| @@ -634,6 +626,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, · 152 unmodified lines | |||
| 634 | switch (new_state) { | 626 | switch (new_state) { |
| 635 | case CAN_STATE_BUS_OFF: | 627 | case CAN_STATE_BUS_OFF: |
| 636 | can_frame->can_id |= CAN_ERR_BUSOFF; | 628 | can_frame->can_id |= CAN_ERR_BUSOFF; |
| 629 | dev->can.can_stats.bus_off++; | ||
| 637 | can_bus_off(netdev); | 630 | can_bus_off(netdev); |
| 638 | break; | 631 | break; |
| 639 | 632 | ||
| @@ -977,7 +970,7 @@ static void pcan_usb_pro_free(struct peak_usb_device *dev) · 337 unmodified lines | |||
| 977 | /* | 970 | /* |
| 978 | * probe function for new PCAN-USB Pro usb interface | 971 | * probe function for new PCAN-USB Pro usb interface |
| 979 | */ | 972 | */ |
| 980 | static int pcan_usb_pro_probe(struct usb_interface *intf) | 973 | int pcan_usb_pro_probe(struct usb_interface *intf) |
| 981 | { | 974 | { |
| 982 | struct usb_host_interface *if_desc; | 975 | struct usb_host_interface *if_desc; |
| 983 | int i; | 976 | int i; |
| @@ -1011,10 +1004,11 @@ static int pcan_usb_pro_probe(struct usb_interface *intf) · 27 unmodified lines | |||
| 1011 | /* | 1004 | /* |
| 1012 | * describe the PCAN-USB Pro adapter | 1005 | * describe the PCAN-USB Pro adapter |
| 1013 | */ | 1006 | */ |
| 1014 | struct peak_usb_adapter pcan_usb_pro = { | 1007 | const struct peak_usb_adapter pcan_usb_pro = { |
| 1015 | .name = "PCAN-USB Pro", | 1008 | .name = "PCAN-USB Pro", |
| 1016 | .device_id = PCAN_USBPRO_PRODUCT_ID, | 1009 | .device_id = PCAN_USBPRO_PRODUCT_ID, |
| 1017 | .ctrl_count = PCAN_USBPRO_CHANNEL_COUNT, | 1010 | .ctrl_count = PCAN_USBPRO_CHANNEL_COUNT, |
| 1011 | .ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY, | ||
| 1018 | .clock = { | 1012 | .clock = { |
| 1019 | .freq = PCAN_USBPRO_CRYSTAL_HZ, | 1013 | .freq = PCAN_USBPRO_CRYSTAL_HZ, |
| 1020 | }, | 1014 | }, |
| @@ -27,6 +27,14 @@ · 26 unmodified lines | |||
| 27 | #define PCAN_USBPRO_INFO_BL 0 | 27 | #define PCAN_USBPRO_INFO_BL 0 |
| 28 | #define PCAN_USBPRO_INFO_FW 1 | 28 | #define PCAN_USBPRO_INFO_FW 1 |
| 29 | 29 | ||
| 30 | /* PCAN-USB Pro (FD) Endpoints */ | ||
| 31 | #define PCAN_USBPRO_EP_CMDOUT 1 | ||
| 32 | #define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN) | ||
| 33 | #define PCAN_USBPRO_EP_MSGOUT_0 2 | ||
| 34 | #define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN) | ||
| 35 | #define PCAN_USBPRO_EP_MSGOUT_1 3 | ||
| 36 | #define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN) | ||
| 37 | |||
| 30 | /* Vendor Request value for XXX_FCT */ | 38 | /* Vendor Request value for XXX_FCT */ |
| 31 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ | 39 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ |
| 32 | #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 | 40 | #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 |
| @@ -176,4 +184,9 @@ union pcan_usb_pro_rec { · 143 unmodified lines | |||
| 176 | struct pcan_usb_pro_txmsg tx_msg; | 184 | struct pcan_usb_pro_txmsg tx_msg; |
| 177 | }; | 185 | }; |
| 178 | 186 | ||
| 187 | int pcan_usb_pro_probe(struct usb_interface *intf); | ||
| 188 | int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, | ||
| 189 | int req_value, void *req_addr, int req_size); | ||
| 190 | void pcan_usb_pro_restart_complete(struct urb *urb); | ||
| 191 | |||
| 179 | #endif | 192 | #endif |
| @@ -377,6 +377,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, · 376 unmodified lines | |||
| 377 | case USB_8DEV_STATUSMSG_BUSOFF: | 377 | case USB_8DEV_STATUSMSG_BUSOFF: |
| 378 | priv->can.state = CAN_STATE_BUS_OFF; | 378 | priv->can.state = CAN_STATE_BUS_OFF; |
| 379 | cf->can_id |= CAN_ERR_BUSOFF; | 379 | cf->can_id |= CAN_ERR_BUSOFF; |
| 380 | priv->can.can_stats.bus_off++; | ||
| 380 | can_bus_off(priv->netdev); | 381 | can_bus_off(priv->netdev); |
| 381 | break; | 382 | break; |
| 382 | case USB_8DEV_STATUSMSG_OVERRUN: | 383 | case USB_8DEV_STATUSMSG_OVERRUN: |
| @@ -233,6 +233,35 @@ static void bcm_sf2_eee_enable_set(struct dsa_switch *ds, int port, bool enable) · 232 unmodified lines | |||
| 233 | core_writel(priv, reg, CORE_EEE_EN_CTRL); | 233 | core_writel(priv, reg, CORE_EEE_EN_CTRL); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable) | ||
| 237 | { | ||
| 238 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | ||
| 239 | u32 reg; | ||
| 240 | |||
| 241 | reg = reg_readl(priv, REG_SPHY_CNTRL); | ||
| 242 | if (enable) { | ||
| 243 | reg |= PHY_RESET; | ||
| 244 | reg &= ~(EXT_PWR_DOWN | IDDQ_BIAS | CK25_DIS); | ||
| 245 | reg_writel(priv, reg, REG_SPHY_CNTRL); | ||
| 246 | udelay(21); | ||
| 247 | reg = reg_readl(priv, REG_SPHY_CNTRL); | ||
| 248 | reg &= ~PHY_RESET; | ||
| 249 | } else { | ||
| 250 | reg |= EXT_PWR_DOWN | IDDQ_BIAS | PHY_RESET; | ||
| 251 | reg_writel(priv, reg, REG_SPHY_CNTRL); | ||
| 252 | mdelay(1); | ||
| 253 | reg |= CK25_DIS; | ||
| 254 | } | ||
| 255 | reg_writel(priv, reg, REG_SPHY_CNTRL); | ||
| 256 | |||
| 257 | /* Use PHY-driven LED signaling */ | ||
| 258 | if (!enable) { | ||
| 259 | reg = reg_readl(priv, REG_LED_CNTRL(0)); | ||
| 260 | reg |= SPDLNK_SRC_SEL; | ||
| 261 | reg_writel(priv, reg, REG_LED_CNTRL(0)); | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 236 | static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, | 265 | static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, |
| 237 | struct phy_device *phy) | 266 | struct phy_device *phy) |
| 238 | { | 267 | { |
| @@ -248,6 +277,24 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, · 9 unmodified lines | |||
| 248 | /* Clear the Rx and Tx disable bits and set to no spanning tree */ | 277 | /* Clear the Rx and Tx disable bits and set to no spanning tree */ |
| 249 | core_writel(priv, 0, CORE_G_PCTL_PORT(port)); | 278 | core_writel(priv, 0, CORE_G_PCTL_PORT(port)); |
| 250 | 279 | ||
| 280 | /* Re-enable the GPHY and re-apply workarounds */ | ||
| 281 | if (port == 0 && priv->hw_params.num_gphy == 1) { | ||
| 282 | bcm_sf2_gphy_enable_set(ds, true); | ||
| 283 | if (phy) { | ||
| 284 | /* if phy_stop() has been called before, phy | ||
| 285 | * will be in halted state, and phy_start() | ||
| 286 | * will call resume. | ||
| 287 | * | ||
| 288 | * the resume path does not configure back | ||
| 289 | * autoneg settings, and since we hard reset | ||
| 290 | * the phy manually here, we need to reset the | ||
| 291 | * state machine also. | ||
| 292 | */ | ||
| 293 | phy->state = PHY_READY; | ||
| 294 | phy_init_hw(phy); | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 251 | /* Enable port 7 interrupts to get notified */ | 298 | /* Enable port 7 interrupts to get notified */ |
| 252 | if (port == 7) | 299 | if (port == 7) |
| 253 | intrl2_1_mask_clear(priv, P_IRQ_MASK(P7_IRQ_OFF)); | 300 | intrl2_1_mask_clear(priv, P_IRQ_MASK(P7_IRQ_OFF)); |
| @@ -281,6 +328,9 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, · 27 unmodified lines | |||
| 281 | intrl2_1_writel(priv, P_IRQ_MASK(P7_IRQ_OFF), INTRL2_CPU_CLEAR); | 328 | intrl2_1_writel(priv, P_IRQ_MASK(P7_IRQ_OFF), INTRL2_CPU_CLEAR); |
| 282 | } | 329 | } |
| 283 | 330 | ||
| 331 | if (port == 0 && priv->hw_params.num_gphy == 1) | ||
| 332 | bcm_sf2_gphy_enable_set(ds, false); | ||
| 333 | |||
| 284 | if (dsa_is_cpu_port(ds, port)) | 334 | if (dsa_is_cpu_port(ds, port)) |
| 285 | off = CORE_IMP_CTL; | 335 | off = CORE_IMP_CTL; |
| 286 | else | 336 | else |
| @@ -400,6 +450,16 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) · 113 unmodified lines | |||
| 400 | return 0; | 450 | return 0; |
| 401 | } | 451 | } |
| 402 | 452 | ||
| 453 | static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) | ||
| 454 | { | ||
| 455 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | ||
| 456 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | ||
| 457 | intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); | ||
| 458 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | ||
| 459 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | ||
| 460 | intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); | ||
| 461 | } | ||
| 462 | |||
| 403 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) | 463 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) |
| 404 | { | 464 | { |
| 405 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; | 465 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; |
| @@ -440,12 +500,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) · 34 unmodified lines | |||
| 440 | } | 500 | } |
| 441 | 501 | ||
| 442 | /* Disable all interrupts and request them */ | 502 | /* Disable all interrupts and request them */ |
| 443 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | 503 | bcm_sf2_intr_disable(priv); |
| 444 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | ||
| 445 | intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); | ||
| 446 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | ||
| 447 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | ||
| 448 | intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); | ||
| 449 | 504 | ||
| 450 | ret = request_irq(priv->irq0, bcm_sf2_switch_0_isr, 0, | 505 | ret = request_irq(priv->irq0, bcm_sf2_switch_0_isr, 0, |
| 451 | "switch_0", priv); | 506 | "switch_0", priv); |
| @@ -747,12 +802,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) · 295 unmodified lines | |||
| 747 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | 802 | struct bcm_sf2_priv *priv = ds_to_priv(ds); |
| 748 | unsigned int port; | 803 | unsigned int port; |
| 749 | 804 | ||
| 750 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | 805 | bcm_sf2_intr_disable(priv); |
| 751 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | ||
| 752 | intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); | ||
| 753 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | ||
| 754 | intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | ||
| 755 | intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); | ||
| 756 | 806 | ||
| 757 | /* Disable all ports physically present including the IMP | 807 | /* Disable all ports physically present including the IMP |
| 758 | * port, the other ones have already been disabled during | 808 | * port, the other ones have already been disabled during |
| @@ -771,7 +821,6 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) · 12 unmodified lines | |||
| 771 | { | 821 | { |
| 772 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | 822 | struct bcm_sf2_priv *priv = ds_to_priv(ds); |
| 773 | unsigned int port; | 823 | unsigned int port; |
| 774 | u32 reg; | ||
| 775 | int ret; | 824 | int ret; |
| 776 | 825 | ||
| 777 | ret = bcm_sf2_sw_rst(priv); | 826 | ret = bcm_sf2_sw_rst(priv); |
| @@ -780,17 +829,8 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) · 2 unmodified lines | |||
| 780 | return ret; | 829 | return ret; |
| 781 | } | 830 | } |
| 782 | 831 | ||
| 783 | /* Reinitialize the single GPHY */ | 832 | if (priv->hw_params.num_gphy == 1) |
| 784 | if (priv->hw_params.num_gphy == 1) { | 833 | bcm_sf2_gphy_enable_set(ds, true); |
| 785 | reg = reg_readl(priv, REG_SPHY_CNTRL); | ||
| 786 | reg |= PHY_RESET; | ||
| 787 | reg &= ~(EXT_PWR_DOWN | IDDQ_BIAS); | ||
| 788 | reg_writel(priv, reg, REG_SPHY_CNTRL); | ||
| 789 | udelay(21); | ||
| 790 | reg = reg_readl(priv, REG_SPHY_CNTRL); | ||
| 791 | reg &= ~PHY_RESET; | ||
| 792 | reg_writel(priv, reg, REG_SPHY_CNTRL); | ||
| 793 | } | ||
| 794 | 834 | ||
| 795 | for (port = 0; port < DSA_MAX_PORTS; port++) { | 835 | for (port = 0; port < DSA_MAX_PORTS; port++) { |
| 796 | if ((1 << port) & ds->phys_port_mask) | 836 | if ((1 << port) & ds->phys_port_mask) |
| @@ -61,6 +61,10 @@ · 60 unmodified lines | |||
| 61 | #define LPI_COUNT_SHIFT 9 | 61 | #define LPI_COUNT_SHIFT 9 |
| 62 | #define LPI_COUNT_MASK 0x3F | 62 | #define LPI_COUNT_MASK 0x3F |
| 63 | 63 | ||
| 64 | #define REG_LED_CNTRL_BASE 0x90 | ||
| 65 | #define REG_LED_CNTRL(x) (REG_LED_CNTRL_BASE + (x) * 4) | ||
| 66 | #define SPDLNK_SRC_SEL (1 << 24) | ||
| 67 | |||
| 64 | /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */ | 68 | /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */ |
| 65 | #define INTRL2_CPU_STATUS 0x00 | 69 | #define INTRL2_CPU_STATUS 0x00 |
| 66 | #define INTRL2_CPU_SET 0x04 | 70 | #define INTRL2_CPU_SET 0x04 |
| @@ -139,7 +139,8 @@ static int mv88e6131_setup_global(struct dsa_switch *ds) · 138 unmodified lines | |||
| 139 | int nexthop; | 139 | int nexthop; |
| 140 | 140 | ||
| 141 | nexthop = 0x1f; | 141 | nexthop = 0x1f; |
| 142 | if (i != ds->index && i < ds->dst->pd->nr_chips) | 142 | if (ds->pd->rtable && |
| 143 | i != ds->index && i < ds->dst->pd->nr_chips) | ||
| 143 | nexthop = ds->pd->rtable[i] & 0x1f; | 144 | nexthop = ds->pd->rtable[i] & 0x1f; |
| 144 | 145 | ||
| 145 | REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop); | 146 | REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop); |
| @@ -22,17 +22,14 @@ · 21 unmodified lines | |||
| 22 | #include <net/dsa.h> | 22 | #include <net/dsa.h> |
| 23 | #include "mv88e6xxx.h" | 23 | #include "mv88e6xxx.h" |
| 24 | 24 | ||
| 25 | static int mv88e6352_wait(struct dsa_switch *ds, int reg, u16 mask) | 25 | static int mv88e6352_wait(struct dsa_switch *ds, int reg, int offset, u16 mask) |
| 26 | { | 26 | { |
| 27 | unsigned long timeout = jiffies + HZ / 10; | 27 | unsigned long timeout = jiffies + HZ / 10; |
| 28 | 28 | ||
| 29 | while (time_before(jiffies, timeout)) { | 29 | while (time_before(jiffies, timeout)) { |
| 30 | int ret; | 30 | int ret; |
| 31 | 31 | ||
| 32 | ret = REG_READ(REG_GLOBAL2, reg); | 32 | ret = REG_READ(reg, offset); |
| 33 | if (ret < 0) | ||
| 34 | return ret; | ||
| 35 | |||
| 36 | if (!(ret & mask)) | 33 | if (!(ret & mask)) |
| 37 | return 0; | 34 | return 0; |
| 38 | 35 | ||
| @@ -43,17 +40,17 @@ static int mv88e6352_wait(struct dsa_switch *ds, int reg, u16 mask) · 4 unmodified lines | |||
| 43 | 40 | ||
| 44 | static inline int mv88e6352_phy_wait(struct dsa_switch *ds) | 41 | static inline int mv88e6352_phy_wait(struct dsa_switch *ds) |
| 45 | { | 42 | { |
| 46 | return mv88e6352_wait(ds, 0x18, 0x8000); | 43 | return mv88e6352_wait(ds, REG_GLOBAL2, 0x18, 0x8000); |
| 47 | } | 44 | } |
| 48 | 45 | ||
| 49 | static inline int mv88e6352_eeprom_load_wait(struct dsa_switch *ds) | 46 | static inline int mv88e6352_eeprom_load_wait(struct dsa_switch *ds) |
| 50 | { | 47 | { |
| 51 | return mv88e6352_wait(ds, 0x14, 0x0800); | 48 | return mv88e6352_wait(ds, REG_GLOBAL2, 0x14, 0x0800); |
| 52 | } | 49 | } |
| 53 | 50 | ||
| 54 | static inline int mv88e6352_eeprom_busy_wait(struct dsa_switch *ds) | 51 | static inline int mv88e6352_eeprom_busy_wait(struct dsa_switch *ds) |
| 55 | { | 52 | { |
| 56 | return mv88e6352_wait(ds, 0x14, 0x8000); | 53 | return mv88e6352_wait(ds, REG_GLOBAL2, 0x14, 0x8000); |
| 57 | } | 54 | } |
| 58 | 55 | ||
| 59 | static int __mv88e6352_phy_read(struct dsa_switch *ds, int addr, int regnum) | 56 | static int __mv88e6352_phy_read(struct dsa_switch *ds, int addr, int regnum) |
| @@ -85,6 +85,12 @@ int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg) · 84 unmodified lines | |||
| 85 | ret = __mv88e6xxx_reg_read(bus, ds->pd->sw_addr, addr, reg); | 85 | ret = __mv88e6xxx_reg_read(bus, ds->pd->sw_addr, addr, reg); |
| 86 | mutex_unlock(&ps->smi_mutex); | 86 | mutex_unlock(&ps->smi_mutex); |
| 87 | 87 | ||
| 88 | if (ret < 0) | ||
| 89 | return ret; | ||
| 90 | |||
| 91 | dev_dbg(ds->master_dev, "<- addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n", | ||
| 92 | addr, reg, ret); | ||
| 93 | |||
| 88 | return ret; | 94 | return ret; |
| 89 | } | 95 | } |
| 90 | 96 | ||
| @@ -128,6 +134,9 @@ int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val) · 37 unmodified lines | |||
| 128 | if (bus == NULL) | 134 | if (bus == NULL) |
| 129 | return -EINVAL; | 135 | return -EINVAL; |
| 130 | 136 | ||
| 137 | dev_dbg(ds->master_dev, "-> addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n", | ||
| 138 | addr, reg, val); | ||
| 139 | |||
| 131 | mutex_lock(&ps->smi_mutex); | 140 | mutex_lock(&ps->smi_mutex); |
| 132 | ret = __mv88e6xxx_reg_write(bus, ds->pd->sw_addr, addr, reg, val); | 141 | ret = __mv88e6xxx_reg_write(bus, ds->pd->sw_addr, addr, reg, val); |
| 133 | mutex_unlock(&ps->smi_mutex); | 142 | mutex_unlock(&ps->smi_mutex); |
| @@ -769,11 +769,11 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) · 768 unmodified lines | |||
| 769 | first_txd->processFlags |= TYPHOON_TX_PF_IP_CHKSUM; | 769 | first_txd->processFlags |= TYPHOON_TX_PF_IP_CHKSUM; |
| 770 | } | 770 | } |
| 771 | 771 | ||
| 772 | if(vlan_tx_tag_present(skb)) { | 772 | if (skb_vlan_tag_present(skb)) { |
| 773 | first_txd->processFlags |= | 773 | first_txd->processFlags |= |
| 774 | TYPHOON_TX_PF_INSERT_VLAN | TYPHOON_TX_PF_VLAN_PRIORITY; | 774 | TYPHOON_TX_PF_INSERT_VLAN | TYPHOON_TX_PF_VLAN_PRIORITY; |
| 775 | first_txd->processFlags |= | 775 | first_txd->processFlags |= |
| 776 | cpu_to_le32(htons(vlan_tx_tag_get(skb)) << | 776 | cpu_to_le32(htons(skb_vlan_tag_get(skb)) << |
| 777 | TYPHOON_TX_PF_VLAN_TAG_SHIFT); | 777 | TYPHOON_TX_PF_VLAN_TAG_SHIFT); |
| 778 | } | 778 | } |
| 779 | 779 | ||
| @@ -2429,9 +2429,9 @@ restart: · 2428 unmodified lines | |||
| 2429 | flagsize = (skb->len << 16) | (BD_FLG_END); | 2429 | flagsize = (skb->len << 16) | (BD_FLG_END); |
| 2430 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2430 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
| 2431 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2431 | flagsize |= BD_FLG_TCP_UDP_SUM; |
| 2432 | if (vlan_tx_tag_present(skb)) { | 2432 | if (skb_vlan_tag_present(skb)) { |
| 2433 | flagsize |= BD_FLG_VLAN_TAG; | 2433 | flagsize |= BD_FLG_VLAN_TAG; |
| 2434 | vlan_tag = vlan_tx_tag_get(skb); | 2434 | vlan_tag = skb_vlan_tag_get(skb); |
| 2435 | } | 2435 | } |
| 2436 | desc = ap->tx_ring + idx; | 2436 | desc = ap->tx_ring + idx; |
| 2437 | idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); | 2437 | idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); |
| @@ -2450,9 +2450,9 @@ restart: · 12 unmodified lines | |||
| 2450 | flagsize = (skb_headlen(skb) << 16); | 2450 | flagsize = (skb_headlen(skb) << 16); |
| 2451 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2451 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
| 2452 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2452 | flagsize |= BD_FLG_TCP_UDP_SUM; |
| 2453 | if (vlan_tx_tag_present(skb)) { | 2453 | if (skb_vlan_tag_present(skb)) { |
| 2454 | flagsize |= BD_FLG_VLAN_TAG; | 2454 | flagsize |= BD_FLG_VLAN_TAG; |
| 2455 | vlan_tag = vlan_tx_tag_get(skb); | 2455 | vlan_tag = skb_vlan_tag_get(skb); |
| 2456 | } | 2456 | } |
| 2457 | 2457 | ||
| 2458 | ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag); | 2458 | ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag); |
| @@ -179,7 +179,7 @@ config SUNLANCE · 178 unmodified lines | |||
| 179 | 179 | ||
| 180 | config AMD_XGBE | 180 | config AMD_XGBE |
| 181 | tristate "AMD 10GbE Ethernet driver" | 181 | tristate "AMD 10GbE Ethernet driver" |
| 182 | depends on OF_NET && HAS_IOMEM | 182 | depends on (OF_NET || ACPI) && HAS_IOMEM |
| 183 | select PHYLIB | 183 | select PHYLIB |
| 184 | select AMD_XGBE_PHY | 184 | select AMD_XGBE_PHY |
| 185 | select BITREVERSE | 185 | select BITREVERSE |
| @@ -1299,11 +1299,11 @@ static netdev_tx_t amd8111e_start_xmit(struct sk_buff *skb, · 1298 unmodified lines | |||
| 1299 | lp->tx_ring[tx_index].tx_flags = 0; | 1299 | lp->tx_ring[tx_index].tx_flags = 0; |
| 1300 | 1300 | ||
| 1301 | #if AMD8111E_VLAN_TAG_USED | 1301 | #if AMD8111E_VLAN_TAG_USED |
| 1302 | if (vlan_tx_tag_present(skb)) { | 1302 | if (skb_vlan_tag_present(skb)) { |
| 1303 | lp->tx_ring[tx_index].tag_ctrl_cmd |= | 1303 | lp->tx_ring[tx_index].tag_ctrl_cmd |= |
| 1304 | cpu_to_le16(TCC_VLAN_INSERT); | 1304 | cpu_to_le16(TCC_VLAN_INSERT); |
| 1305 | lp->tx_ring[tx_index].tag_ctrl_info = | 1305 | lp->tx_ring[tx_index].tag_ctrl_info = |
| 1306 | cpu_to_le16(vlan_tx_tag_get(skb)); | 1306 | cpu_to_le16(skb_vlan_tag_get(skb)); |
| 1307 | 1307 | ||
| 1308 | } | 1308 | } |
| 1309 | #endif | 1309 | #endif |
| @@ -2806,7 +2806,7 @@ static void pcnet32_check_media(struct net_device *dev, int verbose) · 2805 unmodified lines | |||
| 2806 | 2806 | ||
| 2807 | /* | 2807 | /* |
| 2808 | * Check for loss of link and link establishment. | 2808 | * Check for loss of link and link establishment. |
| 2809 | * Can not use mii_check_media because it does nothing if mode is forced. | 2809 | * Could possibly be changed to use mii_check_media instead. |
| 2810 | */ | 2810 | */ |
| 2811 | 2811 | ||
| 2812 | static void pcnet32_watchdog(struct net_device *dev) | 2812 | static void pcnet32_watchdog(struct net_device *dev) |
| @@ -328,7 +328,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata) · 327 unmodified lines | |||
| 328 | 328 | ||
| 329 | buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name); | 329 | buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name); |
| 330 | pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); | 330 | pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); |
| 331 | if (pdata->xgbe_debugfs == NULL) { | 331 | if (!pdata->xgbe_debugfs) { |
| 332 | netdev_err(pdata->netdev, "debugfs_create_dir failed\n"); | 332 | netdev_err(pdata->netdev, "debugfs_create_dir failed\n"); |
| 333 | return; | 333 | return; |
| 334 | } | 334 | } |
| @@ -422,7 +422,6 @@ static void xgbe_wrapper_rx_descriptor_init(struct xgbe_prv_data *pdata) · 421 unmodified lines | |||
| 422 | 422 | ||
| 423 | ring->cur = 0; | 423 | ring->cur = 0; |
| 424 | ring->dirty = 0; | 424 | ring->dirty = 0; |
| 425 | memset(&ring->rx, 0, sizeof(ring->rx)); | ||
| 426 | 425 | ||
| 427 | hw_if->rx_desc_init(channel); | 426 | hw_if->rx_desc_init(channel); |
| 428 | } | 427 | } |
| @@ -621,35 +620,6 @@ err_out: · 192 unmodified lines | |||
| 621 | return 0; | 620 | return 0; |
| 622 | } | 621 | } |
| 623 | 622 | ||
| 624 | static void xgbe_realloc_rx_buffer(struct xgbe_channel *channel) | ||
| 625 | { | ||
| 626 | struct xgbe_prv_data *pdata = channel->pdata; | ||
| 627 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
| 628 | struct xgbe_ring *ring = channel->rx_ring; | ||
| 629 | struct xgbe_ring_data *rdata; | ||
| 630 | int i; | ||
| 631 | |||
| 632 | DBGPR("-->xgbe_realloc_rx_buffer: rx_ring->rx.realloc_index = %u\n", | ||
| 633 | ring->rx.realloc_index); | ||
| 634 | |||
| 635 | for (i = 0; i < ring->dirty; i++) { | ||
| 636 | rdata = XGBE_GET_DESC_DATA(ring, ring->rx.realloc_index); | ||
| 637 | |||
| 638 | /* Reset rdata values */ | ||
| 639 | xgbe_unmap_rdata(pdata, rdata); | ||
| 640 | |||
| 641 | if (xgbe_map_rx_buffer(pdata, ring, rdata)) | ||
| 642 | break; | ||
| 643 | |||
| 644 | hw_if->rx_desc_reset(rdata); | ||
| 645 | |||
| 646 | ring->rx.realloc_index++; | ||
| 647 | } | ||
| 648 | ring->dirty = 0; | ||
| 649 | |||
| 650 | DBGPR("<--xgbe_realloc_rx_buffer\n"); | ||
| 651 | } | ||
| 652 | |||
| 653 | void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *desc_if) | 623 | void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *desc_if) |
| 654 | { | 624 | { |
| 655 | DBGPR("-->xgbe_init_function_ptrs_desc\n"); | 625 | DBGPR("-->xgbe_init_function_ptrs_desc\n"); |
| @@ -657,7 +627,7 @@ void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *desc_if) · 1 unmodified line | |||
| 657 | desc_if->alloc_ring_resources = xgbe_alloc_ring_resources; | 627 | desc_if->alloc_ring_resources = xgbe_alloc_ring_resources; |
| 658 | desc_if->free_ring_resources = xgbe_free_ring_resources; | 628 | desc_if->free_ring_resources = xgbe_free_ring_resources; |
| 659 | desc_if->map_tx_skb = xgbe_map_tx_skb; | 629 | desc_if->map_tx_skb = xgbe_map_tx_skb; |
| 660 | desc_if->realloc_rx_buffer = xgbe_realloc_rx_buffer; | 630 | desc_if->map_rx_buffer = xgbe_map_rx_buffer; |
| 661 | desc_if->unmap_rdata = xgbe_unmap_rdata; | 631 | desc_if->unmap_rdata = xgbe_unmap_rdata; |
| 662 | desc_if->wrapper_tx_desc_init = xgbe_wrapper_tx_descriptor_init; | 632 | desc_if->wrapper_tx_desc_init = xgbe_wrapper_tx_descriptor_init; |
| 663 | desc_if->wrapper_rx_desc_init = xgbe_wrapper_rx_descriptor_init; | 633 | desc_if->wrapper_rx_desc_init = xgbe_wrapper_rx_descriptor_init; |
| @@ -115,6 +115,7 @@ · 114 unmodified lines | |||
| 115 | */ | 115 | */ |
| 116 | 116 | ||
| 117 | #include <linux/phy.h> | 117 | #include <linux/phy.h> |
| 118 | #include <linux/mdio.h> | ||
| 118 | #include <linux/clk.h> | 119 | #include <linux/clk.h> |
| 119 | #include <linux/bitrev.h> | 120 | #include <linux/bitrev.h> |
| 120 | #include <linux/crc32.h> | 121 | #include <linux/crc32.h> |
| @@ -130,7 +131,7 @@ static unsigned int xgbe_usec_to_riwt(struct xgbe_prv_data *pdata, · 9 unmodified lines | |||
| 130 | 131 | ||
| 131 | DBGPR("-->xgbe_usec_to_riwt\n"); | 132 | DBGPR("-->xgbe_usec_to_riwt\n"); |
| 132 | 133 | ||
| 133 | rate = clk_get_rate(pdata->sysclk); | 134 | rate = pdata->sysclk_rate; |
| 134 | 135 | ||
| 135 | /* | 136 | /* |
| 136 | * Convert the input usec value to the watchdog timer value. Each | 137 | * Convert the input usec value to the watchdog timer value. Each |
| @@ -153,7 +154,7 @@ static unsigned int xgbe_riwt_to_usec(struct xgbe_prv_data *pdata, · 16 unmodified lines | |||
| 153 | 154 | ||
| 154 | DBGPR("-->xgbe_riwt_to_usec\n"); | 155 | DBGPR("-->xgbe_riwt_to_usec\n"); |
| 155 | 156 | ||
| 156 | rate = clk_get_rate(pdata->sysclk); | 157 | rate = pdata->sysclk_rate; |
| 157 | 158 | ||
| 158 | /* | 159 | /* |
| 159 | * Convert the input watchdog timer value to the usec value. Each | 160 | * Convert the input watchdog timer value to the usec value. Each |
| @@ -673,6 +674,9 @@ static void xgbe_enable_mac_interrupts(struct xgbe_prv_data *pdata) · 513 unmodified lines | |||
| 673 | 674 | ||
| 674 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) | 675 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) |
| 675 | { | 676 | { |
| 677 | if (XGMAC_IOREAD_BITS(pdata, MAC_TCR, SS) == 0x3) | ||
| 678 | return 0; | ||
| 679 | |||
| 676 | XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0x3); | 680 | XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0x3); |
| 677 | 681 | ||
| 678 | return 0; | 682 | return 0; |
| @@ -680,6 +684,9 @@ static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) · 1 unmodified line | |||
| 680 | 684 | ||
| 681 | static int xgbe_set_gmii_2500_speed(struct xgbe_prv_data *pdata) | 685 | static int xgbe_set_gmii_2500_speed(struct xgbe_prv_data *pdata) |
| 682 | { | 686 | { |
| 687 | if (XGMAC_IOREAD_BITS(pdata, MAC_TCR, SS) == 0x2) | ||
| 688 | return 0; | ||
| 689 | |||
| 683 | XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0x2); | 690 | XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0x2); |
| 684 | 691 | ||
| 685 | return 0; | 692 | return 0; |
| @@ -687,6 +694,9 @@ static int xgbe_set_gmii_2500_speed(struct xgbe_prv_data *pdata) · 1 unmodified line | |||
| 687 | 694 | ||
| 688 | static int xgbe_set_xgmii_speed(struct xgbe_prv_data *pdata) | 695 | static int xgbe_set_xgmii_speed(struct xgbe_prv_data *pdata) |
| 689 | { | 696 | { |
| 697 | if (XGMAC_IOREAD_BITS(pdata, MAC_TCR, SS) == 0) | ||
| 698 | return 0; | ||
| 699 | |||
| 690 | XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0); | 700 | XGMAC_IOWRITE_BITS(pdata, MAC_TCR, SS, 0); |
| 691 | 701 | ||
| 692 | return 0; | 702 | return 0; |
| @@ -881,6 +891,23 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad, · 188 unmodified lines | |||
| 881 | else | 891 | else |
| 882 | mmd_address = (pdata->mdio_mmd << 16) | (mmd_reg & 0xffff); | 892 | mmd_address = (pdata->mdio_mmd << 16) | (mmd_reg & 0xffff); |
| 883 | 893 | ||
| 894 | /* If the PCS is changing modes, match the MAC speed to it */ | ||
| 895 | if (((mmd_address >> 16) == MDIO_MMD_PCS) && | ||
| 896 | ((mmd_address & 0xffff) == MDIO_CTRL2)) { | ||
| 897 | struct phy_device *phydev = pdata->phydev; | ||
| 898 | |||
| 899 | if (mmd_data & MDIO_PCS_CTRL2_TYPE) { | ||
| 900 | /* KX mode */ | ||
| 901 | if (phydev->supported & SUPPORTED_1000baseKX_Full) | ||
| 902 | xgbe_set_gmii_speed(pdata); | ||
| 903 | else | ||
| 904 | xgbe_set_gmii_2500_speed(pdata); | ||
| 905 | } else { | ||
| 906 | /* KR mode */ | ||
| 907 | xgbe_set_xgmii_speed(pdata); | ||
| 908 | } | ||
| 909 | } | ||
| 910 | |||
| 884 | /* The PCS registers are accessed using mmio. The underlying APB3 | 911 | /* The PCS registers are accessed using mmio. The underlying APB3 |
| 885 | * management interface uses indirect addressing to access the MMD | 912 | * management interface uses indirect addressing to access the MMD |
| 886 | * register sets. This requires accessing of the PCS register in two | 913 | * register sets. This requires accessing of the PCS register in two |
| @@ -1359,6 +1386,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 472 unmodified lines | |||
| 1359 | unsigned int tso_context, vlan_context; | 1386 | unsigned int tso_context, vlan_context; |
| 1360 | unsigned int tx_set_ic; | 1387 | unsigned int tx_set_ic; |
| 1361 | int start_index = ring->cur; | 1388 | int start_index = ring->cur; |
| 1389 | int cur_index = ring->cur; | ||
| 1362 | int i; | 1390 | int i; |
| 1363 | 1391 | ||
| 1364 | DBGPR("-->xgbe_dev_xmit\n"); | 1392 | DBGPR("-->xgbe_dev_xmit\n"); |
| @@ -1401,7 +1429,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 36 unmodified lines | |||
| 1401 | else | 1429 | else |
| 1402 | tx_set_ic = 0; | 1430 | tx_set_ic = 0; |
| 1403 | 1431 | ||
| 1404 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); | 1432 | rdata = XGBE_GET_DESC_DATA(ring, cur_index); |
| 1405 | rdesc = rdata->rdesc; | 1433 | rdesc = rdata->rdesc; |
| 1406 | 1434 | ||
| 1407 | /* Create a context descriptor if this is a TSO packet */ | 1435 | /* Create a context descriptor if this is a TSO packet */ |
| @@ -1444,8 +1472,8 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 36 unmodified lines | |||
| 1444 | ring->tx.cur_vlan_ctag = packet->vlan_ctag; | 1472 | ring->tx.cur_vlan_ctag = packet->vlan_ctag; |
| 1445 | } | 1473 | } |
| 1446 | 1474 | ||
| 1447 | ring->cur++; | 1475 | cur_index++; |
| 1448 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); | 1476 | rdata = XGBE_GET_DESC_DATA(ring, cur_index); |
| 1449 | rdesc = rdata->rdesc; | 1477 | rdesc = rdata->rdesc; |
| 1450 | } | 1478 | } |
| 1451 | 1479 | ||
| @@ -1473,7 +1501,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 21 unmodified lines | |||
| 1473 | XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, CTXT, 0); | 1501 | XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, CTXT, 0); |
| 1474 | 1502 | ||
| 1475 | /* Set OWN bit if not the first descriptor */ | 1503 | /* Set OWN bit if not the first descriptor */ |
| 1476 | if (ring->cur != start_index) | 1504 | if (cur_index != start_index) |
| 1477 | XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, OWN, 1); | 1505 | XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, OWN, 1); |
| 1478 | 1506 | ||
| 1479 | if (tso) { | 1507 | if (tso) { |
| @@ -1497,9 +1525,9 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 17 unmodified lines | |||
| 1497 | packet->length); | 1525 | packet->length); |
| 1498 | } | 1526 | } |
| 1499 | 1527 | ||
| 1500 | for (i = ring->cur - start_index + 1; i < packet->rdesc_count; i++) { | 1528 | for (i = cur_index - start_index + 1; i < packet->rdesc_count; i++) { |
| 1501 | ring->cur++; | 1529 | cur_index++; |
| 1502 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); | 1530 | rdata = XGBE_GET_DESC_DATA(ring, cur_index); |
| 1503 | rdesc = rdata->rdesc; | 1531 | rdesc = rdata->rdesc; |
| 1504 | 1532 | ||
| 1505 | /* Update buffer address */ | 1533 | /* Update buffer address */ |
| @@ -1551,7 +1579,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) · 45 unmodified lines | |||
| 1551 | /* Make sure ownership is written to the descriptor */ | 1579 | /* Make sure ownership is written to the descriptor */ |
| 1552 | wmb(); | 1580 | wmb(); |
| 1553 | 1581 | ||
| 1554 | ring->cur++; | 1582 | ring->cur = cur_index + 1; |
| 1555 | if (!packet->skb->xmit_more || | 1583 | if (!packet->skb->xmit_more || |
| 1556 | netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev, | 1584 | netif_xmit_stopped(netdev_get_tx_queue(pdata->netdev, |
| 1557 | channel->queue_index))) | 1585 | channel->queue_index))) |
| @@ -2107,6 +2135,23 @@ static void xgbe_config_jumbo_enable(struct xgbe_prv_data *pdata) · 549 unmodified lines | |||
| 2107 | XGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val); | 2135 | XGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val); |
| 2108 | } | 2136 | } |
| 2109 | 2137 | ||
| 2138 | static void xgbe_config_mac_speed(struct xgbe_prv_data *pdata) | ||
| 2139 | { | ||
| 2140 | switch (pdata->phy_speed) { | ||
| 2141 | case SPEED_10000: | ||
| 2142 | xgbe_set_xgmii_speed(pdata); | ||
| 2143 | break; | ||
| 2144 | |||
| 2145 | case SPEED_2500: | ||
| 2146 | xgbe_set_gmii_2500_speed(pdata); | ||
| 2147 | break; | ||
| 2148 | |||
| 2149 | case SPEED_1000: | ||
| 2150 | xgbe_set_gmii_speed(pdata); | ||
| 2151 | break; | ||
| 2152 | } | ||
| 2153 | } | ||
| 2154 | |||
| 2110 | static void xgbe_config_checksum_offload(struct xgbe_prv_data *pdata) | 2155 | static void xgbe_config_checksum_offload(struct xgbe_prv_data *pdata) |
| 2111 | { | 2156 | { |
| 2112 | if (pdata->netdev->features & NETIF_F_RXCSUM) | 2157 | if (pdata->netdev->features & NETIF_F_RXCSUM) |
| @@ -2757,6 +2802,7 @@ static int xgbe_init(struct xgbe_prv_data *pdata) · 644 unmodified lines | |||
| 2757 | xgbe_config_mac_address(pdata); | 2802 | xgbe_config_mac_address(pdata); |
| 2758 | xgbe_config_jumbo_enable(pdata); | 2803 | xgbe_config_jumbo_enable(pdata); |
| 2759 | xgbe_config_flow_control(pdata); | 2804 | xgbe_config_flow_control(pdata); |
| 2805 | xgbe_config_mac_speed(pdata); | ||
| 2760 | xgbe_config_checksum_offload(pdata); | 2806 | xgbe_config_checksum_offload(pdata); |
| 2761 | xgbe_config_vlan_support(pdata); | 2807 | xgbe_config_vlan_support(pdata); |
| 2762 | xgbe_config_mmc(pdata); | 2808 | xgbe_config_mmc(pdata); |
| @@ -225,6 +225,11 @@ static inline unsigned int xgbe_tx_avail_desc(struct xgbe_ring *ring) · 224 unmodified lines | |||
| 225 | return (ring->rdesc_count - (ring->cur - ring->dirty)); | 225 | return (ring->rdesc_count - (ring->cur - ring->dirty)); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | static inline unsigned int xgbe_rx_dirty_desc(struct xgbe_ring *ring) | ||
| 229 | { | ||
| 230 | return (ring->cur - ring->dirty); | ||
| 231 | } | ||
| 232 | |||
| 228 | static int xgbe_maybe_stop_tx_queue(struct xgbe_channel *channel, | 233 | static int xgbe_maybe_stop_tx_queue(struct xgbe_channel *channel, |
| 229 | struct xgbe_ring *ring, unsigned int count) | 234 | struct xgbe_ring *ring, unsigned int count) |
| 230 | { | 235 | { |
| @@ -337,12 +342,13 @@ static irqreturn_t xgbe_isr(int irq, void *data) · 106 unmodified lines | |||
| 337 | dma_ch_isr = XGMAC_DMA_IOREAD(channel, DMA_CH_SR); | 342 | dma_ch_isr = XGMAC_DMA_IOREAD(channel, DMA_CH_SR); |
| 338 | DBGPR(" DMA_CH%u_ISR = %08x\n", i, dma_ch_isr); | 343 | DBGPR(" DMA_CH%u_ISR = %08x\n", i, dma_ch_isr); |
| 339 | 344 | ||
| 340 | /* If we get a TI or RI interrupt that means per channel DMA | 345 | /* The TI or RI interrupt bits may still be set even if using |
| 341 | * interrupts are not enabled, so we use the private data napi | 346 | * per channel DMA interrupts. Check to be sure those are not |
| 342 | * structure, not the per channel napi structure | 347 | * enabled before using the private data napi structure. |
| 343 | */ | 348 | */ |
| 344 | if (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) || | 349 | if (!pdata->per_channel_irq && |
| 345 | XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI)) { | 350 | (XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, TI) || |
| 351 | XGMAC_GET_BITS(dma_ch_isr, DMA_CH_SR, RI))) { | ||
| 346 | if (napi_schedule_prep(&pdata->napi)) { | 352 | if (napi_schedule_prep(&pdata->napi)) { |
| 347 | /* Disable Tx and Rx interrupts */ | 353 | /* Disable Tx and Rx interrupts */ |
| 348 | xgbe_disable_rx_tx_ints(pdata); | 354 | xgbe_disable_rx_tx_ints(pdata); |
| @@ -410,17 +416,13 @@ static enum hrtimer_restart xgbe_tx_timer(struct hrtimer *timer) · 61 unmodified lines | |||
| 410 | struct xgbe_channel *channel = container_of(timer, | 416 | struct xgbe_channel *channel = container_of(timer, |
| 411 | struct xgbe_channel, | 417 | struct xgbe_channel, |
| 412 | tx_timer); | 418 | tx_timer); |
| 413 | struct xgbe_ring *ring = channel->tx_ring; | ||
| 414 | struct xgbe_prv_data *pdata = channel->pdata; | 419 | struct xgbe_prv_data *pdata = channel->pdata; |
| 415 | struct napi_struct *napi; | 420 | struct napi_struct *napi; |
| 416 | unsigned long flags; | ||
| 417 | 421 | ||
| 418 | DBGPR("-->xgbe_tx_timer\n"); | 422 | DBGPR("-->xgbe_tx_timer\n"); |
| 419 | 423 | ||
| 420 | napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; | 424 | napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; |
| 421 | 425 | ||
| 422 | spin_lock_irqsave(&ring->lock, flags); | ||
| 423 | |||
| 424 | if (napi_schedule_prep(napi)) { | 426 | if (napi_schedule_prep(napi)) { |
| 425 | /* Disable Tx and Rx interrupts */ | 427 | /* Disable Tx and Rx interrupts */ |
| 426 | if (pdata->per_channel_irq) | 428 | if (pdata->per_channel_irq) |
| @@ -434,8 +436,6 @@ static enum hrtimer_restart xgbe_tx_timer(struct hrtimer *timer) · 7 unmodified lines | |||
| 434 | 436 | ||
| 435 | channel->tx_timer_active = 0; | 437 | channel->tx_timer_active = 0; |
| 436 | 438 | ||
| 437 | spin_unlock_irqrestore(&ring->lock, flags); | ||
| 438 | |||
| 439 | DBGPR("<--xgbe_tx_timer\n"); | 439 | DBGPR("<--xgbe_tx_timer\n"); |
| 440 | 440 | ||
| 441 | return HRTIMER_NORESTART; | 441 | return HRTIMER_NORESTART; |
| @@ -694,7 +694,7 @@ static void xgbe_adjust_link(struct net_device *netdev) · 252 unmodified lines | |||
| 694 | struct phy_device *phydev = pdata->phydev; | 694 | struct phy_device *phydev = pdata->phydev; |
| 695 | int new_state = 0; | 695 | int new_state = 0; |
| 696 | 696 | ||
| 697 | if (phydev == NULL) | 697 | if (!phydev) |
| 698 | return; | 698 | return; |
| 699 | 699 | ||
| 700 | if (phydev->link) { | 700 | if (phydev->link) { |
| @@ -929,7 +929,7 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) · 228 unmodified lines | |||
| 929 | DBGPR("<--xgbe_stop\n"); | 929 | DBGPR("<--xgbe_stop\n"); |
| 930 | } | 930 | } |
| 931 | 931 | ||
| 932 | static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset) | 932 | static void xgbe_restart_dev(struct xgbe_prv_data *pdata) |
| 933 | { | 933 | { |
| 934 | struct xgbe_channel *channel; | 934 | struct xgbe_channel *channel; |
| 935 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 935 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
| @@ -952,9 +952,8 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset) · 16 unmodified lines | |||
| 952 | xgbe_free_tx_data(pdata); | 952 | xgbe_free_tx_data(pdata); |
| 953 | xgbe_free_rx_data(pdata); | 953 | xgbe_free_rx_data(pdata); |
| 954 | 954 | ||
| 955 | /* Issue software reset to device if requested */ | 955 | /* Issue software reset to device */ |
| 956 | if (reset) | 956 | hw_if->exit(pdata); |
| 957 | hw_if->exit(pdata); | ||
| 958 | 957 | ||
| 959 | xgbe_start(pdata); | 958 | xgbe_start(pdata); |
| 960 | 959 | ||
| @@ -969,7 +968,7 @@ static void xgbe_restart(struct work_struct *work) · 8 unmodified lines | |||
| 969 | 968 | ||
| 970 | rtnl_lock(); | 969 | rtnl_lock(); |
| 971 | 970 | ||
| 972 | xgbe_restart_dev(pdata, 1); | 971 | xgbe_restart_dev(pdata); |
| 973 | 972 | ||
| 974 | rtnl_unlock(); | 973 | rtnl_unlock(); |
| 975 | } | 974 | } |
| @@ -1167,8 +1166,8 @@ static void xgbe_prep_tx_tstamp(struct xgbe_prv_data *pdata, · 191 unmodified lines | |||
| 1167 | 1166 | ||
| 1168 | static void xgbe_prep_vlan(struct sk_buff *skb, struct xgbe_packet_data *packet) | 1167 | static void xgbe_prep_vlan(struct sk_buff *skb, struct xgbe_packet_data *packet) |
| 1169 | { | 1168 | { |
| 1170 | if (vlan_tx_tag_present(skb)) | 1169 | if (skb_vlan_tag_present(skb)) |
| 1171 | packet->vlan_ctag = vlan_tx_tag_get(skb); | 1170 | packet->vlan_ctag = skb_vlan_tag_get(skb); |
| 1172 | } | 1171 | } |
| 1173 | 1172 | ||
| 1174 | static int xgbe_prep_tso(struct sk_buff *skb, struct xgbe_packet_data *packet) | 1173 | static int xgbe_prep_tso(struct sk_buff *skb, struct xgbe_packet_data *packet) |
| @@ -1249,9 +1248,9 @@ static void xgbe_packet_info(struct xgbe_prv_data *pdata, · 74 unmodified lines | |||
| 1249 | XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, | 1248 | XGMAC_SET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, |
| 1250 | CSUM_ENABLE, 1); | 1249 | CSUM_ENABLE, 1); |
| 1251 | 1250 | ||
| 1252 | if (vlan_tx_tag_present(skb)) { | 1251 | if (skb_vlan_tag_present(skb)) { |
| 1253 | /* VLAN requires an extra descriptor if tag is different */ | 1252 | /* VLAN requires an extra descriptor if tag is different */ |
| 1254 | if (vlan_tx_tag_get(skb) != ring->tx.cur_vlan_ctag) | 1253 | if (skb_vlan_tag_get(skb) != ring->tx.cur_vlan_ctag) |
| 1255 | /* We can share with the TSO context descriptor */ | 1254 | /* We can share with the TSO context descriptor */ |
| 1256 | if (!context_desc) { | 1255 | if (!context_desc) { |
| 1257 | context_desc = 1; | 1256 | context_desc = 1; |
| @@ -1448,7 +1447,6 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) · 190 unmodified lines | |||
| 1448 | struct xgbe_ring *ring; | 1447 | struct xgbe_ring *ring; |
| 1449 | struct xgbe_packet_data *packet; | 1448 | struct xgbe_packet_data *packet; |
| 1450 | struct netdev_queue *txq; | 1449 | struct netdev_queue *txq; |
| 1451 | unsigned long flags; | ||
| 1452 | int ret; | 1450 | int ret; |
| 1453 | 1451 | ||
| 1454 | DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len); | 1452 | DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len); |
| @@ -1460,8 +1458,6 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) · 5 unmodified lines | |||
| 1460 | 1458 | ||
| 1461 | ret = NETDEV_TX_OK; | 1459 | ret = NETDEV_TX_OK; |
| 1462 | 1460 | ||
| 1463 | spin_lock_irqsave(&ring->lock, flags); | ||
| 1464 | |||
| 1465 | if (skb->len == 0) { | 1461 | if (skb->len == 0) { |
| 1466 | netdev_err(netdev, "empty skb received from stack\n"); | 1462 | netdev_err(netdev, "empty skb received from stack\n"); |
| 1467 | dev_kfree_skb_any(skb); | 1463 | dev_kfree_skb_any(skb); |
| @@ -1508,10 +1504,6 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) · 40 unmodified lines | |||
| 1508 | ret = NETDEV_TX_OK; | 1504 | ret = NETDEV_TX_OK; |
| 1509 | 1505 | ||
| 1510 | tx_netdev_return: | 1506 | tx_netdev_return: |
| 1511 | spin_unlock_irqrestore(&ring->lock, flags); | ||
| 1512 | |||
| 1513 | DBGPR("<--xgbe_xmit\n"); | ||
| 1514 | |||
| 1515 | return ret; | 1507 | return ret; |
| 1516 | } | 1508 | } |
| 1517 | 1509 | ||
| @@ -1589,7 +1581,7 @@ static int xgbe_change_mtu(struct net_device *netdev, int mtu) · 71 unmodified lines | |||
| 1589 | pdata->rx_buf_size = ret; | 1581 | pdata->rx_buf_size = ret; |
| 1590 | netdev->mtu = mtu; | 1582 | netdev->mtu = mtu; |
| 1591 | 1583 | ||
| 1592 | xgbe_restart_dev(pdata, 0); | 1584 | xgbe_restart_dev(pdata); |
| 1593 | 1585 | ||
| 1594 | DBGPR("<--xgbe_change_mtu\n"); | 1586 | DBGPR("<--xgbe_change_mtu\n"); |
| 1595 | 1587 | ||
| @@ -1778,15 +1770,28 @@ struct net_device_ops *xgbe_get_netdev_ops(void) · 182 unmodified lines | |||
| 1778 | static void xgbe_rx_refresh(struct xgbe_channel *channel) | 1770 | static void xgbe_rx_refresh(struct xgbe_channel *channel) |
| 1779 | { | 1771 | { |
| 1780 | struct xgbe_prv_data *pdata = channel->pdata; | 1772 | struct xgbe_prv_data *pdata = channel->pdata; |
| 1773 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
| 1781 | struct xgbe_desc_if *desc_if = &pdata->desc_if; | 1774 | struct xgbe_desc_if *desc_if = &pdata->desc_if; |
| 1782 | struct xgbe_ring *ring = channel->rx_ring; | 1775 | struct xgbe_ring *ring = channel->rx_ring; |
| 1783 | struct xgbe_ring_data *rdata; | 1776 | struct xgbe_ring_data *rdata; |
| 1784 | 1777 | ||
| 1785 | desc_if->realloc_rx_buffer(channel); | 1778 | while (ring->dirty != ring->cur) { |
| 1779 | rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); | ||
| 1780 | |||
| 1781 | /* Reset rdata values */ | ||
| 1782 | desc_if->unmap_rdata(pdata, rdata); | ||
| 1783 | |||
| 1784 | if (desc_if->map_rx_buffer(pdata, ring, rdata)) | ||
| 1785 | break; | ||
| 1786 | |||
| 1787 | hw_if->rx_desc_reset(rdata); | ||
| 1788 | |||
| 1789 | ring->dirty++; | ||
| 1790 | } | ||
| 1786 | 1791 | ||
| 1787 | /* Update the Rx Tail Pointer Register with address of | 1792 | /* Update the Rx Tail Pointer Register with address of |
| 1788 | * the last cleaned entry */ | 1793 | * the last cleaned entry */ |
| 1789 | rdata = XGBE_GET_DESC_DATA(ring, ring->rx.realloc_index - 1); | 1794 | rdata = XGBE_GET_DESC_DATA(ring, ring->dirty - 1); |
| 1790 | XGMAC_DMA_IOWRITE(channel, DMA_CH_RDTR_LO, | 1795 | XGMAC_DMA_IOWRITE(channel, DMA_CH_RDTR_LO, |
| 1791 | lower_32_bits(rdata->rdesc_dma)); | 1796 | lower_32_bits(rdata->rdesc_dma)); |
| 1792 | } | 1797 | } |
| @@ -1826,7 +1831,6 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 33 unmodified lines | |||
| 1826 | struct xgbe_ring_desc *rdesc; | 1831 | struct xgbe_ring_desc *rdesc; |
| 1827 | struct net_device *netdev = pdata->netdev; | 1832 | struct net_device *netdev = pdata->netdev; |
| 1828 | struct netdev_queue *txq; | 1833 | struct netdev_queue *txq; |
| 1829 | unsigned long flags; | ||
| 1830 | int processed = 0; | 1834 | int processed = 0; |
| 1831 | unsigned int tx_packets = 0, tx_bytes = 0; | 1835 | unsigned int tx_packets = 0, tx_bytes = 0; |
| 1832 | 1836 | ||
| @@ -1838,8 +1842,6 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 5 unmodified lines | |||
| 1838 | 1842 | ||
| 1839 | txq = netdev_get_tx_queue(netdev, channel->queue_index); | 1843 | txq = netdev_get_tx_queue(netdev, channel->queue_index); |
| 1840 | 1844 | ||
| 1841 | spin_lock_irqsave(&ring->lock, flags); | ||
| 1842 | |||
| 1843 | while ((processed < XGBE_TX_DESC_MAX_PROC) && | 1845 | while ((processed < XGBE_TX_DESC_MAX_PROC) && |
| 1844 | (ring->dirty != ring->cur)) { | 1846 | (ring->dirty != ring->cur)) { |
| 1845 | rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); | 1847 | rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); |
| @@ -1870,7 +1872,7 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 24 unmodified lines | |||
| 1870 | } | 1872 | } |
| 1871 | 1873 | ||
| 1872 | if (!processed) | 1874 | if (!processed) |
| 1873 | goto unlock; | 1875 | return 0; |
| 1874 | 1876 | ||
| 1875 | netdev_tx_completed_queue(txq, tx_packets, tx_bytes); | 1877 | netdev_tx_completed_queue(txq, tx_packets, tx_bytes); |
| 1876 | 1878 | ||
| @@ -1882,9 +1884,6 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) · 5 unmodified lines | |||
| 1882 | 1884 | ||
| 1883 | DBGPR("<--xgbe_tx_poll: processed=%d\n", processed); | 1885 | DBGPR("<--xgbe_tx_poll: processed=%d\n", processed); |
| 1884 | 1886 | ||
| 1885 | unlock: | ||
| 1886 | spin_unlock_irqrestore(&ring->lock, flags); | ||
| 1887 | |||
| 1888 | return processed; | 1887 | return processed; |
| 1889 | } | 1888 | } |
| 1890 | 1889 | ||
| @@ -1936,7 +1935,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) · 45 unmodified lines | |||
| 1936 | read_again: | 1935 | read_again: |
| 1937 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); | 1936 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); |
| 1938 | 1937 | ||
| 1939 | if (ring->dirty > (XGBE_RX_DESC_CNT >> 3)) | 1938 | if (xgbe_rx_dirty_desc(ring) > (XGBE_RX_DESC_CNT >> 3)) |
| 1940 | xgbe_rx_refresh(channel); | 1939 | xgbe_rx_refresh(channel); |
| 1941 | 1940 | ||
| 1942 | if (hw_if->dev_read(channel)) | 1941 | if (hw_if->dev_read(channel)) |
| @@ -1944,7 +1943,6 @@ read_again: · 1 unmodified line | |||
| 1944 | 1943 | ||
| 1945 | received++; | 1944 | received++; |
| 1946 | ring->cur++; | 1945 | ring->cur++; |
| 1947 | ring->dirty++; | ||
| 1948 | 1946 | ||
| 1949 | incomplete = XGMAC_GET_BITS(packet->attributes, | 1947 | incomplete = XGMAC_GET_BITS(packet->attributes, |
| 1950 | RX_PACKET_ATTRIBUTES, | 1948 | RX_PACKET_ATTRIBUTES, |
| @@ -123,7 +123,10 @@ · 122 unmodified lines | |||
| 123 | #include <linux/io.h> | 123 | #include <linux/io.h> |
| 124 | #include <linux/of.h> | 124 | #include <linux/of.h> |
| 125 | #include <linux/of_net.h> | 125 | #include <linux/of_net.h> |
| 126 | #include <linux/of_address.h> | ||
| 126 | #include <linux/clk.h> | 127 | #include <linux/clk.h> |
| 128 | #include <linux/property.h> | ||
| 129 | #include <linux/acpi.h> | ||
| 127 | 130 | ||
| 128 | #include "xgbe.h" | 131 | #include "xgbe.h" |
| 129 | #include "xgbe-common.h" | 132 | #include "xgbe-common.h" |
| @@ -148,6 +151,7 @@ static void xgbe_default_config(struct xgbe_prv_data *pdata) · 18 unmodified lines | |||
| 148 | pdata->pause_autoneg = 1; | 151 | pdata->pause_autoneg = 1; |
| 149 | pdata->tx_pause = 1; | 152 | pdata->tx_pause = 1; |
| 150 | pdata->rx_pause = 1; | 153 | pdata->rx_pause = 1; |
| 154 | pdata->phy_speed = SPEED_UNKNOWN; | ||
| 151 | pdata->power_down = 0; | 155 | pdata->power_down = 0; |
| 152 | pdata->default_autoneg = AUTONEG_ENABLE; | 156 | pdata->default_autoneg = AUTONEG_ENABLE; |
| 153 | pdata->default_speed = SPEED_10000; | 157 | pdata->default_speed = SPEED_10000; |
| @@ -161,6 +165,96 @@ static void xgbe_init_all_fptrs(struct xgbe_prv_data *pdata) · 7 unmodified lines | |||
| 161 | xgbe_init_function_ptrs_desc(&pdata->desc_if); | 165 | xgbe_init_function_ptrs_desc(&pdata->desc_if); |
| 162 | } | 166 | } |
| 163 | 167 | ||
| 168 | #ifdef CONFIG_ACPI | ||
| 169 | static int xgbe_acpi_support(struct xgbe_prv_data *pdata) | ||
| 170 | { | ||
| 171 | struct acpi_device *adev = pdata->adev; | ||
| 172 | struct device *dev = pdata->dev; | ||
| 173 | u32 property; | ||
| 174 | acpi_handle handle; | ||
| 175 | acpi_status status; | ||
| 176 | unsigned long long data; | ||
| 177 | int cca; | ||
| 178 | int ret; | ||
| 179 | |||
| 180 | /* Obtain the system clock setting */ | ||
| 181 | ret = device_property_read_u32(dev, XGBE_ACPI_DMA_FREQ, &property); | ||
| 182 | if (ret) { | ||
| 183 | dev_err(dev, "unable to obtain %s property\n", | ||
| 184 | XGBE_ACPI_DMA_FREQ); | ||
| 185 | return ret; | ||
| 186 | } | ||
| 187 | pdata->sysclk_rate = property; | ||
| 188 | |||
| 189 | /* Obtain the PTP clock setting */ | ||
| 190 | ret = device_property_read_u32(dev, XGBE_ACPI_PTP_FREQ, &property); | ||
| 191 | if (ret) { | ||
| 192 | dev_err(dev, "unable to obtain %s property\n", | ||
| 193 | XGBE_ACPI_PTP_FREQ); | ||
| 194 | return ret; | ||
| 195 | } | ||
| 196 | pdata->ptpclk_rate = property; | ||
| 197 | |||
| 198 | /* Retrieve the device cache coherency value */ | ||
| 199 | handle = adev->handle; | ||
| 200 | do { | ||
| 201 | status = acpi_evaluate_integer(handle, "_CCA", NULL, &data); | ||
| 202 | if (!ACPI_FAILURE(status)) { | ||
| 203 | cca = data; | ||
| 204 | break; | ||
| 205 | } | ||
| 206 | |||
| 207 | status = acpi_get_parent(handle, &handle); | ||
| 208 | } while (!ACPI_FAILURE(status)); | ||
| 209 | |||
| 210 | if (ACPI_FAILURE(status)) { | ||
| 211 | dev_err(dev, "error obtaining acpi coherency value\n"); | ||
| 212 | return -EINVAL; | ||
| 213 | } | ||
| 214 | pdata->coherent = !!cca; | ||
| 215 | |||
| 216 | return 0; | ||
| 217 | } | ||
| 218 | #else /* CONFIG_ACPI */ | ||
| 219 | static int xgbe_acpi_support(struct xgbe_prv_data *pdata) | ||
| 220 | { | ||
| 221 | return -EINVAL; | ||
| 222 | } | ||
| 223 | #endif /* CONFIG_ACPI */ | ||
| 224 | |||
| 225 | #ifdef CONFIG_OF | ||
| 226 | static int xgbe_of_support(struct xgbe_prv_data *pdata) | ||
| 227 | { | ||
| 228 | struct device *dev = pdata->dev; | ||
| 229 | |||
| 230 | /* Obtain the system clock setting */ | ||
| 231 | pdata->sysclk = devm_clk_get(dev, XGBE_DMA_CLOCK); | ||
| 232 | if (IS_ERR(pdata->sysclk)) { | ||
| 233 | dev_err(dev, "dma devm_clk_get failed\n"); | ||
| 234 | return PTR_ERR(pdata->sysclk); | ||
| 235 | } | ||
| 236 | pdata->sysclk_rate = clk_get_rate(pdata->sysclk); | ||
| 237 | |||
| 238 | /* Obtain the PTP clock setting */ | ||
| 239 | pdata->ptpclk = devm_clk_get(dev, XGBE_PTP_CLOCK); | ||
| 240 | if (IS_ERR(pdata->ptpclk)) { | ||
| 241 | dev_err(dev, "ptp devm_clk_get failed\n"); | ||
| 242 | return PTR_ERR(pdata->ptpclk); | ||
| 243 | } | ||
| 244 | pdata->ptpclk_rate = clk_get_rate(pdata->ptpclk); | ||
| 245 | |||
| 246 | /* Retrieve the device cache coherency value */ | ||
| 247 | pdata->coherent = of_dma_is_coherent(dev->of_node); | ||
| 248 | |||
| 249 | return 0; | ||
| 250 | } | ||
| 251 | #else /* CONFIG_OF */ | ||
| 252 | static int xgbe_of_support(struct xgbe_prv_data *pdata) | ||
| 253 | { | ||
| 254 | return -EINVAL; | ||
| 255 | } | ||
| 256 | #endif /*CONFIG_OF */ | ||
| 257 | |||
| 164 | static int xgbe_probe(struct platform_device *pdev) | 258 | static int xgbe_probe(struct platform_device *pdev) |
| 165 | { | 259 | { |
| 166 | struct xgbe_prv_data *pdata; | 260 | struct xgbe_prv_data *pdata; |
| @@ -169,7 +263,7 @@ static int xgbe_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 169 | struct net_device *netdev; | 263 | struct net_device *netdev; |
| 170 | struct device *dev = &pdev->dev; | 264 | struct device *dev = &pdev->dev; |
| 171 | struct resource *res; | 265 | struct resource *res; |
| 172 | const u8 *mac_addr; | 266 | const char *phy_mode; |
| 173 | unsigned int i; | 267 | unsigned int i; |
| 174 | int ret; | 268 | int ret; |
| 175 | 269 | ||
| @@ -186,6 +280,7 @@ static int xgbe_probe(struct platform_device *pdev) · 10 unmodified lines | |||
| 186 | pdata = netdev_priv(netdev); | 280 | pdata = netdev_priv(netdev); |
| 187 | pdata->netdev = netdev; | 281 | pdata->netdev = netdev; |
| 188 | pdata->pdev = pdev; | 282 | pdata->pdev = pdev; |
| 283 | pdata->adev = ACPI_COMPANION(dev); | ||
| 189 | pdata->dev = dev; | 284 | pdata->dev = dev; |
| 190 | platform_set_drvdata(pdev, netdev); | 285 | platform_set_drvdata(pdev, netdev); |
| 191 | 286 | ||
| @@ -194,6 +289,9 @@ static int xgbe_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 194 | mutex_init(&pdata->rss_mutex); | 289 | mutex_init(&pdata->rss_mutex); |
| 195 | spin_lock_init(&pdata->tstamp_lock); | 290 | spin_lock_init(&pdata->tstamp_lock); |
| 196 | 291 | ||
| 292 | /* Check if we should use ACPI or DT */ | ||
| 293 | pdata->use_acpi = (!pdata->adev || acpi_disabled) ? 0 : 1; | ||
| 294 | |||
| 197 | /* Set and validate the number of descriptors for a ring */ | 295 | /* Set and validate the number of descriptors for a ring */ |
| 198 | BUILD_BUG_ON_NOT_POWER_OF_2(XGBE_TX_DESC_CNT); | 296 | BUILD_BUG_ON_NOT_POWER_OF_2(XGBE_TX_DESC_CNT); |
| 199 | pdata->tx_desc_count = XGBE_TX_DESC_CNT; | 297 | pdata->tx_desc_count = XGBE_TX_DESC_CNT; |
| @@ -212,22 +310,6 @@ static int xgbe_probe(struct platform_device *pdev) · 12 unmodified lines | |||
| 212 | goto err_io; | 310 | goto err_io; |
| 213 | } | 311 | } |
| 214 | 312 | ||
| 215 | /* Obtain the system clock setting */ | ||
| 216 | pdata->sysclk = devm_clk_get(dev, XGBE_DMA_CLOCK); | ||
| 217 | if (IS_ERR(pdata->sysclk)) { | ||
| 218 | dev_err(dev, "dma devm_clk_get failed\n"); | ||
| 219 | ret = PTR_ERR(pdata->sysclk); | ||
| 220 | goto err_io; | ||
| 221 | } | ||
| 222 | |||
| 223 | /* Obtain the PTP clock setting */ | ||
| 224 | pdata->ptpclk = devm_clk_get(dev, XGBE_PTP_CLOCK); | ||
| 225 | if (IS_ERR(pdata->ptpclk)) { | ||
| 226 | dev_err(dev, "ptp devm_clk_get failed\n"); | ||
| 227 | ret = PTR_ERR(pdata->ptpclk); | ||
| 228 | goto err_io; | ||
| 229 | } | ||
| 230 | |||
| 231 | /* Obtain the mmio areas for the device */ | 313 | /* Obtain the mmio areas for the device */ |
| 232 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 314 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 233 | pdata->xgmac_regs = devm_ioremap_resource(dev, res); | 315 | pdata->xgmac_regs = devm_ioremap_resource(dev, res); |
| @@ -247,16 +329,42 @@ static int xgbe_probe(struct platform_device *pdev) · 13 unmodified lines | |||
| 247 | } | 329 | } |
| 248 | DBGPR(" xpcs_regs = %p\n", pdata->xpcs_regs); | 330 | DBGPR(" xpcs_regs = %p\n", pdata->xpcs_regs); |
| 249 | 331 | ||
| 250 | /* Set the DMA mask */ | 332 | /* Retrieve the MAC address */ |
| 251 | if (!dev->dma_mask) | 333 | ret = device_property_read_u8_array(dev, XGBE_MAC_ADDR_PROPERTY, |
| 252 | dev->dma_mask = &dev->coherent_dma_mask; | 334 | pdata->mac_addr, |
| 253 | ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); | 335 | sizeof(pdata->mac_addr)); |
| 254 | if (ret) { | 336 | if (ret || !is_valid_ether_addr(pdata->mac_addr)) { |
| 255 | dev_err(dev, "dma_set_mask_and_coherent failed\n"); | 337 | dev_err(dev, "invalid %s property\n", XGBE_MAC_ADDR_PROPERTY); |
| 338 | if (!ret) | ||
| 339 | ret = -EINVAL; | ||
| 256 | goto err_io; | 340 | goto err_io; |
| 257 | } | 341 | } |
| 258 | 342 | ||
| 259 | if (of_property_read_bool(dev->of_node, "dma-coherent")) { | 343 | /* Retrieve the PHY mode - it must be "xgmii" */ |
| 344 | ret = device_property_read_string(dev, XGBE_PHY_MODE_PROPERTY, | ||
| 345 | &phy_mode); | ||
| 346 | if (ret || strcmp(phy_mode, phy_modes(PHY_INTERFACE_MODE_XGMII))) { | ||
| 347 | dev_err(dev, "invalid %s property\n", XGBE_PHY_MODE_PROPERTY); | ||
| 348 | if (!ret) | ||
| 349 | ret = -EINVAL; | ||
| 350 | goto err_io; | ||
| 351 | } | ||
| 352 | pdata->phy_mode = PHY_INTERFACE_MODE_XGMII; | ||
| 353 | |||
| 354 | /* Check for per channel interrupt support */ | ||
| 355 | if (device_property_present(dev, XGBE_DMA_IRQS_PROPERTY)) | ||
| 356 | pdata->per_channel_irq = 1; | ||
| 357 | |||
| 358 | /* Obtain device settings unique to ACPI/OF */ | ||
| 359 | if (pdata->use_acpi) | ||
| 360 | ret = xgbe_acpi_support(pdata); | ||
| 361 | else | ||
| 362 | ret = xgbe_of_support(pdata); | ||
| 363 | if (ret) | ||
| 364 | goto err_io; | ||
| 365 | |||
| 366 | /* Set the DMA coherency values */ | ||
| 367 | if (pdata->coherent) { | ||
| 260 | pdata->axdomain = XGBE_DMA_OS_AXDOMAIN; | 368 | pdata->axdomain = XGBE_DMA_OS_AXDOMAIN; |
| 261 | pdata->arcache = XGBE_DMA_OS_ARCACHE; | 369 | pdata->arcache = XGBE_DMA_OS_ARCACHE; |
| 262 | pdata->awcache = XGBE_DMA_OS_AWCACHE; | 370 | pdata->awcache = XGBE_DMA_OS_AWCACHE; |
| @@ -266,10 +374,16 @@ static int xgbe_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 266 | pdata->awcache = XGBE_DMA_SYS_AWCACHE; | 374 | pdata->awcache = XGBE_DMA_SYS_AWCACHE; |
| 267 | } | 375 | } |
| 268 | 376 | ||
| 269 | /* Check for per channel interrupt support */ | 377 | /* Set the DMA mask */ |
| 270 | if (of_property_read_bool(dev->of_node, XGBE_DMA_IRQS)) | 378 | if (!dev->dma_mask) |
| 271 | pdata->per_channel_irq = 1; | 379 | dev->dma_mask = &dev->coherent_dma_mask; |
| 380 | ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); | ||
| 381 | if (ret) { | ||
| 382 | dev_err(dev, "dma_set_mask_and_coherent failed\n"); | ||
| 383 | goto err_io; | ||
| 384 | } | ||
| 272 | 385 | ||
| 386 | /* Get the device interrupt */ | ||
| 273 | ret = platform_get_irq(pdev, 0); | 387 | ret = platform_get_irq(pdev, 0); |
| 274 | if (ret < 0) { | 388 | if (ret < 0) { |
| 275 | dev_err(dev, "platform_get_irq 0 failed\n"); | 389 | dev_err(dev, "platform_get_irq 0 failed\n"); |
| @@ -279,6 +393,7 @@ static int xgbe_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 279 | 393 | ||
| 280 | netdev->irq = pdata->dev_irq; | 394 | netdev->irq = pdata->dev_irq; |
| 281 | netdev->base_addr = (unsigned long)pdata->xgmac_regs; | 395 | netdev->base_addr = (unsigned long)pdata->xgmac_regs; |
| 396 | memcpy(netdev->dev_addr, pdata->mac_addr, netdev->addr_len); | ||
| 282 | 397 | ||
| 283 | /* Set all the function pointers */ | 398 | /* Set all the function pointers */ |
| 284 | xgbe_init_all_fptrs(pdata); | 399 | xgbe_init_all_fptrs(pdata); |
| @@ -291,23 +406,6 @@ static int xgbe_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 291 | /* Populate the hardware features */ | 406 | /* Populate the hardware features */ |
| 292 | xgbe_get_all_hw_features(pdata); | 407 | xgbe_get_all_hw_features(pdata); |
| 293 | 408 | ||
| 294 | /* Retrieve the MAC address */ | ||
| 295 | mac_addr = of_get_mac_address(dev->of_node); | ||
| 296 | if (!mac_addr) { | ||
| 297 | dev_err(dev, "invalid mac address for this device\n"); | ||
| 298 | ret = -EINVAL; | ||
| 299 | goto err_io; | ||
| 300 | } | ||
| 301 | memcpy(netdev->dev_addr, mac_addr, netdev->addr_len); | ||
| 302 | |||
| 303 | /* Retrieve the PHY mode - it must be "xgmii" */ | ||
| 304 | pdata->phy_mode = of_get_phy_mode(dev->of_node); | ||
| 305 | if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) { | ||
| 306 | dev_err(dev, "invalid phy-mode specified for this device\n"); | ||
| 307 | ret = -EINVAL; | ||
| 308 | goto err_io; | ||
| 309 | } | ||
| 310 | |||
| 311 | /* Set default configuration data */ | 409 | /* Set default configuration data */ |
| 312 | xgbe_default_config(pdata); | 410 | xgbe_default_config(pdata); |
| 313 | 411 | ||
| @@ -491,18 +589,35 @@ static int xgbe_resume(struct device *dev) · 177 unmodified lines | |||
| 491 | } | 589 | } |
| 492 | #endif /* CONFIG_PM */ | 590 | #endif /* CONFIG_PM */ |
| 493 | 591 | ||
| 592 | #ifdef CONFIG_ACPI | ||
| 593 | static const struct acpi_device_id xgbe_acpi_match[] = { | ||
| 594 | { "AMDI8001", 0 }, | ||
| 595 | {}, | ||
| 596 | }; | ||
| 597 | |||
| 598 | MODULE_DEVICE_TABLE(acpi, xgbe_acpi_match); | ||
| 599 | #endif | ||
| 600 | |||
| 601 | #ifdef CONFIG_OF | ||
| 494 | static const struct of_device_id xgbe_of_match[] = { | 602 | static const struct of_device_id xgbe_of_match[] = { |
| 495 | { .compatible = "amd,xgbe-seattle-v1a", }, | 603 | { .compatible = "amd,xgbe-seattle-v1a", }, |
| 496 | {}, | 604 | {}, |
| 497 | }; | 605 | }; |
| 498 | 606 | ||
| 499 | MODULE_DEVICE_TABLE(of, xgbe_of_match); | 607 | MODULE_DEVICE_TABLE(of, xgbe_of_match); |
| 608 | #endif | ||
| 609 | |||
| 500 | static SIMPLE_DEV_PM_OPS(xgbe_pm_ops, xgbe_suspend, xgbe_resume); | 610 | static SIMPLE_DEV_PM_OPS(xgbe_pm_ops, xgbe_suspend, xgbe_resume); |
| 501 | 611 | ||
| 502 | static struct platform_driver xgbe_driver = { | 612 | static struct platform_driver xgbe_driver = { |
| 503 | .driver = { | 613 | .driver = { |
| 504 | .name = "amd-xgbe", | 614 | .name = "amd-xgbe", |
| 615 | #ifdef CONFIG_ACPI | ||
| 616 | .acpi_match_table = xgbe_acpi_match, | ||
| 617 | #endif | ||
| 618 | #ifdef CONFIG_OF | ||
| 505 | .of_match_table = xgbe_of_match, | 619 | .of_match_table = xgbe_of_match, |
| 620 | #endif | ||
| 506 | .pm = &xgbe_pm_ops, | 621 | .pm = &xgbe_pm_ops, |
| 507 | }, | 622 | }, |
| 508 | .probe = xgbe_probe, | 623 | .probe = xgbe_probe, |
| @@ -205,25 +205,16 @@ void xgbe_dump_phy_registers(struct xgbe_prv_data *pdata) · 204 unmodified lines | |||
| 205 | 205 | ||
| 206 | int xgbe_mdio_register(struct xgbe_prv_data *pdata) | 206 | int xgbe_mdio_register(struct xgbe_prv_data *pdata) |
| 207 | { | 207 | { |
| 208 | struct device_node *phy_node; | ||
| 209 | struct mii_bus *mii; | 208 | struct mii_bus *mii; |
| 210 | struct phy_device *phydev; | 209 | struct phy_device *phydev; |
| 211 | int ret = 0; | 210 | int ret = 0; |
| 212 | 211 | ||
| 213 | DBGPR("-->xgbe_mdio_register\n"); | 212 | DBGPR("-->xgbe_mdio_register\n"); |
| 214 | 213 | ||
| 215 | /* Retrieve the phy-handle */ | ||
| 216 | phy_node = of_parse_phandle(pdata->dev->of_node, "phy-handle", 0); | ||
| 217 | if (!phy_node) { | ||
| 218 | dev_err(pdata->dev, "unable to parse phy-handle\n"); | ||
| 219 | return -EINVAL; | ||
| 220 | } | ||
| 221 | |||
| 222 | mii = mdiobus_alloc(); | 214 | mii = mdiobus_alloc(); |
| 223 | if (mii == NULL) { | 215 | if (!mii) { |
| 224 | dev_err(pdata->dev, "mdiobus_alloc failed\n"); | 216 | dev_err(pdata->dev, "mdiobus_alloc failed\n"); |
| 225 | ret = -ENOMEM; | 217 | return -ENOMEM; |
| 226 | goto err_node_get; | ||
| 227 | } | 218 | } |
| 228 | 219 | ||
| 229 | /* Register on the MDIO bus (don't probe any PHYs) */ | 220 | /* Register on the MDIO bus (don't probe any PHYs) */ |
| @@ -252,18 +243,19 @@ int xgbe_mdio_register(struct xgbe_prv_data *pdata) · 22 unmodified lines | |||
| 252 | request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, | 243 | request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, |
| 253 | MDIO_ID_ARGS(phydev->c45_ids.device_ids[MDIO_MMD_PCS])); | 244 | MDIO_ID_ARGS(phydev->c45_ids.device_ids[MDIO_MMD_PCS])); |
| 254 | 245 | ||
| 255 | of_node_get(phy_node); | ||
| 256 | phydev->dev.of_node = phy_node; | ||
| 257 | ret = phy_device_register(phydev); | 246 | ret = phy_device_register(phydev); |
| 258 | if (ret) { | 247 | if (ret) { |
| 259 | dev_err(pdata->dev, "phy_device_register failed\n"); | 248 | dev_err(pdata->dev, "phy_device_register failed\n"); |
| 260 | of_node_put(phy_node); | 249 | goto err_phy_device; |
| 250 | } | ||
| 251 | if (!phydev->dev.driver) { | ||
| 252 | dev_err(pdata->dev, "phy driver probe failed\n"); | ||
| 253 | ret = -EIO; | ||
| 261 | goto err_phy_device; | 254 | goto err_phy_device; |
| 262 | } | 255 | } |
| 263 | 256 | ||
| 264 | /* Add a reference to the PHY driver so it can't be unloaded */ | 257 | /* Add a reference to the PHY driver so it can't be unloaded */ |
| 265 | pdata->phy_module = phydev->dev.driver ? | 258 | pdata->phy_module = phydev->dev.driver->owner; |
| 266 | phydev->dev.driver->owner : NULL; | ||
| 267 | if (!try_module_get(pdata->phy_module)) { | 259 | if (!try_module_get(pdata->phy_module)) { |
| 268 | dev_err(pdata->dev, "try_module_get failed\n"); | 260 | dev_err(pdata->dev, "try_module_get failed\n"); |
| 269 | ret = -EIO; | 261 | ret = -EIO; |
| @@ -283,8 +275,6 @@ int xgbe_mdio_register(struct xgbe_prv_data *pdata) · 13 unmodified lines | |||
| 283 | 275 | ||
| 284 | pdata->phydev = phydev; | 276 | pdata->phydev = phydev; |
| 285 | 277 | ||
| 286 | of_node_put(phy_node); | ||
| 287 | |||
| 288 | DBGPHY_REGS(pdata); | 278 | DBGPHY_REGS(pdata); |
| 289 | 279 | ||
| 290 | DBGPR("<--xgbe_mdio_register\n"); | 280 | DBGPR("<--xgbe_mdio_register\n"); |
| @@ -300,9 +290,6 @@ err_mdiobus_register: · 9 unmodified lines | |||
| 300 | err_mdiobus_alloc: | 290 | err_mdiobus_alloc: |
| 301 | mdiobus_free(mii); | 291 | mdiobus_free(mii); |
| 302 | 292 | ||
| 303 | err_node_get: | ||
| 304 | of_node_put(phy_node); | ||
| 305 | |||
| 306 | return ret; | 293 | return ret; |
| 307 | } | 294 | } |
| 308 | 295 | ||
| @@ -171,15 +171,9 @@ static int xgbe_adjtime(struct ptp_clock_info *info, s64 delta) · 170 unmodified lines | |||
| 171 | struct xgbe_prv_data, | 171 | struct xgbe_prv_data, |
| 172 | ptp_clock_info); | 172 | ptp_clock_info); |
| 173 | unsigned long flags; | 173 | unsigned long flags; |
| 174 | u64 nsec; | ||
| 175 | 174 | ||
| 176 | spin_lock_irqsave(&pdata->tstamp_lock, flags); | 175 | spin_lock_irqsave(&pdata->tstamp_lock, flags); |
| 177 | 176 | timecounter_adjtime(&pdata->tstamp_tc, delta); | |
| 178 | nsec = timecounter_read(&pdata->tstamp_tc); | ||
| 179 | |||
| 180 | nsec += delta; | ||
| 181 | timecounter_init(&pdata->tstamp_tc, &pdata->tstamp_cc, nsec); | ||
| 182 | |||
| 183 | spin_unlock_irqrestore(&pdata->tstamp_lock, flags); | 177 | spin_unlock_irqrestore(&pdata->tstamp_lock, flags); |
| 184 | 178 | ||
| 185 | return 0; | 179 | return 0; |
| @@ -239,7 +233,7 @@ void xgbe_ptp_register(struct xgbe_prv_data *pdata) · 53 unmodified lines | |||
| 239 | snprintf(info->name, sizeof(info->name), "%s", | 233 | snprintf(info->name, sizeof(info->name), "%s", |
| 240 | netdev_name(pdata->netdev)); | 234 | netdev_name(pdata->netdev)); |
| 241 | info->owner = THIS_MODULE; | 235 | info->owner = THIS_MODULE; |
| 242 | info->max_adj = clk_get_rate(pdata->ptpclk); | 236 | info->max_adj = pdata->ptpclk_rate; |
| 243 | info->adjfreq = xgbe_adjfreq; | 237 | info->adjfreq = xgbe_adjfreq; |
| 244 | info->adjtime = xgbe_adjtime; | 238 | info->adjtime = xgbe_adjtime; |
| 245 | info->gettime = xgbe_gettime; | 239 | info->gettime = xgbe_gettime; |
| @@ -260,7 +254,7 @@ void xgbe_ptp_register(struct xgbe_prv_data *pdata) · 14 unmodified lines | |||
| 260 | */ | 254 | */ |
| 261 | dividend = 50000000; | 255 | dividend = 50000000; |
| 262 | dividend <<= 32; | 256 | dividend <<= 32; |
| 263 | pdata->tstamp_addend = div_u64(dividend, clk_get_rate(pdata->ptpclk)); | 257 | pdata->tstamp_addend = div_u64(dividend, pdata->ptpclk_rate); |
| 264 | 258 | ||
| 265 | /* Setup the timecounter */ | 259 | /* Setup the timecounter */ |
| 266 | cc->read = xgbe_cc_read; | 260 | cc->read = xgbe_cc_read; |
| @@ -124,7 +124,7 @@ · 123 unmodified lines | |||
| 124 | #include <linux/if_vlan.h> | 124 | #include <linux/if_vlan.h> |
| 125 | #include <linux/bitops.h> | 125 | #include <linux/bitops.h> |
| 126 | #include <linux/ptp_clock_kernel.h> | 126 | #include <linux/ptp_clock_kernel.h> |
| 127 | #include <linux/clocksource.h> | 127 | #include <linux/timecounter.h> |
| 128 | #include <linux/net_tstamp.h> | 128 | #include <linux/net_tstamp.h> |
| 129 | #include <net/dcbnl.h> | 129 | #include <net/dcbnl.h> |
| 130 | 130 | ||
| @@ -182,10 +182,18 @@ · 51 unmodified lines | |||
| 182 | #define XGBE_PHY_NAME "amd_xgbe_phy" | 182 | #define XGBE_PHY_NAME "amd_xgbe_phy" |
| 183 | #define XGBE_PRTAD 0 | 183 | #define XGBE_PRTAD 0 |
| 184 | 184 | ||
| 185 | /* Common property names */ | ||
| 186 | #define XGBE_MAC_ADDR_PROPERTY "mac-address" | ||
| 187 | #define XGBE_PHY_MODE_PROPERTY "phy-mode" | ||
| 188 | #define XGBE_DMA_IRQS_PROPERTY "amd,per-channel-interrupt" | ||
| 189 | |||
| 185 | /* Device-tree clock names */ | 190 | /* Device-tree clock names */ |
| 186 | #define XGBE_DMA_CLOCK "dma_clk" | 191 | #define XGBE_DMA_CLOCK "dma_clk" |
| 187 | #define XGBE_PTP_CLOCK "ptp_clk" | 192 | #define XGBE_PTP_CLOCK "ptp_clk" |
| 188 | #define XGBE_DMA_IRQS "amd,per-channel-interrupt" | 193 | |
| 194 | /* ACPI property names */ | ||
| 195 | #define XGBE_ACPI_DMA_FREQ "amd,dma-freq" | ||
| 196 | #define XGBE_ACPI_PTP_FREQ "amd,ptp-freq" | ||
| 189 | 197 | ||
| 190 | /* Timestamp support - values based on 50MHz PTP clock | 198 | /* Timestamp support - values based on 50MHz PTP clock |
| 191 | * 50MHz => 20 nsec | 199 | * 50MHz => 20 nsec |
| @@ -361,8 +369,7 @@ struct xgbe_ring { · 169 unmodified lines | |||
| 361 | * cur - Tx: index of descriptor to be used for current transfer | 369 | * cur - Tx: index of descriptor to be used for current transfer |
| 362 | * Rx: index of descriptor to check for packet availability | 370 | * Rx: index of descriptor to check for packet availability |
| 363 | * dirty - Tx: index of descriptor to check for transfer complete | 371 | * dirty - Tx: index of descriptor to check for transfer complete |
| 364 | * Rx: count of descriptors in which a packet has been received | 372 | * Rx: index of descriptor to check for buffer reallocation |
| 365 | * (used with skb_realloc_index to refresh the ring) | ||
| 366 | */ | 373 | */ |
| 367 | unsigned int cur; | 374 | unsigned int cur; |
| 368 | unsigned int dirty; | 375 | unsigned int dirty; |
| @@ -377,11 +384,6 @@ struct xgbe_ring { · 8 unmodified lines | |||
| 377 | unsigned short cur_mss; | 384 | unsigned short cur_mss; |
| 378 | unsigned short cur_vlan_ctag; | 385 | unsigned short cur_vlan_ctag; |
| 379 | } tx; | 386 | } tx; |
| 380 | |||
| 381 | struct { | ||
| 382 | unsigned int realloc_index; | ||
| 383 | unsigned int realloc_threshold; | ||
| 384 | } rx; | ||
| 385 | }; | 387 | }; |
| 386 | } ____cacheline_aligned; | 388 | } ____cacheline_aligned; |
| 387 | 389 | ||
| @@ -596,7 +598,8 @@ struct xgbe_desc_if { · 208 unmodified lines | |||
| 596 | int (*alloc_ring_resources)(struct xgbe_prv_data *); | 598 | int (*alloc_ring_resources)(struct xgbe_prv_data *); |
| 597 | void (*free_ring_resources)(struct xgbe_prv_data *); | 599 | void (*free_ring_resources)(struct xgbe_prv_data *); |
| 598 | int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *); | 600 | int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *); |
| 599 | void (*realloc_rx_buffer)(struct xgbe_channel *); | 601 | int (*map_rx_buffer)(struct xgbe_prv_data *, struct xgbe_ring *, |
| 602 | struct xgbe_ring_data *); | ||
| 600 | void (*unmap_rdata)(struct xgbe_prv_data *, struct xgbe_ring_data *); | 603 | void (*unmap_rdata)(struct xgbe_prv_data *, struct xgbe_ring_data *); |
| 601 | void (*wrapper_tx_desc_init)(struct xgbe_prv_data *); | 604 | void (*wrapper_tx_desc_init)(struct xgbe_prv_data *); |
| 602 | void (*wrapper_rx_desc_init)(struct xgbe_prv_data *); | 605 | void (*wrapper_rx_desc_init)(struct xgbe_prv_data *); |
| @@ -650,8 +653,12 @@ struct xgbe_hw_features { · 47 unmodified lines | |||
| 650 | struct xgbe_prv_data { | 653 | struct xgbe_prv_data { |
| 651 | struct net_device *netdev; | 654 | struct net_device *netdev; |
| 652 | struct platform_device *pdev; | 655 | struct platform_device *pdev; |
| 656 | struct acpi_device *adev; | ||
| 653 | struct device *dev; | 657 | struct device *dev; |
| 654 | 658 | ||
| 659 | /* ACPI or DT flag */ | ||
| 660 | unsigned int use_acpi; | ||
| 661 | |||
| 655 | /* XGMAC/XPCS related mmio registers */ | 662 | /* XGMAC/XPCS related mmio registers */ |
| 656 | void __iomem *xgmac_regs; /* XGMAC CSRs */ | 663 | void __iomem *xgmac_regs; /* XGMAC CSRs */ |
| 657 | void __iomem *xpcs_regs; /* XPCS MMD registers */ | 664 | void __iomem *xpcs_regs; /* XPCS MMD registers */ |
| @@ -672,6 +679,7 @@ struct xgbe_prv_data { · 14 unmodified lines | |||
| 672 | struct xgbe_desc_if desc_if; | 679 | struct xgbe_desc_if desc_if; |
| 673 | 680 | ||
| 674 | /* AXI DMA settings */ | 681 | /* AXI DMA settings */ |
| 682 | unsigned int coherent; | ||
| 675 | unsigned int axdomain; | 683 | unsigned int axdomain; |
| 676 | unsigned int arcache; | 684 | unsigned int arcache; |
| 677 | unsigned int awcache; | 685 | unsigned int awcache; |
| @@ -739,6 +747,7 @@ struct xgbe_prv_data { · 61 unmodified lines | |||
| 739 | unsigned int phy_rx_pause; | 747 | unsigned int phy_rx_pause; |
| 740 | 748 | ||
| 741 | /* Netdev related settings */ | 749 | /* Netdev related settings */ |
| 750 | unsigned char mac_addr[ETH_ALEN]; | ||
| 742 | netdev_features_t netdev_features; | 751 | netdev_features_t netdev_features; |
| 743 | struct napi_struct napi; | 752 | struct napi_struct napi; |
| 744 | struct xgbe_mmc_stats mmc_stats; | 753 | struct xgbe_mmc_stats mmc_stats; |
| @@ -748,7 +757,9 @@ struct xgbe_prv_data { · 3 unmodified lines | |||
| 748 | 757 | ||
| 749 | /* Device clocks */ | 758 | /* Device clocks */ |
| 750 | struct clk *sysclk; | 759 | struct clk *sysclk; |
| 760 | unsigned long sysclk_rate; | ||
| 751 | struct clk *ptpclk; | 761 | struct clk *ptpclk; |
| 762 | unsigned long ptpclk_rate; | ||
| 752 | 763 | ||
| 753 | /* Timestamp support */ | 764 | /* Timestamp support */ |
| 754 | spinlock_t tstamp_lock; | 765 | spinlock_t tstamp_lock; |
| @@ -593,10 +593,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata) · 592 unmodified lines | |||
| 593 | if (!xgene_ring_mgr_init(pdata)) | 593 | if (!xgene_ring_mgr_init(pdata)) |
| 594 | return -ENODEV; | 594 | return -ENODEV; |
| 595 | 595 | ||
| 596 | clk_prepare_enable(pdata->clk); | 596 | if (!efi_enabled(EFI_BOOT)) { |
| 597 | clk_disable_unprepare(pdata->clk); | 597 | clk_prepare_enable(pdata->clk); |
| 598 | clk_prepare_enable(pdata->clk); | 598 | clk_disable_unprepare(pdata->clk); |
| 599 | xgene_enet_ecc_init(pdata); | 599 | clk_prepare_enable(pdata->clk); |
| 600 | xgene_enet_ecc_init(pdata); | ||
| 601 | } | ||
| 600 | xgene_enet_config_ring_if_assoc(pdata); | 602 | xgene_enet_config_ring_if_assoc(pdata); |
| 601 | 603 | ||
| 602 | /* Enable auto-incr for scanning */ | 604 | /* Enable auto-incr for scanning */ |
| @@ -663,15 +665,20 @@ static int xgene_enet_phy_connect(struct net_device *ndev) · 60 unmodified lines | |||
| 663 | struct phy_device *phy_dev; | 665 | struct phy_device *phy_dev; |
| 664 | struct device *dev = &pdata->pdev->dev; | 666 | struct device *dev = &pdata->pdev->dev; |
| 665 | 667 | ||
| 666 | phy_np = of_parse_phandle(dev->of_node, "phy-handle", 0); | 668 | if (dev->of_node) { |
| 667 | if (!phy_np) { | 669 | phy_np = of_parse_phandle(dev->of_node, "phy-handle", 0); |
| 668 | netdev_dbg(ndev, "No phy-handle found\n"); | 670 | if (!phy_np) { |
| 669 | return -ENODEV; | 671 | netdev_dbg(ndev, "No phy-handle found in DT\n"); |
| 672 | return -ENODEV; | ||
| 673 | } | ||
| 674 | pdata->phy_dev = of_phy_find_device(phy_np); | ||
| 670 | } | 675 | } |
| 671 | 676 | ||
| 672 | phy_dev = of_phy_connect(ndev, phy_np, &xgene_enet_adjust_link, | 677 | phy_dev = pdata->phy_dev; |
| 673 | 0, pdata->phy_mode); | 678 | |
| 674 | if (!phy_dev) { | 679 | if (!phy_dev || |
| 680 | phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link, | ||
| 681 | pdata->phy_mode)) { | ||
| 675 | netdev_err(ndev, "Could not connect to PHY\n"); | 682 | netdev_err(ndev, "Could not connect to PHY\n"); |
| 676 | return -ENODEV; | 683 | return -ENODEV; |
| 677 | } | 684 | } |
| @@ -681,32 +688,71 @@ static int xgene_enet_phy_connect(struct net_device *ndev) · 3 unmodified lines | |||
| 681 | ~SUPPORTED_100baseT_Half & | 688 | ~SUPPORTED_100baseT_Half & |
| 682 | ~SUPPORTED_1000baseT_Half; | 689 | ~SUPPORTED_1000baseT_Half; |
| 683 | phy_dev->advertising = phy_dev->supported; | 690 | phy_dev->advertising = phy_dev->supported; |
| 684 | pdata->phy_dev = phy_dev; | ||
| 685 | 691 | ||
| 686 | return 0; | 692 | return 0; |
| 687 | } | 693 | } |
| 688 | 694 | ||
| 689 | int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata) | 695 | static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata, |
| 696 | struct mii_bus *mdio) | ||
| 690 | { | 697 | { |
| 691 | struct net_device *ndev = pdata->ndev; | ||
| 692 | struct device *dev = &pdata->pdev->dev; | 698 | struct device *dev = &pdata->pdev->dev; |
| 699 | struct net_device *ndev = pdata->ndev; | ||
| 700 | struct phy_device *phy; | ||
| 693 | struct device_node *child_np; | 701 | struct device_node *child_np; |
| 694 | struct device_node *mdio_np = NULL; | 702 | struct device_node *mdio_np = NULL; |
| 695 | struct mii_bus *mdio_bus; | ||
| 696 | int ret; | 703 | int ret; |
| 704 | u32 phy_id; | ||
| 705 | |||
| 706 | if (dev->of_node) { | ||
| 707 | for_each_child_of_node(dev->of_node, child_np) { | ||
| 708 | if (of_device_is_compatible(child_np, | ||
| 709 | "apm,xgene-mdio")) { | ||
| 710 | mdio_np = child_np; | ||
| 711 | break; | ||
| 712 | } | ||
| 713 | } | ||
| 697 | 714 | ||
| 698 | for_each_child_of_node(dev->of_node, child_np) { | 715 | if (!mdio_np) { |
| 699 | if (of_device_is_compatible(child_np, "apm,xgene-mdio")) { | 716 | netdev_dbg(ndev, "No mdio node in the dts\n"); |
| 700 | mdio_np = child_np; | 717 | return -ENXIO; |
| 701 | break; | ||
| 702 | } | 718 | } |
| 703 | } | ||
| 704 | 719 | ||
| 705 | if (!mdio_np) { | 720 | return of_mdiobus_register(mdio, mdio_np); |
| 706 | netdev_dbg(ndev, "No mdio node in the dts\n"); | ||
| 707 | return -ENXIO; | ||
| 708 | } | 721 | } |
| 709 | 722 | ||
| 723 | /* Mask out all PHYs from auto probing. */ | ||
| 724 | mdio->phy_mask = ~0; | ||
| 725 | |||
| 726 | /* Register the MDIO bus */ | ||
| 727 | ret = mdiobus_register(mdio); | ||
| 728 | if (ret) | ||
| 729 | return ret; | ||
| 730 | |||
| 731 | ret = device_property_read_u32(dev, "phy-channel", &phy_id); | ||
| 732 | if (ret) | ||
| 733 | ret = device_property_read_u32(dev, "phy-addr", &phy_id); | ||
| 734 | if (ret) | ||
| 735 | return -EINVAL; | ||
| 736 | |||
| 737 | phy = get_phy_device(mdio, phy_id, true); | ||
| 738 | if (!phy || IS_ERR(phy)) | ||
| 739 | return -EIO; | ||
| 740 | |||
| 741 | ret = phy_device_register(phy); | ||
| 742 | if (ret) | ||
| 743 | phy_device_free(phy); | ||
| 744 | else | ||
| 745 | pdata->phy_dev = phy; | ||
| 746 | |||
| 747 | return ret; | ||
| 748 | } | ||
| 749 | |||
| 750 | int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata) | ||
| 751 | { | ||
| 752 | struct net_device *ndev = pdata->ndev; | ||
| 753 | struct mii_bus *mdio_bus; | ||
| 754 | int ret; | ||
| 755 | |||
| 710 | mdio_bus = mdiobus_alloc(); | 756 | mdio_bus = mdiobus_alloc(); |
| 711 | if (!mdio_bus) | 757 | if (!mdio_bus) |
| 712 | return -ENOMEM; | 758 | return -ENOMEM; |
| @@ -720,7 +766,7 @@ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata) · 7 unmodified lines | |||
| 720 | mdio_bus->priv = pdata; | 766 | mdio_bus->priv = pdata; |
| 721 | mdio_bus->parent = &ndev->dev; | 767 | mdio_bus->parent = &ndev->dev; |
| 722 | 768 | ||
| 723 | ret = of_mdiobus_register(mdio_bus, mdio_np); | 769 | ret = xgene_mdiobus_register(pdata, mdio_bus); |
| 724 | if (ret) { | 770 | if (ret) { |
| 725 | netdev_err(ndev, "Failed to register MDIO bus\n"); | 771 | netdev_err(ndev, "Failed to register MDIO bus\n"); |
| 726 | mdiobus_free(mdio_bus); | 772 | mdiobus_free(mdio_bus); |
| @@ -24,6 +24,10 @@ · 23 unmodified lines | |||
| 24 | #include "xgene_enet_sgmac.h" | 24 | #include "xgene_enet_sgmac.h" |
| 25 | #include "xgene_enet_xgmac.h" | 25 | #include "xgene_enet_xgmac.h" |
| 26 | 26 | ||
| 27 | #define RES_ENET_CSR 0 | ||
| 28 | #define RES_RING_CSR 1 | ||
| 29 | #define RES_RING_CMD 2 | ||
| 30 | |||
| 27 | static void xgene_enet_init_bufpool(struct xgene_enet_desc_ring *buf_pool) | 31 | static void xgene_enet_init_bufpool(struct xgene_enet_desc_ring *buf_pool) |
| 28 | { | 32 | { |
| 29 | struct xgene_enet_raw_desc16 *raw_desc; | 33 | struct xgene_enet_raw_desc16 *raw_desc; |
| @@ -748,6 +752,41 @@ static const struct net_device_ops xgene_ndev_ops = { · 718 unmodified lines | |||
| 748 | .ndo_set_mac_address = xgene_enet_set_mac_address, | 752 | .ndo_set_mac_address = xgene_enet_set_mac_address, |
| 749 | }; | 753 | }; |
| 750 | 754 | ||
| 755 | static int xgene_get_mac_address(struct device *dev, | ||
| 756 | unsigned char *addr) | ||
| 757 | { | ||
| 758 | int ret; | ||
| 759 | |||
| 760 | ret = device_property_read_u8_array(dev, "local-mac-address", addr, 6); | ||
| 761 | if (ret) | ||
| 762 | ret = device_property_read_u8_array(dev, "mac-address", | ||
| 763 | addr, 6); | ||
| 764 | if (ret) | ||
| 765 | return -ENODEV; | ||
| 766 | |||
| 767 | return ETH_ALEN; | ||
| 768 | } | ||
| 769 | |||
| 770 | static int xgene_get_phy_mode(struct device *dev) | ||
| 771 | { | ||
| 772 | int i, ret; | ||
| 773 | char *modestr; | ||
| 774 | |||
| 775 | ret = device_property_read_string(dev, "phy-connection-type", | ||
| 776 | (const char **)&modestr); | ||
| 777 | if (ret) | ||
| 778 | ret = device_property_read_string(dev, "phy-mode", | ||
| 779 | (const char **)&modestr); | ||
| 780 | if (ret) | ||
| 781 | return -ENODEV; | ||
| 782 | |||
| 783 | for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++) { | ||
| 784 | if (!strcasecmp(modestr, phy_modes(i))) | ||
| 785 | return i; | ||
| 786 | } | ||
| 787 | return -ENODEV; | ||
| 788 | } | ||
| 789 | |||
| 751 | static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) | 790 | static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) |
| 752 | { | 791 | { |
| 753 | struct platform_device *pdev; | 792 | struct platform_device *pdev; |
| @@ -755,32 +794,45 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 1 unmodified line | |||
| 755 | struct device *dev; | 794 | struct device *dev; |
| 756 | struct resource *res; | 795 | struct resource *res; |
| 757 | void __iomem *base_addr; | 796 | void __iomem *base_addr; |
| 758 | const char *mac; | ||
| 759 | int ret; | 797 | int ret; |
| 760 | 798 | ||
| 761 | pdev = pdata->pdev; | 799 | pdev = pdata->pdev; |
| 762 | dev = &pdev->dev; | 800 | dev = &pdev->dev; |
| 763 | ndev = pdata->ndev; | 801 | ndev = pdata->ndev; |
| 764 | 802 | ||
| 765 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "enet_csr"); | 803 | res = platform_get_resource(pdev, IORESOURCE_MEM, RES_ENET_CSR); |
| 766 | pdata->base_addr = devm_ioremap_resource(dev, res); | 804 | if (!res) { |
| 767 | if (IS_ERR(pdata->base_addr)) { | 805 | dev_err(dev, "Resource enet_csr not defined\n"); |
| 806 | return -ENODEV; | ||
| 807 | } | ||
| 808 | pdata->base_addr = devm_ioremap(dev, res->start, resource_size(res)); | ||
| 809 | if (!pdata->base_addr) { | ||
| 768 | dev_err(dev, "Unable to retrieve ENET Port CSR region\n"); | 810 | dev_err(dev, "Unable to retrieve ENET Port CSR region\n"); |
| 769 | return PTR_ERR(pdata->base_addr); | 811 | return -ENOMEM; |
| 770 | } | 812 | } |
| 771 | 813 | ||
| 772 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_csr"); | 814 | res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CSR); |
| 773 | pdata->ring_csr_addr = devm_ioremap_resource(dev, res); | 815 | if (!res) { |
| 774 | if (IS_ERR(pdata->ring_csr_addr)) { | 816 | dev_err(dev, "Resource ring_csr not defined\n"); |
| 817 | return -ENODEV; | ||
| 818 | } | ||
| 819 | pdata->ring_csr_addr = devm_ioremap(dev, res->start, | ||
| 820 | resource_size(res)); | ||
| 821 | if (!pdata->ring_csr_addr) { | ||
| 775 | dev_err(dev, "Unable to retrieve ENET Ring CSR region\n"); | 822 | dev_err(dev, "Unable to retrieve ENET Ring CSR region\n"); |
| 776 | return PTR_ERR(pdata->ring_csr_addr); | 823 | return -ENOMEM; |
| 777 | } | 824 | } |
| 778 | 825 | ||
| 779 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_cmd"); | 826 | res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CMD); |
| 780 | pdata->ring_cmd_addr = devm_ioremap_resource(dev, res); | 827 | if (!res) { |
| 781 | if (IS_ERR(pdata->ring_cmd_addr)) { | 828 | dev_err(dev, "Resource ring_cmd not defined\n"); |
| 829 | return -ENODEV; | ||
| 830 | } | ||
| 831 | pdata->ring_cmd_addr = devm_ioremap(dev, res->start, | ||
| 832 | resource_size(res)); | ||
| 833 | if (!pdata->ring_cmd_addr) { | ||
| 782 | dev_err(dev, "Unable to retrieve ENET Ring command region\n"); | 834 | dev_err(dev, "Unable to retrieve ENET Ring command region\n"); |
| 783 | return PTR_ERR(pdata->ring_cmd_addr); | 835 | return -ENOMEM; |
| 784 | } | 836 | } |
| 785 | 837 | ||
| 786 | ret = platform_get_irq(pdev, 0); | 838 | ret = platform_get_irq(pdev, 0); |
| @@ -791,14 +843,12 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 4 unmodified lines | |||
| 791 | } | 843 | } |
| 792 | pdata->rx_irq = ret; | 844 | pdata->rx_irq = ret; |
| 793 | 845 | ||
| 794 | mac = of_get_mac_address(dev->of_node); | 846 | if (xgene_get_mac_address(dev, ndev->dev_addr) != ETH_ALEN) |
| 795 | if (mac) | ||
| 796 | memcpy(ndev->dev_addr, mac, ndev->addr_len); | ||
| 797 | else | ||
| 798 | eth_hw_addr_random(ndev); | 847 | eth_hw_addr_random(ndev); |
| 848 | |||
| 799 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); | 849 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); |
| 800 | 850 | ||
| 801 | pdata->phy_mode = of_get_phy_mode(pdev->dev.of_node); | 851 | pdata->phy_mode = xgene_get_phy_mode(dev); |
| 802 | if (pdata->phy_mode < 0) { | 852 | if (pdata->phy_mode < 0) { |
| 803 | dev_err(dev, "Unable to get phy-connection-type\n"); | 853 | dev_err(dev, "Unable to get phy-connection-type\n"); |
| 804 | return pdata->phy_mode; | 854 | return pdata->phy_mode; |
| @@ -811,11 +861,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) · 6 unmodified lines | |||
| 811 | } | 861 | } |
| 812 | 862 | ||
| 813 | pdata->clk = devm_clk_get(&pdev->dev, NULL); | 863 | pdata->clk = devm_clk_get(&pdev->dev, NULL); |
| 814 | ret = IS_ERR(pdata->clk); | ||
| 815 | if (IS_ERR(pdata->clk)) { | 864 | if (IS_ERR(pdata->clk)) { |
| 816 | dev_err(&pdev->dev, "can't get clock\n"); | 865 | /* Firmware may have set up the clock already. */ |
| 817 | ret = PTR_ERR(pdata->clk); | 866 | pdata->clk = NULL; |
| 818 | return ret; | ||
| 819 | } | 867 | } |
| 820 | 868 | ||
| 821 | base_addr = pdata->base_addr; | 869 | base_addr = pdata->base_addr; |
| @@ -926,7 +974,7 @@ static int xgene_enet_probe(struct platform_device *pdev) · 104 unmodified lines | |||
| 926 | goto err; | 974 | goto err; |
| 927 | } | 975 | } |
| 928 | 976 | ||
| 929 | ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); | 977 | ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); |
| 930 | if (ret) { | 978 | if (ret) { |
| 931 | netdev_err(ndev, "No usable DMA configuration\n"); | 979 | netdev_err(ndev, "No usable DMA configuration\n"); |
| 932 | goto err; | 980 | goto err; |
| @@ -974,17 +1022,26 @@ static int xgene_enet_remove(struct platform_device *pdev) · 41 unmodified lines | |||
| 974 | return 0; | 1022 | return 0; |
| 975 | } | 1023 | } |
| 976 | 1024 | ||
| 977 | static struct of_device_id xgene_enet_match[] = { | 1025 | #ifdef CONFIG_ACPI |
| 1026 | static const struct acpi_device_id xgene_enet_acpi_match[] = { | ||
| 1027 | { "APMC0D05", }, | ||
| 1028 | { } | ||
| 1029 | }; | ||
| 1030 | MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match); | ||
| 1031 | #endif | ||
| 1032 | |||
| 1033 | static struct of_device_id xgene_enet_of_match[] = { | ||
| 978 | {.compatible = "apm,xgene-enet",}, | 1034 | {.compatible = "apm,xgene-enet",}, |
| 979 | {}, | 1035 | {}, |
| 980 | }; | 1036 | }; |
| 981 | 1037 | ||
| 982 | MODULE_DEVICE_TABLE(of, xgene_enet_match); | 1038 | MODULE_DEVICE_TABLE(of, xgene_enet_of_match); |
| 983 | 1039 | ||
| 984 | static struct platform_driver xgene_enet_driver = { | 1040 | static struct platform_driver xgene_enet_driver = { |
| 985 | .driver = { | 1041 | .driver = { |
| 986 | .name = "xgene-enet", | 1042 | .name = "xgene-enet", |
| 987 | .of_match_table = xgene_enet_match, | 1043 | .of_match_table = of_match_ptr(xgene_enet_of_match), |
| 1044 | .acpi_match_table = ACPI_PTR(xgene_enet_acpi_match), | ||
| 988 | }, | 1045 | }, |
| 989 | .probe = xgene_enet_probe, | 1046 | .probe = xgene_enet_probe, |
| 990 | .remove = xgene_enet_remove, | 1047 | .remove = xgene_enet_remove, |
| @@ -22,7 +22,10 @@ · 21 unmodified lines | |||
| 22 | #ifndef __XGENE_ENET_MAIN_H__ | 22 | #ifndef __XGENE_ENET_MAIN_H__ |
| 23 | #define __XGENE_ENET_MAIN_H__ | 23 | #define __XGENE_ENET_MAIN_H__ |
| 24 | 24 | ||
| 25 | #include <linux/acpi.h> | ||
| 25 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
| 27 | #include <linux/efi.h> | ||
| 28 | #include <linux/io.h> | ||
| 26 | #include <linux/of_platform.h> | 29 | #include <linux/of_platform.h> |
| 27 | #include <linux/of_net.h> | 30 | #include <linux/of_net.h> |
| 28 | #include <linux/of_mdio.h> | 31 | #include <linux/of_mdio.h> |
| @@ -2235,8 +2235,8 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, · 2234 unmodified lines | |||
| 2235 | return NETDEV_TX_OK; | 2235 | return NETDEV_TX_OK; |
| 2236 | } | 2236 | } |
| 2237 | 2237 | ||
| 2238 | if (unlikely(vlan_tx_tag_present(skb))) { | 2238 | if (unlikely(skb_vlan_tag_present(skb))) { |
| 2239 | u16 vlan = vlan_tx_tag_get(skb); | 2239 | u16 vlan = skb_vlan_tag_get(skb); |
| 2240 | __le16 tag; | 2240 | __le16 tag; |
| 2241 | 2241 | ||
| 2242 | vlan = cpu_to_le16(vlan); | 2242 | vlan = cpu_to_le16(vlan); |
| @@ -1892,8 +1892,8 @@ static netdev_tx_t atl1e_xmit_frame(struct sk_buff *skb, · 1891 unmodified lines | |||
| 1892 | 1892 | ||
| 1893 | tpd = atl1e_get_tpd(adapter); | 1893 | tpd = atl1e_get_tpd(adapter); |
| 1894 | 1894 | ||
| 1895 | if (vlan_tx_tag_present(skb)) { | 1895 | if (skb_vlan_tag_present(skb)) { |
| 1896 | u16 vlan_tag = vlan_tx_tag_get(skb); | 1896 | u16 vlan_tag = skb_vlan_tag_get(skb); |
| 1897 | u16 atl1e_vlan_tag; | 1897 | u16 atl1e_vlan_tag; |
| 1898 | 1898 | ||
| 1899 | tpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; | 1899 | tpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; |
| @@ -2373,9 +2373,8 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 473 unmodified lines | |||
| 2373 | 2373 | ||
| 2374 | netif_napi_add(netdev, &adapter->napi, atl1e_clean, 64); | 2374 | netif_napi_add(netdev, &adapter->napi, atl1e_clean, 64); |
| 2375 | 2375 | ||
| 2376 | init_timer(&adapter->phy_config_timer); | 2376 | setup_timer(&adapter->phy_config_timer, atl1e_phy_config, |
| 2377 | adapter->phy_config_timer.function = atl1e_phy_config; | 2377 | (unsigned long)adapter); |
| 2378 | adapter->phy_config_timer.data = (unsigned long) adapter; | ||
| 2379 | 2378 | ||
| 2380 | /* get user settings */ | 2379 | /* get user settings */ |
| 2381 | atl1e_check_options(adapter); | 2380 | atl1e_check_options(adapter); |
| @@ -2415,8 +2415,8 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb, · 2414 unmodified lines | |||
| 2415 | (u16) atomic_read(&tpd_ring->next_to_use)); | 2415 | (u16) atomic_read(&tpd_ring->next_to_use)); |
| 2416 | memset(ptpd, 0, sizeof(struct tx_packet_desc)); | 2416 | memset(ptpd, 0, sizeof(struct tx_packet_desc)); |
| 2417 | 2417 | ||
| 2418 | if (vlan_tx_tag_present(skb)) { | 2418 | if (skb_vlan_tag_present(skb)) { |
| 2419 | vlan_tag = vlan_tx_tag_get(skb); | 2419 | vlan_tag = skb_vlan_tag_get(skb); |
| 2420 | vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) | | 2420 | vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) | |
| 2421 | ((vlan_tag >> 9) & 0x8); | 2421 | ((vlan_tag >> 9) & 0x8); |
| 2422 | ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; | 2422 | ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; |
| @@ -887,8 +887,8 @@ static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb, · 886 unmodified lines | |||
| 887 | offset = ((u32)(skb->len-copy_len + 3) & ~3); | 887 | offset = ((u32)(skb->len-copy_len + 3) & ~3); |
| 888 | } | 888 | } |
| 889 | #ifdef NETIF_F_HW_VLAN_CTAG_TX | 889 | #ifdef NETIF_F_HW_VLAN_CTAG_TX |
| 890 | if (vlan_tx_tag_present(skb)) { | 890 | if (skb_vlan_tag_present(skb)) { |
| 891 | u16 vlan_tag = vlan_tx_tag_get(skb); | 891 | u16 vlan_tag = skb_vlan_tag_get(skb); |
| 892 | vlan_tag = (vlan_tag << 4) | | 892 | vlan_tag = (vlan_tag << 4) | |
| 893 | (vlan_tag >> 13) | | 893 | (vlan_tag >> 13) | |
| 894 | ((vlan_tag >> 9) & 0x8); | 894 | ((vlan_tag >> 9) & 0x8); |
| @@ -1436,13 +1436,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 541 unmodified lines | |||
| 1436 | 1436 | ||
| 1437 | atl2_check_options(adapter); | 1437 | atl2_check_options(adapter); |
| 1438 | 1438 | ||
| 1439 | init_timer(&adapter->watchdog_timer); | 1439 | setup_timer(&adapter->watchdog_timer, atl2_watchdog, |
| 1440 | adapter->watchdog_timer.function = atl2_watchdog; | 1440 | (unsigned long)adapter); |
| 1441 | adapter->watchdog_timer.data = (unsigned long) adapter; | ||
| 1442 | 1441 | ||
| 1443 | init_timer(&adapter->phy_config_timer); | 1442 | setup_timer(&adapter->phy_config_timer, atl2_phy_config, |
| 1444 | adapter->phy_config_timer.function = atl2_phy_config; | 1443 | (unsigned long)adapter); |
| 1445 | adapter->phy_config_timer.data = (unsigned long) adapter; | ||
| 1446 | 1444 | ||
| 1447 | INIT_WORK(&adapter->reset_task, atl2_reset_task); | 1445 | INIT_WORK(&adapter->reset_task, atl2_reset_task); |
| 1448 | INIT_WORK(&adapter->link_chg_task, atl2_link_chg_task); | 1446 | INIT_WORK(&adapter->link_chg_task, atl2_link_chg_task); |
| @@ -6597,9 +6597,9 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) · 6596 unmodified lines | |||
| 6597 | vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM; | 6597 | vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM; |
| 6598 | } | 6598 | } |
| 6599 | 6599 | ||
| 6600 | if (vlan_tx_tag_present(skb)) { | 6600 | if (skb_vlan_tag_present(skb)) { |
| 6601 | vlan_tag_flags |= | 6601 | vlan_tag_flags |= |
| 6602 | (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); | 6602 | (TX_BD_FLAGS_VLAN_TAG | (skb_vlan_tag_get(skb) << 16)); |
| 6603 | } | 6603 | } |
| 6604 | 6604 | ||
| 6605 | if ((mss = skb_shinfo(skb)->gso_size)) { | 6605 | if ((mss = skb_shinfo(skb)->gso_size)) { |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #include <linux/ptp_clock_kernel.h> | 23 | #include <linux/ptp_clock_kernel.h> |
| 24 | #include <linux/net_tstamp.h> | 24 | #include <linux/net_tstamp.h> |
| 25 | #include <linux/clocksource.h> | 25 | #include <linux/timecounter.h> |
| 26 | 26 | ||
| 27 | /* compilation time flags */ | 27 | /* compilation time flags */ |
| 28 | 28 | ||
| @@ -1138,12 +1138,8 @@ struct bnx2x_port { · 1109 unmodified lines | |||
| 1138 | u32 link_config[LINK_CONFIG_SIZE]; | 1138 | u32 link_config[LINK_CONFIG_SIZE]; |
| 1139 | 1139 | ||
| 1140 | u32 supported[LINK_CONFIG_SIZE]; | 1140 | u32 supported[LINK_CONFIG_SIZE]; |
| 1141 | /* link settings - missing defines */ | ||
| 1142 | #define SUPPORTED_2500baseX_Full (1 << 15) | ||
| 1143 | 1141 | ||
| 1144 | u32 advertising[LINK_CONFIG_SIZE]; | 1142 | u32 advertising[LINK_CONFIG_SIZE]; |
| 1145 | /* link settings - missing defines */ | ||
| 1146 | #define ADVERTISED_2500baseX_Full (1 << 15) | ||
| 1147 | 1143 | ||
| 1148 | u32 phy_addr; | 1144 | u32 phy_addr; |
| 1149 | 1145 | ||
| @@ -3865,9 +3865,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3864 unmodified lines | |||
| 3865 | "sending pkt %u @%p next_idx %u bd %u @%p\n", | 3865 | "sending pkt %u @%p next_idx %u bd %u @%p\n", |
| 3866 | pkt_prod, tx_buf, txdata->tx_pkt_prod, bd_prod, tx_start_bd); | 3866 | pkt_prod, tx_buf, txdata->tx_pkt_prod, bd_prod, tx_start_bd); |
| 3867 | 3867 | ||
| 3868 | if (vlan_tx_tag_present(skb)) { | 3868 | if (skb_vlan_tag_present(skb)) { |
| 3869 | tx_start_bd->vlan_or_ethertype = | 3869 | tx_start_bd->vlan_or_ethertype = |
| 3870 | cpu_to_le16(vlan_tx_tag_get(skb)); | 3870 | cpu_to_le16(skb_vlan_tag_get(skb)); |
| 3871 | tx_start_bd->bd_flags.as_bitfield |= | 3871 | tx_start_bd->bd_flags.as_bitfield |= |
| 3872 | (X_ETH_OUTBAND_VLAN << ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); | 3872 | (X_ETH_OUTBAND_VLAN << ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); |
| 3873 | } else { | 3873 | } else { |
| @@ -9169,7 +9169,7 @@ static void bnx2x_disable_ptp(struct bnx2x *bp) · 9168 unmodified lines | |||
| 9169 | } | 9169 | } |
| 9170 | 9170 | ||
| 9171 | /* Called during unload, to stop PTP-related stuff */ | 9171 | /* Called during unload, to stop PTP-related stuff */ |
| 9172 | void bnx2x_stop_ptp(struct bnx2x *bp) | 9172 | static void bnx2x_stop_ptp(struct bnx2x *bp) |
| 9173 | { | 9173 | { |
| 9174 | /* Cancel PTP work queue. Should be done after the Tx queues are | 9174 | /* Cancel PTP work queue. Should be done after the Tx queues are |
| 9175 | * drained to prevent additional scheduling. | 9175 | * drained to prevent additional scheduling. |
| @@ -13267,14 +13267,10 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 4091 unmodified lines | |||
| 13267 | static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) | 13267 | static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) |
| 13268 | { | 13268 | { |
| 13269 | struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); | 13269 | struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); |
| 13270 | u64 now; | ||
| 13271 | 13270 | ||
| 13272 | DP(BNX2X_MSG_PTP, "PTP adjtime called, delta = %llx\n", delta); | 13271 | DP(BNX2X_MSG_PTP, "PTP adjtime called, delta = %llx\n", delta); |
| 13273 | 13272 | ||
| 13274 | now = timecounter_read(&bp->timecounter); | 13273 | timecounter_adjtime(&bp->timecounter, delta); |
| 13275 | now += delta; | ||
| 13276 | /* Re-init the timecounter */ | ||
| 13277 | timecounter_init(&bp->timecounter, &bp->cyclecounter, now); | ||
| 13278 | 13274 | ||
| 13279 | return 0; | 13275 | return 0; |
| 13280 | } | 13276 | } |
| @@ -13322,7 +13318,7 @@ static int bnx2x_ptp_enable(struct ptp_clock_info *ptp, · 41 unmodified lines | |||
| 13322 | return -ENOTSUPP; | 13318 | return -ENOTSUPP; |
| 13323 | } | 13319 | } |
| 13324 | 13320 | ||
| 13325 | void bnx2x_register_phc(struct bnx2x *bp) | 13321 | static void bnx2x_register_phc(struct bnx2x *bp) |
| 13326 | { | 13322 | { |
| 13327 | /* Fill the ptp_clock_info struct and register PTP clock*/ | 13323 | /* Fill the ptp_clock_info struct and register PTP clock*/ |
| 13328 | bp->ptp_clock_info.owner = THIS_MODULE; | 13324 | bp->ptp_clock_info.owner = THIS_MODULE; |
| @@ -14614,7 +14610,7 @@ static void bnx2x_init_cyclecounter(struct bnx2x *bp) · 1285 unmodified lines | |||
| 14614 | { | 14610 | { |
| 14615 | memset(&bp->cyclecounter, 0, sizeof(bp->cyclecounter)); | 14611 | memset(&bp->cyclecounter, 0, sizeof(bp->cyclecounter)); |
| 14616 | bp->cyclecounter.read = bnx2x_cyclecounter_read; | 14612 | bp->cyclecounter.read = bnx2x_cyclecounter_read; |
| 14617 | bp->cyclecounter.mask = CLOCKSOURCE_MASK(64); | 14613 | bp->cyclecounter.mask = CYCLECOUNTER_MASK(64); |
| 14618 | bp->cyclecounter.shift = 1; | 14614 | bp->cyclecounter.shift = 1; |
| 14619 | bp->cyclecounter.mult = 1; | 14615 | bp->cyclecounter.mult = 1; |
| 14620 | } | 14616 | } |
| @@ -14639,7 +14635,7 @@ static int bnx2x_send_reset_timesync_ramrod(struct bnx2x *bp) · 18 unmodified lines | |||
| 14639 | return bnx2x_func_state_change(bp, &func_params); | 14635 | return bnx2x_func_state_change(bp, &func_params); |
| 14640 | } | 14636 | } |
| 14641 | 14637 | ||
| 14642 | int bnx2x_enable_ptp_packets(struct bnx2x *bp) | 14638 | static int bnx2x_enable_ptp_packets(struct bnx2x *bp) |
| 14643 | { | 14639 | { |
| 14644 | struct bnx2x_queue_state_params q_params; | 14640 | struct bnx2x_queue_state_params q_params; |
| 14645 | int rc, i; | 14641 | int rc, i; |
| @@ -8008,9 +8008,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · 8007 unmodified lines | |||
| 8008 | !mss && skb->len > VLAN_ETH_FRAME_LEN) | 8008 | !mss && skb->len > VLAN_ETH_FRAME_LEN) |
| 8009 | base_flags |= TXD_FLAG_JMB_PKT; | 8009 | base_flags |= TXD_FLAG_JMB_PKT; |
| 8010 | 8010 | ||
| 8011 | if (vlan_tx_tag_present(skb)) { | 8011 | if (skb_vlan_tag_present(skb)) { |
| 8012 | base_flags |= TXD_FLAG_VLAN; | 8012 | base_flags |= TXD_FLAG_VLAN; |
| 8013 | vlan = vlan_tx_tag_get(skb); | 8013 | vlan = skb_vlan_tag_get(skb); |
| 8014 | } | 8014 | } |
| 8015 | 8015 | ||
| 8016 | if ((unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) && | 8016 | if ((unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) && |
| @@ -11573,11 +11573,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, · 3556 unmodified lines | |||
| 11573 | tg3_flag_set(tp, INIT_COMPLETE); | 11573 | tg3_flag_set(tp, INIT_COMPLETE); |
| 11574 | tg3_enable_ints(tp); | 11574 | tg3_enable_ints(tp); |
| 11575 | 11575 | ||
| 11576 | if (init) | 11576 | tg3_ptp_resume(tp); |
| 11577 | tg3_ptp_init(tp); | ||
| 11578 | else | ||
| 11579 | tg3_ptp_resume(tp); | ||
| 11580 | |||
| 11581 | 11577 | ||
| 11582 | tg3_full_unlock(tp); | 11578 | tg3_full_unlock(tp); |
| 11583 | 11579 | ||
| @@ -11698,13 +11694,6 @@ static int tg3_open(struct net_device *dev) · 114 unmodified lines | |||
| 11698 | pci_set_power_state(tp->pdev, PCI_D3hot); | 11694 | pci_set_power_state(tp->pdev, PCI_D3hot); |
| 11699 | } | 11695 | } |
| 11700 | 11696 | ||
| 11701 | if (tg3_flag(tp, PTP_CAPABLE)) { | ||
| 11702 | tp->ptp_clock = ptp_clock_register(&tp->ptp_info, | ||
| 11703 | &tp->pdev->dev); | ||
| 11704 | if (IS_ERR(tp->ptp_clock)) | ||
| 11705 | tp->ptp_clock = NULL; | ||
| 11706 | } | ||
| 11707 | |||
| 11708 | return err; | 11697 | return err; |
| 11709 | } | 11698 | } |
| 11710 | 11699 | ||
| @@ -11718,8 +11707,6 @@ static int tg3_close(struct net_device *dev) · 7 unmodified lines | |||
| 11718 | return -EAGAIN; | 11707 | return -EAGAIN; |
| 11719 | } | 11708 | } |
| 11720 | 11709 | ||
| 11721 | tg3_ptp_fini(tp); | ||
| 11722 | |||
| 11723 | tg3_stop(tp); | 11710 | tg3_stop(tp); |
| 11724 | 11711 | ||
| 11725 | /* Clear stats across close / open calls */ | 11712 | /* Clear stats across close / open calls */ |
| @@ -17897,6 +17884,14 @@ static int tg3_init_one(struct pci_dev *pdev, · 6171 unmodified lines | |||
| 17897 | goto err_out_apeunmap; | 17884 | goto err_out_apeunmap; |
| 17898 | } | 17885 | } |
| 17899 | 17886 | ||
| 17887 | if (tg3_flag(tp, PTP_CAPABLE)) { | ||
| 17888 | tg3_ptp_init(tp); | ||
| 17889 | tp->ptp_clock = ptp_clock_register(&tp->ptp_info, | ||
| 17890 | &tp->pdev->dev); | ||
| 17891 | if (IS_ERR(tp->ptp_clock)) | ||
| 17892 | tp->ptp_clock = NULL; | ||
| 17893 | } | ||
| 17894 | |||
| 17900 | netdev_info(dev, "Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n", | 17895 | netdev_info(dev, "Tigon3 [partno(%s) rev %04x] (%s) MAC address %pM\n", |
| 17901 | tp->board_part_number, | 17896 | tp->board_part_number, |
| 17902 | tg3_chip_rev_id(tp), | 17897 | tg3_chip_rev_id(tp), |
| @@ -17972,6 +17967,8 @@ static void tg3_remove_one(struct pci_dev *pdev) · 69 unmodified lines | |||
| 17972 | if (dev) { | 17967 | if (dev) { |
| 17973 | struct tg3 *tp = netdev_priv(dev); | 17968 | struct tg3 *tp = netdev_priv(dev); |
| 17974 | 17969 | ||
| 17970 | tg3_ptp_fini(tp); | ||
| 17971 | |||
| 17975 | release_firmware(tp->fw); | 17972 | release_firmware(tp->fw); |
| 17976 | 17973 | ||
| 17977 | tg3_reset_task_cancel(tp); | 17974 | tg3_reset_task_cancel(tp); |
| @@ -2824,8 +2824,8 @@ bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb, · 2823 unmodified lines | |||
| 2824 | u32 gso_size; | 2824 | u32 gso_size; |
| 2825 | u16 vlan_tag = 0; | 2825 | u16 vlan_tag = 0; |
| 2826 | 2826 | ||
| 2827 | if (vlan_tx_tag_present(skb)) { | 2827 | if (skb_vlan_tag_present(skb)) { |
| 2828 | vlan_tag = (u16)vlan_tx_tag_get(skb); | 2828 | vlan_tag = (u16)skb_vlan_tag_get(skb); |
| 2829 | flags |= (BNA_TXQ_WI_CF_INS_PRIO | BNA_TXQ_WI_CF_INS_VLAN); | 2829 | flags |= (BNA_TXQ_WI_CF_INS_PRIO | BNA_TXQ_WI_CF_INS_VLAN); |
| 2830 | } | 2830 | } |
| 2831 | if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) { | 2831 | if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) { |
| @@ -1691,7 +1691,7 @@ static int hash_get_index(__u8 *addr) · 1690 unmodified lines | |||
| 1691 | 1691 | ||
| 1692 | for (j = 0; j < 6; j++) { | 1692 | for (j = 0; j < 6; j++) { |
| 1693 | for (i = 0, bitval = 0; i < 8; i++) | 1693 | for (i = 0, bitval = 0; i < 8; i++) |
| 1694 | bitval ^= hash_bit_value(i*6 + j, addr); | 1694 | bitval ^= hash_bit_value(i * 6 + j, addr); |
| 1695 | 1695 | ||
| 1696 | hash_index |= (bitval << j); | 1696 | hash_index |= (bitval << j); |
| 1697 | } | 1697 | } |
| @@ -1827,12 +1827,23 @@ static int macb_close(struct net_device *dev) · 129 unmodified lines | |||
| 1827 | 1827 | ||
| 1828 | static void gem_update_stats(struct macb *bp) | 1828 | static void gem_update_stats(struct macb *bp) |
| 1829 | { | 1829 | { |
| 1830 | u32 __iomem *reg = bp->regs + GEM_OTX; | 1830 | int i; |
| 1831 | u32 *p = &bp->hw_stats.gem.tx_octets_31_0; | 1831 | u32 *p = &bp->hw_stats.gem.tx_octets_31_0; |
| 1832 | u32 *end = &bp->hw_stats.gem.rx_udp_checksum_errors + 1; | ||
| 1833 | 1832 | ||
| 1834 | for (; p < end; p++, reg++) | 1833 | for (i = 0; i < GEM_STATS_LEN; ++i, ++p) { |
| 1835 | *p += __raw_readl(reg); | 1834 | u32 offset = gem_statistics[i].offset; |
| 1835 | u64 val = __raw_readl(bp->regs + offset); | ||
| 1836 | |||
| 1837 | bp->ethtool_stats[i] += val; | ||
| 1838 | *p += val; | ||
| 1839 | |||
| 1840 | if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) { | ||
| 1841 | /* Add GEM_OCTTXH, GEM_OCTRXH */ | ||
| 1842 | val = __raw_readl(bp->regs + offset + 4); | ||
| 1843 | bp->ethtool_stats[i] += ((u64)val) << 32; | ||
| 1844 | *(++p) += val; | ||
| 1845 | } | ||
| 1846 | } | ||
| 1836 | } | 1847 | } |
| 1837 | 1848 | ||
| 1838 | static struct net_device_stats *gem_get_stats(struct macb *bp) | 1849 | static struct net_device_stats *gem_get_stats(struct macb *bp) |
| @@ -1873,6 +1884,39 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) · 34 unmodified lines | |||
| 1873 | return nstat; | 1884 | return nstat; |
| 1874 | } | 1885 | } |
| 1875 | 1886 | ||
| 1887 | static void gem_get_ethtool_stats(struct net_device *dev, | ||
| 1888 | struct ethtool_stats *stats, u64 *data) | ||
| 1889 | { | ||
| 1890 | struct macb *bp; | ||
| 1891 | |||
| 1892 | bp = netdev_priv(dev); | ||
| 1893 | gem_update_stats(bp); | ||
| 1894 | memcpy(data, &bp->ethtool_stats, sizeof(u64) * GEM_STATS_LEN); | ||
| 1895 | } | ||
| 1896 | |||
| 1897 | static int gem_get_sset_count(struct net_device *dev, int sset) | ||
| 1898 | { | ||
| 1899 | switch (sset) { | ||
| 1900 | case ETH_SS_STATS: | ||
| 1901 | return GEM_STATS_LEN; | ||
| 1902 | default: | ||
| 1903 | return -EOPNOTSUPP; | ||
| 1904 | } | ||
| 1905 | } | ||
| 1906 | |||
| 1907 | static void gem_get_ethtool_strings(struct net_device *dev, u32 sset, u8 *p) | ||
| 1908 | { | ||
| 1909 | int i; | ||
| 1910 | |||
| 1911 | switch (sset) { | ||
| 1912 | case ETH_SS_STATS: | ||
| 1913 | for (i = 0; i < GEM_STATS_LEN; i++, p += ETH_GSTRING_LEN) | ||
| 1914 | memcpy(p, gem_statistics[i].stat_string, | ||
| 1915 | ETH_GSTRING_LEN); | ||
| 1916 | break; | ||
| 1917 | } | ||
| 1918 | } | ||
| 1919 | |||
| 1876 | struct net_device_stats *macb_get_stats(struct net_device *dev) | 1920 | struct net_device_stats *macb_get_stats(struct net_device *dev) |
| 1877 | { | 1921 | { |
| 1878 | struct macb *bp = netdev_priv(dev); | 1922 | struct macb *bp = netdev_priv(dev); |
| @@ -1991,6 +2035,18 @@ const struct ethtool_ops macb_ethtool_ops = { · 112 unmodified lines | |||
| 1991 | }; | 2035 | }; |
| 1992 | EXPORT_SYMBOL_GPL(macb_ethtool_ops); | 2036 | EXPORT_SYMBOL_GPL(macb_ethtool_ops); |
| 1993 | 2037 | ||
| 2038 | static const struct ethtool_ops gem_ethtool_ops = { | ||
| 2039 | .get_settings = macb_get_settings, | ||
| 2040 | .set_settings = macb_set_settings, | ||
| 2041 | .get_regs_len = macb_get_regs_len, | ||
| 2042 | .get_regs = macb_get_regs, | ||
| 2043 | .get_link = ethtool_op_get_link, | ||
| 2044 | .get_ts_info = ethtool_op_get_ts_info, | ||
| 2045 | .get_ethtool_stats = gem_get_ethtool_stats, | ||
| 2046 | .get_strings = gem_get_ethtool_strings, | ||
| 2047 | .get_sset_count = gem_get_sset_count, | ||
| 2048 | }; | ||
| 2049 | |||
| 1994 | int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 2050 | int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
| 1995 | { | 2051 | { |
| 1996 | struct macb *bp = netdev_priv(dev); | 2052 | struct macb *bp = netdev_priv(dev); |
| @@ -2148,7 +2204,7 @@ static void macb_probe_queues(void __iomem *mem, · 151 unmodified lines | |||
| 2148 | (*num_queues)++; | 2204 | (*num_queues)++; |
| 2149 | } | 2205 | } |
| 2150 | 2206 | ||
| 2151 | static int __init macb_probe(struct platform_device *pdev) | 2207 | static int macb_probe(struct platform_device *pdev) |
| 2152 | { | 2208 | { |
| 2153 | struct macb_platform_data *pdata; | 2209 | struct macb_platform_data *pdata; |
| 2154 | struct resource *regs; | 2210 | struct resource *regs; |
| @@ -2278,7 +2334,6 @@ static int __init macb_probe(struct platform_device *pdev) · 123 unmodified lines | |||
| 2278 | 2334 | ||
| 2279 | dev->netdev_ops = &macb_netdev_ops; | 2335 | dev->netdev_ops = &macb_netdev_ops; |
| 2280 | netif_napi_add(dev, &bp->napi, macb_poll, 64); | 2336 | netif_napi_add(dev, &bp->napi, macb_poll, 64); |
| 2281 | dev->ethtool_ops = &macb_ethtool_ops; | ||
| 2282 | 2337 | ||
| 2283 | dev->base_addr = regs->start; | 2338 | dev->base_addr = regs->start; |
| 2284 | 2339 | ||
| @@ -2292,12 +2347,14 @@ static int __init macb_probe(struct platform_device *pdev) · 7 unmodified lines | |||
| 2292 | bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers; | 2347 | bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers; |
| 2293 | bp->macbgem_ops.mog_init_rings = gem_init_rings; | 2348 | bp->macbgem_ops.mog_init_rings = gem_init_rings; |
| 2294 | bp->macbgem_ops.mog_rx = gem_rx; | 2349 | bp->macbgem_ops.mog_rx = gem_rx; |
| 2350 | dev->ethtool_ops = &gem_ethtool_ops; | ||
| 2295 | } else { | 2351 | } else { |
| 2296 | bp->max_tx_length = MACB_MAX_TX_LEN; | 2352 | bp->max_tx_length = MACB_MAX_TX_LEN; |
| 2297 | bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers; | 2353 | bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers; |
| 2298 | bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers; | 2354 | bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers; |
| 2299 | bp->macbgem_ops.mog_init_rings = macb_init_rings; | 2355 | bp->macbgem_ops.mog_init_rings = macb_init_rings; |
| 2300 | bp->macbgem_ops.mog_rx = macb_rx; | 2356 | bp->macbgem_ops.mog_rx = macb_rx; |
| 2357 | dev->ethtool_ops = &macb_ethtool_ops; | ||
| 2301 | } | 2358 | } |
| 2302 | 2359 | ||
| 2303 | /* Set features */ | 2360 | /* Set features */ |
| @@ -2386,7 +2443,7 @@ err_out: · 82 unmodified lines | |||
| 2386 | return err; | 2443 | return err; |
| 2387 | } | 2444 | } |
| 2388 | 2445 | ||
| 2389 | static int __exit macb_remove(struct platform_device *pdev) | 2446 | static int macb_remove(struct platform_device *pdev) |
| 2390 | { | 2447 | { |
| 2391 | struct net_device *dev; | 2448 | struct net_device *dev; |
| 2392 | struct macb *bp; | 2449 | struct macb *bp; |
| @@ -2411,8 +2468,7 @@ static int __exit macb_remove(struct platform_device *pdev) · 18 unmodified lines | |||
| 2411 | return 0; | 2468 | return 0; |
| 2412 | } | 2469 | } |
| 2413 | 2470 | ||
| 2414 | #ifdef CONFIG_PM | 2471 | static int __maybe_unused macb_suspend(struct device *dev) |
| 2415 | static int macb_suspend(struct device *dev) | ||
| 2416 | { | 2472 | { |
| 2417 | struct platform_device *pdev = to_platform_device(dev); | 2473 | struct platform_device *pdev = to_platform_device(dev); |
| 2418 | struct net_device *netdev = platform_get_drvdata(pdev); | 2474 | struct net_device *netdev = platform_get_drvdata(pdev); |
| @@ -2429,7 +2485,7 @@ static int macb_suspend(struct device *dev) · 10 unmodified lines | |||
| 2429 | return 0; | 2485 | return 0; |
| 2430 | } | 2486 | } |
| 2431 | 2487 | ||
| 2432 | static int macb_resume(struct device *dev) | 2488 | static int __maybe_unused macb_resume(struct device *dev) |
| 2433 | { | 2489 | { |
| 2434 | struct platform_device *pdev = to_platform_device(dev); | 2490 | struct platform_device *pdev = to_platform_device(dev); |
| 2435 | struct net_device *netdev = platform_get_drvdata(pdev); | 2491 | struct net_device *netdev = platform_get_drvdata(pdev); |
| @@ -2444,12 +2500,12 @@ static int macb_resume(struct device *dev) · 8 unmodified lines | |||
| 2444 | 2500 | ||
| 2445 | return 0; | 2501 | return 0; |
| 2446 | } | 2502 | } |
| 2447 | #endif | ||
| 2448 | 2503 | ||
| 2449 | static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume); | 2504 | static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume); |
| 2450 | 2505 | ||
| 2451 | static struct platform_driver macb_driver = { | 2506 | static struct platform_driver macb_driver = { |
| 2452 | .remove = __exit_p(macb_remove), | 2507 | .probe = macb_probe, |
| 2508 | .remove = macb_remove, | ||
| 2453 | .driver = { | 2509 | .driver = { |
| 2454 | .name = "macb", | 2510 | .name = "macb", |
| 2455 | .of_match_table = of_match_ptr(macb_dt_ids), | 2511 | .of_match_table = of_match_ptr(macb_dt_ids), |
| @@ -2457,7 +2513,7 @@ static struct platform_driver macb_driver = { · 1 unmodified line | |||
| 2457 | }, | 2513 | }, |
| 2458 | }; | 2514 | }; |
| 2459 | 2515 | ||
| 2460 | module_platform_driver_probe(macb_driver, macb_probe); | 2516 | module_platform_driver(macb_driver); |
| 2461 | 2517 | ||
| 2462 | MODULE_LICENSE("GPL"); | 2518 | MODULE_LICENSE("GPL"); |
| 2463 | MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver"); | 2519 | MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver"); |
| @@ -15,263 +15,309 @@ · 14 unmodified lines | |||
| 15 | #define MACB_MAX_QUEUES 8 | 15 | #define MACB_MAX_QUEUES 8 |
| 16 | 16 | ||
| 17 | /* MACB register offsets */ | 17 | /* MACB register offsets */ |
| 18 | #define MACB_NCR 0x0000 | 18 | #define MACB_NCR 0x0000 /* Network Control */ |
| 19 | #define MACB_NCFGR 0x0004 | 19 | #define MACB_NCFGR 0x0004 /* Network Config */ |
| 20 | #define MACB_NSR 0x0008 | 20 | #define MACB_NSR 0x0008 /* Network Status */ |
| 21 | #define MACB_TAR 0x000c /* AT91RM9200 only */ | 21 | #define MACB_TAR 0x000c /* AT91RM9200 only */ |
| 22 | #define MACB_TCR 0x0010 /* AT91RM9200 only */ | 22 | #define MACB_TCR 0x0010 /* AT91RM9200 only */ |
| 23 | #define MACB_TSR 0x0014 | 23 | #define MACB_TSR 0x0014 /* Transmit Status */ |
| 24 | #define MACB_RBQP 0x0018 | 24 | #define MACB_RBQP 0x0018 /* RX Q Base Address */ |
| 25 | #define MACB_TBQP 0x001c | 25 | #define MACB_TBQP 0x001c /* TX Q Base Address */ |
| 26 | #define MACB_RSR 0x0020 | 26 | #define MACB_RSR 0x0020 /* Receive Status */ |
| 27 | #define MACB_ISR 0x0024 | 27 | #define MACB_ISR 0x0024 /* Interrupt Status */ |
| 28 | #define MACB_IER 0x0028 | 28 | #define MACB_IER 0x0028 /* Interrupt Enable */ |
| 29 | #define MACB_IDR 0x002c | 29 | #define MACB_IDR 0x002c /* Interrupt Disable */ |
| 30 | #define MACB_IMR 0x0030 | 30 | #define MACB_IMR 0x0030 /* Interrupt Mask */ |
| 31 | #define MACB_MAN 0x0034 | 31 | #define MACB_MAN 0x0034 /* PHY Maintenance */ |
| 32 | #define MACB_PTR 0x0038 | 32 | #define MACB_PTR 0x0038 |
| 33 | #define MACB_PFR 0x003c | 33 | #define MACB_PFR 0x003c |
| 34 | #define MACB_FTO 0x0040 | 34 | #define MACB_FTO 0x0040 |
| 35 | #define MACB_SCF 0x0044 | 35 | #define MACB_SCF 0x0044 |
| 36 | #define MACB_MCF 0x0048 | 36 | #define MACB_MCF 0x0048 |
| 37 | #define MACB_FRO 0x004c | 37 | #define MACB_FRO 0x004c |
| 38 | #define MACB_FCSE 0x0050 | 38 | #define MACB_FCSE 0x0050 |
| 39 | #define MACB_ALE 0x0054 | 39 | #define MACB_ALE 0x0054 |
| 40 | #define MACB_DTF 0x0058 | 40 | #define MACB_DTF 0x0058 |
| 41 | #define MACB_LCOL 0x005c | 41 | #define MACB_LCOL 0x005c |
| 42 | #define MACB_EXCOL 0x0060 | 42 | #define MACB_EXCOL 0x0060 |
| 43 | #define MACB_TUND 0x0064 | 43 | #define MACB_TUND 0x0064 |
| 44 | #define MACB_CSE 0x0068 | 44 | #define MACB_CSE 0x0068 |
| 45 | #define MACB_RRE 0x006c | 45 | #define MACB_RRE 0x006c |
| 46 | #define MACB_ROVR 0x0070 | 46 | #define MACB_ROVR 0x0070 |
| 47 | #define MACB_RSE 0x0074 | 47 | #define MACB_RSE 0x0074 |
| 48 | #define MACB_ELE 0x0078 | 48 | #define MACB_ELE 0x0078 |
| 49 | #define MACB_RJA 0x007c | 49 | #define MACB_RJA 0x007c |
| 50 | #define MACB_USF 0x0080 | 50 | #define MACB_USF 0x0080 |
| 51 | #define MACB_STE 0x0084 | 51 | #define MACB_STE 0x0084 |
| 52 | #define MACB_RLE 0x0088 | 52 | #define MACB_RLE 0x0088 |
| 53 | #define MACB_TPF 0x008c | 53 | #define MACB_TPF 0x008c |
| 54 | #define MACB_HRB 0x0090 | 54 | #define MACB_HRB 0x0090 |
| 55 | #define MACB_HRT 0x0094 | 55 | #define MACB_HRT 0x0094 |
| 56 | #define MACB_SA1B 0x0098 | 56 | #define MACB_SA1B 0x0098 |
| 57 | #define MACB_SA1T 0x009c | 57 | #define MACB_SA1T 0x009c |
| 58 | #define MACB_SA2B 0x00a0 | 58 | #define MACB_SA2B 0x00a0 |
| 59 | #define MACB_SA2T 0x00a4 | 59 | #define MACB_SA2T 0x00a4 |
| 60 | #define MACB_SA3B 0x00a8 | 60 | #define MACB_SA3B 0x00a8 |
| 61 | #define MACB_SA3T 0x00ac | 61 | #define MACB_SA3T 0x00ac |
| 62 | #define MACB_SA4B 0x00b0 | 62 | #define MACB_SA4B 0x00b0 |
| 63 | #define MACB_SA4T 0x00b4 | 63 | #define MACB_SA4T 0x00b4 |
| 64 | #define MACB_TID 0x00b8 | 64 | #define MACB_TID 0x00b8 |
| 65 | #define MACB_TPQ 0x00bc | 65 | #define MACB_TPQ 0x00bc |
| 66 | #define MACB_USRIO 0x00c0 | 66 | #define MACB_USRIO 0x00c0 |
| 67 | #define MACB_WOL 0x00c4 | 67 | #define MACB_WOL 0x00c4 |
| 68 | #define MACB_MID 0x00fc | 68 | #define MACB_MID 0x00fc |
| 69 | 69 | ||
| 70 | /* GEM register offsets. */ | 70 | /* GEM register offsets. */ |
| 71 | #define GEM_NCFGR 0x0004 | 71 | #define GEM_NCFGR 0x0004 /* Network Config */ |
| 72 | #define GEM_USRIO 0x000c | 72 | #define GEM_USRIO 0x000c /* User IO */ |
| 73 | #define GEM_DMACFG 0x0010 | 73 | #define GEM_DMACFG 0x0010 /* DMA Configuration */ |
| 74 | #define GEM_HRB 0x0080 | 74 | #define GEM_HRB 0x0080 /* Hash Bottom */ |
| 75 | #define GEM_HRT 0x0084 | 75 | #define GEM_HRT 0x0084 /* Hash Top */ |
| 76 | #define GEM_SA1B 0x0088 | 76 | #define GEM_SA1B 0x0088 /* Specific1 Bottom */ |
| 77 | #define GEM_SA1T 0x008C | 77 | #define GEM_SA1T 0x008C /* Specific1 Top */ |
| 78 | #define GEM_SA2B 0x0090 | 78 | #define GEM_SA2B 0x0090 /* Specific2 Bottom */ |
| 79 | #define GEM_SA2T 0x0094 | 79 | #define GEM_SA2T 0x0094 /* Specific2 Top */ |
| 80 | #define GEM_SA3B 0x0098 | 80 | #define GEM_SA3B 0x0098 /* Specific3 Bottom */ |
| 81 | #define GEM_SA3T 0x009C | 81 | #define GEM_SA3T 0x009C /* Specific3 Top */ |
| 82 | #define GEM_SA4B 0x00A0 | 82 | #define GEM_SA4B 0x00A0 /* Specific4 Bottom */ |
| 83 | #define GEM_SA4T 0x00A4 | 83 | #define GEM_SA4T 0x00A4 /* Specific4 Top */ |
| 84 | #define GEM_OTX 0x0100 | 84 | #define GEM_OTX 0x0100 /* Octets transmitted */ |
| 85 | #define GEM_DCFG1 0x0280 | 85 | #define GEM_OCTTXL 0x0100 /* Octets transmitted [31:0] */ |
| 86 | #define GEM_DCFG2 0x0284 | 86 | #define GEM_OCTTXH 0x0104 /* Octets transmitted [47:32] */ |
| 87 | #define GEM_DCFG3 0x0288 | 87 | #define GEM_TXCNT 0x0108 /* Frames Transmitted counter */ |
| 88 | #define GEM_DCFG4 0x028c | 88 | #define GEM_TXBCCNT 0x010c /* Broadcast Frames counter */ |
| 89 | #define GEM_DCFG5 0x0290 | 89 | #define GEM_TXMCCNT 0x0110 /* Multicast Frames counter */ |
| 90 | #define GEM_DCFG6 0x0294 | 90 | #define GEM_TXPAUSECNT 0x0114 /* Pause Frames Transmitted Counter */ |
| 91 | #define GEM_DCFG7 0x0298 | 91 | #define GEM_TX64CNT 0x0118 /* 64 byte Frames TX counter */ |
| 92 | 92 | #define GEM_TX65CNT 0x011c /* 65-127 byte Frames TX counter */ | |
| 93 | #define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2)) | 93 | #define GEM_TX128CNT 0x0120 /* 128-255 byte Frames TX counter */ |
| 94 | #define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2)) | 94 | #define GEM_TX256CNT 0x0124 /* 256-511 byte Frames TX counter */ |
| 95 | #define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2)) | 95 | #define GEM_TX512CNT 0x0128 /* 512-1023 byte Frames TX counter */ |
| 96 | #define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2)) | 96 | #define GEM_TX1024CNT 0x012c /* 1024-1518 byte Frames TX counter */ |
| 97 | #define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2)) | 97 | #define GEM_TX1519CNT 0x0130 /* 1519+ byte Frames TX counter */ |
| 98 | #define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2)) | 98 | #define GEM_TXURUNCNT 0x0134 /* TX under run error counter */ |
| 99 | #define GEM_SNGLCOLLCNT 0x0138 /* Single Collision Frame Counter */ | ||
| 100 | #define GEM_MULTICOLLCNT 0x013c /* Multiple Collision Frame Counter */ | ||
| 101 | #define GEM_EXCESSCOLLCNT 0x0140 /* Excessive Collision Frame Counter */ | ||
| 102 | #define GEM_LATECOLLCNT 0x0144 /* Late Collision Frame Counter */ | ||
| 103 | #define GEM_TXDEFERCNT 0x0148 /* Deferred Transmission Frame Counter */ | ||
| 104 | #define GEM_TXCSENSECNT 0x014c /* Carrier Sense Error Counter */ | ||
| 105 | #define GEM_ORX 0x0150 /* Octets received */ | ||
| 106 | #define GEM_OCTRXL 0x0150 /* Octets received [31:0] */ | ||
| 107 | #define GEM_OCTRXH 0x0154 /* Octets received [47:32] */ | ||
| 108 | #define GEM_RXCNT 0x0158 /* Frames Received Counter */ | ||
| 109 | #define GEM_RXBROADCNT 0x015c /* Broadcast Frames Received Counter */ | ||
| 110 | #define GEM_RXMULTICNT 0x0160 /* Multicast Frames Received Counter */ | ||
| 111 | #define GEM_RXPAUSECNT 0x0164 /* Pause Frames Received Counter */ | ||
| 112 | #define GEM_RX64CNT 0x0168 /* 64 byte Frames RX Counter */ | ||
| 113 | #define GEM_RX65CNT 0x016c /* 65-127 byte Frames RX Counter */ | ||
| 114 | #define GEM_RX128CNT 0x0170 /* 128-255 byte Frames RX Counter */ | ||
| 115 | #define GEM_RX256CNT 0x0174 /* 256-511 byte Frames RX Counter */ | ||
| 116 | #define GEM_RX512CNT 0x0178 /* 512-1023 byte Frames RX Counter */ | ||
| 117 | #define GEM_RX1024CNT 0x017c /* 1024-1518 byte Frames RX Counter */ | ||
| 118 | #define GEM_RX1519CNT 0x0180 /* 1519+ byte Frames RX Counter */ | ||
| 119 | #define GEM_RXUNDRCNT 0x0184 /* Undersize Frames Received Counter */ | ||
| 120 | #define GEM_RXOVRCNT 0x0188 /* Oversize Frames Received Counter */ | ||
| 121 | #define GEM_RXJABCNT 0x018c /* Jabbers Received Counter */ | ||
| 122 | #define GEM_RXFCSCNT 0x0190 /* Frame Check Sequence Error Counter */ | ||
| 123 | #define GEM_RXLENGTHCNT 0x0194 /* Length Field Error Counter */ | ||
| 124 | #define GEM_RXSYMBCNT 0x0198 /* Symbol Error Counter */ | ||
| 125 | #define GEM_RXALIGNCNT 0x019c /* Alignment Error Counter */ | ||
| 126 | #define GEM_RXRESERRCNT 0x01a0 /* Receive Resource Error Counter */ | ||
| 127 | #define GEM_RXORCNT 0x01a4 /* Receive Overrun Counter */ | ||
| 128 | #define GEM_RXIPCCNT 0x01a8 /* IP header Checksum Error Counter */ | ||
| 129 | #define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error Counter */ | ||
| 130 | #define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error Counter */ | ||
| 131 | #define GEM_DCFG1 0x0280 /* Design Config 1 */ | ||
| 132 | #define GEM_DCFG2 0x0284 /* Design Config 2 */ | ||
| 133 | #define GEM_DCFG3 0x0288 /* Design Config 3 */ | ||
| 134 | #define GEM_DCFG4 0x028c /* Design Config 4 */ | ||
| 135 | #define GEM_DCFG5 0x0290 /* Design Config 5 */ | ||
| 136 | #define GEM_DCFG6 0x0294 /* Design Config 6 */ | ||
| 137 | #define GEM_DCFG7 0x0298 /* Design Config 7 */ | ||
| 138 | |||
| 139 | #define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2)) | ||
| 140 | #define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2)) | ||
| 141 | #define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2)) | ||
| 142 | #define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2)) | ||
| 143 | #define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2)) | ||
| 144 | #define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2)) | ||
| 99 | 145 | ||
| 100 | /* Bitfields in NCR */ | 146 | /* Bitfields in NCR */ |
| 101 | #define MACB_LB_OFFSET 0 | 147 | #define MACB_LB_OFFSET 0 /* reserved */ |
| 102 | #define MACB_LB_SIZE 1 | 148 | #define MACB_LB_SIZE 1 |
| 103 | #define MACB_LLB_OFFSET 1 | 149 | #define MACB_LLB_OFFSET 1 /* Loop back local */ |
| 104 | #define MACB_LLB_SIZE 1 | 150 | #define MACB_LLB_SIZE 1 |
| 105 | #define MACB_RE_OFFSET 2 | 151 | #define MACB_RE_OFFSET 2 /* Receive enable */ |
| 106 | #define MACB_RE_SIZE 1 | 152 | #define MACB_RE_SIZE 1 |
| 107 | #define MACB_TE_OFFSET 3 | 153 | #define MACB_TE_OFFSET 3 /* Transmit enable */ |
| 108 | #define MACB_TE_SIZE 1 | 154 | #define MACB_TE_SIZE 1 |
| 109 | #define MACB_MPE_OFFSET 4 | 155 | #define MACB_MPE_OFFSET 4 /* Management port enable */ |
| 110 | #define MACB_MPE_SIZE 1 | 156 | #define MACB_MPE_SIZE 1 |
| 111 | #define MACB_CLRSTAT_OFFSET 5 | 157 | #define MACB_CLRSTAT_OFFSET 5 /* Clear stats regs */ |
| 112 | #define MACB_CLRSTAT_SIZE 1 | 158 | #define MACB_CLRSTAT_SIZE 1 |
| 113 | #define MACB_INCSTAT_OFFSET 6 | 159 | #define MACB_INCSTAT_OFFSET 6 /* Incremental stats regs */ |
| 114 | #define MACB_INCSTAT_SIZE 1 | 160 | #define MACB_INCSTAT_SIZE 1 |
| 115 | #define MACB_WESTAT_OFFSET 7 | 161 | #define MACB_WESTAT_OFFSET 7 /* Write enable stats regs */ |
| 116 | #define MACB_WESTAT_SIZE 1 | 162 | #define MACB_WESTAT_SIZE 1 |
| 117 | #define MACB_BP_OFFSET 8 | 163 | #define MACB_BP_OFFSET 8 /* Back pressure */ |
| 118 | #define MACB_BP_SIZE 1 | 164 | #define MACB_BP_SIZE 1 |
| 119 | #define MACB_TSTART_OFFSET 9 | 165 | #define MACB_TSTART_OFFSET 9 /* Start transmission */ |
| 120 | #define MACB_TSTART_SIZE 1 | 166 | #define MACB_TSTART_SIZE 1 |
| 121 | #define MACB_THALT_OFFSET 10 | 167 | #define MACB_THALT_OFFSET 10 /* Transmit halt */ |
| 122 | #define MACB_THALT_SIZE 1 | 168 | #define MACB_THALT_SIZE 1 |
| 123 | #define MACB_NCR_TPF_OFFSET 11 | 169 | #define MACB_NCR_TPF_OFFSET 11 /* Transmit pause frame */ |
| 124 | #define MACB_NCR_TPF_SIZE 1 | 170 | #define MACB_NCR_TPF_SIZE 1 |
| 125 | #define MACB_TZQ_OFFSET 12 | 171 | #define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */ |
| 126 | #define MACB_TZQ_SIZE 1 | 172 | #define MACB_TZQ_SIZE 1 |
| 127 | 173 | ||
| 128 | /* Bitfields in NCFGR */ | 174 | /* Bitfields in NCFGR */ |
| 129 | #define MACB_SPD_OFFSET 0 | 175 | #define MACB_SPD_OFFSET 0 /* Speed */ |
| 130 | #define MACB_SPD_SIZE 1 | 176 | #define MACB_SPD_SIZE 1 |
| 131 | #define MACB_FD_OFFSET 1 | 177 | #define MACB_FD_OFFSET 1 /* Full duplex */ |
| 132 | #define MACB_FD_SIZE 1 | 178 | #define MACB_FD_SIZE 1 |
| 133 | #define MACB_BIT_RATE_OFFSET 2 | 179 | #define MACB_BIT_RATE_OFFSET 2 /* Discard non-VLAN frames */ |
| 134 | #define MACB_BIT_RATE_SIZE 1 | 180 | #define MACB_BIT_RATE_SIZE 1 |
| 135 | #define MACB_JFRAME_OFFSET 3 | 181 | #define MACB_JFRAME_OFFSET 3 /* reserved */ |
| 136 | #define MACB_JFRAME_SIZE 1 | 182 | #define MACB_JFRAME_SIZE 1 |
| 137 | #define MACB_CAF_OFFSET 4 | 183 | #define MACB_CAF_OFFSET 4 /* Copy all frames */ |
| 138 | #define MACB_CAF_SIZE 1 | 184 | #define MACB_CAF_SIZE 1 |
| 139 | #define MACB_NBC_OFFSET 5 | 185 | #define MACB_NBC_OFFSET 5 /* No broadcast */ |
| 140 | #define MACB_NBC_SIZE 1 | 186 | #define MACB_NBC_SIZE 1 |
| 141 | #define MACB_NCFGR_MTI_OFFSET 6 | 187 | #define MACB_NCFGR_MTI_OFFSET 6 /* Multicast hash enable */ |
| 142 | #define MACB_NCFGR_MTI_SIZE 1 | 188 | #define MACB_NCFGR_MTI_SIZE 1 |
| 143 | #define MACB_UNI_OFFSET 7 | 189 | #define MACB_UNI_OFFSET 7 /* Unicast hash enable */ |
| 144 | #define MACB_UNI_SIZE 1 | 190 | #define MACB_UNI_SIZE 1 |
| 145 | #define MACB_BIG_OFFSET 8 | 191 | #define MACB_BIG_OFFSET 8 /* Receive 1536 byte frames */ |
| 146 | #define MACB_BIG_SIZE 1 | 192 | #define MACB_BIG_SIZE 1 |
| 147 | #define MACB_EAE_OFFSET 9 | 193 | #define MACB_EAE_OFFSET 9 /* External address match enable */ |
| 148 | #define MACB_EAE_SIZE 1 | 194 | #define MACB_EAE_SIZE 1 |
| 149 | #define MACB_CLK_OFFSET 10 | 195 | #define MACB_CLK_OFFSET 10 |
| 150 | #define MACB_CLK_SIZE 2 | 196 | #define MACB_CLK_SIZE 2 |
| 151 | #define MACB_RTY_OFFSET 12 | 197 | #define MACB_RTY_OFFSET 12 /* Retry test */ |
| 152 | #define MACB_RTY_SIZE 1 | 198 | #define MACB_RTY_SIZE 1 |
| 153 | #define MACB_PAE_OFFSET 13 | 199 | #define MACB_PAE_OFFSET 13 /* Pause enable */ |
| 154 | #define MACB_PAE_SIZE 1 | 200 | #define MACB_PAE_SIZE 1 |
| 155 | #define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */ | 201 | #define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */ |
| 156 | #define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */ | 202 | #define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */ |
| 157 | #define MACB_RBOF_OFFSET 14 | 203 | #define MACB_RBOF_OFFSET 14 /* Receive buffer offset */ |
| 158 | #define MACB_RBOF_SIZE 2 | 204 | #define MACB_RBOF_SIZE 2 |
| 159 | #define MACB_RLCE_OFFSET 16 | 205 | #define MACB_RLCE_OFFSET 16 /* Length field error frame discard */ |
| 160 | #define MACB_RLCE_SIZE 1 | 206 | #define MACB_RLCE_SIZE 1 |
| 161 | #define MACB_DRFCS_OFFSET 17 | 207 | #define MACB_DRFCS_OFFSET 17 /* FCS remove */ |
| 162 | #define MACB_DRFCS_SIZE 1 | 208 | #define MACB_DRFCS_SIZE 1 |
| 163 | #define MACB_EFRHD_OFFSET 18 | 209 | #define MACB_EFRHD_OFFSET 18 |
| 164 | #define MACB_EFRHD_SIZE 1 | 210 | #define MACB_EFRHD_SIZE 1 |
| 165 | #define MACB_IRXFCS_OFFSET 19 | 211 | #define MACB_IRXFCS_OFFSET 19 |
| 166 | #define MACB_IRXFCS_SIZE 1 | 212 | #define MACB_IRXFCS_SIZE 1 |
| 167 | 213 | ||
| 168 | /* GEM specific NCFGR bitfields. */ | 214 | /* GEM specific NCFGR bitfields. */ |
| 169 | #define GEM_GBE_OFFSET 10 | 215 | #define GEM_GBE_OFFSET 10 /* Gigabit mode enable */ |
| 170 | #define GEM_GBE_SIZE 1 | 216 | #define GEM_GBE_SIZE 1 |
| 171 | #define GEM_CLK_OFFSET 18 | 217 | #define GEM_CLK_OFFSET 18 /* MDC clock division */ |
| 172 | #define GEM_CLK_SIZE 3 | 218 | #define GEM_CLK_SIZE 3 |
| 173 | #define GEM_DBW_OFFSET 21 | 219 | #define GEM_DBW_OFFSET 21 /* Data bus width */ |
| 174 | #define GEM_DBW_SIZE 2 | 220 | #define GEM_DBW_SIZE 2 |
| 175 | #define GEM_RXCOEN_OFFSET 24 | 221 | #define GEM_RXCOEN_OFFSET 24 |
| 176 | #define GEM_RXCOEN_SIZE 1 | 222 | #define GEM_RXCOEN_SIZE 1 |
| 177 | 223 | ||
| 178 | /* Constants for data bus width. */ | 224 | /* Constants for data bus width. */ |
| 179 | #define GEM_DBW32 0 | 225 | #define GEM_DBW32 0 /* 32 bit AMBA AHB data bus width */ |
| 180 | #define GEM_DBW64 1 | 226 | #define GEM_DBW64 1 /* 64 bit AMBA AHB data bus width */ |
| 181 | #define GEM_DBW128 2 | 227 | #define GEM_DBW128 2 /* 128 bit AMBA AHB data bus width */ |
| 182 | 228 | ||
| 183 | /* Bitfields in DMACFG. */ | 229 | /* Bitfields in DMACFG. */ |
| 184 | #define GEM_FBLDO_OFFSET 0 | 230 | #define GEM_FBLDO_OFFSET 0 /* fixed burst length for DMA */ |
| 185 | #define GEM_FBLDO_SIZE 5 | 231 | #define GEM_FBLDO_SIZE 5 |
| 186 | #define GEM_ENDIA_OFFSET 7 | 232 | #define GEM_ENDIA_OFFSET 7 /* endian swap mode for packet data access */ |
| 187 | #define GEM_ENDIA_SIZE 1 | 233 | #define GEM_ENDIA_SIZE 1 |
| 188 | #define GEM_RXBMS_OFFSET 8 | 234 | #define GEM_RXBMS_OFFSET 8 /* RX packet buffer memory size select */ |
| 189 | #define GEM_RXBMS_SIZE 2 | 235 | #define GEM_RXBMS_SIZE 2 |
| 190 | #define GEM_TXPBMS_OFFSET 10 | 236 | #define GEM_TXPBMS_OFFSET 10 /* TX packet buffer memory size select */ |
| 191 | #define GEM_TXPBMS_SIZE 1 | 237 | #define GEM_TXPBMS_SIZE 1 |
| 192 | #define GEM_TXCOEN_OFFSET 11 | 238 | #define GEM_TXCOEN_OFFSET 11 /* TX IP/TCP/UDP checksum gen offload */ |
| 193 | #define GEM_TXCOEN_SIZE 1 | 239 | #define GEM_TXCOEN_SIZE 1 |
| 194 | #define GEM_RXBS_OFFSET 16 | 240 | #define GEM_RXBS_OFFSET 16 /* DMA receive buffer size */ |
| 195 | #define GEM_RXBS_SIZE 8 | 241 | #define GEM_RXBS_SIZE 8 |
| 196 | #define GEM_DDRP_OFFSET 24 | 242 | #define GEM_DDRP_OFFSET 24 /* disc_when_no_ahb */ |
| 197 | #define GEM_DDRP_SIZE 1 | 243 | #define GEM_DDRP_SIZE 1 |
| 198 | 244 | ||
| 199 | 245 | ||
| 200 | /* Bitfields in NSR */ | 246 | /* Bitfields in NSR */ |
| 201 | #define MACB_NSR_LINK_OFFSET 0 | 247 | #define MACB_NSR_LINK_OFFSET 0 /* pcs_link_state */ |
| 202 | #define MACB_NSR_LINK_SIZE 1 | 248 | #define MACB_NSR_LINK_SIZE 1 |
| 203 | #define MACB_MDIO_OFFSET 1 | 249 | #define MACB_MDIO_OFFSET 1 /* status of the mdio_in pin */ |
| 204 | #define MACB_MDIO_SIZE 1 | 250 | #define MACB_MDIO_SIZE 1 |
| 205 | #define MACB_IDLE_OFFSET 2 | 251 | #define MACB_IDLE_OFFSET 2 /* The PHY management logic is idle */ |
| 206 | #define MACB_IDLE_SIZE 1 | 252 | #define MACB_IDLE_SIZE 1 |
| 207 | 253 | ||
| 208 | /* Bitfields in TSR */ | 254 | /* Bitfields in TSR */ |
| 209 | #define MACB_UBR_OFFSET 0 | 255 | #define MACB_UBR_OFFSET 0 /* Used bit read */ |
| 210 | #define MACB_UBR_SIZE 1 | 256 | #define MACB_UBR_SIZE 1 |
| 211 | #define MACB_COL_OFFSET 1 | 257 | #define MACB_COL_OFFSET 1 /* Collision occurred */ |
| 212 | #define MACB_COL_SIZE 1 | 258 | #define MACB_COL_SIZE 1 |
| 213 | #define MACB_TSR_RLE_OFFSET 2 | 259 | #define MACB_TSR_RLE_OFFSET 2 /* Retry limit exceeded */ |
| 214 | #define MACB_TSR_RLE_SIZE 1 | 260 | #define MACB_TSR_RLE_SIZE 1 |
| 215 | #define MACB_TGO_OFFSET 3 | 261 | #define MACB_TGO_OFFSET 3 /* Transmit go */ |
| 216 | #define MACB_TGO_SIZE 1 | 262 | #define MACB_TGO_SIZE 1 |
| 217 | #define MACB_BEX_OFFSET 4 | 263 | #define MACB_BEX_OFFSET 4 /* TX frame corruption due to AHB error */ |
| 218 | #define MACB_BEX_SIZE 1 | 264 | #define MACB_BEX_SIZE 1 |
| 219 | #define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */ | 265 | #define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */ |
| 220 | #define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */ | 266 | #define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */ |
| 221 | #define MACB_COMP_OFFSET 5 | 267 | #define MACB_COMP_OFFSET 5 /* Trnasmit complete */ |
| 222 | #define MACB_COMP_SIZE 1 | 268 | #define MACB_COMP_SIZE 1 |
| 223 | #define MACB_UND_OFFSET 6 | 269 | #define MACB_UND_OFFSET 6 /* Trnasmit under run */ |
| 224 | #define MACB_UND_SIZE 1 | 270 | #define MACB_UND_SIZE 1 |
| 225 | 271 | ||
| 226 | /* Bitfields in RSR */ | 272 | /* Bitfields in RSR */ |
| 227 | #define MACB_BNA_OFFSET 0 | 273 | #define MACB_BNA_OFFSET 0 /* Buffer not available */ |
| 228 | #define MACB_BNA_SIZE 1 | 274 | #define MACB_BNA_SIZE 1 |
| 229 | #define MACB_REC_OFFSET 1 | 275 | #define MACB_REC_OFFSET 1 /* Frame received */ |
| 230 | #define MACB_REC_SIZE 1 | 276 | #define MACB_REC_SIZE 1 |
| 231 | #define MACB_OVR_OFFSET 2 | 277 | #define MACB_OVR_OFFSET 2 /* Receive overrun */ |
| 232 | #define MACB_OVR_SIZE 1 | 278 | #define MACB_OVR_SIZE 1 |
| 233 | 279 | ||
| 234 | /* Bitfields in ISR/IER/IDR/IMR */ | 280 | /* Bitfields in ISR/IER/IDR/IMR */ |
| 235 | #define MACB_MFD_OFFSET 0 | 281 | #define MACB_MFD_OFFSET 0 /* Management frame sent */ |
| 236 | #define MACB_MFD_SIZE 1 | 282 | #define MACB_MFD_SIZE 1 |
| 237 | #define MACB_RCOMP_OFFSET 1 | 283 | #define MACB_RCOMP_OFFSET 1 /* Receive complete */ |
| 238 | #define MACB_RCOMP_SIZE 1 | 284 | #define MACB_RCOMP_SIZE 1 |
| 239 | #define MACB_RXUBR_OFFSET 2 | 285 | #define MACB_RXUBR_OFFSET 2 /* RX used bit read */ |
| 240 | #define MACB_RXUBR_SIZE 1 | 286 | #define MACB_RXUBR_SIZE 1 |
| 241 | #define MACB_TXUBR_OFFSET 3 | 287 | #define MACB_TXUBR_OFFSET 3 /* TX used bit read */ |
| 242 | #define MACB_TXUBR_SIZE 1 | 288 | #define MACB_TXUBR_SIZE 1 |
| 243 | #define MACB_ISR_TUND_OFFSET 4 | 289 | #define MACB_ISR_TUND_OFFSET 4 /* Enable TX buffer under run interrupt */ |
| 244 | #define MACB_ISR_TUND_SIZE 1 | 290 | #define MACB_ISR_TUND_SIZE 1 |
| 245 | #define MACB_ISR_RLE_OFFSET 5 | 291 | #define MACB_ISR_RLE_OFFSET 5 /* EN retry exceeded/late coll interrupt */ |
| 246 | #define MACB_ISR_RLE_SIZE 1 | 292 | #define MACB_ISR_RLE_SIZE 1 |
| 247 | #define MACB_TXERR_OFFSET 6 | 293 | #define MACB_TXERR_OFFSET 6 /* EN TX frame corrupt from error interrupt */ |
| 248 | #define MACB_TXERR_SIZE 1 | 294 | #define MACB_TXERR_SIZE 1 |
| 249 | #define MACB_TCOMP_OFFSET 7 | 295 | #define MACB_TCOMP_OFFSET 7 /* Enable transmit complete interrupt */ |
| 250 | #define MACB_TCOMP_SIZE 1 | 296 | #define MACB_TCOMP_SIZE 1 |
| 251 | #define MACB_ISR_LINK_OFFSET 9 | 297 | #define MACB_ISR_LINK_OFFSET 9 /* Enable link change interrupt */ |
| 252 | #define MACB_ISR_LINK_SIZE 1 | 298 | #define MACB_ISR_LINK_SIZE 1 |
| 253 | #define MACB_ISR_ROVR_OFFSET 10 | 299 | #define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun interrupt */ |
| 254 | #define MACB_ISR_ROVR_SIZE 1 | 300 | #define MACB_ISR_ROVR_SIZE 1 |
| 255 | #define MACB_HRESP_OFFSET 11 | 301 | #define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK interrupt */ |
| 256 | #define MACB_HRESP_SIZE 1 | 302 | #define MACB_HRESP_SIZE 1 |
| 257 | #define MACB_PFR_OFFSET 12 | 303 | #define MACB_PFR_OFFSET 12 /* Enable pause frame w/ quantum interrupt */ |
| 258 | #define MACB_PFR_SIZE 1 | 304 | #define MACB_PFR_SIZE 1 |
| 259 | #define MACB_PTZ_OFFSET 13 | 305 | #define MACB_PTZ_OFFSET 13 /* Enable pause time zero interrupt */ |
| 260 | #define MACB_PTZ_SIZE 1 | 306 | #define MACB_PTZ_SIZE 1 |
| 261 | 307 | ||
| 262 | /* Bitfields in MAN */ | 308 | /* Bitfields in MAN */ |
| 263 | #define MACB_DATA_OFFSET 0 | 309 | #define MACB_DATA_OFFSET 0 /* data */ |
| 264 | #define MACB_DATA_SIZE 16 | 310 | #define MACB_DATA_SIZE 16 |
| 265 | #define MACB_CODE_OFFSET 16 | 311 | #define MACB_CODE_OFFSET 16 /* Must be written to 10 */ |
| 266 | #define MACB_CODE_SIZE 2 | 312 | #define MACB_CODE_SIZE 2 |
| 267 | #define MACB_REGA_OFFSET 18 | 313 | #define MACB_REGA_OFFSET 18 /* Register address */ |
| 268 | #define MACB_REGA_SIZE 5 | 314 | #define MACB_REGA_SIZE 5 |
| 269 | #define MACB_PHYA_OFFSET 23 | 315 | #define MACB_PHYA_OFFSET 23 /* PHY address */ |
| 270 | #define MACB_PHYA_SIZE 5 | 316 | #define MACB_PHYA_SIZE 5 |
| 271 | #define MACB_RW_OFFSET 28 | 317 | #define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01 is write. */ |
| 272 | #define MACB_RW_SIZE 2 | 318 | #define MACB_RW_SIZE 2 |
| 273 | #define MACB_SOF_OFFSET 30 | 319 | #define MACB_SOF_OFFSET 30 /* Must be written to 1 for Clause 22 */ |
| 274 | #define MACB_SOF_SIZE 2 | 320 | #define MACB_SOF_SIZE 2 |
| 275 | 321 | ||
| 276 | /* Bitfields in USRIO (AVR32) */ | 322 | /* Bitfields in USRIO (AVR32) */ |
| 277 | #define MACB_MII_OFFSET 0 | 323 | #define MACB_MII_OFFSET 0 |
| @@ -286,7 +332,7 @@ · 8 unmodified lines | |||
| 286 | /* Bitfields in USRIO (AT91) */ | 332 | /* Bitfields in USRIO (AT91) */ |
| 287 | #define MACB_RMII_OFFSET 0 | 333 | #define MACB_RMII_OFFSET 0 |
| 288 | #define MACB_RMII_SIZE 1 | 334 | #define MACB_RMII_SIZE 1 |
| 289 | #define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */ | 335 | #define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */ |
| 290 | #define GEM_RGMII_SIZE 1 | 336 | #define GEM_RGMII_SIZE 1 |
| 291 | #define MACB_CLKEN_OFFSET 1 | 337 | #define MACB_CLKEN_OFFSET 1 |
| 292 | #define MACB_CLKEN_SIZE 1 | 338 | #define MACB_CLKEN_SIZE 1 |
| @@ -389,8 +435,7 @@ · 96 unmodified lines | |||
| 389 | #define queue_writel(queue, reg, value) \ | 435 | #define queue_writel(queue, reg, value) \ |
| 390 | __raw_writel((value), (queue)->bp->regs + (queue)->reg) | 436 | __raw_writel((value), (queue)->bp->regs + (queue)->reg) |
| 391 | 437 | ||
| 392 | /* | 438 | /* Conditional GEM/MACB macros. These perform the operation to the correct |
| 393 | * Conditional GEM/MACB macros. These perform the operation to the correct | ||
| 394 | * register dependent on whether the device is a GEM or a MACB. For registers | 439 | * register dependent on whether the device is a GEM or a MACB. For registers |
| 395 | * and bitfields that are common across both devices, use macb_{read,write}l | 440 | * and bitfields that are common across both devices, use macb_{read,write}l |
| 396 | * to avoid the cost of the conditional. | 441 | * to avoid the cost of the conditional. |
| @@ -413,8 +458,7 @@ · 16 unmodified lines | |||
| 413 | __v; \ | 458 | __v; \ |
| 414 | }) | 459 | }) |
| 415 | 460 | ||
| 416 | /** | 461 | /* struct macb_dma_desc - Hardware DMA descriptor |
| 417 | * struct macb_dma_desc - Hardware DMA descriptor | ||
| 418 | * @addr: DMA address of data buffer | 462 | * @addr: DMA address of data buffer |
| 419 | * @ctrl: Control and status bits | 463 | * @ctrl: Control and status bits |
| 420 | */ | 464 | */ |
| @@ -503,8 +547,7 @@ struct macb_dma_desc { · 82 unmodified lines | |||
| 503 | /* limit RX checksum offload to TCP and UDP packets */ | 547 | /* limit RX checksum offload to TCP and UDP packets */ |
| 504 | #define GEM_RX_CSUM_CHECKED_MASK 2 | 548 | #define GEM_RX_CSUM_CHECKED_MASK 2 |
| 505 | 549 | ||
| 506 | /** | 550 | /* struct macb_tx_skb - data about an skb which is being transmitted |
| 507 | * struct macb_tx_skb - data about an skb which is being transmitted | ||
| 508 | * @skb: skb currently being transmitted, only set for the last buffer | 551 | * @skb: skb currently being transmitted, only set for the last buffer |
| 509 | * of the frame | 552 | * of the frame |
| 510 | * @mapping: DMA address of the skb's fragment buffer | 553 | * @mapping: DMA address of the skb's fragment buffer |
| @@ -519,8 +562,7 @@ struct macb_tx_skb { · 8 unmodified lines | |||
| 519 | bool mapped_as_page; | 562 | bool mapped_as_page; |
| 520 | }; | 563 | }; |
| 521 | 564 | ||
| 522 | /* | 565 | /* Hardware-collected statistics. Used when updating the network |
| 523 | * Hardware-collected statistics. Used when updating the network | ||
| 524 | * device stats by a periodic timer. | 566 | * device stats by a periodic timer. |
| 525 | */ | 567 | */ |
| 526 | struct macb_stats { | 568 | struct macb_stats { |
| @@ -595,6 +637,107 @@ struct gem_stats { · 68 unmodified lines | |||
| 595 | u32 rx_udp_checksum_errors; | 637 | u32 rx_udp_checksum_errors; |
| 596 | }; | 638 | }; |
| 597 | 639 | ||
| 640 | /* Describes the name and offset of an individual statistic register, as | ||
| 641 | * returned by `ethtool -S`. Also describes which net_device_stats statistics | ||
| 642 | * this register should contribute to. | ||
| 643 | */ | ||
| 644 | struct gem_statistic { | ||
| 645 | char stat_string[ETH_GSTRING_LEN]; | ||
| 646 | int offset; | ||
| 647 | u32 stat_bits; | ||
| 648 | }; | ||
| 649 | |||
| 650 | /* Bitfield defs for net_device_stat statistics */ | ||
| 651 | #define GEM_NDS_RXERR_OFFSET 0 | ||
| 652 | #define GEM_NDS_RXLENERR_OFFSET 1 | ||
| 653 | #define GEM_NDS_RXOVERERR_OFFSET 2 | ||
| 654 | #define GEM_NDS_RXCRCERR_OFFSET 3 | ||
| 655 | #define GEM_NDS_RXFRAMEERR_OFFSET 4 | ||
| 656 | #define GEM_NDS_RXFIFOERR_OFFSET 5 | ||
| 657 | #define GEM_NDS_TXERR_OFFSET 6 | ||
| 658 | #define GEM_NDS_TXABORTEDERR_OFFSET 7 | ||
| 659 | #define GEM_NDS_TXCARRIERERR_OFFSET 8 | ||
| 660 | #define GEM_NDS_TXFIFOERR_OFFSET 9 | ||
| 661 | #define GEM_NDS_COLLISIONS_OFFSET 10 | ||
| 662 | |||
| 663 | #define GEM_STAT_TITLE(name, title) GEM_STAT_TITLE_BITS(name, title, 0) | ||
| 664 | #define GEM_STAT_TITLE_BITS(name, title, bits) { \ | ||
| 665 | .stat_string = title, \ | ||
| 666 | .offset = GEM_##name, \ | ||
| 667 | .stat_bits = bits \ | ||
| 668 | } | ||
| 669 | |||
| 670 | /* list of gem statistic registers. The names MUST match the | ||
| 671 | * corresponding GEM_* definitions. | ||
| 672 | */ | ||
| 673 | static const struct gem_statistic gem_statistics[] = { | ||
| 674 | GEM_STAT_TITLE(OCTTXL, "tx_octets"), /* OCTTXH combined with OCTTXL */ | ||
| 675 | GEM_STAT_TITLE(TXCNT, "tx_frames"), | ||
| 676 | GEM_STAT_TITLE(TXBCCNT, "tx_broadcast_frames"), | ||
| 677 | GEM_STAT_TITLE(TXMCCNT, "tx_multicast_frames"), | ||
| 678 | GEM_STAT_TITLE(TXPAUSECNT, "tx_pause_frames"), | ||
| 679 | GEM_STAT_TITLE(TX64CNT, "tx_64_byte_frames"), | ||
| 680 | GEM_STAT_TITLE(TX65CNT, "tx_65_127_byte_frames"), | ||
| 681 | GEM_STAT_TITLE(TX128CNT, "tx_128_255_byte_frames"), | ||
| 682 | GEM_STAT_TITLE(TX256CNT, "tx_256_511_byte_frames"), | ||
| 683 | GEM_STAT_TITLE(TX512CNT, "tx_512_1023_byte_frames"), | ||
| 684 | GEM_STAT_TITLE(TX1024CNT, "tx_1024_1518_byte_frames"), | ||
| 685 | GEM_STAT_TITLE(TX1519CNT, "tx_greater_than_1518_byte_frames"), | ||
| 686 | GEM_STAT_TITLE_BITS(TXURUNCNT, "tx_underrun", | ||
| 687 | GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_TXFIFOERR)), | ||
| 688 | GEM_STAT_TITLE_BITS(SNGLCOLLCNT, "tx_single_collision_frames", | ||
| 689 | GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)), | ||
| 690 | GEM_STAT_TITLE_BITS(MULTICOLLCNT, "tx_multiple_collision_frames", | ||
| 691 | GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)), | ||
| 692 | GEM_STAT_TITLE_BITS(EXCESSCOLLCNT, "tx_excessive_collisions", | ||
| 693 | GEM_BIT(NDS_TXERR)| | ||
| 694 | GEM_BIT(NDS_TXABORTEDERR)| | ||
| 695 | GEM_BIT(NDS_COLLISIONS)), | ||
| 696 | GEM_STAT_TITLE_BITS(LATECOLLCNT, "tx_late_collisions", | ||
| 697 | GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)), | ||
| 698 | GEM_STAT_TITLE(TXDEFERCNT, "tx_deferred_frames"), | ||
| 699 | GEM_STAT_TITLE_BITS(TXCSENSECNT, "tx_carrier_sense_errors", | ||
| 700 | GEM_BIT(NDS_TXERR)|GEM_BIT(NDS_COLLISIONS)), | ||
| 701 | GEM_STAT_TITLE(OCTRXL, "rx_octets"), /* OCTRXH combined with OCTRXL */ | ||
| 702 | GEM_STAT_TITLE(RXCNT, "rx_frames"), | ||
| 703 | GEM_STAT_TITLE(RXBROADCNT, "rx_broadcast_frames"), | ||
| 704 | GEM_STAT_TITLE(RXMULTICNT, "rx_multicast_frames"), | ||
| 705 | GEM_STAT_TITLE(RXPAUSECNT, "rx_pause_frames"), | ||
| 706 | GEM_STAT_TITLE(RX64CNT, "rx_64_byte_frames"), | ||
| 707 | GEM_STAT_TITLE(RX65CNT, "rx_65_127_byte_frames"), | ||
| 708 | GEM_STAT_TITLE(RX128CNT, "rx_128_255_byte_frames"), | ||
| 709 | GEM_STAT_TITLE(RX256CNT, "rx_256_511_byte_frames"), | ||
| 710 | GEM_STAT_TITLE(RX512CNT, "rx_512_1023_byte_frames"), | ||
| 711 | GEM_STAT_TITLE(RX1024CNT, "rx_1024_1518_byte_frames"), | ||
| 712 | GEM_STAT_TITLE(RX1519CNT, "rx_greater_than_1518_byte_frames"), | ||
| 713 | GEM_STAT_TITLE_BITS(RXUNDRCNT, "rx_undersized_frames", | ||
| 714 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXLENERR)), | ||
| 715 | GEM_STAT_TITLE_BITS(RXOVRCNT, "rx_oversize_frames", | ||
| 716 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXLENERR)), | ||
| 717 | GEM_STAT_TITLE_BITS(RXJABCNT, "rx_jabbers", | ||
| 718 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXLENERR)), | ||
| 719 | GEM_STAT_TITLE_BITS(RXFCSCNT, "rx_frame_check_sequence_errors", | ||
| 720 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXCRCERR)), | ||
| 721 | GEM_STAT_TITLE_BITS(RXLENGTHCNT, "rx_length_field_frame_errors", | ||
| 722 | GEM_BIT(NDS_RXERR)), | ||
| 723 | GEM_STAT_TITLE_BITS(RXSYMBCNT, "rx_symbol_errors", | ||
| 724 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXFRAMEERR)), | ||
| 725 | GEM_STAT_TITLE_BITS(RXALIGNCNT, "rx_alignment_errors", | ||
| 726 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXOVERERR)), | ||
| 727 | GEM_STAT_TITLE_BITS(RXRESERRCNT, "rx_resource_errors", | ||
| 728 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXOVERERR)), | ||
| 729 | GEM_STAT_TITLE_BITS(RXORCNT, "rx_overruns", | ||
| 730 | GEM_BIT(NDS_RXERR)|GEM_BIT(NDS_RXFIFOERR)), | ||
| 731 | GEM_STAT_TITLE_BITS(RXIPCCNT, "rx_ip_header_checksum_errors", | ||
| 732 | GEM_BIT(NDS_RXERR)), | ||
| 733 | GEM_STAT_TITLE_BITS(RXTCPCCNT, "rx_tcp_checksum_errors", | ||
| 734 | GEM_BIT(NDS_RXERR)), | ||
| 735 | GEM_STAT_TITLE_BITS(RXUDPCCNT, "rx_udp_checksum_errors", | ||
| 736 | GEM_BIT(NDS_RXERR)), | ||
| 737 | }; | ||
| 738 | |||
| 739 | #define GEM_STATS_LEN ARRAY_SIZE(gem_statistics) | ||
| 740 | |||
| 598 | struct macb; | 741 | struct macb; |
| 599 | 742 | ||
| 600 | struct macb_or_gem_ops { | 743 | struct macb_or_gem_ops { |
| @@ -673,6 +816,8 @@ struct macb { · 72 unmodified lines | |||
| 673 | dma_addr_t skb_physaddr; /* phys addr from pci_map_single */ | 816 | dma_addr_t skb_physaddr; /* phys addr from pci_map_single */ |
| 674 | int skb_length; /* saved skb length for pci_unmap_single */ | 817 | int skb_length; /* saved skb length for pci_unmap_single */ |
| 675 | unsigned int max_tx_length; | 818 | unsigned int max_tx_length; |
| 819 | |||
| 820 | u64 ethtool_stats[GEM_STATS_LEN]; | ||
| 676 | }; | 821 | }; |
| 677 | 822 | ||
| 678 | extern const struct ethtool_ops macb_ethtool_ops; | 823 | extern const struct ethtool_ops macb_ethtool_ops; |
| @@ -1860,9 +1860,9 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) · 1859 unmodified lines | |||
| 1860 | } | 1860 | } |
| 1861 | cpl->iff = dev->if_port; | 1861 | cpl->iff = dev->if_port; |
| 1862 | 1862 | ||
| 1863 | if (vlan_tx_tag_present(skb)) { | 1863 | if (skb_vlan_tag_present(skb)) { |
| 1864 | cpl->vlan_valid = 1; | 1864 | cpl->vlan_valid = 1; |
| 1865 | cpl->vlan = htons(vlan_tx_tag_get(skb)); | 1865 | cpl->vlan = htons(skb_vlan_tag_get(skb)); |
| 1866 | st->vlan_insert++; | 1866 | st->vlan_insert++; |
| 1867 | } else | 1867 | } else |
| 1868 | cpl->vlan_valid = 0; | 1868 | cpl->vlan_valid = 0; |
| @@ -97,14 +97,6 @@ static int mc5_cmd_write(struct adapter *adapter, u32 cmd) · 96 unmodified lines | |||
| 97 | F_DBGIRSPVALID, 1, MAX_WRITE_ATTEMPTS, 1); | 97 | F_DBGIRSPVALID, 1, MAX_WRITE_ATTEMPTS, 1); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static inline void dbgi_wr_addr3(struct adapter *adapter, u32 v1, u32 v2, | ||
| 101 | u32 v3) | ||
| 102 | { | ||
| 103 | t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_ADDR0, v1); | ||
| 104 | t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_ADDR1, v2); | ||
| 105 | t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_ADDR2, v3); | ||
| 106 | } | ||
| 107 | |||
| 108 | static inline void dbgi_wr_data3(struct adapter *adapter, u32 v1, u32 v2, | 100 | static inline void dbgi_wr_data3(struct adapter *adapter, u32 v1, u32 v2, |
| 109 | u32 v3) | 101 | u32 v3) |
| 110 | { | 102 | { |
| @@ -113,14 +105,6 @@ static inline void dbgi_wr_data3(struct adapter *adapter, u32 v1, u32 v2, · 2 unmodified lines | |||
| 113 | t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_DATA2, v3); | 105 | t3_write_reg(adapter, A_MC5_DB_DBGI_REQ_DATA2, v3); |
| 114 | } | 106 | } |
| 115 | 107 | ||
| 116 | static inline void dbgi_rd_rsp3(struct adapter *adapter, u32 *v1, u32 *v2, | ||
| 117 | u32 *v3) | ||
| 118 | { | ||
| 119 | *v1 = t3_read_reg(adapter, A_MC5_DB_DBGI_RSP_DATA0); | ||
| 120 | *v2 = t3_read_reg(adapter, A_MC5_DB_DBGI_RSP_DATA1); | ||
| 121 | *v3 = t3_read_reg(adapter, A_MC5_DB_DBGI_RSP_DATA2); | ||
| 122 | } | ||
| 123 | |||
| 124 | /* | 108 | /* |
| 125 | * Write data to the TCAM register at address (0, 0, addr_lo) using the TCAM | 109 | * Write data to the TCAM register at address (0, 0, addr_lo) using the TCAM |
| 126 | * command cmd. The data to be written must have been set up by the caller. | 110 | * command cmd. The data to be written must have been set up by the caller. |
| @@ -1148,8 +1148,8 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, · 1147 unmodified lines | |||
| 1148 | cpl->len = htonl(skb->len); | 1148 | cpl->len = htonl(skb->len); |
| 1149 | cntrl = V_TXPKT_INTF(pi->port_id); | 1149 | cntrl = V_TXPKT_INTF(pi->port_id); |
| 1150 | 1150 | ||
| 1151 | if (vlan_tx_tag_present(skb)) | 1151 | if (skb_vlan_tag_present(skb)) |
| 1152 | cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(vlan_tx_tag_get(skb)); | 1152 | cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(skb_vlan_tag_get(skb)); |
| 1153 | 1153 | ||
| 1154 | tso_info = V_LSO_MSS(skb_shinfo(skb)->gso_size); | 1154 | tso_info = V_LSO_MSS(skb_shinfo(skb)->gso_size); |
| 1155 | if (tso_info) { | 1155 | if (tso_info) { |
| @@ -1282,7 +1282,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) · 126 unmodified lines | |||
| 1282 | qs->port_stats[SGE_PSTAT_TX_CSUM]++; | 1282 | qs->port_stats[SGE_PSTAT_TX_CSUM]++; |
| 1283 | if (skb_shinfo(skb)->gso_size) | 1283 | if (skb_shinfo(skb)->gso_size) |
| 1284 | qs->port_stats[SGE_PSTAT_TSO]++; | 1284 | qs->port_stats[SGE_PSTAT_TSO]++; |
| 1285 | if (vlan_tx_tag_present(skb)) | 1285 | if (skb_vlan_tag_present(skb)) |
| 1286 | qs->port_stats[SGE_PSTAT_VLANINS]++; | 1286 | qs->port_stats[SGE_PSTAT_VLANINS]++; |
| 1287 | 1287 | ||
| 1288 | /* | 1288 | /* |
| @@ -727,9 +727,9 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) · 726 unmodified lines | |||
| 727 | p->xauicfg[1] = simple_strtoul(vpd.xaui1cfg_data, NULL, 16); | 727 | p->xauicfg[1] = simple_strtoul(vpd.xaui1cfg_data, NULL, 16); |
| 728 | } | 728 | } |
| 729 | 729 | ||
| 730 | for (i = 0; i < 6; i++) | 730 | ret = hex2bin(p->eth_base, vpd.na_data, 6); |
| 731 | p->eth_base[i] = hex_to_bin(vpd.na_data[2 * i]) * 16 + | 731 | if (ret < 0) |
| 732 | hex_to_bin(vpd.na_data[2 * i + 1]); | 732 | return -EINVAL; |
| 733 | return 0; | 733 | return 0; |
| 734 | } | 734 | } |
| 735 | 735 | ||
| @@ -4,6 +4,6 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | obj-$(CONFIG_CHELSIO_T4) += cxgb4.o | 5 | obj-$(CONFIG_CHELSIO_T4) += cxgb4.o |
| 6 | 6 | ||
| 7 | cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o | 7 | cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o |
| 8 | cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o | 8 | cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o |
| 9 | cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o | 9 | cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o |
| @@ -0,0 +1,317 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of the Chelsio T4 Ethernet driver for Linux. | ||
| 3 | * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved. | ||
| 4 | * | ||
| 5 | * Written by Deepak (deepak.s@chelsio.com) | ||
| 6 | * | ||
| 7 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 8 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 9 | * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this | ||
| 10 | * release for licensing terms and conditions. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/netdevice.h> | ||
| 15 | #include <linux/jhash.h> | ||
| 16 | #include <linux/if_vlan.h> | ||
| 17 | #include <net/addrconf.h> | ||
| 18 | #include "cxgb4.h" | ||
| 19 | #include "clip_tbl.h" | ||
| 20 | |||
| 21 | static inline unsigned int ipv4_clip_hash(struct clip_tbl *c, const u32 *key) | ||
| 22 | { | ||
| 23 | unsigned int clipt_size_half = c->clipt_size / 2; | ||
| 24 | |||
| 25 | return jhash_1word(*key, 0) % clipt_size_half; | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline unsigned int ipv6_clip_hash(struct clip_tbl *d, const u32 *key) | ||
| 29 | { | ||
| 30 | unsigned int clipt_size_half = d->clipt_size / 2; | ||
| 31 | u32 xor = key[0] ^ key[1] ^ key[2] ^ key[3]; | ||
| 32 | |||
| 33 | return clipt_size_half + | ||
| 34 | (jhash_1word(xor, 0) % clipt_size_half); | ||
| 35 | } | ||
| 36 | |||
| 37 | static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr, | ||
| 38 | int addr_len) | ||
| 39 | { | ||
| 40 | return addr_len == 4 ? ipv4_clip_hash(ctbl, addr) : | ||
| 41 | ipv6_clip_hash(ctbl, addr); | ||
| 42 | } | ||
| 43 | |||
| 44 | static int clip6_get_mbox(const struct net_device *dev, | ||
| 45 | const struct in6_addr *lip) | ||
| 46 | { | ||
| 47 | struct adapter *adap = netdev2adap(dev); | ||
| 48 | struct fw_clip_cmd c; | ||
| 49 | |||
| 50 | memset(&c, 0, sizeof(c)); | ||
| 51 | c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) | | ||
| 52 | FW_CMD_REQUEST_F | FW_CMD_WRITE_F); | ||
| 53 | c.alloc_to_len16 = htonl(FW_CLIP_CMD_ALLOC_F | FW_LEN16(c)); | ||
| 54 | *(__be64 *)&c.ip_hi = *(__be64 *)(lip->s6_addr); | ||
| 55 | *(__be64 *)&c.ip_lo = *(__be64 *)(lip->s6_addr + 8); | ||
| 56 | return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); | ||
| 57 | } | ||
| 58 | |||
| 59 | static int clip6_release_mbox(const struct net_device *dev, | ||
| 60 | const struct in6_addr *lip) | ||
| 61 | { | ||
| 62 | struct adapter *adap = netdev2adap(dev); | ||
| 63 | struct fw_clip_cmd c; | ||
| 64 | |||
| 65 | memset(&c, 0, sizeof(c)); | ||
| 66 | c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) | | ||
| 67 | FW_CMD_REQUEST_F | FW_CMD_READ_F); | ||
| 68 | c.alloc_to_len16 = htonl(FW_CLIP_CMD_FREE_F | FW_LEN16(c)); | ||
| 69 | *(__be64 *)&c.ip_hi = *(__be64 *)(lip->s6_addr); | ||
| 70 | *(__be64 *)&c.ip_lo = *(__be64 *)(lip->s6_addr + 8); | ||
| 71 | return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); | ||
| 72 | } | ||
| 73 | |||
| 74 | int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) | ||
| 75 | { | ||
| 76 | struct adapter *adap = netdev2adap(dev); | ||
| 77 | struct clip_tbl *ctbl = adap->clipt; | ||
| 78 | struct clip_entry *ce, *cte; | ||
| 79 | u32 *addr = (u32 *)lip; | ||
| 80 | int hash; | ||
| 81 | int addr_len; | ||
| 82 | int ret = 0; | ||
| 83 | |||
| 84 | if (!ctbl) | ||
| 85 | return 0; | ||
| 86 | |||
| 87 | if (v6) | ||
| 88 | addr_len = 16; | ||
| 89 | else | ||
| 90 | addr_len = 4; | ||
| 91 | |||
| 92 | hash = clip_addr_hash(ctbl, addr, addr_len); | ||
| 93 | |||
| 94 | read_lock_bh(&ctbl->lock); | ||
| 95 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { | ||
| 96 | if (addr_len == cte->addr_len && | ||
| 97 | memcmp(lip, cte->addr, cte->addr_len) == 0) { | ||
| 98 | ce = cte; | ||
| 99 | read_unlock_bh(&ctbl->lock); | ||
| 100 | goto found; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | read_unlock_bh(&ctbl->lock); | ||
| 104 | |||
| 105 | write_lock_bh(&ctbl->lock); | ||
| 106 | if (!list_empty(&ctbl->ce_free_head)) { | ||
| 107 | ce = list_first_entry(&ctbl->ce_free_head, | ||
| 108 | struct clip_entry, list); | ||
| 109 | list_del(&ce->list); | ||
| 110 | INIT_LIST_HEAD(&ce->list); | ||
| 111 | spin_lock_init(&ce->lock); | ||
| 112 | atomic_set(&ce->refcnt, 0); | ||
| 113 | atomic_dec(&ctbl->nfree); | ||
| 114 | ce->addr_len = addr_len; | ||
| 115 | memcpy(ce->addr, lip, addr_len); | ||
| 116 | list_add_tail(&ce->list, &ctbl->hash_list[hash]); | ||
| 117 | if (v6) { | ||
| 118 | ret = clip6_get_mbox(dev, (const struct in6_addr *)lip); | ||
| 119 | if (ret) { | ||
| 120 | write_unlock_bh(&ctbl->lock); | ||
| 121 | return ret; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | } else { | ||
| 125 | write_unlock_bh(&ctbl->lock); | ||
| 126 | return -ENOMEM; | ||
| 127 | } | ||
| 128 | write_unlock_bh(&ctbl->lock); | ||
| 129 | found: | ||
| 130 | atomic_inc(&ce->refcnt); | ||
| 131 | |||
| 132 | return 0; | ||
| 133 | } | ||
| 134 | EXPORT_SYMBOL(cxgb4_clip_get); | ||
| 135 | |||
| 136 | void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6) | ||
| 137 | { | ||
| 138 | struct adapter *adap = netdev2adap(dev); | ||
| 139 | struct clip_tbl *ctbl = adap->clipt; | ||
| 140 | struct clip_entry *ce, *cte; | ||
| 141 | u32 *addr = (u32 *)lip; | ||
| 142 | int hash; | ||
| 143 | int addr_len; | ||
| 144 | |||
| 145 | if (v6) | ||
| 146 | addr_len = 16; | ||
| 147 | else | ||
| 148 | addr_len = 4; | ||
| 149 | |||
| 150 | hash = clip_addr_hash(ctbl, addr, addr_len); | ||
| 151 | |||
| 152 | read_lock_bh(&ctbl->lock); | ||
| 153 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { | ||
| 154 | if (addr_len == cte->addr_len && | ||
| 155 | memcmp(lip, cte->addr, cte->addr_len) == 0) { | ||
| 156 | ce = cte; | ||
| 157 | read_unlock_bh(&ctbl->lock); | ||
| 158 | goto found; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | read_unlock_bh(&ctbl->lock); | ||
| 162 | |||
| 163 | return; | ||
| 164 | found: | ||
| 165 | write_lock_bh(&ctbl->lock); | ||
| 166 | spin_lock_bh(&ce->lock); | ||
| 167 | if (atomic_dec_and_test(&ce->refcnt)) { | ||
| 168 | list_del(&ce->list); | ||
| 169 | INIT_LIST_HEAD(&ce->list); | ||
| 170 | list_add_tail(&ce->list, &ctbl->ce_free_head); | ||
| 171 | atomic_inc(&ctbl->nfree); | ||
| 172 | if (v6) | ||
| 173 | clip6_release_mbox(dev, (const struct in6_addr *)lip); | ||
| 174 | } | ||
| 175 | spin_unlock_bh(&ce->lock); | ||
| 176 | write_unlock_bh(&ctbl->lock); | ||
| 177 | } | ||
| 178 | EXPORT_SYMBOL(cxgb4_clip_release); | ||
| 179 | |||
| 180 | /* Retrieves IPv6 addresses from a root device (bond, vlan) associated with | ||
| 181 | * a physical device. | ||
| 182 | * The physical device reference is needed to send the actul CLIP command. | ||
| 183 | */ | ||
| 184 | static int cxgb4_update_dev_clip(struct net_device *root_dev, | ||
| 185 | struct net_device *dev) | ||
| 186 | { | ||
| 187 | struct inet6_dev *idev = NULL; | ||
| 188 | struct inet6_ifaddr *ifa; | ||
| 189 | int ret = 0; | ||
| 190 | |||
| 191 | idev = __in6_dev_get(root_dev); | ||
| 192 | if (!idev) | ||
| 193 | return ret; | ||
| 194 | |||
| 195 | read_lock_bh(&idev->lock); | ||
| 196 | list_for_each_entry(ifa, &idev->addr_list, if_list) { | ||
| 197 | ret = cxgb4_clip_get(dev, (const u32 *)ifa->addr.s6_addr, 1); | ||
| 198 | if (ret < 0) | ||
| 199 | break; | ||
| 200 | } | ||
| 201 | read_unlock_bh(&idev->lock); | ||
| 202 | |||
| 203 | return ret; | ||
| 204 | } | ||
| 205 | |||
| 206 | int cxgb4_update_root_dev_clip(struct net_device *dev) | ||
| 207 | { | ||
| 208 | struct net_device *root_dev = NULL; | ||
| 209 | int i, ret = 0; | ||
| 210 | |||
| 211 | /* First populate the real net device's IPv6 addresses */ | ||
| 212 | ret = cxgb4_update_dev_clip(dev, dev); | ||
| 213 | if (ret) | ||
| 214 | return ret; | ||
| 215 | |||
| 216 | /* Parse all bond and vlan devices layered on top of the physical dev */ | ||
| 217 | root_dev = netdev_master_upper_dev_get_rcu(dev); | ||
| 218 | if (root_dev) { | ||
| 219 | ret = cxgb4_update_dev_clip(root_dev, dev); | ||
| 220 | if (ret) | ||
| 221 | return ret; | ||
| 222 | } | ||
| 223 | |||
| 224 | for (i = 0; i < VLAN_N_VID; i++) { | ||
| 225 | root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i); | ||
| 226 | if (!root_dev) | ||
| 227 | continue; | ||
| 228 | |||
| 229 | ret = cxgb4_update_dev_clip(root_dev, dev); | ||
| 230 | if (ret) | ||
| 231 | break; | ||
| 232 | } | ||
| 233 | |||
| 234 | return ret; | ||
| 235 | } | ||
| 236 | EXPORT_SYMBOL(cxgb4_update_root_dev_clip); | ||
| 237 | |||
| 238 | int clip_tbl_show(struct seq_file *seq, void *v) | ||
| 239 | { | ||
| 240 | struct adapter *adapter = seq->private; | ||
| 241 | struct clip_tbl *ctbl = adapter->clipt; | ||
| 242 | struct clip_entry *ce; | ||
| 243 | char ip[60]; | ||
| 244 | int i; | ||
| 245 | |||
| 246 | read_lock_bh(&ctbl->lock); | ||
| 247 | |||
| 248 | seq_puts(seq, "IP Address Users\n"); | ||
| 249 | for (i = 0 ; i < ctbl->clipt_size; ++i) { | ||
| 250 | list_for_each_entry(ce, &ctbl->hash_list[i], list) { | ||
| 251 | ip[0] = '\0'; | ||
| 252 | if (ce->addr_len == 16) | ||
| 253 | sprintf(ip, "%pI6c", ce->addr); | ||
| 254 | else | ||
| 255 | sprintf(ip, "%pI4c", ce->addr); | ||
| 256 | seq_printf(seq, "%-25s %u\n", ip, | ||
| 257 | atomic_read(&ce->refcnt)); | ||
| 258 | } | ||
| 259 | } | ||
| 260 | seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree)); | ||
| 261 | |||
| 262 | read_unlock_bh(&ctbl->lock); | ||
| 263 | |||
| 264 | return 0; | ||
| 265 | } | ||
| 266 | |||
| 267 | struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start, | ||
| 268 | unsigned int clipt_end) | ||
| 269 | { | ||
| 270 | struct clip_entry *cl_list; | ||
| 271 | struct clip_tbl *ctbl; | ||
| 272 | unsigned int clipt_size; | ||
| 273 | int i; | ||
| 274 | |||
| 275 | if (clipt_start >= clipt_end) | ||
| 276 | return NULL; | ||
| 277 | clipt_size = clipt_end - clipt_start + 1; | ||
| 278 | if (clipt_size < CLIPT_MIN_HASH_BUCKETS) | ||
| 279 | return NULL; | ||
| 280 | |||
| 281 | ctbl = t4_alloc_mem(sizeof(*ctbl) + | ||
| 282 | clipt_size*sizeof(struct list_head)); | ||
| 283 | if (!ctbl) | ||
| 284 | return NULL; | ||
| 285 | |||
| 286 | ctbl->clipt_start = clipt_start; | ||
| 287 | ctbl->clipt_size = clipt_size; | ||
| 288 | INIT_LIST_HEAD(&ctbl->ce_free_head); | ||
| 289 | |||
| 290 | atomic_set(&ctbl->nfree, clipt_size); | ||
| 291 | rwlock_init(&ctbl->lock); | ||
| 292 | |||
| 293 | for (i = 0; i < ctbl->clipt_size; ++i) | ||
| 294 | INIT_LIST_HEAD(&ctbl->hash_list[i]); | ||
| 295 | |||
| 296 | cl_list = t4_alloc_mem(clipt_size*sizeof(struct clip_entry)); | ||
| 297 | ctbl->cl_list = (void *)cl_list; | ||
| 298 | |||
| 299 | for (i = 0; i < clipt_size; i++) { | ||
| 300 | INIT_LIST_HEAD(&cl_list[i].list); | ||
| 301 | list_add_tail(&cl_list[i].list, &ctbl->ce_free_head); | ||
| 302 | } | ||
| 303 | |||
| 304 | return ctbl; | ||
| 305 | } | ||
| 306 | |||
| 307 | void t4_cleanup_clip_tbl(struct adapter *adap) | ||
| 308 | { | ||
| 309 | struct clip_tbl *ctbl = adap->clipt; | ||
| 310 | |||
| 311 | if (ctbl) { | ||
| 312 | if (ctbl->cl_list) | ||
| 313 | t4_free_mem(ctbl->cl_list); | ||
| 314 | t4_free_mem(ctbl); | ||
| 315 | } | ||
| 316 | } | ||
| 317 | EXPORT_SYMBOL(t4_cleanup_clip_tbl); | ||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of the Chelsio T4 Ethernet driver for Linux. | ||
| 3 | * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved. | ||
| 4 | * | ||
| 5 | * Written by Deepak (deepak.s@chelsio.com) | ||
| 6 | * | ||
| 7 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 8 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 9 | * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this | ||
| 10 | * release for licensing terms and conditions. | ||
| 11 | */ | ||
| 12 | |||
| 13 | struct clip_entry { | ||
| 14 | spinlock_t lock; /* Hold while modifying clip reference */ | ||
| 15 | atomic_t refcnt; | ||
| 16 | struct list_head list; | ||
| 17 | u32 addr[4]; | ||
| 18 | int addr_len; | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct clip_tbl { | ||
| 22 | unsigned int clipt_start; | ||
| 23 | unsigned int clipt_size; | ||
| 24 | rwlock_t lock; | ||
| 25 | atomic_t nfree; | ||
| 26 | struct list_head ce_free_head; | ||
| 27 | void *cl_list; | ||
| 28 | struct list_head hash_list[0]; | ||
| 29 | }; | ||
| 30 | |||
| 31 | enum { | ||
| 32 | CLIPT_MIN_HASH_BUCKETS = 2, | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start, | ||
| 36 | unsigned int clipt_end); | ||
| 37 | int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6); | ||
| 38 | void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6); | ||
| 39 | int clip_tbl_show(struct seq_file *seq, void *v); | ||
| 40 | int cxgb4_update_root_dev_clip(struct net_device *dev); | ||
| 41 | void t4_cleanup_clip_tbl(struct adapter *adap); | ||
| @@ -49,16 +49,6 @@ · 48 unmodified lines | |||
| 49 | #include <asm/io.h> | 49 | #include <asm/io.h> |
| 50 | #include "cxgb4_uld.h" | 50 | #include "cxgb4_uld.h" |
| 51 | 51 | ||
| 52 | #define T4FW_VERSION_MAJOR 0x01 | ||
| 53 | #define T4FW_VERSION_MINOR 0x0C | ||
| 54 | #define T4FW_VERSION_MICRO 0x19 | ||
| 55 | #define T4FW_VERSION_BUILD 0x00 | ||
| 56 | |||
| 57 | #define T5FW_VERSION_MAJOR 0x01 | ||
| 58 | #define T5FW_VERSION_MINOR 0x0C | ||
| 59 | #define T5FW_VERSION_MICRO 0x19 | ||
| 60 | #define T5FW_VERSION_BUILD 0x00 | ||
| 61 | |||
| 62 | #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__) | 52 | #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__) |
| 63 | 53 | ||
| 64 | enum { | 54 | enum { |
| @@ -231,6 +221,7 @@ struct sge_params { · 166 unmodified lines | |||
| 231 | struct tp_params { | 221 | struct tp_params { |
| 232 | unsigned int ntxchan; /* # of Tx channels */ | 222 | unsigned int ntxchan; /* # of Tx channels */ |
| 233 | unsigned int tre; /* log2 of core clocks per TP tick */ | 223 | unsigned int tre; /* log2 of core clocks per TP tick */ |
| 224 | unsigned int la_mask; /* what events are recorded by TP LA */ | ||
| 234 | unsigned short tx_modq_map; /* TX modulation scheduler queue to */ | 225 | unsigned short tx_modq_map; /* TX modulation scheduler queue to */ |
| 235 | /* channel map */ | 226 | /* channel map */ |
| 236 | 227 | ||
| @@ -290,11 +281,21 @@ enum chip_type { · 53 unmodified lines | |||
| 290 | T5_LAST_REV = T5_A1, | 281 | T5_LAST_REV = T5_A1, |
| 291 | }; | 282 | }; |
| 292 | 283 | ||
| 284 | struct devlog_params { | ||
| 285 | u32 memtype; /* which memory (EDC0, EDC1, MC) */ | ||
| 286 | u32 start; /* start of log in firmware memory */ | ||
| 287 | u32 size; /* size of log */ | ||
| 288 | }; | ||
| 289 | |||
| 293 | struct adapter_params { | 290 | struct adapter_params { |
| 294 | struct sge_params sge; | 291 | struct sge_params sge; |
| 295 | struct tp_params tp; | 292 | struct tp_params tp; |
| 296 | struct vpd_params vpd; | 293 | struct vpd_params vpd; |
| 297 | struct pci_params pci; | 294 | struct pci_params pci; |
| 295 | struct devlog_params devlog; | ||
| 296 | enum pcie_memwin drv_memwin; | ||
| 297 | |||
| 298 | unsigned int cim_la_size; | ||
| 298 | 299 | ||
| 299 | unsigned int sf_size; /* serial flash size in bytes */ | 300 | unsigned int sf_size; /* serial flash size in bytes */ |
| 300 | unsigned int sf_nsec; /* # of flash sectors */ | 301 | unsigned int sf_nsec; /* # of flash sectors */ |
| @@ -476,6 +477,22 @@ struct sge_rspq { /* state for an SGE response queue */ · 175 unmodified lines | |||
| 476 | struct adapter *adap; | 477 | struct adapter *adap; |
| 477 | struct net_device *netdev; /* associated net device */ | 478 | struct net_device *netdev; /* associated net device */ |
| 478 | rspq_handler_t handler; | 479 | rspq_handler_t handler; |
| 480 | #ifdef CONFIG_NET_RX_BUSY_POLL | ||
| 481 | #define CXGB_POLL_STATE_IDLE 0 | ||
| 482 | #define CXGB_POLL_STATE_NAPI BIT(0) /* NAPI owns this poll */ | ||
| 483 | #define CXGB_POLL_STATE_POLL BIT(1) /* poll owns this poll */ | ||
| 484 | #define CXGB_POLL_STATE_NAPI_YIELD BIT(2) /* NAPI yielded this poll */ | ||
| 485 | #define CXGB_POLL_STATE_POLL_YIELD BIT(3) /* poll yielded this poll */ | ||
| 486 | #define CXGB_POLL_YIELD (CXGB_POLL_STATE_NAPI_YIELD | \ | ||
| 487 | CXGB_POLL_STATE_POLL_YIELD) | ||
| 488 | #define CXGB_POLL_LOCKED (CXGB_POLL_STATE_NAPI | \ | ||
| 489 | CXGB_POLL_STATE_POLL) | ||
| 490 | #define CXGB_POLL_USER_PEND (CXGB_POLL_STATE_POLL | \ | ||
| 491 | CXGB_POLL_STATE_POLL_YIELD) | ||
| 492 | unsigned int bpoll_state; | ||
| 493 | spinlock_t bpoll_lock; /* lock for busy poll */ | ||
| 494 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | ||
| 495 | |||
| 479 | }; | 496 | }; |
| 480 | 497 | ||
| 481 | struct sge_eth_stats { /* Ethernet queue statistics */ | 498 | struct sge_eth_stats { /* Ethernet queue statistics */ |
| @@ -658,6 +675,9 @@ struct adapter { · 176 unmodified lines | |||
| 658 | unsigned int l2t_start; | 675 | unsigned int l2t_start; |
| 659 | unsigned int l2t_end; | 676 | unsigned int l2t_end; |
| 660 | struct l2t_data *l2t; | 677 | struct l2t_data *l2t; |
| 678 | unsigned int clipt_start; | ||
| 679 | unsigned int clipt_end; | ||
| 680 | struct clip_tbl *clipt; | ||
| 661 | void *uld_handle[CXGB4_ULD_MAX]; | 681 | void *uld_handle[CXGB4_ULD_MAX]; |
| 662 | struct list_head list_node; | 682 | struct list_head list_node; |
| 663 | struct list_head rcu_node; | 683 | struct list_head rcu_node; |
| @@ -877,6 +897,102 @@ static inline struct adapter *netdev2adap(const struct net_device *dev) · 213 unmodified lines | |||
| 877 | return netdev2pinfo(dev)->adapter; | 897 | return netdev2pinfo(dev)->adapter; |
| 878 | } | 898 | } |
| 879 | 899 | ||
| 900 | #ifdef CONFIG_NET_RX_BUSY_POLL | ||
| 901 | static inline void cxgb_busy_poll_init_lock(struct sge_rspq *q) | ||
| 902 | { | ||
| 903 | spin_lock_init(&q->bpoll_lock); | ||
| 904 | q->bpoll_state = CXGB_POLL_STATE_IDLE; | ||
| 905 | } | ||
| 906 | |||
| 907 | static inline bool cxgb_poll_lock_napi(struct sge_rspq *q) | ||
| 908 | { | ||
| 909 | bool rc = true; | ||
| 910 | |||
| 911 | spin_lock(&q->bpoll_lock); | ||
| 912 | if (q->bpoll_state & CXGB_POLL_LOCKED) { | ||
| 913 | q->bpoll_state |= CXGB_POLL_STATE_NAPI_YIELD; | ||
| 914 | rc = false; | ||
| 915 | } else { | ||
| 916 | q->bpoll_state = CXGB_POLL_STATE_NAPI; | ||
| 917 | } | ||
| 918 | spin_unlock(&q->bpoll_lock); | ||
| 919 | return rc; | ||
| 920 | } | ||
| 921 | |||
| 922 | static inline bool cxgb_poll_unlock_napi(struct sge_rspq *q) | ||
| 923 | { | ||
| 924 | bool rc = false; | ||
| 925 | |||
| 926 | spin_lock(&q->bpoll_lock); | ||
| 927 | if (q->bpoll_state & CXGB_POLL_STATE_POLL_YIELD) | ||
| 928 | rc = true; | ||
| 929 | q->bpoll_state = CXGB_POLL_STATE_IDLE; | ||
| 930 | spin_unlock(&q->bpoll_lock); | ||
| 931 | return rc; | ||
| 932 | } | ||
| 933 | |||
| 934 | static inline bool cxgb_poll_lock_poll(struct sge_rspq *q) | ||
| 935 | { | ||
| 936 | bool rc = true; | ||
| 937 | |||
| 938 | spin_lock_bh(&q->bpoll_lock); | ||
| 939 | if (q->bpoll_state & CXGB_POLL_LOCKED) { | ||
| 940 | q->bpoll_state |= CXGB_POLL_STATE_POLL_YIELD; | ||
| 941 | rc = false; | ||
| 942 | } else { | ||
| 943 | q->bpoll_state |= CXGB_POLL_STATE_POLL; | ||
| 944 | } | ||
| 945 | spin_unlock_bh(&q->bpoll_lock); | ||
| 946 | return rc; | ||
| 947 | } | ||
| 948 | |||
| 949 | static inline bool cxgb_poll_unlock_poll(struct sge_rspq *q) | ||
| 950 | { | ||
| 951 | bool rc = false; | ||
| 952 | |||
| 953 | spin_lock_bh(&q->bpoll_lock); | ||
| 954 | if (q->bpoll_state & CXGB_POLL_STATE_POLL_YIELD) | ||
| 955 | rc = true; | ||
| 956 | q->bpoll_state = CXGB_POLL_STATE_IDLE; | ||
| 957 | spin_unlock_bh(&q->bpoll_lock); | ||
| 958 | return rc; | ||
| 959 | } | ||
| 960 | |||
| 961 | static inline bool cxgb_poll_busy_polling(struct sge_rspq *q) | ||
| 962 | { | ||
| 963 | return q->bpoll_state & CXGB_POLL_USER_PEND; | ||
| 964 | } | ||
| 965 | #else | ||
| 966 | static inline void cxgb_busy_poll_init_lock(struct sge_rspq *q) | ||
| 967 | { | ||
| 968 | } | ||
| 969 | |||
| 970 | static inline bool cxgb_poll_lock_napi(struct sge_rspq *q) | ||
| 971 | { | ||
| 972 | return true; | ||
| 973 | } | ||
| 974 | |||
| 975 | static inline bool cxgb_poll_unlock_napi(struct sge_rspq *q) | ||
| 976 | { | ||
| 977 | return false; | ||
| 978 | } | ||
| 979 | |||
| 980 | static inline bool cxgb_poll_lock_poll(struct sge_rspq *q) | ||
| 981 | { | ||
| 982 | return false; | ||
| 983 | } | ||
| 984 | |||
| 985 | static inline bool cxgb_poll_unlock_poll(struct sge_rspq *q) | ||
| 986 | { | ||
| 987 | return false; | ||
| 988 | } | ||
| 989 | |||
| 990 | static inline bool cxgb_poll_busy_polling(struct sge_rspq *q) | ||
| 991 | { | ||
| 992 | return false; | ||
| 993 | } | ||
| 994 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | ||
| 995 | |||
| 880 | void t4_os_portmod_changed(const struct adapter *adap, int port_id); | 996 | void t4_os_portmod_changed(const struct adapter *adap, int port_id); |
| 881 | void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); | 997 | void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); |
| 882 | 998 | ||
| @@ -905,6 +1021,7 @@ irqreturn_t t4_sge_intr_msix(int irq, void *cookie); · 22 unmodified lines | |||
| 905 | int t4_sge_init(struct adapter *adap); | 1021 | int t4_sge_init(struct adapter *adap); |
| 906 | void t4_sge_start(struct adapter *adap); | 1022 | void t4_sge_start(struct adapter *adap); |
| 907 | void t4_sge_stop(struct adapter *adap); | 1023 | void t4_sge_stop(struct adapter *adap); |
| 1024 | int cxgb_busy_poll(struct napi_struct *napi); | ||
| 908 | extern int dbfifo_int_thresh; | 1025 | extern int dbfifo_int_thresh; |
| 909 | 1026 | ||
| 910 | #define for_each_port(adapter, iter) \ | 1027 | #define for_each_port(adapter, iter) \ |
| @@ -995,12 +1112,16 @@ static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, · 84 unmodified lines | |||
| 995 | 1112 | ||
| 996 | int t4_seeprom_wp(struct adapter *adapter, bool enable); | 1113 | int t4_seeprom_wp(struct adapter *adapter, bool enable); |
| 997 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p); | 1114 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p); |
| 1115 | int t4_read_flash(struct adapter *adapter, unsigned int addr, | ||
| 1116 | unsigned int nwords, u32 *data, int byte_oriented); | ||
| 998 | int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); | 1117 | int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); |
| 1118 | int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op); | ||
| 999 | int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, | 1119 | int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, |
| 1000 | const u8 *fw_data, unsigned int size, int force); | 1120 | const u8 *fw_data, unsigned int size, int force); |
| 1001 | unsigned int t4_flash_cfg_addr(struct adapter *adapter); | 1121 | unsigned int t4_flash_cfg_addr(struct adapter *adapter); |
| 1002 | int t4_get_fw_version(struct adapter *adapter, u32 *vers); | 1122 | int t4_get_fw_version(struct adapter *adapter, u32 *vers); |
| 1003 | int t4_get_tp_version(struct adapter *adapter, u32 *vers); | 1123 | int t4_get_tp_version(struct adapter *adapter, u32 *vers); |
| 1124 | int t4_get_exprom_version(struct adapter *adapter, u32 *vers); | ||
| 1004 | int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, | 1125 | int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, |
| 1005 | const u8 *fw_data, unsigned int fw_size, | 1126 | const u8 *fw_data, unsigned int fw_size, |
| 1006 | struct fw_hdr *card_fw, enum dev_state state, int *reset); | 1127 | struct fw_hdr *card_fw, enum dev_state state, int *reset); |
| @@ -1013,6 +1134,8 @@ int cxgb4_t4_bar2_sge_qregs(struct adapter *adapter, · 6 unmodified lines | |||
| 1013 | u64 *pbar2_qoffset, | 1134 | u64 *pbar2_qoffset, |
| 1014 | unsigned int *pbar2_qid); | 1135 | unsigned int *pbar2_qid); |
| 1015 | 1136 | ||
| 1137 | unsigned int qtimer_val(const struct adapter *adap, | ||
| 1138 | const struct sge_rspq *q); | ||
| 1016 | int t4_init_sge_params(struct adapter *adapter); | 1139 | int t4_init_sge_params(struct adapter *adapter); |
| 1017 | int t4_init_tp_params(struct adapter *adap); | 1140 | int t4_init_tp_params(struct adapter *adap); |
| 1018 | int t4_filter_field_shift(const struct adapter *adap, int filter_sel); | 1141 | int t4_filter_field_shift(const struct adapter *adap, int filter_sel); |
| @@ -1022,20 +1145,46 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, · 3 unmodified lines | |||
| 1022 | int start, int n, const u16 *rspq, unsigned int nrspq); | 1145 | int start, int n, const u16 *rspq, unsigned int nrspq); |
| 1023 | int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, | 1146 | int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, |
| 1024 | unsigned int flags); | 1147 | unsigned int flags); |
| 1148 | int t4_read_rss(struct adapter *adapter, u16 *entries); | ||
| 1149 | void t4_read_rss_key(struct adapter *adapter, u32 *key); | ||
| 1150 | void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx); | ||
| 1151 | void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, | ||
| 1152 | u32 *valp); | ||
| 1153 | void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, | ||
| 1154 | u32 *vfl, u32 *vfh); | ||
| 1155 | u32 t4_read_rss_pf_map(struct adapter *adapter); | ||
| 1156 | u32 t4_read_rss_pf_mask(struct adapter *adapter); | ||
| 1157 | |||
| 1025 | int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, | 1158 | int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, |
| 1026 | u64 *parity); | 1159 | u64 *parity); |
| 1027 | int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, | 1160 | int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, |
| 1028 | u64 *parity); | 1161 | u64 *parity); |
| 1162 | void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); | ||
| 1163 | void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); | ||
| 1164 | int t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, | ||
| 1165 | size_t n); | ||
| 1166 | int t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, | ||
| 1167 | size_t n); | ||
| 1168 | int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, | ||
| 1169 | unsigned int *valp); | ||
| 1170 | int t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, | ||
| 1171 | const unsigned int *valp); | ||
| 1172 | int t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr); | ||
| 1173 | void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres); | ||
| 1029 | const char *t4_get_port_type_description(enum fw_port_type port_type); | 1174 | const char *t4_get_port_type_description(enum fw_port_type port_type); |
| 1030 | void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); | 1175 | void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); |
| 1031 | void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); | 1176 | void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); |
| 1177 | void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]); | ||
| 1032 | void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, | 1178 | void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, |
| 1033 | unsigned int mask, unsigned int val); | 1179 | unsigned int mask, unsigned int val); |
| 1180 | void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); | ||
| 1034 | void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, | 1181 | void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, |
| 1035 | struct tp_tcp_stats *v6); | 1182 | struct tp_tcp_stats *v6); |
| 1036 | void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, | 1183 | void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, |
| 1037 | const unsigned short *alpha, const unsigned short *beta); | 1184 | const unsigned short *alpha, const unsigned short *beta); |
| 1038 | 1185 | ||
| 1186 | void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf); | ||
| 1187 | |||
| 1039 | void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); | 1188 | void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); |
| 1040 | 1189 | ||
| 1041 | void t4_wol_magic_enable(struct adapter *adap, unsigned int port, | 1190 | void t4_wol_magic_enable(struct adapter *adap, unsigned int port, |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | /* DCBx version control | 23 | /* DCBx version control |
| 24 | */ | 24 | */ |
| 25 | char *dcb_ver_array[] = { | 25 | static const char * const dcb_ver_array[] = { |
| 26 | "Unknown", | 26 | "Unknown", |
| 27 | "DCBx-CIN", | 27 | "DCBx-CIN", |
| 28 | "DCBx-CEE 1.01", | 28 | "DCBx-CEE 1.01", |
| @@ -428,7 +428,10 @@ static void cxgb4_getpgtccfg(struct net_device *dev, int tc, · 399 unmodified lines | |||
| 428 | } | 428 | } |
| 429 | *pgid = (be32_to_cpu(pcmd.u.dcb.pgid.pgid) >> (tc * 4)) & 0xf; | 429 | *pgid = (be32_to_cpu(pcmd.u.dcb.pgid.pgid) >> (tc * 4)) & 0xf; |
| 430 | 430 | ||
| 431 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | 431 | if (local) |
| 432 | INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); | ||
| 433 | else | ||
| 434 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | ||
| 432 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; | 435 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; |
| 433 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); | 436 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); |
| 434 | if (err != FW_PORT_DCB_CFG_SUCCESS) { | 437 | if (err != FW_PORT_DCB_CFG_SUCCESS) { |
| @@ -900,6 +903,88 @@ cxgb4_ieee_negotiation_complete(struct net_device *dev, · 465 unmodified lines | |||
| 900 | (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); | 903 | (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); |
| 901 | } | 904 | } |
| 902 | 905 | ||
| 906 | static int cxgb4_ieee_read_ets(struct net_device *dev, struct ieee_ets *ets, | ||
| 907 | int local) | ||
| 908 | { | ||
| 909 | struct port_info *pi = netdev2pinfo(dev); | ||
| 910 | struct port_dcb_info *dcb = &pi->dcb; | ||
| 911 | struct adapter *adap = pi->adapter; | ||
| 912 | uint32_t tc_info; | ||
| 913 | struct fw_port_cmd pcmd; | ||
| 914 | int i, bwg, err; | ||
| 915 | |||
| 916 | if (!(dcb->msgs & (CXGB4_DCB_FW_PGID | CXGB4_DCB_FW_PGRATE))) | ||
| 917 | return 0; | ||
| 918 | |||
| 919 | ets->ets_cap = dcb->pg_num_tcs_supported; | ||
| 920 | |||
| 921 | if (local) { | ||
| 922 | ets->willing = 1; | ||
| 923 | INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); | ||
| 924 | } else { | ||
| 925 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | ||
| 926 | } | ||
| 927 | |||
| 928 | pcmd.u.dcb.pgid.type = FW_PORT_DCB_TYPE_PGID; | ||
| 929 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); | ||
| 930 | if (err != FW_PORT_DCB_CFG_SUCCESS) { | ||
| 931 | dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); | ||
| 932 | return err; | ||
| 933 | } | ||
| 934 | |||
| 935 | tc_info = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | ||
| 936 | |||
| 937 | if (local) | ||
| 938 | INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); | ||
| 939 | else | ||
| 940 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | ||
| 941 | |||
| 942 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; | ||
| 943 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); | ||
| 944 | if (err != FW_PORT_DCB_CFG_SUCCESS) { | ||
| 945 | dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", | ||
| 946 | -err); | ||
| 947 | return err; | ||
| 948 | } | ||
| 949 | |||
| 950 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { | ||
| 951 | bwg = (tc_info >> ((7 - i) * 4)) & 0xF; | ||
| 952 | ets->prio_tc[i] = bwg; | ||
| 953 | ets->tc_tx_bw[i] = pcmd.u.dcb.pgrate.pgrate[i]; | ||
| 954 | ets->tc_rx_bw[i] = ets->tc_tx_bw[i]; | ||
| 955 | ets->tc_tsa[i] = pcmd.u.dcb.pgrate.tsa[i]; | ||
| 956 | } | ||
| 957 | |||
| 958 | return 0; | ||
| 959 | } | ||
| 960 | |||
| 961 | static int cxgb4_ieee_get_ets(struct net_device *dev, struct ieee_ets *ets) | ||
| 962 | { | ||
| 963 | return cxgb4_ieee_read_ets(dev, ets, 1); | ||
| 964 | } | ||
| 965 | |||
| 966 | /* We reuse this for peer PFC as well, as we can't have it enabled one way */ | ||
| 967 | static int cxgb4_ieee_get_pfc(struct net_device *dev, struct ieee_pfc *pfc) | ||
| 968 | { | ||
| 969 | struct port_info *pi = netdev2pinfo(dev); | ||
| 970 | struct port_dcb_info *dcb = &pi->dcb; | ||
| 971 | |||
| 972 | memset(pfc, 0, sizeof(struct ieee_pfc)); | ||
| 973 | |||
| 974 | if (!(dcb->msgs & CXGB4_DCB_FW_PFC)) | ||
| 975 | return 0; | ||
| 976 | |||
| 977 | pfc->pfc_cap = dcb->pfc_num_tcs_supported; | ||
| 978 | pfc->pfc_en = bitswap_1(dcb->pfcen); | ||
| 979 | |||
| 980 | return 0; | ||
| 981 | } | ||
| 982 | |||
| 983 | static int cxgb4_ieee_peer_ets(struct net_device *dev, struct ieee_ets *ets) | ||
| 984 | { | ||
| 985 | return cxgb4_ieee_read_ets(dev, ets, 0); | ||
| 986 | } | ||
| 987 | |||
| 903 | /* Fill in the Application User Priority Map associated with the | 988 | /* Fill in the Application User Priority Map associated with the |
| 904 | * specified Application. | 989 | * specified Application. |
| 905 | * Priority for IEEE dcb_app is an integer, with 0 being a valid value | 990 | * Priority for IEEE dcb_app is an integer, with 0 being a valid value |
| @@ -1106,14 +1191,23 @@ static int cxgb4_cee_peer_getpfc(struct net_device *dev, struct cee_pfc *pfc) · 200 unmodified lines | |||
| 1106 | struct port_info *pi = netdev2pinfo(dev); | 1191 | struct port_info *pi = netdev2pinfo(dev); |
| 1107 | 1192 | ||
| 1108 | cxgb4_getnumtcs(dev, DCB_NUMTCS_ATTR_PFC, &(pfc->tcs_supported)); | 1193 | cxgb4_getnumtcs(dev, DCB_NUMTCS_ATTR_PFC, &(pfc->tcs_supported)); |
| 1109 | pfc->pfc_en = pi->dcb.pfcen; | 1194 | |
| 1195 | /* Firmware sends this to us in a formwat that is a bit flipped version | ||
| 1196 | * of spec, correct it before we send it to host. This is taken care of | ||
| 1197 | * by bit shifting in other uses of pfcen | ||
| 1198 | */ | ||
| 1199 | pfc->pfc_en = bitswap_1(pi->dcb.pfcen); | ||
| 1110 | 1200 | ||
| 1111 | return 0; | 1201 | return 0; |
| 1112 | } | 1202 | } |
| 1113 | 1203 | ||
| 1114 | const struct dcbnl_rtnl_ops cxgb4_dcb_ops = { | 1204 | const struct dcbnl_rtnl_ops cxgb4_dcb_ops = { |
| 1205 | .ieee_getets = cxgb4_ieee_get_ets, | ||
| 1206 | .ieee_getpfc = cxgb4_ieee_get_pfc, | ||
| 1115 | .ieee_getapp = cxgb4_ieee_getapp, | 1207 | .ieee_getapp = cxgb4_ieee_getapp, |
| 1116 | .ieee_setapp = cxgb4_ieee_setapp, | 1208 | .ieee_setapp = cxgb4_ieee_setapp, |
| 1209 | .ieee_peer_getets = cxgb4_ieee_peer_ets, | ||
| 1210 | .ieee_peer_getpfc = cxgb4_ieee_get_pfc, | ||
| 1117 | 1211 | ||
| 1118 | /* CEE std */ | 1212 | /* CEE std */ |
| 1119 | .getstate = cxgb4_getstate, | 1213 | .getstate = cxgb4_getstate, |
| @@ -136,6 +136,17 @@ void cxgb4_dcb_handle_fw_update(struct adapter *, const struct fw_port_cmd *); · 135 unmodified lines | |||
| 136 | void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *); | 136 | void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *); |
| 137 | extern const struct dcbnl_rtnl_ops cxgb4_dcb_ops; | 137 | extern const struct dcbnl_rtnl_ops cxgb4_dcb_ops; |
| 138 | 138 | ||
| 139 | static inline __u8 bitswap_1(unsigned char val) | ||
| 140 | { | ||
| 141 | return ((val & 0x80) >> 7) | | ||
| 142 | ((val & 0x40) >> 5) | | ||
| 143 | ((val & 0x20) >> 3) | | ||
| 144 | ((val & 0x10) >> 1) | | ||
| 145 | ((val & 0x08) << 1) | | ||
| 146 | ((val & 0x04) << 3) | | ||
| 147 | ((val & 0x02) << 5) | | ||
| 148 | ((val & 0x01) << 7); | ||
| 149 | } | ||
| 139 | #define CXGB4_DCB_ENABLED true | 150 | #define CXGB4_DCB_ENABLED true |
| 140 | 151 | ||
| 141 | #else /* !CONFIG_CHELSIO_T4_DCB */ | 152 | #else /* !CONFIG_CHELSIO_T4_DCB */ |
| @@ -36,13 +36,1867 @@ · 35 unmodified lines | |||
| 36 | #include <linux/debugfs.h> | 36 | #include <linux/debugfs.h> |
| 37 | #include <linux/string_helpers.h> | 37 | #include <linux/string_helpers.h> |
| 38 | #include <linux/sort.h> | 38 | #include <linux/sort.h> |
| 39 | #include <linux/ctype.h> | ||
| 39 | 40 | ||
| 40 | #include "cxgb4.h" | 41 | #include "cxgb4.h" |
| 41 | #include "t4_regs.h" | 42 | #include "t4_regs.h" |
| 43 | #include "t4_values.h" | ||
| 42 | #include "t4fw_api.h" | 44 | #include "t4fw_api.h" |
| 43 | #include "cxgb4_debugfs.h" | 45 | #include "cxgb4_debugfs.h" |
| 46 | #include "clip_tbl.h" | ||
| 44 | #include "l2t.h" | 47 | #include "l2t.h" |
| 45 | 48 | ||
| 49 | /* generic seq_file support for showing a table of size rows x width. */ | ||
| 50 | static void *seq_tab_get_idx(struct seq_tab *tb, loff_t pos) | ||
| 51 | { | ||
| 52 | pos -= tb->skip_first; | ||
| 53 | return pos >= tb->rows ? NULL : &tb->data[pos * tb->width]; | ||
| 54 | } | ||
| 55 | |||
| 56 | static void *seq_tab_start(struct seq_file *seq, loff_t *pos) | ||
| 57 | { | ||
| 58 | struct seq_tab *tb = seq->private; | ||
| 59 | |||
| 60 | if (tb->skip_first && *pos == 0) | ||
| 61 | return SEQ_START_TOKEN; | ||
| 62 | |||
| 63 | return seq_tab_get_idx(tb, *pos); | ||
| 64 | } | ||
| 65 | |||
| 66 | static void *seq_tab_next(struct seq_file *seq, void *v, loff_t *pos) | ||
| 67 | { | ||
| 68 | v = seq_tab_get_idx(seq->private, *pos + 1); | ||
| 69 | if (v) | ||
| 70 | ++*pos; | ||
| 71 | return v; | ||
| 72 | } | ||
| 73 | |||
| 74 | static void seq_tab_stop(struct seq_file *seq, void *v) | ||
| 75 | { | ||
| 76 | } | ||
| 77 | |||
| 78 | static int seq_tab_show(struct seq_file *seq, void *v) | ||
| 79 | { | ||
| 80 | const struct seq_tab *tb = seq->private; | ||
| 81 | |||
| 82 | return tb->show(seq, v, ((char *)v - tb->data) / tb->width); | ||
| 83 | } | ||
| 84 | |||
| 85 | static const struct seq_operations seq_tab_ops = { | ||
| 86 | .start = seq_tab_start, | ||
| 87 | .next = seq_tab_next, | ||
| 88 | .stop = seq_tab_stop, | ||
| 89 | .show = seq_tab_show | ||
| 90 | }; | ||
| 91 | |||
| 92 | struct seq_tab *seq_open_tab(struct file *f, unsigned int rows, | ||
| 93 | unsigned int width, unsigned int have_header, | ||
| 94 | int (*show)(struct seq_file *seq, void *v, int i)) | ||
| 95 | { | ||
| 96 | struct seq_tab *p; | ||
| 97 | |||
| 98 | p = __seq_open_private(f, &seq_tab_ops, sizeof(*p) + rows * width); | ||
| 99 | if (p) { | ||
| 100 | p->show = show; | ||
| 101 | p->rows = rows; | ||
| 102 | p->width = width; | ||
| 103 | p->skip_first = have_header != 0; | ||
| 104 | } | ||
| 105 | return p; | ||
| 106 | } | ||
| 107 | |||
| 108 | /* Trim the size of a seq_tab to the supplied number of rows. The operation is | ||
| 109 | * irreversible. | ||
| 110 | */ | ||
| 111 | static int seq_tab_trim(struct seq_tab *p, unsigned int new_rows) | ||
| 112 | { | ||
| 113 | if (new_rows > p->rows) | ||
| 114 | return -EINVAL; | ||
| 115 | p->rows = new_rows; | ||
| 116 | return 0; | ||
| 117 | } | ||
| 118 | |||
| 119 | static int cim_la_show(struct seq_file *seq, void *v, int idx) | ||
| 120 | { | ||
| 121 | if (v == SEQ_START_TOKEN) | ||
| 122 | seq_puts(seq, "Status Data PC LS0Stat LS0Addr " | ||
| 123 | " LS0Data\n"); | ||
| 124 | else { | ||
| 125 | const u32 *p = v; | ||
| 126 | |||
| 127 | seq_printf(seq, | ||
| 128 | " %02x %x%07x %x%07x %08x %08x %08x%08x%08x%08x\n", | ||
| 129 | (p[0] >> 4) & 0xff, p[0] & 0xf, p[1] >> 4, | ||
| 130 | p[1] & 0xf, p[2] >> 4, p[2] & 0xf, p[3], p[4], p[5], | ||
| 131 | p[6], p[7]); | ||
| 132 | } | ||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | static int cim_la_show_3in1(struct seq_file *seq, void *v, int idx) | ||
| 137 | { | ||
| 138 | if (v == SEQ_START_TOKEN) { | ||
| 139 | seq_puts(seq, "Status Data PC\n"); | ||
| 140 | } else { | ||
| 141 | const u32 *p = v; | ||
| 142 | |||
| 143 | seq_printf(seq, " %02x %08x %08x\n", p[5] & 0xff, p[6], | ||
| 144 | p[7]); | ||
| 145 | seq_printf(seq, " %02x %02x%06x %02x%06x\n", | ||
| 146 | (p[3] >> 8) & 0xff, p[3] & 0xff, p[4] >> 8, | ||
| 147 | p[4] & 0xff, p[5] >> 8); | ||
| 148 | seq_printf(seq, " %02x %x%07x %x%07x\n", (p[0] >> 4) & 0xff, | ||
| 149 | p[0] & 0xf, p[1] >> 4, p[1] & 0xf, p[2] >> 4); | ||
| 150 | } | ||
| 151 | return 0; | ||
| 152 | } | ||
| 153 | |||
| 154 | static int cim_la_open(struct inode *inode, struct file *file) | ||
| 155 | { | ||
| 156 | int ret; | ||
| 157 | unsigned int cfg; | ||
| 158 | struct seq_tab *p; | ||
| 159 | struct adapter *adap = inode->i_private; | ||
| 160 | |||
| 161 | ret = t4_cim_read(adap, UP_UP_DBG_LA_CFG_A, 1, &cfg); | ||
| 162 | if (ret) | ||
| 163 | return ret; | ||
| 164 | |||
| 165 | p = seq_open_tab(file, adap->params.cim_la_size / 8, 8 * sizeof(u32), 1, | ||
| 166 | cfg & UPDBGLACAPTPCONLY_F ? | ||
| 167 | cim_la_show_3in1 : cim_la_show); | ||
| 168 | if (!p) | ||
| 169 | return -ENOMEM; | ||
| 170 | |||
| 171 | ret = t4_cim_read_la(adap, (u32 *)p->data, NULL); | ||
| 172 | if (ret) | ||
| 173 | seq_release_private(inode, file); | ||
| 174 | return ret; | ||
| 175 | } | ||
| 176 | |||
| 177 | static const struct file_operations cim_la_fops = { | ||
| 178 | .owner = THIS_MODULE, | ||
| 179 | .open = cim_la_open, | ||
| 180 | .read = seq_read, | ||
| 181 | .llseek = seq_lseek, | ||
| 182 | .release = seq_release_private | ||
| 183 | }; | ||
| 184 | |||
| 185 | static int cim_qcfg_show(struct seq_file *seq, void *v) | ||
| 186 | { | ||
| 187 | static const char * const qname[] = { | ||
| 188 | "TP0", "TP1", "ULP", "SGE0", "SGE1", "NC-SI", | ||
| 189 | "ULP0", "ULP1", "ULP2", "ULP3", "SGE", "NC-SI", | ||
| 190 | "SGE0-RX", "SGE1-RX" | ||
| 191 | }; | ||
| 192 | |||
| 193 | int i; | ||
| 194 | struct adapter *adap = seq->private; | ||
| 195 | u16 base[CIM_NUM_IBQ + CIM_NUM_OBQ_T5]; | ||
| 196 | u16 size[CIM_NUM_IBQ + CIM_NUM_OBQ_T5]; | ||
| 197 | u32 stat[(4 * (CIM_NUM_IBQ + CIM_NUM_OBQ_T5))]; | ||
| 198 | u16 thres[CIM_NUM_IBQ]; | ||
| 199 | u32 obq_wr_t4[2 * CIM_NUM_OBQ], *wr; | ||
| 200 | u32 obq_wr_t5[2 * CIM_NUM_OBQ_T5]; | ||
| 201 | u32 *p = stat; | ||
| 202 | int cim_num_obq = is_t4(adap->params.chip) ? | ||
| 203 | CIM_NUM_OBQ : CIM_NUM_OBQ_T5; | ||
| 204 | |||
| 205 | i = t4_cim_read(adap, is_t4(adap->params.chip) ? UP_IBQ_0_RDADDR_A : | ||
| 206 | UP_IBQ_0_SHADOW_RDADDR_A, | ||
| 207 | ARRAY_SIZE(stat), stat); | ||
| 208 | if (!i) { | ||
| 209 | if (is_t4(adap->params.chip)) { | ||
| 210 | i = t4_cim_read(adap, UP_OBQ_0_REALADDR_A, | ||
| 211 | ARRAY_SIZE(obq_wr_t4), obq_wr_t4); | ||
| 212 | wr = obq_wr_t4; | ||
| 213 | } else { | ||
| 214 | i = t4_cim_read(adap, UP_OBQ_0_SHADOW_REALADDR_A, | ||
| 215 | ARRAY_SIZE(obq_wr_t5), obq_wr_t5); | ||
| 216 | wr = obq_wr_t5; | ||
| 217 | } | ||
| 218 | } | ||
| 219 | if (i) | ||
| 220 | return i; | ||
| 221 | |||
| 222 | t4_read_cimq_cfg(adap, base, size, thres); | ||
| 223 | |||
| 224 | seq_printf(seq, | ||
| 225 | " Queue Base Size Thres RdPtr WrPtr SOP EOP Avail\n"); | ||
| 226 | for (i = 0; i < CIM_NUM_IBQ; i++, p += 4) | ||
| 227 | seq_printf(seq, "%7s %5x %5u %5u %6x %4x %4u %4u %5u\n", | ||
| 228 | qname[i], base[i], size[i], thres[i], | ||
| 229 | IBQRDADDR_G(p[0]), IBQWRADDR_G(p[1]), | ||
| 230 | QUESOPCNT_G(p[3]), QUEEOPCNT_G(p[3]), | ||
| 231 | QUEREMFLITS_G(p[2]) * 16); | ||
| 232 | for ( ; i < CIM_NUM_IBQ + cim_num_obq; i++, p += 4, wr += 2) | ||
| 233 | seq_printf(seq, "%7s %5x %5u %12x %4x %4u %4u %5u\n", | ||
| 234 | qname[i], base[i], size[i], | ||
| 235 | QUERDADDR_G(p[0]) & 0x3fff, wr[0] - base[i], | ||
| 236 | QUESOPCNT_G(p[3]), QUEEOPCNT_G(p[3]), | ||
| 237 | QUEREMFLITS_G(p[2]) * 16); | ||
| 238 | return 0; | ||
| 239 | } | ||
| 240 | |||
| 241 | static int cim_qcfg_open(struct inode *inode, struct file *file) | ||
| 242 | { | ||
| 243 | return single_open(file, cim_qcfg_show, inode->i_private); | ||
| 244 | } | ||
| 245 | |||
| 246 | static const struct file_operations cim_qcfg_fops = { | ||
| 247 | .owner = THIS_MODULE, | ||
| 248 | .open = cim_qcfg_open, | ||
| 249 | .read = seq_read, | ||
| 250 | .llseek = seq_lseek, | ||
| 251 | .release = single_release, | ||
| 252 | }; | ||
| 253 | |||
| 254 | static int cimq_show(struct seq_file *seq, void *v, int idx) | ||
| 255 | { | ||
| 256 | const u32 *p = v; | ||
| 257 | |||
| 258 | seq_printf(seq, "%#06x: %08x %08x %08x %08x\n", idx * 16, p[0], p[1], | ||
| 259 | p[2], p[3]); | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | |||
| 263 | static int cim_ibq_open(struct inode *inode, struct file *file) | ||
| 264 | { | ||
| 265 | int ret; | ||
| 266 | struct seq_tab *p; | ||
| 267 | unsigned int qid = (uintptr_t)inode->i_private & 7; | ||
| 268 | struct adapter *adap = inode->i_private - qid; | ||
| 269 | |||
| 270 | p = seq_open_tab(file, CIM_IBQ_SIZE, 4 * sizeof(u32), 0, cimq_show); | ||
| 271 | if (!p) | ||
| 272 | return -ENOMEM; | ||
| 273 | |||
| 274 | ret = t4_read_cim_ibq(adap, qid, (u32 *)p->data, CIM_IBQ_SIZE * 4); | ||
| 275 | if (ret < 0) | ||
| 276 | seq_release_private(inode, file); | ||
| 277 | else | ||
| 278 | ret = 0; | ||
| 279 | return ret; | ||
| 280 | } | ||
| 281 | |||
| 282 | static const struct file_operations cim_ibq_fops = { | ||
| 283 | .owner = THIS_MODULE, | ||
| 284 | .open = cim_ibq_open, | ||
| 285 | .read = seq_read, | ||
| 286 | .llseek = seq_lseek, | ||
| 287 | .release = seq_release_private | ||
| 288 | }; | ||
| 289 | |||
| 290 | static int cim_obq_open(struct inode *inode, struct file *file) | ||
| 291 | { | ||
| 292 | int ret; | ||
| 293 | struct seq_tab *p; | ||
| 294 | unsigned int qid = (uintptr_t)inode->i_private & 7; | ||
| 295 | struct adapter *adap = inode->i_private - qid; | ||
| 296 | |||
| 297 | p = seq_open_tab(file, 6 * CIM_OBQ_SIZE, 4 * sizeof(u32), 0, cimq_show); | ||
| 298 | if (!p) | ||
| 299 | return -ENOMEM; | ||
| 300 | |||
| 301 | ret = t4_read_cim_obq(adap, qid, (u32 *)p->data, 6 * CIM_OBQ_SIZE * 4); | ||
| 302 | if (ret < 0) { | ||
| 303 | seq_release_private(inode, file); | ||
| 304 | } else { | ||
| 305 | seq_tab_trim(p, ret / 4); | ||
| 306 | ret = 0; | ||
| 307 | } | ||
| 308 | return ret; | ||
| 309 | } | ||
| 310 | |||
| 311 | static const struct file_operations cim_obq_fops = { | ||
| 312 | .owner = THIS_MODULE, | ||
| 313 | .open = cim_obq_open, | ||
| 314 | .read = seq_read, | ||
| 315 | .llseek = seq_lseek, | ||
| 316 | .release = seq_release_private | ||
| 317 | }; | ||
| 318 | |||
| 319 | struct field_desc { | ||
| 320 | const char *name; | ||
| 321 | unsigned int start; | ||
| 322 | unsigned int width; | ||
| 323 | }; | ||
| 324 | |||
| 325 | static void field_desc_show(struct seq_file *seq, u64 v, | ||
| 326 | const struct field_desc *p) | ||
| 327 | { | ||
| 328 | char buf[32]; | ||
| 329 | int line_size = 0; | ||
| 330 | |||
| 331 | while (p->name) { | ||
| 332 | u64 mask = (1ULL << p->width) - 1; | ||
| 333 | int len = scnprintf(buf, sizeof(buf), "%s: %llu", p->name, | ||
| 334 | ((unsigned long long)v >> p->start) & mask); | ||
| 335 | |||
| 336 | if (line_size + len >= 79) { | ||
| 337 | line_size = 8; | ||
| 338 | seq_puts(seq, "\n "); | ||
| 339 | } | ||
| 340 | seq_printf(seq, "%s ", buf); | ||
| 341 | line_size += len + 1; | ||
| 342 | p++; | ||
| 343 | } | ||
| 344 | seq_putc(seq, '\n'); | ||
| 345 | } | ||
| 346 | |||
| 347 | static struct field_desc tp_la0[] = { | ||
| 348 | { "RcfOpCodeOut", 60, 4 }, | ||
| 349 | { "State", 56, 4 }, | ||
| 350 | { "WcfState", 52, 4 }, | ||
| 351 | { "RcfOpcSrcOut", 50, 2 }, | ||
| 352 | { "CRxError", 49, 1 }, | ||
| 353 | { "ERxError", 48, 1 }, | ||
| 354 | { "SanityFailed", 47, 1 }, | ||
| 355 | { "SpuriousMsg", 46, 1 }, | ||
| 356 | { "FlushInputMsg", 45, 1 }, | ||
| 357 | { "FlushInputCpl", 44, 1 }, | ||
| 358 | { "RssUpBit", 43, 1 }, | ||
| 359 | { "RssFilterHit", 42, 1 }, | ||
| 360 | { "Tid", 32, 10 }, | ||
| 361 | { "InitTcb", 31, 1 }, | ||
| 362 | { "LineNumber", 24, 7 }, | ||
| 363 | { "Emsg", 23, 1 }, | ||
| 364 | { "EdataOut", 22, 1 }, | ||
| 365 | { "Cmsg", 21, 1 }, | ||
| 366 | { "CdataOut", 20, 1 }, | ||
| 367 | { "EreadPdu", 19, 1 }, | ||
| 368 | { "CreadPdu", 18, 1 }, | ||
| 369 | { "TunnelPkt", 17, 1 }, | ||
| 370 | { "RcfPeerFin", 16, 1 }, | ||
| 371 | { "RcfReasonOut", 12, 4 }, | ||
| 372 | { "TxCchannel", 10, 2 }, | ||
| 373 | { "RcfTxChannel", 8, 2 }, | ||
| 374 | { "RxEchannel", 6, 2 }, | ||
| 375 | { "RcfRxChannel", 5, 1 }, | ||
| 376 | { "RcfDataOutSrdy", 4, 1 }, | ||
| 377 | { "RxDvld", 3, 1 }, | ||
| 378 | { "RxOoDvld", 2, 1 }, | ||
| 379 | { "RxCongestion", 1, 1 }, | ||
| 380 | { "TxCongestion", 0, 1 }, | ||
| 381 | { NULL } | ||
| 382 | }; | ||
| 383 | |||
| 384 | static int tp_la_show(struct seq_file *seq, void *v, int idx) | ||
| 385 | { | ||
| 386 | const u64 *p = v; | ||
| 387 | |||
| 388 | field_desc_show(seq, *p, tp_la0); | ||
| 389 | return 0; | ||
| 390 | } | ||
| 391 | |||
| 392 | static int tp_la_show2(struct seq_file *seq, void *v, int idx) | ||
| 393 | { | ||
| 394 | const u64 *p = v; | ||
| 395 | |||
| 396 | if (idx) | ||
| 397 | seq_putc(seq, '\n'); | ||
| 398 | field_desc_show(seq, p[0], tp_la0); | ||
| 399 | if (idx < (TPLA_SIZE / 2 - 1) || p[1] != ~0ULL) | ||
| 400 | field_desc_show(seq, p[1], tp_la0); | ||
| 401 | return 0; | ||
| 402 | } | ||
| 403 | |||
| 404 | static int tp_la_show3(struct seq_file *seq, void *v, int idx) | ||
| 405 | { | ||
| 406 | static struct field_desc tp_la1[] = { | ||
| 407 | { "CplCmdIn", 56, 8 }, | ||
| 408 | { "CplCmdOut", 48, 8 }, | ||
| 409 | { "ESynOut", 47, 1 }, | ||
| 410 | { "EAckOut", 46, 1 }, | ||
| 411 | { "EFinOut", 45, 1 }, | ||
| 412 | { "ERstOut", 44, 1 }, | ||
| 413 | { "SynIn", 43, 1 }, | ||
| 414 | { "AckIn", 42, 1 }, | ||
| 415 | { "FinIn", 41, 1 }, | ||
| 416 | { "RstIn", 40, 1 }, | ||
| 417 | { "DataIn", 39, 1 }, | ||
| 418 | { "DataInVld", 38, 1 }, | ||
| 419 | { "PadIn", 37, 1 }, | ||
| 420 | { "RxBufEmpty", 36, 1 }, | ||
| 421 | { "RxDdp", 35, 1 }, | ||
| 422 | { "RxFbCongestion", 34, 1 }, | ||
| 423 | { "TxFbCongestion", 33, 1 }, | ||
| 424 | { "TxPktSumSrdy", 32, 1 }, | ||
| 425 | { "RcfUlpType", 28, 4 }, | ||
| 426 | { "Eread", 27, 1 }, | ||
| 427 | { "Ebypass", 26, 1 }, | ||
| 428 | { "Esave", 25, 1 }, | ||
| 429 | { "Static0", 24, 1 }, | ||
| 430 | { "Cread", 23, 1 }, | ||
| 431 | { "Cbypass", 22, 1 }, | ||
| 432 | { "Csave", 21, 1 }, | ||
| 433 | { "CPktOut", 20, 1 }, | ||
| 434 | { "RxPagePoolFull", 18, 2 }, | ||
| 435 | { "RxLpbkPkt", 17, 1 }, | ||
| 436 | { "TxLpbkPkt", 16, 1 }, | ||
| 437 | { "RxVfValid", 15, 1 }, | ||
| 438 | { "SynLearned", 14, 1 }, | ||
| 439 | { "SetDelEntry", 13, 1 }, | ||
| 440 | { "SetInvEntry", 12, 1 }, | ||
| 441 | { "CpcmdDvld", 11, 1 }, | ||
| 442 | { "CpcmdSave", 10, 1 }, | ||
| 443 | { "RxPstructsFull", 8, 2 }, | ||
| 444 | { "EpcmdDvld", 7, 1 }, | ||
| 445 | { "EpcmdFlush", 6, 1 }, | ||
| 446 | { "EpcmdTrimPrefix", 5, 1 }, | ||
| 447 | { "EpcmdTrimPostfix", 4, 1 }, | ||
| 448 | { "ERssIp4Pkt", 3, 1 }, | ||
| 449 | { "ERssIp6Pkt", 2, 1 }, | ||
| 450 | { "ERssTcpUdpPkt", 1, 1 }, | ||
| 451 | { "ERssFceFipPkt", 0, 1 }, | ||
| 452 | { NULL } | ||
| 453 | }; | ||
| 454 | static struct field_desc tp_la2[] = { | ||
| 455 | { "CplCmdIn", 56, 8 }, | ||
| 456 | { "MpsVfVld", 55, 1 }, | ||
| 457 | { "MpsPf", 52, 3 }, | ||
| 458 | { "MpsVf", 44, 8 }, | ||
| 459 | { "SynIn", 43, 1 }, | ||
| 460 | { "AckIn", 42, 1 }, | ||
| 461 | { "FinIn", 41, 1 }, | ||
| 462 | { "RstIn", 40, 1 }, | ||
| 463 | { "DataIn", 39, 1 }, | ||
| 464 | { "DataInVld", 38, 1 }, | ||
| 465 | { "PadIn", 37, 1 }, | ||
| 466 | { "RxBufEmpty", 36, 1 }, | ||
| 467 | { "RxDdp", 35, 1 }, | ||
| 468 | { "RxFbCongestion", 34, 1 }, | ||
| 469 | { "TxFbCongestion", 33, 1 }, | ||
| 470 | { "TxPktSumSrdy", 32, 1 }, | ||
| 471 | { "RcfUlpType", 28, 4 }, | ||
| 472 | { "Eread", 27, 1 }, | ||
| 473 | { "Ebypass", 26, 1 }, | ||
| 474 | { "Esave", 25, 1 }, | ||
| 475 | { "Static0", 24, 1 }, | ||
| 476 | { "Cread", 23, 1 }, | ||
| 477 | { "Cbypass", 22, 1 }, | ||
| 478 | { "Csave", 21, 1 }, | ||
| 479 | { "CPktOut", 20, 1 }, | ||
| 480 | { "RxPagePoolFull", 18, 2 }, | ||
| 481 | { "RxLpbkPkt", 17, 1 }, | ||
| 482 | { "TxLpbkPkt", 16, 1 }, | ||
| 483 | { "RxVfValid", 15, 1 }, | ||
| 484 | { "SynLearned", 14, 1 }, | ||
| 485 | { "SetDelEntry", 13, 1 }, | ||
| 486 | { "SetInvEntry", 12, 1 }, | ||
| 487 | { "CpcmdDvld", 11, 1 }, | ||
| 488 | { "CpcmdSave", 10, 1 }, | ||
| 489 | { "RxPstructsFull", 8, 2 }, | ||
| 490 | { "EpcmdDvld", 7, 1 }, | ||
| 491 | { "EpcmdFlush", 6, 1 }, | ||
| 492 | { "EpcmdTrimPrefix", 5, 1 }, | ||
| 493 | { "EpcmdTrimPostfix", 4, 1 }, | ||
| 494 | { "ERssIp4Pkt", 3, 1 }, | ||
| 495 | { "ERssIp6Pkt", 2, 1 }, | ||
| 496 | { "ERssTcpUdpPkt", 1, 1 }, | ||
| 497 | { "ERssFceFipPkt", 0, 1 }, | ||
| 498 | { NULL } | ||
| 499 | }; | ||
| 500 | const u64 *p = v; | ||
| 501 | |||
| 502 | if (idx) | ||
| 503 | seq_putc(seq, '\n'); | ||
| 504 | field_desc_show(seq, p[0], tp_la0); | ||
| 505 | if (idx < (TPLA_SIZE / 2 - 1) || p[1] != ~0ULL) | ||
| 506 | field_desc_show(seq, p[1], (p[0] & BIT(17)) ? tp_la2 : tp_la1); | ||
| 507 | return 0; | ||
| 508 | } | ||
| 509 | |||
| 510 | static int tp_la_open(struct inode *inode, struct file *file) | ||
| 511 | { | ||
| 512 | struct seq_tab *p; | ||
| 513 | struct adapter *adap = inode->i_private; | ||
| 514 | |||
| 515 | switch (DBGLAMODE_G(t4_read_reg(adap, TP_DBG_LA_CONFIG_A))) { | ||
| 516 | case 2: | ||
| 517 | p = seq_open_tab(file, TPLA_SIZE / 2, 2 * sizeof(u64), 0, | ||
| 518 | tp_la_show2); | ||
| 519 | break; | ||
| 520 | case 3: | ||
| 521 | p = seq_open_tab(file, TPLA_SIZE / 2, 2 * sizeof(u64), 0, | ||
| 522 | tp_la_show3); | ||
| 523 | break; | ||
| 524 | default: | ||
| 525 | p = seq_open_tab(file, TPLA_SIZE, sizeof(u64), 0, tp_la_show); | ||
| 526 | } | ||
| 527 | if (!p) | ||
| 528 | return -ENOMEM; | ||
| 529 | |||
| 530 | t4_tp_read_la(adap, (u64 *)p->data, NULL); | ||
| 531 | return 0; | ||
| 532 | } | ||
| 533 | |||
| 534 | static ssize_t tp_la_write(struct file *file, const char __user *buf, | ||
| 535 | size_t count, loff_t *pos) | ||
| 536 | { | ||
| 537 | int err; | ||
| 538 | char s[32]; | ||
| 539 | unsigned long val; | ||
| 540 | size_t size = min(sizeof(s) - 1, count); | ||
| 541 | struct adapter *adap = FILE_DATA(file)->i_private; | ||
| 542 | |||
| 543 | if (copy_from_user(s, buf, size)) | ||
| 544 | return -EFAULT; | ||
| 545 | s[size] = '\0'; | ||
| 546 | err = kstrtoul(s, 0, &val); | ||
| 547 | if (err) | ||
| 548 | return err; | ||
| 549 | if (val > 0xffff) | ||
| 550 | return -EINVAL; | ||
| 551 | adap->params.tp.la_mask = val << 16; | ||
| 552 | t4_set_reg_field(adap, TP_DBG_LA_CONFIG_A, 0xffff0000U, | ||
| 553 | adap->params.tp.la_mask); | ||
| 554 | return count; | ||
| 555 | } | ||
| 556 | |||
| 557 | static const struct file_operations tp_la_fops = { | ||
| 558 | .owner = THIS_MODULE, | ||
| 559 | .open = tp_la_open, | ||
| 560 | .read = seq_read, | ||
| 561 | .llseek = seq_lseek, | ||
| 562 | .release = seq_release_private, | ||
| 563 | .write = tp_la_write | ||
| 564 | }; | ||
| 565 | |||
| 566 | static int ulprx_la_show(struct seq_file *seq, void *v, int idx) | ||
| 567 | { | ||
| 568 | const u32 *p = v; | ||
| 569 | |||
| 570 | if (v == SEQ_START_TOKEN) | ||
| 571 | seq_puts(seq, " Pcmd Type Message" | ||
| 572 | " Data\n"); | ||
| 573 | else | ||
| 574 | seq_printf(seq, "%08x%08x %4x %08x %08x%08x%08x%08x\n", | ||
| 575 | p[1], p[0], p[2], p[3], p[7], p[6], p[5], p[4]); | ||
| 576 | return 0; | ||
| 577 | } | ||
| 578 | |||
| 579 | static int ulprx_la_open(struct inode *inode, struct file *file) | ||
| 580 | { | ||
| 581 | struct seq_tab *p; | ||
| 582 | struct adapter *adap = inode->i_private; | ||
| 583 | |||
| 584 | p = seq_open_tab(file, ULPRX_LA_SIZE, 8 * sizeof(u32), 1, | ||
| 585 | ulprx_la_show); | ||
| 586 | if (!p) | ||
| 587 | return -ENOMEM; | ||
| 588 | |||
| 589 | t4_ulprx_read_la(adap, (u32 *)p->data); | ||
| 590 | return 0; | ||
| 591 | } | ||
| 592 | |||
| 593 | static const struct file_operations ulprx_la_fops = { | ||
| 594 | .owner = THIS_MODULE, | ||
| 595 | .open = ulprx_la_open, | ||
| 596 | .read = seq_read, | ||
| 597 | .llseek = seq_lseek, | ||
| 598 | .release = seq_release_private | ||
| 599 | }; | ||
| 600 | |||
| 601 | /* Show the PM memory stats. These stats include: | ||
| 602 | * | ||
| 603 | * TX: | ||
| 604 | * Read: memory read operation | ||
| 605 | * Write Bypass: cut-through | ||
| 606 | * Bypass + mem: cut-through and save copy | ||
| 607 | * | ||
| 608 | * RX: | ||
| 609 | * Read: memory read | ||
| 610 | * Write Bypass: cut-through | ||
| 611 | * Flush: payload trim or drop | ||
| 612 | */ | ||
| 613 | static int pm_stats_show(struct seq_file *seq, void *v) | ||
| 614 | { | ||
| 615 | static const char * const tx_pm_stats[] = { | ||
| 616 | "Read:", "Write bypass:", "Write mem:", "Bypass + mem:" | ||
| 617 | }; | ||
| 618 | static const char * const rx_pm_stats[] = { | ||
| 619 | "Read:", "Write bypass:", "Write mem:", "Flush:" | ||
| 620 | }; | ||
| 621 | |||
| 622 | int i; | ||
| 623 | u32 tx_cnt[PM_NSTATS], rx_cnt[PM_NSTATS]; | ||
| 624 | u64 tx_cyc[PM_NSTATS], rx_cyc[PM_NSTATS]; | ||
| 625 | struct adapter *adap = seq->private; | ||
| 626 | |||
| 627 | t4_pmtx_get_stats(adap, tx_cnt, tx_cyc); | ||
| 628 | t4_pmrx_get_stats(adap, rx_cnt, rx_cyc); | ||
| 629 | |||
| 630 | seq_printf(seq, "%13s %10s %20s\n", " ", "Tx pcmds", "Tx bytes"); | ||
| 631 | for (i = 0; i < PM_NSTATS - 1; i++) | ||
| 632 | seq_printf(seq, "%-13s %10u %20llu\n", | ||
| 633 | tx_pm_stats[i], tx_cnt[i], tx_cyc[i]); | ||
| 634 | |||
| 635 | seq_printf(seq, "%13s %10s %20s\n", " ", "Rx pcmds", "Rx bytes"); | ||
| 636 | for (i = 0; i < PM_NSTATS - 1; i++) | ||
| 637 | seq_printf(seq, "%-13s %10u %20llu\n", | ||
| 638 | rx_pm_stats[i], rx_cnt[i], rx_cyc[i]); | ||
| 639 | return 0; | ||
| 640 | } | ||
| 641 | |||
| 642 | static int pm_stats_open(struct inode *inode, struct file *file) | ||
| 643 | { | ||
| 644 | return single_open(file, pm_stats_show, inode->i_private); | ||
| 645 | } | ||
| 646 | |||
| 647 | static ssize_t pm_stats_clear(struct file *file, const char __user *buf, | ||
| 648 | size_t count, loff_t *pos) | ||
| 649 | { | ||
| 650 | struct adapter *adap = FILE_DATA(file)->i_private; | ||
| 651 | |||
| 652 | t4_write_reg(adap, PM_RX_STAT_CONFIG_A, 0); | ||
| 653 | t4_write_reg(adap, PM_TX_STAT_CONFIG_A, 0); | ||
| 654 | return count; | ||
| 655 | } | ||
| 656 | |||
| 657 | static const struct file_operations pm_stats_debugfs_fops = { | ||
| 658 | .owner = THIS_MODULE, | ||
| 659 | .open = pm_stats_open, | ||
| 660 | .read = seq_read, | ||
| 661 | .llseek = seq_lseek, | ||
| 662 | .release = single_release, | ||
| 663 | .write = pm_stats_clear | ||
| 664 | }; | ||
| 665 | |||
| 666 | static int cctrl_tbl_show(struct seq_file *seq, void *v) | ||
| 667 | { | ||
| 668 | static const char * const dec_fac[] = { | ||
| 669 | "0.5", "0.5625", "0.625", "0.6875", "0.75", "0.8125", "0.875", | ||
| 670 | "0.9375" }; | ||
| 671 | |||
| 672 | int i; | ||
| 673 | u16 incr[NMTUS][NCCTRL_WIN]; | ||
| 674 | struct adapter *adap = seq->private; | ||
| 675 | |||
| 676 | t4_read_cong_tbl(adap, incr); | ||
| 677 | |||
| 678 | for (i = 0; i < NCCTRL_WIN; ++i) { | ||
| 679 | seq_printf(seq, "%2d: %4u %4u %4u %4u %4u %4u %4u %4u\n", i, | ||
| 680 | incr[0][i], incr[1][i], incr[2][i], incr[3][i], | ||
| 681 | incr[4][i], incr[5][i], incr[6][i], incr[7][i]); | ||
| 682 | seq_printf(seq, "%8u %4u %4u %4u %4u %4u %4u %4u %5u %s\n", | ||
| 683 | incr[8][i], incr[9][i], incr[10][i], incr[11][i], | ||
| 684 | incr[12][i], incr[13][i], incr[14][i], incr[15][i], | ||
| 685 | adap->params.a_wnd[i], | ||
| 686 | dec_fac[adap->params.b_wnd[i]]); | ||
| 687 | } | ||
| 688 | return 0; | ||
| 689 | } | ||
| 690 | |||
| 691 | DEFINE_SIMPLE_DEBUGFS_FILE(cctrl_tbl); | ||
| 692 | |||
| 693 | /* Format a value in a unit that differs from the value's native unit by the | ||
| 694 | * given factor. | ||
| 695 | */ | ||
| 696 | static char *unit_conv(char *buf, size_t len, unsigned int val, | ||
| 697 | unsigned int factor) | ||
| 698 | { | ||
| 699 | unsigned int rem = val % factor; | ||
| 700 | |||
| 701 | if (rem == 0) { | ||
| 702 | snprintf(buf, len, "%u", val / factor); | ||
| 703 | } else { | ||
| 704 | while (rem % 10 == 0) | ||
| 705 | rem /= 10; | ||
| 706 | snprintf(buf, len, "%u.%u", val / factor, rem); | ||
| 707 | } | ||
| 708 | return buf; | ||
| 709 | } | ||
| 710 | |||
| 711 | static int clk_show(struct seq_file *seq, void *v) | ||
| 712 | { | ||
| 713 | char buf[32]; | ||
| 714 | struct adapter *adap = seq->private; | ||
| 715 | unsigned int cclk_ps = 1000000000 / adap->params.vpd.cclk; /* in ps */ | ||
| 716 | u32 res = t4_read_reg(adap, TP_TIMER_RESOLUTION_A); | ||
| 717 | unsigned int tre = TIMERRESOLUTION_G(res); | ||
| 718 | unsigned int dack_re = DELAYEDACKRESOLUTION_G(res); | ||
| 719 | unsigned long long tp_tick_us = (cclk_ps << tre) / 1000000; /* in us */ | ||
| 720 | |||
| 721 | seq_printf(seq, "Core clock period: %s ns\n", | ||
| 722 | unit_conv(buf, sizeof(buf), cclk_ps, 1000)); | ||
| 723 | seq_printf(seq, "TP timer tick: %s us\n", | ||
| 724 | unit_conv(buf, sizeof(buf), (cclk_ps << tre), 1000000)); | ||
| 725 | seq_printf(seq, "TCP timestamp tick: %s us\n", | ||
| 726 | unit_conv(buf, sizeof(buf), | ||
| 727 | (cclk_ps << TIMESTAMPRESOLUTION_G(res)), 1000000)); | ||
| 728 | seq_printf(seq, "DACK tick: %s us\n", | ||
| 729 | unit_conv(buf, sizeof(buf), (cclk_ps << dack_re), 1000000)); | ||
| 730 | seq_printf(seq, "DACK timer: %u us\n", | ||
| 731 | ((cclk_ps << dack_re) / 1000000) * | ||
| 732 | t4_read_reg(adap, TP_DACK_TIMER_A)); | ||
| 733 | seq_printf(seq, "Retransmit min: %llu us\n", | ||
| 734 | tp_tick_us * t4_read_reg(adap, TP_RXT_MIN_A)); | ||
| 735 | seq_printf(seq, "Retransmit max: %llu us\n", | ||
| 736 | tp_tick_us * t4_read_reg(adap, TP_RXT_MAX_A)); | ||
| 737 | seq_printf(seq, "Persist timer min: %llu us\n", | ||
| 738 | tp_tick_us * t4_read_reg(adap, TP_PERS_MIN_A)); | ||
| 739 | seq_printf(seq, "Persist timer max: %llu us\n", | ||
| 740 | tp_tick_us * t4_read_reg(adap, TP_PERS_MAX_A)); | ||
| 741 | seq_printf(seq, "Keepalive idle timer: %llu us\n", | ||
| 742 | tp_tick_us * t4_read_reg(adap, TP_KEEP_IDLE_A)); | ||
| 743 | seq_printf(seq, "Keepalive interval: %llu us\n", | ||
| 744 | tp_tick_us * t4_read_reg(adap, TP_KEEP_INTVL_A)); | ||
| 745 | seq_printf(seq, "Initial SRTT: %llu us\n", | ||
| 746 | tp_tick_us * INITSRTT_G(t4_read_reg(adap, TP_INIT_SRTT_A))); | ||
| 747 | seq_printf(seq, "FINWAIT2 timer: %llu us\n", | ||
| 748 | tp_tick_us * t4_read_reg(adap, TP_FINWAIT2_TIMER_A)); | ||
| 749 | |||
| 750 | return 0; | ||
| 751 | } | ||
| 752 | |||
| 753 | DEFINE_SIMPLE_DEBUGFS_FILE(clk); | ||
| 754 | |||
| 755 | /* Firmware Device Log dump. */ | ||
| 756 | static const char * const devlog_level_strings[] = { | ||
| 757 | [FW_DEVLOG_LEVEL_EMERG] = "EMERG", | ||
| 758 | [FW_DEVLOG_LEVEL_CRIT] = "CRIT", | ||
| 759 | [FW_DEVLOG_LEVEL_ERR] = "ERR", | ||
| 760 | [FW_DEVLOG_LEVEL_NOTICE] = "NOTICE", | ||
| 761 | [FW_DEVLOG_LEVEL_INFO] = "INFO", | ||
| 762 | [FW_DEVLOG_LEVEL_DEBUG] = "DEBUG" | ||
| 763 | }; | ||
| 764 | |||
| 765 | static const char * const devlog_facility_strings[] = { | ||
| 766 | [FW_DEVLOG_FACILITY_CORE] = "CORE", | ||
| 767 | [FW_DEVLOG_FACILITY_SCHED] = "SCHED", | ||
| 768 | [FW_DEVLOG_FACILITY_TIMER] = "TIMER", | ||
| 769 | [FW_DEVLOG_FACILITY_RES] = "RES", | ||
| 770 | [FW_DEVLOG_FACILITY_HW] = "HW", | ||
| 771 | [FW_DEVLOG_FACILITY_FLR] = "FLR", | ||
| 772 | [FW_DEVLOG_FACILITY_DMAQ] = "DMAQ", | ||
| 773 | [FW_DEVLOG_FACILITY_PHY] = "PHY", | ||
| 774 | [FW_DEVLOG_FACILITY_MAC] = "MAC", | ||
| 775 | [FW_DEVLOG_FACILITY_PORT] = "PORT", | ||
| 776 | [FW_DEVLOG_FACILITY_VI] = "VI", | ||
| 777 | [FW_DEVLOG_FACILITY_FILTER] = "FILTER", | ||
| 778 | [FW_DEVLOG_FACILITY_ACL] = "ACL", | ||
| 779 | [FW_DEVLOG_FACILITY_TM] = "TM", | ||
| 780 | [FW_DEVLOG_FACILITY_QFC] = "QFC", | ||
| 781 | [FW_DEVLOG_FACILITY_DCB] = "DCB", | ||
| 782 | [FW_DEVLOG_FACILITY_ETH] = "ETH", | ||
| 783 | [FW_DEVLOG_FACILITY_OFLD] = "OFLD", | ||
| 784 | [FW_DEVLOG_FACILITY_RI] = "RI", | ||
| 785 | [FW_DEVLOG_FACILITY_ISCSI] = "ISCSI", | ||
| 786 | [FW_DEVLOG_FACILITY_FCOE] = "FCOE", | ||
| 787 | [FW_DEVLOG_FACILITY_FOISCSI] = "FOISCSI", | ||
| 788 | [FW_DEVLOG_FACILITY_FOFCOE] = "FOFCOE" | ||
| 789 | }; | ||
| 790 | |||
| 791 | /* Information gathered by Device Log Open routine for the display routine. | ||
| 792 | */ | ||
| 793 | struct devlog_info { | ||
| 794 | unsigned int nentries; /* number of entries in log[] */ | ||
| 795 | unsigned int first; /* first [temporal] entry in log[] */ | ||
| 796 | struct fw_devlog_e log[0]; /* Firmware Device Log */ | ||
| 797 | }; | ||
| 798 | |||
| 799 | /* Dump a Firmaware Device Log entry. | ||
| 800 | */ | ||
| 801 | static int devlog_show(struct seq_file *seq, void *v) | ||
| 802 | { | ||
| 803 | if (v == SEQ_START_TOKEN) | ||
| 804 | seq_printf(seq, "%10s %15s %8s %8s %s\n", | ||
| 805 | "Seq#", "Tstamp", "Level", "Facility", "Message"); | ||
| 806 | else { | ||
| 807 | struct devlog_info *dinfo = seq->private; | ||
| 808 | int fidx = (uintptr_t)v - 2; | ||
| 809 | unsigned long index; | ||
| 810 | struct fw_devlog_e *e; | ||
| 811 | |||
| 812 | /* Get a pointer to the log entry to display. Skip unused log | ||
| 813 | * entries. | ||
| 814 | */ | ||
| 815 | index = dinfo->first + fidx; | ||
| 816 | if (index >= dinfo->nentries) | ||
| 817 | index -= dinfo->nentries; | ||
| 818 | e = &dinfo->log[index]; | ||
| 819 | if (e->timestamp == 0) | ||
| 820 | return 0; | ||
| 821 | |||
| 822 | /* Print the message. This depends on the firmware using | ||
| 823 | * exactly the same formating strings as the kernel so we may | ||
| 824 | * eventually have to put a format interpreter in here ... | ||
| 825 | */ | ||
| 826 | seq_printf(seq, "%10d %15llu %8s %8s ", | ||
| 827 | e->seqno, e->timestamp, | ||
| 828 | (e->level < ARRAY_SIZE(devlog_level_strings) | ||
| 829 | ? devlog_level_strings[e->level] | ||
| 830 | : "UNKNOWN"), | ||
| 831 | (e->facility < ARRAY_SIZE(devlog_facility_strings) | ||
| 832 | ? devlog_facility_strings[e->facility] | ||
| 833 | : "UNKNOWN")); | ||
| 834 | seq_printf(seq, e->fmt, e->params[0], e->params[1], | ||
| 835 | e->params[2], e->params[3], e->params[4], | ||
| 836 | e->params[5], e->params[6], e->params[7]); | ||
| 837 | } | ||
| 838 | return 0; | ||
| 839 | } | ||
| 840 | |||
| 841 | /* Sequential File Operations for Device Log. | ||
| 842 | */ | ||
| 843 | static inline void *devlog_get_idx(struct devlog_info *dinfo, loff_t pos) | ||
| 844 | { | ||
| 845 | if (pos > dinfo->nentries) | ||
| 846 | return NULL; | ||
| 847 | |||
| 848 | return (void *)(uintptr_t)(pos + 1); | ||
| 849 | } | ||
| 850 | |||
| 851 | static void *devlog_start(struct seq_file *seq, loff_t *pos) | ||
| 852 | { | ||
| 853 | struct devlog_info *dinfo = seq->private; | ||
| 854 | |||
| 855 | return (*pos | ||
| 856 | ? devlog_get_idx(dinfo, *pos) | ||
| 857 | : SEQ_START_TOKEN); | ||
| 858 | } | ||
| 859 | |||
| 860 | static void *devlog_next(struct seq_file *seq, void *v, loff_t *pos) | ||
| 861 | { | ||
| 862 | struct devlog_info *dinfo = seq->private; | ||
| 863 | |||
| 864 | (*pos)++; | ||
| 865 | return devlog_get_idx(dinfo, *pos); | ||
| 866 | } | ||
| 867 | |||
| 868 | static void devlog_stop(struct seq_file *seq, void *v) | ||
| 869 | { | ||
| 870 | } | ||
| 871 | |||
| 872 | static const struct seq_operations devlog_seq_ops = { | ||
| 873 | .start = devlog_start, | ||
| 874 | .next = devlog_next, | ||
| 875 | .stop = devlog_stop, | ||
| 876 | .show = devlog_show | ||
| 877 | }; | ||
| 878 | |||
| 879 | /* Set up for reading the firmware's device log. We read the entire log here | ||
| 880 | * and then display it incrementally in devlog_show(). | ||
| 881 | */ | ||
| 882 | static int devlog_open(struct inode *inode, struct file *file) | ||
| 883 | { | ||
| 884 | struct adapter *adap = inode->i_private; | ||
| 885 | struct devlog_params *dparams = &adap->params.devlog; | ||
| 886 | struct devlog_info *dinfo; | ||
| 887 | unsigned int index; | ||
| 888 | u32 fseqno; | ||
| 889 | int ret; | ||
| 890 | |||
| 891 | /* If we don't know where the log is we can't do anything. | ||
| 892 | */ | ||
| 893 | if (dparams->start == 0) | ||
| 894 | return -ENXIO; | ||
| 895 | |||
| 896 | /* Allocate the space to read in the firmware's device log and set up | ||
| 897 | * for the iterated call to our display function. | ||
| 898 | */ | ||
| 899 | dinfo = __seq_open_private(file, &devlog_seq_ops, | ||
| 900 | sizeof(*dinfo) + dparams->size); | ||
| 901 | if (!dinfo) | ||
| 902 | return -ENOMEM; | ||
| 903 | |||
| 904 | /* Record the basic log buffer information and read in the raw log. | ||
| 905 | */ | ||
| 906 | dinfo->nentries = (dparams->size / sizeof(struct fw_devlog_e)); | ||
| 907 | dinfo->first = 0; | ||
| 908 | spin_lock(&adap->win0_lock); | ||
| 909 | ret = t4_memory_rw(adap, adap->params.drv_memwin, dparams->memtype, | ||
| 910 | dparams->start, dparams->size, (__be32 *)dinfo->log, | ||
| 911 | T4_MEMORY_READ); | ||
| 912 | spin_unlock(&adap->win0_lock); | ||
| 913 | if (ret) { | ||
| 914 | seq_release_private(inode, file); | ||
| 915 | return ret; | ||
| 916 | } | ||
| 917 | |||
| 918 | /* Translate log multi-byte integral elements into host native format | ||
| 919 | * and determine where the first entry in the log is. | ||
| 920 | */ | ||
| 921 | for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) { | ||
| 922 | struct fw_devlog_e *e = &dinfo->log[index]; | ||
| 923 | int i; | ||
| 924 | __u32 seqno; | ||
| 925 | |||
| 926 | if (e->timestamp == 0) | ||
| 927 | continue; | ||
| 928 | |||
| 929 | e->timestamp = (__force __be64)be64_to_cpu(e->timestamp); | ||
| 930 | seqno = be32_to_cpu(e->seqno); | ||
| 931 | for (i = 0; i < 8; i++) | ||
| 932 | e->params[i] = | ||
| 933 | (__force __be32)be32_to_cpu(e->params[i]); | ||
| 934 | |||
| 935 | if (seqno < fseqno) { | ||
| 936 | fseqno = seqno; | ||
| 937 | dinfo->first = index; | ||
| 938 | } | ||
| 939 | } | ||
| 940 | return 0; | ||
| 941 | } | ||
| 942 | |||
| 943 | static const struct file_operations devlog_fops = { | ||
| 944 | .owner = THIS_MODULE, | ||
| 945 | .open = devlog_open, | ||
| 946 | .read = seq_read, | ||
| 947 | .llseek = seq_lseek, | ||
| 948 | .release = seq_release_private | ||
| 949 | }; | ||
| 950 | |||
| 951 | static int mbox_show(struct seq_file *seq, void *v) | ||
| 952 | { | ||
| 953 | static const char * const owner[] = { "none", "FW", "driver", | ||
| 954 | "unknown" }; | ||
| 955 | |||
| 956 | int i; | ||
| 957 | unsigned int mbox = (uintptr_t)seq->private & 7; | ||
| 958 | struct adapter *adap = seq->private - mbox; | ||
| 959 | void __iomem *addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); | ||
| 960 | unsigned int ctrl_reg = (is_t4(adap->params.chip) | ||
| 961 | ? CIM_PF_MAILBOX_CTRL_A | ||
| 962 | : CIM_PF_MAILBOX_CTRL_SHADOW_COPY_A); | ||
| 963 | void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg); | ||
| 964 | |||
| 965 | i = MBOWNER_G(readl(ctrl)); | ||
| 966 | seq_printf(seq, "mailbox owned by %s\n\n", owner[i]); | ||
| 967 | |||
| 968 | for (i = 0; i < MBOX_LEN; i += 8) | ||
| 969 | seq_printf(seq, "%016llx\n", | ||
| 970 | (unsigned long long)readq(addr + i)); | ||
| 971 | return 0; | ||
| 972 | } | ||
| 973 | |||
| 974 | static int mbox_open(struct inode *inode, struct file *file) | ||
| 975 | { | ||
| 976 | return single_open(file, mbox_show, inode->i_private); | ||
| 977 | } | ||
| 978 | |||
| 979 | static ssize_t mbox_write(struct file *file, const char __user *buf, | ||
| 980 | size_t count, loff_t *pos) | ||
| 981 | { | ||
| 982 | int i; | ||
| 983 | char c = '\n', s[256]; | ||
| 984 | unsigned long long data[8]; | ||
| 985 | const struct inode *ino; | ||
| 986 | unsigned int mbox; | ||
| 987 | struct adapter *adap; | ||
| 988 | void __iomem *addr; | ||
| 989 | void __iomem *ctrl; | ||
| 990 | |||
| 991 | if (count > sizeof(s) - 1 || !count) | ||
| 992 | return -EINVAL; | ||
| 993 | if (copy_from_user(s, buf, count)) | ||
| 994 | return -EFAULT; | ||
| 995 | s[count] = '\0'; | ||
| 996 | |||
| 997 | if (sscanf(s, "%llx %llx %llx %llx %llx %llx %llx %llx%c", &data[0], | ||
| 998 | &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], | ||
| 999 | &data[7], &c) < 8 || c != '\n') | ||
| 1000 | return -EINVAL; | ||
| 1001 | |||
| 1002 | ino = FILE_DATA(file); | ||
| 1003 | mbox = (uintptr_t)ino->i_private & 7; | ||
| 1004 | adap = ino->i_private - mbox; | ||
| 1005 | addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); | ||
| 1006 | ctrl = addr + MBOX_LEN; | ||
| 1007 | |||
| 1008 | if (MBOWNER_G(readl(ctrl)) != X_MBOWNER_PL) | ||
| 1009 | return -EBUSY; | ||
| 1010 | |||
| 1011 | for (i = 0; i < 8; i++) | ||
| 1012 | writeq(data[i], addr + 8 * i); | ||
| 1013 | |||
| 1014 | writel(MBMSGVALID_F | MBOWNER_V(X_MBOWNER_FW), ctrl); | ||
| 1015 | return count; | ||
| 1016 | } | ||
| 1017 | |||
| 1018 | static const struct file_operations mbox_debugfs_fops = { | ||
| 1019 | .owner = THIS_MODULE, | ||
| 1020 | .open = mbox_open, | ||
| 1021 | .read = seq_read, | ||
| 1022 | .llseek = seq_lseek, | ||
| 1023 | .release = single_release, | ||
| 1024 | .write = mbox_write | ||
| 1025 | }; | ||
| 1026 | |||
| 1027 | static ssize_t flash_read(struct file *file, char __user *buf, size_t count, | ||
| 1028 | loff_t *ppos) | ||
| 1029 | { | ||
| 1030 | loff_t pos = *ppos; | ||
| 1031 | loff_t avail = FILE_DATA(file)->i_size; | ||
| 1032 | struct adapter *adap = file->private_data; | ||
| 1033 | |||
| 1034 | if (pos < 0) | ||
| 1035 | return -EINVAL; | ||
| 1036 | if (pos >= avail) | ||
| 1037 | return 0; | ||
| 1038 | if (count > avail - pos) | ||
| 1039 | count = avail - pos; | ||
| 1040 | |||
| 1041 | while (count) { | ||
| 1042 | size_t len; | ||
| 1043 | int ret, ofst; | ||
| 1044 | u8 data[256]; | ||
| 1045 | |||
| 1046 | ofst = pos & 3; | ||
| 1047 | len = min(count + ofst, sizeof(data)); | ||
| 1048 | ret = t4_read_flash(adap, pos - ofst, (len + 3) / 4, | ||
| 1049 | (u32 *)data, 1); | ||
| 1050 | if (ret) | ||
| 1051 | return ret; | ||
| 1052 | |||
| 1053 | len -= ofst; | ||
| 1054 | if (copy_to_user(buf, data + ofst, len)) | ||
| 1055 | return -EFAULT; | ||
| 1056 | |||
| 1057 | buf += len; | ||
| 1058 | pos += len; | ||
| 1059 | count -= len; | ||
| 1060 | } | ||
| 1061 | count = pos - *ppos; | ||
| 1062 | *ppos = pos; | ||
| 1063 | return count; | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | static const struct file_operations flash_debugfs_fops = { | ||
| 1067 | .owner = THIS_MODULE, | ||
| 1068 | .open = mem_open, | ||
| 1069 | .read = flash_read, | ||
| 1070 | }; | ||
| 1071 | |||
| 1072 | static inline void tcamxy2valmask(u64 x, u64 y, u8 *addr, u64 *mask) | ||
| 1073 | { | ||
| 1074 | *mask = x | y; | ||
| 1075 | y = (__force u64)cpu_to_be64(y); | ||
| 1076 | memcpy(addr, (char *)&y + 2, ETH_ALEN); | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | static int mps_tcam_show(struct seq_file *seq, void *v) | ||
| 1080 | { | ||
| 1081 | if (v == SEQ_START_TOKEN) | ||
| 1082 | seq_puts(seq, "Idx Ethernet address Mask Vld Ports PF" | ||
| 1083 | " VF Replication " | ||
| 1084 | "P0 P1 P2 P3 ML\n"); | ||
| 1085 | else { | ||
| 1086 | u64 mask; | ||
| 1087 | u8 addr[ETH_ALEN]; | ||
| 1088 | struct adapter *adap = seq->private; | ||
| 1089 | unsigned int idx = (uintptr_t)v - 2; | ||
| 1090 | u64 tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx)); | ||
| 1091 | u64 tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx)); | ||
| 1092 | u32 cls_lo = t4_read_reg(adap, MPS_CLS_SRAM_L(idx)); | ||
| 1093 | u32 cls_hi = t4_read_reg(adap, MPS_CLS_SRAM_H(idx)); | ||
| 1094 | u32 rplc[4] = {0, 0, 0, 0}; | ||
| 1095 | |||
| 1096 | if (tcamx & tcamy) { | ||
| 1097 | seq_printf(seq, "%3u -\n", idx); | ||
| 1098 | goto out; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | if (cls_lo & REPLICATE_F) { | ||
| 1102 | struct fw_ldst_cmd ldst_cmd; | ||
| 1103 | int ret; | ||
| 1104 | |||
| 1105 | memset(&ldst_cmd, 0, sizeof(ldst_cmd)); | ||
| 1106 | ldst_cmd.op_to_addrspace = | ||
| 1107 | htonl(FW_CMD_OP_V(FW_LDST_CMD) | | ||
| 1108 | FW_CMD_REQUEST_F | | ||
| 1109 | FW_CMD_READ_F | | ||
| 1110 | FW_LDST_CMD_ADDRSPACE_V( | ||
| 1111 | FW_LDST_ADDRSPC_MPS)); | ||
| 1112 | ldst_cmd.cycles_to_len16 = htonl(FW_LEN16(ldst_cmd)); | ||
| 1113 | ldst_cmd.u.mps.fid_ctl = | ||
| 1114 | htons(FW_LDST_CMD_FID_V(FW_LDST_MPS_RPLC) | | ||
| 1115 | FW_LDST_CMD_CTL_V(idx)); | ||
| 1116 | ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd, | ||
| 1117 | sizeof(ldst_cmd), &ldst_cmd); | ||
| 1118 | if (ret) | ||
| 1119 | dev_warn(adap->pdev_dev, "Can't read MPS " | ||
| 1120 | "replication map for idx %d: %d\n", | ||
| 1121 | idx, -ret); | ||
| 1122 | else { | ||
| 1123 | rplc[0] = ntohl(ldst_cmd.u.mps.rplc31_0); | ||
| 1124 | rplc[1] = ntohl(ldst_cmd.u.mps.rplc63_32); | ||
| 1125 | rplc[2] = ntohl(ldst_cmd.u.mps.rplc95_64); | ||
| 1126 | rplc[3] = ntohl(ldst_cmd.u.mps.rplc127_96); | ||
| 1127 | } | ||
| 1128 | } | ||
| 1129 | |||
| 1130 | tcamxy2valmask(tcamx, tcamy, addr, &mask); | ||
| 1131 | seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x %012llx" | ||
| 1132 | "%3c %#x%4u%4d", | ||
| 1133 | idx, addr[0], addr[1], addr[2], addr[3], addr[4], | ||
| 1134 | addr[5], (unsigned long long)mask, | ||
| 1135 | (cls_lo & SRAM_VLD_F) ? 'Y' : 'N', PORTMAP_G(cls_hi), | ||
| 1136 | PF_G(cls_lo), | ||
| 1137 | (cls_lo & VF_VALID_F) ? VF_G(cls_lo) : -1); | ||
| 1138 | if (cls_lo & REPLICATE_F) | ||
| 1139 | seq_printf(seq, " %08x %08x %08x %08x", | ||
| 1140 | rplc[3], rplc[2], rplc[1], rplc[0]); | ||
| 1141 | else | ||
| 1142 | seq_printf(seq, "%36c", ' '); | ||
| 1143 | seq_printf(seq, "%4u%3u%3u%3u %#x\n", | ||
| 1144 | SRAM_PRIO0_G(cls_lo), SRAM_PRIO1_G(cls_lo), | ||
| 1145 | SRAM_PRIO2_G(cls_lo), SRAM_PRIO3_G(cls_lo), | ||
| 1146 | (cls_lo >> MULTILISTEN0_S) & 0xf); | ||
| 1147 | } | ||
| 1148 | out: return 0; | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | static inline void *mps_tcam_get_idx(struct seq_file *seq, loff_t pos) | ||
| 1152 | { | ||
| 1153 | struct adapter *adap = seq->private; | ||
| 1154 | int max_mac_addr = is_t4(adap->params.chip) ? | ||
| 1155 | NUM_MPS_CLS_SRAM_L_INSTANCES : | ||
| 1156 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; | ||
| 1157 | return ((pos <= max_mac_addr) ? (void *)(uintptr_t)(pos + 1) : NULL); | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | static void *mps_tcam_start(struct seq_file *seq, loff_t *pos) | ||
| 1161 | { | ||
| 1162 | return *pos ? mps_tcam_get_idx(seq, *pos) : SEQ_START_TOKEN; | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | static void *mps_tcam_next(struct seq_file *seq, void *v, loff_t *pos) | ||
| 1166 | { | ||
| 1167 | ++*pos; | ||
| 1168 | return mps_tcam_get_idx(seq, *pos); | ||
| 1169 | } | ||
| 1170 | |||
| 1171 | static void mps_tcam_stop(struct seq_file *seq, void *v) | ||
| 1172 | { | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | static const struct seq_operations mps_tcam_seq_ops = { | ||
| 1176 | .start = mps_tcam_start, | ||
| 1177 | .next = mps_tcam_next, | ||
| 1178 | .stop = mps_tcam_stop, | ||
| 1179 | .show = mps_tcam_show | ||
| 1180 | }; | ||
| 1181 | |||
| 1182 | static int mps_tcam_open(struct inode *inode, struct file *file) | ||
| 1183 | { | ||
| 1184 | int res = seq_open(file, &mps_tcam_seq_ops); | ||
| 1185 | |||
| 1186 | if (!res) { | ||
| 1187 | struct seq_file *seq = file->private_data; | ||
| 1188 | |||
| 1189 | seq->private = inode->i_private; | ||
| 1190 | } | ||
| 1191 | return res; | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | static const struct file_operations mps_tcam_debugfs_fops = { | ||
| 1195 | .owner = THIS_MODULE, | ||
| 1196 | .open = mps_tcam_open, | ||
| 1197 | .read = seq_read, | ||
| 1198 | .llseek = seq_lseek, | ||
| 1199 | .release = seq_release, | ||
| 1200 | }; | ||
| 1201 | |||
| 1202 | /* Display various sensor information. | ||
| 1203 | */ | ||
| 1204 | static int sensors_show(struct seq_file *seq, void *v) | ||
| 1205 | { | ||
| 1206 | struct adapter *adap = seq->private; | ||
| 1207 | u32 param[7], val[7]; | ||
| 1208 | int ret; | ||
| 1209 | |||
| 1210 | /* Note that if the sensors haven't been initialized and turned on | ||
| 1211 | * we'll get values of 0, so treat those as "<unknown>" ... | ||
| 1212 | */ | ||
| 1213 | param[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | | ||
| 1214 | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) | | ||
| 1215 | FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_TMP)); | ||
| 1216 | param[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | | ||
| 1217 | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) | | ||
| 1218 | FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_VDD)); | ||
| 1219 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, | ||
| 1220 | param, val); | ||
| 1221 | |||
| 1222 | if (ret < 0 || val[0] == 0) | ||
| 1223 | seq_puts(seq, "Temperature: <unknown>\n"); | ||
| 1224 | else | ||
| 1225 | seq_printf(seq, "Temperature: %dC\n", val[0]); | ||
| 1226 | |||
| 1227 | if (ret < 0 || val[1] == 0) | ||
| 1228 | seq_puts(seq, "Core VDD: <unknown>\n"); | ||
| 1229 | else | ||
| 1230 | seq_printf(seq, "Core VDD: %dmV\n", val[1]); | ||
| 1231 | |||
| 1232 | return 0; | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | DEFINE_SIMPLE_DEBUGFS_FILE(sensors); | ||
| 1236 | |||
| 1237 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 1238 | static int clip_tbl_open(struct inode *inode, struct file *file) | ||
| 1239 | { | ||
| 1240 | return single_open(file, clip_tbl_show, inode->i_private); | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | static const struct file_operations clip_tbl_debugfs_fops = { | ||
| 1244 | .owner = THIS_MODULE, | ||
| 1245 | .open = clip_tbl_open, | ||
| 1246 | .read = seq_read, | ||
| 1247 | .llseek = seq_lseek, | ||
| 1248 | .release = single_release | ||
| 1249 | }; | ||
| 1250 | #endif | ||
| 1251 | |||
| 1252 | /*RSS Table. | ||
| 1253 | */ | ||
| 1254 | |||
| 1255 | static int rss_show(struct seq_file *seq, void *v, int idx) | ||
| 1256 | { | ||
| 1257 | u16 *entry = v; | ||
| 1258 | |||
| 1259 | seq_printf(seq, "%4d: %4u %4u %4u %4u %4u %4u %4u %4u\n", | ||
| 1260 | idx * 8, entry[0], entry[1], entry[2], entry[3], entry[4], | ||
| 1261 | entry[5], entry[6], entry[7]); | ||
| 1262 | return 0; | ||
| 1263 | } | ||
| 1264 | |||
| 1265 | static int rss_open(struct inode *inode, struct file *file) | ||
| 1266 | { | ||
| 1267 | int ret; | ||
| 1268 | struct seq_tab *p; | ||
| 1269 | struct adapter *adap = inode->i_private; | ||
| 1270 | |||
| 1271 | p = seq_open_tab(file, RSS_NENTRIES / 8, 8 * sizeof(u16), 0, rss_show); | ||
| 1272 | if (!p) | ||
| 1273 | return -ENOMEM; | ||
| 1274 | |||
| 1275 | ret = t4_read_rss(adap, (u16 *)p->data); | ||
| 1276 | if (ret) | ||
| 1277 | seq_release_private(inode, file); | ||
| 1278 | |||
| 1279 | return ret; | ||
| 1280 | } | ||
| 1281 | |||
| 1282 | static const struct file_operations rss_debugfs_fops = { | ||
| 1283 | .owner = THIS_MODULE, | ||
| 1284 | .open = rss_open, | ||
| 1285 | .read = seq_read, | ||
| 1286 | .llseek = seq_lseek, | ||
| 1287 | .release = seq_release_private | ||
| 1288 | }; | ||
| 1289 | |||
| 1290 | /* RSS Configuration. | ||
| 1291 | */ | ||
| 1292 | |||
| 1293 | /* Small utility function to return the strings "yes" or "no" if the supplied | ||
| 1294 | * argument is non-zero. | ||
| 1295 | */ | ||
| 1296 | static const char *yesno(int x) | ||
| 1297 | { | ||
| 1298 | static const char *yes = "yes"; | ||
| 1299 | static const char *no = "no"; | ||
| 1300 | |||
| 1301 | return x ? yes : no; | ||
| 1302 | } | ||
| 1303 | |||
| 1304 | static int rss_config_show(struct seq_file *seq, void *v) | ||
| 1305 | { | ||
| 1306 | struct adapter *adapter = seq->private; | ||
| 1307 | static const char * const keymode[] = { | ||
| 1308 | "global", | ||
| 1309 | "global and per-VF scramble", | ||
| 1310 | "per-PF and per-VF scramble", | ||
| 1311 | "per-VF and per-VF scramble", | ||
| 1312 | }; | ||
| 1313 | u32 rssconf; | ||
| 1314 | |||
| 1315 | rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_A); | ||
| 1316 | seq_printf(seq, "TP_RSS_CONFIG: %#x\n", rssconf); | ||
| 1317 | seq_printf(seq, " Tnl4TupEnIpv6: %3s\n", yesno(rssconf & | ||
| 1318 | TNL4TUPENIPV6_F)); | ||
| 1319 | seq_printf(seq, " Tnl2TupEnIpv6: %3s\n", yesno(rssconf & | ||
| 1320 | TNL2TUPENIPV6_F)); | ||
| 1321 | seq_printf(seq, " Tnl4TupEnIpv4: %3s\n", yesno(rssconf & | ||
| 1322 | TNL4TUPENIPV4_F)); | ||
| 1323 | seq_printf(seq, " Tnl2TupEnIpv4: %3s\n", yesno(rssconf & | ||
| 1324 | TNL2TUPENIPV4_F)); | ||
| 1325 | seq_printf(seq, " TnlTcpSel: %3s\n", yesno(rssconf & TNLTCPSEL_F)); | ||
| 1326 | seq_printf(seq, " TnlIp6Sel: %3s\n", yesno(rssconf & TNLIP6SEL_F)); | ||
| 1327 | seq_printf(seq, " TnlVrtSel: %3s\n", yesno(rssconf & TNLVRTSEL_F)); | ||
| 1328 | seq_printf(seq, " TnlMapEn: %3s\n", yesno(rssconf & TNLMAPEN_F)); | ||
| 1329 | seq_printf(seq, " OfdHashSave: %3s\n", yesno(rssconf & | ||
| 1330 | OFDHASHSAVE_F)); | ||
| 1331 | seq_printf(seq, " OfdVrtSel: %3s\n", yesno(rssconf & OFDVRTSEL_F)); | ||
| 1332 | seq_printf(seq, " OfdMapEn: %3s\n", yesno(rssconf & OFDMAPEN_F)); | ||
| 1333 | seq_printf(seq, " OfdLkpEn: %3s\n", yesno(rssconf & OFDLKPEN_F)); | ||
| 1334 | seq_printf(seq, " Syn4TupEnIpv6: %3s\n", yesno(rssconf & | ||
| 1335 | SYN4TUPENIPV6_F)); | ||
| 1336 | seq_printf(seq, " Syn2TupEnIpv6: %3s\n", yesno(rssconf & | ||
| 1337 | SYN2TUPENIPV6_F)); | ||
| 1338 | seq_printf(seq, " Syn4TupEnIpv4: %3s\n", yesno(rssconf & | ||
| 1339 | SYN4TUPENIPV4_F)); | ||
| 1340 | seq_printf(seq, " Syn2TupEnIpv4: %3s\n", yesno(rssconf & | ||
| 1341 | SYN2TUPENIPV4_F)); | ||
| 1342 | seq_printf(seq, " Syn4TupEnIpv6: %3s\n", yesno(rssconf & | ||
| 1343 | SYN4TUPENIPV6_F)); | ||
| 1344 | seq_printf(seq, " SynIp6Sel: %3s\n", yesno(rssconf & SYNIP6SEL_F)); | ||
| 1345 | seq_printf(seq, " SynVrt6Sel: %3s\n", yesno(rssconf & SYNVRTSEL_F)); | ||
| 1346 | seq_printf(seq, " SynMapEn: %3s\n", yesno(rssconf & SYNMAPEN_F)); | ||
| 1347 | seq_printf(seq, " SynLkpEn: %3s\n", yesno(rssconf & SYNLKPEN_F)); | ||
| 1348 | seq_printf(seq, " ChnEn: %3s\n", yesno(rssconf & | ||
| 1349 | CHANNELENABLE_F)); | ||
| 1350 | seq_printf(seq, " PrtEn: %3s\n", yesno(rssconf & | ||
| 1351 | PORTENABLE_F)); | ||
| 1352 | seq_printf(seq, " TnlAllLkp: %3s\n", yesno(rssconf & | ||
| 1353 | TNLALLLOOKUP_F)); | ||
| 1354 | seq_printf(seq, " VrtEn: %3s\n", yesno(rssconf & | ||
| 1355 | VIRTENABLE_F)); | ||
| 1356 | seq_printf(seq, " CngEn: %3s\n", yesno(rssconf & | ||
| 1357 | CONGESTIONENABLE_F)); | ||
| 1358 | seq_printf(seq, " HashToeplitz: %3s\n", yesno(rssconf & | ||
| 1359 | HASHTOEPLITZ_F)); | ||
| 1360 | seq_printf(seq, " Udp4En: %3s\n", yesno(rssconf & UDPENABLE_F)); | ||
| 1361 | seq_printf(seq, " Disable: %3s\n", yesno(rssconf & DISABLE_F)); | ||
| 1362 | |||
| 1363 | seq_puts(seq, "\n"); | ||
| 1364 | |||
| 1365 | rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_TNL_A); | ||
| 1366 | seq_printf(seq, "TP_RSS_CONFIG_TNL: %#x\n", rssconf); | ||
| 1367 | seq_printf(seq, " MaskSize: %3d\n", MASKSIZE_G(rssconf)); | ||
| 1368 | seq_printf(seq, " MaskFilter: %3d\n", MASKFILTER_G(rssconf)); | ||
| 1369 | if (CHELSIO_CHIP_VERSION(adapter->params.chip) > CHELSIO_T5) { | ||
| 1370 | seq_printf(seq, " HashAll: %3s\n", | ||
| 1371 | yesno(rssconf & HASHALL_F)); | ||
| 1372 | seq_printf(seq, " HashEth: %3s\n", | ||
| 1373 | yesno(rssconf & HASHETH_F)); | ||
| 1374 | } | ||
| 1375 | seq_printf(seq, " UseWireCh: %3s\n", yesno(rssconf & USEWIRECH_F)); | ||
| 1376 | |||
| 1377 | seq_puts(seq, "\n"); | ||
| 1378 | |||
| 1379 | rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_OFD_A); | ||
| 1380 | seq_printf(seq, "TP_RSS_CONFIG_OFD: %#x\n", rssconf); | ||
| 1381 | seq_printf(seq, " MaskSize: %3d\n", MASKSIZE_G(rssconf)); | ||
| 1382 | seq_printf(seq, " RRCplMapEn: %3s\n", yesno(rssconf & | ||
| 1383 | RRCPLMAPEN_F)); | ||
| 1384 | seq_printf(seq, " RRCplQueWidth: %3d\n", RRCPLQUEWIDTH_G(rssconf)); | ||
| 1385 | |||
| 1386 | seq_puts(seq, "\n"); | ||
| 1387 | |||
| 1388 | rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_SYN_A); | ||
| 1389 | seq_printf(seq, "TP_RSS_CONFIG_SYN: %#x\n", rssconf); | ||
| 1390 | seq_printf(seq, " MaskSize: %3d\n", MASKSIZE_G(rssconf)); | ||
| 1391 | seq_printf(seq, " UseWireCh: %3s\n", yesno(rssconf & USEWIRECH_F)); | ||
| 1392 | |||
| 1393 | seq_puts(seq, "\n"); | ||
| 1394 | |||
| 1395 | rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_VRT_A); | ||
| 1396 | seq_printf(seq, "TP_RSS_CONFIG_VRT: %#x\n", rssconf); | ||
| 1397 | if (CHELSIO_CHIP_VERSION(adapter->params.chip) > CHELSIO_T5) { | ||
| 1398 | seq_printf(seq, " KeyWrAddrX: %3d\n", | ||
| 1399 | KEYWRADDRX_G(rssconf)); | ||
| 1400 | seq_printf(seq, " KeyExtend: %3s\n", | ||
| 1401 | yesno(rssconf & KEYEXTEND_F)); | ||
| 1402 | } | ||
| 1403 | seq_printf(seq, " VfRdRg: %3s\n", yesno(rssconf & VFRDRG_F)); | ||
| 1404 | seq_printf(seq, " VfRdEn: %3s\n", yesno(rssconf & VFRDEN_F)); | ||
| 1405 | seq_printf(seq, " VfPerrEn: %3s\n", yesno(rssconf & VFPERREN_F)); | ||
| 1406 | seq_printf(seq, " KeyPerrEn: %3s\n", yesno(rssconf & KEYPERREN_F)); | ||
| 1407 | seq_printf(seq, " DisVfVlan: %3s\n", yesno(rssconf & | ||
| 1408 | DISABLEVLAN_F)); | ||
| 1409 | seq_printf(seq, " EnUpSwt: %3s\n", yesno(rssconf & ENABLEUP0_F)); | ||
| 1410 | seq_printf(seq, " HashDelay: %3d\n", HASHDELAY_G(rssconf)); | ||
| 1411 | if (CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5) | ||
| 1412 | seq_printf(seq, " VfWrAddr: %3d\n", VFWRADDR_G(rssconf)); | ||
| 1413 | seq_printf(seq, " KeyMode: %s\n", keymode[KEYMODE_G(rssconf)]); | ||
| 1414 | seq_printf(seq, " VfWrEn: %3s\n", yesno(rssconf & VFWREN_F)); | ||
| 1415 | seq_printf(seq, " KeyWrEn: %3s\n", yesno(rssconf & KEYWREN_F)); | ||
| 1416 | seq_printf(seq, " KeyWrAddr: %3d\n", KEYWRADDR_G(rssconf)); | ||
| 1417 | |||
| 1418 | seq_puts(seq, "\n"); | ||
| 1419 | |||
| 1420 | rssconf = t4_read_reg(adapter, TP_RSS_CONFIG_CNG_A); | ||
| 1421 | seq_printf(seq, "TP_RSS_CONFIG_CNG: %#x\n", rssconf); | ||
| 1422 | seq_printf(seq, " ChnCount3: %3s\n", yesno(rssconf & CHNCOUNT3_F)); | ||
| 1423 | seq_printf(seq, " ChnCount2: %3s\n", yesno(rssconf & CHNCOUNT2_F)); | ||
| 1424 | seq_printf(seq, " ChnCount1: %3s\n", yesno(rssconf & CHNCOUNT1_F)); | ||
| 1425 | seq_printf(seq, " ChnCount0: %3s\n", yesno(rssconf & CHNCOUNT0_F)); | ||
| 1426 | seq_printf(seq, " ChnUndFlow3: %3s\n", yesno(rssconf & | ||
| 1427 | CHNUNDFLOW3_F)); | ||
| 1428 | seq_printf(seq, " ChnUndFlow2: %3s\n", yesno(rssconf & | ||
| 1429 | CHNUNDFLOW2_F)); | ||
| 1430 | seq_printf(seq, " ChnUndFlow1: %3s\n", yesno(rssconf & | ||
| 1431 | CHNUNDFLOW1_F)); | ||
| 1432 | seq_printf(seq, " ChnUndFlow0: %3s\n", yesno(rssconf & | ||
| 1433 | CHNUNDFLOW0_F)); | ||
| 1434 | seq_printf(seq, " RstChn3: %3s\n", yesno(rssconf & RSTCHN3_F)); | ||
| 1435 | seq_printf(seq, " RstChn2: %3s\n", yesno(rssconf & RSTCHN2_F)); | ||
| 1436 | seq_printf(seq, " RstChn1: %3s\n", yesno(rssconf & RSTCHN1_F)); | ||
| 1437 | seq_printf(seq, " RstChn0: %3s\n", yesno(rssconf & RSTCHN0_F)); | ||
| 1438 | seq_printf(seq, " UpdVld: %3s\n", yesno(rssconf & UPDVLD_F)); | ||
| 1439 | seq_printf(seq, " Xoff: %3s\n", yesno(rssconf & XOFF_F)); | ||
| 1440 | seq_printf(seq, " UpdChn3: %3s\n", yesno(rssconf & UPDCHN3_F)); | ||
| 1441 | seq_printf(seq, " UpdChn2: %3s\n", yesno(rssconf & UPDCHN2_F)); | ||
| 1442 | seq_printf(seq, " UpdChn1: %3s\n", yesno(rssconf & UPDCHN1_F)); | ||
| 1443 | seq_printf(seq, " UpdChn0: %3s\n", yesno(rssconf & UPDCHN0_F)); | ||
| 1444 | seq_printf(seq, " Queue: %3d\n", QUEUE_G(rssconf)); | ||
| 1445 | |||
| 1446 | return 0; | ||
| 1447 | } | ||
| 1448 | |||
| 1449 | DEFINE_SIMPLE_DEBUGFS_FILE(rss_config); | ||
| 1450 | |||
| 1451 | /* RSS Secret Key. | ||
| 1452 | */ | ||
| 1453 | |||
| 1454 | static int rss_key_show(struct seq_file *seq, void *v) | ||
| 1455 | { | ||
| 1456 | u32 key[10]; | ||
| 1457 | |||
| 1458 | t4_read_rss_key(seq->private, key); | ||
| 1459 | seq_printf(seq, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x\n", | ||
| 1460 | key[9], key[8], key[7], key[6], key[5], key[4], key[3], | ||
| 1461 | key[2], key[1], key[0]); | ||
| 1462 | return 0; | ||
| 1463 | } | ||
| 1464 | |||
| 1465 | static int rss_key_open(struct inode *inode, struct file *file) | ||
| 1466 | { | ||
| 1467 | return single_open(file, rss_key_show, inode->i_private); | ||
| 1468 | } | ||
| 1469 | |||
| 1470 | static ssize_t rss_key_write(struct file *file, const char __user *buf, | ||
| 1471 | size_t count, loff_t *pos) | ||
| 1472 | { | ||
| 1473 | int i, j; | ||
| 1474 | u32 key[10]; | ||
| 1475 | char s[100], *p; | ||
| 1476 | struct adapter *adap = FILE_DATA(file)->i_private; | ||
| 1477 | |||
| 1478 | if (count > sizeof(s) - 1) | ||
| 1479 | return -EINVAL; | ||
| 1480 | if (copy_from_user(s, buf, count)) | ||
| 1481 | return -EFAULT; | ||
| 1482 | for (i = count; i > 0 && isspace(s[i - 1]); i--) | ||
| 1483 | ; | ||
| 1484 | s[i] = '\0'; | ||
| 1485 | |||
| 1486 | for (p = s, i = 9; i >= 0; i--) { | ||
| 1487 | key[i] = 0; | ||
| 1488 | for (j = 0; j < 8; j++, p++) { | ||
| 1489 | if (!isxdigit(*p)) | ||
| 1490 | return -EINVAL; | ||
| 1491 | key[i] = (key[i] << 4) | hex2val(*p); | ||
| 1492 | } | ||
| 1493 | } | ||
| 1494 | |||
| 1495 | t4_write_rss_key(adap, key, -1); | ||
| 1496 | return count; | ||
| 1497 | } | ||
| 1498 | |||
| 1499 | static const struct file_operations rss_key_debugfs_fops = { | ||
| 1500 | .owner = THIS_MODULE, | ||
| 1501 | .open = rss_key_open, | ||
| 1502 | .read = seq_read, | ||
| 1503 | .llseek = seq_lseek, | ||
| 1504 | .release = single_release, | ||
| 1505 | .write = rss_key_write | ||
| 1506 | }; | ||
| 1507 | |||
| 1508 | /* PF RSS Configuration. | ||
| 1509 | */ | ||
| 1510 | |||
| 1511 | struct rss_pf_conf { | ||
| 1512 | u32 rss_pf_map; | ||
| 1513 | u32 rss_pf_mask; | ||
| 1514 | u32 rss_pf_config; | ||
| 1515 | }; | ||
| 1516 | |||
| 1517 | static int rss_pf_config_show(struct seq_file *seq, void *v, int idx) | ||
| 1518 | { | ||
| 1519 | struct rss_pf_conf *pfconf; | ||
| 1520 | |||
| 1521 | if (v == SEQ_START_TOKEN) { | ||
| 1522 | /* use the 0th entry to dump the PF Map Index Size */ | ||
| 1523 | pfconf = seq->private + offsetof(struct seq_tab, data); | ||
| 1524 | seq_printf(seq, "PF Map Index Size = %d\n\n", | ||
| 1525 | LKPIDXSIZE_G(pfconf->rss_pf_map)); | ||
| 1526 | |||
| 1527 | seq_puts(seq, " RSS PF VF Hash Tuple Enable Default\n"); | ||
| 1528 | seq_puts(seq, " Enable IPF Mask Mask IPv6 IPv4 UDP Queue\n"); | ||
| 1529 | seq_puts(seq, " PF Map Chn Prt Map Size Size Four Two Four Two Four Ch1 Ch0\n"); | ||
| 1530 | } else { | ||
| 1531 | #define G_PFnLKPIDX(map, n) \ | ||
| 1532 | (((map) >> PF1LKPIDX_S*(n)) & PF0LKPIDX_M) | ||
| 1533 | #define G_PFnMSKSIZE(mask, n) \ | ||
| 1534 | (((mask) >> PF1MSKSIZE_S*(n)) & PF1MSKSIZE_M) | ||
| 1535 | |||
| 1536 | pfconf = v; | ||
| 1537 | seq_printf(seq, "%3d %3s %3s %3s %3d %3d %3d %3s %3s %3s %3s %3s %3d %3d\n", | ||
| 1538 | idx, | ||
| 1539 | yesno(pfconf->rss_pf_config & MAPENABLE_F), | ||
| 1540 | yesno(pfconf->rss_pf_config & CHNENABLE_F), | ||
| 1541 | yesno(pfconf->rss_pf_config & PRTENABLE_F), | ||
| 1542 | G_PFnLKPIDX(pfconf->rss_pf_map, idx), | ||
| 1543 | G_PFnMSKSIZE(pfconf->rss_pf_mask, idx), | ||
| 1544 | IVFWIDTH_G(pfconf->rss_pf_config), | ||
| 1545 | yesno(pfconf->rss_pf_config & IP6FOURTUPEN_F), | ||
| 1546 | yesno(pfconf->rss_pf_config & IP6TWOTUPEN_F), | ||
| 1547 | yesno(pfconf->rss_pf_config & IP4FOURTUPEN_F), | ||
| 1548 | yesno(pfconf->rss_pf_config & IP4TWOTUPEN_F), | ||
| 1549 | yesno(pfconf->rss_pf_config & UDPFOURTUPEN_F), | ||
| 1550 | CH1DEFAULTQUEUE_G(pfconf->rss_pf_config), | ||
| 1551 | CH0DEFAULTQUEUE_G(pfconf->rss_pf_config)); | ||
| 1552 | |||
| 1553 | #undef G_PFnLKPIDX | ||
| 1554 | #undef G_PFnMSKSIZE | ||
| 1555 | } | ||
| 1556 | return 0; | ||
| 1557 | } | ||
| 1558 | |||
| 1559 | static int rss_pf_config_open(struct inode *inode, struct file *file) | ||
| 1560 | { | ||
| 1561 | struct adapter *adapter = inode->i_private; | ||
| 1562 | struct seq_tab *p; | ||
| 1563 | u32 rss_pf_map, rss_pf_mask; | ||
| 1564 | struct rss_pf_conf *pfconf; | ||
| 1565 | int pf; | ||
| 1566 | |||
| 1567 | p = seq_open_tab(file, 8, sizeof(*pfconf), 1, rss_pf_config_show); | ||
| 1568 | if (!p) | ||
| 1569 | return -ENOMEM; | ||
| 1570 | |||
| 1571 | pfconf = (struct rss_pf_conf *)p->data; | ||
| 1572 | rss_pf_map = t4_read_rss_pf_map(adapter); | ||
| 1573 | rss_pf_mask = t4_read_rss_pf_mask(adapter); | ||
| 1574 | for (pf = 0; pf < 8; pf++) { | ||
| 1575 | pfconf[pf].rss_pf_map = rss_pf_map; | ||
| 1576 | pfconf[pf].rss_pf_mask = rss_pf_mask; | ||
| 1577 | t4_read_rss_pf_config(adapter, pf, &pfconf[pf].rss_pf_config); | ||
| 1578 | } | ||
| 1579 | return 0; | ||
| 1580 | } | ||
| 1581 | |||
| 1582 | static const struct file_operations rss_pf_config_debugfs_fops = { | ||
| 1583 | .owner = THIS_MODULE, | ||
| 1584 | .open = rss_pf_config_open, | ||
| 1585 | .read = seq_read, | ||
| 1586 | .llseek = seq_lseek, | ||
| 1587 | .release = seq_release_private | ||
| 1588 | }; | ||
| 1589 | |||
| 1590 | /* VF RSS Configuration. | ||
| 1591 | */ | ||
| 1592 | |||
| 1593 | struct rss_vf_conf { | ||
| 1594 | u32 rss_vf_vfl; | ||
| 1595 | u32 rss_vf_vfh; | ||
| 1596 | }; | ||
| 1597 | |||
| 1598 | static int rss_vf_config_show(struct seq_file *seq, void *v, int idx) | ||
| 1599 | { | ||
| 1600 | if (v == SEQ_START_TOKEN) { | ||
| 1601 | seq_puts(seq, " RSS Hash Tuple Enable\n"); | ||
| 1602 | seq_puts(seq, " Enable IVF Dis Enb IPv6 IPv4 UDP Def Secret Key\n"); | ||
| 1603 | seq_puts(seq, " VF Chn Prt Map VLAN uP Four Two Four Two Four Que Idx Hash\n"); | ||
| 1604 | } else { | ||
| 1605 | struct rss_vf_conf *vfconf = v; | ||
| 1606 | |||
| 1607 | seq_printf(seq, "%3d %3s %3s %3d %3s %3s %3s %3s %3s %3s %3s %4d %3d %#10x\n", | ||
| 1608 | idx, | ||
| 1609 | yesno(vfconf->rss_vf_vfh & VFCHNEN_F), | ||
| 1610 | yesno(vfconf->rss_vf_vfh & VFPRTEN_F), | ||
| 1611 | VFLKPIDX_G(vfconf->rss_vf_vfh), | ||
| 1612 | yesno(vfconf->rss_vf_vfh & VFVLNEX_F), | ||
| 1613 | yesno(vfconf->rss_vf_vfh & VFUPEN_F), | ||
| 1614 | yesno(vfconf->rss_vf_vfh & VFIP4FOURTUPEN_F), | ||
| 1615 | yesno(vfconf->rss_vf_vfh & VFIP6TWOTUPEN_F), | ||
| 1616 | yesno(vfconf->rss_vf_vfh & VFIP4FOURTUPEN_F), | ||
| 1617 | yesno(vfconf->rss_vf_vfh & VFIP4TWOTUPEN_F), | ||
| 1618 | yesno(vfconf->rss_vf_vfh & ENABLEUDPHASH_F), | ||
| 1619 | DEFAULTQUEUE_G(vfconf->rss_vf_vfh), | ||
| 1620 | KEYINDEX_G(vfconf->rss_vf_vfh), | ||
| 1621 | vfconf->rss_vf_vfl); | ||
| 1622 | } | ||
| 1623 | return 0; | ||
| 1624 | } | ||
| 1625 | |||
| 1626 | static int rss_vf_config_open(struct inode *inode, struct file *file) | ||
| 1627 | { | ||
| 1628 | struct adapter *adapter = inode->i_private; | ||
| 1629 | struct seq_tab *p; | ||
| 1630 | struct rss_vf_conf *vfconf; | ||
| 1631 | int vf; | ||
| 1632 | |||
| 1633 | p = seq_open_tab(file, 128, sizeof(*vfconf), 1, rss_vf_config_show); | ||
| 1634 | if (!p) | ||
| 1635 | return -ENOMEM; | ||
| 1636 | |||
| 1637 | vfconf = (struct rss_vf_conf *)p->data; | ||
| 1638 | for (vf = 0; vf < 128; vf++) { | ||
| 1639 | t4_read_rss_vf_config(adapter, vf, &vfconf[vf].rss_vf_vfl, | ||
| 1640 | &vfconf[vf].rss_vf_vfh); | ||
| 1641 | } | ||
| 1642 | return 0; | ||
| 1643 | } | ||
| 1644 | |||
| 1645 | static const struct file_operations rss_vf_config_debugfs_fops = { | ||
| 1646 | .owner = THIS_MODULE, | ||
| 1647 | .open = rss_vf_config_open, | ||
| 1648 | .read = seq_read, | ||
| 1649 | .llseek = seq_lseek, | ||
| 1650 | .release = seq_release_private | ||
| 1651 | }; | ||
| 1652 | |||
| 1653 | /** | ||
| 1654 | * ethqset2pinfo - return port_info of an Ethernet Queue Set | ||
| 1655 | * @adap: the adapter | ||
| 1656 | * @qset: Ethernet Queue Set | ||
| 1657 | */ | ||
| 1658 | static inline struct port_info *ethqset2pinfo(struct adapter *adap, int qset) | ||
| 1659 | { | ||
| 1660 | int pidx; | ||
| 1661 | |||
| 1662 | for_each_port(adap, pidx) { | ||
| 1663 | struct port_info *pi = adap2pinfo(adap, pidx); | ||
| 1664 | |||
| 1665 | if (qset >= pi->first_qset && | ||
| 1666 | qset < pi->first_qset + pi->nqsets) | ||
| 1667 | return pi; | ||
| 1668 | } | ||
| 1669 | |||
| 1670 | /* should never happen! */ | ||
| 1671 | BUG_ON(1); | ||
| 1672 | return NULL; | ||
| 1673 | } | ||
| 1674 | |||
| 1675 | static int sge_qinfo_show(struct seq_file *seq, void *v) | ||
| 1676 | { | ||
| 1677 | struct adapter *adap = seq->private; | ||
| 1678 | int eth_entries = DIV_ROUND_UP(adap->sge.ethqsets, 4); | ||
| 1679 | int toe_entries = DIV_ROUND_UP(adap->sge.ofldqsets, 4); | ||
| 1680 | int rdma_entries = DIV_ROUND_UP(adap->sge.rdmaqs, 4); | ||
| 1681 | int ciq_entries = DIV_ROUND_UP(adap->sge.rdmaciqs, 4); | ||
| 1682 | int ctrl_entries = DIV_ROUND_UP(MAX_CTRL_QUEUES, 4); | ||
| 1683 | int i, r = (uintptr_t)v - 1; | ||
| 1684 | int toe_idx = r - eth_entries; | ||
| 1685 | int rdma_idx = toe_idx - toe_entries; | ||
| 1686 | int ciq_idx = rdma_idx - rdma_entries; | ||
| 1687 | int ctrl_idx = ciq_idx - ciq_entries; | ||
| 1688 | int fq_idx = ctrl_idx - ctrl_entries; | ||
| 1689 | |||
| 1690 | if (r) | ||
| 1691 | seq_putc(seq, '\n'); | ||
| 1692 | |||
| 1693 | #define S3(fmt_spec, s, v) \ | ||
| 1694 | do { \ | ||
| 1695 | seq_printf(seq, "%-12s", s); \ | ||
| 1696 | for (i = 0; i < n; ++i) \ | ||
| 1697 | seq_printf(seq, " %16" fmt_spec, v); \ | ||
| 1698 | seq_putc(seq, '\n'); \ | ||
| 1699 | } while (0) | ||
| 1700 | #define S(s, v) S3("s", s, v) | ||
| 1701 | #define T(s, v) S3("u", s, tx[i].v) | ||
| 1702 | #define R(s, v) S3("u", s, rx[i].v) | ||
| 1703 | |||
| 1704 | if (r < eth_entries) { | ||
| 1705 | int base_qset = r * 4; | ||
| 1706 | const struct sge_eth_rxq *rx = &adap->sge.ethrxq[base_qset]; | ||
| 1707 | const struct sge_eth_txq *tx = &adap->sge.ethtxq[base_qset]; | ||
| 1708 | int n = min(4, adap->sge.ethqsets - 4 * r); | ||
| 1709 | |||
| 1710 | S("QType:", "Ethernet"); | ||
| 1711 | S("Interface:", | ||
| 1712 | rx[i].rspq.netdev ? rx[i].rspq.netdev->name : "N/A"); | ||
| 1713 | T("TxQ ID:", q.cntxt_id); | ||
| 1714 | T("TxQ size:", q.size); | ||
| 1715 | T("TxQ inuse:", q.in_use); | ||
| 1716 | T("TxQ CIDX:", q.cidx); | ||
| 1717 | T("TxQ PIDX:", q.pidx); | ||
| 1718 | #ifdef CONFIG_CHELSIO_T4_DCB | ||
| 1719 | T("DCB Prio:", dcb_prio); | ||
| 1720 | S3("u", "DCB PGID:", | ||
| 1721 | (ethqset2pinfo(adap, base_qset + i)->dcb.pgid >> | ||
| 1722 | 4*(7-tx[i].dcb_prio)) & 0xf); | ||
| 1723 | S3("u", "DCB PFC:", | ||
| 1724 | (ethqset2pinfo(adap, base_qset + i)->dcb.pfcen >> | ||
| 1725 | 1*(7-tx[i].dcb_prio)) & 0x1); | ||
| 1726 | #endif | ||
| 1727 | R("RspQ ID:", rspq.abs_id); | ||
| 1728 | R("RspQ size:", rspq.size); | ||
| 1729 | R("RspQE size:", rspq.iqe_len); | ||
| 1730 | R("RspQ CIDX:", rspq.cidx); | ||
| 1731 | R("RspQ Gen:", rspq.gen); | ||
| 1732 | S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); | ||
| 1733 | S3("u", "Intr pktcnt:", | ||
| 1734 | adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); | ||
| 1735 | R("FL ID:", fl.cntxt_id); | ||
| 1736 | R("FL size:", fl.size - 8); | ||
| 1737 | R("FL pend:", fl.pend_cred); | ||
| 1738 | R("FL avail:", fl.avail); | ||
| 1739 | R("FL PIDX:", fl.pidx); | ||
| 1740 | R("FL CIDX:", fl.cidx); | ||
| 1741 | } else if (toe_idx < toe_entries) { | ||
| 1742 | const struct sge_ofld_rxq *rx = &adap->sge.ofldrxq[toe_idx * 4]; | ||
| 1743 | const struct sge_ofld_txq *tx = &adap->sge.ofldtxq[toe_idx * 4]; | ||
| 1744 | int n = min(4, adap->sge.ofldqsets - 4 * toe_idx); | ||
| 1745 | |||
| 1746 | S("QType:", "TOE"); | ||
| 1747 | T("TxQ ID:", q.cntxt_id); | ||
| 1748 | T("TxQ size:", q.size); | ||
| 1749 | T("TxQ inuse:", q.in_use); | ||
| 1750 | T("TxQ CIDX:", q.cidx); | ||
| 1751 | T("TxQ PIDX:", q.pidx); | ||
| 1752 | R("RspQ ID:", rspq.abs_id); | ||
| 1753 | R("RspQ size:", rspq.size); | ||
| 1754 | R("RspQE size:", rspq.iqe_len); | ||
| 1755 | R("RspQ CIDX:", rspq.cidx); | ||
| 1756 | R("RspQ Gen:", rspq.gen); | ||
| 1757 | S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); | ||
| 1758 | S3("u", "Intr pktcnt:", | ||
| 1759 | adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); | ||
| 1760 | R("FL ID:", fl.cntxt_id); | ||
| 1761 | R("FL size:", fl.size - 8); | ||
| 1762 | R("FL pend:", fl.pend_cred); | ||
| 1763 | R("FL avail:", fl.avail); | ||
| 1764 | R("FL PIDX:", fl.pidx); | ||
| 1765 | R("FL CIDX:", fl.cidx); | ||
| 1766 | } else if (rdma_idx < rdma_entries) { | ||
| 1767 | const struct sge_ofld_rxq *rx = | ||
| 1768 | &adap->sge.rdmarxq[rdma_idx * 4]; | ||
| 1769 | int n = min(4, adap->sge.rdmaqs - 4 * rdma_idx); | ||
| 1770 | |||
| 1771 | S("QType:", "RDMA-CPL"); | ||
| 1772 | R("RspQ ID:", rspq.abs_id); | ||
| 1773 | R("RspQ size:", rspq.size); | ||
| 1774 | R("RspQE size:", rspq.iqe_len); | ||
| 1775 | R("RspQ CIDX:", rspq.cidx); | ||
| 1776 | R("RspQ Gen:", rspq.gen); | ||
| 1777 | S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); | ||
| 1778 | S3("u", "Intr pktcnt:", | ||
| 1779 | adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); | ||
| 1780 | R("FL ID:", fl.cntxt_id); | ||
| 1781 | R("FL size:", fl.size - 8); | ||
| 1782 | R("FL pend:", fl.pend_cred); | ||
| 1783 | R("FL avail:", fl.avail); | ||
| 1784 | R("FL PIDX:", fl.pidx); | ||
| 1785 | R("FL CIDX:", fl.cidx); | ||
| 1786 | } else if (ciq_idx < ciq_entries) { | ||
| 1787 | const struct sge_ofld_rxq *rx = &adap->sge.rdmaciq[ciq_idx * 4]; | ||
| 1788 | int n = min(4, adap->sge.rdmaciqs - 4 * ciq_idx); | ||
| 1789 | |||
| 1790 | S("QType:", "RDMA-CIQ"); | ||
| 1791 | R("RspQ ID:", rspq.abs_id); | ||
| 1792 | R("RspQ size:", rspq.size); | ||
| 1793 | R("RspQE size:", rspq.iqe_len); | ||
| 1794 | R("RspQ CIDX:", rspq.cidx); | ||
| 1795 | R("RspQ Gen:", rspq.gen); | ||
| 1796 | S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); | ||
| 1797 | S3("u", "Intr pktcnt:", | ||
| 1798 | adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); | ||
| 1799 | } else if (ctrl_idx < ctrl_entries) { | ||
| 1800 | const struct sge_ctrl_txq *tx = &adap->sge.ctrlq[ctrl_idx * 4]; | ||
| 1801 | int n = min(4, adap->params.nports - 4 * ctrl_idx); | ||
| 1802 | |||
| 1803 | S("QType:", "Control"); | ||
| 1804 | T("TxQ ID:", q.cntxt_id); | ||
| 1805 | T("TxQ size:", q.size); | ||
| 1806 | T("TxQ inuse:", q.in_use); | ||
| 1807 | T("TxQ CIDX:", q.cidx); | ||
| 1808 | T("TxQ PIDX:", q.pidx); | ||
| 1809 | } else if (fq_idx == 0) { | ||
| 1810 | const struct sge_rspq *evtq = &adap->sge.fw_evtq; | ||
| 1811 | |||
| 1812 | seq_printf(seq, "%-12s %16s\n", "QType:", "FW event queue"); | ||
| 1813 | seq_printf(seq, "%-12s %16u\n", "RspQ ID:", evtq->abs_id); | ||
| 1814 | seq_printf(seq, "%-12s %16u\n", "RspQ size:", evtq->size); | ||
| 1815 | seq_printf(seq, "%-12s %16u\n", "RspQE size:", evtq->iqe_len); | ||
| 1816 | seq_printf(seq, "%-12s %16u\n", "RspQ CIDX:", evtq->cidx); | ||
| 1817 | seq_printf(seq, "%-12s %16u\n", "RspQ Gen:", evtq->gen); | ||
| 1818 | seq_printf(seq, "%-12s %16u\n", "Intr delay:", | ||
| 1819 | qtimer_val(adap, evtq)); | ||
| 1820 | seq_printf(seq, "%-12s %16u\n", "Intr pktcnt:", | ||
| 1821 | adap->sge.counter_val[evtq->pktcnt_idx]); | ||
| 1822 | } | ||
| 1823 | #undef R | ||
| 1824 | #undef T | ||
| 1825 | #undef S | ||
| 1826 | #undef S3 | ||
| 1827 | return 0; | ||
| 1828 | } | ||
| 1829 | |||
| 1830 | static int sge_queue_entries(const struct adapter *adap) | ||
| 1831 | { | ||
| 1832 | return DIV_ROUND_UP(adap->sge.ethqsets, 4) + | ||
| 1833 | DIV_ROUND_UP(adap->sge.ofldqsets, 4) + | ||
| 1834 | DIV_ROUND_UP(adap->sge.rdmaqs, 4) + | ||
| 1835 | DIV_ROUND_UP(adap->sge.rdmaciqs, 4) + | ||
| 1836 | DIV_ROUND_UP(MAX_CTRL_QUEUES, 4) + 1; | ||
| 1837 | } | ||
| 1838 | |||
| 1839 | static void *sge_queue_start(struct seq_file *seq, loff_t *pos) | ||
| 1840 | { | ||
| 1841 | int entries = sge_queue_entries(seq->private); | ||
| 1842 | |||
| 1843 | return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL; | ||
| 1844 | } | ||
| 1845 | |||
| 1846 | static void sge_queue_stop(struct seq_file *seq, void *v) | ||
| 1847 | { | ||
| 1848 | } | ||
| 1849 | |||
| 1850 | static void *sge_queue_next(struct seq_file *seq, void *v, loff_t *pos) | ||
| 1851 | { | ||
| 1852 | int entries = sge_queue_entries(seq->private); | ||
| 1853 | |||
| 1854 | ++*pos; | ||
| 1855 | return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL; | ||
| 1856 | } | ||
| 1857 | |||
| 1858 | static const struct seq_operations sge_qinfo_seq_ops = { | ||
| 1859 | .start = sge_queue_start, | ||
| 1860 | .next = sge_queue_next, | ||
| 1861 | .stop = sge_queue_stop, | ||
| 1862 | .show = sge_qinfo_show | ||
| 1863 | }; | ||
| 1864 | |||
| 1865 | static int sge_qinfo_open(struct inode *inode, struct file *file) | ||
| 1866 | { | ||
| 1867 | int res = seq_open(file, &sge_qinfo_seq_ops); | ||
| 1868 | |||
| 1869 | if (!res) { | ||
| 1870 | struct seq_file *seq = file->private_data; | ||
| 1871 | |||
| 1872 | seq->private = inode->i_private; | ||
| 1873 | } | ||
| 1874 | return res; | ||
| 1875 | } | ||
| 1876 | |||
| 1877 | static const struct file_operations sge_qinfo_debugfs_fops = { | ||
| 1878 | .owner = THIS_MODULE, | ||
| 1879 | .open = sge_qinfo_open, | ||
| 1880 | .read = seq_read, | ||
| 1881 | .llseek = seq_lseek, | ||
| 1882 | .release = seq_release, | ||
| 1883 | }; | ||
| 1884 | |||
| 1885 | int mem_open(struct inode *inode, struct file *file) | ||
| 1886 | { | ||
| 1887 | unsigned int mem; | ||
| 1888 | struct adapter *adap; | ||
| 1889 | |||
| 1890 | file->private_data = inode->i_private; | ||
| 1891 | |||
| 1892 | mem = (uintptr_t)file->private_data & 0x3; | ||
| 1893 | adap = file->private_data - mem; | ||
| 1894 | |||
| 1895 | (void)t4_fwcache(adap, FW_PARAM_DEV_FWCACHE_FLUSH); | ||
| 1896 | |||
| 1897 | return 0; | ||
| 1898 | } | ||
| 1899 | |||
| 46 | static ssize_t mem_read(struct file *file, char __user *buf, size_t count, | 1900 | static ssize_t mem_read(struct file *file, char __user *buf, size_t count, |
| 47 | loff_t *ppos) | 1901 | loff_t *ppos) |
| 48 | { | 1902 | { |
| @@ -80,7 +1934,6 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, · 31 unmodified lines | |||
| 80 | *ppos = pos + count; | 1934 | *ppos = pos + count; |
| 81 | return count; | 1935 | return count; |
| 82 | } | 1936 | } |
| 83 | |||
| 84 | static const struct file_operations mem_debugfs_fops = { | 1937 | static const struct file_operations mem_debugfs_fops = { |
| 85 | .owner = THIS_MODULE, | 1938 | .owner = THIS_MODULE, |
| 86 | .open = simple_open, | 1939 | .open = simple_open, |
| @@ -88,6 +1941,12 @@ static const struct file_operations mem_debugfs_fops = { · 1 unmodified line | |||
| 88 | .llseek = default_llseek, | 1941 | .llseek = default_llseek, |
| 89 | }; | 1942 | }; |
| 90 | 1943 | ||
| 1944 | static void set_debugfs_file_size(struct dentry *de, loff_t size) | ||
| 1945 | { | ||
| 1946 | if (!IS_ERR(de) && de->d_inode) | ||
| 1947 | de->d_inode->i_size = size; | ||
| 1948 | } | ||
| 1949 | |||
| 91 | static void add_debugfs_mem(struct adapter *adap, const char *name, | 1950 | static void add_debugfs_mem(struct adapter *adap, const char *name, |
| 92 | unsigned int idx, unsigned int size_mb) | 1951 | unsigned int idx, unsigned int size_mb) |
| 93 | { | 1952 | { |
| @@ -119,14 +1978,65 @@ int t4_setup_debugfs(struct adapter *adap) · 25 unmodified lines | |||
| 119 | { | 1978 | { |
| 120 | int i; | 1979 | int i; |
| 121 | u32 size; | 1980 | u32 size; |
| 1981 | struct dentry *de; | ||
| 122 | 1982 | ||
| 123 | static struct t4_debugfs_entry t4_debugfs_files[] = { | 1983 | static struct t4_debugfs_entry t4_debugfs_files[] = { |
| 1984 | { "cim_la", &cim_la_fops, S_IRUSR, 0 }, | ||
| 1985 | { "cim_qcfg", &cim_qcfg_fops, S_IRUSR, 0 }, | ||
| 1986 | { "clk", &clk_debugfs_fops, S_IRUSR, 0 }, | ||
| 1987 | { "devlog", &devlog_fops, S_IRUSR, 0 }, | ||
| 1988 | { "mbox0", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 0 }, | ||
| 1989 | { "mbox1", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 1 }, | ||
| 1990 | { "mbox2", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 2 }, | ||
| 1991 | { "mbox3", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 3 }, | ||
| 1992 | { "mbox4", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 4 }, | ||
| 1993 | { "mbox5", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 5 }, | ||
| 1994 | { "mbox6", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 6 }, | ||
| 1995 | { "mbox7", &mbox_debugfs_fops, S_IRUSR | S_IWUSR, 7 }, | ||
| 124 | { "l2t", &t4_l2t_fops, S_IRUSR, 0}, | 1996 | { "l2t", &t4_l2t_fops, S_IRUSR, 0}, |
| 1997 | { "mps_tcam", &mps_tcam_debugfs_fops, S_IRUSR, 0 }, | ||
| 1998 | { "rss", &rss_debugfs_fops, S_IRUSR, 0 }, | ||
| 1999 | { "rss_config", &rss_config_debugfs_fops, S_IRUSR, 0 }, | ||
| 2000 | { "rss_key", &rss_key_debugfs_fops, S_IRUSR, 0 }, | ||
| 2001 | { "rss_pf_config", &rss_pf_config_debugfs_fops, S_IRUSR, 0 }, | ||
| 2002 | { "rss_vf_config", &rss_vf_config_debugfs_fops, S_IRUSR, 0 }, | ||
| 2003 | { "sge_qinfo", &sge_qinfo_debugfs_fops, S_IRUSR, 0 }, | ||
| 2004 | { "ibq_tp0", &cim_ibq_fops, S_IRUSR, 0 }, | ||
| 2005 | { "ibq_tp1", &cim_ibq_fops, S_IRUSR, 1 }, | ||
| 2006 | { "ibq_ulp", &cim_ibq_fops, S_IRUSR, 2 }, | ||
| 2007 | { "ibq_sge0", &cim_ibq_fops, S_IRUSR, 3 }, | ||
| 2008 | { "ibq_sge1", &cim_ibq_fops, S_IRUSR, 4 }, | ||
| 2009 | { "ibq_ncsi", &cim_ibq_fops, S_IRUSR, 5 }, | ||
| 2010 | { "obq_ulp0", &cim_obq_fops, S_IRUSR, 0 }, | ||
| 2011 | { "obq_ulp1", &cim_obq_fops, S_IRUSR, 1 }, | ||
| 2012 | { "obq_ulp2", &cim_obq_fops, S_IRUSR, 2 }, | ||
| 2013 | { "obq_ulp3", &cim_obq_fops, S_IRUSR, 3 }, | ||
| 2014 | { "obq_sge", &cim_obq_fops, S_IRUSR, 4 }, | ||
| 2015 | { "obq_ncsi", &cim_obq_fops, S_IRUSR, 5 }, | ||
| 2016 | { "tp_la", &tp_la_fops, S_IRUSR, 0 }, | ||
| 2017 | { "ulprx_la", &ulprx_la_fops, S_IRUSR, 0 }, | ||
| 2018 | { "sensors", &sensors_debugfs_fops, S_IRUSR, 0 }, | ||
| 2019 | { "pm_stats", &pm_stats_debugfs_fops, S_IRUSR, 0 }, | ||
| 2020 | { "cctrl", &cctrl_tbl_debugfs_fops, S_IRUSR, 0 }, | ||
| 2021 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 2022 | { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, | ||
| 2023 | #endif | ||
| 2024 | }; | ||
| 2025 | |||
| 2026 | /* Debug FS nodes common to all T5 and later adapters. | ||
| 2027 | */ | ||
| 2028 | static struct t4_debugfs_entry t5_debugfs_files[] = { | ||
| 2029 | { "obq_sge_rx_q0", &cim_obq_fops, S_IRUSR, 6 }, | ||
| 2030 | { "obq_sge_rx_q1", &cim_obq_fops, S_IRUSR, 7 }, | ||
| 125 | }; | 2031 | }; |
| 126 | 2032 | ||
| 127 | add_debugfs_files(adap, | 2033 | add_debugfs_files(adap, |
| 128 | t4_debugfs_files, | 2034 | t4_debugfs_files, |
| 129 | ARRAY_SIZE(t4_debugfs_files)); | 2035 | ARRAY_SIZE(t4_debugfs_files)); |
| 2036 | if (!is_t4(adap->params.chip)) | ||
| 2037 | add_debugfs_files(adap, | ||
| 2038 | t5_debugfs_files, | ||
| 2039 | ARRAY_SIZE(t5_debugfs_files)); | ||
| 130 | 2040 | ||
| 131 | i = t4_read_reg(adap, MA_TARGET_MEM_ENABLE_A); | 2041 | i = t4_read_reg(adap, MA_TARGET_MEM_ENABLE_A); |
| 132 | if (i & EDRAM0_ENABLE_F) { | 2042 | if (i & EDRAM0_ENABLE_F) { |
| @@ -154,5 +2064,10 @@ int t4_setup_debugfs(struct adapter *adap) · 21 unmodified lines | |||
| 154 | EXT_MEM1_SIZE_G(size)); | 2064 | EXT_MEM1_SIZE_G(size)); |
| 155 | } | 2065 | } |
| 156 | } | 2066 | } |
| 2067 | |||
| 2068 | de = debugfs_create_file("flash", S_IRUSR, adap->debugfs_root, adap, | ||
| 2069 | &flash_debugfs_fops); | ||
| 2070 | set_debugfs_file_size(de, adap->params.sf_size); | ||
| 2071 | |||
| 157 | return 0; | 2072 | return 0; |
| 158 | } | 2073 | } |
| @@ -37,6 +37,21 @@ · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | #include <linux/export.h> | 38 | #include <linux/export.h> |
| 39 | 39 | ||
| 40 | #define FILE_DATA(_file) ((_file)->f_path.dentry->d_inode) | ||
| 41 | |||
| 42 | #define DEFINE_SIMPLE_DEBUGFS_FILE(name) \ | ||
| 43 | static int name##_open(struct inode *inode, struct file *file) \ | ||
| 44 | { \ | ||
| 45 | return single_open(file, name##_show, inode->i_private); \ | ||
| 46 | } \ | ||
| 47 | static const struct file_operations name##_debugfs_fops = { \ | ||
| 48 | .owner = THIS_MODULE, \ | ||
| 49 | .open = name##_open, \ | ||
| 50 | .read = seq_read, \ | ||
| 51 | .llseek = seq_lseek, \ | ||
| 52 | .release = single_release \ | ||
| 53 | } | ||
| 54 | |||
| 40 | struct t4_debugfs_entry { | 55 | struct t4_debugfs_entry { |
| 41 | const char *name; | 56 | const char *name; |
| 42 | const struct file_operations *ops; | 57 | const struct file_operations *ops; |
| @@ -44,9 +59,27 @@ struct t4_debugfs_entry { · 1 unmodified line | |||
| 44 | unsigned char data; | 59 | unsigned char data; |
| 45 | }; | 60 | }; |
| 46 | 61 | ||
| 62 | struct seq_tab { | ||
| 63 | int (*show)(struct seq_file *seq, void *v, int idx); | ||
| 64 | unsigned int rows; /* # of entries */ | ||
| 65 | unsigned char width; /* size in bytes of each entry */ | ||
| 66 | unsigned char skip_first; /* whether the first line is a header */ | ||
| 67 | char data[0]; /* the table data */ | ||
| 68 | }; | ||
| 69 | |||
| 70 | static inline unsigned int hex2val(char c) | ||
| 71 | { | ||
| 72 | return isdigit(c) ? c - '0' : tolower(c) - 'a' + 10; | ||
| 73 | } | ||
| 74 | |||
| 75 | struct seq_tab *seq_open_tab(struct file *f, unsigned int rows, | ||
| 76 | unsigned int width, unsigned int have_header, | ||
| 77 | int (*show)(struct seq_file *seq, void *v, int i)); | ||
| 78 | |||
| 47 | int t4_setup_debugfs(struct adapter *adap); | 79 | int t4_setup_debugfs(struct adapter *adap); |
| 48 | void add_debugfs_files(struct adapter *adap, | 80 | void add_debugfs_files(struct adapter *adap, |
| 49 | struct t4_debugfs_entry *files, | 81 | struct t4_debugfs_entry *files, |
| 50 | unsigned int nfiles); | 82 | unsigned int nfiles); |
| 83 | int mem_open(struct inode *inode, struct file *file); | ||
| 51 | 84 | ||
| 52 | #endif | 85 | #endif |
| @@ -62,14 +62,18 @@ · 61 unmodified lines | |||
| 62 | #include <net/netevent.h> | 62 | #include <net/netevent.h> |
| 63 | #include <net/addrconf.h> | 63 | #include <net/addrconf.h> |
| 64 | #include <net/bonding.h> | 64 | #include <net/bonding.h> |
| 65 | #include <net/addrconf.h> | ||
| 65 | #include <asm/uaccess.h> | 66 | #include <asm/uaccess.h> |
| 66 | 67 | ||
| 67 | #include "cxgb4.h" | 68 | #include "cxgb4.h" |
| 68 | #include "t4_regs.h" | 69 | #include "t4_regs.h" |
| 70 | #include "t4_values.h" | ||
| 69 | #include "t4_msg.h" | 71 | #include "t4_msg.h" |
| 70 | #include "t4fw_api.h" | 72 | #include "t4fw_api.h" |
| 73 | #include "t4fw_version.h" | ||
| 71 | #include "cxgb4_dcb.h" | 74 | #include "cxgb4_dcb.h" |
| 72 | #include "cxgb4_debugfs.h" | 75 | #include "cxgb4_debugfs.h" |
| 76 | #include "clip_tbl.h" | ||
| 73 | #include "l2t.h" | 77 | #include "l2t.h" |
| 74 | 78 | ||
| 75 | #ifdef DRV_VERSION | 79 | #ifdef DRV_VERSION |
| @@ -78,99 +82,6 @@ · 2 unmodified lines | |||
| 78 | #define DRV_VERSION "2.0.0-ko" | 82 | #define DRV_VERSION "2.0.0-ko" |
| 79 | #define DRV_DESC "Chelsio T4/T5 Network Driver" | 83 | #define DRV_DESC "Chelsio T4/T5 Network Driver" |
| 80 | 84 | ||
| 81 | /* | ||
| 82 | * Max interrupt hold-off timer value in us. Queues fall back to this value | ||
| 83 | * under extreme memory pressure so it's largish to give the system time to | ||
| 84 | * recover. | ||
| 85 | */ | ||
| 86 | #define MAX_SGE_TIMERVAL 200U | ||
| 87 | |||
| 88 | enum { | ||
| 89 | /* | ||
| 90 | * Physical Function provisioning constants. | ||
| 91 | */ | ||
| 92 | PFRES_NVI = 4, /* # of Virtual Interfaces */ | ||
| 93 | PFRES_NETHCTRL = 128, /* # of EQs used for ETH or CTRL Qs */ | ||
| 94 | PFRES_NIQFLINT = 128, /* # of ingress Qs/w Free List(s)/intr | ||
| 95 | */ | ||
| 96 | PFRES_NEQ = 256, /* # of egress queues */ | ||
| 97 | PFRES_NIQ = 0, /* # of ingress queues */ | ||
| 98 | PFRES_TC = 0, /* PCI-E traffic class */ | ||
| 99 | PFRES_NEXACTF = 128, /* # of exact MPS filters */ | ||
| 100 | |||
| 101 | PFRES_R_CAPS = FW_CMD_CAP_PF, | ||
| 102 | PFRES_WX_CAPS = FW_CMD_CAP_PF, | ||
| 103 | |||
| 104 | #ifdef CONFIG_PCI_IOV | ||
| 105 | /* | ||
| 106 | * Virtual Function provisioning constants. We need two extra Ingress | ||
| 107 | * Queues with Interrupt capability to serve as the VF's Firmware | ||
| 108 | * Event Queue and Forwarded Interrupt Queue (when using MSI mode) -- | ||
| 109 | * neither will have Free Lists associated with them). For each | ||
| 110 | * Ethernet/Control Egress Queue and for each Free List, we need an | ||
| 111 | * Egress Context. | ||
| 112 | */ | ||
| 113 | VFRES_NPORTS = 1, /* # of "ports" per VF */ | ||
| 114 | VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */ | ||
| 115 | |||
| 116 | VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */ | ||
| 117 | VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */ | ||
| 118 | VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */ | ||
| 119 | VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */ | ||
| 120 | VFRES_NIQ = 0, /* # of non-fl/int ingress queues */ | ||
| 121 | VFRES_TC = 0, /* PCI-E traffic class */ | ||
| 122 | VFRES_NEXACTF = 16, /* # of exact MPS filters */ | ||
| 123 | |||
| 124 | VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT, | ||
| 125 | VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF, | ||
| 126 | #endif | ||
| 127 | }; | ||
| 128 | |||
| 129 | /* | ||
| 130 | * Provide a Port Access Rights Mask for the specified PF/VF. This is very | ||
| 131 | * static and likely not to be useful in the long run. We really need to | ||
| 132 | * implement some form of persistent configuration which the firmware | ||
| 133 | * controls. | ||
| 134 | */ | ||
| 135 | static unsigned int pfvfres_pmask(struct adapter *adapter, | ||
| 136 | unsigned int pf, unsigned int vf) | ||
| 137 | { | ||
| 138 | unsigned int portn, portvec; | ||
| 139 | |||
| 140 | /* | ||
| 141 | * Give PF's access to all of the ports. | ||
| 142 | */ | ||
| 143 | if (vf == 0) | ||
| 144 | return FW_PFVF_CMD_PMASK_M; | ||
| 145 | |||
| 146 | /* | ||
| 147 | * For VFs, we'll assign them access to the ports based purely on the | ||
| 148 | * PF. We assign active ports in order, wrapping around if there are | ||
| 149 | * fewer active ports than PFs: e.g. active port[pf % nports]. | ||
| 150 | * Unfortunately the adapter's port_info structs haven't been | ||
| 151 | * initialized yet so we have to compute this. | ||
| 152 | */ | ||
| 153 | if (adapter->params.nports == 0) | ||
| 154 | return 0; | ||
| 155 | |||
| 156 | portn = pf % adapter->params.nports; | ||
| 157 | portvec = adapter->params.portvec; | ||
| 158 | for (;;) { | ||
| 159 | /* | ||
| 160 | * Isolate the lowest set bit in the port vector. If we're at | ||
| 161 | * the port number that we want, return that as the pmask. | ||
| 162 | * otherwise mask that bit out of the port vector and | ||
| 163 | * decrement our port number ... | ||
| 164 | */ | ||
| 165 | unsigned int pmask = portvec ^ (portvec & (portvec-1)); | ||
| 166 | if (portn == 0) | ||
| 167 | return pmask; | ||
| 168 | portn--; | ||
| 169 | portvec &= ~pmask; | ||
| 170 | } | ||
| 171 | /*NOTREACHED*/ | ||
| 172 | } | ||
| 173 | |||
| 174 | enum { | 85 | enum { |
| 175 | MAX_TXQ_ENTRIES = 16384, | 86 | MAX_TXQ_ENTRIES = 16384, |
| 176 | MAX_CTRL_TXQ_ENTRIES = 1024, | 87 | MAX_CTRL_TXQ_ENTRIES = 1024, |
| @@ -263,7 +174,8 @@ MODULE_PARM_DESC(force_init, "Forcibly become Master PF and initialize adapter") · 86 unmodified lines | |||
| 263 | static uint force_old_init; | 174 | static uint force_old_init; |
| 264 | 175 | ||
| 265 | module_param(force_old_init, uint, 0644); | 176 | module_param(force_old_init, uint, 0644); |
| 266 | MODULE_PARM_DESC(force_old_init, "Force old initialization sequence"); | 177 | MODULE_PARM_DESC(force_old_init, "Force old initialization sequence, deprecated" |
| 178 | " parameter"); | ||
| 267 | 179 | ||
| 268 | static int dflt_msg_enable = DFLT_MSG_ENABLE; | 180 | static int dflt_msg_enable = DFLT_MSG_ENABLE; |
| 269 | 181 | ||
| @@ -292,13 +204,14 @@ static unsigned int intr_holdoff[SGE_NTIMERS - 1] = { 5, 10, 20, 50, 100 }; · 22 unmodified lines | |||
| 292 | 204 | ||
| 293 | module_param_array(intr_holdoff, uint, NULL, 0644); | 205 | module_param_array(intr_holdoff, uint, NULL, 0644); |
| 294 | MODULE_PARM_DESC(intr_holdoff, "values for queue interrupt hold-off timers " | 206 | MODULE_PARM_DESC(intr_holdoff, "values for queue interrupt hold-off timers " |
| 295 | "0..4 in microseconds"); | 207 | "0..4 in microseconds, deprecated parameter"); |
| 296 | 208 | ||
| 297 | static unsigned int intr_cnt[SGE_NCOUNTERS - 1] = { 4, 8, 16 }; | 209 | static unsigned int intr_cnt[SGE_NCOUNTERS - 1] = { 4, 8, 16 }; |
| 298 | 210 | ||
| 299 | module_param_array(intr_cnt, uint, NULL, 0644); | 211 | module_param_array(intr_cnt, uint, NULL, 0644); |
| 300 | MODULE_PARM_DESC(intr_cnt, | 212 | MODULE_PARM_DESC(intr_cnt, |
| 301 | "thresholds 1..3 for queue interrupt packet counters"); | 213 | "thresholds 1..3 for queue interrupt packet counters, " |
| 214 | "deprecated parameter"); | ||
| 302 | 215 | ||
| 303 | /* | 216 | /* |
| 304 | * Normally we tell the chip to deliver Ingress Packets into our DMA buffers | 217 | * Normally we tell the chip to deliver Ingress Packets into our DMA buffers |
| @@ -318,7 +231,8 @@ static bool vf_acls; · 13 unmodified lines | |||
| 318 | 231 | ||
| 319 | #ifdef CONFIG_PCI_IOV | 232 | #ifdef CONFIG_PCI_IOV |
| 320 | module_param(vf_acls, bool, 0644); | 233 | module_param(vf_acls, bool, 0644); |
| 321 | MODULE_PARM_DESC(vf_acls, "if set enable virtualization L2 ACL enforcement"); | 234 | MODULE_PARM_DESC(vf_acls, "if set enable virtualization L2 ACL enforcement, " |
| 235 | "deprecated parameter"); | ||
| 322 | 236 | ||
| 323 | /* Configure the number of PCI-E Virtual Function which are to be instantiated | 237 | /* Configure the number of PCI-E Virtual Function which are to be instantiated |
| 324 | * on SR-IOV Capable Physical Functions. | 238 | * on SR-IOV Capable Physical Functions. |
| @@ -340,32 +254,11 @@ module_param(select_queue, int, 0644); · 15 unmodified lines | |||
| 340 | MODULE_PARM_DESC(select_queue, | 254 | MODULE_PARM_DESC(select_queue, |
| 341 | "Select between kernel provided method of selecting or driver method of selecting TX queue. Default is kernel method."); | 255 | "Select between kernel provided method of selecting or driver method of selecting TX queue. Default is kernel method."); |
| 342 | 256 | ||
| 343 | /* | 257 | static unsigned int tp_vlan_pri_map = HW_TPL_FR_MT_PR_IV_P_FC; |
| 344 | * The filter TCAM has a fixed portion and a variable portion. The fixed | ||
| 345 | * portion can match on source/destination IP IPv4/IPv6 addresses and TCP/UDP | ||
| 346 | * ports. The variable portion is 36 bits which can include things like Exact | ||
| 347 | * Match MAC Index (9 bits), Ether Type (16 bits), IP Protocol (8 bits), | ||
| 348 | * [Inner] VLAN Tag (17 bits), etc. which, if all were somehow selected, would | ||
| 349 | * far exceed the 36-bit budget for this "compressed" header portion of the | ||
| 350 | * filter. Thus, we have a scarce resource which must be carefully managed. | ||
| 351 | * | ||
| 352 | * By default we set this up to mostly match the set of filter matching | ||
| 353 | * capabilities of T3 but with accommodations for some of T4's more | ||
| 354 | * interesting features: | ||
| 355 | * | ||
| 356 | * { IP Fragment (1), MPS Match Type (3), IP Protocol (8), | ||
| 357 | * [Inner] VLAN (17), Port (3), FCoE (1) } | ||
| 358 | */ | ||
| 359 | enum { | ||
| 360 | TP_VLAN_PRI_MAP_DEFAULT = HW_TPL_FR_MT_PR_IV_P_FC, | ||
| 361 | TP_VLAN_PRI_MAP_FIRST = FCOE_SHIFT, | ||
| 362 | TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_SHIFT, | ||
| 363 | }; | ||
| 364 | |||
| 365 | static unsigned int tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT; | ||
| 366 | 258 | ||
| 367 | module_param(tp_vlan_pri_map, uint, 0644); | 259 | module_param(tp_vlan_pri_map, uint, 0644); |
| 368 | MODULE_PARM_DESC(tp_vlan_pri_map, "global compressed filter configuration"); | 260 | MODULE_PARM_DESC(tp_vlan_pri_map, "global compressed filter configuration, " |
| 261 | "deprecated parameter"); | ||
| 369 | 262 | ||
| 370 | static struct dentry *cxgb4_debugfs_root; | 263 | static struct dentry *cxgb4_debugfs_root; |
| 371 | 264 | ||
| @@ -671,7 +564,7 @@ static void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl) · 299 unmodified lines | |||
| 671 | if (idx >= adap->tids.ftid_base && nidx < | 564 | if (idx >= adap->tids.ftid_base && nidx < |
| 672 | (adap->tids.nftids + adap->tids.nsftids)) { | 565 | (adap->tids.nftids + adap->tids.nsftids)) { |
| 673 | idx = nidx; | 566 | idx = nidx; |
| 674 | ret = GET_TCB_COOKIE(rpl->cookie); | 567 | ret = TCB_COOKIE_G(rpl->cookie); |
| 675 | f = &adap->tids.ftid_tab[idx]; | 568 | f = &adap->tids.ftid_tab[idx]; |
| 676 | 569 | ||
| 677 | if (ret == FW_FILTER_WR_FLT_DELETED) { | 570 | if (ret == FW_FILTER_WR_FLT_DELETED) { |
| @@ -723,7 +616,7 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, · 45 unmodified lines | |||
| 723 | 616 | ||
| 724 | if (likely(opcode == CPL_SGE_EGR_UPDATE)) { | 617 | if (likely(opcode == CPL_SGE_EGR_UPDATE)) { |
| 725 | const struct cpl_sge_egr_update *p = (void *)rsp; | 618 | const struct cpl_sge_egr_update *p = (void *)rsp; |
| 726 | unsigned int qid = EGR_QID(ntohl(p->opcode_qid)); | 619 | unsigned int qid = EGR_QID_G(ntohl(p->opcode_qid)); |
| 727 | struct sge_txq *txq; | 620 | struct sge_txq *txq; |
| 728 | 621 | ||
| 729 | txq = q->adap->sge.egr_map[qid - q->adap->sge.egr_start]; | 622 | txq = q->adap->sge.egr_map[qid - q->adap->sge.egr_start]; |
| @@ -833,11 +726,11 @@ static void disable_msi(struct adapter *adapter) · 103 unmodified lines | |||
| 833 | static irqreturn_t t4_nondata_intr(int irq, void *cookie) | 726 | static irqreturn_t t4_nondata_intr(int irq, void *cookie) |
| 834 | { | 727 | { |
| 835 | struct adapter *adap = cookie; | 728 | struct adapter *adap = cookie; |
| 729 | u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A)); | ||
| 836 | 730 | ||
| 837 | u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE)); | 731 | if (v & PFSW_F) { |
| 838 | if (v & PFSW) { | ||
| 839 | adap->swintr = 1; | 732 | adap->swintr = 1; |
| 840 | t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE), v); | 733 | t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A), v); |
| 841 | } | 734 | } |
| 842 | t4_slow_intr_handler(adap); | 735 | t4_slow_intr_handler(adap); |
| 843 | return IRQ_HANDLED; | 736 | return IRQ_HANDLED; |
| @@ -1030,8 +923,14 @@ static void quiesce_rx(struct adapter *adap) · 186 unmodified lines | |||
| 1030 | for (i = 0; i < ARRAY_SIZE(adap->sge.ingr_map); i++) { | 923 | for (i = 0; i < ARRAY_SIZE(adap->sge.ingr_map); i++) { |
| 1031 | struct sge_rspq *q = adap->sge.ingr_map[i]; | 924 | struct sge_rspq *q = adap->sge.ingr_map[i]; |
| 1032 | 925 | ||
| 1033 | if (q && q->handler) | 926 | if (q && q->handler) { |
| 1034 | napi_disable(&q->napi); | 927 | napi_disable(&q->napi); |
| 928 | local_bh_disable(); | ||
| 929 | while (!cxgb_poll_lock_napi(q)) | ||
| 930 | mdelay(1); | ||
| 931 | local_bh_enable(); | ||
| 932 | } | ||
| 933 | |||
| 1035 | } | 934 | } |
| 1036 | } | 935 | } |
| 1037 | 936 | ||
| @@ -1047,12 +946,14 @@ static void enable_rx(struct adapter *adap) · 9 unmodified lines | |||
| 1047 | 946 | ||
| 1048 | if (!q) | 947 | if (!q) |
| 1049 | continue; | 948 | continue; |
| 1050 | if (q->handler) | 949 | if (q->handler) { |
| 950 | cxgb_busy_poll_init_lock(q); | ||
| 1051 | napi_enable(&q->napi); | 951 | napi_enable(&q->napi); |
| 952 | } | ||
| 1052 | /* 0-increment GTS to start the timer and enable interrupts */ | 953 | /* 0-increment GTS to start the timer and enable interrupts */ |
| 1053 | t4_write_reg(adap, MYPF_REG(SGE_PF_GTS), | 954 | t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A), |
| 1054 | SEINTARM(q->intr_params) | | 955 | SEINTARM_V(q->intr_params) | |
| 1055 | INGRESSQID(q->cntxt_id)); | 956 | INGRESSQID_V(q->cntxt_id)); |
| 1056 | } | 957 | } |
| 1057 | } | 958 | } |
| 1058 | 959 | ||
| @@ -1176,10 +1077,10 @@ freeout: t4_free_sge_resources(adap); · 117 unmodified lines | |||
| 1176 | } | 1077 | } |
| 1177 | 1078 | ||
| 1178 | t4_write_reg(adap, is_t4(adap->params.chip) ? | 1079 | t4_write_reg(adap, is_t4(adap->params.chip) ? |
| 1179 | MPS_TRC_RSS_CONTROL : | 1080 | MPS_TRC_RSS_CONTROL_A : |
| 1180 | MPS_T5_TRC_RSS_CONTROL, | 1081 | MPS_T5_TRC_RSS_CONTROL_A, |
| 1181 | RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) | | 1082 | RSSCONTROL_V(netdev2pinfo(adap->port[0])->tx_chan) | |
| 1182 | QUEUENUMBER(s->ethrxq[0].rspq.abs_id)); | 1083 | QUEUENUMBER_V(s->ethrxq[0].rspq.abs_id)); |
| 1183 | return 0; | 1084 | return 0; |
| 1184 | } | 1085 | } |
| 1185 | 1086 | ||
| @@ -1518,6 +1419,7 @@ static int get_eeprom_len(struct net_device *dev) · 332 unmodified lines | |||
| 1518 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1419 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 1519 | { | 1420 | { |
| 1520 | struct adapter *adapter = netdev2adap(dev); | 1421 | struct adapter *adapter = netdev2adap(dev); |
| 1422 | u32 exprom_vers; | ||
| 1521 | 1423 | ||
| 1522 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | 1424 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
| 1523 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | 1425 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| @@ -1535,6 +1437,14 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) · 11 unmodified lines | |||
| 1535 | FW_HDR_FW_VER_MINOR_G(adapter->params.tp_vers), | 1437 | FW_HDR_FW_VER_MINOR_G(adapter->params.tp_vers), |
| 1536 | FW_HDR_FW_VER_MICRO_G(adapter->params.tp_vers), | 1438 | FW_HDR_FW_VER_MICRO_G(adapter->params.tp_vers), |
| 1537 | FW_HDR_FW_VER_BUILD_G(adapter->params.tp_vers)); | 1439 | FW_HDR_FW_VER_BUILD_G(adapter->params.tp_vers)); |
| 1440 | |||
| 1441 | if (!t4_get_exprom_version(adapter, &exprom_vers)) | ||
| 1442 | snprintf(info->erom_version, sizeof(info->erom_version), | ||
| 1443 | "%u.%u.%u.%u", | ||
| 1444 | FW_HDR_FW_VER_MAJOR_G(exprom_vers), | ||
| 1445 | FW_HDR_FW_VER_MINOR_G(exprom_vers), | ||
| 1446 | FW_HDR_FW_VER_MICRO_G(exprom_vers), | ||
| 1447 | FW_HDR_FW_VER_BUILD_G(exprom_vers)); | ||
| 1538 | } | 1448 | } |
| 1539 | 1449 | ||
| 1540 | static void get_strings(struct net_device *dev, u32 stringset, u8 *data) | 1450 | static void get_strings(struct net_device *dev, u32 stringset, u8 *data) |
| @@ -1589,9 +1499,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, · 48 unmodified lines | |||
| 1589 | collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); | 1499 | collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); |
| 1590 | data += sizeof(struct queue_port_stats) / sizeof(u64); | 1500 | data += sizeof(struct queue_port_stats) / sizeof(u64); |
| 1591 | if (!is_t4(adapter->params.chip)) { | 1501 | if (!is_t4(adapter->params.chip)) { |
| 1592 | t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7)); | 1502 | t4_write_reg(adapter, SGE_STAT_CFG_A, STATSOURCE_T5_V(7)); |
| 1593 | val1 = t4_read_reg(adapter, SGE_STAT_TOTAL); | 1503 | val1 = t4_read_reg(adapter, SGE_STAT_TOTAL_A); |
| 1594 | val2 = t4_read_reg(adapter, SGE_STAT_MATCH); | 1504 | val2 = t4_read_reg(adapter, SGE_STAT_MATCH_A); |
| 1595 | *data = val1 - val2; | 1505 | *data = val1 - val2; |
| 1596 | data++; | 1506 | data++; |
| 1597 | *data = val2; | 1507 | *data = val2; |
| @@ -2608,8 +2518,8 @@ static int closest_thres(const struct sge *s, int thres) · 1010 unmodified lines | |||
| 2608 | /* | 2518 | /* |
| 2609 | * Return a queue's interrupt hold-off time in us. 0 means no timer. | 2519 | * Return a queue's interrupt hold-off time in us. 0 means no timer. |
| 2610 | */ | 2520 | */ |
| 2611 | static unsigned int qtimer_val(const struct adapter *adap, | 2521 | unsigned int qtimer_val(const struct adapter *adap, |
| 2612 | const struct sge_rspq *q) | 2522 | const struct sge_rspq *q) |
| 2613 | { | 2523 | { |
| 2614 | unsigned int idx = q->intr_params >> 1; | 2524 | unsigned int idx = q->intr_params >> 1; |
| 2615 | 2525 | ||
| @@ -3346,40 +3256,6 @@ static int tid_init(struct tid_info *t) · 730 unmodified lines | |||
| 3346 | return 0; | 3256 | return 0; |
| 3347 | } | 3257 | } |
| 3348 | 3258 | ||
| 3349 | int cxgb4_clip_get(const struct net_device *dev, | ||
| 3350 | const struct in6_addr *lip) | ||
| 3351 | { | ||
| 3352 | struct adapter *adap; | ||
| 3353 | struct fw_clip_cmd c; | ||
| 3354 | |||
| 3355 | adap = netdev2adap(dev); | ||
| 3356 | memset(&c, 0, sizeof(c)); | ||
| 3357 | c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) | | ||
| 3358 | FW_CMD_REQUEST_F | FW_CMD_WRITE_F); | ||
| 3359 | c.alloc_to_len16 = htonl(FW_CLIP_CMD_ALLOC_F | FW_LEN16(c)); | ||
| 3360 | c.ip_hi = *(__be64 *)(lip->s6_addr); | ||
| 3361 | c.ip_lo = *(__be64 *)(lip->s6_addr + 8); | ||
| 3362 | return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); | ||
| 3363 | } | ||
| 3364 | EXPORT_SYMBOL(cxgb4_clip_get); | ||
| 3365 | |||
| 3366 | int cxgb4_clip_release(const struct net_device *dev, | ||
| 3367 | const struct in6_addr *lip) | ||
| 3368 | { | ||
| 3369 | struct adapter *adap; | ||
| 3370 | struct fw_clip_cmd c; | ||
| 3371 | |||
| 3372 | adap = netdev2adap(dev); | ||
| 3373 | memset(&c, 0, sizeof(c)); | ||
| 3374 | c.op_to_write = htonl(FW_CMD_OP_V(FW_CLIP_CMD) | | ||
| 3375 | FW_CMD_REQUEST_F | FW_CMD_READ_F); | ||
| 3376 | c.alloc_to_len16 = htonl(FW_CLIP_CMD_FREE_F | FW_LEN16(c)); | ||
| 3377 | c.ip_hi = *(__be64 *)(lip->s6_addr); | ||
| 3378 | c.ip_lo = *(__be64 *)(lip->s6_addr + 8); | ||
| 3379 | return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); | ||
| 3380 | } | ||
| 3381 | EXPORT_SYMBOL(cxgb4_clip_release); | ||
| 3382 | |||
| 3383 | /** | 3259 | /** |
| 3384 | * cxgb4_create_server - create an IP server | 3260 | * cxgb4_create_server - create an IP server |
| 3385 | * @dev: the device | 3261 | * @dev: the device |
| @@ -3415,8 +3291,8 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid, · 29 unmodified lines | |||
| 3415 | req->peer_ip = htonl(0); | 3291 | req->peer_ip = htonl(0); |
| 3416 | chan = rxq_to_chan(&adap->sge, queue); | 3292 | chan = rxq_to_chan(&adap->sge, queue); |
| 3417 | req->opt0 = cpu_to_be64(TX_CHAN_V(chan)); | 3293 | req->opt0 = cpu_to_be64(TX_CHAN_V(chan)); |
| 3418 | req->opt1 = cpu_to_be64(CONN_POLICY_ASK | | 3294 | req->opt1 = cpu_to_be64(CONN_POLICY_V(CPL_CONN_POLICY_ASK) | |
| 3419 | SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); | 3295 | SYN_RSS_ENABLE_F | SYN_RSS_QUEUE_V(queue)); |
| 3420 | ret = t4_mgmt_tx(adap, skb); | 3296 | ret = t4_mgmt_tx(adap, skb); |
| 3421 | return net_xmit_eval(ret); | 3297 | return net_xmit_eval(ret); |
| 3422 | } | 3298 | } |
| @@ -3458,8 +3334,8 @@ int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, · 35 unmodified lines | |||
| 3458 | req->peer_ip_lo = cpu_to_be64(0); | 3334 | req->peer_ip_lo = cpu_to_be64(0); |
| 3459 | chan = rxq_to_chan(&adap->sge, queue); | 3335 | chan = rxq_to_chan(&adap->sge, queue); |
| 3460 | req->opt0 = cpu_to_be64(TX_CHAN_V(chan)); | 3336 | req->opt0 = cpu_to_be64(TX_CHAN_V(chan)); |
| 3461 | req->opt1 = cpu_to_be64(CONN_POLICY_ASK | | 3337 | req->opt1 = cpu_to_be64(CONN_POLICY_V(CPL_CONN_POLICY_ASK) | |
| 3462 | SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); | 3338 | SYN_RSS_ENABLE_F | SYN_RSS_QUEUE_V(queue)); |
| 3463 | ret = t4_mgmt_tx(adap, skb); | 3339 | ret = t4_mgmt_tx(adap, skb); |
| 3464 | return net_xmit_eval(ret); | 3340 | return net_xmit_eval(ret); |
| 3465 | } | 3341 | } |
| @@ -3482,8 +3358,8 @@ int cxgb4_remove_server(const struct net_device *dev, unsigned int stid, · 16 unmodified lines | |||
| 3482 | req = (struct cpl_close_listsvr_req *)__skb_put(skb, sizeof(*req)); | 3358 | req = (struct cpl_close_listsvr_req *)__skb_put(skb, sizeof(*req)); |
| 3483 | INIT_TP_WR(req, 0); | 3359 | INIT_TP_WR(req, 0); |
| 3484 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, stid)); | 3360 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, stid)); |
| 3485 | req->reply_ctrl = htons(NO_REPLY(0) | (ipv6 ? LISTSVR_IPV6(1) : | 3361 | req->reply_ctrl = htons(NO_REPLY_V(0) | (ipv6 ? LISTSVR_IPV6_V(1) : |
| 3486 | LISTSVR_IPV6(0)) | QUEUENO(queue)); | 3362 | LISTSVR_IPV6_V(0)) | QUEUENO_V(queue)); |
| 3487 | ret = t4_mgmt_tx(adap, skb); | 3363 | ret = t4_mgmt_tx(adap, skb); |
| 3488 | return net_xmit_eval(ret); | 3364 | return net_xmit_eval(ret); |
| 3489 | } | 3365 | } |
| @@ -3600,14 +3476,14 @@ unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo) · 110 unmodified lines | |||
| 3600 | struct adapter *adap = netdev2adap(dev); | 3476 | struct adapter *adap = netdev2adap(dev); |
| 3601 | u32 v1, v2, lp_count, hp_count; | 3477 | u32 v1, v2, lp_count, hp_count; |
| 3602 | 3478 | ||
| 3603 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); | 3479 | v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A); |
| 3604 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); | 3480 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A); |
| 3605 | if (is_t4(adap->params.chip)) { | 3481 | if (is_t4(adap->params.chip)) { |
| 3606 | lp_count = G_LP_COUNT(v1); | 3482 | lp_count = LP_COUNT_G(v1); |
| 3607 | hp_count = G_HP_COUNT(v1); | 3483 | hp_count = HP_COUNT_G(v1); |
| 3608 | } else { | 3484 | } else { |
| 3609 | lp_count = G_LP_COUNT_T5(v1); | 3485 | lp_count = LP_COUNT_T5_G(v1); |
| 3610 | hp_count = G_HP_COUNT_T5(v2); | 3486 | hp_count = HP_COUNT_T5_G(v2); |
| 3611 | } | 3487 | } |
| 3612 | return lpfifo ? lp_count : hp_count; | 3488 | return lpfifo ? lp_count : hp_count; |
| 3613 | } | 3489 | } |
| @@ -3653,10 +3529,10 @@ void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, · 39 unmodified lines | |||
| 3653 | { | 3529 | { |
| 3654 | struct adapter *adap = netdev2adap(dev); | 3530 | struct adapter *adap = netdev2adap(dev); |
| 3655 | 3531 | ||
| 3656 | t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK, tag_mask); | 3532 | t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK_A, tag_mask); |
| 3657 | t4_write_reg(adap, ULP_RX_ISCSI_PSZ, HPZ0(pgsz_order[0]) | | 3533 | t4_write_reg(adap, ULP_RX_ISCSI_PSZ_A, HPZ0_V(pgsz_order[0]) | |
| 3658 | HPZ1(pgsz_order[1]) | HPZ2(pgsz_order[2]) | | 3534 | HPZ1_V(pgsz_order[1]) | HPZ2_V(pgsz_order[2]) | |
| 3659 | HPZ3(pgsz_order[3])); | 3535 | HPZ3_V(pgsz_order[3])); |
| 3660 | } | 3536 | } |
| 3661 | EXPORT_SYMBOL(cxgb4_iscsi_init); | 3537 | EXPORT_SYMBOL(cxgb4_iscsi_init); |
| 3662 | 3538 | ||
| @@ -3666,14 +3542,14 @@ int cxgb4_flush_eq_cache(struct net_device *dev) · 3 unmodified lines | |||
| 3666 | int ret; | 3542 | int ret; |
| 3667 | 3543 | ||
| 3668 | ret = t4_fwaddrspace_write(adap, adap->mbox, | 3544 | ret = t4_fwaddrspace_write(adap, adap->mbox, |
| 3669 | 0xe1000000 + A_SGE_CTXT_CMD, 0x20000000); | 3545 | 0xe1000000 + SGE_CTXT_CMD_A, 0x20000000); |
| 3670 | return ret; | 3546 | return ret; |
| 3671 | } | 3547 | } |
| 3672 | EXPORT_SYMBOL(cxgb4_flush_eq_cache); | 3548 | EXPORT_SYMBOL(cxgb4_flush_eq_cache); |
| 3673 | 3549 | ||
| 3674 | static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx) | 3550 | static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx) |
| 3675 | { | 3551 | { |
| 3676 | u32 addr = t4_read_reg(adap, A_SGE_DBQ_CTXT_BADDR) + 24 * qid + 8; | 3552 | u32 addr = t4_read_reg(adap, SGE_DBQ_CTXT_BADDR_A) + 24 * qid + 8; |
| 3677 | __be64 indices; | 3553 | __be64 indices; |
| 3678 | int ret; | 3554 | int ret; |
| 3679 | 3555 | ||
| @@ -3702,14 +3578,20 @@ int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, · 22 unmodified lines | |||
| 3702 | 3578 | ||
| 3703 | if (pidx != hw_pidx) { | 3579 | if (pidx != hw_pidx) { |
| 3704 | u16 delta; | 3580 | u16 delta; |
| 3581 | u32 val; | ||
| 3705 | 3582 | ||
| 3706 | if (pidx >= hw_pidx) | 3583 | if (pidx >= hw_pidx) |
| 3707 | delta = pidx - hw_pidx; | 3584 | delta = pidx - hw_pidx; |
| 3708 | else | 3585 | else |
| 3709 | delta = size - hw_pidx + pidx; | 3586 | delta = size - hw_pidx + pidx; |
| 3587 | |||
| 3588 | if (is_t4(adap->params.chip)) | ||
| 3589 | val = PIDX_V(delta); | ||
| 3590 | else | ||
| 3591 | val = PIDX_T5_V(delta); | ||
| 3710 | wmb(); | 3592 | wmb(); |
| 3711 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), | 3593 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), |
| 3712 | QID(qid) | PIDX(delta)); | 3594 | QID_V(qid) | val); |
| 3713 | } | 3595 | } |
| 3714 | out: | 3596 | out: |
| 3715 | return ret; | 3597 | return ret; |
| @@ -3721,8 +3603,8 @@ void cxgb4_disable_db_coalescing(struct net_device *dev) · 5 unmodified lines | |||
| 3721 | struct adapter *adap; | 3603 | struct adapter *adap; |
| 3722 | 3604 | ||
| 3723 | adap = netdev2adap(dev); | 3605 | adap = netdev2adap(dev); |
| 3724 | t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE, | 3606 | t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, NOCOALESCE_F, |
| 3725 | F_NOCOALESCE); | 3607 | NOCOALESCE_F); |
| 3726 | } | 3608 | } |
| 3727 | EXPORT_SYMBOL(cxgb4_disable_db_coalescing); | 3609 | EXPORT_SYMBOL(cxgb4_disable_db_coalescing); |
| 3728 | 3610 | ||
| @@ -3731,7 +3613,7 @@ void cxgb4_enable_db_coalescing(struct net_device *dev) · 2 unmodified lines | |||
| 3731 | struct adapter *adap; | 3613 | struct adapter *adap; |
| 3732 | 3614 | ||
| 3733 | adap = netdev2adap(dev); | 3615 | adap = netdev2adap(dev); |
| 3734 | t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE, 0); | 3616 | t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, NOCOALESCE_F, 0); |
| 3735 | } | 3617 | } |
| 3736 | EXPORT_SYMBOL(cxgb4_enable_db_coalescing); | 3618 | EXPORT_SYMBOL(cxgb4_enable_db_coalescing); |
| 3737 | 3619 | ||
| @@ -3809,8 +3691,8 @@ u64 cxgb4_read_sge_timestamp(struct net_device *dev) · 71 unmodified lines | |||
| 3809 | struct adapter *adap; | 3691 | struct adapter *adap; |
| 3810 | 3692 | ||
| 3811 | adap = netdev2adap(dev); | 3693 | adap = netdev2adap(dev); |
| 3812 | lo = t4_read_reg(adap, SGE_TIMESTAMP_LO); | 3694 | lo = t4_read_reg(adap, SGE_TIMESTAMP_LO_A); |
| 3813 | hi = GET_TSVAL(t4_read_reg(adap, SGE_TIMESTAMP_HI)); | 3695 | hi = TSVAL_G(t4_read_reg(adap, SGE_TIMESTAMP_HI_A)); |
| 3814 | 3696 | ||
| 3815 | return ((u64)hi << 32) | (u64)lo; | 3697 | return ((u64)hi << 32) | (u64)lo; |
| 3816 | } | 3698 | } |
| @@ -3870,14 +3752,14 @@ static void drain_db_fifo(struct adapter *adap, int usecs) · 53 unmodified lines | |||
| 3870 | u32 v1, v2, lp_count, hp_count; | 3752 | u32 v1, v2, lp_count, hp_count; |
| 3871 | 3753 | ||
| 3872 | do { | 3754 | do { |
| 3873 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); | 3755 | v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A); |
| 3874 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); | 3756 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A); |
| 3875 | if (is_t4(adap->params.chip)) { | 3757 | if (is_t4(adap->params.chip)) { |
| 3876 | lp_count = G_LP_COUNT(v1); | 3758 | lp_count = LP_COUNT_G(v1); |
| 3877 | hp_count = G_HP_COUNT(v1); | 3759 | hp_count = HP_COUNT_G(v1); |
| 3878 | } else { | 3760 | } else { |
| 3879 | lp_count = G_LP_COUNT_T5(v1); | 3761 | lp_count = LP_COUNT_T5_G(v1); |
| 3880 | hp_count = G_HP_COUNT_T5(v2); | 3762 | hp_count = HP_COUNT_T5_G(v2); |
| 3881 | } | 3763 | } |
| 3882 | 3764 | ||
| 3883 | if (lp_count == 0 && hp_count == 0) | 3765 | if (lp_count == 0 && hp_count == 0) |
| @@ -3904,8 +3786,8 @@ static void enable_txq_db(struct adapter *adap, struct sge_txq *q) · 20 unmodified lines | |||
| 3904 | * are committed before we tell HW about them. | 3786 | * are committed before we tell HW about them. |
| 3905 | */ | 3787 | */ |
| 3906 | wmb(); | 3788 | wmb(); |
| 3907 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), | 3789 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), |
| 3908 | QID(q->cntxt_id) | PIDX(q->db_pidx_inc)); | 3790 | QID_V(q->cntxt_id) | PIDX_V(q->db_pidx_inc)); |
| 3909 | q->db_pidx_inc = 0; | 3791 | q->db_pidx_inc = 0; |
| 3910 | } | 3792 | } |
| 3911 | q->db_disabled = 0; | 3793 | q->db_disabled = 0; |
| @@ -3952,9 +3834,9 @@ static void process_db_full(struct work_struct *work) · 40 unmodified lines | |||
| 3952 | drain_db_fifo(adap, dbfifo_drain_delay); | 3834 | drain_db_fifo(adap, dbfifo_drain_delay); |
| 3953 | enable_dbs(adap); | 3835 | enable_dbs(adap); |
| 3954 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY); | 3836 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY); |
| 3955 | t4_set_reg_field(adap, SGE_INT_ENABLE3, | 3837 | t4_set_reg_field(adap, SGE_INT_ENABLE3_A, |
| 3956 | DBFIFO_HP_INT | DBFIFO_LP_INT, | 3838 | DBFIFO_HP_INT_F | DBFIFO_LP_INT_F, |
| 3957 | DBFIFO_HP_INT | DBFIFO_LP_INT); | 3839 | DBFIFO_HP_INT_F | DBFIFO_LP_INT_F); |
| 3958 | } | 3840 | } |
| 3959 | 3841 | ||
| 3960 | static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) | 3842 | static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) |
| @@ -3968,14 +3850,20 @@ static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) · 7 unmodified lines | |||
| 3968 | goto out; | 3850 | goto out; |
| 3969 | if (q->db_pidx != hw_pidx) { | 3851 | if (q->db_pidx != hw_pidx) { |
| 3970 | u16 delta; | 3852 | u16 delta; |
| 3853 | u32 val; | ||
| 3971 | 3854 | ||
| 3972 | if (q->db_pidx >= hw_pidx) | 3855 | if (q->db_pidx >= hw_pidx) |
| 3973 | delta = q->db_pidx - hw_pidx; | 3856 | delta = q->db_pidx - hw_pidx; |
| 3974 | else | 3857 | else |
| 3975 | delta = q->size - hw_pidx + q->db_pidx; | 3858 | delta = q->size - hw_pidx + q->db_pidx; |
| 3859 | |||
| 3860 | if (is_t4(adap->params.chip)) | ||
| 3861 | val = PIDX_V(delta); | ||
| 3862 | else | ||
| 3863 | val = PIDX_T5_V(delta); | ||
| 3976 | wmb(); | 3864 | wmb(); |
| 3977 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), | 3865 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), |
| 3978 | QID(q->cntxt_id) | PIDX(delta)); | 3866 | QID_V(q->cntxt_id) | val); |
| 3979 | } | 3867 | } |
| 3980 | out: | 3868 | out: |
| 3981 | q->db_disabled = 0; | 3869 | q->db_disabled = 0; |
| @@ -4024,14 +3912,14 @@ static void process_db_drop(struct work_struct *work) · 42 unmodified lines | |||
| 4024 | dev_err(adap->pdev_dev, "doorbell drop recovery: " | 3912 | dev_err(adap->pdev_dev, "doorbell drop recovery: " |
| 4025 | "qid=%d, pidx_inc=%d\n", qid, pidx_inc); | 3913 | "qid=%d, pidx_inc=%d\n", qid, pidx_inc); |
| 4026 | else | 3914 | else |
| 4027 | writel(PIDX_T5(pidx_inc) | QID(bar2_qid), | 3915 | writel(PIDX_T5_V(pidx_inc) | QID_V(bar2_qid), |
| 4028 | adap->bar2 + bar2_qoffset + SGE_UDB_KDOORBELL); | 3916 | adap->bar2 + bar2_qoffset + SGE_UDB_KDOORBELL); |
| 4029 | 3917 | ||
| 4030 | /* Re-enable BAR2 WC */ | 3918 | /* Re-enable BAR2 WC */ |
| 4031 | t4_set_reg_field(adap, 0x10b0, 1<<15, 1<<15); | 3919 | t4_set_reg_field(adap, 0x10b0, 1<<15, 1<<15); |
| 4032 | } | 3920 | } |
| 4033 | 3921 | ||
| 4034 | t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_DROPPED_DB, 0); | 3922 | t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, DROPPED_DB_F, 0); |
| 4035 | } | 3923 | } |
| 4036 | 3924 | ||
| 4037 | void t4_db_full(struct adapter *adap) | 3925 | void t4_db_full(struct adapter *adap) |
| @@ -4039,8 +3927,8 @@ void t4_db_full(struct adapter *adap) · 1 unmodified line | |||
| 4039 | if (is_t4(adap->params.chip)) { | 3927 | if (is_t4(adap->params.chip)) { |
| 4040 | disable_dbs(adap); | 3928 | disable_dbs(adap); |
| 4041 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); | 3929 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); |
| 4042 | t4_set_reg_field(adap, SGE_INT_ENABLE3, | 3930 | t4_set_reg_field(adap, SGE_INT_ENABLE3_A, |
| 4043 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); | 3931 | DBFIFO_HP_INT_F | DBFIFO_LP_INT_F, 0); |
| 4044 | queue_work(adap->workq, &adap->db_full_task); | 3932 | queue_work(adap->workq, &adap->db_full_task); |
| 4045 | } | 3933 | } |
| 4046 | } | 3934 | } |
| @@ -4081,7 +3969,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 34 unmodified lines | |||
| 4081 | lli.nports = adap->params.nports; | 3969 | lli.nports = adap->params.nports; |
| 4082 | lli.wr_cred = adap->params.ofldq_wr_cred; | 3970 | lli.wr_cred = adap->params.ofldq_wr_cred; |
| 4083 | lli.adapter_type = adap->params.chip; | 3971 | lli.adapter_type = adap->params.chip; |
| 4084 | lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); | 3972 | lli.iscsi_iolen = MAXRXDATA_G(t4_read_reg(adap, TP_PARA_REG2_A)); |
| 4085 | lli.cclk_ps = 1000000000 / adap->params.vpd.cclk; | 3973 | lli.cclk_ps = 1000000000 / adap->params.vpd.cclk; |
| 4086 | lli.udb_density = 1 << adap->params.sge.eq_qpp; | 3974 | lli.udb_density = 1 << adap->params.sge.eq_qpp; |
| 4087 | lli.ucq_density = 1 << adap->params.sge.iq_qpp; | 3975 | lli.ucq_density = 1 << adap->params.sge.iq_qpp; |
| @@ -4089,8 +3977,8 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 1 unmodified line | |||
| 4089 | /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */ | 3977 | /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */ |
| 4090 | for (i = 0; i < NCHAN; i++) | 3978 | for (i = 0; i < NCHAN; i++) |
| 4091 | lli.tx_modq[i] = i; | 3979 | lli.tx_modq[i] = i; |
| 4092 | lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS); | 3980 | lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS_A); |
| 4093 | lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL); | 3981 | lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL_A); |
| 4094 | lli.fw_vers = adap->params.fw_vers; | 3982 | lli.fw_vers = adap->params.fw_vers; |
| 4095 | lli.dbfifo_int_thresh = dbfifo_int_thresh; | 3983 | lli.dbfifo_int_thresh = dbfifo_int_thresh; |
| 4096 | lli.sge_ingpadboundary = adap->sge.fl_align; | 3984 | lli.sge_ingpadboundary = adap->sge.fl_align; |
| @@ -4220,148 +4108,61 @@ int cxgb4_unregister_uld(enum cxgb4_uld type) · 123 unmodified lines | |||
| 4220 | } | 4108 | } |
| 4221 | EXPORT_SYMBOL(cxgb4_unregister_uld); | 4109 | EXPORT_SYMBOL(cxgb4_unregister_uld); |
| 4222 | 4110 | ||
| 4223 | /* Check if netdev on which event is occured belongs to us or not. Return | ||
| 4224 | * success (true) if it belongs otherwise failure (false). | ||
| 4225 | * Called with rcu_read_lock() held. | ||
| 4226 | */ | ||
| 4227 | #if IS_ENABLED(CONFIG_IPV6) | 4111 | #if IS_ENABLED(CONFIG_IPV6) |
| 4228 | static bool cxgb4_netdev(const struct net_device *netdev) | 4112 | static int cxgb4_inet6addr_handler(struct notifier_block *this, |
| 4113 | unsigned long event, void *data) | ||
| 4229 | { | 4114 | { |
| 4115 | struct inet6_ifaddr *ifa = data; | ||
| 4116 | struct net_device *event_dev = ifa->idev->dev; | ||
| 4117 | const struct device *parent = NULL; | ||
| 4118 | #if IS_ENABLED(CONFIG_BONDING) | ||
| 4230 | struct adapter *adap; | 4119 | struct adapter *adap; |
| 4231 | int i; | 4120 | #endif |
| 4232 | 4121 | if (event_dev->priv_flags & IFF_802_1Q_VLAN) | |
| 4233 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) | 4122 | event_dev = vlan_dev_real_dev(event_dev); |
| 4234 | for (i = 0; i < MAX_NPORTS; i++) | 4123 | #if IS_ENABLED(CONFIG_BONDING) |
| 4235 | if (adap->port[i] == netdev) | 4124 | if (event_dev->flags & IFF_MASTER) { |
| 4236 | return true; | 4125 | list_for_each_entry(adap, &adapter_list, list_node) { |
| 4237 | return false; | 4126 | switch (event) { |
| 4238 | } | 4127 | case NETDEV_UP: |
| 4128 | cxgb4_clip_get(adap->port[0], | ||
| 4129 | (const u32 *)ifa, 1); | ||
| 4130 | break; | ||
| 4131 | case NETDEV_DOWN: | ||
| 4132 | cxgb4_clip_release(adap->port[0], | ||
| 4133 | (const u32 *)ifa, 1); | ||
| 4134 | break; | ||
| 4135 | default: | ||
| 4136 | break; | ||
| 4137 | } | ||
| 4138 | } | ||
| 4139 | return NOTIFY_OK; | ||
| 4140 | } | ||
| 4141 | #endif | ||
| 4239 | 4142 | ||
| 4240 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, | 4143 | if (event_dev) |
| 4241 | unsigned long event) | 4144 | parent = event_dev->dev.parent; |
| 4242 | { | ||
| 4243 | int ret = NOTIFY_DONE; | ||
| 4244 | 4145 | ||
| 4245 | rcu_read_lock(); | 4146 | if (parent && parent->driver == &cxgb4_driver.driver) { |
| 4246 | if (cxgb4_netdev(event_dev)) { | ||
| 4247 | switch (event) { | 4147 | switch (event) { |
| 4248 | case NETDEV_UP: | 4148 | case NETDEV_UP: |
| 4249 | ret = cxgb4_clip_get(event_dev, &ifa->addr); | 4149 | cxgb4_clip_get(event_dev, (const u32 *)ifa, 1); |
| 4250 | if (ret < 0) { | ||
| 4251 | rcu_read_unlock(); | ||
| 4252 | return ret; | ||
| 4253 | } | ||
| 4254 | ret = NOTIFY_OK; | ||
| 4255 | break; | 4150 | break; |
| 4256 | case NETDEV_DOWN: | 4151 | case NETDEV_DOWN: |
| 4257 | cxgb4_clip_release(event_dev, &ifa->addr); | 4152 | cxgb4_clip_release(event_dev, (const u32 *)ifa, 1); |
| 4258 | ret = NOTIFY_OK; | ||
| 4259 | break; | 4153 | break; |
| 4260 | default: | 4154 | default: |
| 4261 | break; | 4155 | break; |
| 4262 | } | 4156 | } |
| 4263 | } | 4157 | } |
| 4264 | rcu_read_unlock(); | 4158 | return NOTIFY_OK; |
| 4265 | return ret; | ||
| 4266 | } | ||
| 4267 | |||
| 4268 | static int cxgb4_inet6addr_handler(struct notifier_block *this, | ||
| 4269 | unsigned long event, void *data) | ||
| 4270 | { | ||
| 4271 | struct inet6_ifaddr *ifa = data; | ||
| 4272 | struct net_device *event_dev; | ||
| 4273 | int ret = NOTIFY_DONE; | ||
| 4274 | struct bonding *bond = netdev_priv(ifa->idev->dev); | ||
| 4275 | struct list_head *iter; | ||
| 4276 | struct slave *slave; | ||
| 4277 | struct pci_dev *first_pdev = NULL; | ||
| 4278 | |||
| 4279 | if (ifa->idev->dev->priv_flags & IFF_802_1Q_VLAN) { | ||
| 4280 | event_dev = vlan_dev_real_dev(ifa->idev->dev); | ||
| 4281 | ret = clip_add(event_dev, ifa, event); | ||
| 4282 | } else if (ifa->idev->dev->flags & IFF_MASTER) { | ||
| 4283 | /* It is possible that two different adapters are bonded in one | ||
| 4284 | * bond. We need to find such different adapters and add clip | ||
| 4285 | * in all of them only once. | ||
| 4286 | */ | ||
| 4287 | bond_for_each_slave(bond, slave, iter) { | ||
| 4288 | if (!first_pdev) { | ||
| 4289 | ret = clip_add(slave->dev, ifa, event); | ||
| 4290 | /* If clip_add is success then only initialize | ||
| 4291 | * first_pdev since it means it is our device | ||
| 4292 | */ | ||
| 4293 | if (ret == NOTIFY_OK) | ||
| 4294 | first_pdev = to_pci_dev( | ||
| 4295 | slave->dev->dev.parent); | ||
| 4296 | } else if (first_pdev != | ||
| 4297 | to_pci_dev(slave->dev->dev.parent)) | ||
| 4298 | ret = clip_add(slave->dev, ifa, event); | ||
| 4299 | } | ||
| 4300 | } else | ||
| 4301 | ret = clip_add(ifa->idev->dev, ifa, event); | ||
| 4302 | |||
| 4303 | return ret; | ||
| 4304 | } | 4159 | } |
| 4305 | 4160 | ||
| 4161 | static bool inet6addr_registered; | ||
| 4306 | static struct notifier_block cxgb4_inet6addr_notifier = { | 4162 | static struct notifier_block cxgb4_inet6addr_notifier = { |
| 4307 | .notifier_call = cxgb4_inet6addr_handler | 4163 | .notifier_call = cxgb4_inet6addr_handler |
| 4308 | }; | 4164 | }; |
| 4309 | 4165 | ||
| 4310 | /* Retrieves IPv6 addresses from a root device (bond, vlan) associated with | ||
| 4311 | * a physical device. | ||
| 4312 | * The physical device reference is needed to send the actul CLIP command. | ||
| 4313 | */ | ||
| 4314 | static int update_dev_clip(struct net_device *root_dev, struct net_device *dev) | ||
| 4315 | { | ||
| 4316 | struct inet6_dev *idev = NULL; | ||
| 4317 | struct inet6_ifaddr *ifa; | ||
| 4318 | int ret = 0; | ||
| 4319 | |||
| 4320 | idev = __in6_dev_get(root_dev); | ||
| 4321 | if (!idev) | ||
| 4322 | return ret; | ||
| 4323 | |||
| 4324 | read_lock_bh(&idev->lock); | ||
| 4325 | list_for_each_entry(ifa, &idev->addr_list, if_list) { | ||
| 4326 | ret = cxgb4_clip_get(dev, &ifa->addr); | ||
| 4327 | if (ret < 0) | ||
| 4328 | break; | ||
| 4329 | } | ||
| 4330 | read_unlock_bh(&idev->lock); | ||
| 4331 | |||
| 4332 | return ret; | ||
| 4333 | } | ||
| 4334 | |||
| 4335 | static int update_root_dev_clip(struct net_device *dev) | ||
| 4336 | { | ||
| 4337 | struct net_device *root_dev = NULL; | ||
| 4338 | int i, ret = 0; | ||
| 4339 | |||
| 4340 | /* First populate the real net device's IPv6 addresses */ | ||
| 4341 | ret = update_dev_clip(dev, dev); | ||
| 4342 | if (ret) | ||
| 4343 | return ret; | ||
| 4344 | |||
| 4345 | /* Parse all bond and vlan devices layered on top of the physical dev */ | ||
| 4346 | root_dev = netdev_master_upper_dev_get_rcu(dev); | ||
| 4347 | if (root_dev) { | ||
| 4348 | ret = update_dev_clip(root_dev, dev); | ||
| 4349 | if (ret) | ||
| 4350 | return ret; | ||
| 4351 | } | ||
| 4352 | |||
| 4353 | for (i = 0; i < VLAN_N_VID; i++) { | ||
| 4354 | root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i); | ||
| 4355 | if (!root_dev) | ||
| 4356 | continue; | ||
| 4357 | |||
| 4358 | ret = update_dev_clip(root_dev, dev); | ||
| 4359 | if (ret) | ||
| 4360 | break; | ||
| 4361 | } | ||
| 4362 | return ret; | ||
| 4363 | } | ||
| 4364 | |||
| 4365 | static void update_clip(const struct adapter *adap) | 4166 | static void update_clip(const struct adapter *adap) |
| 4366 | { | 4167 | { |
| 4367 | int i; | 4168 | int i; |
| @@ -4375,7 +4176,7 @@ static void update_clip(const struct adapter *adap) · 7 unmodified lines | |||
| 4375 | ret = 0; | 4176 | ret = 0; |
| 4376 | 4177 | ||
| 4377 | if (dev) | 4178 | if (dev) |
| 4378 | ret = update_root_dev_clip(dev); | 4179 | ret = cxgb4_update_root_dev_clip(dev); |
| 4379 | 4180 | ||
| 4380 | if (ret < 0) | 4181 | if (ret < 0) |
| 4381 | break; | 4182 | break; |
| @@ -4567,13 +4368,13 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, · 185 unmodified lines | |||
| 4567 | f->fs.val.lip[i] = val[i]; | 4368 | f->fs.val.lip[i] = val[i]; |
| 4568 | f->fs.mask.lip[i] = ~0; | 4369 | f->fs.mask.lip[i] = ~0; |
| 4569 | } | 4370 | } |
| 4570 | if (adap->params.tp.vlan_pri_map & F_PORT) { | 4371 | if (adap->params.tp.vlan_pri_map & PORT_F) { |
| 4571 | f->fs.val.iport = port; | 4372 | f->fs.val.iport = port; |
| 4572 | f->fs.mask.iport = mask; | 4373 | f->fs.mask.iport = mask; |
| 4573 | } | 4374 | } |
| 4574 | } | 4375 | } |
| 4575 | 4376 | ||
| 4576 | if (adap->params.tp.vlan_pri_map & F_PROTOCOL) { | 4377 | if (adap->params.tp.vlan_pri_map & PROTOCOL_F) { |
| 4577 | f->fs.val.proto = IPPROTO_TCP; | 4378 | f->fs.val.proto = IPPROTO_TCP; |
| 4578 | f->fs.mask.proto = ~0; | 4379 | f->fs.mask.proto = ~0; |
| 4579 | } | 4380 | } |
| @@ -4779,11 +4580,15 @@ static const struct net_device_ops cxgb4_netdev_ops = { · 199 unmodified lines | |||
| 4779 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4580 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 4780 | .ndo_poll_controller = cxgb_netpoll, | 4581 | .ndo_poll_controller = cxgb_netpoll, |
| 4781 | #endif | 4582 | #endif |
| 4583 | #ifdef CONFIG_NET_RX_BUSY_POLL | ||
| 4584 | .ndo_busy_poll = cxgb_busy_poll, | ||
| 4585 | #endif | ||
| 4586 | |||
| 4782 | }; | 4587 | }; |
| 4783 | 4588 | ||
| 4784 | void t4_fatal_err(struct adapter *adap) | 4589 | void t4_fatal_err(struct adapter *adap) |
| 4785 | { | 4590 | { |
| 4786 | t4_set_reg_field(adap, SGE_CONTROL, GLOBALENABLE, 0); | 4591 | t4_set_reg_field(adap, SGE_CONTROL_A, GLOBALENABLE_F, 0); |
| 4787 | t4_intr_disable(adap); | 4592 | t4_intr_disable(adap); |
| 4788 | dev_alert(adap->pdev_dev, "encountered fatal error, adapter stopped\n"); | 4593 | dev_alert(adap->pdev_dev, "encountered fatal error, adapter stopped\n"); |
| 4789 | } | 4594 | } |
| @@ -4858,16 +4663,16 @@ static void setup_memwin(struct adapter *adap) · 68 unmodified lines | |||
| 4858 | mem_win2_base = MEMWIN2_BASE_T5; | 4663 | mem_win2_base = MEMWIN2_BASE_T5; |
| 4859 | mem_win2_aperture = MEMWIN2_APERTURE_T5; | 4664 | mem_win2_aperture = MEMWIN2_APERTURE_T5; |
| 4860 | } | 4665 | } |
| 4861 | t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 0), | 4666 | t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 0), |
| 4862 | mem_win0_base | BIR(0) | | 4667 | mem_win0_base | BIR_V(0) | |
| 4863 | WINDOW(ilog2(MEMWIN0_APERTURE) - 10)); | 4668 | WINDOW_V(ilog2(MEMWIN0_APERTURE) - 10)); |
| 4864 | t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 1), | 4669 | t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 1), |
| 4865 | mem_win1_base | BIR(0) | | 4670 | mem_win1_base | BIR_V(0) | |
| 4866 | WINDOW(ilog2(MEMWIN1_APERTURE) - 10)); | 4671 | WINDOW_V(ilog2(MEMWIN1_APERTURE) - 10)); |
| 4867 | t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2), | 4672 | t4_write_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 2), |
| 4868 | mem_win2_base | BIR(0) | | 4673 | mem_win2_base | BIR_V(0) | |
| 4869 | WINDOW(ilog2(mem_win2_aperture) - 10)); | 4674 | WINDOW_V(ilog2(mem_win2_aperture) - 10)); |
| 4870 | t4_read_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2)); | 4675 | t4_read_reg(adap, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 2)); |
| 4871 | } | 4676 | } |
| 4872 | 4677 | ||
| 4873 | static void setup_memwin_rdma(struct adapter *adap) | 4678 | static void setup_memwin_rdma(struct adapter *adap) |
| @@ -4881,13 +4686,13 @@ static void setup_memwin_rdma(struct adapter *adap) · 7 unmodified lines | |||
| 4881 | start += OCQ_WIN_OFFSET(adap->pdev, &adap->vres); | 4686 | start += OCQ_WIN_OFFSET(adap->pdev, &adap->vres); |
| 4882 | sz_kb = roundup_pow_of_two(adap->vres.ocq.size) >> 10; | 4687 | sz_kb = roundup_pow_of_two(adap->vres.ocq.size) >> 10; |
| 4883 | t4_write_reg(adap, | 4688 | t4_write_reg(adap, |
| 4884 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 3), | 4689 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, 3), |
| 4885 | start | BIR(1) | WINDOW(ilog2(sz_kb))); | 4690 | start | BIR_V(1) | WINDOW_V(ilog2(sz_kb))); |
| 4886 | t4_write_reg(adap, | 4691 | t4_write_reg(adap, |
| 4887 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, 3), | 4692 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, 3), |
| 4888 | adap->vres.ocq.start); | 4693 | adap->vres.ocq.start); |
| 4889 | t4_read_reg(adap, | 4694 | t4_read_reg(adap, |
| 4890 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, 3)); | 4695 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, 3)); |
| 4891 | } | 4696 | } |
| 4892 | } | 4697 | } |
| 4893 | 4698 | ||
| @@ -4936,38 +4741,38 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) · 42 unmodified lines | |||
| 4936 | t4_sge_init(adap); | 4741 | t4_sge_init(adap); |
| 4937 | 4742 | ||
| 4938 | /* tweak some settings */ | 4743 | /* tweak some settings */ |
| 4939 | t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849); | 4744 | t4_write_reg(adap, TP_SHIFT_CNT_A, 0x64f8849); |
| 4940 | t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12)); | 4745 | t4_write_reg(adap, ULP_RX_TDDP_PSZ_A, HPZ0_V(PAGE_SHIFT - 12)); |
| 4941 | t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG); | 4746 | t4_write_reg(adap, TP_PIO_ADDR_A, TP_INGRESS_CONFIG_A); |
| 4942 | v = t4_read_reg(adap, TP_PIO_DATA); | 4747 | v = t4_read_reg(adap, TP_PIO_DATA_A); |
| 4943 | t4_write_reg(adap, TP_PIO_DATA, v & ~CSUM_HAS_PSEUDO_HDR); | 4748 | t4_write_reg(adap, TP_PIO_DATA_A, v & ~CSUM_HAS_PSEUDO_HDR_F); |
| 4944 | 4749 | ||
| 4945 | /* first 4 Tx modulation queues point to consecutive Tx channels */ | 4750 | /* first 4 Tx modulation queues point to consecutive Tx channels */ |
| 4946 | adap->params.tp.tx_modq_map = 0xE4; | 4751 | adap->params.tp.tx_modq_map = 0xE4; |
| 4947 | t4_write_reg(adap, A_TP_TX_MOD_QUEUE_REQ_MAP, | 4752 | t4_write_reg(adap, TP_TX_MOD_QUEUE_REQ_MAP_A, |
| 4948 | V_TX_MOD_QUEUE_REQ_MAP(adap->params.tp.tx_modq_map)); | 4753 | TX_MOD_QUEUE_REQ_MAP_V(adap->params.tp.tx_modq_map)); |
| 4949 | 4754 | ||
| 4950 | /* associate each Tx modulation queue with consecutive Tx channels */ | 4755 | /* associate each Tx modulation queue with consecutive Tx channels */ |
| 4951 | v = 0x84218421; | 4756 | v = 0x84218421; |
| 4952 | t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA, | 4757 | t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, |
| 4953 | &v, 1, A_TP_TX_SCHED_HDR); | 4758 | &v, 1, TP_TX_SCHED_HDR_A); |
| 4954 | t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA, | 4759 | t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, |
| 4955 | &v, 1, A_TP_TX_SCHED_FIFO); | 4760 | &v, 1, TP_TX_SCHED_FIFO_A); |
| 4956 | t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA, | 4761 | t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, |
| 4957 | &v, 1, A_TP_TX_SCHED_PCMD); | 4762 | &v, 1, TP_TX_SCHED_PCMD_A); |
| 4958 | 4763 | ||
| 4959 | #define T4_TX_MODQ_10G_WEIGHT_DEFAULT 16 /* in KB units */ | 4764 | #define T4_TX_MODQ_10G_WEIGHT_DEFAULT 16 /* in KB units */ |
| 4960 | if (is_offload(adap)) { | 4765 | if (is_offload(adap)) { |
| 4961 | t4_write_reg(adap, A_TP_TX_MOD_QUEUE_WEIGHT0, | 4766 | t4_write_reg(adap, TP_TX_MOD_QUEUE_WEIGHT0_A, |
| 4962 | V_TX_MODQ_WEIGHT0(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | | 4767 | TX_MODQ_WEIGHT0_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | |
| 4963 | V_TX_MODQ_WEIGHT1(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | | 4768 | TX_MODQ_WEIGHT1_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | |
| 4964 | V_TX_MODQ_WEIGHT2(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | | 4769 | TX_MODQ_WEIGHT2_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | |
| 4965 | V_TX_MODQ_WEIGHT3(T4_TX_MODQ_10G_WEIGHT_DEFAULT)); | 4770 | TX_MODQ_WEIGHT3_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT)); |
| 4966 | t4_write_reg(adap, A_TP_TX_MOD_CHANNEL_WEIGHT, | 4771 | t4_write_reg(adap, TP_TX_MOD_CHANNEL_WEIGHT_A, |
| 4967 | V_TX_MODQ_WEIGHT0(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | | 4772 | TX_MODQ_WEIGHT0_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | |
| 4968 | V_TX_MODQ_WEIGHT1(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | | 4773 | TX_MODQ_WEIGHT1_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | |
| 4969 | V_TX_MODQ_WEIGHT2(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | | 4774 | TX_MODQ_WEIGHT2_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | |
| 4970 | V_TX_MODQ_WEIGHT3(T4_TX_MODQ_10G_WEIGHT_DEFAULT)); | 4775 | TX_MODQ_WEIGHT3_V(T4_TX_MODQ_10G_WEIGHT_DEFAULT)); |
| 4971 | } | 4776 | } |
| 4972 | 4777 | ||
| 4973 | /* get basic stuff going */ | 4778 | /* get basic stuff going */ |
| @@ -5013,16 +4818,16 @@ static int adap_init0_tweaks(struct adapter *adapter) · 39 unmodified lines | |||
| 5013 | rx_dma_offset); | 4818 | rx_dma_offset); |
| 5014 | rx_dma_offset = 2; | 4819 | rx_dma_offset = 2; |
| 5015 | } | 4820 | } |
| 5016 | t4_set_reg_field(adapter, SGE_CONTROL, | 4821 | t4_set_reg_field(adapter, SGE_CONTROL_A, |
| 5017 | PKTSHIFT_MASK, | 4822 | PKTSHIFT_V(PKTSHIFT_M), |
| 5018 | PKTSHIFT(rx_dma_offset)); | 4823 | PKTSHIFT_V(rx_dma_offset)); |
| 5019 | 4824 | ||
| 5020 | /* | 4825 | /* |
| 5021 | * Don't include the "IP Pseudo Header" in CPL_RX_PKT checksums: Linux | 4826 | * Don't include the "IP Pseudo Header" in CPL_RX_PKT checksums: Linux |
| 5022 | * adds the pseudo header itself. | 4827 | * adds the pseudo header itself. |
| 5023 | */ | 4828 | */ |
| 5024 | t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG, | 4829 | t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG_A, |
| 5025 | CSUM_HAS_PSEUDO_HDR, 0); | 4830 | CSUM_HAS_PSEUDO_HDR_F, 0); |
| 5026 | 4831 | ||
| 5027 | return 0; | 4832 | return 0; |
| 5028 | } | 4833 | } |
| @@ -5046,7 +4851,7 @@ static int adap_init0_config(struct adapter *adapter, int reset) · 17 unmodified lines | |||
| 5046 | */ | 4851 | */ |
| 5047 | if (reset) { | 4852 | if (reset) { |
| 5048 | ret = t4_fw_reset(adapter, adapter->mbox, | 4853 | ret = t4_fw_reset(adapter, adapter->mbox, |
| 5049 | PIORSTMODE | PIORST); | 4854 | PIORSTMODE_F | PIORST_F); |
| 5050 | if (ret < 0) | 4855 | if (ret < 0) |
| 5051 | goto bye; | 4856 | goto bye; |
| 5052 | } | 4857 | } |
| @@ -5212,12 +5017,9 @@ static int adap_init0_config(struct adapter *adapter, int reset) · 159 unmodified lines | |||
| 5212 | if (ret < 0) | 5017 | if (ret < 0) |
| 5213 | goto bye; | 5018 | goto bye; |
| 5214 | 5019 | ||
| 5215 | /* | 5020 | /* Emit Firmware Configuration File information and return |
| 5216 | * Return successfully and note that we're operating with parameters | 5021 | * successfully. |
| 5217 | * not supplied by the driver, rather than from hard-wired | ||
| 5218 | * initialization constants burried in the driver. | ||
| 5219 | */ | 5022 | */ |
| 5220 | adapter->flags |= USING_SOFT_PARAMS; | ||
| 5221 | dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\ | 5023 | dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\ |
| 5222 | "Configuration File \"%s\", version %#x, computed checksum %#x\n", | 5024 | "Configuration File \"%s\", version %#x, computed checksum %#x\n", |
| 5223 | config_name, finiver, cfcsum); | 5025 | config_name, finiver, cfcsum); |
| @@ -5235,249 +5037,6 @@ bye: · 11 unmodified lines | |||
| 5235 | return ret; | 5037 | return ret; |
| 5236 | } | 5038 | } |
| 5237 | 5039 | ||
| 5238 | /* | ||
| 5239 | * Attempt to initialize the adapter via hard-coded, driver supplied | ||
| 5240 | * parameters ... | ||
| 5241 | */ | ||
| 5242 | static int adap_init0_no_config(struct adapter *adapter, int reset) | ||
| 5243 | { | ||
| 5244 | struct sge *s = &adapter->sge; | ||
| 5245 | struct fw_caps_config_cmd caps_cmd; | ||
| 5246 | u32 v; | ||
| 5247 | int i, ret; | ||
| 5248 | |||
| 5249 | /* | ||
| 5250 | * Reset device if necessary | ||
| 5251 | */ | ||
| 5252 | if (reset) { | ||
| 5253 | ret = t4_fw_reset(adapter, adapter->mbox, | ||
| 5254 | PIORSTMODE | PIORST); | ||
| 5255 | if (ret < 0) | ||
| 5256 | goto bye; | ||
| 5257 | } | ||
| 5258 | |||
| 5259 | /* | ||
| 5260 | * Get device capabilities and select which we'll be using. | ||
| 5261 | */ | ||
| 5262 | memset(&caps_cmd, 0, sizeof(caps_cmd)); | ||
| 5263 | caps_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_CAPS_CONFIG_CMD) | | ||
| 5264 | FW_CMD_REQUEST_F | FW_CMD_READ_F); | ||
| 5265 | caps_cmd.cfvalid_to_len16 = htonl(FW_LEN16(caps_cmd)); | ||
| 5266 | ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd), | ||
| 5267 | &caps_cmd); | ||
| 5268 | if (ret < 0) | ||
| 5269 | goto bye; | ||
| 5270 | |||
| 5271 | if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { | ||
| 5272 | if (!vf_acls) | ||
| 5273 | caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); | ||
| 5274 | else | ||
| 5275 | caps_cmd.niccaps = htons(FW_CAPS_CONFIG_NIC_VM); | ||
| 5276 | } else if (vf_acls) { | ||
| 5277 | dev_err(adapter->pdev_dev, "virtualization ACLs not supported"); | ||
| 5278 | goto bye; | ||
| 5279 | } | ||
| 5280 | caps_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_CAPS_CONFIG_CMD) | | ||
| 5281 | FW_CMD_REQUEST_F | FW_CMD_WRITE_F); | ||
| 5282 | ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd), | ||
| 5283 | NULL); | ||
| 5284 | if (ret < 0) | ||
| 5285 | goto bye; | ||
| 5286 | |||
| 5287 | /* | ||
| 5288 | * Tweak configuration based on system architecture, module | ||
| 5289 | * parameters, etc. | ||
| 5290 | */ | ||
| 5291 | ret = adap_init0_tweaks(adapter); | ||
| 5292 | if (ret < 0) | ||
| 5293 | goto bye; | ||
| 5294 | |||
| 5295 | /* | ||
| 5296 | * Select RSS Global Mode we want to use. We use "Basic Virtual" | ||
| 5297 | * mode which maps each Virtual Interface to its own section of | ||
| 5298 | * the RSS Table and we turn on all map and hash enables ... | ||
| 5299 | */ | ||
| 5300 | adapter->flags |= RSS_TNLALLLOOKUP; | ||
| 5301 | ret = t4_config_glbl_rss(adapter, adapter->mbox, | ||
| 5302 | FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL, | ||
| 5303 | FW_RSS_GLB_CONFIG_CMD_TNLMAPEN_F | | ||
| 5304 | FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ_F | | ||
| 5305 | ((adapter->flags & RSS_TNLALLLOOKUP) ? | ||
| 5306 | FW_RSS_GLB_CONFIG_CMD_TNLALLLKP_F : 0)); | ||
| 5307 | if (ret < 0) | ||
| 5308 | goto bye; | ||
| 5309 | |||
| 5310 | /* | ||
| 5311 | * Set up our own fundamental resource provisioning ... | ||
| 5312 | */ | ||
| 5313 | ret = t4_cfg_pfvf(adapter, adapter->mbox, adapter->fn, 0, | ||
| 5314 | PFRES_NEQ, PFRES_NETHCTRL, | ||
| 5315 | PFRES_NIQFLINT, PFRES_NIQ, | ||
| 5316 | PFRES_TC, PFRES_NVI, | ||
| 5317 | FW_PFVF_CMD_CMASK_M, | ||
| 5318 | pfvfres_pmask(adapter, adapter->fn, 0), | ||
| 5319 | PFRES_NEXACTF, | ||
| 5320 | PFRES_R_CAPS, PFRES_WX_CAPS); | ||
| 5321 | if (ret < 0) | ||
| 5322 | goto bye; | ||
| 5323 | |||
| 5324 | /* | ||
| 5325 | * Perform low level SGE initialization. We need to do this before we | ||
| 5326 | * send the firmware the INITIALIZE command because that will cause | ||
| 5327 | * any other PF Drivers which are waiting for the Master | ||
| 5328 | * Initialization to proceed forward. | ||
| 5329 | */ | ||
| 5330 | for (i = 0; i < SGE_NTIMERS - 1; i++) | ||
| 5331 | s->timer_val[i] = min(intr_holdoff[i], MAX_SGE_TIMERVAL); | ||
| 5332 | s->timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL; | ||
| 5333 | s->counter_val[0] = 1; | ||
| 5334 | for (i = 1; i < SGE_NCOUNTERS; i++) | ||
| 5335 | s->counter_val[i] = min(intr_cnt[i - 1], | ||
| 5336 | THRESHOLD_0_GET(THRESHOLD_0_MASK)); | ||
| 5337 | t4_sge_init(adapter); | ||
| 5338 | |||
| 5339 | #ifdef CONFIG_PCI_IOV | ||
| 5340 | /* | ||
| 5341 | * Provision resource limits for Virtual Functions. We currently | ||
| 5342 | * grant them all the same static resource limits except for the Port | ||
| 5343 | * Access Rights Mask which we're assigning based on the PF. All of | ||
| 5344 | * the static provisioning stuff for both the PF and VF really needs | ||
| 5345 | * to be managed in a persistent manner for each device which the | ||
| 5346 | * firmware controls. | ||
| 5347 | */ | ||
| 5348 | { | ||
| 5349 | int pf, vf; | ||
| 5350 | |||
| 5351 | for (pf = 0; pf < ARRAY_SIZE(num_vf); pf++) { | ||
| 5352 | if (num_vf[pf] <= 0) | ||
| 5353 | continue; | ||
| 5354 | |||
| 5355 | /* VF numbering starts at 1! */ | ||
| 5356 | for (vf = 1; vf <= num_vf[pf]; vf++) { | ||
| 5357 | ret = t4_cfg_pfvf(adapter, adapter->mbox, | ||
| 5358 | pf, vf, | ||
| 5359 | VFRES_NEQ, VFRES_NETHCTRL, | ||
| 5360 | VFRES_NIQFLINT, VFRES_NIQ, | ||
| 5361 | VFRES_TC, VFRES_NVI, | ||
| 5362 | FW_PFVF_CMD_CMASK_M, | ||
| 5363 | pfvfres_pmask( | ||
| 5364 | adapter, pf, vf), | ||
| 5365 | VFRES_NEXACTF, | ||
| 5366 | VFRES_R_CAPS, VFRES_WX_CAPS); | ||
| 5367 | if (ret < 0) | ||
| 5368 | dev_warn(adapter->pdev_dev, | ||
| 5369 | "failed to "\ | ||
| 5370 | "provision pf/vf=%d/%d; " | ||
| 5371 | "err=%d\n", pf, vf, ret); | ||
| 5372 | } | ||
| 5373 | } | ||
| 5374 | } | ||
| 5375 | #endif | ||
| 5376 | |||
| 5377 | /* | ||
| 5378 | * Set up the default filter mode. Later we'll want to implement this | ||
| 5379 | * via a firmware command, etc. ... This needs to be done before the | ||
| 5380 | * firmare initialization command ... If the selected set of fields | ||
| 5381 | * isn't equal to the default value, we'll need to make sure that the | ||
| 5382 | * field selections will fit in the 36-bit budget. | ||
| 5383 | */ | ||
| 5384 | if (tp_vlan_pri_map != TP_VLAN_PRI_MAP_DEFAULT) { | ||
| 5385 | int j, bits = 0; | ||
| 5386 | |||
| 5387 | for (j = TP_VLAN_PRI_MAP_FIRST; j <= TP_VLAN_PRI_MAP_LAST; j++) | ||
| 5388 | switch (tp_vlan_pri_map & (1 << j)) { | ||
| 5389 | case 0: | ||
| 5390 | /* compressed filter field not enabled */ | ||
| 5391 | break; | ||
| 5392 | case FCOE_MASK: | ||
| 5393 | bits += 1; | ||
| 5394 | break; | ||
| 5395 | case PORT_MASK: | ||
| 5396 | bits += 3; | ||
| 5397 | break; | ||
| 5398 | case VNIC_ID_MASK: | ||
| 5399 | bits += 17; | ||
| 5400 | break; | ||
| 5401 | case VLAN_MASK: | ||
| 5402 | bits += 17; | ||
| 5403 | break; | ||
| 5404 | case TOS_MASK: | ||
| 5405 | bits += 8; | ||
| 5406 | break; | ||
| 5407 | case PROTOCOL_MASK: | ||
| 5408 | bits += 8; | ||
| 5409 | break; | ||
| 5410 | case ETHERTYPE_MASK: | ||
| 5411 | bits += 16; | ||
| 5412 | break; | ||
| 5413 | case MACMATCH_MASK: | ||
| 5414 | bits += 9; | ||
| 5415 | break; | ||
| 5416 | case MPSHITTYPE_MASK: | ||
| 5417 | bits += 3; | ||
| 5418 | break; | ||
| 5419 | case FRAGMENTATION_MASK: | ||
| 5420 | bits += 1; | ||
| 5421 | break; | ||
| 5422 | } | ||
| 5423 | |||
| 5424 | if (bits > 36) { | ||
| 5425 | dev_err(adapter->pdev_dev, | ||
| 5426 | "tp_vlan_pri_map=%#x needs %d bits > 36;"\ | ||
| 5427 | " using %#x\n", tp_vlan_pri_map, bits, | ||
| 5428 | TP_VLAN_PRI_MAP_DEFAULT); | ||
| 5429 | tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT; | ||
| 5430 | } | ||
| 5431 | } | ||
| 5432 | v = tp_vlan_pri_map; | ||
| 5433 | t4_write_indirect(adapter, TP_PIO_ADDR, TP_PIO_DATA, | ||
| 5434 | &v, 1, TP_VLAN_PRI_MAP); | ||
| 5435 | |||
| 5436 | /* | ||
| 5437 | * We need Five Tuple Lookup mode to be set in TP_GLOBAL_CONFIG order | ||
| 5438 | * to support any of the compressed filter fields above. Newer | ||
| 5439 | * versions of the firmware do this automatically but it doesn't hurt | ||
| 5440 | * to set it here. Meanwhile, we do _not_ need to set Lookup Every | ||
| 5441 | * Packet in TP_INGRESS_CONFIG to support matching non-TCP packets | ||
| 5442 | * since the firmware automatically turns this on and off when we have | ||
| 5443 | * a non-zero number of filters active (since it does have a | ||
| 5444 | * performance impact). | ||
| 5445 | */ | ||
| 5446 | if (tp_vlan_pri_map) | ||
| 5447 | t4_set_reg_field(adapter, TP_GLOBAL_CONFIG, | ||
| 5448 | FIVETUPLELOOKUP_MASK, | ||
| 5449 | FIVETUPLELOOKUP_MASK); | ||
| 5450 | |||
| 5451 | /* | ||
| 5452 | * Tweak some settings. | ||
| 5453 | */ | ||
| 5454 | t4_write_reg(adapter, TP_SHIFT_CNT, SYNSHIFTMAX(6) | | ||
| 5455 | RXTSHIFTMAXR1(4) | RXTSHIFTMAXR2(15) | | ||
| 5456 | PERSHIFTBACKOFFMAX(8) | PERSHIFTMAX(8) | | ||
| 5457 | KEEPALIVEMAXR1(4) | KEEPALIVEMAXR2(9)); | ||
| 5458 | |||
| 5459 | /* | ||
| 5460 | * Get basic stuff going by issuing the Firmware Initialize command. | ||
| 5461 | * Note that this _must_ be after all PFVF commands ... | ||
| 5462 | */ | ||
| 5463 | ret = t4_fw_initialize(adapter, adapter->mbox); | ||
| 5464 | if (ret < 0) | ||
| 5465 | goto bye; | ||
| 5466 | |||
| 5467 | /* | ||
| 5468 | * Return successfully! | ||
| 5469 | */ | ||
| 5470 | dev_info(adapter->pdev_dev, "Successfully configured using built-in "\ | ||
| 5471 | "driver parameters\n"); | ||
| 5472 | return 0; | ||
| 5473 | |||
| 5474 | /* | ||
| 5475 | * Something bad happened. Return the error ... | ||
| 5476 | */ | ||
| 5477 | bye: | ||
| 5478 | return ret; | ||
| 5479 | } | ||
| 5480 | |||
| 5481 | static struct fw_info fw_info_array[] = { | 5040 | static struct fw_info fw_info_array[] = { |
| 5482 | { | 5041 | { |
| 5483 | .chip = CHELSIO_T4, | 5042 | .chip = CHELSIO_T4, |
| @@ -5529,6 +5088,8 @@ static int adap_init0(struct adapter *adap) · 45 unmodified lines | |||
| 5529 | enum dev_state state; | 5088 | enum dev_state state; |
| 5530 | u32 params[7], val[7]; | 5089 | u32 params[7], val[7]; |
| 5531 | struct fw_caps_config_cmd caps_cmd; | 5090 | struct fw_caps_config_cmd caps_cmd; |
| 5091 | struct fw_devlog_cmd devlog_cmd; | ||
| 5092 | u32 devlog_meminfo; | ||
| 5532 | int reset = 1; | 5093 | int reset = 1; |
| 5533 | 5094 | ||
| 5534 | /* Contact FW, advertising Master capability */ | 5095 | /* Contact FW, advertising Master capability */ |
| @@ -5590,8 +5151,7 @@ static int adap_init0(struct adapter *adap) · 55 unmodified lines | |||
| 5590 | state, &reset); | 5151 | state, &reset); |
| 5591 | 5152 | ||
| 5592 | /* Cleaning up */ | 5153 | /* Cleaning up */ |
| 5593 | if (fw != NULL) | 5154 | release_firmware(fw); |
| 5594 | release_firmware(fw); | ||
| 5595 | t4_free_mem(card_fw); | 5155 | t4_free_mem(card_fw); |
| 5596 | 5156 | ||
| 5597 | if (ret < 0) | 5157 | if (ret < 0) |
| @@ -5609,6 +5169,30 @@ static int adap_init0(struct adapter *adap) · 11 unmodified lines | |||
| 5609 | if (ret < 0) | 5169 | if (ret < 0) |
| 5610 | goto bye; | 5170 | goto bye; |
| 5611 | 5171 | ||
| 5172 | /* Read firmware device log parameters. We really need to find a way | ||
| 5173 | * to get these parameters initialized with some default values (which | ||
| 5174 | * are likely to be correct) for the case where we either don't | ||
| 5175 | * attache to the firmware or it's crashed when we probe the adapter. | ||
| 5176 | * That way we'll still be able to perform early firmware startup | ||
| 5177 | * debugging ... If the request to get the Firmware's Device Log | ||
| 5178 | * parameters fails, we'll live so we don't make that a fatal error. | ||
| 5179 | */ | ||
| 5180 | memset(&devlog_cmd, 0, sizeof(devlog_cmd)); | ||
| 5181 | devlog_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_DEVLOG_CMD) | | ||
| 5182 | FW_CMD_REQUEST_F | FW_CMD_READ_F); | ||
| 5183 | devlog_cmd.retval_len16 = htonl(FW_LEN16(devlog_cmd)); | ||
| 5184 | ret = t4_wr_mbox(adap, adap->mbox, &devlog_cmd, sizeof(devlog_cmd), | ||
| 5185 | &devlog_cmd); | ||
| 5186 | if (ret == 0) { | ||
| 5187 | devlog_meminfo = | ||
| 5188 | ntohl(devlog_cmd.memtype_devlog_memaddr16_devlog); | ||
| 5189 | adap->params.devlog.memtype = | ||
| 5190 | FW_DEVLOG_CMD_MEMTYPE_DEVLOG_G(devlog_meminfo); | ||
| 5191 | adap->params.devlog.start = | ||
| 5192 | FW_DEVLOG_CMD_MEMADDR16_DEVLOG_G(devlog_meminfo) << 4; | ||
| 5193 | adap->params.devlog.size = ntohl(devlog_cmd.memsize_devlog); | ||
| 5194 | } | ||
| 5195 | |||
| 5612 | /* | 5196 | /* |
| 5613 | * Find out what ports are available to us. Note that we need to do | 5197 | * Find out what ports are available to us. Note that we need to do |
| 5614 | * this before calling adap_init0_no_config() since it needs nports | 5198 | * this before calling adap_init0_no_config() since it needs nports |
| @@ -5624,88 +5208,58 @@ static int adap_init0(struct adapter *adap) · 9 unmodified lines | |||
| 5624 | adap->params.nports = hweight32(port_vec); | 5208 | adap->params.nports = hweight32(port_vec); |
| 5625 | adap->params.portvec = port_vec; | 5209 | adap->params.portvec = port_vec; |
| 5626 | 5210 | ||
| 5627 | /* | 5211 | /* If the firmware is initialized already, emit a simply note to that |
| 5628 | * If the firmware is initialized already (and we're not forcing a | 5212 | * effect. Otherwise, it's time to try initializing the adapter. |
| 5629 | * master initialization), note that we're living with existing | ||
| 5630 | * adapter parameters. Otherwise, it's time to try initializing the | ||
| 5631 | * adapter ... | ||
| 5632 | */ | 5213 | */ |
| 5633 | if (state == DEV_STATE_INIT) { | 5214 | if (state == DEV_STATE_INIT) { |
| 5634 | dev_info(adap->pdev_dev, "Coming up as %s: "\ | 5215 | dev_info(adap->pdev_dev, "Coming up as %s: "\ |
| 5635 | "Adapter already initialized\n", | 5216 | "Adapter already initialized\n", |
| 5636 | adap->flags & MASTER_PF ? "MASTER" : "SLAVE"); | 5217 | adap->flags & MASTER_PF ? "MASTER" : "SLAVE"); |
| 5637 | adap->flags |= USING_SOFT_PARAMS; | ||
| 5638 | } else { | 5218 | } else { |
| 5639 | dev_info(adap->pdev_dev, "Coming up as MASTER: "\ | 5219 | dev_info(adap->pdev_dev, "Coming up as MASTER: "\ |
| 5640 | "Initializing adapter\n"); | 5220 | "Initializing adapter\n"); |
| 5641 | /* | 5221 | |
| 5642 | * If the firmware doesn't support Configuration | 5222 | /* Find out whether we're dealing with a version of the |
| 5643 | * Files warn user and exit, | 5223 | * firmware which has configuration file support. |
| 5644 | */ | 5224 | */ |
| 5645 | if (ret < 0) | 5225 | params[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | |
| 5646 | dev_warn(adap->pdev_dev, "Firmware doesn't support " | 5226 | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_CF)); |
| 5647 | "configuration file.\n"); | 5227 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1, |
| 5648 | if (force_old_init) | 5228 | params, val); |
| 5649 | ret = adap_init0_no_config(adap, reset); | ||
| 5650 | else { | ||
| 5651 | /* | ||
| 5652 | * Find out whether we're dealing with a version of | ||
| 5653 | * the firmware which has configuration file support. | ||
| 5654 | */ | ||
| 5655 | params[0] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | | ||
| 5656 | FW_PARAMS_PARAM_X_V( | ||
| 5657 | FW_PARAMS_PARAM_DEV_CF)); | ||
| 5658 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1, | ||
| 5659 | params, val); | ||
| 5660 | |||
| 5661 | /* | ||
| 5662 | * If the firmware doesn't support Configuration | ||
| 5663 | * Files, use the old Driver-based, hard-wired | ||
| 5664 | * initialization. Otherwise, try using the | ||
| 5665 | * Configuration File support and fall back to the | ||
| 5666 | * Driver-based initialization if there's no | ||
| 5667 | * Configuration File found. | ||
| 5668 | */ | ||
| 5669 | if (ret < 0) | ||
| 5670 | ret = adap_init0_no_config(adap, reset); | ||
| 5671 | else { | ||
| 5672 | /* | ||
| 5673 | * The firmware provides us with a memory | ||
| 5674 | * buffer where we can load a Configuration | ||
| 5675 | * File from the host if we want to override | ||
| 5676 | * the Configuration File in flash. | ||
| 5677 | */ | ||
| 5678 | 5229 | ||
| 5679 | ret = adap_init0_config(adap, reset); | 5230 | /* If the firmware doesn't support Configuration Files, |
| 5680 | if (ret == -ENOENT) { | 5231 | * return an error. |
| 5681 | dev_info(adap->pdev_dev, | 5232 | */ |
| 5682 | "No Configuration File present " | 5233 | if (ret < 0) { |
| 5683 | "on adapter. Using hard-wired " | 5234 | dev_err(adap->pdev_dev, "firmware doesn't support " |
| 5684 | "configuration parameters.\n"); | 5235 | "Firmware Configuration Files\n"); |
| 5685 | ret = adap_init0_no_config(adap, reset); | 5236 | goto bye; |
| 5686 | } | 5237 | } |
| 5687 | } | 5238 | |
| 5239 | /* The firmware provides us with a memory buffer where we can | ||
| 5240 | * load a Configuration File from the host if we want to | ||
| 5241 | * override the Configuration File in flash. | ||
| 5242 | */ | ||
| 5243 | ret = adap_init0_config(adap, reset); | ||
| 5244 | if (ret == -ENOENT) { | ||
| 5245 | dev_err(adap->pdev_dev, "no Configuration File " | ||
| 5246 | "present on adapter.\n"); | ||
| 5247 | goto bye; | ||
| 5688 | } | 5248 | } |
| 5689 | if (ret < 0) { | 5249 | if (ret < 0) { |
| 5690 | dev_err(adap->pdev_dev, | 5250 | dev_err(adap->pdev_dev, "could not initialize " |
| 5691 | "could not initialize adapter, error %d\n", | 5251 | "adapter, error %d\n", -ret); |
| 5692 | -ret); | ||
| 5693 | goto bye; | 5252 | goto bye; |
| 5694 | } | 5253 | } |
| 5695 | } | 5254 | } |
| 5696 | 5255 | ||
| 5697 | /* | 5256 | /* Give the SGE code a chance to pull in anything that it needs ... |
| 5698 | * If we're living with non-hard-coded parameters (either from a | 5257 | * Note that this must be called after we retrieve our VPD parameters |
| 5699 | * Firmware Configuration File or values programmed by a different PF | 5258 | * in order to know how to convert core ticks to seconds, etc. |
| 5700 | * Driver), give the SGE code a chance to pull in anything that it | ||
| 5701 | * needs ... Note that this must be called after we retrieve our VPD | ||
| 5702 | * parameters in order to know how to convert core ticks to seconds. | ||
| 5703 | */ | 5259 | */ |
| 5704 | if (adap->flags & USING_SOFT_PARAMS) { | 5260 | ret = t4_sge_init(adap); |
| 5705 | ret = t4_sge_init(adap); | 5261 | if (ret < 0) |
| 5706 | if (ret < 0) | 5262 | goto bye; |
| 5707 | goto bye; | ||
| 5708 | } | ||
| 5709 | 5263 | ||
| 5710 | if (is_bypass_device(adap->pdev->device)) | 5264 | if (is_bypass_device(adap->pdev->device)) |
| 5711 | adap->params.bypass = 1; | 5265 | adap->params.bypass = 1; |
| @@ -5739,6 +5293,14 @@ static int adap_init0(struct adapter *adap) · 27 unmodified lines | |||
| 5739 | adap->tids.nftids = val[4] - val[3] + 1; | 5293 | adap->tids.nftids = val[4] - val[3] + 1; |
| 5740 | adap->sge.ingr_start = val[5]; | 5294 | adap->sge.ingr_start = val[5]; |
| 5741 | 5295 | ||
| 5296 | params[0] = FW_PARAM_PFVF(CLIP_START); | ||
| 5297 | params[1] = FW_PARAM_PFVF(CLIP_END); | ||
| 5298 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, val); | ||
| 5299 | if (ret < 0) | ||
| 5300 | goto bye; | ||
| 5301 | adap->clipt_start = val[0]; | ||
| 5302 | adap->clipt_end = val[1]; | ||
| 5303 | |||
| 5742 | /* query params related to active filter region */ | 5304 | /* query params related to active filter region */ |
| 5743 | params[0] = FW_PARAM_PFVF(ACTIVE_FILTER_START); | 5305 | params[0] = FW_PARAM_PFVF(ACTIVE_FILTER_START); |
| 5744 | params[1] = FW_PARAM_PFVF(ACTIVE_FILTER_END); | 5306 | params[1] = FW_PARAM_PFVF(ACTIVE_FILTER_END); |
| @@ -6401,7 +5963,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 656 unmodified lines | |||
| 6401 | goto out_unmap_bar0; | 5963 | goto out_unmap_bar0; |
| 6402 | 5964 | ||
| 6403 | /* We control everything through one PF */ | 5965 | /* We control everything through one PF */ |
| 6404 | func = SOURCEPF_GET(readl(regs + PL_WHOAMI)); | 5966 | func = SOURCEPF_G(readl(regs + PL_WHOAMI_A)); |
| 6405 | if (func != ent->driver_data) { | 5967 | if (func != ent->driver_data) { |
| 6406 | iounmap(regs); | 5968 | iounmap(regs); |
| 6407 | pci_disable_device(pdev); | 5969 | pci_disable_device(pdev); |
| @@ -6467,9 +6029,11 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 59 unmodified lines | |||
| 6467 | 6029 | ||
| 6468 | 6030 | ||
| 6469 | if (!is_t4(adapter->params.chip)) { | 6031 | if (!is_t4(adapter->params.chip)) { |
| 6470 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; | 6032 | s_qpp = (QUEUESPERPAGEPF0_S + |
| 6471 | qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter, | 6033 | (QUEUESPERPAGEPF1_S - QUEUESPERPAGEPF0_S) * |
| 6472 | SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp); | 6034 | adapter->fn); |
| 6035 | qpp = 1 << QUEUESPERPAGEPF0_G(t4_read_reg(adapter, | ||
| 6036 | SGE_EGRESS_QUEUES_PER_PAGE_PF_A) >> s_qpp); | ||
| 6473 | num_seg = PAGE_SIZE / SEGMENT_SIZE; | 6037 | num_seg = PAGE_SIZE / SEGMENT_SIZE; |
| 6474 | 6038 | ||
| 6475 | /* Each segment size is 128B. Write coalescing is enabled only | 6039 | /* Each segment size is 128B. Write coalescing is enabled only |
| @@ -6557,6 +6121,18 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines | |||
| 6557 | adapter->params.offload = 0; | 6121 | adapter->params.offload = 0; |
| 6558 | } | 6122 | } |
| 6559 | 6123 | ||
| 6124 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 6125 | adapter->clipt = t4_init_clip_tbl(adapter->clipt_start, | ||
| 6126 | adapter->clipt_end); | ||
| 6127 | if (!adapter->clipt) { | ||
| 6128 | /* We tolerate a lack of clip_table, giving up | ||
| 6129 | * some functionality | ||
| 6130 | */ | ||
| 6131 | dev_warn(&pdev->dev, | ||
| 6132 | "could not allocate Clip table, continuing\n"); | ||
| 6133 | adapter->params.offload = 0; | ||
| 6134 | } | ||
| 6135 | #endif | ||
| 6560 | if (is_offload(adapter) && tid_init(&adapter->tids) < 0) { | 6136 | if (is_offload(adapter) && tid_init(&adapter->tids) < 0) { |
| 6561 | dev_warn(&pdev->dev, "could not allocate TID table, " | 6137 | dev_warn(&pdev->dev, "could not allocate TID table, " |
| 6562 | "continuing\n"); | 6138 | "continuing\n"); |
| @@ -6682,6 +6258,9 @@ static void remove_one(struct pci_dev *pdev) · 119 unmodified lines | |||
| 6682 | cxgb_down(adapter); | 6258 | cxgb_down(adapter); |
| 6683 | 6259 | ||
| 6684 | free_some_resources(adapter); | 6260 | free_some_resources(adapter); |
| 6261 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 6262 | t4_cleanup_clip_tbl(adapter); | ||
| 6263 | #endif | ||
| 6685 | iounmap(adapter->regs); | 6264 | iounmap(adapter->regs); |
| 6686 | if (!is_t4(adapter->params.chip)) | 6265 | if (!is_t4(adapter->params.chip)) |
| 6687 | iounmap(adapter->bar2); | 6266 | iounmap(adapter->bar2); |
| @@ -6720,7 +6299,10 @@ static int __init cxgb4_init_module(void) · 32 unmodified lines | |||
| 6720 | debugfs_remove(cxgb4_debugfs_root); | 6299 | debugfs_remove(cxgb4_debugfs_root); |
| 6721 | 6300 | ||
| 6722 | #if IS_ENABLED(CONFIG_IPV6) | 6301 | #if IS_ENABLED(CONFIG_IPV6) |
| 6723 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6302 | if (!inet6addr_registered) { |
| 6303 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); | ||
| 6304 | inet6addr_registered = true; | ||
| 6305 | } | ||
| 6724 | #endif | 6306 | #endif |
| 6725 | 6307 | ||
| 6726 | return ret; | 6308 | return ret; |
| @@ -6729,7 +6311,10 @@ static int __init cxgb4_init_module(void) · 2 unmodified lines | |||
| 6729 | static void __exit cxgb4_cleanup_module(void) | 6311 | static void __exit cxgb4_cleanup_module(void) |
| 6730 | { | 6312 | { |
| 6731 | #if IS_ENABLED(CONFIG_IPV6) | 6313 | #if IS_ENABLED(CONFIG_IPV6) |
| 6732 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6314 | if (inet6addr_registered) { |
| 6315 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); | ||
| 6316 | inet6addr_registered = false; | ||
| 6317 | } | ||
| 6733 | #endif | 6318 | #endif |
| 6734 | pci_unregister_driver(&cxgb4_driver); | 6319 | pci_unregister_driver(&cxgb4_driver); |
| 6735 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ | 6320 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ |
| @@ -173,9 +173,6 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, · 172 unmodified lines | |||
| 173 | unsigned char port, unsigned char mask); | 173 | unsigned char port, unsigned char mask); |
| 174 | int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid, | 174 | int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid, |
| 175 | unsigned int queue, bool ipv6); | 175 | unsigned int queue, bool ipv6); |
| 176 | int cxgb4_clip_get(const struct net_device *dev, const struct in6_addr *lip); | ||
| 177 | int cxgb4_clip_release(const struct net_device *dev, | ||
| 178 | const struct in6_addr *lip); | ||
| 179 | 176 | ||
| 180 | static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) | 177 | static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) |
| 181 | { | 178 | { |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | #include "t4_msg.h" | 46 | #include "t4_msg.h" |
| 47 | #include "t4fw_api.h" | 47 | #include "t4fw_api.h" |
| 48 | #include "t4_regs.h" | 48 | #include "t4_regs.h" |
| 49 | #include "t4_values.h" | ||
| 49 | 50 | ||
| 50 | #define VLAN_NONE 0xfff | 51 | #define VLAN_NONE 0xfff |
| 51 | 52 | ||
| @@ -150,8 +151,8 @@ static int write_l2e(struct adapter *adap, struct l2t_entry *e, int sync) · 98 unmodified lines | |||
| 150 | 151 | ||
| 151 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, | 152 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, |
| 152 | e->idx | (sync ? F_SYNC_WR : 0) | | 153 | e->idx | (sync ? F_SYNC_WR : 0) | |
| 153 | TID_QID(adap->sge.fw_evtq.abs_id))); | 154 | TID_QID_V(adap->sge.fw_evtq.abs_id))); |
| 154 | req->params = htons(L2T_W_PORT(e->lport) | L2T_W_NOREPLY(!sync)); | 155 | req->params = htons(L2T_W_PORT_V(e->lport) | L2T_W_NOREPLY_V(!sync)); |
| 155 | req->l2t_idx = htons(e->idx); | 156 | req->l2t_idx = htons(e->idx); |
| 156 | req->vlan = htons(e->vlan); | 157 | req->vlan = htons(e->vlan); |
| 157 | if (e->neigh && !(e->neigh->dev->flags & IFF_LOOPBACK)) | 158 | if (e->neigh && !(e->neigh->dev->flags & IFF_LOOPBACK)) |
| @@ -425,7 +426,7 @@ u64 cxgb4_select_ntuple(struct net_device *dev, · 267 unmodified lines | |||
| 425 | * in the Compressed Filter Tuple. | 426 | * in the Compressed Filter Tuple. |
| 426 | */ | 427 | */ |
| 427 | if (tp->vlan_shift >= 0 && l2t->vlan != VLAN_NONE) | 428 | if (tp->vlan_shift >= 0 && l2t->vlan != VLAN_NONE) |
| 428 | ntuple |= (u64)(F_FT_VLAN_VLD | l2t->vlan) << tp->vlan_shift; | 429 | ntuple |= (u64)(FT_VLAN_VLD_F | l2t->vlan) << tp->vlan_shift; |
| 429 | 430 | ||
| 430 | if (tp->port_shift >= 0) | 431 | if (tp->port_shift >= 0) |
| 431 | ntuple |= (u64)l2t->lport << tp->port_shift; | 432 | ntuple |= (u64)l2t->lport << tp->port_shift; |
| @@ -439,9 +440,9 @@ u64 cxgb4_select_ntuple(struct net_device *dev, · 7 unmodified lines | |||
| 439 | u32 pf = FW_VIID_PFN_G(viid); | 440 | u32 pf = FW_VIID_PFN_G(viid); |
| 440 | u32 vld = FW_VIID_VIVLD_G(viid); | 441 | u32 vld = FW_VIID_VIVLD_G(viid); |
| 441 | 442 | ||
| 442 | ntuple |= (u64)(V_FT_VNID_ID_VF(vf) | | 443 | ntuple |= (u64)(FT_VNID_ID_VF_V(vf) | |
| 443 | V_FT_VNID_ID_PF(pf) | | 444 | FT_VNID_ID_PF_V(pf) | |
| 444 | V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift; | 445 | FT_VNID_ID_VLD_V(vld)) << tp->vnic_shift; |
| 445 | } | 446 | } |
| 446 | 447 | ||
| 447 | return ntuple; | 448 | return ntuple; |
| @@ -43,8 +43,12 @@ · 42 unmodified lines | |||
| 43 | #include <linux/export.h> | 43 | #include <linux/export.h> |
| 44 | #include <net/ipv6.h> | 44 | #include <net/ipv6.h> |
| 45 | #include <net/tcp.h> | 45 | #include <net/tcp.h> |
| 46 | #ifdef CONFIG_NET_RX_BUSY_POLL | ||
| 47 | #include <net/busy_poll.h> | ||
| 48 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | ||
| 46 | #include "cxgb4.h" | 49 | #include "cxgb4.h" |
| 47 | #include "t4_regs.h" | 50 | #include "t4_regs.h" |
| 51 | #include "t4_values.h" | ||
| 48 | #include "t4_msg.h" | 52 | #include "t4_msg.h" |
| 49 | #include "t4fw_api.h" | 53 | #include "t4fw_api.h" |
| 50 | 54 | ||
| @@ -521,10 +525,12 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) · 470 unmodified lines | |||
| 521 | { | 525 | { |
| 522 | u32 val; | 526 | u32 val; |
| 523 | if (q->pend_cred >= 8) { | 527 | if (q->pend_cred >= 8) { |
| 524 | val = PIDX(q->pend_cred / 8); | 528 | if (is_t4(adap->params.chip)) |
| 525 | if (!is_t4(adap->params.chip)) | 529 | val = PIDX_V(q->pend_cred / 8); |
| 526 | val |= DBTYPE(1); | 530 | else |
| 527 | val |= DBPRIO(1); | 531 | val = PIDX_T5_V(q->pend_cred / 8) | |
| 532 | DBTYPE_F; | ||
| 533 | val |= DBPRIO_F; | ||
| 528 | wmb(); | 534 | wmb(); |
| 529 | 535 | ||
| 530 | /* If we don't have access to the new User Doorbell (T5+), use | 536 | /* If we don't have access to the new User Doorbell (T5+), use |
| @@ -532,10 +538,10 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) · 1 unmodified line | |||
| 532 | * mechanism. | 538 | * mechanism. |
| 533 | */ | 539 | */ |
| 534 | if (unlikely(q->bar2_addr == NULL)) { | 540 | if (unlikely(q->bar2_addr == NULL)) { |
| 535 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), | 541 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), |
| 536 | val | QID(q->cntxt_id)); | 542 | val | QID_V(q->cntxt_id)); |
| 537 | } else { | 543 | } else { |
| 538 | writel(val | QID(q->bar2_qid), | 544 | writel(val | QID_V(q->bar2_qid), |
| 539 | q->bar2_addr + SGE_UDB_KDOORBELL); | 545 | q->bar2_addr + SGE_UDB_KDOORBELL); |
| 540 | 546 | ||
| 541 | /* This Write memory Barrier will force the write to | 547 | /* This Write memory Barrier will force the write to |
| @@ -818,7 +824,8 @@ static void write_sgl(const struct sk_buff *skb, struct sge_txq *q, · 276 unmodified lines | |||
| 818 | sgl->addr0 = cpu_to_be64(addr[1]); | 824 | sgl->addr0 = cpu_to_be64(addr[1]); |
| 819 | } | 825 | } |
| 820 | 826 | ||
| 821 | sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) | ULPTX_NSGE(nfrags)); | 827 | sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) | |
| 828 | ULPTX_NSGE_V(nfrags)); | ||
| 822 | if (likely(--nfrags == 0)) | 829 | if (likely(--nfrags == 0)) |
| 823 | return; | 830 | return; |
| 824 | /* | 831 | /* |
| @@ -884,7 +891,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 59 unmodified lines | |||
| 884 | * doorbell mechanism; otherwise use the new BAR2 mechanism. | 891 | * doorbell mechanism; otherwise use the new BAR2 mechanism. |
| 885 | */ | 892 | */ |
| 886 | if (unlikely(q->bar2_addr == NULL)) { | 893 | if (unlikely(q->bar2_addr == NULL)) { |
| 887 | u32 val = PIDX(n); | 894 | u32 val = PIDX_V(n); |
| 888 | unsigned long flags; | 895 | unsigned long flags; |
| 889 | 896 | ||
| 890 | /* For T4 we need to participate in the Doorbell Recovery | 897 | /* For T4 we need to participate in the Doorbell Recovery |
| @@ -892,14 +899,14 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 1 unmodified line | |||
| 892 | */ | 899 | */ |
| 893 | spin_lock_irqsave(&q->db_lock, flags); | 900 | spin_lock_irqsave(&q->db_lock, flags); |
| 894 | if (!q->db_disabled) | 901 | if (!q->db_disabled) |
| 895 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), | 902 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), |
| 896 | QID(q->cntxt_id) | val); | 903 | QID_V(q->cntxt_id) | val); |
| 897 | else | 904 | else |
| 898 | q->db_pidx_inc += n; | 905 | q->db_pidx_inc += n; |
| 899 | q->db_pidx = q->pidx; | 906 | q->db_pidx = q->pidx; |
| 900 | spin_unlock_irqrestore(&q->db_lock, flags); | 907 | spin_unlock_irqrestore(&q->db_lock, flags); |
| 901 | } else { | 908 | } else { |
| 902 | u32 val = PIDX_T5(n); | 909 | u32 val = PIDX_T5_V(n); |
| 903 | 910 | ||
| 904 | /* T4 and later chips share the same PIDX field offset within | 911 | /* T4 and later chips share the same PIDX field offset within |
| 905 | * the doorbell, but T5 and later shrank the field in order to | 912 | * the doorbell, but T5 and later shrank the field in order to |
| @@ -907,7 +914,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 1 unmodified line | |||
| 907 | * large in the first place (14 bits) so we just use the T5 | 914 | * large in the first place (14 bits) so we just use the T5 |
| 908 | * and later limits and warn if a Queue ID is too large. | 915 | * and later limits and warn if a Queue ID is too large. |
| 909 | */ | 916 | */ |
| 910 | WARN_ON(val & DBPRIO(1)); | 917 | WARN_ON(val & DBPRIO_F); |
| 911 | 918 | ||
| 912 | /* If we're only writing a single TX Descriptor and we can use | 919 | /* If we're only writing a single TX Descriptor and we can use |
| 913 | * Inferred QID registers, we can use the Write Combining | 920 | * Inferred QID registers, we can use the Write Combining |
| @@ -923,7 +930,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) · 9 unmodified lines | |||
| 923 | (q->bar2_addr + SGE_UDB_WCDOORBELL), | 930 | (q->bar2_addr + SGE_UDB_WCDOORBELL), |
| 924 | wr); | 931 | wr); |
| 925 | } else { | 932 | } else { |
| 926 | writel(val | QID(q->bar2_qid), | 933 | writel(val | QID_V(q->bar2_qid), |
| 927 | q->bar2_addr + SGE_UDB_KDOORBELL); | 934 | q->bar2_addr + SGE_UDB_KDOORBELL); |
| 928 | } | 935 | } |
| 929 | 936 | ||
| @@ -1150,9 +1157,9 @@ out_free: dev_kfree_skb_any(skb); · 220 unmodified lines | |||
| 1150 | cntrl = TXPKT_L4CSUM_DIS | TXPKT_IPCSUM_DIS; | 1157 | cntrl = TXPKT_L4CSUM_DIS | TXPKT_IPCSUM_DIS; |
| 1151 | } | 1158 | } |
| 1152 | 1159 | ||
| 1153 | if (vlan_tx_tag_present(skb)) { | 1160 | if (skb_vlan_tag_present(skb)) { |
| 1154 | q->vlan_ins++; | 1161 | q->vlan_ins++; |
| 1155 | cntrl |= TXPKT_VLAN_VLD | TXPKT_VLAN(vlan_tx_tag_get(skb)); | 1162 | cntrl |= TXPKT_VLAN_VLD | TXPKT_VLAN(skb_vlan_tag_get(skb)); |
| 1156 | } | 1163 | } |
| 1157 | 1164 | ||
| 1158 | cpl->ctrl0 = htonl(TXPKT_OPCODE(CPL_TX_PKT_XT) | | 1165 | cpl->ctrl0 = htonl(TXPKT_OPCODE(CPL_TX_PKT_XT) | |
| @@ -1716,6 +1723,7 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, · 557 unmodified lines | |||
| 1716 | skb->truesize += skb->data_len; | 1723 | skb->truesize += skb->data_len; |
| 1717 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1724 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 1718 | skb_record_rx_queue(skb, rxq->rspq.idx); | 1725 | skb_record_rx_queue(skb, rxq->rspq.idx); |
| 1726 | skb_mark_napi_id(skb, &rxq->rspq.napi); | ||
| 1719 | if (rxq->rspq.netdev->features & NETIF_F_RXHASH) | 1727 | if (rxq->rspq.netdev->features & NETIF_F_RXHASH) |
| 1720 | skb_set_hash(skb, (__force u32)pkt->rsshdr.hash_val, | 1728 | skb_set_hash(skb, (__force u32)pkt->rsshdr.hash_val, |
| 1721 | PKT_HASH_TYPE_L3); | 1729 | PKT_HASH_TYPE_L3); |
| @@ -1758,7 +1766,8 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 36 unmodified lines | |||
| 1758 | pkt = (const struct cpl_rx_pkt *)rsp; | 1766 | pkt = (const struct cpl_rx_pkt *)rsp; |
| 1759 | csum_ok = pkt->csum_calc && !pkt->err_vec && | 1767 | csum_ok = pkt->csum_calc && !pkt->err_vec && |
| 1760 | (q->netdev->features & NETIF_F_RXCSUM); | 1768 | (q->netdev->features & NETIF_F_RXCSUM); |
| 1761 | if ((pkt->l2info & htonl(RXF_TCP)) && | 1769 | if ((pkt->l2info & htonl(RXF_TCP_F)) && |
| 1770 | !(cxgb_poll_busy_polling(q)) && | ||
| 1762 | (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) { | 1771 | (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) { |
| 1763 | do_gro(rxq, si, pkt); | 1772 | do_gro(rxq, si, pkt); |
| 1764 | return 0; | 1773 | return 0; |
| @@ -1780,11 +1789,11 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 15 unmodified lines | |||
| 1780 | 1789 | ||
| 1781 | rxq->stats.pkts++; | 1790 | rxq->stats.pkts++; |
| 1782 | 1791 | ||
| 1783 | if (csum_ok && (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) { | 1792 | if (csum_ok && (pkt->l2info & htonl(RXF_UDP_F | RXF_TCP_F))) { |
| 1784 | if (!pkt->ip_frag) { | 1793 | if (!pkt->ip_frag) { |
| 1785 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1794 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 1786 | rxq->stats.rx_cso++; | 1795 | rxq->stats.rx_cso++; |
| 1787 | } else if (pkt->l2info & htonl(RXF_IP)) { | 1796 | } else if (pkt->l2info & htonl(RXF_IP_F)) { |
| 1788 | __sum16 c = (__force __sum16)pkt->csum; | 1797 | __sum16 c = (__force __sum16)pkt->csum; |
| 1789 | skb->csum = csum_unfold(c); | 1798 | skb->csum = csum_unfold(c); |
| 1790 | skb->ip_summed = CHECKSUM_COMPLETE; | 1799 | skb->ip_summed = CHECKSUM_COMPLETE; |
| @@ -1797,6 +1806,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, · 6 unmodified lines | |||
| 1797 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan)); | 1806 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan)); |
| 1798 | rxq->stats.vlan_ex++; | 1807 | rxq->stats.vlan_ex++; |
| 1799 | } | 1808 | } |
| 1809 | skb_mark_napi_id(skb, &q->napi); | ||
| 1800 | netif_receive_skb(skb); | 1810 | netif_receive_skb(skb); |
| 1801 | return 0; | 1811 | return 0; |
| 1802 | } | 1812 | } |
| @@ -1959,6 +1969,38 @@ static int process_responses(struct sge_rspq *q, int budget) · 156 unmodified lines | |||
| 1959 | return budget - budget_left; | 1969 | return budget - budget_left; |
| 1960 | } | 1970 | } |
| 1961 | 1971 | ||
| 1972 | #ifdef CONFIG_NET_RX_BUSY_POLL | ||
| 1973 | int cxgb_busy_poll(struct napi_struct *napi) | ||
| 1974 | { | ||
| 1975 | struct sge_rspq *q = container_of(napi, struct sge_rspq, napi); | ||
| 1976 | unsigned int params, work_done; | ||
| 1977 | u32 val; | ||
| 1978 | |||
| 1979 | if (!cxgb_poll_lock_poll(q)) | ||
| 1980 | return LL_FLUSH_BUSY; | ||
| 1981 | |||
| 1982 | work_done = process_responses(q, 4); | ||
| 1983 | params = QINTR_TIMER_IDX(TIMERREG_COUNTER0_X) | QINTR_CNT_EN; | ||
| 1984 | q->next_intr_params = params; | ||
| 1985 | val = CIDXINC_V(work_done) | SEINTARM_V(params); | ||
| 1986 | |||
| 1987 | /* If we don't have access to the new User GTS (T5+), use the old | ||
| 1988 | * doorbell mechanism; otherwise use the new BAR2 mechanism. | ||
| 1989 | */ | ||
| 1990 | if (unlikely(!q->bar2_addr)) | ||
| 1991 | t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS_A), | ||
| 1992 | val | INGRESSQID_V((u32)q->cntxt_id)); | ||
| 1993 | else { | ||
| 1994 | writel(val | INGRESSQID_V(q->bar2_qid), | ||
| 1995 | q->bar2_addr + SGE_UDB_GTS); | ||
| 1996 | wmb(); | ||
| 1997 | } | ||
| 1998 | |||
| 1999 | cxgb_poll_unlock_poll(q); | ||
| 2000 | return work_done; | ||
| 2001 | } | ||
| 2002 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | ||
| 2003 | |||
| 1962 | /** | 2004 | /** |
| 1963 | * napi_rx_handler - the NAPI handler for Rx processing | 2005 | * napi_rx_handler - the NAPI handler for Rx processing |
| 1964 | * @napi: the napi instance | 2006 | * @napi: the napi instance |
| @@ -1974,9 +2016,13 @@ static int napi_rx_handler(struct napi_struct *napi, int budget) · 9 unmodified lines | |||
| 1974 | { | 2016 | { |
| 1975 | unsigned int params; | 2017 | unsigned int params; |
| 1976 | struct sge_rspq *q = container_of(napi, struct sge_rspq, napi); | 2018 | struct sge_rspq *q = container_of(napi, struct sge_rspq, napi); |
| 1977 | int work_done = process_responses(q, budget); | 2019 | int work_done; |
| 1978 | u32 val; | 2020 | u32 val; |
| 1979 | 2021 | ||
| 2022 | if (!cxgb_poll_lock_napi(q)) | ||
| 2023 | return budget; | ||
| 2024 | |||
| 2025 | work_done = process_responses(q, budget); | ||
| 1980 | if (likely(work_done < budget)) { | 2026 | if (likely(work_done < budget)) { |
| 1981 | int timer_index; | 2027 | int timer_index; |
| 1982 | 2028 | ||
| @@ -2001,19 +2047,20 @@ static int napi_rx_handler(struct napi_struct *napi, int budget) · 18 unmodified lines | |||
| 2001 | } else | 2047 | } else |
| 2002 | params = QINTR_TIMER_IDX(7); | 2048 | params = QINTR_TIMER_IDX(7); |
| 2003 | 2049 | ||
| 2004 | val = CIDXINC(work_done) | SEINTARM(params); | 2050 | val = CIDXINC_V(work_done) | SEINTARM_V(params); |
| 2005 | 2051 | ||
| 2006 | /* If we don't have access to the new User GTS (T5+), use the old | 2052 | /* If we don't have access to the new User GTS (T5+), use the old |
| 2007 | * doorbell mechanism; otherwise use the new BAR2 mechanism. | 2053 | * doorbell mechanism; otherwise use the new BAR2 mechanism. |
| 2008 | */ | 2054 | */ |
| 2009 | if (unlikely(q->bar2_addr == NULL)) { | 2055 | if (unlikely(q->bar2_addr == NULL)) { |
| 2010 | t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS), | 2056 | t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS_A), |
| 2011 | val | INGRESSQID((u32)q->cntxt_id)); | 2057 | val | INGRESSQID_V((u32)q->cntxt_id)); |
| 2012 | } else { | 2058 | } else { |
| 2013 | writel(val | INGRESSQID(q->bar2_qid), | 2059 | writel(val | INGRESSQID_V(q->bar2_qid), |
| 2014 | q->bar2_addr + SGE_UDB_GTS); | 2060 | q->bar2_addr + SGE_UDB_GTS); |
| 2015 | wmb(); | 2061 | wmb(); |
| 2016 | } | 2062 | } |
| 2063 | cxgb_poll_unlock_napi(q); | ||
| 2017 | return work_done; | 2064 | return work_done; |
| 2018 | } | 2065 | } |
| 2019 | 2066 | ||
| @@ -2056,16 +2103,16 @@ static unsigned int process_intrq(struct adapter *adap) · 36 unmodified lines | |||
| 2056 | rspq_next(q); | 2103 | rspq_next(q); |
| 2057 | } | 2104 | } |
| 2058 | 2105 | ||
| 2059 | val = CIDXINC(credits) | SEINTARM(q->intr_params); | 2106 | val = CIDXINC_V(credits) | SEINTARM_V(q->intr_params); |
| 2060 | 2107 | ||
| 2061 | /* If we don't have access to the new User GTS (T5+), use the old | 2108 | /* If we don't have access to the new User GTS (T5+), use the old |
| 2062 | * doorbell mechanism; otherwise use the new BAR2 mechanism. | 2109 | * doorbell mechanism; otherwise use the new BAR2 mechanism. |
| 2063 | */ | 2110 | */ |
| 2064 | if (unlikely(q->bar2_addr == NULL)) { | 2111 | if (unlikely(q->bar2_addr == NULL)) { |
| 2065 | t4_write_reg(adap, MYPF_REG(SGE_PF_GTS), | 2112 | t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A), |
| 2066 | val | INGRESSQID(q->cntxt_id)); | 2113 | val | INGRESSQID_V(q->cntxt_id)); |
| 2067 | } else { | 2114 | } else { |
| 2068 | writel(val | INGRESSQID(q->bar2_qid), | 2115 | writel(val | INGRESSQID_V(q->bar2_qid), |
| 2069 | q->bar2_addr + SGE_UDB_GTS); | 2116 | q->bar2_addr + SGE_UDB_GTS); |
| 2070 | wmb(); | 2117 | wmb(); |
| 2071 | } | 2118 | } |
| @@ -2095,7 +2142,7 @@ static irqreturn_t t4_intr_intx(int irq, void *cookie) · 23 unmodified lines | |||
| 2095 | { | 2142 | { |
| 2096 | struct adapter *adap = cookie; | 2143 | struct adapter *adap = cookie; |
| 2097 | 2144 | ||
| 2098 | t4_write_reg(adap, MYPF_REG(PCIE_PF_CLI), 0); | 2145 | t4_write_reg(adap, MYPF_REG(PCIE_PF_CLI_A), 0); |
| 2099 | if (t4_slow_intr_handler(adap) | process_intrq(adap)) | 2146 | if (t4_slow_intr_handler(adap) | process_intrq(adap)) |
| 2100 | return IRQ_HANDLED; | 2147 | return IRQ_HANDLED; |
| 2101 | return IRQ_NONE; /* probably shared interrupt */ | 2148 | return IRQ_NONE; /* probably shared interrupt */ |
| @@ -2142,9 +2189,9 @@ static void sge_rx_timer_cb(unsigned long data) · 40 unmodified lines | |||
| 2142 | } | 2189 | } |
| 2143 | } | 2190 | } |
| 2144 | 2191 | ||
| 2145 | t4_write_reg(adap, SGE_DEBUG_INDEX, 13); | 2192 | t4_write_reg(adap, SGE_DEBUG_INDEX_A, 13); |
| 2146 | idma_same_state_cnt[0] = t4_read_reg(adap, SGE_DEBUG_DATA_HIGH); | 2193 | idma_same_state_cnt[0] = t4_read_reg(adap, SGE_DEBUG_DATA_HIGH_A); |
| 2147 | idma_same_state_cnt[1] = t4_read_reg(adap, SGE_DEBUG_DATA_LOW); | 2194 | idma_same_state_cnt[1] = t4_read_reg(adap, SGE_DEBUG_DATA_LOW_A); |
| 2148 | 2195 | ||
| 2149 | for (i = 0; i < 2; i++) { | 2196 | for (i = 0; i < 2; i++) { |
| 2150 | u32 debug0, debug11; | 2197 | u32 debug0, debug11; |
| @@ -2188,12 +2235,12 @@ static void sge_rx_timer_cb(unsigned long data) · 37 unmodified lines | |||
| 2188 | /* Read and save the SGE IDMA State and Queue ID information. | 2235 | /* Read and save the SGE IDMA State and Queue ID information. |
| 2189 | * We do this every time in case it changes across time ... | 2236 | * We do this every time in case it changes across time ... |
| 2190 | */ | 2237 | */ |
| 2191 | t4_write_reg(adap, SGE_DEBUG_INDEX, 0); | 2238 | t4_write_reg(adap, SGE_DEBUG_INDEX_A, 0); |
| 2192 | debug0 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW); | 2239 | debug0 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW_A); |
| 2193 | s->idma_state[i] = (debug0 >> (i * 9)) & 0x3f; | 2240 | s->idma_state[i] = (debug0 >> (i * 9)) & 0x3f; |
| 2194 | 2241 | ||
| 2195 | t4_write_reg(adap, SGE_DEBUG_INDEX, 11); | 2242 | t4_write_reg(adap, SGE_DEBUG_INDEX_A, 11); |
| 2196 | debug11 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW); | 2243 | debug11 = t4_read_reg(adap, SGE_DEBUG_DATA_LOW_A); |
| 2197 | s->idma_qid[i] = (debug11 >> (i * 16)) & 0xffff; | 2244 | s->idma_qid[i] = (debug11 >> (i * 16)) & 0xffff; |
| 2198 | 2245 | ||
| 2199 | CH_WARN(adap, "SGE idma%u, queue%u, maybe stuck state%u %dsecs (debug0=%#x, debug11=%#x)\n", | 2246 | CH_WARN(adap, "SGE idma%u, queue%u, maybe stuck state%u %dsecs (debug0=%#x, debug11=%#x)\n", |
| @@ -2337,6 +2384,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, · 137 unmodified lines | |||
| 2337 | goto err; | 2384 | goto err; |
| 2338 | 2385 | ||
| 2339 | netif_napi_add(dev, &iq->napi, napi_rx_handler, 64); | 2386 | netif_napi_add(dev, &iq->napi, napi_rx_handler, 64); |
| 2387 | napi_hash_add(&iq->napi); | ||
| 2340 | iq->cur_desc = iq->desc; | 2388 | iq->cur_desc = iq->desc; |
| 2341 | iq->cidx = 0; | 2389 | iq->cidx = 0; |
| 2342 | iq->gen = 1; | 2390 | iq->gen = 1; |
| @@ -2594,6 +2642,7 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, · 251 unmodified lines | |||
| 2594 | rq->cntxt_id, fl_id, 0xffff); | 2642 | rq->cntxt_id, fl_id, 0xffff); |
| 2595 | dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, | 2643 | dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, |
| 2596 | rq->desc, rq->phys_addr); | 2644 | rq->desc, rq->phys_addr); |
| 2645 | napi_hash_del(&rq->napi); | ||
| 2597 | netif_napi_del(&rq->napi); | 2646 | netif_napi_del(&rq->napi); |
| 2598 | rq->netdev = NULL; | 2647 | rq->netdev = NULL; |
| 2599 | rq->cntxt_id = rq->abs_id = 0; | 2648 | rq->cntxt_id = rq->abs_id = 0; |
| @@ -2738,24 +2787,11 @@ void t4_sge_stop(struct adapter *adap) · 138 unmodified lines | |||
| 2738 | } | 2787 | } |
| 2739 | 2788 | ||
| 2740 | /** | 2789 | /** |
| 2741 | * t4_sge_init - initialize SGE | 2790 | * t4_sge_init_soft - grab core SGE values needed by SGE code |
| 2742 | * @adap: the adapter | 2791 | * @adap: the adapter |
| 2743 | * | 2792 | * |
| 2744 | * Performs SGE initialization needed every time after a chip reset. | 2793 | * We need to grab the SGE operating parameters that we need to have |
| 2745 | * We do not initialize any of the queues here, instead the driver | 2794 | * in order to do our job and make sure we can live with them. |
| 2746 | * top-level must request them individually. | ||
| 2747 | * | ||
| 2748 | * Called in two different modes: | ||
| 2749 | * | ||
| 2750 | * 1. Perform actual hardware initialization and record hard-coded | ||
| 2751 | * parameters which were used. This gets used when we're the | ||
| 2752 | * Master PF and the Firmware Configuration File support didn't | ||
| 2753 | * work for some reason. | ||
| 2754 | * | ||
| 2755 | * 2. We're not the Master PF or initialization was performed with | ||
| 2756 | * a Firmware Configuration File. In this case we need to grab | ||
| 2757 | * any of the SGE operating parameters that we need to have in | ||
| 2758 | * order to do our job and make sure we can live with them ... | ||
| 2759 | */ | 2795 | */ |
| 2760 | 2796 | ||
| 2761 | static int t4_sge_init_soft(struct adapter *adap) | 2797 | static int t4_sge_init_soft(struct adapter *adap) |
| @@ -2770,8 +2806,8 @@ static int t4_sge_init_soft(struct adapter *adap) · 8 unmodified lines | |||
| 2770 | * process_responses() and that only packet data is going to the | 2806 | * process_responses() and that only packet data is going to the |
| 2771 | * Free Lists. | 2807 | * Free Lists. |
| 2772 | */ | 2808 | */ |
| 2773 | if ((t4_read_reg(adap, SGE_CONTROL) & RXPKTCPLMODE_MASK) != | 2809 | if ((t4_read_reg(adap, SGE_CONTROL_A) & RXPKTCPLMODE_F) != |
| 2774 | RXPKTCPLMODE(X_RXPKTCPLMODE_SPLIT)) { | 2810 | RXPKTCPLMODE_V(RXPKTCPLMODE_SPLIT_X)) { |
| 2775 | dev_err(adap->pdev_dev, "bad SGE CPL MODE\n"); | 2811 | dev_err(adap->pdev_dev, "bad SGE CPL MODE\n"); |
| 2776 | return -EINVAL; | 2812 | return -EINVAL; |
| 2777 | } | 2813 | } |
| @@ -2785,7 +2821,7 @@ static int t4_sge_init_soft(struct adapter *adap) · 7 unmodified lines | |||
| 2785 | * XXX meet our needs! | 2821 | * XXX meet our needs! |
| 2786 | */ | 2822 | */ |
| 2787 | #define READ_FL_BUF(x) \ | 2823 | #define READ_FL_BUF(x) \ |
| 2788 | t4_read_reg(adap, SGE_FL_BUFFER_SIZE0+(x)*sizeof(u32)) | 2824 | t4_read_reg(adap, SGE_FL_BUFFER_SIZE0_A+(x)*sizeof(u32)) |
| 2789 | 2825 | ||
| 2790 | fl_small_pg = READ_FL_BUF(RX_SMALL_PG_BUF); | 2826 | fl_small_pg = READ_FL_BUF(RX_SMALL_PG_BUF); |
| 2791 | fl_large_pg = READ_FL_BUF(RX_LARGE_PG_BUF); | 2827 | fl_large_pg = READ_FL_BUF(RX_LARGE_PG_BUF); |
| @@ -2823,99 +2859,38 @@ static int t4_sge_init_soft(struct adapter *adap) · 31 unmodified lines | |||
| 2823 | * Retrieve our RX interrupt holdoff timer values and counter | 2859 | * Retrieve our RX interrupt holdoff timer values and counter |
| 2824 | * threshold values from the SGE parameters. | 2860 | * threshold values from the SGE parameters. |
| 2825 | */ | 2861 | */ |
| 2826 | timer_value_0_and_1 = t4_read_reg(adap, SGE_TIMER_VALUE_0_AND_1); | 2862 | timer_value_0_and_1 = t4_read_reg(adap, SGE_TIMER_VALUE_0_AND_1_A); |
| 2827 | timer_value_2_and_3 = t4_read_reg(adap, SGE_TIMER_VALUE_2_AND_3); | 2863 | timer_value_2_and_3 = t4_read_reg(adap, SGE_TIMER_VALUE_2_AND_3_A); |
| 2828 | timer_value_4_and_5 = t4_read_reg(adap, SGE_TIMER_VALUE_4_AND_5); | 2864 | timer_value_4_and_5 = t4_read_reg(adap, SGE_TIMER_VALUE_4_AND_5_A); |
| 2829 | s->timer_val[0] = core_ticks_to_us(adap, | 2865 | s->timer_val[0] = core_ticks_to_us(adap, |
| 2830 | TIMERVALUE0_GET(timer_value_0_and_1)); | 2866 | TIMERVALUE0_G(timer_value_0_and_1)); |
| 2831 | s->timer_val[1] = core_ticks_to_us(adap, | 2867 | s->timer_val[1] = core_ticks_to_us(adap, |
| 2832 | TIMERVALUE1_GET(timer_value_0_and_1)); | 2868 | TIMERVALUE1_G(timer_value_0_and_1)); |
| 2833 | s->timer_val[2] = core_ticks_to_us(adap, | 2869 | s->timer_val[2] = core_ticks_to_us(adap, |
| 2834 | TIMERVALUE2_GET(timer_value_2_and_3)); | 2870 | TIMERVALUE2_G(timer_value_2_and_3)); |
| 2835 | s->timer_val[3] = core_ticks_to_us(adap, | 2871 | s->timer_val[3] = core_ticks_to_us(adap, |
| 2836 | TIMERVALUE3_GET(timer_value_2_and_3)); | 2872 | TIMERVALUE3_G(timer_value_2_and_3)); |
| 2837 | s->timer_val[4] = core_ticks_to_us(adap, | 2873 | s->timer_val[4] = core_ticks_to_us(adap, |
| 2838 | TIMERVALUE4_GET(timer_value_4_and_5)); | 2874 | TIMERVALUE4_G(timer_value_4_and_5)); |
| 2839 | s->timer_val[5] = core_ticks_to_us(adap, | 2875 | s->timer_val[5] = core_ticks_to_us(adap, |
| 2840 | TIMERVALUE5_GET(timer_value_4_and_5)); | 2876 | TIMERVALUE5_G(timer_value_4_and_5)); |
| 2841 | 2877 | ||
| 2842 | ingress_rx_threshold = t4_read_reg(adap, SGE_INGRESS_RX_THRESHOLD); | 2878 | ingress_rx_threshold = t4_read_reg(adap, SGE_INGRESS_RX_THRESHOLD_A); |
| 2843 | s->counter_val[0] = THRESHOLD_0_GET(ingress_rx_threshold); | 2879 | s->counter_val[0] = THRESHOLD_0_G(ingress_rx_threshold); |
| 2844 | s->counter_val[1] = THRESHOLD_1_GET(ingress_rx_threshold); | 2880 | s->counter_val[1] = THRESHOLD_1_G(ingress_rx_threshold); |
| 2845 | s->counter_val[2] = THRESHOLD_2_GET(ingress_rx_threshold); | 2881 | s->counter_val[2] = THRESHOLD_2_G(ingress_rx_threshold); |
| 2846 | s->counter_val[3] = THRESHOLD_3_GET(ingress_rx_threshold); | 2882 | s->counter_val[3] = THRESHOLD_3_G(ingress_rx_threshold); |
| 2847 | |||
| 2848 | return 0; | ||
| 2849 | } | ||
| 2850 | |||
| 2851 | static int t4_sge_init_hard(struct adapter *adap) | ||
| 2852 | { | ||
| 2853 | struct sge *s = &adap->sge; | ||
| 2854 | |||
| 2855 | /* | ||
| 2856 | * Set up our basic SGE mode to deliver CPL messages to our Ingress | ||
| 2857 | * Queue and Packet Date to the Free List. | ||
| 2858 | */ | ||
| 2859 | t4_set_reg_field(adap, SGE_CONTROL, RXPKTCPLMODE_MASK, | ||
| 2860 | RXPKTCPLMODE_MASK); | ||
| 2861 | |||
| 2862 | /* | ||
| 2863 | * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows | ||
| 2864 | * and generate an interrupt when this occurs so we can recover. | ||
| 2865 | */ | ||
| 2866 | if (is_t4(adap->params.chip)) { | ||
| 2867 | t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS, | ||
| 2868 | V_HP_INT_THRESH(M_HP_INT_THRESH) | | ||
| 2869 | V_LP_INT_THRESH(M_LP_INT_THRESH), | ||
| 2870 | V_HP_INT_THRESH(dbfifo_int_thresh) | | ||
| 2871 | V_LP_INT_THRESH(dbfifo_int_thresh)); | ||
| 2872 | } else { | ||
| 2873 | t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS, | ||
| 2874 | V_LP_INT_THRESH_T5(M_LP_INT_THRESH_T5), | ||
| 2875 | V_LP_INT_THRESH_T5(dbfifo_int_thresh)); | ||
| 2876 | t4_set_reg_field(adap, SGE_DBFIFO_STATUS2, | ||
| 2877 | V_HP_INT_THRESH_T5(M_HP_INT_THRESH_T5), | ||
| 2878 | V_HP_INT_THRESH_T5(dbfifo_int_thresh)); | ||
| 2879 | } | ||
| 2880 | t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_ENABLE_DROP, | ||
| 2881 | F_ENABLE_DROP); | ||
| 2882 | |||
| 2883 | /* | ||
| 2884 | * SGE_FL_BUFFER_SIZE0 (RX_SMALL_PG_BUF) is set up by | ||
| 2885 | * t4_fixup_host_params(). | ||
| 2886 | */ | ||
| 2887 | s->fl_pg_order = FL_PG_ORDER; | ||
| 2888 | if (s->fl_pg_order) | ||
| 2889 | t4_write_reg(adap, | ||
| 2890 | SGE_FL_BUFFER_SIZE0+RX_LARGE_PG_BUF*sizeof(u32), | ||
| 2891 | PAGE_SIZE << FL_PG_ORDER); | ||
| 2892 | t4_write_reg(adap, SGE_FL_BUFFER_SIZE0+RX_SMALL_MTU_BUF*sizeof(u32), | ||
| 2893 | FL_MTU_SMALL_BUFSIZE(adap)); | ||
| 2894 | t4_write_reg(adap, SGE_FL_BUFFER_SIZE0+RX_LARGE_MTU_BUF*sizeof(u32), | ||
| 2895 | FL_MTU_LARGE_BUFSIZE(adap)); | ||
| 2896 | |||
| 2897 | /* | ||
| 2898 | * Note that the SGE Ingress Packet Count Interrupt Threshold and | ||
| 2899 | * Timer Holdoff values must be supplied by our caller. | ||
| 2900 | */ | ||
| 2901 | t4_write_reg(adap, SGE_INGRESS_RX_THRESHOLD, | ||
| 2902 | THRESHOLD_0(s->counter_val[0]) | | ||
| 2903 | THRESHOLD_1(s->counter_val[1]) | | ||
| 2904 | THRESHOLD_2(s->counter_val[2]) | | ||
| 2905 | THRESHOLD_3(s->counter_val[3])); | ||
| 2906 | t4_write_reg(adap, SGE_TIMER_VALUE_0_AND_1, | ||
| 2907 | TIMERVALUE0(us_to_core_ticks(adap, s->timer_val[0])) | | ||
| 2908 | TIMERVALUE1(us_to_core_ticks(adap, s->timer_val[1]))); | ||
| 2909 | t4_write_reg(adap, SGE_TIMER_VALUE_2_AND_3, | ||
| 2910 | TIMERVALUE2(us_to_core_ticks(adap, s->timer_val[2])) | | ||
| 2911 | TIMERVALUE3(us_to_core_ticks(adap, s->timer_val[3]))); | ||
| 2912 | t4_write_reg(adap, SGE_TIMER_VALUE_4_AND_5, | ||
| 2913 | TIMERVALUE4(us_to_core_ticks(adap, s->timer_val[4])) | | ||
| 2914 | TIMERVALUE5(us_to_core_ticks(adap, s->timer_val[5]))); | ||
| 2915 | 2883 | ||
| 2916 | return 0; | 2884 | return 0; |
| 2917 | } | 2885 | } |
| 2918 | 2886 | ||
| 2887 | /** | ||
| 2888 | * t4_sge_init - initialize SGE | ||
| 2889 | * @adap: the adapter | ||
| 2890 | * | ||
| 2891 | * Perform low-level SGE code initialization needed every time after a | ||
| 2892 | * chip reset. | ||
| 2893 | */ | ||
| 2919 | int t4_sge_init(struct adapter *adap) | 2894 | int t4_sge_init(struct adapter *adap) |
| 2920 | { | 2895 | { |
| 2921 | struct sge *s = &adap->sge; | 2896 | struct sge *s = &adap->sge; |
| @@ -2927,9 +2902,9 @@ int t4_sge_init(struct adapter *adap) · 5 unmodified lines | |||
| 2927 | * Ingress Padding Boundary and Egress Status Page Size are set up by | 2902 | * Ingress Padding Boundary and Egress Status Page Size are set up by |
| 2928 | * t4_fixup_host_params(). | 2903 | * t4_fixup_host_params(). |
| 2929 | */ | 2904 | */ |
| 2930 | sge_control = t4_read_reg(adap, SGE_CONTROL); | 2905 | sge_control = t4_read_reg(adap, SGE_CONTROL_A); |
| 2931 | s->pktshift = PKTSHIFT_GET(sge_control); | 2906 | s->pktshift = PKTSHIFT_G(sge_control); |
| 2932 | s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; | 2907 | s->stat_len = (sge_control & EGRSTATUSPAGESIZE_F) ? 128 : 64; |
| 2933 | 2908 | ||
| 2934 | /* T4 uses a single control field to specify both the PCIe Padding and | 2909 | /* T4 uses a single control field to specify both the PCIe Padding and |
| 2935 | * Packing Boundary. T5 introduced the ability to specify these | 2910 | * Packing Boundary. T5 introduced the ability to specify these |
| @@ -2937,8 +2912,8 @@ int t4_sge_init(struct adapter *adap) · 1 unmodified line | |||
| 2937 | * within Packed Buffer Mode is the maximum of these two | 2912 | * within Packed Buffer Mode is the maximum of these two |
| 2938 | * specifications. | 2913 | * specifications. |
| 2939 | */ | 2914 | */ |
| 2940 | ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_control) + | 2915 | ingpadboundary = 1 << (INGPADBOUNDARY_G(sge_control) + |
| 2941 | X_INGPADBOUNDARY_SHIFT); | 2916 | INGPADBOUNDARY_SHIFT_X); |
| 2942 | if (is_t4(adap->params.chip)) { | 2917 | if (is_t4(adap->params.chip)) { |
| 2943 | s->fl_align = ingpadboundary; | 2918 | s->fl_align = ingpadboundary; |
| 2944 | } else { | 2919 | } else { |
| @@ -2956,10 +2931,7 @@ int t4_sge_init(struct adapter *adap) · 11 unmodified lines | |||
| 2956 | s->fl_align = max(ingpadboundary, ingpackboundary); | 2931 | s->fl_align = max(ingpadboundary, ingpackboundary); |
| 2957 | } | 2932 | } |
| 2958 | 2933 | ||
| 2959 | if (adap->flags & USING_SOFT_PARAMS) | 2934 | ret = t4_sge_init_soft(adap); |
| 2960 | ret = t4_sge_init_soft(adap); | ||
| 2961 | else | ||
| 2962 | ret = t4_sge_init_hard(adap); | ||
| 2963 | if (ret < 0) | 2935 | if (ret < 0) |
| 2964 | return ret; | 2936 | return ret; |
| 2965 | 2937 | ||
| @@ -2975,11 +2947,11 @@ int t4_sge_init(struct adapter *adap) · 9 unmodified lines | |||
| 2975 | * buffers and a new field which only applies to Packed Mode Free List | 2947 | * buffers and a new field which only applies to Packed Mode Free List |
| 2976 | * buffers. | 2948 | * buffers. |
| 2977 | */ | 2949 | */ |
| 2978 | sge_conm_ctrl = t4_read_reg(adap, SGE_CONM_CTRL); | 2950 | sge_conm_ctrl = t4_read_reg(adap, SGE_CONM_CTRL_A); |
| 2979 | if (is_t4(adap->params.chip)) | 2951 | if (is_t4(adap->params.chip)) |
| 2980 | egress_threshold = EGRTHRESHOLD_GET(sge_conm_ctrl); | 2952 | egress_threshold = EGRTHRESHOLD_G(sge_conm_ctrl); |
| 2981 | else | 2953 | else |
| 2982 | egress_threshold = EGRTHRESHOLDPACKING_GET(sge_conm_ctrl); | 2954 | egress_threshold = EGRTHRESHOLDPACKING_G(sge_conm_ctrl); |
| 2983 | s->fl_starve_thres = 2*egress_threshold + 1; | 2955 | s->fl_starve_thres = 2*egress_threshold + 1; |
| 2984 | 2956 | ||
| 2985 | setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap); | 2957 | setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap); |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | |||
| 35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
| 36 | #include "cxgb4.h" | 36 | #include "cxgb4.h" |
| 37 | #include "t4_regs.h" | 37 | #include "t4_regs.h" |
| 38 | #include "t4_values.h" | ||
| 38 | #include "t4fw_api.h" | 39 | #include "t4fw_api.h" |
| 39 | 40 | ||
| 40 | /** | 41 | /** |
| @@ -149,20 +150,20 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, · 108 unmodified lines | |||
| 149 | */ | 150 | */ |
| 150 | void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) | 151 | void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) |
| 151 | { | 152 | { |
| 152 | u32 req = ENABLE | FUNCTION(adap->fn) | reg; | 153 | u32 req = ENABLE_F | FUNCTION_V(adap->fn) | REGISTER_V(reg); |
| 153 | 154 | ||
| 154 | if (is_t4(adap->params.chip)) | 155 | if (is_t4(adap->params.chip)) |
| 155 | req |= F_LOCALCFG; | 156 | req |= LOCALCFG_F; |
| 156 | 157 | ||
| 157 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ, req); | 158 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ_A, req); |
| 158 | *val = t4_read_reg(adap, PCIE_CFG_SPACE_DATA); | 159 | *val = t4_read_reg(adap, PCIE_CFG_SPACE_DATA_A); |
| 159 | 160 | ||
| 160 | /* Reset ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a | 161 | /* Reset ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a |
| 161 | * Configuration Space read. (None of the other fields matter when | 162 | * Configuration Space read. (None of the other fields matter when |
| 162 | * ENABLE is 0 so a simple register write is easier than a | 163 | * ENABLE is 0 so a simple register write is easier than a |
| 163 | * read-modify-write via t4_set_reg_field().) | 164 | * read-modify-write via t4_set_reg_field().) |
| 164 | */ | 165 | */ |
| 165 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ, 0); | 166 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ_A, 0); |
| 166 | } | 167 | } |
| 167 | 168 | ||
| 168 | /* | 169 | /* |
| @@ -187,8 +188,8 @@ static void t4_report_fw_error(struct adapter *adap) · 18 unmodified lines | |||
| 187 | }; | 188 | }; |
| 188 | u32 pcie_fw; | 189 | u32 pcie_fw; |
| 189 | 190 | ||
| 190 | pcie_fw = t4_read_reg(adap, MA_PCIE_FW); | 191 | pcie_fw = t4_read_reg(adap, PCIE_FW_A); |
| 191 | if (pcie_fw & PCIE_FW_ERR) | 192 | if (pcie_fw & PCIE_FW_ERR_F) |
| 192 | dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n", | 193 | dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n", |
| 193 | reason[PCIE_FW_EVAL_G(pcie_fw)]); | 194 | reason[PCIE_FW_EVAL_G(pcie_fw)]); |
| 194 | } | 195 | } |
| @@ -264,8 +265,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 69 unmodified lines | |||
| 264 | u64 res; | 265 | u64 res; |
| 265 | int i, ms, delay_idx; | 266 | int i, ms, delay_idx; |
| 266 | const __be64 *p = cmd; | 267 | const __be64 *p = cmd; |
| 267 | u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA); | 268 | u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); |
| 268 | u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL); | 269 | u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL_A); |
| 269 | 270 | ||
| 270 | if ((size & 15) || size > MBOX_LEN) | 271 | if ((size & 15) || size > MBOX_LEN) |
| 271 | return -EINVAL; | 272 | return -EINVAL; |
| @@ -277,9 +278,9 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 5 unmodified lines | |||
| 277 | if (adap->pdev->error_state != pci_channel_io_normal) | 278 | if (adap->pdev->error_state != pci_channel_io_normal) |
| 278 | return -EIO; | 279 | return -EIO; |
| 279 | 280 | ||
| 280 | v = MBOWNER_GET(t4_read_reg(adap, ctl_reg)); | 281 | v = MBOWNER_G(t4_read_reg(adap, ctl_reg)); |
| 281 | for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++) | 282 | for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++) |
| 282 | v = MBOWNER_GET(t4_read_reg(adap, ctl_reg)); | 283 | v = MBOWNER_G(t4_read_reg(adap, ctl_reg)); |
| 283 | 284 | ||
| 284 | if (v != MBOX_OWNER_DRV) | 285 | if (v != MBOX_OWNER_DRV) |
| 285 | return v ? -EBUSY : -ETIMEDOUT; | 286 | return v ? -EBUSY : -ETIMEDOUT; |
| @@ -287,7 +288,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 1 unmodified line | |||
| 287 | for (i = 0; i < size; i += 8) | 288 | for (i = 0; i < size; i += 8) |
| 288 | t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p++)); | 289 | t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p++)); |
| 289 | 290 | ||
| 290 | t4_write_reg(adap, ctl_reg, MBMSGVALID | MBOWNER(MBOX_OWNER_FW)); | 291 | t4_write_reg(adap, ctl_reg, MBMSGVALID_F | MBOWNER_V(MBOX_OWNER_FW)); |
| 291 | t4_read_reg(adap, ctl_reg); /* flush write */ | 292 | t4_read_reg(adap, ctl_reg); /* flush write */ |
| 292 | 293 | ||
| 293 | delay_idx = 0; | 294 | delay_idx = 0; |
| @@ -303,8 +304,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 9 unmodified lines | |||
| 303 | mdelay(ms); | 304 | mdelay(ms); |
| 304 | 305 | ||
| 305 | v = t4_read_reg(adap, ctl_reg); | 306 | v = t4_read_reg(adap, ctl_reg); |
| 306 | if (MBOWNER_GET(v) == MBOX_OWNER_DRV) { | 307 | if (MBOWNER_G(v) == MBOX_OWNER_DRV) { |
| 307 | if (!(v & MBMSGVALID)) { | 308 | if (!(v & MBMSGVALID_F)) { |
| 308 | t4_write_reg(adap, ctl_reg, 0); | 309 | t4_write_reg(adap, ctl_reg, 0); |
| 309 | continue; | 310 | continue; |
| 310 | } | 311 | } |
| @@ -350,27 +351,27 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) · 39 unmodified lines | |||
| 350 | u32 mc_bist_status_rdata, mc_bist_data_pattern; | 351 | u32 mc_bist_status_rdata, mc_bist_data_pattern; |
| 351 | 352 | ||
| 352 | if (is_t4(adap->params.chip)) { | 353 | if (is_t4(adap->params.chip)) { |
| 353 | mc_bist_cmd = MC_BIST_CMD; | 354 | mc_bist_cmd = MC_BIST_CMD_A; |
| 354 | mc_bist_cmd_addr = MC_BIST_CMD_ADDR; | 355 | mc_bist_cmd_addr = MC_BIST_CMD_ADDR_A; |
| 355 | mc_bist_cmd_len = MC_BIST_CMD_LEN; | 356 | mc_bist_cmd_len = MC_BIST_CMD_LEN_A; |
| 356 | mc_bist_status_rdata = MC_BIST_STATUS_RDATA; | 357 | mc_bist_status_rdata = MC_BIST_STATUS_RDATA_A; |
| 357 | mc_bist_data_pattern = MC_BIST_DATA_PATTERN; | 358 | mc_bist_data_pattern = MC_BIST_DATA_PATTERN_A; |
| 358 | } else { | 359 | } else { |
| 359 | mc_bist_cmd = MC_REG(MC_P_BIST_CMD, idx); | 360 | mc_bist_cmd = MC_REG(MC_P_BIST_CMD_A, idx); |
| 360 | mc_bist_cmd_addr = MC_REG(MC_P_BIST_CMD_ADDR, idx); | 361 | mc_bist_cmd_addr = MC_REG(MC_P_BIST_CMD_ADDR_A, idx); |
| 361 | mc_bist_cmd_len = MC_REG(MC_P_BIST_CMD_LEN, idx); | 362 | mc_bist_cmd_len = MC_REG(MC_P_BIST_CMD_LEN_A, idx); |
| 362 | mc_bist_status_rdata = MC_REG(MC_P_BIST_STATUS_RDATA, idx); | 363 | mc_bist_status_rdata = MC_REG(MC_P_BIST_STATUS_RDATA_A, idx); |
| 363 | mc_bist_data_pattern = MC_REG(MC_P_BIST_DATA_PATTERN, idx); | 364 | mc_bist_data_pattern = MC_REG(MC_P_BIST_DATA_PATTERN_A, idx); |
| 364 | } | 365 | } |
| 365 | 366 | ||
| 366 | if (t4_read_reg(adap, mc_bist_cmd) & START_BIST) | 367 | if (t4_read_reg(adap, mc_bist_cmd) & START_BIST_F) |
| 367 | return -EBUSY; | 368 | return -EBUSY; |
| 368 | t4_write_reg(adap, mc_bist_cmd_addr, addr & ~0x3fU); | 369 | t4_write_reg(adap, mc_bist_cmd_addr, addr & ~0x3fU); |
| 369 | t4_write_reg(adap, mc_bist_cmd_len, 64); | 370 | t4_write_reg(adap, mc_bist_cmd_len, 64); |
| 370 | t4_write_reg(adap, mc_bist_data_pattern, 0xc); | 371 | t4_write_reg(adap, mc_bist_data_pattern, 0xc); |
| 371 | t4_write_reg(adap, mc_bist_cmd, BIST_OPCODE(1) | START_BIST | | 372 | t4_write_reg(adap, mc_bist_cmd, BIST_OPCODE_V(1) | START_BIST_F | |
| 372 | BIST_CMD_GAP(1)); | 373 | BIST_CMD_GAP_V(1)); |
| 373 | i = t4_wait_op_done(adap, mc_bist_cmd, START_BIST, 0, 10, 1); | 374 | i = t4_wait_op_done(adap, mc_bist_cmd, START_BIST_F, 0, 10, 1); |
| 374 | if (i) | 375 | if (i) |
| 375 | return i; | 376 | return i; |
| 376 | 377 | ||
| @@ -403,31 +404,31 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) · 26 unmodified lines | |||
| 403 | u32 edc_bist_cmd_data_pattern, edc_bist_status_rdata; | 404 | u32 edc_bist_cmd_data_pattern, edc_bist_status_rdata; |
| 404 | 405 | ||
| 405 | if (is_t4(adap->params.chip)) { | 406 | if (is_t4(adap->params.chip)) { |
| 406 | edc_bist_cmd = EDC_REG(EDC_BIST_CMD, idx); | 407 | edc_bist_cmd = EDC_REG(EDC_BIST_CMD_A, idx); |
| 407 | edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR, idx); | 408 | edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR_A, idx); |
| 408 | edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN, idx); | 409 | edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN_A, idx); |
| 409 | edc_bist_cmd_data_pattern = EDC_REG(EDC_BIST_DATA_PATTERN, | 410 | edc_bist_cmd_data_pattern = EDC_REG(EDC_BIST_DATA_PATTERN_A, |
| 410 | idx); | ||
| 411 | edc_bist_status_rdata = EDC_REG(EDC_BIST_STATUS_RDATA, | ||
| 412 | idx); | 411 | idx); |
| 412 | edc_bist_status_rdata = EDC_REG(EDC_BIST_STATUS_RDATA_A, | ||
| 413 | idx); | ||
| 413 | } else { | 414 | } else { |
| 414 | edc_bist_cmd = EDC_REG_T5(EDC_H_BIST_CMD, idx); | 415 | edc_bist_cmd = EDC_REG_T5(EDC_H_BIST_CMD_A, idx); |
| 415 | edc_bist_cmd_addr = EDC_REG_T5(EDC_H_BIST_CMD_ADDR, idx); | 416 | edc_bist_cmd_addr = EDC_REG_T5(EDC_H_BIST_CMD_ADDR_A, idx); |
| 416 | edc_bist_cmd_len = EDC_REG_T5(EDC_H_BIST_CMD_LEN, idx); | 417 | edc_bist_cmd_len = EDC_REG_T5(EDC_H_BIST_CMD_LEN_A, idx); |
| 417 | edc_bist_cmd_data_pattern = | 418 | edc_bist_cmd_data_pattern = |
| 418 | EDC_REG_T5(EDC_H_BIST_DATA_PATTERN, idx); | 419 | EDC_REG_T5(EDC_H_BIST_DATA_PATTERN_A, idx); |
| 419 | edc_bist_status_rdata = | 420 | edc_bist_status_rdata = |
| 420 | EDC_REG_T5(EDC_H_BIST_STATUS_RDATA, idx); | 421 | EDC_REG_T5(EDC_H_BIST_STATUS_RDATA_A, idx); |
| 421 | } | 422 | } |
| 422 | 423 | ||
| 423 | if (t4_read_reg(adap, edc_bist_cmd) & START_BIST) | 424 | if (t4_read_reg(adap, edc_bist_cmd) & START_BIST_F) |
| 424 | return -EBUSY; | 425 | return -EBUSY; |
| 425 | t4_write_reg(adap, edc_bist_cmd_addr, addr & ~0x3fU); | 426 | t4_write_reg(adap, edc_bist_cmd_addr, addr & ~0x3fU); |
| 426 | t4_write_reg(adap, edc_bist_cmd_len, 64); | 427 | t4_write_reg(adap, edc_bist_cmd_len, 64); |
| 427 | t4_write_reg(adap, edc_bist_cmd_data_pattern, 0xc); | 428 | t4_write_reg(adap, edc_bist_cmd_data_pattern, 0xc); |
| 428 | t4_write_reg(adap, edc_bist_cmd, | 429 | t4_write_reg(adap, edc_bist_cmd, |
| 429 | BIST_OPCODE(1) | BIST_CMD_GAP(1) | START_BIST); | 430 | BIST_OPCODE_V(1) | BIST_CMD_GAP_V(1) | START_BIST_F); |
| 430 | i = t4_wait_op_done(adap, edc_bist_cmd, START_BIST, 0, 10, 1); | 431 | i = t4_wait_op_done(adap, edc_bist_cmd, START_BIST_F, 0, 10, 1); |
| 431 | if (i) | 432 | if (i) |
| 432 | return i; | 433 | return i; |
| 433 | 434 | ||
| @@ -505,13 +506,13 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 71 unmodified lines | |||
| 505 | * the address is relative to BAR0. | 506 | * the address is relative to BAR0. |
| 506 | */ | 507 | */ |
| 507 | mem_reg = t4_read_reg(adap, | 508 | mem_reg = t4_read_reg(adap, |
| 508 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, | 509 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN_A, |
| 509 | win)); | 510 | win)); |
| 510 | mem_aperture = 1 << (GET_WINDOW(mem_reg) + 10); | 511 | mem_aperture = 1 << (WINDOW_G(mem_reg) + WINDOW_SHIFT_X); |
| 511 | mem_base = GET_PCIEOFST(mem_reg) << 10; | 512 | mem_base = PCIEOFST_G(mem_reg) << PCIEOFST_SHIFT_X; |
| 512 | if (is_t4(adap->params.chip)) | 513 | if (is_t4(adap->params.chip)) |
| 513 | mem_base -= adap->t4_bar0; | 514 | mem_base -= adap->t4_bar0; |
| 514 | win_pf = is_t4(adap->params.chip) ? 0 : V_PFNUM(adap->fn); | 515 | win_pf = is_t4(adap->params.chip) ? 0 : PFNUM_V(adap->fn); |
| 515 | 516 | ||
| 516 | /* Calculate our initial PCI-E Memory Window Position and Offset into | 517 | /* Calculate our initial PCI-E Memory Window Position and Offset into |
| 517 | * that Window. | 518 | * that Window. |
| @@ -524,10 +525,10 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 6 unmodified lines | |||
| 524 | * attempt to use the new value.) | 525 | * attempt to use the new value.) |
| 525 | */ | 526 | */ |
| 526 | t4_write_reg(adap, | 527 | t4_write_reg(adap, |
| 527 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, win), | 528 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, win), |
| 528 | pos | win_pf); | 529 | pos | win_pf); |
| 529 | t4_read_reg(adap, | 530 | t4_read_reg(adap, |
| 530 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, win)); | 531 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, win)); |
| 531 | 532 | ||
| 532 | /* Transfer data to/from the adapter as long as there's an integral | 533 | /* Transfer data to/from the adapter as long as there's an integral |
| 533 | * number of 32-bit transfers to complete. | 534 | * number of 32-bit transfers to complete. |
| @@ -552,11 +553,11 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 18 unmodified lines | |||
| 552 | pos += mem_aperture; | 553 | pos += mem_aperture; |
| 553 | offset = 0; | 554 | offset = 0; |
| 554 | t4_write_reg(adap, | 555 | t4_write_reg(adap, |
| 555 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, | 556 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, |
| 556 | win), pos | win_pf); | 557 | win), pos | win_pf); |
| 557 | t4_read_reg(adap, | 558 | t4_read_reg(adap, |
| 558 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET, | 559 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_OFFSET_A, |
| 559 | win)); | 560 | win)); |
| 560 | } | 561 | } |
| 561 | } | 562 | } |
| 562 | 563 | ||
| @@ -760,14 +761,13 @@ static int sf1_read(struct adapter *adapter, unsigned int byte_cnt, int cont, · 197 unmodified lines | |||
| 760 | 761 | ||
| 761 | if (!byte_cnt || byte_cnt > 4) | 762 | if (!byte_cnt || byte_cnt > 4) |
| 762 | return -EINVAL; | 763 | return -EINVAL; |
| 763 | if (t4_read_reg(adapter, SF_OP) & SF_BUSY) | 764 | if (t4_read_reg(adapter, SF_OP_A) & SF_BUSY_F) |
| 764 | return -EBUSY; | 765 | return -EBUSY; |
| 765 | cont = cont ? SF_CONT : 0; | 766 | t4_write_reg(adapter, SF_OP_A, SF_LOCK_V(lock) | |
| 766 | lock = lock ? SF_LOCK : 0; | 767 | SF_CONT_V(cont) | BYTECNT_V(byte_cnt - 1)); |
| 767 | t4_write_reg(adapter, SF_OP, lock | cont | BYTECNT(byte_cnt - 1)); | 768 | ret = t4_wait_op_done(adapter, SF_OP_A, SF_BUSY_F, 0, SF_ATTEMPTS, 5); |
| 768 | ret = t4_wait_op_done(adapter, SF_OP, SF_BUSY, 0, SF_ATTEMPTS, 5); | ||
| 769 | if (!ret) | 769 | if (!ret) |
| 770 | *valp = t4_read_reg(adapter, SF_DATA); | 770 | *valp = t4_read_reg(adapter, SF_DATA_A); |
| 771 | return ret; | 771 | return ret; |
| 772 | } | 772 | } |
| 773 | 773 | ||
| @@ -788,14 +788,12 @@ static int sf1_write(struct adapter *adapter, unsigned int byte_cnt, int cont, · 14 unmodified lines | |||
| 788 | { | 788 | { |
| 789 | if (!byte_cnt || byte_cnt > 4) | 789 | if (!byte_cnt || byte_cnt > 4) |
| 790 | return -EINVAL; | 790 | return -EINVAL; |
| 791 | if (t4_read_reg(adapter, SF_OP) & SF_BUSY) | 791 | if (t4_read_reg(adapter, SF_OP_A) & SF_BUSY_F) |
| 792 | return -EBUSY; | 792 | return -EBUSY; |
| 793 | cont = cont ? SF_CONT : 0; | 793 | t4_write_reg(adapter, SF_DATA_A, val); |
| 794 | lock = lock ? SF_LOCK : 0; | 794 | t4_write_reg(adapter, SF_OP_A, SF_LOCK_V(lock) | |
| 795 | t4_write_reg(adapter, SF_DATA, val); | 795 | SF_CONT_V(cont) | BYTECNT_V(byte_cnt - 1) | OP_V(1)); |
| 796 | t4_write_reg(adapter, SF_OP, lock | | 796 | return t4_wait_op_done(adapter, SF_OP_A, SF_BUSY_F, 0, SF_ATTEMPTS, 5); |
| 797 | cont | BYTECNT(byte_cnt - 1) | OP_WR); | ||
| 798 | return t4_wait_op_done(adapter, SF_OP, SF_BUSY, 0, SF_ATTEMPTS, 5); | ||
| 799 | } | 797 | } |
| 800 | 798 | ||
| 801 | /** | 799 | /** |
| @@ -837,8 +835,8 @@ static int flash_wait_op(struct adapter *adapter, int attempts, int delay) · 35 unmodified lines | |||
| 837 | * (i.e., big-endian), otherwise as 32-bit words in the platform's | 835 | * (i.e., big-endian), otherwise as 32-bit words in the platform's |
| 838 | * natural endianess. | 836 | * natural endianess. |
| 839 | */ | 837 | */ |
| 840 | static int t4_read_flash(struct adapter *adapter, unsigned int addr, | 838 | int t4_read_flash(struct adapter *adapter, unsigned int addr, |
| 841 | unsigned int nwords, u32 *data, int byte_oriented) | 839 | unsigned int nwords, u32 *data, int byte_oriented) |
| 842 | { | 840 | { |
| 843 | int ret; | 841 | int ret; |
| 844 | 842 | ||
| @@ -854,7 +852,7 @@ static int t4_read_flash(struct adapter *adapter, unsigned int addr, · 9 unmodified lines | |||
| 854 | for ( ; nwords; nwords--, data++) { | 852 | for ( ; nwords; nwords--, data++) { |
| 855 | ret = sf1_read(adapter, 4, nwords > 1, nwords == 1, data); | 853 | ret = sf1_read(adapter, 4, nwords > 1, nwords == 1, data); |
| 856 | if (nwords == 1) | 854 | if (nwords == 1) |
| 857 | t4_write_reg(adapter, SF_OP, 0); /* unlock SF */ | 855 | t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */ |
| 858 | if (ret) | 856 | if (ret) |
| 859 | return ret; | 857 | return ret; |
| 860 | if (byte_oriented) | 858 | if (byte_oriented) |
| @@ -902,7 +900,7 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 41 unmodified lines | |||
| 902 | if (ret) | 900 | if (ret) |
| 903 | goto unlock; | 901 | goto unlock; |
| 904 | 902 | ||
| 905 | t4_write_reg(adapter, SF_OP, 0); /* unlock SF */ | 903 | t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */ |
| 906 | 904 | ||
| 907 | /* Read the page to verify the write succeeded */ | 905 | /* Read the page to verify the write succeeded */ |
| 908 | ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, 1); | 906 | ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, 1); |
| @@ -918,7 +916,7 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 9 unmodified lines | |||
| 918 | return 0; | 916 | return 0; |
| 919 | 917 | ||
| 920 | unlock: | 918 | unlock: |
| 921 | t4_write_reg(adapter, SF_OP, 0); /* unlock SF */ | 919 | t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */ |
| 922 | return ret; | 920 | return ret; |
| 923 | } | 921 | } |
| 924 | 922 | ||
| @@ -950,6 +948,43 @@ int t4_get_tp_version(struct adapter *adapter, u32 *vers) · 25 unmodified lines | |||
| 950 | 1, vers, 0); | 948 | 1, vers, 0); |
| 951 | } | 949 | } |
| 952 | 950 | ||
| 951 | /** | ||
| 952 | * t4_get_exprom_version - return the Expansion ROM version (if any) | ||
| 953 | * @adapter: the adapter | ||
| 954 | * @vers: where to place the version | ||
| 955 | * | ||
| 956 | * Reads the Expansion ROM header from FLASH and returns the version | ||
| 957 | * number (if present) through the @vers return value pointer. We return | ||
| 958 | * this in the Firmware Version Format since it's convenient. Return | ||
| 959 | * 0 on success, -ENOENT if no Expansion ROM is present. | ||
| 960 | */ | ||
| 961 | int t4_get_exprom_version(struct adapter *adap, u32 *vers) | ||
| 962 | { | ||
| 963 | struct exprom_header { | ||
| 964 | unsigned char hdr_arr[16]; /* must start with 0x55aa */ | ||
| 965 | unsigned char hdr_ver[4]; /* Expansion ROM version */ | ||
| 966 | } *hdr; | ||
| 967 | u32 exprom_header_buf[DIV_ROUND_UP(sizeof(struct exprom_header), | ||
| 968 | sizeof(u32))]; | ||
| 969 | int ret; | ||
| 970 | |||
| 971 | ret = t4_read_flash(adap, FLASH_EXP_ROM_START, | ||
| 972 | ARRAY_SIZE(exprom_header_buf), exprom_header_buf, | ||
| 973 | 0); | ||
| 974 | if (ret) | ||
| 975 | return ret; | ||
| 976 | |||
| 977 | hdr = (struct exprom_header *)exprom_header_buf; | ||
| 978 | if (hdr->hdr_arr[0] != 0x55 || hdr->hdr_arr[1] != 0xaa) | ||
| 979 | return -ENOENT; | ||
| 980 | |||
| 981 | *vers = (FW_HDR_FW_VER_MAJOR_V(hdr->hdr_ver[0]) | | ||
| 982 | FW_HDR_FW_VER_MINOR_V(hdr->hdr_ver[1]) | | ||
| 983 | FW_HDR_FW_VER_MICRO_V(hdr->hdr_ver[2]) | | ||
| 984 | FW_HDR_FW_VER_BUILD_V(hdr->hdr_ver[3])); | ||
| 985 | return 0; | ||
| 986 | } | ||
| 987 | |||
| 953 | /* Is the given firmware API compatible with the one the driver was compiled | 988 | /* Is the given firmware API compatible with the one the driver was compiled |
| 954 | * with? | 989 | * with? |
| 955 | */ | 990 | */ |
| @@ -1113,7 +1148,7 @@ static int t4_flash_erase_sectors(struct adapter *adapter, int start, int end) · 157 unmodified lines | |||
| 1113 | } | 1148 | } |
| 1114 | start++; | 1149 | start++; |
| 1115 | } | 1150 | } |
| 1116 | t4_write_reg(adapter, SF_OP, 0); /* unlock SF */ | 1151 | t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */ |
| 1117 | return ret; | 1152 | return ret; |
| 1118 | } | 1153 | } |
| 1119 | 1154 | ||
| @@ -1241,6 +1276,45 @@ out: · 121 unmodified lines | |||
| 1241 | return ret; | 1276 | return ret; |
| 1242 | } | 1277 | } |
| 1243 | 1278 | ||
| 1279 | /** | ||
| 1280 | * t4_fwcache - firmware cache operation | ||
| 1281 | * @adap: the adapter | ||
| 1282 | * @op : the operation (flush or flush and invalidate) | ||
| 1283 | */ | ||
| 1284 | int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op) | ||
| 1285 | { | ||
| 1286 | struct fw_params_cmd c; | ||
| 1287 | |||
| 1288 | memset(&c, 0, sizeof(c)); | ||
| 1289 | c.op_to_vfn = | ||
| 1290 | cpu_to_be32(FW_CMD_OP_V(FW_PARAMS_CMD) | | ||
| 1291 | FW_CMD_REQUEST_F | FW_CMD_WRITE_F | | ||
| 1292 | FW_PARAMS_CMD_PFN_V(adap->fn) | | ||
| 1293 | FW_PARAMS_CMD_VFN_V(0)); | ||
| 1294 | c.retval_len16 = cpu_to_be32(FW_LEN16(c)); | ||
| 1295 | c.param[0].mnem = | ||
| 1296 | cpu_to_be32(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | | ||
| 1297 | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWCACHE)); | ||
| 1298 | c.param[0].val = (__force __be32)op; | ||
| 1299 | |||
| 1300 | return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL); | ||
| 1301 | } | ||
| 1302 | |||
| 1303 | void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf) | ||
| 1304 | { | ||
| 1305 | unsigned int i, j; | ||
| 1306 | |||
| 1307 | for (i = 0; i < 8; i++) { | ||
| 1308 | u32 *p = la_buf + i; | ||
| 1309 | |||
| 1310 | t4_write_reg(adap, ULP_RX_LA_CTL_A, i); | ||
| 1311 | j = t4_read_reg(adap, ULP_RX_LA_WRPTR_A); | ||
| 1312 | t4_write_reg(adap, ULP_RX_LA_RDPTR_A, j); | ||
| 1313 | for (j = 0; j < ULPRX_LA_SIZE; j++, p += 8) | ||
| 1314 | *p = t4_read_reg(adap, ULP_RX_LA_RDDATA_A); | ||
| 1315 | } | ||
| 1316 | } | ||
| 1317 | |||
| 1244 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ | 1318 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ |
| 1245 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ | 1319 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ |
| 1246 | FW_PORT_CAP_ANEG) | 1320 | FW_PORT_CAP_ANEG) |
| @@ -1365,95 +1439,97 @@ static int t4_handle_intr_status(struct adapter *adapter, unsigned int reg, · 118 unmodified lines | |||
| 1365 | static void pcie_intr_handler(struct adapter *adapter) | 1439 | static void pcie_intr_handler(struct adapter *adapter) |
| 1366 | { | 1440 | { |
| 1367 | static const struct intr_info sysbus_intr_info[] = { | 1441 | static const struct intr_info sysbus_intr_info[] = { |
| 1368 | { RNPP, "RXNP array parity error", -1, 1 }, | 1442 | { RNPP_F, "RXNP array parity error", -1, 1 }, |
| 1369 | { RPCP, "RXPC array parity error", -1, 1 }, | 1443 | { RPCP_F, "RXPC array parity error", -1, 1 }, |
| 1370 | { RCIP, "RXCIF array parity error", -1, 1 }, | 1444 | { RCIP_F, "RXCIF array parity error", -1, 1 }, |
| 1371 | { RCCP, "Rx completions control array parity error", -1, 1 }, | 1445 | { RCCP_F, "Rx completions control array parity error", -1, 1 }, |
| 1372 | { RFTP, "RXFT array parity error", -1, 1 }, | 1446 | { RFTP_F, "RXFT array parity error", -1, 1 }, |
| 1373 | { 0 } | 1447 | { 0 } |
| 1374 | }; | 1448 | }; |
| 1375 | static const struct intr_info pcie_port_intr_info[] = { | 1449 | static const struct intr_info pcie_port_intr_info[] = { |
| 1376 | { TPCP, "TXPC array parity error", -1, 1 }, | 1450 | { TPCP_F, "TXPC array parity error", -1, 1 }, |
| 1377 | { TNPP, "TXNP array parity error", -1, 1 }, | 1451 | { TNPP_F, "TXNP array parity error", -1, 1 }, |
| 1378 | { TFTP, "TXFT array parity error", -1, 1 }, | 1452 | { TFTP_F, "TXFT array parity error", -1, 1 }, |
| 1379 | { TCAP, "TXCA array parity error", -1, 1 }, | 1453 | { TCAP_F, "TXCA array parity error", -1, 1 }, |
| 1380 | { TCIP, "TXCIF array parity error", -1, 1 }, | 1454 | { TCIP_F, "TXCIF array parity error", -1, 1 }, |
| 1381 | { RCAP, "RXCA array parity error", -1, 1 }, | 1455 | { RCAP_F, "RXCA array parity error", -1, 1 }, |
| 1382 | { OTDD, "outbound request TLP discarded", -1, 1 }, | 1456 | { OTDD_F, "outbound request TLP discarded", -1, 1 }, |
| 1383 | { RDPE, "Rx data parity error", -1, 1 }, | 1457 | { RDPE_F, "Rx data parity error", -1, 1 }, |
| 1384 | { TDUE, "Tx uncorrectable data error", -1, 1 }, | 1458 | { TDUE_F, "Tx uncorrectable data error", -1, 1 }, |
| 1385 | { 0 } | 1459 | { 0 } |
| 1386 | }; | 1460 | }; |
| 1387 | static const struct intr_info pcie_intr_info[] = { | 1461 | static const struct intr_info pcie_intr_info[] = { |
| 1388 | { MSIADDRLPERR, "MSI AddrL parity error", -1, 1 }, | 1462 | { MSIADDRLPERR_F, "MSI AddrL parity error", -1, 1 }, |
| 1389 | { MSIADDRHPERR, "MSI AddrH parity error", -1, 1 }, | 1463 | { MSIADDRHPERR_F, "MSI AddrH parity error", -1, 1 }, |
| 1390 | { MSIDATAPERR, "MSI data parity error", -1, 1 }, | 1464 | { MSIDATAPERR_F, "MSI data parity error", -1, 1 }, |
| 1391 | { MSIXADDRLPERR, "MSI-X AddrL parity error", -1, 1 }, | 1465 | { MSIXADDRLPERR_F, "MSI-X AddrL parity error", -1, 1 }, |
| 1392 | { MSIXADDRHPERR, "MSI-X AddrH parity error", -1, 1 }, | 1466 | { MSIXADDRHPERR_F, "MSI-X AddrH parity error", -1, 1 }, |
| 1393 | { MSIXDATAPERR, "MSI-X data parity error", -1, 1 }, | 1467 | { MSIXDATAPERR_F, "MSI-X data parity error", -1, 1 }, |
| 1394 | { MSIXDIPERR, "MSI-X DI parity error", -1, 1 }, | 1468 | { MSIXDIPERR_F, "MSI-X DI parity error", -1, 1 }, |
| 1395 | { PIOCPLPERR, "PCI PIO completion FIFO parity error", -1, 1 }, | 1469 | { PIOCPLPERR_F, "PCI PIO completion FIFO parity error", -1, 1 }, |
| 1396 | { PIOREQPERR, "PCI PIO request FIFO parity error", -1, 1 }, | 1470 | { PIOREQPERR_F, "PCI PIO request FIFO parity error", -1, 1 }, |
| 1397 | { TARTAGPERR, "PCI PCI target tag FIFO parity error", -1, 1 }, | 1471 | { TARTAGPERR_F, "PCI PCI target tag FIFO parity error", -1, 1 }, |
| 1398 | { CCNTPERR, "PCI CMD channel count parity error", -1, 1 }, | 1472 | { CCNTPERR_F, "PCI CMD channel count parity error", -1, 1 }, |
| 1399 | { CREQPERR, "PCI CMD channel request parity error", -1, 1 }, | 1473 | { CREQPERR_F, "PCI CMD channel request parity error", -1, 1 }, |
| 1400 | { CRSPPERR, "PCI CMD channel response parity error", -1, 1 }, | 1474 | { CRSPPERR_F, "PCI CMD channel response parity error", -1, 1 }, |
| 1401 | { DCNTPERR, "PCI DMA channel count parity error", -1, 1 }, | 1475 | { DCNTPERR_F, "PCI DMA channel count parity error", -1, 1 }, |
| 1402 | { DREQPERR, "PCI DMA channel request parity error", -1, 1 }, | 1476 | { DREQPERR_F, "PCI DMA channel request parity error", -1, 1 }, |
| 1403 | { DRSPPERR, "PCI DMA channel response parity error", -1, 1 }, | 1477 | { DRSPPERR_F, "PCI DMA channel response parity error", -1, 1 }, |
| 1404 | { HCNTPERR, "PCI HMA channel count parity error", -1, 1 }, | 1478 | { HCNTPERR_F, "PCI HMA channel count parity error", -1, 1 }, |
| 1405 | { HREQPERR, "PCI HMA channel request parity error", -1, 1 }, | 1479 | { HREQPERR_F, "PCI HMA channel request parity error", -1, 1 }, |
| 1406 | { HRSPPERR, "PCI HMA channel response parity error", -1, 1 }, | 1480 | { HRSPPERR_F, "PCI HMA channel response parity error", -1, 1 }, |
| 1407 | { CFGSNPPERR, "PCI config snoop FIFO parity error", -1, 1 }, | 1481 | { CFGSNPPERR_F, "PCI config snoop FIFO parity error", -1, 1 }, |
| 1408 | { FIDPERR, "PCI FID parity error", -1, 1 }, | 1482 | { FIDPERR_F, "PCI FID parity error", -1, 1 }, |
| 1409 | { INTXCLRPERR, "PCI INTx clear parity error", -1, 1 }, | 1483 | { INTXCLRPERR_F, "PCI INTx clear parity error", -1, 1 }, |
| 1410 | { MATAGPERR, "PCI MA tag parity error", -1, 1 }, | 1484 | { MATAGPERR_F, "PCI MA tag parity error", -1, 1 }, |
| 1411 | { PIOTAGPERR, "PCI PIO tag parity error", -1, 1 }, | 1485 | { PIOTAGPERR_F, "PCI PIO tag parity error", -1, 1 }, |
| 1412 | { RXCPLPERR, "PCI Rx completion parity error", -1, 1 }, | 1486 | { RXCPLPERR_F, "PCI Rx completion parity error", -1, 1 }, |
| 1413 | { RXWRPERR, "PCI Rx write parity error", -1, 1 }, | 1487 | { RXWRPERR_F, "PCI Rx write parity error", -1, 1 }, |
| 1414 | { RPLPERR, "PCI replay buffer parity error", -1, 1 }, | 1488 | { RPLPERR_F, "PCI replay buffer parity error", -1, 1 }, |
| 1415 | { PCIESINT, "PCI core secondary fault", -1, 1 }, | 1489 | { PCIESINT_F, "PCI core secondary fault", -1, 1 }, |
| 1416 | { PCIEPINT, "PCI core primary fault", -1, 1 }, | 1490 | { PCIEPINT_F, "PCI core primary fault", -1, 1 }, |
| 1417 | { UNXSPLCPLERR, "PCI unexpected split completion error", -1, 0 }, | 1491 | { UNXSPLCPLERR_F, "PCI unexpected split completion error", |
| 1492 | -1, 0 }, | ||
| 1418 | { 0 } | 1493 | { 0 } |
| 1419 | }; | 1494 | }; |
| 1420 | 1495 | ||
| 1421 | static struct intr_info t5_pcie_intr_info[] = { | 1496 | static struct intr_info t5_pcie_intr_info[] = { |
| 1422 | { MSTGRPPERR, "Master Response Read Queue parity error", | 1497 | { MSTGRPPERR_F, "Master Response Read Queue parity error", |
| 1423 | -1, 1 }, | 1498 | -1, 1 }, |
| 1424 | { MSTTIMEOUTPERR, "Master Timeout FIFO parity error", -1, 1 }, | 1499 | { MSTTIMEOUTPERR_F, "Master Timeout FIFO parity error", -1, 1 }, |
| 1425 | { MSIXSTIPERR, "MSI-X STI SRAM parity error", -1, 1 }, | 1500 | { MSIXSTIPERR_F, "MSI-X STI SRAM parity error", -1, 1 }, |
| 1426 | { MSIXADDRLPERR, "MSI-X AddrL parity error", -1, 1 }, | 1501 | { MSIXADDRLPERR_F, "MSI-X AddrL parity error", -1, 1 }, |
| 1427 | { MSIXADDRHPERR, "MSI-X AddrH parity error", -1, 1 }, | 1502 | { MSIXADDRHPERR_F, "MSI-X AddrH parity error", -1, 1 }, |
| 1428 | { MSIXDATAPERR, "MSI-X data parity error", -1, 1 }, | 1503 | { MSIXDATAPERR_F, "MSI-X data parity error", -1, 1 }, |
| 1429 | { MSIXDIPERR, "MSI-X DI parity error", -1, 1 }, | 1504 | { MSIXDIPERR_F, "MSI-X DI parity error", -1, 1 }, |
| 1430 | { PIOCPLGRPPERR, "PCI PIO completion Group FIFO parity error", | 1505 | { PIOCPLGRPPERR_F, "PCI PIO completion Group FIFO parity error", |
| 1431 | -1, 1 }, | 1506 | -1, 1 }, |
| 1432 | { PIOREQGRPPERR, "PCI PIO request Group FIFO parity error", | 1507 | { PIOREQGRPPERR_F, "PCI PIO request Group FIFO parity error", |
| 1433 | -1, 1 }, | 1508 | -1, 1 }, |
| 1434 | { TARTAGPERR, "PCI PCI target tag FIFO parity error", -1, 1 }, | 1509 | { TARTAGPERR_F, "PCI PCI target tag FIFO parity error", -1, 1 }, |
| 1435 | { MSTTAGQPERR, "PCI master tag queue parity error", -1, 1 }, | 1510 | { MSTTAGQPERR_F, "PCI master tag queue parity error", -1, 1 }, |
| 1436 | { CREQPERR, "PCI CMD channel request parity error", -1, 1 }, | 1511 | { CREQPERR_F, "PCI CMD channel request parity error", -1, 1 }, |
| 1437 | { CRSPPERR, "PCI CMD channel response parity error", -1, 1 }, | 1512 | { CRSPPERR_F, "PCI CMD channel response parity error", -1, 1 }, |
| 1438 | { DREQWRPERR, "PCI DMA channel write request parity error", | 1513 | { DREQWRPERR_F, "PCI DMA channel write request parity error", |
| 1439 | -1, 1 }, | 1514 | -1, 1 }, |
| 1440 | { DREQPERR, "PCI DMA channel request parity error", -1, 1 }, | 1515 | { DREQPERR_F, "PCI DMA channel request parity error", -1, 1 }, |
| 1441 | { DRSPPERR, "PCI DMA channel response parity error", -1, 1 }, | 1516 | { DRSPPERR_F, "PCI DMA channel response parity error", -1, 1 }, |
| 1442 | { HREQWRPERR, "PCI HMA channel count parity error", -1, 1 }, | 1517 | { HREQWRPERR_F, "PCI HMA channel count parity error", -1, 1 }, |
| 1443 | { HREQPERR, "PCI HMA channel request parity error", -1, 1 }, | 1518 | { HREQPERR_F, "PCI HMA channel request parity error", -1, 1 }, |
| 1444 | { HRSPPERR, "PCI HMA channel response parity error", -1, 1 }, | 1519 | { HRSPPERR_F, "PCI HMA channel response parity error", -1, 1 }, |
| 1445 | { CFGSNPPERR, "PCI config snoop FIFO parity error", -1, 1 }, | 1520 | { CFGSNPPERR_F, "PCI config snoop FIFO parity error", -1, 1 }, |
| 1446 | { FIDPERR, "PCI FID parity error", -1, 1 }, | 1521 | { FIDPERR_F, "PCI FID parity error", -1, 1 }, |
| 1447 | { VFIDPERR, "PCI INTx clear parity error", -1, 1 }, | 1522 | { VFIDPERR_F, "PCI INTx clear parity error", -1, 1 }, |
| 1448 | { MAGRPPERR, "PCI MA group FIFO parity error", -1, 1 }, | 1523 | { MAGRPPERR_F, "PCI MA group FIFO parity error", -1, 1 }, |
| 1449 | { PIOTAGPERR, "PCI PIO tag parity error", -1, 1 }, | 1524 | { PIOTAGPERR_F, "PCI PIO tag parity error", -1, 1 }, |
| 1450 | { IPRXHDRGRPPERR, "PCI IP Rx header group parity error", | 1525 | { IPRXHDRGRPPERR_F, "PCI IP Rx header group parity error", |
| 1451 | -1, 1 }, | 1526 | -1, 1 }, |
| 1452 | { IPRXDATAGRPPERR, "PCI IP Rx data group parity error", -1, 1 }, | 1527 | { IPRXDATAGRPPERR_F, "PCI IP Rx data group parity error", |
| 1453 | { RPLPERR, "PCI IP replay buffer parity error", -1, 1 }, | 1528 | -1, 1 }, |
| 1454 | { IPSOTPERR, "PCI IP SOT buffer parity error", -1, 1 }, | 1529 | { RPLPERR_F, "PCI IP replay buffer parity error", -1, 1 }, |
| 1455 | { TRGT1GRPPERR, "PCI TRGT1 group FIFOs parity error", -1, 1 }, | 1530 | { IPSOTPERR_F, "PCI IP SOT buffer parity error", -1, 1 }, |
| 1456 | { READRSPERR, "Outbound read error", -1, 0 }, | 1531 | { TRGT1GRPPERR_F, "PCI TRGT1 group FIFOs parity error", -1, 1 }, |
| 1532 | { READRSPERR_F, "Outbound read error", -1, 0 }, | ||
| 1457 | { 0 } | 1533 | { 0 } |
| 1458 | }; | 1534 | }; |
| 1459 | 1535 | ||
| @@ -1461,15 +1537,15 @@ static void pcie_intr_handler(struct adapter *adapter) · 1 unmodified line | |||
| 1461 | 1537 | ||
| 1462 | if (is_t4(adapter->params.chip)) | 1538 | if (is_t4(adapter->params.chip)) |
| 1463 | fat = t4_handle_intr_status(adapter, | 1539 | fat = t4_handle_intr_status(adapter, |
| 1464 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | 1540 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS_A, |
| 1465 | sysbus_intr_info) + | 1541 | sysbus_intr_info) + |
| 1466 | t4_handle_intr_status(adapter, | 1542 | t4_handle_intr_status(adapter, |
| 1467 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | 1543 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS_A, |
| 1468 | pcie_port_intr_info) + | 1544 | pcie_port_intr_info) + |
| 1469 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | 1545 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE_A, |
| 1470 | pcie_intr_info); | 1546 | pcie_intr_info); |
| 1471 | else | 1547 | else |
| 1472 | fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | 1548 | fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE_A, |
| 1473 | t5_pcie_intr_info); | 1549 | t5_pcie_intr_info); |
| 1474 | 1550 | ||
| 1475 | if (fat) | 1551 | if (fat) |
| @@ -1483,11 +1559,11 @@ static void tp_intr_handler(struct adapter *adapter) · 7 unmodified lines | |||
| 1483 | { | 1559 | { |
| 1484 | static const struct intr_info tp_intr_info[] = { | 1560 | static const struct intr_info tp_intr_info[] = { |
| 1485 | { 0x3fffffff, "TP parity error", -1, 1 }, | 1561 | { 0x3fffffff, "TP parity error", -1, 1 }, |
| 1486 | { FLMTXFLSTEMPTY, "TP out of Tx pages", -1, 1 }, | 1562 | { FLMTXFLSTEMPTY_F, "TP out of Tx pages", -1, 1 }, |
| 1487 | { 0 } | 1563 | { 0 } |
| 1488 | }; | 1564 | }; |
| 1489 | 1565 | ||
| 1490 | if (t4_handle_intr_status(adapter, TP_INT_CAUSE, tp_intr_info)) | 1566 | if (t4_handle_intr_status(adapter, TP_INT_CAUSE_A, tp_intr_info)) |
| 1491 | t4_fatal_err(adapter); | 1567 | t4_fatal_err(adapter); |
| 1492 | } | 1568 | } |
| 1493 | 1569 | ||
| @@ -1499,102 +1575,107 @@ static void sge_intr_handler(struct adapter *adapter) · 5 unmodified lines | |||
| 1499 | u64 v; | 1575 | u64 v; |
| 1500 | 1576 | ||
| 1501 | static const struct intr_info sge_intr_info[] = { | 1577 | static const struct intr_info sge_intr_info[] = { |
| 1502 | { ERR_CPL_EXCEED_IQE_SIZE, | 1578 | { ERR_CPL_EXCEED_IQE_SIZE_F, |
| 1503 | "SGE received CPL exceeding IQE size", -1, 1 }, | 1579 | "SGE received CPL exceeding IQE size", -1, 1 }, |
| 1504 | { ERR_INVALID_CIDX_INC, | 1580 | { ERR_INVALID_CIDX_INC_F, |
| 1505 | "SGE GTS CIDX increment too large", -1, 0 }, | 1581 | "SGE GTS CIDX increment too large", -1, 0 }, |
| 1506 | { ERR_CPL_OPCODE_0, "SGE received 0-length CPL", -1, 0 }, | 1582 | { ERR_CPL_OPCODE_0_F, "SGE received 0-length CPL", -1, 0 }, |
| 1507 | { DBFIFO_LP_INT, NULL, -1, 0, t4_db_full }, | 1583 | { DBFIFO_LP_INT_F, NULL, -1, 0, t4_db_full }, |
| 1508 | { DBFIFO_HP_INT, NULL, -1, 0, t4_db_full }, | 1584 | { DBFIFO_HP_INT_F, NULL, -1, 0, t4_db_full }, |
| 1509 | { ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped }, | 1585 | { ERR_DROPPED_DB_F, NULL, -1, 0, t4_db_dropped }, |
| 1510 | { ERR_DATA_CPL_ON_HIGH_QID1 | ERR_DATA_CPL_ON_HIGH_QID0, | 1586 | { ERR_DATA_CPL_ON_HIGH_QID1_F | ERR_DATA_CPL_ON_HIGH_QID0_F, |
| 1511 | "SGE IQID > 1023 received CPL for FL", -1, 0 }, | 1587 | "SGE IQID > 1023 received CPL for FL", -1, 0 }, |
| 1512 | { ERR_BAD_DB_PIDX3, "SGE DBP 3 pidx increment too large", -1, | 1588 | { ERR_BAD_DB_PIDX3_F, "SGE DBP 3 pidx increment too large", -1, |
| 1513 | 0 }, | 1589 | 0 }, |
| 1514 | { ERR_BAD_DB_PIDX2, "SGE DBP 2 pidx increment too large", -1, | 1590 | { ERR_BAD_DB_PIDX2_F, "SGE DBP 2 pidx increment too large", -1, |
| 1515 | 0 }, | 1591 | 0 }, |
| 1516 | { ERR_BAD_DB_PIDX1, "SGE DBP 1 pidx increment too large", -1, | 1592 | { ERR_BAD_DB_PIDX1_F, "SGE DBP 1 pidx increment too large", -1, |
| 1517 | 0 }, | 1593 | 0 }, |
| 1518 | { ERR_BAD_DB_PIDX0, "SGE DBP 0 pidx increment too large", -1, | 1594 | { ERR_BAD_DB_PIDX0_F, "SGE DBP 0 pidx increment too large", -1, |
| 1519 | 0 }, | 1595 | 0 }, |
| 1520 | { ERR_ING_CTXT_PRIO, | 1596 | { ERR_ING_CTXT_PRIO_F, |
| 1521 | "SGE too many priority ingress contexts", -1, 0 }, | 1597 | "SGE too many priority ingress contexts", -1, 0 }, |
| 1522 | { ERR_EGR_CTXT_PRIO, | 1598 | { ERR_EGR_CTXT_PRIO_F, |
| 1523 | "SGE too many priority egress contexts", -1, 0 }, | 1599 | "SGE too many priority egress contexts", -1, 0 }, |
| 1524 | { INGRESS_SIZE_ERR, "SGE illegal ingress QID", -1, 0 }, | 1600 | { INGRESS_SIZE_ERR_F, "SGE illegal ingress QID", -1, 0 }, |
| 1525 | { EGRESS_SIZE_ERR, "SGE illegal egress QID", -1, 0 }, | 1601 | { EGRESS_SIZE_ERR_F, "SGE illegal egress QID", -1, 0 }, |
| 1526 | { 0 } | 1602 | { 0 } |
| 1527 | }; | 1603 | }; |
| 1528 | 1604 | ||
| 1529 | v = (u64)t4_read_reg(adapter, SGE_INT_CAUSE1) | | 1605 | v = (u64)t4_read_reg(adapter, SGE_INT_CAUSE1_A) | |
| 1530 | ((u64)t4_read_reg(adapter, SGE_INT_CAUSE2) << 32); | 1606 | ((u64)t4_read_reg(adapter, SGE_INT_CAUSE2_A) << 32); |
| 1531 | if (v) { | 1607 | if (v) { |
| 1532 | dev_alert(adapter->pdev_dev, "SGE parity error (%#llx)\n", | 1608 | dev_alert(adapter->pdev_dev, "SGE parity error (%#llx)\n", |
| 1533 | (unsigned long long)v); | 1609 | (unsigned long long)v); |
| 1534 | t4_write_reg(adapter, SGE_INT_CAUSE1, v); | 1610 | t4_write_reg(adapter, SGE_INT_CAUSE1_A, v); |
| 1535 | t4_write_reg(adapter, SGE_INT_CAUSE2, v >> 32); | 1611 | t4_write_reg(adapter, SGE_INT_CAUSE2_A, v >> 32); |
| 1536 | } | 1612 | } |
| 1537 | 1613 | ||
| 1538 | if (t4_handle_intr_status(adapter, SGE_INT_CAUSE3, sge_intr_info) || | 1614 | if (t4_handle_intr_status(adapter, SGE_INT_CAUSE3_A, sge_intr_info) || |
| 1539 | v != 0) | 1615 | v != 0) |
| 1540 | t4_fatal_err(adapter); | 1616 | t4_fatal_err(adapter); |
| 1541 | } | 1617 | } |
| 1542 | 1618 | ||
| 1619 | #define CIM_OBQ_INTR (OBQULP0PARERR_F | OBQULP1PARERR_F | OBQULP2PARERR_F |\ | ||
| 1620 | OBQULP3PARERR_F | OBQSGEPARERR_F | OBQNCSIPARERR_F) | ||
| 1621 | #define CIM_IBQ_INTR (IBQTP0PARERR_F | IBQTP1PARERR_F | IBQULPPARERR_F |\ | ||
| 1622 | IBQSGEHIPARERR_F | IBQSGELOPARERR_F | IBQNCSIPARERR_F) | ||
| 1623 | |||
| 1543 | /* | 1624 | /* |
| 1544 | * CIM interrupt handler. | 1625 | * CIM interrupt handler. |
| 1545 | */ | 1626 | */ |
| 1546 | static void cim_intr_handler(struct adapter *adapter) | 1627 | static void cim_intr_handler(struct adapter *adapter) |
| 1547 | { | 1628 | { |
| 1548 | static const struct intr_info cim_intr_info[] = { | 1629 | static const struct intr_info cim_intr_info[] = { |
| 1549 | { PREFDROPINT, "CIM control register prefetch drop", -1, 1 }, | 1630 | { PREFDROPINT_F, "CIM control register prefetch drop", -1, 1 }, |
| 1550 | { OBQPARERR, "CIM OBQ parity error", -1, 1 }, | 1631 | { CIM_OBQ_INTR, "CIM OBQ parity error", -1, 1 }, |
| 1551 | { IBQPARERR, "CIM IBQ parity error", -1, 1 }, | 1632 | { CIM_IBQ_INTR, "CIM IBQ parity error", -1, 1 }, |
| 1552 | { MBUPPARERR, "CIM mailbox uP parity error", -1, 1 }, | 1633 | { MBUPPARERR_F, "CIM mailbox uP parity error", -1, 1 }, |
| 1553 | { MBHOSTPARERR, "CIM mailbox host parity error", -1, 1 }, | 1634 | { MBHOSTPARERR_F, "CIM mailbox host parity error", -1, 1 }, |
| 1554 | { TIEQINPARERRINT, "CIM TIEQ outgoing parity error", -1, 1 }, | 1635 | { TIEQINPARERRINT_F, "CIM TIEQ outgoing parity error", -1, 1 }, |
| 1555 | { TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 }, | 1636 | { TIEQOUTPARERRINT_F, "CIM TIEQ incoming parity error", -1, 1 }, |
| 1556 | { 0 } | 1637 | { 0 } |
| 1557 | }; | 1638 | }; |
| 1558 | static const struct intr_info cim_upintr_info[] = { | 1639 | static const struct intr_info cim_upintr_info[] = { |
| 1559 | { RSVDSPACEINT, "CIM reserved space access", -1, 1 }, | 1640 | { RSVDSPACEINT_F, "CIM reserved space access", -1, 1 }, |
| 1560 | { ILLTRANSINT, "CIM illegal transaction", -1, 1 }, | 1641 | { ILLTRANSINT_F, "CIM illegal transaction", -1, 1 }, |
| 1561 | { ILLWRINT, "CIM illegal write", -1, 1 }, | 1642 | { ILLWRINT_F, "CIM illegal write", -1, 1 }, |
| 1562 | { ILLRDINT, "CIM illegal read", -1, 1 }, | 1643 | { ILLRDINT_F, "CIM illegal read", -1, 1 }, |
| 1563 | { ILLRDBEINT, "CIM illegal read BE", -1, 1 }, | 1644 | { ILLRDBEINT_F, "CIM illegal read BE", -1, 1 }, |
| 1564 | { ILLWRBEINT, "CIM illegal write BE", -1, 1 }, | 1645 | { ILLWRBEINT_F, "CIM illegal write BE", -1, 1 }, |
| 1565 | { SGLRDBOOTINT, "CIM single read from boot space", -1, 1 }, | 1646 | { SGLRDBOOTINT_F, "CIM single read from boot space", -1, 1 }, |
| 1566 | { SGLWRBOOTINT, "CIM single write to boot space", -1, 1 }, | 1647 | { SGLWRBOOTINT_F, "CIM single write to boot space", -1, 1 }, |
| 1567 | { BLKWRBOOTINT, "CIM block write to boot space", -1, 1 }, | 1648 | { BLKWRBOOTINT_F, "CIM block write to boot space", -1, 1 }, |
| 1568 | { SGLRDFLASHINT, "CIM single read from flash space", -1, 1 }, | 1649 | { SGLRDFLASHINT_F, "CIM single read from flash space", -1, 1 }, |
| 1569 | { SGLWRFLASHINT, "CIM single write to flash space", -1, 1 }, | 1650 | { SGLWRFLASHINT_F, "CIM single write to flash space", -1, 1 }, |
| 1570 | { BLKWRFLASHINT, "CIM block write to flash space", -1, 1 }, | 1651 | { BLKWRFLASHINT_F, "CIM block write to flash space", -1, 1 }, |
| 1571 | { SGLRDEEPROMINT, "CIM single EEPROM read", -1, 1 }, | 1652 | { SGLRDEEPROMINT_F, "CIM single EEPROM read", -1, 1 }, |
| 1572 | { SGLWREEPROMINT, "CIM single EEPROM write", -1, 1 }, | 1653 | { SGLWREEPROMINT_F, "CIM single EEPROM write", -1, 1 }, |
| 1573 | { BLKRDEEPROMINT, "CIM block EEPROM read", -1, 1 }, | 1654 | { BLKRDEEPROMINT_F, "CIM block EEPROM read", -1, 1 }, |
| 1574 | { BLKWREEPROMINT, "CIM block EEPROM write", -1, 1 }, | 1655 | { BLKWREEPROMINT_F, "CIM block EEPROM write", -1, 1 }, |
| 1575 | { SGLRDCTLINT , "CIM single read from CTL space", -1, 1 }, | 1656 | { SGLRDCTLINT_F, "CIM single read from CTL space", -1, 1 }, |
| 1576 | { SGLWRCTLINT , "CIM single write to CTL space", -1, 1 }, | 1657 | { SGLWRCTLINT_F, "CIM single write to CTL space", -1, 1 }, |
| 1577 | { BLKRDCTLINT , "CIM block read from CTL space", -1, 1 }, | 1658 | { BLKRDCTLINT_F, "CIM block read from CTL space", -1, 1 }, |
| 1578 | { BLKWRCTLINT , "CIM block write to CTL space", -1, 1 }, | 1659 | { BLKWRCTLINT_F, "CIM block write to CTL space", -1, 1 }, |
| 1579 | { SGLRDPLINT , "CIM single read from PL space", -1, 1 }, | 1660 | { SGLRDPLINT_F, "CIM single read from PL space", -1, 1 }, |
| 1580 | { SGLWRPLINT , "CIM single write to PL space", -1, 1 }, | 1661 | { SGLWRPLINT_F, "CIM single write to PL space", -1, 1 }, |
| 1581 | { BLKRDPLINT , "CIM block read from PL space", -1, 1 }, | 1662 | { BLKRDPLINT_F, "CIM block read from PL space", -1, 1 }, |
| 1582 | { BLKWRPLINT , "CIM block write to PL space", -1, 1 }, | 1663 | { BLKWRPLINT_F, "CIM block write to PL space", -1, 1 }, |
| 1583 | { REQOVRLOOKUPINT , "CIM request FIFO overwrite", -1, 1 }, | 1664 | { REQOVRLOOKUPINT_F, "CIM request FIFO overwrite", -1, 1 }, |
| 1584 | { RSPOVRLOOKUPINT , "CIM response FIFO overwrite", -1, 1 }, | 1665 | { RSPOVRLOOKUPINT_F, "CIM response FIFO overwrite", -1, 1 }, |
| 1585 | { TIMEOUTINT , "CIM PIF timeout", -1, 1 }, | 1666 | { TIMEOUTINT_F, "CIM PIF timeout", -1, 1 }, |
| 1586 | { TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 }, | 1667 | { TIMEOUTMAINT_F, "CIM PIF MA timeout", -1, 1 }, |
| 1587 | { 0 } | 1668 | { 0 } |
| 1588 | }; | 1669 | }; |
| 1589 | 1670 | ||
| 1590 | int fat; | 1671 | int fat; |
| 1591 | 1672 | ||
| 1592 | if (t4_read_reg(adapter, MA_PCIE_FW) & PCIE_FW_ERR) | 1673 | if (t4_read_reg(adapter, PCIE_FW_A) & PCIE_FW_ERR_F) |
| 1593 | t4_report_fw_error(adapter); | 1674 | t4_report_fw_error(adapter); |
| 1594 | 1675 | ||
| 1595 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, | 1676 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE_A, |
| 1596 | cim_intr_info) + | 1677 | cim_intr_info) + |
| 1597 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, | 1678 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE_A, |
| 1598 | cim_upintr_info); | 1679 | cim_upintr_info); |
| 1599 | if (fat) | 1680 | if (fat) |
| 1600 | t4_fatal_err(adapter); | 1681 | t4_fatal_err(adapter); |
| @@ -1611,7 +1692,7 @@ static void ulprx_intr_handler(struct adapter *adapter) · 10 unmodified lines | |||
| 1611 | { 0 } | 1692 | { 0 } |
| 1612 | }; | 1693 | }; |
| 1613 | 1694 | ||
| 1614 | if (t4_handle_intr_status(adapter, ULP_RX_INT_CAUSE, ulprx_intr_info)) | 1695 | if (t4_handle_intr_status(adapter, ULP_RX_INT_CAUSE_A, ulprx_intr_info)) |
| 1615 | t4_fatal_err(adapter); | 1696 | t4_fatal_err(adapter); |
| 1616 | } | 1697 | } |
| 1617 | 1698 | ||
| @@ -1621,19 +1702,19 @@ static void ulprx_intr_handler(struct adapter *adapter) · 3 unmodified lines | |||
| 1621 | static void ulptx_intr_handler(struct adapter *adapter) | 1702 | static void ulptx_intr_handler(struct adapter *adapter) |
| 1622 | { | 1703 | { |
| 1623 | static const struct intr_info ulptx_intr_info[] = { | 1704 | static const struct intr_info ulptx_intr_info[] = { |
| 1624 | { PBL_BOUND_ERR_CH3, "ULPTX channel 3 PBL out of bounds", -1, | 1705 | { PBL_BOUND_ERR_CH3_F, "ULPTX channel 3 PBL out of bounds", -1, |
| 1625 | 0 }, | 1706 | 0 }, |
| 1626 | { PBL_BOUND_ERR_CH2, "ULPTX channel 2 PBL out of bounds", -1, | 1707 | { PBL_BOUND_ERR_CH2_F, "ULPTX channel 2 PBL out of bounds", -1, |
| 1627 | 0 }, | 1708 | 0 }, |
| 1628 | { PBL_BOUND_ERR_CH1, "ULPTX channel 1 PBL out of bounds", -1, | 1709 | { PBL_BOUND_ERR_CH1_F, "ULPTX channel 1 PBL out of bounds", -1, |
| 1629 | 0 }, | 1710 | 0 }, |
| 1630 | { PBL_BOUND_ERR_CH0, "ULPTX channel 0 PBL out of bounds", -1, | 1711 | { PBL_BOUND_ERR_CH0_F, "ULPTX channel 0 PBL out of bounds", -1, |
| 1631 | 0 }, | 1712 | 0 }, |
| 1632 | { 0xfffffff, "ULPTX parity error", -1, 1 }, | 1713 | { 0xfffffff, "ULPTX parity error", -1, 1 }, |
| 1633 | { 0 } | 1714 | { 0 } |
| 1634 | }; | 1715 | }; |
| 1635 | 1716 | ||
| 1636 | if (t4_handle_intr_status(adapter, ULP_TX_INT_CAUSE, ulptx_intr_info)) | 1717 | if (t4_handle_intr_status(adapter, ULP_TX_INT_CAUSE_A, ulptx_intr_info)) |
| 1637 | t4_fatal_err(adapter); | 1718 | t4_fatal_err(adapter); |
| 1638 | } | 1719 | } |
| 1639 | 1720 | ||
| @@ -1643,19 +1724,20 @@ static void ulptx_intr_handler(struct adapter *adapter) · 3 unmodified lines | |||
| 1643 | static void pmtx_intr_handler(struct adapter *adapter) | 1724 | static void pmtx_intr_handler(struct adapter *adapter) |
| 1644 | { | 1725 | { |
| 1645 | static const struct intr_info pmtx_intr_info[] = { | 1726 | static const struct intr_info pmtx_intr_info[] = { |
| 1646 | { PCMD_LEN_OVFL0, "PMTX channel 0 pcmd too large", -1, 1 }, | 1727 | { PCMD_LEN_OVFL0_F, "PMTX channel 0 pcmd too large", -1, 1 }, |
| 1647 | { PCMD_LEN_OVFL1, "PMTX channel 1 pcmd too large", -1, 1 }, | 1728 | { PCMD_LEN_OVFL1_F, "PMTX channel 1 pcmd too large", -1, 1 }, |
| 1648 | { PCMD_LEN_OVFL2, "PMTX channel 2 pcmd too large", -1, 1 }, | 1729 | { PCMD_LEN_OVFL2_F, "PMTX channel 2 pcmd too large", -1, 1 }, |
| 1649 | { ZERO_C_CMD_ERROR, "PMTX 0-length pcmd", -1, 1 }, | 1730 | { ZERO_C_CMD_ERROR_F, "PMTX 0-length pcmd", -1, 1 }, |
| 1650 | { PMTX_FRAMING_ERROR, "PMTX framing error", -1, 1 }, | 1731 | { PMTX_FRAMING_ERROR_F, "PMTX framing error", -1, 1 }, |
| 1651 | { OESPI_PAR_ERROR, "PMTX oespi parity error", -1, 1 }, | 1732 | { OESPI_PAR_ERROR_F, "PMTX oespi parity error", -1, 1 }, |
| 1652 | { DB_OPTIONS_PAR_ERROR, "PMTX db_options parity error", -1, 1 }, | 1733 | { DB_OPTIONS_PAR_ERROR_F, "PMTX db_options parity error", |
| 1653 | { ICSPI_PAR_ERROR, "PMTX icspi parity error", -1, 1 }, | 1734 | -1, 1 }, |
| 1654 | { C_PCMD_PAR_ERROR, "PMTX c_pcmd parity error", -1, 1}, | 1735 | { ICSPI_PAR_ERROR_F, "PMTX icspi parity error", -1, 1 }, |
| 1736 | { PMTX_C_PCMD_PAR_ERROR_F, "PMTX c_pcmd parity error", -1, 1}, | ||
| 1655 | { 0 } | 1737 | { 0 } |
| 1656 | }; | 1738 | }; |
| 1657 | 1739 | ||
| 1658 | if (t4_handle_intr_status(adapter, PM_TX_INT_CAUSE, pmtx_intr_info)) | 1740 | if (t4_handle_intr_status(adapter, PM_TX_INT_CAUSE_A, pmtx_intr_info)) |
| 1659 | t4_fatal_err(adapter); | 1741 | t4_fatal_err(adapter); |
| 1660 | } | 1742 | } |
| 1661 | 1743 | ||
| @@ -1665,16 +1747,17 @@ static void pmtx_intr_handler(struct adapter *adapter) · 3 unmodified lines | |||
| 1665 | static void pmrx_intr_handler(struct adapter *adapter) | 1747 | static void pmrx_intr_handler(struct adapter *adapter) |
| 1666 | { | 1748 | { |
| 1667 | static const struct intr_info pmrx_intr_info[] = { | 1749 | static const struct intr_info pmrx_intr_info[] = { |
| 1668 | { ZERO_E_CMD_ERROR, "PMRX 0-length pcmd", -1, 1 }, | 1750 | { ZERO_E_CMD_ERROR_F, "PMRX 0-length pcmd", -1, 1 }, |
| 1669 | { PMRX_FRAMING_ERROR, "PMRX framing error", -1, 1 }, | 1751 | { PMRX_FRAMING_ERROR_F, "PMRX framing error", -1, 1 }, |
| 1670 | { OCSPI_PAR_ERROR, "PMRX ocspi parity error", -1, 1 }, | 1752 | { OCSPI_PAR_ERROR_F, "PMRX ocspi parity error", -1, 1 }, |
| 1671 | { DB_OPTIONS_PAR_ERROR, "PMRX db_options parity error", -1, 1 }, | 1753 | { DB_OPTIONS_PAR_ERROR_F, "PMRX db_options parity error", |
| 1672 | { IESPI_PAR_ERROR, "PMRX iespi parity error", -1, 1 }, | 1754 | -1, 1 }, |
| 1673 | { E_PCMD_PAR_ERROR, "PMRX e_pcmd parity error", -1, 1}, | 1755 | { IESPI_PAR_ERROR_F, "PMRX iespi parity error", -1, 1 }, |
| 1756 | { PMRX_E_PCMD_PAR_ERROR_F, "PMRX e_pcmd parity error", -1, 1}, | ||
| 1674 | { 0 } | 1757 | { 0 } |
| 1675 | }; | 1758 | }; |
| 1676 | 1759 | ||
| 1677 | if (t4_handle_intr_status(adapter, PM_RX_INT_CAUSE, pmrx_intr_info)) | 1760 | if (t4_handle_intr_status(adapter, PM_RX_INT_CAUSE_A, pmrx_intr_info)) |
| 1678 | t4_fatal_err(adapter); | 1761 | t4_fatal_err(adapter); |
| 1679 | } | 1762 | } |
| 1680 | 1763 | ||
| @@ -1684,16 +1767,16 @@ static void pmrx_intr_handler(struct adapter *adapter) · 3 unmodified lines | |||
| 1684 | static void cplsw_intr_handler(struct adapter *adapter) | 1767 | static void cplsw_intr_handler(struct adapter *adapter) |
| 1685 | { | 1768 | { |
| 1686 | static const struct intr_info cplsw_intr_info[] = { | 1769 | static const struct intr_info cplsw_intr_info[] = { |
| 1687 | { CIM_OP_MAP_PERR, "CPLSW CIM op_map parity error", -1, 1 }, | 1770 | { CIM_OP_MAP_PERR_F, "CPLSW CIM op_map parity error", -1, 1 }, |
| 1688 | { CIM_OVFL_ERROR, "CPLSW CIM overflow", -1, 1 }, | 1771 | { CIM_OVFL_ERROR_F, "CPLSW CIM overflow", -1, 1 }, |
| 1689 | { TP_FRAMING_ERROR, "CPLSW TP framing error", -1, 1 }, | 1772 | { TP_FRAMING_ERROR_F, "CPLSW TP framing error", -1, 1 }, |
| 1690 | { SGE_FRAMING_ERROR, "CPLSW SGE framing error", -1, 1 }, | 1773 | { SGE_FRAMING_ERROR_F, "CPLSW SGE framing error", -1, 1 }, |
| 1691 | { CIM_FRAMING_ERROR, "CPLSW CIM framing error", -1, 1 }, | 1774 | { CIM_FRAMING_ERROR_F, "CPLSW CIM framing error", -1, 1 }, |
| 1692 | { ZERO_SWITCH_ERROR, "CPLSW no-switch error", -1, 1 }, | 1775 | { ZERO_SWITCH_ERROR_F, "CPLSW no-switch error", -1, 1 }, |
| 1693 | { 0 } | 1776 | { 0 } |
| 1694 | }; | 1777 | }; |
| 1695 | 1778 | ||
| 1696 | if (t4_handle_intr_status(adapter, CPL_INTR_CAUSE, cplsw_intr_info)) | 1779 | if (t4_handle_intr_status(adapter, CPL_INTR_CAUSE_A, cplsw_intr_info)) |
| 1697 | t4_fatal_err(adapter); | 1780 | t4_fatal_err(adapter); |
| 1698 | } | 1781 | } |
| 1699 | 1782 | ||
| @@ -1703,15 +1786,15 @@ static void cplsw_intr_handler(struct adapter *adapter) · 3 unmodified lines | |||
| 1703 | static void le_intr_handler(struct adapter *adap) | 1786 | static void le_intr_handler(struct adapter *adap) |
| 1704 | { | 1787 | { |
| 1705 | static const struct intr_info le_intr_info[] = { | 1788 | static const struct intr_info le_intr_info[] = { |
| 1706 | { LIPMISS, "LE LIP miss", -1, 0 }, | 1789 | { LIPMISS_F, "LE LIP miss", -1, 0 }, |
| 1707 | { LIP0, "LE 0 LIP error", -1, 0 }, | 1790 | { LIP0_F, "LE 0 LIP error", -1, 0 }, |
| 1708 | { PARITYERR, "LE parity error", -1, 1 }, | 1791 | { PARITYERR_F, "LE parity error", -1, 1 }, |
| 1709 | { UNKNOWNCMD, "LE unknown command", -1, 1 }, | 1792 | { UNKNOWNCMD_F, "LE unknown command", -1, 1 }, |
| 1710 | { REQQPARERR, "LE request queue parity error", -1, 1 }, | 1793 | { REQQPARERR_F, "LE request queue parity error", -1, 1 }, |
| 1711 | { 0 } | 1794 | { 0 } |
| 1712 | }; | 1795 | }; |
| 1713 | 1796 | ||
| 1714 | if (t4_handle_intr_status(adap, LE_DB_INT_CAUSE, le_intr_info)) | 1797 | if (t4_handle_intr_status(adap, LE_DB_INT_CAUSE_A, le_intr_info)) |
| 1715 | t4_fatal_err(adap); | 1798 | t4_fatal_err(adap); |
| 1716 | } | 1799 | } |
| 1717 | 1800 | ||
| @@ -1725,19 +1808,22 @@ static void mps_intr_handler(struct adapter *adapter) · 7 unmodified lines | |||
| 1725 | { 0 } | 1808 | { 0 } |
| 1726 | }; | 1809 | }; |
| 1727 | static const struct intr_info mps_tx_intr_info[] = { | 1810 | static const struct intr_info mps_tx_intr_info[] = { |
| 1728 | { TPFIFO, "MPS Tx TP FIFO parity error", -1, 1 }, | 1811 | { TPFIFO_V(TPFIFO_M), "MPS Tx TP FIFO parity error", -1, 1 }, |
| 1729 | { NCSIFIFO, "MPS Tx NC-SI FIFO parity error", -1, 1 }, | 1812 | { NCSIFIFO_F, "MPS Tx NC-SI FIFO parity error", -1, 1 }, |
| 1730 | { TXDATAFIFO, "MPS Tx data FIFO parity error", -1, 1 }, | 1813 | { TXDATAFIFO_V(TXDATAFIFO_M), "MPS Tx data FIFO parity error", |
| 1731 | { TXDESCFIFO, "MPS Tx desc FIFO parity error", -1, 1 }, | 1814 | -1, 1 }, |
| 1732 | { BUBBLE, "MPS Tx underflow", -1, 1 }, | 1815 | { TXDESCFIFO_V(TXDESCFIFO_M), "MPS Tx desc FIFO parity error", |
| 1733 | { SECNTERR, "MPS Tx SOP/EOP error", -1, 1 }, | 1816 | -1, 1 }, |
| 1734 | { FRMERR, "MPS Tx framing error", -1, 1 }, | 1817 | { BUBBLE_F, "MPS Tx underflow", -1, 1 }, |
| 1818 | { SECNTERR_F, "MPS Tx SOP/EOP error", -1, 1 }, | ||
| 1819 | { FRMERR_F, "MPS Tx framing error", -1, 1 }, | ||
| 1735 | { 0 } | 1820 | { 0 } |
| 1736 | }; | 1821 | }; |
| 1737 | static const struct intr_info mps_trc_intr_info[] = { | 1822 | static const struct intr_info mps_trc_intr_info[] = { |
| 1738 | { FILTMEM, "MPS TRC filter parity error", -1, 1 }, | 1823 | { FILTMEM_V(FILTMEM_M), "MPS TRC filter parity error", -1, 1 }, |
| 1739 | { PKTFIFO, "MPS TRC packet FIFO parity error", -1, 1 }, | 1824 | { PKTFIFO_V(PKTFIFO_M), "MPS TRC packet FIFO parity error", |
| 1740 | { MISCPERR, "MPS TRC misc parity error", -1, 1 }, | 1825 | -1, 1 }, |
| 1826 | { MISCPERR_F, "MPS TRC misc parity error", -1, 1 }, | ||
| 1741 | { 0 } | 1827 | { 0 } |
| 1742 | }; | 1828 | }; |
| 1743 | static const struct intr_info mps_stat_sram_intr_info[] = { | 1829 | static const struct intr_info mps_stat_sram_intr_info[] = { |
| @@ -1753,37 +1839,37 @@ static void mps_intr_handler(struct adapter *adapter) · 9 unmodified lines | |||
| 1753 | { 0 } | 1839 | { 0 } |
| 1754 | }; | 1840 | }; |
| 1755 | static const struct intr_info mps_cls_intr_info[] = { | 1841 | static const struct intr_info mps_cls_intr_info[] = { |
| 1756 | { MATCHSRAM, "MPS match SRAM parity error", -1, 1 }, | 1842 | { MATCHSRAM_F, "MPS match SRAM parity error", -1, 1 }, |
| 1757 | { MATCHTCAM, "MPS match TCAM parity error", -1, 1 }, | 1843 | { MATCHTCAM_F, "MPS match TCAM parity error", -1, 1 }, |
| 1758 | { HASHSRAM, "MPS hash SRAM parity error", -1, 1 }, | 1844 | { HASHSRAM_F, "MPS hash SRAM parity error", -1, 1 }, |
| 1759 | { 0 } | 1845 | { 0 } |
| 1760 | }; | 1846 | }; |
| 1761 | 1847 | ||
| 1762 | int fat; | 1848 | int fat; |
| 1763 | 1849 | ||
| 1764 | fat = t4_handle_intr_status(adapter, MPS_RX_PERR_INT_CAUSE, | 1850 | fat = t4_handle_intr_status(adapter, MPS_RX_PERR_INT_CAUSE_A, |
| 1765 | mps_rx_intr_info) + | 1851 | mps_rx_intr_info) + |
| 1766 | t4_handle_intr_status(adapter, MPS_TX_INT_CAUSE, | 1852 | t4_handle_intr_status(adapter, MPS_TX_INT_CAUSE_A, |
| 1767 | mps_tx_intr_info) + | 1853 | mps_tx_intr_info) + |
| 1768 | t4_handle_intr_status(adapter, MPS_TRC_INT_CAUSE, | 1854 | t4_handle_intr_status(adapter, MPS_TRC_INT_CAUSE_A, |
| 1769 | mps_trc_intr_info) + | 1855 | mps_trc_intr_info) + |
| 1770 | t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_SRAM, | 1856 | t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_SRAM_A, |
| 1771 | mps_stat_sram_intr_info) + | 1857 | mps_stat_sram_intr_info) + |
| 1772 | t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_TX_FIFO, | 1858 | t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_TX_FIFO_A, |
| 1773 | mps_stat_tx_intr_info) + | 1859 | mps_stat_tx_intr_info) + |
| 1774 | t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_RX_FIFO, | 1860 | t4_handle_intr_status(adapter, MPS_STAT_PERR_INT_CAUSE_RX_FIFO_A, |
| 1775 | mps_stat_rx_intr_info) + | 1861 | mps_stat_rx_intr_info) + |
| 1776 | t4_handle_intr_status(adapter, MPS_CLS_INT_CAUSE, | 1862 | t4_handle_intr_status(adapter, MPS_CLS_INT_CAUSE_A, |
| 1777 | mps_cls_intr_info); | 1863 | mps_cls_intr_info); |
| 1778 | 1864 | ||
| 1779 | t4_write_reg(adapter, MPS_INT_CAUSE, CLSINT | TRCINT | | 1865 | t4_write_reg(adapter, MPS_INT_CAUSE_A, 0); |
| 1780 | RXINT | TXINT | STATINT); | 1866 | t4_read_reg(adapter, MPS_INT_CAUSE_A); /* flush */ |
| 1781 | t4_read_reg(adapter, MPS_INT_CAUSE); /* flush */ | ||
| 1782 | if (fat) | 1867 | if (fat) |
| 1783 | t4_fatal_err(adapter); | 1868 | t4_fatal_err(adapter); |
| 1784 | } | 1869 | } |
| 1785 | 1870 | ||
| 1786 | #define MEM_INT_MASK (PERR_INT_CAUSE | ECC_CE_INT_CAUSE | ECC_UE_INT_CAUSE) | 1871 | #define MEM_INT_MASK (PERR_INT_CAUSE_F | ECC_CE_INT_CAUSE_F | \ |
| 1872 | ECC_UE_INT_CAUSE_F) | ||
| 1787 | 1873 | ||
| 1788 | /* | 1874 | /* |
| 1789 | * EDC/MC interrupt handler. | 1875 | * EDC/MC interrupt handler. |
| @@ -1795,40 +1881,40 @@ static void mem_intr_handler(struct adapter *adapter, int idx) · 5 unmodified lines | |||
| 1795 | unsigned int addr, cnt_addr, v; | 1881 | unsigned int addr, cnt_addr, v; |
| 1796 | 1882 | ||
| 1797 | if (idx <= MEM_EDC1) { | 1883 | if (idx <= MEM_EDC1) { |
| 1798 | addr = EDC_REG(EDC_INT_CAUSE, idx); | 1884 | addr = EDC_REG(EDC_INT_CAUSE_A, idx); |
| 1799 | cnt_addr = EDC_REG(EDC_ECC_STATUS, idx); | 1885 | cnt_addr = EDC_REG(EDC_ECC_STATUS_A, idx); |
| 1800 | } else if (idx == MEM_MC) { | 1886 | } else if (idx == MEM_MC) { |
| 1801 | if (is_t4(adapter->params.chip)) { | 1887 | if (is_t4(adapter->params.chip)) { |
| 1802 | addr = MC_INT_CAUSE; | 1888 | addr = MC_INT_CAUSE_A; |
| 1803 | cnt_addr = MC_ECC_STATUS; | 1889 | cnt_addr = MC_ECC_STATUS_A; |
| 1804 | } else { | 1890 | } else { |
| 1805 | addr = MC_P_INT_CAUSE; | 1891 | addr = MC_P_INT_CAUSE_A; |
| 1806 | cnt_addr = MC_P_ECC_STATUS; | 1892 | cnt_addr = MC_P_ECC_STATUS_A; |
| 1807 | } | 1893 | } |
| 1808 | } else { | 1894 | } else { |
| 1809 | addr = MC_REG(MC_P_INT_CAUSE, 1); | 1895 | addr = MC_REG(MC_P_INT_CAUSE_A, 1); |
| 1810 | cnt_addr = MC_REG(MC_P_ECC_STATUS, 1); | 1896 | cnt_addr = MC_REG(MC_P_ECC_STATUS_A, 1); |
| 1811 | } | 1897 | } |
| 1812 | 1898 | ||
| 1813 | v = t4_read_reg(adapter, addr) & MEM_INT_MASK; | 1899 | v = t4_read_reg(adapter, addr) & MEM_INT_MASK; |
| 1814 | if (v & PERR_INT_CAUSE) | 1900 | if (v & PERR_INT_CAUSE_F) |
| 1815 | dev_alert(adapter->pdev_dev, "%s FIFO parity error\n", | 1901 | dev_alert(adapter->pdev_dev, "%s FIFO parity error\n", |
| 1816 | name[idx]); | 1902 | name[idx]); |
| 1817 | if (v & ECC_CE_INT_CAUSE) { | 1903 | if (v & ECC_CE_INT_CAUSE_F) { |
| 1818 | u32 cnt = ECC_CECNT_GET(t4_read_reg(adapter, cnt_addr)); | 1904 | u32 cnt = ECC_CECNT_G(t4_read_reg(adapter, cnt_addr)); |
| 1819 | 1905 | ||
| 1820 | t4_write_reg(adapter, cnt_addr, ECC_CECNT_MASK); | 1906 | t4_write_reg(adapter, cnt_addr, ECC_CECNT_V(ECC_CECNT_M)); |
| 1821 | if (printk_ratelimit()) | 1907 | if (printk_ratelimit()) |
| 1822 | dev_warn(adapter->pdev_dev, | 1908 | dev_warn(adapter->pdev_dev, |
| 1823 | "%u %s correctable ECC data error%s\n", | 1909 | "%u %s correctable ECC data error%s\n", |
| 1824 | cnt, name[idx], cnt > 1 ? "s" : ""); | 1910 | cnt, name[idx], cnt > 1 ? "s" : ""); |
| 1825 | } | 1911 | } |
| 1826 | if (v & ECC_UE_INT_CAUSE) | 1912 | if (v & ECC_UE_INT_CAUSE_F) |
| 1827 | dev_alert(adapter->pdev_dev, | 1913 | dev_alert(adapter->pdev_dev, |
| 1828 | "%s uncorrectable ECC data error\n", name[idx]); | 1914 | "%s uncorrectable ECC data error\n", name[idx]); |
| 1829 | 1915 | ||
| 1830 | t4_write_reg(adapter, addr, v); | 1916 | t4_write_reg(adapter, addr, v); |
| 1831 | if (v & (PERR_INT_CAUSE | ECC_UE_INT_CAUSE)) | 1917 | if (v & (PERR_INT_CAUSE_F | ECC_UE_INT_CAUSE_F)) |
| 1832 | t4_fatal_err(adapter); | 1918 | t4_fatal_err(adapter); |
| 1833 | } | 1919 | } |
| 1834 | 1920 | ||
| @@ -1837,26 +1923,26 @@ static void mem_intr_handler(struct adapter *adapter, int idx) · 2 unmodified lines | |||
| 1837 | */ | 1923 | */ |
| 1838 | static void ma_intr_handler(struct adapter *adap) | 1924 | static void ma_intr_handler(struct adapter *adap) |
| 1839 | { | 1925 | { |
| 1840 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE); | 1926 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE_A); |
| 1841 | 1927 | ||
| 1842 | if (status & MEM_PERR_INT_CAUSE) { | 1928 | if (status & MEM_PERR_INT_CAUSE_F) { |
| 1843 | dev_alert(adap->pdev_dev, | 1929 | dev_alert(adap->pdev_dev, |
| 1844 | "MA parity error, parity status %#x\n", | 1930 | "MA parity error, parity status %#x\n", |
| 1845 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS)); | 1931 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS1_A)); |
| 1846 | if (is_t5(adap->params.chip)) | 1932 | if (is_t5(adap->params.chip)) |
| 1847 | dev_alert(adap->pdev_dev, | 1933 | dev_alert(adap->pdev_dev, |
| 1848 | "MA parity error, parity status %#x\n", | 1934 | "MA parity error, parity status %#x\n", |
| 1849 | t4_read_reg(adap, | 1935 | t4_read_reg(adap, |
| 1850 | MA_PARITY_ERROR_STATUS2)); | 1936 | MA_PARITY_ERROR_STATUS2_A)); |
| 1851 | } | 1937 | } |
| 1852 | if (status & MEM_WRAP_INT_CAUSE) { | 1938 | if (status & MEM_WRAP_INT_CAUSE_F) { |
| 1853 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS); | 1939 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS_A); |
| 1854 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " | 1940 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " |
| 1855 | "client %u to address %#x\n", | 1941 | "client %u to address %#x\n", |
| 1856 | MEM_WRAP_CLIENT_NUM_GET(v), | 1942 | MEM_WRAP_CLIENT_NUM_G(v), |
| 1857 | MEM_WRAP_ADDRESS_GET(v) << 4); | 1943 | MEM_WRAP_ADDRESS_G(v) << 4); |
| 1858 | } | 1944 | } |
| 1859 | t4_write_reg(adap, MA_INT_CAUSE, status); | 1945 | t4_write_reg(adap, MA_INT_CAUSE_A, status); |
| 1860 | t4_fatal_err(adap); | 1946 | t4_fatal_err(adap); |
| 1861 | } | 1947 | } |
| 1862 | 1948 | ||
| @@ -1866,13 +1952,13 @@ static void ma_intr_handler(struct adapter *adap) · 3 unmodified lines | |||
| 1866 | static void smb_intr_handler(struct adapter *adap) | 1952 | static void smb_intr_handler(struct adapter *adap) |
| 1867 | { | 1953 | { |
| 1868 | static const struct intr_info smb_intr_info[] = { | 1954 | static const struct intr_info smb_intr_info[] = { |
| 1869 | { MSTTXFIFOPARINT, "SMB master Tx FIFO parity error", -1, 1 }, | 1955 | { MSTTXFIFOPARINT_F, "SMB master Tx FIFO parity error", -1, 1 }, |
| 1870 | { MSTRXFIFOPARINT, "SMB master Rx FIFO parity error", -1, 1 }, | 1956 | { MSTRXFIFOPARINT_F, "SMB master Rx FIFO parity error", -1, 1 }, |
| 1871 | { SLVFIFOPARINT, "SMB slave FIFO parity error", -1, 1 }, | 1957 | { SLVFIFOPARINT_F, "SMB slave FIFO parity error", -1, 1 }, |
| 1872 | { 0 } | 1958 | { 0 } |
| 1873 | }; | 1959 | }; |
| 1874 | 1960 | ||
| 1875 | if (t4_handle_intr_status(adap, SMB_INT_CAUSE, smb_intr_info)) | 1961 | if (t4_handle_intr_status(adap, SMB_INT_CAUSE_A, smb_intr_info)) |
| 1876 | t4_fatal_err(adap); | 1962 | t4_fatal_err(adap); |
| 1877 | } | 1963 | } |
| 1878 | 1964 | ||
| @@ -1882,14 +1968,14 @@ static void smb_intr_handler(struct adapter *adap) · 3 unmodified lines | |||
| 1882 | static void ncsi_intr_handler(struct adapter *adap) | 1968 | static void ncsi_intr_handler(struct adapter *adap) |
| 1883 | { | 1969 | { |
| 1884 | static const struct intr_info ncsi_intr_info[] = { | 1970 | static const struct intr_info ncsi_intr_info[] = { |
| 1885 | { CIM_DM_PRTY_ERR, "NC-SI CIM parity error", -1, 1 }, | 1971 | { CIM_DM_PRTY_ERR_F, "NC-SI CIM parity error", -1, 1 }, |
| 1886 | { MPS_DM_PRTY_ERR, "NC-SI MPS parity error", -1, 1 }, | 1972 | { MPS_DM_PRTY_ERR_F, "NC-SI MPS parity error", -1, 1 }, |
| 1887 | { TXFIFO_PRTY_ERR, "NC-SI Tx FIFO parity error", -1, 1 }, | 1973 | { TXFIFO_PRTY_ERR_F, "NC-SI Tx FIFO parity error", -1, 1 }, |
| 1888 | { RXFIFO_PRTY_ERR, "NC-SI Rx FIFO parity error", -1, 1 }, | 1974 | { RXFIFO_PRTY_ERR_F, "NC-SI Rx FIFO parity error", -1, 1 }, |
| 1889 | { 0 } | 1975 | { 0 } |
| 1890 | }; | 1976 | }; |
| 1891 | 1977 | ||
| 1892 | if (t4_handle_intr_status(adap, NCSI_INT_CAUSE, ncsi_intr_info)) | 1978 | if (t4_handle_intr_status(adap, NCSI_INT_CAUSE_A, ncsi_intr_info)) |
| 1893 | t4_fatal_err(adap); | 1979 | t4_fatal_err(adap); |
| 1894 | } | 1980 | } |
| 1895 | 1981 | ||
| @@ -1901,23 +1987,23 @@ static void xgmac_intr_handler(struct adapter *adap, int port) · 5 unmodified lines | |||
| 1901 | u32 v, int_cause_reg; | 1987 | u32 v, int_cause_reg; |
| 1902 | 1988 | ||
| 1903 | if (is_t4(adap->params.chip)) | 1989 | if (is_t4(adap->params.chip)) |
| 1904 | int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE); | 1990 | int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE_A); |
| 1905 | else | 1991 | else |
| 1906 | int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE); | 1992 | int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE_A); |
| 1907 | 1993 | ||
| 1908 | v = t4_read_reg(adap, int_cause_reg); | 1994 | v = t4_read_reg(adap, int_cause_reg); |
| 1909 | 1995 | ||
| 1910 | v &= TXFIFO_PRTY_ERR | RXFIFO_PRTY_ERR; | 1996 | v &= TXFIFO_PRTY_ERR_F | RXFIFO_PRTY_ERR_F; |
| 1911 | if (!v) | 1997 | if (!v) |
| 1912 | return; | 1998 | return; |
| 1913 | 1999 | ||
| 1914 | if (v & TXFIFO_PRTY_ERR) | 2000 | if (v & TXFIFO_PRTY_ERR_F) |
| 1915 | dev_alert(adap->pdev_dev, "XGMAC %d Tx FIFO parity error\n", | 2001 | dev_alert(adap->pdev_dev, "XGMAC %d Tx FIFO parity error\n", |
| 1916 | port); | 2002 | port); |
| 1917 | if (v & RXFIFO_PRTY_ERR) | 2003 | if (v & RXFIFO_PRTY_ERR_F) |
| 1918 | dev_alert(adap->pdev_dev, "XGMAC %d Rx FIFO parity error\n", | 2004 | dev_alert(adap->pdev_dev, "XGMAC %d Rx FIFO parity error\n", |
| 1919 | port); | 2005 | port); |
| 1920 | t4_write_reg(adap, PORT_REG(port, XGMAC_PORT_INT_CAUSE), v); | 2006 | t4_write_reg(adap, PORT_REG(port, XGMAC_PORT_INT_CAUSE_A), v); |
| 1921 | t4_fatal_err(adap); | 2007 | t4_fatal_err(adap); |
| 1922 | } | 2008 | } |
| 1923 | 2009 | ||
| @@ -1927,19 +2013,19 @@ static void xgmac_intr_handler(struct adapter *adap, int port) · 3 unmodified lines | |||
| 1927 | static void pl_intr_handler(struct adapter *adap) | 2013 | static void pl_intr_handler(struct adapter *adap) |
| 1928 | { | 2014 | { |
| 1929 | static const struct intr_info pl_intr_info[] = { | 2015 | static const struct intr_info pl_intr_info[] = { |
| 1930 | { FATALPERR, "T4 fatal parity error", -1, 1 }, | 2016 | { FATALPERR_F, "T4 fatal parity error", -1, 1 }, |
| 1931 | { PERRVFID, "PL VFID_MAP parity error", -1, 1 }, | 2017 | { PERRVFID_F, "PL VFID_MAP parity error", -1, 1 }, |
| 1932 | { 0 } | 2018 | { 0 } |
| 1933 | }; | 2019 | }; |
| 1934 | 2020 | ||
| 1935 | if (t4_handle_intr_status(adap, PL_PL_INT_CAUSE, pl_intr_info)) | 2021 | if (t4_handle_intr_status(adap, PL_PL_INT_CAUSE_A, pl_intr_info)) |
| 1936 | t4_fatal_err(adap); | 2022 | t4_fatal_err(adap); |
| 1937 | } | 2023 | } |
| 1938 | 2024 | ||
| 1939 | #define PF_INTR_MASK (PFSW) | 2025 | #define PF_INTR_MASK (PFSW_F) |
| 1940 | #define GLBL_INTR_MASK (CIM | MPS | PL | PCIE | MC | EDC0 | \ | 2026 | #define GLBL_INTR_MASK (CIM_F | MPS_F | PL_F | PCIE_F | MC_F | EDC0_F | \ |
| 1941 | EDC1 | LE | TP | MA | PM_TX | PM_RX | ULP_RX | \ | 2027 | EDC1_F | LE_F | TP_F | MA_F | PM_TX_F | PM_RX_F | ULP_RX_F | \ |
| 1942 | CPL_SWITCH | SGE | ULP_TX) | 2028 | CPL_SWITCH_F | SGE_F | ULP_TX_F) |
| 1943 | 2029 | ||
| 1944 | /** | 2030 | /** |
| 1945 | * t4_slow_intr_handler - control path interrupt handler | 2031 | * t4_slow_intr_handler - control path interrupt handler |
| @@ -1951,60 +2037,60 @@ static void pl_intr_handler(struct adapter *adap) · 5 unmodified lines | |||
| 1951 | */ | 2037 | */ |
| 1952 | int t4_slow_intr_handler(struct adapter *adapter) | 2038 | int t4_slow_intr_handler(struct adapter *adapter) |
| 1953 | { | 2039 | { |
| 1954 | u32 cause = t4_read_reg(adapter, PL_INT_CAUSE); | 2040 | u32 cause = t4_read_reg(adapter, PL_INT_CAUSE_A); |
| 1955 | 2041 | ||
| 1956 | if (!(cause & GLBL_INTR_MASK)) | 2042 | if (!(cause & GLBL_INTR_MASK)) |
| 1957 | return 0; | 2043 | return 0; |
| 1958 | if (cause & CIM) | 2044 | if (cause & CIM_F) |
| 1959 | cim_intr_handler(adapter); | 2045 | cim_intr_handler(adapter); |
| 1960 | if (cause & MPS) | 2046 | if (cause & MPS_F) |
| 1961 | mps_intr_handler(adapter); | 2047 | mps_intr_handler(adapter); |
| 1962 | if (cause & NCSI) | 2048 | if (cause & NCSI_F) |
| 1963 | ncsi_intr_handler(adapter); | 2049 | ncsi_intr_handler(adapter); |
| 1964 | if (cause & PL) | 2050 | if (cause & PL_F) |
| 1965 | pl_intr_handler(adapter); | 2051 | pl_intr_handler(adapter); |
| 1966 | if (cause & SMB) | 2052 | if (cause & SMB_F) |
| 1967 | smb_intr_handler(adapter); | 2053 | smb_intr_handler(adapter); |
| 1968 | if (cause & XGMAC0) | 2054 | if (cause & XGMAC0_F) |
| 1969 | xgmac_intr_handler(adapter, 0); | 2055 | xgmac_intr_handler(adapter, 0); |
| 1970 | if (cause & XGMAC1) | 2056 | if (cause & XGMAC1_F) |
| 1971 | xgmac_intr_handler(adapter, 1); | 2057 | xgmac_intr_handler(adapter, 1); |
| 1972 | if (cause & XGMAC_KR0) | 2058 | if (cause & XGMAC_KR0_F) |
| 1973 | xgmac_intr_handler(adapter, 2); | 2059 | xgmac_intr_handler(adapter, 2); |
| 1974 | if (cause & XGMAC_KR1) | 2060 | if (cause & XGMAC_KR1_F) |
| 1975 | xgmac_intr_handler(adapter, 3); | 2061 | xgmac_intr_handler(adapter, 3); |
| 1976 | if (cause & PCIE) | 2062 | if (cause & PCIE_F) |
| 1977 | pcie_intr_handler(adapter); | 2063 | pcie_intr_handler(adapter); |
| 1978 | if (cause & MC) | 2064 | if (cause & MC_F) |
| 1979 | mem_intr_handler(adapter, MEM_MC); | 2065 | mem_intr_handler(adapter, MEM_MC); |
| 1980 | if (!is_t4(adapter->params.chip) && (cause & MC1)) | 2066 | if (!is_t4(adapter->params.chip) && (cause & MC1_S)) |
| 1981 | mem_intr_handler(adapter, MEM_MC1); | 2067 | mem_intr_handler(adapter, MEM_MC1); |
| 1982 | if (cause & EDC0) | ||
1150 more lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 545 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 3483 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 183 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 128 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 315 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 296 lines aren’t shown here.
This diff is large: its 428 lines aren’t shown here.
This diff is large: its 304 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 273 lines aren’t shown here.
This diff is large: its 1450 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 288 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 178 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 240 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 972 lines aren’t shown here.
This diff is large: its 187 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 395 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 356 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 331 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 240 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 251 lines aren’t shown here.
This diff is large: its 359 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 205 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 279 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 764 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 340 lines aren’t shown here.
This diff is large: its 841 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 217 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 243 lines aren’t shown here.
This diff is large: its 324 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 895 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 265 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 136 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 438 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 149 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 173 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 230 lines aren’t shown here.
This diff is large: its 2150 lines aren’t shown here.
This diff is large: its 2160 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 502 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 197 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 1460 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 602 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 769 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 542 lines aren’t shown here.
This diff is large: its 234 lines aren’t shown here.
This diff is large: its 201 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 244 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 550 lines aren’t shown here.
This diff is large: its 204 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 206 lines aren’t shown here.
This diff is large: its 1133 lines aren’t shown here.
This diff is large: its 297 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 245 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 1065 lines aren’t shown here.
This diff is large: its 2697 lines aren’t shown here.
This diff is large: its 1445 lines aren’t shown here.
This diff is large: its 3580 lines aren’t shown here.
This diff is large: its 653 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 469 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 1047 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 367 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 381 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 298 lines aren’t shown here.
This diff is large: its 267 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 438 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 329 lines aren’t shown here.
This diff is large: its 345 lines aren’t shown here.
This diff is large: its 264 lines aren’t shown here.
This diff is large: its 318 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 258 lines aren’t shown here.
This diff is large: its 380 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 196 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 514 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 204 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 418 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 278 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 334 lines aren’t shown here.
This diff is large: its 180 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 539 lines aren’t shown here.
This diff is large: its 211 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 214 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 962 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 171 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 186 lines aren’t shown here.
This diff is large: its 253 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 234 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 1392 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 347 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 240 lines aren’t shown here.
This diff is large: its 239 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 254 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 260 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 259 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 194 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 284 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 246 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 651 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 379 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 232 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 382 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 412 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 708 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 1896 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 405 lines aren’t shown here.
This diff is large: its 240 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 289 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 168 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
File renamed without changes.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 416 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 177 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 453 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 285 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 131 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 138 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 365 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 1465 lines aren’t shown here.
This diff is large: its 228 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 2216 lines aren’t shown here.
This diff is large: its 1057 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 399 lines aren’t shown here.
This diff is large: its 557 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 163 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 1196 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 245 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 557 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 146 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 403 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 416 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 138 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 262 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 358 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 305 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 272 lines aren’t shown here.
This diff is large: its 730 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 370 lines aren’t shown here.
This diff is large: its 550 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 271 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 1126 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 2612 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 363 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 198 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 287 lines aren’t shown here.
This diff is large: its 179 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 186 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 122 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 248 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 507 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 192 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 236 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 194 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 361 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 201 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 310 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 531 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 205 lines aren’t shown here.
This diff is large: its 203 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 485 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 281 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 695 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 584 lines aren’t shown here.
This diff is large: its 529 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 841 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 430 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 196 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 205 lines aren’t shown here.
This diff is large: its 186 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 955 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 518 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 343 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 213 lines aren’t shown here.
This diff is large: its 199 lines aren’t shown here.
This diff is large: its 257 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 1523 lines aren’t shown here.
This diff is large: its 128 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 296 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 336 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 719 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 1085 lines aren’t shown here.
This diff is large: its 591 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 1674 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 263 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 230 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 1169 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 239 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.