net/bnxt: vector mode enhancements
Subsystems (2)
cover net/bnxt: vector mode enhancements
- Switch to non-vector receive function when "mark" action is requested.
- Add support for rx_burst_mode_get()/tx_burst_mode_get() to return currently active receive/transmit mode.
- Add vector mode support for ARM64.
Lance Richardson (3):
net/bnxt: disable vector receive for mark action net/bnxt: support Rx/Tx burst mode info net/bnxt: add ARM64 vector support
doc/guides/nics/features/bnxt.ini | 1 + drivers/net/bnxt/Makefile | 3 + drivers/net/bnxt/bnxt_ethdev.c | 52 ++- drivers/net/bnxt/bnxt_flow.c | 20 +- drivers/net/bnxt/bnxt_ring.c | 4 +- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 18 + drivers/net/bnxt/bnxt_rxr.h | 2 +- drivers/net/bnxt/bnxt_rxtx_vec_common.h | 57 +++ drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 473 ++++++++++++++++++++++++ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 46 +-- drivers/net/bnxt/bnxt_txr.h | 2 +- drivers/net/bnxt/meson.build | 2 + 13 files changed, 618 insertions(+), 64 deletions(-) create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_common.h create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_neon.c
Signature · 1 line
2.25.1
PATCH 1/3 net/bnxt: disable vector receive for mark action
The bnxt vector mode receive handler does not support the rte_flow 'mark' action. Since we cannot know in advance whether this action will be required, add support for dynamically switching from vector to non-vector receive when the first flow create request with a mark action is processed.
--- drivers/net/bnxt/bnxt_flow.c | 20 ++++++++------------ drivers/net/bnxt/bnxt_rxr.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 12 deletions(-)
drivers/net/bnxt/bnxt_flow.c +8 -12
@@ -18,6 +18,7 @@#include "bnxt_hwrm.h" #include "bnxt_ring.h" #include "bnxt_rxq.h" +#include "bnxt_rxr.h" #include "bnxt_vnic.h" #include "hsi_struct_def_dpdk.h"
@@ -1403,18 +1404,6 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,bnxt_update_filter_flags_en (filter, filter1, use_ntuple);break ;case RTE_FLOW_ACTION_TYPE_MARK : -if (bp->flags &BNXT_FLAG_RX_VECTOR_PKT_MODE ) { -PMD_DRV_LOG (DEBUG , -"Disable vector processing for mark\n" ); -rte_flow_error_set (error, -ENOTSUP , -RTE_FLOW_ERROR_TYPE_ACTION , - act, -"Disable vector processing for mark" ); - rc = -rte_errno; - goto ret; - } -if (bp->mark_table ==NULL ) { rte_flow_error_set(error, ENOMEM,
@@ -1425,6 +1414,13 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, goto ret; } +if (bp->flags &BNXT_FLAG_RX_VECTOR_PKT_MODE ) { +PMD_DRV_LOG (DEBUG , +"Disabling vector processing for mark\n" ); + bp->eth_dev->rx_pkt_burst = bnxt_recv_pkts; + bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE ; + } + filter->valid_flags |=BNXT_FLOW_MARK_FLAG ; filter->mark = ((const struct rte_flow_action_mark *) act->conf)->id;
drivers/net/bnxt/bnxt_rxr.c +18 -0
@@ -747,6 +747,24 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, !rte_spinlock_trylock(&rxq->lock)))return 0 ; +#if defined(RTE_ARCH_X86 ) +/* +* Replenish buffers if needed when a transition has been made from +* vector- to non-vector- receive processing. +*/ +while (unlikely (rxq->rxrearm_nb)) { +if (!bnxt_alloc_rx_data (rxq, rxr, rxq->rxrearm_start)) { + rxr->rx_prod = rxq->rxrearm_start; +bnxt_db_write (&rxr->rx_db, rxr->rx_prod); + rxq->rxrearm_start++; + rxq->rxrearm_nb--; + }else { +/* Retry allocation on next call. */ +break ; + } + } +#endif +/* Handle RX burst request */ while (1 ) { cons =RING_CMP (cpr->cp_ring_struct, raw_cons);
Signature · 1 line
2.25.1
PATCH 2/3 net/bnxt: support Rx/Tx burst mode info
In reply to Lance RichardsonRetrieve burst mode options according to the selected Rx/Tx burst function name.
--- doc/guides/nics/features/bnxt.ini | 1 + drivers/net/bnxt/bnxt_ethdev.c | 46 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
doc/guides/nics/features/bnxt.ini +1 -0
@@ -9,6 +9,7 @@ Link status = Y Link status event = Y Rx interrupt = Y Queue start/stop = Y +Burst mode info = Y MTU update = Y Jumbo frame = Y Scattered Rx = Y
drivers/net/bnxt/bnxt_ethdev.c +46 -0
58 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 3/3 net/bnxt: add ARM64 vector support
In reply to Lance RichardsonAdd bnxt vector PMD support using NEON SIMD instructions.
--- drivers/net/bnxt/Makefile | 3 + drivers/net/bnxt/bnxt_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ring.c | 4 +- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 2 +- drivers/net/bnxt/bnxt_rxr.h | 2 +- drivers/net/bnxt/bnxt_rxtx_vec_common.h | 57 +++ drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 473 ++++++++++++++++++++++++ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 46 +-- drivers/net/bnxt/bnxt_txr.h | 2 +- drivers/net/bnxt/meson.build | 2 + 11 files changed, 548 insertions(+), 55 deletions(-) create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_common.h create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_neon.c
drivers/net/bnxt/Makefile +3 -0
@@ -42,6 +42,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += rte_pmd_bnxt.c ifeq ($(CONFIG_RTE_ARCH_X86), y) SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_rxtx_vec_sse.c endif +ifeq ($(CONFIG_RTE_ARCH_ARM64), y) +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_rxtx_vec_neon.c +endif ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD), y) CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_core -I$(SRCDIR)/tf_ulp
drivers/net/bnxt/bnxt_ethdev.c +5 -5
@@ -1075,7 +1075,7 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev) {struct bnxt *bp = eth_dev->data->dev_private; -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )#ifndef RTE_LIBRTE_IEEE1588 /* * Vector mode receive can be enabled only if scatter rx is not
@@ -1115,7 +1115,7 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)static eth_tx_burst_t bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev) { -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )#ifndef RTE_LIBRTE_IEEE1588 /* * Vector mode transmit can be enabled only if not using scatter rx
@@ -2593,7 +2593,7 @@ bnxt_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, "Scalar");return 0 ; } -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )if (pkt_burst == bnxt_recv_pkts_vec) {snprintf (mode->info,sizeof (mode->info),"%s" ,"Vector SSE" );
@@ -2615,7 +2615,7 @@ bnxt_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, "Scalar");return 0 ; } -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )if (pkt_burst == bnxt_xmit_pkts_vec) {snprintf (mode->info,sizeof (mode->info),"%s" ,"Vector SSE" );
@@ -2644,7 +2644,7 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) new_pkt_size = new_mtu +RTE_ETHER_HDR_LEN +RTE_ETHER_CRC_LEN +VLAN_TAG_SIZE *BNXT_NUM_VLANS ; -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )/* * If vector-mode tx/rx is active, disallow any MTU change that would * require scattered receive support.
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -608,7 +608,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)bnxt_db_write (&rxr->ag_db, rxr->ag_prod); } rxq->index = queue_index; -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )bnxt_rxq_vec_setup (rxq);#endif
@@ -713,7 +713,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)bnxt_db_write (&rxr->rx_db, rxr->rx_prod);bnxt_db_write (&rxr->ag_db, rxr->ag_prod); rxq->index = i; -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )bnxt_rxq_vec_setup (rxq);#endif }
drivers/net/bnxt/bnxt_rxq.h +1 -1
@@ -22,7 +22,7 @@ struct bnxt_rx_queue {uint16_t nb_rx_hold;/* num held free RX desc */ uint16_t rx_free_thresh;/* max free RX desc to hold */ uint16_t queue_id;/* RX queue index */ -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )uint16_t rxrearm_nb;/* number of descs to reinit. */ uint16_t rxrearm_start;/* next desc index to reinit. */ #endif
drivers/net/bnxt/bnxt_rxr.c +1 -1
@@ -747,7 +747,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, !rte_spinlock_trylock(&rxq->lock)))return 0 ; -#if defined(RTE_ARCH_X86 ) +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )/* * Replenish buffers if needed when a transition has been made from * vector- to non-vector- receive processing.
drivers/net/bnxt/bnxt_rxr.h +1 -1
@@ -220,7 +220,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);int bnxt_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id);int bnxt_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id); -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )uint16_t bnxt_recv_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts);int bnxt_rxq_vec_setup (struct bnxt_rx_queue *rxq);
drivers/net/bnxt/bnxt_rxtx_vec_common.h new file +57 -0
57 lines not on this page · raw message
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +473 -0
473 lines not on this page · raw message
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +2 -44
68 lines not on this page · raw message
drivers/net/bnxt/bnxt_txr.h +1 -1
@@ -59,7 +59,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);uint16_t bnxt_dummy_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); -#ifdef RTE_ARCH_X86 +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM64 )uint16_t bnxt_xmit_pkts_vec (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);#endif
drivers/net/bnxt/meson.build +2 -0
@@ -47,4 +47,6 @@ sources = files('bnxt_cpr.c', if arch_subdir == 'x86' sources += files('bnxt_rxtx_vec_sse.c') +elif arch_subdir == 'arm' and host_machine.cpu_family().startswith('aarch64') + sources += files('bnxt_rxtx_vec_neon.c') endif
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH 3/3] net/bnxt: add ARM64 vector support
Quoted 29 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Lance Richardson
Sent: Friday, June 12, 2020 7:58 AM
To: [email protected]; Ajit Khaparde ([email protected]) <[email protected]>
Subject: [dpdk-dev] [PATCH 3/3] net/bnxt: add ARM64 vector supportAdd bnxt vector PMD support using NEON SIMD instructions.
Signed-off-by Lance Richardson <[email protected]>Reviewed-by Ajit Kumar Khaparde <[email protected]>--- drivers/net/bnxt/Makefile | 3 + drivers/net/bnxt/bnxt_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ring.c | 4 +- drivers/net/bnxt/bnxt_rxq.h | 2 +- drivers/net/bnxt/bnxt_rxr.c | 2 +- drivers/net/bnxt/bnxt_rxr.h | 2 +- drivers/net/bnxt/bnxt_rxtx_vec_common.h | 57 +++ drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 473 ++++++++++++++++++++++++ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 46 +-- drivers/net/bnxt/bnxt_txr.h | 2 +- drivers/net/bnxt/meson.build | 2 + 11 files changed, 548 insertions(+), 55 deletions(-) create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_common.h create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_neon.c
<snip>
Quoted 9 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +2
-0@@ -0,0 +1,473 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright(c) 2019-2020 Broadcom All rights reserved. */
drivers/net/bnxt/bnxt_rxtx_vec_neon.c line 12
Quoted 10 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +10
-0+ +#include <inttypes.h> +#include <stdbool.h> + +#include <rte_bitmap.h> +#include <rte_byteorder.h> +#include <rte_malloc.h> +#include <rte_memory.h> +#if defined(RTE_ARCH_ARM64 ) +#include <arm_neon.h>
rte_vect.h includes compatibility improvement. It can replace arm_neon.h here.
Quoted 5 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +5
-0+#else +#error "bnxt vector pmd: unsupported target." +#endif + +#include "bnxt.h"
drivers/net/bnxt/bnxt_rxtx_vec_neon.c line 27
Quoted 10 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +10
-0+#include "bnxt_cpr.h" +#include "bnxt_ring.h" +#include "bnxt_rxr.h" +#include "bnxt_rxq.h" +#include "hsi_struct_def_dpdk.h" +#include "bnxt_rxtx_vec_common.h" + +#include "bnxt_txq.h" +#include "bnxt_txr.h" +
<snip>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Re: [dpdk-dev] [PATCH 3/3] net/bnxt: add ARM64 vector support
Quoted 1 line · Ruifeng Wang
<snip>
Quoted 9 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c line 12
Quoted 2 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +2
-0+#if defined(RTE_ARCH_ARM64 ) +#include <arm_neon.h>
rte_vect.hincludes compatibility improvement. It can replacearm_neon.hhere.drivers/net/bnxt/bnxt_rxtx_vec_neon.c line 16
Quoted 4 lines
drivers/net/bnxt/bnxt_rxtx_vec_neon.c new file +4
-0+#else +#error "bnxt vector pmd: unsupported target." +#endif +
Thanks, Ruifeng, I've addressed this in v2.
Lance