From patchwork Tue Jul 24 21:05:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10543201 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03333112E for ; Tue, 24 Jul 2018 21:08:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E54EA294C8 for ; Tue, 24 Jul 2018 21:08:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D98A8294CD; Tue, 24 Jul 2018 21:08:35 +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 26AFD294C8 for ; Tue, 24 Jul 2018 21:08:34 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41ZrYs1xS9zDrpm for ; Wed, 25 Jul 2018 07:08:33 +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="FmdxXpqD"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=104.47.0.48; helo=eur01-he1-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="FmdxXpqD"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0048.outbound.protection.outlook.com [104.47.0.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41ZrVm671kzDrM8 for ; Wed, 25 Jul 2018 07:05:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VzS5pclGWAhSIg3O14SLTjMQvu1zmzcL9SmIVq1IY0o=; b=FmdxXpqD9rAOZELBi11oz8NDqfE8WgiIAeuMjBNKx5zC/xkJgcLbPGOjikZ4HAuEmGVwNOm90sFIxdnr1TuHAbDZADBA+DXCz+1X0IpAKx3lNNDBro0ndNCIDI7wCDiZfvYqiL3Qz8n5+GRdeUxjRYX0sPunp1/p8zmVeN9XW2I= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Tue, 24 Jul 2018 21:05:44 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw 1/8] net: dcb: For wild-card lookups, use priority -1, not 0 In-Reply-To: References: Message-Id: Date: Tue, 24 Jul 2018 23:05:39 +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: VI1PR0501CA0040.eurprd05.prod.outlook.com (2603:10a6:800:60::26) To DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8dc876e8-ec78-4ef1-ce3b-08d5f1a938c6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4188; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 3:ACewLSlvBPM7+zoOdMMI55SbHVpaSBpSxcV7EmSeqdeNB0MvSd+ubQ+jfqQryt51FDKqD/bUEclE3ZrYK3zXnnwSdoRKix9F9OqSw60ePamx2xi0kQvcp764neNlZuzGbJ9hQCI+pFyqKCfgYwgo5OjufM0KsQC5JTU3xSJ5Ff8VTM8iqmou8IO7St3+88EUhd17N9IdWxVVe+sIlvveDqb6irxAF+Hx6NJT5AGI8RTOXqq18NDqK8Wf7g0HSwmJ; 25:pUEWjisDEYUtr0AXElNj7mVpkBpd41zLbRIfs8KzFADbq5LjPLWq9KM/Z+091ubruGf1aCjPtnEWpgVes0uPTFw9TQIIOzC6rSkoga3F3QxxTFi7bYkAcca2qnb+KS4MjYz/zXuHzl0Of+lBOsHiQXGCGbQ+kod3ixvrWvn/deMrxJ7OUgLqRFU6zNm1FTFGhQ47DCs1OWOFFCR4nStkVr91YYSTEa+XnBIFt5O5ZFjV9J3UkM9ghN56lXYRGkwyv9+qd5vqQxHoAr+NLM8tJd3ebFmiTSy/DjZQT59GmXR394TXpCYKA1gZFqhPcXtB8+S4zoDnZvAhkcmFKtM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huoghwvzYwTjYjxqEsHOIj/iiN1LMyPwHHI3K7r52aiAB1u6O3hQIgAnbUYKr3i3mHiIZcYBAT2OlRkZhKbSvq 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:DB7PR05MB4188; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4188; X-Forefront-PRVS: 0743E8D0A6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(136003)(376002)(346002)(396003)(39860400002)(199004)(189003)(186003)(8936002)(14444005)(66066001)(47776003)(7736002)(305945005)(2906002)(11346002)(446003)(52116002)(97736004)(6116002)(2351001)(76176011)(3846002)(51416003)(86362001)(25786009)(16526019)(6486002)(486006)(26005)(386003)(68736007)(6496006)(478600001)(105586002)(50466002)(5660300001)(6862004)(58126008)(81156014)(37006003)(53936002)(81166006)(956004)(2616005)(476003)(8676002)(106356001)(16586007)(36756003)(48376002)(6666003)(118296001)(316002)(6636002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4188; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR05MB4188; 23:o6m5tDoAMc0GJGFUozfHG15HpIC679ddxqR3AcZTw?= L2hQB5pd9TlkPE8WyL+tWTdPmwHkkUJgjNFXZnmscwLN0rps6OvM3inzNQLGp6mjDRQcx0bX9ExjBvedGbd9Hgt8hZIjj+RPXM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CWHsgRo6XTymh9wa6yzWbI=; 7:9w/mbxPj+ImmsrYtC1W/6o63hMcf6nFbROzSPQzgvlpUYxduW0/si6eSDTn6UBh4wcH3bQ+g2uTVOm0F0j3MgbnxG48tqjKQ++GSd+vZwsQX6nrZNZOecpnB6TEiOd5A2PcXkj/gKzo5Jfx1JfXcmDFiJRVFUxS683sA0HA4Xj9V0VAn2liVQH/YYmpiqFPCXaciPK4X/nzRRZwEZQFLR//1Ual2ZfDpvVjuuH331de9UkE1C7tgFbnAz4jF2mbq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2018 21:05:44.4651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8dc876e8-ec78-4ef1-ce3b-08d5f1a938c6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4188 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP The function dcb_app_lookup walks the list of specified DCB APP entries, looking for one that matches a given criteria: ifindex, selector, protocol ID and optionally also priority. The "don't care" value for priority is set to 0, because that priority has not been allowed under CEE regime, which predates the IEEE standardization. Under IEEE, 0 is a valid priority number. But because dcb_app_lookup considers zero a wild card, attempts to add an APP entry with priority 0 fail when other entries exist for a given ifindex / selector / PID triplet. Fix by changing the wild-card value to -1. Signed-off-by: Petr Machata --- net/dcb/dcbnl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 2589a6b78aa1..013fdb6fa07a 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1786,7 +1786,7 @@ static struct dcb_app_type *dcb_app_lookup(const struct dcb_app *app, if (itr->app.selector == app->selector && itr->app.protocol == app->protocol && itr->ifindex == ifindex && - (!prio || itr->app.priority == prio)) + ((prio == -1) || itr->app.priority == prio)) return itr; } @@ -1821,7 +1821,8 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app) u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio = itr->app.priority; spin_unlock_bh(&dcb_lock); @@ -1849,7 +1850,8 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) spin_lock_bh(&dcb_lock); /* Search for existing match and replace */ - if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { + itr = dcb_app_lookup(new, dev->ifindex, -1); + if (itr) { if (new->priority) itr->app.priority = new->priority; else { @@ -1882,7 +1884,8 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app) u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio |= 1 << itr->app.priority; spin_unlock_bh(&dcb_lock);