DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/bnxt: refactor Rx ring cleanup for representors
@ 2021-10-26  5:14 Ajit Khaparde
  2021-10-27  1:52 ` Ajit Khaparde
  0 siblings, 1 reply; 2+ messages in thread
From: Ajit Khaparde @ 2021-10-26  5:14 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, Somnath Kotur

[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]

Rx ring for representors does not use aggregation rings for Rx.
Instead they use simple software buffers for handling Rx packets.
So there is no need to use the same cleanup routine as done by
the non-representor code path.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_reps.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 1c07db3ca9..92beea3558 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -386,6 +386,26 @@ static int bnxt_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 	return rc;
 }
 
+static void bnxt_vfr_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
+{
+	struct rte_mbuf **sw_ring;
+	unsigned int i;
+
+	if (!rxq || !rxq->rx_ring)
+		return;
+
+	sw_ring = rxq->rx_ring->rx_buf_ring;
+	if (sw_ring) {
+		for (i = 0; i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
+			if (sw_ring[i]) {
+				if (sw_ring[i] != &rxq->fake_mbuf)
+					rte_pktmbuf_free_seg(sw_ring[i]);
+				sw_ring[i] = NULL;
+			}
+		}
+	}
+}
+
 static void bnxt_rep_free_rx_mbufs(struct bnxt_representor *rep_bp)
 {
 	struct bnxt_rx_queue *rxq;
@@ -393,7 +413,7 @@ static void bnxt_rep_free_rx_mbufs(struct bnxt_representor *rep_bp)
 
 	for (i = 0; i < rep_bp->rx_nr_rings; i++) {
 		rxq = rep_bp->rx_queues[i];
-		bnxt_rx_queue_release_mbufs(rxq);
+		bnxt_vfr_rx_queue_release_mbufs(rxq);
 	}
 }
 
-- 
2.30.1 (Apple Git-130)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/bnxt: refactor Rx ring cleanup for representors
  2021-10-26  5:14 [dpdk-dev] [PATCH] net/bnxt: refactor Rx ring cleanup for representors Ajit Khaparde
@ 2021-10-27  1:52 ` Ajit Khaparde
  0 siblings, 0 replies; 2+ messages in thread
From: Ajit Khaparde @ 2021-10-27  1:52 UTC (permalink / raw)
  To: dpdk-dev; +Cc: Kalesh AP, Somnath Kotur

On Mon, Oct 25, 2021 at 10:14 PM Ajit Khaparde
<ajit.khaparde@broadcom.com> wrote:
>
> Rx ring for representors does not use aggregation rings for Rx.
> Instead they use simple software buffers for handling Rx packets.
> So there is no need to use the same cleanup routine as done by
> the non-representor code path.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Acked-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  drivers/net/bnxt/bnxt_reps.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
> index 1c07db3ca9..92beea3558 100644
> --- a/drivers/net/bnxt/bnxt_reps.c
> +++ b/drivers/net/bnxt/bnxt_reps.c
> @@ -386,6 +386,26 @@ static int bnxt_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
>         return rc;
>  }
>
> +static void bnxt_vfr_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
> +{
> +       struct rte_mbuf **sw_ring;
> +       unsigned int i;
> +
> +       if (!rxq || !rxq->rx_ring)
> +               return;
> +
> +       sw_ring = rxq->rx_ring->rx_buf_ring;
> +       if (sw_ring) {
> +               for (i = 0; i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
> +                       if (sw_ring[i]) {
> +                               if (sw_ring[i] != &rxq->fake_mbuf)
> +                                       rte_pktmbuf_free_seg(sw_ring[i]);
> +                               sw_ring[i] = NULL;
> +                       }
> +               }
> +       }
> +}
> +
>  static void bnxt_rep_free_rx_mbufs(struct bnxt_representor *rep_bp)
>  {
>         struct bnxt_rx_queue *rxq;
> @@ -393,7 +413,7 @@ static void bnxt_rep_free_rx_mbufs(struct bnxt_representor *rep_bp)
>
>         for (i = 0; i < rep_bp->rx_nr_rings; i++) {
>                 rxq = rep_bp->rx_queues[i];
> -               bnxt_rx_queue_release_mbufs(rxq);
> +               bnxt_vfr_rx_queue_release_mbufs(rxq);
>         }
>  }
>
> --
> 2.30.1 (Apple Git-130)
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-27  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26  5:14 [dpdk-dev] [PATCH] net/bnxt: refactor Rx ring cleanup for representors Ajit Khaparde
2021-10-27  1:52 ` Ajit Khaparde

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).