DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>, dev@dpdk.org
Cc: ferruh.yigit@intel.com, Lance Richardson <lance.richardson@broadcom.com>
Subject: Re: [dpdk-dev] [PATCH 03/11] net/bnxt: implement vector mode driver
Date: Thu, 23 May 2019 14:18:06 +0200
Message-ID: <311341f0-054b-00af-4778-f8b2f5c771c2@redhat.com> (raw)
In-Reply-To: <20190521213953.25425-4-ajit.khaparde@broadcom.com>



On 5/21/19 11:39 PM, Ajit Khaparde wrote:
> From: Lance Richardson <lance.richardson@broadcom.com>
> 
> Introduce vector mode support for the bnxt pmd.
> 
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>   config/common_base                   |   1 +
>   drivers/net/bnxt/Makefile            |   1 +
>   drivers/net/bnxt/bnxt_ethdev.c       |  92 ++++-
>   drivers/net/bnxt/bnxt_ring.h         |   3 +-
>   drivers/net/bnxt/bnxt_rxq.c          |   5 +
>   drivers/net/bnxt/bnxt_rxq.h          |   4 +
>   drivers/net/bnxt/bnxt_rxr.h          |   9 +-
>   drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 481 +++++++++++++++++++++++++++
>   drivers/net/bnxt/bnxt_txr.h          |  11 +-
>   9 files changed, 598 insertions(+), 9 deletions(-)
>   create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_sse.c
> 
> diff --git a/config/common_base b/config/common_base
> index 6b96e0e80..1bbb7c10b 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -212,6 +212,7 @@ CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC=n
>   # Compile burst-oriented Broadcom BNXT PMD driver
>   #
>   CONFIG_RTE_LIBRTE_BNXT_PMD=y
> +CONFIG_RTE_LIBRTE_BNXT_INC_VECTOR=n
>   
>   #
>   # Compile burst-oriented Chelsio Terminator (CXGBE) PMD
> diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
> index 8be3cb0e4..9e006b5d1 100644
> --- a/drivers/net/bnxt/Makefile
> +++ b/drivers/net/bnxt/Makefile
> @@ -41,6 +41,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_vnic.c
>   SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
>   SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_util.c
>   SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += rte_pmd_bnxt.c
> +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_INC_VECTOR) += bnxt_rxtx_vec_sse.c
>   
>   #
>   # Export include files

How do we enable it with Meson build? It seems to be missing.

> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index e0e0b72c6..064a153ec 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -645,6 +645,67 @@ static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev)
>   	return 0;
>   }
>   
> +static eth_rx_burst_t
> +bnxt_receive_function(__rte_unused struct rte_eth_dev *eth_dev)
> +{
> +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR
> +	/*
> +	 * Vector mode receive can be enabled only if scatter rx is not
> +	 * in use and rx offloads are limited to VLAN stripping and
> +	 * CRC stripping.
> +	 */
> +	if (!eth_dev->data->scattered_rx &&
> +	    !(eth_dev->data->dev_conf.rxmode.offloads &
> +	      ~(DEV_RX_OFFLOAD_VLAN_STRIP |
> +		DEV_RX_OFFLOAD_KEEP_CRC |
> +		DEV_RX_OFFLOAD_JUMBO_FRAME |
> +		DEV_RX_OFFLOAD_IPV4_CKSUM |
> +		DEV_RX_OFFLOAD_UDP_CKSUM |
> +		DEV_RX_OFFLOAD_TCP_CKSUM |
> +		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
> +		DEV_RX_OFFLOAD_VLAN_FILTER))) {
> +		PMD_DRV_LOG(INFO, "Using vector mode receive for port %d\n",
> +			    eth_dev->data->port_id);
> +		return bnxt_recv_pkts_vec;
> +	}
> +	PMD_DRV_LOG(INFO, "Vector mode receive disabled for port %d\n",
> +		    eth_dev->data->port_id);
> +	PMD_DRV_LOG(INFO,
> +		    "Port %d scatter: %d rx offload: %" PRIX64 "\n",
> +		    eth_dev->data->port_id,
> +		    eth_dev->data->scattered_rx,
> +		    eth_dev->data->dev_conf.rxmode.offloads);
> +#endif

I think we would better have a stub for bnxt_recv_pkts_vec() when
RTE_LIBRTE_BNXT_INC_VECTOR isn't set, that would avoid having all these
#ifdeferies in this file.

> +	return bnxt_recv_pkts;
> +}
> +
> +static eth_tx_burst_t
> +bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)
> +{
> +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR
> +	/*
> +	 * Vector mode receive can be enabled only if scatter tx is not
> +	 * in use and tx offloads other than VLAN insertion are not
> +	 * in use.
> +	 */
> +	if (!eth_dev->data->scattered_rx &&
> +	    !(eth_dev->data->dev_conf.txmode.offloads &
> +	      ~DEV_TX_OFFLOAD_VLAN_INSERT)) {
> +		PMD_DRV_LOG(INFO, "Using vector mode transmit for port %d\n",
> +			    eth_dev->data->port_id);
> +		return bnxt_xmit_pkts_vec;
> +	}
> +	PMD_DRV_LOG(INFO, "Vector mode transmit disabled for port %d\n",
> +		    eth_dev->data->port_id);
> +	PMD_DRV_LOG(INFO,
> +		    "Port %d scatter: %d tx offload: %" PRIX64 "\n",
> +		    eth_dev->data->port_id,
> +		    eth_dev->data->scattered_rx,
> +		    eth_dev->data->dev_conf.txmode.offloads);
> +#endif
> +	return bnxt_xmit_pkts;
> +}
> +
>   static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
>   {
>   	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
> @@ -675,6 +736,8 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
>   	if (rc)
>   		goto error;
>   
> +	eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
> +	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
>   	bp->flags |= BNXT_FLAG_INIT_DONE;
>   	return 0;
>   
> @@ -1597,6 +1660,8 @@ bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
>   
>   static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
>   {
> +	uint32_t new_pkt_size = new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN +
> +				VLAN_TAG_SIZE * BNXT_NUM_VLANS;
>   	struct bnxt *bp = eth_dev->data->dev_private;
>   	struct rte_eth_dev_info dev_info;
>   	uint32_t rc = 0;
> @@ -1610,6 +1675,23 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
>   		return -EINVAL;
>   	}
>   
> +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR
> +	/*
> +	 * If vector-mode tx/rx is active, disallow any MTU change that would
> +	 * require scattered receive support.
> +	 */
> +	if (eth_dev->data->dev_started &&
> +	    (eth_dev->rx_pkt_burst == bnxt_recv_pkts_vec ||
> +	     eth_dev->tx_pkt_burst == bnxt_xmit_pkts_vec) &&
> +	    (new_pkt_size >
> +	     eth_dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
> +		PMD_DRV_LOG(ERR,
> +			    "MTU change would require scattered rx support. ");
> +		PMD_DRV_LOG(ERR, "Stop port before changing MTU.\n");
> +		return -EINVAL;
> +	}
> +#endif
> +
>   	if (new_mtu > ETHER_MTU) {
>   		bp->flags |= BNXT_FLAG_JUMBO;
>   		bp->eth_dev->data->dev_conf.rxmode.offloads |=
> @@ -1620,8 +1702,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
>   		bp->flags &= ~BNXT_FLAG_JUMBO;
>   	}
>   
> -	eth_dev->data->dev_conf.rxmode.max_rx_pkt_len =
> -		new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
> +	eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
>   
>   	eth_dev->data->mtu = new_mtu;
>   	PMD_DRV_LOG(INFO, "New MTU is %d\n", eth_dev->data->mtu);
> @@ -2655,9 +2736,10 @@ bnxt_dev_supported_ptypes_get_op(struct rte_eth_dev *dev)
>   		RTE_PTYPE_UNKNOWN
>   	};
>   
> -	if (dev->rx_pkt_burst == bnxt_recv_pkts)
> -		return ptypes;
> -	return NULL;
> +	if (!dev->rx_pkt_burst)
> +		return NULL;
> +
> +	return ptypes;
>   }
>   
>   static int bnxt_map_regs(struct bnxt *bp, uint32_t *reg_arr, int count,

...

> diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h
> index 13ca04676..c28bd9c18 100644
> --- a/drivers/net/bnxt/bnxt_txr.h
> +++ b/drivers/net/bnxt/bnxt_txr.h
> @@ -37,13 +37,15 @@ struct bnxt_sw_tx_bd {
>   	unsigned short		nr_bds;
>   };
>   
> -static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
> +static inline uint32_t
> +bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)

If to be done, it should be done in patch 1.

>   {
>   	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
>   		txq->tx_ring->tx_ring_struct->ring_mask);
>   }
>   
> -static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq)
> +static inline uint32_t
> +bnxt_tx_avail(struct bnxt_tx_queue *txq)

Ditto

>   {
>   	/* Tell compiler to fetch tx indices from memory. */
>   	rte_compiler_barrier();
> @@ -57,6 +59,11 @@ int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq);
>   int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);
>   uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
>   			       uint16_t nb_pkts);
> +#ifdef RTE_LIBRTE_BNXT_INC_VECTOR
> +uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
> +			    uint16_t nb_pkts);
> +#endif
> +
>   int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
>   int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
>   
> 

  reply index

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 21:39 [dpdk-dev] [PATCH 00/11] bnxt patchset Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 01/11] net/bnxt: move tx bd checking to header file Ajit Khaparde
2019-05-23 11:44   ` Maxime Coquelin
2019-05-21 21:39 ` [dpdk-dev] [PATCH 02/11] net/bnxt: compute and store scattered RX status Ajit Khaparde
2019-05-23 11:47   ` Maxime Coquelin
2019-05-21 21:39 ` [dpdk-dev] [PATCH 03/11] net/bnxt: implement vector mode driver Ajit Khaparde
2019-05-23 12:18   ` Maxime Coquelin [this message]
2019-05-23 19:23     ` Lance Richardson
2019-05-21 21:39 ` [dpdk-dev] [PATCH 04/11] net/bnxt: fix double counting VLAN tags Ajit Khaparde
2019-05-23 12:21   ` Maxime Coquelin
2019-05-23 18:53     ` Lance Richardson
2019-05-21 21:39 ` [dpdk-dev] [PATCH 05/11] net/bnxt: fix RSS reta indirection table update Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 06/11] net/bnxt: use reta update mask and translate qid to grp id Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 07/11] net/bnxt: fix reta query op Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 08/11] net/bnxt: update HWRM API Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 09/11] net/bnxt: update HWRM version Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 10/11] net/bnxt: HWRM version update Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 11/11] net/bnxt: update release notes for bnxt Ajit Khaparde
2019-05-24 14:49 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: move tx bd checking to header file Lance Richardson
2019-05-27  9:36     ` Ferruh Yigit
2019-05-27 15:24       ` Ferruh Yigit
2019-05-27 18:50         ` Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 02/10] net/bnxt: compute and store scattered RX status Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 03/10] net/bnxt: implement vector mode driver Lance Richardson
2019-05-28  9:05     ` Ferruh Yigit
2019-05-28  9:08     ` Ferruh Yigit
2019-05-28 11:23       ` Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix RSS reta indirection table update Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 05/10] net/bnxt: use reta update mask and translate qid to grp id Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix reta query op Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 07/10] net/bnxt: update HWRM API Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: update HWRM version Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 09/10] net/bnxt: HWRM version update Lance Richardson
2019-05-28  9:12     ` Ferruh Yigit
2019-05-28 15:06       ` Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 10/10] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-28  9:15     ` Ferruh Yigit
2019-05-28  9:19   ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset Ferruh Yigit
2019-05-28 15:11     ` Lance Richardson
2019-05-28 19:23 ` [dpdk-dev] [PATCH v3 0/8] " Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 1/8] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 2/8] net/bnxt: move Tx bd checking to header file Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 3/8] net/bnxt: compute and store scattered Rx status Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 4/8] net/bnxt: implement vector mode driver Lance Richardson
2019-05-29  6:48     ` Maxime Coquelin
2019-05-29 13:19       ` Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 5/8] net/bnxt: fix RSS RETA indirection table ops Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 6/8] net/bnxt: update HWRM API to version 1.10.0.19 Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 7/8] net/bnxt: update HWRM API to version 1.10.0.48 Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 8/8] net/bnxt: update HWRM API to version 1.10.0.74 Lance Richardson
2019-05-29 15:02 ` [dpdk-dev] [PATCH v4 0/8] bnxt patchset Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 1/8] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-29 18:16     ` Kevin Traynor
2019-05-29 20:28       ` Lance Richardson
2019-05-29 20:35         ` Lance Richardson
2019-05-29 20:38           ` Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 2/8] net/bnxt: move Tx bd checking to header file Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 3/8] net/bnxt: compute and store scattered Rx status Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 4/8] net/bnxt: implement vector mode driver Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 5/8] net/bnxt: fix RSS RETA indirection table ops Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 6/8] net/bnxt: update HWRM API to version 1.10.0.19 Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 7/8] net/bnxt: update HWRM API to version 1.10.0.48 Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 8/8] net/bnxt: update HWRM API to version 1.10.0.74 Lance Richardson
2019-05-29 21:02 ` [dpdk-dev] [PATCH v5 0/8] bnxt patchset Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 1/8] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 2/8] net/bnxt: move Tx bd checking to header file Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 3/8] net/bnxt: compute and store scattered Rx status Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 4/8] net/bnxt: implement vector mode driver Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 5/8] net/bnxt: fix RSS RETA indirection table ops Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 6/8] net/bnxt: update HWRM API to version 1.10.0.19 Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 7/8] net/bnxt: update HWRM API to version 1.10.0.48 Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 8/8] net/bnxt: update HWRM API to version 1.10.0.74 Lance Richardson
2019-06-04 16:07   ` [dpdk-dev] [PATCH v5 0/8] bnxt patchset Ferruh Yigit
2019-06-14 15:34     ` Ferruh Yigit

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=311341f0-054b-00af-4778-f8b2f5c771c2@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=lance.richardson@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox