From patchwork Tue Dec 14 10:21:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12675747 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79276C433F5 for ; Tue, 14 Dec 2021 10:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233032AbhLNKWU (ORCPT ); Tue, 14 Dec 2021 05:22:20 -0500 Received: from mail-mw2nam12on2077.outbound.protection.outlook.com ([40.107.244.77]:26272 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233037AbhLNKWN (ORCPT ); Tue, 14 Dec 2021 05:22:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7YM+Ag6l/FGFEGkzajxaRbC6/FPv4rQulQnQUSSwhXUF2sxGRT3gDpUGYpHzDtoKURcCi5ijkd9//zQMVDeiiREKkzOLpRR6cOs7MnUPoE4Ul/Qd7UZwkrLo0iNLW5LdoTLiqh8ocrZOaPwOuzjL7/uO4x8ayY4mhk3i6ZxzcZgztFmi0ZSiN5mYs/re4Cbrz2SsqVSwHXZ+sxrAprI7fStJyojklg1ggMpQW3ktaExWCSnL4fSEVIPcv708aeZnCqPzZFVCcISghmp/pBE/AueEcSoP9AtTO+nLuH5dSPrgxw5gE/jP8jCYxPRwz0lkuPc+dti3/+B53tAePjSBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nS+iugIAWKcB5wbrznom4AYqCfvJLsVrQM9jknQTAvE=; b=h7sucQdwENI/XGJTUlCG0PGnJf863CQIIWRFGY4Jghwzo1b6/lju4POEgldV/YIGZeqnhWvL/+iHt42Ovw7JIuBfh+IcLwlHOChTT/M69EyQqikrTj1c/zDBs0dugM02dYXE37gnrKhvFwZkzC4KmNRGWU+KFIgzSrGospAO+E+A3purKnM/kpOJZmgXUg6JyWDi8Yvvyf1kPg/OziaYITLyr9wd5KX7XCeoHjK5+2rgGAvEI74CX8nYuM51in59jFi5tKov/c6xJ5kHhXo2tbl5vw9JtVTcGPT4aRVLsnQizqd12anG72E8lzHZRMzCOvQVw6OewDV/tny4URjJ3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nS+iugIAWKcB5wbrznom4AYqCfvJLsVrQM9jknQTAvE=; b=e7efdw/zUHOccEXKrfXQEZrt7zHno+mhPrSSxso9WqTgRPxZydxRwZRk2mfwiNlzjhM/QspHF0BAZgBgKZ3GJGZiPpZOH/jhVz33/P/PjNKYBhDcjKB9FwBI68DMrOi22fZdX/6qK7GKZV51wQ879mYEeaslfTkO3VhQoZroGL4VtjJ1+PeIXLY0EOAsRoV68NqkdRzDm13rje2QMPYTRnkXow0VOqIOVw7ydo4ukR6wFE1MJDgIk9NAudcqG8ptsHevT7qX9S4OvSQY/w7Yhb4TBk44HlsqMFZ9mb9uQllzYAImRvoEkOOvW1Fm0avOMvmmsCqMer2Q07FC/5q4fw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB4757.namprd12.prod.outlook.com (2603:10b6:a03:97::32) by BYAPR12MB3079.namprd12.prod.outlook.com (2603:10b6:a03:a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Tue, 14 Dec 2021 10:22:10 +0000 Received: from BYAPR12MB4757.namprd12.prod.outlook.com ([fe80::398b:d0f7:22f:5d2b]) by BYAPR12MB4757.namprd12.prod.outlook.com ([fe80::398b:d0f7:22f:5d2b%3]) with mapi id 15.20.4755.028; Tue, 14 Dec 2021 10:22:10 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net 1/2] mlxsw: spectrum_router: Consolidate MAC profiles when possible Date: Tue, 14 Dec 2021 12:21:36 +0200 Message-Id: <20211214102137.580179-2-idosch@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211214102137.580179-1-idosch@nvidia.com> References: <20211214102137.580179-1-idosch@nvidia.com> X-ClientProxiedBy: MR2P264CA0015.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::27) To BYAPR12MB4757.namprd12.prod.outlook.com (2603:10b6:a03:97::32) MIME-Version: 1.0 Received: from localhost (2a0d:6fc2:5560:e600:ddf8:d1fa:667a:53e3) by MR2P264CA0015.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Tue, 14 Dec 2021 10:22:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5fb90c3c-0e6f-4541-bd5a-08d9beeb96b7 X-MS-TrafficTypeDiagnostic: BYAPR12MB3079:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u+UWf/uOqHnkMBg8QNKNHE8MsKIqlyYzQUnPR0iiS85zeIjSSp1COl8BE1oNKY1vdt6ZKzQAwduj+Ue6edxwLiA6OpjCMI9HSg5r4QOdrDgV8aTV8qmGH0V4bFP/j1YYgcex8vN6uhFgf6qKjnnDF78GK5Jas8FqE2b+F/fTj4I7mP1/APiwt6BRJvMhqX+Si+fwQXwA9mVEJqMCTEyCc1hJAEhJtSQ+qySoSsi7vLcpjSIQbWxxnBaOVN+YM9qipcIhRTaK+f7NBErvfw5jr74upEfFNHdoZVGdkYnMqpjsM1upFr9gwhM94Qb4dZQj4XSulaBS5oFYvZIsqSvnvQ9dCQOJIaGggpzCAg00DGxY9tSJGUAw6cHzMchHxswQX74YyXGM+CeghHZIKjerFLqkAfENNfBaPusLPSGwS/AUFUVvNijDLWA6bLTzCLO8dKzxxsZXOdCtf9/HM+AEZtWa8P1RI7GhEkqzsMMsZQSSF5HatqPq/qpRxaDHlprjJwl+PpITP++37I3ZCTirfEGsknyqpcql5ZM+hOCtBczgBGtK+rFBMndq2111FQi1Kw8KBYNwqU3wfg6KQd+UdaTtAsZQFPIJ05Z1LRFhr6hpQvxnqSncVgwxeefgWaBEtMWsmekijuijYHC4N9NI/A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB4757.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66556008)(66476007)(66946007)(508600001)(5660300002)(1076003)(107886003)(66574015)(316002)(8936002)(8676002)(86362001)(83380400001)(2906002)(36756003)(6666004)(4326008)(6486002)(38100700002)(6496006)(2616005)(6916009)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1rhM0y7LeO+XPwLFjn3eU8cLgTHxuemrPc4TTs0EXjlBOPvDALowX6m2NsCZ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7c75vvb2h9vsp0PdblaExZXjDx71rjHwIqiqpnmE3xFEfYlgOdgIAnsc0hNlMAYMsHmyjjfpMj41qoMqG3UVEMpNNXbYSRz5zxS+FsjFzel9cRSMZ1iAExmQmjCwXLsGdi3JnXgWF6sQuXSYSDM/Z1miJAiZZnC2Dc7oEA8RfiSmcPMJEwQty5Vjkfg8lDxdGFCtC9vFllqa7Pm7RoUbR3uaTJYzmU6f1aOdjdA9tB6QEJRDSroCBAt4+Tmz0+NPj7tAsrqfqm4SHyBGZR9MTIFjD/TEpwiB5Uq+Z81oUVgVVOq7m5sLcOK6Tm+dTfooS1TgadJFkMKv+Vd+wwsfQgE3Rlo/ay6twnHHz+3mr5QagfBzYgPon1IVgwACmzvmlYDsmpiLQndN+6J2PWYb6NgR9FOwhcGNwEZyWD1DjFKVf7Ms7hIfP8ajQsp7CgE460BPAKUNcBU6G+/kLPZ9gom3ZSwjIwcWjfh3U59hKnohK6n6eFYKBvQYTFcqeQhuPbn2+yw06VqrllzoiV+scZJpUcifnDp6QmwW5rdSKd1+j9v/a2gdO6Ku5S8A= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fb90c3c-0e6f-4541-bd5a-08d9beeb96b7 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB4757.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 10:22:10.7507 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HREN/QV2hg5QDCm+9U0fqwjXidQFz0tNSiikg72WGf5yzvr/lzKR2Ql7aVooxRf3v16A2fMJl3bxtgLTZl3dKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3079 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson Currently, when setting a router interface (RIF) MAC address while the MAC profile is not shared with other RIFs, the profile is edited so that the new MAC address is assigned to it. This does not take into account a situation in which the new MAC address already matches an existing MAC profile. In that situation, two MAC profiles will be occupied even though they hold MAC addresses from the same profile. In order to prevent that, add a check to ensure that editing a MAC profile takes place only when the new MAC address does not match an existing profile. Fixes: 605d25cd782a6 ("mlxsw: spectrum_router: Add RIF MAC profiles support") Reported-by: Maksym Yaremchuk Tested-by: Maksym Yaremchuk Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 2af0c6382609..764731eae2cd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -8491,7 +8491,8 @@ mlxsw_sp_rif_mac_profile_replace(struct mlxsw_sp *mlxsw_sp, u8 mac_profile; int err; - if (!mlxsw_sp_rif_mac_profile_is_shared(rif)) + if (!mlxsw_sp_rif_mac_profile_is_shared(rif) && + !mlxsw_sp_rif_mac_profile_find(mlxsw_sp, new_mac)) return mlxsw_sp_rif_mac_profile_edit(rif, new_mac); err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, new_mac, From patchwork Tue Dec 14 10:21:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12675749 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA287C433EF for ; Tue, 14 Dec 2021 10:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231292AbhLNKWX (ORCPT ); Tue, 14 Dec 2021 05:22:23 -0500 Received: from mail-mw2nam12on2077.outbound.protection.outlook.com ([40.107.244.77]:26272 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231277AbhLNKWU (ORCPT ); Tue, 14 Dec 2021 05:22:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMgOV6vbEsuZe5uYf7siUJ5Ye5AJ0/2MIop3R5FKgHHkAip9BAhUdS1rUr71ufw5iJFXaRVdGVpdMGHN2yYADGW2ftfbP9lv5W5cMitUFRo00ZEMauKeHners6Uh9zTloYkXouqR0o4+FO5pHGlOMku2B8OVvq/5afEFVoLYEBZRZbAJZJRxOOZms8DBftNnVqvOkUb7rm2VnG0Icpi/zX+4GamrNw08tiuEy5WifVgymFv11j6/GaqzRDSqmHeeh2xXQRwq+LwBfubsV2Wn1tvdXi9jzkSuuLhrF/M014v3zDHJMPSjbw7eriDBZpSaI1zOa/EbawXL+G6qkCbvHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+ulMIiQ+zknwvUtUgN7zXsgQyTg04J+yB8vI6HBrx4c=; b=Vinj/Q0bpl/LZGfJET7tPKqmDerpGQfjNaKpWPoNmaTc2DffEAqYlhNGtRet1cYszw2IRbpBkF/1yj2BAzrR7y2C5ZpKhtUFH1Suxg0+zprKhaZHV43FsX98S8rT54OayRgoSk+Cs4mzDbv/cWJXgF8SjT37nwK96LzOhzuH8FZLhWP977u2OuA/gVmKZn6B8pU+QdLYAvXoCIAMjhodvsptTCfij18dmS5NqnKjoT2SytQio8N4BBlSH8wjQBv78+awCIdIdkO8esHGtdjLgzi3Rfil3by+zRDAOGRQKvr6oP+nVsnsKZTeqLVw5QW/UaSs5y4Ahe1CqxmakvOaFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+ulMIiQ+zknwvUtUgN7zXsgQyTg04J+yB8vI6HBrx4c=; b=ClMCDuhwgODEH1D5VLWvpNQBhtfRlmldS56uH7P+yVIkfPuq8UjPVoP7Pu1SoN+a0jLEo1XFSQroRNHjNqKwy6Cmmi4rpsFjIt0jlld5U0Kab1Q6MhdYqLfUuzY/CWZSU5YSorxtQxUKCgeScN/PzDiYPx2zeuEKk0QKmrnLaeqRomZE3Piz6LB/AN1yIE0fYegZIvxlasHu3DAM7w5uDdgYL1VkwNqA1R2xNpyGnZ0QRfmn9tU77U8H74HXybjsT3l4Wn5h9jZ/eW8NoOi4NwCqeJD/Q7MbqcZLGhFAqO1KY9sM76PjULzm8zuwWec4v+cnpoLk3S5SPG1GNy7U3Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB4757.namprd12.prod.outlook.com (2603:10b6:a03:97::32) by BYAPR12MB3079.namprd12.prod.outlook.com (2603:10b6:a03:a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Tue, 14 Dec 2021 10:22:18 +0000 Received: from BYAPR12MB4757.namprd12.prod.outlook.com ([fe80::398b:d0f7:22f:5d2b]) by BYAPR12MB4757.namprd12.prod.outlook.com ([fe80::398b:d0f7:22f:5d2b%3]) with mapi id 15.20.4755.028; Tue, 14 Dec 2021 10:22:18 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com, danieller@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net 2/2] selftests: mlxsw: Add a test case for MAC profiles consolidation Date: Tue, 14 Dec 2021 12:21:37 +0200 Message-Id: <20211214102137.580179-3-idosch@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211214102137.580179-1-idosch@nvidia.com> References: <20211214102137.580179-1-idosch@nvidia.com> X-ClientProxiedBy: MR2P264CA0131.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:30::23) To BYAPR12MB4757.namprd12.prod.outlook.com (2603:10b6:a03:97::32) MIME-Version: 1.0 Received: from localhost (2a0d:6fc2:5560:e600:ddf8:d1fa:667a:53e3) by MR2P264CA0131.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:30::23) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Tue, 14 Dec 2021 10:22:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 730aa42b-832f-4b3f-7949-08d9beeb9af4 X-MS-TrafficTypeDiagnostic: BYAPR12MB3079:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J3o7IJiCgb2m3egEQFQLbdPGYmobAzpWCSelS5XAoowyepasIvNdHf5JJYdmW6LpwU27jzsHhyT3E5BJ90dAZmJ/8mApKcJdkFSvbcNouOuftDwV4bqWXj2/eeMeaYw26j1Vci+u0QY+pkVh4dHMdA7Z9re/iddIHM1VN7T3AfLtbrFOPXT9/Wgz34TU360X0DrWLHjSUYBrN+D5vIGAJycv/M1ZwKgJWel6lM5N6RjR2LoYqCvGK00wwJgZ/x6iqx54xIGJRAhj5b7H52rI+TciGXKfuFKfbB/WFvwlqKOy1S9EC6WQYkmT9ycjaZ4Pl6wIVdooGRFj/m7U5uJJe83tF55qTq+Zp4145o2Fl8D2fb79wjjPQo+8HHv+v0W6QMtdCqcqNYLcxPJIQFjnAUnefDQSkdec/dFHdN7JEgvPAr9GwN/6jweNuhyV2nD+q4i3P8wNY+vOh0NxVd4/UQ6PKJ5NqlHmHmLeCqqc6TlcK6bXWTs30yQ8VdVdBbP/x8ewfTtd7CamEWHeoroTz1PZkGo1npw51f/LWCtEoF4i4jcMZADQzd0YnoJ1AeF47EDsA3UdgQtQJ+gmcV7JRcyN1QfalXHNdL6HNromhYS6OSO+3EKjXivNr8shrrWpsTRx0f3j7JmkePSX5voR1A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB4757.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66556008)(66476007)(66946007)(508600001)(5660300002)(1076003)(107886003)(316002)(8936002)(8676002)(86362001)(83380400001)(2906002)(36756003)(6666004)(4326008)(6486002)(38100700002)(6496006)(2616005)(6916009)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XaHk+NyyS6ToPR+LQv/z7qSrzJMWFegDYRqr5yONeGel1FY2SaCqJvwySLgSnsYFNr4gDLSE7NUdLHVKPGwfoUWF2P1rWkXLAQlnZoLmv4doaG0zc5kCI9s5dak2DOweNaJVSxUy6leYZebSUc6Ziyoy7JR0MwDO4S9/qLDXwzeYiUjNxaQA564PZvDwBB9FyDhnVggkvl3piLj1bqq/CrPyzZtunAxU2EVRmTiMyVwg0HlsPBktWWaGyAz0/mRlOloCtKmUoE+YPZhl1IDn3h8kemEJWOBD2gey0782iQVSE1QbzdU83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hWJuvz3kcuuRZ6/jkh6NV0qtzJ+3kD3w6ey/21S+Kn+3w369bdkeINioB1oCYJKnc0LjU6K0LFcZUXzYEL204fIPEkh0rYlB/p6vQctHotBiISLGbD4es/xBAJlnQY4qCp+jnI/EM+86xZjSGifHr66H+ekgKDrhi2Rm/e45z3dq8DKIfiDAio7eO6GIbGjnKqcJbl6U4o0pqh5FasM8BFivCTevuOG6hlGwp1Y+Ackt278k6rOmfeRFRSjoMy4Xs85jkaLZ5kh8YzXYpx6zm8eaCpjRYZtW5FbfAW8Oio/gbFQz5wJzPAvrQVA0ptKw4O5QY5o= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 730aa42b-832f-4b3f-7949-08d9beeb9af4 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB4757.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 10:22:18.0159 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jA+oKzHuZJfzYtoXp5r5rygEoVbD0afHPG7zJquDeuHlDaDrVcFvLFS0kvhds4/dBoSednV5+1c380WjrcmxPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3079 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Danielle Ratson Add a test case to cover the bug fixed by the previous patch. Edit the MAC address of one netdev so that it matches the MAC address of the second netdev. Verify that the two MAC profiles were consolidated by testing that the MAC profiles occupancy decreased by one. Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel --- .../drivers/net/mlxsw/rif_mac_profiles_occ.sh | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh b/tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh index b513f64d9092..026a126f584d 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh @@ -72,6 +72,35 @@ rif_mac_profile_replacement_test() ip link set $h1.10 address $h1_10_mac } +rif_mac_profile_consolidation_test() +{ + local count=$1; shift + local h1_20_mac + + RET=0 + + if [[ $count -eq 1 ]]; then + return + fi + + h1_20_mac=$(mac_get $h1.20) + + # Set the MAC of $h1.20 to that of $h1.10 and confirm that they are + # using the same MAC profile. + ip link set $h1.20 address 00:11:11:11:11:11 + check_err $? + + occ=$(devlink -j resource show $DEVLINK_DEV \ + | jq '.[][][] | select(.name=="rif_mac_profiles") |.["occ"]') + + [[ $occ -eq $((count - 1)) ]] + check_err $? "MAC profile occupancy did not decrease" + + log_test "RIF MAC profile consolidation" + + ip link set $h1.20 address $h1_20_mac +} + rif_mac_profile_shared_replacement_test() { local count=$1; shift @@ -104,6 +133,7 @@ rif_mac_profile_edit_test() create_max_rif_mac_profiles $count rif_mac_profile_replacement_test + rif_mac_profile_consolidation_test $count rif_mac_profile_shared_replacement_test $count }