All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] virtio_net: force_napi_tx module param.
@ 2018-07-23 23:11 Caleb Raitto
  2018-07-24  0:53 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Caleb Raitto @ 2018-07-23 23:11 UTC (permalink / raw)
  To: mst, jasowang, davem, netdev; +Cc: Caleb Raitto

From: Caleb Raitto <caraitto@google.com>

The driver disables tx napi if it's not certain that completions will
be processed affine with tx service.

Its heuristic doesn't account for some scenarios where it is, such as
when the queue pair count matches the core but not hyperthread count.

Allow userspace to override the heuristic. This is an alternative
solution to that in the linked patch. That added more logic in the
kernel for these cases, but the agreement was that this was better left
to user control.

Do not expand the existing napi_tx variable to a ternary value,
because doing so can break user applications that expect
boolean ('Y'/'N') instead of integer output. Add a new param instead.

Link: https://patchwork.ozlabs.org/patch/725249/
Acked-by: Willem de Bruijn <willemb@google.com>
Acked-by: Jon Olson <jonolson@google.com>
Signed-off-by: Caleb Raitto <caraitto@google.com>
---
 drivers/net/virtio_net.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2ff08bc103a9..d9aca4e90d6b 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -39,10 +39,11 @@
 static int napi_weight = NAPI_POLL_WEIGHT;
 module_param(napi_weight, int, 0444);
 
-static bool csum = true, gso = true, napi_tx;
+static bool csum = true, gso = true, napi_tx, force_napi_tx;
 module_param(csum, bool, 0444);
 module_param(gso, bool, 0444);
 module_param(napi_tx, bool, 0644);
+module_param(force_napi_tx, bool, 0644);
 
 /* FIXME: MTU in config. */
 #define GOOD_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
@@ -1201,7 +1202,7 @@ static void virtnet_napi_tx_enable(struct virtnet_info *vi,
 	/* Tx napi touches cachelines on the cpu handling tx interrupts. Only
 	 * enable the feature if this is likely affine with the transmit path.
 	 */
-	if (!vi->affinity_hint_set) {
+	if (!vi->affinity_hint_set && !force_napi_tx) {
 		napi->weight = 0;
 		return;
 	}
@@ -2646,7 +2647,7 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
 		netif_napi_add(vi->dev, &vi->rq[i].napi, virtnet_poll,
 			       napi_weight);
 		netif_tx_napi_add(vi->dev, &vi->sq[i].napi, virtnet_poll_tx,
-				  napi_tx ? napi_weight : 0);
+				  (napi_tx || force_napi_tx) ? napi_weight : 0);
 
 		sg_init_table(vi->rq[i].sg, ARRAY_SIZE(vi->rq[i].sg));
 		ewma_pkt_len_init(&vi->rq[i].mrg_avg_pkt_len);
-- 
2.18.0.233.g985f88cf7e-goog

^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2018-09-10 10:51 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-23 23:11 [PATCH net-next] virtio_net: force_napi_tx module param Caleb Raitto
2018-07-24  0:53 ` Stephen Hemminger
2018-07-24  1:23   ` Willem de Bruijn
2018-07-24 10:42 ` Michael S. Tsirkin
2018-07-24 14:01   ` Willem de Bruijn
2018-07-24 18:38     ` Michael S. Tsirkin
2018-07-24 20:52       ` Willem de Bruijn
2018-07-24 22:23         ` Michael S. Tsirkin
2018-07-24 22:31           ` Willem de Bruijn
2018-07-24 22:46             ` Michael S. Tsirkin
2018-07-25  0:02               ` Willem de Bruijn
2018-07-25  0:17               ` Jon Olson
2018-07-30  6:06                 ` Jason Wang
2018-08-01 22:27                   ` Michael S. Tsirkin
2018-08-28 19:57                   ` Willem de Bruijn
2018-08-29  7:56                     ` Jason Wang
2018-08-29 13:01                       ` Willem de Bruijn
2018-09-09 23:07                         ` Willem de Bruijn
2018-09-10  5:59                           ` Jason Wang
2018-07-29 16:00 ` David Miller
2018-07-29 20:33   ` Michael S. Tsirkin
2018-07-29 20:36     ` David Miller
2018-07-29 21:09     ` Willem de Bruijn
2018-07-29 21:32   ` Willem de Bruijn
2018-07-31 12:34     ` Michael S. Tsirkin
2018-08-01 15:46       ` Willem de Bruijn
2018-08-01 15:56         ` Willem de Bruijn
2018-08-01 22:25         ` Michael S. Tsirkin
2018-08-01 22:43           ` Willem de Bruijn
2018-08-01 22:48             ` Michael S. Tsirkin
2018-08-01 23:33               ` Willem de Bruijn
2018-07-30 19:51   ` Stephen Hemminger
2018-07-31  1:41     ` Jason Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.