Skip to contentSkip to conversation

net/i40e: fix return status for unsupported VF message

PATCH Superseded Alvin Zhang 3 participants 13 messages May 10, 2021 – May 12, 2021 Network drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 net/i40e: fix return status for unsupported VF message

This patch modifies the return status for unsupported VF messages, in order to make it the same as the return status of the kernel driver.

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_pf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +2 -2
index 9804ed4..308da1b 100644
@@ -1464,8 +1464,8 @@
 	 */
 	default:
 		PMD_DRV_LOG(ERR, "%u received, not supported", opcode);
-		i40e_pf_host_send_msg_to_vf(vf, opcode, I40E_ERR_PARAM,
-								NULL, 0);
+		i40e_pf_host_send_msg_to_vf(vf, opcode,
+					    I40E_ERR_NOT_IMPLEMENTED, NULL, 0);
 		break;
 	}
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 net/iavf: fix error logs

Remove some useless logs which are duplicated of the lower-level function logs and may confuse users when running VF without some features supportted by PF.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
Fixes 95f2f0e9fc2a ("net/iavf: improve default RSS")
---
 drivers/net/iavf/iavf_vchnl.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/iavf/iavf_vchnl.c +2 -11
index ca5c56e..dfa7ce3 100644
@@ -1519,11 +1519,8 @@
 	args.out_size = IAVF_AQ_BUF_SZ;
 
 	err = iavf_execute_vf_cmd(adapter, &args);
-	if (err) {
-		PMD_DRV_LOG(ERR,
-			    "Failed to execute command of OP_GET_RSS_HENA_CAPS");
+	if (err)
 		return err;
-	}
 
 	*caps = ((struct virtchnl_rss_hena *)args.out_buffer)->hena;
 	return 0;
@@ -1535,7 +1532,6 @@
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
 	struct virtchnl_rss_hena vrh;
 	struct iavf_cmd_info args;
-	int err;
 
 	vrh.hena = hena;
 	args.ops = VIRTCHNL_OP_SET_RSS_HENA;
@@ -1544,12 +1540,7 @@
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 
-	err = iavf_execute_vf_cmd(adapter, &args);
-	if (err)
-		PMD_DRV_LOG(ERR,
-			    "Failed to execute command of OP_SET_RSS_HENA");
-
-	return err;
+	return iavf_execute_vf_cmd(adapter, &args);
 }
 
 int
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 1/1 net/iavf: fix error logs

Remove some useless logs which are duplicated of the lower-level function logs and may confuse users when running VF without some features that not supported by PF.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
Fixes 95f2f0e9fc2a ("net/iavf: improve default RSS")
---
 drivers/net/iavf/iavf_vchnl.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/iavf/iavf_vchnl.c +2 -11
index ca5c56e..dfa7ce3 100644
@@ -1519,11 +1519,8 @@
 	args.out_size = IAVF_AQ_BUF_SZ;
 
 	err = iavf_execute_vf_cmd(adapter, &args);
-	if (err) {
-		PMD_DRV_LOG(ERR,
-			    "Failed to execute command of OP_GET_RSS_HENA_CAPS");
+	if (err)
 		return err;
-	}
 
 	*caps = ((struct virtchnl_rss_hena *)args.out_buffer)->hena;
 	return 0;
@@ -1535,7 +1532,6 @@
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
 	struct virtchnl_rss_hena vrh;
 	struct iavf_cmd_info args;
-	int err;
 
 	vrh.hena = hena;
 	args.ops = VIRTCHNL_OP_SET_RSS_HENA;
@@ -1544,12 +1540,7 @@
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 
-	err = iavf_execute_vf_cmd(adapter, &args);
-	if (err)
-		PMD_DRV_LOG(ERR,
-			    "Failed to execute command of OP_SET_RSS_HENA");
-
-	return err;
+	return iavf_execute_vf_cmd(adapter, &args);
 }
 
 int
Signature · 1 line
1.8.3.1
#3 lore raw

Re: [dpdk-dev] [PATCH] net/iavf: fix error logs

In reply to Alvin Zhang
Quoted 26 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Alvin Zhang
Sent: Monday, May 10, 2021 8:21 PM
To: Xing, Beilei <[email protected]>; Xu, Ting <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>
Subject: [dpdk-dev] [PATCH] net/iavf: fix error logs

Remove some useless logs which are duplicated of the lower-level function logs and may confuse users when running VF without some features supportted by PF.

Fixes 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
Fixes 95f2f0e9fc2a ("net/iavf: improve default RSS")
---
 drivers/net/iavf/iavf_vchnl.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/iavf/iavf_vchnl.c index renamed from drivers/net/iavf/iavf_vchnl.c +0 -0

ca5c56e..dfa7ce3 100644

drivers/net/iavf/iavf_vchnl.c line 1522

Quoted 7 lines
drivers/net/iavf/iavf_vchnl.c +0 -3
@@ -1519,11 +1519,8 @@
 	args.out_size = IAVF_AQ_BUF_SZ;
 
 	err = iavf_execute_vf_cmd(adapter, &args);
-	if (err) {
-		PMD_DRV_LOG(ERR,
-			    "Failed to execute command of
 OP_GET_RSS_HENA_CAPS");

I don't think we should remove these logs, it help us to understand which command virtchnl failed.

Quoted 15 lines
drivers/net/iavf/iavf_vchnl.c +1 -1
+	if (err)
 		return err;
-	}
 
 	*caps = ((struct virtchnl_rss_hena *)args.out_buffer)->hena;
drivers/net/iavf/iavf_vchnl.c +0 -1
 	return 0;
@@ -1535,7 +1532,6 @@
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
 	struct virtchnl_rss_hena vrh;
 	struct iavf_cmd_info args;
-	int err;
 
 	vrh.hena = hena;
 	args.ops = VIRTCHNL_OP_SET_RSS_HENA;

drivers/net/iavf/iavf_vchnl.c line 1550

Quoted 7 lines
drivers/net/iavf/iavf_vchnl.c +0 -4
@@ -1544,12 +1540,7 @@
 	args.out_buffer = vf->aq_resp;
 	args.out_size = IAVF_AQ_BUF_SZ;
 
-	err = iavf_execute_vf_cmd(adapter, &args);
-	if (err)
-		PMD_DRV_LOG(ERR,
-			    "Failed to execute command of OP_SET_RSS_HENA");

Same as above.

Quoted 8 lines
drivers/net/iavf/iavf_vchnl.c +1 -3
-
-	return err;
+	return iavf_execute_vf_cmd(adapter, &args);
 }
 
 int
--

1.8.3.1

#4 lore raw

PATCH 1/1 net/i40e: fix VF RSS configuration

In reply to Alvin Zhang

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages.

Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF message")
---
 drivers/net/i40e/i40e_pf.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/net/i40e/i40e_pf.c +58 -0
index 9804ed4..b18dc84 100644
@@ -29,6 +29,28 @@
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
+/* Supported RSS offloads */
+#define I40E_DEFAULT_RSS_HENA ( \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
+#define I40E_DEFAULT_RSS_HENA_EXPANDED (I40E_DEFAULT_RSS_HENA | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
+
 static int
 i40e_pf_host_switch_queues(struct i40e_pf_vf *vf,
 			   struct virtchnl_queue_select *qsel,
@@ -1288,6 +1310,36 @@
 				(u8 *)vfres, sizeof(*vfres));
 }
 
+static int
+i40e_pf_host_process_cmd_get_rss_hena(struct i40e_pf_vf *vf)
+{
+	struct virtchnl_rss_hena vrh = {0};
+	struct i40e_pf *pf = vf->pf;
+
+	if (pf->adapter->hw.mac.type == I40E_MAC_X722)
+		vrh.hena = I40E_DEFAULT_RSS_HENA_EXPANDED;
+	else
+		vrh.hena = I40E_DEFAULT_RSS_HENA;
+
+	return i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_RSS_HENA_CAPS,
+					   0, (u8 *)&vrh, sizeof(vrh));
+}
+
+static int
+i40e_pf_host_process_cmd_set_rss_hena(struct i40e_pf_vf *vf, u8 *msg)
+{
+	struct virtchnl_rss_hena *vrh =
+		(struct virtchnl_rss_hena *)msg;
+	struct i40e_hw *hw = &vf->pf->adapter->hw;
+
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_idx), (u32)vrh->hena);
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_idx),
+			  (u32)(vrh->hena >> 32));
+
+	return i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_SET_RSS_HENA,
+					   0, NULL, 0);
+}
+
 void
 i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 			   uint16_t abs_vf_id, uint32_t opcode,
@@ -1458,6 +1510,12 @@
 		PMD_DRV_LOG(INFO, "OP_REQUEST_QUEUES received");
 		i40e_pf_host_process_cmd_request_queues(vf, msg);
 		break;
+	case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
+		ret = i40e_pf_host_process_cmd_get_rss_hena(vf);
+		break;
+	case VIRTCHNL_OP_SET_RSS_HENA:
+		ret = i40e_pf_host_process_cmd_set_rss_hena(vf, msg);
+		break;
 
 	/* Don't add command supported below, which will
 	 * return an error code.
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [dpdk-dev] [PATCH] net/i40e: fix VF RSS configuration

Quoted 73 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Wednesday, May 12, 2021 1:48 PM
To: Xing, Beilei <[email protected]>; Xu, Ting <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH] net/i40e: fix VF RSS configuration

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages.

Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF message")
---
 drivers/net/i40e/i40e_pf.c | 58
++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/net/i40e/i40e_pf.c index renamed from drivers/net/i40e/i40e_pf.c +0 -0

9804ed4..b18dc84 100644

drivers/net/i40e/i40e_pf.c +22 -0
@@ -29,6 +29,28 @@
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
+/* Supported RSS offloads */
+#define I40E_DEFAULT_RSS_HENA ( \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
+#define I40E_DEFAULT_RSS_HENA_EXPANDED (I40E_DEFAULT_RSS_HENA |
 \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
+
 static int
 i40e_pf_host_switch_queues(struct i40e_pf_vf *vf,
drivers/net/i40e/i40e_pf.c +12 -0
 			   struct virtchnl_queue_select *qsel, @@ -1288,6
+1310,36 @@
 				(u8 *)vfres, sizeof(*vfres));
 }
 
+static int
+i40e_pf_host_process_cmd_get_rss_hena(struct i40e_pf_vf *vf) {
+	struct virtchnl_rss_hena vrh = {0};
+	struct i40e_pf *pf = vf->pf;
+
+	if (pf->adapter->hw.mac.type == I40E_MAC_X722)
+		vrh.hena = I40E_DEFAULT_RSS_HENA_EXPANDED;
+	else
+		vrh.hena = I40E_DEFAULT_RSS_HENA;
+
+	return i40e_pf_host_send_msg_to_vf(vf,

VIRTCHNL_OP_GET_RSS_HENA_CAPS,

drivers/net/i40e/i40e_pf.c line 1325

Quoted 1 line
drivers/net/i40e/i40e_pf.c +1 -0
+					   0, (u8 *)&vrh, sizeof(vrh));

Use uint8_t in PMD.

drivers/net/i40e/i40e_pf.c

Quoted 4 lines
drivers/net/i40e/i40e_pf.c +4 -0
+}
+
+static int
+i40e_pf_host_process_cmd_set_rss_hena(struct i40e_pf_vf *vf, u8 *msg) {

Same above. And please check below.

Quoted 32 lines
drivers/net/i40e/i40e_pf.c +5 -0
+	struct virtchnl_rss_hena *vrh =
+		(struct virtchnl_rss_hena *)msg;
+	struct i40e_hw *hw = &vf->pf->adapter->hw;
+
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_idx), (u32)vrh-
Quoted 1 line

hena);

drivers/net/i40e/i40e_pf.c +4 -0
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_idx),
+			  (u32)(vrh->hena >> 32));
+
+	return i40e_pf_host_send_msg_to_vf(vf,

VIRTCHNL_OP_SET_RSS_HENA,

drivers/net/i40e/i40e_pf.c +10 -1
+					   0, NULL, 0);
+}
+
 void
 i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 			   uint16_t abs_vf_id, uint32_t opcode, @@ -1458,6
+1510,12 @@
 		PMD_DRV_LOG(INFO, "OP_REQUEST_QUEUES received");
 		i40e_pf_host_process_cmd_request_queues(vf, msg);
 		break;
+	case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
+		ret = i40e_pf_host_process_cmd_get_rss_hena(vf);
+		break;
+	case VIRTCHNL_OP_SET_RSS_HENA:
+		ret = i40e_pf_host_process_cmd_set_rss_hena(vf, msg);
+		break;
 
 	/* Don't add command supported below, which will
 	 * return an error code.
--

1.8.3.1

#6 lore raw

PATCH v2 1/1 net/i40e: fix VF RSS configuration

In reply to Alvin Zhang

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages.

Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF message")

---

v2: Update codes according to comments.

---
 drivers/net/i40e/i40e_pf.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/net/i40e/i40e_pf.c +58 -0
index 9804ed4..f51654d 100644
@@ -29,6 +29,28 @@
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
+/* Supported RSS offloads */
+#define I40E_DEFAULT_RSS_HENA ( \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
+#define I40E_DEFAULT_RSS_HENA_EXPANDED (I40E_DEFAULT_RSS_HENA | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
+
 static int
 i40e_pf_host_switch_queues(struct i40e_pf_vf *vf,
 			   struct virtchnl_queue_select *qsel,
@@ -1288,6 +1310,36 @@
 				(u8 *)vfres, sizeof(*vfres));
 }
 
+static int
+i40e_pf_host_process_cmd_get_rss_hena(struct i40e_pf_vf *vf)
+{
+	struct virtchnl_rss_hena vrh = {0};
+	struct i40e_pf *pf = vf->pf;
+
+	if (pf->adapter->hw.mac.type == I40E_MAC_X722)
+		vrh.hena = I40E_DEFAULT_RSS_HENA_EXPANDED;
+	else
+		vrh.hena = I40E_DEFAULT_RSS_HENA;
+
+	return i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_RSS_HENA_CAPS,
+					   0, (uint8_t *)&vrh, sizeof(vrh));
+}
+
+static int
+i40e_pf_host_process_cmd_set_rss_hena(struct i40e_pf_vf *vf, uint8_t *msg)
+{
+	struct virtchnl_rss_hena *vrh =
+		(struct virtchnl_rss_hena *)msg;
+	struct i40e_hw *hw = &vf->pf->adapter->hw;
+
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_idx), (u32)vrh->hena);
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_idx),
+			  (u32)(vrh->hena >> 32));
+
+	return i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_SET_RSS_HENA,
+					   0, NULL, 0);
+}
+
 void
 i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 			   uint16_t abs_vf_id, uint32_t opcode,
@@ -1458,6 +1510,12 @@
 		PMD_DRV_LOG(INFO, "OP_REQUEST_QUEUES received");
 		i40e_pf_host_process_cmd_request_queues(vf, msg);
 		break;
+	case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
+		ret = i40e_pf_host_process_cmd_get_rss_hena(vf);
+		break;
+	case VIRTCHNL_OP_SET_RSS_HENA:
+		ret = i40e_pf_host_process_cmd_set_rss_hena(vf, msg);
+		break;
 
 	/* Don't add command supported below, which will
 	 * return an error code.
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v3 1/1 net/i40e: fix VF RSS configuration

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages.

Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF message")

---

v2, v3: Update codes according to comments.

---
 drivers/net/i40e/i40e_pf.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
drivers/net/i40e/i40e_pf.c +59 -0
index 9804ed4..2e7a8ee 100644
@@ -29,6 +29,28 @@
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
+/* Supported RSS offloads */
+#define I40E_DEFAULT_RSS_HENA ( \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
+#define I40E_DEFAULT_RSS_HENA_EXPANDED (I40E_DEFAULT_RSS_HENA | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
+
 static int
 i40e_pf_host_switch_queues(struct i40e_pf_vf *vf,
 			   struct virtchnl_queue_select *qsel,
@@ -1288,6 +1310,37 @@
 				(u8 *)vfres, sizeof(*vfres));
 }
 
+static int
+i40e_pf_host_process_cmd_get_rss_hena(struct i40e_pf_vf *vf)
+{
+	struct virtchnl_rss_hena vrh = {0};
+	struct i40e_pf *pf = vf->pf;
+
+	if (pf->adapter->hw.mac.type == I40E_MAC_X722)
+		vrh.hena = I40E_DEFAULT_RSS_HENA_EXPANDED;
+	else
+		vrh.hena = I40E_DEFAULT_RSS_HENA;
+
+	return i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_RSS_HENA_CAPS,
+					   0, (uint8_t *)&vrh, sizeof(vrh));
+}
+
+static int
+i40e_pf_host_process_cmd_set_rss_hena(struct i40e_pf_vf *vf, uint8_t *msg)
+{
+	struct virtchnl_rss_hena *vrh =
+		(struct virtchnl_rss_hena *)msg;
+	struct i40e_hw *hw = &vf->pf->adapter->hw;
+
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_idx),
+			  (uint32_t)vrh->hena);
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_idx),
+			  (uint32_t)(vrh->hena >> 32));
+
+	return i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_SET_RSS_HENA,
+					   0, NULL, 0);
+}
+
 void
 i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 			   uint16_t abs_vf_id, uint32_t opcode,
@@ -1458,6 +1511,12 @@
 		PMD_DRV_LOG(INFO, "OP_REQUEST_QUEUES received");
 		i40e_pf_host_process_cmd_request_queues(vf, msg);
 		break;
+	case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
+		ret = i40e_pf_host_process_cmd_get_rss_hena(vf);
+		break;
+	case VIRTCHNL_OP_SET_RSS_HENA:
+		ret = i40e_pf_host_process_cmd_set_rss_hena(vf, msg);
+		break;
 
 	/* Don't add command supported below, which will
 	 * return an error code.
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v4 1/1 net/i40e: fix VF RSS configuration

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages.

Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF message")

---

v2, v3, v4: Update codes according to comments.

---
 drivers/net/i40e/i40e_pf.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
drivers/net/i40e/i40e_pf.c +61 -0
index 9804ed4..e2d8b2b 100644
@@ -29,6 +29,28 @@
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
+/* Supported RSS offloads */
+#define I40E_DEFAULT_RSS_HENA ( \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
+#define I40E_DEFAULT_RSS_HENA_EXPANDED (I40E_DEFAULT_RSS_HENA | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
+	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))
+
 static int
 i40e_pf_host_switch_queues(struct i40e_pf_vf *vf,
 			   struct virtchnl_queue_select *qsel,
@@ -1288,6 +1310,37 @@
 				(u8 *)vfres, sizeof(*vfres));
 }
 
+static void
+i40e_pf_host_process_cmd_get_rss_hena(struct i40e_pf_vf *vf)
+{
+	struct virtchnl_rss_hena vrh = {0};
+	struct i40e_pf *pf = vf->pf;
+
+	if (pf->adapter->hw.mac.type == I40E_MAC_X722)
+		vrh.hena = I40E_DEFAULT_RSS_HENA_EXPANDED;
+	else
+		vrh.hena = I40E_DEFAULT_RSS_HENA;
+
+	i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_RSS_HENA_CAPS,
+				    I40E_SUCCESS, (uint8_t *)&vrh, sizeof(vrh));
+}
+
+static void
+i40e_pf_host_process_cmd_set_rss_hena(struct i40e_pf_vf *vf, uint8_t *msg)
+{
+	struct virtchnl_rss_hena *vrh =
+		(struct virtchnl_rss_hena *)msg;
+	struct i40e_hw *hw = &vf->pf->adapter->hw;
+
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_idx),
+			  (uint32_t)vrh->hena);
+	i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_idx),
+			  (uint32_t)(vrh->hena >> 32));
+
+	i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_SET_RSS_HENA,
+				    I40E_SUCCESS, NULL, 0);
+}
+
 void
 i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 			   uint16_t abs_vf_id, uint32_t opcode,
@@ -1458,6 +1511,14 @@
 		PMD_DRV_LOG(INFO, "OP_REQUEST_QUEUES received");
 		i40e_pf_host_process_cmd_request_queues(vf, msg);
 		break;
+	case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
+		PMD_DRV_LOG(INFO, "OP_GET_RSS_HENA_CAPS received");
+		i40e_pf_host_process_cmd_get_rss_hena(vf);
+		break;
+	case VIRTCHNL_OP_SET_RSS_HENA:
+		PMD_DRV_LOG(INFO, "OP_SET_RSS_HENA received");
+		i40e_pf_host_process_cmd_set_rss_hena(vf, msg);
+		break;
 
 	/* Don't add command supported below, which will
 	 * return an error code.
Signature · 1 line
1.8.3.1
Acked-by on v4 1/1
#9 lore raw

Re: [dpdk-dev] [PATCH v4] net/i40e: fix VF RSS configuration

Quoted 10 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Wednesday, May 12, 2021 5:23 PM
To: Xing, Beilei <[email protected]>; Xu, Ting <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v4] net/i40e: fix VF RSS configuration

Quoted 8 lines

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages.

Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF message")
Applied
#10 lore raw

Re: [dpdk-dev] [PATCH v4] net/i40e: fix VF RSS configuration

Quoted 24 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xing, Beilei
Sent: Wednesday, May 12, 2021 5:27 PM
To: Zhang, AlvinX <[email protected]>; Xu, Ting <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v4] net/i40e: fix VF RSS configuration

Quoted 10 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Wednesday, May 12, 2021 5:23 PM
To: Xing, Beilei <[email protected]>; Xu, Ting <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v4] net/i40e: fix VF RSS configuration

The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA",

this

Quoted 2 lines

patch adds PMD support for these messages.

Quoted 8 lines
Quoted 5 lines
Fixes b81295c474b0 ("net/i40e: add user callback for VF to PF

message")
Cc: [email protected]

Applied to dpdk-next-net-intel.

Thanks
Qi

#11 lore raw

PATCH 2/3 common/iavf: fix V-channel status

In reply to Alvin Zhang

Add VIRTCHNL_STATUS_ERR_NOT_IMPLEMENTED to enum virtchnl_status_code.

Fixes e5b2a9e957e7 ("net/avf/base: add base code for avf PMD")
---
 drivers/common/iavf/virtchnl.h | 1 +
 1 file changed, 1 insertion(+)
drivers/common/iavf/virtchnl.h +1 -0
index 3a60faf..0558c99 100644
@@ -47,6 +47,7 @@ enum virtchnl_status_code {
 	VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR		= -39,
 	VIRTCHNL_STATUS_ERR_INVALID_VF_ID		= -40,
 	VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR		= -53,
+	VIRTCHNL_STATUS_ERR_NOT_IMPLEMENTED		= -60,
 	VIRTCHNL_STATUS_ERR_NOT_SUPPORTED		= -64,
 };
 
Signature · 1 line
1.8.3.1
#12 lore raw

PATCH 3/3 net/iavf: fix V-channel status

In reply to Alvin Zhang

Add support of VIRTCHNL_STATUS_ERR_NOT_IMPLEMENTED for facilitating compatibility with PF.

Chang the error log-level from ERROR to WARNING when a V-channel message is not supported by PF, because the VF may still be able to run without certain features which not supported by PF.

Fixes 0c35eecfe8b5 ("net/iavf: fix VF to PF command failure handling")
---
 drivers/net/iavf/iavf_vchnl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_vchnl.c +4 -2
index 5d57e8b..ca5c56e 100644
@@ -234,8 +234,10 @@
 			_clear_cmd(vf);
 			err = -EIO;
 		} else if (vf->cmd_retval ==
-			   VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
-			PMD_DRV_LOG(ERR, "Cmd %d not supported", args->ops);
+			   VIRTCHNL_STATUS_ERR_NOT_SUPPORTED ||
+			   vf->cmd_retval ==
+			   VIRTCHNL_STATUS_ERR_NOT_IMPLEMENTED) {
+			PMD_DRV_LOG(WARNING, "Cmd %d not supported", args->ops);
 			err = -ENOTSUP;
 		} else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
 			PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
Signature · 1 line
1.8.3.1