public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: "Jasper Tran O'Leary" <jtranoleary@google.com>
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Vee Agarwal <veethebee@google.com>,
	 "Jasper Tran O'Leary" <jtranoleary@google.com>,
	Joshua Washington <joshwash@google.com>
Subject: [PATCH v2 2/4] net/gve: introduce extended adminq command
Date: Tue,  3 Mar 2026 00:58:02 +0000	[thread overview]
Message-ID: <20260303005804.924545-3-jtranoleary@google.com> (raw)
In-Reply-To: <20260303005804.924545-1-jtranoleary@google.com>

From: Vee Agarwal <veethebee@google.com>

Flow steering adminq commands are too large to fit into a normal adminq
command buffer which accepts at most 56 bytes. As a result, introduce
extended adminq commands which permit larger command buffers using
indirection. Namely, extended command operations point to inner command
buffers allocated at a specified DMA address. As specified with the
device, all extended commands will use inner opcodes larger than 0xFF.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>
Reviewed-by: Joshua Washington <joshwash@google.com>
---
 drivers/net/gve/base/gve_adminq.c | 30 ++++++++++++++++++++++++++++++
 drivers/net/gve/base/gve_adminq.h | 16 ++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/drivers/net/gve/base/gve_adminq.c b/drivers/net/gve/base/gve_adminq.c
index 64b9468..0cc6d44 100644
--- a/drivers/net/gve/base/gve_adminq.c
+++ b/drivers/net/gve/base/gve_adminq.c
@@ -438,6 +438,8 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,
 
 	memcpy(cmd, cmd_orig, sizeof(*cmd_orig));
 	opcode = be32_to_cpu(READ_ONCE32(cmd->opcode));
+	if (opcode == GVE_ADMINQ_EXTENDED_COMMAND)
+		opcode = be32_to_cpu(READ_ONCE32(cmd->extended_command.inner_opcode));
 
 	switch (opcode) {
 	case GVE_ADMINQ_DESCRIBE_DEVICE:
@@ -516,6 +518,34 @@ static int gve_adminq_execute_cmd(struct gve_priv *priv,
 	return gve_adminq_kick_and_wait(priv);
 }
 
+static int gve_adminq_execute_extended_cmd(struct gve_priv *priv, u32 opcode,
+					   size_t cmd_size, void *cmd_orig)
+{
+	union gve_adminq_command cmd;
+	struct gve_dma_mem inner_cmd_dma_mem;
+	void *inner_cmd;
+	int err;
+
+	inner_cmd = gve_alloc_dma_mem(&inner_cmd_dma_mem, cmd_size);
+	if (!inner_cmd)
+		return -ENOMEM;
+
+	memcpy(inner_cmd, cmd_orig, cmd_size);
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.opcode = cpu_to_be32(GVE_ADMINQ_EXTENDED_COMMAND);
+	cmd.extended_command = (struct gve_adminq_extended_command) {
+		.inner_opcode = cpu_to_be32(opcode),
+		.inner_length = cpu_to_be32(cmd_size),
+		.inner_command_addr = cpu_to_be64(inner_cmd_dma_mem.pa),
+	};
+
+	err = gve_adminq_execute_cmd(priv, &cmd);
+
+	gve_free_dma_mem(&inner_cmd_dma_mem);
+	return err;
+}
+
 /* The device specifies that the management vector can either be the first irq
  * or the last irq. ntfy_blk_msix_base_idx indicates the first irq assigned to
  * the ntfy blks. It if is 0 then the management vector is last, if it is 1 then
diff --git a/drivers/net/gve/base/gve_adminq.h b/drivers/net/gve/base/gve_adminq.h
index e237353..f52658e 100644
--- a/drivers/net/gve/base/gve_adminq.h
+++ b/drivers/net/gve/base/gve_adminq.h
@@ -25,8 +25,15 @@ enum gve_adminq_opcodes {
 	GVE_ADMINQ_REPORT_LINK_SPEED		= 0xD,
 	GVE_ADMINQ_GET_PTYPE_MAP		= 0xE,
 	GVE_ADMINQ_VERIFY_DRIVER_COMPATIBILITY	= 0xF,
+	/* For commands that are larger than 56 bytes */
+	GVE_ADMINQ_EXTENDED_COMMAND		= 0xFF,
 };
 
+/* The normal adminq command is restricted to be 56 bytes at maximum. For the
+ * longer adminq command, it is wrapped by GVE_ADMINQ_EXTENDED_COMMAND with
+ * inner opcode of gve_adminq_extended_cmd_opcodes specified. The inner command
+ * is written in the dma memory allocated by GVE_ADMINQ_EXTENDED_COMMAND.
+ */
 /* Admin queue status codes */
 enum gve_adminq_statuses {
 	GVE_ADMINQ_COMMAND_UNSET			= 0x0,
@@ -194,6 +201,14 @@ enum gve_driver_capbility {
 #define GVE_DRIVER_CAPABILITY_FLAGS3 0x0
 #define GVE_DRIVER_CAPABILITY_FLAGS4 0x0
 
+struct gve_adminq_extended_command {
+	__be32 inner_opcode;
+	__be32 inner_length;
+	__be64 inner_command_addr;
+};
+
+GVE_CHECK_STRUCT_LEN(16, gve_adminq_extended_command);
+
 struct gve_driver_info {
 	u8 os_type;	/* 0x05 = DPDK */
 	u8 driver_major;
@@ -440,6 +455,7 @@ union gve_adminq_command {
 			struct gve_adminq_get_ptype_map get_ptype_map;
 			struct gve_adminq_verify_driver_compatibility
 				verify_driver_compatibility;
+			struct gve_adminq_extended_command extended_command;
 		};
 	};
 	u8 reserved[64];
-- 
2.53.0.473.g4a7958ca14-goog


  parent reply	other threads:[~2026-03-03  0:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 19:51 [PATCH 0/4] net/gve: add flow steering support Jasper Tran O'Leary
2026-02-27 19:51 ` [PATCH 1/4] net/gve: add flow steering device option Jasper Tran O'Leary
2026-02-27 19:51 ` [PATCH 2/4] net/gve: introduce extended adminq command Jasper Tran O'Leary
2026-02-27 19:51 ` [PATCH 3/4] net/gve: add adminq commands for flow steering Jasper Tran O'Leary
2026-02-27 19:51 ` [PATCH 4/4] net/gve: add rte flow API integration Jasper Tran O'Leary
2026-02-27 22:52 ` [PATCH 0/4] net/gve: add flow steering support Stephen Hemminger
2026-03-03  1:00   ` Jasper Tran O'Leary
2026-03-03  0:58 ` [PATCH v2 " Jasper Tran O'Leary
2026-03-03  0:58   ` [PATCH v2 1/4] net/gve: add flow steering device option Jasper Tran O'Leary
2026-03-03  0:58   ` Jasper Tran O'Leary [this message]
2026-03-03  0:58   ` [PATCH v2 3/4] net/gve: add adminq commands for flow steering Jasper Tran O'Leary
2026-03-03  0:58   ` [PATCH v2 4/4] net/gve: add rte flow API integration Jasper Tran O'Leary
2026-03-03 15:21   ` [PATCH v2 0/4] net/gve: add flow steering support Stephen Hemminger
2026-03-04  1:49     ` Jasper Tran O'Leary
2026-03-04  1:46   ` [PATCH v3 " Jasper Tran O'Leary
2026-03-04  1:46     ` [PATCH v3 1/4] net/gve: add flow steering device option Jasper Tran O'Leary
2026-03-04  1:46     ` [PATCH v3 2/4] net/gve: introduce extended adminq command Jasper Tran O'Leary
2026-03-04  1:46     ` [PATCH v3 3/4] net/gve: add adminq commands for flow steering Jasper Tran O'Leary
2026-03-04  1:46     ` [PATCH v3 4/4] net/gve: add rte flow API integration Jasper Tran O'Leary
2026-03-04  4:46     ` [PATCH v3 0/4] net/gve: add flow steering support Jasper Tran O'Leary
2026-03-04  4:50     ` [PATCH v4 " Jasper Tran O'Leary
2026-03-04  4:50       ` [PATCH v4 1/4] net/gve: add flow steering device option Jasper Tran O'Leary
2026-03-04  4:50       ` [PATCH v4 2/4] net/gve: introduce extended adminq command Jasper Tran O'Leary
2026-03-04  4:50       ` [PATCH v4 3/4] net/gve: add adminq commands for flow steering Jasper Tran O'Leary
2026-03-04  4:50       ` [PATCH v4 4/4] net/gve: add rte flow API integration Jasper Tran O'Leary
2026-03-04 15:59       ` [PATCH v4 0/4] net/gve: add flow steering support Stephen Hemminger
2026-03-04 22:43         ` Jasper Tran O'Leary

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=20260303005804.924545-3-jtranoleary@google.com \
    --to=jtranoleary@google.com \
    --cc=dev@dpdk.org \
    --cc=joshwash@google.com \
    --cc=stephen@networkplumber.org \
    --cc=veethebee@google.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