From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730078.outbound.protection.outlook.com [40.107.73.78]) by dpdk.org (Postfix) with ESMTP id CB5992BC9 for ; Wed, 18 Jul 2018 17:06:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RFduAR5KB49+cO6b86WFvR5SSXdexFiOrAPOUk+jPlI=; b=liNSAZ6HFGfZJErJdGlZylkaJu13YvS8aCQ+6L7vrjulE9ENi9sI8+unZIvqlj4xbIoqDo2b6qcfVgCRTqzvAZbKW1KY53FzLqxPhswP3aVzpRtAlj5UQyvHAPLhcl0nH7sBiZyIPuGXbMpq0mEzZSQw1cbXm+qBGJw25Hf0uhA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by MWHPR07MB3471.namprd07.prod.outlook.com (2603:10b6:301:63::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Wed, 18 Jul 2018 15:06:01 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, rkudurumalla@caviumnetworks.com, ferruh.yigit@intel.com Cc: dev@dpdk.org, "Kudurumalla, Rakesh" , Pavan Nikhilesh Date: Wed, 18 Jul 2018 20:35:02 +0530 Message-Id: <20180718150502.19162-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718150502.19162-1-pbhagavatula@caviumnetworks.com> References: <20180701164637.978-1-pbhagavatula@caviumnetworks.com> <20180718150502.19162-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR0101CA0056.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::18) To MWHPR07MB3471.namprd07.prod.outlook.com (2603:10b6:301:63::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79348a17-4dab-4a88-e68d-08d5ecbffb2a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3471; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 3:K+ptNimuxHzFPaVjTkr7teeNBrOYSXWy2k8V1CwWnfxO3tT8Y7vyAeYYWDgwgiVs5arTeM/jDYBnJAHYYEH6he3Re6ZjD06mb2U+RnAmXmLHJqROKdgwk1MyyLK4IrpzSceNHhDWHqmXbTUtIZQO/xdvDPpXFp3xoiQInDrlPL2yAqBH9tTCbKm+hqF0vzkwppE0EsH+GjgvFOfuYcDPkaR9lewK4grbm2SYRQR7xKMVOBJQWPUFEfcUcxOG7mX3; 25:ZLB9Gzzng1toxy3ifFeJs8FVFNNq+DlAGYlyx/DH661PdObsy0lKpeARxRa5Nu4OscCTvxS4Jvyb1gvDbkIDcnUNRTq8MfJr8cTUVjla+WEeSmp1Q5ob9gqP07pJ3zVbLFrZloLWcPo2A6CV99E5sBkcfOEow+6rM4VoVtQdJBGHN3RlUV0SQ/0Q9TtAY9OPJJQnclEJGX7xcGPcb3Hd5wYojD5I+4jDtWsRkfNMcSch0wijf2Md4G/UVmkOkCmmANQhQxg6BWnx//Lkoc+2J5F9JCjyMiH1FeVbwEc+QA+IKHZn4G6YyRNuUaJKuxW25G8YAp5LbusPyTOQQ4FJxQ==; 31:t6phDrM5H6OHY2gi9KLmyR8lewsps3p87A8yDiXfKrIJCHhQhRjjrd6mm1ZzhNjoO+1zMoRqOg7TfbSGRxzV7c2o0lFpvb+f2vtZgBJpWtIxv1UtupsKyW9ITEPoplV0C0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X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:MWHPR07MB3471; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3471; X-Forefront-PRVS: 0737B96801 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(69596002)(5660300001)(36756003)(105586002)(316002)(7736002)(48376002)(6486002)(25786009)(305945005)(53936002)(11346002)(6512007)(4326008)(3846002)(1076002)(107886003)(6116002)(54906003)(50466002)(53416004)(14444005)(16586007)(8676002)(72206003)(478600001)(68736007)(81166006)(81156014)(47776003)(106356001)(8936002)(76176011)(42882007)(6506007)(66066001)(52116002)(956004)(2616005)(476003)(386003)(446003)(51416003)(16526019)(5009440100003)(26005)(1857600001)(50226002)(2906002)(486006)(97736004)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3471; H:ltp-pvn.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3471; 23:V7gowq4EdKhYUO7Xvb6wnaSZQE4kXHo0Of9wAbX1s?= =?us-ascii?Q?72rJqLb4NbF/mPqjED3sTrkGli7tOIxeVwBQZQWNGbnxQgsmCbrFbJfSvtbn?= =?us-ascii?Q?3SoWSgNqu2NkvAYuUe62pP7zqDgGX/h9tAXFI2xcMPDL44iOqNCQ/cFCKK5y?= =?us-ascii?Q?aaGY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2YBJxVlhQIWpkHiig7?= =?us-ascii?Q?BVcIwK5DswqEEf4rnIav8DefwiF/vgSKSnshd77epiyqGbJBzl36gPWekUh8?= =?us-ascii?Q?9du7vsgERi1DWOr8hsZnxYDTRx1KJEM9hS4u66VUUw1uri3XKxLK3WwgovBd?= =?us-ascii?Q?4TXlOMyRq6LJ85ChjUR5Ab6fx1h6Yexy2VDw9XmoME1C4OsKF1Kf4UhK3dxM?= =?us-ascii?Q?9yxLJCwS7snbB+mLZdiQ7r92vgYhsaeBa0nElNdnOuhln9FN5yaDa746whZY?= =?us-ascii?Q?Dn+N5s6VEkFbBp2/OPRABYrxTfpqSB41PTxKnSUi9hx?= X-Microsoft-Antispam-Message-Info: gKdO8RURbQOyP89G37LL1afTQAWjQs8ElSF2Dg/XBmSH12FTTTGZstPJ32PHmARZ4HH5DG/S5UoMZh9In4ZUtsJK4vT6TZ1WzC6VkDsTzaFsuuCi8qE7SqsDV9NYal3PPuUgbxWh6hH4eIBEcVEjprpmjwKdXeA0aFRQmi3AkOxwNtTwyNke8FLaIYESAciYh3uYtMSWkQBj1u6bBkUktbLmg2J/DSE3V7D7lFCXi5wWSViiNzvSHhHZU78R5BRYH016iAe2P0pXrnX5hta72Daes0znLFgnBdgFEkdvHoz8t9LDJxJPr1JQyycE8Ovw7eP07Oxix44EWQehbzS+13nsov9oetUfeITE0rhNoXs= X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 6:Hv+Nh0PGBx0f6JaMMN/A6Um/RKzHoF5bsBSIqOSOg2nSSyMjUlFnLw6u/W10TuMUwOkJHPvf9tNG3gpyMosOuSYO+Tje/94m+9jePYbbFjmUon0oKQN8V+3wcRgDq6f5eaUyC7bxAFFyWSYA3LHZAATZdU9fSvVsaYbs2QT6Ms/dN8XwSx0GGlfWsKGtxBa7aVZGM7xE4YR0/8+64E4KFe7J2CbJYlx1dMEK46khAke5yCu0q5HQzAEa5wp+1ZULhjN4cmwnOHGNczWUgD21Fz2sTAi8YgkN+222NdNZCsDT2ioZiLS0EEuoioUUpCXVltLYgBnR2hGsi3Hz7zm6GNXDeNv2Svy4N5GqGKQ7cRUha34zDtc1VdXhPgFy6W0/sqnBJT+/22EbuglTrBJsPdZq3TZFLRavJrL0UGTpKwj95xr/GsD3OQRqPdvJ/tXg3Auk9Msl4OLKKv/d1at+Pg==; 5:jVH4EAXcC92F1iORp+H/AQvZy0XkibDFRl2NVY+qqFw9orbLd+t3HUysN6Lepj5piTWHDyKItvOJNHqUExwhB67UU0d6QD6MfzM5mxVSndas0lumK7oSgHAgC5k/vaTE2lLQC4BpukQKVtu2d4/O7euDAYRNOqNJDa6+23wMaT4=; 7:D/9uhEKwtxliTFMrYusVAqQtYcHpFKyWggc17GspUKxcYizICwpHR94tbPXAnIVFJYJOOAYrPqZSDmlihZK3xiqlq7mjbCxZ/ZOJP7MzhgJZzPotWIRj10RjggS3pmqRR+entl2q5W8i0mM9S2w9UUv6xVNpNfpygYY4AmC7d9O6zs4l2LSERwn5yk8Pn5kAb+JqqvSr2z6XpsH155uJ7sTYwlSo7YjPgYWrq4AJV/he8XiwFnGKSKVkGuoF3A0l SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2018 15:06:01.5844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79348a17-4dab-4a88-e68d-08d5ecbffb2a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3471 Subject: [dpdk-dev] [PATCH v3 2/2] net/thunderx: add support for Rx VLAN offload 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, 18 Jul 2018 15:06:07 -0000 From: "Kudurumalla, Rakesh" This feature is used to offload stripping of vlan header from recevied packets and update vlan_tci field in mbuf when DEV_RX_OFFLOAD_VLAN_STRIP & ETH_VLAN_STRIP_MASK flag is set. Signed-off-by: Rakesh Kudurumalla Signed-off-by: Pavan Nikhilesh --- drivers/net/thunderx/base/nicvf_hw.c | 1 + drivers/net/thunderx/nicvf_ethdev.c | 54 ++++++++++++++++++++++------ drivers/net/thunderx/nicvf_rxtx.c | 47 ++++++++++++++++++++++++ drivers/net/thunderx/nicvf_rxtx.h | 9 +++++ drivers/net/thunderx/nicvf_struct.h | 1 + 5 files changed, 101 insertions(+), 11 deletions(-) diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c index b07a2937d..5b1abe201 100644 --- a/drivers/net/thunderx/base/nicvf_hw.c +++ b/drivers/net/thunderx/base/nicvf_hw.c @@ -699,6 +699,7 @@ nicvf_vlan_hw_strip(struct nicvf *nic, bool enable) else val &= ~((STRIP_SECOND_VLAN | STRIP_FIRST_VLAN) << 25); + nic->vlan_strip = enable; nicvf_reg_write(nic, NIC_VNIC_RQ_GEN_CFG, val); } diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index eba05fdf0..a55c3ca66 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -52,6 +52,8 @@ static void nicvf_dev_stop(struct rte_eth_dev *dev); static void nicvf_dev_stop_cleanup(struct rte_eth_dev *dev, bool cleanup); static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic, bool cleanup); +static int nicvf_vlan_offload_config(struct rte_eth_dev *dev, int mask); +static int nicvf_vlan_offload_set(struct rte_eth_dev *dev, int mask); RTE_INIT(nicvf_init_log) { @@ -916,16 +918,21 @@ nicvf_set_rx_function(struct rte_eth_dev *dev) { struct nicvf *nic = nicvf_pmd_priv(dev); - const eth_rx_burst_t rx_burst_func[2][2] = { - /* [NORMAL/SCATTER] [NO_CKSUM/CKSUM] */ - [0][0] = nicvf_recv_pkts_no_offload, - [0][1] = nicvf_recv_pkts_cksum, - [1][0] = nicvf_recv_pkts_multiseg_no_offload, - [1][1] = nicvf_recv_pkts_multiseg_cksum, + const eth_rx_burst_t rx_burst_func[2][2][2] = { + /* [NORMAL/SCATTER] [CKSUM/NO_CKSUM] [VLAN_STRIP/NO_VLAN_STRIP] */ + [0][0][0] = nicvf_recv_pkts_no_offload, + [0][0][1] = nicvf_recv_pkts_vlan_strip, + [0][1][0] = nicvf_recv_pkts_cksum, + [0][1][1] = nicvf_recv_pkts_cksum_vlan_strip, + [1][0][0] = nicvf_recv_pkts_multiseg_no_offload, + [1][0][1] = nicvf_recv_pkts_multiseg_vlan_strip, + [1][1][0] = nicvf_recv_pkts_multiseg_cksum, + [1][1][1] = nicvf_recv_pkts_multiseg_cksum_vlan_strip, }; dev->rx_pkt_burst = - rx_burst_func[dev->data->scattered_rx][nic->offload_cksum]; + rx_burst_func[dev->data->scattered_rx] + [nic->offload_cksum][nic->vlan_strip]; } static int @@ -1473,7 +1480,7 @@ nicvf_vf_start(struct rte_eth_dev *dev, struct nicvf *nic, uint32_t rbdrsz) struct rte_mbuf *mbuf; uint16_t rx_start, rx_end; uint16_t tx_start, tx_end; - bool vlan_strip; + int mask; PMD_INIT_FUNC_TRACE(); @@ -1594,9 +1601,9 @@ nicvf_vf_start(struct rte_eth_dev *dev, struct nicvf *nic, uint32_t rbdrsz) nic->rbdr->tail, nb_rbdr_desc, nic->vf_id); /* Configure VLAN Strip */ - vlan_strip = !!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_STRIP); - nicvf_vlan_hw_strip(nic, vlan_strip); + mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | + ETH_VLAN_EXTEND_MASK; + ret = nicvf_vlan_offload_config(dev, mask); /* Based on the packet type(IPv4 or IPv6), the nicvf HW aligns L3 data * to the 64bit memory address. @@ -1990,6 +1997,7 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .dev_infos_get = nicvf_dev_info_get, .dev_supported_ptypes_get = nicvf_dev_supported_ptypes_get, .mtu_set = nicvf_dev_set_mtu, + .vlan_offload_set = nicvf_vlan_offload_set, .reta_update = nicvf_dev_reta_update, .reta_query = nicvf_dev_reta_query, .rss_hash_update = nicvf_dev_rss_hash_update, @@ -2006,6 +2014,30 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .get_reg = nicvf_dev_get_regs, }; +static int +nicvf_vlan_offload_config(struct rte_eth_dev *dev, int mask) +{ + struct rte_eth_rxmode *rxmode; + struct nicvf *nic = nicvf_pmd_priv(dev); + rxmode = &dev->data->dev_conf.rxmode; + if (mask & ETH_VLAN_STRIP_MASK) { + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) + nicvf_vlan_hw_strip(nic, true); + else + nicvf_vlan_hw_strip(nic, false); + } + + return 0; +} + +static int +nicvf_vlan_offload_set(struct rte_eth_dev *dev, int mask) +{ + nicvf_vlan_offload_config(dev, mask); + + return 0; +} + static inline int nicvf_set_first_skip(struct rte_eth_dev *dev) { diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c index 4980dab79..247c35685 100644 --- a/drivers/net/thunderx/nicvf_rxtx.c +++ b/drivers/net/thunderx/nicvf_rxtx.c @@ -445,6 +445,14 @@ nicvf_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, pkt->ol_flags = 0; if (flag & NICVF_RX_OFFLOAD_CKSUM) pkt->ol_flags = nicvf_set_olflags(cqe_rx_w0); + if (flag & NICVF_RX_OFFLOAD_VLAN_STRIP) { + if (unlikely(cqe_rx_w0.vlan_stripped)) { + pkt->ol_flags |= PKT_RX_VLAN + | PKT_RX_VLAN_STRIPPED; + pkt->vlan_tci = + rte_cpu_to_be_16(cqe_rx_w2.vlan_tci); + } + } pkt->data_len = cqe_rx_w3.rb0_sz; pkt->pkt_len = cqe_rx_w3.rb0_sz; pkt->packet_type = nicvf_rx_classify_pkt(cqe_rx_w0); @@ -485,6 +493,22 @@ nicvf_recv_pkts_cksum(void *rx_queue, struct rte_mbuf **rx_pkts, NICVF_RX_OFFLOAD_CKSUM); } +uint16_t __hot +nicvf_recv_pkts_vlan_strip(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + return nicvf_recv_pkts(rx_queue, rx_pkts, nb_pkts, + NICVF_RX_OFFLOAD_NONE | NICVF_RX_OFFLOAD_VLAN_STRIP); +} + +uint16_t __hot +nicvf_recv_pkts_cksum_vlan_strip(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + return nicvf_recv_pkts(rx_queue, rx_pkts, nb_pkts, + NICVF_RX_OFFLOAD_CKSUM | NICVF_RX_OFFLOAD_VLAN_STRIP); +} + static __rte_always_inline uint16_t __hot nicvf_process_cq_mseg_entry(struct cqe_rx_t *cqe_rx, uint64_t mbuf_phys_off, @@ -516,6 +540,13 @@ nicvf_process_cq_mseg_entry(struct cqe_rx_t *cqe_rx, pkt->ol_flags = 0; if (flag & NICVF_RX_OFFLOAD_CKSUM) pkt->ol_flags = nicvf_set_olflags(cqe_rx_w0); + if (flag & NICVF_RX_OFFLOAD_VLAN_STRIP) { + if (unlikely(cqe_rx_w0.vlan_stripped)) { + pkt->ol_flags |= PKT_RX_VLAN + | PKT_RX_VLAN_STRIPPED; + pkt->vlan_tci = rte_cpu_to_be_16(cqe_rx_w2.vlan_tci); + } + } nicvf_rx_offload(cqe_rx_w0, cqe_rx_w2, pkt); *rx_pkt = pkt; @@ -594,6 +625,22 @@ nicvf_recv_pkts_multiseg_cksum(void *rx_queue, struct rte_mbuf **rx_pkts, NICVF_RX_OFFLOAD_CKSUM); } +uint16_t __hot +nicvf_recv_pkts_multiseg_vlan_strip(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + return nicvf_recv_pkts_multiseg(rx_queue, rx_pkts, nb_pkts, + NICVF_RX_OFFLOAD_NONE | NICVF_RX_OFFLOAD_VLAN_STRIP); +} + +uint16_t __hot +nicvf_recv_pkts_multiseg_cksum_vlan_strip(void *rx_queue, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts) +{ + return nicvf_recv_pkts_multiseg(rx_queue, rx_pkts, nb_pkts, + NICVF_RX_OFFLOAD_CKSUM | NICVF_RX_OFFLOAD_VLAN_STRIP); +} + uint32_t nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx) { diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h index 72daffb60..a39808cb6 100644 --- a/drivers/net/thunderx/nicvf_rxtx.h +++ b/drivers/net/thunderx/nicvf_rxtx.h @@ -10,6 +10,7 @@ #define NICVF_RX_OFFLOAD_NONE 0x1 #define NICVF_RX_OFFLOAD_CKSUM 0x2 +#define NICVF_RX_OFFLOAD_VLAN_STRIP 0x4 #define NICVF_TX_OFFLOAD_MASK (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK) @@ -93,11 +94,19 @@ uint16_t nicvf_recv_pkts_no_offload(void *rxq, struct rte_mbuf **rx_pkts, uint16_t pkts); uint16_t nicvf_recv_pkts_cksum(void *rxq, struct rte_mbuf **rx_pkts, uint16_t pkts); +uint16_t nicvf_recv_pkts_vlan_strip(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); +uint16_t nicvf_recv_pkts_cksum_vlan_strip(void *rx_queue, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts); uint16_t nicvf_recv_pkts_multiseg_no_offload(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); uint16_t nicvf_recv_pkts_multiseg_cksum(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +uint16_t nicvf_recv_pkts_multiseg_vlan_strip(void *rx_queue, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +uint16_t nicvf_recv_pkts_multiseg_cksum_vlan_strip(void *rx_queue, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts); uint16_t nicvf_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts, uint16_t pkts); uint16_t nicvf_xmit_pkts_multiseg(void *txq, struct rte_mbuf **tx_pkts, diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h index a770e6b54..dd52f38e5 100644 --- a/drivers/net/thunderx/nicvf_struct.h +++ b/drivers/net/thunderx/nicvf_struct.h @@ -88,6 +88,7 @@ struct nicvf { bool pf_acked:1; bool pf_nacked:1; bool offload_cksum:1; + bool vlan_strip:1; uint64_t hwcap; uint8_t link_up; uint8_t duplex; -- 2.18.0