Skip to contentSkip to conversation

net/ixgbevf: fix stats update after a PF reset

PATCH In review Thierry Herbelot 3 participants 4 messages Sep 11, 2019 – Sep 30, 2019 1 message not in the archive Network drivers

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 net/ixgbevf: fix stats update after a PF reset

In reply to a message not in the archive

From: Guo Fengtian <[email protected]>

When PF is set down, in VF, the value of stats register is zero. So only increase stats when it's non zero.

Fixes af75078fece3 ('first public release')
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +4 -2
index 7eb3d0567b58..27c540f60563 100644
@@ -385,7 +385,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
 #define UPDATE_VF_STAT(reg, last, cur)                          \
 {                                                               \
 	uint32_t latest = IXGBE_READ_REG(hw, reg);              \
-	cur += (latest - last) & UINT_MAX;                      \
+	if (latest)                                             \
+		cur += (latest - last) & UINT_MAX;              \
 	last = latest;                                          \
 }
 
@@ -394,7 +395,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
 	u64 new_lsb = IXGBE_READ_REG(hw, lsb);                   \
 	u64 new_msb = IXGBE_READ_REG(hw, msb);                   \
 	u64 latest = ((new_msb << 32) | new_lsb);                \
-	cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
+	if (latest)                                              \
+		cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL;\
 	last = latest;                                           \
 }
 
Signature · 1 line
2.20.1
#2 lore raw
Quoted 33 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thierry Herbelot
Sent: Thursday, September 12, 2019 12:01 AM
To: [email protected]
Cc: Guo Fengtian <[email protected]>; Thomas Monjalon <[email protected]>; [email protected]; Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH 1/1] net/ixgbevf: fix stats update after a PF reset

From: Guo Fengtian <[email protected]>

When PF is set down, in VF, the value of stats register is zero. So only increase stats when it's non zero.

Fixes af75078fece3 ('first public release')
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index 7eb3d0567b58..27c540f60563 100644

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbe_l2_tunnel_conf(struct rte_eth_dev · line 390

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
@@ -385,7 +385,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev
 *dev);
 #define UPDATE_VF_STAT(reg, last, cur)                          \
 {                                                               \
 	uint32_t latest = IXGBE_READ_REG(hw, reg);              \
-	cur += (latest - last) & UINT_MAX;                      \
+	if (latest)                                             \
+		cur += (latest - last) & UINT_MAX;              \

There is still a chance that PF is up but the latest reg read returns 0, since it's a cyclic counter, is any way to check the PF status directly?

Quoted 16 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
 	last = latest;                                          \
 }
@@ -394,7 +395,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev
 *dev);
 	u64 new_lsb = IXGBE_READ_REG(hw, lsb);                   \
 	u64 new_msb = IXGBE_READ_REG(hw, msb);                   \
 	u64 latest = ((new_msb << 32) | new_lsb);                \
-	cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
+	if (latest)                                              \
+		cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL;\
 	last = latest;                                           \
 }
 
--

2.20.1

#3 lore raw

Hi, Thierry & Fengtian

Any update about this patch according to Qi's comment?

Thanks,
Xiaolong

Quoted 60 lines · Qi Z
Quoted 33 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thierry Herbelot
Sent: Thursday, September 12, 2019 12:01 AM
To: [email protected]
Cc: Guo Fengtian <[email protected]>; Thomas Monjalon <[email protected]>; [email protected]; Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH 1/1] net/ixgbevf: fix stats update after a PF reset

From: Guo Fengtian <[email protected]>

When PF is set down, in VF, the value of stats register is zero. So only increase stats when it's non zero.

Fixes af75078fece3 ('first public release')
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index 7eb3d0567b58..27c540f60563 100644

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbe_l2_tunnel_conf(struct rte_eth_dev · line 390

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
@@ -385,7 +385,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev
 *dev);
 #define UPDATE_VF_STAT(reg, last, cur)                          \
 {                                                               \
 	uint32_t latest = IXGBE_READ_REG(hw, reg);              \
-	cur += (latest - last) & UINT_MAX;                      \
+	if (latest)                                             \
+		cur += (latest - last) & UINT_MAX;              \

There is still a chance that PF is up but the latest reg read returns 0, since it's a cyclic counter, is any way to check the PF status directly?

Quoted 16 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
 	last = latest;                                          \
 }
@@ -394,7 +395,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev
 *dev);
 	u64 new_lsb = IXGBE_READ_REG(hw, lsb);                   \
 	u64 new_msb = IXGBE_READ_REG(hw, msb);                   \
 	u64 latest = ((new_msb << 32) | new_lsb);                \
-	cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
+	if (latest)                                              \
+		cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL;\
 	last = latest;                                           \
 }
 
--

2.20.1

#4 lore raw
Quoted 3 lines · Ye Xiaolong

Hi, Thierry & Fengtian

Any update about this patch according to Qi's comment?

Hello, Xiaolong

I agreee with Qi's comment: this patch solves one issue, but causes another problem.

I am completely open to any suggestion about how to retrieve the PF status from the VF device.

Regards

Thierry

Quoted 65 lines

Thanks,
Xiaolong

Quoted 60 lines · Qi Z
Quoted 33 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thierry Herbelot
Sent: Thursday, September 12, 2019 12:01 AM
To: [email protected]
Cc: Guo Fengtian <[email protected]>; Thomas Monjalon <[email protected]>; [email protected]; Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [dpdk-dev] [PATCH 1/1] net/ixgbevf: fix stats update after a PF reset

From: Guo Fengtian <[email protected]>

When PF is set down, in VF, the value of stats register is zero. So only increase stats when it's non zero.

Fixes af75078fece3 ('first public release')
---
  drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index 7eb3d0567b58..27c540f60563 100644

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbe_l2_tunnel_conf(struct rte_eth_dev · line 390

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
@@ -385,7 +385,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev
 *dev);
  #define UPDATE_VF_STAT(reg, last, cur)                          \
  {                                                               \
  	uint32_t latest = IXGBE_READ_REG(hw, reg);              \
-	cur += (latest - last) & UINT_MAX;                      \
+	if (latest)                                             \
+		cur += (latest - last) & UINT_MAX;              \

There is still a chance that PF is up but the latest reg read returns 0, since it's a cyclic counter, is any way to check the PF status directly?

Quoted 16 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
  	last = latest;                                          \
  }
@@ -394,7 +395,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev
 *dev);
  	u64 new_lsb = IXGBE_READ_REG(hw, lsb);                   \
  	u64 new_msb = IXGBE_READ_REG(hw, msb);                   \
  	u64 latest = ((new_msb << 32) | new_lsb);                \
-	cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
+	if (latest)                                              \
+		cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL;\
  	last = latest;                                           \
  }
 
--

2.20.1

Signature · 13 lines
Thierry Herbelot
6WIND
Senior Software Engineer

Tel: +33 1 39 30 92 61
Fax: +33 1 39 30 92 11
[email protected]
www.6wind.com
Immeuble Central Gare - Bât C 1, place Charles de Gaulle 78180 Montigny-le-Bretonneux, France

Ce courriel ainsi que toutes les pièces jointes, est uniquement destiné à son ou ses destinataires. Il contient des informations confidentielles qui sont la propriété de 6WIND. Toute révélation, distribution ou copie des informations qu'il contient est strictement interdite. Si vous avez reçu ce message par erreur, veuillez immédiatement le signaler à l'émetteur et détruire toutes les données reçues

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to 6WIND. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.