Skip to contentSkip to conversation

net/ixgbe: do not return internal code in rte_eth_dev_reset

PATCH Superseded Luca Boccassi 3 participants 6 messages Aug 21, 2018 – Sep 5, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ixgbe: do not return internal code in rte_eth_dev_reset

In case of a temporary failure the ixgbe driver can return the internal error IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per the public API specification.

---
 drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_vf.c +6 -1
index 5b25a6b4d4..62f2bf2e7d 100644
@@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
 		usec_delay(5);
 	}
 
+	/*
+	 * This error code will be propagated to the app by rte_eth_dev_reset,
+	 * so use a public error code rather than the internal-only
+	 * IXGBE_ERR_RESET_FAILED
+	 */
 	if (!timeout)
-		return IXGBE_ERR_RESET_FAILED;
+		return -EAGAIN;
 
 	/* Reset VF registers to initial values */
 	ixgbe_virt_clr_reg(hw);
Signature · 1 line
2.18.0
Acked-by on v1 1/1
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Tuesday, August 21, 2018 12:07 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [PATCH] net/ixgbe: do not return internal code in rte_eth_dev_reset

In case of a temporary failure the ixgbe driver can return the internal error IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per the public API specification.

---
 drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_vf.c +6 -2
index 5b25a6b4d4..62f2bf2e7d 100644
@@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
 		usec_delay(5);
 	}
 
+	/*
+	 * This error code will be propagated to the app by rte_eth_dev_reset,
+	 * so use a public error code rather than the internal-only
+	 * IXGBE_ERR_RESET_FAILED
+	 */
 	if (!timeout)
-		return IXGBE_ERR_RESET_FAILED;
+		return -EAGAIN;
 
 	/* Reset VF registers to initial values */
 	ixgbe_virt_clr_reg(hw);
--
Quoted 1 line

2.18.0

#2 lore raw
In reply to Luca Boccassi
Quoted 27 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Luca Boccassi
Sent: Tuesday, August 21, 2018 7:07 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ixgbe: do not return internal code in rte_eth_dev_reset

In case of a temporary failure the ixgbe driver can return the internal error IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per the public API specification.

---
 drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_vf.c +0 -0
index 5b25a6b4d4..62f2bf2e7d 100644
@@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
 		usec_delay(5);

drivers/net/ixgbe/base/ixgbe_vf.c s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw) · line 212

Quoted 10 lines
drivers/net/ixgbe/base/ixgbe_vf.c +6 -1
 	}
 
+	/*
+	 * This error code will be propagated to the app by rte_eth_dev_reset,
+	 * so use a public error code rather than the internal-only
+	 * IXGBE_ERR_RESET_FAILED
+	 */
 	if (!timeout)
-		return IXGBE_ERR_RESET_FAILED;
+		return -EAGAIN;

I think it's better not to change this in base code which are assumed to only return IXGBE_ERR_xxx And also this is not the only place in ixgbe_reset_hw_vf that will propagated the internal error. Why not convert it in "eth_ixgbevf_dev_init" which looks like a right place?

Quoted 5 lines
drivers/net/ixgbe/base/ixgbe_vf.c +0 -1
 	/* Reset VF registers to initial values */
 	ixgbe_virt_clr_reg(hw);
--

2.18.0

#3 lore raw
Quoted 39 lines · Qi Z
Quoted 39 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Luca Boccassi
Sent: Tuesday, August 21, 2018 7:07 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ixgbe: do not return internal code in
rte_eth_dev_reset

In case of a temporary failure the ixgbe driver can return the internal error
IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per
the public API specification.

---
 drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-

 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_vf.c +3 -0
index 5b25a6b4d4..62f2bf2e7d 100644
@@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
  		usec_delay(5);
  	}
 
+	/*
+	 * This error code will be propagated to the app by
 rte_eth_dev_reset,
+	 * so use a public error code rather than the internal-

only

drivers/net/ixgbe/base/ixgbe_vf.c +2 -0
+	 * IXGBE_ERR_RESET_FAILED
+	 */

  if (!timeout)

drivers/net/ixgbe/base/ixgbe_vf.c +0 -1
-		return IXGBE_ERR_RESET_FAILED;
Quoted 8 lines

drivers/net/ixgbe/base/ixgbe_vf.c s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw) · line 212

Quoted 1 line
drivers/net/ixgbe/base/ixgbe_vf.c +1 -0
+		return -EAGAIN;

I think it's better not to change this in base code which are assumed to only return IXGBE_ERR_xxx
And also this is not the only place in ixgbe_reset_hw_vf that will propagated the internal error.
Why not convert it in "eth_ixgbevf_dev_init" which looks like a right place?

Ok, done in v2

Signature · 2 lines
Kind regards,
Luca Boccassi
#4 lore raw

PATCH v2 1/1 net/ixgbe: do not return internal code in rte_eth_dev_reset

In reply to Luca Boccassi

In case of a temporary failure the ixgbe driver can return the internal error IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per the public API specification.

Fixes cddaf87a1ecb ("lib: fix unused values")

---
v2: added fixes and cc: stable
move change to eth_ixgbevf_dev_init from the base code

 drivers/net/ixgbe/ixgbe_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +6 -1
index 26b192737f..eab9e2e7e6 100644
@@ -1619,7 +1619,12 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 	 */
 	if ((diag != IXGBE_SUCCESS) && (diag != IXGBE_ERR_INVALID_MAC_ADDR)) {
 		PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag);
-		return diag;
+		/*
+		 * This error code will be propagated to the app by
+		 * rte_eth_dev_reset, so use a public error code rather than
+		 * the internal-only IXGBE_ERR_RESET_FAILED
+		 */
+		return -EAGAIN;
 	}
 
 	/* negotiate mailbox API version to use with the PF. */
Signature · 1 line
2.18.0
Acked-by on v2 1/1 Applied
#5 lore raw
Quoted 11 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Monday, September 3, 2018 10:18 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v2] net/ixgbe: do not return internal code in rte_eth_dev_reset

Change title to "net/ixgbe: do not return internal code" to avoid check-git-log error.

Quoted 9 lines

In case of a temporary failure the ixgbe driver can return the internal error IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per the public API specification.

Fixes cddaf87a1ecb ("lib: fix unused values")

Applied to dpdk-next-net-intel.

Thanks!
Qi