Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp104482imu; Wed, 21 Nov 2018 16:13:39 -0800 (PST) X-Google-Smtp-Source: AJdET5fTMjPEzPUuCkdrRq57UT0/jSSOJgZVdpSL6KHcN0NLhowYToN72FMDtSt5AJkd773PSKtv X-Received: by 2002:a62:c21c:: with SMTP id l28mr8991272pfg.74.1542845619687; Wed, 21 Nov 2018 16:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542845619; cv=none; d=google.com; s=arc-20160816; b=Ff0JSo1puNgHW6zbSkBFy77sUi2T4TAiMdnawaQ1rm0wnv8mxHpdC9TlekfWah+hA+ HImBJbDWCv1r3i+aiL1h0FX0Eeihp2hXoglSQyb8ixZK9JDrtf+kFpfZKvT3rwZMd+eP 0Hb/8YHUtUQwCZcvgndtwcCO1BX0BxKhjKhXK7/aSp9UpS71h0hxuUYMDR3kb4sDSvUK MD3oFLcLYjNx3uAlgF19AQzswf9GC/92fJ0KCKcLHqxuLYcuoGR+atLwUd1Pbxry322B blugUqK4/VS1oUPecc8WvRl5+INwpRn94XuPxDeq7H03prTxsAp/djDdeDvuQAOUvWjp lPIg== 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=hhw0jFOFthZAEHyNQFiFUo0z6CvXN20WXJmywhbsVck=; b=omEUJ04fD8tsp2258k0XjtJh5fnZgmXLTBLFX0AI1CNe5b9sf/FCURC8+nK7TJScbH XQ/gRYKirTGc2KfU/LMWbauq813lSNDpg8AB8fajQH3cise0F8olzetowxJSg6+Tp2Ju knbqeH4xERkJJJM0kN9392bYOuAk6GO3KaJJztVfsoHOG50wesCJ1VdqV27mKBSTevcM iU/5zMYiJGWZDx7njsSHdVq9qSPCR945PqburLaKY6XuhR7pIH3i0l5Tyrsn4mbSx1es hOn6DO97B6kXCpQ2QB6nU1KvR2tb66o910FqaPsU2ODdhyben8lOcTnP/lCDBeWHWOj/ MZ4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BJPWO8FL; 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 v6si41506520pgv.277.2018.11.21.16.13.24; Wed, 21 Nov 2018 16:13:39 -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=BJPWO8FL; 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 S2388486AbeKVFpK (ORCPT + 99 others); Thu, 22 Nov 2018 00:45:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:39888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730870AbeKVFpJ (ORCPT ); Thu, 22 Nov 2018 00:45:09 -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 46E44206BB; Wed, 21 Nov 2018 19:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542827376; bh=uXUj+zy2akVsMYba+cH4N60tqiNrDzcigXSWHr/qvYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJPWO8FLBLdOpKrTkUsDova85dfIO3hwY4x99otNFU2jmik9ickJHtPK4RrXb0SmE 0YaWHi59dqEoK/Sdn3ZJf0r60EgpOKrztKKl5UuyDlt3RsKA0gNI3P79llD8yr67ez 1AmNQ04VY94+haGMk2FE3jgnT3DRF/Jf1DADcXrc= 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.14 08/21] tuntap: fix multiqueue rx Date: Wed, 21 Nov 2018 20:06:52 +0100 Message-Id: <20181121183422.431534668@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121183422.103826775@linuxfoundation.org> References: <20181121183422.103826775@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.14-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 @@ -1214,6 +1214,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; @@ -1233,8 +1234,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(); }