diff mbox

[net] netxen: fix netxen_nic_poll() logic

Message ID 1421942178.3471.10.camel@edumazet-glaptop2.roam.corp.google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Jan. 22, 2015, 3:56 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

NAPI poll logic now enforces that a poller returns exactly the budget
when it wants to be called again.

If a driver limits TX completion, it has to return budget as well when
the limit is hit, not the number of received packets.

Reported-and-tested-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")
Cc: Manish Chopra <manish.chopra@qlogic.com>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Manish Chopra Jan. 23, 2015, 10:59 a.m. UTC | #1
> -----Original Message-----

> From: Eric Dumazet [mailto:eric.dumazet@gmail.com]

> Sent: Thursday, January 22, 2015 9:26 PM

> To: Mike Galbraith; David Miller

> Cc: netdev; Manish Chopra

> Subject: [PATCH net] netxen: fix netxen_nic_poll() logic

> 

> From: Eric Dumazet <edumazet@google.com>

> 

> NAPI poll logic now enforces that a poller returns exactly the budget when it

> wants to be called again.

> 

> If a driver limits TX completion, it has to return budget as well when the limit is

> hit, not the number of received packets.

> 

> Reported-and-tested-by: Mike Galbraith <umgwanakikbuti@gmail.com>

> Signed-off-by: Eric Dumazet <edumazet@google.com>

> Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")

> Cc: Manish Chopra <manish.chopra@qlogic.com>

> ---

>  drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c |    5 ++++-

>  1 file changed, 4 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

> b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

> index 613037584d08..c531c8ae1be4 100644

> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

> @@ -2388,7 +2388,10 @@ static int netxen_nic_poll(struct napi_struct *napi,

> int budget)

> 

>  	work_done = netxen_process_rcv_ring(sds_ring, budget);

> 

> -	if ((work_done < budget) && tx_complete) {

> +	if (!tx_complete)

> +		work_done = budget;

> +

> +	if (work_done < budget) {

>  		napi_complete(&sds_ring->napi);

>  		if (test_bit(__NX_DEV_UP, &adapter->state))

>  			netxen_nic_enable_int(sds_ring);

> 

Thanks Eric.
Acked-by: Manish Chopra <manish.chopra@qlogic.com>
David Miller Jan. 25, 2015, 8:22 a.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 22 Jan 2015 07:56:18 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> NAPI poll logic now enforces that a poller returns exactly the budget
> when it wants to be called again.
> 
> If a driver limits TX completion, it has to return budget as well when
> the limit is hit, not the number of received packets.
> 
> Reported-and-tested-by: Mike Galbraith <umgwanakikbuti@gmail.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")

Applied and queued up for -stable, thanks Eric.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 613037584d08..c531c8ae1be4 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -2388,7 +2388,10 @@  static int netxen_nic_poll(struct napi_struct *napi, int budget)
 
 	work_done = netxen_process_rcv_ring(sds_ring, budget);
 
-	if ((work_done < budget) && tx_complete) {
+	if (!tx_complete)
+		work_done = budget;
+
+	if (work_done < budget) {
 		napi_complete(&sds_ring->napi);
 		if (test_bit(__NX_DEV_UP, &adapter->state))
 			netxen_nic_enable_int(sds_ring);