mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Subbaraya Sundeep <sbhatta@marvell.com>
To: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<sgoutham@marvell.com>, <gakula@marvell.com>,
	<bbhushan2@marvell.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Subbaraya Sundeep" <sbhatta@marvell.com>
Subject: [net-next PATCH v6 1/5] octeontx2-af: Simplify NPA context writing and reading
Date: Tue, 26 May 2026 16:17:23 +0530	[thread overview]
Message-ID: <1779792447-5593-2-git-send-email-sbhatta@marvell.com> (raw)
In-Reply-To: <1779792447-5593-1-git-send-email-sbhatta@marvell.com>

Simplify NPA context reading and writing by using hardware
maximum context size instead of using individual sizes of
each context type.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
---
 .../ethernet/marvell/octeontx2/af/rvu_npa.c   | 20 ++++++++-----------
 .../marvell/octeontx2/af/rvu_struct.h         |  6 ++++++
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c
index e2a33e46b48a..df783c4e5d75 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c
@@ -116,13 +116,11 @@ int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,
 	case NPA_AQ_INSTOP_WRITE:
 		/* Copy context and write mask */
 		if (req->ctype == NPA_AQ_CTYPE_AURA) {
-			memcpy(mask, &req->aura_mask,
-			       sizeof(struct npa_aura_s));
-			memcpy(ctx, &req->aura, sizeof(struct npa_aura_s));
+			memcpy(mask, &req->aura_mask, NIX_MAX_CTX_SIZE);
+			memcpy(ctx, &req->aura, NIX_MAX_CTX_SIZE);
 		} else {
-			memcpy(mask, &req->pool_mask,
-			       sizeof(struct npa_pool_s));
-			memcpy(ctx, &req->pool, sizeof(struct npa_pool_s));
+			memcpy(mask, &req->pool_mask, NIX_MAX_CTX_SIZE);
+			memcpy(ctx, &req->pool, NIX_MAX_CTX_SIZE);
 		}
 		break;
 	case NPA_AQ_INSTOP_INIT:
@@ -134,9 +132,9 @@ int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,
 			/* Set pool's context address */
 			req->aura.pool_addr = pfvf->pool_ctx->iova +
 			(req->aura.pool_addr * pfvf->pool_ctx->entry_sz);
-			memcpy(ctx, &req->aura, sizeof(struct npa_aura_s));
+			memcpy(ctx, &req->aura, NIX_MAX_CTX_SIZE);
 		} else { /* POOL's context */
-			memcpy(ctx, &req->pool, sizeof(struct npa_pool_s));
+			memcpy(ctx, &req->pool, NIX_MAX_CTX_SIZE);
 		}
 		break;
 	case NPA_AQ_INSTOP_NOP:
@@ -196,11 +194,9 @@ int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,
 		/* Copy read context into mailbox */
 		if (req->op == NPA_AQ_INSTOP_READ) {
 			if (req->ctype == NPA_AQ_CTYPE_AURA)
-				memcpy(&rsp->aura, ctx,
-				       sizeof(struct npa_aura_s));
+				memcpy(&rsp->aura, ctx, NIX_MAX_CTX_SIZE);
 			else
-				memcpy(&rsp->pool, ctx,
-				       sizeof(struct npa_pool_s));
+				memcpy(&rsp->pool, ctx, NIX_MAX_CTX_SIZE);
 		}
 	}
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h
index 8e868f815de1..1e51ed197b29 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h
@@ -227,8 +227,12 @@ struct npa_aura_s {
 	u64 fc_msh_dst            : 11;
 	u64 reserved_435_447      : 13;
 	u64 reserved_448_511;		/* W7 */
+	/* Ensure all context sizes are 128 bytes */
+	u64 padding[8];
 };
 
+static_assert(sizeof(struct npa_aura_s) == NIX_MAX_CTX_SIZE);
+
 struct npa_pool_s {
 	u64 stack_base;			/* W0 */
 	u64 ena                   : 1;
@@ -285,6 +289,8 @@ struct npa_pool_s {
 	u64 reserved_960_1023;		/* W15 */
 };
 
+static_assert(sizeof(struct npa_pool_s) == NIX_MAX_CTX_SIZE);
+
 /* NIX admin queue completion status */
 enum nix_aq_comp {
 	NIX_AQ_COMP_NOTDONE        = 0x0,
-- 
2.48.1


  reply	other threads:[~2026-05-26 10:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 10:47 [net-next PATCH v6 0/5] octeontx2: CN20K NPA Halo context support Subbaraya Sundeep
2026-05-26 10:47 ` Subbaraya Sundeep [this message]
2026-05-26 10:47 ` [net-next PATCH v6 2/5] octeontx2-af: npa: cn20k: Add NPA Halo support Subbaraya Sundeep
2026-05-26 10:47 ` [net-next PATCH v6 3/5] octeontx2-af: npa: cn20k: Add DPC support Subbaraya Sundeep
2026-06-01  9:48   ` Paolo Abeni
2026-05-26 10:47 ` [net-next PATCH v6 4/5] octeontx2-af: npa: cn20k: Add debugfs for Halo Subbaraya Sundeep
2026-05-26 10:47 ` [net-next PATCH v6 5/5] octeontx2-pf: cn20k: Use unified Halo context Subbaraya Sundeep

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=1779792447-5593-2-git-send-email-sbhatta@marvell.com \
    --to=sbhatta@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bbhushan2@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgoutham@marvell.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

all inboxes | Powered by JetHome®