linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Matthew Cover <matthew.cover@stackpath.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.19 13/42] tuntap: fix multiqueue rx
Date: Wed, 21 Nov 2018 20:05:49 +0100	[thread overview]
Message-ID: <20181121183148.543350632@linuxfoundation.org> (raw)
In-Reply-To: <20181121183147.869199006@linuxfoundation.org>

4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Matthew Cover <werekraken@gmail.com>

[ Upstream commit 8ebebcba559a1bfbaec7bbda64feb9870b9c58da ]

When writing packets to a descriptor associated with a combined queue, the
packets should end up on that queue.

Before this change all packets written to any descriptor associated with a
tap interface end up on rx-0, even when the descriptor is associated with a
different queue.

The rx traffic can be generated by either of the following.
  1. a simple tap program which spins up multiple queues and writes packets
     to each of the file descriptors
  2. tx from a qemu vm with a tap multiqueue netdev

The queue for rx traffic can be observed by either of the following (done
on the hypervisor in the qemu case).
  1. a simple netmap program which opens and reads from per-queue
     descriptors
  2. configuring RPS and doing per-cpu captures with rxtxcpu

Alternatively, if you printk() the return value of skb_get_rx_queue() just
before each instance of netif_receive_skb() in tun.c, you will get 65535
for every skb.

Calling skb_record_rx_queue() to set the rx queue to the queue_index fixes
the association between descriptor and rx queue.

Signed-off-by: Matthew Cover <matthew.cover@stackpath.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/tun.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1527,6 +1527,7 @@ static void tun_rx_batched(struct tun_st
 
 	if (!rx_batched || (!more && skb_queue_empty(queue))) {
 		local_bh_disable();
+		skb_record_rx_queue(skb, tfile->queue_index);
 		netif_receive_skb(skb);
 		local_bh_enable();
 		return;
@@ -1546,8 +1547,11 @@ static void tun_rx_batched(struct tun_st
 		struct sk_buff *nskb;
 
 		local_bh_disable();
-		while ((nskb = __skb_dequeue(&process_queue)))
+		while ((nskb = __skb_dequeue(&process_queue))) {
+			skb_record_rx_queue(nskb, tfile->queue_index);
 			netif_receive_skb(nskb);
+		}
+		skb_record_rx_queue(skb, tfile->queue_index);
 		netif_receive_skb(skb);
 		local_bh_enable();
 	}



  parent reply	other threads:[~2018-11-21 19:08 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 19:05 [PATCH 4.19 00/42] 4.19.4-stable review Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 01/42] flow_dissector: do not dissect l4 ports for fragments Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 02/42] ibmvnic: fix accelerated VLAN handling Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 03/42] ip_tunnel: dont force DF when MTU is locked Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 04/42] ipv6: fix a dst leak when removing its exception Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 05/42] ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 06/42] net: bcmgenet: protect stop from timeout Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 07/42] net-gro: reset skb->pkt_type in napi_reuse_skb() Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 08/42] sctp: not allow to set asoc prsctp_enable by sockopt Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 09/42] tcp: Fix SOF_TIMESTAMPING_RX_HARDWARE to use the latest timestamp during TCP coalescing Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 10/42] tg3: Add PHY reset for 5717/5719/5720 in change ring and flow control paths Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 11/42] tipc: dont assume linear buffer when reading ancillary data Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 12/42] tipc: fix lockdep warning when reinitilaizing sockets Greg Kroah-Hartman
2018-11-21 19:05 ` Greg Kroah-Hartman [this message]
2018-11-21 19:05 ` [PATCH 4.19 14/42] net: systemport: Protect stop from timeout Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 15/42] net/sched: act_pedit: fix memory leak when IDR allocation fails Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 16/42] net: sched: cls_flower: validate nested enc_opts_policy to avoid warning Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 17/42] tipc: fix link re-establish failure Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 18/42] net/mlx5e: Dont match on vlan non-existence if ethertype is wildcarded Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 19/42] net/mlx5e: Claim TC hw offloads support only under a proper build config Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 20/42] net/mlx5e: Adjust to max number of channles when re-attaching Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 21/42] net/mlx5e: RX, verify received packet size in Linear Striding RQ Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 22/42] Revert "sctp: remove sctp_transport_pmtu_check" Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 23/42] net/mlx5e: Always use the match level enum when parsing TC rule match Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 24/42] net/mlx5e: Fix selftest for small MTUs Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 25/42] net/mlx5e: Removed unnecessary warnings in FEC caps query Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 26/42] inet: frags: better deal with smp races Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 27/42] l2tp: fix a sock refcnt leak in l2tp_tunnel_register Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 28/42] net/mlx5: IPSec, Fix the SA context hash key Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 29/42] net/mlx5e: IPoIB, Reset QP after channels are closed Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 30/42] net: dsa: mv88e6xxx: Fix clearing of stats counters Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 31/42] net: phy: realtek: fix RTL8201F sysfs name Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 32/42] sctp: define SCTP_SS_DEFAULT for Stream schedulers Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 33/42] net: qualcomm: rmnet: Fix incorrect assignment of real_dev Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 34/42] net: dsa: microchip: initialize mutex before use Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 35/42] sctp: fix strchange_flags name for Stream Change Event Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 36/42] net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 37/42] sctp: not increase streams incnt before sending addstrm_in request Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 38/42] mlxsw: spectrum: Fix IP2ME CPU policer configuration Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 39/42] net: smsc95xx: Fix MTU range Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 40/42] rxrpc: Fix lockup due to no error backoff after ack transmit error Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 41/42] usbnet: smsc95xx: disable carrier check while suspending Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 42/42] Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation" Greg Kroah-Hartman
2018-11-22  5:26 ` [PATCH 4.19 00/42] 4.19.4-stable review kernelci.org bot
2018-11-22  7:15 ` Harsh Shandilya
2018-11-22  8:24   ` Greg Kroah-Hartman
2018-11-22 16:36 ` Guenter Roeck
2018-11-23  7:16   ` Greg Kroah-Hartman
2018-11-22 20:53 ` Thomas Voegtle
2018-11-22 22:01   ` Thomas Voegtle
2018-11-22 22:30     ` Guenter Roeck
2018-11-23  6:52       ` Greg Kroah-Hartman
2018-11-23  7:45       ` Greg Kroah-Hartman
2018-11-23 12:06         ` Guenter Roeck
2018-11-23  6:51   ` Greg Kroah-Hartman
2018-11-23 15:40     ` Thomas Voegtle
2018-11-23 15:44       ` David Laight
2018-11-23  8:13 ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181121183148.543350632@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.cover@stackpath.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).