[SRU][Xenial/gcp][PATCH 9/11] virtio-net: per-queue RPS config

Khalid Elmously khalid.elmously at canonical.com
Thu Sep 19 09:23:51 UTC 2019

From: Willem de Bruijn <willemb at google.com>

BugLink: https://bugs.launchpad.net/bugs/1810457

On multiqueue network devices, RPS maps are configured independently
for each receive queue through /sys/class/net/$DEV/queues/rx-*.

On virtio-net currently all packets use the map from rx-0, because the
real rx queue is not known at time of map lookup by get_rps_cpu.

Call skb_record_rx_queue in the driver rx path to make lookup work.

Recording the receive queue has ramifications beyond RPS, such as in
sticky load balancing decisions for sockets (skb_tx_hash) and XPS.

Reported-by: Mark Hlady <mhlady at google.com>
Signed-off-by: Willem de Bruijn <willemb at google.com>
Acked-by: Jason Wang <jasowang at redhat.com>
Acked-by: Michael S. Tsirkin <mst at redhat.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 133bbb18ab1a2f5549435c5a3126413344ddbcb8)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously at canonical.com>
 drivers/net/virtio_net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index e1b753a334d0..82782d3a2b41 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -895,6 +895,7 @@ static int receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
 		goto frame_err;
+	skb_record_rx_queue(skb, vq2rxq(rq->vq));
 	skb->protocol = eth_type_trans(skb, dev);
 	pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
 		 ntohs(skb->protocol), skb->len, skb->pkt_type);

More information about the kernel-team mailing list