From 7235cd206e9f768cbbc46ca0a41bdc3e9cf60cfa Mon Sep 17 00:00:00 2001 From: David Marchand Date: Thu, 25 Apr 2019 17:22:09 +0200 Subject: [PATCH] netdev-dpdk: Avoid reconfiguration on VIRTIO_NET_F_MQ changes. At the moment, a malicious guest might negotiate VIRTIO_NET_F_MQ and !VIRTIO_NET_F_MQ in a loop which would be seen as qp_num going from 1 to n and n to 1 continuously, triggering datapath reconfigurations at each transition. Limit this by only reconfiguring on increased qp_num. The previous patch reduced the observed cost of polling disabled queues, so the only cost is memory. Co-authored-by: Ilya Maximets Signed-off-by: Ilya Maximets Signed-off-by: David Marchand Acked-by: Kevin Traynor Signed-off-by: Ian Stokes --- lib/netdev-dpdk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 73262acfc9d..b7f45438f7e 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3512,8 +3512,8 @@ new_device(int vid) newnode = dev->socket_id; } - if (dev->requested_n_txq != qp_num - || dev->requested_n_rxq != qp_num + if (dev->requested_n_txq < qp_num + || dev->requested_n_rxq < qp_num || dev->requested_socket_id != newnode) { dev->requested_socket_id = newnode; dev->requested_n_rxq = qp_num;