From patchwork Fri Nov 22 12:06:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 63235 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 412D5A04C3; Fri, 22 Nov 2019 15:16:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C44442BF2; Fri, 22 Nov 2019 15:15:57 +0100 (CET) Received: from smtp.tom.com (smtprz14.163.net [106.3.154.247]) by dpdk.org (Postfix) with ESMTP id CAF8C1DBC for ; Fri, 22 Nov 2019 13:06:35 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 140751C81A64 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID 863127031 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 037381C81A43 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424398; bh=WtrCasxu6FDls7wvntLMYSPC3VxSbSpVosMjg5VSjSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpcVSndV+c4wgHdCTExTkkvK9C4jTNPreyJti71fvKwSoAhvl/qWBkpXUxbS1yhqn c4djTVDd7ab/lzkP+ni3SzGRcCz5/B6CNgRcBPQZSYxD77INzlgIZ8mC7o7Hf7ZhmI 80hLsuE1rXkyMur0D/+x39oo8XKdi2LL2eEsln8c= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 0633C1001887 for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LrUWtv_kEkiB for ; Fri, 22 Nov 2019 20:06:07 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id D65F11001515; Fri, 22 Nov 2019 20:06:06 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:19 +0800 Message-Id: <20191122120624.4963-2-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 1/6] net/hns3: fix RSS hardware configuration restore failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hao Chen 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 Signed-off-by: Wei Hu (Xavier) --- 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); From patchwork Fri Nov 22 12:06:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 63234 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BAC8A04C3; Fri, 22 Nov 2019 15:16:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B7F22BBB; Fri, 22 Nov 2019 15:15:56 +0100 (CET) Received: from smtp.tom.com (smtprz14.163.net [106.3.154.247]) by dpdk.org (Postfix) with ESMTP id 751F82C30 for ; Fri, 22 Nov 2019 13:06:35 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 1C5D11C81A77 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID 97149650 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 112F41C81A5C for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424398; bh=gVi1+1bGincgaANiQdx/VF/31GeCmaMYNcw9BxVOZg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SSVx8qjlVAjT3U2nSRmMzV8UZITKN+pW+ci4RMxvaSn5R9w1fhirCw3XVQ/Q1wGvy 4iaIRMlqQvSFYj+GlfOAPaAWDqSuryFHwmgVP3mVAf3dVgrZBnAyi9t20uo0hiWWqE OLBaRxzuEec/zIkLpFZBzGLXj9BjDuAtPtKTKi9Q= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 0771D1001891 for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SrTQlVLqqZzK for ; Fri, 22 Nov 2019 20:06:07 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id 530BC1001124; Fri, 22 Nov 2019 20:06:07 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:20 +0800 Message-Id: <20191122120624.4963-3-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 2/6] net/hns3: fix VF configuration table entries restore failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "Wei Hu (Xavier)" 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 Signed-off-by: Wei Hu (Xavier) --- 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 From patchwork Fri Nov 22 12:06:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 63238 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B33BA04C3; Fri, 22 Nov 2019 15:16:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F7505B3E; Fri, 22 Nov 2019 15:16:02 +0100 (CET) Received: from smtp.tom.com (smtprz14.163.net [106.3.154.247]) by dpdk.org (Postfix) with ESMTP id 4A48C2C08 for ; Fri, 22 Nov 2019 13:17:44 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 042181C81A49 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID -604769835 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 005841C81A1F for ; Fri, 22 Nov 2019 20:06:37 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424398; bh=7W4WK+qM7clPkaCnQs3bArPuBbKunpoExc59NEdMfBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=epGjeJzaCaAzGtvr2xauAVDOaqz5cza7kp5L5wz3EMDEOebzuOD0zRBl2vv87VEo8 q3iKYS4TOPMub441la+2YeRNjxKcjYlMcNu9ujm3DxlfW5Jh37mA9l4DduP3UgGICY 3SSlRsTtI2u5PDtiAdh6BMDAgQepN6EKLYO+v6jI= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 0467B1001873 for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aBIi5DL8IbvQ for ; Fri, 22 Nov 2019 20:06:08 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id C436710017BC; Fri, 22 Nov 2019 20:06:07 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:21 +0800 Message-Id: <20191122120624.4963-4-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 3/6] net/hns3: fix the failure sending packets less than 60 bytes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "Wei Hu (Xavier)" 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 Signed-off-by: Wei Hu (Xavier) --- 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)) From patchwork Fri Nov 22 12:06:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 63236 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09730A04C3; Fri, 22 Nov 2019 15:16:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 744902C30; Fri, 22 Nov 2019 15:15:59 +0100 (CET) Received: from smtp.tom.com (smtprz15.163.net [106.3.154.248]) by dpdk.org (Postfix) with ESMTP id 0366E2C28 for ; Fri, 22 Nov 2019 13:06:35 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 341511C81A35 for ; Fri, 22 Nov 2019 20:06:39 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID -1349614957 for ; Fri, 22 Nov 2019 20:06:39 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 2FEAB1C81A1F for ; Fri, 22 Nov 2019 20:06:39 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424399; bh=AFMbcsaxDpXf5dmmWxXvPLa9tCdQDu8PXc5Jyfm5SMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wk3gwpP7hZz3Tx1wZQwPIgp4PVbcatb1IXyShnHbWPKpJbDbBACKWqEIyzJhkBf5W bqWDw1BqKTu180hrcxUZQJNXw7rns6tDvHyxBOLrHEcbk7s0O0Xhq12R7cJgfdgl5a SjZmDU4mwXtIYMpy7oX1QXjScnLFlNnCpwcFyTvs= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 3269310015E5 for ; Fri, 22 Nov 2019 20:06:10 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RHusw63Ekf4H for ; Fri, 22 Nov 2019 20:06:08 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id 417D91001825; Fri, 22 Nov 2019 20:06:08 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:22 +0800 Message-Id: <20191122120624.4963-5-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 4/6] net/hns3: fix the error length limit of maiblox response X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengchang Tang 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 Signed-off-by: Wei Hu (Xavier) --- 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++; } From patchwork Fri Nov 22 12:06:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 63237 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B66DA04C3; Fri, 22 Nov 2019 15:16:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 08C1D5596; Fri, 22 Nov 2019 15:16:01 +0100 (CET) Received: from smtp.tom.com (smtprz15.163.net [106.3.154.248]) by dpdk.org (Postfix) with ESMTP id 131BD374 for ; Fri, 22 Nov 2019 13:06:35 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 7A28A1C81A45 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID -1777405614 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 6B19C1C81A28 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424398; bh=gArXmcHvjfBZf3/zrlpv3xzicqJiLFS0WE/WH3chEq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDwdGWGBvRel0K5F8YUz8SKEYzfdw1HI1k4ZnVq/mnxiZfxN8Jkwg3FVhbIoK4Bn/ zk4RTurag8SGDbgnO0Gykl9VURjXB51F48QxVdH978mmkbCjX3/7tvraiJAbaz1yfk slo0EoZuySPKmfpOrI318I5I6NCDF9bGl0CCfNaY= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 6ACA410017C7 for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id riq7xWla5FFh for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id B27E21001828; Fri, 22 Nov 2019 20:06:08 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:23 +0800 Message-Id: <20191122120624.4963-6-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 5/6] net/hns3: fix the strategy of getting link status for VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Huisong Li 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 Signed-off-by: Wei Hu (Xavier) --- 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: From patchwork Fri Nov 22 12:06:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 63233 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7774FA04C3; Fri, 22 Nov 2019 15:16:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 690C52BA2; Fri, 22 Nov 2019 15:15:54 +0100 (CET) Received: from smtp.tom.com (smtprz15.163.net [106.3.154.248]) by dpdk.org (Postfix) with ESMTP id 415161DBC for ; Fri, 22 Nov 2019 13:06:35 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id D799F1C81A30 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID 800360812 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id CE79D1C81A11 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424398; bh=pvTT+4RTUS2gkOkoyJl31nZDpvGhWmlddBxcNTeH6zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=3qUm19s4r/OEb7zhbxxdBgjfx5jvX6qXK+RSBLgqQImFcNR20gn4v7UfHkoy+Otml WJXfgln8/X3wymB/2yEkJXuhIBvrTNCh3BQk9Vz9yhlIWT5255xHKUN2uTPxemUnG4 EagKUETS5zKXNQ9DtMff7QjjgoSzBuwyWIQwNSqs= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id D2F9A10017BC for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rrs7USbp1C5W for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id 381DD10014BB; Fri, 22 Nov 2019 20:06:09 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:24 +0800 Message-Id: <20191122120624.4963-7-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 6/6] net/hns3: fix duplicate VLAN X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "Min Hu (Connor)" 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) Signed-off-by: Wei Hu (Xavier) --- 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");