From patchwork Mon May 29 13:42:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 24860 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E94157D22; Mon, 29 May 2017 15:42:53 +0200 (CEST) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id D73E07D02 for ; Mon, 29 May 2017 15:42:47 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id e127so61285474wmg.1 for ; Mon, 29 May 2017 06:42:47 -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:in-reply-to:references :in-reply-to:references; bh=oXbiBwGMnioBxzWQi7NNYMDD8tU10osyJcwwK+estYU=; b=Dk3jLYY53RsCmTqdVxEJgO/0RkNEhMHREgbuIt43dJOYgA5iCSZ+jVw95Q7TvHgCE5 sNz9DpyVvZtM6ZhxuPZOBG445XeevNUb8MQtMyxvhhPfjeYdMx6jZHIYVwnW8lR6m8jq tNL9r/nEcYG0/vIFt7FZic8m5cvP4oyNKle2iIQplY6SWCUS6CRoqNKBJdalw2ekVrFs sEGc5AqNK206xMri1sLQ4FLUDe2qR7txo6CukMPNDW8iRL0cpssQbDFcWOm8Qu+Pri/s eiUEkOroq+Kn33OKewS1sO6uoVHIrud8spsMbu23e4hhdOfPOVZS5mcUNObtIC5BFKhm y9Vw== 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:in-reply-to :references:in-reply-to:references; bh=oXbiBwGMnioBxzWQi7NNYMDD8tU10osyJcwwK+estYU=; b=lqTOXRETASCYfGpyiu7HyyH/rrPJBENcxEFBU0YpV4AXkoVtYFHVQjBxyW80yI6y1b oeR4umKwlTNj7FPS0JMFtOXeySL0UzjXtMXKY69faeIEhwBq7Xkz/2qoWEHezq9dX0GT kXdUNuyDSQveEVufvHbaHNDNdwJVS0yoC5UnMsOS1eKgnbAWTSb6H50U6ZU3tHonu3Lw Bo2ZaikMemraB/QKOh2r3zc3ph+6L8sdM/pcxFnWLekbuPilPTbT43ZMA4T5LMcw4ZkQ rdhG/Aksh7if96/reAOt3FXRocNHHnoKhr7bKli7p1o9huE8Fg/3WWVXxOmDZNg2guAQ iU2w== X-Gm-Message-State: AODbwcDFyUCuU/72d9fh4rXrqGcojE4s5Nvx161OAG9JAiSRKFnH3YeP 6+2CCKjPZR0QM0Njprk= X-Received: by 10.28.129.139 with SMTP id c133mr9740607wmd.14.1496065367213; Mon, 29 May 2017 06:42:47 -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 l8sm12906671wmd.8.2017.05.29.06.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 May 2017 06:42:46 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Mon, 29 May 2017 15:42:13 +0200 Message-Id: <31578aad5404f554a597dce2e86159252ec64f95.1496065002.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 01/12] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Other configuration items (i.e. MAC addresses) are stored within rte_eth_dev_data, but not this one. Signed-off-by: Gaetan Rivet --- 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 ff4f5ab..c8c5e73 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1976,6 +1976,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]; @@ -1991,7 +1992,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 0f38b45..33cc48c 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 @@ -1738,6 +1746,8 @@ struct rte_eth_dev_data { enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ int numa_node; /**< NUMA node connection */ const char *drv_name; /**< Driver name */ + struct rte_vlan_filter_conf vlan_filter_conf; + /**< VLAN filter configuration. */ }; /** Device supports hotplug detach */