fix napi return value
Subsystems (4)
cover fix napi return value
Since d75b1ade567ffab ("net: less interrupt masking in NAPI") we should return budget for napi repoll.
In enic, we return 0 when busy_poll is happening. Fix this by returning budget.
Looks like bnx2x needs this fix as well. On bnx2x I performed compile test only. I do not have hardware.
Govindarajulu Varadarajan (2):
enic: fix rx napi poll return value
bnx2x: fix napi poll return value for repoll
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 4 ++-- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.2.2
PATCH 1/2 enic: fix rx napi poll return value
With the commit d75b1ade567ffab ("net: less interrupt masking in NAPI") napi repoll is done only when work_done == budget. When we are in busy_poll we return 0 in napi_poll. We should return budget.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cisco/enic/enic_main.c +1 -1
@@ -1335,7 +1335,7 @@ static int enic_poll_msix_rq(struct napi_struct *napi, int budget)int err;if (!enic_poll_lock_napi (&enic->rq[rq])) -return work_done; +return budget;/* Service RQ */
Signature · 1 line
2.2.2
PATCH 2/2 bnx2x: fix napi poll return value for repoll
In reply to Govindarajulu VaradarajanWith the commit d75b1ade567ffab ("net: less interrupt masking in NAPI") napi repoll is done only when work_done == budget. When in busy_poll is we return 0 in napi_poll. We should return budget. Also do not return workdone > budget.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +2 -2
@@ -3175,7 +3175,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) }#endif if (!bnx2x_fp_lock_napi (fp)) -return work_done; +return budget;for_each_cos_in_tx_queue (fp, cos)if (bnx2x_tx_queue_has_work (fp->txdata_ptr[cos]))
@@ -3187,7 +3187,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)/* must not complete if we consumed full budget */ if (work_done >= budget) {bnx2x_fp_unlock_napi (fp); -break ; +return budget; } }
Signature · 1 line
2.2.2
Re: [PATCH net 2/2] bnx2x: fix napi poll return value for repoll
Quoted 4 lines · Govindarajulu Varadarajan
With the commit
d75b1ade567ffab("net: less interrupt masking in NAPI") napi repoll is done only whenwork_done== budget. When inbusy_pollis we return 0 innapi_poll. We should return budget. Also do not return workdone > budget.
I am not sure.
Quoted 10 lines
Signed-off-by Govindarajulu Varadarajan <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +0
-0
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static int bnx2x_poll(struct napi_struct *napi, int budget) · line 3178
Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1
-1@@ -3175,7 +3175,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) }#endif if (!bnx2x_fp_lock_napi (fp)) -return work_done; +return budget;
For this one I am not sure.
Busy poll is not supposed to drain the whole queue.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static int bnx2x_poll(struct napi_struct *napi, int budget) · line 3190
Quoted 9 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1
-1for_each_cos_in_tx_queue (fp, cos)if (bnx2x_tx_queue_has_work (fp->txdata_ptr[cos]))@@ -3187,7 +3187,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)/* must not complete if we consumed full budget */ if (work_done >= budget) {bnx2x_fp_unlock_napi (fp); -break ; +return budget;
This one looks fine.
Quoted 3 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +0
-0} }
Re: [PATCH net 2/2] bnx2x: fix napi poll return value for repoll
Quoted 11 lines · Eric Dumazet
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static int bnx2x_poll(struct napi_struct *napi, int budget) · line 3190
Quoted 9 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1
-1for_each_cos_in_tx_queue (fp, cos)if (bnx2x_tx_queue_has_work (fp->txdata_ptr[cos]))@@ -3187,7 +3187,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)/* must not complete if we consumed full budget */ if (work_done >= budget) {bnx2x_fp_unlock_napi (fp); -break ; +return budget;This one looks fine.
But its not necessary, as here budget == work_done.
(work_done > budget) would be a bug from bnx2x_rx_int()
Re: [PATCH net 2/2] bnx2x: fix napi poll return value for repoll
In reply to Eric DumazetQuoted 8 lines · Eric Dumazet
Quoted 4 lines · Govindarajulu Varadarajan
With the commit
d75b1ade567ffab("net: less interrupt masking in NAPI") napi repoll is done only whenwork_done== budget. When inbusy_pollis we return 0 innapi_poll. We should return budget. Also do not return workdone > budget.I am not sure.
This is based on f41281d02f8b94e136f78cb1b6a5d78182c222bd & 9dfa9a27b620640322588df399eb8f624b48d877
I do not know about bnx2x, but in enic driver, when busy_poll is enables rq clean is not happening. This is because, in napi_poll() when work_done < budget, we do not repoll. At this point, enic has disables rq intr and has not called napi_complete. Driver assumes that napi will repoll. Which does not happen.
Lot of drivers I have checked return full budget if they want to repoll. eg. mlx4_en_poll_rx_cq()
Re: [PATCH net 2/2] bnx2x: fix napi poll return value for repoll
In reply to Eric DumazetQuoted 14 lines · Eric Dumazet
Quoted 11 lines · Eric Dumazet
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static int bnx2x_poll(struct napi_struct *napi, int budget) · line 3190
Quoted 9 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1
-1for_each_cos_in_tx_queue (fp, cos)if (bnx2x_tx_queue_has_work (fp->txdata_ptr[cos]))@@ -3187,7 +3187,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)/* must not complete if we consumed full budget */ if (work_done >= budget) {bnx2x_fp_unlock_napi (fp); -break ; +return budget;This one looks fine.
Quoted 4 lines
But its not necessary, as here budget ==
work_done.(
work_done> budget) would be a bug frombnx2x_rx_int()
Yes, I missed that one. This change here is not needed.
Thanks
Re: [PATCH net 2/2] bnx2x: fix napi poll return value for repoll
In reply to Govindarajulu VaradarajanQuoted 14 lines · Govindarajulu Varadarajan
Quoted 8 lines · Eric Dumazet
Quoted 4 lines · Govindarajulu Varadarajan
With the commit
d75b1ade567ffab("net: less interrupt masking in NAPI") napi repoll is done only whenwork_done== budget. When inbusy_pollis we return 0 innapi_poll. We should return budget. Also do not return workdone > budget.I am not sure.
This is based on
f41281d02f8b94e136f78cb1b6a5d78182c222bd&9dfa9a27b620640322588df399eb8f624b48d877
Quoted 8 lines
I do not know about bnx2x, but in enic driver, when
busy_pollis enables rq clean is not happening. This is because, innapi_poll()whenwork_done< budget, we do not repoll. At this point, enic has disables rq intr and has not callednapi_complete. Driver assumes that napi will repoll. Which does not happen.Lot of drivers I have checked return full budget if they want to repoll. eg.
mlx4_en_poll_rx_cq()
I was referring to the "workdone > budget" condition.
But yes, the fix about busy poll seems needed.
Re: [PATCH net 1/2] enic: fix rx napi poll return value
In reply to Govindarajulu VaradarajanFrom: Govindarajulu Varadarajan <[email protected]>
Date: Tue, 20 Jan 2015 18:46:15 +0530
Quoted 5 lines
With the commit
d75b1ade567ffab("net: less interrupt masking in NAPI") napi repoll is done only whenwork_done== budget. When we are inbusy_pollwe return 0 innapi_poll. We should return budget.Signed-off-by Govindarajulu Varadarajan <[email protected]>
Applied.
David Miller
maintainerRe: [PATCH net 2/2] bnx2x: fix napi poll return value for repoll
In reply to Govindarajulu VaradarajanFrom: Govindarajulu Varadarajan <[email protected]>
Date: Tue, 20 Jan 2015 18:46:16 +0530
Quoted 5 lines
With the commit
d75b1ade567ffab("net: less interrupt masking in NAPI") napi repoll is done only whenwork_done== budget. When inbusy_pollis we return 0 innapi_poll. We should return budget. Also do not return workdone > budget.Signed-off-by Govindarajulu Varadarajan <[email protected]>
This seems like it needs some adjustments, please make those corrections and respin this patch.
Thanks.