Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp83714imu; Wed, 21 Nov 2018 15:50:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wbw8JzeAFBLUH/VO9/HlzFBdrC2Wt1gK/G5qrpvZl45N5+0nizzdjbepVxfoT5UIgNB/1P X-Received: by 2002:a63:65c7:: with SMTP id z190mr3308455pgb.249.1542844214754; Wed, 21 Nov 2018 15:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542844214; cv=none; d=google.com; s=arc-20160816; b=gUKGgMXsPZQ3byAJOTatxzFqmuYvw75fTVMMRc7iWt9CxPc/3HF21K1LZ9ptLCEds5 7pywD17aWaaWgzAjuA93Xh2zni+OTCFqbcm1j3AF98lmS0j4hmNCVrwUPOO0syQXGCGl 7b105t/Wzsf4eF8t1AvIL44lJcNBRQe79asb8DN3LYrxQ9jGF9/5GPuCmBJKhOtY7O7D yWAdQxcUlWhRVggPUBTCWvH5QImIdHL81i6YmpTDK01ti0WiqS1NeLhSsoqDZGaowePX iKxar02cm5XW2SvozHQW9FZtfwzGoe59ogGl7i6s/nlcEfX5TUCmlHwQh9g38gm2AX+H MRZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BnT4Lgpzg3g9Xnx7GOdxD0ud2iFIWtEYaMtdjnC/eYY=; b=UoMcYDRztVrNNf4y6yvjKRisvceTHNxQnsnh/bB8tFlLgQOtJAJ+Et9p8YOD/gRgTb zAWR3KwweQp5WFyUm2IQ3EQ2AaPAOYePbafPkYKoC16k64c9vyIeTbmV5Lh3mnrPaZ0i UTqMaWRfnhzWCrpMA/6eSZ/hTBZs88+7H51b0RJyvA3ETeD+YUJbfsI0aToMc3cALx3s rXvpBPVGuoztvTz3zfItIfbmC2nPVZ8p0uzDLelEsaruyCF3ek2gfDOTWF+2A+goL5KW yrn7IfP67vZ5DwCCqynP77TILTuRMIA8eRrdmBNnwUrb9F1q1g8NvCNJYMSmDlCcjo/j 2qVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qM6+uRfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2-v6si54389165pfb.66.2018.11.21.15.49.52; Wed, 21 Nov 2018 15:50:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qM6+uRfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388147AbeKVFnr (ORCPT + 99 others); Thu, 22 Nov 2018 00:43:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:38608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388124AbeKVFnq (ORCPT ); Thu, 22 Nov 2018 00:43:46 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 424D5214DB; Wed, 21 Nov 2018 19:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542827293; bh=bxHMjfMeEnAIzAoyo4heU2R6cysHkTsmzMpD/d34u7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qM6+uRfpIgHeTOywqkWTbhaHc3AtrWluINN/KEqG3SWUSoDfU7FHXsvBbHX265if2 /T3W70wNaA/ffM6i6YSGdGlwqRb4yOYIQ3pD9eCnhqiEVlmE4qvV14i837C8cKYLWT 3xZySk1vYGFs8ZfjuPofmGMk4m4NJqYarQMwNCNE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Cover , "David S. Miller" Subject: [PATCH 4.19 13/42] tuntap: fix multiqueue rx Date: Wed, 21 Nov 2018 20:05:49 +0100 Message-Id: <20181121183148.543350632@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121183147.869199006@linuxfoundation.org> References: <20181121183147.869199006@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthew Cover [ 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- 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(); }