DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wenjing Qiao <wenjing.qiao@intel.com>
To: jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com
Cc: dev@dpdk.org, Wenjing Qiao <wenjing.qiao@intel.com>,
	Nizan Zorea <nizan.zorea@intel.com>
Subject: [PATCH 15/18] common/idpf: add/delete queue groups commands
Date: Thu, 13 Apr 2023 05:44:59 -0400	[thread overview]
Message-ID: <20230413094502.1714755-16-wenjing.qiao@intel.com> (raw)
In-Reply-To: <20230413094502.1714755-1-wenjing.qiao@intel.com>

Add types for new two virtchnl commands: add & delete queue group

Signed-off-by: Nizan Zorea <nizan.zorea@intel.com>
Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/common/idpf/base/virtchnl2.h | 189 +++++++++++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h
index 415e90358e..9e70e5b10e 100644
--- a/drivers/common/idpf/base/virtchnl2.h
+++ b/drivers/common/idpf/base/virtchnl2.h
@@ -95,6 +95,8 @@
 #define		VIRTCHNL2_OP_ADD_MAC_ADDR		535
 #define		VIRTCHNL2_OP_DEL_MAC_ADDR		536
 #define		VIRTCHNL2_OP_CONFIG_PROMISCUOUS_MODE	537
+#define		VIRTCHNL2_OP_ADD_QUEUE_GROUPS		538
+#define		VIRTCHNL2_OP_DEL_QUEUE_GROUPS		539
 
 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX	0xFFFF
 
@@ -345,6 +347,14 @@
 #define VIRTCHNL2_UNICAST_PROMISC		BIT(0)
 #define VIRTCHNL2_MULTICAST_PROMISC		BIT(1)
 
+/* VIRTCHNL2_QUEUE_GROUP_TYPE
+ * Type of queue groups
+ * 0 till 0xFF is for general use
+ */
+#define VIRTCHNL2_QUEUE_GROUP_DATA		1
+#define VIRTCHNL2_QUEUE_GROUP_MBX		2
+#define VIRTCHNL2_QUEUE_GROUP_CONFIG		3
+
 /* VIRTCHNL2_PROTO_HDR_TYPE
  * Protocol header type within a packet segment. A segment consists of one or
  * more protocol headers that make up a logical group of protocol headers. Each
@@ -794,6 +804,133 @@ struct virtchnl2_add_queues {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(56, virtchnl2_add_queues);
 
+/* Queue Groups Extension */
+
+struct virtchnl2_rx_queue_group_info {
+	/* IN/OUT, user can ask to update rss_lut size originally allocated
+	 * by CreateVport command. New size will be returned if allocation
+	 * suceeded, otherwise original rss_size from CreateVport will
+	 * be returned.
+	 */
+	__le16 rss_lut_size;
+	/* Future extension purpose */
+	u8 pad[6];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_rx_queue_group_info);
+
+struct virtchnl2_tx_queue_group_info { /* IN */
+	/* TX TC queue group will be connected to */
+	u8 tx_tc;
+	/* Each group can have its own priority, value 0-7, while each group
+	 * with unique priority is strict priority.
+	 * It can be single set of queue groups which configured with
+	 * same priority, then they are assumed part of WFQ arbitration
+	 * group and are expected to be assigned with weight.
+	 */
+	u8 priority;
+	/* Determines if queue group is expected to be Strict Priority
+	 * according to its priority
+	 */
+	u8 is_sp;
+	u8 pad;
+
+	/* Peak Info Rate Weight in case Queue Group is part of WFQ
+	 * arbitration set.
+	 * The weights of the groups are independent of each other.
+	 * Possible values: 1-200
+	 */
+	__le16 pir_weight;
+	/* Future extension purpose for CIR only */
+	u8 cir_pad[2];
+	/* Future extension purpose*/
+	u8 pad2[8];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_tx_queue_group_info);
+
+struct virtchnl2_queue_group_id {
+	/* Queue group ID - depended on it's type
+	 * Data: is an ID which is relative to Vport
+	 * Config & Mailbox: is an ID which is relative to func.
+	 * This ID is use in future calls, i.e. delete.
+	 * Requested by host and assigned by Control plane.
+	 */
+	__le16 queue_group_id;
+	/* Functional type: see VIRTCHNL2_QUEUE_GROUP_TYPE definitions */
+	__le16 queue_group_type;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_queue_group_id);
+
+struct virtchnl2_queue_group_info {
+	/* IN */
+	struct virtchnl2_queue_group_id qg_id;
+	/* IN, Number of queue of different types in the group. */
+	__le16 num_tx_q;
+	__le16 num_tx_complq;
+	__le16 num_rx_q;
+	__le16 num_rx_bufq;
+
+	struct virtchnl2_tx_queue_group_info tx_q_grp_info;
+	struct virtchnl2_rx_queue_group_info rx_q_grp_info;
+	/* Future extension purpose */
+	u8 pad[40];
+	struct virtchnl2_queue_reg_chunks chunks; /* OUT */
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(120, virtchnl2_queue_group_info);
+
+struct virtchnl2_queue_groups {
+	__le16 num_queue_groups;
+	u8 pad[6];
+	struct virtchnl2_queue_group_info groups[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(128, virtchnl2_queue_groups);
+
+/* VIRTCHNL2_OP_ADD_QUEUE_GROUPS
+ * PF sends this message to request additional transmit/receive queue groups
+ * beyond the ones that were assigned via CREATE_VPORT request.
+ * virtchnl2_add_queue_groups structure is used to specify the number of each
+ * type of queues. CP responds with the same structure with the actual number of
+ * groups and queues assigned followed by num_queue_groups and num_chunks of
+ * virtchnl2_queue_groups and virtchnl2_queue_chunk structures.
+ */
+struct virtchnl2_add_queue_groups {
+	/* IN, vport_id to add queue group to, same as allocated by CreateVport.
+	 * NA for mailbox and other types not assigned to vport
+	 */
+	__le32 vport_id;
+	u8 pad[4];
+	/* IN/OUT */
+	struct virtchnl2_queue_groups qg_info;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(136, virtchnl2_add_queue_groups);
+
+/* VIRTCHNL2_OP_DEL_QUEUE_GROUPS
+ * PF sends this message to delete queue groups.
+ * PF sends virtchnl2_delete_queue_groups struct to specify the queue groups
+ * to be deleted. CP performs requested action and returns status and update
+ * num_queue_groups with number of successfully deleted queue groups.
+ */
+struct virtchnl2_delete_queue_groups {
+	/* IN, vport_id to delete queue group from, same as
+	 * allocated by CreateVport.
+	 */
+	__le32 vport_id;
+	/* IN/OUT, Defines number of groups provided below */
+	__le16 num_queue_groups;
+	u8 pad[2];
+
+	/* IN, IDs & types of Queue Groups to delete */
+	struct virtchnl2_queue_group_id qg_ids[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_delete_queue_groups);
+
 /* Structure to specify a chunk of contiguous interrupt vectors */
 struct virtchnl2_vector_chunk {
 	__le16 start_vector_id;
@@ -1243,6 +1380,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_CREATE_ADI";
 	case VIRTCHNL2_OP_DESTROY_ADI:
 		return "VIRTCHNL2_OP_DESTROY_ADI";
+	case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
+		return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS";
+	case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
+		return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS";
 	default:
 		return "Unsupported (update virtchnl2.h)";
 	}
@@ -1373,6 +1514,54 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_queue_chunk);
 		}
 		break;
+	case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
+		valid_len = sizeof(struct virtchnl2_add_queue_groups);
+		if (msglen != valid_len) {
+			__le32 i = 0, offset = 0;
+			struct virtchnl2_add_queue_groups *add_queue_grp =
+				(struct virtchnl2_add_queue_groups *)msg;
+			struct virtchnl2_queue_groups *groups = &(add_queue_grp->qg_info);
+			struct virtchnl2_queue_group_info *grp_info;
+			__le32 chunk_size = sizeof(struct virtchnl2_queue_reg_chunk);
+			__le32 group_size = sizeof(struct virtchnl2_queue_group_info);
+			__le32 total_chunks_size;
+
+			if (groups->num_queue_groups == 0) {
+				err_msg_format = true;
+				break;
+			}
+			valid_len += (groups->num_queue_groups - 1) *
+				      sizeof(struct virtchnl2_queue_group_info);
+			offset = (u8 *)(&groups->groups[0]) - (u8 *)groups;
+
+			for (i = 0; i < groups->num_queue_groups; i++) {
+				grp_info = (struct virtchnl2_queue_group_info *)
+						   ((u8 *)groups + offset);
+				if (grp_info->chunks.num_chunks == 0) {
+					offset += group_size;
+					continue;
+				}
+				total_chunks_size = (grp_info->chunks.num_chunks - 1) * chunk_size;
+				offset += group_size + total_chunks_size;
+				valid_len += total_chunks_size;
+			}
+		}
+		break;
+	case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
+		valid_len = sizeof(struct virtchnl2_delete_queue_groups);
+		if (msglen != valid_len) {
+			struct virtchnl2_delete_queue_groups *del_queue_grp =
+				(struct virtchnl2_delete_queue_groups *)msg;
+
+			if (del_queue_grp->num_queue_groups == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += (del_queue_grp->num_queue_groups - 1) *
+				      sizeof(struct virtchnl2_queue_group_id);
+		}
+		break;
 	case VIRTCHNL2_OP_MAP_QUEUE_VECTOR:
 	case VIRTCHNL2_OP_UNMAP_QUEUE_VECTOR:
 		valid_len = sizeof(struct virtchnl2_queue_vector_maps);
-- 
2.25.1


  parent reply	other threads:[~2023-04-13  9:52 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13  9:44 [PATCH 00/18] update idpf shared code Wenjing Qiao
2023-04-13  9:44 ` [PATCH 01/18] common/idpf: support flow subscription Wenjing Qiao
2023-04-21  8:40   ` [PATCH v2 00/15] update idpf shared code Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 01/15] common/idpf: remove virtchnl related " Wenjing Qiao
2023-04-24 11:52       ` Zhang, Qi Z
2023-04-26 10:22       ` [PATCH v3 00/15] update idpf base code Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 01/15] common/idpf/base: remove virtchnl related " Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 02/15] common/idpf/base: fix ctlq message send and receive Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 03/15] common/idpf/base: fix ITR register definitions for AVF Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 04/15] common/idpf/base: remove qregion struct variables Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 05/15] common/idpf/base: move OEM capability to the last bit Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 06/15] common/idpf/base: modify SSO/LSO and ITR fields Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 07/15] common/idpf/base: add virtchnl2 error codes Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 08/15] common/idpf/base: swap opcode and retval location in msg struct Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 09/15] common/idpf/base: fix idpf_send_msg_to_cp prototypes Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 10/15] common/idpf/base: fix memory leaks on ctrlq functions Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 11/15] common/idpf/base: allocate static buffer at initialization Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 12/15] common/idpf/base: replace MAKEMASK to IDPF_M Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 13/15] common/idpf/base: add/delete queue groups commands Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 14/15] common/idpf/base: add func to clean all DESCs on controlq Wenjing Qiao
2023-04-26 10:22         ` [PATCH v3 15/15] common/idpf/base: update license and README Wenjing Qiao
2023-04-26 11:56           ` Zhang, Qi Z
2023-06-12 10:18           ` Thomas Monjalon
2023-04-26 12:40         ` [PATCH v3 00/15] update idpf base code Zhang, Qi Z
2023-04-21  8:40     ` [PATCH v2 02/15] common/idpf: fix ctlq message send and receive Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 03/15] common/idpf: fix ITR register definitions for AVF Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 04/15] common/idpf: remove qregion struct variables Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 05/15] common/idpf: move OEM capability to the last bit Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 06/15] common/idpf: modify SSO/LSO and ITR fields Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 07/15] common/idpf: add virtchnl2 error codes Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 08/15] common/idpf: swap opcode and retval location in msg struct Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 09/15] common/idpf: fix idpf_send_msg_to_cp prototypes Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 10/15] common/idpf: fix memory leaks on ctrlq functions Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 11/15] common/idpf: allocate static buffer at initialization Wenjing Qiao
2023-04-24 12:15       ` Zhang, Qi Z
2023-04-21  8:40     ` [PATCH v2 12/15] common/idpf: replace MAKEMASK to IDPF_M Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 13/15] common/idpf: add/delete queue groups commands Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 14/15] common/idpf: add func to clean all DESCs on controlq Wenjing Qiao
2023-04-21  8:40     ` [PATCH v2 15/15] common/idpf: update license and README Wenjing Qiao
2023-04-13  9:44 ` [PATCH 02/18] common/idpf: fix ctlq message send and receive Wenjing Qiao
2023-04-13  9:44 ` [PATCH 03/18] common/idpf: fix ITR register definitions for AVF Wenjing Qiao
2023-04-13  9:44 ` [PATCH 04/18] common/idpf: remove qregion struct variables Wenjing Qiao
2023-04-13  9:44 ` [PATCH 05/18] common/idpf: move OEM capability to the last bit Wenjing Qiao
2023-04-13  9:44 ` [PATCH 06/18] common/idpf: modify SSO/LSO and ITR fields Wenjing Qiao
2023-04-13  9:44 ` [PATCH 07/18] common/idpf: add virtchnl2 error codes Wenjing Qiao
2023-04-13  9:44 ` [PATCH 08/18] common/idpf: swap opcode and retval location in msg struct Wenjing Qiao
2023-04-13  9:44 ` [PATCH 09/18] common/idpf: fix idpf_send_msg_to_cp prototypes Wenjing Qiao
2023-04-13  9:44 ` [PATCH 10/18] common/idpf: fix memory leaks on ctrlq functions Wenjing Qiao
2023-04-13  9:44 ` [PATCH 11/18] common/idpf: allocate static buffer at initialization Wenjing Qiao
2023-04-13  9:44 ` [PATCH 12/18] common/idpf: add SyncE support over VF Wenjing Qiao
2023-04-13  9:44 ` [PATCH 13/18] common/idpf: replace MAKEMASK to IDPF_M Wenjing Qiao
2023-04-13  9:44 ` [PATCH 14/18] common/idpf: add GNSS support over VF Wenjing Qiao
2023-04-13  9:44 ` Wenjing Qiao [this message]
2023-04-13  9:45 ` [PATCH 16/18] common/idpf: add func to clean all DESCs on controlq Wenjing Qiao
2023-04-13  9:45 ` [PATCH 17/18] common/idpf: fix cannot understand warnings Wenjing Qiao
2023-04-13  9:45 ` [PATCH 18/18] common/idpf: update license and README Wenjing Qiao

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=20230413094502.1714755-16-wenjing.qiao@intel.com \
    --to=wenjing.qiao@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=nizan.zorea@intel.com \
    --cc=qi.z.zhang@intel.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).