From patchwork Thu Nov 2 23:34:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 833584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RjEdySKk"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yShJS6zL2z9sPm for ; Fri, 3 Nov 2017 10:34:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5236C8940F; Thu, 2 Nov 2017 23:34:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zA9HZrjfhkzQ; Thu, 2 Nov 2017 23:34:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 3041F890DC; Thu, 2 Nov 2017 23:34:44 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 264F41C2306 for ; Thu, 2 Nov 2017 23:34:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1D4E888139 for ; Thu, 2 Nov 2017 23:34:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aUpxtIkVRvSP for ; Thu, 2 Nov 2017 23:34:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8E4B082BEA for ; Thu, 2 Nov 2017 23:34:42 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id p87so855423pfj.3 for ; Thu, 02 Nov 2017 16:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=ejmPs4d6WGksKqGaSvVZvzQ4R2XgnE32rVqWT/NiCTA=; b=RjEdySKk9u2SrTdOBE4hweiNT5LTvf/dbv6PMVXzZZXG1gXJLz0V0hWG59jtZh/EFs mW6GkOFBd3qWG6n73ul0m1qvz4fhGffshAl3b9hn1R+BQEy3fg1O3z2Aufl6kEpDNlSh oo1nipCDqB9HsHRNmMwig1xeS+obB4KkX2jPiPqQg9/Dbvw1ozmEoPEBX1NIbcK1eGcD wfqISVnsNc5X7a1ZRaj4J3NzoIhfruyNcFwysbgZxnW0bbxw9uyobPOQi3tZJ2Shdb1E fdk6HIjPZX/oUg/L59yOrzZWcpPFTQ9jEMuC+WaG0HAtFdolbenc2iEH07zbfnwwsNsJ fYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=ejmPs4d6WGksKqGaSvVZvzQ4R2XgnE32rVqWT/NiCTA=; b=IZLW8RuGFxDtnA8OAXaovDb0R+rOUMfw97/x+DWRVFSZjbrFoNGxxPXsjemqJlg6D3 BNepztmjjWoiAgBebw0S8Npo8nEOmFBy0MDUfoaphPrmAxcwop5UQ9nChJ73S6YOqzOA oTqgZKFlC0fVCiFdSqZ1ylULXPSFk5juEmHiqY+5RRFFDhoBzgjS0e4+Kup1jGkmK4r6 Om6S+oh37WViIKOQGgUeTGL2vWb0jrSS0/fej+NPw2KIZde0FSyVtOTqlyH+m/dOFn5l IlbmaEwy53SamiJyIHu1SEZ0rO0YjLQQ9HrA12YN3Yv2zi2Q1n7xJ4zsoIiw5V+2Cf1Q en+A== X-Gm-Message-State: AMCzsaUqJxWu75hxmMo0ADeqy8ahCCVUxz/K1aUPd7qO1hrHFOPusWtg NdQwp2Xzm2B39BWCOjqNCx9XY2O4 X-Google-Smtp-Source: ABhQp+QQ01eccjlFow0I0mLeKGS+UkmzkE9PbIRGcH52BsXpVql+zOBLGxFlOX6zrdYe7+fHGPN3yg== X-Received: by 10.84.215.207 with SMTP id g15mr4941034plj.11.1509665681979; Thu, 02 Nov 2017 16:34:41 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id m1sm7667336pfk.54.2017.11.02.16.34.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 16:34:41 -0700 (PDT) From: Alexander Duyck To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 02 Nov 2017 16:34:41 -0700 Message-ID: <20171102233417.15146.6991.stgit@localhost.localdomain> In-Reply-To: <20171102232857.15146.21583.stgit@localhost.localdomain> References: <20171102232857.15146.21583.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [jkirsher/next-queue PATCH 4/5] dev: Clean-up __skb_tx_hash to match up with traffic class based configs X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck This patch is mostly just a minor clean-up so that we avoid letting a packet jump from one traffic class to another just based on the Rx queue. Instead we now use that queue number as an offset within the traffic class. Handling it this way allows us to operate more cleanly in a mixed environment that is doing routing over multiple interfaces that may not have the same queue configuration. This patch includes a minor clean-up of variable declaration as well to get things into the reverse xmas tree format. Signed-off-by: Alexander Duyck --- net/core/dev.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 24ac9083bc13..fd51b8703277 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2573,16 +2573,9 @@ void netif_device_attach(struct net_device *dev) u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb, unsigned int num_tx_queues) { - u32 hash; - u16 qoffset = 0; u16 qcount = num_tx_queues; - - if (skb_rx_queue_recorded(skb)) { - hash = skb_get_rx_queue(skb); - while (unlikely(hash >= num_tx_queues)) - hash -= num_tx_queues; - return hash; - } + u16 qoffset = 0; + u32 hash; if (dev->num_tc) { u8 tc = netdev_get_prio_tc_map(dev, skb->priority); @@ -2591,6 +2584,13 @@ u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb, qcount = dev->tc_to_txq[tc].count; } + if (skb_rx_queue_recorded(skb)) { + hash = skb_get_rx_queue(skb); + while (unlikely(hash >= qcount)) + hash -= qcount; + return hash + qoffset; + } + return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset; } EXPORT_SYMBOL(__skb_tx_hash);