Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93d05d4a authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: provide generic busy polling to all NAPI drivers



NAPI drivers no longer need to observe a particular protocol
to benefit from busy polling (CONFIG_NET_RX_BUSY_POLL=y)

napi_hash_add() and napi_hash_del() are automatically called
from core networking stack, respectively from
netif_napi_add() and netif_napi_del()

This patch depends on free_netdev() and netif_napi_del() being
called from process context, which seems to be the norm.

Drivers might still prefer to call napi_hash_del() on their
own, since they might combine all the rcu grace periods into
a single one, knowing their NAPI structures lifetime, while
core networking stack has no idea of a possible combining.

Once this patch proves to not bring serious regressions,
we will cleanup drivers to either remove napi_hash_del()
or provide appropriate rcu grace periods combining.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 34cbe27e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ static void bnx2x_add_all_napi_cnic(struct bnx2x *bp)
	for_each_rx_queue_cnic(bp, i) {
		netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
			       bnx2x_poll, NAPI_POLL_WEIGHT);
		napi_hash_add(&bnx2x_fp(bp, i, napi));
	}
}

@@ -58,7 +57,6 @@ static void bnx2x_add_all_napi(struct bnx2x *bp)
	for_each_eth_queue(bp, i) {
		netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
			       bnx2x_poll, NAPI_POLL_WEIGHT);
		napi_hash_add(&bnx2x_fp(bp, i, napi));
	}
}

+0 −2
Original line number Diff line number Diff line
@@ -4227,12 +4227,10 @@ static void bnxt_init_napi(struct bnxt *bp)
			bnapi = bp->bnapi[i];
			netif_napi_add(bp->dev, &bnapi->napi,
				       bnxt_poll, 64);
			napi_hash_add(&bnapi->napi);
		}
	} else {
		bnapi = bp->bnapi[0];
		netif_napi_add(bp->dev, &bnapi->napi, bnxt_poll, 64);
		napi_hash_add(&bnapi->napi);
	}
}

+0 −1
Original line number Diff line number Diff line
@@ -2527,7 +2527,6 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
		goto err;

	netif_napi_add(dev, &iq->napi, napi_rx_handler, 64);
	napi_hash_add(&iq->napi);
	iq->cur_desc = iq->desc;
	iq->cidx = 0;
	iq->gen = 1;
+0 −2
Original line number Diff line number Diff line
@@ -2458,13 +2458,11 @@ static int enic_dev_init(struct enic *enic)
	switch (vnic_dev_get_intr_mode(enic->vdev)) {
	default:
		netif_napi_add(netdev, &enic->napi[0], enic_poll, 64);
		napi_hash_add(&enic->napi[0]);
		break;
	case VNIC_DEV_INTR_MODE_MSIX:
		for (i = 0; i < enic->rq_count; i++) {
			netif_napi_add(netdev, &enic->napi[i],
				enic_poll_msix_rq, NAPI_POLL_WEIGHT);
			napi_hash_add(&enic->napi[i]);
		}
		for (i = 0; i < enic->wq_count; i++)
			netif_napi_add(netdev, &enic->napi[enic_cq_wq(enic, i)],
+0 −1
Original line number Diff line number Diff line
@@ -2630,7 +2630,6 @@ static int be_evt_queues_create(struct be_adapter *adapter)
				eqo->affinity_mask);
		netif_napi_add(adapter->netdev, &eqo->napi, be_poll,
			       BE_NAPI_WEIGHT);
		napi_hash_add(&eqo->napi);
	}
	return 0;
}
Loading