From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 991D05A62 for ; Mon, 18 Jan 2016 18:18:56 +0100 (CET) Received: by mail-wm0-f48.google.com with SMTP id n5so74468432wmn.0 for ; Mon, 18 Jan 2016 09:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=3nuawvJuguS3/JwaVpedSKrXd4WisdzIFPzY0SbPybQ=; b=MoBn1sVTtsmLcOTIS9o9Okl9Z5A0lDj5XC8Ts5vqJQzvMHeEcP1efBg396lIq6ktdZ UyItCu4l0exsWZERQ0uo1zqPipbL7URpjqD8v8L3V6owRgNkjnf0Rxc3zHWbqaGUhYAi ypePO8LB2Lv4K+oH+v20mCibvQQX2oTfaIvRo64ra7yRU93FPuDVAANw6YuSNSVvD4rX P7bA5EC2vlFBcwh1t9rX6rmE5tZuVEZ5U6TObKby16VcKs6azQoQTU0w1a2TeCvSTezi KpWMNG4nE4UMN+jlB4IvAKFipEkTSl3ObpFm4DP8wK9svdzWnbRGeau6an59olZRk38j 2b8g== 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; bh=3nuawvJuguS3/JwaVpedSKrXd4WisdzIFPzY0SbPybQ=; b=RotIhxSt2/1wGMBZq7YY79i62eBXjTrRzdfIQYvoqjiFBAAImmzIUQ/UvcpU69p8gk iqD3y5aNRJknaNbLTs5ZYhizovn6yBjqN+QBtQmJ6VdXdTN7ulcjI9bZORToGyiCtw6t XnvjBbD55+FwUyiJ0WNZJn5QWGKGnOiTiyg0wqV23WBytTJQDpggpiLa9kU6pbfWPmbr cnTxMa8cpq4RW5qgFlCiXDD8ttrD4gg4TH2RybGHyS1MPIealW9slIS8s28vGR2RCLhl wJffDn50Af3eGVPwVwQYGz/poEVoyn9mj9U/rkEaSW3rprUC4FEFW7F9f2DDiyHc4+/e BO9A== X-Gm-Message-State: AG10YORY3lGxavwuJnrLEerQnE7w0auhX9Lp2kKZrEx0j2DPuYKW0J7DNDy8dDYVppLY1+F1 X-Received: by 10.28.15.210 with SMTP id 201mr13588394wmp.79.1453137536443; Mon, 18 Jan 2016 09:18:56 -0800 (PST) Received: from grendel.vm.6wind.com. (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id lh1sm24574496wjb.20.2016.01.18.09.18.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Jan 2016 09:18:55 -0800 (PST) From: Julien Meunier To: helin.zhang@intel.com Date: Mon, 18 Jan 2016 18:18:35 +0100 Message-Id: <1453137515-19195-1-git-send-email-julien.meunier@6wind.com> X-Mailer: git-send-email 2.1.4 X-Mailman-Approved-At: Tue, 19 Jan 2016 08:36:37 +0100 Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH] i40e: fix vlan filtering 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: Mon, 18 Jan 2016 17:18:56 -0000 VLAN filtering was always performed, even if hw_vlan_filter was disabled. During device initialization, default filter RTE_MACVLAN_PERFECT_MATCH was applied. In this situation, all incoming VLAN frames were dropped by the card (increase of the register RUPP - Rx Unsupported Protocol). In order to restore default behavior, if HW VLAN filtering is activated, set a filter to match MAC and VLAN. If not, set a filter to only match MAC. Signed-off-by: Julien Meunier Signed-off-by: David Marchand --- drivers/net/i40e/i40e_ethdev.c | 39 ++++++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 1 + 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..ef9d578 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2332,6 +2332,13 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi = pf->main_vsi; + if (mask & ETH_VLAN_FILTER_MASK) { + if (dev->data->dev_conf.rxmode.hw_vlan_filter) + i40e_vsi_config_vlan_filter(vsi, TRUE); + else + i40e_vsi_config_vlan_filter(vsi, FALSE); + } + if (mask & ETH_VLAN_STRIP_MASK) { /* Enable or disable VLAN stripping */ if (dev->data->dev_conf.rxmode.hw_vlan_strip) @@ -4156,6 +4163,34 @@ fail_mem: return NULL; } +/* Configure vlan filter on or off */ +int +i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on) +{ + struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); + struct i40e_mac_filter_info filter; + int ret; + + rte_memcpy(&filter.mac_addr, + (struct ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + ret = i40e_vsi_delete_mac(vsi, &filter.mac_addr); + + if (on) { + /* Filter to match MAC and VLAN */ + filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; + } else { + /* Filter to match only MAC */ + filter.filter_type = RTE_MAC_PERFECT_MATCH; + } + + ret |= i40e_vsi_add_mac(vsi, &filter); + + if (ret) + PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan filter", + on ? "enable" : "disable"); + return ret; +} + /* Configure vlan stripping on or off */ int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on) @@ -4203,9 +4238,11 @@ i40e_dev_init_vlan(struct rte_eth_dev *dev) { struct rte_eth_dev_data *data = dev->data; int ret; + int mask = 0; /* Apply vlan offload setting */ - i40e_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK); + mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK; + i40e_vlan_offload_set(dev, mask); /* Apply double-vlan setting, not implemented yet */ diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 1f9792b..5505d72 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -551,6 +551,7 @@ void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi); int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi, struct i40e_vsi_vlan_pvid_info *info); int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on); +int i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on); uint64_t i40e_config_hena(uint64_t flags); uint64_t i40e_parse_hena(uint64_t flags); enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf); -- 2.1.4