From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0070.outbound.protection.outlook.com [104.47.37.70]) by dpdk.org (Postfix) with ESMTP id 67166160 for ; Mon, 16 Jul 2018 11:31:18 +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=smrzFTL73GPLuTTcnSQjmLT4MS/xyL5zk3nrRO1M6GQ=; b=V2yvNSu55rt/M3DjBO/APk0wmmBNDl1e2lgqQulBOi5JTra8h8TlHwrAYdlM3yJAsIjSMi7swuGYVCA8c/4f3mQEQQP7A+9Rh2HONQ0aKQOco/gNinFQox4s4D9xSAVdvqKqWFQwPS3Jsfuz62aNf3ykbP5dRKaS7oVgR3l6As4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (12.108.191.226) by MWHPR07MB3472.namprd07.prod.outlook.com (2603:10b6:301:63::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.18; Mon, 16 Jul 2018 09:27:23 +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: Mon, 16 Jul 2018 14:56:57 +0530 Message-Id: <20180716092657.17072-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716092657.17072-1-pbhagavatula@caviumnetworks.com> References: <20180701164637.978-1-pbhagavatula@caviumnetworks.com> <20180716092657.17072-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [12.108.191.226] X-ClientProxiedBy: DM6PR08CA0007.namprd08.prod.outlook.com (2603:10b6:5:80::20) To MWHPR07MB3472.namprd07.prod.outlook.com (2603:10b6:301:63::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71e2685b-aacb-4420-fc16-08d5eafe5847 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3472; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3472; 3:i6wYKcxLXoDlhnzdN0e3gk91CNX91hrGtrc596LZmjM5zHlJW+fdMEq7N7OcZdpp4lgsi4/gvoLMAo8Wjx15fLm2hA9eT5DBw1qKI/s+8WtDsUBjxNG1F+x6ODFegnQd1Y8WUd56qG0rk6X/WV1iiPdmMJ/x9nzNMv56RwmfKuN9pcUAVV/CAW7+t+n0/41FG48nYaZay+SHKZSapwnV/ZBH3llypq/R6GUHedX2kGw6kquo03L7SlEvXjN4lBHH; 25:n/GIZZLPjUjF8fqLVXLP+/h/ZxRwYAiLsnQOKmAoWfL1+lLJnTf7+tJLSNl+gLnjiWVmaYNK0gnC24hfv4jViEVO7PQqnlfYTRgNZE6nQ1YOHbT6eFsHZ7Rr4SRvgMMY83e+cwN8/OEw7DZhk3xi+p54Su4rfDOKeZc5/WsAD+YWS5twL6fqMBEO/C1uSmDzBkNKFfv4j62hxbJenOioIqsBVrnA10bT9EU/6wmAhP+GtniFXzKHFQ7lYAe4TJV4IzhbNIfOREOwW8g1cExJ11rAd7Yiv/2sLIqPdjHSDRgH4k5sqm3vi0pruRNwWCCC3zoY5w928Cw/s9yvb6wveg==; 31:oYIbUnD0iLgXc12Fdw5hB3TZj7KsYLVOjiTOaGZrDEpULBjQAsiSDx+Mon8wcIhYAhRIN5Qao4TvgS9uVDN4kTpEHRGUBO3dlVGNmE/K3H5QI6uJ1iIktqlnqssR8TzhkTnqbr2hUj5rCZzmi6hqsm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S: 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)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:MWHPR07MB3472; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3472; X-Forefront-PRVS: 073515755F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(366004)(39860400002)(376002)(346002)(136003)(199004)(189003)(6116002)(106356001)(6506007)(42882007)(81166006)(81156014)(8936002)(72206003)(478600001)(386003)(3846002)(8676002)(16526019)(47776003)(1857600001)(105586002)(6512007)(66066001)(52116002)(1076002)(446003)(6486002)(51416003)(26005)(76176011)(97736004)(107886003)(53936002)(5660300001)(7736002)(68736007)(2906002)(6666003)(25786009)(956004)(16586007)(2616005)(476003)(14444005)(11346002)(54906003)(50226002)(486006)(36756003)(316002)(305945005)(50466002)(4326008)(48376002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3472; H:localhost.localdomain; 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; MWHPR07MB3472; 23:10zt8eGKciO/fpj+JMJFhf2lUBEYzDAFis5Ee6RUS?= =?us-ascii?Q?UQal8UUv9JftKxH0cxSIGTfUkHc2phcCBgnA9ikxkjnD1JXoh/49pJQIl/zU?= =?us-ascii?Q?wdeolM0mosmc0/ovIzux9VGMdZixXs0RWxO1qMrGSLmePUhz3Kr3He1tKV5l?= =?us-ascii?Q?ylGqj+5q9N+W/uL31UoO0YtnIDPs8DR/JxVs+O9zRR/q7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k/xiVUtKWWkMghdXJyCy1R2x358aPXKorxztBLqCZhCvpjQX6aLoLFMRI9qj6B/VwHRgJKbZtrvGduvs9EgavcqnmvwTweE4/wntpGRBOsvxaiQ==; 5:kXZIgH2CCZSU1NHpdp731XwEPm0p7KotKkfmxLH7qsVYOcM/ODM1p/ElRI3vNEiQxD9a8PXzfoDddCaF7VxhF2YL3+dbeCntiNLYV/H4SEsCbli0ndwI94S2BJzJyhlepni6o6ZM7ElUB05XcVjM5kJftL1r1UvxgaM4mmtj45U=; 24:82trdzrio6KHnoQxd3lBh5s8Cl+cv82Te0yX8vX4Skgx9Qbb9e9UESOWTRvPAVv7wClOkvaQjvFPr6GYe/j9p4fammOUJ2At16Fkx2eNbA8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3472; 7:+KB57+Hr+aPalhiTBJS5loITAT5Lh8/W1/wu1f08hn31ogsJwbSvIlMnHBzp4g5y9Aj7fSUKbaTR9/rf+sOId6nTDiUbIF7mpEhLffG43Ci0ztECPljoX3YdXA9LmdyFv8+HYK/PCX/dDybpxWDmu+O+jvsbM8ZYz/rbM1efmleQst8XhE7/0FhU46INK/bPzvOy1uaE2zdRbPWRE4YPW0q+eGBv2FSe4GnU1xdzxhdvrRcwC5kKdrrTM+wzUAbR X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2018 09:27:23.4936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71e2685b-aacb-4420-fc16-08d5eafe5847 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3472 Subject: [dpdk-dev] [PATCH v2 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: Mon, 16 Jul 2018 09:31:19 -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 8fd52e1c3..e87d41116 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); static void @@ -918,16 +920,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 @@ -1475,7 +1482,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(); @@ -1596,9 +1603,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. @@ -1992,6 +1999,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, @@ -2008,6 +2016,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 fa4ee824a..14479cb7a 100644 --- a/drivers/net/thunderx/nicvf_rxtx.c +++ b/drivers/net/thunderx/nicvf_rxtx.c @@ -441,6 +441,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); @@ -481,6 +489,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, @@ -512,6 +536,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; @@ -590,6 +621,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