net: add netif_tx_napi_add()
netif_tx_napi_add() is a variant of netif_napi_add() It should be used by drivers that use a napi structure to exclusively poll TX. We do not want to add this kind of napi in napi_hash[] in following patches, adding generic busy polling to all NAPI drivers. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
93f93a4404
commit
d64b5e85bf
@@ -326,7 +326,8 @@ enum {
|
||||
NAPI_STATE_SCHED, /* Poll is scheduled */
|
||||
NAPI_STATE_DISABLE, /* Disable pending */
|
||||
NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
|
||||
NAPI_STATE_HASHED, /* In NAPI hash */
|
||||
NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
|
||||
NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
|
||||
};
|
||||
|
||||
enum gro_result {
|
||||
@@ -1938,6 +1939,26 @@ static inline void *netdev_priv(const struct net_device *dev)
|
||||
void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
|
||||
int (*poll)(struct napi_struct *, int), int weight);
|
||||
|
||||
/**
|
||||
* netif_tx_napi_add - initialize a napi context
|
||||
* @dev: network device
|
||||
* @napi: napi context
|
||||
* @poll: polling function
|
||||
* @weight: default weight
|
||||
*
|
||||
* This variant of netif_napi_add() should be used from drivers using NAPI
|
||||
* to exclusively poll a TX queue.
|
||||
* This will avoid we add it into napi_hash[], thus polluting this hash table.
|
||||
*/
|
||||
static inline void netif_tx_napi_add(struct net_device *dev,
|
||||
struct napi_struct *napi,
|
||||
int (*poll)(struct napi_struct *, int),
|
||||
int weight)
|
||||
{
|
||||
set_bit(NAPI_STATE_NO_BUSY_POLL, &napi->state);
|
||||
netif_napi_add(dev, napi, poll, weight);
|
||||
}
|
||||
|
||||
/**
|
||||
* netif_napi_del - remove a napi context
|
||||
* @napi: napi context
|
||||
|
Reference in New Issue
Block a user