From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id BF2C5995F for ; Thu, 25 May 2017 11:51:19 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 May 2017 02:51:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,391,1491289200"; d="scan'208";a="91624366" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 25 May 2017 02:51:04 -0700 From: Yuanhan Liu To: Wenzhuo Lu Cc: Yuanhan Liu , dpdk stable Date: Thu, 25 May 2017 17:48:28 +0800 Message-Id: <1495705809-21416-56-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1495705809-21416-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1495705809-21416-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-stable] patch 'net/i40e: fix VLAN promisc setting' has been queued to stable release 17.02.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 May 2017 09:51:20 -0000 Hi, FYI, your patch has been queued to stable release 17.02.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/28/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 6af8f925d21abc0187f65437189bc2ea6a06496a Mon Sep 17 00:00:00 2001 From: Wenzhuo Lu Date: Sat, 1 Apr 2017 14:15:57 +0800 Subject: [PATCH] net/i40e: fix VLAN promisc setting [ upstream commit 974fd9991a3f8cc329252eba1127381db35beca4 ] After adding VLAN filter, the VLAN promiscuous mode is disabled. But there's no chance to enable it. So add the check after deleting VLAN filter. If there's no VLAN filter left, enable the VLAN promiscuous mode. Fixes: 9f0645cd147c ("net/i40e: fix VLAN filter") Signed-off-by: Wenzhuo Lu --- drivers/net/i40e/i40e_ethdev.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index a3f8514..c4b9d0e 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -11101,6 +11101,32 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on) return ret; } +static int +i40e_vlan_filter_count(struct i40e_vsi *vsi) +{ + uint32_t j, k; + uint16_t vlan_id; + int count = 0; + + for (j = 0; j < I40E_VFTA_SIZE; j++) { + if (!vsi->vfta[j]) + continue; + + for (k = 0; k < I40E_UINT32_BIT_SIZE; k++) { + if (!(vsi->vfta[j] & (1 << k))) + continue; + + vlan_id = j * I40E_UINT32_BIT_SIZE + k; + if (!vlan_id) + continue; + + count++; + } + } + + return count; +} + int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, uint64_t vf_mask, uint8_t on) { @@ -11118,7 +11144,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; - if (vlan_id > ETHER_MAX_VLAN_ID) { + if (vlan_id > ETHER_MAX_VLAN_ID || !vlan_id) { PMD_DRV_LOG(ERR, "Invalid VLAN ID."); return -EINVAL; } @@ -11152,15 +11178,25 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, if (on) { if (!vsi->vlan_filter_on) { vsi->vlan_filter_on = true; + i40e_aq_set_vsi_vlan_promisc(hw, + vsi->seid, + false, + NULL); if (!vsi->vlan_anti_spoof_on) i40e_add_rm_all_vlan_filter( vsi, true); } - i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, - false, NULL); ret = i40e_vsi_add_vlan(vsi, vlan_id); } else { ret = i40e_vsi_delete_vlan(vsi, vlan_id); + + if (!i40e_vlan_filter_count(vsi)) { + vsi->vlan_filter_on = false; + i40e_aq_set_vsi_vlan_promisc(hw, + vsi->seid, + true, + NULL); + } } } } -- 1.9.0