From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8B8E2A057C; Thu, 26 Mar 2020 08:15:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89A9C1C0B2; Thu, 26 Mar 2020 08:15:25 +0100 (CET) Received: from mail.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 5F8714CA7 for ; Thu, 26 Mar 2020 08:15:21 +0100 (CET) Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Thu, 26 Mar 2020 15:15:01 +0800 From: "Wei Hu (Xavier)" To: Date: Thu, 26 Mar 2020 15:14:33 +0800 Message-ID: <20200326071433.65694-5-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200326071433.65694-1-huwei013@chinasoftinc.com> References: <20200326071433.65694-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] Subject: [dpdk-dev] [PATCH 4/4] net/hns3: fix the return value of setting VLAN offload 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: Chengwen Feng Currently, the '.vlan_offload_set' ops implementation function named hns3vf_vlan_offload_set always return 0 in hns3 VF PMD driver. This patch fixes it with the following modification in the function named hns3vf_vlan_offload_set. 1. Avoid setting hardware configuration and return -EIO during resetting. 2. Add the return value dectection process for calling internal static function named hns3vf_en_hw_strip_rxvtag. Fixes: a5475d61fa34 ("net/hns3: support VF") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_ethdev_vf.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index e0c40a10e..8be743d19 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1150,6 +1150,13 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask) struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct rte_eth_conf *dev_conf = &dev->data->dev_conf; unsigned int tmp_mask; + int ret = 0; + + if (rte_atomic16_read(&hw->reset.resetting)) { + hns3_err(hw, "vf set vlan offload failed during resetting, " + "mask = 0x%x", mask); + return -EIO; + } tmp_mask = (unsigned int)mask; /* Vlan stripping setting */ @@ -1157,13 +1164,13 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask) rte_spinlock_lock(&hw->lock); /* Enable or disable VLAN stripping */ if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP) - hns3vf_en_hw_strip_rxvtag(hw, true); + ret = hns3vf_en_hw_strip_rxvtag(hw, true); else - hns3vf_en_hw_strip_rxvtag(hw, false); + ret = hns3vf_en_hw_strip_rxvtag(hw, false); rte_spinlock_unlock(&hw->lock); } - return 0; + return ret; } static int -- 2.23.0