Aquantia atlantic bugfixes
cover Aquantia atlantic bugfixes
This patchset contains various bugfixes found during verification and integration testing.
Most notable is eeprom access cleanup, fix for broadcast filter, flow control logic tracking, some code style cleanups.
Igor Russkikh (7):
net/atlantic: enable broadcast traffic net/atlantic: extra line at eof net/atlantic: bad indentation
net/atlantic: fix max eeprom size net/atlantic: validity check for eeprom dev address net/atlantic: typo on args check net/atlantic: extra err check
Pavel Belous (4):
net/atlantic: eeprom get/set should consider offset net/atlantic: bad logic with offsets talking with firmware net/atlantic: flow control settings synchronization on rx net/atlantic: use capability bits to detect eeprom access
drivers/net/atlantic/atl_ethdev.c | 43 +++++-- drivers/net/atlantic/atl_rxtx.c | 1 - drivers/net/atlantic/atl_types.h | 3 +- drivers/net/atlantic/hw_atl/hw_atl_b0.c | 8 ++ drivers/net/atlantic/hw_atl/hw_atl_b0.h | 2 + drivers/net/atlantic/hw_atl/hw_atl_utils.c | 17 +-- drivers/net/atlantic/hw_atl/hw_atl_utils.h | 11 +- .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 111 ++++++++++++------ 8 files changed, 128 insertions(+), 68 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/11 net/atlantic: enable broadcast traffic
Broadcast was not correctly and fully initialized
--- drivers/net/atlantic/hw_atl/hw_atl_b0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/atlantic/hw_atl/hw_atl_b0.c +2 -0
@@ -286,6 +286,8 @@ int hw_atl_b0_hw_init_rx_path(struct aq_hw_s *self)hw_atl_rpfl2broadcast_flr_act_set (self,1U );hw_atl_rpfl2broadcast_count_threshold_set (self,0xFFFFU & (~0U /256U )); +hw_atl_rpfl2broadcast_en_set (self,1U ); +hw_atl_rdm_rx_dca_en_set (self,0U );hw_atl_rdm_rx_dca_mode_set (self,0U );
Signature · 1 line
2.17.1
PATCH 2/11 net/atlantic: extra line at eof
In reply to Igor RusskikhRemove extra empty line at EOF
--- drivers/net/atlantic/atl_rxtx.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/atlantic/atl_rxtx.c +0 -1
@@ -1348,4 +1348,3 @@ atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)return nb_tx; } -
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 02/11] net/atlantic: extra line at eof
Quoted 13 lines · Igor Russkikh
Remove extra empty line at EOF
Signed-off-by Igor Russkikh <[email protected]>--- drivers/net/atlantic/atl_rxtx.c | 1 - 1 file changed, 1 deletion(-)drivers/net/atlantic/atl_rxtx.c +0
-0
drivers/net/atlantic/atl_rxtx.c atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1351
Quoted 4 lines
drivers/net/atlantic/atl_rxtx.c +0
-1@@ -1348,4 +1348,3 @@ atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)return nb_tx; } -
This has been already fixed in v19.05-rc2 by:
PATCH 3/11 net/atlantic: bad indentation
In reply to Igor RusskikhMake indentation correct. No functional impact.
--- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/atlantic/hw_atl/hw_atl_utils.c +4 -4
@@ -305,10 +305,10 @@ int hw_atl_utils_fw_downld_dwords(struct aq_hw_s *self, u32 a,AQ_HW_WAIT_FOR (!(0x100 &aq_hw_read_reg (self,HW_ATL_MIF_CMD )),1 ,1000U ); -if (err) { - err = -ETIMEDOUT ; - goto err_exit; - } +if (err) { + err = -ETIMEDOUT ; + goto err_exit; + } *(p++) =aq_hw_read_reg (self,HW_ATL_MIF_VAL ); a +=4 ;
Signature · 1 line
2.17.1
PATCH 4/11 net/atlantic: eeprom get/set should consider offset
In reply to Igor RusskikhFrom: Pavel Belous <[email protected]>
EEPROM get/set offset logic should take offset into account. Data transfers to/from FW should also correctly use dword based transfer interface, taking into account the remainder.
We also check error code returned from FW.
--- drivers/net/atlantic/atl_ethdev.c | 7 +- drivers/net/atlantic/atl_types.h | 2 +- drivers/net/atlantic/hw_atl/hw_atl_utils.h | 11 +-- .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 95 ++++++++++++------- 4 files changed, 68 insertions(+), 47 deletions(-)
drivers/net/atlantic/atl_ethdev.c +4 -3
@@ -1448,14 +1448,15 @@ int atl_dev_set_eeprom(struct rte_eth_dev *dev,if (hw->aq_fw_ops->set_eeprom ==NULL )return -ENOTSUP ; -if (eeprom->length !=SFP_EEPROM_SIZE || eeprom->data ==NULL ) +if (eeprom->length + eeprom->offset >SFP_EEPROM_SIZE || + eeprom->data ==NULL )return -EINVAL ;if (eeprom->magic) dev_addr = eeprom->magic; -return hw->aq_fw_ops->set_eeprom (hw, dev_addr, - eeprom->data, eeprom->length); +return hw->aq_fw_ops->set_eeprom (hw, dev_addr, eeprom->data, + eeprom->length, eeprom->offset); } static int
drivers/net/atlantic/atl_types.h +1 -1
@@ -177,7 +177,7 @@ struct aq_fw_ops { u32 *data, u32 len, u32 offset);int (*set_eeprom)(struct aq_hw_s *self,int dev_addr, -u32 *data,u32 len); +u32 *data,u32 len,u32 offset); int (*send_macsec_req)(struct aq_hw_s *self, struct macsec_msg_fw_request *req,
drivers/net/atlantic/hw_atl/hw_atl_utils.h +2 -9
@@ -337,15 +337,8 @@ struct offload_info {u8 buf[0 ]; } __attribute__((__packed__)); -struct smbus_read_request { -u32 offset;/* not used */ -u32 device_id; -u32 address; -u32 length; -} __attribute__((__packed__ )); - -struct smbus_write_request { -u32 offset;/* not used */ +struct smbus_request { +u32 msg_id;/* not used */ u32 device_id;u32 address;u32 length;
drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +61 -34
145 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 5/11 net/atlantic: fix max eeprom size
In reply to Igor RusskikhMaximum size should be 256 bytes.
Move declaration to the top of the file
--- drivers/net/atlantic/atl_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/atlantic/atl_ethdev.c +2 -1
@@ -179,6 +179,8 @@ static struct rte_pci_driver rte_atl_pmd = { | DEV_TX_OFFLOAD_MACSEC_INSERT \ | DEV_TX_OFFLOAD_MULTI_SEGS) +#define SFP_EEPROM_SIZE 0x100 +static const struct rte_eth_desc_lim rx_desc_lim = { .nb_max =ATL_MAX_RING_DESC , .nb_min =ATL_MIN_RING_DESC ,
@@ -1411,7 +1413,6 @@ atl_dev_interrupt_handler(void *param)atl_dev_interrupt_action (dev, dev->intr_handle); } -#define SFP_EEPROM_SIZE 0xffstatic int atl_dev_get_eeprom_length(struct rte_eth_dev *dev __rte_unused)
Signature · 1 line
2.17.1
PATCH 6/11 net/atlantic: validity check for eeprom dev address
In reply to Igor RusskikhClients may not fillin magic field, thus causing garbage to be passed as a device addr.
Limit that to maximum SMbus address.
--- drivers/net/atlantic/atl_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/atlantic/atl_ethdev.c +6 -0
@@ -1433,6 +1433,9 @@ int atl_dev_get_eeprom(struct rte_eth_dev *dev, eeprom->data == NULL)return -EINVAL ; +if (eeprom->magic >0x7F ) +return -EINVAL ; +if (eeprom->magic) dev_addr = eeprom->magic;
@@ -1453,6 +1456,9 @@ int atl_dev_set_eeprom(struct rte_eth_dev *dev, eeprom->data == NULL)return -EINVAL ; +if (eeprom->magic >0x7F ) +return -EINVAL ; +if (eeprom->magic) dev_addr = eeprom->magic;
Signature · 1 line
2.17.1
PATCH 7/11 net/atlantic: bad logic with offsets talking with firmware
In reply to Igor RusskikhFrom: Pavel Belous <[email protected]>
eeprom write accesses start using non zero configuration memory accesses. This revealed an issue where firmware interface was actually always did the uploads starting with zero offset
--- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/atlantic/hw_atl/hw_atl_utils.c +5 -4
@@ -332,12 +332,13 @@ int hw_atl_utils_fw_upload_dwords(struct aq_hw_s *self, u32 a, u32 *p, goto err_exit; }if (IS_CHIP_FEATURE (REVISION_B1 )) { -u32 offset =0 ; +u32 mbox_offset = (a - self->rpc_addr) /sizeof (u32); +u32 data_offset =0 ; -for (; offset < cnt; ++offset) { -aq_hw_write_reg (self,0x328 , p[offset]); +for (; data_offset < cnt; ++mbox_offset, ++data_offset) { +aq_hw_write_reg (self,0x328 , p[data_offset]);aq_hw_write_reg (self,0x32C , - (0x80000000 | (0xFFFF & (offset *4 )))); + (0x80000000 | (0xFFFF & (mbox_offset *4 ))));hw_atl_mcp_up_force_intr_set (self,1 );/* 1000 times by 10us = 10ms */ AQ_HW_WAIT_FOR((aq_hw_read_reg(self,
Signature · 1 line
2.17.1
PATCH 8/11 net/atlantic: flow control settings synchronization on rx
In reply to Igor RusskikhFrom: Pavel Belous <[email protected]>
Driver should track negotiated PHY flow control settings during link state changes and update MAC level flow control configuration.
Otherwise there could be unexpected pause frames generation which could lockup the datapath.
--- drivers/net/atlantic/atl_ethdev.c | 24 +++++++++++++++---- drivers/net/atlantic/atl_types.h | 1 + drivers/net/atlantic/hw_atl/hw_atl_b0.c | 6 +++++ drivers/net/atlantic/hw_atl/hw_atl_b0.h | 2 ++ .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 9 +++++++ 5 files changed, 38 insertions(+), 4 deletions(-)
drivers/net/atlantic/atl_ethdev.c +20 -4
@@ -1160,6 +1160,7 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused) {struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_eth_link link, old; +u32 fc =AQ_NIC_FC_OFF ;int err =0 ; link.link_status =ETH_LINK_DOWN ;
@@ -1194,6 +1195,15 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)if (link.link_status == old.link_status)return -1 ; +/* Driver has to update flow control settings on RX block +* on any link event. +* We should query FW whether it negotiated FC. +*/ +if (hw->aq_fw_ops->get_flow_control) { + hw->aq_fw_ops->get_flow_control (hw, &fc); +hw_atl_b0_set_fc (hw, fc,0U ); + } +if (rte_eal_alarm_set (1000 *1000 , atl_dev_delayed_handler, (void *)dev) <0 )PMD_DRV_LOG (ERR ,"rte_eal_alarm_set fail" );
@@ -1496,14 +1506,20 @@ static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); +u32 fc =AQ_NIC_FC_OFF ; + +if (hw->aq_fw_ops->get_flow_control ==NULL ) +return -ENOTSUP ; + + hw->aq_fw_ops->get_flow_control (hw, &fc); -if (hw->aq_nic_cfg->flow_control ==AQ_NIC_FC_OFF ) +if (fc ==AQ_NIC_FC_OFF ) fc_conf->mode =RTE_FC_NONE ; -else if (hw->aq_nic_cfg->flow_control & (AQ_NIC_FC_RX |AQ_NIC_FC_TX )) +else if (fc & (AQ_NIC_FC_RX |AQ_NIC_FC_TX )) fc_conf->mode =RTE_FC_FULL ; -else if (hw->aq_nic_cfg->flow_control &AQ_NIC_FC_RX ) +else if (fc &AQ_NIC_FC_RX ) fc_conf->mode =RTE_FC_RX_PAUSE ; -else if (hw->aq_nic_cfg->flow_control &AQ_NIC_FC_RX ) +else if (fc &AQ_NIC_FC_RX ) fc_conf->mode =RTE_FC_TX_PAUSE ;return 0 ;
drivers/net/atlantic/atl_types.h +1 -0
@@ -169,6 +169,7 @@ struct aq_fw_ops {int (*get_eee_rate)(struct aq_hw_s *self,u32 *rate,u32 *supported_rates); +int (*get_flow_control)(struct aq_hw_s *self,u32 *fc);int (*set_flow_control)(struct aq_hw_s *self);int (*led_control)(struct aq_hw_s *self,u32 mode);
drivers/net/atlantic/hw_atl/hw_atl_b0.c +6 -0
@@ -26,6 +26,12 @@ int hw_atl_b0_hw_reset(struct aq_hw_s *self)return err; } +int hw_atl_b0_set_fc (struct aq_hw_s *self,u32 fc,u32 tc) +{ +hw_atl_rpb_rx_xoff_en_per_tc_set (self, !!(fc &AQ_NIC_FC_RX ), tc); +return 0 ; +} +static int hw_atl_b0_hw_qos_set (struct aq_hw_s *self) {u32 tc =0U ;
drivers/net/atlantic/hw_atl/hw_atl_b0.h +2 -0
@@ -11,6 +11,8 @@int hw_atl_b0_hw_reset (struct aq_hw_s *self);int hw_atl_b0_hw_init (struct aq_hw_s *self,u8 *mac_addr); +int hw_atl_b0_set_fc (struct aq_hw_s *self,u32 fc,u32 tc); +int hw_atl_b0_hw_ring_tx_init (struct aq_hw_s *self,uint64_t base_addr,int index,int size,int cpu,int vec); int hw_atl_b0_hw_ring_rx_init(struct aq_hw_s *self, uint64_t base_addr,
drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +9 -0
@@ -473,7 +473,15 @@ static int aq_fw2x_get_eee_rate(struct aq_hw_s *self, u32 *rate,return err; } +static int aq_fw2x_get_flow_control (struct aq_hw_s *self,u32 *fc) +{ +u32 mpi_state =aq_hw_read_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR ); + + *fc = ((mpi_state &BIT (CAPS_HI_PAUSE )) ?AQ_NIC_FC_RX :0 ) | + ((mpi_state &BIT (CAPS_HI_ASYMMETRIC_PAUSE )) ?AQ_NIC_FC_TX :0 ); +return 0 ; +}static int aq_fw2x_set_flow_control (struct aq_hw_s *self) {
@@ -714,6 +722,7 @@ const struct aq_fw_ops aq_fw_2x_ops = { .get_cable_len = aq_fw2x_get_cable_len, .set_eee_rate = aq_fw2x_set_eee_rate, .get_eee_rate = aq_fw2x_get_eee_rate, + .get_flow_control = aq_fw2x_get_flow_control, .set_flow_control = aq_fw2x_set_flow_control, .led_control = aq_fw2x_led_control, .get_eeprom = aq_fw2x_get_eeprom,
Signature · 1 line
2.17.1
PATCH 9/11 net/atlantic: use capability bits to detect eeprom access
In reply to Igor RusskikhFrom: Pavel Belous <[email protected]>
Its better to use capability bits FW provides to detect whether firmware has APIs for EEPROM access.
Before that explicit FW version comparison was used and that may cause conflicts.
--- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +2 -3
@@ -34,7 +34,6 @@#define HAL_ATLANTIC_WOL_FILTERS_COUNT 8#define HAL_ATLANTIC_UTILS_FW2X_MSG_WOL 0x0E -#define HW_ATL_FW_FEATURE_EEPROM 0x03010025#define HW_ATL_FW_FEATURE_LED 0x03010026struct fw2x_msg_wol_pattern {
@@ -513,7 +512,7 @@ static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,u32 mpi_opts;int err =0 ; -if (self->fw_ver_actual <HW_ATL_FW_FEATURE_EEPROM ) +if ((self->caps_lo &BIT (CAPS_LO_SMBUS_READ )) ==0 )return -EOPNOTSUPP ; request.msg_id =0 ;
@@ -591,7 +590,7 @@ static int aq_fw2x_set_eeprom(struct aq_hw_s *self, int dev_addr,u32 mpi_opts, result =0 ;int err =0 ; -if (self->fw_ver_actual <HW_ATL_FW_FEATURE_EEPROM ) +if ((self->caps_lo &BIT (CAPS_LO_SMBUS_WRITE )) ==0 )return -EOPNOTSUPP ; request.msg_id =0 ;
Signature · 1 line
2.17.1
PATCH 10/11 net/atlantic: typo on args check
In reply to Igor RusskikhFound by coverity scan, two pointer args should be not zero checked
Coverity issue: 337929
--- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +1 -1
@@ -671,7 +671,7 @@ static int aq_fw2x_send_macsec_request(struct aq_hw_s *self,int err =0 ;u32 mpi_opts =0 ; -if (!response || !response) +if (!req || !response)return 0 ;if ((self->caps_lo &BIT (CAPS_LO_MACSEC )) ==0 )
Signature · 1 line
2.17.1
PATCH 11/11 net/atlantic: extra err check
In reply to Igor RusskikhFound by coverity scan - dead code
Coverity issue: 337665
--- drivers/net/atlantic/atl_ethdev.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/atlantic/atl_ethdev.c +0 -3
@@ -602,9 +602,6 @@ atl_dev_start(struct rte_eth_dev *dev) dev->data->dev_link.link_status = hw->aq_link_status.mbps !=0 ; -if (err) - goto error; -if (rte_intr_allow_others (intr_handle)) {/* check if lsc interrupt is enabled */ if (dev->data->dev_conf.intr_conf.lsc !=0 )
Signature · 1 line
2.17.1
Quoted 21 lines · Igor Russkikh
This patchset contains various bugfixes found during verification and integration testing.
Most notable is eeprom access cleanup, fix for broadcast filter, flow control logic tracking, some code style cleanups.
Igor Russkikh (7):
net/atlantic: enable broadcast traffic net/atlantic: extra line at eof net/atlantic: bad indentation
net/atlantic: fix max eeprom size net/atlantic: validity check for eeprom dev address net/atlantic: typo on args check net/atlantic: extra err checkPavel Belous (4):
net/atlantic: eeprom get/set should consider offset net/atlantic: bad logic with offsets talking with firmware net/atlantic: flow control settings synchronization on rx net/atlantic: use capability bits to detect eeprom access
Quoted 10 lines
drivers/net/atlantic/atl_ethdev.c | 43 +++++-- drivers/net/atlantic/atl_rxtx.c | 1 - drivers/net/atlantic/atl_types.h | 3 +- drivers/net/atlantic/hw_atl/hw_atl_b0.c | 8 ++ drivers/net/atlantic/hw_atl/hw_atl_b0.h | 2 + drivers/net/atlantic/hw_atl/hw_atl_utils.c | 17 +-- drivers/net/atlantic/hw_atl/hw_atl_utils.h | 11 +- .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 111 ++++++++++++------ 8 files changed, 128 insertions(+), 68 deletions(-)
Hi - some of these that are fixes will apply on 18.11 stable branch with a little of rebasing, some will not. It will be cleaner to take the fixes as a series. Can you send backports for the series for the 18.11 branch, or let me know if they are not needed.
thanks,
Kevin.
Quoted 6 lines
Hi - some of these that are fixes will apply on 18.11 stable branch with a little of rebasing, some will not. It will be cleaner to take the fixes as a series. Can you send backports for the series for the 18.11 branch, or let me know if they are not needed.
Hi Kevin, I'll backport these to 18.11 and resubmit it soon.
Thanks,
Igor