Skip to content

Commit

Permalink
sfc: Match calls to netif_napi_add() and netif_napi_del()
Browse files Browse the repository at this point in the history
sfc could call netif_napi_add() multiple times for the same
napi_struct, corrupting the list of napi_structs for the associated
device and leading to a busy-loop on device removal.  Move the call to
netif_napi_add() and add a call to netif_napi_del() in the obvious
places.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Apr 15, 2009
1 parent 2690f8d commit 718cff1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,6 @@ static void efx_init_channels(struct efx_nic *efx)

WARN_ON(channel->rx_pkt != NULL);
efx_rx_strategy(channel);

netif_napi_add(channel->napi_dev, &channel->napi_str,
efx_poll, napi_weight);
}
}

Expand Down Expand Up @@ -1321,6 +1318,8 @@ static int efx_init_napi(struct efx_nic *efx)

efx_for_each_channel(channel, efx) {
channel->napi_dev = efx->net_dev;
netif_napi_add(channel->napi_dev, &channel->napi_str,
efx_poll, napi_weight);
}
return 0;
}
Expand All @@ -1330,6 +1329,8 @@ static void efx_fini_napi(struct efx_nic *efx)
struct efx_channel *channel;

efx_for_each_channel(channel, efx) {
if (channel->napi_dev)
netif_napi_del(&channel->napi_str);
channel->napi_dev = NULL;
}
}
Expand Down

0 comments on commit 718cff1

Please sign in to comment.