Skip to contentSkip to conversation

update idpf base code

PATCH In review Wenjing Qiao 5 participants 85 messages Aug 9, 2023 – Sep 21, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

cover update idpf base code

This patch set updates idpf base code.

Simei Su (14):
common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initial PTP support common/idpf/base: remove mailbox registers common/idpf/base: add some adi specific fields common/idpf/base: add necessary check common/idpf/base: add union for SW cookie fields in ctlq msg common/idpf/base: define non-flexible size structure for ADI common/idpf/base: use local pointer before updating 'CQ out' common/idpf/base: use 'void' return type common/idpf/base: refactor descriptor 'ret val' stripping common/idpf/base: refine comments and alignment common/idpf/base: use GENMASK macro common/idpf/base: use 'type functionname(args)' style

 .mailmap                                      |   7 +
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 159 +++++----
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 303 ++++++++++++++++--
 12 files changed, 456 insertions(+), 205 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/14 common/idpf/base: enable support for physical port stats

From: Simei Su <[email protected]>

Add support to indicate physical port representor and query its statistics.

---
 .mailmap                             |  2 +
 drivers/common/idpf/base/virtchnl2.h | 80 +++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
.mailmap +2 -0
index 864d33ee46..8f90e6f972 100644
@@ -1638,3 +1638,5 @@ Ziye Yang <[email protected]>
 Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
+Jayaprakash Shanmugam <[email protected]>
+Zhenning Xiao <[email protected]>
drivers/common/idpf/base/virtchnl2.h +79 -1

116 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/14 common/idpf/base: add miss completion capabilities

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Add miss completion tag to other capabilities list, to indicate support for detecting a miss completion based on the upper bit of the completion tag.

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 4 ++++
 2 files changed, 5 insertions(+)
.mailmap +1 -0
index 8f90e6f972..af452d54c6 100644
@@ -1640,3 +1640,4 @@ Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
+Josh Hay <[email protected]>
drivers/common/idpf/base/virtchnl2.h +4 -0
index cd47444835..c49e4b943c 100644
@@ -231,6 +231,10 @@
 #define VIRTCHNL2_CAP_RX_FLEX_DESC		BIT(17)
 #define VIRTCHNL2_CAP_PTYPE			BIT(18)
 #define VIRTCHNL2_CAP_LOOPBACK			BIT(19)
+/* Enable miss completion types plus ability to detect a miss completion if a
+ * reserved bit is set in a standared completion's tag.
+ */
+#define VIRTCHNL2_CAP_MISS_COMPL_TAG		BIT(20)
 /* this must be the last capability */
 #define VIRTCHNL2_CAP_OEM			BIT(63)
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/14 common/idpf/base: initial PTP support

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Adding a few PTP capabilities to determine which PTP features are enabled - legacy cross time, ptm, device clock control, PTP Tx timestamp with direct registers access, PTP Tx timestamp using virtchnl messages.

Creating structures and opcodes to support feautres introduced by capabilities.

---
 drivers/common/idpf/base/virtchnl2.h | 145 +++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)
drivers/common/idpf/base/virtchnl2.h +145 -0
index c49e4b943c..320430df6f 100644
@@ -98,6 +98,9 @@
 #define		VIRTCHNL2_OP_ADD_QUEUE_GROUPS		538
 #define		VIRTCHNL2_OP_DEL_QUEUE_GROUPS		539
 #define		VIRTCHNL2_OP_GET_PORT_STATS		540
+	/* TimeSync opcodes */
+#define		VIRTCHNL2_OP_GET_PTP_CAPS		541
+#define		VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES	542
 
 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX	0xFFFF
 
@@ -1395,6 +1398,112 @@ struct virtchnl2_promisc_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_promisc_info);
 
+/* VIRTCHNL2_PTP_CAPS
+ * PTP capabilities
+ */
+#define VIRTCHNL2_PTP_CAP_LEGACY_CROSS_TIME	BIT(0)
+#define VIRTCHNL2_PTP_CAP_PTM			BIT(1)
+#define VIRTCHNL2_PTP_CAP_DEVICE_CLOCK_CONTROL	BIT(2)
+#define VIRTCHNL2_PTP_CAP_TX_TSTAMPS_DIRECT	BIT(3)
+#define	VIRTCHNL2_PTP_CAP_TX_TSTAMPS_VIRTCHNL	BIT(4)
+
+/* Legacy cross time registers offsets */
+struct virtchnl2_ptp_legacy_cross_time_reg {
+	__le32 shadow_time_0;
+	__le32 shadow_time_l;
+	__le32 shadow_time_h;
+	__le32 cmd_sync;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_legacy_cross_time_reg);
+
+/* PTM cross time registers offsets */
+struct virtchnl2_ptp_ptm_cross_time_reg {
+	__le32 art_l;
+	__le32 art_h;
+	__le32 cmd_sync;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_ptm_cross_time_reg);
+
+/* Registers needed to control the main clock */
+struct virtchnl2_ptp_device_clock_control {
+	__le32 cmd;
+	__le32 incval_l;
+	__le32 incval_h;
+	__le32 shadj_l;
+	__le32 shadj_h;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_device_clock_control);
+
+/* Structure that defines tx tstamp entry - index and register offset */
+struct virtchnl2_ptp_tx_tstamp_entry {
+	__le32 tx_latch_register_base;
+	__le32 tx_latch_register_offset;
+	u8 index;
+	u8 pad[7];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_entry);
+
+/* Structure that defines tx tstamp entries - total number of latches
+ * and the array of entries.
+ */
+struct virtchnl2_ptp_tx_tstamp {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_entry ptp_tx_tstamp_entries[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp);
+
+/* VIRTCHNL2_OP_GET_PTP_CAPS
+ * PV/VF sends this message to negotiate PTP capabilities. CP updates bitmap
+ * with supported features and fulfills appropriate structures.
+ */
+struct virtchnl2_get_ptp_caps {
+	/* PTP capability bitmap */
+	/* see VIRTCHNL2_PTP_CAPS definitions */
+	__le32 ptp_caps;
+	u8 pad[4];
+
+	struct virtchnl2_ptp_legacy_cross_time_reg legacy_cross_time_reg;
+	struct virtchnl2_ptp_ptm_cross_time_reg ptm_cross_time_reg;
+	struct virtchnl2_ptp_device_clock_control device_clock_control;
+	struct virtchnl2_ptp_tx_tstamp tx_tstamp;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(88, virtchnl2_get_ptp_caps);
+
+/* Structure that describes tx tstamp values, index and validity */
+struct virtchnl2_ptp_tx_tstamp_latch {
+	__le32 tstamp_h;
+	__le32 tstamp_l;
+	u8 index;
+	u8 valid;
+	u8 pad[6];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_latch);
+
+/* VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES
+ * PF/VF sends this message to receive a specified number of timestamps
+ * entries.
+ */
+struct virtchnl2_ptp_tx_tstamp_latches {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_latch tstamp_latches[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp_latches);
 
 static inline const char *virtchnl2_op_str(__le32 v_opcode)
 {
@@ -1463,6 +1572,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_GET_PORT_STATS:
 		return "VIRTCHNL2_OP_GET_PORT_STATS";
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		return "VIRTCHNL2_OP_GET_PTP_CAPS";
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		return "VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES";
 	default:
 		return "Unsupported (update virtchnl2.h)";
 	}
@@ -1732,6 +1845,38 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 		break;
 	case VIRTCHNL2_OP_RESET_VF:
 		break;
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		valid_len = sizeof(struct virtchnl2_get_ptp_caps);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_get_ptp_caps *ptp_caps =
+			(struct virtchnl2_get_ptp_caps *)msg;
+
+			if (ptp_caps->tx_tstamp.num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((ptp_caps->tx_tstamp.num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_entry));
+		}
+		break;
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches =
+			(struct virtchnl2_ptp_tx_tstamp_latches *)msg;
+
+			if (tx_tstamp_latches->num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((tx_tstamp_latches->num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_latch));
+		}
+		break;
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL2_OP_EVENT:
 	case VIRTCHNL2_OP_UNKNOWN:
Signature · 1 line
2.34.1
#4 lore raw

RE: [PATCH 03/14] common/idpf/base: initial PTP support

Quoted 12 lines

-----Original Message-----
From: Qiao, Wenjing <[email protected]>
Sent: Wednesday, August 9, 2023 9:33 AM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Liu, Mingxia <[email protected]>; Qiao, Wenjing <[email protected]>; Su, Simei <[email protected]>; Olech, Milena <[email protected]>
Subject: [PATCH 03/14] common/idpf/base: initial PTP support

drivers/common/idpf/base/virtchnl2.h struct virtchnl2_promisc_info { · line 1408

Quoted 8 lines
drivers/common/idpf/base/virtchnl2.h +8 -0
+/* VIRTCHNL2_PTP_CAPS
+ * PTP capabilities
+ */
+#define VIRTCHNL2_PTP_CAP_LEGACY_CROSS_TIME	BIT(0)
+#define VIRTCHNL2_PTP_CAP_PTM			BIT(1)
+#define VIRTCHNL2_PTP_CAP_DEVICE_CLOCK_CONTROL	BIT(2)
+#define VIRTCHNL2_PTP_CAP_TX_TSTAMPS_DIRECT	BIT(3)
+#define	VIRTCHNL2_PTP_CAP_TX_TSTAMPS_VIRTCHNL	BIT(4)

[Liu, Mingxia] Spaces need to be aligned.

Quoted 1 line

+

#5 lore raw

PATCH 4/14 common/idpf/base: remove mailbox registers

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Removing mailbox register offsets as the mapping to device register offsets are different between CVL and MEV (they are swapped out) individual drivers will define the offsets based on how registers are hardware addressed. However the it will begin with VDEV_MBX_START offset.

---
 .mailmap                             |  1 +
 drivers/common/idpf/base/siov_regs.h | 13 ++-----------
 2 files changed, 3 insertions(+), 11 deletions(-)
.mailmap +1 -0
index af452d54c6..f23f8fecfa 100644
@@ -1641,3 +1641,4 @@ Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
+Madhu Chittim <[email protected]>
drivers/common/idpf/base/siov_regs.h +2 -11
index fad329601a..7e1ae2e300 100644
@@ -4,16 +4,6 @@
 #ifndef _SIOV_REGS_H_
 #define _SIOV_REGS_H_
 #define VDEV_MBX_START			0x20000 /* Begin at 128KB */
-#define VDEV_MBX_ATQBAL			(VDEV_MBX_START + 0x0000)
-#define VDEV_MBX_ATQBAH			(VDEV_MBX_START + 0x0004)
-#define VDEV_MBX_ATQLEN			(VDEV_MBX_START + 0x0008)
-#define VDEV_MBX_ATQH			(VDEV_MBX_START + 0x000C)
-#define VDEV_MBX_ATQT			(VDEV_MBX_START + 0x0010)
-#define VDEV_MBX_ARQBAL			(VDEV_MBX_START + 0x0014)
-#define VDEV_MBX_ARQBAH			(VDEV_MBX_START + 0x0018)
-#define VDEV_MBX_ARQLEN			(VDEV_MBX_START + 0x001C)
-#define VDEV_MBX_ARQH			(VDEV_MBX_START + 0x0020)
-#define VDEV_MBX_ARQT			(VDEV_MBX_START + 0x0024)
 #define VDEV_GET_RSTAT			0x21000 /* 132KB for RSTAT */
 
 /* Begin at offset after 1MB (after 256 4k pages) */
@@ -43,5 +33,6 @@
 #define VDEV_INT_ITR_1(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x08)
 #define VDEV_INT_ITR_2(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x0C)
 
-/* Next offset to begin at 42MB (0x2A00000) */
+#define SIOV_REG_BAR_SIZE               0x2A00000
+/* Next offset to begin at 42MB + 4K (0x2A00000 + 0x1000) */
 #endif /* _SIOV_REGS_H_ */
Signature · 1 line
2.34.1
#6 lore raw

PATCH 5/14 common/idpf/base: add some adi specific fields

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

a) Add maximum ADI count in capabilities message
b) Add PF side ADI index to create_adi message
c) Define another constant to indicate 'Function active' state of ADI

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
.mailmap +1 -0
index f23f8fecfa..3879b5a33f 100644
@@ -1642,3 +1642,4 @@ Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
+Shailendra Bhatnagar <[email protected]>
drivers/common/idpf/base/virtchnl2.h +6 -2
index 320430df6f..7a099f5148 100644
@@ -294,6 +294,7 @@
 /* These messages are only sent to PF from CP */
 #define VIRTCHNL2_EVENT_START_RESET_ADI		2
 #define VIRTCHNL2_EVENT_FINISH_RESET_ADI	3
+#define VIRTCHNL2_EVENT_ADI_ACTIVE		4
 
 /* VIRTCHNL2_QUEUE_TYPE
  * Transmit and Receive queue types are valid in legacy as well as split queue
@@ -547,7 +548,8 @@ struct virtchnl2_get_capabilities {
 	u8 max_sg_bufs_per_tx_pkt;
 
 	u8 reserved1;
-	__le16 pad1;
+	/* upper bound of number of ADIs supported */
+	__le16 max_adis;
 
 	/* version of Control Plane that is running */
 	__le16 oem_cp_ver_major;
@@ -1076,10 +1078,12 @@ struct virtchnl2_create_adi {
 	__le16 mbx_id;
 	/* PF sends mailbox vector id to CP */
 	__le16 mbx_vec_id;
+	/* PF populates this ADI index */
+	__le16 adi_index;
 	/* CP populates ADI id */
 	__le16 adi_id;
 	u8 reserved[64];
-	u8 pad[6];
+	u8 pad[4];
 	/* CP populates queue chunks */
 	struct virtchnl2_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
Signature · 1 line
2.34.1
#7 lore raw

PATCH 6/14 common/idpf/base: add necessary check

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Add necessary check for payload and message buffer.

---
 .mailmap                               | 1 +
 drivers/common/idpf/base/idpf_common.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
.mailmap +1 -0
index 3879b5a33f..7400692544 100644
@@ -1643,3 +1643,4 @@ Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
+Julianx Grajkowski <[email protected]>
drivers/common/idpf/base/idpf_common.c +4 -2
index fbf71416fd..9610916aa9 100644
@@ -239,8 +239,10 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 	e->desc.ret_val = msg.status;
 	e->desc.datalen = msg.data_len;
 	if (msg.data_len > 0) {
-		if (!msg.ctx.indirect.payload)
-			return -EINVAL;
+		if (!msg.ctx.indirect.payload || !msg.ctx.indirect.payload->va ||
+		    !e->msg_buf) {
+			return -EFAULT;
+		}
 		e->buf_len = msg.data_len;
 		msg_data_len = msg.data_len;
 		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,
Signature · 1 line
2.34.1
#8 lore raw

PATCH 7/14 common/idpf/base: add union for SW cookie fields in ctlq msg

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Instead of using something like a byte offset, we can add a union to the struct here to enable direct addressing.

---
 .mailmap                                     | 1 +
 drivers/common/idpf/base/idpf_controlq_api.h | 5 +++++
 2 files changed, 6 insertions(+)
.mailmap +1 -0
index 7400692544..ff96bc7d0e 100644
@@ -1644,3 +1644,4 @@ Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
 Julianx Grajkowski <[email protected]>
+Alan Brady <[email protected]>
drivers/common/idpf/base/idpf_controlq_api.h +5 -0
index 3780304256..f4e7b53ac9 100644
@@ -77,6 +77,11 @@ struct idpf_ctlq_msg {
 			u8 context[IDPF_INDIRECT_CTX_SIZE];
 			struct idpf_dma_mem *payload;
 		} indirect;
+		struct {
+			u32 rsvd;
+			u16 data;
+			u16 flags;
+		} sw_cookie;
 	} ctx;
 };
 
Signature · 1 line
2.34.1
#9 lore raw

PATCH 8/14 common/idpf/base: define non-flexible size structure for ADI

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Customer has a requirement to use the legacy fixed size, single chunk structure for ADI creation - one chunk for queue and one chunk for vector. This is described in detail in customer case
https://issuetracker.google.com/issues/270157802.

On the other hand, upstream code review patch has been posted with flex-array definitions. To accommodate the old style, the single chunk structures are being renamed so that merger of upstream patches with current code does not impact the existing workflows of the customer.

a) Define virtchnl2_non_flex_queue_reg_chunks with a single chunk in it.
b) Define virtchnl2_non_flex_vector_chunks with a single chunk in it.
c) Rename and modify virtchnl2_create_adi to use the above 2 new structs. New structure is virtchnl2_non_flex_create_adi.

---
 drivers/common/idpf/base/virtchnl2.h | 66 ++++++++++++++++++----------
 1 file changed, 43 insertions(+), 23 deletions(-)
drivers/common/idpf/base/virtchnl2.h +43 -23
index 7a099f5148..a19bb193c9 100644
@@ -89,8 +89,8 @@
 	 * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW
 	 */
 	/* opcodes 529, 530, and 531 are reserved */
-#define		VIRTCHNL2_OP_CREATE_ADI			532
-#define		VIRTCHNL2_OP_DESTROY_ADI		533
+#define		VIRTCHNL2_OP_NON_FLEX_CREATE_ADI	532
+#define		VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI	533
 #define		VIRTCHNL2_OP_LOOPBACK			534
 #define		VIRTCHNL2_OP_ADD_MAC_ADDR		535
 #define		VIRTCHNL2_OP_DEL_MAC_ADDR		536
@@ -1061,14 +1061,34 @@ struct virtchnl2_sriov_vfs_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_sriov_vfs_info);
 
-/* VIRTCHNL2_OP_CREATE_ADI
+/* structure to specify single chunk of queue */
+/* 'chunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_queue_reg_chunks {
+	__le16 num_chunks;
+	u8 reserved[6];
+	struct virtchnl2_queue_reg_chunk chunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_non_flex_queue_reg_chunks);
+
+/* structure to specify single chunk of interrupt vector */
+/* 'vchunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_vector_chunks {
+	__le16 num_vchunks;
+	u8 reserved[14];
+	struct virtchnl2_vector_chunk vchunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_non_flex_vector_chunks);
+
+/* VIRTCHNL2_OP_NON_FLEX_CREATE_ADI
  * PF sends this message to CP to create ADI by filling in required
- * fields of virtchnl2_create_adi structure.
- * CP responds with the updated virtchnl2_create_adi structure containing the
- * necessary fields followed by chunks which in turn will have an array of
+ * fields of virtchnl2_non_flex_create_adi structure.
+ * CP responds with the updated virtchnl2_non_flex_create_adi structure containing
+ * the necessary fields followed by chunks which in turn will have an array of
  * num_chunks entries of virtchnl2_queue_chunk structures.
  */
-struct virtchnl2_create_adi {
+struct virtchnl2_non_flex_create_adi {
 	/* PF sends PASID to CP */
 	__le32 pasid;
 	/*
@@ -1085,24 +1105,24 @@ struct virtchnl2_create_adi {
 	u8 reserved[64];
 	u8 pad[4];
 	/* CP populates queue chunks */
-	struct virtchnl2_queue_reg_chunks chunks;
+	struct virtchnl2_non_flex_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
-	struct virtchnl2_vector_chunks vchunks;
+	struct virtchnl2_non_flex_vector_chunks vchunks;
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_create_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_non_flex_create_adi);
 
-/* VIRTCHNL2_OP_DESTROY_ADI
+/* VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI
  * PF sends this message to CP to destroy ADI by filling
  * in the adi_id in virtchnl2_destropy_adi structure.
  * CP responds with the status of the requested operation.
  */
-struct virtchnl2_destroy_adi {
+struct virtchnl2_non_flex_destroy_adi {
 	__le16 adi_id;
 	u8 reserved[2];
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_destroy_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_non_flex_destroy_adi);
 
 /* Based on the descriptor type the PF supports, CP fills ptype_id_10 or
  * ptype_id_8 for flex and base descriptor respectively. If ptype_id_10 value
@@ -1566,10 +1586,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_EVENT";
 	case VIRTCHNL2_OP_RESET_VF:
 		return "VIRTCHNL2_OP_RESET_VF";
-	case VIRTCHNL2_OP_CREATE_ADI:
-		return "VIRTCHNL2_OP_CREATE_ADI";
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		return "VIRTCHNL2_OP_DESTROY_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_CREATE_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI";
 	case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
 		return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
@@ -1624,11 +1644,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_queue_reg_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_CREATE_ADI:
-		valid_len = sizeof(struct virtchnl2_create_adi);
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_create_adi);
 		if (msglen >= valid_len) {
-			struct virtchnl2_create_adi *cadi =
-				(struct virtchnl2_create_adi *)msg;
+			struct virtchnl2_non_flex_create_adi *cadi =
+				(struct virtchnl2_non_flex_create_adi *)msg;
 
 			if (cadi->chunks.num_chunks == 0) {
 				/* zero chunks is allowed as input */
@@ -1645,8 +1665,8 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_vector_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		valid_len = sizeof(struct virtchnl2_destroy_adi);
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_destroy_adi);
 		break;
 	case VIRTCHNL2_OP_DESTROY_VPORT:
 	case VIRTCHNL2_OP_ENABLE_VPORT:
Signature · 1 line
2.34.1
#10 lore raw

PATCH 9/14 common/idpf/base: use local pointer before updating 'CQ out'

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Instead of updating directly to 'cq_out' double pointer, use a local pointer and update only when we return success.

---
 drivers/common/idpf/base/idpf_controlq.c | 43 +++++++++++++-----------
 1 file changed, 23 insertions(+), 20 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +23 -20
index 6815153e1d..b84a1ea046 100644
@@ -137,6 +137,7 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		  struct idpf_ctlq_create_info *qinfo,
 		  struct idpf_ctlq_info **cq_out)
 {
+	struct idpf_ctlq_info *cq;
 	bool is_rxq = false;
 	int status = 0;
 
@@ -145,26 +146,26 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 	    qinfo->buf_size > IDPF_CTLQ_MAX_BUF_LEN)
 		return -EINVAL;
 
-	*cq_out = (struct idpf_ctlq_info *)
-		idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
-	if (!(*cq_out))
+	cq = (struct idpf_ctlq_info *)
+	     idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
+	if (!cq)
 		return -ENOMEM;
 
-	(*cq_out)->cq_type = qinfo->type;
-	(*cq_out)->q_id = qinfo->id;
-	(*cq_out)->buf_size = qinfo->buf_size;
-	(*cq_out)->ring_size = qinfo->len;
+	(cq)->cq_type = qinfo->type;
+	(cq)->q_id = qinfo->id;
+	(cq)->buf_size = qinfo->buf_size;
+	(cq)->ring_size = qinfo->len;
 
-	(*cq_out)->next_to_use = 0;
-	(*cq_out)->next_to_clean = 0;
-	(*cq_out)->next_to_post = (*cq_out)->ring_size - 1;
+	(cq)->next_to_use = 0;
+	(cq)->next_to_clean = 0;
+	(cq)->next_to_post = cq->ring_size - 1;
 
 	switch (qinfo->type) {
 	case IDPF_CTLQ_TYPE_MAILBOX_RX:
 		is_rxq = true;
 		/* fallthrough */
 	case IDPF_CTLQ_TYPE_MAILBOX_TX:
-		status = idpf_ctlq_alloc_ring_res(hw, *cq_out);
+		status = idpf_ctlq_alloc_ring_res(hw, cq);
 		break;
 	default:
 		status = -EINVAL;
@@ -175,33 +176,35 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		goto init_free_q;
 
 	if (is_rxq) {
-		idpf_ctlq_init_rxq_bufs(*cq_out);
+		idpf_ctlq_init_rxq_bufs(cq);
 	} else {
 		/* Allocate the array of msg pointers for TX queues */
-		(*cq_out)->bi.tx_msg = (struct idpf_ctlq_msg **)
+		cq->bi.tx_msg = (struct idpf_ctlq_msg **)
 			idpf_calloc(hw, qinfo->len,
 				    sizeof(struct idpf_ctlq_msg *));
-		if (!(*cq_out)->bi.tx_msg) {
+		if (!cq->bi.tx_msg) {
 			status = -ENOMEM;
 			goto init_dealloc_q_mem;
 		}
 	}
 
-	idpf_ctlq_setup_regs(*cq_out, qinfo);
+	idpf_ctlq_setup_regs(cq, qinfo);
 
-	idpf_ctlq_init_regs(hw, *cq_out, is_rxq);
+	idpf_ctlq_init_regs(hw, cq, is_rxq);
 
-	idpf_init_lock(&(*cq_out)->cq_lock);
+	idpf_init_lock(&(cq->cq_lock));
 
-	LIST_INSERT_HEAD(&hw->cq_list_head, (*cq_out), cq_list);
+	LIST_INSERT_HEAD(&hw->cq_list_head, cq, cq_list);
 
+	*cq_out = cq;
 	return status;
 
 init_dealloc_q_mem:
 	/* free ring buffers and the ring itself */
-	idpf_ctlq_dealloc_ring_res(hw, *cq_out);
+	idpf_ctlq_dealloc_ring_res(hw, cq);
 init_free_q:
-	idpf_free(hw, *cq_out);
+	idpf_free(hw, cq);
+	cq = NULL;
 
 	return status;
 }
Signature · 1 line
2.34.1
#11 lore raw

PATCH 10/14 common/idpf/base: use 'void' return type

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

As idpf_ctlq_deinit always returns success, make it 'void' instead of returning only success. This also changes the return type for idpf_deinit_hw as 'void'.

Based on the upstream comments, explicit __le16 typecasting is not necessary as CPU_TO_LE16 is already being used.

---
 drivers/common/idpf/base/idpf_common.c       | 4 ++--
 drivers/common/idpf/base/idpf_controlq.c     | 7 ++-----
 drivers/common/idpf/base/idpf_controlq_api.h | 2 +-
 drivers/common/idpf/base/idpf_prototype.h    | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)
drivers/common/idpf/base/idpf_common.c +2 -2
index 9610916aa9..7181a7f14c 100644
@@ -262,12 +262,12 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
  *  idpf_deinit_hw - shutdown routine
  *  @hw: pointer to the hardware structure
  */
-int idpf_deinit_hw(struct idpf_hw *hw)
+void idpf_deinit_hw(struct idpf_hw *hw)
 {
 	hw->asq = NULL;
 	hw->arq = NULL;
 
-	return idpf_ctlq_deinit(hw);
+	idpf_ctlq_deinit(hw);
 }
 
 /**
drivers/common/idpf/base/idpf_controlq.c +2 -5
index b84a1ea046..7b12dfab18 100644
@@ -75,7 +75,7 @@ static void idpf_ctlq_init_rxq_bufs(struct idpf_ctlq_info *cq)
 		desc->flags =
 			CPU_TO_LE16(IDPF_CTLQ_FLAG_BUF | IDPF_CTLQ_FLAG_RD);
 		desc->opcode = 0;
-		desc->datalen = (__le16)CPU_TO_LE16(bi->size);
+		desc->datalen = CPU_TO_LE16(bi->size);
 		desc->ret_val = 0;
 		desc->cookie_high = 0;
 		desc->cookie_low = 0;
@@ -264,16 +264,13 @@ int idpf_ctlq_init(struct idpf_hw *hw, u8 num_q,
  * idpf_ctlq_deinit - destroy all control queues
  * @hw: pointer to hw struct
  */
-int idpf_ctlq_deinit(struct idpf_hw *hw)
+void idpf_ctlq_deinit(struct idpf_hw *hw)
 {
 	struct idpf_ctlq_info *cq = NULL, *tmp = NULL;
-	int ret_code = 0;
 
 	LIST_FOR_EACH_ENTRY_SAFE(cq, tmp, &hw->cq_list_head,
 				 idpf_ctlq_info, cq_list)
 		idpf_ctlq_remove(hw, cq);
-
-	return ret_code;
 }
 
 /**
drivers/common/idpf/base/idpf_controlq_api.h +1 -1
index f4e7b53ac9..78a54f6b4c 100644
@@ -205,6 +205,6 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw,
 			    struct idpf_dma_mem **buffs);
 
 /* Will destroy all q including the default mb */
-int idpf_ctlq_deinit(struct idpf_hw *hw);
+void idpf_ctlq_deinit(struct idpf_hw *hw);
 
 #endif /* _IDPF_CONTROLQ_API_H_ */
drivers/common/idpf/base/idpf_prototype.h +1 -1
index 988ff00506..e2f090a9e3 100644
@@ -20,7 +20,7 @@
 #define APF
 
 int idpf_init_hw(struct idpf_hw *hw, struct idpf_ctlq_size ctlq_size);
-int idpf_deinit_hw(struct idpf_hw *hw);
+void idpf_deinit_hw(struct idpf_hw *hw);
 
 int idpf_clean_arq_element(struct idpf_hw *hw,
 			   struct idpf_arq_event_info *e,
Signature · 1 line
2.34.1
#12 lore raw

PATCH 11/14 common/idpf/base: refactor descriptor 'ret val' stripping

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Conditional check is not necessary to strip and get status bits from the descriptor.

---
 drivers/common/idpf/base/idpf_controlq.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -5
index 7b12dfab18..da5c930578 100644
@@ -426,11 +426,8 @@ static int __idpf_ctlq_clean_sq(struct idpf_ctlq_info *cq, u16 *clean_count,
 		if (!force && !(LE16_TO_CPU(desc->flags) & IDPF_CTLQ_FLAG_DD))
 			break;
 
-		desc_err = LE16_TO_CPU(desc->ret_val);
-		if (desc_err) {
-			/* strip off FW internal code */
-			desc_err &= 0xff;
-		}
+		/* strip off FW internal code */
+		desc_err = LE16_TO_CPU(desc->ret_val) & 0xff;
 
 		msg_status[i] = cq->bi.tx_msg[ntc];
 		if (!msg_status[i])
Signature · 1 line
2.34.1
#13 lore raw

PATCH 12/14 common/idpf/base: refine comments and alignment

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Refine the macros and definitions by using 'tab' spaces and new lines whereever necessary. Also refine the comment in 'idpf_ctlq_setup_regs'.

---
 drivers/common/idpf/base/idpf_controlq.c     |  2 +-
 drivers/common/idpf/base/idpf_controlq_api.h | 10 +----
 drivers/common/idpf/base/idpf_lan_pf_regs.h  |  7 ++--
 drivers/common/idpf/base/idpf_lan_txrx.h     | 43 ++++++++++----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h  | 25 ++++++++----
 5 files changed, 46 insertions(+), 41 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +1 -1
index da5c930578..c24bfd23ef 100644
@@ -13,7 +13,7 @@ static void
 idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
 		     struct idpf_ctlq_create_info *q_create_info)
 {
-	/* set head and tail registers in our local struct */
+	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
 	cq->reg.tail = q_create_info->reg.tail;
 	cq->reg.len = q_create_info->reg.len;
drivers/common/idpf/base/idpf_controlq_api.h +2 -8
index 78a54f6b4c..38f5d2df3c 100644
@@ -21,10 +21,7 @@ enum idpf_ctlq_type {
 	IDPF_CTLQ_TYPE_RDMA_COMPL	= 7
 };
 
-/*
- * Generic Control Queue Structures
- */
-
+/* Generic Control Queue Structures */
 struct idpf_ctlq_reg {
 	/* used for queue tracking */
 	u32 head;
@@ -157,10 +154,7 @@ enum idpf_mbx_opc {
 	idpf_mbq_opc_send_msg_to_peer_drv	= 0x0804,
 };
 
-/*
- * API supported for control queue management
- */
-
+/* API supported for control queue management */
 /* Will init all required q including default mb.  "q_info" is an array of
  * create_info structs equal to the number of control queues to be created.
  */
drivers/common/idpf/base/idpf_lan_pf_regs.h +4 -3
index 8542620e01..e47afad6e9 100644
@@ -80,10 +80,11 @@
 /* _ITR is ITR index, _INT is interrupt index, _itrn_indx_spacing is
  * spacing b/w itrn registers of the same vector.
  */
-#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
+#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing)		\
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
 /* For PF, itrn_indx_spacing is 4 and itrn_reg_spacing is 0x1000 */
-#define PF_GLINT_ITR(_ITR, _INT) (PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
+#define PF_GLINT_ITR(_ITR, _INT)	\
+	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
 #define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
drivers/common/idpf/base/idpf_lan_txrx.h +22 -21

71 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +17 -8
index b5ff9b2cc9..4c5249129e 100644
@@ -94,14 +94,23 @@
  * b/w itrn registers of the same vector
  */
 #define VF_INT_ITR0(_ITR)		(0x00004C00 + ((_ITR) * 4))
-#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		 ((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
-/* For VF with 16 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x40 */
-#define VF_INT_ITRN(_INT, _ITR)	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
-/* For VF with 64 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x100 */
-#define VF_INT_ITRN_64(_INT, _ITR) (0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
-/* For VF with 2k vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x2000 */
-#define VF_INT_ITRN_2K(_INT, _ITR) (0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
+#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing)  \
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
+/* For VF with 16 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x40 and base register offset is 0x00002800
+ */
+#define VF_INT_ITRN(_INT, _ITR)			\
+	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
+/* For VF with 64 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x100 and base register offset is 0x00002C00
+ */
+#define VF_INT_ITRN_64(_INT, _ITR)	\
+	(0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
+/* For VF with 2k vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x2000 and base register offset is 0x00072000
+ */
+#define VF_INT_ITRN_2K(_INT, _ITR)	\
+	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
 #define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
Signature · 1 line
2.34.1
#14 lore raw

PATCH 13/14 common/idpf/base: use GENMASK macro

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Instead of using a custom defined macro for generating a mask, use the standard GENMASK macro.

---
 drivers/common/idpf/base/idpf_lan_pf_regs.h |  26 ++---
 drivers/common/idpf/base/idpf_lan_txrx.h    | 116 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h |  16 +--
 drivers/common/idpf/base/idpf_osdep.h       |   7 ++
 4 files changed, 80 insertions(+), 85 deletions(-)
drivers/common/idpf/base/idpf_lan_pf_regs.h +13 -13
index e47afad6e9..b9d82592c0 100644
@@ -24,7 +24,7 @@
 #define PF_FW_ARQBAH			(PF_FW_BASE + 0x4)
 #define PF_FW_ARQLEN			(PF_FW_BASE + 0x8)
 #define PF_FW_ARQLEN_ARQLEN_S		0
-#define PF_FW_ARQLEN_ARQLEN_M		IDPF_M(0x1FFF, PF_FW_ARQLEN_ARQLEN_S)
+#define PF_FW_ARQLEN_ARQLEN_M		GENMASK(12, 0)
 #define PF_FW_ARQLEN_ARQVFE_S		28
 #define PF_FW_ARQLEN_ARQVFE_M		BIT(PF_FW_ARQLEN_ARQVFE_S)
 #define PF_FW_ARQLEN_ARQOVFL_S		29
@@ -35,14 +35,14 @@
 #define PF_FW_ARQLEN_ARQENABLE_M	BIT(PF_FW_ARQLEN_ARQENABLE_S)
 #define PF_FW_ARQH			(PF_FW_BASE + 0xC)
 #define PF_FW_ARQH_ARQH_S		0
-#define PF_FW_ARQH_ARQH_M		IDPF_M(0x1FFF, PF_FW_ARQH_ARQH_S)
+#define PF_FW_ARQH_ARQH_M		GENMASK(12, 0)
 #define PF_FW_ARQT			(PF_FW_BASE + 0x10)
 
 #define PF_FW_ATQBAL			(PF_FW_BASE + 0x14)
 #define PF_FW_ATQBAH			(PF_FW_BASE + 0x18)
 #define PF_FW_ATQLEN			(PF_FW_BASE + 0x1C)
 #define PF_FW_ATQLEN_ATQLEN_S		0
-#define PF_FW_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, PF_FW_ATQLEN_ATQLEN_S)
+#define PF_FW_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define PF_FW_ATQLEN_ATQVFE_S		28
 #define PF_FW_ATQLEN_ATQVFE_M		BIT(PF_FW_ATQLEN_ATQVFE_S)
 #define PF_FW_ATQLEN_ATQOVFL_S		29
@@ -53,7 +53,7 @@
 #define PF_FW_ATQLEN_ATQENABLE_M	BIT(PF_FW_ATQLEN_ATQENABLE_S)
 #define PF_FW_ATQH			(PF_FW_BASE + 0x20)
 #define PF_FW_ATQH_ATQH_S		0
-#define PF_FW_ATQH_ATQH_M		IDPF_M(0x3FF, PF_FW_ATQH_ATQH_S)
+#define PF_FW_ATQH_ATQH_M		GENMASK(9, 0)
 #define PF_FW_ATQT			(PF_FW_BASE + 0x24)
 
 /* Interrupts */
@@ -66,7 +66,7 @@
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_S	2
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_M	BIT(PF_GLINT_DYN_CTL_SWINT_TRIG_S)
 #define PF_GLINT_DYN_CTL_ITR_INDX_S	3
-#define PF_GLINT_DYN_CTL_ITR_INDX_M	IDPF_M(0x3, PF_GLINT_DYN_CTL_ITR_INDX_S)
+#define PF_GLINT_DYN_CTL_ITR_INDX_M	GENMASK(4, 3)
 #define PF_GLINT_DYN_CTL_INTERVAL_S	5
 #define PF_GLINT_DYN_CTL_INTERVAL_M	BIT(PF_GLINT_DYN_CTL_INTERVAL_S)
 #define PF_GLINT_DYN_CTL_SW_ITR_INDX_ENA_S	24
@@ -87,13 +87,13 @@
 	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
-#define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
+#define PF_GLINT_ITR_INTERVAL_M		GENMASK(11, 0)
 
 /* Timesync registers */
 #define PF_TIMESYNC_BASE		0x08404000
 #define PF_GLTSYN_CMD_SYNC		(PF_TIMESYNC_BASE)
 #define PF_GLTSYN_CMD_SYNC_EXEC_CMD_S	0
-#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	IDPF_M(0x3, PF_GLTSYN_CMD_SYNC_EXEC_CMD_S)
+#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	GENMASK(1, 0)
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_S	2
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_M	BIT(PF_GLTSYN_CMD_SYNC_SHTIME_EN_S)
 #define PF_GLTSYN_SHTIME_0		(PF_TIMESYNC_BASE + 0x4)
@@ -105,23 +105,23 @@
 /* Generic registers */
 #define PF_INT_DIR_OICR_ENA		0x08406000
 #define PF_INT_DIR_OICR_ENA_S		0
-#define PF_INT_DIR_OICR_ENA_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_ENA_S)
+#define PF_INT_DIR_OICR_ENA_M		GENMASK(31, 0)
 #define PF_INT_DIR_OICR			0x08406004
 #define PF_INT_DIR_OICR_TSYN_EVNT	0
 #define PF_INT_DIR_OICR_PHY_TS_0	BIT(1)
 #define PF_INT_DIR_OICR_PHY_TS_1	BIT(2)
 #define PF_INT_DIR_OICR_CAUSE		0x08406008
 #define PF_INT_DIR_OICR_CAUSE_CAUSE_S	0
-#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_CAUSE_CAUSE_S)
+#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	GENMASK(31, 0)
 #define PF_INT_PBA_CLEAR		0x0840600C
 
 #define PF_FUNC_RID			0x08406010
 #define PF_FUNC_RID_FUNCTION_NUMBER_S	0
-#define PF_FUNC_RID_FUNCTION_NUMBER_M	IDPF_M(0x7, PF_FUNC_RID_FUNCTION_NUMBER_S)
+#define PF_FUNC_RID_FUNCTION_NUMBER_M	GENMASK(2, 0)
 #define PF_FUNC_RID_DEVICE_NUMBER_S	3
-#define PF_FUNC_RID_DEVICE_NUMBER_M	IDPF_M(0x1F, PF_FUNC_RID_DEVICE_NUMBER_S)
+#define PF_FUNC_RID_DEVICE_NUMBER_M	GENMASK(7, 3)
 #define PF_FUNC_RID_BUS_NUMBER_S	8
-#define PF_FUNC_RID_BUS_NUMBER_M	IDPF_M(0xFF, PF_FUNC_RID_BUS_NUMBER_S)
+#define PF_FUNC_RID_BUS_NUMBER_M	GENMASK(15, 8)
 
 /* Reset registers */
 #define PFGEN_RTRIG			0x08407000
@@ -133,7 +133,7 @@
 #define PFGEN_RTRIG_IMCR_M		BIT(2)
 #define PFGEN_RSTAT			0x08407008 /* PFR Status */
 #define PFGEN_RSTAT_PFR_STATE_S		0
-#define PFGEN_RSTAT_PFR_STATE_M		IDPF_M(0x3, PFGEN_RSTAT_PFR_STATE_S)
+#define PFGEN_RSTAT_PFR_STATE_M		GENMASK(1, 0)
 #define PFGEN_CTRL			0x0840700C
 #define PFGEN_CTRL_PFSWR		BIT(0)
 
drivers/common/idpf/base/idpf_lan_txrx.h +52 -64

164 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +8 -8
index 4c5249129e..f394a0d67a 100644
@@ -9,7 +9,7 @@
 /* Reset */
 #define VFGEN_RSTAT			0x00008800
 #define VFGEN_RSTAT_VFR_STATE_S		0
-#define VFGEN_RSTAT_VFR_STATE_M		IDPF_M(0x3, VFGEN_RSTAT_VFR_STATE_S)
+#define VFGEN_RSTAT_VFR_STATE_M		GENMASK(1, 0)
 
 /* Control(VF Mailbox) Queue */
 #define VF_BASE				0x00006000
@@ -18,7 +18,7 @@
 #define VF_ATQBAH			(VF_BASE + 0x1800)
 #define VF_ATQLEN			(VF_BASE + 0x0800)
 #define VF_ATQLEN_ATQLEN_S		0
-#define VF_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, VF_ATQLEN_ATQLEN_S)
+#define VF_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define VF_ATQLEN_ATQVFE_S		28
 #define VF_ATQLEN_ATQVFE_M		BIT(VF_ATQLEN_ATQVFE_S)
 #define VF_ATQLEN_ATQOVFL_S		29
@@ -29,14 +29,14 @@
 #define VF_ATQLEN_ATQENABLE_M		BIT(VF_ATQLEN_ATQENABLE_S)
 #define VF_ATQH				(VF_BASE + 0x0400)
 #define VF_ATQH_ATQH_S			0
-#define VF_ATQH_ATQH_M			IDPF_M(0x3FF, VF_ATQH_ATQH_S)
+#define VF_ATQH_ATQH_M			GENMASK(9, 0)
 #define VF_ATQT				(VF_BASE + 0x2400)
 
 #define VF_ARQBAL			(VF_BASE + 0x0C00)
 #define VF_ARQBAH			(VF_BASE)
 #define VF_ARQLEN			(VF_BASE + 0x2000)
 #define VF_ARQLEN_ARQLEN_S		0
-#define VF_ARQLEN_ARQLEN_M		IDPF_M(0x3FF, VF_ARQLEN_ARQLEN_S)
+#define VF_ARQLEN_ARQLEN_M		GENMASK(9, 0)
 #define VF_ARQLEN_ARQVFE_S		28
 #define VF_ARQLEN_ARQVFE_M		BIT(VF_ARQLEN_ARQVFE_S)
 #define VF_ARQLEN_ARQOVFL_S		29
@@ -47,7 +47,7 @@
 #define VF_ARQLEN_ARQENABLE_M		BIT(VF_ARQLEN_ARQENABLE_S)
 #define VF_ARQH				(VF_BASE + 0x1400)
 #define VF_ARQH_ARQH_S			0
-#define VF_ARQH_ARQH_M			IDPF_M(0x1FFF, VF_ARQH_ARQH_S)
+#define VF_ARQH_ARQH_M			GENMASK(12, 0)
 #define VF_ARQT				(VF_BASE + 0x1000)
 
 /* Transmit queues */
@@ -69,7 +69,7 @@
 #define VF_INT_DYN_CTL0_INTENA_S	0
 #define VF_INT_DYN_CTL0_INTENA_M	BIT(VF_INT_DYN_CTL0_INTENA_S)
 #define VF_INT_DYN_CTL0_ITR_INDX_S	3
-#define VF_INT_DYN_CTL0_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTL0_ITR_INDX_S)
+#define VF_INT_DYN_CTL0_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN(_INT)		(0x00003800 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_EXT(_INT)	(0x00070000 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_INTENA_S	0
@@ -79,7 +79,7 @@
 #define VF_INT_DYN_CTLN_SWINT_TRIG_S	2
 #define VF_INT_DYN_CTLN_SWINT_TRIG_M	BIT(VF_INT_DYN_CTLN_SWINT_TRIG_S)
 #define VF_INT_DYN_CTLN_ITR_INDX_S	3
-#define VF_INT_DYN_CTLN_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTLN_ITR_INDX_S)
+#define VF_INT_DYN_CTLN_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN_INTERVAL_S	5
 #define VF_INT_DYN_CTLN_INTERVAL_M	BIT(VF_INT_DYN_CTLN_INTERVAL_S)
 #define VF_INT_DYN_CTLN_SW_ITR_INDX_ENA_S	24
@@ -113,7 +113,7 @@
 	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
-#define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
+#define VF_INT_ITRN_INTERVAL_M		GENMASK(11, 0)
 #define VF_INT_PBA_CLEAR		0x00008900
 
 #define VF_INT_ICR0_ENA1		0x00005000
drivers/common/idpf/base/idpf_osdep.h +7 -0
index 2a817a9807..74a376cb13 100644
@@ -48,6 +48,13 @@ typedef struct idpf_lock idpf_lock;
 
 #define IDPF_M(m, s)		((m) << (s))
 
+#define BITS_PER_LONG (8 * sizeof(long))
+#define BITS_PER_LONG_LONG (8 * sizeof(long long))
+#define GENMASK(h, l) \
+	(((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+
 #ifndef ETH_ADDR_LEN
 #define ETH_ADDR_LEN		6
 #endif
Signature · 1 line
2.34.1
#15 lore raw

PATCH 14/14 common/idpf/base: use 'type functionname(args)' style

In reply to Wenjing Qiao

From: Simei Su <[email protected]>

Instead of splitting the function name and function type into multiple lines, use then in a single line.

---
 drivers/common/idpf/base/idpf_controlq.c       | 5 ++---
 drivers/common/idpf/base/idpf_controlq_setup.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -3
index c24bfd23ef..07bbec91b9 100644
@@ -9,9 +9,8 @@
  * @cq: pointer to the specific control queue
  * @q_create_info: structs containing info for each queue to be initialized
  */
-static void
-idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
-		     struct idpf_ctlq_create_info *q_create_info)
+static void idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
+				 struct idpf_ctlq_create_info *q_create_info)
 {
 	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
drivers/common/idpf/base/idpf_controlq_setup.c +2 -3
index 0f1b52a7e9..21f43c74f5 100644
@@ -11,9 +11,8 @@
  * @hw: pointer to hw struct
  * @cq: pointer to the specific Control queue
  */
-static int
-idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
-			  struct idpf_ctlq_info *cq)
+static int idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
+				     struct idpf_ctlq_info *cq)
 {
 	size_t size = cq->ring_size * sizeof(struct idpf_ctlq_desc);
 
Signature · 1 line
2.34.1
#16 lore raw

v2 cover update idpf base code

In reply to Wenjing Qiao

This patch set updates idpf base code.

v2:
* Add two patches for share code update.
* Add version update.
* Fix coding style issue.

Simei Su (17):
common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initial PTP support common/idpf/base: remove mailbox registers common/idpf/base: add some adi specific fields common/idpf/base: add necessary check common/idpf/base: add union for SW cookie fields in ctlq msg common/idpf/base: define non-flexible size structure for ADI common/idpf/base: use local pointer before updating 'CQ out' common/idpf/base: use 'void' return type common/idpf/base: refactor descriptor 'ret val' stripping common/idpf/base: refine comments and alignment common/idpf/base: use GENMASK macro common/idpf/base: use 'type functionname(args)' style common/idpf/base: dont declare union with 'flex' common/idpf/base: remove unused Tx descriptor types common/idpf/base: update version

 .mailmap                                      |   7 +
 drivers/common/idpf/base/README               |   4 +-
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 285 +++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 303 ++++++++++++++++--
 13 files changed, 463 insertions(+), 328 deletions(-)
Signature · 1 line
2.25.1
#17 lore raw

PATCH v2 1/17 common/idpf/base: enable support for physical port stats

Add support to indicate physical port representor and query its statistics.

---
 .mailmap                             |  2 +
 drivers/common/idpf/base/virtchnl2.h | 80 +++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
.mailmap +2 -0
index 864d33ee46..8f90e6f972 100644
@@ -1638,3 +1638,5 @@ Ziye Yang <[email protected]>
 Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
+Jayaprakash Shanmugam <[email protected]>
+Zhenning Xiao <[email protected]>
drivers/common/idpf/base/virtchnl2.h +79 -1

116 lines not on this page · raw message

Signature · 1 line
2.25.1
#18 lore raw

PATCH v2 2/17 common/idpf/base: add miss completion capabilities

In reply to Simei Su

Add miss completion tag to other capabilities list, to indicate support for detecting a miss completion based on the upper bit of the completion tag.

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 4 ++++
 2 files changed, 5 insertions(+)
.mailmap +1 -0
index 8f90e6f972..af452d54c6 100644
@@ -1640,3 +1640,4 @@ Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
+Josh Hay <[email protected]>
drivers/common/idpf/base/virtchnl2.h +4 -0
index cd47444835..c49e4b943c 100644
@@ -231,6 +231,10 @@
 #define VIRTCHNL2_CAP_RX_FLEX_DESC		BIT(17)
 #define VIRTCHNL2_CAP_PTYPE			BIT(18)
 #define VIRTCHNL2_CAP_LOOPBACK			BIT(19)
+/* Enable miss completion types plus ability to detect a miss completion if a
+ * reserved bit is set in a standared completion's tag.
+ */
+#define VIRTCHNL2_CAP_MISS_COMPL_TAG		BIT(20)
 /* this must be the last capability */
 #define VIRTCHNL2_CAP_OEM			BIT(63)
 
Signature · 1 line
2.25.1
#19 lore raw

PATCH v2 3/17 common/idpf/base: initial PTP support

In reply to Simei Su

Adding a few PTP capabilities to determine which PTP features are enabled - legacy cross time, ptm, device clock control, PTP Tx timestamp with direct registers access, PTP Tx timestamp using virtchnl messages.

Creating structures and opcodes to support feautres introduced by capabilities.

---
 drivers/common/idpf/base/virtchnl2.h | 145 +++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)
drivers/common/idpf/base/virtchnl2.h +145 -0
index c49e4b943c..320430df6f 100644
@@ -98,6 +98,9 @@
 #define		VIRTCHNL2_OP_ADD_QUEUE_GROUPS		538
 #define		VIRTCHNL2_OP_DEL_QUEUE_GROUPS		539
 #define		VIRTCHNL2_OP_GET_PORT_STATS		540
+	/* TimeSync opcodes */
+#define		VIRTCHNL2_OP_GET_PTP_CAPS		541
+#define		VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES	542
 
 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX	0xFFFF
 
@@ -1395,6 +1398,112 @@ struct virtchnl2_promisc_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_promisc_info);
 
+/* VIRTCHNL2_PTP_CAPS
+ * PTP capabilities
+ */
+#define VIRTCHNL2_PTP_CAP_LEGACY_CROSS_TIME	BIT(0)
+#define VIRTCHNL2_PTP_CAP_PTM			BIT(1)
+#define VIRTCHNL2_PTP_CAP_DEVICE_CLOCK_CONTROL	BIT(2)
+#define VIRTCHNL2_PTP_CAP_TX_TSTAMPS_DIRECT	BIT(3)
+#define	VIRTCHNL2_PTP_CAP_TX_TSTAMPS_VIRTCHNL	BIT(4)
+
+/* Legacy cross time registers offsets */
+struct virtchnl2_ptp_legacy_cross_time_reg {
+	__le32 shadow_time_0;
+	__le32 shadow_time_l;
+	__le32 shadow_time_h;
+	__le32 cmd_sync;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_legacy_cross_time_reg);
+
+/* PTM cross time registers offsets */
+struct virtchnl2_ptp_ptm_cross_time_reg {
+	__le32 art_l;
+	__le32 art_h;
+	__le32 cmd_sync;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_ptm_cross_time_reg);
+
+/* Registers needed to control the main clock */
+struct virtchnl2_ptp_device_clock_control {
+	__le32 cmd;
+	__le32 incval_l;
+	__le32 incval_h;
+	__le32 shadj_l;
+	__le32 shadj_h;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_device_clock_control);
+
+/* Structure that defines tx tstamp entry - index and register offset */
+struct virtchnl2_ptp_tx_tstamp_entry {
+	__le32 tx_latch_register_base;
+	__le32 tx_latch_register_offset;
+	u8 index;
+	u8 pad[7];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_entry);
+
+/* Structure that defines tx tstamp entries - total number of latches
+ * and the array of entries.
+ */
+struct virtchnl2_ptp_tx_tstamp {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_entry ptp_tx_tstamp_entries[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp);
+
+/* VIRTCHNL2_OP_GET_PTP_CAPS
+ * PV/VF sends this message to negotiate PTP capabilities. CP updates bitmap
+ * with supported features and fulfills appropriate structures.
+ */
+struct virtchnl2_get_ptp_caps {
+	/* PTP capability bitmap */
+	/* see VIRTCHNL2_PTP_CAPS definitions */
+	__le32 ptp_caps;
+	u8 pad[4];
+
+	struct virtchnl2_ptp_legacy_cross_time_reg legacy_cross_time_reg;
+	struct virtchnl2_ptp_ptm_cross_time_reg ptm_cross_time_reg;
+	struct virtchnl2_ptp_device_clock_control device_clock_control;
+	struct virtchnl2_ptp_tx_tstamp tx_tstamp;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(88, virtchnl2_get_ptp_caps);
+
+/* Structure that describes tx tstamp values, index and validity */
+struct virtchnl2_ptp_tx_tstamp_latch {
+	__le32 tstamp_h;
+	__le32 tstamp_l;
+	u8 index;
+	u8 valid;
+	u8 pad[6];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_latch);
+
+/* VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES
+ * PF/VF sends this message to receive a specified number of timestamps
+ * entries.
+ */
+struct virtchnl2_ptp_tx_tstamp_latches {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_latch tstamp_latches[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp_latches);
 
 static inline const char *virtchnl2_op_str(__le32 v_opcode)
 {
@@ -1463,6 +1572,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_GET_PORT_STATS:
 		return "VIRTCHNL2_OP_GET_PORT_STATS";
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		return "VIRTCHNL2_OP_GET_PTP_CAPS";
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		return "VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES";
 	default:
 		return "Unsupported (update virtchnl2.h)";
 	}
@@ -1732,6 +1845,38 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 		break;
 	case VIRTCHNL2_OP_RESET_VF:
 		break;
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		valid_len = sizeof(struct virtchnl2_get_ptp_caps);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_get_ptp_caps *ptp_caps =
+			(struct virtchnl2_get_ptp_caps *)msg;
+
+			if (ptp_caps->tx_tstamp.num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((ptp_caps->tx_tstamp.num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_entry));
+		}
+		break;
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches =
+			(struct virtchnl2_ptp_tx_tstamp_latches *)msg;
+
+			if (tx_tstamp_latches->num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((tx_tstamp_latches->num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_latch));
+		}
+		break;
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL2_OP_EVENT:
 	case VIRTCHNL2_OP_UNKNOWN:
Signature · 1 line
2.25.1
#20 lore raw

PATCH v2 4/17 common/idpf/base: remove mailbox registers

In reply to Simei Su

Removing mailbox register offsets as the mapping to device register offsets are different between CVL and MEV (they are swapped out) individual drivers will define the offsets based on how registers are hardware addressed. However the it will begin with VDEV_MBX_START offset.

---
 .mailmap                             |  1 +
 drivers/common/idpf/base/siov_regs.h | 13 ++-----------
 2 files changed, 3 insertions(+), 11 deletions(-)
.mailmap +1 -0
index af452d54c6..f23f8fecfa 100644
@@ -1641,3 +1641,4 @@ Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
+Madhu Chittim <[email protected]>
drivers/common/idpf/base/siov_regs.h +2 -11
index fad329601a..7e1ae2e300 100644
@@ -4,16 +4,6 @@
 #ifndef _SIOV_REGS_H_
 #define _SIOV_REGS_H_
 #define VDEV_MBX_START			0x20000 /* Begin at 128KB */
-#define VDEV_MBX_ATQBAL			(VDEV_MBX_START + 0x0000)
-#define VDEV_MBX_ATQBAH			(VDEV_MBX_START + 0x0004)
-#define VDEV_MBX_ATQLEN			(VDEV_MBX_START + 0x0008)
-#define VDEV_MBX_ATQH			(VDEV_MBX_START + 0x000C)
-#define VDEV_MBX_ATQT			(VDEV_MBX_START + 0x0010)
-#define VDEV_MBX_ARQBAL			(VDEV_MBX_START + 0x0014)
-#define VDEV_MBX_ARQBAH			(VDEV_MBX_START + 0x0018)
-#define VDEV_MBX_ARQLEN			(VDEV_MBX_START + 0x001C)
-#define VDEV_MBX_ARQH			(VDEV_MBX_START + 0x0020)
-#define VDEV_MBX_ARQT			(VDEV_MBX_START + 0x0024)
 #define VDEV_GET_RSTAT			0x21000 /* 132KB for RSTAT */
 
 /* Begin at offset after 1MB (after 256 4k pages) */
@@ -43,5 +33,6 @@
 #define VDEV_INT_ITR_1(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x08)
 #define VDEV_INT_ITR_2(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x0C)
 
-/* Next offset to begin at 42MB (0x2A00000) */
+#define SIOV_REG_BAR_SIZE               0x2A00000
+/* Next offset to begin at 42MB + 4K (0x2A00000 + 0x1000) */
 #endif /* _SIOV_REGS_H_ */
Signature · 1 line
2.25.1
#21 lore raw

PATCH v2 5/17 common/idpf/base: add some adi specific fields

In reply to Simei Su

a) Add maximum ADI count in capabilities message
b) Add PF side ADI index to create_adi message
c) Define another constant to indicate 'Function active' state of ADI

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
.mailmap +1 -0
index f23f8fecfa..3879b5a33f 100644
@@ -1642,3 +1642,4 @@ Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
+Shailendra Bhatnagar <[email protected]>
drivers/common/idpf/base/virtchnl2.h +6 -2
index 320430df6f..7a099f5148 100644
@@ -294,6 +294,7 @@
 /* These messages are only sent to PF from CP */
 #define VIRTCHNL2_EVENT_START_RESET_ADI		2
 #define VIRTCHNL2_EVENT_FINISH_RESET_ADI	3
+#define VIRTCHNL2_EVENT_ADI_ACTIVE		4
 
 /* VIRTCHNL2_QUEUE_TYPE
  * Transmit and Receive queue types are valid in legacy as well as split queue
@@ -547,7 +548,8 @@ struct virtchnl2_get_capabilities {
 	u8 max_sg_bufs_per_tx_pkt;
 
 	u8 reserved1;
-	__le16 pad1;
+	/* upper bound of number of ADIs supported */
+	__le16 max_adis;
 
 	/* version of Control Plane that is running */
 	__le16 oem_cp_ver_major;
@@ -1076,10 +1078,12 @@ struct virtchnl2_create_adi {
 	__le16 mbx_id;
 	/* PF sends mailbox vector id to CP */
 	__le16 mbx_vec_id;
+	/* PF populates this ADI index */
+	__le16 adi_index;
 	/* CP populates ADI id */
 	__le16 adi_id;
 	u8 reserved[64];
-	u8 pad[6];
+	u8 pad[4];
 	/* CP populates queue chunks */
 	struct virtchnl2_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
Signature · 1 line
2.25.1
#22 lore raw

PATCH v2 6/17 common/idpf/base: add necessary check

In reply to Simei Su

Add necessary check for payload and message buffer.

---
 .mailmap                               | 1 +
 drivers/common/idpf/base/idpf_common.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
.mailmap +1 -0
index 3879b5a33f..7400692544 100644
@@ -1643,3 +1643,4 @@ Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
+Julianx Grajkowski <[email protected]>
drivers/common/idpf/base/idpf_common.c +4 -2
index fbf71416fd..9610916aa9 100644
@@ -239,8 +239,10 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 	e->desc.ret_val = msg.status;
 	e->desc.datalen = msg.data_len;
 	if (msg.data_len > 0) {
-		if (!msg.ctx.indirect.payload)
-			return -EINVAL;
+		if (!msg.ctx.indirect.payload || !msg.ctx.indirect.payload->va ||
+		    !e->msg_buf) {
+			return -EFAULT;
+		}
 		e->buf_len = msg.data_len;
 		msg_data_len = msg.data_len;
 		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,
Signature · 1 line
2.25.1
#23 lore raw

PATCH v2 7/17 common/idpf/base: add union for SW cookie fields in ctlq msg

In reply to Simei Su

Instead of using something like a byte offset, we can add a union to the struct here to enable direct addressing.

---
 .mailmap                                     | 1 +
 drivers/common/idpf/base/idpf_controlq_api.h | 5 +++++
 2 files changed, 6 insertions(+)
.mailmap +1 -0
index 7400692544..ff96bc7d0e 100644
@@ -1644,3 +1644,4 @@ Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
 Julianx Grajkowski <[email protected]>
+Alan Brady <[email protected]>
drivers/common/idpf/base/idpf_controlq_api.h +5 -0
index 3780304256..f4e7b53ac9 100644
@@ -77,6 +77,11 @@ struct idpf_ctlq_msg {
 			u8 context[IDPF_INDIRECT_CTX_SIZE];
 			struct idpf_dma_mem *payload;
 		} indirect;
+		struct {
+			u32 rsvd;
+			u16 data;
+			u16 flags;
+		} sw_cookie;
 	} ctx;
 };
 
Signature · 1 line
2.25.1
#24 lore raw

PATCH v2 8/17 common/idpf/base: define non-flexible size structure for ADI

In reply to Simei Su

Customer has a requirement to use the legacy fixed size, single chunk structure for ADI creation - one chunk for queue and one chunk for vector. This is described in detail in customer case
https://issuetracker.google.com/issues/270157802.

On the other hand, upstream code review patch has been posted with flex-array definitions. To accommodate the old style, the single chunk structures are being renamed so that merger of upstream patches with current code does not impact the existing workflows of the customer.

a) Define virtchnl2_non_flex_queue_reg_chunks with a single chunk in it.
b) Define virtchnl2_non_flex_vector_chunks with a single chunk in it.
c) Rename and modify virtchnl2_create_adi to use the above 2 new structs. New structure is virtchnl2_non_flex_create_adi.

---
 drivers/common/idpf/base/virtchnl2.h | 66 ++++++++++++++++++----------
 1 file changed, 43 insertions(+), 23 deletions(-)
drivers/common/idpf/base/virtchnl2.h +43 -23
index 7a099f5148..a19bb193c9 100644
@@ -89,8 +89,8 @@
 	 * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW
 	 */
 	/* opcodes 529, 530, and 531 are reserved */
-#define		VIRTCHNL2_OP_CREATE_ADI			532
-#define		VIRTCHNL2_OP_DESTROY_ADI		533
+#define		VIRTCHNL2_OP_NON_FLEX_CREATE_ADI	532
+#define		VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI	533
 #define		VIRTCHNL2_OP_LOOPBACK			534
 #define		VIRTCHNL2_OP_ADD_MAC_ADDR		535
 #define		VIRTCHNL2_OP_DEL_MAC_ADDR		536
@@ -1061,14 +1061,34 @@ struct virtchnl2_sriov_vfs_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_sriov_vfs_info);
 
-/* VIRTCHNL2_OP_CREATE_ADI
+/* structure to specify single chunk of queue */
+/* 'chunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_queue_reg_chunks {
+	__le16 num_chunks;
+	u8 reserved[6];
+	struct virtchnl2_queue_reg_chunk chunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_non_flex_queue_reg_chunks);
+
+/* structure to specify single chunk of interrupt vector */
+/* 'vchunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_vector_chunks {
+	__le16 num_vchunks;
+	u8 reserved[14];
+	struct virtchnl2_vector_chunk vchunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_non_flex_vector_chunks);
+
+/* VIRTCHNL2_OP_NON_FLEX_CREATE_ADI
  * PF sends this message to CP to create ADI by filling in required
- * fields of virtchnl2_create_adi structure.
- * CP responds with the updated virtchnl2_create_adi structure containing the
- * necessary fields followed by chunks which in turn will have an array of
+ * fields of virtchnl2_non_flex_create_adi structure.
+ * CP responds with the updated virtchnl2_non_flex_create_adi structure containing
+ * the necessary fields followed by chunks which in turn will have an array of
  * num_chunks entries of virtchnl2_queue_chunk structures.
  */
-struct virtchnl2_create_adi {
+struct virtchnl2_non_flex_create_adi {
 	/* PF sends PASID to CP */
 	__le32 pasid;
 	/*
@@ -1085,24 +1105,24 @@ struct virtchnl2_create_adi {
 	u8 reserved[64];
 	u8 pad[4];
 	/* CP populates queue chunks */
-	struct virtchnl2_queue_reg_chunks chunks;
+	struct virtchnl2_non_flex_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
-	struct virtchnl2_vector_chunks vchunks;
+	struct virtchnl2_non_flex_vector_chunks vchunks;
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_create_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_non_flex_create_adi);
 
-/* VIRTCHNL2_OP_DESTROY_ADI
+/* VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI
  * PF sends this message to CP to destroy ADI by filling
  * in the adi_id in virtchnl2_destropy_adi structure.
  * CP responds with the status of the requested operation.
  */
-struct virtchnl2_destroy_adi {
+struct virtchnl2_non_flex_destroy_adi {
 	__le16 adi_id;
 	u8 reserved[2];
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_destroy_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_non_flex_destroy_adi);
 
 /* Based on the descriptor type the PF supports, CP fills ptype_id_10 or
  * ptype_id_8 for flex and base descriptor respectively. If ptype_id_10 value
@@ -1566,10 +1586,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_EVENT";
 	case VIRTCHNL2_OP_RESET_VF:
 		return "VIRTCHNL2_OP_RESET_VF";
-	case VIRTCHNL2_OP_CREATE_ADI:
-		return "VIRTCHNL2_OP_CREATE_ADI";
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		return "VIRTCHNL2_OP_DESTROY_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_CREATE_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI";
 	case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
 		return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
@@ -1624,11 +1644,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_queue_reg_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_CREATE_ADI:
-		valid_len = sizeof(struct virtchnl2_create_adi);
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_create_adi);
 		if (msglen >= valid_len) {
-			struct virtchnl2_create_adi *cadi =
-				(struct virtchnl2_create_adi *)msg;
+			struct virtchnl2_non_flex_create_adi *cadi =
+				(struct virtchnl2_non_flex_create_adi *)msg;
 
 			if (cadi->chunks.num_chunks == 0) {
 				/* zero chunks is allowed as input */
@@ -1645,8 +1665,8 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_vector_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		valid_len = sizeof(struct virtchnl2_destroy_adi);
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_destroy_adi);
 		break;
 	case VIRTCHNL2_OP_DESTROY_VPORT:
 	case VIRTCHNL2_OP_ENABLE_VPORT:
Signature · 1 line
2.25.1
#25 lore raw

PATCH v2 9/17 common/idpf/base: use local pointer before updating 'CQ out'

In reply to Simei Su

Instead of updating directly to 'cq_out' double pointer, use a local pointer and update only when we return success.

---
 drivers/common/idpf/base/idpf_controlq.c | 43 +++++++++++++-----------
 1 file changed, 23 insertions(+), 20 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +23 -20
index 6815153e1d..b84a1ea046 100644
@@ -137,6 +137,7 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		  struct idpf_ctlq_create_info *qinfo,
 		  struct idpf_ctlq_info **cq_out)
 {
+	struct idpf_ctlq_info *cq;
 	bool is_rxq = false;
 	int status = 0;
 
@@ -145,26 +146,26 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 	    qinfo->buf_size > IDPF_CTLQ_MAX_BUF_LEN)
 		return -EINVAL;
 
-	*cq_out = (struct idpf_ctlq_info *)
-		idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
-	if (!(*cq_out))
+	cq = (struct idpf_ctlq_info *)
+	     idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
+	if (!cq)
 		return -ENOMEM;
 
-	(*cq_out)->cq_type = qinfo->type;
-	(*cq_out)->q_id = qinfo->id;
-	(*cq_out)->buf_size = qinfo->buf_size;
-	(*cq_out)->ring_size = qinfo->len;
+	(cq)->cq_type = qinfo->type;
+	(cq)->q_id = qinfo->id;
+	(cq)->buf_size = qinfo->buf_size;
+	(cq)->ring_size = qinfo->len;
 
-	(*cq_out)->next_to_use = 0;
-	(*cq_out)->next_to_clean = 0;
-	(*cq_out)->next_to_post = (*cq_out)->ring_size - 1;
+	(cq)->next_to_use = 0;
+	(cq)->next_to_clean = 0;
+	(cq)->next_to_post = cq->ring_size - 1;
 
 	switch (qinfo->type) {
 	case IDPF_CTLQ_TYPE_MAILBOX_RX:
 		is_rxq = true;
 		/* fallthrough */
 	case IDPF_CTLQ_TYPE_MAILBOX_TX:
-		status = idpf_ctlq_alloc_ring_res(hw, *cq_out);
+		status = idpf_ctlq_alloc_ring_res(hw, cq);
 		break;
 	default:
 		status = -EINVAL;
@@ -175,33 +176,35 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		goto init_free_q;
 
 	if (is_rxq) {
-		idpf_ctlq_init_rxq_bufs(*cq_out);
+		idpf_ctlq_init_rxq_bufs(cq);
 	} else {
 		/* Allocate the array of msg pointers for TX queues */
-		(*cq_out)->bi.tx_msg = (struct idpf_ctlq_msg **)
+		cq->bi.tx_msg = (struct idpf_ctlq_msg **)
 			idpf_calloc(hw, qinfo->len,
 				    sizeof(struct idpf_ctlq_msg *));
-		if (!(*cq_out)->bi.tx_msg) {
+		if (!cq->bi.tx_msg) {
 			status = -ENOMEM;
 			goto init_dealloc_q_mem;
 		}
 	}
 
-	idpf_ctlq_setup_regs(*cq_out, qinfo);
+	idpf_ctlq_setup_regs(cq, qinfo);
 
-	idpf_ctlq_init_regs(hw, *cq_out, is_rxq);
+	idpf_ctlq_init_regs(hw, cq, is_rxq);
 
-	idpf_init_lock(&(*cq_out)->cq_lock);
+	idpf_init_lock(&(cq->cq_lock));
 
-	LIST_INSERT_HEAD(&hw->cq_list_head, (*cq_out), cq_list);
+	LIST_INSERT_HEAD(&hw->cq_list_head, cq, cq_list);
 
+	*cq_out = cq;
 	return status;
 
 init_dealloc_q_mem:
 	/* free ring buffers and the ring itself */
-	idpf_ctlq_dealloc_ring_res(hw, *cq_out);
+	idpf_ctlq_dealloc_ring_res(hw, cq);
 init_free_q:
-	idpf_free(hw, *cq_out);
+	idpf_free(hw, cq);
+	cq = NULL;
 
 	return status;
 }
Signature · 1 line
2.25.1
#26 lore raw

PATCH v2 10/17 common/idpf/base: use 'void' return type

In reply to Simei Su

As idpf_ctlq_deinit always returns success, make it 'void' instead of returning only success. This also changes the return type for idpf_deinit_hw as 'void'.

Based on the upstream comments, explicit __le16 typecasting is not necessary as CPU_TO_LE16 is already being used.

---
 drivers/common/idpf/base/idpf_common.c       | 4 ++--
 drivers/common/idpf/base/idpf_controlq.c     | 7 ++-----
 drivers/common/idpf/base/idpf_controlq_api.h | 2 +-
 drivers/common/idpf/base/idpf_prototype.h    | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)
drivers/common/idpf/base/idpf_common.c +2 -2
index 9610916aa9..7181a7f14c 100644
@@ -262,12 +262,12 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
  *  idpf_deinit_hw - shutdown routine
  *  @hw: pointer to the hardware structure
  */
-int idpf_deinit_hw(struct idpf_hw *hw)
+void idpf_deinit_hw(struct idpf_hw *hw)
 {
 	hw->asq = NULL;
 	hw->arq = NULL;
 
-	return idpf_ctlq_deinit(hw);
+	idpf_ctlq_deinit(hw);
 }
 
 /**
drivers/common/idpf/base/idpf_controlq.c +2 -5
index b84a1ea046..7b12dfab18 100644
@@ -75,7 +75,7 @@ static void idpf_ctlq_init_rxq_bufs(struct idpf_ctlq_info *cq)
 		desc->flags =
 			CPU_TO_LE16(IDPF_CTLQ_FLAG_BUF | IDPF_CTLQ_FLAG_RD);
 		desc->opcode = 0;
-		desc->datalen = (__le16)CPU_TO_LE16(bi->size);
+		desc->datalen = CPU_TO_LE16(bi->size);
 		desc->ret_val = 0;
 		desc->cookie_high = 0;
 		desc->cookie_low = 0;
@@ -264,16 +264,13 @@ int idpf_ctlq_init(struct idpf_hw *hw, u8 num_q,
  * idpf_ctlq_deinit - destroy all control queues
  * @hw: pointer to hw struct
  */
-int idpf_ctlq_deinit(struct idpf_hw *hw)
+void idpf_ctlq_deinit(struct idpf_hw *hw)
 {
 	struct idpf_ctlq_info *cq = NULL, *tmp = NULL;
-	int ret_code = 0;
 
 	LIST_FOR_EACH_ENTRY_SAFE(cq, tmp, &hw->cq_list_head,
 				 idpf_ctlq_info, cq_list)
 		idpf_ctlq_remove(hw, cq);
-
-	return ret_code;
 }
 
 /**
drivers/common/idpf/base/idpf_controlq_api.h +1 -1
index f4e7b53ac9..78a54f6b4c 100644
@@ -205,6 +205,6 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw,
 			    struct idpf_dma_mem **buffs);
 
 /* Will destroy all q including the default mb */
-int idpf_ctlq_deinit(struct idpf_hw *hw);
+void idpf_ctlq_deinit(struct idpf_hw *hw);
 
 #endif /* _IDPF_CONTROLQ_API_H_ */
drivers/common/idpf/base/idpf_prototype.h +1 -1
index 988ff00506..e2f090a9e3 100644
@@ -20,7 +20,7 @@
 #define APF
 
 int idpf_init_hw(struct idpf_hw *hw, struct idpf_ctlq_size ctlq_size);
-int idpf_deinit_hw(struct idpf_hw *hw);
+void idpf_deinit_hw(struct idpf_hw *hw);
 
 int idpf_clean_arq_element(struct idpf_hw *hw,
 			   struct idpf_arq_event_info *e,
Signature · 1 line
2.25.1
#27 lore raw

PATCH v2 11/17 common/idpf/base: refactor descriptor 'ret val' stripping

In reply to Simei Su

Conditional check is not necessary to strip and get status bits from the descriptor.

---
 drivers/common/idpf/base/idpf_controlq.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -5
index 7b12dfab18..da5c930578 100644
@@ -426,11 +426,8 @@ static int __idpf_ctlq_clean_sq(struct idpf_ctlq_info *cq, u16 *clean_count,
 		if (!force && !(LE16_TO_CPU(desc->flags) & IDPF_CTLQ_FLAG_DD))
 			break;
 
-		desc_err = LE16_TO_CPU(desc->ret_val);
-		if (desc_err) {
-			/* strip off FW internal code */
-			desc_err &= 0xff;
-		}
+		/* strip off FW internal code */
+		desc_err = LE16_TO_CPU(desc->ret_val) & 0xff;
 
 		msg_status[i] = cq->bi.tx_msg[ntc];
 		if (!msg_status[i])
Signature · 1 line
2.25.1
#28 lore raw

PATCH v2 12/17 common/idpf/base: refine comments and alignment

In reply to Simei Su

Refine the macros and definitions by using 'tab' spaces and new lines wherever necessary. Also refine the comment in 'idpf_ctlq_setup_regs' and remove the TODO comment in idpf_rss_hash enum as it doesn't make any sense.

---
 drivers/common/idpf/base/idpf_controlq.c     |  2 +-
 drivers/common/idpf/base/idpf_controlq_api.h | 10 +----
 drivers/common/idpf/base/idpf_lan_pf_regs.h  |  7 +--
 drivers/common/idpf/base/idpf_lan_txrx.h     | 47 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h  | 25 +++++++----
 5 files changed, 46 insertions(+), 45 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +1 -1
index da5c930578..c24bfd23ef 100644
@@ -13,7 +13,7 @@ static void
 idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
 		     struct idpf_ctlq_create_info *q_create_info)
 {
-	/* set head and tail registers in our local struct */
+	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
 	cq->reg.tail = q_create_info->reg.tail;
 	cq->reg.len = q_create_info->reg.len;
drivers/common/idpf/base/idpf_controlq_api.h +2 -8
index 78a54f6b4c..38f5d2df3c 100644
@@ -21,10 +21,7 @@ enum idpf_ctlq_type {
 	IDPF_CTLQ_TYPE_RDMA_COMPL	= 7
 };
 
-/*
- * Generic Control Queue Structures
- */
-
+/* Generic Control Queue Structures */
 struct idpf_ctlq_reg {
 	/* used for queue tracking */
 	u32 head;
@@ -157,10 +154,7 @@ enum idpf_mbx_opc {
 	idpf_mbq_opc_send_msg_to_peer_drv	= 0x0804,
 };
 
-/*
- * API supported for control queue management
- */
-
+/* API supported for control queue management */
 /* Will init all required q including default mb.  "q_info" is an array of
  * create_info structs equal to the number of control queues to be created.
  */
drivers/common/idpf/base/idpf_lan_pf_regs.h +4 -3
index 8542620e01..e47afad6e9 100644
@@ -80,10 +80,11 @@
 /* _ITR is ITR index, _INT is interrupt index, _itrn_indx_spacing is
  * spacing b/w itrn registers of the same vector.
  */
-#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
+#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing)		\
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
 /* For PF, itrn_indx_spacing is 4 and itrn_reg_spacing is 0x1000 */
-#define PF_GLINT_ITR(_ITR, _INT) (PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
+#define PF_GLINT_ITR(_ITR, _INT)	\
+	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
 #define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
drivers/common/idpf/base/idpf_lan_txrx.h +22 -25

72 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +17 -8
index b5ff9b2cc9..4c5249129e 100644
@@ -94,14 +94,23 @@
  * b/w itrn registers of the same vector
  */
 #define VF_INT_ITR0(_ITR)		(0x00004C00 + ((_ITR) * 4))
-#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		 ((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
-/* For VF with 16 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x40 */
-#define VF_INT_ITRN(_INT, _ITR)	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
-/* For VF with 64 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x100 */
-#define VF_INT_ITRN_64(_INT, _ITR) (0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
-/* For VF with 2k vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x2000 */
-#define VF_INT_ITRN_2K(_INT, _ITR) (0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
+#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing)  \
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
+/* For VF with 16 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x40 and base register offset is 0x00002800
+ */
+#define VF_INT_ITRN(_INT, _ITR)			\
+	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
+/* For VF with 64 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x100 and base register offset is 0x00002C00
+ */
+#define VF_INT_ITRN_64(_INT, _ITR)	\
+	(0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
+/* For VF with 2k vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x2000 and base register offset is 0x00072000
+ */
+#define VF_INT_ITRN_2K(_INT, _ITR)	\
+	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
 #define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
Signature · 1 line
2.25.1
#29 lore raw

PATCH v2 13/17 common/idpf/base: use GENMASK macro

In reply to Simei Su

Instead of using a custom defined macro for generating a mask, use the standard GENMASK macro.

---
 drivers/common/idpf/base/idpf_lan_pf_regs.h |  26 ++---
 drivers/common/idpf/base/idpf_lan_txrx.h    | 116 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h |  16 +--
 drivers/common/idpf/base/idpf_osdep.h       |   7 ++
 4 files changed, 80 insertions(+), 85 deletions(-)
drivers/common/idpf/base/idpf_lan_pf_regs.h +13 -13
index e47afad6e9..b9d82592c0 100644
@@ -24,7 +24,7 @@
 #define PF_FW_ARQBAH			(PF_FW_BASE + 0x4)
 #define PF_FW_ARQLEN			(PF_FW_BASE + 0x8)
 #define PF_FW_ARQLEN_ARQLEN_S		0
-#define PF_FW_ARQLEN_ARQLEN_M		IDPF_M(0x1FFF, PF_FW_ARQLEN_ARQLEN_S)
+#define PF_FW_ARQLEN_ARQLEN_M		GENMASK(12, 0)
 #define PF_FW_ARQLEN_ARQVFE_S		28
 #define PF_FW_ARQLEN_ARQVFE_M		BIT(PF_FW_ARQLEN_ARQVFE_S)
 #define PF_FW_ARQLEN_ARQOVFL_S		29
@@ -35,14 +35,14 @@
 #define PF_FW_ARQLEN_ARQENABLE_M	BIT(PF_FW_ARQLEN_ARQENABLE_S)
 #define PF_FW_ARQH			(PF_FW_BASE + 0xC)
 #define PF_FW_ARQH_ARQH_S		0
-#define PF_FW_ARQH_ARQH_M		IDPF_M(0x1FFF, PF_FW_ARQH_ARQH_S)
+#define PF_FW_ARQH_ARQH_M		GENMASK(12, 0)
 #define PF_FW_ARQT			(PF_FW_BASE + 0x10)
 
 #define PF_FW_ATQBAL			(PF_FW_BASE + 0x14)
 #define PF_FW_ATQBAH			(PF_FW_BASE + 0x18)
 #define PF_FW_ATQLEN			(PF_FW_BASE + 0x1C)
 #define PF_FW_ATQLEN_ATQLEN_S		0
-#define PF_FW_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, PF_FW_ATQLEN_ATQLEN_S)
+#define PF_FW_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define PF_FW_ATQLEN_ATQVFE_S		28
 #define PF_FW_ATQLEN_ATQVFE_M		BIT(PF_FW_ATQLEN_ATQVFE_S)
 #define PF_FW_ATQLEN_ATQOVFL_S		29
@@ -53,7 +53,7 @@
 #define PF_FW_ATQLEN_ATQENABLE_M	BIT(PF_FW_ATQLEN_ATQENABLE_S)
 #define PF_FW_ATQH			(PF_FW_BASE + 0x20)
 #define PF_FW_ATQH_ATQH_S		0
-#define PF_FW_ATQH_ATQH_M		IDPF_M(0x3FF, PF_FW_ATQH_ATQH_S)
+#define PF_FW_ATQH_ATQH_M		GENMASK(9, 0)
 #define PF_FW_ATQT			(PF_FW_BASE + 0x24)
 
 /* Interrupts */
@@ -66,7 +66,7 @@
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_S	2
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_M	BIT(PF_GLINT_DYN_CTL_SWINT_TRIG_S)
 #define PF_GLINT_DYN_CTL_ITR_INDX_S	3
-#define PF_GLINT_DYN_CTL_ITR_INDX_M	IDPF_M(0x3, PF_GLINT_DYN_CTL_ITR_INDX_S)
+#define PF_GLINT_DYN_CTL_ITR_INDX_M	GENMASK(4, 3)
 #define PF_GLINT_DYN_CTL_INTERVAL_S	5
 #define PF_GLINT_DYN_CTL_INTERVAL_M	BIT(PF_GLINT_DYN_CTL_INTERVAL_S)
 #define PF_GLINT_DYN_CTL_SW_ITR_INDX_ENA_S	24
@@ -87,13 +87,13 @@
 	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
-#define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
+#define PF_GLINT_ITR_INTERVAL_M		GENMASK(11, 0)
 
 /* Timesync registers */
 #define PF_TIMESYNC_BASE		0x08404000
 #define PF_GLTSYN_CMD_SYNC		(PF_TIMESYNC_BASE)
 #define PF_GLTSYN_CMD_SYNC_EXEC_CMD_S	0
-#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	IDPF_M(0x3, PF_GLTSYN_CMD_SYNC_EXEC_CMD_S)
+#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	GENMASK(1, 0)
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_S	2
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_M	BIT(PF_GLTSYN_CMD_SYNC_SHTIME_EN_S)
 #define PF_GLTSYN_SHTIME_0		(PF_TIMESYNC_BASE + 0x4)
@@ -105,23 +105,23 @@
 /* Generic registers */
 #define PF_INT_DIR_OICR_ENA		0x08406000
 #define PF_INT_DIR_OICR_ENA_S		0
-#define PF_INT_DIR_OICR_ENA_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_ENA_S)
+#define PF_INT_DIR_OICR_ENA_M		GENMASK(31, 0)
 #define PF_INT_DIR_OICR			0x08406004
 #define PF_INT_DIR_OICR_TSYN_EVNT	0
 #define PF_INT_DIR_OICR_PHY_TS_0	BIT(1)
 #define PF_INT_DIR_OICR_PHY_TS_1	BIT(2)
 #define PF_INT_DIR_OICR_CAUSE		0x08406008
 #define PF_INT_DIR_OICR_CAUSE_CAUSE_S	0
-#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_CAUSE_CAUSE_S)
+#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	GENMASK(31, 0)
 #define PF_INT_PBA_CLEAR		0x0840600C
 
 #define PF_FUNC_RID			0x08406010
 #define PF_FUNC_RID_FUNCTION_NUMBER_S	0
-#define PF_FUNC_RID_FUNCTION_NUMBER_M	IDPF_M(0x7, PF_FUNC_RID_FUNCTION_NUMBER_S)
+#define PF_FUNC_RID_FUNCTION_NUMBER_M	GENMASK(2, 0)
 #define PF_FUNC_RID_DEVICE_NUMBER_S	3
-#define PF_FUNC_RID_DEVICE_NUMBER_M	IDPF_M(0x1F, PF_FUNC_RID_DEVICE_NUMBER_S)
+#define PF_FUNC_RID_DEVICE_NUMBER_M	GENMASK(7, 3)
 #define PF_FUNC_RID_BUS_NUMBER_S	8
-#define PF_FUNC_RID_BUS_NUMBER_M	IDPF_M(0xFF, PF_FUNC_RID_BUS_NUMBER_S)
+#define PF_FUNC_RID_BUS_NUMBER_M	GENMASK(15, 8)
 
 /* Reset registers */
 #define PFGEN_RTRIG			0x08407000
@@ -133,7 +133,7 @@
 #define PFGEN_RTRIG_IMCR_M		BIT(2)
 #define PFGEN_RSTAT			0x08407008 /* PFR Status */
 #define PFGEN_RSTAT_PFR_STATE_S		0
-#define PFGEN_RSTAT_PFR_STATE_M		IDPF_M(0x3, PFGEN_RSTAT_PFR_STATE_S)
+#define PFGEN_RSTAT_PFR_STATE_M		GENMASK(1, 0)
 #define PFGEN_CTRL			0x0840700C
 #define PFGEN_CTRL_PFSWR		BIT(0)
 
drivers/common/idpf/base/idpf_lan_txrx.h +52 -64

164 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +8 -8
index 4c5249129e..f394a0d67a 100644
@@ -9,7 +9,7 @@
 /* Reset */
 #define VFGEN_RSTAT			0x00008800
 #define VFGEN_RSTAT_VFR_STATE_S		0
-#define VFGEN_RSTAT_VFR_STATE_M		IDPF_M(0x3, VFGEN_RSTAT_VFR_STATE_S)
+#define VFGEN_RSTAT_VFR_STATE_M		GENMASK(1, 0)
 
 /* Control(VF Mailbox) Queue */
 #define VF_BASE				0x00006000
@@ -18,7 +18,7 @@
 #define VF_ATQBAH			(VF_BASE + 0x1800)
 #define VF_ATQLEN			(VF_BASE + 0x0800)
 #define VF_ATQLEN_ATQLEN_S		0
-#define VF_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, VF_ATQLEN_ATQLEN_S)
+#define VF_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define VF_ATQLEN_ATQVFE_S		28
 #define VF_ATQLEN_ATQVFE_M		BIT(VF_ATQLEN_ATQVFE_S)
 #define VF_ATQLEN_ATQOVFL_S		29
@@ -29,14 +29,14 @@
 #define VF_ATQLEN_ATQENABLE_M		BIT(VF_ATQLEN_ATQENABLE_S)
 #define VF_ATQH				(VF_BASE + 0x0400)
 #define VF_ATQH_ATQH_S			0
-#define VF_ATQH_ATQH_M			IDPF_M(0x3FF, VF_ATQH_ATQH_S)
+#define VF_ATQH_ATQH_M			GENMASK(9, 0)
 #define VF_ATQT				(VF_BASE + 0x2400)
 
 #define VF_ARQBAL			(VF_BASE + 0x0C00)
 #define VF_ARQBAH			(VF_BASE)
 #define VF_ARQLEN			(VF_BASE + 0x2000)
 #define VF_ARQLEN_ARQLEN_S		0
-#define VF_ARQLEN_ARQLEN_M		IDPF_M(0x3FF, VF_ARQLEN_ARQLEN_S)
+#define VF_ARQLEN_ARQLEN_M		GENMASK(9, 0)
 #define VF_ARQLEN_ARQVFE_S		28
 #define VF_ARQLEN_ARQVFE_M		BIT(VF_ARQLEN_ARQVFE_S)
 #define VF_ARQLEN_ARQOVFL_S		29
@@ -47,7 +47,7 @@
 #define VF_ARQLEN_ARQENABLE_M		BIT(VF_ARQLEN_ARQENABLE_S)
 #define VF_ARQH				(VF_BASE + 0x1400)
 #define VF_ARQH_ARQH_S			0
-#define VF_ARQH_ARQH_M			IDPF_M(0x1FFF, VF_ARQH_ARQH_S)
+#define VF_ARQH_ARQH_M			GENMASK(12, 0)
 #define VF_ARQT				(VF_BASE + 0x1000)
 
 /* Transmit queues */
@@ -69,7 +69,7 @@
 #define VF_INT_DYN_CTL0_INTENA_S	0
 #define VF_INT_DYN_CTL0_INTENA_M	BIT(VF_INT_DYN_CTL0_INTENA_S)
 #define VF_INT_DYN_CTL0_ITR_INDX_S	3
-#define VF_INT_DYN_CTL0_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTL0_ITR_INDX_S)
+#define VF_INT_DYN_CTL0_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN(_INT)		(0x00003800 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_EXT(_INT)	(0x00070000 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_INTENA_S	0
@@ -79,7 +79,7 @@
 #define VF_INT_DYN_CTLN_SWINT_TRIG_S	2
 #define VF_INT_DYN_CTLN_SWINT_TRIG_M	BIT(VF_INT_DYN_CTLN_SWINT_TRIG_S)
 #define VF_INT_DYN_CTLN_ITR_INDX_S	3
-#define VF_INT_DYN_CTLN_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTLN_ITR_INDX_S)
+#define VF_INT_DYN_CTLN_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN_INTERVAL_S	5
 #define VF_INT_DYN_CTLN_INTERVAL_M	BIT(VF_INT_DYN_CTLN_INTERVAL_S)
 #define VF_INT_DYN_CTLN_SW_ITR_INDX_ENA_S	24
@@ -113,7 +113,7 @@
 	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
-#define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
+#define VF_INT_ITRN_INTERVAL_M		GENMASK(11, 0)
 #define VF_INT_PBA_CLEAR		0x00008900
 
 #define VF_INT_ICR0_ENA1		0x00005000
drivers/common/idpf/base/idpf_osdep.h +7 -0
index 2a817a9807..74a376cb13 100644
@@ -48,6 +48,13 @@ typedef struct idpf_lock idpf_lock;
 
 #define IDPF_M(m, s)		((m) << (s))
 
+#define BITS_PER_LONG (8 * sizeof(long))
+#define BITS_PER_LONG_LONG (8 * sizeof(long long))
+#define GENMASK(h, l) \
+	(((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+
 #ifndef ETH_ADDR_LEN
 #define ETH_ADDR_LEN		6
 #endif
Signature · 1 line
2.25.1
#30 lore raw

PATCH v2 14/17 common/idpf/base: use 'type functionname(args)' style

In reply to Simei Su

Instead of splitting the function name and function type into multiple lines, use then in a single line.

---
 drivers/common/idpf/base/idpf_controlq.c       | 5 ++---
 drivers/common/idpf/base/idpf_controlq_setup.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -3
index c24bfd23ef..07bbec91b9 100644
@@ -9,9 +9,8 @@
  * @cq: pointer to the specific control queue
  * @q_create_info: structs containing info for each queue to be initialized
  */
-static void
-idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
-		     struct idpf_ctlq_create_info *q_create_info)
+static void idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
+				 struct idpf_ctlq_create_info *q_create_info)
 {
 	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
drivers/common/idpf/base/idpf_controlq_setup.c +2 -3
index 0f1b52a7e9..21f43c74f5 100644
@@ -11,9 +11,8 @@
  * @hw: pointer to hw struct
  * @cq: pointer to the specific Control queue
  */
-static int
-idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
-			  struct idpf_ctlq_info *cq)
+static int idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
+				     struct idpf_ctlq_info *cq)
 {
 	size_t size = cq->ring_size * sizeof(struct idpf_ctlq_desc);
 
Signature · 1 line
2.25.1
#31 lore raw

PATCH v2 15/17 common/idpf/base: dont declare union with 'flex'

In reply to Simei Su

In idpf_flex_tx_desc structure, instead of naming the union with 'flex', use no name union as the union name is not really necessary there. This reduces the level of indirection in the hotpath.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +2 -2
index f213c49e47..1e19aeafac 100644
@@ -226,11 +226,11 @@ enum idpf_tx_flex_desc_cmd_bits {
 struct idpf_flex_tx_desc {
 	__le64 buf_addr;	/* Packet buffer address */
 	struct {
-		__le16 cmd_dtype;
 #define IDPF_FLEX_TXD_QW1_DTYPE_S	0
 #define IDPF_FLEX_TXD_QW1_DTYPE_M	GENMASK(4, 0)
 #define IDPF_FLEX_TXD_QW1_CMD_S		5
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
+		__le16 cmd_dtype;
 		union {
 			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
 			u8 raw[4];
@@ -247,7 +247,7 @@ struct idpf_flex_tx_desc {
 				__le16 l2tag1;
 				__le16 l2tag2;
 			} l2tags;
-		} flex;
+		};
 		__le16 buf_size;
 	} qw1;
 };
Signature · 1 line
2.25.1
#32 lore raw

PATCH v2 16/17 common/idpf/base: remove unused Tx descriptor types

In reply to Simei Su

Remove the unused TX descriptor types and mark them as reserved.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 132 ++---------------------
 1 file changed, 10 insertions(+), 122 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +10 -122
index 1e19aeafac..5bc4271584 100644
@@ -120,19 +120,19 @@ enum idpf_rss_hash {
 enum idpf_tx_desc_dtype_value {
 	IDPF_TX_DESC_DTYPE_DATA				= 0,
 	IDPF_TX_DESC_DTYPE_CTX				= 1,
-	IDPF_TX_DESC_DTYPE_REINJECT_CTX			= 2,
-	IDPF_TX_DESC_DTYPE_FLEX_DATA			= 3,
-	IDPF_TX_DESC_DTYPE_FLEX_CTX			= 4,
+	/* DTYPE 2 is reserved
+	 * DTYPE 3 is free for future use
+	 * DTYPE 4 is reserved
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX			= 5,
-	IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1		= 6,
+	/* DTYPE 6 is reserved */
 	IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2		= 7,
-	IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX	= 8,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_TSO_CTX	= 9,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_CTX	= 10,
-	IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX		= 11,
+	/* DTYPE 8, 9 are free for future use
+	 * DTYPE 10 is reserved
+	 * DTYPE 11 is free for future use
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE		= 12,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_TSO_CTX	= 13,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_CTX		= 14,
+	/* DTYPE 13, 14 are free for future use */
 	/* DESC_DONE - HW has completed write-back of descriptor */
 	IDPF_TX_DESC_DTYPE_DESC_DONE			= 15,
 };
@@ -232,16 +232,6 @@ struct idpf_flex_tx_desc {
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
 		__le16 cmd_dtype;
 		union {
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
-			u8 raw[4];
-
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1 (0x06) */
-			struct {
-				__le16 l2tag1;
-				u8 flex;
-				u8 tsync;
-			} tsync;
-
 			/* DTYPE=IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2 (0x07) */
 			struct {
 				__le16 l2tag1;
@@ -297,16 +287,6 @@ struct idpf_flex_tx_tso_ctx_qw {
 };
 
 union idpf_flex_tx_ctx_desc {
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_CTX (0x04) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag1;
-			u8 qw1_flex[4];
-		} qw1;
-	} gen;
-
 	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX (0x05) */
 	struct {
 		struct idpf_flex_tx_tso_ctx_qw qw0;
@@ -315,98 +295,6 @@ union idpf_flex_tx_ctx_desc {
 			u8 flex[6];
 		} qw1;
 	} tso;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX (0x08) */
-	struct {
-		struct idpf_flex_tx_tso_ctx_qw qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex0;
-			u8 ptag;
-			u8 flex1[2];
-		} qw1;
-	} tso_l2tag2_ptag;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX (0x0B) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex[4];
-		} qw1;
-	} l2tag2;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_REINJECT_CTX (0x02) */
-	struct {
-		struct {
-			__le32 sa_domain;
-#define IDPF_TXD_FLEX_CTX_SA_DOM_M	0xFFFF
-#define IDPF_TXD_FLEX_CTX_SA_DOM_VAL	0x10000
-			__le32 sa_idx;
-#define IDPF_TXD_FLEX_CTX_SAIDX_M	0x1FFFFF
-		} qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 txr2comp;
-#define IDPF_TXD_FLEX_CTX_TXR2COMP	0x1
-			__le16 miss_txq_comp_tag;
-			__le16 miss_txq_id;
-		} qw1;
-	} reinjection_pkt;
 };
 
-/* Host Split Context Descriptors */
-struct idpf_flex_tx_hs_ctx_desc {
-	union {
-		struct {
-			__le32 host_fnum_tlen;
-#define IDPF_TXD_FLEX_CTX_TLEN_S	0
-/* see IDPF_TXD_FLEX_CTX_TLEN_M for mask definition */
-#define IDPF_TXD_FLEX_CTX_FNUM_S	18
-#define IDPF_TXD_FLEX_CTX_FNUM_M	0x7FF
-#define IDPF_TXD_FLEX_CTX_HOST_S	29
-#define IDPF_TXD_FLEX_CTX_HOST_M	0x7
-			__le16 ftype_mss_rt;
-#define IDPF_TXD_FLEX_CTX_MSS_RT_0	0
-#define IDPF_TXD_FLEX_CTX_MSS_RT_M	0x3FFF
-#define IDPF_TXD_FLEX_CTX_FTYPE_S	14
-#define IDPF_TXD_FLEX_CTX_FTYPE_VF	0
-#define IDPF_TXD_FLEX_CTX_FTYPE_VDEV	BIT(14)
-#define IDPF_TXD_FLEX_CTX_FTYPE_PF	BIT(15)
-			u8 hdr_len;
-			u8 ptag;
-		} tso;
-		struct {
-			u8 flex0[2];
-			__le16 host_fnum_ftype;
-			u8 flex1[3];
-			u8 ptag;
-		} no_tso;
-	} qw0;
-
-	__le64 qw1_cmd_dtype;
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_S		16
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_M		0xFFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S	36
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S)
-#define IDPF_TXD_FLEX_CTX_QW1_TPH_S		37
-#define IDPF_TXD_FLEX_CTX_QW1_TPH		\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_TPH_S)
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_S		38
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_M		0xF
-/* The following are only valid for DTYPE = 0x09 and DTYPE = 0x0A */
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_S		42
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_M		0x1FFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S	63
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S)
-/* The following are only valid for DTYPE = 0x0D and DTYPE = 0x0E */
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_S		48
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_M		0xFF
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_S		56
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_M		0xFF
-};
 #endif /* _IDPF_LAN_TXRX_H_ */
Signature · 1 line
2.25.1
#33 lore raw

PATCH v2 17/17 common/idpf/base: update version

In reply to Simei Su

Update README

---
 drivers/common/idpf/base/README | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/idpf/base/README +2 -2
index 693049c057..457b5a81f3 100644
@@ -6,7 +6,7 @@ Intel® IDPF driver
 ==================
 
 This directory contains source code of BSD-3-Clause idpf driver of version
-2023.02.23 released by the team which develops basic drivers for Intel IPU.
+2023.07.25 released by the team which develops basic drivers for Intel IPU.
 The directory of base/ contains the original source package.
 This driver is valid for the product(s) listed below
 
@@ -18,4 +18,4 @@ Updating the driver
 NOTE: The source code in this directory should not be modified apart from
 the following file(s):
 
-    idpf_osdep.h
\ No newline at end of file
+    idpf_osdep.h
Signature · 1 line
2.25.1
#34 lore raw

v3 cover update idpf base code

In reply to Simei Su

This patch set updates idpf base code.

v3:
* Fix coding style issue.
* Modify unexpected error in the update version patch.

v2:
* Add two patches for share code update.
* Add version update.
* Fix coding style issue.

Simei Su (17):
common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initial PTP support common/idpf/base: remove mailbox registers common/idpf/base: add some adi specific fields common/idpf/base: add necessary check common/idpf/base: add union for SW cookie fields in ctlq msg common/idpf/base: define non-flexible size structure for ADI common/idpf/base: use local pointer before updating 'CQ out' common/idpf/base: use 'void' return type common/idpf/base: refactor descriptor 'ret val' stripping common/idpf/base: refine comments and alignment common/idpf/base: use GENMASK macro common/idpf/base: use 'type functionname(args)' style common/idpf/base: don't declare union with 'flex' common/idpf/base: remove unused Tx descriptor types common/idpf/base: update version

 .mailmap                                      |   7 +
 drivers/common/idpf/base/README               |   2 +-
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 285 +++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 303 ++++++++++++++++--
 13 files changed, 462 insertions(+), 327 deletions(-)
Signature · 1 line
2.25.1
#35 lore raw

PATCH v3 1/17 common/idpf/base: enable support for physical port stats

Add support to indicate physical port representor and query its statistics.

---
 .mailmap                             |  2 +
 drivers/common/idpf/base/virtchnl2.h | 80 +++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
.mailmap +2 -0
index 4dac53011b..3dfdd81797 100644
@@ -1639,3 +1639,5 @@ Ziye Yang <[email protected]>
 Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
+Jayaprakash Shanmugam <[email protected]>
+Zhenning Xiao <[email protected]>
drivers/common/idpf/base/virtchnl2.h +79 -1

116 lines not on this page · raw message

Signature · 1 line
2.25.1
#36 lore raw

PATCH v3 2/17 common/idpf/base: add miss completion capabilities

In reply to Simei Su

Add miss completion tag to other capabilities list, to indicate support for detecting a miss completion based on the upper bit of the completion tag.

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 4 ++++
 2 files changed, 5 insertions(+)
.mailmap +1 -0
index 3dfdd81797..91d8cca78f 100644
@@ -1641,3 +1641,4 @@ Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
+Josh Hay <[email protected]>
drivers/common/idpf/base/virtchnl2.h +4 -0
index cd47444835..c49e4b943c 100644
@@ -231,6 +231,10 @@
 #define VIRTCHNL2_CAP_RX_FLEX_DESC		BIT(17)
 #define VIRTCHNL2_CAP_PTYPE			BIT(18)
 #define VIRTCHNL2_CAP_LOOPBACK			BIT(19)
+/* Enable miss completion types plus ability to detect a miss completion if a
+ * reserved bit is set in a standared completion's tag.
+ */
+#define VIRTCHNL2_CAP_MISS_COMPL_TAG		BIT(20)
 /* this must be the last capability */
 #define VIRTCHNL2_CAP_OEM			BIT(63)
 
Signature · 1 line
2.25.1
#37 lore raw

PATCH v3 3/17 common/idpf/base: initial PTP support

In reply to Simei Su

Adding a few PTP capabilities to determine which PTP features are enabled - legacy cross time, ptm, device clock control, PTP Tx timestamp with direct registers access, PTP Tx timestamp using virtchnl messages.

Creating structures and opcodes to support feautres introduced by capabilities.

---
 drivers/common/idpf/base/virtchnl2.h | 145 +++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)
drivers/common/idpf/base/virtchnl2.h +145 -0
index c49e4b943c..320430df6f 100644
@@ -98,6 +98,9 @@
 #define		VIRTCHNL2_OP_ADD_QUEUE_GROUPS		538
 #define		VIRTCHNL2_OP_DEL_QUEUE_GROUPS		539
 #define		VIRTCHNL2_OP_GET_PORT_STATS		540
+	/* TimeSync opcodes */
+#define		VIRTCHNL2_OP_GET_PTP_CAPS		541
+#define		VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES	542
 
 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX	0xFFFF
 
@@ -1395,6 +1398,112 @@ struct virtchnl2_promisc_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_promisc_info);
 
+/* VIRTCHNL2_PTP_CAPS
+ * PTP capabilities
+ */
+#define VIRTCHNL2_PTP_CAP_LEGACY_CROSS_TIME	BIT(0)
+#define VIRTCHNL2_PTP_CAP_PTM			BIT(1)
+#define VIRTCHNL2_PTP_CAP_DEVICE_CLOCK_CONTROL	BIT(2)
+#define VIRTCHNL2_PTP_CAP_TX_TSTAMPS_DIRECT	BIT(3)
+#define	VIRTCHNL2_PTP_CAP_TX_TSTAMPS_VIRTCHNL	BIT(4)
+
+/* Legacy cross time registers offsets */
+struct virtchnl2_ptp_legacy_cross_time_reg {
+	__le32 shadow_time_0;
+	__le32 shadow_time_l;
+	__le32 shadow_time_h;
+	__le32 cmd_sync;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_legacy_cross_time_reg);
+
+/* PTM cross time registers offsets */
+struct virtchnl2_ptp_ptm_cross_time_reg {
+	__le32 art_l;
+	__le32 art_h;
+	__le32 cmd_sync;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_ptm_cross_time_reg);
+
+/* Registers needed to control the main clock */
+struct virtchnl2_ptp_device_clock_control {
+	__le32 cmd;
+	__le32 incval_l;
+	__le32 incval_h;
+	__le32 shadj_l;
+	__le32 shadj_h;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_device_clock_control);
+
+/* Structure that defines tx tstamp entry - index and register offset */
+struct virtchnl2_ptp_tx_tstamp_entry {
+	__le32 tx_latch_register_base;
+	__le32 tx_latch_register_offset;
+	u8 index;
+	u8 pad[7];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_entry);
+
+/* Structure that defines tx tstamp entries - total number of latches
+ * and the array of entries.
+ */
+struct virtchnl2_ptp_tx_tstamp {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_entry ptp_tx_tstamp_entries[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp);
+
+/* VIRTCHNL2_OP_GET_PTP_CAPS
+ * PV/VF sends this message to negotiate PTP capabilities. CP updates bitmap
+ * with supported features and fulfills appropriate structures.
+ */
+struct virtchnl2_get_ptp_caps {
+	/* PTP capability bitmap */
+	/* see VIRTCHNL2_PTP_CAPS definitions */
+	__le32 ptp_caps;
+	u8 pad[4];
+
+	struct virtchnl2_ptp_legacy_cross_time_reg legacy_cross_time_reg;
+	struct virtchnl2_ptp_ptm_cross_time_reg ptm_cross_time_reg;
+	struct virtchnl2_ptp_device_clock_control device_clock_control;
+	struct virtchnl2_ptp_tx_tstamp tx_tstamp;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(88, virtchnl2_get_ptp_caps);
+
+/* Structure that describes tx tstamp values, index and validity */
+struct virtchnl2_ptp_tx_tstamp_latch {
+	__le32 tstamp_h;
+	__le32 tstamp_l;
+	u8 index;
+	u8 valid;
+	u8 pad[6];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_latch);
+
+/* VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES
+ * PF/VF sends this message to receive a specified number of timestamps
+ * entries.
+ */
+struct virtchnl2_ptp_tx_tstamp_latches {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_latch tstamp_latches[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp_latches);
 
 static inline const char *virtchnl2_op_str(__le32 v_opcode)
 {
@@ -1463,6 +1572,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_GET_PORT_STATS:
 		return "VIRTCHNL2_OP_GET_PORT_STATS";
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		return "VIRTCHNL2_OP_GET_PTP_CAPS";
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		return "VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES";
 	default:
 		return "Unsupported (update virtchnl2.h)";
 	}
@@ -1732,6 +1845,38 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 		break;
 	case VIRTCHNL2_OP_RESET_VF:
 		break;
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		valid_len = sizeof(struct virtchnl2_get_ptp_caps);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_get_ptp_caps *ptp_caps =
+			(struct virtchnl2_get_ptp_caps *)msg;
+
+			if (ptp_caps->tx_tstamp.num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((ptp_caps->tx_tstamp.num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_entry));
+		}
+		break;
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches =
+			(struct virtchnl2_ptp_tx_tstamp_latches *)msg;
+
+			if (tx_tstamp_latches->num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((tx_tstamp_latches->num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_latch));
+		}
+		break;
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL2_OP_EVENT:
 	case VIRTCHNL2_OP_UNKNOWN:
Signature · 1 line
2.25.1
#38 lore raw

PATCH v3 4/17 common/idpf/base: remove mailbox registers

In reply to Simei Su

Removing mailbox register offsets as the mapping to device register offsets are different between CVL and MEV (they are swapped out) individual drivers will define the offsets based on how registers are hardware addressed. However the it will begin with VDEV_MBX_START offset.

---
 .mailmap                             |  1 +
 drivers/common/idpf/base/siov_regs.h | 13 ++-----------
 2 files changed, 3 insertions(+), 11 deletions(-)
.mailmap +1 -0
index 91d8cca78f..d8782cd67e 100644
@@ -1642,3 +1642,4 @@ Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
+Madhu Chittim <[email protected]>
drivers/common/idpf/base/siov_regs.h +2 -11
index fad329601a..7e1ae2e300 100644
@@ -4,16 +4,6 @@
 #ifndef _SIOV_REGS_H_
 #define _SIOV_REGS_H_
 #define VDEV_MBX_START			0x20000 /* Begin at 128KB */
-#define VDEV_MBX_ATQBAL			(VDEV_MBX_START + 0x0000)
-#define VDEV_MBX_ATQBAH			(VDEV_MBX_START + 0x0004)
-#define VDEV_MBX_ATQLEN			(VDEV_MBX_START + 0x0008)
-#define VDEV_MBX_ATQH			(VDEV_MBX_START + 0x000C)
-#define VDEV_MBX_ATQT			(VDEV_MBX_START + 0x0010)
-#define VDEV_MBX_ARQBAL			(VDEV_MBX_START + 0x0014)
-#define VDEV_MBX_ARQBAH			(VDEV_MBX_START + 0x0018)
-#define VDEV_MBX_ARQLEN			(VDEV_MBX_START + 0x001C)
-#define VDEV_MBX_ARQH			(VDEV_MBX_START + 0x0020)
-#define VDEV_MBX_ARQT			(VDEV_MBX_START + 0x0024)
 #define VDEV_GET_RSTAT			0x21000 /* 132KB for RSTAT */
 
 /* Begin at offset after 1MB (after 256 4k pages) */
@@ -43,5 +33,6 @@
 #define VDEV_INT_ITR_1(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x08)
 #define VDEV_INT_ITR_2(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x0C)
 
-/* Next offset to begin at 42MB (0x2A00000) */
+#define SIOV_REG_BAR_SIZE               0x2A00000
+/* Next offset to begin at 42MB + 4K (0x2A00000 + 0x1000) */
 #endif /* _SIOV_REGS_H_ */
Signature · 1 line
2.25.1
#39 lore raw

PATCH v3 5/17 common/idpf/base: add some adi specific fields

In reply to Simei Su

a) Add maximum ADI count in capabilities message
b) Add PF side ADI index to create_adi message
c) Define another constant to indicate 'Function active' state of ADI

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
.mailmap +1 -0
index d8782cd67e..75d534c53d 100644
@@ -1643,3 +1643,4 @@ Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
+Shailendra Bhatnagar <[email protected]>
drivers/common/idpf/base/virtchnl2.h +6 -2
index 320430df6f..7a099f5148 100644
@@ -294,6 +294,7 @@
 /* These messages are only sent to PF from CP */
 #define VIRTCHNL2_EVENT_START_RESET_ADI		2
 #define VIRTCHNL2_EVENT_FINISH_RESET_ADI	3
+#define VIRTCHNL2_EVENT_ADI_ACTIVE		4
 
 /* VIRTCHNL2_QUEUE_TYPE
  * Transmit and Receive queue types are valid in legacy as well as split queue
@@ -547,7 +548,8 @@ struct virtchnl2_get_capabilities {
 	u8 max_sg_bufs_per_tx_pkt;
 
 	u8 reserved1;
-	__le16 pad1;
+	/* upper bound of number of ADIs supported */
+	__le16 max_adis;
 
 	/* version of Control Plane that is running */
 	__le16 oem_cp_ver_major;
@@ -1076,10 +1078,12 @@ struct virtchnl2_create_adi {
 	__le16 mbx_id;
 	/* PF sends mailbox vector id to CP */
 	__le16 mbx_vec_id;
+	/* PF populates this ADI index */
+	__le16 adi_index;
 	/* CP populates ADI id */
 	__le16 adi_id;
 	u8 reserved[64];
-	u8 pad[6];
+	u8 pad[4];
 	/* CP populates queue chunks */
 	struct virtchnl2_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
Signature · 1 line
2.25.1
#40 lore raw

PATCH v3 6/17 common/idpf/base: add necessary check

In reply to Simei Su

Add necessary check for payload and message buffer.

---
 .mailmap                               | 1 +
 drivers/common/idpf/base/idpf_common.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
.mailmap +1 -0
index 75d534c53d..23aed53102 100644
@@ -1644,3 +1644,4 @@ Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
+Julianx Grajkowski <[email protected]>
drivers/common/idpf/base/idpf_common.c +4 -2
index fbf71416fd..9610916aa9 100644
@@ -239,8 +239,10 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 	e->desc.ret_val = msg.status;
 	e->desc.datalen = msg.data_len;
 	if (msg.data_len > 0) {
-		if (!msg.ctx.indirect.payload)
-			return -EINVAL;
+		if (!msg.ctx.indirect.payload || !msg.ctx.indirect.payload->va ||
+		    !e->msg_buf) {
+			return -EFAULT;
+		}
 		e->buf_len = msg.data_len;
 		msg_data_len = msg.data_len;
 		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,
Signature · 1 line
2.25.1
#41 lore raw

PATCH v3 7/17 common/idpf/base: add union for SW cookie fields in ctlq msg

In reply to Simei Su

Instead of using something like a byte offset, we can add a union to the struct here to enable direct addressing.

---
 .mailmap                                     | 1 +
 drivers/common/idpf/base/idpf_controlq_api.h | 5 +++++
 2 files changed, 6 insertions(+)
.mailmap +1 -0
index 23aed53102..2fcadb4e4c 100644
@@ -1645,3 +1645,4 @@ Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
 Julianx Grajkowski <[email protected]>
+Alan Brady <[email protected]>
drivers/common/idpf/base/idpf_controlq_api.h +5 -0
index 3780304256..f4e7b53ac9 100644
@@ -77,6 +77,11 @@ struct idpf_ctlq_msg {
 			u8 context[IDPF_INDIRECT_CTX_SIZE];
 			struct idpf_dma_mem *payload;
 		} indirect;
+		struct {
+			u32 rsvd;
+			u16 data;
+			u16 flags;
+		} sw_cookie;
 	} ctx;
 };
 
Signature · 1 line
2.25.1
#42 lore raw

PATCH v3 8/17 common/idpf/base: define non-flexible size structure for ADI

In reply to Simei Su

Customer has a requirement to use the legacy fixed size, single chunk structure for ADI creation - one chunk for queue and one chunk for vector. This is described in detail in customer case
https://issuetracker.google.com/issues/270157802.

On the other hand, upstream code review patch has been posted with flex-array definitions. To accommodate the old style, the single chunk structures are being renamed so that merger of upstream patches with current code does not impact the existing workflows of the customer.

a) Define virtchnl2_non_flex_queue_reg_chunks with a single chunk in it.
b) Define virtchnl2_non_flex_vector_chunks with a single chunk in it.
c) Rename and modify virtchnl2_create_adi to use the above 2 new structs. New structure is virtchnl2_non_flex_create_adi.

---
 drivers/common/idpf/base/virtchnl2.h | 66 ++++++++++++++++++----------
 1 file changed, 43 insertions(+), 23 deletions(-)
drivers/common/idpf/base/virtchnl2.h +43 -23
index 7a099f5148..a19bb193c9 100644
@@ -89,8 +89,8 @@
 	 * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW
 	 */
 	/* opcodes 529, 530, and 531 are reserved */
-#define		VIRTCHNL2_OP_CREATE_ADI			532
-#define		VIRTCHNL2_OP_DESTROY_ADI		533
+#define		VIRTCHNL2_OP_NON_FLEX_CREATE_ADI	532
+#define		VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI	533
 #define		VIRTCHNL2_OP_LOOPBACK			534
 #define		VIRTCHNL2_OP_ADD_MAC_ADDR		535
 #define		VIRTCHNL2_OP_DEL_MAC_ADDR		536
@@ -1061,14 +1061,34 @@ struct virtchnl2_sriov_vfs_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_sriov_vfs_info);
 
-/* VIRTCHNL2_OP_CREATE_ADI
+/* structure to specify single chunk of queue */
+/* 'chunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_queue_reg_chunks {
+	__le16 num_chunks;
+	u8 reserved[6];
+	struct virtchnl2_queue_reg_chunk chunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_non_flex_queue_reg_chunks);
+
+/* structure to specify single chunk of interrupt vector */
+/* 'vchunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_vector_chunks {
+	__le16 num_vchunks;
+	u8 reserved[14];
+	struct virtchnl2_vector_chunk vchunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_non_flex_vector_chunks);
+
+/* VIRTCHNL2_OP_NON_FLEX_CREATE_ADI
  * PF sends this message to CP to create ADI by filling in required
- * fields of virtchnl2_create_adi structure.
- * CP responds with the updated virtchnl2_create_adi structure containing the
- * necessary fields followed by chunks which in turn will have an array of
+ * fields of virtchnl2_non_flex_create_adi structure.
+ * CP responds with the updated virtchnl2_non_flex_create_adi structure containing
+ * the necessary fields followed by chunks which in turn will have an array of
  * num_chunks entries of virtchnl2_queue_chunk structures.
  */
-struct virtchnl2_create_adi {
+struct virtchnl2_non_flex_create_adi {
 	/* PF sends PASID to CP */
 	__le32 pasid;
 	/*
@@ -1085,24 +1105,24 @@ struct virtchnl2_create_adi {
 	u8 reserved[64];
 	u8 pad[4];
 	/* CP populates queue chunks */
-	struct virtchnl2_queue_reg_chunks chunks;
+	struct virtchnl2_non_flex_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
-	struct virtchnl2_vector_chunks vchunks;
+	struct virtchnl2_non_flex_vector_chunks vchunks;
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_create_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_non_flex_create_adi);
 
-/* VIRTCHNL2_OP_DESTROY_ADI
+/* VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI
  * PF sends this message to CP to destroy ADI by filling
  * in the adi_id in virtchnl2_destropy_adi structure.
  * CP responds with the status of the requested operation.
  */
-struct virtchnl2_destroy_adi {
+struct virtchnl2_non_flex_destroy_adi {
 	__le16 adi_id;
 	u8 reserved[2];
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_destroy_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_non_flex_destroy_adi);
 
 /* Based on the descriptor type the PF supports, CP fills ptype_id_10 or
  * ptype_id_8 for flex and base descriptor respectively. If ptype_id_10 value
@@ -1566,10 +1586,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_EVENT";
 	case VIRTCHNL2_OP_RESET_VF:
 		return "VIRTCHNL2_OP_RESET_VF";
-	case VIRTCHNL2_OP_CREATE_ADI:
-		return "VIRTCHNL2_OP_CREATE_ADI";
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		return "VIRTCHNL2_OP_DESTROY_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_CREATE_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI";
 	case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
 		return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
@@ -1624,11 +1644,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_queue_reg_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_CREATE_ADI:
-		valid_len = sizeof(struct virtchnl2_create_adi);
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_create_adi);
 		if (msglen >= valid_len) {
-			struct virtchnl2_create_adi *cadi =
-				(struct virtchnl2_create_adi *)msg;
+			struct virtchnl2_non_flex_create_adi *cadi =
+				(struct virtchnl2_non_flex_create_adi *)msg;
 
 			if (cadi->chunks.num_chunks == 0) {
 				/* zero chunks is allowed as input */
@@ -1645,8 +1665,8 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_vector_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		valid_len = sizeof(struct virtchnl2_destroy_adi);
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_destroy_adi);
 		break;
 	case VIRTCHNL2_OP_DESTROY_VPORT:
 	case VIRTCHNL2_OP_ENABLE_VPORT:
Signature · 1 line
2.25.1
#43 lore raw

PATCH v3 9/17 common/idpf/base: use local pointer before updating 'CQ out'

In reply to Simei Su

Instead of updating directly to 'cq_out' double pointer, use a local pointer and update only when we return success.

---
 drivers/common/idpf/base/idpf_controlq.c | 43 +++++++++++++-----------
 1 file changed, 23 insertions(+), 20 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +23 -20
index 6815153e1d..b84a1ea046 100644
@@ -137,6 +137,7 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		  struct idpf_ctlq_create_info *qinfo,
 		  struct idpf_ctlq_info **cq_out)
 {
+	struct idpf_ctlq_info *cq;
 	bool is_rxq = false;
 	int status = 0;
 
@@ -145,26 +146,26 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 	    qinfo->buf_size > IDPF_CTLQ_MAX_BUF_LEN)
 		return -EINVAL;
 
-	*cq_out = (struct idpf_ctlq_info *)
-		idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
-	if (!(*cq_out))
+	cq = (struct idpf_ctlq_info *)
+	     idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
+	if (!cq)
 		return -ENOMEM;
 
-	(*cq_out)->cq_type = qinfo->type;
-	(*cq_out)->q_id = qinfo->id;
-	(*cq_out)->buf_size = qinfo->buf_size;
-	(*cq_out)->ring_size = qinfo->len;
+	(cq)->cq_type = qinfo->type;
+	(cq)->q_id = qinfo->id;
+	(cq)->buf_size = qinfo->buf_size;
+	(cq)->ring_size = qinfo->len;
 
-	(*cq_out)->next_to_use = 0;
-	(*cq_out)->next_to_clean = 0;
-	(*cq_out)->next_to_post = (*cq_out)->ring_size - 1;
+	(cq)->next_to_use = 0;
+	(cq)->next_to_clean = 0;
+	(cq)->next_to_post = cq->ring_size - 1;
 
 	switch (qinfo->type) {
 	case IDPF_CTLQ_TYPE_MAILBOX_RX:
 		is_rxq = true;
 		/* fallthrough */
 	case IDPF_CTLQ_TYPE_MAILBOX_TX:
-		status = idpf_ctlq_alloc_ring_res(hw, *cq_out);
+		status = idpf_ctlq_alloc_ring_res(hw, cq);
 		break;
 	default:
 		status = -EINVAL;
@@ -175,33 +176,35 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		goto init_free_q;
 
 	if (is_rxq) {
-		idpf_ctlq_init_rxq_bufs(*cq_out);
+		idpf_ctlq_init_rxq_bufs(cq);
 	} else {
 		/* Allocate the array of msg pointers for TX queues */
-		(*cq_out)->bi.tx_msg = (struct idpf_ctlq_msg **)
+		cq->bi.tx_msg = (struct idpf_ctlq_msg **)
 			idpf_calloc(hw, qinfo->len,
 				    sizeof(struct idpf_ctlq_msg *));
-		if (!(*cq_out)->bi.tx_msg) {
+		if (!cq->bi.tx_msg) {
 			status = -ENOMEM;
 			goto init_dealloc_q_mem;
 		}
 	}
 
-	idpf_ctlq_setup_regs(*cq_out, qinfo);
+	idpf_ctlq_setup_regs(cq, qinfo);
 
-	idpf_ctlq_init_regs(hw, *cq_out, is_rxq);
+	idpf_ctlq_init_regs(hw, cq, is_rxq);
 
-	idpf_init_lock(&(*cq_out)->cq_lock);
+	idpf_init_lock(&(cq->cq_lock));
 
-	LIST_INSERT_HEAD(&hw->cq_list_head, (*cq_out), cq_list);
+	LIST_INSERT_HEAD(&hw->cq_list_head, cq, cq_list);
 
+	*cq_out = cq;
 	return status;
 
 init_dealloc_q_mem:
 	/* free ring buffers and the ring itself */
-	idpf_ctlq_dealloc_ring_res(hw, *cq_out);
+	idpf_ctlq_dealloc_ring_res(hw, cq);
 init_free_q:
-	idpf_free(hw, *cq_out);
+	idpf_free(hw, cq);
+	cq = NULL;
 
 	return status;
 }
Signature · 1 line
2.25.1
#44 lore raw

PATCH v3 10/17 common/idpf/base: use 'void' return type

In reply to Simei Su

As idpf_ctlq_deinit always returns success, make it 'void' instead of returning only success. This also changes the return type for idpf_deinit_hw as 'void'.

Based on the upstream comments, explicit __le16 typecasting is not necessary as CPU_TO_LE16 is already being used.

---
 drivers/common/idpf/base/idpf_common.c       | 4 ++--
 drivers/common/idpf/base/idpf_controlq.c     | 7 ++-----
 drivers/common/idpf/base/idpf_controlq_api.h | 2 +-
 drivers/common/idpf/base/idpf_prototype.h    | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)
drivers/common/idpf/base/idpf_common.c +2 -2
index 9610916aa9..7181a7f14c 100644
@@ -262,12 +262,12 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
  *  idpf_deinit_hw - shutdown routine
  *  @hw: pointer to the hardware structure
  */
-int idpf_deinit_hw(struct idpf_hw *hw)
+void idpf_deinit_hw(struct idpf_hw *hw)
 {
 	hw->asq = NULL;
 	hw->arq = NULL;
 
-	return idpf_ctlq_deinit(hw);
+	idpf_ctlq_deinit(hw);
 }
 
 /**
drivers/common/idpf/base/idpf_controlq.c +2 -5
index b84a1ea046..7b12dfab18 100644
@@ -75,7 +75,7 @@ static void idpf_ctlq_init_rxq_bufs(struct idpf_ctlq_info *cq)
 		desc->flags =
 			CPU_TO_LE16(IDPF_CTLQ_FLAG_BUF | IDPF_CTLQ_FLAG_RD);
 		desc->opcode = 0;
-		desc->datalen = (__le16)CPU_TO_LE16(bi->size);
+		desc->datalen = CPU_TO_LE16(bi->size);
 		desc->ret_val = 0;
 		desc->cookie_high = 0;
 		desc->cookie_low = 0;
@@ -264,16 +264,13 @@ int idpf_ctlq_init(struct idpf_hw *hw, u8 num_q,
  * idpf_ctlq_deinit - destroy all control queues
  * @hw: pointer to hw struct
  */
-int idpf_ctlq_deinit(struct idpf_hw *hw)
+void idpf_ctlq_deinit(struct idpf_hw *hw)
 {
 	struct idpf_ctlq_info *cq = NULL, *tmp = NULL;
-	int ret_code = 0;
 
 	LIST_FOR_EACH_ENTRY_SAFE(cq, tmp, &hw->cq_list_head,
 				 idpf_ctlq_info, cq_list)
 		idpf_ctlq_remove(hw, cq);
-
-	return ret_code;
 }
 
 /**
drivers/common/idpf/base/idpf_controlq_api.h +1 -1
index f4e7b53ac9..78a54f6b4c 100644
@@ -205,6 +205,6 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw,
 			    struct idpf_dma_mem **buffs);
 
 /* Will destroy all q including the default mb */
-int idpf_ctlq_deinit(struct idpf_hw *hw);
+void idpf_ctlq_deinit(struct idpf_hw *hw);
 
 #endif /* _IDPF_CONTROLQ_API_H_ */
drivers/common/idpf/base/idpf_prototype.h +1 -1
index 988ff00506..e2f090a9e3 100644
@@ -20,7 +20,7 @@
 #define APF
 
 int idpf_init_hw(struct idpf_hw *hw, struct idpf_ctlq_size ctlq_size);
-int idpf_deinit_hw(struct idpf_hw *hw);
+void idpf_deinit_hw(struct idpf_hw *hw);
 
 int idpf_clean_arq_element(struct idpf_hw *hw,
 			   struct idpf_arq_event_info *e,
Signature · 1 line
2.25.1
#45 lore raw

PATCH v3 11/17 common/idpf/base: refactor descriptor 'ret val' stripping

In reply to Simei Su

Conditional check is not necessary to strip and get status bits from the descriptor.

---
 drivers/common/idpf/base/idpf_controlq.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -5
index 7b12dfab18..da5c930578 100644
@@ -426,11 +426,8 @@ static int __idpf_ctlq_clean_sq(struct idpf_ctlq_info *cq, u16 *clean_count,
 		if (!force && !(LE16_TO_CPU(desc->flags) & IDPF_CTLQ_FLAG_DD))
 			break;
 
-		desc_err = LE16_TO_CPU(desc->ret_val);
-		if (desc_err) {
-			/* strip off FW internal code */
-			desc_err &= 0xff;
-		}
+		/* strip off FW internal code */
+		desc_err = LE16_TO_CPU(desc->ret_val) & 0xff;
 
 		msg_status[i] = cq->bi.tx_msg[ntc];
 		if (!msg_status[i])
Signature · 1 line
2.25.1
#46 lore raw

PATCH v3 12/17 common/idpf/base: refine comments and alignment

In reply to Simei Su

Refine the macros and definitions by using 'tab' spaces and new lines wherever necessary. Also refine the comment in 'idpf_ctlq_setup_regs' and remove the TODO comment in idpf_rss_hash enum as it doesn't make any sense.

---
 drivers/common/idpf/base/idpf_controlq.c     |  2 +-
 drivers/common/idpf/base/idpf_controlq_api.h | 10 +----
 drivers/common/idpf/base/idpf_lan_pf_regs.h  |  7 +--
 drivers/common/idpf/base/idpf_lan_txrx.h     | 47 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h  | 25 +++++++----
 5 files changed, 46 insertions(+), 45 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +1 -1
index da5c930578..c24bfd23ef 100644
@@ -13,7 +13,7 @@ static void
 idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
 		     struct idpf_ctlq_create_info *q_create_info)
 {
-	/* set head and tail registers in our local struct */
+	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
 	cq->reg.tail = q_create_info->reg.tail;
 	cq->reg.len = q_create_info->reg.len;
drivers/common/idpf/base/idpf_controlq_api.h +2 -8
index 78a54f6b4c..38f5d2df3c 100644
@@ -21,10 +21,7 @@ enum idpf_ctlq_type {
 	IDPF_CTLQ_TYPE_RDMA_COMPL	= 7
 };
 
-/*
- * Generic Control Queue Structures
- */
-
+/* Generic Control Queue Structures */
 struct idpf_ctlq_reg {
 	/* used for queue tracking */
 	u32 head;
@@ -157,10 +154,7 @@ enum idpf_mbx_opc {
 	idpf_mbq_opc_send_msg_to_peer_drv	= 0x0804,
 };
 
-/*
- * API supported for control queue management
- */
-
+/* API supported for control queue management */
 /* Will init all required q including default mb.  "q_info" is an array of
  * create_info structs equal to the number of control queues to be created.
  */
drivers/common/idpf/base/idpf_lan_pf_regs.h +4 -3
index 8542620e01..e47afad6e9 100644
@@ -80,10 +80,11 @@
 /* _ITR is ITR index, _INT is interrupt index, _itrn_indx_spacing is
  * spacing b/w itrn registers of the same vector.
  */
-#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
+#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing)		\
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
 /* For PF, itrn_indx_spacing is 4 and itrn_reg_spacing is 0x1000 */
-#define PF_GLINT_ITR(_ITR, _INT) (PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
+#define PF_GLINT_ITR(_ITR, _INT)	\
+	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
 #define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
drivers/common/idpf/base/idpf_lan_txrx.h +22 -25

72 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +17 -8
index b5ff9b2cc9..4c5249129e 100644
@@ -94,14 +94,23 @@
  * b/w itrn registers of the same vector
  */
 #define VF_INT_ITR0(_ITR)		(0x00004C00 + ((_ITR) * 4))
-#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		 ((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
-/* For VF with 16 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x40 */
-#define VF_INT_ITRN(_INT, _ITR)	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
-/* For VF with 64 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x100 */
-#define VF_INT_ITRN_64(_INT, _ITR) (0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
-/* For VF with 2k vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x2000 */
-#define VF_INT_ITRN_2K(_INT, _ITR) (0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
+#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing)  \
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
+/* For VF with 16 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x40 and base register offset is 0x00002800
+ */
+#define VF_INT_ITRN(_INT, _ITR)			\
+	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
+/* For VF with 64 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x100 and base register offset is 0x00002C00
+ */
+#define VF_INT_ITRN_64(_INT, _ITR)	\
+	(0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
+/* For VF with 2k vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x2000 and base register offset is 0x00072000
+ */
+#define VF_INT_ITRN_2K(_INT, _ITR)	\
+	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
 #define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
Signature · 1 line
2.25.1
#47 lore raw

PATCH v3 13/17 common/idpf/base: use GENMASK macro

In reply to Simei Su

Instead of using a custom defined macro for generating a mask, use the standard GENMASK macro.

---
 drivers/common/idpf/base/idpf_lan_pf_regs.h |  26 ++---
 drivers/common/idpf/base/idpf_lan_txrx.h    | 116 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h |  16 +--
 drivers/common/idpf/base/idpf_osdep.h       |   7 ++
 4 files changed, 80 insertions(+), 85 deletions(-)
drivers/common/idpf/base/idpf_lan_pf_regs.h +13 -13
index e47afad6e9..b9d82592c0 100644
@@ -24,7 +24,7 @@
 #define PF_FW_ARQBAH			(PF_FW_BASE + 0x4)
 #define PF_FW_ARQLEN			(PF_FW_BASE + 0x8)
 #define PF_FW_ARQLEN_ARQLEN_S		0
-#define PF_FW_ARQLEN_ARQLEN_M		IDPF_M(0x1FFF, PF_FW_ARQLEN_ARQLEN_S)
+#define PF_FW_ARQLEN_ARQLEN_M		GENMASK(12, 0)
 #define PF_FW_ARQLEN_ARQVFE_S		28
 #define PF_FW_ARQLEN_ARQVFE_M		BIT(PF_FW_ARQLEN_ARQVFE_S)
 #define PF_FW_ARQLEN_ARQOVFL_S		29
@@ -35,14 +35,14 @@
 #define PF_FW_ARQLEN_ARQENABLE_M	BIT(PF_FW_ARQLEN_ARQENABLE_S)
 #define PF_FW_ARQH			(PF_FW_BASE + 0xC)
 #define PF_FW_ARQH_ARQH_S		0
-#define PF_FW_ARQH_ARQH_M		IDPF_M(0x1FFF, PF_FW_ARQH_ARQH_S)
+#define PF_FW_ARQH_ARQH_M		GENMASK(12, 0)
 #define PF_FW_ARQT			(PF_FW_BASE + 0x10)
 
 #define PF_FW_ATQBAL			(PF_FW_BASE + 0x14)
 #define PF_FW_ATQBAH			(PF_FW_BASE + 0x18)
 #define PF_FW_ATQLEN			(PF_FW_BASE + 0x1C)
 #define PF_FW_ATQLEN_ATQLEN_S		0
-#define PF_FW_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, PF_FW_ATQLEN_ATQLEN_S)
+#define PF_FW_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define PF_FW_ATQLEN_ATQVFE_S		28
 #define PF_FW_ATQLEN_ATQVFE_M		BIT(PF_FW_ATQLEN_ATQVFE_S)
 #define PF_FW_ATQLEN_ATQOVFL_S		29
@@ -53,7 +53,7 @@
 #define PF_FW_ATQLEN_ATQENABLE_M	BIT(PF_FW_ATQLEN_ATQENABLE_S)
 #define PF_FW_ATQH			(PF_FW_BASE + 0x20)
 #define PF_FW_ATQH_ATQH_S		0
-#define PF_FW_ATQH_ATQH_M		IDPF_M(0x3FF, PF_FW_ATQH_ATQH_S)
+#define PF_FW_ATQH_ATQH_M		GENMASK(9, 0)
 #define PF_FW_ATQT			(PF_FW_BASE + 0x24)
 
 /* Interrupts */
@@ -66,7 +66,7 @@
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_S	2
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_M	BIT(PF_GLINT_DYN_CTL_SWINT_TRIG_S)
 #define PF_GLINT_DYN_CTL_ITR_INDX_S	3
-#define PF_GLINT_DYN_CTL_ITR_INDX_M	IDPF_M(0x3, PF_GLINT_DYN_CTL_ITR_INDX_S)
+#define PF_GLINT_DYN_CTL_ITR_INDX_M	GENMASK(4, 3)
 #define PF_GLINT_DYN_CTL_INTERVAL_S	5
 #define PF_GLINT_DYN_CTL_INTERVAL_M	BIT(PF_GLINT_DYN_CTL_INTERVAL_S)
 #define PF_GLINT_DYN_CTL_SW_ITR_INDX_ENA_S	24
@@ -87,13 +87,13 @@
 	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
-#define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
+#define PF_GLINT_ITR_INTERVAL_M		GENMASK(11, 0)
 
 /* Timesync registers */
 #define PF_TIMESYNC_BASE		0x08404000
 #define PF_GLTSYN_CMD_SYNC		(PF_TIMESYNC_BASE)
 #define PF_GLTSYN_CMD_SYNC_EXEC_CMD_S	0
-#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	IDPF_M(0x3, PF_GLTSYN_CMD_SYNC_EXEC_CMD_S)
+#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	GENMASK(1, 0)
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_S	2
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_M	BIT(PF_GLTSYN_CMD_SYNC_SHTIME_EN_S)
 #define PF_GLTSYN_SHTIME_0		(PF_TIMESYNC_BASE + 0x4)
@@ -105,23 +105,23 @@
 /* Generic registers */
 #define PF_INT_DIR_OICR_ENA		0x08406000
 #define PF_INT_DIR_OICR_ENA_S		0
-#define PF_INT_DIR_OICR_ENA_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_ENA_S)
+#define PF_INT_DIR_OICR_ENA_M		GENMASK(31, 0)
 #define PF_INT_DIR_OICR			0x08406004
 #define PF_INT_DIR_OICR_TSYN_EVNT	0
 #define PF_INT_DIR_OICR_PHY_TS_0	BIT(1)
 #define PF_INT_DIR_OICR_PHY_TS_1	BIT(2)
 #define PF_INT_DIR_OICR_CAUSE		0x08406008
 #define PF_INT_DIR_OICR_CAUSE_CAUSE_S	0
-#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_CAUSE_CAUSE_S)
+#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	GENMASK(31, 0)
 #define PF_INT_PBA_CLEAR		0x0840600C
 
 #define PF_FUNC_RID			0x08406010
 #define PF_FUNC_RID_FUNCTION_NUMBER_S	0
-#define PF_FUNC_RID_FUNCTION_NUMBER_M	IDPF_M(0x7, PF_FUNC_RID_FUNCTION_NUMBER_S)
+#define PF_FUNC_RID_FUNCTION_NUMBER_M	GENMASK(2, 0)
 #define PF_FUNC_RID_DEVICE_NUMBER_S	3
-#define PF_FUNC_RID_DEVICE_NUMBER_M	IDPF_M(0x1F, PF_FUNC_RID_DEVICE_NUMBER_S)
+#define PF_FUNC_RID_DEVICE_NUMBER_M	GENMASK(7, 3)
 #define PF_FUNC_RID_BUS_NUMBER_S	8
-#define PF_FUNC_RID_BUS_NUMBER_M	IDPF_M(0xFF, PF_FUNC_RID_BUS_NUMBER_S)
+#define PF_FUNC_RID_BUS_NUMBER_M	GENMASK(15, 8)
 
 /* Reset registers */
 #define PFGEN_RTRIG			0x08407000
@@ -133,7 +133,7 @@
 #define PFGEN_RTRIG_IMCR_M		BIT(2)
 #define PFGEN_RSTAT			0x08407008 /* PFR Status */
 #define PFGEN_RSTAT_PFR_STATE_S		0
-#define PFGEN_RSTAT_PFR_STATE_M		IDPF_M(0x3, PFGEN_RSTAT_PFR_STATE_S)
+#define PFGEN_RSTAT_PFR_STATE_M		GENMASK(1, 0)
 #define PFGEN_CTRL			0x0840700C
 #define PFGEN_CTRL_PFSWR		BIT(0)
 
drivers/common/idpf/base/idpf_lan_txrx.h +52 -64

164 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +8 -8
index 4c5249129e..f394a0d67a 100644
@@ -9,7 +9,7 @@
 /* Reset */
 #define VFGEN_RSTAT			0x00008800
 #define VFGEN_RSTAT_VFR_STATE_S		0
-#define VFGEN_RSTAT_VFR_STATE_M		IDPF_M(0x3, VFGEN_RSTAT_VFR_STATE_S)
+#define VFGEN_RSTAT_VFR_STATE_M		GENMASK(1, 0)
 
 /* Control(VF Mailbox) Queue */
 #define VF_BASE				0x00006000
@@ -18,7 +18,7 @@
 #define VF_ATQBAH			(VF_BASE + 0x1800)
 #define VF_ATQLEN			(VF_BASE + 0x0800)
 #define VF_ATQLEN_ATQLEN_S		0
-#define VF_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, VF_ATQLEN_ATQLEN_S)
+#define VF_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define VF_ATQLEN_ATQVFE_S		28
 #define VF_ATQLEN_ATQVFE_M		BIT(VF_ATQLEN_ATQVFE_S)
 #define VF_ATQLEN_ATQOVFL_S		29
@@ -29,14 +29,14 @@
 #define VF_ATQLEN_ATQENABLE_M		BIT(VF_ATQLEN_ATQENABLE_S)
 #define VF_ATQH				(VF_BASE + 0x0400)
 #define VF_ATQH_ATQH_S			0
-#define VF_ATQH_ATQH_M			IDPF_M(0x3FF, VF_ATQH_ATQH_S)
+#define VF_ATQH_ATQH_M			GENMASK(9, 0)
 #define VF_ATQT				(VF_BASE + 0x2400)
 
 #define VF_ARQBAL			(VF_BASE + 0x0C00)
 #define VF_ARQBAH			(VF_BASE)
 #define VF_ARQLEN			(VF_BASE + 0x2000)
 #define VF_ARQLEN_ARQLEN_S		0
-#define VF_ARQLEN_ARQLEN_M		IDPF_M(0x3FF, VF_ARQLEN_ARQLEN_S)
+#define VF_ARQLEN_ARQLEN_M		GENMASK(9, 0)
 #define VF_ARQLEN_ARQVFE_S		28
 #define VF_ARQLEN_ARQVFE_M		BIT(VF_ARQLEN_ARQVFE_S)
 #define VF_ARQLEN_ARQOVFL_S		29
@@ -47,7 +47,7 @@
 #define VF_ARQLEN_ARQENABLE_M		BIT(VF_ARQLEN_ARQENABLE_S)
 #define VF_ARQH				(VF_BASE + 0x1400)
 #define VF_ARQH_ARQH_S			0
-#define VF_ARQH_ARQH_M			IDPF_M(0x1FFF, VF_ARQH_ARQH_S)
+#define VF_ARQH_ARQH_M			GENMASK(12, 0)
 #define VF_ARQT				(VF_BASE + 0x1000)
 
 /* Transmit queues */
@@ -69,7 +69,7 @@
 #define VF_INT_DYN_CTL0_INTENA_S	0
 #define VF_INT_DYN_CTL0_INTENA_M	BIT(VF_INT_DYN_CTL0_INTENA_S)
 #define VF_INT_DYN_CTL0_ITR_INDX_S	3
-#define VF_INT_DYN_CTL0_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTL0_ITR_INDX_S)
+#define VF_INT_DYN_CTL0_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN(_INT)		(0x00003800 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_EXT(_INT)	(0x00070000 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_INTENA_S	0
@@ -79,7 +79,7 @@
 #define VF_INT_DYN_CTLN_SWINT_TRIG_S	2
 #define VF_INT_DYN_CTLN_SWINT_TRIG_M	BIT(VF_INT_DYN_CTLN_SWINT_TRIG_S)
 #define VF_INT_DYN_CTLN_ITR_INDX_S	3
-#define VF_INT_DYN_CTLN_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTLN_ITR_INDX_S)
+#define VF_INT_DYN_CTLN_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN_INTERVAL_S	5
 #define VF_INT_DYN_CTLN_INTERVAL_M	BIT(VF_INT_DYN_CTLN_INTERVAL_S)
 #define VF_INT_DYN_CTLN_SW_ITR_INDX_ENA_S	24
@@ -113,7 +113,7 @@
 	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
-#define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
+#define VF_INT_ITRN_INTERVAL_M		GENMASK(11, 0)
 #define VF_INT_PBA_CLEAR		0x00008900
 
 #define VF_INT_ICR0_ENA1		0x00005000
drivers/common/idpf/base/idpf_osdep.h +7 -0
index 2a817a9807..74a376cb13 100644
@@ -48,6 +48,13 @@ typedef struct idpf_lock idpf_lock;
 
 #define IDPF_M(m, s)		((m) << (s))
 
+#define BITS_PER_LONG (8 * sizeof(long))
+#define BITS_PER_LONG_LONG (8 * sizeof(long long))
+#define GENMASK(h, l) \
+	(((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+
 #ifndef ETH_ADDR_LEN
 #define ETH_ADDR_LEN		6
 #endif
Signature · 1 line
2.25.1
#48 lore raw

PATCH v3 14/17 common/idpf/base: use 'type functionname(args)' style

In reply to Simei Su

Instead of splitting the function name and function type into multiple lines, use then in a single line.

---
 drivers/common/idpf/base/idpf_controlq.c       | 5 ++---
 drivers/common/idpf/base/idpf_controlq_setup.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -3
index c24bfd23ef..07bbec91b9 100644
@@ -9,9 +9,8 @@
  * @cq: pointer to the specific control queue
  * @q_create_info: structs containing info for each queue to be initialized
  */
-static void
-idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
-		     struct idpf_ctlq_create_info *q_create_info)
+static void idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
+				 struct idpf_ctlq_create_info *q_create_info)
 {
 	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
drivers/common/idpf/base/idpf_controlq_setup.c +2 -3
index 0f1b52a7e9..21f43c74f5 100644
@@ -11,9 +11,8 @@
  * @hw: pointer to hw struct
  * @cq: pointer to the specific Control queue
  */
-static int
-idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
-			  struct idpf_ctlq_info *cq)
+static int idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
+				     struct idpf_ctlq_info *cq)
 {
 	size_t size = cq->ring_size * sizeof(struct idpf_ctlq_desc);
 
Signature · 1 line
2.25.1
#49 lore raw

PATCH v3 15/17 common/idpf/base: don't declare union with 'flex'

In reply to Simei Su

In idpf_flex_tx_desc structure, instead of naming the union with 'flex', use no name union as the union name is not really necessary there. This reduces the level of indirection in the hotpath.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +2 -2
index f213c49e47..1e19aeafac 100644
@@ -226,11 +226,11 @@ enum idpf_tx_flex_desc_cmd_bits {
 struct idpf_flex_tx_desc {
 	__le64 buf_addr;	/* Packet buffer address */
 	struct {
-		__le16 cmd_dtype;
 #define IDPF_FLEX_TXD_QW1_DTYPE_S	0
 #define IDPF_FLEX_TXD_QW1_DTYPE_M	GENMASK(4, 0)
 #define IDPF_FLEX_TXD_QW1_CMD_S		5
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
+		__le16 cmd_dtype;
 		union {
 			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
 			u8 raw[4];
@@ -247,7 +247,7 @@ struct idpf_flex_tx_desc {
 				__le16 l2tag1;
 				__le16 l2tag2;
 			} l2tags;
-		} flex;
+		};
 		__le16 buf_size;
 	} qw1;
 };
Signature · 1 line
2.25.1
#50 lore raw

PATCH v3 16/17 common/idpf/base: remove unused Tx descriptor types

In reply to Simei Su

Remove the unused TX descriptor types and mark them as reserved.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 132 ++---------------------
 1 file changed, 10 insertions(+), 122 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +10 -122
index 1e19aeafac..5bc4271584 100644
@@ -120,19 +120,19 @@ enum idpf_rss_hash {
 enum idpf_tx_desc_dtype_value {
 	IDPF_TX_DESC_DTYPE_DATA				= 0,
 	IDPF_TX_DESC_DTYPE_CTX				= 1,
-	IDPF_TX_DESC_DTYPE_REINJECT_CTX			= 2,
-	IDPF_TX_DESC_DTYPE_FLEX_DATA			= 3,
-	IDPF_TX_DESC_DTYPE_FLEX_CTX			= 4,
+	/* DTYPE 2 is reserved
+	 * DTYPE 3 is free for future use
+	 * DTYPE 4 is reserved
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX			= 5,
-	IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1		= 6,
+	/* DTYPE 6 is reserved */
 	IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2		= 7,
-	IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX	= 8,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_TSO_CTX	= 9,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_CTX	= 10,
-	IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX		= 11,
+	/* DTYPE 8, 9 are free for future use
+	 * DTYPE 10 is reserved
+	 * DTYPE 11 is free for future use
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE		= 12,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_TSO_CTX	= 13,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_CTX		= 14,
+	/* DTYPE 13, 14 are free for future use */
 	/* DESC_DONE - HW has completed write-back of descriptor */
 	IDPF_TX_DESC_DTYPE_DESC_DONE			= 15,
 };
@@ -232,16 +232,6 @@ struct idpf_flex_tx_desc {
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
 		__le16 cmd_dtype;
 		union {
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
-			u8 raw[4];
-
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1 (0x06) */
-			struct {
-				__le16 l2tag1;
-				u8 flex;
-				u8 tsync;
-			} tsync;
-
 			/* DTYPE=IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2 (0x07) */
 			struct {
 				__le16 l2tag1;
@@ -297,16 +287,6 @@ struct idpf_flex_tx_tso_ctx_qw {
 };
 
 union idpf_flex_tx_ctx_desc {
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_CTX (0x04) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag1;
-			u8 qw1_flex[4];
-		} qw1;
-	} gen;
-
 	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX (0x05) */
 	struct {
 		struct idpf_flex_tx_tso_ctx_qw qw0;
@@ -315,98 +295,6 @@ union idpf_flex_tx_ctx_desc {
 			u8 flex[6];
 		} qw1;
 	} tso;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX (0x08) */
-	struct {
-		struct idpf_flex_tx_tso_ctx_qw qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex0;
-			u8 ptag;
-			u8 flex1[2];
-		} qw1;
-	} tso_l2tag2_ptag;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX (0x0B) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex[4];
-		} qw1;
-	} l2tag2;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_REINJECT_CTX (0x02) */
-	struct {
-		struct {
-			__le32 sa_domain;
-#define IDPF_TXD_FLEX_CTX_SA_DOM_M	0xFFFF
-#define IDPF_TXD_FLEX_CTX_SA_DOM_VAL	0x10000
-			__le32 sa_idx;
-#define IDPF_TXD_FLEX_CTX_SAIDX_M	0x1FFFFF
-		} qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 txr2comp;
-#define IDPF_TXD_FLEX_CTX_TXR2COMP	0x1
-			__le16 miss_txq_comp_tag;
-			__le16 miss_txq_id;
-		} qw1;
-	} reinjection_pkt;
 };
 
-/* Host Split Context Descriptors */
-struct idpf_flex_tx_hs_ctx_desc {
-	union {
-		struct {
-			__le32 host_fnum_tlen;
-#define IDPF_TXD_FLEX_CTX_TLEN_S	0
-/* see IDPF_TXD_FLEX_CTX_TLEN_M for mask definition */
-#define IDPF_TXD_FLEX_CTX_FNUM_S	18
-#define IDPF_TXD_FLEX_CTX_FNUM_M	0x7FF
-#define IDPF_TXD_FLEX_CTX_HOST_S	29
-#define IDPF_TXD_FLEX_CTX_HOST_M	0x7
-			__le16 ftype_mss_rt;
-#define IDPF_TXD_FLEX_CTX_MSS_RT_0	0
-#define IDPF_TXD_FLEX_CTX_MSS_RT_M	0x3FFF
-#define IDPF_TXD_FLEX_CTX_FTYPE_S	14
-#define IDPF_TXD_FLEX_CTX_FTYPE_VF	0
-#define IDPF_TXD_FLEX_CTX_FTYPE_VDEV	BIT(14)
-#define IDPF_TXD_FLEX_CTX_FTYPE_PF	BIT(15)
-			u8 hdr_len;
-			u8 ptag;
-		} tso;
-		struct {
-			u8 flex0[2];
-			__le16 host_fnum_ftype;
-			u8 flex1[3];
-			u8 ptag;
-		} no_tso;
-	} qw0;
-
-	__le64 qw1_cmd_dtype;
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_S		16
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_M		0xFFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S	36
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S)
-#define IDPF_TXD_FLEX_CTX_QW1_TPH_S		37
-#define IDPF_TXD_FLEX_CTX_QW1_TPH		\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_TPH_S)
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_S		38
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_M		0xF
-/* The following are only valid for DTYPE = 0x09 and DTYPE = 0x0A */
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_S		42
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_M		0x1FFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S	63
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S)
-/* The following are only valid for DTYPE = 0x0D and DTYPE = 0x0E */
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_S		48
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_M		0xFF
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_S		56
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_M		0xFF
-};
 #endif /* _IDPF_LAN_TXRX_H_ */
Signature · 1 line
2.25.1
#51 lore raw

PATCH v3 17/17 common/idpf/base: update version

In reply to Simei Su

Update README

---
 drivers/common/idpf/base/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/idpf/base/README +1 -1
index 693049c057..ff26f736ec 100644
@@ -6,7 +6,7 @@ Intel® IDPF driver
 ==================
 
 This directory contains source code of BSD-3-Clause idpf driver of version
-2023.02.23 released by the team which develops basic drivers for Intel IPU.
+2023.07.25 released by the team which develops basic drivers for Intel IPU.
 The directory of base/ contains the original source package.
 This driver is valid for the product(s) listed below
 
Signature · 1 line
2.25.1
Acked-by on the v3 series
#52 lore raw
In reply to Simei Su
Quoted 56 lines

-----Original Message-----
From: Su, Simei <[email protected]>
Sent: Friday, September 15, 2023 10:17 AM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Liu, Mingxia <[email protected]>; Qiao, Wenjing <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH v3 00/17] update idpf base code

This patch set updates idpf base code.

v3:
* Fix coding style issue.
* Modify unexpected error in the update version patch.

v2:
* Add two patches for share code update.
* Add version update.
* Fix coding style issue.

Simei Su (17):
common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initial PTP support common/idpf/base: remove mailbox registers common/idpf/base: add some adi specific fields common/idpf/base: add necessary check common/idpf/base: add union for SW cookie fields in ctlq msg common/idpf/base: define non-flexible size structure for ADI common/idpf/base: use local pointer before updating 'CQ out' common/idpf/base: use 'void' return type common/idpf/base: refactor descriptor 'ret val' stripping common/idpf/base: refine comments and alignment common/idpf/base: use GENMASK macro common/idpf/base: use 'type functionname(args)' style common/idpf/base: don't declare union with 'flex' common/idpf/base: remove unused Tx descriptor types common/idpf/base: update version

 .mailmap                                      |   7 +
 drivers/common/idpf/base/README               |   2 +-
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 285 +++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 303 ++++++++++++++++--
 13 files changed, 462 insertions(+), 327 deletions(-)
Quoted 2 lines

--
2.25.1

#53 lore raw

v4 cover update idpf base code

In reply to Simei Su

Currently, single queue Tx data path uses flex Tx data descriptor(DTYPE3) which is removed in the latest idpf spec. [PATCH v4 01/18] replaces flex Tx data descriptor with base Tx data descriptor for single queue Tx data path and refines Tx single queue setup to align with Tx data path.

[PATCH v4 02/18]~[PATCH v4 18/18] update idpf base code based on [PATCH v4 01/18].

v4:
* Put single queue Tx data path refactor patch in this patchset.

v3:
* Fix coding style issue.
* Modify unexpected error in the update version patch.

v2:
* Add two patches for share code update.
* Add version update.
* Fix coding style issue.

Simei Su (18):
common/idpf: refactor single queue Tx data path common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initial PTP support common/idpf/base: remove mailbox registers common/idpf/base: add some adi specific fields common/idpf/base: add necessary check common/idpf/base: add union for SW cookie fields in ctlq msg common/idpf/base: define non-flexible size structure for ADI common/idpf/base: use local pointer before updating 'CQ out' common/idpf/base: use 'void' return type common/idpf/base: refactor descriptor 'ret val' stripping common/idpf/base: refine comments and alignment common/idpf/base: use GENMASK macro common/idpf/base: use 'type functionname(args)' style common/idpf/base: don't declare union with 'flex' common/idpf/base: remove unused Tx descriptor types common/idpf/base: update version

 .mailmap                                      |   7 +
 drivers/common/idpf/base/README               |   2 +-
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 285 +++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 303 ++++++++++++++++--
 drivers/common/idpf/idpf_common_rxtx.c        |  39 ++-
 drivers/common/idpf/idpf_common_rxtx.h        |   2 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c |  37 ++-
 drivers/net/cpfl/cpfl_rxtx.c                  |   2 +-
 drivers/net/idpf/idpf_rxtx.c                  |   2 +-
 18 files changed, 502 insertions(+), 369 deletions(-)
Signature · 1 line
2.25.1
#54 lore raw

PATCH v4 1/18 common/idpf: refactor single queue Tx data path

Currently, single queue Tx data path uses flex Tx data descriptor(DTYPE3) which is removed in the latest idpf spec. This patch replaces flex Tx data descriptor with base Tx data descriptor for single queue Tx data path and refines Tx single queue setup to align with Tx data path.

---
 drivers/common/idpf/idpf_common_rxtx.c        | 39 +++++++++----------
 drivers/common/idpf/idpf_common_rxtx.h        |  2 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c | 37 +++++++++---------
 drivers/net/cpfl/cpfl_rxtx.c                  |  2 +-
 drivers/net/idpf/idpf_rxtx.c                  |  2 +-
 5 files changed, 40 insertions(+), 42 deletions(-)
drivers/common/idpf/idpf_common_rxtx.c +19 -20
index fc87e3e243..e6d2486272 100644
@@ -276,14 +276,14 @@ idpf_qc_single_tx_queue_reset(struct idpf_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct idpf_flex_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct idpf_base_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->tx_ring[i].qw1.cmd_dtype =
-			rte_cpu_to_le_16(IDPF_TX_DESC_DTYPE_DESC_DONE);
+		txq->tx_ring[i].qw1 =
+			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
 		txe[prev].next_id = i;
@@ -1307,17 +1307,16 @@ idpf_xmit_cleanup(struct idpf_tx_queue *txq)
 	uint16_t nb_tx_to_clean;
 	uint16_t i;
 
-	volatile struct idpf_flex_tx_desc *txd = txq->tx_ring;
+	volatile struct idpf_base_tx_desc *txd = txq->tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	/* In the writeback Tx desccriptor, the only significant fields are the 4-bit DTYPE */
-	if ((txd[desc_to_clean_to].qw1.cmd_dtype &
-	     rte_cpu_to_le_16(IDPF_TXD_QW1_DTYPE_M)) !=
-	    rte_cpu_to_le_16(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
+	if ((txd[desc_to_clean_to].qw1 &
+	     rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
+	    rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
 		TX_LOG(DEBUG, "TX descriptor %4u is not done "
 		       "(port=%d queue=%d)", desc_to_clean_to,
 		       txq->port_id, txq->queue_id);
@@ -1331,10 +1330,7 @@ idpf_xmit_cleanup(struct idpf_tx_queue *txq)
 		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
 					    last_desc_cleaned);
 
-	txd[desc_to_clean_to].qw1.cmd_dtype = 0;
-	txd[desc_to_clean_to].qw1.buf_size = 0;
-	for (i = 0; i < RTE_DIM(txd[desc_to_clean_to].qw1.flex.raw); i++)
-		txd[desc_to_clean_to].qw1.flex.raw[i] = 0;
+	txd[desc_to_clean_to].qw1 = 0;
 
 	txq->last_desc_cleaned = desc_to_clean_to;
 	txq->nb_free = (uint16_t)(txq->nb_free + nb_tx_to_clean);
@@ -1347,8 +1343,8 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	volatile struct idpf_flex_tx_desc *txd;
-	volatile struct idpf_flex_tx_desc *txr;
+	volatile struct idpf_base_tx_desc *txd;
+	volatile struct idpf_base_tx_desc *txr;
 	union idpf_tx_offload tx_offload = {0};
 	struct idpf_tx_entry *txe, *txn;
 	struct idpf_tx_entry *sw_ring;
@@ -1356,6 +1352,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
 	uint64_t buf_dma_addr;
+	uint32_t td_offset;
 	uint64_t ol_flags;
 	uint16_t tx_last;
 	uint16_t nb_used;
@@ -1382,6 +1379,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
 		td_cmd = 0;
+		td_offset = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
@@ -1462,9 +1460,10 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			slen = m_seg->data_len;
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
 			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->qw1.buf_size = slen;
-			txd->qw1.cmd_dtype = rte_cpu_to_le_16(IDPF_TX_DESC_DTYPE_FLEX_DATA <<
-							      IDPF_FLEX_TXD_QW1_DTYPE_S);
+			txd->qw1 = rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |
+				((uint64_t)td_cmd  << IDPF_TXD_QW1_CMD_S) |
+				((uint64_t)td_offset << IDPF_TXD_QW1_OFFSET_S) |
+				((uint64_t)slen << IDPF_TXD_QW1_TX_BUF_SZ_S));
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
@@ -1473,7 +1472,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		} while (m_seg);
 
 		/* The last packet data descriptor needs End Of Packet (EOP) */
-		td_cmd |= IDPF_TX_FLEX_DESC_CMD_EOP;
+		td_cmd |= IDPF_TX_DESC_CMD_EOP;
 		txq->nb_used = (uint16_t)(txq->nb_used + nb_used);
 		txq->nb_free = (uint16_t)(txq->nb_free - nb_used);
 
@@ -1482,7 +1481,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       "%4u (port=%d queue=%d)",
 			       tx_last, txq->port_id, txq->queue_id);
 
-			td_cmd |= IDPF_TX_FLEX_DESC_CMD_RS;
+			td_cmd |= IDPF_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
 			txq->nb_used = 0;
@@ -1491,7 +1490,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK)
 			td_cmd |= IDPF_TX_FLEX_DESC_CMD_CS_EN;
 
-		txd->qw1.cmd_dtype |= rte_cpu_to_le_16(td_cmd << IDPF_FLEX_TXD_QW1_CMD_S);
+		txd->qw1 |= rte_cpu_to_le_16(td_cmd << IDPF_TXD_QW1_CMD_S);
 	}
 
 end_of_tx:
drivers/common/idpf/idpf_common_rxtx.h +1 -1
index 6cb83fc0a6..b49b1ed737 100644
@@ -157,7 +157,7 @@ struct idpf_tx_entry {
 /* Structure associated with each TX queue. */
 struct idpf_tx_queue {
 	const struct rte_memzone *mz;		/* memzone for Tx ring */
-	volatile struct idpf_flex_tx_desc *tx_ring;	/* Tx ring virtual address */
+	volatile struct idpf_base_tx_desc *tx_ring;	/* Tx ring virtual address */
 	volatile union {
 		struct idpf_flex_tx_sched_desc *desc_ring;
 		struct idpf_splitq_tx_compl_desc *compl_ring;
drivers/common/idpf/idpf_common_rxtx_avx512.c +18 -19
index 2ac46fb1d2..f65e8d512b 100644
@@ -1005,7 +1005,7 @@ idpf_tx_singleq_free_bufs_avx512(struct idpf_tx_queue *txq)
 	struct rte_mbuf *m, *free[txq->rs_thresh];
 
 	/* check DD bits on threshold descriptor */
-	if ((txq->tx_ring[txq->next_dd].qw1.cmd_dtype &
+	if ((txq->tx_ring[txq->next_dd].qw1 &
 			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
 			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
@@ -1113,15 +1113,14 @@ tx_backlog_entry_avx512(struct idpf_tx_vec_entry *txep,
 		txep[i].mbuf = tx_pkts[i];
 }
 
-#define IDPF_FLEX_TXD_QW1_BUF_SZ_S 48
 static __rte_always_inline void
-idpf_singleq_vtx1(volatile struct idpf_flex_tx_desc *txdp,
+idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw =
-		(IDPF_TX_DESC_DTYPE_FLEX_DATA << IDPF_FLEX_TXD_QW1_DTYPE_S |
-		 ((uint64_t)flags  << IDPF_FLEX_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << IDPF_FLEX_TXD_QW1_BUF_SZ_S));
+		(IDPF_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags  << IDPF_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << IDPF_TXD_QW1_TX_BUF_SZ_S));
 
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 					    pkt->buf_iova + pkt->data_off);
@@ -1131,11 +1130,11 @@ idpf_singleq_vtx1(volatile struct idpf_flex_tx_desc *txdp,
 #define IDPF_TX_LEN_MASK 0xAA
 #define IDPF_TX_OFF_MASK 0x55
 static __rte_always_inline void
-idpf_singleq_vtx(volatile struct idpf_flex_tx_desc *txdp,
+idpf_singleq_vtx(volatile struct idpf_base_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_FLEX_DATA  |
-			((uint64_t)flags  << IDPF_FLEX_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA  |
+			((uint64_t)flags  << IDPF_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -1148,19 +1147,19 @@ idpf_singleq_vtx(volatile struct idpf_flex_tx_desc *txdp,
 		uint64_t hi_qw3 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[3]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw2 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[2]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw1 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[1]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw0 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[0]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 
 		__m512i desc0_3 =
 			_mm512_set_epi64
@@ -1187,11 +1186,11 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 					 uint16_t nb_pkts)
 {
 	struct idpf_tx_queue *txq = tx_queue;
-	volatile struct idpf_flex_tx_desc *txdp;
+	volatile struct idpf_base_tx_desc *txdp;
 	struct idpf_tx_vec_entry *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = IDPF_TX_FLEX_DESC_CMD_EOP;
-	uint64_t rs = IDPF_TX_FLEX_DESC_CMD_RS | flags;
+	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
+	uint64_t rs = IDPF_TX_DESC_CMD_RS | flags;
 
 	/* cross rx_thresh boundary is not allowed */
 	nb_pkts = RTE_MIN(nb_pkts, txq->rs_thresh);
@@ -1238,9 +1237,9 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->next_rs) {
-		txq->tx_ring[txq->next_rs].qw1.cmd_dtype |=
-			rte_cpu_to_le_64(((uint64_t)IDPF_TX_FLEX_DESC_CMD_RS) <<
-					 IDPF_FLEX_TXD_QW1_CMD_S);
+		txq->tx_ring[txq->next_rs].qw1 |=
+			rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
+					 IDPF_TXD_QW1_CMD_S);
 		txq->next_rs =
 			(uint16_t)(txq->next_rs + txq->rs_thresh);
 	}
drivers/net/cpfl/cpfl_rxtx.c +1 -1
index 2ef6871a85..ab8bec4645 100644
@@ -135,7 +135,7 @@ cpfl_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_sched_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		memcpy(ring_name, "cpfl Tx ring", sizeof("cpfl Tx ring"));
 		break;
drivers/net/idpf/idpf_rxtx.c +1 -1
index 3e3d81ca6d..64f2235580 100644
@@ -74,7 +74,7 @@ idpf_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_sched_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		rte_memcpy(ring_name, "idpf Tx ring", sizeof("idpf Tx ring"));
 		break;
Signature · 1 line
2.25.1
#55 lore raw

PATCH v4 2/18 common/idpf/base: enable support for physical port stats

In reply to Simei Su

Add support to indicate physical port representor and query its statistics.

---
 .mailmap                             |  2 +
 drivers/common/idpf/base/virtchnl2.h | 80 +++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
.mailmap +2 -0
index 4dac53011b..3dfdd81797 100644
@@ -1639,3 +1639,5 @@ Ziye Yang <[email protected]>
 Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
+Jayaprakash Shanmugam <[email protected]>
+Zhenning Xiao <[email protected]>
drivers/common/idpf/base/virtchnl2.h +79 -1

116 lines not on this page · raw message

Signature · 1 line
2.25.1
#56 lore raw

PATCH v4 3/18 common/idpf/base: add miss completion capabilities

In reply to Simei Su

Add miss completion tag to other capabilities list, to indicate support for detecting a miss completion based on the upper bit of the completion tag.

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 4 ++++
 2 files changed, 5 insertions(+)
.mailmap +1 -0
index 3dfdd81797..91d8cca78f 100644
@@ -1641,3 +1641,4 @@ Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
+Josh Hay <[email protected]>
drivers/common/idpf/base/virtchnl2.h +4 -0
index cd47444835..c49e4b943c 100644
@@ -231,6 +231,10 @@
 #define VIRTCHNL2_CAP_RX_FLEX_DESC		BIT(17)
 #define VIRTCHNL2_CAP_PTYPE			BIT(18)
 #define VIRTCHNL2_CAP_LOOPBACK			BIT(19)
+/* Enable miss completion types plus ability to detect a miss completion if a
+ * reserved bit is set in a standared completion's tag.
+ */
+#define VIRTCHNL2_CAP_MISS_COMPL_TAG		BIT(20)
 /* this must be the last capability */
 #define VIRTCHNL2_CAP_OEM			BIT(63)
 
Signature · 1 line
2.25.1
#57 lore raw

PATCH v4 4/18 common/idpf/base: initial PTP support

In reply to Simei Su

Adding a few PTP capabilities to determine which PTP features are enabled - legacy cross time, ptm, device clock control, PTP Tx timestamp with direct registers access, PTP Tx timestamp using virtchnl messages.

Creating structures and opcodes to support feautres introduced by capabilities.

---
 drivers/common/idpf/base/virtchnl2.h | 145 +++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)
drivers/common/idpf/base/virtchnl2.h +145 -0
index c49e4b943c..320430df6f 100644
@@ -98,6 +98,9 @@
 #define		VIRTCHNL2_OP_ADD_QUEUE_GROUPS		538
 #define		VIRTCHNL2_OP_DEL_QUEUE_GROUPS		539
 #define		VIRTCHNL2_OP_GET_PORT_STATS		540
+	/* TimeSync opcodes */
+#define		VIRTCHNL2_OP_GET_PTP_CAPS		541
+#define		VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES	542
 
 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX	0xFFFF
 
@@ -1395,6 +1398,112 @@ struct virtchnl2_promisc_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_promisc_info);
 
+/* VIRTCHNL2_PTP_CAPS
+ * PTP capabilities
+ */
+#define VIRTCHNL2_PTP_CAP_LEGACY_CROSS_TIME	BIT(0)
+#define VIRTCHNL2_PTP_CAP_PTM			BIT(1)
+#define VIRTCHNL2_PTP_CAP_DEVICE_CLOCK_CONTROL	BIT(2)
+#define VIRTCHNL2_PTP_CAP_TX_TSTAMPS_DIRECT	BIT(3)
+#define	VIRTCHNL2_PTP_CAP_TX_TSTAMPS_VIRTCHNL	BIT(4)
+
+/* Legacy cross time registers offsets */
+struct virtchnl2_ptp_legacy_cross_time_reg {
+	__le32 shadow_time_0;
+	__le32 shadow_time_l;
+	__le32 shadow_time_h;
+	__le32 cmd_sync;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_legacy_cross_time_reg);
+
+/* PTM cross time registers offsets */
+struct virtchnl2_ptp_ptm_cross_time_reg {
+	__le32 art_l;
+	__le32 art_h;
+	__le32 cmd_sync;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_ptm_cross_time_reg);
+
+/* Registers needed to control the main clock */
+struct virtchnl2_ptp_device_clock_control {
+	__le32 cmd;
+	__le32 incval_l;
+	__le32 incval_h;
+	__le32 shadj_l;
+	__le32 shadj_h;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_device_clock_control);
+
+/* Structure that defines tx tstamp entry - index and register offset */
+struct virtchnl2_ptp_tx_tstamp_entry {
+	__le32 tx_latch_register_base;
+	__le32 tx_latch_register_offset;
+	u8 index;
+	u8 pad[7];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_entry);
+
+/* Structure that defines tx tstamp entries - total number of latches
+ * and the array of entries.
+ */
+struct virtchnl2_ptp_tx_tstamp {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_entry ptp_tx_tstamp_entries[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp);
+
+/* VIRTCHNL2_OP_GET_PTP_CAPS
+ * PV/VF sends this message to negotiate PTP capabilities. CP updates bitmap
+ * with supported features and fulfills appropriate structures.
+ */
+struct virtchnl2_get_ptp_caps {
+	/* PTP capability bitmap */
+	/* see VIRTCHNL2_PTP_CAPS definitions */
+	__le32 ptp_caps;
+	u8 pad[4];
+
+	struct virtchnl2_ptp_legacy_cross_time_reg legacy_cross_time_reg;
+	struct virtchnl2_ptp_ptm_cross_time_reg ptm_cross_time_reg;
+	struct virtchnl2_ptp_device_clock_control device_clock_control;
+	struct virtchnl2_ptp_tx_tstamp tx_tstamp;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(88, virtchnl2_get_ptp_caps);
+
+/* Structure that describes tx tstamp values, index and validity */
+struct virtchnl2_ptp_tx_tstamp_latch {
+	__le32 tstamp_h;
+	__le32 tstamp_l;
+	u8 index;
+	u8 valid;
+	u8 pad[6];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_latch);
+
+/* VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES
+ * PF/VF sends this message to receive a specified number of timestamps
+ * entries.
+ */
+struct virtchnl2_ptp_tx_tstamp_latches {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_latch tstamp_latches[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp_latches);
 
 static inline const char *virtchnl2_op_str(__le32 v_opcode)
 {
@@ -1463,6 +1572,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_GET_PORT_STATS:
 		return "VIRTCHNL2_OP_GET_PORT_STATS";
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		return "VIRTCHNL2_OP_GET_PTP_CAPS";
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		return "VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES";
 	default:
 		return "Unsupported (update virtchnl2.h)";
 	}
@@ -1732,6 +1845,38 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 		break;
 	case VIRTCHNL2_OP_RESET_VF:
 		break;
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		valid_len = sizeof(struct virtchnl2_get_ptp_caps);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_get_ptp_caps *ptp_caps =
+			(struct virtchnl2_get_ptp_caps *)msg;
+
+			if (ptp_caps->tx_tstamp.num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((ptp_caps->tx_tstamp.num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_entry));
+		}
+		break;
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches =
+			(struct virtchnl2_ptp_tx_tstamp_latches *)msg;
+
+			if (tx_tstamp_latches->num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((tx_tstamp_latches->num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_latch));
+		}
+		break;
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL2_OP_EVENT:
 	case VIRTCHNL2_OP_UNKNOWN:
Signature · 1 line
2.25.1
#58 lore raw

PATCH v4 5/18 common/idpf/base: remove mailbox registers

In reply to Simei Su

Removing mailbox register offsets as the mapping to device register offsets are different between CVL and MEV (they are swapped out) individual drivers will define the offsets based on how registers are hardware addressed. However the it will begin with VDEV_MBX_START offset.

---
 .mailmap                             |  1 +
 drivers/common/idpf/base/siov_regs.h | 13 ++-----------
 2 files changed, 3 insertions(+), 11 deletions(-)
.mailmap +1 -0
index 91d8cca78f..d8782cd67e 100644
@@ -1642,3 +1642,4 @@ Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
+Madhu Chittim <[email protected]>
drivers/common/idpf/base/siov_regs.h +2 -11
index fad329601a..7e1ae2e300 100644
@@ -4,16 +4,6 @@
 #ifndef _SIOV_REGS_H_
 #define _SIOV_REGS_H_
 #define VDEV_MBX_START			0x20000 /* Begin at 128KB */
-#define VDEV_MBX_ATQBAL			(VDEV_MBX_START + 0x0000)
-#define VDEV_MBX_ATQBAH			(VDEV_MBX_START + 0x0004)
-#define VDEV_MBX_ATQLEN			(VDEV_MBX_START + 0x0008)
-#define VDEV_MBX_ATQH			(VDEV_MBX_START + 0x000C)
-#define VDEV_MBX_ATQT			(VDEV_MBX_START + 0x0010)
-#define VDEV_MBX_ARQBAL			(VDEV_MBX_START + 0x0014)
-#define VDEV_MBX_ARQBAH			(VDEV_MBX_START + 0x0018)
-#define VDEV_MBX_ARQLEN			(VDEV_MBX_START + 0x001C)
-#define VDEV_MBX_ARQH			(VDEV_MBX_START + 0x0020)
-#define VDEV_MBX_ARQT			(VDEV_MBX_START + 0x0024)
 #define VDEV_GET_RSTAT			0x21000 /* 132KB for RSTAT */
 
 /* Begin at offset after 1MB (after 256 4k pages) */
@@ -43,5 +33,6 @@
 #define VDEV_INT_ITR_1(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x08)
 #define VDEV_INT_ITR_2(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x0C)
 
-/* Next offset to begin at 42MB (0x2A00000) */
+#define SIOV_REG_BAR_SIZE               0x2A00000
+/* Next offset to begin at 42MB + 4K (0x2A00000 + 0x1000) */
 #endif /* _SIOV_REGS_H_ */
Signature · 1 line
2.25.1
#59 lore raw

PATCH v4 6/18 common/idpf/base: add some adi specific fields

In reply to Simei Su

a) Add maximum ADI count in capabilities message
b) Add PF side ADI index to create_adi message
c) Define another constant to indicate 'Function active' state of ADI

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
.mailmap +1 -0
index d8782cd67e..75d534c53d 100644
@@ -1643,3 +1643,4 @@ Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
+Shailendra Bhatnagar <[email protected]>
drivers/common/idpf/base/virtchnl2.h +6 -2
index 320430df6f..7a099f5148 100644
@@ -294,6 +294,7 @@
 /* These messages are only sent to PF from CP */
 #define VIRTCHNL2_EVENT_START_RESET_ADI		2
 #define VIRTCHNL2_EVENT_FINISH_RESET_ADI	3
+#define VIRTCHNL2_EVENT_ADI_ACTIVE		4
 
 /* VIRTCHNL2_QUEUE_TYPE
  * Transmit and Receive queue types are valid in legacy as well as split queue
@@ -547,7 +548,8 @@ struct virtchnl2_get_capabilities {
 	u8 max_sg_bufs_per_tx_pkt;
 
 	u8 reserved1;
-	__le16 pad1;
+	/* upper bound of number of ADIs supported */
+	__le16 max_adis;
 
 	/* version of Control Plane that is running */
 	__le16 oem_cp_ver_major;
@@ -1076,10 +1078,12 @@ struct virtchnl2_create_adi {
 	__le16 mbx_id;
 	/* PF sends mailbox vector id to CP */
 	__le16 mbx_vec_id;
+	/* PF populates this ADI index */
+	__le16 adi_index;
 	/* CP populates ADI id */
 	__le16 adi_id;
 	u8 reserved[64];
-	u8 pad[6];
+	u8 pad[4];
 	/* CP populates queue chunks */
 	struct virtchnl2_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
Signature · 1 line
2.25.1
#60 lore raw

PATCH v4 7/18 common/idpf/base: add necessary check

In reply to Simei Su

Add necessary check for payload and message buffer.

---
 .mailmap                               | 1 +
 drivers/common/idpf/base/idpf_common.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
.mailmap +1 -0
index 75d534c53d..23aed53102 100644
@@ -1644,3 +1644,4 @@ Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
+Julianx Grajkowski <[email protected]>
drivers/common/idpf/base/idpf_common.c +4 -2
index fbf71416fd..9610916aa9 100644
@@ -239,8 +239,10 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 	e->desc.ret_val = msg.status;
 	e->desc.datalen = msg.data_len;
 	if (msg.data_len > 0) {
-		if (!msg.ctx.indirect.payload)
-			return -EINVAL;
+		if (!msg.ctx.indirect.payload || !msg.ctx.indirect.payload->va ||
+		    !e->msg_buf) {
+			return -EFAULT;
+		}
 		e->buf_len = msg.data_len;
 		msg_data_len = msg.data_len;
 		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,
Signature · 1 line
2.25.1
#61 lore raw

PATCH v4 8/18 common/idpf/base: add union for SW cookie fields in ctlq msg

In reply to Simei Su

Instead of using something like a byte offset, we can add a union to the struct here to enable direct addressing.

---
 .mailmap                                     | 1 +
 drivers/common/idpf/base/idpf_controlq_api.h | 5 +++++
 2 files changed, 6 insertions(+)
.mailmap +1 -0
index 23aed53102..2fcadb4e4c 100644
@@ -1645,3 +1645,4 @@ Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
 Julianx Grajkowski <[email protected]>
+Alan Brady <[email protected]>
drivers/common/idpf/base/idpf_controlq_api.h +5 -0
index 3780304256..f4e7b53ac9 100644
@@ -77,6 +77,11 @@ struct idpf_ctlq_msg {
 			u8 context[IDPF_INDIRECT_CTX_SIZE];
 			struct idpf_dma_mem *payload;
 		} indirect;
+		struct {
+			u32 rsvd;
+			u16 data;
+			u16 flags;
+		} sw_cookie;
 	} ctx;
 };
 
Signature · 1 line
2.25.1
#62 lore raw

PATCH v4 9/18 common/idpf/base: define non-flexible size structure for ADI

In reply to Simei Su

Customer has a requirement to use the legacy fixed size, single chunk structure for ADI creation - one chunk for queue and one chunk for vector. This is described in detail in customer case
https://issuetracker.google.com/issues/270157802.

On the other hand, upstream code review patch has been posted with flex-array definitions. To accommodate the old style, the single chunk structures are being renamed so that merger of upstream patches with current code does not impact the existing workflows of the customer.

a) Define virtchnl2_non_flex_queue_reg_chunks with a single chunk in it.
b) Define virtchnl2_non_flex_vector_chunks with a single chunk in it.
c) Rename and modify virtchnl2_create_adi to use the above 2 new structs. New structure is virtchnl2_non_flex_create_adi.

---
 drivers/common/idpf/base/virtchnl2.h | 66 ++++++++++++++++++----------
 1 file changed, 43 insertions(+), 23 deletions(-)
drivers/common/idpf/base/virtchnl2.h +43 -23
index 7a099f5148..a19bb193c9 100644
@@ -89,8 +89,8 @@
 	 * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW
 	 */
 	/* opcodes 529, 530, and 531 are reserved */
-#define		VIRTCHNL2_OP_CREATE_ADI			532
-#define		VIRTCHNL2_OP_DESTROY_ADI		533
+#define		VIRTCHNL2_OP_NON_FLEX_CREATE_ADI	532
+#define		VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI	533
 #define		VIRTCHNL2_OP_LOOPBACK			534
 #define		VIRTCHNL2_OP_ADD_MAC_ADDR		535
 #define		VIRTCHNL2_OP_DEL_MAC_ADDR		536
@@ -1061,14 +1061,34 @@ struct virtchnl2_sriov_vfs_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_sriov_vfs_info);
 
-/* VIRTCHNL2_OP_CREATE_ADI
+/* structure to specify single chunk of queue */
+/* 'chunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_queue_reg_chunks {
+	__le16 num_chunks;
+	u8 reserved[6];
+	struct virtchnl2_queue_reg_chunk chunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_non_flex_queue_reg_chunks);
+
+/* structure to specify single chunk of interrupt vector */
+/* 'vchunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_vector_chunks {
+	__le16 num_vchunks;
+	u8 reserved[14];
+	struct virtchnl2_vector_chunk vchunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_non_flex_vector_chunks);
+
+/* VIRTCHNL2_OP_NON_FLEX_CREATE_ADI
  * PF sends this message to CP to create ADI by filling in required
- * fields of virtchnl2_create_adi structure.
- * CP responds with the updated virtchnl2_create_adi structure containing the
- * necessary fields followed by chunks which in turn will have an array of
+ * fields of virtchnl2_non_flex_create_adi structure.
+ * CP responds with the updated virtchnl2_non_flex_create_adi structure containing
+ * the necessary fields followed by chunks which in turn will have an array of
  * num_chunks entries of virtchnl2_queue_chunk structures.
  */
-struct virtchnl2_create_adi {
+struct virtchnl2_non_flex_create_adi {
 	/* PF sends PASID to CP */
 	__le32 pasid;
 	/*
@@ -1085,24 +1105,24 @@ struct virtchnl2_create_adi {
 	u8 reserved[64];
 	u8 pad[4];
 	/* CP populates queue chunks */
-	struct virtchnl2_queue_reg_chunks chunks;
+	struct virtchnl2_non_flex_queue_reg_chunks chunks;
 	/* PF sends vector chunks to CP */
-	struct virtchnl2_vector_chunks vchunks;
+	struct virtchnl2_non_flex_vector_chunks vchunks;
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_create_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_non_flex_create_adi);
 
-/* VIRTCHNL2_OP_DESTROY_ADI
+/* VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI
  * PF sends this message to CP to destroy ADI by filling
  * in the adi_id in virtchnl2_destropy_adi structure.
  * CP responds with the status of the requested operation.
  */
-struct virtchnl2_destroy_adi {
+struct virtchnl2_non_flex_destroy_adi {
 	__le16 adi_id;
 	u8 reserved[2];
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_destroy_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_non_flex_destroy_adi);
 
 /* Based on the descriptor type the PF supports, CP fills ptype_id_10 or
  * ptype_id_8 for flex and base descriptor respectively. If ptype_id_10 value
@@ -1566,10 +1586,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_EVENT";
 	case VIRTCHNL2_OP_RESET_VF:
 		return "VIRTCHNL2_OP_RESET_VF";
-	case VIRTCHNL2_OP_CREATE_ADI:
-		return "VIRTCHNL2_OP_CREATE_ADI";
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		return "VIRTCHNL2_OP_DESTROY_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_CREATE_ADI";
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		return "VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI";
 	case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
 		return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
@@ -1624,11 +1644,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_queue_reg_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_CREATE_ADI:
-		valid_len = sizeof(struct virtchnl2_create_adi);
+	case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_create_adi);
 		if (msglen >= valid_len) {
-			struct virtchnl2_create_adi *cadi =
-				(struct virtchnl2_create_adi *)msg;
+			struct virtchnl2_non_flex_create_adi *cadi =
+				(struct virtchnl2_non_flex_create_adi *)msg;
 
 			if (cadi->chunks.num_chunks == 0) {
 				/* zero chunks is allowed as input */
@@ -1645,8 +1665,8 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 				      sizeof(struct virtchnl2_vector_chunk);
 		}
 		break;
-	case VIRTCHNL2_OP_DESTROY_ADI:
-		valid_len = sizeof(struct virtchnl2_destroy_adi);
+	case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+		valid_len = sizeof(struct virtchnl2_non_flex_destroy_adi);
 		break;
 	case VIRTCHNL2_OP_DESTROY_VPORT:
 	case VIRTCHNL2_OP_ENABLE_VPORT:
Signature · 1 line
2.25.1
#63 lore raw

PATCH v4 10/18 common/idpf/base: use local pointer before updating 'CQ out'

In reply to Simei Su

Instead of updating directly to 'cq_out' double pointer, use a local pointer and update only when we return success.

---
 drivers/common/idpf/base/idpf_controlq.c | 43 +++++++++++++-----------
 1 file changed, 23 insertions(+), 20 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +23 -20
index 6815153e1d..b84a1ea046 100644
@@ -137,6 +137,7 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		  struct idpf_ctlq_create_info *qinfo,
 		  struct idpf_ctlq_info **cq_out)
 {
+	struct idpf_ctlq_info *cq;
 	bool is_rxq = false;
 	int status = 0;
 
@@ -145,26 +146,26 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 	    qinfo->buf_size > IDPF_CTLQ_MAX_BUF_LEN)
 		return -EINVAL;
 
-	*cq_out = (struct idpf_ctlq_info *)
-		idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
-	if (!(*cq_out))
+	cq = (struct idpf_ctlq_info *)
+	     idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
+	if (!cq)
 		return -ENOMEM;
 
-	(*cq_out)->cq_type = qinfo->type;
-	(*cq_out)->q_id = qinfo->id;
-	(*cq_out)->buf_size = qinfo->buf_size;
-	(*cq_out)->ring_size = qinfo->len;
+	(cq)->cq_type = qinfo->type;
+	(cq)->q_id = qinfo->id;
+	(cq)->buf_size = qinfo->buf_size;
+	(cq)->ring_size = qinfo->len;
 
-	(*cq_out)->next_to_use = 0;
-	(*cq_out)->next_to_clean = 0;
-	(*cq_out)->next_to_post = (*cq_out)->ring_size - 1;
+	(cq)->next_to_use = 0;
+	(cq)->next_to_clean = 0;
+	(cq)->next_to_post = cq->ring_size - 1;
 
 	switch (qinfo->type) {
 	case IDPF_CTLQ_TYPE_MAILBOX_RX:
 		is_rxq = true;
 		/* fallthrough */
 	case IDPF_CTLQ_TYPE_MAILBOX_TX:
-		status = idpf_ctlq_alloc_ring_res(hw, *cq_out);
+		status = idpf_ctlq_alloc_ring_res(hw, cq);
 		break;
 	default:
 		status = -EINVAL;
@@ -175,33 +176,35 @@ int idpf_ctlq_add(struct idpf_hw *hw,
 		goto init_free_q;
 
 	if (is_rxq) {
-		idpf_ctlq_init_rxq_bufs(*cq_out);
+		idpf_ctlq_init_rxq_bufs(cq);
 	} else {
 		/* Allocate the array of msg pointers for TX queues */
-		(*cq_out)->bi.tx_msg = (struct idpf_ctlq_msg **)
+		cq->bi.tx_msg = (struct idpf_ctlq_msg **)
 			idpf_calloc(hw, qinfo->len,
 				    sizeof(struct idpf_ctlq_msg *));
-		if (!(*cq_out)->bi.tx_msg) {
+		if (!cq->bi.tx_msg) {
 			status = -ENOMEM;
 			goto init_dealloc_q_mem;
 		}
 	}
 
-	idpf_ctlq_setup_regs(*cq_out, qinfo);
+	idpf_ctlq_setup_regs(cq, qinfo);
 
-	idpf_ctlq_init_regs(hw, *cq_out, is_rxq);
+	idpf_ctlq_init_regs(hw, cq, is_rxq);
 
-	idpf_init_lock(&(*cq_out)->cq_lock);
+	idpf_init_lock(&(cq->cq_lock));
 
-	LIST_INSERT_HEAD(&hw->cq_list_head, (*cq_out), cq_list);
+	LIST_INSERT_HEAD(&hw->cq_list_head, cq, cq_list);
 
+	*cq_out = cq;
 	return status;
 
 init_dealloc_q_mem:
 	/* free ring buffers and the ring itself */
-	idpf_ctlq_dealloc_ring_res(hw, *cq_out);
+	idpf_ctlq_dealloc_ring_res(hw, cq);
 init_free_q:
-	idpf_free(hw, *cq_out);
+	idpf_free(hw, cq);
+	cq = NULL;
 
 	return status;
 }
Signature · 1 line
2.25.1
#64 lore raw

PATCH v4 11/18 common/idpf/base: use 'void' return type

In reply to Simei Su

As idpf_ctlq_deinit always returns success, make it 'void' instead of returning only success. This also changes the return type for idpf_deinit_hw as 'void'.

Based on the upstream comments, explicit __le16 typecasting is not necessary as CPU_TO_LE16 is already being used.

---
 drivers/common/idpf/base/idpf_common.c       | 4 ++--
 drivers/common/idpf/base/idpf_controlq.c     | 7 ++-----
 drivers/common/idpf/base/idpf_controlq_api.h | 2 +-
 drivers/common/idpf/base/idpf_prototype.h    | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)
drivers/common/idpf/base/idpf_common.c +2 -2
index 9610916aa9..7181a7f14c 100644
@@ -262,12 +262,12 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
  *  idpf_deinit_hw - shutdown routine
  *  @hw: pointer to the hardware structure
  */
-int idpf_deinit_hw(struct idpf_hw *hw)
+void idpf_deinit_hw(struct idpf_hw *hw)
 {
 	hw->asq = NULL;
 	hw->arq = NULL;
 
-	return idpf_ctlq_deinit(hw);
+	idpf_ctlq_deinit(hw);
 }
 
 /**
drivers/common/idpf/base/idpf_controlq.c +2 -5
index b84a1ea046..7b12dfab18 100644
@@ -75,7 +75,7 @@ static void idpf_ctlq_init_rxq_bufs(struct idpf_ctlq_info *cq)
 		desc->flags =
 			CPU_TO_LE16(IDPF_CTLQ_FLAG_BUF | IDPF_CTLQ_FLAG_RD);
 		desc->opcode = 0;
-		desc->datalen = (__le16)CPU_TO_LE16(bi->size);
+		desc->datalen = CPU_TO_LE16(bi->size);
 		desc->ret_val = 0;
 		desc->cookie_high = 0;
 		desc->cookie_low = 0;
@@ -264,16 +264,13 @@ int idpf_ctlq_init(struct idpf_hw *hw, u8 num_q,
  * idpf_ctlq_deinit - destroy all control queues
  * @hw: pointer to hw struct
  */
-int idpf_ctlq_deinit(struct idpf_hw *hw)
+void idpf_ctlq_deinit(struct idpf_hw *hw)
 {
 	struct idpf_ctlq_info *cq = NULL, *tmp = NULL;
-	int ret_code = 0;
 
 	LIST_FOR_EACH_ENTRY_SAFE(cq, tmp, &hw->cq_list_head,
 				 idpf_ctlq_info, cq_list)
 		idpf_ctlq_remove(hw, cq);
-
-	return ret_code;
 }
 
 /**
drivers/common/idpf/base/idpf_controlq_api.h +1 -1
index f4e7b53ac9..78a54f6b4c 100644
@@ -205,6 +205,6 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw,
 			    struct idpf_dma_mem **buffs);
 
 /* Will destroy all q including the default mb */
-int idpf_ctlq_deinit(struct idpf_hw *hw);
+void idpf_ctlq_deinit(struct idpf_hw *hw);
 
 #endif /* _IDPF_CONTROLQ_API_H_ */
drivers/common/idpf/base/idpf_prototype.h +1 -1
index 988ff00506..e2f090a9e3 100644
@@ -20,7 +20,7 @@
 #define APF
 
 int idpf_init_hw(struct idpf_hw *hw, struct idpf_ctlq_size ctlq_size);
-int idpf_deinit_hw(struct idpf_hw *hw);
+void idpf_deinit_hw(struct idpf_hw *hw);
 
 int idpf_clean_arq_element(struct idpf_hw *hw,
 			   struct idpf_arq_event_info *e,
Signature · 1 line
2.25.1
#65 lore raw

PATCH v4 12/18 common/idpf/base: refactor descriptor 'ret val' stripping

In reply to Simei Su

Conditional check is not necessary to strip and get status bits from the descriptor.

---
 drivers/common/idpf/base/idpf_controlq.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -5
index 7b12dfab18..da5c930578 100644
@@ -426,11 +426,8 @@ static int __idpf_ctlq_clean_sq(struct idpf_ctlq_info *cq, u16 *clean_count,
 		if (!force && !(LE16_TO_CPU(desc->flags) & IDPF_CTLQ_FLAG_DD))
 			break;
 
-		desc_err = LE16_TO_CPU(desc->ret_val);
-		if (desc_err) {
-			/* strip off FW internal code */
-			desc_err &= 0xff;
-		}
+		/* strip off FW internal code */
+		desc_err = LE16_TO_CPU(desc->ret_val) & 0xff;
 
 		msg_status[i] = cq->bi.tx_msg[ntc];
 		if (!msg_status[i])
Signature · 1 line
2.25.1
#66 lore raw

PATCH v4 13/18 common/idpf/base: refine comments and alignment

In reply to Simei Su

Refine the macros and definitions by using 'tab' spaces and new lines wherever necessary. Also refine the comment in 'idpf_ctlq_setup_regs' and remove the TODO comment in idpf_rss_hash enum as it doesn't make any sense.

---
 drivers/common/idpf/base/idpf_controlq.c     |  2 +-
 drivers/common/idpf/base/idpf_controlq_api.h | 10 +----
 drivers/common/idpf/base/idpf_lan_pf_regs.h  |  7 +--
 drivers/common/idpf/base/idpf_lan_txrx.h     | 47 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h  | 25 +++++++----
 5 files changed, 46 insertions(+), 45 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +1 -1
index da5c930578..c24bfd23ef 100644
@@ -13,7 +13,7 @@ static void
 idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
 		     struct idpf_ctlq_create_info *q_create_info)
 {
-	/* set head and tail registers in our local struct */
+	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
 	cq->reg.tail = q_create_info->reg.tail;
 	cq->reg.len = q_create_info->reg.len;
drivers/common/idpf/base/idpf_controlq_api.h +2 -8
index 78a54f6b4c..38f5d2df3c 100644
@@ -21,10 +21,7 @@ enum idpf_ctlq_type {
 	IDPF_CTLQ_TYPE_RDMA_COMPL	= 7
 };
 
-/*
- * Generic Control Queue Structures
- */
-
+/* Generic Control Queue Structures */
 struct idpf_ctlq_reg {
 	/* used for queue tracking */
 	u32 head;
@@ -157,10 +154,7 @@ enum idpf_mbx_opc {
 	idpf_mbq_opc_send_msg_to_peer_drv	= 0x0804,
 };
 
-/*
- * API supported for control queue management
- */
-
+/* API supported for control queue management */
 /* Will init all required q including default mb.  "q_info" is an array of
  * create_info structs equal to the number of control queues to be created.
  */
drivers/common/idpf/base/idpf_lan_pf_regs.h +4 -3
index 8542620e01..e47afad6e9 100644
@@ -80,10 +80,11 @@
 /* _ITR is ITR index, _INT is interrupt index, _itrn_indx_spacing is
  * spacing b/w itrn registers of the same vector.
  */
-#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
+#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing)		\
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
 /* For PF, itrn_indx_spacing is 4 and itrn_reg_spacing is 0x1000 */
-#define PF_GLINT_ITR(_ITR, _INT) (PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
+#define PF_GLINT_ITR(_ITR, _INT)	\
+	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
 #define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
drivers/common/idpf/base/idpf_lan_txrx.h +22 -25

72 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +17 -8
index b5ff9b2cc9..4c5249129e 100644
@@ -94,14 +94,23 @@
  * b/w itrn registers of the same vector
  */
 #define VF_INT_ITR0(_ITR)		(0x00004C00 + ((_ITR) * 4))
-#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		 ((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
-/* For VF with 16 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x40 */
-#define VF_INT_ITRN(_INT, _ITR)	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
-/* For VF with 64 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x100 */
-#define VF_INT_ITRN_64(_INT, _ITR) (0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
-/* For VF with 2k vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x2000 */
-#define VF_INT_ITRN_2K(_INT, _ITR) (0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
+#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing)  \
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
+/* For VF with 16 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x40 and base register offset is 0x00002800
+ */
+#define VF_INT_ITRN(_INT, _ITR)			\
+	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
+/* For VF with 64 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x100 and base register offset is 0x00002C00
+ */
+#define VF_INT_ITRN_64(_INT, _ITR)	\
+	(0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
+/* For VF with 2k vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x2000 and base register offset is 0x00072000
+ */
+#define VF_INT_ITRN_2K(_INT, _ITR)	\
+	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
 #define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
Signature · 1 line
2.25.1
#67 lore raw

PATCH v4 14/18 common/idpf/base: use GENMASK macro

In reply to Simei Su

Instead of using a custom defined macro for generating a mask, use the standard GENMASK macro.

---
 drivers/common/idpf/base/idpf_lan_pf_regs.h |  26 ++---
 drivers/common/idpf/base/idpf_lan_txrx.h    | 116 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h |  16 +--
 drivers/common/idpf/base/idpf_osdep.h       |   7 ++
 4 files changed, 80 insertions(+), 85 deletions(-)
drivers/common/idpf/base/idpf_lan_pf_regs.h +13 -13
index e47afad6e9..b9d82592c0 100644
@@ -24,7 +24,7 @@
 #define PF_FW_ARQBAH			(PF_FW_BASE + 0x4)
 #define PF_FW_ARQLEN			(PF_FW_BASE + 0x8)
 #define PF_FW_ARQLEN_ARQLEN_S		0
-#define PF_FW_ARQLEN_ARQLEN_M		IDPF_M(0x1FFF, PF_FW_ARQLEN_ARQLEN_S)
+#define PF_FW_ARQLEN_ARQLEN_M		GENMASK(12, 0)
 #define PF_FW_ARQLEN_ARQVFE_S		28
 #define PF_FW_ARQLEN_ARQVFE_M		BIT(PF_FW_ARQLEN_ARQVFE_S)
 #define PF_FW_ARQLEN_ARQOVFL_S		29
@@ -35,14 +35,14 @@
 #define PF_FW_ARQLEN_ARQENABLE_M	BIT(PF_FW_ARQLEN_ARQENABLE_S)
 #define PF_FW_ARQH			(PF_FW_BASE + 0xC)
 #define PF_FW_ARQH_ARQH_S		0
-#define PF_FW_ARQH_ARQH_M		IDPF_M(0x1FFF, PF_FW_ARQH_ARQH_S)
+#define PF_FW_ARQH_ARQH_M		GENMASK(12, 0)
 #define PF_FW_ARQT			(PF_FW_BASE + 0x10)
 
 #define PF_FW_ATQBAL			(PF_FW_BASE + 0x14)
 #define PF_FW_ATQBAH			(PF_FW_BASE + 0x18)
 #define PF_FW_ATQLEN			(PF_FW_BASE + 0x1C)
 #define PF_FW_ATQLEN_ATQLEN_S		0
-#define PF_FW_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, PF_FW_ATQLEN_ATQLEN_S)
+#define PF_FW_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define PF_FW_ATQLEN_ATQVFE_S		28
 #define PF_FW_ATQLEN_ATQVFE_M		BIT(PF_FW_ATQLEN_ATQVFE_S)
 #define PF_FW_ATQLEN_ATQOVFL_S		29
@@ -53,7 +53,7 @@
 #define PF_FW_ATQLEN_ATQENABLE_M	BIT(PF_FW_ATQLEN_ATQENABLE_S)
 #define PF_FW_ATQH			(PF_FW_BASE + 0x20)
 #define PF_FW_ATQH_ATQH_S		0
-#define PF_FW_ATQH_ATQH_M		IDPF_M(0x3FF, PF_FW_ATQH_ATQH_S)
+#define PF_FW_ATQH_ATQH_M		GENMASK(9, 0)
 #define PF_FW_ATQT			(PF_FW_BASE + 0x24)
 
 /* Interrupts */
@@ -66,7 +66,7 @@
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_S	2
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_M	BIT(PF_GLINT_DYN_CTL_SWINT_TRIG_S)
 #define PF_GLINT_DYN_CTL_ITR_INDX_S	3
-#define PF_GLINT_DYN_CTL_ITR_INDX_M	IDPF_M(0x3, PF_GLINT_DYN_CTL_ITR_INDX_S)
+#define PF_GLINT_DYN_CTL_ITR_INDX_M	GENMASK(4, 3)
 #define PF_GLINT_DYN_CTL_INTERVAL_S	5
 #define PF_GLINT_DYN_CTL_INTERVAL_M	BIT(PF_GLINT_DYN_CTL_INTERVAL_S)
 #define PF_GLINT_DYN_CTL_SW_ITR_INDX_ENA_S	24
@@ -87,13 +87,13 @@
 	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
-#define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
+#define PF_GLINT_ITR_INTERVAL_M		GENMASK(11, 0)
 
 /* Timesync registers */
 #define PF_TIMESYNC_BASE		0x08404000
 #define PF_GLTSYN_CMD_SYNC		(PF_TIMESYNC_BASE)
 #define PF_GLTSYN_CMD_SYNC_EXEC_CMD_S	0
-#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	IDPF_M(0x3, PF_GLTSYN_CMD_SYNC_EXEC_CMD_S)
+#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	GENMASK(1, 0)
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_S	2
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_M	BIT(PF_GLTSYN_CMD_SYNC_SHTIME_EN_S)
 #define PF_GLTSYN_SHTIME_0		(PF_TIMESYNC_BASE + 0x4)
@@ -105,23 +105,23 @@
 /* Generic registers */
 #define PF_INT_DIR_OICR_ENA		0x08406000
 #define PF_INT_DIR_OICR_ENA_S		0
-#define PF_INT_DIR_OICR_ENA_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_ENA_S)
+#define PF_INT_DIR_OICR_ENA_M		GENMASK(31, 0)
 #define PF_INT_DIR_OICR			0x08406004
 #define PF_INT_DIR_OICR_TSYN_EVNT	0
 #define PF_INT_DIR_OICR_PHY_TS_0	BIT(1)
 #define PF_INT_DIR_OICR_PHY_TS_1	BIT(2)
 #define PF_INT_DIR_OICR_CAUSE		0x08406008
 #define PF_INT_DIR_OICR_CAUSE_CAUSE_S	0
-#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_CAUSE_CAUSE_S)
+#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	GENMASK(31, 0)
 #define PF_INT_PBA_CLEAR		0x0840600C
 
 #define PF_FUNC_RID			0x08406010
 #define PF_FUNC_RID_FUNCTION_NUMBER_S	0
-#define PF_FUNC_RID_FUNCTION_NUMBER_M	IDPF_M(0x7, PF_FUNC_RID_FUNCTION_NUMBER_S)
+#define PF_FUNC_RID_FUNCTION_NUMBER_M	GENMASK(2, 0)
 #define PF_FUNC_RID_DEVICE_NUMBER_S	3
-#define PF_FUNC_RID_DEVICE_NUMBER_M	IDPF_M(0x1F, PF_FUNC_RID_DEVICE_NUMBER_S)
+#define PF_FUNC_RID_DEVICE_NUMBER_M	GENMASK(7, 3)
 #define PF_FUNC_RID_BUS_NUMBER_S	8
-#define PF_FUNC_RID_BUS_NUMBER_M	IDPF_M(0xFF, PF_FUNC_RID_BUS_NUMBER_S)
+#define PF_FUNC_RID_BUS_NUMBER_M	GENMASK(15, 8)
 
 /* Reset registers */
 #define PFGEN_RTRIG			0x08407000
@@ -133,7 +133,7 @@
 #define PFGEN_RTRIG_IMCR_M		BIT(2)
 #define PFGEN_RSTAT			0x08407008 /* PFR Status */
 #define PFGEN_RSTAT_PFR_STATE_S		0
-#define PFGEN_RSTAT_PFR_STATE_M		IDPF_M(0x3, PFGEN_RSTAT_PFR_STATE_S)
+#define PFGEN_RSTAT_PFR_STATE_M		GENMASK(1, 0)
 #define PFGEN_CTRL			0x0840700C
 #define PFGEN_CTRL_PFSWR		BIT(0)
 
drivers/common/idpf/base/idpf_lan_txrx.h +52 -64

164 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +8 -8
index 4c5249129e..f394a0d67a 100644
@@ -9,7 +9,7 @@
 /* Reset */
 #define VFGEN_RSTAT			0x00008800
 #define VFGEN_RSTAT_VFR_STATE_S		0
-#define VFGEN_RSTAT_VFR_STATE_M		IDPF_M(0x3, VFGEN_RSTAT_VFR_STATE_S)
+#define VFGEN_RSTAT_VFR_STATE_M		GENMASK(1, 0)
 
 /* Control(VF Mailbox) Queue */
 #define VF_BASE				0x00006000
@@ -18,7 +18,7 @@
 #define VF_ATQBAH			(VF_BASE + 0x1800)
 #define VF_ATQLEN			(VF_BASE + 0x0800)
 #define VF_ATQLEN_ATQLEN_S		0
-#define VF_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, VF_ATQLEN_ATQLEN_S)
+#define VF_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define VF_ATQLEN_ATQVFE_S		28
 #define VF_ATQLEN_ATQVFE_M		BIT(VF_ATQLEN_ATQVFE_S)
 #define VF_ATQLEN_ATQOVFL_S		29
@@ -29,14 +29,14 @@
 #define VF_ATQLEN_ATQENABLE_M		BIT(VF_ATQLEN_ATQENABLE_S)
 #define VF_ATQH				(VF_BASE + 0x0400)
 #define VF_ATQH_ATQH_S			0
-#define VF_ATQH_ATQH_M			IDPF_M(0x3FF, VF_ATQH_ATQH_S)
+#define VF_ATQH_ATQH_M			GENMASK(9, 0)
 #define VF_ATQT				(VF_BASE + 0x2400)
 
 #define VF_ARQBAL			(VF_BASE + 0x0C00)
 #define VF_ARQBAH			(VF_BASE)
 #define VF_ARQLEN			(VF_BASE + 0x2000)
 #define VF_ARQLEN_ARQLEN_S		0
-#define VF_ARQLEN_ARQLEN_M		IDPF_M(0x3FF, VF_ARQLEN_ARQLEN_S)
+#define VF_ARQLEN_ARQLEN_M		GENMASK(9, 0)
 #define VF_ARQLEN_ARQVFE_S		28
 #define VF_ARQLEN_ARQVFE_M		BIT(VF_ARQLEN_ARQVFE_S)
 #define VF_ARQLEN_ARQOVFL_S		29
@@ -47,7 +47,7 @@
 #define VF_ARQLEN_ARQENABLE_M		BIT(VF_ARQLEN_ARQENABLE_S)
 #define VF_ARQH				(VF_BASE + 0x1400)
 #define VF_ARQH_ARQH_S			0
-#define VF_ARQH_ARQH_M			IDPF_M(0x1FFF, VF_ARQH_ARQH_S)
+#define VF_ARQH_ARQH_M			GENMASK(12, 0)
 #define VF_ARQT				(VF_BASE + 0x1000)
 
 /* Transmit queues */
@@ -69,7 +69,7 @@
 #define VF_INT_DYN_CTL0_INTENA_S	0
 #define VF_INT_DYN_CTL0_INTENA_M	BIT(VF_INT_DYN_CTL0_INTENA_S)
 #define VF_INT_DYN_CTL0_ITR_INDX_S	3
-#define VF_INT_DYN_CTL0_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTL0_ITR_INDX_S)
+#define VF_INT_DYN_CTL0_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN(_INT)		(0x00003800 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_EXT(_INT)	(0x00070000 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_INTENA_S	0
@@ -79,7 +79,7 @@
 #define VF_INT_DYN_CTLN_SWINT_TRIG_S	2
 #define VF_INT_DYN_CTLN_SWINT_TRIG_M	BIT(VF_INT_DYN_CTLN_SWINT_TRIG_S)
 #define VF_INT_DYN_CTLN_ITR_INDX_S	3
-#define VF_INT_DYN_CTLN_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTLN_ITR_INDX_S)
+#define VF_INT_DYN_CTLN_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN_INTERVAL_S	5
 #define VF_INT_DYN_CTLN_INTERVAL_M	BIT(VF_INT_DYN_CTLN_INTERVAL_S)
 #define VF_INT_DYN_CTLN_SW_ITR_INDX_ENA_S	24
@@ -113,7 +113,7 @@
 	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
-#define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
+#define VF_INT_ITRN_INTERVAL_M		GENMASK(11, 0)
 #define VF_INT_PBA_CLEAR		0x00008900
 
 #define VF_INT_ICR0_ENA1		0x00005000
drivers/common/idpf/base/idpf_osdep.h +7 -0
index 2a817a9807..74a376cb13 100644
@@ -48,6 +48,13 @@ typedef struct idpf_lock idpf_lock;
 
 #define IDPF_M(m, s)		((m) << (s))
 
+#define BITS_PER_LONG (8 * sizeof(long))
+#define BITS_PER_LONG_LONG (8 * sizeof(long long))
+#define GENMASK(h, l) \
+	(((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+
 #ifndef ETH_ADDR_LEN
 #define ETH_ADDR_LEN		6
 #endif
Signature · 1 line
2.25.1
#68 lore raw

PATCH v4 15/18 common/idpf/base: use 'type functionname(args)' style

In reply to Simei Su

Instead of splitting the function name and function type into multiple lines, use then in a single line.

---
 drivers/common/idpf/base/idpf_controlq.c       | 5 ++---
 drivers/common/idpf/base/idpf_controlq_setup.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/common/idpf/base/idpf_controlq.c +2 -3
index c24bfd23ef..07bbec91b9 100644
@@ -9,9 +9,8 @@
  * @cq: pointer to the specific control queue
  * @q_create_info: structs containing info for each queue to be initialized
  */
-static void
-idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
-		     struct idpf_ctlq_create_info *q_create_info)
+static void idpf_ctlq_setup_regs(struct idpf_ctlq_info *cq,
+				 struct idpf_ctlq_create_info *q_create_info)
 {
 	/* set control queue registers in our local struct */
 	cq->reg.head = q_create_info->reg.head;
drivers/common/idpf/base/idpf_controlq_setup.c +2 -3
index 0f1b52a7e9..21f43c74f5 100644
@@ -11,9 +11,8 @@
  * @hw: pointer to hw struct
  * @cq: pointer to the specific Control queue
  */
-static int
-idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
-			  struct idpf_ctlq_info *cq)
+static int idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
+				     struct idpf_ctlq_info *cq)
 {
 	size_t size = cq->ring_size * sizeof(struct idpf_ctlq_desc);
 
Signature · 1 line
2.25.1
#69 lore raw

PATCH v4 16/18 common/idpf/base: don't declare union with 'flex'

In reply to Simei Su

In idpf_flex_tx_desc structure, instead of naming the union with 'flex', use no name union as the union name is not really necessary there. This reduces the level of indirection in the hotpath.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +2 -2
index f213c49e47..1e19aeafac 100644
@@ -226,11 +226,11 @@ enum idpf_tx_flex_desc_cmd_bits {
 struct idpf_flex_tx_desc {
 	__le64 buf_addr;	/* Packet buffer address */
 	struct {
-		__le16 cmd_dtype;
 #define IDPF_FLEX_TXD_QW1_DTYPE_S	0
 #define IDPF_FLEX_TXD_QW1_DTYPE_M	GENMASK(4, 0)
 #define IDPF_FLEX_TXD_QW1_CMD_S		5
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
+		__le16 cmd_dtype;
 		union {
 			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
 			u8 raw[4];
@@ -247,7 +247,7 @@ struct idpf_flex_tx_desc {
 				__le16 l2tag1;
 				__le16 l2tag2;
 			} l2tags;
-		} flex;
+		};
 		__le16 buf_size;
 	} qw1;
 };
Signature · 1 line
2.25.1
#70 lore raw

PATCH v4 17/18 common/idpf/base: remove unused Tx descriptor types

In reply to Simei Su

Remove the unused TX descriptor types and mark them as reserved.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 132 ++---------------------
 1 file changed, 10 insertions(+), 122 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +10 -122
index 1e19aeafac..5bc4271584 100644
@@ -120,19 +120,19 @@ enum idpf_rss_hash {
 enum idpf_tx_desc_dtype_value {
 	IDPF_TX_DESC_DTYPE_DATA				= 0,
 	IDPF_TX_DESC_DTYPE_CTX				= 1,
-	IDPF_TX_DESC_DTYPE_REINJECT_CTX			= 2,
-	IDPF_TX_DESC_DTYPE_FLEX_DATA			= 3,
-	IDPF_TX_DESC_DTYPE_FLEX_CTX			= 4,
+	/* DTYPE 2 is reserved
+	 * DTYPE 3 is free for future use
+	 * DTYPE 4 is reserved
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX			= 5,
-	IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1		= 6,
+	/* DTYPE 6 is reserved */
 	IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2		= 7,
-	IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX	= 8,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_TSO_CTX	= 9,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_CTX	= 10,
-	IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX		= 11,
+	/* DTYPE 8, 9 are free for future use
+	 * DTYPE 10 is reserved
+	 * DTYPE 11 is free for future use
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE		= 12,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_TSO_CTX	= 13,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_CTX		= 14,
+	/* DTYPE 13, 14 are free for future use */
 	/* DESC_DONE - HW has completed write-back of descriptor */
 	IDPF_TX_DESC_DTYPE_DESC_DONE			= 15,
 };
@@ -232,16 +232,6 @@ struct idpf_flex_tx_desc {
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
 		__le16 cmd_dtype;
 		union {
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
-			u8 raw[4];
-
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1 (0x06) */
-			struct {
-				__le16 l2tag1;
-				u8 flex;
-				u8 tsync;
-			} tsync;
-
 			/* DTYPE=IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2 (0x07) */
 			struct {
 				__le16 l2tag1;
@@ -297,16 +287,6 @@ struct idpf_flex_tx_tso_ctx_qw {
 };
 
 union idpf_flex_tx_ctx_desc {
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_CTX (0x04) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag1;
-			u8 qw1_flex[4];
-		} qw1;
-	} gen;
-
 	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX (0x05) */
 	struct {
 		struct idpf_flex_tx_tso_ctx_qw qw0;
@@ -315,98 +295,6 @@ union idpf_flex_tx_ctx_desc {
 			u8 flex[6];
 		} qw1;
 	} tso;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX (0x08) */
-	struct {
-		struct idpf_flex_tx_tso_ctx_qw qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex0;
-			u8 ptag;
-			u8 flex1[2];
-		} qw1;
-	} tso_l2tag2_ptag;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX (0x0B) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex[4];
-		} qw1;
-	} l2tag2;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_REINJECT_CTX (0x02) */
-	struct {
-		struct {
-			__le32 sa_domain;
-#define IDPF_TXD_FLEX_CTX_SA_DOM_M	0xFFFF
-#define IDPF_TXD_FLEX_CTX_SA_DOM_VAL	0x10000
-			__le32 sa_idx;
-#define IDPF_TXD_FLEX_CTX_SAIDX_M	0x1FFFFF
-		} qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 txr2comp;
-#define IDPF_TXD_FLEX_CTX_TXR2COMP	0x1
-			__le16 miss_txq_comp_tag;
-			__le16 miss_txq_id;
-		} qw1;
-	} reinjection_pkt;
 };
 
-/* Host Split Context Descriptors */
-struct idpf_flex_tx_hs_ctx_desc {
-	union {
-		struct {
-			__le32 host_fnum_tlen;
-#define IDPF_TXD_FLEX_CTX_TLEN_S	0
-/* see IDPF_TXD_FLEX_CTX_TLEN_M for mask definition */
-#define IDPF_TXD_FLEX_CTX_FNUM_S	18
-#define IDPF_TXD_FLEX_CTX_FNUM_M	0x7FF
-#define IDPF_TXD_FLEX_CTX_HOST_S	29
-#define IDPF_TXD_FLEX_CTX_HOST_M	0x7
-			__le16 ftype_mss_rt;
-#define IDPF_TXD_FLEX_CTX_MSS_RT_0	0
-#define IDPF_TXD_FLEX_CTX_MSS_RT_M	0x3FFF
-#define IDPF_TXD_FLEX_CTX_FTYPE_S	14
-#define IDPF_TXD_FLEX_CTX_FTYPE_VF	0
-#define IDPF_TXD_FLEX_CTX_FTYPE_VDEV	BIT(14)
-#define IDPF_TXD_FLEX_CTX_FTYPE_PF	BIT(15)
-			u8 hdr_len;
-			u8 ptag;
-		} tso;
-		struct {
-			u8 flex0[2];
-			__le16 host_fnum_ftype;
-			u8 flex1[3];
-			u8 ptag;
-		} no_tso;
-	} qw0;
-
-	__le64 qw1_cmd_dtype;
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_S		16
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_M		0xFFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S	36
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S)
-#define IDPF_TXD_FLEX_CTX_QW1_TPH_S		37
-#define IDPF_TXD_FLEX_CTX_QW1_TPH		\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_TPH_S)
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_S		38
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_M		0xF
-/* The following are only valid for DTYPE = 0x09 and DTYPE = 0x0A */
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_S		42
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_M		0x1FFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S	63
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S)
-/* The following are only valid for DTYPE = 0x0D and DTYPE = 0x0E */
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_S		48
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_M		0xFF
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_S		56
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_M		0xFF
-};
 #endif /* _IDPF_LAN_TXRX_H_ */
Signature · 1 line
2.25.1
#71 lore raw

PATCH v4 18/18 common/idpf/base: update version

In reply to Simei Su

Update README

---
 drivers/common/idpf/base/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/idpf/base/README +1 -1
index 693049c057..ff26f736ec 100644
@@ -6,7 +6,7 @@ Intel® IDPF driver
 ==================
 
 This directory contains source code of BSD-3-Clause idpf driver of version
-2023.02.23 released by the team which develops basic drivers for Intel IPU.
+2023.07.25 released by the team which develops basic drivers for Intel IPU.
 The directory of base/ contains the original source package.
 This driver is valid for the product(s) listed below
 
Signature · 1 line
2.25.1
#72 lore raw

v5 cover update idpf base code

In reply to Simei Su

Currently, single queue Tx data path uses flex Tx data descriptor(DTYPE3) which is removed in the latest idpf spec. [PATCH v5 01/11] replaces flex Tx data descriptor with base Tx data descriptor for single queue Tx data path and refines Tx single queue setup to align with Tx data path.

[PATCH v5 02/11]~[PATCH v5 11/11] update idpf base code based on [PATCH v5 01/11].

v5:
* Refine commit title and commit log.
* Combine several patches into one patch.

v4:
* Put single queue Tx data path refactor patch in this patchset.

v3:
* Fix coding style issue.
* Modify unexpected error in the update version patch.

v2:
* Add two patches for share code update.
* Add version update.
* Fix coding style issue.

Simei Su (11):
common/idpf: refactor single queue Tx data path common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initialize PTP support common/idpf/base: remove mailbox registers common/idpf/base: refine structure and necessary check common/idpf/base: add union for SW cookie fields common/idpf/base: refine code and alignments common/idpf/base: use GENMASK macro common/idpf/base: remove unused Tx descriptor types common/idpf/base: update version

 .mailmap                                      |   7 +
 drivers/common/idpf/base/README               |   2 +-
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 284 +++++------------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 301 ++++++++++++++++--
 drivers/common/idpf/idpf_common_rxtx.c        |  39 ++-
 drivers/common/idpf/idpf_common_rxtx.h        |   2 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c |  37 ++-
 drivers/net/cpfl/cpfl_rxtx.c                  |   2 +-
 drivers/net/idpf/idpf_rxtx.c                  |   2 +-
 18 files changed, 500 insertions(+), 368 deletions(-)
Signature · 1 line
2.25.1
#73 lore raw

PATCH v5 1/11 common/idpf: refactor single queue Tx data path

Currently, single queue Tx data path uses flex Tx data descriptor(DTYPE3) which is removed in the latest idpf spec. This patch replaces flex Tx data descriptor with base Tx data descriptor for single queue Tx data path and refines Tx single queue setup to align with Tx data path.

---
 drivers/common/idpf/idpf_common_rxtx.c        | 39 +++++++++----------
 drivers/common/idpf/idpf_common_rxtx.h        |  2 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c | 37 +++++++++---------
 drivers/net/cpfl/cpfl_rxtx.c                  |  2 +-
 drivers/net/idpf/idpf_rxtx.c                  |  2 +-
 5 files changed, 40 insertions(+), 42 deletions(-)
drivers/common/idpf/idpf_common_rxtx.c +19 -20
index fc87e3e243..e6d2486272 100644
@@ -276,14 +276,14 @@ idpf_qc_single_tx_queue_reset(struct idpf_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct idpf_flex_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct idpf_base_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->tx_ring[i].qw1.cmd_dtype =
-			rte_cpu_to_le_16(IDPF_TX_DESC_DTYPE_DESC_DONE);
+		txq->tx_ring[i].qw1 =
+			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
 		txe[prev].next_id = i;
@@ -1307,17 +1307,16 @@ idpf_xmit_cleanup(struct idpf_tx_queue *txq)
 	uint16_t nb_tx_to_clean;
 	uint16_t i;
 
-	volatile struct idpf_flex_tx_desc *txd = txq->tx_ring;
+	volatile struct idpf_base_tx_desc *txd = txq->tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	/* In the writeback Tx desccriptor, the only significant fields are the 4-bit DTYPE */
-	if ((txd[desc_to_clean_to].qw1.cmd_dtype &
-	     rte_cpu_to_le_16(IDPF_TXD_QW1_DTYPE_M)) !=
-	    rte_cpu_to_le_16(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
+	if ((txd[desc_to_clean_to].qw1 &
+	     rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
+	    rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
 		TX_LOG(DEBUG, "TX descriptor %4u is not done "
 		       "(port=%d queue=%d)", desc_to_clean_to,
 		       txq->port_id, txq->queue_id);
@@ -1331,10 +1330,7 @@ idpf_xmit_cleanup(struct idpf_tx_queue *txq)
 		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
 					    last_desc_cleaned);
 
-	txd[desc_to_clean_to].qw1.cmd_dtype = 0;
-	txd[desc_to_clean_to].qw1.buf_size = 0;
-	for (i = 0; i < RTE_DIM(txd[desc_to_clean_to].qw1.flex.raw); i++)
-		txd[desc_to_clean_to].qw1.flex.raw[i] = 0;
+	txd[desc_to_clean_to].qw1 = 0;
 
 	txq->last_desc_cleaned = desc_to_clean_to;
 	txq->nb_free = (uint16_t)(txq->nb_free + nb_tx_to_clean);
@@ -1347,8 +1343,8 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	volatile struct idpf_flex_tx_desc *txd;
-	volatile struct idpf_flex_tx_desc *txr;
+	volatile struct idpf_base_tx_desc *txd;
+	volatile struct idpf_base_tx_desc *txr;
 	union idpf_tx_offload tx_offload = {0};
 	struct idpf_tx_entry *txe, *txn;
 	struct idpf_tx_entry *sw_ring;
@@ -1356,6 +1352,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
 	uint64_t buf_dma_addr;
+	uint32_t td_offset;
 	uint64_t ol_flags;
 	uint16_t tx_last;
 	uint16_t nb_used;
@@ -1382,6 +1379,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
 		td_cmd = 0;
+		td_offset = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
@@ -1462,9 +1460,10 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			slen = m_seg->data_len;
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
 			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->qw1.buf_size = slen;
-			txd->qw1.cmd_dtype = rte_cpu_to_le_16(IDPF_TX_DESC_DTYPE_FLEX_DATA <<
-							      IDPF_FLEX_TXD_QW1_DTYPE_S);
+			txd->qw1 = rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |
+				((uint64_t)td_cmd  << IDPF_TXD_QW1_CMD_S) |
+				((uint64_t)td_offset << IDPF_TXD_QW1_OFFSET_S) |
+				((uint64_t)slen << IDPF_TXD_QW1_TX_BUF_SZ_S));
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
@@ -1473,7 +1472,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		} while (m_seg);
 
 		/* The last packet data descriptor needs End Of Packet (EOP) */
-		td_cmd |= IDPF_TX_FLEX_DESC_CMD_EOP;
+		td_cmd |= IDPF_TX_DESC_CMD_EOP;
 		txq->nb_used = (uint16_t)(txq->nb_used + nb_used);
 		txq->nb_free = (uint16_t)(txq->nb_free - nb_used);
 
@@ -1482,7 +1481,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       "%4u (port=%d queue=%d)",
 			       tx_last, txq->port_id, txq->queue_id);
 
-			td_cmd |= IDPF_TX_FLEX_DESC_CMD_RS;
+			td_cmd |= IDPF_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
 			txq->nb_used = 0;
@@ -1491,7 +1490,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK)
 			td_cmd |= IDPF_TX_FLEX_DESC_CMD_CS_EN;
 
-		txd->qw1.cmd_dtype |= rte_cpu_to_le_16(td_cmd << IDPF_FLEX_TXD_QW1_CMD_S);
+		txd->qw1 |= rte_cpu_to_le_16(td_cmd << IDPF_TXD_QW1_CMD_S);
 	}
 
 end_of_tx:
drivers/common/idpf/idpf_common_rxtx.h +1 -1
index 6cb83fc0a6..b49b1ed737 100644
@@ -157,7 +157,7 @@ struct idpf_tx_entry {
 /* Structure associated with each TX queue. */
 struct idpf_tx_queue {
 	const struct rte_memzone *mz;		/* memzone for Tx ring */
-	volatile struct idpf_flex_tx_desc *tx_ring;	/* Tx ring virtual address */
+	volatile struct idpf_base_tx_desc *tx_ring;	/* Tx ring virtual address */
 	volatile union {
 		struct idpf_flex_tx_sched_desc *desc_ring;
 		struct idpf_splitq_tx_compl_desc *compl_ring;
drivers/common/idpf/idpf_common_rxtx_avx512.c +18 -19
index 2ac46fb1d2..f65e8d512b 100644
@@ -1005,7 +1005,7 @@ idpf_tx_singleq_free_bufs_avx512(struct idpf_tx_queue *txq)
 	struct rte_mbuf *m, *free[txq->rs_thresh];
 
 	/* check DD bits on threshold descriptor */
-	if ((txq->tx_ring[txq->next_dd].qw1.cmd_dtype &
+	if ((txq->tx_ring[txq->next_dd].qw1 &
 			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
 			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
@@ -1113,15 +1113,14 @@ tx_backlog_entry_avx512(struct idpf_tx_vec_entry *txep,
 		txep[i].mbuf = tx_pkts[i];
 }
 
-#define IDPF_FLEX_TXD_QW1_BUF_SZ_S 48
 static __rte_always_inline void
-idpf_singleq_vtx1(volatile struct idpf_flex_tx_desc *txdp,
+idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw =
-		(IDPF_TX_DESC_DTYPE_FLEX_DATA << IDPF_FLEX_TXD_QW1_DTYPE_S |
-		 ((uint64_t)flags  << IDPF_FLEX_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << IDPF_FLEX_TXD_QW1_BUF_SZ_S));
+		(IDPF_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags  << IDPF_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << IDPF_TXD_QW1_TX_BUF_SZ_S));
 
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 					    pkt->buf_iova + pkt->data_off);
@@ -1131,11 +1130,11 @@ idpf_singleq_vtx1(volatile struct idpf_flex_tx_desc *txdp,
 #define IDPF_TX_LEN_MASK 0xAA
 #define IDPF_TX_OFF_MASK 0x55
 static __rte_always_inline void
-idpf_singleq_vtx(volatile struct idpf_flex_tx_desc *txdp,
+idpf_singleq_vtx(volatile struct idpf_base_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_FLEX_DATA  |
-			((uint64_t)flags  << IDPF_FLEX_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA  |
+			((uint64_t)flags  << IDPF_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -1148,19 +1147,19 @@ idpf_singleq_vtx(volatile struct idpf_flex_tx_desc *txdp,
 		uint64_t hi_qw3 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[3]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw2 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[2]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw1 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[1]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw0 =
 			hi_qw_tmpl |
 			((uint64_t)pkt[0]->data_len <<
-			 IDPF_FLEX_TXD_QW1_BUF_SZ_S);
+			 IDPF_TXD_QW1_TX_BUF_SZ_S);
 
 		__m512i desc0_3 =
 			_mm512_set_epi64
@@ -1187,11 +1186,11 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 					 uint16_t nb_pkts)
 {
 	struct idpf_tx_queue *txq = tx_queue;
-	volatile struct idpf_flex_tx_desc *txdp;
+	volatile struct idpf_base_tx_desc *txdp;
 	struct idpf_tx_vec_entry *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = IDPF_TX_FLEX_DESC_CMD_EOP;
-	uint64_t rs = IDPF_TX_FLEX_DESC_CMD_RS | flags;
+	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
+	uint64_t rs = IDPF_TX_DESC_CMD_RS | flags;
 
 	/* cross rx_thresh boundary is not allowed */
 	nb_pkts = RTE_MIN(nb_pkts, txq->rs_thresh);
@@ -1238,9 +1237,9 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->next_rs) {
-		txq->tx_ring[txq->next_rs].qw1.cmd_dtype |=
-			rte_cpu_to_le_64(((uint64_t)IDPF_TX_FLEX_DESC_CMD_RS) <<
-					 IDPF_FLEX_TXD_QW1_CMD_S);
+		txq->tx_ring[txq->next_rs].qw1 |=
+			rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
+					 IDPF_TXD_QW1_CMD_S);
 		txq->next_rs =
 			(uint16_t)(txq->next_rs + txq->rs_thresh);
 	}
drivers/net/cpfl/cpfl_rxtx.c +1 -1
index 2ef6871a85..ab8bec4645 100644
@@ -135,7 +135,7 @@ cpfl_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_sched_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		memcpy(ring_name, "cpfl Tx ring", sizeof("cpfl Tx ring"));
 		break;
drivers/net/idpf/idpf_rxtx.c +1 -1
index 3e3d81ca6d..64f2235580 100644
@@ -74,7 +74,7 @@ idpf_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_sched_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		rte_memcpy(ring_name, "idpf Tx ring", sizeof("idpf Tx ring"));
 		break;
Signature · 1 line
2.25.1
#74 lore raw

PATCH v5 2/11 common/idpf/base: enable support for physical port stats

In reply to Simei Su

Add support to indicate physical port representor and query its statistics.

---
 .mailmap                             |  2 +
 drivers/common/idpf/base/virtchnl2.h | 80 +++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
.mailmap +2 -0
index 4dac53011b..3dfdd81797 100644
@@ -1639,3 +1639,5 @@ Ziye Yang <[email protected]>
 Zoltan Kiss <[email protected]> <[email protected]>
 Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
+Jayaprakash Shanmugam <[email protected]>
+Zhenning Xiao <[email protected]>
drivers/common/idpf/base/virtchnl2.h +79 -1

116 lines not on this page · raw message

Signature · 1 line
2.25.1
#75 lore raw

PATCH v5 3/11 common/idpf/base: add miss completion capabilities

In reply to Simei Su

Add miss completion tag in other capability flags to indicate support for detecting a miss completion based on the upper bit of the completion tag.

---
 .mailmap                             | 1 +
 drivers/common/idpf/base/virtchnl2.h | 4 ++++
 2 files changed, 5 insertions(+)
.mailmap +1 -0
index 3dfdd81797..91d8cca78f 100644
@@ -1641,3 +1641,4 @@ Zorik Machulsky <[email protected]>
 Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
+Josh Hay <[email protected]>
drivers/common/idpf/base/virtchnl2.h +4 -0
index cd47444835..c49e4b943c 100644
@@ -231,6 +231,10 @@
 #define VIRTCHNL2_CAP_RX_FLEX_DESC		BIT(17)
 #define VIRTCHNL2_CAP_PTYPE			BIT(18)
 #define VIRTCHNL2_CAP_LOOPBACK			BIT(19)
+/* Enable miss completion types plus ability to detect a miss completion if a
+ * reserved bit is set in a standared completion's tag.
+ */
+#define VIRTCHNL2_CAP_MISS_COMPL_TAG		BIT(20)
 /* this must be the last capability */
 #define VIRTCHNL2_CAP_OEM			BIT(63)
 
Signature · 1 line
2.25.1
#76 lore raw

PATCH v5 4/11 common/idpf/base: initialize PTP support

In reply to Simei Su

Add a few PTP capabilities to determine which PTP features are enabled including legacy cross time, ptm, device clock control, PTP Tx timestamp with direct registers access and PTP Tx timestamp with virtchnl messages. Also create opcodes and structures to support feautres introduced by capabilities.

---
 drivers/common/idpf/base/virtchnl2.h | 145 +++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)
drivers/common/idpf/base/virtchnl2.h +145 -0
index c49e4b943c..320430df6f 100644
@@ -98,6 +98,9 @@
 #define		VIRTCHNL2_OP_ADD_QUEUE_GROUPS		538
 #define		VIRTCHNL2_OP_DEL_QUEUE_GROUPS		539
 #define		VIRTCHNL2_OP_GET_PORT_STATS		540
+	/* TimeSync opcodes */
+#define		VIRTCHNL2_OP_GET_PTP_CAPS		541
+#define		VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES	542
 
 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX	0xFFFF
 
@@ -1395,6 +1398,112 @@ struct virtchnl2_promisc_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_promisc_info);
 
+/* VIRTCHNL2_PTP_CAPS
+ * PTP capabilities
+ */
+#define VIRTCHNL2_PTP_CAP_LEGACY_CROSS_TIME	BIT(0)
+#define VIRTCHNL2_PTP_CAP_PTM			BIT(1)
+#define VIRTCHNL2_PTP_CAP_DEVICE_CLOCK_CONTROL	BIT(2)
+#define VIRTCHNL2_PTP_CAP_TX_TSTAMPS_DIRECT	BIT(3)
+#define	VIRTCHNL2_PTP_CAP_TX_TSTAMPS_VIRTCHNL	BIT(4)
+
+/* Legacy cross time registers offsets */
+struct virtchnl2_ptp_legacy_cross_time_reg {
+	__le32 shadow_time_0;
+	__le32 shadow_time_l;
+	__le32 shadow_time_h;
+	__le32 cmd_sync;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_legacy_cross_time_reg);
+
+/* PTM cross time registers offsets */
+struct virtchnl2_ptp_ptm_cross_time_reg {
+	__le32 art_l;
+	__le32 art_h;
+	__le32 cmd_sync;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_ptm_cross_time_reg);
+
+/* Registers needed to control the main clock */
+struct virtchnl2_ptp_device_clock_control {
+	__le32 cmd;
+	__le32 incval_l;
+	__le32 incval_h;
+	__le32 shadj_l;
+	__le32 shadj_h;
+	u8 pad[4];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_device_clock_control);
+
+/* Structure that defines tx tstamp entry - index and register offset */
+struct virtchnl2_ptp_tx_tstamp_entry {
+	__le32 tx_latch_register_base;
+	__le32 tx_latch_register_offset;
+	u8 index;
+	u8 pad[7];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_entry);
+
+/* Structure that defines tx tstamp entries - total number of latches
+ * and the array of entries.
+ */
+struct virtchnl2_ptp_tx_tstamp {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_entry ptp_tx_tstamp_entries[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp);
+
+/* VIRTCHNL2_OP_GET_PTP_CAPS
+ * PV/VF sends this message to negotiate PTP capabilities. CP updates bitmap
+ * with supported features and fulfills appropriate structures.
+ */
+struct virtchnl2_get_ptp_caps {
+	/* PTP capability bitmap */
+	/* see VIRTCHNL2_PTP_CAPS definitions */
+	__le32 ptp_caps;
+	u8 pad[4];
+
+	struct virtchnl2_ptp_legacy_cross_time_reg legacy_cross_time_reg;
+	struct virtchnl2_ptp_ptm_cross_time_reg ptm_cross_time_reg;
+	struct virtchnl2_ptp_device_clock_control device_clock_control;
+	struct virtchnl2_ptp_tx_tstamp tx_tstamp;
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(88, virtchnl2_get_ptp_caps);
+
+/* Structure that describes tx tstamp values, index and validity */
+struct virtchnl2_ptp_tx_tstamp_latch {
+	__le32 tstamp_h;
+	__le32 tstamp_l;
+	u8 index;
+	u8 valid;
+	u8 pad[6];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_ptp_tx_tstamp_latch);
+
+/* VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES
+ * PF/VF sends this message to receive a specified number of timestamps
+ * entries.
+ */
+struct virtchnl2_ptp_tx_tstamp_latches {
+	__le16 num_latches;
+	/* latch size expressed in bits */
+	__le16 latch_size;
+	u8 pad[4];
+	struct virtchnl2_ptp_tx_tstamp_latch tstamp_latches[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_ptp_tx_tstamp_latches);
 
 static inline const char *virtchnl2_op_str(__le32 v_opcode)
 {
@@ -1463,6 +1572,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode)
 		return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS";
 	case VIRTCHNL2_OP_GET_PORT_STATS:
 		return "VIRTCHNL2_OP_GET_PORT_STATS";
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		return "VIRTCHNL2_OP_GET_PTP_CAPS";
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		return "VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES";
 	default:
 		return "Unsupported (update virtchnl2.h)";
 	}
@@ -1732,6 +1845,38 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 		break;
 	case VIRTCHNL2_OP_RESET_VF:
 		break;
+	case VIRTCHNL2_OP_GET_PTP_CAPS:
+		valid_len = sizeof(struct virtchnl2_get_ptp_caps);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_get_ptp_caps *ptp_caps =
+			(struct virtchnl2_get_ptp_caps *)msg;
+
+			if (ptp_caps->tx_tstamp.num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((ptp_caps->tx_tstamp.num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_entry));
+		}
+		break;
+	case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES:
+		valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches);
+
+		if (msglen >= valid_len) {
+			struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches =
+			(struct virtchnl2_ptp_tx_tstamp_latches *)msg;
+
+			if (tx_tstamp_latches->num_latches == 0) {
+				err_msg_format = true;
+				break;
+			}
+
+			valid_len += ((tx_tstamp_latches->num_latches - 1) *
+				      sizeof(struct virtchnl2_ptp_tx_tstamp_latch));
+		}
+		break;
 	/* These are always errors coming from the VF. */
 	case VIRTCHNL2_OP_EVENT:
 	case VIRTCHNL2_OP_UNKNOWN:
Signature · 1 line
2.25.1
#77 lore raw

PATCH v5 5/11 common/idpf/base: remove mailbox registers

In reply to Simei Su

Remove mailbox register offsets because individual drivers will define the offsets based on how registers address the registers.

---
 .mailmap                             |  1 +
 drivers/common/idpf/base/siov_regs.h | 13 ++-----------
 2 files changed, 3 insertions(+), 11 deletions(-)
.mailmap +1 -0
index 91d8cca78f..d8782cd67e 100644
@@ -1642,3 +1642,4 @@ Zyta Szpak <[email protected]> <[email protected]> <[email protected]>
 Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
+Madhu Chittim <[email protected]>
drivers/common/idpf/base/siov_regs.h +2 -11
index fad329601a..7e1ae2e300 100644
@@ -4,16 +4,6 @@
 #ifndef _SIOV_REGS_H_
 #define _SIOV_REGS_H_
 #define VDEV_MBX_START			0x20000 /* Begin at 128KB */
-#define VDEV_MBX_ATQBAL			(VDEV_MBX_START + 0x0000)
-#define VDEV_MBX_ATQBAH			(VDEV_MBX_START + 0x0004)
-#define VDEV_MBX_ATQLEN			(VDEV_MBX_START + 0x0008)
-#define VDEV_MBX_ATQH			(VDEV_MBX_START + 0x000C)
-#define VDEV_MBX_ATQT			(VDEV_MBX_START + 0x0010)
-#define VDEV_MBX_ARQBAL			(VDEV_MBX_START + 0x0014)
-#define VDEV_MBX_ARQBAH			(VDEV_MBX_START + 0x0018)
-#define VDEV_MBX_ARQLEN			(VDEV_MBX_START + 0x001C)
-#define VDEV_MBX_ARQH			(VDEV_MBX_START + 0x0020)
-#define VDEV_MBX_ARQT			(VDEV_MBX_START + 0x0024)
 #define VDEV_GET_RSTAT			0x21000 /* 132KB for RSTAT */
 
 /* Begin at offset after 1MB (after 256 4k pages) */
@@ -43,5 +33,6 @@
 #define VDEV_INT_ITR_1(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x08)
 #define VDEV_INT_ITR_2(_i)		(VDEV_INT_DYN_START + ((_i) * 0x1000) + 0x0C)
 
-/* Next offset to begin at 42MB (0x2A00000) */
+#define SIOV_REG_BAR_SIZE               0x2A00000
+/* Next offset to begin at 42MB + 4K (0x2A00000 + 0x1000) */
 #endif /* _SIOV_REGS_H_ */
Signature · 1 line
2.25.1
#78 lore raw

PATCH v5 6/11 common/idpf/base: refine structure and necessary check

In reply to Simei Su

a) Refine queue chunk and vector chunk structures.
b) Add non_flex prefix to distinguish the flex array definitions.
c) Add some specific fields.
d) Refine condition check.

---
 .mailmap                               |  2 +
 drivers/common/idpf/base/idpf_common.c |  6 ++-
 drivers/common/idpf/base/virtchnl2.h   | 72 +++++++++++++++++---------
 3 files changed, 54 insertions(+), 26 deletions(-)
.mailmap +2 -0
index d8782cd67e..23aed53102 100644
@@ -1643,3 +1643,5 @@ Jayaprakash Shanmugam <[email protected]>
 Zhenning Xiao <[email protected]>
 Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
+Shailendra Bhatnagar <[email protected]>
+Julianx Grajkowski <[email protected]>
drivers/common/idpf/base/idpf_common.c +4 -2
index fbf71416fd..9610916aa9 100644
@@ -239,8 +239,10 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
 	e->desc.ret_val = msg.status;
 	e->desc.datalen = msg.data_len;
 	if (msg.data_len > 0) {
-		if (!msg.ctx.indirect.payload)
-			return -EINVAL;
+		if (!msg.ctx.indirect.payload || !msg.ctx.indirect.payload->va ||
+		    !e->msg_buf) {
+			return -EFAULT;
+		}
 		e->buf_len = msg.data_len;
 		msg_data_len = msg.data_len;
 		idpf_memcpy(e->msg_buf, msg.ctx.indirect.payload->va, msg_data_len,
drivers/common/idpf/base/virtchnl2.h +48 -24

141 lines not on this page · raw message

Signature · 1 line
2.25.1
#79 lore raw

PATCH v5 7/11 common/idpf/base: add union for SW cookie fields

In reply to Simei Su

Instead of using something like a byte offset, we can add a union to the struct to enable direct addressing.

---
 .mailmap                                     | 1 +
 drivers/common/idpf/base/idpf_controlq_api.h | 5 +++++
 2 files changed, 6 insertions(+)
.mailmap +1 -0
index 23aed53102..2fcadb4e4c 100644
@@ -1645,3 +1645,4 @@ Josh Hay <[email protected]>
 Madhu Chittim <[email protected]>
 Shailendra Bhatnagar <[email protected]>
 Julianx Grajkowski <[email protected]>
+Alan Brady <[email protected]>
drivers/common/idpf/base/idpf_controlq_api.h +5 -0
index 3780304256..f4e7b53ac9 100644
@@ -77,6 +77,11 @@ struct idpf_ctlq_msg {
 			u8 context[IDPF_INDIRECT_CTX_SIZE];
 			struct idpf_dma_mem *payload;
 		} indirect;
+		struct {
+			u32 rsvd;
+			u16 data;
+			u16 flags;
+		} sw_cookie;
 	} ctx;
 };
 
Signature · 1 line
2.25.1
#80 lore raw

PATCH v5 8/11 common/idpf/base: refine code and alignments

In reply to Simei Su

a) Refine double pointer with a local pointer.
b) Refine return type for function instead of only returning success.
c) Remove unnecessary check and comments.
d) Use tab spaces and new lines wherever necessary.

---
 drivers/common/idpf/base/idpf_common.c        |  4 +-
 drivers/common/idpf/base/idpf_controlq.c      | 64 +++++++++----------
 drivers/common/idpf/base/idpf_controlq_api.h  | 12 +---
 .../common/idpf/base/idpf_controlq_setup.c    |  5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  7 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 46 ++++++-------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   | 25 +++++---
 drivers/common/idpf/base/idpf_prototype.h     |  2 +-
 8 files changed, 80 insertions(+), 85 deletions(-)
drivers/common/idpf/base/idpf_common.c +2 -2
index 9610916aa9..7181a7f14c 100644
@@ -262,12 +262,12 @@ int idpf_clean_arq_element(struct idpf_hw *hw,
  *  idpf_deinit_hw - shutdown routine
  *  @hw: pointer to the hardware structure
  */
-int idpf_deinit_hw(struct idpf_hw *hw)
+void idpf_deinit_hw(struct idpf_hw *hw)
 {
 	hw->asq = NULL;
 	hw->arq = NULL;
 
-	return idpf_ctlq_deinit(hw);
+	idpf_ctlq_deinit(hw);
 }
 
 /**
drivers/common/idpf/base/idpf_controlq.c +30 -34

140 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h +3 -9
index f4e7b53ac9..38f5d2df3c 100644
@@ -21,10 +21,7 @@ enum idpf_ctlq_type {
 	IDPF_CTLQ_TYPE_RDMA_COMPL	= 7
 };
 
-/*
- * Generic Control Queue Structures
- */
-
+/* Generic Control Queue Structures */
 struct idpf_ctlq_reg {
 	/* used for queue tracking */
 	u32 head;
@@ -157,10 +154,7 @@ enum idpf_mbx_opc {
 	idpf_mbq_opc_send_msg_to_peer_drv	= 0x0804,
 };
 
-/*
- * API supported for control queue management
- */
-
+/* API supported for control queue management */
 /* Will init all required q including default mb.  "q_info" is an array of
  * create_info structs equal to the number of control queues to be created.
  */
@@ -205,6 +199,6 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw,
 			    struct idpf_dma_mem **buffs);
 
 /* Will destroy all q including the default mb */
-int idpf_ctlq_deinit(struct idpf_hw *hw);
+void idpf_ctlq_deinit(struct idpf_hw *hw);
 
 #endif /* _IDPF_CONTROLQ_API_H_ */
drivers/common/idpf/base/idpf_controlq_setup.c +2 -3
index 0f1b52a7e9..21f43c74f5 100644
@@ -11,9 +11,8 @@
  * @hw: pointer to hw struct
  * @cq: pointer to the specific Control queue
  */
-static int
-idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
-			  struct idpf_ctlq_info *cq)
+static int idpf_ctlq_alloc_desc_ring(struct idpf_hw *hw,
+				     struct idpf_ctlq_info *cq)
 {
 	size_t size = cq->ring_size * sizeof(struct idpf_ctlq_desc);
 
drivers/common/idpf/base/idpf_lan_pf_regs.h +4 -3
index 8542620e01..eab23f279a 100644
@@ -80,10 +80,11 @@
 /* _ITR is ITR index, _INT is interrupt index, _itrn_indx_spacing is
  * spacing b/w itrn registers of the same vector.
  */
-#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
+#define PF_GLINT_ITR_ADDR(_ITR, _reg_start, _itrn_indx_spacing)	\
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
 /* For PF, itrn_indx_spacing is 4 and itrn_reg_spacing is 0x1000 */
-#define PF_GLINT_ITR(_ITR, _INT) (PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
+#define PF_GLINT_ITR(_ITR, _INT)	\
+	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
 #define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
drivers/common/idpf/base/idpf_lan_txrx.h +21 -25

71 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +17 -8
index b5ff9b2cc9..2caa07fdfd 100644
@@ -94,14 +94,23 @@
  * b/w itrn registers of the same vector
  */
 #define VF_INT_ITR0(_ITR)		(0x00004C00 + ((_ITR) * 4))
-#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing) \
-		 ((_reg_start) + (((_ITR)) * (_itrn_indx_spacing)))
-/* For VF with 16 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x40 */
-#define VF_INT_ITRN(_INT, _ITR)	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
-/* For VF with 64 vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x100 */
-#define VF_INT_ITRN_64(_INT, _ITR) (0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
-/* For VF with 2k vector support, itrn_reg_spacing is 0x4 and itrn_indx_spacing is 0x2000 */
-#define VF_INT_ITRN_2K(_INT, _ITR) (0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
+#define VF_INT_ITRN_ADDR(_ITR, _reg_start, _itrn_indx_spacing)	\
+	((_reg_start) + ((_ITR) * (_itrn_indx_spacing)))
+/* For VF with 16 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x40 and base register offset is 0x00002800
+ */
+#define VF_INT_ITRN(_INT, _ITR)		\
+	(0x00002800 + ((_INT) * 4) + ((_ITR) * 0x40))
+/* For VF with 64 vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x100 and base register offset is 0x00002C00
+ */
+#define VF_INT_ITRN_64(_INT, _ITR)	\
+	(0x00002C00 + ((_INT) * 4) + ((_ITR) * 0x100))
+/* For VF with 2k vector support, itrn_reg_spacing is 0x4, itrn_indx_spacing
+ * is 0x2000 and base register offset is 0x00072000
+ */
+#define VF_INT_ITRN_2K(_INT, _ITR)	\
+	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
 #define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
drivers/common/idpf/base/idpf_prototype.h +1 -1
index 988ff00506..e2f090a9e3 100644
@@ -20,7 +20,7 @@
 #define APF
 
 int idpf_init_hw(struct idpf_hw *hw, struct idpf_ctlq_size ctlq_size);
-int idpf_deinit_hw(struct idpf_hw *hw);
+void idpf_deinit_hw(struct idpf_hw *hw);
 
 int idpf_clean_arq_element(struct idpf_hw *hw,
 			   struct idpf_arq_event_info *e,
Signature · 1 line
2.25.1
#81 lore raw

PATCH v5 9/11 common/idpf/base: use GENMASK macro

In reply to Simei Su

Instead of using a custom defined macro for generating a mask, use the standard GENMASK macro.

---
 drivers/common/idpf/base/idpf_lan_pf_regs.h |  26 ++---
 drivers/common/idpf/base/idpf_lan_txrx.h    | 116 +++++++++-----------
 drivers/common/idpf/base/idpf_lan_vf_regs.h |  16 +--
 drivers/common/idpf/base/idpf_osdep.h       |   7 ++
 4 files changed, 80 insertions(+), 85 deletions(-)
drivers/common/idpf/base/idpf_lan_pf_regs.h +13 -13
index eab23f279a..a51e39a502 100644
@@ -24,7 +24,7 @@
 #define PF_FW_ARQBAH			(PF_FW_BASE + 0x4)
 #define PF_FW_ARQLEN			(PF_FW_BASE + 0x8)
 #define PF_FW_ARQLEN_ARQLEN_S		0
-#define PF_FW_ARQLEN_ARQLEN_M		IDPF_M(0x1FFF, PF_FW_ARQLEN_ARQLEN_S)
+#define PF_FW_ARQLEN_ARQLEN_M		GENMASK(12, 0)
 #define PF_FW_ARQLEN_ARQVFE_S		28
 #define PF_FW_ARQLEN_ARQVFE_M		BIT(PF_FW_ARQLEN_ARQVFE_S)
 #define PF_FW_ARQLEN_ARQOVFL_S		29
@@ -35,14 +35,14 @@
 #define PF_FW_ARQLEN_ARQENABLE_M	BIT(PF_FW_ARQLEN_ARQENABLE_S)
 #define PF_FW_ARQH			(PF_FW_BASE + 0xC)
 #define PF_FW_ARQH_ARQH_S		0
-#define PF_FW_ARQH_ARQH_M		IDPF_M(0x1FFF, PF_FW_ARQH_ARQH_S)
+#define PF_FW_ARQH_ARQH_M		GENMASK(12, 0)
 #define PF_FW_ARQT			(PF_FW_BASE + 0x10)
 
 #define PF_FW_ATQBAL			(PF_FW_BASE + 0x14)
 #define PF_FW_ATQBAH			(PF_FW_BASE + 0x18)
 #define PF_FW_ATQLEN			(PF_FW_BASE + 0x1C)
 #define PF_FW_ATQLEN_ATQLEN_S		0
-#define PF_FW_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, PF_FW_ATQLEN_ATQLEN_S)
+#define PF_FW_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define PF_FW_ATQLEN_ATQVFE_S		28
 #define PF_FW_ATQLEN_ATQVFE_M		BIT(PF_FW_ATQLEN_ATQVFE_S)
 #define PF_FW_ATQLEN_ATQOVFL_S		29
@@ -53,7 +53,7 @@
 #define PF_FW_ATQLEN_ATQENABLE_M	BIT(PF_FW_ATQLEN_ATQENABLE_S)
 #define PF_FW_ATQH			(PF_FW_BASE + 0x20)
 #define PF_FW_ATQH_ATQH_S		0
-#define PF_FW_ATQH_ATQH_M		IDPF_M(0x3FF, PF_FW_ATQH_ATQH_S)
+#define PF_FW_ATQH_ATQH_M		GENMASK(9, 0)
 #define PF_FW_ATQT			(PF_FW_BASE + 0x24)
 
 /* Interrupts */
@@ -66,7 +66,7 @@
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_S	2
 #define PF_GLINT_DYN_CTL_SWINT_TRIG_M	BIT(PF_GLINT_DYN_CTL_SWINT_TRIG_S)
 #define PF_GLINT_DYN_CTL_ITR_INDX_S	3
-#define PF_GLINT_DYN_CTL_ITR_INDX_M	IDPF_M(0x3, PF_GLINT_DYN_CTL_ITR_INDX_S)
+#define PF_GLINT_DYN_CTL_ITR_INDX_M	GENMASK(4, 3)
 #define PF_GLINT_DYN_CTL_INTERVAL_S	5
 #define PF_GLINT_DYN_CTL_INTERVAL_M	BIT(PF_GLINT_DYN_CTL_INTERVAL_S)
 #define PF_GLINT_DYN_CTL_SW_ITR_INDX_ENA_S	24
@@ -87,13 +87,13 @@
 	(PF_GLINT_BASE + (((_ITR) + 1) * 4) + ((_INT) * 0x1000))
 #define PF_GLINT_ITR_MAX_INDEX		2
 #define PF_GLINT_ITR_INTERVAL_S		0
-#define PF_GLINT_ITR_INTERVAL_M		IDPF_M(0xFFF, PF_GLINT_ITR_INTERVAL_S)
+#define PF_GLINT_ITR_INTERVAL_M		GENMASK(11, 0)
 
 /* Timesync registers */
 #define PF_TIMESYNC_BASE		0x08404000
 #define PF_GLTSYN_CMD_SYNC		(PF_TIMESYNC_BASE)
 #define PF_GLTSYN_CMD_SYNC_EXEC_CMD_S	0
-#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	IDPF_M(0x3, PF_GLTSYN_CMD_SYNC_EXEC_CMD_S)
+#define PF_GLTSYN_CMD_SYNC_EXEC_CMD_M	GENMASK(1, 0)
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_S	2
 #define PF_GLTSYN_CMD_SYNC_SHTIME_EN_M	BIT(PF_GLTSYN_CMD_SYNC_SHTIME_EN_S)
 #define PF_GLTSYN_SHTIME_0		(PF_TIMESYNC_BASE + 0x4)
@@ -105,23 +105,23 @@
 /* Generic registers */
 #define PF_INT_DIR_OICR_ENA		0x08406000
 #define PF_INT_DIR_OICR_ENA_S		0
-#define PF_INT_DIR_OICR_ENA_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_ENA_S)
+#define PF_INT_DIR_OICR_ENA_M		GENMASK(31, 0)
 #define PF_INT_DIR_OICR			0x08406004
 #define PF_INT_DIR_OICR_TSYN_EVNT	0
 #define PF_INT_DIR_OICR_PHY_TS_0	BIT(1)
 #define PF_INT_DIR_OICR_PHY_TS_1	BIT(2)
 #define PF_INT_DIR_OICR_CAUSE		0x08406008
 #define PF_INT_DIR_OICR_CAUSE_CAUSE_S	0
-#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	IDPF_M(0xFFFFFFFF, PF_INT_DIR_OICR_CAUSE_CAUSE_S)
+#define PF_INT_DIR_OICR_CAUSE_CAUSE_M	GENMASK(31, 0)
 #define PF_INT_PBA_CLEAR		0x0840600C
 
 #define PF_FUNC_RID			0x08406010
 #define PF_FUNC_RID_FUNCTION_NUMBER_S	0
-#define PF_FUNC_RID_FUNCTION_NUMBER_M	IDPF_M(0x7, PF_FUNC_RID_FUNCTION_NUMBER_S)
+#define PF_FUNC_RID_FUNCTION_NUMBER_M	GENMASK(2, 0)
 #define PF_FUNC_RID_DEVICE_NUMBER_S	3
-#define PF_FUNC_RID_DEVICE_NUMBER_M	IDPF_M(0x1F, PF_FUNC_RID_DEVICE_NUMBER_S)
+#define PF_FUNC_RID_DEVICE_NUMBER_M	GENMASK(7, 3)
 #define PF_FUNC_RID_BUS_NUMBER_S	8
-#define PF_FUNC_RID_BUS_NUMBER_M	IDPF_M(0xFF, PF_FUNC_RID_BUS_NUMBER_S)
+#define PF_FUNC_RID_BUS_NUMBER_M	GENMASK(15, 8)
 
 /* Reset registers */
 #define PFGEN_RTRIG			0x08407000
@@ -133,7 +133,7 @@
 #define PFGEN_RTRIG_IMCR_M		BIT(2)
 #define PFGEN_RSTAT			0x08407008 /* PFR Status */
 #define PFGEN_RSTAT_PFR_STATE_S		0
-#define PFGEN_RSTAT_PFR_STATE_M		IDPF_M(0x3, PFGEN_RSTAT_PFR_STATE_S)
+#define PFGEN_RSTAT_PFR_STATE_M		GENMASK(1, 0)
 #define PFGEN_CTRL			0x0840700C
 #define PFGEN_CTRL_PFSWR		BIT(0)
 
drivers/common/idpf/base/idpf_lan_txrx.h +52 -64

164 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h +8 -8
index 2caa07fdfd..eae28478ff 100644
@@ -9,7 +9,7 @@
 /* Reset */
 #define VFGEN_RSTAT			0x00008800
 #define VFGEN_RSTAT_VFR_STATE_S		0
-#define VFGEN_RSTAT_VFR_STATE_M		IDPF_M(0x3, VFGEN_RSTAT_VFR_STATE_S)
+#define VFGEN_RSTAT_VFR_STATE_M		GENMASK(1, 0)
 
 /* Control(VF Mailbox) Queue */
 #define VF_BASE				0x00006000
@@ -18,7 +18,7 @@
 #define VF_ATQBAH			(VF_BASE + 0x1800)
 #define VF_ATQLEN			(VF_BASE + 0x0800)
 #define VF_ATQLEN_ATQLEN_S		0
-#define VF_ATQLEN_ATQLEN_M		IDPF_M(0x3FF, VF_ATQLEN_ATQLEN_S)
+#define VF_ATQLEN_ATQLEN_M		GENMASK(9, 0)
 #define VF_ATQLEN_ATQVFE_S		28
 #define VF_ATQLEN_ATQVFE_M		BIT(VF_ATQLEN_ATQVFE_S)
 #define VF_ATQLEN_ATQOVFL_S		29
@@ -29,14 +29,14 @@
 #define VF_ATQLEN_ATQENABLE_M		BIT(VF_ATQLEN_ATQENABLE_S)
 #define VF_ATQH				(VF_BASE + 0x0400)
 #define VF_ATQH_ATQH_S			0
-#define VF_ATQH_ATQH_M			IDPF_M(0x3FF, VF_ATQH_ATQH_S)
+#define VF_ATQH_ATQH_M			GENMASK(9, 0)
 #define VF_ATQT				(VF_BASE + 0x2400)
 
 #define VF_ARQBAL			(VF_BASE + 0x0C00)
 #define VF_ARQBAH			(VF_BASE)
 #define VF_ARQLEN			(VF_BASE + 0x2000)
 #define VF_ARQLEN_ARQLEN_S		0
-#define VF_ARQLEN_ARQLEN_M		IDPF_M(0x3FF, VF_ARQLEN_ARQLEN_S)
+#define VF_ARQLEN_ARQLEN_M		GENMASK(9, 0)
 #define VF_ARQLEN_ARQVFE_S		28
 #define VF_ARQLEN_ARQVFE_M		BIT(VF_ARQLEN_ARQVFE_S)
 #define VF_ARQLEN_ARQOVFL_S		29
@@ -47,7 +47,7 @@
 #define VF_ARQLEN_ARQENABLE_M		BIT(VF_ARQLEN_ARQENABLE_S)
 #define VF_ARQH				(VF_BASE + 0x1400)
 #define VF_ARQH_ARQH_S			0
-#define VF_ARQH_ARQH_M			IDPF_M(0x1FFF, VF_ARQH_ARQH_S)
+#define VF_ARQH_ARQH_M			GENMASK(12, 0)
 #define VF_ARQT				(VF_BASE + 0x1000)
 
 /* Transmit queues */
@@ -69,7 +69,7 @@
 #define VF_INT_DYN_CTL0_INTENA_S	0
 #define VF_INT_DYN_CTL0_INTENA_M	BIT(VF_INT_DYN_CTL0_INTENA_S)
 #define VF_INT_DYN_CTL0_ITR_INDX_S	3
-#define VF_INT_DYN_CTL0_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTL0_ITR_INDX_S)
+#define VF_INT_DYN_CTL0_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN(_INT)		(0x00003800 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_EXT(_INT)	(0x00070000 + ((_INT) * 4))
 #define VF_INT_DYN_CTLN_INTENA_S	0
@@ -79,7 +79,7 @@
 #define VF_INT_DYN_CTLN_SWINT_TRIG_S	2
 #define VF_INT_DYN_CTLN_SWINT_TRIG_M	BIT(VF_INT_DYN_CTLN_SWINT_TRIG_S)
 #define VF_INT_DYN_CTLN_ITR_INDX_S	3
-#define VF_INT_DYN_CTLN_ITR_INDX_M	IDPF_M(0x3, VF_INT_DYN_CTLN_ITR_INDX_S)
+#define VF_INT_DYN_CTLN_ITR_INDX_M	GENMASK(4, 3)
 #define VF_INT_DYN_CTLN_INTERVAL_S	5
 #define VF_INT_DYN_CTLN_INTERVAL_M	BIT(VF_INT_DYN_CTLN_INTERVAL_S)
 #define VF_INT_DYN_CTLN_SW_ITR_INDX_ENA_S	24
@@ -113,7 +113,7 @@
 	(0x00072000 + ((_INT) * 4) + ((_ITR) * 0x2000))
 #define VF_INT_ITRN_MAX_INDEX		2
 #define VF_INT_ITRN_INTERVAL_S		0
-#define VF_INT_ITRN_INTERVAL_M		IDPF_M(0xFFF, VF_INT_ITRN_INTERVAL_S)
+#define VF_INT_ITRN_INTERVAL_M		GENMASK(11, 0)
 #define VF_INT_PBA_CLEAR		0x00008900
 
 #define VF_INT_ICR0_ENA1		0x00005000
drivers/common/idpf/base/idpf_osdep.h +7 -0
index 2a817a9807..74a376cb13 100644
@@ -48,6 +48,13 @@ typedef struct idpf_lock idpf_lock;
 
 #define IDPF_M(m, s)		((m) << (s))
 
+#define BITS_PER_LONG (8 * sizeof(long))
+#define BITS_PER_LONG_LONG (8 * sizeof(long long))
+#define GENMASK(h, l) \
+	(((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+
 #ifndef ETH_ADDR_LEN
 #define ETH_ADDR_LEN		6
 #endif
Signature · 1 line
2.25.1
#82 lore raw

PATCH v5 10/11 common/idpf/base: remove unused Tx descriptor types

In reply to Simei Su

Remove the unused TX descriptor types and mark them as reserved.

---
 drivers/common/idpf/base/idpf_lan_txrx.h | 136 ++---------------------
 1 file changed, 12 insertions(+), 124 deletions(-)
drivers/common/idpf/base/idpf_lan_txrx.h +12 -124
index c39930654a..c9eaeb5d3f 100644
@@ -119,19 +119,19 @@ enum idpf_rss_hash {
 enum idpf_tx_desc_dtype_value {
 	IDPF_TX_DESC_DTYPE_DATA				= 0,
 	IDPF_TX_DESC_DTYPE_CTX				= 1,
-	IDPF_TX_DESC_DTYPE_REINJECT_CTX			= 2,
-	IDPF_TX_DESC_DTYPE_FLEX_DATA			= 3,
-	IDPF_TX_DESC_DTYPE_FLEX_CTX			= 4,
+	/* DTYPE 2 is reserved
+	 * DTYPE 3 is free for future use
+	 * DTYPE 4 is reserved
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX			= 5,
-	IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1		= 6,
+	/* DTYPE 6 is reserved */
 	IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2		= 7,
-	IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX	= 8,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_TSO_CTX	= 9,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_SA_CTX	= 10,
-	IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX		= 11,
+	/* DTYPE 8, 9 are free for future use
+	 * DTYPE 10 is reserved
+	 * DTYPE 11 is free for future use
+	 */
 	IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE		= 12,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_TSO_CTX	= 13,
-	IDPF_TX_DESC_DTYPE_FLEX_HOSTSPLIT_CTX		= 14,
+	/* DTYPE 13, 14 are free for future use */
 	/* DESC_DONE - HW has completed write-back of descriptor */
 	IDPF_TX_DESC_DTYPE_DESC_DONE			= 15,
 };
@@ -225,28 +225,18 @@ enum idpf_tx_flex_desc_cmd_bits {
 struct idpf_flex_tx_desc {
 	__le64 buf_addr;	/* Packet buffer address */
 	struct {
-		__le16 cmd_dtype;
 #define IDPF_FLEX_TXD_QW1_DTYPE_S	0
 #define IDPF_FLEX_TXD_QW1_DTYPE_M	GENMASK(4, 0)
 #define IDPF_FLEX_TXD_QW1_CMD_S		5
 #define IDPF_FLEX_TXD_QW1_CMD_M		GENMASK(15, 5)
+		__le16 cmd_dtype;
 		union {
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_DATA_(0x03) */
-			u8 raw[4];
-
-			/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSYN_L2TAG1 (0x06) */
-			struct {
-				__le16 l2tag1;
-				u8 flex;
-				u8 tsync;
-			} tsync;
-
 			/* DTYPE=IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2 (0x07) */
 			struct {
 				__le16 l2tag1;
 				__le16 l2tag2;
 			} l2tags;
-		} flex;
+		};
 		__le16 buf_size;
 	} qw1;
 };
@@ -296,16 +286,6 @@ struct idpf_flex_tx_tso_ctx_qw {
 };
 
 union idpf_flex_tx_ctx_desc {
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_CTX (0x04) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag1;
-			u8 qw1_flex[4];
-		} qw1;
-	} gen;
-
 	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX (0x05) */
 	struct {
 		struct idpf_flex_tx_tso_ctx_qw qw0;
@@ -314,98 +294,6 @@ union idpf_flex_tx_ctx_desc {
 			u8 flex[6];
 		} qw1;
 	} tso;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_L2TAG2_PARSTAG_CTX (0x08) */
-	struct {
-		struct idpf_flex_tx_tso_ctx_qw qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex0;
-			u8 ptag;
-			u8 flex1[2];
-		} qw1;
-	} tso_l2tag2_ptag;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_L2TAG2_CTX (0x0B) */
-	struct {
-		u8 qw0_flex[8];
-		struct {
-			__le16 cmd_dtype;
-			__le16 l2tag2;
-			u8 flex[4];
-		} qw1;
-	} l2tag2;
-
-	/* DTYPE = IDPF_TX_DESC_DTYPE_REINJECT_CTX (0x02) */
-	struct {
-		struct {
-			__le32 sa_domain;
-#define IDPF_TXD_FLEX_CTX_SA_DOM_M	0xFFFF
-#define IDPF_TXD_FLEX_CTX_SA_DOM_VAL	0x10000
-			__le32 sa_idx;
-#define IDPF_TXD_FLEX_CTX_SAIDX_M	0x1FFFFF
-		} qw0;
-		struct {
-			__le16 cmd_dtype;
-			__le16 txr2comp;
-#define IDPF_TXD_FLEX_CTX_TXR2COMP	0x1
-			__le16 miss_txq_comp_tag;
-			__le16 miss_txq_id;
-		} qw1;
-	} reinjection_pkt;
 };
 
-/* Host Split Context Descriptors */
-struct idpf_flex_tx_hs_ctx_desc {
-	union {
-		struct {
-			__le32 host_fnum_tlen;
-#define IDPF_TXD_FLEX_CTX_TLEN_S	0
-/* see IDPF_TXD_FLEX_CTX_TLEN_M for mask definition */
-#define IDPF_TXD_FLEX_CTX_FNUM_S	18
-#define IDPF_TXD_FLEX_CTX_FNUM_M	0x7FF
-#define IDPF_TXD_FLEX_CTX_HOST_S	29
-#define IDPF_TXD_FLEX_CTX_HOST_M	0x7
-			__le16 ftype_mss_rt;
-#define IDPF_TXD_FLEX_CTX_MSS_RT_0	0
-#define IDPF_TXD_FLEX_CTX_MSS_RT_M	0x3FFF
-#define IDPF_TXD_FLEX_CTX_FTYPE_S	14
-#define IDPF_TXD_FLEX_CTX_FTYPE_VF	0
-#define IDPF_TXD_FLEX_CTX_FTYPE_VDEV	BIT(14)
-#define IDPF_TXD_FLEX_CTX_FTYPE_PF	BIT(15)
-			u8 hdr_len;
-			u8 ptag;
-		} tso;
-		struct {
-			u8 flex0[2];
-			__le16 host_fnum_ftype;
-			u8 flex1[3];
-			u8 ptag;
-		} no_tso;
-	} qw0;
-
-	__le64 qw1_cmd_dtype;
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_S		16
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_M		0xFFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S	36
-#define IDPF_TXD_FLEX_CTX_QW1_PASID_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_PASID_VALID_S)
-#define IDPF_TXD_FLEX_CTX_QW1_TPH_S		37
-#define IDPF_TXD_FLEX_CTX_QW1_TPH		\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_TPH_S)
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_S		38
-#define IDPF_TXD_FLEX_CTX_QW1_PFNUM_M		0xF
-/* The following are only valid for DTYPE = 0x09 and DTYPE = 0x0A */
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_S		42
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_M		0x1FFFFF
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S	63
-#define IDPF_TXD_FLEX_CTX_QW1_SAIDX_VALID	\
-	BIT_ULL(IDPF_TXD_FLEX_CTX_QW1_SAIDX_VAL_S)
-/* The following are only valid for DTYPE = 0x0D and DTYPE = 0x0E */
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_S		48
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX0_M		0xFF
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_S		56
-#define IDPF_TXD_FLEX_CTX_QW1_FLEX1_M		0xFF
-};
 #endif /* _IDPF_LAN_TXRX_H_ */
Signature · 1 line
2.25.1
#83 lore raw

PATCH v5 11/11 common/idpf/base: update version

In reply to Simei Su

Update README

---
 drivers/common/idpf/base/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/idpf/base/README +1 -1
index 693049c057..ff26f736ec 100644
@@ -6,7 +6,7 @@ Intel® IDPF driver
 ==================
 
 This directory contains source code of BSD-3-Clause idpf driver of version
-2023.02.23 released by the team which develops basic drivers for Intel IPU.
+2023.07.25 released by the team which develops basic drivers for Intel IPU.
 The directory of base/ contains the original source package.
 This driver is valid for the product(s) listed below
 
Signature · 1 line
2.25.1
Applied
#84 lore raw
In reply to Simei Su
Quoted 70 lines

-----Original Message-----
From: Su, Simei <[email protected]>
Sent: Wednesday, September 20, 2023 2:22 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Wu, Wenjun1 <[email protected]>; Liu, Mingxia <[email protected]>; Qiao, Wenjing <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH v5 00/11] update idpf base code

Currently, single queue Tx data path uses flex Tx data descriptor(DTYPE3) which is removed in the latest idpf spec. [PATCH v5 01/11] replaces flex Tx data descriptor with base Tx data descriptor for single queue Tx data path and refines Tx single queue setup to align with Tx data path.

[PATCH v5 02/11]~[PATCH v5 11/11] update idpf base code based on [PATCH v5 01/11].

v5:
* Refine commit title and commit log.
* Combine several patches into one patch.

v4:
* Put single queue Tx data path refactor patch in this patchset.

v3:
* Fix coding style issue.
* Modify unexpected error in the update version patch.

v2:
* Add two patches for share code update.
* Add version update.
* Fix coding style issue.

Simei Su (11):
common/idpf: refactor single queue Tx data path common/idpf/base: enable support for physical port stats common/idpf/base: add miss completion capabilities common/idpf/base: initialize PTP support common/idpf/base: remove mailbox registers common/idpf/base: refine structure and necessary check common/idpf/base: add union for SW cookie fields common/idpf/base: refine code and alignments common/idpf/base: use GENMASK macro common/idpf/base: remove unused Tx descriptor types common/idpf/base: update version

 .mailmap                                      |   7 +
 drivers/common/idpf/base/README               |   2 +-
 drivers/common/idpf/base/idpf_common.c        |  10 +-
 drivers/common/idpf/base/idpf_controlq.c      |  64 ++--
 drivers/common/idpf/base/idpf_controlq_api.h  |  17 +-
 .../common/idpf/base/idpf_controlq_setup.c    |   5 +-
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  33 +-
 drivers/common/idpf/base/idpf_lan_txrx.h      | 284 +++++------------
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  41 ++-
 drivers/common/idpf/base/idpf_osdep.h         |   7 +
 drivers/common/idpf/base/idpf_prototype.h     |   2 +-
 drivers/common/idpf/base/siov_regs.h          |  13 +-
 drivers/common/idpf/base/virtchnl2.h          | 301 ++++++++++++++++--
 drivers/common/idpf/idpf_common_rxtx.c        |  39 ++-
 drivers/common/idpf/idpf_common_rxtx.h        |   2 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c |  37 ++-
 drivers/net/cpfl/cpfl_rxtx.c                  |   2 +-
 drivers/net/idpf/idpf_rxtx.c                  |   2 +-
 18 files changed, 500 insertions(+), 368 deletions(-)
Quoted 2 lines

--
2.25.1

Patch 11 has been squashed with Patch 10, as it's not necessary to have a dedicate path for internal version tag.

Applied to dpdk-next-net-intel.

Thanks
Qi