From patchwork Wed Jul 25 13:53:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544037 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 CC229112B for ; Wed, 25 Jul 2018 13:53:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA86C2A020 for ; Wed, 25 Jul 2018 13:53:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEC2A2A03E; Wed, 25 Jul 2018 13:53:40 +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 EC74A2A020 for ; Wed, 25 Jul 2018 13:53:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsZ0tCrzDrS7 for ; Wed, 25 Jul 2018 23:53:38 +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="WOo3TZ8H"; 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.8.52; helo=eur04-vi1-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="WOo3TZ8H"; dkim-atps=neutral Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsQ6KgbzDrSg for ; Wed, 25 Jul 2018 23:53:30 +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=VzS5pclGWAhSIg3O14SLTjMQvu1zmzcL9SmIVq1IY0o=; b=WOo3TZ8Hd2JjXfMpGBGZa3QSbmd4eLXeUsbK0byHGDzUEaxE+F8sWKzBhmrRXRqlRMOh+o0czdBb5rb8BTgo6eyNU88g3yyxDO0cRB2JtI4soTXfdzKHVk1/Tyfl9q7iw/7g8h4nyHabt+3c6j6xVYjaIefwKP3YwWpv1sUg7Fs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM0PR05MB4179.eurprd05.prod.outlook.com (2603:10a6:208:57::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Wed, 25 Jul 2018 13:53:22 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 1/8] net: dcb: For wild-card lookups, use priority -1, not 0 In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:13 +0200 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: AM4PR07CA0010.eurprd07.prod.outlook.com (2603:10a6:205:1::23) To AM0PR05MB4179.eurprd05.prod.outlook.com (2603:10a6:208:57::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41a680b3-4815-4e7e-d801-08d5f235fca6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4179; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4179; 3:3lkhPq9qY06IX2JE445puyf8RAZe1UpNbypkzmlYQAksnExOqfgK1FD18zceYy9W6GgEhohC9zwPb4FlHnPWQXAod6fLtB6lwtrJokZC8q+KqtXvu7Qtpwi9a+zYRwjZ5Ol34wCRxDxZzSiL++fwjV1XOgfNqx277Dy4moLZ85AFKUQ2rv7PZJvMqvqwQ1VDNDp8LvUCTgd9YSKD6/iNnnHmDHUJPRuMKxmgwDFNMTl4DrYYrScHtWTaUcKSev4N; 25:b+l8S7gcptC27TPNnPL9d45XPmmfr7FbMZmpdncMD9p+iH9YuD13mpKdElib9TmtCqDMqZ76AIVDX3hAec/Q+WGBcA2N4arbLAnKo1o7pWtyAwXZjFDPnTKqE3TwO89F/5lyV811d7Wp5tfDTg4SmcPwo6Jiujhcv0XXA2jZ617oTj9Qub0gNkLs5IT/Imu8lMTgs0zYuWsrpoYTaMzMXv73wS4n/6Ryxpwn67GAegAGbgpRYkZWkhEVN6+01E+6N5a6KaDY5pmSpSUjkpUJi/nLTsjQej1PDDYGwJyqqWpL+3PkwhDQn3aMihBfZa/JYNiL21MuiONkwmuCNPHzI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SgjNZzzMDk91ZUO7JvJ3nloKfp36Dny/FS9xqP2NAVrvj15YjQdQOyQfoYk1t57tlSJMhbIyTbven X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4179; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4179; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(39860400002)(376002)(346002)(199004)(189003)(11346002)(36756003)(6116002)(14444005)(3846002)(305945005)(118296001)(316002)(81156014)(76176011)(8676002)(37006003)(50466002)(68736007)(58126008)(81166006)(16586007)(47776003)(7736002)(66066001)(446003)(48376002)(26005)(105586002)(2351001)(8936002)(106356001)(6666003)(6486002)(386003)(53936002)(186003)(6496006)(6636002)(25786009)(2906002)(2616005)(52116002)(16526019)(956004)(97736004)(486006)(6862004)(476003)(86362001)(5660300001)(51416003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4179; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4179; 23:ZFHywuRQ6DVzUjJo77emgf9amrPO1Lkyr7BvekbWU?= BuzuuaFNbR5oMtxjTmF5f+ClUns4qqVp22Wlz4cKSdUVifzbjyCbutdStuFMRiRvwCHTnCipB31/RQigHcvqhzHB45vrSMRx6GPVHQ9RD0O1JqDt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=; 7:8NCwKhrnzSJ30t0uU4Wq20lvhxVb73ZdXVfmjqjOkQ4uKQo3bXjQs6u36kqtDr8nqMuAI25tqhf7YDgX3mE6+fztoZDDoayOuBia625l2dqIPx617luwo91qDq+KOvVQZLhJejR50nK1h6SHka8h3MCb7uhDYKHuxdUxC22GKKJzzNIdMUzyJ4IkhvU+7eR2jR1PQJY3iLmhflsgSfLL9nrMn8hSR+TbHOa1/CexC1cOV9KGBARDQczMVE6GqTbz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:22.6118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41a680b3-4815-4e7e-d801-08d5f235fca6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4179 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 The function dcb_app_lookup walks the list of specified DCB APP entries, looking for one that matches a given criteria: ifindex, selector, protocol ID and optionally also priority. The "don't care" value for priority is set to 0, because that priority has not been allowed under CEE regime, which predates the IEEE standardization. Under IEEE, 0 is a valid priority number. But because dcb_app_lookup considers zero a wild card, attempts to add an APP entry with priority 0 fail when other entries exist for a given ifindex / selector / PID triplet. Fix by changing the wild-card value to -1. Signed-off-by: Petr Machata --- net/dcb/dcbnl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 2589a6b78aa1..013fdb6fa07a 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1786,7 +1786,7 @@ static struct dcb_app_type *dcb_app_lookup(const struct dcb_app *app, if (itr->app.selector == app->selector && itr->app.protocol == app->protocol && itr->ifindex == ifindex && - (!prio || itr->app.priority == prio)) + ((prio == -1) || itr->app.priority == prio)) return itr; } @@ -1821,7 +1821,8 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app) u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio = itr->app.priority; spin_unlock_bh(&dcb_lock); @@ -1849,7 +1850,8 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) spin_lock_bh(&dcb_lock); /* Search for existing match and replace */ - if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { + itr = dcb_app_lookup(new, dev->ifindex, -1); + if (itr) { if (new->priority) itr->app.priority = new->priority; else { @@ -1882,7 +1884,8 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app) u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio |= 1 << itr->app.priority; spin_unlock_bh(&dcb_lock); From patchwork Wed Jul 25 13:53:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544039 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 1E27F112B for ; Wed, 25 Jul 2018 13:53:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A95E2A020 for ; Wed, 25 Jul 2018 13:53:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F28112A03E; Wed, 25 Jul 2018 13:53:46 +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 167982A020 for ; Wed, 25 Jul 2018 13:53:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsg2GlrzDrdc for ; Wed, 25 Jul 2018 23:53:43 +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="pnnx+AFU"; 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.0.57; helo=eur02-am5-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="pnnx+AFU"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00057.outbound.protection.outlook.com [40.107.0.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsV0VQ0zDrHF for ; Wed, 25 Jul 2018 23:53:33 +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=hFlQrVNEINcGYiZhYEg+ufx3saB2kXrVIgaEYXEaPm0=; b=pnnx+AFUgswzScBIYhlHrBF1oWt88s3RHWV8Yn/Wf/hhMWYHH3SUyYkT94hcht1ukIiFXCt8u50/MXrgFXQMBUFeKY9wCY8YBv1WXLw3FC4+xdGldKQOq1+3va+kaZrykHOyxsQYv2Gb+8FJTSwUSCmSQ1pWHRpvE0ciJfQCM8E= Received: from t540p (78.45.160.211) by AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Wed, 25 Jul 2018 13:53:28 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 2/8] net: dcb: Add priority-to-DSCP map getters In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:23 +0200 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: AM0PR01CA0010.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::23) To AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5907e4a5-4d51-4326-b9ab-08d5f2360022 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4180; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 3:Gm4GaqOhToK9dLTYRX4/zVmTY7CIrFaFXVkOa6zDzjpqDhtxL8wtcf989UyZT9UrZyCZ0bHQ3IpTDLV6SV3wVsce7A9e9DjvbwdjU4/CtEx3M7fz/aWLQJVZuisJJr3Mrp663uyrkNT7FPuvBFydp9JeoLis6so6afAnY6FuNAdo22ac49mZeAopb1RMi4eRUxs0GP3yeo6wx34kQ4EUme9idIhkNycP0rzO/02TFfkvlh337vkWZq2A79io1Lic; 25:Cn4q872DUGRhFUjLQMn4BBml6yEPQxAP7KOL8d6UGFn1+MZ4jYnj5/Tp+mZjvtZQb8W88Z64PwEWKfypWdZaetd2IaHFmLDkIqfVG/HoOb11BbxlAD1ywRHmYi+7WUrlJMEAAjDVFvmys9DOHasUvHNyJ0xnRMCnQtP5QayME0poI/GEqOrE4ljZALSf2gdFTO7gNoOkrxXSY2A4RGf1Ck3JHgScwqgRSiDjJ6J60f5RJYgfRH4yoSf+BkfP+hrF5qeAE+wG57V8cYwdn2UOzEF12NnNWk/YkKruApoOdhnDs41znfXJXz1Qlxf7uVUbgO097fTFbJHOOEITtHQLTw==; 31:Q1ralZSyVdHoqqXG6fLRQAsFHpRq9czxRr8K9WFXICVqFliYRsq7tCPFqRnLP6J93Dzrgy1G4wRdTVzlcIwqCwgsGtSmqDos/0TdpPqzMPeISGqZGS6eFNCKsrstTntOXeyfUZDXOb8krksAb4BkK0DorthWqWMZgDnKui1XYdRNY8PGeNxCZnT9gwRLKjzXp6PwwO4PXG2XheyKXCoCSlHaONOTWNcaWt828wUc8Qk= X-MS-TrafficTypeDiagnostic: AM0PR05MB4180: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 20:SRwMSnewtE/yml6E3DH8Lpxqt3M+SG1+5vz0t3nSYC1cR9XXcvr+iua1IRhSTvLqPfYq0efYbm+un130TQaSX8ylPQBVYBmyPHZLrwWc59eIVHpkyrbd0xWPTcs50ZMf4jUSCcHOHlUwf07ZNvNF/41PFBlomdmIQ3KLhCPLtTeFpkhwFOjAaiCJuV55mD4td9LZgQhFvID+eTRSsnK4XLmq+hJWRJD6bnDCdAjd/6TE3BZZPxxPVjGrOC5IHWKKASxaN6sxPPIvGb80ADot9wmhfkAVNmddP+wbfK5uzaK/Djcmkw79w2h5fRQbU+iVN/wKqrF7p64eB82vG2aBAWO+HofYsog36VIcvDCAzTiUyvGIy0JVBXfi4qs/cx1/S4Xb3u2Y0eoVYlieL91ZmUm1hmMjnpl6tMyv4zsxzxMKySQEhj0/ZvCrzQmMYiyE25IRVBmT3RgxjQfOndh8J9lV5Ty3lq8I6lk+y/5byZG+9tFczQC+KY+SVMeiGFam; 4:/XBSmyQGFpGA6L+98v6x2doY4CnjBVtC2PV3jierR5T3UGgHvEEBSR/IYnWxgtODrXyMOsXQTaQFJIGKg8xIByavP1NZ/G+LqLGliuryQV6i/fxgO0XBmS0GMvXJLCSbxBX7J6Yn8BdyeeNSOmKOCcfQPk/L3Mx+SHo1LITceQTct0mvguSFQdFN3q1BYZAu8WrpbbQYXTxo43KwUWm6x/j1Uh6ptjjI128BMCFKTJcdGyQqn8AeHLrRZowX90Xi5RkVqmaHHzX8HfaW0mOAog== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4180; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4180; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(478600001)(6666003)(14444005)(76176011)(86362001)(68736007)(81166006)(81156014)(16526019)(956004)(51416003)(52116002)(476003)(2616005)(186003)(26005)(11346002)(25786009)(48376002)(386003)(47776003)(50466002)(53936002)(8676002)(446003)(6862004)(6496006)(6636002)(6116002)(36756003)(105586002)(6486002)(2351001)(118296001)(106356001)(97736004)(486006)(7736002)(66066001)(2906002)(8936002)(5660300001)(37006003)(16586007)(316002)(305945005)(3846002)(58126008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4180; 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; AM0PR05MB4180; 23:0rqn3F3vW9pcfpy9c3OI6oDtTrnefG/KlNqYkQqb7?= tgjwGhAxJyNXFtDepqImH9sOyDUrJtnzTUM+5nIuTbLTZm58K2Fgq70zgUf8E4+rR5rNihgq00YXJuklGZaMklvjFyYdAgKegMn8n6Ukfi9h1eCg6QzULrlSbG6bZT1iPh5rSywY0PZO+iPE/fagJ6ZB0LMgviO8RQn3+0kp6IwaTx5GytxlkJ3CL2z4r6of6EmuFotPrdRvWyTvrVPQ3dcwRCy5ejItkttAy3Z9wzOICzaZNm2NKiOwDPqSRMSwFJ/cAXjHeACyVZu+kzN6XPzBBFSwe7gSu6bgHCOF+5P701M5XOMSi0mRFEbEqb89VVf+LZ8DDitylmb4A+bYhp2vfXzskTPGBiZwOQJ3WgoKcXyfIBqQIg6fIr5ubMcE08D3zSs5od/cbsxdtPixfEhd3C2VlQTk6CM0Qr3UjTSfzHQJt//oSHgla4hWxmUj3Jnu2Skl4VPQ2bR1VlgBOP9M+WY6575OOhaiuTZXYugSdsVRrDayybME/B7/lR8p/1oZWkJj3XRMhOlMMbunRhKxe3D3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; AM0PR05MB4180; 6:fZXiEaS2Nb75SCgUI4ry8Pvn80frL3bvjzCUJGbeRLgA/l5DBU3cTXzM2gtLnFXhschuPCWyKTnjVmKBaJOxfQ3ANkUf9K7LQuq8SBRccEaDONXMtQZlDv4gKMiAYG73I/Dl8Ys+n2SdPVKiIJAuQd4tnY/nwULQH5QuU91ZLSgqsCxBukO+Q8eqreUCrmttJnyOFEugn+ZbsLR8LmSuLZ6slHOAqDviocVD9MSO1OmhBxBkk0LnRHMJMv3IwfRODCUZvuV2A53le9MVlVsEA7VlTwdLBpCS+taD224sC5acPtUMXvKLKplZlE15dOJ0P5PMWP0aN7g0MybGS45aEM0FedTM7b0u94v2pAbQGos9MsPfLSyBUW/VTBu+8CqKwp0wuGJOVzMMphkGjFQyBPpzws9XrQATvUtK2uJZm3I9wRv37dW9LRgyacIZ5KyIZnG3NhKOOAlgfNMEMFIVzA==; 5:mhigW2eRm+mrPF4OMAVOA44a0+7kbWxWfetkHbzFy3dZOOMd1t2YwtgWs+W1Y9Uimqj9vlwNBl1lticAW4KUw0PqaoW8sk7Kr/bK9jWqd4bdvai1NYDbFSEnCe//p6Khoslu+TcC0vx+oSFXwhj6LDYNVAqsx9TDDFk4OBJDnBc=; 7:WQYl99A/K/VRMwyNABXqXvuNCRJ4QV3lcqeOdn4kQ0bu7ToZfBjR7zF5jynZ75yGQ0svV1WAT+yIXCsvnAFHuAVOPkwNX+MhPpPEquQxl0TlQvj0jcc5jSYQeBy7E3/cDoXXYgwe7IKvT7qDlVhiiHlvbXj6rO69fxiXrb69W+A3bPb62dMVQoUupG72H5Hk93ZKUHaG0Wox0X709g3uXSLwkYqvfa/SmDIM6Bsgm0NfVC43N2cjDdBeRIGY7KPt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:28.4568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5907e4a5-4d51-4326-b9ab-08d5f2360022 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4180 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 On ingress, a network device such as a switch assigns to packets priority based on various criteria. Common options include interpreting PCP and DSCP fields according to user configuration. When a packet egresses the switch, a reverse process may rewrite PCP and/or DSCP values according to packet priority. The following three functions support a) obtaining a DSCP-to-priority map or vice versa, and b) finding default-priority entries in APP database. The DCB subsystem supports for APP entries a very generous M:N mapping between priorities and protocol identifiers. Understandably, several (say) DSCP values can map to the same priority. But this asymmetry holds the other way around as well--one priority can map to several DSCP values. For this reason, the following functions operate in terms of bitmaps, with ones in positions that match some APP entry. - dcb_ieee_getapp_dscp_prio_mask_map() to compute for a given netdevice a map of DSCP-to-priority-mask, which gives for each DSCP value a bitmap of priorities related to that DSCP value by APP, along the lines of dcb_ieee_getapp_mask(). - dcb_ieee_getapp_prio_dscp_mask_map() similarly to compute for a given netdevice a map from priorities to a bitmap of DSCPs. - dcb_ieee_getapp_default_prio_mask() which finds all default-priority rules for a given port in APP database, and returns a mask of priorities allowed by these default-priority rules. Signed-off-by: Petr Machata --- Notes: Changes from v1 to v2 - Use IEEE_8021QAZ_MAX_TCS instead of literal 8. - Check values of ifindex, selector, protocol, priority consistently in all helpers, and in this order. include/net/dcbnl.h | 13 ++++++++ net/dcb/dcbnl.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h index 0e5e91be2d30..e22a8a3c089b 100644 --- a/include/net/dcbnl.h +++ b/include/net/dcbnl.h @@ -34,6 +34,19 @@ int dcb_ieee_setapp(struct net_device *, struct dcb_app *); int dcb_ieee_delapp(struct net_device *, struct dcb_app *); u8 dcb_ieee_getapp_mask(struct net_device *, struct dcb_app *); +struct dcb_ieee_app_prio_map { + u64 map[IEEE_8021QAZ_MAX_TCS]; +}; +void dcb_ieee_getapp_prio_dscp_mask_map(const struct net_device *dev, + struct dcb_ieee_app_prio_map *p_map); + +struct dcb_ieee_app_dscp_map { + u8 map[64]; +}; +void dcb_ieee_getapp_dscp_prio_mask_map(const struct net_device *dev, + struct dcb_ieee_app_dscp_map *p_map); +u8 dcb_ieee_getapp_default_prio_mask(const struct net_device *dev); + int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd, u32 seq, u32 pid); int dcbnl_cee_notify(struct net_device *dev, int event, int cmd, diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 013fdb6fa07a..a556cd708885 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1958,6 +1958,92 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) } EXPORT_SYMBOL(dcb_ieee_delapp); +/** + * dcb_ieee_getapp_prio_dscp_mask_map - For a given device, find mapping from + * priorities to the DSCP values assigned to that priority. Initialize p_map + * such that each map element holds a bit mask of DSCP values configured for + * that priority by APP entries. + */ +void dcb_ieee_getapp_prio_dscp_mask_map(const struct net_device *dev, + struct dcb_ieee_app_prio_map *p_map) +{ + int ifindex = dev->ifindex; + struct dcb_app_type *itr; + u8 prio; + + memset(p_map->map, 0, sizeof(p_map->map)); + + spin_lock_bh(&dcb_lock); + list_for_each_entry(itr, &dcb_app_list, list) { + if (itr->ifindex == ifindex && + itr->app.selector == IEEE_8021QAZ_APP_SEL_DSCP && + itr->app.protocol < 64 && + itr->app.priority < IEEE_8021QAZ_MAX_TCS) { + prio = itr->app.priority; + p_map->map[prio] |= 1ULL << itr->app.protocol; + } + } + spin_unlock_bh(&dcb_lock); +} +EXPORT_SYMBOL(dcb_ieee_getapp_prio_dscp_mask_map); + +/** + * dcb_ieee_getapp_dscp_prio_mask_map - For a given device, find mapping from + * DSCP values to the priorities assigned to that DSCP value. Initialize p_map + * such that each map element holds a bit mask of priorities configured for a + * given DSCP value by APP entries. + */ +void +dcb_ieee_getapp_dscp_prio_mask_map(const struct net_device *dev, + struct dcb_ieee_app_dscp_map *p_map) +{ + int ifindex = dev->ifindex; + struct dcb_app_type *itr; + + memset(p_map->map, 0, sizeof(p_map->map)); + + spin_lock_bh(&dcb_lock); + list_for_each_entry(itr, &dcb_app_list, list) { + if (itr->ifindex == ifindex && + itr->app.selector == IEEE_8021QAZ_APP_SEL_DSCP && + itr->app.protocol < 64 && + itr->app.priority < IEEE_8021QAZ_MAX_TCS) + p_map->map[itr->app.protocol] |= 1 << itr->app.priority; + } + spin_unlock_bh(&dcb_lock); +} +EXPORT_SYMBOL(dcb_ieee_getapp_dscp_prio_mask_map); + +/** + * Per 802.1Q-2014, the selector value of 1 is used for matching on Ethernet + * type, with valid PID values >= 1536. A special meaning is then assigned to + * protocol value of 0: "default priority. For use when priority is not + * otherwise specified". + * + * dcb_ieee_getapp_default_prio_mask - For a given device, find all APP entries + * of the form {$PRIO, ETHERTYPE, 0} and construct a bit mask of all default + * priorities set by these entries. + */ +u8 dcb_ieee_getapp_default_prio_mask(const struct net_device *dev) +{ + int ifindex = dev->ifindex; + struct dcb_app_type *itr; + u8 mask = 0; + + spin_lock_bh(&dcb_lock); + list_for_each_entry(itr, &dcb_app_list, list) { + if (itr->ifindex == ifindex && + itr->app.selector == IEEE_8021QAZ_APP_SEL_ETHERTYPE && + itr->app.protocol == 0 && + itr->app.priority < IEEE_8021QAZ_MAX_TCS) + mask |= 1 << itr->app.priority; + } + spin_unlock_bh(&dcb_lock); + + return mask; +} +EXPORT_SYMBOL(dcb_ieee_getapp_default_prio_mask); + static int __init dcbnl_init(void) { INIT_LIST_HEAD(&dcb_app_list); From patchwork Wed Jul 25 13:53:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544041 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 49DBF139A for ; Wed, 25 Jul 2018 13:53:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 392D32A020 for ; Wed, 25 Jul 2018 13:53:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DD032A063; Wed, 25 Jul 2018 13:53:55 +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 6A8F42A03E for ; Wed, 25 Jul 2018 13:53:54 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsr2ktNzDrHF for ; Wed, 25 Jul 2018 23:53:52 +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="jOEpVy7b"; 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=104.47.0.83; helo=eur01-he1-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="jOEpVy7b"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0083.outbound.protection.outlook.com [104.47.0.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsj24WmzDrM8 for ; Wed, 25 Jul 2018 23:53:45 +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=SV/YrB1LxvDOtCM9s1v8rrsy/FN+5SKkuiqWpHs1o5Y=; b=jOEpVy7bykCZFx2z1TrxlBcp21jiBx7T+h4/BJnRDZip4t/H4lMWDagElcvtmiB87cBrosv4s3sFi+USSUy24cjkD1ZCgVP2+UeXzPRxhKLdfVkZcKxa+IUDPQ4IUBsxrjpJeXqj7IsVrFSInVzkONl6uKRwHFpCmXF1hvCRQHM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Wed, 25 Jul 2018 13:53:35 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 3/8] mlxsw: reg: Add QoS Port DSCP to Priority Mapping Register In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:29 +0200 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: HE1PR06CA0143.eurprd06.prod.outlook.com (2603:10a6:7:16::30) To DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25ab07c6-2e52-4e6f-1874-08d5f23604df X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4186; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4186; 3:2LLtutL2wPGjFCAEZsBM3VfQ86zpl1JPL4H+DC+15G5DlfaHKGuWI/zoO5lreGQhA4sMTZpoKDaAaxhEMfWTSrsoVtT9BKhVVidUpe44TArxppLewaBEXJiMVJlVMfiYOYldIhOapsFfTYZLPjKLsr5OXNA24YWTRT4nr6M34HkGbGAtQQ1g9LJPPMd6x+wqmmrisQFGlPGQdFkR6tcm7rtXscwbQUFZr3nZj1LZXSTesp/gZypMM24X23HNRLeZ; 25:aByQZQpJ1/efPkDSM3gf0EiTl2qdLlIWsj2H5+bPvlXTfrT0PNUU4JPN8n2TgmbhOQwCjajvWpRo0ac/gnaX33PWuQmJ1yWo9jcSQXRjrDdjuGMNG/NoeKswtUdcYP45K4oKGbF0hYrRlzRRRULpLWXySmBR51p9A0xetplFEyUxix47wHBp+NZC71GHX/N0b20z57Q1vGRV6FU/Sreel8nPKEPn9GRWxtm7z8Z4keudqlUTT1dFUWCwDEKWVmjY0c+mUnb5lYfR5Quk4PSC29thv9txZlTfS2ZXnq/jyI+yfa1WzDD8t6pgcKYjjaITfEgqskNVJfnxZoztcILWUw==; 31:cXIKRFrs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JdJoy2Z+vNGvMFRsg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4186; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4186; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(396003)(346002)(366004)(189003)(199004)(53936002)(6666003)(36756003)(6486002)(478600001)(50466002)(48376002)(97736004)(6862004)(8936002)(81166006)(118296001)(81156014)(25786009)(7736002)(305945005)(8676002)(6496006)(2351001)(106356001)(6636002)(386003)(476003)(956004)(2616005)(486006)(6116002)(3846002)(105586002)(66066001)(446003)(186003)(16526019)(47776003)(26005)(11346002)(51416003)(52116002)(76176011)(68736007)(2906002)(16586007)(58126008)(5660300001)(316002)(14444005)(37006003)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4186; 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; DB7PR05MB4186; 23:+p6b7qP/wsd5v+bcToycWT679iaF6pMJo6zkqLLfX?= BmSaZiXfQgNP6xeBnvskqmK2drFv6ubbG9sZ1jdwSLYbIBg+0fJwcm8kg6tc6TlCqGFGk1LkUX0BmxvQCmM3qH9F4dEFb2ZN0ukyjj7fUOMrxJEJv1OjxFLQrya7heHlf6Vuf6vMb/n6lsyZTOl2AdsvHxUXqDNY239D9ohU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eCfzsZNibJN6WhmfDjyeHI7xhPzygFaFR6i/S74bvIKmkGk24Bw+5qVGvkljgLC4X/Q3x+ycuBsl1DKe7htjBtuVSEG+gB4afkUa/NH2tQU+183yZZ/CNHVptyboOeItlobMblqX8DeoU4dlAxOpx7F9ve1/pc6TO9+fv3s8gbps2kO+c+CKy1C6o84oA/+G7/mmh2yix6EjQSE3e3BhV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:35.8241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25ab07c6-2e52-4e6f-1874-08d5f23604df X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4186 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 The QPDPM register controls the mapping from DSCP field to Switch Priority for IP packets. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 596fddfb3850..fd8745bce13c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3044,6 +3044,57 @@ static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port, mlxsw_reg_qeec_next_element_index_set(payload, next_index); } +/* QPDPM - QoS Port DSCP to Priority Mapping Register + * -------------------------------------------------- + * This register controls the mapping from DSCP field to + * Switch Priority for IP packets. + */ +#define MLXSW_REG_QPDPM_ID 0x4013 +#define MLXSW_REG_QPDPM_BASE_LEN 0x4 /* base length, without records */ +#define MLXSW_REG_QPDPM_DSCP_ENTRY_REC_LEN 0x2 /* record length */ +#define MLXSW_REG_QPDPM_DSCP_ENTRY_REC_MAX_COUNT 64 +#define MLXSW_REG_QPDPM_LEN (MLXSW_REG_QPDPM_BASE_LEN + \ + MLXSW_REG_QPDPM_DSCP_ENTRY_REC_LEN * \ + MLXSW_REG_QPDPM_DSCP_ENTRY_REC_MAX_COUNT) + +MLXSW_REG_DEFINE(qpdpm, MLXSW_REG_QPDPM_ID, MLXSW_REG_QPDPM_LEN); + +/* reg_qpdpm_local_port + * Local Port. Supported for data packets from CPU port. + * Access: Index + */ +MLXSW_ITEM32(reg, qpdpm, local_port, 0x00, 16, 8); + +/* reg_qpdpm_dscp_e + * Enable update of the specific entry. When cleared, the switch_prio and color + * fields are ignored and the previous switch_prio and color values are + * preserved. + * Access: WO + */ +MLXSW_ITEM16_INDEXED(reg, qpdpm, dscp_entry_e, MLXSW_REG_QPDPM_BASE_LEN, 15, 1, + MLXSW_REG_QPDPM_DSCP_ENTRY_REC_LEN, 0x00, false); + +/* reg_qpdpm_dscp_prio + * The new Switch Priority value for the relevant DSCP value. + * Access: RW + */ +MLXSW_ITEM16_INDEXED(reg, qpdpm, dscp_entry_prio, + MLXSW_REG_QPDPM_BASE_LEN, 0, 4, + MLXSW_REG_QPDPM_DSCP_ENTRY_REC_LEN, 0x00, false); + +static inline void mlxsw_reg_qpdpm_pack(char *payload, u8 local_port) +{ + MLXSW_REG_ZERO(qpdpm, payload); + mlxsw_reg_qpdpm_local_port_set(payload, local_port); +} + +static inline void +mlxsw_reg_qpdpm_dscp_pack(char *payload, unsigned short dscp, u8 prio) +{ + mlxsw_reg_qpdpm_dscp_entry_e_set(payload, dscp, 1); + mlxsw_reg_qpdpm_dscp_entry_prio_set(payload, dscp, prio); +} + /* PMLP - Ports Module to Local Port Register * ------------------------------------------ * Configures the assignment of modules to local ports. @@ -8255,6 +8306,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(qpcr), MLXSW_REG(qtct), MLXSW_REG(qeec), + MLXSW_REG(qpdpm), MLXSW_REG(pmlp), MLXSW_REG(pmtu), MLXSW_REG(ptys), From patchwork Wed Jul 25 13:53:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544043 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 9EB43139A for ; Wed, 25 Jul 2018 13:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C6FD2A020 for ; Wed, 25 Jul 2018 13:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80A942A063; Wed, 25 Jul 2018 13:53:58 +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 C71922A020 for ; Wed, 25 Jul 2018 13:53:57 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsw0z8FzDrdf for ; Wed, 25 Jul 2018 23:53:56 +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="Ch7eRIHb"; 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.0.60; helo=eur02-am5-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="Ch7eRIHb"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00060.outbound.protection.outlook.com [40.107.0.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsn2LqxzDrHN for ; Wed, 25 Jul 2018 23:53:49 +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=0ApNhXjIx7Tjv6uwyLsxIBqJtz7ESwJGejnKWRctu1Y=; b=Ch7eRIHbV9zDbuAZB5M3aDbRzgxmbrQ0PtQReHDTMiwxkoCfWxWq4bJLFmEdH7JIc9r/WcMezPSH0HMKB2O6f3CnSGRiXde27gKEgsLHfnbL94DEZHS3MpB5l7xUhNv5FqghXb3KnmkL+mygpCVef+wJ7rxPQmwjIjJe04uU0UU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Wed, 25 Jul 2018 13:53:42 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 4/8] mlxsw: reg: Add QoS Priority Trust State Register In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:37 +0200 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: AM4PR0101CA0053.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::21) To DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6819765e-e2b3-47c0-5031-08d5f2360848 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4188; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 3:8yRLqcVA324zDYRWgTvXo7CFBh1XzI4R7q3DXNDV93LdyQMDlEx8SUbMNWNKBZAyl95kKHOpnJ0U0Rl/Hthgzq4NB1PqGEO6CJVKmhRbbLemcUwIi78vx5khbJoBipnnnlRks9WyPvIMs5HL1gs6Do4Di1uKVlI6ME6yfgA3wJgDidwpig2vVa0NQwRB77FqY4te4pXL4TTtqKQLQ+azI6FfOu3IaRK9WrFB8/3wenAqO7+QqwOxlVD0AV7h3hni; 25:flu+fDzg5F1TOCev6N8wRXqFXcUVQPW3B+EZUlsG6lx726WUQxSO/hy428xpgE0o+xsX95F7p4oOOB0cpWTqDBTtK8HfMwtqTTLYEF6zPHd0gUqML1CewwwQYFsmF4feuPwMF/eqTOvg6PcXzWpxV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4mTwaFZe8qpeTW9A7n6u2Lo/X2h+/X2KQODu/NrbHUsyRxK82NbgPDCFPW0ubJbQAocPmNHawK52aRw8ehRIzFc0uMw0Cp2DHnDRSnNlHjIL4IxymvvG3CGbRFHmSxx34v6oUPsCNrFZadXwopPlNcW3ZHYsaCS0OQasynM63iU+oK3xhJcKGAvYKNUuvKX1m79ioebr2IG992vQAi3OefIH6Eva0nw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4188; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4188; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(346002)(376002)(366004)(136003)(199004)(189003)(106356001)(956004)(2616005)(8676002)(476003)(50466002)(5660300001)(6862004)(105586002)(6496006)(37006003)(81166006)(81156014)(53936002)(58126008)(48376002)(6666003)(118296001)(68736007)(478600001)(6636002)(316002)(16586007)(36756003)(446003)(11346002)(186003)(14444005)(2906002)(8936002)(305945005)(7736002)(66066001)(47776003)(6486002)(16526019)(486006)(25786009)(86362001)(26005)(386003)(6116002)(3846002)(51416003)(52116002)(2351001)(97736004)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4188; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR05MB4188; 23:hG9UONBUn2JKsZ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D9EjN0pEq+8Z5/UQYuGiBCxZzuqGYCrMk/oydRnhg1s2KvLYA3B4FsF4Jh4e0UNpfXWUALOYRTp4z3QO2idswfH9EhiOGZ7q0wlH55ySdjXwUWhJ29oy4I/NboWKLKLQzE0uJRu+UEa78fD+Eq+6f8qRY=; 7:GrQP6pVOWotAWFDByQCSEeIwKb3C7La7xf66xKvlQnGZp53bbAsazyGs5VZ1vZks1eYlmH8O5smm/6n9aHUMNWO1sgD5WuhNBEtsWRqUimCOMfQJ2Kc3v+B+8pS7DogXdPoI/PuKmvWkhuo1RMW6jJs5pJpB1imJJPNUpNm77VXbfQnrx3RAioAbY/xahLcb6DNaOk+ptRUX1NKqDgivH3xpZda9f0ik7PvXjdURet34xY+MT+xrYBnjev4rFAXE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:42.1233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6819765e-e2b3-47c0-5031-08d5f2360848 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4188 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 The QPTS register controls the port policy to calculate the switch priority and packet color based on incoming packet fields. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index fd8745bce13c..efc989e7c842 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -2732,6 +2732,44 @@ static inline void mlxsw_reg_iedr_rec_pack(char *payload, int rec_index, mlxsw_reg_iedr_rec_index_start_set(payload, rec_index, rec_index_start); } +/* QPTS - QoS Priority Trust State Register + * ---------------------------------------- + * This register controls the port policy to calculate the switch priority and + * packet color based on incoming packet fields. + */ +#define MLXSW_REG_QPTS_ID 0x4002 +#define MLXSW_REG_QPTS_LEN 0x8 + +MLXSW_REG_DEFINE(qpts, MLXSW_REG_QPTS_ID, MLXSW_REG_QPTS_LEN); + +/* reg_qpts_local_port + * Local port number. + * Access: Index + * + * Note: CPU port is supported. + */ +MLXSW_ITEM32(reg, qpts, local_port, 0x00, 16, 8); + +enum mlxsw_reg_qpts_trust_state { + MLXSW_REG_QPTS_TRUST_STATE_PCP = 1, + MLXSW_REG_QPTS_TRUST_STATE_DSCP = 2, /* For MPLS, trust EXP. */ +}; + +/* reg_qpts_trust_state + * Trust state for a given port. + * Access: RW + */ +MLXSW_ITEM32(reg, qpts, trust_state, 0x04, 0, 3); + +static inline void mlxsw_reg_qpts_pack(char *payload, u8 local_port, + enum mlxsw_reg_qpts_trust_state ts) +{ + MLXSW_REG_ZERO(qpts, payload); + + mlxsw_reg_qpts_local_port_set(payload, local_port); + mlxsw_reg_qpts_trust_state_set(payload, ts); +} + /* QPCR - QoS Policer Configuration Register * ----------------------------------------- * The QPCR register is used to create policers - that limit @@ -8303,6 +8341,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(percr), MLXSW_REG(pererp), MLXSW_REG(iedr), + MLXSW_REG(qpts), MLXSW_REG(qpcr), MLXSW_REG(qtct), MLXSW_REG(qeec), From patchwork Wed Jul 25 13:53:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544045 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 3335B112B for ; Wed, 25 Jul 2018 13:53:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 217C12A020 for ; Wed, 25 Jul 2018 13:53:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15F1A2A03E; Wed, 25 Jul 2018 13:53:59 +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 5A8BE2A02A for ; Wed, 25 Jul 2018 13:53:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsw47yfzDrpm for ; Wed, 25 Jul 2018 23:53:56 +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="ClDVnx3w"; 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.0.60; helo=eur02-am5-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="ClDVnx3w"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00060.outbound.protection.outlook.com [40.107.0.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsp4rvKzDrHN for ; Wed, 25 Jul 2018 23:53:50 +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=6/xNwEM4c/sKn78TfNbfJEpZi+oN7kGT3CDGYBOUX48=; b=ClDVnx3w0vTuBUiorGKJXrtl73V429QXyZaU1SnPS1Vo6SV3tiw7vWdZGAYGctbtXf9rqlebBsBbrk23S4HpOlLZE2sJ+vXu7Go9gZ+loqbjNVccYrouUHyg4TgYIcT/GyVfoE0WtHv83pDJylqpNo9OQIiIuimwkqgVhsUu63E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Wed, 25 Jul 2018 13:53:46 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 5/8] mlxsw: reg: Add QoS ReWrite Enable Register In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:42 +0200 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: VI1P189CA0031.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::44) To DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80253d73-f433-466e-74f4-08d5f2360af5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4188; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 3:JBewTCgB93a2k0cvBDZptRwua+o16YwmzB+QHcOOvckgERHYUTMIzFFg/crt3jPlWvPUabbR9waBY1UtpUMST0AAWDsxcsXux7Q2WWlOKHoQ6q+kSsa2wPNwbeubdS9yByixKIxddaqxgy5Md5TBSVwFdXHJdtvKggcO4fWAXsAH1qPjLV+ver1KDkuy0cjfTGBV7ZVPmsZd6BzSFZI5r4GlpOjz9fPHe/tSxO6KdG87nxF6gsPgApFdA1WqdW3L; 25:CN4cE9X7fw+gxZ8XHAV7AxDqh/v29AavHiFr1A0L9dzQ+w5NK9AEVDERxVMsUZ9zZbdEoYg6Y6vLN76h3LxFjJEniTxLkTqqbqoDwv0hiyAN+MX0uolgHTfceRgW+P866macOkeUZAzT0uJlROK3GOYTY/Fvccr3e0V4qGdFA9Sw/dyOmbzvMOQnr8/Yo/gPtfB5mklzJx5iuyI++X+G7gtKdFfVFaACTOFv3gtVh18d1f1BDsjPK8N5hmrpqhU2tpmwzqBwViqfbdkP0ErawIhTv55BWIhLuVPaRSYa2HSooSxZE1Uayg3ftU397/umv75UNpu+Ig4CbhJqH2MXVQ==; 31:Qje4N5vMgzVWZ9wKFC/worlByKgnsoovkkAFadULkJIIVLyafx3qBheLwo9qhbtWy538vAjboeU4jPQmPfzkLIdlmxRAJvMy+/d80YlvnbAxxxh9SxviFs2MVBOvEXEcmL2bHDhZVngS1sTeSHJvIJWQ/NA/2yy/5ylBV+d4Cn9LP8sioG4xLvaGQBDi9Axm+o2kOsH/xrdQz1Uxo9H7ruW7wznfR//fUk/U0QEaZPQ= X-MS-TrafficTypeDiagnostic: DB7PR05MB4188: X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 20:umz9BdLE1YaVMvbDUkiHWm/ZQhZkFJT+HTVv1RoDvRC+otLP3LpdXWWdgWYTGaWw7a0Z5UWY4PJ64nuFu68QwPaU3clDb7an+blFnWX1YLP/k4tYsGJ+aXe7K8VaSTUiP6Y+q3Kr1EOLWFN+68WyMg2VSH7bphf9kNqzbIb57wZ31dPtWjve0JeJb+D2fHGm/jdQSFvYlnnEJUdrHpj8qJTpOkV7cizq0JtbmzmNuvAaPxEmDD/f1//E+XkLkedi25Jlp7Up6QY/eGN+64L5iA9YwuxT0bddXopS4hkTZ/6kOqBC1++J/EXk5DPF4mpcacjtYb8O7T1Affp5RPrO6cpnMLyKjk3PG/XVc+upizL81eadS4p2L8wLUyGy1g8GCRL0IRjFu95llKJaiFFWB6NaMMBuy+OIlp24MTpaForErnWUHbFucNVE+moSPfNEXXW7N3Uysr1t6Gx1ANb7QJXYDDBbSdal19LOvgWyLk8FsEgnzaq3iI32voo3Pz03; 4:hIZ/yj/omFEflGqTUmtou7piIk1KvIJrs/nE2duOzQc2J2zTLBdSVq5+TVndjiIP1WOHabL12dnACLDuVVUfAeqEh2SbiZyFu3aha07qEdiUNVHWPZ35jgrgnDkjBqhmULiTHLct/MAbdFsUKJAkTf8w3hvPCzyAwvsehl8u6ugTws6JlSJe+XmfE5ia9xHxXamW7u2erkKYH8sGepr/6Dq0J9GygvkJwZRNo1LbVTnvtlzewgDpS3aWGwQz+PM19wxC78qvOSRxoQtgII7FiQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4188; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4188; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6029001)(39860400002)(396003)(346002)(376002)(366004)(136003)(199004)(189003)(106356001)(956004)(2616005)(8676002)(476003)(50466002)(5660300001)(6862004)(105586002)(6496006)(37006003)(81166006)(81156014)(53936002)(58126008)(48376002)(6666003)(118296001)(68736007)(478600001)(6636002)(316002)(16586007)(36756003)(446003)(11346002)(186003)(14444005)(2906002)(8936002)(305945005)(7736002)(66066001)(47776003)(6486002)(16526019)(486006)(25786009)(86362001)(26005)(386003)(6116002)(3846002)(51416003)(52116002)(2351001)(97736004)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4188; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR05MB4188; 23:mbWnHljLC70vIdUUyHv4Q+JMlk1DAdLScMXhpGyb6?= EZ0NucrwLzuE1Bx2RabazncpN9FgRmH4jRA1ODIJrrmzjfoFpfFD/Q2TI6YKsAmxYuC72xS4PpqvGDeiKe+AAyLRPS0+ze86/T1fwGRj2SRPLOTVMQrrNII2ISx9O6ChEIUm0Qb/xx6nuwOsKZv/Wa9CMp0P5FSFkbCf0EpABQbTZyBImxOxUm2Qp/scXpAbp4w8/kblgBZPo/DxoFQP/qbBvHR2YaxMv9mPebNJWz34qYSUVadexMpEEu47J3uvgu9RQN5Dd5IAtJp5J/m7Sc9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pU61LocTMkXGPEatDk68701U38zaoQoUJLIBVEsdxrcGuqhtOX2defZn9WAV4CgRdRjBIiY96thwAZe3GOAiTJN6Eb5Y9qPgwimeoFYQbtzSDRo2j SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:46.6625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80253d73-f433-466e-74f4-08d5f2360af5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4188 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 This register configures the rewrite enable (whether PCP or DSCP value in packet should be updated according to packet priority) per receive port. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index efc989e7c842..14e75b8afcfa 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3082,6 +3082,44 @@ static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port, mlxsw_reg_qeec_next_element_index_set(payload, next_index); } +/* QRWE - QoS ReWrite Enable + * ------------------------- + * This register configures the rewrite enable per receive port. + */ +#define MLXSW_REG_QRWE_ID 0x400F +#define MLXSW_REG_QRWE_LEN 0x08 + +MLXSW_REG_DEFINE(qrwe, MLXSW_REG_QRWE_ID, MLXSW_REG_QRWE_LEN); + +/* reg_qrwe_local_port + * Local port number. + * Access: Index + * + * Note: CPU port is supported. No support for router port. + */ +MLXSW_ITEM32(reg, qrwe, local_port, 0x00, 16, 8); + +/* reg_qrwe_dscp + * Whether to enable DSCP rewrite (default is 0, don't rewrite). + * Access: RW + */ +MLXSW_ITEM32(reg, qrwe, dscp, 0x04, 1, 1); + +/* reg_qrwe_pcp + * Whether to enable PCP and DEI rewrite (default is 0, don't rewrite). + * Access: RW + */ +MLXSW_ITEM32(reg, qrwe, pcp, 0x04, 0, 1); + +static inline void mlxsw_reg_qrwe_pack(char *payload, u8 local_port, + bool rewrite_pcp, bool rewrite_dscp) +{ + MLXSW_REG_ZERO(qrwe, payload); + mlxsw_reg_qrwe_local_port_set(payload, local_port); + mlxsw_reg_qrwe_pcp_set(payload, rewrite_pcp); + mlxsw_reg_qrwe_dscp_set(payload, rewrite_dscp); +} + /* QPDPM - QoS Port DSCP to Priority Mapping Register * -------------------------------------------------- * This register controls the mapping from DSCP field to @@ -8345,6 +8383,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(qpcr), MLXSW_REG(qtct), MLXSW_REG(qeec), + MLXSW_REG(qrwe), MLXSW_REG(qpdpm), MLXSW_REG(pmlp), MLXSW_REG(pmtu), From patchwork Wed Jul 25 13:53:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544047 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 48376139A for ; Wed, 25 Jul 2018 13:54:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 363392A02A for ; Wed, 25 Jul 2018 13:54:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A8222A07B; Wed, 25 Jul 2018 13:54:12 +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 3B9DE2A02A for ; Wed, 25 Jul 2018 13:54:11 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGt9022szDrnp for ; Wed, 25 Jul 2018 23:54:09 +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="t+qG5WFL"; 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=104.47.2.54; helo=eur01-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="t+qG5WFL"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0054.outbound.protection.outlook.com [104.47.2.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGt33rV7zDrHF for ; Wed, 25 Jul 2018 23:54:03 +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=s2urprDgP0aBgebXspcuUHZJqdjoe+tTAdVeUvClS7M=; b=t+qG5WFLpRpGPRGQKX78dYc2258dNM66RQKP8iVLl3n4vChaHvo3OSe+VikeRcC1NT81BonpML/uIFX/TahkqThcwPOEVR1rXqVSb0s5QvFmluSdpQK1eWtCQ/wjBXoEaGbGO4lCDJb581KuZEV8CPWjiP9ViFnx6tMbp5EFFZU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4192.eurprd05.prod.outlook.com (2603:10a6:803:4e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Wed, 25 Jul 2018 13:53:54 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 6/8] mlxsw: reg: Add QoS Priority to DSCP Mapping Register In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:47 +0200 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: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To VI1PR05MB4192.eurprd05.prod.outlook.com (2603:10a6:803:4e::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b559db4-ac4f-4ad1-8a60-08d5f2360ff7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4192; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 3:LLrTz8AgznfwMX3rnCUBcfq6/fxGSP0oPRI6DW6rc8AZxkjEfuQr+FzZJQ/3VrwiuknaQ9ziOAxtvjmgeUbspt1KGClgeBWBIbl8EyjG/DhwRw1L/4WHiU1umt0HmwJWziFDgbIc1x75MMmnWpm/8rtzET6miTxompst79DBL0/dWuyKE7SRvt9DOtHpBPgVg2FCNMoyxzQcjUhiWrAU42CZ4U9AfeCUaQcDtJ/emhvscnUfzSXymzprgAmr8dAF; 25:Rm8xqyClXMRlDWa8DnTs7Sni/PWeiv5Dh5TN/dac3yV3dJ+MauSx0I44KJ53aoB/0NFzNTi34gmpIstUAhS1sn3hZarkneh1pa9VzpA8pKAcwKOUtAEHs72XcPn6+jRO9rgsBrC9OVwnctHlpdLqvTW1ZkpuuG+rCrNoXPvDxKVPjFosY1mqxa4T7SVUBIJJ1iXJ0W4ImTSRxfNWLevOEZsPzhM/sP15m++ihXn8C7Arnef+LnlwagvujSnmGY9LMJQBz9jitVVJxTau+wj+3qMr9rysSaxAmilaIrq6nxfyCbpDOpM796oTD8E3JbWXn27MlCYuxtTn9pg7GNRDHQ==; 31:2y/Sibc7GZ6H49Ua2/+c15xdaegwQDUetRxTwZqh4O4Ki2ybbNpKxSvb4uicemGYB/oNfM620grlR9cPSmW9L8Ocw74xOEHwLzARklRPOylTwnzknvdVxqs+N6yIPlnwMc0DLJZ3zdgC3ZfRTBVGE6zmHg4ozI7M0TYDDi8Em1nNzLHsfMfoNoAfLefKpHUHBUOAtIA7kBHQzuD0nVThh857D7Es1zD5K9YMfXzsfWo= X-MS-TrafficTypeDiagnostic: VI1PR05MB4192: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 20:RcqcWHXnSKKUtZNZjOoJB2Fjy0L3WI5w2INmuXvRiubKC4sxs72tnwuQrq0Bn9bvR5JJauxqDYqxqQLh7I8YJt5wmiO/PXptqLJnBIRkM2nfgS96uCiokbRBul9T1QDgpyKvx1dd9AsvPKp1AxIPh7Z4K30nI42sIlB348qlw60S00UsNC4ih37W04ZtX3gXl2nQj+hhqfByt5OA4QrSkJDNNdlOjSDn9QgDT+dPa2StGjbCOJvgzC2qpVexhCgF3CtoShoIPTat+hyRKwfdI4xkfgBW0A/WnuiZZ6lGn1Rhvt75VJumtDNi62fPkW5m8riO42OCVkybYBfwyOtYmsUbyqe/YLGT5C+51TBGDImKOVaFnCgFY8sA8AFkoJ6xSzLODn7J4bdDDPmeuU9n+4iiu7m1Wh709WlRBlohmy8+LRaAKpODVHg0CXrX3YPJJaaj6R77VtD0MAczcwqbf0NYYMhPJ1seMlEKAH9Zm0BxStnLvGaruWsm5WHHRTC9; 4:BRh5e2P8cMoUBP2vqbeY/9k18syqDA3dh1S0sTZKo1k1oNCLNNh5faVrtzk/PvvmeuUFsQyUKmWH+9UoWi2TdKXEt0hnhP6aXZRc0Cj60KcYfNF1iXGEWOsct2vC1On1FXpzODK+EyH5rAfOJh3RZOTqixu69guOdc1pRW6KLQAbe4ep0d/ujywGOxF2kX/Of11B4xZeXS1PzOE52gzzodpwXRIIXz4pVp3CirO4boNtXwG8fe0d44nPT2BSpB+L1dQTUZizvlAzDBbAHdQIAg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4192; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4192; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(136003)(346002)(366004)(39860400002)(189003)(199004)(2616005)(6862004)(118296001)(105586002)(66066001)(14444005)(106356001)(2351001)(52116002)(47776003)(186003)(51416003)(486006)(16526019)(53936002)(476003)(956004)(446003)(11346002)(386003)(25786009)(478600001)(97736004)(81156014)(6496006)(6486002)(6636002)(8936002)(81166006)(86362001)(8676002)(76176011)(6666003)(305945005)(50466002)(58126008)(48376002)(37006003)(36756003)(16586007)(316002)(68736007)(7736002)(2906002)(5660300001)(26005)(3846002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4192; 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; VI1PR05MB4192; 23:Mzk46SefwlEGUnBiBHjf1GzKywk/FfNcMPAQOHzbv?= NGBl8GF7ukXjxaIcOtLf8oRekKqlxBv2Qsln6yyFLa3Y0FGABi0L/qBE57YBtvGif70i0oq7qS3ibA/L3EBz8ej6FYGjmA2o7GQeOfkJvMypZ98r0ZEGLPJ2rxR6QQF4Exx9HforoIWkWDrX4zykw2KsrGDB5j+2bzERNiJa/azzWNkGH8/Gv3kaFgeXLMM6QA+2uqMQoUKiGVejQiaTZ4ZxMitDM2MVvV7HULShnAVKwpiE/yYwmypHdaG9h1RlaM15XyXkPDWQF028c2dTQQqGRhmboKeIzYLv1Z4CJeVaBA8QQKjzLIUrrctR7XlU0tGhrslBbMGLo/bVrO37eRQ7luho8ylPO7aubfw6JlkmlGJ4EdlyRNqH41EgNIC0L/sTUpzNerLv15Wh57hsSP55V7MLrTBI6TmX5LUjR81ovlQwB+5RYPYw/VZvg7oWDPnPqr5qOyj8Pqu1bGrQeBI92Szo353AoPELeyLbuAqlX8414TBm2nUpJjKJQe7nWqqDtagugdQZgtlQtznl3i8ZPK4+ylbYPtpcL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 6:AGDEhdeCoTuVbWz6QPhUEb+tFzoB8ZaDyptM9okPriiDf6NaAZzqJdN8u+6qTJMZb5baLyHZCJkSOYn430xhhMwy7yvUcQc7f517+oUrFDD9KQ0BVi/lXKtj/2vHe1wPk59LuGe4TUwxRCMj6nxSKivwg5c2Cc2RUl1afGP3rdtM3qr2UZ7DgtUa4Ji+qPbinS5/5AghsML0sVfutH733oLubJ73m34Dd3KvR0yqHAnu0iUk/dud6AvGuLqYclsHCqq/wt/2UMm2TIqlhvFMK7rVBiTi0GFgjZwWNmaeeVlMuM845RqwbfKEp2tSIoGbSGhu86eCBya8zjEZiJi48wK3WXCQ8Zs4TRfgUbogb2/rrN+M0QuZ2i45IeOQtk7UAiHKWB7pXOwbcLz8UapUG/gC2TyGCxABv1eAP9Qbl2ReOi7+qYabddy0yrX7zAKTTH0jbw579vVam2JlLcoYiA==; 5:71ZmVl1IOPZLnHerRrRoIrrScdNdpc1SFfNXaDdXqIUM7Qe2PZOGrh3QQMhsUQ+MtgKUUVW69+S7kmJrvb0XEeMebXp2xxRUrHSBEaH+nPOK1Wrci40qmCLKcGeLvsVHOG2voEprIv0Ka3hFiEty5i7W6OI30IFkG1EiD6qpBYw=; 7:tgi1DmGU1nbgXvRhXC/O9FE6B32hX/Ighrqm30OIgL200CaJnPDXhpAA9jW+BQmFGcFM1nDbZb7jJVR/xJrP0KgbQ9c0am1FeXa/gGOR2iBdGciVa0UaH9z2Za6BJTjCVfL+dJZnXXQfS1DINT1dLvuG9dvIlgVqwa/sJak8M7xQ8SnoerqvAVvCB0lLIbyslBymRbEM42+T1yQhtuNlFm6qtmwLZ1lduJk1J4nEbi4vMAu7/BGReiAn1G0HikrA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:54.8298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b559db4-ac4f-4ad1-8a60-08d5f2360ff7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4192 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 This register controls mapping from Priority to DSCP for purposes of rewrite. Note that rewrite happens as the packet is transmitted provided that the DSCP rewrite bit is enabled for the packet. Signed-off-by: Petr Machata --- Notes: Changes from v1 to v2: - Update commit message to describe when the rewrite is done. drivers/net/ethernet/mellanox/mlxsw/reg.h | 89 +++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 14e75b8afcfa..ed92f9809f2c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3120,6 +3120,94 @@ static inline void mlxsw_reg_qrwe_pack(char *payload, u8 local_port, mlxsw_reg_qrwe_dscp_set(payload, rewrite_dscp); } +/* QPDSM - QoS Priority to DSCP Mapping + * ------------------------------------ + * QoS Priority to DSCP Mapping Register + */ +#define MLXSW_REG_QPDSM_ID 0x4011 +#define MLXSW_REG_QPDSM_BASE_LEN 0x04 /* base length, without records */ +#define MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN 0x4 /* record length */ +#define MLXSW_REG_QPDSM_PRIO_ENTRY_REC_MAX_COUNT 16 +#define MLXSW_REG_QPDSM_LEN (MLXSW_REG_QPDSM_BASE_LEN + \ + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN * \ + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_MAX_COUNT) + +MLXSW_REG_DEFINE(qpdsm, MLXSW_REG_QPDSM_ID, MLXSW_REG_QPDSM_LEN); + +/* reg_qpdsm_local_port + * Local Port. Supported for data packets from CPU port. + * Access: Index + */ +MLXSW_ITEM32(reg, qpdsm, local_port, 0x00, 16, 8); + +/* reg_qpdsm_prio_entry_color0_e + * Enable update of the entry for color 0 and a given port. + * Access: WO + */ +MLXSW_ITEM32_INDEXED(reg, qpdsm, prio_entry_color0_e, + MLXSW_REG_QPDSM_BASE_LEN, 31, 1, + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN, 0x00, false); + +/* reg_qpdsm_prio_entry_color0_dscp + * DSCP field in the outer label of the packet for color 0 and a given port. + * Reserved when e=0. + * Access: RW + */ +MLXSW_ITEM32_INDEXED(reg, qpdsm, prio_entry_color0_dscp, + MLXSW_REG_QPDSM_BASE_LEN, 24, 6, + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN, 0x00, false); + +/* reg_qpdsm_prio_entry_color1_e + * Enable update of the entry for color 1 and a given port. + * Access: WO + */ +MLXSW_ITEM32_INDEXED(reg, qpdsm, prio_entry_color1_e, + MLXSW_REG_QPDSM_BASE_LEN, 23, 1, + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN, 0x00, false); + +/* reg_qpdsm_prio_entry_color1_dscp + * DSCP field in the outer label of the packet for color 1 and a given port. + * Reserved when e=0. + * Access: RW + */ +MLXSW_ITEM32_INDEXED(reg, qpdsm, prio_entry_color1_dscp, + MLXSW_REG_QPDSM_BASE_LEN, 16, 6, + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN, 0x00, false); + +/* reg_qpdsm_prio_entry_color2_e + * Enable update of the entry for color 2 and a given port. + * Access: WO + */ +MLXSW_ITEM32_INDEXED(reg, qpdsm, prio_entry_color2_e, + MLXSW_REG_QPDSM_BASE_LEN, 15, 1, + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN, 0x00, false); + +/* reg_qpdsm_prio_entry_color2_dscp + * DSCP field in the outer label of the packet for color 2 and a given port. + * Reserved when e=0. + * Access: RW + */ +MLXSW_ITEM32_INDEXED(reg, qpdsm, prio_entry_color2_dscp, + MLXSW_REG_QPDSM_BASE_LEN, 8, 6, + MLXSW_REG_QPDSM_PRIO_ENTRY_REC_LEN, 0x00, false); + +static inline void mlxsw_reg_qpdsm_pack(char *payload, u8 local_port) +{ + MLXSW_REG_ZERO(qpdsm, payload); + mlxsw_reg_qpdsm_local_port_set(payload, local_port); +} + +static inline void +mlxsw_reg_qpdsm_prio_pack(char *payload, unsigned short prio, u8 dscp) +{ + mlxsw_reg_qpdsm_prio_entry_color0_e_set(payload, prio, 1); + mlxsw_reg_qpdsm_prio_entry_color0_dscp_set(payload, prio, dscp); + mlxsw_reg_qpdsm_prio_entry_color1_e_set(payload, prio, 1); + mlxsw_reg_qpdsm_prio_entry_color1_dscp_set(payload, prio, dscp); + mlxsw_reg_qpdsm_prio_entry_color2_e_set(payload, prio, 1); + mlxsw_reg_qpdsm_prio_entry_color2_dscp_set(payload, prio, dscp); +} + /* QPDPM - QoS Port DSCP to Priority Mapping Register * -------------------------------------------------- * This register controls the mapping from DSCP field to @@ -8384,6 +8472,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(qtct), MLXSW_REG(qeec), MLXSW_REG(qrwe), + MLXSW_REG(qpdsm), MLXSW_REG(qpdpm), MLXSW_REG(pmlp), MLXSW_REG(pmtu), From patchwork Wed Jul 25 13:53:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544049 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 C416B139A for ; Wed, 25 Jul 2018 13:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B06B32A02A for ; Wed, 25 Jul 2018 13:54:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A47312A07B; Wed, 25 Jul 2018 13:54:19 +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 8935E2A02A for ; Wed, 25 Jul 2018 13:54:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGtJ5gm1zDrTP for ; Wed, 25 Jul 2018 23:54:16 +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="IxG5Acst"; 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=104.47.0.55; helo=eur01-he1-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="IxG5Acst"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0055.outbound.protection.outlook.com [104.47.0.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGt85c6GzDrdf for ; Wed, 25 Jul 2018 23:54:08 +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=VZ11z7TjabKtvEZBf7HTTsqa+0uIzI8Gq2L+d+6H4xk=; b=IxG5Acstp3vsCq3E1ZcVB88FQkxTvN+SnSAk1k+DWEjAUQ6ASRlBcJ/HF0wbUXWfahSnGmPyyv1RvDnZzVd8EpqzDjuGuULJrT9jqvZ0cENbtPMNgDXIfF8XOKTGqy95avEIbJs0MPlDjAC+8Dfn5bxxz2PoJyGBQUeOz8NASW0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Wed, 25 Jul 2018 13:54:01 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 7/8] mlxsw: spectrum: Support ieee_setapp, ieee_delapp In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:55 +0200 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: VI1PR04CA0094.eurprd04.prod.outlook.com (2603:10a6:803:64::29) To VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd7fa89d-7c53-4df9-a7d6-08d5f236138e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4190; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 3:GXryr7wxvQQF3y/deb2RFD52dmmhpaZ6yY1XOjvhP1wrjb7Sm/xssXVz4u0gIp2Fz1sJaHUQWw5J2aM/tmxC6i6Ek6G96kWmBr9d7FEtO9fqE/Blj92NGYlNpy2NBrDXHnI0xviuUjPQmEJ4dSgYQUv2t5og5whsRXqTRu6lufUgTBuvHLwMZKD3VJNp/ty6I/BuqPDxMt7uSyGT/XxCLnVTw67hytz7N92hRu5faZZK6db/SDrMYO5rTIdkxVkB; 25:Sl/RkAYMcEiJ06YCn4lF8M5/Ce3bIlJnWT2nV1ISjG8Xp0o3xarqFxoZ0nPa7vd/pghiHqAAVMURBLvBJcMuS91Zqvw+se/KL7rPD5QIa0BbvvbfnHkK8dUOHqxLYEgELK+i46Rpg6OFN3JeDuyEbj2hfdvtRdegHKx1TzQvPEqvfQNecqmWWIT3wVvmJEqfKl6o2QSPVaf4e8H+Q1S5Ip5Ow0XhIWFCSZyu3vVbQOVSblwr9zSSj/WkbW/h8AUNyO15szoZ+aEXc0wxTLMike3ag74b0HEL0BlWih+QbflI541Gm2X0zUrabmclqgmuAskPSG0QyBWd+8IAKH+CMQ==; 31:5kYt9BhM8gHgtp/hpNsBjg/A+H1X7pCok6iZUlmP/qPsebnDIEFaZE6yDq9Tf59o3VWO8IPV9uwXUX1vlRmQkMAcR8kplYzJXQp8oskacQQg2P1x/bbnfKfQe5jpWWG6UJftRgCBsSRskBSc8mSoJP7Xu6i7ZlM4I4bma51tAK2DMgz5kc+XBFO0FQzWXjv1HskGXyEBLBHEpxVR02gQKxnP5lEevmGAMXusjL5FY30= X-MS-TrafficTypeDiagnostic: VI1PR05MB4190: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 20:KrAejBTRMIUzUJjyzVBEDLEDFx68R7m6EN7Gg7xMxGVecPAxUCkSXVWONUXpSv3/fkNghDTW4W26VdbUCkl/mtzChMSRwTXsnf9HOYUFSfHtOM5Q3vNHK9SSRAVT0BdJGPC5/PMk4rZL73zSj1t9TycrphJFrGGpCfEOmWy43XMpmJxnPf2Ojl7q53zraWWXdFFvIN7B0YmsOlqj8dZfYJD7pdS/HVc/7ugD/wF1oLynILlkuCQGUnNpSLF4i4y47v6YtjifhqOQMjaSDITo3Q04RCaGqBq7yAWVeizwic+TvWqyarDyfi5sLG1Xy6jaM9OPtrbjuEUyVpzDZUSJABArZBL5p4X4EgsGIKXMZNYK6tfejYTlGHyqS12uGcOmZdYZ8rRX5nOCS5BAX7O7FQZzm4mb+W6z6/dSxJuul8qtSZFWvf0BcyBcD5re00FQI6ia3gLdXjkAZQQ5jhCcgDBGOEnHaLvH6+crnAdENpP8xT9a/rfb/IAJKvY4Hvum; 4:KlJoyHmC0mu6rIFiX/HTke88H2rOgzTQ7cu2FG9otptfNh+/1KCP4S88t0WQyDVUXGeuOYyWrVW03PARDQdgmqvGRzobRzPgapSfEctloJCTUidIo4VjIQRF3RUbIUOz+XODy/6SpVS8ygthtdHFtjLtDW8tWtV5+oarXGQNl6R1GaMcekozy174vkMOIrSS/js6hkKdkC+PWjdIV8TmFytLLVPbuhyv0T48Bfc977JeYV8ljBM6/YDfiSnx31UYxfE9uQeLAS3Gq+DcqSOmcQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4190; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4190; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(136003)(366004)(39860400002)(199004)(189003)(118296001)(2351001)(25786009)(6862004)(47776003)(478600001)(53936002)(3846002)(6116002)(446003)(26005)(52116002)(6496006)(51416003)(66066001)(37006003)(316002)(58126008)(14444005)(76176011)(476003)(305945005)(16526019)(16586007)(86362001)(956004)(11346002)(2616005)(186003)(106356001)(105586002)(8676002)(5660300001)(486006)(2906002)(6666003)(6636002)(81156014)(8936002)(6486002)(68736007)(50466002)(97736004)(48376002)(81166006)(36756003)(7736002)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4190; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4190; 23:CbA3dMp9yKWZY0Mv95frxOMEvEvj9DYo40wtVwxi4?= 9Dw2ElD0OyAL5S6pTcWDnTzRrrQcBhBM6Zqqfz2zQz4Wdh2xqU/k8idwTYbFLlNELctWNPfE95YFDMdDRSG1HWz/TPvQXRzC8y0rXqrmjDIcthu/Dvdm0HXnQeTUZZavQ3alQcHzLHVM7kUVQra0hk72GE2JIvaCvOQHc+PedMtXRfFQvAm1W1ng6WoXESJ08IWkfazcL1VmDIHBDrKrD3GF0KZ59rJVqu/WlYxrUfRtMms1bgOR2V397YnpM1aY2fkaeSUafk3ErYU9vE/rojLR0Mx6H1JmuHKngqXLcb4zbEqQnNTAr5iGgQ3Xa9MfVF6cUxbTDndlcgjn4k1cNly8kN2Ppn3Iu3aU0Y7mzOMuvA7TZZ5quSEtkpElxiwY2fUTNOG6KvyUbR6dquz7t0lIOt5dQ2zpBYGnoIErz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Metadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:54:01.1815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd7fa89d-7c53-4df9-a7d6-08d5f236138e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4190 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 The APP TLVs are used for communicating priority-to-protocol ID maps for a given netdevice. Support the following APP TLVs: - DSCP (selector 5) to configure priority-to-DSCP code point maps. Use these maps to configure packet priority on ingress, and DSCP code point rewrite on egress. - Default priority (selector 1, PID 0) to configure priority for the DSCP code points that don't have one assigned by the DSCP selector. In future this could also be used for assigning default port priority when a packet arrives without DSCP tagging. Besides setting up the maps themselves, also configure port trust level and rewrite bits. Port trust level determines whether, for a packet arriving through a certain port, the priority should be determined based on PCP or DSCP header fields. So far, mlxsw kept the device default of trust-PCP. Now, as soon as the first DSCP APP TLV is configured, switch to trust-DSCP. Only when all DSCP APP TLVs are removed, switch back to trust-PCP again. Note that the default priority APP TLV doesn't impact the trust level configuration. Rewrite bits determine whether DSCP and PCP fields of egressing packets should be updated according to switch priority. When port trust is switched to DSCP, enable rewrite of DSCP field. Signed-off-by: Petr Machata --- Notes: Changes from v1 to v2: - s/8/IEEE_8021QAZ_MAX_TCS/ - In mlxsw_sp_port_dcb_app_update(): - Don't unnecessarily initialize have_dscp - Rewrite if(have_dscp){Y} if(!have_dscp){Z} to if(have_dscp){return Y} Z drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 4 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c | 269 ++++++++++++++++++++- 2 files changed, 271 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 016058961542..3899f04e4b66 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -1,6 +1,6 @@ /* * drivers/net/ethernet/mellanox/mlxsw/spectrum.h - * Copyright (c) 2015-2017 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * Copyright (c) 2015-2017 Jiri Pirko * Copyright (c) 2015 Ido Schimmel * Copyright (c) 2015 Elad Raz @@ -54,6 +54,7 @@ #include "core.h" #include "core_acl_flex_keys.h" #include "core_acl_flex_actions.h" +#include "reg.h" #define MLXSW_SP_FID_8021D_MAX 1024 @@ -243,6 +244,7 @@ struct mlxsw_sp_port { struct ieee_ets *ets; struct ieee_maxrate *maxrate; struct ieee_pfc *pfc; + enum mlxsw_reg_qpts_trust_state trust_state; } dcb; struct { u8 module; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c index b6ed7f7c531e..c31aeb25ab5a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c @@ -1,6 +1,6 @@ /* * drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c - * Copyright (c) 2016 Mellanox Technologies. All rights reserved. + * Copyright (c) 2016-2018 Mellanox Technologies. All rights reserved. * Copyright (c) 2016 Ido Schimmel * * Redistribution and use in source and binary forms, with or without @@ -255,6 +255,270 @@ static int mlxsw_sp_dcbnl_ieee_setets(struct net_device *dev, return 0; } +static int mlxsw_sp_dcbnl_app_validate(struct net_device *dev, + struct dcb_app *app) +{ + int prio; + + if (app->priority >= IEEE_8021QAZ_MAX_TCS) { + netdev_err(dev, "APP entry with priority value %u is invalid\n", + app->priority); + return -EINVAL; + } + + switch (app->selector) { + case IEEE_8021QAZ_APP_SEL_DSCP: + if (app->protocol >= 64) { + netdev_err(dev, "DSCP APP entry with protocol value %u is invalid\n", + app->protocol); + return -EINVAL; + } + + /* Warn about any DSCP APP entries with the same PID. */ + prio = fls(dcb_ieee_getapp_mask(dev, app)); + if (prio--) { + if (prio < app->priority) + netdev_warn(dev, "Choosing priority %d for DSCP %d in favor of previously-active value of %d\n", + app->priority, app->protocol, prio); + else if (prio > app->priority) + netdev_warn(dev, "Ignoring new priority %d for DSCP %d in favor of current value of %d\n", + app->priority, app->protocol, prio); + } + break; + + case IEEE_8021QAZ_APP_SEL_ETHERTYPE: + if (app->protocol) { + netdev_err(dev, "EtherType APP entries with protocol value != 0 not supported\n"); + return -EINVAL; + } + break; + + default: + netdev_err(dev, "APP entries with selector %u not supported\n", + app->selector); + return -EINVAL; + } + + return 0; +} + +static u8 +mlxsw_sp_port_dcb_app_default_prio(struct mlxsw_sp_port *mlxsw_sp_port) +{ + u8 prio_mask; + + prio_mask = dcb_ieee_getapp_default_prio_mask(mlxsw_sp_port->dev); + if (prio_mask) + /* Take the highest configured priority. */ + return fls(prio_mask) - 1; + + return 0; +} + +static void +mlxsw_sp_port_dcb_app_dscp_prio_map(struct mlxsw_sp_port *mlxsw_sp_port, + u8 default_prio, + struct dcb_ieee_app_dscp_map *map) +{ + int i; + + dcb_ieee_getapp_dscp_prio_mask_map(mlxsw_sp_port->dev, map); + for (i = 0; i < ARRAY_SIZE(map->map); ++i) { + if (map->map[i]) + map->map[i] = fls(map->map[i]) - 1; + else + map->map[i] = default_prio; + } +} + +static bool +mlxsw_sp_port_dcb_app_prio_dscp_map(struct mlxsw_sp_port *mlxsw_sp_port, + struct dcb_ieee_app_prio_map *map) +{ + bool have_dscp = false; + int i; + + dcb_ieee_getapp_prio_dscp_mask_map(mlxsw_sp_port->dev, map); + for (i = 0; i < ARRAY_SIZE(map->map); ++i) { + if (map->map[i]) { + map->map[i] = fls64(map->map[i]) - 1; + have_dscp = true; + } + } + + return have_dscp; +} + +static int +mlxsw_sp_port_dcb_app_update_qpts(struct mlxsw_sp_port *mlxsw_sp_port, + enum mlxsw_reg_qpts_trust_state ts) +{ + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; + char qpts_pl[MLXSW_REG_QPTS_LEN]; + + mlxsw_reg_qpts_pack(qpts_pl, mlxsw_sp_port->local_port, ts); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpts), qpts_pl); +} + +static int +mlxsw_sp_port_dcb_app_update_qrwe(struct mlxsw_sp_port *mlxsw_sp_port, + bool rewrite_dscp) +{ + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; + char qrwe_pl[MLXSW_REG_QRWE_LEN]; + + mlxsw_reg_qrwe_pack(qrwe_pl, mlxsw_sp_port->local_port, + false, rewrite_dscp); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qrwe), qrwe_pl); +} + +static int +mlxsw_sp_port_dcb_toggle_trust(struct mlxsw_sp_port *mlxsw_sp_port, + enum mlxsw_reg_qpts_trust_state ts) +{ + bool rewrite_dscp = ts == MLXSW_REG_QPTS_TRUST_STATE_DSCP; + int err; + + if (mlxsw_sp_port->dcb.trust_state == ts) + return 0; + + err = mlxsw_sp_port_dcb_app_update_qpts(mlxsw_sp_port, ts); + if (err) + return err; + + err = mlxsw_sp_port_dcb_app_update_qrwe(mlxsw_sp_port, rewrite_dscp); + if (err) + goto err_update_qrwe; + + mlxsw_sp_port->dcb.trust_state = ts; + return 0; + +err_update_qrwe: + mlxsw_sp_port_dcb_app_update_qpts(mlxsw_sp_port, + mlxsw_sp_port->dcb.trust_state); + return err; +} + +static int +mlxsw_sp_port_dcb_app_update_qpdpm(struct mlxsw_sp_port *mlxsw_sp_port, + struct dcb_ieee_app_dscp_map *map) +{ + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; + char qpdpm_pl[MLXSW_REG_QPDPM_LEN]; + short int i; + + mlxsw_reg_qpdpm_pack(qpdpm_pl, mlxsw_sp_port->local_port); + for (i = 0; i < ARRAY_SIZE(map->map); ++i) + mlxsw_reg_qpdpm_dscp_pack(qpdpm_pl, i, map->map[i]); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpdpm), qpdpm_pl); +} + +static int +mlxsw_sp_port_dcb_app_update_qpdsm(struct mlxsw_sp_port *mlxsw_sp_port, + struct dcb_ieee_app_prio_map *map) +{ + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; + char qpdsm_pl[MLXSW_REG_QPDSM_LEN]; + short int i; + + mlxsw_reg_qpdsm_pack(qpdsm_pl, mlxsw_sp_port->local_port); + for (i = 0; i < ARRAY_SIZE(map->map); ++i) + mlxsw_reg_qpdsm_prio_pack(qpdsm_pl, i, map->map[i]); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qpdsm), qpdsm_pl); +} + +static int mlxsw_sp_port_dcb_app_update(struct mlxsw_sp_port *mlxsw_sp_port) +{ + struct dcb_ieee_app_prio_map prio_map; + struct dcb_ieee_app_dscp_map dscp_map; + u8 default_prio; + bool have_dscp; + int err; + + default_prio = mlxsw_sp_port_dcb_app_default_prio(mlxsw_sp_port); + have_dscp = mlxsw_sp_port_dcb_app_prio_dscp_map(mlxsw_sp_port, + &prio_map); + + if (!have_dscp) { + err = mlxsw_sp_port_dcb_toggle_trust(mlxsw_sp_port, + MLXSW_REG_QPTS_TRUST_STATE_PCP); + if (err) + netdev_err(mlxsw_sp_port->dev, "Couldn't switch to trust L2\n"); + return err; + } + + mlxsw_sp_port_dcb_app_dscp_prio_map(mlxsw_sp_port, default_prio, + &dscp_map); + err = mlxsw_sp_port_dcb_app_update_qpdpm(mlxsw_sp_port, + &dscp_map); + if (err) { + netdev_err(mlxsw_sp_port->dev, "Couldn't configure priority map\n"); + return err; + } + + err = mlxsw_sp_port_dcb_app_update_qpdsm(mlxsw_sp_port, + &prio_map); + if (err) { + netdev_err(mlxsw_sp_port->dev, "Couldn't configure DSCP rewrite map\n"); + return err; + } + + err = mlxsw_sp_port_dcb_toggle_trust(mlxsw_sp_port, + MLXSW_REG_QPTS_TRUST_STATE_DSCP); + if (err) { + /* A failure to set trust DSCP means that the QPDPM and QPDSM + * maps installed above are not in effect. And since we are here + * attempting to set trust DSCP, we couldn't have attempted to + * switch trust to PCP. Thus no cleanup is necessary. + */ + netdev_err(mlxsw_sp_port->dev, "Couldn't switch to trust L3\n"); + return err; + } + + return 0; +} + +static int mlxsw_sp_dcbnl_ieee_setapp(struct net_device *dev, + struct dcb_app *app) +{ + struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); + int err; + + err = mlxsw_sp_dcbnl_app_validate(dev, app); + if (err) + return err; + + err = dcb_ieee_setapp(dev, app); + if (err) + return err; + + err = mlxsw_sp_port_dcb_app_update(mlxsw_sp_port); + if (err) + goto err_update; + + return 0; + +err_update: + dcb_ieee_delapp(dev, app); + return err; +} + +static int mlxsw_sp_dcbnl_ieee_delapp(struct net_device *dev, + struct dcb_app *app) +{ + struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); + int err; + + err = dcb_ieee_delapp(dev, app); + if (err) + return err; + + err = mlxsw_sp_port_dcb_app_update(mlxsw_sp_port); + if (err) + netdev_err(dev, "Failed to update DCB APP configuration\n"); + return 0; +} + static int mlxsw_sp_dcbnl_ieee_getmaxrate(struct net_device *dev, struct ieee_maxrate *maxrate) { @@ -394,6 +658,8 @@ static const struct dcbnl_rtnl_ops mlxsw_sp_dcbnl_ops = { .ieee_setmaxrate = mlxsw_sp_dcbnl_ieee_setmaxrate, .ieee_getpfc = mlxsw_sp_dcbnl_ieee_getpfc, .ieee_setpfc = mlxsw_sp_dcbnl_ieee_setpfc, + .ieee_setapp = mlxsw_sp_dcbnl_ieee_setapp, + .ieee_delapp = mlxsw_sp_dcbnl_ieee_delapp, .getdcbx = mlxsw_sp_dcbnl_getdcbx, .setdcbx = mlxsw_sp_dcbnl_setdcbx, @@ -467,6 +733,7 @@ int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port) if (err) goto err_port_pfc_init; + mlxsw_sp_port->dcb.trust_state = MLXSW_REG_QPTS_TRUST_STATE_PCP; mlxsw_sp_port->dev->dcbnl_ops = &mlxsw_sp_dcbnl_ops; return 0; From patchwork Wed Jul 25 13:54:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544051 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 4C011112B for ; Wed, 25 Jul 2018 13:54:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39A232A02A for ; Wed, 25 Jul 2018 13:54:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DBEA2A07B; Wed, 25 Jul 2018 13:54:27 +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,LOTS_OF_MONEY,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 3A23D2A02A for ; Wed, 25 Jul 2018 13:54:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGtS3Dv1zDrdc for ; Wed, 25 Jul 2018 23:54:24 +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="Twzow3dd"; 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.5.52; helo=eur03-ve1-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="Twzow3dd"; dkim-atps=neutral Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50052.outbound.protection.outlook.com [40.107.5.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGtJ4NFTzDrTH for ; Wed, 25 Jul 2018 23:54:16 +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=w5Fb3N37N2RXg72cT6/Aeni8LMOTpirAbl4P4T2+uJ8=; b=Twzow3ddNGQfafBUtJ9o3ge34sijCI1f3DLO12DeCIiAKy4jAzewTYGrdSWtCnZQtxsI2kBBBtGkD2lyV8B8LmpdfyeUWvDdehtmmBN4JyMYvjsKPgT3LPwjFXXbO2xLr9MkoH1gbOTOROrtxLr0f1L3MQsK9TLIvO8w2X8zugY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4185.eurprd05.prod.outlook.com (2603:10a6:5:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.22; Wed, 25 Jul 2018 13:54:08 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 8/8] selftests: mlxsw: Add test for trust-DSCP In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:54:01 +0200 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: HE1PR02CA0117.eurprd02.prod.outlook.com (2603:10a6:7:29::46) To DB7PR05MB4185.eurprd05.prod.outlook.com (2603:10a6:5:18::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0180eb35-2192-4689-3941-08d5f2361838 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4185; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 3:JfmzviWf26wJGpBfAKmbyJkeZctnKtneuXjfAnq77Gytx2kt7NC2ENYxDMrsd8U3MfwUejgNvk194rFBrCGXBWw77STv55pbwwuskSAdJiKKRjeHlES6bfxgKL45ARXPnRIl3AskFYEq/nprjfAmuSk398BEnhiM66JwEEDr4blM0WTl7dUOJlsiHDw4bpz0vK4n/r8xNv6XN5AiVoCQ8FMrn58s1tqmWPYWnM0UJKavKBwmIiGO4w3r5EQvdFXS; 25:UENk9SKuFEsbsh+6LQVHorA4mahRmbRZUvu9I5qlTyeo+ICQksdMEznNtHPyAeYjFWsAoyXRO+sW/SyjNX9A6CBnT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; 4:equ+CEZurMak0F+9Ccs22x5U/68FchuluLCZeP4u5kPRduX4FN89kTOldtFCpk8klA2lVEGu0Xw8PNM5SuYHLoJ2rE7YaK2r8v8hwa1EaPK8MMQw/sQ096/GsSilWzhwn3PIXVQ6b2R7+Hu1kFqaqpET7h8hA/1CPiiCL6Xqz7rIFRSIKXwMc9qI4/nvQ/D7X/kBNndcP7BIHadR1GFjLPP5j3ax6z9yLVZ+bLp2v+dJtb+vx8lyAVsdahlZMQJNrlmCloSKYpww04MMdr7Hcpu4VZ6FCYWBTfCXUyxj24oQA2ZREoYI2PPEIrxSOlN1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(190756311086443); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4185; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4185; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(136003)(376002)(366004)(39860400002)(346002)(396003)(189003)(199004)(14444005)(575784001)(86362001)(53936002)(486006)(386003)(6862004)(6116002)(478600001)(5660300001)(3846002)(6666003)(6636002)(25786009)(68736007)(956004)(11346002)(476003)(446003)(2616005)(36756003)(76176011)(8676002)(118296001)(97736004)(105586002)(2906002)(305945005)(66066001)(2351001)(47776003)(81156014)(50466002)(81166006)(106356001)(8936002)(48376002)(51416003)(52116002)(7736002)(26005)(186003)(58126008)(37006003)(316002)(16586007)(6486002)(6496006)(16526019)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4185; 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; DB7PR05MB4185; 23:Ld1BD4vd2hTj9M9n2N+YED+nl5o+3nDQH5HPJYUzD?= KTzLLMTiF8QezLkMVHlMWr5daN6BvcHDQMDCv8OeQ5O34U9LW6Kh13fyxJSmYZ0v4Nsk5d2Ke2VdpdDQLaEKdj96NJ5qTExzteWV+sWkAiGqXIThCguKBsmRKHuejocyCyGGImnXBY7FFzE2vh+082iEqineOhNS1bd8fU/qeIVuICVOLJYYRxvDFWd3qLuCOwiGC9QY+AD86tuUA1NqsiUFKH5hqUtQEuop/cY9doQvSsHnkpnB+2ZTuqOgDEjy39CALXrlwHVcKAgAFSBKO7HjrYDrMnXJmE0uZXyUufNZHpNIKI1WljIj784uEh/wmaMnx+xgUJ1YRILITs/M/7p4uWDVYoxvo13CWaQKn2uMSTNUkx4e2JiSYXE2HxbR7orH6r0M9+HRAMy1KpjzzAnzvg7yhe1xL59bF7oKaNgvpPNyl8iIHn0zTR87mYqJeVtd6+sDDrT6MRURmFWbBU2+YF75TE+exLelaclMSwGs6hFHOZWCbzo6v+W7oO9LD+CERWqmFue0NblINUbg+mf/YgKqLkC4y5nE4FifTl41KU0MdxGoJlgtGNj7jQrqEQc9JzUOdwAw+Oj9h2a1HJ1vO32QeT+mGpCWV7+RaEvydM/2dUdkPKRi9ggfJ8Jp9Wblro9Zfy6bGRyJHbPSgcgceAdsJ8Uuhzd7uvQG8kqITAD8AuA6VYYk+WUjGybcT5Pk7BAX2W1z1WfaG5C6etoMjEAKUNniqGvTfvs84GRuufqTni5tT6xDEdSLf0K7voyVyrWtJd0z4pxbBds/RVT1cOQ5J6hlgQnLFW1FzHAM2P7IUtNJi5q8AEnoF7ETGguASMSVpq+wCS8r90Wh7CwATtKssX9GKS3Q37vDnpiNnxMLEhpQpx21oX17MvJQeJ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L/RZpBhyhAsUKvIQUUehzZYOi2/Ck+gZMvYPs5DIT6NNKuvTk76Wra7Sssqm+wQ+CuDmwNBWd2cFDvVw0Bwjx821mulnQNtdMQdwzxus62VSMV7WYUflirYJfmFglRmRIVgGx8rLSntWFuoKoYhRqVhWhBq2rEjs4Lkt4jxgQhzj6jCgNRRyxMOenyi3ZVm7gdlKtNZO/sb+JubiZ/AKML6m+FWMVySx0z9/9hNpb0SE1b4iwJX78y6p1w==; 5:/6PqzZ6GhyAaIGGR+89VML3rKf6HRMrfYXbFrpwogW0d+1UDRSHAT9rQBJgdPzjqqnNHxYtu0rbIhsoyW9rqJ4GXzRA6t7K44m4o5uEh++5WRPzohejJ1/n9cUb2Tv56pSldvoZEZKHoDEKTye1GdONRUBTuAPbA+hT8XEdr+iE=; 7:Xs0aias99lN5czHlL5JYjatnwkGzz4Gj1d6a0wtdnXUhEK6SfxkqY6jNPpi7llQ0iwIN4IHQ4L9yJYjo2ihZ6AI47CgthXtef490lTuwqRQYxvXIRwUz8lOm3H2F8uXfkvClQVmI9wAJiiralJ9iDWgJPcaMq4STDRgHIUU5rJb6GlMy6Zk6Z9bvMr3FjDBqJRbB60D00dzfbvdNBlLHfprwYeCP/iili3by+SHxHSQT7VHKzjuxKI11zmlilmHE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:54:08.3318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0180eb35-2192-4689-3941-08d5f2361838 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4185 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 Add a test that exercises the new code. Send DSCP-tagged packets, and observe how they are prioritized in the switch and the DSCP is updated on egress again. Signed-off-by: Petr Machata --- Notes: Changes from v1 to v2: - Fix asymmetry between h1_create and h1_destroy, likewise for h2 - Don't tolerate a couple stray extra packets. - Rename to qos_dscp_bridge.sh to recognize that this is the likely less common scenario that doesn't involve router. .../selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 248 +++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh new file mode 100755 index 000000000000..418319f19108 --- /dev/null +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh @@ -0,0 +1,248 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# Test for DSCP prioritization and rewrite. Packets ingress $swp1 with a DSCP +# tag and are prioritized according to the map at $swp1. They egress $swp2 and +# the DSCP value is updated to match the map at that interface. The updated DSCP +# tag is verified at $h2. +# +# ICMP responses are produced with the same DSCP tag that arrived at $h2. They +# go through prioritization at $swp2 and DSCP retagging at $swp1. The tag is +# verified at $h1--it should match the original tag. +# +# +----------------------+ +----------------------+ +# | H1 | | H2 | +# | + $h1 | | $h2 + | +# | | 192.0.2.1/28 | | 192.0.2.2/28 | | +# +----|-----------------+ +----------------|-----+ +# | | +# +----|----------------------------------------------------------------|-----+ +# | SW | | | +# | +-|----------------------------------------------------------------|-+ | +# | | + $swp1 BR $swp2 + | | +# | | APP=0,5,10 .. 7,5,17 APP=0,5,20 .. 7,5,27 | | +# | +--------------------------------------------------------------------+ | +# +---------------------------------------------------------------------------+ + +ALL_TESTS=" + ping_ipv4 + test_dscp +" + +lib_dir=$(dirname $0)/../../../net/forwarding + +NUM_NETIFS=4 +source $lib_dir/lib.sh + +__dscp_capture_add_del() +{ + local add_del=$1; shift + local dev=$1; shift + local base=$1; shift + local dscp; + + for prio in {0..7}; do + dscp=$((base + prio)) + __icmp_capture_add_del $add_del $dscp "" $dev \ + "ip_tos $((dscp << 2))" + done +} + +dscp_capture_install() +{ + local dev=$1; shift + local base=$1; shift + + __dscp_capture_add_del add $dev $base +} + +dscp_capture_uninstall() +{ + local dev=$1; shift + local base=$1; shift + + __dscp_capture_add_del del $dev $base +} + +h1_create() +{ + local dscp; + + simple_if_init $h1 192.0.2.1/28 + tc qdisc add dev $h1 clsact + dscp_capture_install $h1 10 +} + +h1_destroy() +{ + dscp_capture_uninstall $h1 10 + tc qdisc del dev $h1 clsact + simple_if_fini $h1 192.0.2.1/28 +} + +h2_create() +{ + simple_if_init $h2 192.0.2.2/28 + tc qdisc add dev $h2 clsact + dscp_capture_install $h2 20 +} + +h2_destroy() +{ + dscp_capture_uninstall $h2 20 + tc qdisc del dev $h2 clsact + simple_if_fini $h2 192.0.2.2/28 +} + +dscp_map() +{ + local base=$1; shift + + for prio in {0..7}; do + echo app=$prio,5,$((base + prio)) + done +} + +lldpad_wait() +{ + local dev=$1; shift + + while lldptool -t -i $dev -V APP -c app | grep -q pending; do + echo "$dev: waiting for lldpad to push pending APP updates" + sleep 5 + done +} + +switch_create() +{ + ip link add name br1 type bridge vlan_filtering 1 + ip link set dev br1 up + ip link set dev $swp1 master br1 + ip link set dev $swp1 up + ip link set dev $swp2 master br1 + ip link set dev $swp2 up + + lldptool -T -i $swp1 -V APP $(dscp_map 10) >/dev/null + lldptool -T -i $swp2 -V APP $(dscp_map 20) >/dev/null + lldpad_wait $swp1 + lldpad_wait $swp2 +} + +switch_destroy() +{ + lldptool -T -i $swp2 -V APP -d $(dscp_map 20) >/dev/null + lldptool -T -i $swp1 -V APP -d $(dscp_map 10) >/dev/null + + # Give lldpad a chance to push down the changes. If the device is downed + # too soon, the updates will be left pending, but will have been struck + # off the lldpad's DB already, and we won't be able to tell. Then on + # next test iteration this would cause weirdness as newly-added APP + # rules conflict with the old ones, sometimes getting stuck in an + # "unknown" state. + sleep 5 + + ip link set dev $swp2 nomaster + ip link set dev $swp1 nomaster + ip link del dev br1 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + swp2=${NETIFS[p3]} + h2=${NETIFS[p4]} + + vrf_prepare + + h1_create + h2_create + switch_create +} + +cleanup() +{ + pre_cleanup + + switch_destroy + h2_destroy + h1_destroy + + vrf_cleanup +} + +dscp_fetch_stats() +{ + local dev=$1; shift + local base=$1; shift + + for prio in {0..7}; do + local dscp=$((base + prio)) + local t=$(tc_rule_stats_get $dev $dscp) + echo "[$dscp]=$t " + done +} + +ping_ipv4() +{ + ping_test $h1 192.0.2.2 +} + +dscp_ping_test() +{ + local vrf_name=$1; shift + local sip=$1; shift + local dip=$1; shift + local prio=$1; shift + local dev_10=$1; shift + local dev_20=$1; shift + + local dscp_10=$(((prio + 10) << 2)) + local dscp_20=$(((prio + 20) << 2)) + + RET=0 + + local -A t0s + eval "t0s=($(dscp_fetch_stats $dev_10 10) + $(dscp_fetch_stats $dev_20 20))" + + ip vrf exec $vrf_name \ + ${PING} -Q $dscp_10 ${sip:+-I $sip} $dip \ + -c 10 -i 0.1 -w 2 &> /dev/null + + local -A t1s + eval "t1s=($(dscp_fetch_stats $dev_10 10) + $(dscp_fetch_stats $dev_20 20))" + + for key in ${!t0s[@]}; do + local expect + if ((key == dscp_10 || key == dscp_20)); then + expect=10 + else + expect=0 + fi + + local delta=$((t1s[key] - t0s[key])) + ((expect == delta)) + check_err $? "DSCP $key: Expected to capture $expect packets, got $delta." + done + + log_test "DSCP rewrite: $dscp_10-(prio $prio)-$dscp_20" +} + +test_dscp() +{ + for prio in {0..7}; do + dscp_ping_test v$h1 192.0.2.1 192.0.2.2 $prio $h1 $h2 + done +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tests_run + +exit $EXIT_STATUS