From: Chengwen Feng Date: Thu, 26 Mar 2020 07:14:33 +0000 (+0800) Subject: net/hns3: fix return value of setting VLAN offload X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e7f4213c304bd8d71fc3ca7702c85c434eff0805;p=dpdk.git net/hns3: fix return value of setting VLAN offload 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 detection 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) --- diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 08ae58a794..07f5ab6379 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