From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by dpdk.org (Postfix) with ESMTP id DD5E63DC for ; Wed, 8 Mar 2017 16:16:04 +0100 (CET) Received: by mail-wr0-f177.google.com with SMTP id u48so25598136wrc.0 for ; Wed, 08 Mar 2017 07:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:in-reply-to :references; bh=pRfOwv6zt1Vn1vVJ+EnzD4SQa5UVRCG/JlKauQENyeY=; b=02ZQ9q6u/aTakqWpue4WP7CXLVcOFFSuPGQCZVI531orSKYBJ5yfx353xsJZR4bPxJ 6Tso/MYQ7gdvWQ/g8zMWk+yxqFh/+Ls8/AHtr91pZjOgLL/Lus5+BvCQeSHht5/kD6XP yTWjnmX6CW3OspiCklrFMzEbxj6aswNX9W42ZeLEzH1CyRGEWVAiKZlBG0CeUHhFil7x W7X7a4EpM5xUm0hQlpPLKHkjOaqbZMWq1kn9Pjyqf1QeTNGEtSyiSyi+1xeL4dtoCIsp 7SuoJSyRdSWZQiIOjaTGyrwsf9JJ5B8RUQa6RfRW/21+9Y7xzYZqr8G5GcW5yzwCG2Mn qVPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=pRfOwv6zt1Vn1vVJ+EnzD4SQa5UVRCG/JlKauQENyeY=; b=S8C0lodvrh2pX+HoJbO6cSO5ezd5rePIskvNO7PgRr9M1vj2WD02eaVtz7yUi8goFB 1ml9A+l8yyUpnVgUZOQOHUsSG9gFG6gtDJyu1CK4NrPQC2LdCKPo9RnArrf6xFhIOyZx l8MtAbiLwY7kGzKUe/8topsT8Bauc+K/HBn5uJrPuqev7V3a5Bq0ZJu5Y2eiAbpDzm0z KyOhMDQKANg9ywi/KGOs8/Eod5pV87+v7y1A+Ry6H1ThtL6y8z1RFj4ocPVzuofpD/HK OALNHsCYFD2dGcIuD3wtAgYVaLXpixcAhx548cVEKKY5K82pcWrriyysqdrZ46/mJLAE w58w== X-Gm-Message-State: AMke39mGnPGbcTqjTBKl4gYOMkxTxSMT55Q17QbxdxkezK2WqUP4UXMkLXBr4AswkN6vpL/F X-Received: by 10.223.175.238 with SMTP id y46mr5578526wrd.63.1488986164264; Wed, 08 Mar 2017 07:16:04 -0800 (PST) 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 t103sm4553592wrc.43.2017.03.08.07.16.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Mar 2017 07:16:03 -0800 (PST) From: Gaetan Rivet To: dev@dpdk.org Date: Wed, 8 Mar 2017 16:15:34 +0100 Message-Id: <43b23f2977d5401004d649bd3a98e64dfa66420f.1488985489.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 v2 01/13] 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, 08 Mar 2017 15:16:05 -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 6c4b796..61a63b7 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1764,6 +1764,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]; @@ -1779,7 +1780,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 ed99660..f01d140 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -375,6 +375,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 @@ -1716,6 +1724,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