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);