Fixes for hns3 PMD driver
cover Fixes for hns3 PMD driver
From: "Wei Hu (Xavier)" <[email protected]>
This series add some fixes for hns3 PMD driver.
Chengchang Tang (1):
net/hns3: fix the error length limit of maiblox response
Hao Chen (1):
net/hns3: fix RSS hardware configuration restore failure
Huisong Li (1):
net/hns3: fix the strategy of getting link status for VF
Min Hu (Connor) (1):
net/hns3: fix duplicate VLAN
Wei Hu (Xavier) (2):
net/hns3: fix VF configuration table entries restore failure net/hns3: fix the failure sending packets less than 60 bytes
drivers/net/hns3/hns3_ethdev.c | 5 +++++ drivers/net/hns3/hns3_ethdev.h | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 22 +++++++++++++++++----- drivers/net/hns3/hns3_mbx.c | 4 +--- drivers/net/hns3/hns3_mbx.h | 6 ++++++ drivers/net/hns3/hns3_rss.c | 4 +--- drivers/net/hns3/hns3_rxtx.c | 24 ++++++++++++++++++++---- 7 files changed, 51 insertions(+), 15 deletions(-)
Signature · 1 line
2.23.0
PATCH 1/6 net/hns3: fix RSS hardware configuration restore failure
From: Hao Chen <[email protected]>
This patch fixes the bug that hardware configuration called tc_size doesn't restore to the initial value when starting the app, configuring PFC and then restarting the app, because of the tc_mode didn't initial when rss is disabled.
--- drivers/net/hns3/hns3_rss.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/hns3/hns3_rss.c +1 -3
@@ -525,10 +525,8 @@ hns3_config_rss(struct hns3_adapter *hns)enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode;/* When there is no open RSS, redirect the packet queue 0 */ -if (((uint32_t )mq_mode Ð_MQ_RX_RSS_FLAG ) ==0 ) { +if (((uint32_t )mq_mode Ð_MQ_RX_RSS_FLAG ) ==0 )hns3_rss_uninit (hns); -return 0 ; - }/* Configure RSS hash algorithm and hash key offset */ ret =hns3_set_rss_algo_key (hw, hash_algo, hash_key);
Signature · 1 line
2.23.0
PATCH 2/6 net/hns3: fix VF configuration table entries restore failure
In reply to Wei Hu (Xavier)From: "Wei Hu (Xavier)" <[email protected]>
When the application using VF device exits abnormally, for example, when it is killed by 'kill -9', kernel PF netdev driver also stores the corresponding configuration table entries of VF device.
This patch fixes it by adding message of deleting VF configuration table entry corresponds to the revision of kernel hns3 netdev driver, the new message is added to notify the kernel PF netdev driver to clean up the VF configuration initialization during VF initialization.
This revision is compatible with the old version of kernel hns3 netdev driver. The old version of kernel pf netdev driver will ignore this message.
--- drivers/net/hns3/hns3_ethdev_vf.c | 14 ++++++++++++++ drivers/net/hns3/hns3_mbx.h | 6 ++++++ 2 files changed, 20 insertions(+)
drivers/net/hns3/hns3_ethdev_vf.c +14 -0
@@ -1096,6 +1096,14 @@ hns3vf_init_hardware(struct hns3_adapter *hns)return ret; } +static int +hns3vf_clear_vport_list (struct hns3_hw *hw) +{ +return hns3_send_mbx_msg (hw,HNS3_MBX_HANDLE_VF_TBL , +HNS3_MBX_VPORT_LIST_CLEAR ,NULL ,0 , false, +NULL ,0 ); +} +static int hns3vf_init_vf (struct rte_eth_dev *eth_dev) {
@@ -1147,6 +1155,12 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev)rte_eth_random_addr (hw->mac.mac_addr);/* Generate a random mac addr */ + ret =hns3vf_clear_vport_list (hw); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clear tbl list: %d" , ret); + goto err_get_config; + } + ret =hns3vf_init_hardware (hns);if (ret) goto err_get_config;
drivers/net/hns3/hns3_mbx.h +6 -0
@@ -39,6 +39,8 @@ enum HNS3_MBX_OPCODE {HNS3_MBX_SET_ALIVE ,/* (VF -> PF) set alive state */ HNS3_MBX_SET_MTU ,/* (VF -> PF) set mtu */ HNS3_MBX_GET_QID_IN_PF ,/* (VF -> PF) get queue id in pf */ + + HNS3_MBX_HANDLE_VF_TBL = 38, /* (VF -> PF) store/clear hw cfg tbl */ };/* below are per-VF mac-vlan subcodes */
@@ -58,6 +60,10 @@ enum hns3_mbx_vlan_cfg_subcode { HNS3_MBX_VLAN_RX_OFF_CFG, /* set rx side vlan offload */ }; +enum hns3_mbx_tbl_cfg_subcode { +HNS3_MBX_VPORT_LIST_CLEAR =0 , +}; +#define HNS3_MBX_MAX_MSG_SIZE 16#define HNS3_MBX_MAX_RESP_DATA_SIZE 8#define HNS3_MBX_RING_MAP_BASIC_MSG_NUM 3
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH 2/6] net/hns3: fix VF configuration table entries restore failure
Quoted 16 lines · Wei Hu (Xavier)
From: "Wei Hu (Xavier)" <[email protected]>
When the application using VF device exits abnormally, for example, when it is killed by 'kill -9', kernel PF netdev driver also stores the corresponding configuration table entries of VF device.
This patch fixes it by adding message of deleting VF configuration table entry corresponds to the revision of kernel hns3 netdev driver, the new message is added to notify the kernel PF netdev driver to clean up the VF configuration initialization during VF initialization.
This revision is compatible with the old version of kernel hns3 netdev driver. The old version of kernel pf netdev driver will ignore this message.
Quoted 5 lines
Fixes a5475d61fa34 ("net/hns3: support VF")Signed-off-by Hongbo Zheng <[email protected]>Signed-off-by Wei Hu (Xavier) <[email protected]>
Hi Xavier,
We are trying the use unique identifier for same person as much as possible, Above seems your personal email, I will update all occurrences as following, as how git history knows you:
Wei Hu (Xavier) <[email protected]>
Please let us know if there is an objection/concern on this changes.
PATCH 3/6 net/hns3: fix the failure sending packets less than 60 bytes
In reply to Wei Hu (Xavier)From: "Wei Hu (Xavier)" <[email protected]>
Ethernet minimum packet length is 64 bytes. If upper application sends packets with less than 60 bytes in length(no CRC), driver adds padding processing to avoid failure.
--- drivers/net/hns3/hns3_ethdev.h | 1 + drivers/net/hns3/hns3_rxtx.c | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-)
drivers/net/hns3/hns3_ethdev.h +1 -0
@@ -43,6 +43,7 @@#define HNS3_MAX_MTU (HNS3_MAX_FRAME_LEN - HNS3_ETH_OVERHEAD)#define HNS3_DEFAULT_MTU 1500UL#define HNS3_DEFAULT_FRAME_LEN (HNS3_DEFAULT_MTU + HNS3_ETH_OVERHEAD) +#define HNS3_MIN_PKT_SIZE 60#define HNS3_4_TCS 4#define HNS3_8_TCS 8
drivers/net/hns3/hns3_rxtx.c +20 -4
@@ -1598,13 +1598,29 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) }/* -* If the length of the packet is too long or zero, the packet -* will be ignored. +* If packet length is greater than HNS3_MAX_FRAME_LEN +* driver support, the packet will be ignored. */ -if (unlikely (tx_pkt->pkt_len >HNS3_MAX_FRAME_LEN || - tx_pkt->pkt_len ==0 )) +if (unlikely (rte_pktmbuf_pkt_len (tx_pkt) >HNS3_MAX_FRAME_LEN ))break ; +/* +* If packet length is less than minimum packet size, driver +* need to pad it. +*/ +if (unlikely (rte_pktmbuf_pkt_len (tx_pkt) <HNS3_MIN_PKT_SIZE )) { +uint16_t add_len; +char *appended; + + add_len =HNS3_MIN_PKT_SIZE - +rte_pktmbuf_pkt_len (tx_pkt); + appended =rte_pktmbuf_append (tx_pkt, add_len); +if (appended ==NULL ) +break ; + +memset (appended,0 , add_len); + } + m_seg = tx_pkt;if (unlikely (nb_buf >HNS3_MAX_TX_BD_PER_PKT )) {if (hns3_reassemble_tx_pkts (txq, tx_pkt, &new_pkt))
Signature · 1 line
2.23.0
PATCH 4/6 net/hns3: fix the error length limit of maiblox response
In reply to Wei Hu (Xavier)From: Chengchang Tang <[email protected]>
This patch removes the macro 'HNS3_REG_MSG_DATA_OFFSET' which is used to prevent the array from accessing violation and it limits the response data length to be 4. but the limit value is too short to get some longer information such as 6 byte MAC address.
This patch modify the length of response data from mailbox to allows the response data length to be 8. So that the VF driver could get more data from PF drvier by mailbox.
--- drivers/net/hns3/hns3_mbx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/hns3/hns3_mbx.c +1 -3
@@ -24,7 +24,6 @@#include "hns3_logs.h" #include "hns3_intr.h" -#define HNS3_REG_MSG_DATA_OFFSET 4#define HNS3_CMD_CODE_OFFSET 2static const struct errno_respcode_map err_code_map[] = {
@@ -320,8 +319,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) resp->resp_status =hns3_resp_to_errno (req->msg[3 ]); temp = (uint8_t *)&req->msg[4 ]; -for (i =0 ; i <HNS3_MBX_MAX_RESP_DATA_SIZE && - i <HNS3_REG_MSG_DATA_OFFSET ; i++) { +for (i =0 ; i <HNS3_MBX_MAX_RESP_DATA_SIZE ; i++) { resp->additional_info[i] = *temp; temp++; }
Signature · 1 line
2.23.0
PATCH 5/6 net/hns3: fix the strategy of getting link status for VF
In reply to Wei Hu (Xavier)From: Huisong Li <[email protected]>
Currently, port link status is "up" in VF driver after user calling the rte_eth_dev_stop API. This is unreasonable.
Therefore, this patch adjusts the strategy of getting link status from PF driver for VF. VF drvier should stop getting link status from PF by canceling the alarm that VF driver send mailbox message to PF driver, when the rte_eth_dev_stop API is called. And VF driver should restore the alarm when the rte_eth_dev_start API is called.
--- drivers/net/hns3/hns3_ethdev_vf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/hns3/hns3_ethdev_vf.c +3 -5
@@ -1246,6 +1246,7 @@ hns3vf_dev_stop(struct rte_eth_dev *eth_dev)hns3_dev_release_mbufs (hns); hw->adapter_state =HNS3_NIC_CONFIGURED ; } +rte_eal_alarm_cancel (hns3vf_service_handler, eth_dev);rte_spinlock_unlock (&hw->lock); }
@@ -1265,7 +1266,6 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)hns3_reset_abort (hns); hw->adapter_state =HNS3_NIC_CLOSED ;rte_eal_alarm_cancel (hns3vf_keep_alive_handler, eth_dev); -rte_eal_alarm_cancel (hns3vf_service_handler, eth_dev);hns3vf_configure_all_mc_mac_addr (hns, true);hns3vf_remove_all_vlan_table (hns);hns3vf_uninit_vf (eth_dev);
@@ -1286,8 +1286,6 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,struct hns3_mac *mac = &hw->mac;struct rte_eth_link new_link; -hns3vf_request_link_info (hw); -memset (&new_link,0 ,sizeof (new_link));switch (mac->link_speed) {case ETH_SPEED_NUM_10M :
@@ -1352,6 +1350,8 @@ hns3vf_dev_start(struct rte_eth_dev *eth_dev)rte_spinlock_unlock (&hw->lock);hns3_set_rxtx_function (eth_dev);hns3_mp_req_start_rxtx (eth_dev); +rte_eal_alarm_set (HNS3VF_SERVICE_INTERVAL , hns3vf_service_handler, + eth_dev);return 0 ; }
@@ -1789,8 +1789,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) }rte_eal_alarm_set (HNS3VF_KEEP_ALIVE_INTERVAL , hns3vf_keep_alive_handler, eth_dev); -rte_eal_alarm_set (HNS3VF_SERVICE_INTERVAL , hns3vf_service_handler, - eth_dev);return 0 ; err_rte_zmalloc:
Signature · 1 line
2.23.0
PATCH 6/6 net/hns3: fix duplicate VLAN
In reply to Wei Hu (Xavier)From: "Min Hu (Connor)" <[email protected]>
When setting duplicate vlan, hns3 driver will also add vlan entry to vlan linked list, and this is unreasonable.
This patch adds checking whether the VLAN to be added already exists in the linked list and preventing adding duplicate vlan.
--- drivers/net/hns3/hns3_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/hns3/hns3_ethdev.c +5 -0
@@ -282,6 +282,11 @@ hns3_add_dev_vlan_table(struct hns3_adapter *hns, uint16_t vlan_id,struct hns3_hw *hw = &hns->hw;struct hns3_pf *pf = &hns->pf; + LIST_FOREACH(vlan_entry, &pf->vlan_list, next) { +if (vlan_entry->vlan_id == vlan_id) +return ; + } + vlan_entry =rte_zmalloc ("hns3_vlan_tbl" ,sizeof (*vlan_entry),0 );if (vlan_entry ==NULL ) {hns3_err (hw,"Failed to malloc hns3 vlan table" );
Signature · 1 line
2.23.0
Quoted 13 lines · Wei Hu (Xavier)
From: "Wei Hu (Xavier)" <[email protected]>
This series add some fixes for hns3 PMD driver.
Chengchang Tang (1):
net/hns3: fix the error length limit of maiblox responseHao Chen (1):
net/hns3: fix RSS hardware configuration restore failureHuisong Li (1):
net/hns3: fix the strategy of getting link status for VF
Quoted 6 lines
Min Hu (Connor) (1):
net/hns3: fix duplicate VLANWei Hu (Xavier) (2):
net/hns3: fix VF configuration table entries restore failure net/hns3: fix the failure sending packets less than 60 bytes
Series applied to dpdk-next-net/master, thanks.