From patchwork Fri Jul 27 19:09: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: 10547613 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 07283112E for ; Fri, 27 Jul 2018 19:10:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEA7D2C447 for ; Fri, 27 Jul 2018 19:10:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC5432C40C; Fri, 27 Jul 2018 19:10:14 +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 D1D302C447 for ; Fri, 27 Jul 2018 19:10:12 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdnv0HJ8zF0xF for ; Sat, 28 Jul 2018 05:10:11 +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="IG+LbsBD"; 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=2a01:111:f400:fe0e::61b; 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="IG+LbsBD"; dkim-atps=neutral Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::61b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cdnk5z25zF0jD for ; Sat, 28 Jul 2018 05:10:01 +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=pcHvaxhCdzHKGbiqJNOWOGCcMKn5gtoV3XsX9I4Rfuk=; b=IG+LbsBDamikGbH0hyp2LWWDtKZrEvCHCyb45SHu0cgdZY/RlXyOHPfc0a31zZXLG/GsUfbAyV6Ubt1NrrkxM3Zr00WMIEvG9G+21OEfs4JRwsf53aqcw3+toKKZlBzVuWIMulM0YM7B16do9uqjkv4pbDtWQGVdJb1KYVGSVbM= 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; Fri, 27 Jul 2018 19:09:54 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 01/10] net: dcb: For wild-card lookups, use priority -1, not 0 In-Reply-To: References: Message-Id: <2d7a6afa765dfe6c346060bfda6dec01b361c51d.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:09: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: HE1PR0301CA0024.eurprd03.prod.outlook.com (2603:10a6:3:76::34) To DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e14bb550-8d09-4edf-f4d7-08d5f3f4898b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4186; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4186; 3:dFZz9TFcddhBq7+k2BWfD/2hQpk4bCQZ91TwMkxBiPU96K9jA5tYEIvOCuRkaC0/o2ixZFg/EsWYxc381EDuoYII3ivNnDKjcHBFG/24GbCA9atuyGSePVUwOTktSnBvtJI5A9cZH7Jpi9ykOyCTKjFJiwA92usKLW/fQzQhR4o4EYQUGhrm/Gt92QnLsDOISic1MHzRnejMWwMzRhNWglpjH54yJ9qqjlE6SDZztG4m4zlhxWJ9e3AyyAPDRIXF; 25:qqd5VtFsSI6PXTdazTqfrGSJPFpwJZanmR46l9i1dkKmcPPnfDGozgNvLbdOlnqSwCCcYjEew0zV3iOHf5NsJoiJ+FhjAax/q/ndOL23adg7T0f2oN1X6P/H76anrAMzq3nwtoec34HSC3ZOb/Tl1B+ufz5HARh2+mhuAwpQsY7op+dANj8ueayO+vb8hYc/yfNM36xphVMeL7fTobFxxyWCzryi+qe1JwsYdoqApGZK47nRhtsDJdgMhmJSWzupIFg242MJK4b16GvdrkPLhhl4bX3JjM/1Bn43E0C4yMBGIbvpVvppnMJ9co4n1UHcdGrNve7k9rwLHRGePsVhGw==; 31:RqCTWaJq54p/axuWwupBSLOyhNBNAXlB8s/xTBjwmm6dTjCfWf5J+YJdyOBF3OI9RuoqbHejksB1+62uV4l8qct6mc1UsxIDBlcaQUKGcBHanOLUpnkHBZujRvkJVWEQflAXlHxW3zygT7SYsnfeT9zl0gxu9kEWZNahFajeICmifWZZB3TWPawod7sy4SWxIW+cGB3CIzDB4vme+kdz9bR4+tF/rm1EaSky4TGotNk= X-MS-TrafficTypeDiagnostic: DB7PR05MB4186: X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4186; 20:P3VM3lHAqfmQMCAn6049QBiBAeJQnpK8EVTw+FAEDLJkP7PXjCrOaE50Jixl6ViSIBzSLQeRMSVJ0jLdd4YdfFGi3oL4dt04MSIS6A3O4Bux4zhDZ3KhBCCUZlZUwV33sClK88CDIEmk8iwy9nkRn9WSenvNcIdqa9Cdty/SN7csZEfZg1BxG6LF7wnqoEl5GERbRjqxlsYW2yD8YH7bM46G2G+DUf1azgGNBWe5oHQHYfwzm3h7JaStwNNyqqKCKTj9vWTdVdMP+flm5Lm+t9r8lNehc5UbeK6ih8G7KSTri8i6JQJes7BisxafIKQJiWoPZoPgB47FCJopJLhM5QaQ7lA+UA7PokHy0AbD5H2dgee5M9fc5GELns54N/vneV9MMmjnKaGle8aXd9ZrFoeEG91zfg05E2qYmArkMSg0uqTffQgMEYhsEhGpts6RTgMdeg8wB68MzwYS18gRp2XETnoEj/d6O7jMJHfHnC8HVHr79dtDXwwhcFJ/HJmN; 4:Z/83e6PZ0kaGyKH6yTid+ca84+rob2A1JojSQT6RS8m6dQentuyrICdVP5vJNX4ArLcMILga9blfZQ5rZNEFdzM9wpgfCpSb3HItcOF9u82I6i099fAy2tUsvysTirnG9uzyDNHpw1D3wm/sBvr9wXLA2LPOTSHtwsWael+l4gJWtGTaMBzT1QyFadht6Pc3B1SFnenHq+9oiCME7UMHEO8U/wAJ9OD9cRRuIBeuSAAfO5eGOu719iaBAxztmFpElPCU3IkOP1Hf2cVIZdZhALYKytm4H/zTC5ReHX0naQ+RE1wf6pjJTAFhGjb925fo 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)(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: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(366004)(396003)(376002)(346002)(189003)(199004)(16586007)(76176011)(6496006)(36756003)(6486002)(53936002)(48376002)(478600001)(97736004)(2351001)(6666003)(50466002)(8936002)(81166006)(118296001)(8676002)(106356001)(81156014)(25786009)(6862004)(68736007)(6636002)(2616005)(486006)(476003)(956004)(3846002)(6116002)(446003)(7736002)(66066001)(305945005)(186003)(16526019)(47776003)(105586002)(2906002)(51416003)(26005)(5660300001)(11346002)(316002)(86362001)(386003)(58126008)(37006003)(14444005)(52116002); 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:YqU8NFEDbyRxoitdTCp70Voq7zlooC1tyvTMogL0J?= rcA34c9AwQ8iPwOtZdM/z/tEo8SRWAFbTbnib5St21Bzf/iuc0D23Y+rFBqK16LTcuZKmq8s8sb0E4LOrV2Gzji9+Z9rKivdbxlXKrfJsZR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Emy9k0=; 7:+LqRtmui6KSnxhwB7OMzFO+XSekbJOWUKcgTBX5Ou+xmyrtl6LHUGSNkKXq/x4Qa9tB9fB/5qtTU4xR6Y6gxD2UMiXVzqIb5BSTCBsEmO4i9FGMfeCJVzvPuh/6xQ2rPtrX/GMsyqH2+/p/Hox/qMFdLLY+9HDqx1wJONmkS4oz+UKRwiXAnKMN0eSmhRBqYI9PHQR5AOJZUUlmVy0gKwZNJ4HDiOiz0wYFKGhewkDKcWDsILUlI7B0dcUhbZVs0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:09:54.0826 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e14bb550-8d09-4edf-f4d7-08d5f3f4898b 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 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 Reviewed-by: Ido Schimmel --- 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 Fri Jul 27 19:09: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: 10547619 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 B4581112E for ; Fri, 27 Jul 2018 19:10:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92F282C434 for ; Fri, 27 Jul 2018 19:10:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FCFC2C402; Fri, 27 Jul 2018 19:10:28 +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 C64032C40E for ; Fri, 27 Jul 2018 19:10:20 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdp251mCzF0q0 for ; Sat, 28 Jul 2018 05:10:18 +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="yZ3AjPM3"; 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.77; 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="yZ3AjPM3"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0077.outbound.protection.outlook.com [104.47.2.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cdnq3RWtzF0q0 for ; Sat, 28 Jul 2018 05:10:07 +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=tLnHV2Kv2bmfDzZcTq89ulG3IohOAZujEZDmSeaVSt4=; b=yZ3AjPM3ezktAtbcn0owojO50aJxfcJkLcHh+J027w6ex2DW7phiR334ExOyxXo2Sa5GTYXtcX4OryLVfU6sKVVoDgGOlp4uEXDpFdD4YMvQetyRqP3SBxlqubVjPPuHEcyiFz57hpiWOJqbPm0pwqm7BK7fmAe7qaIT2axKwCk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4182.eurprd05.prod.outlook.com (2603:10a6:209:40::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Fri, 27 Jul 2018 19:09:59 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 02/10] net: dcb: Add priority-to-DSCP map getters In-Reply-To: References: Message-Id: Date: Fri, 27 Jul 2018 21:09: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: AM5PR0701CA0002.eurprd07.prod.outlook.com (2603:10a6:203:51::12) To AM6PR05MB4182.eurprd05.prod.outlook.com (2603:10a6:209:40::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df726d7c-d878-4ace-f705-08d5f3f48ca2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4182; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4182; 3:2wHUVEE5r2RCRKZU3E8URS9PRBUPQTv/5/6/MikJPbfaEoi2oAnywggWnGyjGuHmzlj9UzNvQ7a2RnPBEjPIpJD/r/TbW7YKjet2Rs6ZaZvDbyMAab+6CKnPjSGt7gsmzi/NMJCdBtO82MEjCvcq/MRx7LxPEbB9QDZlpmvYPDM29QWqh7bYYj3jfgfClJDmxZXvCRApcbaIXetxIkjd9U2tafDFEOG1Owq3RRRsYhQN4MmqrYevL65zXRGgoY7R; 25:fWH8wmnbTrKZy1+VZgv0SowWS1NsTZoSAGzaRmff7rgp/GT82SMcjUq5+fHd4/6jpHIvJR4xd7orLzTYP41JJYThR5PhxDoY6DSnbiO847mab97O8WIPc/JAJyUBGuWevl9O77o4bidaGGkdtfl75mLxvX8i2k9MIHjxTukZMPlDvth+E1kTY7i2vdniAq8Wp/RFPPYnIn4cEPJL+5Gz9JTZtNAcdxp/UNK9vvWe9FY69ruYPYEOdVq9ac6vQBzW93noRQSMA+DNcy7JTjCOMJoxxqssHSwal+R2pxlAhGcvNUayUSJ+kJJgtBw5/79vQg+zBu1fwuwj9LX7gzhAnw==; 31:MNMd42FB5KijmyH21ceEsGDkSpWloc3Y+Oiz+q/n7R4l/ICenjaAHZL5p3kb1nkZ73ciWCXSvPoQX9dm4vBKtFpPVrA2ukNyZXrgK/HfJfSC0+LQWhoKstKzjUQYajaszpfTN7gBSbrs7KAxL/Fw7emvW6ElJZ8b5T+KQ2KTPbAJXg0K1/7evMfosh3Sgp/kxI7PCuYS6ry5ZW0ilHxCltV1gOjFnTBRz0N+A0aRoJQ= X-MS-TrafficTypeDiagnostic: AM6PR05MB4182: X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4182; 20:K295UTb6d+Q5loAYIx42ny7UETVPh8MBsbUaimCWPjteMEVi56j4Qvtr/u1hVgLc586ead+8gf0Rd1LOV414FBhkyNRrCl0SlzaDJqoI9iQA6lGYZTId++YYMIWhJCJftbSwaNIvnq73BMfUJiSP4WKg10TRAEqQrOZkhEEH5nSb4OFolCC/ePVi3EYtIEbZe+o2JbIPujJV+tsM5NfQEOf6InDrtBYjgje/tQR4WtdAuqx8FvyvLtP68IeRv4Vpc84SOMsETsgYKgzNRqLOiCWJkxEmTcp0Ij0PCeGCkj8aPr6XlVAsfMX6GZhsDqltQfip3F7DOnI3IrL6rIAtx9b7ntwzvBBW7oS7tDHcQpo9+DSnQpASrPshw++Lx9vCIFYvxDSZwRvVx0OMcsXe/nssjT95BRN/uYNLQ4Ov8QpcnnMULmzW+JSHF0q4QRG9GTyUlJ+8dBalqK9yzehQpCDG7SHjPdgabDLfWE9HsoxJVLwvtl+XNPYwus477fck; 4:w3yRZYkIZbbshBzLXXcgZaz9plcLVS2mdq82hPka8m8jj+0tp6UnBpD+ShaOGfgMqRtrTzKeF53mKoPMWke0Y8wI+3IWh5dFJVh7LrvvC3tLi1wShBTMso5I7PBWG4lWwT9ynowdWMdt9+CT8gWHhd2YqmMEJ+xS0s2MFxnvbwYY5JrOxWnRlzl/wfeXvbEQNAbfGbJ5IbQOkYGGdPGrKAJJvo016Pz3fJzTPii2U5osRVgCYFNzXFu1FRk0/rrH17T5Ead0YI0ADP7cJuSsCA== 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:AM6PR05MB4182; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4182; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(136003)(366004)(396003)(189003)(199004)(50466002)(36756003)(106356001)(2351001)(7736002)(97736004)(6486002)(105586002)(305945005)(14444005)(68736007)(25786009)(478600001)(5660300001)(16526019)(956004)(6636002)(26005)(2616005)(186003)(476003)(76176011)(51416003)(6496006)(316002)(52116002)(386003)(6666003)(486006)(8676002)(11346002)(446003)(2906002)(3846002)(6116002)(8936002)(86362001)(81156014)(81166006)(66066001)(6862004)(37006003)(58126008)(48376002)(53936002)(47776003)(16586007)(118296001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4182; 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; AM6PR05MB4182; 23:UOt89l7VKaX9JVy8isyc5Ikr/6EHgB3MdBEV6fPdH?= qMZDu44rdKPmXHa16+Ystmr+VRna8yHDcjCqB1OHdNx1xaC2dGvSjVIxGUBPodUjofmTgej/4YFTslmL8bkNgLO3kQliQuRW9+KfquUAqHivkUOIDKoG4jVX428pK3Kp+fs+bZNVPJq4WRB5vG7L32mKw5eoFAMKQMm9jDBg8NZeefBS07RSmyV+rQYCC12ASIyL1+fjFGIrZT3caV7lC03+CVN1Jpwza6c/bbMgGwm8gg6Vpf1dNAHozG3MM27OIu32GurKKqVRZfdCbeeZ+btYfof+3guXS68HubsK5a2lHxzvpybJWkpTnU1CRwFEBB0/vsg9lo8NrA7t64PkkSR4nhPH5e4ZHkXLDPYbBQwaL8vBwsmuo+T2VaB4c5SVWhxDy4qNAv70BgEFDqoTh2T+lCSxKoy9bMXOmUt70YxzJ7no1oBcHakYJnINFP2J8uzSGIhE/rqSW0uT7bxnhXR4r8oEsc6Y7ZgMSIBobNrEPgo9pYrkGqqSl7GrFejOPr2o+zNjBqacKOJ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Diagnostics: 1; AM6PR05MB4182; 6:2agfRWh4MgHLLCI6KwubfEOByPA1rFaDJW8yWZ/LSW0FXxI06LXaonLd7zroQbeSfy4eQYF8A7h/SRxHvoldPSp1FOf/YSqyq64Cd+E9yKgCe4hhGZ2T1XE/wzn7iCYeLOw2w06bBgcTlautWuO+TtjI5dGcHuqVSAeTG16mpZEBM595ga9t2+YswbdkHeK4hmGc8CGP32jiCWUvE7paQ2uEWX6p/TTy2yy8vL/fha7mAHbZOEdgGs94tb/E6mapeAVyfODAYs4BVT1ENODe/duxykP8mmZLJgTAut+LXFKKEcrENfS0UO+WtFYlhiFdvoP5a+atRYDMToMWqbmLJaU/W2FGyGzmo6D7MPlegzeS7vlNJDdVfPHngBBvtImGXdA8ga9i8c4nCgQJ6uj5r+JmE3EqTSrYXVlqpIBnxwusH+nCgoXzSPhdD0336YfbsEb5mUcnubTdVC7TvxKGVA==; 5:ZvuFa86CWjrnsXFnyFyRB2lxb8y5DoKzaALAw3fbLKlxpG2vsk5+f7YmVxL/X4BqhXk+qqk2OsnvCVIrlMaW3NydNqFjRSFtN8MWoYzTcMGbx5FZ+hyDdo1UUYGnVvQeYYG9/e0gyq6oNrZRk1eN0N4eND0OznyZ7CjOntzmp8g=; 7:kR6zM0V68rScwZewKtlTa/Ph/Nd1MqMQYP5N8o0k1MihhZ4J/Q5tn7dEoYeekMk+BFt6P2FAKaI2IlKzUjCAWR4IqjSWcd0dexMfC+Vm6n+GJTwipb6zwOOZTftXiRSLmT1ZcOUQHx6BJP1XWucEeGXEJ/Vr/kTlkvUt4TBFBo3ubybuFbQl6zOKDiSITeqQpd9qqtrVuN+ZrEbSWIbl+/7E4z2X2EkwWww+fQRFe5JKMQExWG/sbpFAOqWx+rxq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:09:59.8002 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df726d7c-d878-4ace-f705-08d5f3f48ca2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4182 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 Reviewed-by: Ido Schimmel --- 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 Fri Jul 27 19:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547617 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 7C9EB112E for ; Fri, 27 Jul 2018 19:10:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F9E12C41C for ; Fri, 27 Jul 2018 19:10:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F8D32C43C; Fri, 27 Jul 2018 19:10:26 +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 D78B62C43C for ; Fri, 27 Jul 2018 19:10:20 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdp30MmxzF0x8 for ; Sat, 28 Jul 2018 05:10:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="K0r0ZESq"; 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="K0r0ZESq"; 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 41cdnw63PgzF10g for ; Sat, 28 Jul 2018 05:10:12 +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=72t7StI+qjc4nQ1V+mvG8nFZUIR9OuM3UiaxCK9ZjKU=; b=K0r0ZESq4HDSkBnurIW8hckdYvn8ehpsLLoLW64YfuuCWT37z556mFdvyY37ac/Ph+asPiQ7WQr8yZebjAenVsBEke+UWph1yhiThdznoKlt/fYF3NywAmhUFhs5idvBxCDHHbHATl0kDEy7J/XLaOY21NbUdJRO2sg9VPJHU1c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.17; Fri, 27 Jul 2018 19:10:05 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 03/10] mlxsw: reg: Add QoS Port DSCP to Priority Mapping Register In-Reply-To: References: Message-Id: <356ab85b9db343dde65e5e419793cfa850328fd2.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10:00 +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: AM4PR0101CA0047.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::15) To AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c7d5a9f-2c44-4c64-ec98-08d5f3f49025 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4181; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4181; 3:/P/uTkkACZNbEu6l/9lUbAojjkt8liFx76iOoD8/n2cDk+tBYs51wwRR7W0bONn3QByFTISMhn0DQ/mUEqMNo863WvWwwscTMUfQdfQBWnt2dtqiz3HwbFFHyvx99YGL2T48wxoeWB2oYXLk8FPSylnVBLw/VwX2l65DqCyHxGJPhAmqMrgFKGHqo8QnsYYE8lWq2jZCZnZ0ZiuMVV1EXQ0C8bbBlCZrOwz/nk8cZbXdbuCR7XP702++rsOaJOR/; 25:ZoCwJri4dG+yuHbmsKzhndZrhALwMvZdhPQ0WdzyvQ3xwRBruYyomb3iMzAFSh/F0I3x8wEQ2GQ6a25S+msCLuHIcuyD2c3SlvavaunnUCZ0fNaE9fWMN4PPToxmteSbJgFzZreoHml5tqhkcbpblct+DYKtEjcUWoKLnJY9AzAuuEz3XLPirMVBuJxwDMUEg6zF0C/J7fGjbu0oh32zKhK4LhFmTKSsY86To4hf4Y51XbzORPYj6sV6g9TVIPIJYLaSou837tXdsfwcEDtL2GDKQCD6m7JjgfF0RJqhAcBzAtuLlEg0gy+bixebxxGC9QslaQYVmH5HrsPq8uobcg==; 31:6L+TaAou1ny7D4GcTkfevfncGB9uJhdkJRQssx6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S: 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)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4181; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4181; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(366004)(39860400002)(396003)(189003)(199004)(476003)(6496006)(2616005)(81156014)(53936002)(305945005)(316002)(7736002)(486006)(37006003)(16586007)(58126008)(36756003)(186003)(16526019)(26005)(81166006)(105586002)(956004)(8676002)(76176011)(386003)(2351001)(51416003)(52116002)(68736007)(47776003)(8936002)(106356001)(446003)(11346002)(86362001)(66066001)(6862004)(118296001)(25786009)(5660300001)(3846002)(97736004)(6486002)(50466002)(6116002)(48376002)(14444005)(478600001)(6636002)(2906002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4181; 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; AM6PR05MB4181; 23:w9yGTi6MCVoZbUWFJEn3d6kkzUeyqOBWQmaikWQsf?= 7q3dbo+ZkiFAu6OQvKD1P4z+CdeY8s8mURjDCR95Eunjv8LAq4XIB2foYvk+puxUAycIjoqYfBd6p2dzlsCEnx5KMx7YIDdv1ck8wRY+wFOzhIN5dml7kSQM1a2EqrHT9GAPxMftluGlfB4WyHkx6xCTa2Ma0CIbR37jnk0YE8uO0ZrgbrtUG594S9hFcMrjRlMX0mNxhKqSwU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ll3QwJug7QU8vkjojuG5/qT/PBFMbVFWIaaLAPJEF3h3egi8AANJGej0DBA54wTmX33OyxVBtbO9l9aZ6sCVEOASg+bfEmoYjE5bYYjSL1jRGDAstApkGNd+x5NGmW7AbA675gdTwY0GoEjanZF7LB1HNh1K2XJaLkIvdxMwd4pvkJn2Yz9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:05.6826 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c7d5a9f-2c44-4c64-ec98-08d5f3f49025 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4181 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 Reviewed-by: Ido Schimmel --- 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 fd2e3dd166d2..411d06b5aaae 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3329,6 +3329,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. @@ -8542,6 +8593,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 Fri Jul 27 19:10:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547621 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 220E813BB for ; Fri, 27 Jul 2018 19:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F0D92C45F for ; Fri, 27 Jul 2018 19:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D2D12C472; Fri, 27 Jul 2018 19:10:34 +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 53B072C46D for ; Fri, 27 Jul 2018 19:10:33 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdpH5Ny9zF0yB for ; Sat, 28 Jul 2018 05:10:31 +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="sTPRFx/N"; 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.3.40; helo=eur03-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="sTPRFx/N"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30040.outbound.protection.outlook.com [40.107.3.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cdp91ZNWzF0jD for ; Sat, 28 Jul 2018 05:10:24 +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=T4cSJPIDkgkgtEoWlRiKntN5MIHohehx2abr44QSkMs=; b=sTPRFx/NMornDfSKB9Q4W0W11bPtR11ZeEZYvKYVZ7x68UQTeLkKahQYcOWz5paoO1QIxan8boys/+6NwhM9apjWwZ+hEsVdjCbZlfCzU3jTSJYyaaKgAJffuLrdRNsoC49FsUXfbB/vFsKFXUoDTTUgmhjrV2zC5ajS5D/QrQA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4184.eurprd05.prod.outlook.com (2603:10a6:209:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Fri, 27 Jul 2018 19:10:17 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 04/10] mlxsw: reg: Add QoS Priority Trust State Register In-Reply-To: References: Message-Id: <24a944b1d11131d353b4a498cac7418283a9f4c1.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10:06 +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: VI1PR08CA0119.eurprd08.prod.outlook.com (2603:10a6:800:d4::21) To AM6PR05MB4184.eurprd05.prod.outlook.com (2603:10a6:209:40::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14daf3b2-65ff-4797-5be1-08d5f3f49720 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4184; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4184; 3:cll5GZQ6aPDYhFaHkLxSIaw8MIthndrYhJ11f87PmY9ERUpilKxAX553rTxhtwNFTKBNkfqLaUI1uaj4Ik9eP2MPOXHiR9TtoBrzJlgrRNWSU0P0fwefprZGnTCUryBU6vjWx57puCnJUtWrTUEaSSqNkPn/BBxP80Tm02X8rxOl7EzBffLj3oKKM2Px7JQAuKsbtCQpUgRBolgDBxXRwNyEsNSjscO3lsGqaD5CtrfNF4ptabj85YjS7/oeQoGY; 25:M1Zr838OGcykYvBfOYCvCIkHVhD3cMfnnZgZs1+oXoV6M1n/kvqI8LPUePzSE+2TikHBdojso2uB2/tGhmelYocsSVsIIQ7IfpYs0bEBQkOoaGYmLHsxUcYBZGGvb10yrKVxHk0OvBO15iCiIf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uGy55mdm+joDs4Sp0pjx7Wsq+8HrVisBH27m6cC7+2mICv6hKsfou/uc9yufFfxJoDk6Hym5d/ALvCS2WYhRCAJNw7xJ6OHDIgFJmJclUTwHuyUn47fETGC7UKtTQOQuIFzr2xZnlPVvwUhZif3d7nhMcyXMeS09yMn6cWURqubZwVJasZNo6RcL+wRY/UVmb6qA9Pjt6Anfge7ytRPAdDxsn13mAw== 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:AM6PR05MB4184; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4184; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(136003)(376002)(366004)(39860400002)(199004)(189003)(186003)(37006003)(58126008)(16586007)(97736004)(316002)(16526019)(53936002)(106356001)(118296001)(105586002)(478600001)(2616005)(66066001)(956004)(11346002)(446003)(476003)(81166006)(8936002)(81156014)(14444005)(25786009)(68736007)(2906002)(86362001)(6486002)(8676002)(6636002)(6666003)(36756003)(6862004)(486006)(5660300001)(2351001)(6116002)(3846002)(47776003)(50466002)(26005)(7736002)(386003)(305945005)(51416003)(52116002)(76176011)(6496006)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4184; 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; AM6PR05MB4184; 23:PIyg+ZoNped4ccnl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AphMQQ7qjdgpuftpJHFTo9CPklmM89cUlaP5bYHmpj+VZlu4JOrv1D2QCslrokDWK3rtYiCnVm4Kwm8ueU7Ov4hQQPwa2AlviSGRlfMGTIIJ8vgldZTwPD27wkbHD5j/1tTIXJmwhGV/0ZnBxgyxhQ=; 7:3/b/4KrLKFJ8FhrotFlqEj0Ce4E8Iytw91HRDwdNrrfxlymU7wimHKcq0y4sTaXFrYHYuUMBHQjXst1IV7DJW6xEWQFTwjBCYZ7zS6VZQAO2ujpugf1fkiJMKS1ta2gabc2KoIBIvmj/r4JKxSp9AjRoylh51xpdAfPVeqCipl+fpNvucJVIZLyUDmVOWQ4LVU8MkVOx964OU+rdraOeBi25Yhw0eQpK4eUfZj+HO9hFOojntQWma7/z49BdUmH8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:17.4124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14daf3b2-65ff-4797-5be1-08d5f3f49720 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4184 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 Reviewed-by: Ido Schimmel --- 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 411d06b5aaae..c50e754dd725 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3017,6 +3017,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 @@ -8590,6 +8628,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 Fri Jul 27 19:10:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547623 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 6CFC413BB for ; Fri, 27 Jul 2018 19:10:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A9932863E for ; Fri, 27 Jul 2018 19:10:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58B6B2C460; Fri, 27 Jul 2018 19:10:38 +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 837652863E for ; Fri, 27 Jul 2018 19:10:37 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdpM50BHzF11l for ; Sat, 28 Jul 2018 05:10:35 +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="X2ZipdJY"; 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.80; 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="X2ZipdJY"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0080.outbound.protection.outlook.com [104.47.2.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cdpF60rFzF0ph for ; Sat, 28 Jul 2018 05:10:29 +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=bhjZ/V6Q5uVxvypGCVmJjxZV/QloEqPictEQTmRwvBY=; b=X2ZipdJYpBaPXQGIg3oU/htgyOKfYfer2jWU0vPASW7DNgWFaZ+v0DAyS0TKAZG20/Q3hfaCRZTGZ3LL96csnINBJ8AOQ6YdhwR5N4jjfTDIT6qteotiMKq2X0qk35MCDOfkozr8yj5TK+nybLUFP7CgDSpqz6KpOLHdwXZUisk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM0PR05MB4178.eurprd05.prod.outlook.com (2603:10a6:208:57::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Fri, 27 Jul 2018 19:10:22 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 05/10] mlxsw: reg: Add QoS ReWrite Enable Register In-Reply-To: References: Message-Id: <9d4fe1d3061619846b4942d1a2083f97c9a5e602.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10:18 +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 AM0PR05MB4178.eurprd05.prod.outlook.com (2603:10a6:208:57::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f4ff4ca-fcb0-4996-f6a4-08d5f3f49a45 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4178; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4178; 3:3zDtoRFfjmBUnduCvv/Iey+Zr8PUGst+q8sA2n7oSzNsBnBkN18p3ZseSCA+loASmR0ubDI5cLZiJ64/gS6u9j4eOx+kWdorijiyeWky8AQ+66BFXBv1Da52ftwjNELM+NoWXN29UrsAZ1saO5tgWZ3PV2nfyOqsazCxwazMna+ThmnuLalE/is7B0vdRTFxA2c8va2o7WV7oQ5TSL9o8+kRnT7TWChYBeGHYa2ZuzisnOMVkIU2mNPowDPxy7iY; 25:DTE+x9QMqxO7NAdMqOQg/t8fEXUEz8i+orfYCU3+ZkioLMkENdJI/rse1mzczqGn6uTG0R0JmU+3bNCOHpUkhW0bWs6i0kybyPLifBUmT28RJmOdWHLYcfAy3Uh9ftEH9RAPU1melTGkHbx9t8qq3sFKa9L9eiCq6VImcjVX/qRxDIjtZhYd4eyREo2huR26B2ApOLdlct3AX2qCOa0E/YVj2qGH8HuzoXsFP+e6MB3ViTRdKDX0KZR9Zgo38oU7gu17yvKaaJ+8pymp6MWwTZblMtn7otn4PeRutCIKwfyhrfrOK57Uvxa4ijnrZTdIQ0tAPodKD6X/Ribz0pl+9w==; 31:sHntojZYVfbNTW/OsEERBPDXc4cIWqaUbdZL2alV7hB708/Nzq5YmqrTrCLfiGgpEioW2XhR/WZiilum5tmehJfIAVpWgo5qjLrzFEYscX+lRsDtvRbSAB3K4oNOM2cmZig6xQQwGVOg2dW6WIqmyDcT6sCUaY5qbLigLPpg6PJ1B38Moj4x3R4JclhdWI7RwICE+PS/ANZLZuT5bEnQdK6zjtHCtT7MGBE6EGlX11k= X-MS-TrafficTypeDiagnostic: AM0PR05MB4178: X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4178; 20:KjMIbTTyRpsbeGUJ+ggeud1c2sgnJ1nTSgezBd1OPaHq9o35WbzE3ont5psuQ0P+F3lJ2myOXlTkZLyCWP3Ia0qayHo3mNZ3XnKEPOvwSMaKXNHKl8Eqq0KLd9rBWiBFECMHxm/2xwvBH/KZmxtLOum18WLXTCtx8NfXeAQewy7aLI5KEJxaDXVpyq56D+oSZr/0bAwRPQILuzJ6Qh0OZ2UL9kZRsVhYhJi3fQAR32mhXDRqatsBRB8ySxLEuyyoCl9+MCkiBxPnKEDMX5mXurd5H2KqZkf+ttrZIfwTIilDQ79gHNilqy5aUaQmR3TbMaRrsuEIognETOvYTnIC3Wcv6SNnDGclg/rQc30U+YjCp5i4WD1y9tTMZth2SCuUho+JlEuUWlQSjOVjz58xFr8GaaWmVDrQTznSO/m4jPcvs2UUbLwyuF8I6qTexBRj0BTxB6ggDCMQFFQRJ34MmeMTM9NljzW0HuA7Qs1zkmXozkqbK1ptHtZ3AVVYTcZD; 4:OcTK2zbQt8ilahxsbkCFzRXwLA7VyuAxYU2gQ9LdRoVeW+MplmrA46LmT6HFg5tZyYI7RsGMfeIKLyF9SCVgvh62rIXg/H4RNfMmbju/98TEgwExdUgzSUpCACoS/U5uJ2T67iZRB+oSpkqwG5FDYqmLonhEc6PLdu+yBmv0neWFMNH63FC2ovSNqJ/hihuGgXm6caXxnZtONukzQQwumTDpf9G/68zeYFZ1CQdTJIrb01HKezjCtVoBzinadINnyrQVhimePM+TiJ6ZvvaPQg== 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)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4178; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4178; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6029001)(136003)(396003)(366004)(39860400002)(346002)(376002)(189003)(199004)(186003)(86362001)(47776003)(575784001)(66066001)(50466002)(2351001)(97736004)(305945005)(68736007)(48376002)(2616005)(956004)(476003)(14444005)(6496006)(106356001)(105586002)(7736002)(11346002)(51416003)(6486002)(36756003)(6862004)(37006003)(52116002)(58126008)(316002)(446003)(8936002)(6116002)(3846002)(16586007)(5660300001)(2906002)(26005)(25786009)(16526019)(478600001)(486006)(81156014)(118296001)(6666003)(81166006)(53936002)(76176011)(8676002)(6636002)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4178; 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; AM0PR05MB4178; 23:5u30zC10ZQ0pxTxM8EJn8bHuUSTn5TywQW/vvQa+O?= VE91myNd+wWXHIMDaSNFfY99KtZunxPGVPY+dfHRJzy+rECkUGL/2j6FY/ZNkzg4gKr9wSwx/fSrjVpVi+B31uAJK4md0cNC6WaH1o3F0cuotAyXt4DeV2pqgDV06kXc125BCqM+LrERyaFAA77Ui/50h0wOp7U0dj9kM/+Toot8lVUe0oOpLZT37355HManyD12GprJJGQeNK1K3L9xr4b+bjwZ9RHukwUmI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WqPgzG15KlRBR/iUDvIvSSFqvV7xY+vVaLkrrC2tfc/o/QAwUcP+1u+GJjvpztuC2QFCS2ZRxKsmulAZsC7eYPWeVfsFJ2wWKHQCNXkzG8mNOtrqcSRJ+6ev9ZcsCNnn90fYBZSeC93ZUwAiY0bvu458g6gfHDvebQ70A6yvSr7IXVtve00JxtD+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:22.5670 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f4ff4ca-fcb0-4996-f6a4-08d5f3f49a45 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4178 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 Reviewed-by: Ido Schimmel --- 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 c50e754dd725..02c0e1531ed2 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3367,6 +3367,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 @@ -8632,6 +8670,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 Fri Jul 27 19:10: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: 10547625 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 CC15B112E for ; Fri, 27 Jul 2018 19:10:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAA2A2C46F for ; Fri, 27 Jul 2018 19:10:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8F212C44E; Fri, 27 Jul 2018 19:10:44 +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 E93EF2C46F for ; Fri, 27 Jul 2018 19:10:43 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdpT3wqNzF14h for ; Sat, 28 Jul 2018 05:10:41 +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="BWXaYc+2"; 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.6.58; helo=eur04-db3-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="BWXaYc+2"; dkim-atps=neutral Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60058.outbound.protection.outlook.com [40.107.6.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cdpL1RsfzF0yB for ; Sat, 28 Jul 2018 05:10:34 +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=ORtYmJ635kHkfV5SXw72ZX5gyj752/+cWSBdF02jOX0=; b=BWXaYc+2VJbcfjD0SnxwgpOZyCGBMq21DbSdHlD8andVQ+101Fly87wcjM5U7Wb4vxMp3VrhWOMGv/PTmqcFJYJnLC59wkjb2E/JF/Gn4r5g3m21gfa6NveccxsNVGT09chrNXjpAd5yLbeVO3wntC9tlXPf+vgc3Rll41isyOw= Received: from t540p (78.45.160.211) by AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Fri, 27 Jul 2018 19:10:28 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 06/10] mlxsw: reg: Add QoS Priority to DSCP Mapping Register In-Reply-To: References: Message-Id: <29e9ce8eeb53713c3baf3ab604c76129d666cd3f.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10: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: HE1PR02CA0119.eurprd02.prod.outlook.com (2603:10a6:7:29::48) To AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ccb05af4-a62f-4468-cda1-08d5f3f49dd3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4177; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 3:L3QS0+xC9kgOnQhu+25T9DsVCJMxGGTiU8ni332P8LFphCBvrVF40QU/tsHPsZsfIFC93QvHHosdwmyklAlvNZihgoSXGYluoEuTW1yS2Y/Z9KbV1ckft8Ss6K8CRsARogPUAygaoyCLt5hDVlfZcQ0W8X8oAQoNeaztXLbn7+oxZfhEXD5yGDUP0hQjUu4s/N+VcNJpAhV2tvWvHRKuoGV0sSMlZ1xPnOTmjF6FxYZEE5A6IU3d5AdK7e2a3cjZ; 25:MGfUREwWNiTaePvCxaGs8H5gg6DoSTJiqr2SAU3vlg5jR8U+e78T90JAbfdveNCX+G1RqClNT3szBLIGvuHmgboxmEg0HpeL7cGPJu88UH1PVvUwQqFqpP3wJ5LnKd//kkZ4NAhVg31BNEGdbsJBYWjgQ3YKoYEguWEDIdJCJ6FlEy4GfLHFmzFfr+bQcSd8xnXO44mftBhykX9UQ0n/EhDj3b8w8TVJhANs9UyLXGNdjWRYKt9T+/0JNpi8dGUGPEOhzD/Dfy/HQus+scW9ffz9vSyFqWakvs28LlGmLB/ULQJY06JgQYra2EQSZ1lW9s1TQy5y9Fkl0/1c4tptYg==; 31:j4QtkFg7SNSuikvyyBI3xfDePts1bPbKizUWQRB1czzCgEn4mzFkm0a/nWlKCIqMHD+KWiu5bF+56BHRrPi2sgTgYwZQ/yJAWTtNznsWnLhEiWaKVbqy58nv7IXTAMfxI2+bPRIeqI2SEVyyY87DawjfQwN5j2QIHKBECPeqlsy4pTiVScpc8mt6MJe8wm8gSryakBe88Kt0ENgg1RxZLiVS5+dYBehUsDHW5xGyX6Q= X-MS-TrafficTypeDiagnostic: AM0PR05MB4177: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 20:vsJTD9Lcar4FxK6h1fqExgXi9z8kqCYxz3SnJbSYnOvOPvHYwGsa1SxO5zAurNj38NmA9tRDEGr82izvRZft34VKaaf1nEwMk+NjQd/pTLQEuXKoUP4tvVT68gR3dp7ttyFdztpPgr0blqou6rXkLB+iyqNp7vcuCB+BvDWRj/3W+tkjhazigkDk+tuiT6flH+T2pRSE6OeGVD1Z7pd28bAoSH8SqrHDS8Rl3+0bDxwXVxOCw2o0xo3/YYUTYPyzj0AhI1LZ68Z97XF2ir4vIbq32cuYLOgOXZ+iWPkwgfiV8nZQCUBhfUY//X914bAGyw320xRUlxHCNQUZ1CTV0PYyE+YTkCOCEp3en4+khlIbR1T6s6nUOx8JFDmHMNAUR51PWcSyGjYlu0/bhQ4LMlDjtoze5B2yuv+90Tnni3/btfaFePJO371Yrizpfbxg7kS4YBeurhv5n5YM/DJ/EXl28WrzLJkeln3luyDovj9CA88kQSbBgEVax9uYrbv1; 4:l5hYpfutHiQyJ0AS1R7/0MPYmTUuRGkjKxl+4NXKDxL/B3OmPcYpmCiacW6WVZBACZThcDFpU2HqSCvf3fXfRE2dXJ6oBMVrBY1KhFyWBqy96zC1NDLdIpGlGoHrKf22LgJxzjTwqZ/f/X65GrdFLDBwHTQr2hlkztsJDD/+cBS/X7MRfrHh01lNwMOZSlOG0y94QeT52LWMdHmdMA5uJhzd6aZP/zVavcYga4JUbYkXaepnpvrrtloWoqYRWbgehsBwV3jWL3e4T2Yir6shGg== 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)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4177; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4177; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(376002)(136003)(199004)(189003)(6486002)(186003)(16526019)(25786009)(5660300001)(26005)(48376002)(86362001)(386003)(6496006)(50466002)(305945005)(575784001)(6636002)(7736002)(8936002)(66066001)(6666003)(47776003)(8676002)(2351001)(81166006)(81156014)(97736004)(446003)(11346002)(6116002)(58126008)(16586007)(37006003)(316002)(76176011)(2906002)(52116002)(6862004)(14444005)(956004)(118296001)(2616005)(51416003)(68736007)(36756003)(476003)(478600001)(486006)(53936002)(105586002)(3846002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4177; 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; AM0PR05MB4177; 23:WNqlDtVyBOCOt0BsE0x5F4iQS5puVjbJAwYkRKLEa?= sA6rut+g5sczIK4vGNgbCO/XtntBH9IyPRuAA9oZj4WSEP8LC9rNpmJiJwaA7Q3K0l7OySnl7juNRJ1qtISt4ereU/6cL/3kpO6xN1i1VH1OyIx2KVPln+tzMGRmVlVeF1I11lHN7JwgQpUoRQ4bt3qS8pQOGWldvVQ4OluT/Uaw2Ao3lOG+yNp6Da+eH/4VtdjGdAq6k/lhMr3jaY+R/uNgvRZ/cgXKnEkaTc6YKYTE54qONMV0pCPWEavaAodz7UxA5wMybJ8ks15aZYnlgoBX+59rChD4Li87SlFGqQNscihkvUFl7LkUdjFTFtcUbSTbzV9oRaM5BmCkFIn6Gx+JRuMzi6T5lHXcRYqpYllTcK4ZxFuDwfjXxtiyWdvVSl/hMSYSXjg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Metadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:28.4033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ccb05af4-a62f-4468-cda1-08d5f3f49dd3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4177 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 Reviewed-by: Ido Schimmel --- 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 02c0e1531ed2..e52841627966 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -3405,6 +3405,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 @@ -8671,6 +8759,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 Fri Jul 27 19:10: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: 10547627 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 EC5B713BB for ; Fri, 27 Jul 2018 19:10:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D91402C472 for ; Fri, 27 Jul 2018 19:10:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6C302C49B; Fri, 27 Jul 2018 19:10:49 +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 80F532C497 for ; Fri, 27 Jul 2018 19:10:48 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdpZ5nhVzF0wM for ; Sat, 28 Jul 2018 05:10:46 +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="eiK0o4rq"; 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.6.57; helo=eur04-db3-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="eiK0o4rq"; dkim-atps=neutral Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.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 41cdpQ4V97zF0yB for ; Sat, 28 Jul 2018 05:10:38 +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=kW36O2fdiyzPzXIYfOUv2Gz5iNSyqAKh0laDzQqqM4A=; b=eiK0o4rqSKG9kGDmoke1dUs9bV97daSNMWMwKL9JDb5JWFKQKh6s3VGoez4DpH/EyQIXG1gl6lhMys97+DyI0ApaXyQxYH7t2Lm3PwNZILOFyxJ1Qxmc8ZtWxoTdwQQtBF1dGpGSlI+vqV1c4MTVFB93Wqp3tP5w0H6FChVydNM= 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; Fri, 27 Jul 2018 19:10:33 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 07/10] mlxsw: spectrum: Support ieee_setapp, ieee_delapp In-Reply-To: References: Message-Id: Date: Fri, 27 Jul 2018 21:10: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: VI1P189CA0002.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::15) To VI1PR05MB4192.eurprd05.prod.outlook.com (2603:10a6:803:4e::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08511cae-9596-455c-e215-08d5f3f4a07e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4192; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 3:kaWiG1lwe7zx5pnTXuXhI2FFxT6ppT1jvpIb5DI6THKjpTp7ndBtRrPog8XiG5tbjgPHLCw5HusaM6VkkYXj8rfu0trOvhFlcIBayleAnC8QD4JojnuCaqLdAgGVqbpn33aXGuvMSpfrlu1U5nk46GLxJdfYQ9lXY7uCBb/qOqbHaRVFHhWhv9yqdH13sxt2GaOtY3ot/f6U3/+D36+eE5Pijzsf701pKBPmWWPGi+Pz91VKqS5u4/+OpkDzWBbT; 25:iTd1jE4ixc2iJUNp8y4rJA1LjsFOel+eBxHQTB+PdF0sRLv0hm0oSlCr09khEEgqQpyPlnwYgZbonfsS69rNPkTEhaXN8T2YR24ADMa2muOOsO1XqKgJDq4nih9RJXYlLrW3Ko+AHuGGsXbY3rGTWZUl350pKKONycvxuV5EWvw0hYTxzWb6DYnK73+6/7/Ni5a5btN00zNBDQHS/H3v8XAvAEP95XcYsNSmjKxnOpwVaBqRB7huI/uSFZkjmMfeO99nYsOkxCTrY5iuMQjnC8wfI5PtleuC6BGPK+hBCO+wOuAhJ8rMi85aSs0OSjEGoJSF25B3msuE6UWS4gqeoQ==; 31:p3obRCeKxobWYaJVNMko7a1utM96N4begNLcuRz011a0e8nAmdz2EhyVC+dNKvJ+Re8Ml/bql7PATGyqLlgBLLf29oWzMdItDfYCymGFMtyPtOBZUCRT14Rsqtsf9dO7DGjhZiXXEi2thYCd1JzdSYwEfm4/2fk/dFEGcH86k649xibpOuF+M9x5KMocRnnaqeys6Xlgci21VT9yBXbhQe3TMhTmu1kanwHY9XgNKUc= X-MS-TrafficTypeDiagnostic: VI1PR05MB4192: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 20:x+4tSzI2ETcgbfmIWfzVYpjb+NL4+Rl9V4qjK6bAExYTa/JjZIMOz+ejpO0gRwSpeMg+k2C9zfNRSJjbbsYv+R+lBUzSLkVQiiGmNfhhzOvgp2bgsspbXGRMr+NR8XXQQHijbViNGnigutYAhELRhrFEtKog5YZDH10rFtlO1el2gY6PGALNixNQPObofQvLEQe53FW/s+NwLwfRWClpBRYy/5Cp0m+ypTuKeskgr4AgmRYPIkrnzTpfYVTmf2ZX5pFoBeigJZOOdFUKQSq1xXlgHkjBe2ZDgdDJwFzsMF1NcUO1FkPGYmf8LZ8xmTXXx4CrDHyLT3UCv5OWdv96olWekfox9ry/UECD9H2t4MIOUb6k3m/1tNzfLy2w2+Q5GDbayhLvkdOgwgerauHcXHgL5ZZWyED8KozAvAKAPaL0fSnIDLC80l4lOjm3N3inPOoYW9f2r16ZDB/UWn4z7AC+DbPeUWzqxaiKnPQugoxdTfN13xnjXFl1/E04Udal; 4:G4V3TKPYKfaEYOW9txbFtzD3FHyWwUHHd8ongAOXxqYWcEVoF2ZCyOma1QmvNUE4VUgHrNzjAiefLK3D8XMWTH1O/HyhhSBBaXhz0t2abykPApDXZhxu6ALTBWrwsE5KMB9blANmJuwi9y4fZzM2n2/dH9ztNJM4NadViqbqomdsYAL+kN4yKDCAr220V3eiZl3ObzXlw18U8tlQYEduZ5eXJB5Evi09ydFX9E3IHfn2qkpiOH7A+q4twnGQrnme74C0G9L9G+xIQ2aEG9dobQ== 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)(93006095)(93001095)(3002001)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4192; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4192; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(136003)(366004)(376002)(39860400002)(189003)(199004)(6862004)(105586002)(316002)(66066001)(2616005)(14444005)(52116002)(118296001)(106356001)(47776003)(2351001)(51416003)(478600001)(186003)(486006)(956004)(476003)(11346002)(386003)(53936002)(25786009)(16526019)(446003)(97736004)(6666003)(8936002)(6496006)(81166006)(6486002)(81156014)(76176011)(6636002)(8676002)(48376002)(37006003)(50466002)(36756003)(16586007)(86362001)(58126008)(68736007)(26005)(305945005)(6116002)(5660300001)(3846002)(7736002)(2906002); 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:GCuAUUB8/3VqPTjPAZHK/UXYRF7tJzG5A4ZUBxHgA?= 0IFMGhdzVhQFrqmQaa4oM+xstB5dl2ppe5v+kzLLCUm9+a+wW72ZGYK0bU7UJOQPn2R5Mo7w9el/I3nO2/OvRjRaK35WRNfXD2xLOJCvWoQ6QAktfHrxhhoCG39IiR2Qm2tSbECoAXIz7wofuFIT5gAXrrGN6WYeGt2wu2/fcjJaklRkhizqiy3fBXCu2Jb+S8gPciX9hUPnDODN1xoDQo+r70S47hx+VimsRAA0Qjbpt7lioo666frxcdSE7LiCYePVqWrSQGDm/cBmdsmDmYvEgHjtFFm6dnnySMw1ysWTDLv3xf5mGli75AZ4/Ae5az0nh6a4pjvw1w0weWZjJIJ8onGmRyInGNIi1FdFas8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eWyul00o3I5Z SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:33.2095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08511cae-9596-455c-e215-08d5f3f4a07e 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 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 Reviewed-by: Ido Schimmel --- 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 bc2704193666..13eca1a79d52 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 Fri Jul 27 19:10:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547629 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 3718E180E for ; Fri, 27 Jul 2018 19:10:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 247822C453 for ; Fri, 27 Jul 2018 19:10:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22BCB2C49B; Fri, 27 Jul 2018 19:10:50 +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 63BFE2C49A for ; Fri, 27 Jul 2018 19:10:49 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdpb1N3vzF14j for ; Sat, 28 Jul 2018 05:10:47 +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="VxiTrxi3"; 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.6.57; helo=eur04-db3-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="VxiTrxi3"; dkim-atps=neutral Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.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 41cdpS4fLSzF132 for ; Sat, 28 Jul 2018 05:10:40 +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=IvyWojp8J1BofvozELII0bRrW0W1XLodYFAZbdNRFqM=; b=VxiTrxi3Z1Qk8ZVXM1/rLrOS3jfVwJFjLkNHdA9lUoDf8NBUOmqBG1GglM6KR9DbcTayqswHrOy2efx0INaNCBg3N1RftftdUyAXx0Lf+R1wpcnYrwe3VQ3LGwFOgud5Z8n+1diAdWJ4atRuG/gsdH0ZfWjT4fvYjwSxtA1Fkmw= 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; Fri, 27 Jul 2018 19:10:37 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 08/10] selftests: forwarding: lib: Add DSCP capture In-Reply-To: References: Message-Id: <7d9b5ce7ae80826de8c48441e5a0a22e8c449c88.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10:33 +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: VI1PR04CA0079.eurprd04.prod.outlook.com (2603:10a6:803:64::14) To VI1PR05MB4192.eurprd05.prod.outlook.com (2603:10a6:803:4e::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2bdedd4-db5e-4206-e897-08d5f3f4a34e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4192; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 3:ijl5Lj65xl+4ryyapH/izVBpjWXGxVV9xU2h/2cHreaCos4MXH7rMy4Tdovv5R9SDZAFK5CmC/GXS1H7mmL2/JE4+LtU/acZvrCUmLdv57HkVoxP4mpUEICOkNfo1wnrTFFjx+sokcPvsnu9+J/vohNL/xxtk8cGAmEDUv59wColxTuMjX2Dyuv49XrG/gXv5sZWC1TmsHO1EUM/5+TwqoQtB4DyueMoIeV/BqgYATKV5aJP1T0pQDsiiqGaNT4j; 25:00CLTAzelgIsX9PQmE5Y+06m/E5nZwiDDOi+JQrARZ+8qsKIiPlEUDFcR+hpnApB7YmkSUnV12sBhoZLPBGwT6BpmJyDD8kMKDVKGh3xooU50iP8PK3nFeAj9XI0+0sm+RRmgCCzkenPk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MIEaMnXAAsjOaohvYleBj4ZvsGNJnZfYxRhr7wnEVpqpE4I7wvfti2b50ir9KQ32cLfQlN3lklI2YEvDHLd9Wmk2AaFC/qyyPHttMyEBBkhjo6TgrH3iZpK4LPR6ZyGssCswAleSF8bi96dsO+WuG0ilmkWv15b1QzW+/LXXS1v0W/ZON25zVkY8b5LsTBKl7RyB9tXqCWBVdQVr9LzMpfBw1UEJU4XcntrUeGTV2wnao+7d/3KA== 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)(93006095)(93001095)(3002001)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4192; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4192; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(136003)(366004)(376002)(39860400002)(189003)(199004)(6862004)(105586002)(316002)(66066001)(2616005)(14444005)(52116002)(118296001)(106356001)(47776003)(2351001)(51416003)(478600001)(186003)(486006)(956004)(476003)(11346002)(386003)(53936002)(25786009)(16526019)(446003)(97736004)(6666003)(8936002)(6496006)(81166006)(6486002)(81156014)(76176011)(6636002)(8676002)(48376002)(37006003)(50466002)(36756003)(16586007)(86362001)(58126008)(68736007)(26005)(305945005)(6116002)(5660300001)(3846002)(7736002)(2906002); 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; VI1PR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Ttei5Tf7eAma7lbxmGnGjzZdh80Vl4bjN8a4/DhJyk6y5HvTx+y/XLnzXOJiX+YUblfnqRJXgJ3+FEaS9nHiHis9rLqL6Tkzq2D63Yqt7mxZ+t4LX8H5y/a7WTeallWJRoIft/we8WVZR0iRU1U=; 7:E0gWM+2QrDSC605wCHdYkMzz+UOR7s6krUKad7CB01DJhLCX5VKglvCqSnWlA3MvC+vvVu5zF/VRzyxxKGUaYfIYP/ArdTF/aM304CL0h8V94qdaejmNBLsEHK4mKTA6rUe1lqmofKumgK0f8oy+YxSE/wi1e4xcISuVBMtScGItOunSu+yIcHvgm8FD7duQBD37Enbx+iH4BOXOF0zWLtm+CVGdMkiy/q4hsHQQkSa92Wg2DWItSvSxBnwCCcYL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:37.9283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2bdedd4-db5e-4206-e897-08d5f3f4a34e 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 DSCP captures are TC rules intended to notice packets with a given DSCP value. Add dscp_capture_install(), dscp_capture_uninstall() and their helper along the lines of ICMP and VLAN captures already present in lib.sh. Complementary to the install and uninstall functions is a function to collect the capture stats: dscp_fetch_stats(). Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/lib.sh | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 158d59ffee40..d396f89d864d 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -605,6 +605,48 @@ vlan_capture_uninstall() __vlan_capture_add_del del 100 "$@" } +__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 + 100)) "" $dev \ + "skip_hw 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 +} + +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 + 100))) + echo "[$dscp]=$t " + done +} + matchall_sink_create() { local dev=$1; shift From patchwork Fri Jul 27 19:10:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547631 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 82FB6112E for ; Fri, 27 Jul 2018 19:10:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 710132C48E for ; Fri, 27 Jul 2018 19:10:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EC282C498; Fri, 27 Jul 2018 19:10: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 989AB2C48E for ; Fri, 27 Jul 2018 19:10: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 41cdpm0KygzF16f for ; Sat, 28 Jul 2018 05:10: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="wtLsJnF0"; 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.52; 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="wtLsJnF0"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0052.outbound.protection.outlook.com [104.47.2.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 41cdpf2sTPzF15L for ; Sat, 28 Jul 2018 05:10: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=Ru1vchQjHLHp3PvB8nLah7Z3FMDHVsHhcqpoT9diY+U=; b=wtLsJnF0Wu6elFK+gD5m75IbT/vgiKDpr+y4+vVHP4fcdXrYF5iRjAyDceZCPpkw+i/CWjVCf5B9cvzY8BlBfzbKIYijsuDKT0pepDrKFhMaw1mC9UEqgpivlDTLhBz3RM8ZKmdlWeiGDpSk/wiKUXMR51Qmz7pQ4hTQDfS9NgI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.17; Fri, 27 Jul 2018 19:10:43 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 09/10] selftests: forwarding: lib: Add lldpad waiting functions In-Reply-To: References: Message-Id: <7202f0e97d3e0f7b2b1274a51f62f6efb3e65d09.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10:38 +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: HE1PR06CA0135.eurprd06.prod.outlook.com (2603:10a6:7:16::22) To AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5179a779-877b-48ae-6a0f-08d5f3f4a705 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4181; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4181; 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1TwgfsxuUG7adXJdgVsbgj7H9eHmVdbAkga5olBeeken521et3CT1Na8U7tD5zQvZtsgJOGHDq2ciIrOszRKcgm9T8wy3+v5byfy6i4viWS8dWS3p/jiwQcaFDiL7LvP4Cwjka/wZY229wsLZLNjIeePZnZlT8wc/oe5xTyMdtD6wFMImrqZ7wo2kZfJohsRCeDrN+lDIj/xJTkdrEbldbEt32xvhaTg9YfEQLo5fXhM2mh0qJJ6rabY9yZnJW6c60mJtUCoY041ZMqUMRW4u3uXS5mcMHPdSr5blMxfzQQHNOMUwRM6pcacKAapZx39bKeBJx8HvlTbLbUkNUzUysrRTYke1nSlwu4b; 4:CUB0v3Y1dD6DvgthOr87KBfIVZ4UoPYdc+zGh3SrYu1pIMwvhH7WizvC0xI/zlg6BcMEr6fBpRdsh3icdaG8+e+/hYLw659smM1hq+hbzVKd3MHd6ifaovaWvRJmOZ6hlJaQs/heClSVOSh/TYmGoZID26c8MVftMPoBJl3k60qwZlz9cwrzpnSiSRkPnbsp8uuXfZeW7FNxf5YJnyu4dvbO8r6D/foRCkogzHEU+ozFf1ZEMA1Ggf1rU3ezmyotc9JVLpdjZX+Lvhov6pvaZA== 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)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4181; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4181; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(366004)(39860400002)(396003)(189003)(199004)(476003)(6496006)(2616005)(81156014)(53936002)(305945005)(316002)(7736002)(486006)(37006003)(16586007)(58126008)(36756003)(186003)(16526019)(26005)(81166006)(105586002)(956004)(8676002)(76176011)(386003)(2351001)(51416003)(52116002)(68736007)(47776003)(8936002)(106356001)(446003)(11346002)(86362001)(66066001)(6862004)(118296001)(25786009)(5660300001)(3846002)(97736004)(6486002)(50466002)(6116002)(48376002)(14444005)(478600001)(6636002)(2906002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4181; 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; AM6PR05MB4181; 23:NwVgFmiJzw9g9uyDIFUKudbHwQHOYFo9jp5v8uUV0?= Dl9t4hvpghkmI5+4DlkpHGAvFgam0B72ws27En9zkd6HF2Me8ke/e+iCXhK4RjQthPkzeRrb6dE5Ys7yImgE/8QdS0VVsfQfn8s7XpOQ5jFQwzjyCKKo6Ss4DLkxBVMcO05HDbV+ChenVXYBwiSs+IXDNRBR5pZfown0DmwfhkSJ1K91X9l4PVsSxLut++9J1dcDrNtVN6EFn7Xz+XMlX+F5jr9yTcJDdiH4LWsj11+jMpG6JAvULy3dW0nzf6KtrJZaBbeXt+PVSSuyE6pNTKrGjkMs9jV5RJEUSAgMAIuq+VdYSqrjVC2GyBUnInO4bzAn0oR7yhmqjRcSpNHmAhJLgcFL8c0Ba8UmNr8zky3O9AUEmYYQL4gO8dhnf2Yf4Fry+5nuiCRHZ0GV8yEB9+hpphQ422tqylKRd1FZ/a7Tc8S4mqfRNgjh16iZqsX+QSy427oMsiVbg69aQ/ycgs3/9VUzCRUgHhIEeJxWZqk+OcRhIVQav49VdtRMq5PeCCRySpnfDCcTJxPWxMNohcZYQP/N15U6QEhFSCzt372bbq8AYVWrf/5prUjsQP6w5Ap092mX7U2+lP8o3Rq9Th4eOF+imeUfKz99e/IcyvFwEud5CYsFb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cl9RPbWXfQW1mJqeG5ubBUFqv2PPFYkiiGnbPq4TckLmOEBF0EskX3Fjk9WJ7QxH+KN/RRwtn1sfEwsUCLt6O0XnjLicXr2JjiYO5qUZY1SRX5Pm4Sp5Z8NSxuyIYvfYwH2hc716TLCx5GSlW1DY8Luyxi8s+bOuJfCM44I7rpiAib96pJlWXzrBwUd/CjluoBdmFk7O1dTOu5LhGdFjGdbu5Q1+aiTwtfR+WNU+VVQYU/pFOvkSYOe9N1rR3NVCuiovxp7lZsJafXCSZ7em8rbHeBzKxGZjTa/poYJXXn9hDugf/GvCPE4K5oNE6j71Ntmvgj8mfqHlPXQY8lQgbtUiL80NIhPDSOhvqzmArMwjBpF3wkpg9GESyqtg==; 5:kMKjJtFWMHbElS83KWa/lfLsCqVbcxiSt7LLCiPKNn9jflr21LUn1ZPR5kAB91wvYmDai7qQY+JWBUno8k1ZAJJkUSAHoDw7okezEwtesGc9nqNGTxaYu2OiVEdM9/u32TiOjxb79LTnm54YX7o4Rhuk7NRTowAvUd2XeIUPJx4=; 7:gK3Jgf3ZQrL5OW+zpZfp/R5OTWcwJuwfVNui7AYa070Sz7J3/cZSQqIz6Edgr3FoARi+3VxNSJTNsqC40YXhbUm01qjwF/k2bn4aXhLHlzA3EgfeBkmV8pXpefJYXzYiVIgnzmO7vsWPu/DItHJnnGd5QFy8EphY7bZlhaXmMMGQS58Jd45J0gsYLVIz0FXyB2xP0F9mbVU2KaNdWDAZ5GGEwSb/OCmznMzrXsmkNMfIPDddVX9pQHaI1I26ILkN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:43.8059 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5179a779-877b-48ae-6a0f-08d5f3f4a705 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4181 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 lldpad can sometimes take a long time to push the configured values to the kernel. In the mean time they are stuck in pending state. Add a new function, lldpad_wait_set(), to wait until all values that have been set are pushed. The situation is similar for deletes, where however there is no good indication of whether the values are pending. Just sleep 5, which seems to be enough time for lldpad to consistently update the kernel. (Unlike in previous case, where the delay is often in the 30s ballpark.) Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/lib.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index d396f89d864d..abdcae9dc5c7 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -242,6 +242,27 @@ setup_wait() sleep $WAIT_TIME } +lldpad_wait_set() +{ + 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 +} + +lldpad_wait_del() +{ + # Give lldpad a chance to push down the changes. If the device is downed + # too soon, the updates will be left pending. However, they will have + # been struck off the lldpad's DB already, so we won't be able to tell + # they are pending. 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 +} + pre_cleanup() { if [ "${PAUSE_ON_CLEANUP}" = "yes" ]; then From patchwork Fri Jul 27 19:10:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547633 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 1170C112E for ; Fri, 27 Jul 2018 19:11:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F387C2C49A for ; Fri, 27 Jul 2018 19:11:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1CE62C404; Fri, 27 Jul 2018 19:11:07 +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 B81312C4AD for ; Fri, 27 Jul 2018 19:11:05 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cdpw0m90zF12j for ; Sat, 28 Jul 2018 05:11:04 +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="BeCxOAdR"; 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.71; 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="BeCxOAdR"; dkim-atps=neutral Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80071.outbound.protection.outlook.com [40.107.8.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cdpn3CwFzF0wy for ; Sat, 28 Jul 2018 05:10:57 +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=EOj2pK6E3YNEPAYCcI+AmHf2FpSCMfFMRQy3kqbIRK4=; b=BeCxOAdRr7RPkq9ZVn8vv8dMzlwUAP+0SLN2gMis1CP/CDowouHYTfDvLmCV/aaLB8EFGpHzYFE/1PvSducNrmmGZGS0DA5FJiYXvYpL5m0U/8amFptoUkEu4QVissV7Nurc6ekWns53tFCX1pnuAd57hEOXj1W3l2GH5BSdm1Q= 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; Fri, 27 Jul 2018 19:10:50 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 10/10] selftests: mlxsw: Add test for trust-DSCP In-Reply-To: References: Message-Id: <004a2da52c5031aa49732e89778d1690035db905.1532716714.git.petrm@mellanox.com> Date: Fri, 27 Jul 2018 21:10:44 +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: HE1PR0301CA0015.eurprd03.prod.outlook.com (2603:10a6:3:76::25) To DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1685cf06-d619-41d6-72ca-08d5f3f4aaea X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4186; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4186; 3:Z3coMKjKdSqXoIp0SIP+IAAGq5hmRMcjIQVIgnzQHTPdZtmzyKJBcM2hrplpcmTjjH+PD6GhI0t/28mquRxRydBcHc9uGVNenWckKkMCyBlzDtRVkox4swA5NBLjzsEPpP3o3SGgltojDDMUF0vsJ4uWbnY+z1pfBOSkJxfWpf6ZAF7YngfviD6OzI0UNQROo6rM9xKvDQNmGa3ER7XTIkQpJldSE/81eTc/WZ769Ajm+Icp7QXK5ed60+NZ8dB8; 25:fNGW7ABLyZz+5GGg98he5Ql4yoJ6V/IYqX8/eUKmHS2KCgUjwF4d3RqNDtoujX+3+Dc8SJWiSxl5KDb5nrdLW+56x4UbG5ZUU/f00UuFnH7Ivaft9q47LOTi5V3z6kIChwb1+5flnZL1AubsVe7bQocUTU3tvVaJBUzqUBlTdV7AiDt9eyHr2+EsRvMVuWj0EJBBxs43TnB+W1n7snR9ZjM0TCrcNEudw8ABbvNfAZIW8oHxLhYOyo31ZiOWs+icLltGH/ir3vulC9I+lXKvvJNY/v9ZFOp9/ki4I8qhsq+fEci+JoHkla3cpzT7Ybs0WANrs1YfnA/yFyhG0ieYPQ==; 31:qn+JIxqiBN+Z176QT1RijcbhMRKOSnEZlfLlVQy4SKicBbh8BdPZpXa6GEHfM1y6NJdRhRsqlucCHIPd6TsRAHIS2Q5vKxILiVeUhf1LS5oL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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)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4186; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4186; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(366004)(396003)(376002)(346002)(189003)(199004)(16586007)(76176011)(6496006)(36756003)(6486002)(53936002)(48376002)(478600001)(97736004)(2351001)(6666003)(50466002)(8936002)(81166006)(118296001)(8676002)(106356001)(81156014)(25786009)(6862004)(68736007)(6636002)(2616005)(486006)(476003)(956004)(3846002)(6116002)(446003)(7736002)(66066001)(305945005)(186003)(16526019)(47776003)(105586002)(2906002)(51416003)(26005)(5660300001)(11346002)(316002)(86362001)(575784001)(386003)(58126008)(37006003)(52116002); 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:wOqxON9HDeRe/rksSirKeokJadjMlGSSKNGGLdOoH?= XcxU7aYzyIwOIHO6hpYsbWnr+eY2GGMwAy0xIsncZhQ23nP6mOB6fDQYTRJtWK3caVNpAjf/OqPtwIrvA60/f5Tlb9HYqGCjPnaAndIa3tOLibOex3qAiQPRbflCB6sQzg+zLFpoCPsLTcVr+WtKILj4nlIWxQBYKKca+sfPpvVzapM2eo5WhMRA/HNbRLFqGd74upMw/G7qsyIIkqmHERnosKhJKEuDp4VR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l2yVykTIEm5jKWYU4GYoa03FFBD7be0dJUVci4aYdNjIF+QwqzL0XlSzqyyl91YPL79A1IIV0231xnvwMvXjLtfjFhQisGKLJrfzxHMM+y+ZEDefyrckqxM+E6pfwSg21VJzX6ilhLx9b SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 19:10:50.1135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1685cf06-d619-41d6-72ca-08d5f3f4aaea 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 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 --- .../selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 189 +++++++++++++++++++++ 1 file changed, 189 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..d29d4582b13c --- /dev/null +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh @@ -0,0 +1,189 @@ +#!/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 + +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 +} + +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_set $swp1 + lldpad_wait_set $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 + lldpad_wait_del + + 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 +} + +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 == prio+10 || key == prio+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