From patchwork Tue Jul 31 10:33:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10550609 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97332139A for ; Tue, 31 Jul 2018 10:35:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81E542A4E2 for ; Tue, 31 Jul 2018 10:35:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 748032A7BE; Tue, 31 Jul 2018 10:35:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ABB452A4E2 for ; Tue, 31 Jul 2018 10:35:20 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41ft9z0CRvzF1Cq for ; Tue, 31 Jul 2018 20:35:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="Q3GzD3ej"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.4.85; helo=eur03-db5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="Q3GzD3ej"; dkim-atps=neutral Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40085.outbound.protection.outlook.com [40.107.4.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41ft9w1KwVzF18B for ; Tue, 31 Jul 2018 20:35:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=70jUMUsMYZ30Dg/YiQRxF37UfzEzKvC0O83zJJfEW98=; b=Q3GzD3ejQ5OuDus5c4/zsDeh9XLaj7jUoxam5HnmvHGghnykd1f0A9Ghck5v2LC7i0S4fj1EYpO4e3e35a5cx4AUqJtN+gG83nsUZb2e4z4vEBLVPWC6B5OdifDDnJFvXY4NpycBc+ioIBmR1bAZVFIRwXsoo2FmU60BLDHZAzY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Tue, 31 Jul 2018 10:35:08 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw 3/3] mlxsw: spectrum: Configure MC-aware mode on mlxsw ports In-Reply-To: Date: Tue, 31 Jul 2018 12:33:09 +0200 References: Message-Id: <9b0c1da9e54045ba1f592c2ea999ea64c9fb9bb2.1533032999.git.petrm@mellanox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: DB6P193CA0006.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::16) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1b81b84-f470-4749-0d7a-08d5f6d149ac X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:4htEM0YgktuplQun6AcsUNPKRJO+zm8k3CmxPTUj6d/ZiGMNkQzfy8ZRmfWqwAcPXGFrcTAy8yAKaujBBsECjJLyC63gEFhA+4EzBLaYgo/FTHpHCKmiaHOy0RDT1MHYkUTj+yGrOlHulU8gxLizYz5SJMgoQf/J8F4zk+QUZ49veF/F77vyTGz1jqJJiUK8z11JdMOGjyO/HtCnerbHbWp8LAIebbTf30kGLurDCd/B8wt1NWVoEbDS1RvzQWUY; 25:leVdOb+kuNI/LHE+iuRbrfgRdaZYILUgmoFgF/o06hEVj+hKxBSu4j8GDW+9dvyxXlalWf0cp0Vik8HJUOehzUXrdiiUSaYjEi57MAc3UlIOisBhaC+sr6kr9mZAeAwClQlDI2bPd8vSFohKmcda60H+9nt4thNlj447oGyREqABD2+DhJgnRhLMfS7emE1atdOzK2U4Ka1ZdL/KF5wKzi90dxgKD16hWDCaUEZkthJxPXrBAl9XkhmKlCxV9wCAPQmHUJa+E8fuZC46TqYg9GCNVC40AU1rm7b9fwIF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oiEnsuJpEYfPqOygyXWmUXU/E56HagRrJd9m02HEm+AhNL/7VBm3rOCrNuSXep9YPkETTNSl5OBA/N2+8EFRHhMx1eTCYU9bQt2doWt3zHPzDM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0750463DC9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(136003)(396003)(39860400002)(189003)(199004)(2906002)(66066001)(956004)(81166006)(81156014)(2616005)(8676002)(476003)(6636002)(305945005)(8936002)(6862004)(25786009)(486006)(48376002)(118296001)(14444005)(50466002)(5660300001)(446003)(36756003)(52116002)(51416003)(478600001)(3846002)(58126008)(26005)(37006003)(16526019)(86362001)(47776003)(575784001)(16586007)(6496006)(186003)(2351001)(6116002)(6486002)(11346002)(7736002)(53936002)(105586002)(386003)(106356001)(97736004)(68736007)(316002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4191; 23:cv89vifBy/9YMEmiUSlGG+yy+BP1nR17Pb7WKIuy5?= H50UBzbVEs1IlBXwTwiqlwOr+/tC9ENXuVthPAwiaAdSaoA910STcAm+Bn68Nm3DdWNOnSaqKGWXYIj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F8TPl/j3rLo/y2PrXLyI6hUHA9SGEr+1lXZ6criFiVX/o=; 7:lSTQY2X9endUswOt7j/++QqNKoxFloxav0i3zrj/3ZLVP0cR2mauClzeukjDtBVtqfxhZQaXw7Vdsm+bm0LSDAGMyyaocrMC+FZwQGrnu4k9gxt9wfPEI9IXhAIcmhSLbJC7w/hUGAphtB0tgshgmR5zXlYGj6hxqvx3E3oFiO1v8uIBt9OGlq2Rj0j1ujlvTH6WTDD+mr2GhYgQX6akLamRkpBN7pICSZXt9Fc4LgAb2kLRM6LRv95JFpepUjGd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2018 10:35:08.3620 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1b81b84-f470-4749-0d7a-08d5f6d149ac X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP In order to give unicast traffic precedence over BUM traffic, configure multicast-aware mode on all ports. Under multicast-aware regime, when assigning traffic class to a packet, the switch doesn't merely take the value prescribed by the QTCT register. For BUM traffic, it instead assigns that value plus 8. ETS elements for TCs 8..15 thus need to be configured as well. Extend mlxsw_sp_port_ets_init() so that it maps each of them to the same subgroup as their corresponding TC from the range 0..7, such that TCs X and X+8 map to the same subgroup. The existing code configures TCs with strict priority. So far this was immaterial, because each TC had its own subgroup. Now that two TCs share a subgroup it becomes important. TCs are prioritized in order of 7, 6, ..., 0, 15, 14, ..., 8: the higher TCs used for BUM traffic end up being deprioritized. Since that's what's needed, keep that configuration as it is, and configure the new TCs likewise. Finally in mlxsw_sp_port_create(), invoke configuration of QTCTM to enable MC-aware mode on each port. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 42312ff57b7e..5e2c968f0b70 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -2760,6 +2760,13 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) false, 0); if (err) return err; + + err = mlxsw_sp_port_ets_set(mlxsw_sp_port, + MLXSW_REG_QEEC_HIERARCY_TC, + i + 8, i, + false, 0); + if (err) + return err; } /* Make sure the max shaper is disabled in all hierarchies that @@ -2797,6 +2804,15 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) return 0; } +static int mlxsw_sp_port_tc_mc_mode_set(struct mlxsw_sp_port *mlxsw_sp_port) +{ + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; + char qtctm_pl[MLXSW_REG_QTCTM_LEN]; + + mlxsw_reg_qtctm_pack(qtctm_pl, mlxsw_sp_port->local_port, true); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qtctm), qtctm_pl); +} + static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, bool split, u8 module, u8 width, u8 lane) { @@ -2925,6 +2941,13 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, goto err_port_ets_init; } + err = mlxsw_sp_port_tc_mc_mode_set(mlxsw_sp_port); + if (err) { + dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize TC MC mode\n", + mlxsw_sp_port->local_port); + goto err_port_tc_mc_mode; + } + /* ETS and buffers must be initialized before DCB. */ err = mlxsw_sp_port_dcb_init(mlxsw_sp_port); if (err) { @@ -2981,6 +3004,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, err_port_fids_init: mlxsw_sp_port_dcb_fini(mlxsw_sp_port); err_port_dcb_init: +err_port_tc_mc_mode: err_port_ets_init: err_port_buffers_init: err_port_admin_status_set: