Commit f31ec95fa19e07a8beebcc0297284f23aa57967e

Authored by Shahed Shaikh
Committed by David S. Miller
1 parent cf180b8acf

qlcnic: Fix NAPI poll routine for Tx completion

After d75b1ade567f ("net: less interrupt masking in NAPI")
driver's NAPI poll routine is expected to return
exact budget value if it wants to be re-called.

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 24 additions and 3 deletions Side-by-side Diff

drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
... ... @@ -967,7 +967,12 @@
967 967 tx_complete = qlcnic_process_cmd_ring(adapter, tx_ring,
968 968 budget);
969 969 work_done = qlcnic_process_rcv_ring(sds_ring, budget);
970   - if ((work_done < budget) && tx_complete) {
  970 +
  971 + /* Check if we need a repoll */
  972 + if (!tx_complete)
  973 + work_done = budget;
  974 +
  975 + if (work_done < budget) {
971 976 napi_complete(&sds_ring->napi);
972 977 if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
973 978 qlcnic_enable_sds_intr(adapter, sds_ring);
... ... @@ -992,6 +997,9 @@
992 997 napi_complete(&tx_ring->napi);
993 998 if (test_bit(__QLCNIC_DEV_UP, &adapter->state))
994 999 qlcnic_enable_tx_intr(adapter, tx_ring);
  1000 + } else {
  1001 + /* As qlcnic_process_cmd_ring() returned 0, we need a repoll*/
  1002 + work_done = budget;
995 1003 }
996 1004  
997 1005 return work_done;
... ... @@ -1950,7 +1958,12 @@
1950 1958  
1951 1959 tx_complete = qlcnic_process_cmd_ring(adapter, tx_ring, budget);
1952 1960 work_done = qlcnic_83xx_process_rcv_ring(sds_ring, budget);
1953   - if ((work_done < budget) && tx_complete) {
  1961 +
  1962 + /* Check if we need a repoll */
  1963 + if (!tx_complete)
  1964 + work_done = budget;
  1965 +
  1966 + if (work_done < budget) {
1954 1967 napi_complete(&sds_ring->napi);
1955 1968 qlcnic_enable_sds_intr(adapter, sds_ring);
1956 1969 }
... ... @@ -1973,7 +1986,12 @@
1973 1986  
1974 1987 tx_complete = qlcnic_process_cmd_ring(adapter, tx_ring, budget);
1975 1988 work_done = qlcnic_83xx_process_rcv_ring(sds_ring, budget);
1976   - if ((work_done < budget) && tx_complete) {
  1989 +
  1990 + /* Check if we need a repoll */
  1991 + if (!tx_complete)
  1992 + work_done = budget;
  1993 +
  1994 + if (work_done < budget) {
1977 1995 napi_complete(&sds_ring->napi);
1978 1996 qlcnic_enable_sds_intr(adapter, sds_ring);
1979 1997 }
... ... @@ -1995,6 +2013,9 @@
1995 2013 napi_complete(&tx_ring->napi);
1996 2014 if (test_bit(__QLCNIC_DEV_UP , &adapter->state))
1997 2015 qlcnic_enable_tx_intr(adapter, tx_ring);
  2016 + } else {
  2017 + /* need a repoll */
  2018 + work_done = budget;
1998 2019 }
1999 2020  
2000 2021 return work_done;