From patchwork Wed Jul 25 13:53:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10544037 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC229112B for ; Wed, 25 Jul 2018 13:53:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA86C2A020 for ; Wed, 25 Jul 2018 13:53:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEC2A2A03E; Wed, 25 Jul 2018 13:53:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC74A2A020 for ; Wed, 25 Jul 2018 13:53:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bGsZ0tCrzDrS7 for ; Wed, 25 Jul 2018 23:53:38 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="WOo3TZ8H"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.8.52; helo=eur04-vi1-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="WOo3TZ8H"; dkim-atps=neutral Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bGsQ6KgbzDrSg for ; Wed, 25 Jul 2018 23:53:30 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VzS5pclGWAhSIg3O14SLTjMQvu1zmzcL9SmIVq1IY0o=; b=WOo3TZ8Hd2JjXfMpGBGZa3QSbmd4eLXeUsbK0byHGDzUEaxE+F8sWKzBhmrRXRqlRMOh+o0czdBb5rb8BTgo6eyNU88g3yyxDO0cRB2JtI4soTXfdzKHVk1/Tyfl9q7iw/7g8h4nyHabt+3c6j6xVYjaIefwKP3YwWpv1sUg7Fs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM0PR05MB4179.eurprd05.prod.outlook.com (2603:10a6:208:57::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.16; Wed, 25 Jul 2018 13:53:22 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 1/8] net: dcb: For wild-card lookups, use priority -1, not 0 In-Reply-To: References: Message-Id: Date: Wed, 25 Jul 2018 15:53:13 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: AM4PR07CA0010.eurprd07.prod.outlook.com (2603:10a6:205:1::23) To AM0PR05MB4179.eurprd05.prod.outlook.com (2603:10a6:208:57::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41a680b3-4815-4e7e-d801-08d5f235fca6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4179; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4179; 3:3lkhPq9qY06IX2JE445puyf8RAZe1UpNbypkzmlYQAksnExOqfgK1FD18zceYy9W6GgEhohC9zwPb4FlHnPWQXAod6fLtB6lwtrJokZC8q+KqtXvu7Qtpwi9a+zYRwjZ5Ol34wCRxDxZzSiL++fwjV1XOgfNqx277Dy4moLZ85AFKUQ2rv7PZJvMqvqwQ1VDNDp8LvUCTgd9YSKD6/iNnnHmDHUJPRuMKxmgwDFNMTl4DrYYrScHtWTaUcKSev4N; 25:b+l8S7gcptC27TPNnPL9d45XPmmfr7FbMZmpdncMD9p+iH9YuD13mpKdElib9TmtCqDMqZ76AIVDX3hAec/Q+WGBcA2N4arbLAnKo1o7pWtyAwXZjFDPnTKqE3TwO89F/5lyV811d7Wp5tfDTg4SmcPwo6Jiujhcv0XXA2jZ617oTj9Qub0gNkLs5IT/Imu8lMTgs0zYuWsrpoYTaMzMXv73wS4n/6Ryxpwn67GAegAGbgpRYkZWkhEVN6+01E+6N5a6KaDY5pmSpSUjkpUJi/nLTsjQej1PDDYGwJyqqWpL+3PkwhDQn3aMihBfZa/JYNiL21MuiONkwmuCNPHzI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SgjNZzzMDk91ZUO7JvJ3nloKfp36Dny/FS9xqP2NAVrvj15YjQdQOyQfoYk1t57tlSJMhbIyTbven X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4179; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4179; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(39860400002)(376002)(346002)(199004)(189003)(11346002)(36756003)(6116002)(14444005)(3846002)(305945005)(118296001)(316002)(81156014)(76176011)(8676002)(37006003)(50466002)(68736007)(58126008)(81166006)(16586007)(47776003)(7736002)(66066001)(446003)(48376002)(26005)(105586002)(2351001)(8936002)(106356001)(6666003)(6486002)(386003)(53936002)(186003)(6496006)(6636002)(25786009)(2906002)(2616005)(52116002)(16526019)(956004)(97736004)(486006)(6862004)(476003)(86362001)(5660300001)(51416003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4179; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4179; 23:ZFHywuRQ6DVzUjJo77emgf9amrPO1Lkyr7BvekbWU?= BuzuuaFNbR5oMtxjTmF5f+ClUns4qqVp22Wlz4cKSdUVifzbjyCbutdStuFMRiRvwCHTnCipB31/RQigHcvqhzHB45vrSMRx6GPVHQ9RD0O1JqDt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=; 7:8NCwKhrnzSJ30t0uU4Wq20lvhxVb73ZdXVfmjqjOkQ4uKQo3bXjQs6u36kqtDr8nqMuAI25tqhf7YDgX3mE6+fztoZDDoayOuBia625l2dqIPx617luwo91qDq+KOvVQZLhJejR50nK1h6SHka8h3MCb7uhDYKHuxdUxC22GKKJzzNIdMUzyJ4IkhvU+7eR2jR1PQJY3iLmhflsgSfLL9nrMn8hSR+TbHOa1/CexC1cOV9KGBARDQczMVE6GqTbz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 13:53:22.6118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41a680b3-4815-4e7e-d801-08d5f235fca6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4179 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP The function dcb_app_lookup walks the list of specified DCB APP entries, looking for one that matches a given criteria: ifindex, selector, protocol ID and optionally also priority. The "don't care" value for priority is set to 0, because that priority has not been allowed under CEE regime, which predates the IEEE standardization. Under IEEE, 0 is a valid priority number. But because dcb_app_lookup considers zero a wild card, attempts to add an APP entry with priority 0 fail when other entries exist for a given ifindex / selector / PID triplet. Fix by changing the wild-card value to -1. Signed-off-by: Petr Machata --- net/dcb/dcbnl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 2589a6b78aa1..013fdb6fa07a 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1786,7 +1786,7 @@ static struct dcb_app_type *dcb_app_lookup(const struct dcb_app *app, if (itr->app.selector == app->selector && itr->app.protocol == app->protocol && itr->ifindex == ifindex && - (!prio || itr->app.priority == prio)) + ((prio == -1) || itr->app.priority == prio)) return itr; } @@ -1821,7 +1821,8 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app) u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio = itr->app.priority; spin_unlock_bh(&dcb_lock); @@ -1849,7 +1850,8 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) spin_lock_bh(&dcb_lock); /* Search for existing match and replace */ - if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { + itr = dcb_app_lookup(new, dev->ifindex, -1); + if (itr) { if (new->priority) itr->app.priority = new->priority; else { @@ -1882,7 +1884,8 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app) u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio |= 1 << itr->app.priority; spin_unlock_bh(&dcb_lock);