DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 06/12] net/bnxt: use smaller cq when agg ring not needed
Date: Wed,  9 Sep 2020 11:52:59 -0400
Message-ID: <20200909155302.28656-7-lance.richardson@broadcom.com> (raw)
In-Reply-To: <20200909155302.28656-1-lance.richardson@broadcom.com>

Don't allocate extra completion queue entries for aggregation
ring when aggregation ring will not be used.

Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++------
 drivers/net/bnxt/bnxt_rxr.c    | 21 +++++++++++++++++++--
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1ad9bfc0a6..27eba431b8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1295,6 +1295,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
 	eth_dev->data->dev_started = 0;
+	eth_dev->data->scattered_rx = 0;
+
 	/* Prevent crashes when queues are still in use */
 	eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
 	eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts;
@@ -2695,14 +2697,12 @@ 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;
 
-#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.
+	 * Disallow any MTU change that would require scattered receive support
+	 * if it is not already enabled.
 	 */
 	if (eth_dev->data->dev_started &&
-	    (eth_dev->rx_pkt_burst == bnxt_recv_pkts_vec ||
-	     eth_dev->tx_pkt_burst == bnxt_xmit_pkts_vec) &&
+	    !eth_dev->data->scattered_rx &&
 	    (new_pkt_size >
 	     eth_dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
 		PMD_DRV_LOG(ERR,
@@ -2710,7 +2710,6 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		PMD_DRV_LOG(ERR, "Stop port before changing MTU.\n");
 		return -EINVAL;
 	}
-#endif
 
 	if (new_mtu > RTE_ETHER_MTU) {
 		bp->flags |= BNXT_FLAG_JUMBO;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 92102e3d57..5673e2b50f 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -938,9 +938,12 @@ void bnxt_free_rx_rings(struct bnxt *bp)
 
 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 {
+	struct rte_eth_dev *eth_dev = rxq->bp->eth_dev;
+	struct rte_eth_rxmode *rxmode;
 	struct bnxt_cp_ring_info *cpr;
 	struct bnxt_rx_ring_info *rxr;
 	struct bnxt_ring *ring;
+	bool use_agg_ring;
 
 	rxq->rx_buf_size = BNXT_MAX_PKT_LEN + sizeof(struct rte_mbuf);
 
@@ -978,8 +981,22 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	cpr->cp_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(rxr->rx_ring_struct->ring_size *
-					  (2 + AGG_RING_SIZE_FACTOR));
+
+	rxmode = &eth_dev->data->dev_conf.rxmode;
+	use_agg_ring = (rxmode->offloads & DEV_RX_OFFLOAD_SCATTER) ||
+		       (rxmode->offloads & DEV_RX_OFFLOAD_TCP_LRO) ||
+		       (rxmode->max_rx_pkt_len >
+			 (uint32_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) -
+				    RTE_PKTMBUF_HEADROOM));
+
+	/* Allocate two completion slots per entry in desc ring. */
+	ring->ring_size = rxr->rx_ring_struct->ring_size * 2;
+
+	/* Allocate additional slots if aggregation ring is in use. */
+	if (use_agg_ring)
+		ring->ring_size *= AGG_RING_SIZE_FACTOR;
+
+	ring->ring_size = rte_align32pow2(ring->ring_size);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)cpr->cp_desc_ring;
 	ring->bd_dma = cpr->cp_desc_mapping;
-- 
2.25.1


  parent reply	other threads:[~2020-09-09 15:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 15:52 [dpdk-dev] [PATCH 00/12] net/bnxt: vector PMD improvements Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 01/12] net/bnxt: fix burst mode get for Arm Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 02/12] net/bnxt: fix rxq/txq get information Lance Richardson
2020-09-11 14:41   ` Ferruh Yigit
2020-09-18 18:41     ` Lance Richardson
2020-09-21 11:05       ` Ferruh Yigit
2020-09-09 15:52 ` [dpdk-dev] [PATCH 03/12] net/bnxt: use appropriate type for Rx mbuf ring Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 04/12] net/bnxt: require async cq for vector mode Lance Richardson
2020-09-11 15:02   ` Ferruh Yigit
2020-09-11 15:07     ` Lance Richardson
2020-09-09 15:52 ` [dpdk-dev] [PATCH 05/12] net/bnxt: improve support for small ring sizes Lance Richardson
2020-09-14 22:03   ` Ferruh Yigit
2020-09-15 14:12     ` Lance Richardson
2020-09-09 15:52 ` Lance Richardson [this message]
2020-09-09 15:53 ` [dpdk-dev] [PATCH 07/12] net/bnxt: increase max burst size for vector mode Lance Richardson
2020-09-11 15:19   ` Ferruh Yigit
2020-09-11 15:38     ` Lance Richardson
2020-09-11 15:56       ` Ferruh Yigit
2020-09-09 15:53 ` [dpdk-dev] [PATCH 08/12] net/bnxt: use table-based packet type translation Lance Richardson
2020-09-09 15:53 ` [dpdk-dev] [PATCH 09/12] net/bnxt: table-based handling for ol flags Lance Richardson
2020-09-11  3:42 ` [dpdk-dev] [PATCH 00/12] net/bnxt: vector PMD improvements Ajit Khaparde
2020-09-11 15:58   ` Ferruh Yigit

Reply instructions:

You may reply publicly 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=20200909155302.28656-7-lance.richardson@broadcom.com \
    --to=lance.richardson@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=somnath.kotur@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 patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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