unsigned int ifindex;
};
struct napi_struct napi;
+ bool napi_enabled;
struct mutex napi_mutex; /* Protects access to the above napi */
struct list_head next;
struct tun_struct *detached;
static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile,
bool napi_en)
{
+ tfile->napi_enabled = napi_en;
if (napi_en) {
netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll,
NAPI_POLL_WEIGHT);
static void tun_napi_disable(struct tun_struct *tun, struct tun_file *tfile)
{
- if (tun->flags & IFF_NAPI)
+ if (tfile->napi_enabled)
napi_disable(&tfile->napi);
}
static void tun_napi_del(struct tun_struct *tun, struct tun_file *tfile)
{
- if (tun->flags & IFF_NAPI)
+ if (tfile->napi_enabled)
netif_napi_del(&tfile->napi);
}
rcu_read_lock();
for (i = 0; i < tun->numqueues; i++) {
tfile = rcu_dereference(tun->tfiles[i]);
- napi_schedule(&tfile->napi);
+ if (tfile->napi_enabled)
+ napi_schedule(&tfile->napi);
}
rcu_read_unlock();
}
napi_gro_frags(&tfile->napi);
local_bh_enable();
mutex_unlock(&tfile->napi_mutex);
- } else if (tun->flags & IFF_NAPI) {
+ } else if (tfile->napi_enabled) {
struct sk_buff_head *queue = &tfile->sk.sk_write_queue;
int queue_len;