Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4825621ybl; Wed, 22 Jan 2020 05:27:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwKOP44Jh9pIWac6ZP/xR1uYJofO+XP3qbrdWaTfeSZI6RdQAz6QbScZg5R/8ZPZZu+Ge02 X-Received: by 2002:a9d:470a:: with SMTP id a10mr7570104otf.370.1579699670894; Wed, 22 Jan 2020 05:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699670; cv=none; d=google.com; s=arc-20160816; b=M8gzhzKE+iLmEWSCYzMtfKzMSAUQc9+DT4U+IFkj458jz3XUy9UU8/5lvI+7Lsu+ER NSlU169TbGBotFiIN5KuM17flfg3H6WxU8O2MCQxFyc8Bj+FUu7xMzHtAxlWV2yTIdnu CwFmBhKGb9bOQB7jTUGYDhPBlhz53OKYWsHnMwkWrsixvCUi0PFJZUy2dYFBmcoxs45e xIxXh2qlAg9f7jLh4ZOJEbP4yIpAS3oIkFk2y3afb7gjj2aGdnS543RhMZHh9hOuYheZ RJ8K7YTE318jKYyg+kh9t+JG8uT3fDiJ1FwYYDRiITokRr+vYaEtshoh4Kmz931crUfv 8OYA== 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=l5tERp2KaoMroe9hrm7Re6g9uAcUgbgviryFlgr53a8=; b=wMC528rtxKiiVRlzVvyaZnM4nKa31u7oABsrSUmw+Lm+7Y/B9wTHdXWFnOsL5cU0Dd VY0/0iKLY+uif+V8Bj8RaLM1N6tFQVIl6EM03CF36m6UU9sD5rDTyN5xi2bypsk55UUs /IgLFunjsDq5d+DKy8ug979+xeylTOSusWy8nGk9IYm74cJSHrwQJBv3Fm+dgxh4a29Q tljQctKg4r9+dg4jBoSLNPzP7/H3dhL4gv0F4lxywzOvZQl3jcXcobkydnzjg3vlavL/ oFtGAuTCIDPzUn4IS3rdLQVApecFCvIoxwDp5mzWh+SbCBH94iqgnkcrZdSAtTMhs8e9 8XkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JOJs8BX8; 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 n8si23540338otr.102.2020.01.22.05.27.35; Wed, 22 Jan 2020 05:27:50 -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=JOJs8BX8; 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 S1731636AbgAVN0f (ORCPT + 99 others); Wed, 22 Jan 2020 08:26:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:47414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729163AbgAVN0e (ORCPT ); Wed, 22 Jan 2020 08:26:34 -0500 Received: from localhost (unknown [84.241.205.26]) (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 2DBDC2467B; Wed, 22 Jan 2020 13:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699594; bh=9F+EXNeal2W7NUa/tq+TFrW6djEOpUYwVzyxkLEmiAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOJs8BX8PMqyVtdGyoJ6KEAfwTMGUXOQl1CY2yJG1LxAQb+63/WqytaHpn5Mjtu+G HFZnnsFDmwbkp+hS9npSJ74pQ/USXM6vQy2tT4DXISFHpVdHVtIR3uElD+kjV9rUfe 6Pvo5s/HpQFyQpYi4JtYex/E1zqQhVRITFcY9/rk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" Subject: [PATCH 5.4 153/222] net: systemport: Fixed queue mapping in internal ring map Date: Wed, 22 Jan 2020 10:28:59 +0100 Message-Id: <20200122092844.677212804@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Florian Fainelli [ Upstream commit 5a9ef19454cd5daec8041bc7c3c11deb7456d9a0 ] We would not be transmitting using the correct SYSTEMPORT transmit queue during ndo_select_queue() which looks up the internal TX ring map because while establishing the mapping we would be off by 4, so for instance, when we populate switch port mappings we would be doing: switch port 0, queue 0 -> ring index #0 switch port 0, queue 1 -> ring index #1 ... switch port 0, queue 3 -> ring index #3 switch port 1, queue 0 -> ring index #8 (4 + 4 * 1) ... instead of using ring index #4. This would cause our ndo_select_queue() to use the fallback queue mechanism which would pick up an incorrect ring for that switch port. Fix this by using the correct switch queue number instead of SYSTEMPORT queue number. Fixes: 25c440704661 ("net: systemport: Simplify queue mapping logic") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bcmsysport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2323,7 +2323,7 @@ static int bcm_sysport_map_queues(struct ring->switch_queue = qp; ring->switch_port = port; ring->inspect = true; - priv->ring_map[q + port * num_tx_queues] = ring; + priv->ring_map[qp + port * num_tx_queues] = ring; qp++; } @@ -2338,7 +2338,7 @@ static int bcm_sysport_unmap_queues(stru struct net_device *slave_dev; unsigned int num_tx_queues; struct net_device *dev; - unsigned int q, port; + unsigned int q, qp, port; priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier); if (priv->netdev != info->master) @@ -2364,7 +2364,8 @@ static int bcm_sysport_unmap_queues(stru continue; ring->inspect = false; - priv->ring_map[q + port * num_tx_queues] = NULL; + qp = ring->switch_queue; + priv->ring_map[qp + port * num_tx_queues] = NULL; } return 0;