Commit ec20f36b authored by Dwip N. Banerjee's avatar Dwip N. Banerjee Committed by Jakub Kicinski

ibmvnic: Correctly re-enable interrupts in NAPI polling routine

If the current NAPI polling loop exits without completing it's
budget, only re-enable interrupts if there are no entries remaining
in the queue and napi_complete_done is successful. If there are entries
remaining on the queue that were missed, restart the polling loop.
Signed-off-by: default avatarDwip N. Banerjee <dnbanerg@us.ibm.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9a87c3fc
...@@ -2450,10 +2450,17 @@ static void remove_buff_from_pool(struct ibmvnic_adapter *adapter, ...@@ -2450,10 +2450,17 @@ static void remove_buff_from_pool(struct ibmvnic_adapter *adapter,
static int ibmvnic_poll(struct napi_struct *napi, int budget) static int ibmvnic_poll(struct napi_struct *napi, int budget)
{ {
struct net_device *netdev = napi->dev; struct ibmvnic_sub_crq_queue *rx_scrq;
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter;
int scrq_num = (int)(napi - adapter->napi); struct net_device *netdev;
int frames_processed = 0; int frames_processed;
int scrq_num;
netdev = napi->dev;
adapter = netdev_priv(netdev);
scrq_num = (int)(napi - adapter->napi);
frames_processed = 0;
rx_scrq = adapter->rx_scrq[scrq_num];
restart_poll: restart_poll:
while (frames_processed < budget) { while (frames_processed < budget) {
...@@ -2466,14 +2473,14 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget) ...@@ -2466,14 +2473,14 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
if (unlikely(test_bit(0, &adapter->resetting) && if (unlikely(test_bit(0, &adapter->resetting) &&
adapter->reset_reason != VNIC_RESET_NON_FATAL)) { adapter->reset_reason != VNIC_RESET_NON_FATAL)) {
enable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]); enable_scrq_irq(adapter, rx_scrq);
napi_complete_done(napi, frames_processed); napi_complete_done(napi, frames_processed);
return frames_processed; return frames_processed;
} }
if (!pending_scrq(adapter, adapter->rx_scrq[scrq_num])) if (!pending_scrq(adapter, rx_scrq))
break; break;
next = ibmvnic_next_scrq(adapter, adapter->rx_scrq[scrq_num]); next = ibmvnic_next_scrq(adapter, rx_scrq);
rx_buff = rx_buff =
(struct ibmvnic_rx_buff *)be64_to_cpu(next-> (struct ibmvnic_rx_buff *)be64_to_cpu(next->
rx_comp.correlator); rx_comp.correlator);
...@@ -2532,14 +2539,16 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget) ...@@ -2532,14 +2539,16 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
if (adapter->state != VNIC_CLOSING) if (adapter->state != VNIC_CLOSING)
replenish_rx_pool(adapter, &adapter->rx_pool[scrq_num]); replenish_rx_pool(adapter, &adapter->rx_pool[scrq_num]);
if (frames_processed < budget) { if (frames_processed < budget) {
enable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]); if (napi_complete_done(napi, frames_processed)) {
napi_complete_done(napi, frames_processed); enable_scrq_irq(adapter, rx_scrq);
if (pending_scrq(adapter, adapter->rx_scrq[scrq_num]) && if (pending_scrq(adapter, rx_scrq)) {
napi_reschedule(napi)) { rmb();
disable_scrq_irq(adapter, adapter->rx_scrq[scrq_num]); if (napi_reschedule(napi)) {
goto restart_poll; disable_scrq_irq(adapter, rx_scrq);
goto restart_poll;
}
}
} }
} }
return frames_processed; return frames_processed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment