From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 7772E7CF1 for ; Wed, 24 May 2017 17:20:22 +0200 (CEST) Received: by mail-wm0-f43.google.com with SMTP id d127so71772790wmf.0 for ; Wed, 24 May 2017 08:20:22 -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=LoFWxR6Mb+kWujIjf+zkf6FTvaOvyXG0B97Lwe6jU8cEoXeXeIOQkxw+T9qjs5dOw/ iOilqypsO+eNc8AfLx1FgRXKsmL7sn689AYU3OhUle7ry6TX+qylY2tv0UOB/Vb2MVc1 OMjMo6WZldIOTNtbWk+vQ4N9VmyWDZpqQgIKmScpXwyXiNDKxDYasch15lLd9t4H4Vl3 9wyTiqkaCPM2wAy0rK87BYNnW7xGSC6LGZ/AhRmyi9YCt2hUNteWLi5QvqJ00lxKCPtU xuB1sQUqdosB1y1qlUDfrl6P/7OQ8dr3dGjiOVv0S78D45qTGDSaxqFs3tGUdekANPX/ bR3A== 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=Q6dubY9QbXyZYrHjWEkIjLcr1V9goixNfbCb4TEkJziM/RptyHqojh3wdnM8hQCnrn OteJKjDX7IdQXkYNt1FrPUsygWrvO4OK6X4G6XH2X4xX/J90We+PvUOKw9eLY8KpJYgE EviWvuDvaTxPQfipZfUlRBaGV6OV1g92iMYe1stC0+jGJlZeOUb5p8rHDmZ0Ai2SHZmn LYwbk6npxgB6iesdjNxJINcq8eT+3vGBEua8eyZyCb8x5k/6gdaHyy4Sy1pMBDKzEux2 LI8I+DaS0siuDpY4FMAU9UM0Nd4jTPt2pnm3CZsAQG+pIb2JthegWeIa3olJnNZ1hImQ gmew== X-Gm-Message-State: AODbwcBA/qLqZiS3OWNol+6B9LeXR1Ly+4pko7JweB5Ji07sgL7LaOgu nGkgCDV3uMhdOQWp X-Received: by 10.28.91.80 with SMTP id p77mr6322216wmb.84.1495639222198; Wed, 24 May 2017 08:20:22 -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 t85sm5444271wmt.23.2017.05.24.08.20.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:20:21 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 24 May 2017 17:19:59 +0200 Message-Id: <9cacb7709fe2029153cc58b8cec964beab86d62c.1495634974.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 v3 01/11] 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: Wed, 24 May 2017 15:20:22 -0000 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 */ -- 2.1.4