From: "Wei Hu (Xavier)" <xavier_huwei@163.com> 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(-) -- 2.23.0
From: Hao Chen <chenhao164@huawei.com> 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. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Hao Chen <chenhao164@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> --- drivers/net/hns3/hns3_rss.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index 6a5d63398..b8c20e6d9 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -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 & ETH_MQ_RX_RSS_FLAG) == 0) { + if (((uint32_t)mq_mode & ETH_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); -- 2.23.0
From: "Wei Hu (Xavier)" <xavier_huwei@163.com> 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. Fixes: a5475d61fa34 ("net/hns3: support VF") Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier_huwei@163.com> --- drivers/net/hns3/hns3_ethdev_vf.c | 14 ++++++++++++++ drivers/net/hns3/hns3_mbx.h | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 403674969..2274ac35e 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -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; diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h index ee6e82314..01eddb845 100644 --- a/drivers/net/hns3/hns3_mbx.h +++ b/drivers/net/hns3/hns3_mbx.h @@ -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 -- 2.23.0
From: "Wei Hu (Xavier)" <xavier_huwei@163.com> 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. Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Cc: stable@dpdk.org Signed-off-by: Huisong Li <lihuisong@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier_huwei@163.com> --- drivers/net/hns3/hns3_ethdev.h | 1 + drivers/net/hns3/hns3_rxtx.c | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 9710e45fb..e9a3fe410 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -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 diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 1de238b4c..34cb7faf9 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -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)) -- 2.23.0
From: Chengchang Tang <tangchengchang@hisilicon.com> 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. Fixes: 463e748964f5 ("net/hns3: support mailbox") Cc: stable@dpdk.org Signed-off-by: Chengchang Tang <tangchengchang@hisilicon.com> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> --- drivers/net/hns3/hns3_mbx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c index 2bfd97415..c1647af4b 100644 --- a/drivers/net/hns3/hns3_mbx.c +++ b/drivers/net/hns3/hns3_mbx.c @@ -24,7 +24,6 @@ #include "hns3_logs.h" #include "hns3_intr.h" -#define HNS3_REG_MSG_DATA_OFFSET 4 #define HNS3_CMD_CODE_OFFSET 2 static 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++; } -- 2.23.0
From: Huisong Li <lihuisong@huawei.com> 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. Fixes: a5475d61fa34 ("net/hns3: support VF") Cc: stable@dpdk.org Signed-off-by: Huisong Li <lihuisong@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> --- drivers/net/hns3/hns3_ethdev_vf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 2274ac35e..b1736e73a 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -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: -- 2.23.0
From: "Min Hu (Connor)" <humin29@huawei.com> 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. Fixes: 411d23b9eafb ("net/hns3: support VLAN") Cc: stable@dpdk.org Signed-off-by: Min Hu (Connor) <humin29@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 3435bce26..72315718a 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -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"); -- 2.23.0
On 11/22/2019 12:06 PM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier_huwei@163.com>
>
> 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.
>
> Fixes: a5475d61fa34 ("net/hns3: support VF")
> Cc: stable@dpdk.org
>
> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier_huwei@163.com>
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) <xavier.huwei@huawei.com>
Please let us know if there is an objection/concern on this changes.
On 11/22/2019 12:06 PM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier_huwei@163.com>
>
> 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
Series applied to dpdk-next-net/master, thanks.