Aquantia atlantic driver new devices support
Subsystems (3)
cover Aquantia atlantic driver new devices support
This patchset introduces a support for new Aquantia hardware:
AQC11x family with updated hardware (B1) and firmware (2.x and 3.x branches).
For that, a number of improvements in overall driver model were done:
- Firmware specific ops tables. Firmware 2.x and 3.x series support functions are now in separate fw2x module.
- PCI module cleanup and simplification done.
- Verified and tested hardware reset process.
Igor Russkikh (11):
net: aquantia: Introduce new device ids and constants
net: aquantia: Introduce new AQC devices and capabilities
net: aquantia: Convert hw and caps structures to const static pointers
net: aquantia: Cleanup pci functions module
net: aquantia: Remove create/destroy from hw ops
net: aquantia: Change confusing no_ff_addr to more meaningful name
net: aquantia: Introduce firmware ops callbacks
net: aquantia: Introduce support for new firmware on AQC cards
net: aquantia: Introduce global AQC hardware reset sequence
net: aquantia: Report correct mediatype via ethtool
net: aquantia: bump driver version to match aquantia internal
numbering
drivers/net/ethernet/aquantia/atlantic/Makefile | 1 + drivers/net/ethernet/aquantia/atlantic/aq_cfg.h | 8 +- drivers/net/ethernet/aquantia/atlantic/aq_common.h | 38 ++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 46 +-- .../net/ethernet/aquantia/atlantic/aq_hw_utils.c | 5 +- .../net/ethernet/aquantia/atlantic/aq_hw_utils.h | 3 + drivers/net/ethernet/aquantia/atlantic/aq_main.c | 14 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 263 +++++-------- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 29 +- .../net/ethernet/aquantia/atlantic/aq_pci_func.c | 418 +++++++++------------ .../net/ethernet/aquantia/atlantic/aq_pci_func.h | 23 +- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 137 ++++--- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.h | 18 +- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 34 -- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 163 ++++---- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h | 28 +- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 33 -- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 269 +++++++++++-- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 73 +++- .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 184 +++++++++ drivers/net/ethernet/aquantia/atlantic/ver.h | 6 +- 21 files changed, 1020 insertions(+), 773 deletions(-) create mode 100644 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
Signature · 1 line
2.7.4
PATCH 1/11 net: aquantia: Introduce new device ids and constants
New set of aquantia devices has an upgraded hardware (B1). The hardware interface is identical to B0. The difference will be in firmware which is incompatible with old one.
Reorganized and removed duplicate speed and devid definitions Introduced explicit flow control configuration defines
--- drivers/net/ethernet/aquantia/atlantic/aq_cfg.h | 8 ++++- drivers/net/ethernet/aquantia/atlantic/aq_common.h | 34 ++++++++++++++++++++++ drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 13 --------- .../net/ethernet/aquantia/atlantic/aq_pci_func.c | 28 ++++++++++++++---- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 20 ++++++------- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.h | 13 --------- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 16 ++++------ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 20 ++++++------- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h | 13 --------- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 16 ++++------ 10 files changed, 94 insertions(+), 87 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_cfg.h +7 -1
@@ -65,7 +65,13 @@/*#define AQ_CFG_MAC_ADDR_PERMANENT {0x30, 0x0E, 0xE3, 0x12, 0x34, 0x56}*/ -#define AQ_CFG_FC_MODE 3U +#define AQ_NIC_FC_OFF 0U +#define AQ_NIC_FC_TX 1U +#define AQ_NIC_FC_RX 2U +#define AQ_NIC_FC_FULL 3U +#define AQ_NIC_FC_AUTO 4U + +#define AQ_CFG_FC_MODE AQ_NIC_FC_FULL#define AQ_CFG_SPEED_MSK 0xFFFFU/* 0xFFFFU==auto_neg */
drivers/net/ethernet/aquantia/atlantic/aq_common.h +34 -0
@@ -19,4 +19,38 @@#include "aq_cfg.h" #include "aq_utils.h" +#define PCI_VENDOR_ID_AQUANTIA 0x1D6A + +#define AQ_DEVICE_ID_0001 0x0001 +#define AQ_DEVICE_ID_D100 0xD100 +#define AQ_DEVICE_ID_D107 0xD107 +#define AQ_DEVICE_ID_D108 0xD108 +#define AQ_DEVICE_ID_D109 0xD109 + +#define AQ_DEVICE_ID_AQC100 0x00B1 +#define AQ_DEVICE_ID_AQC107 0x07B1 +#define AQ_DEVICE_ID_AQC108 0x08B1 +#define AQ_DEVICE_ID_AQC109 0x09B1 +#define AQ_DEVICE_ID_AQC111 0x11B1 +#define AQ_DEVICE_ID_AQC112 0x12B1 + +#define AQ_DEVICE_ID_AQC100S 0x80B1 +#define AQ_DEVICE_ID_AQC107S 0x87B1 +#define AQ_DEVICE_ID_AQC108S 0x88B1 +#define AQ_DEVICE_ID_AQC109S 0x89B1 +#define AQ_DEVICE_ID_AQC111S 0x91B1 +#define AQ_DEVICE_ID_AQC112S 0x92B1 + +#define AQ_DEVICE_ID_AQC111E 0x51B1 +#define AQ_DEVICE_ID_AQC112E 0x52B1 + +#define HW_ATL_NIC_NAME "aQuantia AQtion 10Gbit Network Adapter" + +#define AQ_NIC_RATE_10G BIT(0) +#define AQ_NIC_RATE_5G BIT(1) +#define AQ_NIC_RATE_5GSR BIT(2) +#define AQ_NIC_RATE_2GS BIT(3) +#define AQ_NIC_RATE_1G BIT(4) +#define AQ_NIC_RATE_100M BIT(5) +#endif /* AQ_COMMON_H */
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +0 -13
@@ -22,19 +22,6 @@ struct aq_hw_ops;struct aq_fw_s ;struct aq_vec_s ; -#define AQ_NIC_FC_OFF 0U -#define AQ_NIC_FC_TX 1U -#define AQ_NIC_FC_RX 2U -#define AQ_NIC_FC_FULL 3U -#define AQ_NIC_FC_AUTO 4U - -#define AQ_NIC_RATE_10G BIT(0) -#define AQ_NIC_RATE_5G BIT(1) -#define AQ_NIC_RATE_5GSR BIT(2) -#define AQ_NIC_RATE_2GS BIT(3) -#define AQ_NIC_RATE_1G BIT(4) -#define AQ_NIC_RATE_100M BIT(5) -struct aq_nic_cfg_s {const struct aq_hw_caps_s *aq_hw_caps;u64 hw_features;
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +23 -5
@@ -34,11 +34,29 @@ struct aq_pci_func_s { };static const struct pci_device_id aq_pci_tbl[] = { - {PCI_VDEVICE (AQUANTIA ,HW_ATL_DEVICE_ID_0001 ), }, - {PCI_VDEVICE (AQUANTIA ,HW_ATL_DEVICE_ID_D100 ), }, - {PCI_VDEVICE (AQUANTIA ,HW_ATL_DEVICE_ID_D107 ), }, - {PCI_VDEVICE (AQUANTIA ,HW_ATL_DEVICE_ID_D108 ), }, - {PCI_VDEVICE (AQUANTIA ,HW_ATL_DEVICE_ID_D109 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_0001 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_D100 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_D107 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_D108 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_D109 ), }, + + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC100 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC107 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC108 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC109 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC111 ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC112 ), }, + + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC100S ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC107S ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC108S ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC109S ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC111S ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC112S ), }, + + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC111E ), }, + {PCI_VDEVICE (AQUANTIA ,AQ_DEVICE_ID_AQC112E ), }, + {} };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +10 -10
@@ -25,12 +25,12 @@ static int hw_atl_a0_get_hw_caps(struct aq_hw_s *self, {memcpy (aq_hw_caps, &hw_atl_a0_hw_caps_,sizeof (*aq_hw_caps)); -if (device ==HW_ATL_DEVICE_ID_D108 && subsystem_device ==0x0001 ) - aq_hw_caps->link_speed_msk &= ~HW_ATL_A0_RATE_10G ; +if (device ==AQ_DEVICE_ID_D108 && subsystem_device ==0x0001 ) + aq_hw_caps->link_speed_msk &= ~AQ_NIC_RATE_10G ; -if (device ==HW_ATL_DEVICE_ID_D109 && subsystem_device ==0x0001 ) { - aq_hw_caps->link_speed_msk &= ~HW_ATL_A0_RATE_10G ; - aq_hw_caps->link_speed_msk &= ~HW_ATL_A0_RATE_5G ; +if (device ==AQ_DEVICE_ID_D109 && subsystem_device ==0x0001 ) { + aq_hw_caps->link_speed_msk &= ~AQ_NIC_RATE_10G ; + aq_hw_caps->link_speed_msk &= ~AQ_NIC_RATE_5G ; }return 0 ;
@@ -907,11 +907,11 @@ static const struct aq_hw_ops hw_atl_ops_ = {const struct aq_hw_ops *hw_atl_a0_get_ops_by_id (struct pci_dev *pdev) {bool is_vid_ok = (pdev->vendor ==PCI_VENDOR_ID_AQUANTIA ); -bool is_did_ok = ((pdev->device ==HW_ATL_DEVICE_ID_0001 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D100 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D107 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D108 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D109 )); +bool is_did_ok = ((pdev->device ==AQ_DEVICE_ID_0001 ) || + (pdev->device ==AQ_DEVICE_ID_D100 ) || + (pdev->device ==AQ_DEVICE_ID_D107 ) || + (pdev->device ==AQ_DEVICE_ID_D108 ) || + (pdev->device ==AQ_DEVICE_ID_D109 ));bool is_rev_ok = (pdev->revision ==1U );
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.h +0 -13
@@ -16,19 +16,6 @@#include "../aq_common.h" -#ifndef PCI_VENDOR_ID_AQUANTIA - -#define PCI_VENDOR_ID_AQUANTIA 0x1D6A -#define HW_ATL_DEVICE_ID_0001 0x0001 -#define HW_ATL_DEVICE_ID_D100 0xD100 -#define HW_ATL_DEVICE_ID_D107 0xD107 -#define HW_ATL_DEVICE_ID_D108 0xD108 -#define HW_ATL_DEVICE_ID_D109 0xD109 - -#define HW_ATL_NIC_NAME "aQuantia AQtion 5Gbit Network Adapter" - -#endif -const struct aq_hw_ops *hw_atl_a0_get_ops_by_id (struct pci_dev *pdev);#endif /* HW_ATL_A0_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h +5 -11
@@ -62,12 +62,6 @@#define HW_ATL_A0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_A0_MPI_SPEED_SHIFT 16U -#define HW_ATL_A0_RATE_10G BIT(0) -#define HW_ATL_A0_RATE_5G BIT(1) -#define HW_ATL_A0_RATE_2G5 BIT(3) -#define HW_ATL_A0_RATE_1G BIT(4) -#define HW_ATL_A0_RATE_100M BIT(5) -#define HW_ATL_A0_TXBUF_MAX 160U#define HW_ATL_A0_RXBUF_MAX 320U
@@ -111,11 +105,11 @@ static struct aq_hw_caps_s hw_atl_a0_hw_caps_ = {NETIF_F_SG | NETIF_F_TSO, .hw_priv_flags = IFF_UNICAST_FLT, - .link_speed_msk = (HW_ATL_A0_RATE_10G | -HW_ATL_A0_RATE_5G | -HW_ATL_A0_RATE_2G5 | -HW_ATL_A0_RATE_1G | - HW_ATL_A0_RATE_100M), + .link_speed_msk = (AQ_NIC_RATE_10G | +AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | + AQ_NIC_RATE_100M), .flow_control = true, .mtu = HW_ATL_A0_MTU_JUMBO, .mac_regs_count = 88,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +10 -10
@@ -26,12 +26,12 @@ static int hw_atl_b0_get_hw_caps(struct aq_hw_s *self, {memcpy (aq_hw_caps, &hw_atl_b0_hw_caps_,sizeof (*aq_hw_caps)); -if (device ==HW_ATL_DEVICE_ID_D108 && subsystem_device ==0x0001 ) - aq_hw_caps->link_speed_msk &= ~HW_ATL_B0_RATE_10G ; +if (device ==AQ_DEVICE_ID_D108 && subsystem_device ==0x0001 ) + aq_hw_caps->link_speed_msk &= ~AQ_NIC_RATE_10G ; -if (device ==HW_ATL_DEVICE_ID_D109 && subsystem_device ==0x0001 ) { - aq_hw_caps->link_speed_msk &= ~HW_ATL_B0_RATE_10G ; - aq_hw_caps->link_speed_msk &= ~HW_ATL_B0_RATE_5G ; +if (device ==AQ_DEVICE_ID_D109 && subsystem_device ==0x0001 ) { + aq_hw_caps->link_speed_msk &= ~AQ_NIC_RATE_10G ; + aq_hw_caps->link_speed_msk &= ~AQ_NIC_RATE_5G ; }return 0 ;
@@ -981,11 +981,11 @@ static const struct aq_hw_ops hw_atl_ops_ = {const struct aq_hw_ops *hw_atl_b0_get_ops_by_id (struct pci_dev *pdev) {bool is_vid_ok = (pdev->vendor ==PCI_VENDOR_ID_AQUANTIA ); -bool is_did_ok = ((pdev->device ==HW_ATL_DEVICE_ID_0001 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D100 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D107 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D108 ) || - (pdev->device ==HW_ATL_DEVICE_ID_D109 )); +bool is_did_ok = ((pdev->device ==AQ_DEVICE_ID_0001 ) || + (pdev->device ==AQ_DEVICE_ID_D100 ) || + (pdev->device ==AQ_DEVICE_ID_D107 ) || + (pdev->device ==AQ_DEVICE_ID_D108 ) || + (pdev->device ==AQ_DEVICE_ID_D109 ));bool is_rev_ok = (pdev->revision ==2U );
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h +0 -13
@@ -16,19 +16,6 @@#include "../aq_common.h" -#ifndef PCI_VENDOR_ID_AQUANTIA - -#define PCI_VENDOR_ID_AQUANTIA 0x1D6A -#define HW_ATL_DEVICE_ID_0001 0x0001 -#define HW_ATL_DEVICE_ID_D100 0xD100 -#define HW_ATL_DEVICE_ID_D107 0xD107 -#define HW_ATL_DEVICE_ID_D108 0xD108 -#define HW_ATL_DEVICE_ID_D109 0xD109 - -#define HW_ATL_NIC_NAME "aQuantia AQtion 5Gbit Network Adapter" - -#endif -const struct aq_hw_ops *hw_atl_b0_get_ops_by_id (struct pci_dev *pdev);#endif /* HW_ATL_B0_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h +5 -11
@@ -67,12 +67,6 @@#define HW_ATL_B0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_B0_MPI_SPEED_SHIFT 16U -#define HW_ATL_B0_RATE_10G BIT(0) -#define HW_ATL_B0_RATE_5G BIT(1) -#define HW_ATL_B0_RATE_2G5 BIT(3) -#define HW_ATL_B0_RATE_1G BIT(4) -#define HW_ATL_B0_RATE_100M BIT(5) -#define HW_ATL_B0_TXBUF_MAX 160U#define HW_ATL_B0_RXBUF_MAX 320U
@@ -166,11 +160,11 @@ static struct aq_hw_caps_s hw_atl_b0_hw_caps_ = {NETIF_F_TSO | NETIF_F_LRO, .hw_priv_flags = IFF_UNICAST_FLT, - .link_speed_msk = (HW_ATL_B0_RATE_10G | -HW_ATL_B0_RATE_5G | -HW_ATL_B0_RATE_2G5 | -HW_ATL_B0_RATE_1G | - HW_ATL_B0_RATE_100M), + .link_speed_msk = (AQ_NIC_RATE_10G | +AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | + AQ_NIC_RATE_100M), .flow_control = true, .mtu = HW_ATL_B0_MTU_JUMBO, .mac_regs_count = 88,
Signature · 1 line
2.7.4
PATCH 2/11 net: aquantia: Introduce new AQC devices and capabilities
In reply to Igor RusskikhA number of new AQC devices is going to be released. To support more flexible capabilities management a number of static caps instances is now declared. Devices now are mainly differs by supported speeds, but in future more parameters will be customized. A set of AQC100 devices have fibre media, not twisted pair - this is also reflected in
new capabilities definitions.
HW level also now directly exports hw_ops for each of A0/B0 hardware.
PCI configuration now uses a device configuration table where each device ID is explicitly mapped with hardware OPs and capabilities structures.
--- drivers/net/ethernet/aquantia/atlantic/aq_common.h | 4 + drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 9 +-- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 9 +-- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 3 +- .../net/ethernet/aquantia/atlantic/aq_pci_func.c | 74 ++++++++++++++---- .../net/ethernet/aquantia/atlantic/aq_pci_func.h | 9 ++- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 90 +++++++++++++-------- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.h | 7 +- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 40 ++-------- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 91 ++++++++++++++-------- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h | 23 +++++- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 39 ++-------- 12 files changed, 239 insertions(+), 159 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_common.h +4 -0
@@ -46,6 +46,10 @@#define HW_ATL_NIC_NAME "aQuantia AQtion 10Gbit Network Adapter" +#define AQ_HWREV_ANY 0 +#define AQ_HWREV_1 1 +#define AQ_HWREV_2 2 +#define AQ_NIC_RATE_10G BIT(0)#define AQ_NIC_RATE_5G BIT(1)#define AQ_NIC_RATE_5GSR BIT(2)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +4 -5
@@ -23,6 +23,7 @@ struct aq_hw_caps_s {u64 hw_features;u64 link_speed_msk;unsigned int hw_priv_flags; +u32 media_type;u32 rxds;u32 txds;u32 txhwb_alignment;
@@ -95,6 +96,9 @@ struct aq_stats_s {#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \ AQ_NIC_LINK_DOWN) +#define AQ_HW_MEDIA_TYPE_TP 1U +#define AQ_HW_MEDIA_TYPE_FIBRE 2U +struct aq_hw_s {atomic_t flags;struct aq_nic_cfg_s *aq_nic_cfg;
@@ -128,11 +132,6 @@ struct aq_hw_ops {void (*destroy)(struct aq_hw_s *self); -int (*get_hw_caps)(struct aq_hw_s *self, -struct aq_hw_caps_s *aq_hw_caps, -unsigned short device, -unsigned short subsystem_device); -int (*hw_ring_tx_xmit)(struct aq_hw_s *self,struct aq_ring_s *aq_ring,unsigned int frags);
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +3 -6
@@ -208,7 +208,8 @@ static void aq_nic_polling_timer_cb(struct timer_list *t)struct aq_nic_s *aq_nic_alloc_cold (struct pci_dev *pdev,struct aq_pci_func_s *aq_pci_func,unsigned int port, -const struct aq_hw_ops *aq_hw_ops) +const struct aq_hw_ops *aq_hw_ops, +const struct aq_hw_caps_s *aq_hw_caps) {struct net_device *ndev =NULL ;struct aq_nic_s *self =NULL ;
@@ -230,16 +231,12 @@ struct aq_nic_s *aq_nic_alloc_cold(struct pci_dev *pdev, self->aq_pci_func = aq_pci_func; self->aq_hw_ops = *aq_hw_ops; + self->aq_hw_caps = *aq_hw_caps; self->port = (u8 )port; self->aq_hw = self->aq_hw_ops.create (aq_pci_func, self->port); self->aq_hw->aq_nic_cfg = &self->aq_nic_cfg; - err = self->aq_hw_ops.get_hw_caps (self->aq_hw, &self->aq_hw_caps, - pdev->device, pdev->subsystem_device); -if (err <0 ) - goto err_exit; -aq_nic_cfg_init_defaults (self); err_exit:
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +2 -1
@@ -92,7 +92,8 @@ static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)struct aq_nic_s *aq_nic_alloc_cold (struct pci_dev *pdev,struct aq_pci_func_s *aq_pci_func,unsigned int port, -const struct aq_hw_ops *aq_hw_ops); +const struct aq_hw_ops *aq_hw_ops, +const struct aq_hw_caps_s *aq_hw_caps);int aq_nic_ndev_init (struct aq_nic_s *self);struct aq_nic_s *aq_nic_alloc_hot (struct net_device *ndev); void aq_nic_set_tx_ring(struct aq_nic_s *self, unsigned int idx,
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +60 -14
111 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h +7 -2
@@ -15,8 +15,13 @@#include "aq_common.h" #include "aq_nic.h" -struct aq_pci_func_s *aq_pci_func_alloc (const struct aq_hw_ops *hw_ops, -struct pci_dev *pdev); +struct aq_board_revision_s { +unsigned short devid; +unsigned short revision; +const struct aq_hw_ops *ops; +const struct aq_hw_caps_s *caps; +}; +int aq_pci_func_init (struct aq_pci_func_s *self); int aq_pci_func_alloc_irq(struct aq_pci_func_s *self, unsigned int i, char *name, void *aq_vec,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +59 -31
110 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.h +6 -1
@@ -16,6 +16,11 @@#include "../aq_common.h" -const struct aq_hw_ops *hw_atl_a0_get_ops_by_id (struct pci_dev *pdev); +extern const struct aq_hw_caps_s hw_atl_a0_caps_aqc100; +extern const struct aq_hw_caps_s hw_atl_a0_caps_aqc107; +extern const struct aq_hw_caps_s hw_atl_a0_caps_aqc108; +extern const struct aq_hw_caps_s hw_atl_a0_caps_aqc109; + +extern const struct aq_hw_ops hw_atl_ops_a0;#endif /* HW_ATL_A0_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h +6 -34
@@ -62,6 +62,12 @@#define HW_ATL_A0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_A0_MPI_SPEED_SHIFT 16U +#define HW_ATL_A0_RATE_10G BIT(0) +#define HW_ATL_A0_RATE_5G BIT(1) +#define HW_ATL_A0_RATE_2G5 BIT(3) +#define HW_ATL_A0_RATE_1G BIT(4) +#define HW_ATL_A0_RATE_100M BIT(5) +#define HW_ATL_A0_TXBUF_MAX 160U#define HW_ATL_A0_RXBUF_MAX 320U
@@ -82,38 +88,4 @@#define HW_ATL_A0_FW_VER_EXPECTED 0x01050006U -/* HW layer capabilities */ -static struct aq_hw_caps_s hw_atl_a0_hw_caps_ = { - .ports =1U , - .is_64_dma = true, - .msix_irqs =4U , - .irq_mask = ~0U , - .vecs =HW_ATL_A0_RSS_MAX , - .tcs =HW_ATL_A0_TC_MAX , - .rxd_alignment =1U , - .rxd_size =HW_ATL_A0_RXD_SIZE , - .rxds =248U , - .txd_alignment =1U , - .txd_size =HW_ATL_A0_TXD_SIZE , - .txds =8U *1024U , - .txhwb_alignment =4096U , - .tx_rings =HW_ATL_A0_TX_RINGS , - .rx_rings =HW_ATL_A0_RX_RINGS , - .hw_features =NETIF_F_HW_CSUM | -NETIF_F_RXCSUM | -NETIF_F_RXHASH | -NETIF_F_SG | -NETIF_F_TSO , - .hw_priv_flags =IFF_UNICAST_FLT , - .link_speed_msk = (AQ_NIC_RATE_10G | -AQ_NIC_RATE_5G | -AQ_NIC_RATE_2GS | -AQ_NIC_RATE_1G | -AQ_NIC_RATE_100M ), - .flow_control = true, - .mtu =HW_ATL_A0_MTU_JUMBO , - .mac_regs_count =88 , - .fw_ver_expected =HW_ATL_A0_FW_VER_EXPECTED , -}; -#endif /* HW_ATL_A0_INTERNAL_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +60 -31
111 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h +22 -1
@@ -16,6 +16,27 @@#include "../aq_common.h" -const struct aq_hw_ops *hw_atl_b0_get_ops_by_id (struct pci_dev *pdev); +extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc100; +extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc107; +extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc108; +extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc109; + +#define hw_atl_b0_caps_aqc111 hw_atl_b0_caps_aqc108 +#define hw_atl_b0_caps_aqc112 hw_atl_b0_caps_aqc109 + +#define hw_atl_b0_caps_aqc100s hw_atl_b0_caps_aqc100 +#define hw_atl_b0_caps_aqc107s hw_atl_b0_caps_aqc107 +#define hw_atl_b0_caps_aqc108s hw_atl_b0_caps_aqc108 +#define hw_atl_b0_caps_aqc109s hw_atl_b0_caps_aqc109 + +#define hw_atl_b0_caps_aqc111s hw_atl_b0_caps_aqc108 +#define hw_atl_b0_caps_aqc112s hw_atl_b0_caps_aqc109 + +#define hw_atl_b0_caps_aqc111e hw_atl_b0_caps_aqc108 +#define hw_atl_b0_caps_aqc112e hw_atl_b0_caps_aqc109 + +extern const struct aq_hw_ops hw_atl_ops_b0; + +#define hw_atl_ops_b1 hw_atl_ops_b0#endif /* HW_ATL_B0_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h +6 -33
@@ -67,6 +67,12 @@#define HW_ATL_B0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_B0_MPI_SPEED_SHIFT 16U +#define HW_ATL_B0_RATE_10G BIT(0) +#define HW_ATL_B0_RATE_5G BIT(1) +#define HW_ATL_B0_RATE_2G5 BIT(3) +#define HW_ATL_B0_RATE_1G BIT(4) +#define HW_ATL_B0_RATE_100M BIT(5) +#define HW_ATL_B0_TXBUF_MAX 160U#define HW_ATL_B0_RXBUF_MAX 320U
@@ -137,38 +143,5 @@#define HW_ATL_INTR_MODER_MIN 0xFF/* HW layer capabilities */ -static struct aq_hw_caps_s hw_atl_b0_hw_caps_ = { - .ports =1U , - .is_64_dma = true, - .msix_irqs =4U , - .irq_mask = ~0U , - .vecs =HW_ATL_B0_RSS_MAX , - .tcs =HW_ATL_B0_TC_MAX , - .rxd_alignment =1U , - .rxd_size =HW_ATL_B0_RXD_SIZE , - .rxds =8U *1024U , - .txd_alignment =1U , - .txd_size =HW_ATL_B0_TXD_SIZE , - .txds =8U *1024U , - .txhwb_alignment =4096U , - .tx_rings =HW_ATL_B0_TX_RINGS , - .rx_rings =HW_ATL_B0_RX_RINGS , - .hw_features =NETIF_F_HW_CSUM | -NETIF_F_RXCSUM | -NETIF_F_RXHASH | -NETIF_F_SG | -NETIF_F_TSO | -NETIF_F_LRO , - .hw_priv_flags =IFF_UNICAST_FLT , - .link_speed_msk = (AQ_NIC_RATE_10G | -AQ_NIC_RATE_5G | -AQ_NIC_RATE_2GS | -AQ_NIC_RATE_1G | -AQ_NIC_RATE_100M ), - .flow_control = true, - .mtu =HW_ATL_B0_MTU_JUMBO , - .mac_regs_count =88 , - .fw_ver_expected =HW_ATL_B0_FW_VER_EXPECTED , -};#endif /* HW_ATL_B0_INTERNAL_H */
Signature · 1 line
2.7.4
PATCH 3/11 net: aquantia: Convert hw and caps structures to const static pointers
In reply to Igor RusskikhThis removes unnecessary structure copying, and prepares the driver for separate firmware ops table introduction.
We also remove extra copy of capabilities structure (which is const actually) and also replace it with a const pointer in aq_nic_cfg.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 97 +++++++++++++------------ drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 3 +- 2 files changed, 50 insertions(+), 50 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +49 -48
@@ -66,8 +66,6 @@ static void aq_nic_cfg_init_defaults(struct aq_nic_s *self) {struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; - cfg->aq_hw_caps = &self->aq_hw_caps; - cfg->vecs =AQ_CFG_VECS_DEF ; cfg->tcs =AQ_CFG_TCS_DEF ;
@@ -123,20 +121,20 @@ int aq_nic_cfg_start(struct aq_nic_s *self) cfg->irq_type =aq_pci_func_get_irq_type (self->aq_pci_func);if ((cfg->irq_type ==AQ_HW_IRQ_LEGACY ) || - (self->aq_hw_caps.vecs ==1U ) || + (cfg->aq_hw_caps->vecs ==1U ) || (cfg->vecs ==1U )) { cfg->is_rss =0U ; cfg->vecs =1U ; } - cfg->link_speed_msk &= self->aq_hw_caps.link_speed_msk; - cfg->hw_features = self->aq_hw_caps.hw_features; + cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; + cfg->hw_features = cfg->aq_hw_caps->hw_features;return 0 ; }static int aq_nic_update_link_status (struct aq_nic_s *self) { -int err = self->aq_hw_ops.hw_get_link_status (self->aq_hw); +int err = self->aq_hw_ops->hw_get_link_status (self->aq_hw);if (err)return err;
@@ -178,8 +176,8 @@ static void aq_nic_service_timer_cb(struct timer_list *t)if (err) goto err_exit; -if (self->aq_hw_ops.hw_update_stats) - self->aq_hw_ops.hw_update_stats (self->aq_hw); +if (self->aq_hw_ops->hw_update_stats) + self->aq_hw_ops->hw_update_stats (self->aq_hw);aq_nic_update_ndev_stats (self);
@@ -230,12 +228,14 @@ struct aq_nic_s *aq_nic_alloc_cold(struct pci_dev *pdev, self->aq_pci_func = aq_pci_func; - self->aq_hw_ops = *aq_hw_ops; - self->aq_hw_caps = *aq_hw_caps; + self->aq_hw_ops = aq_hw_ops; + self->aq_nic_cfg.aq_hw_caps = aq_hw_caps; + self->aq_hw->aq_nic_cfg = &self->aq_nic_cfg; self->port = (u8 )port; - self->aq_hw = self->aq_hw_ops.create (aq_pci_func, self->port); - self->aq_hw->aq_nic_cfg = &self->aq_nic_cfg; + self->aq_hw = self->aq_hw_ops->create (aq_pci_func, self->port); +if (err <0 ) + goto err_exit;aq_nic_cfg_init_defaults (self);
@@ -255,7 +255,7 @@ int aq_nic_ndev_register(struct aq_nic_s *self) err = -EINVAL ; goto err_exit; } - err = self->aq_hw_ops.hw_get_mac_permanent (self->aq_hw, + err = self->aq_hw_ops->hw_get_mac_permanent (self->aq_hw, self->ndev->dev_addr);if (err <0 ) goto err_exit;
@@ -289,7 +289,7 @@ int aq_nic_ndev_init(struct aq_nic_s *self) self->ndev->features = aq_hw_caps->hw_features; self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; self->ndev->mtu = aq_nic_cfg->mtu -ETH_HLEN ; - self->ndev->max_mtu = self->aq_hw_caps.mtu -ETH_FCS_LEN -ETH_HLEN ; + self->ndev->max_mtu = aq_hw_caps->mtu -ETH_FCS_LEN -ETH_HLEN ;return 0 ; }
@@ -303,7 +303,7 @@ void aq_nic_ndev_free(struct aq_nic_s *self)unregister_netdev (self->ndev);if (self->aq_hw) - self->aq_hw_ops.destroy (self->aq_hw); + self->aq_hw_ops->destroy (self->aq_hw);free_netdev (self->ndev);
@@ -365,18 +365,18 @@ int aq_nic_init(struct aq_nic_s *self)unsigned int i =0U ; self->power_state =AQ_HW_POWER_STATE_D0 ; - err = self->aq_hw_ops.hw_reset (self->aq_hw); + err = self->aq_hw_ops->hw_reset (self->aq_hw);if (err <0 ) goto err_exit; - err = self->aq_hw_ops.hw_init (self->aq_hw, + err = self->aq_hw_ops->hw_init (self->aq_hw,aq_nic_get_ndev (self)->dev_addr);if (err <0 ) goto err_exit;for (i =0U , aq_vec = self->aq_vec[0 ]; self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) -aq_vec_init (aq_vec, &self->aq_hw_ops, self->aq_hw); +aq_vec_init (aq_vec, self->aq_hw_ops, self->aq_hw); err_exit:return err;
@@ -388,13 +388,13 @@ int aq_nic_start(struct aq_nic_s *self)int err =0 ;unsigned int i =0U ; - err = self->aq_hw_ops.hw_multicast_list_set (self->aq_hw, + err = self->aq_hw_ops->hw_multicast_list_set (self->aq_hw, self->mc_list.ar, self->mc_list.count);if (err <0 ) goto err_exit; - err = self->aq_hw_ops.hw_packet_filter_set (self->aq_hw, + err = self->aq_hw_ops->hw_packet_filter_set (self->aq_hw, self->packet_filter);if (err <0 ) goto err_exit;
@@ -406,7 +406,7 @@ int aq_nic_start(struct aq_nic_s *self) goto err_exit; } - err = self->aq_hw_ops.hw_start (self->aq_hw); + err = self->aq_hw_ops->hw_start (self->aq_hw);if (err <0 ) goto err_exit;
@@ -431,7 +431,7 @@ int aq_nic_start(struct aq_nic_s *self) goto err_exit; } - err = self->aq_hw_ops.hw_irq_enable (self->aq_hw, + err = self->aq_hw_ops->hw_irq_enable (self->aq_hw,AQ_CFG_IRQ_MASK );if (err <0 ) goto err_exit;
@@ -616,7 +616,7 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb) frags =aq_nic_map_skb (self, skb, ring);if (likely (frags)) { - err = self->aq_hw_ops.hw_ring_tx_xmit (self->aq_hw, + err = self->aq_hw_ops->hw_ring_tx_xmit (self->aq_hw, ring, frags);if (err >=0 ) {
@@ -633,14 +633,14 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)int aq_nic_update_interrupt_moderation_settings (struct aq_nic_s *self) { -return self->aq_hw_ops.hw_interrupt_moderation_set (self->aq_hw); +return self->aq_hw_ops->hw_interrupt_moderation_set (self->aq_hw); }int aq_nic_set_packet_filter (struct aq_nic_s *self,unsigned int flags) {int err =0 ; - err = self->aq_hw_ops.hw_packet_filter_set (self->aq_hw, flags); + err = self->aq_hw_ops->hw_packet_filter_set (self->aq_hw, flags);if (err <0 ) goto err_exit;
@@ -672,11 +672,11 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)* multicast mask */ self->packet_filter |=IFF_ALLMULTI ; - self->aq_hw->aq_nic_cfg->mc_list_count =0 ; -return self->aq_hw_ops.hw_packet_filter_set (self->aq_hw, + self->aq_nic_cfg.mc_list_count =0 ; +return self->aq_hw_ops->hw_packet_filter_set (self->aq_hw, self->packet_filter); }else { -return self->aq_hw_ops.hw_multicast_list_set (self->aq_hw, +return self->aq_hw_ops->hw_multicast_list_set (self->aq_hw, self->mc_list.ar, self->mc_list.count); }
@@ -691,7 +691,7 @@ int aq_nic_set_mtu(struct aq_nic_s *self, int new_mtu)int aq_nic_set_mac (struct aq_nic_s *self,struct net_device *ndev) { -return self->aq_hw_ops.hw_set_mac_address (self->aq_hw, ndev->dev_addr); +return self->aq_hw_ops->hw_set_mac_address (self->aq_hw, ndev->dev_addr); }unsigned int aq_nic_get_link_speed (struct aq_nic_s *self)
@@ -706,8 +706,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p) regs->version =1 ; - err = self->aq_hw_ops.hw_get_regs (self->aq_hw, - &self->aq_hw_caps, regs_buff); + err = self->aq_hw_ops->hw_get_regs (self->aq_hw, + self->aq_nic_cfg.aq_hw_caps, + regs_buff);if (err <0 ) goto err_exit;
@@ -717,7 +718,7 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)int aq_nic_get_regs_count (struct aq_nic_s *self) { -return self->aq_hw_caps.mac_regs_count; +return self->aq_nic_cfg.aq_hw_caps->mac_regs_count; }void aq_nic_get_stats (struct aq_nic_s *self,u64 *data)
@@ -725,7 +726,7 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data)unsigned int i =0U ;unsigned int count =0U ;struct aq_vec_s *aq_vec =NULL ; -struct aq_stats_s *stats = self->aq_hw_ops.hw_get_hw_stats (self->aq_hw); +struct aq_stats_s *stats = self->aq_hw_ops->hw_get_hw_stats (self->aq_hw);if (!stats) goto err_exit;
@@ -770,7 +771,7 @@ err_exit:;static void aq_nic_update_ndev_stats (struct aq_nic_s *self) {struct net_device *ndev = self->ndev; -struct aq_stats_s *stats = self->aq_hw_ops.hw_get_hw_stats (self->aq_hw); +struct aq_stats_s *stats = self->aq_hw_ops->hw_get_hw_stats (self->aq_hw); ndev->stats.rx_packets = stats->uprc + stats->mprc + stats->bprc; ndev->stats.rx_bytes = stats->ubrc + stats->mbrc + stats->bbrc;
@@ -791,27 +792,27 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self,ethtool_link_ksettings_zero_link_mode (cmd, supported); -if (self->aq_hw_caps.link_speed_msk &AQ_NIC_RATE_10G ) +if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk &AQ_NIC_RATE_10G )ethtool_link_ksettings_add_link_mode (cmd, supported, 10000baseT_Full); -if (self->aq_hw_caps.link_speed_msk &AQ_NIC_RATE_5G ) +if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk &AQ_NIC_RATE_5G )ethtool_link_ksettings_add_link_mode (cmd, supported, 5000baseT_Full); -if (self->aq_hw_caps.link_speed_msk &AQ_NIC_RATE_2GS ) +if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk &AQ_NIC_RATE_2GS )ethtool_link_ksettings_add_link_mode (cmd, supported, 2500baseT_Full); -if (self->aq_hw_caps.link_speed_msk &AQ_NIC_RATE_1G ) +if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk &AQ_NIC_RATE_1G )ethtool_link_ksettings_add_link_mode (cmd, supported, 1000baseT_Full); -if (self->aq_hw_caps.link_speed_msk &AQ_NIC_RATE_100M ) +if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk &AQ_NIC_RATE_100M )ethtool_link_ksettings_add_link_mode (cmd, supported, 100baseT_Full); -if (self->aq_hw_caps.flow_control) +if (self->aq_nic_cfg.aq_hw_caps->flow_control)ethtool_link_ksettings_add_link_mode (cmd, supported, Pause);
@@ -858,7 +859,7 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self,int err =0 ;if (cmd->base.autoneg ==AUTONEG_ENABLE ) { - rate = self->aq_hw_caps.link_speed_msk; + rate = self->aq_nic_cfg.aq_hw_caps->link_speed_msk; self->aq_nic_cfg.is_autoneg = true; }else { speed = cmd->base.speed;
@@ -889,7 +890,7 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self, goto err_exit;break ; } -if (!(self->aq_hw_caps.link_speed_msk & rate)) { +if (!(self->aq_nic_cfg.aq_hw_caps->link_speed_msk & rate)) { err =-1 ; goto err_exit; }
@@ -897,7 +898,7 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self, self->aq_nic_cfg.is_autoneg = false; } - err = self->aq_hw_ops.hw_set_link_speed (self->aq_hw, rate); + err = self->aq_hw_ops->hw_set_link_speed (self->aq_hw, rate);if (err <0 ) goto err_exit;
@@ -916,7 +917,7 @@ u32 aq_nic_get_fw_version(struct aq_nic_s *self) {u32 fw_version =0U ; - self->aq_hw_ops.hw_get_fw_version (self->aq_hw, &fw_version); + self->aq_hw_ops->hw_get_fw_version (self->aq_hw, &fw_version);return fw_version; }
@@ -931,7 +932,7 @@ int aq_nic_stop(struct aq_nic_s *self)del_timer_sync (&self->service_timer); - self->aq_hw_ops.hw_irq_disable (self->aq_hw,AQ_CFG_IRQ_MASK ); + self->aq_hw_ops->hw_irq_disable (self->aq_hw,AQ_CFG_IRQ_MASK );if (self->aq_nic_cfg.is_polling)del_timer_sync (&self->polling_timer);
@@ -942,7 +943,7 @@ int aq_nic_stop(struct aq_nic_s *self) self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i])aq_vec_stop (aq_vec); -return self->aq_hw_ops.hw_stop (self->aq_hw); +return self->aq_hw_ops->hw_stop (self->aq_hw); }void aq_nic_deinit (struct aq_nic_s *self)
@@ -958,9 +959,9 @@ void aq_nic_deinit(struct aq_nic_s *self)aq_vec_deinit (aq_vec);if (self->power_state ==AQ_HW_POWER_STATE_D0 ) { - (void )self->aq_hw_ops.hw_deinit (self->aq_hw); + (void )self->aq_hw_ops->hw_deinit (self->aq_hw); }else { - (void )self->aq_hw_ops.hw_set_power (self->aq_hw, + (void )self->aq_hw_ops->hw_set_power (self->aq_hw, self->power_state); }
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +1 -2
@@ -69,8 +69,7 @@ struct aq_nic_s {unsigned int packet_filter;unsigned int power_state;u8 port; -struct aq_hw_ops aq_hw_ops; -struct aq_hw_caps_s aq_hw_caps; +const struct aq_hw_ops *aq_hw_ops;struct aq_nic_cfg_s aq_nic_cfg;struct timer_list service_timer;struct timer_list polling_timer;
Signature · 1 line
2.7.4
PATCH 4/11 net: aquantia: Cleanup pci functions module
In reply to Igor RusskikhDriver contained a dead code of maintaining multiple pci port instances. That will never be used since for each pci function a separate NIC instance is created.
Simplify this, making pci module only responsible for pci resource management.
NIC initialization is also simplified accordingly.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 1 - drivers/net/ethernet/aquantia/atlantic/aq_main.c | 14 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 157 ++-------- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 13 +- .../net/ethernet/aquantia/atlantic/aq_pci_func.c | 340 +++++++-------------- .../net/ethernet/aquantia/atlantic/aq_pci_func.h | 14 +- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 2 - 7 files changed, 156 insertions(+), 385 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +0 -1
@@ -31,7 +31,6 @@ struct aq_hw_caps_s {u32 vecs;u32 mtu;u32 mac_regs_count; -u8 ports;u8 msix_irqs;u8 tcs;u8 rxd_alignment;
drivers/net/ethernet/aquantia/atlantic/aq_main.c +3 -11
@@ -43,14 +43,9 @@ struct net_device *aq_ndev_alloc(void)static int aq_ndev_open (struct net_device *ndev) { -struct aq_nic_s *aq_nic =NULL ;int err =0 ; +struct aq_nic_s *aq_nic =netdev_priv (ndev); - aq_nic =aq_nic_alloc_hot (ndev); -if (!aq_nic) { - err = -ENOMEM ; - goto err_exit; - } err =aq_nic_init (aq_nic);if (err <0 ) goto err_exit;
@@ -73,7 +68,6 @@ static int aq_ndev_close(struct net_device *ndev)if (err <0 ) goto err_exit;aq_nic_deinit (aq_nic); -aq_nic_free_hot_resources (aq_nic); err_exit:return err;
@@ -145,15 +139,13 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev) err =aq_nic_set_packet_filter (aq_nic, ndev->flags);if (err <0 ) - goto err_exit; +return ;if (netdev_mc_count (ndev)) { err =aq_nic_set_multicast_list (aq_nic, ndev);if (err <0 ) - goto err_exit; +return ; } - -err_exit:; }static const struct net_device_ops aq_ndev_ops = {
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +29 -128
282 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +3 -10
@@ -17,7 +17,6 @@#include "aq_hw.h" struct aq_ring_s ; -struct aq_pci_func_s ;struct aq_hw_ops ;struct aq_fw_s ;struct aq_vec_s ;
@@ -64,7 +63,6 @@ struct aq_nic_s {struct aq_ring_s *aq_ring_tx[AQ_CFG_VECS_MAX *AQ_CFG_TCS_MAX ];struct aq_hw_s *aq_hw;struct net_device *ndev; -struct aq_pci_func_s *aq_pci_func;unsigned int aq_vecs;unsigned int packet_filter;unsigned int power_state;
@@ -88,19 +86,13 @@ static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)return self->ndev->dev.parent; } -struct aq_nic_s *aq_nic_alloc_cold (struct pci_dev *pdev, -struct aq_pci_func_s *aq_pci_func, -unsigned int port, -const struct aq_hw_ops *aq_hw_ops, -const struct aq_hw_caps_s *aq_hw_caps); -int aq_nic_ndev_init (struct aq_nic_s *self); +void aq_nic_ndev_init (struct aq_nic_s *self);struct aq_nic_s *aq_nic_alloc_hot (struct net_device *ndev);void aq_nic_set_tx_ring (struct aq_nic_s *self,unsigned int idx,struct aq_ring_s *ring); -struct device *aq_nic_get_dev (struct aq_nic_s *self);struct net_device *aq_nic_get_ndev (struct aq_nic_s *self);int aq_nic_init (struct aq_nic_s *self); -int aq_nic_cfg_start (struct aq_nic_s *self); +void aq_nic_cfg_start (struct aq_nic_s *self);int aq_nic_ndev_register (struct aq_nic_s *self);void aq_nic_ndev_free (struct aq_nic_s *self);int aq_nic_start (struct aq_nic_s *self);
@@ -111,6 +103,7 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data);int aq_nic_stop (struct aq_nic_s *self);void aq_nic_deinit (struct aq_nic_s *self);void aq_nic_free_hot_resources (struct aq_nic_s *self); +void aq_nic_free_vectors (struct aq_nic_s *self);int aq_nic_set_mtu (struct aq_nic_s *self,int new_mtu);int aq_nic_set_mac (struct aq_nic_s *self,struct net_device *ndev);int aq_nic_set_packet_filter (struct aq_nic_s *self,unsigned int flags);
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +117 -223
441 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h +4 -10
@@ -22,17 +22,11 @@ struct aq_board_revision_s { const struct aq_hw_caps_s *caps; }; -int aq_pci_func_init (struct aq_pci_func_s *self); -int aq_pci_func_alloc_irq (struct aq_pci_func_s *self,unsigned int i, +int aq_pci_func_init (struct pci_dev *pdev); +int aq_pci_func_alloc_irq (struct aq_nic_s *self,unsigned int i,char *name,void *aq_vec,cpumask_t *affinity_mask); -void aq_pci_func_free_irqs (struct aq_pci_func_s *self); -int aq_pci_func_start (struct aq_pci_func_s *self); -void __iomem *aq_pci_func_get_mmio (struct aq_pci_func_s *self); -unsigned int aq_pci_func_get_irq_type (struct aq_pci_func_s *self); -void aq_pci_func_deinit (struct aq_pci_func_s *self); -void aq_pci_func_free (struct aq_pci_func_s *self); -int aq_pci_func_change_pm_state (struct aq_pci_func_s *self, -pm_message_t *pm_msg); +void aq_pci_func_free_irqs (struct aq_nic_s *self); +unsigned int aq_pci_func_get_irq_type (struct aq_nic_s *self);#endif /* AQ_PCI_FUNC_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +0 -2
@@ -369,8 +369,6 @@ int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,u32 l =0U ;u32 mac_addr[2 ]; - self->mmio =aq_pci_func_get_mmio (self->aq_pci_func); -hw_atl_utils_hw_chip_features_init (self, &self->chip_features);
Signature · 1 line
2.7.4
PATCH 5/11 net: aquantia: Remove create/destroy from hw ops
In reply to Igor RusskikhThese ops are not related to HW and are now implemented in pci module. Thus, remove these ops pointers and implementation.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 5 ----- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 25 ---------------------- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 24 --------------------- 3 files changed, 54 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +0 -5
@@ -101,7 +101,6 @@ struct aq_stats_s {struct aq_hw_s {atomic_t flags;struct aq_nic_cfg_s *aq_nic_cfg; -struct aq_pci_func_s *aq_pci_func;void __iomem *mmio;unsigned int not_ff_addr;struct aq_hw_link_status_s aq_link_status;
@@ -126,10 +125,6 @@ struct aq_nic_cfg_s;struct sk_buff ;struct aq_hw_ops { -struct aq_hw_s *(*create)(struct aq_pci_func_s *aq_pci_func, -unsigned int port); - -void (*destroy)(struct aq_hw_s *self);int (*hw_ring_tx_xmit)(struct aq_hw_s *self,struct aq_ring_s *aq_ring,unsigned int frags);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +0 -25
@@ -79,29 +79,6 @@ const struct aq_hw_caps_s hw_atl_a0_caps_aqc109 = { HW_ATL_A0_RATE_100M, }; - -static struct aq_hw_s *hw_atl_a0_create (struct aq_pci_func_s *aq_pci_func, -unsigned int port) -{ -struct aq_hw_s *self =NULL ; - - self =kzalloc (sizeof (*self),GFP_KERNEL ); -if (!self) - goto err_exit; - - self->aq_pci_func = aq_pci_func; - - self->not_ff_addr =0x10U ; - -err_exit: -return self; -} - -static void hw_atl_a0_destroy (struct aq_hw_s *self) -{ -kfree (self); -} -static int hw_atl_a0_hw_reset (struct aq_hw_s *self) {int err =0 ;
@@ -906,8 +883,6 @@ static int hw_atl_a0_hw_set_speed(struct aq_hw_s *self, u32 speed) }const struct aq_hw_ops hw_atl_ops_a0 = { - .create = hw_atl_a0_create, - .destroy = hw_atl_a0_destroy, .hw_get_mac_permanent = hw_atl_utils_get_mac_permanent, .hw_set_mac_address = hw_atl_a0_hw_mac_addr_set, .hw_get_link_status = hw_atl_utils_mpi_get_link_status,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +0 -24
@@ -82,28 +82,6 @@ const struct aq_hw_caps_s hw_atl_b0_caps_aqc109 = { HW_ATL_B0_RATE_100M, }; -static struct aq_hw_s *hw_atl_b0_create (struct aq_pci_func_s *aq_pci_func, -unsigned int port) -{ -struct aq_hw_s *self =NULL ; - - self =kzalloc (sizeof (*self),GFP_KERNEL ); -if (!self) - goto err_exit; - - self->aq_pci_func = aq_pci_func; - - self->not_ff_addr =0x10U ; - -err_exit: -return self; -} - -static void hw_atl_b0_destroy (struct aq_hw_s *self) -{ -kfree (self); -} -static int hw_atl_b0_hw_reset (struct aq_hw_s *self) {int err =0 ;
@@ -981,8 +959,6 @@ static int hw_atl_b0_hw_set_speed(struct aq_hw_s *self, u32 speed) }const struct aq_hw_ops hw_atl_ops_b0 = { - .create = hw_atl_b0_create, - .destroy = hw_atl_b0_destroy, .hw_get_mac_permanent = hw_atl_utils_get_mac_permanent, .hw_set_mac_address = hw_atl_b0_hw_mac_addr_set, .hw_get_link_status = hw_atl_utils_mpi_get_link_status,
Signature · 1 line
2.7.4
PATCH 6/11 net: aquantia: Change confusing no_ff_addr to more meaningful name
In reply to Igor RusskikhThe address to check if HW is not dead/hang could be stored in capabilities, since it is a constant. Change its name to better reflect the idea.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c | 5 ++++- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 3 ++- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +1 -1
@@ -31,6 +31,7 @@ struct aq_hw_caps_s {u32 vecs;u32 mtu;u32 mac_regs_count; +u32 hw_alive_check_addr;u8 msix_irqs;u8 tcs;u8 rxd_alignment;
@@ -102,7 +103,6 @@ struct aq_hw_s {atomic_t flags;struct aq_nic_cfg_s *aq_nic_cfg;void __iomem *mmio; -unsigned int not_ff_addr;struct aq_hw_link_status_s aq_link_status;struct hw_aq_atl_utils_mbox mbox;struct hw_atl_stats_s last_stats;
drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c +4 -1
@@ -13,6 +13,7 @@#include "aq_hw_utils.h" #include "aq_hw.h" +#include "aq_nic.h" void aq_hw_write_reg_bit (struct aq_hw_s *aq_hw,u32 addr,u32 msk,u32 shift,u32 val)
@@ -39,7 +40,9 @@ u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg) {u32 value =readl (hw->mmio + reg); -if ((~0U ) == value && (~0U ) ==readl (hw->mmio + hw->not_ff_addr)) +if ((~0U ) == value && + (~0U ) ==readl (hw->mmio + + hw->aq_nic_cfg->aq_hw_caps->hw_alive_check_addr))aq_utils_obj_set (&hw->flags,AQ_HW_FLAG_ERR_UNPLUG );return value;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +2 -1
@@ -41,7 +41,8 @@ .hw_priv_flags = IFF_UNICAST_FLT, \ .flow_control = true, \ .mtu = HW_ATL_A0_MTU_JUMBO, \ - .mac_regs_count = 88 + .mac_regs_count = 88, \ + .hw_alive_check_addr = 0x10U const struct aq_hw_caps_s hw_atl_a0_caps_aqc100 = {DEFAULT_A0_BOARD_BASIC_CAPABILITIES ,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +2 -1
@@ -43,7 +43,8 @@ .hw_priv_flags = IFF_UNICAST_FLT, \ .flow_control = true, \ .mtu = HW_ATL_B0_MTU_JUMBO, \ - .mac_regs_count = 88 + .mac_regs_count = 88, \ + .hw_alive_check_addr = 0x10U const struct aq_hw_caps_s hw_atl_b0_caps_aqc100 = {DEFAULT_B0_BOARD_BASIC_CAPABILITIES ,
Signature · 1 line
2.7.4
PATCH 7/11 net: aquantia: Introduce firmware ops callbacks
In reply to Igor RusskikhNew AQC cards will have an updated firmware with new binary interface. This patch extracts firmware specific operations into a separate table and prepares for the introduction of new fw 2.x and 3.x
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 27 ++++--- .../net/ethernet/aquantia/atlantic/aq_hw_utils.h | 3 + drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 14 ++-- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 1 + .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 23 ++---- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 23 ++---- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 82 +++++++++++++++------- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 10 ++- 8 files changed, 102 insertions(+), 81 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +17 -10
@@ -102,6 +102,7 @@ struct aq_stats_s {struct aq_hw_s {atomic_t flags;struct aq_nic_cfg_s *aq_nic_cfg; +const struct aq_fw_ops *aq_fw_ops;void __iomem *mmio;struct aq_hw_link_status_s aq_link_status;struct hw_aq_atl_utils_mbox mbox;
@@ -121,7 +122,6 @@ struct aq_hw_s {struct aq_ring_s ;struct aq_ring_param_s ; -struct aq_nic_cfg_s ;struct sk_buff ;struct aq_hw_ops {
@@ -138,15 +138,8 @@ struct aq_hw_ops {int (*hw_ring_tx_head_update)(struct aq_hw_s *self,struct aq_ring_s *aq_ring); -int (*hw_get_mac_permanent)(struct aq_hw_s *self, -u8 *mac); -int (*hw_set_mac_address)(struct aq_hw_s *self,u8 *mac_addr); -int (*hw_get_link_status)(struct aq_hw_s *self); - -int (*hw_set_link_speed)(struct aq_hw_s *self,u32 speed); -int (*hw_reset)(struct aq_hw_s *self);int (*hw_init)(struct aq_hw_s *self,u8 *mac_addr);
@@ -200,8 +193,6 @@ struct aq_hw_ops {const struct aq_hw_caps_s *aq_hw_caps, u32 *regs_buff); -int (*hw_update_stats)(struct aq_hw_s *self); -struct aq_stats_s *(*hw_get_hw_stats)(struct aq_hw_s *self);int (*hw_get_fw_version)(struct aq_hw_s *self,u32 *fw_version);
@@ -211,4 +202,20 @@ struct aq_hw_ops { int (*hw_set_power)(struct aq_hw_s *self, unsigned int power_state); }; +struct aq_fw_ops { +int (*init)(struct aq_hw_s *self); + +int (*reset)(struct aq_hw_s *self); + +int (*get_mac_permanent)(struct aq_hw_s *self,u8 *mac); + +int (*set_link_speed)(struct aq_hw_s *self,u32 speed); + +int (*set_state)(struct aq_hw_s *self,enum hal_atl_utils_fw_state_e state); + +int (*update_link_status)(struct aq_hw_s *self); + +int (*update_stats)(struct aq_hw_s *self); +}; +#endif /* AQ_HW_H */
drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h +3 -0
@@ -35,6 +35,9 @@ do { \ } \ } while (0) +#define aq_pr_err (...) pr_err(AQ_CFG_DRV_NAME ": " __VA_ARGS__) +#define aq_pr_trace (...) pr_info(AQ_CFG_DRV_NAME ": " __VA_ARGS__) +struct aq_hw_s ; void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +9 -5
@@ -122,7 +122,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self)static int aq_nic_update_link_status (struct aq_nic_s *self) { -int err = self->aq_hw_ops->hw_get_link_status (self->aq_hw); +int err = self->aq_fw_ops->update_link_status (self->aq_hw);if (err)return err;
@@ -164,8 +164,8 @@ static void aq_nic_service_timer_cb(struct timer_list *t)if (err) goto err_exit; -if (self->aq_hw_ops->hw_update_stats) - self->aq_hw_ops->hw_update_stats (self->aq_hw); +if (self->aq_fw_ops->update_stats) + self->aq_fw_ops->update_stats (self->aq_hw);aq_nic_update_ndev_stats (self);
@@ -200,7 +200,11 @@ int aq_nic_ndev_register(struct aq_nic_s *self) goto err_exit; } - err = self->aq_hw_ops->hw_get_mac_permanent (self->aq_hw, + err =hw_atl_utils_initfw (self->aq_hw, &self->aq_fw_ops); +if (err) + goto err_exit; + + err = self->aq_fw_ops->get_mac_permanent (self->aq_hw, self->ndev->dev_addr);if (err) goto err_exit;
@@ -799,7 +803,7 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self, self->aq_nic_cfg.is_autoneg = false; } - err = self->aq_hw_ops->hw_set_link_speed (self->aq_hw, rate); + err = self->aq_fw_ops->set_link_speed (self->aq_hw, rate);if (err <0 ) goto err_exit;
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +1 -0
@@ -68,6 +68,7 @@ struct aq_nic_s {unsigned int power_state;u8 port;const struct aq_hw_ops *aq_hw_ops; +const struct aq_fw_ops *aq_fw_ops;struct aq_nic_cfg_s aq_nic_cfg;struct timer_list service_timer;struct timer_list polling_timer;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +4 -19
@@ -105,7 +105,7 @@ static int hw_atl_a0_hw_reset(struct aq_hw_s *self)if (err <0 ) goto err_exit; -hw_atl_utils_mpi_set (self,MPI_RESET ,0x0U ); + self->aq_fw_ops->set_state (self,MPI_RESET ); err =aq_hw_err_from_flags (self);
@@ -354,7 +354,8 @@ static int hw_atl_a0_hw_init(struct aq_hw_s *self, u8 *mac_addr)hw_atl_a0_hw_mac_addr_set (self, mac_addr); -hw_atl_utils_mpi_set (self,MPI_INIT , aq_nic_cfg->link_speed_msk); + self->aq_fw_ops->set_link_speed (self, aq_nic_cfg->link_speed_msk); + self->aq_fw_ops->set_state (self,MPI_INIT );hw_atl_reg_tx_dma_debug_ctl_set (self,0x800000b8U );hw_atl_reg_tx_dma_debug_ctl_set (self,0x000000b8U );
@@ -365,7 +366,7 @@ static int hw_atl_a0_hw_init(struct aq_hw_s *self, u8 *mac_addr)/* Reset link status and read out initial hardware counters */ self->aq_link_status.mbps =0 ; -hw_atl_utils_update_stats (self); + self->aq_fw_ops->update_stats (self); err =aq_hw_err_from_flags (self);if (err <0 )
@@ -871,23 +872,8 @@ static int hw_atl_a0_hw_ring_rx_stop(struct aq_hw_s *self,return aq_hw_err_from_flags (self); } -static int hw_atl_a0_hw_set_speed (struct aq_hw_s *self,u32 speed) -{ -int err =0 ; - - err =hw_atl_utils_mpi_set_speed (self, speed,MPI_INIT ); -if (err <0 ) - goto err_exit; - -err_exit: -return err; -} -const struct aq_hw_ops hw_atl_ops_a0 = { - .hw_get_mac_permanent = hw_atl_utils_get_mac_permanent, .hw_set_mac_address = hw_atl_a0_hw_mac_addr_set, - .hw_get_link_status = hw_atl_utils_mpi_get_link_status, - .hw_set_link_speed = hw_atl_a0_hw_set_speed, .hw_init = hw_atl_a0_hw_init, .hw_deinit = hw_atl_utils_hw_deinit, .hw_set_power = hw_atl_utils_hw_set_power,
@@ -917,7 +903,6 @@ const struct aq_hw_ops hw_atl_ops_a0 = { .hw_rss_set = hw_atl_a0_hw_rss_set, .hw_rss_hash_set = hw_atl_a0_hw_rss_hash_set, .hw_get_regs = hw_atl_utils_hw_get_regs, - .hw_update_stats = hw_atl_utils_update_stats, .hw_get_hw_stats = hw_atl_utils_get_hw_stats, .hw_get_fw_version = hw_atl_utils_get_fw_version, };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +4 -19
@@ -108,7 +108,7 @@ static int hw_atl_b0_hw_reset(struct aq_hw_s *self)if (err <0 ) goto err_exit; -hw_atl_utils_mpi_set (self,MPI_RESET ,0x0U ); + self->aq_fw_ops->set_state (self,MPI_RESET ); err =aq_hw_err_from_flags (self);
@@ -403,7 +403,8 @@ static int hw_atl_b0_hw_init(struct aq_hw_s *self, u8 *mac_addr)hw_atl_b0_hw_mac_addr_set (self, mac_addr); -hw_atl_utils_mpi_set (self,MPI_INIT , aq_nic_cfg->link_speed_msk); + self->aq_fw_ops->set_link_speed (self, aq_nic_cfg->link_speed_msk); + self->aq_fw_ops->set_state (self,MPI_INIT );hw_atl_b0_hw_qos_set (self);hw_atl_b0_hw_rss_set (self, &aq_nic_cfg->aq_rss);
@@ -422,7 +423,7 @@ static int hw_atl_b0_hw_init(struct aq_hw_s *self, u8 *mac_addr)/* Reset link status and read out initial hardware counters */ self->aq_link_status.mbps =0 ; -hw_atl_utils_update_stats (self); + self->aq_fw_ops->update_stats (self); err =aq_hw_err_from_flags (self);if (err <0 )
@@ -947,23 +948,8 @@ static int hw_atl_b0_hw_ring_rx_stop(struct aq_hw_s *self,return aq_hw_err_from_flags (self); } -static int hw_atl_b0_hw_set_speed (struct aq_hw_s *self,u32 speed) -{ -int err =0 ; - - err =hw_atl_utils_mpi_set_speed (self, speed,MPI_INIT ); -if (err <0 ) - goto err_exit; - -err_exit: -return err; -} -const struct aq_hw_ops hw_atl_ops_b0 = { - .hw_get_mac_permanent = hw_atl_utils_get_mac_permanent, .hw_set_mac_address = hw_atl_b0_hw_mac_addr_set, - .hw_get_link_status = hw_atl_utils_mpi_get_link_status, - .hw_set_link_speed = hw_atl_b0_hw_set_speed, .hw_init = hw_atl_b0_hw_init, .hw_deinit = hw_atl_utils_hw_deinit, .hw_set_power = hw_atl_utils_hw_set_power,
@@ -993,7 +979,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = { .hw_rss_set = hw_atl_b0_hw_rss_set, .hw_rss_hash_set = hw_atl_b0_hw_rss_hash_set, .hw_get_regs = hw_atl_utils_hw_get_regs, - .hw_update_stats = hw_atl_utils_update_stats, .hw_get_hw_stats = hw_atl_utils_get_hw_stats, .hw_get_fw_version = hw_atl_utils_get_fw_version, };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +57 -25
147 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +7 -3
@@ -181,9 +181,14 @@ enum hal_atl_utils_fw_state_e {#define HAL_ATLANTIC_RATE_INVALID BIT(6)struct aq_hw_s ; +struct aq_fw_ops ;struct aq_hw_caps_s ;struct aq_hw_link_status_s ; +int hw_atl_utils_initfw (struct aq_hw_s *self,const struct aq_fw_ops **fw_ops); + +int hw_atl_utils_soft_reset (struct aq_hw_s *self); +void hw_atl_utils_hw_chip_features_init (struct aq_hw_s *self,u32 *p); int hw_atl_utils_mpi_read_mbox(struct aq_hw_s *self,
@@ -196,9 +201,6 @@ void hw_atl_utils_mpi_set(struct aq_hw_s *self,enum hal_atl_utils_fw_state_e state, u32 speed); -int hw_atl_utils_mpi_set_speed (struct aq_hw_s *self,u32 speed, -enum hal_atl_utils_fw_state_e state); -int hw_atl_utils_mpi_get_link_status (struct aq_hw_s *self); int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
@@ -221,4 +223,6 @@ int hw_atl_utils_update_stats(struct aq_hw_s *self);struct aq_stats_s *hw_atl_utils_get_hw_stats (struct aq_hw_s *self); +extern const struct aq_fw_ops aq_fw_1x_ops; +#endif /* HW_ATL_UTILS_H */
Signature · 1 line
2.7.4
PATCH 8/11 net: aquantia: Introduce support for new firmware on AQC cards
In reply to Igor RusskikhThis defines fw2x operations table and corresponding methods. Some of the functions are being shared with 1.x firmware
--- drivers/net/ethernet/aquantia/atlantic/Makefile | 1 + drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 1 - .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 12 +- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 63 ++++++- .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 184 +++++++++++++++++++++ 5 files changed, 257 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
drivers/net/ethernet/aquantia/atlantic/Makefile +1 -0
@@ -39,4 +39,5 @@ atlantic-objs := aq_main.o \ hw_atl/hw_atl_a0.o \ hw_atl/hw_atl_b0.o \ hw_atl/hw_atl_utils.o \ + hw_atl/hw_atl_utils_fw2x.o \ hw_atl/hw_atl_llh.o
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +0 -1
@@ -42,7 +42,6 @@ struct aq_hw_caps_s {u8 rx_rings;bool flow_control;bool is_64_dma; -u32 fw_ver_expected; };struct aq_hw_link_status_s {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +10 -2
@@ -32,6 +32,8 @@#define HW_ATL_MPI_SPEED_SHIFT 16U#define HW_ATL_FW_VER_1X 0x01050006U +#define HW_ATL_FW_VER_2X 0x02000000U +#define HW_ATL_FW_VER_3X 0x03000000Ustatic int hw_atl_utils_ver_match (u32 ver_expected,u32 ver_actual);
@@ -46,6 +48,12 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)if (hw_atl_utils_ver_match (HW_ATL_FW_VER_1X , self->fw_ver_actual) ==0 ) *fw_ops = &aq_fw_1x_ops; +else if (hw_atl_utils_ver_match (HW_ATL_FW_VER_2X , + self->fw_ver_actual) ==0 ) + *fw_ops = &aq_fw_2x_ops; +else if (hw_atl_utils_ver_match (HW_ATL_FW_VER_3X , + self->fw_ver_actual) ==0 ) + *fw_ops = &aq_fw_2x_ops;else {aq_pr_err ("Bad FW version detected: %x\n" , self->fw_ver_actual);
@@ -56,8 +64,8 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)return err; } -static int hw_atl_utils_fw_downld_dwords (struct aq_hw_s *self,u32 a, -u32 *p,u32 cnt) +int hw_atl_utils_fw_downld_dwords (struct aq_hw_s *self,u32 a, +u32 *p,u32 cnt) {int err =0 ;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +62 -1
82 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c new file +184 -0
184 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 9/11 net: aquantia: Introduce global AQC hardware reset sequence
In reply to Igor RusskikhThe detailed reset sequence ensures all HW components are in aligned state before NIC startup. It also supports cards with signed firmware (RBL) and checks if their FW is valid.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 1 + .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 24 +-- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 187 ++++++++++++++++++++- 3 files changed, 183 insertions(+), 29 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +1 -0
@@ -100,6 +100,7 @@ struct aq_stats_s {struct aq_hw_s {atomic_t flags; +u8 rbl_enabled:1 ;struct aq_nic_cfg_s *aq_nic_cfg;const struct aq_fw_ops *aq_fw_ops;void __iomem *mmio;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +3 -21
@@ -87,32 +87,14 @@ static int hw_atl_b0_hw_reset(struct aq_hw_s *self) {int err =0 ; -hw_atl_glb_glb_reg_res_dis_set (self,1U ); -hw_atl_pci_pci_reg_res_dis_set (self,0U ); -hw_atl_rx_rx_reg_res_dis_set (self,0U ); -hw_atl_tx_tx_reg_res_dis_set (self,0U ); - -HW_ATL_FLUSH (); -hw_atl_glb_soft_res_set (self,1 ); - -/* check 10 times by 1ms */ -AQ_HW_WAIT_FOR (hw_atl_glb_soft_res_get (self) ==0 ,1000U ,10U ); -if (err <0 ) - goto err_exit; - -hw_atl_itr_irq_reg_res_dis_set (self,0U ); -hw_atl_itr_res_irq_set (self,1U ); - -/* check 10 times by 1ms */ -AQ_HW_WAIT_FOR (hw_atl_itr_res_irq_get (self) ==0 ,1000U ,10U ); -if (err <0 ) - goto err_exit; + err =hw_atl_utils_soft_reset (self); +if (err) +return err; self->aq_fw_ops->set_state (self,MPI_RESET ); err =aq_hw_err_from_flags (self); -err_exit:return err; }
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +179 -8
224 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 10/11 net: aquantia: Report correct mediatype via ethtool
In reply to Igor RusskikhFor devices with known capabilities of Fibre media type we now report that to ethtool.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +13 -3
@@ -690,7 +690,10 @@ static void aq_nic_update_ndev_stats(struct aq_nic_s *self)void aq_nic_get_link_ksettings (struct aq_nic_s *self,struct ethtool_link_ksettings *cmd) { - cmd->base.port =PORT_TP ; +if (self->aq_nic_cfg.aq_hw_caps->media_type ==AQ_HW_MEDIA_TYPE_FIBRE ) + cmd->base.port =PORT_FIBRE ; +else + cmd->base.port =PORT_TP ;/* This driver supports only 10G capable adapters, so DUPLEX_FULL */ cmd->base.duplex =DUPLEX_FULL ; cmd->base.autoneg = self->aq_nic_cfg.is_autoneg;
@@ -722,7 +725,11 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self, Pause);ethtool_link_ksettings_add_link_mode (cmd, supported, Autoneg); -ethtool_link_ksettings_add_link_mode (cmd, supported,TP ); + +if (self->aq_nic_cfg.aq_hw_caps->media_type ==AQ_HW_MEDIA_TYPE_FIBRE ) +ethtool_link_ksettings_add_link_mode (cmd, supported,FIBRE ); +else +ethtool_link_ksettings_add_link_mode (cmd, supported,TP );ethtool_link_ksettings_zero_link_mode (cmd, advertising);
@@ -753,7 +760,10 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self,ethtool_link_ksettings_add_link_mode (cmd, advertising, Pause); -ethtool_link_ksettings_add_link_mode (cmd, advertising,TP ); +if (self->aq_nic_cfg.aq_hw_caps->media_type ==AQ_HW_MEDIA_TYPE_FIBRE ) +ethtool_link_ksettings_add_link_mode (cmd, advertising,FIBRE ); +else +ethtool_link_ksettings_add_link_mode (cmd, advertising,TP ); } int aq_nic_set_link_ksettings(struct aq_nic_s *self,
Signature · 1 line
2.7.4
PATCH 11/11 net: aquantia: bump driver version to match aquantia internal numbering
In reply to Igor Russkikh--- drivers/net/ethernet/aquantia/atlantic/ver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/aquantia/atlantic/ver.h +3 -3
@@ -10,9 +10,9 @@#ifndef VER_H #define VER_H -#define NIC_MAJOR_DRIVER_VERSION 1 -#define NIC_MINOR_DRIVER_VERSION 6 -#define NIC_BUILD_DRIVER_VERSION 13 +#define NIC_MAJOR_DRIVER_VERSION 2 +#define NIC_MINOR_DRIVER_VERSION 0 +#define NIC_BUILD_DRIVER_VERSION 2#define NIC_REVISION_DRIVER_VERSION 0#define AQ_CFG_DRV_VERSION_SUFFIX "-kern"
Signature · 1 line
2.7.4
David Miller
maintainerFrom: Igor Russkikh <[email protected]>
Date: Fri, 19 Jan 2018 17:03:17 +0300
Quoted 8 lines
This patchset introduces a support for new Aquantia hardware:
AQC11x family with updated hardware (B1) and firmware (2.x and 3.x branches).For that, a number of improvements in overall driver model were done:
- Firmware specific ops tables. Firmware 2.x and 3.x series support functions are now in separate fw2x module.
- PCI module cleanup and simplification done.
- Verified and tested hardware reset process.
Series applied, thanks Igor.