Pull networking changes from David Miller: 1) Allow to dump, monitor, and change the bridge multicast database using netlink. From Cong Wang. 2) RFC 5961 TCP blind data injection attack mitigation, from Eric Dumazet. 3) Networking user namespace support from Eric W. Biederman. 4) tuntap/virtio-net multiqueue support by Jason Wang. 5) Support for checksum offload of encapsulated packets (basically, tunneled traffic can still be checksummed by HW). From Joseph Gasparakis. 6) Allow BPF filter access to VLAN tags, from Eric Dumazet and Daniel Borkmann. 7) Bridge port parameters over netlink and BPDU blocking support from Stephen Hemminger. 8) Improve data access patterns during inet socket demux by rearranging socket layout, from Eric Dumazet. 9) TIPC protocol updates and cleanups from Ying Xue, Paul Gortmaker, and Jon Maloy. 10) Update TCP socket hash sizing to be more in line with current day realities. The existing heurstics were choosen a decade ago. From Eric Dumazet. 11) Fix races, queue bloat, and excessive wakeups in ATM and associated drivers, from Krzysztof Mazur and David Woodhouse. 12) Support DOVE (Distributed Overlay Virtual Ethernet) extensions in VXLAN driver, from David Stevens. 13) Add "oops_only" mode to netconsole, from Amerigo Wang. 14) Support set and query of VEB/VEPA bridge mode via PF_BRIDGE, also allow DCB netlink to work on namespaces other than the initial namespace. From John Fastabend. 15) Support PTP in the Tigon3 driver, from Matt Carlson. 16) tun/vhost zero copy fixes and improvements, plus turn it on by default, from Michael S. Tsirkin. 17) Support per-association statistics in SCTP, from Michele Baldessari. And many, many, driver updates, cleanups, and improvements. Too numerous to mention individually. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1722 commits) net/mlx4_en: Add support for destination MAC in steering rules net/mlx4_en: Use generic etherdevice.h functions. net: ethtool: Add destination MAC address to flow steering API bridge: add support of adding and deleting mdb entries bridge: notify mdb changes via netlink ndisc: Unexport ndisc_{build,send}_skb(). uapi: add missing netconf.h to export list pkt_sched: avoid requeues if possible solos-pci: fix double-free of TX skb in DMA mode bnx2: Fix accidental reversions. bna: Driver Version Updated to 3.1.2.1 bna: Firmware update bna: Add RX State bna: Rx Page Based Allocation bna: TX Intr Coalescing Fix bna: Tx and Rx Optimizations bna: Code Cleanup and Enhancements ath9k: check pdata variable before dereferencing it ath5k: RX timestamp is reported at end of frame ath9k_htc: RX timestamp is reported at end of frame ...
Unified · Split
| @@ -0,0 +1,9 @@ | ||
| 1 | +What: /sys/bus/mdio_bus/devices/.../phy_id | |
| 2 | +Date: November 2012 | |
| 3 | +KernelVersion: 3.8 | |
| 4 | +Contact: netdev@vger.kernel.org | |
| 5 | +Description: | |
| 6 | + This attribute contains the 32-bit PHY Identifier as reported | |
| 7 | + by the device during bus enumeration, encoded in hexadecimal. | |
| 8 | + This ID is used to match the device with the appropriate | |
| 9 | + driver. | |
| @@ -1,4 +1,10 @@ | ||
| 1 | 1 | |
| 2 | +What: /sys/class/net/<iface>/batman-adv/iface_status | |
| 3 | +Date: May 2010 | |
| 4 | +Contact: Marek Lindner <lindner_marek@yahoo.de> | |
| 5 | +Description: | |
| 6 | + Indicates the status of <iface> as it is seen by batman. | |
| 7 | + | |
| 2 | 8 | What: /sys/class/net/<iface>/batman-adv/mesh_iface |
| 3 | 9 | Date: May 2010 |
| 4 | 10 | Contact: Marek Lindner <lindner_marek@yahoo.de> |
| @@ -7,8 +13,3 @@ Description: · 2 unmodified lines | ||
| 7 | 13 | displays the batman mesh interface this <iface> |
| 8 | 14 | currently is associated with. |
| 9 | 15 | |
| 10 | −What: /sys/class/net/<iface>/batman-adv/iface_status | |
| 11 | −Date: May 2010 | |
| 12 | −Contact: Marek Lindner <lindner_marek@yahoo.de> | |
| 13 | −Description: | |
| 14 | − Indicates the status of <iface> as it is seen by batman. | |
| @@ -0,0 +1,35 @@ | ||
| 1 | + | |
| 2 | +What: /sys/class/net/<iface>/grcan/enable0 | |
| 3 | +Date: October 2012 | |
| 4 | +KernelVersion: 3.8 | |
| 5 | +Contact: Andreas Larsson <andreas@gaisler.com> | |
| 6 | +Description: | |
| 7 | + Hardware configuration of physical interface 0. This file reads | |
| 8 | + and writes the "Enable 0" bit of the configuration register. | |
| 9 | + Possible values: 0 or 1. See the GRCAN chapter of the GRLIB IP | |
| 10 | + core library documentation for details. The default value is 0 | |
| 11 | + or set by the module parameter grcan.enable0 and can be read at | |
| 12 | + /sys/module/grcan/parameters/enable0. | |
| 13 | + | |
| 14 | +What: /sys/class/net/<iface>/grcan/enable1 | |
| 15 | +Date: October 2012 | |
| 16 | +KernelVersion: 3.8 | |
| 17 | +Contact: Andreas Larsson <andreas@gaisler.com> | |
| 18 | +Description: | |
| 19 | + Hardware configuration of physical interface 1. This file reads | |
| 20 | + and writes the "Enable 1" bit of the configuration register. | |
| 21 | + Possible values: 0 or 1. See the GRCAN chapter of the GRLIB IP | |
| 22 | + core library documentation for details. The default value is 0 | |
| 23 | + or set by the module parameter grcan.enable1 and can be read at | |
| 24 | + /sys/module/grcan/parameters/enable1. | |
| 25 | + | |
| 26 | +What: /sys/class/net/<iface>/grcan/select | |
| 27 | +Date: October 2012 | |
| 28 | +KernelVersion: 3.8 | |
| 29 | +Contact: Andreas Larsson <andreas@gaisler.com> | |
| 30 | +Description: | |
| 31 | + Configuration of which physical interface to be used. Possible | |
| 32 | + values: 0 or 1. See the GRCAN chapter of the GRLIB IP core | |
| 33 | + library documentation for details. The default value is 0 or is | |
| 34 | + set by the module parameter grcan.select and can be read at | |
| 35 | + /sys/module/grcan/parameters/select. | |
| @@ -6,6 +6,14 @@ Description: · 5 unmodified lines | ||
| 6 | 6 | Indicates whether the batman protocol messages of the |
| 7 | 7 | mesh <mesh_iface> shall be aggregated or not. |
| 8 | 8 | |
| 9 | +What: /sys/class/net/<mesh_iface>/mesh/ap_isolation | |
| 10 | +Date: May 2011 | |
| 11 | +Contact: Antonio Quartulli <ordex@autistici.org> | |
| 12 | +Description: | |
| 13 | + Indicates whether the data traffic going from a | |
| 14 | + wireless client to another wireless client will be | |
| 15 | + silently dropped. | |
| 16 | + | |
| 9 | 17 | What: /sys/class/net/<mesh_iface>/mesh/bonding |
| 10 | 18 | Date: June 2010 |
| 11 | 19 | Contact: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> |
| @@ -31,14 +39,6 @@ Description: · 19 unmodified lines | ||
| 31 | 39 | mesh will be fragmented or silently discarded if the |
| 32 | 40 | packet size exceeds the outgoing interface MTU. |
| 33 | 41 | |
| 34 | −What: /sys/class/net/<mesh_iface>/mesh/ap_isolation | |
| 35 | −Date: May 2011 | |
| 36 | −Contact: Antonio Quartulli <ordex@autistici.org> | |
| 37 | −Description: | |
| 38 | − Indicates whether the data traffic going from a | |
| 39 | − wireless client to another wireless client will be | |
| 40 | − silently dropped. | |
| 41 | − | |
| 42 | 42 | What: /sys/class/net/<mesh_iface>/mesh/gw_bandwidth |
| 43 | 43 | Date: October 2010 |
| 44 | 44 | Contact: Marek Lindner <lindner_marek@yahoo.de> |
| @@ -60,6 +60,13 @@ Description: · 15 unmodified lines | ||
| 60 | 60 | Defines the selection criteria this node will use |
| 61 | 61 | to choose a gateway if gw_mode was set to 'client'. |
| 62 | 62 | |
| 63 | +What: /sys/class/net/<mesh_iface>/mesh/hop_penalty | |
| 64 | +Date: Oct 2010 | |
| 65 | +Contact: Linus Lüssing <linus.luessing@web.de> | |
| 66 | +Description: | |
| 67 | + Defines the penalty which will be applied to an | |
| 68 | + originator message's tq-field on every hop. | |
| 69 | + | |
| 63 | 70 | What: /sys/class/net/<mesh_iface>/mesh/orig_interval |
| 64 | 71 | Date: May 2010 |
| 65 | 72 | Contact: Marek Lindner <lindner_marek@yahoo.de> |
| @@ -67,19 +74,12 @@ Description: · 1 unmodified line | ||
| 67 | 74 | Defines the interval in milliseconds in which batman |
| 68 | 75 | sends its protocol messages. |
| 69 | 76 | |
| 70 | −What: /sys/class/net/<mesh_iface>/mesh/hop_penalty | |
| 71 | −Date: Oct 2010 | |
| 72 | −Contact: Linus Lüssing <linus.luessing@web.de> | |
| 73 | −Description: | |
| 74 | − Defines the penalty which will be applied to an | |
| 75 | − originator message's tq-field on every hop. | |
| 76 | − | |
| 77 | −What: /sys/class/net/<mesh_iface>/mesh/routing_algo | |
| 78 | −Date: Dec 2011 | |
| 79 | −Contact: Marek Lindner <lindner_marek@yahoo.de> | |
| 77 | +What: /sys/class/net/<mesh_iface>/mesh/routing_algo | |
| 78 | +Date: Dec 2011 | |
| 79 | +Contact: Marek Lindner <lindner_marek@yahoo.de> | |
| 80 | 80 | Description: |
| 81 | − Defines the routing procotol this mesh instance | |
| 82 | − uses to find the optimal paths through the mesh. | |
| 81 | + Defines the routing procotol this mesh instance | |
| 82 | + uses to find the optimal paths through the mesh. | |
| 83 | 83 | |
| 84 | 84 | What: /sys/class/net/<mesh_iface>/mesh/vis_mode |
| 85 | 85 | Date: May 2010 |
| @@ -0,0 +1,28 @@ | ||
| 1 | +Aeroflex Gaisler GRCAN and GRHCAN CAN controllers. | |
| 2 | + | |
| 3 | +The GRCAN and CRHCAN CAN controllers are available in the GRLIB VHDL IP core | |
| 4 | +library. | |
| 5 | + | |
| 6 | +Note: These properties are built from the AMBA plug&play in a Leon SPARC system | |
| 7 | +(the ordinary environment for GRCAN and GRHCAN). There are no dts files for | |
| 8 | +sparc. | |
| 9 | + | |
| 10 | +Required properties: | |
| 11 | + | |
| 12 | +- name : Should be "GAISLER_GRCAN", "01_03d", "GAISLER_GRHCAN" or "01_034" | |
| 13 | + | |
| 14 | +- reg : Address and length of the register set for the device | |
| 15 | + | |
| 16 | +- freq : Frequency of the external oscillator clock in Hz (the frequency of | |
| 17 | + the amba bus in the ordinary case) | |
| 18 | + | |
| 19 | +- interrupts : Interrupt number for this device | |
| 20 | + | |
| 21 | +Optional properties: | |
| 22 | + | |
| 23 | +- systemid : If not present or if the value of the least significant 16 bits | |
| 24 | + of this 32-bit property is smaller than GRCAN_TXBUG_SAFE_GRLIB_VERSION | |
| 25 | + a bug workaround is activated. | |
| 26 | + | |
| 27 | +For further information look in the documentation for the GLIB IP core library: | |
| 28 | +http://www.gaisler.com/products/grlib/grip.pdf | |
| @@ -0,0 +1,23 @@ | ||
| 1 | +* Cadence EMAC Ethernet controller | |
| 2 | + | |
| 3 | +Required properties: | |
| 4 | +- compatible: Should be "cdns,[<chip>-]{emac}" | |
| 5 | + Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC. | |
| 6 | + or the generic form: "cdns,emac". | |
| 7 | +- reg: Address and length of the register set for the device | |
| 8 | +- interrupts: Should contain macb interrupt | |
| 9 | +- phy-mode: String, operation mode of the PHY interface. | |
| 10 | + Supported values are: "mii", "rmii". | |
| 11 | + | |
| 12 | +Optional properties: | |
| 13 | +- local-mac-address: 6 bytes, mac address | |
| 14 | + | |
| 15 | +Examples: | |
| 16 | + | |
| 17 | + macb0: ethernet@fffc4000 { | |
| 18 | + compatible = "cdns,at91rm9200-emac"; | |
| 19 | + reg = <0xfffc4000 0x4000>; | |
| 20 | + interrupts = <21>; | |
| 21 | + phy-mode = "rmii"; | |
| 22 | + local-mac-address = [3a 0e 03 04 05 06]; | |
| 23 | + }; | |
| @@ -9,21 +9,15 @@ Required properties: · 8 unmodified lines | ||
| 9 | 9 | number |
| 10 | 10 | - interrupt-parent : The parent interrupt controller |
| 11 | 11 | - cpdma_channels : Specifies number of channels in CPDMA |
| 12 | −- host_port_no : Specifies host port shift | |
| 13 | −- cpdma_reg_ofs : Specifies CPDMA submodule register offset | |
| 14 | −- cpdma_sram_ofs : Specifies CPDMA SRAM offset | |
| 15 | −- ale_reg_ofs : Specifies ALE submodule register offset | |
| 16 | 12 | - ale_entries : Specifies No of entries ALE can hold |
| 17 | −- host_port_reg_ofs : Specifies host port register offset | |
| 18 | −- hw_stats_reg_ofs : Specifies hardware statistics register offset | |
| 19 | −- bd_ram_ofs : Specifies internal desciptor RAM offset | |
| 20 | 13 | - bd_ram_size : Specifies internal descriptor RAM size |
| 21 | 14 | - rx_descs : Specifies number of Rx descriptors |
| 22 | 15 | - mac_control : Specifies Default MAC control register content |
| 23 | 16 | for the specific platform |
| 24 | 17 | - slaves : Specifies number for slaves |
| 25 | −- slave_reg_ofs : Specifies slave register offset | |
| 26 | −- sliver_reg_ofs : Specifies slave sliver register offset | |
| 18 | +- cpts_active_slave : Specifies the slave to use for time stamping | |
| 19 | +- cpts_clock_mult : Numerator to convert input clock ticks into nanoseconds | |
| 20 | +- cpts_clock_shift : Denominator to convert input clock ticks into nanoseconds | |
| 27 | 21 | - phy_id : Specifies slave phy id |
| 28 | 22 | - mac-address : Specifies slave MAC address |
| 29 | 23 | |
| @@ -45,30 +39,22 @@ Examples: · 15 unmodified lines | ||
| 45 | 39 | interrupts = <55 0x4>; |
| 46 | 40 | interrupt-parent = <&intc>; |
| 47 | 41 | cpdma_channels = <8>; |
| 48 | − host_port_no = <0>; | |
| 49 | − cpdma_reg_ofs = <0x800>; | |
| 50 | − cpdma_sram_ofs = <0xa00>; | |
| 51 | − ale_reg_ofs = <0xd00>; | |
| 52 | 42 | ale_entries = <1024>; |
| 53 | − host_port_reg_ofs = <0x108>; | |
| 54 | − hw_stats_reg_ofs = <0x900>; | |
| 55 | − bd_ram_ofs = <0x2000>; | |
| 56 | 43 | bd_ram_size = <0x2000>; |
| 57 | 44 | no_bd_ram = <0>; |
| 58 | 45 | rx_descs = <64>; |
| 59 | 46 | mac_control = <0x20>; |
| 60 | 47 | slaves = <2>; |
| 48 | + cpts_active_slave = <0>; | |
| 49 | + cpts_clock_mult = <0x80000000>; | |
| 50 | + cpts_clock_shift = <29>; | |
| 61 | 51 | cpsw_emac0: slave@0 { |
| 62 | − slave_reg_ofs = <0x208>; | |
| 63 | − sliver_reg_ofs = <0xd80>; | |
| 64 | − phy_id = "davinci_mdio.16:00"; | |
| 52 | + phy_id = <&davinci_mdio>, <0>; | |
| 65 | 53 | /* Filled in by U-Boot */ |
| 66 | 54 | mac-address = [ 00 00 00 00 00 00 ]; |
| 67 | 55 | }; |
| 68 | 56 | cpsw_emac1: slave@1 { |
| 69 | − slave_reg_ofs = <0x308>; | |
| 70 | − sliver_reg_ofs = <0xdc0>; | |
| 71 | − phy_id = "davinci_mdio.16:01"; | |
| 57 | + phy_id = <&davinci_mdio>, <1>; | |
| 72 | 58 | /* Filled in by U-Boot */ |
| 73 | 59 | mac-address = [ 00 00 00 00 00 00 ]; |
| 74 | 60 | }; |
| @@ -79,30 +65,22 @@ Examples: · 4 unmodified lines | ||
| 79 | 65 | compatible = "ti,cpsw"; |
| 80 | 66 | ti,hwmods = "cpgmac0"; |
| 81 | 67 | cpdma_channels = <8>; |
| 82 | − host_port_no = <0>; | |
| 83 | − cpdma_reg_ofs = <0x800>; | |
| 84 | − cpdma_sram_ofs = <0xa00>; | |
| 85 | − ale_reg_ofs = <0xd00>; | |
| 86 | 68 | ale_entries = <1024>; |
| 87 | − host_port_reg_ofs = <0x108>; | |
| 88 | − hw_stats_reg_ofs = <0x900>; | |
| 89 | − bd_ram_ofs = <0x2000>; | |
| 90 | 69 | bd_ram_size = <0x2000>; |
| 91 | 70 | no_bd_ram = <0>; |
| 92 | 71 | rx_descs = <64>; |
| 93 | 72 | mac_control = <0x20>; |
| 94 | 73 | slaves = <2>; |
| 74 | + cpts_active_slave = <0>; | |
| 75 | + cpts_clock_mult = <0x80000000>; | |
| 76 | + cpts_clock_shift = <29>; | |
| 95 | 77 | cpsw_emac0: slave@0 { |
| 96 | − slave_reg_ofs = <0x208>; | |
| 97 | − sliver_reg_ofs = <0xd80>; | |
| 98 | − phy_id = "davinci_mdio.16:00"; | |
| 78 | + phy_id = <&davinci_mdio>, <0>; | |
| 99 | 79 | /* Filled in by U-Boot */ |
| 100 | 80 | mac-address = [ 00 00 00 00 00 00 ]; |
| 101 | 81 | }; |
| 102 | 82 | cpsw_emac1: slave@1 { |
| 103 | − slave_reg_ofs = <0x308>; | |
| 104 | − sliver_reg_ofs = <0xdc0>; | |
| 105 | − phy_id = "davinci_mdio.16:01"; | |
| 83 | + phy_id = <&davinci_mdio>, <1>; | |
| 106 | 84 | /* Filled in by U-Boot */ |
| 107 | 85 | mac-address = [ 00 00 00 00 00 00 ]; |
| 108 | 86 | }; |
| @@ -905,6 +905,24 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 904 unmodified lines | ||
| 905 | 905 | gpt [EFI] Forces disk with valid GPT signature but |
| 906 | 906 | invalid Protective MBR to be treated as GPT. |
| 907 | 907 | |
| 908 | + grcan.enable0= [HW] Configuration of physical interface 0. Determines | |
| 909 | + the "Enable 0" bit of the configuration register. | |
| 910 | + Format: 0 | 1 | |
| 911 | + Default: 0 | |
| 912 | + grcan.enable1= [HW] Configuration of physical interface 1. Determines | |
| 913 | + the "Enable 0" bit of the configuration register. | |
| 914 | + Format: 0 | 1 | |
| 915 | + Default: 0 | |
| 916 | + grcan.select= [HW] Select which physical interface to use. | |
| 917 | + Format: 0 | 1 | |
| 918 | + Default: 0 | |
| 919 | + grcan.txsize= [HW] Sets the size of the tx buffer. | |
| 920 | + Format: <unsigned int> such that (txsize & ~0x1fffc0) == 0. | |
| 921 | + Default: 1024 | |
| 922 | + grcan.rxsize= [HW] Sets the size of the rx buffer. | |
| 923 | + Format: <unsigned int> such that (rxsize & ~0x1fffc0) == 0. | |
| 924 | + Default: 1024 | |
| 925 | + | |
| 908 | 926 | hashdist= [KNL,NUMA] Large hashes allocated during boot |
| 909 | 927 | are distributed across NUMA nodes. Defaults on |
| 910 | 928 | for 64-bit NUMA, off otherwise. |
| @@ -203,7 +203,8 @@ abled during run time. Following log_levels are defined: · 202 unmodified lines | ||
| 203 | 203 | 2 - Enable messages related to route added / changed / deleted |
| 204 | 204 | 4 - Enable messages related to translation table operations |
| 205 | 205 | 8 - Enable messages related to bridge loop avoidance |
| 206 | −15 - enable all messages | |
| 206 | +16 - Enable messaged related to DAT, ARP snooping and parsing | |
| 207 | +31 - Enable all messages | |
| 207 | 208 | |
| 208 | 209 | The debug output can be changed at runtime using the file |
| 209 | 210 | /sys/class/net/bat0/mesh/log_level. e.g. |
| @@ -30,16 +30,24 @@ neigh/default/gc_thresh3 - INTEGER · 29 unmodified lines | ||
| 30 | 30 | Maximum number of neighbor entries allowed. Increase this |
| 31 | 31 | when using large numbers of interfaces and when communicating |
| 32 | 32 | with large numbers of directly-connected peers. |
| 33 | + Default: 1024 | |
| 33 | 34 | |
| 34 | 35 | neigh/default/unres_qlen_bytes - INTEGER |
| 35 | 36 | The maximum number of bytes which may be used by packets |
| 36 | 37 | queued for each unresolved address by other network layers. |
| 37 | 38 | (added in linux 3.3) |
| 39 | + Seting negative value is meaningless and will retrun error. | |
| 40 | + Default: 65536 Bytes(64KB) | |
| 38 | 41 | |
| 39 | 42 | neigh/default/unres_qlen - INTEGER |
| 40 | 43 | The maximum number of packets which may be queued for each |
| 41 | 44 | unresolved address by other network layers. |
| 42 | 45 | (deprecated in linux 3.3) : use unres_qlen_bytes instead. |
| 46 | + Prior to linux 3.3, the default value is 3 which may cause | |
| 47 | + unexpected packet loss. The current default value is calculated | |
| 48 | + according to default value of unres_qlen_bytes and true size of | |
| 49 | + packet. | |
| 50 | + Default: 31 | |
| 43 | 51 | |
| 44 | 52 | mtu_expires - INTEGER |
| 45 | 53 | Time, in seconds, that cached PMTU information is kept. |
| @@ -199,15 +207,16 @@ tcp_early_retrans - INTEGER · 153 unmodified lines | ||
| 199 | 207 | Default: 2 |
| 200 | 208 | |
| 201 | 209 | tcp_ecn - INTEGER |
| 202 | − Enable Explicit Congestion Notification (ECN) in TCP. ECN is only | |
| 203 | − used when both ends of the TCP flow support it. It is useful to | |
| 204 | − avoid losses due to congestion (when the bottleneck router supports | |
| 205 | − ECN). | |
| 210 | + Control use of Explicit Congestion Notification (ECN) by TCP. | |
| 211 | + ECN is used only when both ends of the TCP connection indicate | |
| 212 | + support for it. This feature is useful in avoiding losses due | |
| 213 | + to congestion by allowing supporting routers to signal | |
| 214 | + congestion before having to drop packets. | |
| 206 | 215 | Possible values are: |
| 207 | − 0 disable ECN | |
| 208 | − 1 ECN enabled | |
| 209 | − 2 Only server-side ECN enabled. If the other end does | |
| 210 | − not support ECN, behavior is like with ECN disabled. | |
| 216 | + 0 Disable ECN. Neither initiate nor accept ECN. | |
| 217 | + 1 Always request ECN on outgoing connection attempts. | |
| 218 | + 2 Enable ECN when requested by incomming connections | |
| 219 | + but do not request ECN on outgoing connections. | |
| 211 | 220 | Default: 2 |
| 212 | 221 | |
| 213 | 222 | tcp_fack - BOOLEAN |
| @@ -215,15 +224,14 @@ tcp_fack - BOOLEAN · 1 unmodified line | ||
| 215 | 224 | The value is not used, if tcp_sack is not enabled. |
| 216 | 225 | |
| 217 | 226 | tcp_fin_timeout - INTEGER |
| 218 | − Time to hold socket in state FIN-WAIT-2, if it was closed | |
| 219 | − by our side. Peer can be broken and never close its side, | |
| 220 | − or even died unexpectedly. Default value is 60sec. | |
| 221 | − Usual value used in 2.2 was 180 seconds, you may restore | |
| 222 | − it, but remember that if your machine is even underloaded WEB server, | |
| 223 | − you risk to overflow memory with kilotons of dead sockets, | |
| 224 | − FIN-WAIT-2 sockets are less dangerous than FIN-WAIT-1, | |
| 225 | − because they eat maximum 1.5K of memory, but they tend | |
| 226 | − to live longer. Cf. tcp_max_orphans. | |
| 227 | + The length of time an orphaned (no longer referenced by any | |
| 228 | + application) connection will remain in the FIN_WAIT_2 state | |
| 229 | + before it is aborted at the local end. While a perfectly | |
| 230 | + valid "receive only" state for an un-orphaned connection, an | |
| 231 | + orphaned connection in FIN_WAIT_2 state could otherwise wait | |
| 232 | + forever for the remote to close its end of the connection. | |
| 233 | + Cf. tcp_max_orphans | |
| 234 | + Default: 60 seconds | |
| 227 | 235 | |
| 228 | 236 | tcp_frto - INTEGER |
| 229 | 237 | Enables Forward RTO-Recovery (F-RTO) defined in RFC4138. |
| @@ -1514,6 +1522,20 @@ cookie_preserve_enable - BOOLEAN · 1284 unmodified lines | ||
| 1514 | 1522 | |
| 1515 | 1523 | Default: 1 |
| 1516 | 1524 | |
| 1525 | +cookie_hmac_alg - STRING | |
| 1526 | + Select the hmac algorithm used when generating the cookie value sent by | |
| 1527 | + a listening sctp socket to a connecting client in the INIT-ACK chunk. | |
| 1528 | + Valid values are: | |
| 1529 | + * md5 | |
| 1530 | + * sha1 | |
| 1531 | + * none | |
| 1532 | + Ability to assign md5 or sha1 as the selected alg is predicated on the | |
| 1533 | + configuarion of those algorithms at build time (CONFIG_CRYPTO_MD5 and | |
| 1534 | + CONFIG_CRYPTO_SHA1). | |
| 1535 | + | |
| 1536 | + Default: Dependent on configuration. MD5 if available, else SHA1 if | |
| 1537 | + available, else none. | |
| 1538 | + | |
| 1517 | 1539 | rcvbuf_policy - INTEGER |
| 1518 | 1540 | Determines if the receive buffer is attributed to the socket or to |
| 1519 | 1541 | association. SCTP supports the capability to create multiple |
| @@ -3,9 +3,9 @@ · 2 unmodified lines | ||
| 3 | 3 | -------------------------------------------------------------------------------- |
| 4 | 4 | |
| 5 | 5 | This file documents the mmap() facility available with the PACKET |
| 6 | −socket interface on 2.4 and 2.6 kernels. This type of sockets is used for | |
| 7 | −capture network traffic with utilities like tcpdump or any other that needs | |
| 8 | −raw access to network interface. | |
| 6 | +socket interface on 2.4/2.6/3.x kernels. This type of sockets is used for | |
| 7 | +i) capture network traffic with utilities like tcpdump, ii) transmit network | |
| 8 | +traffic, or any other that needs raw access to network interface. | |
| 9 | 9 | |
| 10 | 10 | You can find the latest version of this document at: |
| 11 | 11 | http://wiki.ipxwarzone.com/index.php5?title=Linux_packet_mmap |
| @@ -21,19 +21,18 @@ Please send your comments to · 9 unmodified lines | ||
| 21 | 21 | + Why use PACKET_MMAP |
| 22 | 22 | -------------------------------------------------------------------------------- |
| 23 | 23 | |
| 24 | −In Linux 2.4/2.6 if PACKET_MMAP is not enabled, the capture process is very | |
| 25 | −inefficient. It uses very limited buffers and requires one system call | |
| 26 | −to capture each packet, it requires two if you want to get packet's | |
| 27 | −timestamp (like libpcap always does). | |
| 24 | +In Linux 2.4/2.6/3.x if PACKET_MMAP is not enabled, the capture process is very | |
| 25 | +inefficient. It uses very limited buffers and requires one system call to | |
| 26 | +capture each packet, it requires two if you want to get packet's timestamp | |
| 27 | +(like libpcap always does). | |
| 28 | 28 | |
| 29 | 29 | In the other hand PACKET_MMAP is very efficient. PACKET_MMAP provides a size |
| 30 | 30 | configurable circular buffer mapped in user space that can be used to either |
| 31 | 31 | send or receive packets. This way reading packets just needs to wait for them, |
| 32 | 32 | most of the time there is no need to issue a single system call. Concerning |
| 33 | 33 | transmission, multiple packets can be sent through one system call to get the |
| 34 | −highest bandwidth. | |
| 35 | −By using a shared buffer between the kernel and the user also has the benefit | |
| 36 | −of minimizing packet copies. | |
| 34 | +highest bandwidth. By using a shared buffer between the kernel and the user | |
| 35 | +also has the benefit of minimizing packet copies. | |
| 37 | 36 | |
| 38 | 37 | It's fine to use PACKET_MMAP to improve the performance of the capture and |
| 39 | 38 | transmission process, but it isn't everything. At least, if you are capturing |
| @@ -41,7 +40,8 @@ at high speeds (this is relative to the cpu speed), you should check if the · 1 unmodified line | ||
| 41 | 40 | device driver of your network interface card supports some sort of interrupt |
| 42 | 41 | load mitigation or (even better) if it supports NAPI, also make sure it is |
| 43 | 42 | enabled. For transmission, check the MTU (Maximum Transmission Unit) used and |
| 44 | −supported by devices of your network. | |
| 43 | +supported by devices of your network. CPU IRQ pinning of your network interface | |
| 44 | +card can also be an advantage. | |
| 45 | 45 | |
| 46 | 46 | -------------------------------------------------------------------------------- |
| 47 | 47 | + How to use mmap() to improve capture process |
| @@ -87,9 +87,7 @@ the following process: · 39 unmodified lines | ||
| 87 | 87 | socket creation and destruction is straight forward, and is done |
| 88 | 88 | the same way with or without PACKET_MMAP: |
| 89 | 89 | |
| 90 | −int fd; | |
| 91 | − | |
| 92 | −fd= socket(PF_PACKET, mode, htons(ETH_P_ALL)) | |
| 90 | + int fd = socket(PF_PACKET, mode, htons(ETH_P_ALL)); | |
| 93 | 91 | |
| 94 | 92 | where mode is SOCK_RAW for the raw interface were link level |
| 95 | 93 | information can be captured or SOCK_DGRAM for the cooked |
| @@ -163,11 +161,23 @@ As capture, each frame contains two parts: · 67 unmodified lines | ||
| 163 | 161 | |
| 164 | 162 | A complete tutorial is available at: http://wiki.gnu-log.net/ |
| 165 | 163 | |
| 164 | +By default, the user should put data at : | |
| 165 | + frame base + TPACKET_HDRLEN - sizeof(struct sockaddr_ll) | |
| 166 | + | |
| 167 | +So, whatever you choose for the socket mode (SOCK_DGRAM or SOCK_RAW), | |
| 168 | +the beginning of the user data will be at : | |
| 169 | + frame base + TPACKET_ALIGN(sizeof(struct tpacket_hdr)) | |
| 170 | + | |
| 171 | +If you wish to put user data at a custom offset from the beginning of | |
| 172 | +the frame (for payload alignment with SOCK_RAW mode for instance) you | |
| 173 | +can set tp_net (with SOCK_DGRAM) or tp_mac (with SOCK_RAW). In order | |
| 174 | +to make this work it must be enabled previously with setsockopt() | |
| 175 | +and the PACKET_TX_HAS_OFF option. | |
| 176 | + | |
| 166 | 177 | -------------------------------------------------------------------------------- |
| 167 | 178 | + PACKET_MMAP settings |
| 168 | 179 | -------------------------------------------------------------------------------- |
| 169 | 180 | |
| 170 | − | |
| 171 | 181 | To setup PACKET_MMAP from user level code is done with a call like |
| 172 | 182 | |
| 173 | 183 | - Capture process |
| @@ -201,7 +211,6 @@ indeed, packet_set_ring checks that the following condition is true · 27 unmodified lines | ||
| 201 | 211 | |
| 202 | 212 | frames_per_block * tp_block_nr == tp_frame_nr |
| 203 | 213 | |
| 204 | − | |
| 205 | 214 | Lets see an example, with the following values: |
| 206 | 215 | |
| 207 | 216 | tp_block_size= 4096 |
| @@ -227,7 +236,6 @@ be spawned across two blocks, so there are some details you have to take into · 19 unmodified lines | ||
| 227 | 236 | account when choosing the frame_size. See "Mapping and use of the circular |
| 228 | 237 | buffer (ring)". |
| 229 | 238 | |
| 230 | − | |
| 231 | 239 | -------------------------------------------------------------------------------- |
| 232 | 240 | + PACKET_MMAP setting constraints |
| 233 | 241 | -------------------------------------------------------------------------------- |
| @@ -264,7 +272,6 @@ User space programs can include /usr/include/sys/user.h and · 30 unmodified lines | ||
| 264 | 272 | The pagesize can also be determined dynamically with the getpagesize (2) |
| 265 | 273 | system call. |
| 266 | 274 | |
| 267 | − | |
| 268 | 275 | Block number limit |
| 269 | 276 | -------------------- |
| 270 | 277 | |
| @@ -284,7 +291,6 @@ called pg_vec, its size limits the number of blocks that can be allocated. · 13 unmodified lines | ||
| 284 | 291 | v block #2 |
| 285 | 292 | block #1 |
| 286 | 293 | |
| 287 | − | |
| 288 | 294 | kmalloc allocates any number of bytes of physically contiguous memory from |
| 289 | 295 | a pool of pre-determined sizes. This pool of memory is maintained by the slab |
| 290 | 296 | allocator which is at the end the responsible for doing the allocation and |
| @@ -299,7 +305,6 @@ pointers to blocks is · 8 unmodified lines | ||
| 299 | 305 | |
| 300 | 306 | 131072/4 = 32768 blocks |
| 301 | 307 | |
| 302 | − | |
| 303 | 308 | PACKET_MMAP buffer size calculator |
| 304 | 309 | ------------------------------------ |
| 305 | 310 | |
| @@ -340,7 +345,6 @@ and a value for <frame size> of 2048 bytes. These parameters will yield · 34 unmodified lines | ||
| 340 | 345 | and hence the buffer will have a 262144 MiB size. So it can hold |
| 341 | 346 | 262144 MiB / 2048 bytes = 134217728 frames |
| 342 | 347 | |
| 343 | − | |
| 344 | 348 | Actually, this buffer size is not possible with an i386 architecture. |
| 345 | 349 | Remember that the memory is allocated in kernel space, in the case of |
| 346 | 350 | an i386 kernel's memory size is limited to 1GiB. |
| @@ -372,7 +376,6 @@ the following (from include/linux/if_packet.h): · 25 unmodified lines | ||
| 372 | 376 | - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. |
| 373 | 377 | - Pad to align to TPACKET_ALIGNMENT=16 |
| 374 | 378 | */ |
| 375 | − | |
| 376 | 379 | |
| 377 | 380 | The following are conditions that are checked in packet_set_ring |
| 378 | 381 | |
| @@ -413,7 +416,6 @@ and the following flags apply: · 34 unmodified lines | ||
| 413 | 416 | #define TP_STATUS_LOSING 4 |
| 414 | 417 | #define TP_STATUS_CSUMNOTREADY 8 |
| 415 | 418 | |
| 416 | − | |
| 417 | 419 | TP_STATUS_COPY : This flag indicates that the frame (and associated |
| 418 | 420 | meta information) has been truncated because it's |
| 419 | 421 | larger than tp_frame_size. This packet can be |
| @@ -462,7 +464,6 @@ packets are in the ring: · 42 unmodified lines | ||
| 462 | 464 | It doesn't incur in a race condition to first check the status value and |
| 463 | 465 | then poll for frames. |
| 464 | 466 | |
| 465 | − | |
| 466 | 467 | ++ Transmission process |
| 467 | 468 | Those defines are also used for transmission: |
| 468 | 469 | |
| @@ -493,6 +494,196 @@ The user can also use poll() to check if a buffer is available: · 24 unmodified lines | ||
| 493 | 494 | pfd.events = POLLOUT; |
| 494 | 495 | retval = poll(&pfd, 1, timeout); |
| 495 | 496 | |
| 497 | +------------------------------------------------------------------------------- | |
| 498 | ++ What TPACKET versions are available and when to use them? | |
| 499 | +------------------------------------------------------------------------------- | |
| 500 | + | |
| 501 | + int val = tpacket_version; | |
| 502 | + setsockopt(fd, SOL_PACKET, PACKET_VERSION, &val, sizeof(val)); | |
| 503 | + getsockopt(fd, SOL_PACKET, PACKET_VERSION, &val, sizeof(val)); | |
| 504 | + | |
| 505 | +where 'tpacket_version' can be TPACKET_V1 (default), TPACKET_V2, TPACKET_V3. | |
| 506 | + | |
| 507 | +TPACKET_V1: | |
| 508 | + - Default if not otherwise specified by setsockopt(2) | |
| 509 | + - RX_RING, TX_RING available | |
| 510 | + - VLAN metadata information available for packets | |
| 511 | + (TP_STATUS_VLAN_VALID) | |
| 512 | + | |
| 513 | +TPACKET_V1 --> TPACKET_V2: | |
| 514 | + - Made 64 bit clean due to unsigned long usage in TPACKET_V1 | |
| 515 | + structures, thus this also works on 64 bit kernel with 32 bit | |
| 516 | + userspace and the like | |
| 517 | + - Timestamp resolution in nanoseconds instead of microseconds | |
| 518 | + - RX_RING, TX_RING available | |
| 519 | + - How to switch to TPACKET_V2: | |
| 520 | + 1. Replace struct tpacket_hdr by struct tpacket2_hdr | |
| 521 | + 2. Query header len and save | |
| 522 | + 3. Set protocol version to 2, set up ring as usual | |
| 523 | + 4. For getting the sockaddr_ll, | |
| 524 | + use (void *)hdr + TPACKET_ALIGN(hdrlen) instead of | |
| 525 | + (void *)hdr + TPACKET_ALIGN(sizeof(struct tpacket_hdr)) | |
| 526 | + | |
| 527 | +TPACKET_V2 --> TPACKET_V3: | |
| 528 | + - Flexible buffer implementation: | |
| 529 | + 1. Blocks can be configured with non-static frame-size | |
| 530 | + 2. Read/poll is at a block-level (as opposed to packet-level) | |
| 531 | + 3. Added poll timeout to avoid indefinite user-space wait | |
| 532 | + on idle links | |
| 533 | + 4. Added user-configurable knobs: | |
| 534 | + 4.1 block::timeout | |
| 535 | + 4.2 tpkt_hdr::sk_rxhash | |
| 536 | + - RX Hash data available in user space | |
| 537 | + - Currently only RX_RING available | |
| 538 | + | |
| 539 | +------------------------------------------------------------------------------- | |
| 540 | ++ AF_PACKET fanout mode | |
| 541 | +------------------------------------------------------------------------------- | |
| 542 | + | |
| 543 | +In the AF_PACKET fanout mode, packet reception can be load balanced among | |
| 544 | +processes. This also works in combination with mmap(2) on packet sockets. | |
| 545 | + | |
| 546 | +Minimal example code by David S. Miller (try things like "./test eth0 hash", | |
| 547 | +"./test eth0 lb", etc.): | |
| 548 | + | |
| 549 | +#include <stddef.h> | |
| 550 | +#include <stdlib.h> | |
| 551 | +#include <stdio.h> | |
| 552 | +#include <string.h> | |
| 553 | + | |
| 554 | +#include <sys/types.h> | |
| 555 | +#include <sys/wait.h> | |
| 556 | +#include <sys/socket.h> | |
| 557 | +#include <sys/ioctl.h> | |
| 558 | + | |
| 559 | +#include <unistd.h> | |
| 560 | + | |
| 561 | +#include <linux/if_ether.h> | |
| 562 | +#include <linux/if_packet.h> | |
| 563 | + | |
| 564 | +#include <net/if.h> | |
| 565 | + | |
| 566 | +static const char *device_name; | |
| 567 | +static int fanout_type; | |
| 568 | +static int fanout_id; | |
| 569 | + | |
| 570 | +#ifndef PACKET_FANOUT | |
| 571 | +# define PACKET_FANOUT 18 | |
| 572 | +# define PACKET_FANOUT_HASH 0 | |
| 573 | +# define PACKET_FANOUT_LB 1 | |
| 574 | +#endif | |
| 575 | + | |
| 576 | +static int setup_socket(void) | |
| 577 | +{ | |
| 578 | + int err, fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_IP)); | |
| 579 | + struct sockaddr_ll ll; | |
| 580 | + struct ifreq ifr; | |
| 581 | + int fanout_arg; | |
| 582 | + | |
| 583 | + if (fd < 0) { | |
| 584 | + perror("socket"); | |
| 585 | + return EXIT_FAILURE; | |
| 586 | + } | |
| 587 | + | |
| 588 | + memset(&ifr, 0, sizeof(ifr)); | |
| 589 | + strcpy(ifr.ifr_name, device_name); | |
| 590 | + err = ioctl(fd, SIOCGIFINDEX, &ifr); | |
| 591 | + if (err < 0) { | |
| 592 | + perror("SIOCGIFINDEX"); | |
| 593 | + return EXIT_FAILURE; | |
| 594 | + } | |
| 595 | + | |
| 596 | + memset(&ll, 0, sizeof(ll)); | |
| 597 | + ll.sll_family = AF_PACKET; | |
| 598 | + ll.sll_ifindex = ifr.ifr_ifindex; | |
| 599 | + err = bind(fd, (struct sockaddr *) &ll, sizeof(ll)); | |
| 600 | + if (err < 0) { | |
| 601 | + perror("bind"); | |
| 602 | + return EXIT_FAILURE; | |
| 603 | + } | |
| 604 | + | |
| 605 | + fanout_arg = (fanout_id | (fanout_type << 16)); | |
| 606 | + err = setsockopt(fd, SOL_PACKET, PACKET_FANOUT, | |
| 607 | + &fanout_arg, sizeof(fanout_arg)); | |
| 608 | + if (err) { | |
| 609 | + perror("setsockopt"); | |
| 610 | + return EXIT_FAILURE; | |
| 611 | + } | |
| 612 | + | |
| 613 | + return fd; | |
| 614 | +} | |
| 615 | + | |
| 616 | +static void fanout_thread(void) | |
| 617 | +{ | |
| 618 | + int fd = setup_socket(); | |
| 619 | + int limit = 10000; | |
| 620 | + | |
| 621 | + if (fd < 0) | |
| 622 | + exit(fd); | |
| 623 | + | |
| 624 | + while (limit-- > 0) { | |
| 625 | + char buf[1600]; | |
| 626 | + int err; | |
| 627 | + | |
| 628 | + err = read(fd, buf, sizeof(buf)); | |
| 629 | + if (err < 0) { | |
| 630 | + perror("read"); | |
| 631 | + exit(EXIT_FAILURE); | |
| 632 | + } | |
| 633 | + if ((limit % 10) == 0) | |
| 634 | + fprintf(stdout, "(%d) \n", getpid()); | |
| 635 | + } | |
| 636 | + | |
| 637 | + fprintf(stdout, "%d: Received 10000 packets\n", getpid()); | |
| 638 | + | |
| 639 | + close(fd); | |
| 640 | + exit(0); | |
| 641 | +} | |
| 642 | + | |
| 643 | +int main(int argc, char **argp) | |
| 644 | +{ | |
| 645 | + int fd, err; | |
| 646 | + int i; | |
| 647 | + | |
| 648 | + if (argc != 3) { | |
| 649 | + fprintf(stderr, "Usage: %s INTERFACE {hash|lb}\n", argp[0]); | |
| 650 | + return EXIT_FAILURE; | |
| 651 | + } | |
| 652 | + | |
| 653 | + if (!strcmp(argp[2], "hash")) | |
| 654 | + fanout_type = PACKET_FANOUT_HASH; | |
| 655 | + else if (!strcmp(argp[2], "lb")) | |
| 656 | + fanout_type = PACKET_FANOUT_LB; | |
| 657 | + else { | |
| 658 | + fprintf(stderr, "Unknown fanout type [%s]\n", argp[2]); | |
| 659 | + exit(EXIT_FAILURE); | |
| 660 | + } | |
| 661 | + | |
| 662 | + device_name = argp[1]; | |
| 663 | + fanout_id = getpid() & 0xffff; | |
| 664 | + | |
| 665 | + for (i = 0; i < 4; i++) { | |
| 666 | + pid_t pid = fork(); | |
| 667 | + | |
| 668 | + switch (pid) { | |
| 669 | + case 0: | |
| 670 | + fanout_thread(); | |
| 671 | + | |
| 672 | + case -1: | |
| 673 | + perror("fork"); | |
| 674 | + exit(EXIT_FAILURE); | |
| 675 | + } | |
| 676 | + } | |
| 677 | + | |
| 678 | + for (i = 0; i < 4; i++) { | |
| 679 | + int status; | |
| 680 | + | |
| 681 | + wait(&status); | |
| 682 | + } | |
| 683 | + | |
| 684 | + return 0; | |
| 685 | +} | |
| 686 | + | |
| 496 | 687 | ------------------------------------------------------------------------------- |
| 497 | 688 | + PACKET_TIMESTAMP |
| 498 | 689 | ------------------------------------------------------------------------------- |
| @@ -519,6 +710,13 @@ the networking stack is used (the behavior before this setting was added). · 20 unmodified lines | ||
| 519 | 710 | See include/linux/net_tstamp.h and Documentation/networking/timestamping |
| 520 | 711 | for more information on hardware timestamps. |
| 521 | 712 | |
| 713 | +------------------------------------------------------------------------------- | |
| 714 | ++ Miscellaneous bits | |
| 715 | +------------------------------------------------------------------------------- | |
| 716 | + | |
| 717 | +- Packet sockets work well together with Linux socket filters, thus you also | |
| 718 | + might want to have a look at Documentation/networking/filter.txt | |
| 719 | + | |
| 522 | 720 | -------------------------------------------------------------------------------- |
| 523 | 721 | + THANKS |
| 524 | 722 | -------------------------------------------------------------------------------- |
| @@ -29,11 +29,9 @@ The kernel configuration option is STMMAC_ETH: · 28 unmodified lines | ||
| 29 | 29 | dma_txsize: DMA tx ring size; |
| 30 | 30 | buf_sz: DMA buffer size; |
| 31 | 31 | tc: control the HW FIFO threshold; |
| 32 | − tx_coe: Enable/Disable Tx Checksum Offload engine; | |
| 33 | 32 | watchdog: transmit timeout (in milliseconds); |
| 34 | 33 | flow_ctrl: Flow control ability [on/off]; |
| 35 | 34 | pause: Flow Control Pause Time; |
| 36 | − tmrate: timer period (only if timer optimisation is configured). | |
| 37 | 35 | |
| 38 | 36 | 3) Command line options |
| 39 | 37 | Driver parameters can be also passed in command line by using: |
| @@ -60,17 +58,19 @@ Then the poll method will be scheduled at some future point. · 20 unmodified lines | ||
| 60 | 58 | The incoming packets are stored, by the DMA, in a list of pre-allocated socket |
| 61 | 59 | buffers in order to avoid the memcpy (Zero-copy). |
| 62 | 60 | |
| 63 | −4.3) Timer-Driver Interrupt | |
| 64 | −Instead of having the device that asynchronously notifies the frame receptions, | |
| 65 | −the driver configures a timer to generate an interrupt at regular intervals. | |
| 66 | −Based on the granularity of the timer, the frames that are received by the | |
| 67 | −device will experience different levels of latency. Some NICs have dedicated | |
| 68 | −timer device to perform this task. STMMAC can use either the RTC device or the | |
| 69 | −TMU channel 2 on STLinux platforms. | |
| 70 | −The timers frequency can be passed to the driver as parameter; when change it, | |
| 71 | −take care of both hardware capability and network stability/performance impact. | |
| 72 | −Several performance tests on STM platforms showed this optimisation allows to | |
| 73 | −spare the CPU while having the maximum throughput. | |
| 61 | +4.3) Interrupt Mitigation | |
| 62 | +The driver is able to mitigate the number of its DMA interrupts | |
| 63 | +using NAPI for the reception on chips older than the 3.50. | |
| 64 | +New chips have an HW RX-Watchdog used for this mitigation. | |
| 65 | + | |
| 66 | +On Tx-side, the mitigation schema is based on a SW timer that calls the | |
| 67 | +tx function (stmmac_tx) to reclaim the resource after transmitting the | |
| 68 | +frames. | |
| 69 | +Also there is another parameter (like a threshold) used to program | |
| 70 | +the descriptors avoiding to set the interrupt on completion bit in | |
| 71 | +when the frame is sent (xmit). | |
| 72 | + | |
| 73 | +Mitigation parameters can be tuned by ethtool. | |
| 74 | 74 | |
| 75 | 75 | 4.4) WOL |
| 76 | 76 | Wake up on Lan feature through Magic and Unicast frames are supported for the |
| @@ -121,6 +121,7 @@ struct plat_stmmacenet_data { · 44 unmodified lines | ||
| 121 | 121 | int bugged_jumbo; |
| 122 | 122 | int pmt; |
| 123 | 123 | int force_sf_dma_mode; |
| 124 | + int riwt_off; | |
| 124 | 125 | void (*fix_mac_speed)(void *priv, unsigned int speed); |
| 125 | 126 | void (*bus_setup)(void __iomem *ioaddr); |
| 126 | 127 | int (*init)(struct platform_device *pdev); |
| @@ -156,6 +157,7 @@ Where: · 29 unmodified lines | ||
| 156 | 157 | o pmt: core has the embedded power module (optional). |
| 157 | 158 | o force_sf_dma_mode: force DMA to use the Store and Forward mode |
| 158 | 159 | instead of the Threshold. |
| 160 | + o riwt_off: force to disable the RX watchdog feature and switch to NAPI mode. | |
| 159 | 161 | o fix_mac_speed: this callback is used for modifying some syscfg registers |
| 160 | 162 | (on ST SoCs) according to the link speed negotiated by the |
| 161 | 163 | physical layer . |
| @@ -1680,10 +1680,9 @@ F: drivers/net/ethernet/broadcom/tg3.* · 1679 unmodified lines | ||
| 1680 | 1680 | |
| 1681 | 1681 | BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER |
| 1682 | 1682 | M: Brett Rudley <brudley@broadcom.com> |
| 1683 | −M: Roland Vossen <rvossen@broadcom.com> | |
| 1684 | 1683 | M: Arend van Spriel <arend@broadcom.com> |
| 1685 | 1684 | M: Franky (Zhenhui) Lin <frankyl@broadcom.com> |
| 1686 | −M: Kan Yan <kanyan@broadcom.com> | |
| 1685 | +M: Hante Meuleman <meuleman@broadcom.com> | |
| 1687 | 1686 | L: linux-wireless@vger.kernel.org |
| 1688 | 1687 | L: brcm80211-dev-list@broadcom.com |
| 1689 | 1688 | S: Supported |
| @@ -3949,7 +3948,9 @@ M: Greg Rose <gregory.v.rose@intel.com> · 2259 unmodified lines | ||
| 3949 | 3948 | M: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> |
| 3950 | 3949 | M: Alex Duyck <alexander.h.duyck@intel.com> |
| 3951 | 3950 | M: John Ronciak <john.ronciak@intel.com> |
| 3951 | +M: Tushar Dave <tushar.n.dave@intel.com> | |
| 3952 | 3952 | L: e1000-devel@lists.sourceforge.net |
| 3953 | +W: http://www.intel.com/support/feedback.htm | |
| 3953 | 3954 | W: http://e1000.sourceforge.net/ |
| 3954 | 3955 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net.git |
| 3955 | 3956 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next.git |
| @@ -4833,6 +4834,14 @@ F: Documentation/scsi/megaraid.txt · 877 unmodified lines | ||
| 4833 | 4834 | F: drivers/scsi/megaraid.* |
| 4834 | 4835 | F: drivers/scsi/megaraid/ |
| 4835 | 4836 | |
| 4837 | +MELLANOX ETHERNET DRIVER (mlx4_en) | |
| 4838 | +M: Amir Vadai <amirv@mellanox.com> | |
| 4839 | +L: netdev@vger.kernel.org | |
| 4840 | +S: Supported | |
| 4841 | +W: http://www.mellanox.com | |
| 4842 | +Q: http://patchwork.ozlabs.org/project/netdev/list/ | |
| 4843 | +F: drivers/net/ethernet/mellanox/mlx4/en_* | |
| 4844 | + | |
| 4836 | 4845 | MEMORY MANAGEMENT |
| 4837 | 4846 | L: linux-mm@kvack.org |
| 4838 | 4847 | W: http://www.linux-mm.org |
| @@ -5075,7 +5084,7 @@ NETWORKING [GENERAL] · 236 unmodified lines | ||
| 5075 | 5084 | M: "David S. Miller" <davem@davemloft.net> |
| 5076 | 5085 | L: netdev@vger.kernel.org |
| 5077 | 5086 | W: http://www.linuxfoundation.org/en/Net |
| 5078 | −W: http://patchwork.ozlabs.org/project/netdev/list/ | |
| 5087 | +Q: http://patchwork.ozlabs.org/project/netdev/list/ | |
| 5079 | 5088 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git |
| 5080 | 5089 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git |
| 5081 | 5090 | S: Maintained |
| @@ -5135,6 +5144,7 @@ F: drivers/net/wireless/ · 53 unmodified lines | ||
| 5135 | 5144 | NETWORKING DRIVERS |
| 5136 | 5145 | L: netdev@vger.kernel.org |
| 5137 | 5146 | W: http://www.linuxfoundation.org/en/Net |
| 5147 | +Q: http://patchwork.ozlabs.org/project/netdev/list/ | |
| 5138 | 5148 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git |
| 5139 | 5149 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git |
| 5140 | 5150 | S: Odd Fixes |
| @@ -5167,6 +5177,7 @@ F: net/nfc/ · 26 unmodified lines | ||
| 5167 | 5177 | F: include/linux/nfc.h |
| 5168 | 5178 | F: include/net/nfc/ |
| 5169 | 5179 | F: drivers/nfc/ |
| 5180 | +F: include/linux/platform_data/pn544.h | |
| 5170 | 5181 | |
| 5171 | 5182 | NFS, SUNRPC, AND LOCKD CLIENTS |
| 5172 | 5183 | M: Trond Myklebust <Trond.Myklebust@netapp.com> |
| @@ -6442,6 +6453,7 @@ F: drivers/scsi/st* · 1269 unmodified lines | ||
| 6442 | 6453 | SCTP PROTOCOL |
| 6443 | 6454 | M: Vlad Yasevich <vyasevich@gmail.com> |
| 6444 | 6455 | M: Sridhar Samudrala <sri@us.ibm.com> |
| 6456 | +M: Neil Horman <nhorman@tuxdriver.com> | |
| 6445 | 6457 | L: linux-sctp@vger.kernel.org |
| 6446 | 6458 | W: http://lksctp.sourceforge.net |
| 6447 | 6459 | S: Maintained |
| @@ -7469,8 +7481,7 @@ S: Maintained · 1021 unmodified lines | ||
| 7469 | 7481 | F: drivers/net/ethernet/dec/tulip/ |
| 7470 | 7482 | |
| 7471 | 7483 | TUN/TAP driver |
| 7472 | −M: Maxim Krasnyansky <maxk@qualcomm.com> | |
| 7473 | −L: vtun@office.satix.net | |
| 7484 | +M: Maxim Krasnyansky <maxk@qti.qualcomm.com> | |
| 7474 | 7485 | W: http://vtun.sourceforge.net/tun |
| 7475 | 7486 | S: Maintained |
| 7476 | 7487 | F: Documentation/networking/tuntap.txt |
| @@ -7592,6 +7603,12 @@ S: Maintained · 115 unmodified lines | ||
| 7592 | 7603 | F: Documentation/usb/acm.txt |
| 7593 | 7604 | F: drivers/usb/class/cdc-acm.* |
| 7594 | 7605 | |
| 7606 | +USB AR5523 WIRELESS DRIVER | |
| 7607 | +M: Pontus Fuchs <pontus.fuchs@gmail.com> | |
| 7608 | +L: linux-wireless@vger.kernel.org | |
| 7609 | +S: Maintained | |
| 7610 | +F: drivers/net/wireless/ath/ar5523/ | |
| 7611 | + | |
| 7595 | 7612 | USB ATTACHED SCSI |
| 7596 | 7613 | M: Matthew Wilcox <willy@linux.intel.com> |
| 7597 | 7614 | M: Sarah Sharp <sarah.a.sharp@linux.intel.com> |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | ||
| 47 | 47 | /* Socket filtering */ |
| 48 | 48 | #define SO_ATTACH_FILTER 26 |
| 49 | 49 | #define SO_DETACH_FILTER 27 |
| 50 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 50 | 51 | |
| 51 | 52 | #define SO_PEERNAME 28 |
| 52 | 53 | #define SO_TIMESTAMP 29 |
| @@ -128,3 +128,11 @@ · 127 unmodified lines | ||
| 128 | 128 | }; |
| 129 | 129 | }; |
| 130 | 130 | }; |
| 131 | + | |
| 132 | +&cpsw_emac0 { | |
| 133 | + phy_id = <&davinci_mdio>, <0>; | |
| 134 | +}; | |
| 135 | + | |
| 136 | +&cpsw_emac1 { | |
| 137 | + phy_id = <&davinci_mdio>, <1>; | |
| 138 | +}; | |
| @@ -236,3 +236,11 @@ · 235 unmodified lines | ||
| 236 | 236 | }; |
| 237 | 237 | }; |
| 238 | 238 | }; |
| 239 | + | |
| 240 | +&cpsw_emac0 { | |
| 241 | + phy_id = <&davinci_mdio>, <0>; | |
| 242 | +}; | |
| 243 | + | |
| 244 | +&cpsw_emac1 { | |
| 245 | + phy_id = <&davinci_mdio>, <1>; | |
| 246 | +}; | |
| @@ -338,5 +338,52 @@ · 337 unmodified lines | ||
| 338 | 338 | power = <250>; |
| 339 | 339 | ti,hwmods = "usb_otg_hs"; |
| 340 | 340 | }; |
| 341 | + | |
| 342 | + mac: ethernet@4a100000 { | |
| 343 | + compatible = "ti,cpsw"; | |
| 344 | + ti,hwmods = "cpgmac0"; | |
| 345 | + cpdma_channels = <8>; | |
| 346 | + ale_entries = <1024>; | |
| 347 | + bd_ram_size = <0x2000>; | |
| 348 | + no_bd_ram = <0>; | |
| 349 | + rx_descs = <64>; | |
| 350 | + mac_control = <0x20>; | |
| 351 | + slaves = <2>; | |
| 352 | + cpts_active_slave = <0>; | |
| 353 | + cpts_clock_mult = <0x80000000>; | |
| 354 | + cpts_clock_shift = <29>; | |
| 355 | + reg = <0x4a100000 0x800 | |
| 356 | + 0x4a101200 0x100>; | |
| 357 | + #address-cells = <1>; | |
| 358 | + #size-cells = <1>; | |
| 359 | + interrupt-parent = <&intc>; | |
| 360 | + /* | |
| 361 | + * c0_rx_thresh_pend | |
| 362 | + * c0_rx_pend | |
| 363 | + * c0_tx_pend | |
| 364 | + * c0_misc_pend | |
| 365 | + */ | |
| 366 | + interrupts = <40 41 42 43>; | |
| 367 | + ranges; | |
| 368 | + | |
| 369 | + davinci_mdio: mdio@4a101000 { | |
| 370 | + compatible = "ti,davinci_mdio"; | |
| 371 | + #address-cells = <1>; | |
| 372 | + #size-cells = <0>; | |
| 373 | + ti,hwmods = "davinci_mdio"; | |
| 374 | + bus_freq = <1000000>; | |
| 375 | + reg = <0x4a101000 0x100>; | |
| 376 | + }; | |
| 377 | + | |
| 378 | + cpsw_emac0: slave@4a100200 { | |
| 379 | + /* Filled in by U-Boot */ | |
| 380 | + mac-address = [ 00 00 00 00 00 00 ]; | |
| 381 | + }; | |
| 382 | + | |
| 383 | + cpsw_emac1: slave@4a100300 { | |
| 384 | + /* Filled in by U-Boot */ | |
| 385 | + mac-address = [ 00 00 00 00 00 00 ]; | |
| 386 | + }; | |
| 387 | + }; | |
| 341 | 388 | }; |
| 342 | 389 | }; |
| @@ -596,6 +596,7 @@ · 595 unmodified lines | ||
| 596 | 596 | 66 0x1b0b0 /* MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2 */ |
| 597 | 597 | 70 0x1b0b0 /* MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3 */ |
| 598 | 598 | 48 0x1b0b0 /* MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL */ |
| 599 | + 1033 0x4001b0a8 /* MX6Q_PAD_GPIO_16__ENET_ANATOP_ETHERNET_REF_OUT*/ | |
| 599 | 600 | >; |
| 600 | 601 | }; |
| 601 | 602 | |
| @@ -849,8 +850,8 @@ · 247 unmodified lines | ||
| 849 | 850 | compatible = "fsl,imx6q-fec"; |
| 850 | 851 | reg = <0x02188000 0x4000>; |
| 851 | 852 | interrupts = <0 118 0x04 0 119 0x04>; |
| 852 | − clocks = <&clks 117>, <&clks 117>; | |
| 853 | − clock-names = "ipg", "ahb"; | |
| 853 | + clocks = <&clks 117>, <&clks 117>, <&clks 177>; | |
| 854 | + clock-names = "ipg", "ahb", "ptp"; | |
| 854 | 855 | status = "disabled"; |
| 855 | 856 | }; |
| 856 | 857 | |
| @@ -240,3 +240,6 @@ CONFIG_CRC_ITU_T=y · 239 unmodified lines | ||
| 240 | 240 | CONFIG_CRC7=y |
| 241 | 241 | CONFIG_LIBCRC32C=y |
| 242 | 242 | CONFIG_SOC_OMAP5=y |
| 243 | +CONFIG_TI_DAVINCI_MDIO=y | |
| 244 | +CONFIG_TI_DAVINCI_CPDMA=y | |
| 245 | +CONFIG_TI_CPSW=y | |
| @@ -39,7 +39,6 @@ config SOC_AT91RM9200 · 38 unmodified lines | ||
| 39 | 39 | config SOC_AT91SAM9260 |
| 40 | 40 | bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" |
| 41 | 41 | select HAVE_AT91_DBGU0 |
| 42 | − select HAVE_NET_MACB | |
| 43 | 42 | select SOC_AT91SAM9 |
| 44 | 43 | help |
| 45 | 44 | Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE |
| @@ -57,7 +56,6 @@ config SOC_AT91SAM9263 · 11 unmodified lines | ||
| 57 | 56 | bool "AT91SAM9263" |
| 58 | 57 | select HAVE_AT91_DBGU1 |
| 59 | 58 | select HAVE_FB_ATMEL |
| 60 | − select HAVE_NET_MACB | |
| 61 | 59 | select SOC_AT91SAM9 |
| 62 | 60 | |
| 63 | 61 | config SOC_AT91SAM9RL |
| @@ -70,7 +68,6 @@ config SOC_AT91SAM9G45 · 6 unmodified lines | ||
| 70 | 68 | bool "AT91SAM9G45 or AT91SAM9M10 families" |
| 71 | 69 | select HAVE_AT91_DBGU1 |
| 72 | 70 | select HAVE_FB_ATMEL |
| 73 | − select HAVE_NET_MACB | |
| 74 | 71 | select SOC_AT91SAM9 |
| 75 | 72 | help |
| 76 | 73 | Select this if you are using one of Atmel's AT91SAM9G45 family SoC. |
| @@ -80,7 +77,6 @@ config SOC_AT91SAM9X5 · 3 unmodified lines | ||
| 80 | 77 | bool "AT91SAM9x5 family" |
| 81 | 78 | select HAVE_AT91_DBGU0 |
| 82 | 79 | select HAVE_FB_ATMEL |
| 83 | − select HAVE_NET_MACB | |
| 84 | 80 | select SOC_AT91SAM9 |
| 85 | 81 | help |
| 86 | 82 | Select this if you are using one of Atmel's AT91SAM9x5 family SoC. |
| @@ -53,6 +53,8 @@ static void __init csb337_init_early(void) · 52 unmodified lines | ||
| 53 | 53 | static struct macb_platform_data __initdata csb337_eth_data = { |
| 54 | 54 | .phy_irq_pin = AT91_PIN_PC2, |
| 55 | 55 | .is_rmii = 0, |
| 56 | + /* The CSB337 bootloader stores the MAC the wrong-way around */ | |
| 57 | + .rev_eth_addr = 1, | |
| 56 | 58 | }; |
| 57 | 59 | |
| 58 | 60 | static struct at91_usbh_data __initdata csb337_usbh_data = { |
| @@ -1,138 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * arch/arm/mach-at91/include/mach/at91rm9200_emac.h | |
| 3 | − * | |
| 4 | − * Copyright (C) 2005 Ivan Kokshaysky | |
| 5 | − * Copyright (C) SAN People | |
| 6 | − * | |
| 7 | − * Ethernet MAC registers. | |
| 8 | − * Based on AT91RM9200 datasheet revision E. | |
| 9 | − * | |
| 10 | − * This program is free software; you can redistribute it and/or modify | |
| 11 | − * it under the terms of the GNU General Public License as published by | |
| 12 | − * the Free Software Foundation; either version 2 of the License, or | |
| 13 | − * (at your option) any later version. | |
| 14 | − */ | |
| 15 | − | |
| 16 | −#ifndef AT91RM9200_EMAC_H | |
| 17 | −#define AT91RM9200_EMAC_H | |
| 18 | − | |
| 19 | −#define AT91_EMAC_CTL 0x00 /* Control Register */ | |
| 20 | −#define AT91_EMAC_LB (1 << 0) /* Loopback */ | |
| 21 | −#define AT91_EMAC_LBL (1 << 1) /* Loopback Local */ | |
| 22 | −#define AT91_EMAC_RE (1 << 2) /* Receive Enable */ | |
| 23 | −#define AT91_EMAC_TE (1 << 3) /* Transmit Enable */ | |
| 24 | −#define AT91_EMAC_MPE (1 << 4) /* Management Port Enable */ | |
| 25 | −#define AT91_EMAC_CSR (1 << 5) /* Clear Statistics Registers */ | |
| 26 | −#define AT91_EMAC_INCSTAT (1 << 6) /* Increment Statistics Registers */ | |
| 27 | −#define AT91_EMAC_WES (1 << 7) /* Write Enable for Statistics Registers */ | |
| 28 | −#define AT91_EMAC_BP (1 << 8) /* Back Pressure */ | |
| 29 | − | |
| 30 | −#define AT91_EMAC_CFG 0x04 /* Configuration Register */ | |
| 31 | −#define AT91_EMAC_SPD (1 << 0) /* Speed */ | |
| 32 | −#define AT91_EMAC_FD (1 << 1) /* Full Duplex */ | |
| 33 | −#define AT91_EMAC_BR (1 << 2) /* Bit Rate */ | |
| 34 | −#define AT91_EMAC_CAF (1 << 4) /* Copy All Frames */ | |
| 35 | −#define AT91_EMAC_NBC (1 << 5) /* No Broadcast */ | |
| 36 | −#define AT91_EMAC_MTI (1 << 6) /* Multicast Hash Enable */ | |
| 37 | −#define AT91_EMAC_UNI (1 << 7) /* Unicast Hash Enable */ | |
| 38 | −#define AT91_EMAC_BIG (1 << 8) /* Receive 1522 Bytes */ | |
| 39 | −#define AT91_EMAC_EAE (1 << 9) /* External Address Match Enable */ | |
| 40 | −#define AT91_EMAC_CLK (3 << 10) /* MDC Clock Divisor */ | |
| 41 | −#define AT91_EMAC_CLK_DIV8 (0 << 10) | |
| 42 | −#define AT91_EMAC_CLK_DIV16 (1 << 10) | |
| 43 | −#define AT91_EMAC_CLK_DIV32 (2 << 10) | |
| 44 | −#define AT91_EMAC_CLK_DIV64 (3 << 10) | |
| 45 | −#define AT91_EMAC_RTY (1 << 12) /* Retry Test */ | |
| 46 | −#define AT91_EMAC_RMII (1 << 13) /* Reduce MII (RMII) */ | |
| 47 | − | |
| 48 | −#define AT91_EMAC_SR 0x08 /* Status Register */ | |
| 49 | −#define AT91_EMAC_SR_LINK (1 << 0) /* Link */ | |
| 50 | −#define AT91_EMAC_SR_MDIO (1 << 1) /* MDIO pin */ | |
| 51 | −#define AT91_EMAC_SR_IDLE (1 << 2) /* PHY idle */ | |
| 52 | − | |
| 53 | −#define AT91_EMAC_TAR 0x0c /* Transmit Address Register */ | |
| 54 | − | |
| 55 | −#define AT91_EMAC_TCR 0x10 /* Transmit Control Register */ | |
| 56 | −#define AT91_EMAC_LEN (0x7ff << 0) /* Transmit Frame Length */ | |
| 57 | −#define AT91_EMAC_NCRC (1 << 15) /* No CRC */ | |
| 58 | − | |
| 59 | −#define AT91_EMAC_TSR 0x14 /* Transmit Status Register */ | |
| 60 | −#define AT91_EMAC_TSR_OVR (1 << 0) /* Transmit Buffer Overrun */ | |
| 61 | −#define AT91_EMAC_TSR_COL (1 << 1) /* Collision Occurred */ | |
| 62 | −#define AT91_EMAC_TSR_RLE (1 << 2) /* Retry Limit Exceeded */ | |
| 63 | −#define AT91_EMAC_TSR_IDLE (1 << 3) /* Transmitter Idle */ | |
| 64 | −#define AT91_EMAC_TSR_BNQ (1 << 4) /* Transmit Buffer not Queued */ | |
| 65 | −#define AT91_EMAC_TSR_COMP (1 << 5) /* Transmit Complete */ | |
| 66 | −#define AT91_EMAC_TSR_UND (1 << 6) /* Transmit Underrun */ | |
| 67 | − | |
| 68 | −#define AT91_EMAC_RBQP 0x18 /* Receive Buffer Queue Pointer */ | |
| 69 | − | |
| 70 | −#define AT91_EMAC_RSR 0x20 /* Receive Status Register */ | |
| 71 | −#define AT91_EMAC_RSR_BNA (1 << 0) /* Buffer Not Available */ | |
| 72 | −#define AT91_EMAC_RSR_REC (1 << 1) /* Frame Received */ | |
| 73 | −#define AT91_EMAC_RSR_OVR (1 << 2) /* RX Overrun */ | |
| 74 | − | |
| 75 | −#define AT91_EMAC_ISR 0x24 /* Interrupt Status Register */ | |
| 76 | −#define AT91_EMAC_DONE (1 << 0) /* Management Done */ | |
| 77 | −#define AT91_EMAC_RCOM (1 << 1) /* Receive Complete */ | |
| 78 | −#define AT91_EMAC_RBNA (1 << 2) /* Receive Buffer Not Available */ | |
| 79 | −#define AT91_EMAC_TOVR (1 << 3) /* Transmit Buffer Overrun */ | |
| 80 | −#define AT91_EMAC_TUND (1 << 4) /* Transmit Buffer Underrun */ | |
| 81 | −#define AT91_EMAC_RTRY (1 << 5) /* Retry Limit */ | |
| 82 | −#define AT91_EMAC_TBRE (1 << 6) /* Transmit Buffer Register Empty */ | |
| 83 | −#define AT91_EMAC_TCOM (1 << 7) /* Transmit Complete */ | |
| 84 | −#define AT91_EMAC_TIDLE (1 << 8) /* Transmit Idle */ | |
| 85 | −#define AT91_EMAC_LINK (1 << 9) /* Link */ | |
| 86 | −#define AT91_EMAC_ROVR (1 << 10) /* RX Overrun */ | |
| 87 | −#define AT91_EMAC_ABT (1 << 11) /* Abort */ | |
| 88 | − | |
| 89 | −#define AT91_EMAC_IER 0x28 /* Interrupt Enable Register */ | |
| 90 | −#define AT91_EMAC_IDR 0x2c /* Interrupt Disable Register */ | |
| 91 | −#define AT91_EMAC_IMR 0x30 /* Interrupt Mask Register */ | |
| 92 | − | |
| 93 | −#define AT91_EMAC_MAN 0x34 /* PHY Maintenance Register */ | |
| 94 | −#define AT91_EMAC_DATA (0xffff << 0) /* MDIO Data */ | |
| 95 | −#define AT91_EMAC_REGA (0x1f << 18) /* MDIO Register */ | |
| 96 | −#define AT91_EMAC_PHYA (0x1f << 23) /* MDIO PHY Address */ | |
| 97 | −#define AT91_EMAC_RW (3 << 28) /* Read/Write operation */ | |
| 98 | −#define AT91_EMAC_RW_W (1 << 28) | |
| 99 | −#define AT91_EMAC_RW_R (2 << 28) | |
| 100 | −#define AT91_EMAC_MAN_802_3 0x40020000 /* IEEE 802.3 value */ | |
| 101 | − | |
| 102 | −/* | |
| 103 | − * Statistics Registers. | |
| 104 | − */ | |
| 105 | −#define AT91_EMAC_FRA 0x40 /* Frames Transmitted OK */ | |
| 106 | −#define AT91_EMAC_SCOL 0x44 /* Single Collision Frame */ | |
| 107 | −#define AT91_EMAC_MCOL 0x48 /* Multiple Collision Frame */ | |
| 108 | −#define AT91_EMAC_OK 0x4c /* Frames Received OK */ | |
| 109 | −#define AT91_EMAC_SEQE 0x50 /* Frame Check Sequence Error */ | |
| 110 | −#define AT91_EMAC_ALE 0x54 /* Alignmemt Error */ | |
| 111 | −#define AT91_EMAC_DTE 0x58 /* Deffered Transmission Frame */ | |
| 112 | −#define AT91_EMAC_LCOL 0x5c /* Late Collision */ | |
| 113 | −#define AT91_EMAC_ECOL 0x60 /* Excessive Collision */ | |
| 114 | −#define AT91_EMAC_TUE 0x64 /* Transmit Underrun Error */ | |
| 115 | −#define AT91_EMAC_CSE 0x68 /* Carrier Sense Error */ | |
| 116 | −#define AT91_EMAC_DRFC 0x6c /* Discard RX Frame */ | |
| 117 | −#define AT91_EMAC_ROV 0x70 /* Receive Overrun */ | |
| 118 | −#define AT91_EMAC_CDE 0x74 /* Code Error */ | |
| 119 | −#define AT91_EMAC_ELR 0x78 /* Excessive Length Error */ | |
| 120 | −#define AT91_EMAC_RJB 0x7c /* Receive Jabber */ | |
| 121 | −#define AT91_EMAC_USF 0x80 /* Undersize Frame */ | |
| 122 | −#define AT91_EMAC_SQEE 0x84 /* SQE Test Error */ | |
| 123 | − | |
| 124 | −/* | |
| 125 | − * Address Registers. | |
| 126 | − */ | |
| 127 | −#define AT91_EMAC_HSL 0x90 /* Hash Address Low [31:0] */ | |
| 128 | −#define AT91_EMAC_HSH 0x94 /* Hash Address High [63:32] */ | |
| 129 | −#define AT91_EMAC_SA1L 0x98 /* Specific Address 1 Low, bytes 0-3 */ | |
| 130 | −#define AT91_EMAC_SA1H 0x9c /* Specific Address 1 High, bytes 4-5 */ | |
| 131 | −#define AT91_EMAC_SA2L 0xa0 /* Specific Address 2 Low, bytes 0-3 */ | |
| 132 | −#define AT91_EMAC_SA2H 0xa4 /* Specific Address 2 High, bytes 4-5 */ | |
| 133 | −#define AT91_EMAC_SA3L 0xa8 /* Specific Address 3 Low, bytes 0-3 */ | |
| 134 | −#define AT91_EMAC_SA3H 0xac /* Specific Address 3 High, bytes 4-5 */ | |
| 135 | −#define AT91_EMAC_SA4L 0xb0 /* Specific Address 4 Low, bytes 0-3 */ | |
| 136 | −#define AT91_EMAC_SA4H 0xb4 /* Specific Address 4 High, bytes 4-5 */ | |
| 137 | − | |
| 138 | −#endif | |
| @@ -117,6 +117,17 @@ static void __init imx6q_sabrelite_init(void) · 116 unmodified lines | ||
| 117 | 117 | imx6q_sabrelite_cko1_setup(); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | +static void __init imx6q_1588_init(void) | |
| 121 | +{ | |
| 122 | + struct regmap *gpr; | |
| 123 | + | |
| 124 | + gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); | |
| 125 | + if (!IS_ERR(gpr)) | |
| 126 | + regmap_update_bits(gpr, 0x4, 1 << 21, 1 << 21); | |
| 127 | + else | |
| 128 | + pr_err("failed to find fsl,imx6q-iomux-gpr regmap\n"); | |
| 129 | + | |
| 130 | +} | |
| 120 | 131 | static void __init imx6q_usb_init(void) |
| 121 | 132 | { |
| 122 | 133 | struct regmap *anatop; |
| @@ -153,6 +164,7 @@ static void __init imx6q_init_machine(void) · 30 unmodified lines | ||
| 153 | 164 | |
| 154 | 165 | imx6q_pm_init(); |
| 155 | 166 | imx6q_usb_init(); |
| 167 | + imx6q_1588_init(); | |
| 156 | 168 | } |
| 157 | 169 | |
| 158 | 170 | static struct cpuidle_driver imx6q_cpuidle_driver = { |
| @@ -674,6 +674,7 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = { · 673 unmodified lines | ||
| 674 | 674 | .name = "cpgmac0", |
| 675 | 675 | .class = &am33xx_cpgmac0_hwmod_class, |
| 676 | 676 | .clkdm_name = "cpsw_125mhz_clkdm", |
| 677 | + .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), | |
| 677 | 678 | .mpu_irqs = am33xx_cpgmac0_irqs, |
| 678 | 679 | .main_clk = "cpsw_125mhz_gclk", |
| 679 | 680 | .prcm = { |
| @@ -684,6 +685,20 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = { · 4 unmodified lines | ||
| 684 | 685 | }, |
| 685 | 686 | }; |
| 686 | 687 | |
| 688 | +/* | |
| 689 | + * mdio class | |
| 690 | + */ | |
| 691 | +static struct omap_hwmod_class am33xx_mdio_hwmod_class = { | |
| 692 | + .name = "davinci_mdio", | |
| 693 | +}; | |
| 694 | + | |
| 695 | +static struct omap_hwmod am33xx_mdio_hwmod = { | |
| 696 | + .name = "davinci_mdio", | |
| 697 | + .class = &am33xx_mdio_hwmod_class, | |
| 698 | + .clkdm_name = "cpsw_125mhz_clkdm", | |
| 699 | + .main_clk = "cpsw_125mhz_gclk", | |
| 700 | +}; | |
| 701 | + | |
| 687 | 702 | /* |
| 688 | 703 | * dcan class |
| 689 | 704 | */ |
| @@ -2501,6 +2516,21 @@ static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = { · 1811 unmodified lines | ||
| 2501 | 2516 | .user = OCP_USER_MPU, |
| 2502 | 2517 | }; |
| 2503 | 2518 | |
| 2519 | +struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = { | |
| 2520 | + { | |
| 2521 | + .pa_start = 0x4A101000, | |
| 2522 | + .pa_end = 0x4A101000 + SZ_256 - 1, | |
| 2523 | + }, | |
| 2524 | + { } | |
| 2525 | +}; | |
| 2526 | + | |
| 2527 | +struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = { | |
| 2528 | + .master = &am33xx_cpgmac0_hwmod, | |
| 2529 | + .slave = &am33xx_mdio_hwmod, | |
| 2530 | + .addr = am33xx_mdio_addr_space, | |
| 2531 | + .user = OCP_USER_MPU, | |
| 2532 | +}; | |
| 2533 | + | |
| 2504 | 2534 | static struct omap_hwmod_addr_space am33xx_elm_addr_space[] = { |
| 2505 | 2535 | { |
| 2506 | 2536 | .pa_start = 0x48080000, |
| @@ -3371,6 +3401,7 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = { · 864 unmodified lines | ||
| 3371 | 3401 | &am33xx_l3_main__tptc2, |
| 3372 | 3402 | &am33xx_l3_s__usbss, |
| 3373 | 3403 | &am33xx_l4_hs__cpgmac0, |
| 3404 | + &am33xx_cpgmac0__mdio, | |
| 3374 | 3405 | NULL, |
| 3375 | 3406 | }; |
| 3376 | 3407 | |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/netdevice.h> |
| 17 | 17 | #include <linux/string.h> |
| 18 | 18 | #include <linux/slab.h> |
| 19 | +#include <linux/if_vlan.h> | |
| 19 | 20 | #include <asm/cacheflush.h> |
| 20 | 21 | #include <asm/hwcap.h> |
| 21 | 22 | |
| @@ -168,6 +169,8 @@ static inline bool is_load_to_a(u16 inst) · 146 unmodified lines | ||
| 168 | 169 | case BPF_S_ANC_MARK: |
| 169 | 170 | case BPF_S_ANC_PROTOCOL: |
| 170 | 171 | case BPF_S_ANC_RXHASH: |
| 172 | + case BPF_S_ANC_VLAN_TAG: | |
| 173 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 171 | 174 | case BPF_S_ANC_QUEUE: |
| 172 | 175 | return true; |
| 173 | 176 | default: |
| @@ -646,6 +649,16 @@ load_ind: · 472 unmodified lines | ||
| 646 | 649 | update_on_xread(ctx); |
| 647 | 650 | emit(ARM_ORR_R(r_A, r_A, r_X), ctx); |
| 648 | 651 | break; |
| 652 | + case BPF_S_ALU_XOR_K: | |
| 653 | + /* A ^= K; */ | |
| 654 | + OP_IMM3(ARM_EOR, r_A, r_A, k, ctx); | |
| 655 | + break; | |
| 656 | + case BPF_S_ANC_ALU_XOR_X: | |
| 657 | + case BPF_S_ALU_XOR_X: | |
| 658 | + /* A ^= X */ | |
| 659 | + update_on_xread(ctx); | |
| 660 | + emit(ARM_EOR_R(r_A, r_A, r_X), ctx); | |
| 661 | + break; | |
| 649 | 662 | case BPF_S_ALU_AND_K: |
| 650 | 663 | /* A &= K */ |
| 651 | 664 | OP_IMM3(ARM_AND, r_A, r_A, k, ctx); |
| @@ -762,11 +775,6 @@ b_epilogue: · 110 unmodified lines | ||
| 762 | 775 | update_on_xread(ctx); |
| 763 | 776 | emit(ARM_MOV_R(r_A, r_X), ctx); |
| 764 | 777 | break; |
| 765 | − case BPF_S_ANC_ALU_XOR_X: | |
| 766 | − /* A ^= X */ | |
| 767 | − update_on_xread(ctx); | |
| 768 | − emit(ARM_EOR_R(r_A, r_A, r_X), ctx); | |
| 769 | − break; | |
| 770 | 778 | case BPF_S_ANC_PROTOCOL: |
| 771 | 779 | /* A = ntohs(skb->protocol) */ |
| 772 | 780 | ctx->seen |= SEEN_SKB; |
| @@ -810,6 +818,17 @@ b_epilogue: · 37 unmodified lines | ||
| 810 | 818 | off = offsetof(struct sk_buff, rxhash); |
| 811 | 819 | emit(ARM_LDR_I(r_A, r_skb, off), ctx); |
| 812 | 820 | break; |
| 821 | + case BPF_S_ANC_VLAN_TAG: | |
| 822 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 823 | + ctx->seen |= SEEN_SKB; | |
| 824 | + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | |
| 825 | + off = offsetof(struct sk_buff, vlan_tci); | |
| 826 | + emit(ARM_LDRH_I(r_A, r_skb, off), ctx); | |
| 827 | + if (inst->code == BPF_S_ANC_VLAN_TAG) | |
| 828 | + OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx); | |
| 829 | + else | |
| 830 | + OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx); | |
| 831 | + break; | |
| 813 | 832 | case BPF_S_ANC_QUEUE: |
| 814 | 833 | ctx->seen |= SEEN_SKB; |
| 815 | 834 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
| @@ -69,6 +69,7 @@ · 68 unmodified lines | ||
| 69 | 69 | #define ARM_INST_CMP_I 0x03500000 |
| 70 | 70 | |
| 71 | 71 | #define ARM_INST_EOR_R 0x00200000 |
| 72 | +#define ARM_INST_EOR_I 0x02200000 | |
| 72 | 73 | |
| 73 | 74 | #define ARM_INST_LDRB_I 0x05d00000 |
| 74 | 75 | #define ARM_INST_LDRB_R 0x07d00000 |
| @@ -135,6 +136,7 @@ · 60 unmodified lines | ||
| 135 | 136 | #define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm) |
| 136 | 137 | |
| 137 | 138 | #define ARM_EOR_R(rd, rn, rm) _AL3_R(ARM_INST_EOR, rd, rn, rm) |
| 139 | +#define ARM_EOR_I(rd, rn, imm) _AL3_I(ARM_INST_EOR, rd, rn, imm) | |
| 138 | 140 | |
| 139 | 141 | #define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \ |
| 140 | 142 | | (off)) |
| @@ -82,7 +82,6 @@ config PLATFORM_AT32AP · 81 unmodified lines | ||
| 82 | 82 | select ARCH_REQUIRE_GPIOLIB |
| 83 | 83 | select GENERIC_ALLOCATOR |
| 84 | 84 | select HAVE_FB_ATMEL |
| 85 | − select HAVE_NET_MACB | |
| 86 | 85 | |
| 87 | 86 | # |
| 88 | 87 | # CPU types |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | /* Socket filtering */ |
| 41 | 41 | #define SO_ATTACH_FILTER 26 |
| 42 | 42 | #define SO_DETACH_FILTER 27 |
| 43 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 43 | 44 | |
| 44 | 45 | #define SO_PEERNAME 28 |
| 45 | 46 | #define SO_TIMESTAMP 29 |
| @@ -42,6 +42,7 @@ · 41 unmodified lines | ||
| 42 | 42 | /* Socket filtering */ |
| 43 | 43 | #define SO_ATTACH_FILTER 26 |
| 44 | 44 | #define SO_DETACH_FILTER 27 |
| 45 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 45 | 46 | |
| 46 | 47 | #define SO_PEERNAME 28 |
| 47 | 48 | #define SO_TIMESTAMP 29 |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | /* Socket filtering */ |
| 41 | 41 | #define SO_ATTACH_FILTER 26 |
| 42 | 42 | #define SO_DETACH_FILTER 27 |
| 43 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 43 | 44 | |
| 44 | 45 | #define SO_PEERNAME 28 |
| 45 | 46 | #define SO_TIMESTAMP 29 |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | /* Socket filtering */ |
| 41 | 41 | #define SO_ATTACH_FILTER 26 |
| 42 | 42 | #define SO_DETACH_FILTER 27 |
| 43 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 43 | 44 | |
| 44 | 45 | #define SO_PEERNAME 28 |
| 45 | 46 | #define SO_TIMESTAMP 29 |
| @@ -49,6 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | /* Socket filtering */ |
| 50 | 50 | #define SO_ATTACH_FILTER 26 |
| 51 | 51 | #define SO_DETACH_FILTER 27 |
| 52 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 52 | 53 | |
| 53 | 54 | #define SO_PEERNAME 28 |
| 54 | 55 | #define SO_TIMESTAMP 29 |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | /* Socket filtering */ |
| 41 | 41 | #define SO_ATTACH_FILTER 26 |
| 42 | 42 | #define SO_DETACH_FILTER 27 |
| 43 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 43 | 44 | |
| 44 | 45 | #define SO_PEERNAME 28 |
| 45 | 46 | #define SO_TIMESTAMP 29 |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | /* Socket filtering */ |
| 41 | 41 | #define SO_ATTACH_FILTER 26 |
| 42 | 42 | #define SO_DETACH_FILTER 27 |
| 43 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 43 | 44 | |
| 44 | 45 | #define SO_PEERNAME 28 |
| 45 | 46 | #define SO_TIMESTAMP 29 |
| @@ -43,8 +43,8 @@ static void early_nvram_init(void) · 42 unmodified lines | ||
| 43 | 43 | #ifdef CONFIG_BCM47XX_SSB |
| 44 | 44 | case BCM47XX_BUS_TYPE_SSB: |
| 45 | 45 | mcore_ssb = &bcm47xx_bus.ssb.mipscore; |
| 46 | − base = mcore_ssb->flash_window; | |
| 47 | − lim = mcore_ssb->flash_window_size; | |
| 46 | + base = mcore_ssb->pflash.window; | |
| 47 | + lim = mcore_ssb->pflash.window_size; | |
| 48 | 48 | break; |
| 49 | 49 | #endif |
| 50 | 50 | #ifdef CONFIG_BCM47XX_BCMA |
| @@ -156,10 +156,10 @@ static int __init wgt634u_init(void) · 155 unmodified lines | ||
| 156 | 156 | SSB_CHIPCO_IRQ_GPIO); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | − wgt634u_flash_data.width = mcore->flash_buswidth; | |
| 160 | − wgt634u_flash_resource.start = mcore->flash_window; | |
| 161 | − wgt634u_flash_resource.end = mcore->flash_window | |
| 162 | − + mcore->flash_window_size | |
| 159 | + wgt634u_flash_data.width = mcore->pflash.buswidth; | |
| 160 | + wgt634u_flash_resource.start = mcore->pflash.window; | |
| 161 | + wgt634u_flash_resource.end = mcore->pflash.window | |
| 162 | + + mcore->pflash.window_size | |
| 163 | 163 | - 1; |
| 164 | 164 | return platform_add_devices(wgt634u_devices, |
| 165 | 165 | ARRAY_SIZE(wgt634u_devices)); |
| @@ -63,6 +63,7 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */ · 62 unmodified lines | ||
| 63 | 63 | /* Socket filtering */ |
| 64 | 64 | #define SO_ATTACH_FILTER 26 |
| 65 | 65 | #define SO_DETACH_FILTER 27 |
| 66 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 66 | 67 | |
| 67 | 68 | #define SO_PEERNAME 28 |
| 68 | 69 | #define SO_TIMESTAMP 29 |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | /* Socket filtering */ |
| 41 | 41 | #define SO_ATTACH_FILTER 26 |
| 42 | 42 | #define SO_DETACH_FILTER 27 |
| 43 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 43 | 44 | |
| 44 | 45 | #define SO_PEERNAME 28 |
| 45 | 46 | #define SO_TIMESTAMP 29 |
| @@ -48,6 +48,7 @@ · 47 unmodified lines | ||
| 48 | 48 | /* Socket filtering */ |
| 49 | 49 | #define SO_ATTACH_FILTER 0x401a |
| 50 | 50 | #define SO_DETACH_FILTER 0x401b |
| 51 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 51 | 52 | |
| 52 | 53 | #define SO_ACCEPTCONN 0x401c |
| 53 | 54 | |
| @@ -168,9 +168,12 @@ · 167 unmodified lines | ||
| 168 | 168 | #define PPC_INST_AND 0x7c000038 |
| 169 | 169 | #define PPC_INST_ANDDOT 0x7c000039 |
| 170 | 170 | #define PPC_INST_OR 0x7c000378 |
| 171 | +#define PPC_INST_XOR 0x7c000278 | |
| 171 | 172 | #define PPC_INST_ANDI 0x70000000 |
| 172 | 173 | #define PPC_INST_ORI 0x60000000 |
| 173 | 174 | #define PPC_INST_ORIS 0x64000000 |
| 175 | +#define PPC_INST_XORI 0x68000000 | |
| 176 | +#define PPC_INST_XORIS 0x6c000000 | |
| 174 | 177 | #define PPC_INST_NEG 0x7c0000d0 |
| 175 | 178 | #define PPC_INST_BRANCH 0x48000000 |
| 176 | 179 | #define PPC_INST_BRANCH_COND 0x40800000 |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | ||
| 47 | 47 | /* Socket filtering */ |
| 48 | 48 | #define SO_ATTACH_FILTER 26 |
| 49 | 49 | #define SO_DETACH_FILTER 27 |
| 50 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 50 | 51 | |
| 51 | 52 | #define SO_PEERNAME 28 |
| 52 | 53 | #define SO_TIMESTAMP 29 |
| @@ -134,6 +134,12 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh); · 133 unmodified lines | ||
| 134 | 134 | ___PPC_RS(a) | IMM_L(i)) |
| 135 | 135 | #define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | ___PPC_RA(d) | \ |
| 136 | 136 | ___PPC_RS(a) | IMM_L(i)) |
| 137 | +#define PPC_XOR(d, a, b) EMIT(PPC_INST_XOR | ___PPC_RA(d) | \ | |
| 138 | + ___PPC_RS(a) | ___PPC_RB(b)) | |
| 139 | +#define PPC_XORI(d, a, i) EMIT(PPC_INST_XORI | ___PPC_RA(d) | \ | |
| 140 | + ___PPC_RS(a) | IMM_L(i)) | |
| 141 | +#define PPC_XORIS(d, a, i) EMIT(PPC_INST_XORIS | ___PPC_RA(d) | \ | |
| 142 | + ___PPC_RS(a) | IMM_L(i)) | |
| 137 | 143 | #define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | ___PPC_RA(d) | \ |
| 138 | 144 | ___PPC_RS(a) | ___PPC_RB(s)) |
| 139 | 145 | #define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \ |
| @@ -13,6 +13,8 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <asm/cacheflush.h> |
| 14 | 14 | #include <linux/netdevice.h> |
| 15 | 15 | #include <linux/filter.h> |
| 16 | +#include <linux/if_vlan.h> | |
| 17 | + | |
| 16 | 18 | #include "bpf_jit.h" |
| 17 | 19 | |
| 18 | 20 | #ifndef __BIG_ENDIAN |
| @@ -89,6 +91,8 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image, · 70 unmodified lines | ||
| 89 | 91 | case BPF_S_ANC_IFINDEX: |
| 90 | 92 | case BPF_S_ANC_MARK: |
| 91 | 93 | case BPF_S_ANC_RXHASH: |
| 94 | + case BPF_S_ANC_VLAN_TAG: | |
| 95 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 92 | 96 | case BPF_S_ANC_CPU: |
| 93 | 97 | case BPF_S_ANC_QUEUE: |
| 94 | 98 | case BPF_S_LD_W_ABS: |
| @@ -232,6 +236,17 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, · 137 unmodified lines | ||
| 232 | 236 | if (K >= 65536) |
| 233 | 237 | PPC_ORIS(r_A, r_A, IMM_H(K)); |
| 234 | 238 | break; |
| 239 | + case BPF_S_ANC_ALU_XOR_X: | |
| 240 | + case BPF_S_ALU_XOR_X: /* A ^= X */ | |
| 241 | + ctx->seen |= SEEN_XREG; | |
| 242 | + PPC_XOR(r_A, r_A, r_X); | |
| 243 | + break; | |
| 244 | + case BPF_S_ALU_XOR_K: /* A ^= K */ | |
| 245 | + if (IMM_L(K)) | |
| 246 | + PPC_XORI(r_A, r_A, IMM_L(K)); | |
| 247 | + if (K >= 65536) | |
| 248 | + PPC_XORIS(r_A, r_A, IMM_H(K)); | |
| 249 | + break; | |
| 235 | 250 | case BPF_S_ALU_LSH_X: /* A <<= X; */ |
| 236 | 251 | ctx->seen |= SEEN_XREG; |
| 237 | 252 | PPC_SLW(r_A, r_A, r_X); |
| @@ -371,6 +386,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, · 133 unmodified lines | ||
| 371 | 386 | PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, |
| 372 | 387 | rxhash)); |
| 373 | 388 | break; |
| 389 | + case BPF_S_ANC_VLAN_TAG: | |
| 390 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 391 | + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | |
| 392 | + PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, | |
| 393 | + vlan_tci)); | |
| 394 | + if (filter[i].code == BPF_S_ANC_VLAN_TAG) | |
| 395 | + PPC_ANDI(r_A, r_A, VLAN_VID_MASK); | |
| 396 | + else | |
| 397 | + PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); | |
| 398 | + break; | |
| 374 | 399 | case BPF_S_ANC_QUEUE: |
| 375 | 400 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
| 376 | 401 | queue_mapping) != 2); |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | /* Socket filtering */ |
| 47 | 47 | #define SO_ATTACH_FILTER 26 |
| 48 | 48 | #define SO_DETACH_FILTER 27 |
| 49 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 49 | 50 | |
| 50 | 51 | #define SO_PEERNAME 28 |
| 51 | 52 | #define SO_TIMESTAMP 29 |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | #define SO_ATTACH_FILTER 0x001a |
| 43 | 43 | #define SO_DETACH_FILTER 0x001b |
| 44 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 44 | 45 | |
| 45 | 46 | #define SO_PEERNAME 0x001c |
| 46 | 47 | #define SO_TIMESTAMP 0x001d |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #include <linux/netdevice.h> |
| 4 | 4 | #include <linux/filter.h> |
| 5 | 5 | #include <linux/cache.h> |
| 6 | +#include <linux/if_vlan.h> | |
| 6 | 7 | |
| 7 | 8 | #include <asm/cacheflush.h> |
| 8 | 9 | #include <asm/ptrace.h> |
| @@ -312,6 +313,12 @@ do { *prog++ = BR_OPC | WDISP22(OFF); \ · 303 unmodified lines | ||
| 312 | 313 | #define emit_addi(R1, IMM, R3) \ |
| 313 | 314 | *prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3)) |
| 314 | 315 | |
| 316 | +#define emit_and(R1, R2, R3) \ | |
| 317 | + *prog++ = (AND | RS1(R1) | RS2(R2) | RD(R3)) | |
| 318 | + | |
| 319 | +#define emit_andi(R1, IMM, R3) \ | |
| 320 | + *prog++ = (AND | IMMED | RS1(R1) | S13(IMM) | RD(R3)) | |
| 321 | + | |
| 315 | 322 | #define emit_alloc_stack(SZ) \ |
| 316 | 323 | *prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP)) |
| 317 | 324 | |
| @@ -415,6 +422,8 @@ void bpf_jit_compile(struct sk_filter *fp) · 97 unmodified lines | ||
| 415 | 422 | case BPF_S_ANC_IFINDEX: |
| 416 | 423 | case BPF_S_ANC_MARK: |
| 417 | 424 | case BPF_S_ANC_RXHASH: |
| 425 | + case BPF_S_ANC_VLAN_TAG: | |
| 426 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 418 | 427 | case BPF_S_ANC_CPU: |
| 419 | 428 | case BPF_S_ANC_QUEUE: |
| 420 | 429 | case BPF_S_LD_W_ABS: |
| @@ -600,6 +609,16 @@ void bpf_jit_compile(struct sk_filter *fp) · 179 unmodified lines | ||
| 600 | 609 | case BPF_S_ANC_RXHASH: |
| 601 | 610 | emit_skb_load32(rxhash, r_A); |
| 602 | 611 | break; |
| 612 | + case BPF_S_ANC_VLAN_TAG: | |
| 613 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 614 | + emit_skb_load16(vlan_tci, r_A); | |
| 615 | + if (filter[i].code == BPF_S_ANC_VLAN_TAG) { | |
| 616 | + emit_andi(r_A, VLAN_VID_MASK, r_A); | |
| 617 | + } else { | |
| 618 | + emit_loadimm(VLAN_TAG_PRESENT, r_TMP); | |
| 619 | + emit_and(r_A, r_TMP, r_A); | |
| 620 | + } | |
| 621 | + break; | |
| 603 | 622 | |
| 604 | 623 | case BPF_S_LD_IMM: |
| 605 | 624 | emit_loadimm(K, r_A); |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <asm/cacheflush.h> |
| 12 | 12 | #include <linux/netdevice.h> |
| 13 | 13 | #include <linux/filter.h> |
| 14 | +#include <linux/if_vlan.h> | |
| 14 | 15 | |
| 15 | 16 | /* |
| 16 | 17 | * Conventions : |
| @@ -212,6 +213,8 @@ void bpf_jit_compile(struct sk_filter *fp) · 195 unmodified lines | ||
| 212 | 213 | case BPF_S_ANC_MARK: |
| 213 | 214 | case BPF_S_ANC_RXHASH: |
| 214 | 215 | case BPF_S_ANC_CPU: |
| 216 | + case BPF_S_ANC_VLAN_TAG: | |
| 217 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 215 | 218 | case BPF_S_ANC_QUEUE: |
| 216 | 219 | case BPF_S_LD_W_ABS: |
| 217 | 220 | case BPF_S_LD_H_ABS: |
| @@ -515,6 +518,24 @@ void bpf_jit_compile(struct sk_filter *fp) · 297 unmodified lines | ||
| 515 | 518 | CLEAR_A(); |
| 516 | 519 | #endif |
| 517 | 520 | break; |
| 521 | + case BPF_S_ANC_VLAN_TAG: | |
| 522 | + case BPF_S_ANC_VLAN_TAG_PRESENT: | |
| 523 | + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | |
| 524 | + if (is_imm8(offsetof(struct sk_buff, vlan_tci))) { | |
| 525 | + /* movzwl off8(%rdi),%eax */ | |
| 526 | + EMIT4(0x0f, 0xb7, 0x47, offsetof(struct sk_buff, vlan_tci)); | |
| 527 | + } else { | |
| 528 | + EMIT3(0x0f, 0xb7, 0x87); /* movzwl off32(%rdi),%eax */ | |
| 529 | + EMIT(offsetof(struct sk_buff, vlan_tci), 4); | |
| 530 | + } | |
| 531 | + BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000); | |
| 532 | + if (filter[i].code == BPF_S_ANC_VLAN_TAG) { | |
| 533 | + EMIT3(0x80, 0xe4, 0xef); /* and $0xef,%ah */ | |
| 534 | + } else { | |
| 535 | + EMIT3(0xc1, 0xe8, 0x0c); /* shr $0xc,%eax */ | |
| 536 | + EMIT3(0x83, 0xe0, 0x01); /* and $0x1,%eax */ | |
| 537 | + } | |
| 538 | + break; | |
| 518 | 539 | case BPF_S_LD_W_ABS: |
| 519 | 540 | func = CHOOSE_LOAD_FUNC(K, sk_load_word); |
| 520 | 541 | common_load: seen |= SEEN_DATAREF; |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | #define SO_ATTACH_FILTER 26 |
| 54 | 54 | #define SO_DETACH_FILTER 27 |
| 55 | +#define SO_GET_FILTER SO_ATTACH_FILTER | |
| 55 | 56 | |
| 56 | 57 | #define SO_PEERNAME 28 |
| 57 | 58 | #define SO_TIMESTAMP 29 |
| @@ -164,7 +164,6 @@ static void fpga_queue(struct solos_card *card, int port, struct sk_buff *skb, · 163 unmodified lines | ||
| 164 | 164 | static uint32_t fpga_tx(struct solos_card *); |
| 165 | 165 | static irqreturn_t solos_irq(int irq, void *dev_id); |
| 166 | 166 | static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); |
| 167 | −static int list_vccs(int vci); | |
| 168 | 167 | static int atm_init(struct solos_card *, struct device *); |
| 169 | 168 | static void atm_remove(struct solos_card *); |
| 170 | 169 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); |
| @@ -710,7 +709,8 @@ void solos_bh(unsigned long card_arg) · 539 unmodified lines | ||
| 710 | 709 | dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", |
| 711 | 710 | le16_to_cpu(header->vpi), le16_to_cpu(header->vci), |
| 712 | 711 | port); |
| 713 | − continue; | |
| 712 | + dev_kfree_skb_any(skb); | |
| 713 | + break; | |
| 714 | 714 | } |
| 715 | 715 | atm_charge(vcc, skb->truesize); |
| 716 | 716 | vcc->push(vcc, skb); |
| @@ -790,44 +790,6 @@ static struct atm_vcc *find_vcc(struct atm_dev *dev, short vpi, int vci) · 73 unmodified lines | ||
| 790 | 790 | return vcc; |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | −static int list_vccs(int vci) | |
| 794 | −{ | |
| 795 | − struct hlist_head *head; | |
| 796 | − struct atm_vcc *vcc; | |
| 797 | − struct hlist_node *node; | |
| 798 | − struct sock *s; | |
| 799 | − int num_found = 0; | |
| 800 | − int i; | |
| 801 | − | |
| 802 | − read_lock(&vcc_sklist_lock); | |
| 803 | − if (vci != 0){ | |
| 804 | − head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; | |
| 805 | − sk_for_each(s, node, head) { | |
| 806 | − num_found ++; | |
| 807 | − vcc = atm_sk(s); | |
| 808 | − printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", | |
| 809 | − vcc->dev->number, | |
| 810 | − vcc->vpi, | |
| 811 | − vcc->vci); | |
| 812 | − } | |
| 813 | − } else { | |
| 814 | − for(i = 0; i < VCC_HTABLE_SIZE; i++){ | |
| 815 | − head = &vcc_hash[i]; | |
| 816 | − sk_for_each(s, node, head) { | |
| 817 | − num_found ++; | |
| 818 | − vcc = atm_sk(s); | |
| 819 | − printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n", | |
| 820 | − vcc->dev->number, | |
| 821 | − vcc->vpi, | |
| 822 | − vcc->vci); | |
| 823 | − } | |
| 824 | − } | |
| 825 | − } | |
| 826 | − read_unlock(&vcc_sklist_lock); | |
| 827 | − return num_found; | |
| 828 | −} | |
| 829 | − | |
| 830 | − | |
| 831 | 793 | static int popen(struct atm_vcc *vcc) |
| 832 | 794 | { |
| 833 | 795 | struct solos_card *card = vcc->dev->dev_data; |
| @@ -840,7 +802,7 @@ static int popen(struct atm_vcc *vcc) · 6 unmodified lines | ||
| 840 | 802 | return -EINVAL; |
| 841 | 803 | } |
| 842 | 804 | |
| 843 | − skb = alloc_skb(sizeof(*header), GFP_ATOMIC); | |
| 805 | + skb = alloc_skb(sizeof(*header), GFP_KERNEL); | |
| 844 | 806 | if (!skb) { |
| 845 | 807 | if (net_ratelimit()) |
| 846 | 808 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); |
| @@ -857,8 +819,6 @@ static int popen(struct atm_vcc *vcc) · 10 unmodified lines | ||
| 857 | 819 | |
| 858 | 820 | set_bit(ATM_VF_ADDR, &vcc->flags); |
| 859 | 821 | set_bit(ATM_VF_READY, &vcc->flags); |
| 860 | − list_vccs(0); | |
| 861 | − | |
| 862 | 822 | |
| 863 | 823 | return 0; |
| 864 | 824 | } |
| @@ -866,10 +826,21 @@ static int popen(struct atm_vcc *vcc) · 1 unmodified line | ||
| 866 | 826 | static void pclose(struct atm_vcc *vcc) |
| 867 | 827 | { |
| 868 | 828 | struct solos_card *card = vcc->dev->dev_data; |
| 869 | − struct sk_buff *skb; | |
| 829 | + unsigned char port = SOLOS_CHAN(vcc->dev); | |
| 830 | + struct sk_buff *skb, *tmpskb; | |
| 870 | 831 | struct pkt_hdr *header; |
| 871 | 832 | |
| 872 | − skb = alloc_skb(sizeof(*header), GFP_ATOMIC); | |
| 833 | + /* Remove any yet-to-be-transmitted packets from the pending queue */ | |
| 834 | + spin_lock(&card->tx_queue_lock); | |
| 835 | + skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) { | |
| 836 | + if (SKB_CB(skb)->vcc == vcc) { | |
| 837 | + skb_unlink(skb, &card->tx_queue[port]); | |
| 838 | + solos_pop(vcc, skb); | |
| 839 | + } | |
| 840 | + } | |
| 841 | + spin_unlock(&card->tx_queue_lock); | |
| 842 | + | |
| 843 | + skb = alloc_skb(sizeof(*header), GFP_KERNEL); | |
| 873 | 844 | if (!skb) { |
| 874 | 845 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n"); |
| 875 | 846 | return; |
| @@ -881,15 +852,22 @@ static void pclose(struct atm_vcc *vcc) · 5 unmodified lines | ||
| 881 | 852 | header->vci = cpu_to_le16(vcc->vci); |
| 882 | 853 | header->type = cpu_to_le16(PKT_PCLOSE); |
| 883 | 854 | |
| 884 | − fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL); | |
| 855 | + skb_get(skb); | |
| 856 | + fpga_queue(card, port, skb, NULL); | |
| 885 | 857 | |
| 886 | − clear_bit(ATM_VF_ADDR, &vcc->flags); | |
| 887 | − clear_bit(ATM_VF_READY, &vcc->flags); | |
| 858 | + if (!wait_event_timeout(card->param_wq, !skb_shared(skb), 5 * HZ)) | |
| 859 | + dev_warn(&card->dev->dev, | |
| 860 | + "Timeout waiting for VCC close on port %d\n", port); | |
| 861 | + | |
| 862 | + dev_kfree_skb(skb); | |
| 888 | 863 | |
| 889 | 864 | /* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the |
| 890 | 865 | tasklet has finished processing any incoming packets (and, more to |
| 891 | 866 | the point, using the vcc pointer). */ |
| 892 | 867 | tasklet_unlock_wait(&card->tlet); |
| 868 | + | |
| 869 | + clear_bit(ATM_VF_ADDR, &vcc->flags); | |
| 870 | + | |
| 893 | 871 | return; |
| 894 | 872 | } |
| 895 | 873 | |
| @@ -967,10 +945,11 @@ static uint32_t fpga_tx(struct solos_card *card) · 71 unmodified lines | ||
| 967 | 945 | for (port = 0; tx_pending; tx_pending >>= 1, port++) { |
| 968 | 946 | if (tx_pending & 1) { |
| 969 | 947 | struct sk_buff *oldskb = card->tx_skb[port]; |
| 970 | − if (oldskb) | |
| 948 | + if (oldskb) { | |
| 971 | 949 | pci_unmap_single(card->dev, SKB_CB(oldskb)->dma_addr, |
| 972 | 950 | oldskb->len, PCI_DMA_TODEVICE); |
| 973 | − | |
| 951 | + card->tx_skb[port] = NULL; | |
| 952 | + } | |
| 974 | 953 | spin_lock(&card->tx_queue_lock); |
| 975 | 954 | skb = skb_dequeue(&card->tx_queue[port]); |
| 976 | 955 | if (!skb) |
| @@ -1011,9 +990,10 @@ static uint32_t fpga_tx(struct solos_card *card) · 34 unmodified lines | ||
| 1011 | 990 | if (vcc) { |
| 1012 | 991 | atomic_inc(&vcc->stats->tx); |
| 1013 | 992 | solos_pop(vcc, oldskb); |
| 1014 | − } else | |
| 993 | + } else { | |
| 1015 | 994 | dev_kfree_skb_irq(oldskb); |
| 1016 | − | |
| 995 | + wake_up(&card->param_wq); | |
| 996 | + } | |
| 1017 | 997 | } |
| 1018 | 998 | } |
| 1019 | 999 | /* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */ |
| @@ -1248,7 +1228,7 @@ static int atm_init(struct solos_card *card, struct device *parent) · 228 unmodified lines | ||
| 1248 | 1228 | card->atmdev[i]->phy_data = (void *)(unsigned long)i; |
| 1249 | 1229 | atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); |
| 1250 | 1230 | |
| 1251 | − skb = alloc_skb(sizeof(*header), GFP_ATOMIC); | |
| 1231 | + skb = alloc_skb(sizeof(*header), GFP_KERNEL); | |
| 1252 | 1232 | if (!skb) { |
| 1253 | 1233 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in atm_init()\n"); |
| 1254 | 1234 | continue; |
| @@ -1345,6 +1325,8 @@ static struct pci_driver fpga_driver = { · 90 unmodified lines | ||
| 1345 | 1325 | |
| 1346 | 1326 | static int __init solos_pci_init(void) |
| 1347 | 1327 | { |
| 1328 | + BUILD_BUG_ON(sizeof(struct solos_skb_cb) > sizeof(((struct sk_buff *)0)->cb)); | |
| 1329 | + | |
| 1348 | 1330 | printk(KERN_INFO "Solos PCI Driver Version %s\n", VERSION); |
| 1349 | 1331 | return pci_register_driver(&fpga_driver); |
| 1350 | 1332 | } |
| @@ -48,8 +48,8 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc); · 47 unmodified lines | ||
| 48 | 48 | #endif /* CONFIG_BCMA_DRIVER_MIPS */ |
| 49 | 49 | |
| 50 | 50 | /* driver_chipcommon_pmu.c */ |
| 51 | −u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc); | |
| 52 | −u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); | |
| 51 | +u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); | |
| 52 | +u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); | |
| 53 | 53 | |
| 54 | 54 | #ifdef CONFIG_BCMA_SFLASH |
| 55 | 55 | /* driver_chipcommon_sflash.c */ |
| @@ -84,6 +84,8 @@ extern void __exit bcma_host_pci_exit(void); · 28 unmodified lines | ||
| 84 | 84 | /* driver_pci.c */ |
| 85 | 85 | u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); |
| 86 | 86 | |
| 87 | +extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); | |
| 88 | + | |
| 87 | 89 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE |
| 88 | 90 | bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); |
| 89 | 91 | void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); |
| @@ -4,12 +4,15 @@ · 3 unmodified lines | ||
| 4 | 4 | * |
| 5 | 5 | * Copyright 2005, Broadcom Corporation |
| 6 | 6 | * Copyright 2006, 2007, Michael Buesch <m@bues.ch> |
| 7 | + * Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de> | |
| 7 | 8 | * |
| 8 | 9 | * Licensed under the GNU/GPL. See COPYING for details. |
| 9 | 10 | */ |
| 10 | 11 | |
| 11 | 12 | #include "bcma_private.h" |
| 13 | +#include <linux/bcm47xx_wdt.h> | |
| 12 | 14 | #include <linux/export.h> |
| 15 | +#include <linux/platform_device.h> | |
| 13 | 16 | #include <linux/bcma/bcma.h> |
| 14 | 17 | |
| 15 | 18 | static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, |
| @@ -22,12 +25,93 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, · 6 unmodified lines | ||
| 22 | 25 | return value; |
| 23 | 26 | } |
| 24 | 27 | |
| 25 | −void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) | |
| 28 | +static u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc) | |
| 26 | 29 | { |
| 27 | − u32 leddc_on = 10; | |
| 28 | − u32 leddc_off = 90; | |
| 30 | + if (cc->capabilities & BCMA_CC_CAP_PMU) | |
| 31 | + return bcma_pmu_get_alp_clock(cc); | |
| 29 | 32 | |
| 30 | − if (cc->setup_done) | |
| 33 | + return 20000000; | |
| 34 | +} | |
| 35 | + | |
| 36 | +static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc) | |
| 37 | +{ | |
| 38 | + struct bcma_bus *bus = cc->core->bus; | |
| 39 | + u32 nb; | |
| 40 | + | |
| 41 | + if (cc->capabilities & BCMA_CC_CAP_PMU) { | |
| 42 | + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) | |
| 43 | + nb = 32; | |
| 44 | + else if (cc->core->id.rev < 26) | |
| 45 | + nb = 16; | |
| 46 | + else | |
| 47 | + nb = (cc->core->id.rev >= 37) ? 32 : 24; | |
| 48 | + } else { | |
| 49 | + nb = 28; | |
| 50 | + } | |
| 51 | + if (nb == 32) | |
| 52 | + return 0xffffffff; | |
| 53 | + else | |
| 54 | + return (1 << nb) - 1; | |
| 55 | +} | |
| 56 | + | |
| 57 | +static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, | |
| 58 | + u32 ticks) | |
| 59 | +{ | |
| 60 | + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt); | |
| 61 | + | |
| 62 | + return bcma_chipco_watchdog_timer_set(cc, ticks); | |
| 63 | +} | |
| 64 | + | |
| 65 | +static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt, | |
| 66 | + u32 ms) | |
| 67 | +{ | |
| 68 | + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt); | |
| 69 | + u32 ticks; | |
| 70 | + | |
| 71 | + ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms); | |
| 72 | + return ticks / cc->ticks_per_ms; | |
| 73 | +} | |
| 74 | + | |
| 75 | +static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc) | |
| 76 | +{ | |
| 77 | + struct bcma_bus *bus = cc->core->bus; | |
| 78 | + | |
| 79 | + if (cc->capabilities & BCMA_CC_CAP_PMU) { | |
| 80 | + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) | |
| 81 | + /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ | |
| 82 | + return bcma_chipco_get_alp_clock(cc) / 4000; | |
| 83 | + else | |
| 84 | + /* based on 32KHz ILP clock */ | |
| 85 | + return 32; | |
| 86 | + } else { | |
| 87 | + return bcma_chipco_get_alp_clock(cc) / 1000; | |
| 88 | + } | |
| 89 | +} | |
| 90 | + | |
| 91 | +int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc) | |
| 92 | +{ | |
| 93 | + struct bcm47xx_wdt wdt = {}; | |
| 94 | + struct platform_device *pdev; | |
| 95 | + | |
| 96 | + wdt.driver_data = cc; | |
| 97 | + wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; | |
| 98 | + wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; | |
| 99 | + wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; | |
| 100 | + | |
| 101 | + pdev = platform_device_register_data(NULL, "bcm47xx-wdt", | |
| 102 | + cc->core->bus->num, &wdt, | |
| 103 | + sizeof(wdt)); | |
| 104 | + if (IS_ERR(pdev)) | |
| 105 | + return PTR_ERR(pdev); | |
| 106 | + | |
| 107 | + cc->watchdog = pdev; | |
| 108 | + | |
| 109 | + return 0; | |
| 110 | +} | |
| 111 | + | |
| 112 | +void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) | |
| 113 | +{ | |
| 114 | + if (cc->early_setup_done) | |
| 31 | 115 | return; |
| 32 | 116 | |
| 33 | 117 | if (cc->core->id.rev >= 11) |
| @@ -36,6 +120,22 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) · 2 unmodified lines | ||
| 36 | 120 | if (cc->core->id.rev >= 35) |
| 37 | 121 | cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT); |
| 38 | 122 | |
| 123 | + if (cc->capabilities & BCMA_CC_CAP_PMU) | |
| 124 | + bcma_pmu_early_init(cc); | |
| 125 | + | |
| 126 | + cc->early_setup_done = true; | |
| 127 | +} | |
| 128 | + | |
| 129 | +void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) | |
| 130 | +{ | |
| 131 | + u32 leddc_on = 10; | |
| 132 | + u32 leddc_off = 90; | |
| 133 | + | |
| 134 | + if (cc->setup_done) | |
| 135 | + return; | |
| 136 | + | |
| 137 | + bcma_core_chipcommon_early_init(cc); | |
| 138 | + | |
| 39 | 139 | if (cc->core->id.rev >= 20) { |
| 40 | 140 | bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0); |
| 41 | 141 | bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0); |
| @@ -56,15 +156,33 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) · 14 unmodified lines | ||
| 56 | 156 | ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) | |
| 57 | 157 | (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT))); |
| 58 | 158 | } |
| 159 | + cc->ticks_per_ms = bcma_chipco_watchdog_ticks_per_ms(cc); | |
| 59 | 160 | |
| 60 | 161 | cc->setup_done = true; |
| 61 | 162 | } |
| 62 | 163 | |
| 63 | 164 | /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ |
| 64 | −void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) | |
| 165 | +u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) | |
| 65 | 166 | { |
| 66 | − /* instant NMI */ | |
| 67 | − bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); | |
| 167 | + u32 maxt; | |
| 168 | + enum bcma_clkmode clkmode; | |
| 169 | + | |
| 170 | + maxt = bcma_chipco_watchdog_get_max_timer(cc); | |
| 171 | + if (cc->capabilities & BCMA_CC_CAP_PMU) { | |
| 172 | + if (ticks == 1) | |
| 173 | + ticks = 2; | |
| 174 | + else if (ticks > maxt) | |
| 175 | + ticks = maxt; | |
| 176 | + bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); | |
| 177 | + } else { | |
| 178 | + clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; | |
| 179 | + bcma_core_set_clockmode(cc->core, clkmode); | |
| 180 | + if (ticks > maxt) | |
| 181 | + ticks = maxt; | |
| 182 | + /* instant NMI */ | |
| 183 | + bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); | |
| 184 | + } | |
| 185 | + return ticks; | |
| 68 | 186 | } |
| 69 | 187 | |
| 70 | 188 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) |
| @@ -118,8 +236,7 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc) · 47 unmodified lines | ||
| 118 | 236 | struct bcma_serial_port *ports = cc->serial_ports; |
| 119 | 237 | |
| 120 | 238 | if (ccrev >= 11 && ccrev != 15) { |
| 121 | − /* Fixed ALP clock */ | |
| 122 | − baud_base = bcma_pmu_alp_clock(cc); | |
| 239 | + baud_base = bcma_chipco_get_alp_clock(cc); | |
| 123 | 240 | if (ccrev >= 21) { |
| 124 | 241 | /* Turn off UART clock before switching clocksource. */ |
| 125 | 242 | bcma_cc_write32(cc, BCMA_CC_CORECTL, |
| @@ -32,6 +32,9 @@ int bcma_nflash_init(struct bcma_drv_cc *cc) · 31 unmodified lines | ||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | cc->nflash.present = true; |
| 35 | + if (cc->core->id.rev == 38 && | |
| 36 | + (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT)) | |
| 37 | + cc->nflash.boot = true; | |
| 35 | 38 | |
| 36 | 39 | /* Prepare platform device, but don't register it yet. It's too early, |
| 37 | 40 | * malloc (required by device_private_init) is not available yet. */ |
| @@ -144,7 +144,7 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc) · 143 unmodified lines | ||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | −void bcma_pmu_init(struct bcma_drv_cc *cc) | |
| 147 | +void bcma_pmu_early_init(struct bcma_drv_cc *cc) | |
| 148 | 148 | { |
| 149 | 149 | u32 pmucap; |
| 150 | 150 | |
| @@ -153,7 +153,10 @@ void bcma_pmu_init(struct bcma_drv_cc *cc) · 2 unmodified lines | ||
| 153 | 153 | |
| 154 | 154 | bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n", |
| 155 | 155 | cc->pmu.rev, pmucap); |
| 156 | +} | |
| 156 | 157 | |
| 158 | +void bcma_pmu_init(struct bcma_drv_cc *cc) | |
| 159 | +{ | |
| 157 | 160 | if (cc->pmu.rev == 1) |
| 158 | 161 | bcma_cc_mask32(cc, BCMA_CC_PMU_CTL, |
| 159 | 162 | ~BCMA_CC_PMU_CTL_NOILPONW); |
| @@ -165,7 +168,7 @@ void bcma_pmu_init(struct bcma_drv_cc *cc) · 5 unmodified lines | ||
| 165 | 168 | bcma_pmu_workarounds(cc); |
| 166 | 169 | } |
| 167 | 170 | |
| 168 | −u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc) | |
| 171 | +u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc) | |
| 169 | 172 | { |
| 170 | 173 | struct bcma_bus *bus = cc->core->bus; |
| 171 | 174 | |
| @@ -193,7 +196,7 @@ u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc) · 21 unmodified lines | ||
| 193 | 196 | /* Find the output of the "m" pll divider given pll controls that start with |
| 194 | 197 | * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc. |
| 195 | 198 | */ |
| 196 | −static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m) | |
| 199 | +static u32 bcma_pmu_pll_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m) | |
| 197 | 200 | { |
| 198 | 201 | u32 tmp, div, ndiv, p1, p2, fc; |
| 199 | 202 | struct bcma_bus *bus = cc->core->bus; |
| @@ -222,14 +225,14 @@ static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m) · 22 unmodified lines | ||
| 222 | 225 | ndiv = (tmp & BCMA_CC_PPL_NDIV_MASK) >> BCMA_CC_PPL_NDIV_SHIFT; |
| 223 | 226 | |
| 224 | 227 | /* Do calculation in Mhz */ |
| 225 | − fc = bcma_pmu_alp_clock(cc) / 1000000; | |
| 228 | + fc = bcma_pmu_get_alp_clock(cc) / 1000000; | |
| 226 | 229 | fc = (p1 * ndiv * fc) / p2; |
| 227 | 230 | |
| 228 | 231 | /* Return clock in Hertz */ |
| 229 | 232 | return (fc / div) * 1000000; |
| 230 | 233 | } |
| 231 | 234 | |
| 232 | −static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) | |
| 235 | +static u32 bcma_pmu_pll_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) | |
| 233 | 236 | { |
| 234 | 237 | u32 tmp, ndiv, p1div, p2div; |
| 235 | 238 | u32 clock; |
| @@ -260,7 +263,7 @@ static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) · 24 unmodified lines | ||
| 260 | 263 | } |
| 261 | 264 | |
| 262 | 265 | /* query bus clock frequency for PMU-enabled chipcommon */ |
| 263 | −static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc) | |
| 266 | +static u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc) | |
| 264 | 267 | { |
| 265 | 268 | struct bcma_bus *bus = cc->core->bus; |
| 266 | 269 | |
| @@ -268,40 +271,42 @@ static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc) · 1 unmodified line | ||
| 268 | 271 | case BCMA_CHIP_ID_BCM4716: |
| 269 | 272 | case BCMA_CHIP_ID_BCM4748: |
| 270 | 273 | case BCMA_CHIP_ID_BCM47162: |
| 271 | − return bcma_pmu_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0, | |
| 272 | − BCMA_CC_PMU5_MAINPLL_SSB); | |
| 274 | + return bcma_pmu_pll_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0, | |
| 275 | + BCMA_CC_PMU5_MAINPLL_SSB); | |
| 273 | 276 | case BCMA_CHIP_ID_BCM5356: |
| 274 | − return bcma_pmu_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0, | |
| 275 | − BCMA_CC_PMU5_MAINPLL_SSB); | |
| 277 | + return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0, | |
| 278 | + BCMA_CC_PMU5_MAINPLL_SSB); | |
| 276 | 279 | case BCMA_CHIP_ID_BCM5357: |
| 277 | 280 | case BCMA_CHIP_ID_BCM4749: |
| 278 | − return bcma_pmu_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0, | |
| 279 | − BCMA_CC_PMU5_MAINPLL_SSB); | |
| 281 | + return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0, | |
| 282 | + BCMA_CC_PMU5_MAINPLL_SSB); | |
| 280 | 283 | case BCMA_CHIP_ID_BCM4706: |
| 281 | − return bcma_pmu_clock_bcm4706(cc, BCMA_CC_PMU4706_MAINPLL_PLL0, | |
| 282 | − BCMA_CC_PMU5_MAINPLL_SSB); | |
| 284 | + return bcma_pmu_pll_clock_bcm4706(cc, | |
| 285 | + BCMA_CC_PMU4706_MAINPLL_PLL0, | |
| 286 | + BCMA_CC_PMU5_MAINPLL_SSB); | |
| 283 | 287 | case BCMA_CHIP_ID_BCM53572: |
| 284 | 288 | return 75000000; |
| 285 | 289 | default: |
| 286 | − bcma_warn(bus, "No backplane clock specified for %04X device, pmu rev. %d, using default %d Hz\n", | |
| 290 | + bcma_warn(bus, "No bus clock specified for %04X device, pmu rev. %d, using default %d Hz\n", | |
| 287 | 291 | bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK); |
| 288 | 292 | } |
| 289 | 293 | return BCMA_CC_PMU_HT_CLOCK; |
| 290 | 294 | } |
| 291 | 295 | |
| 292 | 296 | /* query cpu clock frequency for PMU-enabled chipcommon */ |
| 293 | −u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc) | |
| 297 | +u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc) | |
| 294 | 298 | { |
| 295 | 299 | struct bcma_bus *bus = cc->core->bus; |
| 296 | 300 | |
| 297 | 301 | if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) |
| 298 | 302 | return 300000000; |
| 299 | 303 | |
| 304 | + /* New PMUs can have different clock for bus and CPU */ | |
| 300 | 305 | if (cc->pmu.rev >= 5) { |
| 301 | 306 | u32 pll; |
| 302 | 307 | switch (bus->chipinfo.id) { |
| 303 | 308 | case BCMA_CHIP_ID_BCM4706: |
| 304 | − return bcma_pmu_clock_bcm4706(cc, | |
| 309 | + return bcma_pmu_pll_clock_bcm4706(cc, | |
| 305 | 310 | BCMA_CC_PMU4706_MAINPLL_PLL0, |
| 306 | 311 | BCMA_CC_PMU5_MAINPLL_CPU); |
| 307 | 312 | case BCMA_CHIP_ID_BCM5356: |
| @@ -316,10 +321,11 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc) · 8 unmodified lines | ||
| 316 | 321 | break; |
| 317 | 322 | } |
| 318 | 323 | |
| 319 | − return bcma_pmu_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU); | |
| 324 | + return bcma_pmu_pll_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU); | |
| 320 | 325 | } |
| 321 | 326 | |
| 322 | − return bcma_pmu_get_clockcontrol(cc); | |
| 327 | + /* On old PMUs CPU has the same clock as the bus */ | |
| 328 | + return bcma_pmu_get_bus_clock(cc); | |
| 323 | 329 | } |
| 324 | 330 | |
| 325 | 331 | static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset, |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | static struct resource bcma_sflash_resource = { |
| 14 | 14 | .name = "bcma_sflash", |
| 15 | − .start = BCMA_SFLASH, | |
| 15 | + .start = BCMA_SOC_FLASH2, | |
| 16 | 16 | .end = 0, |
| 17 | 17 | .flags = IORESOURCE_MEM | IORESOURCE_READONLY, |
| 18 | 18 | }; |
| @@ -31,15 +31,42 @@ struct bcma_sflash_tbl_e { · 12 unmodified lines | ||
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | 33 | static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = { |
| 34 | − { "", 0x14, 0x10000, 32, }, | |
| 34 | + { "M25P20", 0x11, 0x10000, 4, }, | |
| 35 | + { "M25P40", 0x12, 0x10000, 8, }, | |
| 36 | + | |
| 37 | + { "M25P16", 0x14, 0x10000, 32, }, | |
| 38 | + { "M25P32", 0x14, 0x10000, 64, }, | |
| 39 | + { "M25P64", 0x16, 0x10000, 128, }, | |
| 40 | + { "M25FL128", 0x17, 0x10000, 256, }, | |
| 35 | 41 | { 0 }, |
| 36 | 42 | }; |
| 37 | 43 | |
| 38 | 44 | static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = { |
| 45 | + { "SST25WF512", 1, 0x1000, 16, }, | |
| 46 | + { "SST25VF512", 0x48, 0x1000, 16, }, | |
| 47 | + { "SST25WF010", 2, 0x1000, 32, }, | |
| 48 | + { "SST25VF010", 0x49, 0x1000, 32, }, | |
| 49 | + { "SST25WF020", 3, 0x1000, 64, }, | |
| 50 | + { "SST25VF020", 0x43, 0x1000, 64, }, | |
| 51 | + { "SST25WF040", 4, 0x1000, 128, }, | |
| 52 | + { "SST25VF040", 0x44, 0x1000, 128, }, | |
| 53 | + { "SST25VF040B", 0x8d, 0x1000, 128, }, | |
| 54 | + { "SST25WF080", 5, 0x1000, 256, }, | |
| 55 | + { "SST25VF080B", 0x8e, 0x1000, 256, }, | |
| 56 | + { "SST25VF016", 0x41, 0x1000, 512, }, | |
| 57 | + { "SST25VF032", 0x4a, 0x1000, 1024, }, | |
| 58 | + { "SST25VF064", 0x4b, 0x1000, 2048, }, | |
| 39 | 59 | { 0 }, |
| 40 | 60 | }; |
| 41 | 61 | |
| 42 | 62 | static struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = { |
| 63 | + { "AT45DB011", 0xc, 256, 512, }, | |
| 64 | + { "AT45DB021", 0x14, 256, 1024, }, | |
| 65 | + { "AT45DB041", 0x1c, 256, 2048, }, | |
| 66 | + { "AT45DB081", 0x24, 256, 4096, }, | |
| 67 | + { "AT45DB161", 0x2c, 512, 4096, }, | |
| 68 | + { "AT45DB321", 0x34, 512, 8192, }, | |
| 69 | + { "AT45DB642", 0x3c, 1024, 8192, }, | |
| 43 | 70 | { 0 }, |
| 44 | 71 | }; |
| 45 | 72 | |
| @@ -84,6 +111,8 @@ int bcma_sflash_init(struct bcma_drv_cc *cc) · 38 unmodified lines | ||
| 84 | 111 | break; |
| 85 | 112 | } |
| 86 | 113 | break; |
| 114 | + case 0x13: | |
| 115 | + return -ENOTSUPP; | |
| 87 | 116 | default: |
| 88 | 117 | for (e = bcma_sflash_st_tbl; e->name; e++) { |
| 89 | 118 | if (e->id == id) |
| @@ -116,7 +145,7 @@ int bcma_sflash_init(struct bcma_drv_cc *cc) · 26 unmodified lines | ||
| 116 | 145 | return -ENOTSUPP; |
| 117 | 146 | } |
| 118 | 147 | |
| 119 | − sflash->window = BCMA_SFLASH; | |
| 148 | + sflash->window = BCMA_SOC_FLASH2; | |
| 120 | 149 | sflash->blocksize = e->blocksize; |
| 121 | 150 | sflash->numblocks = e->numblocks; |
| 122 | 151 | sflash->size = sflash->blocksize * sflash->numblocks; |
| @@ -115,7 +115,7 @@ static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) · 114 unmodified lines | ||
| 115 | 115 | bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) & |
| 116 | 116 | ~(1 << irqflag)); |
| 117 | 117 | else |
| 118 | − bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq), 0); | |
| 118 | + bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0); | |
| 119 | 119 | |
| 120 | 120 | /* assign the new one */ |
| 121 | 121 | if (irq == 0) { |
| @@ -171,7 +171,7 @@ u32 bcma_cpu_clock(struct bcma_drv_mips *mcore) · 49 unmodified lines | ||
| 171 | 171 | struct bcma_bus *bus = mcore->core->bus; |
| 172 | 172 | |
| 173 | 173 | if (bus->drv_cc.capabilities & BCMA_CC_CAP_PMU) |
| 174 | − return bcma_pmu_get_clockcpu(&bus->drv_cc); | |
| 174 | + return bcma_pmu_get_cpu_clock(&bus->drv_cc); | |
| 175 | 175 | |
| 176 | 176 | bcma_err(bus, "No PMU available, need this to get the cpu clock\n"); |
| 177 | 177 | return 0; |
| @@ -181,47 +181,66 @@ EXPORT_SYMBOL(bcma_cpu_clock); · 3 unmodified lines | ||
| 181 | 181 | static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) |
| 182 | 182 | { |
| 183 | 183 | struct bcma_bus *bus = mcore->core->bus; |
| 184 | + struct bcma_drv_cc *cc = &bus->drv_cc; | |
| 184 | 185 | |
| 185 | − switch (bus->drv_cc.capabilities & BCMA_CC_CAP_FLASHT) { | |
| 186 | + switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { | |
| 186 | 187 | case BCMA_CC_FLASHT_STSER: |
| 187 | 188 | case BCMA_CC_FLASHT_ATSER: |
| 188 | 189 | bcma_debug(bus, "Found serial flash\n"); |
| 189 | − bcma_sflash_init(&bus->drv_cc); | |
| 190 | + bcma_sflash_init(cc); | |
| 190 | 191 | break; |
| 191 | 192 | case BCMA_CC_FLASHT_PARA: |
| 192 | 193 | bcma_debug(bus, "Found parallel flash\n"); |
| 193 | − bus->drv_cc.pflash.window = 0x1c000000; | |
| 194 | − bus->drv_cc.pflash.window_size = 0x02000000; | |
| 194 | + cc->pflash.present = true; | |
| 195 | + cc->pflash.window = BCMA_SOC_FLASH2; | |
| 196 | + cc->pflash.window_size = BCMA_SOC_FLASH2_SZ; | |
| 195 | 197 | |
| 196 | − if ((bcma_read32(bus->drv_cc.core, BCMA_CC_FLASH_CFG) & | |
| 198 | + if ((bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & | |
| 197 | 199 | BCMA_CC_FLASH_CFG_DS) == 0) |
| 198 | − bus->drv_cc.pflash.buswidth = 1; | |
| 200 | + cc->pflash.buswidth = 1; | |
| 199 | 201 | else |
| 200 | − bus->drv_cc.pflash.buswidth = 2; | |
| 202 | + cc->pflash.buswidth = 2; | |
| 201 | 203 | break; |
| 202 | 204 | default: |
| 203 | 205 | bcma_err(bus, "Flash type not supported\n"); |
| 204 | 206 | } |
| 205 | 207 | |
| 206 | − if (bus->drv_cc.core->id.rev == 38 || | |
| 208 | + if (cc->core->id.rev == 38 || | |
| 207 | 209 | bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { |
| 208 | − if (bus->drv_cc.capabilities & BCMA_CC_CAP_NFLASH) { | |
| 210 | + if (cc->capabilities & BCMA_CC_CAP_NFLASH) { | |
| 209 | 211 | bcma_debug(bus, "Found NAND flash\n"); |
| 210 | − bcma_nflash_init(&bus->drv_cc); | |
| 212 | + bcma_nflash_init(cc); | |
| 211 | 213 | } |
| 212 | 214 | } |
| 213 | 215 | } |
| 214 | 216 | |
| 217 | +void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) | |
| 218 | +{ | |
| 219 | + struct bcma_bus *bus = mcore->core->bus; | |
| 220 | + | |
| 221 | + if (mcore->early_setup_done) | |
| 222 | + return; | |
| 223 | + | |
| 224 | + bcma_chipco_serial_init(&bus->drv_cc); | |
| 225 | + bcma_core_mips_flash_detect(mcore); | |
| 226 | + | |
| 227 | + mcore->early_setup_done = true; | |
| 228 | +} | |
| 229 | + | |
| 215 | 230 | void bcma_core_mips_init(struct bcma_drv_mips *mcore) |
| 216 | 231 | { |
| 217 | 232 | struct bcma_bus *bus; |
| 218 | 233 | struct bcma_device *core; |
| 219 | 234 | bus = mcore->core->bus; |
| 220 | 235 | |
| 236 | + if (mcore->setup_done) | |
| 237 | + return; | |
| 238 | + | |
| 221 | 239 | bcma_info(bus, "Initializing MIPS core...\n"); |
| 222 | 240 | |
| 223 | − if (!mcore->setup_done) | |
| 224 | − mcore->assigned_irqs = 1; | |
| 241 | + bcma_core_mips_early_init(mcore); | |
| 242 | + | |
| 243 | + mcore->assigned_irqs = 1; | |
| 225 | 244 | |
| 226 | 245 | /* Assign IRQs to all cores on the bus */ |
| 227 | 246 | list_for_each_entry(core, &bus->cores, list) { |
| @@ -256,10 +275,5 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore) · 28 unmodified lines | ||
| 256 | 275 | bcma_info(bus, "IRQ reconfiguration done\n"); |
| 257 | 276 | bcma_core_mips_dump_irq(bus); |
| 258 | 277 | |
| 259 | − if (mcore->setup_done) | |
| 260 | − return; | |
| 261 | − | |
| 262 | − bcma_chipco_serial_init(&bus->drv_cc); | |
| 263 | − bcma_core_mips_flash_detect(mcore); | |
| 264 | 278 | mcore->setup_done = true; |
| 265 | 279 | } |
| @@ -35,11 +35,6 @@ bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) · 34 unmodified lines | ||
| 35 | 35 | chipid_top != 0x5300) |
| 36 | 36 | return false; |
| 37 | 37 | |
| 38 | − if (bus->sprom.boardflags_lo & BCMA_CORE_PCI_BFL_NOPCI) { | |
| 39 | − bcma_info(bus, "This PCI core is disabled and not working\n"); | |
| 40 | − return false; | |
| 41 | − } | |
| 42 | − | |
| 43 | 38 | bcma_core_enable(pc->core, 0); |
| 44 | 39 | |
| 45 | 40 | return !mips_busprobe32(tmp, pc->core->io_addr); |
| @@ -396,6 +391,11 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 350 unmodified lines | ||
| 396 | 391 | |
| 397 | 392 | bcma_info(bus, "PCIEcore in host mode found\n"); |
| 398 | 393 | |
| 394 | + if (bus->sprom.boardflags_lo & BCMA_CORE_PCI_BFL_NOPCI) { | |
| 395 | + bcma_info(bus, "This PCIE core is disabled and not working\n"); | |
| 396 | + return; | |
| 397 | + } | |
| 398 | + | |
| 399 | 399 | pc_host = kzalloc(sizeof(*pc_host), GFP_KERNEL); |
| 400 | 400 | if (!pc_host) { |
| 401 | 401 | bcma_err(bus, "can not allocate memory"); |
| @@ -452,6 +452,8 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 50 unmodified lines | ||
| 452 | 452 | pc_host->mem_resource.start = BCMA_SOC_PCI_MEM; |
| 453 | 453 | pc_host->mem_resource.end = BCMA_SOC_PCI_MEM + |
| 454 | 454 | BCMA_SOC_PCI_MEM_SZ - 1; |
| 455 | + pc_host->io_resource.start = 0x100; | |
| 456 | + pc_host->io_resource.end = 0x47F; | |
| 455 | 457 | pci_membase_1G = BCMA_SOC_PCIE_DMA_H32; |
| 456 | 458 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, |
| 457 | 459 | tmp | BCMA_SOC_PCI_MEM); |
| @@ -459,6 +461,8 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) · 1 unmodified line | ||
| 459 | 461 | pc_host->mem_resource.start = BCMA_SOC_PCI1_MEM; |
| 460 | 462 | pc_host->mem_resource.end = BCMA_SOC_PCI1_MEM + |
| 461 | 463 | BCMA_SOC_PCI_MEM_SZ - 1; |
| 464 | + pc_host->io_resource.start = 0x480; | |
| 465 | + pc_host->io_resource.end = 0x7FF; | |
| 462 | 466 | pci_membase_1G = BCMA_SOC_PCIE1_DMA_H32; |
| 463 | 467 | pc_host->host_cfg_addr = BCMA_SOC_PCI1_CFG; |
| 464 | 468 | pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, |
| @@ -534,7 +538,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_pcibridge); · 69 unmodified lines | ||
| 534 | 538 | static void bcma_core_pci_fixup_addresses(struct pci_dev *dev) |
| 535 | 539 | { |
| 536 | 540 | struct resource *res; |
| 537 | − int pos; | |
| 541 | + int pos, err; | |
| 538 | 542 | |
| 539 | 543 | if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) { |
| 540 | 544 | /* This is not a device on the PCI-core bridge. */ |
| @@ -547,8 +551,12 @@ static void bcma_core_pci_fixup_addresses(struct pci_dev *dev) · 6 unmodified lines | ||
| 547 | 551 | |
| 548 | 552 | for (pos = 0; pos < 6; pos++) { |
| 549 | 553 | res = &dev->resource[pos]; |
| 550 | − if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM)) | |
| 551 | − pci_assign_resource(dev, pos); | |
| 554 | + if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM)) { | |
| 555 | + err = pci_assign_resource(dev, pos); | |
| 556 | + if (err) | |
| 557 | + pr_err("PCI: Problem fixing up the addresses on %s\n", | |
| 558 | + pci_name(dev)); | |
| 559 | + } | |
| 552 | 560 | } |
| 553 | 561 | } |
| 554 | 562 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_addresses); |
| @@ -238,7 +238,7 @@ static void __devexit bcma_host_pci_remove(struct pci_dev *dev) · 237 unmodified lines | ||
| 238 | 238 | pci_set_drvdata(dev, NULL); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | −#ifdef CONFIG_PM | |
| 241 | +#ifdef CONFIG_PM_SLEEP | |
| 242 | 242 | static int bcma_host_pci_suspend(struct device *dev) |
| 243 | 243 | { |
| 244 | 244 | struct pci_dev *pdev = to_pci_dev(dev); |
| @@ -261,11 +261,11 @@ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend, · 16 unmodified lines | ||
| 261 | 261 | bcma_host_pci_resume); |
| 262 | 262 | #define BCMA_PM_OPS (&bcma_pm_ops) |
| 263 | 263 | |
| 264 | −#else /* CONFIG_PM */ | |
| 264 | +#else /* CONFIG_PM_SLEEP */ | |
| 265 | 265 | |
| 266 | 266 | #define BCMA_PM_OPS NULL |
| 267 | 267 | |
| 268 | −#endif /* CONFIG_PM */ | |
| 268 | +#endif /* CONFIG_PM_SLEEP */ | |
| 269 | 269 | |
| 270 | 270 | static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { |
| 271 | 271 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, |
| @@ -81,6 +81,18 @@ struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid) · 80 unmodified lines | ||
| 81 | 81 | } |
| 82 | 82 | EXPORT_SYMBOL_GPL(bcma_find_core); |
| 83 | 83 | |
| 84 | +static struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid, | |
| 85 | + u8 unit) | |
| 86 | +{ | |
| 87 | + struct bcma_device *core; | |
| 88 | + | |
| 89 | + list_for_each_entry(core, &bus->cores, list) { | |
| 90 | + if (core->id.id == coreid && core->core_unit == unit) | |
| 91 | + return core; | |
| 92 | + } | |
| 93 | + return NULL; | |
| 94 | +} | |
| 95 | + | |
| 84 | 96 | static void bcma_release_core_dev(struct device *dev) |
| 85 | 97 | { |
| 86 | 98 | struct bcma_device *core = container_of(dev, struct bcma_device, dev); |
| @@ -153,6 +165,12 @@ static int bcma_register_cores(struct bcma_bus *bus) · 66 unmodified lines | ||
| 153 | 165 | } |
| 154 | 166 | #endif |
| 155 | 167 | |
| 168 | + if (bus->hosttype == BCMA_HOSTTYPE_SOC) { | |
| 169 | + err = bcma_chipco_watchdog_register(&bus->drv_cc); | |
| 170 | + if (err) | |
| 171 | + bcma_err(bus, "Error registering watchdog driver\n"); | |
| 172 | + } | |
| 173 | + | |
| 156 | 174 | return 0; |
| 157 | 175 | } |
| 158 | 176 | |
| @@ -165,6 +183,8 @@ static void bcma_unregister_cores(struct bcma_bus *bus) · 6 unmodified lines | ||
| 165 | 183 | if (core->dev_registered) |
| 166 | 184 | device_unregister(&core->dev); |
| 167 | 185 | } |
| 186 | + if (bus->hosttype == BCMA_HOSTTYPE_SOC) | |
| 187 | + platform_device_unregister(bus->drv_cc.watchdog); | |
| 168 | 188 | } |
| 169 | 189 | |
| 170 | 190 | int __devinit bcma_bus_register(struct bcma_bus *bus) |
| @@ -183,6 +203,20 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) · 12 unmodified lines | ||
| 183 | 203 | return -1; |
| 184 | 204 | } |
| 185 | 205 | |
| 206 | + /* Early init CC core */ | |
| 207 | + core = bcma_find_core(bus, bcma_cc_core_id(bus)); | |
| 208 | + if (core) { | |
| 209 | + bus->drv_cc.core = core; | |
| 210 | + bcma_core_chipcommon_early_init(&bus->drv_cc); | |
| 211 | + } | |
| 212 | + | |
| 213 | + /* Try to get SPROM */ | |
| 214 | + err = bcma_sprom_get(bus); | |
| 215 | + if (err == -ENOENT) { | |
| 216 | + bcma_err(bus, "No SPROM available\n"); | |
| 217 | + } else if (err) | |
| 218 | + bcma_err(bus, "Failed to get SPROM: %d\n", err); | |
| 219 | + | |
| 186 | 220 | /* Init CC core */ |
| 187 | 221 | core = bcma_find_core(bus, bcma_cc_core_id(bus)); |
| 188 | 222 | if (core) { |
| @@ -198,10 +232,17 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) · 9 unmodified lines | ||
| 198 | 232 | } |
| 199 | 233 | |
| 200 | 234 | /* Init PCIE core */ |
| 201 | − core = bcma_find_core(bus, BCMA_CORE_PCIE); | |
| 235 | + core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0); | |
| 236 | + if (core) { | |
| 237 | + bus->drv_pci[0].core = core; | |
| 238 | + bcma_core_pci_init(&bus->drv_pci[0]); | |
| 239 | + } | |
| 240 | + | |
| 241 | + /* Init PCIE core */ | |
| 242 | + core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1); | |
| 202 | 243 | if (core) { |
| 203 | − bus->drv_pci.core = core; | |
| 204 | − bcma_core_pci_init(&bus->drv_pci); | |
| 244 | + bus->drv_pci[1].core = core; | |
| 245 | + bcma_core_pci_init(&bus->drv_pci[1]); | |
| 205 | 246 | } |
| 206 | 247 | |
| 207 | 248 | /* Init GBIT MAC COMMON core */ |
| @@ -211,13 +252,6 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) · 3 unmodified lines | ||
| 211 | 252 | bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn); |
| 212 | 253 | } |
| 213 | 254 | |
| 214 | − /* Try to get SPROM */ | |
| 215 | − err = bcma_sprom_get(bus); | |
| 216 | − if (err == -ENOENT) { | |
| 217 | − bcma_err(bus, "No SPROM available\n"); | |
| 218 | − } else if (err) | |
| 219 | − bcma_err(bus, "Failed to get SPROM: %d\n", err); | |
| 220 | − | |
| 221 | 255 | /* Register found cores */ |
| 222 | 256 | bcma_register_cores(bus); |
| 223 | 257 | |
| @@ -275,18 +309,18 @@ int __init bcma_bus_early_register(struct bcma_bus *bus, · 51 unmodified lines | ||
| 275 | 309 | return -1; |
| 276 | 310 | } |
| 277 | 311 | |
| 278 | − /* Init CC core */ | |
| 312 | + /* Early init CC core */ | |
| 279 | 313 | core = bcma_find_core(bus, bcma_cc_core_id(bus)); |
| 280 | 314 | if (core) { |
| 281 | 315 | bus->drv_cc.core = core; |
| 282 | − bcma_core_chipcommon_init(&bus->drv_cc); | |
| 316 | + bcma_core_chipcommon_early_init(&bus->drv_cc); | |
| 283 | 317 | } |
| 284 | 318 | |
| 285 | − /* Init MIPS core */ | |
| 319 | + /* Early init MIPS core */ | |
| 286 | 320 | core = bcma_find_core(bus, BCMA_CORE_MIPS_74K); |
| 287 | 321 | if (core) { |
| 288 | 322 | bus->drv_mips.core = core; |
| 289 | − bcma_core_mips_init(&bus->drv_mips); | |
| 323 | + bcma_core_mips_early_init(&bus->drv_mips); | |
| 290 | 324 | } |
| 291 | 325 | |
| 292 | 326 | bcma_info(bus, "Early bus registered\n"); |
| @@ -595,8 +595,11 @@ int bcma_sprom_get(struct bcma_bus *bus) · 594 unmodified lines | ||
| 595 | 595 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true); |
| 596 | 596 | |
| 597 | 597 | err = bcma_sprom_valid(sprom); |
| 598 | − if (err) | |
| 598 | + if (err) { | |
| 599 | + bcma_warn(bus, "invalid sprom read from the PCIe card, try to use fallback sprom\n"); | |
| 600 | + err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); | |
| 599 | 601 | goto out; |
| 602 | + } | |
| 600 | 603 | |
| 601 | 604 | bcma_sprom_extract_r8(bus, sprom); |
| 602 | 605 | |
| @@ -492,7 +492,7 @@ done: · 491 unmodified lines | ||
| 492 | 492 | static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) |
| 493 | 493 | { |
| 494 | 494 | u16 buf_len = 0; |
| 495 | − int ret, buf_block_len, blksz; | |
| 495 | + int ret, num_blocks, blksz; | |
| 496 | 496 | struct sk_buff *skb = NULL; |
| 497 | 497 | u32 type; |
| 498 | 498 | u8 *payload = NULL; |
| @@ -514,18 +514,17 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) · 15 unmodified lines | ||
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | blksz = SDIO_BLOCK_SIZE; |
| 517 | − buf_block_len = (buf_len + blksz - 1) / blksz; | |
| 517 | + num_blocks = DIV_ROUND_UP(buf_len, blksz); | |
| 518 | 518 | |
| 519 | 519 | if (buf_len <= SDIO_HEADER_LEN |
| 520 | − || (buf_block_len * blksz) > ALLOC_BUF_SIZE) { | |
| 520 | + || (num_blocks * blksz) > ALLOC_BUF_SIZE) { | |
| 521 | 521 | BT_ERR("invalid packet length: %d", buf_len); |
| 522 | 522 | ret = -EINVAL; |
| 523 | 523 | goto exit; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /* Allocate buffer */ |
| 527 | − skb = bt_skb_alloc(buf_block_len * blksz + BTSDIO_DMA_ALIGN, | |
| 528 | − GFP_ATOMIC); | |
| 527 | + skb = bt_skb_alloc(num_blocks * blksz + BTSDIO_DMA_ALIGN, GFP_ATOMIC); | |
| 529 | 528 | if (skb == NULL) { |
| 530 | 529 | BT_ERR("No free skb"); |
| 531 | 530 | goto exit; |
| @@ -541,7 +540,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) · 9 unmodified lines | ||
| 541 | 540 | payload = skb->data; |
| 542 | 541 | |
| 543 | 542 | ret = sdio_readsb(card->func, payload, card->ioport, |
| 544 | − buf_block_len * blksz); | |
| 543 | + num_blocks * blksz); | |
| 545 | 544 | if (ret < 0) { |
| 546 | 545 | BT_ERR("readsb failed: %d", ret); |
| 547 | 546 | ret = -EIO; |
| @@ -553,7 +552,16 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) · 5 unmodified lines | ||
| 553 | 552 | */ |
| 554 | 553 | |
| 555 | 554 | buf_len = payload[0]; |
| 556 | − buf_len |= (u16) payload[1] << 8; | |
| 555 | + buf_len |= payload[1] << 8; | |
| 556 | + buf_len |= payload[2] << 16; | |
| 557 | + | |
| 558 | + if (buf_len > blksz * num_blocks) { | |
| 559 | + BT_ERR("Skip incorrect packet: hdrlen %d buffer %d", | |
| 560 | + buf_len, blksz * num_blocks); | |
| 561 | + ret = -EIO; | |
| 562 | + goto exit; | |
| 563 | + } | |
| 564 | + | |
| 557 | 565 | type = payload[3]; |
| 558 | 566 | |
| 559 | 567 | switch (type) { |
| @@ -589,8 +597,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) · 29 unmodified lines | ||
| 589 | 597 | |
| 590 | 598 | default: |
| 591 | 599 | BT_ERR("Unknown packet type:%d", type); |
| 592 | − print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, payload, | |
| 593 | − blksz * buf_block_len); | |
| 600 | + BT_ERR("hex: %*ph", blksz * num_blocks, payload); | |
| 594 | 601 | |
| 595 | 602 | kfree_skb(skb); |
| 596 | 603 | skb = NULL; |
| @@ -849,8 +856,7 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv, · 252 unmodified lines | ||
| 849 | 856 | if (ret < 0) { |
| 850 | 857 | i++; |
| 851 | 858 | BT_ERR("i=%d writesb failed: %d", i, ret); |
| 852 | − print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, | |
| 853 | − payload, nb); | |
| 859 | + BT_ERR("hex: %*ph", nb, payload); | |
| 854 | 860 | ret = -EIO; |
| 855 | 861 | if (i > MAX_WRITE_IOMEM_RETRY) |
| 856 | 862 | goto exit; |
| @@ -96,6 +96,7 @@ static struct usb_device_id btusb_table[] = { · 95 unmodified lines | ||
| 96 | 96 | { USB_DEVICE(0x0c10, 0x0000) }, |
| 97 | 97 | |
| 98 | 98 | /* Broadcom BCM20702A0 */ |
| 99 | + { USB_DEVICE(0x0b05, 0x17b5) }, | |
| 99 | 100 | { USB_DEVICE(0x04ca, 0x2003) }, |
| 100 | 101 | { USB_DEVICE(0x0489, 0xe042) }, |
| 101 | 102 | { USB_DEVICE(0x413c, 0x8197) }, |
| @@ -604,6 +604,23 @@ static int ioat3_dca_count_dca_slots(void *iobase, u16 dca_offset) · 603 unmodified lines | ||
| 604 | 604 | return slots; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | +static inline int dca3_tag_map_invalid(u8 *tag_map) | |
| 608 | +{ | |
| 609 | + /* | |
| 610 | + * If the tag map is not programmed by the BIOS the default is: | |
| 611 | + * 0x80 0x80 0x80 0x80 0x80 0x00 0x00 0x00 | |
| 612 | + * | |
| 613 | + * This an invalid map and will result in only 2 possible tags | |
| 614 | + * 0x1F and 0x00. 0x00 is an invalid DCA tag so we know that | |
| 615 | + * this entire definition is invalid. | |
| 616 | + */ | |
| 617 | + return ((tag_map[0] == DCA_TAG_MAP_VALID) && | |
| 618 | + (tag_map[1] == DCA_TAG_MAP_VALID) && | |
| 619 | + (tag_map[2] == DCA_TAG_MAP_VALID) && | |
| 620 | + (tag_map[3] == DCA_TAG_MAP_VALID) && | |
| 621 | + (tag_map[4] == DCA_TAG_MAP_VALID)); | |
| 622 | +} | |
| 623 | + | |
| 607 | 624 | struct dca_provider * __devinit |
| 608 | 625 | ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase) |
| 609 | 626 | { |
| @@ -674,6 +691,12 @@ ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase) · 64 unmodified lines | ||
| 674 | 691 | ioatdca->tag_map[i] = bit & DCA_TAG_MAP_MASK; |
| 675 | 692 | } |
| 676 | 693 | |
| 694 | + if (dca3_tag_map_invalid(ioatdca->tag_map)) { | |
| 695 | + dev_err(&pdev->dev, "APICID_TAG_MAP set incorrectly by BIOS, disabling DCA\n"); | |
| 696 | + free_dca_provider(dca); | |
| 697 | + return NULL; | |
| 698 | + } | |
| 699 | + | |
| 677 | 700 | err = register_dca_provider(dca, &pdev->dev); |
| 678 | 701 | if (err) { |
| 679 | 702 | free_dca_provider(dca); |
| @@ -490,7 +490,7 @@ receive_dmsg(struct hfc_pci *hc) · 489 unmodified lines | ||
| 490 | 490 | (df->data[le16_to_cpu(zp->z1)])) { |
| 491 | 491 | if (dch->debug & DEBUG_HW) |
| 492 | 492 | printk(KERN_DEBUG |
| 493 | − "empty_fifo hfcpci paket inv. len " | |
| 493 | + "empty_fifo hfcpci packet inv. len " | |
| 494 | 494 | "%d or crc %d\n", |
| 495 | 495 | rcnt, |
| 496 | 496 | df->data[le16_to_cpu(zp->z1)]); |
| @@ -1302,7 +1302,7 @@ modeisar(struct isar_ch *ch, u32 bprotocol) · 1301 unmodified lines | ||
| 1302 | 1302 | &ch->is->Flags)) |
| 1303 | 1303 | ch->dpath = 1; |
| 1304 | 1304 | else { |
| 1305 | − pr_info("modeisar both pathes in use\n"); | |
| 1305 | + pr_info("modeisar both paths in use\n"); | |
| 1306 | 1306 | return -EBUSY; |
| 1307 | 1307 | } |
| 1308 | 1308 | if (bprotocol == ISDN_P_B_HDLC) |
| @@ -35,7 +35,7 @@ static int chancount; · 34 unmodified lines | ||
| 35 | 35 | /* experimental REJECT after ALERTING for CALLBACK to beat the 4s delay */ |
| 36 | 36 | #define ALERT_REJECT 0 |
| 37 | 37 | |
| 38 | −/* Value to delay the sending of the first B-channel paket after CONNECT | |
| 38 | +/* Value to delay the sending of the first B-channel packet after CONNECT | |
| 39 | 39 | * here is no value given by ITU, but experience shows that 300 ms will |
| 40 | 40 | * work on many networks, if you or your other side is behind local exchanges |
| 41 | 41 | * a greater value may be recommented. If the delay is to short the first paket |
| @@ -354,7 +354,7 @@ receive_dmsg(struct IsdnCardState *cs) · 353 unmodified lines | ||
| 354 | 354 | if ((rcnt > MAX_DFRAME_LEN + 3) || (rcnt < 4) || |
| 355 | 355 | (df->data[zp->z1])) { |
| 356 | 356 | if (cs->debug & L1_DEB_WARN) |
| 357 | − debugl1(cs, "empty_fifo hfcpci paket inv. len %d or crc %d", rcnt, df->data[zp->z1]); | |
| 357 | + debugl1(cs, "empty_fifo hfcpci packet inv. len %d or crc %d", rcnt, df->data[zp->z1]); | |
| 358 | 358 | #ifdef ERROR_STATISTIC |
| 359 | 359 | cs->err_rx++; |
| 360 | 360 | #endif |
| @@ -270,7 +270,7 @@ read_fifo(struct IsdnCardState *cs, u_char fifo, int trans_max) · 269 unmodified lines | ||
| 270 | 270 | |
| 271 | 271 | if ((count > fifo_size) || (count < 4)) { |
| 272 | 272 | if (cs->debug & L1_DEB_WARN) |
| 273 | − debugl1(cs, "hfcsx_read_fifo %d paket inv. len %d ", fifo , count); | |
| 273 | + debugl1(cs, "hfcsx_read_fifo %d packet inv. len %d ", fifo , count); | |
| 274 | 274 | while (count) { |
| 275 | 275 | count--; /* empty fifo */ |
| 276 | 276 | Read_hfc(cs, HFCSX_FIF_DRD); |
| @@ -277,7 +277,6 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, · 276 unmodified lines | ||
| 277 | 277 | u16 timebase, u8 *buf, int len) |
| 278 | 278 | { |
| 279 | 279 | u8 *p; |
| 280 | − int multi = 0; | |
| 281 | 280 | u8 frame[len + 32]; |
| 282 | 281 | struct socket *socket = NULL; |
| 283 | 282 | |
| @@ -317,9 +316,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, · 33 unmodified lines | ||
| 317 | 316 | *p++ = hc->id >> 8; |
| 318 | 317 | *p++ = hc->id; |
| 319 | 318 | } |
| 320 | − *p++ = (multi == 1) ? 0x80 : 0x00 + channel; /* m-flag, channel */ | |
| 321 | − if (multi == 1) | |
| 322 | − *p++ = len; /* length */ | |
| 319 | + *p++ = 0x00 + channel; /* m-flag, channel */ | |
| 323 | 320 | *p++ = timebase >> 8; /* time base */ |
| 324 | 321 | *p++ = timebase; |
| 325 | 322 | |
| @@ -250,7 +250,7 @@ tei_debug(struct FsmInst *fi, char *fmt, ...) · 249 unmodified lines | ||
| 250 | 250 | static int |
| 251 | 251 | get_free_id(struct manager *mgr) |
| 252 | 252 | { |
| 253 | − u64 ids = 0; | |
| 253 | + DECLARE_BITMAP(ids, 64) = { [0 ... BITS_TO_LONGS(64) - 1] = 0 }; | |
| 254 | 254 | int i; |
| 255 | 255 | struct layer2 *l2; |
| 256 | 256 | |
| @@ -261,11 +261,11 @@ get_free_id(struct manager *mgr) · 4 unmodified lines | ||
| 261 | 261 | __func__); |
| 262 | 262 | return -EBUSY; |
| 263 | 263 | } |
| 264 | − test_and_set_bit(l2->ch.nr, (u_long *)&ids); | |
| 264 | + __set_bit(l2->ch.nr, ids); | |
| 265 | 265 | } |
| 266 | − for (i = 1; i < 64; i++) | |
| 267 | − if (!test_bit(i, (u_long *)&ids)) | |
| 268 | − return i; | |
| 266 | + i = find_next_zero_bit(ids, 64, 1); | |
| 267 | + if (i < 64) | |
| 268 | + return i; | |
| 269 | 269 | printk(KERN_WARNING "%s: more as 63 layer2 for one device\n", |
| 270 | 270 | __func__); |
| 271 | 271 | return -EBUSY; |
| @@ -274,7 +274,7 @@ get_free_id(struct manager *mgr) · 2 unmodified lines | ||
| 274 | 274 | static int |
| 275 | 275 | get_free_tei(struct manager *mgr) |
| 276 | 276 | { |
| 277 | − u64 ids = 0; | |
| 277 | + DECLARE_BITMAP(ids, 64) = { [0 ... BITS_TO_LONGS(64) - 1] = 0 }; | |
| 278 | 278 | int i; |
| 279 | 279 | struct layer2 *l2; |
| 280 | 280 | |
| @@ -288,11 +288,11 @@ get_free_tei(struct manager *mgr) · 7 unmodified lines | ||
| 288 | 288 | continue; |
| 289 | 289 | i -= 64; |
| 290 | 290 | |
| 291 | − test_and_set_bit(i, (u_long *)&ids); | |
| 291 | + __set_bit(i, ids); | |
| 292 | 292 | } |
| 293 | − for (i = 0; i < 64; i++) | |
| 294 | − if (!test_bit(i, (u_long *)&ids)) | |
| 295 | − return i + 64; | |
| 293 | + i = find_first_zero_bit(ids, 64); | |
| 294 | + if (i < 64) | |
| 295 | + return i + 64; | |
| 296 | 296 | printk(KERN_WARNING "%s: more as 63 dynamic tei for one device\n", |
| 297 | 297 | __func__); |
| 298 | 298 | return -1; |
| @@ -508,7 +508,7 @@ pcbit_irq_handler(int interrupt, void *devptr) · 507 unmodified lines | ||
| 508 | 508 | return IRQ_NONE; |
| 509 | 509 | } |
| 510 | 510 | if (dev->interrupt) { |
| 511 | − printk(KERN_DEBUG "pcbit: reentering interrupt hander\n"); | |
| 511 | + printk(KERN_DEBUG "pcbit: reentering interrupt handler\n"); | |
| 512 | 512 | return IRQ_HANDLED; |
| 513 | 513 | } |
| 514 | 514 | dev->interrupt = 1; |
| @@ -61,7 +61,7 @@ module_param(clockp, int, 0); · 60 unmodified lines | ||
| 61 | 61 | module_param(clockm, int, 0); |
| 62 | 62 | MODULE_LICENSE("GPL"); |
| 63 | 63 | |
| 64 | −static int __devinit com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |
| 64 | +static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |
| 65 | 65 | { |
| 66 | 66 | struct net_device *dev; |
| 67 | 67 | struct arcnet_local *lp; |
| @@ -135,7 +135,7 @@ out_dev: · 67 unmodified lines | ||
| 135 | 135 | return err; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | −static void __devexit com20020pci_remove(struct pci_dev *pdev) | |
| 138 | +static void com20020pci_remove(struct pci_dev *pdev) | |
| 139 | 139 | { |
| 140 | 140 | struct net_device *dev = pci_get_drvdata(pdev); |
| 141 | 141 | unregister_netdev(dev); |
| @@ -178,7 +178,7 @@ static struct pci_driver com20020pci_driver = { · 36 unmodified lines | ||
| 178 | 178 | .name = "com20020", |
| 179 | 179 | .id_table = com20020pci_id_table, |
| 180 | 180 | .probe = com20020pci_probe, |
| 181 | − .remove = __devexit_p(com20020pci_remove), | |
| 181 | + .remove = com20020pci_remove, | |
| 182 | 182 | }; |
| 183 | 183 | |
| 184 | 184 | static int __init com20020pci_init(void) |
| @@ -84,6 +84,10 @@ static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb) · 83 unmodified lines | ||
| 84 | 84 | |
| 85 | 85 | /* Forward declaration */ |
| 86 | 86 | static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); |
| 87 | +static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp); | |
| 88 | +static void rlb_src_unlink(struct bonding *bond, u32 index); | |
| 89 | +static void rlb_src_link(struct bonding *bond, u32 ip_src_hash, | |
| 90 | + u32 ip_dst_hash); | |
| 87 | 91 | |
| 88 | 92 | static inline u8 _simple_hash(const u8 *hash_start, int hash_size) |
| 89 | 93 | { |
| @@ -354,6 +358,18 @@ static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond, · 264 unmodified lines | ||
| 354 | 358 | if (!arp) |
| 355 | 359 | goto out; |
| 356 | 360 | |
| 361 | + /* We received an ARP from arp->ip_src. | |
| 362 | + * We might have used this IP address previously (on the bonding host | |
| 363 | + * itself or on a system that is bridged together with the bond). | |
| 364 | + * However, if arp->mac_src is different than what is stored in | |
| 365 | + * rx_hashtbl, some other host is now using the IP and we must prevent | |
| 366 | + * sending out client updates with this IP address and the old MAC | |
| 367 | + * address. | |
| 368 | + * Clean up all hash table entries that have this address as ip_src but | |
| 369 | + * have a different mac_src. | |
| 370 | + */ | |
| 371 | + rlb_purge_src_ip(bond, arp); | |
| 372 | + | |
| 357 | 373 | if (arp->op_code == htons(ARPOP_REPLY)) { |
| 358 | 374 | /* update rx hash table for this ARP */ |
| 359 | 375 | rlb_update_entry_from_arp(bond, arp); |
| @@ -432,9 +448,9 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave) · 72 unmodified lines | ||
| 432 | 448 | _lock_rx_hashtbl_bh(bond); |
| 433 | 449 | |
| 434 | 450 | rx_hash_table = bond_info->rx_hashtbl; |
| 435 | − index = bond_info->rx_hashtbl_head; | |
| 451 | + index = bond_info->rx_hashtbl_used_head; | |
| 436 | 452 | for (; index != RLB_NULL_INDEX; index = next_index) { |
| 437 | − next_index = rx_hash_table[index].next; | |
| 453 | + next_index = rx_hash_table[index].used_next; | |
| 438 | 454 | if (rx_hash_table[index].slave == slave) { |
| 439 | 455 | struct slave *assigned_slave = rlb_next_rx_slave(bond); |
| 440 | 456 | |
| @@ -519,8 +535,9 @@ static void rlb_update_rx_clients(struct bonding *bond) · 78 unmodified lines | ||
| 519 | 535 | |
| 520 | 536 | _lock_rx_hashtbl_bh(bond); |
| 521 | 537 | |
| 522 | − hash_index = bond_info->rx_hashtbl_head; | |
| 523 | − for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) { | |
| 538 | + hash_index = bond_info->rx_hashtbl_used_head; | |
| 539 | + for (; hash_index != RLB_NULL_INDEX; | |
| 540 | + hash_index = client_info->used_next) { | |
| 524 | 541 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
| 525 | 542 | if (client_info->ntt) { |
| 526 | 543 | rlb_update_client(client_info); |
| @@ -548,8 +565,9 @@ static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *sla · 21 unmodified lines | ||
| 548 | 565 | |
| 549 | 566 | _lock_rx_hashtbl_bh(bond); |
| 550 | 567 | |
| 551 | − hash_index = bond_info->rx_hashtbl_head; | |
| 552 | − for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) { | |
| 568 | + hash_index = bond_info->rx_hashtbl_used_head; | |
| 569 | + for (; hash_index != RLB_NULL_INDEX; | |
| 570 | + hash_index = client_info->used_next) { | |
| 553 | 571 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
| 554 | 572 | |
| 555 | 573 | if ((client_info->slave == slave) && |
| @@ -578,8 +596,9 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) · 22 unmodified lines | ||
| 578 | 596 | |
| 579 | 597 | _lock_rx_hashtbl(bond); |
| 580 | 598 | |
| 581 | − hash_index = bond_info->rx_hashtbl_head; | |
| 582 | − for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) { | |
| 599 | + hash_index = bond_info->rx_hashtbl_used_head; | |
| 600 | + for (; hash_index != RLB_NULL_INDEX; | |
| 601 | + hash_index = client_info->used_next) { | |
| 583 | 602 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
| 584 | 603 | |
| 585 | 604 | if (!client_info->slave) { |
| @@ -625,6 +644,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon · 39 unmodified lines | ||
| 625 | 644 | /* update mac address from arp */ |
| 626 | 645 | memcpy(client_info->mac_dst, arp->mac_dst, ETH_ALEN); |
| 627 | 646 | } |
| 647 | + memcpy(client_info->mac_src, arp->mac_src, ETH_ALEN); | |
| 628 | 648 | |
| 629 | 649 | assigned_slave = client_info->slave; |
| 630 | 650 | if (assigned_slave) { |
| @@ -647,6 +667,17 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon · 16 unmodified lines | ||
| 647 | 667 | assigned_slave = rlb_next_rx_slave(bond); |
| 648 | 668 | |
| 649 | 669 | if (assigned_slave) { |
| 670 | + if (!(client_info->assigned && | |
| 671 | + client_info->ip_src == arp->ip_src)) { | |
| 672 | + /* ip_src is going to be updated, | |
| 673 | + * fix the src hash list | |
| 674 | + */ | |
| 675 | + u32 hash_src = _simple_hash((u8 *)&arp->ip_src, | |
| 676 | + sizeof(arp->ip_src)); | |
| 677 | + rlb_src_unlink(bond, hash_index); | |
| 678 | + rlb_src_link(bond, hash_src, hash_index); | |
| 679 | + } | |
| 680 | + | |
| 650 | 681 | client_info->ip_src = arp->ip_src; |
| 651 | 682 | client_info->ip_dst = arp->ip_dst; |
| 652 | 683 | /* arp->mac_dst is broadcast for arp reqeusts. |
| @@ -654,6 +685,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon · 1 unmodified line | ||
| 654 | 685 | * upon receiving an arp reply. |
| 655 | 686 | */ |
| 656 | 687 | memcpy(client_info->mac_dst, arp->mac_dst, ETH_ALEN); |
| 688 | + memcpy(client_info->mac_src, arp->mac_src, ETH_ALEN); | |
| 657 | 689 | client_info->slave = assigned_slave; |
| 658 | 690 | |
| 659 | 691 | if (!ether_addr_equal_64bits(client_info->mac_dst, mac_bcast)) { |
| @@ -669,11 +701,11 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon · 9 unmodified lines | ||
| 669 | 701 | } |
| 670 | 702 | |
| 671 | 703 | if (!client_info->assigned) { |
| 672 | − u32 prev_tbl_head = bond_info->rx_hashtbl_head; | |
| 673 | − bond_info->rx_hashtbl_head = hash_index; | |
| 674 | − client_info->next = prev_tbl_head; | |
| 704 | + u32 prev_tbl_head = bond_info->rx_hashtbl_used_head; | |
| 705 | + bond_info->rx_hashtbl_used_head = hash_index; | |
| 706 | + client_info->used_next = prev_tbl_head; | |
| 675 | 707 | if (prev_tbl_head != RLB_NULL_INDEX) { |
| 676 | − bond_info->rx_hashtbl[prev_tbl_head].prev = | |
| 708 | + bond_info->rx_hashtbl[prev_tbl_head].used_prev = | |
| 677 | 709 | hash_index; |
| 678 | 710 | } |
| 679 | 711 | client_info->assigned = 1; |
| @@ -694,6 +726,12 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) · 14 unmodified lines | ||
| 694 | 726 | struct arp_pkt *arp = arp_pkt(skb); |
| 695 | 727 | struct slave *tx_slave = NULL; |
| 696 | 728 | |
| 729 | + /* Don't modify or load balance ARPs that do not originate locally | |
| 730 | + * (e.g.,arrive via a bridge). | |
| 731 | + */ | |
| 732 | + if (!bond_slave_has_mac(bond, arp->mac_src)) | |
| 733 | + return NULL; | |
| 734 | + | |
| 697 | 735 | if (arp->op_code == htons(ARPOP_REPLY)) { |
| 698 | 736 | /* the arp must be sent on the selected |
| 699 | 737 | * rx channel |
| @@ -740,8 +778,9 @@ static void rlb_rebalance(struct bonding *bond) · 40 unmodified lines | ||
| 740 | 778 | _lock_rx_hashtbl_bh(bond); |
| 741 | 779 | |
| 742 | 780 | ntt = 0; |
| 743 | − hash_index = bond_info->rx_hashtbl_head; | |
| 744 | − for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) { | |
| 781 | + hash_index = bond_info->rx_hashtbl_used_head; | |
| 782 | + for (; hash_index != RLB_NULL_INDEX; | |
| 783 | + hash_index = client_info->used_next) { | |
| 745 | 784 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
| 746 | 785 | assigned_slave = rlb_next_rx_slave(bond); |
| 747 | 786 | if (assigned_slave && (client_info->slave != assigned_slave)) { |
| @@ -759,11 +798,113 @@ static void rlb_rebalance(struct bonding *bond) · 11 unmodified lines | ||
| 759 | 798 | } |
| 760 | 799 | |
| 761 | 800 | /* Caller must hold rx_hashtbl lock */ |
| 801 | +static void rlb_init_table_entry_dst(struct rlb_client_info *entry) | |
| 802 | +{ | |
| 803 | + entry->used_next = RLB_NULL_INDEX; | |
| 804 | + entry->used_prev = RLB_NULL_INDEX; | |
| 805 | + entry->assigned = 0; | |
| 806 | + entry->slave = NULL; | |
| 807 | + entry->tag = 0; | |
| 808 | +} | |
| 809 | +static void rlb_init_table_entry_src(struct rlb_client_info *entry) | |
| 810 | +{ | |
| 811 | + entry->src_first = RLB_NULL_INDEX; | |
| 812 | + entry->src_prev = RLB_NULL_INDEX; | |
| 813 | + entry->src_next = RLB_NULL_INDEX; | |
| 814 | +} | |
| 815 | + | |
| 762 | 816 | static void rlb_init_table_entry(struct rlb_client_info *entry) |
| 763 | 817 | { |
| 764 | 818 | memset(entry, 0, sizeof(struct rlb_client_info)); |
| 765 | − entry->next = RLB_NULL_INDEX; | |
| 766 | − entry->prev = RLB_NULL_INDEX; | |
| 819 | + rlb_init_table_entry_dst(entry); | |
| 820 | + rlb_init_table_entry_src(entry); | |
| 821 | +} | |
| 822 | + | |
| 823 | +static void rlb_delete_table_entry_dst(struct bonding *bond, u32 index) | |
| 824 | +{ | |
| 825 | + struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | |
| 826 | + u32 next_index = bond_info->rx_hashtbl[index].used_next; | |
| 827 | + u32 prev_index = bond_info->rx_hashtbl[index].used_prev; | |
| 828 | + | |
| 829 | + if (index == bond_info->rx_hashtbl_used_head) | |
| 830 | + bond_info->rx_hashtbl_used_head = next_index; | |
| 831 | + if (prev_index != RLB_NULL_INDEX) | |
| 832 | + bond_info->rx_hashtbl[prev_index].used_next = next_index; | |
| 833 | + if (next_index != RLB_NULL_INDEX) | |
| 834 | + bond_info->rx_hashtbl[next_index].used_prev = prev_index; | |
| 835 | +} | |
| 836 | + | |
| 837 | +/* unlink a rlb hash table entry from the src list */ | |
| 838 | +static void rlb_src_unlink(struct bonding *bond, u32 index) | |
| 839 | +{ | |
| 840 | + struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | |
| 841 | + u32 next_index = bond_info->rx_hashtbl[index].src_next; | |
| 842 | + u32 prev_index = bond_info->rx_hashtbl[index].src_prev; | |
| 843 | + | |
| 844 | + bond_info->rx_hashtbl[index].src_next = RLB_NULL_INDEX; | |
| 845 | + bond_info->rx_hashtbl[index].src_prev = RLB_NULL_INDEX; | |
| 846 | + | |
| 847 | + if (next_index != RLB_NULL_INDEX) | |
| 848 | + bond_info->rx_hashtbl[next_index].src_prev = prev_index; | |
| 849 | + | |
| 850 | + if (prev_index == RLB_NULL_INDEX) | |
| 851 | + return; | |
| 852 | + | |
| 853 | + /* is prev_index pointing to the head of this list? */ | |
| 854 | + if (bond_info->rx_hashtbl[prev_index].src_first == index) | |
| 855 | + bond_info->rx_hashtbl[prev_index].src_first = next_index; | |
| 856 | + else | |
| 857 | + bond_info->rx_hashtbl[prev_index].src_next = next_index; | |
| 858 | + | |
| 859 | +} | |
| 860 | + | |
| 861 | +static void rlb_delete_table_entry(struct bonding *bond, u32 index) | |
| 862 | +{ | |
| 863 | + struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | |
| 864 | + struct rlb_client_info *entry = &(bond_info->rx_hashtbl[index]); | |
| 865 | + | |
| 866 | + rlb_delete_table_entry_dst(bond, index); | |
| 867 | + rlb_init_table_entry_dst(entry); | |
| 868 | + | |
| 869 | + rlb_src_unlink(bond, index); | |
| 870 | +} | |
| 871 | + | |
| 872 | +/* add the rx_hashtbl[ip_dst_hash] entry to the list | |
| 873 | + * of entries with identical ip_src_hash | |
| 874 | + */ | |
| 875 | +static void rlb_src_link(struct bonding *bond, u32 ip_src_hash, u32 ip_dst_hash) | |
| 876 | +{ | |
| 877 | + struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | |
| 878 | + u32 next; | |
| 879 | + | |
| 880 | + bond_info->rx_hashtbl[ip_dst_hash].src_prev = ip_src_hash; | |
| 881 | + next = bond_info->rx_hashtbl[ip_src_hash].src_first; | |
| 882 | + bond_info->rx_hashtbl[ip_dst_hash].src_next = next; | |
| 883 | + if (next != RLB_NULL_INDEX) | |
| 884 | + bond_info->rx_hashtbl[next].src_prev = ip_dst_hash; | |
| 885 | + bond_info->rx_hashtbl[ip_src_hash].src_first = ip_dst_hash; | |
| 886 | +} | |
| 887 | + | |
| 888 | +/* deletes all rx_hashtbl entries with arp->ip_src if their mac_src does | |
| 889 | + * not match arp->mac_src */ | |
| 890 | +static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp) | |
| 891 | +{ | |
| 892 | + struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | |
| 893 | + u32 ip_src_hash = _simple_hash((u8*)&(arp->ip_src), sizeof(arp->ip_src)); | |
| 894 | + u32 index; | |
| 895 | + | |
| 896 | + _lock_rx_hashtbl_bh(bond); | |
| 897 | + | |
| 898 | + index = bond_info->rx_hashtbl[ip_src_hash].src_first; | |
| 899 | + while (index != RLB_NULL_INDEX) { | |
| 900 | + struct rlb_client_info *entry = &(bond_info->rx_hashtbl[index]); | |
| 901 | + u32 next_index = entry->src_next; | |
| 902 | + if (entry->ip_src == arp->ip_src && | |
| 903 | + !ether_addr_equal_64bits(arp->mac_src, entry->mac_src)) | |
| 904 | + rlb_delete_table_entry(bond, index); | |
| 905 | + index = next_index; | |
| 906 | + } | |
| 907 | + _unlock_rx_hashtbl_bh(bond); | |
| 767 | 908 | } |
| 768 | 909 | |
| 769 | 910 | static int rlb_initialize(struct bonding *bond) |
| @@ -781,7 +922,7 @@ static int rlb_initialize(struct bonding *bond) · 11 unmodified lines | ||
| 781 | 922 | |
| 782 | 923 | bond_info->rx_hashtbl = new_hashtbl; |
| 783 | 924 | |
| 784 | − bond_info->rx_hashtbl_head = RLB_NULL_INDEX; | |
| 925 | + bond_info->rx_hashtbl_used_head = RLB_NULL_INDEX; | |
| 785 | 926 | |
| 786 | 927 | for (i = 0; i < RLB_HASH_TABLE_SIZE; i++) { |
| 787 | 928 | rlb_init_table_entry(bond_info->rx_hashtbl + i); |
| @@ -803,7 +944,7 @@ static void rlb_deinitialize(struct bonding *bond) · 15 unmodified lines | ||
| 803 | 944 | |
| 804 | 945 | kfree(bond_info->rx_hashtbl); |
| 805 | 946 | bond_info->rx_hashtbl = NULL; |
| 806 | − bond_info->rx_hashtbl_head = RLB_NULL_INDEX; | |
| 947 | + bond_info->rx_hashtbl_used_head = RLB_NULL_INDEX; | |
| 807 | 948 | |
| 808 | 949 | _unlock_rx_hashtbl_bh(bond); |
| 809 | 950 | } |
| @@ -815,25 +956,13 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id) · 5 unmodified lines | ||
| 815 | 956 | |
| 816 | 957 | _lock_rx_hashtbl_bh(bond); |
| 817 | 958 | |
| 818 | − curr_index = bond_info->rx_hashtbl_head; | |
| 959 | + curr_index = bond_info->rx_hashtbl_used_head; | |
| 819 | 960 | while (curr_index != RLB_NULL_INDEX) { |
| 820 | 961 | struct rlb_client_info *curr = &(bond_info->rx_hashtbl[curr_index]); |
| 821 | − u32 next_index = bond_info->rx_hashtbl[curr_index].next; | |
| 822 | − u32 prev_index = bond_info->rx_hashtbl[curr_index].prev; | |
| 823 | − | |
| 824 | − if (curr->tag && (curr->vlan_id == vlan_id)) { | |
| 825 | − if (curr_index == bond_info->rx_hashtbl_head) { | |
| 826 | − bond_info->rx_hashtbl_head = next_index; | |
| 827 | − } | |
| 828 | − if (prev_index != RLB_NULL_INDEX) { | |
| 829 | − bond_info->rx_hashtbl[prev_index].next = next_index; | |
| 830 | − } | |
| 831 | − if (next_index != RLB_NULL_INDEX) { | |
| 832 | − bond_info->rx_hashtbl[next_index].prev = prev_index; | |
| 833 | − } | |
| 962 | + u32 next_index = bond_info->rx_hashtbl[curr_index].used_next; | |
| 834 | 963 | |
| 835 | − rlb_init_table_entry(curr); | |
| 836 | − } | |
| 964 | + if (curr->tag && (curr->vlan_id == vlan_id)) | |
| 965 | + rlb_delete_table_entry(bond, curr_index); | |
| 837 | 966 | |
| 838 | 967 | curr_index = next_index; |
| 839 | 968 | } |
| @@ -94,15 +94,35 @@ struct tlb_client_info { · 93 unmodified lines | ||
| 94 | 94 | |
| 95 | 95 | /* ------------------------------------------------------------------------- |
| 96 | 96 | * struct rlb_client_info contains all info related to a specific rx client |
| 97 | − * connection. This is the Clients Hash Table entry struct | |
| 97 | + * connection. This is the Clients Hash Table entry struct. | |
| 98 | + * Note that this is not a proper hash table; if a new client's IP address | |
| 99 | + * hash collides with an existing client entry, the old entry is replaced. | |
| 100 | + * | |
| 101 | + * There is a linked list (linked by the used_next and used_prev members) | |
| 102 | + * linking all the used entries of the hash table. This allows updating | |
| 103 | + * all the clients without walking over all the unused elements of the table. | |
| 104 | + * | |
| 105 | + * There are also linked lists of entries with identical hash(ip_src). These | |
| 106 | + * allow cleaning up the table from ip_src<->mac_src associations that have | |
| 107 | + * become outdated and would cause sending out invalid ARP updates to the | |
| 108 | + * network. These are linked by the (src_next and src_prev members). | |
| 98 | 109 | * ------------------------------------------------------------------------- |
| 99 | 110 | */ |
| 100 | 111 | struct rlb_client_info { |
| 101 | 112 | __be32 ip_src; /* the server IP address */ |
| 102 | 113 | __be32 ip_dst; /* the client IP address */ |
| 114 | + u8 mac_src[ETH_ALEN]; /* the server MAC address */ | |
| 103 | 115 | u8 mac_dst[ETH_ALEN]; /* the client MAC address */ |
| 104 | − u32 next; /* The next Hash table entry index */ | |
| 105 | − u32 prev; /* The previous Hash table entry index */ | |
| 116 | + | |
| 117 | + /* list of used hash table entries, starting at rx_hashtbl_used_head */ | |
| 118 | + u32 used_next; | |
| 119 | + u32 used_prev; | |
| 120 | + | |
| 121 | + /* ip_src based hashing */ | |
| 122 | + u32 src_next; /* next entry with same hash(ip_src) */ | |
| 123 | + u32 src_prev; /* prev entry with same hash(ip_src) */ | |
| 124 | + u32 src_first; /* first entry with hash(ip_src) == this entry's index */ | |
| 125 | + | |
| 106 | 126 | u8 assigned; /* checking whether this entry is assigned */ |
| 107 | 127 | u8 ntt; /* flag - need to transmit client info */ |
| 108 | 128 | struct slave *slave; /* the slave assigned to this client */ |
| @@ -131,7 +151,7 @@ struct alb_bond_info { · 22 unmodified lines | ||
| 131 | 151 | int rlb_enabled; |
| 132 | 152 | struct rlb_client_info *rx_hashtbl; /* Receive hash table */ |
| 133 | 153 | spinlock_t rx_hashtbl_lock; |
| 134 | − u32 rx_hashtbl_head; | |
| 154 | + u32 rx_hashtbl_used_head; | |
| 135 | 155 | u8 rx_ntt; /* flag - need to transmit |
| 136 | 156 | * to all rx clients |
| 137 | 157 | */ |
| @@ -31,8 +31,9 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v) · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | spin_lock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); |
| 33 | 33 | |
| 34 | − hash_index = bond_info->rx_hashtbl_head; | |
| 35 | − for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) { | |
| 34 | + hash_index = bond_info->rx_hashtbl_used_head; | |
| 35 | + for (; hash_index != RLB_NULL_INDEX; | |
| 36 | + hash_index = client_info->used_next) { | |
| 36 | 37 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
| 37 | 38 | seq_printf(m, "%-15pI4 %-15pI4 %-17pM %s\n", |
| 38 | 39 | &client_info->ip_src, |
| @@ -615,15 +615,9 @@ static int bond_check_dev_link(struct bonding *bond, · 614 unmodified lines | ||
| 615 | 615 | return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0; |
| 616 | 616 | |
| 617 | 617 | /* Try to get link status using Ethtool first. */ |
| 618 | − if (slave_dev->ethtool_ops) { | |
| 619 | − if (slave_dev->ethtool_ops->get_link) { | |
| 620 | − u32 link; | |
| 621 | − | |
| 622 | − link = slave_dev->ethtool_ops->get_link(slave_dev); | |
| 623 | − | |
| 624 | − return link ? BMSR_LSTATUS : 0; | |
| 625 | − } | |
| 626 | − } | |
| 618 | + if (slave_dev->ethtool_ops->get_link) | |
| 619 | + return slave_dev->ethtool_ops->get_link(slave_dev) ? | |
| 620 | + BMSR_LSTATUS : 0; | |
| 627 | 621 | |
| 628 | 622 | /* Ethtool can't be used, fallback to MII ioctls. */ |
| 629 | 623 | ioctl = slave_ops->ndo_do_ioctl; |
| @@ -1510,8 +1504,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 880 unmodified lines | ||
| 1510 | 1504 | int link_reporting; |
| 1511 | 1505 | int res = 0; |
| 1512 | 1506 | |
| 1513 | − if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && | |
| 1514 | − slave_ops->ndo_do_ioctl == NULL) { | |
| 1507 | + if (!bond->params.use_carrier && | |
| 1508 | + slave_dev->ethtool_ops->get_link == NULL && | |
| 1509 | + slave_ops->ndo_do_ioctl == NULL) { | |
| 1515 | 1510 | pr_warning("%s: Warning: no link monitoring support for %s\n", |
| 1516 | 1511 | bond_dev->name, slave_dev->name); |
| 1517 | 1512 | } |
| @@ -1838,7 +1833,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 320 unmodified lines | ||
| 1838 | 1833 | * anyway (it holds no special properties of the bond device), |
| 1839 | 1834 | * so we can change it without calling change_active_interface() |
| 1840 | 1835 | */ |
| 1841 | − if (!bond->curr_active_slave) | |
| 1836 | + if (!bond->curr_active_slave && new_slave->link == BOND_LINK_UP) | |
| 1842 | 1837 | bond->curr_active_slave = new_slave; |
| 1843 | 1838 | |
| 1844 | 1839 | break; |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/in6.h> |
| 23 | 23 | #include <linux/netpoll.h> |
| 24 | 24 | #include <linux/inetdevice.h> |
| 25 | +#include <linux/etherdevice.h> | |
| 25 | 26 | #include "bond_3ad.h" |
| 26 | 27 | #include "bond_alb.h" |
| 27 | 28 | |
| @@ -450,6 +451,18 @@ static inline void bond_destroy_proc_dir(struct bond_net *bn) · 422 unmodified lines | ||
| 450 | 451 | } |
| 451 | 452 | #endif |
| 452 | 453 | |
| 454 | +static inline struct slave *bond_slave_has_mac(struct bonding *bond, | |
| 455 | + const u8 *mac) | |
| 456 | +{ | |
| 457 | + int i = 0; | |
| 458 | + struct slave *tmp; | |
| 459 | + | |
| 460 | + bond_for_each_slave(bond, tmp, i) | |
| 461 | + if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) | |
| 462 | + return tmp; | |
| 463 | + | |
| 464 | + return NULL; | |
| 465 | +} | |
| 453 | 466 | |
| 454 | 467 | /* exported from bond_main.c */ |
| 455 | 468 | extern int bond_net_id; |
| @@ -110,6 +110,15 @@ config PCH_CAN · 109 unmodified lines | ||
| 110 | 110 | is an IOH for x86 embedded processor (Intel Atom E6xx series). |
| 111 | 111 | This driver can access CAN bus. |
| 112 | 112 | |
| 113 | +config CAN_GRCAN | |
| 114 | + tristate "Aeroflex Gaisler GRCAN and GRHCAN CAN devices" | |
| 115 | + depends on CAN_DEV && OF | |
| 116 | + ---help--- | |
| 117 | + Say Y here if you want to use Aeroflex Gaisler GRCAN or GRHCAN. | |
| 118 | + Note that the driver supports little endian, even though little | |
| 119 | + endian syntheses of the cores would need some modifications on | |
| 120 | + the hardware level to work. | |
| 121 | + | |
| 113 | 122 | source "drivers/net/can/mscan/Kconfig" |
| 114 | 123 | |
| 115 | 124 | source "drivers/net/can/sja1000/Kconfig" |
| @@ -22,5 +22,6 @@ obj-$(CONFIG_CAN_BFIN) += bfin_can.o · 21 unmodified lines | ||
| 22 | 22 | obj-$(CONFIG_CAN_JANZ_ICAN3) += janz-ican3.o |
| 23 | 23 | obj-$(CONFIG_CAN_FLEXCAN) += flexcan.o |
| 24 | 24 | obj-$(CONFIG_PCH_CAN) += pch_can.o |
| 25 | +obj-$(CONFIG_CAN_GRCAN) += grcan.o | |
| 25 | 26 | |
| 26 | 27 | ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG |
| @@ -154,7 +154,7 @@ struct at91_priv { · 153 unmodified lines | ||
| 154 | 154 | canid_t mb0_id; |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | −static const struct at91_devtype_data at91_devtype_data[] __devinitconst = { | |
| 157 | +static const struct at91_devtype_data at91_devtype_data[] = { | |
| 158 | 158 | [AT91_DEVTYPE_SAM9263] = { |
| 159 | 159 | .rx_first = 1, |
| 160 | 160 | .rx_split = 8, |
| @@ -1241,7 +1241,7 @@ static struct attribute_group at91_sysfs_attr_group = { · 1080 unmodified lines | ||
| 1241 | 1241 | .attrs = at91_sysfs_attrs, |
| 1242 | 1242 | }; |
| 1243 | 1243 | |
| 1244 | −static int __devinit at91_can_probe(struct platform_device *pdev) | |
| 1244 | +static int at91_can_probe(struct platform_device *pdev) | |
| 1245 | 1245 | { |
| 1246 | 1246 | const struct at91_devtype_data *devtype_data; |
| 1247 | 1247 | enum at91_devtype devtype; |
| @@ -1338,7 +1338,7 @@ static int __devinit at91_can_probe(struct platform_device *pdev) · 90 unmodified lines | ||
| 1338 | 1338 | return err; |
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | −static int __devexit at91_can_remove(struct platform_device *pdev) | |
| 1341 | +static int at91_can_remove(struct platform_device *pdev) | |
| 1342 | 1342 | { |
| 1343 | 1343 | struct net_device *dev = platform_get_drvdata(pdev); |
| 1344 | 1344 | struct at91_priv *priv = netdev_priv(dev); |
| @@ -1371,10 +1371,11 @@ static const struct platform_device_id at91_can_id_table[] = { · 26 unmodified lines | ||
| 1371 | 1371 | /* sentinel */ |
| 1372 | 1372 | } |
| 1373 | 1373 | }; |
| 1374 | +MODULE_DEVICE_TABLE(platform, at91_can_id_table); | |
| 1374 | 1375 | |
| 1375 | 1376 | static struct platform_driver at91_can_driver = { |
| 1376 | 1377 | .probe = at91_can_probe, |
| 1377 | − .remove = __devexit_p(at91_can_remove), | |
| 1378 | + .remove = at91_can_remove, | |
| 1378 | 1379 | .driver = { |
| 1379 | 1380 | .name = KBUILD_MODNAME, |
| 1380 | 1381 | .owner = THIS_MODULE, |
| @@ -531,7 +531,7 @@ static const struct net_device_ops bfin_can_netdev_ops = { · 530 unmodified lines | ||
| 531 | 531 | .ndo_start_xmit = bfin_can_start_xmit, |
| 532 | 532 | }; |
| 533 | 533 | |
| 534 | −static int __devinit bfin_can_probe(struct platform_device *pdev) | |
| 534 | +static int bfin_can_probe(struct platform_device *pdev) | |
| 535 | 535 | { |
| 536 | 536 | int err; |
| 537 | 537 | struct net_device *dev; |
| @@ -611,7 +611,7 @@ exit: · 73 unmodified lines | ||
| 611 | 611 | return err; |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | −static int __devexit bfin_can_remove(struct platform_device *pdev) | |
| 614 | +static int bfin_can_remove(struct platform_device *pdev) | |
| 615 | 615 | { |
| 616 | 616 | struct net_device *dev = dev_get_drvdata(&pdev->dev); |
| 617 | 617 | struct bfin_can_priv *priv = netdev_priv(dev); |
| @@ -677,7 +677,7 @@ static int bfin_can_resume(struct platform_device *pdev) · 59 unmodified lines | ||
| 677 | 677 | |
| 678 | 678 | static struct platform_driver bfin_can_driver = { |
| 679 | 679 | .probe = bfin_can_probe, |
| 680 | − .remove = __devexit_p(bfin_can_remove), | |
| 680 | + .remove = bfin_can_remove, | |
| 681 | 681 | .suspend = bfin_can_suspend, |
| 682 | 682 | .resume = bfin_can_resume, |
| 683 | 683 | .driver = { |
| @@ -691,3 +691,4 @@ module_platform_driver(bfin_can_driver); · 7 unmodified lines | ||
| 691 | 691 | MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); |
| 692 | 692 | MODULE_LICENSE("GPL"); |
| 693 | 693 | MODULE_DESCRIPTION("Blackfin on-chip CAN netdevice driver"); |
| 694 | +MODULE_ALIAS("platform:" DRV_NAME); | |
| @@ -233,6 +233,12 @@ static inline void c_can_pm_runtime_put_sync(const struct c_can_priv *priv) · 232 unmodified lines | ||
| 233 | 233 | pm_runtime_put_sync(priv->device); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | +static inline void c_can_reset_ram(const struct c_can_priv *priv, bool enable) | |
| 237 | +{ | |
| 238 | + if (priv->raminit) | |
| 239 | + priv->raminit(priv, enable); | |
| 240 | +} | |
| 241 | + | |
| 236 | 242 | static inline int get_tx_next_msg_obj(const struct c_can_priv *priv) |
| 237 | 243 | { |
| 238 | 244 | return (priv->tx_next & C_CAN_NEXT_MSG_OBJ_MASK) + |
| @@ -1090,6 +1096,7 @@ static int c_can_open(struct net_device *dev) · 851 unmodified lines | ||
| 1090 | 1096 | struct c_can_priv *priv = netdev_priv(dev); |
| 1091 | 1097 | |
| 1092 | 1098 | c_can_pm_runtime_get_sync(priv); |
| 1099 | + c_can_reset_ram(priv, true); | |
| 1093 | 1100 | |
| 1094 | 1101 | /* open the can device */ |
| 1095 | 1102 | err = open_candev(dev); |
| @@ -1118,6 +1125,7 @@ static int c_can_open(struct net_device *dev) · 22 unmodified lines | ||
| 1118 | 1125 | exit_irq_fail: |
| 1119 | 1126 | close_candev(dev); |
| 1120 | 1127 | exit_open_fail: |
| 1128 | + c_can_reset_ram(priv, false); | |
| 1121 | 1129 | c_can_pm_runtime_put_sync(priv); |
| 1122 | 1130 | return err; |
| 1123 | 1131 | } |
| @@ -1131,6 +1139,8 @@ static int c_can_close(struct net_device *dev) · 7 unmodified lines | ||
| 1131 | 1139 | c_can_stop(dev); |
| 1132 | 1140 | free_irq(dev->irq, dev); |
| 1133 | 1141 | close_candev(dev); |
| 1142 | + | |
| 1143 | + c_can_reset_ram(priv, false); | |
| 1134 | 1144 | c_can_pm_runtime_put_sync(priv); |
| 1135 | 1145 | |
| 1136 | 1146 | return 0; |
| @@ -1188,6 +1198,7 @@ int c_can_power_down(struct net_device *dev) · 51 unmodified lines | ||
| 1188 | 1198 | |
| 1189 | 1199 | c_can_stop(dev); |
| 1190 | 1200 | |
| 1201 | + c_can_reset_ram(priv, false); | |
| 1191 | 1202 | c_can_pm_runtime_put_sync(priv); |
| 1192 | 1203 | |
| 1193 | 1204 | return 0; |
| @@ -1206,6 +1217,7 @@ int c_can_power_up(struct net_device *dev) · 12 unmodified lines | ||
| 1206 | 1217 | WARN_ON(priv->type != BOSCH_D_CAN); |
| 1207 | 1218 | |
| 1208 | 1219 | c_can_pm_runtime_get_sync(priv); |
| 1220 | + c_can_reset_ram(priv, true); | |
| 1209 | 1221 | |
| 1210 | 1222 | /* Clear PDR and INIT bits */ |
| 1211 | 1223 | val = priv->read_reg(priv, C_CAN_CTRL_EX_REG); |
| @@ -169,6 +169,9 @@ struct c_can_priv { · 168 unmodified lines | ||
| 169 | 169 | void *priv; /* for board-specific data */ |
| 170 | 170 | u16 irqstatus; |
| 171 | 171 | enum c_can_dev_id type; |
| 172 | + u32 __iomem *raminit_ctrlreg; | |
| 173 | + unsigned int instance; | |
| 174 | + void (*raminit) (const struct c_can_priv *priv, bool enable); | |
| 172 | 175 | }; |
| 173 | 176 | |
| 174 | 177 | struct net_device *alloc_c_can_dev(void); |
| @@ -63,8 +63,8 @@ static void c_can_pci_write_reg_aligned_to_32bit(struct c_can_priv *priv, · 62 unmodified lines | ||
| 63 | 63 | writew(val, priv->base + 2 * priv->regs[index]); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | −static int __devinit c_can_pci_probe(struct pci_dev *pdev, | |
| 67 | − const struct pci_device_id *ent) | |
| 66 | +static int c_can_pci_probe(struct pci_dev *pdev, | |
| 67 | + const struct pci_device_id *ent) | |
| 68 | 68 | { |
| 69 | 69 | struct c_can_pci_data *c_can_pci_data = (void *)ent->driver_data; |
| 70 | 70 | struct c_can_priv *priv; |
| @@ -174,7 +174,7 @@ out: · 103 unmodified lines | ||
| 174 | 174 | return ret; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | −static void __devexit c_can_pci_remove(struct pci_dev *pdev) | |
| 177 | +static void c_can_pci_remove(struct pci_dev *pdev) | |
| 178 | 178 | { |
| 179 | 179 | struct net_device *dev = pci_get_drvdata(pdev); |
| 180 | 180 | struct c_can_priv *priv = netdev_priv(dev); |
| @@ -210,7 +210,7 @@ static struct pci_driver c_can_pci_driver = { · 29 unmodified lines | ||
| 210 | 210 | .name = KBUILD_MODNAME, |
| 211 | 211 | .id_table = c_can_pci_tbl, |
| 212 | 212 | .probe = c_can_pci_probe, |
| 213 | − .remove = __devexit_p(c_can_pci_remove), | |
| 213 | + .remove = c_can_pci_remove, | |
| 214 | 214 | }; |
| 215 | 215 | |
| 216 | 216 | module_pci_driver(c_can_pci_driver); |
| @@ -38,6 +38,8 @@ · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | #include "c_can.h" |
| 40 | 40 | |
| 41 | +#define CAN_RAMINIT_START_MASK(i) (1 << (i)) | |
| 42 | + | |
| 41 | 43 | /* |
| 42 | 44 | * 16-bit c_can registers can be arranged differently in the memory |
| 43 | 45 | * architecture of different implementations. For example: 16-bit |
| @@ -68,6 +70,18 @@ static void c_can_plat_write_reg_aligned_to_32bit(struct c_can_priv *priv, · 24 unmodified lines | ||
| 68 | 70 | writew(val, priv->base + 2 * priv->regs[index]); |
| 69 | 71 | } |
| 70 | 72 | |
| 73 | +static void c_can_hw_raminit(const struct c_can_priv *priv, bool enable) | |
| 74 | +{ | |
| 75 | + u32 val; | |
| 76 | + | |
| 77 | + val = readl(priv->raminit_ctrlreg); | |
| 78 | + if (enable) | |
| 79 | + val |= CAN_RAMINIT_START_MASK(priv->instance); | |
| 80 | + else | |
| 81 | + val &= ~CAN_RAMINIT_START_MASK(priv->instance); | |
| 82 | + writel(val, priv->raminit_ctrlreg); | |
| 83 | +} | |
| 84 | + | |
| 71 | 85 | static struct platform_device_id c_can_id_table[] = { |
| 72 | 86 | [BOSCH_C_CAN_PLATFORM] = { |
| 73 | 87 | .name = KBUILD_MODNAME, |
| @@ -83,14 +97,16 @@ static struct platform_device_id c_can_id_table[] = { · 9 unmodified lines | ||
| 83 | 97 | }, { |
| 84 | 98 | } |
| 85 | 99 | }; |
| 100 | +MODULE_DEVICE_TABLE(platform, c_can_id_table); | |
| 86 | 101 | |
| 87 | 102 | static const struct of_device_id c_can_of_table[] = { |
| 88 | 103 | { .compatible = "bosch,c_can", .data = &c_can_id_table[BOSCH_C_CAN] }, |
| 89 | 104 | { .compatible = "bosch,d_can", .data = &c_can_id_table[BOSCH_D_CAN] }, |
| 90 | 105 | { /* sentinel */ }, |
| 91 | 106 | }; |
| 107 | +MODULE_DEVICE_TABLE(of, c_can_of_table); | |
| 92 | 108 | |
| 93 | −static int __devinit c_can_plat_probe(struct platform_device *pdev) | |
| 109 | +static int c_can_plat_probe(struct platform_device *pdev) | |
| 94 | 110 | { |
| 95 | 111 | int ret; |
| 96 | 112 | void __iomem *addr; |
| @@ -99,7 +115,7 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 99 | 115 | const struct of_device_id *match; |
| 100 | 116 | const struct platform_device_id *id; |
| 101 | 117 | struct pinctrl *pinctrl; |
| 102 | − struct resource *mem; | |
| 118 | + struct resource *mem, *res; | |
| 103 | 119 | int irq; |
| 104 | 120 | struct clk *clk; |
| 105 | 121 | |
| @@ -178,6 +194,18 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev) · 72 unmodified lines | ||
| 178 | 194 | priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; |
| 179 | 195 | priv->read_reg = c_can_plat_read_reg_aligned_to_16bit; |
| 180 | 196 | priv->write_reg = c_can_plat_write_reg_aligned_to_16bit; |
| 197 | + | |
| 198 | + if (pdev->dev.of_node) | |
| 199 | + priv->instance = of_alias_get_id(pdev->dev.of_node, "d_can"); | |
| 200 | + else | |
| 201 | + priv->instance = pdev->id; | |
| 202 | + | |
| 203 | + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | |
| 204 | + priv->raminit_ctrlreg = devm_request_and_ioremap(&pdev->dev, res); | |
| 205 | + if (!priv->raminit_ctrlreg || priv->instance < 0) | |
| 206 | + dev_info(&pdev->dev, "control memory is not used for raminit\n"); | |
| 207 | + else | |
| 208 | + priv->raminit = c_can_hw_raminit; | |
| 181 | 209 | break; |
| 182 | 210 | default: |
| 183 | 211 | ret = -EINVAL; |
| @@ -220,7 +248,7 @@ exit: · 36 unmodified lines | ||
| 220 | 248 | return ret; |
| 221 | 249 | } |
| 222 | 250 | |
| 223 | −static int __devexit c_can_plat_remove(struct platform_device *pdev) | |
| 251 | +static int c_can_plat_remove(struct platform_device *pdev) | |
| 224 | 252 | { |
| 225 | 253 | struct net_device *dev = platform_get_drvdata(pdev); |
| 226 | 254 | struct c_can_priv *priv = netdev_priv(dev); |
| @@ -306,7 +334,7 @@ static struct platform_driver c_can_plat_driver = { · 79 unmodified lines | ||
| 306 | 334 | .of_match_table = of_match_ptr(c_can_of_table), |
| 307 | 335 | }, |
| 308 | 336 | .probe = c_can_plat_probe, |
| 309 | − .remove = __devexit_p(c_can_plat_remove), | |
| 337 | + .remove = c_can_plat_remove, | |
| 310 | 338 | .suspend = c_can_suspend, |
| 311 | 339 | .resume = c_can_resume, |
| 312 | 340 | .id_table = c_can_id_table, |
| @@ -75,12 +75,12 @@ MODULE_LICENSE("GPL v2"); · 74 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | static unsigned long port[MAXDEV]; |
| 77 | 77 | static unsigned long mem[MAXDEV]; |
| 78 | −static int __devinitdata irq[MAXDEV]; | |
| 79 | −static int __devinitdata clk[MAXDEV]; | |
| 80 | −static u8 __devinitdata cir[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 81 | −static u8 __devinitdata cor[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 82 | −static u8 __devinitdata bcr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 83 | −static int __devinitdata indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1}; | |
| 78 | +static int irq[MAXDEV]; | |
| 79 | +static int clk[MAXDEV]; | |
| 80 | +static u8 cir[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 81 | +static u8 cor[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 82 | +static u8 bcr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 83 | +static int indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1}; | |
| 84 | 84 | |
| 85 | 85 | module_param_array(port, ulong, NULL, S_IRUGO); |
| 86 | 86 | MODULE_PARM_DESC(port, "I/O port number"); |
| @@ -166,7 +166,7 @@ static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv, · 79 unmodified lines | ||
| 166 | 166 | spin_unlock_irqrestore(&cc770_isa_port_lock, flags); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | −static int __devinit cc770_isa_probe(struct platform_device *pdev) | |
| 169 | +static int cc770_isa_probe(struct platform_device *pdev) | |
| 170 | 170 | { |
| 171 | 171 | struct net_device *dev; |
| 172 | 172 | struct cc770_priv *priv; |
| @@ -291,7 +291,7 @@ static int __devinit cc770_isa_probe(struct platform_device *pdev) · 118 unmodified lines | ||
| 291 | 291 | return err; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | −static int __devexit cc770_isa_remove(struct platform_device *pdev) | |
| 294 | +static int cc770_isa_remove(struct platform_device *pdev) | |
| 295 | 295 | { |
| 296 | 296 | struct net_device *dev = dev_get_drvdata(&pdev->dev); |
| 297 | 297 | struct cc770_priv *priv = netdev_priv(dev); |
| @@ -316,7 +316,7 @@ static int __devexit cc770_isa_remove(struct platform_device *pdev) · 18 unmodified lines | ||
| 316 | 316 | |
| 317 | 317 | static struct platform_driver cc770_isa_driver = { |
| 318 | 318 | .probe = cc770_isa_probe, |
| 319 | − .remove = __devexit_p(cc770_isa_remove), | |
| 319 | + .remove = cc770_isa_remove, | |
| 320 | 320 | .driver = { |
| 321 | 321 | .name = KBUILD_MODNAME, |
| 322 | 322 | .owner = THIS_MODULE, |
| @@ -60,6 +60,7 @@ · 59 unmodified lines | ||
| 60 | 60 | MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); |
| 61 | 61 | MODULE_DESCRIPTION("Socket-CAN driver for CC770 on the platform bus"); |
| 62 | 62 | MODULE_LICENSE("GPL v2"); |
| 63 | +MODULE_ALIAS("platform:" DRV_NAME); | |
| 63 | 64 | |
| 64 | 65 | #define CC770_PLATFORM_CAN_CLOCK 16000000 |
| 65 | 66 | |
| @@ -74,8 +75,8 @@ static void cc770_platform_write_reg(const struct cc770_priv *priv, int reg, · 8 unmodified lines | ||
| 74 | 75 | iowrite8(val, priv->reg_base + reg); |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | −static int __devinit cc770_get_of_node_data(struct platform_device *pdev, | |
| 78 | − struct cc770_priv *priv) | |
| 78 | +static int cc770_get_of_node_data(struct platform_device *pdev, | |
| 79 | + struct cc770_priv *priv) | |
| 79 | 80 | { |
| 80 | 81 | struct device_node *np = pdev->dev.of_node; |
| 81 | 82 | const u32 *prop; |
| @@ -147,8 +148,8 @@ static int __devinit cc770_get_of_node_data(struct platform_device *pdev, · 65 unmodified lines | ||
| 147 | 148 | return 0; |
| 148 | 149 | } |
| 149 | 150 | |
| 150 | −static int __devinit cc770_get_platform_data(struct platform_device *pdev, | |
| 151 | − struct cc770_priv *priv) | |
| 151 | +static int cc770_get_platform_data(struct platform_device *pdev, | |
| 152 | + struct cc770_priv *priv) | |
| 152 | 153 | { |
| 153 | 154 | |
| 154 | 155 | struct cc770_platform_data *pdata = pdev->dev.platform_data; |
| @@ -163,7 +164,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev, · 8 unmodified lines | ||
| 163 | 164 | return 0; |
| 164 | 165 | } |
| 165 | 166 | |
| 166 | −static int __devinit cc770_platform_probe(struct platform_device *pdev) | |
| 167 | +static int cc770_platform_probe(struct platform_device *pdev) | |
| 167 | 168 | { |
| 168 | 169 | struct net_device *dev; |
| 169 | 170 | struct cc770_priv *priv; |
| @@ -237,7 +238,7 @@ exit_release_mem: · 67 unmodified lines | ||
| 237 | 238 | return err; |
| 238 | 239 | } |
| 239 | 240 | |
| 240 | −static int __devexit cc770_platform_remove(struct platform_device *pdev) | |
| 241 | +static int cc770_platform_remove(struct platform_device *pdev) | |
| 241 | 242 | { |
| 242 | 243 | struct net_device *dev = dev_get_drvdata(&pdev->dev); |
| 243 | 244 | struct cc770_priv *priv = netdev_priv(dev); |
| @@ -253,11 +254,12 @@ static int __devexit cc770_platform_remove(struct platform_device *pdev) · 9 unmodified lines | ||
| 253 | 254 | return 0; |
| 254 | 255 | } |
| 255 | 256 | |
| 256 | −static struct of_device_id __devinitdata cc770_platform_table[] = { | |
| 257 | +static struct of_device_id cc770_platform_table[] = { | |
| 257 | 258 | {.compatible = "bosch,cc770"}, /* CC770 from Bosch */ |
| 258 | 259 | {.compatible = "intc,82527"}, /* AN82527 from Intel CP */ |
| 259 | 260 | {}, |
| 260 | 261 | }; |
| 262 | +MODULE_DEVICE_TABLE(of, cc770_platform_table); | |
| 261 | 263 | |
| 262 | 264 | static struct platform_driver cc770_platform_driver = { |
| 263 | 265 | .driver = { |
| @@ -266,7 +268,7 @@ static struct platform_driver cc770_platform_driver = { · 2 unmodified lines | ||
| 266 | 268 | .of_match_table = cc770_platform_table, |
| 267 | 269 | }, |
| 268 | 270 | .probe = cc770_platform_probe, |
| 269 | − .remove = __devexit_p(cc770_platform_remove), | |
| 271 | + .remove = cc770_platform_remove, | |
| 270 | 272 | }; |
| 271 | 273 | |
| 272 | 274 | module_platform_driver(cc770_platform_driver); |
| @@ -609,8 +609,7 @@ void close_candev(struct net_device *dev) · 608 unmodified lines | ||
| 609 | 609 | { |
| 610 | 610 | struct can_priv *priv = netdev_priv(dev); |
| 611 | 611 | |
| 612 | − if (del_timer_sync(&priv->restart_timer)) | |
| 613 | − dev_put(dev); | |
| 612 | + del_timer_sync(&priv->restart_timer); | |
| 614 | 613 | can_flush_echo_skb(dev); |
| 615 | 614 | } |
| 616 | 615 | EXPORT_SYMBOL_GPL(close_candev); |
| @@ -922,7 +922,7 @@ static const struct net_device_ops flexcan_netdev_ops = { · 921 unmodified lines | ||
| 922 | 922 | .ndo_start_xmit = flexcan_start_xmit, |
| 923 | 923 | }; |
| 924 | 924 | |
| 925 | −static int __devinit register_flexcandev(struct net_device *dev) | |
| 925 | +static int register_flexcandev(struct net_device *dev) | |
| 926 | 926 | { |
| 927 | 927 | struct flexcan_priv *priv = netdev_priv(dev); |
| 928 | 928 | struct flexcan_regs __iomem *regs = priv->base; |
| @@ -968,7 +968,7 @@ static int __devinit register_flexcandev(struct net_device *dev) · 39 unmodified lines | ||
| 968 | 968 | return err; |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | −static void __devexit unregister_flexcandev(struct net_device *dev) | |
| 971 | +static void unregister_flexcandev(struct net_device *dev) | |
| 972 | 972 | { |
| 973 | 973 | unregister_candev(dev); |
| 974 | 974 | } |
| @@ -979,13 +979,15 @@ static const struct of_device_id flexcan_of_match[] = { · 4 unmodified lines | ||
| 979 | 979 | { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, |
| 980 | 980 | { /* sentinel */ }, |
| 981 | 981 | }; |
| 982 | +MODULE_DEVICE_TABLE(of, flexcan_of_match); | |
| 982 | 983 | |
| 983 | 984 | static const struct platform_device_id flexcan_id_table[] = { |
| 984 | 985 | { .name = "flexcan", .driver_data = (kernel_ulong_t)&fsl_p1010_devtype_data, }, |
| 985 | 986 | { /* sentinel */ }, |
| 986 | 987 | }; |
| 988 | +MODULE_DEVICE_TABLE(platform, flexcan_id_table); | |
| 987 | 989 | |
| 988 | −static int __devinit flexcan_probe(struct platform_device *pdev) | |
| 990 | +static int flexcan_probe(struct platform_device *pdev) | |
| 989 | 991 | { |
| 990 | 992 | const struct of_device_id *of_id; |
| 991 | 993 | const struct flexcan_devtype_data *devtype_data; |
| @@ -1107,7 +1109,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev) · 115 unmodified lines | ||
| 1107 | 1109 | return err; |
| 1108 | 1110 | } |
| 1109 | 1111 | |
| 1110 | −static int __devexit flexcan_remove(struct platform_device *pdev) | |
| 1112 | +static int flexcan_remove(struct platform_device *pdev) | |
| 1111 | 1113 | { |
| 1112 | 1114 | struct net_device *dev = platform_get_drvdata(pdev); |
| 1113 | 1115 | struct flexcan_priv *priv = netdev_priv(dev); |
| @@ -1168,7 +1170,7 @@ static struct platform_driver flexcan_driver = { · 54 unmodified lines | ||
| 1168 | 1170 | .of_match_table = flexcan_of_match, |
| 1169 | 1171 | }, |
| 1170 | 1172 | .probe = flexcan_probe, |
| 1171 | − .remove = __devexit_p(flexcan_remove), | |
| 1173 | + .remove = flexcan_remove, | |
| 1172 | 1174 | .suspend = flexcan_suspend, |
| 1173 | 1175 | .resume = flexcan_resume, |
| 1174 | 1176 | .id_table = flexcan_id_table, |
| @@ -0,0 +1,1756 @@ | ||
| 1 | +/* | |
| 2 | + * Socket CAN driver for Aeroflex Gaisler GRCAN and GRHCAN. | |
| 3 | + * | |
| 4 | + * 2012 (c) Aeroflex Gaisler AB | |
| 5 | + * | |
| 6 | + * This driver supports GRCAN and GRHCAN CAN controllers available in the GRLIB | |
| 7 | + * VHDL IP core library. | |
| 8 | + * | |
| 9 | + * Full documentation of the GRCAN core can be found here: | |
| 10 | + * http://www.gaisler.com/products/grlib/grip.pdf | |
| 11 | + * | |
| 12 | + * See "Documentation/devicetree/bindings/net/can/grcan.txt" for information on | |
| 13 | + * open firmware properties. | |
| 14 | + * | |
| 15 | + * See "Documentation/ABI/testing/sysfs-class-net-grcan" for information on the | |
| 16 | + * sysfs interface. | |
| 17 | + * | |
| 18 | + * See "Documentation/kernel-parameters.txt" for information on the module | |
| 19 | + * parameters. | |
| 20 | + * | |
| 21 | + * This program is free software; you can redistribute it and/or modify it | |
| 22 | + * under the terms of the GNU General Public License as published by the | |
| 23 | + * Free Software Foundation; either version 2 of the License, or (at your | |
| 24 | + * option) any later version. | |
| 25 | + * | |
| 26 | + * Contributors: Andreas Larsson <andreas@gaisler.com> | |
| 27 | + */ | |
| 28 | + | |
| 29 | +#include <linux/kernel.h> | |
| 30 | +#include <linux/module.h> | |
| 31 | +#include <linux/interrupt.h> | |
| 32 | +#include <linux/netdevice.h> | |
| 33 | +#include <linux/delay.h> | |
| 34 | +#include <linux/io.h> | |
| 35 | +#include <linux/can/dev.h> | |
| 36 | +#include <linux/spinlock.h> | |
| 37 | + | |
| 38 | +#include <linux/of_platform.h> | |
| 39 | +#include <asm/prom.h> | |
| 40 | + | |
| 41 | +#include <linux/of_irq.h> | |
| 42 | + | |
| 43 | +#include <linux/dma-mapping.h> | |
| 44 | + | |
| 45 | +#define DRV_NAME "grcan" | |
| 46 | + | |
| 47 | +#define GRCAN_NAPI_WEIGHT 32 | |
| 48 | + | |
| 49 | +#define GRCAN_RESERVE_SIZE(slot1, slot2) (((slot2) - (slot1)) / 4 - 1) | |
| 50 | + | |
| 51 | +struct grcan_registers { | |
| 52 | + u32 conf; /* 0x00 */ | |
| 53 | + u32 stat; /* 0x04 */ | |
| 54 | + u32 ctrl; /* 0x08 */ | |
| 55 | + u32 __reserved1[GRCAN_RESERVE_SIZE(0x08, 0x18)]; | |
| 56 | + u32 smask; /* 0x18 - CanMASK */ | |
| 57 | + u32 scode; /* 0x1c - CanCODE */ | |
| 58 | + u32 __reserved2[GRCAN_RESERVE_SIZE(0x1c, 0x100)]; | |
| 59 | + u32 pimsr; /* 0x100 */ | |
| 60 | + u32 pimr; /* 0x104 */ | |
| 61 | + u32 pisr; /* 0x108 */ | |
| 62 | + u32 pir; /* 0x10C */ | |
| 63 | + u32 imr; /* 0x110 */ | |
| 64 | + u32 picr; /* 0x114 */ | |
| 65 | + u32 __reserved3[GRCAN_RESERVE_SIZE(0x114, 0x200)]; | |
| 66 | + u32 txctrl; /* 0x200 */ | |
| 67 | + u32 txaddr; /* 0x204 */ | |
| 68 | + u32 txsize; /* 0x208 */ | |
| 69 | + u32 txwr; /* 0x20C */ | |
| 70 | + u32 txrd; /* 0x210 */ | |
| 71 | + u32 txirq; /* 0x214 */ | |
| 72 | + u32 __reserved4[GRCAN_RESERVE_SIZE(0x214, 0x300)]; | |
| 73 | + u32 rxctrl; /* 0x300 */ | |
| 74 | + u32 rxaddr; /* 0x304 */ | |
| 75 | + u32 rxsize; /* 0x308 */ | |
| 76 | + u32 rxwr; /* 0x30C */ | |
| 77 | + u32 rxrd; /* 0x310 */ | |
| 78 | + u32 rxirq; /* 0x314 */ | |
| 79 | + u32 rxmask; /* 0x318 */ | |
| 80 | + u32 rxcode; /* 0x31C */ | |
| 81 | +}; | |
| 82 | + | |
| 83 | +#define GRCAN_CONF_ABORT 0x00000001 | |
| 84 | +#define GRCAN_CONF_ENABLE0 0x00000002 | |
| 85 | +#define GRCAN_CONF_ENABLE1 0x00000004 | |
| 86 | +#define GRCAN_CONF_SELECT 0x00000008 | |
| 87 | +#define GRCAN_CONF_SILENT 0x00000010 | |
| 88 | +#define GRCAN_CONF_SAM 0x00000020 /* Available in some hardware */ | |
| 89 | +#define GRCAN_CONF_BPR 0x00000300 /* Note: not BRP */ | |
| 90 | +#define GRCAN_CONF_RSJ 0x00007000 | |
| 91 | +#define GRCAN_CONF_PS1 0x00f00000 | |
| 92 | +#define GRCAN_CONF_PS2 0x000f0000 | |
| 93 | +#define GRCAN_CONF_SCALER 0xff000000 | |
| 94 | +#define GRCAN_CONF_OPERATION \ | |
| 95 | + (GRCAN_CONF_ABORT | GRCAN_CONF_ENABLE0 | GRCAN_CONF_ENABLE1 \ | |
| 96 | + | GRCAN_CONF_SELECT | GRCAN_CONF_SILENT | GRCAN_CONF_SAM) | |
| 97 | +#define GRCAN_CONF_TIMING \ | |
| 98 | + (GRCAN_CONF_BPR | GRCAN_CONF_RSJ | GRCAN_CONF_PS1 \ | |
| 99 | + | GRCAN_CONF_PS2 | GRCAN_CONF_SCALER) | |
| 100 | + | |
| 101 | +#define GRCAN_CONF_RSJ_MIN 1 | |
| 102 | +#define GRCAN_CONF_RSJ_MAX 4 | |
| 103 | +#define GRCAN_CONF_PS1_MIN 1 | |
| 104 | +#define GRCAN_CONF_PS1_MAX 15 | |
| 105 | +#define GRCAN_CONF_PS2_MIN 2 | |
| 106 | +#define GRCAN_CONF_PS2_MAX 8 | |
| 107 | +#define GRCAN_CONF_SCALER_MIN 0 | |
| 108 | +#define GRCAN_CONF_SCALER_MAX 255 | |
| 109 | +#define GRCAN_CONF_SCALER_INC 1 | |
| 110 | + | |
| 111 | +#define GRCAN_CONF_BPR_BIT 8 | |
| 112 | +#define GRCAN_CONF_RSJ_BIT 12 | |
| 113 | +#define GRCAN_CONF_PS1_BIT 20 | |
| 114 | +#define GRCAN_CONF_PS2_BIT 16 | |
| 115 | +#define GRCAN_CONF_SCALER_BIT 24 | |
| 116 | + | |
| 117 | +#define GRCAN_STAT_PASS 0x000001 | |
| 118 | +#define GRCAN_STAT_OFF 0x000002 | |
| 119 | +#define GRCAN_STAT_OR 0x000004 | |
| 120 | +#define GRCAN_STAT_AHBERR 0x000008 | |
| 121 | +#define GRCAN_STAT_ACTIVE 0x000010 | |
| 122 | +#define GRCAN_STAT_RXERRCNT 0x00ff00 | |
| 123 | +#define GRCAN_STAT_TXERRCNT 0xff0000 | |
| 124 | + | |
| 125 | +#define GRCAN_STAT_ERRCTR_RELATED (GRCAN_STAT_PASS | GRCAN_STAT_OFF) | |
| 126 | + | |
| 127 | +#define GRCAN_STAT_RXERRCNT_BIT 8 | |
| 128 | +#define GRCAN_STAT_TXERRCNT_BIT 16 | |
| 129 | + | |
| 130 | +#define GRCAN_STAT_ERRCNT_WARNING_LIMIT 96 | |
| 131 | +#define GRCAN_STAT_ERRCNT_PASSIVE_LIMIT 127 | |
| 132 | + | |
| 133 | +#define GRCAN_CTRL_RESET 0x2 | |
| 134 | +#define GRCAN_CTRL_ENABLE 0x1 | |
| 135 | + | |
| 136 | +#define GRCAN_TXCTRL_ENABLE 0x1 | |
| 137 | +#define GRCAN_TXCTRL_ONGOING 0x2 | |
| 138 | +#define GRCAN_TXCTRL_SINGLE 0x4 | |
| 139 | + | |
| 140 | +#define GRCAN_RXCTRL_ENABLE 0x1 | |
| 141 | +#define GRCAN_RXCTRL_ONGOING 0x2 | |
| 142 | + | |
| 143 | +/* Relative offset of IRQ sources to AMBA Plug&Play */ | |
| 144 | +#define GRCAN_IRQIX_IRQ 0 | |
| 145 | +#define GRCAN_IRQIX_TXSYNC 1 | |
| 146 | +#define GRCAN_IRQIX_RXSYNC 2 | |
| 147 | + | |
| 148 | +#define GRCAN_IRQ_PASS 0x00001 | |
| 149 | +#define GRCAN_IRQ_OFF 0x00002 | |
| 150 | +#define GRCAN_IRQ_OR 0x00004 | |
| 151 | +#define GRCAN_IRQ_RXAHBERR 0x00008 | |
| 152 | +#define GRCAN_IRQ_TXAHBERR 0x00010 | |
| 153 | +#define GRCAN_IRQ_RXIRQ 0x00020 | |
| 154 | +#define GRCAN_IRQ_TXIRQ 0x00040 | |
| 155 | +#define GRCAN_IRQ_RXFULL 0x00080 | |
| 156 | +#define GRCAN_IRQ_TXEMPTY 0x00100 | |
| 157 | +#define GRCAN_IRQ_RX 0x00200 | |
| 158 | +#define GRCAN_IRQ_TX 0x00400 | |
| 159 | +#define GRCAN_IRQ_RXSYNC 0x00800 | |
| 160 | +#define GRCAN_IRQ_TXSYNC 0x01000 | |
| 161 | +#define GRCAN_IRQ_RXERRCTR 0x02000 | |
| 162 | +#define GRCAN_IRQ_TXERRCTR 0x04000 | |
| 163 | +#define GRCAN_IRQ_RXMISS 0x08000 | |
| 164 | +#define GRCAN_IRQ_TXLOSS 0x10000 | |
| 165 | + | |
| 166 | +#define GRCAN_IRQ_NONE 0 | |
| 167 | +#define GRCAN_IRQ_ALL \ | |
| 168 | + (GRCAN_IRQ_PASS | GRCAN_IRQ_OFF | GRCAN_IRQ_OR \ | |
| 169 | + | GRCAN_IRQ_RXAHBERR | GRCAN_IRQ_TXAHBERR \ | |
| 170 | + | GRCAN_IRQ_RXIRQ | GRCAN_IRQ_TXIRQ \ | |
| 171 | + | GRCAN_IRQ_RXFULL | GRCAN_IRQ_TXEMPTY \ | |
| 172 | + | GRCAN_IRQ_RX | GRCAN_IRQ_TX | GRCAN_IRQ_RXSYNC \ | |
| 173 | + | GRCAN_IRQ_TXSYNC | GRCAN_IRQ_RXERRCTR \ | |
| 174 | + | GRCAN_IRQ_TXERRCTR | GRCAN_IRQ_RXMISS \ | |
| 175 | + | GRCAN_IRQ_TXLOSS) | |
| 176 | + | |
| 177 | +#define GRCAN_IRQ_ERRCTR_RELATED (GRCAN_IRQ_RXERRCTR | GRCAN_IRQ_TXERRCTR \ | |
| 178 | + | GRCAN_IRQ_PASS | GRCAN_IRQ_OFF) | |
| 179 | +#define GRCAN_IRQ_ERRORS (GRCAN_IRQ_ERRCTR_RELATED | GRCAN_IRQ_OR \ | |
| 180 | + | GRCAN_IRQ_TXAHBERR | GRCAN_IRQ_RXAHBERR \ | |
| 181 | + | GRCAN_IRQ_TXLOSS) | |
| 182 | +#define GRCAN_IRQ_DEFAULT (GRCAN_IRQ_RX | GRCAN_IRQ_TX | GRCAN_IRQ_ERRORS) | |
| 183 | + | |
| 184 | +#define GRCAN_MSG_SIZE 16 | |
| 185 | + | |
| 186 | +#define GRCAN_MSG_IDE 0x80000000 | |
| 187 | +#define GRCAN_MSG_RTR 0x40000000 | |
| 188 | +#define GRCAN_MSG_BID 0x1ffc0000 | |
| 189 | +#define GRCAN_MSG_EID 0x1fffffff | |
| 190 | +#define GRCAN_MSG_IDE_BIT 31 | |
| 191 | +#define GRCAN_MSG_RTR_BIT 30 | |
| 192 | +#define GRCAN_MSG_BID_BIT 18 | |
| 193 | +#define GRCAN_MSG_EID_BIT 0 | |
| 194 | + | |
| 195 | +#define GRCAN_MSG_DLC 0xf0000000 | |
| 196 | +#define GRCAN_MSG_TXERRC 0x00ff0000 | |
| 197 | +#define GRCAN_MSG_RXERRC 0x0000ff00 | |
| 198 | +#define GRCAN_MSG_DLC_BIT 28 | |
| 199 | +#define GRCAN_MSG_TXERRC_BIT 16 | |
| 200 | +#define GRCAN_MSG_RXERRC_BIT 8 | |
| 201 | +#define GRCAN_MSG_AHBERR 0x00000008 | |
| 202 | +#define GRCAN_MSG_OR 0x00000004 | |
| 203 | +#define GRCAN_MSG_OFF 0x00000002 | |
| 204 | +#define GRCAN_MSG_PASS 0x00000001 | |
| 205 | + | |
| 206 | +#define GRCAN_MSG_DATA_SLOT_INDEX(i) (2 + (i) / 4) | |
| 207 | +#define GRCAN_MSG_DATA_SHIFT(i) ((3 - (i) % 4) * 8) | |
| 208 | + | |
| 209 | +#define GRCAN_BUFFER_ALIGNMENT 1024 | |
| 210 | +#define GRCAN_DEFAULT_BUFFER_SIZE 1024 | |
| 211 | +#define GRCAN_VALID_TR_SIZE_MASK 0x001fffc0 | |
| 212 | + | |
| 213 | +#define GRCAN_INVALID_BUFFER_SIZE(s) \ | |
| 214 | + ((s) == 0 || ((s) & ~GRCAN_VALID_TR_SIZE_MASK)) | |
| 215 | + | |
| 216 | +#if GRCAN_INVALID_BUFFER_SIZE(GRCAN_DEFAULT_BUFFER_SIZE) | |
| 217 | +#error "Invalid default buffer size" | |
| 218 | +#endif | |
| 219 | + | |
| 220 | +struct grcan_dma_buffer { | |
| 221 | + size_t size; | |
| 222 | + void *buf; | |
| 223 | + dma_addr_t handle; | |
| 224 | +}; | |
| 225 | + | |
| 226 | +struct grcan_dma { | |
| 227 | + size_t base_size; | |
| 228 | + void *base_buf; | |
| 229 | + dma_addr_t base_handle; | |
| 230 | + struct grcan_dma_buffer tx; | |
| 231 | + struct grcan_dma_buffer rx; | |
| 232 | +}; | |
| 233 | + | |
| 234 | +/* GRCAN configuration parameters */ | |
| 235 | +struct grcan_device_config { | |
| 236 | + unsigned short enable0; | |
| 237 | + unsigned short enable1; | |
| 238 | + unsigned short select; | |
| 239 | + unsigned int txsize; | |
| 240 | + unsigned int rxsize; | |
| 241 | +}; | |
| 242 | + | |
| 243 | +#define GRCAN_DEFAULT_DEVICE_CONFIG { \ | |
| 244 | + .enable0 = 0, \ | |
| 245 | + .enable1 = 0, \ | |
| 246 | + .select = 0, \ | |
| 247 | + .txsize = GRCAN_DEFAULT_BUFFER_SIZE, \ | |
| 248 | + .rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \ | |
| 249 | + } | |
| 250 | + | |
| 251 | +#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 0x4100 | |
| 252 | +#define GRLIB_VERSION_MASK 0xffff | |
| 253 | + | |
| 254 | +/* GRCAN private data structure */ | |
| 255 | +struct grcan_priv { | |
| 256 | + struct can_priv can; /* must be the first member */ | |
| 257 | + struct net_device *dev; | |
| 258 | + struct napi_struct napi; | |
| 259 | + | |
| 260 | + struct grcan_registers __iomem *regs; /* ioremap'ed registers */ | |
| 261 | + struct grcan_device_config config; | |
| 262 | + struct grcan_dma dma; | |
| 263 | + | |
| 264 | + struct sk_buff **echo_skb; /* We allocate this on our own */ | |
| 265 | + u8 *txdlc; /* Length of queued frames */ | |
| 266 | + | |
| 267 | + /* The echo skb pointer, pointing into echo_skb and indicating which | |
| 268 | + * frames can be echoed back. See the "Notes on the tx cyclic buffer | |
| 269 | + * handling"-comment for grcan_start_xmit for more details. | |
| 270 | + */ | |
| 271 | + u32 eskbp; | |
| 272 | + | |
| 273 | + /* Lock for controlling changes to the netif tx queue state, accesses to | |
| 274 | + * the echo_skb pointer eskbp and for making sure that a running reset | |
| 275 | + * and/or a close of the interface is done without interference from | |
| 276 | + * other parts of the code. | |
| 277 | + * | |
| 278 | + * The echo_skb pointer, eskbp, should only be accessed under this lock | |
| 279 | + * as it can be changed in several places and together with decisions on | |
| 280 | + * whether to wake up the tx queue. | |
| 281 | + * | |
| 282 | + * The tx queue must never be woken up if there is a running reset or | |
| 283 | + * close in progress. | |
| 284 | + * | |
| 285 | + * A running reset (see below on need_txbug_workaround) should never be | |
| 286 | + * done if the interface is closing down and several running resets | |
| 287 | + * should never be scheduled simultaneously. | |
| 288 | + */ | |
| 289 | + spinlock_t lock; | |
| 290 | + | |
| 291 | + /* Whether a workaround is needed due to a bug in older hardware. In | |
| 292 | + * this case, the driver both tries to prevent the bug from being | |
| 293 | + * triggered and recovers, if the bug nevertheless happens, by doing a | |
| 294 | + * running reset. A running reset, resets the device and continues from | |
| 295 | + * where it were without being noticeable from outside the driver (apart | |
| 296 | + * from slight delays). | |
| 297 | + */ | |
| 298 | + bool need_txbug_workaround; | |
| 299 | + | |
| 300 | + /* To trigger initization of running reset and to trigger running reset | |
| 301 | + * respectively in the case of a hanged device due to a txbug. | |
| 302 | + */ | |
| 303 | + struct timer_list hang_timer; | |
| 304 | + struct timer_list rr_timer; | |
| 305 | + | |
| 306 | + /* To avoid waking up the netif queue and restarting timers | |
| 307 | + * when a reset is scheduled or when closing of the device is | |
| 308 | + * undergoing | |
| 309 | + */ | |
| 310 | + bool resetting; | |
| 311 | + bool closing; | |
| 312 | +}; | |
| 313 | + | |
| 314 | +/* Wait time for a short wait for ongoing to clear */ | |
| 315 | +#define GRCAN_SHORTWAIT_USECS 10 | |
| 316 | + | |
| 317 | +/* Limit on the number of transmitted bits of an eff frame according to the CAN | |
| 318 | + * specification: 1 bit start of frame, 32 bits arbitration field, 6 bits | |
| 319 | + * control field, 8 bytes data field, 16 bits crc field, 2 bits ACK field and 7 | |
| 320 | + * bits end of frame | |
| 321 | + */ | |
| 322 | +#define GRCAN_EFF_FRAME_MAX_BITS (1+32+6+8*8+16+2+7) | |
| 323 | + | |
| 324 | +#if defined(__BIG_ENDIAN) | |
| 325 | +static inline u32 grcan_read_reg(u32 __iomem *reg) | |
| 326 | +{ | |
| 327 | + return ioread32be(reg); | |
| 328 | +} | |
| 329 | + | |
| 330 | +static inline void grcan_write_reg(u32 __iomem *reg, u32 val) | |
| 331 | +{ | |
| 332 | + iowrite32be(val, reg); | |
| 333 | +} | |
| 334 | +#else | |
| 335 | +static inline u32 grcan_read_reg(u32 __iomem *reg) | |
| 336 | +{ | |
| 337 | + return ioread32(reg); | |
| 338 | +} | |
| 339 | + | |
| 340 | +static inline void grcan_write_reg(u32 __iomem *reg, u32 val) | |
| 341 | +{ | |
| 342 | + iowrite32(val, reg); | |
| 343 | +} | |
| 344 | +#endif | |
| 345 | + | |
| 346 | +static inline void grcan_clear_bits(u32 __iomem *reg, u32 mask) | |
| 347 | +{ | |
| 348 | + grcan_write_reg(reg, grcan_read_reg(reg) & ~mask); | |
| 349 | +} | |
| 350 | + | |
| 351 | +static inline void grcan_set_bits(u32 __iomem *reg, u32 mask) | |
| 352 | +{ | |
| 353 | + grcan_write_reg(reg, grcan_read_reg(reg) | mask); | |
| 354 | +} | |
| 355 | + | |
| 356 | +static inline u32 grcan_read_bits(u32 __iomem *reg, u32 mask) | |
| 357 | +{ | |
| 358 | + return grcan_read_reg(reg) & mask; | |
| 359 | +} | |
| 360 | + | |
| 361 | +static inline void grcan_write_bits(u32 __iomem *reg, u32 value, u32 mask) | |
| 362 | +{ | |
| 363 | + u32 old = grcan_read_reg(reg); | |
| 364 | + | |
| 365 | + grcan_write_reg(reg, (old & ~mask) | (value & mask)); | |
| 366 | +} | |
| 367 | + | |
| 368 | +/* a and b should both be in [0,size] and a == b == size should not hold */ | |
| 369 | +static inline u32 grcan_ring_add(u32 a, u32 b, u32 size) | |
| 370 | +{ | |
| 371 | + u32 sum = a + b; | |
| 372 | + | |
| 373 | + if (sum < size) | |
| 374 | + return sum; | |
| 375 | + else | |
| 376 | + return sum - size; | |
| 377 | +} | |
| 378 | + | |
| 379 | +/* a and b should both be in [0,size) */ | |
| 380 | +static inline u32 grcan_ring_sub(u32 a, u32 b, u32 size) | |
| 381 | +{ | |
| 382 | + return grcan_ring_add(a, size - b, size); | |
| 383 | +} | |
| 384 | + | |
| 385 | +/* Available slots for new transmissions */ | |
| 386 | +static inline u32 grcan_txspace(size_t txsize, u32 txwr, u32 eskbp) | |
| 387 | +{ | |
| 388 | + u32 slots = txsize / GRCAN_MSG_SIZE - 1; | |
| 389 | + u32 used = grcan_ring_sub(txwr, eskbp, txsize) / GRCAN_MSG_SIZE; | |
| 390 | + | |
| 391 | + return slots - used; | |
| 392 | +} | |
| 393 | + | |
| 394 | +/* Configuration parameters that can be set via module parameters */ | |
| 395 | +static struct grcan_device_config grcan_module_config = | |
| 396 | + GRCAN_DEFAULT_DEVICE_CONFIG; | |
| 397 | + | |
| 398 | +static const struct can_bittiming_const grcan_bittiming_const = { | |
| 399 | + .name = DRV_NAME, | |
| 400 | + .tseg1_min = GRCAN_CONF_PS1_MIN + 1, | |
| 401 | + .tseg1_max = GRCAN_CONF_PS1_MAX + 1, | |
| 402 | + .tseg2_min = GRCAN_CONF_PS2_MIN, | |
| 403 | + .tseg2_max = GRCAN_CONF_PS2_MAX, | |
| 404 | + .sjw_max = GRCAN_CONF_RSJ_MAX, | |
| 405 | + .brp_min = GRCAN_CONF_SCALER_MIN + 1, | |
| 406 | + .brp_max = GRCAN_CONF_SCALER_MAX + 1, | |
| 407 | + .brp_inc = GRCAN_CONF_SCALER_INC, | |
| 408 | +}; | |
| 409 | + | |
| 410 | +static int grcan_set_bittiming(struct net_device *dev) | |
| 411 | +{ | |
| 412 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 413 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 414 | + struct can_bittiming *bt = &priv->can.bittiming; | |
| 415 | + u32 timing = 0; | |
| 416 | + int bpr, rsj, ps1, ps2, scaler; | |
| 417 | + | |
| 418 | + /* Should never happen - function will not be called when | |
| 419 | + * device is up | |
| 420 | + */ | |
| 421 | + if (grcan_read_bits(®s->ctrl, GRCAN_CTRL_ENABLE)) | |
| 422 | + return -EBUSY; | |
| 423 | + | |
| 424 | + bpr = 0; /* Note bpr and brp are different concepts */ | |
| 425 | + rsj = bt->sjw; | |
| 426 | + ps1 = (bt->prop_seg + bt->phase_seg1) - 1; /* tseg1 - 1 */ | |
| 427 | + ps2 = bt->phase_seg2; | |
| 428 | + scaler = (bt->brp - 1); | |
| 429 | + netdev_dbg(dev, "Request for BPR=%d, RSJ=%d, PS1=%d, PS2=%d, SCALER=%d", | |
| 430 | + bpr, rsj, ps1, ps2, scaler); | |
| 431 | + if (!(ps1 > ps2)) { | |
| 432 | + netdev_err(dev, "PS1 > PS2 must hold: PS1=%d, PS2=%d\n", | |
| 433 | + ps1, ps2); | |
| 434 | + return -EINVAL; | |
| 435 | + } | |
| 436 | + if (!(ps2 >= rsj)) { | |
| 437 | + netdev_err(dev, "PS2 >= RSJ must hold: PS2=%d, RSJ=%d\n", | |
| 438 | + ps2, rsj); | |
| 439 | + return -EINVAL; | |
| 440 | + } | |
| 441 | + | |
| 442 | + timing |= (bpr << GRCAN_CONF_BPR_BIT) & GRCAN_CONF_BPR; | |
| 443 | + timing |= (rsj << GRCAN_CONF_RSJ_BIT) & GRCAN_CONF_RSJ; | |
| 444 | + timing |= (ps1 << GRCAN_CONF_PS1_BIT) & GRCAN_CONF_PS1; | |
| 445 | + timing |= (ps2 << GRCAN_CONF_PS2_BIT) & GRCAN_CONF_PS2; | |
| 446 | + timing |= (scaler << GRCAN_CONF_SCALER_BIT) & GRCAN_CONF_SCALER; | |
| 447 | + netdev_info(dev, "setting timing=0x%x\n", timing); | |
| 448 | + grcan_write_bits(®s->conf, timing, GRCAN_CONF_TIMING); | |
| 449 | + | |
| 450 | + return 0; | |
| 451 | +} | |
| 452 | + | |
| 453 | +static int grcan_get_berr_counter(const struct net_device *dev, | |
| 454 | + struct can_berr_counter *bec) | |
| 455 | +{ | |
| 456 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 457 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 458 | + u32 status = grcan_read_reg(®s->stat); | |
| 459 | + | |
| 460 | + bec->txerr = (status & GRCAN_STAT_TXERRCNT) >> GRCAN_STAT_TXERRCNT_BIT; | |
| 461 | + bec->rxerr = (status & GRCAN_STAT_RXERRCNT) >> GRCAN_STAT_RXERRCNT_BIT; | |
| 462 | + return 0; | |
| 463 | +} | |
| 464 | + | |
| 465 | +static int grcan_poll(struct napi_struct *napi, int budget); | |
| 466 | + | |
| 467 | +/* Reset device, but keep configuration information */ | |
| 468 | +static void grcan_reset(struct net_device *dev) | |
| 469 | +{ | |
| 470 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 471 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 472 | + u32 config = grcan_read_reg(®s->conf); | |
| 473 | + | |
| 474 | + grcan_set_bits(®s->ctrl, GRCAN_CTRL_RESET); | |
| 475 | + grcan_write_reg(®s->conf, config); | |
| 476 | + | |
| 477 | + priv->eskbp = grcan_read_reg(®s->txrd); | |
| 478 | + priv->can.state = CAN_STATE_STOPPED; | |
| 479 | + | |
| 480 | + /* Turn off hardware filtering - regs->rxcode set to 0 by reset */ | |
| 481 | + grcan_write_reg(®s->rxmask, 0); | |
| 482 | +} | |
| 483 | + | |
| 484 | +/* stop device without changing any configurations */ | |
| 485 | +static void grcan_stop_hardware(struct net_device *dev) | |
| 486 | +{ | |
| 487 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 488 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 489 | + | |
| 490 | + grcan_write_reg(®s->imr, GRCAN_IRQ_NONE); | |
| 491 | + grcan_clear_bits(®s->txctrl, GRCAN_TXCTRL_ENABLE); | |
| 492 | + grcan_clear_bits(®s->rxctrl, GRCAN_RXCTRL_ENABLE); | |
| 493 | + grcan_clear_bits(®s->ctrl, GRCAN_CTRL_ENABLE); | |
| 494 | +} | |
| 495 | + | |
| 496 | +/* Let priv->eskbp catch up to regs->txrd and echo back the skbs if echo | |
| 497 | + * is true and free them otherwise. | |
| 498 | + * | |
| 499 | + * If budget is >= 0, stop after handling at most budget skbs. Otherwise, | |
| 500 | + * continue until priv->eskbp catches up to regs->txrd. | |
| 501 | + * | |
| 502 | + * priv->lock *must* be held when calling this function | |
| 503 | + */ | |
| 504 | +static int catch_up_echo_skb(struct net_device *dev, int budget, bool echo) | |
| 505 | +{ | |
| 506 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 507 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 508 | + struct grcan_dma *dma = &priv->dma; | |
| 509 | + struct net_device_stats *stats = &dev->stats; | |
| 510 | + int i, work_done; | |
| 511 | + | |
| 512 | + /* Updates to priv->eskbp and wake-ups of the queue needs to | |
| 513 | + * be atomic towards the reads of priv->eskbp and shut-downs | |
| 514 | + * of the queue in grcan_start_xmit. | |
| 515 | + */ | |
| 516 | + u32 txrd = grcan_read_reg(®s->txrd); | |
| 517 | + | |
| 518 | + for (work_done = 0; work_done < budget || budget < 0; work_done++) { | |
| 519 | + if (priv->eskbp == txrd) | |
| 520 | + break; | |
| 521 | + i = priv->eskbp / GRCAN_MSG_SIZE; | |
| 522 | + if (echo) { | |
| 523 | + /* Normal echo of messages */ | |
| 524 | + stats->tx_packets++; | |
| 525 | + stats->tx_bytes += priv->txdlc[i]; | |
| 526 | + priv->txdlc[i] = 0; | |
| 527 | + can_get_echo_skb(dev, i); | |
| 528 | + } else { | |
| 529 | + /* For cleanup of untransmitted messages */ | |
| 530 | + can_free_echo_skb(dev, i); | |
| 531 | + } | |
| 532 | + | |
| 533 | + priv->eskbp = grcan_ring_add(priv->eskbp, GRCAN_MSG_SIZE, | |
| 534 | + dma->tx.size); | |
| 535 | + txrd = grcan_read_reg(®s->txrd); | |
| 536 | + } | |
| 537 | + return work_done; | |
| 538 | +} | |
| 539 | + | |
| 540 | +static void grcan_lost_one_shot_frame(struct net_device *dev) | |
| 541 | +{ | |
| 542 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 543 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 544 | + struct grcan_dma *dma = &priv->dma; | |
| 545 | + u32 txrd; | |
| 546 | + unsigned long flags; | |
| 547 | + | |
| 548 | + spin_lock_irqsave(&priv->lock, flags); | |
| 549 | + | |
| 550 | + catch_up_echo_skb(dev, -1, true); | |
| 551 | + | |
| 552 | + if (unlikely(grcan_read_bits(®s->txctrl, GRCAN_TXCTRL_ENABLE))) { | |
| 553 | + /* Should never happen */ | |
| 554 | + netdev_err(dev, "TXCTRL enabled at TXLOSS in one shot mode\n"); | |
| 555 | + } else { | |
| 556 | + /* By the time an GRCAN_IRQ_TXLOSS is generated in | |
| 557 | + * one-shot mode there is no problem in writing | |
| 558 | + * to TXRD even in versions of the hardware in | |
| 559 | + * which GRCAN_TXCTRL_ONGOING is not cleared properly | |
| 560 | + * in one-shot mode. | |
| 561 | + */ | |
| 562 | + | |
| 563 | + /* Skip message and discard echo-skb */ | |
| 564 | + txrd = grcan_read_reg(®s->txrd); | |
| 565 | + txrd = grcan_ring_add(txrd, GRCAN_MSG_SIZE, dma->tx.size); | |
| 566 | + grcan_write_reg(®s->txrd, txrd); | |
| 567 | + catch_up_echo_skb(dev, -1, false); | |
| 568 | + | |
| 569 | + if (!priv->resetting && !priv->closing && | |
| 570 | + !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) { | |
| 571 | + netif_wake_queue(dev); | |
| 572 | + grcan_set_bits(®s->txctrl, GRCAN_TXCTRL_ENABLE); | |
| 573 | + } | |
| 574 | + } | |
| 575 | + | |
| 576 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 577 | +} | |
| 578 | + | |
| 579 | +static void grcan_err(struct net_device *dev, u32 sources, u32 status) | |
| 580 | +{ | |
| 581 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 582 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 583 | + struct grcan_dma *dma = &priv->dma; | |
| 584 | + struct net_device_stats *stats = &dev->stats; | |
| 585 | + struct can_frame cf; | |
| 586 | + | |
| 587 | + /* Zero potential error_frame */ | |
| 588 | + memset(&cf, 0, sizeof(cf)); | |
| 589 | + | |
| 590 | + /* Message lost interrupt. This might be due to arbitration error, but | |
| 591 | + * is also triggered when there is no one else on the can bus or when | |
| 592 | + * there is a problem with the hardware interface or the bus itself. As | |
| 593 | + * arbitration errors can not be singled out, no error frames are | |
| 594 | + * generated reporting this event as an arbitration error. | |
| 595 | + */ | |
| 596 | + if (sources & GRCAN_IRQ_TXLOSS) { | |
| 597 | + /* Take care of failed one-shot transmit */ | |
| 598 | + if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT) | |
| 599 | + grcan_lost_one_shot_frame(dev); | |
| 600 | + | |
| 601 | + /* Stop printing as soon as error passive or bus off is in | |
| 602 | + * effect to limit the amount of txloss debug printouts. | |
| 603 | + */ | |
| 604 | + if (!(status & GRCAN_STAT_ERRCTR_RELATED)) { | |
| 605 | + netdev_dbg(dev, "tx message lost\n"); | |
| 606 | + stats->tx_errors++; | |
| 607 | + } | |
| 608 | + } | |
| 609 | + | |
| 610 | + /* Conditions dealing with the error counters. There is no interrupt for | |
| 611 | + * error warning, but there are interrupts for increases of the error | |
| 612 | + * counters. | |
| 613 | + */ | |
| 614 | + if ((sources & GRCAN_IRQ_ERRCTR_RELATED) || | |
| 615 | + (status & GRCAN_STAT_ERRCTR_RELATED)) { | |
| 616 | + enum can_state state = priv->can.state; | |
| 617 | + enum can_state oldstate = state; | |
| 618 | + u32 txerr = (status & GRCAN_STAT_TXERRCNT) | |
| 619 | + >> GRCAN_STAT_TXERRCNT_BIT; | |
| 620 | + u32 rxerr = (status & GRCAN_STAT_RXERRCNT) | |
| 621 | + >> GRCAN_STAT_RXERRCNT_BIT; | |
| 622 | + | |
| 623 | + /* Figure out current state */ | |
| 624 | + if (status & GRCAN_STAT_OFF) { | |
| 625 | + state = CAN_STATE_BUS_OFF; | |
| 626 | + } else if (status & GRCAN_STAT_PASS) { | |
| 627 | + state = CAN_STATE_ERROR_PASSIVE; | |
| 628 | + } else if (txerr >= GRCAN_STAT_ERRCNT_WARNING_LIMIT || | |
| 629 | + rxerr >= GRCAN_STAT_ERRCNT_WARNING_LIMIT) { | |
| 630 | + state = CAN_STATE_ERROR_WARNING; | |
| 631 | + } else { | |
| 632 | + state = CAN_STATE_ERROR_ACTIVE; | |
| 633 | + } | |
| 634 | + | |
| 635 | + /* Handle and report state changes */ | |
| 636 | + if (state != oldstate) { | |
| 637 | + switch (state) { | |
| 638 | + case CAN_STATE_BUS_OFF: | |
| 639 | + netdev_dbg(dev, "bus-off\n"); | |
| 640 | + netif_carrier_off(dev); | |
| 641 | + priv->can.can_stats.bus_off++; | |
| 642 | + | |
| 643 | + /* Prevent the hardware from recovering from bus | |
| 644 | + * off on its own if restart is disabled. | |
| 645 | + */ | |
| 646 | + if (!priv->can.restart_ms) | |
| 647 | + grcan_stop_hardware(dev); | |
| 648 | + | |
| 649 | + cf.can_id |= CAN_ERR_BUSOFF; | |
| 650 | + break; | |
| 651 | + | |
| 652 | + case CAN_STATE_ERROR_PASSIVE: | |
| 653 | + netdev_dbg(dev, "Error passive condition\n"); | |
| 654 | + priv->can.can_stats.error_passive++; | |
| 655 | + | |
| 656 | + cf.can_id |= CAN_ERR_CRTL; | |
| 657 | + if (txerr >= GRCAN_STAT_ERRCNT_PASSIVE_LIMIT) | |
| 658 | + cf.data[1] |= CAN_ERR_CRTL_TX_PASSIVE; | |
| 659 | + if (rxerr >= GRCAN_STAT_ERRCNT_PASSIVE_LIMIT) | |
| 660 | + cf.data[1] |= CAN_ERR_CRTL_RX_PASSIVE; | |
| 661 | + break; | |
| 662 | + | |
| 663 | + case CAN_STATE_ERROR_WARNING: | |
| 664 | + netdev_dbg(dev, "Error warning condition\n"); | |
| 665 | + priv->can.can_stats.error_warning++; | |
| 666 | + | |
| 667 | + cf.can_id |= CAN_ERR_CRTL; | |
| 668 | + if (txerr >= GRCAN_STAT_ERRCNT_WARNING_LIMIT) | |
| 669 | + cf.data[1] |= CAN_ERR_CRTL_TX_WARNING; | |
| 670 | + if (rxerr >= GRCAN_STAT_ERRCNT_WARNING_LIMIT) | |
| 671 | + cf.data[1] |= CAN_ERR_CRTL_RX_WARNING; | |
| 672 | + break; | |
| 673 | + | |
| 674 | + case CAN_STATE_ERROR_ACTIVE: | |
| 675 | + netdev_dbg(dev, "Error active condition\n"); | |
| 676 | + cf.can_id |= CAN_ERR_CRTL; | |
| 677 | + break; | |
| 678 | + | |
| 679 | + default: | |
| 680 | + /* There are no others at this point */ | |
| 681 | + break; | |
| 682 | + } | |
| 683 | + cf.data[6] = txerr; | |
| 684 | + cf.data[7] = rxerr; | |
| 685 | + priv->can.state = state; | |
| 686 | + } | |
| 687 | + | |
| 688 | + /* Report automatic restarts */ | |
| 689 | + if (priv->can.restart_ms && oldstate == CAN_STATE_BUS_OFF) { | |
| 690 | + unsigned long flags; | |
| 691 | + | |
| 692 | + cf.can_id |= CAN_ERR_RESTARTED; | |
| 693 | + netdev_dbg(dev, "restarted\n"); | |
| 694 | + priv->can.can_stats.restarts++; | |
| 695 | + netif_carrier_on(dev); | |
| 696 | + | |
| 697 | + spin_lock_irqsave(&priv->lock, flags); | |
| 698 | + | |
| 699 | + if (!priv->resetting && !priv->closing) { | |
| 700 | + u32 txwr = grcan_read_reg(®s->txwr); | |
| 701 | + | |
| 702 | + if (grcan_txspace(dma->tx.size, txwr, | |
| 703 | + priv->eskbp)) | |
| 704 | + netif_wake_queue(dev); | |
| 705 | + } | |
| 706 | + | |
| 707 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 708 | + } | |
| 709 | + } | |
| 710 | + | |
| 711 | + /* Data overrun interrupt */ | |
| 712 | + if ((sources & GRCAN_IRQ_OR) || (status & GRCAN_STAT_OR)) { | |
| 713 | + netdev_dbg(dev, "got data overrun interrupt\n"); | |
| 714 | + stats->rx_over_errors++; | |
| 715 | + stats->rx_errors++; | |
| 716 | + | |
| 717 | + cf.can_id |= CAN_ERR_CRTL; | |
| 718 | + cf.data[1] |= CAN_ERR_CRTL_RX_OVERFLOW; | |
| 719 | + } | |
| 720 | + | |
| 721 | + /* AHB bus error interrupts (not CAN bus errors) - shut down the | |
| 722 | + * device. | |
| 723 | + */ | |
| 724 | + if (sources & (GRCAN_IRQ_TXAHBERR | GRCAN_IRQ_RXAHBERR) || | |
| 725 | + (status & GRCAN_STAT_AHBERR)) { | |
| 726 | + char *txrx = ""; | |
| 727 | + unsigned long flags; | |
| 728 | + | |
| 729 | + if (sources & GRCAN_IRQ_TXAHBERR) { | |
| 730 | + txrx = "on tx "; | |
| 731 | + stats->tx_errors++; | |
| 732 | + } else if (sources & GRCAN_IRQ_RXAHBERR) { | |
| 733 | + txrx = "on rx "; | |
| 734 | + stats->rx_errors++; | |
| 735 | + } | |
| 736 | + netdev_err(dev, "Fatal AHB buss error %s- halting device\n", | |
| 737 | + txrx); | |
| 738 | + | |
| 739 | + spin_lock_irqsave(&priv->lock, flags); | |
| 740 | + | |
| 741 | + /* Prevent anything to be enabled again and halt device */ | |
| 742 | + priv->closing = true; | |
| 743 | + netif_stop_queue(dev); | |
| 744 | + grcan_stop_hardware(dev); | |
| 745 | + priv->can.state = CAN_STATE_STOPPED; | |
| 746 | + | |
| 747 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 748 | + } | |
| 749 | + | |
| 750 | + /* Pass on error frame if something to report, | |
| 751 | + * i.e. id contains some information | |
| 752 | + */ | |
| 753 | + if (cf.can_id) { | |
| 754 | + struct can_frame *skb_cf; | |
| 755 | + struct sk_buff *skb = alloc_can_err_skb(dev, &skb_cf); | |
| 756 | + | |
| 757 | + if (skb == NULL) { | |
| 758 | + netdev_dbg(dev, "could not allocate error frame\n"); | |
| 759 | + return; | |
| 760 | + } | |
| 761 | + skb_cf->can_id |= cf.can_id; | |
| 762 | + memcpy(skb_cf->data, cf.data, sizeof(cf.data)); | |
| 763 | + | |
| 764 | + netif_rx(skb); | |
| 765 | + } | |
| 766 | +} | |
| 767 | + | |
| 768 | +static irqreturn_t grcan_interrupt(int irq, void *dev_id) | |
| 769 | +{ | |
| 770 | + struct net_device *dev = dev_id; | |
| 771 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 772 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 773 | + u32 sources, status; | |
| 774 | + | |
| 775 | + /* Find out the source */ | |
| 776 | + sources = grcan_read_reg(®s->pimsr); | |
| 777 | + if (!sources) | |
| 778 | + return IRQ_NONE; | |
| 779 | + grcan_write_reg(®s->picr, sources); | |
| 780 | + status = grcan_read_reg(®s->stat); | |
| 781 | + | |
| 782 | + /* If we got TX progress, the device has not hanged, | |
| 783 | + * so disable the hang timer | |
| 784 | + */ | |
| 785 | + if (priv->need_txbug_workaround && | |
| 786 | + (sources & (GRCAN_IRQ_TX | GRCAN_IRQ_TXLOSS))) { | |
| 787 | + del_timer(&priv->hang_timer); | |
| 788 | + } | |
| 789 | + | |
| 790 | + /* Frame(s) received or transmitted */ | |
| 791 | + if (sources & (GRCAN_IRQ_TX | GRCAN_IRQ_RX)) { | |
| 792 | + /* Disable tx/rx interrupts and schedule poll(). No need for | |
| 793 | + * locking as interference from a running reset at worst leads | |
| 794 | + * to an extra interrupt. | |
| 795 | + */ | |
| 796 | + grcan_clear_bits(®s->imr, GRCAN_IRQ_TX | GRCAN_IRQ_RX); | |
| 797 | + napi_schedule(&priv->napi); | |
| 798 | + } | |
| 799 | + | |
| 800 | + /* (Potential) error conditions to take care of */ | |
| 801 | + if (sources & GRCAN_IRQ_ERRORS) | |
| 802 | + grcan_err(dev, sources, status); | |
| 803 | + | |
| 804 | + return IRQ_HANDLED; | |
| 805 | +} | |
| 806 | + | |
| 807 | +/* Reset device and restart operations from where they were. | |
| 808 | + * | |
| 809 | + * This assumes that RXCTRL & RXCTRL is properly disabled and that RX | |
| 810 | + * is not ONGOING (TX might be stuck in ONGOING due to a harwrware bug | |
| 811 | + * for single shot) | |
| 812 | + */ | |
| 813 | +static void grcan_running_reset(unsigned long data) | |
| 814 | +{ | |
| 815 | + struct net_device *dev = (struct net_device *)data; | |
| 816 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 817 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 818 | + unsigned long flags; | |
| 819 | + | |
| 820 | + /* This temporarily messes with eskbp, so we need to lock | |
| 821 | + * priv->lock | |
| 822 | + */ | |
| 823 | + spin_lock_irqsave(&priv->lock, flags); | |
| 824 | + | |
| 825 | + priv->resetting = false; | |
| 826 | + del_timer(&priv->hang_timer); | |
| 827 | + del_timer(&priv->rr_timer); | |
| 828 | + | |
| 829 | + if (!priv->closing) { | |
| 830 | + /* Save and reset - config register preserved by grcan_reset */ | |
| 831 | + u32 imr = grcan_read_reg(®s->imr); | |
| 832 | + | |
| 833 | + u32 txaddr = grcan_read_reg(®s->txaddr); | |
| 834 | + u32 txsize = grcan_read_reg(®s->txsize); | |
| 835 | + u32 txwr = grcan_read_reg(®s->txwr); | |
| 836 | + u32 txrd = grcan_read_reg(®s->txrd); | |
| 837 | + u32 eskbp = priv->eskbp; | |
| 838 | + | |
| 839 | + u32 rxaddr = grcan_read_reg(®s->rxaddr); | |
| 840 | + u32 rxsize = grcan_read_reg(®s->rxsize); | |
| 841 | + u32 rxwr = grcan_read_reg(®s->rxwr); | |
| 842 | + u32 rxrd = grcan_read_reg(®s->rxrd); | |
| 843 | + | |
| 844 | + grcan_reset(dev); | |
| 845 | + | |
| 846 | + /* Restore */ | |
| 847 | + grcan_write_reg(®s->txaddr, txaddr); | |
| 848 | + grcan_write_reg(®s->txsize, txsize); | |
| 849 | + grcan_write_reg(®s->txwr, txwr); | |
| 850 | + grcan_write_reg(®s->txrd, txrd); | |
| 851 | + priv->eskbp = eskbp; | |
| 852 | + | |
| 853 | + grcan_write_reg(®s->rxaddr, rxaddr); | |
| 854 | + grcan_write_reg(®s->rxsize, rxsize); | |
| 855 | + grcan_write_reg(®s->rxwr, rxwr); | |
| 856 | + grcan_write_reg(®s->rxrd, rxrd); | |
| 857 | + | |
| 858 | + /* Turn on device again */ | |
| 859 | + grcan_write_reg(®s->imr, imr); | |
| 860 | + priv->can.state = CAN_STATE_ERROR_ACTIVE; | |
| 861 | + grcan_write_reg(®s->txctrl, GRCAN_TXCTRL_ENABLE | |
| 862 | + | (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT | |
| 863 | + ? GRCAN_TXCTRL_SINGLE : 0)); | |
| 864 | + grcan_write_reg(®s->rxctrl, GRCAN_RXCTRL_ENABLE); | |
| 865 | + grcan_write_reg(®s->ctrl, GRCAN_CTRL_ENABLE); | |
| 866 | + | |
| 867 | + /* Start queue if there is size and listen-onle mode is not | |
| 868 | + * enabled | |
| 869 | + */ | |
| 870 | + if (grcan_txspace(priv->dma.tx.size, txwr, priv->eskbp) && | |
| 871 | + !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) | |
| 872 | + netif_wake_queue(dev); | |
| 873 | + } | |
| 874 | + | |
| 875 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 876 | + | |
| 877 | + netdev_err(dev, "Device reset and restored\n"); | |
| 878 | +} | |
| 879 | + | |
| 880 | +/* Waiting time in usecs corresponding to the transmission of three maximum | |
| 881 | + * sized can frames in the given bitrate (in bits/sec). Waiting for this amount | |
| 882 | + * of time makes sure that the can controller have time to finish sending or | |
| 883 | + * receiving a frame with a good margin. | |
| 884 | + * | |
| 885 | + * usecs/sec * number of frames * bits/frame / bits/sec | |
| 886 | + */ | |
| 887 | +static inline u32 grcan_ongoing_wait_usecs(__u32 bitrate) | |
| 888 | +{ | |
| 889 | + return 1000000 * 3 * GRCAN_EFF_FRAME_MAX_BITS / bitrate; | |
| 890 | +} | |
| 891 | + | |
| 892 | +/* Set timer so that it will not fire until after a period in which the can | |
| 893 | + * controller have a good margin to finish transmitting a frame unless it has | |
| 894 | + * hanged | |
| 895 | + */ | |
| 896 | +static inline void grcan_reset_timer(struct timer_list *timer, __u32 bitrate) | |
| 897 | +{ | |
| 898 | + u32 wait_jiffies = usecs_to_jiffies(grcan_ongoing_wait_usecs(bitrate)); | |
| 899 | + | |
| 900 | + mod_timer(timer, jiffies + wait_jiffies); | |
| 901 | +} | |
| 902 | + | |
| 903 | +/* Disable channels and schedule a running reset */ | |
| 904 | +static void grcan_initiate_running_reset(unsigned long data) | |
| 905 | +{ | |
| 906 | + struct net_device *dev = (struct net_device *)data; | |
| 907 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 908 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 909 | + unsigned long flags; | |
| 910 | + | |
| 911 | + netdev_err(dev, "Device seems hanged - reset scheduled\n"); | |
| 912 | + | |
| 913 | + spin_lock_irqsave(&priv->lock, flags); | |
| 914 | + | |
| 915 | + /* The main body of this function must never be executed again | |
| 916 | + * until after an execution of grcan_running_reset | |
| 917 | + */ | |
| 918 | + if (!priv->resetting && !priv->closing) { | |
| 919 | + priv->resetting = true; | |
| 920 | + netif_stop_queue(dev); | |
| 921 | + grcan_clear_bits(®s->txctrl, GRCAN_TXCTRL_ENABLE); | |
| 922 | + grcan_clear_bits(®s->rxctrl, GRCAN_RXCTRL_ENABLE); | |
| 923 | + grcan_reset_timer(&priv->rr_timer, priv->can.bittiming.bitrate); | |
| 924 | + } | |
| 925 | + | |
| 926 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 927 | +} | |
| 928 | + | |
| 929 | +static void grcan_free_dma_buffers(struct net_device *dev) | |
| 930 | +{ | |
| 931 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 932 | + struct grcan_dma *dma = &priv->dma; | |
| 933 | + | |
| 934 | + dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf, | |
| 935 | + dma->base_handle); | |
| 936 | + memset(dma, 0, sizeof(*dma)); | |
| 937 | +} | |
| 938 | + | |
| 939 | +static int grcan_allocate_dma_buffers(struct net_device *dev, | |
| 940 | + size_t tsize, size_t rsize) | |
| 941 | +{ | |
| 942 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 943 | + struct grcan_dma *dma = &priv->dma; | |
| 944 | + struct grcan_dma_buffer *large = rsize > tsize ? &dma->rx : &dma->tx; | |
| 945 | + struct grcan_dma_buffer *small = rsize > tsize ? &dma->tx : &dma->rx; | |
| 946 | + size_t shift; | |
| 947 | + | |
| 948 | + /* Need a whole number of GRCAN_BUFFER_ALIGNMENT for the large, | |
| 949 | + * i.e. first buffer | |
| 950 | + */ | |
| 951 | + size_t maxs = max(tsize, rsize); | |
| 952 | + size_t lsize = ALIGN(maxs, GRCAN_BUFFER_ALIGNMENT); | |
| 953 | + | |
| 954 | + /* Put the small buffer after that */ | |
| 955 | + size_t ssize = min(tsize, rsize); | |
| 956 | + | |
| 957 | + /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */ | |
| 958 | + dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT; | |
| 959 | + dma->base_buf = dma_alloc_coherent(&dev->dev, | |
| 960 | + dma->base_size, | |
| 961 | + &dma->base_handle, | |
| 962 | + GFP_KERNEL); | |
| 963 | + | |
| 964 | + if (!dma->base_buf) | |
| 965 | + return -ENOMEM; | |
| 966 | + | |
| 967 | + dma->tx.size = tsize; | |
| 968 | + dma->rx.size = rsize; | |
| 969 | + | |
| 970 | + large->handle = ALIGN(dma->base_handle, GRCAN_BUFFER_ALIGNMENT); | |
| 971 | + small->handle = large->handle + lsize; | |
| 972 | + shift = large->handle - dma->base_handle; | |
| 973 | + | |
| 974 | + large->buf = dma->base_buf + shift; | |
| 975 | + small->buf = large->buf + lsize; | |
| 976 | + | |
| 977 | + return 0; | |
| 978 | +} | |
| 979 | + | |
| 980 | +/* priv->lock *must* be held when calling this function */ | |
| 981 | +static int grcan_start(struct net_device *dev) | |
| 982 | +{ | |
| 983 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 984 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 985 | + u32 confop, txctrl; | |
| 986 | + | |
| 987 | + grcan_reset(dev); | |
| 988 | + | |
| 989 | + grcan_write_reg(®s->txaddr, priv->dma.tx.handle); | |
| 990 | + grcan_write_reg(®s->txsize, priv->dma.tx.size); | |
| 991 | + /* regs->txwr, regs->txrd and priv->eskbp already set to 0 by reset */ | |
| 992 | + | |
| 993 | + grcan_write_reg(®s->rxaddr, priv->dma.rx.handle); | |
| 994 | + grcan_write_reg(®s->rxsize, priv->dma.rx.size); | |
| 995 | + /* regs->rxwr and regs->rxrd already set to 0 by reset */ | |
| 996 | + | |
| 997 | + /* Enable interrupts */ | |
| 998 | + grcan_read_reg(®s->pir); | |
| 999 | + grcan_write_reg(®s->imr, GRCAN_IRQ_DEFAULT); | |
| 1000 | + | |
| 1001 | + /* Enable interfaces, channels and device */ | |
| 1002 | + confop = GRCAN_CONF_ABORT | |
| 1003 | + | (priv->config.enable0 ? GRCAN_CONF_ENABLE0 : 0) | |
| 1004 | + | (priv->config.enable1 ? GRCAN_CONF_ENABLE1 : 0) | |
| 1005 | + | (priv->config.select ? GRCAN_CONF_SELECT : 0) | |
| 1006 | + | (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY ? | |
| 1007 | + GRCAN_CONF_SILENT : 0) | |
| 1008 | + | (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES ? | |
| 1009 | + GRCAN_CONF_SAM : 0); | |
| 1010 | + grcan_write_bits(®s->conf, confop, GRCAN_CONF_OPERATION); | |
| 1011 | + txctrl = GRCAN_TXCTRL_ENABLE | |
| 1012 | + | (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT | |
| 1013 | + ? GRCAN_TXCTRL_SINGLE : 0); | |
| 1014 | + grcan_write_reg(®s->txctrl, txctrl); | |
| 1015 | + grcan_write_reg(®s->rxctrl, GRCAN_RXCTRL_ENABLE); | |
| 1016 | + grcan_write_reg(®s->ctrl, GRCAN_CTRL_ENABLE); | |
| 1017 | + | |
| 1018 | + priv->can.state = CAN_STATE_ERROR_ACTIVE; | |
| 1019 | + | |
| 1020 | + return 0; | |
| 1021 | +} | |
| 1022 | + | |
| 1023 | +static int grcan_set_mode(struct net_device *dev, enum can_mode mode) | |
| 1024 | +{ | |
| 1025 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1026 | + unsigned long flags; | |
| 1027 | + int err = 0; | |
| 1028 | + | |
| 1029 | + if (mode == CAN_MODE_START) { | |
| 1030 | + /* This might be called to restart the device to recover from | |
| 1031 | + * bus off errors | |
| 1032 | + */ | |
| 1033 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1034 | + if (priv->closing || priv->resetting) { | |
| 1035 | + err = -EBUSY; | |
| 1036 | + } else { | |
| 1037 | + netdev_info(dev, "Restarting device\n"); | |
| 1038 | + grcan_start(dev); | |
| 1039 | + if (!(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) | |
| 1040 | + netif_wake_queue(dev); | |
| 1041 | + } | |
| 1042 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1043 | + return err; | |
| 1044 | + } | |
| 1045 | + return -EOPNOTSUPP; | |
| 1046 | +} | |
| 1047 | + | |
| 1048 | +static int grcan_open(struct net_device *dev) | |
| 1049 | +{ | |
| 1050 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1051 | + struct grcan_dma *dma = &priv->dma; | |
| 1052 | + unsigned long flags; | |
| 1053 | + int err; | |
| 1054 | + | |
| 1055 | + /* Allocate memory */ | |
| 1056 | + err = grcan_allocate_dma_buffers(dev, priv->config.txsize, | |
| 1057 | + priv->config.rxsize); | |
| 1058 | + if (err) { | |
| 1059 | + netdev_err(dev, "could not allocate DMA buffers\n"); | |
| 1060 | + return err; | |
| 1061 | + } | |
| 1062 | + | |
| 1063 | + priv->echo_skb = kzalloc(dma->tx.size * sizeof(*priv->echo_skb), | |
| 1064 | + GFP_KERNEL); | |
| 1065 | + if (!priv->echo_skb) { | |
| 1066 | + err = -ENOMEM; | |
| 1067 | + goto exit_free_dma_buffers; | |
| 1068 | + } | |
| 1069 | + priv->can.echo_skb_max = dma->tx.size; | |
| 1070 | + priv->can.echo_skb = priv->echo_skb; | |
| 1071 | + | |
| 1072 | + priv->txdlc = kzalloc(dma->tx.size * sizeof(*priv->txdlc), GFP_KERNEL); | |
| 1073 | + if (!priv->txdlc) { | |
| 1074 | + err = -ENOMEM; | |
| 1075 | + goto exit_free_echo_skb; | |
| 1076 | + } | |
| 1077 | + | |
| 1078 | + /* Get can device up */ | |
| 1079 | + err = open_candev(dev); | |
| 1080 | + if (err) | |
| 1081 | + goto exit_free_txdlc; | |
| 1082 | + | |
| 1083 | + err = request_irq(dev->irq, grcan_interrupt, IRQF_SHARED, | |
| 1084 | + dev->name, dev); | |
| 1085 | + if (err) | |
| 1086 | + goto exit_close_candev; | |
| 1087 | + | |
| 1088 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1089 | + | |
| 1090 | + napi_enable(&priv->napi); | |
| 1091 | + grcan_start(dev); | |
| 1092 | + if (!(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) | |
| 1093 | + netif_start_queue(dev); | |
| 1094 | + priv->resetting = false; | |
| 1095 | + priv->closing = false; | |
| 1096 | + | |
| 1097 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1098 | + | |
| 1099 | + return 0; | |
| 1100 | + | |
| 1101 | +exit_close_candev: | |
| 1102 | + close_candev(dev); | |
| 1103 | +exit_free_txdlc: | |
| 1104 | + kfree(priv->txdlc); | |
| 1105 | +exit_free_echo_skb: | |
| 1106 | + kfree(priv->echo_skb); | |
| 1107 | +exit_free_dma_buffers: | |
| 1108 | + grcan_free_dma_buffers(dev); | |
| 1109 | + return err; | |
| 1110 | +} | |
| 1111 | + | |
| 1112 | +static int grcan_close(struct net_device *dev) | |
| 1113 | +{ | |
| 1114 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1115 | + unsigned long flags; | |
| 1116 | + | |
| 1117 | + napi_disable(&priv->napi); | |
| 1118 | + | |
| 1119 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1120 | + | |
| 1121 | + priv->closing = true; | |
| 1122 | + if (priv->need_txbug_workaround) { | |
| 1123 | + del_timer_sync(&priv->hang_timer); | |
| 1124 | + del_timer_sync(&priv->rr_timer); | |
| 1125 | + } | |
| 1126 | + netif_stop_queue(dev); | |
| 1127 | + grcan_stop_hardware(dev); | |
| 1128 | + priv->can.state = CAN_STATE_STOPPED; | |
| 1129 | + | |
| 1130 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1131 | + | |
| 1132 | + free_irq(dev->irq, dev); | |
| 1133 | + close_candev(dev); | |
| 1134 | + | |
| 1135 | + grcan_free_dma_buffers(dev); | |
| 1136 | + priv->can.echo_skb_max = 0; | |
| 1137 | + priv->can.echo_skb = NULL; | |
| 1138 | + kfree(priv->echo_skb); | |
| 1139 | + kfree(priv->txdlc); | |
| 1140 | + | |
| 1141 | + return 0; | |
| 1142 | +} | |
| 1143 | + | |
| 1144 | +static int grcan_transmit_catch_up(struct net_device *dev, int budget) | |
| 1145 | +{ | |
| 1146 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1147 | + unsigned long flags; | |
| 1148 | + int work_done; | |
| 1149 | + | |
| 1150 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1151 | + | |
| 1152 | + work_done = catch_up_echo_skb(dev, budget, true); | |
| 1153 | + if (work_done) { | |
| 1154 | + if (!priv->resetting && !priv->closing && | |
| 1155 | + !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) | |
| 1156 | + netif_wake_queue(dev); | |
| 1157 | + | |
| 1158 | + /* With napi we don't get TX interrupts for a while, | |
| 1159 | + * so prevent a running reset while catching up | |
| 1160 | + */ | |
| 1161 | + if (priv->need_txbug_workaround) | |
| 1162 | + del_timer(&priv->hang_timer); | |
| 1163 | + } | |
| 1164 | + | |
| 1165 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1166 | + | |
| 1167 | + return work_done; | |
| 1168 | +} | |
| 1169 | + | |
| 1170 | +static int grcan_receive(struct net_device *dev, int budget) | |
| 1171 | +{ | |
| 1172 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1173 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 1174 | + struct grcan_dma *dma = &priv->dma; | |
| 1175 | + struct net_device_stats *stats = &dev->stats; | |
| 1176 | + struct can_frame *cf; | |
| 1177 | + struct sk_buff *skb; | |
| 1178 | + u32 wr, rd, startrd; | |
| 1179 | + u32 *slot; | |
| 1180 | + u32 i, rtr, eff, j, shift; | |
| 1181 | + int work_done = 0; | |
| 1182 | + | |
| 1183 | + rd = grcan_read_reg(®s->rxrd); | |
| 1184 | + startrd = rd; | |
| 1185 | + for (work_done = 0; work_done < budget; work_done++) { | |
| 1186 | + /* Check for packet to receive */ | |
| 1187 | + wr = grcan_read_reg(®s->rxwr); | |
| 1188 | + if (rd == wr) | |
| 1189 | + break; | |
| 1190 | + | |
| 1191 | + /* Take care of packet */ | |
| 1192 | + skb = alloc_can_skb(dev, &cf); | |
| 1193 | + if (skb == NULL) { | |
| 1194 | + netdev_err(dev, | |
| 1195 | + "dropping frame: skb allocation failed\n"); | |
| 1196 | + stats->rx_dropped++; | |
| 1197 | + continue; | |
| 1198 | + } | |
| 1199 | + | |
| 1200 | + slot = dma->rx.buf + rd; | |
| 1201 | + eff = slot[0] & GRCAN_MSG_IDE; | |
| 1202 | + rtr = slot[0] & GRCAN_MSG_RTR; | |
| 1203 | + if (eff) { | |
| 1204 | + cf->can_id = ((slot[0] & GRCAN_MSG_EID) | |
| 1205 | + >> GRCAN_MSG_EID_BIT); | |
| 1206 | + cf->can_id |= CAN_EFF_FLAG; | |
| 1207 | + } else { | |
| 1208 | + cf->can_id = ((slot[0] & GRCAN_MSG_BID) | |
| 1209 | + >> GRCAN_MSG_BID_BIT); | |
| 1210 | + } | |
| 1211 | + cf->can_dlc = get_can_dlc((slot[1] & GRCAN_MSG_DLC) | |
| 1212 | + >> GRCAN_MSG_DLC_BIT); | |
| 1213 | + if (rtr) { | |
| 1214 | + cf->can_id |= CAN_RTR_FLAG; | |
| 1215 | + } else { | |
| 1216 | + for (i = 0; i < cf->can_dlc; i++) { | |
| 1217 | + j = GRCAN_MSG_DATA_SLOT_INDEX(i); | |
| 1218 | + shift = GRCAN_MSG_DATA_SHIFT(i); | |
| 1219 | + cf->data[i] = (u8)(slot[j] >> shift); | |
| 1220 | + } | |
| 1221 | + } | |
| 1222 | + netif_receive_skb(skb); | |
| 1223 | + | |
| 1224 | + /* Update statistics and read pointer */ | |
| 1225 | + stats->rx_packets++; | |
| 1226 | + stats->rx_bytes += cf->can_dlc; | |
| 1227 | + rd = grcan_ring_add(rd, GRCAN_MSG_SIZE, dma->rx.size); | |
| 1228 | + } | |
| 1229 | + | |
| 1230 | + /* Make sure everything is read before allowing hardware to | |
| 1231 | + * use the memory | |
| 1232 | + */ | |
| 1233 | + mb(); | |
| 1234 | + | |
| 1235 | + /* Update read pointer - no need to check for ongoing */ | |
| 1236 | + if (likely(rd != startrd)) | |
| 1237 | + grcan_write_reg(®s->rxrd, rd); | |
| 1238 | + | |
| 1239 | + return work_done; | |
| 1240 | +} | |
| 1241 | + | |
| 1242 | +static int grcan_poll(struct napi_struct *napi, int budget) | |
| 1243 | +{ | |
| 1244 | + struct grcan_priv *priv = container_of(napi, struct grcan_priv, napi); | |
| 1245 | + struct net_device *dev = priv->dev; | |
| 1246 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 1247 | + unsigned long flags; | |
| 1248 | + int tx_work_done, rx_work_done; | |
| 1249 | + int rx_budget = budget / 2; | |
| 1250 | + int tx_budget = budget - rx_budget; | |
| 1251 | + | |
| 1252 | + /* Half of the budget for receiveing messages */ | |
| 1253 | + rx_work_done = grcan_receive(dev, rx_budget); | |
| 1254 | + | |
| 1255 | + /* Half of the budget for transmitting messages as that can trigger echo | |
| 1256 | + * frames being received | |
| 1257 | + */ | |
| 1258 | + tx_work_done = grcan_transmit_catch_up(dev, tx_budget); | |
| 1259 | + | |
| 1260 | + if (rx_work_done < rx_budget && tx_work_done < tx_budget) { | |
| 1261 | + napi_complete(napi); | |
| 1262 | + | |
| 1263 | + /* Guarantee no interference with a running reset that otherwise | |
| 1264 | + * could turn off interrupts. | |
| 1265 | + */ | |
| 1266 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1267 | + | |
| 1268 | + /* Enable tx and rx interrupts again. No need to check | |
| 1269 | + * priv->closing as napi_disable in grcan_close is waiting for | |
| 1270 | + * scheduled napi calls to finish. | |
| 1271 | + */ | |
| 1272 | + grcan_set_bits(®s->imr, GRCAN_IRQ_TX | GRCAN_IRQ_RX); | |
| 1273 | + | |
| 1274 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1275 | + } | |
| 1276 | + | |
| 1277 | + return rx_work_done + tx_work_done; | |
| 1278 | +} | |
| 1279 | + | |
| 1280 | +/* Work tx bug by waiting while for the risky situation to clear. If that fails, | |
| 1281 | + * drop a frame in one-shot mode or indicate a busy device otherwise. | |
| 1282 | + * | |
| 1283 | + * Returns 0 on successful wait. Otherwise it sets *netdev_tx_status to the | |
| 1284 | + * value that should be returned by grcan_start_xmit when aborting the xmit. | |
| 1285 | + */ | |
| 1286 | +static int grcan_txbug_workaround(struct net_device *dev, struct sk_buff *skb, | |
| 1287 | + u32 txwr, u32 oneshotmode, | |
| 1288 | + netdev_tx_t *netdev_tx_status) | |
| 1289 | +{ | |
| 1290 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1291 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 1292 | + struct grcan_dma *dma = &priv->dma; | |
| 1293 | + int i; | |
| 1294 | + unsigned long flags; | |
| 1295 | + | |
| 1296 | + /* Wait a while for ongoing to be cleared or read pointer to catch up to | |
| 1297 | + * write pointer. The latter is needed due to a bug in older versions of | |
| 1298 | + * GRCAN in which ONGOING is not cleared properly one-shot mode when a | |
| 1299 | + * transmission fails. | |
| 1300 | + */ | |
| 1301 | + for (i = 0; i < GRCAN_SHORTWAIT_USECS; i++) { | |
| 1302 | + udelay(1); | |
| 1303 | + if (!grcan_read_bits(®s->txctrl, GRCAN_TXCTRL_ONGOING) || | |
| 1304 | + grcan_read_reg(®s->txrd) == txwr) { | |
| 1305 | + return 0; | |
| 1306 | + } | |
| 1307 | + } | |
| 1308 | + | |
| 1309 | + /* Clean up, in case the situation was not resolved */ | |
| 1310 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1311 | + if (!priv->resetting && !priv->closing) { | |
| 1312 | + /* Queue might have been stopped earlier in grcan_start_xmit */ | |
| 1313 | + if (grcan_txspace(dma->tx.size, txwr, priv->eskbp)) | |
| 1314 | + netif_wake_queue(dev); | |
| 1315 | + /* Set a timer to resolve a hanged tx controller */ | |
| 1316 | + if (!timer_pending(&priv->hang_timer)) | |
| 1317 | + grcan_reset_timer(&priv->hang_timer, | |
| 1318 | + priv->can.bittiming.bitrate); | |
| 1319 | + } | |
| 1320 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1321 | + | |
| 1322 | + if (oneshotmode) { | |
| 1323 | + /* In one-shot mode we should never end up here because | |
| 1324 | + * then the interrupt handler increases txrd on TXLOSS, | |
| 1325 | + * but it is consistent with one-shot mode to drop the | |
| 1326 | + * frame in this case. | |
| 1327 | + */ | |
| 1328 | + kfree_skb(skb); | |
| 1329 | + *netdev_tx_status = NETDEV_TX_OK; | |
| 1330 | + } else { | |
| 1331 | + /* In normal mode the socket-can transmission queue get | |
| 1332 | + * to keep the frame so that it can be retransmitted | |
| 1333 | + * later | |
| 1334 | + */ | |
| 1335 | + *netdev_tx_status = NETDEV_TX_BUSY; | |
| 1336 | + } | |
| 1337 | + return -EBUSY; | |
| 1338 | +} | |
| 1339 | + | |
| 1340 | +/* Notes on the tx cyclic buffer handling: | |
| 1341 | + * | |
| 1342 | + * regs->txwr - the next slot for the driver to put data to be sent | |
| 1343 | + * regs->txrd - the next slot for the device to read data | |
| 1344 | + * priv->eskbp - the next slot for the driver to call can_put_echo_skb for | |
| 1345 | + * | |
| 1346 | + * grcan_start_xmit can enter more messages as long as regs->txwr does | |
| 1347 | + * not reach priv->eskbp (within 1 message gap) | |
| 1348 | + * | |
| 1349 | + * The device sends messages until regs->txrd reaches regs->txwr | |
| 1350 | + * | |
| 1351 | + * The interrupt calls handler calls can_put_echo_skb until | |
| 1352 | + * priv->eskbp reaches regs->txrd | |
| 1353 | + */ | |
| 1354 | +static netdev_tx_t grcan_start_xmit(struct sk_buff *skb, | |
| 1355 | + struct net_device *dev) | |
| 1356 | +{ | |
| 1357 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1358 | + struct grcan_registers __iomem *regs = priv->regs; | |
| 1359 | + struct grcan_dma *dma = &priv->dma; | |
| 1360 | + struct can_frame *cf = (struct can_frame *)skb->data; | |
| 1361 | + u32 id, txwr, txrd, space, txctrl; | |
| 1362 | + int slotindex; | |
| 1363 | + u32 *slot; | |
| 1364 | + u32 i, rtr, eff, dlc, tmp, err; | |
| 1365 | + int j, shift; | |
| 1366 | + unsigned long flags; | |
| 1367 | + u32 oneshotmode = priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT; | |
| 1368 | + | |
| 1369 | + if (can_dropped_invalid_skb(dev, skb)) | |
| 1370 | + return NETDEV_TX_OK; | |
| 1371 | + | |
| 1372 | + /* Trying to transmit in silent mode will generate error interrupts, but | |
| 1373 | + * this should never happen - the queue should not have been started. | |
| 1374 | + */ | |
| 1375 | + if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) | |
| 1376 | + return NETDEV_TX_BUSY; | |
| 1377 | + | |
| 1378 | + /* Reads of priv->eskbp and shut-downs of the queue needs to | |
| 1379 | + * be atomic towards the updates to priv->eskbp and wake-ups | |
| 1380 | + * of the queue in the interrupt handler. | |
| 1381 | + */ | |
| 1382 | + spin_lock_irqsave(&priv->lock, flags); | |
| 1383 | + | |
| 1384 | + txwr = grcan_read_reg(®s->txwr); | |
| 1385 | + space = grcan_txspace(dma->tx.size, txwr, priv->eskbp); | |
| 1386 | + | |
| 1387 | + slotindex = txwr / GRCAN_MSG_SIZE; | |
| 1388 | + slot = dma->tx.buf + txwr; | |
| 1389 | + | |
| 1390 | + if (unlikely(space == 1)) | |
| 1391 | + netif_stop_queue(dev); | |
| 1392 | + | |
| 1393 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 1394 | + /* End of critical section*/ | |
| 1395 | + | |
| 1396 | + /* This should never happen. If circular buffer is full, the | |
| 1397 | + * netif_stop_queue should have been stopped already. | |
| 1398 | + */ | |
| 1399 | + if (unlikely(!space)) { | |
| 1400 | + netdev_err(dev, "No buffer space, but queue is non-stopped.\n"); | |
| 1401 | + return NETDEV_TX_BUSY; | |
| 1402 | + } | |
| 1403 | + | |
| 1404 | + /* Convert and write CAN message to DMA buffer */ | |
| 1405 | + eff = cf->can_id & CAN_EFF_FLAG; | |
| 1406 | + rtr = cf->can_id & CAN_RTR_FLAG; | |
| 1407 | + id = cf->can_id & (eff ? CAN_EFF_MASK : CAN_SFF_MASK); | |
| 1408 | + dlc = cf->can_dlc; | |
| 1409 | + if (eff) | |
| 1410 | + tmp = (id << GRCAN_MSG_EID_BIT) & GRCAN_MSG_EID; | |
| 1411 | + else | |
| 1412 | + tmp = (id << GRCAN_MSG_BID_BIT) & GRCAN_MSG_BID; | |
| 1413 | + slot[0] = (eff ? GRCAN_MSG_IDE : 0) | (rtr ? GRCAN_MSG_RTR : 0) | tmp; | |
| 1414 | + | |
| 1415 | + slot[1] = ((dlc << GRCAN_MSG_DLC_BIT) & GRCAN_MSG_DLC); | |
| 1416 | + slot[2] = 0; | |
| 1417 | + slot[3] = 0; | |
| 1418 | + for (i = 0; i < dlc; i++) { | |
| 1419 | + j = GRCAN_MSG_DATA_SLOT_INDEX(i); | |
| 1420 | + shift = GRCAN_MSG_DATA_SHIFT(i); | |
| 1421 | + slot[j] |= cf->data[i] << shift; | |
| 1422 | + } | |
| 1423 | + | |
| 1424 | + /* Checking that channel has not been disabled. These cases | |
| 1425 | + * should never happen | |
| 1426 | + */ | |
| 1427 | + txctrl = grcan_read_reg(®s->txctrl); | |
| 1428 | + if (!(txctrl & GRCAN_TXCTRL_ENABLE)) | |
| 1429 | + netdev_err(dev, "tx channel spuriously disabled\n"); | |
| 1430 | + | |
| 1431 | + if (oneshotmode && !(txctrl & GRCAN_TXCTRL_SINGLE)) | |
| 1432 | + netdev_err(dev, "one-shot mode spuriously disabled\n"); | |
| 1433 | + | |
| 1434 | + /* Bug workaround for old version of grcan where updating txwr | |
| 1435 | + * in the same clock cycle as the controller updates txrd to | |
| 1436 | + * the current txwr could hang the can controller | |
| 1437 | + */ | |
| 1438 | + if (priv->need_txbug_workaround) { | |
| 1439 | + txrd = grcan_read_reg(®s->txrd); | |
| 1440 | + if (unlikely(grcan_ring_sub(txwr, txrd, dma->tx.size) == 1)) { | |
| 1441 | + netdev_tx_t txstatus; | |
| 1442 | + | |
| 1443 | + err = grcan_txbug_workaround(dev, skb, txwr, | |
| 1444 | + oneshotmode, &txstatus); | |
| 1445 | + if (err) | |
| 1446 | + return txstatus; | |
| 1447 | + } | |
| 1448 | + } | |
| 1449 | + | |
| 1450 | + /* Prepare skb for echoing. This must be after the bug workaround above | |
| 1451 | + * as ownership of the skb is passed on by calling can_put_echo_skb. | |
| 1452 | + * Returning NETDEV_TX_BUSY or accessing skb or cf after a call to | |
| 1453 | + * can_put_echo_skb would be an error unless other measures are | |
| 1454 | + * taken. | |
| 1455 | + */ | |
| 1456 | + priv->txdlc[slotindex] = cf->can_dlc; /* Store dlc for statistics */ | |
| 1457 | + can_put_echo_skb(skb, dev, slotindex); | |
| 1458 | + | |
| 1459 | + /* Make sure everything is written before allowing hardware to | |
| 1460 | + * read from the memory | |
| 1461 | + */ | |
| 1462 | + wmb(); | |
| 1463 | + | |
| 1464 | + /* Update write pointer to start transmission */ | |
| 1465 | + grcan_write_reg(®s->txwr, | |
| 1466 | + grcan_ring_add(txwr, GRCAN_MSG_SIZE, dma->tx.size)); | |
| 1467 | + | |
| 1468 | + return NETDEV_TX_OK; | |
| 1469 | +} | |
| 1470 | + | |
| 1471 | +/* ========== Setting up sysfs interface and module parameters ========== */ | |
| 1472 | + | |
| 1473 | +#define GRCAN_NOT_BOOL(unsigned_val) ((unsigned_val) > 1) | |
| 1474 | + | |
| 1475 | +#define GRCAN_MODULE_PARAM(name, mtype, valcheckf, desc) \ | |
| 1476 | + static void grcan_sanitize_##name(struct platform_device *pd) \ | |
| 1477 | + { \ | |
| 1478 | + struct grcan_device_config grcan_default_config \ | |
| 1479 | + = GRCAN_DEFAULT_DEVICE_CONFIG; \ | |
| 1480 | + if (valcheckf(grcan_module_config.name)) { \ | |
| 1481 | + dev_err(&pd->dev, \ | |
| 1482 | + "Invalid module parameter value for " \ | |
| 1483 | + #name " - setting default\n"); \ | |
| 1484 | + grcan_module_config.name = \ | |
| 1485 | + grcan_default_config.name; \ | |
| 1486 | + } \ | |
| 1487 | + } \ | |
| 1488 | + module_param_named(name, grcan_module_config.name, \ | |
| 1489 | + mtype, S_IRUGO); \ | |
| 1490 | + MODULE_PARM_DESC(name, desc) | |
| 1491 | + | |
| 1492 | +#define GRCAN_CONFIG_ATTR(name, desc) \ | |
| 1493 | + static ssize_t grcan_store_##name(struct device *sdev, \ | |
| 1494 | + struct device_attribute *att, \ | |
| 1495 | + const char *buf, \ | |
| 1496 | + size_t count) \ | |
| 1497 | + { \ | |
| 1498 | + struct net_device *dev = to_net_dev(sdev); \ | |
| 1499 | + struct grcan_priv *priv = netdev_priv(dev); \ | |
| 1500 | + u8 val; \ | |
| 1501 | + int ret; \ | |
| 1502 | + if (dev->flags & IFF_UP) \ | |
| 1503 | + return -EBUSY; \ | |
| 1504 | + ret = kstrtou8(buf, 0, &val); \ | |
| 1505 | + if (ret < 0 || val > 1) \ | |
| 1506 | + return -EINVAL; \ | |
| 1507 | + priv->config.name = val; \ | |
| 1508 | + return count; \ | |
| 1509 | + } \ | |
| 1510 | + static ssize_t grcan_show_##name(struct device *sdev, \ | |
| 1511 | + struct device_attribute *att, \ | |
| 1512 | + char *buf) \ | |
| 1513 | + { \ | |
| 1514 | + struct net_device *dev = to_net_dev(sdev); \ | |
| 1515 | + struct grcan_priv *priv = netdev_priv(dev); \ | |
| 1516 | + return sprintf(buf, "%d\n", priv->config.name); \ | |
| 1517 | + } \ | |
| 1518 | + static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, \ | |
| 1519 | + grcan_show_##name, \ | |
| 1520 | + grcan_store_##name); \ | |
| 1521 | + GRCAN_MODULE_PARAM(name, ushort, GRCAN_NOT_BOOL, desc) | |
| 1522 | + | |
| 1523 | +/* The following configuration options are made available both via module | |
| 1524 | + * parameters and writable sysfs files. See the chapter about GRCAN in the | |
| 1525 | + * documentation for the GRLIB VHDL library for further details. | |
| 1526 | + */ | |
| 1527 | +GRCAN_CONFIG_ATTR(enable0, | |
| 1528 | + "Configuration of physical interface 0. Determines\n" \ | |
| 1529 | + "the \"Enable 0\" bit of the configuration register.\n" \ | |
| 1530 | + "Format: 0 | 1\nDefault: 0\n"); | |
| 1531 | + | |
| 1532 | +GRCAN_CONFIG_ATTR(enable1, | |
| 1533 | + "Configuration of physical interface 1. Determines\n" \ | |
| 1534 | + "the \"Enable 1\" bit of the configuration register.\n" \ | |
| 1535 | + "Format: 0 | 1\nDefault: 0\n"); | |
| 1536 | + | |
| 1537 | +GRCAN_CONFIG_ATTR(select, | |
| 1538 | + "Select which physical interface to use.\n" \ | |
| 1539 | + "Format: 0 | 1\nDefault: 0\n"); | |
| 1540 | + | |
| 1541 | +/* The tx and rx buffer size configuration options are only available via module | |
| 1542 | + * parameters. | |
| 1543 | + */ | |
| 1544 | +GRCAN_MODULE_PARAM(txsize, uint, GRCAN_INVALID_BUFFER_SIZE, | |
| 1545 | + "Sets the size of the tx buffer.\n" \ | |
| 1546 | + "Format: <unsigned int> where (txsize & ~0x1fffc0) == 0\n" \ | |
| 1547 | + "Default: 1024\n"); | |
| 1548 | +GRCAN_MODULE_PARAM(rxsize, uint, GRCAN_INVALID_BUFFER_SIZE, | |
| 1549 | + "Sets the size of the rx buffer.\n" \ | |
| 1550 | + "Format: <unsigned int> where (size & ~0x1fffc0) == 0\n" \ | |
| 1551 | + "Default: 1024\n"); | |
| 1552 | + | |
| 1553 | +/* Function that makes sure that configuration done using | |
| 1554 | + * module parameters are set to valid values | |
| 1555 | + */ | |
| 1556 | +static void grcan_sanitize_module_config(struct platform_device *ofdev) | |
| 1557 | +{ | |
| 1558 | + grcan_sanitize_enable0(ofdev); | |
| 1559 | + grcan_sanitize_enable1(ofdev); | |
| 1560 | + grcan_sanitize_select(ofdev); | |
| 1561 | + grcan_sanitize_txsize(ofdev); | |
| 1562 | + grcan_sanitize_rxsize(ofdev); | |
| 1563 | +} | |
| 1564 | + | |
| 1565 | +static const struct attribute *const sysfs_grcan_attrs[] = { | |
| 1566 | + /* Config attrs */ | |
| 1567 | + &dev_attr_enable0.attr, | |
| 1568 | + &dev_attr_enable1.attr, | |
| 1569 | + &dev_attr_select.attr, | |
| 1570 | + NULL, | |
| 1571 | +}; | |
| 1572 | + | |
| 1573 | +static const struct attribute_group sysfs_grcan_group = { | |
| 1574 | + .name = "grcan", | |
| 1575 | + .attrs = (struct attribute **)sysfs_grcan_attrs, | |
| 1576 | +}; | |
| 1577 | + | |
| 1578 | +/* ========== Setting up the driver ========== */ | |
| 1579 | + | |
| 1580 | +static const struct net_device_ops grcan_netdev_ops = { | |
| 1581 | + .ndo_open = grcan_open, | |
| 1582 | + .ndo_stop = grcan_close, | |
| 1583 | + .ndo_start_xmit = grcan_start_xmit, | |
| 1584 | +}; | |
| 1585 | + | |
| 1586 | +static int grcan_setup_netdev(struct platform_device *ofdev, | |
| 1587 | + void __iomem *base, | |
| 1588 | + int irq, u32 ambafreq, bool txbug) | |
| 1589 | +{ | |
| 1590 | + struct net_device *dev; | |
| 1591 | + struct grcan_priv *priv; | |
| 1592 | + struct grcan_registers __iomem *regs; | |
| 1593 | + int err; | |
| 1594 | + | |
| 1595 | + dev = alloc_candev(sizeof(struct grcan_priv), 0); | |
| 1596 | + if (!dev) | |
| 1597 | + return -ENOMEM; | |
| 1598 | + | |
| 1599 | + dev->irq = irq; | |
| 1600 | + dev->flags |= IFF_ECHO; | |
| 1601 | + dev->netdev_ops = &grcan_netdev_ops; | |
| 1602 | + dev->sysfs_groups[0] = &sysfs_grcan_group; | |
| 1603 | + | |
| 1604 | + priv = netdev_priv(dev); | |
| 1605 | + memcpy(&priv->config, &grcan_module_config, | |
| 1606 | + sizeof(struct grcan_device_config)); | |
| 1607 | + priv->dev = dev; | |
| 1608 | + priv->regs = base; | |
| 1609 | + priv->can.bittiming_const = &grcan_bittiming_const; | |
| 1610 | + priv->can.do_set_bittiming = grcan_set_bittiming; | |
| 1611 | + priv->can.do_set_mode = grcan_set_mode; | |
| 1612 | + priv->can.do_get_berr_counter = grcan_get_berr_counter; | |
| 1613 | + priv->can.clock.freq = ambafreq; | |
| 1614 | + priv->can.ctrlmode_supported = | |
| 1615 | + CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_ONE_SHOT; | |
| 1616 | + priv->need_txbug_workaround = txbug; | |
| 1617 | + | |
| 1618 | + /* Discover if triple sampling is supported by hardware */ | |
| 1619 | + regs = priv->regs; | |
| 1620 | + grcan_set_bits(®s->ctrl, GRCAN_CTRL_RESET); | |
| 1621 | + grcan_set_bits(®s->conf, GRCAN_CONF_SAM); | |
| 1622 | + if (grcan_read_bits(®s->conf, GRCAN_CONF_SAM)) { | |
| 1623 | + priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; | |
| 1624 | + dev_dbg(&ofdev->dev, "Hardware supports triple-sampling\n"); | |
| 1625 | + } | |
| 1626 | + | |
| 1627 | + spin_lock_init(&priv->lock); | |
| 1628 | + | |
| 1629 | + if (priv->need_txbug_workaround) { | |
| 1630 | + init_timer(&priv->rr_timer); | |
| 1631 | + priv->rr_timer.function = grcan_running_reset; | |
| 1632 | + priv->rr_timer.data = (unsigned long)dev; | |
| 1633 | + | |
| 1634 | + init_timer(&priv->hang_timer); | |
| 1635 | + priv->hang_timer.function = grcan_initiate_running_reset; | |
| 1636 | + priv->hang_timer.data = (unsigned long)dev; | |
| 1637 | + } | |
| 1638 | + | |
| 1639 | + netif_napi_add(dev, &priv->napi, grcan_poll, GRCAN_NAPI_WEIGHT); | |
| 1640 | + | |
| 1641 | + SET_NETDEV_DEV(dev, &ofdev->dev); | |
| 1642 | + dev_info(&ofdev->dev, "regs=0x%p, irq=%d, clock=%d\n", | |
| 1643 | + priv->regs, dev->irq, priv->can.clock.freq); | |
| 1644 | + | |
| 1645 | + err = register_candev(dev); | |
| 1646 | + if (err) | |
| 1647 | + goto exit_free_candev; | |
| 1648 | + | |
| 1649 | + dev_set_drvdata(&ofdev->dev, dev); | |
| 1650 | + | |
| 1651 | + /* Reset device to allow bit-timing to be set. No need to call | |
| 1652 | + * grcan_reset at this stage. That is done in grcan_open. | |
| 1653 | + */ | |
| 1654 | + grcan_write_reg(®s->ctrl, GRCAN_CTRL_RESET); | |
| 1655 | + | |
| 1656 | + return 0; | |
| 1657 | +exit_free_candev: | |
| 1658 | + free_candev(dev); | |
| 1659 | + return err; | |
| 1660 | +} | |
| 1661 | + | |
| 1662 | +static int grcan_probe(struct platform_device *ofdev) | |
| 1663 | +{ | |
| 1664 | + struct device_node *np = ofdev->dev.of_node; | |
| 1665 | + struct resource *res; | |
| 1666 | + u32 sysid, ambafreq; | |
| 1667 | + int irq, err; | |
| 1668 | + void __iomem *base; | |
| 1669 | + bool txbug = true; | |
| 1670 | + | |
| 1671 | + /* Compare GRLIB version number with the first that does not | |
| 1672 | + * have the tx bug (see start_xmit) | |
| 1673 | + */ | |
| 1674 | + err = of_property_read_u32(np, "systemid", &sysid); | |
| 1675 | + if (!err && ((sysid & GRLIB_VERSION_MASK) | |
| 1676 | + >= GRCAN_TXBUG_SAFE_GRLIB_VERSION)) | |
| 1677 | + txbug = false; | |
| 1678 | + | |
| 1679 | + err = of_property_read_u32(np, "freq", &ambafreq); | |
| 1680 | + if (err) { | |
| 1681 | + dev_err(&ofdev->dev, "unable to fetch \"freq\" property\n"); | |
| 1682 | + goto exit_error; | |
| 1683 | + } | |
| 1684 | + | |
| 1685 | + res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); | |
| 1686 | + base = devm_request_and_ioremap(&ofdev->dev, res); | |
| 1687 | + if (!base) { | |
| 1688 | + dev_err(&ofdev->dev, "couldn't map IO resource\n"); | |
| 1689 | + err = -EADDRNOTAVAIL; | |
| 1690 | + goto exit_error; | |
| 1691 | + } | |
| 1692 | + | |
| 1693 | + irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ); | |
| 1694 | + if (!irq) { | |
| 1695 | + dev_err(&ofdev->dev, "no irq found\n"); | |
| 1696 | + err = -ENODEV; | |
| 1697 | + goto exit_error; | |
| 1698 | + } | |
| 1699 | + | |
| 1700 | + grcan_sanitize_module_config(ofdev); | |
| 1701 | + | |
| 1702 | + err = grcan_setup_netdev(ofdev, base, irq, ambafreq, txbug); | |
| 1703 | + if (err) | |
| 1704 | + goto exit_dispose_irq; | |
| 1705 | + | |
| 1706 | + return 0; | |
| 1707 | + | |
| 1708 | +exit_dispose_irq: | |
| 1709 | + irq_dispose_mapping(irq); | |
| 1710 | +exit_error: | |
| 1711 | + dev_err(&ofdev->dev, | |
| 1712 | + "%s socket CAN driver initialization failed with error %d\n", | |
| 1713 | + DRV_NAME, err); | |
| 1714 | + return err; | |
| 1715 | +} | |
| 1716 | + | |
| 1717 | +static int grcan_remove(struct platform_device *ofdev) | |
| 1718 | +{ | |
| 1719 | + struct net_device *dev = dev_get_drvdata(&ofdev->dev); | |
| 1720 | + struct grcan_priv *priv = netdev_priv(dev); | |
| 1721 | + | |
| 1722 | + unregister_candev(dev); /* Will in turn call grcan_close */ | |
| 1723 | + | |
| 1724 | + irq_dispose_mapping(dev->irq); | |
| 1725 | + dev_set_drvdata(&ofdev->dev, NULL); | |
| 1726 | + netif_napi_del(&priv->napi); | |
| 1727 | + free_candev(dev); | |
| 1728 | + | |
| 1729 | + return 0; | |
| 1730 | +} | |
| 1731 | + | |
| 1732 | +static struct of_device_id grcan_match[] = { | |
| 1733 | + {.name = "GAISLER_GRCAN"}, | |
| 1734 | + {.name = "01_03d"}, | |
| 1735 | + {.name = "GAISLER_GRHCAN"}, | |
| 1736 | + {.name = "01_034"}, | |
| 1737 | + {}, | |
| 1738 | +}; | |
| 1739 | + | |
| 1740 | +MODULE_DEVICE_TABLE(of, grcan_match); | |
| 1741 | + | |
| 1742 | +static struct platform_driver grcan_driver = { | |
| 1743 | + .driver = { | |
| 1744 | + .name = DRV_NAME, | |
| 1745 | + .owner = THIS_MODULE, | |
| 1746 | + .of_match_table = grcan_match, | |
| 1747 | + }, | |
| 1748 | + .probe = grcan_probe, | |
| 1749 | + .remove = grcan_remove, | |
| 1750 | +}; | |
| 1751 | + | |
| 1752 | +module_platform_driver(grcan_driver); | |
| 1753 | + | |
| 1754 | +MODULE_AUTHOR("Aeroflex Gaisler AB."); | |
| 1755 | +MODULE_DESCRIPTION("Socket CAN driver for Aeroflex Gaisler GRCAN"); | |
| 1756 | +MODULE_LICENSE("GPL"); | |
| @@ -365,7 +365,7 @@ static int ican3_old_send_msg(struct ican3_dev *mod, struct ican3_msg *msg) · 364 unmodified lines | ||
| 365 | 365 | * ICAN3 "new-style" Host Interface Setup |
| 366 | 366 | */ |
| 367 | 367 | |
| 368 | −static void __devinit ican3_init_new_host_interface(struct ican3_dev *mod) | |
| 368 | +static void ican3_init_new_host_interface(struct ican3_dev *mod) | |
| 369 | 369 | { |
| 370 | 370 | struct ican3_new_desc desc; |
| 371 | 371 | unsigned long flags; |
| @@ -444,7 +444,7 @@ static void __devinit ican3_init_new_host_interface(struct ican3_dev *mod) · 72 unmodified lines | ||
| 444 | 444 | * ICAN3 Fast Host Interface Setup |
| 445 | 445 | */ |
| 446 | 446 | |
| 447 | −static void __devinit ican3_init_fast_host_interface(struct ican3_dev *mod) | |
| 447 | +static void ican3_init_fast_host_interface(struct ican3_dev *mod) | |
| 448 | 448 | { |
| 449 | 449 | struct ican3_fast_desc desc; |
| 450 | 450 | unsigned long flags; |
| @@ -631,7 +631,7 @@ static int ican3_recv_msg(struct ican3_dev *mod, struct ican3_msg *msg) · 180 unmodified lines | ||
| 631 | 631 | * Quick Pre-constructed Messages |
| 632 | 632 | */ |
| 633 | 633 | |
| 634 | −static int __devinit ican3_msg_connect(struct ican3_dev *mod) | |
| 634 | +static int ican3_msg_connect(struct ican3_dev *mod) | |
| 635 | 635 | { |
| 636 | 636 | struct ican3_msg msg; |
| 637 | 637 | |
| @@ -642,7 +642,7 @@ static int __devinit ican3_msg_connect(struct ican3_dev *mod) · 4 unmodified lines | ||
| 642 | 642 | return ican3_send_msg(mod, &msg); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | −static int __devexit ican3_msg_disconnect(struct ican3_dev *mod) | |
| 645 | +static int ican3_msg_disconnect(struct ican3_dev *mod) | |
| 646 | 646 | { |
| 647 | 647 | struct ican3_msg msg; |
| 648 | 648 | |
| @@ -653,7 +653,7 @@ static int __devexit ican3_msg_disconnect(struct ican3_dev *mod) · 4 unmodified lines | ||
| 653 | 653 | return ican3_send_msg(mod, &msg); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | −static int __devinit ican3_msg_newhostif(struct ican3_dev *mod) | |
| 656 | +static int ican3_msg_newhostif(struct ican3_dev *mod) | |
| 657 | 657 | { |
| 658 | 658 | struct ican3_msg msg; |
| 659 | 659 | int ret; |
| @@ -674,7 +674,7 @@ static int __devinit ican3_msg_newhostif(struct ican3_dev *mod) · 14 unmodified lines | ||
| 674 | 674 | return 0; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | −static int __devinit ican3_msg_fasthostif(struct ican3_dev *mod) | |
| 677 | +static int ican3_msg_fasthostif(struct ican3_dev *mod) | |
| 678 | 678 | { |
| 679 | 679 | struct ican3_msg msg; |
| 680 | 680 | unsigned int addr; |
| @@ -707,7 +707,7 @@ static int __devinit ican3_msg_fasthostif(struct ican3_dev *mod) · 26 unmodified lines | ||
| 707 | 707 | * Setup the CAN filter to either accept or reject all |
| 708 | 708 | * messages from the CAN bus. |
| 709 | 709 | */ |
| 710 | −static int __devinit ican3_set_id_filter(struct ican3_dev *mod, bool accept) | |
| 710 | +static int ican3_set_id_filter(struct ican3_dev *mod, bool accept) | |
| 711 | 711 | { |
| 712 | 712 | struct ican3_msg msg; |
| 713 | 713 | int ret; |
| @@ -1421,7 +1421,7 @@ static int ican3_reset_module(struct ican3_dev *mod) · 707 unmodified lines | ||
| 1421 | 1421 | return -ETIMEDOUT; |
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | −static void __devexit ican3_shutdown_module(struct ican3_dev *mod) | |
| 1424 | +static void ican3_shutdown_module(struct ican3_dev *mod) | |
| 1425 | 1425 | { |
| 1426 | 1426 | ican3_msg_disconnect(mod); |
| 1427 | 1427 | ican3_reset_module(mod); |
| @@ -1430,7 +1430,7 @@ static void __devexit ican3_shutdown_module(struct ican3_dev *mod) · 2 unmodified lines | ||
| 1430 | 1430 | /* |
| 1431 | 1431 | * Startup an ICAN module, bringing it into fast mode |
| 1432 | 1432 | */ |
| 1433 | −static int __devinit ican3_startup_module(struct ican3_dev *mod) | |
| 1433 | +static int ican3_startup_module(struct ican3_dev *mod) | |
| 1434 | 1434 | { |
| 1435 | 1435 | int ret; |
| 1436 | 1436 | |
| @@ -1692,7 +1692,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev, · 255 unmodified lines | ||
| 1692 | 1692 | return ret; |
| 1693 | 1693 | |
| 1694 | 1694 | ret = wait_for_completion_timeout(&mod->buserror_comp, HZ); |
| 1695 | − if (ret <= 0) { | |
| 1695 | + if (ret == 0) { | |
| 1696 | 1696 | dev_info(mod->dev, "%s timed out\n", __func__); |
| 1697 | 1697 | return -ETIMEDOUT; |
| 1698 | 1698 | } |
| @@ -1718,7 +1718,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev, · 19 unmodified lines | ||
| 1718 | 1718 | return ret; |
| 1719 | 1719 | |
| 1720 | 1720 | ret = wait_for_completion_timeout(&mod->termination_comp, HZ); |
| 1721 | − if (ret <= 0) { | |
| 1721 | + if (ret == 0) { | |
| 1722 | 1722 | dev_info(mod->dev, "%s timed out\n", __func__); |
| 1723 | 1723 | return -ETIMEDOUT; |
| 1724 | 1724 | } |
| @@ -1760,7 +1760,7 @@ static struct attribute_group ican3_sysfs_attr_group = { · 35 unmodified lines | ||
| 1760 | 1760 | * PCI Subsystem |
| 1761 | 1761 | */ |
| 1762 | 1762 | |
| 1763 | −static int __devinit ican3_probe(struct platform_device *pdev) | |
| 1763 | +static int ican3_probe(struct platform_device *pdev) | |
| 1764 | 1764 | { |
| 1765 | 1765 | struct janz_platform_data *pdata; |
| 1766 | 1766 | struct net_device *ndev; |
| @@ -1898,7 +1898,7 @@ out_return: · 131 unmodified lines | ||
| 1898 | 1898 | return ret; |
| 1899 | 1899 | } |
| 1900 | 1900 | |
| 1901 | −static int __devexit ican3_remove(struct platform_device *pdev) | |
| 1901 | +static int ican3_remove(struct platform_device *pdev) | |
| 1902 | 1902 | { |
| 1903 | 1903 | struct net_device *ndev = platform_get_drvdata(pdev); |
| 1904 | 1904 | struct ican3_dev *mod = netdev_priv(ndev); |
| @@ -1927,7 +1927,7 @@ static struct platform_driver ican3_driver = { · 22 unmodified lines | ||
| 1927 | 1927 | .owner = THIS_MODULE, |
| 1928 | 1928 | }, |
| 1929 | 1929 | .probe = ican3_probe, |
| 1930 | − .remove = __devexit_p(ican3_remove), | |
| 1930 | + .remove = ican3_remove, | |
| 1931 | 1931 | }; |
| 1932 | 1932 | |
| 1933 | 1933 | module_platform_driver(ican3_driver); |
| @@ -981,7 +981,7 @@ static const struct net_device_ops mcp251x_netdev_ops = { · 980 unmodified lines | ||
| 981 | 981 | .ndo_start_xmit = mcp251x_hard_start_xmit, |
| 982 | 982 | }; |
| 983 | 983 | |
| 984 | −static int __devinit mcp251x_can_probe(struct spi_device *spi) | |
| 984 | +static int mcp251x_can_probe(struct spi_device *spi) | |
| 985 | 985 | { |
| 986 | 986 | struct net_device *net; |
| 987 | 987 | struct mcp251x_priv *priv; |
| @@ -1100,7 +1100,7 @@ error_out: · 112 unmodified lines | ||
| 1100 | 1100 | return ret; |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | −static int __devexit mcp251x_can_remove(struct spi_device *spi) | |
| 1103 | +static int mcp251x_can_remove(struct spi_device *spi) | |
| 1104 | 1104 | { |
| 1105 | 1105 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; |
| 1106 | 1106 | struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); |
| @@ -1198,7 +1198,7 @@ static struct spi_driver mcp251x_can_driver = { · 91 unmodified lines | ||
| 1198 | 1198 | |
| 1199 | 1199 | .id_table = mcp251x_id_table, |
| 1200 | 1200 | .probe = mcp251x_can_probe, |
| 1201 | − .remove = __devexit_p(mcp251x_can_remove), | |
| 1201 | + .remove = mcp251x_can_remove, | |
| 1202 | 1202 | .suspend = mcp251x_can_suspend, |
| 1203 | 1203 | .resume = mcp251x_can_resume, |
| 1204 | 1204 | }; |
| @@ -43,14 +43,13 @@ struct mpc5xxx_can_data { · 42 unmodified lines | ||
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | #ifdef CONFIG_PPC_MPC52xx |
| 46 | −static struct of_device_id __devinitdata mpc52xx_cdm_ids[] = { | |
| 46 | +static struct of_device_id mpc52xx_cdm_ids[] = { | |
| 47 | 47 | { .compatible = "fsl,mpc5200-cdm", }, |
| 48 | 48 | {} |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | −static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev, | |
| 52 | − const char *clock_name, | |
| 53 | − int *mscan_clksrc) | |
| 51 | +static u32 mpc52xx_can_get_clock(struct platform_device *ofdev, | |
| 52 | + const char *clock_name, int *mscan_clksrc) | |
| 54 | 53 | { |
| 55 | 54 | unsigned int pvr; |
| 56 | 55 | struct mpc52xx_cdm __iomem *cdm; |
| @@ -101,9 +100,8 @@ static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev, · 44 unmodified lines | ||
| 101 | 100 | return freq; |
| 102 | 101 | } |
| 103 | 102 | #else /* !CONFIG_PPC_MPC52xx */ |
| 104 | −static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev, | |
| 105 | − const char *clock_name, | |
| 106 | − int *mscan_clksrc) | |
| 103 | +static u32 mpc52xx_can_get_clock(struct platform_device *ofdev, | |
| 104 | + const char *clock_name, int *mscan_clksrc) | |
| 107 | 105 | { |
| 108 | 106 | return 0; |
| 109 | 107 | } |
| @@ -124,14 +122,13 @@ struct mpc512x_clockctl { · 14 unmodified lines | ||
| 124 | 122 | u32 mccr[4]; /* MSCAN Clk Ctrl Reg 1-3 */ |
| 125 | 123 | }; |
| 126 | 124 | |
| 127 | −static struct of_device_id __devinitdata mpc512x_clock_ids[] = { | |
| 125 | +static struct of_device_id mpc512x_clock_ids[] = { | |
| 128 | 126 | { .compatible = "fsl,mpc5121-clock", }, |
| 129 | 127 | {} |
| 130 | 128 | }; |
| 131 | 129 | |
| 132 | −static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, | |
| 133 | − const char *clock_name, | |
| 134 | − int *mscan_clksrc) | |
| 130 | +static u32 mpc512x_can_get_clock(struct platform_device *ofdev, | |
| 131 | + const char *clock_name, int *mscan_clksrc) | |
| 135 | 132 | { |
| 136 | 133 | struct mpc512x_clockctl __iomem *clockctl; |
| 137 | 134 | struct device_node *np_clock; |
| @@ -239,16 +236,15 @@ exit_put: · 101 unmodified lines | ||
| 239 | 236 | return freq; |
| 240 | 237 | } |
| 241 | 238 | #else /* !CONFIG_PPC_MPC512x */ |
| 242 | −static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, | |
| 243 | − const char *clock_name, | |
| 244 | − int *mscan_clksrc) | |
| 239 | +static u32 mpc512x_can_get_clock(struct platform_device *ofdev, | |
| 240 | + const char *clock_name, int *mscan_clksrc) | |
| 245 | 241 | { |
| 246 | 242 | return 0; |
| 247 | 243 | } |
| 248 | 244 | #endif /* CONFIG_PPC_MPC512x */ |
| 249 | 245 | |
| 250 | 246 | static const struct of_device_id mpc5xxx_can_table[]; |
| 251 | −static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) | |
| 247 | +static int mpc5xxx_can_probe(struct platform_device *ofdev) | |
| 252 | 248 | { |
| 253 | 249 | const struct of_device_id *match; |
| 254 | 250 | const struct mpc5xxx_can_data *data; |
| @@ -323,7 +319,7 @@ exit_unmap_mem: · 68 unmodified lines | ||
| 323 | 319 | return err; |
| 324 | 320 | } |
| 325 | 321 | |
| 326 | −static int __devexit mpc5xxx_can_remove(struct platform_device *ofdev) | |
| 322 | +static int mpc5xxx_can_remove(struct platform_device *ofdev) | |
| 327 | 323 | { |
| 328 | 324 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); |
| 329 | 325 | struct mscan_priv *priv = netdev_priv(dev); |
| @@ -380,22 +376,23 @@ static int mpc5xxx_can_resume(struct platform_device *ofdev) · 50 unmodified lines | ||
| 380 | 376 | } |
| 381 | 377 | #endif |
| 382 | 378 | |
| 383 | −static const struct mpc5xxx_can_data __devinitconst mpc5200_can_data = { | |
| 379 | +static const struct mpc5xxx_can_data mpc5200_can_data = { | |
| 384 | 380 | .type = MSCAN_TYPE_MPC5200, |
| 385 | 381 | .get_clock = mpc52xx_can_get_clock, |
| 386 | 382 | }; |
| 387 | 383 | |
| 388 | −static const struct mpc5xxx_can_data __devinitconst mpc5121_can_data = { | |
| 384 | +static const struct mpc5xxx_can_data mpc5121_can_data = { | |
| 389 | 385 | .type = MSCAN_TYPE_MPC5121, |
| 390 | 386 | .get_clock = mpc512x_can_get_clock, |
| 391 | 387 | }; |
| 392 | 388 | |
| 393 | −static const struct of_device_id __devinitconst mpc5xxx_can_table[] = { | |
| 389 | +static const struct of_device_id mpc5xxx_can_table[] = { | |
| 394 | 390 | { .compatible = "fsl,mpc5200-mscan", .data = &mpc5200_can_data, }, |
| 395 | 391 | /* Note that only MPC5121 Rev. 2 (and later) is supported */ |
| 396 | 392 | { .compatible = "fsl,mpc5121-mscan", .data = &mpc5121_can_data, }, |
| 397 | 393 | {}, |
| 398 | 394 | }; |
| 395 | +MODULE_DEVICE_TABLE(of, mpc5xxx_can_table); | |
| 399 | 396 | |
| 400 | 397 | static struct platform_driver mpc5xxx_can_driver = { |
| 401 | 398 | .driver = { |
| @@ -404,7 +401,7 @@ static struct platform_driver mpc5xxx_can_driver = { · 2 unmodified lines | ||
| 404 | 401 | .of_match_table = mpc5xxx_can_table, |
| 405 | 402 | }, |
| 406 | 403 | .probe = mpc5xxx_can_probe, |
| 407 | − .remove = __devexit_p(mpc5xxx_can_remove), | |
| 404 | + .remove = mpc5xxx_can_remove, | |
| 408 | 405 | #ifdef CONFIG_PM |
| 409 | 406 | .suspend = mpc5xxx_can_suspend, |
| 410 | 407 | .resume = mpc5xxx_can_resume, |
| @@ -517,12 +517,8 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) · 516 unmodified lines | ||
| 517 | 517 | |
| 518 | 518 | static int mscan_do_set_mode(struct net_device *dev, enum can_mode mode) |
| 519 | 519 | { |
| 520 | − struct mscan_priv *priv = netdev_priv(dev); | |
| 521 | 520 | int ret = 0; |
| 522 | 521 | |
| 523 | − if (!priv->open_time) | |
| 524 | − return -EINVAL; | |
| 525 | − | |
| 526 | 522 | switch (mode) { |
| 527 | 523 | case CAN_MODE_START: |
| 528 | 524 | ret = mscan_restart(dev); |
| @@ -590,8 +586,6 @@ static int mscan_open(struct net_device *dev) · 61 unmodified lines | ||
| 590 | 586 | goto exit_napi_disable; |
| 591 | 587 | } |
| 592 | 588 | |
| 593 | − priv->open_time = jiffies; | |
| 594 | − | |
| 595 | 589 | if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) |
| 596 | 590 | setbits8(®s->canctl1, MSCAN_LISTEN); |
| 597 | 591 | else |
| @@ -606,7 +600,6 @@ static int mscan_open(struct net_device *dev) · 8 unmodified lines | ||
| 606 | 600 | return 0; |
| 607 | 601 | |
| 608 | 602 | exit_free_irq: |
| 609 | − priv->open_time = 0; | |
| 610 | 603 | free_irq(dev->irq, dev); |
| 611 | 604 | exit_napi_disable: |
| 612 | 605 | napi_disable(&priv->napi); |
| @@ -627,7 +620,6 @@ static int mscan_close(struct net_device *dev) · 14 unmodified lines | ||
| 627 | 620 | mscan_set_mode(dev, MSCAN_INIT_MODE); |
| 628 | 621 | close_candev(dev); |
| 629 | 622 | free_irq(dev->irq, dev); |
| 630 | − priv->open_time = 0; | |
| 631 | 623 | |
| 632 | 624 | return 0; |
| 633 | 625 | } |
| @@ -281,7 +281,6 @@ struct tx_queue_entry { · 280 unmodified lines | ||
| 281 | 281 | struct mscan_priv { |
| 282 | 282 | struct can_priv can; /* must be the first member */ |
| 283 | 283 | unsigned int type; /* MSCAN type variants */ |
| 284 | − long open_time; | |
| 285 | 284 | unsigned long flags; |
| 286 | 285 | void __iomem *reg_base; /* ioremap'ed address to registers */ |
| 287 | 286 | u8 shadow_statflg; |
| @@ -954,7 +954,7 @@ static const struct net_device_ops pch_can_netdev_ops = { · 953 unmodified lines | ||
| 954 | 954 | .ndo_start_xmit = pch_xmit, |
| 955 | 955 | }; |
| 956 | 956 | |
| 957 | −static void __devexit pch_can_remove(struct pci_dev *pdev) | |
| 957 | +static void pch_can_remove(struct pci_dev *pdev) | |
| 958 | 958 | { |
| 959 | 959 | struct net_device *ndev = pci_get_drvdata(pdev); |
| 960 | 960 | struct pch_can_priv *priv = netdev_priv(ndev); |
| @@ -1178,7 +1178,7 @@ static int pch_can_get_berr_counter(const struct net_device *dev, · 217 unmodified lines | ||
| 1178 | 1178 | return 0; |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | −static int __devinit pch_can_probe(struct pci_dev *pdev, | |
| 1181 | +static int pch_can_probe(struct pci_dev *pdev, | |
| 1182 | 1182 | const struct pci_device_id *id) |
| 1183 | 1183 | { |
| 1184 | 1184 | struct net_device *ndev; |
| @@ -1269,7 +1269,7 @@ static struct pci_driver pch_can_pci_driver = { · 84 unmodified lines | ||
| 1269 | 1269 | .name = "pch_can", |
| 1270 | 1270 | .id_table = pch_pci_tbl, |
| 1271 | 1271 | .probe = pch_can_probe, |
| 1272 | − .remove = __devexit_p(pch_can_remove), | |
| 1272 | + .remove = pch_can_remove, | |
| 1273 | 1273 | .suspend = pch_can_suspend, |
| 1274 | 1274 | .resume = pch_can_resume, |
| 1275 | 1275 | }; |
| @@ -21,7 +21,7 @@ config CAN_SJA1000_PLATFORM · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | config CAN_SJA1000_OF_PLATFORM |
| 23 | 23 | tristate "Generic OF Platform Bus based SJA1000 driver" |
| 24 | − depends on PPC_OF | |
| 24 | + depends on OF | |
| 25 | 25 | ---help--- |
| 26 | 26 | This driver adds support for the SJA1000 chips connected to |
| 27 | 27 | the OpenFirmware "platform bus" found on embedded systems with |
| @@ -93,6 +93,7 @@ config CAN_PLX_PCI · 65 unmodified lines | ||
| 93 | 93 | - Marathon CAN-bus-PCI card (http://www.marathon.ru/) |
| 94 | 94 | - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/) |
| 95 | 95 | - IXXAT Automation PC-I 04/PCI card (http://www.ixxat.com/) |
| 96 | + - Connect Tech Inc. CANpro/104-Plus Opto (CRG001) card (http://www.connecttech.com) | |
| 96 | 97 | |
| 97 | 98 | config CAN_TSCAN1 |
| 98 | 99 | tristate "TS-CAN1 PC104 boards" |
| @@ -220,8 +220,8 @@ static void ems_pci_card_reset(struct ems_pci_card *card) · 219 unmodified lines | ||
| 220 | 220 | * Probe PCI device for EMS CAN signature and register each available |
| 221 | 221 | * CAN channel to SJA1000 Socket-CAN subsystem. |
| 222 | 222 | */ |
| 223 | −static int __devinit ems_pci_add_card(struct pci_dev *pdev, | |
| 224 | − const struct pci_device_id *ent) | |
| 223 | +static int ems_pci_add_card(struct pci_dev *pdev, | |
| 224 | + const struct pci_device_id *ent) | |
| 225 | 225 | { |
| 226 | 226 | struct sja1000_priv *priv; |
| 227 | 227 | struct net_device *dev; |
| @@ -166,8 +166,7 @@ static void ems_pcmcia_del_card(struct pcmcia_device *pdev) · 165 unmodified lines | ||
| 166 | 166 | * Probe PCI device for EMS CAN signature and register each available |
| 167 | 167 | * CAN channel to SJA1000 Socket-CAN subsystem. |
| 168 | 168 | */ |
| 169 | −static int __devinit ems_pcmcia_add_card(struct pcmcia_device *pdev, | |
| 170 | − unsigned long base) | |
| 169 | +static int ems_pcmcia_add_card(struct pcmcia_device *pdev, unsigned long base) | |
| 171 | 170 | { |
| 172 | 171 | struct sja1000_priv *priv; |
| 173 | 172 | struct net_device *dev; |
| @@ -256,7 +255,7 @@ failure_cleanup: · 82 unmodified lines | ||
| 256 | 255 | /* |
| 257 | 256 | * Setup PCMCIA socket and probe for EMS CPC-CARD |
| 258 | 257 | */ |
| 259 | −static int __devinit ems_pcmcia_probe(struct pcmcia_device *dev) | |
| 258 | +static int ems_pcmcia_probe(struct pcmcia_device *dev) | |
| 260 | 259 | { |
| 261 | 260 | int csval; |
| 262 | 261 | |
| @@ -290,8 +290,8 @@ failure: · 289 unmodified lines | ||
| 290 | 290 | return err; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | −static int __devinit kvaser_pci_init_one(struct pci_dev *pdev, | |
| 294 | − const struct pci_device_id *ent) | |
| 293 | +static int kvaser_pci_init_one(struct pci_dev *pdev, | |
| 294 | + const struct pci_device_id *ent) | |
| 295 | 295 | { |
| 296 | 296 | int err; |
| 297 | 297 | struct net_device *master_dev = NULL; |
| @@ -379,7 +379,7 @@ failure: · 81 unmodified lines | ||
| 379 | 379 | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | −static void __devexit kvaser_pci_remove_one(struct pci_dev *pdev) | |
| 382 | +static void kvaser_pci_remove_one(struct pci_dev *pdev) | |
| 383 | 383 | { |
| 384 | 384 | struct net_device *dev = pci_get_drvdata(pdev); |
| 385 | 385 | |
| @@ -394,7 +394,7 @@ static struct pci_driver kvaser_pci_driver = { · 8 unmodified lines | ||
| 394 | 394 | .name = DRV_NAME, |
| 395 | 395 | .id_table = kvaser_pci_tbl, |
| 396 | 396 | .probe = kvaser_pci_init_one, |
| 397 | − .remove = __devexit_p(kvaser_pci_remove_one), | |
| 397 | + .remove = kvaser_pci_remove_one, | |
| 398 | 398 | }; |
| 399 | 399 | |
| 400 | 400 | module_pci_driver(kvaser_pci_driver); |
| @@ -551,8 +551,7 @@ static void peak_pci_post_irq(const struct sja1000_priv *priv) · 550 unmodified lines | ||
| 551 | 551 | writew(chan->icr_mask, chan->cfg_base + PITA_ICR); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | −static int __devinit peak_pci_probe(struct pci_dev *pdev, | |
| 555 | − const struct pci_device_id *ent) | |
| 554 | +static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 556 | 555 | { |
| 557 | 556 | struct sja1000_priv *priv; |
| 558 | 557 | struct peak_pci_chan *chan; |
| @@ -717,7 +716,7 @@ failure_disable_pci: · 158 unmodified lines | ||
| 717 | 716 | return err; |
| 718 | 717 | } |
| 719 | 718 | |
| 720 | −static void __devexit peak_pci_remove(struct pci_dev *pdev) | |
| 719 | +static void peak_pci_remove(struct pci_dev *pdev) | |
| 721 | 720 | { |
| 722 | 721 | struct net_device *dev = pci_get_drvdata(pdev); /* Last device */ |
| 723 | 722 | struct sja1000_priv *priv = netdev_priv(dev); |
| @@ -757,7 +756,7 @@ static struct pci_driver peak_pci_driver = { · 33 unmodified lines | ||
| 757 | 756 | .name = DRV_NAME, |
| 758 | 757 | .id_table = peak_pci_tbl, |
| 759 | 758 | .probe = peak_pci_probe, |
| 760 | − .remove = __devexit_p(peak_pci_remove), | |
| 759 | + .remove = peak_pci_remove, | |
| 761 | 760 | }; |
| 762 | 761 | |
| 763 | 762 | module_pci_driver(peak_pci_driver); |
| @@ -632,7 +632,7 @@ static void pcan_free(struct pcmcia_device *pdev) · 631 unmodified lines | ||
| 632 | 632 | /* |
| 633 | 633 | * setup PCMCIA socket and probe for PEAK-System PC-CARD |
| 634 | 634 | */ |
| 635 | −static int __devinit pcan_probe(struct pcmcia_device *pdev) | |
| 635 | +static int pcan_probe(struct pcmcia_device *pdev) | |
| 636 | 636 | { |
| 637 | 637 | struct pcan_pccard *card; |
| 638 | 638 | int err; |
| @@ -44,6 +44,7 @@ MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, " · 43 unmodified lines | ||
| 44 | 44 | "esd CAN-PCI/CPCI/PCI104/200, " |
| 45 | 45 | "esd CAN-PCI/PMC/266, " |
| 46 | 46 | "esd CAN-PCIe/2000, " |
| 47 | + "Connect Tech Inc. CANpro/104-Plus Opto (CRG001), " | |
| 47 | 48 | "IXXAT PC-I 04/PCI") |
| 48 | 49 | MODULE_LICENSE("GPL v2"); |
| 49 | 50 | |
| @@ -131,6 +132,9 @@ struct plx_pci_card { · 81 unmodified lines | ||
| 131 | 132 | #define TEWS_PCI_VENDOR_ID 0x1498 |
| 132 | 133 | #define TEWS_PCI_DEVICE_ID_TMPC810 0x032A |
| 133 | 134 | |
| 135 | +#define CTI_PCI_VENDOR_ID 0x12c4 | |
| 136 | +#define CTI_PCI_DEVICE_ID_CRG001 0x0900 | |
| 137 | + | |
| 134 | 138 | static void plx_pci_reset_common(struct pci_dev *pdev); |
| 135 | 139 | static void plx_pci_reset_marathon(struct pci_dev *pdev); |
| 136 | 140 | static void plx9056_pci_reset_common(struct pci_dev *pdev); |
| @@ -158,7 +162,7 @@ struct plx_pci_card_info { · 21 unmodified lines | ||
| 158 | 162 | void (*reset_func)(struct pci_dev *pdev); |
| 159 | 163 | }; |
| 160 | 164 | |
| 161 | −static struct plx_pci_card_info plx_pci_card_info_adlink __devinitdata = { | |
| 165 | +static struct plx_pci_card_info plx_pci_card_info_adlink = { | |
| 162 | 166 | "Adlink PCI-7841/cPCI-7841", 2, |
| 163 | 167 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 164 | 168 | {1, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x80, 0x80} }, |
| @@ -166,7 +170,7 @@ static struct plx_pci_card_info plx_pci_card_info_adlink __devinitdata = { · 1 unmodified line | ||
| 166 | 170 | /* based on PLX9052 */ |
| 167 | 171 | }; |
| 168 | 172 | |
| 169 | −static struct plx_pci_card_info plx_pci_card_info_adlink_se __devinitdata = { | |
| 173 | +static struct plx_pci_card_info plx_pci_card_info_adlink_se = { | |
| 170 | 174 | "Adlink PCI-7841/cPCI-7841 SE", 2, |
| 171 | 175 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 172 | 176 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x80, 0x80} }, |
| @@ -174,7 +178,7 @@ static struct plx_pci_card_info plx_pci_card_info_adlink_se __devinitdata = { · 1 unmodified line | ||
| 174 | 178 | /* based on PLX9052 */ |
| 175 | 179 | }; |
| 176 | 180 | |
| 177 | −static struct plx_pci_card_info plx_pci_card_info_esd200 __devinitdata = { | |
| 181 | +static struct plx_pci_card_info plx_pci_card_info_esd200 = { | |
| 178 | 182 | "esd CAN-PCI/CPCI/PCI104/200", 2, |
| 179 | 183 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 180 | 184 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x100, 0x80} }, |
| @@ -182,7 +186,7 @@ static struct plx_pci_card_info plx_pci_card_info_esd200 __devinitdata = { · 1 unmodified line | ||
| 182 | 186 | /* based on PLX9030/9050 */ |
| 183 | 187 | }; |
| 184 | 188 | |
| 185 | −static struct plx_pci_card_info plx_pci_card_info_esd266 __devinitdata = { | |
| 189 | +static struct plx_pci_card_info plx_pci_card_info_esd266 = { | |
| 186 | 190 | "esd CAN-PCI/PMC/266", 2, |
| 187 | 191 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 188 | 192 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x100, 0x80} }, |
| @@ -190,7 +194,7 @@ static struct plx_pci_card_info plx_pci_card_info_esd266 __devinitdata = { · 1 unmodified line | ||
| 190 | 194 | /* based on PLX9056 */ |
| 191 | 195 | }; |
| 192 | 196 | |
| 193 | −static struct plx_pci_card_info plx_pci_card_info_esd2000 __devinitdata = { | |
| 197 | +static struct plx_pci_card_info plx_pci_card_info_esd2000 = { | |
| 194 | 198 | "esd CAN-PCIe/2000", 2, |
| 195 | 199 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 196 | 200 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x100, 0x80} }, |
| @@ -198,7 +202,7 @@ static struct plx_pci_card_info plx_pci_card_info_esd2000 __devinitdata = { · 1 unmodified line | ||
| 198 | 202 | /* based on PEX8311 */ |
| 199 | 203 | }; |
| 200 | 204 | |
| 201 | −static struct plx_pci_card_info plx_pci_card_info_ixxat __devinitdata = { | |
| 205 | +static struct plx_pci_card_info plx_pci_card_info_ixxat = { | |
| 202 | 206 | "IXXAT PC-I 04/PCI", 2, |
| 203 | 207 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 204 | 208 | {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x200, 0x80} }, |
| @@ -206,7 +210,7 @@ static struct plx_pci_card_info plx_pci_card_info_ixxat __devinitdata = { · 1 unmodified line | ||
| 206 | 210 | /* based on PLX9050 */ |
| 207 | 211 | }; |
| 208 | 212 | |
| 209 | −static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = { | |
| 213 | +static struct plx_pci_card_info plx_pci_card_info_marathon = { | |
| 210 | 214 | "Marathon CAN-bus-PCI", 2, |
| 211 | 215 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 212 | 216 | {0, 0x00, 0x00}, { {2, 0x00, 0x00}, {4, 0x00, 0x00} }, |
| @@ -214,7 +218,7 @@ static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = { · 1 unmodified line | ||
| 214 | 218 | /* based on PLX9052 */ |
| 215 | 219 | }; |
| 216 | 220 | |
| 217 | −static struct plx_pci_card_info plx_pci_card_info_tews __devinitdata = { | |
| 221 | +static struct plx_pci_card_info plx_pci_card_info_tews = { | |
| 218 | 222 | "TEWS TECHNOLOGIES TPMC810", 2, |
| 219 | 223 | PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, |
| 220 | 224 | {0, 0x00, 0x00}, { {2, 0x000, 0x80}, {2, 0x100, 0x80} }, |
| @@ -222,6 +226,14 @@ static struct plx_pci_card_info plx_pci_card_info_tews __devinitdata = { · 1 unmodified line | ||
| 222 | 226 | /* based on PLX9030 */ |
| 223 | 227 | }; |
| 224 | 228 | |
| 229 | +static struct plx_pci_card_info plx_pci_card_info_cti = { | |
| 230 | + "Connect Tech Inc. CANpro/104-Plus Opto (CRG001)", 2, | |
| 231 | + PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, | |
| 232 | + {0, 0x00, 0x00}, { {2, 0x000, 0x80}, {2, 0x100, 0x80} }, | |
| 233 | + &plx_pci_reset_common | |
| 234 | + /* based on PLX9030 */ | |
| 235 | +}; | |
| 236 | + | |
| 225 | 237 | static DEFINE_PCI_DEVICE_TABLE(plx_pci_tbl) = { |
| 226 | 238 | { |
| 227 | 239 | /* Adlink PCI-7841/cPCI-7841 */ |
| @@ -300,6 +312,13 @@ static DEFINE_PCI_DEVICE_TABLE(plx_pci_tbl) = { · 72 unmodified lines | ||
| 300 | 312 | 0, 0, |
| 301 | 313 | (kernel_ulong_t)&plx_pci_card_info_tews |
| 302 | 314 | }, |
| 315 | + { | |
| 316 | + /* Connect Tech Inc. CANpro/104-Plus Opto (CRG001) card */ | |
| 317 | + PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030, | |
| 318 | + CTI_PCI_VENDOR_ID, CTI_PCI_DEVICE_ID_CRG001, | |
| 319 | + 0, 0, | |
| 320 | + (kernel_ulong_t)&plx_pci_card_info_cti | |
| 321 | + }, | |
| 303 | 322 | { 0,} |
| 304 | 323 | }; |
| 305 | 324 | MODULE_DEVICE_TABLE(pci, plx_pci_tbl); |
| @@ -465,8 +484,8 @@ static void plx_pci_del_card(struct pci_dev *pdev) · 159 unmodified lines | ||
| 465 | 484 | * Probe PLX90xx based device for the SJA1000 chips and register each |
| 466 | 485 | * available CAN channel to SJA1000 Socket-CAN subsystem. |
| 467 | 486 | */ |
| 468 | −static int __devinit plx_pci_add_card(struct pci_dev *pdev, | |
| 469 | − const struct pci_device_id *ent) | |
| 487 | +static int plx_pci_add_card(struct pci_dev *pdev, | |
| 488 | + const struct pci_device_id *ent) | |
| 470 | 489 | { |
| 471 | 490 | struct sja1000_priv *priv; |
| 472 | 491 | struct net_device *dev; |
| @@ -188,11 +188,6 @@ static void sja1000_start(struct net_device *dev) · 187 unmodified lines | ||
| 188 | 188 | |
| 189 | 189 | static int sja1000_set_mode(struct net_device *dev, enum can_mode mode) |
| 190 | 190 | { |
| 191 | − struct sja1000_priv *priv = netdev_priv(dev); | |
| 192 | − | |
| 193 | − if (!priv->open_time) | |
| 194 | − return -EINVAL; | |
| 195 | − | |
| 196 | 191 | switch (mode) { |
| 197 | 192 | case CAN_MODE_START: |
| 198 | 193 | sja1000_start(dev); |
| @@ -579,7 +574,6 @@ static int sja1000_open(struct net_device *dev) · 380 unmodified lines | ||
| 579 | 574 | |
| 580 | 575 | /* init and start chi */ |
| 581 | 576 | sja1000_start(dev); |
| 582 | − priv->open_time = jiffies; | |
| 583 | 577 | |
| 584 | 578 | netif_start_queue(dev); |
| 585 | 579 | |
| @@ -598,8 +592,6 @@ static int sja1000_close(struct net_device *dev) · 12 unmodified lines | ||
| 598 | 592 | |
| 599 | 593 | close_candev(dev); |
| 600 | 594 | |
| 601 | − priv->open_time = 0; | |
| 602 | − | |
| 603 | 595 | return 0; |
| 604 | 596 | } |
| 605 | 597 | |
| @@ -152,7 +152,6 @@ · 151 unmodified lines | ||
| 152 | 152 | */ |
| 153 | 153 | struct sja1000_priv { |
| 154 | 154 | struct can_priv can; /* must be the first member */ |
| 155 | − int open_time; | |
| 156 | 155 | struct sk_buff *echo_skb; |
| 157 | 156 | |
| 158 | 157 | /* the lower-layer is responsible for appropriate locking */ |
| @@ -42,11 +42,11 @@ MODULE_LICENSE("GPL v2"); · 41 unmodified lines | ||
| 42 | 42 | |
| 43 | 43 | static unsigned long port[MAXDEV]; |
| 44 | 44 | static unsigned long mem[MAXDEV]; |
| 45 | −static int __devinitdata irq[MAXDEV]; | |
| 46 | −static int __devinitdata clk[MAXDEV]; | |
| 47 | −static unsigned char __devinitdata cdr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 48 | −static unsigned char __devinitdata ocr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 49 | −static int __devinitdata indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1}; | |
| 45 | +static int irq[MAXDEV]; | |
| 46 | +static int clk[MAXDEV]; | |
| 47 | +static unsigned char cdr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 48 | +static unsigned char ocr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff}; | |
| 49 | +static int indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1}; | |
| 50 | 50 | |
| 51 | 51 | module_param_array(port, ulong, NULL, S_IRUGO); |
| 52 | 52 | MODULE_PARM_DESC(port, "I/O port number"); |
| @@ -117,7 +117,7 @@ static void sja1000_isa_port_write_reg_indirect(const struct sja1000_priv *priv, · 64 unmodified lines | ||
| 117 | 117 | outb(val, base + 1); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | −static int __devinit sja1000_isa_probe(struct platform_device *pdev) | |
| 120 | +static int sja1000_isa_probe(struct platform_device *pdev) | |
| 121 | 121 | { |
| 122 | 122 | struct net_device *dev; |
| 123 | 123 | struct sja1000_priv *priv; |
| @@ -223,7 +223,7 @@ static int __devinit sja1000_isa_probe(struct platform_device *pdev) · 99 unmodified lines | ||
| 223 | 223 | return err; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | −static int __devexit sja1000_isa_remove(struct platform_device *pdev) | |
| 226 | +static int sja1000_isa_remove(struct platform_device *pdev) | |
| 227 | 227 | { |
| 228 | 228 | struct net_device *dev = dev_get_drvdata(&pdev->dev); |
| 229 | 229 | struct sja1000_priv *priv = netdev_priv(dev); |
| @@ -248,7 +248,7 @@ static int __devexit sja1000_isa_remove(struct platform_device *pdev) · 18 unmodified lines | ||
| 248 | 248 | |
| 249 | 249 | static struct platform_driver sja1000_isa_driver = { |
| 250 | 250 | .probe = sja1000_isa_probe, |
| 251 | − .remove = __devexit_p(sja1000_isa_remove), | |
| 251 | + .remove = sja1000_isa_remove, | |
| 252 | 252 | .driver = { |
| 253 | 253 | .name = DRV_NAME, |
| 254 | 254 | .owner = THIS_MODULE, |
| @@ -42,6 +42,8 @@ · 41 unmodified lines | ||
| 42 | 42 | #include <linux/can/dev.h> |
| 43 | 43 | |
| 44 | 44 | #include <linux/of_platform.h> |
| 45 | +#include <linux/of_address.h> | |
| 46 | +#include <linux/of_irq.h> | |
| 45 | 47 | #include <asm/prom.h> |
| 46 | 48 | |
| 47 | 49 | #include "sja1000.h" |
| @@ -59,16 +61,16 @@ MODULE_LICENSE("GPL v2"); · 11 unmodified lines | ||
| 59 | 61 | |
| 60 | 62 | static u8 sja1000_ofp_read_reg(const struct sja1000_priv *priv, int reg) |
| 61 | 63 | { |
| 62 | − return in_8(priv->reg_base + reg); | |
| 64 | + return ioread8(priv->reg_base + reg); | |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | 67 | static void sja1000_ofp_write_reg(const struct sja1000_priv *priv, |
| 66 | 68 | int reg, u8 val) |
| 67 | 69 | { |
| 68 | − out_8(priv->reg_base + reg, val); | |
| 70 | + iowrite8(val, priv->reg_base + reg); | |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | −static int __devexit sja1000_ofp_remove(struct platform_device *ofdev) | |
| 73 | +static int sja1000_ofp_remove(struct platform_device *ofdev) | |
| 72 | 74 | { |
| 73 | 75 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); |
| 74 | 76 | struct sja1000_priv *priv = netdev_priv(dev); |
| @@ -88,7 +90,7 @@ static int __devexit sja1000_ofp_remove(struct platform_device *ofdev) · 13 unmodified lines | ||
| 88 | 90 | return 0; |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | −static int __devinit sja1000_ofp_probe(struct platform_device *ofdev) | |
| 93 | +static int sja1000_ofp_probe(struct platform_device *ofdev) | |
| 92 | 94 | { |
| 93 | 95 | struct device_node *np = ofdev->dev.of_node; |
| 94 | 96 | struct net_device *dev; |
| @@ -204,7 +206,7 @@ exit_release_mem: · 109 unmodified lines | ||
| 204 | 206 | return err; |
| 205 | 207 | } |
| 206 | 208 | |
| 207 | −static struct of_device_id __devinitdata sja1000_ofp_table[] = { | |
| 209 | +static struct of_device_id sja1000_ofp_table[] = { | |
| 208 | 210 | {.compatible = "nxp,sja1000"}, |
| 209 | 211 | {}, |
| 210 | 212 | }; |
| @@ -217,7 +219,7 @@ static struct platform_driver sja1000_ofp_driver = { · 6 unmodified lines | ||
| 217 | 219 | .of_match_table = sja1000_ofp_table, |
| 218 | 220 | }, |
| 219 | 221 | .probe = sja1000_ofp_probe, |
| 220 | − .remove = __devexit_p(sja1000_ofp_remove), | |
| 222 | + .remove = sja1000_ofp_remove, | |
| 221 | 223 | }; |
| 222 | 224 | |
| 223 | 225 | module_platform_driver(sja1000_ofp_driver); |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); |
| 36 | 36 | MODULE_DESCRIPTION("Socket-CAN driver for SJA1000 on the platform bus"); |
| 37 | +MODULE_ALIAS("platform:" DRV_NAME); | |
| 37 | 38 | MODULE_LICENSE("GPL v2"); |
| 38 | 39 | |
| 39 | 40 | static u8 sp_read_reg8(const struct sja1000_priv *priv, int reg) |
| @@ -71,7 +71,7 @@ MODULE_LICENSE("GPL"); · 70 unmodified lines | ||
| 71 | 71 | #define TSCAN1_SJA1000_XTAL 16000000 |
| 72 | 72 | |
| 73 | 73 | /* SJA1000 IO base addresses */ |
| 74 | −static const unsigned short tscan1_sja1000_addresses[] __devinitconst = { | |
| 74 | +static const unsigned short tscan1_sja1000_addresses[] = { | |
| 75 | 75 | 0x100, 0x120, 0x180, 0x1a0, 0x200, 0x240, 0x280, 0x320 |
| 76 | 76 | }; |
| 77 | 77 | |
| @@ -88,7 +88,7 @@ static void tscan1_write(const struct sja1000_priv *priv, int reg, u8 val) · 10 unmodified lines | ||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /* Probe for a TS-CAN1 board with JP2:JP1 jumper setting ID */ |
| 91 | −static int __devinit tscan1_probe(struct device *dev, unsigned id) | |
| 91 | +static int tscan1_probe(struct device *dev, unsigned id) | |
| 92 | 92 | { |
| 93 | 93 | struct net_device *netdev; |
| 94 | 94 | struct sja1000_priv *priv; |
| @@ -171,7 +171,7 @@ static int __devinit tscan1_probe(struct device *dev, unsigned id) · 76 unmodified lines | ||
| 171 | 171 | return -ENXIO; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | −static int __devexit tscan1_remove(struct device *dev, unsigned id /*unused*/) | |
| 174 | +static int tscan1_remove(struct device *dev, unsigned id /*unused*/) | |
| 175 | 175 | { |
| 176 | 176 | struct net_device *netdev; |
| 177 | 177 | struct sja1000_priv *priv; |
| @@ -197,7 +197,7 @@ static int __devexit tscan1_remove(struct device *dev, unsigned id /*unused*/) · 19 unmodified lines | ||
| 197 | 197 | |
| 198 | 198 | static struct isa_driver tscan1_isa_driver = { |
| 199 | 199 | .probe = tscan1_probe, |
| 200 | − .remove = __devexit_p(tscan1_remove), | |
| 200 | + .remove = tscan1_remove, | |
| 201 | 201 | .driver = { |
| 202 | 202 | .name = "tscan1", |
| 203 | 203 | }, |
| @@ -159,7 +159,7 @@ MODULE_FIRMWARE(fw_dir "bcard2.bin"); · 158 unmodified lines | ||
| 159 | 159 | MODULE_FIRMWARE(fw_dir "ldcard2.bin"); |
| 160 | 160 | MODULE_FIRMWARE(fw_dir "cancrd2.bin"); |
| 161 | 161 | |
| 162 | −static __devinit const struct softing_platform_data | |
| 162 | +static const struct softing_platform_data | |
| 163 | 163 | *softingcs_find_platform_data(unsigned int manf, unsigned int prod) |
| 164 | 164 | { |
| 165 | 165 | const struct softing_platform_data *lp; |
| @@ -193,8 +193,7 @@ static int softingcs_enable_irq(struct platform_device *pdev, int v) · 27 unmodified lines | ||
| 193 | 193 | /* |
| 194 | 194 | * pcmcia check |
| 195 | 195 | */ |
| 196 | −static __devinit int softingcs_probe_config(struct pcmcia_device *pcmcia, | |
| 197 | − void *priv_data) | |
| 196 | +static int softingcs_probe_config(struct pcmcia_device *pcmcia, void *priv_data) | |
| 198 | 197 | { |
| 199 | 198 | struct softing_platform_data *pdat = priv_data; |
| 200 | 199 | struct resource *pres; |
| @@ -215,7 +214,7 @@ static __devinit int softingcs_probe_config(struct pcmcia_device *pcmcia, · 14 unmodified lines | ||
| 215 | 214 | return pcmcia_request_window(pcmcia, pres, memspeed); |
| 216 | 215 | } |
| 217 | 216 | |
| 218 | −static __devexit void softingcs_remove(struct pcmcia_device *pcmcia) | |
| 217 | +static void softingcs_remove(struct pcmcia_device *pcmcia) | |
| 219 | 218 | { |
| 220 | 219 | struct platform_device *pdev = pcmcia->priv; |
| 221 | 220 | |
| @@ -235,7 +234,7 @@ static void softingcs_pdev_release(struct device *dev) · 13 unmodified lines | ||
| 235 | 234 | kfree(pdev); |
| 236 | 235 | } |
| 237 | 236 | |
| 238 | −static __devinit int softingcs_probe(struct pcmcia_device *pcmcia) | |
| 237 | +static int softingcs_probe(struct pcmcia_device *pcmcia) | |
| 239 | 238 | { |
| 240 | 239 | int ret; |
| 241 | 240 | struct platform_device *pdev; |
| @@ -338,7 +337,7 @@ static struct pcmcia_driver softingcs_driver = { · 96 unmodified lines | ||
| 338 | 337 | .name = "softingcs", |
| 339 | 338 | .id_table = softingcs_ids, |
| 340 | 339 | .probe = softingcs_probe, |
| 341 | − .remove = __devexit_p(softingcs_remove), | |
| 340 | + .remove = softingcs_remove, | |
| 342 | 341 | }; |
| 343 | 342 | |
| 344 | 343 | static int __init softingcs_start(void) |
| @@ -478,7 +478,7 @@ static void softing_card_shutdown(struct softing *card) · 477 unmodified lines | ||
| 478 | 478 | mutex_unlock(&card->fw.lock); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | −static __devinit int softing_card_boot(struct softing *card) | |
| 481 | +static int softing_card_boot(struct softing *card) | |
| 482 | 482 | { |
| 483 | 483 | int ret, j; |
| 484 | 484 | static const uint8_t stream[] = { |
| @@ -645,8 +645,8 @@ static const struct can_bittiming_const softing_btr_const = { · 160 unmodified lines | ||
| 645 | 645 | }; |
| 646 | 646 | |
| 647 | 647 | |
| 648 | −static __devinit struct net_device *softing_netdev_create(struct softing *card, | |
| 649 | − uint16_t chip_id) | |
| 648 | +static struct net_device *softing_netdev_create(struct softing *card, | |
| 649 | + uint16_t chip_id) | |
| 650 | 650 | { |
| 651 | 651 | struct net_device *netdev; |
| 652 | 652 | struct softing_priv *priv; |
| @@ -676,7 +676,7 @@ static __devinit struct net_device *softing_netdev_create(struct softing *card, · 23 unmodified lines | ||
| 676 | 676 | return netdev; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | −static __devinit int softing_netdev_register(struct net_device *netdev) | |
| 679 | +static int softing_netdev_register(struct net_device *netdev) | |
| 680 | 680 | { |
| 681 | 681 | int ret; |
| 682 | 682 | |
| @@ -745,7 +745,7 @@ static const struct attribute_group softing_pdev_group = { · 62 unmodified lines | ||
| 745 | 745 | /* |
| 746 | 746 | * platform driver |
| 747 | 747 | */ |
| 748 | −static __devexit int softing_pdev_remove(struct platform_device *pdev) | |
| 748 | +static int softing_pdev_remove(struct platform_device *pdev) | |
| 749 | 749 | { |
| 750 | 750 | struct softing *card = platform_get_drvdata(pdev); |
| 751 | 751 | int j; |
| @@ -766,7 +766,7 @@ static __devexit int softing_pdev_remove(struct platform_device *pdev) · 14 unmodified lines | ||
| 766 | 766 | return 0; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | −static __devinit int softing_pdev_probe(struct platform_device *pdev) | |
| 769 | +static int softing_pdev_probe(struct platform_device *pdev) | |
| 770 | 770 | { |
| 771 | 771 | const struct softing_platform_data *pdat = pdev->dev.platform_data; |
| 772 | 772 | struct softing *card; |
| @@ -871,7 +871,7 @@ static struct platform_driver softing_driver = { · 98 unmodified lines | ||
| 871 | 871 | .owner = THIS_MODULE, |
| 872 | 872 | }, |
| 873 | 873 | .probe = softing_pdev_probe, |
| 874 | − .remove = __devexit_p(softing_pdev_remove), | |
| 874 | + .remove = softing_pdev_remove, | |
| 875 | 875 | }; |
| 876 | 876 | |
| 877 | 877 | module_platform_driver(softing_driver); |
| @@ -978,7 +978,7 @@ probe_exit: · 977 unmodified lines | ||
| 978 | 978 | return err; |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | −static int __devexit ti_hecc_remove(struct platform_device *pdev) | |
| 981 | +static int ti_hecc_remove(struct platform_device *pdev) | |
| 982 | 982 | { |
| 983 | 983 | struct resource *res; |
| 984 | 984 | struct net_device *ndev = platform_get_drvdata(pdev); |
| @@ -1045,7 +1045,7 @@ static struct platform_driver ti_hecc_driver = { · 60 unmodified lines | ||
| 1045 | 1045 | .owner = THIS_MODULE, |
| 1046 | 1046 | }, |
| 1047 | 1047 | .probe = ti_hecc_probe, |
| 1048 | − .remove = __devexit_p(ti_hecc_remove), | |
| 1048 | + .remove = ti_hecc_remove, | |
| 1049 | 1049 | .suspend = ti_hecc_suspend, |
| 1050 | 1050 | .resume = ti_hecc_resume, |
| 1051 | 1051 | }; |
| @@ -1055,3 +1055,4 @@ module_platform_driver(ti_hecc_driver); · 3 unmodified lines | ||
| 1055 | 1055 | MODULE_AUTHOR("Anant Gole <anantgole@ti.com>"); |
| 1056 | 1056 | MODULE_LICENSE("GPL v2"); |
| 1057 | 1057 | MODULE_DESCRIPTION(DRV_DESC); |
| 1058 | +MODULE_ALIAS("platform:" DRV_NAME); | |
| @@ -13,6 +13,35 @@ config CAN_ESD_USB2 · 12 unmodified lines | ||
| 13 | 13 | This driver supports the CAN-USB/2 interface |
| 14 | 14 | from esd electronic system design gmbh (http://www.esd.eu). |
| 15 | 15 | |
| 16 | +config CAN_KVASER_USB | |
| 17 | + tristate "Kvaser CAN/USB interface" | |
| 18 | + ---help--- | |
| 19 | + This driver adds support for Kvaser CAN/USB devices like Kvaser | |
| 20 | + Leaf Light. | |
| 21 | + | |
| 22 | + The driver gives support for the following devices: | |
| 23 | + - Kvaser Leaf Light | |
| 24 | + - Kvaser Leaf Professional HS | |
| 25 | + - Kvaser Leaf SemiPro HS | |
| 26 | + - Kvaser Leaf Professional LS | |
| 27 | + - Kvaser Leaf Professional SWC | |
| 28 | + - Kvaser Leaf Professional LIN | |
| 29 | + - Kvaser Leaf SemiPro LS | |
| 30 | + - Kvaser Leaf SemiPro SWC | |
| 31 | + - Kvaser Memorator II HS/HS | |
| 32 | + - Kvaser USBcan Professional HS/HS | |
| 33 | + - Kvaser Leaf Light GI | |
| 34 | + - Kvaser Leaf Professional HS (OBD-II connector) | |
| 35 | + - Kvaser Memorator Professional HS/LS | |
| 36 | + - Kvaser Leaf Light "China" | |
| 37 | + - Kvaser BlackBird SemiPro | |
| 38 | + - Kvaser USBcan R | |
| 39 | + | |
| 40 | + If unsure, say N. | |
| 41 | + | |
| 42 | + To compile this driver as a module, choose M here: the | |
| 43 | + module will be called kvaser_usb. | |
| 44 | + | |
| 16 | 45 | config CAN_PEAK_USB |
| 17 | 46 | tristate "PEAK PCAN-USB/USB Pro interfaces" |
| 18 | 47 | ---help--- |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o |
| 6 | 6 | obj-$(CONFIG_CAN_ESD_USB2) += esd_usb2.o |
| 7 | +obj-$(CONFIG_CAN_KVASER_USB) += kvaser_usb.o | |
| 7 | 8 | obj-$(CONFIG_CAN_PEAK_USB) += peak_usb/ |
| 8 | 9 | |
| 9 | 10 | ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG |
| @@ -245,7 +245,6 @@ struct ems_tx_urb_context { · 244 unmodified lines | ||
| 245 | 245 | |
| 246 | 246 | struct ems_usb { |
| 247 | 247 | struct can_priv can; /* must be the first member */ |
| 248 | − int open_time; | |
| 249 | 248 | |
| 250 | 249 | struct sk_buff *echo_skb[MAX_TX_URBS]; |
| 251 | 250 | |
| @@ -728,7 +727,6 @@ static int ems_usb_open(struct net_device *netdev) · 476 unmodified lines | ||
| 728 | 727 | return err; |
| 729 | 728 | } |
| 730 | 729 | |
| 731 | − dev->open_time = jiffies; | |
| 732 | 730 | |
| 733 | 731 | netif_start_queue(netdev); |
| 734 | 732 | |
| @@ -878,8 +876,6 @@ static int ems_usb_close(struct net_device *netdev) · 143 unmodified lines | ||
| 878 | 876 | |
| 879 | 877 | close_candev(netdev); |
| 880 | 878 | |
| 881 | − dev->open_time = 0; | |
| 882 | − | |
| 883 | 879 | return 0; |
| 884 | 880 | } |
| 885 | 881 | |
| @@ -905,9 +901,6 @@ static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode) · 19 unmodified lines | ||
| 905 | 901 | { |
| 906 | 902 | struct ems_usb *dev = netdev_priv(netdev); |
| 907 | 903 | |
| 908 | − if (!dev->open_time) | |
| 909 | − return -EINVAL; | |
| 910 | − | |
| 911 | 904 | switch (mode) { |
| 912 | 905 | case CAN_MODE_START: |
| 913 | 906 | if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL)) |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /* |
| 2 | − * CAN driver for esd CAN-USB/2 | |
| 2 | + * CAN driver for esd CAN-USB/2 and CAN-USB/Micro | |
| 3 | 3 | * |
| 4 | − * Copyright (C) 2010 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh | |
| 4 | + * Copyright (C) 2010-2012 Matthias Fuchs <matthias.fuchs@esd.eu>, esd gmbh | |
| 5 | 5 | * |
| 6 | 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | * under the terms of the GNU General Public License as published |
| @@ -28,14 +28,16 @@ · 20 unmodified lines | ||
| 28 | 28 | #include <linux/can/error.h> |
| 29 | 29 | |
| 30 | 30 | MODULE_AUTHOR("Matthias Fuchs <matthias.fuchs@esd.eu>"); |
| 31 | −MODULE_DESCRIPTION("CAN driver for esd CAN-USB/2 interfaces"); | |
| 31 | +MODULE_DESCRIPTION("CAN driver for esd CAN-USB/2 and CAN-USB/Micro interfaces"); | |
| 32 | 32 | MODULE_LICENSE("GPL v2"); |
| 33 | 33 | |
| 34 | 34 | /* Define these values to match your devices */ |
| 35 | 35 | #define USB_ESDGMBH_VENDOR_ID 0x0ab4 |
| 36 | 36 | #define USB_CANUSB2_PRODUCT_ID 0x0010 |
| 37 | +#define USB_CANUSBM_PRODUCT_ID 0x0011 | |
| 37 | 38 | |
| 38 | 39 | #define ESD_USB2_CAN_CLOCK 60000000 |
| 40 | +#define ESD_USBM_CAN_CLOCK 36000000 | |
| 39 | 41 | #define ESD_USB2_MAX_NETS 2 |
| 40 | 42 | |
| 41 | 43 | /* USB2 commands */ |
| @@ -69,6 +71,7 @@ MODULE_LICENSE("GPL v2"); · 27 unmodified lines | ||
| 69 | 71 | #define ESD_USB2_TSEG2_SHIFT 20 |
| 70 | 72 | #define ESD_USB2_SJW_MAX 4 |
| 71 | 73 | #define ESD_USB2_SJW_SHIFT 14 |
| 74 | +#define ESD_USBM_SJW_SHIFT 24 | |
| 72 | 75 | #define ESD_USB2_BRP_MIN 1 |
| 73 | 76 | #define ESD_USB2_BRP_MAX 1024 |
| 74 | 77 | #define ESD_USB2_BRP_INC 1 |
| @@ -183,6 +186,7 @@ struct __attribute__ ((packed)) esd_usb2_msg { · 108 unmodified lines | ||
| 183 | 186 | |
| 184 | 187 | static struct usb_device_id esd_usb2_table[] = { |
| 185 | 188 | {USB_DEVICE(USB_ESDGMBH_VENDOR_ID, USB_CANUSB2_PRODUCT_ID)}, |
| 189 | + {USB_DEVICE(USB_ESDGMBH_VENDOR_ID, USB_CANUSBM_PRODUCT_ID)}, | |
| 186 | 190 | {} |
| 187 | 191 | }; |
| 188 | 192 | MODULE_DEVICE_TABLE(usb, esd_usb2_table); |
| @@ -213,7 +217,6 @@ struct esd_usb2_net_priv { · 24 unmodified lines | ||
| 213 | 217 | struct usb_anchor tx_submitted; |
| 214 | 218 | struct esd_tx_urb_context tx_contexts[MAX_TX_URBS]; |
| 215 | 219 | |
| 216 | − int open_time; | |
| 217 | 220 | struct esd_usb2 *usb2; |
| 218 | 221 | struct net_device *netdev; |
| 219 | 222 | int index; |
| @@ -691,8 +694,6 @@ static int esd_usb2_open(struct net_device *netdev) · 471 unmodified lines | ||
| 691 | 694 | return err; |
| 692 | 695 | } |
| 693 | 696 | |
| 694 | − priv->open_time = jiffies; | |
| 695 | − | |
| 696 | 697 | netif_start_queue(netdev); |
| 697 | 698 | |
| 698 | 699 | return 0; |
| @@ -860,8 +861,6 @@ static int esd_usb2_close(struct net_device *netdev) · 161 unmodified lines | ||
| 860 | 861 | |
| 861 | 862 | close_candev(netdev); |
| 862 | 863 | |
| 863 | − priv->open_time = 0; | |
| 864 | − | |
| 865 | 864 | return 0; |
| 866 | 865 | } |
| 867 | 866 | |
| @@ -889,11 +888,22 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) · 21 unmodified lines | ||
| 889 | 888 | struct can_bittiming *bt = &priv->can.bittiming; |
| 890 | 889 | struct esd_usb2_msg msg; |
| 891 | 890 | u32 canbtr; |
| 891 | + int sjw_shift; | |
| 892 | 892 | |
| 893 | 893 | canbtr = ESD_USB2_UBR; |
| 894 | + if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) | |
| 895 | + canbtr |= ESD_USB2_LOM; | |
| 896 | + | |
| 894 | 897 | canbtr |= (bt->brp - 1) & (ESD_USB2_BRP_MAX - 1); |
| 898 | + | |
| 899 | + if (le16_to_cpu(priv->usb2->udev->descriptor.idProduct) == | |
| 900 | + USB_CANUSBM_PRODUCT_ID) | |
| 901 | + sjw_shift = ESD_USBM_SJW_SHIFT; | |
| 902 | + else | |
| 903 | + sjw_shift = ESD_USB2_SJW_SHIFT; | |
| 904 | + | |
| 895 | 905 | canbtr |= ((bt->sjw - 1) & (ESD_USB2_SJW_MAX - 1)) |
| 896 | − << ESD_USB2_SJW_SHIFT; | |
| 906 | + << sjw_shift; | |
| 897 | 907 | canbtr |= ((bt->prop_seg + bt->phase_seg1 - 1) |
| 898 | 908 | & (ESD_USB2_TSEG1_MAX - 1)) |
| 899 | 909 | << ESD_USB2_TSEG1_SHIFT; |
| @@ -926,11 +936,6 @@ static int esd_usb2_get_berr_counter(const struct net_device *netdev, · 26 unmodified lines | ||
| 926 | 936 | |
| 927 | 937 | static int esd_usb2_set_mode(struct net_device *netdev, enum can_mode mode) |
| 928 | 938 | { |
| 929 | − struct esd_usb2_net_priv *priv = netdev_priv(netdev); | |
| 930 | − | |
| 931 | − if (!priv->open_time) | |
| 932 | − return -EINVAL; | |
| 933 | − | |
| 934 | 939 | switch (mode) { |
| 935 | 940 | case CAN_MODE_START: |
| 936 | 941 | netif_wake_queue(netdev); |
| @@ -971,12 +976,20 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index) · 34 unmodified lines | ||
| 971 | 976 | priv->index = index; |
| 972 | 977 | |
| 973 | 978 | priv->can.state = CAN_STATE_STOPPED; |
| 974 | − priv->can.clock.freq = ESD_USB2_CAN_CLOCK; | |
| 979 | + priv->can.ctrlmode_supported = CAN_CTRLMODE_LISTENONLY; | |
| 980 | + | |
| 981 | + if (le16_to_cpu(dev->udev->descriptor.idProduct) == | |
| 982 | + USB_CANUSBM_PRODUCT_ID) | |
| 983 | + priv->can.clock.freq = ESD_USBM_CAN_CLOCK; | |
| 984 | + else { | |
| 985 | + priv->can.clock.freq = ESD_USB2_CAN_CLOCK; | |
| 986 | + priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; | |
| 987 | + } | |
| 988 | + | |
| 975 | 989 | priv->can.bittiming_const = &esd_usb2_bittiming_const; |
| 976 | 990 | priv->can.do_set_bittiming = esd_usb2_set_bittiming; |
| 977 | 991 | priv->can.do_set_mode = esd_usb2_set_mode; |
| 978 | 992 | priv->can.do_get_berr_counter = esd_usb2_get_berr_counter; |
| 979 | − priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; | |
| 980 | 993 | |
| 981 | 994 | netdev->flags |= IFF_ECHO; /* we support local echo */ |
| 982 | 995 | |
| @@ -0,0 +1,1627 @@ | ||
| 1 | +/* | |
| 2 | + * This program is free software; you can redistribute it and/or | |
| 3 | + * modify it under the terms of the GNU General Public License as | |
| 4 | + * published by the Free Software Foundation version 2. | |
| 5 | + * | |
| 6 | + * Parts of this driver are based on the following: | |
| 7 | + * - Kvaser linux leaf driver (version 4.78) | |
| 8 | + * - CAN driver for esd CAN-USB/2 | |
| 9 | + * | |
| 10 | + * 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) 2012 Olivier Sobrie <olivier@sobrie.be> | |
| 13 | + */ | |
| 14 | + | |
| 15 | +#include <linux/init.h> | |
| 16 | +#include <linux/completion.h> | |
| 17 | +#include <linux/module.h> | |
| 18 | +#include <linux/netdevice.h> | |
| 19 | +#include <linux/usb.h> | |
| 20 | + | |
| 21 | +#include <linux/can.h> | |
| 22 | +#include <linux/can/dev.h> | |
| 23 | +#include <linux/can/error.h> | |
| 24 | + | |
| 25 | +#define MAX_TX_URBS 16 | |
| 26 | +#define MAX_RX_URBS 4 | |
| 27 | +#define START_TIMEOUT 1000 /* msecs */ | |
| 28 | +#define STOP_TIMEOUT 1000 /* msecs */ | |
| 29 | +#define USB_SEND_TIMEOUT 1000 /* msecs */ | |
| 30 | +#define USB_RECV_TIMEOUT 1000 /* msecs */ | |
| 31 | +#define RX_BUFFER_SIZE 3072 | |
| 32 | +#define CAN_USB_CLOCK 8000000 | |
| 33 | +#define MAX_NET_DEVICES 3 | |
| 34 | + | |
| 35 | +/* Kvaser USB devices */ | |
| 36 | +#define KVASER_VENDOR_ID 0x0bfd | |
| 37 | +#define USB_LEAF_DEVEL_PRODUCT_ID 10 | |
| 38 | +#define USB_LEAF_LITE_PRODUCT_ID 11 | |
| 39 | +#define USB_LEAF_PRO_PRODUCT_ID 12 | |
| 40 | +#define USB_LEAF_SPRO_PRODUCT_ID 14 | |
| 41 | +#define USB_LEAF_PRO_LS_PRODUCT_ID 15 | |
| 42 | +#define USB_LEAF_PRO_SWC_PRODUCT_ID 16 | |
| 43 | +#define USB_LEAF_PRO_LIN_PRODUCT_ID 17 | |
| 44 | +#define USB_LEAF_SPRO_LS_PRODUCT_ID 18 | |
| 45 | +#define USB_LEAF_SPRO_SWC_PRODUCT_ID 19 | |
| 46 | +#define USB_MEMO2_DEVEL_PRODUCT_ID 22 | |
| 47 | +#define USB_MEMO2_HSHS_PRODUCT_ID 23 | |
| 48 | +#define USB_UPRO_HSHS_PRODUCT_ID 24 | |
| 49 | +#define USB_LEAF_LITE_GI_PRODUCT_ID 25 | |
| 50 | +#define USB_LEAF_PRO_OBDII_PRODUCT_ID 26 | |
| 51 | +#define USB_MEMO2_HSLS_PRODUCT_ID 27 | |
| 52 | +#define USB_LEAF_LITE_CH_PRODUCT_ID 28 | |
| 53 | +#define USB_BLACKBIRD_SPRO_PRODUCT_ID 29 | |
| 54 | +#define USB_OEM_MERCURY_PRODUCT_ID 34 | |
| 55 | +#define USB_OEM_LEAF_PRODUCT_ID 35 | |
| 56 | +#define USB_CAN_R_PRODUCT_ID 39 | |
| 57 | + | |
| 58 | +/* USB devices features */ | |
| 59 | +#define KVASER_HAS_SILENT_MODE BIT(0) | |
| 60 | +#define KVASER_HAS_TXRX_ERRORS BIT(1) | |
| 61 | + | |
| 62 | +/* Message header size */ | |
| 63 | +#define MSG_HEADER_LEN 2 | |
| 64 | + | |
| 65 | +/* Can message flags */ | |
| 66 | +#define MSG_FLAG_ERROR_FRAME BIT(0) | |
| 67 | +#define MSG_FLAG_OVERRUN BIT(1) | |
| 68 | +#define MSG_FLAG_NERR BIT(2) | |
| 69 | +#define MSG_FLAG_WAKEUP BIT(3) | |
| 70 | +#define MSG_FLAG_REMOTE_FRAME BIT(4) | |
| 71 | +#define MSG_FLAG_RESERVED BIT(5) | |
| 72 | +#define MSG_FLAG_TX_ACK BIT(6) | |
| 73 | +#define MSG_FLAG_TX_REQUEST BIT(7) | |
| 74 | + | |
| 75 | +/* Can states */ | |
| 76 | +#define M16C_STATE_BUS_RESET BIT(0) | |
| 77 | +#define M16C_STATE_BUS_ERROR BIT(4) | |
| 78 | +#define M16C_STATE_BUS_PASSIVE BIT(5) | |
| 79 | +#define M16C_STATE_BUS_OFF BIT(6) | |
| 80 | + | |
| 81 | +/* Can msg ids */ | |
| 82 | +#define CMD_RX_STD_MESSAGE 12 | |
| 83 | +#define CMD_TX_STD_MESSAGE 13 | |
| 84 | +#define CMD_RX_EXT_MESSAGE 14 | |
| 85 | +#define CMD_TX_EXT_MESSAGE 15 | |
| 86 | +#define CMD_SET_BUS_PARAMS 16 | |
| 87 | +#define CMD_GET_BUS_PARAMS 17 | |
| 88 | +#define CMD_GET_BUS_PARAMS_REPLY 18 | |
| 89 | +#define CMD_GET_CHIP_STATE 19 | |
| 90 | +#define CMD_CHIP_STATE_EVENT 20 | |
| 91 | +#define CMD_SET_CTRL_MODE 21 | |
| 92 | +#define CMD_GET_CTRL_MODE 22 | |
| 93 | +#define CMD_GET_CTRL_MODE_REPLY 23 | |
| 94 | +#define CMD_RESET_CHIP 24 | |
| 95 | +#define CMD_RESET_CARD 25 | |
| 96 | +#define CMD_START_CHIP 26 | |
| 97 | +#define CMD_START_CHIP_REPLY 27 | |
| 98 | +#define CMD_STOP_CHIP 28 | |
| 99 | +#define CMD_STOP_CHIP_REPLY 29 | |
| 100 | +#define CMD_GET_CARD_INFO2 32 | |
| 101 | +#define CMD_GET_CARD_INFO 34 | |
| 102 | +#define CMD_GET_CARD_INFO_REPLY 35 | |
| 103 | +#define CMD_GET_SOFTWARE_INFO 38 | |
| 104 | +#define CMD_GET_SOFTWARE_INFO_REPLY 39 | |
| 105 | +#define CMD_ERROR_EVENT 45 | |
| 106 | +#define CMD_FLUSH_QUEUE 48 | |
| 107 | +#define CMD_RESET_ERROR_COUNTER 49 | |
| 108 | +#define CMD_TX_ACKNOWLEDGE 50 | |
| 109 | +#define CMD_CAN_ERROR_EVENT 51 | |
| 110 | +#define CMD_USB_THROTTLE 77 | |
| 111 | +#define CMD_LOG_MESSAGE 106 | |
| 112 | + | |
| 113 | +/* error factors */ | |
| 114 | +#define M16C_EF_ACKE BIT(0) | |
| 115 | +#define M16C_EF_CRCE BIT(1) | |
| 116 | +#define M16C_EF_FORME BIT(2) | |
| 117 | +#define M16C_EF_STFE BIT(3) | |
| 118 | +#define M16C_EF_BITE0 BIT(4) | |
| 119 | +#define M16C_EF_BITE1 BIT(5) | |
| 120 | +#define M16C_EF_RCVE BIT(6) | |
| 121 | +#define M16C_EF_TRE BIT(7) | |
| 122 | + | |
| 123 | +/* bittiming parameters */ | |
| 124 | +#define KVASER_USB_TSEG1_MIN 1 | |
| 125 | +#define KVASER_USB_TSEG1_MAX 16 | |
| 126 | +#define KVASER_USB_TSEG2_MIN 1 | |
| 127 | +#define KVASER_USB_TSEG2_MAX 8 | |
| 128 | +#define KVASER_USB_SJW_MAX 4 | |
| 129 | +#define KVASER_USB_BRP_MIN 1 | |
| 130 | +#define KVASER_USB_BRP_MAX 64 | |
| 131 | +#define KVASER_USB_BRP_INC 1 | |
| 132 | + | |
| 133 | +/* ctrl modes */ | |
| 134 | +#define KVASER_CTRL_MODE_NORMAL 1 | |
| 135 | +#define KVASER_CTRL_MODE_SILENT 2 | |
| 136 | +#define KVASER_CTRL_MODE_SELFRECEPTION 3 | |
| 137 | +#define KVASER_CTRL_MODE_OFF 4 | |
| 138 | + | |
| 139 | +struct kvaser_msg_simple { | |
| 140 | + u8 tid; | |
| 141 | + u8 channel; | |
| 142 | +} __packed; | |
| 143 | + | |
| 144 | +struct kvaser_msg_cardinfo { | |
| 145 | + u8 tid; | |
| 146 | + u8 nchannels; | |
| 147 | + __le32 serial_number; | |
| 148 | + __le32 padding; | |
| 149 | + __le32 clock_resolution; | |
| 150 | + __le32 mfgdate; | |
| 151 | + u8 ean[8]; | |
| 152 | + u8 hw_revision; | |
| 153 | + u8 usb_hs_mode; | |
| 154 | + __le16 padding2; | |
| 155 | +} __packed; | |
| 156 | + | |
| 157 | +struct kvaser_msg_cardinfo2 { | |
| 158 | + u8 tid; | |
| 159 | + u8 channel; | |
| 160 | + u8 pcb_id[24]; | |
| 161 | + __le32 oem_unlock_code; | |
| 162 | +} __packed; | |
| 163 | + | |
| 164 | +struct kvaser_msg_softinfo { | |
| 165 | + u8 tid; | |
| 166 | + u8 channel; | |
| 167 | + __le32 sw_options; | |
| 168 | + __le32 fw_version; | |
| 169 | + __le16 max_outstanding_tx; | |
| 170 | + __le16 padding[9]; | |
| 171 | +} __packed; | |
| 172 | + | |
| 173 | +struct kvaser_msg_busparams { | |
| 174 | + u8 tid; | |
| 175 | + u8 channel; | |
| 176 | + __le32 bitrate; | |
| 177 | + u8 tseg1; | |
| 178 | + u8 tseg2; | |
| 179 | + u8 sjw; | |
| 180 | + u8 no_samp; | |
| 181 | +} __packed; | |
| 182 | + | |
| 183 | +struct kvaser_msg_tx_can { | |
| 184 | + u8 channel; | |
| 185 | + u8 tid; | |
| 186 | + u8 msg[14]; | |
| 187 | + u8 padding; | |
| 188 | + u8 flags; | |
| 189 | +} __packed; | |
| 190 | + | |
| 191 | +struct kvaser_msg_rx_can { | |
| 192 | + u8 channel; | |
| 193 | + u8 flag; | |
| 194 | + __le16 time[3]; | |
| 195 | + u8 msg[14]; | |
| 196 | +} __packed; | |
| 197 | + | |
| 198 | +struct kvaser_msg_chip_state_event { | |
| 199 | + u8 tid; | |
| 200 | + u8 channel; | |
| 201 | + __le16 time[3]; | |
| 202 | + u8 tx_errors_count; | |
| 203 | + u8 rx_errors_count; | |
| 204 | + u8 status; | |
| 205 | + u8 padding[3]; | |
| 206 | +} __packed; | |
| 207 | + | |
| 208 | +struct kvaser_msg_tx_acknowledge { | |
| 209 | + u8 channel; | |
| 210 | + u8 tid; | |
| 211 | + __le16 time[3]; | |
| 212 | + u8 flags; | |
| 213 | + u8 time_offset; | |
| 214 | +} __packed; | |
| 215 | + | |
| 216 | +struct kvaser_msg_error_event { | |
| 217 | + u8 tid; | |
| 218 | + u8 flags; | |
| 219 | + __le16 time[3]; | |
| 220 | + u8 channel; | |
| 221 | + u8 padding; | |
| 222 | + u8 tx_errors_count; | |
| 223 | + u8 rx_errors_count; | |
| 224 | + u8 status; | |
| 225 | + u8 error_factor; | |
| 226 | +} __packed; | |
| 227 | + | |
| 228 | +struct kvaser_msg_ctrl_mode { | |
| 229 | + u8 tid; | |
| 230 | + u8 channel; | |
| 231 | + u8 ctrl_mode; | |
| 232 | + u8 padding[3]; | |
| 233 | +} __packed; | |
| 234 | + | |
| 235 | +struct kvaser_msg_flush_queue { | |
| 236 | + u8 tid; | |
| 237 | + u8 channel; | |
| 238 | + u8 flags; | |
| 239 | + u8 padding[3]; | |
| 240 | +} __packed; | |
| 241 | + | |
| 242 | +struct kvaser_msg_log_message { | |
| 243 | + u8 channel; | |
| 244 | + u8 flags; | |
| 245 | + __le16 time[3]; | |
| 246 | + u8 dlc; | |
| 247 | + u8 time_offset; | |
| 248 | + __le32 id; | |
| 249 | + u8 data[8]; | |
| 250 | +} __packed; | |
| 251 | + | |
| 252 | +struct kvaser_msg { | |
| 253 | + u8 len; | |
| 254 | + u8 id; | |
| 255 | + union { | |
| 256 | + struct kvaser_msg_simple simple; | |
| 257 | + struct kvaser_msg_cardinfo cardinfo; | |
| 258 | + struct kvaser_msg_cardinfo2 cardinfo2; | |
| 259 | + struct kvaser_msg_softinfo softinfo; | |
| 260 | + struct kvaser_msg_busparams busparams; | |
| 261 | + struct kvaser_msg_tx_can tx_can; | |
| 262 | + struct kvaser_msg_rx_can rx_can; | |
| 263 | + struct kvaser_msg_chip_state_event chip_state_event; | |
| 264 | + struct kvaser_msg_tx_acknowledge tx_acknowledge; | |
| 265 | + struct kvaser_msg_error_event error_event; | |
| 266 | + struct kvaser_msg_ctrl_mode ctrl_mode; | |
| 267 | + struct kvaser_msg_flush_queue flush_queue; | |
| 268 | + struct kvaser_msg_log_message log_message; | |
| 269 | + } u; | |
| 270 | +} __packed; | |
| 271 | + | |
| 272 | +struct kvaser_usb_tx_urb_context { | |
| 273 | + struct kvaser_usb_net_priv *priv; | |
| 274 | + u32 echo_index; | |
| 275 | + int dlc; | |
| 276 | +}; | |
| 277 | + | |
| 278 | +struct kvaser_usb { | |
| 279 | + struct usb_device *udev; | |
| 280 | + struct kvaser_usb_net_priv *nets[MAX_NET_DEVICES]; | |
| 281 | + | |
| 282 | + struct usb_endpoint_descriptor *bulk_in, *bulk_out; | |
| 283 | + struct usb_anchor rx_submitted; | |
| 284 | + | |
| 285 | + u32 fw_version; | |
| 286 | + unsigned int nchannels; | |
| 287 | + | |
| 288 | + bool rxinitdone; | |
| 289 | + void *rxbuf[MAX_RX_URBS]; | |
| 290 | + dma_addr_t rxbuf_dma[MAX_RX_URBS]; | |
| 291 | +}; | |
| 292 | + | |
| 293 | +struct kvaser_usb_net_priv { | |
| 294 | + struct can_priv can; | |
| 295 | + | |
| 296 | + atomic_t active_tx_urbs; | |
| 297 | + struct usb_anchor tx_submitted; | |
| 298 | + struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS]; | |
| 299 | + | |
| 300 | + struct completion start_comp, stop_comp; | |
| 301 | + | |
| 302 | + struct kvaser_usb *dev; | |
| 303 | + struct net_device *netdev; | |
| 304 | + int channel; | |
| 305 | + | |
| 306 | + struct can_berr_counter bec; | |
| 307 | +}; | |
| 308 | + | |
| 309 | +static const struct usb_device_id kvaser_usb_table[] = { | |
| 310 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID) }, | |
| 311 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID) }, | |
| 312 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_PRODUCT_ID), | |
| 313 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 314 | + KVASER_HAS_SILENT_MODE }, | |
| 315 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_PRODUCT_ID), | |
| 316 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 317 | + KVASER_HAS_SILENT_MODE }, | |
| 318 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_LS_PRODUCT_ID), | |
| 319 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 320 | + KVASER_HAS_SILENT_MODE }, | |
| 321 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_SWC_PRODUCT_ID), | |
| 322 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 323 | + KVASER_HAS_SILENT_MODE }, | |
| 324 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_LIN_PRODUCT_ID), | |
| 325 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 326 | + KVASER_HAS_SILENT_MODE }, | |
| 327 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_LS_PRODUCT_ID), | |
| 328 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 329 | + KVASER_HAS_SILENT_MODE }, | |
| 330 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_SWC_PRODUCT_ID), | |
| 331 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 332 | + KVASER_HAS_SILENT_MODE }, | |
| 333 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_DEVEL_PRODUCT_ID), | |
| 334 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 335 | + KVASER_HAS_SILENT_MODE }, | |
| 336 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_HSHS_PRODUCT_ID), | |
| 337 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 338 | + KVASER_HAS_SILENT_MODE }, | |
| 339 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_UPRO_HSHS_PRODUCT_ID), | |
| 340 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 341 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_GI_PRODUCT_ID) }, | |
| 342 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_OBDII_PRODUCT_ID), | |
| 343 | + .driver_info = KVASER_HAS_TXRX_ERRORS | | |
| 344 | + KVASER_HAS_SILENT_MODE }, | |
| 345 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_HSLS_PRODUCT_ID), | |
| 346 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 347 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_CH_PRODUCT_ID), | |
| 348 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 349 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_SPRO_PRODUCT_ID), | |
| 350 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 351 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_OEM_MERCURY_PRODUCT_ID), | |
| 352 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 353 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_OEM_LEAF_PRODUCT_ID), | |
| 354 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 355 | + { USB_DEVICE(KVASER_VENDOR_ID, USB_CAN_R_PRODUCT_ID), | |
| 356 | + .driver_info = KVASER_HAS_TXRX_ERRORS }, | |
| 357 | + { } | |
| 358 | +}; | |
| 359 | +MODULE_DEVICE_TABLE(usb, kvaser_usb_table); | |
| 360 | + | |
| 361 | +static inline int kvaser_usb_send_msg(const struct kvaser_usb *dev, | |
| 362 | + struct kvaser_msg *msg) | |
| 363 | +{ | |
| 364 | + int actual_len; | |
| 365 | + | |
| 366 | + return usb_bulk_msg(dev->udev, | |
| 367 | + usb_sndbulkpipe(dev->udev, | |
| 368 | + dev->bulk_out->bEndpointAddress), | |
| 369 | + msg, msg->len, &actual_len, | |
| 370 | + USB_SEND_TIMEOUT); | |
| 371 | +} | |
| 372 | + | |
| 373 | +static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id, | |
| 374 | + struct kvaser_msg *msg) | |
| 375 | +{ | |
| 376 | + struct kvaser_msg *tmp; | |
| 377 | + void *buf; | |
| 378 | + int actual_len; | |
| 379 | + int err; | |
| 380 | + int pos = 0; | |
| 381 | + | |
| 382 | + buf = kzalloc(RX_BUFFER_SIZE, GFP_KERNEL); | |
| 383 | + if (!buf) | |
| 384 | + return -ENOMEM; | |
| 385 | + | |
| 386 | + err = usb_bulk_msg(dev->udev, | |
| 387 | + usb_rcvbulkpipe(dev->udev, | |
| 388 | + dev->bulk_in->bEndpointAddress), | |
| 389 | + buf, RX_BUFFER_SIZE, &actual_len, | |
| 390 | + USB_RECV_TIMEOUT); | |
| 391 | + if (err < 0) | |
| 392 | + goto end; | |
| 393 | + | |
| 394 | + while (pos <= actual_len - MSG_HEADER_LEN) { | |
| 395 | + tmp = buf + pos; | |
| 396 | + | |
| 397 | + if (!tmp->len) | |
| 398 | + break; | |
| 399 | + | |
| 400 | + if (pos + tmp->len > actual_len) { | |
| 401 | + dev_err(dev->udev->dev.parent, "Format error\n"); | |
| 402 | + break; | |
| 403 | + } | |
| 404 | + | |
| 405 | + if (tmp->id == id) { | |
| 406 | + memcpy(msg, tmp, tmp->len); | |
| 407 | + goto end; | |
| 408 | + } | |
| 409 | + | |
| 410 | + pos += tmp->len; | |
| 411 | + } | |
| 412 | + | |
| 413 | + err = -EINVAL; | |
| 414 | + | |
| 415 | +end: | |
| 416 | + kfree(buf); | |
| 417 | + | |
| 418 | + return err; | |
| 419 | +} | |
| 420 | + | |
| 421 | +static int kvaser_usb_send_simple_msg(const struct kvaser_usb *dev, | |
| 422 | + u8 msg_id, int channel) | |
| 423 | +{ | |
| 424 | + struct kvaser_msg *msg; | |
| 425 | + int rc; | |
| 426 | + | |
| 427 | + msg = kmalloc(sizeof(*msg), GFP_KERNEL); | |
| 428 | + if (!msg) | |
| 429 | + return -ENOMEM; | |
| 430 | + | |
| 431 | + msg->id = msg_id; | |
| 432 | + msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_simple); | |
| 433 | + msg->u.simple.channel = channel; | |
| 434 | + msg->u.simple.tid = 0xff; | |
| 435 | + | |
| 436 | + rc = kvaser_usb_send_msg(dev, msg); | |
| 437 | + | |
| 438 | + kfree(msg); | |
| 439 | + return rc; | |
| 440 | +} | |
| 441 | + | |
| 442 | +static int kvaser_usb_get_software_info(struct kvaser_usb *dev) | |
| 443 | +{ | |
| 444 | + struct kvaser_msg msg; | |
| 445 | + int err; | |
| 446 | + | |
| 447 | + err = kvaser_usb_send_simple_msg(dev, CMD_GET_SOFTWARE_INFO, 0); | |
| 448 | + if (err) | |
| 449 | + return err; | |
| 450 | + | |
| 451 | + err = kvaser_usb_wait_msg(dev, CMD_GET_SOFTWARE_INFO_REPLY, &msg); | |
| 452 | + if (err) | |
| 453 | + return err; | |
| 454 | + | |
| 455 | + dev->fw_version = le32_to_cpu(msg.u.softinfo.fw_version); | |
| 456 | + | |
| 457 | + return 0; | |
| 458 | +} | |
| 459 | + | |
| 460 | +static int kvaser_usb_get_card_info(struct kvaser_usb *dev) | |
| 461 | +{ | |
| 462 | + struct kvaser_msg msg; | |
| 463 | + int err; | |
| 464 | + | |
| 465 | + err = kvaser_usb_send_simple_msg(dev, CMD_GET_CARD_INFO, 0); | |
| 466 | + if (err) | |
| 467 | + return err; | |
| 468 | + | |
| 469 | + err = kvaser_usb_wait_msg(dev, CMD_GET_CARD_INFO_REPLY, &msg); | |
| 470 | + if (err) | |
| 471 | + return err; | |
| 472 | + | |
| 473 | + dev->nchannels = msg.u.cardinfo.nchannels; | |
| 474 | + | |
| 475 | + return 0; | |
| 476 | +} | |
| 477 | + | |
| 478 | +static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, | |
| 479 | + const struct kvaser_msg *msg) | |
| 480 | +{ | |
| 481 | + struct net_device_stats *stats; | |
| 482 | + struct kvaser_usb_tx_urb_context *context; | |
| 483 | + struct kvaser_usb_net_priv *priv; | |
| 484 | + struct sk_buff *skb; | |
| 485 | + struct can_frame *cf; | |
| 486 | + u8 channel = msg->u.tx_acknowledge.channel; | |
| 487 | + u8 tid = msg->u.tx_acknowledge.tid; | |
| 488 | + | |
| 489 | + if (channel >= dev->nchannels) { | |
| 490 | + dev_err(dev->udev->dev.parent, | |
| 491 | + "Invalid channel number (%d)\n", channel); | |
| 492 | + return; | |
| 493 | + } | |
| 494 | + | |
| 495 | + priv = dev->nets[channel]; | |
| 496 | + | |
| 497 | + if (!netif_device_present(priv->netdev)) | |
| 498 | + return; | |
| 499 | + | |
| 500 | + stats = &priv->netdev->stats; | |
| 501 | + | |
| 502 | + context = &priv->tx_contexts[tid % MAX_TX_URBS]; | |
| 503 | + | |
| 504 | + /* Sometimes the state change doesn't come after a bus-off event */ | |
| 505 | + if (priv->can.restart_ms && | |
| 506 | + (priv->can.state >= CAN_STATE_BUS_OFF)) { | |
| 507 | + skb = alloc_can_err_skb(priv->netdev, &cf); | |
| 508 | + if (skb) { | |
| 509 | + cf->can_id |= CAN_ERR_RESTARTED; | |
| 510 | + netif_rx(skb); | |
| 511 | + | |
| 512 | + stats->rx_packets++; | |
| 513 | + stats->rx_bytes += cf->can_dlc; | |
| 514 | + } else { | |
| 515 | + netdev_err(priv->netdev, | |
| 516 | + "No memory left for err_skb\n"); | |
| 517 | + } | |
| 518 | + | |
| 519 | + priv->can.can_stats.restarts++; | |
| 520 | + netif_carrier_on(priv->netdev); | |
| 521 | + | |
| 522 | + priv->can.state = CAN_STATE_ERROR_ACTIVE; | |
| 523 | + } | |
| 524 | + | |
| 525 | + stats->tx_packets++; | |
| 526 | + stats->tx_bytes += context->dlc; | |
| 527 | + can_get_echo_skb(priv->netdev, context->echo_index); | |
| 528 | + | |
| 529 | + context->echo_index = MAX_TX_URBS; | |
| 530 | + atomic_dec(&priv->active_tx_urbs); | |
| 531 | + | |
| 532 | + netif_wake_queue(priv->netdev); | |
| 533 | +} | |
| 534 | + | |
| 535 | +static void kvaser_usb_simple_msg_callback(struct urb *urb) | |
| 536 | +{ | |
| 537 | + struct net_device *netdev = urb->context; | |
| 538 | + | |
| 539 | + kfree(urb->transfer_buffer); | |
| 540 | + | |
| 541 | + if (urb->status) | |
| 542 | + netdev_warn(netdev, "urb status received: %d\n", | |
| 543 | + urb->status); | |
| 544 | +} | |
| 545 | + | |
| 546 | +static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, | |
| 547 | + u8 msg_id) | |
| 548 | +{ | |
| 549 | + struct kvaser_usb *dev = priv->dev; | |
| 550 | + struct net_device *netdev = priv->netdev; | |
| 551 | + struct kvaser_msg *msg; | |
| 552 | + struct urb *urb; | |
| 553 | + void *buf; | |
| 554 | + int err; | |
| 555 | + | |
| 556 | + urb = usb_alloc_urb(0, GFP_ATOMIC); | |
| 557 | + if (!urb) { | |
| 558 | + netdev_err(netdev, "No memory left for URBs\n"); | |
| 559 | + return -ENOMEM; | |
| 560 | + } | |
| 561 | + | |
| 562 | + buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); | |
| 563 | + if (!buf) { | |
| 564 | + netdev_err(netdev, "No memory left for USB buffer\n"); | |
| 565 | + usb_free_urb(urb); | |
| 566 | + return -ENOMEM; | |
| 567 | + } | |
| 568 | + | |
| 569 | + msg = (struct kvaser_msg *)buf; | |
| 570 | + msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_simple); | |
| 571 | + msg->id = msg_id; | |
| 572 | + msg->u.simple.channel = priv->channel; | |
| 573 | + | |
| 574 | + usb_fill_bulk_urb(urb, dev->udev, | |
| 575 | + usb_sndbulkpipe(dev->udev, | |
| 576 | + dev->bulk_out->bEndpointAddress), | |
| 577 | + buf, msg->len, | |
| 578 | + kvaser_usb_simple_msg_callback, priv); | |
| 579 | + usb_anchor_urb(urb, &priv->tx_submitted); | |
| 580 | + | |
| 581 | + err = usb_submit_urb(urb, GFP_ATOMIC); | |
| 582 | + if (err) { | |
| 583 | + netdev_err(netdev, "Error transmitting URB\n"); | |
| 584 | + usb_unanchor_urb(urb); | |
| 585 | + usb_free_urb(urb); | |
| 586 | + kfree(buf); | |
| 587 | + return err; | |
| 588 | + } | |
| 589 | + | |
| 590 | + usb_free_urb(urb); | |
| 591 | + | |
| 592 | + return 0; | |
| 593 | +} | |
| 594 | + | |
| 595 | +static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) | |
| 596 | +{ | |
| 597 | + int i; | |
| 598 | + | |
| 599 | + usb_kill_anchored_urbs(&priv->tx_submitted); | |
| 600 | + atomic_set(&priv->active_tx_urbs, 0); | |
| 601 | + | |
| 602 | + for (i = 0; i < MAX_TX_URBS; i++) | |
| 603 | + priv->tx_contexts[i].echo_index = MAX_TX_URBS; | |
| 604 | +} | |
| 605 | + | |
| 606 | +static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | |
| 607 | + const struct kvaser_msg *msg) | |
| 608 | +{ | |
| 609 | + struct can_frame *cf; | |
| 610 | + struct sk_buff *skb; | |
| 611 | + struct net_device_stats *stats; | |
| 612 | + struct kvaser_usb_net_priv *priv; | |
| 613 | + unsigned int new_state; | |
| 614 | + u8 channel, status, txerr, rxerr, error_factor; | |
| 615 | + | |
| 616 | + switch (msg->id) { | |
| 617 | + case CMD_CAN_ERROR_EVENT: | |
| 618 | + channel = msg->u.error_event.channel; | |
| 619 | + status = msg->u.error_event.status; | |
| 620 | + txerr = msg->u.error_event.tx_errors_count; | |
| 621 | + rxerr = msg->u.error_event.rx_errors_count; | |
| 622 | + error_factor = msg->u.error_event.error_factor; | |
| 623 | + break; | |
| 624 | + case CMD_LOG_MESSAGE: | |
| 625 | + channel = msg->u.log_message.channel; | |
| 626 | + status = msg->u.log_message.data[0]; | |
| 627 | + txerr = msg->u.log_message.data[2]; | |
| 628 | + rxerr = msg->u.log_message.data[3]; | |
| 629 | + error_factor = msg->u.log_message.data[1]; | |
| 630 | + break; | |
| 631 | + case CMD_CHIP_STATE_EVENT: | |
| 632 | + channel = msg->u.chip_state_event.channel; | |
| 633 | + status = msg->u.chip_state_event.status; | |
| 634 | + txerr = msg->u.chip_state_event.tx_errors_count; | |
| 635 | + rxerr = msg->u.chip_state_event.rx_errors_count; | |
| 636 | + error_factor = 0; | |
| 637 | + break; | |
| 638 | + default: | |
| 639 | + dev_err(dev->udev->dev.parent, "Invalid msg id (%d)\n", | |
| 640 | + msg->id); | |
| 641 | + return; | |
| 642 | + } | |
| 643 | + | |
| 644 | + if (channel >= dev->nchannels) { | |
| 645 | + dev_err(dev->udev->dev.parent, | |
| 646 | + "Invalid channel number (%d)\n", channel); | |
| 647 | + return; | |
| 648 | + } | |
| 649 | + | |
| 650 | + priv = dev->nets[channel]; | |
| 651 | + stats = &priv->netdev->stats; | |
| 652 | + | |
| 653 | + if (status & M16C_STATE_BUS_RESET) { | |
| 654 | + kvaser_usb_unlink_tx_urbs(priv); | |
| 655 | + return; | |
| 656 | + } | |
| 657 | + | |
| 658 | + skb = alloc_can_err_skb(priv->netdev, &cf); | |
| 659 | + if (!skb) { | |
| 660 | + stats->rx_dropped++; | |
| 661 | + return; | |
| 662 | + } | |
| 663 | + | |
| 664 | + new_state = priv->can.state; | |
| 665 | + | |
| 666 | + netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status); | |
| 667 | + | |
| 668 | + if (status & M16C_STATE_BUS_OFF) { | |
| 669 | + cf->can_id |= CAN_ERR_BUSOFF; | |
| 670 | + | |
| 671 | + priv->can.can_stats.bus_off++; | |
| 672 | + if (!priv->can.restart_ms) | |
| 673 | + kvaser_usb_simple_msg_async(priv, CMD_STOP_CHIP); | |
| 674 | + | |
| 675 | + netif_carrier_off(priv->netdev); | |
| 676 | + | |
| 677 | + new_state = CAN_STATE_BUS_OFF; | |
| 678 | + } else if (status & M16C_STATE_BUS_PASSIVE) { | |
| 679 | + if (priv->can.state != CAN_STATE_ERROR_PASSIVE) { | |
| 680 | + cf->can_id |= CAN_ERR_CRTL; | |
| 681 | + | |
| 682 | + if (txerr || rxerr) | |
| 683 | + cf->data[1] = (txerr > rxerr) | |
| 684 | + ? CAN_ERR_CRTL_TX_PASSIVE | |
| 685 | + : CAN_ERR_CRTL_RX_PASSIVE; | |
| 686 | + else | |
| 687 | + cf->data[1] = CAN_ERR_CRTL_TX_PASSIVE | | |
| 688 | + CAN_ERR_CRTL_RX_PASSIVE; | |
| 689 | + | |
| 690 | + priv->can.can_stats.error_passive++; | |
| 691 | + } | |
| 692 | + | |
| 693 | + new_state = CAN_STATE_ERROR_PASSIVE; | |
| 694 | + } | |
| 695 | + | |
| 696 | + if (status == M16C_STATE_BUS_ERROR) { | |
| 697 | + if ((priv->can.state < CAN_STATE_ERROR_WARNING) && | |
| 698 | + ((txerr >= 96) || (rxerr >= 96))) { | |
| 699 | + cf->can_id |= CAN_ERR_CRTL; | |
| 700 | + cf->data[1] = (txerr > rxerr) | |
| 701 | + ? CAN_ERR_CRTL_TX_WARNING | |
| 702 | + : CAN_ERR_CRTL_RX_WARNING; | |
| 703 | + | |
| 704 | + priv->can.can_stats.error_warning++; | |
| 705 | + new_state = CAN_STATE_ERROR_WARNING; | |
| 706 | + } else if (priv->can.state > CAN_STATE_ERROR_ACTIVE) { | |
| 707 | + cf->can_id |= CAN_ERR_PROT; | |
| 708 | + cf->data[2] = CAN_ERR_PROT_ACTIVE; | |
| 709 | + | |
| 710 | + new_state = CAN_STATE_ERROR_ACTIVE; | |
| 711 | + } | |
| 712 | + } | |
| 713 | + | |
| 714 | + if (!status) { | |
| 715 | + cf->can_id |= CAN_ERR_PROT; | |
| 716 | + cf->data[2] = CAN_ERR_PROT_ACTIVE; | |
| 717 | + | |
| 718 | + new_state = CAN_STATE_ERROR_ACTIVE; | |
| 719 | + } | |
| 720 | + | |
| 721 | + if (priv->can.restart_ms && | |
| 722 | + (priv->can.state >= CAN_STATE_BUS_OFF) && | |
| 723 | + (new_state < CAN_STATE_BUS_OFF)) { | |
| 724 | + cf->can_id |= CAN_ERR_RESTARTED; | |
| 725 | + netif_carrier_on(priv->netdev); | |
| 726 | + | |
| 727 | + priv->can.can_stats.restarts++; | |
| 728 | + } | |
| 729 | + | |
| 730 | + if (error_factor) { | |
| 731 | + priv->can.can_stats.bus_error++; | |
| 732 | + stats->rx_errors++; | |
| 733 | + | |
| 734 | + cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT; | |
| 735 | + | |
| 736 | + if (error_factor & M16C_EF_ACKE) | |
| 737 | + cf->data[3] |= (CAN_ERR_PROT_LOC_ACK); | |
| 738 | + if (error_factor & M16C_EF_CRCE) | |
| 739 | + cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | | |
| 740 | + CAN_ERR_PROT_LOC_CRC_DEL); | |
| 741 | + if (error_factor & M16C_EF_FORME) | |
| 742 | + cf->data[2] |= CAN_ERR_PROT_FORM; | |
| 743 | + if (error_factor & M16C_EF_STFE) | |
| 744 | + cf->data[2] |= CAN_ERR_PROT_STUFF; | |
| 745 | + if (error_factor & M16C_EF_BITE0) | |
| 746 | + cf->data[2] |= CAN_ERR_PROT_BIT0; | |
| 747 | + if (error_factor & M16C_EF_BITE1) | |
| 748 | + cf->data[2] |= CAN_ERR_PROT_BIT1; | |
| 749 | + if (error_factor & M16C_EF_TRE) | |
| 750 | + cf->data[2] |= CAN_ERR_PROT_TX; | |
| 751 | + } | |
| 752 | + | |
| 753 | + cf->data[6] = txerr; | |
| 754 | + cf->data[7] = rxerr; | |
| 755 | + | |
| 756 | + priv->bec.txerr = txerr; | |
| 757 | + priv->bec.rxerr = rxerr; | |
| 758 | + | |
| 759 | + priv->can.state = new_state; | |
| 760 | + | |
| 761 | + netif_rx(skb); | |
| 762 | + | |
| 763 | + stats->rx_packets++; | |
| 764 | + stats->rx_bytes += cf->can_dlc; | |
| 765 | +} | |
| 766 | + | |
| 767 | +static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, | |
| 768 | + const struct kvaser_msg *msg) | |
| 769 | +{ | |
| 770 | + struct can_frame *cf; | |
| 771 | + struct sk_buff *skb; | |
| 772 | + struct net_device_stats *stats = &priv->netdev->stats; | |
| 773 | + | |
| 774 | + if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | | |
| 775 | + MSG_FLAG_NERR)) { | |
| 776 | + netdev_err(priv->netdev, "Unknow error (flags: 0x%02x)\n", | |
| 777 | + msg->u.rx_can.flag); | |
| 778 | + | |
| 779 | + stats->rx_errors++; | |
| 780 | + return; | |
| 781 | + } | |
| 782 | + | |
| 783 | + if (msg->u.rx_can.flag & MSG_FLAG_OVERRUN) { | |
| 784 | + skb = alloc_can_err_skb(priv->netdev, &cf); | |
| 785 | + if (!skb) { | |
| 786 | + stats->rx_dropped++; | |
| 787 | + return; | |
| 788 | + } | |
| 789 | + | |
| 790 | + cf->can_id |= CAN_ERR_CRTL; | |
| 791 | + cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | |
| 792 | + | |
| 793 | + stats->rx_over_errors++; | |
| 794 | + stats->rx_errors++; | |
| 795 | + | |
| 796 | + netif_rx(skb); | |
| 797 | + | |
| 798 | + stats->rx_packets++; | |
| 799 | + stats->rx_bytes += cf->can_dlc; | |
| 800 | + } | |
| 801 | +} | |
| 802 | + | |
| 803 | +static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, | |
| 804 | + const struct kvaser_msg *msg) | |
| 805 | +{ | |
| 806 | + struct kvaser_usb_net_priv *priv; | |
| 807 | + struct can_frame *cf; | |
| 808 | + struct sk_buff *skb; | |
| 809 | + struct net_device_stats *stats; | |
| 810 | + u8 channel = msg->u.rx_can.channel; | |
| 811 | + | |
| 812 | + if (channel >= dev->nchannels) { | |
| 813 | + dev_err(dev->udev->dev.parent, | |
| 814 | + "Invalid channel number (%d)\n", channel); | |
| 815 | + return; | |
| 816 | + } | |
| 817 | + | |
| 818 | + priv = dev->nets[channel]; | |
| 819 | + stats = &priv->netdev->stats; | |
| 820 | + | |
| 821 | + if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | MSG_FLAG_NERR | | |
| 822 | + MSG_FLAG_OVERRUN)) { | |
| 823 | + kvaser_usb_rx_can_err(priv, msg); | |
| 824 | + return; | |
| 825 | + } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) { | |
| 826 | + netdev_warn(priv->netdev, | |
| 827 | + "Unhandled frame (flags: 0x%02x)", | |
| 828 | + msg->u.rx_can.flag); | |
| 829 | + return; | |
| 830 | + } | |
| 831 | + | |
| 832 | + skb = alloc_can_skb(priv->netdev, &cf); | |
| 833 | + if (!skb) { | |
| 834 | + stats->tx_dropped++; | |
| 835 | + return; | |
| 836 | + } | |
| 837 | + | |
| 838 | + cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) | | |
| 839 | + (msg->u.rx_can.msg[1] & 0x3f); | |
| 840 | + cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]); | |
| 841 | + | |
| 842 | + if (msg->id == CMD_RX_EXT_MESSAGE) { | |
| 843 | + cf->can_id <<= 18; | |
| 844 | + cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) | | |
| 845 | + ((msg->u.rx_can.msg[3] & 0xff) << 6) | | |
| 846 | + (msg->u.rx_can.msg[4] & 0x3f); | |
| 847 | + cf->can_id |= CAN_EFF_FLAG; | |
| 848 | + } | |
| 849 | + | |
| 850 | + if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME) | |
| 851 | + cf->can_id |= CAN_RTR_FLAG; | |
| 852 | + else | |
| 853 | + memcpy(cf->data, &msg->u.rx_can.msg[6], cf->can_dlc); | |
| 854 | + | |
| 855 | + netif_rx(skb); | |
| 856 | + | |
| 857 | + stats->rx_packets++; | |
| 858 | + stats->rx_bytes += cf->can_dlc; | |
| 859 | +} | |
| 860 | + | |
| 861 | +static void kvaser_usb_start_chip_reply(const struct kvaser_usb *dev, | |
| 862 | + const struct kvaser_msg *msg) | |
| 863 | +{ | |
| 864 | + struct kvaser_usb_net_priv *priv; | |
| 865 | + u8 channel = msg->u.simple.channel; | |
| 866 | + | |
| 867 | + if (channel >= dev->nchannels) { | |
| 868 | + dev_err(dev->udev->dev.parent, | |
| 869 | + "Invalid channel number (%d)\n", channel); | |
| 870 | + return; | |
| 871 | + } | |
| 872 | + | |
| 873 | + priv = dev->nets[channel]; | |
| 874 | + | |
| 875 | + if (completion_done(&priv->start_comp) && | |
| 876 | + netif_queue_stopped(priv->netdev)) { | |
| 877 | + netif_wake_queue(priv->netdev); | |
| 878 | + } else { | |
| 879 | + netif_start_queue(priv->netdev); | |
| 880 | + complete(&priv->start_comp); | |
| 881 | + } | |
| 882 | +} | |
| 883 | + | |
| 884 | +static void kvaser_usb_stop_chip_reply(const struct kvaser_usb *dev, | |
| 885 | + const struct kvaser_msg *msg) | |
| 886 | +{ | |
| 887 | + struct kvaser_usb_net_priv *priv; | |
| 888 | + u8 channel = msg->u.simple.channel; | |
| 889 | + | |
| 890 | + if (channel >= dev->nchannels) { | |
| 891 | + dev_err(dev->udev->dev.parent, | |
| 892 | + "Invalid channel number (%d)\n", channel); | |
| 893 | + return; | |
| 894 | + } | |
| 895 | + | |
| 896 | + priv = dev->nets[channel]; | |
| 897 | + | |
| 898 | + complete(&priv->stop_comp); | |
| 899 | +} | |
| 900 | + | |
| 901 | +static void kvaser_usb_handle_message(const struct kvaser_usb *dev, | |
| 902 | + const struct kvaser_msg *msg) | |
| 903 | +{ | |
| 904 | + switch (msg->id) { | |
| 905 | + case CMD_START_CHIP_REPLY: | |
| 906 | + kvaser_usb_start_chip_reply(dev, msg); | |
| 907 | + break; | |
| 908 | + | |
| 909 | + case CMD_STOP_CHIP_REPLY: | |
| 910 | + kvaser_usb_stop_chip_reply(dev, msg); | |
| 911 | + break; | |
| 912 | + | |
| 913 | + case CMD_RX_STD_MESSAGE: | |
| 914 | + case CMD_RX_EXT_MESSAGE: | |
| 915 | + kvaser_usb_rx_can_msg(dev, msg); | |
| 916 | + break; | |
| 917 | + | |
| 918 | + case CMD_CHIP_STATE_EVENT: | |
| 919 | + case CMD_CAN_ERROR_EVENT: | |
| 920 | + kvaser_usb_rx_error(dev, msg); | |
| 921 | + break; | |
| 922 | + | |
| 923 | + case CMD_LOG_MESSAGE: | |
| 924 | + if (msg->u.log_message.flags & MSG_FLAG_ERROR_FRAME) | |
| 925 | + kvaser_usb_rx_error(dev, msg); | |
| 926 | + break; | |
| 927 | + | |
| 928 | + case CMD_TX_ACKNOWLEDGE: | |
| 929 | + kvaser_usb_tx_acknowledge(dev, msg); | |
| 930 | + break; | |
| 931 | + | |
| 932 | + default: | |
| 933 | + dev_warn(dev->udev->dev.parent, | |
| 934 | + "Unhandled message (%d)\n", msg->id); | |
| 935 | + break; | |
| 936 | + } | |
| 937 | +} | |
| 938 | + | |
| 939 | +static void kvaser_usb_read_bulk_callback(struct urb *urb) | |
| 940 | +{ | |
| 941 | + struct kvaser_usb *dev = urb->context; | |
| 942 | + struct kvaser_msg *msg; | |
| 943 | + int pos = 0; | |
| 944 | + int err, i; | |
| 945 | + | |
| 946 | + switch (urb->status) { | |
| 947 | + case 0: | |
| 948 | + break; | |
| 949 | + case -ENOENT: | |
| 950 | + case -ESHUTDOWN: | |
| 951 | + return; | |
| 952 | + default: | |
| 953 | + dev_info(dev->udev->dev.parent, "Rx URB aborted (%d)\n", | |
| 954 | + urb->status); | |
| 955 | + goto resubmit_urb; | |
| 956 | + } | |
| 957 | + | |
| 958 | + while (pos <= urb->actual_length - MSG_HEADER_LEN) { | |
| 959 | + msg = urb->transfer_buffer + pos; | |
| 960 | + | |
| 961 | + if (!msg->len) | |
| 962 | + break; | |
| 963 | + | |
| 964 | + if (pos + msg->len > urb->actual_length) { | |
| 965 | + dev_err(dev->udev->dev.parent, "Format error\n"); | |
| 966 | + break; | |
| 967 | + } | |
| 968 | + | |
| 969 | + kvaser_usb_handle_message(dev, msg); | |
| 970 | + | |
| 971 | + pos += msg->len; | |
| 972 | + } | |
| 973 | + | |
| 974 | +resubmit_urb: | |
| 975 | + usb_fill_bulk_urb(urb, dev->udev, | |
| 976 | + usb_rcvbulkpipe(dev->udev, | |
| 977 | + dev->bulk_in->bEndpointAddress), | |
| 978 | + urb->transfer_buffer, RX_BUFFER_SIZE, | |
| 979 | + kvaser_usb_read_bulk_callback, dev); | |
| 980 | + | |
| 981 | + err = usb_submit_urb(urb, GFP_ATOMIC); | |
| 982 | + if (err == -ENODEV) { | |
| 983 | + for (i = 0; i < dev->nchannels; i++) { | |
| 984 | + if (!dev->nets[i]) | |
| 985 | + continue; | |
| 986 | + | |
| 987 | + netif_device_detach(dev->nets[i]->netdev); | |
| 988 | + } | |
| 989 | + } else if (err) { | |
| 990 | + dev_err(dev->udev->dev.parent, | |
| 991 | + "Failed resubmitting read bulk urb: %d\n", err); | |
| 992 | + } | |
| 993 | + | |
| 994 | + return; | |
| 995 | +} | |
| 996 | + | |
| 997 | +static int kvaser_usb_setup_rx_urbs(struct kvaser_usb *dev) | |
| 998 | +{ | |
| 999 | + int i, err = 0; | |
| 1000 | + | |
| 1001 | + if (dev->rxinitdone) | |
| 1002 | + return 0; | |
| 1003 | + | |
| 1004 | + for (i = 0; i < MAX_RX_URBS; i++) { | |
| 1005 | + struct urb *urb = NULL; | |
| 1006 | + u8 *buf = NULL; | |
| 1007 | + dma_addr_t buf_dma; | |
| 1008 | + | |
| 1009 | + urb = usb_alloc_urb(0, GFP_KERNEL); | |
| 1010 | + if (!urb) { | |
| 1011 | + dev_warn(dev->udev->dev.parent, | |
| 1012 | + "No memory left for URBs\n"); | |
| 1013 | + err = -ENOMEM; | |
| 1014 | + break; | |
| 1015 | + } | |
| 1016 | + | |
| 1017 | + buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, | |
| 1018 | + GFP_KERNEL, &buf_dma); | |
| 1019 | + if (!buf) { | |
| 1020 | + dev_warn(dev->udev->dev.parent, | |
| 1021 | + "No memory left for USB buffer\n"); | |
| 1022 | + usb_free_urb(urb); | |
| 1023 | + err = -ENOMEM; | |
| 1024 | + break; | |
| 1025 | + } | |
| 1026 | + | |
| 1027 | + usb_fill_bulk_urb(urb, dev->udev, | |
| 1028 | + usb_rcvbulkpipe(dev->udev, | |
| 1029 | + dev->bulk_in->bEndpointAddress), | |
| 1030 | + buf, RX_BUFFER_SIZE, | |
| 1031 | + kvaser_usb_read_bulk_callback, | |
| 1032 | + dev); | |
| 1033 | + urb->transfer_dma = buf_dma; | |
| 1034 | + urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | |
| 1035 | + usb_anchor_urb(urb, &dev->rx_submitted); | |
| 1036 | + | |
| 1037 | + err = usb_submit_urb(urb, GFP_KERNEL); | |
| 1038 | + if (err) { | |
| 1039 | + usb_unanchor_urb(urb); | |
| 1040 | + usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, | |
| 1041 | + buf_dma); | |
| 1042 | + usb_free_urb(urb); | |
| 1043 | + break; | |
| 1044 | + } | |
| 1045 | + | |
| 1046 | + dev->rxbuf[i] = buf; | |
| 1047 | + dev->rxbuf_dma[i] = buf_dma; | |
| 1048 | + | |
| 1049 | + usb_free_urb(urb); | |
| 1050 | + } | |
| 1051 | + | |
| 1052 | + if (i == 0) { | |
| 1053 | + dev_warn(dev->udev->dev.parent, | |
| 1054 | + "Cannot setup read URBs, error %d\n", err); | |
| 1055 | + return err; | |
| 1056 | + } else if (i < MAX_RX_URBS) { | |
| 1057 | + dev_warn(dev->udev->dev.parent, | |
| 1058 | + "RX performances may be slow\n"); | |
| 1059 | + } | |
| 1060 | + | |
| 1061 | + dev->rxinitdone = true; | |
| 1062 | + | |
| 1063 | + return 0; | |
| 1064 | +} | |
| 1065 | + | |
| 1066 | +static int kvaser_usb_set_opt_mode(const struct kvaser_usb_net_priv *priv) | |
| 1067 | +{ | |
| 1068 | + struct kvaser_msg *msg; | |
| 1069 | + int rc; | |
| 1070 | + | |
| 1071 | + msg = kmalloc(sizeof(*msg), GFP_KERNEL); | |
| 1072 | + if (!msg) | |
| 1073 | + return -ENOMEM; | |
| 1074 | + | |
| 1075 | + msg->id = CMD_SET_CTRL_MODE; | |
| 1076 | + msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_ctrl_mode); | |
| 1077 | + msg->u.ctrl_mode.tid = 0xff; | |
| 1078 | + msg->u.ctrl_mode.channel = priv->channel; | |
| 1079 | + | |
| 1080 | + if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) | |
| 1081 | + msg->u.ctrl_mode.ctrl_mode = KVASER_CTRL_MODE_SILENT; | |
| 1082 | + else | |
| 1083 | + msg->u.ctrl_mode.ctrl_mode = KVASER_CTRL_MODE_NORMAL; | |
| 1084 | + | |
| 1085 | + rc = kvaser_usb_send_msg(priv->dev, msg); | |
| 1086 | + | |
| 1087 | + kfree(msg); | |
| 1088 | + return rc; | |
| 1089 | +} | |
| 1090 | + | |
| 1091 | +static int kvaser_usb_start_chip(struct kvaser_usb_net_priv *priv) | |
| 1092 | +{ | |
| 1093 | + int err; | |
| 1094 | + | |
| 1095 | + init_completion(&priv->start_comp); | |
| 1096 | + | |
| 1097 | + err = kvaser_usb_send_simple_msg(priv->dev, CMD_START_CHIP, | |
| 1098 | + priv->channel); | |
| 1099 | + if (err) | |
| 1100 | + return err; | |
| 1101 | + | |
| 1102 | + if (!wait_for_completion_timeout(&priv->start_comp, | |
| 1103 | + msecs_to_jiffies(START_TIMEOUT))) | |
| 1104 | + return -ETIMEDOUT; | |
| 1105 | + | |
| 1106 | + return 0; | |
| 1107 | +} | |
| 1108 | + | |
| 1109 | +static int kvaser_usb_open(struct net_device *netdev) | |
| 1110 | +{ | |
| 1111 | + struct kvaser_usb_net_priv *priv = netdev_priv(netdev); | |
| 1112 | + struct kvaser_usb *dev = priv->dev; | |
| 1113 | + int err; | |
| 1114 | + | |
| 1115 | + err = open_candev(netdev); | |
| 1116 | + if (err) | |
| 1117 | + return err; | |
| 1118 | + | |
| 1119 | + err = kvaser_usb_setup_rx_urbs(dev); | |
| 1120 | + if (err) | |
| 1121 | + goto error; | |
| 1122 | + | |
| 1123 | + err = kvaser_usb_set_opt_mode(priv); | |
| 1124 | + if (err) | |
| 1125 | + goto error; | |
| 1126 | + | |
| 1127 | + err = kvaser_usb_start_chip(priv); | |
| 1128 | + if (err) { | |
| 1129 | + netdev_warn(netdev, "Cannot start device, error %d\n", err); | |
| 1130 | + goto error; | |
| 1131 | + } | |
| 1132 | + | |
| 1133 | + priv->can.state = CAN_STATE_ERROR_ACTIVE; | |
| 1134 | + | |
| 1135 | + return 0; | |
| 1136 | + | |
| 1137 | +error: | |
| 1138 | + close_candev(netdev); | |
| 1139 | + return err; | |
| 1140 | +} | |
| 1141 | + | |
| 1142 | +static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) | |
| 1143 | +{ | |
| 1144 | + int i; | |
| 1145 | + | |
| 1146 | + usb_kill_anchored_urbs(&dev->rx_submitted); | |
| 1147 | + | |
| 1148 | + for (i = 0; i < MAX_RX_URBS; i++) | |
| 1149 | + usb_free_coherent(dev->udev, RX_BUFFER_SIZE, | |
| 1150 | + dev->rxbuf[i], | |
| 1151 | + dev->rxbuf_dma[i]); | |
| 1152 | + | |
| 1153 | + for (i = 0; i < MAX_NET_DEVICES; i++) { | |
| 1154 | + struct kvaser_usb_net_priv *priv = dev->nets[i]; | |
| 1155 | + | |
| 1156 | + if (priv) | |
| 1157 | + kvaser_usb_unlink_tx_urbs(priv); | |
| 1158 | + } | |
| 1159 | +} | |
| 1160 | + | |
| 1161 | +static int kvaser_usb_stop_chip(struct kvaser_usb_net_priv *priv) | |
| 1162 | +{ | |
| 1163 | + int err; | |
| 1164 | + | |
| 1165 | + init_completion(&priv->stop_comp); | |
| 1166 | + | |
| 1167 | + err = kvaser_usb_send_simple_msg(priv->dev, CMD_STOP_CHIP, | |
| 1168 | + priv->channel); | |
| 1169 | + if (err) | |
| 1170 | + return err; | |
| 1171 | + | |
| 1172 | + if (!wait_for_completion_timeout(&priv->stop_comp, | |
| 1173 | + msecs_to_jiffies(STOP_TIMEOUT))) | |
| 1174 | + return -ETIMEDOUT; | |
| 1175 | + | |
| 1176 | + return 0; | |
| 1177 | +} | |
| 1178 | + | |
| 1179 | +static int kvaser_usb_flush_queue(struct kvaser_usb_net_priv *priv) | |
| 1180 | +{ | |
| 1181 | + struct kvaser_msg *msg; | |
| 1182 | + int rc; | |
| 1183 | + | |
| 1184 | + msg = kmalloc(sizeof(*msg), GFP_KERNEL); | |
| 1185 | + if (!msg) | |
| 1186 | + return -ENOMEM; | |
| 1187 | + | |
| 1188 | + msg->id = CMD_FLUSH_QUEUE; | |
| 1189 | + msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_flush_queue); | |
| 1190 | + msg->u.flush_queue.channel = priv->channel; | |
| 1191 | + msg->u.flush_queue.flags = 0x00; | |
| 1192 | + | |
| 1193 | + rc = kvaser_usb_send_msg(priv->dev, msg); | |
| 1194 | + | |
| 1195 | + kfree(msg); | |
| 1196 | + return rc; | |
| 1197 | +} | |
| 1198 | + | |
| 1199 | +static int kvaser_usb_close(struct net_device *netdev) | |
| 1200 | +{ | |
| 1201 | + struct kvaser_usb_net_priv *priv = netdev_priv(netdev); | |
| 1202 | + struct kvaser_usb *dev = priv->dev; | |
| 1203 | + int err; | |
| 1204 | + | |
| 1205 | + netif_stop_queue(netdev); | |
| 1206 | + | |
| 1207 | + err = kvaser_usb_flush_queue(priv); | |
| 1208 | + if (err) | |
| 1209 | + netdev_warn(netdev, "Cannot flush queue, error %d\n", err); | |
| 1210 | + | |
| 1211 | + if (kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel)) | |
| 1212 | + netdev_warn(netdev, "Cannot reset card, error %d\n", err); | |
| 1213 | + | |
| 1214 | + err = kvaser_usb_stop_chip(priv); | |
| 1215 | + if (err) | |
| 1216 | + netdev_warn(netdev, "Cannot stop device, error %d\n", err); | |
| 1217 | + | |
| 1218 | + priv->can.state = CAN_STATE_STOPPED; | |
| 1219 | + close_candev(priv->netdev); | |
| 1220 | + | |
| 1221 | + return 0; | |
| 1222 | +} | |
| 1223 | + | |
| 1224 | +static void kvaser_usb_write_bulk_callback(struct urb *urb) | |
| 1225 | +{ | |
| 1226 | + struct kvaser_usb_tx_urb_context *context = urb->context; | |
| 1227 | + struct kvaser_usb_net_priv *priv; | |
| 1228 | + struct net_device *netdev; | |
| 1229 | + | |
| 1230 | + if (WARN_ON(!context)) | |
| 1231 | + return; | |
| 1232 | + | |
| 1233 | + priv = context->priv; | |
| 1234 | + netdev = priv->netdev; | |
| 1235 | + | |
| 1236 | + kfree(urb->transfer_buffer); | |
| 1237 | + | |
| 1238 | + if (!netif_device_present(netdev)) | |
| 1239 | + return; | |
| 1240 | + | |
| 1241 | + if (urb->status) | |
| 1242 | + netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status); | |
| 1243 | +} | |
| 1244 | + | |
| 1245 | +static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |
| 1246 | + struct net_device *netdev) | |
| 1247 | +{ | |
| 1248 | + struct kvaser_usb_net_priv *priv = netdev_priv(netdev); | |
| 1249 | + struct kvaser_usb *dev = priv->dev; | |
| 1250 | + struct net_device_stats *stats = &netdev->stats; | |
| 1251 | + struct can_frame *cf = (struct can_frame *)skb->data; | |
| 1252 | + struct kvaser_usb_tx_urb_context *context = NULL; | |
| 1253 | + struct urb *urb; | |
| 1254 | + void *buf; | |
| 1255 | + struct kvaser_msg *msg; | |
| 1256 | + int i, err; | |
| 1257 | + int ret = NETDEV_TX_OK; | |
| 1258 | + | |
| 1259 | + if (can_dropped_invalid_skb(netdev, skb)) | |
| 1260 | + return NETDEV_TX_OK; | |
| 1261 | + | |
| 1262 | + urb = usb_alloc_urb(0, GFP_ATOMIC); | |
| 1263 | + if (!urb) { | |
| 1264 | + netdev_err(netdev, "No memory left for URBs\n"); | |
| 1265 | + stats->tx_dropped++; | |
| 1266 | + goto nourbmem; | |
| 1267 | + } | |
| 1268 | + | |
| 1269 | + buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); | |
| 1270 | + if (!buf) { | |
| 1271 | + netdev_err(netdev, "No memory left for USB buffer\n"); | |
| 1272 | + stats->tx_dropped++; | |
| 1273 | + goto nobufmem; | |
| 1274 | + } | |
| 1275 | + | |
| 1276 | + msg = buf; | |
| 1277 | + msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_tx_can); | |
| 1278 | + msg->u.tx_can.flags = 0; | |
| 1279 | + msg->u.tx_can.channel = priv->channel; | |
| 1280 | + | |
| 1281 | + if (cf->can_id & CAN_EFF_FLAG) { | |
| 1282 | + msg->id = CMD_TX_EXT_MESSAGE; | |
| 1283 | + msg->u.tx_can.msg[0] = (cf->can_id >> 24) & 0x1f; | |
| 1284 | + msg->u.tx_can.msg[1] = (cf->can_id >> 18) & 0x3f; | |
| 1285 | + msg->u.tx_can.msg[2] = (cf->can_id >> 14) & 0x0f; | |
| 1286 | + msg->u.tx_can.msg[3] = (cf->can_id >> 6) & 0xff; | |
| 1287 | + msg->u.tx_can.msg[4] = cf->can_id & 0x3f; | |
| 1288 | + } else { | |
| 1289 | + msg->id = CMD_TX_STD_MESSAGE; | |
| 1290 | + msg->u.tx_can.msg[0] = (cf->can_id >> 6) & 0x1f; | |
| 1291 | + msg->u.tx_can.msg[1] = cf->can_id & 0x3f; | |
| 1292 | + } | |
| 1293 | + | |
| 1294 | + msg->u.tx_can.msg[5] = cf->can_dlc; | |
| 1295 | + memcpy(&msg->u.tx_can.msg[6], cf->data, cf->can_dlc); | |
| 1296 | + | |
| 1297 | + if (cf->can_id & CAN_RTR_FLAG) | |
| 1298 | + msg->u.tx_can.flags |= MSG_FLAG_REMOTE_FRAME; | |
| 1299 | + | |
| 1300 | + for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { | |
| 1301 | + if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { | |
| 1302 | + context = &priv->tx_contexts[i]; | |
| 1303 | + break; | |
| 1304 | + } | |
| 1305 | + } | |
| 1306 | + | |
| 1307 | + if (!context) { | |
| 1308 | + netdev_warn(netdev, "cannot find free context\n"); | |
| 1309 | + ret = NETDEV_TX_BUSY; | |
| 1310 | + goto releasebuf; | |
| 1311 | + } | |
| 1312 | + | |
| 1313 | + context->priv = priv; | |
| 1314 | + context->echo_index = i; | |
| 1315 | + context->dlc = cf->can_dlc; | |
| 1316 | + | |
| 1317 | + msg->u.tx_can.tid = context->echo_index; | |
| 1318 | + | |
| 1319 | + usb_fill_bulk_urb(urb, dev->udev, | |
| 1320 | + usb_sndbulkpipe(dev->udev, | |
| 1321 | + dev->bulk_out->bEndpointAddress), | |
| 1322 | + buf, msg->len, | |
| 1323 | + kvaser_usb_write_bulk_callback, context); | |
| 1324 | + usb_anchor_urb(urb, &priv->tx_submitted); | |
| 1325 | + | |
| 1326 | + can_put_echo_skb(skb, netdev, context->echo_index); | |
| 1327 | + | |
| 1328 | + atomic_inc(&priv->active_tx_urbs); | |
| 1329 | + | |
| 1330 | + if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) | |
| 1331 | + netif_stop_queue(netdev); | |
| 1332 | + | |
| 1333 | + err = usb_submit_urb(urb, GFP_ATOMIC); | |
| 1334 | + if (unlikely(err)) { | |
| 1335 | + can_free_echo_skb(netdev, context->echo_index); | |
| 1336 | + | |
| 1337 | + skb = NULL; /* set to NULL to avoid double free in | |
| 1338 | + * dev_kfree_skb(skb) */ | |
| 1339 | + | |
| 1340 | + atomic_dec(&priv->active_tx_urbs); | |
| 1341 | + usb_unanchor_urb(urb); | |
| 1342 | + | |
| 1343 | + stats->tx_dropped++; | |
| 1344 | + | |
| 1345 | + if (err == -ENODEV) | |
| 1346 | + netif_device_detach(netdev); | |
| 1347 | + else | |
| 1348 | + netdev_warn(netdev, "Failed tx_urb %d\n", err); | |
| 1349 | + | |
| 1350 | + goto releasebuf; | |
| 1351 | + } | |
| 1352 | + | |
| 1353 | + usb_free_urb(urb); | |
| 1354 | + | |
| 1355 | + return NETDEV_TX_OK; | |
| 1356 | + | |
| 1357 | +releasebuf: | |
| 1358 | + kfree(buf); | |
| 1359 | +nobufmem: | |
| 1360 | + usb_free_urb(urb); | |
| 1361 | +nourbmem: | |
| 1362 | + dev_kfree_skb(skb); | |
| 1363 | + return ret; | |
| 1364 | +} | |
| 1365 | + | |
| 1366 | +static const struct net_device_ops kvaser_usb_netdev_ops = { | |
| 1367 | + .ndo_open = kvaser_usb_open, | |
| 1368 | + .ndo_stop = kvaser_usb_close, | |
| 1369 | + .ndo_start_xmit = kvaser_usb_start_xmit, | |
| 1370 | +}; | |
| 1371 | + | |
| 1372 | +static const struct can_bittiming_const kvaser_usb_bittiming_const = { | |
| 1373 | + .name = "kvaser_usb", | |
| 1374 | + .tseg1_min = KVASER_USB_TSEG1_MIN, | |
| 1375 | + .tseg1_max = KVASER_USB_TSEG1_MAX, | |
| 1376 | + .tseg2_min = KVASER_USB_TSEG2_MIN, | |
| 1377 | + .tseg2_max = KVASER_USB_TSEG2_MAX, | |
| 1378 | + .sjw_max = KVASER_USB_SJW_MAX, | |
| 1379 | + .brp_min = KVASER_USB_BRP_MIN, | |
| 1380 | + .brp_max = KVASER_USB_BRP_MAX, | |
| 1381 | + .brp_inc = KVASER_USB_BRP_INC, | |
| 1382 | +}; | |
| 1383 | + | |
| 1384 | +static int kvaser_usb_set_bittiming(struct net_device *netdev) | |
| 1385 | +{ | |
| 1386 | + struct kvaser_usb_net_priv *priv = netdev_priv(netdev); | |
| 1387 | + struct can_bittiming *bt = &priv->can.bittiming; | |
| 1388 | + struct kvaser_usb *dev = priv->dev; | |
| 1389 | + struct kvaser_msg *msg; | |
| 1390 | + int rc; | |
| 1391 | + | |
| 1392 | + msg = kmalloc(sizeof(*msg), GFP_KERNEL); | |
| 1393 | + if (!msg) | |
| 1394 | + return -ENOMEM; | |
| 1395 | + | |
| 1396 | + msg->id = CMD_SET_BUS_PARAMS; | |
| 1397 | + msg->len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_busparams); | |
| 1398 | + msg->u.busparams.channel = priv->channel; | |
| 1399 | + msg->u.busparams.tid = 0xff; | |
| 1400 | + msg->u.busparams.bitrate = cpu_to_le32(bt->bitrate); | |
| 1401 | + msg->u.busparams.sjw = bt->sjw; | |
| 1402 | + msg->u.busparams.tseg1 = bt->prop_seg + bt->phase_seg1; | |
| 1403 | + msg->u.busparams.tseg2 = bt->phase_seg2; | |
| 1404 | + | |
| 1405 | + if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) | |
| 1406 | + msg->u.busparams.no_samp = 3; | |
| 1407 | + else | |
| 1408 | + msg->u.busparams.no_samp = 1; | |
| 1409 | + | |
| 1410 | + rc = kvaser_usb_send_msg(dev, msg); | |
| 1411 | + | |
| 1412 | + kfree(msg); | |
| 1413 | + return rc; | |
| 1414 | +} | |
| 1415 | + | |
| 1416 | +static int kvaser_usb_set_mode(struct net_device *netdev, | |
| 1417 | + enum can_mode mode) | |
| 1418 | +{ | |
| 1419 | + struct kvaser_usb_net_priv *priv = netdev_priv(netdev); | |
| 1420 | + int err; | |
| 1421 | + | |
| 1422 | + switch (mode) { | |
| 1423 | + case CAN_MODE_START: | |
| 1424 | + err = kvaser_usb_simple_msg_async(priv, CMD_START_CHIP); | |
| 1425 | + if (err) | |
| 1426 | + return err; | |
| 1427 | + break; | |
| 1428 | + default: | |
| 1429 | + return -EOPNOTSUPP; | |
| 1430 | + } | |
| 1431 | + | |
| 1432 | + return 0; | |
| 1433 | +} | |
| 1434 | + | |
| 1435 | +static int kvaser_usb_get_berr_counter(const struct net_device *netdev, | |
| 1436 | + struct can_berr_counter *bec) | |
| 1437 | +{ | |
| 1438 | + struct kvaser_usb_net_priv *priv = netdev_priv(netdev); | |
| 1439 | + | |
| 1440 | + *bec = priv->bec; | |
| 1441 | + | |
| 1442 | + return 0; | |
| 1443 | +} | |
| 1444 | + | |
| 1445 | +static void kvaser_usb_remove_interfaces(struct kvaser_usb *dev) | |
| 1446 | +{ | |
| 1447 | + int i; | |
| 1448 | + | |
| 1449 | + for (i = 0; i < dev->nchannels; i++) { | |
| 1450 | + if (!dev->nets[i]) | |
| 1451 | + continue; | |
| 1452 | + | |
| 1453 | + unregister_netdev(dev->nets[i]->netdev); | |
| 1454 | + } | |
| 1455 | + | |
| 1456 | + kvaser_usb_unlink_all_urbs(dev); | |
| 1457 | + | |
| 1458 | + for (i = 0; i < dev->nchannels; i++) { | |
| 1459 | + if (!dev->nets[i]) | |
| 1460 | + continue; | |
| 1461 | + | |
| 1462 | + free_candev(dev->nets[i]->netdev); | |
| 1463 | + } | |
| 1464 | +} | |
| 1465 | + | |
| 1466 | +static int kvaser_usb_init_one(struct usb_interface *intf, | |
| 1467 | + const struct usb_device_id *id, int channel) | |
| 1468 | +{ | |
| 1469 | + struct kvaser_usb *dev = usb_get_intfdata(intf); | |
| 1470 | + struct net_device *netdev; | |
| 1471 | + struct kvaser_usb_net_priv *priv; | |
| 1472 | + int i, err; | |
| 1473 | + | |
| 1474 | + netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); | |
| 1475 | + if (!netdev) { | |
| 1476 | + dev_err(&intf->dev, "Cannot alloc candev\n"); | |
| 1477 | + return -ENOMEM; | |
| 1478 | + } | |
| 1479 | + | |
| 1480 | + priv = netdev_priv(netdev); | |
| 1481 | + | |
| 1482 | + init_completion(&priv->start_comp); | |
| 1483 | + init_completion(&priv->stop_comp); | |
| 1484 | + | |
| 1485 | + init_usb_anchor(&priv->tx_submitted); | |
| 1486 | + atomic_set(&priv->active_tx_urbs, 0); | |
| 1487 | + | |
| 1488 | + for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) | |
| 1489 | + priv->tx_contexts[i].echo_index = MAX_TX_URBS; | |
| 1490 | + | |
| 1491 | + priv->dev = dev; | |
| 1492 | + priv->netdev = netdev; | |
| 1493 | + priv->channel = channel; | |
| 1494 | + | |
| 1495 | + priv->can.state = CAN_STATE_STOPPED; | |
| 1496 | + priv->can.clock.freq = CAN_USB_CLOCK; | |
| 1497 | + priv->can.bittiming_const = &kvaser_usb_bittiming_const; | |
| 1498 | + priv->can.do_set_bittiming = kvaser_usb_set_bittiming; | |
| 1499 | + priv->can.do_set_mode = kvaser_usb_set_mode; | |
| 1500 | + if (id->driver_info & KVASER_HAS_TXRX_ERRORS) | |
| 1501 | + priv->can.do_get_berr_counter = kvaser_usb_get_berr_counter; | |
| 1502 | + priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; | |
| 1503 | + if (id->driver_info & KVASER_HAS_SILENT_MODE) | |
| 1504 | + priv->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY; | |
| 1505 | + | |
| 1506 | + netdev->flags |= IFF_ECHO; | |
| 1507 | + | |
| 1508 | + netdev->netdev_ops = &kvaser_usb_netdev_ops; | |
| 1509 | + | |
| 1510 | + SET_NETDEV_DEV(netdev, &intf->dev); | |
| 1511 | + | |
| 1512 | + dev->nets[channel] = priv; | |
| 1513 | + | |
| 1514 | + err = register_candev(netdev); | |
| 1515 | + if (err) { | |
| 1516 | + dev_err(&intf->dev, "Failed to register can device\n"); | |
| 1517 | + free_candev(netdev); | |
| 1518 | + dev->nets[channel] = NULL; | |
| 1519 | + return err; | |
| 1520 | + } | |
| 1521 | + | |
| 1522 | + netdev_dbg(netdev, "device registered\n"); | |
| 1523 | + | |
| 1524 | + return 0; | |
| 1525 | +} | |
| 1526 | + | |
| 1527 | +static void kvaser_usb_get_endpoints(const struct usb_interface *intf, | |
| 1528 | + struct usb_endpoint_descriptor **in, | |
| 1529 | + struct usb_endpoint_descriptor **out) | |
| 1530 | +{ | |
| 1531 | + const struct usb_host_interface *iface_desc; | |
| 1532 | + struct usb_endpoint_descriptor *endpoint; | |
| 1533 | + int i; | |
| 1534 | + | |
| 1535 | + iface_desc = &intf->altsetting[0]; | |
| 1536 | + | |
| 1537 | + for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | |
| 1538 | + endpoint = &iface_desc->endpoint[i].desc; | |
| 1539 | + | |
| 1540 | + if (usb_endpoint_is_bulk_in(endpoint)) | |
| 1541 | + *in = endpoint; | |
| 1542 | + | |
| 1543 | + if (usb_endpoint_is_bulk_out(endpoint)) | |
| 1544 | + *out = endpoint; | |
| 1545 | + } | |
| 1546 | +} | |
| 1547 | + | |
| 1548 | +static int kvaser_usb_probe(struct usb_interface *intf, | |
| 1549 | + const struct usb_device_id *id) | |
| 1550 | +{ | |
| 1551 | + struct kvaser_usb *dev; | |
| 1552 | + int err = -ENOMEM; | |
| 1553 | + int i; | |
| 1554 | + | |
| 1555 | + dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL); | |
| 1556 | + if (!dev) | |
| 1557 | + return -ENOMEM; | |
| 1558 | + | |
| 1559 | + kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); | |
| 1560 | + if (!dev->bulk_in || !dev->bulk_out) { | |
| 1561 | + dev_err(&intf->dev, "Cannot get usb endpoint(s)"); | |
| 1562 | + return err; | |
| 1563 | + } | |
| 1564 | + | |
| 1565 | + dev->udev = interface_to_usbdev(intf); | |
| 1566 | + | |
| 1567 | + init_usb_anchor(&dev->rx_submitted); | |
| 1568 | + | |
| 1569 | + usb_set_intfdata(intf, dev); | |
| 1570 | + | |
| 1571 | + for (i = 0; i < MAX_NET_DEVICES; i++) | |
| 1572 | + kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i); | |
| 1573 | + | |
| 1574 | + err = kvaser_usb_get_software_info(dev); | |
| 1575 | + if (err) { | |
| 1576 | + dev_err(&intf->dev, | |
| 1577 | + "Cannot get software infos, error %d\n", err); | |
| 1578 | + return err; | |
| 1579 | + } | |
| 1580 | + | |
| 1581 | + err = kvaser_usb_get_card_info(dev); | |
| 1582 | + if (err) { | |
| 1583 | + dev_err(&intf->dev, | |
| 1584 | + "Cannot get card infos, error %d\n", err); | |
| 1585 | + return err; | |
| 1586 | + } | |
| 1587 | + | |
| 1588 | + dev_dbg(&intf->dev, "Firmware version: %d.%d.%d\n", | |
| 1589 | + ((dev->fw_version >> 24) & 0xff), | |
| 1590 | + ((dev->fw_version >> 16) & 0xff), | |
| 1591 | + (dev->fw_version & 0xffff)); | |
| 1592 | + | |
| 1593 | + for (i = 0; i < dev->nchannels; i++) { | |
| 1594 | + err = kvaser_usb_init_one(intf, id, i); | |
| 1595 | + if (err) { | |
| 1596 | + kvaser_usb_remove_interfaces(dev); | |
| 1597 | + return err; | |
| 1598 | + } | |
| 1599 | + } | |
| 1600 | + | |
| 1601 | + return 0; | |
| 1602 | +} | |
| 1603 | + | |
| 1604 | +static void kvaser_usb_disconnect(struct usb_interface *intf) | |
| 1605 | +{ | |
| 1606 | + struct kvaser_usb *dev = usb_get_intfdata(intf); | |
| 1607 | + | |
| 1608 | + usb_set_intfdata(intf, NULL); | |
| 1609 | + | |
| 1610 | + if (!dev) | |
| 1611 | + return; | |
| 1612 | + | |
| 1613 | + kvaser_usb_remove_interfaces(dev); | |
| 1614 | +} | |
| 1615 | + | |
| 1616 | +static struct usb_driver kvaser_usb_driver = { | |
| 1617 | + .name = "kvaser_usb", | |
| 1618 | + .probe = kvaser_usb_probe, | |
| 1619 | + .disconnect = kvaser_usb_disconnect, | |
| 1620 | + .id_table = kvaser_usb_table, | |
| 1621 | +}; | |
| 1622 | + | |
| 1623 | +module_usb_driver(kvaser_usb_driver); | |
| 1624 | + | |
| 1625 | +MODULE_AUTHOR("Olivier Sobrie <olivier@sobrie.be>"); | |
| 1626 | +MODULE_DESCRIPTION("CAN driver for Kvaser CAN/USB devices"); | |
| 1627 | +MODULE_LICENSE("GPL v2"); | |
| @@ -520,7 +520,6 @@ static int peak_usb_ndo_open(struct net_device *netdev) · 519 unmodified lines | ||
| 520 | 520 | return err; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | − dev->open_time = jiffies; | |
| 524 | 523 | netif_start_queue(netdev); |
| 525 | 524 | |
| 526 | 525 | return 0; |
| @@ -576,7 +575,6 @@ static int peak_usb_ndo_stop(struct net_device *netdev) · 49 unmodified lines | ||
| 576 | 575 | |
| 577 | 576 | close_candev(netdev); |
| 578 | 577 | |
| 579 | − dev->open_time = 0; | |
| 580 | 578 | dev->can.state = CAN_STATE_STOPPED; |
| 581 | 579 | |
| 582 | 580 | /* can set bus off now */ |
| @@ -661,9 +659,6 @@ static int peak_usb_set_mode(struct net_device *netdev, enum can_mode mode) · 78 unmodified lines | ||
| 661 | 659 | struct peak_usb_device *dev = netdev_priv(netdev); |
| 662 | 660 | int err = 0; |
| 663 | 661 | |
| 664 | − if (!dev->open_time) | |
| 665 | − return -EINVAL; | |
| 666 | − | |
| 667 | 662 | switch (mode) { |
| 668 | 663 | case CAN_MODE_START: |
| 669 | 664 | err = peak_usb_restart(dev); |
| @@ -104,7 +104,6 @@ struct peak_usb_device { · 103 unmodified lines | ||
| 104 | 104 | struct can_priv can; |
| 105 | 105 | struct peak_usb_adapter *adapter; |
| 106 | 106 | unsigned int ctrl_idx; |
| 107 | − int open_time; | |
| 108 | 107 | u32 state; |
| 109 | 108 | |
| 110 | 109 | struct sk_buff *echo_skb[PCAN_USB_MAX_TX_URBS]; |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | menu "Distributed Switch Architecture drivers" |
| 2 | − depends on NET_DSA | |
| 2 | + depends on HAVE_NET_DSA | |
| 3 | 3 | |
| 4 | 4 | config NET_DSA_MV88E6XXX |
| 5 | 5 | tristate |
| @@ -7,6 +7,7 @@ config NET_DSA_MV88E6XXX · 1 unmodified line | ||
| 7 | 7 | |
| 8 | 8 | config NET_DSA_MV88E6060 |
| 9 | 9 | tristate "Marvell 88E6060 ethernet switch chip support" |
| 10 | + select NET_DSA | |
| 10 | 11 | select NET_DSA_TAG_TRAILER |
| 11 | 12 | ---help--- |
| 12 | 13 | This enables support for the Marvell 88E6060 ethernet switch |
| @@ -18,6 +19,7 @@ config NET_DSA_MV88E6XXX_NEED_PPU · 5 unmodified lines | ||
| 18 | 19 | |
| 19 | 20 | config NET_DSA_MV88E6131 |
| 20 | 21 | tristate "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support" |
| 22 | + select NET_DSA | |
| 21 | 23 | select NET_DSA_MV88E6XXX |
| 22 | 24 | select NET_DSA_MV88E6XXX_NEED_PPU |
| 23 | 25 | select NET_DSA_TAG_DSA |
| @@ -27,6 +29,7 @@ config NET_DSA_MV88E6131 · 3 unmodified lines | ||
| 27 | 29 | |
| 28 | 30 | config NET_DSA_MV88E6123_61_65 |
| 29 | 31 | tristate "Marvell 88E6123/6161/6165 ethernet switch chip support" |
| 32 | + select NET_DSA | |
| 30 | 33 | select NET_DSA_MV88E6XXX |
| 31 | 34 | select NET_DSA_TAG_EDSA |
| 32 | 35 | ---help--- |
| @@ -92,7 +92,7 @@ · 91 unmodified lines | ||
| 92 | 92 | #include <asm/io.h> |
| 93 | 93 | #include <asm/irq.h> |
| 94 | 94 | |
| 95 | −static char version[] __devinitdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n"; | |
| 95 | +static char version[] = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n"; | |
| 96 | 96 | |
| 97 | 97 | #ifdef EL3_DEBUG |
| 98 | 98 | static int el3_debug = EL3_DEBUG; |
| @@ -184,7 +184,7 @@ static int max_interrupt_work = 10; · 85 unmodified lines | ||
| 184 | 184 | static int nopnp; |
| 185 | 185 | #endif |
| 186 | 186 | |
| 187 | −static int __devinit el3_common_init(struct net_device *dev); | |
| 187 | +static int el3_common_init(struct net_device *dev); | |
| 188 | 188 | static void el3_common_remove(struct net_device *dev); |
| 189 | 189 | static ushort id_read_eeprom(int index); |
| 190 | 190 | static ushort read_eeprom(int ioaddr, int index); |
| @@ -270,9 +270,8 @@ static int el3_isa_id_sequence(__be16 *phys_addr) · 79 unmodified lines | ||
| 270 | 270 | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | −static void __devinit el3_dev_fill(struct net_device *dev, __be16 *phys_addr, | |
| 274 | − int ioaddr, int irq, int if_port, | |
| 275 | − enum el3_cardtype type) | |
| 273 | +static void el3_dev_fill(struct net_device *dev, __be16 *phys_addr, int ioaddr, | |
| 274 | + int irq, int if_port, enum el3_cardtype type) | |
| 276 | 275 | { |
| 277 | 276 | struct el3_private *lp = netdev_priv(dev); |
| 278 | 277 | |
| @@ -283,8 +282,7 @@ static void __devinit el3_dev_fill(struct net_device *dev, __be16 *phys_addr, · 4 unmodified lines | ||
| 283 | 282 | lp->type = type; |
| 284 | 283 | } |
| 285 | 284 | |
| 286 | −static int __devinit el3_isa_match(struct device *pdev, | |
| 287 | − unsigned int ndev) | |
| 285 | +static int el3_isa_match(struct device *pdev, unsigned int ndev) | |
| 288 | 286 | { |
| 289 | 287 | struct net_device *dev; |
| 290 | 288 | int ioaddr, isa_irq, if_port, err; |
| @@ -341,7 +339,7 @@ static int __devinit el3_isa_match(struct device *pdev, · 50 unmodified lines | ||
| 341 | 339 | return 1; |
| 342 | 340 | } |
| 343 | 341 | |
| 344 | −static int __devexit el3_isa_remove(struct device *pdev, | |
| 342 | +static int el3_isa_remove(struct device *pdev, | |
| 345 | 343 | unsigned int ndev) |
| 346 | 344 | { |
| 347 | 345 | el3_device_remove(pdev); |
| @@ -382,7 +380,7 @@ static int el3_isa_resume(struct device *dev, unsigned int n) · 34 unmodified lines | ||
| 382 | 380 | |
| 383 | 381 | static struct isa_driver el3_isa_driver = { |
| 384 | 382 | .match = el3_isa_match, |
| 385 | − .remove = __devexit_p(el3_isa_remove), | |
| 383 | + .remove = el3_isa_remove, | |
| 386 | 384 | #ifdef CONFIG_PM |
| 387 | 385 | .suspend = el3_isa_suspend, |
| 388 | 386 | .resume = el3_isa_resume, |
| @@ -406,8 +404,7 @@ static struct pnp_device_id el3_pnp_ids[] = { · 17 unmodified lines | ||
| 406 | 404 | }; |
| 407 | 405 | MODULE_DEVICE_TABLE(pnp, el3_pnp_ids); |
| 408 | 406 | |
| 409 | −static int __devinit el3_pnp_probe(struct pnp_dev *pdev, | |
| 410 | − const struct pnp_device_id *id) | |
| 407 | +static int el3_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id) | |
| 411 | 408 | { |
| 412 | 409 | short i; |
| 413 | 410 | int ioaddr, irq, if_port; |
| @@ -445,7 +442,7 @@ static int __devinit el3_pnp_probe(struct pnp_dev *pdev, · 31 unmodified lines | ||
| 445 | 442 | return 0; |
| 446 | 443 | } |
| 447 | 444 | |
| 448 | −static void __devexit el3_pnp_remove(struct pnp_dev *pdev) | |
| 445 | +static void el3_pnp_remove(struct pnp_dev *pdev) | |
| 449 | 446 | { |
| 450 | 447 | el3_common_remove(pnp_get_drvdata(pdev)); |
| 451 | 448 | pnp_set_drvdata(pdev, NULL); |
| @@ -467,7 +464,7 @@ static struct pnp_driver el3_pnp_driver = { · 15 unmodified lines | ||
| 467 | 464 | .name = "3c509", |
| 468 | 465 | .id_table = el3_pnp_ids, |
| 469 | 466 | .probe = el3_pnp_probe, |
| 470 | − .remove = __devexit_p(el3_pnp_remove), | |
| 467 | + .remove = el3_pnp_remove, | |
| 471 | 468 | #ifdef CONFIG_PM |
| 472 | 469 | .suspend = el3_pnp_suspend, |
| 473 | 470 | .resume = el3_pnp_resume, |
| @@ -496,7 +493,7 @@ static struct eisa_driver el3_eisa_driver = { · 22 unmodified lines | ||
| 496 | 493 | .driver = { |
| 497 | 494 | .name = "3c579", |
| 498 | 495 | .probe = el3_eisa_probe, |
| 499 | − .remove = __devexit_p (el3_device_remove), | |
| 496 | + .remove = el3_device_remove, | |
| 500 | 497 | .suspend = el3_suspend, |
| 501 | 498 | .resume = el3_resume, |
| 502 | 499 | } |
| @@ -519,7 +516,7 @@ static const struct net_device_ops netdev_ops = { · 16 unmodified lines | ||
| 519 | 516 | #endif |
| 520 | 517 | }; |
| 521 | 518 | |
| 522 | −static int __devinit el3_common_init(struct net_device *dev) | |
| 519 | +static int el3_common_init(struct net_device *dev) | |
| 523 | 520 | { |
| 524 | 521 | struct el3_private *lp = netdev_priv(dev); |
| 525 | 522 | int err; |
| @@ -618,7 +615,7 @@ static int __init el3_eisa_probe (struct device *device) · 92 unmodified lines | ||
| 618 | 615 | /* This remove works for all device types. |
| 619 | 616 | * |
| 620 | 617 | * The net dev must be stored in the driver data field */ |
| 621 | −static int __devexit el3_device_remove (struct device *device) | |
| 618 | +static int el3_device_remove(struct device *device) | |
| 622 | 619 | { |
| 623 | 620 | struct net_device *dev; |
| 624 | 621 | |
| @@ -102,7 +102,7 @@ static int vortex_debug = 1; · 101 unmodified lines | ||
| 102 | 102 | #include <linux/delay.h> |
| 103 | 103 | |
| 104 | 104 | |
| 105 | −static const char version[] __devinitconst = | |
| 105 | +static const char version[] = | |
| 106 | 106 | DRV_NAME ": Donald Becker and others.\n"; |
| 107 | 107 | |
| 108 | 108 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
| @@ -277,7 +277,7 @@ static struct vortex_chip_info { · 168 unmodified lines | ||
| 277 | 277 | int flags; |
| 278 | 278 | int drv_flags; |
| 279 | 279 | int io_size; |
| 280 | −} vortex_info_tbl[] __devinitdata = { | |
| 280 | +} vortex_info_tbl[] = { | |
| 281 | 281 | {"3c590 Vortex 10Mbps", |
| 282 | 282 | PCI_USES_MASTER, IS_VORTEX, 32, }, |
| 283 | 283 | {"3c592 EISA 10Mbps Demon/Vortex", /* AKPM: from Don's 3c59x_cb.c 0.49H */ |
| @@ -931,7 +931,7 @@ static int __init vortex_eisa_probe(struct device *device) · 647 unmodified lines | ||
| 931 | 931 | return 0; |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | −static int __devexit vortex_eisa_remove(struct device *device) | |
| 934 | +static int vortex_eisa_remove(struct device *device) | |
| 935 | 935 | { |
| 936 | 936 | struct eisa_device *edev; |
| 937 | 937 | struct net_device *dev; |
| @@ -962,7 +962,7 @@ static struct eisa_driver vortex_eisa_driver = { · 24 unmodified lines | ||
| 962 | 962 | .driver = { |
| 963 | 963 | .name = "3c59x", |
| 964 | 964 | .probe = vortex_eisa_probe, |
| 965 | − .remove = __devexit_p(vortex_eisa_remove) | |
| 965 | + .remove = vortex_eisa_remove | |
| 966 | 966 | } |
| 967 | 967 | }; |
| 968 | 968 | |
| @@ -1000,8 +1000,8 @@ static int __init vortex_eisa_init(void) · 31 unmodified lines | ||
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | /* returns count (>= 0), or negative on error */ |
| 1003 | −static int __devinit vortex_init_one(struct pci_dev *pdev, | |
| 1004 | − const struct pci_device_id *ent) | |
| 1003 | +static int vortex_init_one(struct pci_dev *pdev, | |
| 1004 | + const struct pci_device_id *ent) | |
| 1005 | 1005 | { |
| 1006 | 1006 | int rc, unit, pci_bar; |
| 1007 | 1007 | struct vortex_chip_info *vci; |
| @@ -1088,9 +1088,8 @@ static const struct net_device_ops vortex_netdev_ops = { · 80 unmodified lines | ||
| 1088 | 1088 | * |
| 1089 | 1089 | * NOTE: pdev can be NULL, for the case of a Compaq device |
| 1090 | 1090 | */ |
| 1091 | −static int __devinit vortex_probe1(struct device *gendev, | |
| 1092 | − void __iomem *ioaddr, int irq, | |
| 1093 | − int chip_idx, int card_idx) | |
| 1091 | +static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, | |
| 1092 | + int chip_idx, int card_idx) | |
| 1094 | 1093 | { |
| 1095 | 1094 | struct vortex_private *vp; |
| 1096 | 1095 | int option; |
| @@ -3222,7 +3221,7 @@ static void acpi_set_WOL(struct net_device *dev) · 2125 unmodified lines | ||
| 3222 | 3221 | } |
| 3223 | 3222 | |
| 3224 | 3223 | |
| 3225 | −static void __devexit vortex_remove_one(struct pci_dev *pdev) | |
| 3224 | +static void vortex_remove_one(struct pci_dev *pdev) | |
| 3226 | 3225 | { |
| 3227 | 3226 | struct net_device *dev = pci_get_drvdata(pdev); |
| 3228 | 3227 | struct vortex_private *vp; |
| @@ -3265,7 +3264,7 @@ static void __devexit vortex_remove_one(struct pci_dev *pdev) · 36 unmodified lines | ||
| 3265 | 3264 | static struct pci_driver vortex_driver = { |
| 3266 | 3265 | .name = "3c59x", |
| 3267 | 3266 | .probe = vortex_init_one, |
| 3268 | − .remove = __devexit_p(vortex_remove_one), | |
| 3267 | + .remove = vortex_remove_one, | |
| 3269 | 3268 | .id_table = vortex_pci_tbl, |
| 3270 | 3269 | .driver.pm = VORTEX_PM_OPS, |
| 3271 | 3270 | }; |
| @@ -80,7 +80,7 @@ config PCMCIA_3C589 · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | config VORTEX |
| 82 | 82 | tristate "3c590/3c900 series (592/595/597) \"Vortex/Boomerang\" support" |
| 83 | − depends on (PCI || EISA) | |
| 83 | + depends on (PCI || EISA) && HAS_IOPORT | |
| 84 | 84 | select NET_CORE |
| 85 | 85 | select MII |
| 86 | 86 | ---help--- |
| @@ -168,7 +168,7 @@ enum typhoon_cards { · 167 unmodified lines | ||
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | 170 | /* directly indexed by enum typhoon_cards, above */ |
| 171 | −static struct typhoon_card_info typhoon_card_info[] __devinitdata = { | |
| 171 | +static struct typhoon_card_info typhoon_card_info[] = { | |
| 172 | 172 | { "3Com Typhoon (3C990-TX)", |
| 173 | 173 | TYPHOON_CRYPTO_NONE}, |
| 174 | 174 | { "3Com Typhoon (3CR990-TX-95)", |
| @@ -2200,7 +2200,7 @@ need_resume: · 2025 unmodified lines | ||
| 2200 | 2200 | } |
| 2201 | 2201 | #endif |
| 2202 | 2202 | |
| 2203 | −static int __devinit | |
| 2203 | +static int | |
| 2204 | 2204 | typhoon_test_mmio(struct pci_dev *pdev) |
| 2205 | 2205 | { |
| 2206 | 2206 | void __iomem *ioaddr = pci_iomap(pdev, 1, 128); |
| @@ -2258,7 +2258,7 @@ static const struct net_device_ops typhoon_netdev_ops = { · 51 unmodified lines | ||
| 2258 | 2258 | .ndo_change_mtu = eth_change_mtu, |
| 2259 | 2259 | }; |
| 2260 | 2260 | |
| 2261 | −static int __devinit | |
| 2261 | +static int | |
| 2262 | 2262 | typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 2263 | 2263 | { |
| 2264 | 2264 | struct net_device *dev; |
| @@ -2509,7 +2509,7 @@ error_out: · 244 unmodified lines | ||
| 2509 | 2509 | return err; |
| 2510 | 2510 | } |
| 2511 | 2511 | |
| 2512 | −static void __devexit | |
| 2512 | +static void | |
| 2513 | 2513 | typhoon_remove_one(struct pci_dev *pdev) |
| 2514 | 2514 | { |
| 2515 | 2515 | struct net_device *dev = pci_get_drvdata(pdev); |
| @@ -2533,7 +2533,7 @@ static struct pci_driver typhoon_driver = { · 17 unmodified lines | ||
| 2533 | 2533 | .name = KBUILD_MODNAME, |
| 2534 | 2534 | .id_table = typhoon_pci_tbl, |
| 2535 | 2535 | .probe = typhoon_init_one, |
| 2536 | − .remove = __devexit_p(typhoon_remove_one), | |
| 2536 | + .remove = typhoon_remove_one, | |
| 2537 | 2537 | #ifdef CONFIG_PM |
| 2538 | 2538 | .suspend = typhoon_suspend, |
| 2539 | 2539 | .resume = typhoon_resume, |
| @@ -191,11 +191,11 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, · 190 unmodified lines | ||
| 191 | 191 | ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD); |
| 192 | 192 | |
| 193 | 193 | if (ei_local->word16) |
| 194 | − readsw(nic_base + NE_DATAPORT, hdr, | |
| 195 | − sizeof(struct e8390_pkt_hdr) >> 1); | |
| 194 | + ioread16_rep(nic_base + NE_DATAPORT, hdr, | |
| 195 | + sizeof(struct e8390_pkt_hdr) >> 1); | |
| 196 | 196 | else |
| 197 | − readsb(nic_base + NE_DATAPORT, hdr, | |
| 198 | − sizeof(struct e8390_pkt_hdr)); | |
| 197 | + ioread8_rep(nic_base + NE_DATAPORT, hdr, | |
| 198 | + sizeof(struct e8390_pkt_hdr)); | |
| 199 | 199 | |
| 200 | 200 | ei_outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ |
| 201 | 201 | ei_local->dmaing &= ~0x01; |
| @@ -237,12 +237,12 @@ static void ax_block_input(struct net_device *dev, int count, · 35 unmodified lines | ||
| 237 | 237 | ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD); |
| 238 | 238 | |
| 239 | 239 | if (ei_local->word16) { |
| 240 | − readsw(nic_base + NE_DATAPORT, buf, count >> 1); | |
| 240 | + ioread16_rep(nic_base + NE_DATAPORT, buf, count >> 1); | |
| 241 | 241 | if (count & 0x01) |
| 242 | 242 | buf[count-1] = ei_inb(nic_base + NE_DATAPORT); |
| 243 | 243 | |
| 244 | 244 | } else { |
| 245 | − readsb(nic_base + NE_DATAPORT, buf, count); | |
| 245 | + ioread8_rep(nic_base + NE_DATAPORT, buf, count); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | ei_local->dmaing &= ~1; |
| @@ -286,9 +286,9 @@ static void ax_block_output(struct net_device *dev, int count, · 37 unmodified lines | ||
| 286 | 286 | |
| 287 | 287 | ei_outb(E8390_RWRITE+E8390_START, nic_base + NE_CMD); |
| 288 | 288 | if (ei_local->word16) |
| 289 | − writesw(nic_base + NE_DATAPORT, buf, count >> 1); | |
| 289 | + iowrite16_rep(nic_base + NE_DATAPORT, buf, count >> 1); | |
| 290 | 290 | else |
| 291 | − writesb(nic_base + NE_DATAPORT, buf, count); | |
| 291 | + iowrite8_rep(nic_base + NE_DATAPORT, buf, count); | |
| 292 | 292 | |
| 293 | 293 | dma_start = jiffies; |
| 294 | 294 | |
| @@ -463,12 +463,6 @@ etherh_open(struct net_device *dev) · 462 unmodified lines | ||
| 463 | 463 | { |
| 464 | 464 | struct ei_device *ei_local = netdev_priv(dev); |
| 465 | 465 | |
| 466 | − if (!is_valid_ether_addr(dev->dev_addr)) { | |
| 467 | − printk(KERN_WARNING "%s: invalid ethernet MAC address\n", | |
| 468 | − dev->name); | |
| 469 | − return -EINVAL; | |
| 470 | − } | |
| 471 | − | |
| 472 | 466 | if (request_irq(dev->irq, __ei_interrupt, 0, dev->name, dev)) |
| 473 | 467 | return -EAGAIN; |
| 474 | 468 | |
| @@ -527,7 +521,7 @@ static void __init etherh_banner(void) · 52 unmodified lines | ||
| 527 | 521 | * Read the ethernet address string from the on board rom. |
| 528 | 522 | * This is an ascii string... |
| 529 | 523 | */ |
| 530 | −static int __devinit etherh_addr(char *addr, struct expansion_card *ec) | |
| 524 | +static int etherh_addr(char *addr, struct expansion_card *ec) | |
| 531 | 525 | { |
| 532 | 526 | struct in_chunk_dir cd; |
| 533 | 527 | char *s; |
| @@ -657,7 +651,7 @@ static const struct net_device_ops etherh_netdev_ops = { · 123 unmodified lines | ||
| 657 | 651 | static u32 etherh_regoffsets[16]; |
| 658 | 652 | static u32 etherm_regoffsets[16]; |
| 659 | 653 | |
| 660 | −static int __devinit | |
| 654 | +static int | |
| 661 | 655 | etherh_probe(struct expansion_card *ec, const struct ecard_id *id) |
| 662 | 656 | { |
| 663 | 657 | const struct etherh_data *data = id->data; |
| @@ -775,7 +769,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) · 111 unmodified lines | ||
| 775 | 769 | return ret; |
| 776 | 770 | } |
| 777 | 771 | |
| 778 | −static void __devexit etherh_remove(struct expansion_card *ec) | |
| 772 | +static void etherh_remove(struct expansion_card *ec) | |
| 779 | 773 | { |
| 780 | 774 | struct net_device *dev = ecard_get_drvdata(ec); |
| 781 | 775 | |
| @@ -839,7 +833,7 @@ static const struct ecard_id etherh_ids[] = { · 57 unmodified lines | ||
| 839 | 833 | |
| 840 | 834 | static struct ecard_driver etherh_driver = { |
| 841 | 835 | .probe = etherh_probe, |
| 842 | − .remove = __devexit_p(etherh_remove), | |
| 836 | + .remove = etherh_remove, | |
| 843 | 837 | .id_table = etherh_ids, |
| 844 | 838 | .drv = { |
| 845 | 839 | .name = DRV_NAME, |
| @@ -53,9 +53,9 @@ static const char version[] = · 52 unmodified lines | ||
| 53 | 53 | #define WORDSWAP(a) ((((a)>>8)&0xff) | ((a)<<8)) |
| 54 | 54 | |
| 55 | 55 | |
| 56 | −static int __devinit hydra_init_one(struct zorro_dev *z, | |
| 56 | +static int hydra_init_one(struct zorro_dev *z, | |
| 57 | 57 | const struct zorro_device_id *ent); |
| 58 | −static int __devinit hydra_init(struct zorro_dev *z); | |
| 58 | +static int hydra_init(struct zorro_dev *z); | |
| 59 | 59 | static int hydra_open(struct net_device *dev); |
| 60 | 60 | static int hydra_close(struct net_device *dev); |
| 61 | 61 | static void hydra_reset_8390(struct net_device *dev); |
| @@ -65,9 +65,9 @@ static void hydra_block_input(struct net_device *dev, int count, · 3 unmodified lines | ||
| 65 | 65 | struct sk_buff *skb, int ring_offset); |
| 66 | 66 | static void hydra_block_output(struct net_device *dev, int count, |
| 67 | 67 | const unsigned char *buf, int start_page); |
| 68 | −static void __devexit hydra_remove_one(struct zorro_dev *z); | |
| 68 | +static void hydra_remove_one(struct zorro_dev *z); | |
| 69 | 69 | |
| 70 | −static struct zorro_device_id hydra_zorro_tbl[] __devinitdata = { | |
| 70 | +static struct zorro_device_id hydra_zorro_tbl[] = { | |
| 71 | 71 | { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET }, |
| 72 | 72 | { 0 } |
| 73 | 73 | }; |
| @@ -77,11 +77,11 @@ static struct zorro_driver hydra_driver = { · 3 unmodified lines | ||
| 77 | 77 | .name = "hydra", |
| 78 | 78 | .id_table = hydra_zorro_tbl, |
| 79 | 79 | .probe = hydra_init_one, |
| 80 | − .remove = __devexit_p(hydra_remove_one), | |
| 80 | + .remove = hydra_remove_one, | |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | −static int __devinit hydra_init_one(struct zorro_dev *z, | |
| 84 | − const struct zorro_device_id *ent) | |
| 83 | +static int hydra_init_one(struct zorro_dev *z, | |
| 84 | + const struct zorro_device_id *ent) | |
| 85 | 85 | { |
| 86 | 86 | int err; |
| 87 | 87 | |
| @@ -110,7 +110,7 @@ static const struct net_device_ops hydra_netdev_ops = { · 22 unmodified lines | ||
| 110 | 110 | #endif |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | −static int __devinit hydra_init(struct zorro_dev *z) | |
| 113 | +static int hydra_init(struct zorro_dev *z) | |
| 114 | 114 | { |
| 115 | 115 | struct net_device *dev; |
| 116 | 116 | unsigned long board = ZTWO_VADDR(z->resource.start); |
| @@ -247,7 +247,7 @@ static void hydra_block_output(struct net_device *dev, int count, · 130 unmodified lines | ||
| 247 | 247 | z_memcpy_toio(mem_base+((start_page - NESM_START_PG)<<8), buf, count); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | −static void __devexit hydra_remove_one(struct zorro_dev *z) | |
| 250 | +static void hydra_remove_one(struct zorro_dev *z) | |
| 251 | 251 | { |
| 252 | 252 | struct net_device *dev = zorro_get_drvdata(z); |
| 253 | 253 | |
| @@ -61,7 +61,7 @@ static int options[MAX_UNITS]; · 60 unmodified lines | ||
| 61 | 61 | #include "8390.h" |
| 62 | 62 | |
| 63 | 63 | /* These identify the driver base version and may not be removed. */ |
| 64 | −static const char version[] __devinitconst = | |
| 64 | +static const char version[] = | |
| 65 | 65 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE |
| 66 | 66 | " D. Becker/P. Gortmaker\n"; |
| 67 | 67 | |
| @@ -119,7 +119,7 @@ enum ne2k_pci_chipsets { · 51 unmodified lines | ||
| 119 | 119 | static struct { |
| 120 | 120 | char *name; |
| 121 | 121 | int flags; |
| 122 | −} pci_clone_list[] __devinitdata = { | |
| 122 | +} pci_clone_list[] = { | |
| 123 | 123 | {"RealTek RTL-8029", REALTEK_FDX}, |
| 124 | 124 | {"Winbond 89C940", 0}, |
| 125 | 125 | {"Compex RL2000", 0}, |
| @@ -215,8 +215,8 @@ static const struct net_device_ops ne2k_netdev_ops = { · 89 unmodified lines | ||
| 215 | 215 | #endif |
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | −static int __devinit ne2k_pci_init_one (struct pci_dev *pdev, | |
| 219 | − const struct pci_device_id *ent) | |
| 218 | +static int ne2k_pci_init_one(struct pci_dev *pdev, | |
| 219 | + const struct pci_device_id *ent) | |
| 220 | 220 | { |
| 221 | 221 | struct net_device *dev; |
| 222 | 222 | int i; |
| @@ -647,7 +647,7 @@ static const struct ethtool_ops ne2k_pci_ethtool_ops = { · 424 unmodified lines | ||
| 647 | 647 | .get_drvinfo = ne2k_pci_get_drvinfo, |
| 648 | 648 | }; |
| 649 | 649 | |
| 650 | −static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) | |
| 650 | +static void ne2k_pci_remove_one(struct pci_dev *pdev) | |
| 651 | 651 | { |
| 652 | 652 | struct net_device *dev = pci_get_drvdata(pdev); |
| 653 | 653 | |
| @@ -696,7 +696,7 @@ static int ne2k_pci_resume (struct pci_dev *pdev) · 42 unmodified lines | ||
| 696 | 696 | static struct pci_driver ne2k_driver = { |
| 697 | 697 | .name = DRV_NAME, |
| 698 | 698 | .probe = ne2k_pci_init_one, |
| 699 | − .remove = __devexit_p(ne2k_pci_remove_one), | |
| 699 | + .remove = ne2k_pci_remove_one, | |
| 700 | 700 | .id_table = ne2k_pci_tbl, |
| 701 | 701 | #ifdef CONFIG_PM |
| 702 | 702 | .suspend = ne2k_pci_suspend, |
| @@ -222,7 +222,7 @@ static int __init ne3210_eisa_probe (struct device *device) · 221 unmodified lines | ||
| 222 | 222 | return retval; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | −static int __devexit ne3210_eisa_remove (struct device *device) | |
| 225 | +static int ne3210_eisa_remove(struct device *device) | |
| 226 | 226 | { |
| 227 | 227 | struct net_device *dev = dev_get_drvdata(device); |
| 228 | 228 | unsigned long ioaddr = to_eisa_device (device)->base_addr; |
| @@ -324,7 +324,7 @@ static struct eisa_driver ne3210_eisa_driver = { · 95 unmodified lines | ||
| 324 | 324 | .driver = { |
| 325 | 325 | .name = "ne3210", |
| 326 | 326 | .probe = ne3210_eisa_probe, |
| 327 | − .remove = __devexit_p (ne3210_eisa_remove), | |
| 327 | + .remove = ne3210_eisa_remove, | |
| 328 | 328 | }, |
| 329 | 329 | }; |
| 330 | 330 | |
| @@ -75,7 +75,7 @@ static struct card_info { · 74 unmodified lines | ||
| 75 | 75 | zorro_id id; |
| 76 | 76 | const char *name; |
| 77 | 77 | unsigned int offset; |
| 78 | −} cards[] __devinitdata = { | |
| 78 | +} cards[] = { | |
| 79 | 79 | { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE2, "Ariadne II", 0x0600 }, |
| 80 | 80 | { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, "X-Surf", 0x8600 }, |
| 81 | 81 | }; |
| @@ -254,7 +254,7 @@ static int zorro8390_close(struct net_device *dev) · 172 unmodified lines | ||
| 254 | 254 | return 0; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | −static void __devexit zorro8390_remove_one(struct zorro_dev *z) | |
| 257 | +static void zorro8390_remove_one(struct zorro_dev *z) | |
| 258 | 258 | { |
| 259 | 259 | struct net_device *dev = zorro_get_drvdata(z); |
| 260 | 260 | |
| @@ -264,7 +264,7 @@ static void __devexit zorro8390_remove_one(struct zorro_dev *z) · 3 unmodified lines | ||
| 264 | 264 | free_netdev(dev); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | −static struct zorro_device_id zorro8390_zorro_tbl[] __devinitdata = { | |
| 267 | +static struct zorro_device_id zorro8390_zorro_tbl[] = { | |
| 268 | 268 | { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE2, }, |
| 269 | 269 | { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, }, |
| 270 | 270 | { 0 } |
| @@ -286,9 +286,8 @@ static const struct net_device_ops zorro8390_netdev_ops = { · 15 unmodified lines | ||
| 286 | 286 | #endif |
| 287 | 287 | }; |
| 288 | 288 | |
| 289 | −static int __devinit zorro8390_init(struct net_device *dev, | |
| 290 | − unsigned long board, const char *name, | |
| 291 | − unsigned long ioaddr) | |
| 289 | +static int zorro8390_init(struct net_device *dev, unsigned long board, | |
| 290 | + const char *name, unsigned long ioaddr) | |
| 292 | 291 | { |
| 293 | 292 | int i; |
| 294 | 293 | int err; |
| @@ -396,8 +395,8 @@ static int __devinit zorro8390_init(struct net_device *dev, · 101 unmodified lines | ||
| 396 | 395 | return 0; |
| 397 | 396 | } |
| 398 | 397 | |
| 399 | −static int __devinit zorro8390_init_one(struct zorro_dev *z, | |
| 400 | − const struct zorro_device_id *ent) | |
| 398 | +static int zorro8390_init_one(struct zorro_dev *z, | |
| 399 | + const struct zorro_device_id *ent) | |
| 401 | 400 | { |
| 402 | 401 | struct net_device *dev; |
| 403 | 402 | unsigned long board, ioaddr; |
| @@ -432,7 +431,7 @@ static struct zorro_driver zorro8390_driver = { · 28 unmodified lines | ||
| 432 | 431 | .name = "zorro8390", |
| 433 | 432 | .id_table = zorro8390_zorro_tbl, |
| 434 | 433 | .probe = zorro8390_init_one, |
| 435 | − .remove = __devexit_p(zorro8390_remove_one), | |
| 434 | + .remove = zorro8390_remove_one, | |
| 436 | 435 | }; |
| 437 | 436 | |
| 438 | 437 | static int __init zorro8390_init_module(void) |
| @@ -166,7 +166,7 @@ static int rx_copybreak /* = 0 */; · 165 unmodified lines | ||
| 166 | 166 | #define FIRMWARE_TX "adaptec/starfire_tx.bin" |
| 167 | 167 | |
| 168 | 168 | /* These identify the driver base version and may not be removed. */ |
| 169 | −static const char version[] __devinitconst = | |
| 169 | +static const char version[] = | |
| 170 | 170 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" |
| 171 | 171 | " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; |
| 172 | 172 | |
| @@ -295,7 +295,7 @@ MODULE_DEVICE_TABLE(pci, starfire_pci_tbl); · 122 unmodified lines | ||
| 295 | 295 | static const struct chip_info { |
| 296 | 296 | const char *name; |
| 297 | 297 | int drv_flags; |
| 298 | −} netdrv_tbl[] __devinitconst = { | |
| 298 | +} netdrv_tbl[] = { | |
| 299 | 299 | { "Adaptec Starfire 6915", CanHaveMII }, |
| 300 | 300 | }; |
| 301 | 301 | |
| @@ -641,8 +641,8 @@ static const struct net_device_ops netdev_ops = { · 339 unmodified lines | ||
| 641 | 641 | #endif |
| 642 | 642 | }; |
| 643 | 643 | |
| 644 | −static int __devinit starfire_init_one(struct pci_dev *pdev, | |
| 645 | − const struct pci_device_id *ent) | |
| 644 | +static int starfire_init_one(struct pci_dev *pdev, | |
| 645 | + const struct pci_device_id *ent) | |
| 646 | 646 | { |
| 647 | 647 | struct device *d = &pdev->dev; |
| 648 | 648 | struct netdev_private *np; |
| @@ -1990,7 +1990,7 @@ static int starfire_resume(struct pci_dev *pdev) · 1341 unmodified lines | ||
| 1990 | 1990 | #endif /* CONFIG_PM */ |
| 1991 | 1991 | |
| 1992 | 1992 | |
| 1993 | −static void __devexit starfire_remove_one (struct pci_dev *pdev) | |
| 1993 | +static void starfire_remove_one(struct pci_dev *pdev) | |
| 1994 | 1994 | { |
| 1995 | 1995 | struct net_device *dev = pci_get_drvdata(pdev); |
| 1996 | 1996 | struct netdev_private *np = netdev_priv(dev); |
| @@ -2018,7 +2018,7 @@ static void __devexit starfire_remove_one (struct pci_dev *pdev) · 21 unmodified lines | ||
| 2018 | 2018 | static struct pci_driver starfire_driver = { |
| 2019 | 2019 | .name = DRV_NAME, |
| 2020 | 2020 | .probe = starfire_init_one, |
| 2021 | − .remove = __devexit_p(starfire_remove_one), | |
| 2021 | + .remove = starfire_remove_one, | |
| 2022 | 2022 | #ifdef CONFIG_PM |
| 2023 | 2023 | .suspend = starfire_suspend, |
| 2024 | 2024 | .resume = starfire_resume, |
| @@ -61,7 +61,7 @@ config BFIN_RX_DESC_NUM · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | config BFIN_MAC_USE_HWSTAMP |
| 63 | 63 | bool "Use IEEE 1588 hwstamp" |
| 64 | − depends on BFIN_MAC && BF518 | |
| 64 | + select PTP_1588_CLOCK | |
| 65 | 65 | default y |
| 66 | 66 | ---help--- |
| 67 | 67 | To support the IEEE 1588 Precision Time Protocol (PTP), select y here |
| @@ -548,14 +548,17 @@ static int bfin_mac_ethtool_setwol(struct net_device *dev, · 547 unmodified lines | ||
| 548 | 548 | return 0; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | +#ifdef CONFIG_BFIN_MAC_USE_HWSTAMP | |
| 551 | 552 | static int bfin_mac_ethtool_get_ts_info(struct net_device *dev, |
| 552 | 553 | struct ethtool_ts_info *info) |
| 553 | 554 | { |
| 555 | + struct bfin_mac_local *lp = netdev_priv(dev); | |
| 556 | + | |
| 554 | 557 | info->so_timestamping = |
| 555 | 558 | SOF_TIMESTAMPING_TX_HARDWARE | |
| 556 | 559 | SOF_TIMESTAMPING_RX_HARDWARE | |
| 557 | − SOF_TIMESTAMPING_SYS_HARDWARE; | |
| 558 | − info->phc_index = -1; | |
| 560 | + SOF_TIMESTAMPING_RAW_HARDWARE; | |
| 561 | + info->phc_index = lp->phc_index; | |
| 559 | 562 | info->tx_types = |
| 560 | 563 | (1 << HWTSTAMP_TX_OFF) | |
| 561 | 564 | (1 << HWTSTAMP_TX_ON); |
| @@ -566,6 +569,7 @@ static int bfin_mac_ethtool_get_ts_info(struct net_device *dev, · 4 unmodified lines | ||
| 566 | 569 | (1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT); |
| 567 | 570 | return 0; |
| 568 | 571 | } |
| 572 | +#endif | |
| 569 | 573 | |
| 570 | 574 | static const struct ethtool_ops bfin_mac_ethtool_ops = { |
| 571 | 575 | .get_settings = bfin_mac_ethtool_getsettings, |
| @@ -574,7 +578,9 @@ static const struct ethtool_ops bfin_mac_ethtool_ops = { · 2 unmodified lines | ||
| 574 | 578 | .get_drvinfo = bfin_mac_ethtool_getdrvinfo, |
| 575 | 579 | .get_wol = bfin_mac_ethtool_getwol, |
| 576 | 580 | .set_wol = bfin_mac_ethtool_setwol, |
| 581 | +#ifdef CONFIG_BFIN_MAC_USE_HWSTAMP | |
| 577 | 582 | .get_ts_info = bfin_mac_ethtool_get_ts_info, |
| 583 | +#endif | |
| 578 | 584 | }; |
| 579 | 585 | |
| 580 | 586 | /**************************************************************************/ |
| @@ -649,6 +655,20 @@ static int bfin_mac_set_mac_address(struct net_device *dev, void *p) · 68 unmodified lines | ||
| 649 | 655 | #ifdef CONFIG_BFIN_MAC_USE_HWSTAMP |
| 650 | 656 | #define bfin_mac_hwtstamp_is_none(cfg) ((cfg) == HWTSTAMP_FILTER_NONE) |
| 651 | 657 | |
| 658 | +static u32 bfin_select_phc_clock(u32 input_clk, unsigned int *shift_result) | |
| 659 | +{ | |
| 660 | + u32 ipn = 1000000000UL / input_clk; | |
| 661 | + u32 ppn = 1; | |
| 662 | + unsigned int shift = 0; | |
| 663 | + | |
| 664 | + while (ppn <= ipn) { | |
| 665 | + ppn <<= 1; | |
| 666 | + shift++; | |
| 667 | + } | |
| 668 | + *shift_result = shift; | |
| 669 | + return 1000000000UL / ppn; | |
| 670 | +} | |
| 671 | + | |
| 652 | 672 | static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, |
| 653 | 673 | struct ifreq *ifr, int cmd) |
| 654 | 674 | { |
| @@ -798,19 +818,7 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, · 143 unmodified lines | ||
| 798 | 818 | bfin_read_EMAC_PTP_TXSNAPLO(); |
| 799 | 819 | bfin_read_EMAC_PTP_TXSNAPHI(); |
| 800 | 820 | |
| 801 | − /* | |
| 802 | − * Set registers so that rollover occurs soon to test this. | |
| 803 | − */ | |
| 804 | − bfin_write_EMAC_PTP_TIMELO(0x00000000); | |
| 805 | − bfin_write_EMAC_PTP_TIMEHI(0xFF800000); | |
| 806 | − | |
| 807 | 821 | SSYNC(); |
| 808 | − | |
| 809 | − lp->compare.last_update = 0; | |
| 810 | − timecounter_init(&lp->clock, | |
| 811 | − &lp->cycles, | |
| 812 | − ktime_to_ns(ktime_get_real())); | |
| 813 | − timecompare_update(&lp->compare, 0); | |
| 814 | 822 | } |
| 815 | 823 | |
| 816 | 824 | lp->stamp_cfg = config; |
| @@ -818,15 +826,6 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev, · 1 unmodified line | ||
| 818 | 826 | -EFAULT : 0; |
| 819 | 827 | } |
| 820 | 828 | |
| 821 | −static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts, struct timecompare *cmp) | |
| 822 | −{ | |
| 823 | − ktime_t sys = ktime_get_real(); | |
| 824 | − | |
| 825 | − pr_debug("%s %s hardware:%d,%d transform system:%d,%d system:%d,%d, cmp:%lld, %lld\n", | |
| 826 | − __func__, s, hw->tv.sec, hw->tv.nsec, ts->tv.sec, ts->tv.nsec, sys.tv.sec, | |
| 827 | − sys.tv.nsec, cmp->offset, cmp->skew); | |
| 828 | −} | |
| 829 | − | |
| 830 | 829 | static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) |
| 831 | 830 | { |
| 832 | 831 | struct bfin_mac_local *lp = netdev_priv(netdev); |
| @@ -857,15 +856,9 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) · 24 unmodified lines | ||
| 857 | 856 | regval = bfin_read_EMAC_PTP_TXSNAPLO(); |
| 858 | 857 | regval |= (u64)bfin_read_EMAC_PTP_TXSNAPHI() << 32; |
| 859 | 858 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
| 860 | − ns = timecounter_cyc2time(&lp->clock, | |
| 861 | − regval); | |
| 862 | − timecompare_update(&lp->compare, ns); | |
| 859 | + ns = regval << lp->shift; | |
| 863 | 860 | shhwtstamps.hwtstamp = ns_to_ktime(ns); |
| 864 | − shhwtstamps.syststamp = | |
| 865 | − timecompare_transform(&lp->compare, ns); | |
| 866 | 861 | skb_tstamp_tx(skb, &shhwtstamps); |
| 867 | − | |
| 868 | − bfin_dump_hwtamp("TX", &shhwtstamps.hwtstamp, &shhwtstamps.syststamp, &lp->compare); | |
| 869 | 862 | } |
| 870 | 863 | } |
| 871 | 864 | } |
| @@ -888,55 +881,184 @@ static void bfin_rx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) · 16 unmodified lines | ||
| 888 | 881 | |
| 889 | 882 | regval = bfin_read_EMAC_PTP_RXSNAPLO(); |
| 890 | 883 | regval |= (u64)bfin_read_EMAC_PTP_RXSNAPHI() << 32; |
| 891 | − ns = timecounter_cyc2time(&lp->clock, regval); | |
| 892 | − timecompare_update(&lp->compare, ns); | |
| 884 | + ns = regval << lp->shift; | |
| 893 | 885 | memset(shhwtstamps, 0, sizeof(*shhwtstamps)); |
| 894 | 886 | shhwtstamps->hwtstamp = ns_to_ktime(ns); |
| 895 | − shhwtstamps->syststamp = timecompare_transform(&lp->compare, ns); | |
| 887 | +} | |
| 888 | + | |
| 889 | +static void bfin_mac_hwtstamp_init(struct net_device *netdev) | |
| 890 | +{ | |
| 891 | + struct bfin_mac_local *lp = netdev_priv(netdev); | |
| 892 | + u64 addend, ppb; | |
| 893 | + u32 input_clk, phc_clk; | |
| 894 | + | |
| 895 | + /* Initialize hardware timer */ | |
| 896 | + input_clk = get_sclk(); | |
| 897 | + phc_clk = bfin_select_phc_clock(input_clk, &lp->shift); | |
| 898 | + addend = phc_clk * (1ULL << 32); | |
| 899 | + do_div(addend, input_clk); | |
| 900 | + bfin_write_EMAC_PTP_ADDEND((u32)addend); | |
| 901 | + | |
| 902 | + lp->addend = addend; | |
| 903 | + ppb = 1000000000ULL * input_clk; | |
| 904 | + do_div(ppb, phc_clk); | |
| 905 | + lp->max_ppb = ppb - 1000000000ULL - 1ULL; | |
| 896 | 906 | |
| 897 | − bfin_dump_hwtamp("RX", &shhwtstamps->hwtstamp, &shhwtstamps->syststamp, &lp->compare); | |
| 907 | + /* Initialize hwstamp config */ | |
| 908 | + lp->stamp_cfg.rx_filter = HWTSTAMP_FILTER_NONE; | |
| 909 | + lp->stamp_cfg.tx_type = HWTSTAMP_TX_OFF; | |
| 898 | 910 | } |
| 899 | 911 | |
| 900 | −/* | |
| 901 | − * bfin_read_clock - read raw cycle counter (to be used by time counter) | |
| 902 | − */ | |
| 903 | −static cycle_t bfin_read_clock(const struct cyclecounter *tc) | |
| 912 | +static u64 bfin_ptp_time_read(struct bfin_mac_local *lp) | |
| 904 | 913 | { |
| 905 | − u64 stamp; | |
| 914 | + u64 ns; | |
| 915 | + u32 lo, hi; | |
| 916 | + | |
| 917 | + lo = bfin_read_EMAC_PTP_TIMELO(); | |
| 918 | + hi = bfin_read_EMAC_PTP_TIMEHI(); | |
| 906 | 919 | |
| 907 | − stamp = bfin_read_EMAC_PTP_TIMELO(); | |
| 908 | − stamp |= (u64)bfin_read_EMAC_PTP_TIMEHI() << 32ULL; | |
| 920 | + ns = ((u64) hi) << 32; | |
| 921 | + ns |= lo; | |
| 922 | + ns <<= lp->shift; | |
| 909 | 923 | |
| 910 | − return stamp; | |
| 924 | + return ns; | |
| 911 | 925 | } |
| 912 | 926 | |
| 913 | −#define PTP_CLK 25000000 | |
| 927 | +static void bfin_ptp_time_write(struct bfin_mac_local *lp, u64 ns) | |
| 928 | +{ | |
| 929 | + u32 hi, lo; | |
| 914 | 930 | |
| 915 | −static void bfin_mac_hwtstamp_init(struct net_device *netdev) | |
| 931 | + ns >>= lp->shift; | |
| 932 | + hi = ns >> 32; | |
| 933 | + lo = ns & 0xffffffff; | |
| 934 | + | |
| 935 | + bfin_write_EMAC_PTP_TIMELO(lo); | |
| 936 | + bfin_write_EMAC_PTP_TIMEHI(hi); | |
| 937 | +} | |
| 938 | + | |
| 939 | +/* PTP Hardware Clock operations */ | |
| 940 | + | |
| 941 | +static int bfin_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) | |
| 942 | +{ | |
| 943 | + u64 adj; | |
| 944 | + u32 diff, addend; | |
| 945 | + int neg_adj = 0; | |
| 946 | + struct bfin_mac_local *lp = | |
| 947 | + container_of(ptp, struct bfin_mac_local, caps); | |
| 948 | + | |
| 949 | + if (ppb < 0) { | |
| 950 | + neg_adj = 1; | |
| 951 | + ppb = -ppb; | |
| 952 | + } | |
| 953 | + addend = lp->addend; | |
| 954 | + adj = addend; | |
| 955 | + adj *= ppb; | |
| 956 | + diff = div_u64(adj, 1000000000ULL); | |
| 957 | + | |
| 958 | + addend = neg_adj ? addend - diff : addend + diff; | |
| 959 | + | |
| 960 | + bfin_write_EMAC_PTP_ADDEND(addend); | |
| 961 | + | |
| 962 | + return 0; | |
| 963 | +} | |
| 964 | + | |
| 965 | +static int bfin_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) | |
| 966 | +{ | |
| 967 | + s64 now; | |
| 968 | + unsigned long flags; | |
| 969 | + struct bfin_mac_local *lp = | |
| 970 | + container_of(ptp, struct bfin_mac_local, caps); | |
| 971 | + | |
| 972 | + spin_lock_irqsave(&lp->phc_lock, flags); | |
| 973 | + | |
| 974 | + now = bfin_ptp_time_read(lp); | |
| 975 | + now += delta; | |
| 976 | + bfin_ptp_time_write(lp, now); | |
| 977 | + | |
| 978 | + spin_unlock_irqrestore(&lp->phc_lock, flags); | |
| 979 | + | |
| 980 | + return 0; | |
| 981 | +} | |
| 982 | + | |
| 983 | +static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts) | |
| 984 | +{ | |
| 985 | + u64 ns; | |
| 986 | + u32 remainder; | |
| 987 | + unsigned long flags; | |
| 988 | + struct bfin_mac_local *lp = | |
| 989 | + container_of(ptp, struct bfin_mac_local, caps); | |
| 990 | + | |
| 991 | + spin_lock_irqsave(&lp->phc_lock, flags); | |
| 992 | + | |
| 993 | + ns = bfin_ptp_time_read(lp); | |
| 994 | + | |
| 995 | + spin_unlock_irqrestore(&lp->phc_lock, flags); | |
| 996 | + | |
| 997 | + ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | |
| 998 | + ts->tv_nsec = remainder; | |
| 999 | + return 0; | |
| 1000 | +} | |
| 1001 | + | |
| 1002 | +static int bfin_ptp_settime(struct ptp_clock_info *ptp, | |
| 1003 | + const struct timespec *ts) | |
| 1004 | +{ | |
| 1005 | + u64 ns; | |
| 1006 | + unsigned long flags; | |
| 1007 | + struct bfin_mac_local *lp = | |
| 1008 | + container_of(ptp, struct bfin_mac_local, caps); | |
| 1009 | + | |
| 1010 | + ns = ts->tv_sec * 1000000000ULL; | |
| 1011 | + ns += ts->tv_nsec; | |
| 1012 | + | |
| 1013 | + spin_lock_irqsave(&lp->phc_lock, flags); | |
| 1014 | + | |
| 1015 | + bfin_ptp_time_write(lp, ns); | |
| 1016 | + | |
| 1017 | + spin_unlock_irqrestore(&lp->phc_lock, flags); | |
| 1018 | + | |
| 1019 | + return 0; | |
| 1020 | +} | |
| 1021 | + | |
| 1022 | +static int bfin_ptp_enable(struct ptp_clock_info *ptp, | |
| 1023 | + struct ptp_clock_request *rq, int on) | |
| 1024 | +{ | |
| 1025 | + return -EOPNOTSUPP; | |
| 1026 | +} | |
| 1027 | + | |
| 1028 | +static struct ptp_clock_info bfin_ptp_caps = { | |
| 1029 | + .owner = THIS_MODULE, | |
| 1030 | + .name = "BF518 clock", | |
| 1031 | + .max_adj = 0, | |
| 1032 | + .n_alarm = 0, | |
| 1033 | + .n_ext_ts = 0, | |
| 1034 | + .n_per_out = 0, | |
| 1035 | + .pps = 0, | |
| 1036 | + .adjfreq = bfin_ptp_adjfreq, | |
| 1037 | + .adjtime = bfin_ptp_adjtime, | |
| 1038 | + .gettime = bfin_ptp_gettime, | |
| 1039 | + .settime = bfin_ptp_settime, | |
| 1040 | + .enable = bfin_ptp_enable, | |
| 1041 | +}; | |
| 1042 | + | |
| 1043 | +static int bfin_phc_init(struct net_device *netdev, struct device *dev) | |
| 916 | 1044 | { |
| 917 | 1045 | struct bfin_mac_local *lp = netdev_priv(netdev); |
| 918 | − u64 append; | |
| 919 | 1046 | |
| 920 | − /* Initialize hardware timer */ | |
| 921 | − append = PTP_CLK * (1ULL << 32); | |
| 922 | − do_div(append, get_sclk()); | |
| 923 | − bfin_write_EMAC_PTP_ADDEND((u32)append); | |
| 924 | − | |
| 925 | − memset(&lp->cycles, 0, sizeof(lp->cycles)); | |
| 926 | − lp->cycles.read = bfin_read_clock; | |
| 927 | − lp->cycles.mask = CLOCKSOURCE_MASK(64); | |
| 928 | − lp->cycles.mult = 1000000000 / PTP_CLK; | |
| 929 | − lp->cycles.shift = 0; | |
| 930 | − | |
| 931 | − /* Synchronize our NIC clock against system wall clock */ | |
| 932 | − memset(&lp->compare, 0, sizeof(lp->compare)); | |
| 933 | − lp->compare.source = &lp->clock; | |
| 934 | − lp->compare.target = ktime_get_real; | |
| 935 | − lp->compare.num_samples = 10; | |
| 1047 | + lp->caps = bfin_ptp_caps; | |
| 1048 | + lp->caps.max_adj = lp->max_ppb; | |
| 1049 | + lp->clock = ptp_clock_register(&lp->caps, dev); | |
| 1050 | + if (IS_ERR(lp->clock)) | |
| 1051 | + return PTR_ERR(lp->clock); | |
| 936 | 1052 | |
| 937 | − /* Initialize hwstamp config */ | |
| 938 | − lp->stamp_cfg.rx_filter = HWTSTAMP_FILTER_NONE; | |
| 939 | − lp->stamp_cfg.tx_type = HWTSTAMP_TX_OFF; | |
| 1053 | + lp->phc_index = ptp_clock_index(lp->clock); | |
| 1054 | + spin_lock_init(&lp->phc_lock); | |
| 1055 | + | |
| 1056 | + return 0; | |
| 1057 | +} | |
| 1058 | + | |
| 1059 | +static void bfin_phc_release(struct bfin_mac_local *lp) | |
| 1060 | +{ | |
| 1061 | + ptp_clock_unregister(lp->clock); | |
| 940 | 1062 | } |
| 941 | 1063 | |
| 942 | 1064 | #else |
| @@ -945,6 +1067,8 @@ static void bfin_mac_hwtstamp_init(struct net_device *netdev) · 2 unmodified lines | ||
| 945 | 1067 | # define bfin_mac_hwtstamp_ioctl(dev, ifr, cmd) (-EOPNOTSUPP) |
| 946 | 1068 | # define bfin_rx_hwtstamp(dev, skb) |
| 947 | 1069 | # define bfin_tx_hwtstamp(dev, skb) |
| 1070 | +# define bfin_phc_init(netdev, dev) 0 | |
| 1071 | +# define bfin_phc_release(lp) | |
| 948 | 1072 | #endif |
| 949 | 1073 | |
| 950 | 1074 | static inline void _tx_reclaim_skb(void) |
| @@ -1479,7 +1603,7 @@ static const struct net_device_ops bfin_mac_netdev_ops = { · 528 unmodified lines | ||
| 1479 | 1603 | #endif |
| 1480 | 1604 | }; |
| 1481 | 1605 | |
| 1482 | −static int __devinit bfin_mac_probe(struct platform_device *pdev) | |
| 1606 | +static int bfin_mac_probe(struct platform_device *pdev) | |
| 1483 | 1607 | { |
| 1484 | 1608 | struct net_device *ndev; |
| 1485 | 1609 | struct bfin_mac_local *lp; |
| @@ -1579,12 +1703,17 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev) · 93 unmodified lines | ||
| 1579 | 1703 | } |
| 1580 | 1704 | |
| 1581 | 1705 | bfin_mac_hwtstamp_init(ndev); |
| 1706 | + if (bfin_phc_init(ndev, &pdev->dev)) { | |
| 1707 | + dev_err(&pdev->dev, "Cannot register PHC device!\n"); | |
| 1708 | + goto out_err_phc; | |
| 1709 | + } | |
| 1582 | 1710 | |
| 1583 | 1711 | /* now, print out the card info, in a short format.. */ |
| 1584 | 1712 | netdev_info(ndev, "%s, Version %s\n", DRV_DESC, DRV_VERSION); |
| 1585 | 1713 | |
| 1586 | 1714 | return 0; |
| 1587 | 1715 | |
| 1716 | +out_err_phc: | |
| 1588 | 1717 | out_err_reg_ndev: |
| 1589 | 1718 | free_irq(IRQ_MAC_RX, ndev); |
| 1590 | 1719 | out_err_request_irq: |
| @@ -1598,11 +1727,13 @@ out_err_probe_mac: · 7 unmodified lines | ||
| 1598 | 1727 | return rc; |
| 1599 | 1728 | } |
| 1600 | 1729 | |
| 1601 | −static int __devexit bfin_mac_remove(struct platform_device *pdev) | |
| 1730 | +static int bfin_mac_remove(struct platform_device *pdev) | |
| 1602 | 1731 | { |
| 1603 | 1732 | struct net_device *ndev = platform_get_drvdata(pdev); |
| 1604 | 1733 | struct bfin_mac_local *lp = netdev_priv(ndev); |
| 1605 | 1734 | |
| 1735 | + bfin_phc_release(lp); | |
| 1736 | + | |
| 1606 | 1737 | platform_set_drvdata(pdev, NULL); |
| 1607 | 1738 | |
| 1608 | 1739 | lp->mii_bus->priv = NULL; |
| @@ -1655,7 +1786,7 @@ static int bfin_mac_resume(struct platform_device *pdev) · 46 unmodified lines | ||
| 1655 | 1786 | #define bfin_mac_resume NULL |
| 1656 | 1787 | #endif /* CONFIG_PM */ |
| 1657 | 1788 | |
| 1658 | −static int __devinit bfin_mii_bus_probe(struct platform_device *pdev) | |
| 1789 | +static int bfin_mii_bus_probe(struct platform_device *pdev) | |
| 1659 | 1790 | { |
| 1660 | 1791 | struct mii_bus *miibus; |
| 1661 | 1792 | struct bfin_mii_bus_platform_data *mii_bus_pd; |
| @@ -1733,7 +1864,7 @@ out_err_alloc: · 71 unmodified lines | ||
| 1733 | 1864 | return rc; |
| 1734 | 1865 | } |
| 1735 | 1866 | |
| 1736 | −static int __devexit bfin_mii_bus_remove(struct platform_device *pdev) | |
| 1867 | +static int bfin_mii_bus_remove(struct platform_device *pdev) | |
| 1737 | 1868 | { |
| 1738 | 1869 | struct mii_bus *miibus = platform_get_drvdata(pdev); |
| 1739 | 1870 | struct bfin_mii_bus_platform_data *mii_bus_pd = |
| @@ -1750,7 +1881,7 @@ static int __devexit bfin_mii_bus_remove(struct platform_device *pdev) · 10 unmodified lines | ||
| 1750 | 1881 | |
| 1751 | 1882 | static struct platform_driver bfin_mii_bus_driver = { |
| 1752 | 1883 | .probe = bfin_mii_bus_probe, |
| 1753 | − .remove = __devexit_p(bfin_mii_bus_remove), | |
| 1884 | + .remove = bfin_mii_bus_remove, | |
| 1754 | 1885 | .driver = { |
| 1755 | 1886 | .name = "bfin_mii_bus", |
| 1756 | 1887 | .owner = THIS_MODULE, |
| @@ -1759,7 +1890,7 @@ static struct platform_driver bfin_mii_bus_driver = { · 2 unmodified lines | ||
| 1759 | 1890 | |
| 1760 | 1891 | static struct platform_driver bfin_mac_driver = { |
| 1761 | 1892 | .probe = bfin_mac_probe, |
| 1762 | − .remove = __devexit_p(bfin_mac_remove), | |
| 1893 | + .remove = bfin_mac_remove, | |
| 1763 | 1894 | .resume = bfin_mac_resume, |
| 1764 | 1895 | .suspend = bfin_mac_suspend, |
| 1765 | 1896 | .driver = { |
| @@ -11,8 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #define _BFIN_MAC_H_ |
| 12 | 12 | |
| 13 | 13 | #include <linux/net_tstamp.h> |
| 14 | −#include <linux/clocksource.h> | |
| 15 | −#include <linux/timecompare.h> | |
| 14 | +#include <linux/ptp_clock_kernel.h> | |
| 16 | 15 | #include <linux/timer.h> |
| 17 | 16 | #include <linux/etherdevice.h> |
| 18 | 17 | #include <linux/bfin_mac.h> |
| @@ -94,10 +93,14 @@ struct bfin_mac_local { · 75 unmodified lines | ||
| 94 | 93 | struct mii_bus *mii_bus; |
| 95 | 94 | |
| 96 | 95 | #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP) |
| 97 | − struct cyclecounter cycles; | |
| 98 | − struct timecounter clock; | |
| 99 | − struct timecompare compare; | |
| 96 | + u32 addend; | |
| 97 | + unsigned int shift; | |
| 98 | + s32 max_ppb; | |
| 100 | 99 | struct hwtstamp_config stamp_cfg; |
| 100 | + struct ptp_clock_info caps; | |
| 101 | + struct ptp_clock *clock; | |
| 102 | + int phc_index; | |
| 103 | + spinlock_t phc_lock; /* protects time lo/hi registers */ | |
| 101 | 104 | #endif |
| 102 | 105 | }; |
| 103 | 106 | |
| @@ -1376,7 +1376,7 @@ error: · 1375 unmodified lines | ||
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | 1378 | /* Initialize the GRETH MAC */ |
| 1379 | −static int __devinit greth_of_probe(struct platform_device *ofdev) | |
| 1379 | +static int greth_of_probe(struct platform_device *ofdev) | |
| 1380 | 1380 | { |
| 1381 | 1381 | struct net_device *dev; |
| 1382 | 1382 | struct greth_private *greth; |
| @@ -1576,7 +1576,7 @@ error1: · 193 unmodified lines | ||
| 1576 | 1576 | return err; |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | −static int __devexit greth_of_remove(struct platform_device *of_dev) | |
| 1579 | +static int greth_of_remove(struct platform_device *of_dev) | |
| 1580 | 1580 | { |
| 1581 | 1581 | struct net_device *ndev = dev_get_drvdata(&of_dev->dev); |
| 1582 | 1582 | struct greth_private *greth = netdev_priv(ndev); |
| @@ -1619,7 +1619,7 @@ static struct platform_driver greth_of_driver = { · 36 unmodified lines | ||
| 1619 | 1619 | .of_match_table = greth_of_match, |
| 1620 | 1620 | }, |
| 1621 | 1621 | .probe = greth_of_probe, |
| 1622 | − .remove = __devexit_p(greth_of_remove), | |
| 1622 | + .remove = greth_of_remove, | |
| 1623 | 1623 | }; |
| 1624 | 1624 | |
| 1625 | 1625 | module_platform_driver(greth_of_driver); |
| @@ -426,7 +426,7 @@ MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descript · 425 unmodified lines | ||
| 426 | 426 | MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)"); |
| 427 | 427 | |
| 428 | 428 | |
| 429 | −static const char version[] __devinitconst = | |
| 429 | +static const char version[] = | |
| 430 | 430 | "acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" |
| 431 | 431 | " http://home.cern.ch/~jes/gige/acenic.html\n"; |
| 432 | 432 | |
| @@ -454,8 +454,8 @@ static const struct net_device_ops ace_netdev_ops = { · 21 unmodified lines | ||
| 454 | 454 | .ndo_change_mtu = ace_change_mtu, |
| 455 | 455 | }; |
| 456 | 456 | |
| 457 | −static int __devinit acenic_probe_one(struct pci_dev *pdev, | |
| 458 | − const struct pci_device_id *id) | |
| 457 | +static int acenic_probe_one(struct pci_dev *pdev, | |
| 458 | + const struct pci_device_id *id) | |
| 459 | 459 | { |
| 460 | 460 | struct net_device *dev; |
| 461 | 461 | struct ace_private *ap; |
| @@ -603,7 +603,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev, · 141 unmodified lines | ||
| 603 | 603 | return -ENODEV; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | −static void __devexit acenic_remove_one(struct pci_dev *pdev) | |
| 606 | +static void acenic_remove_one(struct pci_dev *pdev) | |
| 607 | 607 | { |
| 608 | 608 | struct net_device *dev = pci_get_drvdata(pdev); |
| 609 | 609 | struct ace_private *ap = netdev_priv(dev); |
| @@ -699,7 +699,7 @@ static struct pci_driver acenic_pci_driver = { · 89 unmodified lines | ||
| 699 | 699 | .name = "acenic", |
| 700 | 700 | .id_table = acenic_pci_tbl, |
| 701 | 701 | .probe = acenic_probe_one, |
| 702 | − .remove = __devexit_p(acenic_remove_one), | |
| 702 | + .remove = acenic_remove_one, | |
| 703 | 703 | }; |
| 704 | 704 | |
| 705 | 705 | static int __init acenic_init(void) |
| @@ -871,7 +871,7 @@ static inline void ace_issue_cmd(struct ace_regs __iomem *regs, struct cmd *cmd) · 165 unmodified lines | ||
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | |
| 874 | −static int __devinit ace_init(struct net_device *dev) | |
| 874 | +static int ace_init(struct net_device *dev) | |
| 875 | 875 | { |
| 876 | 876 | struct ace_private *ap; |
| 877 | 877 | struct ace_regs __iomem *regs; |
| @@ -2824,8 +2824,8 @@ static struct net_device_stats *ace_get_stats(struct net_device *dev) · 1946 unmodified lines | ||
| 2824 | 2824 | } |
| 2825 | 2825 | |
| 2826 | 2826 | |
| 2827 | −static void __devinit ace_copy(struct ace_regs __iomem *regs, const __be32 *src, | |
| 2828 | − u32 dest, int size) | |
| 2827 | +static void ace_copy(struct ace_regs __iomem *regs, const __be32 *src, | |
| 2828 | + u32 dest, int size) | |
| 2829 | 2829 | { |
| 2830 | 2830 | void __iomem *tdest; |
| 2831 | 2831 | short tsize, i; |
| @@ -2851,7 +2851,7 @@ static void __devinit ace_copy(struct ace_regs __iomem *regs, const __be32 *src, · 19 unmodified lines | ||
| 2851 | 2851 | } |
| 2852 | 2852 | |
| 2853 | 2853 | |
| 2854 | −static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int size) | |
| 2854 | +static void ace_clear(struct ace_regs __iomem *regs, u32 dest, int size) | |
| 2855 | 2855 | { |
| 2856 | 2856 | void __iomem *tdest; |
| 2857 | 2857 | short tsize = 0, i; |
| @@ -2882,7 +2882,7 @@ static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int siz · 24 unmodified lines | ||
| 2882 | 2882 | * This operation requires the NIC to be halted and is performed with |
| 2883 | 2883 | * interrupts disabled and with the spinlock hold. |
| 2884 | 2884 | */ |
| 2885 | −static int __devinit ace_load_firmware(struct net_device *dev) | |
| 2885 | +static int ace_load_firmware(struct net_device *dev) | |
| 2886 | 2886 | { |
| 2887 | 2887 | const struct firmware *fw; |
| 2888 | 2888 | const char *fw_name = "acenic/tg2.bin"; |
| @@ -2962,7 +2962,7 @@ static int __devinit ace_load_firmware(struct net_device *dev) · 73 unmodified lines | ||
| 2962 | 2962 | * Thanks to Stevarino Webinski for helping tracking down the bugs in the |
| 2963 | 2963 | * code i2c readout code by beta testing all my hacks. |
| 2964 | 2964 | */ |
| 2965 | −static void __devinit eeprom_start(struct ace_regs __iomem *regs) | |
| 2965 | +static void eeprom_start(struct ace_regs __iomem *regs) | |
| 2966 | 2966 | { |
| 2967 | 2967 | u32 local; |
| 2968 | 2968 | |
| @@ -2991,7 +2991,7 @@ static void __devinit eeprom_start(struct ace_regs __iomem *regs) · 22 unmodified lines | ||
| 2991 | 2991 | } |
| 2992 | 2992 | |
| 2993 | 2993 | |
| 2994 | −static void __devinit eeprom_prep(struct ace_regs __iomem *regs, u8 magic) | |
| 2994 | +static void eeprom_prep(struct ace_regs __iomem *regs, u8 magic) | |
| 2995 | 2995 | { |
| 2996 | 2996 | short i; |
| 2997 | 2997 | u32 local; |
| @@ -3028,7 +3028,7 @@ static void __devinit eeprom_prep(struct ace_regs __iomem *regs, u8 magic) · 30 unmodified lines | ||
| 3028 | 3028 | } |
| 3029 | 3029 | |
| 3030 | 3030 | |
| 3031 | −static int __devinit eeprom_check_ack(struct ace_regs __iomem *regs) | |
| 3031 | +static int eeprom_check_ack(struct ace_regs __iomem *regs) | |
| 3032 | 3032 | { |
| 3033 | 3033 | int state; |
| 3034 | 3034 | u32 local; |
| @@ -3056,7 +3056,7 @@ static int __devinit eeprom_check_ack(struct ace_regs __iomem *regs) · 21 unmodified lines | ||
| 3056 | 3056 | } |
| 3057 | 3057 | |
| 3058 | 3058 | |
| 3059 | −static void __devinit eeprom_stop(struct ace_regs __iomem *regs) | |
| 3059 | +static void eeprom_stop(struct ace_regs __iomem *regs) | |
| 3060 | 3060 | { |
| 3061 | 3061 | u32 local; |
| 3062 | 3062 | |
| @@ -3091,8 +3091,7 @@ static void __devinit eeprom_stop(struct ace_regs __iomem *regs) · 28 unmodified lines | ||
| 3091 | 3091 | /* |
| 3092 | 3092 | * Read a whole byte from the EEPROM. |
| 3093 | 3093 | */ |
| 3094 | −static int __devinit read_eeprom_byte(struct net_device *dev, | |
| 3095 | − unsigned long offset) | |
| 3094 | +static int read_eeprom_byte(struct net_device *dev, unsigned long offset) | |
| 3096 | 3095 | { |
| 3097 | 3096 | struct ace_private *ap = netdev_priv(dev); |
| 3098 | 3097 | struct ace_regs __iomem *regs = ap->regs; |
| @@ -639,12 +639,12 @@ static void lance_set_multicast(struct net_device *dev) · 638 unmodified lines | ||
| 639 | 639 | netif_wake_queue(dev); |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | −static int __devinit a2065_init_one(struct zorro_dev *z, | |
| 643 | − const struct zorro_device_id *ent); | |
| 644 | −static void __devexit a2065_remove_one(struct zorro_dev *z); | |
| 642 | +static int a2065_init_one(struct zorro_dev *z, | |
| 643 | + const struct zorro_device_id *ent); | |
| 644 | +static void a2065_remove_one(struct zorro_dev *z); | |
| 645 | 645 | |
| 646 | 646 | |
| 647 | −static struct zorro_device_id a2065_zorro_tbl[] __devinitdata = { | |
| 647 | +static struct zorro_device_id a2065_zorro_tbl[] = { | |
| 648 | 648 | { ZORRO_PROD_CBM_A2065_1 }, |
| 649 | 649 | { ZORRO_PROD_CBM_A2065_2 }, |
| 650 | 650 | { ZORRO_PROD_AMERISTAR_A2065 }, |
| @@ -656,7 +656,7 @@ static struct zorro_driver a2065_driver = { · 5 unmodified lines | ||
| 656 | 656 | .name = "a2065", |
| 657 | 657 | .id_table = a2065_zorro_tbl, |
| 658 | 658 | .probe = a2065_init_one, |
| 659 | − .remove = __devexit_p(a2065_remove_one), | |
| 659 | + .remove = a2065_remove_one, | |
| 660 | 660 | }; |
| 661 | 661 | |
| 662 | 662 | static const struct net_device_ops lance_netdev_ops = { |
| @@ -670,8 +670,8 @@ static const struct net_device_ops lance_netdev_ops = { · 7 unmodified lines | ||
| 670 | 670 | .ndo_set_mac_address = eth_mac_addr, |
| 671 | 671 | }; |
| 672 | 672 | |
| 673 | −static int __devinit a2065_init_one(struct zorro_dev *z, | |
| 674 | − const struct zorro_device_id *ent) | |
| 673 | +static int a2065_init_one(struct zorro_dev *z, | |
| 674 | + const struct zorro_device_id *ent) | |
| 675 | 675 | { |
| 676 | 676 | struct net_device *dev; |
| 677 | 677 | struct lance_private *priv; |
| @@ -754,7 +754,7 @@ static int __devinit a2065_init_one(struct zorro_dev *z, · 76 unmodified lines | ||
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | |
| 757 | −static void __devexit a2065_remove_one(struct zorro_dev *z) | |
| 757 | +static void a2065_remove_one(struct zorro_dev *z) | |
| 758 | 758 | { |
| 759 | 759 | struct net_device *dev = zorro_get_drvdata(z); |
| 760 | 760 | |
| @@ -671,7 +671,7 @@ static const struct net_device_ops am79c961_netdev_ops = { · 670 unmodified lines | ||
| 671 | 671 | #endif |
| 672 | 672 | }; |
| 673 | 673 | |
| 674 | −static int __devinit am79c961_probe(struct platform_device *pdev) | |
| 674 | +static int am79c961_probe(struct platform_device *pdev) | |
| 675 | 675 | { |
| 676 | 676 | struct resource *res; |
| 677 | 677 | struct net_device *dev; |
| @@ -1702,7 +1702,7 @@ static int amd8111e_resume(struct pci_dev *pci_dev) · 1701 unmodified lines | ||
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | 1704 | |
| 1705 | −static void __devexit amd8111e_remove_one(struct pci_dev *pdev) | |
| 1705 | +static void amd8111e_remove_one(struct pci_dev *pdev) | |
| 1706 | 1706 | { |
| 1707 | 1707 | struct net_device *dev = pci_get_drvdata(pdev); |
| 1708 | 1708 | if (dev) { |
| @@ -1774,7 +1774,7 @@ static void amd8111e_config_ipg(struct net_device* dev) · 65 unmodified lines | ||
| 1774 | 1774 | |
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | −static void __devinit amd8111e_probe_ext_phy(struct net_device* dev) | |
| 1777 | +static void amd8111e_probe_ext_phy(struct net_device *dev) | |
| 1778 | 1778 | { |
| 1779 | 1779 | struct amd8111e_priv *lp = netdev_priv(dev); |
| 1780 | 1780 | int i; |
| @@ -1810,7 +1810,7 @@ static const struct net_device_ops amd8111e_netdev_ops = { · 29 unmodified lines | ||
| 1810 | 1810 | #endif |
| 1811 | 1811 | }; |
| 1812 | 1812 | |
| 1813 | −static int __devinit amd8111e_probe_one(struct pci_dev *pdev, | |
| 1813 | +static int amd8111e_probe_one(struct pci_dev *pdev, | |
| 1814 | 1814 | const struct pci_device_id *ent) |
| 1815 | 1815 | { |
| 1816 | 1816 | int err,i,pm_cap; |
| @@ -1976,7 +1976,7 @@ static struct pci_driver amd8111e_driver = { · 159 unmodified lines | ||
| 1976 | 1976 | .name = MODULE_NAME, |
| 1977 | 1977 | .id_table = amd8111e_pci_tbl, |
| 1978 | 1978 | .probe = amd8111e_probe_one, |
| 1979 | − .remove = __devexit_p(amd8111e_remove_one), | |
| 1979 | + .remove = amd8111e_remove_one, | |
| 1980 | 1980 | .suspend = amd8111e_suspend, |
| 1981 | 1981 | .resume = amd8111e_resume |
| 1982 | 1982 | }; |
| @@ -682,7 +682,7 @@ static void set_multicast_list(struct net_device *dev) · 681 unmodified lines | ||
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | |
| 685 | −static void __devexit ariadne_remove_one(struct zorro_dev *z) | |
| 685 | +static void ariadne_remove_one(struct zorro_dev *z) | |
| 686 | 686 | { |
| 687 | 687 | struct net_device *dev = zorro_get_drvdata(z); |
| 688 | 688 | |
| @@ -692,7 +692,7 @@ static void __devexit ariadne_remove_one(struct zorro_dev *z) · 3 unmodified lines | ||
| 692 | 692 | free_netdev(dev); |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | −static struct zorro_device_id ariadne_zorro_tbl[] __devinitdata = { | |
| 695 | +static struct zorro_device_id ariadne_zorro_tbl[] = { | |
| 696 | 696 | { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE }, |
| 697 | 697 | { 0 } |
| 698 | 698 | }; |
| @@ -710,8 +710,8 @@ static const struct net_device_ops ariadne_netdev_ops = { · 11 unmodified lines | ||
| 710 | 710 | .ndo_set_mac_address = eth_mac_addr, |
| 711 | 711 | }; |
| 712 | 712 | |
| 713 | −static int __devinit ariadne_init_one(struct zorro_dev *z, | |
| 714 | − const struct zorro_device_id *ent) | |
| 713 | +static int ariadne_init_one(struct zorro_dev *z, | |
| 714 | + const struct zorro_device_id *ent) | |
| 715 | 715 | { |
| 716 | 716 | unsigned long board = z->resource.start; |
| 717 | 717 | unsigned long base_addr = board + ARIADNE_LANCE; |
| @@ -774,7 +774,7 @@ static struct zorro_driver ariadne_driver = { · 56 unmodified lines | ||
| 774 | 774 | .name = "ariadne", |
| 775 | 775 | .id_table = ariadne_zorro_tbl, |
| 776 | 776 | .probe = ariadne_init_one, |
| 777 | − .remove = __devexit_p(ariadne_remove_one), | |
| 777 | + .remove = ariadne_remove_one, | |
| 778 | 778 | }; |
| 779 | 779 | |
| 780 | 780 | static int __init ariadne_init_module(void) |
| @@ -1016,7 +1016,7 @@ static const struct net_device_ops au1000_netdev_ops = { · 1015 unmodified lines | ||
| 1016 | 1016 | .ndo_change_mtu = eth_change_mtu, |
| 1017 | 1017 | }; |
| 1018 | 1018 | |
| 1019 | −static int __devinit au1000_probe(struct platform_device *pdev) | |
| 1019 | +static int au1000_probe(struct platform_device *pdev) | |
| 1020 | 1020 | { |
| 1021 | 1021 | static unsigned version_printed; |
| 1022 | 1022 | struct au1000_private *aup = NULL; |
| @@ -1295,7 +1295,7 @@ out: · 272 unmodified lines | ||
| 1295 | 1295 | return err; |
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | −static int __devexit au1000_remove(struct platform_device *pdev) | |
| 1298 | +static int au1000_remove(struct platform_device *pdev) | |
| 1299 | 1299 | { |
| 1300 | 1300 | struct net_device *dev = platform_get_drvdata(pdev); |
| 1301 | 1301 | struct au1000_private *aup = netdev_priv(dev); |
| @@ -1340,7 +1340,7 @@ static int __devexit au1000_remove(struct platform_device *pdev) · 38 unmodified lines | ||
| 1340 | 1340 | |
| 1341 | 1341 | static struct platform_driver au1000_eth_driver = { |
| 1342 | 1342 | .probe = au1000_probe, |
| 1343 | − .remove = __devexit_p(au1000_remove), | |
| 1343 | + .remove = au1000_remove, | |
| 1344 | 1344 | .driver = { |
| 1345 | 1345 | .name = "au1000-eth", |
| 1346 | 1346 | .owner = THIS_MODULE, |
| @@ -72,7 +72,7 @@ · 71 unmodified lines | ||
| 72 | 72 | #include <asm/dec/machtype.h> |
| 73 | 73 | #include <asm/dec/system.h> |
| 74 | 74 | |
| 75 | −static char version[] __devinitdata = | |
| 75 | +static char version[] = | |
| 76 | 76 | "declance.c: v0.011 by Linux MIPS DECstation task force\n"; |
| 77 | 77 | |
| 78 | 78 | MODULE_AUTHOR("Linux MIPS DECstation task force"); |
| @@ -1020,7 +1020,7 @@ static const struct net_device_ops lance_netdev_ops = { · 941 unmodified lines | ||
| 1020 | 1020 | .ndo_set_mac_address = eth_mac_addr, |
| 1021 | 1021 | }; |
| 1022 | 1022 | |
| 1023 | −static int __devinit dec_lance_probe(struct device *bdev, const int type) | |
| 1023 | +static int dec_lance_probe(struct device *bdev, const int type) | |
| 1024 | 1024 | { |
| 1025 | 1025 | static unsigned version_printed; |
| 1026 | 1026 | static const char fmt[] = "declance%d"; |
| @@ -1322,7 +1322,7 @@ static void __exit dec_lance_platform_remove(void) · 295 unmodified lines | ||
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | #ifdef CONFIG_TC |
| 1325 | −static int __devinit dec_lance_tc_probe(struct device *dev); | |
| 1325 | +static int dec_lance_tc_probe(struct device *dev); | |
| 1326 | 1326 | static int __exit dec_lance_tc_remove(struct device *dev); |
| 1327 | 1327 | |
| 1328 | 1328 | static const struct tc_device_id dec_lance_tc_table[] = { |
| @@ -1341,7 +1341,7 @@ static struct tc_driver dec_lance_tc_driver = { · 12 unmodified lines | ||
| 1341 | 1341 | }, |
| 1342 | 1342 | }; |
| 1343 | 1343 | |
| 1344 | −static int __devinit dec_lance_tc_probe(struct device *dev) | |
| 1344 | +static int dec_lance_tc_probe(struct device *dev) | |
| 1345 | 1345 | { |
| 1346 | 1346 | int status = dec_lance_probe(dev, PMAD_LANCE); |
| 1347 | 1347 | if (!status) |
| @@ -338,21 +338,21 @@ static struct eisa_driver depca_eisa_driver = { · 337 unmodified lines | ||
| 338 | 338 | .driver = { |
| 339 | 339 | .name = depca_string, |
| 340 | 340 | .probe = depca_eisa_probe, |
| 341 | − .remove = __devexit_p (depca_device_remove) | |
| 341 | + .remove = depca_device_remove | |
| 342 | 342 | } |
| 343 | 343 | }; |
| 344 | 344 | #endif |
| 345 | 345 | |
| 346 | 346 | static int depca_isa_probe (struct platform_device *); |
| 347 | 347 | |
| 348 | −static int __devexit depca_isa_remove(struct platform_device *pdev) | |
| 348 | +static int depca_isa_remove(struct platform_device *pdev) | |
| 349 | 349 | { |
| 350 | 350 | return depca_device_remove(&pdev->dev); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | static struct platform_driver depca_isa_driver = { |
| 354 | 354 | .probe = depca_isa_probe, |
| 355 | − .remove = __devexit_p(depca_isa_remove), | |
| 355 | + .remove = depca_isa_remove, | |
| 356 | 356 | .driver = { |
| 357 | 357 | .name = depca_string, |
| 358 | 358 | }, |
| @@ -1320,7 +1320,7 @@ static enum depca_type __init depca_shmem_probe (ulong *mem_start) · 961 unmodified lines | ||
| 1320 | 1320 | return adapter; |
| 1321 | 1321 | } |
| 1322 | 1322 | |
| 1323 | −static int __devinit depca_isa_probe (struct platform_device *device) | |
| 1323 | +static int depca_isa_probe(struct platform_device *device) | |
| 1324 | 1324 | { |
| 1325 | 1325 | struct net_device *dev; |
| 1326 | 1326 | struct depca_private *lp; |
| @@ -1412,7 +1412,7 @@ static int __init depca_eisa_probe (struct device *device) · 85 unmodified lines | ||
| 1412 | 1412 | } |
| 1413 | 1413 | #endif |
| 1414 | 1414 | |
| 1415 | −static int __devexit depca_device_remove (struct device *device) | |
| 1415 | +static int depca_device_remove(struct device *device) | |
| 1416 | 1416 | { |
| 1417 | 1417 | struct net_device *dev; |
| 1418 | 1418 | struct depca_private *lp; |
| @@ -46,11 +46,9 @@ struct hplance_private { · 45 unmodified lines | ||
| 46 | 46 | * plus board-specific init, open and close actions. |
| 47 | 47 | * Oh, and we need to tell the generic code how to read and write LANCE registers... |
| 48 | 48 | */ |
| 49 | −static int __devinit hplance_init_one(struct dio_dev *d, | |
| 50 | − const struct dio_device_id *ent); | |
| 51 | −static void __devinit hplance_init(struct net_device *dev, | |
| 52 | − struct dio_dev *d); | |
| 53 | −static void __devexit hplance_remove_one(struct dio_dev *d); | |
| 49 | +static int hplance_init_one(struct dio_dev *d, const struct dio_device_id *ent); | |
| 50 | +static void hplance_init(struct net_device *dev, struct dio_dev *d); | |
| 51 | +static void hplance_remove_one(struct dio_dev *d); | |
| 54 | 52 | static void hplance_writerap(void *priv, unsigned short value); |
| 55 | 53 | static void hplance_writerdp(void *priv, unsigned short value); |
| 56 | 54 | static unsigned short hplance_readrdp(void *priv); |
| @@ -66,7 +64,7 @@ static struct dio_driver hplance_driver = { · 9 unmodified lines | ||
| 66 | 64 | .name = "hplance", |
| 67 | 65 | .id_table = hplance_dio_tbl, |
| 68 | 66 | .probe = hplance_init_one, |
| 69 | − .remove = __devexit_p(hplance_remove_one), | |
| 67 | + .remove = hplance_remove_one, | |
| 70 | 68 | }; |
| 71 | 69 | |
| 72 | 70 | static const struct net_device_ops hplance_netdev_ops = { |
| @@ -83,8 +81,7 @@ static const struct net_device_ops hplance_netdev_ops = { · 10 unmodified lines | ||
| 83 | 81 | }; |
| 84 | 82 | |
| 85 | 83 | /* Find all the HP Lance boards and initialise them... */ |
| 86 | −static int __devinit hplance_init_one(struct dio_dev *d, | |
| 87 | − const struct dio_device_id *ent) | |
| 84 | +static int hplance_init_one(struct dio_dev *d, const struct dio_device_id *ent) | |
| 88 | 85 | { |
| 89 | 86 | struct net_device *dev; |
| 90 | 87 | int err = -ENOMEM; |
| @@ -118,7 +115,7 @@ static int __devinit hplance_init_one(struct dio_dev *d, · 27 unmodified lines | ||
| 118 | 115 | return err; |
| 119 | 116 | } |
| 120 | 117 | |
| 121 | −static void __devexit hplance_remove_one(struct dio_dev *d) | |
| 118 | +static void hplance_remove_one(struct dio_dev *d) | |
| 122 | 119 | { |
| 123 | 120 | struct net_device *dev = dio_get_drvdata(d); |
| 124 | 121 | |
| @@ -128,7 +125,7 @@ static void __devexit hplance_remove_one(struct dio_dev *d) · 3 unmodified lines | ||
| 128 | 125 | } |
| 129 | 126 | |
| 130 | 127 | /* Initialise a single lance board at the given DIO device */ |
| 131 | −static void __devinit hplance_init(struct net_device *dev, struct dio_dev *d) | |
| 128 | +static void hplance_init(struct net_device *dev, struct dio_dev *d) | |
| 132 | 129 | { |
| 133 | 130 | unsigned long va = (d->resource.start + DIO_VIRADDRBASE); |
| 134 | 131 | struct hplance_private *lp; |
| @@ -1443,7 +1443,7 @@ static const struct ethtool_ops pcnet32_ethtool_ops = { · 1442 unmodified lines | ||
| 1443 | 1443 | /* only probes for non-PCI devices, the rest are handled by |
| 1444 | 1444 | * pci_register_driver via pcnet32_probe_pci */ |
| 1445 | 1445 | |
| 1446 | −static void __devinit pcnet32_probe_vlbus(unsigned int *pcnet32_portlist) | |
| 1446 | +static void pcnet32_probe_vlbus(unsigned int *pcnet32_portlist) | |
| 1447 | 1447 | { |
| 1448 | 1448 | unsigned int *port, ioaddr; |
| 1449 | 1449 | |
| @@ -1462,7 +1462,7 @@ static void __devinit pcnet32_probe_vlbus(unsigned int *pcnet32_portlist) · 12 unmodified lines | ||
| 1462 | 1462 | } |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | −static int __devinit | |
| 1465 | +static int | |
| 1466 | 1466 | pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 1467 | 1467 | { |
| 1468 | 1468 | unsigned long ioaddr; |
| @@ -1521,7 +1521,7 @@ static const struct net_device_ops pcnet32_netdev_ops = { · 52 unmodified lines | ||
| 1521 | 1521 | * Called from both pcnet32_probe_vlbus and pcnet_probe_pci. |
| 1522 | 1522 | * pdev will be NULL when called from pcnet32_probe_vlbus. |
| 1523 | 1523 | */ |
| 1524 | −static int __devinit | |
| 1524 | +static int | |
| 1525 | 1525 | pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) |
| 1526 | 1526 | { |
| 1527 | 1527 | struct pcnet32_private *lp; |
| @@ -2823,7 +2823,7 @@ static int pcnet32_pm_resume(struct pci_dev *pdev) · 1295 unmodified lines | ||
| 2823 | 2823 | return 0; |
| 2824 | 2824 | } |
| 2825 | 2825 | |
| 2826 | −static void __devexit pcnet32_remove_one(struct pci_dev *pdev) | |
| 2826 | +static void pcnet32_remove_one(struct pci_dev *pdev) | |
| 2827 | 2827 | { |
| 2828 | 2828 | struct net_device *dev = pci_get_drvdata(pdev); |
| 2829 | 2829 | |
| @@ -2844,7 +2844,7 @@ static void __devexit pcnet32_remove_one(struct pci_dev *pdev) · 14 unmodified lines | ||
| 2844 | 2844 | static struct pci_driver pcnet32_driver = { |
| 2845 | 2845 | .name = DRV_NAME, |
| 2846 | 2846 | .probe = pcnet32_probe_pci, |
| 2847 | − .remove = __devexit_p(pcnet32_remove_one), | |
| 2847 | + .remove = pcnet32_remove_one, | |
| 2848 | 2848 | .id_table = pcnet32_pci_tbl, |
| 2849 | 2849 | .suspend = pcnet32_pm_suspend, |
| 2850 | 2850 | .resume = pcnet32_pm_resume, |
| @@ -1304,9 +1304,9 @@ static const struct net_device_ops sparc_lance_ops = { · 1303 unmodified lines | ||
| 1304 | 1304 | .ndo_validate_addr = eth_validate_addr, |
| 1305 | 1305 | }; |
| 1306 | 1306 | |
| 1307 | −static int __devinit sparc_lance_probe_one(struct platform_device *op, | |
| 1308 | − struct platform_device *ledma, | |
| 1309 | − struct platform_device *lebuffer) | |
| 1307 | +static int sparc_lance_probe_one(struct platform_device *op, | |
| 1308 | + struct platform_device *ledma, | |
| 1309 | + struct platform_device *lebuffer) | |
| 1310 | 1310 | { |
| 1311 | 1311 | struct device_node *dp = op->dev.of_node; |
| 1312 | 1312 | static unsigned version_printed; |
| @@ -1488,7 +1488,7 @@ fail: · 175 unmodified lines | ||
| 1488 | 1488 | return -ENODEV; |
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | −static int __devinit sunlance_sbus_probe(struct platform_device *op) | |
| 1491 | +static int sunlance_sbus_probe(struct platform_device *op) | |
| 1492 | 1492 | { |
| 1493 | 1493 | struct platform_device *parent = to_platform_device(op->dev.parent); |
| 1494 | 1494 | struct device_node *parent_dp = parent->dev.of_node; |
| @@ -1504,7 +1504,7 @@ static int __devinit sunlance_sbus_probe(struct platform_device *op) · 9 unmodified lines | ||
| 1504 | 1504 | return err; |
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | −static int __devexit sunlance_sbus_remove(struct platform_device *op) | |
| 1507 | +static int sunlance_sbus_remove(struct platform_device *op) | |
| 1508 | 1508 | { |
| 1509 | 1509 | struct lance_private *lp = dev_get_drvdata(&op->dev); |
| 1510 | 1510 | struct net_device *net_dev = lp->dev; |
| @@ -1536,7 +1536,7 @@ static struct platform_driver sunlance_sbus_driver = { · 25 unmodified lines | ||
| 1536 | 1536 | .of_match_table = sunlance_sbus_match, |
| 1537 | 1537 | }, |
| 1538 | 1538 | .probe = sunlance_sbus_probe, |
| 1539 | − .remove = __devexit_p(sunlance_sbus_remove), | |
| 1539 | + .remove = sunlance_sbus_remove, | |
| 1540 | 1540 | }; |
| 1541 | 1541 | |
| 1542 | 1542 | module_platform_driver(sunlance_sbus_driver); |
| @@ -1244,7 +1244,7 @@ static const struct net_device_ops bmac_netdev_ops = { · 1243 unmodified lines | ||
| 1244 | 1244 | .ndo_validate_addr = eth_validate_addr, |
| 1245 | 1245 | }; |
| 1246 | 1246 | |
| 1247 | −static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) | |
| 1247 | +static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) | |
| 1248 | 1248 | { |
| 1249 | 1249 | int j, rev, ret; |
| 1250 | 1250 | struct bmac_data *bp; |
| @@ -1602,7 +1602,7 @@ bmac_proc_info(char *buffer, char **start, off_t offset, int length) · 351 unmodified lines | ||
| 1602 | 1602 | } |
| 1603 | 1603 | #endif |
| 1604 | 1604 | |
| 1605 | −static int __devexit bmac_remove(struct macio_dev *mdev) | |
| 1605 | +static int bmac_remove(struct macio_dev *mdev) | |
| 1606 | 1606 | { |
| 1607 | 1607 | struct net_device *dev = macio_get_drvdata(mdev); |
| 1608 | 1608 | struct bmac_data *bp = netdev_priv(dev); |
| @@ -106,7 +106,7 @@ static const struct net_device_ops mace_netdev_ops = { · 105 unmodified lines | ||
| 106 | 106 | .ndo_validate_addr = eth_validate_addr, |
| 107 | 107 | }; |
| 108 | 108 | |
| 109 | −static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_id *match) | |
| 109 | +static int mace_probe(struct macio_dev *mdev, const struct of_device_id *match) | |
| 110 | 110 | { |
| 111 | 111 | struct device_node *mace = macio_get_of_node(mdev); |
| 112 | 112 | struct net_device *dev; |
| @@ -271,7 +271,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i · 158 unmodified lines | ||
| 271 | 271 | return rc; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | −static int __devexit mace_remove(struct macio_dev *mdev) | |
| 274 | +static int mace_remove(struct macio_dev *mdev) | |
| 275 | 275 | { |
| 276 | 276 | struct net_device *dev = macio_get_drvdata(mdev); |
| 277 | 277 | struct mace_data *mp; |
| @@ -195,7 +195,7 @@ static const struct net_device_ops mace_netdev_ops = { · 194 unmodified lines | ||
| 195 | 195 | * model of Macintrash has a MACE (AV macintoshes) |
| 196 | 196 | */ |
| 197 | 197 | |
| 198 | −static int __devinit mace_probe(struct platform_device *pdev) | |
| 198 | +static int mace_probe(struct platform_device *pdev) | |
| 199 | 199 | { |
| 200 | 200 | int j; |
| 201 | 201 | struct mace_data *mp; |
| @@ -746,7 +746,7 @@ MODULE_LICENSE("GPL"); · 544 unmodified lines | ||
| 746 | 746 | MODULE_DESCRIPTION("Macintosh MACE ethernet driver"); |
| 747 | 747 | MODULE_ALIAS("platform:macmace"); |
| 748 | 748 | |
| 749 | −static int __devexit mac_mace_device_remove (struct platform_device *pdev) | |
| 749 | +static int mac_mace_device_remove(struct platform_device *pdev) | |
| 750 | 750 | { |
| 751 | 751 | struct net_device *dev = platform_get_drvdata(pdev); |
| 752 | 752 | struct mace_data *mp = netdev_priv(dev); |
| @@ -768,7 +768,7 @@ static int __devexit mac_mace_device_remove (struct platform_device *pdev) · 15 unmodified lines | ||
| 768 | 768 | |
| 769 | 769 | static struct platform_driver mac_mace_driver = { |
| 770 | 770 | .probe = mace_probe, |
| 771 | − .remove = __devexit_p(mac_mace_device_remove), | |
| 771 | + .remove = mac_mace_device_remove, | |
| 772 | 772 | .driver = { |
| 773 | 773 | .name = mac_mace_string, |
| 774 | 774 | .owner = THIS_MODULE, |
| @@ -643,7 +643,7 @@ static int atl1c_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) · 642 unmodified lines | ||
| 643 | 643 | * @adapter: board private structure to initialize |
| 644 | 644 | * |
| 645 | 645 | */ |
| 646 | −static int __devinit atl1c_alloc_queues(struct atl1c_adapter *adapter) | |
| 646 | +static int atl1c_alloc_queues(struct atl1c_adapter *adapter) | |
| 647 | 647 | { |
| 648 | 648 | return 0; |
| 649 | 649 | } |
| @@ -702,7 +702,7 @@ struct atl1c_platform_patch { · 52 unmodified lines | ||
| 702 | 702 | u32 patch_flag; |
| 703 | 703 | #define ATL1C_LINK_PATCH 0x1 |
| 704 | 704 | }; |
| 705 | −static const struct atl1c_platform_patch plats[] __devinitconst = { | |
| 705 | +static const struct atl1c_platform_patch plats[] = { | |
| 706 | 706 | {0x2060, 0xC1, 0x1019, 0x8152, 0x1}, |
| 707 | 707 | {0x2060, 0xC1, 0x1019, 0x2060, 0x1}, |
| 708 | 708 | {0x2060, 0xC1, 0x1019, 0xE000, 0x1}, |
| @@ -725,7 +725,7 @@ static const struct atl1c_platform_patch plats[] __devinitconst = { · 16 unmodified lines | ||
| 725 | 725 | {0}, |
| 726 | 726 | }; |
| 727 | 727 | |
| 728 | −static void __devinit atl1c_patch_assign(struct atl1c_hw *hw) | |
| 728 | +static void atl1c_patch_assign(struct atl1c_hw *hw) | |
| 729 | 729 | { |
| 730 | 730 | struct pci_dev *pdev = hw->adapter->pdev; |
| 731 | 731 | u32 misc_ctrl; |
| @@ -764,7 +764,7 @@ static void __devinit atl1c_patch_assign(struct atl1c_hw *hw) · 32 unmodified lines | ||
| 764 | 764 | * Fields are initialized based on PCI device information and |
| 765 | 765 | * OS network device settings (MTU size). |
| 766 | 766 | */ |
| 767 | −static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter) | |
| 767 | +static int atl1c_sw_init(struct atl1c_adapter *adapter) | |
| 768 | 768 | { |
| 769 | 769 | struct atl1c_hw *hw = &adapter->hw; |
| 770 | 770 | struct pci_dev *pdev = adapter->pdev; |
| @@ -2442,8 +2442,7 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev) · 1671 unmodified lines | ||
| 2442 | 2442 | * The OS initialization, configuring of the adapter private structure, |
| 2443 | 2443 | * and a hardware reset occur. |
| 2444 | 2444 | */ |
| 2445 | −static int __devinit atl1c_probe(struct pci_dev *pdev, | |
| 2446 | − const struct pci_device_id *ent) | |
| 2445 | +static int atl1c_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 2447 | 2446 | { |
| 2448 | 2447 | struct net_device *netdev; |
| 2449 | 2448 | struct atl1c_adapter *adapter; |
| @@ -2587,7 +2586,7 @@ err_dma: · 137 unmodified lines | ||
| 2587 | 2586 | * Hot-Plug event, or because the driver is going to be removed from |
| 2588 | 2587 | * memory. |
| 2589 | 2588 | */ |
| 2590 | −static void __devexit atl1c_remove(struct pci_dev *pdev) | |
| 2589 | +static void atl1c_remove(struct pci_dev *pdev) | |
| 2591 | 2590 | { |
| 2592 | 2591 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 2593 | 2592 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
| @@ -2697,7 +2696,7 @@ static struct pci_driver atl1c_driver = { · 103 unmodified lines | ||
| 2697 | 2696 | .name = atl1c_driver_name, |
| 2698 | 2697 | .id_table = atl1c_pci_tbl, |
| 2699 | 2698 | .probe = atl1c_probe, |
| 2700 | − .remove = __devexit_p(atl1c_remove), | |
| 2699 | + .remove = atl1c_remove, | |
| 2701 | 2700 | .shutdown = atl1c_shutdown, |
| 2702 | 2701 | .err_handler = &atl1c_err_handler, |
| 2703 | 2702 | .driver.pm = &atl1c_pm_ops, |
| @@ -534,7 +534,7 @@ static void atl1e_setup_pcicmd(struct pci_dev *pdev) · 533 unmodified lines | ||
| 534 | 534 | * @adapter: board private structure to initialize |
| 535 | 535 | * |
| 536 | 536 | */ |
| 537 | −static int __devinit atl1e_alloc_queues(struct atl1e_adapter *adapter) | |
| 537 | +static int atl1e_alloc_queues(struct atl1e_adapter *adapter) | |
| 538 | 538 | { |
| 539 | 539 | return 0; |
| 540 | 540 | } |
| @@ -547,7 +547,7 @@ static int __devinit atl1e_alloc_queues(struct atl1e_adapter *adapter) · 6 unmodified lines | ||
| 547 | 547 | * Fields are initialized based on PCI device information and |
| 548 | 548 | * OS network device settings (MTU size). |
| 549 | 549 | */ |
| 550 | −static int __devinit atl1e_sw_init(struct atl1e_adapter *adapter) | |
| 550 | +static int atl1e_sw_init(struct atl1e_adapter *adapter) | |
| 551 | 551 | { |
| 552 | 552 | struct atl1e_hw *hw = &adapter->hw; |
| 553 | 553 | struct pci_dev *pdev = adapter->pdev; |
| @@ -2235,8 +2235,7 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev) · 1681 unmodified lines | ||
| 2235 | 2235 | * The OS initialization, configuring of the adapter private structure, |
| 2236 | 2236 | * and a hardware reset occur. |
| 2237 | 2237 | */ |
| 2238 | −static int __devinit atl1e_probe(struct pci_dev *pdev, | |
| 2239 | − const struct pci_device_id *ent) | |
| 2238 | +static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 2240 | 2239 | { |
| 2241 | 2240 | struct net_device *netdev; |
| 2242 | 2241 | struct atl1e_adapter *adapter = NULL; |
| @@ -2387,7 +2386,7 @@ err_dma: · 144 unmodified lines | ||
| 2387 | 2386 | * Hot-Plug event, or because the driver is going to be removed from |
| 2388 | 2387 | * memory. |
| 2389 | 2388 | */ |
| 2390 | −static void __devexit atl1e_remove(struct pci_dev *pdev) | |
| 2389 | +static void atl1e_remove(struct pci_dev *pdev) | |
| 2391 | 2390 | { |
| 2392 | 2391 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 2393 | 2392 | struct atl1e_adapter *adapter = netdev_priv(netdev); |
| @@ -2499,7 +2498,7 @@ static struct pci_driver atl1e_driver = { · 105 unmodified lines | ||
| 2499 | 2498 | .name = atl1e_driver_name, |
| 2500 | 2499 | .id_table = atl1e_pci_tbl, |
| 2501 | 2500 | .probe = atl1e_probe, |
| 2502 | − .remove = __devexit_p(atl1e_remove), | |
| 2501 | + .remove = atl1e_remove, | |
| 2503 | 2502 | /* Power Management Hooks */ |
| 2504 | 2503 | #ifdef CONFIG_PM |
| 2505 | 2504 | .suspend = atl1e_suspend, |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | #define ATL1E_PARAM_INIT { [0 ... ATL1E_MAX_NIC] = OPTION_UNSET } |
| 41 | 41 | |
| 42 | 42 | #define ATL1E_PARAM(x, desc) \ |
| 43 | − static int __devinitdata x[ATL1E_MAX_NIC + 1] = ATL1E_PARAM_INIT; \ | |
| 43 | + static int x[ATL1E_MAX_NIC + 1] = ATL1E_PARAM_INIT; \ | |
| 44 | 44 | static unsigned int num_##x; \ |
| 45 | 45 | module_param_array_named(x, x, int, &num_##x, 0); \ |
| 46 | 46 | MODULE_PARM_DESC(x, desc); |
| @@ -116,7 +116,8 @@ struct atl1e_option { · 69 unmodified lines | ||
| 116 | 116 | } arg; |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | −static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt, struct atl1e_adapter *adapter) | |
| 119 | +static int atl1e_validate_option(int *value, struct atl1e_option *opt, | |
| 120 | + struct atl1e_adapter *adapter) | |
| 120 | 121 | { |
| 121 | 122 | if (*value == OPTION_UNSET) { |
| 122 | 123 | *value = opt->def; |
| @@ -177,7 +178,7 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt, · 54 unmodified lines | ||
| 177 | 178 | * value exists, a default value is used. The final value is stored |
| 178 | 179 | * in a variable in the adapter structure. |
| 179 | 180 | */ |
| 180 | −void __devinit atl1e_check_options(struct atl1e_adapter *adapter) | |
| 181 | +void atl1e_check_options(struct atl1e_adapter *adapter) | |
| 181 | 182 | { |
| 182 | 183 | int bd = adapter->bd_number; |
| 183 | 184 | |
| @@ -113,7 +113,7 @@ static const struct ethtool_ops atl1_ethtool_ops; · 112 unmodified lines | ||
| 113 | 113 | * |
| 114 | 114 | * Default Value: 100 (200us) |
| 115 | 115 | */ |
| 116 | −static int __devinitdata int_mod_timer[ATL1_MAX_NIC+1] = ATL1_PARAM_INIT; | |
| 116 | +static int int_mod_timer[ATL1_MAX_NIC+1] = ATL1_PARAM_INIT; | |
| 117 | 117 | static unsigned int num_int_mod_timer; |
| 118 | 118 | module_param_array_named(int_mod_timer, int_mod_timer, int, |
| 119 | 119 | &num_int_mod_timer, 0); |
| @@ -143,8 +143,8 @@ struct atl1_option { · 23 unmodified lines | ||
| 143 | 143 | } arg; |
| 144 | 144 | }; |
| 145 | 145 | |
| 146 | −static int __devinit atl1_validate_option(int *value, struct atl1_option *opt, | |
| 147 | − struct pci_dev *pdev) | |
| 146 | +static int atl1_validate_option(int *value, struct atl1_option *opt, | |
| 147 | + struct pci_dev *pdev) | |
| 148 | 148 | { |
| 149 | 149 | if (*value == OPTION_UNSET) { |
| 150 | 150 | *value = opt->def; |
| @@ -204,7 +204,7 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt, · 53 unmodified lines | ||
| 204 | 204 | * value exists, a default value is used. The final value is stored |
| 205 | 205 | * in a variable in the adapter structure. |
| 206 | 206 | */ |
| 207 | −static void __devinit atl1_check_options(struct atl1_adapter *adapter) | |
| 207 | +static void atl1_check_options(struct atl1_adapter *adapter) | |
| 208 | 208 | { |
| 209 | 209 | struct pci_dev *pdev = adapter->pdev; |
| 210 | 210 | int bd = adapter->bd_number; |
| @@ -945,7 +945,7 @@ static void atl1_set_mac_addr(struct atl1_hw *hw) · 734 unmodified lines | ||
| 945 | 945 | * Fields are initialized based on PCI device information and |
| 946 | 946 | * OS network device settings (MTU size). |
| 947 | 947 | */ |
| 948 | −static int __devinit atl1_sw_init(struct atl1_adapter *adapter) | |
| 948 | +static int atl1_sw_init(struct atl1_adapter *adapter) | |
| 949 | 949 | { |
| 950 | 950 | struct atl1_hw *hw = &adapter->hw; |
| 951 | 951 | struct net_device *netdev = adapter->netdev; |
| @@ -2934,8 +2934,7 @@ static const struct net_device_ops atl1_netdev_ops = { · 1982 unmodified lines | ||
| 2934 | 2934 | * The OS initialization, configuring of the adapter private structure, |
| 2935 | 2935 | * and a hardware reset occur. |
| 2936 | 2936 | */ |
| 2937 | −static int __devinit atl1_probe(struct pci_dev *pdev, | |
| 2938 | − const struct pci_device_id *ent) | |
| 2937 | +static int atl1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 2939 | 2938 | { |
| 2940 | 2939 | struct net_device *netdev; |
| 2941 | 2940 | struct atl1_adapter *adapter; |
| @@ -3113,7 +3112,7 @@ err_request_regions: · 171 unmodified lines | ||
| 3113 | 3112 | * Hot-Plug event, or because the driver is going to be removed from |
| 3114 | 3113 | * memory. |
| 3115 | 3114 | */ |
| 3116 | −static void __devexit atl1_remove(struct pci_dev *pdev) | |
| 3115 | +static void atl1_remove(struct pci_dev *pdev) | |
| 3117 | 3116 | { |
| 3118 | 3117 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 3119 | 3118 | struct atl1_adapter *adapter; |
| @@ -3146,7 +3145,7 @@ static struct pci_driver atl1_driver = { · 26 unmodified lines | ||
| 3146 | 3145 | .name = ATLX_DRIVER_NAME, |
| 3147 | 3146 | .id_table = atl1_pci_tbl, |
| 3148 | 3147 | .probe = atl1_probe, |
| 3149 | − .remove = __devexit_p(atl1_remove), | |
| 3148 | + .remove = atl1_remove, | |
| 3150 | 3149 | .shutdown = atl1_shutdown, |
| 3151 | 3150 | .driver.pm = ATL1_PM_OPS, |
| 3152 | 3151 | }; |
| @@ -83,7 +83,7 @@ static void atl2_check_options(struct atl2_adapter *adapter); · 82 unmodified lines | ||
| 83 | 83 | * Fields are initialized based on PCI device information and |
| 84 | 84 | * OS network device settings (MTU size). |
| 85 | 85 | */ |
| 86 | −static int __devinit atl2_sw_init(struct atl2_adapter *adapter) | |
| 86 | +static int atl2_sw_init(struct atl2_adapter *adapter) | |
| 87 | 87 | { |
| 88 | 88 | struct atl2_hw *hw = &adapter->hw; |
| 89 | 89 | struct pci_dev *pdev = adapter->pdev; |
| @@ -1338,8 +1338,7 @@ static const struct net_device_ops atl2_netdev_ops = { · 1248 unmodified lines | ||
| 1338 | 1338 | * The OS initialization, configuring of the adapter private structure, |
| 1339 | 1339 | * and a hardware reset occur. |
| 1340 | 1340 | */ |
| 1341 | −static int __devinit atl2_probe(struct pci_dev *pdev, | |
| 1342 | − const struct pci_device_id *ent) | |
| 1341 | +static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 1343 | 1342 | { |
| 1344 | 1343 | struct net_device *netdev; |
| 1345 | 1344 | struct atl2_adapter *adapter; |
| @@ -1498,7 +1497,7 @@ err_dma: · 152 unmodified lines | ||
| 1498 | 1497 | */ |
| 1499 | 1498 | /* FIXME: write the original MAC address back in case it was changed from a |
| 1500 | 1499 | * BIOS-set value, as in atl1 -- CHS */ |
| 1501 | −static void __devexit atl2_remove(struct pci_dev *pdev) | |
| 1500 | +static void atl2_remove(struct pci_dev *pdev) | |
| 1502 | 1501 | { |
| 1503 | 1502 | struct net_device *netdev = pci_get_drvdata(pdev); |
| 1504 | 1503 | struct atl2_adapter *adapter = netdev_priv(netdev); |
| @@ -1705,7 +1704,7 @@ static struct pci_driver atl2_driver = { · 200 unmodified lines | ||
| 1705 | 1704 | .name = atl2_driver_name, |
| 1706 | 1705 | .id_table = atl2_pci_tbl, |
| 1707 | 1706 | .probe = atl2_probe, |
| 1708 | − .remove = __devexit_p(atl2_remove), | |
| 1707 | + .remove = atl2_remove, | |
| 1709 | 1708 | /* Power Management Hooks */ |
| 1710 | 1709 | .suspend = atl2_suspend, |
| 1711 | 1710 | #ifdef CONFIG_PM |
| @@ -2845,12 +2844,12 @@ static void atl2_force_ps(struct atl2_hw *hw) · 1133 unmodified lines | ||
| 2845 | 2844 | */ |
| 2846 | 2845 | |
| 2847 | 2846 | #define ATL2_PARAM(X, desc) \ |
| 2848 | − static const int __devinitconst X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \ | |
| 2847 | + static const int X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \ | |
| 2849 | 2848 | MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \ |
| 2850 | 2849 | MODULE_PARM_DESC(X, desc); |
| 2851 | 2850 | #else |
| 2852 | 2851 | #define ATL2_PARAM(X, desc) \ |
| 2853 | − static int __devinitdata X[ATL2_MAX_NIC+1] = ATL2_PARAM_INIT; \ | |
| 2852 | + static int X[ATL2_MAX_NIC+1] = ATL2_PARAM_INIT; \ | |
| 2854 | 2853 | static unsigned int num_##X; \ |
| 2855 | 2854 | module_param_array_named(X, X, int, &num_##X, 0); \ |
| 2856 | 2855 | MODULE_PARM_DESC(X, desc); |
| @@ -2934,7 +2933,7 @@ struct atl2_option { · 77 unmodified lines | ||
| 2934 | 2933 | } arg; |
| 2935 | 2934 | }; |
| 2936 | 2935 | |
| 2937 | −static int __devinit atl2_validate_option(int *value, struct atl2_option *opt) | |
| 2936 | +static int atl2_validate_option(int *value, struct atl2_option *opt) | |
| 2938 | 2937 | { |
| 2939 | 2938 | int i; |
| 2940 | 2939 | struct atl2_opt_list *ent; |
| @@ -2992,7 +2991,7 @@ static int __devinit atl2_validate_option(int *value, struct atl2_option *opt) · 51 unmodified lines | ||
| 2992 | 2991 | * value exists, a default value is used. The final value is stored |
| 2993 | 2992 | * in a variable in the adapter structure. |
| 2994 | 2993 | */ |
| 2995 | −static void __devinit atl2_check_options(struct atl2_adapter *adapter) | |
| 2994 | +static void atl2_check_options(struct atl2_adapter *adapter) | |
| 2996 | 2995 | { |
| 2997 | 2996 | int val; |
| 2998 | 2997 | struct atl2_option opt; |
| @@ -102,6 +102,7 @@ config TIGON3 · 101 unmodified lines | ||
| 102 | 102 | depends on PCI |
| 103 | 103 | select PHYLIB |
| 104 | 104 | select HWMON |
| 105 | + select PTP_1588_CLOCK | |
| 105 | 106 | ---help--- |
| 106 | 107 | This driver supports Broadcom Tigon3 based gigabit Ethernet cards. |
| 107 | 108 | |
| @@ -2083,7 +2083,7 @@ out: · 2082 unmodified lines | ||
| 2083 | 2083 | return err; |
| 2084 | 2084 | } |
| 2085 | 2085 | |
| 2086 | −static int __devinit b44_get_invariants(struct b44 *bp) | |
| 2086 | +static int b44_get_invariants(struct b44 *bp) | |
| 2087 | 2087 | { |
| 2088 | 2088 | struct ssb_device *sdev = bp->sdev; |
| 2089 | 2089 | int err = 0; |
| @@ -2141,8 +2141,8 @@ static const struct net_device_ops b44_netdev_ops = { · 51 unmodified lines | ||
| 2141 | 2141 | #endif |
| 2142 | 2142 | }; |
| 2143 | 2143 | |
| 2144 | −static int __devinit b44_init_one(struct ssb_device *sdev, | |
| 2145 | − const struct ssb_device_id *ent) | |
| 2144 | +static int b44_init_one(struct ssb_device *sdev, | |
| 2145 | + const struct ssb_device_id *ent) | |
| 2146 | 2146 | { |
| 2147 | 2147 | struct net_device *dev; |
| 2148 | 2148 | struct b44 *bp; |
| @@ -2249,7 +2249,7 @@ out: · 100 unmodified lines | ||
| 2249 | 2249 | return err; |
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | −static void __devexit b44_remove_one(struct ssb_device *sdev) | |
| 2252 | +static void b44_remove_one(struct ssb_device *sdev) | |
| 2253 | 2253 | { |
| 2254 | 2254 | struct net_device *dev = ssb_get_drvdata(sdev); |
| 2255 | 2255 | |
| @@ -2340,7 +2340,7 @@ static struct ssb_driver b44_ssb_driver = { · 84 unmodified lines | ||
| 2340 | 2340 | .name = DRV_MODULE_NAME, |
| 2341 | 2341 | .id_table = b44_ssb_tbl, |
| 2342 | 2342 | .probe = b44_init_one, |
| 2343 | − .remove = __devexit_p(b44_remove_one), | |
| 2343 | + .remove = b44_remove_one, | |
| 2344 | 2344 | .suspend = b44_suspend, |
| 2345 | 2345 | .resume = b44_resume, |
| 2346 | 2346 | }; |
| @@ -1612,7 +1612,7 @@ static const struct net_device_ops bcm_enet_ops = { · 1611 unmodified lines | ||
| 1612 | 1612 | /* |
| 1613 | 1613 | * allocate netdevice, request register memory and register device. |
| 1614 | 1614 | */ |
| 1615 | −static int __devinit bcm_enet_probe(struct platform_device *pdev) | |
| 1615 | +static int bcm_enet_probe(struct platform_device *pdev) | |
| 1616 | 1616 | { |
| 1617 | 1617 | struct bcm_enet_priv *priv; |
| 1618 | 1618 | struct net_device *dev; |
| @@ -1830,7 +1830,7 @@ out: · 211 unmodified lines | ||
| 1830 | 1830 | /* |
| 1831 | 1831 | * exit func, stops hardware and unregisters netdevice |
| 1832 | 1832 | */ |
| 1833 | −static int __devexit bcm_enet_remove(struct platform_device *pdev) | |
| 1833 | +static int bcm_enet_remove(struct platform_device *pdev) | |
| 1834 | 1834 | { |
| 1835 | 1835 | struct bcm_enet_priv *priv; |
| 1836 | 1836 | struct net_device *dev; |
| @@ -1877,7 +1877,7 @@ static int __devexit bcm_enet_remove(struct platform_device *pdev) · 40 unmodified lines | ||
| 1877 | 1877 | |
| 1878 | 1878 | struct platform_driver bcm63xx_enet_driver = { |
| 1879 | 1879 | .probe = bcm_enet_probe, |
| 1880 | − .remove = __devexit_p(bcm_enet_remove), | |
| 1880 | + .remove = bcm_enet_remove, | |
| 1881 | 1881 | .driver = { |
| 1882 | 1882 | .name = "bcm63xx_enet", |
| 1883 | 1883 | .owner = THIS_MODULE, |
| @@ -1887,7 +1887,7 @@ struct platform_driver bcm63xx_enet_driver = { · 3 unmodified lines | ||
| 1887 | 1887 | /* |
| 1888 | 1888 | * reserve & remap memory space shared between all macs |
| 1889 | 1889 | */ |
| 1890 | −static int __devinit bcm_enet_shared_probe(struct platform_device *pdev) | |
| 1890 | +static int bcm_enet_shared_probe(struct platform_device *pdev) | |
| 1891 | 1891 | { |
| 1892 | 1892 | struct resource *res; |
| 1893 | 1893 | unsigned int iomem_size; |
| @@ -1908,7 +1908,7 @@ static int __devinit bcm_enet_shared_probe(struct platform_device *pdev) · 14 unmodified lines | ||
| 1908 | 1908 | return 0; |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | −static int __devexit bcm_enet_shared_remove(struct platform_device *pdev) | |
| 1911 | +static int bcm_enet_shared_remove(struct platform_device *pdev) | |
| 1912 | 1912 | { |
| 1913 | 1913 | struct resource *res; |
| 1914 | 1914 | |
| @@ -1924,7 +1924,7 @@ static int __devexit bcm_enet_shared_remove(struct platform_device *pdev) · 9 unmodified lines | ||
| 1924 | 1924 | */ |
| 1925 | 1925 | struct platform_driver bcm63xx_enet_shared_driver = { |
| 1926 | 1926 | .probe = bcm_enet_shared_probe, |
| 1927 | − .remove = __devexit_p(bcm_enet_shared_remove), | |
| 1927 | + .remove = bcm_enet_shared_remove, | |
| 1928 | 1928 | .driver = { |
| 1929 | 1929 | .name = "bcm63xx_enet_shared", |
| 1930 | 1930 | .owner = THIS_MODULE, |
| @@ -71,7 +71,7 @@ · 70 unmodified lines | ||
| 71 | 71 | /* Time in jiffies before concluding the transmitter is hung. */ |
| 72 | 72 | #define TX_TIMEOUT (5*HZ) |
| 73 | 73 | |
| 74 | −static char version[] __devinitdata = | |
| 74 | +static char version[] = | |
| 75 | 75 | "Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
| 76 | 76 | |
| 77 | 77 | MODULE_AUTHOR("Michael Chan <mchan@broadcom.com>"); |
| @@ -106,7 +106,7 @@ typedef enum { · 28 unmodified lines | ||
| 106 | 106 | /* indexed by board_t, above */ |
| 107 | 107 | static struct { |
| 108 | 108 | char *name; |
| 109 | −} board_info[] __devinitdata = { | |
| 109 | +} board_info[] = { | |
| 110 | 110 | { "Broadcom NetXtreme II BCM5706 1000Base-T" }, |
| 111 | 111 | { "HP NC370T Multifunction Gigabit Server Adapter" }, |
| 112 | 112 | { "HP NC370i Multifunction Gigabit Server Adapter" }, |
| @@ -260,10 +260,10 @@ static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr) · 147 unmodified lines | ||
| 260 | 260 | * needs to be skipped. |
| 261 | 261 | */ |
| 262 | 262 | diff = txr->tx_prod - txr->tx_cons; |
| 263 | − if (unlikely(diff >= TX_DESC_CNT)) { | |
| 263 | + if (unlikely(diff >= BNX2_TX_DESC_CNT)) { | |
| 264 | 264 | diff &= 0xffff; |
| 265 | − if (diff == TX_DESC_CNT) | |
| 266 | − diff = MAX_TX_DESC_CNT; | |
| 265 | + if (diff == BNX2_TX_DESC_CNT) | |
| 266 | + diff = BNX2_MAX_TX_DESC_CNT; | |
| 267 | 267 | } |
| 268 | 268 | return bp->tx_ring_size - diff; |
| 269 | 269 | } |
| @@ -274,8 +274,8 @@ bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset) · 4 unmodified lines | ||
| 274 | 274 | u32 val; |
| 275 | 275 | |
| 276 | 276 | spin_lock_bh(&bp->indirect_lock); |
| 277 | − REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset); | |
| 278 | − val = REG_RD(bp, BNX2_PCICFG_REG_WINDOW); | |
| 277 | + BNX2_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset); | |
| 278 | + val = BNX2_RD(bp, BNX2_PCICFG_REG_WINDOW); | |
| 279 | 279 | spin_unlock_bh(&bp->indirect_lock); |
| 280 | 280 | return val; |
| 281 | 281 | } |
| @@ -284,8 +284,8 @@ static void · 2 unmodified lines | ||
| 284 | 284 | bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val) |
| 285 | 285 | { |
| 286 | 286 | spin_lock_bh(&bp->indirect_lock); |
| 287 | − REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset); | |
| 288 | − REG_WR(bp, BNX2_PCICFG_REG_WINDOW, val); | |
| 287 | + BNX2_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset); | |
| 288 | + BNX2_WR(bp, BNX2_PCICFG_REG_WINDOW, val); | |
| 289 | 289 | spin_unlock_bh(&bp->indirect_lock); |
| 290 | 290 | } |
| 291 | 291 | |
| @@ -306,21 +306,21 @@ bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val) · 14 unmodified lines | ||
| 306 | 306 | { |
| 307 | 307 | offset += cid_addr; |
| 308 | 308 | spin_lock_bh(&bp->indirect_lock); |
| 309 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 309 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 310 | 310 | int i; |
| 311 | 311 | |
| 312 | − REG_WR(bp, BNX2_CTX_CTX_DATA, val); | |
| 313 | − REG_WR(bp, BNX2_CTX_CTX_CTRL, | |
| 314 | − offset | BNX2_CTX_CTX_CTRL_WRITE_REQ); | |
| 312 | + BNX2_WR(bp, BNX2_CTX_CTX_DATA, val); | |
| 313 | + BNX2_WR(bp, BNX2_CTX_CTX_CTRL, | |
| 314 | + offset | BNX2_CTX_CTX_CTRL_WRITE_REQ); | |
| 315 | 315 | for (i = 0; i < 5; i++) { |
| 316 | − val = REG_RD(bp, BNX2_CTX_CTX_CTRL); | |
| 316 | + val = BNX2_RD(bp, BNX2_CTX_CTX_CTRL); | |
| 317 | 317 | if ((val & BNX2_CTX_CTX_CTRL_WRITE_REQ) == 0) |
| 318 | 318 | break; |
| 319 | 319 | udelay(5); |
| 320 | 320 | } |
| 321 | 321 | } else { |
| 322 | − REG_WR(bp, BNX2_CTX_DATA_ADR, offset); | |
| 323 | − REG_WR(bp, BNX2_CTX_DATA, val); | |
| 322 | + BNX2_WR(bp, BNX2_CTX_DATA_ADR, offset); | |
| 323 | + BNX2_WR(bp, BNX2_CTX_DATA, val); | |
| 324 | 324 | } |
| 325 | 325 | spin_unlock_bh(&bp->indirect_lock); |
| 326 | 326 | } |
| @@ -434,7 +434,6 @@ struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev) · 107 unmodified lines | ||
| 434 | 434 | |
| 435 | 435 | return cp; |
| 436 | 436 | } |
| 437 | −EXPORT_SYMBOL(bnx2_cnic_probe); | |
| 438 | 437 | |
| 439 | 438 | static void |
| 440 | 439 | bnx2_cnic_stop(struct bnx2 *bp) |
| @@ -494,11 +493,11 @@ bnx2_read_phy(struct bnx2 *bp, u32 reg, u32 *val) · 53 unmodified lines | ||
| 494 | 493 | int i, ret; |
| 495 | 494 | |
| 496 | 495 | if (bp->phy_flags & BNX2_PHY_FLAG_INT_MODE_AUTO_POLLING) { |
| 497 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 496 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 498 | 497 | val1 &= ~BNX2_EMAC_MDIO_MODE_AUTO_POLL; |
| 499 | 498 | |
| 500 | − REG_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 501 | − REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 499 | + BNX2_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 500 | + BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 502 | 501 | |
| 503 | 502 | udelay(40); |
| 504 | 503 | } |
| @@ -506,16 +505,16 @@ bnx2_read_phy(struct bnx2 *bp, u32 reg, u32 *val) · 1 unmodified line | ||
| 506 | 505 | val1 = (bp->phy_addr << 21) | (reg << 16) | |
| 507 | 506 | BNX2_EMAC_MDIO_COMM_COMMAND_READ | BNX2_EMAC_MDIO_COMM_DISEXT | |
| 508 | 507 | BNX2_EMAC_MDIO_COMM_START_BUSY; |
| 509 | − REG_WR(bp, BNX2_EMAC_MDIO_COMM, val1); | |
| 508 | + BNX2_WR(bp, BNX2_EMAC_MDIO_COMM, val1); | |
| 510 | 509 | |
| 511 | 510 | for (i = 0; i < 50; i++) { |
| 512 | 511 | udelay(10); |
| 513 | 512 | |
| 514 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_COMM); | |
| 513 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_COMM); | |
| 515 | 514 | if (!(val1 & BNX2_EMAC_MDIO_COMM_START_BUSY)) { |
| 516 | 515 | udelay(5); |
| 517 | 516 | |
| 518 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_COMM); | |
| 517 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_COMM); | |
| 519 | 518 | val1 &= BNX2_EMAC_MDIO_COMM_DATA; |
| 520 | 519 | |
| 521 | 520 | break; |
| @@ -532,11 +531,11 @@ bnx2_read_phy(struct bnx2 *bp, u32 reg, u32 *val) · 10 unmodified lines | ||
| 532 | 531 | } |
| 533 | 532 | |
| 534 | 533 | if (bp->phy_flags & BNX2_PHY_FLAG_INT_MODE_AUTO_POLLING) { |
| 535 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 534 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 536 | 535 | val1 |= BNX2_EMAC_MDIO_MODE_AUTO_POLL; |
| 537 | 536 | |
| 538 | − REG_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 539 | − REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 537 | + BNX2_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 538 | + BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 540 | 539 | |
| 541 | 540 | udelay(40); |
| 542 | 541 | } |
| @@ -551,11 +550,11 @@ bnx2_write_phy(struct bnx2 *bp, u32 reg, u32 val) · 8 unmodified lines | ||
| 551 | 550 | int i, ret; |
| 552 | 551 | |
| 553 | 552 | if (bp->phy_flags & BNX2_PHY_FLAG_INT_MODE_AUTO_POLLING) { |
| 554 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 553 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 555 | 554 | val1 &= ~BNX2_EMAC_MDIO_MODE_AUTO_POLL; |
| 556 | 555 | |
| 557 | − REG_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 558 | − REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 556 | + BNX2_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 557 | + BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 559 | 558 | |
| 560 | 559 | udelay(40); |
| 561 | 560 | } |
| @@ -563,12 +562,12 @@ bnx2_write_phy(struct bnx2 *bp, u32 reg, u32 val) · 1 unmodified line | ||
| 563 | 562 | val1 = (bp->phy_addr << 21) | (reg << 16) | val | |
| 564 | 563 | BNX2_EMAC_MDIO_COMM_COMMAND_WRITE | |
| 565 | 564 | BNX2_EMAC_MDIO_COMM_START_BUSY | BNX2_EMAC_MDIO_COMM_DISEXT; |
| 566 | − REG_WR(bp, BNX2_EMAC_MDIO_COMM, val1); | |
| 565 | + BNX2_WR(bp, BNX2_EMAC_MDIO_COMM, val1); | |
| 567 | 566 | |
| 568 | 567 | for (i = 0; i < 50; i++) { |
| 569 | 568 | udelay(10); |
| 570 | 569 | |
| 571 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_COMM); | |
| 570 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_COMM); | |
| 572 | 571 | if (!(val1 & BNX2_EMAC_MDIO_COMM_START_BUSY)) { |
| 573 | 572 | udelay(5); |
| 574 | 573 | break; |
| @@ -581,11 +580,11 @@ bnx2_write_phy(struct bnx2 *bp, u32 reg, u32 val) · 6 unmodified lines | ||
| 581 | 580 | ret = 0; |
| 582 | 581 | |
| 583 | 582 | if (bp->phy_flags & BNX2_PHY_FLAG_INT_MODE_AUTO_POLLING) { |
| 584 | − val1 = REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 583 | + val1 = BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 585 | 584 | val1 |= BNX2_EMAC_MDIO_MODE_AUTO_POLL; |
| 586 | 585 | |
| 587 | − REG_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 588 | − REG_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 586 | + BNX2_WR(bp, BNX2_EMAC_MDIO_MODE, val1); | |
| 587 | + BNX2_RD(bp, BNX2_EMAC_MDIO_MODE); | |
| 589 | 588 | |
| 590 | 589 | udelay(40); |
| 591 | 590 | } |
| @@ -601,10 +600,10 @@ bnx2_disable_int(struct bnx2 *bp) · 9 unmodified lines | ||
| 601 | 600 | |
| 602 | 601 | for (i = 0; i < bp->irq_nvecs; i++) { |
| 603 | 602 | bnapi = &bp->bnx2_napi[i]; |
| 604 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 603 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 605 | 604 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
| 606 | 605 | } |
| 607 | − REG_RD(bp, BNX2_PCICFG_INT_ACK_CMD); | |
| 606 | + BNX2_RD(bp, BNX2_PCICFG_INT_ACK_CMD); | |
| 608 | 607 | } |
| 609 | 608 | |
| 610 | 609 | static void |
| @@ -616,16 +615,16 @@ bnx2_enable_int(struct bnx2 *bp) · 5 unmodified lines | ||
| 616 | 615 | for (i = 0; i < bp->irq_nvecs; i++) { |
| 617 | 616 | bnapi = &bp->bnx2_napi[i]; |
| 618 | 617 | |
| 619 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 620 | − BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 621 | − BNX2_PCICFG_INT_ACK_CMD_MASK_INT | | |
| 622 | − bnapi->last_status_idx); | |
| 618 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 619 | + BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 620 | + BNX2_PCICFG_INT_ACK_CMD_MASK_INT | | |
| 621 | + bnapi->last_status_idx); | |
| 623 | 622 | |
| 624 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 625 | − BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 626 | − bnapi->last_status_idx); | |
| 623 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 624 | + BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 625 | + bnapi->last_status_idx); | |
| 627 | 626 | } |
| 628 | − REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW); | |
| 627 | + BNX2_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW); | |
| 629 | 628 | } |
| 630 | 629 | |
| 631 | 630 | static void |
| @@ -824,7 +823,7 @@ bnx2_free_mem(struct bnx2 *bp) · 192 unmodified lines | ||
| 824 | 823 | |
| 825 | 824 | for (i = 0; i < bp->ctx_pages; i++) { |
| 826 | 825 | if (bp->ctx_blk[i]) { |
| 827 | − dma_free_coherent(&bp->pdev->dev, BCM_PAGE_SIZE, | |
| 826 | + dma_free_coherent(&bp->pdev->dev, BNX2_PAGE_SIZE, | |
| 828 | 827 | bp->ctx_blk[i], |
| 829 | 828 | bp->ctx_blk_mapping[i]); |
| 830 | 829 | bp->ctx_blk[i] = NULL; |
| @@ -887,13 +886,13 @@ bnx2_alloc_mem(struct bnx2 *bp) · 56 unmodified lines | ||
| 887 | 886 | |
| 888 | 887 | bp->stats_blk_mapping = bp->status_blk_mapping + status_blk_size; |
| 889 | 888 | |
| 890 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 891 | − bp->ctx_pages = 0x2000 / BCM_PAGE_SIZE; | |
| 889 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 890 | + bp->ctx_pages = 0x2000 / BNX2_PAGE_SIZE; | |
| 892 | 891 | if (bp->ctx_pages == 0) |
| 893 | 892 | bp->ctx_pages = 1; |
| 894 | 893 | for (i = 0; i < bp->ctx_pages; i++) { |
| 895 | 894 | bp->ctx_blk[i] = dma_alloc_coherent(&bp->pdev->dev, |
| 896 | − BCM_PAGE_SIZE, | |
| 895 | + BNX2_PAGE_SIZE, | |
| 897 | 896 | &bp->ctx_blk_mapping[i], |
| 898 | 897 | GFP_KERNEL); |
| 899 | 898 | if (bp->ctx_blk[i] == NULL) |
| @@ -1034,7 +1033,7 @@ bnx2_resolve_flow_ctrl(struct bnx2 *bp) · 134 unmodified lines | ||
| 1034 | 1033 | } |
| 1035 | 1034 | |
| 1036 | 1035 | if ((bp->phy_flags & BNX2_PHY_FLAG_SERDES) && |
| 1037 | − (CHIP_NUM(bp) == CHIP_NUM_5708)) { | |
| 1036 | + (BNX2_CHIP(bp) == BNX2_CHIP_5708)) { | |
| 1038 | 1037 | u32 val; |
| 1039 | 1038 | |
| 1040 | 1039 | bnx2_read_phy(bp, BCM5708S_1000X_STAT1, &val); |
| @@ -1294,14 +1293,14 @@ bnx2_set_mac_link(struct bnx2 *bp) · 253 unmodified lines | ||
| 1294 | 1293 | { |
| 1295 | 1294 | u32 val; |
| 1296 | 1295 | |
| 1297 | − REG_WR(bp, BNX2_EMAC_TX_LENGTHS, 0x2620); | |
| 1296 | + BNX2_WR(bp, BNX2_EMAC_TX_LENGTHS, 0x2620); | |
| 1298 | 1297 | if (bp->link_up && (bp->line_speed == SPEED_1000) && |
| 1299 | 1298 | (bp->duplex == DUPLEX_HALF)) { |
| 1300 | − REG_WR(bp, BNX2_EMAC_TX_LENGTHS, 0x26ff); | |
| 1299 | + BNX2_WR(bp, BNX2_EMAC_TX_LENGTHS, 0x26ff); | |
| 1301 | 1300 | } |
| 1302 | 1301 | |
| 1303 | 1302 | /* Configure the EMAC mode register. */ |
| 1304 | − val = REG_RD(bp, BNX2_EMAC_MODE); | |
| 1303 | + val = BNX2_RD(bp, BNX2_EMAC_MODE); | |
| 1305 | 1304 | |
| 1306 | 1305 | val &= ~(BNX2_EMAC_MODE_PORT | BNX2_EMAC_MODE_HALF_DUPLEX | |
| 1307 | 1306 | BNX2_EMAC_MODE_MAC_LOOP | BNX2_EMAC_MODE_FORCE_LINK | |
| @@ -1310,7 +1309,7 @@ bnx2_set_mac_link(struct bnx2 *bp) · 2 unmodified lines | ||
| 1310 | 1309 | if (bp->link_up) { |
| 1311 | 1310 | switch (bp->line_speed) { |
| 1312 | 1311 | case SPEED_10: |
| 1313 | − if (CHIP_NUM(bp) != CHIP_NUM_5706) { | |
| 1312 | + if (BNX2_CHIP(bp) != BNX2_CHIP_5706) { | |
| 1314 | 1313 | val |= BNX2_EMAC_MODE_PORT_MII_10M; |
| 1315 | 1314 | break; |
| 1316 | 1315 | } |
| @@ -1333,25 +1332,25 @@ bnx2_set_mac_link(struct bnx2 *bp) · 16 unmodified lines | ||
| 1333 | 1332 | /* Set the MAC to operate in the appropriate duplex mode. */ |
| 1334 | 1333 | if (bp->duplex == DUPLEX_HALF) |
| 1335 | 1334 | val |= BNX2_EMAC_MODE_HALF_DUPLEX; |
| 1336 | − REG_WR(bp, BNX2_EMAC_MODE, val); | |
| 1335 | + BNX2_WR(bp, BNX2_EMAC_MODE, val); | |
| 1337 | 1336 | |
| 1338 | 1337 | /* Enable/disable rx PAUSE. */ |
| 1339 | 1338 | bp->rx_mode &= ~BNX2_EMAC_RX_MODE_FLOW_EN; |
| 1340 | 1339 | |
| 1341 | 1340 | if (bp->flow_ctrl & FLOW_CTRL_RX) |
| 1342 | 1341 | bp->rx_mode |= BNX2_EMAC_RX_MODE_FLOW_EN; |
| 1343 | − REG_WR(bp, BNX2_EMAC_RX_MODE, bp->rx_mode); | |
| 1342 | + BNX2_WR(bp, BNX2_EMAC_RX_MODE, bp->rx_mode); | |
| 1344 | 1343 | |
| 1345 | 1344 | /* Enable/disable tx PAUSE. */ |
| 1346 | − val = REG_RD(bp, BNX2_EMAC_TX_MODE); | |
| 1345 | + val = BNX2_RD(bp, BNX2_EMAC_TX_MODE); | |
| 1347 | 1346 | val &= ~BNX2_EMAC_TX_MODE_FLOW_EN; |
| 1348 | 1347 | |
| 1349 | 1348 | if (bp->flow_ctrl & FLOW_CTRL_TX) |
| 1350 | 1349 | val |= BNX2_EMAC_TX_MODE_FLOW_EN; |
| 1351 | − REG_WR(bp, BNX2_EMAC_TX_MODE, val); | |
| 1350 | + BNX2_WR(bp, BNX2_EMAC_TX_MODE, val); | |
| 1352 | 1351 | |
| 1353 | 1352 | /* Acknowledge the interrupt. */ |
| 1354 | − REG_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE); | |
| 1353 | + BNX2_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE); | |
| 1355 | 1354 | |
| 1356 | 1355 | bnx2_init_all_rx_contexts(bp); |
| 1357 | 1356 | } |
| @@ -1360,7 +1359,7 @@ static void · 2 unmodified lines | ||
| 1360 | 1359 | bnx2_enable_bmsr1(struct bnx2 *bp) |
| 1361 | 1360 | { |
| 1362 | 1361 | if ((bp->phy_flags & BNX2_PHY_FLAG_SERDES) && |
| 1363 | − (CHIP_NUM(bp) == CHIP_NUM_5709)) | |
| 1362 | + (BNX2_CHIP(bp) == BNX2_CHIP_5709)) | |
| 1364 | 1363 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, |
| 1365 | 1364 | MII_BNX2_BLK_ADDR_GP_STATUS); |
| 1366 | 1365 | } |
| @@ -1369,7 +1368,7 @@ static void · 2 unmodified lines | ||
| 1369 | 1368 | bnx2_disable_bmsr1(struct bnx2 *bp) |
| 1370 | 1369 | { |
| 1371 | 1370 | if ((bp->phy_flags & BNX2_PHY_FLAG_SERDES) && |
| 1372 | − (CHIP_NUM(bp) == CHIP_NUM_5709)) | |
| 1371 | + (BNX2_CHIP(bp) == BNX2_CHIP_5709)) | |
| 1373 | 1372 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, |
| 1374 | 1373 | MII_BNX2_BLK_ADDR_COMBO_IEEEB0); |
| 1375 | 1374 | } |
| @@ -1386,7 +1385,7 @@ bnx2_test_and_enable_2g5(struct bnx2 *bp) · 10 unmodified lines | ||
| 1386 | 1385 | if (bp->autoneg & AUTONEG_SPEED) |
| 1387 | 1386 | bp->advertising |= ADVERTISED_2500baseX_Full; |
| 1388 | 1387 | |
| 1389 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 1388 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 1390 | 1389 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G); |
| 1391 | 1390 | |
| 1392 | 1391 | bnx2_read_phy(bp, bp->mii_up1, &up1); |
| @@ -1396,7 +1395,7 @@ bnx2_test_and_enable_2g5(struct bnx2 *bp) · 3 unmodified lines | ||
| 1396 | 1395 | ret = 0; |
| 1397 | 1396 | } |
| 1398 | 1397 | |
| 1399 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 1398 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 1400 | 1399 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, |
| 1401 | 1400 | MII_BNX2_BLK_ADDR_COMBO_IEEEB0); |
| 1402 | 1401 | |
| @@ -1412,7 +1411,7 @@ bnx2_test_and_disable_2g5(struct bnx2 *bp) · 9 unmodified lines | ||
| 1412 | 1411 | if (!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE)) |
| 1413 | 1412 | return 0; |
| 1414 | 1413 | |
| 1415 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 1414 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 1416 | 1415 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G); |
| 1417 | 1416 | |
| 1418 | 1417 | bnx2_read_phy(bp, bp->mii_up1, &up1); |
| @@ -1422,7 +1421,7 @@ bnx2_test_and_disable_2g5(struct bnx2 *bp) · 3 unmodified lines | ||
| 1422 | 1421 | ret = 1; |
| 1423 | 1422 | } |
| 1424 | 1423 | |
| 1425 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 1424 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 1426 | 1425 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, |
| 1427 | 1426 | MII_BNX2_BLK_ADDR_COMBO_IEEEB0); |
| 1428 | 1427 | |
| @@ -1438,7 +1437,7 @@ bnx2_enable_forced_2g5(struct bnx2 *bp) · 9 unmodified lines | ||
| 1438 | 1437 | if (!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE)) |
| 1439 | 1438 | return; |
| 1440 | 1439 | |
| 1441 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 1440 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 1442 | 1441 | u32 val; |
| 1443 | 1442 | |
| 1444 | 1443 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, |
| @@ -1454,7 +1453,7 @@ bnx2_enable_forced_2g5(struct bnx2 *bp) · 9 unmodified lines | ||
| 1454 | 1453 | MII_BNX2_BLK_ADDR_COMBO_IEEEB0); |
| 1455 | 1454 | err = bnx2_read_phy(bp, bp->mii_bmcr, &bmcr); |
| 1456 | 1455 | |
| 1457 | − } else if (CHIP_NUM(bp) == CHIP_NUM_5708) { | |
| 1456 | + } else if (BNX2_CHIP(bp) == BNX2_CHIP_5708) { | |
| 1458 | 1457 | err = bnx2_read_phy(bp, bp->mii_bmcr, &bmcr); |
| 1459 | 1458 | if (!err) |
| 1460 | 1459 | bmcr |= BCM5708S_BMCR_FORCE_2500; |
| @@ -1482,7 +1481,7 @@ bnx2_disable_forced_2g5(struct bnx2 *bp) · 21 unmodified lines | ||
| 1482 | 1481 | if (!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE)) |
| 1483 | 1482 | return; |
| 1484 | 1483 | |
| 1485 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 1484 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 1486 | 1485 | u32 val; |
| 1487 | 1486 | |
| 1488 | 1487 | bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, |
| @@ -1496,7 +1495,7 @@ bnx2_disable_forced_2g5(struct bnx2 *bp) · 7 unmodified lines | ||
| 1496 | 1495 | MII_BNX2_BLK_ADDR_COMBO_IEEEB0); |
| 1497 | 1496 | err = bnx2_read_phy(bp, bp->mii_bmcr, &bmcr); |
| 1498 | 1497 | |
| 1499 | − } else if (CHIP_NUM(bp) == CHIP_NUM_5708) { | |
| 1498 | + } else if (BNX2_CHIP(bp) == BNX2_CHIP_5708) { | |
| 1500 | 1499 | err = bnx2_read_phy(bp, bp->mii_bmcr, &bmcr); |
| 1501 | 1500 | if (!err) |
| 1502 | 1501 | bmcr &= ~BCM5708S_BMCR_FORCE_2500; |
| @@ -1547,14 +1546,14 @@ bnx2_set_link(struct bnx2 *bp) · 44 unmodified lines | ||
| 1547 | 1546 | bnx2_disable_bmsr1(bp); |
| 1548 | 1547 | |
| 1549 | 1548 | if ((bp->phy_flags & BNX2_PHY_FLAG_SERDES) && |
| 1550 | − (CHIP_NUM(bp) == CHIP_NUM_5706)) { | |
| 1549 | + (BNX2_CHIP(bp) == BNX2_CHIP_5706)) { | |
| 1551 | 1550 | u32 val, an_dbg; |
| 1552 | 1551 | |
| 1553 | 1552 | if (bp->phy_flags & BNX2_PHY_FLAG_FORCED_DOWN) { |
| 1554 | 1553 | bnx2_5706s_force_link_dn(bp, 0); |
| 1555 | 1554 | bp->phy_flags &= ~BNX2_PHY_FLAG_FORCED_DOWN; |
| 1556 | 1555 | } |
| 1557 | − val = REG_RD(bp, BNX2_EMAC_STATUS); | |
| 1556 | + val = BNX2_RD(bp, BNX2_EMAC_STATUS); | |
| 1558 | 1557 | |
| 1559 | 1558 | bnx2_write_phy(bp, MII_BNX2_MISC_SHADOW, MISC_SHDW_AN_DBG); |
| 1560 | 1559 | bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg); |
| @@ -1571,11 +1570,11 @@ bnx2_set_link(struct bnx2 *bp) · 10 unmodified lines | ||
| 1571 | 1570 | bp->link_up = 1; |
| 1572 | 1571 | |
| 1573 | 1572 | if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { |
| 1574 | − if (CHIP_NUM(bp) == CHIP_NUM_5706) | |
| 1573 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5706) | |
| 1575 | 1574 | bnx2_5706s_linkup(bp); |
| 1576 | − else if (CHIP_NUM(bp) == CHIP_NUM_5708) | |
| 1575 | + else if (BNX2_CHIP(bp) == BNX2_CHIP_5708) | |
| 1577 | 1576 | bnx2_5708s_linkup(bp); |
| 1578 | − else if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 1577 | + else if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 1579 | 1578 | bnx2_5709s_linkup(bp); |
| 1580 | 1579 | } |
| 1581 | 1580 | else { |
| @@ -1757,7 +1756,7 @@ __acquires(&bp->phy_lock) · 175 unmodified lines | ||
| 1757 | 1756 | new_bmcr = bmcr & ~BMCR_ANENABLE; |
| 1758 | 1757 | new_bmcr |= BMCR_SPEED1000; |
| 1759 | 1758 | |
| 1760 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 1759 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 1761 | 1760 | if (bp->req_line_speed == SPEED_2500) |
| 1762 | 1761 | bnx2_enable_forced_2g5(bp); |
| 1763 | 1762 | else if (bp->req_line_speed == SPEED_1000) { |
| @@ -1765,7 +1764,7 @@ __acquires(&bp->phy_lock) · 1 unmodified line | ||
| 1765 | 1764 | new_bmcr &= ~0x2000; |
| 1766 | 1765 | } |
| 1767 | 1766 | |
| 1768 | − } else if (CHIP_NUM(bp) == CHIP_NUM_5708) { | |
| 1767 | + } else if (BNX2_CHIP(bp) == BNX2_CHIP_5708) { | |
| 1769 | 1768 | if (bp->req_line_speed == SPEED_2500) |
| 1770 | 1769 | new_bmcr |= BCM5708S_BMCR_FORCE_2500; |
| 1771 | 1770 | else |
| @@ -1942,8 +1941,8 @@ bnx2_send_heart_beat(struct bnx2 *bp) · 170 unmodified lines | ||
| 1942 | 1941 | spin_lock(&bp->indirect_lock); |
| 1943 | 1942 | msg = (u32) (++bp->fw_drv_pulse_wr_seq & BNX2_DRV_PULSE_SEQ_MASK); |
| 1944 | 1943 | addr = bp->shmem_base + BNX2_DRV_PULSE_MB; |
| 1945 | − REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, addr); | |
| 1946 | − REG_WR(bp, BNX2_PCICFG_REG_WINDOW, msg); | |
| 1944 | + BNX2_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, addr); | |
| 1945 | + BNX2_WR(bp, BNX2_PCICFG_REG_WINDOW, msg); | |
| 1947 | 1946 | spin_unlock(&bp->indirect_lock); |
| 1948 | 1947 | } |
| 1949 | 1948 | |
| @@ -2230,9 +2229,9 @@ bnx2_init_5708s_phy(struct bnx2 *bp, int reset_phy) · 280 unmodified lines | ||
| 2230 | 2229 | bnx2_write_phy(bp, BCM5708S_UP1, val); |
| 2231 | 2230 | } |
| 2232 | 2231 | |
| 2233 | − if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || | |
| 2234 | − (CHIP_ID(bp) == CHIP_ID_5708_B0) || | |
| 2235 | − (CHIP_ID(bp) == CHIP_ID_5708_B1)) { | |
| 2232 | + if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0) || | |
| 2233 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B0) || | |
| 2234 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B1)) { | |
| 2236 | 2235 | /* increase tx signal amplitude */ |
| 2237 | 2236 | bnx2_write_phy(bp, BCM5708S_BLK_ADDR, |
| 2238 | 2237 | BCM5708S_BLK_ADDR_TX_MISC); |
| @@ -2268,8 +2267,8 @@ bnx2_init_5706s_phy(struct bnx2 *bp, int reset_phy) · 29 unmodified lines | ||
| 2268 | 2267 | |
| 2269 | 2268 | bp->phy_flags &= ~BNX2_PHY_FLAG_PARALLEL_DETECT; |
| 2270 | 2269 | |
| 2271 | − if (CHIP_NUM(bp) == CHIP_NUM_5706) | |
| 2272 | − REG_WR(bp, BNX2_MISC_GP_HW_CTL0, 0x300); | |
| 2270 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5706) | |
| 2271 | + BNX2_WR(bp, BNX2_MISC_GP_HW_CTL0, 0x300); | |
| 2273 | 2272 | |
| 2274 | 2273 | if (bp->dev->mtu > 1500) { |
| 2275 | 2274 | u32 val; |
| @@ -2368,7 +2367,7 @@ __acquires(&bp->phy_lock) · 92 unmodified lines | ||
| 2368 | 2367 | bp->mii_adv = MII_ADVERTISE; |
| 2369 | 2368 | bp->mii_lpa = MII_LPA; |
| 2370 | 2369 | |
| 2371 | − REG_WR(bp, BNX2_EMAC_ATTENTION_ENA, BNX2_EMAC_ATTENTION_ENA_LINK); | |
| 2370 | + BNX2_WR(bp, BNX2_EMAC_ATTENTION_ENA, BNX2_EMAC_ATTENTION_ENA_LINK); | |
| 2372 | 2371 | |
| 2373 | 2372 | if (bp->phy_flags & BNX2_PHY_FLAG_REMOTE_PHY_CAP) |
| 2374 | 2373 | goto setup_phy; |
| @@ -2379,11 +2378,11 @@ __acquires(&bp->phy_lock) · 4 unmodified lines | ||
| 2379 | 2378 | bp->phy_id |= val & 0xffff; |
| 2380 | 2379 | |
| 2381 | 2380 | if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { |
| 2382 | − if (CHIP_NUM(bp) == CHIP_NUM_5706) | |
| 2381 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5706) | |
| 2383 | 2382 | rc = bnx2_init_5706s_phy(bp, reset_phy); |
| 2384 | − else if (CHIP_NUM(bp) == CHIP_NUM_5708) | |
| 2383 | + else if (BNX2_CHIP(bp) == BNX2_CHIP_5708) | |
| 2385 | 2384 | rc = bnx2_init_5708s_phy(bp, reset_phy); |
| 2386 | − else if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 2385 | + else if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 2387 | 2386 | rc = bnx2_init_5709s_phy(bp, reset_phy); |
| 2388 | 2387 | } |
| 2389 | 2388 | else { |
| @@ -2402,10 +2401,10 @@ bnx2_set_mac_loopback(struct bnx2 *bp) · 12 unmodified lines | ||
| 2402 | 2401 | { |
| 2403 | 2402 | u32 mac_mode; |
| 2404 | 2403 | |
| 2405 | − mac_mode = REG_RD(bp, BNX2_EMAC_MODE); | |
| 2404 | + mac_mode = BNX2_RD(bp, BNX2_EMAC_MODE); | |
| 2406 | 2405 | mac_mode &= ~BNX2_EMAC_MODE_PORT; |
| 2407 | 2406 | mac_mode |= BNX2_EMAC_MODE_MAC_LOOP | BNX2_EMAC_MODE_FORCE_LINK; |
| 2408 | − REG_WR(bp, BNX2_EMAC_MODE, mac_mode); | |
| 2407 | + BNX2_WR(bp, BNX2_EMAC_MODE, mac_mode); | |
| 2409 | 2408 | bp->link_up = 1; |
| 2410 | 2409 | return 0; |
| 2411 | 2410 | } |
| @@ -2431,13 +2430,13 @@ bnx2_set_phy_loopback(struct bnx2 *bp) · 19 unmodified lines | ||
| 2431 | 2430 | msleep(100); |
| 2432 | 2431 | } |
| 2433 | 2432 | |
| 2434 | − mac_mode = REG_RD(bp, BNX2_EMAC_MODE); | |
| 2433 | + mac_mode = BNX2_RD(bp, BNX2_EMAC_MODE); | |
| 2435 | 2434 | mac_mode &= ~(BNX2_EMAC_MODE_PORT | BNX2_EMAC_MODE_HALF_DUPLEX | |
| 2436 | 2435 | BNX2_EMAC_MODE_MAC_LOOP | BNX2_EMAC_MODE_FORCE_LINK | |
| 2437 | 2436 | BNX2_EMAC_MODE_25G_MODE); |
| 2438 | 2437 | |
| 2439 | 2438 | mac_mode |= BNX2_EMAC_MODE_PORT_GMII; |
| 2440 | − REG_WR(bp, BNX2_EMAC_MODE, mac_mode); | |
| 2439 | + BNX2_WR(bp, BNX2_EMAC_MODE, mac_mode); | |
| 2441 | 2440 | bp->link_up = 1; |
| 2442 | 2441 | return 0; |
| 2443 | 2442 | } |
| @@ -2449,7 +2448,7 @@ bnx2_dump_mcp_state(struct bnx2 *bp) · 5 unmodified lines | ||
| 2449 | 2448 | u32 mcp_p0, mcp_p1; |
| 2450 | 2449 | |
| 2451 | 2450 | netdev_err(dev, "<--- start MCP states dump --->\n"); |
| 2452 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 2451 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 2453 | 2452 | mcp_p0 = BNX2_MCP_STATE_P0; |
| 2454 | 2453 | mcp_p1 = BNX2_MCP_STATE_P1; |
| 2455 | 2454 | } else { |
| @@ -2538,10 +2537,10 @@ bnx2_init_5709_context(struct bnx2 *bp) · 82 unmodified lines | ||
| 2538 | 2537 | u32 val; |
| 2539 | 2538 | |
| 2540 | 2539 | val = BNX2_CTX_COMMAND_ENABLED | BNX2_CTX_COMMAND_MEM_INIT | (1 << 12); |
| 2541 | − val |= (BCM_PAGE_BITS - 8) << 16; | |
| 2542 | − REG_WR(bp, BNX2_CTX_COMMAND, val); | |
| 2540 | + val |= (BNX2_PAGE_BITS - 8) << 16; | |
| 2541 | + BNX2_WR(bp, BNX2_CTX_COMMAND, val); | |
| 2543 | 2542 | for (i = 0; i < 10; i++) { |
| 2544 | − val = REG_RD(bp, BNX2_CTX_COMMAND); | |
| 2543 | + val = BNX2_RD(bp, BNX2_CTX_COMMAND); | |
| 2545 | 2544 | if (!(val & BNX2_CTX_COMMAND_MEM_INIT)) |
| 2546 | 2545 | break; |
| 2547 | 2546 | udelay(2); |
| @@ -2553,20 +2552,20 @@ bnx2_init_5709_context(struct bnx2 *bp) · 5 unmodified lines | ||
| 2553 | 2552 | int j; |
| 2554 | 2553 | |
| 2555 | 2554 | if (bp->ctx_blk[i]) |
| 2556 | − memset(bp->ctx_blk[i], 0, BCM_PAGE_SIZE); | |
| 2555 | + memset(bp->ctx_blk[i], 0, BNX2_PAGE_SIZE); | |
| 2557 | 2556 | else |
| 2558 | 2557 | return -ENOMEM; |
| 2559 | 2558 | |
| 2560 | − REG_WR(bp, BNX2_CTX_HOST_PAGE_TBL_DATA0, | |
| 2561 | − (bp->ctx_blk_mapping[i] & 0xffffffff) | | |
| 2562 | − BNX2_CTX_HOST_PAGE_TBL_DATA0_VALID); | |
| 2563 | − REG_WR(bp, BNX2_CTX_HOST_PAGE_TBL_DATA1, | |
| 2564 | − (u64) bp->ctx_blk_mapping[i] >> 32); | |
| 2565 | − REG_WR(bp, BNX2_CTX_HOST_PAGE_TBL_CTRL, i | | |
| 2566 | − BNX2_CTX_HOST_PAGE_TBL_CTRL_WRITE_REQ); | |
| 2559 | + BNX2_WR(bp, BNX2_CTX_HOST_PAGE_TBL_DATA0, | |
| 2560 | + (bp->ctx_blk_mapping[i] & 0xffffffff) | | |
| 2561 | + BNX2_CTX_HOST_PAGE_TBL_DATA0_VALID); | |
| 2562 | + BNX2_WR(bp, BNX2_CTX_HOST_PAGE_TBL_DATA1, | |
| 2563 | + (u64) bp->ctx_blk_mapping[i] >> 32); | |
| 2564 | + BNX2_WR(bp, BNX2_CTX_HOST_PAGE_TBL_CTRL, i | | |
| 2565 | + BNX2_CTX_HOST_PAGE_TBL_CTRL_WRITE_REQ); | |
| 2567 | 2566 | for (j = 0; j < 10; j++) { |
| 2568 | 2567 | |
| 2569 | − val = REG_RD(bp, BNX2_CTX_HOST_PAGE_TBL_CTRL); | |
| 2568 | + val = BNX2_RD(bp, BNX2_CTX_HOST_PAGE_TBL_CTRL); | |
| 2570 | 2569 | if (!(val & BNX2_CTX_HOST_PAGE_TBL_CTRL_WRITE_REQ)) |
| 2571 | 2570 | break; |
| 2572 | 2571 | udelay(5); |
| @@ -2591,7 +2590,7 @@ bnx2_init_context(struct bnx2 *bp) · 18 unmodified lines | ||
| 2591 | 2590 | |
| 2592 | 2591 | vcid--; |
| 2593 | 2592 | |
| 2594 | − if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | |
| 2593 | + if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { | |
| 2595 | 2594 | u32 new_vcid; |
| 2596 | 2595 | |
| 2597 | 2596 | vcid_addr = GET_PCID_ADDR(vcid); |
| @@ -2612,8 +2611,8 @@ bnx2_init_context(struct bnx2 *bp) · 14 unmodified lines | ||
| 2612 | 2611 | vcid_addr += (i << PHY_CTX_SHIFT); |
| 2613 | 2612 | pcid_addr += (i << PHY_CTX_SHIFT); |
| 2614 | 2613 | |
| 2615 | − REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr); | |
| 2616 | − REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); | |
| 2614 | + BNX2_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr); | |
| 2615 | + BNX2_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); | |
| 2617 | 2616 | |
| 2618 | 2617 | /* Zero out the context. */ |
| 2619 | 2618 | for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) |
| @@ -2633,7 +2632,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp) · 13 unmodified lines | ||
| 2633 | 2632 | if (good_mbuf == NULL) |
| 2634 | 2633 | return -ENOMEM; |
| 2635 | 2634 | |
| 2636 | − REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, | |
| 2635 | + BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS, | |
| 2637 | 2636 | BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE); |
| 2638 | 2637 | |
| 2639 | 2638 | good_mbuf_cnt = 0; |
| @@ -2678,21 +2677,21 @@ bnx2_set_mac_addr(struct bnx2 *bp, u8 *mac_addr, u32 pos) · 38 unmodified lines | ||
| 2678 | 2677 | |
| 2679 | 2678 | val = (mac_addr[0] << 8) | mac_addr[1]; |
| 2680 | 2679 | |
| 2681 | − REG_WR(bp, BNX2_EMAC_MAC_MATCH0 + (pos * 8), val); | |
| 2680 | + BNX2_WR(bp, BNX2_EMAC_MAC_MATCH0 + (pos * 8), val); | |
| 2682 | 2681 | |
| 2683 | 2682 | val = (mac_addr[2] << 24) | (mac_addr[3] << 16) | |
| 2684 | 2683 | (mac_addr[4] << 8) | mac_addr[5]; |
| 2685 | 2684 | |
| 2686 | − REG_WR(bp, BNX2_EMAC_MAC_MATCH1 + (pos * 8), val); | |
| 2685 | + BNX2_WR(bp, BNX2_EMAC_MAC_MATCH1 + (pos * 8), val); | |
| 2687 | 2686 | } |
| 2688 | 2687 | |
| 2689 | 2688 | static inline int |
| 2690 | 2689 | bnx2_alloc_rx_page(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index, gfp_t gfp) |
| 2691 | 2690 | { |
| 2692 | 2691 | dma_addr_t mapping; |
| 2693 | − struct sw_pg *rx_pg = &rxr->rx_pg_ring[index]; | |
| 2694 | − struct rx_bd *rxbd = | |
| 2695 | − &rxr->rx_pg_desc_ring[RX_RING(index)][RX_IDX(index)]; | |
| 2692 | + struct bnx2_sw_pg *rx_pg = &rxr->rx_pg_ring[index]; | |
| 2693 | + struct bnx2_rx_bd *rxbd = | |
| 2694 | + &rxr->rx_pg_desc_ring[BNX2_RX_RING(index)][BNX2_RX_IDX(index)]; | |
| 2696 | 2695 | struct page *page = alloc_page(gfp); |
| 2697 | 2696 | |
| 2698 | 2697 | if (!page) |
| @@ -2714,7 +2713,7 @@ bnx2_alloc_rx_page(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index, gf · 15 unmodified lines | ||
| 2714 | 2713 | static void |
| 2715 | 2714 | bnx2_free_rx_page(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index) |
| 2716 | 2715 | { |
| 2717 | − struct sw_pg *rx_pg = &rxr->rx_pg_ring[index]; | |
| 2716 | + struct bnx2_sw_pg *rx_pg = &rxr->rx_pg_ring[index]; | |
| 2718 | 2717 | struct page *page = rx_pg->page; |
| 2719 | 2718 | |
| 2720 | 2719 | if (!page) |
| @@ -2731,9 +2730,10 @@ static inline int · 10 unmodified lines | ||
| 2731 | 2730 | bnx2_alloc_rx_data(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index, gfp_t gfp) |
| 2732 | 2731 | { |
| 2733 | 2732 | u8 *data; |
| 2734 | − struct sw_bd *rx_buf = &rxr->rx_buf_ring[index]; | |
| 2733 | + struct bnx2_sw_bd *rx_buf = &rxr->rx_buf_ring[index]; | |
| 2735 | 2734 | dma_addr_t mapping; |
| 2736 | − struct rx_bd *rxbd = &rxr->rx_desc_ring[RX_RING(index)][RX_IDX(index)]; | |
| 2735 | + struct bnx2_rx_bd *rxbd = | |
| 2736 | + &rxr->rx_desc_ring[BNX2_RX_RING(index)][BNX2_RX_IDX(index)]; | |
| 2737 | 2737 | |
| 2738 | 2738 | data = kmalloc(bp->rx_buf_size, gfp); |
| 2739 | 2739 | if (!data) |
| @@ -2770,9 +2770,9 @@ bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event) · 30 unmodified lines | ||
| 2770 | 2770 | old_link_state = sblk->status_attn_bits_ack & event; |
| 2771 | 2771 | if (new_link_state != old_link_state) { |
| 2772 | 2772 | if (new_link_state) |
| 2773 | − REG_WR(bp, BNX2_PCICFG_STATUS_BIT_SET_CMD, event); | |
| 2773 | + BNX2_WR(bp, BNX2_PCICFG_STATUS_BIT_SET_CMD, event); | |
| 2774 | 2774 | else |
| 2775 | − REG_WR(bp, BNX2_PCICFG_STATUS_BIT_CLEAR_CMD, event); | |
| 2775 | + BNX2_WR(bp, BNX2_PCICFG_STATUS_BIT_CLEAR_CMD, event); | |
| 2776 | 2776 | } else |
| 2777 | 2777 | is_set = 0; |
| 2778 | 2778 | |
| @@ -2802,7 +2802,7 @@ bnx2_get_hw_tx_cons(struct bnx2_napi *bnapi) · 23 unmodified lines | ||
| 2802 | 2802 | barrier(); |
| 2803 | 2803 | cons = *bnapi->hw_tx_cons_ptr; |
| 2804 | 2804 | barrier(); |
| 2805 | − if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT)) | |
| 2805 | + if (unlikely((cons & BNX2_MAX_TX_DESC_CNT) == BNX2_MAX_TX_DESC_CNT)) | |
| 2806 | 2806 | cons++; |
| 2807 | 2807 | return cons; |
| 2808 | 2808 | } |
| @@ -2823,11 +2823,11 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) · 14 unmodified lines | ||
| 2823 | 2823 | sw_cons = txr->tx_cons; |
| 2824 | 2824 | |
| 2825 | 2825 | while (sw_cons != hw_cons) { |
| 2826 | − struct sw_tx_bd *tx_buf; | |
| 2826 | + struct bnx2_sw_tx_bd *tx_buf; | |
| 2827 | 2827 | struct sk_buff *skb; |
| 2828 | 2828 | int i, last; |
| 2829 | 2829 | |
| 2830 | − sw_ring_cons = TX_RING_IDX(sw_cons); | |
| 2830 | + sw_ring_cons = BNX2_TX_RING_IDX(sw_cons); | |
| 2831 | 2831 | |
| 2832 | 2832 | tx_buf = &txr->tx_buf_ring[sw_ring_cons]; |
| 2833 | 2833 | skb = tx_buf->skb; |
| @@ -2841,7 +2841,7 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) · 7 unmodified lines | ||
| 2841 | 2841 | |
| 2842 | 2842 | last_idx = sw_cons + tx_buf->nr_frags + 1; |
| 2843 | 2843 | last_ring_idx = sw_ring_cons + tx_buf->nr_frags + 1; |
| 2844 | − if (unlikely(last_ring_idx >= MAX_TX_DESC_CNT)) { | |
| 2844 | + if (unlikely(last_ring_idx >= BNX2_MAX_TX_DESC_CNT)) { | |
| 2845 | 2845 | last_idx++; |
| 2846 | 2846 | } |
| 2847 | 2847 | if (((s16) ((s16) last_idx - (s16) hw_cons)) > 0) { |
| @@ -2856,17 +2856,18 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) · 8 unmodified lines | ||
| 2856 | 2856 | last = tx_buf->nr_frags; |
| 2857 | 2857 | |
| 2858 | 2858 | for (i = 0; i < last; i++) { |
| 2859 | − sw_cons = NEXT_TX_BD(sw_cons); | |
| 2859 | + struct bnx2_sw_tx_bd *tx_buf; | |
| 2860 | 2860 | |
| 2861 | + sw_cons = BNX2_NEXT_TX_BD(sw_cons); | |
| 2862 | + | |
| 2863 | + tx_buf = &txr->tx_buf_ring[BNX2_TX_RING_IDX(sw_cons)]; | |
| 2861 | 2864 | dma_unmap_page(&bp->pdev->dev, |
| 2862 | − dma_unmap_addr( | |
| 2863 | − &txr->tx_buf_ring[TX_RING_IDX(sw_cons)], | |
| 2864 | − mapping), | |
| 2865 | + dma_unmap_addr(tx_buf, mapping), | |
| 2865 | 2866 | skb_frag_size(&skb_shinfo(skb)->frags[i]), |
| 2866 | 2867 | PCI_DMA_TODEVICE); |
| 2867 | 2868 | } |
| 2868 | 2869 | |
| 2869 | − sw_cons = NEXT_TX_BD(sw_cons); | |
| 2870 | + sw_cons = BNX2_NEXT_TX_BD(sw_cons); | |
| 2870 | 2871 | |
| 2871 | 2872 | tx_bytes += skb->len; |
| 2872 | 2873 | dev_kfree_skb(skb); |
| @@ -2905,8 +2906,8 @@ static void · 32 unmodified lines | ||
| 2905 | 2906 | bnx2_reuse_rx_skb_pages(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, |
| 2906 | 2907 | struct sk_buff *skb, int count) |
| 2907 | 2908 | { |
| 2908 | − struct sw_pg *cons_rx_pg, *prod_rx_pg; | |
| 2909 | − struct rx_bd *cons_bd, *prod_bd; | |
| 2909 | + struct bnx2_sw_pg *cons_rx_pg, *prod_rx_pg; | |
| 2910 | + struct bnx2_rx_bd *cons_bd, *prod_bd; | |
| 2910 | 2911 | int i; |
| 2911 | 2912 | u16 hw_prod, prod; |
| 2912 | 2913 | u16 cons = rxr->rx_pg_cons; |
| @@ -2933,12 +2934,14 @@ bnx2_reuse_rx_skb_pages(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, · 20 unmodified lines | ||
| 2933 | 2934 | hw_prod = rxr->rx_pg_prod; |
| 2934 | 2935 | |
| 2935 | 2936 | for (i = 0; i < count; i++) { |
| 2936 | − prod = RX_PG_RING_IDX(hw_prod); | |
| 2937 | + prod = BNX2_RX_PG_RING_IDX(hw_prod); | |
| 2937 | 2938 | |
| 2938 | 2939 | prod_rx_pg = &rxr->rx_pg_ring[prod]; |
| 2939 | 2940 | cons_rx_pg = &rxr->rx_pg_ring[cons]; |
| 2940 | − cons_bd = &rxr->rx_pg_desc_ring[RX_RING(cons)][RX_IDX(cons)]; | |
| 2941 | − prod_bd = &rxr->rx_pg_desc_ring[RX_RING(prod)][RX_IDX(prod)]; | |
| 2941 | + cons_bd = &rxr->rx_pg_desc_ring[BNX2_RX_RING(cons)] | |
| 2942 | + [BNX2_RX_IDX(cons)]; | |
| 2943 | + prod_bd = &rxr->rx_pg_desc_ring[BNX2_RX_RING(prod)] | |
| 2944 | + [BNX2_RX_IDX(prod)]; | |
| 2942 | 2945 | |
| 2943 | 2946 | if (prod != cons) { |
| 2944 | 2947 | prod_rx_pg->page = cons_rx_pg->page; |
| @@ -2950,8 +2953,8 @@ bnx2_reuse_rx_skb_pages(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, · 5 unmodified lines | ||
| 2950 | 2953 | prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; |
| 2951 | 2954 | |
| 2952 | 2955 | } |
| 2953 | − cons = RX_PG_RING_IDX(NEXT_RX_BD(cons)); | |
| 2954 | − hw_prod = NEXT_RX_BD(hw_prod); | |
| 2956 | + cons = BNX2_RX_PG_RING_IDX(BNX2_NEXT_RX_BD(cons)); | |
| 2957 | + hw_prod = BNX2_NEXT_RX_BD(hw_prod); | |
| 2955 | 2958 | } |
| 2956 | 2959 | rxr->rx_pg_prod = hw_prod; |
| 2957 | 2960 | rxr->rx_pg_cons = cons; |
| @@ -2961,8 +2964,8 @@ static inline void · 3 unmodified lines | ||
| 2961 | 2964 | bnx2_reuse_rx_data(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, |
| 2962 | 2965 | u8 *data, u16 cons, u16 prod) |
| 2963 | 2966 | { |
| 2964 | − struct sw_bd *cons_rx_buf, *prod_rx_buf; | |
| 2965 | − struct rx_bd *cons_bd, *prod_bd; | |
| 2967 | + struct bnx2_sw_bd *cons_rx_buf, *prod_rx_buf; | |
| 2968 | + struct bnx2_rx_bd *cons_bd, *prod_bd; | |
| 2966 | 2969 | |
| 2967 | 2970 | cons_rx_buf = &rxr->rx_buf_ring[cons]; |
| 2968 | 2971 | prod_rx_buf = &rxr->rx_buf_ring[prod]; |
| @@ -2981,8 +2984,8 @@ bnx2_reuse_rx_data(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, · 12 unmodified lines | ||
| 2981 | 2984 | dma_unmap_addr_set(prod_rx_buf, mapping, |
| 2982 | 2985 | dma_unmap_addr(cons_rx_buf, mapping)); |
| 2983 | 2986 | |
| 2984 | − cons_bd = &rxr->rx_desc_ring[RX_RING(cons)][RX_IDX(cons)]; | |
| 2985 | − prod_bd = &rxr->rx_desc_ring[RX_RING(prod)][RX_IDX(prod)]; | |
| 2987 | + cons_bd = &rxr->rx_desc_ring[BNX2_RX_RING(cons)][BNX2_RX_IDX(cons)]; | |
| 2988 | + prod_bd = &rxr->rx_desc_ring[BNX2_RX_RING(prod)][BNX2_RX_IDX(prod)]; | |
| 2986 | 2989 | prod_bd->rx_bd_haddr_hi = cons_bd->rx_bd_haddr_hi; |
| 2987 | 2990 | prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; |
| 2988 | 2991 | } |
| @@ -3022,7 +3025,7 @@ error: · 33 unmodified lines | ||
| 3022 | 3025 | return skb; |
| 3023 | 3026 | } else { |
| 3024 | 3027 | unsigned int i, frag_len, frag_size, pages; |
| 3025 | − struct sw_pg *rx_pg; | |
| 3028 | + struct bnx2_sw_pg *rx_pg; | |
| 3026 | 3029 | u16 pg_cons = rxr->rx_pg_cons; |
| 3027 | 3030 | u16 pg_prod = rxr->rx_pg_prod; |
| 3028 | 3031 | |
| @@ -3065,7 +3068,7 @@ error: · 36 unmodified lines | ||
| 3065 | 3068 | rx_pg->page = NULL; |
| 3066 | 3069 | |
| 3067 | 3070 | err = bnx2_alloc_rx_page(bp, rxr, |
| 3068 | − RX_PG_RING_IDX(pg_prod), | |
| 3071 | + BNX2_RX_PG_RING_IDX(pg_prod), | |
| 3069 | 3072 | GFP_ATOMIC); |
| 3070 | 3073 | if (unlikely(err)) { |
| 3071 | 3074 | rxr->rx_pg_cons = pg_cons; |
| @@ -3083,8 +3086,8 @@ error: · 11 unmodified lines | ||
| 3083 | 3086 | skb->truesize += PAGE_SIZE; |
| 3084 | 3087 | skb->len += frag_len; |
| 3085 | 3088 | |
| 3086 | − pg_prod = NEXT_RX_BD(pg_prod); | |
| 3087 | − pg_cons = RX_PG_RING_IDX(NEXT_RX_BD(pg_cons)); | |
| 3089 | + pg_prod = BNX2_NEXT_RX_BD(pg_prod); | |
| 3090 | + pg_cons = BNX2_RX_PG_RING_IDX(BNX2_NEXT_RX_BD(pg_cons)); | |
| 3088 | 3091 | } |
| 3089 | 3092 | rxr->rx_pg_prod = pg_prod; |
| 3090 | 3093 | rxr->rx_pg_cons = pg_cons; |
| @@ -3101,7 +3104,7 @@ bnx2_get_hw_rx_cons(struct bnx2_napi *bnapi) · 10 unmodified lines | ||
| 3101 | 3104 | barrier(); |
| 3102 | 3105 | cons = *bnapi->hw_rx_cons_ptr; |
| 3103 | 3106 | barrier(); |
| 3104 | − if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)) | |
| 3107 | + if (unlikely((cons & BNX2_MAX_RX_DESC_CNT) == BNX2_MAX_RX_DESC_CNT)) | |
| 3105 | 3108 | cons++; |
| 3106 | 3109 | return cons; |
| 3107 | 3110 | } |
| @@ -3125,13 +3128,14 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) · 17 unmodified lines | ||
| 3125 | 3128 | while (sw_cons != hw_cons) { |
| 3126 | 3129 | unsigned int len, hdr_len; |
| 3127 | 3130 | u32 status; |
| 3128 | − struct sw_bd *rx_buf, *next_rx_buf; | |
| 3131 | + struct bnx2_sw_bd *rx_buf, *next_rx_buf; | |
| 3129 | 3132 | struct sk_buff *skb; |
| 3130 | 3133 | dma_addr_t dma_addr; |
| 3131 | 3134 | u8 *data; |
| 3135 | + u16 next_ring_idx; | |
| 3132 | 3136 | |
| 3133 | − sw_ring_cons = RX_RING_IDX(sw_cons); | |
| 3134 | − sw_ring_prod = RX_RING_IDX(sw_prod); | |
| 3137 | + sw_ring_cons = BNX2_RX_RING_IDX(sw_cons); | |
| 3138 | + sw_ring_prod = BNX2_RX_RING_IDX(sw_prod); | |
| 3135 | 3139 | |
| 3136 | 3140 | rx_buf = &rxr->rx_buf_ring[sw_ring_cons]; |
| 3137 | 3141 | data = rx_buf->data; |
| @@ -3146,8 +3150,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) · 8 unmodified lines | ||
| 3146 | 3150 | BNX2_RX_OFFSET + BNX2_RX_COPY_THRESH, |
| 3147 | 3151 | PCI_DMA_FROMDEVICE); |
| 3148 | 3152 | |
| 3149 | − next_rx_buf = | |
| 3150 | − &rxr->rx_buf_ring[RX_RING_IDX(NEXT_RX_BD(sw_cons))]; | |
| 3153 | + next_ring_idx = BNX2_RX_RING_IDX(BNX2_NEXT_RX_BD(sw_cons)); | |
| 3154 | + next_rx_buf = &rxr->rx_buf_ring[next_ring_idx]; | |
| 3151 | 3155 | prefetch(get_l2_fhdr(next_rx_buf->data)); |
| 3152 | 3156 | |
| 3153 | 3157 | len = rx_hdr->l2_fhdr_pkt_len; |
| @@ -3239,8 +3243,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) · 85 unmodified lines | ||
| 3239 | 3243 | rx_pkt++; |
| 3240 | 3244 | |
| 3241 | 3245 | next_rx: |
| 3242 | − sw_cons = NEXT_RX_BD(sw_cons); | |
| 3243 | − sw_prod = NEXT_RX_BD(sw_prod); | |
| 3246 | + sw_cons = BNX2_NEXT_RX_BD(sw_cons); | |
| 3247 | + sw_prod = BNX2_NEXT_RX_BD(sw_prod); | |
| 3244 | 3248 | |
| 3245 | 3249 | if ((rx_pkt == budget)) |
| 3246 | 3250 | break; |
| @@ -3255,11 +3259,11 @@ next_rx: · 8 unmodified lines | ||
| 3255 | 3259 | rxr->rx_prod = sw_prod; |
| 3256 | 3260 | |
| 3257 | 3261 | if (pg_ring_used) |
| 3258 | − REG_WR16(bp, rxr->rx_pg_bidx_addr, rxr->rx_pg_prod); | |
| 3262 | + BNX2_WR16(bp, rxr->rx_pg_bidx_addr, rxr->rx_pg_prod); | |
| 3259 | 3263 | |
| 3260 | − REG_WR16(bp, rxr->rx_bidx_addr, sw_prod); | |
| 3264 | + BNX2_WR16(bp, rxr->rx_bidx_addr, sw_prod); | |
| 3261 | 3265 | |
| 3262 | − REG_WR(bp, rxr->rx_bseq_addr, rxr->rx_prod_bseq); | |
| 3266 | + BNX2_WR(bp, rxr->rx_bseq_addr, rxr->rx_prod_bseq); | |
| 3263 | 3267 | |
| 3264 | 3268 | mmiowb(); |
| 3265 | 3269 | |
| @@ -3277,7 +3281,7 @@ bnx2_msi(int irq, void *dev_instance) · 11 unmodified lines | ||
| 3277 | 3281 | struct bnx2 *bp = bnapi->bp; |
| 3278 | 3282 | |
| 3279 | 3283 | prefetch(bnapi->status_blk.msi); |
| 3280 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3284 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3281 | 3285 | BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM | |
| 3282 | 3286 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
| 3283 | 3287 | |
| @@ -3321,18 +3325,18 @@ bnx2_interrupt(int irq, void *dev_instance) · 37 unmodified lines | ||
| 3321 | 3325 | * the status block write. |
| 3322 | 3326 | */ |
| 3323 | 3327 | if ((sblk->status_idx == bnapi->last_status_idx) && |
| 3324 | − (REG_RD(bp, BNX2_PCICFG_MISC_STATUS) & | |
| 3328 | + (BNX2_RD(bp, BNX2_PCICFG_MISC_STATUS) & | |
| 3325 | 3329 | BNX2_PCICFG_MISC_STATUS_INTA_VALUE)) |
| 3326 | 3330 | return IRQ_NONE; |
| 3327 | 3331 | |
| 3328 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3332 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3329 | 3333 | BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM | |
| 3330 | 3334 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
| 3331 | 3335 | |
| 3332 | 3336 | /* Read back to deassert IRQ immediately to avoid too many |
| 3333 | 3337 | * spurious interrupts. |
| 3334 | 3338 | */ |
| 3335 | − REG_RD(bp, BNX2_PCICFG_INT_ACK_CMD); | |
| 3339 | + BNX2_RD(bp, BNX2_PCICFG_INT_ACK_CMD); | |
| 3336 | 3340 | |
| 3337 | 3341 | /* Return here if interrupt is shared and is disabled. */ |
| 3338 | 3342 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) |
| @@ -3388,14 +3392,14 @@ bnx2_chk_missed_msi(struct bnx2 *bp) · 49 unmodified lines | ||
| 3388 | 3392 | u32 msi_ctrl; |
| 3389 | 3393 | |
| 3390 | 3394 | if (bnx2_has_work(bnapi)) { |
| 3391 | − msi_ctrl = REG_RD(bp, BNX2_PCICFG_MSI_CONTROL); | |
| 3395 | + msi_ctrl = BNX2_RD(bp, BNX2_PCICFG_MSI_CONTROL); | |
| 3392 | 3396 | if (!(msi_ctrl & BNX2_PCICFG_MSI_CONTROL_ENABLE)) |
| 3393 | 3397 | return; |
| 3394 | 3398 | |
| 3395 | 3399 | if (bnapi->last_status_idx == bp->idle_chk_status_idx) { |
| 3396 | − REG_WR(bp, BNX2_PCICFG_MSI_CONTROL, msi_ctrl & | |
| 3397 | − ~BNX2_PCICFG_MSI_CONTROL_ENABLE); | |
| 3398 | − REG_WR(bp, BNX2_PCICFG_MSI_CONTROL, msi_ctrl); | |
| 3400 | + BNX2_WR(bp, BNX2_PCICFG_MSI_CONTROL, msi_ctrl & | |
| 3401 | + ~BNX2_PCICFG_MSI_CONTROL_ENABLE); | |
| 3402 | + BNX2_WR(bp, BNX2_PCICFG_MSI_CONTROL, msi_ctrl); | |
| 3399 | 3403 | bnx2_msi(bp->irq_tbl[0].vector, bnapi); |
| 3400 | 3404 | } |
| 3401 | 3405 | } |
| @@ -3434,9 +3438,9 @@ static void bnx2_poll_link(struct bnx2 *bp, struct bnx2_napi *bnapi) · 32 unmodified lines | ||
| 3434 | 3438 | /* This is needed to take care of transient status |
| 3435 | 3439 | * during link changes. |
| 3436 | 3440 | */ |
| 3437 | − REG_WR(bp, BNX2_HC_COMMAND, | |
| 3438 | − bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW_WO_INT); | |
| 3439 | − REG_RD(bp, BNX2_HC_COMMAND); | |
| 3441 | + BNX2_WR(bp, BNX2_HC_COMMAND, | |
| 3442 | + bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW_WO_INT); | |
| 3443 | + BNX2_RD(bp, BNX2_HC_COMMAND); | |
| 3440 | 3444 | } |
| 3441 | 3445 | } |
| 3442 | 3446 | |
| @@ -3473,9 +3477,9 @@ static int bnx2_poll_msix(struct napi_struct *napi, int budget) · 30 unmodified lines | ||
| 3473 | 3477 | if (likely(!bnx2_has_fast_work(bnapi))) { |
| 3474 | 3478 | |
| 3475 | 3479 | napi_complete(napi); |
| 3476 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 3477 | − BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3478 | − bnapi->last_status_idx); | |
| 3480 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num | | |
| 3481 | + BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3482 | + bnapi->last_status_idx); | |
| 3479 | 3483 | break; |
| 3480 | 3484 | } |
| 3481 | 3485 | } |
| @@ -3511,19 +3515,19 @@ static int bnx2_poll(struct napi_struct *napi, int budget) · 29 unmodified lines | ||
| 3511 | 3515 | if (likely(!bnx2_has_work(bnapi))) { |
| 3512 | 3516 | napi_complete(napi); |
| 3513 | 3517 | if (likely(bp->flags & BNX2_FLAG_USING_MSI_OR_MSIX)) { |
| 3514 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3515 | − BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3516 | − bnapi->last_status_idx); | |
| 3518 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3519 | + BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3520 | + bnapi->last_status_idx); | |
| 3517 | 3521 | break; |
| 3518 | 3522 | } |
| 3519 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3520 | − BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3521 | − BNX2_PCICFG_INT_ACK_CMD_MASK_INT | | |
| 3522 | − bnapi->last_status_idx); | |
| 3523 | − | |
| 3524 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3525 | − BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3526 | − bnapi->last_status_idx); | |
| 3523 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3524 | + BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3525 | + BNX2_PCICFG_INT_ACK_CMD_MASK_INT | | |
| 3526 | + bnapi->last_status_idx); | |
| 3527 | + | |
| 3528 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | |
| 3529 | + BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | |
| 3530 | + bnapi->last_status_idx); | |
| 3527 | 3531 | break; |
| 3528 | 3532 | } |
| 3529 | 3533 | } |
| @@ -3561,8 +3565,8 @@ bnx2_set_rx_mode(struct net_device *dev) · 31 unmodified lines | ||
| 3561 | 3565 | } |
| 3562 | 3566 | else if (dev->flags & IFF_ALLMULTI) { |
| 3563 | 3567 | for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) { |
| 3564 | − REG_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4), | |
| 3565 | − 0xffffffff); | |
| 3568 | + BNX2_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4), | |
| 3569 | + 0xffffffff); | |
| 3566 | 3570 | } |
| 3567 | 3571 | sort_mode |= BNX2_RPM_SORT_USER0_MC_EN; |
| 3568 | 3572 | } |
| @@ -3584,8 +3588,8 @@ bnx2_set_rx_mode(struct net_device *dev) · 15 unmodified lines | ||
| 3584 | 3588 | } |
| 3585 | 3589 | |
| 3586 | 3590 | for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) { |
| 3587 | − REG_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4), | |
| 3588 | − mc_filter[i]); | |
| 3591 | + BNX2_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4), | |
| 3592 | + mc_filter[i]); | |
| 3589 | 3593 | } |
| 3590 | 3594 | |
| 3591 | 3595 | sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN; |
| @@ -3610,12 +3614,12 @@ bnx2_set_rx_mode(struct net_device *dev) · 18 unmodified lines | ||
| 3610 | 3614 | |
| 3611 | 3615 | if (rx_mode != bp->rx_mode) { |
| 3612 | 3616 | bp->rx_mode = rx_mode; |
| 3613 | − REG_WR(bp, BNX2_EMAC_RX_MODE, rx_mode); | |
| 3617 | + BNX2_WR(bp, BNX2_EMAC_RX_MODE, rx_mode); | |
| 3614 | 3618 | } |
| 3615 | 3619 | |
| 3616 | − REG_WR(bp, BNX2_RPM_SORT_USER0, 0x0); | |
| 3617 | − REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode); | |
| 3618 | − REG_WR(bp, BNX2_RPM_SORT_USER0, sort_mode | BNX2_RPM_SORT_USER0_ENA); | |
| 3620 | + BNX2_WR(bp, BNX2_RPM_SORT_USER0, 0x0); | |
| 3621 | + BNX2_WR(bp, BNX2_RPM_SORT_USER0, sort_mode); | |
| 3622 | + BNX2_WR(bp, BNX2_RPM_SORT_USER0, sort_mode | BNX2_RPM_SORT_USER0_ENA); | |
| 3619 | 3623 | |
| 3620 | 3624 | spin_unlock_bh(&bp->phy_lock); |
| 3621 | 3625 | } |
| @@ -3663,10 +3667,10 @@ static int bnx2_request_uncached_firmware(struct bnx2 *bp) · 41 unmodified lines | ||
| 3663 | 3667 | const struct bnx2_rv2p_fw_file *rv2p_fw; |
| 3664 | 3668 | int rc; |
| 3665 | 3669 | |
| 3666 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 3670 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 3667 | 3671 | mips_fw_file = FW_MIPS_FILE_09; |
| 3668 | − if ((CHIP_ID(bp) == CHIP_ID_5709_A0) || | |
| 3669 | − (CHIP_ID(bp) == CHIP_ID_5709_A1)) | |
| 3672 | + if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5709_A0) || | |
| 3673 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5709_A1)) | |
| 3670 | 3674 | rv2p_fw_file = FW_RV2P_FILE_09_Ax; |
| 3671 | 3675 | else |
| 3672 | 3676 | rv2p_fw_file = FW_RV2P_FILE_09; |
| @@ -3756,13 +3760,13 @@ load_rv2p_fw(struct bnx2 *bp, u32 rv2p_proc, · 83 unmodified lines | ||
| 3756 | 3760 | } |
| 3757 | 3761 | |
| 3758 | 3762 | for (i = 0; i < rv2p_code_len; i += 8) { |
| 3759 | − REG_WR(bp, BNX2_RV2P_INSTR_HIGH, be32_to_cpu(*rv2p_code)); | |
| 3763 | + BNX2_WR(bp, BNX2_RV2P_INSTR_HIGH, be32_to_cpu(*rv2p_code)); | |
| 3760 | 3764 | rv2p_code++; |
| 3761 | − REG_WR(bp, BNX2_RV2P_INSTR_LOW, be32_to_cpu(*rv2p_code)); | |
| 3765 | + BNX2_WR(bp, BNX2_RV2P_INSTR_LOW, be32_to_cpu(*rv2p_code)); | |
| 3762 | 3766 | rv2p_code++; |
| 3763 | 3767 | |
| 3764 | 3768 | val = (i / 8) | cmd; |
| 3765 | − REG_WR(bp, addr, val); | |
| 3769 | + BNX2_WR(bp, addr, val); | |
| 3766 | 3770 | } |
| 3767 | 3771 | |
| 3768 | 3772 | rv2p_code = (__be32 *)(bp->rv2p_firmware->data + file_offset); |
| @@ -3772,22 +3776,22 @@ load_rv2p_fw(struct bnx2 *bp, u32 rv2p_proc, · 3 unmodified lines | ||
| 3772 | 3776 | loc = be32_to_cpu(fw_entry->fixup[i]); |
| 3773 | 3777 | if (loc && ((loc * 4) < rv2p_code_len)) { |
| 3774 | 3778 | code = be32_to_cpu(*(rv2p_code + loc - 1)); |
| 3775 | − REG_WR(bp, BNX2_RV2P_INSTR_HIGH, code); | |
| 3779 | + BNX2_WR(bp, BNX2_RV2P_INSTR_HIGH, code); | |
| 3776 | 3780 | code = be32_to_cpu(*(rv2p_code + loc)); |
| 3777 | 3781 | code = rv2p_fw_fixup(rv2p_proc, i, loc, code); |
| 3778 | − REG_WR(bp, BNX2_RV2P_INSTR_LOW, code); | |
| 3782 | + BNX2_WR(bp, BNX2_RV2P_INSTR_LOW, code); | |
| 3779 | 3783 | |
| 3780 | 3784 | val = (loc / 2) | cmd; |
| 3781 | − REG_WR(bp, addr, val); | |
| 3785 | + BNX2_WR(bp, addr, val); | |
| 3782 | 3786 | } |
| 3783 | 3787 | } |
| 3784 | 3788 | |
| 3785 | 3789 | /* Reset the processor, un-stall is done later. */ |
| 3786 | 3790 | if (rv2p_proc == RV2P_PROC1) { |
| 3787 | − REG_WR(bp, BNX2_RV2P_COMMAND, BNX2_RV2P_COMMAND_PROC1_RESET); | |
| 3791 | + BNX2_WR(bp, BNX2_RV2P_COMMAND, BNX2_RV2P_COMMAND_PROC1_RESET); | |
| 3788 | 3792 | } |
| 3789 | 3793 | else { |
| 3790 | − REG_WR(bp, BNX2_RV2P_COMMAND, BNX2_RV2P_COMMAND_PROC2_RESET); | |
| 3794 | + BNX2_WR(bp, BNX2_RV2P_COMMAND, BNX2_RV2P_COMMAND_PROC2_RESET); | |
| 3791 | 3795 | } |
| 3792 | 3796 | |
| 3793 | 3797 | return 0; |
| @@ -3924,14 +3928,14 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) · 130 unmodified lines | ||
| 3924 | 3928 | /* delay required during transition out of D3hot */ |
| 3925 | 3929 | msleep(20); |
| 3926 | 3930 | |
| 3927 | − val = REG_RD(bp, BNX2_EMAC_MODE); | |
| 3931 | + val = BNX2_RD(bp, BNX2_EMAC_MODE); | |
| 3928 | 3932 | val |= BNX2_EMAC_MODE_MPKT_RCVD | BNX2_EMAC_MODE_ACPI_RCVD; |
| 3929 | 3933 | val &= ~BNX2_EMAC_MODE_MPKT; |
| 3930 | − REG_WR(bp, BNX2_EMAC_MODE, val); | |
| 3934 | + BNX2_WR(bp, BNX2_EMAC_MODE, val); | |
| 3931 | 3935 | |
| 3932 | − val = REG_RD(bp, BNX2_RPM_CONFIG); | |
| 3936 | + val = BNX2_RD(bp, BNX2_RPM_CONFIG); | |
| 3933 | 3937 | val &= ~BNX2_RPM_CONFIG_ACPI_ENA; |
| 3934 | − REG_WR(bp, BNX2_RPM_CONFIG, val); | |
| 3938 | + BNX2_WR(bp, BNX2_RPM_CONFIG, val); | |
| 3935 | 3939 | break; |
| 3936 | 3940 | } |
| 3937 | 3941 | case PCI_D3hot: { |
| @@ -3963,7 +3967,7 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) · 25 unmodified lines | ||
| 3963 | 3967 | |
| 3964 | 3968 | bnx2_set_mac_addr(bp, bp->dev->dev_addr, 0); |
| 3965 | 3969 | |
| 3966 | − val = REG_RD(bp, BNX2_EMAC_MODE); | |
| 3970 | + val = BNX2_RD(bp, BNX2_EMAC_MODE); | |
| 3967 | 3971 | |
| 3968 | 3972 | /* Enable port mode. */ |
| 3969 | 3973 | val &= ~BNX2_EMAC_MODE_PORT; |
| @@ -3978,32 +3982,32 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) · 8 unmodified lines | ||
| 3978 | 3982 | val |= BNX2_EMAC_MODE_25G_MODE; |
| 3979 | 3983 | } |
| 3980 | 3984 | |
| 3981 | − REG_WR(bp, BNX2_EMAC_MODE, val); | |
| 3985 | + BNX2_WR(bp, BNX2_EMAC_MODE, val); | |
| 3982 | 3986 | |
| 3983 | 3987 | /* receive all multicast */ |
| 3984 | 3988 | for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) { |
| 3985 | − REG_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4), | |
| 3986 | − 0xffffffff); | |
| 3989 | + BNX2_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4), | |
| 3990 | + 0xffffffff); | |
| 3987 | 3991 | } |
| 3988 | − REG_WR(bp, BNX2_EMAC_RX_MODE, | |
| 3989 | − BNX2_EMAC_RX_MODE_SORT_MODE); | |
| 3992 | + BNX2_WR(bp, BNX2_EMAC_RX_MODE, | |
| 3993 | + BNX2_EMAC_RX_MODE_SORT_MODE); | |
| 3990 | 3994 | |
| 3991 | 3995 | val = 1 | BNX2_RPM_SORT_USER0_BC_EN | |
| 3992 | 3996 | BNX2_RPM_SORT_USER0_MC_EN; |
| 3993 | − REG_WR(bp, BNX2_RPM_SORT_USER0, 0x0); | |
| 3994 | − REG_WR(bp, BNX2_RPM_SORT_USER0, val); | |
| 3995 | − REG_WR(bp, BNX2_RPM_SORT_USER0, val | | |
| 3996 | − BNX2_RPM_SORT_USER0_ENA); | |
| 3997 | + BNX2_WR(bp, BNX2_RPM_SORT_USER0, 0x0); | |
| 3998 | + BNX2_WR(bp, BNX2_RPM_SORT_USER0, val); | |
| 3999 | + BNX2_WR(bp, BNX2_RPM_SORT_USER0, val | | |
| 4000 | + BNX2_RPM_SORT_USER0_ENA); | |
| 3997 | 4001 | |
| 3998 | 4002 | /* Need to enable EMAC and RPM for WOL. */ |
| 3999 | − REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, | |
| 4000 | − BNX2_MISC_ENABLE_SET_BITS_RX_PARSER_MAC_ENABLE | | |
| 4001 | − BNX2_MISC_ENABLE_SET_BITS_TX_HEADER_Q_ENABLE | | |
| 4002 | − BNX2_MISC_ENABLE_SET_BITS_EMAC_ENABLE); | |
| 4003 | + BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS, | |
| 4004 | + BNX2_MISC_ENABLE_SET_BITS_RX_PARSER_MAC_ENABLE | | |
| 4005 | + BNX2_MISC_ENABLE_SET_BITS_TX_HEADER_Q_ENABLE | | |
| 4006 | + BNX2_MISC_ENABLE_SET_BITS_EMAC_ENABLE); | |
| 4003 | 4007 | |
| 4004 | − val = REG_RD(bp, BNX2_RPM_CONFIG); | |
| 4008 | + val = BNX2_RD(bp, BNX2_RPM_CONFIG); | |
| 4005 | 4009 | val &= ~BNX2_RPM_CONFIG_ACPI_ENA; |
| 4006 | − REG_WR(bp, BNX2_RPM_CONFIG, val); | |
| 4010 | + BNX2_WR(bp, BNX2_RPM_CONFIG, val); | |
| 4007 | 4011 | |
| 4008 | 4012 | wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_WOL; |
| 4009 | 4013 | } |
| @@ -4016,8 +4020,8 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) · 6 unmodified lines | ||
| 4016 | 4020 | 1, 0); |
| 4017 | 4021 | |
| 4018 | 4022 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; |
| 4019 | − if ((CHIP_ID(bp) == CHIP_ID_5706_A0) || | |
| 4020 | − (CHIP_ID(bp) == CHIP_ID_5706_A1)) { | |
| 4023 | + if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) || | |
| 4024 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1)) { | |
| 4021 | 4025 | |
| 4022 | 4026 | if (bp->wol) |
| 4023 | 4027 | pmcsr |= 3; |
| @@ -4050,9 +4054,9 @@ bnx2_acquire_nvram_lock(struct bnx2 *bp) · 26 unmodified lines | ||
| 4050 | 4054 | int j; |
| 4051 | 4055 | |
| 4052 | 4056 | /* Request access to the flash interface. */ |
| 4053 | − REG_WR(bp, BNX2_NVM_SW_ARB, BNX2_NVM_SW_ARB_ARB_REQ_SET2); | |
| 4057 | + BNX2_WR(bp, BNX2_NVM_SW_ARB, BNX2_NVM_SW_ARB_ARB_REQ_SET2); | |
| 4054 | 4058 | for (j = 0; j < NVRAM_TIMEOUT_COUNT; j++) { |
| 4055 | − val = REG_RD(bp, BNX2_NVM_SW_ARB); | |
| 4059 | + val = BNX2_RD(bp, BNX2_NVM_SW_ARB); | |
| 4056 | 4060 | if (val & BNX2_NVM_SW_ARB_ARB_ARB2) |
| 4057 | 4061 | break; |
| 4058 | 4062 | |
| @@ -4072,10 +4076,10 @@ bnx2_release_nvram_lock(struct bnx2 *bp) · 13 unmodified lines | ||
| 4072 | 4076 | u32 val; |
| 4073 | 4077 | |
| 4074 | 4078 | /* Relinquish nvram interface. */ |
| 4075 | − REG_WR(bp, BNX2_NVM_SW_ARB, BNX2_NVM_SW_ARB_ARB_REQ_CLR2); | |
| 4079 | + BNX2_WR(bp, BNX2_NVM_SW_ARB, BNX2_NVM_SW_ARB_ARB_REQ_CLR2); | |
| 4076 | 4080 | |
| 4077 | 4081 | for (j = 0; j < NVRAM_TIMEOUT_COUNT; j++) { |
| 4078 | − val = REG_RD(bp, BNX2_NVM_SW_ARB); | |
| 4082 | + val = BNX2_RD(bp, BNX2_NVM_SW_ARB); | |
| 4079 | 4083 | if (!(val & BNX2_NVM_SW_ARB_ARB_ARB2)) |
| 4080 | 4084 | break; |
| 4081 | 4085 | |
| @@ -4094,20 +4098,20 @@ bnx2_enable_nvram_write(struct bnx2 *bp) · 12 unmodified lines | ||
| 4094 | 4098 | { |
| 4095 | 4099 | u32 val; |
| 4096 | 4100 | |
| 4097 | − val = REG_RD(bp, BNX2_MISC_CFG); | |
| 4098 | − REG_WR(bp, BNX2_MISC_CFG, val | BNX2_MISC_CFG_NVM_WR_EN_PCI); | |
| 4101 | + val = BNX2_RD(bp, BNX2_MISC_CFG); | |
| 4102 | + BNX2_WR(bp, BNX2_MISC_CFG, val | BNX2_MISC_CFG_NVM_WR_EN_PCI); | |
| 4099 | 4103 | |
| 4100 | 4104 | if (bp->flash_info->flags & BNX2_NV_WREN) { |
| 4101 | 4105 | int j; |
| 4102 | 4106 | |
| 4103 | − REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4104 | − REG_WR(bp, BNX2_NVM_COMMAND, | |
| 4105 | − BNX2_NVM_COMMAND_WREN | BNX2_NVM_COMMAND_DOIT); | |
| 4107 | + BNX2_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4108 | + BNX2_WR(bp, BNX2_NVM_COMMAND, | |
| 4109 | + BNX2_NVM_COMMAND_WREN | BNX2_NVM_COMMAND_DOIT); | |
| 4106 | 4110 | |
| 4107 | 4111 | for (j = 0; j < NVRAM_TIMEOUT_COUNT; j++) { |
| 4108 | 4112 | udelay(5); |
| 4109 | 4113 | |
| 4110 | − val = REG_RD(bp, BNX2_NVM_COMMAND); | |
| 4114 | + val = BNX2_RD(bp, BNX2_NVM_COMMAND); | |
| 4111 | 4115 | if (val & BNX2_NVM_COMMAND_DONE) |
| 4112 | 4116 | break; |
| 4113 | 4117 | } |
| @@ -4123,8 +4127,8 @@ bnx2_disable_nvram_write(struct bnx2 *bp) · 9 unmodified lines | ||
| 4123 | 4127 | { |
| 4124 | 4128 | u32 val; |
| 4125 | 4129 | |
| 4126 | − val = REG_RD(bp, BNX2_MISC_CFG); | |
| 4127 | − REG_WR(bp, BNX2_MISC_CFG, val & ~BNX2_MISC_CFG_NVM_WR_EN); | |
| 4130 | + val = BNX2_RD(bp, BNX2_MISC_CFG); | |
| 4131 | + BNX2_WR(bp, BNX2_MISC_CFG, val & ~BNX2_MISC_CFG_NVM_WR_EN); | |
| 4128 | 4132 | } |
| 4129 | 4133 | |
| 4130 | 4134 | |
| @@ -4133,10 +4137,10 @@ bnx2_enable_nvram_access(struct bnx2 *bp) · 2 unmodified lines | ||
| 4133 | 4137 | { |
| 4134 | 4138 | u32 val; |
| 4135 | 4139 | |
| 4136 | − val = REG_RD(bp, BNX2_NVM_ACCESS_ENABLE); | |
| 4140 | + val = BNX2_RD(bp, BNX2_NVM_ACCESS_ENABLE); | |
| 4137 | 4141 | /* Enable both bits, even on read. */ |
| 4138 | − REG_WR(bp, BNX2_NVM_ACCESS_ENABLE, | |
| 4139 | − val | BNX2_NVM_ACCESS_ENABLE_EN | BNX2_NVM_ACCESS_ENABLE_WR_EN); | |
| 4142 | + BNX2_WR(bp, BNX2_NVM_ACCESS_ENABLE, | |
| 4143 | + val | BNX2_NVM_ACCESS_ENABLE_EN | BNX2_NVM_ACCESS_ENABLE_WR_EN); | |
| 4140 | 4144 | } |
| 4141 | 4145 | |
| 4142 | 4146 | static void |
| @@ -4144,9 +4148,9 @@ bnx2_disable_nvram_access(struct bnx2 *bp) · 1 unmodified line | ||
| 4144 | 4148 | { |
| 4145 | 4149 | u32 val; |
| 4146 | 4150 | |
| 4147 | − val = REG_RD(bp, BNX2_NVM_ACCESS_ENABLE); | |
| 4151 | + val = BNX2_RD(bp, BNX2_NVM_ACCESS_ENABLE); | |
| 4148 | 4152 | /* Disable both bits, even after read. */ |
| 4149 | − REG_WR(bp, BNX2_NVM_ACCESS_ENABLE, | |
| 4153 | + BNX2_WR(bp, BNX2_NVM_ACCESS_ENABLE, | |
| 4150 | 4154 | val & ~(BNX2_NVM_ACCESS_ENABLE_EN | |
| 4151 | 4155 | BNX2_NVM_ACCESS_ENABLE_WR_EN)); |
| 4152 | 4156 | } |
| @@ -4166,13 +4170,13 @@ bnx2_nvram_erase_page(struct bnx2 *bp, u32 offset) · 13 unmodified lines | ||
| 4166 | 4170 | BNX2_NVM_COMMAND_DOIT; |
| 4167 | 4171 | |
| 4168 | 4172 | /* Need to clear DONE bit separately. */ |
| 4169 | − REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4173 | + BNX2_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4170 | 4174 | |
| 4171 | 4175 | /* Address of the NVRAM to read from. */ |
| 4172 | − REG_WR(bp, BNX2_NVM_ADDR, offset & BNX2_NVM_ADDR_NVM_ADDR_VALUE); | |
| 4176 | + BNX2_WR(bp, BNX2_NVM_ADDR, offset & BNX2_NVM_ADDR_NVM_ADDR_VALUE); | |
| 4173 | 4177 | |
| 4174 | 4178 | /* Issue an erase command. */ |
| 4175 | − REG_WR(bp, BNX2_NVM_COMMAND, cmd); | |
| 4179 | + BNX2_WR(bp, BNX2_NVM_COMMAND, cmd); | |
| 4176 | 4180 | |
| 4177 | 4181 | /* Wait for completion. */ |
| 4178 | 4182 | for (j = 0; j < NVRAM_TIMEOUT_COUNT; j++) { |
| @@ -4180,7 +4184,7 @@ bnx2_nvram_erase_page(struct bnx2 *bp, u32 offset) · 1 unmodified line | ||
| 4180 | 4184 | |
| 4181 | 4185 | udelay(5); |
| 4182 | 4186 | |
| 4183 | − val = REG_RD(bp, BNX2_NVM_COMMAND); | |
| 4187 | + val = BNX2_RD(bp, BNX2_NVM_COMMAND); | |
| 4184 | 4188 | if (val & BNX2_NVM_COMMAND_DONE) |
| 4185 | 4189 | break; |
| 4186 | 4190 | } |
| @@ -4208,13 +4212,13 @@ bnx2_nvram_read_dword(struct bnx2 *bp, u32 offset, u8 *ret_val, u32 cmd_flags) · 21 unmodified lines | ||
| 4208 | 4212 | } |
| 4209 | 4213 | |
| 4210 | 4214 | /* Need to clear DONE bit separately. */ |
| 4211 | − REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4215 | + BNX2_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4212 | 4216 | |
| 4213 | 4217 | /* Address of the NVRAM to read from. */ |
| 4214 | − REG_WR(bp, BNX2_NVM_ADDR, offset & BNX2_NVM_ADDR_NVM_ADDR_VALUE); | |
| 4218 | + BNX2_WR(bp, BNX2_NVM_ADDR, offset & BNX2_NVM_ADDR_NVM_ADDR_VALUE); | |
| 4215 | 4219 | |
| 4216 | 4220 | /* Issue a read command. */ |
| 4217 | − REG_WR(bp, BNX2_NVM_COMMAND, cmd); | |
| 4221 | + BNX2_WR(bp, BNX2_NVM_COMMAND, cmd); | |
| 4218 | 4222 | |
| 4219 | 4223 | /* Wait for completion. */ |
| 4220 | 4224 | for (j = 0; j < NVRAM_TIMEOUT_COUNT; j++) { |
| @@ -4222,9 +4226,9 @@ bnx2_nvram_read_dword(struct bnx2 *bp, u32 offset, u8 *ret_val, u32 cmd_flags) · 1 unmodified line | ||
| 4222 | 4226 | |
| 4223 | 4227 | udelay(5); |
| 4224 | 4228 | |
| 4225 | − val = REG_RD(bp, BNX2_NVM_COMMAND); | |
| 4229 | + val = BNX2_RD(bp, BNX2_NVM_COMMAND); | |
| 4226 | 4230 | if (val & BNX2_NVM_COMMAND_DONE) { |
| 4227 | − __be32 v = cpu_to_be32(REG_RD(bp, BNX2_NVM_READ)); | |
| 4231 | + __be32 v = cpu_to_be32(BNX2_RD(bp, BNX2_NVM_READ)); | |
| 4228 | 4232 | memcpy(ret_val, &v, 4); |
| 4229 | 4233 | break; |
| 4230 | 4234 | } |
| @@ -4254,24 +4258,24 @@ bnx2_nvram_write_dword(struct bnx2 *bp, u32 offset, u8 *val, u32 cmd_flags) · 23 unmodified lines | ||
| 4254 | 4258 | } |
| 4255 | 4259 | |
| 4256 | 4260 | /* Need to clear DONE bit separately. */ |
| 4257 | − REG_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4261 | + BNX2_WR(bp, BNX2_NVM_COMMAND, BNX2_NVM_COMMAND_DONE); | |
| 4258 | 4262 | |
| 4259 | 4263 | memcpy(&val32, val, 4); |
| 4260 | 4264 | |
| 4261 | 4265 | /* Write the data. */ |
| 4262 | − REG_WR(bp, BNX2_NVM_WRITE, be32_to_cpu(val32)); | |
| 4266 | + BNX2_WR(bp, BNX2_NVM_WRITE, be32_to_cpu(val32)); | |
| 4263 | 4267 | |
| 4264 | 4268 | /* Address of the NVRAM to write to. */ |
| 4265 | − REG_WR(bp, BNX2_NVM_ADDR, offset & BNX2_NVM_ADDR_NVM_ADDR_VALUE); | |
| 4269 | + BNX2_WR(bp, BNX2_NVM_ADDR, offset & BNX2_NVM_ADDR_NVM_ADDR_VALUE); | |
| 4266 | 4270 | |
| 4267 | 4271 | /* Issue the write command. */ |
| 4268 | − REG_WR(bp, BNX2_NVM_COMMAND, cmd); | |
| 4272 | + BNX2_WR(bp, BNX2_NVM_COMMAND, cmd); | |
| 4269 | 4273 | |
| 4270 | 4274 | /* Wait for completion. */ |
| 4271 | 4275 | for (j = 0; j < NVRAM_TIMEOUT_COUNT; j++) { |
| 4272 | 4276 | udelay(5); |
| 4273 | 4277 | |
| 4274 | − if (REG_RD(bp, BNX2_NVM_COMMAND) & BNX2_NVM_COMMAND_DONE) | |
| 4278 | + if (BNX2_RD(bp, BNX2_NVM_COMMAND) & BNX2_NVM_COMMAND_DONE) | |
| 4275 | 4279 | break; |
| 4276 | 4280 | } |
| 4277 | 4281 | if (j >= NVRAM_TIMEOUT_COUNT) |
| @@ -4287,13 +4291,13 @@ bnx2_init_nvram(struct bnx2 *bp) · 9 unmodified lines | ||
| 4287 | 4291 | int j, entry_count, rc = 0; |
| 4288 | 4292 | const struct flash_spec *flash; |
| 4289 | 4293 | |
| 4290 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 4294 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 4291 | 4295 | bp->flash_info = &flash_5709; |
| 4292 | 4296 | goto get_flash_size; |
| 4293 | 4297 | } |
| 4294 | 4298 | |
| 4295 | 4299 | /* Determine the selected interface. */ |
| 4296 | − val = REG_RD(bp, BNX2_NVM_CFG1); | |
| 4300 | + val = BNX2_RD(bp, BNX2_NVM_CFG1); | |
| 4297 | 4301 | |
| 4298 | 4302 | entry_count = ARRAY_SIZE(flash_table); |
| 4299 | 4303 | |
| @@ -4332,10 +4336,10 @@ bnx2_init_nvram(struct bnx2 *bp) · 32 unmodified lines | ||
| 4332 | 4336 | bnx2_enable_nvram_access(bp); |
| 4333 | 4337 | |
| 4334 | 4338 | /* Reconfigure the flash interface */ |
| 4335 | − REG_WR(bp, BNX2_NVM_CFG1, flash->config1); | |
| 4336 | − REG_WR(bp, BNX2_NVM_CFG2, flash->config2); | |
| 4337 | − REG_WR(bp, BNX2_NVM_CFG3, flash->config3); | |
| 4338 | − REG_WR(bp, BNX2_NVM_WRITE1, flash->write1); | |
| 4339 | + BNX2_WR(bp, BNX2_NVM_CFG1, flash->config1); | |
| 4340 | + BNX2_WR(bp, BNX2_NVM_CFG2, flash->config2); | |
| 4341 | + BNX2_WR(bp, BNX2_NVM_CFG3, flash->config3); | |
| 4342 | + BNX2_WR(bp, BNX2_NVM_WRITE1, flash->write1); | |
| 4339 | 4343 | |
| 4340 | 4344 | /* Disable access to flash interface */ |
| 4341 | 4345 | bnx2_disable_nvram_access(bp); |
| @@ -4696,10 +4700,10 @@ bnx2_init_fw_cap(struct bnx2 *bp) · 354 unmodified lines | ||
| 4696 | 4700 | static void |
| 4697 | 4701 | bnx2_setup_msix_tbl(struct bnx2 *bp) |
| 4698 | 4702 | { |
| 4699 | − REG_WR(bp, BNX2_PCI_GRC_WINDOW_ADDR, BNX2_PCI_GRC_WINDOW_ADDR_SEP_WIN); | |
| 4703 | + BNX2_WR(bp, BNX2_PCI_GRC_WINDOW_ADDR, BNX2_PCI_GRC_WINDOW_ADDR_SEP_WIN); | |
| 4700 | 4704 | |
| 4701 | − REG_WR(bp, BNX2_PCI_GRC_WINDOW2_ADDR, BNX2_MSIX_TABLE_ADDR); | |
| 4702 | − REG_WR(bp, BNX2_PCI_GRC_WINDOW3_ADDR, BNX2_MSIX_PBA_ADDR); | |
| 4705 | + BNX2_WR(bp, BNX2_PCI_GRC_WINDOW2_ADDR, BNX2_MSIX_TABLE_ADDR); | |
| 4706 | + BNX2_WR(bp, BNX2_PCI_GRC_WINDOW3_ADDR, BNX2_MSIX_PBA_ADDR); | |
| 4703 | 4707 | } |
| 4704 | 4708 | |
| 4705 | 4709 | static int |
| @@ -4711,24 +4715,24 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) · 5 unmodified lines | ||
| 4711 | 4715 | |
| 4712 | 4716 | /* Wait for the current PCI transaction to complete before |
| 4713 | 4717 | * issuing a reset. */ |
| 4714 | − if ((CHIP_NUM(bp) == CHIP_NUM_5706) || | |
| 4715 | − (CHIP_NUM(bp) == CHIP_NUM_5708)) { | |
| 4716 | − REG_WR(bp, BNX2_MISC_ENABLE_CLR_BITS, | |
| 4717 | − BNX2_MISC_ENABLE_CLR_BITS_TX_DMA_ENABLE | | |
| 4718 | − BNX2_MISC_ENABLE_CLR_BITS_DMA_ENGINE_ENABLE | | |
| 4719 | − BNX2_MISC_ENABLE_CLR_BITS_RX_DMA_ENABLE | | |
| 4720 | − BNX2_MISC_ENABLE_CLR_BITS_HOST_COALESCE_ENABLE); | |
| 4721 | − val = REG_RD(bp, BNX2_MISC_ENABLE_CLR_BITS); | |
| 4718 | + if ((BNX2_CHIP(bp) == BNX2_CHIP_5706) || | |
| 4719 | + (BNX2_CHIP(bp) == BNX2_CHIP_5708)) { | |
| 4720 | + BNX2_WR(bp, BNX2_MISC_ENABLE_CLR_BITS, | |
| 4721 | + BNX2_MISC_ENABLE_CLR_BITS_TX_DMA_ENABLE | | |
| 4722 | + BNX2_MISC_ENABLE_CLR_BITS_DMA_ENGINE_ENABLE | | |
| 4723 | + BNX2_MISC_ENABLE_CLR_BITS_RX_DMA_ENABLE | | |
| 4724 | + BNX2_MISC_ENABLE_CLR_BITS_HOST_COALESCE_ENABLE); | |
| 4725 | + val = BNX2_RD(bp, BNX2_MISC_ENABLE_CLR_BITS); | |
| 4722 | 4726 | udelay(5); |
| 4723 | 4727 | } else { /* 5709 */ |
| 4724 | − val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL); | |
| 4728 | + val = BNX2_RD(bp, BNX2_MISC_NEW_CORE_CTL); | |
| 4725 | 4729 | val &= ~BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE; |
| 4726 | − REG_WR(bp, BNX2_MISC_NEW_CORE_CTL, val); | |
| 4727 | − val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL); | |
| 4730 | + BNX2_WR(bp, BNX2_MISC_NEW_CORE_CTL, val); | |
| 4731 | + val = BNX2_RD(bp, BNX2_MISC_NEW_CORE_CTL); | |
| 4728 | 4732 | |
| 4729 | 4733 | for (i = 0; i < 100; i++) { |
| 4730 | 4734 | msleep(1); |
| 4731 | − val = REG_RD(bp, BNX2_PCICFG_DEVICE_CONTROL); | |
| 4735 | + val = BNX2_RD(bp, BNX2_PCICFG_DEVICE_CONTROL); | |
| 4732 | 4736 | if (!(val & BNX2_PCICFG_DEVICE_STATUS_NO_PEND)) |
| 4733 | 4737 | break; |
| 4734 | 4738 | } |
| @@ -4744,17 +4748,17 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) · 9 unmodified lines | ||
| 4744 | 4748 | |
| 4745 | 4749 | /* Do a dummy read to force the chip to complete all current transaction |
| 4746 | 4750 | * before we issue a reset. */ |
| 4747 | − val = REG_RD(bp, BNX2_MISC_ID); | |
| 4751 | + val = BNX2_RD(bp, BNX2_MISC_ID); | |
| 4748 | 4752 | |
| 4749 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 4750 | − REG_WR(bp, BNX2_MISC_COMMAND, BNX2_MISC_COMMAND_SW_RESET); | |
| 4751 | − REG_RD(bp, BNX2_MISC_COMMAND); | |
| 4753 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 4754 | + BNX2_WR(bp, BNX2_MISC_COMMAND, BNX2_MISC_COMMAND_SW_RESET); | |
| 4755 | + BNX2_RD(bp, BNX2_MISC_COMMAND); | |
| 4752 | 4756 | udelay(5); |
| 4753 | 4757 | |
| 4754 | 4758 | val = BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | |
| 4755 | 4759 | BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP; |
| 4756 | 4760 | |
| 4757 | − REG_WR(bp, BNX2_PCICFG_MISC_CONFIG, val); | |
| 4761 | + BNX2_WR(bp, BNX2_PCICFG_MISC_CONFIG, val); | |
| 4758 | 4762 | |
| 4759 | 4763 | } else { |
| 4760 | 4764 | val = BNX2_PCICFG_MISC_CONFIG_CORE_RST_REQ | |
| @@ -4762,19 +4766,19 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) · 1 unmodified line | ||
| 4762 | 4766 | BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP; |
| 4763 | 4767 | |
| 4764 | 4768 | /* Chip reset. */ |
| 4765 | − REG_WR(bp, BNX2_PCICFG_MISC_CONFIG, val); | |
| 4769 | + BNX2_WR(bp, BNX2_PCICFG_MISC_CONFIG, val); | |
| 4766 | 4770 | |
| 4767 | 4771 | /* Reading back any register after chip reset will hang the |
| 4768 | 4772 | * bus on 5706 A0 and A1. The msleep below provides plenty |
| 4769 | 4773 | * of margin for write posting. |
| 4770 | 4774 | */ |
| 4771 | − if ((CHIP_ID(bp) == CHIP_ID_5706_A0) || | |
| 4772 | − (CHIP_ID(bp) == CHIP_ID_5706_A1)) | |
| 4775 | + if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) || | |
| 4776 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1)) | |
| 4773 | 4777 | msleep(20); |
| 4774 | 4778 | |
| 4775 | 4779 | /* Reset takes approximate 30 usec */ |
| 4776 | 4780 | for (i = 0; i < 10; i++) { |
| 4777 | − val = REG_RD(bp, BNX2_PCICFG_MISC_CONFIG); | |
| 4781 | + val = BNX2_RD(bp, BNX2_PCICFG_MISC_CONFIG); | |
| 4778 | 4782 | if ((val & (BNX2_PCICFG_MISC_CONFIG_CORE_RST_REQ | |
| 4779 | 4783 | BNX2_PCICFG_MISC_CONFIG_CORE_RST_BSY)) == 0) |
| 4780 | 4784 | break; |
| @@ -4789,7 +4793,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) · 8 unmodified lines | ||
| 4789 | 4793 | } |
| 4790 | 4794 | |
| 4791 | 4795 | /* Make sure byte swapping is properly configured. */ |
| 4792 | − val = REG_RD(bp, BNX2_PCI_SWAP_DIAG0); | |
| 4796 | + val = BNX2_RD(bp, BNX2_PCI_SWAP_DIAG0); | |
| 4793 | 4797 | if (val != 0x01020304) { |
| 4794 | 4798 | pr_err("Chip not in correct endian mode\n"); |
| 4795 | 4799 | return -ENODEV; |
| @@ -4808,10 +4812,10 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) · 12 unmodified lines | ||
| 4808 | 4812 | bnx2_set_default_remote_link(bp); |
| 4809 | 4813 | spin_unlock_bh(&bp->phy_lock); |
| 4810 | 4814 | |
| 4811 | − if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | |
| 4815 | + if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { | |
| 4812 | 4816 | /* Adjust the voltage regular to two steps lower. The default |
| 4813 | 4817 | * of this register is 0x0000000e. */ |
| 4814 | − REG_WR(bp, BNX2_MISC_VREG_CONTROL, 0x000000fa); | |
| 4818 | + BNX2_WR(bp, BNX2_MISC_VREG_CONTROL, 0x000000fa); | |
| 4815 | 4819 | |
| 4816 | 4820 | /* Remove bad rbuf memory from the free pool. */ |
| 4817 | 4821 | rc = bnx2_alloc_bad_rbuf(bp); |
| @@ -4820,7 +4824,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) · 2 unmodified lines | ||
| 4820 | 4824 | if (bp->flags & BNX2_FLAG_USING_MSIX) { |
| 4821 | 4825 | bnx2_setup_msix_tbl(bp); |
| 4822 | 4826 | /* Prevent MSIX table reads and write from timing out */ |
| 4823 | − REG_WR(bp, BNX2_MISC_ECO_HW_CTL, | |
| 4827 | + BNX2_WR(bp, BNX2_MISC_ECO_HW_CTL, | |
| 4824 | 4828 | BNX2_MISC_ECO_HW_CTL_LARGE_GRC_TMOUT_EN); |
| 4825 | 4829 | } |
| 4826 | 4830 | |
| @@ -4834,7 +4838,7 @@ bnx2_init_chip(struct bnx2 *bp) · 7 unmodified lines | ||
| 4834 | 4838 | int rc, i; |
| 4835 | 4839 | |
| 4836 | 4840 | /* Make sure the interrupt is not active. */ |
| 4837 | − REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, BNX2_PCICFG_INT_ACK_CMD_MASK_INT); | |
| 4841 | + BNX2_WR(bp, BNX2_PCICFG_INT_ACK_CMD, BNX2_PCICFG_INT_ACK_CMD_MASK_INT); | |
| 4838 | 4842 | |
| 4839 | 4843 | val = BNX2_DMA_CONFIG_DATA_BYTE_SWAP | |
| 4840 | 4844 | BNX2_DMA_CONFIG_DATA_WORD_SWAP | |
| @@ -4850,16 +4854,17 @@ bnx2_init_chip(struct bnx2 *bp) · 9 unmodified lines | ||
| 4850 | 4854 | if ((bp->flags & BNX2_FLAG_PCIX) && (bp->bus_speed_mhz == 133)) |
| 4851 | 4855 | val |= (1 << 23); |
| 4852 | 4856 | |
| 4853 | − if ((CHIP_NUM(bp) == CHIP_NUM_5706) && | |
| 4854 | − (CHIP_ID(bp) != CHIP_ID_5706_A0) && !(bp->flags & BNX2_FLAG_PCIX)) | |
| 4857 | + if ((BNX2_CHIP(bp) == BNX2_CHIP_5706) && | |
| 4858 | + (BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A0) && | |
| 4859 | + !(bp->flags & BNX2_FLAG_PCIX)) | |
| 4855 | 4860 | val |= BNX2_DMA_CONFIG_CNTL_PING_PONG_DMA; |
| 4856 | 4861 | |
| 4857 | − REG_WR(bp, BNX2_DMA_CONFIG, val); | |
| 4862 | + BNX2_WR(bp, BNX2_DMA_CONFIG, val); | |
| 4858 | 4863 | |
| 4859 | − if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | |
| 4860 | − val = REG_RD(bp, BNX2_TDMA_CONFIG); | |
| 4864 | + if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { | |
| 4865 | + val = BNX2_RD(bp, BNX2_TDMA_CONFIG); | |
| 4861 | 4866 | val |= BNX2_TDMA_CONFIG_ONE_DMA; |
| 4862 | − REG_WR(bp, BNX2_TDMA_CONFIG, val); | |
| 4867 | + BNX2_WR(bp, BNX2_TDMA_CONFIG, val); | |
| 4863 | 4868 | } |
| 4864 | 4869 | |
| 4865 | 4870 | if (bp->flags & BNX2_FLAG_PCIX) { |
| @@ -4871,14 +4876,14 @@ bnx2_init_chip(struct bnx2 *bp) · 5 unmodified lines | ||
| 4871 | 4876 | val16 & ~PCI_X_CMD_ERO); |
| 4872 | 4877 | } |
| 4873 | 4878 | |
| 4874 | − REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, | |
| 4875 | − BNX2_MISC_ENABLE_SET_BITS_HOST_COALESCE_ENABLE | | |
| 4876 | − BNX2_MISC_ENABLE_STATUS_BITS_RX_V2P_ENABLE | | |
| 4877 | − BNX2_MISC_ENABLE_STATUS_BITS_CONTEXT_ENABLE); | |
| 4879 | + BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS, | |
| 4880 | + BNX2_MISC_ENABLE_SET_BITS_HOST_COALESCE_ENABLE | | |
| 4881 | + BNX2_MISC_ENABLE_STATUS_BITS_RX_V2P_ENABLE | | |
| 4882 | + BNX2_MISC_ENABLE_STATUS_BITS_CONTEXT_ENABLE); | |
| 4878 | 4883 | |
| 4879 | 4884 | /* Initialize context mapping and zero out the quick contexts. The |
| 4880 | 4885 | * context block must have already been enabled. */ |
| 4881 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 4886 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 4882 | 4887 | rc = bnx2_init_5709_context(bp); |
| 4883 | 4888 | if (rc) |
| 4884 | 4889 | return rc; |
| @@ -4892,29 +4897,29 @@ bnx2_init_chip(struct bnx2 *bp) · 7 unmodified lines | ||
| 4892 | 4897 | |
| 4893 | 4898 | bnx2_set_mac_addr(bp, bp->dev->dev_addr, 0); |
| 4894 | 4899 | |
| 4895 | − val = REG_RD(bp, BNX2_MQ_CONFIG); | |
| 4900 | + val = BNX2_RD(bp, BNX2_MQ_CONFIG); | |
| 4896 | 4901 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; |
| 4897 | 4902 | val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256; |
| 4898 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 4903 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 4899 | 4904 | val |= BNX2_MQ_CONFIG_BIN_MQ_MODE; |
| 4900 | − if (CHIP_REV(bp) == CHIP_REV_Ax) | |
| 4905 | + if (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax) | |
| 4901 | 4906 | val |= BNX2_MQ_CONFIG_HALT_DIS; |
| 4902 | 4907 | } |
| 4903 | 4908 | |
| 4904 | − REG_WR(bp, BNX2_MQ_CONFIG, val); | |
| 4909 | + BNX2_WR(bp, BNX2_MQ_CONFIG, val); | |
| 4905 | 4910 | |
| 4906 | 4911 | val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE); |
| 4907 | − REG_WR(bp, BNX2_MQ_KNL_BYP_WIND_START, val); | |
| 4908 | − REG_WR(bp, BNX2_MQ_KNL_WIND_END, val); | |
| 4912 | + BNX2_WR(bp, BNX2_MQ_KNL_BYP_WIND_START, val); | |
| 4913 | + BNX2_WR(bp, BNX2_MQ_KNL_WIND_END, val); | |
| 4909 | 4914 | |
| 4910 | − val = (BCM_PAGE_BITS - 8) << 24; | |
| 4911 | − REG_WR(bp, BNX2_RV2P_CONFIG, val); | |
| 4915 | + val = (BNX2_PAGE_BITS - 8) << 24; | |
| 4916 | + BNX2_WR(bp, BNX2_RV2P_CONFIG, val); | |
| 4912 | 4917 | |
| 4913 | 4918 | /* Configure page size. */ |
| 4914 | − val = REG_RD(bp, BNX2_TBDR_CONFIG); | |
| 4919 | + val = BNX2_RD(bp, BNX2_TBDR_CONFIG); | |
| 4915 | 4920 | val &= ~BNX2_TBDR_CONFIG_PAGE_SIZE; |
| 4916 | − val |= (BCM_PAGE_BITS - 8) << 24 | 0x40; | |
| 4917 | − REG_WR(bp, BNX2_TBDR_CONFIG, val); | |
| 4921 | + val |= (BNX2_PAGE_BITS - 8) << 24 | 0x40; | |
| 4922 | + BNX2_WR(bp, BNX2_TBDR_CONFIG, val); | |
| 4918 | 4923 | |
| 4919 | 4924 | val = bp->mac_addr[0] + |
| 4920 | 4925 | (bp->mac_addr[1] << 8) + |
| @@ -4922,14 +4927,14 @@ bnx2_init_chip(struct bnx2 *bp) · 1 unmodified line | ||
| 4922 | 4927 | bp->mac_addr[3] + |
| 4923 | 4928 | (bp->mac_addr[4] << 8) + |
| 4924 | 4929 | (bp->mac_addr[5] << 16); |
| 4925 | − REG_WR(bp, BNX2_EMAC_BACKOFF_SEED, val); | |
| 4930 | + BNX2_WR(bp, BNX2_EMAC_BACKOFF_SEED, val); | |
| 4926 | 4931 | |
| 4927 | 4932 | /* Program the MTU. Also include 4 bytes for CRC32. */ |
| 4928 | 4933 | mtu = bp->dev->mtu; |
| 4929 | 4934 | val = mtu + ETH_HLEN + ETH_FCS_LEN; |
| 4930 | 4935 | if (val > (MAX_ETHERNET_PACKET_SIZE + 4)) |
| 4931 | 4936 | val |= BNX2_EMAC_RX_MTU_SIZE_JUMBO_ENA; |
| 4932 | − REG_WR(bp, BNX2_EMAC_RX_MTU_SIZE, val); | |
| 4937 | + BNX2_WR(bp, BNX2_EMAC_RX_MTU_SIZE, val); | |
| 4933 | 4938 | |
| 4934 | 4939 | if (mtu < 1500) |
| 4935 | 4940 | mtu = 1500; |
| @@ -4947,43 +4952,43 @@ bnx2_init_chip(struct bnx2 *bp) · 11 unmodified lines | ||
| 4947 | 4952 | bp->rx_mode = BNX2_EMAC_RX_MODE_SORT_MODE; |
| 4948 | 4953 | |
| 4949 | 4954 | /* Set up how to generate a link change interrupt. */ |
| 4950 | − REG_WR(bp, BNX2_EMAC_ATTENTION_ENA, BNX2_EMAC_ATTENTION_ENA_LINK); | |
| 4955 | + BNX2_WR(bp, BNX2_EMAC_ATTENTION_ENA, BNX2_EMAC_ATTENTION_ENA_LINK); | |
| 4951 | 4956 | |
| 4952 | − REG_WR(bp, BNX2_HC_STATUS_ADDR_L, | |
| 4953 | − (u64) bp->status_blk_mapping & 0xffffffff); | |
| 4954 | − REG_WR(bp, BNX2_HC_STATUS_ADDR_H, (u64) bp->status_blk_mapping >> 32); | |
| 4957 | + BNX2_WR(bp, BNX2_HC_STATUS_ADDR_L, | |
| 4958 | + (u64) bp->status_blk_mapping & 0xffffffff); | |
| 4959 | + BNX2_WR(bp, BNX2_HC_STATUS_ADDR_H, (u64) bp->status_blk_mapping >> 32); | |
| 4955 | 4960 | |
| 4956 | − REG_WR(bp, BNX2_HC_STATISTICS_ADDR_L, | |
| 4957 | − (u64) bp->stats_blk_mapping & 0xffffffff); | |
| 4958 | − REG_WR(bp, BNX2_HC_STATISTICS_ADDR_H, | |
| 4959 | − (u64) bp->stats_blk_mapping >> 32); | |
| 4961 | + BNX2_WR(bp, BNX2_HC_STATISTICS_ADDR_L, | |
| 4962 | + (u64) bp->stats_blk_mapping & 0xffffffff); | |
| 4963 | + BNX2_WR(bp, BNX2_HC_STATISTICS_ADDR_H, | |
| 4964 | + (u64) bp->stats_blk_mapping >> 32); | |
| 4960 | 4965 | |
| 4961 | − REG_WR(bp, BNX2_HC_TX_QUICK_CONS_TRIP, | |
| 4962 | − (bp->tx_quick_cons_trip_int << 16) | bp->tx_quick_cons_trip); | |
| 4966 | + BNX2_WR(bp, BNX2_HC_TX_QUICK_CONS_TRIP, | |
| 4967 | + (bp->tx_quick_cons_trip_int << 16) | bp->tx_quick_cons_trip); | |
| 4963 | 4968 | |
| 4964 | − REG_WR(bp, BNX2_HC_RX_QUICK_CONS_TRIP, | |
| 4965 | − (bp->rx_quick_cons_trip_int << 16) | bp->rx_quick_cons_trip); | |
| 4969 | + BNX2_WR(bp, BNX2_HC_RX_QUICK_CONS_TRIP, | |
| 4970 | + (bp->rx_quick_cons_trip_int << 16) | bp->rx_quick_cons_trip); | |
| 4966 | 4971 | |
| 4967 | − REG_WR(bp, BNX2_HC_COMP_PROD_TRIP, | |
| 4968 | − (bp->comp_prod_trip_int << 16) | bp->comp_prod_trip); | |
| 4972 | + BNX2_WR(bp, BNX2_HC_COMP_PROD_TRIP, | |
| 4973 | + (bp->comp_prod_trip_int << 16) | bp->comp_prod_trip); | |
| 4969 | 4974 | |
| 4970 | − REG_WR(bp, BNX2_HC_TX_TICKS, (bp->tx_ticks_int << 16) | bp->tx_ticks); | |
| 4975 | + BNX2_WR(bp, BNX2_HC_TX_TICKS, (bp->tx_ticks_int << 16) | bp->tx_ticks); | |
| 4971 | 4976 | |
| 4972 | − REG_WR(bp, BNX2_HC_RX_TICKS, (bp->rx_ticks_int << 16) | bp->rx_ticks); | |
| 4977 | + BNX2_WR(bp, BNX2_HC_RX_TICKS, (bp->rx_ticks_int << 16) | bp->rx_ticks); | |
| 4973 | 4978 | |
| 4974 | − REG_WR(bp, BNX2_HC_COM_TICKS, | |
| 4975 | − (bp->com_ticks_int << 16) | bp->com_ticks); | |
| 4979 | + BNX2_WR(bp, BNX2_HC_COM_TICKS, | |
| 4980 | + (bp->com_ticks_int << 16) | bp->com_ticks); | |
| 4976 | 4981 | |
| 4977 | − REG_WR(bp, BNX2_HC_CMD_TICKS, | |
| 4978 | − (bp->cmd_ticks_int << 16) | bp->cmd_ticks); | |
| 4982 | + BNX2_WR(bp, BNX2_HC_CMD_TICKS, | |
| 4983 | + (bp->cmd_ticks_int << 16) | bp->cmd_ticks); | |
| 4979 | 4984 | |
| 4980 | 4985 | if (bp->flags & BNX2_FLAG_BROKEN_STATS) |
| 4981 | − REG_WR(bp, BNX2_HC_STATS_TICKS, 0); | |
| 4986 | + BNX2_WR(bp, BNX2_HC_STATS_TICKS, 0); | |
| 4982 | 4987 | else |
| 4983 | − REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks); | |
| 4984 | − REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ | |
| 4988 | + BNX2_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks); | |
| 4989 | + BNX2_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ | |
| 4985 | 4990 | |
| 4986 | − if (CHIP_ID(bp) == CHIP_ID_5706_A1) | |
| 4991 | + if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) | |
| 4987 | 4992 | val = BNX2_HC_CONFIG_COLLECT_STATS; |
| 4988 | 4993 | else { |
| 4989 | 4994 | val = BNX2_HC_CONFIG_RX_TMR_MODE | BNX2_HC_CONFIG_TX_TMR_MODE | |
| @@ -4991,8 +4996,8 @@ bnx2_init_chip(struct bnx2 *bp) · 1 unmodified line | ||
| 4991 | 4996 | } |
| 4992 | 4997 | |
| 4993 | 4998 | if (bp->flags & BNX2_FLAG_USING_MSIX) { |
| 4994 | − REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR, | |
| 4995 | − BNX2_HC_MSIX_BIT_VECTOR_VAL); | |
| 4999 | + BNX2_WR(bp, BNX2_HC_MSIX_BIT_VECTOR, | |
| 5000 | + BNX2_HC_MSIX_BIT_VECTOR_VAL); | |
| 4996 | 5001 | |
| 4997 | 5002 | val |= BNX2_HC_CONFIG_SB_ADDR_INC_128B; |
| 4998 | 5003 | } |
| @@ -5000,7 +5005,7 @@ bnx2_init_chip(struct bnx2 *bp) · 1 unmodified line | ||
| 5000 | 5005 | if (bp->flags & BNX2_FLAG_ONE_SHOT_MSI) |
| 5001 | 5006 | val |= BNX2_HC_CONFIG_ONE_SHOT | BNX2_HC_CONFIG_USE_INT_PARAM; |
| 5002 | 5007 | |
| 5003 | − REG_WR(bp, BNX2_HC_CONFIG, val); | |
| 5008 | + BNX2_WR(bp, BNX2_HC_CONFIG, val); | |
| 5004 | 5009 | |
| 5005 | 5010 | if (bp->rx_ticks < 25) |
| 5006 | 5011 | bnx2_reg_wr_ind(bp, BNX2_FW_RX_LOW_LATENCY, 1); |
| @@ -5011,48 +5016,48 @@ bnx2_init_chip(struct bnx2 *bp) · 4 unmodified lines | ||
| 5011 | 5016 | u32 base = ((i - 1) * BNX2_HC_SB_CONFIG_SIZE) + |
| 5012 | 5017 | BNX2_HC_SB_CONFIG_1; |
| 5013 | 5018 | |
| 5014 | − REG_WR(bp, base, | |
| 5019 | + BNX2_WR(bp, base, | |
| 5015 | 5020 | BNX2_HC_SB_CONFIG_1_TX_TMR_MODE | |
| 5016 | 5021 | BNX2_HC_SB_CONFIG_1_RX_TMR_MODE | |
| 5017 | 5022 | BNX2_HC_SB_CONFIG_1_ONE_SHOT); |
| 5018 | 5023 | |
| 5019 | − REG_WR(bp, base + BNX2_HC_TX_QUICK_CONS_TRIP_OFF, | |
| 5024 | + BNX2_WR(bp, base + BNX2_HC_TX_QUICK_CONS_TRIP_OFF, | |
| 5020 | 5025 | (bp->tx_quick_cons_trip_int << 16) | |
| 5021 | 5026 | bp->tx_quick_cons_trip); |
| 5022 | 5027 | |
| 5023 | − REG_WR(bp, base + BNX2_HC_TX_TICKS_OFF, | |
| 5028 | + BNX2_WR(bp, base + BNX2_HC_TX_TICKS_OFF, | |
| 5024 | 5029 | (bp->tx_ticks_int << 16) | bp->tx_ticks); |
| 5025 | 5030 | |
| 5026 | − REG_WR(bp, base + BNX2_HC_RX_QUICK_CONS_TRIP_OFF, | |
| 5027 | − (bp->rx_quick_cons_trip_int << 16) | | |
| 5031 | + BNX2_WR(bp, base + BNX2_HC_RX_QUICK_CONS_TRIP_OFF, | |
| 5032 | + (bp->rx_quick_cons_trip_int << 16) | | |
| 5028 | 5033 | bp->rx_quick_cons_trip); |
| 5029 | 5034 | |
| 5030 | − REG_WR(bp, base + BNX2_HC_RX_TICKS_OFF, | |
| 5035 | + BNX2_WR(bp, base + BNX2_HC_RX_TICKS_OFF, | |
| 5031 | 5036 | (bp->rx_ticks_int << 16) | bp->rx_ticks); |
| 5032 | 5037 | } |
| 5033 | 5038 | |
| 5034 | 5039 | /* Clear internal stats counters. */ |
| 5035 | − REG_WR(bp, BNX2_HC_COMMAND, BNX2_HC_COMMAND_CLR_STAT_NOW); | |
| 5040 | + BNX2_WR(bp, BNX2_HC_COMMAND, BNX2_HC_COMMAND_CLR_STAT_NOW); | |
| 5036 | 5041 | |
| 5037 | − REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_EVENTS); | |
| 5042 | + BNX2_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_EVENTS); | |
| 5038 | 5043 | |
| 5039 | 5044 | /* Initialize the receive filter. */ |
| 5040 | 5045 | bnx2_set_rx_mode(bp->dev); |
| 5041 | 5046 | |
| 5042 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 5043 | − val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL); | |
| 5047 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 5048 | + val = BNX2_RD(bp, BNX2_MISC_NEW_CORE_CTL); | |
| 5044 | 5049 | val |= BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE; |
| 5045 | − REG_WR(bp, BNX2_MISC_NEW_CORE_CTL, val); | |
| 5050 | + BNX2_WR(bp, BNX2_MISC_NEW_CORE_CTL, val); | |
| 5046 | 5051 | } |
| 5047 | 5052 | rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET, |
| 5048 | 5053 | 1, 0); |
| 5049 | 5054 | |
| 5050 | − REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, BNX2_MISC_ENABLE_DEFAULT); | |
| 5051 | − REG_RD(bp, BNX2_MISC_ENABLE_SET_BITS); | |
| 5055 | + BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS, BNX2_MISC_ENABLE_DEFAULT); | |
| 5056 | + BNX2_RD(bp, BNX2_MISC_ENABLE_SET_BITS); | |
| 5052 | 5057 | |
| 5053 | 5058 | udelay(20); |
| 5054 | 5059 | |
| 5055 | − bp->hc_cmd = REG_RD(bp, BNX2_HC_COMMAND); | |
| 5060 | + bp->hc_cmd = BNX2_RD(bp, BNX2_HC_COMMAND); | |
| 5056 | 5061 | |
| 5057 | 5062 | return rc; |
| 5058 | 5063 | } |
| @@ -5086,7 +5091,7 @@ bnx2_init_tx_context(struct bnx2 *bp, u32 cid, struct bnx2_tx_ring_info *txr) · 27 unmodified lines | ||
| 5086 | 5091 | u32 val, offset0, offset1, offset2, offset3; |
| 5087 | 5092 | u32 cid_addr = GET_CID_ADDR(cid); |
| 5088 | 5093 | |
| 5089 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 5094 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 5090 | 5095 | offset0 = BNX2_L2CTX_TYPE_XI; |
| 5091 | 5096 | offset1 = BNX2_L2CTX_CMD_TYPE_XI; |
| 5092 | 5097 | offset2 = BNX2_L2CTX_TBDR_BHADDR_HI_XI; |
| @@ -5113,7 +5118,7 @@ bnx2_init_tx_context(struct bnx2 *bp, u32 cid, struct bnx2_tx_ring_info *txr) · 20 unmodified lines | ||
| 5113 | 5118 | static void |
| 5114 | 5119 | bnx2_init_tx_ring(struct bnx2 *bp, int ring_num) |
| 5115 | 5120 | { |
| 5116 | − struct tx_bd *txbd; | |
| 5121 | + struct bnx2_tx_bd *txbd; | |
| 5117 | 5122 | u32 cid = TX_CID; |
| 5118 | 5123 | struct bnx2_napi *bnapi; |
| 5119 | 5124 | struct bnx2_tx_ring_info *txr; |
| @@ -5128,7 +5133,7 @@ bnx2_init_tx_ring(struct bnx2 *bp, int ring_num) · 8 unmodified lines | ||
| 5128 | 5133 | |
| 5129 | 5134 | bp->tx_wake_thresh = bp->tx_ring_size / 2; |
| 5130 | 5135 | |
| 5131 | − txbd = &txr->tx_desc_ring[MAX_TX_DESC_CNT]; | |
| 5136 | + txbd = &txr->tx_desc_ring[BNX2_MAX_TX_DESC_CNT]; | |
| 5132 | 5137 | |
| 5133 | 5138 | txbd->tx_bd_haddr_hi = (u64) txr->tx_desc_mapping >> 32; |
| 5134 | 5139 | txbd->tx_bd_haddr_lo = (u64) txr->tx_desc_mapping & 0xffffffff; |
| @@ -5143,17 +5148,17 @@ bnx2_init_tx_ring(struct bnx2 *bp, int ring_num) · 8 unmodified lines | ||
| 5143 | 5148 | } |
| 5144 | 5149 | |
| 5145 | 5150 | static void |
| 5146 | −bnx2_init_rxbd_rings(struct rx_bd *rx_ring[], dma_addr_t dma[], u32 buf_size, | |
| 5147 | − int num_rings) | |
| 5151 | +bnx2_init_rxbd_rings(struct bnx2_rx_bd *rx_ring[], dma_addr_t dma[], | |
| 5152 | + u32 buf_size, int num_rings) | |
| 5148 | 5153 | { |
| 5149 | 5154 | int i; |
| 5150 | − struct rx_bd *rxbd; | |
| 5155 | + struct bnx2_rx_bd *rxbd; | |
| 5151 | 5156 | |
| 5152 | 5157 | for (i = 0; i < num_rings; i++) { |
| 5153 | 5158 | int j; |
| 5154 | 5159 | |
| 5155 | 5160 | rxbd = &rx_ring[i][0]; |
| 5156 | − for (j = 0; j < MAX_RX_DESC_CNT; j++, rxbd++) { | |
| 5161 | + for (j = 0; j < BNX2_MAX_RX_DESC_CNT; j++, rxbd++) { | |
| 5157 | 5162 | rxbd->rx_bd_len = buf_size; |
| 5158 | 5163 | rxbd->rx_bd_flags = RX_BD_FLAGS_START | RX_BD_FLAGS_END; |
| 5159 | 5164 | } |
| @@ -5187,9 +5192,9 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num) · 27 unmodified lines | ||
| 5187 | 5192 | |
| 5188 | 5193 | bnx2_init_rx_context(bp, cid); |
| 5189 | 5194 | |
| 5190 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 5191 | − val = REG_RD(bp, BNX2_MQ_MAP_L2_5); | |
| 5192 | − REG_WR(bp, BNX2_MQ_MAP_L2_5, val | BNX2_MQ_MAP_L2_5_ARM); | |
| 5195 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 5196 | + val = BNX2_RD(bp, BNX2_MQ_MAP_L2_5); | |
| 5197 | + BNX2_WR(bp, BNX2_MQ_MAP_L2_5, val | BNX2_MQ_MAP_L2_5_ARM); | |
| 5193 | 5198 | } |
| 5194 | 5199 | |
| 5195 | 5200 | bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, 0); |
| @@ -5208,8 +5213,8 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num) · 12 unmodified lines | ||
| 5208 | 5213 | val = (u64) rxr->rx_pg_desc_mapping[0] & 0xffffffff; |
| 5209 | 5214 | bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_LO, val); |
| 5210 | 5215 | |
| 5211 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 5212 | − REG_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT); | |
| 5216 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 5217 | + BNX2_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT); | |
| 5213 | 5218 | } |
| 5214 | 5219 | |
| 5215 | 5220 | val = (u64) rxr->rx_desc_mapping[0] >> 32; |
| @@ -5225,8 +5230,8 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num) · 9 unmodified lines | ||
| 5225 | 5230 | ring_num, i, bp->rx_pg_ring_size); |
| 5226 | 5231 | break; |
| 5227 | 5232 | } |
| 5228 | − prod = NEXT_RX_BD(prod); | |
| 5229 | − ring_prod = RX_PG_RING_IDX(prod); | |
| 5233 | + prod = BNX2_NEXT_RX_BD(prod); | |
| 5234 | + ring_prod = BNX2_RX_PG_RING_IDX(prod); | |
| 5230 | 5235 | } |
| 5231 | 5236 | rxr->rx_pg_prod = prod; |
| 5232 | 5237 | |
| @@ -5237,8 +5242,8 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num) · 4 unmodified lines | ||
| 5237 | 5242 | ring_num, i, bp->rx_ring_size); |
| 5238 | 5243 | break; |
| 5239 | 5244 | } |
| 5240 | − prod = NEXT_RX_BD(prod); | |
| 5241 | − ring_prod = RX_RING_IDX(prod); | |
| 5245 | + prod = BNX2_NEXT_RX_BD(prod); | |
| 5246 | + ring_prod = BNX2_RX_RING_IDX(prod); | |
| 5242 | 5247 | } |
| 5243 | 5248 | rxr->rx_prod = prod; |
| 5244 | 5249 | |
| @@ -5246,10 +5251,10 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num) · 1 unmodified line | ||
| 5246 | 5251 | rxr->rx_bseq_addr = MB_GET_CID_ADDR(cid) + BNX2_L2CTX_HOST_BSEQ; |
| 5247 | 5252 | rxr->rx_pg_bidx_addr = MB_GET_CID_ADDR(cid) + BNX2_L2CTX_HOST_PG_BDIDX; |
| 5248 | 5253 | |
| 5249 | − REG_WR16(bp, rxr->rx_pg_bidx_addr, rxr->rx_pg_prod); | |
| 5250 | − REG_WR16(bp, rxr->rx_bidx_addr, prod); | |
| 5254 | + BNX2_WR16(bp, rxr->rx_pg_bidx_addr, rxr->rx_pg_prod); | |
| 5255 | + BNX2_WR16(bp, rxr->rx_bidx_addr, prod); | |
| 5251 | 5256 | |
| 5252 | − REG_WR(bp, rxr->rx_bseq_addr, rxr->rx_prod_bseq); | |
| 5257 | + BNX2_WR(bp, rxr->rx_bseq_addr, rxr->rx_prod_bseq); | |
| 5253 | 5258 | } |
| 5254 | 5259 | |
| 5255 | 5260 | static void |
| @@ -5260,15 +5265,15 @@ bnx2_init_all_rings(struct bnx2 *bp) · 4 unmodified lines | ||
| 5260 | 5265 | |
| 5261 | 5266 | bnx2_clear_ring_states(bp); |
| 5262 | 5267 | |
| 5263 | − REG_WR(bp, BNX2_TSCH_TSS_CFG, 0); | |
| 5268 | + BNX2_WR(bp, BNX2_TSCH_TSS_CFG, 0); | |
| 5264 | 5269 | for (i = 0; i < bp->num_tx_rings; i++) |
| 5265 | 5270 | bnx2_init_tx_ring(bp, i); |
| 5266 | 5271 | |
| 5267 | 5272 | if (bp->num_tx_rings > 1) |
| 5268 | − REG_WR(bp, BNX2_TSCH_TSS_CFG, ((bp->num_tx_rings - 1) << 24) | | |
| 5269 | − (TX_TSS_CID << 7)); | |
| 5273 | + BNX2_WR(bp, BNX2_TSCH_TSS_CFG, ((bp->num_tx_rings - 1) << 24) | | |
| 5274 | + (TX_TSS_CID << 7)); | |
| 5270 | 5275 | |
| 5271 | − REG_WR(bp, BNX2_RLUP_RSS_CONFIG, 0); | |
| 5276 | + BNX2_WR(bp, BNX2_RLUP_RSS_CONFIG, 0); | |
| 5272 | 5277 | bnx2_reg_wr_ind(bp, BNX2_RXP_SCRATCH_RSS_TBL_SZ, 0); |
| 5273 | 5278 | |
| 5274 | 5279 | for (i = 0; i < bp->num_rx_rings; i++) |
| @@ -5282,8 +5287,8 @@ bnx2_init_all_rings(struct bnx2 *bp) · 7 unmodified lines | ||
| 5282 | 5287 | |
| 5283 | 5288 | tbl_32 |= (i % (bp->num_rx_rings - 1)) << shift; |
| 5284 | 5289 | if ((i % 8) == 7) { |
| 5285 | − REG_WR(bp, BNX2_RLUP_RSS_DATA, tbl_32); | |
| 5286 | − REG_WR(bp, BNX2_RLUP_RSS_COMMAND, (i >> 3) | | |
| 5290 | + BNX2_WR(bp, BNX2_RLUP_RSS_DATA, tbl_32); | |
| 5291 | + BNX2_WR(bp, BNX2_RLUP_RSS_COMMAND, (i >> 3) | | |
| 5287 | 5292 | BNX2_RLUP_RSS_COMMAND_RSS_WRITE_MASK | |
| 5288 | 5293 | BNX2_RLUP_RSS_COMMAND_WRITE | |
| 5289 | 5294 | BNX2_RLUP_RSS_COMMAND_HASH_MASK); |
| @@ -5294,7 +5299,7 @@ bnx2_init_all_rings(struct bnx2 *bp) · 4 unmodified lines | ||
| 5294 | 5299 | val = BNX2_RLUP_RSS_CONFIG_IPV4_RSS_TYPE_ALL_XI | |
| 5295 | 5300 | BNX2_RLUP_RSS_CONFIG_IPV6_RSS_TYPE_ALL_XI; |
| 5296 | 5301 | |
| 5297 | − REG_WR(bp, BNX2_RLUP_RSS_CONFIG, val); | |
| 5302 | + BNX2_WR(bp, BNX2_RLUP_RSS_CONFIG, val); | |
| 5298 | 5303 | |
| 5299 | 5304 | } |
| 5300 | 5305 | } |
| @@ -5303,8 +5308,8 @@ static u32 bnx2_find_max_ring(u32 ring_size, u32 max_size) · 2 unmodified lines | ||
| 5303 | 5308 | { |
| 5304 | 5309 | u32 max, num_rings = 1; |
| 5305 | 5310 | |
| 5306 | − while (ring_size > MAX_RX_DESC_CNT) { | |
| 5307 | − ring_size -= MAX_RX_DESC_CNT; | |
| 5311 | + while (ring_size > BNX2_MAX_RX_DESC_CNT) { | |
| 5312 | + ring_size -= BNX2_MAX_RX_DESC_CNT; | |
| 5308 | 5313 | num_rings++; |
| 5309 | 5314 | } |
| 5310 | 5315 | /* round to next power of 2 */ |
| @@ -5337,13 +5342,14 @@ bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size) · 26 unmodified lines | ||
| 5337 | 5342 | int pages = PAGE_ALIGN(bp->dev->mtu - 40) >> PAGE_SHIFT; |
| 5338 | 5343 | |
| 5339 | 5344 | jumbo_size = size * pages; |
| 5340 | − if (jumbo_size > MAX_TOTAL_RX_PG_DESC_CNT) | |
| 5341 | − jumbo_size = MAX_TOTAL_RX_PG_DESC_CNT; | |
| 5345 | + if (jumbo_size > BNX2_MAX_TOTAL_RX_PG_DESC_CNT) | |
| 5346 | + jumbo_size = BNX2_MAX_TOTAL_RX_PG_DESC_CNT; | |
| 5342 | 5347 | |
| 5343 | 5348 | bp->rx_pg_ring_size = jumbo_size; |
| 5344 | 5349 | bp->rx_max_pg_ring = bnx2_find_max_ring(jumbo_size, |
| 5345 | − MAX_RX_PG_RINGS); | |
| 5346 | − bp->rx_max_pg_ring_idx = (bp->rx_max_pg_ring * RX_DESC_CNT) - 1; | |
| 5350 | + BNX2_MAX_RX_PG_RINGS); | |
| 5351 | + bp->rx_max_pg_ring_idx = | |
| 5352 | + (bp->rx_max_pg_ring * BNX2_RX_DESC_CNT) - 1; | |
| 5347 | 5353 | rx_size = BNX2_RX_COPY_THRESH + BNX2_RX_OFFSET; |
| 5348 | 5354 | bp->rx_copy_thresh = 0; |
| 5349 | 5355 | } |
| @@ -5354,8 +5360,8 @@ bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size) · 4 unmodified lines | ||
| 5354 | 5360 | NET_SKB_PAD + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); |
| 5355 | 5361 | bp->rx_jumbo_thresh = rx_size - BNX2_RX_OFFSET; |
| 5356 | 5362 | bp->rx_ring_size = size; |
| 5357 | − bp->rx_max_ring = bnx2_find_max_ring(size, MAX_RX_RINGS); | |
| 5358 | − bp->rx_max_ring_idx = (bp->rx_max_ring * RX_DESC_CNT) - 1; | |
| 5363 | + bp->rx_max_ring = bnx2_find_max_ring(size, BNX2_MAX_RX_RINGS); | |
| 5364 | + bp->rx_max_ring_idx = (bp->rx_max_ring * BNX2_RX_DESC_CNT) - 1; | |
| 5359 | 5365 | } |
| 5360 | 5366 | |
| 5361 | 5367 | static void |
| @@ -5371,13 +5377,13 @@ bnx2_free_tx_skbs(struct bnx2 *bp) · 9 unmodified lines | ||
| 5371 | 5377 | if (txr->tx_buf_ring == NULL) |
| 5372 | 5378 | continue; |
| 5373 | 5379 | |
| 5374 | − for (j = 0; j < TX_DESC_CNT; ) { | |
| 5375 | − struct sw_tx_bd *tx_buf = &txr->tx_buf_ring[j]; | |
| 5380 | + for (j = 0; j < BNX2_TX_DESC_CNT; ) { | |
| 5381 | + struct bnx2_sw_tx_bd *tx_buf = &txr->tx_buf_ring[j]; | |
| 5376 | 5382 | struct sk_buff *skb = tx_buf->skb; |
| 5377 | 5383 | int k, last; |
| 5378 | 5384 | |
| 5379 | 5385 | if (skb == NULL) { |
| 5380 | − j = NEXT_TX_BD(j); | |
| 5386 | + j = BNX2_NEXT_TX_BD(j); | |
| 5381 | 5387 | continue; |
| 5382 | 5388 | } |
| 5383 | 5389 | |
| @@ -5389,9 +5395,9 @@ bnx2_free_tx_skbs(struct bnx2 *bp) · 5 unmodified lines | ||
| 5389 | 5395 | tx_buf->skb = NULL; |
| 5390 | 5396 | |
| 5391 | 5397 | last = tx_buf->nr_frags; |
| 5392 | − j = NEXT_TX_BD(j); | |
| 5393 | − for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) { | |
| 5394 | − tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; | |
| 5398 | + j = BNX2_NEXT_TX_BD(j); | |
| 5399 | + for (k = 0; k < last; k++, j = BNX2_NEXT_TX_BD(j)) { | |
| 5400 | + tx_buf = &txr->tx_buf_ring[BNX2_TX_RING_IDX(j)]; | |
| 5395 | 5401 | dma_unmap_page(&bp->pdev->dev, |
| 5396 | 5402 | dma_unmap_addr(tx_buf, mapping), |
| 5397 | 5403 | skb_frag_size(&skb_shinfo(skb)->frags[k]), |
| @@ -5417,7 +5423,7 @@ bnx2_free_rx_skbs(struct bnx2 *bp) · 19 unmodified lines | ||
| 5417 | 5423 | return; |
| 5418 | 5424 | |
| 5419 | 5425 | for (j = 0; j < bp->rx_max_ring_idx; j++) { |
| 5420 | − struct sw_bd *rx_buf = &rxr->rx_buf_ring[j]; | |
| 5426 | + struct bnx2_sw_bd *rx_buf = &rxr->rx_buf_ring[j]; | |
| 5421 | 5427 | u8 *data = rx_buf->data; |
| 5422 | 5428 | |
| 5423 | 5429 | if (data == NULL) |
| @@ -5615,7 +5621,7 @@ bnx2_test_registers(struct bnx2 *bp) · 191 unmodified lines | ||
| 5615 | 5621 | |
| 5616 | 5622 | ret = 0; |
| 5617 | 5623 | is_5709 = 0; |
| 5618 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 5624 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 5619 | 5625 | is_5709 = 1; |
| 5620 | 5626 | |
| 5621 | 5627 | for (i = 0; reg_tbl[i].offset != 0xffff; i++) { |
| @@ -5714,7 +5720,7 @@ bnx2_test_memory(struct bnx2 *bp) · 92 unmodified lines | ||
| 5714 | 5720 | }; |
| 5715 | 5721 | struct mem_entry *mem_tbl; |
| 5716 | 5722 | |
| 5717 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 5723 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 5718 | 5724 | mem_tbl = mem_tbl_5709; |
| 5719 | 5725 | else |
| 5720 | 5726 | mem_tbl = mem_tbl_5706; |
| @@ -5741,8 +5747,8 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) · 20 unmodified lines | ||
| 5741 | 5747 | unsigned char *packet; |
| 5742 | 5748 | u16 rx_start_idx, rx_idx; |
| 5743 | 5749 | dma_addr_t map; |
| 5744 | − struct tx_bd *txbd; | |
| 5745 | − struct sw_bd *rx_buf; | |
| 5750 | + struct bnx2_tx_bd *txbd; | |
| 5751 | + struct bnx2_sw_bd *rx_buf; | |
| 5746 | 5752 | struct l2_fhdr *rx_hdr; |
| 5747 | 5753 | int ret = -ENODEV; |
| 5748 | 5754 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0], *tx_napi; |
| @@ -5784,17 +5790,17 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) · 35 unmodified lines | ||
| 5784 | 5790 | return -EIO; |
| 5785 | 5791 | } |
| 5786 | 5792 | |
| 5787 | − REG_WR(bp, BNX2_HC_COMMAND, | |
| 5788 | − bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW_WO_INT); | |
| 5793 | + BNX2_WR(bp, BNX2_HC_COMMAND, | |
| 5794 | + bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW_WO_INT); | |
| 5789 | 5795 | |
| 5790 | − REG_RD(bp, BNX2_HC_COMMAND); | |
| 5796 | + BNX2_RD(bp, BNX2_HC_COMMAND); | |
| 5791 | 5797 | |
| 5792 | 5798 | udelay(5); |
| 5793 | 5799 | rx_start_idx = bnx2_get_hw_rx_cons(bnapi); |
| 5794 | 5800 | |
| 5795 | 5801 | num_pkts = 0; |
| 5796 | 5802 | |
| 5797 | − txbd = &txr->tx_desc_ring[TX_RING_IDX(txr->tx_prod)]; | |
| 5803 | + txbd = &txr->tx_desc_ring[BNX2_TX_RING_IDX(txr->tx_prod)]; | |
| 5798 | 5804 | |
| 5799 | 5805 | txbd->tx_bd_haddr_hi = (u64) map >> 32; |
| 5800 | 5806 | txbd->tx_bd_haddr_lo = (u64) map & 0xffffffff; |
| @@ -5802,18 +5808,18 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) · 1 unmodified line | ||
| 5802 | 5808 | txbd->tx_bd_vlan_tag_flags = TX_BD_FLAGS_START | TX_BD_FLAGS_END; |
| 5803 | 5809 | |
| 5804 | 5810 | num_pkts++; |
| 5805 | − txr->tx_prod = NEXT_TX_BD(txr->tx_prod); | |
| 5811 | + txr->tx_prod = BNX2_NEXT_TX_BD(txr->tx_prod); | |
| 5806 | 5812 | txr->tx_prod_bseq += pkt_size; |
| 5807 | 5813 | |
| 5808 | − REG_WR16(bp, txr->tx_bidx_addr, txr->tx_prod); | |
| 5809 | − REG_WR(bp, txr->tx_bseq_addr, txr->tx_prod_bseq); | |
| 5814 | + BNX2_WR16(bp, txr->tx_bidx_addr, txr->tx_prod); | |
| 5815 | + BNX2_WR(bp, txr->tx_bseq_addr, txr->tx_prod_bseq); | |
| 5810 | 5816 | |
| 5811 | 5817 | udelay(100); |
| 5812 | 5818 | |
| 5813 | − REG_WR(bp, BNX2_HC_COMMAND, | |
| 5814 | − bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW_WO_INT); | |
| 5819 | + BNX2_WR(bp, BNX2_HC_COMMAND, | |
| 5820 | + bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW_WO_INT); | |
| 5815 | 5821 | |
| 5816 | − REG_RD(bp, BNX2_HC_COMMAND); | |
| 5822 | + BNX2_RD(bp, BNX2_HC_COMMAND); | |
| 5817 | 5823 | |
| 5818 | 5824 | udelay(5); |
| 5819 | 5825 | |
| @@ -5962,14 +5968,14 @@ bnx2_test_intr(struct bnx2 *bp) · 142 unmodified lines | ||
| 5962 | 5968 | if (!netif_running(bp->dev)) |
| 5963 | 5969 | return -ENODEV; |
| 5964 | 5970 | |
| 5965 | − status_idx = REG_RD(bp, BNX2_PCICFG_INT_ACK_CMD) & 0xffff; | |
| 5971 | + status_idx = BNX2_RD(bp, BNX2_PCICFG_INT_ACK_CMD) & 0xffff; | |
| 5966 | 5972 | |
| 5967 | 5973 | /* This register is not touched during run-time. */ |
| 5968 | − REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW); | |
| 5969 | − REG_RD(bp, BNX2_HC_COMMAND); | |
| 5974 | + BNX2_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW); | |
| 5975 | + BNX2_RD(bp, BNX2_HC_COMMAND); | |
| 5970 | 5976 | |
| 5971 | 5977 | for (i = 0; i < 10; i++) { |
| 5972 | − if ((REG_RD(bp, BNX2_PCICFG_INT_ACK_CMD) & 0xffff) != | |
| 5978 | + if ((BNX2_RD(bp, BNX2_PCICFG_INT_ACK_CMD) & 0xffff) != | |
| 5973 | 5979 | status_idx) { |
| 5974 | 5980 | |
| 5975 | 5981 | break; |
| @@ -6132,11 +6138,11 @@ bnx2_timer(unsigned long data) · 156 unmodified lines | ||
| 6132 | 6138 | |
| 6133 | 6139 | /* workaround occasional corrupted counters */ |
| 6134 | 6140 | if ((bp->flags & BNX2_FLAG_BROKEN_STATS) && bp->stats_ticks) |
| 6135 | − REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | | |
| 6136 | − BNX2_HC_COMMAND_STATS_NOW); | |
| 6141 | + BNX2_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | | |
| 6142 | + BNX2_HC_COMMAND_STATS_NOW); | |
| 6137 | 6143 | |
| 6138 | 6144 | if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { |
| 6139 | − if (CHIP_NUM(bp) == CHIP_NUM_5706) | |
| 6145 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5706) | |
| 6140 | 6146 | bnx2_5706_serdes_timer(bp); |
| 6141 | 6147 | else |
| 6142 | 6148 | bnx2_5708_serdes_timer(bp); |
| @@ -6205,13 +6211,13 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs) · 62 unmodified lines | ||
| 6205 | 6211 | const int len = sizeof(bp->irq_tbl[0].name); |
| 6206 | 6212 | |
| 6207 | 6213 | bnx2_setup_msix_tbl(bp); |
| 6208 | − REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1); | |
| 6209 | − REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE); | |
| 6210 | − REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE); | |
| 6214 | + BNX2_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1); | |
| 6215 | + BNX2_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE); | |
| 6216 | + BNX2_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE); | |
| 6211 | 6217 | |
| 6212 | 6218 | /* Need to flush the previous three writes to ensure MSI-X |
| 6213 | 6219 | * is setup properly */ |
| 6214 | − REG_RD(bp, BNX2_PCI_MSIX_CONTROL); | |
| 6220 | + BNX2_RD(bp, BNX2_PCI_MSIX_CONTROL); | |
| 6215 | 6221 | |
| 6216 | 6222 | for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) { |
| 6217 | 6223 | msix_ent[i].entry = i; |
| @@ -6274,7 +6280,7 @@ bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi) · 56 unmodified lines | ||
| 6274 | 6280 | !(bp->flags & BNX2_FLAG_USING_MSIX)) { |
| 6275 | 6281 | if (pci_enable_msi(bp->pdev) == 0) { |
| 6276 | 6282 | bp->flags |= BNX2_FLAG_USING_MSI; |
| 6277 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 6283 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 6278 | 6284 | bp->flags |= BNX2_FLAG_ONE_SHOT_MSI; |
| 6279 | 6285 | bp->irq_tbl[0].handler = bnx2_msi_1shot; |
| 6280 | 6286 | } else |
| @@ -6464,22 +6470,22 @@ bnx2_dump_ftq(struct bnx2 *bp) · 183 unmodified lines | ||
| 6464 | 6470 | netdev_err(dev, "<--- end FTQ dump --->\n"); |
| 6465 | 6471 | netdev_err(dev, "<--- start TBDC dump --->\n"); |
| 6466 | 6472 | netdev_err(dev, "TBDC free cnt: %ld\n", |
| 6467 | − REG_RD(bp, BNX2_TBDC_STATUS) & BNX2_TBDC_STATUS_FREE_CNT); | |
| 6473 | + BNX2_RD(bp, BNX2_TBDC_STATUS) & BNX2_TBDC_STATUS_FREE_CNT); | |
| 6468 | 6474 | netdev_err(dev, "LINE CID BIDX CMD VALIDS\n"); |
| 6469 | 6475 | for (i = 0; i < 0x20; i++) { |
| 6470 | 6476 | int j = 0; |
| 6471 | 6477 | |
| 6472 | − REG_WR(bp, BNX2_TBDC_BD_ADDR, i); | |
| 6473 | − REG_WR(bp, BNX2_TBDC_CAM_OPCODE, | |
| 6474 | − BNX2_TBDC_CAM_OPCODE_OPCODE_CAM_READ); | |
| 6475 | − REG_WR(bp, BNX2_TBDC_COMMAND, BNX2_TBDC_COMMAND_CMD_REG_ARB); | |
| 6476 | − while ((REG_RD(bp, BNX2_TBDC_COMMAND) & | |
| 6478 | + BNX2_WR(bp, BNX2_TBDC_BD_ADDR, i); | |
| 6479 | + BNX2_WR(bp, BNX2_TBDC_CAM_OPCODE, | |
| 6480 | + BNX2_TBDC_CAM_OPCODE_OPCODE_CAM_READ); | |
| 6481 | + BNX2_WR(bp, BNX2_TBDC_COMMAND, BNX2_TBDC_COMMAND_CMD_REG_ARB); | |
| 6482 | + while ((BNX2_RD(bp, BNX2_TBDC_COMMAND) & | |
| 6477 | 6483 | BNX2_TBDC_COMMAND_CMD_REG_ARB) && j < 100) |
| 6478 | 6484 | j++; |
| 6479 | 6485 | |
| 6480 | − cid = REG_RD(bp, BNX2_TBDC_CID); | |
| 6481 | − bdidx = REG_RD(bp, BNX2_TBDC_BIDX); | |
| 6482 | − valid = REG_RD(bp, BNX2_TBDC_CAM_OPCODE); | |
| 6486 | + cid = BNX2_RD(bp, BNX2_TBDC_CID); | |
| 6487 | + bdidx = BNX2_RD(bp, BNX2_TBDC_BIDX); | |
| 6488 | + valid = BNX2_RD(bp, BNX2_TBDC_CAM_OPCODE); | |
| 6483 | 6489 | netdev_err(dev, "%02x %06x %04lx %02x [%x]\n", |
| 6484 | 6490 | i, cid, bdidx & BNX2_TBDC_BDIDX_BDIDX, |
| 6485 | 6491 | bdidx >> 24, (valid >> 8) & 0x0ff); |
| @@ -6500,15 +6506,15 @@ bnx2_dump_state(struct bnx2 *bp) · 14 unmodified lines | ||
| 6500 | 6506 | pci_read_config_dword(bp->pdev, BNX2_PCICFG_MISC_CONFIG, &val2); |
| 6501 | 6507 | netdev_err(dev, "DEBUG: PCI_PM[%08x] PCI_MISC_CFG[%08x]\n", val1, val2); |
| 6502 | 6508 | netdev_err(dev, "DEBUG: EMAC_TX_STATUS[%08x] EMAC_RX_STATUS[%08x]\n", |
| 6503 | − REG_RD(bp, BNX2_EMAC_TX_STATUS), | |
| 6504 | − REG_RD(bp, BNX2_EMAC_RX_STATUS)); | |
| 6509 | + BNX2_RD(bp, BNX2_EMAC_TX_STATUS), | |
| 6510 | + BNX2_RD(bp, BNX2_EMAC_RX_STATUS)); | |
| 6505 | 6511 | netdev_err(dev, "DEBUG: RPM_MGMT_PKT_CTRL[%08x]\n", |
| 6506 | − REG_RD(bp, BNX2_RPM_MGMT_PKT_CTRL)); | |
| 6512 | + BNX2_RD(bp, BNX2_RPM_MGMT_PKT_CTRL)); | |
| 6507 | 6513 | netdev_err(dev, "DEBUG: HC_STATS_INTERRUPT_STATUS[%08x]\n", |
| 6508 | − REG_RD(bp, BNX2_HC_STATS_INTERRUPT_STATUS)); | |
| 6514 | + BNX2_RD(bp, BNX2_HC_STATS_INTERRUPT_STATUS)); | |
| 6509 | 6515 | if (bp->flags & BNX2_FLAG_USING_MSIX) |
| 6510 | 6516 | netdev_err(dev, "DEBUG: PBA[%08x]\n", |
| 6511 | − REG_RD(bp, BNX2_PCI_GRC_WINDOW3_BASE)); | |
| 6517 | + BNX2_RD(bp, BNX2_PCI_GRC_WINDOW3_BASE)); | |
| 6512 | 6518 | } |
| 6513 | 6519 | |
| 6514 | 6520 | static void |
| @@ -6533,8 +6539,8 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) · 18 unmodified lines | ||
| 6533 | 6539 | { |
| 6534 | 6540 | struct bnx2 *bp = netdev_priv(dev); |
| 6535 | 6541 | dma_addr_t mapping; |
| 6536 | − struct tx_bd *txbd; | |
| 6537 | − struct sw_tx_bd *tx_buf; | |
| 6542 | + struct bnx2_tx_bd *txbd; | |
| 6543 | + struct bnx2_sw_tx_bd *tx_buf; | |
| 6538 | 6544 | u32 len, vlan_tag_flags, last_frag, mss; |
| 6539 | 6545 | u16 prod, ring_prod; |
| 6540 | 6546 | int i; |
| @@ -6557,7 +6563,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) · 16 unmodified lines | ||
| 6557 | 6563 | } |
| 6558 | 6564 | len = skb_headlen(skb); |
| 6559 | 6565 | prod = txr->tx_prod; |
| 6560 | − ring_prod = TX_RING_IDX(prod); | |
| 6566 | + ring_prod = BNX2_TX_RING_IDX(prod); | |
| 6561 | 6567 | |
| 6562 | 6568 | vlan_tag_flags = 0; |
| 6563 | 6569 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
| @@ -6627,8 +6633,8 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) · 63 unmodified lines | ||
| 6627 | 6633 | for (i = 0; i < last_frag; i++) { |
| 6628 | 6634 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
| 6629 | 6635 | |
| 6630 | − prod = NEXT_TX_BD(prod); | |
| 6631 | − ring_prod = TX_RING_IDX(prod); | |
| 6636 | + prod = BNX2_NEXT_TX_BD(prod); | |
| 6637 | + ring_prod = BNX2_TX_RING_IDX(prod); | |
| 6632 | 6638 | txbd = &txr->tx_desc_ring[ring_prod]; |
| 6633 | 6639 | |
| 6634 | 6640 | len = skb_frag_size(frag); |
| @@ -6652,11 +6658,11 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) · 17 unmodified lines | ||
| 6652 | 6658 | |
| 6653 | 6659 | netdev_tx_sent_queue(txq, skb->len); |
| 6654 | 6660 | |
| 6655 | − prod = NEXT_TX_BD(prod); | |
| 6661 | + prod = BNX2_NEXT_TX_BD(prod); | |
| 6656 | 6662 | txr->tx_prod_bseq += skb->len; |
| 6657 | 6663 | |
| 6658 | − REG_WR16(bp, txr->tx_bidx_addr, prod); | |
| 6659 | − REG_WR(bp, txr->tx_bseq_addr, txr->tx_prod_bseq); | |
| 6664 | + BNX2_WR16(bp, txr->tx_bidx_addr, prod); | |
| 6665 | + BNX2_WR(bp, txr->tx_bseq_addr, txr->tx_prod_bseq); | |
| 6660 | 6666 | |
| 6661 | 6667 | mmiowb(); |
| 6662 | 6668 | |
| @@ -6682,7 +6688,7 @@ dma_error: · 19 unmodified lines | ||
| 6682 | 6688 | |
| 6683 | 6689 | /* start back at beginning and unmap skb */ |
| 6684 | 6690 | prod = txr->tx_prod; |
| 6685 | − ring_prod = TX_RING_IDX(prod); | |
| 6691 | + ring_prod = BNX2_TX_RING_IDX(prod); | |
| 6686 | 6692 | tx_buf = &txr->tx_buf_ring[ring_prod]; |
| 6687 | 6693 | tx_buf->skb = NULL; |
| 6688 | 6694 | dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(tx_buf, mapping), |
| @@ -6690,8 +6696,8 @@ dma_error: · 1 unmodified line | ||
| 6690 | 6696 | |
| 6691 | 6697 | /* unmap remaining mapped pages */ |
| 6692 | 6698 | for (i = 0; i < last_frag; i++) { |
| 6693 | − prod = NEXT_TX_BD(prod); | |
| 6694 | − ring_prod = TX_RING_IDX(prod); | |
| 6699 | + prod = BNX2_NEXT_TX_BD(prod); | |
| 6700 | + ring_prod = BNX2_TX_RING_IDX(prod); | |
| 6695 | 6701 | tx_buf = &txr->tx_buf_ring[ring_prod]; |
| 6696 | 6702 | dma_unmap_page(&bp->pdev->dev, dma_unmap_addr(tx_buf, mapping), |
| 6697 | 6703 | skb_frag_size(&skb_shinfo(skb)->frags[i]), |
| @@ -6810,8 +6816,8 @@ bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats) · 112 unmodified lines | ||
| 6810 | 6816 | GET_32BIT_NET_STATS(stat_Dot3StatsExcessiveCollisions) + |
| 6811 | 6817 | GET_32BIT_NET_STATS(stat_Dot3StatsLateCollisions); |
| 6812 | 6818 | |
| 6813 | − if ((CHIP_NUM(bp) == CHIP_NUM_5706) || | |
| 6814 | − (CHIP_ID(bp) == CHIP_ID_5708_A0)) | |
| 6819 | + if ((BNX2_CHIP(bp) == BNX2_CHIP_5706) || | |
| 6820 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0)) | |
| 6815 | 6821 | net_stats->tx_carrier_errors = 0; |
| 6816 | 6822 | else { |
| 6817 | 6823 | net_stats->tx_carrier_errors = |
| @@ -7030,7 +7036,7 @@ bnx2_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p) · 212 unmodified lines | ||
| 7030 | 7036 | offset = reg_boundaries[0]; |
| 7031 | 7037 | p += offset; |
| 7032 | 7038 | while (offset < BNX2_REGDUMP_LEN) { |
| 7033 | − *p++ = REG_RD(bp, offset); | |
| 7039 | + *p++ = BNX2_RD(bp, offset); | |
| 7034 | 7040 | offset += 4; |
| 7035 | 7041 | if (offset == reg_boundaries[i + 1]) { |
| 7036 | 7042 | offset = reg_boundaries[i + 2]; |
| @@ -7254,13 +7260,13 @@ bnx2_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) · 217 unmodified lines | ||
| 7254 | 7260 | { |
| 7255 | 7261 | struct bnx2 *bp = netdev_priv(dev); |
| 7256 | 7262 | |
| 7257 | − ering->rx_max_pending = MAX_TOTAL_RX_DESC_CNT; | |
| 7258 | − ering->rx_jumbo_max_pending = MAX_TOTAL_RX_PG_DESC_CNT; | |
| 7263 | + ering->rx_max_pending = BNX2_MAX_TOTAL_RX_DESC_CNT; | |
| 7264 | + ering->rx_jumbo_max_pending = BNX2_MAX_TOTAL_RX_PG_DESC_CNT; | |
| 7259 | 7265 | |
| 7260 | 7266 | ering->rx_pending = bp->rx_ring_size; |
| 7261 | 7267 | ering->rx_jumbo_pending = bp->rx_pg_ring_size; |
| 7262 | 7268 | |
| 7263 | − ering->tx_max_pending = MAX_TX_DESC_CNT; | |
| 7269 | + ering->tx_max_pending = BNX2_MAX_TX_DESC_CNT; | |
| 7264 | 7270 | ering->tx_pending = bp->tx_ring_size; |
| 7265 | 7271 | } |
| 7266 | 7272 | |
| @@ -7326,8 +7332,8 @@ bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) · 59 unmodified lines | ||
| 7326 | 7332 | struct bnx2 *bp = netdev_priv(dev); |
| 7327 | 7333 | int rc; |
| 7328 | 7334 | |
| 7329 | − if ((ering->rx_pending > MAX_TOTAL_RX_DESC_CNT) || | |
| 7330 | − (ering->tx_pending > MAX_TX_DESC_CNT) || | |
| 7335 | + if ((ering->rx_pending > BNX2_MAX_TOTAL_RX_DESC_CNT) || | |
| 7336 | + (ering->tx_pending > BNX2_MAX_TX_DESC_CNT) || | |
| 7331 | 7337 | (ering->tx_pending <= MAX_SKB_FRAGS)) { |
| 7332 | 7338 | |
| 7333 | 7339 | return -EINVAL; |
| @@ -7614,10 +7620,10 @@ bnx2_get_ethtool_stats(struct net_device *dev, · 280 unmodified lines | ||
| 7614 | 7620 | return; |
| 7615 | 7621 | } |
| 7616 | 7622 | |
| 7617 | − if ((CHIP_ID(bp) == CHIP_ID_5706_A0) || | |
| 7618 | − (CHIP_ID(bp) == CHIP_ID_5706_A1) || | |
| 7619 | − (CHIP_ID(bp) == CHIP_ID_5706_A2) || | |
| 7620 | − (CHIP_ID(bp) == CHIP_ID_5708_A0)) | |
| 7623 | + if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) || | |
| 7624 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) || | |
| 7625 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A2) || | |
| 7626 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0)) | |
| 7621 | 7627 | stats_len_arr = bnx2_5706_stats_len_arr; |
| 7622 | 7628 | else |
| 7623 | 7629 | stats_len_arr = bnx2_5708_stats_len_arr; |
| @@ -7655,26 +7661,26 @@ bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state) · 31 unmodified lines | ||
| 7655 | 7661 | case ETHTOOL_ID_ACTIVE: |
| 7656 | 7662 | bnx2_set_power_state(bp, PCI_D0); |
| 7657 | 7663 | |
| 7658 | − bp->leds_save = REG_RD(bp, BNX2_MISC_CFG); | |
| 7659 | − REG_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC); | |
| 7664 | + bp->leds_save = BNX2_RD(bp, BNX2_MISC_CFG); | |
| 7665 | + BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC); | |
| 7660 | 7666 | return 1; /* cycle on/off once per second */ |
| 7661 | 7667 | |
| 7662 | 7668 | case ETHTOOL_ID_ON: |
| 7663 | − REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE | | |
| 7664 | − BNX2_EMAC_LED_1000MB_OVERRIDE | | |
| 7665 | − BNX2_EMAC_LED_100MB_OVERRIDE | | |
| 7666 | − BNX2_EMAC_LED_10MB_OVERRIDE | | |
| 7667 | − BNX2_EMAC_LED_TRAFFIC_OVERRIDE | | |
| 7668 | − BNX2_EMAC_LED_TRAFFIC); | |
| 7669 | + BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE | | |
| 7670 | + BNX2_EMAC_LED_1000MB_OVERRIDE | | |
| 7671 | + BNX2_EMAC_LED_100MB_OVERRIDE | | |
| 7672 | + BNX2_EMAC_LED_10MB_OVERRIDE | | |
| 7673 | + BNX2_EMAC_LED_TRAFFIC_OVERRIDE | | |
| 7674 | + BNX2_EMAC_LED_TRAFFIC); | |
| 7669 | 7675 | break; |
| 7670 | 7676 | |
| 7671 | 7677 | case ETHTOOL_ID_OFF: |
| 7672 | − REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE); | |
| 7678 | + BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE); | |
| 7673 | 7679 | break; |
| 7674 | 7680 | |
| 7675 | 7681 | case ETHTOOL_ID_INACTIVE: |
| 7676 | − REG_WR(bp, BNX2_EMAC_LED, 0); | |
| 7677 | − REG_WR(bp, BNX2_MISC_CFG, bp->leds_save); | |
| 7682 | + BNX2_WR(bp, BNX2_EMAC_LED, 0); | |
| 7683 | + BNX2_WR(bp, BNX2_MISC_CFG, bp->leds_save); | |
| 7678 | 7684 | |
| 7679 | 7685 | if (!netif_running(dev)) |
| 7680 | 7686 | bnx2_set_power_state(bp, PCI_D3hot); |
| @@ -7896,10 +7902,10 @@ poll_bnx2(struct net_device *dev) · 215 unmodified lines | ||
| 7896 | 7902 | } |
| 7897 | 7903 | #endif |
| 7898 | 7904 | |
| 7899 | −static void __devinit | |
| 7905 | +static void | |
| 7900 | 7906 | bnx2_get_5709_media(struct bnx2 *bp) |
| 7901 | 7907 | { |
| 7902 | − u32 val = REG_RD(bp, BNX2_MISC_DUAL_MEDIA_CTRL); | |
| 7908 | + u32 val = BNX2_RD(bp, BNX2_MISC_DUAL_MEDIA_CTRL); | |
| 7903 | 7909 | u32 bond_id = val & BNX2_MISC_DUAL_MEDIA_CTRL_BOND_ID; |
| 7904 | 7910 | u32 strap; |
| 7905 | 7911 | |
| @@ -7934,18 +7940,18 @@ bnx2_get_5709_media(struct bnx2 *bp) · 28 unmodified lines | ||
| 7934 | 7940 | } |
| 7935 | 7941 | } |
| 7936 | 7942 | |
| 7937 | −static void __devinit | |
| 7943 | +static void | |
| 7938 | 7944 | bnx2_get_pci_speed(struct bnx2 *bp) |
| 7939 | 7945 | { |
| 7940 | 7946 | u32 reg; |
| 7941 | 7947 | |
| 7942 | − reg = REG_RD(bp, BNX2_PCICFG_MISC_STATUS); | |
| 7948 | + reg = BNX2_RD(bp, BNX2_PCICFG_MISC_STATUS); | |
| 7943 | 7949 | if (reg & BNX2_PCICFG_MISC_STATUS_PCIX_DET) { |
| 7944 | 7950 | u32 clkreg; |
| 7945 | 7951 | |
| 7946 | 7952 | bp->flags |= BNX2_FLAG_PCIX; |
| 7947 | 7953 | |
| 7948 | − clkreg = REG_RD(bp, BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS); | |
| 7954 | + clkreg = BNX2_RD(bp, BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS); | |
| 7949 | 7955 | |
| 7950 | 7956 | clkreg &= BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET; |
| 7951 | 7957 | switch (clkreg) { |
| @@ -7986,7 +7992,7 @@ bnx2_get_pci_speed(struct bnx2 *bp) · 34 unmodified lines | ||
| 7986 | 7992 | |
| 7987 | 7993 | } |
| 7988 | 7994 | |
| 7989 | −static void __devinit | |
| 7995 | +static void | |
| 7990 | 7996 | bnx2_read_vpd_fw_ver(struct bnx2 *bp) |
| 7991 | 7997 | { |
| 7992 | 7998 | int rc, i, j; |
| @@ -8054,7 +8060,7 @@ vpd_done: · 61 unmodified lines | ||
| 8054 | 8060 | kfree(data); |
| 8055 | 8061 | } |
| 8056 | 8062 | |
| 8057 | −static int __devinit | |
| 8063 | +static int | |
| 8058 | 8064 | bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) |
| 8059 | 8065 | { |
| 8060 | 8066 | struct bnx2 *bp; |
| @@ -8131,20 +8137,20 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 70 unmodified lines | ||
| 8131 | 8137 | * Rely on CPU to do target byte swapping on big endian systems |
| 8132 | 8138 | * The chip's target access swapping will not swap all accesses |
| 8133 | 8139 | */ |
| 8134 | − REG_WR(bp, BNX2_PCICFG_MISC_CONFIG, | |
| 8135 | − BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | | |
| 8136 | − BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP); | |
| 8140 | + BNX2_WR(bp, BNX2_PCICFG_MISC_CONFIG, | |
| 8141 | + BNX2_PCICFG_MISC_CONFIG_REG_WINDOW_ENA | | |
| 8142 | + BNX2_PCICFG_MISC_CONFIG_TARGET_MB_WORD_SWAP); | |
| 8137 | 8143 | |
| 8138 | − bp->chip_id = REG_RD(bp, BNX2_MISC_ID); | |
| 8144 | + bp->chip_id = BNX2_RD(bp, BNX2_MISC_ID); | |
| 8139 | 8145 | |
| 8140 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) { | |
| 8146 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) { | |
| 8141 | 8147 | if (!pci_is_pcie(pdev)) { |
| 8142 | 8148 | dev_err(&pdev->dev, "Not PCIE, aborting\n"); |
| 8143 | 8149 | rc = -EIO; |
| 8144 | 8150 | goto err_out_unmap; |
| 8145 | 8151 | } |
| 8146 | 8152 | bp->flags |= BNX2_FLAG_PCIE; |
| 8147 | − if (CHIP_REV(bp) == CHIP_REV_Ax) | |
| 8153 | + if (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax) | |
| 8148 | 8154 | bp->flags |= BNX2_FLAG_JUMBO_BROKEN; |
| 8149 | 8155 | |
| 8150 | 8156 | /* AER (Advanced Error Reporting) hooks */ |
| @@ -8163,18 +8169,20 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 12 unmodified lines | ||
| 8163 | 8169 | bp->flags |= BNX2_FLAG_BROKEN_STATS; |
| 8164 | 8170 | } |
| 8165 | 8171 | |
| 8166 | − if (CHIP_NUM(bp) == CHIP_NUM_5709 && CHIP_REV(bp) != CHIP_REV_Ax) { | |
| 8172 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709 && | |
| 8173 | + BNX2_CHIP_REV(bp) != BNX2_CHIP_REV_Ax) { | |
| 8167 | 8174 | if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) |
| 8168 | 8175 | bp->flags |= BNX2_FLAG_MSIX_CAP; |
| 8169 | 8176 | } |
| 8170 | 8177 | |
| 8171 | − if (CHIP_ID(bp) != CHIP_ID_5706_A0 && CHIP_ID(bp) != CHIP_ID_5706_A1) { | |
| 8178 | + if (BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A0 && | |
| 8179 | + BNX2_CHIP_ID(bp) != BNX2_CHIP_ID_5706_A1) { | |
| 8172 | 8180 | if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) |
| 8173 | 8181 | bp->flags |= BNX2_FLAG_MSI_CAP; |
| 8174 | 8182 | } |
| 8175 | 8183 | |
| 8176 | 8184 | /* 5708 cannot support DMA addresses > 40-bit. */ |
| 8177 | − if (CHIP_NUM(bp) == CHIP_NUM_5708) | |
| 8185 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5708) | |
| 8178 | 8186 | persist_dma_mask = dma_mask = DMA_BIT_MASK(40); |
| 8179 | 8187 | else |
| 8180 | 8188 | persist_dma_mask = dma_mask = DMA_BIT_MASK(64); |
| @@ -8197,12 +8205,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 16 unmodified lines | ||
| 8197 | 8205 | bnx2_get_pci_speed(bp); |
| 8198 | 8206 | |
| 8199 | 8207 | /* 5706A0 may falsely detect SERR and PERR. */ |
| 8200 | − if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | |
| 8201 | − reg = REG_RD(bp, PCI_COMMAND); | |
| 8208 | + if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { | |
| 8209 | + reg = BNX2_RD(bp, PCI_COMMAND); | |
| 8202 | 8210 | reg &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY); |
| 8203 | − REG_WR(bp, PCI_COMMAND, reg); | |
| 8204 | − } | |
| 8205 | − else if ((CHIP_ID(bp) == CHIP_ID_5706_A1) && | |
| 8211 | + BNX2_WR(bp, PCI_COMMAND, reg); | |
| 8212 | + } else if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) && | |
| 8206 | 8213 | !(bp->flags & BNX2_FLAG_PCIX)) { |
| 8207 | 8214 | |
| 8208 | 8215 | dev_err(&pdev->dev, |
| @@ -8299,7 +8306,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 90 unmodified lines | ||
| 8299 | 8306 | bp->mac_addr[4] = (u8) (reg >> 8); |
| 8300 | 8307 | bp->mac_addr[5] = (u8) reg; |
| 8301 | 8308 | |
| 8302 | − bp->tx_ring_size = MAX_TX_DESC_CNT; | |
| 8309 | + bp->tx_ring_size = BNX2_MAX_TX_DESC_CNT; | |
| 8303 | 8310 | bnx2_set_rx_ring_size(bp, 255); |
| 8304 | 8311 | |
| 8305 | 8312 | bp->tx_quick_cons_trip_int = 2; |
| @@ -8319,9 +8326,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 13 unmodified lines | ||
| 8319 | 8326 | bp->phy_addr = 1; |
| 8320 | 8327 | |
| 8321 | 8328 | /* Disable WOL support if we are running on a SERDES chip. */ |
| 8322 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 8329 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 8323 | 8330 | bnx2_get_5709_media(bp); |
| 8324 | − else if (CHIP_BOND_ID(bp) & CHIP_BOND_ID_SERDES_BIT) | |
| 8331 | + else if (BNX2_CHIP_BOND(bp) & BNX2_CHIP_BOND_SERDES_BIT) | |
| 8325 | 8332 | bp->phy_flags |= BNX2_PHY_FLAG_SERDES; |
| 8326 | 8333 | |
| 8327 | 8334 | bp->phy_port = PORT_TP; |
| @@ -8332,7 +8339,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 4 unmodified lines | ||
| 8332 | 8339 | bp->flags |= BNX2_FLAG_NO_WOL; |
| 8333 | 8340 | bp->wol = 0; |
| 8334 | 8341 | } |
| 8335 | − if (CHIP_NUM(bp) == CHIP_NUM_5706) { | |
| 8342 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5706) { | |
| 8336 | 8343 | /* Don't do parallel detect on this board because of |
| 8337 | 8344 | * some board problems. The link will not go down |
| 8338 | 8345 | * if we do parallel detect. |
| @@ -8345,25 +8352,25 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 6 unmodified lines | ||
| 8345 | 8352 | if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G) |
| 8346 | 8353 | bp->phy_flags |= BNX2_PHY_FLAG_2_5G_CAPABLE; |
| 8347 | 8354 | } |
| 8348 | − } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || | |
| 8349 | − CHIP_NUM(bp) == CHIP_NUM_5708) | |
| 8355 | + } else if (BNX2_CHIP(bp) == BNX2_CHIP_5706 || | |
| 8356 | + BNX2_CHIP(bp) == BNX2_CHIP_5708) | |
| 8350 | 8357 | bp->phy_flags |= BNX2_PHY_FLAG_CRC_FIX; |
| 8351 | − else if (CHIP_NUM(bp) == CHIP_NUM_5709 && | |
| 8352 | − (CHIP_REV(bp) == CHIP_REV_Ax || | |
| 8353 | − CHIP_REV(bp) == CHIP_REV_Bx)) | |
| 8358 | + else if (BNX2_CHIP(bp) == BNX2_CHIP_5709 && | |
| 8359 | + (BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Ax || | |
| 8360 | + BNX2_CHIP_REV(bp) == BNX2_CHIP_REV_Bx)) | |
| 8354 | 8361 | bp->phy_flags |= BNX2_PHY_FLAG_DIS_EARLY_DAC; |
| 8355 | 8362 | |
| 8356 | 8363 | bnx2_init_fw_cap(bp); |
| 8357 | 8364 | |
| 8358 | − if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || | |
| 8359 | − (CHIP_ID(bp) == CHIP_ID_5708_B0) || | |
| 8360 | − (CHIP_ID(bp) == CHIP_ID_5708_B1) || | |
| 8361 | − !(REG_RD(bp, BNX2_PCI_CONFIG_3) & BNX2_PCI_CONFIG_3_VAUX_PRESET)) { | |
| 8365 | + if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_A0) || | |
| 8366 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B0) || | |
| 8367 | + (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5708_B1) || | |
| 8368 | + !(BNX2_RD(bp, BNX2_PCI_CONFIG_3) & BNX2_PCI_CONFIG_3_VAUX_PRESET)) { | |
| 8362 | 8369 | bp->flags |= BNX2_FLAG_NO_WOL; |
| 8363 | 8370 | bp->wol = 0; |
| 8364 | 8371 | } |
| 8365 | 8372 | |
| 8366 | − if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | |
| 8373 | + if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) { | |
| 8367 | 8374 | bp->tx_quick_cons_trip_int = |
| 8368 | 8375 | bp->tx_quick_cons_trip; |
| 8369 | 8376 | bp->tx_ticks_int = bp->tx_ticks; |
| @@ -8385,7 +8392,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 15 unmodified lines | ||
| 8385 | 8392 | * AMD believes this incompatibility is unique to the 5706, and |
| 8386 | 8393 | * prefers to locally disable MSI rather than globally disabling it. |
| 8387 | 8394 | */ |
| 8388 | − if (CHIP_NUM(bp) == CHIP_NUM_5706 && disable_msi == 0) { | |
| 8395 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5706 && disable_msi == 0) { | |
| 8389 | 8396 | struct pci_dev *amd_8132 = NULL; |
| 8390 | 8397 | |
| 8391 | 8398 | while ((amd_8132 = pci_get_device(PCI_VENDOR_ID_AMD, |
| @@ -8414,6 +8421,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 22 unmodified lines | ||
| 8414 | 8421 | bp->cnic_eth_dev.max_iscsi_conn = |
| 8415 | 8422 | (bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) & |
| 8416 | 8423 | BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT; |
| 8424 | + bp->cnic_probe = bnx2_cnic_probe; | |
| 8417 | 8425 | #endif |
| 8418 | 8426 | pci_save_state(pdev); |
| 8419 | 8427 | |
| @@ -8439,7 +8447,7 @@ err_out: · 19 unmodified lines | ||
| 8439 | 8447 | return rc; |
| 8440 | 8448 | } |
| 8441 | 8449 | |
| 8442 | −static char * __devinit | |
| 8450 | +static char * | |
| 8443 | 8451 | bnx2_bus_string(struct bnx2 *bp, char *str) |
| 8444 | 8452 | { |
| 8445 | 8453 | char *s = str; |
| @@ -8505,7 +8513,7 @@ static const struct net_device_ops bnx2_netdev_ops = { · 59 unmodified lines | ||
| 8505 | 8513 | #endif |
| 8506 | 8514 | }; |
| 8507 | 8515 | |
| 8508 | −static int __devinit | |
| 8516 | +static int | |
| 8509 | 8517 | bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 8510 | 8518 | { |
| 8511 | 8519 | static int version_printed = 0; |
| @@ -8541,7 +8549,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 29 unmodified lines | ||
| 8541 | 8549 | NETIF_F_TSO | NETIF_F_TSO_ECN | |
| 8542 | 8550 | NETIF_F_RXHASH | NETIF_F_RXCSUM; |
| 8543 | 8551 | |
| 8544 | − if (CHIP_NUM(bp) == CHIP_NUM_5709) | |
| 8552 | + if (BNX2_CHIP(bp) == BNX2_CHIP_5709) | |
| 8545 | 8553 | dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6; |
| 8546 | 8554 | |
| 8547 | 8555 | dev->vlan_features = dev->hw_features; |
| @@ -8556,8 +8564,8 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 8 unmodified lines | ||
| 8556 | 8564 | |
| 8557 | 8565 | netdev_info(dev, "%s (%c%d) %s found at mem %lx, IRQ %d, " |
| 8558 | 8566 | "node addr %pM\n", board_info[ent->driver_data].name, |
| 8559 | − ((CHIP_ID(bp) & 0xf000) >> 12) + 'A', | |
| 8560 | − ((CHIP_ID(bp) & 0x0ff0) >> 4), | |
| 8567 | + ((BNX2_CHIP_ID(bp) & 0xf000) >> 12) + 'A', | |
| 8568 | + ((BNX2_CHIP_ID(bp) & 0x0ff0) >> 4), | |
| 8561 | 8569 | bnx2_bus_string(bp, str), (long)pci_resource_start(pdev, 0), |
| 8562 | 8570 | pdev->irq, dev->dev_addr); |
| 8563 | 8571 | |
| @@ -8573,7 +8581,7 @@ err_free: · 9 unmodified lines | ||
| 8573 | 8581 | return rc; |
| 8574 | 8582 | } |
| 8575 | 8583 | |
| 8576 | −static void __devexit | |
| 8584 | +static void | |
| 8577 | 8585 | bnx2_remove_one(struct pci_dev *pdev) |
| 8578 | 8586 | { |
| 8579 | 8587 | struct net_device *dev = pci_get_drvdata(pdev); |
| @@ -8752,7 +8760,7 @@ static struct pci_driver bnx2_pci_driver = { · 172 unmodified lines | ||
| 8752 | 8760 | .name = DRV_MODULE_NAME, |
| 8753 | 8761 | .id_table = bnx2_pci_tbl, |
| 8754 | 8762 | .probe = bnx2_init_one, |
| 8755 | − .remove = __devexit_p(bnx2_remove_one), | |
| 8763 | + .remove = bnx2_remove_one, | |
| 8756 | 8764 | .suspend = bnx2_suspend, |
| 8757 | 8765 | .resume = bnx2_resume, |
| 8758 | 8766 | .err_handler = &bnx2_err_handler, |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | /* |
| 21 | 21 | * tx_bd definition |
| 22 | 22 | */ |
| 23 | −struct tx_bd { | |
| 23 | +struct bnx2_tx_bd { | |
| 24 | 24 | u32 tx_bd_haddr_hi; |
| 25 | 25 | u32 tx_bd_haddr_lo; |
| 26 | 26 | u32 tx_bd_mss_nbytes; |
| @@ -48,7 +48,7 @@ struct tx_bd { · 21 unmodified lines | ||
| 48 | 48 | /* |
| 49 | 49 | * rx_bd definition |
| 50 | 50 | */ |
| 51 | −struct rx_bd { | |
| 51 | +struct bnx2_rx_bd { | |
| 52 | 52 | u32 rx_bd_haddr_hi; |
| 53 | 53 | u32 rx_bd_haddr_lo; |
| 54 | 54 | u32 rx_bd_len; |
| @@ -6538,37 +6538,38 @@ struct l2_fhdr { · 6483 unmodified lines | ||
| 6538 | 6538 | |
| 6539 | 6539 | /* Use CPU native page size up to 16K for the ring sizes. */ |
| 6540 | 6540 | #if (PAGE_SHIFT > 14) |
| 6541 | −#define BCM_PAGE_BITS 14 | |
| 6541 | +#define BNX2_PAGE_BITS 14 | |
| 6542 | 6542 | #else |
| 6543 | −#define BCM_PAGE_BITS PAGE_SHIFT | |
| 6543 | +#define BNX2_PAGE_BITS PAGE_SHIFT | |
| 6544 | 6544 | #endif |
| 6545 | −#define BCM_PAGE_SIZE (1 << BCM_PAGE_BITS) | |
| 6545 | +#define BNX2_PAGE_SIZE (1 << BNX2_PAGE_BITS) | |
| 6546 | 6546 | |
| 6547 | −#define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct tx_bd)) | |
| 6548 | −#define MAX_TX_DESC_CNT (TX_DESC_CNT - 1) | |
| 6547 | +#define BNX2_TX_DESC_CNT (BNX2_PAGE_SIZE / sizeof(struct bnx2_tx_bd)) | |
| 6548 | +#define BNX2_MAX_TX_DESC_CNT (BNX2_TX_DESC_CNT - 1) | |
| 6549 | 6549 | |
| 6550 | −#define MAX_RX_RINGS 8 | |
| 6551 | −#define MAX_RX_PG_RINGS 32 | |
| 6552 | −#define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct rx_bd)) | |
| 6553 | −#define MAX_RX_DESC_CNT (RX_DESC_CNT - 1) | |
| 6554 | −#define MAX_TOTAL_RX_DESC_CNT (MAX_RX_DESC_CNT * MAX_RX_RINGS) | |
| 6555 | −#define MAX_TOTAL_RX_PG_DESC_CNT (MAX_RX_DESC_CNT * MAX_RX_PG_RINGS) | |
| 6550 | +#define BNX2_MAX_RX_RINGS 8 | |
| 6551 | +#define BNX2_MAX_RX_PG_RINGS 32 | |
| 6552 | +#define BNX2_RX_DESC_CNT (BNX2_PAGE_SIZE / sizeof(struct bnx2_rx_bd)) | |
| 6553 | +#define BNX2_MAX_RX_DESC_CNT (BNX2_RX_DESC_CNT - 1) | |
| 6554 | +#define BNX2_MAX_TOTAL_RX_DESC_CNT (BNX2_MAX_RX_DESC_CNT * BNX2_MAX_RX_RINGS) | |
| 6555 | +#define BNX2_MAX_TOTAL_RX_PG_DESC_CNT \ | |
| 6556 | + (BNX2_MAX_RX_DESC_CNT * BNX2_MAX_RX_PG_RINGS) | |
| 6556 | 6557 | |
| 6557 | −#define NEXT_TX_BD(x) (((x) & (MAX_TX_DESC_CNT - 1)) == \ | |
| 6558 | − (MAX_TX_DESC_CNT - 1)) ? \ | |
| 6558 | +#define BNX2_NEXT_TX_BD(x) (((x) & (BNX2_MAX_TX_DESC_CNT - 1)) == \ | |
| 6559 | + (BNX2_MAX_TX_DESC_CNT - 1)) ? \ | |
| 6559 | 6560 | (x) + 2 : (x) + 1 |
| 6560 | 6561 | |
| 6561 | −#define TX_RING_IDX(x) ((x) & MAX_TX_DESC_CNT) | |
| 6562 | +#define BNX2_TX_RING_IDX(x) ((x) & BNX2_MAX_TX_DESC_CNT) | |
| 6562 | 6563 | |
| 6563 | −#define NEXT_RX_BD(x) (((x) & (MAX_RX_DESC_CNT - 1)) == \ | |
| 6564 | − (MAX_RX_DESC_CNT - 1)) ? \ | |
| 6564 | +#define BNX2_NEXT_RX_BD(x) (((x) & (BNX2_MAX_RX_DESC_CNT - 1)) == \ | |
| 6565 | + (BNX2_MAX_RX_DESC_CNT - 1)) ? \ | |
| 6565 | 6566 | (x) + 2 : (x) + 1 |
| 6566 | 6567 | |
| 6567 | −#define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx) | |
| 6568 | −#define RX_PG_RING_IDX(x) ((x) & bp->rx_max_pg_ring_idx) | |
| 6568 | +#define BNX2_RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx) | |
| 6569 | +#define BNX2_RX_PG_RING_IDX(x) ((x) & bp->rx_max_pg_ring_idx) | |
| 6569 | 6570 | |
| 6570 | −#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> (BCM_PAGE_BITS - 4)) | |
| 6571 | −#define RX_IDX(x) ((x) & MAX_RX_DESC_CNT) | |
| 6571 | +#define BNX2_RX_RING(x) (((x) & ~BNX2_MAX_RX_DESC_CNT) >> (BNX2_PAGE_BITS - 4)) | |
| 6572 | +#define BNX2_RX_IDX(x) ((x) & BNX2_MAX_RX_DESC_CNT) | |
| 6572 | 6573 | |
| 6573 | 6574 | /* Context size. */ |
| 6574 | 6575 | #define CTX_SHIFT 7 |
| @@ -6609,7 +6610,7 @@ struct l2_fhdr { · 34 unmodified lines | ||
| 6609 | 6610 | * RX ring buffer contains pointer to kmalloc() data only, |
| 6610 | 6611 | * skb are built only after Hardware filled the frame. |
| 6611 | 6612 | */ |
| 6612 | −struct sw_bd { | |
| 6613 | +struct bnx2_sw_bd { | |
| 6613 | 6614 | u8 *data; |
| 6614 | 6615 | DEFINE_DMA_UNMAP_ADDR(mapping); |
| 6615 | 6616 | }; |
| @@ -6623,23 +6624,23 @@ static inline struct l2_fhdr *get_l2_fhdr(u8 *data) · 7 unmodified lines | ||
| 6623 | 6624 | } |
| 6624 | 6625 | |
| 6625 | 6626 | |
| 6626 | −struct sw_pg { | |
| 6627 | +struct bnx2_sw_pg { | |
| 6627 | 6628 | struct page *page; |
| 6628 | 6629 | DEFINE_DMA_UNMAP_ADDR(mapping); |
| 6629 | 6630 | }; |
| 6630 | 6631 | |
| 6631 | −struct sw_tx_bd { | |
| 6632 | +struct bnx2_sw_tx_bd { | |
| 6632 | 6633 | struct sk_buff *skb; |
| 6633 | 6634 | DEFINE_DMA_UNMAP_ADDR(mapping); |
| 6634 | 6635 | unsigned short is_gso; |
| 6635 | 6636 | unsigned short nr_frags; |
| 6636 | 6637 | }; |
| 6637 | 6638 | |
| 6638 | −#define SW_RXBD_RING_SIZE (sizeof(struct sw_bd) * RX_DESC_CNT) | |
| 6639 | −#define SW_RXPG_RING_SIZE (sizeof(struct sw_pg) * RX_DESC_CNT) | |
| 6640 | −#define RXBD_RING_SIZE (sizeof(struct rx_bd) * RX_DESC_CNT) | |
| 6641 | −#define SW_TXBD_RING_SIZE (sizeof(struct sw_tx_bd) * TX_DESC_CNT) | |
| 6642 | −#define TXBD_RING_SIZE (sizeof(struct tx_bd) * TX_DESC_CNT) | |
| 6639 | +#define SW_RXBD_RING_SIZE (sizeof(struct bnx2_sw_bd) * BNX2_RX_DESC_CNT) | |
| 6640 | +#define SW_RXPG_RING_SIZE (sizeof(struct bnx2_sw_pg) * BNX2_RX_DESC_CNT) | |
| 6641 | +#define RXBD_RING_SIZE (sizeof(struct bnx2_rx_bd) * BNX2_RX_DESC_CNT) | |
| 6642 | +#define SW_TXBD_RING_SIZE (sizeof(struct bnx2_sw_tx_bd) * BNX2_TX_DESC_CNT) | |
| 6643 | +#define TXBD_RING_SIZE (sizeof(struct bnx2_tx_bd) * BNX2_TX_DESC_CNT) | |
| 6643 | 6644 | |
| 6644 | 6645 | /* Buffered flash (Atmel: AT45DB011B) specific information */ |
| 6645 | 6646 | #define SEEPROM_PAGE_BITS 2 |
| @@ -6720,8 +6721,8 @@ struct bnx2_tx_ring_info { · 74 unmodified lines | ||
| 6720 | 6721 | u32 tx_bidx_addr; |
| 6721 | 6722 | u32 tx_bseq_addr; |
| 6722 | 6723 | |
| 6723 | − struct tx_bd *tx_desc_ring; | |
| 6724 | − struct sw_tx_bd *tx_buf_ring; | |
| 6724 | + struct bnx2_tx_bd *tx_desc_ring; | |
| 6725 | + struct bnx2_sw_tx_bd *tx_buf_ring; | |
| 6725 | 6726 | |
| 6726 | 6727 | u16 tx_cons; |
| 6727 | 6728 | u16 hw_tx_cons; |
| @@ -6741,13 +6742,13 @@ struct bnx2_rx_ring_info { · 13 unmodified lines | ||
| 6741 | 6742 | u16 rx_pg_prod; |
| 6742 | 6743 | u16 rx_pg_cons; |
| 6743 | 6744 | |
| 6744 | − struct sw_bd *rx_buf_ring; | |
| 6745 | − struct rx_bd *rx_desc_ring[MAX_RX_RINGS]; | |
| 6746 | − struct sw_pg *rx_pg_ring; | |
| 6747 | − struct rx_bd *rx_pg_desc_ring[MAX_RX_PG_RINGS]; | |
| 6745 | + struct bnx2_sw_bd *rx_buf_ring; | |
| 6746 | + struct bnx2_rx_bd *rx_desc_ring[BNX2_MAX_RX_RINGS]; | |
| 6747 | + struct bnx2_sw_pg *rx_pg_ring; | |
| 6748 | + struct bnx2_rx_bd *rx_pg_desc_ring[BNX2_MAX_RX_PG_RINGS]; | |
| 6748 | 6749 | |
| 6749 | − dma_addr_t rx_desc_mapping[MAX_RX_RINGS]; | |
| 6750 | − dma_addr_t rx_pg_desc_mapping[MAX_RX_PG_RINGS]; | |
| 6750 | + dma_addr_t rx_desc_mapping[BNX2_MAX_RX_RINGS]; | |
| 6751 | + dma_addr_t rx_pg_desc_mapping[BNX2_MAX_RX_PG_RINGS]; | |
| 6751 | 6752 | }; |
| 6752 | 6753 | |
| 6753 | 6754 | struct bnx2_napi { |
| @@ -6853,33 +6854,31 @@ struct bnx2 { · 99 unmodified lines | ||
| 6853 | 6854 | |
| 6854 | 6855 | u32 chip_id; |
| 6855 | 6856 | /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */ |
| 6856 | −#define CHIP_NUM(bp) (((bp)->chip_id) & 0xffff0000) | |
| 6857 | −#define CHIP_NUM_5706 0x57060000 | |
| 6858 | −#define CHIP_NUM_5708 0x57080000 | |
| 6859 | −#define CHIP_NUM_5709 0x57090000 | |
| 6860 | − | |
| 6861 | −#define CHIP_REV(bp) (((bp)->chip_id) & 0x0000f000) | |
| 6862 | −#define CHIP_REV_Ax 0x00000000 | |
| 6863 | −#define CHIP_REV_Bx 0x00001000 | |
| 6864 | −#define CHIP_REV_Cx 0x00002000 | |
| 6865 | − | |
| 6866 | −#define CHIP_METAL(bp) (((bp)->chip_id) & 0x00000ff0) | |
| 6867 | −#define CHIP_BONDING(bp) (((bp)->chip_id) & 0x0000000f) | |
| 6868 | − | |
| 6869 | −#define CHIP_ID(bp) (((bp)->chip_id) & 0xfffffff0) | |
| 6870 | −#define CHIP_ID_5706_A0 0x57060000 | |
| 6871 | −#define CHIP_ID_5706_A1 0x57060010 | |
| 6872 | −#define CHIP_ID_5706_A2 0x57060020 | |
| 6873 | −#define CHIP_ID_5708_A0 0x57080000 | |
| 6874 | −#define CHIP_ID_5708_B0 0x57081000 | |
| 6875 | −#define CHIP_ID_5708_B1 0x57081010 | |
| 6876 | −#define CHIP_ID_5709_A0 0x57090000 | |
| 6877 | −#define CHIP_ID_5709_A1 0x57090010 | |
| 6878 | − | |
| 6879 | −#define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) | |
| 6857 | +#define BNX2_CHIP(bp) (((bp)->chip_id) & 0xffff0000) | |
| 6858 | +#define BNX2_CHIP_5706 0x57060000 | |
| 6859 | +#define BNX2_CHIP_5708 0x57080000 | |
| 6860 | +#define BNX2_CHIP_5709 0x57090000 | |
| 6861 | + | |
| 6862 | +#define BNX2_CHIP_REV(bp) (((bp)->chip_id) & 0x0000f000) | |
| 6863 | +#define BNX2_CHIP_REV_Ax 0x00000000 | |
| 6864 | +#define BNX2_CHIP_REV_Bx 0x00001000 | |
| 6865 | +#define BNX2_CHIP_REV_Cx 0x00002000 | |
| 6866 | + | |
| 6867 | +#define BNX2_CHIP_METAL(bp) (((bp)->chip_id) & 0x00000ff0) | |
| 6868 | +#define BNX2_CHIP_BOND(bp) (((bp)->chip_id) & 0x0000000f) | |
| 6869 | + | |
| 6870 | +#define BNX2_CHIP_ID(bp) (((bp)->chip_id) & 0xfffffff0) | |
| 6871 | +#define BNX2_CHIP_ID_5706_A0 0x57060000 | |
| 6872 | +#define BNX2_CHIP_ID_5706_A1 0x57060010 | |
| 6873 | +#define BNX2_CHIP_ID_5706_A2 0x57060020 | |
| 6874 | +#define BNX2_CHIP_ID_5708_A0 0x57080000 | |
| 6875 | +#define BNX2_CHIP_ID_5708_B0 0x57081000 | |
| 6876 | +#define BNX2_CHIP_ID_5708_B1 0x57081010 | |
| 6877 | +#define BNX2_CHIP_ID_5709_A0 0x57090000 | |
| 6878 | +#define BNX2_CHIP_ID_5709_A1 0x57090010 | |
| 6880 | 6879 | |
| 6881 | 6880 | /* A serdes chip will have the first bit of the bond id set. */ |
| 6882 | −#define CHIP_BOND_ID_SERDES_BIT 0x01 | |
| 6881 | +#define BNX2_CHIP_BOND_SERDES_BIT 0x01 | |
| 6883 | 6882 | |
| 6884 | 6883 | u32 phy_addr; |
| 6885 | 6884 | u32 phy_id; |
| @@ -6985,19 +6984,20 @@ struct bnx2 { · 99 unmodified lines | ||
| 6985 | 6984 | #ifdef BCM_CNIC |
| 6986 | 6985 | struct mutex cnic_lock; |
| 6987 | 6986 | struct cnic_eth_dev cnic_eth_dev; |
| 6987 | + struct cnic_eth_dev *(*cnic_probe)(struct net_device *); | |
| 6988 | 6988 | #endif |
| 6989 | 6989 | |
| 6990 | 6990 | const struct firmware *mips_firmware; |
| 6991 | 6991 | const struct firmware *rv2p_firmware; |
| 6992 | 6992 | }; |
| 6993 | 6993 | |
| 6994 | −#define REG_RD(bp, offset) \ | |
| 6994 | +#define BNX2_RD(bp, offset) \ | |
| 6995 | 6995 | readl(bp->regview + offset) |
| 6996 | 6996 | |
| 6997 | −#define REG_WR(bp, offset, val) \ | |
| 6997 | +#define BNX2_WR(bp, offset, val) \ | |
| 6998 | 6998 | writel(val, bp->regview + offset) |
| 6999 | 6999 | |
| 7000 | −#define REG_WR16(bp, offset, val) \ | |
| 7000 | +#define BNX2_WR16(bp, offset, val) \ | |
| 7001 | 7001 | writew(val, bp->regview + offset) |
| 7002 | 7002 | |
| 7003 | 7003 | struct cpu_reg { |
| @@ -7052,7 +7052,7 @@ struct bnx2_rv2p_fw_file { · 48 unmodified lines | ||
| 7052 | 7052 | |
| 7053 | 7053 | #define RV2P_P1_FIXUP_PAGE_SIZE_IDX 0 |
| 7054 | 7054 | #define RV2P_BD_PAGE_SIZE_MSK 0xffff |
| 7055 | −#define RV2P_BD_PAGE_SIZE ((BCM_PAGE_SIZE / 16) - 1) | |
| 7055 | +#define RV2P_BD_PAGE_SIZE ((BNX2_PAGE_SIZE / 16) - 1) | |
| 7056 | 7056 | |
| 7057 | 7057 | #define RV2P_PROC1 0 |
| 7058 | 7058 | #define RV2P_PROC2 1 |
| @@ -34,25 +34,16 @@ · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | #include "bnx2x_hsi.h" |
| 36 | 36 | |
| 37 | −#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE) | |
| 38 | −#define BCM_CNIC 1 | |
| 39 | 37 | #include "../cnic_if.h" |
| 40 | −#endif | |
| 41 | 38 | |
| 42 | −#ifdef BCM_CNIC | |
| 43 | −#define BNX2X_MIN_MSIX_VEC_CNT 3 | |
| 44 | −#define BNX2X_MSIX_VEC_FP_START 2 | |
| 45 | −#else | |
| 46 | −#define BNX2X_MIN_MSIX_VEC_CNT 2 | |
| 47 | −#define BNX2X_MSIX_VEC_FP_START 1 | |
| 48 | −#endif | |
| 39 | + | |
| 40 | +#define BNX2X_MIN_MSIX_VEC_CNT(bp) ((bp)->min_msix_vec_cnt) | |
| 49 | 41 | |
| 50 | 42 | #include <linux/mdio.h> |
| 51 | 43 | |
| 52 | 44 | #include "bnx2x_reg.h" |
| 53 | 45 | #include "bnx2x_fw_defs.h" |
| 54 | 46 | #include "bnx2x_mfw_req.h" |
| 55 | −#include "bnx2x_hsi.h" | |
| 56 | 47 | #include "bnx2x_link.h" |
| 57 | 48 | #include "bnx2x_sp.h" |
| 58 | 49 | #include "bnx2x_dcb.h" |
| @@ -256,15 +247,10 @@ enum { · 197 unmodified lines | ||
| 256 | 247 | /* FCoE L2 */ |
| 257 | 248 | #define BNX2X_FCOE_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp) + 1) |
| 258 | 249 | |
| 259 | −/** Additional rings budgeting */ | |
| 260 | −#ifdef BCM_CNIC | |
| 261 | −#define CNIC_PRESENT 1 | |
| 262 | −#define FCOE_PRESENT 1 | |
| 263 | −#else | |
| 264 | −#define CNIC_PRESENT 0 | |
| 265 | −#define FCOE_PRESENT 0 | |
| 266 | −#endif /* BCM_CNIC */ | |
| 267 | −#define NON_ETH_CONTEXT_USE (FCOE_PRESENT) | |
| 250 | +#define CNIC_SUPPORT(bp) ((bp)->cnic_support) | |
| 251 | +#define CNIC_ENABLED(bp) ((bp)->cnic_enabled) | |
| 252 | +#define CNIC_LOADED(bp) ((bp)->cnic_loaded) | |
| 253 | +#define FCOE_INIT(bp) ((bp)->fcoe_init) | |
| 268 | 254 | |
| 269 | 255 | #define AEU_IN_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR \ |
| 270 | 256 | AEU_INPUTS_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR |
| @@ -297,9 +283,7 @@ enum { · 26 unmodified lines | ||
| 297 | 283 | OOO_TXQ_IDX_OFFSET, |
| 298 | 284 | }; |
| 299 | 285 | #define MAX_ETH_TXQ_IDX(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) * (bp)->max_cos) |
| 300 | −#ifdef BCM_CNIC | |
| 301 | 286 | #define FCOE_TXQ_IDX(bp) (MAX_ETH_TXQ_IDX(bp) + FCOE_TXQ_IDX_OFFSET) |
| 302 | −#endif | |
| 303 | 287 | |
| 304 | 288 | /* fast path */ |
| 305 | 289 | /* |
| @@ -505,7 +489,7 @@ struct bnx2x_fastpath { · 199 unmodified lines | ||
| 505 | 489 | u32 ustorm_rx_prods_offset; |
| 506 | 490 | |
| 507 | 491 | u32 rx_buf_size; |
| 508 | − | |
| 492 | + u32 rx_frag_size; /* 0 if kmalloced(), or rx_buf_size + NET_SKB_PAD */ | |
| 509 | 493 | dma_addr_t status_blk_mapping; |
| 510 | 494 | |
| 511 | 495 | enum bnx2x_tpa_mode_t mode; |
| @@ -585,15 +569,9 @@ struct bnx2x_fastpath { · 73 unmodified lines | ||
| 585 | 569 | ->var) |
| 586 | 570 | |
| 587 | 571 | |
| 588 | −#define IS_ETH_FP(fp) (fp->index < \ | |
| 589 | − BNX2X_NUM_ETH_QUEUES(fp->bp)) | |
| 590 | −#ifdef BCM_CNIC | |
| 591 | −#define IS_FCOE_FP(fp) (fp->index == FCOE_IDX(fp->bp)) | |
| 592 | −#define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX(bp)) | |
| 593 | −#else | |
| 594 | −#define IS_FCOE_FP(fp) false | |
| 595 | −#define IS_FCOE_IDX(idx) false | |
| 596 | −#endif | |
| 572 | +#define IS_ETH_FP(fp) ((fp)->index < BNX2X_NUM_ETH_QUEUES((fp)->bp)) | |
| 573 | +#define IS_FCOE_FP(fp) ((fp)->index == FCOE_IDX((fp)->bp)) | |
| 574 | +#define IS_FCOE_IDX(idx) ((idx) == FCOE_IDX(bp)) | |
| 597 | 575 | |
| 598 | 576 | |
| 599 | 577 | /* MC hsi */ |
| @@ -886,6 +864,18 @@ struct bnx2x_common { · 286 unmodified lines | ||
| 886 | 864 | (CHIP_REV(bp) == CHIP_REV_Bx)) |
| 887 | 865 | #define CHIP_IS_E3A0(bp) (CHIP_IS_E3(bp) && \ |
| 888 | 866 | (CHIP_REV(bp) == CHIP_REV_Ax)) |
| 867 | +/* This define is used in two main places: | |
| 868 | + * 1. In the early stages of nic_load, to know if to configrue Parser / Searcher | |
| 869 | + * to nic-only mode or to offload mode. Offload mode is configured if either the | |
| 870 | + * chip is E1x (where MIC_MODE register is not applicable), or if cnic already | |
| 871 | + * registered for this port (which means that the user wants storage services). | |
| 872 | + * 2. During cnic-related load, to know if offload mode is already configured in | |
| 873 | + * the HW or needs to be configrued. | |
| 874 | + * Since the transition from nic-mode to offload-mode in HW causes traffic | |
| 875 | + * coruption, nic-mode is configured only in ports on which storage services | |
| 876 | + * where never requested. | |
| 877 | + */ | |
| 878 | +#define CONFIGURE_NIC_MODE(bp) (!CHIP_IS_E1x(bp) && !CNIC_ENABLED(bp)) | |
| 889 | 879 | |
| 890 | 880 | int flash_size; |
| 891 | 881 | #define BNX2X_NVRAM_1MB_SIZE 0x20000 /* 1M bit in bytes */ |
| @@ -925,6 +915,7 @@ struct bnx2x_common { · 33 unmodified lines | ||
| 925 | 915 | #define BNX2X_IGU_STAS_MSG_VF_CNT 64 |
| 926 | 916 | #define BNX2X_IGU_STAS_MSG_PF_CNT 4 |
| 927 | 917 | |
| 918 | +#define MAX_IGU_ATTN_ACK_TO 100 | |
| 928 | 919 | /* end of common */ |
| 929 | 920 | |
| 930 | 921 | /* port */ |
| @@ -946,7 +937,6 @@ struct bnx2x_port { · 15 unmodified lines | ||
| 946 | 937 | |
| 947 | 938 | /* used to synchronize phy accesses */ |
| 948 | 939 | struct mutex phy_mutex; |
| 949 | − int need_hw_lock; | |
| 950 | 940 | |
| 951 | 941 | u32 port_stx; |
| 952 | 942 | |
| @@ -1003,18 +993,15 @@ union cdu_context { · 50 unmodified lines | ||
| 1003 | 993 | #define CDU_ILT_PAGE_SZ (8192 << CDU_ILT_PAGE_SZ_HW) /* 32K */ |
| 1004 | 994 | #define ILT_PAGE_CIDS (CDU_ILT_PAGE_SZ / sizeof(union cdu_context)) |
| 1005 | 995 | |
| 1006 | −#ifdef BCM_CNIC | |
| 1007 | 996 | #define CNIC_ISCSI_CID_MAX 256 |
| 1008 | 997 | #define CNIC_FCOE_CID_MAX 2048 |
| 1009 | 998 | #define CNIC_CID_MAX (CNIC_ISCSI_CID_MAX + CNIC_FCOE_CID_MAX) |
| 1010 | 999 | #define CNIC_ILT_LINES DIV_ROUND_UP(CNIC_CID_MAX, ILT_PAGE_CIDS) |
| 1011 | −#endif | |
| 1012 | 1000 | |
| 1013 | 1001 | #define QM_ILT_PAGE_SZ_HW 0 |
| 1014 | 1002 | #define QM_ILT_PAGE_SZ (4096 << QM_ILT_PAGE_SZ_HW) /* 4K */ |
| 1015 | 1003 | #define QM_CID_ROUND 1024 |
| 1016 | 1004 | |
| 1017 | −#ifdef BCM_CNIC | |
| 1018 | 1005 | /* TM (timers) host DB constants */ |
| 1019 | 1006 | #define TM_ILT_PAGE_SZ_HW 0 |
| 1020 | 1007 | #define TM_ILT_PAGE_SZ (4096 << TM_ILT_PAGE_SZ_HW) /* 4K */ |
| @@ -1032,8 +1019,6 @@ union cdu_context { · 11 unmodified lines | ||
| 1032 | 1019 | #define SRC_T2_SZ SRC_ILT_SZ |
| 1033 | 1020 | #define SRC_ILT_LINES DIV_ROUND_UP(SRC_ILT_SZ, SRC_ILT_PAGE_SZ) |
| 1034 | 1021 | |
| 1035 | −#endif | |
| 1036 | − | |
| 1037 | 1022 | #define MAX_DMAE_C 8 |
| 1038 | 1023 | |
| 1039 | 1024 | /* DMA memory not used in fastpath */ |
| @@ -1201,6 +1186,7 @@ struct bnx2x_prev_path_list { · 161 unmodified lines | ||
| 1201 | 1186 | u8 slot; |
| 1202 | 1187 | u8 path; |
| 1203 | 1188 | struct list_head list; |
| 1189 | + u8 undi; | |
| 1204 | 1190 | }; |
| 1205 | 1191 | |
| 1206 | 1192 | struct bnx2x_sp_objs { |
| @@ -1227,7 +1213,6 @@ struct bnx2x { · 20 unmodified lines | ||
| 1227 | 1213 | struct bnx2x_sp_objs *sp_objs; |
| 1228 | 1214 | struct bnx2x_fp_stats *fp_stats; |
| 1229 | 1215 | struct bnx2x_fp_txdata *bnx2x_txq; |
| 1230 | − int bnx2x_txq_size; | |
| 1231 | 1216 | void __iomem *regview; |
| 1232 | 1217 | void __iomem *doorbells; |
| 1233 | 1218 | u16 db_size; |
| @@ -1350,6 +1335,16 @@ struct bnx2x { · 116 unmodified lines | ||
| 1350 | 1335 | #define NO_ISCSI_OOO(bp) ((bp)->flags & NO_ISCSI_OOO_FLAG) |
| 1351 | 1336 | #define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG) |
| 1352 | 1337 | |
| 1338 | + u8 cnic_support; | |
| 1339 | + bool cnic_enabled; | |
| 1340 | + bool cnic_loaded; | |
| 1341 | + struct cnic_eth_dev *(*cnic_probe)(struct net_device *); | |
| 1342 | + | |
| 1343 | + /* Flag that indicates that we can start looking for FCoE L2 queue | |
| 1344 | + * completions in the default status block. | |
| 1345 | + */ | |
| 1346 | + bool fcoe_init; | |
| 1347 | + | |
| 1353 | 1348 | int pm_cap; |
| 1354 | 1349 | int mrrs; |
| 1355 | 1350 | |
| @@ -1420,6 +1415,8 @@ struct bnx2x { · 64 unmodified lines | ||
| 1420 | 1415 | #define BNX2X_MAX_COS 3 |
| 1421 | 1416 | #define BNX2X_MAX_TX_COS 2 |
| 1422 | 1417 | int num_queues; |
| 1418 | + uint num_ethernet_queues; | |
| 1419 | + uint num_cnic_queues; | |
| 1423 | 1420 | int num_napi_queues; |
| 1424 | 1421 | int disable_tpa; |
| 1425 | 1422 | |
| @@ -1433,6 +1430,7 @@ struct bnx2x { · 7 unmodified lines | ||
| 1433 | 1430 | u8 igu_dsb_id; |
| 1434 | 1431 | u8 igu_base_sb; |
| 1435 | 1432 | u8 igu_sb_cnt; |
| 1433 | + u8 min_msix_vec_cnt; | |
| 1436 | 1434 | |
| 1437 | 1435 | dma_addr_t def_status_blk_mapping; |
| 1438 | 1436 | |
| @@ -1478,26 +1476,23 @@ struct bnx2x { · 39 unmodified lines | ||
| 1478 | 1476 | * Maximum supported number of RSS queues: number of IGU SBs minus one that goes |
| 1479 | 1477 | * to CNIC. |
| 1480 | 1478 | */ |
| 1481 | −#define BNX2X_MAX_RSS_COUNT(bp) ((bp)->igu_sb_cnt - CNIC_PRESENT) | |
| 1479 | +#define BNX2X_MAX_RSS_COUNT(bp) ((bp)->igu_sb_cnt - CNIC_SUPPORT(bp)) | |
| 1482 | 1480 | |
| 1483 | 1481 | /* |
| 1484 | 1482 | * Maximum CID count that might be required by the bnx2x: |
| 1485 | 1483 | * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI |
| 1486 | 1484 | */ |
| 1487 | 1485 | #define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \ |
| 1488 | − + NON_ETH_CONTEXT_USE + CNIC_PRESENT) | |
| 1486 | + + 2 * CNIC_SUPPORT(bp)) | |
| 1489 | 1487 | #define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \ |
| 1490 | − + NON_ETH_CONTEXT_USE + CNIC_PRESENT) | |
| 1488 | + + 2 * CNIC_SUPPORT(bp)) | |
| 1491 | 1489 | #define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ |
| 1492 | 1490 | ILT_PAGE_CIDS)) |
| 1493 | 1491 | |
| 1494 | 1492 | int qm_cid_count; |
| 1495 | 1493 | |
| 1496 | − int dropless_fc; | |
| 1494 | + bool dropless_fc; | |
| 1497 | 1495 | |
| 1498 | −#ifdef BCM_CNIC | |
| 1499 | − u32 cnic_flags; | |
| 1500 | −#define BNX2X_CNIC_FLAG_MAC_SET 1 | |
| 1501 | 1496 | void *t2; |
| 1502 | 1497 | dma_addr_t t2_mapping; |
| 1503 | 1498 | struct cnic_ops __rcu *cnic_ops; |
| @@ -1518,7 +1513,6 @@ struct bnx2x { · 14 unmodified lines | ||
| 1518 | 1513 | |
| 1519 | 1514 | /* Start index of the "special" (CNIC related) L2 cleints */ |
| 1520 | 1515 | u8 cnic_base_cl_id; |
| 1521 | −#endif | |
| 1522 | 1516 | |
| 1523 | 1517 | int dmae_ready; |
| 1524 | 1518 | /* used to synchronize dmae accesses */ |
| @@ -1647,9 +1641,9 @@ struct bnx2x { · 122 unmodified lines | ||
| 1647 | 1641 | /* Tx queues may be less or equal to Rx queues */ |
| 1648 | 1642 | extern int num_queues; |
| 1649 | 1643 | #define BNX2X_NUM_QUEUES(bp) (bp->num_queues) |
| 1650 | −#define BNX2X_NUM_ETH_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE) | |
| 1644 | +#define BNX2X_NUM_ETH_QUEUES(bp) ((bp)->num_ethernet_queues) | |
| 1651 | 1645 | #define BNX2X_NUM_NON_CNIC_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - \ |
| 1652 | − NON_ETH_CONTEXT_USE) | |
| 1646 | + (bp)->num_cnic_queues) | |
| 1653 | 1647 | #define BNX2X_NUM_RX_QUEUES(bp) BNX2X_NUM_QUEUES(bp) |
| 1654 | 1648 | |
| 1655 | 1649 | #define is_multi(bp) (BNX2X_NUM_QUEUES(bp) > 1) |
| @@ -1689,6 +1683,13 @@ struct bnx2x_func_init_params { · 33 unmodified lines | ||
| 1689 | 1683 | u16 spq_prod; /* valid iff FUNC_FLG_SPQ */ |
| 1690 | 1684 | }; |
| 1691 | 1685 | |
| 1686 | +#define for_each_cnic_queue(bp, var) \ | |
| 1687 | + for ((var) = BNX2X_NUM_ETH_QUEUES(bp); (var) < BNX2X_NUM_QUEUES(bp); \ | |
| 1688 | + (var)++) \ | |
| 1689 | + if (skip_queue(bp, var)) \ | |
| 1690 | + continue; \ | |
| 1691 | + else | |
| 1692 | + | |
| 1692 | 1693 | #define for_each_eth_queue(bp, var) \ |
| 1693 | 1694 | for ((var) = 0; (var) < BNX2X_NUM_ETH_QUEUES(bp); (var)++) |
| 1694 | 1695 | |
| @@ -1702,6 +1703,22 @@ struct bnx2x_func_init_params { · 7 unmodified lines | ||
| 1702 | 1703 | else |
| 1703 | 1704 | |
| 1704 | 1705 | /* Skip forwarding FP */ |
| 1706 | +#define for_each_valid_rx_queue(bp, var) \ | |
| 1707 | + for ((var) = 0; \ | |
| 1708 | + (var) < (CNIC_LOADED(bp) ? BNX2X_NUM_QUEUES(bp) : \ | |
| 1709 | + BNX2X_NUM_ETH_QUEUES(bp)); \ | |
| 1710 | + (var)++) \ | |
| 1711 | + if (skip_rx_queue(bp, var)) \ | |
| 1712 | + continue; \ | |
| 1713 | + else | |
| 1714 | + | |
| 1715 | +#define for_each_rx_queue_cnic(bp, var) \ | |
| 1716 | + for ((var) = BNX2X_NUM_ETH_QUEUES(bp); (var) < BNX2X_NUM_QUEUES(bp); \ | |
| 1717 | + (var)++) \ | |
| 1718 | + if (skip_rx_queue(bp, var)) \ | |
| 1719 | + continue; \ | |
| 1720 | + else | |
| 1721 | + | |
| 1705 | 1722 | #define for_each_rx_queue(bp, var) \ |
| 1706 | 1723 | for ((var) = 0; (var) < BNX2X_NUM_QUEUES(bp); (var)++) \ |
| 1707 | 1724 | if (skip_rx_queue(bp, var)) \ |
| @@ -1709,6 +1726,22 @@ struct bnx2x_func_init_params { · 1 unmodified line | ||
| 1709 | 1726 | else |
| 1710 | 1727 | |
| 1711 | 1728 | /* Skip OOO FP */ |
| 1729 | +#define for_each_valid_tx_queue(bp, var) \ | |
| 1730 | + for ((var) = 0; \ | |
| 1731 | + (var) < (CNIC_LOADED(bp) ? BNX2X_NUM_QUEUES(bp) : \ | |
| 1732 | + BNX2X_NUM_ETH_QUEUES(bp)); \ | |
| 1733 | + (var)++) \ | |
| 1734 | + if (skip_tx_queue(bp, var)) \ | |
| 1735 | + continue; \ | |
| 1736 | + else | |
| 1737 | + | |
| 1738 | +#define for_each_tx_queue_cnic(bp, var) \ | |
| 1739 | + for ((var) = BNX2X_NUM_ETH_QUEUES(bp); (var) < BNX2X_NUM_QUEUES(bp); \ | |
| 1740 | + (var)++) \ | |
| 1741 | + if (skip_tx_queue(bp, var)) \ | |
| 1742 | + continue; \ | |
| 1743 | + else | |
| 1744 | + | |
| 1712 | 1745 | #define for_each_tx_queue(bp, var) \ |
| 1713 | 1746 | for ((var) = 0; (var) < BNX2X_NUM_QUEUES(bp); (var)++) \ |
| 1714 | 1747 | if (skip_tx_queue(bp, var)) \ |
| @@ -2179,7 +2212,6 @@ void bnx2x_notify_link_changed(struct bnx2x *bp); · 464 unmodified lines | ||
| 2179 | 2212 | #define BNX2X_MF_SD_PROTOCOL(bp) \ |
| 2180 | 2213 | ((bp)->mf_config[BP_VN(bp)] & FUNC_MF_CFG_PROTOCOL_MASK) |
| 2181 | 2214 | |
| 2182 | −#ifdef BCM_CNIC | |
| 2183 | 2215 | #define BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) \ |
| 2184 | 2216 | (BNX2X_MF_SD_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_ISCSI) |
| 2185 | 2217 | |
| @@ -2196,9 +2228,12 @@ void bnx2x_notify_link_changed(struct bnx2x *bp); · 10 unmodified lines | ||
| 2196 | 2228 | #define IS_MF_STORAGE_SD(bp) (IS_MF_SD(bp) && \ |
| 2197 | 2229 | (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) || \ |
| 2198 | 2230 | BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp))) |
| 2199 | −#else | |
| 2200 | −#define IS_MF_FCOE_AFEX(bp) false | |
| 2201 | −#endif | |
| 2202 | 2231 | |
| 2232 | +enum { | |
| 2233 | + SWITCH_UPDATE, | |
| 2234 | + AFEX_UPDATE, | |
| 2235 | +}; | |
| 2236 | + | |
| 2237 | +#define NUM_MACS 8 | |
| 2203 | 2238 | |
| 2204 | 2239 | #endif /* bnx2x.h */ |
| @@ -552,6 +552,23 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 551 unmodified lines | ||
| 552 | 552 | return 0; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | +static void bnx2x_frag_free(const struct bnx2x_fastpath *fp, void *data) | |
| 556 | +{ | |
| 557 | + if (fp->rx_frag_size) | |
| 558 | + put_page(virt_to_head_page(data)); | |
| 559 | + else | |
| 560 | + kfree(data); | |
| 561 | +} | |
| 562 | + | |
| 563 | +static void *bnx2x_frag_alloc(const struct bnx2x_fastpath *fp) | |
| 564 | +{ | |
| 565 | + if (fp->rx_frag_size) | |
| 566 | + return netdev_alloc_frag(fp->rx_frag_size); | |
| 567 | + | |
| 568 | + return kmalloc(fp->rx_buf_size + NET_SKB_PAD, GFP_ATOMIC); | |
| 569 | +} | |
| 570 | + | |
| 571 | + | |
| 555 | 572 | static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, |
| 556 | 573 | struct bnx2x_agg_info *tpa_info, |
| 557 | 574 | u16 pages, |
| @@ -574,15 +591,14 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 16 unmodified lines | ||
| 574 | 591 | goto drop; |
| 575 | 592 | |
| 576 | 593 | /* Try to allocate the new data */ |
| 577 | − new_data = kmalloc(fp->rx_buf_size + NET_SKB_PAD, GFP_ATOMIC); | |
| 578 | − | |
| 594 | + new_data = bnx2x_frag_alloc(fp); | |
| 579 | 595 | /* Unmap skb in the pool anyway, as we are going to change |
| 580 | 596 | pool entry status to BNX2X_TPA_STOP even if new skb allocation |
| 581 | 597 | fails. */ |
| 582 | 598 | dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(rx_buf, mapping), |
| 583 | 599 | fp->rx_buf_size, DMA_FROM_DEVICE); |
| 584 | 600 | if (likely(new_data)) |
| 585 | − skb = build_skb(data, 0); | |
| 601 | + skb = build_skb(data, fp->rx_frag_size); | |
| 586 | 602 | |
| 587 | 603 | if (likely(skb)) { |
| 588 | 604 | #ifdef BNX2X_STOP_ON_ERROR |
| @@ -619,7 +635,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 30 unmodified lines | ||
| 619 | 635 | |
| 620 | 636 | return; |
| 621 | 637 | } |
| 622 | − kfree(new_data); | |
| 638 | + bnx2x_frag_free(fp, new_data); | |
| 623 | 639 | drop: |
| 624 | 640 | /* drop the packet and keep the buffer in the bin */ |
| 625 | 641 | DP(NETIF_MSG_RX_STATUS, |
| @@ -635,7 +651,7 @@ static int bnx2x_alloc_rx_data(struct bnx2x *bp, · 9 unmodified lines | ||
| 635 | 651 | struct eth_rx_bd *rx_bd = &fp->rx_desc_ring[index]; |
| 636 | 652 | dma_addr_t mapping; |
| 637 | 653 | |
| 638 | − data = kmalloc(fp->rx_buf_size + NET_SKB_PAD, GFP_ATOMIC); | |
| 654 | + data = bnx2x_frag_alloc(fp); | |
| 639 | 655 | if (unlikely(data == NULL)) |
| 640 | 656 | return -ENOMEM; |
| 641 | 657 | |
| @@ -643,7 +659,7 @@ static int bnx2x_alloc_rx_data(struct bnx2x *bp, · 1 unmodified line | ||
| 643 | 659 | fp->rx_buf_size, |
| 644 | 660 | DMA_FROM_DEVICE); |
| 645 | 661 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { |
| 646 | − kfree(data); | |
| 662 | + bnx2x_frag_free(fp, data); | |
| 647 | 663 | BNX2X_ERR("Can't map rx data\n"); |
| 648 | 664 | return -ENOMEM; |
| 649 | 665 | } |
| @@ -845,9 +861,9 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) · 195 unmodified lines | ||
| 845 | 861 | dma_unmap_addr(rx_buf, mapping), |
| 846 | 862 | fp->rx_buf_size, |
| 847 | 863 | DMA_FROM_DEVICE); |
| 848 | − skb = build_skb(data, 0); | |
| 864 | + skb = build_skb(data, fp->rx_frag_size); | |
| 849 | 865 | if (unlikely(!skb)) { |
| 850 | − kfree(data); | |
| 866 | + bnx2x_frag_free(fp, data); | |
| 851 | 867 | bnx2x_fp_qstats(bp, fp)-> |
| 852 | 868 | rx_skb_alloc_failed++; |
| 853 | 869 | goto next_rx; |
| @@ -948,14 +964,12 @@ void bnx2x_acquire_phy_lock(struct bnx2x *bp) · 94 unmodified lines | ||
| 948 | 964 | { |
| 949 | 965 | mutex_lock(&bp->port.phy_mutex); |
| 950 | 966 | |
| 951 | − if (bp->port.need_hw_lock) | |
| 952 | − bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_MDIO); | |
| 967 | + bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_MDIO); | |
| 953 | 968 | } |
| 954 | 969 | |
| 955 | 970 | void bnx2x_release_phy_lock(struct bnx2x *bp) |
| 956 | 971 | { |
| 957 | − if (bp->port.need_hw_lock) | |
| 958 | − bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_MDIO); | |
| 972 | + bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_MDIO); | |
| 959 | 973 | |
| 960 | 974 | mutex_unlock(&bp->port.phy_mutex); |
| 961 | 975 | } |
| @@ -1147,11 +1161,30 @@ static void bnx2x_free_tpa_pool(struct bnx2x *bp, · 185 unmodified lines | ||
| 1147 | 1161 | dma_unmap_single(&bp->pdev->dev, |
| 1148 | 1162 | dma_unmap_addr(first_buf, mapping), |
| 1149 | 1163 | fp->rx_buf_size, DMA_FROM_DEVICE); |
| 1150 | − kfree(data); | |
| 1164 | + bnx2x_frag_free(fp, data); | |
| 1151 | 1165 | first_buf->data = NULL; |
| 1152 | 1166 | } |
| 1153 | 1167 | } |
| 1154 | 1168 | |
| 1169 | +void bnx2x_init_rx_rings_cnic(struct bnx2x *bp) | |
| 1170 | +{ | |
| 1171 | + int j; | |
| 1172 | + | |
| 1173 | + for_each_rx_queue_cnic(bp, j) { | |
| 1174 | + struct bnx2x_fastpath *fp = &bp->fp[j]; | |
| 1175 | + | |
| 1176 | + fp->rx_bd_cons = 0; | |
| 1177 | + | |
| 1178 | + /* Activate BD ring */ | |
| 1179 | + /* Warning! | |
| 1180 | + * this will generate an interrupt (to the TSTORM) | |
| 1181 | + * must only be done after chip is initialized | |
| 1182 | + */ | |
| 1183 | + bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, | |
| 1184 | + fp->rx_sge_prod); | |
| 1185 | + } | |
| 1186 | +} | |
| 1187 | + | |
| 1155 | 1188 | void bnx2x_init_rx_rings(struct bnx2x *bp) |
| 1156 | 1189 | { |
| 1157 | 1190 | int func = BP_FUNC(bp); |
| @@ -1159,7 +1192,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) · 1 unmodified line | ||
| 1159 | 1192 | int i, j; |
| 1160 | 1193 | |
| 1161 | 1194 | /* Allocate TPA resources */ |
| 1162 | − for_each_rx_queue(bp, j) { | |
| 1195 | + for_each_eth_queue(bp, j) { | |
| 1163 | 1196 | struct bnx2x_fastpath *fp = &bp->fp[j]; |
| 1164 | 1197 | |
| 1165 | 1198 | DP(NETIF_MSG_IFUP, |
| @@ -1173,8 +1206,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) · 7 unmodified lines | ||
| 1173 | 1206 | struct sw_rx_bd *first_buf = |
| 1174 | 1207 | &tpa_info->first_buf; |
| 1175 | 1208 | |
| 1176 | − first_buf->data = kmalloc(fp->rx_buf_size + NET_SKB_PAD, | |
| 1177 | − GFP_ATOMIC); | |
| 1209 | + first_buf->data = bnx2x_frag_alloc(fp); | |
| 1178 | 1210 | if (!first_buf->data) { |
| 1179 | 1211 | BNX2X_ERR("Failed to allocate TPA skb pool for queue[%d] - disabling TPA on this queue!\n", |
| 1180 | 1212 | j); |
| @@ -1217,7 +1249,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) · 36 unmodified lines | ||
| 1217 | 1249 | } |
| 1218 | 1250 | } |
| 1219 | 1251 | |
| 1220 | − for_each_rx_queue(bp, j) { | |
| 1252 | + for_each_eth_queue(bp, j) { | |
| 1221 | 1253 | struct bnx2x_fastpath *fp = &bp->fp[j]; |
| 1222 | 1254 | |
| 1223 | 1255 | fp->rx_bd_cons = 0; |
| @@ -1244,29 +1276,45 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) · 20 unmodified lines | ||
| 1244 | 1276 | } |
| 1245 | 1277 | } |
| 1246 | 1278 | |
| 1247 | −static void bnx2x_free_tx_skbs(struct bnx2x *bp) | |
| 1279 | +static void bnx2x_free_tx_skbs_queue(struct bnx2x_fastpath *fp) | |
| 1248 | 1280 | { |
| 1249 | − int i; | |
| 1250 | 1281 | u8 cos; |
| 1282 | + struct bnx2x *bp = fp->bp; | |
| 1251 | 1283 | |
| 1252 | − for_each_tx_queue(bp, i) { | |
| 1253 | − struct bnx2x_fastpath *fp = &bp->fp[i]; | |
| 1254 | − for_each_cos_in_tx_queue(fp, cos) { | |
| 1255 | − struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; | |
| 1256 | − unsigned pkts_compl = 0, bytes_compl = 0; | |
| 1284 | + for_each_cos_in_tx_queue(fp, cos) { | |
| 1285 | + struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; | |
| 1286 | + unsigned pkts_compl = 0, bytes_compl = 0; | |
| 1257 | 1287 | |
| 1258 | − u16 sw_prod = txdata->tx_pkt_prod; | |
| 1259 | − u16 sw_cons = txdata->tx_pkt_cons; | |
| 1288 | + u16 sw_prod = txdata->tx_pkt_prod; | |
| 1289 | + u16 sw_cons = txdata->tx_pkt_cons; | |
| 1260 | 1290 | |
| 1261 | − while (sw_cons != sw_prod) { | |
| 1262 | − bnx2x_free_tx_pkt(bp, txdata, TX_BD(sw_cons), | |
| 1263 | − &pkts_compl, &bytes_compl); | |
| 1264 | − sw_cons++; | |
| 1265 | − } | |
| 1266 | − netdev_tx_reset_queue( | |
| 1267 | − netdev_get_tx_queue(bp->dev, | |
| 1268 | − txdata->txq_index)); | |
| 1291 | + while (sw_cons != sw_prod) { | |
| 1292 | + bnx2x_free_tx_pkt(bp, txdata, TX_BD(sw_cons), | |
| 1293 | + &pkts_compl, &bytes_compl); | |
| 1294 | + sw_cons++; | |
| 1269 | 1295 | } |
| 1296 | + | |
| 1297 | + netdev_tx_reset_queue( | |
| 1298 | + netdev_get_tx_queue(bp->dev, | |
| 1299 | + txdata->txq_index)); | |
| 1300 | + } | |
| 1301 | +} | |
| 1302 | + | |
| 1303 | +static void bnx2x_free_tx_skbs_cnic(struct bnx2x *bp) | |
| 1304 | +{ | |
| 1305 | + int i; | |
| 1306 | + | |
| 1307 | + for_each_tx_queue_cnic(bp, i) { | |
| 1308 | + bnx2x_free_tx_skbs_queue(&bp->fp[i]); | |
| 1309 | + } | |
| 1310 | +} | |
| 1311 | + | |
| 1312 | +static void bnx2x_free_tx_skbs(struct bnx2x *bp) | |
| 1313 | +{ | |
| 1314 | + int i; | |
| 1315 | + | |
| 1316 | + for_each_eth_queue(bp, i) { | |
| 1317 | + bnx2x_free_tx_skbs_queue(&bp->fp[i]); | |
| 1270 | 1318 | } |
| 1271 | 1319 | } |
| 1272 | 1320 | |
| @@ -1290,7 +1338,16 @@ static void bnx2x_free_rx_bds(struct bnx2x_fastpath *fp) · 17 unmodified lines | ||
| 1290 | 1338 | fp->rx_buf_size, DMA_FROM_DEVICE); |
| 1291 | 1339 | |
| 1292 | 1340 | rx_buf->data = NULL; |
| 1293 | − kfree(data); | |
| 1341 | + bnx2x_frag_free(fp, data); | |
| 1342 | + } | |
| 1343 | +} | |
| 1344 | + | |
| 1345 | +static void bnx2x_free_rx_skbs_cnic(struct bnx2x *bp) | |
| 1346 | +{ | |
| 1347 | + int j; | |
| 1348 | + | |
| 1349 | + for_each_rx_queue_cnic(bp, j) { | |
| 1350 | + bnx2x_free_rx_bds(&bp->fp[j]); | |
| 1294 | 1351 | } |
| 1295 | 1352 | } |
| 1296 | 1353 | |
| @@ -1298,7 +1355,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp) · 1 unmodified line | ||
| 1298 | 1355 | { |
| 1299 | 1356 | int j; |
| 1300 | 1357 | |
| 1301 | − for_each_rx_queue(bp, j) { | |
| 1358 | + for_each_eth_queue(bp, j) { | |
| 1302 | 1359 | struct bnx2x_fastpath *fp = &bp->fp[j]; |
| 1303 | 1360 | |
| 1304 | 1361 | bnx2x_free_rx_bds(fp); |
| @@ -1308,6 +1365,12 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp) · 3 unmodified lines | ||
| 1308 | 1365 | } |
| 1309 | 1366 | } |
| 1310 | 1367 | |
| 1368 | +void bnx2x_free_skbs_cnic(struct bnx2x *bp) | |
| 1369 | +{ | |
| 1370 | + bnx2x_free_tx_skbs_cnic(bp); | |
| 1371 | + bnx2x_free_rx_skbs_cnic(bp); | |
| 1372 | +} | |
| 1373 | + | |
| 1311 | 1374 | void bnx2x_free_skbs(struct bnx2x *bp) |
| 1312 | 1375 | { |
| 1313 | 1376 | bnx2x_free_tx_skbs(bp); |
| @@ -1347,11 +1410,12 @@ static void bnx2x_free_msix_irqs(struct bnx2x *bp, int nvecs) · 33 unmodified lines | ||
| 1347 | 1410 | DP(NETIF_MSG_IFDOWN, "released sp irq (%d)\n", |
| 1348 | 1411 | bp->msix_table[offset].vector); |
| 1349 | 1412 | offset++; |
| 1350 | −#ifdef BCM_CNIC | |
| 1351 | − if (nvecs == offset) | |
| 1352 | − return; | |
| 1353 | − offset++; | |
| 1354 | −#endif | |
| 1413 | + | |
| 1414 | + if (CNIC_SUPPORT(bp)) { | |
| 1415 | + if (nvecs == offset) | |
| 1416 | + return; | |
| 1417 | + offset++; | |
| 1418 | + } | |
| 1355 | 1419 | |
| 1356 | 1420 | for_each_eth_queue(bp, i) { |
| 1357 | 1421 | if (nvecs == offset) |
| @@ -1368,7 +1432,7 @@ void bnx2x_free_irq(struct bnx2x *bp) · 10 unmodified lines | ||
| 1368 | 1432 | if (bp->flags & USING_MSIX_FLAG && |
| 1369 | 1433 | !(bp->flags & USING_SINGLE_MSIX_FLAG)) |
| 1370 | 1434 | bnx2x_free_msix_irqs(bp, BNX2X_NUM_ETH_QUEUES(bp) + |
| 1371 | − CNIC_PRESENT + 1); | |
| 1435 | + CNIC_SUPPORT(bp) + 1); | |
| 1372 | 1436 | else |
| 1373 | 1437 | free_irq(bp->dev->irq, bp->dev); |
| 1374 | 1438 | } |
| @@ -1382,12 +1446,14 @@ int bnx2x_enable_msix(struct bnx2x *bp) · 7 unmodified lines | ||
| 1382 | 1446 | bp->msix_table[0].entry); |
| 1383 | 1447 | msix_vec++; |
| 1384 | 1448 | |
| 1385 | −#ifdef BCM_CNIC | |
| 1386 | − bp->msix_table[msix_vec].entry = msix_vec; | |
| 1387 | − BNX2X_DEV_INFO("msix_table[%d].entry = %d (CNIC)\n", | |
| 1388 | − bp->msix_table[msix_vec].entry, bp->msix_table[msix_vec].entry); | |
| 1389 | − msix_vec++; | |
| 1390 | −#endif | |
| 1449 | + /* Cnic requires an msix vector for itself */ | |
| 1450 | + if (CNIC_SUPPORT(bp)) { | |
| 1451 | + bp->msix_table[msix_vec].entry = msix_vec; | |
| 1452 | + BNX2X_DEV_INFO("msix_table[%d].entry = %d (CNIC)\n", | |
| 1453 | + msix_vec, bp->msix_table[msix_vec].entry); | |
| 1454 | + msix_vec++; | |
| 1455 | + } | |
| 1456 | + | |
| 1391 | 1457 | /* We need separate vectors for ETH queues only (not FCoE) */ |
| 1392 | 1458 | for_each_eth_queue(bp, i) { |
| 1393 | 1459 | bp->msix_table[msix_vec].entry = msix_vec; |
| @@ -1396,7 +1462,7 @@ int bnx2x_enable_msix(struct bnx2x *bp) · 2 unmodified lines | ||
| 1396 | 1462 | msix_vec++; |
| 1397 | 1463 | } |
| 1398 | 1464 | |
| 1399 | − req_cnt = BNX2X_NUM_ETH_QUEUES(bp) + CNIC_PRESENT + 1; | |
| 1465 | + req_cnt = BNX2X_NUM_ETH_QUEUES(bp) + CNIC_SUPPORT(bp) + 1; | |
| 1400 | 1466 | |
| 1401 | 1467 | rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], req_cnt); |
| 1402 | 1468 | |
| @@ -1404,7 +1470,7 @@ int bnx2x_enable_msix(struct bnx2x *bp) · 1 unmodified line | ||
| 1404 | 1470 | * reconfigure number of tx/rx queues according to available |
| 1405 | 1471 | * MSI-X vectors |
| 1406 | 1472 | */ |
| 1407 | − if (rc >= BNX2X_MIN_MSIX_VEC_CNT) { | |
| 1473 | + if (rc >= BNX2X_MIN_MSIX_VEC_CNT(bp)) { | |
| 1408 | 1474 | /* how less vectors we will have? */ |
| 1409 | 1475 | int diff = req_cnt - rc; |
| 1410 | 1476 | |
| @@ -1419,7 +1485,8 @@ int bnx2x_enable_msix(struct bnx2x *bp) · 8 unmodified lines | ||
| 1419 | 1485 | /* |
| 1420 | 1486 | * decrease number of queues by number of unallocated entries |
| 1421 | 1487 | */ |
| 1422 | − bp->num_queues -= diff; | |
| 1488 | + bp->num_ethernet_queues -= diff; | |
| 1489 | + bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; | |
| 1423 | 1490 | |
| 1424 | 1491 | BNX2X_DEV_INFO("New queue configuration set: %d\n", |
| 1425 | 1492 | bp->num_queues); |
| @@ -1435,6 +1502,9 @@ int bnx2x_enable_msix(struct bnx2x *bp) · 9 unmodified lines | ||
| 1435 | 1502 | BNX2X_DEV_INFO("Using single MSI-X vector\n"); |
| 1436 | 1503 | bp->flags |= USING_SINGLE_MSIX_FLAG; |
| 1437 | 1504 | |
| 1505 | + BNX2X_DEV_INFO("set number of queues to 1\n"); | |
| 1506 | + bp->num_ethernet_queues = 1; | |
| 1507 | + bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; | |
| 1438 | 1508 | } else if (rc < 0) { |
| 1439 | 1509 | BNX2X_DEV_INFO("MSI-X is not attainable rc %d\n", rc); |
| 1440 | 1510 | goto no_msix; |
| @@ -1464,9 +1534,9 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp) · 23 unmodified lines | ||
| 1464 | 1534 | return -EBUSY; |
| 1465 | 1535 | } |
| 1466 | 1536 | |
| 1467 | −#ifdef BCM_CNIC | |
| 1468 | − offset++; | |
| 1469 | −#endif | |
| 1537 | + if (CNIC_SUPPORT(bp)) | |
| 1538 | + offset++; | |
| 1539 | + | |
| 1470 | 1540 | for_each_eth_queue(bp, i) { |
| 1471 | 1541 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
| 1472 | 1542 | snprintf(fp->name, sizeof(fp->name), "%s-fp-%d", |
| @@ -1485,7 +1555,7 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp) · 12 unmodified lines | ||
| 1485 | 1555 | } |
| 1486 | 1556 | |
| 1487 | 1557 | i = BNX2X_NUM_ETH_QUEUES(bp); |
| 1488 | − offset = 1 + CNIC_PRESENT; | |
| 1558 | + offset = 1 + CNIC_SUPPORT(bp); | |
| 1489 | 1559 | netdev_info(bp->dev, "using MSI-X IRQs: sp %d fp[%d] %d ... fp[%d] %d\n", |
| 1490 | 1560 | bp->msix_table[0].vector, |
| 1491 | 1561 | 0, bp->msix_table[offset].vector, |
| @@ -1556,19 +1626,35 @@ static int bnx2x_setup_irqs(struct bnx2x *bp) · 64 unmodified lines | ||
| 1556 | 1626 | return 0; |
| 1557 | 1627 | } |
| 1558 | 1628 | |
| 1629 | +static void bnx2x_napi_enable_cnic(struct bnx2x *bp) | |
| 1630 | +{ | |
| 1631 | + int i; | |
| 1632 | + | |
| 1633 | + for_each_rx_queue_cnic(bp, i) | |
| 1634 | + napi_enable(&bnx2x_fp(bp, i, napi)); | |
| 1635 | +} | |
| 1636 | + | |
| 1559 | 1637 | static void bnx2x_napi_enable(struct bnx2x *bp) |
| 1560 | 1638 | { |
| 1561 | 1639 | int i; |
| 1562 | 1640 | |
| 1563 | − for_each_rx_queue(bp, i) | |
| 1641 | + for_each_eth_queue(bp, i) | |
| 1564 | 1642 | napi_enable(&bnx2x_fp(bp, i, napi)); |
| 1565 | 1643 | } |
| 1566 | 1644 | |
| 1645 | +static void bnx2x_napi_disable_cnic(struct bnx2x *bp) | |
| 1646 | +{ | |
| 1647 | + int i; | |
| 1648 | + | |
| 1649 | + for_each_rx_queue_cnic(bp, i) | |
| 1650 | + napi_disable(&bnx2x_fp(bp, i, napi)); | |
| 1651 | +} | |
| 1652 | + | |
| 1567 | 1653 | static void bnx2x_napi_disable(struct bnx2x *bp) |
| 1568 | 1654 | { |
| 1569 | 1655 | int i; |
| 1570 | 1656 | |
| 1571 | − for_each_rx_queue(bp, i) | |
| 1657 | + for_each_eth_queue(bp, i) | |
| 1572 | 1658 | napi_disable(&bnx2x_fp(bp, i, napi)); |
| 1573 | 1659 | } |
| 1574 | 1660 | |
| @@ -1576,6 +1662,8 @@ void bnx2x_netif_start(struct bnx2x *bp) · 1 unmodified line | ||
| 1576 | 1662 | { |
| 1577 | 1663 | if (netif_running(bp->dev)) { |
| 1578 | 1664 | bnx2x_napi_enable(bp); |
| 1665 | + if (CNIC_LOADED(bp)) | |
| 1666 | + bnx2x_napi_enable_cnic(bp); | |
| 1579 | 1667 | bnx2x_int_enable(bp); |
| 1580 | 1668 | if (bp->state == BNX2X_STATE_OPEN) |
| 1581 | 1669 | netif_tx_wake_all_queues(bp->dev); |
| @@ -1586,14 +1674,15 @@ void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) · 4 unmodified lines | ||
| 1586 | 1674 | { |
| 1587 | 1675 | bnx2x_int_disable_sync(bp, disable_hw); |
| 1588 | 1676 | bnx2x_napi_disable(bp); |
| 1677 | + if (CNIC_LOADED(bp)) | |
| 1678 | + bnx2x_napi_disable_cnic(bp); | |
| 1589 | 1679 | } |
| 1590 | 1680 | |
| 1591 | 1681 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb) |
| 1592 | 1682 | { |
| 1593 | 1683 | struct bnx2x *bp = netdev_priv(dev); |
| 1594 | 1684 | |
| 1595 | −#ifdef BCM_CNIC | |
| 1596 | − if (!NO_FCOE(bp)) { | |
| 1685 | + if (CNIC_LOADED(bp) && !NO_FCOE(bp)) { | |
| 1597 | 1686 | struct ethhdr *hdr = (struct ethhdr *)skb->data; |
| 1598 | 1687 | u16 ether_type = ntohs(hdr->h_proto); |
| 1599 | 1688 | |
| @@ -1609,7 +1698,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb) · 9 unmodified lines | ||
| 1609 | 1698 | if ((ether_type == ETH_P_FCOE) || (ether_type == ETH_P_FIP)) |
| 1610 | 1699 | return bnx2x_fcoe_tx(bp, txq_index); |
| 1611 | 1700 | } |
| 1612 | −#endif | |
| 1701 | + | |
| 1613 | 1702 | /* select a non-FCoE queue */ |
| 1614 | 1703 | return __skb_tx_hash(dev, skb, BNX2X_NUM_ETH_QUEUES(bp)); |
| 1615 | 1704 | } |
| @@ -1618,15 +1707,15 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb) · 2 unmodified lines | ||
| 1618 | 1707 | void bnx2x_set_num_queues(struct bnx2x *bp) |
| 1619 | 1708 | { |
| 1620 | 1709 | /* RSS queues */ |
| 1621 | − bp->num_queues = bnx2x_calc_num_queues(bp); | |
| 1710 | + bp->num_ethernet_queues = bnx2x_calc_num_queues(bp); | |
| 1622 | 1711 | |
| 1623 | −#ifdef BCM_CNIC | |
| 1624 | 1712 | /* override in STORAGE SD modes */ |
| 1625 | 1713 | if (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp)) |
| 1626 | − bp->num_queues = 1; | |
| 1627 | −#endif | |
| 1714 | + bp->num_ethernet_queues = 1; | |
| 1715 | + | |
| 1628 | 1716 | /* Add special queues */ |
| 1629 | − bp->num_queues += NON_ETH_CONTEXT_USE; | |
| 1717 | + bp->num_cnic_queues = CNIC_SUPPORT(bp); /* For FCOE */ | |
| 1718 | + bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; | |
| 1630 | 1719 | |
| 1631 | 1720 | BNX2X_DEV_INFO("set number of queues to %d\n", bp->num_queues); |
| 1632 | 1721 | } |
| @@ -1653,20 +1742,18 @@ void bnx2x_set_num_queues(struct bnx2x *bp) · 20 unmodified lines | ||
| 1653 | 1742 | * bnx2x_setup_tc() takes care of the proper TC mappings so that __skb_tx_hash() |
| 1654 | 1743 | * will return a proper Tx index if TC is enabled (netdev->num_tc > 0). |
| 1655 | 1744 | */ |
| 1656 | −static int bnx2x_set_real_num_queues(struct bnx2x *bp) | |
| 1745 | +static int bnx2x_set_real_num_queues(struct bnx2x *bp, int include_cnic) | |
| 1657 | 1746 | { |
| 1658 | 1747 | int rc, tx, rx; |
| 1659 | 1748 | |
| 1660 | 1749 | tx = BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos; |
| 1661 | − rx = BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE; | |
| 1750 | + rx = BNX2X_NUM_ETH_QUEUES(bp); | |
| 1662 | 1751 | |
| 1663 | 1752 | /* account for fcoe queue */ |
| 1664 | −#ifdef BCM_CNIC | |
| 1665 | − if (!NO_FCOE(bp)) { | |
| 1666 | − rx += FCOE_PRESENT; | |
| 1667 | − tx += FCOE_PRESENT; | |
| 1753 | + if (include_cnic && !NO_FCOE(bp)) { | |
| 1754 | + rx++; | |
| 1755 | + tx++; | |
| 1668 | 1756 | } |
| 1669 | −#endif | |
| 1670 | 1757 | |
| 1671 | 1758 | rc = netif_set_real_num_tx_queues(bp->dev, tx); |
| 1672 | 1759 | if (rc) { |
| @@ -1710,6 +1797,10 @@ static void bnx2x_set_rx_buf_size(struct bnx2x *bp) · 37 unmodified lines | ||
| 1710 | 1797 | mtu + |
| 1711 | 1798 | BNX2X_FW_RX_ALIGN_END; |
| 1712 | 1799 | /* Note : rx_buf_size doesnt take into account NET_SKB_PAD */ |
| 1800 | + if (fp->rx_buf_size + NET_SKB_PAD <= PAGE_SIZE) | |
| 1801 | + fp->rx_frag_size = fp->rx_buf_size + NET_SKB_PAD; | |
| 1802 | + else | |
| 1803 | + fp->rx_frag_size = 0; | |
| 1713 | 1804 | } |
| 1714 | 1805 | } |
| 1715 | 1806 | |
| @@ -1859,14 +1950,26 @@ static void bnx2x_squeeze_objects(struct bnx2x *bp) · 143 unmodified lines | ||
| 1859 | 1950 | (bp)->state = BNX2X_STATE_ERROR; \ |
| 1860 | 1951 | goto label; \ |
| 1861 | 1952 | } while (0) |
| 1862 | −#else | |
| 1953 | + | |
| 1954 | +#define LOAD_ERROR_EXIT_CNIC(bp, label) \ | |
| 1955 | + do { \ | |
| 1956 | + bp->cnic_loaded = false; \ | |
| 1957 | + goto label; \ | |
| 1958 | + } while (0) | |
| 1959 | +#else /*BNX2X_STOP_ON_ERROR*/ | |
| 1863 | 1960 | #define LOAD_ERROR_EXIT(bp, label) \ |
| 1864 | 1961 | do { \ |
| 1865 | 1962 | (bp)->state = BNX2X_STATE_ERROR; \ |
| 1866 | 1963 | (bp)->panic = 1; \ |
| 1867 | 1964 | return -EBUSY; \ |
| 1868 | 1965 | } while (0) |
| 1869 | −#endif | |
| 1966 | +#define LOAD_ERROR_EXIT_CNIC(bp, label) \ | |
| 1967 | + do { \ | |
| 1968 | + bp->cnic_loaded = false; \ | |
| 1969 | + (bp)->panic = 1; \ | |
| 1970 | + return -EBUSY; \ | |
| 1971 | + } while (0) | |
| 1972 | +#endif /*BNX2X_STOP_ON_ERROR*/ | |
| 1870 | 1973 | |
| 1871 | 1974 | bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err) |
| 1872 | 1975 | { |
| @@ -1959,10 +2062,8 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) · 86 unmodified lines | ||
| 1959 | 2062 | fp->max_cos = 1; |
| 1960 | 2063 | |
| 1961 | 2064 | /* Init txdata pointers */ |
| 1962 | −#ifdef BCM_CNIC | |
| 1963 | 2065 | if (IS_FCOE_FP(fp)) |
| 1964 | 2066 | fp->txdata_ptr[0] = &bp->bnx2x_txq[FCOE_TXQ_IDX(bp)]; |
| 1965 | −#endif | |
| 1966 | 2067 | if (IS_ETH_FP(fp)) |
| 1967 | 2068 | for_each_cos_in_tx_queue(fp, cos) |
| 1968 | 2069 | fp->txdata_ptr[cos] = &bp->bnx2x_txq[cos * |
| @@ -1980,11 +2081,95 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) · 11 unmodified lines | ||
| 1980 | 2081 | else if (bp->flags & GRO_ENABLE_FLAG) |
| 1981 | 2082 | fp->mode = TPA_MODE_GRO; |
| 1982 | 2083 | |
| 1983 | −#ifdef BCM_CNIC | |
| 1984 | 2084 | /* We don't want TPA on an FCoE L2 ring */ |
| 1985 | 2085 | if (IS_FCOE_FP(fp)) |
| 1986 | 2086 | fp->disable_tpa = 1; |
| 1987 | −#endif | |
| 2087 | +} | |
| 2088 | + | |
| 2089 | +int bnx2x_load_cnic(struct bnx2x *bp) | |
| 2090 | +{ | |
| 2091 | + int i, rc, port = BP_PORT(bp); | |
| 2092 | + | |
| 2093 | + DP(NETIF_MSG_IFUP, "Starting CNIC-related load\n"); | |
| 2094 | + | |
| 2095 | + mutex_init(&bp->cnic_mutex); | |
| 2096 | + | |
| 2097 | + rc = bnx2x_alloc_mem_cnic(bp); | |
| 2098 | + if (rc) { | |
| 2099 | + BNX2X_ERR("Unable to allocate bp memory for cnic\n"); | |
| 2100 | + LOAD_ERROR_EXIT_CNIC(bp, load_error_cnic0); | |
| 2101 | + } | |
| 2102 | + | |
| 2103 | + rc = bnx2x_alloc_fp_mem_cnic(bp); | |
| 2104 | + if (rc) { | |
| 2105 | + BNX2X_ERR("Unable to allocate memory for cnic fps\n"); | |
| 2106 | + LOAD_ERROR_EXIT_CNIC(bp, load_error_cnic0); | |
| 2107 | + } | |
| 2108 | + | |
| 2109 | + /* Update the number of queues with the cnic queues */ | |
| 2110 | + rc = bnx2x_set_real_num_queues(bp, 1); | |
| 2111 | + if (rc) { | |
| 2112 | + BNX2X_ERR("Unable to set real_num_queues including cnic\n"); | |
| 2113 | + LOAD_ERROR_EXIT_CNIC(bp, load_error_cnic0); | |
| 2114 | + } | |
| 2115 | + | |
| 2116 | + /* Add all CNIC NAPI objects */ | |
| 2117 | + bnx2x_add_all_napi_cnic(bp); | |
| 2118 | + DP(NETIF_MSG_IFUP, "cnic napi added\n"); | |
| 2119 | + bnx2x_napi_enable_cnic(bp); | |
| 2120 | + | |
| 2121 | + rc = bnx2x_init_hw_func_cnic(bp); | |
| 2122 | + if (rc) | |
| 2123 | + LOAD_ERROR_EXIT_CNIC(bp, load_error_cnic1); | |
| 2124 | + | |
| 2125 | + bnx2x_nic_init_cnic(bp); | |
| 2126 | + | |
| 2127 | + /* Enable Timer scan */ | |
| 2128 | + REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 1); | |
| 2129 | + | |
| 2130 | + for_each_cnic_queue(bp, i) { | |
| 2131 | + rc = bnx2x_setup_queue(bp, &bp->fp[i], 0); | |
| 2132 | + if (rc) { | |
| 2133 | + BNX2X_ERR("Queue setup failed\n"); | |
| 2134 | + LOAD_ERROR_EXIT(bp, load_error_cnic2); | |
| 2135 | + } | |
| 2136 | + } | |
| 2137 | + | |
| 2138 | + /* Initialize Rx filter. */ | |
| 2139 | + netif_addr_lock_bh(bp->dev); | |
| 2140 | + bnx2x_set_rx_mode(bp->dev); | |
| 2141 | + netif_addr_unlock_bh(bp->dev); | |
| 2142 | + | |
| 2143 | + /* re-read iscsi info */ | |
| 2144 | + bnx2x_get_iscsi_info(bp); | |
| 2145 | + bnx2x_setup_cnic_irq_info(bp); | |
| 2146 | + bnx2x_setup_cnic_info(bp); | |
| 2147 | + bp->cnic_loaded = true; | |
| 2148 | + if (bp->state == BNX2X_STATE_OPEN) | |
| 2149 | + bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD); | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + DP(NETIF_MSG_IFUP, "Ending successfully CNIC-related load\n"); | |
| 2153 | + | |
| 2154 | + return 0; | |
| 2155 | + | |
| 2156 | +#ifndef BNX2X_STOP_ON_ERROR | |
| 2157 | +load_error_cnic2: | |
| 2158 | + /* Disable Timer scan */ | |
| 2159 | + REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 0); | |
| 2160 | + | |
| 2161 | +load_error_cnic1: | |
| 2162 | + bnx2x_napi_disable_cnic(bp); | |
| 2163 | + /* Update the number of queues without the cnic queues */ | |
| 2164 | + rc = bnx2x_set_real_num_queues(bp, 0); | |
| 2165 | + if (rc) | |
| 2166 | + BNX2X_ERR("Unable to set real_num_queues not including cnic\n"); | |
| 2167 | +load_error_cnic0: | |
| 2168 | + BNX2X_ERR("CNIC-related load failed\n"); | |
| 2169 | + bnx2x_free_fp_mem_cnic(bp); | |
| 2170 | + bnx2x_free_mem_cnic(bp); | |
| 2171 | + return rc; | |
| 2172 | +#endif /* ! BNX2X_STOP_ON_ERROR */ | |
| 1988 | 2173 | } |
| 1989 | 2174 | |
| 1990 | 2175 | |
| @@ -1995,6 +2180,10 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 4 unmodified lines | ||
| 1995 | 2180 | u32 load_code; |
| 1996 | 2181 | int i, rc; |
| 1997 | 2182 | |
| 2183 | + DP(NETIF_MSG_IFUP, "Starting NIC load\n"); | |
| 2184 | + DP(NETIF_MSG_IFUP, | |
| 2185 | + "CNIC is %s\n", CNIC_ENABLED(bp) ? "enabled" : "disabled"); | |
| 2186 | + | |
| 1998 | 2187 | #ifdef BNX2X_STOP_ON_ERROR |
| 1999 | 2188 | if (unlikely(bp->panic)) { |
| 2000 | 2189 | BNX2X_ERR("Can't load NIC when there is panic\n"); |
| @@ -2022,9 +2211,11 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 21 unmodified lines | ||
| 2022 | 2211 | DP(NETIF_MSG_IFUP, "num queues: %d", bp->num_queues); |
| 2023 | 2212 | for_each_queue(bp, i) |
| 2024 | 2213 | bnx2x_bz_fp(bp, i); |
| 2025 | − memset(bp->bnx2x_txq, 0, bp->bnx2x_txq_size * | |
| 2026 | − sizeof(struct bnx2x_fp_txdata)); | |
| 2214 | + memset(bp->bnx2x_txq, 0, (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS + | |
| 2215 | + bp->num_cnic_queues) * | |
| 2216 | + sizeof(struct bnx2x_fp_txdata)); | |
| 2027 | 2217 | |
| 2218 | + bp->fcoe_init = false; | |
| 2028 | 2219 | |
| 2029 | 2220 | /* Set the receive queues buffer size */ |
| 2030 | 2221 | bnx2x_set_rx_buf_size(bp); |
| @@ -2034,9 +2225,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 3 unmodified lines | ||
| 2034 | 2225 | |
| 2035 | 2226 | /* As long as bnx2x_alloc_mem() may possibly update |
| 2036 | 2227 | * bp->num_queues, bnx2x_set_real_num_queues() should always |
| 2037 | − * come after it. | |
| 2228 | + * come after it. At this stage cnic queues are not counted. | |
| 2038 | 2229 | */ |
| 2039 | − rc = bnx2x_set_real_num_queues(bp); | |
| 2230 | + rc = bnx2x_set_real_num_queues(bp, 0); | |
| 2040 | 2231 | if (rc) { |
| 2041 | 2232 | BNX2X_ERR("Unable to set real_num_queues\n"); |
| 2042 | 2233 | LOAD_ERROR_EXIT(bp, load_error0); |
| @@ -2050,6 +2241,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 7 unmodified lines | ||
| 2050 | 2241 | |
| 2051 | 2242 | /* Add all NAPI objects */ |
| 2052 | 2243 | bnx2x_add_all_napi(bp); |
| 2244 | + DP(NETIF_MSG_IFUP, "napi added\n"); | |
| 2053 | 2245 | bnx2x_napi_enable(bp); |
| 2054 | 2246 | |
| 2055 | 2247 | /* set pf load just before approaching the MCP */ |
| @@ -2073,7 +2265,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 17 unmodified lines | ||
| 2073 | 2265 | DRV_PULSE_SEQ_MASK); |
| 2074 | 2266 | BNX2X_DEV_INFO("drv_pulse 0x%x\n", bp->fw_drv_pulse_wr_seq); |
| 2075 | 2267 | |
| 2076 | − load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, 0); | |
| 2268 | + load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, | |
| 2269 | + DRV_MSG_CODE_LOAD_REQ_WITH_LFA); | |
| 2077 | 2270 | if (!load_code) { |
| 2078 | 2271 | BNX2X_ERR("MCP response failure, aborting\n"); |
| 2079 | 2272 | rc = -EBUSY; |
| @@ -2191,23 +2384,18 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 111 unmodified lines | ||
| 2191 | 2384 | LOAD_ERROR_EXIT(bp, load_error3); |
| 2192 | 2385 | } |
| 2193 | 2386 | |
| 2194 | −#ifdef BCM_CNIC | |
| 2195 | − /* Enable Timer scan */ | |
| 2196 | − REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 1); | |
| 2197 | −#endif | |
| 2198 | − | |
| 2199 | − for_each_nondefault_queue(bp, i) { | |
| 2387 | + for_each_nondefault_eth_queue(bp, i) { | |
| 2200 | 2388 | rc = bnx2x_setup_queue(bp, &bp->fp[i], 0); |
| 2201 | 2389 | if (rc) { |
| 2202 | 2390 | BNX2X_ERR("Queue setup failed\n"); |
| 2203 | − LOAD_ERROR_EXIT(bp, load_error4); | |
| 2391 | + LOAD_ERROR_EXIT(bp, load_error3); | |
| 2204 | 2392 | } |
| 2205 | 2393 | } |
| 2206 | 2394 | |
| 2207 | 2395 | rc = bnx2x_init_rss_pf(bp); |
| 2208 | 2396 | if (rc) { |
| 2209 | 2397 | BNX2X_ERR("PF RSS init failed\n"); |
| 2210 | − LOAD_ERROR_EXIT(bp, load_error4); | |
| 2398 | + LOAD_ERROR_EXIT(bp, load_error3); | |
| 2211 | 2399 | } |
| 2212 | 2400 | |
| 2213 | 2401 | /* Now when Clients are configured we are ready to work */ |
| @@ -2217,7 +2405,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 3 unmodified lines | ||
| 2217 | 2405 | rc = bnx2x_set_eth_mac(bp, true); |
| 2218 | 2406 | if (rc) { |
| 2219 | 2407 | BNX2X_ERR("Setting Ethernet MAC failed\n"); |
| 2220 | − LOAD_ERROR_EXIT(bp, load_error4); | |
| 2408 | + LOAD_ERROR_EXIT(bp, load_error3); | |
| 2221 | 2409 | } |
| 2222 | 2410 | |
| 2223 | 2411 | if (bp->pending_max) { |
| @@ -2227,6 +2415,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 3 unmodified lines | ||
| 2227 | 2415 | |
| 2228 | 2416 | if (bp->port.pmf) |
| 2229 | 2417 | bnx2x_initial_phy_init(bp, load_mode); |
| 2418 | + bp->link_params.feature_config_flags &= ~FEATURE_CONFIG_BOOT_FROM_SAN; | |
| 2230 | 2419 | |
| 2231 | 2420 | /* Start fast path */ |
| 2232 | 2421 | |
| @@ -2257,21 +2446,15 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 24 unmodified lines | ||
| 2257 | 2446 | } |
| 2258 | 2447 | |
| 2259 | 2448 | if (bp->port.pmf) |
| 2260 | − bnx2x_update_drv_flags(bp, 1 << DRV_FLAGS_DCB_CONFIGURED, 0); | |
| 2449 | + bnx2x_update_drv_flags(bp, 1 << DRV_FLAGS_PORT_MASK, 0); | |
| 2261 | 2450 | else |
| 2262 | 2451 | bnx2x__link_status_update(bp); |
| 2263 | 2452 | |
| 2264 | 2453 | /* start the timer */ |
| 2265 | 2454 | mod_timer(&bp->timer, jiffies + bp->current_interval); |
| 2266 | 2455 | |
| 2267 | −#ifdef BCM_CNIC | |
| 2268 | − /* re-read iscsi info */ | |
| 2269 | − bnx2x_get_iscsi_info(bp); | |
| 2270 | − bnx2x_setup_cnic_irq_info(bp); | |
| 2271 | − bnx2x_setup_cnic_info(bp); | |
| 2272 | − if (bp->state == BNX2X_STATE_OPEN) | |
| 2273 | − bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD); | |
| 2274 | −#endif | |
| 2456 | + if (CNIC_ENABLED(bp)) | |
| 2457 | + bnx2x_load_cnic(bp); | |
| 2275 | 2458 | |
| 2276 | 2459 | /* mark driver is loaded in shmem2 */ |
| 2277 | 2460 | if (SHMEM2_HAS(bp, drv_capabilities_flag)) { |
| @@ -2293,14 +2476,11 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) · 15 unmodified lines | ||
| 2293 | 2476 | if (bp->port.pmf && (bp->state != BNX2X_STATE_DIAG)) |
| 2294 | 2477 | bnx2x_dcbx_init(bp, false); |
| 2295 | 2478 | |
| 2479 | + DP(NETIF_MSG_IFUP, "Ending successfully NIC load\n"); | |
| 2480 | + | |
| 2296 | 2481 | return 0; |
| 2297 | 2482 | |
| 2298 | 2483 | #ifndef BNX2X_STOP_ON_ERROR |
| 2299 | −load_error4: | |
| 2300 | −#ifdef BCM_CNIC | |
| 2301 | − /* Disable Timer scan */ | |
| 2302 | − REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 0); | |
| 2303 | −#endif | |
| 2304 | 2484 | load_error3: |
| 2305 | 2485 | bnx2x_int_disable_sync(bp, 1); |
| 2306 | 2486 | |
| @@ -2338,6 +2518,8 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 31 unmodified lines | ||
| 2338 | 2518 | int i; |
| 2339 | 2519 | bool global = false; |
| 2340 | 2520 | |
| 2521 | + DP(NETIF_MSG_IFUP, "Starting NIC unload\n"); | |
| 2522 | + | |
| 2341 | 2523 | /* mark driver is unloaded in shmem2 */ |
| 2342 | 2524 | if (SHMEM2_HAS(bp, drv_capabilities_flag)) { |
| 2343 | 2525 | u32 val; |
| @@ -2373,14 +2555,13 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 29 unmodified lines | ||
| 2373 | 2555 | bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT; |
| 2374 | 2556 | smp_mb(); |
| 2375 | 2557 | |
| 2558 | + if (CNIC_LOADED(bp)) | |
| 2559 | + bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); | |
| 2560 | + | |
| 2376 | 2561 | /* Stop Tx */ |
| 2377 | 2562 | bnx2x_tx_disable(bp); |
| 2378 | 2563 | netdev_reset_tc(bp->dev); |
| 2379 | 2564 | |
| 2380 | −#ifdef BCM_CNIC | |
| 2381 | − bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); | |
| 2382 | −#endif | |
| 2383 | − | |
| 2384 | 2565 | bp->rx_mode = BNX2X_RX_MODE_NONE; |
| 2385 | 2566 | |
| 2386 | 2567 | del_timer_sync(&bp->timer); |
| @@ -2414,7 +2595,8 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 27 unmodified lines | ||
| 2414 | 2595 | bnx2x_netif_stop(bp, 1); |
| 2415 | 2596 | /* Delete all NAPI objects */ |
| 2416 | 2597 | bnx2x_del_all_napi(bp); |
| 2417 | − | |
| 2598 | + if (CNIC_LOADED(bp)) | |
| 2599 | + bnx2x_del_all_napi_cnic(bp); | |
| 2418 | 2600 | /* Release IRQs */ |
| 2419 | 2601 | bnx2x_free_irq(bp); |
| 2420 | 2602 | |
| @@ -2435,12 +2617,19 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 14 unmodified lines | ||
| 2435 | 2617 | |
| 2436 | 2618 | /* Free SKBs, SGEs, TPA pool and driver internals */ |
| 2437 | 2619 | bnx2x_free_skbs(bp); |
| 2620 | + if (CNIC_LOADED(bp)) | |
| 2621 | + bnx2x_free_skbs_cnic(bp); | |
| 2438 | 2622 | for_each_rx_queue(bp, i) |
| 2439 | 2623 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); |
| 2440 | 2624 | |
| 2625 | + if (CNIC_LOADED(bp)) { | |
| 2626 | + bnx2x_free_fp_mem_cnic(bp); | |
| 2627 | + bnx2x_free_mem_cnic(bp); | |
| 2628 | + } | |
| 2441 | 2629 | bnx2x_free_mem(bp); |
| 2442 | 2630 | |
| 2443 | 2631 | bp->state = BNX2X_STATE_CLOSED; |
| 2632 | + bp->cnic_loaded = false; | |
| 2444 | 2633 | |
| 2445 | 2634 | /* Check if there are pending parity attentions. If there are - set |
| 2446 | 2635 | * RECOVERY_IN_PROGRESS. |
| @@ -2460,6 +2649,8 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) · 13 unmodified lines | ||
| 2460 | 2649 | if (!bnx2x_clear_pf_load(bp) && bnx2x_reset_is_done(bp, BP_PATH(bp))) |
| 2461 | 2650 | bnx2x_disable_close_the_gate(bp); |
| 2462 | 2651 | |
| 2652 | + DP(NETIF_MSG_IFUP, "Ending NIC unload\n"); | |
| 2653 | + | |
| 2463 | 2654 | return 0; |
| 2464 | 2655 | } |
| 2465 | 2656 | |
| @@ -2550,7 +2741,7 @@ int bnx2x_poll(struct napi_struct *napi, int budget) · 84 unmodified lines | ||
| 2550 | 2741 | |
| 2551 | 2742 | /* Fall out from the NAPI loop if needed */ |
| 2552 | 2743 | if (!(bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) { |
| 2553 | −#ifdef BCM_CNIC | |
| 2744 | + | |
| 2554 | 2745 | /* No need to update SB for FCoE L2 ring as long as |
| 2555 | 2746 | * it's connected to the default SB and the SB |
| 2556 | 2747 | * has been updated when NAPI was scheduled. |
| @@ -2559,8 +2750,6 @@ int bnx2x_poll(struct napi_struct *napi, int budget) · 2 unmodified lines | ||
| 2559 | 2750 | napi_complete(napi); |
| 2560 | 2751 | break; |
| 2561 | 2752 | } |
| 2562 | −#endif | |
| 2563 | − | |
| 2564 | 2753 | bnx2x_update_fpsb_idx(fp); |
| 2565 | 2754 | /* bnx2x_has_rx_work() reads the status block, |
| 2566 | 2755 | * thus we need to ensure that status block indices |
| @@ -2940,7 +3129,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 373 unmodified lines | ||
| 2940 | 3129 | txq_index = skb_get_queue_mapping(skb); |
| 2941 | 3130 | txq = netdev_get_tx_queue(dev, txq_index); |
| 2942 | 3131 | |
| 2943 | − BUG_ON(txq_index >= MAX_ETH_TXQ_IDX(bp) + FCOE_PRESENT); | |
| 3132 | + BUG_ON(txq_index >= MAX_ETH_TXQ_IDX(bp) + (CNIC_LOADED(bp) ? 1 : 0)); | |
| 2944 | 3133 | |
| 2945 | 3134 | txdata = &bp->bnx2x_txq[txq_index]; |
| 2946 | 3135 | |
| @@ -2958,11 +3147,16 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 11 unmodified lines | ||
| 2958 | 3147 | BDS_PER_TX_PKT + |
| 2959 | 3148 | NEXT_CNT_PER_TX_PKT(MAX_BDS_PER_TX_PKT))) { |
| 2960 | 3149 | /* Handle special storage cases separately */ |
| 2961 | − if (txdata->tx_ring_size != 0) { | |
| 2962 | − BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); | |
| 3150 | + if (txdata->tx_ring_size == 0) { | |
| 3151 | + struct bnx2x_eth_q_stats *q_stats = | |
| 3152 | + bnx2x_fp_qstats(bp, txdata->parent_fp); | |
| 3153 | + q_stats->driver_filtered_tx_pkt++; | |
| 3154 | + dev_kfree_skb(skb); | |
| 3155 | + return NETDEV_TX_OK; | |
| 3156 | + } | |
| 2963 | 3157 | bnx2x_fp_qstats(bp, txdata->parent_fp)->driver_xoff++; |
| 2964 | 3158 | netif_tx_stop_queue(txq); |
| 2965 | − } | |
| 3159 | + BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); | |
| 2966 | 3160 | |
| 2967 | 3161 | return NETDEV_TX_BUSY; |
| 2968 | 3162 | } |
| @@ -3339,13 +3533,11 @@ int bnx2x_change_mac_addr(struct net_device *dev, void *p) · 370 unmodified lines | ||
| 3339 | 3533 | return -EINVAL; |
| 3340 | 3534 | } |
| 3341 | 3535 | |
| 3342 | −#ifdef BCM_CNIC | |
| 3343 | 3536 | if ((IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp)) && |
| 3344 | 3537 | !is_zero_ether_addr(addr->sa_data)) { |
| 3345 | 3538 | BNX2X_ERR("Can't configure non-zero address on iSCSI or FCoE functions in MF-SD mode\n"); |
| 3346 | 3539 | return -EINVAL; |
| 3347 | 3540 | } |
| 3348 | −#endif | |
| 3349 | 3541 | |
| 3350 | 3542 | if (netif_running(dev)) { |
| 3351 | 3543 | rc = bnx2x_set_eth_mac(bp, false); |
| @@ -3369,13 +3561,11 @@ static void bnx2x_free_fp_mem_at(struct bnx2x *bp, int fp_index) · 17 unmodified lines | ||
| 3369 | 3561 | u8 cos; |
| 3370 | 3562 | |
| 3371 | 3563 | /* Common */ |
| 3372 | −#ifdef BCM_CNIC | |
| 3564 | + | |
| 3373 | 3565 | if (IS_FCOE_IDX(fp_index)) { |
| 3374 | 3566 | memset(sb, 0, sizeof(union host_hc_status_block)); |
| 3375 | 3567 | fp->status_blk_mapping = 0; |
| 3376 | − | |
| 3377 | 3568 | } else { |
| 3378 | −#endif | |
| 3379 | 3569 | /* status blocks */ |
| 3380 | 3570 | if (!CHIP_IS_E1x(bp)) |
| 3381 | 3571 | BNX2X_PCI_FREE(sb->e2_sb, |
| @@ -3387,9 +3577,8 @@ static void bnx2x_free_fp_mem_at(struct bnx2x *bp, int fp_index) · 5 unmodified lines | ||
| 3387 | 3577 | bnx2x_fp(bp, fp_index, |
| 3388 | 3578 | status_blk_mapping), |
| 3389 | 3579 | sizeof(struct host_hc_status_block_e1x)); |
| 3390 | −#ifdef BCM_CNIC | |
| 3391 | 3580 | } |
| 3392 | −#endif | |
| 3581 | + | |
| 3393 | 3582 | /* Rx */ |
| 3394 | 3583 | if (!skip_rx_queue(bp, fp_index)) { |
| 3395 | 3584 | bnx2x_free_rx_bds(fp); |
| @@ -3431,10 +3620,17 @@ static void bnx2x_free_fp_mem_at(struct bnx2x *bp, int fp_index) · 35 unmodified lines | ||
| 3431 | 3620 | /* end of fastpath */ |
| 3432 | 3621 | } |
| 3433 | 3622 | |
| 3623 | +void bnx2x_free_fp_mem_cnic(struct bnx2x *bp) | |
| 3624 | +{ | |
| 3625 | + int i; | |
| 3626 | + for_each_cnic_queue(bp, i) | |
| 3627 | + bnx2x_free_fp_mem_at(bp, i); | |
| 3628 | +} | |
| 3629 | + | |
| 3434 | 3630 | void bnx2x_free_fp_mem(struct bnx2x *bp) |
| 3435 | 3631 | { |
| 3436 | 3632 | int i; |
| 3437 | − for_each_queue(bp, i) | |
| 3633 | + for_each_eth_queue(bp, i) | |
| 3438 | 3634 | bnx2x_free_fp_mem_at(bp, i); |
| 3439 | 3635 | } |
| 3440 | 3636 | |
| @@ -3519,14 +3715,11 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) · 78 unmodified lines | ||
| 3519 | 3715 | u8 cos; |
| 3520 | 3716 | int rx_ring_size = 0; |
| 3521 | 3717 | |
| 3522 | −#ifdef BCM_CNIC | |
| 3523 | 3718 | if (!bp->rx_ring_size && |
| 3524 | 3719 | (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))) { |
| 3525 | 3720 | rx_ring_size = MIN_RX_SIZE_NONTPA; |
| 3526 | 3721 | bp->rx_ring_size = rx_ring_size; |
| 3527 | − } else | |
| 3528 | −#endif | |
| 3529 | − if (!bp->rx_ring_size) { | |
| 3722 | + } else if (!bp->rx_ring_size) { | |
| 3530 | 3723 | rx_ring_size = MAX_RX_AVAIL/BNX2X_NUM_RX_QUEUES(bp); |
| 3531 | 3724 | |
| 3532 | 3725 | if (CHIP_IS_E3(bp)) { |
| @@ -3550,9 +3743,8 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) · 17 unmodified lines | ||
| 3550 | 3743 | |
| 3551 | 3744 | /* Common */ |
| 3552 | 3745 | sb = &bnx2x_fp(bp, index, status_blk); |
| 3553 | −#ifdef BCM_CNIC | |
| 3746 | + | |
| 3554 | 3747 | if (!IS_FCOE_IDX(index)) { |
| 3555 | −#endif | |
| 3556 | 3748 | /* status blocks */ |
| 3557 | 3749 | if (!CHIP_IS_E1x(bp)) |
| 3558 | 3750 | BNX2X_PCI_ALLOC(sb->e2_sb, |
| @@ -3562,9 +3754,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) · 3 unmodified lines | ||
| 3562 | 3754 | BNX2X_PCI_ALLOC(sb->e1x_sb, |
| 3563 | 3755 | &bnx2x_fp(bp, index, status_blk_mapping), |
| 3564 | 3756 | sizeof(struct host_hc_status_block_e1x)); |
| 3565 | −#ifdef BCM_CNIC | |
| 3566 | 3757 | } |
| 3567 | −#endif | |
| 3568 | 3758 | |
| 3569 | 3759 | /* FCoE Queue uses Default SB and doesn't ACK the SB, thus no need to |
| 3570 | 3760 | * set shortcuts for it. |
| @@ -3641,31 +3831,31 @@ alloc_mem_err: · 70 unmodified lines | ||
| 3641 | 3831 | return 0; |
| 3642 | 3832 | } |
| 3643 | 3833 | |
| 3834 | +int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp) | |
| 3835 | +{ | |
| 3836 | + if (!NO_FCOE(bp)) | |
| 3837 | + /* FCoE */ | |
| 3838 | + if (bnx2x_alloc_fp_mem_at(bp, FCOE_IDX(bp))) | |
| 3839 | + /* we will fail load process instead of mark | |
| 3840 | + * NO_FCOE_FLAG | |
| 3841 | + */ | |
| 3842 | + return -ENOMEM; | |
| 3843 | + | |
| 3844 | + return 0; | |
| 3845 | +} | |
| 3846 | + | |
| 3644 | 3847 | int bnx2x_alloc_fp_mem(struct bnx2x *bp) |
| 3645 | 3848 | { |
| 3646 | 3849 | int i; |
| 3647 | 3850 | |
| 3648 | − /** | |
| 3649 | − * 1. Allocate FP for leading - fatal if error | |
| 3650 | − * 2. {CNIC} Allocate FCoE FP - fatal if error | |
| 3651 | − * 3. {CNIC} Allocate OOO + FWD - disable OOO if error | |
| 3652 | − * 4. Allocate RSS - fix number of queues if error | |
| 3851 | + /* 1. Allocate FP for leading - fatal if error | |
| 3852 | + * 2. Allocate RSS - fix number of queues if error | |
| 3653 | 3853 | */ |
| 3654 | 3854 | |
| 3655 | 3855 | /* leading */ |
| 3656 | 3856 | if (bnx2x_alloc_fp_mem_at(bp, 0)) |
| 3657 | 3857 | return -ENOMEM; |
| 3658 | 3858 | |
| 3659 | −#ifdef BCM_CNIC | |
| 3660 | − if (!NO_FCOE(bp)) | |
| 3661 | − /* FCoE */ | |
| 3662 | − if (bnx2x_alloc_fp_mem_at(bp, FCOE_IDX(bp))) | |
| 3663 | − /* we will fail load process instead of mark | |
| 3664 | − * NO_FCOE_FLAG | |
| 3665 | − */ | |
| 3666 | − return -ENOMEM; | |
| 3667 | −#endif | |
| 3668 | − | |
| 3669 | 3859 | /* RSS */ |
| 3670 | 3860 | for_each_nondefault_eth_queue(bp, i) |
| 3671 | 3861 | if (bnx2x_alloc_fp_mem_at(bp, i)) |
| @@ -3676,17 +3866,17 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp) · 4 unmodified lines | ||
| 3676 | 3866 | int delta = BNX2X_NUM_ETH_QUEUES(bp) - i; |
| 3677 | 3867 | |
| 3678 | 3868 | WARN_ON(delta < 0); |
| 3679 | −#ifdef BCM_CNIC | |
| 3680 | − /** | |
| 3681 | − * move non eth FPs next to last eth FP | |
| 3682 | − * must be done in that order | |
| 3683 | − * FCOE_IDX < FWD_IDX < OOO_IDX | |
| 3684 | − */ | |
| 3869 | + if (CNIC_SUPPORT(bp)) | |
| 3870 | + /* move non eth FPs next to last eth FP | |
| 3871 | + * must be done in that order | |
| 3872 | + * FCOE_IDX < FWD_IDX < OOO_IDX | |
| 3873 | + */ | |
| 3685 | 3874 | |
| 3686 | − /* move FCoE fp even NO_FCOE_FLAG is on */ | |
| 3687 | − bnx2x_move_fp(bp, FCOE_IDX(bp), FCOE_IDX(bp) - delta); | |
| 3688 | −#endif | |
| 3689 | − bp->num_queues -= delta; | |
| 3875 | + /* move FCoE fp even NO_FCOE_FLAG is on */ | |
| 3876 | + bnx2x_move_fp(bp, FCOE_IDX(bp), FCOE_IDX(bp) - delta); | |
| 3877 | + bp->num_ethernet_queues -= delta; | |
| 3878 | + bp->num_queues = bp->num_ethernet_queues + | |
| 3879 | + bp->num_cnic_queues; | |
| 3690 | 3880 | BNX2X_ERR("Adjusted num of queues from %d to %d\n", |
| 3691 | 3881 | bp->num_queues + delta, bp->num_queues); |
| 3692 | 3882 | } |
| @@ -3705,13 +3895,13 @@ void bnx2x_free_mem_bp(struct bnx2x *bp) · 12 unmodified lines | ||
| 3705 | 3895 | kfree(bp->ilt); |
| 3706 | 3896 | } |
| 3707 | 3897 | |
| 3708 | −int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp) | |
| 3898 | +int bnx2x_alloc_mem_bp(struct bnx2x *bp) | |
| 3709 | 3899 | { |
| 3710 | 3900 | struct bnx2x_fastpath *fp; |
| 3711 | 3901 | struct msix_entry *tbl; |
| 3712 | 3902 | struct bnx2x_ilt *ilt; |
| 3713 | 3903 | int msix_table_size = 0; |
| 3714 | − int fp_array_size; | |
| 3904 | + int fp_array_size, txq_array_size; | |
| 3715 | 3905 | int i; |
| 3716 | 3906 | |
| 3717 | 3907 | /* |
| @@ -3721,7 +3911,7 @@ int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp) · 3 unmodified lines | ||
| 3721 | 3911 | msix_table_size = bp->igu_sb_cnt + 1; |
| 3722 | 3912 | |
| 3723 | 3913 | /* fp array: RSS plus CNIC related L2 queues */ |
| 3724 | − fp_array_size = BNX2X_MAX_RSS_COUNT(bp) + NON_ETH_CONTEXT_USE; | |
| 3914 | + fp_array_size = BNX2X_MAX_RSS_COUNT(bp) + CNIC_SUPPORT(bp); | |
| 3725 | 3915 | BNX2X_DEV_INFO("fp_array_size %d", fp_array_size); |
| 3726 | 3916 | |
| 3727 | 3917 | fp = kcalloc(fp_array_size, sizeof(*fp), GFP_KERNEL); |
| @@ -3750,12 +3940,12 @@ int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp) · 22 unmodified lines | ||
| 3750 | 3940 | goto alloc_err; |
| 3751 | 3941 | |
| 3752 | 3942 | /* Allocate memory for the transmission queues array */ |
| 3753 | − bp->bnx2x_txq_size = BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS; | |
| 3754 | −#ifdef BCM_CNIC | |
| 3755 | − bp->bnx2x_txq_size++; | |
| 3756 | −#endif | |
| 3757 | − bp->bnx2x_txq = kcalloc(bp->bnx2x_txq_size, | |
| 3758 | − sizeof(struct bnx2x_fp_txdata), GFP_KERNEL); | |
| 3943 | + txq_array_size = | |
| 3944 | + BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS + CNIC_SUPPORT(bp); | |
| 3945 | + BNX2X_DEV_INFO("txq_array_size %d", txq_array_size); | |
| 3946 | + | |
| 3947 | + bp->bnx2x_txq = kcalloc(txq_array_size, sizeof(struct bnx2x_fp_txdata), | |
| 3948 | + GFP_KERNEL); | |
| 3759 | 3949 | if (!bp->bnx2x_txq) |
| 3760 | 3950 | goto alloc_err; |
| 3761 | 3951 | |
| @@ -3838,7 +4028,7 @@ int bnx2x_get_link_cfg_idx(struct bnx2x *bp) · 76 unmodified lines | ||
| 3838 | 4028 | return LINK_CONFIG_IDX(sel_phy_idx); |
| 3839 | 4029 | } |
| 3840 | 4030 | |
| 3841 | −#if defined(NETDEV_FCOE_WWNN) && defined(BCM_CNIC) | |
| 4031 | +#ifdef NETDEV_FCOE_WWNN | |
| 3842 | 4032 | int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type) |
| 3843 | 4033 | { |
| 3844 | 4034 | struct bnx2x *bp = netdev_priv(dev); |
| @@ -144,7 +144,7 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command, u32 param); · 143 unmodified lines | ||
| 144 | 144 | * @bp: driver handle |
| 145 | 145 | * @load_mode: current mode |
| 146 | 146 | */ |
| 147 | −u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode); | |
| 147 | +int bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode); | |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * bnx2x_link_set - configure hw according to link parameters structure. |
| @@ -238,7 +238,6 @@ irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance); · 87 unmodified lines | ||
| 238 | 238 | * @dev_instance: private instance |
| 239 | 239 | */ |
| 240 | 240 | irqreturn_t bnx2x_interrupt(int irq, void *dev_instance); |
| 241 | −#ifdef BCM_CNIC | |
| 242 | 241 | |
| 243 | 242 | /** |
| 244 | 243 | * bnx2x_cnic_notify - send command to cnic driver |
| @@ -262,8 +261,6 @@ void bnx2x_setup_cnic_irq_info(struct bnx2x *bp); · 17 unmodified lines | ||
| 262 | 261 | */ |
| 263 | 262 | void bnx2x_setup_cnic_info(struct bnx2x *bp); |
| 264 | 263 | |
| 265 | −#endif | |
| 266 | − | |
| 267 | 264 | /** |
| 268 | 265 | * bnx2x_int_enable - enable HW interrupts. |
| 269 | 266 | * |
| @@ -283,7 +280,7 @@ void bnx2x_int_enable(struct bnx2x *bp); · 13 unmodified lines | ||
| 283 | 280 | void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw); |
| 284 | 281 | |
| 285 | 282 | /** |
| 286 | − * bnx2x_nic_init - init driver internals. | |
| 283 | + * bnx2x_nic_init_cnic - init driver internals for cnic. | |
| 287 | 284 | * |
| 288 | 285 | * @bp: driver handle |
| 289 | 286 | * @load_code: COMMON, PORT or FUNCTION |
| @@ -293,8 +290,25 @@ void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw); · 3 unmodified lines | ||
| 293 | 290 | * - status blocks |
| 294 | 291 | * - etc. |
| 295 | 292 | */ |
| 296 | −void bnx2x_nic_init(struct bnx2x *bp, u32 load_code); | |
| 293 | +void bnx2x_nic_init_cnic(struct bnx2x *bp); | |
| 297 | 294 | |
| 295 | +/** | |
| 296 | + * bnx2x_nic_init - init driver internals. | |
| 297 | + * | |
| 298 | + * @bp: driver handle | |
| 299 | + * | |
| 300 | + * Initializes: | |
| 301 | + * - rings | |
| 302 | + * - status blocks | |
| 303 | + * - etc. | |
| 304 | + */ | |
| 305 | +void bnx2x_nic_init(struct bnx2x *bp, u32 load_code); | |
| 306 | +/** | |
| 307 | + * bnx2x_alloc_mem_cnic - allocate driver's memory for cnic. | |
| 308 | + * | |
| 309 | + * @bp: driver handle | |
| 310 | + */ | |
| 311 | +int bnx2x_alloc_mem_cnic(struct bnx2x *bp); | |
| 298 | 312 | /** |
| 299 | 313 | * bnx2x_alloc_mem - allocate driver's memory. |
| 300 | 314 | * |
| @@ -302,6 +316,12 @@ void bnx2x_nic_init(struct bnx2x *bp, u32 load_code); · 1 unmodified line | ||
| 302 | 316 | */ |
| 303 | 317 | int bnx2x_alloc_mem(struct bnx2x *bp); |
| 304 | 318 | |
| 319 | +/** | |
| 320 | + * bnx2x_free_mem_cnic - release driver's memory for cnic. | |
| 321 | + * | |
| 322 | + * @bp: driver handle | |
| 323 | + */ | |
| 324 | +void bnx2x_free_mem_cnic(struct bnx2x *bp); | |
| 305 | 325 | /** |
| 306 | 326 | * bnx2x_free_mem - release driver's memory. |
| 307 | 327 | * |
| @@ -407,6 +427,7 @@ bool bnx2x_reset_is_done(struct bnx2x *bp, int engine); · 99 unmodified lines | ||
| 407 | 427 | void bnx2x_set_reset_in_progress(struct bnx2x *bp); |
| 408 | 428 | void bnx2x_set_reset_global(struct bnx2x *bp); |
| 409 | 429 | void bnx2x_disable_close_the_gate(struct bnx2x *bp); |
| 430 | +int bnx2x_init_hw_func_cnic(struct bnx2x *bp); | |
| 410 | 431 | |
| 411 | 432 | /** |
| 412 | 433 | * bnx2x_sp_event - handle ramrods completion. |
| @@ -423,6 +444,14 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe); · 10 unmodified lines | ||
| 423 | 444 | */ |
| 424 | 445 | void bnx2x_ilt_set_info(struct bnx2x *bp); |
| 425 | 446 | |
| 447 | +/** | |
| 448 | + * bnx2x_ilt_set_cnic_info - prepare ILT configurations for SRC | |
| 449 | + * and TM. | |
| 450 | + * | |
| 451 | + * @bp: driver handle | |
| 452 | + */ | |
| 453 | +void bnx2x_ilt_set_info_cnic(struct bnx2x *bp); | |
| 454 | + | |
| 426 | 455 | /** |
| 427 | 456 | * bnx2x_dcbx_init - initialize dcbx protocol. |
| 428 | 457 | * |
| @@ -491,12 +520,17 @@ int bnx2x_resume(struct pci_dev *pdev); · 62 unmodified lines | ||
| 491 | 520 | /* Release IRQ vectors */ |
| 492 | 521 | void bnx2x_free_irq(struct bnx2x *bp); |
| 493 | 522 | |
| 523 | +void bnx2x_free_fp_mem_cnic(struct bnx2x *bp); | |
| 494 | 524 | void bnx2x_free_fp_mem(struct bnx2x *bp); |
| 525 | +int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp); | |
| 495 | 526 | int bnx2x_alloc_fp_mem(struct bnx2x *bp); |
| 496 | 527 | void bnx2x_init_rx_rings(struct bnx2x *bp); |
| 528 | +void bnx2x_init_rx_rings_cnic(struct bnx2x *bp); | |
| 529 | +void bnx2x_free_skbs_cnic(struct bnx2x *bp); | |
| 497 | 530 | void bnx2x_free_skbs(struct bnx2x *bp); |
| 498 | 531 | void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw); |
| 499 | 532 | void bnx2x_netif_start(struct bnx2x *bp); |
| 533 | +int bnx2x_load_cnic(struct bnx2x *bp); | |
| 500 | 534 | |
| 501 | 535 | /** |
| 502 | 536 | * bnx2x_enable_msix - set msix configuration. |
| @@ -529,7 +563,7 @@ int bnx2x_poll(struct napi_struct *napi, int budget); · 26 unmodified lines | ||
| 529 | 563 | * |
| 530 | 564 | * @bp: driver handle |
| 531 | 565 | */ |
| 532 | −int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp); | |
| 566 | +int bnx2x_alloc_mem_bp(struct bnx2x *bp); | |
| 533 | 567 | |
| 534 | 568 | /** |
| 535 | 569 | * bnx2x_free_mem_bp - release memories outsize main driver structure |
| @@ -547,7 +581,7 @@ void bnx2x_free_mem_bp(struct bnx2x *bp); · 11 unmodified lines | ||
| 547 | 581 | */ |
| 548 | 582 | int bnx2x_change_mtu(struct net_device *dev, int new_mtu); |
| 549 | 583 | |
| 550 | −#if defined(NETDEV_FCOE_WWNN) && defined(BCM_CNIC) | |
| 584 | +#ifdef NETDEV_FCOE_WWNN | |
| 551 | 585 | /** |
| 552 | 586 | * bnx2x_fcoe_get_wwn - return the requested WWN value for this port |
| 553 | 587 | * |
| @@ -793,23 +827,39 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp, · 239 unmodified lines | ||
| 793 | 827 | sge->addr_lo = 0; |
| 794 | 828 | } |
| 795 | 829 | |
| 796 | −static inline void bnx2x_add_all_napi(struct bnx2x *bp) | |
| 830 | +static inline void bnx2x_add_all_napi_cnic(struct bnx2x *bp) | |
| 797 | 831 | { |
| 798 | 832 | int i; |
| 799 | 833 | |
| 800 | − bp->num_napi_queues = bp->num_queues; | |
| 834 | + /* Add NAPI objects */ | |
| 835 | + for_each_rx_queue_cnic(bp, i) | |
| 836 | + netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi), | |
| 837 | + bnx2x_poll, BNX2X_NAPI_WEIGHT); | |
| 838 | +} | |
| 839 | + | |
| 840 | +static inline void bnx2x_add_all_napi(struct bnx2x *bp) | |
| 841 | +{ | |
| 842 | + int i; | |
| 801 | 843 | |
| 802 | 844 | /* Add NAPI objects */ |
| 803 | − for_each_rx_queue(bp, i) | |
| 845 | + for_each_eth_queue(bp, i) | |
| 804 | 846 | netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi), |
| 805 | 847 | bnx2x_poll, BNX2X_NAPI_WEIGHT); |
| 806 | 848 | } |
| 807 | 849 | |
| 850 | +static inline void bnx2x_del_all_napi_cnic(struct bnx2x *bp) | |
| 851 | +{ | |
| 852 | + int i; | |
| 853 | + | |
| 854 | + for_each_rx_queue_cnic(bp, i) | |
| 855 | + netif_napi_del(&bnx2x_fp(bp, i, napi)); | |
| 856 | +} | |
| 857 | + | |
| 808 | 858 | static inline void bnx2x_del_all_napi(struct bnx2x *bp) |
| 809 | 859 | { |
| 810 | 860 | int i; |
| 811 | 861 | |
| 812 | − for_each_rx_queue(bp, i) | |
| 862 | + for_each_eth_queue(bp, i) | |
| 813 | 863 | netif_napi_del(&bnx2x_fp(bp, i, napi)); |
| 814 | 864 | } |
| 815 | 865 | |
| @@ -979,11 +1029,9 @@ static inline u8 bnx2x_stats_id(struct bnx2x_fastpath *fp) · 163 unmodified lines | ||
| 979 | 1029 | { |
| 980 | 1030 | struct bnx2x *bp = fp->bp; |
| 981 | 1031 | if (!CHIP_IS_E1x(bp)) { |
| 982 | −#ifdef BCM_CNIC | |
| 983 | 1032 | /* there are special statistics counters for FCoE 136..140 */ |
| 984 | 1033 | if (IS_FCOE_FP(fp)) |
| 985 | 1034 | return bp->cnic_base_cl_id + (bp->pf_num >> 1); |
| 986 | −#endif | |
| 987 | 1035 | return fp->cl_id; |
| 988 | 1036 | } |
| 989 | 1037 | return fp->cl_id + BP_PORT(bp) * FP_SB_MAX_E1x; |
| @@ -1102,7 +1150,6 @@ static inline void bnx2x_init_txdata(struct bnx2x *bp, · 112 unmodified lines | ||
| 1102 | 1150 | txdata->cid, txdata->txq_index); |
| 1103 | 1151 | } |
| 1104 | 1152 | |
| 1105 | −#ifdef BCM_CNIC | |
| 1106 | 1153 | static inline u8 bnx2x_cnic_eth_cl_id(struct bnx2x *bp, u8 cl_idx) |
| 1107 | 1154 | { |
| 1108 | 1155 | return bp->cnic_base_cl_id + cl_idx + |
| @@ -1162,7 +1209,6 @@ static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp) · 53 unmodified lines | ||
| 1162 | 1209 | fp->index, bp, fp->status_blk.e2_sb, fp->cl_id, fp->fw_sb_id, |
| 1163 | 1210 | fp->igu_sb_id); |
| 1164 | 1211 | } |
| 1165 | −#endif | |
| 1166 | 1212 | |
| 1167 | 1213 | static inline int bnx2x_clean_tx_queue(struct bnx2x *bp, |
| 1168 | 1214 | struct bnx2x_fp_txdata *txdata) |
| @@ -1280,7 +1326,7 @@ static inline bool bnx2x_mtu_allows_gro(int mtu) · 111 unmodified lines | ||
| 1280 | 1326 | */ |
| 1281 | 1327 | return mtu <= SGE_PAGE_SIZE && (U_ETH_SGL_SIZE * fpp) <= MAX_SKB_FRAGS; |
| 1282 | 1328 | } |
| 1283 | −#ifdef BCM_CNIC | |
| 1329 | + | |
| 1284 | 1330 | /** |
| 1285 | 1331 | * bnx2x_get_iscsi_info - update iSCSI params according to licensing info. |
| 1286 | 1332 | * |
| @@ -1288,7 +1334,6 @@ static inline bool bnx2x_mtu_allows_gro(int mtu) · 1 unmodified line | ||
| 1288 | 1334 | * |
| 1289 | 1335 | */ |
| 1290 | 1336 | void bnx2x_get_iscsi_info(struct bnx2x *bp); |
| 1291 | −#endif | |
| 1292 | 1337 | |
| 1293 | 1338 | /** |
| 1294 | 1339 | * bnx2x_link_sync_notify - send notification to other functions. |
| @@ -1340,13 +1385,11 @@ static inline void bnx2x_update_drv_flags(struct bnx2x *bp, u32 flags, u32 set) · 45 unmodified lines | ||
| 1340 | 1385 | |
| 1341 | 1386 | static inline bool bnx2x_is_valid_ether_addr(struct bnx2x *bp, u8 *addr) |
| 1342 | 1387 | { |
| 1343 | − if (is_valid_ether_addr(addr)) | |
| 1388 | + if (is_valid_ether_addr(addr) || | |
| 1389 | + (is_zero_ether_addr(addr) && | |
| 1390 | + (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp)))) | |
| 1344 | 1391 | return true; |
| 1345 | −#ifdef BCM_CNIC | |
| 1346 | − if (is_zero_ether_addr(addr) && | |
| 1347 | − (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))) | |
| 1348 | − return true; | |
| 1349 | −#endif | |
| 1392 | + | |
| 1350 | 1393 | return false; |
| 1351 | 1394 | } |
| 1352 | 1395 | |
| @@ -413,8 +413,11 @@ static int bnx2x_dcbx_read_mib(struct bnx2x *bp, · 412 unmodified lines | ||
| 413 | 413 | |
| 414 | 414 | static void bnx2x_pfc_set_pfc(struct bnx2x *bp) |
| 415 | 415 | { |
| 416 | + int mfw_configured = SHMEM2_HAS(bp, drv_flags) && | |
| 417 | + GET_FLAGS(SHMEM2_RD(bp, drv_flags), | |
| 418 | + 1 << DRV_FLAGS_DCB_MFW_CONFIGURED); | |
| 416 | 419 | if (bp->dcbx_port_params.pfc.enabled && |
| 417 | − !(bp->dcbx_error & DCBX_REMOTE_MIB_ERROR)) | |
| 420 | + (!(bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) || mfw_configured)) | |
| 418 | 421 | /* |
| 419 | 422 | * 1. Fills up common PFC structures if required |
| 420 | 423 | * 2. Configure NIG, MAC and BRB via the elink |
| @@ -552,10 +555,13 @@ static void bnx2x_dcbx_update_ets_config(struct bnx2x *bp) · 131 unmodified lines | ||
| 552 | 555 | |
| 553 | 556 | static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp) |
| 554 | 557 | { |
| 558 | + int mfw_configured = SHMEM2_HAS(bp, drv_flags) && | |
| 559 | + GET_FLAGS(SHMEM2_RD(bp, drv_flags), | |
| 560 | + 1 << DRV_FLAGS_DCB_MFW_CONFIGURED); | |
| 555 | 561 | bnx2x_ets_disabled(&bp->link_params, &bp->link_vars); |
| 556 | 562 | |
| 557 | 563 | if (!bp->dcbx_port_params.ets.enabled || |
| 558 | − (bp->dcbx_error & DCBX_REMOTE_MIB_ERROR)) | |
| 564 | + ((bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) && !mfw_configured)) | |
| 559 | 565 | return; |
| 560 | 566 | |
| 561 | 567 | if (CHIP_IS_E3B0(bp)) |
| @@ -1802,11 +1808,14 @@ static void bnx2x_dcbx_fw_struct(struct bnx2x *bp, · 1240 unmodified lines | ||
| 1802 | 1808 | u8 cos = 0, pri = 0; |
| 1803 | 1809 | struct priority_cos *tt2cos; |
| 1804 | 1810 | u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority; |
| 1811 | + int mfw_configured = SHMEM2_HAS(bp, drv_flags) && | |
| 1812 | + GET_FLAGS(SHMEM2_RD(bp, drv_flags), | |
| 1813 | + 1 << DRV_FLAGS_DCB_MFW_CONFIGURED); | |
| 1805 | 1814 | |
| 1806 | 1815 | memset(pfc_fw_cfg, 0, sizeof(*pfc_fw_cfg)); |
| 1807 | 1816 | |
| 1808 | 1817 | /* to disable DCB - the structure must be zeroed */ |
| 1809 | − if (bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) | |
| 1818 | + if ((bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) && !mfw_configured) | |
| 1810 | 1819 | return; |
| 1811 | 1820 | |
| 1812 | 1821 | /*shortcut*/ |
| @@ -1895,6 +1904,11 @@ static u8 bnx2x_dcbnl_set_state(struct net_device *netdev, u8 state) · 82 unmodified lines | ||
| 1895 | 1904 | struct bnx2x *bp = netdev_priv(netdev); |
| 1896 | 1905 | DP(BNX2X_MSG_DCB, "state = %s\n", state ? "on" : "off"); |
| 1897 | 1906 | |
| 1907 | + if (state && ((bp->dcbx_enabled == BNX2X_DCBX_ENABLED_OFF) || | |
| 1908 | + (bp->dcbx_enabled == BNX2X_DCBX_ENABLED_INVALID))) { | |
| 1909 | + DP(BNX2X_MSG_DCB, "Can not set dcbx to enabled while it is disabled in nvm\n"); | |
| 1910 | + return 1; | |
| 1911 | + } | |
| 1898 | 1912 | bnx2x_dcbx_set_state(bp, (state ? true : false), bp->dcbx_enabled); |
| 1899 | 1913 | return 0; |
| 1900 | 1914 | } |
| @@ -1908,10 +1922,10 @@ static void bnx2x_dcbnl_get_perm_hw_addr(struct net_device *netdev, · 7 unmodified lines | ||
| 1908 | 1922 | /* first the HW mac address */ |
| 1909 | 1923 | memcpy(perm_addr, netdev->dev_addr, netdev->addr_len); |
| 1910 | 1924 | |
| 1911 | −#ifdef BCM_CNIC | |
| 1912 | − /* second SAN address */ | |
| 1913 | − memcpy(perm_addr+netdev->addr_len, bp->fip_mac, netdev->addr_len); | |
| 1914 | −#endif | |
| 1925 | + if (CNIC_LOADED(bp)) | |
| 1926 | + /* second SAN address */ | |
| 1927 | + memcpy(perm_addr+netdev->addr_len, bp->fip_mac, | |
| 1928 | + netdev->addr_len); | |
| 1915 | 1929 | } |
| 1916 | 1930 | |
| 1917 | 1931 | static void bnx2x_dcbnl_set_pg_tccfg_tx(struct net_device *netdev, int prio, |
| @@ -2038,10 +2052,13 @@ static void bnx2x_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio, · 120 unmodified lines | ||
| 2038 | 2052 | if (!bnx2x_dcbnl_set_valid(bp) || prio >= MAX_PFC_PRIORITIES) |
| 2039 | 2053 | return; |
| 2040 | 2054 | |
| 2041 | − bp->dcbx_config_params.admin_pfc_bitmap |= ((setting ? 1 : 0) << prio); | |
| 2042 | 2055 | |
| 2043 | − if (setting) | |
| 2056 | + if (setting) { | |
| 2057 | + bp->dcbx_config_params.admin_pfc_bitmap |= (1 << prio); | |
| 2044 | 2058 | bp->dcbx_config_params.admin_pfc_tx_enable = 1; |
| 2059 | + } else { | |
| 2060 | + bp->dcbx_config_params.admin_pfc_bitmap &= ~(1 << prio); | |
| 2061 | + } | |
| 2045 | 2062 | } |
| 2046 | 2063 | |
| 2047 | 2064 | static void bnx2x_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio, |
| @@ -2073,8 +2090,12 @@ static u8 bnx2x_dcbnl_set_all(struct net_device *netdev) · 25 unmodified lines | ||
| 2073 | 2090 | "Handling parity error recovery. Try again later\n"); |
| 2074 | 2091 | return 1; |
| 2075 | 2092 | } |
| 2076 | − if (netif_running(bp->dev)) | |
| 2093 | + if (netif_running(bp->dev)) { | |
| 2094 | + bnx2x_update_drv_flags(bp, | |
| 2095 | + 1 << DRV_FLAGS_DCB_MFW_CONFIGURED, | |
| 2096 | + 1); | |
| 2077 | 2097 | bnx2x_dcbx_init(bp, true); |
| 2098 | + } | |
| 2078 | 2099 | DP(BNX2X_MSG_DCB, "set_dcbx_params done (%d)\n", rc); |
| 2079 | 2100 | if (rc) |
| 2080 | 2101 | return 1; |
| @@ -62,7 +62,9 @@ static const struct { · 61 unmodified lines | ||
| 62 | 62 | 8, "[%s]: tpa_aggregations" }, |
| 63 | 63 | { Q_STATS_OFFSET32(total_tpa_aggregated_frames_hi), |
| 64 | 64 | 8, "[%s]: tpa_aggregated_frames"}, |
| 65 | − { Q_STATS_OFFSET32(total_tpa_bytes_hi), 8, "[%s]: tpa_bytes"} | |
| 65 | + { Q_STATS_OFFSET32(total_tpa_bytes_hi), 8, "[%s]: tpa_bytes"}, | |
| 66 | + { Q_STATS_OFFSET32(driver_filtered_tx_pkt), | |
| 67 | + 4, "[%s]: driver_filtered_tx_pkt" } | |
| 66 | 68 | }; |
| 67 | 69 | |
| 68 | 70 | #define BNX2X_NUM_Q_STATS ARRAY_SIZE(bnx2x_q_stats_arr) |
| @@ -177,6 +179,8 @@ static const struct { · 108 unmodified lines | ||
| 177 | 179 | 4, STATS_FLAGS_FUNC, "recoverable_errors" }, |
| 178 | 180 | { STATS_OFFSET32(unrecoverable_error), |
| 179 | 181 | 4, STATS_FLAGS_FUNC, "unrecoverable_errors" }, |
| 182 | + { STATS_OFFSET32(driver_filtered_tx_pkt), | |
| 183 | + 4, STATS_FLAGS_FUNC, "driver_filtered_tx_pkt" }, | |
| 180 | 184 | { STATS_OFFSET32(eee_tx_lpi), |
| 181 | 185 | 4, STATS_FLAGS_PORT, "Tx LPI entry count"} |
| 182 | 186 | }; |
| @@ -227,18 +231,14 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) · 44 unmodified lines | ||
| 227 | 231 | cmd->advertising &= ~(ADVERTISED_10000baseT_Full); |
| 228 | 232 | } |
| 229 | 233 | |
| 230 | − if ((bp->state == BNX2X_STATE_OPEN) && (bp->link_vars.link_up)) { | |
| 231 | − if (!(bp->flags & MF_FUNC_DIS)) { | |
| 232 | − ethtool_cmd_speed_set(cmd, bp->link_vars.line_speed); | |
| 234 | + if ((bp->state == BNX2X_STATE_OPEN) && bp->link_vars.link_up && | |
| 235 | + !(bp->flags & MF_FUNC_DIS)) { | |
| 233 | 236 | cmd->duplex = bp->link_vars.duplex; |
| 234 | − } else { | |
| 235 | − ethtool_cmd_speed_set( | |
| 236 | − cmd, bp->link_params.req_line_speed[cfg_idx]); | |
| 237 | − cmd->duplex = bp->link_params.req_duplex[cfg_idx]; | |
| 238 | − } | |
| 239 | 237 | |
| 240 | 238 | if (IS_MF(bp) && !BP_NOMCP(bp)) |
| 241 | 239 | ethtool_cmd_speed_set(cmd, bnx2x_get_mf_speed(bp)); |
| 240 | + else | |
| 241 | + ethtool_cmd_speed_set(cmd, bp->link_vars.line_speed); | |
| 242 | 242 | } else { |
| 243 | 243 | cmd->duplex = DUPLEX_UNKNOWN; |
| 244 | 244 | ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN); |
| @@ -2660,20 +2660,25 @@ static int bnx2x_set_phys_id(struct net_device *dev, · 2415 unmodified lines | ||
| 2660 | 2660 | return 1; /* cycle on/off once per second */ |
| 2661 | 2661 | |
| 2662 | 2662 | case ETHTOOL_ID_ON: |
| 2663 | + bnx2x_acquire_phy_lock(bp); | |
| 2663 | 2664 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
| 2664 | 2665 | LED_MODE_ON, SPEED_1000); |
| 2666 | + bnx2x_release_phy_lock(bp); | |
| 2665 | 2667 | break; |
| 2666 | 2668 | |
| 2667 | 2669 | case ETHTOOL_ID_OFF: |
| 2670 | + bnx2x_acquire_phy_lock(bp); | |
| 2668 | 2671 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
| 2669 | 2672 | LED_MODE_FRONT_PANEL_OFF, 0); |
| 2670 | − | |
| 2673 | + bnx2x_release_phy_lock(bp); | |
| 2671 | 2674 | break; |
| 2672 | 2675 | |
| 2673 | 2676 | case ETHTOOL_ID_INACTIVE: |
| 2677 | + bnx2x_acquire_phy_lock(bp); | |
| 2674 | 2678 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
| 2675 | 2679 | LED_MODE_OPER, |
| 2676 | 2680 | bp->link_vars.line_speed); |
| 2681 | + bnx2x_release_phy_lock(bp); | |
| 2677 | 2682 | } |
| 2678 | 2683 | |
| 2679 | 2684 | return 0; |
| @@ -2901,7 +2906,9 @@ static void bnx2x_get_channels(struct net_device *dev, · 221 unmodified lines | ||
| 2901 | 2906 | static void bnx2x_change_num_queues(struct bnx2x *bp, int num_rss) |
| 2902 | 2907 | { |
| 2903 | 2908 | bnx2x_disable_msi(bp); |
| 2904 | − BNX2X_NUM_QUEUES(bp) = num_rss + NON_ETH_CONTEXT_USE; | |
| 2909 | + bp->num_ethernet_queues = num_rss; | |
| 2910 | + bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; | |
| 2911 | + BNX2X_DEV_INFO("set number of queues to %d\n", bp->num_queues); | |
| 2905 | 2912 | bnx2x_set_int_mode(bp); |
| 2906 | 2913 | } |
| 2907 | 2914 | |
| @@ -23,6 +23,11 @@ · 22 unmodified lines | ||
| 23 | 23 | (IRO[159].base + ((funcId) * IRO[159].m1)) |
| 24 | 24 | #define CSTORM_FUNC_EN_OFFSET(funcId) \ |
| 25 | 25 | (IRO[149].base + ((funcId) * IRO[149].m1)) |
| 26 | +#define CSTORM_HC_SYNC_LINE_INDEX_E1X_OFFSET(hcIndex, sbId) \ | |
| 27 | + (IRO[139].base + ((hcIndex) * IRO[139].m1) + ((sbId) * IRO[139].m2)) | |
| 28 | +#define CSTORM_HC_SYNC_LINE_INDEX_E2_OFFSET(hcIndex, sbId) \ | |
| 29 | + (IRO[138].base + (((hcIndex)>>2) * IRO[138].m1) + (((hcIndex)&3) \ | |
| 30 | + * IRO[138].m2) + ((sbId) * IRO[138].m3)) | |
| 26 | 31 | #define CSTORM_IGU_MODE_OFFSET (IRO[157].base) |
| 27 | 32 | #define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ |
| 28 | 33 | (IRO[316].base + ((pfId) * IRO[316].m1)) |
| @@ -500,7 +500,15 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ · 499 unmodified lines | ||
| 500 | 500 | u32 e3_cmn_pin_cfg1; /* 0x170 */ |
| 501 | 501 | #define PORT_HW_CFG_E3_OVER_CURRENT_MASK 0x000000FF |
| 502 | 502 | #define PORT_HW_CFG_E3_OVER_CURRENT_SHIFT 0 |
| 503 | − u32 reserved0[7]; /* 0x174 */ | |
| 503 | + | |
| 504 | + /* pause on host ring */ | |
| 505 | + u32 generic_features; /* 0x174 */ | |
| 506 | + #define PORT_HW_CFG_PAUSE_ON_HOST_RING_MASK 0x00000001 | |
| 507 | + #define PORT_HW_CFG_PAUSE_ON_HOST_RING_SHIFT 0 | |
| 508 | + #define PORT_HW_CFG_PAUSE_ON_HOST_RING_DISABLED 0x00000000 | |
| 509 | + #define PORT_HW_CFG_PAUSE_ON_HOST_RING_ENABLED 0x00000001 | |
| 510 | + | |
| 511 | + u32 reserved0[6]; /* 0x178 */ | |
| 504 | 512 | |
| 505 | 513 | u32 aeu_int_mask; /* 0x190 */ |
| 506 | 514 | |
| @@ -695,6 +703,7 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ · 188 unmodified lines | ||
| 695 | 703 | #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54618SE 0x00000e00 |
| 696 | 704 | #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8722 0x00000f00 |
| 697 | 705 | #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54616 0x00001000 |
| 706 | + #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84834 0x00001100 | |
| 698 | 707 | #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_FAILURE 0x0000fd00 |
| 699 | 708 | #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_NOT_CONN 0x0000ff00 |
| 700 | 709 | |
| @@ -751,6 +760,7 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ · 50 unmodified lines | ||
| 751 | 760 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE 0x00000e00 |
| 752 | 761 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8722 0x00000f00 |
| 753 | 762 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616 0x00001000 |
| 763 | + #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834 0x00001100 | |
| 754 | 764 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT_WC 0x0000fc00 |
| 755 | 765 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00 |
| 756 | 766 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00 |
| @@ -1246,6 +1256,7 @@ struct drv_func_mb { · 489 unmodified lines | ||
| 1246 | 1256 | #define DRV_MSG_CODE_VRFY_AFEX_SUPPORTED 0xa2000000 |
| 1247 | 1257 | #define REQ_BC_VER_4_VRFY_AFEX_SUPPORTED 0x00070002 |
| 1248 | 1258 | #define REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED 0x00070014 |
| 1259 | + #define REQ_BC_VER_4_MT_SUPPORTED 0x00070201 | |
| 1249 | 1260 | #define REQ_BC_VER_4_PFC_STATS_SUPPORTED 0x00070201 |
| 1250 | 1261 | #define REQ_BC_VER_4_FCOE_FEATURES 0x00070209 |
| 1251 | 1262 | |
| @@ -1515,12 +1526,13 @@ enum mf_cfg_afex_vlan_mode { · 263 unmodified lines | ||
| 1515 | 1526 | /* This structure is not applicable and should not be accessed on 57711 */ |
| 1516 | 1527 | struct func_ext_cfg { |
| 1517 | 1528 | u32 func_cfg; |
| 1518 | − #define MACP_FUNC_CFG_FLAGS_MASK 0x000000FF | |
| 1529 | + #define MACP_FUNC_CFG_FLAGS_MASK 0x0000007F | |
| 1519 | 1530 | #define MACP_FUNC_CFG_FLAGS_SHIFT 0 |
| 1520 | 1531 | #define MACP_FUNC_CFG_FLAGS_ENABLED 0x00000001 |
| 1521 | 1532 | #define MACP_FUNC_CFG_FLAGS_ETHERNET 0x00000002 |
| 1522 | 1533 | #define MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD 0x00000004 |
| 1523 | 1534 | #define MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD 0x00000008 |
| 1535 | + #define MACP_FUNC_CFG_PAUSE_ON_HOST_RING 0x00000080 | |
| 1524 | 1536 | |
| 1525 | 1537 | u32 iscsi_mac_addr_upper; |
| 1526 | 1538 | u32 iscsi_mac_addr_lower; |
| @@ -2085,8 +2097,13 @@ struct shmem2_region { · 558 unmodified lines | ||
| 2085 | 2097 | |
| 2086 | 2098 | /* generic flags controlled by the driver */ |
| 2087 | 2099 | u32 drv_flags; |
| 2088 | − #define DRV_FLAGS_DCB_CONFIGURED 0x1 | |
| 2100 | + #define DRV_FLAGS_DCB_CONFIGURED 0x0 | |
| 2101 | + #define DRV_FLAGS_DCB_CONFIGURATION_ABORTED 0x1 | |
| 2102 | + #define DRV_FLAGS_DCB_MFW_CONFIGURED 0x2 | |
| 2089 | 2103 | |
| 2104 | + #define DRV_FLAGS_PORT_MASK ((1 << DRV_FLAGS_DCB_CONFIGURED) | \ | |
| 2105 | + (1 << DRV_FLAGS_DCB_CONFIGURATION_ABORTED) | \ | |
| 2106 | + (1 << DRV_FLAGS_DCB_MFW_CONFIGURED)) | |
| 2090 | 2107 | /* pointer to extended dev_info shared data copied from nvm image */ |
| 2091 | 2108 | u32 extended_dev_info_shared_addr; |
| 2092 | 2109 | u32 ncsi_oem_data_addr; |
| @@ -2159,6 +2176,16 @@ struct shmem2_region { · 66 unmodified lines | ||
| 2159 | 2176 | #define SHMEM_EEE_TIME_OUTPUT_BIT 0x80000000 |
| 2160 | 2177 | |
| 2161 | 2178 | u32 sizeof_port_stats; |
| 2179 | + | |
| 2180 | + /* Link Flap Avoidance */ | |
| 2181 | + u32 lfa_host_addr[PORT_MAX]; | |
| 2182 | + u32 reserved1; | |
| 2183 | + | |
| 2184 | + u32 reserved2; /* Offset 0x148 */ | |
| 2185 | + u32 reserved3; /* Offset 0x14C */ | |
| 2186 | + u32 reserved4; /* Offset 0x150 */ | |
| 2187 | + u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */ | |
| 2188 | + #define LINK_ATTR_SYNC_KR2_ENABLE (1<<0) | |
| 2162 | 2189 | }; |
| 2163 | 2190 | |
| 2164 | 2191 | |
| @@ -4845,9 +4872,17 @@ struct vif_list_event_data { · 2680 unmodified lines | ||
| 4845 | 4872 | __le32 reserved2; |
| 4846 | 4873 | }; |
| 4847 | 4874 | |
| 4848 | −/* | |
| 4849 | − * union for all event ring message types | |
| 4850 | − */ | |
| 4875 | +/* function update event data */ | |
| 4876 | +struct function_update_event_data { | |
| 4877 | + u8 echo; | |
| 4878 | + u8 reserved; | |
| 4879 | + __le16 reserved0; | |
| 4880 | + __le32 reserved1; | |
| 4881 | + __le32 reserved2; | |
| 4882 | +}; | |
| 4883 | + | |
| 4884 | + | |
| 4885 | +/* union for all event ring message types */ | |
| 4851 | 4886 | union event_data { |
| 4852 | 4887 | struct vf_pf_event_data vf_pf_event; |
| 4853 | 4888 | struct eth_event_data eth_event; |
| @@ -4855,6 +4890,7 @@ union event_data { · 1 unmodified line | ||
| 4855 | 4890 | struct vf_flr_event_data vf_flr_event; |
| 4856 | 4891 | struct malicious_vf_event_data malicious_vf_event; |
| 4857 | 4892 | struct vif_list_event_data vif_list_event; |
| 4893 | + struct function_update_event_data function_update_event; | |
| 4858 | 4894 | }; |
| 4859 | 4895 | |
| 4860 | 4896 | |
| @@ -4984,8 +5020,10 @@ struct function_update_data { · 123 unmodified lines | ||
| 4984 | 5020 | u8 allowed_priorities; |
| 4985 | 5021 | u8 network_cos_mode; |
| 4986 | 5022 | u8 lb_mode_en; |
| 4987 | − u8 reserved0; | |
| 4988 | − __le32 reserved1; | |
| 5023 | + u8 tx_switch_suspend_change_flg; | |
| 5024 | + u8 tx_switch_suspend; | |
| 5025 | + u8 echo; | |
| 5026 | + __le16 reserved1; | |
| 4989 | 5027 | }; |
| 4990 | 5028 | |
| 4991 | 5029 | |
| @@ -648,15 +648,25 @@ static int bnx2x_ilt_client_mem_op(struct bnx2x *bp, int cli_num, · 647 unmodified lines | ||
| 648 | 648 | return rc; |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | +static int bnx2x_ilt_mem_op_cnic(struct bnx2x *bp, u8 memop) | |
| 652 | +{ | |
| 653 | + int rc = 0; | |
| 654 | + | |
| 655 | + if (CONFIGURE_NIC_MODE(bp)) | |
| 656 | + rc = bnx2x_ilt_client_mem_op(bp, ILT_CLIENT_SRC, memop); | |
| 657 | + if (!rc) | |
| 658 | + rc = bnx2x_ilt_client_mem_op(bp, ILT_CLIENT_TM, memop); | |
| 659 | + | |
| 660 | + return rc; | |
| 661 | +} | |
| 662 | + | |
| 651 | 663 | static int bnx2x_ilt_mem_op(struct bnx2x *bp, u8 memop) |
| 652 | 664 | { |
| 653 | 665 | int rc = bnx2x_ilt_client_mem_op(bp, ILT_CLIENT_CDU, memop); |
| 654 | 666 | if (!rc) |
| 655 | 667 | rc = bnx2x_ilt_client_mem_op(bp, ILT_CLIENT_QM, memop); |
| 656 | − if (!rc) | |
| 668 | + if (!rc && CNIC_SUPPORT(bp) && !CONFIGURE_NIC_MODE(bp)) | |
| 657 | 669 | rc = bnx2x_ilt_client_mem_op(bp, ILT_CLIENT_SRC, memop); |
| 658 | − if (!rc) | |
| 659 | − rc = bnx2x_ilt_client_mem_op(bp, ILT_CLIENT_TM, memop); | |
| 660 | 670 | |
| 661 | 671 | return rc; |
| 662 | 672 | } |
| @@ -781,12 +791,19 @@ static void bnx2x_ilt_client_id_init_op(struct bnx2x *bp, · 118 unmodified lines | ||
| 781 | 791 | bnx2x_ilt_client_init_op(bp, ilt_cli, initop); |
| 782 | 792 | } |
| 783 | 793 | |
| 794 | +static void bnx2x_ilt_init_op_cnic(struct bnx2x *bp, u8 initop) | |
| 795 | +{ | |
| 796 | + if (CONFIGURE_NIC_MODE(bp)) | |
| 797 | + bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_SRC, initop); | |
| 798 | + bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_TM, initop); | |
| 799 | +} | |
| 800 | + | |
| 784 | 801 | static void bnx2x_ilt_init_op(struct bnx2x *bp, u8 initop) |
| 785 | 802 | { |
| 786 | 803 | bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_CDU, initop); |
| 787 | 804 | bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_QM, initop); |
| 788 | − bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_SRC, initop); | |
| 789 | − bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_TM, initop); | |
| 805 | + if (CNIC_SUPPORT(bp) && !CONFIGURE_NIC_MODE(bp)) | |
| 806 | + bnx2x_ilt_client_id_init_op(bp, ILT_CLIENT_SRC, initop); | |
| 790 | 807 | } |
| 791 | 808 | |
| 792 | 809 | static void bnx2x_ilt_init_client_psz(struct bnx2x *bp, int cli_num, |
| @@ -890,7 +907,6 @@ static void bnx2x_qm_init_ptr_table(struct bnx2x *bp, int qm_cid_count, · 97 unmodified lines | ||
| 890 | 907 | /**************************************************************************** |
| 891 | 908 | * SRC initializations |
| 892 | 909 | ****************************************************************************/ |
| 893 | −#ifdef BCM_CNIC | |
| 894 | 910 | /* called during init func stage */ |
| 895 | 911 | static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, |
| 896 | 912 | dma_addr_t t2_mapping, int src_cid_count) |
| @@ -915,5 +931,4 @@ static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, · 18 unmodified lines | ||
| 915 | 931 | U64_HI((u64)t2_mapping + |
| 916 | 932 | (src_cid_count-1) * sizeof(struct src_ent))); |
| 917 | 933 | } |
| 918 | −#endif | |
| 919 | 934 | #endif /* BNX2X_INIT_OPS_H */ |
| @@ -121,6 +121,7 @@ · 120 unmodified lines | ||
| 121 | 121 | #define GP_STATUS_10G_XFI MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_XFI |
| 122 | 122 | #define GP_STATUS_20G_DXGXS MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_20G_DXGXS |
| 123 | 123 | #define GP_STATUS_10G_SFI MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_SFI |
| 124 | +#define GP_STATUS_20G_KR2 MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_20G_KR2 | |
| 124 | 125 | #define LINK_10THD LINK_STATUS_SPEED_AND_DUPLEX_10THD |
| 125 | 126 | #define LINK_10TFD LINK_STATUS_SPEED_AND_DUPLEX_10TFD |
| 126 | 127 | #define LINK_100TXHD LINK_STATUS_SPEED_AND_DUPLEX_100TXHD |
| @@ -253,6 +254,12 @@ static int bnx2x_check_lfa(struct link_params *params) · 126 unmodified lines | ||
| 253 | 254 | if (!(link_status & LINK_STATUS_LINK_UP)) |
| 254 | 255 | return LFA_LINK_DOWN; |
| 255 | 256 | |
| 257 | + /* if loaded after BOOT from SAN, don't flap the link in any case and | |
| 258 | + * rely on link set by preboot driver | |
| 259 | + */ | |
| 260 | + if (params->feature_config_flags & FEATURE_CONFIG_BOOT_FROM_SAN) | |
| 261 | + return 0; | |
| 262 | + | |
| 256 | 263 | /* Verify that loopback mode is not set */ |
| 257 | 264 | if (params->loopback_mode) |
| 258 | 265 | return LFA_LOOPBACK_ENABLED; |
| @@ -1440,30 +1447,47 @@ void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars, · 1181 unmodified lines | ||
| 1440 | 1447 | /******************************************************************/ |
| 1441 | 1448 | /* MAC/PBF section */ |
| 1442 | 1449 | /******************************************************************/ |
| 1443 | −static void bnx2x_set_mdio_clk(struct bnx2x *bp, u32 chip_id, u8 port) | |
| 1450 | +static void bnx2x_set_mdio_clk(struct bnx2x *bp, u32 chip_id, | |
| 1451 | + u32 emac_base) | |
| 1444 | 1452 | { |
| 1445 | − u32 mode, emac_base; | |
| 1453 | + u32 new_mode, cur_mode; | |
| 1454 | + u32 clc_cnt; | |
| 1446 | 1455 | /* Set clause 45 mode, slow down the MDIO clock to 2.5MHz |
| 1447 | 1456 | * (a value of 49==0x31) and make sure that the AUTO poll is off |
| 1448 | 1457 | */ |
| 1458 | + cur_mode = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); | |
| 1449 | 1459 | |
| 1450 | − if (CHIP_IS_E2(bp)) | |
| 1451 | − emac_base = GRCBASE_EMAC0; | |
| 1452 | − else | |
| 1453 | − emac_base = (port) ? GRCBASE_EMAC1 : GRCBASE_EMAC0; | |
| 1454 | − mode = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); | |
| 1455 | − mode &= ~(EMAC_MDIO_MODE_AUTO_POLL | | |
| 1456 | − EMAC_MDIO_MODE_CLOCK_CNT); | |
| 1457 | 1460 | if (USES_WARPCORE(bp)) |
| 1458 | − mode |= (74L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT); | |
| 1461 | + clc_cnt = 74L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT; | |
| 1459 | 1462 | else |
| 1460 | − mode |= (49L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT); | |
| 1463 | + clc_cnt = 49L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT; | |
| 1461 | 1464 | |
| 1462 | − mode |= (EMAC_MDIO_MODE_CLAUSE_45); | |
| 1463 | − REG_WR(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE, mode); | |
| 1465 | + if (((cur_mode & EMAC_MDIO_MODE_CLOCK_CNT) == clc_cnt) && | |
| 1466 | + (cur_mode & (EMAC_MDIO_MODE_CLAUSE_45))) | |
| 1467 | + return; | |
| 1464 | 1468 | |
| 1469 | + new_mode = cur_mode & | |
| 1470 | + ~(EMAC_MDIO_MODE_AUTO_POLL | EMAC_MDIO_MODE_CLOCK_CNT); | |
| 1471 | + new_mode |= clc_cnt; | |
| 1472 | + new_mode |= (EMAC_MDIO_MODE_CLAUSE_45); | |
| 1473 | + | |
| 1474 | + DP(NETIF_MSG_LINK, "Changing emac_mode from 0x%x to 0x%x\n", | |
| 1475 | + cur_mode, new_mode); | |
| 1476 | + REG_WR(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE, new_mode); | |
| 1465 | 1477 | udelay(40); |
| 1466 | 1478 | } |
| 1479 | + | |
| 1480 | +static void bnx2x_set_mdio_emac_per_phy(struct bnx2x *bp, | |
| 1481 | + struct link_params *params) | |
| 1482 | +{ | |
| 1483 | + u8 phy_index; | |
| 1484 | + /* Set mdio clock per phy */ | |
| 1485 | + for (phy_index = INT_PHY; phy_index < params->num_phys; | |
| 1486 | + phy_index++) | |
| 1487 | + bnx2x_set_mdio_clk(bp, params->chip_id, | |
| 1488 | + params->phy[phy_index].mdio_ctrl); | |
| 1489 | +} | |
| 1490 | + | |
| 1467 | 1491 | static u8 bnx2x_is_4_port_mode(struct bnx2x *bp) |
| 1468 | 1492 | { |
| 1469 | 1493 | u32 port4mode_ovwr_val; |
| @@ -1508,7 +1532,8 @@ static void bnx2x_emac_init(struct link_params *params, · 38 unmodified lines | ||
| 1508 | 1532 | } |
| 1509 | 1533 | timeout--; |
| 1510 | 1534 | } while (val & EMAC_MODE_RESET); |
| 1511 | − bnx2x_set_mdio_clk(bp, params->chip_id, port); | |
| 1535 | + | |
| 1536 | + bnx2x_set_mdio_emac_per_phy(bp, params); | |
| 1512 | 1537 | /* Set mac address */ |
| 1513 | 1538 | val = ((params->mac_addr[0] << 8) | |
| 1514 | 1539 | params->mac_addr[1]); |
| @@ -1664,7 +1689,10 @@ static void bnx2x_xmac_init(struct link_params *params, u32 max_speed) · 149 unmodified lines | ||
| 1664 | 1689 | * ports of the path |
| 1665 | 1690 | */ |
| 1666 | 1691 | |
| 1667 | − if ((CHIP_NUM(bp) == CHIP_NUM_57840_4_10) && | |
| 1692 | + if (((CHIP_NUM(bp) == CHIP_NUM_57840_4_10) || | |
| 1693 | + (CHIP_NUM(bp) == CHIP_NUM_57840_2_20) || | |
| 1694 | + (CHIP_NUM(bp) == CHIP_NUM_57840_OBSOLETE)) && | |
| 1695 | + is_port4mode && | |
| 1668 | 1696 | (REG_RD(bp, MISC_REG_RESET_REG_2) & |
| 1669 | 1697 | MISC_REGISTERS_RESET_REG_2_XMAC)) { |
| 1670 | 1698 | DP(NETIF_MSG_LINK, |
| @@ -1760,6 +1788,18 @@ static int bnx2x_xmac_enable(struct link_params *params, · 89 unmodified lines | ||
| 1760 | 1788 | */ |
| 1761 | 1789 | REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + params->port*4, 0); |
| 1762 | 1790 | |
| 1791 | + /* When XMAC is in XLGMII mode, disable sending idles for fault | |
| 1792 | + * detection. | |
| 1793 | + */ | |
| 1794 | + if (!(params->phy[INT_PHY].flags & FLAGS_TX_ERROR_CHECK)) { | |
| 1795 | + REG_WR(bp, xmac_base + XMAC_REG_RX_LSS_CTRL, | |
| 1796 | + (XMAC_RX_LSS_CTRL_REG_LOCAL_FAULT_DISABLE | | |
| 1797 | + XMAC_RX_LSS_CTRL_REG_REMOTE_FAULT_DISABLE)); | |
| 1798 | + REG_WR(bp, xmac_base + XMAC_REG_CLEAR_RX_LSS_STATUS, 0); | |
| 1799 | + REG_WR(bp, xmac_base + XMAC_REG_CLEAR_RX_LSS_STATUS, | |
| 1800 | + XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_LOCAL_FAULT_STATUS | | |
| 1801 | + XMAC_CLEAR_RX_LSS_STATUS_REG_CLEAR_REMOTE_FAULT_STATUS); | |
| 1802 | + } | |
| 1763 | 1803 | /* Set Max packet size */ |
| 1764 | 1804 | REG_WR(bp, xmac_base + XMAC_REG_RX_MAX_SIZE, 0x2710); |
| 1765 | 1805 | |
| @@ -1780,6 +1820,12 @@ static int bnx2x_xmac_enable(struct link_params *params, · 14 unmodified lines | ||
| 1780 | 1820 | /* Enable TX and RX */ |
| 1781 | 1821 | val = XMAC_CTRL_REG_TX_EN | XMAC_CTRL_REG_RX_EN; |
| 1782 | 1822 | |
| 1823 | + /* Set MAC in XLGMII mode for dual-mode */ | |
| 1824 | + if ((vars->line_speed == SPEED_20000) && | |
| 1825 | + (params->phy[INT_PHY].supported & | |
| 1826 | + SUPPORTED_20000baseKR2_Full)) | |
| 1827 | + val |= XMAC_CTRL_REG_XLGMII_ALIGN_ENB; | |
| 1828 | + | |
| 1783 | 1829 | /* Check loopback mode */ |
| 1784 | 1830 | if (lb) |
| 1785 | 1831 | val |= XMAC_CTRL_REG_LINE_LOCAL_LPBK; |
| @@ -2096,6 +2142,16 @@ static void bnx2x_update_mng(struct link_params *params, u32 link_status) · 310 unmodified lines | ||
| 2096 | 2142 | port_mb[params->port].link_status), link_status); |
| 2097 | 2143 | } |
| 2098 | 2144 | |
| 2145 | +static void bnx2x_update_link_attr(struct link_params *params, u32 link_attr) | |
| 2146 | +{ | |
| 2147 | + struct bnx2x *bp = params->bp; | |
| 2148 | + | |
| 2149 | + if (SHMEM2_HAS(bp, link_attr_sync)) | |
| 2150 | + REG_WR(bp, params->shmem2_base + | |
| 2151 | + offsetof(struct shmem2_region, | |
| 2152 | + link_attr_sync[params->port]), link_attr); | |
| 2153 | +} | |
| 2154 | + | |
| 2099 | 2155 | static void bnx2x_update_pfc_nig(struct link_params *params, |
| 2100 | 2156 | struct link_vars *vars, |
| 2101 | 2157 | struct bnx2x_nig_brb_pfc_port_params *nig_params) |
| @@ -2126,7 +2182,7 @@ static void bnx2x_update_pfc_nig(struct link_params *params, · 24 unmodified lines | ||
| 2126 | 2182 | if (CHIP_IS_E3(bp)) |
| 2127 | 2183 | ppp_enable = 0; |
| 2128 | 2184 | else |
| 2129 | − ppp_enable = 1; | |
| 2185 | + ppp_enable = 1; | |
| 2130 | 2186 | xcm_mask &= ~(port ? NIG_LLH1_XCM_MASK_REG_LLH1_XCM_MASK_BCN : |
| 2131 | 2187 | NIG_LLH0_XCM_MASK_REG_LLH0_XCM_MASK_BCN); |
| 2132 | 2188 | xcm_out_en = 0; |
| @@ -2247,7 +2303,6 @@ int bnx2x_update_pfc(struct link_params *params, · 114 unmodified lines | ||
| 2247 | 2303 | return bnx2x_status; |
| 2248 | 2304 | } |
| 2249 | 2305 | |
| 2250 | − | |
| 2251 | 2306 | static int bnx2x_bmac1_enable(struct link_params *params, |
| 2252 | 2307 | struct link_vars *vars, |
| 2253 | 2308 | u8 is_lb) |
| @@ -2651,6 +2706,13 @@ static int bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, · 397 unmodified lines | ||
| 2651 | 2706 | u32 val; |
| 2652 | 2707 | u16 i; |
| 2653 | 2708 | int rc = 0; |
| 2709 | + u32 chip_id; | |
| 2710 | + if (phy->flags & FLAGS_MDC_MDIO_WA_G) { | |
| 2711 | + chip_id = (REG_RD(bp, MISC_REG_CHIP_NUM) << 16) | | |
| 2712 | + ((REG_RD(bp, MISC_REG_CHIP_REV) & 0xf) << 12); | |
| 2713 | + bnx2x_set_mdio_clk(bp, chip_id, phy->mdio_ctrl); | |
| 2714 | + } | |
| 2715 | + | |
| 2654 | 2716 | if (phy->flags & FLAGS_MDC_MDIO_WA_B0) |
| 2655 | 2717 | bnx2x_bits_en(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS, |
| 2656 | 2718 | EMAC_MDIO_STATUS_10MB); |
| @@ -2719,6 +2781,13 @@ static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, · 62 unmodified lines | ||
| 2719 | 2781 | u32 tmp; |
| 2720 | 2782 | u8 i; |
| 2721 | 2783 | int rc = 0; |
| 2784 | + u32 chip_id; | |
| 2785 | + if (phy->flags & FLAGS_MDC_MDIO_WA_G) { | |
| 2786 | + chip_id = (REG_RD(bp, MISC_REG_CHIP_NUM) << 16) | | |
| 2787 | + ((REG_RD(bp, MISC_REG_CHIP_REV) & 0xf) << 12); | |
| 2788 | + bnx2x_set_mdio_clk(bp, chip_id, phy->mdio_ctrl); | |
| 2789 | + } | |
| 2790 | + | |
| 2722 | 2791 | if (phy->flags & FLAGS_MDC_MDIO_WA_B0) |
| 2723 | 2792 | bnx2x_bits_en(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS, |
| 2724 | 2793 | EMAC_MDIO_STATUS_10MB); |
| @@ -3147,6 +3216,15 @@ static void bnx2x_cl45_read_or_write(struct bnx2x *bp, struct bnx2x_phy *phy, · 422 unmodified lines | ||
| 3147 | 3216 | bnx2x_cl45_write(bp, phy, devad, reg, val | or_val); |
| 3148 | 3217 | } |
| 3149 | 3218 | |
| 3219 | +static void bnx2x_cl45_read_and_write(struct bnx2x *bp, | |
| 3220 | + struct bnx2x_phy *phy, | |
| 3221 | + u8 devad, u16 reg, u16 and_val) | |
| 3222 | +{ | |
| 3223 | + u16 val; | |
| 3224 | + bnx2x_cl45_read(bp, phy, devad, reg, &val); | |
| 3225 | + bnx2x_cl45_write(bp, phy, devad, reg, val & and_val); | |
| 3226 | +} | |
| 3227 | + | |
| 3150 | 3228 | int bnx2x_phy_read(struct link_params *params, u8 phy_addr, |
| 3151 | 3229 | u8 devad, u16 reg, u16 *ret_val) |
| 3152 | 3230 | { |
| @@ -3551,6 +3629,44 @@ static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy, · 398 unmodified lines | ||
| 3551 | 3629 | * init configuration, and set/clear SGMII flag. Internal |
| 3552 | 3630 | * phy init is done purely in phy_init stage. |
| 3553 | 3631 | */ |
| 3632 | +static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy, | |
| 3633 | + struct link_params *params, | |
| 3634 | + struct link_vars *vars) | |
| 3635 | +{ | |
| 3636 | + struct bnx2x *bp = params->bp; | |
| 3637 | + u16 i; | |
| 3638 | + static struct bnx2x_reg_set reg_set[] = { | |
| 3639 | + /* Step 1 - Program the TX/RX alignment markers */ | |
| 3640 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0xa157}, | |
| 3641 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xcbe2}, | |
| 3642 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0x7537}, | |
| 3643 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0xa157}, | |
| 3644 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xcbe2}, | |
| 3645 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0x7537}, | |
| 3646 | + /* Step 2 - Configure the NP registers */ | |
| 3647 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000a}, | |
| 3648 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6400}, | |
| 3649 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0620}, | |
| 3650 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0157}, | |
| 3651 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x6464}, | |
| 3652 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x3150}, | |
| 3653 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x3150}, | |
| 3654 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0157}, | |
| 3655 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0620} | |
| 3656 | + }; | |
| 3657 | + DP(NETIF_MSG_LINK, "Enabling 20G-KR2\n"); | |
| 3658 | + | |
| 3659 | + bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | |
| 3660 | + MDIO_WC_REG_CL49_USERB0_CTRL, (3<<6)); | |
| 3661 | + | |
| 3662 | + for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++) | |
| 3663 | + bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | |
| 3664 | + reg_set[i].val); | |
| 3665 | + | |
| 3666 | + /* Start KR2 work-around timer which handles BCM8073 link-parner */ | |
| 3667 | + vars->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; | |
| 3668 | + bnx2x_update_link_attr(params, vars->link_attr_sync); | |
| 3669 | +} | |
| 3554 | 3670 | |
| 3555 | 3671 | static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, |
| 3556 | 3672 | struct link_params *params) |
| @@ -3564,6 +3680,21 @@ static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, · 7 unmodified lines | ||
| 3564 | 3680 | MDIO_WC_REG_DIGITAL4_MISC5, 0xc000); |
| 3565 | 3681 | } |
| 3566 | 3682 | |
| 3683 | +static void bnx2x_warpcore_restart_AN_KR(struct bnx2x_phy *phy, | |
| 3684 | + struct link_params *params) | |
| 3685 | +{ | |
| 3686 | + /* Restart autoneg on the leading lane only */ | |
| 3687 | + struct bnx2x *bp = params->bp; | |
| 3688 | + u16 lane = bnx2x_get_warpcore_lane(phy, params); | |
| 3689 | + CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | |
| 3690 | + MDIO_AER_BLOCK_AER_REG, lane); | |
| 3691 | + bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | |
| 3692 | + MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x1200); | |
| 3693 | + | |
| 3694 | + /* Restore AER */ | |
| 3695 | + bnx2x_set_aer_mmd(params, phy); | |
| 3696 | +} | |
| 3697 | + | |
| 3567 | 3698 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, |
| 3568 | 3699 | struct link_params *params, |
| 3569 | 3700 | struct link_vars *vars) { |
| @@ -3576,7 +3707,9 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 6 unmodified lines | ||
| 3576 | 3707 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, |
| 3577 | 3708 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, |
| 3578 | 3709 | /* Disable Autoneg: re-enable it after adv is done. */ |
| 3579 | − {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0} | |
| 3710 | + {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0}, | |
| 3711 | + {MDIO_PMA_DEVAD, MDIO_WC_REG_PMD_KR_CONTROL, 0x2}, | |
| 3712 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_TX_FIR_TAP, 0}, | |
| 3580 | 3713 | }; |
| 3581 | 3714 | DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); |
| 3582 | 3715 | /* Set to default registers that may be overriden by 10G force */ |
| @@ -3585,11 +3718,11 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 2 unmodified lines | ||
| 3585 | 3718 | reg_set[i].val); |
| 3586 | 3719 | |
| 3587 | 3720 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| 3588 | − MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl); | |
| 3589 | − cl72_ctrl &= 0xf8ff; | |
| 3721 | + MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl); | |
| 3722 | + cl72_ctrl &= 0x08ff; | |
| 3590 | 3723 | cl72_ctrl |= 0x3800; |
| 3591 | 3724 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
| 3592 | − MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl); | |
| 3725 | + MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl); | |
| 3593 | 3726 | |
| 3594 | 3727 | /* Check adding advertisement for 1G KX */ |
| 3595 | 3728 | if (((vars->line_speed == SPEED_AUTO_NEG) && |
| @@ -3624,6 +3757,16 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 28 unmodified lines | ||
| 3624 | 3757 | ((0x02 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | |
| 3625 | 3758 | (0x06 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | |
| 3626 | 3759 | (0x09 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET))); |
| 3760 | + /* Configure the next lane if dual mode */ | |
| 3761 | + if (phy->flags & FLAGS_WC_DUAL_MODE) | |
| 3762 | + bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3763 | + MDIO_WC_REG_TX0_TX_DRIVER + 0x10*(lane+1), | |
| 3764 | + ((0x02 << | |
| 3765 | + MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | | |
| 3766 | + (0x06 << | |
| 3767 | + MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | | |
| 3768 | + (0x09 << | |
| 3769 | + MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET))); | |
| 3627 | 3770 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
| 3628 | 3771 | MDIO_WC_REG_CL72_USERB0_CL72_OS_DEF_CTRL, |
| 3629 | 3772 | 0x03f0); |
| @@ -3670,10 +3813,26 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 40 unmodified lines | ||
| 3670 | 3813 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
| 3671 | 3814 | MDIO_WC_REG_DIGITAL3_UP1, 0x1f); |
| 3672 | 3815 | |
| 3673 | − /* Enable Autoneg */ | |
| 3674 | − bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | |
| 3675 | − MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x1200); | |
| 3816 | + if (((phy->req_line_speed == SPEED_AUTO_NEG) && | |
| 3817 | + (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G)) || | |
| 3818 | + (phy->req_line_speed == SPEED_20000)) { | |
| 3676 | 3819 | |
| 3820 | + CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | |
| 3821 | + MDIO_AER_BLOCK_AER_REG, lane); | |
| 3822 | + | |
| 3823 | + bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | |
| 3824 | + MDIO_WC_REG_RX1_PCI_CTRL + (0x10*lane), | |
| 3825 | + (1<<11)); | |
| 3826 | + | |
| 3827 | + bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3828 | + MDIO_WC_REG_XGXS_X2_CONTROL3, 0x7); | |
| 3829 | + bnx2x_set_aer_mmd(params, phy); | |
| 3830 | + | |
| 3831 | + bnx2x_warpcore_enable_AN_KR2(phy, params, vars); | |
| 3832 | + } | |
| 3833 | + | |
| 3834 | + /* Enable Autoneg: only on the main lane */ | |
| 3835 | + bnx2x_warpcore_restart_AN_KR(phy, params); | |
| 3677 | 3836 | } |
| 3678 | 3837 | |
| 3679 | 3838 | static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, |
| @@ -3692,9 +3851,7 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, · 12 unmodified lines | ||
| 3692 | 3851 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, |
| 3693 | 3852 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, |
| 3694 | 3853 | /* Leave cl72 training enable, needed for KR */ |
| 3695 | − {MDIO_PMA_DEVAD, | |
| 3696 | − MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, | |
| 3697 | − 0x2} | |
| 3854 | + {MDIO_PMA_DEVAD, MDIO_WC_REG_PMD_KR_CONTROL, 0x2} | |
| 3698 | 3855 | }; |
| 3699 | 3856 | |
| 3700 | 3857 | for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++) |
| @@ -3764,27 +3921,21 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, · 63 unmodified lines | ||
| 3764 | 3921 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0); |
| 3765 | 3922 | |
| 3766 | 3923 | /* Disable 100FX Enable and Auto-Detect */ |
| 3767 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 3768 | − MDIO_WC_REG_FX100_CTRL1, &val); | |
| 3769 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3770 | − MDIO_WC_REG_FX100_CTRL1, (val & 0xFFFA)); | |
| 3924 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 3925 | + MDIO_WC_REG_FX100_CTRL1, 0xFFFA); | |
| 3771 | 3926 | |
| 3772 | 3927 | /* Disable 100FX Idle detect */ |
| 3773 | 3928 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
| 3774 | 3929 | MDIO_WC_REG_FX100_CTRL3, 0x0080); |
| 3775 | 3930 | |
| 3776 | 3931 | /* Set Block address to Remote PHY & Clear forced_speed[5] */ |
| 3777 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 3778 | − MDIO_WC_REG_DIGITAL4_MISC3, &val); | |
| 3779 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3780 | − MDIO_WC_REG_DIGITAL4_MISC3, (val & 0xFF7F)); | |
| 3932 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 3933 | + MDIO_WC_REG_DIGITAL4_MISC3, 0xFF7F); | |
| 3781 | 3934 | |
| 3782 | 3935 | /* Turn off auto-detect & fiber mode */ |
| 3783 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 3784 | − MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X1, &val); | |
| 3785 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3786 | − MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X1, | |
| 3787 | − (val & 0xFFEE)); | |
| 3936 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 3937 | + MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X1, | |
| 3938 | + 0xFFEE); | |
| 3788 | 3939 | |
| 3789 | 3940 | /* Set filter_force_link, disable_false_link and parallel_detect */ |
| 3790 | 3941 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| @@ -3846,22 +3997,65 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, · 55 unmodified lines | ||
| 3846 | 3997 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x100); |
| 3847 | 3998 | |
| 3848 | 3999 | /* Release tx_fifo_reset */ |
| 4000 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4001 | + MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X3, | |
| 4002 | + 0xFFFE); | |
| 4003 | + /* Release rxSeqStart */ | |
| 4004 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4005 | + MDIO_WC_REG_DSC2B0_DSC_MISC_CTRL0, 0x7FFF); | |
| 4006 | +} | |
| 4007 | + | |
| 4008 | +static void bnx2x_warpcore_set_20G_force_KR2(struct bnx2x_phy *phy, | |
| 4009 | + struct link_params *params) | |
| 4010 | +{ | |
| 4011 | + u16 val; | |
| 4012 | + struct bnx2x *bp = params->bp; | |
| 4013 | + /* Set global registers, so set AER lane to 0 */ | |
| 4014 | + CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | |
| 4015 | + MDIO_AER_BLOCK_AER_REG, 0); | |
| 4016 | + | |
| 4017 | + /* Disable sequencer */ | |
| 4018 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4019 | + MDIO_WC_REG_XGXSBLK0_XGXSCONTROL, ~(1<<13)); | |
| 4020 | + | |
| 4021 | + bnx2x_set_aer_mmd(params, phy); | |
| 4022 | + | |
| 4023 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_PMA_DEVAD, | |
| 4024 | + MDIO_WC_REG_PMD_KR_CONTROL, ~(1<<1)); | |
| 4025 | + bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | |
| 4026 | + MDIO_AN_REG_CTRL, 0); | |
| 4027 | + /* Turn off CL73 */ | |
| 3849 | 4028 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| 3850 | − MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X3, &val); | |
| 4029 | + MDIO_WC_REG_CL73_USERB0_CTRL, &val); | |
| 4030 | + val &= ~(1<<5); | |
| 4031 | + val |= (1<<6); | |
| 3851 | 4032 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
| 3852 | − MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X3, val & 0xFFFE); | |
| 4033 | + MDIO_WC_REG_CL73_USERB0_CTRL, val); | |
| 4034 | + | |
| 4035 | + /* Set 20G KR2 force speed */ | |
| 4036 | + bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | |
| 4037 | + MDIO_WC_REG_SERDESDIGITAL_MISC1, 0x1f); | |
| 4038 | + | |
| 4039 | + bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | |
| 4040 | + MDIO_WC_REG_DIGITAL4_MISC3, (1<<7)); | |
| 3853 | 4041 | |
| 3854 | − /* Release rxSeqStart */ | |
| 3855 | 4042 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| 3856 | − MDIO_WC_REG_DSC2B0_DSC_MISC_CTRL0, &val); | |
| 4043 | + MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &val); | |
| 4044 | + val &= ~(3<<14); | |
| 4045 | + val |= (1<<15); | |
| 3857 | 4046 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
| 3858 | − MDIO_WC_REG_DSC2B0_DSC_MISC_CTRL0, (val & 0x7FFF)); | |
| 3859 | −} | |
| 4047 | + MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, val); | |
| 4048 | + bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 4049 | + MDIO_WC_REG_CL72_USERB0_CL72_TX_FIR_TAP, 0x835A); | |
| 3860 | 4050 | |
| 3861 | −static void bnx2x_warpcore_set_20G_KR2(struct bnx2x *bp, | |
| 3862 | − struct bnx2x_phy *phy) | |
| 3863 | −{ | |
| 3864 | − DP(NETIF_MSG_LINK, "KR2 still not supported !!!\n"); | |
| 4051 | + /* Enable sequencer (over lane 0) */ | |
| 4052 | + CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | |
| 4053 | + MDIO_AER_BLOCK_AER_REG, 0); | |
| 4054 | + | |
| 4055 | + bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | |
| 4056 | + MDIO_WC_REG_XGXSBLK0_XGXSCONTROL, (1<<13)); | |
| 4057 | + | |
| 4058 | + bnx2x_set_aer_mmd(params, phy); | |
| 3865 | 4059 | } |
| 3866 | 4060 | |
| 3867 | 4061 | static void bnx2x_warpcore_set_20G_DXGXS(struct bnx2x *bp, |
| @@ -3931,20 +4125,16 @@ static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy, · 63 unmodified lines | ||
| 3931 | 4125 | u16 val16, digctrl_kx1, digctrl_kx2; |
| 3932 | 4126 | |
| 3933 | 4127 | /* Clear XFI clock comp in non-10G single lane mode. */ |
| 3934 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 3935 | − MDIO_WC_REG_RX66_CONTROL, &val16); | |
| 3936 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3937 | − MDIO_WC_REG_RX66_CONTROL, val16 & ~(3<<13)); | |
| 4128 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4129 | + MDIO_WC_REG_RX66_CONTROL, ~(3<<13)); | |
| 3938 | 4130 | |
| 3939 | 4131 | bnx2x_warpcore_set_lpi_passthrough(phy, params); |
| 3940 | 4132 | |
| 3941 | 4133 | if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) { |
| 3942 | 4134 | /* SGMII Autoneg */ |
| 3943 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 3944 | − MDIO_WC_REG_COMBO_IEEE0_MIICTRL, &val16); | |
| 3945 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 3946 | − MDIO_WC_REG_COMBO_IEEE0_MIICTRL, | |
| 3947 | − val16 | 0x1000); | |
| 4135 | + bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | |
| 4136 | + MDIO_WC_REG_COMBO_IEEE0_MIICTRL, | |
| 4137 | + 0x1000); | |
| 3948 | 4138 | DP(NETIF_MSG_LINK, "set SGMII AUTONEG\n"); |
| 3949 | 4139 | } else { |
| 3950 | 4140 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| @@ -4086,7 +4276,7 @@ static int bnx2x_get_mod_abs_int_cfg(struct bnx2x *bp, · 135 unmodified lines | ||
| 4086 | 4276 | if ((cfg_pin < PIN_CFG_GPIO0_P0) || |
| 4087 | 4277 | (cfg_pin > PIN_CFG_GPIO3_P1)) { |
| 4088 | 4278 | DP(NETIF_MSG_LINK, |
| 4089 | − "ERROR: Invalid cfg pin %x for module detect indication\n", | |
| 4279 | + "No cfg pin %x for module detect indication\n", | |
| 4090 | 4280 | cfg_pin); |
| 4091 | 4281 | return -EINVAL; |
| 4092 | 4282 | } |
| @@ -4097,7 +4287,7 @@ static int bnx2x_get_mod_abs_int_cfg(struct bnx2x *bp, · 4 unmodified lines | ||
| 4097 | 4287 | *gpio_num = MISC_REGISTERS_GPIO_3; |
| 4098 | 4288 | *gpio_port = port; |
| 4099 | 4289 | } |
| 4100 | − DP(NETIF_MSG_LINK, "MOD_ABS int GPIO%d_P%d\n", *gpio_num, *gpio_port); | |
| 4290 | + | |
| 4101 | 4291 | return 0; |
| 4102 | 4292 | } |
| 4103 | 4293 | |
| @@ -4120,7 +4310,7 @@ static int bnx2x_is_sfp_module_plugged(struct bnx2x_phy *phy, · 16 unmodified lines | ||
| 4120 | 4310 | return 0; |
| 4121 | 4311 | } |
| 4122 | 4312 | static int bnx2x_warpcore_get_sigdet(struct bnx2x_phy *phy, |
| 4123 | − struct link_params *params) | |
| 4313 | + struct link_params *params) | |
| 4124 | 4314 | { |
| 4125 | 4315 | u16 gp2_status_reg0, lane; |
| 4126 | 4316 | struct bnx2x *bp = params->bp; |
| @@ -4134,8 +4324,8 @@ static int bnx2x_warpcore_get_sigdet(struct bnx2x_phy *phy, · 7 unmodified lines | ||
| 4134 | 4324 | } |
| 4135 | 4325 | |
| 4136 | 4326 | static void bnx2x_warpcore_config_runtime(struct bnx2x_phy *phy, |
| 4137 | − struct link_params *params, | |
| 4138 | − struct link_vars *vars) | |
| 4327 | + struct link_params *params, | |
| 4328 | + struct link_vars *vars) | |
| 4139 | 4329 | { |
| 4140 | 4330 | struct bnx2x *bp = params->bp; |
| 4141 | 4331 | u32 serdes_net_if; |
| @@ -4163,7 +4353,7 @@ static void bnx2x_warpcore_config_runtime(struct bnx2x_phy *phy, · 21 unmodified lines | ||
| 4163 | 4353 | case PORT_HW_CFG_NET_SERDES_IF_KR: |
| 4164 | 4354 | /* Do we get link yet? */ |
| 4165 | 4355 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, 0x81d1, |
| 4166 | − &gp_status1); | |
| 4356 | + &gp_status1); | |
| 4167 | 4357 | lnkup = (gp_status1 >> (8+lane)) & 0x1;/* 1G */ |
| 4168 | 4358 | /*10G KR*/ |
| 4169 | 4359 | lnkup_kr = (gp_status1 >> (12+lane)) & 0x1; |
| @@ -4215,6 +4405,27 @@ static void bnx2x_warpcore_config_sfi(struct bnx2x_phy *phy, · 45 unmodified lines | ||
| 4215 | 4405 | } |
| 4216 | 4406 | } |
| 4217 | 4407 | |
| 4408 | +static void bnx2x_sfp_e3_set_transmitter(struct link_params *params, | |
| 4409 | + struct bnx2x_phy *phy, | |
| 4410 | + u8 tx_en) | |
| 4411 | +{ | |
| 4412 | + struct bnx2x *bp = params->bp; | |
| 4413 | + u32 cfg_pin; | |
| 4414 | + u8 port = params->port; | |
| 4415 | + | |
| 4416 | + cfg_pin = REG_RD(bp, params->shmem_base + | |
| 4417 | + offsetof(struct shmem_region, | |
| 4418 | + dev_info.port_hw_config[port].e3_sfp_ctrl)) & | |
| 4419 | + PORT_HW_CFG_E3_TX_LASER_MASK; | |
| 4420 | + /* Set the !tx_en since this pin is DISABLE_TX_LASER */ | |
| 4421 | + DP(NETIF_MSG_LINK, "Setting WC TX to %d\n", tx_en); | |
| 4422 | + | |
| 4423 | + /* For 20G, the expected pin to be used is 3 pins after the current */ | |
| 4424 | + bnx2x_set_cfg_pin(bp, cfg_pin, tx_en ^ 1); | |
| 4425 | + if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G) | |
| 4426 | + bnx2x_set_cfg_pin(bp, cfg_pin + 3, tx_en ^ 1); | |
| 4427 | +} | |
| 4428 | + | |
| 4218 | 4429 | static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, |
| 4219 | 4430 | struct link_params *params, |
| 4220 | 4431 | struct link_vars *vars) |
| @@ -4275,9 +4486,14 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, · 54 unmodified lines | ||
| 4275 | 4486 | break; |
| 4276 | 4487 | |
| 4277 | 4488 | case PORT_HW_CFG_NET_SERDES_IF_SFI: |
| 4278 | − /* Issue Module detection */ | |
| 4489 | + /* Issue Module detection if module is plugged, or | |
| 4490 | + * enabled transmitter to avoid current leakage in case | |
| 4491 | + * no module is connected | |
| 4492 | + */ | |
| 4279 | 4493 | if (bnx2x_is_sfp_module_plugged(phy, params)) |
| 4280 | 4494 | bnx2x_sfp_module_detection(phy, params); |
| 4495 | + else | |
| 4496 | + bnx2x_sfp_e3_set_transmitter(params, phy, 1); | |
| 4281 | 4497 | |
| 4282 | 4498 | bnx2x_warpcore_config_sfi(phy, params); |
| 4283 | 4499 | break; |
| @@ -4293,16 +4509,14 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, · 9 unmodified lines | ||
| 4293 | 4509 | |
| 4294 | 4510 | bnx2x_sfp_module_detection(phy, params); |
| 4295 | 4511 | break; |
| 4296 | − | |
| 4297 | 4512 | case PORT_HW_CFG_NET_SERDES_IF_KR2: |
| 4298 | − if (vars->line_speed != SPEED_20000) { | |
| 4299 | − DP(NETIF_MSG_LINK, "Speed not supported yet\n"); | |
| 4300 | − return; | |
| 4513 | + if (!params->loopback_mode) { | |
| 4514 | + bnx2x_warpcore_enable_AN_KR(phy, params, vars); | |
| 4515 | + } else { | |
| 4516 | + DP(NETIF_MSG_LINK, "Setting KR 20G-Force\n"); | |
| 4517 | + bnx2x_warpcore_set_20G_force_KR2(phy, params); | |
| 4301 | 4518 | } |
| 4302 | − DP(NETIF_MSG_LINK, "Setting 20G KR2\n"); | |
| 4303 | − bnx2x_warpcore_set_20G_KR2(bp, phy); | |
| 4304 | 4519 | break; |
| 4305 | − | |
| 4306 | 4520 | default: |
| 4307 | 4521 | DP(NETIF_MSG_LINK, |
| 4308 | 4522 | "Unsupported Serdes Net Interface 0x%x\n", |
| @@ -4316,68 +4530,35 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, · 7 unmodified lines | ||
| 4316 | 4530 | DP(NETIF_MSG_LINK, "Exit config init\n"); |
| 4317 | 4531 | } |
| 4318 | 4532 | |
| 4319 | −static void bnx2x_sfp_e3_set_transmitter(struct link_params *params, | |
| 4320 | − struct bnx2x_phy *phy, | |
| 4321 | − u8 tx_en) | |
| 4322 | −{ | |
| 4323 | − struct bnx2x *bp = params->bp; | |
| 4324 | − u32 cfg_pin; | |
| 4325 | − u8 port = params->port; | |
| 4326 | − | |
| 4327 | − cfg_pin = REG_RD(bp, params->shmem_base + | |
| 4328 | − offsetof(struct shmem_region, | |
| 4329 | − dev_info.port_hw_config[port].e3_sfp_ctrl)) & | |
| 4330 | − PORT_HW_CFG_TX_LASER_MASK; | |
| 4331 | − /* Set the !tx_en since this pin is DISABLE_TX_LASER */ | |
| 4332 | − DP(NETIF_MSG_LINK, "Setting WC TX to %d\n", tx_en); | |
| 4333 | − /* For 20G, the expected pin to be used is 3 pins after the current */ | |
| 4334 | − | |
| 4335 | − bnx2x_set_cfg_pin(bp, cfg_pin, tx_en ^ 1); | |
| 4336 | − if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G) | |
| 4337 | − bnx2x_set_cfg_pin(bp, cfg_pin + 3, tx_en ^ 1); | |
| 4338 | −} | |
| 4339 | − | |
| 4340 | 4533 | static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, |
| 4341 | 4534 | struct link_params *params) |
| 4342 | 4535 | { |
| 4343 | 4536 | struct bnx2x *bp = params->bp; |
| 4344 | 4537 | u16 val16, lane; |
| 4345 | 4538 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); |
| 4346 | − bnx2x_set_mdio_clk(bp, params->chip_id, params->port); | |
| 4539 | + bnx2x_set_mdio_emac_per_phy(bp, params); | |
| 4347 | 4540 | bnx2x_set_aer_mmd(params, phy); |
| 4348 | 4541 | /* Global register */ |
| 4349 | 4542 | bnx2x_warpcore_reset_lane(bp, phy, 1); |
| 4350 | 4543 | |
| 4351 | 4544 | /* Clear loopback settings (if any) */ |
| 4352 | 4545 | /* 10G & 20G */ |
| 4353 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 4354 | − MDIO_WC_REG_COMBO_IEEE0_MIICTRL, &val16); | |
| 4355 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 4356 | − MDIO_WC_REG_COMBO_IEEE0_MIICTRL, val16 & | |
| 4357 | − 0xBFFF); | |
| 4546 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4547 | + MDIO_WC_REG_COMBO_IEEE0_MIICTRL, 0xBFFF); | |
| 4358 | 4548 | |
| 4359 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 4360 | − MDIO_WC_REG_IEEE0BLK_MIICNTL, &val16); | |
| 4361 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 4362 | − MDIO_WC_REG_IEEE0BLK_MIICNTL, val16 & 0xfffe); | |
| 4549 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4550 | + MDIO_WC_REG_IEEE0BLK_MIICNTL, 0xfffe); | |
| 4363 | 4551 | |
| 4364 | 4552 | /* Update those 1-copy registers */ |
| 4365 | 4553 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
| 4366 | 4554 | MDIO_AER_BLOCK_AER_REG, 0); |
| 4367 | 4555 | /* Enable 1G MDIO (1-copy) */ |
| 4368 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 4369 | − MDIO_WC_REG_XGXSBLK0_XGXSCONTROL, | |
| 4370 | − &val16); | |
| 4371 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 4372 | − MDIO_WC_REG_XGXSBLK0_XGXSCONTROL, | |
| 4373 | − val16 & ~0x10); | |
| 4374 | − | |
| 4375 | − bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 4376 | − MDIO_WC_REG_XGXSBLK1_LANECTRL2, &val16); | |
| 4377 | − bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | |
| 4378 | − MDIO_WC_REG_XGXSBLK1_LANECTRL2, | |
| 4379 | − val16 & 0xff00); | |
| 4556 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4557 | + MDIO_WC_REG_XGXSBLK0_XGXSCONTROL, | |
| 4558 | + ~0x10); | |
| 4380 | 4559 | |
| 4560 | + bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, | |
| 4561 | + MDIO_WC_REG_XGXSBLK1_LANECTRL2, 0xff00); | |
| 4381 | 4562 | lane = bnx2x_get_warpcore_lane(phy, params); |
| 4382 | 4563 | /* Disable CL36 PCS Tx */ |
| 4383 | 4564 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| @@ -4413,8 +4594,9 @@ static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, · 29 unmodified lines | ||
| 4413 | 4594 | DP(NETIF_MSG_LINK, "Setting Warpcore loopback type %x, speed %d\n", |
| 4414 | 4595 | params->loopback_mode, phy->req_line_speed); |
| 4415 | 4596 | |
| 4416 | − if (phy->req_line_speed < SPEED_10000) { | |
| 4417 | − /* 10/100/1000 */ | |
| 4597 | + if (phy->req_line_speed < SPEED_10000 || | |
| 4598 | + phy->supported & SUPPORTED_20000baseKR2_Full) { | |
| 4599 | + /* 10/100/1000/20G-KR2 */ | |
| 4418 | 4600 | |
| 4419 | 4601 | /* Update those 1-copy registers */ |
| 4420 | 4602 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
| @@ -4427,18 +4609,20 @@ static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, · 6 unmodified lines | ||
| 4427 | 4609 | lane = bnx2x_get_warpcore_lane(phy, params); |
| 4428 | 4610 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| 4429 | 4611 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, &val16); |
| 4612 | + val16 |= (1<<lane); | |
| 4613 | + if (phy->flags & FLAGS_WC_DUAL_MODE) | |
| 4614 | + val16 |= (2<<lane); | |
| 4430 | 4615 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
| 4431 | − MDIO_WC_REG_XGXSBLK1_LANECTRL2, | |
| 4432 | − val16 | (1<<lane)); | |
| 4616 | + MDIO_WC_REG_XGXSBLK1_LANECTRL2, | |
| 4617 | + val16); | |
| 4433 | 4618 | |
| 4434 | 4619 | /* Switch back to 4-copy registers */ |
| 4435 | 4620 | bnx2x_set_aer_mmd(params, phy); |
| 4436 | 4621 | } else { |
| 4437 | − /* 10G & 20G */ | |
| 4622 | + /* 10G / 20G-DXGXS */ | |
| 4438 | 4623 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
| 4439 | 4624 | MDIO_WC_REG_COMBO_IEEE0_MIICTRL, |
| 4440 | 4625 | 0x4000); |
| 4441 | − | |
| 4442 | 4626 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
| 4443 | 4627 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x1); |
| 4444 | 4628 | } |
| @@ -4603,6 +4787,10 @@ void bnx2x_link_status_update(struct link_params *params, · 158 unmodified lines | ||
| 4603 | 4787 | params->feature_config_flags &= |
| 4604 | 4788 | ~FEATURE_CONFIG_PFC_ENABLED; |
| 4605 | 4789 | |
| 4790 | + if (SHMEM2_HAS(bp, link_attr_sync)) | |
| 4791 | + vars->link_attr_sync = SHMEM2_RD(bp, | |
| 4792 | + link_attr_sync[params->port]); | |
| 4793 | + | |
| 4606 | 4794 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", |
| 4607 | 4795 | vars->link_status, vars->phy_link_up, vars->aeu_int_mask); |
| 4608 | 4796 | DP(NETIF_MSG_LINK, "line_speed %x duplex %x flow_ctrl 0x%x\n", |
| @@ -5332,6 +5520,7 @@ static int bnx2x_get_link_speed_duplex(struct bnx2x_phy *phy, · 723 unmodified lines | ||
| 5332 | 5520 | vars->link_status |= LINK_10GTFD; |
| 5333 | 5521 | break; |
| 5334 | 5522 | case GP_STATUS_20G_DXGXS: |
| 5523 | + case GP_STATUS_20G_KR2: | |
| 5335 | 5524 | vars->line_speed = SPEED_20000; |
| 5336 | 5525 | vars->link_status |= LINK_20GTFD; |
| 5337 | 5526 | break; |
| @@ -5439,7 +5628,15 @@ static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy, · 101 unmodified lines | ||
| 5439 | 5628 | int rc = 0; |
| 5440 | 5629 | lane = bnx2x_get_warpcore_lane(phy, params); |
| 5441 | 5630 | /* Read gp_status */ |
| 5442 | − if (phy->req_line_speed > SPEED_10000) { | |
| 5631 | + if ((params->loopback_mode) && | |
| 5632 | + (phy->flags & FLAGS_WC_DUAL_MODE)) { | |
| 5633 | + bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 5634 | + MDIO_WC_REG_DIGITAL5_LINK_STATUS, &link_up); | |
| 5635 | + bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | |
| 5636 | + MDIO_WC_REG_DIGITAL5_LINK_STATUS, &link_up); | |
| 5637 | + link_up &= 0x1; | |
| 5638 | + } else if ((phy->req_line_speed > SPEED_10000) && | |
| 5639 | + (phy->supported & SUPPORTED_20000baseMLD2_Full)) { | |
| 5443 | 5640 | u16 temp_link_up; |
| 5444 | 5641 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| 5445 | 5642 | 1, &temp_link_up); |
| @@ -5452,12 +5649,22 @@ static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy, · 6 unmodified lines | ||
| 5452 | 5649 | bnx2x_ext_phy_resolve_fc(phy, params, vars); |
| 5453 | 5650 | } else { |
| 5454 | 5651 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
| 5455 | − MDIO_WC_REG_GP2_STATUS_GP_2_1, &gp_status1); | |
| 5652 | + MDIO_WC_REG_GP2_STATUS_GP_2_1, | |
| 5653 | + &gp_status1); | |
| 5456 | 5654 | DP(NETIF_MSG_LINK, "0x81d1 = 0x%x\n", gp_status1); |
| 5457 | − /* Check for either KR or generic link up. */ | |
| 5458 | − gp_status1 = ((gp_status1 >> 8) & 0xf) | | |
| 5459 | − ((gp_status1 >> 12) & 0xf); | |
| 5460 | − link_up = gp_status1 & (1 << lane); | |
| 5655 | + /* Check for either KR, 1G, or AN up. */ | |
| 5656 | + link_up = ((gp_status1 >> 8) | | |
| 5657 | + (gp_status1 >> 12) | | |
| 5658 | + (gp_status1)) & | |
| 5659 | + (1 << lane); | |
| 5660 | + if (phy->supported & SUPPORTED_20000baseKR2_Full) { | |
| 5661 | + u16 an_link; | |
| 5662 | + bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | |
| 5663 | + MDIO_AN_REG_STATUS, &an_link); | |
| 5664 | + bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | |
| 5665 | + MDIO_AN_REG_STATUS, &an_link); | |
| 5666 | + link_up |= (an_link & (1<<2)); | |
| 5667 | + } | |
| 5461 | 5668 | if (link_up && SINGLE_MEDIA_DIRECT(params)) { |
| 5462 | 5669 | u16 pd, gp_status4; |
| 5463 | 5670 | if (phy->req_line_speed == SPEED_AUTO_NEG) { |
| @@ -5522,7 +5729,7 @@ static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy, · 58 unmodified lines | ||
| 5522 | 5729 | if ((lane & 1) == 0) |
| 5523 | 5730 | gp_speed <<= 8; |
| 5524 | 5731 | gp_speed &= 0x3f00; |
| 5525 | − | |
| 5732 | + link_up = !!link_up; | |
| 5526 | 5733 | |
| 5527 | 5734 | rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, gp_speed, |
| 5528 | 5735 | duplex); |
| @@ -6683,7 +6890,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) · 1154 unmodified lines | ||
| 6683 | 6890 | } else if (prev_line_speed != vars->line_speed) { |
| 6684 | 6891 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, |
| 6685 | 6892 | 0); |
| 6686 | − usleep_range(1000, 2000); | |
| 6893 | + usleep_range(1000, 2000); | |
| 6687 | 6894 | } |
| 6688 | 6895 | } |
| 6689 | 6896 | |
| @@ -6753,7 +6960,7 @@ void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port) · 63 unmodified lines | ||
| 6753 | 6960 | { |
| 6754 | 6961 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
| 6755 | 6962 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); |
| 6756 | − usleep_range(1000, 2000); | |
| 6963 | + usleep_range(1000, 2000); | |
| 6757 | 6964 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
| 6758 | 6965 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, port); |
| 6759 | 6966 | } |
| @@ -6894,7 +7101,7 @@ static int bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, · 134 unmodified lines | ||
| 6894 | 7101 | MDIO_PMA_DEVAD, |
| 6895 | 7102 | MDIO_PMA_REG_M8051_MSGOUT_REG, &fw_msgout); |
| 6896 | 7103 | |
| 6897 | − usleep_range(1000, 2000); | |
| 7104 | + usleep_range(1000, 2000); | |
| 6898 | 7105 | } while (fw_ver1 == 0 || fw_ver1 == 0x4321 || |
| 6899 | 7106 | ((fw_msgout & 0xff) != 0x03 && (phy->type == |
| 6900 | 7107 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073))); |
| @@ -7604,13 +7811,12 @@ static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 703 unmodified lines | ||
| 7604 | 7811 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == |
| 7605 | 7812 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE) |
| 7606 | 7813 | return 0; |
| 7607 | − usleep_range(1000, 2000); | |
| 7814 | + usleep_range(1000, 2000); | |
| 7608 | 7815 | } |
| 7609 | 7816 | return -EINVAL; |
| 7610 | 7817 | } |
| 7611 | 7818 | |
| 7612 | 7819 | static void bnx2x_warpcore_power_module(struct link_params *params, |
| 7613 | − struct bnx2x_phy *phy, | |
| 7614 | 7820 | u8 power) |
| 7615 | 7821 | { |
| 7616 | 7822 | u32 pin_cfg; |
| @@ -7652,10 +7858,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 35 unmodified lines | ||
| 7652 | 7858 | addr32 = addr & (~0x3); |
| 7653 | 7859 | do { |
| 7654 | 7860 | if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) { |
| 7655 | − bnx2x_warpcore_power_module(params, phy, 0); | |
| 7861 | + bnx2x_warpcore_power_module(params, 0); | |
| 7656 | 7862 | /* Note that 100us are not enough here */ |
| 7657 | 7863 | usleep_range(1000, 2000); |
| 7658 | − bnx2x_warpcore_power_module(params, phy, 1); | |
| 7864 | + bnx2x_warpcore_power_module(params, 1); | |
| 7659 | 7865 | } |
| 7660 | 7866 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, |
| 7661 | 7867 | data_array); |
| @@ -7715,7 +7921,7 @@ static int bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 53 unmodified lines | ||
| 7715 | 7921 | /* Wait appropriate time for two-wire command to finish before |
| 7716 | 7922 | * polling the status register |
| 7717 | 7923 | */ |
| 7718 | − usleep_range(1000, 2000); | |
| 7924 | + usleep_range(1000, 2000); | |
| 7719 | 7925 | |
| 7720 | 7926 | /* Wait up to 500us for command complete status */ |
| 7721 | 7927 | for (i = 0; i < 100; i++) { |
| @@ -7751,7 +7957,7 @@ static int bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 29 unmodified lines | ||
| 7751 | 7957 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == |
| 7752 | 7958 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE) |
| 7753 | 7959 | return 0; |
| 7754 | − usleep_range(1000, 2000); | |
| 7960 | + usleep_range(1000, 2000); | |
| 7755 | 7961 | } |
| 7756 | 7962 | |
| 7757 | 7963 | return -EINVAL; |
| @@ -7786,9 +7992,8 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 28 unmodified lines | ||
| 7786 | 7992 | { |
| 7787 | 7993 | struct bnx2x *bp = params->bp; |
| 7788 | 7994 | u32 sync_offset = 0, phy_idx, media_types; |
| 7789 | − u8 val[2], check_limiting_mode = 0; | |
| 7995 | + u8 gport, val[2], check_limiting_mode = 0; | |
| 7790 | 7996 | *edc_mode = EDC_MODE_LIMITING; |
| 7791 | − | |
| 7792 | 7997 | phy->media_type = ETH_PHY_UNSPECIFIED; |
| 7793 | 7998 | /* First check for copper cable */ |
| 7794 | 7999 | if (bnx2x_read_sfp_module_eeprom(phy, |
| @@ -7843,8 +8048,15 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 48 unmodified lines | ||
| 7843 | 8048 | SFP_EEPROM_COMP_CODE_LR_MASK | |
| 7844 | 8049 | SFP_EEPROM_COMP_CODE_LRM_MASK)) == 0) { |
| 7845 | 8050 | DP(NETIF_MSG_LINK, "1G Optic module detected\n"); |
| 8051 | + gport = params->port; | |
| 7846 | 8052 | phy->media_type = ETH_PHY_SFP_1G_FIBER; |
| 7847 | 8053 | phy->req_line_speed = SPEED_1000; |
| 8054 | + if (!CHIP_IS_E1x(bp)) | |
| 8055 | + gport = BP_PATH(bp) + (params->port << 1); | |
| 8056 | + netdev_err(bp->dev, "Warning: Link speed was forced to 1000Mbps." | |
| 8057 | + " Current SFP module in port %d is not" | |
| 8058 | + " compliant with 10G Ethernet\n", | |
| 8059 | + gport); | |
| 7848 | 8060 | } else { |
| 7849 | 8061 | int idx, cfg_idx = 0; |
| 7850 | 8062 | DP(NETIF_MSG_LINK, "10G Optic module detected\n"); |
| @@ -8241,7 +8453,7 @@ static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, · 390 unmodified lines | ||
| 8241 | 8453 | struct link_params *params) |
| 8242 | 8454 | { |
| 8243 | 8455 | struct bnx2x *bp = params->bp; |
| 8244 | − bnx2x_warpcore_power_module(params, phy, 0); | |
| 8456 | + bnx2x_warpcore_power_module(params, 0); | |
| 8245 | 8457 | /* Put Warpcore in low power mode */ |
| 8246 | 8458 | REG_WR(bp, MISC_REG_WC0_RESET, 0x0c0e); |
| 8247 | 8459 | |
| @@ -8264,7 +8476,7 @@ static void bnx2x_power_sfp_module(struct link_params *params, · 16 unmodified lines | ||
| 8264 | 8476 | bnx2x_8727_power_module(params->bp, phy, power); |
| 8265 | 8477 | break; |
| 8266 | 8478 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: |
| 8267 | − bnx2x_warpcore_power_module(params, phy, power); | |
| 8479 | + bnx2x_warpcore_power_module(params, power); | |
| 8268 | 8480 | break; |
| 8269 | 8481 | default: |
| 8270 | 8482 | break; |
| @@ -8337,7 +8549,8 @@ int bnx2x_sfp_module_detection(struct bnx2x_phy *phy, · 66 unmodified lines | ||
| 8337 | 8549 | u32 val = REG_RD(bp, params->shmem_base + |
| 8338 | 8550 | offsetof(struct shmem_region, dev_info. |
| 8339 | 8551 | port_feature_config[params->port].config)); |
| 8340 | − | |
| 8552 | + /* Enabled transmitter by default */ | |
| 8553 | + bnx2x_sfp_set_transmitter(params, phy, 1); | |
| 8341 | 8554 | DP(NETIF_MSG_LINK, "SFP+ module plugged in/out detected on port %d\n", |
| 8342 | 8555 | params->port); |
| 8343 | 8556 | /* Power up module */ |
| @@ -8370,14 +8583,12 @@ int bnx2x_sfp_module_detection(struct bnx2x_phy *phy, · 26 unmodified lines | ||
| 8370 | 8583 | */ |
| 8371 | 8584 | bnx2x_set_limiting_mode(params, phy, edc_mode); |
| 8372 | 8585 | |
| 8373 | − /* Enable transmit for this module if the module is approved, or | |
| 8374 | − * if unapproved modules should also enable the Tx laser | |
| 8586 | + /* Disable transmit for this module if the module is not approved, and | |
| 8587 | + * laser needs to be disabled. | |
| 8375 | 8588 | */ |
| 8376 | − if (rc == 0 || | |
| 8377 | − (val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) != | |
| 8378 | − PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) | |
| 8379 | − bnx2x_sfp_set_transmitter(params, phy, 1); | |
| 8380 | − else | |
| 8589 | + if ((rc) && | |
| 8590 | + ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == | |
| 8591 | + PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER)) | |
| 8381 | 8592 | bnx2x_sfp_set_transmitter(params, phy, 0); |
| 8382 | 8593 | |
| 8383 | 8594 | return rc; |
| @@ -8389,11 +8600,13 @@ void bnx2x_handle_module_detect_int(struct link_params *params) · 5 unmodified lines | ||
| 8389 | 8600 | struct bnx2x_phy *phy; |
| 8390 | 8601 | u32 gpio_val; |
| 8391 | 8602 | u8 gpio_num, gpio_port; |
| 8392 | − if (CHIP_IS_E3(bp)) | |
| 8603 | + if (CHIP_IS_E3(bp)) { | |
| 8393 | 8604 | phy = ¶ms->phy[INT_PHY]; |
| 8394 | − else | |
| 8605 | + /* Always enable TX laser,will be disabled in case of fault */ | |
| 8606 | + bnx2x_sfp_set_transmitter(params, phy, 1); | |
| 8607 | + } else { | |
| 8395 | 8608 | phy = ¶ms->phy[EXT_PHY1]; |
| 8396 | − | |
| 8609 | + } | |
| 8397 | 8610 | if (bnx2x_get_mod_abs_int_cfg(bp, params->chip_id, params->shmem_base, |
| 8398 | 8611 | params->port, &gpio_num, &gpio_port) == |
| 8399 | 8612 | -EINVAL) { |
| @@ -8409,7 +8622,7 @@ void bnx2x_handle_module_detect_int(struct link_params *params) · 9 unmodified lines | ||
| 8409 | 8622 | |
| 8410 | 8623 | /* Call the handling function in case module is detected */ |
| 8411 | 8624 | if (gpio_val == 0) { |
| 8412 | − bnx2x_set_mdio_clk(bp, params->chip_id, params->port); | |
| 8625 | + bnx2x_set_mdio_emac_per_phy(bp, params); | |
| 8413 | 8626 | bnx2x_set_aer_mmd(params, phy); |
| 8414 | 8627 | |
| 8415 | 8628 | bnx2x_power_sfp_module(params, phy, 1); |
| @@ -8438,10 +8651,6 @@ void bnx2x_handle_module_detect_int(struct link_params *params) · 22 unmodified lines | ||
| 8438 | 8651 | DP(NETIF_MSG_LINK, "SFP+ module is not initialized\n"); |
| 8439 | 8652 | } |
| 8440 | 8653 | } else { |
| 8441 | − u32 val = REG_RD(bp, params->shmem_base + | |
| 8442 | − offsetof(struct shmem_region, dev_info. | |
| 8443 | − port_feature_config[params->port]. | |
| 8444 | − config)); | |
| 8445 | 8654 | bnx2x_set_gpio_int(bp, gpio_num, |
| 8446 | 8655 | MISC_REGISTERS_GPIO_INT_OUTPUT_SET, |
| 8447 | 8656 | gpio_port); |
| @@ -8449,10 +8658,6 @@ void bnx2x_handle_module_detect_int(struct link_params *params) · 1 unmodified line | ||
| 8449 | 8658 | * Disable transmit for this module |
| 8450 | 8659 | */ |
| 8451 | 8660 | phy->media_type = ETH_PHY_NOT_PRESENT; |
| 8452 | − if (((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == | |
| 8453 | − PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) || | |
| 8454 | − CHIP_IS_E3(bp)) | |
| 8455 | − bnx2x_sfp_set_transmitter(params, phy, 0); | |
| 8456 | 8661 | } |
| 8457 | 8662 | } |
| 8458 | 8663 | |
| @@ -9192,6 +9397,7 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, · 733 unmodified lines | ||
| 9192 | 9397 | bnx2x_cl45_read(bp, phy, |
| 9193 | 9398 | MDIO_PMA_DEVAD, |
| 9194 | 9399 | MDIO_PMA_LASI_RXSTAT, &rx_alarm_status); |
| 9400 | + bnx2x_8727_power_module(params->bp, phy, 0); | |
| 9195 | 9401 | return 0; |
| 9196 | 9402 | } |
| 9197 | 9403 | } /* Over current check */ |
| @@ -9296,20 +9502,28 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, · 98 unmodified lines | ||
| 9296 | 9502 | struct bnx2x *bp, |
| 9297 | 9503 | u8 port) |
| 9298 | 9504 | { |
| 9299 | − u16 val, fw_ver1, fw_ver2, cnt; | |
| 9505 | + u16 val, fw_ver2, cnt, i; | |
| 9506 | + static struct bnx2x_reg_set reg_set[] = { | |
| 9507 | + {MDIO_PMA_DEVAD, 0xA819, 0x0014}, | |
| 9508 | + {MDIO_PMA_DEVAD, 0xA81A, 0xc200}, | |
| 9509 | + {MDIO_PMA_DEVAD, 0xA81B, 0x0000}, | |
| 9510 | + {MDIO_PMA_DEVAD, 0xA81C, 0x0300}, | |
| 9511 | + {MDIO_PMA_DEVAD, 0xA817, 0x0009} | |
| 9512 | + }; | |
| 9513 | + u16 fw_ver1; | |
| 9300 | 9514 | |
| 9301 | − if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | |
| 9515 | + if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || | |
| 9516 | + (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) { | |
| 9302 | 9517 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); |
| 9303 | 9518 | bnx2x_save_spirom_version(bp, port, fw_ver1 & 0xfff, |
| 9304 | 9519 | phy->ver_addr); |
| 9305 | 9520 | } else { |
| 9306 | 9521 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ |
| 9307 | 9522 | /* (1) set reg 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */ |
| 9308 | − bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA819, 0x0014); | |
| 9309 | − bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81A, 0xc200); | |
| 9310 | − bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81B, 0x0000); | |
| 9311 | − bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81C, 0x0300); | |
| 9312 | − bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA817, 0x0009); | |
| 9523 | + for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); | |
| 9524 | + i++) | |
| 9525 | + bnx2x_cl45_write(bp, phy, reg_set[i].devad, | |
| 9526 | + reg_set[i].reg, reg_set[i].val); | |
| 9313 | 9527 | |
| 9314 | 9528 | for (cnt = 0; cnt < 100; cnt++) { |
| 9315 | 9529 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818, &val); |
| @@ -9357,8 +9571,16 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, · 41 unmodified lines | ||
| 9357 | 9571 | static void bnx2x_848xx_set_led(struct bnx2x *bp, |
| 9358 | 9572 | struct bnx2x_phy *phy) |
| 9359 | 9573 | { |
| 9360 | − u16 val, offset; | |
| 9361 | − | |
| 9574 | + u16 val, offset, i; | |
| 9575 | + static struct bnx2x_reg_set reg_set[] = { | |
| 9576 | + {MDIO_PMA_DEVAD, MDIO_PMA_REG_8481_LED1_MASK, 0x0080}, | |
| 9577 | + {MDIO_PMA_DEVAD, MDIO_PMA_REG_8481_LED2_MASK, 0x0018}, | |
| 9578 | + {MDIO_PMA_DEVAD, MDIO_PMA_REG_8481_LED3_MASK, 0x0006}, | |
| 9579 | + {MDIO_PMA_DEVAD, MDIO_PMA_REG_8481_LED3_BLINK, 0x0000}, | |
| 9580 | + {MDIO_PMA_DEVAD, MDIO_PMA_REG_84823_CTL_SLOW_CLK_CNT_HIGH, | |
| 9581 | + MDIO_PMA_REG_84823_BLINK_RATE_VAL_15P9HZ}, | |
| 9582 | + {MDIO_AN_DEVAD, 0xFFFB, 0xFFFD} | |
| 9583 | + }; | |
| 9362 | 9584 | /* PHYC_CTL_LED_CTL */ |
| 9363 | 9585 | bnx2x_cl45_read(bp, phy, |
| 9364 | 9586 | MDIO_PMA_DEVAD, |
| @@ -9370,49 +9592,20 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp, · 5 unmodified lines | ||
| 9370 | 9592 | MDIO_PMA_DEVAD, |
| 9371 | 9593 | MDIO_PMA_REG_8481_LINK_SIGNAL, val); |
| 9372 | 9594 | |
| 9373 | − bnx2x_cl45_write(bp, phy, | |
| 9374 | − MDIO_PMA_DEVAD, | |
| 9375 | − MDIO_PMA_REG_8481_LED1_MASK, | |
| 9376 | − 0x80); | |
| 9377 | − | |
| 9378 | − bnx2x_cl45_write(bp, phy, | |
| 9379 | − MDIO_PMA_DEVAD, | |
| 9380 | − MDIO_PMA_REG_8481_LED2_MASK, | |
| 9381 | − 0x18); | |
| 9382 | − | |
| 9383 | − /* Select activity source by Tx and Rx, as suggested by PHY AE */ | |
| 9384 | − bnx2x_cl45_write(bp, phy, | |
| 9385 | − MDIO_PMA_DEVAD, | |
| 9386 | − MDIO_PMA_REG_8481_LED3_MASK, | |
| 9387 | − 0x0006); | |
| 9388 | − | |
| 9389 | − /* Select the closest activity blink rate to that in 10/100/1000 */ | |
| 9390 | − bnx2x_cl45_write(bp, phy, | |
| 9391 | − MDIO_PMA_DEVAD, | |
| 9392 | − MDIO_PMA_REG_8481_LED3_BLINK, | |
| 9393 | − 0); | |
| 9394 | − | |
| 9395 | − /* Configure the blink rate to ~15.9 Hz */ | |
| 9396 | − bnx2x_cl45_write(bp, phy, | |
| 9397 | − MDIO_PMA_DEVAD, | |
| 9398 | − MDIO_PMA_REG_84823_CTL_SLOW_CLK_CNT_HIGH, | |
| 9399 | − MDIO_PMA_REG_84823_BLINK_RATE_VAL_15P9HZ); | |
| 9595 | + for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++) | |
| 9596 | + bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | |
| 9597 | + reg_set[i].val); | |
| 9400 | 9598 | |
| 9401 | − if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) | |
| 9599 | + if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || | |
| 9600 | + (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) | |
| 9402 | 9601 | offset = MDIO_PMA_REG_84833_CTL_LED_CTL_1; |
| 9403 | 9602 | else |
| 9404 | 9603 | offset = MDIO_PMA_REG_84823_CTL_LED_CTL_1; |
| 9405 | 9604 | |
| 9406 | − bnx2x_cl45_read(bp, phy, | |
| 9407 | − MDIO_PMA_DEVAD, offset, &val); | |
| 9408 | − val |= MDIO_PMA_REG_84823_LED3_STRETCH_EN; /* stretch_en for LED3*/ | |
| 9409 | − bnx2x_cl45_write(bp, phy, | |
| 9410 | − MDIO_PMA_DEVAD, offset, val); | |
| 9411 | − | |
| 9412 | − /* 'Interrupt Mask' */ | |
| 9413 | − bnx2x_cl45_write(bp, phy, | |
| 9414 | − MDIO_AN_DEVAD, | |
| 9415 | − 0xFFFB, 0xFFFD); | |
| 9605 | + /* stretch_en for LED3*/ | |
| 9606 | + bnx2x_cl45_read_or_write(bp, phy, | |
| 9607 | + MDIO_PMA_DEVAD, offset, | |
| 9608 | + MDIO_PMA_REG_84823_LED3_STRETCH_EN); | |
| 9416 | 9609 | } |
| 9417 | 9610 | |
| 9418 | 9611 | static void bnx2x_848xx_specific_func(struct bnx2x_phy *phy, |
| @@ -9422,7 +9615,8 @@ static void bnx2x_848xx_specific_func(struct bnx2x_phy *phy, · 3 unmodified lines | ||
| 9422 | 9615 | struct bnx2x *bp = params->bp; |
| 9423 | 9616 | switch (action) { |
| 9424 | 9617 | case PHY_INIT: |
| 9425 | − if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | |
| 9618 | + if ((phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) && | |
| 9619 | + (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) { | |
| 9426 | 9620 | /* Save spirom version */ |
| 9427 | 9621 | bnx2x_save_848xx_spirom_version(phy, bp, params->port); |
| 9428 | 9622 | } |
| @@ -9443,7 +9637,7 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, · 14 unmodified lines | ||
| 9443 | 9637 | struct link_vars *vars) |
| 9444 | 9638 | { |
| 9445 | 9639 | struct bnx2x *bp = params->bp; |
| 9446 | − u16 autoneg_val, an_1000_val, an_10_100_val, an_10g_val; | |
| 9640 | + u16 autoneg_val, an_1000_val, an_10_100_val; | |
| 9447 | 9641 | |
| 9448 | 9642 | bnx2x_848xx_specific_func(phy, params, PHY_INIT); |
| 9449 | 9643 | bnx2x_cl45_write(bp, phy, |
| @@ -9542,11 +9736,12 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, · 92 unmodified lines | ||
| 9542 | 9736 | if (phy->req_duplex == DUPLEX_FULL) |
| 9543 | 9737 | autoneg_val |= (1<<8); |
| 9544 | 9738 | |
| 9545 | − /* Always write this if this is not 84833. | |
| 9546 | − * For 84833, write it only when it's a forced speed. | |
| 9739 | + /* Always write this if this is not 84833/4. | |
| 9740 | + * For 84833/4, write it only when it's a forced speed. | |
| 9547 | 9741 | */ |
| 9548 | − if ((phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || | |
| 9549 | − ((autoneg_val & (1<<12)) == 0)) | |
| 9742 | + if (((phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) && | |
| 9743 | + (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) || | |
| 9744 | + ((autoneg_val & (1<<12)) == 0)) | |
| 9550 | 9745 | bnx2x_cl45_write(bp, phy, |
| 9551 | 9746 | MDIO_AN_DEVAD, |
| 9552 | 9747 | MDIO_AN_REG_8481_LEGACY_MII_CTRL, autoneg_val); |
| @@ -9558,14 +9753,11 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, · 5 unmodified lines | ||
| 9558 | 9753 | DP(NETIF_MSG_LINK, "Advertising 10G\n"); |
| 9559 | 9754 | /* Restart autoneg for 10G*/ |
| 9560 | 9755 | |
| 9561 | − bnx2x_cl45_read(bp, phy, | |
| 9562 | − MDIO_AN_DEVAD, | |
| 9563 | − MDIO_AN_REG_8481_10GBASE_T_AN_CTRL, | |
| 9564 | − &an_10g_val); | |
| 9565 | − bnx2x_cl45_write(bp, phy, | |
| 9566 | − MDIO_AN_DEVAD, | |
| 9567 | − MDIO_AN_REG_8481_10GBASE_T_AN_CTRL, | |
| 9568 | − an_10g_val | 0x1000); | |
| 9756 | + bnx2x_cl45_read_or_write( | |
| 9757 | + bp, phy, | |
| 9758 | + MDIO_AN_DEVAD, | |
| 9759 | + MDIO_AN_REG_8481_10GBASE_T_AN_CTRL, | |
| 9760 | + 0x1000); | |
| 9569 | 9761 | bnx2x_cl45_write(bp, phy, |
| 9570 | 9762 | MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, |
| 9571 | 9763 | 0x3200); |
| @@ -9598,9 +9790,8 @@ static int bnx2x_8481_config_init(struct bnx2x_phy *phy, · 26 unmodified lines | ||
| 9598 | 9790 | #define PHY84833_CMDHDLR_WAIT 300 |
| 9599 | 9791 | #define PHY84833_CMDHDLR_MAX_ARGS 5 |
| 9600 | 9792 | static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy, |
| 9601 | − struct link_params *params, | |
| 9602 | − u16 fw_cmd, | |
| 9603 | − u16 cmd_args[], int argc) | |
| 9793 | + struct link_params *params, u16 fw_cmd, | |
| 9794 | + u16 cmd_args[], int argc) | |
| 9604 | 9795 | { |
| 9605 | 9796 | int idx; |
| 9606 | 9797 | u16 val; |
| @@ -9614,7 +9805,7 @@ static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy, · 7 unmodified lines | ||
| 9614 | 9805 | MDIO_84833_CMD_HDLR_STATUS, &val); |
| 9615 | 9806 | if (val == PHY84833_STATUS_CMD_OPEN_FOR_CMDS) |
| 9616 | 9807 | break; |
| 9617 | − usleep_range(1000, 2000); | |
| 9808 | + usleep_range(1000, 2000); | |
| 9618 | 9809 | } |
| 9619 | 9810 | if (idx >= PHY84833_CMDHDLR_WAIT) { |
| 9620 | 9811 | DP(NETIF_MSG_LINK, "FW cmd: FW not ready.\n"); |
| @@ -9635,7 +9826,7 @@ static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy, · 14 unmodified lines | ||
| 9635 | 9826 | if ((val == PHY84833_STATUS_CMD_COMPLETE_PASS) || |
| 9636 | 9827 | (val == PHY84833_STATUS_CMD_COMPLETE_ERROR)) |
| 9637 | 9828 | break; |
| 9638 | − usleep_range(1000, 2000); | |
| 9829 | + usleep_range(1000, 2000); | |
| 9639 | 9830 | } |
| 9640 | 9831 | if ((idx >= PHY84833_CMDHDLR_WAIT) || |
| 9641 | 9832 | (val == PHY84833_STATUS_CMD_COMPLETE_ERROR)) { |
| @@ -9654,7 +9845,6 @@ static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy, · 12 unmodified lines | ||
| 9654 | 9845 | return 0; |
| 9655 | 9846 | } |
| 9656 | 9847 | |
| 9657 | − | |
| 9658 | 9848 | static int bnx2x_84833_pair_swap_cfg(struct bnx2x_phy *phy, |
| 9659 | 9849 | struct link_params *params, |
| 9660 | 9850 | struct link_vars *vars) |
| @@ -9802,11 +9992,11 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 141 unmodified lines | ||
| 9802 | 9992 | struct bnx2x *bp = params->bp; |
| 9803 | 9993 | u8 port, initialize = 1; |
| 9804 | 9994 | u16 val; |
| 9805 | − u32 actual_phy_selection, cms_enable; | |
| 9995 | + u32 actual_phy_selection; | |
| 9806 | 9996 | u16 cmd_args[PHY84833_CMDHDLR_MAX_ARGS]; |
| 9807 | 9997 | int rc = 0; |
| 9808 | 9998 | |
| 9809 | − usleep_range(1000, 2000); | |
| 9999 | + usleep_range(1000, 2000); | |
| 9810 | 10000 | |
| 9811 | 10001 | if (!(CHIP_IS_E1x(bp))) |
| 9812 | 10002 | port = BP_PATH(bp); |
| @@ -9828,7 +10018,8 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 15 unmodified lines | ||
| 9828 | 10018 | |
| 9829 | 10019 | /* Wait for GPHY to come out of reset */ |
| 9830 | 10020 | msleep(50); |
| 9831 | − if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | |
| 10021 | + if ((phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) && | |
| 10022 | + (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) { | |
| 9832 | 10023 | /* BCM84823 requires that XGXS links up first @ 10G for normal |
| 9833 | 10024 | * behavior. |
| 9834 | 10025 | */ |
| @@ -9884,7 +10075,8 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 49 unmodified lines | ||
| 9884 | 10075 | DP(NETIF_MSG_LINK, "Multi_phy config = 0x%x, Media control = 0x%x\n", |
| 9885 | 10076 | params->multi_phy_config, val); |
| 9886 | 10077 | |
| 9887 | − if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | |
| 10078 | + if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || | |
| 10079 | + (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) { | |
| 9888 | 10080 | bnx2x_84833_pair_swap_cfg(phy, params, vars); |
| 9889 | 10081 | |
| 9890 | 10082 | /* Keep AutogrEEEn disabled. */ |
| @@ -9904,7 +10096,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 13 unmodified lines | ||
| 9904 | 10096 | bnx2x_save_848xx_spirom_version(phy, bp, params->port); |
| 9905 | 10097 | /* 84833 PHY has a better feature and doesn't need to support this. */ |
| 9906 | 10098 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823) { |
| 9907 | − cms_enable = REG_RD(bp, params->shmem_base + | |
| 10099 | + u32 cms_enable = REG_RD(bp, params->shmem_base + | |
| 9908 | 10100 | offsetof(struct shmem_region, |
| 9909 | 10101 | dev_info.port_hw_config[params->port].default_cfg)) & |
| 9910 | 10102 | PORT_HW_CFG_ENABLE_CMS_MASK; |
| @@ -9933,7 +10125,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 22 unmodified lines | ||
| 9933 | 10125 | return rc; |
| 9934 | 10126 | } |
| 9935 | 10127 | |
| 9936 | − if ((params->req_duplex[actual_phy_selection] == DUPLEX_FULL) && | |
| 10128 | + if ((phy->req_duplex == DUPLEX_FULL) && | |
| 9937 | 10129 | (params->eee_mode & EEE_MODE_ADV_LPI) && |
| 9938 | 10130 | (bnx2x_eee_calc_timer(params) || |
| 9939 | 10131 | !(params->eee_mode & EEE_MODE_ENABLE_LPI))) |
| @@ -9948,15 +10140,13 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 8 unmodified lines | ||
| 9948 | 10140 | vars->eee_status &= ~SHMEM_EEE_SUPPORTED_MASK; |
| 9949 | 10141 | } |
| 9950 | 10142 | |
| 9951 | − if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | |
| 10143 | + if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || | |
| 10144 | + (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) { | |
| 9952 | 10145 | /* Bring PHY out of super isolate mode as the final step. */ |
| 9953 | − bnx2x_cl45_read(bp, phy, | |
| 9954 | − MDIO_CTL_DEVAD, | |
| 9955 | − MDIO_84833_TOP_CFG_XGPHY_STRAP1, &val); | |
| 9956 | − val &= ~MDIO_84833_SUPER_ISOLATE; | |
| 9957 | − bnx2x_cl45_write(bp, phy, | |
| 9958 | − MDIO_CTL_DEVAD, | |
| 9959 | − MDIO_84833_TOP_CFG_XGPHY_STRAP1, val); | |
| 10146 | + bnx2x_cl45_read_and_write(bp, phy, | |
| 10147 | + MDIO_CTL_DEVAD, | |
| 10148 | + MDIO_84833_TOP_CFG_XGPHY_STRAP1, | |
| 10149 | + (u16)~MDIO_84833_SUPER_ISOLATE); | |
| 9960 | 10150 | } |
| 9961 | 10151 | return rc; |
| 9962 | 10152 | } |
| @@ -10090,7 +10280,6 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, · 127 unmodified lines | ||
| 10090 | 10280 | return link_up; |
| 10091 | 10281 | } |
| 10092 | 10282 | |
| 10093 | − | |
| 10094 | 10283 | static int bnx2x_848xx_format_ver(u32 raw_ver, u8 *str, u16 *len) |
| 10095 | 10284 | { |
| 10096 | 10285 | int status = 0; |
| @@ -10962,7 +11151,7 @@ static void bnx2x_7101_set_link_led(struct bnx2x_phy *phy, · 865 unmodified lines | ||
| 10962 | 11151 | /* STATIC PHY DECLARATION */ |
| 10963 | 11152 | /******************************************************************/ |
| 10964 | 11153 | |
| 10965 | −static struct bnx2x_phy phy_null = { | |
| 11154 | +static const struct bnx2x_phy phy_null = { | |
| 10966 | 11155 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN, |
| 10967 | 11156 | .addr = 0, |
| 10968 | 11157 | .def_md_devad = 0, |
| @@ -10988,7 +11177,7 @@ static struct bnx2x_phy phy_null = { · 19 unmodified lines | ||
| 10988 | 11177 | .phy_specific_func = (phy_specific_func_t)NULL |
| 10989 | 11178 | }; |
| 10990 | 11179 | |
| 10991 | −static struct bnx2x_phy phy_serdes = { | |
| 11180 | +static const struct bnx2x_phy phy_serdes = { | |
| 10992 | 11181 | .type = PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT, |
| 10993 | 11182 | .addr = 0xff, |
| 10994 | 11183 | .def_md_devad = 0, |
| @@ -11023,7 +11212,7 @@ static struct bnx2x_phy phy_serdes = { · 28 unmodified lines | ||
| 11023 | 11212 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11024 | 11213 | }; |
| 11025 | 11214 | |
| 11026 | −static struct bnx2x_phy phy_xgxs = { | |
| 11215 | +static const struct bnx2x_phy phy_xgxs = { | |
| 11027 | 11216 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, |
| 11028 | 11217 | .addr = 0xff, |
| 11029 | 11218 | .def_md_devad = 0, |
| @@ -11058,12 +11247,11 @@ static struct bnx2x_phy phy_xgxs = { · 28 unmodified lines | ||
| 11058 | 11247 | .set_link_led = (set_link_led_t)NULL, |
| 11059 | 11248 | .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func |
| 11060 | 11249 | }; |
| 11061 | −static struct bnx2x_phy phy_warpcore = { | |
| 11250 | +static const struct bnx2x_phy phy_warpcore = { | |
| 11062 | 11251 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, |
| 11063 | 11252 | .addr = 0xff, |
| 11064 | 11253 | .def_md_devad = 0, |
| 11065 | − .flags = (FLAGS_HW_LOCK_REQUIRED | | |
| 11066 | − FLAGS_TX_ERROR_CHECK), | |
| 11254 | + .flags = FLAGS_TX_ERROR_CHECK, | |
| 11067 | 11255 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 11068 | 11256 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 11069 | 11257 | .mdio_ctrl = 0, |
| @@ -11097,7 +11285,7 @@ static struct bnx2x_phy phy_warpcore = { · 27 unmodified lines | ||
| 11097 | 11285 | }; |
| 11098 | 11286 | |
| 11099 | 11287 | |
| 11100 | −static struct bnx2x_phy phy_7101 = { | |
| 11288 | +static const struct bnx2x_phy phy_7101 = { | |
| 11101 | 11289 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101, |
| 11102 | 11290 | .addr = 0xff, |
| 11103 | 11291 | .def_md_devad = 0, |
| @@ -11126,11 +11314,11 @@ static struct bnx2x_phy phy_7101 = { · 22 unmodified lines | ||
| 11126 | 11314 | .set_link_led = (set_link_led_t)bnx2x_7101_set_link_led, |
| 11127 | 11315 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11128 | 11316 | }; |
| 11129 | −static struct bnx2x_phy phy_8073 = { | |
| 11317 | +static const struct bnx2x_phy phy_8073 = { | |
| 11130 | 11318 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073, |
| 11131 | 11319 | .addr = 0xff, |
| 11132 | 11320 | .def_md_devad = 0, |
| 11133 | − .flags = FLAGS_HW_LOCK_REQUIRED, | |
| 11321 | + .flags = 0, | |
| 11134 | 11322 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 11135 | 11323 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 11136 | 11324 | .mdio_ctrl = 0, |
| @@ -11157,7 +11345,7 @@ static struct bnx2x_phy phy_8073 = { · 20 unmodified lines | ||
| 11157 | 11345 | .set_link_led = (set_link_led_t)NULL, |
| 11158 | 11346 | .phy_specific_func = (phy_specific_func_t)bnx2x_8073_specific_func |
| 11159 | 11347 | }; |
| 11160 | −static struct bnx2x_phy phy_8705 = { | |
| 11348 | +static const struct bnx2x_phy phy_8705 = { | |
| 11161 | 11349 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705, |
| 11162 | 11350 | .addr = 0xff, |
| 11163 | 11351 | .def_md_devad = 0, |
| @@ -11185,7 +11373,7 @@ static struct bnx2x_phy phy_8705 = { · 21 unmodified lines | ||
| 11185 | 11373 | .set_link_led = (set_link_led_t)NULL, |
| 11186 | 11374 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11187 | 11375 | }; |
| 11188 | −static struct bnx2x_phy phy_8706 = { | |
| 11376 | +static const struct bnx2x_phy phy_8706 = { | |
| 11189 | 11377 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706, |
| 11190 | 11378 | .addr = 0xff, |
| 11191 | 11379 | .def_md_devad = 0, |
| @@ -11215,12 +11403,11 @@ static struct bnx2x_phy phy_8706 = { · 23 unmodified lines | ||
| 11215 | 11403 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11216 | 11404 | }; |
| 11217 | 11405 | |
| 11218 | −static struct bnx2x_phy phy_8726 = { | |
| 11406 | +static const struct bnx2x_phy phy_8726 = { | |
| 11219 | 11407 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726, |
| 11220 | 11408 | .addr = 0xff, |
| 11221 | 11409 | .def_md_devad = 0, |
| 11222 | − .flags = (FLAGS_HW_LOCK_REQUIRED | | |
| 11223 | − FLAGS_INIT_XGXS_FIRST | | |
| 11410 | + .flags = (FLAGS_INIT_XGXS_FIRST | | |
| 11224 | 11411 | FLAGS_TX_ERROR_CHECK), |
| 11225 | 11412 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| 11226 | 11413 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, |
| @@ -11248,7 +11435,7 @@ static struct bnx2x_phy phy_8726 = { · 21 unmodified lines | ||
| 11248 | 11435 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11249 | 11436 | }; |
| 11250 | 11437 | |
| 11251 | −static struct bnx2x_phy phy_8727 = { | |
| 11438 | +static const struct bnx2x_phy phy_8727 = { | |
| 11252 | 11439 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727, |
| 11253 | 11440 | .addr = 0xff, |
| 11254 | 11441 | .def_md_devad = 0, |
| @@ -11278,7 +11465,7 @@ static struct bnx2x_phy phy_8727 = { · 23 unmodified lines | ||
| 11278 | 11465 | .set_link_led = (set_link_led_t)bnx2x_8727_set_link_led, |
| 11279 | 11466 | .phy_specific_func = (phy_specific_func_t)bnx2x_8727_specific_func |
| 11280 | 11467 | }; |
| 11281 | −static struct bnx2x_phy phy_8481 = { | |
| 11468 | +static const struct bnx2x_phy phy_8481 = { | |
| 11282 | 11469 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, |
| 11283 | 11470 | .addr = 0xff, |
| 11284 | 11471 | .def_md_devad = 0, |
| @@ -11314,7 +11501,7 @@ static struct bnx2x_phy phy_8481 = { · 29 unmodified lines | ||
| 11314 | 11501 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11315 | 11502 | }; |
| 11316 | 11503 | |
| 11317 | −static struct bnx2x_phy phy_84823 = { | |
| 11504 | +static const struct bnx2x_phy phy_84823 = { | |
| 11318 | 11505 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823, |
| 11319 | 11506 | .addr = 0xff, |
| 11320 | 11507 | .def_md_devad = 0, |
| @@ -11351,7 +11538,7 @@ static struct bnx2x_phy phy_84823 = { · 30 unmodified lines | ||
| 11351 | 11538 | .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func |
| 11352 | 11539 | }; |
| 11353 | 11540 | |
| 11354 | −static struct bnx2x_phy phy_84833 = { | |
| 11541 | +static const struct bnx2x_phy phy_84833 = { | |
| 11355 | 11542 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833, |
| 11356 | 11543 | .addr = 0xff, |
| 11357 | 11544 | .def_md_devad = 0, |
| @@ -11386,7 +11573,41 @@ static struct bnx2x_phy phy_84833 = { · 28 unmodified lines | ||
| 11386 | 11573 | .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func |
| 11387 | 11574 | }; |
| 11388 | 11575 | |
| 11389 | −static struct bnx2x_phy phy_54618se = { | |
| 11576 | +static const struct bnx2x_phy phy_84834 = { | |
| 11577 | + .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834, | |
| 11578 | + .addr = 0xff, | |
| 11579 | + .def_md_devad = 0, | |
| 11580 | + .flags = FLAGS_FAN_FAILURE_DET_REQ | | |
| 11581 | + FLAGS_REARM_LATCH_SIGNAL, | |
| 11582 | + .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | |
| 11583 | + .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | |
| 11584 | + .mdio_ctrl = 0, | |
| 11585 | + .supported = (SUPPORTED_100baseT_Half | | |
| 11586 | + SUPPORTED_100baseT_Full | | |
| 11587 | + SUPPORTED_1000baseT_Full | | |
| 11588 | + SUPPORTED_10000baseT_Full | | |
| 11589 | + SUPPORTED_TP | | |
| 11590 | + SUPPORTED_Autoneg | | |
| 11591 | + SUPPORTED_Pause | | |
| 11592 | + SUPPORTED_Asym_Pause), | |
| 11593 | + .media_type = ETH_PHY_BASE_T, | |
| 11594 | + .ver_addr = 0, | |
| 11595 | + .req_flow_ctrl = 0, | |
| 11596 | + .req_line_speed = 0, | |
| 11597 | + .speed_cap_mask = 0, | |
| 11598 | + .req_duplex = 0, | |
| 11599 | + .rsrv = 0, | |
| 11600 | + .config_init = (config_init_t)bnx2x_848x3_config_init, | |
| 11601 | + .read_status = (read_status_t)bnx2x_848xx_read_status, | |
| 11602 | + .link_reset = (link_reset_t)bnx2x_848x3_link_reset, | |
| 11603 | + .config_loopback = (config_loopback_t)NULL, | |
| 11604 | + .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, | |
| 11605 | + .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, | |
| 11606 | + .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, | |
| 11607 | + .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func | |
| 11608 | +}; | |
| 11609 | + | |
| 11610 | +static const struct bnx2x_phy phy_54618se = { | |
| 11390 | 11611 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE, |
| 11391 | 11612 | .addr = 0xff, |
| 11392 | 11613 | .def_md_devad = 0, |
| @@ -11564,9 +11785,11 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, · 171 unmodified lines | ||
| 11564 | 11785 | phy->media_type = ETH_PHY_KR; |
| 11565 | 11786 | phy->flags |= FLAGS_WC_DUAL_MODE; |
| 11566 | 11787 | phy->supported &= (SUPPORTED_20000baseKR2_Full | |
| 11788 | + SUPPORTED_Autoneg | | |
| 11567 | 11789 | SUPPORTED_FIBRE | |
| 11568 | 11790 | SUPPORTED_Pause | |
| 11569 | 11791 | SUPPORTED_Asym_Pause); |
| 11792 | + phy->flags &= ~FLAGS_TX_ERROR_CHECK; | |
| 11570 | 11793 | break; |
| 11571 | 11794 | default: |
| 11572 | 11795 | DP(NETIF_MSG_LINK, "Unknown WC interface type 0x%x\n", |
| @@ -11665,6 +11888,9 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp, · 92 unmodified lines | ||
| 11665 | 11888 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833: |
| 11666 | 11889 | *phy = phy_84833; |
| 11667 | 11890 | break; |
| 11891 | + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834: | |
| 11892 | + *phy = phy_84834; | |
| 11893 | + break; | |
| 11668 | 11894 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616: |
| 11669 | 11895 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE: |
| 11670 | 11896 | *phy = phy_54618se; |
| @@ -11721,9 +11947,10 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp, · 50 unmodified lines | ||
| 11721 | 11947 | } |
| 11722 | 11948 | phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, port); |
| 11723 | 11949 | |
| 11724 | − if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) && | |
| 11950 | + if (((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || | |
| 11951 | + (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834)) && | |
| 11725 | 11952 | (phy->ver_addr)) { |
| 11726 | − /* Remove 100Mb link supported for BCM84833 when phy fw | |
| 11953 | + /* Remove 100Mb link supported for BCM84833/4 when phy fw | |
| 11727 | 11954 | * version lower than or equal to 1.39 |
| 11728 | 11955 | */ |
| 11729 | 11956 | u32 raw_ver = REG_RD(bp, phy->ver_addr); |
| @@ -11733,12 +11960,6 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp, · 3 unmodified lines | ||
| 11733 | 11960 | SUPPORTED_100baseT_Full); |
| 11734 | 11961 | } |
| 11735 | 11962 | |
| 11736 | − /* In case mdc/mdio_access of the external phy is different than the | |
| 11737 | − * mdc/mdio access of the XGXS, a HW lock must be taken in each access | |
| 11738 | − * to prevent one port interfere with another port's CL45 operations. | |
| 11739 | − */ | |
| 11740 | − if (mdc_mdio_access != SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH) | |
| 11741 | − phy->flags |= FLAGS_HW_LOCK_REQUIRED; | |
| 11742 | 11963 | DP(NETIF_MSG_LINK, "phy_type 0x%x port %d found in index %d\n", |
| 11743 | 11964 | phy_type, port, phy_index); |
| 11744 | 11965 | DP(NETIF_MSG_LINK, " addr=0x%x, mdio_ctl=0x%x\n", |
| @@ -11863,7 +12084,6 @@ u32 bnx2x_phy_selection(struct link_params *params) · 118 unmodified lines | ||
| 11863 | 12084 | return return_cfg; |
| 11864 | 12085 | } |
| 11865 | 12086 | |
| 11866 | − | |
| 11867 | 12087 | int bnx2x_phy_probe(struct link_params *params) |
| 11868 | 12088 | { |
| 11869 | 12089 | u8 phy_index, actual_phy_idx; |
| @@ -11907,6 +12127,10 @@ int bnx2x_phy_probe(struct link_params *params) · 37 unmodified lines | ||
| 11907 | 12127 | FEATURE_CONFIG_DISABLE_REMOTE_FAULT_DET) |
| 11908 | 12128 | phy->flags &= ~FLAGS_TX_ERROR_CHECK; |
| 11909 | 12129 | |
| 12130 | + if (!(params->feature_config_flags & | |
| 12131 | + FEATURE_CONFIG_MT_SUPPORT)) | |
| 12132 | + phy->flags |= FLAGS_MDC_MDIO_WA_G; | |
| 12133 | + | |
| 11910 | 12134 | sync_offset = params->shmem_base + |
| 11911 | 12135 | offsetof(struct shmem_region, |
| 11912 | 12136 | dev_info.port_hw_config[params->port].media_type); |
| @@ -11934,8 +12158,8 @@ int bnx2x_phy_probe(struct link_params *params) · 21 unmodified lines | ||
| 11934 | 12158 | return 0; |
| 11935 | 12159 | } |
| 11936 | 12160 | |
| 11937 | −void bnx2x_init_bmac_loopback(struct link_params *params, | |
| 11938 | − struct link_vars *vars) | |
| 12161 | +static void bnx2x_init_bmac_loopback(struct link_params *params, | |
| 12162 | + struct link_vars *vars) | |
| 11939 | 12163 | { |
| 11940 | 12164 | struct bnx2x *bp = params->bp; |
| 11941 | 12165 | vars->link_up = 1; |
| @@ -11954,8 +12178,8 @@ void bnx2x_init_bmac_loopback(struct link_params *params, · 12 unmodified lines | ||
| 11954 | 12178 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); |
| 11955 | 12179 | } |
| 11956 | 12180 | |
| 11957 | −void bnx2x_init_emac_loopback(struct link_params *params, | |
| 11958 | − struct link_vars *vars) | |
| 12181 | +static void bnx2x_init_emac_loopback(struct link_params *params, | |
| 12182 | + struct link_vars *vars) | |
| 11959 | 12183 | { |
| 11960 | 12184 | struct bnx2x *bp = params->bp; |
| 11961 | 12185 | vars->link_up = 1; |
| @@ -11973,8 +12197,8 @@ void bnx2x_init_emac_loopback(struct link_params *params, · 11 unmodified lines | ||
| 11973 | 12197 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); |
| 11974 | 12198 | } |
| 11975 | 12199 | |
| 11976 | −void bnx2x_init_xmac_loopback(struct link_params *params, | |
| 11977 | − struct link_vars *vars) | |
| 12200 | +static void bnx2x_init_xmac_loopback(struct link_params *params, | |
| 12201 | + struct link_vars *vars) | |
| 11978 | 12202 | { |
| 11979 | 12203 | struct bnx2x *bp = params->bp; |
| 11980 | 12204 | vars->link_up = 1; |
| @@ -11999,8 +12223,8 @@ void bnx2x_init_xmac_loopback(struct link_params *params, · 18 unmodified lines | ||
| 11999 | 12223 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); |
| 12000 | 12224 | } |
| 12001 | 12225 | |
| 12002 | −void bnx2x_init_umac_loopback(struct link_params *params, | |
| 12003 | − struct link_vars *vars) | |
| 12226 | +static void bnx2x_init_umac_loopback(struct link_params *params, | |
| 12227 | + struct link_vars *vars) | |
| 12004 | 12228 | { |
| 12005 | 12229 | struct bnx2x *bp = params->bp; |
| 12006 | 12230 | vars->link_up = 1; |
| @@ -12014,17 +12238,21 @@ void bnx2x_init_umac_loopback(struct link_params *params, · 7 unmodified lines | ||
| 12014 | 12238 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); |
| 12015 | 12239 | } |
| 12016 | 12240 | |
| 12017 | −void bnx2x_init_xgxs_loopback(struct link_params *params, | |
| 12018 | − struct link_vars *vars) | |
| 12241 | +static void bnx2x_init_xgxs_loopback(struct link_params *params, | |
| 12242 | + struct link_vars *vars) | |
| 12019 | 12243 | { |
| 12020 | 12244 | struct bnx2x *bp = params->bp; |
| 12021 | − vars->link_up = 1; | |
| 12022 | − vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; | |
| 12023 | − vars->duplex = DUPLEX_FULL; | |
| 12245 | + struct bnx2x_phy *int_phy = ¶ms->phy[INT_PHY]; | |
| 12246 | + vars->link_up = 1; | |
| 12247 | + vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; | |
| 12248 | + vars->duplex = DUPLEX_FULL; | |
| 12024 | 12249 | if (params->req_line_speed[0] == SPEED_1000) |
| 12025 | − vars->line_speed = SPEED_1000; | |
| 12250 | + vars->line_speed = SPEED_1000; | |
| 12251 | + else if ((params->req_line_speed[0] == SPEED_20000) || | |
| 12252 | + (int_phy->flags & FLAGS_WC_DUAL_MODE)) | |
| 12253 | + vars->line_speed = SPEED_20000; | |
| 12026 | 12254 | else |
| 12027 | − vars->line_speed = SPEED_10000; | |
| 12255 | + vars->line_speed = SPEED_10000; | |
| 12028 | 12256 | |
| 12029 | 12257 | if (!USES_WARPCORE(bp)) |
| 12030 | 12258 | bnx2x_xgxs_deassert(params); |
| @@ -12044,34 +12272,30 @@ void bnx2x_init_xgxs_loopback(struct link_params *params, · 13 unmodified lines | ||
| 12044 | 12272 | bnx2x_bmac_enable(params, vars, 0, 1); |
| 12045 | 12273 | } |
| 12046 | 12274 | |
| 12047 | − if (params->loopback_mode == LOOPBACK_XGXS) { | |
| 12048 | − /* set 10G XGXS loopback */ | |
| 12049 | − params->phy[INT_PHY].config_loopback( | |
| 12050 | − ¶ms->phy[INT_PHY], | |
| 12051 | − params); | |
| 12052 | − | |
| 12053 | − } else { | |
| 12054 | − /* set external phy loopback */ | |
| 12055 | − u8 phy_index; | |
| 12056 | − for (phy_index = EXT_PHY1; | |
| 12057 | − phy_index < params->num_phys; phy_index++) { | |
| 12058 | − if (params->phy[phy_index].config_loopback) | |
| 12059 | − params->phy[phy_index].config_loopback( | |
| 12060 | − ¶ms->phy[phy_index], | |
| 12061 | − params); | |
| 12062 | − } | |
| 12063 | − } | |
| 12064 | − REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); | |
| 12275 | + if (params->loopback_mode == LOOPBACK_XGXS) { | |
| 12276 | + /* Set 10G XGXS loopback */ | |
| 12277 | + int_phy->config_loopback(int_phy, params); | |
| 12278 | + } else { | |
| 12279 | + /* Set external phy loopback */ | |
| 12280 | + u8 phy_index; | |
| 12281 | + for (phy_index = EXT_PHY1; | |
| 12282 | + phy_index < params->num_phys; phy_index++) | |
| 12283 | + if (params->phy[phy_index].config_loopback) | |
| 12284 | + params->phy[phy_index].config_loopback( | |
| 12285 | + ¶ms->phy[phy_index], | |
| 12286 | + params); | |
| 12287 | + } | |
| 12288 | + REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); | |
| 12065 | 12289 | |
| 12066 | 12290 | bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed); |
| 12067 | 12291 | } |
| 12068 | 12292 | |
| 12069 | −static void bnx2x_set_rx_filter(struct link_params *params, u8 en) | |
| 12293 | +void bnx2x_set_rx_filter(struct link_params *params, u8 en) | |
| 12070 | 12294 | { |
| 12071 | 12295 | struct bnx2x *bp = params->bp; |
| 12072 | 12296 | u8 val = en * 0x1F; |
| 12073 | 12297 | |
| 12074 | − /* Open the gate between the NIG to the BRB */ | |
| 12298 | + /* Open / close the gate between the NIG and the BRB */ | |
| 12075 | 12299 | if (!CHIP_IS_E1x(bp)) |
| 12076 | 12300 | val |= en * 0x20; |
| 12077 | 12301 | REG_WR(bp, NIG_REG_LLH0_BRB1_DRV_MASK + params->port*4, val); |
| @@ -12345,7 +12569,7 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars, · 267 unmodified lines | ||
| 12345 | 12569 | * Hold it as vars low |
| 12346 | 12570 | */ |
| 12347 | 12571 | /* Clear link led */ |
| 12348 | − bnx2x_set_mdio_clk(bp, params->chip_id, port); | |
| 12572 | + bnx2x_set_mdio_emac_per_phy(bp, params); | |
| 12349 | 12573 | bnx2x_set_led(params, vars, LED_MODE_OFF, 0); |
| 12350 | 12574 | |
| 12351 | 12575 | if (reset_ext_phy) { |
| @@ -12696,7 +12920,7 @@ static int bnx2x_8727_common_init_phy(struct bnx2x *bp, · 344 unmodified lines | ||
| 12696 | 12920 | /* Initiate PHY reset*/ |
| 12697 | 12921 | bnx2x_set_gpio(bp, reset_gpio, MISC_REGISTERS_GPIO_OUTPUT_LOW, |
| 12698 | 12922 | port); |
| 12699 | − usleep_range(1000, 2000); | |
| 12923 | + usleep_range(1000, 2000); | |
| 12700 | 12924 | bnx2x_set_gpio(bp, reset_gpio, MISC_REGISTERS_GPIO_OUTPUT_HIGH, |
| 12701 | 12925 | port); |
| 12702 | 12926 | |
| @@ -12784,7 +13008,8 @@ static int bnx2x_84833_common_init_phy(struct bnx2x *bp, · 81 unmodified lines | ||
| 12784 | 13008 | } |
| 12785 | 13009 | |
| 12786 | 13010 | static int bnx2x_84833_pre_init_phy(struct bnx2x *bp, |
| 12787 | − struct bnx2x_phy *phy) | |
| 13011 | + struct bnx2x_phy *phy, | |
| 13012 | + u8 port) | |
| 12788 | 13013 | { |
| 12789 | 13014 | u16 val, cnt; |
| 12790 | 13015 | /* Wait for FW completing its initialization. */ |
| @@ -12794,7 +13019,7 @@ static int bnx2x_84833_pre_init_phy(struct bnx2x *bp, · 3 unmodified lines | ||
| 12794 | 13019 | MDIO_PMA_REG_CTRL, &val); |
| 12795 | 13020 | if (!(val & (1<<15))) |
| 12796 | 13021 | break; |
| 12797 | − usleep_range(1000, 2000); | |
| 13022 | + usleep_range(1000, 2000); | |
| 12798 | 13023 | } |
| 12799 | 13024 | if (cnt >= 1500) { |
| 12800 | 13025 | DP(NETIF_MSG_LINK, "84833 reset timeout\n"); |
| @@ -12811,26 +13036,28 @@ static int bnx2x_84833_pre_init_phy(struct bnx2x *bp, · 10 unmodified lines | ||
| 12811 | 13036 | MDIO_84833_TOP_CFG_XGPHY_STRAP1, val); |
| 12812 | 13037 | |
| 12813 | 13038 | /* Save spirom version */ |
| 12814 | − bnx2x_save_848xx_spirom_version(phy, bp, PORT_0); | |
| 13039 | + bnx2x_save_848xx_spirom_version(phy, bp, port); | |
| 12815 | 13040 | return 0; |
| 12816 | 13041 | } |
| 12817 | 13042 | |
| 12818 | 13043 | int bnx2x_pre_init_phy(struct bnx2x *bp, |
| 12819 | 13044 | u32 shmem_base, |
| 12820 | 13045 | u32 shmem2_base, |
| 12821 | − u32 chip_id) | |
| 13046 | + u32 chip_id, | |
| 13047 | + u8 port) | |
| 12822 | 13048 | { |
| 12823 | 13049 | int rc = 0; |
| 12824 | 13050 | struct bnx2x_phy phy; |
| 12825 | − bnx2x_set_mdio_clk(bp, chip_id, PORT_0); | |
| 12826 | 13051 | if (bnx2x_populate_phy(bp, EXT_PHY1, shmem_base, shmem2_base, |
| 12827 | − PORT_0, &phy)) { | |
| 13052 | + port, &phy) != 0) { | |
| 12828 | 13053 | DP(NETIF_MSG_LINK, "populate_phy failed\n"); |
| 12829 | 13054 | return -EINVAL; |
| 12830 | 13055 | } |
| 13056 | + bnx2x_set_mdio_clk(bp, chip_id, phy.mdio_ctrl); | |
| 12831 | 13057 | switch (phy.type) { |
| 12832 | 13058 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833: |
| 12833 | − rc = bnx2x_84833_pre_init_phy(bp, &phy); | |
| 13059 | + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834: | |
| 13060 | + rc = bnx2x_84833_pre_init_phy(bp, &phy, port); | |
| 12834 | 13061 | break; |
| 12835 | 13062 | default: |
| 12836 | 13063 | break; |
| @@ -12867,6 +13094,7 @@ static int bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], · 30 unmodified lines | ||
| 12867 | 13094 | phy_index, chip_id); |
| 12868 | 13095 | break; |
| 12869 | 13096 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833: |
| 13097 | + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834: | |
| 12870 | 13098 | /* GPIO3's are linked, and so both need to be toggled |
| 12871 | 13099 | * to obtain required 2us pulse. |
| 12872 | 13100 | */ |
| @@ -12898,8 +13126,9 @@ int bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[], · 25 unmodified lines | ||
| 12898 | 13126 | u32 phy_ver, val; |
| 12899 | 13127 | u8 phy_index = 0; |
| 12900 | 13128 | u32 ext_phy_type, ext_phy_config; |
| 12901 | − bnx2x_set_mdio_clk(bp, chip_id, PORT_0); | |
| 12902 | − bnx2x_set_mdio_clk(bp, chip_id, PORT_1); | |
| 13129 | + | |
| 13130 | + bnx2x_set_mdio_clk(bp, chip_id, GRCBASE_EMAC0); | |
| 13131 | + bnx2x_set_mdio_clk(bp, chip_id, GRCBASE_EMAC1); | |
| 12903 | 13132 | DP(NETIF_MSG_LINK, "Begin common phy init\n"); |
| 12904 | 13133 | if (CHIP_IS_E3(bp)) { |
| 12905 | 13134 | /* Enable EPIO */ |
| @@ -12960,6 +13189,7 @@ static void bnx2x_check_over_curr(struct link_params *params, · 54 unmodified lines | ||
| 12960 | 13189 | " error.\n", |
| 12961 | 13190 | params->port); |
| 12962 | 13191 | vars->phy_flags |= PHY_OVER_CURRENT_FLAG; |
| 13192 | + bnx2x_warpcore_power_module(params, 0); | |
| 12963 | 13193 | } |
| 12964 | 13194 | } else |
| 12965 | 13195 | vars->phy_flags &= ~PHY_OVER_CURRENT_FLAG; |
| @@ -13139,6 +13369,108 @@ static void bnx2x_sfp_tx_fault_detection(struct bnx2x_phy *phy, · 173 unmodified lines | ||
| 13139 | 13369 | } |
| 13140 | 13370 | } |
| 13141 | 13371 | } |
| 13372 | +static void bnx2x_disable_kr2(struct link_params *params, | |
| 13373 | + struct link_vars *vars, | |
| 13374 | + struct bnx2x_phy *phy) | |
| 13375 | +{ | |
| 13376 | + struct bnx2x *bp = params->bp; | |
| 13377 | + int i; | |
| 13378 | + static struct bnx2x_reg_set reg_set[] = { | |
| 13379 | + /* Step 1 - Program the TX/RX alignment markers */ | |
| 13380 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690}, | |
| 13381 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647}, | |
| 13382 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0}, | |
| 13383 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690}, | |
| 13384 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647}, | |
| 13385 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0}, | |
| 13386 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c}, | |
| 13387 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000}, | |
| 13388 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000}, | |
| 13389 | + {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002}, | |
| 13390 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000}, | |
| 13391 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7}, | |
| 13392 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7}, | |
| 13393 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002}, | |
| 13394 | + {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000} | |
| 13395 | + }; | |
| 13396 | + DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n"); | |
| 13397 | + | |
| 13398 | + for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++) | |
| 13399 | + bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | |
| 13400 | + reg_set[i].val); | |
| 13401 | + vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | |
| 13402 | + bnx2x_update_link_attr(params, vars->link_attr_sync); | |
| 13403 | + | |
| 13404 | + /* Restart AN on leading lane */ | |
| 13405 | + bnx2x_warpcore_restart_AN_KR(phy, params); | |
| 13406 | +} | |
| 13407 | + | |
| 13408 | +static void bnx2x_kr2_recovery(struct link_params *params, | |
| 13409 | + struct link_vars *vars, | |
| 13410 | + struct bnx2x_phy *phy) | |
| 13411 | +{ | |
| 13412 | + struct bnx2x *bp = params->bp; | |
| 13413 | + DP(NETIF_MSG_LINK, "KR2 recovery\n"); | |
| 13414 | + bnx2x_warpcore_enable_AN_KR2(phy, params, vars); | |
| 13415 | + bnx2x_warpcore_restart_AN_KR(phy, params); | |
| 13416 | +} | |
| 13417 | + | |
| 13418 | +static void bnx2x_check_kr2_wa(struct link_params *params, | |
| 13419 | + struct link_vars *vars, | |
| 13420 | + struct bnx2x_phy *phy) | |
| 13421 | +{ | |
| 13422 | + struct bnx2x *bp = params->bp; | |
| 13423 | + u16 base_page, next_page, not_kr2_device, lane; | |
| 13424 | + int sigdet = bnx2x_warpcore_get_sigdet(phy, params); | |
| 13425 | + | |
| 13426 | + if (!sigdet) { | |
| 13427 | + if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) | |
| 13428 | + bnx2x_kr2_recovery(params, vars, phy); | |
| 13429 | + return; | |
| 13430 | + } | |
| 13431 | + | |
| 13432 | + lane = bnx2x_get_warpcore_lane(phy, params); | |
| 13433 | + CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | |
| 13434 | + MDIO_AER_BLOCK_AER_REG, lane); | |
| 13435 | + bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | |
| 13436 | + MDIO_AN_REG_LP_AUTO_NEG, &base_page); | |
| 13437 | + bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | |
| 13438 | + MDIO_AN_REG_LP_AUTO_NEG2, &next_page); | |
| 13439 | + bnx2x_set_aer_mmd(params, phy); | |
| 13440 | + | |
| 13441 | + /* CL73 has not begun yet */ | |
| 13442 | + if (base_page == 0) { | |
| 13443 | + if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) | |
| 13444 | + bnx2x_kr2_recovery(params, vars, phy); | |
| 13445 | + return; | |
| 13446 | + } | |
| 13447 | + | |
| 13448 | + /* In case NP bit is not set in the BasePage, or it is set, | |
| 13449 | + * but only KX is advertised, declare this link partner as non-KR2 | |
| 13450 | + * device. | |
| 13451 | + */ | |
| 13452 | + not_kr2_device = (((base_page & 0x8000) == 0) || | |
| 13453 | + (((base_page & 0x8000) && | |
| 13454 | + ((next_page & 0xe0) == 0x2)))); | |
| 13455 | + | |
| 13456 | + /* In case KR2 is already disabled, check if we need to re-enable it */ | |
| 13457 | + if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13458 | + if (!not_kr2_device) { | |
| 13459 | + DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, | |
| 13460 | + next_page); | |
| 13461 | + bnx2x_kr2_recovery(params, vars, phy); | |
| 13462 | + } | |
| 13463 | + return; | |
| 13464 | + } | |
| 13465 | + /* KR2 is enabled, but not KR2 device */ | |
| 13466 | + if (not_kr2_device) { | |
| 13467 | + /* Disable KR2 on both lanes */ | |
| 13468 | + DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page); | |
| 13469 | + bnx2x_disable_kr2(params, vars, phy); | |
| 13470 | + return; | |
| 13471 | + } | |
| 13472 | +} | |
| 13473 | + | |
| 13142 | 13474 | void bnx2x_period_func(struct link_params *params, struct link_vars *vars) |
| 13143 | 13475 | { |
| 13144 | 13476 | u16 phy_idx; |
| @@ -13156,6 +13488,9 @@ void bnx2x_period_func(struct link_params *params, struct link_vars *vars) · 11 unmodified lines | ||
| 13156 | 13488 | if (CHIP_IS_E3(bp)) { |
| 13157 | 13489 | struct bnx2x_phy *phy = ¶ms->phy[INT_PHY]; |
| 13158 | 13490 | bnx2x_set_aer_mmd(params, phy); |
| 13491 | + if ((phy->supported & SUPPORTED_20000baseKR2_Full) && | |
| 13492 | + (phy->speed_cap_mask & SPEED_20000)) | |
| 13493 | + bnx2x_check_kr2_wa(params, vars, phy); | |
| 13159 | 13494 | bnx2x_check_over_curr(params, vars); |
| 13160 | 13495 | if (vars->rx_tx_asic_rst) |
| 13161 | 13496 | bnx2x_warpcore_config_runtime(phy, params, vars); |
| @@ -13176,27 +13511,7 @@ void bnx2x_period_func(struct link_params *params, struct link_vars *vars) · 14 unmodified lines | ||
| 13176 | 13511 | bnx2x_update_mng(params, vars->link_status); |
| 13177 | 13512 | } |
| 13178 | 13513 | } |
| 13179 | − | |
| 13180 | − } | |
| 13181 | − | |
| 13182 | −} | |
| 13183 | − | |
| 13184 | −u8 bnx2x_hw_lock_required(struct bnx2x *bp, u32 shmem_base, u32 shmem2_base) | |
| 13185 | −{ | |
| 13186 | − u8 phy_index; | |
| 13187 | − struct bnx2x_phy phy; | |
| 13188 | − for (phy_index = INT_PHY; phy_index < MAX_PHYS; | |
| 13189 | − phy_index++) { | |
| 13190 | − if (bnx2x_populate_phy(bp, phy_index, shmem_base, shmem2_base, | |
| 13191 | − 0, &phy) != 0) { | |
| 13192 | − DP(NETIF_MSG_LINK, "populate phy failed\n"); | |
| 13193 | − return 0; | |
| 13194 | − } | |
| 13195 | − | |
| 13196 | − if (phy.flags & FLAGS_HW_LOCK_REQUIRED) | |
| 13197 | − return 1; | |
| 13198 | 13514 | } |
| 13199 | − return 0; | |
| 13200 | 13515 | } |
| 13201 | 13516 | |
| 13202 | 13517 | u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, |
| @@ -139,8 +139,6 @@ struct bnx2x_phy { · 138 unmodified lines | ||
| 139 | 139 | u8 addr; |
| 140 | 140 | u8 def_md_devad; |
| 141 | 141 | u16 flags; |
| 142 | − /* Require HW lock */ | |
| 143 | −#define FLAGS_HW_LOCK_REQUIRED (1<<0) | |
| 144 | 142 | /* No Over-Current detection */ |
| 145 | 143 | #define FLAGS_NOC (1<<1) |
| 146 | 144 | /* Fan failure detection required */ |
| @@ -156,6 +154,7 @@ struct bnx2x_phy { · 9 unmodified lines | ||
| 156 | 154 | #define FLAGS_MDC_MDIO_WA_B0 (1<<10) |
| 157 | 155 | #define FLAGS_TX_ERROR_CHECK (1<<12) |
| 158 | 156 | #define FLAGS_EEE (1<<13) |
| 157 | +#define FLAGS_MDC_MDIO_WA_G (1<<15) | |
| 159 | 158 | |
| 160 | 159 | /* preemphasis values for the rx side */ |
| 161 | 160 | u16 rx_preemphasis[4]; |
| @@ -267,6 +266,9 @@ struct link_params { · 105 unmodified lines | ||
| 267 | 266 | #define FEATURE_CONFIG_AUTOGREEEN_ENABLED (1<<9) |
| 268 | 267 | #define FEATURE_CONFIG_BC_SUPPORTS_SFP_TX_DISABLED (1<<10) |
| 269 | 268 | #define FEATURE_CONFIG_DISABLE_REMOTE_FAULT_DET (1<<11) |
| 269 | +#define FEATURE_CONFIG_MT_SUPPORT (1<<13) | |
| 270 | +#define FEATURE_CONFIG_BOOT_FROM_SAN (1<<14) | |
| 271 | + | |
| 270 | 272 | /* Will be populated during common init */ |
| 271 | 273 | struct bnx2x_phy phy[MAX_PHYS]; |
| 272 | 274 | |
| @@ -347,6 +349,8 @@ struct link_vars { · 74 unmodified lines | ||
| 347 | 349 | u8 rx_tx_asic_rst; |
| 348 | 350 | u8 turn_to_run_wc_rt; |
| 349 | 351 | u16 rsrv2; |
| 352 | + /* The same definitions as the shmem2 parameter */ | |
| 353 | + u32 link_attr_sync; | |
| 350 | 354 | }; |
| 351 | 355 | |
| 352 | 356 | /***********************************************************/ |
| @@ -418,10 +422,6 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 65 unmodified lines | ||
| 418 | 422 | |
| 419 | 423 | void bnx2x_hw_reset_phy(struct link_params *params); |
| 420 | 424 | |
| 421 | −/* Checks if HW lock is required for this phy/board type */ | |
| 422 | −u8 bnx2x_hw_lock_required(struct bnx2x *bp, u32 shmem_base, | |
| 423 | − u32 shmem2_base); | |
| 424 | − | |
| 425 | 425 | /* Check swap bit and adjust PHY order */ |
| 426 | 426 | u32 bnx2x_phy_selection(struct link_params *params); |
| 427 | 427 | |
| @@ -432,7 +432,8 @@ int bnx2x_phy_probe(struct link_params *params); · 4 unmodified lines | ||
| 432 | 432 | u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, u32 shmem_base, |
| 433 | 433 | u32 shmem2_base, u8 port); |
| 434 | 434 | |
| 435 | − | |
| 435 | +/* Open / close the gate between the NIG and the BRB */ | |
| 436 | +void bnx2x_set_rx_filter(struct link_params *params, u8 en); | |
| 436 | 437 | |
| 437 | 438 | /* DCBX structs */ |
| 438 | 439 | |
| @@ -459,9 +460,6 @@ struct bnx2x_nig_brb_pfc_port_params { · 20 unmodified lines | ||
| 459 | 460 | u32 rx_cos_priority_mask[DCBX_MAX_NUM_COS]; |
| 460 | 461 | u32 llfc_high_priority_classes; |
| 461 | 462 | u32 llfc_low_priority_classes; |
| 462 | − /* BRB */ | |
| 463 | − u32 cos0_pauseable; | |
| 464 | − u32 cos1_pauseable; | |
| 465 | 463 | }; |
| 466 | 464 | |
| 467 | 465 | |
| @@ -79,7 +79,7 @@ · 78 unmodified lines | ||
| 79 | 79 | /* Time in jiffies before concluding the transmitter is hung */ |
| 80 | 80 | #define TX_TIMEOUT (5*HZ) |
| 81 | 81 | |
| 82 | −static char version[] __devinitdata = | |
| 82 | +static char version[] = | |
| 83 | 83 | "Broadcom NetXtreme II 5771x/578xx 10/20-Gigabit Ethernet Driver " |
| 84 | 84 | DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
| 85 | 85 | |
| @@ -149,7 +149,7 @@ enum bnx2x_board_type { · 63 unmodified lines | ||
| 149 | 149 | /* indexed by board_type, above */ |
| 150 | 150 | static struct { |
| 151 | 151 | char *name; |
| 152 | −} board_info[] __devinitdata = { | |
| 152 | +} board_info[] = { | |
| 153 | 153 | { "Broadcom NetXtreme II BCM57710 10 Gigabit PCIe [Everest]" }, |
| 154 | 154 | { "Broadcom NetXtreme II BCM57711 10 Gigabit PCIe" }, |
| 155 | 155 | { "Broadcom NetXtreme II BCM57711E 10 Gigabit PCIe" }, |
| @@ -791,10 +791,9 @@ void bnx2x_panic_dump(struct bnx2x *bp) · 635 unmodified lines | ||
| 791 | 791 | |
| 792 | 792 | /* host sb data */ |
| 793 | 793 | |
| 794 | −#ifdef BCM_CNIC | |
| 795 | 794 | if (IS_FCOE_FP(fp)) |
| 796 | 795 | continue; |
| 797 | −#endif | |
| 796 | + | |
| 798 | 797 | BNX2X_ERR(" run indexes ("); |
| 799 | 798 | for (j = 0; j < HC_SB_MAX_SM; j++) |
| 800 | 799 | pr_cont("0x%x%s", |
| @@ -859,7 +858,7 @@ void bnx2x_panic_dump(struct bnx2x *bp) · 58 unmodified lines | ||
| 859 | 858 | #ifdef BNX2X_STOP_ON_ERROR |
| 860 | 859 | /* Rings */ |
| 861 | 860 | /* Rx */ |
| 862 | − for_each_rx_queue(bp, i) { | |
| 861 | + for_each_valid_rx_queue(bp, i) { | |
| 863 | 862 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
| 864 | 863 | |
| 865 | 864 | start = RX_BD(le16_to_cpu(*fp->rx_cons_sb) - 10); |
| @@ -893,7 +892,7 @@ void bnx2x_panic_dump(struct bnx2x *bp) · 27 unmodified lines | ||
| 893 | 892 | } |
| 894 | 893 | |
| 895 | 894 | /* Tx */ |
| 896 | − for_each_tx_queue(bp, i) { | |
| 895 | + for_each_valid_tx_queue(bp, i) { | |
| 897 | 896 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
| 898 | 897 | for_each_cos_in_tx_queue(fp, cos) { |
| 899 | 898 | struct bnx2x_fp_txdata *txdata = fp->txdata_ptr[cos]; |
| @@ -1483,7 +1482,7 @@ static void bnx2x_igu_int_disable(struct bnx2x *bp) · 583 unmodified lines | ||
| 1483 | 1482 | BNX2X_ERR("BUG! proper val not read from IGU!\n"); |
| 1484 | 1483 | } |
| 1485 | 1484 | |
| 1486 | −void bnx2x_int_disable(struct bnx2x *bp) | |
| 1485 | +static void bnx2x_int_disable(struct bnx2x *bp) | |
| 1487 | 1486 | { |
| 1488 | 1487 | if (bp->common.int_block == INT_BLOCK_HC) |
| 1489 | 1488 | bnx2x_hc_int_disable(bp); |
| @@ -1504,9 +1503,8 @@ void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw) · 14 unmodified lines | ||
| 1504 | 1503 | if (msix) { |
| 1505 | 1504 | synchronize_irq(bp->msix_table[0].vector); |
| 1506 | 1505 | offset = 1; |
| 1507 | −#ifdef BCM_CNIC | |
| 1508 | − offset++; | |
| 1509 | −#endif | |
| 1506 | + if (CNIC_SUPPORT(bp)) | |
| 1507 | + offset++; | |
| 1510 | 1508 | for_each_eth_queue(bp, i) |
| 1511 | 1509 | synchronize_irq(bp->msix_table[offset++].vector); |
| 1512 | 1510 | } else |
| @@ -1588,9 +1586,8 @@ static bool bnx2x_trylock_leader_lock(struct bnx2x *bp) · 75 unmodified lines | ||
| 1588 | 1586 | return bnx2x_trylock_hw_lock(bp, bnx2x_get_leader_lock_resource(bp)); |
| 1589 | 1587 | } |
| 1590 | 1588 | |
| 1591 | −#ifdef BCM_CNIC | |
| 1592 | 1589 | static void bnx2x_cnic_cfc_comp(struct bnx2x *bp, int cid, u8 err); |
| 1593 | −#endif | |
| 1590 | + | |
| 1594 | 1591 | |
| 1595 | 1592 | void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe) |
| 1596 | 1593 | { |
| @@ -1720,7 +1717,7 @@ irqreturn_t bnx2x_interrupt(int irq, void *dev_instance) · 123 unmodified lines | ||
| 1720 | 1717 | for_each_eth_queue(bp, i) { |
| 1721 | 1718 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
| 1722 | 1719 | |
| 1723 | − mask = 0x2 << (fp->index + CNIC_PRESENT); | |
| 1720 | + mask = 0x2 << (fp->index + CNIC_SUPPORT(bp)); | |
| 1724 | 1721 | if (status & mask) { |
| 1725 | 1722 | /* Handle Rx or Tx according to SB id */ |
| 1726 | 1723 | prefetch(fp->rx_cons_sb); |
| @@ -1732,22 +1729,23 @@ irqreturn_t bnx2x_interrupt(int irq, void *dev_instance) · 5 unmodified lines | ||
| 1732 | 1729 | } |
| 1733 | 1730 | } |
| 1734 | 1731 | |
| 1735 | −#ifdef BCM_CNIC | |
| 1736 | − mask = 0x2; | |
| 1737 | − if (status & (mask | 0x1)) { | |
| 1738 | − struct cnic_ops *c_ops = NULL; | |
| 1732 | + if (CNIC_SUPPORT(bp)) { | |
| 1733 | + mask = 0x2; | |
| 1734 | + if (status & (mask | 0x1)) { | |
| 1735 | + struct cnic_ops *c_ops = NULL; | |
| 1739 | 1736 | |
| 1740 | − if (likely(bp->state == BNX2X_STATE_OPEN)) { | |
| 1741 | − rcu_read_lock(); | |
| 1742 | − c_ops = rcu_dereference(bp->cnic_ops); | |
| 1743 | − if (c_ops) | |
| 1744 | − c_ops->cnic_handler(bp->cnic_data, NULL); | |
| 1745 | − rcu_read_unlock(); | |
| 1746 | − } | |
| 1737 | + if (likely(bp->state == BNX2X_STATE_OPEN)) { | |
| 1738 | + rcu_read_lock(); | |
| 1739 | + c_ops = rcu_dereference(bp->cnic_ops); | |
| 1740 | + if (c_ops) | |
| 1741 | + c_ops->cnic_handler(bp->cnic_data, | |
| 1742 | + NULL); | |
| 1743 | + rcu_read_unlock(); | |
| 1744 | + } | |
| 1747 | 1745 | |
| 1748 | − status &= ~mask; | |
| 1746 | + status &= ~mask; | |
| 1747 | + } | |
| 1749 | 1748 | } |
| 1750 | −#endif | |
| 1751 | 1749 | |
| 1752 | 1750 | if (unlikely(status & 0x1)) { |
| 1753 | 1751 | queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); |
| @@ -2034,40 +2032,39 @@ int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port) · 280 unmodified lines | ||
| 2034 | 2032 | return 0; |
| 2035 | 2033 | } |
| 2036 | 2034 | |
| 2037 | −static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode) | |
| 2035 | +static int bnx2x_set_spio(struct bnx2x *bp, int spio, u32 mode) | |
| 2038 | 2036 | { |
| 2039 | − u32 spio_mask = (1 << spio_num); | |
| 2040 | 2037 | u32 spio_reg; |
| 2041 | 2038 | |
| 2042 | − if ((spio_num < MISC_REGISTERS_SPIO_4) || | |
| 2043 | − (spio_num > MISC_REGISTERS_SPIO_7)) { | |
| 2044 | − BNX2X_ERR("Invalid SPIO %d\n", spio_num); | |
| 2039 | + /* Only 2 SPIOs are configurable */ | |
| 2040 | + if ((spio != MISC_SPIO_SPIO4) && (spio != MISC_SPIO_SPIO5)) { | |
| 2041 | + BNX2X_ERR("Invalid SPIO 0x%x\n", spio); | |
| 2045 | 2042 | return -EINVAL; |
| 2046 | 2043 | } |
| 2047 | 2044 | |
| 2048 | 2045 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_SPIO); |
| 2049 | 2046 | /* read SPIO and mask except the float bits */ |
| 2050 | − spio_reg = (REG_RD(bp, MISC_REG_SPIO) & MISC_REGISTERS_SPIO_FLOAT); | |
| 2047 | + spio_reg = (REG_RD(bp, MISC_REG_SPIO) & MISC_SPIO_FLOAT); | |
| 2051 | 2048 | |
| 2052 | 2049 | switch (mode) { |
| 2053 | − case MISC_REGISTERS_SPIO_OUTPUT_LOW: | |
| 2054 | − DP(NETIF_MSG_HW, "Set SPIO %d -> output low\n", spio_num); | |
| 2050 | + case MISC_SPIO_OUTPUT_LOW: | |
| 2051 | + DP(NETIF_MSG_HW, "Set SPIO 0x%x -> output low\n", spio); | |
| 2055 | 2052 | /* clear FLOAT and set CLR */ |
| 2056 | − spio_reg &= ~(spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS); | |
| 2057 | − spio_reg |= (spio_mask << MISC_REGISTERS_SPIO_CLR_POS); | |
| 2053 | + spio_reg &= ~(spio << MISC_SPIO_FLOAT_POS); | |
| 2054 | + spio_reg |= (spio << MISC_SPIO_CLR_POS); | |
| 2058 | 2055 | break; |
| 2059 | 2056 | |
| 2060 | − case MISC_REGISTERS_SPIO_OUTPUT_HIGH: | |
| 2061 | − DP(NETIF_MSG_HW, "Set SPIO %d -> output high\n", spio_num); | |
| 2057 | + case MISC_SPIO_OUTPUT_HIGH: | |
| 2058 | + DP(NETIF_MSG_HW, "Set SPIO 0x%x -> output high\n", spio); | |
| 2062 | 2059 | /* clear FLOAT and set SET */ |
| 2063 | − spio_reg &= ~(spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS); | |
| 2064 | − spio_reg |= (spio_mask << MISC_REGISTERS_SPIO_SET_POS); | |
| 2060 | + spio_reg &= ~(spio << MISC_SPIO_FLOAT_POS); | |
| 2061 | + spio_reg |= (spio << MISC_SPIO_SET_POS); | |
| 2065 | 2062 | break; |
| 2066 | 2063 | |
| 2067 | − case MISC_REGISTERS_SPIO_INPUT_HI_Z: | |
| 2068 | − DP(NETIF_MSG_HW, "Set SPIO %d -> input\n", spio_num); | |
| 2064 | + case MISC_SPIO_INPUT_HI_Z: | |
| 2065 | + DP(NETIF_MSG_HW, "Set SPIO 0x%x -> input\n", spio); | |
| 2069 | 2066 | /* set FLOAT */ |
| 2070 | − spio_reg |= (spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS); | |
| 2067 | + spio_reg |= (spio << MISC_SPIO_FLOAT_POS); | |
| 2071 | 2068 | break; |
| 2072 | 2069 | |
| 2073 | 2070 | default: |
| @@ -2106,22 +2103,25 @@ void bnx2x_calc_fc_adv(struct bnx2x *bp) · 32 unmodified lines | ||
| 2106 | 2103 | } |
| 2107 | 2104 | } |
| 2108 | 2105 | |
| 2109 | −u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode) | |
| 2106 | +static void bnx2x_set_requested_fc(struct bnx2x *bp) | |
| 2110 | 2107 | { |
| 2111 | − if (!BP_NOMCP(bp)) { | |
| 2112 | − u8 rc; | |
| 2113 | − int cfx_idx = bnx2x_get_link_cfg_idx(bp); | |
| 2114 | − u16 req_line_speed = bp->link_params.req_line_speed[cfx_idx]; | |
| 2115 | − /* | |
| 2116 | − * Initialize link parameters structure variables | |
| 2117 | − * It is recommended to turn off RX FC for jumbo frames | |
| 2118 | − * for better performance | |
| 2119 | − */ | |
| 2120 | − if (CHIP_IS_E1x(bp) && (bp->dev->mtu > 5000)) | |
| 2121 | − bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_TX; | |
| 2122 | − else | |
| 2123 | − bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH; | |
| 2108 | + /* Initialize link parameters structure variables | |
| 2109 | + * It is recommended to turn off RX FC for jumbo frames | |
| 2110 | + * for better performance | |
| 2111 | + */ | |
| 2112 | + if (CHIP_IS_E1x(bp) && (bp->dev->mtu > 5000)) | |
| 2113 | + bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_TX; | |
| 2114 | + else | |
| 2115 | + bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH; | |
| 2116 | +} | |
| 2124 | 2117 | |
| 2118 | +int bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode) | |
| 2119 | +{ | |
| 2120 | + int rc, cfx_idx = bnx2x_get_link_cfg_idx(bp); | |
| 2121 | + u16 req_line_speed = bp->link_params.req_line_speed[cfx_idx]; | |
| 2122 | + | |
| 2123 | + if (!BP_NOMCP(bp)) { | |
| 2124 | + bnx2x_set_requested_fc(bp); | |
| 2125 | 2125 | bnx2x_acquire_phy_lock(bp); |
| 2126 | 2126 | |
| 2127 | 2127 | if (load_mode == LOAD_DIAG) { |
| @@ -2150,11 +2150,11 @@ u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode) · 22 unmodified lines | ||
| 2150 | 2150 | |
| 2151 | 2151 | bnx2x_calc_fc_adv(bp); |
| 2152 | 2152 | |
| 2153 | − if (CHIP_REV_IS_SLOW(bp) && bp->link_vars.link_up) { | |
| 2153 | + if (bp->link_vars.link_up) { | |
| 2154 | 2154 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); |
| 2155 | 2155 | bnx2x_link_report(bp); |
| 2156 | − } else | |
| 2157 | − queue_delayed_work(bnx2x_wq, &bp->period_task, 0); | |
| 2156 | + } | |
| 2157 | + queue_delayed_work(bnx2x_wq, &bp->period_task, 0); | |
| 2158 | 2158 | bp->link_params.req_line_speed[cfx_idx] = req_line_speed; |
| 2159 | 2159 | return rc; |
| 2160 | 2160 | } |
| @@ -3075,11 +3075,13 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) · 914 unmodified lines | ||
| 3075 | 3075 | |
| 3076 | 3076 | static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp) |
| 3077 | 3077 | { |
| 3078 | −#ifdef BCM_CNIC | |
| 3079 | 3078 | struct bnx2x_dcbx_app_params *app = &bp->dcbx_port_params.app; |
| 3080 | 3079 | struct fcoe_stats_info *fcoe_stat = |
| 3081 | 3080 | &bp->slowpath->drv_info_to_mcp.fcoe_stat; |
| 3082 | 3081 | |
| 3082 | + if (!CNIC_LOADED(bp)) | |
| 3083 | + return; | |
| 3084 | + | |
| 3083 | 3085 | memcpy(fcoe_stat->mac_local + MAC_LEADING_ZERO_CNT, |
| 3084 | 3086 | bp->fip_mac, ETH_ALEN); |
| 3085 | 3087 | |
| @@ -3162,16 +3164,17 @@ static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp) · 76 unmodified lines | ||
| 3162 | 3164 | |
| 3163 | 3165 | /* ask L5 driver to add data to the struct */ |
| 3164 | 3166 | bnx2x_cnic_notify(bp, CNIC_CTL_FCOE_STATS_GET_CMD); |
| 3165 | −#endif | |
| 3166 | 3167 | } |
| 3167 | 3168 | |
| 3168 | 3169 | static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp) |
| 3169 | 3170 | { |
| 3170 | −#ifdef BCM_CNIC | |
| 3171 | 3171 | struct bnx2x_dcbx_app_params *app = &bp->dcbx_port_params.app; |
| 3172 | 3172 | struct iscsi_stats_info *iscsi_stat = |
| 3173 | 3173 | &bp->slowpath->drv_info_to_mcp.iscsi_stat; |
| 3174 | 3174 | |
| 3175 | + if (!CNIC_LOADED(bp)) | |
| 3176 | + return; | |
| 3177 | + | |
| 3175 | 3178 | memcpy(iscsi_stat->mac_local + MAC_LEADING_ZERO_CNT, |
| 3176 | 3179 | bp->cnic_eth_dev.iscsi_mac, ETH_ALEN); |
| 3177 | 3180 | |
| @@ -3180,7 +3183,6 @@ static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp) · 2 unmodified lines | ||
| 3180 | 3183 | |
| 3181 | 3184 | /* ask L5 driver to add data to the struct */ |
| 3182 | 3185 | bnx2x_cnic_notify(bp, CNIC_CTL_ISCSI_STATS_GET_CMD); |
| 3183 | −#endif | |
| 3184 | 3186 | } |
| 3185 | 3187 | |
| 3186 | 3188 | /* called due to MCP event (on pmf): |
| @@ -3589,6 +3591,21 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted) · 402 unmodified lines | ||
| 3589 | 3591 | |
| 3590 | 3592 | /* now set back the mask */ |
| 3591 | 3593 | if (asserted & ATTN_NIG_FOR_FUNC) { |
| 3594 | + /* Verify that IGU ack through BAR was written before restoring | |
| 3595 | + * NIG mask. This loop should exit after 2-3 iterations max. | |
| 3596 | + */ | |
| 3597 | + if (bp->common.int_block != INT_BLOCK_HC) { | |
| 3598 | + u32 cnt = 0, igu_acked; | |
| 3599 | + do { | |
| 3600 | + igu_acked = REG_RD(bp, | |
| 3601 | + IGU_REG_ATTENTION_ACK_BITS); | |
| 3602 | + } while (((igu_acked & ATTN_NIG_FOR_FUNC) == 0) && | |
| 3603 | + (++cnt < MAX_IGU_ATTN_ACK_TO)); | |
| 3604 | + if (!igu_acked) | |
| 3605 | + DP(NETIF_MSG_HW, | |
| 3606 | + "Failed to verify IGU ack on time\n"); | |
| 3607 | + barrier(); | |
| 3608 | + } | |
| 3592 | 3609 | REG_WR(bp, nig_int_mask_addr, nig_mask); |
| 3593 | 3610 | bnx2x_release_phy_lock(bp); |
| 3594 | 3611 | } |
| @@ -4572,7 +4589,6 @@ static void bnx2x_update_eq_prod(struct bnx2x *bp, u16 prod) · 977 unmodified lines | ||
| 4572 | 4589 | mmiowb(); /* keep prod updates ordered */ |
| 4573 | 4590 | } |
| 4574 | 4591 | |
| 4575 | −#ifdef BCM_CNIC | |
| 4576 | 4592 | static int bnx2x_cnic_handle_cfc_del(struct bnx2x *bp, u32 cid, |
| 4577 | 4593 | union event_ring_elem *elem) |
| 4578 | 4594 | { |
| @@ -4594,7 +4610,6 @@ static int bnx2x_cnic_handle_cfc_del(struct bnx2x *bp, u32 cid, · 15 unmodified lines | ||
| 4594 | 4610 | bnx2x_cnic_cfc_comp(bp, cid, err); |
| 4595 | 4611 | return 0; |
| 4596 | 4612 | } |
| 4597 | −#endif | |
| 4598 | 4613 | |
| 4599 | 4614 | static void bnx2x_handle_mcast_eqe(struct bnx2x *bp) |
| 4600 | 4615 | { |
| @@ -4635,11 +4650,9 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp, · 34 unmodified lines | ||
| 4635 | 4650 | switch (elem->message.data.eth_event.echo >> BNX2X_SWCID_SHIFT) { |
| 4636 | 4651 | case BNX2X_FILTER_MAC_PENDING: |
| 4637 | 4652 | DP(BNX2X_MSG_SP, "Got SETUP_MAC completions\n"); |
| 4638 | −#ifdef BCM_CNIC | |
| 4639 | − if (cid == BNX2X_ISCSI_ETH_CID(bp)) | |
| 4653 | + if (CNIC_LOADED(bp) && (cid == BNX2X_ISCSI_ETH_CID(bp))) | |
| 4640 | 4654 | vlan_mac_obj = &bp->iscsi_l2_mac_obj; |
| 4641 | 4655 | else |
| 4642 | −#endif | |
| 4643 | 4656 | vlan_mac_obj = &bp->sp_objs[cid].mac_obj; |
| 4644 | 4657 | |
| 4645 | 4658 | break; |
| @@ -4665,9 +4678,7 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp, · 19 unmodified lines | ||
| 4665 | 4678 | |
| 4666 | 4679 | } |
| 4667 | 4680 | |
| 4668 | −#ifdef BCM_CNIC | |
| 4669 | 4681 | static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp, bool start); |
| 4670 | −#endif | |
| 4671 | 4682 | |
| 4672 | 4683 | static void bnx2x_handle_rx_mode_eqe(struct bnx2x *bp) |
| 4673 | 4684 | { |
| @@ -4678,14 +4689,12 @@ static void bnx2x_handle_rx_mode_eqe(struct bnx2x *bp) · 4 unmodified lines | ||
| 4678 | 4689 | /* Send rx_mode command again if was requested */ |
| 4679 | 4690 | if (test_and_clear_bit(BNX2X_FILTER_RX_MODE_SCHED, &bp->sp_state)) |
| 4680 | 4691 | bnx2x_set_storm_rx_mode(bp); |
| 4681 | −#ifdef BCM_CNIC | |
| 4682 | 4692 | else if (test_and_clear_bit(BNX2X_FILTER_ISCSI_ETH_START_SCHED, |
| 4683 | 4693 | &bp->sp_state)) |
| 4684 | 4694 | bnx2x_set_iscsi_eth_rx_mode(bp, true); |
| 4685 | 4695 | else if (test_and_clear_bit(BNX2X_FILTER_ISCSI_ETH_STOP_SCHED, |
| 4686 | 4696 | &bp->sp_state)) |
| 4687 | 4697 | bnx2x_set_iscsi_eth_rx_mode(bp, false); |
| 4688 | −#endif | |
| 4689 | 4698 | |
| 4690 | 4699 | netif_addr_unlock_bh(bp->dev); |
| 4691 | 4700 | } |
| @@ -4747,7 +4756,6 @@ static void bnx2x_after_function_update(struct bnx2x *bp) · 55 unmodified lines | ||
| 4747 | 4756 | q); |
| 4748 | 4757 | } |
| 4749 | 4758 | |
| 4750 | −#ifdef BCM_CNIC | |
| 4751 | 4759 | if (!NO_FCOE(bp)) { |
| 4752 | 4760 | fp = &bp->fp[FCOE_IDX(bp)]; |
| 4753 | 4761 | queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
| @@ -4770,22 +4778,16 @@ static void bnx2x_after_function_update(struct bnx2x *bp) · 16 unmodified lines | ||
| 4770 | 4778 | bnx2x_link_report(bp); |
| 4771 | 4779 | bnx2x_fw_command(bp, DRV_MSG_CODE_AFEX_VIFSET_ACK, 0); |
| 4772 | 4780 | } |
| 4773 | −#else | |
| 4774 | − /* If no FCoE ring - ACK MCP now */ | |
| 4775 | − bnx2x_link_report(bp); | |
| 4776 | − bnx2x_fw_command(bp, DRV_MSG_CODE_AFEX_VIFSET_ACK, 0); | |
| 4777 | −#endif /* BCM_CNIC */ | |
| 4778 | 4781 | } |
| 4779 | 4782 | |
| 4780 | 4783 | static struct bnx2x_queue_sp_obj *bnx2x_cid_to_q_obj( |
| 4781 | 4784 | struct bnx2x *bp, u32 cid) |
| 4782 | 4785 | { |
| 4783 | 4786 | DP(BNX2X_MSG_SP, "retrieving fp from cid %d\n", cid); |
| 4784 | −#ifdef BCM_CNIC | |
| 4785 | − if (cid == BNX2X_FCOE_ETH_CID(bp)) | |
| 4787 | + | |
| 4788 | + if (CNIC_LOADED(bp) && (cid == BNX2X_FCOE_ETH_CID(bp))) | |
| 4786 | 4789 | return &bnx2x_fcoe_sp_obj(bp, q_obj); |
| 4787 | 4790 | else |
| 4788 | −#endif | |
| 4789 | 4791 | return &bp->sp_objs[CID_TO_FP(cid, bp)].q_obj; |
| 4790 | 4792 | } |
| 4791 | 4793 | |
| @@ -4793,6 +4795,7 @@ static void bnx2x_eq_int(struct bnx2x *bp) · 1 unmodified line | ||
| 4793 | 4795 | { |
| 4794 | 4796 | u16 hw_cons, sw_cons, sw_prod; |
| 4795 | 4797 | union event_ring_elem *elem; |
| 4798 | + u8 echo; | |
| 4796 | 4799 | u32 cid; |
| 4797 | 4800 | u8 opcode; |
| 4798 | 4801 | int spqe_cnt = 0; |
| @@ -4847,10 +4850,11 @@ static void bnx2x_eq_int(struct bnx2x *bp) · 48 unmodified lines | ||
| 4847 | 4850 | */ |
| 4848 | 4851 | DP(BNX2X_MSG_SP, |
| 4849 | 4852 | "got delete ramrod for MULTI[%d]\n", cid); |
| 4850 | −#ifdef BCM_CNIC | |
| 4851 | − if (!bnx2x_cnic_handle_cfc_del(bp, cid, elem)) | |
| 4853 | + | |
| 4854 | + if (CNIC_LOADED(bp) && | |
| 4855 | + !bnx2x_cnic_handle_cfc_del(bp, cid, elem)) | |
| 4852 | 4856 | goto next_spqe; |
| 4853 | −#endif | |
| 4857 | + | |
| 4854 | 4858 | q_obj = bnx2x_cid_to_q_obj(bp, cid); |
| 4855 | 4859 | |
| 4856 | 4860 | if (q_obj->complete_cmd(bp, q_obj, BNX2X_Q_CMD_CFC_DEL)) |
| @@ -4875,21 +4879,34 @@ static void bnx2x_eq_int(struct bnx2x *bp) · 18 unmodified lines | ||
| 4875 | 4879 | break; |
| 4876 | 4880 | bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_RELEASED); |
| 4877 | 4881 | goto next_spqe; |
| 4882 | + | |
| 4878 | 4883 | case EVENT_RING_OPCODE_FUNCTION_UPDATE: |
| 4879 | − DP(BNX2X_MSG_SP | BNX2X_MSG_MCP, | |
| 4880 | − "AFEX: ramrod completed FUNCTION_UPDATE\n"); | |
| 4881 | − f_obj->complete_cmd(bp, f_obj, BNX2X_F_CMD_AFEX_UPDATE); | |
| 4884 | + echo = elem->message.data.function_update_event.echo; | |
| 4885 | + if (echo == SWITCH_UPDATE) { | |
| 4886 | + DP(BNX2X_MSG_SP | NETIF_MSG_IFUP, | |
| 4887 | + "got FUNC_SWITCH_UPDATE ramrod\n"); | |
| 4888 | + if (f_obj->complete_cmd( | |
| 4889 | + bp, f_obj, BNX2X_F_CMD_SWITCH_UPDATE)) | |
| 4890 | + break; | |
| 4882 | 4891 | |
| 4883 | − /* We will perform the Queues update from sp_rtnl task | |
| 4884 | − * as all Queue SP operations should run under | |
| 4885 | − * rtnl_lock. | |
| 4886 | − */ | |
| 4887 | − smp_mb__before_clear_bit(); | |
| 4888 | − set_bit(BNX2X_SP_RTNL_AFEX_F_UPDATE, | |
| 4889 | − &bp->sp_rtnl_state); | |
| 4890 | − smp_mb__after_clear_bit(); | |
| 4892 | + } else { | |
| 4893 | + DP(BNX2X_MSG_SP | BNX2X_MSG_MCP, | |
| 4894 | + "AFEX: ramrod completed FUNCTION_UPDATE\n"); | |
| 4895 | + f_obj->complete_cmd(bp, f_obj, | |
| 4896 | + BNX2X_F_CMD_AFEX_UPDATE); | |
| 4897 | + | |
| 4898 | + /* We will perform the Queues update from | |
| 4899 | + * sp_rtnl task as all Queue SP operations | |
| 4900 | + * should run under rtnl_lock. | |
| 4901 | + */ | |
| 4902 | + smp_mb__before_clear_bit(); | |
| 4903 | + set_bit(BNX2X_SP_RTNL_AFEX_F_UPDATE, | |
| 4904 | + &bp->sp_rtnl_state); | |
| 4905 | + smp_mb__after_clear_bit(); | |
| 4906 | + | |
| 4907 | + schedule_delayed_work(&bp->sp_rtnl_task, 0); | |
| 4908 | + } | |
| 4891 | 4909 | |
| 4892 | − schedule_delayed_work(&bp->sp_rtnl_task, 0); | |
| 4893 | 4910 | goto next_spqe; |
| 4894 | 4911 | |
| 4895 | 4912 | case EVENT_RING_OPCODE_AFEX_VIF_LISTS: |
| @@ -4999,11 +5016,10 @@ static void bnx2x_sp_task(struct work_struct *work) · 103 unmodified lines | ||
| 4999 | 5016 | |
| 5000 | 5017 | /* SP events: STAT_QUERY and others */ |
| 5001 | 5018 | if (status & BNX2X_DEF_SB_IDX) { |
| 5002 | −#ifdef BCM_CNIC | |
| 5003 | 5019 | struct bnx2x_fastpath *fp = bnx2x_fcoe_fp(bp); |
| 5004 | 5020 | |
| 5005 | − if ((!NO_FCOE(bp)) && | |
| 5006 | − (bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) { | |
| 5021 | + if (FCOE_INIT(bp) && | |
| 5022 | + (bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) { | |
| 5007 | 5023 | /* |
| 5008 | 5024 | * Prevent local bottom-halves from running as |
| 5009 | 5025 | * we are going to change the local NAPI list. |
| @@ -5012,7 +5028,7 @@ static void bnx2x_sp_task(struct work_struct *work) · 2 unmodified lines | ||
| 5012 | 5028 | napi_schedule(&bnx2x_fcoe(bp, napi)); |
| 5013 | 5029 | local_bh_enable(); |
| 5014 | 5030 | } |
| 5015 | −#endif | |
| 5031 | + | |
| 5016 | 5032 | /* Handle EQ completions */ |
| 5017 | 5033 | bnx2x_eq_int(bp); |
| 5018 | 5034 | |
| @@ -5050,8 +5066,7 @@ irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) · 31 unmodified lines | ||
| 5050 | 5066 | return IRQ_HANDLED; |
| 5051 | 5067 | #endif |
| 5052 | 5068 | |
| 5053 | −#ifdef BCM_CNIC | |
| 5054 | − { | |
| 5069 | + if (CNIC_LOADED(bp)) { | |
| 5055 | 5070 | struct cnic_ops *c_ops; |
| 5056 | 5071 | |
| 5057 | 5072 | rcu_read_lock(); |
| @@ -5060,7 +5075,7 @@ irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) · 2 unmodified lines | ||
| 5060 | 5075 | c_ops->cnic_handler(bp->cnic_data, NULL); |
| 5061 | 5076 | rcu_read_unlock(); |
| 5062 | 5077 | } |
| 5063 | −#endif | |
| 5078 | + | |
| 5064 | 5079 | queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); |
| 5065 | 5080 | |
| 5066 | 5081 | return IRQ_HANDLED; |
| @@ -5498,12 +5513,10 @@ void bnx2x_set_storm_rx_mode(struct bnx2x *bp) · 431 unmodified lines | ||
| 5498 | 5513 | unsigned long rx_mode_flags = 0, ramrod_flags = 0; |
| 5499 | 5514 | unsigned long rx_accept_flags = 0, tx_accept_flags = 0; |
| 5500 | 5515 | |
| 5501 | −#ifdef BCM_CNIC | |
| 5502 | 5516 | if (!NO_FCOE(bp)) |
| 5503 | 5517 | |
| 5504 | 5518 | /* Configure rx_mode of FCoE Queue */ |
| 5505 | 5519 | __set_bit(BNX2X_RX_MODE_FCOE_ETH, &rx_mode_flags); |
| 5506 | −#endif | |
| 5507 | 5520 | |
| 5508 | 5521 | switch (bp->rx_mode) { |
| 5509 | 5522 | case BNX2X_RX_MODE_NONE: |
| @@ -5624,12 +5637,12 @@ static void bnx2x_init_internal(struct bnx2x *bp, u32 load_code) · 114 unmodified lines | ||
| 5624 | 5637 | |
| 5625 | 5638 | static inline u8 bnx2x_fp_igu_sb_id(struct bnx2x_fastpath *fp) |
| 5626 | 5639 | { |
| 5627 | − return fp->bp->igu_base_sb + fp->index + CNIC_PRESENT; | |
| 5640 | + return fp->bp->igu_base_sb + fp->index + CNIC_SUPPORT(fp->bp); | |
| 5628 | 5641 | } |
| 5629 | 5642 | |
| 5630 | 5643 | static inline u8 bnx2x_fp_fw_sb_id(struct bnx2x_fastpath *fp) |
| 5631 | 5644 | { |
| 5632 | − return fp->bp->base_fw_ndsb + fp->index + CNIC_PRESENT; | |
| 5645 | + return fp->bp->base_fw_ndsb + fp->index + CNIC_SUPPORT(fp->bp); | |
| 5633 | 5646 | } |
| 5634 | 5647 | |
| 5635 | 5648 | static u8 bnx2x_fp_cl_id(struct bnx2x_fastpath *fp) |
| @@ -5720,23 +5733,25 @@ static void bnx2x_init_tx_ring_one(struct bnx2x_fp_txdata *txdata) · 84 unmodified lines | ||
| 5720 | 5733 | txdata->tx_pkt = 0; |
| 5721 | 5734 | } |
| 5722 | 5735 | |
| 5736 | +static void bnx2x_init_tx_rings_cnic(struct bnx2x *bp) | |
| 5737 | +{ | |
| 5738 | + int i; | |
| 5739 | + | |
| 5740 | + for_each_tx_queue_cnic(bp, i) | |
| 5741 | + bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[0]); | |
| 5742 | +} | |
| 5723 | 5743 | static void bnx2x_init_tx_rings(struct bnx2x *bp) |
| 5724 | 5744 | { |
| 5725 | 5745 | int i; |
| 5726 | 5746 | u8 cos; |
| 5727 | 5747 | |
| 5728 | − for_each_tx_queue(bp, i) | |
| 5748 | + for_each_eth_queue(bp, i) | |
| 5729 | 5749 | for_each_cos_in_tx_queue(&bp->fp[i], cos) |
| 5730 | 5750 | bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[cos]); |
| 5731 | 5751 | } |
| 5732 | 5752 | |
| 5733 | −void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) | |
| 5753 | +void bnx2x_nic_init_cnic(struct bnx2x *bp) | |
| 5734 | 5754 | { |
| 5735 | − int i; | |
| 5736 | − | |
| 5737 | − for_each_eth_queue(bp, i) | |
| 5738 | − bnx2x_init_eth_fp(bp, i); | |
| 5739 | −#ifdef BCM_CNIC | |
| 5740 | 5755 | if (!NO_FCOE(bp)) |
| 5741 | 5756 | bnx2x_init_fcoe_fp(bp); |
| 5742 | 5757 | |
| @@ -5744,8 +5759,22 @@ void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) · 1 unmodified line | ||
| 5744 | 5759 | BNX2X_VF_ID_INVALID, false, |
| 5745 | 5760 | bnx2x_cnic_fw_sb_id(bp), bnx2x_cnic_igu_sb_id(bp)); |
| 5746 | 5761 | |
| 5747 | −#endif | |
| 5762 | + /* ensure status block indices were read */ | |
| 5763 | + rmb(); | |
| 5764 | + bnx2x_init_rx_rings_cnic(bp); | |
| 5765 | + bnx2x_init_tx_rings_cnic(bp); | |
| 5766 | + | |
| 5767 | + /* flush all */ | |
| 5768 | + mb(); | |
| 5769 | + mmiowb(); | |
| 5770 | +} | |
| 5748 | 5771 | |
| 5772 | +void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) | |
| 5773 | +{ | |
| 5774 | + int i; | |
| 5775 | + | |
| 5776 | + for_each_eth_queue(bp, i) | |
| 5777 | + bnx2x_init_eth_fp(bp, i); | |
| 5749 | 5778 | /* Initialize MOD_ABS interrupts */ |
| 5750 | 5779 | bnx2x_init_mod_abs_int(bp, &bp->link_vars, bp->common.chip_id, |
| 5751 | 5780 | bp->common.shmem_base, bp->common.shmem2_base, |
| @@ -6031,10 +6060,9 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) · 279 unmodified lines | ||
| 6031 | 6060 | msleep(50); |
| 6032 | 6061 | bnx2x_init_block(bp, BLOCK_BRB1, PHASE_COMMON); |
| 6033 | 6062 | bnx2x_init_block(bp, BLOCK_PRS, PHASE_COMMON); |
| 6034 | −#ifndef BCM_CNIC | |
| 6035 | − /* set NIC mode */ | |
| 6036 | − REG_WR(bp, PRS_REG_NIC_MODE, 1); | |
| 6037 | −#endif | |
| 6063 | + if (!CNIC_SUPPORT(bp)) | |
| 6064 | + /* set NIC mode */ | |
| 6065 | + REG_WR(bp, PRS_REG_NIC_MODE, 1); | |
| 6038 | 6066 | |
| 6039 | 6067 | /* Enable inputs of parser neighbor blocks */ |
| 6040 | 6068 | REG_WR(bp, TSDM_REG_ENABLE_IN1, 0x7fffffff); |
| @@ -6049,6 +6077,8 @@ static int bnx2x_int_mem_test(struct bnx2x *bp) · 8 unmodified lines | ||
| 6049 | 6077 | |
| 6050 | 6078 | static void bnx2x_enable_blocks_attention(struct bnx2x *bp) |
| 6051 | 6079 | { |
| 6080 | + u32 val; | |
| 6081 | + | |
| 6052 | 6082 | REG_WR(bp, PXP_REG_PXP_INT_MASK_0, 0); |
| 6053 | 6083 | if (!CHIP_IS_E1x(bp)) |
| 6054 | 6084 | REG_WR(bp, PXP_REG_PXP_INT_MASK_1, 0x40); |
| @@ -6082,17 +6112,14 @@ static void bnx2x_enable_blocks_attention(struct bnx2x *bp) · 27 unmodified lines | ||
| 6082 | 6112 | /* REG_WR(bp, CSEM_REG_CSEM_INT_MASK_0, 0); */ |
| 6083 | 6113 | /* REG_WR(bp, CSEM_REG_CSEM_INT_MASK_1, 0); */ |
| 6084 | 6114 | |
| 6085 | − if (CHIP_REV_IS_FPGA(bp)) | |
| 6086 | − REG_WR(bp, PXP2_REG_PXP2_INT_MASK_0, 0x580000); | |
| 6087 | − else if (!CHIP_IS_E1x(bp)) | |
| 6088 | − REG_WR(bp, PXP2_REG_PXP2_INT_MASK_0, | |
| 6089 | − (PXP2_PXP2_INT_MASK_0_REG_PGL_CPL_OF | |
| 6090 | − | PXP2_PXP2_INT_MASK_0_REG_PGL_CPL_AFT | |
| 6091 | − | PXP2_PXP2_INT_MASK_0_REG_PGL_PCIE_ATTN | |
| 6092 | − | PXP2_PXP2_INT_MASK_0_REG_PGL_READ_BLOCKED | |
| 6093 | − | PXP2_PXP2_INT_MASK_0_REG_PGL_WRITE_BLOCKED)); | |
| 6094 | − else | |
| 6095 | − REG_WR(bp, PXP2_REG_PXP2_INT_MASK_0, 0x480000); | |
| 6115 | + val = PXP2_PXP2_INT_MASK_0_REG_PGL_CPL_AFT | | |
| 6116 | + PXP2_PXP2_INT_MASK_0_REG_PGL_CPL_OF | | |
| 6117 | + PXP2_PXP2_INT_MASK_0_REG_PGL_PCIE_ATTN; | |
| 6118 | + if (!CHIP_IS_E1x(bp)) | |
| 6119 | + val |= PXP2_PXP2_INT_MASK_0_REG_PGL_READ_BLOCKED | | |
| 6120 | + PXP2_PXP2_INT_MASK_0_REG_PGL_WRITE_BLOCKED; | |
| 6121 | + REG_WR(bp, PXP2_REG_PXP2_INT_MASK_0, val); | |
| 6122 | + | |
| 6096 | 6123 | REG_WR(bp, TSDM_REG_TSDM_INT_MASK_0, 0); |
| 6097 | 6124 | REG_WR(bp, TSDM_REG_TSDM_INT_MASK_1, 0); |
| 6098 | 6125 | REG_WR(bp, TCM_REG_TCM_INT_MASK, 0); |
| @@ -6185,18 +6212,16 @@ static void bnx2x_setup_fan_failure_detection(struct bnx2x *bp) · 86 unmodified lines | ||
| 6185 | 6212 | return; |
| 6186 | 6213 | |
| 6187 | 6214 | /* Fan failure is indicated by SPIO 5 */ |
| 6188 | − bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5, | |
| 6189 | − MISC_REGISTERS_SPIO_INPUT_HI_Z); | |
| 6215 | + bnx2x_set_spio(bp, MISC_SPIO_SPIO5, MISC_SPIO_INPUT_HI_Z); | |
| 6190 | 6216 | |
| 6191 | 6217 | /* set to active low mode */ |
| 6192 | 6218 | val = REG_RD(bp, MISC_REG_SPIO_INT); |
| 6193 | − val |= ((1 << MISC_REGISTERS_SPIO_5) << | |
| 6194 | − MISC_REGISTERS_SPIO_INT_OLD_SET_POS); | |
| 6219 | + val |= (MISC_SPIO_SPIO5 << MISC_SPIO_INT_OLD_SET_POS); | |
| 6195 | 6220 | REG_WR(bp, MISC_REG_SPIO_INT, val); |
| 6196 | 6221 | |
| 6197 | 6222 | /* enable interrupt to signal the IGU */ |
| 6198 | 6223 | val = REG_RD(bp, MISC_REG_SPIO_EVENT_EN); |
| 6199 | − val |= (1 << MISC_REGISTERS_SPIO_5); | |
| 6224 | + val |= MISC_SPIO_SPIO5; | |
| 6200 | 6225 | REG_WR(bp, MISC_REG_SPIO_EVENT_EN, val); |
| 6201 | 6226 | } |
| 6202 | 6227 | |
| @@ -6256,6 +6281,10 @@ void bnx2x_pf_disable(struct bnx2x *bp) · 53 unmodified lines | ||
| 6256 | 6281 | static void bnx2x__common_init_phy(struct bnx2x *bp) |
| 6257 | 6282 | { |
| 6258 | 6283 | u32 shmem_base[2], shmem2_base[2]; |
| 6284 | + /* Avoid common init in case MFW supports LFA */ | |
| 6285 | + if (SHMEM2_RD(bp, size) > | |
| 6286 | + (u32)offsetof(struct shmem2_region, lfa_host_addr[BP_PORT(bp)])) | |
| 6287 | + return; | |
| 6259 | 6288 | shmem_base[0] = bp->common.shmem_base; |
| 6260 | 6289 | shmem2_base[0] = bp->common.shmem2_base; |
| 6261 | 6290 | if (!CHIP_IS_E1x(bp)) { |
| @@ -6522,9 +6551,8 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) · 260 unmodified lines | ||
| 6522 | 6551 | REG_WR(bp, QM_REG_SOFT_RESET, 1); |
| 6523 | 6552 | REG_WR(bp, QM_REG_SOFT_RESET, 0); |
| 6524 | 6553 | |
| 6525 | −#ifdef BCM_CNIC | |
| 6526 | − bnx2x_init_block(bp, BLOCK_TM, PHASE_COMMON); | |
| 6527 | −#endif | |
| 6554 | + if (CNIC_SUPPORT(bp)) | |
| 6555 | + bnx2x_init_block(bp, BLOCK_TM, PHASE_COMMON); | |
| 6528 | 6556 | |
| 6529 | 6557 | bnx2x_init_block(bp, BLOCK_DORQ, PHASE_COMMON); |
| 6530 | 6558 | REG_WR(bp, DORQ_REG_DPM_CID_OFST, BNX2X_DB_SHIFT); |
| @@ -6611,18 +6639,18 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) · 80 unmodified lines | ||
| 6611 | 6639 | |
| 6612 | 6640 | bnx2x_init_block(bp, BLOCK_SRC, PHASE_COMMON); |
| 6613 | 6641 | |
| 6614 | −#ifdef BCM_CNIC | |
| 6615 | − REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672); | |
| 6616 | − REG_WR(bp, SRC_REG_KEYSEARCH_1, 0x24b8f2cc); | |
| 6617 | − REG_WR(bp, SRC_REG_KEYSEARCH_2, 0x223aef9b); | |
| 6618 | − REG_WR(bp, SRC_REG_KEYSEARCH_3, 0x26001e3a); | |
| 6619 | − REG_WR(bp, SRC_REG_KEYSEARCH_4, 0x7ae91116); | |
| 6620 | − REG_WR(bp, SRC_REG_KEYSEARCH_5, 0x5ce5230b); | |
| 6621 | − REG_WR(bp, SRC_REG_KEYSEARCH_6, 0x298d8adf); | |
| 6622 | − REG_WR(bp, SRC_REG_KEYSEARCH_7, 0x6eb0ff09); | |
| 6623 | − REG_WR(bp, SRC_REG_KEYSEARCH_8, 0x1830f82f); | |
| 6624 | − REG_WR(bp, SRC_REG_KEYSEARCH_9, 0x01e46be7); | |
| 6625 | −#endif | |
| 6642 | + if (CNIC_SUPPORT(bp)) { | |
| 6643 | + REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672); | |
| 6644 | + REG_WR(bp, SRC_REG_KEYSEARCH_1, 0x24b8f2cc); | |
| 6645 | + REG_WR(bp, SRC_REG_KEYSEARCH_2, 0x223aef9b); | |
| 6646 | + REG_WR(bp, SRC_REG_KEYSEARCH_3, 0x26001e3a); | |
| 6647 | + REG_WR(bp, SRC_REG_KEYSEARCH_4, 0x7ae91116); | |
| 6648 | + REG_WR(bp, SRC_REG_KEYSEARCH_5, 0x5ce5230b); | |
| 6649 | + REG_WR(bp, SRC_REG_KEYSEARCH_6, 0x298d8adf); | |
| 6650 | + REG_WR(bp, SRC_REG_KEYSEARCH_7, 0x6eb0ff09); | |
| 6651 | + REG_WR(bp, SRC_REG_KEYSEARCH_8, 0x1830f82f); | |
| 6652 | + REG_WR(bp, SRC_REG_KEYSEARCH_9, 0x01e46be7); | |
| 6653 | + } | |
| 6626 | 6654 | REG_WR(bp, SRC_REG_SOFT_RST, 0); |
| 6627 | 6655 | |
| 6628 | 6656 | if (sizeof(union cdu_context) != 1024) |
| @@ -6786,11 +6814,11 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 157 unmodified lines | ||
| 6786 | 6814 | /* QM cid (connection) count */ |
| 6787 | 6815 | bnx2x_qm_init_cid_count(bp, bp->qm_cid_count, INITOP_SET); |
| 6788 | 6816 | |
| 6789 | −#ifdef BCM_CNIC | |
| 6790 | − bnx2x_init_block(bp, BLOCK_TM, init_phase); | |
| 6791 | − REG_WR(bp, TM_REG_LIN0_SCAN_TIME + port*4, 20); | |
| 6792 | − REG_WR(bp, TM_REG_LIN0_MAX_ACTIVE_CID + port*4, 31); | |
| 6793 | −#endif | |
| 6817 | + if (CNIC_SUPPORT(bp)) { | |
| 6818 | + bnx2x_init_block(bp, BLOCK_TM, init_phase); | |
| 6819 | + REG_WR(bp, TM_REG_LIN0_SCAN_TIME + port*4, 20); | |
| 6820 | + REG_WR(bp, TM_REG_LIN0_MAX_ACTIVE_CID + port*4, 31); | |
| 6821 | + } | |
| 6794 | 6822 | |
| 6795 | 6823 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); |
| 6796 | 6824 | |
| @@ -6877,9 +6905,9 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 80 unmodified lines | ||
| 6877 | 6905 | REG_WR(bp, PBF_REG_INIT_P0 + port*4, 0); |
| 6878 | 6906 | } |
| 6879 | 6907 | |
| 6880 | −#ifdef BCM_CNIC | |
| 6881 | − bnx2x_init_block(bp, BLOCK_SRC, init_phase); | |
| 6882 | −#endif | |
| 6908 | + if (CNIC_SUPPORT(bp)) | |
| 6909 | + bnx2x_init_block(bp, BLOCK_SRC, init_phase); | |
| 6910 | + | |
| 6883 | 6911 | bnx2x_init_block(bp, BLOCK_CDU, init_phase); |
| 6884 | 6912 | bnx2x_init_block(bp, BLOCK_CFC, init_phase); |
| 6885 | 6913 | |
| @@ -6955,7 +6983,7 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 69 unmodified lines | ||
| 6955 | 6983 | |
| 6956 | 6984 | /* If SPIO5 is set to generate interrupts, enable it for this port */ |
| 6957 | 6985 | val = REG_RD(bp, MISC_REG_SPIO_EVENT_EN); |
| 6958 | − if (val & (1 << MISC_REGISTERS_SPIO_5)) { | |
| 6986 | + if (val & MISC_SPIO_SPIO5) { | |
| 6959 | 6987 | u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : |
| 6960 | 6988 | MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0); |
| 6961 | 6989 | val = REG_RD(bp, reg_addr); |
| @@ -7040,6 +7068,130 @@ static void bnx2x_clear_func_ilt(struct bnx2x *bp, u32 func) · 78 unmodified lines | ||
| 7040 | 7068 | bnx2x_ilt_wr(bp, i, 0); |
| 7041 | 7069 | } |
| 7042 | 7070 | |
| 7071 | + | |
| 7072 | +static void bnx2x_init_searcher(struct bnx2x *bp) | |
| 7073 | +{ | |
| 7074 | + int port = BP_PORT(bp); | |
| 7075 | + bnx2x_src_init_t2(bp, bp->t2, bp->t2_mapping, SRC_CONN_NUM); | |
| 7076 | + /* T1 hash bits value determines the T1 number of entries */ | |
| 7077 | + REG_WR(bp, SRC_REG_NUMBER_HASH_BITS0 + port*4, SRC_HASH_BITS); | |
| 7078 | +} | |
| 7079 | + | |
| 7080 | +static inline int bnx2x_func_switch_update(struct bnx2x *bp, int suspend) | |
| 7081 | +{ | |
| 7082 | + int rc; | |
| 7083 | + struct bnx2x_func_state_params func_params = {NULL}; | |
| 7084 | + struct bnx2x_func_switch_update_params *switch_update_params = | |
| 7085 | + &func_params.params.switch_update; | |
| 7086 | + | |
| 7087 | + /* Prepare parameters for function state transitions */ | |
| 7088 | + __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags); | |
| 7089 | + __set_bit(RAMROD_RETRY, &func_params.ramrod_flags); | |
| 7090 | + | |
| 7091 | + func_params.f_obj = &bp->func_obj; | |
| 7092 | + func_params.cmd = BNX2X_F_CMD_SWITCH_UPDATE; | |
| 7093 | + | |
| 7094 | + /* Function parameters */ | |
| 7095 | + switch_update_params->suspend = suspend; | |
| 7096 | + | |
| 7097 | + rc = bnx2x_func_state_change(bp, &func_params); | |
| 7098 | + | |
| 7099 | + return rc; | |
| 7100 | +} | |
| 7101 | + | |
| 7102 | +static int bnx2x_reset_nic_mode(struct bnx2x *bp) | |
| 7103 | +{ | |
| 7104 | + int rc, i, port = BP_PORT(bp); | |
| 7105 | + int vlan_en = 0, mac_en[NUM_MACS]; | |
| 7106 | + | |
| 7107 | + | |
| 7108 | + /* Close input from network */ | |
| 7109 | + if (bp->mf_mode == SINGLE_FUNCTION) { | |
| 7110 | + bnx2x_set_rx_filter(&bp->link_params, 0); | |
| 7111 | + } else { | |
| 7112 | + vlan_en = REG_RD(bp, port ? NIG_REG_LLH1_FUNC_EN : | |
| 7113 | + NIG_REG_LLH0_FUNC_EN); | |
| 7114 | + REG_WR(bp, port ? NIG_REG_LLH1_FUNC_EN : | |
| 7115 | + NIG_REG_LLH0_FUNC_EN, 0); | |
| 7116 | + for (i = 0; i < NUM_MACS; i++) { | |
| 7117 | + mac_en[i] = REG_RD(bp, port ? | |
| 7118 | + (NIG_REG_LLH1_FUNC_MEM_ENABLE + | |
| 7119 | + 4 * i) : | |
| 7120 | + (NIG_REG_LLH0_FUNC_MEM_ENABLE + | |
| 7121 | + 4 * i)); | |
| 7122 | + REG_WR(bp, port ? (NIG_REG_LLH1_FUNC_MEM_ENABLE + | |
| 7123 | + 4 * i) : | |
| 7124 | + (NIG_REG_LLH0_FUNC_MEM_ENABLE + 4 * i), 0); | |
| 7125 | + } | |
| 7126 | + } | |
| 7127 | + | |
| 7128 | + /* Close BMC to host */ | |
| 7129 | + REG_WR(bp, port ? NIG_REG_P0_TX_MNG_HOST_ENABLE : | |
| 7130 | + NIG_REG_P1_TX_MNG_HOST_ENABLE, 0); | |
| 7131 | + | |
| 7132 | + /* Suspend Tx switching to the PF. Completion of this ramrod | |
| 7133 | + * further guarantees that all the packets of that PF / child | |
| 7134 | + * VFs in BRB were processed by the Parser, so it is safe to | |
| 7135 | + * change the NIC_MODE register. | |
| 7136 | + */ | |
| 7137 | + rc = bnx2x_func_switch_update(bp, 1); | |
| 7138 | + if (rc) { | |
| 7139 | + BNX2X_ERR("Can't suspend tx-switching!\n"); | |
| 7140 | + return rc; | |
| 7141 | + } | |
| 7142 | + | |
| 7143 | + /* Change NIC_MODE register */ | |
| 7144 | + REG_WR(bp, PRS_REG_NIC_MODE, 0); | |
| 7145 | + | |
| 7146 | + /* Open input from network */ | |
| 7147 | + if (bp->mf_mode == SINGLE_FUNCTION) { | |
| 7148 | + bnx2x_set_rx_filter(&bp->link_params, 1); | |
| 7149 | + } else { | |
| 7150 | + REG_WR(bp, port ? NIG_REG_LLH1_FUNC_EN : | |
| 7151 | + NIG_REG_LLH0_FUNC_EN, vlan_en); | |
| 7152 | + for (i = 0; i < NUM_MACS; i++) { | |
| 7153 | + REG_WR(bp, port ? (NIG_REG_LLH1_FUNC_MEM_ENABLE + | |
| 7154 | + 4 * i) : | |
| 7155 | + (NIG_REG_LLH0_FUNC_MEM_ENABLE + 4 * i), | |
| 7156 | + mac_en[i]); | |
| 7157 | + } | |
| 7158 | + } | |
| 7159 | + | |
| 7160 | + /* Enable BMC to host */ | |
| 7161 | + REG_WR(bp, port ? NIG_REG_P0_TX_MNG_HOST_ENABLE : | |
| 7162 | + NIG_REG_P1_TX_MNG_HOST_ENABLE, 1); | |
| 7163 | + | |
| 7164 | + /* Resume Tx switching to the PF */ | |
| 7165 | + rc = bnx2x_func_switch_update(bp, 0); | |
| 7166 | + if (rc) { | |
| 7167 | + BNX2X_ERR("Can't resume tx-switching!\n"); | |
| 7168 | + return rc; | |
| 7169 | + } | |
| 7170 | + | |
| 7171 | + DP(NETIF_MSG_IFUP, "NIC MODE disabled\n"); | |
| 7172 | + return 0; | |
| 7173 | +} | |
| 7174 | + | |
| 7175 | +int bnx2x_init_hw_func_cnic(struct bnx2x *bp) | |
| 7176 | +{ | |
| 7177 | + int rc; | |
| 7178 | + | |
| 7179 | + bnx2x_ilt_init_op_cnic(bp, INITOP_SET); | |
| 7180 | + | |
| 7181 | + if (CONFIGURE_NIC_MODE(bp)) { | |
| 7182 | + /* Configrue searcher as part of function hw init */ | |
| 7183 | + bnx2x_init_searcher(bp); | |
| 7184 | + | |
| 7185 | + /* Reset NIC mode */ | |
| 7186 | + rc = bnx2x_reset_nic_mode(bp); | |
| 7187 | + if (rc) | |
| 7188 | + BNX2X_ERR("Can't change NIC mode!\n"); | |
| 7189 | + return rc; | |
| 7190 | + } | |
| 7191 | + | |
| 7192 | + return 0; | |
| 7193 | +} | |
| 7194 | + | |
| 7043 | 7195 | static int bnx2x_init_hw_func(struct bnx2x *bp) |
| 7044 | 7196 | { |
| 7045 | 7197 | int port = BP_PORT(bp); |
| @@ -7082,17 +7234,16 @@ static int bnx2x_init_hw_func(struct bnx2x *bp) · 36 unmodified lines | ||
| 7082 | 7234 | } |
| 7083 | 7235 | bnx2x_ilt_init_op(bp, INITOP_SET); |
| 7084 | 7236 | |
| 7085 | −#ifdef BCM_CNIC | |
| 7086 | − bnx2x_src_init_t2(bp, bp->t2, bp->t2_mapping, SRC_CONN_NUM); | |
| 7087 | − | |
| 7088 | − /* T1 hash bits value determines the T1 number of entries */ | |
| 7089 | − REG_WR(bp, SRC_REG_NUMBER_HASH_BITS0 + port*4, SRC_HASH_BITS); | |
| 7090 | −#endif | |
| 7237 | + if (!CONFIGURE_NIC_MODE(bp)) { | |
| 7238 | + bnx2x_init_searcher(bp); | |
| 7239 | + REG_WR(bp, PRS_REG_NIC_MODE, 0); | |
| 7240 | + DP(NETIF_MSG_IFUP, "NIC MODE disabled\n"); | |
| 7241 | + } else { | |
| 7242 | + /* Set NIC mode */ | |
| 7243 | + REG_WR(bp, PRS_REG_NIC_MODE, 1); | |
| 7244 | + DP(NETIF_MSG_IFUP, "NIC MODE configrued\n"); | |
| 7091 | 7245 | |
| 7092 | −#ifndef BCM_CNIC | |
| 7093 | − /* set NIC mode */ | |
| 7094 | − REG_WR(bp, PRS_REG_NIC_MODE, 1); | |
| 7095 | −#endif /* BCM_CNIC */ | |
| 7246 | + } | |
| 7096 | 7247 | |
| 7097 | 7248 | if (!CHIP_IS_E1x(bp)) { |
| 7098 | 7249 | u32 pf_conf = IGU_PF_CONF_FUNC_EN; |
| @@ -7343,6 +7494,20 @@ static int bnx2x_init_hw_func(struct bnx2x *bp) · 244 unmodified lines | ||
| 7343 | 7494 | } |
| 7344 | 7495 | |
| 7345 | 7496 | |
| 7497 | +void bnx2x_free_mem_cnic(struct bnx2x *bp) | |
| 7498 | +{ | |
| 7499 | + bnx2x_ilt_mem_op_cnic(bp, ILT_MEMOP_FREE); | |
| 7500 | + | |
| 7501 | + if (!CHIP_IS_E1x(bp)) | |
| 7502 | + BNX2X_PCI_FREE(bp->cnic_sb.e2_sb, bp->cnic_sb_mapping, | |
| 7503 | + sizeof(struct host_hc_status_block_e2)); | |
| 7504 | + else | |
| 7505 | + BNX2X_PCI_FREE(bp->cnic_sb.e1x_sb, bp->cnic_sb_mapping, | |
| 7506 | + sizeof(struct host_hc_status_block_e1x)); | |
| 7507 | + | |
| 7508 | + BNX2X_PCI_FREE(bp->t2, bp->t2_mapping, SRC_T2_SZ); | |
| 7509 | +} | |
| 7510 | + | |
| 7346 | 7511 | void bnx2x_free_mem(struct bnx2x *bp) |
| 7347 | 7512 | { |
| 7348 | 7513 | int i; |
| @@ -7367,17 +7532,6 @@ void bnx2x_free_mem(struct bnx2x *bp) · 18 unmodified lines | ||
| 7367 | 7532 | |
| 7368 | 7533 | BNX2X_FREE(bp->ilt->lines); |
| 7369 | 7534 | |
| 7370 | −#ifdef BCM_CNIC | |
| 7371 | − if (!CHIP_IS_E1x(bp)) | |
| 7372 | − BNX2X_PCI_FREE(bp->cnic_sb.e2_sb, bp->cnic_sb_mapping, | |
| 7373 | − sizeof(struct host_hc_status_block_e2)); | |
| 7374 | − else | |
| 7375 | − BNX2X_PCI_FREE(bp->cnic_sb.e1x_sb, bp->cnic_sb_mapping, | |
| 7376 | − sizeof(struct host_hc_status_block_e1x)); | |
| 7377 | − | |
| 7378 | − BNX2X_PCI_FREE(bp->t2, bp->t2_mapping, SRC_T2_SZ); | |
| 7379 | −#endif | |
| 7380 | − | |
| 7381 | 7535 | BNX2X_PCI_FREE(bp->spq, bp->spq_mapping, BCM_PAGE_SIZE); |
| 7382 | 7536 | |
| 7383 | 7537 | BNX2X_PCI_FREE(bp->eq_ring, bp->eq_mapping, |
| @@ -7445,24 +7599,44 @@ alloc_mem_err: · 61 unmodified lines | ||
| 7445 | 7599 | return -ENOMEM; |
| 7446 | 7600 | } |
| 7447 | 7601 | |
| 7448 | − | |
| 7449 | −int bnx2x_alloc_mem(struct bnx2x *bp) | |
| 7602 | +int bnx2x_alloc_mem_cnic(struct bnx2x *bp) | |
| 7450 | 7603 | { |
| 7451 | − int i, allocated, context_size; | |
| 7452 | − | |
| 7453 | −#ifdef BCM_CNIC | |
| 7454 | 7604 | if (!CHIP_IS_E1x(bp)) |
| 7455 | 7605 | /* size = the status block + ramrod buffers */ |
| 7456 | 7606 | BNX2X_PCI_ALLOC(bp->cnic_sb.e2_sb, &bp->cnic_sb_mapping, |
| 7457 | 7607 | sizeof(struct host_hc_status_block_e2)); |
| 7458 | 7608 | else |
| 7459 | − BNX2X_PCI_ALLOC(bp->cnic_sb.e1x_sb, &bp->cnic_sb_mapping, | |
| 7460 | − sizeof(struct host_hc_status_block_e1x)); | |
| 7609 | + BNX2X_PCI_ALLOC(bp->cnic_sb.e1x_sb, | |
| 7610 | + &bp->cnic_sb_mapping, | |
| 7611 | + sizeof(struct | |
| 7612 | + host_hc_status_block_e1x)); | |
| 7461 | 7613 | |
| 7462 | − /* allocate searcher T2 table */ | |
| 7463 | − BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); | |
| 7464 | −#endif | |
| 7614 | + if (CONFIGURE_NIC_MODE(bp)) | |
| 7615 | + /* allocate searcher T2 table, as it wan't allocated before */ | |
| 7616 | + BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); | |
| 7617 | + | |
| 7618 | + /* write address to which L5 should insert its values */ | |
| 7619 | + bp->cnic_eth_dev.addr_drv_info_to_mcp = | |
| 7620 | + &bp->slowpath->drv_info_to_mcp; | |
| 7465 | 7621 | |
| 7622 | + if (bnx2x_ilt_mem_op_cnic(bp, ILT_MEMOP_ALLOC)) | |
| 7623 | + goto alloc_mem_err; | |
| 7624 | + | |
| 7625 | + return 0; | |
| 7626 | + | |
| 7627 | +alloc_mem_err: | |
| 7628 | + bnx2x_free_mem_cnic(bp); | |
| 7629 | + BNX2X_ERR("Can't allocate memory\n"); | |
| 7630 | + return -ENOMEM; | |
| 7631 | +} | |
| 7632 | + | |
| 7633 | +int bnx2x_alloc_mem(struct bnx2x *bp) | |
| 7634 | +{ | |
| 7635 | + int i, allocated, context_size; | |
| 7636 | + | |
| 7637 | + if (!CONFIGURE_NIC_MODE(bp)) | |
| 7638 | + /* allocate searcher T2 table */ | |
| 7639 | + BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); | |
| 7466 | 7640 | |
| 7467 | 7641 | BNX2X_PCI_ALLOC(bp->def_status_blk, &bp->def_status_blk_mapping, |
| 7468 | 7642 | sizeof(struct host_sp_status_block)); |
| @@ -7470,11 +7644,6 @@ int bnx2x_alloc_mem(struct bnx2x *bp) · 1 unmodified line | ||
| 7470 | 7644 | BNX2X_PCI_ALLOC(bp->slowpath, &bp->slowpath_mapping, |
| 7471 | 7645 | sizeof(struct bnx2x_slowpath)); |
| 7472 | 7646 | |
| 7473 | −#ifdef BCM_CNIC | |
| 7474 | − /* write address to which L5 should insert its values */ | |
| 7475 | − bp->cnic_eth_dev.addr_drv_info_to_mcp = &bp->slowpath->drv_info_to_mcp; | |
| 7476 | −#endif | |
| 7477 | − | |
| 7478 | 7647 | /* Allocated memory for FW statistics */ |
| 7479 | 7648 | if (bnx2x_alloc_fw_stats_mem(bp)) |
| 7480 | 7649 | goto alloc_mem_err; |
| @@ -7596,14 +7765,12 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set) · 115 unmodified lines | ||
| 7596 | 7765 | { |
| 7597 | 7766 | unsigned long ramrod_flags = 0; |
| 7598 | 7767 | |
| 7599 | −#ifdef BCM_CNIC | |
| 7600 | 7768 | if (is_zero_ether_addr(bp->dev->dev_addr) && |
| 7601 | 7769 | (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))) { |
| 7602 | 7770 | DP(NETIF_MSG_IFUP | NETIF_MSG_IFDOWN, |
| 7603 | 7771 | "Ignoring Zero MAC for STORAGE SD mode\n"); |
| 7604 | 7772 | return 0; |
| 7605 | 7773 | } |
| 7606 | −#endif | |
| 7607 | 7774 | |
| 7608 | 7775 | DP(NETIF_MSG_IFUP, "Adding Eth MAC\n"); |
| 7609 | 7776 | |
| @@ -7632,7 +7799,8 @@ void bnx2x_set_int_mode(struct bnx2x *bp) · 22 unmodified lines | ||
| 7632 | 7799 | bnx2x_enable_msi(bp); |
| 7633 | 7800 | /* falling through... */ |
| 7634 | 7801 | case INT_MODE_INTx: |
| 7635 | − bp->num_queues = 1 + NON_ETH_CONTEXT_USE; | |
| 7802 | + bp->num_ethernet_queues = 1; | |
| 7803 | + bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; | |
| 7636 | 7804 | BNX2X_DEV_INFO("set number of queues to 1\n"); |
| 7637 | 7805 | break; |
| 7638 | 7806 | default: |
| @@ -7644,9 +7812,10 @@ void bnx2x_set_int_mode(struct bnx2x *bp) · 5 unmodified lines | ||
| 7644 | 7812 | bp->flags & USING_SINGLE_MSIX_FLAG) { |
| 7645 | 7813 | /* failed to enable multiple MSI-X */ |
| 7646 | 7814 | BNX2X_DEV_INFO("Failed to enable multiple MSI-X (%d), set number of queues to %d\n", |
| 7647 | − bp->num_queues, 1 + NON_ETH_CONTEXT_USE); | |
| 7815 | + bp->num_queues, | |
| 7816 | + 1 + bp->num_cnic_queues); | |
| 7648 | 7817 | |
| 7649 | − bp->num_queues = 1 + NON_ETH_CONTEXT_USE; | |
| 7818 | + bp->num_queues = 1 + bp->num_cnic_queues; | |
| 7650 | 7819 | |
| 7651 | 7820 | /* Try to enable MSI */ |
| 7652 | 7821 | if (!(bp->flags & USING_SINGLE_MSIX_FLAG) && |
| @@ -7679,9 +7848,9 @@ void bnx2x_ilt_set_info(struct bnx2x *bp) · 26 unmodified lines | ||
| 7679 | 7848 | ilt_client->flags = ILT_CLIENT_SKIP_MEM; |
| 7680 | 7849 | ilt_client->start = line; |
| 7681 | 7850 | line += bnx2x_cid_ilt_lines(bp); |
| 7682 | −#ifdef BCM_CNIC | |
| 7683 | − line += CNIC_ILT_LINES; | |
| 7684 | −#endif | |
| 7851 | + | |
| 7852 | + if (CNIC_SUPPORT(bp)) | |
| 7853 | + line += CNIC_ILT_LINES; | |
| 7685 | 7854 | ilt_client->end = line - 1; |
| 7686 | 7855 | |
| 7687 | 7856 | DP(NETIF_MSG_IFUP, "ilt client[CDU]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", |
| @@ -7714,49 +7883,43 @@ void bnx2x_ilt_set_info(struct bnx2x *bp) · 26 unmodified lines | ||
| 7714 | 7883 | ilog2(ilt_client->page_size >> 12)); |
| 7715 | 7884 | |
| 7716 | 7885 | } |
| 7717 | − /* SRC */ | |
| 7718 | − ilt_client = &ilt->clients[ILT_CLIENT_SRC]; | |
| 7719 | −#ifdef BCM_CNIC | |
| 7720 | − ilt_client->client_num = ILT_CLIENT_SRC; | |
| 7721 | − ilt_client->page_size = SRC_ILT_PAGE_SZ; | |
| 7722 | − ilt_client->flags = 0; | |
| 7723 | − ilt_client->start = line; | |
| 7724 | − line += SRC_ILT_LINES; | |
| 7725 | − ilt_client->end = line - 1; | |
| 7726 | 7886 | |
| 7727 | − DP(NETIF_MSG_IFUP, | |
| 7728 | − "ilt client[SRC]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", | |
| 7729 | − ilt_client->start, | |
| 7730 | − ilt_client->end, | |
| 7731 | − ilt_client->page_size, | |
| 7732 | − ilt_client->flags, | |
| 7733 | − ilog2(ilt_client->page_size >> 12)); | |
| 7887 | + if (CNIC_SUPPORT(bp)) { | |
| 7888 | + /* SRC */ | |
| 7889 | + ilt_client = &ilt->clients[ILT_CLIENT_SRC]; | |
| 7890 | + ilt_client->client_num = ILT_CLIENT_SRC; | |
| 7891 | + ilt_client->page_size = SRC_ILT_PAGE_SZ; | |
| 7892 | + ilt_client->flags = 0; | |
| 7893 | + ilt_client->start = line; | |
| 7894 | + line += SRC_ILT_LINES; | |
| 7895 | + ilt_client->end = line - 1; | |
| 7734 | 7896 | |
| 7735 | −#else | |
| 7736 | − ilt_client->flags = (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM); | |
| 7737 | −#endif | |
| 7897 | + DP(NETIF_MSG_IFUP, | |
| 7898 | + "ilt client[SRC]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", | |
| 7899 | + ilt_client->start, | |
| 7900 | + ilt_client->end, | |
| 7901 | + ilt_client->page_size, | |
| 7902 | + ilt_client->flags, | |
| 7903 | + ilog2(ilt_client->page_size >> 12)); | |
| 7738 | 7904 | |
| 7739 | − /* TM */ | |
| 7740 | − ilt_client = &ilt->clients[ILT_CLIENT_TM]; | |
| 7741 | −#ifdef BCM_CNIC | |
| 7742 | − ilt_client->client_num = ILT_CLIENT_TM; | |
| 7743 | − ilt_client->page_size = TM_ILT_PAGE_SZ; | |
| 7744 | − ilt_client->flags = 0; | |
| 7745 | − ilt_client->start = line; | |
| 7746 | − line += TM_ILT_LINES; | |
| 7747 | − ilt_client->end = line - 1; | |
| 7905 | + /* TM */ | |
| 7906 | + ilt_client = &ilt->clients[ILT_CLIENT_TM]; | |
| 7907 | + ilt_client->client_num = ILT_CLIENT_TM; | |
| 7908 | + ilt_client->page_size = TM_ILT_PAGE_SZ; | |
| 7909 | + ilt_client->flags = 0; | |
| 7910 | + ilt_client->start = line; | |
| 7911 | + line += TM_ILT_LINES; | |
| 7912 | + ilt_client->end = line - 1; | |
| 7748 | 7913 | |
| 7749 | − DP(NETIF_MSG_IFUP, | |
| 7750 | − "ilt client[TM]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", | |
| 7751 | − ilt_client->start, | |
| 7752 | − ilt_client->end, | |
| 7753 | − ilt_client->page_size, | |
| 7754 | − ilt_client->flags, | |
| 7755 | − ilog2(ilt_client->page_size >> 12)); | |
| 7914 | + DP(NETIF_MSG_IFUP, | |
| 7915 | + "ilt client[TM]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", | |
| 7916 | + ilt_client->start, | |
| 7917 | + ilt_client->end, | |
| 7918 | + ilt_client->page_size, | |
| 7919 | + ilt_client->flags, | |
| 7920 | + ilog2(ilt_client->page_size >> 12)); | |
| 7921 | + } | |
| 7756 | 7922 | |
| 7757 | −#else | |
| 7758 | − ilt_client->flags = (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM); | |
| 7759 | −#endif | |
| 7760 | 7923 | BUG_ON(line > ILT_MAX_LINES); |
| 7761 | 7924 | } |
| 7762 | 7925 | |
| @@ -7823,7 +7986,7 @@ static void bnx2x_pf_q_prep_init(struct bnx2x *bp, · 60 unmodified lines | ||
| 7823 | 7986 | } |
| 7824 | 7987 | } |
| 7825 | 7988 | |
| 7826 | −int bnx2x_setup_tx_only(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |
| 7989 | +static int bnx2x_setup_tx_only(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |
| 7827 | 7990 | struct bnx2x_queue_state_params *q_params, |
| 7828 | 7991 | struct bnx2x_queue_setup_tx_only_params *tx_only_params, |
| 7829 | 7992 | int tx_index, bool leading) |
| @@ -7924,6 +8087,9 @@ int bnx2x_setup_queue(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 94 unmodified lines | ||
| 7924 | 8087 | /* Set the command */ |
| 7925 | 8088 | q_params.cmd = BNX2X_Q_CMD_SETUP; |
| 7926 | 8089 | |
| 8090 | + if (IS_FCOE_FP(fp)) | |
| 8091 | + bp->fcoe_init = true; | |
| 8092 | + | |
| 7927 | 8093 | /* Change the state to SETUP */ |
| 7928 | 8094 | rc = bnx2x_queue_state_change(bp, &q_params); |
| 7929 | 8095 | if (rc) { |
| @@ -8037,12 +8203,12 @@ static void bnx2x_reset_func(struct bnx2x *bp) · 107 unmodified lines | ||
| 8037 | 8203 | SB_DISABLED); |
| 8038 | 8204 | } |
| 8039 | 8205 | |
| 8040 | −#ifdef BCM_CNIC | |
| 8041 | − /* CNIC SB */ | |
| 8042 | − REG_WR8(bp, BAR_CSTRORM_INTMEM + | |
| 8043 | − CSTORM_STATUS_BLOCK_DATA_STATE_OFFSET(bnx2x_cnic_fw_sb_id(bp)), | |
| 8044 | − SB_DISABLED); | |
| 8045 | −#endif | |
| 8206 | + if (CNIC_LOADED(bp)) | |
| 8207 | + /* CNIC SB */ | |
| 8208 | + REG_WR8(bp, BAR_CSTRORM_INTMEM + | |
| 8209 | + CSTORM_STATUS_BLOCK_DATA_STATE_OFFSET | |
| 8210 | + (bnx2x_cnic_fw_sb_id(bp)), SB_DISABLED); | |
| 8211 | + | |
| 8046 | 8212 | /* SP SB */ |
| 8047 | 8213 | REG_WR8(bp, BAR_CSTRORM_INTMEM + |
| 8048 | 8214 | CSTORM_SP_STATUS_BLOCK_DATA_STATE_OFFSET(func), |
| @@ -8061,19 +8227,19 @@ static void bnx2x_reset_func(struct bnx2x *bp) · 12 unmodified lines | ||
| 8061 | 8227 | REG_WR(bp, IGU_REG_TRAILING_EDGE_LATCH, 0); |
| 8062 | 8228 | } |
| 8063 | 8229 | |
| 8064 | −#ifdef BCM_CNIC | |
| 8065 | − /* Disable Timer scan */ | |
| 8066 | − REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 0); | |
| 8067 | − /* | |
| 8068 | − * Wait for at least 10ms and up to 2 second for the timers scan to | |
| 8069 | − * complete | |
| 8070 | − */ | |
| 8071 | − for (i = 0; i < 200; i++) { | |
| 8072 | − msleep(10); | |
| 8073 | − if (!REG_RD(bp, TM_REG_LIN0_SCAN_ON + port*4)) | |
| 8074 | − break; | |
| 8230 | + if (CNIC_LOADED(bp)) { | |
| 8231 | + /* Disable Timer scan */ | |
| 8232 | + REG_WR(bp, TM_REG_EN_LINEAR0_TIMER + port*4, 0); | |
| 8233 | + /* | |
| 8234 | + * Wait for at least 10ms and up to 2 second for the timers | |
| 8235 | + * scan to complete | |
| 8236 | + */ | |
| 8237 | + for (i = 0; i < 200; i++) { | |
| 8238 | + msleep(10); | |
| 8239 | + if (!REG_RD(bp, TM_REG_LIN0_SCAN_ON + port*4)) | |
| 8240 | + break; | |
| 8241 | + } | |
| 8075 | 8242 | } |
| 8076 | −#endif | |
| 8077 | 8243 | /* Clear ILT */ |
| 8078 | 8244 | bnx2x_clear_func_ilt(bp, func); |
| 8079 | 8245 | |
| @@ -8409,13 +8575,24 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link) · 329 unmodified lines | ||
| 8409 | 8575 | /* Close multi and leading connections |
| 8410 | 8576 | * Completions for ramrods are collected in a synchronous way |
| 8411 | 8577 | */ |
| 8412 | − for_each_queue(bp, i) | |
| 8578 | + for_each_eth_queue(bp, i) | |
| 8413 | 8579 | if (bnx2x_stop_queue(bp, i)) |
| 8414 | 8580 | #ifdef BNX2X_STOP_ON_ERROR |
| 8415 | 8581 | return; |
| 8416 | 8582 | #else |
| 8417 | 8583 | goto unload_error; |
| 8418 | 8584 | #endif |
| 8585 | + | |
| 8586 | + if (CNIC_LOADED(bp)) { | |
| 8587 | + for_each_cnic_queue(bp, i) | |
| 8588 | + if (bnx2x_stop_queue(bp, i)) | |
| 8589 | +#ifdef BNX2X_STOP_ON_ERROR | |
| 8590 | + return; | |
| 8591 | +#else | |
| 8592 | + goto unload_error; | |
| 8593 | +#endif | |
| 8594 | + } | |
| 8595 | + | |
| 8419 | 8596 | /* If SP settings didn't get completed so far - something |
| 8420 | 8597 | * very wrong has happen. |
| 8421 | 8598 | */ |
| @@ -8437,6 +8614,8 @@ unload_error: · 15 unmodified lines | ||
| 8437 | 8614 | bnx2x_netif_stop(bp, 1); |
| 8438 | 8615 | /* Delete all NAPI objects */ |
| 8439 | 8616 | bnx2x_del_all_napi(bp); |
| 8617 | + if (CNIC_LOADED(bp)) | |
| 8618 | + bnx2x_del_all_napi_cnic(bp); | |
| 8440 | 8619 | |
| 8441 | 8620 | /* Release IRQs */ |
| 8442 | 8621 | bnx2x_free_irq(bp); |
| @@ -8558,7 +8737,8 @@ static void bnx2x_reset_mcp_prep(struct bnx2x *bp, u32 *magic_val) · 115 unmodified lines | ||
| 8558 | 8737 | |
| 8559 | 8738 | /* Get shmem offset */ |
| 8560 | 8739 | shmem = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); |
| 8561 | − validity_offset = offsetof(struct shmem_region, validity_map[0]); | |
| 8740 | + validity_offset = | |
| 8741 | + offsetof(struct shmem_region, validity_map[BP_PORT(bp)]); | |
| 8562 | 8742 | |
| 8563 | 8743 | /* Clear validity map flags */ |
| 8564 | 8744 | if (shmem > 0) |
| @@ -8651,7 +8831,11 @@ static void bnx2x_process_kill_chip_reset(struct bnx2x *bp, bool global) · 86 unmodified lines | ||
| 8651 | 8831 | MISC_REGISTERS_RESET_REG_2_RST_MCP_N_RESET_CMN_CPU | |
| 8652 | 8832 | MISC_REGISTERS_RESET_REG_2_RST_MCP_N_RESET_CMN_CORE; |
| 8653 | 8833 | |
| 8654 | − /* Don't reset the following blocks */ | |
| 8834 | + /* Don't reset the following blocks. | |
| 8835 | + * Important: per port blocks (such as EMAC, BMAC, UMAC) can't be | |
| 8836 | + * reset, as in 4 port device they might still be owned | |
| 8837 | + * by the MCP (there is only one leader per path). | |
| 8838 | + */ | |
| 8655 | 8839 | not_reset_mask1 = |
| 8656 | 8840 | MISC_REGISTERS_RESET_REG_1_RST_HC | |
| 8657 | 8841 | MISC_REGISTERS_RESET_REG_1_RST_PXPV | |
| @@ -8667,19 +8851,19 @@ static void bnx2x_process_kill_chip_reset(struct bnx2x *bp, bool global) · 9 unmodified lines | ||
| 8667 | 8851 | MISC_REGISTERS_RESET_REG_2_RST_MCP_N_RESET_REG_HARD_CORE | |
| 8668 | 8852 | MISC_REGISTERS_RESET_REG_2_RST_MCP_N_HARD_CORE_RST_B | |
| 8669 | 8853 | MISC_REGISTERS_RESET_REG_2_RST_ATC | |
| 8670 | − MISC_REGISTERS_RESET_REG_2_PGLC; | |
| 8854 | + MISC_REGISTERS_RESET_REG_2_PGLC | | |
| 8855 | + MISC_REGISTERS_RESET_REG_2_RST_BMAC0 | | |
| 8856 | + MISC_REGISTERS_RESET_REG_2_RST_BMAC1 | | |
| 8857 | + MISC_REGISTERS_RESET_REG_2_RST_EMAC0 | | |
| 8858 | + MISC_REGISTERS_RESET_REG_2_RST_EMAC1 | | |
| 8859 | + MISC_REGISTERS_RESET_REG_2_UMAC0 | | |
| 8860 | + MISC_REGISTERS_RESET_REG_2_UMAC1; | |
| 8671 | 8861 | |
| 8672 | 8862 | /* |
| 8673 | 8863 | * Keep the following blocks in reset: |
| 8674 | 8864 | * - all xxMACs are handled by the bnx2x_link code. |
| 8675 | 8865 | */ |
| 8676 | 8866 | stay_reset2 = |
| 8677 | − MISC_REGISTERS_RESET_REG_2_RST_BMAC0 | | |
| 8678 | − MISC_REGISTERS_RESET_REG_2_RST_BMAC1 | | |
| 8679 | − MISC_REGISTERS_RESET_REG_2_RST_EMAC0 | | |
| 8680 | − MISC_REGISTERS_RESET_REG_2_RST_EMAC1 | | |
| 8681 | − MISC_REGISTERS_RESET_REG_2_UMAC0 | | |
| 8682 | − MISC_REGISTERS_RESET_REG_2_UMAC1 | | |
| 8683 | 8867 | MISC_REGISTERS_RESET_REG_2_XMAC | |
| 8684 | 8868 | MISC_REGISTERS_RESET_REG_2_XMAC_SOFT; |
| 8685 | 8869 | |
| @@ -8769,6 +8953,7 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global) · 83 unmodified lines | ||
| 8769 | 8953 | int cnt = 1000; |
| 8770 | 8954 | u32 val = 0; |
| 8771 | 8955 | u32 sr_cnt, blk_cnt, port_is_idle_0, port_is_idle_1, pgl_exp_rom2; |
| 8956 | + u32 tags_63_32 = 0; | |
| 8772 | 8957 | |
| 8773 | 8958 | |
| 8774 | 8959 | /* Empty the Tetris buffer, wait for 1s */ |
| @@ -8778,10 +8963,14 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global) · 3 unmodified lines | ||
| 8778 | 8963 | port_is_idle_0 = REG_RD(bp, PXP2_REG_RD_PORT_IS_IDLE_0); |
| 8779 | 8964 | port_is_idle_1 = REG_RD(bp, PXP2_REG_RD_PORT_IS_IDLE_1); |
| 8780 | 8965 | pgl_exp_rom2 = REG_RD(bp, PXP2_REG_PGL_EXP_ROM2); |
| 8966 | + if (CHIP_IS_E3(bp)) | |
| 8967 | + tags_63_32 = REG_RD(bp, PGLUE_B_REG_TAGS_63_32); | |
| 8968 | + | |
| 8781 | 8969 | if ((sr_cnt == 0x7e) && (blk_cnt == 0xa0) && |
| 8782 | 8970 | ((port_is_idle_0 & 0x1) == 0x1) && |
| 8783 | 8971 | ((port_is_idle_1 & 0x1) == 0x1) && |
| 8784 | − (pgl_exp_rom2 == 0xffffffff)) | |
| 8972 | + (pgl_exp_rom2 == 0xffffffff) && | |
| 8973 | + (!CHIP_IS_E3(bp) || (tags_63_32 == 0xffffffff))) | |
| 8785 | 8974 | break; |
| 8786 | 8975 | usleep_range(1000, 1000); |
| 8787 | 8976 | } while (cnt-- > 0); |
| @@ -8838,9 +9027,6 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global) · 50 unmodified lines | ||
| 8838 | 9027 | |
| 8839 | 9028 | /* TBD: Add resetting the NO_MCP mode DB here */ |
| 8840 | 9029 | |
| 8841 | − /* PXP */ | |
| 8842 | − bnx2x_pxp_prep(bp); | |
| 8843 | − | |
| 8844 | 9030 | /* Open the gates #2, #3 and #4 */ |
| 8845 | 9031 | bnx2x_set_234_gates(bp, false); |
| 8846 | 9032 | |
| @@ -8850,7 +9036,7 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global) · 3 unmodified lines | ||
| 8850 | 9036 | return 0; |
| 8851 | 9037 | } |
| 8852 | 9038 | |
| 8853 | −int bnx2x_leader_reset(struct bnx2x *bp) | |
| 9039 | +static int bnx2x_leader_reset(struct bnx2x *bp) | |
| 8854 | 9040 | { |
| 8855 | 9041 | int rc = 0; |
| 8856 | 9042 | bool global = bnx2x_reset_is_global(bp); |
| @@ -9234,7 +9420,7 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp) · 377 unmodified lines | ||
| 9234 | 9420 | bnx2x_undi_int_disable_e1h(bp); |
| 9235 | 9421 | } |
| 9236 | 9422 | |
| 9237 | −static void __devinit bnx2x_prev_unload_close_mac(struct bnx2x *bp) | |
| 9423 | +static void bnx2x_prev_unload_close_mac(struct bnx2x *bp) | |
| 9238 | 9424 | { |
| 9239 | 9425 | u32 val, base_addr, offset, mask, reset_reg; |
| 9240 | 9426 | bool mac_stopped = false; |
| @@ -9301,8 +9487,7 @@ static void __devinit bnx2x_prev_unload_close_mac(struct bnx2x *bp) · 60 unmodified lines | ||
| 9301 | 9487 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) |
| 9302 | 9488 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) |
| 9303 | 9489 | |
| 9304 | −static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, | |
| 9305 | − u8 inc) | |
| 9490 | +static void bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, u8 inc) | |
| 9306 | 9491 | { |
| 9307 | 9492 | u16 rcq, bd; |
| 9308 | 9493 | u32 tmp_reg = REG_RD(bp, BNX2X_PREV_UNDI_PROD_ADDR(port)); |
| @@ -9317,7 +9502,7 @@ static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, · 8 unmodified lines | ||
| 9317 | 9502 | port, bd, rcq); |
| 9318 | 9503 | } |
| 9319 | 9504 | |
| 9320 | −static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp) | |
| 9505 | +static int bnx2x_prev_mcp_done(struct bnx2x *bp) | |
| 9321 | 9506 | { |
| 9322 | 9507 | u32 rc = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, |
| 9323 | 9508 | DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET); |
| @@ -9329,7 +9514,21 @@ static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp) · 5 unmodified lines | ||
| 9329 | 9514 | return 0; |
| 9330 | 9515 | } |
| 9331 | 9516 | |
| 9332 | −static bool __devinit bnx2x_prev_is_path_marked(struct bnx2x *bp) | |
| 9517 | +static struct bnx2x_prev_path_list * | |
| 9518 | + bnx2x_prev_path_get_entry(struct bnx2x *bp) | |
| 9519 | +{ | |
| 9520 | + struct bnx2x_prev_path_list *tmp_list; | |
| 9521 | + | |
| 9522 | + list_for_each_entry(tmp_list, &bnx2x_prev_list, list) | |
| 9523 | + if (PCI_SLOT(bp->pdev->devfn) == tmp_list->slot && | |
| 9524 | + bp->pdev->bus->number == tmp_list->bus && | |
| 9525 | + BP_PATH(bp) == tmp_list->path) | |
| 9526 | + return tmp_list; | |
| 9527 | + | |
| 9528 | + return NULL; | |
| 9529 | +} | |
| 9530 | + | |
| 9531 | +static bool bnx2x_prev_is_path_marked(struct bnx2x *bp) | |
| 9333 | 9532 | { |
| 9334 | 9533 | struct bnx2x_prev_path_list *tmp_list; |
| 9335 | 9534 | int rc = false; |
| @@ -9353,7 +9552,7 @@ static bool __devinit bnx2x_prev_is_path_marked(struct bnx2x *bp) · 17 unmodified lines | ||
| 9353 | 9552 | return rc; |
| 9354 | 9553 | } |
| 9355 | 9554 | |
| 9356 | −static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp) | |
| 9555 | +static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi) | |
| 9357 | 9556 | { |
| 9358 | 9557 | struct bnx2x_prev_path_list *tmp_list; |
| 9359 | 9558 | int rc; |
| @@ -9367,6 +9566,7 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp) · 7 unmodified lines | ||
| 9367 | 9566 | tmp_list->bus = bp->pdev->bus->number; |
| 9368 | 9567 | tmp_list->slot = PCI_SLOT(bp->pdev->devfn); |
| 9369 | 9568 | tmp_list->path = BP_PATH(bp); |
| 9569 | + tmp_list->undi = after_undi ? (1 << BP_PORT(bp)) : 0; | |
| 9370 | 9570 | |
| 9371 | 9571 | rc = down_interruptible(&bnx2x_prev_sem); |
| 9372 | 9572 | if (rc) { |
| @@ -9382,7 +9582,7 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp) · 9 unmodified lines | ||
| 9382 | 9582 | return rc; |
| 9383 | 9583 | } |
| 9384 | 9584 | |
| 9385 | −static int __devinit bnx2x_do_flr(struct bnx2x *bp) | |
| 9585 | +static int bnx2x_do_flr(struct bnx2x *bp) | |
| 9386 | 9586 | { |
| 9387 | 9587 | int i; |
| 9388 | 9588 | u16 status; |
| @@ -9422,7 +9622,7 @@ clear: · 33 unmodified lines | ||
| 9422 | 9622 | return 0; |
| 9423 | 9623 | } |
| 9424 | 9624 | |
| 9425 | −static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp) | |
| 9625 | +static int bnx2x_prev_unload_uncommon(struct bnx2x *bp) | |
| 9426 | 9626 | { |
| 9427 | 9627 | int rc; |
| 9428 | 9628 | |
| @@ -9460,9 +9660,10 @@ static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp) · 31 unmodified lines | ||
| 9460 | 9660 | return rc; |
| 9461 | 9661 | } |
| 9462 | 9662 | |
| 9463 | −static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) | |
| 9663 | +static int bnx2x_prev_unload_common(struct bnx2x *bp) | |
| 9464 | 9664 | { |
| 9465 | 9665 | u32 reset_reg, tmp_reg = 0, rc; |
| 9666 | + bool prev_undi = false; | |
| 9466 | 9667 | /* It is possible a previous function received 'common' answer, |
| 9467 | 9668 | * but hasn't loaded yet, therefore creating a scenario of |
| 9468 | 9669 | * multiple functions receiving 'common' on the same path. |
| @@ -9477,7 +9678,6 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) · 8 unmodified lines | ||
| 9477 | 9678 | /* Reset should be performed after BRB is emptied */ |
| 9478 | 9679 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { |
| 9479 | 9680 | u32 timer_count = 1000; |
| 9480 | − bool prev_undi = false; | |
| 9481 | 9681 | |
| 9482 | 9682 | /* Close the MAC Rx to prevent BRB from filling up */ |
| 9483 | 9683 | bnx2x_prev_unload_close_mac(bp); |
| @@ -9527,7 +9727,7 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) · 43 unmodified lines | ||
| 9527 | 9727 | /* No packets are in the pipeline, path is ready for reset */ |
| 9528 | 9728 | bnx2x_reset_common(bp); |
| 9529 | 9729 | |
| 9530 | − rc = bnx2x_prev_mark_path(bp); | |
| 9730 | + rc = bnx2x_prev_mark_path(bp, prev_undi); | |
| 9531 | 9731 | if (rc) { |
| 9532 | 9732 | bnx2x_prev_mcp_done(bp); |
| 9533 | 9733 | return rc; |
| @@ -9543,7 +9743,7 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) · 9 unmodified lines | ||
| 9543 | 9743 | * to clear the interrupt which detected this from the pglueb and the was done |
| 9544 | 9744 | * bit |
| 9545 | 9745 | */ |
| 9546 | −static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp) | |
| 9746 | +static void bnx2x_prev_interrupted_dmae(struct bnx2x *bp) | |
| 9547 | 9747 | { |
| 9548 | 9748 | if (!CHIP_IS_E1x(bp)) { |
| 9549 | 9749 | u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS); |
| @@ -9555,10 +9755,11 @@ static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp) · 5 unmodified lines | ||
| 9555 | 9755 | } |
| 9556 | 9756 | } |
| 9557 | 9757 | |
| 9558 | −static int __devinit bnx2x_prev_unload(struct bnx2x *bp) | |
| 9758 | +static int bnx2x_prev_unload(struct bnx2x *bp) | |
| 9559 | 9759 | { |
| 9560 | 9760 | int time_counter = 10; |
| 9561 | 9761 | u32 rc, fw, hw_lock_reg, hw_lock_val; |
| 9762 | + struct bnx2x_prev_path_list *prev_list; | |
| 9562 | 9763 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); |
| 9563 | 9764 | |
| 9564 | 9765 | /* clear hw from errors which may have resulted from an interrupted |
| @@ -9617,12 +9818,18 @@ static int __devinit bnx2x_prev_unload(struct bnx2x *bp) · 52 unmodified lines | ||
| 9617 | 9818 | rc = -EBUSY; |
| 9618 | 9819 | } |
| 9619 | 9820 | |
| 9821 | + /* Mark function if its port was used to boot from SAN */ | |
| 9822 | + prev_list = bnx2x_prev_path_get_entry(bp); | |
| 9823 | + if (prev_list && (prev_list->undi & (1 << BP_PORT(bp)))) | |
| 9824 | + bp->link_params.feature_config_flags |= | |
| 9825 | + FEATURE_CONFIG_BOOT_FROM_SAN; | |
| 9826 | + | |
| 9620 | 9827 | BNX2X_DEV_INFO("Finished Previous Unload Flow [%d]\n", rc); |
| 9621 | 9828 | |
| 9622 | 9829 | return rc; |
| 9623 | 9830 | } |
| 9624 | 9831 | |
| 9625 | −static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) | |
| 9832 | +static void bnx2x_get_common_hwinfo(struct bnx2x *bp) | |
| 9626 | 9833 | { |
| 9627 | 9834 | u32 val, val2, val3, val4, id, boot_mode; |
| 9628 | 9835 | u16 pmc; |
| @@ -9701,6 +9908,14 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) · 72 unmodified lines | ||
| 9701 | 9908 | |
| 9702 | 9909 | bp->link_params.shmem_base = bp->common.shmem_base; |
| 9703 | 9910 | bp->link_params.shmem2_base = bp->common.shmem2_base; |
| 9911 | + if (SHMEM2_RD(bp, size) > | |
| 9912 | + (u32)offsetof(struct shmem2_region, lfa_host_addr[BP_PORT(bp)])) | |
| 9913 | + bp->link_params.lfa_base = | |
| 9914 | + REG_RD(bp, bp->common.shmem2_base + | |
| 9915 | + (u32)offsetof(struct shmem2_region, | |
| 9916 | + lfa_host_addr[BP_PORT(bp)])); | |
| 9917 | + else | |
| 9918 | + bp->link_params.lfa_base = 0; | |
| 9704 | 9919 | BNX2X_DEV_INFO("shmem offset 0x%x shmem2 offset 0x%x\n", |
| 9705 | 9920 | bp->common.shmem_base, bp->common.shmem2_base); |
| 9706 | 9921 | |
| @@ -9748,6 +9963,11 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) · 41 unmodified lines | ||
| 9748 | 9963 | bp->link_params.feature_config_flags |= |
| 9749 | 9964 | (val >= REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED) ? |
| 9750 | 9965 | FEATURE_CONFIG_BC_SUPPORTS_SFP_TX_DISABLED : 0; |
| 9966 | + | |
| 9967 | + bp->link_params.feature_config_flags |= | |
| 9968 | + (val >= REQ_BC_VER_4_MT_SUPPORTED) ? | |
| 9969 | + FEATURE_CONFIG_MT_SUPPORT : 0; | |
| 9970 | + | |
| 9751 | 9971 | bp->flags |= (val >= REQ_BC_VER_4_PFC_STATS_SUPPORTED) ? |
| 9752 | 9972 | BC_SUPPORTS_PFC_STATS : 0; |
| 9753 | 9973 | |
| @@ -9792,7 +10012,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) · 38 unmodified lines | ||
| 9792 | 10012 | #define IGU_FID(val) GET_FIELD((val), IGU_REG_MAPPING_MEMORY_FID) |
| 9793 | 10013 | #define IGU_VEC(val) GET_FIELD((val), IGU_REG_MAPPING_MEMORY_VECTOR) |
| 9794 | 10014 | |
| 9795 | −static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) | |
| 10015 | +static int bnx2x_get_igu_cam_info(struct bnx2x *bp) | |
| 9796 | 10016 | { |
| 9797 | 10017 | int pfid = BP_FUNC(bp); |
| 9798 | 10018 | int igu_sb_id; |
| @@ -9809,7 +10029,7 @@ static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) · 10 unmodified lines | ||
| 9809 | 10029 | bp->igu_dsb_id = E1HVN_MAX * FP_SB_MAX_E1x + |
| 9810 | 10030 | (CHIP_MODE_IS_4_PORT(bp) ? pfid : vn); |
| 9811 | 10031 | |
| 9812 | − return; | |
| 10032 | + return 0; | |
| 9813 | 10033 | } |
| 9814 | 10034 | |
| 9815 | 10035 | /* IGU in normal mode - read CAM */ |
| @@ -9843,12 +10063,15 @@ static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) · 27 unmodified lines | ||
| 9843 | 10063 | bp->igu_sb_cnt = min_t(int, bp->igu_sb_cnt, igu_sb_cnt); |
| 9844 | 10064 | #endif |
| 9845 | 10065 | |
| 9846 | − if (igu_sb_cnt == 0) | |
| 10066 | + if (igu_sb_cnt == 0) { | |
| 9847 | 10067 | BNX2X_ERR("CAM configuration error\n"); |
| 10068 | + return -EINVAL; | |
| 10069 | + } | |
| 10070 | + | |
| 10071 | + return 0; | |
| 9848 | 10072 | } |
| 9849 | 10073 | |
| 9850 | −static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp, | |
| 9851 | − u32 switch_cfg) | |
| 10074 | +static void bnx2x_link_settings_supported(struct bnx2x *bp, u32 switch_cfg) | |
| 9852 | 10075 | { |
| 9853 | 10076 | int cfg_size = 0, idx, port = BP_PORT(bp); |
| 9854 | 10077 | |
| @@ -9946,7 +10169,7 @@ static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp, · 91 unmodified lines | ||
| 9946 | 10169 | bp->port.supported[1]); |
| 9947 | 10170 | } |
| 9948 | 10171 | |
| 9949 | −static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp) | |
| 10172 | +static void bnx2x_link_settings_requested(struct bnx2x *bp) | |
| 9950 | 10173 | { |
| 9951 | 10174 | u32 link_config, idx, cfg_size = 0; |
| 9952 | 10175 | bp->port.advertising[0] = 0; |
| @@ -10115,11 +10338,13 @@ static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp) · 162 unmodified lines | ||
| 10115 | 10338 | |
| 10116 | 10339 | bp->link_params.req_flow_ctrl[idx] = (link_config & |
| 10117 | 10340 | PORT_FEATURE_FLOW_CONTROL_MASK); |
| 10118 | − if ((bp->link_params.req_flow_ctrl[idx] == | |
| 10119 | − BNX2X_FLOW_CTRL_AUTO) && | |
| 10120 | − !(bp->port.supported[idx] & SUPPORTED_Autoneg)) { | |
| 10121 | − bp->link_params.req_flow_ctrl[idx] = | |
| 10122 | − BNX2X_FLOW_CTRL_NONE; | |
| 10341 | + if (bp->link_params.req_flow_ctrl[idx] == | |
| 10342 | + BNX2X_FLOW_CTRL_AUTO) { | |
| 10343 | + if (!(bp->port.supported[idx] & SUPPORTED_Autoneg)) | |
| 10344 | + bp->link_params.req_flow_ctrl[idx] = | |
| 10345 | + BNX2X_FLOW_CTRL_NONE; | |
| 10346 | + else | |
| 10347 | + bnx2x_set_requested_fc(bp); | |
| 10123 | 10348 | } |
| 10124 | 10349 | |
| 10125 | 10350 | BNX2X_DEV_INFO("req_line_speed %d req_duplex %d req_flow_ctrl 0x%x advertising 0x%x\n", |
| @@ -10130,7 +10355,7 @@ static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp) · 4 unmodified lines | ||
| 10130 | 10355 | } |
| 10131 | 10356 | } |
| 10132 | 10357 | |
| 10133 | −static void __devinit bnx2x_set_mac_buf(u8 *mac_buf, u32 mac_lo, u16 mac_hi) | |
| 10358 | +static void bnx2x_set_mac_buf(u8 *mac_buf, u32 mac_lo, u16 mac_hi) | |
| 10134 | 10359 | { |
| 10135 | 10360 | mac_hi = cpu_to_be16(mac_hi); |
| 10136 | 10361 | mac_lo = cpu_to_be32(mac_lo); |
| @@ -10138,7 +10363,7 @@ static void __devinit bnx2x_set_mac_buf(u8 *mac_buf, u32 mac_lo, u16 mac_hi) · 1 unmodified line | ||
| 10138 | 10363 | memcpy(mac_buf + sizeof(mac_hi), &mac_lo, sizeof(mac_lo)); |
| 10139 | 10364 | } |
| 10140 | 10365 | |
| 10141 | −static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp) | |
| 10366 | +static void bnx2x_get_port_hwinfo(struct bnx2x *bp) | |
| 10142 | 10367 | { |
| 10143 | 10368 | int port = BP_PORT(bp); |
| 10144 | 10369 | u32 config; |
| @@ -10199,17 +10424,6 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp) · 54 unmodified lines | ||
| 10199 | 10424 | bp->mdio.prtad = |
| 10200 | 10425 | XGXS_EXT_PHY_ADDR(ext_phy_config); |
| 10201 | 10426 | |
| 10202 | − /* | |
| 10203 | − * Check if hw lock is required to access MDC/MDIO bus to the PHY(s) | |
| 10204 | − * In MF mode, it is set to cover self test cases | |
| 10205 | − */ | |
| 10206 | − if (IS_MF(bp)) | |
| 10207 | − bp->port.need_hw_lock = 1; | |
| 10208 | − else | |
| 10209 | − bp->port.need_hw_lock = bnx2x_hw_lock_required(bp, | |
| 10210 | − bp->common.shmem_base, | |
| 10211 | − bp->common.shmem2_base); | |
| 10212 | − | |
| 10213 | 10427 | /* Configure link feature according to nvram value */ |
| 10214 | 10428 | eee_mode = (((SHMEM_RD(bp, dev_info. |
| 10215 | 10429 | port_feature_config[port].eee_power_mode)) & |
| @@ -10227,12 +10441,15 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp) · 11 unmodified lines | ||
| 10227 | 10441 | void bnx2x_get_iscsi_info(struct bnx2x *bp) |
| 10228 | 10442 | { |
| 10229 | 10443 | u32 no_flags = NO_ISCSI_FLAG; |
| 10230 | −#ifdef BCM_CNIC | |
| 10231 | 10444 | int port = BP_PORT(bp); |
| 10232 | − | |
| 10233 | 10445 | u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, |
| 10234 | 10446 | drv_lic_key[port].max_iscsi_conn); |
| 10235 | 10447 | |
| 10448 | + if (!CNIC_SUPPORT(bp)) { | |
| 10449 | + bp->flags |= no_flags; | |
| 10450 | + return; | |
| 10451 | + } | |
| 10452 | + | |
| 10236 | 10453 | /* Get the number of maximum allowed iSCSI connections */ |
| 10237 | 10454 | bp->cnic_eth_dev.max_iscsi_conn = |
| 10238 | 10455 | (max_iscsi_conn & BNX2X_MAX_ISCSI_INIT_CONN_MASK) >> |
| @@ -10247,13 +10464,10 @@ void bnx2x_get_iscsi_info(struct bnx2x *bp) · 8 unmodified lines | ||
| 10247 | 10464 | */ |
| 10248 | 10465 | if (!bp->cnic_eth_dev.max_iscsi_conn) |
| 10249 | 10466 | bp->flags |= no_flags; |
| 10250 | −#else | |
| 10251 | − bp->flags |= no_flags; | |
| 10252 | −#endif | |
| 10467 | + | |
| 10253 | 10468 | } |
| 10254 | 10469 | |
| 10255 | −#ifdef BCM_CNIC | |
| 10256 | −static void __devinit bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func) | |
| 10470 | +static void bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func) | |
| 10257 | 10471 | { |
| 10258 | 10472 | /* Port info */ |
| 10259 | 10473 | bp->cnic_eth_dev.fcoe_wwn_port_name_hi = |
| @@ -10267,16 +10481,18 @@ static void __devinit bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func) · 7 unmodified lines | ||
| 10267 | 10481 | bp->cnic_eth_dev.fcoe_wwn_node_name_lo = |
| 10268 | 10482 | MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower); |
| 10269 | 10483 | } |
| 10270 | −#endif | |
| 10271 | −static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp) | |
| 10484 | +static void bnx2x_get_fcoe_info(struct bnx2x *bp) | |
| 10272 | 10485 | { |
| 10273 | −#ifdef BCM_CNIC | |
| 10274 | 10486 | int port = BP_PORT(bp); |
| 10275 | 10487 | int func = BP_ABS_FUNC(bp); |
| 10276 | − | |
| 10277 | 10488 | u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, |
| 10278 | 10489 | drv_lic_key[port].max_fcoe_conn); |
| 10279 | 10490 | |
| 10491 | + if (!CNIC_SUPPORT(bp)) { | |
| 10492 | + bp->flags |= NO_FCOE_FLAG; | |
| 10493 | + return; | |
| 10494 | + } | |
| 10495 | + | |
| 10280 | 10496 | /* Get the number of maximum allowed FCoE connections */ |
| 10281 | 10497 | bp->cnic_eth_dev.max_fcoe_conn = |
| 10282 | 10498 | (max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >> |
| @@ -10311,8 +10527,9 @@ static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp) · 28 unmodified lines | ||
| 10311 | 10527 | if (BNX2X_MF_EXT_PROTOCOL_FCOE(bp) && !CHIP_IS_E1x(bp)) |
| 10312 | 10528 | bnx2x_get_ext_wwn_info(bp, func); |
| 10313 | 10529 | |
| 10314 | − } else if (IS_MF_FCOE_SD(bp)) | |
| 10530 | + } else if (IS_MF_FCOE_SD(bp) && !CHIP_IS_E1x(bp)) { | |
| 10315 | 10531 | bnx2x_get_ext_wwn_info(bp, func); |
| 10532 | + } | |
| 10316 | 10533 | |
| 10317 | 10534 | BNX2X_DEV_INFO("max_fcoe_conn 0x%x\n", bp->cnic_eth_dev.max_fcoe_conn); |
| 10318 | 10535 | |
| @@ -10322,12 +10539,9 @@ static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp) · 3 unmodified lines | ||
| 10322 | 10539 | */ |
| 10323 | 10540 | if (!bp->cnic_eth_dev.max_fcoe_conn) |
| 10324 | 10541 | bp->flags |= NO_FCOE_FLAG; |
| 10325 | −#else | |
| 10326 | − bp->flags |= NO_FCOE_FLAG; | |
| 10327 | −#endif | |
| 10328 | 10542 | } |
| 10329 | 10543 | |
| 10330 | −static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp) | |
| 10544 | +static void bnx2x_get_cnic_info(struct bnx2x *bp) | |
| 10331 | 10545 | { |
| 10332 | 10546 | /* |
| 10333 | 10547 | * iSCSI may be dynamically disabled but reading |
| @@ -10338,143 +10552,162 @@ static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp) · 4 unmodified lines | ||
| 10338 | 10552 | bnx2x_get_fcoe_info(bp); |
| 10339 | 10553 | } |
| 10340 | 10554 | |
| 10341 | −static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) | |
| 10555 | +static void bnx2x_get_cnic_mac_hwinfo(struct bnx2x *bp) | |
| 10342 | 10556 | { |
| 10343 | 10557 | u32 val, val2; |
| 10344 | 10558 | int func = BP_ABS_FUNC(bp); |
| 10345 | 10559 | int port = BP_PORT(bp); |
| 10346 | −#ifdef BCM_CNIC | |
| 10347 | 10560 | u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac; |
| 10348 | 10561 | u8 *fip_mac = bp->fip_mac; |
| 10349 | −#endif | |
| 10350 | 10562 | |
| 10351 | − /* Zero primary MAC configuration */ | |
| 10352 | − memset(bp->dev->dev_addr, 0, ETH_ALEN); | |
| 10353 | − | |
| 10354 | − if (BP_NOMCP(bp)) { | |
| 10355 | − BNX2X_ERROR("warning: random MAC workaround active\n"); | |
| 10356 | − eth_hw_addr_random(bp->dev); | |
| 10357 | − } else if (IS_MF(bp)) { | |
| 10358 | − val2 = MF_CFG_RD(bp, func_mf_config[func].mac_upper); | |
| 10359 | − val = MF_CFG_RD(bp, func_mf_config[func].mac_lower); | |
| 10360 | − if ((val2 != FUNC_MF_CFG_UPPERMAC_DEFAULT) && | |
| 10361 | − (val != FUNC_MF_CFG_LOWERMAC_DEFAULT)) | |
| 10362 | − bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); | |
| 10363 | − | |
| 10364 | −#ifdef BCM_CNIC | |
| 10365 | − /* | |
| 10366 | − * iSCSI and FCoE NPAR MACs: if there is no either iSCSI or | |
| 10563 | + if (IS_MF(bp)) { | |
| 10564 | + /* iSCSI and FCoE NPAR MACs: if there is no either iSCSI or | |
| 10367 | 10565 | * FCoE MAC then the appropriate feature should be disabled. |
| 10368 | − * | |
| 10369 | − * In non SD mode features configuration comes from | |
| 10370 | − * struct func_ext_config. | |
| 10566 | + * In non SD mode features configuration comes from struct | |
| 10567 | + * func_ext_config. | |
| 10371 | 10568 | */ |
| 10372 | − if (!IS_MF_SD(bp)) { | |
| 10569 | + if (!IS_MF_SD(bp) && !CHIP_IS_E1x(bp)) { | |
| 10373 | 10570 | u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); |
| 10374 | 10571 | if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) { |
| 10375 | 10572 | val2 = MF_CFG_RD(bp, func_ext_config[func]. |
| 10376 | − iscsi_mac_addr_upper); | |
| 10573 | + iscsi_mac_addr_upper); | |
| 10377 | 10574 | val = MF_CFG_RD(bp, func_ext_config[func]. |
| 10378 | − iscsi_mac_addr_lower); | |
| 10575 | + iscsi_mac_addr_lower); | |
| 10379 | 10576 | bnx2x_set_mac_buf(iscsi_mac, val, val2); |
| 10380 | − BNX2X_DEV_INFO("Read iSCSI MAC: %pM\n", | |
| 10381 | − iscsi_mac); | |
| 10382 | − } else | |
| 10577 | + BNX2X_DEV_INFO | |
| 10578 | + ("Read iSCSI MAC: %pM\n", iscsi_mac); | |
| 10579 | + } else { | |
| 10383 | 10580 | bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG; |
| 10581 | + } | |
| 10384 | 10582 | |
| 10385 | 10583 | if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) { |
| 10386 | 10584 | val2 = MF_CFG_RD(bp, func_ext_config[func]. |
| 10387 | − fcoe_mac_addr_upper); | |
| 10585 | + fcoe_mac_addr_upper); | |
| 10388 | 10586 | val = MF_CFG_RD(bp, func_ext_config[func]. |
| 10389 | − fcoe_mac_addr_lower); | |
| 10587 | + fcoe_mac_addr_lower); | |
| 10390 | 10588 | bnx2x_set_mac_buf(fip_mac, val, val2); |
| 10391 | − BNX2X_DEV_INFO("Read FCoE L2 MAC: %pM\n", | |
| 10392 | − fip_mac); | |
| 10393 | − | |
| 10394 | − } else | |
| 10589 | + BNX2X_DEV_INFO | |
| 10590 | + ("Read FCoE L2 MAC: %pM\n", fip_mac); | |
| 10591 | + } else { | |
| 10395 | 10592 | bp->flags |= NO_FCOE_FLAG; |
| 10593 | + } | |
| 10396 | 10594 | |
| 10397 | 10595 | bp->mf_ext_config = cfg; |
| 10398 | 10596 | |
| 10399 | 10597 | } else { /* SD MODE */ |
| 10400 | − if (IS_MF_STORAGE_SD(bp)) { | |
| 10401 | − if (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp)) { | |
| 10402 | − /* use primary mac as iscsi mac */ | |
| 10403 | − memcpy(iscsi_mac, bp->dev->dev_addr, | |
| 10404 | − ETH_ALEN); | |
| 10405 | − | |
| 10406 | − BNX2X_DEV_INFO("SD ISCSI MODE\n"); | |
| 10407 | − BNX2X_DEV_INFO("Read iSCSI MAC: %pM\n", | |
| 10408 | − iscsi_mac); | |
| 10409 | − } else { /* FCoE */ | |
| 10410 | − memcpy(fip_mac, bp->dev->dev_addr, | |
| 10411 | − ETH_ALEN); | |
| 10412 | − BNX2X_DEV_INFO("SD FCoE MODE\n"); | |
| 10413 | − BNX2X_DEV_INFO("Read FIP MAC: %pM\n", | |
| 10414 | − fip_mac); | |
| 10415 | − } | |
| 10416 | − /* Zero primary MAC configuration */ | |
| 10417 | − memset(bp->dev->dev_addr, 0, ETH_ALEN); | |
| 10598 | + if (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp)) { | |
| 10599 | + /* use primary mac as iscsi mac */ | |
| 10600 | + memcpy(iscsi_mac, bp->dev->dev_addr, ETH_ALEN); | |
| 10601 | + | |
| 10602 | + BNX2X_DEV_INFO("SD ISCSI MODE\n"); | |
| 10603 | + BNX2X_DEV_INFO | |
| 10604 | + ("Read iSCSI MAC: %pM\n", iscsi_mac); | |
| 10605 | + } else if (BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp)) { | |
| 10606 | + /* use primary mac as fip mac */ | |
| 10607 | + memcpy(fip_mac, bp->dev->dev_addr, ETH_ALEN); | |
| 10608 | + BNX2X_DEV_INFO("SD FCoE MODE\n"); | |
| 10609 | + BNX2X_DEV_INFO | |
| 10610 | + ("Read FIP MAC: %pM\n", fip_mac); | |
| 10418 | 10611 | } |
| 10419 | 10612 | } |
| 10420 | 10613 | |
| 10614 | + if (IS_MF_STORAGE_SD(bp)) | |
| 10615 | + /* Zero primary MAC configuration */ | |
| 10616 | + memset(bp->dev->dev_addr, 0, ETH_ALEN); | |
| 10617 | + | |
| 10421 | 10618 | if (IS_MF_FCOE_AFEX(bp)) |
| 10422 | 10619 | /* use FIP MAC as primary MAC */ |
| 10423 | 10620 | memcpy(bp->dev->dev_addr, fip_mac, ETH_ALEN); |
| 10424 | 10621 | |
| 10425 | −#endif | |
| 10426 | 10622 | } else { |
| 10427 | − /* in SF read MACs from port configuration */ | |
| 10428 | − val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_upper); | |
| 10429 | − val = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_lower); | |
| 10430 | − bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); | |
| 10431 | − | |
| 10432 | −#ifdef BCM_CNIC | |
| 10433 | 10623 | val2 = SHMEM_RD(bp, dev_info.port_hw_config[port]. |
| 10434 | − iscsi_mac_upper); | |
| 10624 | + iscsi_mac_upper); | |
| 10435 | 10625 | val = SHMEM_RD(bp, dev_info.port_hw_config[port]. |
| 10436 | − iscsi_mac_lower); | |
| 10626 | + iscsi_mac_lower); | |
| 10437 | 10627 | bnx2x_set_mac_buf(iscsi_mac, val, val2); |
| 10438 | 10628 | |
| 10439 | 10629 | val2 = SHMEM_RD(bp, dev_info.port_hw_config[port]. |
| 10440 | − fcoe_fip_mac_upper); | |
| 10630 | + fcoe_fip_mac_upper); | |
| 10441 | 10631 | val = SHMEM_RD(bp, dev_info.port_hw_config[port]. |
| 10442 | − fcoe_fip_mac_lower); | |
| 10632 | + fcoe_fip_mac_lower); | |
| 10443 | 10633 | bnx2x_set_mac_buf(fip_mac, val, val2); |
| 10444 | −#endif | |
| 10445 | 10634 | } |
| 10446 | 10635 | |
| 10447 | − memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN); | |
| 10448 | − memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); | |
| 10449 | − | |
| 10450 | −#ifdef BCM_CNIC | |
| 10451 | − /* Disable iSCSI if MAC configuration is | |
| 10452 | − * invalid. | |
| 10453 | − */ | |
| 10636 | + /* Disable iSCSI OOO if MAC configuration is invalid. */ | |
| 10454 | 10637 | if (!is_valid_ether_addr(iscsi_mac)) { |
| 10455 | − bp->flags |= NO_ISCSI_FLAG; | |
| 10638 | + bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG; | |
| 10456 | 10639 | memset(iscsi_mac, 0, ETH_ALEN); |
| 10457 | 10640 | } |
| 10458 | 10641 | |
| 10459 | − /* Disable FCoE if MAC configuration is | |
| 10460 | − * invalid. | |
| 10461 | − */ | |
| 10642 | + /* Disable FCoE if MAC configuration is invalid. */ | |
| 10462 | 10643 | if (!is_valid_ether_addr(fip_mac)) { |
| 10463 | 10644 | bp->flags |= NO_FCOE_FLAG; |
| 10464 | 10645 | memset(bp->fip_mac, 0, ETH_ALEN); |
| 10465 | 10646 | } |
| 10466 | −#endif | |
| 10647 | +} | |
| 10648 | + | |
| 10649 | +static void bnx2x_get_mac_hwinfo(struct bnx2x *bp) | |
| 10650 | +{ | |
| 10651 | + u32 val, val2; | |
| 10652 | + int func = BP_ABS_FUNC(bp); | |
| 10653 | + int port = BP_PORT(bp); | |
| 10654 | + | |
| 10655 | + /* Zero primary MAC configuration */ | |
| 10656 | + memset(bp->dev->dev_addr, 0, ETH_ALEN); | |
| 10657 | + | |
| 10658 | + if (BP_NOMCP(bp)) { | |
| 10659 | + BNX2X_ERROR("warning: random MAC workaround active\n"); | |
| 10660 | + eth_hw_addr_random(bp->dev); | |
| 10661 | + } else if (IS_MF(bp)) { | |
| 10662 | + val2 = MF_CFG_RD(bp, func_mf_config[func].mac_upper); | |
| 10663 | + val = MF_CFG_RD(bp, func_mf_config[func].mac_lower); | |
| 10664 | + if ((val2 != FUNC_MF_CFG_UPPERMAC_DEFAULT) && | |
| 10665 | + (val != FUNC_MF_CFG_LOWERMAC_DEFAULT)) | |
| 10666 | + bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); | |
| 10667 | + | |
| 10668 | + if (CNIC_SUPPORT(bp)) | |
| 10669 | + bnx2x_get_cnic_mac_hwinfo(bp); | |
| 10670 | + } else { | |
| 10671 | + /* in SF read MACs from port configuration */ | |
| 10672 | + val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_upper); | |
| 10673 | + val = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_lower); | |
| 10674 | + bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); | |
| 10675 | + | |
| 10676 | + if (CNIC_SUPPORT(bp)) | |
| 10677 | + bnx2x_get_cnic_mac_hwinfo(bp); | |
| 10678 | + } | |
| 10679 | + | |
| 10680 | + memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN); | |
| 10681 | + memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); | |
| 10467 | 10682 | |
| 10468 | 10683 | if (!bnx2x_is_valid_ether_addr(bp, bp->dev->dev_addr)) |
| 10469 | 10684 | dev_err(&bp->pdev->dev, |
| 10470 | 10685 | "bad Ethernet MAC address configuration: %pM\n" |
| 10471 | 10686 | "change it manually before bringing up the appropriate network interface\n", |
| 10472 | 10687 | bp->dev->dev_addr); |
| 10688 | +} | |
| 10473 | 10689 | |
| 10690 | +static bool bnx2x_get_dropless_info(struct bnx2x *bp) | |
| 10691 | +{ | |
| 10692 | + int tmp; | |
| 10693 | + u32 cfg; | |
| 10474 | 10694 | |
| 10695 | + if (IS_MF(bp) && !CHIP_IS_E1x(bp)) { | |
| 10696 | + /* Take function: tmp = func */ | |
| 10697 | + tmp = BP_ABS_FUNC(bp); | |
| 10698 | + cfg = MF_CFG_RD(bp, func_ext_config[tmp].func_cfg); | |
| 10699 | + cfg = !!(cfg & MACP_FUNC_CFG_PAUSE_ON_HOST_RING); | |
| 10700 | + } else { | |
| 10701 | + /* Take port: tmp = port */ | |
| 10702 | + tmp = BP_PORT(bp); | |
| 10703 | + cfg = SHMEM_RD(bp, | |
| 10704 | + dev_info.port_hw_config[tmp].generic_features); | |
| 10705 | + cfg = !!(cfg & PORT_HW_CFG_PAUSE_ON_HOST_RING_ENABLED); | |
| 10706 | + } | |
| 10707 | + return cfg; | |
| 10475 | 10708 | } |
| 10476 | 10709 | |
| 10477 | −static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | |
| 10710 | +static int bnx2x_get_hwinfo(struct bnx2x *bp) | |
| 10478 | 10711 | { |
| 10479 | 10712 | int /*abs*/func = BP_ABS_FUNC(bp); |
| 10480 | 10713 | int vn; |
| @@ -10516,6 +10749,8 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) · 35 unmodified lines | ||
| 10516 | 10749 | if (REG_RD(bp, IGU_REG_RESET_MEMORIES)) { |
| 10517 | 10750 | dev_err(&bp->pdev->dev, |
| 10518 | 10751 | "FORCING Normal Mode failed!!!\n"); |
| 10752 | + bnx2x_release_hw_lock(bp, | |
| 10753 | + HW_LOCK_RESOURCE_RESET); | |
| 10519 | 10754 | return -EPERM; |
| 10520 | 10755 | } |
| 10521 | 10756 | } |
| @@ -10526,9 +10761,10 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) · 4 unmodified lines | ||
| 10526 | 10761 | } else |
| 10527 | 10762 | BNX2X_DEV_INFO("IGU Normal Mode\n"); |
| 10528 | 10763 | |
| 10529 | − bnx2x_get_igu_cam_info(bp); | |
| 10530 | − | |
| 10764 | + rc = bnx2x_get_igu_cam_info(bp); | |
| 10531 | 10765 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); |
| 10766 | + if (rc) | |
| 10767 | + return rc; | |
| 10532 | 10768 | } |
| 10533 | 10769 | |
| 10534 | 10770 | /* |
| @@ -10697,7 +10933,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) · 162 unmodified lines | ||
| 10697 | 10933 | return rc; |
| 10698 | 10934 | } |
| 10699 | 10935 | |
| 10700 | −static void __devinit bnx2x_read_fwinfo(struct bnx2x *bp) | |
| 10936 | +static void bnx2x_read_fwinfo(struct bnx2x *bp) | |
| 10701 | 10937 | { |
| 10702 | 10938 | int cnt, i, block_end, rodi; |
| 10703 | 10939 | char vpd_start[BNX2X_VPD_LEN+1]; |
| @@ -10782,7 +11018,7 @@ out_not_found: · 78 unmodified lines | ||
| 10782 | 11018 | return; |
| 10783 | 11019 | } |
| 10784 | 11020 | |
| 10785 | −static void __devinit bnx2x_set_modes_bitmap(struct bnx2x *bp) | |
| 11021 | +static void bnx2x_set_modes_bitmap(struct bnx2x *bp) | |
| 10786 | 11022 | { |
| 10787 | 11023 | u32 flags = 0; |
| 10788 | 11024 | |
| @@ -10832,7 +11068,7 @@ static void __devinit bnx2x_set_modes_bitmap(struct bnx2x *bp) · 43 unmodified lines | ||
| 10832 | 11068 | INIT_MODE_FLAGS(bp) = flags; |
| 10833 | 11069 | } |
| 10834 | 11070 | |
| 10835 | −static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |
| 11071 | +static int bnx2x_init_bp(struct bnx2x *bp) | |
| 10836 | 11072 | { |
| 10837 | 11073 | int func; |
| 10838 | 11074 | int rc; |
| @@ -10840,9 +11076,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) · 1 unmodified line | ||
| 10840 | 11076 | mutex_init(&bp->port.phy_mutex); |
| 10841 | 11077 | mutex_init(&bp->fw_mb_mutex); |
| 10842 | 11078 | spin_lock_init(&bp->stats_lock); |
| 10843 | −#ifdef BCM_CNIC | |
| 10844 | − mutex_init(&bp->cnic_mutex); | |
| 10845 | −#endif | |
| 11079 | + | |
| 10846 | 11080 | |
| 10847 | 11081 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); |
| 10848 | 11082 | INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); |
| @@ -10880,10 +11114,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) · 31 unmodified lines | ||
| 10880 | 11114 | dev_err(&bp->pdev->dev, "MCP disabled, must load devices in order!\n"); |
| 10881 | 11115 | |
| 10882 | 11116 | bp->disable_tpa = disable_tpa; |
| 10883 | − | |
| 10884 | −#ifdef BCM_CNIC | |
| 10885 | 11117 | bp->disable_tpa |= IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp); |
| 10886 | −#endif | |
| 10887 | 11118 | |
| 10888 | 11119 | /* Set TPA flags */ |
| 10889 | 11120 | if (bp->disable_tpa) { |
| @@ -10897,7 +11128,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) · 7 unmodified lines | ||
| 10897 | 11128 | if (CHIP_IS_E1(bp)) |
| 10898 | 11129 | bp->dropless_fc = 0; |
| 10899 | 11130 | else |
| 10900 | − bp->dropless_fc = dropless_fc; | |
| 11131 | + bp->dropless_fc = dropless_fc | bnx2x_get_dropless_info(bp); | |
| 10901 | 11132 | |
| 10902 | 11133 | bp->mrrs = mrrs; |
| 10903 | 11134 | |
| @@ -10914,15 +11145,20 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) · 10 unmodified lines | ||
| 10914 | 11145 | bp->timer.data = (unsigned long) bp; |
| 10915 | 11146 | bp->timer.function = bnx2x_timer; |
| 10916 | 11147 | |
| 10917 | − bnx2x_dcbx_set_state(bp, true, BNX2X_DCBX_ENABLED_ON_NEG_ON); | |
| 10918 | − bnx2x_dcbx_init_params(bp); | |
| 11148 | + if (SHMEM2_HAS(bp, dcbx_lldp_params_offset) && | |
| 11149 | + SHMEM2_HAS(bp, dcbx_lldp_dcbx_stat_offset) && | |
| 11150 | + SHMEM2_RD(bp, dcbx_lldp_params_offset) && | |
| 11151 | + SHMEM2_RD(bp, dcbx_lldp_dcbx_stat_offset)) { | |
| 11152 | + bnx2x_dcbx_set_state(bp, true, BNX2X_DCBX_ENABLED_ON_NEG_ON); | |
| 11153 | + bnx2x_dcbx_init_params(bp); | |
| 11154 | + } else { | |
| 11155 | + bnx2x_dcbx_set_state(bp, false, BNX2X_DCBX_ENABLED_OFF); | |
| 11156 | + } | |
| 10919 | 11157 | |
| 10920 | −#ifdef BCM_CNIC | |
| 10921 | 11158 | if (CHIP_IS_E1x(bp)) |
| 10922 | 11159 | bp->cnic_base_cl_id = FP_SB_MAX_E1x; |
| 10923 | 11160 | else |
| 10924 | 11161 | bp->cnic_base_cl_id = FP_SB_MAX_E2; |
| 10925 | −#endif | |
| 10926 | 11162 | |
| 10927 | 11163 | /* multiple tx priority */ |
| 10928 | 11164 | if (CHIP_IS_E1x(bp)) |
| @@ -10932,6 +11168,16 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) · 3 unmodified lines | ||
| 10932 | 11168 | if (CHIP_IS_E3B0(bp)) |
| 10933 | 11169 | bp->max_cos = BNX2X_MULTI_TX_COS_E3B0; |
| 10934 | 11170 | |
| 11171 | + /* We need at least one default status block for slow-path events, | |
| 11172 | + * second status block for the L2 queue, and a third status block for | |
| 11173 | + * CNIC if supproted. | |
| 11174 | + */ | |
| 11175 | + if (CNIC_SUPPORT(bp)) | |
| 11176 | + bp->min_msix_vec_cnt = 3; | |
| 11177 | + else | |
| 11178 | + bp->min_msix_vec_cnt = 2; | |
| 11179 | + BNX2X_DEV_INFO("bp->min_msix_vec_cnt %d", bp->min_msix_vec_cnt); | |
| 11180 | + | |
| 10935 | 11181 | return rc; |
| 10936 | 11182 | } |
| 10937 | 11183 | |
| @@ -11168,11 +11414,9 @@ void bnx2x_set_rx_mode(struct net_device *dev) · 230 unmodified lines | ||
| 11168 | 11414 | } |
| 11169 | 11415 | |
| 11170 | 11416 | bp->rx_mode = rx_mode; |
| 11171 | −#ifdef BCM_CNIC | |
| 11172 | 11417 | /* handle ISCSI SD mode */ |
| 11173 | 11418 | if (IS_MF_ISCSI_SD(bp)) |
| 11174 | 11419 | bp->rx_mode = BNX2X_RX_MODE_NONE; |
| 11175 | −#endif | |
| 11176 | 11420 | |
| 11177 | 11421 | /* Schedule the rx_mode command */ |
| 11178 | 11422 | if (test_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state)) { |
| @@ -11284,7 +11528,7 @@ static const struct net_device_ops bnx2x_netdev_ops = { · 105 unmodified lines | ||
| 11284 | 11528 | #endif |
| 11285 | 11529 | .ndo_setup_tc = bnx2x_setup_tc, |
| 11286 | 11530 | |
| 11287 | −#if defined(NETDEV_FCOE_WWNN) && defined(BCM_CNIC) | |
| 11531 | +#ifdef NETDEV_FCOE_WWNN | |
| 11288 | 11532 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, |
| 11289 | 11533 | #endif |
| 11290 | 11534 | }; |
| @@ -11307,9 +11551,8 @@ static int bnx2x_set_coherency_mask(struct bnx2x *bp) · 16 unmodified lines | ||
| 11307 | 11551 | return 0; |
| 11308 | 11552 | } |
| 11309 | 11553 | |
| 11310 | −static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |
| 11311 | − struct net_device *dev, | |
| 11312 | − unsigned long board_type) | |
| 11554 | +static int bnx2x_init_dev(struct pci_dev *pdev, struct net_device *dev, | |
| 11555 | + unsigned long board_type) | |
| 11313 | 11556 | { |
| 11314 | 11557 | struct bnx2x *bp; |
| 11315 | 11558 | int rc; |
| @@ -11346,6 +11589,14 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, · 30 unmodified lines | ||
| 11346 | 11589 | goto err_out_disable; |
| 11347 | 11590 | } |
| 11348 | 11591 | |
| 11592 | + pci_read_config_dword(pdev, PCICFG_REVISION_ID_OFFSET, &pci_cfg_dword); | |
| 11593 | + if ((pci_cfg_dword & PCICFG_REVESION_ID_MASK) == | |
| 11594 | + PCICFG_REVESION_ID_ERROR_VAL) { | |
| 11595 | + pr_err("PCI device error, probably due to fan failure, aborting\n"); | |
| 11596 | + rc = -ENODEV; | |
| 11597 | + goto err_out_disable; | |
| 11598 | + } | |
| 11599 | + | |
| 11349 | 11600 | if (atomic_read(&pdev->enable_cnt) == 1) { |
| 11350 | 11601 | rc = pci_request_regions(pdev, DRV_MODULE_NAME); |
| 11351 | 11602 | if (rc) { |
| @@ -11481,8 +11732,7 @@ err_out: · 129 unmodified lines | ||
| 11481 | 11732 | return rc; |
| 11482 | 11733 | } |
| 11483 | 11734 | |
| 11484 | −static void __devinit bnx2x_get_pcie_width_speed(struct bnx2x *bp, | |
| 11485 | − int *width, int *speed) | |
| 11735 | +static void bnx2x_get_pcie_width_speed(struct bnx2x *bp, int *width, int *speed) | |
| 11486 | 11736 | { |
| 11487 | 11737 | u32 val = REG_RD(bp, PCICFG_OFFSET + PCICFG_LINK_CONTROL); |
| 11488 | 11738 | |
| @@ -11750,9 +12000,8 @@ static int bnx2x_set_qm_cid_count(struct bnx2x *bp) · 261 unmodified lines | ||
| 11750 | 12000 | { |
| 11751 | 12001 | int cid_count = BNX2X_L2_MAX_CID(bp); |
| 11752 | 12002 | |
| 11753 | −#ifdef BCM_CNIC | |
| 11754 | − cid_count += CNIC_CID_MAX; | |
| 11755 | −#endif | |
| 12003 | + if (CNIC_SUPPORT(bp)) | |
| 12004 | + cid_count += CNIC_CID_MAX; | |
| 11756 | 12005 | return roundup(cid_count, QM_CID_ROUND); |
| 11757 | 12006 | } |
| 11758 | 12007 | |
| @@ -11762,7 +12011,8 @@ static int bnx2x_set_qm_cid_count(struct bnx2x *bp) · 3 unmodified lines | ||
| 11762 | 12011 | * @dev: pci device |
| 11763 | 12012 | * |
| 11764 | 12013 | */ |
| 11765 | −static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev) | |
| 12014 | +static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev, | |
| 12015 | + int cnic_cnt) | |
| 11766 | 12016 | { |
| 11767 | 12017 | int pos; |
| 11768 | 12018 | u16 control; |
| @@ -11774,7 +12024,7 @@ static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev) · 5 unmodified lines | ||
| 11774 | 12024 | * one fast path queue: one FP queue + SB for CNIC |
| 11775 | 12025 | */ |
| 11776 | 12026 | if (!pos) |
| 11777 | − return 1 + CNIC_PRESENT; | |
| 12027 | + return 1 + cnic_cnt; | |
| 11778 | 12028 | |
| 11779 | 12029 | /* |
| 11780 | 12030 | * The value in the PCI configuration space is the index of the last |
| @@ -11786,14 +12036,16 @@ static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev) · 5 unmodified lines | ||
| 11786 | 12036 | return control & PCI_MSIX_FLAGS_QSIZE; |
| 11787 | 12037 | } |
| 11788 | 12038 | |
| 11789 | −static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |
| 11790 | − const struct pci_device_id *ent) | |
| 12039 | +struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *); | |
| 12040 | + | |
| 12041 | +static int bnx2x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 11791 | 12042 | { |
| 11792 | 12043 | struct net_device *dev = NULL; |
| 11793 | 12044 | struct bnx2x *bp; |
| 11794 | 12045 | int pcie_width, pcie_speed; |
| 11795 | 12046 | int rc, max_non_def_sbs; |
| 11796 | 12047 | int rx_count, tx_count, rss_count, doorbell_size; |
| 12048 | + int cnic_cnt; | |
| 11797 | 12049 | /* |
| 11798 | 12050 | * An estimated maximum supported CoS number according to the chip |
| 11799 | 12051 | * version. |
| @@ -11837,21 +12089,22 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 37 unmodified lines | ||
| 11837 | 12089 | return -ENODEV; |
| 11838 | 12090 | } |
| 11839 | 12091 | |
| 11840 | − max_non_def_sbs = bnx2x_get_num_non_def_sbs(pdev); | |
| 12092 | + cnic_cnt = 1; | |
| 12093 | + max_non_def_sbs = bnx2x_get_num_non_def_sbs(pdev, cnic_cnt); | |
| 11841 | 12094 | |
| 11842 | 12095 | WARN_ON(!max_non_def_sbs); |
| 11843 | 12096 | |
| 11844 | 12097 | /* Maximum number of RSS queues: one IGU SB goes to CNIC */ |
| 11845 | − rss_count = max_non_def_sbs - CNIC_PRESENT; | |
| 12098 | + rss_count = max_non_def_sbs - cnic_cnt; | |
| 11846 | 12099 | |
| 11847 | 12100 | /* Maximum number of netdev Rx queues: RSS + FCoE L2 */ |
| 11848 | − rx_count = rss_count + FCOE_PRESENT; | |
| 12101 | + rx_count = rss_count + cnic_cnt; | |
| 11849 | 12102 | |
| 11850 | 12103 | /* |
| 11851 | 12104 | * Maximum number of netdev Tx queues: |
| 11852 | 12105 | * Maximum TSS queues * Maximum supported number of CoS + FCoE L2 |
| 11853 | 12106 | */ |
| 11854 | − tx_count = rss_count * max_cos_est + FCOE_PRESENT; | |
| 12107 | + tx_count = rss_count * max_cos_est + cnic_cnt; | |
| 11855 | 12108 | |
| 11856 | 12109 | /* dev zeroed in init_etherdev */ |
| 11857 | 12110 | dev = alloc_etherdev_mqs(sizeof(*bp), tx_count, rx_count); |
| @@ -11862,6 +12115,9 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 4 unmodified lines | ||
| 11862 | 12115 | |
| 11863 | 12116 | bp->igu_sb_cnt = max_non_def_sbs; |
| 11864 | 12117 | bp->msg_enable = debug; |
| 12118 | + bp->cnic_support = cnic_cnt; | |
| 12119 | + bp->cnic_probe = bnx2x_cnic_probe; | |
| 12120 | + | |
| 11865 | 12121 | pci_set_drvdata(pdev, dev); |
| 11866 | 12122 | |
| 11867 | 12123 | rc = bnx2x_init_dev(pdev, dev, ent->driver_data); |
| @@ -11870,6 +12126,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 2 unmodified lines | ||
| 11870 | 12126 | return rc; |
| 11871 | 12127 | } |
| 11872 | 12128 | |
| 12129 | + BNX2X_DEV_INFO("Cnic support is %s\n", CNIC_SUPPORT(bp) ? "on" : "off"); | |
| 11873 | 12130 | BNX2X_DEV_INFO("max_non_def_sbs %d\n", max_non_def_sbs); |
| 11874 | 12131 | |
| 11875 | 12132 | BNX2X_DEV_INFO("Allocated netdev with %d tx and %d rx queues\n", |
| @@ -11902,10 +12159,10 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 26 unmodified lines | ||
| 11902 | 12159 | /* calc qm_cid_count */ |
| 11903 | 12160 | bp->qm_cid_count = bnx2x_set_qm_cid_count(bp); |
| 11904 | 12161 | |
| 11905 | −#ifdef BCM_CNIC | |
| 11906 | − /* disable FCOE L2 queue for E1x */ | |
| 12162 | + /* disable FCOE L2 queue for E1x*/ | |
| 11907 | 12163 | if (CHIP_IS_E1x(bp)) |
| 11908 | 12164 | bp->flags |= NO_FCOE_FLAG; |
| 12165 | + | |
| 11909 | 12166 | /* disable FCOE for 57840 device, until FW supports it */ |
| 11910 | 12167 | switch (ent->driver_data) { |
| 11911 | 12168 | case BCM57840_O: |
| @@ -11915,8 +12172,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 3 unmodified lines | ||
| 11915 | 12172 | case BCM57840_MF: |
| 11916 | 12173 | bp->flags |= NO_FCOE_FLAG; |
| 11917 | 12174 | } |
| 11918 | −#endif | |
| 11919 | − | |
| 11920 | 12175 | |
| 11921 | 12176 | /* Set bp->num_queues for MSI-X mode*/ |
| 11922 | 12177 | bnx2x_set_num_queues(bp); |
| @@ -11932,14 +12187,13 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 9 unmodified lines | ||
| 11932 | 12187 | goto init_one_exit; |
| 11933 | 12188 | } |
| 11934 | 12189 | |
| 11935 | −#ifdef BCM_CNIC | |
| 12190 | + | |
| 11936 | 12191 | if (!NO_FCOE(bp)) { |
| 11937 | 12192 | /* Add storage MAC address */ |
| 11938 | 12193 | rtnl_lock(); |
| 11939 | 12194 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); |
| 11940 | 12195 | rtnl_unlock(); |
| 11941 | 12196 | } |
| 11942 | −#endif | |
| 11943 | 12197 | |
| 11944 | 12198 | bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed); |
| 11945 | 12199 | |
| @@ -11973,7 +12227,7 @@ init_one_exit: · 27 unmodified lines | ||
| 11973 | 12227 | return rc; |
| 11974 | 12228 | } |
| 11975 | 12229 | |
| 11976 | −static void __devexit bnx2x_remove_one(struct pci_dev *pdev) | |
| 12230 | +static void bnx2x_remove_one(struct pci_dev *pdev) | |
| 11977 | 12231 | { |
| 11978 | 12232 | struct net_device *dev = pci_get_drvdata(pdev); |
| 11979 | 12233 | struct bnx2x *bp; |
| @@ -11984,14 +12238,12 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev) · 4 unmodified lines | ||
| 11984 | 12238 | } |
| 11985 | 12239 | bp = netdev_priv(dev); |
| 11986 | 12240 | |
| 11987 | −#ifdef BCM_CNIC | |
| 11988 | 12241 | /* Delete storage MAC address */ |
| 11989 | 12242 | if (!NO_FCOE(bp)) { |
| 11990 | 12243 | rtnl_lock(); |
| 11991 | 12244 | dev_addr_del(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); |
| 11992 | 12245 | rtnl_unlock(); |
| 11993 | 12246 | } |
| 11994 | −#endif | |
| 11995 | 12247 | |
| 11996 | 12248 | #ifdef BCM_DCBNL |
| 11997 | 12249 | /* Delete app tlvs from dcbnl */ |
| @@ -12039,15 +12291,17 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp) · 41 unmodified lines | ||
| 12039 | 12291 | |
| 12040 | 12292 | bp->rx_mode = BNX2X_RX_MODE_NONE; |
| 12041 | 12293 | |
| 12042 | −#ifdef BCM_CNIC | |
| 12043 | − bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); | |
| 12044 | −#endif | |
| 12294 | + if (CNIC_LOADED(bp)) | |
| 12295 | + bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD); | |
| 12296 | + | |
| 12045 | 12297 | /* Stop Tx */ |
| 12046 | 12298 | bnx2x_tx_disable(bp); |
| 12047 | 12299 | |
| 12048 | 12300 | bnx2x_netif_stop(bp, 0); |
| 12049 | 12301 | /* Delete all NAPI objects */ |
| 12050 | 12302 | bnx2x_del_all_napi(bp); |
| 12303 | + if (CNIC_LOADED(bp)) | |
| 12304 | + bnx2x_del_all_napi_cnic(bp); | |
| 12051 | 12305 | |
| 12052 | 12306 | del_timer_sync(&bp->timer); |
| 12053 | 12307 | |
| @@ -12188,7 +12442,7 @@ static struct pci_driver bnx2x_pci_driver = { · 134 unmodified lines | ||
| 12188 | 12442 | .name = DRV_MODULE_NAME, |
| 12189 | 12443 | .id_table = bnx2x_pci_tbl, |
| 12190 | 12444 | .probe = bnx2x_init_one, |
| 12191 | − .remove = __devexit_p(bnx2x_remove_one), | |
| 12445 | + .remove = bnx2x_remove_one, | |
| 12192 | 12446 | .suspend = bnx2x_suspend, |
| 12193 | 12447 | .resume = bnx2x_resume, |
| 12194 | 12448 | .err_handler = &bnx2x_err_handler, |
| @@ -12238,7 +12492,6 @@ void bnx2x_notify_link_changed(struct bnx2x *bp) · 43 unmodified lines | ||
| 12238 | 12492 | module_init(bnx2x_init); |
| 12239 | 12493 | module_exit(bnx2x_cleanup); |
| 12240 | 12494 | |
| 12241 | −#ifdef BCM_CNIC | |
| 12242 | 12495 | /** |
| 12243 | 12496 | * bnx2x_set_iscsi_eth_mac_addr - set iSCSI MAC(s). |
| 12244 | 12497 | * |
| @@ -12691,12 +12944,31 @@ static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops, · 446 unmodified lines | ||
| 12691 | 12944 | { |
| 12692 | 12945 | struct bnx2x *bp = netdev_priv(dev); |
| 12693 | 12946 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; |
| 12947 | + int rc; | |
| 12948 | + | |
| 12949 | + DP(NETIF_MSG_IFUP, "Register_cnic called\n"); | |
| 12694 | 12950 | |
| 12695 | 12951 | if (ops == NULL) { |
| 12696 | 12952 | BNX2X_ERR("NULL ops received\n"); |
| 12697 | 12953 | return -EINVAL; |
| 12698 | 12954 | } |
| 12699 | 12955 | |
| 12956 | + if (!CNIC_SUPPORT(bp)) { | |
| 12957 | + BNX2X_ERR("Can't register CNIC when not supported\n"); | |
| 12958 | + return -EOPNOTSUPP; | |
| 12959 | + } | |
| 12960 | + | |
| 12961 | + if (!CNIC_LOADED(bp)) { | |
| 12962 | + rc = bnx2x_load_cnic(bp); | |
| 12963 | + if (rc) { | |
| 12964 | + BNX2X_ERR("CNIC-related load failed\n"); | |
| 12965 | + return rc; | |
| 12966 | + } | |
| 12967 | + | |
| 12968 | + } | |
| 12969 | + | |
| 12970 | + bp->cnic_enabled = true; | |
| 12971 | + | |
| 12700 | 12972 | bp->cnic_kwq = kzalloc(PAGE_SIZE, GFP_KERNEL); |
| 12701 | 12973 | if (!bp->cnic_kwq) |
| 12702 | 12974 | return -ENOMEM; |
| @@ -12786,7 +13058,5 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) · 83 unmodified lines | ||
| 12786 | 13058 | cp->starting_cid); |
| 12787 | 13059 | return cp; |
| 12788 | 13060 | } |
| 12789 | −EXPORT_SYMBOL(bnx2x_cnic_probe); | |
| 12790 | 13061 | |
| 12791 | −#endif /* BCM_CNIC */ | |
| 12792 | 13062 | |
| @@ -2107,6 +2107,7 @@ · 2106 unmodified lines | ||
| 2107 | 2107 | #define NIG_REG_LLH1_ERROR_MASK 0x10090 |
| 2108 | 2108 | /* [RW 8] event id for llh1 */ |
| 2109 | 2109 | #define NIG_REG_LLH1_EVENT_ID 0x10088 |
| 2110 | +#define NIG_REG_LLH1_FUNC_EN 0x16104 | |
| 2110 | 2111 | #define NIG_REG_LLH1_FUNC_MEM 0x161c0 |
| 2111 | 2112 | #define NIG_REG_LLH1_FUNC_MEM_ENABLE 0x16160 |
| 2112 | 2113 | #define NIG_REG_LLH1_FUNC_MEM_SIZE 16 |
| @@ -2302,6 +2303,15 @@ · 189 unmodified lines | ||
| 2302 | 2303 | * set to 0x345678021. This is a new register (with 2_) added in E3 B0 to |
| 2303 | 2304 | * accommodate the 9 input clients to ETS arbiter. */ |
| 2304 | 2305 | #define NIG_REG_P0_TX_ARB_PRIORITY_CLIENT2_MSB 0x18684 |
| 2306 | +/* [RW 1] MCP-to-host path enable. Set this bit to enable the routing of MCP | |
| 2307 | + * packets to BRB LB interface to forward the packet to the host. All | |
| 2308 | + * packets from MCP are forwarded to the network when this bit is cleared - | |
| 2309 | + * regardless of the configured destination in tx_mng_destination register. | |
| 2310 | + * When MCP-to-host paths for both ports 0 and 1 are disabled - the arbiter | |
| 2311 | + * for BRB LB interface is bypassed and PBF LB traffic is always selected to | |
| 2312 | + * send to BRB LB. | |
| 2313 | + */ | |
| 2314 | +#define NIG_REG_P0_TX_MNG_HOST_ENABLE 0x182f4 | |
| 2305 | 2315 | #define NIG_REG_P1_HWPFC_ENABLE 0x181d0 |
| 2306 | 2316 | #define NIG_REG_P1_MAC_IN_EN 0x185c0 |
| 2307 | 2317 | /* [RW 1] Output enable for TX MAC interface */ |
| @@ -2418,6 +2428,12 @@ · 110 unmodified lines | ||
| 2418 | 2428 | #define NIG_REG_P1_TX_ARB_PRIORITY_CLIENT2_MSB 0x186e4 |
| 2419 | 2429 | /* [R 1] TX FIFO for transmitting data to MAC is empty. */ |
| 2420 | 2430 | #define NIG_REG_P1_TX_MACFIFO_EMPTY 0x18594 |
| 2431 | +/* [RW 1] MCP-to-host path enable. Set this bit to enable the routing of MCP | |
| 2432 | + * packets to BRB LB interface to forward the packet to the host. All | |
| 2433 | + * packets from MCP are forwarded to the network when this bit is cleared - | |
| 2434 | + * regardless of the configured destination in tx_mng_destination register. | |
| 2435 | + */ | |
| 2436 | +#define NIG_REG_P1_TX_MNG_HOST_ENABLE 0x182f8 | |
| 2421 | 2437 | /* [R 1] FIFO empty status of the MCP TX FIFO used for storing MCP packets |
| 2422 | 2438 | forwarded to the host. */ |
| 2423 | 2439 | #define NIG_REG_P1_TX_MNG_HOST_FIFO_EMPTY 0x182b8 |
| @@ -5482,6 +5498,7 @@ · 3058 unmodified lines | ||
| 5482 | 5498 | #define XMAC_CTRL_REG_RX_EN (0x1<<1) |
| 5483 | 5499 | #define XMAC_CTRL_REG_SOFT_RESET (0x1<<6) |
| 5484 | 5500 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) |
| 5501 | +#define XMAC_CTRL_REG_XLGMII_ALIGN_ENB (0x1<<7) | |
| 5485 | 5502 | #define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18) |
| 5486 | 5503 | #define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17) |
| 5487 | 5504 | #define XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON (0x1<<1) |
| @@ -5502,11 +5519,14 @@ · 14 unmodified lines | ||
| 5502 | 5519 | #define XMAC_REG_PAUSE_CTRL 0x68 |
| 5503 | 5520 | #define XMAC_REG_PFC_CTRL 0x70 |
| 5504 | 5521 | #define XMAC_REG_PFC_CTRL_HI 0x74 |
| 5522 | +#define XMAC_REG_RX_LSS_CTRL 0x50 | |
| 5505 | 5523 | #define XMAC_REG_RX_LSS_STATUS 0x58 |
| 5506 | 5524 | /* [RW 14] Maximum packet size in receive direction; exclusive of preamble & |
| 5507 | 5525 | * CRC in strip mode */ |
| 5508 | 5526 | #define XMAC_REG_RX_MAX_SIZE 0x40 |
| 5509 | 5527 | #define XMAC_REG_TX_CTRL 0x20 |
| 5528 | +#define XMAC_RX_LSS_CTRL_REG_LOCAL_FAULT_DISABLE (0x1<<0) | |
| 5529 | +#define XMAC_RX_LSS_CTRL_REG_REMOTE_FAULT_DISABLE (0x1<<1) | |
| 5510 | 5530 | /* [RW 16] Indirect access to the XX table of the XX protection mechanism. |
| 5511 | 5531 | The fields are:[4:0] - tail pointer; 9:5] - Link List size; 14:10] - |
| 5512 | 5532 | header pointer. */ |
| @@ -5922,6 +5942,16 @@ · 409 unmodified lines | ||
| 5922 | 5942 | #define MISC_REGISTERS_SPIO_OUTPUT_HIGH 1 |
| 5923 | 5943 | #define MISC_REGISTERS_SPIO_OUTPUT_LOW 0 |
| 5924 | 5944 | #define MISC_REGISTERS_SPIO_SET_POS 8 |
| 5945 | +#define MISC_SPIO_CLR_POS 16 | |
| 5946 | +#define MISC_SPIO_FLOAT (0xffL<<24) | |
| 5947 | +#define MISC_SPIO_FLOAT_POS 24 | |
| 5948 | +#define MISC_SPIO_INPUT_HI_Z 2 | |
| 5949 | +#define MISC_SPIO_INT_OLD_SET_POS 16 | |
| 5950 | +#define MISC_SPIO_OUTPUT_HIGH 1 | |
| 5951 | +#define MISC_SPIO_OUTPUT_LOW 0 | |
| 5952 | +#define MISC_SPIO_SET_POS 8 | |
| 5953 | +#define MISC_SPIO_SPIO4 0x10 | |
| 5954 | +#define MISC_SPIO_SPIO5 0x20 | |
| 5925 | 5955 | #define HW_LOCK_MAX_RESOURCE_VALUE 31 |
| 5926 | 5956 | #define HW_LOCK_RESOURCE_DCBX_ADMIN_MIB 13 |
| 5927 | 5957 | #define HW_LOCK_RESOURCE_DRV_FLAGS 10 |
| @@ -6130,7 +6160,9 @@ · 202 unmodified lines | ||
| 6130 | 6160 | #define PCICFG_COMMAND_INT_DISABLE (1<<10) |
| 6131 | 6161 | #define PCICFG_COMMAND_RESERVED (0x1f<<11) |
| 6132 | 6162 | #define PCICFG_STATUS_OFFSET 0x06 |
| 6133 | −#define PCICFG_REVESION_ID_OFFSET 0x08 | |
| 6163 | +#define PCICFG_REVISION_ID_OFFSET 0x08 | |
| 6164 | +#define PCICFG_REVESION_ID_MASK 0xff | |
| 6165 | +#define PCICFG_REVESION_ID_ERROR_VAL 0xff | |
| 6134 | 6166 | #define PCICFG_CACHE_LINE_SIZE 0x0c |
| 6135 | 6167 | #define PCICFG_LATENCY_TIMER 0x0d |
| 6136 | 6168 | #define PCICFG_BAR_1_LOW 0x10 |
| @@ -6672,6 +6704,7 @@ · 535 unmodified lines | ||
| 6672 | 6704 | #define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_XFI 0x1B00 |
| 6673 | 6705 | #define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_20G_DXGXS 0x1E00 |
| 6674 | 6706 | #define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_SFI 0x1F00 |
| 6707 | +#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_20G_KR2 0x3900 | |
| 6675 | 6708 | |
| 6676 | 6709 | |
| 6677 | 6710 | #define MDIO_REG_BANK_10G_PARALLEL_DETECT 0x8130 |
| @@ -7046,7 +7079,8 @@ Theotherbitsarereservedandshouldbezero*/ · 368 unmodified lines | ||
| 7046 | 7079 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT2 0x12 |
| 7047 | 7080 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADV2_FEC_ABILITY 0x4000 |
| 7048 | 7081 | #define MDIO_WC_REG_AN_IEEE1BLK_AN_ADV2_FEC_REQ 0x8000 |
| 7049 | −#define MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150 0x96 | |
| 7082 | +#define MDIO_WC_REG_PCS_STATUS2 0x0021 | |
| 7083 | +#define MDIO_WC_REG_PMD_KR_CONTROL 0x0096 | |
| 7050 | 7084 | #define MDIO_WC_REG_XGXSBLK0_XGXSCONTROL 0x8000 |
| 7051 | 7085 | #define MDIO_WC_REG_XGXSBLK0_MISCCONTROL1 0x800e |
| 7052 | 7086 | #define MDIO_WC_REG_XGXSBLK1_DESKEW 0x8010 |
| @@ -7078,6 +7112,7 @@ Theotherbitsarereservedandshouldbezero*/ · 25 unmodified lines | ||
| 7078 | 7112 | #define MDIO_WC_REG_PAR_DET_10G_STATUS 0x8130 |
| 7079 | 7113 | #define MDIO_WC_REG_PAR_DET_10G_CTRL 0x8131 |
| 7080 | 7114 | #define MDIO_WC_REG_XGXS_X2_CONTROL2 0x8141 |
| 7115 | +#define MDIO_WC_REG_XGXS_X2_CONTROL3 0x8142 | |
| 7081 | 7116 | #define MDIO_WC_REG_XGXS_RX_LN_SWAP1 0x816B |
| 7082 | 7117 | #define MDIO_WC_REG_XGXS_TX_LN_SWAP1 0x8169 |
| 7083 | 7118 | #define MDIO_WC_REG_GP2_STATUS_GP_2_0 0x81d0 |
| @@ -7112,6 +7147,7 @@ Theotherbitsarereservedandshouldbezero*/ · 28 unmodified lines | ||
| 7112 | 7147 | #define MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET 0x0a |
| 7113 | 7148 | #define MDIO_WC_REG_TX_FIR_TAP_POST_TAP_MASK 0x7c00 |
| 7114 | 7149 | #define MDIO_WC_REG_TX_FIR_TAP_ENABLE 0x8000 |
| 7150 | +#define MDIO_WC_REG_CL72_USERB0_CL72_TX_FIR_TAP 0x82e2 | |
| 7115 | 7151 | #define MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL 0x82e3 |
| 7116 | 7152 | #define MDIO_WC_REG_CL72_USERB0_CL72_OS_DEF_CTRL 0x82e6 |
| 7117 | 7153 | #define MDIO_WC_REG_CL72_USERB0_CL72_BR_DEF_CTRL 0x82e7 |
| @@ -7129,9 +7165,16 @@ Theotherbitsarereservedandshouldbezero*/ · 11 unmodified lines | ||
| 7129 | 7165 | #define MDIO_WC_REG_DIGITAL4_MISC5 0x833e |
| 7130 | 7166 | #define MDIO_WC_REG_DIGITAL5_MISC6 0x8345 |
| 7131 | 7167 | #define MDIO_WC_REG_DIGITAL5_MISC7 0x8349 |
| 7168 | +#define MDIO_WC_REG_DIGITAL5_LINK_STATUS 0x834d | |
| 7132 | 7169 | #define MDIO_WC_REG_DIGITAL5_ACTUAL_SPEED 0x834e |
| 7133 | 7170 | #define MDIO_WC_REG_DIGITAL6_MP5_NEXTPAGECTRL 0x8350 |
| 7134 | 7171 | #define MDIO_WC_REG_CL49_USERB0_CTRL 0x8368 |
| 7172 | +#define MDIO_WC_REG_CL73_USERB0_CTRL 0x8370 | |
| 7173 | +#define MDIO_WC_REG_CL73_USERB0_USTAT 0x8371 | |
| 7174 | +#define MDIO_WC_REG_CL73_BAM_CTRL1 0x8372 | |
| 7175 | +#define MDIO_WC_REG_CL73_BAM_CTRL2 0x8373 | |
| 7176 | +#define MDIO_WC_REG_CL73_BAM_CTRL3 0x8374 | |
| 7177 | +#define MDIO_WC_REG_CL73_BAM_CODE_FIELD 0x837b | |
| 7135 | 7178 | #define MDIO_WC_REG_EEE_COMBO_CONTROL0 0x8390 |
| 7136 | 7179 | #define MDIO_WC_REG_TX66_CONTROL 0x83b0 |
| 7137 | 7180 | #define MDIO_WC_REG_RX66_CONTROL 0x83c0 |
| @@ -7145,7 +7188,17 @@ Theotherbitsarereservedandshouldbezero*/ · 7 unmodified lines | ||
| 7145 | 7188 | #define MDIO_WC_REG_RX66_SCW3_MASK 0x83c9 |
| 7146 | 7189 | #define MDIO_WC_REG_FX100_CTRL1 0x8400 |
| 7147 | 7190 | #define MDIO_WC_REG_FX100_CTRL3 0x8402 |
| 7148 | − | |
| 7191 | +#define MDIO_WC_REG_CL82_USERB1_TX_CTRL5 0x8436 | |
| 7192 | +#define MDIO_WC_REG_CL82_USERB1_TX_CTRL6 0x8437 | |
| 7193 | +#define MDIO_WC_REG_CL82_USERB1_TX_CTRL7 0x8438 | |
| 7194 | +#define MDIO_WC_REG_CL82_USERB1_TX_CTRL9 0x8439 | |
| 7195 | +#define MDIO_WC_REG_CL82_USERB1_RX_CTRL10 0x843a | |
| 7196 | +#define MDIO_WC_REG_CL82_USERB1_RX_CTRL11 0x843b | |
| 7197 | +#define MDIO_WC_REG_ETA_CL73_OUI1 0x8453 | |
| 7198 | +#define MDIO_WC_REG_ETA_CL73_OUI2 0x8454 | |
| 7199 | +#define MDIO_WC_REG_ETA_CL73_OUI3 0x8455 | |
| 7200 | +#define MDIO_WC_REG_ETA_CL73_LD_BAM_CODE 0x8456 | |
| 7201 | +#define MDIO_WC_REG_ETA_CL73_LD_UD_CODE 0x8457 | |
| 7149 | 7202 | #define MDIO_WC_REG_MICROBLK_CMD 0xffc2 |
| 7150 | 7203 | #define MDIO_WC_REG_MICROBLK_DL_STATUS 0xffc5 |
| 7151 | 7204 | #define MDIO_WC_REG_MICROBLK_CMD3 0xffcc |
| @@ -5350,12 +5350,24 @@ static int bnx2x_func_chk_transition(struct bnx2x *bp, · 5349 unmodified lines | ||
| 5350 | 5350 | else if ((cmd == BNX2X_F_CMD_AFEX_VIFLISTS) && |
| 5351 | 5351 | (!test_bit(BNX2X_F_CMD_STOP, &o->pending))) |
| 5352 | 5352 | next_state = BNX2X_F_STATE_STARTED; |
| 5353 | + | |
| 5354 | + /* Switch_update ramrod can be sent in either started or | |
| 5355 | + * tx_stopped state, and it doesn't change the state. | |
| 5356 | + */ | |
| 5357 | + else if ((cmd == BNX2X_F_CMD_SWITCH_UPDATE) && | |
| 5358 | + (!test_bit(BNX2X_F_CMD_STOP, &o->pending))) | |
| 5359 | + next_state = BNX2X_F_STATE_STARTED; | |
| 5360 | + | |
| 5353 | 5361 | else if (cmd == BNX2X_F_CMD_TX_STOP) |
| 5354 | 5362 | next_state = BNX2X_F_STATE_TX_STOPPED; |
| 5355 | 5363 | |
| 5356 | 5364 | break; |
| 5357 | 5365 | case BNX2X_F_STATE_TX_STOPPED: |
| 5358 | − if (cmd == BNX2X_F_CMD_TX_START) | |
| 5366 | + if ((cmd == BNX2X_F_CMD_SWITCH_UPDATE) && | |
| 5367 | + (!test_bit(BNX2X_F_CMD_STOP, &o->pending))) | |
| 5368 | + next_state = BNX2X_F_STATE_TX_STOPPED; | |
| 5369 | + | |
| 5370 | + else if (cmd == BNX2X_F_CMD_TX_START) | |
| 5359 | 5371 | next_state = BNX2X_F_STATE_STARTED; |
| 5360 | 5372 | |
| 5361 | 5373 | break; |
| @@ -5637,6 +5649,28 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp, · 275 unmodified lines | ||
| 5637 | 5649 | U64_LO(data_mapping), NONE_CONNECTION_TYPE); |
| 5638 | 5650 | } |
| 5639 | 5651 | |
| 5652 | +static inline int bnx2x_func_send_switch_update(struct bnx2x *bp, | |
| 5653 | + struct bnx2x_func_state_params *params) | |
| 5654 | +{ | |
| 5655 | + struct bnx2x_func_sp_obj *o = params->f_obj; | |
| 5656 | + struct function_update_data *rdata = | |
| 5657 | + (struct function_update_data *)o->rdata; | |
| 5658 | + dma_addr_t data_mapping = o->rdata_mapping; | |
| 5659 | + struct bnx2x_func_switch_update_params *switch_update_params = | |
| 5660 | + ¶ms->params.switch_update; | |
| 5661 | + | |
| 5662 | + memset(rdata, 0, sizeof(*rdata)); | |
| 5663 | + | |
| 5664 | + /* Fill the ramrod data with provided parameters */ | |
| 5665 | + rdata->tx_switch_suspend_change_flg = 1; | |
| 5666 | + rdata->tx_switch_suspend = switch_update_params->suspend; | |
| 5667 | + rdata->echo = SWITCH_UPDATE; | |
| 5668 | + | |
| 5669 | + return bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_FUNCTION_UPDATE, 0, | |
| 5670 | + U64_HI(data_mapping), | |
| 5671 | + U64_LO(data_mapping), NONE_CONNECTION_TYPE); | |
| 5672 | +} | |
| 5673 | + | |
| 5640 | 5674 | static inline int bnx2x_func_send_afex_update(struct bnx2x *bp, |
| 5641 | 5675 | struct bnx2x_func_state_params *params) |
| 5642 | 5676 | { |
| @@ -5657,6 +5691,7 @@ static inline int bnx2x_func_send_afex_update(struct bnx2x *bp, · 14 unmodified lines | ||
| 5657 | 5691 | cpu_to_le16(afex_update_params->afex_default_vlan); |
| 5658 | 5692 | rdata->allowed_priorities_change_flg = 1; |
| 5659 | 5693 | rdata->allowed_priorities = afex_update_params->allowed_priorities; |
| 5694 | + rdata->echo = AFEX_UPDATE; | |
| 5660 | 5695 | |
| 5661 | 5696 | /* No need for an explicit memory barrier here as long we would |
| 5662 | 5697 | * need to ensure the ordering of writing to the SPQ element |
| @@ -5773,6 +5808,8 @@ static int bnx2x_func_send_cmd(struct bnx2x *bp, · 110 unmodified lines | ||
| 5773 | 5808 | return bnx2x_func_send_tx_stop(bp, params); |
| 5774 | 5809 | case BNX2X_F_CMD_TX_START: |
| 5775 | 5810 | return bnx2x_func_send_tx_start(bp, params); |
| 5811 | + case BNX2X_F_CMD_SWITCH_UPDATE: | |
| 5812 | + return bnx2x_func_send_switch_update(bp, params); | |
| 5776 | 5813 | default: |
| 5777 | 5814 | BNX2X_ERR("Unknown command: %d\n", params->cmd); |
| 5778 | 5815 | return -EINVAL; |
| @@ -5818,16 +5855,30 @@ int bnx2x_func_state_change(struct bnx2x *bp, · 39 unmodified lines | ||
| 5818 | 5855 | struct bnx2x_func_state_params *params) |
| 5819 | 5856 | { |
| 5820 | 5857 | struct bnx2x_func_sp_obj *o = params->f_obj; |
| 5821 | − int rc; | |
| 5858 | + int rc, cnt = 300; | |
| 5822 | 5859 | enum bnx2x_func_cmd cmd = params->cmd; |
| 5823 | 5860 | unsigned long *pending = &o->pending; |
| 5824 | 5861 | |
| 5825 | 5862 | mutex_lock(&o->one_pending_mutex); |
| 5826 | 5863 | |
| 5827 | 5864 | /* Check that the requested transition is legal */ |
| 5828 | − if (o->check_transition(bp, o, params)) { | |
| 5865 | + rc = o->check_transition(bp, o, params); | |
| 5866 | + if ((rc == -EBUSY) && | |
| 5867 | + (test_bit(RAMROD_RETRY, ¶ms->ramrod_flags))) { | |
| 5868 | + while ((rc == -EBUSY) && (--cnt > 0)) { | |
| 5869 | + mutex_unlock(&o->one_pending_mutex); | |
| 5870 | + msleep(10); | |
| 5871 | + mutex_lock(&o->one_pending_mutex); | |
| 5872 | + rc = o->check_transition(bp, o, params); | |
| 5873 | + } | |
| 5874 | + if (rc == -EBUSY) { | |
| 5875 | + mutex_unlock(&o->one_pending_mutex); | |
| 5876 | + BNX2X_ERR("timeout waiting for previous ramrod completion\n"); | |
| 5877 | + return rc; | |
| 5878 | + } | |
| 5879 | + } else if (rc) { | |
| 5829 | 5880 | mutex_unlock(&o->one_pending_mutex); |
| 5830 | − return -EINVAL; | |
| 5881 | + return rc; | |
| 5831 | 5882 | } |
| 5832 | 5883 | |
| 5833 | 5884 | /* Set "pending" bit */ |
| @@ -40,6 +40,12 @@ enum { · 39 unmodified lines | ||
| 40 | 40 | * pending commands list. |
| 41 | 41 | */ |
| 42 | 42 | RAMROD_CONT, |
| 43 | + /* If there is another pending ramrod, wait until it finishes and | |
| 44 | + * re-try to submit this one. This flag can be set only in sleepable | |
| 45 | + * context, and should not be set from the context that completes the | |
| 46 | + * ramrods as deadlock will occur. | |
| 47 | + */ | |
| 48 | + RAMROD_RETRY, | |
| 43 | 49 | }; |
| 44 | 50 | |
| 45 | 51 | typedef enum { |
| @@ -1061,6 +1067,7 @@ enum bnx2x_func_cmd { · 1015 unmodified lines | ||
| 1061 | 1067 | BNX2X_F_CMD_AFEX_VIFLISTS, |
| 1062 | 1068 | BNX2X_F_CMD_TX_STOP, |
| 1063 | 1069 | BNX2X_F_CMD_TX_START, |
| 1070 | + BNX2X_F_CMD_SWITCH_UPDATE, | |
| 1064 | 1071 | BNX2X_F_CMD_MAX, |
| 1065 | 1072 | }; |
| 1066 | 1073 | |
| @@ -1103,6 +1110,10 @@ struct bnx2x_func_start_params { · 36 unmodified lines | ||
| 1103 | 1110 | u8 network_cos_mode; |
| 1104 | 1111 | }; |
| 1105 | 1112 | |
| 1113 | +struct bnx2x_func_switch_update_params { | |
| 1114 | + u8 suspend; | |
| 1115 | +}; | |
| 1116 | + | |
| 1106 | 1117 | struct bnx2x_func_afex_update_params { |
| 1107 | 1118 | u16 vif_id; |
| 1108 | 1119 | u16 afex_default_vlan; |
| @@ -1136,6 +1147,7 @@ struct bnx2x_func_state_params { · 27 unmodified lines | ||
| 1136 | 1147 | struct bnx2x_func_hw_init_params hw_init; |
| 1137 | 1148 | struct bnx2x_func_hw_reset_params hw_reset; |
| 1138 | 1149 | struct bnx2x_func_start_params start; |
| 1150 | + struct bnx2x_func_switch_update_params switch_update; | |
| 1139 | 1151 | struct bnx2x_func_afex_update_params afex_update; |
| 1140 | 1152 | struct bnx2x_func_afex_viflists_params afex_viflists; |
| 1141 | 1153 | struct bnx2x_func_tx_start_params tx_start; |
| @@ -1149,6 +1149,7 @@ static void bnx2x_drv_stats_update(struct bnx2x *bp) · 1148 unmodified lines | ||
| 1149 | 1149 | UPDATE_ESTAT_QSTAT(rx_err_discard_pkt); |
| 1150 | 1150 | UPDATE_ESTAT_QSTAT(rx_skb_alloc_failed); |
| 1151 | 1151 | UPDATE_ESTAT_QSTAT(hw_csum_err); |
| 1152 | + UPDATE_ESTAT_QSTAT(driver_filtered_tx_pkt); | |
| 1152 | 1153 | } |
| 1153 | 1154 | } |
| 1154 | 1155 | |
| @@ -203,6 +203,7 @@ struct bnx2x_eth_stats { · 202 unmodified lines | ||
| 203 | 203 | /* Recovery */ |
| 204 | 204 | u32 recoverable_error; |
| 205 | 205 | u32 unrecoverable_error; |
| 206 | + u32 driver_filtered_tx_pkt; | |
| 206 | 207 | /* src: Clear-on-Read register; Will not survive PMF Migration */ |
| 207 | 208 | u32 eee_tx_lpi; |
| 208 | 209 | }; |
| @@ -264,6 +265,7 @@ struct bnx2x_eth_q_stats { · 55 unmodified lines | ||
| 264 | 265 | u32 total_tpa_aggregated_frames_lo; |
| 265 | 266 | u32 total_tpa_bytes_hi; |
| 266 | 267 | u32 total_tpa_bytes_lo; |
| 268 | + u32 driver_filtered_tx_pkt; | |
| 267 | 269 | }; |
| 268 | 270 | |
| 269 | 271 | struct bnx2x_eth_stats_old { |
| @@ -315,6 +317,7 @@ struct bnx2x_eth_q_stats_old { · 45 unmodified lines | ||
| 315 | 317 | u32 rx_err_discard_pkt_old; |
| 316 | 318 | u32 rx_skb_alloc_failed_old; |
| 317 | 319 | u32 hw_csum_err_old; |
| 320 | + u32 driver_filtered_tx_pkt_old; | |
| 318 | 321 | }; |
| 319 | 322 | |
| 320 | 323 | struct bnx2x_net_stats_old { |
| @@ -40,8 +40,10 @@ · 39 unmodified lines | ||
| 40 | 40 | #include <net/ip6_checksum.h> |
| 41 | 41 | #include <scsi/iscsi_if.h> |
| 42 | 42 | |
| 43 | +#define BCM_CNIC 1 | |
| 43 | 44 | #include "cnic_if.h" |
| 44 | 45 | #include "bnx2.h" |
| 46 | +#include "bnx2x/bnx2x.h" | |
| 45 | 47 | #include "bnx2x/bnx2x_reg.h" |
| 46 | 48 | #include "bnx2x/bnx2x_fw_defs.h" |
| 47 | 49 | #include "bnx2x/bnx2x_hsi.h" |
| @@ -51,10 +53,10 @@ · 3 unmodified lines | ||
| 51 | 53 | #include "cnic.h" |
| 52 | 54 | #include "cnic_defs.h" |
| 53 | 55 | |
| 54 | −#define DRV_MODULE_NAME "cnic" | |
| 56 | +#define CNIC_MODULE_NAME "cnic" | |
| 55 | 57 | |
| 56 | −static char version[] __devinitdata = | |
| 57 | − "Broadcom NetXtreme II CNIC Driver " DRV_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; | |
| 58 | +static char version[] = | |
| 59 | + "Broadcom NetXtreme II CNIC Driver " CNIC_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; | |
| 58 | 60 | |
| 59 | 61 | MODULE_AUTHOR("Michael Chan <mchan@broadcom.com> and John(Zongxi) " |
| 60 | 62 | "Chen (zongxi@broadcom.com"); |
| @@ -724,7 +726,7 @@ static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma) · 663 unmodified lines | ||
| 724 | 726 | |
| 725 | 727 | for (i = 0; i < dma->num_pages; i++) { |
| 726 | 728 | if (dma->pg_arr[i]) { |
| 727 | − dma_free_coherent(&dev->pcidev->dev, BCM_PAGE_SIZE, | |
| 729 | + dma_free_coherent(&dev->pcidev->dev, BNX2_PAGE_SIZE, | |
| 728 | 730 | dma->pg_arr[i], dma->pg_map_arr[i]); |
| 729 | 731 | dma->pg_arr[i] = NULL; |
| 730 | 732 | } |
| @@ -783,7 +785,7 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma, · 52 unmodified lines | ||
| 783 | 785 | |
| 784 | 786 | for (i = 0; i < pages; i++) { |
506 more lines aren’t shown here.
This diff is large: its 74 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 1584 lines aren’t shown here.
This diff is large: its 168 lines aren’t shown here.
This diff is large: its 32 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 10 lines aren’t shown here.
This diff is large: its 314 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 1333 lines aren’t shown here.
This diff is large: its 112 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 33 lines aren’t shown here.
This diff is large: its 1527 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 1000 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 198 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 38 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 14 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 11 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 8 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 37 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 207 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 8 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 555 lines aren’t shown here.
This diff is large: its 233 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 1321 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 317 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 384 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 9 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 76 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 35 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 220 lines aren’t shown here.
This diff is large: its 374 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 223 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 801 lines aren’t shown here.
This diff is large: its 433 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 1039 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 188 lines aren’t shown here.
This diff is large: its 458 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 438 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 149 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 21 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 222 lines aren’t shown here.
This diff is large: its 503 lines aren’t shown here.
This diff is large: its 2269 lines aren’t shown here.
This diff is large: its 154 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 115 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 249 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 200 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 911 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 613 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 14 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 846 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 75 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 18 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 120 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 257 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 82 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 28 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 39 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 448 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 29 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 12 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 752 lines aren’t shown here.
This diff is large: its 311 lines aren’t shown here.
This diff is large: its 239 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 944 lines aren’t shown here.
This diff is large: its 1109 lines aren’t shown here.
This diff is large: its 1310 lines aren’t shown here.
This diff is large: its 2800 lines aren’t shown here.
This diff is large: its 630 lines aren’t shown here.
This diff is large: its 961 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 166 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 451 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 85 lines aren’t shown here.
This diff is large: its 9 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 51 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 29 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 28 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 89 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 21 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 464 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 431 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 989 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 428 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 72 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 45 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 121 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 1426 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 413 lines aren’t shown here.
This diff is large: its 958 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 178 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 2150 lines aren’t shown here.
This diff is large: its 1582 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 203 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 1288 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 435 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 45 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 18 lines aren’t shown here.
This diff is large: its 28 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 11 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 36 lines aren’t shown here.
This diff is large: its 223 lines aren’t shown here.
This diff is large: its 25 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 2 lines aren’t shown here.
This diff is large: its 1799 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 432 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 13 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 747 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 146 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 187 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 470 lines aren’t shown here.
This diff is large: its 190 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 140 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 447 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 124 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 42 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 523 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 37 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 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 203 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 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 306 lines aren’t shown here.
This diff is large: its 278 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 21 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 77 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 35 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 27 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 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 81 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 9 lines aren’t shown here.
This diff is large: its 245 lines aren’t shown here.
This diff is large: its 365 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 1036 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 1116 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 1700 lines aren’t shown here.
This diff is large: its 448 lines aren’t shown here.
This diff is large: its 216 lines aren’t shown here.
This diff is large: its 345 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 1076 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 5248 lines aren’t shown here.
This diff is large: its 472 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 946 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 631 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 455 lines aren’t shown here.
This diff is large: its 2475 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 688 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 17 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 30 lines aren’t shown here.
This diff is large: its 111 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 20 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 36 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 51 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 92 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 217 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 183 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 197 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 119 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 244 lines aren’t shown here.
This diff is large: its 763 lines aren’t shown here.
This diff is large: its 1474 lines aren’t shown here.
This diff is large: its 1634 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 48 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 946 lines aren’t shown here.
This diff is large: its 34 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 247 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 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 162 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 74 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 38 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 81 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 54 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 200 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 18 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 18 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 42 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 13 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 85 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 36 lines aren’t shown here.
This diff is large: its 36 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 31 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 80 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 484 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 224 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 265 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 249 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 79 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 164 lines aren’t shown here.
This diff is large: its 921 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 746 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 543 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 1787 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 2381 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 2045 lines aren’t shown here.
This diff is large: its 225 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 323 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 2098 lines aren’t shown here.
This diff is large: its 506 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 381 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 739 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 671 lines aren’t shown here.
This diff is large: its 726 lines aren’t shown here.
This diff is large: its 269 lines aren’t shown here.
This diff is large: its 47 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 317 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 18 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 38 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 8 lines aren’t shown here.
This diff is large: its 501 lines aren’t shown here.
This diff is large: its 876 lines aren’t shown here.
This diff is large: its 33 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 121 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 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 260 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 34 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 20 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 11 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 2 lines aren’t shown here.
This diff is large: its 248 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 12 lines aren’t shown here.
This diff is large: its 58 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 103 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 105 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 42 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 180 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 24 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 10 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 135 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 8 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 55 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 330 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 640 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 299 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 614 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 9 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 10 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 38 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 14 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 15 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 67 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 53 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 8 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 3 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 32 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 12 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 25 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 43 lines aren’t shown here.
This diff is large: its 338 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 58 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 6 lines aren’t shown here.
This diff is large: its 194 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 167 lines aren’t shown here.
This diff is large: its 25 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 31 lines aren’t shown here.
This diff is large: its 265 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 1067 lines aren’t shown here.
This diff is large: its 168 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 507 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 202 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 960 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 195 lines aren’t shown here.
This diff is large: its 187 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 650 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 472 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 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 147 lines aren’t shown here.
This diff is large: its 439 lines aren’t shown here.
This diff is large: its 876 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 2925 lines aren’t shown here.
This diff is large: its 315 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 254 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 204 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 18 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 482 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 302 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 84 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 20 lines aren’t shown here.
This diff is large: its 501 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 87 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 132 lines aren’t shown here.
This diff is large: its 306 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 29 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 20 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 214 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 267 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 54 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 11 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 27 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 63 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 397 lines aren’t shown here.
This diff is large: its 343 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 39 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 10 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 36 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 20 lines aren’t shown here.
This diff is large: its 382 lines aren’t shown here.
This diff is large: its 269 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 42 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 62 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 283 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 439 lines aren’t shown here.
This diff is large: its 352 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 158 lines aren’t shown here.
This diff is large: its 169 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 119 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 9 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 401 lines aren’t shown here.
This diff is large: its 634 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 200 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 49 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 9 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 29 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 927 lines aren’t shown here.
This diff is large: its 464 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 165 lines aren’t shown here.
This diff is large: its 136 lines aren’t shown here.
This diff is large: its 166 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 352 lines aren’t shown here.
This diff is large: its 484 lines aren’t shown here.
This diff is large: its 258 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 307 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 233 lines aren’t shown here.
This diff is large: its 145 lines aren’t shown here.
This diff is large: its 1225 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 65 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 30 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 586 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 192 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 229 lines aren’t shown here.
This diff is large: its 325 lines aren’t shown here.
This diff is large: its 755 lines aren’t shown here.
This diff is large: its 678 lines aren’t shown here.
This diff is large: its 36 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 26 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 605 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 817 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 21 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 37 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 95 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 284 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 88 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 160 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 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 36 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 133 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 221 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 9 lines aren’t shown here.
This diff is large: its 220 lines aren’t shown here.
This diff is large: its 440 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 67 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 192 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 8 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 47 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 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 45 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 314 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 1296 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 57 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 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 162 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 22 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 28 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 59 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 461 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 43 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 625 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 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 354 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 158 lines aren’t shown here.
This diff is large: its 400 lines aren’t shown here.
This diff is large: its 1721 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 879 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 1026 lines aren’t shown here.
This diff is large: its 91 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 2325 lines aren’t shown here.
This diff is large: its 255 lines aren’t shown here.
This diff is large: its 249 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 20 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.