DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Subject: [dpdk-dev] [PATCH 2/8] net/bnxt: simplify representor Rx ring creation
Date: Tue, 22 Sep 2020 12:36:26 +0530	[thread overview]
Message-ID: <20200922070632.17706-3-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200922070632.17706-1-somnath.kotur@broadcom.com>

rx_queue_setup_op for representor was using a common function to
initialize the software data structures for the Rx ring. But that
routine has code to init other rings not needed for representors like
cp/agg ring etc.
Define and invoke a new function to setup structures just for the
representor Rx ring

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/bnxt_reps.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 17010f1..d4d0a9e 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -522,6 +522,31 @@ int bnxt_vf_rep_dev_configure_op(__rte_unused struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+static int bnxt_init_rep_rx_ring(struct bnxt_rx_queue *rxq,
+				 unsigned int socket_id)
+{
+	struct bnxt_rx_ring_info *rxr;
+	struct bnxt_ring *ring;
+
+	rxr = rte_zmalloc_socket("bnxt_rep_rx_ring",
+				 sizeof(struct bnxt_rx_ring_info),
+				 RTE_CACHE_LINE_SIZE, socket_id);
+	if (rxr == NULL)
+		return -ENOMEM;
+	rxq->rx_ring = rxr;
+
+	ring = rte_zmalloc_socket("bnxt_rep_rx_ring_struct",
+				  sizeof(struct bnxt_ring),
+				  RTE_CACHE_LINE_SIZE, socket_id);
+	if (ring == NULL)
+		return -ENOMEM;
+	rxr->rx_ring_struct = ring;
+	ring->ring_size = rte_align32pow2(rxq->nb_rx_desc);
+	ring->ring_mask = ring->ring_size - 1;
+
+	return 0;
+}
+
 int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			  uint16_t queue_idx,
 			  uint16_t nb_desc,
@@ -580,7 +605,7 @@ int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	rxq->nb_rx_desc = nb_desc;
 
-	rc = bnxt_init_rx_ring_struct(rxq, socket_id);
+	rc = bnxt_init_rep_rx_ring(rxq, socket_id);
 	if (rc)
 		goto out;
 
@@ -603,7 +628,7 @@ int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 out:
 	if (rxq)
-		bnxt_rx_queue_release_op(rxq);
+		bnxt_vf_rep_rx_queue_release_op(rxq);
 
 	return rc;
 }
@@ -618,8 +643,8 @@ void bnxt_vf_rep_rx_queue_release_op(void *rx_queue)
 	bnxt_rx_queue_release_mbufs(rxq);
 
 	bnxt_free_ring(rxq->rx_ring->rx_ring_struct);
-	bnxt_free_ring(rxq->rx_ring->ag_ring_struct);
-	bnxt_free_ring(rxq->cp_ring->cp_ring_struct);
+	rte_free(rxq->rx_ring->rx_ring_struct);
+	rte_free(rxq->rx_ring);
 
 	rte_free(rxq);
 }
-- 
2.7.4


  parent reply	other threads:[~2020-09-22  7:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22  7:06 [dpdk-dev] [PATCH 0/8] bnxt patches Somnath Kotur
2020-09-22  7:06 ` [dpdk-dev] [PATCH 1/8] net/bnxt: add support for decap action for ipv6 VXLAN flows Somnath Kotur
2020-09-22  7:06 ` Somnath Kotur [this message]
2020-09-22  7:06 ` [dpdk-dev] [PATCH 3/8] net/bnxt: fix to correct bad shift operation Somnath Kotur
2020-09-22  7:06 ` [dpdk-dev] [PATCH 4/8] net/bnxt: fix to honor value passed for truflow devargs Somnath Kotur
2020-09-22  7:06 ` [dpdk-dev] [PATCH 5/8] net/bnxt: add a null ptr check in bnxt PCI probe Somnath Kotur
2020-09-24 14:47   ` Ferruh Yigit
2020-09-25  2:04     ` Somnath Kotur
2020-09-25  8:42       ` Ferruh Yigit
2020-09-25 10:46         ` Somnath Kotur
2020-09-25 10:49           ` Somnath Kotur
2020-09-25 10:40   ` [dpdk-dev] [PATCH v2] net/bnxt: add a " Somnath Kotur
2020-09-25 11:56     ` Ferruh Yigit
2020-09-22  7:06 ` [dpdk-dev] [PATCH 6/8] net/bnxt: support for representors on remote host domain Somnath Kotur
2020-09-22  7:06 ` [dpdk-dev] [PATCH 7/8] net/bnxt: fix flow match to ignore pkt type Somnath Kotur
2020-09-22  7:06 ` [dpdk-dev] [PATCH 8/8] net/bnxt: fix seg fault during NAT configuration Somnath Kotur
2020-09-23 23:50 ` [dpdk-dev] [PATCH 0/8] bnxt patches Ajit Khaparde

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=20200922070632.17706-3-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=venkatkumar.duvvuru@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).