From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by dpdk.org (Postfix) with ESMTP id AF45E3250 for ; Sun, 9 Jul 2017 03:45:00 +0200 (CEST) Received: by mail-wr0-f182.google.com with SMTP id r103so93856734wrb.0 for ; Sat, 08 Jul 2017 18:45:00 -0700 (PDT) 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=1u7xpB4uEgS3hXYEy0857Qf3nFsPJOHT0KXfajjLBtg=; b=sy0ORKCuivy95BtTtBUXu1/DYEvjfiE+1ECi53dAYicQ4mT98V6qbA3K5FYviLdT+i yO1s/17z4lc48/C/L+DyJI0KLWRR4tCPqZYY13yR2ERgaGBaR9Q2CJ15hg8ir2/NU7dr Ys0BWWiH+lQsKCCaXvi5xYnGrJKtM3OJw8N7BGeG7bfx//jekZ57ealRyTK2I7U7zKUf h+Qa1lXy9qonEIbcdA2s7UZ7rawk/jeKLF/OzgeUyIh1vciCE/oScyXtyyefYaahrR9G 1U+dRvnwoVzJ2VA9immd0qnSavGbeTTOCzHGHJwTFslAkgE7vgNZVCAxR4sTtFTa6SzS d8Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1u7xpB4uEgS3hXYEy0857Qf3nFsPJOHT0KXfajjLBtg=; b=Y2V+ltKjAt1ZTt9dyL/dQ1NBb+g+3Se1qSvgM7w49JU5+SZmQW5uop2GxQJtdObEHi 848DWISU+Xk0FGh2/aLCFyyNMvv3j4UKVVBzMi5yb7hqNM3X1Z0c2SMlnunUPUBadVSf DB4RqdstW0ypiZDI6J6SGXKp/d7zsWbXIX9fQzhvIleCHBXWX8rOvK16qfLJ4rbWdIFj k8XOHhQz5ZkkUHJtr2R3oetOFhcVekdOKIFDn01N/pqPGS7gMkcuFMtiNOJBVPtVV3GU hmUowhh84xgr3A5d5ldDGR7/49bCNUT4R+6uWmYIph1i9VqF0kRUD7wqIRvzoEfXb0BG ko1w== X-Gm-Message-State: AIVw112t3FLhsI9C9cJAD8lby4cobrOU2aEmzQAp47ywlmdxBO5TMJaM Mx0dBHlaUiqx+ZIMwXw= X-Received: by 10.28.153.21 with SMTP id b21mr3355090wme.96.1499564699948; Sat, 08 Jul 2017 18:44:59 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x21sm5170803wme.24.2017.07.08.18.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Jul 2017 18:44:58 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Sun, 9 Jul 2017 03:44:45 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] ethdev: save VLAN filter setting 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: , X-List-Received-Date: Sun, 09 Jul 2017 01:45:01 -0000 In order to be able to replicate a configuration onto a second port, device configuration should be fully described and available. Other configuration items (i.e. MAC addresses) are stored within rte_eth_dev_data, but not this one. Signed-off-by: Gaetan Rivet --- I'm removing this patch from the fail-safe series, as it stands on its own. lib/librte_ether/rte_ethdev.c | 19 ++++++++++++++++++- lib/librte_ether/rte_ethdev.h | 10 ++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 838ace3..76179fd 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1981,6 +1981,7 @@ int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; @@ -1996,7 +1997,23 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) } RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP); - return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on); + ret = (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on); + if (ret == 0) { + struct rte_vlan_filter_conf *vfc; + int vidx; + int vbit; + + vfc = &dev->data->vlan_filter_conf; + vidx = vlan_id / 64; + vbit = vlan_id % 64; + + if (on) + vfc->ids[vidx] |= UINT64_C(1) << vbit; + else + vfc->ids[vidx] &= ~(UINT64_C(1) << vbit); + } + + return ret; } int diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 5093436..93182b8 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -374,6 +374,14 @@ enum rte_vlan_type { }; /** + * A structure used to describe a vlan filter. + * If the bit corresponding to a VID is set, such VID is on. + */ +struct rte_vlan_filter_conf { + uint64_t ids[64]; +}; + +/** * A structure used to configure the Receive Side Scaling (RSS) feature * of an Ethernet port. * If not NULL, the *rss_key* pointer of the *rss_conf* structure points @@ -1674,6 +1682,8 @@ struct rte_eth_dev_data { uint32_t dev_flags; /**< Capabilities */ enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ int numa_node; /**< NUMA node connection */ + struct rte_vlan_filter_conf vlan_filter_conf; + /**< VLAN filter configuration. */ }; /** Device supports hotplug detach */ -- 2.1.4