From patchwork Fri Jul 7 00:09:19 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: 26598 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 44B8E7CDA; Fri, 7 Jul 2017 02:10:32 +0200 (CEST) Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by dpdk.org (Postfix) with ESMTP id 762005A6A for ; Fri, 7 Jul 2017 02:10:08 +0200 (CEST) Received: by mail-wr0-f170.google.com with SMTP id c11so24291219wrc.3 for ; Thu, 06 Jul 2017 17:10:08 -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=EFeWDOPftPQuUPuuYCuqi0HHWx1XXlkFlGrLHgVnFtU=; b=Wo+H28+X8K6fEeYY21RPC1pXkKuuDeLhfMQYw5hhqTi1l+pP6+LbuS9ES5Vy5M/hUj e+uOV5QWu2WT5P4NzJtDNGMbX8OIyzwzTz3XIkdelL8gPNXRraEBnt1OAhStuAv/3qkc unY9E1u+sNwCFjvq+R4rnF/cgHH/ULi1IhQyAqvYhscggBPL7G6XFpeUyXlGP0fWHCvT HHjXnkc8N9aFuXz0uxeJektFZeLCG5l5oh74uLR5yhP8W+JBEbsFEqBYipxqTz+GrYb7 61Q0SjPfYZr90aaXWe3e/uiy7t1wNAkT/gPu4F3T2hCtP31SCxVHEwVekAEMdTByZoD7 BPrQ== 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=EFeWDOPftPQuUPuuYCuqi0HHWx1XXlkFlGrLHgVnFtU=; b=s8zFTdwmTg6hZiXs02O2IDI3KQ/EVsswtZ6HChiqWf368oR01HjtG6ZQkhFeqLeJvc jUGs5REA+FvCTGJxriSfgK5r7Er3TB+b1HL//2Hqsk8XXIMGh1xjGzFejnXajNvN3Qh+ Dx1A1kRGD6r3mEK+efMU1WSKTflIQEfh4Utn++O0uRbWiY/S59r17NWQV246MB1NyXPo xYAVOecw/WjvtIjDl2dX4XsnynuVMffbUSbI0yBgNNua9r0RtwbWyFPNqApYlCwdVa+2 BWCLhcagMdBfY6CHaV2wx60xzJa+OoqkGRo+sFWdvzffLPpnwBRIEs/C0uaq+kBhlcDT LHKw== X-Gm-Message-State: AKS2vOwsEYxdFMQul8cEzB96p1h/xqfr03FOzK+2UdmWtPgdN3ySr7fr 3QKbEUo8gn/A9eRv7I8= X-Received: by 10.223.151.51 with SMTP id r48mr44674780wrb.189.1499386207920; Thu, 06 Jul 2017 17:10:07 -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 f45sm2391166wrf.2.2017.07.06.17.10.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:10:07 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:09:19 +0200 Message-Id: <4915aafabece426d28651906f0fbfbf721aa3479.1499385282.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 v6 11/22] 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 957ae2a..38c5ad4 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 d1076c8..acbbbb6 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 */