From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by dpdk.org (Postfix) with ESMTP id 36B1C8E59 for ; Fri, 4 Dec 2015 02:05:03 +0100 (CET) Received: by pfdd184 with SMTP id d184so17129886pfd.3 for ; Thu, 03 Dec 2015 17:05:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IXms3zFxMfFv6PPreIApkkIyNpFP+CoiYCILBRWIf4Q=; b=kLR6h0jkMf0OCAf8Vr0EiWaeEjB8Uns3dcj8cFquBN+cwyCCmV18ZHYC0f+5OgIJ41 7sef5G46mA7llEu37CObANjuagFMtY/WVKzrWCAzxvPu9792gBFgYCSfHEtVrDc6YeGX 5twvF5bCSmyuVdiZ0ALpXeKX4AWPZJ6cIKA/fKzvZu8U9h7PtTfFAH5aKNGK4yB3Itj8 ai9CfNXU41+8LUqWfbKeheSiI8YbiOlgtvE73y6qnnIj6cdg2sg3M/RooO0MiW86ByjZ wz5tO9Fn3es+gPZI8dR+jOL4zS2KoUvn29DrDNcSZWfCedBZ2UiadQAOo+gL6KROZhWK o3rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IXms3zFxMfFv6PPreIApkkIyNpFP+CoiYCILBRWIf4Q=; b=XxVgUTONKAf3rFuvVmO5DeCS814OpJ1CQ7t/rcOjZxCegLXvNHAZDgSC3FKDU5/oOv DkvX+9B7uGF9D9rSTh5sWRWO66GfD8Vmar3+hXbYQUg+K5jrUKBBVqFTMp+kXgeWl8H3 6Hb7K3YGgiYKva9ApKgkD3W/xhUQc206J3ppBa6OAN0xYj2GXq+9Txr51lFhevW7i16U I8aeyNw921YaZj4xMwH92mDZt3I86tS86CrJRCDEGKelg1xmzkap+zyeBWabBHC57XRL DRlKvnYd6w52p52syMmSDyGEeaW8Bbxmd9tDaMiKGglv+s6dqRWgJ4aVGGNUgeU45kEc LA2A== X-Gm-Message-State: ALoCoQl0TgsiSKaHAMfHEvxRmogfQdrOriHQTHeThFK3DZTjqN0Oszik8KL8EeGlg8VAmcwBh7jE X-Received: by 10.98.19.130 with SMTP id 2mr17520225pft.93.1449191102634; Thu, 03 Dec 2015 17:05:02 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id 6sm13060124pfm.58.2015.12.03.17.05.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Dec 2015 17:05:01 -0800 (PST) From: Stephen Hemminger To: yongwang@vmware.com Date: Thu, 3 Dec 2015 17:05:07 -0800 Message-Id: <1449191107-14222-4-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449191107-14222-1-git-send-email-stephen@networkplumber.org> References: <1449191107-14222-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Nachiketa Prachanda Subject: [dpdk-dev] [PATCH 3/3] vmxnet3: fix vlan_offload_set X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2015 01:05:03 -0000 From: Nachiketa Prachanda vmxnet3_dev_vlan_offload_set(dev, mask) was incorrectly treating the mask parameter as the bitmask for vlan_strip and vlan_filter, whereas the mask indicates only what has changed - the values for vlan_stripping and vlan_filter needs to be taken from dev_conf.rxmode. Signed-off-by: Nachiketa Prachanda Signed-off-by: Stephen Hemminger --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 45 ++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 2d7bf13..40c4537 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -90,7 +90,7 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void vmxnet3_dev_vlan_offload_update(struct rte_eth_dev *dev, - int mask); + int mask, int changed); #if PROCESS_SYS_EVENTS == 1 static void vmxnet3_process_events(struct vmxnet3_hw *); @@ -521,7 +521,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev) if (dev->data->dev_conf.rxmode.hw_vlan_filter) mask |= ETH_VLAN_FILTER_MASK; - vmxnet3_dev_vlan_offload_update(dev, mask); + vmxnet3_dev_vlan_offload_update(dev, mask, mask); PMD_INIT_LOG(DEBUG, "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -838,34 +838,45 @@ vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on) } static void -vmxnet3_dev_vlan_offload_update(struct rte_eth_dev *dev, int mask) +vmxnet3_dev_vlan_offload_update(struct rte_eth_dev *dev, int mask, int changed) { struct vmxnet3_hw *hw = dev->data->dev_private; Vmxnet3_DSDevRead *devRead = &hw->shared->devRead; uint32_t *vf_table = devRead->rxFilterConf.vfTable; - if (mask & ETH_VLAN_STRIP_MASK) - devRead->misc.uptFeatures |= UPT1_F_RXVLAN; - else - devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN; - - VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, - VMXNET3_CMD_UPDATE_FEATURE); + if (changed & ETH_VLAN_STRIP_MASK) { + if (mask & ETH_VLAN_STRIP_MASK) + devRead->misc.uptFeatures |= UPT1_F_RXVLAN; + else + devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN; - if (mask & ETH_VLAN_FILTER_MASK) { - memcpy(vf_table, hw->shadow_vfta, VMXNET3_VFT_TABLE_SIZE); - } else { - memset(vf_table, 0xff, VMXNET3_VFT_TABLE_SIZE); + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, + VMXNET3_CMD_UPDATE_FEATURE); } - VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, - VMXNET3_CMD_UPDATE_VLAN_FILTERS); + if (changed & ETH_VLAN_FILTER_MASK) { + if (mask & ETH_VLAN_FILTER_MASK) + memcpy(vf_table, hw->shadow_vfta, VMXNET3_VFT_TABLE_SIZE); + else + memset(vf_table, 0xff, VMXNET3_VFT_TABLE_SIZE); + + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, + VMXNET3_CMD_UPDATE_VLAN_FILTERS); + } } static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) { - vmxnet3_dev_vlan_offload_update(dev, mask); + int hw_mask = 0; + + if (dev->data->dev_conf.rxmode.hw_vlan_strip) + hw_mask |= ETH_VLAN_STRIP_MASK; + + if (dev->data->dev_conf.rxmode.hw_vlan_filter) + hw_mask |= ETH_VLAN_FILTER_MASK; + + vmxnet3_dev_vlan_offload_update(dev, hw_mask, mask); } #if PROCESS_SYS_EVENTS == 1 -- 2.1.4