Skip to contentSkip to conversation

fm10k: napi polling routine must return actual work done

PATCH New Jacob Keller 3 participants 8 messages Jun 20, 2016 – Aug 30, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fm10k: napi polling routine must return actual work done

When fm10k_poll fully cleans rings it returns 0. This is incorrect as it messes up the budget accounting in the core napi code. Fix this by returning actual work done, capped at budget - 1 since the core doesn't expect a return of the full budget when the driver modifies the napi status.

Cc Paolo Abeni <[email protected]>
Cc Venkatesh Srinivas <[email protected]>
Cc Alexander Duyck <[email protected]>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +1 -1
index 682a372bdb20..79d5093d83d1 100644
@@ -1484,7 +1484,7 @@ static int fm10k_poll(struct napi_struct *napi, int budget)
 	/* re-enable the q_vector */
 	fm10k_qv_enable(q_vector);
 
-	return 0;
+	return min(work_done, budget - 1);
 }
 
 /**
Signature · 1 line
2.9.0.rc1.405.g81f467e
#1 lore raw

PATCH 2/2 fm10k: return smaller of actual work done or budget in fm10k_poll

Correct a slight issue with fm10k_poll returning the full budget even if it didn't fully exhaust it. This occurs if a single ring exhausts its per-ring portion of the budget but the other rings do not. Return the actual amount we used capped at budget to avoid issues with napi core.

Change-Id: Ie84de029a62adcfa8af49ccb2dc0b4d9f378ee71
Cc: Paolo Abeni <[email protected]>
Cc: Venkatesh Srinivas <[email protected]>
Cc: Alexander Duyck <[email protected]>

---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +2 -2
index 79d5093d83d1..c2c7f2ef2152 100644
@@ -1474,9 +1474,9 @@ static int fm10k_poll(struct napi_struct *napi, int budget)
 			clean_complete = false;
 	}
 
-	/* If all work not completed, return budget and keep polling */
+	/* If all work not completed, return work done and keep polling */
 	if (!clean_complete)
-		return budget;
+		return min(work_done, budget);
 
 	/* all work done, exit the polling mode */
 	napi_complete_done(napi, work_done);
Signature · 1 line
2.9.0.rc1.405.g81f467e
#2 lore raw

PATCH 2/2 fm10k: return smaller of actual work done or budget in fm10k_poll

Quoted 29 lines

-----Original Message-----
From: Keller, Jacob E
Sent: Monday, June 20, 2016 10:40 AM
To: Intel Wired LAN <[email protected]>
Cc: Keller, Jacob E <[email protected]>; Paolo Abeni <[email protected]>; Venkatesh Srinivas <[email protected]>; Alexander Duyck <[email protected]>
Subject: [PATCH 2/2] fm10k: return smaller of actual work done or budget in fm10k_poll

Correct a slight issue with fm10k_poll returning the full budget even if it didn't fully exhaust it. This occurs if a single ring exhausts its per-ring portion of the budget but the other rings do not. Return the actual amount we used capped at budget to avoid issues with napi core.

Change-Id: Ie84de029a62adcfa8af49ccb2dc0b4d9f378ee71
Cc: Paolo Abeni <[email protected]>
Cc: Venkatesh Srinivas <[email protected]>
Cc: Alexander Duyck <[email protected]>

---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
index 79d5093d83d1..c2c7f2ef2152 100644

drivers/net/ethernet/intel/fm10k/fm10k_main.c static int fm10k_poll(struct napi_struct *napi, int · line 1481

Quoted 10 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +2 -2
@@ -1474,9 +1474,9 @@ static int fm10k_poll(struct napi_struct *napi, int
 budget)
 			clean_complete = false;
 	}
 
-	/* If all work not completed, return budget and keep polling */
+	/* If all work not completed, return work done and keep polling */
 	if (!clean_complete)
-		return budget;
+		return min(work_done, budget);
 

This patch potentially appears to be caused Tx hangs in the napi routines in the stack, when under heavy traffic pressure. It appears that other drivers (i40e, and ixgbe) don't do this either, so I am not sure which is correct...

Quoted 4 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
 	/* all work done, exit the polling mode */

napi_complete_done(napi, work_done);
--
2.9.0.rc1.405.g81f467e

#3 lore raw

PATCH 2/2 fm10k: return smaller of actual work done or budget in fm10k_poll

Quoted 46 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Keller, Jacob E
Sent: Wednesday, August 10, 2016 12:49 PM
To: Intel Wired LAN <[email protected]>; Duyck, Alexander H <[email protected]>
Cc: Paolo Abeni <[email protected]>; Venkatesh Srinivas <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH 2/2] fm10k: return smaller of actual work done or budget in fm10k_poll

Quoted 8 lines

-----Original Message-----
From: Keller, Jacob E
Sent: Monday, June 20, 2016 10:40 AM
To: Intel Wired LAN <[email protected]>
Cc: Keller, Jacob E <[email protected]>; Paolo Abeni <[email protected]>; Venkatesh Srinivas <[email protected]>; Alexander Duyck <[email protected]>
Subject: [PATCH 2/2] fm10k: return smaller of actual work done or budget

in

drivers/net/ethernet/intel/fm10k/fm10k_main.c static int fm10k_poll(struct napi_struct *napi,

Quoted 21 lines

fm10k_poll

Correct a slight issue with fm10k_poll returning the full budget even if it didn't fully exhaust it. This occurs if a single ring exhausts its per-ring portion of the budget but the other rings do not. Return the actual amount we used capped at budget to avoid issues with napi core.

Change-Id: Ie84de029a62adcfa8af49ccb2dc0b4d9f378ee71
Cc: Paolo Abeni <[email protected]>
Cc: Venkatesh Srinivas <[email protected]>
Cc: Alexander Duyck <[email protected]>

---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
index 79d5093d83d1..c2c7f2ef2152 100644
@@ -1474,9 +1474,9 @@ static int fm10k_poll(struct napi_struct *napi,

int

Quoted 4 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
 budget)
 			clean_complete = false;
 	}
 
Quoted 11 lines

drivers/net/ethernet/intel/fm10k/fm10k_main.c static int fm10k_poll(struct napi_struct *napi, int budget) · line 1480

Quoted 6 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +2 -2
-	/* If all work not completed, return budget and keep polling */
+	/* If all work not completed, return work done and keep polling */
 	if (!clean_complete)
-		return budget;
+		return min(work_done, budget);
 

This patch potentially appears to be caused Tx hangs in the napi routines in the stack, when under heavy traffic pressure. It appears that other drivers (i40e, and ixgbe) don't do this either, so I am not sure which is correct...

This patch causes false Tx hangs due to potentially returning 0 when work_done is 0 but the Tx rings aren't clean. After some discussion with Alex I believe that the patch is just wrong and should be dropped. Jeff, can you drop this patch from the queue? The other related patch is actually correct and should remain.

Thanks,
Jake

maintainer
#4 lore raw

PATCH 1/2 fm10k: napi polling routine must return actual work done

In reply to Jacob Keller
Quoted 6 lines · Jacob Keller

When fm10k_poll fully cleans rings it returns 0. This is incorrect as it messes up the budget accounting in the core napi code. Fix this by returning actual work done, capped at budget - 1 since the core doesn't expect a return of the full budget when the driver modifies the napi status.

Quoted 7 lines
Cc Paolo Abeni <[email protected]>
Cc Venkatesh Srinivas <[email protected]>
Cc Alexander Duyck <[email protected]>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#5 lore raw

PATCH 1/2 fm10k: napi polling routine must return actual work done

In reply to Jacob Keller
Quoted 32 lines

-----Original Message-----
From: Keller, Jacob E
Sent: Monday, June 20, 2016 10:40 AM
To: Intel Wired LAN <[email protected]>
Cc: Keller, Jacob E <[email protected]>; Paolo Abeni <[email protected]>; Venkatesh Srinivas <[email protected]>; Alexander Duyck <[email protected]>
Subject: [PATCH 1/2] fm10k: napi polling routine must return actual work done

When fm10k_poll fully cleans rings it returns 0. This is incorrect as it messes up the budget accounting in the core napi code. Fix this by returning actual work done, capped at budget - 1 since the core doesn't expect a return of the full budget when the driver modifies the napi status.

Cc Paolo Abeni <[email protected]>
Cc Venkatesh Srinivas <[email protected]>
Cc Alexander Duyck <[email protected]>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
index 682a372bdb20..79d5093d83d1 100644

drivers/net/ethernet/intel/fm10k/fm10k_main.c static int fm10k_poll(struct napi_struct *napi, int · line 1488

Quoted 6 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +1 -1
@@ -1484,7 +1484,7 @@ static int fm10k_poll(struct napi_struct *napi, int
 budget)
 	/* re-enable the q_vector */
 	fm10k_qv_enable(q_vector);
 
-	return 0;
+	return min(work_done, budget - 1);

This patch potentially appears to be caused Tx hangs in the napi routines in the stack, when under heavy traffic pressure. It appears that other drivers (i40e, and ixgbe) don't do this either, so I am not sure which is correct...

Quoted 5 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
 }
 

/**
--
2.9.0.rc1.405.g81f467e

#6 lore raw

PATCH 1/2 fm10k: napi polling routine must return actual work done

Quoted 50 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Keller, Jacob E
Sent: Wednesday, August 10, 2016 12:50 PM
To: Intel Wired LAN <[email protected]>; Duyck, Alexander H <[email protected]>
Cc: Paolo Abeni <[email protected]>; Venkatesh Srinivas <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH 1/2] fm10k: napi polling routine must return actual work done

drivers/net/ethernet/intel/fm10k/fm10k_main.c static int fm10k_poll(struct napi_struct *napi,

Quoted 30 lines

-----Original Message-----
From: Keller, Jacob E
Sent: Monday, June 20, 2016 10:40 AM
To: Intel Wired LAN <[email protected]>
Cc: Keller, Jacob E <[email protected]>; Paolo Abeni <[email protected]>; Venkatesh Srinivas <[email protected]>; Alexander Duyck <[email protected]>
Subject: [PATCH 1/2] fm10k: napi polling routine must return actual work done

When fm10k_poll fully cleans rings it returns 0. This is incorrect as it messes up the budget accounting in the core napi code. Fix this by returning actual work done, capped at budget - 1 since the core doesn't expect a return of the full budget when the driver modifies the napi status.

Cc Paolo Abeni <[email protected]>
Cc Venkatesh Srinivas <[email protected]>
Cc Alexander Duyck <[email protected]>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
index 682a372bdb20..79d5093d83d1 100644
@@ -1484,7 +1484,7 @@ static int fm10k_poll(struct napi_struct *napi,

int

Quoted 4 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +0 -0
 budget)
 	/* re-enable the q_vector */
 	fm10k_qv_enable(q_vector);
 
Quoted 8 lines

drivers/net/ethernet/intel/fm10k/fm10k_main.c static int fm10k_poll(struct napi_struct *napi, int budget) · line 1487

Quoted 2 lines
drivers/net/ethernet/intel/fm10k/fm10k_main.c +1 -1
-	return 0;
+	return min(work_done, budget - 1);

This patch potentially appears to be caused Tx hangs in the napi routines in the stack, when under heavy traffic pressure. It appears that other drivers (i40e, and ixgbe) don't do this either, so I am not sure which is correct...

This patch is fine and should remain.

Thanks,
Jake

#7 lore raw

PATCH 1/2 fm10k: napi polling routine must return actual work done

In reply to Jacob Keller

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Monday, June 20, 2016 10:40 AM
To: Intel Wired LAN <[email protected]>
Cc: Paolo Abeni <[email protected]>; Alexander Duyck <[email protected]>; Venkatesh Srinivas <[email protected]>
Subject: [Intel-wired-lan] [PATCH 1/2] fm10k: napi polling routine must return actual work done

When fm10k_poll fully cleans rings it returns 0. This is incorrect as it messes up the budget accounting in the core napi code. Fix this by returning actual work done, capped at budget - 1 since the core doesn't expect a return of the full budget when the driver modifies the napi status.

Cc Paolo Abeni <[email protected]>
Cc Venkatesh Srinivas <[email protected]>
Cc Alexander Duyck <[email protected]>

---