From patchwork Fri Nov 22 12:39:49 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: 63229 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 78268A04C3; Fri, 22 Nov 2019 13:40:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3B4C45B32; Fri, 22 Nov 2019 13:40:10 +0100 (CET) Received: from smtp.tom.com (smtprz14.163.net [106.3.154.247]) by dpdk.org (Postfix) with ESMTP id 8AB522C08 for ; Fri, 22 Nov 2019 13:40:05 +0100 (CET) Received: from my-app02.tom.com (my-app02.tom.com [127.0.0.1]) by freemail02.tom.com (Postfix) with ESMTP id 5A781B00D6B for ; Fri, 22 Nov 2019 20:40:11 +0800 (CST) Received: from my-app02.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app02 (TOM SMTP Server) with SMTP ID 572997317 for ; Fri, 22 Nov 2019 20:40:11 +0800 (CST) Received: from antispam2.tom.com (unknown [172.25.16.56]) by freemail02.tom.com (Postfix) with ESMTP id 47D97B00D4C for ; Fri, 22 Nov 2019 20:40:11 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574426411; bh=WtrCasxu6FDls7wvntLMYSPC3VxSbSpVosMjg5VSjSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yhn2rPbZ8g81Zva/V4JvwR1dxUhVFvWlaRxT77TDe7eAWRKEZx2ZA8yP0EhSJ9YbO TWctQ8smQrzA6B2nPneGNE4BMjf6qQTQvUj/kS3FcG285ZCCTHSht492ZEyqgRkKSG DbonnakB+ri6A1td9fymib9bJIiP3oPbBYsWtNK4= Received: from antispam2.tom.com (antispam2.tom.com [127.0.0.1]) by antispam2.tom.com (Postfix) with ESMTP id 1D07F817F2 for ; Fri, 22 Nov 2019 20:39:49 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam2.tom.com Received: from antispam2.tom.com ([127.0.0.1]) by antispam2.tom.com (antispam2.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9nxbIjQMyEKw for ; Fri, 22 Nov 2019 20:39:46 +0800 (CST) Received: from localhost.localdomain (unknown [114.119.4.74]) by antispam2.tom.com (Postfix) with ESMTPA id 65429817EC; Fri, 22 Nov 2019 20:39:46 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org Cc: stable@dpdk.org, xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:39:49 +0800 Message-Id: <20191122123954.17911-2-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122123954.17911-1-xavier.huwei@tom.com> References: <20191122123954.17911-1-xavier.huwei@tom.com> MIME-Version: 1.0 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:39:50 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: 63230 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 551ABA04C3; Fri, 22 Nov 2019 13:40:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 33C3C7CBC; Fri, 22 Nov 2019 13:40:17 +0100 (CET) Received: from smtp.tom.com (smtprz14.163.net [106.3.154.247]) by dpdk.org (Postfix) with ESMTP id C66492C30 for ; Fri, 22 Nov 2019 13:40:06 +0100 (CET) Received: from my-app02.tom.com (my-app02.tom.com [127.0.0.1]) by freemail02.tom.com (Postfix) with ESMTP id 5A5A0B00D64 for ; Fri, 22 Nov 2019 20:40:11 +0800 (CST) Received: from my-app02.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app02 (TOM SMTP Server) with SMTP ID 2137138911 for ; Fri, 22 Nov 2019 20:40:11 +0800 (CST) Received: from antispam2.tom.com (unknown [172.25.16.56]) by freemail02.tom.com (Postfix) with ESMTP id 47DBCB00D5C for ; Fri, 22 Nov 2019 20:40:11 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574426411; bh=gVi1+1bGincgaANiQdx/VF/31GeCmaMYNcw9BxVOZg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zApAOdX7o/ZJtAYbBzn9Ta8wo/Tc/HqRpvH0dzvskVUXMf1O9LbqNBSliHH0aQHz0 W2ffGs+xZBIEz1c3BCDOJNihAyx6KKqvPALkGiBBGHC9kr4g1L/7AkTqJOiOQ73a63 e4jTY1lIfpGBYePy04TX3l9/q23V6jplzfHBU5dc= Received: from antispam2.tom.com (antispam2.tom.com [127.0.0.1]) by antispam2.tom.com (Postfix) with ESMTP id 1B8828179D for ; Fri, 22 Nov 2019 20:39:49 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam2.tom.com Received: from antispam2.tom.com ([127.0.0.1]) by antispam2.tom.com (antispam2.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mIMBBeqXNlTp for ; Fri, 22 Nov 2019 20:39:47 +0800 (CST) Received: from localhost.localdomain (unknown [114.119.4.74]) by antispam2.tom.com (Postfix) with ESMTPA id CD11E818C8; Fri, 22 Nov 2019 20:39:46 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org Cc: stable@dpdk.org, xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:39:50 +0800 Message-Id: <20191122123954.17911-3-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122123954.17911-1-xavier.huwei@tom.com> References: <20191122123954.17911-1-xavier.huwei@tom.com> MIME-Version: 1.0 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