Bugfix for hns3 PMD
cover Bugfix for hns3 PMD
This set of patches contains seven bugfixes for hns3 PMD.
Chengchang Tang (3):
net/hns3: fix incorrect timing in resetting queues net/hns3: fix queue state when concurrent with reset net/hns3: fix configure FEC when concurrent with reset
Chengwen Feng (2):
net/hns3: remove ariables of selecting Rx/Tx function net/hns3: fix some packet type calc error
Hongbo Zheng (1):
net/hns3: fix FLR failure when RAS concurrently with FLR
Min Hu (Connor) (1):
net/hns3: fix missing rollback in PF init
drivers/net/hns3/hns3_ethdev.c | 14 +++--- drivers/net/hns3/hns3_ethdev.h | 9 +--- drivers/net/hns3/hns3_ethdev_vf.c | 5 --- drivers/net/hns3/hns3_intr.c | 7 +-- drivers/net/hns3/hns3_rxtx.c | 89 ++++++++++++++++----------------------- drivers/net/hns3/hns3_rxtx.h | 14 +++--- 6 files changed, 54 insertions(+), 84 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/7 net/hns3: remove ariables of selecting Rx/Tx function
From: Chengwen Feng <[email protected]>
Currently, there are four control variables (rx_simple_allowed, rx_vec_allowed, tx_simple_allowed and tx_vec_allowed) which are used to impact the selection of Rx/Tx burst function.
The purpose of the design is to provide a way to control the selection of Rx/Tx burst function by modifying it's values, but these variables have no entry to modify unless make intrusive modifications.
Now we already support runtime config to select Rx/Tx function, these variables could be removed.
--- drivers/net/hns3/hns3_ethdev.c | 5 ----- drivers/net/hns3/hns3_ethdev.h | 5 ----- drivers/net/hns3/hns3_ethdev_vf.c | 5 ----- drivers/net/hns3/hns3_rxtx.c | 11 ++++------- 4 files changed, 4 insertions(+), 22 deletions(-)
drivers/net/hns3/hns3_ethdev.c +0 -5
@@ -2512,11 +2512,6 @@ hns3_dev_configure(struct rte_eth_dev *dev)if (ret) goto cfg_err; - hns->rx_simple_allowed = true; - hns->rx_vec_allowed = true; - hns->tx_simple_allowed = true; - hns->tx_vec_allowed = true; -hns3_init_rx_ptype_tble (dev); hw->adapter_state =HNS3_NIC_CONFIGURED ;
drivers/net/hns3/hns3_ethdev.h +0 -5
@@ -777,11 +777,6 @@ struct hns3_adapter {struct hns3_vf vf; }; -bool rx_simple_allowed; -bool rx_vec_allowed; -bool tx_simple_allowed; -bool tx_vec_allowed; -uint32_t rx_func_hint;uint32_t tx_func_hint;
drivers/net/hns3/hns3_ethdev_vf.c +0 -5
@@ -854,11 +854,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)if (ret) goto cfg_err; - hns->rx_simple_allowed = true; - hns->rx_vec_allowed = true; - hns->tx_simple_allowed = true; - hns->tx_vec_allowed = true; -hns3_init_rx_ptype_tble (dev); hw->adapter_state =HNS3_NIC_CONFIGURED ;
drivers/net/hns3/hns3_rxtx.c +4 -7
@@ -2805,10 +2805,9 @@ hns3_get_rx_function(struct rte_eth_dev *dev)uint64_t offloads = dev->data->dev_conf.rxmode.offloads;bool vec_allowed, sve_allowed, simple_allowed; - vec_allowed = hns->rx_vec_allowed && -hns3_rx_check_vec_support (dev) ==0 ; + vec_allowed =hns3_rx_check_vec_support (dev) ==0 ; sve_allowed = vec_allowed &&hns3_check_sve_support (); - simple_allowed = hns->rx_simple_allowed && !dev->data->scattered_rx && + simple_allowed = !dev->data->scattered_rx && (offloads &DEV_RX_OFFLOAD_TCP_LRO ) ==0 ;if (hns->rx_func_hint ==HNS3_IO_FUNC_HINT_VEC && vec_allowed)
@@ -4195,11 +4194,9 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)struct hns3_adapter *hns = dev->data->dev_private;bool vec_allowed, sve_allowed, simple_allowed; - vec_allowed = hns->tx_vec_allowed && -hns3_tx_check_vec_support (dev) ==0 ; + vec_allowed =hns3_tx_check_vec_support (dev) ==0 ; sve_allowed = vec_allowed &&hns3_check_sve_support (); - simple_allowed = hns->tx_simple_allowed && -hns3_tx_check_simple_support (dev); + simple_allowed =hns3_tx_check_simple_support (dev); *prep =NULL ;
Signature · 1 line
2.7.4
PATCH 2/7 net/hns3: fix missing rollback in PF init
In reply to Min Hu (Connor)This patch adds rollback processing when updating imissed stats failed in PF init.
--- drivers/net/hns3/hns3_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
@@ -4991,7 +4991,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) ret =hns3_update_imissed_stats (hw, true);if (ret) {hns3_err (hw,"clear imissed stats failed, ret = %d" , ret); -return ret; + goto err_cmd_init; }hns3_config_all_msix_error (hw, true);
Signature · 1 line
2.7.4
PATCH 3/7 net/hns3: fix FLR failure when RAS concurrently with FLR
In reply to Min Hu (Connor)From: Hongbo Zheng <[email protected]>
Currently, if RAS interrupt and FLR occurred at the same time, FLR will be detected and corresponding schedule state will be set during RAS interrupt processing. However, the schedule state value will be overridden in subsequent RAS processing, resulting in FLR processing failure. This patch solves this problem.
--- drivers/net/hns3/hns3_intr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_intr.c +4 -3
@@ -2133,10 +2133,11 @@ hns3_schedule_reset(struct hns3_adapter *hns) SCHEDULE_REQUESTED)return ;if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == -SCHEDULE_DEFERRED ) +SCHEDULE_DEFERRED )rte_eal_alarm_cancel (hw->reset.ops->reset_service, hns); -__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , - __ATOMIC_RELAXED); +else +__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , + __ATOMIC_RELAXED);rte_eal_alarm_set (SWITCH_CONTEXT_US , hw->reset.ops->reset_service, hns); }
Signature · 1 line
2.7.4
PATCH 4/7 net/hns3: fix some packet type calc error
In reply to Min Hu (Connor)From: Chengwen Feng <[email protected]>
Currently, the packet type calculated by vlan/ovlan/l3id/l4id/ol3id/ol4id fields have the following problems:
1) Identify error when exist vlan strip which will lead to the data buffer has non vlan header but mbuf's ptype have L2_ETHER_VLAN flag.
2) Some packet identifies error, eg: hardware report it's RARP or unknown packet, but ptype will marked with L2_ETHER .
So driver will calculate packet type only by l3id/l4id/ol3id/ol4id fields.
--- drivers/net/hns3/hns3_ethdev.h | 4 +-- drivers/net/hns3/hns3_rxtx.c | 60 +++++++++++++----------------------------- drivers/net/hns3/hns3_rxtx.h | 14 ++++------ 3 files changed, 24 insertions(+), 54 deletions(-)
drivers/net/hns3/hns3_ethdev.h +1 -3
@@ -682,12 +682,10 @@ struct hns3_ptype_table {* The next fields used to calc packet-type by the * L3_ID/L4_ID/OL3_ID/OL4_ID from the Rx descriptor. */ -uint32_t l2l3table[HNS3_L2TBL_NUM ][HNS3_L3TBL_NUM ]; +uint32_t l3table[HNS3_L3TBL_NUM ];uint32_t l4table[HNS3_L4TBL_NUM ]; -uint32_t inner_l2table[HNS3_L2TBL_NUM ];uint32_t inner_l3table[HNS3_L3TBL_NUM ];uint32_t inner_l4table[HNS3_L4TBL_NUM ]; -uint32_t ol2table[HNS3_OL2TBL_NUM ];uint32_t ol3table[HNS3_OL3TBL_NUM ];uint32_t ol4table[HNS3_OL4TBL_NUM ];
drivers/net/hns3/hns3_rxtx.c +18 -42
83 lines not on this page · raw message
drivers/net/hns3/hns3_rxtx.h +5 -9
@@ -635,8 +635,8 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, const uint32_t ol_info) {const struct hns3_ptype_table *const ptype_tbl = rxq->ptype_tbl; -uint32_t l2id, l3id, l4id; -uint32_t ol3id, ol4id, ol2id; +uint32_t ol3id, ol4id; +uint32_t l3id, l4id;uint32_t ptype;if (rxq->ptype_en) {
@@ -647,20 +647,16 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, ol4id =hns3_get_field (ol_info,HNS3_RXD_OL4ID_M ,HNS3_RXD_OL4ID_S ); ol3id =hns3_get_field (ol_info,HNS3_RXD_OL3ID_M ,HNS3_RXD_OL3ID_S ); - ol2id =hns3_get_field (ol_info,HNS3_RXD_OVLAN_M ,HNS3_RXD_OVLAN_S ); - l2id =hns3_get_field (l234_info,HNS3_RXD_VLAN_M ,HNS3_RXD_VLAN_S ); l3id =hns3_get_field (l234_info,HNS3_RXD_L3ID_M ,HNS3_RXD_L3ID_S ); l4id =hns3_get_field (l234_info,HNS3_RXD_L4ID_M ,HNS3_RXD_L4ID_S );if (unlikely (ptype_tbl->ol4table[ol4id])) -return ptype_tbl->inner_l2table[l2id] | - ptype_tbl->inner_l3table[l3id] | +return ptype_tbl->inner_l3table[l3id] | ptype_tbl->inner_l4table[l4id] | ptype_tbl->ol3table[ol3id] | - ptype_tbl->ol4table[ol4id] | ptype_tbl->ol2table[ol2id]; + ptype_tbl->ol4table[ol4id];else -return ptype_tbl->l2l3table[l2id][l3id] | - ptype_tbl->l4table[l4id]; +return ptype_tbl->l3table[l3id] | ptype_tbl->l4table[l4id]; }void hns3_dev_rx_queue_release (void *queue);
Signature · 1 line
2.7.4
PATCH 5/7 net/hns3: fix incorrect timing in resetting queues
In reply to Min Hu (Connor)From: Chengchang Tang <[email protected]>
During the task queue pairs reset, the getimeofday is used to obtain the timestamp to determine whether the command execution times out. But gettimeofday is not monotonous, it can be modified by system administrators, so the timing may not be accurate or even cause the loop to wait consistently. And actually, in this scenario, it is not necessary to obain the timestamp.
This patch removes the operation of obtaining the timestamp from the task queue pairs reset function.
--- drivers/net/hns3/hns3_rxtx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_rxtx.c +4 -3
@@ -625,8 +625,8 @@ static int hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) {#define HNS3_TQP_RESET_TRY_MS 200 +uint16_t wait_time =0 ;uint8_t reset_status; -uint64_t end;int ret;/*
@@ -639,17 +639,18 @@ hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id)hns3_err (hw,"Send reset tqp cmd fail, ret = %d" , ret);return ret; } - end =get_timeofday_ms () +HNS3_TQP_RESET_TRY_MS ; +do {/* Wait for tqp hw reset */ rte_delay_ms (HNS3_POLL_RESPONE_MS ); + wait_time +=HNS3_POLL_RESPONE_MS ; ret =hns3_get_tqp_reset_status (hw, queue_id, &reset_status);if (ret) goto tqp_reset_fail;if (reset_status)break ; - }while (get_timeofday_ms () < end); + }while (wait_time <HNS3_TQP_RESET_TRY_MS );if (!reset_status) { ret = -ETIMEDOUT ;
Signature · 1 line
2.7.4
PATCH 6/7 net/hns3: fix queue state when concurrent with reset
In reply to Min Hu (Connor)From: Chengchang Tang <[email protected]>
At the end of the reset, the state of queues need to be restored according to the states saved in the driver. If the start and stop operations of the queues are concurrent at this time, it may cause the final status to be uncertain.
This patch requires queues to acquire the hw lock before starting and stopping. If the device is being restored due to reset at this time, it will block until the reset is completed.
--- drivers/net/hns3/hns3_rxtx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/hns3/hns3_rxtx.c +11 -0
@@ -4270,10 +4270,12 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock); ret =hns3_reset_queue (hw, rx_queue_id,HNS3_RING_TYPE_RX );if (ret) {hns3_err (hw,"fail to reset Rx queue %u, ret = %d." , rx_queue_id, ret); +rte_spinlock_unlock (&hw->lock);return ret; }
@@ -4281,11 +4283,13 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (ret) {hns3_err (hw,"fail to init Rx queue %u, ret = %d." , rx_queue_id, ret); +rte_spinlock_unlock (&hw->lock);return ret; }hns3_enable_rxq (rxq, true); dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; +rte_spinlock_unlock (&hw->lock);return ret; }
@@ -4312,12 +4316,14 @@ hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock);hns3_enable_rxq (rxq, false);hns3_rx_queue_release_mbufs (rxq);hns3_reset_sw_rxq (rxq); dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; +rte_spinlock_unlock (&hw->lock);return 0 ; }
@@ -4332,16 +4338,19 @@ hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock); ret =hns3_reset_queue (hw, tx_queue_id,HNS3_RING_TYPE_TX );if (ret) {hns3_err (hw,"fail to reset Tx queue %u, ret = %d." , tx_queue_id, ret); +rte_spinlock_unlock (&hw->lock);return ret; }hns3_init_txq (txq);hns3_enable_txq (txq, true); dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; +rte_spinlock_unlock (&hw->lock);return ret; }
@@ -4355,6 +4364,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock);hns3_enable_txq (txq, false);hns3_tx_queue_release_mbufs (txq);/*
@@ -4366,6 +4376,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)*/ hns3_init_txq (txq); dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; +rte_spinlock_unlock (&hw->lock);return 0 ; }
Signature · 1 line
2.7.4
PATCH 7/7 net/hns3: fix configure FEC when concurrent with reset
In reply to Min Hu (Connor)From: Chengchang Tang <[email protected]>
Currently, after the reset is complete, the PMD restores the FEC according to the FEC configuration reserved in the driver. If there is a concurrency between the FEC setup operation and the restore operation after a reset, the FEC status of the last hardware may be unknown.
This patch adds the step of obtaining the lock when setting the FEC to avoid concurrency between restore operation and setting operation.
--- drivers/net/hns3/hns3_ethdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/hns3/hns3_ethdev.c +6 -1
@@ -6411,11 +6411,16 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode)return -EINVAL ; } +rte_spinlock_lock (&hw->lock); ret =hns3_set_fec_hw (hw, mode); -if (ret) +if (ret) { +rte_spinlock_unlock (&hw->lock);return ret; + } pf->fec_mode = mode; +rte_spinlock_unlock (&hw->lock); +return 0 ; }
Signature · 1 line
2.7.4
v2 cover Bugfix for hns3 PMD
In reply to Min Hu (Connor)This set of patches contains seven bugfixes for hns3 PMD.
Chengchang Tang (3):
net/hns3: fix incorrect timing in resetting queues net/hns3: fix queue state when concurrent with reset net/hns3: fix configure FEC when concurrent with reset
Chengwen Feng (2):
net/hns3: remove variables of selecting Rx/Tx function net/hns3: fix some packet type calc error
Hongbo Zheng (1):
net/hns3: fix FLR failure when RAS concurrent with FLR
Min Hu (Connor) (1):
net/hns3: fix missing rollback in PF init
---
v2:
* Adjust the patch title.
drivers/net/hns3/hns3_ethdev.c | 14 +++--- drivers/net/hns3/hns3_ethdev.h | 9 +--- drivers/net/hns3/hns3_ethdev_vf.c | 5 --- drivers/net/hns3/hns3_intr.c | 7 +-- drivers/net/hns3/hns3_rxtx.c | 89 ++++++++++++++++----------------------- drivers/net/hns3/hns3_rxtx.h | 14 +++--- 6 files changed, 54 insertions(+), 84 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/7 net/hns3: remove variables of selecting Rx/Tx function
From: Chengwen Feng <[email protected]>
Currently, there are four control variables (rx_simple_allowed, rx_vec_allowed, tx_simple_allowed and tx_vec_allowed) which are used to impact the selection of Rx/Tx burst function.
The purpose of the design is to provide a way to control the selection of Rx/Tx burst function by modifying it's values, but these variables have no entry to modify unless make intrusive modifications.
Now we already support runtime config to select Rx/Tx function, these variables could be removed.
--- drivers/net/hns3/hns3_ethdev.c | 5 ----- drivers/net/hns3/hns3_ethdev.h | 5 ----- drivers/net/hns3/hns3_ethdev_vf.c | 5 ----- drivers/net/hns3/hns3_rxtx.c | 11 ++++------- 4 files changed, 4 insertions(+), 22 deletions(-)
drivers/net/hns3/hns3_ethdev.c +0 -5
@@ -2512,11 +2512,6 @@ hns3_dev_configure(struct rte_eth_dev *dev)if (ret) goto cfg_err; - hns->rx_simple_allowed = true; - hns->rx_vec_allowed = true; - hns->tx_simple_allowed = true; - hns->tx_vec_allowed = true; -hns3_init_rx_ptype_tble (dev); hw->adapter_state =HNS3_NIC_CONFIGURED ;
drivers/net/hns3/hns3_ethdev.h +0 -5
@@ -777,11 +777,6 @@ struct hns3_adapter {struct hns3_vf vf; }; -bool rx_simple_allowed; -bool rx_vec_allowed; -bool tx_simple_allowed; -bool tx_vec_allowed; -uint32_t rx_func_hint;uint32_t tx_func_hint;
drivers/net/hns3/hns3_ethdev_vf.c +0 -5
@@ -854,11 +854,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)if (ret) goto cfg_err; - hns->rx_simple_allowed = true; - hns->rx_vec_allowed = true; - hns->tx_simple_allowed = true; - hns->tx_vec_allowed = true; -hns3_init_rx_ptype_tble (dev); hw->adapter_state =HNS3_NIC_CONFIGURED ;
drivers/net/hns3/hns3_rxtx.c +4 -7
@@ -2805,10 +2805,9 @@ hns3_get_rx_function(struct rte_eth_dev *dev)uint64_t offloads = dev->data->dev_conf.rxmode.offloads;bool vec_allowed, sve_allowed, simple_allowed; - vec_allowed = hns->rx_vec_allowed && -hns3_rx_check_vec_support (dev) ==0 ; + vec_allowed =hns3_rx_check_vec_support (dev) ==0 ; sve_allowed = vec_allowed &&hns3_check_sve_support (); - simple_allowed = hns->rx_simple_allowed && !dev->data->scattered_rx && + simple_allowed = !dev->data->scattered_rx && (offloads &DEV_RX_OFFLOAD_TCP_LRO ) ==0 ;if (hns->rx_func_hint ==HNS3_IO_FUNC_HINT_VEC && vec_allowed)
@@ -4195,11 +4194,9 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)struct hns3_adapter *hns = dev->data->dev_private;bool vec_allowed, sve_allowed, simple_allowed; - vec_allowed = hns->tx_vec_allowed && -hns3_tx_check_vec_support (dev) ==0 ; + vec_allowed =hns3_tx_check_vec_support (dev) ==0 ; sve_allowed = vec_allowed &&hns3_check_sve_support (); - simple_allowed = hns->tx_simple_allowed && -hns3_tx_check_simple_support (dev); + simple_allowed =hns3_tx_check_simple_support (dev); *prep =NULL ;
Signature · 1 line
2.7.4
PATCH v2 2/7 net/hns3: fix missing rollback in PF init
In reply to Min Hu (Connor)This patch adds rollback processing when updating imissed stats failed in PF init.
--- drivers/net/hns3/hns3_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_ethdev.c +1 -1
@@ -4991,7 +4991,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) ret =hns3_update_imissed_stats (hw, true);if (ret) {hns3_err (hw,"clear imissed stats failed, ret = %d" , ret); -return ret; + goto err_cmd_init; }hns3_config_all_msix_error (hw, true);
Signature · 1 line
2.7.4
PATCH v2 3/7 net/hns3: fix FLR failure when RAS concurrent with FLR
In reply to Min Hu (Connor)From: Hongbo Zheng <[email protected]>
Currently, if RAS interrupt and FLR occurred at the same time, FLR will be detected and corresponding schedule state will be set during RAS interrupt processing. However, the schedule state value will be overridden in subsequent RAS processing, resulting in FLR processing failure. This patch solves this problem.
--- drivers/net/hns3/hns3_intr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_intr.c +4 -3
@@ -2133,10 +2133,11 @@ hns3_schedule_reset(struct hns3_adapter *hns) SCHEDULE_REQUESTED)return ;if (__atomic_load_n (&hw->reset.schedule, __ATOMIC_RELAXED) == -SCHEDULE_DEFERRED ) +SCHEDULE_DEFERRED )rte_eal_alarm_cancel (hw->reset.ops->reset_service, hns); -__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , - __ATOMIC_RELAXED); +else +__atomic_store_n (&hw->reset.schedule,SCHEDULE_REQUESTED , + __ATOMIC_RELAXED);rte_eal_alarm_set (SWITCH_CONTEXT_US , hw->reset.ops->reset_service, hns); }
Signature · 1 line
2.7.4
PATCH v2 4/7 net/hns3: fix some packet type calc error
In reply to Min Hu (Connor)From: Chengwen Feng <[email protected]>
Currently, the packet type calculated by vlan/ovlan/l3id/l4id/ol3id/ol4id fields have the following problems:
1) Identify error when exist vlan strip which will lead to the data buffer has non vlan header but mbuf's ptype have L2_ETHER_VLAN flag.
2) Some packet identifies error, eg: hardware report it's RARP or unknown packet, but ptype will marked with L2_ETHER .
So driver will calculate packet type only by l3id/l4id/ol3id/ol4id fields.
--- drivers/net/hns3/hns3_ethdev.h | 4 +-- drivers/net/hns3/hns3_rxtx.c | 60 +++++++++++++----------------------------- drivers/net/hns3/hns3_rxtx.h | 14 ++++------ 3 files changed, 24 insertions(+), 54 deletions(-)
drivers/net/hns3/hns3_ethdev.h +1 -3
@@ -682,12 +682,10 @@ struct hns3_ptype_table {* The next fields used to calc packet-type by the * L3_ID/L4_ID/OL3_ID/OL4_ID from the Rx descriptor. */ -uint32_t l2l3table[HNS3_L2TBL_NUM ][HNS3_L3TBL_NUM ]; +uint32_t l3table[HNS3_L3TBL_NUM ];uint32_t l4table[HNS3_L4TBL_NUM ]; -uint32_t inner_l2table[HNS3_L2TBL_NUM ];uint32_t inner_l3table[HNS3_L3TBL_NUM ];uint32_t inner_l4table[HNS3_L4TBL_NUM ]; -uint32_t ol2table[HNS3_OL2TBL_NUM ];uint32_t ol3table[HNS3_OL3TBL_NUM ];uint32_t ol4table[HNS3_OL4TBL_NUM ];
drivers/net/hns3/hns3_rxtx.c +18 -42
83 lines not on this page · raw message
drivers/net/hns3/hns3_rxtx.h +5 -9
@@ -635,8 +635,8 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, const uint32_t ol_info) {const struct hns3_ptype_table *const ptype_tbl = rxq->ptype_tbl; -uint32_t l2id, l3id, l4id; -uint32_t ol3id, ol4id, ol2id; +uint32_t ol3id, ol4id; +uint32_t l3id, l4id;uint32_t ptype;if (rxq->ptype_en) {
@@ -647,20 +647,16 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, ol4id =hns3_get_field (ol_info,HNS3_RXD_OL4ID_M ,HNS3_RXD_OL4ID_S ); ol3id =hns3_get_field (ol_info,HNS3_RXD_OL3ID_M ,HNS3_RXD_OL3ID_S ); - ol2id =hns3_get_field (ol_info,HNS3_RXD_OVLAN_M ,HNS3_RXD_OVLAN_S ); - l2id =hns3_get_field (l234_info,HNS3_RXD_VLAN_M ,HNS3_RXD_VLAN_S ); l3id =hns3_get_field (l234_info,HNS3_RXD_L3ID_M ,HNS3_RXD_L3ID_S ); l4id =hns3_get_field (l234_info,HNS3_RXD_L4ID_M ,HNS3_RXD_L4ID_S );if (unlikely (ptype_tbl->ol4table[ol4id])) -return ptype_tbl->inner_l2table[l2id] | - ptype_tbl->inner_l3table[l3id] | +return ptype_tbl->inner_l3table[l3id] | ptype_tbl->inner_l4table[l4id] | ptype_tbl->ol3table[ol3id] | - ptype_tbl->ol4table[ol4id] | ptype_tbl->ol2table[ol2id]; + ptype_tbl->ol4table[ol4id];else -return ptype_tbl->l2l3table[l2id][l3id] | - ptype_tbl->l4table[l4id]; +return ptype_tbl->l3table[l3id] | ptype_tbl->l4table[l4id]; }void hns3_dev_rx_queue_release (void *queue);
Signature · 1 line
2.7.4
PATCH v2 5/7 net/hns3: fix incorrect timing in resetting queues
In reply to Min Hu (Connor)From: Chengchang Tang <[email protected]>
During the task queue pairs reset, the getimeofday is used to obtain the timestamp to determine whether the command execution times out. But gettimeofday is not monotonous, it can be modified by system administrators, so the timing may not be accurate or even cause the loop to wait consistently. And actually, in this scenario, it is not necessary to obain the timestamp.
This patch removes the operation of obtaining the timestamp from the task queue pairs reset function.
--- drivers/net/hns3/hns3_rxtx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_rxtx.c +4 -3
@@ -625,8 +625,8 @@ static int hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) {#define HNS3_TQP_RESET_TRY_MS 200 +uint16_t wait_time =0 ;uint8_t reset_status; -uint64_t end;int ret;/*
@@ -639,17 +639,18 @@ hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id)hns3_err (hw,"Send reset tqp cmd fail, ret = %d" , ret);return ret; } - end =get_timeofday_ms () +HNS3_TQP_RESET_TRY_MS ; +do {/* Wait for tqp hw reset */ rte_delay_ms (HNS3_POLL_RESPONE_MS ); + wait_time +=HNS3_POLL_RESPONE_MS ; ret =hns3_get_tqp_reset_status (hw, queue_id, &reset_status);if (ret) goto tqp_reset_fail;if (reset_status)break ; - }while (get_timeofday_ms () < end); + }while (wait_time <HNS3_TQP_RESET_TRY_MS );if (!reset_status) { ret = -ETIMEDOUT ;
Signature · 1 line
2.7.4
PATCH v2 6/7 net/hns3: fix queue state when concurrent with reset
In reply to Min Hu (Connor)From: Chengchang Tang <[email protected]>
At the end of the reset, the state of queues need to be restored according to the states saved in the driver. If the start and stop operations of the queues are concurrent at this time, it may cause the final status to be uncertain.
This patch requires queues to acquire the hw lock before starting and stopping. If the device is being restored due to reset at this time, it will block until the reset is completed.
--- drivers/net/hns3/hns3_rxtx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/hns3/hns3_rxtx.c +11 -0
@@ -4270,10 +4270,12 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock); ret =hns3_reset_queue (hw, rx_queue_id,HNS3_RING_TYPE_RX );if (ret) {hns3_err (hw,"fail to reset Rx queue %u, ret = %d." , rx_queue_id, ret); +rte_spinlock_unlock (&hw->lock);return ret; }
@@ -4281,11 +4283,13 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (ret) {hns3_err (hw,"fail to init Rx queue %u, ret = %d." , rx_queue_id, ret); +rte_spinlock_unlock (&hw->lock);return ret; }hns3_enable_rxq (rxq, true); dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; +rte_spinlock_unlock (&hw->lock);return ret; }
@@ -4312,12 +4316,14 @@ hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock);hns3_enable_rxq (rxq, false);hns3_rx_queue_release_mbufs (rxq);hns3_reset_sw_rxq (rxq); dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; +rte_spinlock_unlock (&hw->lock);return 0 ; }
@@ -4332,16 +4338,19 @@ hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock); ret =hns3_reset_queue (hw, tx_queue_id,HNS3_RING_TYPE_TX );if (ret) {hns3_err (hw,"fail to reset Tx queue %u, ret = %d." , tx_queue_id, ret); +rte_spinlock_unlock (&hw->lock);return ret; }hns3_init_txq (txq);hns3_enable_txq (txq, true); dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; +rte_spinlock_unlock (&hw->lock);return ret; }
@@ -4355,6 +4364,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)if (!hns3_dev_indep_txrx_supported (hw))return -ENOTSUP ; +rte_spinlock_lock (&hw->lock);hns3_enable_txq (txq, false);hns3_tx_queue_release_mbufs (txq);/*
@@ -4366,6 +4376,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)*/ hns3_init_txq (txq); dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; +rte_spinlock_unlock (&hw->lock);return 0 ; }
Signature · 1 line
2.7.4
PATCH v2 7/7 net/hns3: fix configure FEC when concurrent with reset
In reply to Min Hu (Connor)From: Chengchang Tang <[email protected]>
Currently, after the reset is complete, the PMD restores the FEC according to the FEC configuration reserved in the driver. If there is a concurrency between the FEC setup operation and the restore operation after a reset, the FEC status of the last hardware may be unknown.
This patch adds the step of obtaining the lock when setting the FEC to avoid concurrency between restore operation and setting operation.
--- drivers/net/hns3/hns3_ethdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/hns3/hns3_ethdev.c +6 -1
@@ -6411,11 +6411,16 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode)return -EINVAL ; } +rte_spinlock_lock (&hw->lock); ret =hns3_set_fec_hw (hw, mode); -if (ret) +if (ret) { +rte_spinlock_unlock (&hw->lock);return ret; + } pf->fec_mode = mode; +rte_spinlock_unlock (&hw->lock); +return 0 ; }
Signature · 1 line
2.7.4
Quoted 11 lines · Min Hu (Connor)
This set of patches contains seven bugfixes for hns3 PMD.
Chengchang Tang (3):
net/hns3: fix incorrect timing in resetting queues net/hns3: fix queue state when concurrent with reset net/hns3: fix configure FEC when concurrent with resetChengwen Feng (2):
net/hns3: remove variables of selecting Rx/Tx function net/hns3: fix some packet type calc error
Quoted 5 lines
Hongbo Zheng (1):
net/hns3: fix FLR failure when RAS concurrent with FLRMin Hu (Connor) (1):
net/hns3: fix missing rollback in PF init
Series applied to dpdk-next-net/main, thanks.