From patchwork Thu Jun 23 07:17:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891856 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 21BFFC43334 for ; Thu, 23 Jun 2022 07:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbiFWHT2 (ORCPT ); Thu, 23 Jun 2022 03:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbiFWHT1 (ORCPT ); Thu, 23 Jun 2022 03:19:27 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA9B845503 for ; Thu, 23 Jun 2022 00:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D9UVYHoUnEL7iqeWBFW/SuTHSOftBQrvYUbJXLGxxJhGKtNdI5NmlmnGWjGomKHWlnBiiON/5YX3raiUUnNSNFpirI5Lp6CmsBiUG7FRweSZluLrsEmJJpa9iRr99EIU2zLiXpNznuXc2aWetVG3Hl2KU3ZRnsqpV231tjjhWGI6auIAjmKeWgqTSwtuD6m8y/rzZw09MA6tVC52dgPeuF+7hZr+V4jeHuU3MdBTliER6qW+1CEkzF8ung0gs0gtkHEVPBULdgziG1W8XjOEyh5pjdUKygMl33nGcFWyjX/FLqZ1Du28jWm9JLTEWqXuDQkjsGHGV5ep1bnw9wbImQ== 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=iWeqBtvOwrxti5FEL9PIKlJ52iSIQmh6ygGe7wsZoik=; b=TKLQUeVt78T8q+32uVaZQrvHuyEFG34Ld18gKGSXcUmy4JxgHmbJlmbGChexBOLtnTuHK4DDpd2qRxfeE9vf6bURv8InPu4JvmV4P0OPcR7PCrWQuuct7Rm4rQXNq7ZatEgGzMIg2ymF+2BAN8kVOkGMjyOAT0CLKp+KcaOguzz5kzwTrtCcOcq0DXFwbiLwtq067bLrAjhM6vOoF7+Hc8zdbV3w7i0M0sL1JX/dkU9IVvUDFWQlSs5E2MIDCO1lEa8NfPKw16U70qcF8FHdk6zDVlVohHdRudPbSN0fBdCsOQA4Goky5TLpC3GlWlmLtf1EYbtlt8S7Ix7Zpehgpw== 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=iWeqBtvOwrxti5FEL9PIKlJ52iSIQmh6ygGe7wsZoik=; b=quMPouggZaTQi0yTwDxrTbVDtOYrMvvYAHk7Lng1iQnDh188zM4ssg3zwwbExZEP7nl0f6Dm6aB7Oh9sov2XPceyCLhIrIuNJvJIZiJPzQpP54D8PVMmOQxaRYM+nNsoP54BW4NqoqEJvC5tAtgkSuTX6hWiFQiDpDWeP1gTpJ0f8I0u9JRO5LQqPO8PZuFTGSIM83yM5TQf5kHaaZaWwEwuB+NOOnxhg6PEUZ1pHlWvtXYC4CEDGavp/Btbn//BhJx5puPIcTMxI+UTXQ/ln2bwxdX46BwAf3XufPyML3V45VHTeu0NWIIBkP1CeXyxYhLAR0ggSO5zDMEreCRClg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by DM5PR12MB2518.namprd12.prod.outlook.com (2603:10b6:4:b0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Thu, 23 Jun 2022 07:19:24 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:23 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 1/8] mlxsw: spectrum_fid: Maintain {port, VID}->FID mappings Date: Thu, 23 Jun 2022 10:17:30 +0300 Message-Id: <20220623071737.318238-2-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7432f8f-d5cd-4852-0596-08da54e8b28a X-MS-TrafficTypeDiagnostic: DM5PR12MB2518:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yR3FYHjrq+xtuxsS8VgBlxnkhwl6HRzl6rVwlSv5HzEIp0zEEIyEVjMFkS8CvjTDfY62rk67fJWc0q0ASt018ZYKdTQWvzJPMdI4UboF3TOr6IJ/IW9xMXjsPNRYX2nGsI7OMOybbOZSffG2fuZTNVJ08vXO+YUZ7BOs42FKRn4b0SzqvFnGF7TnwgXs7GiMQwzWeIqlpzTkVrUjQ/9+3tYxtHv6GzeOZNKKIn9OmeOI1f41BnjxbxTmrdDhWFAZ1iHYeQz1mi/8J61UUf+mwsSlhpd3IIri4XwFWWzlC2mcpT0Z3B25XG6BQ/mv8AtxTzNEw3X6Zbmqz9ugiMtnrteEr7RLBb+SmiaulWJpYWmDqUEduFkvtPE4q5ZvZoyZlvV1jMrWk/Q2e3NV/KaHc5BH63LdxQguU6PGKiDTjHtiMH7f7wHckm/djVm+DdJ0U4HsNmAYTO0vC8mozKXp6lhj+mJ1R+0KRg4SpevCyRuGG5hEMPJaRrayOwb0NX4bwqQuszVGtkKOfFtTVDr3Uf8ViqDLGRtQQgvurbLCpGA5+m7J7Pg4hrguuc94DE83B9Zz/3v34Pal+5+Gn9I/tZxQ9N3gqWMcQnGP1OwK712GGIB6dXWZE+904q0NTI/1ObNtX7jF03o2RsQs1edQWSpab/VRJSkoquAE5lE90QEjx73DaAjbxnK9OBJLZ+p3YnUfRyzcOhINHe6LjcaHew== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(4326008)(8936002)(66476007)(8676002)(86362001)(1076003)(6666004)(6506007)(66556008)(6512007)(66946007)(107886003)(186003)(6916009)(83380400001)(2616005)(5660300002)(36756003)(41300700001)(38100700002)(26005)(316002)(6486002)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Kk/zO6MeQ4YcQAk8bQ4cPfr8fMkBq4kMEjevcsus0EVPUJ0hoz3e+0OXxjY2VNQSp5D+JKCMkK4ILxvViVw4sZfaagxUjvLgAlv1/sEqMvzNX2Ywu7nIVbRvzGS5WaJq4qTkYcoDKv+HmgIrYldalvhHvRMAlZNa74H9FmLcQTFc91xDF286g/bBxDkdyuEAkpV3ff0OCRAyn/3C+74qcXwlnQBXrX65cTd/clA72+njdcDbrXIYs8a9BT6Dmn4DjHfNULy+pl5g8BjdF1GOGRWaXiiB+n6Xly1CKY9OLkOadeY3VPqyfTUbxPswgX1INJf07Oaav7YE4F2xtPkyh1+DE++vX+7wiEZA9J1nS7EBGbyX4MTglg5wxQ7UsnFysNvzP0dSEBVQNEFgV2Yu/fV1N7x1t1GvudcetmOCjJ5htkg0pOQ40KSaNgR0/gQI/SEtvp5TflZllmakYD/FAxq0ElOQcvhhgYHa4niupC6H4xWQAY9kNNfHzaNfTEKxV+yN43ao9b2hxb16mARJD6KB8sH+EkF91tLsOgfeGZp0rX197ipB+ljBunpXkVUf4pPvTUU5EG74DFq6ptETk8/iqzxa3VlrlmeFa42gNsYNIr9d8mpXuAp7uKwRdbJkJQk+10ps/2vo+/B0uaapjnjXAWiOtbcLZqkE8+VQn1jZNoiVwz9VZn9nU6KMv1UH6Lsap5FNvi5vaSdhQ+HDEnBiBgLM6xaCK6mqKq4zAHKpVpqNFR5vp/pm9x5qWc78CXMN8wFoFmb6wfZgMwzJTRl48dgZYu57w6iJ5wvAPc/33hrjQHrc6qn/Md5mapRYGYPnc+kOkXrG9cnmTWEWm4yyCWrqxtDLHL/vyRbNyk+r7V0PcSfRwS/s8N/oocEPh48dYjCnnK/BXlXm8+17bVJBYHXf7nLHkJwYFLptasqZKN1RSuZnNelnhHTLbnnG+GO7R2COJkDFjFejDwnnqNG6uUM5B37CiqRii6yljNEWR2zBqnWNt+THC4Oc3KP6ZpzNU/4nT5Rm+nD+Guec7wCIWH/oJg5IZv77I+NHwMglafR5RTbyfq6+NdhfUHrIL207gzWlcjkYotYDP3xAA1py3f23DHiV2PNHZzD43fMNiV+deCqgrtDSc+j7QGrgDslg7xrCJj+5d1820M1LI4NB0WKKp4A5N+zkkeIO1FvSHujFeGjfdjwXz8+uG78XiWR/NCjYFyeeU8DtstvNuH1O3X1sUYenPrOUnJYNgAhSuRkh62oF2MVYYI636UMI06S3N/m5rxW8bq+ogfItzDwQtpae8NwZ4iBM2uJSs01gqiqG/NuKKXEOYjl1LU+9kRYr61TZGKJBh+d72Jsm+H3Q3Nz2zRRfhX/dbfT0le3E23Gq5Qwdt06kncHu/3N6I9HwFDnb/pKhdbZC2AUFUh0cbhO1zgsnQ8smMUK+b1JbExChbYboFL+ITuNTAxwwRnNjtiJ5QUzyvq3KifXLU6siCMs6zz+cKRPWqXYz3pSRruQ8cY7g8ctpECf3uNfWJMVqu2bf7LpwvCUcudwqM1dqqxpyJ9cicbYaIwtzOGNXZnr4ic2m10Zro5x+wYDXBGU22Gur+zEIqbbh5c0cNmGdV8i2lD0H7YYTLJhcTSQfs3I6TlEIsOHkDeE9laPz5crwTWEc4/SM1Hy+2puqjci2OwmwzTh9dDPJn0k2kwlAwsQVMsCCmecQwDVPKA7G86It+e7YiCPPY+PaPssuDg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7432f8f-d5cd-4852-0596-08da54e8b28a X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:23.1975 (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: e9HWDp2xw2jfAEOreQ7Utd0mtncA1cPEyHgYr4/Zvq/+Qvz9x2gTUk2XQ0kAG49GxCtoE3LEdosGkamDxVixFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2518 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen In the unified bridge model, FID classification mappings (e.g., {Port, VID}->FID) and layer 3 egress VID classification mappings (i.e., {eRIF, ePort}->VID) will need to be updated when a RIF is configured on top of a FID. This requires the driver to be aware of all the {Port, VID} pairs mapped to a FID. To that end, extend the FID structure with a linked list of {Port, VID} pairs. Add an entry to the list when a {Port, VID} is mapped to a FID and remove it upon unmap. Keep the list sorted by local port as it will be useful for {eRIF, ePort}->VID mappings via REIV register in the future. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum_fid.c | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index 69c6576931b5..18a96db3ba29 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -22,6 +22,12 @@ struct mlxsw_sp_fid_core { unsigned int *port_fid_mappings; }; +struct mlxsw_sp_fid_port_vid { + struct list_head list; + u16 local_port; + u16 vid; +}; + struct mlxsw_sp_fid { struct list_head list; struct mlxsw_sp_rif *rif; @@ -38,6 +44,7 @@ struct mlxsw_sp_fid { int nve_ifindex; u8 vni_valid:1, nve_flood_index_valid:1; + struct list_head port_vid_list; /* Ordered by local port. */ }; struct mlxsw_sp_fid_8021q { @@ -567,6 +574,44 @@ static void mlxsw_sp_port_vlan_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) } } +static int +mlxsw_sp_fid_port_vid_list_add(struct mlxsw_sp_fid *fid, u16 local_port, + u16 vid) +{ + struct mlxsw_sp_fid_port_vid *port_vid, *tmp_port_vid; + + port_vid = kzalloc(sizeof(*port_vid), GFP_KERNEL); + if (!port_vid) + return -ENOMEM; + + port_vid->local_port = local_port; + port_vid->vid = vid; + + list_for_each_entry(tmp_port_vid, &fid->port_vid_list, list) { + if (tmp_port_vid->local_port > local_port) + break; + } + + list_add_tail(&port_vid->list, &tmp_port_vid->list); + return 0; +} + +static void +mlxsw_sp_fid_port_vid_list_del(struct mlxsw_sp_fid *fid, u16 local_port, + u16 vid) +{ + struct mlxsw_sp_fid_port_vid *port_vid, *tmp; + + list_for_each_entry_safe(port_vid, tmp, &fid->port_vid_list, list) { + if (port_vid->local_port != local_port || port_vid->vid != vid) + continue; + + list_del(&port_vid->list); + kfree(port_vid); + return; + } +} + static int mlxsw_sp_fid_8021d_port_vid_map(struct mlxsw_sp_fid *fid, struct mlxsw_sp_port *mlxsw_sp_port, u16 vid) @@ -580,6 +625,11 @@ static int mlxsw_sp_fid_8021d_port_vid_map(struct mlxsw_sp_fid *fid, if (err) return err; + err = mlxsw_sp_fid_port_vid_list_add(fid, mlxsw_sp_port->local_port, + vid); + if (err) + goto err_port_vid_list_add; + if (mlxsw_sp->fid_core->port_fid_mappings[local_port]++ == 0) { err = mlxsw_sp_port_vp_mode_trans(mlxsw_sp_port); if (err) @@ -590,6 +640,8 @@ static int mlxsw_sp_fid_8021d_port_vid_map(struct mlxsw_sp_fid *fid, err_port_vp_mode_trans: mlxsw_sp->fid_core->port_fid_mappings[local_port]--; + mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); +err_port_vid_list_add: __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, mlxsw_sp_port->local_port, vid, false); return err; @@ -605,6 +657,7 @@ mlxsw_sp_fid_8021d_port_vid_unmap(struct mlxsw_sp_fid *fid, if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 1) mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port); mlxsw_sp->fid_core->port_fid_mappings[local_port]--; + mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, mlxsw_sp_port->local_port, vid, false); } @@ -792,6 +845,11 @@ static int mlxsw_sp_fid_rfid_port_vid_map(struct mlxsw_sp_fid *fid, u16 local_port = mlxsw_sp_port->local_port; int err; + err = mlxsw_sp_fid_port_vid_list_add(fid, mlxsw_sp_port->local_port, + vid); + if (err) + return err; + /* We only need to transition the port to virtual mode since * {Port, VID} => FID is done by the firmware upon RIF creation. */ @@ -805,6 +863,7 @@ static int mlxsw_sp_fid_rfid_port_vid_map(struct mlxsw_sp_fid *fid, err_port_vp_mode_trans: mlxsw_sp->fid_core->port_fid_mappings[local_port]--; + mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); return err; } @@ -818,6 +877,7 @@ mlxsw_sp_fid_rfid_port_vid_unmap(struct mlxsw_sp_fid *fid, if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 1) mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port); mlxsw_sp->fid_core->port_fid_mappings[local_port]--; + mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); } static int mlxsw_sp_fid_rfid_vni_set(struct mlxsw_sp_fid *fid, __be32 vni) @@ -982,6 +1042,8 @@ static struct mlxsw_sp_fid *mlxsw_sp_fid_get(struct mlxsw_sp *mlxsw_sp, fid = kzalloc(fid_family->fid_size, GFP_KERNEL); if (!fid) return ERR_PTR(-ENOMEM); + + INIT_LIST_HEAD(&fid->port_vid_list); fid->fid_family = fid_family; err = fid->fid_family->ops->index_alloc(fid, arg, &fid_index); @@ -1029,6 +1091,7 @@ void mlxsw_sp_fid_put(struct mlxsw_sp_fid *fid) fid->fid_family->ops->deconfigure(fid); __clear_bit(fid->fid_index - fid_family->start_index, fid_family->fids_bitmap); + WARN_ON_ONCE(!list_empty(&fid->port_vid_list)); kfree(fid); } From patchwork Thu Jun 23 07:17:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891857 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 E4B33CCA481 for ; Thu, 23 Jun 2022 07:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbiFWHTe (ORCPT ); Thu, 23 Jun 2022 03:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbiFWHTb (ORCPT ); Thu, 23 Jun 2022 03:19:31 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2056.outbound.protection.outlook.com [40.107.243.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00CC145AED for ; Thu, 23 Jun 2022 00:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YTYU+whz9sGaJPQ1Mh159Fik6Q0wE7XULa+M2mwrSD/h99P4V2pqjaxy4KCnydr02blUc3l+0wvjza/spyinzFhRDEh0irUlIkjfZ8snvD6nB2aebL3rESRFeU8KBNrHVGQupNG2g+x1P2G+AR4r95SJiSgngo0ARudFfNa6KUVaOdOND5B+yBr327hHEIEiyuvaxQTRqCnTSsayTDaWgmebvS1whKL+99heAQnefpD0pVtM+ZbwxhXCocj/qHuQSMPm7APt+9hqYCuHDFv5xRw8AHKfbeP7u3Ti3maNQ6W1UlSNC/b1T8WHROVdZo2sAGkWwWgqm5c8O69jWIq7ZA== 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=C4gj1r2bgGngzAO61j+QQ03z4amO9+HcuxPAe5bYOF4=; b=VTQY//WnPzu9fJ7QGnohhIhRV1A8NJZjeRLxs/Uy/gJXXDuanPb3MyDfxsl8XGzoLEj0ovRFuuh7JG2pW69bTG1B779eY2Cz2aQdHekNYuNx/iL4vY1Uql1WUXLIL/HA+CxPduaaIl4AJY4n06A7XNcX6w+FRL/hxafRiwqy3myv1HinKIQzepjqTOffqPPYyVaCzxBZBkBNOmAivz1WZHQLotz2YL4nsS5W6ZwerS4d1klhH7uZFrNhSn2GaRbLwhawwhsIa71fvdO65AUNIRLEI5p1CHs0syVJXZUsXekEAkJZLTdvocXnSO0YCUBI0A1C4SJW5N2We6CDvLCwKA== 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=C4gj1r2bgGngzAO61j+QQ03z4amO9+HcuxPAe5bYOF4=; b=Q27Es2KNbdUcsRlmVrpCF6tH0WdGVeSgOx7aw3jTDU5f8J4nWceKSnJfDC8R5oM6EesJACqYE8AezJ/vQkM4QwAB49iP6YWMwahaCbrjCy6TIbBHfglSAcuP+ZJs3keoUWInlOIcth9nNuC5vNQWB0x16LWDMZDMe1WN1roNYPkgA0xMeRzfah8+8Fr73Osn/OiDyhOi1F2uJLREKEtkl4BtxQ8Bsl032l8n1uVWlgwkgw7JIAK+4WSi9p0YERWRpE206sRWdZd2auIKnWo6EsqnV7k7LoIoJzjhHoBgBNuKGorQefUJhs16vC6XrKBAO84Y77Me2XplRRHODv2g1Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by DM5PR12MB2518.namprd12.prod.outlook.com (2603:10b6:4:b0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Thu, 23 Jun 2022 07:19:29 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:29 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 2/8] mlxsw: spectrum_fid: Update FID structure prior to device configuration Date: Thu, 23 Jun 2022 10:17:31 +0300 Message-Id: <20220623071737.318238-3-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0701CA0030.eurprd07.prod.outlook.com (2603:10a6:800:90::16) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b9ea96c-9641-4912-9d05-08da54e8b616 X-MS-TrafficTypeDiagnostic: DM5PR12MB2518:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Immyn14dRUlYvlfXe7WcpTI5A0rN7kWb3rMFmWVzntHrWiPDJfnspF4r+mAGaVObw2xQ/Di2/xrd63vFG7xz+UcWOvZqG34Nu/3gRGylQp6p8PZHowbgxXWoN5YEqSXyByorm9ocJ0ETDjLUxkVAd7Hz1kLgYlKu46tEsJDN2Y0HRcIxPhivivjozBpRAQRbmIx7/ZVJOoWZiJKniFEArQ96yX5hbn36W/A8OqbvYkcQO0BlJAY6EHmrZAH3lsLPtgbey+ftMe1ppAEHsNgjp3eeA4s3yh5rSKSsoHhGyCgJ/p41TbFIzEXgCMDvo6w9E690KSeUd6qOV5vWAxOabQbX88WGdP3muWYnZSXtu3pj2l1nAYKGRID8DXPynM1yoEJ7Bo52iQWp54xHXtDHHyqMuLaIH4KsclVFJqtg4BvDSeRY9gQzgBxpkxZ0VxcvBDD9sBKPc0t3u6NGdPS6XcV+4MoPn9o6V/ormyEzeT4PTY1YpmgfXu5SYQa9r+meqHWxABVFvQ2Z7pUU7puwrIUHTfAFiriwOhmmqB94oWsKcPx57k3RKrSH0ZM1aj4KxFuqV3PfTz7+Uv2HNQkinhNr3jt4ZMi/fh1HlnTPXMOdF5eVA+4qPik9kdeWJh7MNPQjNuBAggsPG2G5+9j7u9c4zkKPfbjDq/g08/Q+hP07ebAK+gbYnSr1WuGnxsdT4tNzdl6A5RvEwd4SOwxssg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(4326008)(8936002)(66476007)(8676002)(86362001)(1076003)(6666004)(6506007)(66556008)(6512007)(66946007)(107886003)(186003)(6916009)(83380400001)(2616005)(5660300002)(36756003)(41300700001)(38100700002)(26005)(316002)(6486002)(478600001)(15650500001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vCgb08RxZE37btbD1z3ArCWEpqV9yaBPKKgbRMhCar3W3ONUJ05L0MhHojSWioPV6tRVJPcqD06aCd8suPCaXcOsyjwrtSqjUO0MMpDPGuzE1LBlBHctGlu4CoFPAkBWaUYPr6ePbE0p1TrjN84mHf3HsJFgyVA8L7uV1fy1pf7AB5hTcf3gA/ibW5yh7R+1OUGqAm4oGUE4zTlJGvGj8M31EsvIt9Z8YrffLQPosgJ/KJ/BjIsDplwfuRsf7AjbiK7tJyIjRw+xcDvX+gztR9o0j01UnBSd1I4iwFvE6W2aY9WxKgtGMqHP8Wl3h3Aw2rTSCPUmnlr85aklNYVVWGAOLvxxxqK4n4a4bpChbd+F69q4A1TBAs4d9dzZqkT78TcJrA6IQPt9xdeNdr/ehMrlqxIfvVlb/Vf6z50QJKokKiSKBwNVDymZSPzm7QyEDdXtUuC1baokAnkPC2pXAyNL1hfcO8z40jRTj8sApqEKuDtICH9kCL/qLdn/QxqjcMBcYzJRpDRzlL7YwqK2apaZfku2mNm+jsGoKdMMkvD7wA3m2zCxjNULp3Z+RAONYBJYLNpHaQ9EZtiqFjTFXcubKy02/wp02g/wRLXSYgb84XMIyA0dlAZAWxUEqzy5PcNj7d45DiGaSOp4V4CT+ip9HuPwT4Sx8+Sgb6y2maUjYiAfCzH6OgaFbi/2hCZ/+qOKldWRjh6oSJy8ux9b4apbHyvL4tsAs7e0f43CG1Xv4UUPZZqpdsS+zNxqRJUnQhlsKmwv1guNAfDifwNHQrPnl2BRUISv8diBRinHSnsWJQOufELLOsMkYLSMPsWHQd/Xtpuzg1I8K5I+dpfbdMkUPoPkNx9GSeZVsUYnexKdoWS9d6W+e/hlUdreJIbXe/HJdFJ8a2H/sjeNICrKZnSIwl2IIrot1MGBXdw+ty3KpP6MeDtZ5NMqlYHOH0K7OYW1+HdW1qNZMcQHYWmO0OMzGk8yba9YwYFiQXODmRzDQx0NCeA43ddjR9AYpyavXVyhl0K2VWCC2JcutJq5YOzLTpR9E8CnMMWr3oMAQsZqXS1kUzva6nmMiC7USHAi5D+6ErrDtdChIoajldCKhDjDUdjgQ9o0Zh4afSSGsHn2SRDQdbLwe2Lpm2kKrzKL+RepQUmXIWa4Ws728kwpGFCrNj5iM9FJPp78SRvbJ7yMKrlMuCgCHymUcYzwkQhCCuqBehH5fKrfRnzc1ElZ2hHIVfNXhepqDE4btNJFk9kpIkp8MFBBJBXGjNFAqX0/lNr+dLsO8ka/ZHwDWpVLDPQ8rI2xw7eCmv6DZN5qNByiUhGDdzTov3l4oC0dMePsUyQrbzyV32MogMLH5wPGD6O72++/ybFh9SwwnoEa69PwioHGYawon94Hzsm0HAAwAvFJzmUaJSiwJxxxpy6Brh66Fy79HXS4F6iVaV5BuSDjtZfmx+7Tbf2EkZDurN8qpGP6jkAR4uoC/F+hMlyEvLVzlY+2TDjHsU4eoqONXM2blvhHN7lYMxzh1fAtMrOPbs8ivWpIz/86yZivOULEJafwE/nbAe7dLQRay0WxaCXH/sQ4Rxf1XRQJ6V6NFwVCj0X0NRgZnLrs/T1q63UvH3r79jks2uuL/flFYf9nwEKq6K1LYLDD7cQFjndV6HbpURYwPvXVaYlH++rUKIX152JZ7BiEqHbx/cWkxYi6Q+sCF9nwOJqhYNEwdenzJTxji65jeF3sCTAAZFu6WEi4jA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b9ea96c-9641-4912-9d05-08da54e8b616 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:29.2302 (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: IZ7fAml2J4ZSvgstQIRrNcQPeFdidv9edrT+0RoWJs4PsAnKdqVnKXXEB5YYS8sM4ne1jjd7ESxGZX6fehuU7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2518 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen Currently, the only FID attributes that are edited after FID creation are its VNI and NVE tunnel flood pointer. This is achieved by eventually invoking mlxsw_sp_fid_vni_op() with an updated set of arguments. In the future, more FID attributes will need to be edited, such as the ingress RIF configured on top of the FID. Therefore, it makes sense to encapsulate all the FID edit logic in one function that will perform the edit based on an updated FID structure. To that end, update the FID structure before invoking the various edit operations that eventually call into mlxsw_sp_fid_vni_op(). Use the updated structure as the sole argument of the edit operations. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum_fid.c | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index 18a96db3ba29..ac39be25d57f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -89,10 +89,9 @@ struct mlxsw_sp_fid_ops { struct mlxsw_sp_port *port, u16 vid); void (*port_vid_unmap)(struct mlxsw_sp_fid *fid, struct mlxsw_sp_port *port, u16 vid); - int (*vni_set)(struct mlxsw_sp_fid *fid, __be32 vni); + int (*vni_set)(struct mlxsw_sp_fid *fid); void (*vni_clear)(struct mlxsw_sp_fid *fid); - int (*nve_flood_index_set)(struct mlxsw_sp_fid *fid, - u32 nve_flood_index); + int (*nve_flood_index_set)(struct mlxsw_sp_fid *fid); void (*nve_flood_index_clear)(struct mlxsw_sp_fid *fid); void (*fdb_clear_offload)(const struct mlxsw_sp_fid *fid, const struct net_device *nve_dev); @@ -211,14 +210,17 @@ int mlxsw_sp_fid_nve_flood_index_set(struct mlxsw_sp_fid *fid, if (WARN_ON(fid->nve_flood_index_valid)) return -EINVAL; - err = ops->nve_flood_index_set(fid, nve_flood_index); - if (err) - return err; - fid->nve_flood_index = nve_flood_index; fid->nve_flood_index_valid = true; + err = ops->nve_flood_index_set(fid); + if (err) + goto err_nve_flood_index_set; return 0; + +err_nve_flood_index_set: + fid->nve_flood_index_valid = false; + return err; } void mlxsw_sp_fid_nve_flood_index_clear(struct mlxsw_sp_fid *fid) @@ -258,15 +260,15 @@ int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, enum mlxsw_sp_nve_type type, if (err) return err; - err = ops->vni_set(fid, vni); + fid->vni_valid = true; + err = ops->vni_set(fid); if (err) goto err_vni_set; - fid->vni_valid = true; - return 0; err_vni_set: + fid->vni_valid = false; rhashtable_remove_fast(&mlxsw_sp->fid_core->vni_ht, &fid->vni_ht_node, mlxsw_sp_fid_vni_ht_params); return err; @@ -662,12 +664,12 @@ mlxsw_sp_fid_8021d_port_vid_unmap(struct mlxsw_sp_fid *fid, mlxsw_sp_port->local_port, vid, false); } -static int mlxsw_sp_fid_8021d_vni_set(struct mlxsw_sp_fid *fid, __be32 vni) +static int mlxsw_sp_fid_8021d_vni_set(struct mlxsw_sp_fid *fid) { struct mlxsw_sp_fid_family *fid_family = fid->fid_family; return mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, vni, true, + fid->fid_offset, fid->vni, fid->vni_valid, fid->nve_flood_index, fid->nve_flood_index_valid); } @@ -677,18 +679,18 @@ static void mlxsw_sp_fid_8021d_vni_clear(struct mlxsw_sp_fid *fid) struct mlxsw_sp_fid_family *fid_family = fid->fid_family; mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, 0, false, fid->nve_flood_index, - fid->nve_flood_index_valid); + fid->fid_offset, 0, fid->vni_valid, + fid->nve_flood_index, fid->nve_flood_index_valid); } -static int mlxsw_sp_fid_8021d_nve_flood_index_set(struct mlxsw_sp_fid *fid, - u32 nve_flood_index) +static int mlxsw_sp_fid_8021d_nve_flood_index_set(struct mlxsw_sp_fid *fid) { struct mlxsw_sp_fid_family *fid_family = fid->fid_family; return mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, fid->fid_offset, fid->vni, fid->vni_valid, - nve_flood_index, true); + fid->nve_flood_index, + fid->nve_flood_index_valid); } static void mlxsw_sp_fid_8021d_nve_flood_index_clear(struct mlxsw_sp_fid *fid) @@ -697,7 +699,7 @@ static void mlxsw_sp_fid_8021d_nve_flood_index_clear(struct mlxsw_sp_fid *fid) mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, fid->fid_offset, fid->vni, fid->vni_valid, 0, - false); + fid->nve_flood_index_valid); } static void @@ -880,7 +882,7 @@ mlxsw_sp_fid_rfid_port_vid_unmap(struct mlxsw_sp_fid *fid, mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); } -static int mlxsw_sp_fid_rfid_vni_set(struct mlxsw_sp_fid *fid, __be32 vni) +static int mlxsw_sp_fid_rfid_vni_set(struct mlxsw_sp_fid *fid) { return -EOPNOTSUPP; } @@ -890,8 +892,7 @@ static void mlxsw_sp_fid_rfid_vni_clear(struct mlxsw_sp_fid *fid) WARN_ON_ONCE(1); } -static int mlxsw_sp_fid_rfid_nve_flood_index_set(struct mlxsw_sp_fid *fid, - u32 nve_flood_index) +static int mlxsw_sp_fid_rfid_nve_flood_index_set(struct mlxsw_sp_fid *fid) { return -EOPNOTSUPP; } @@ -959,7 +960,7 @@ static bool mlxsw_sp_fid_dummy_compare(const struct mlxsw_sp_fid *fid, return true; } -static int mlxsw_sp_fid_dummy_vni_set(struct mlxsw_sp_fid *fid, __be32 vni) +static int mlxsw_sp_fid_dummy_vni_set(struct mlxsw_sp_fid *fid) { return -EOPNOTSUPP; } @@ -969,8 +970,7 @@ static void mlxsw_sp_fid_dummy_vni_clear(struct mlxsw_sp_fid *fid) WARN_ON_ONCE(1); } -static int mlxsw_sp_fid_dummy_nve_flood_index_set(struct mlxsw_sp_fid *fid, - u32 nve_flood_index) +static int mlxsw_sp_fid_dummy_nve_flood_index_set(struct mlxsw_sp_fid *fid) { return -EOPNOTSUPP; } From patchwork Thu Jun 23 07:17:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891858 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 5156CC43334 for ; Thu, 23 Jun 2022 07:19:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbiFWHTo (ORCPT ); Thu, 23 Jun 2022 03:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbiFWHTh (ORCPT ); Thu, 23 Jun 2022 03:19:37 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7112B45AFB for ; Thu, 23 Jun 2022 00:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iWIai2yiT4hd3iN2FiTe6UXQa7s7mWvq9uOlOfSW/mMOD/2Ua53Q1g1cWv4wl65+R1szvB0aZIZER8X642ClJN6zWlhP3ZbCKb3gdmsKFyMxFPIOQM+Cv1mMRKTG7r3oHepTesM3aKDtuyfXyF6MQI55QURuQupPjHK2X0aeg6p7B+Wwx/Z57vtRd6AuFF4eTbxUPytHDbr2kAJvRqIxxhU9fL/wtZ4j7kGlvKqPBHf+WK2oIGa701+cYyVGjh7cArf/y9J1L+oMSjwgbB3uw04Mcw0ToVKsCedSuAYX7fbd5ASICsAgj38+BE2OJwIo8LaFWTTrvA03Se4uQpB5Dg== 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=A+lo3ddwuz2SBOeSNC+uhuXxA4I22wLK3CgphV/NCRo=; b=EDXQXI6VEA4r2MRNmG9+sEu88X0R+rOnpBMwhSAXcKkf4qYGYlLMmkJejIYC6uwfePrJOREqpnAxQ2h1APmJbOhux534FcPPhBoJlxkanPlJj9O0J3OVPsWDS7Djl01oNtLlhL0pYUiOXQs/UINoxR/h1A+x8hNJ58ok6tGnJrvPRKobHtiIGusKt4VdVpYczCLLLnhAH4YVxBXCTvV2I6mhyPfYx8k0kMwufEt3TMPl5hg2now8t0j7jp4tuX+YuAmfWfyMy7RuA/8z54eS3HfNevASc8/vZDUWAS4oPNjl73LzjHB+ChyQ6e3/fPx5s/LvWXp47bJrYi5fmZBXDQ== 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=A+lo3ddwuz2SBOeSNC+uhuXxA4I22wLK3CgphV/NCRo=; b=M5W3RsTF/l9IdVtVjLnwUf3CPeQiuvnE9msIaafZJExjKcda5YITvVyXmqazZWxoqzvMaHUWIXleLc+D31E2BqfYxVMqaSlM7+EJ+t0zVcLjcFjEcrCuz5bXqk9p0WmcmIl00wWTgOQB4/F+a+3ndAi+nba2GhUycCf6NmEHWbL1HXRzL/pfPRV8gRontFqCCVuVvCLC/j37NmG57Rb/VOtR0JIi4KE0iWLSQ8iGsHuue6NP/GR+vh82jvtGn8DVQ8pzDgFLzCdNTpum0QbMkC4fJERiCOVBoXElR7K+oLuznQTCHpCmV/DUlrKyhI3Uhgu1Y5qUToAwI63FF4xmCg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by DM5PR12MB2518.namprd12.prod.outlook.com (2603:10b6:4:b0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Thu, 23 Jun 2022 07:19:33 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:33 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 3/8] mlxsw: spectrum_fid: Rename mlxsw_sp_fid_vni_op() Date: Thu, 23 Jun 2022 10:17:32 +0300 Message-Id: <20220623071737.318238-4-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 410be806-b8ce-41e3-c8fd-08da54e8b8c0 X-MS-TrafficTypeDiagnostic: DM5PR12MB2518:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NqC8wn1OBrBUc2NC8UMB4nXvfXCHxnw+NHbGYvsLY/5p5o0Js8dRzT7sldV5iEVDOpxScIYaK5E3s4EHTZVPXA7qcKGM+2e3rFmgcP0ol6FnYsGfOPADPf25eM/LfAvXtMKVAzNe1FCkqbLoyTLzjyk95qS3mOiOzwrM9amub02qLkzF+pu/tMnRJPykSi/1qIIG1vUkZB2ITvx5gofeyeol8q8J914+n0OoRpLDN9V+O5Q/UPCObhYdZNuf7R6zf6ltHPAmMxQJ+4jDnHTJWz0HzCjj0QndxgB7XSr8dsuvWZbgbylRO8RNu+n81cJ6emBYFkgAZ8RODHJNd5F6+NuN4NDLwX1KKSkCWwB8uHSmZymMlbg1sRmZHhC4hDSow8vKR+iUZgPtXMKy3QF3jwPcwCzl2k4cviRFOLEQZNRonO7DAMcnNcI3yhQxsFStuNvfKmdARrFFWt7G9oQ7q/yEfJDp5B/W/+iHHxlKA+sk+mprHKRrMRV1J0VG4HQY/Uj277Q2UyzQsz37+BR9QYEoQxaKYABK02mkj3JlHUEL8OjeER0elWqh6k4zaUPIvPFlDeO3MzbiRWQV6BptvIK1YTk1I7d/tIqohRrmxTwLfESn0boV9o92zVVhPf5dq1cbYLZTbnttvjNhoaLkLew4wX+JoS7dCW+qzVrhOVfyIsXUS6Qb8KVob9WXRsmH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(4326008)(8936002)(66476007)(8676002)(86362001)(1076003)(6506007)(66556008)(6512007)(66946007)(107886003)(186003)(6916009)(83380400001)(2616005)(5660300002)(36756003)(41300700001)(38100700002)(26005)(316002)(6486002)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kaSUkGGxydeYA2Nbc+ShhXnIDJTC/r6p7gvm5z0n2DhGZ+5KAOF1eeh6LoVLtpsqak3nKKCJHbmGDazqeNmTs+4IDdmI4uclq2Qbh4nu86jVZIZYeFf7yneA2CB23creHuhQLO2iaBzPu4D62Iw5w3KXaSnRGsSIdLxBPb18KB1nCQdKgNBUfjyqtbegbN3qTYbl+c+QuOiolhC7X3ngJKFtQFkCJkcWNtL4lzvgpKdPnlNjrerxkiQZDZXAHbZ60KIJ2IiL5UcsO53h43pR+nrxOhFkR0aGKzaS2GUxjo+4Cw7XgfQagZDJqpRtUcZl1chMVJ7mj0gWMSVx1JlUkrogO04Li+2678wpPg40e1k2QDZUoOcz4HuYb2k6RQVTkyCYmtkBMkMtelSlhAVaCIsd3pvGhqjA3UG8vM3bAK2HajFk2lnAGdqrO7aiLGT39pPeYO7uYrWYHx/F9wjPN14fIF2IGREAlWndgXJ3H2i1iYbvG9px3WT5dFUFoY37+tG067mWYEdnZImpLRNrSAofepxttAbUVuQcUYD4STPJyU5ypMApwxrsU6HMBM44qjZ0gOozxlDASFodtUzt1tt2nU79JGYMNB5JVo4r8UhnXVOkBvb8P23QtE8YcfC5VOBRByQH7E08aPYenfMeDQ6RY+yLQhLkpcSWrYCRZ8fIO1ks9p71i0CuMa0fy6u1GOvAZkOqpUxNqpGLBP/khXEauHhVLOLYgInpcfCCI5bRTvvFkbBOuwjyf3kMaXEWEYBEBGTzGhjFXwa/UeZ2/gJMWnIGlVIWXSgQ7S1xizD3QZ/h4MMYrwFRdBy+1mOTapeYxajzC5xrAjOd8/lzyO/9OjeWg3DeINjbB/xPtI8PSxZ4CELdjlXZ6DsR/g52/Kw6uxNSxDcu0Hq679HFv5T82sJTHI6i/a1kVZrvxKaincOKxsVIQnAXEF2AWMPlfVPP8GPBuzBXl1OtF8FpyDQ55xR/kix9UUlJrSf5SkLqTqkDCCh8T04XP7IvJkMV1eNaqpyI5r/aAlRaTKtlxb6EYsegiqjbztvfxsrHxvYgb6Ho36BmK2PLHNxcaPNkeBTiiwZ7aT33XVdod2UbqKb+ujb3Yywl7zDJwYoEQWWBY3a8Hpf1Ot73n31qksVCjpInfj8YJX1uogJ0zneQT5uZzYflPyHR3KMzsLrydFIw8J1U/0y9yTevBhXxjZikGTzvynP9qb/tLJAcq3DhY2tzAv9qYU3hJw//uZodmqmTL31mAIol5AvW6qXorB+Q58z1SDem06hFKbPRgAw9MV2KL/RNEYGEsnW7nJFot7H9NBA4u8mQoZ1e0Szk+DPepOzHRGQmR5GLW3idaiYCz1AW6GeFt5MgpuBfhqtEcx0oX044SNU8QM32tNbeLOcwgcAqsvGTkw81fMGg9xyZnjbeJN32DbRJiCNCAxCYqVM2siWK48WqibqGB7If2yMWAIA3SJp+afv1lHvrZpS7Adxb3/G0wak6ZObhKM9rIlb/saPAq7WT0UQmML56Uf5dwquvaJpopKjieCmD+xq70a/LllMTw76lWhg0/WACssDUu7PEKikxvSXEJT1gfQw4id6Z6u4uSOrz5Kf14xPTwJmXb/xz2SHFRp8nXZJKbln3YaRVksWV5CF1dBQLMJMs5ATun+TtwEA1XmKUuozJ7+8IyXlbbi/XHOvCqXiTYbQhfAzTOBgpruWGHVfAYaak/clDaTWT5hY7vy8GkbAAyg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 410be806-b8ce-41e3-c8fd-08da54e8b8c0 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:33.6071 (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: HLaMjwbWb7sSpB64Hl74g43tUYWipD+ft+SbVembH2rROTIMI1n0a3mXB3hzgw27bNJAkqc7d8YYq3ECgzHvHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2518 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen After the previous patch, all the callers of the function pass arguments extracted from the FID structure itself. Reduce the arguments list by simply passing the FID structure itself. This makes the function more generic as it can be easily extended to edit any FID attributes. Rename it to mlxsw_sp_fid_edit_op() to reflect that. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum_fid.c | 43 ++++++------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index ac39be25d57f..f642c25a0219 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -428,18 +428,17 @@ static int mlxsw_sp_fid_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index, return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); } -static int mlxsw_sp_fid_vni_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index, - u16 fid_offset, __be32 vni, bool vni_valid, - u32 nve_flood_index, bool nve_flood_index_valid) +static int mlxsw_sp_fid_edit_op(const struct mlxsw_sp_fid *fid) { + struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; char sfmr_pl[MLXSW_REG_SFMR_LEN]; - mlxsw_reg_sfmr_pack(sfmr_pl, MLXSW_REG_SFMR_OP_CREATE_FID, fid_index, - fid_offset); - mlxsw_reg_sfmr_vv_set(sfmr_pl, vni_valid); - mlxsw_reg_sfmr_vni_set(sfmr_pl, be32_to_cpu(vni)); - mlxsw_reg_sfmr_vtfp_set(sfmr_pl, nve_flood_index_valid); - mlxsw_reg_sfmr_nve_tunnel_flood_ptr_set(sfmr_pl, nve_flood_index); + mlxsw_reg_sfmr_pack(sfmr_pl, MLXSW_REG_SFMR_OP_CREATE_FID, + fid->fid_index, fid->fid_offset); + mlxsw_reg_sfmr_vv_set(sfmr_pl, fid->vni_valid); + mlxsw_reg_sfmr_vni_set(sfmr_pl, be32_to_cpu(fid->vni)); + mlxsw_reg_sfmr_vtfp_set(sfmr_pl, fid->nve_flood_index_valid); + mlxsw_reg_sfmr_nve_tunnel_flood_ptr_set(sfmr_pl, fid->nve_flood_index); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); } @@ -666,40 +665,22 @@ mlxsw_sp_fid_8021d_port_vid_unmap(struct mlxsw_sp_fid *fid, static int mlxsw_sp_fid_8021d_vni_set(struct mlxsw_sp_fid *fid) { - struct mlxsw_sp_fid_family *fid_family = fid->fid_family; - - return mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, fid->vni, fid->vni_valid, - fid->nve_flood_index, - fid->nve_flood_index_valid); + return mlxsw_sp_fid_edit_op(fid); } static void mlxsw_sp_fid_8021d_vni_clear(struct mlxsw_sp_fid *fid) { - struct mlxsw_sp_fid_family *fid_family = fid->fid_family; - - mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, 0, fid->vni_valid, - fid->nve_flood_index, fid->nve_flood_index_valid); + mlxsw_sp_fid_edit_op(fid); } static int mlxsw_sp_fid_8021d_nve_flood_index_set(struct mlxsw_sp_fid *fid) { - struct mlxsw_sp_fid_family *fid_family = fid->fid_family; - - return mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, fid->vni, fid->vni_valid, - fid->nve_flood_index, - fid->nve_flood_index_valid); + return mlxsw_sp_fid_edit_op(fid); } static void mlxsw_sp_fid_8021d_nve_flood_index_clear(struct mlxsw_sp_fid *fid) { - struct mlxsw_sp_fid_family *fid_family = fid->fid_family; - - mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, fid->vni, fid->vni_valid, 0, - fid->nve_flood_index_valid); + mlxsw_sp_fid_edit_op(fid); } static void From patchwork Thu Jun 23 07:17:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891859 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 76839C433EF for ; Thu, 23 Jun 2022 07:19:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbiFWHTp (ORCPT ); Thu, 23 Jun 2022 03:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbiFWHTn (ORCPT ); Thu, 23 Jun 2022 03:19:43 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2062.outbound.protection.outlook.com [40.107.243.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8A045AFE for ; Thu, 23 Jun 2022 00:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k+jSvu1xnmSGt3uso4vSd617wNhWNPii/pV8sbIspksiVxdLvq3RgJUBfSmzUJAXnzjgCis99Tyt5BTgWLTzttjV+Z+iptORVQ67Ky80vSsaUUwHYmjE7QHEjUPoDyVr6Nyw/TOmot4dbSfPAYcjlMrb4532M2IkK6Phg2GZd3Mh9h1sLRRdyrJkR85/y4Dgr5pt4jed//9U1f+nbBijpkfnXbmsTONItLrp2FIRDeqdeKbz1z/N6ijJ9qZYCoz+slipq3gpYcasjhDaIT61PpoEnN/U7Hy55YUAUticZoqSoAtFprKWSm8ZP+rtLY3iC9oQFGp5w0WLm0erPPxwRg== 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=Va5xqvSvJ8n5xyEYr2XZHYADbAkrDs5iW97FAUoxwCs=; b=h7vpxu5NJvn4Tt4XUWp0Q3zMc8muH6kjWxIKp21vOfuI1oRsw38wXQxobTTOIrcjBpuIfGh0z+S77715+iU1y/w5RL5zbet23vgcQDpf5Cwk//5Hr6lrxtiSkZZMdwr/p5CZhc3aRJo4562MXzuosvyBQQsndEYDfJQG7OXYiSIiAYKcizcba0X68gcPBO48hpsMixfARts/WEwQlSSNEooXO8ifk74FsGSPDBf8jdlmoRXAST5MLoMNls3ZK15tJu29AwbRkMA2/pEotUuq7S0kYNEdvn+rJGhAcCD45Ch20lwDeqoYm/Ncb/97/US7MdUDZEYkF/yy/ReWnKZq1g== 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=Va5xqvSvJ8n5xyEYr2XZHYADbAkrDs5iW97FAUoxwCs=; b=WGSoUtOd3lwhG0ZJVPGzZMZzIwKDXVTRd81TAgnnKsRcLM8Brz/t2JGfLwnRxVNoNdeGlfi56ZSRSsJXtvmtx+izIDI2yADBcuJNw+igo7UbuAr39mK2/IydIs4SCeshCCvffwIUkUdVioUgxDRhYn1EWzsbzPism6D13wHQu/7r5hrRu4pChncRxqub7WwlFIRY2iKWyEil9RCBHc3xsCGuhmnk+AHNjeaaPgb6nvAi2KpnTbKzZYIg1CzHwgBkr0RRsqCIJ20AUWNVOugkshbJ9Quhc8rST0Sf10VIVpbZItNMbOL8gsqKvOnE907eqxIfN0mnwvFgOSEwlC91Tw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by DM5PR12MB2518.namprd12.prod.outlook.com (2603:10b6:4:b0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Thu, 23 Jun 2022 07:19:39 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:39 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 4/8] mlxsw: spectrum_fid: Pass FID structure to mlxsw_sp_fid_op() Date: Thu, 23 Jun 2022 10:17:33 +0300 Message-Id: <20220623071737.318238-5-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR02CA0076.eurprd02.prod.outlook.com (2603:10a6:802:14::47) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5307342-5dac-4168-2194-08da54e8bbfc X-MS-TrafficTypeDiagnostic: DM5PR12MB2518:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: il3GOKt67NF0FQwGZj84EyBcATTLdFIZy1JRGhFuj+qUcwkouD6a8ic9pzrVdFkcIAQk3de+SFpko0Mtdys+dbE6di/g6YhwmeGzUEKjeGu87NO5jTBPiM+xRNP5BTCjQf2ajpzzbQAozJGnlUDgK/orktyJQA60Fjif3AcYcNdud7RxIZ6YKkPwrwvy2vrPPDkyKBPWFePxTm2PVyEyO+7xH+CUtHhY2SgtgpiXJrH4JSBTaEC+xtpCbrj6JtRmKgZ3AonyF8++yccTq5Yekg4xBJE1I8rpeAAosBwG+IPLaeIRTj2j9FkhS9lXCfEV6mqOM61K1lrJfBHCtMwsQGs6158fMf0FTkMZNysGm5ifuXmGkQDKK6QkWVzJrTXCSe8PjV9AjCm9mxvZEeUtN8RFGVcqXwQSvsFFMiSEhxKAGmpoRDYc++BsSkmpmsntwkn2MrlaoD48DB3C8v9GtTueAiD5UM80naiKQCy5pWZqZEynO9CF027rlLP1x6J1bM+nqiFBL/XxmmmEh1qE81nlu/OdkH2rtIS+enA5Ap7BcIyMi/fVnSTAmPX1FIK4JH3bg/p13Tyvuznpr0knxwFO3Fd3ygqaIJ6StncXH2Yknq/zh9LuyIV3/FOir+1CNE6l0vB788Oq6zLb3ZFa0aGlQAi5k29UrDLJeHJFyHmgnHbLXdMzHJL9sOmL4LYP/MGNr/2cZv7dzHaecaAQAA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(4326008)(8936002)(66476007)(8676002)(86362001)(1076003)(6666004)(6506007)(66556008)(6512007)(66946007)(107886003)(186003)(6916009)(83380400001)(2616005)(5660300002)(36756003)(41300700001)(38100700002)(26005)(316002)(6486002)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: obEd16pZ+nKh5cPcD/INW8501fcUey+HM0xLDxzGiWvTlz3M/akyK6vg/ozmTFnNIm9DitR/lG4uaAsjA17YfFhOpImh+kUm72F7eP5qEhD5z00awvSC7Kc9oYSsJE3HfYEiYRxPC8wRN0VQFnFimHAMeSAf1lNxUzaYHe2FjqwAQYDyXCNJFlQMAn2nfq2WCPEih/WcWhlA8FpFk18Ov/6AA0PPyQyObbOyRVHrmxWbSiH/3Ytk0Basn8SC4sJHZc5TJJl36Jp/QU5t6ituKdrCctf9nMvdCbKZ9ltWduVS8+tVJriAj03Ks1NLX1yteq2WF5VT9Oc5NJRjEe6mwtC6KTJj31fVR7ijVzF82x8/AIINuSnBWupt/p0M9H3zXIBp+xOKR6jnbnC2WUoLKX1f9XdEeOSV5rAI9Diq2FGwICTgxw6VHU888KvKe91+QdUd6ACbjVMpehu7TVNZHpj6PyAQvgdOTPGCt4F5QGiC2j/biiJOIurMCzOO1T/vz/WKhxBg97oukrR/EDkB8zffVvJAA7q0DWsRXOmN/ifHJzQpj5RyIvQEVB4KY4mibtCGXfGVTE1dkqZ0V2/KIQbqjstVotSo5aHWSqHb0HwlNmEpXqLzt2xXiNyYPExAGUqj0h6M9u2sAy/rfPeC3C0/VUK7c9ukGry9aq4YsTZgNQ9Dyv0v98d2BBLHcz6T7WSpn9I2P6a3cV8c9VWxjk1ql+1WH5QDddy8SNNrweA0VLsEhQ9NLX0PZ1ypqPgZkXLhNj1Hb8HlmhU0V6Z3fTErIuyoVKO4BDGB3f66qQ8APtbFbvFbD89wj/CY/R+ZCK4LUA3rQVLCNP8NnieW9ci7X/eAj3R+pgyj4bXEiCS7TwOLbQeE6Bdomfi2cmYqOz3u8VqhUJ18HSnOnz5nJuN7FeE6heuihamS1oewyBUR4Fi3heZbFE0In92R6dia8YwvJ0r0GLki0a2m4NYDj3QffJfEb8WOeFLpTZbPF9HAcYfxSaTlOHpNsjIKa2sRoXlM0TfLP7BA1cIjXBGr9S7VmZ+tis/aVvHPDg8uDi4gVc/TIWTQL2FAuwLc9iCOzvYnhDeirkPomHXuY/DOkpY55Uo762rjE5o298THmHjdsppgoiuAU3zZI5mXeLJPsedTONY7NlabliDiSoVEWANMWvOvKvJA8SZMr2ND62wWUmWuyirrMxfuBE3y/4SogoXX18QMd9vqBTsnwvkg0coOOvXvU3K7UF+W9AJZRCRAsIvpvYwUsSLq+B/mGADFEOcke2XWhHBQGp18Gt6Wu9L8zUNA028wQJDPVJcjK1Ud30/RuX7TaULW6/+50fqyhr9wVKD9u0jRnvxfEPDU2i+zSnkQmEFkHcby91GK3FNUHVD67vH35T0TtKZyDZFKbCuD6kA6EISPPaHQtpwZx0YKPcIjNwT9Lu4en97ODMHtjCURCXEKEwPLWCJK7IZ6MeDhUqKMGxMfb+jMYHedNOj2MDhfs+K2yj0K70MgpsbhfEdD/qogwoKKEsYkw1h2UPbDQ/eFrYtjOONTOBxWfBos6aDzMpvKh8qVpoJBm1wyZV5et/yugm2pwXNejUth11RGdiXJa1R/aWclxtHrvRtnDvzL6NQsx5ilhsqOCI73bnvh5MUN/ZoOEJgVDZLMusorIEC9Dn4IjAvT76xa6M2vSBlYEoFduCacvGtgtsc49Zkx1hX1bRHbewauAhS6o6Fsdg0pPwUrI2o+V3cQJA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5307342-5dac-4168-2194-08da54e8bbfc X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:39.1398 (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: CdylzB77ddJe2xhEOydlALFBjI/CKjkjy3jPzHdBFUkwp1xpUC7msRbSg0cMPe6VYrJMRGt8TTqsIfqnLbgQxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2518 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen The function gets several arguments derived from the FID structure itself. In the future, it will need to be extended to configure additional FID attributes. Prepare for that change and reduce the arguments list by passing the FID structure itself. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum_fid.c | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index f642c25a0219..e356b4d2193d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -418,13 +418,13 @@ static enum mlxsw_reg_sfmr_op mlxsw_sp_sfmr_op(bool valid) MLXSW_REG_SFMR_OP_DESTROY_FID; } -static int mlxsw_sp_fid_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index, - u16 fid_offset, bool valid) +static int mlxsw_sp_fid_op(const struct mlxsw_sp_fid *fid, bool valid) { + struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; char sfmr_pl[MLXSW_REG_SFMR_LEN]; - mlxsw_reg_sfmr_pack(sfmr_pl, mlxsw_sp_sfmr_op(valid), fid_index, - fid_offset); + mlxsw_reg_sfmr_pack(sfmr_pl, mlxsw_sp_sfmr_op(valid), fid->fid_index, + fid->fid_offset); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); } @@ -468,18 +468,14 @@ static void mlxsw_sp_fid_8021d_setup(struct mlxsw_sp_fid *fid, const void *arg) static int mlxsw_sp_fid_8021d_configure(struct mlxsw_sp_fid *fid) { - struct mlxsw_sp_fid_family *fid_family = fid->fid_family; - - return mlxsw_sp_fid_op(fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, true); + return mlxsw_sp_fid_op(fid, true); } static void mlxsw_sp_fid_8021d_deconfigure(struct mlxsw_sp_fid *fid) { if (fid->vni_valid) mlxsw_sp_nve_fid_disable(fid->fid_family->mlxsw_sp, fid); - mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, false); + mlxsw_sp_fid_op(fid, false); } static int mlxsw_sp_fid_8021d_index_alloc(struct mlxsw_sp_fid *fid, @@ -916,15 +912,12 @@ static void mlxsw_sp_fid_dummy_setup(struct mlxsw_sp_fid *fid, const void *arg) static int mlxsw_sp_fid_dummy_configure(struct mlxsw_sp_fid *fid) { - struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; - - return mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, fid->fid_offset, true); + return mlxsw_sp_fid_op(fid, true); } static void mlxsw_sp_fid_dummy_deconfigure(struct mlxsw_sp_fid *fid) { - mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index, - fid->fid_offset, false); + mlxsw_sp_fid_op(fid, false); } static int mlxsw_sp_fid_dummy_index_alloc(struct mlxsw_sp_fid *fid, From patchwork Thu Jun 23 07:17:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891860 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 78266C433EF for ; Thu, 23 Jun 2022 07:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230190AbiFWHTz (ORCPT ); Thu, 23 Jun 2022 03:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbiFWHTw (ORCPT ); Thu, 23 Jun 2022 03:19:52 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 723E646158 for ; Thu, 23 Jun 2022 00:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMAgW0TGUwddRvwi5QA2CKQr8vEehRL4Phxbk0dVfraIOtpHpiPTZPn3oZUUv9u16XBFek3gn9pJYuo2H6Qa9pPogSSH5FRC8AgS6k15I2dwuQx5wv7/KtGhr+le0GuQv2fLvilHFeX3jNnp+x3Q9c0Jy0zcOBPR+kAIEoIJWgDJavvAHliHB3Qs5ApuN/eb6OLQxn4szYDm83LnGlxikDoHmV4IN3q1wJfcEcUaZPqwZDa38lQgh7cFRHT1lcQYHRVPa1vYHvxe32XbXjzF53P9N5VtBhFlpg5/UVgzFK06f09FzxXrkQg78Gdu3tRopfpfi1TKfmzWmOYqrUB8Fw== 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=BS8XyxZGH4zDg+3gc5hC4F1P8qUZx0F69y1ADOxd5xc=; b=PN+43HSgdiZtoN5N6U0bgBPUwQnAVvrvwQgTwY8PAaork4rE4MFOFKvAY+cR/650FsX+ZBW+hBGkXnvQJWSgcFlMiRn5cSCHBMQyCGvIZyOrdhMzzMYRoYKV39AwipsktJOFUbnuQ6bxDJ6XEDjrkiVAXHA/PBbKWETjiRyFDb5Jkbnyi1sQ+lIUz8gEepqLCenUwShoHBhwJLi1I57xJ6JYF4lslGXHh5ds1cUcLfDVeXfkNollTSEHVDmxJp5u/mBybqfItTwejIw+8C2OXEW2Q/EcTvUPAXGB0nd4EhB0z5XDgI8hfEKxbrkZxN+nfGwwYhRbRcg+Eoyt6mpkIA== 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=BS8XyxZGH4zDg+3gc5hC4F1P8qUZx0F69y1ADOxd5xc=; b=aLwzgy2mviyKNU+D7NX1BAJym5NIDTuCYCBeI3e9x6TaDT5Iv1TXeX/KLObLpOvYXCDdTH+fo+3lgWIQLvtGlSPeQC1RI6Shr+Kpd0+vcSv5L4dxdBx6qJf5PW6+liW2wHzqvjudzOglWEf9NGYdTh6tEaH1z74h6uRcP6bSoLrfSjFmb8qsUoGDdYVXWdFdv4KfpyhwonK1MAqzHw/eAU2IjUSCjqVfNqIYo9diO3GvQca8wtn8Yf6VsKAC6L1B5/DkBNX05ylyho2Xk1rFqmI2Gzd9sFvHSsbIoDO81oFBUCVd9KKbyYcTiYKLQtDcB7HrKq302ZotaQFXaRzP7Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by DM5PR12MB2518.namprd12.prod.outlook.com (2603:10b6:4:b0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Thu, 23 Jun 2022 07:19:45 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:45 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 5/8] mlxsw: spectrum_fid: Pass FID structure to __mlxsw_sp_fid_port_vid_map() Date: Thu, 23 Jun 2022 10:17:34 +0300 Message-Id: <20220623071737.318238-6-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR04CA0084.eurprd04.prod.outlook.com (2603:10a6:803:64::19) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0510eb36-5ba0-40df-c7e6-08da54e8bf81 X-MS-TrafficTypeDiagnostic: DM5PR12MB2518:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: moXruhJA2xewodlppZ9JoXJcJNIzOml6tT9+9dQ4sCr6/fP5t0vxX942QroowfHICA7heLeYK8F6sGAwX4ugBQU1yDVwO+ZoSZA42+jTBm6llbr98IZugksi4P1iXs/N2m1twt+DQNSMgqQkVX13oe1dGOlp9N3bWsiHGtvbpjEuzmlV89sckpx1hlLJk1y6WZin1KfYqZmjbvBeaXyP4f1JCF8MbN+hlYMjhQwjMWyAtKOA+AnMbZM1BAhTdlQqQcYgfM+04mMjGMR+ikraHxmOtDeeo13bMvKBomuicq/xsjjEpDgZQq/MFP10oNJnjG4Z27wVjsSivXHKkM3TV5+2ohJ2ZHketCpbXLrVMhR2ljYz0ETwIC1LbJSB/e0aVAloGUTPmz0cHDkyDJ7G7sjerXvoBMdA/Y2hLkBgNxjXlmts+S9x7CWdKStw9yWHzMAK9NTWy/6Zj4EGauPZ9x60zahRSVacuAIpMlSLZbg+fSKEgTkkCJVsyHobwI6iRt5KGXnyf31gNqWr+N2ijh03CDmiCgjwOQ+hMy/sXF+jL/e3n7C7uhGepMiR9jA7gI7dUszhviq1/EnhpSvVFQNKE9DUSi/7AJDHPyE6c4s6qbZtG46b/SpzJztVGj+QMfdcMVeZrIh9ZMsDyPfGfcauCM5ZZ2FUYe9STUkN1q4sLtTRgArFcDOoqD4mWwGqrInr0MVKwJEkhiClxLlyng== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(4326008)(8936002)(66476007)(8676002)(86362001)(1076003)(6666004)(6506007)(66556008)(6512007)(66946007)(107886003)(186003)(6916009)(83380400001)(2616005)(5660300002)(36756003)(41300700001)(38100700002)(26005)(316002)(6486002)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 26Vb8ZxZX9aiHfcT6l7nEOPTQJjnj6SI4H5xC+lykMlElym6z2bhn3DOERI3z2z2+RX400qJ1/sdkVHBrFLXYYrtlKKfW3yV6Qor2YKvoR2IbSXznveEkwF0nwkpUMqo4fL5O1LtvA7/Dyq7+vmllmqEwI4RAGiyjbDsYTtXZ+c8jfvgP6aohWpe5Om3xOpBalbZ6SEV96sCRC03cstSiTzOjzEWNi0QKG+08PaGi1HRgf2pi6eM/nKXkeu+Lth4F2RlDlVXf4n8SWwmZfrgE3j58xjUVSlmshqPvjajZ91AHvx+3Emeoeq9Rhn2uhrmDOGqmaTYUKhPKl9yb+LAeNNXsmM+2KTfmJaxj7lcB/krhVA6SqwSzZyXDndX5dXkRBQvjb/n1HZS94C/L8gw4MfZxeJmQlhCaXamu2Tx0Nfe7yFq44SKec7DnlfDfFdBfgqDkJffW/LOOBIT7cMC/K7HRdcRjI+ZXeYw+1kv5VMxul2JPNj8aKks2x/To4bEA4T3qS9bUKQaO616M4fpyyx0FR8pW/gz/cAxSxZS/QvNnR+H1Alp7D7ZNpUg+NzavCpP7IJ6QkT+vL69v1ww6iTmWka9G5h4Ui4XHrttOO+89+ogF6R8lh1ySFh87EVYpKVAztLr2Tgx2VsDrhXacNsYYwtnY5zGU6KHvYxcZJ9lCQfJTARBp/u4d0Ig4rZzvTqRRtVL9ZPO4KUkgYfvTyuPv3f7ByKqB3qXHml4RZpp4LBIexlhU7ZN6772FbZyT2iSHLXhHe0OnAVbinU+pfURLw+13wGeU6WniHm1utGAoxAyaQC5V6gBJkdfbWrmGRxXBuHj5lOS/An4vjs0P21YVStgrDioAr8fPJqS7S+CKhQY0qstspyApXOLndHhPzDpK28tErIxeNtplcCPwznE98W/Cf2VSwTtBZdPwKSznizl7IKIQmtvUVKB21dQCUtT774LcCDejXK0HJK/9mrpEXrBLLiuOza20yzAG9NvNS5YCvzc3Jg0/KNeeIbwAr2LIkrNaywJBWop71bdscha7GXPSaihvOddw9x9a/AWR6Q9Tu23FxdwJ8hpF3Gx9zgS6QQNPts7oiLJkJezSkTsfyb1hOnkG806Sw7qnach1pn8AvoBq9a8CL7FaRd5dO2CUfmWE0SHC2L4TB7IIYwFRv4HCZ8616u6ZzBBT3K/l1QMgMRmsZAuVRrzV0G5JpOmJPKTjkMZtPem/RlTAhUijrMb5Pt1O+fEWzj0K3lHVxgxOSqILJs9oePTzF0+GCYLDXb4a9t87atgQkejWAVjDuFIMXMrfPuWvz5uTNWoEcEWblt++dm6sczkcuGA6/L3ailEUYv7H6vknEPGZ6jHqthgfqmFYSviZPgWJvt/jBYaSDsbteHM0JgsmdQztEAbC1V0kG99UTvm7Z3DCieiF5owcQz/FUl0XhPh/aEZ7fqjAfRWgHRWgbFFu8lyvAaGwZFHPTuUcGX3gNaDgWIBqJRUQ/ESYPm+BqovTmLnIwq9m/xHEFYg9EXp1GggL58lrRacMO4plpl0xBrdDJ16U0zBBXBLDz/E1tR7o/NCufsHvrE2Zp5Wk4jTLxXPgoWUCrR4q7sNMUc436iVSSudLtdaUMKUNs2Ds5IH8BHoP3TmcdN3L2/VrHg5Calm99wJwXfPNTFZtZMxFaIW1RTar2yim9uyundl9GJsEZDjuD6ooIWkB6ZNpdUOv9m81Y+ka7zBXc18joZvjklKYw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0510eb36-5ba0-40df-c7e6-08da54e8bf81 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:45.0331 (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: 3Sekff5FlrSqeiP4MT/oGuDmnpyjHgJmXPGvACjfCAqbvfbK4oJ4B3J1ADJ4bBaZ1+tzz3ysFvC8E16/TvFuoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2518 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen The function configures {Port, VID}->FID classification entries using the SVFA register. In the unified bridge model such entries will need to be programmed with an ingress RIF parameter, which is a FID attribute. As a preparation for this change, pass the FID structure itself to the function. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum_fid.c | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index e356b4d2193d..27bd55efa94c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -442,12 +442,13 @@ static int mlxsw_sp_fid_edit_op(const struct mlxsw_sp_fid *fid) return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); } -static int __mlxsw_sp_fid_port_vid_map(struct mlxsw_sp *mlxsw_sp, u16 fid_index, +static int __mlxsw_sp_fid_port_vid_map(const struct mlxsw_sp_fid *fid, u16 local_port, u16 vid, bool valid) { + struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; char svfa_pl[MLXSW_REG_SVFA_LEN]; - mlxsw_reg_svfa_port_vid_pack(svfa_pl, local_port, valid, fid_index, + mlxsw_reg_svfa_port_vid_pack(svfa_pl, local_port, valid, fid->fid_index, vid); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svfa), svfa_pl); } @@ -508,7 +509,6 @@ static u16 mlxsw_sp_fid_8021d_flood_index(const struct mlxsw_sp_fid *fid) static int mlxsw_sp_port_vp_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) { - struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; int err; @@ -520,7 +520,7 @@ static int mlxsw_sp_port_vp_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) if (!fid) continue; - err = __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, + err = __mlxsw_sp_fid_port_vid_map(fid, mlxsw_sp_port->local_port, vid, true); if (err) @@ -543,8 +543,7 @@ static int mlxsw_sp_port_vp_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) if (!fid) continue; - __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, - mlxsw_sp_port->local_port, vid, + __mlxsw_sp_fid_port_vid_map(fid, mlxsw_sp_port->local_port, vid, false); } return err; @@ -552,7 +551,6 @@ static int mlxsw_sp_port_vp_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) static void mlxsw_sp_port_vlan_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) { - struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, false); @@ -565,8 +563,7 @@ static void mlxsw_sp_port_vlan_mode_trans(struct mlxsw_sp_port *mlxsw_sp_port) if (!fid) continue; - __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, - mlxsw_sp_port->local_port, vid, + __mlxsw_sp_fid_port_vid_map(fid, mlxsw_sp_port->local_port, vid, false); } } @@ -617,8 +614,8 @@ static int mlxsw_sp_fid_8021d_port_vid_map(struct mlxsw_sp_fid *fid, u16 local_port = mlxsw_sp_port->local_port; int err; - err = __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, - mlxsw_sp_port->local_port, vid, true); + err = __mlxsw_sp_fid_port_vid_map(fid, mlxsw_sp_port->local_port, vid, + true); if (err) return err; @@ -639,8 +636,7 @@ static int mlxsw_sp_fid_8021d_port_vid_map(struct mlxsw_sp_fid *fid, mlxsw_sp->fid_core->port_fid_mappings[local_port]--; mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); err_port_vid_list_add: - __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, - mlxsw_sp_port->local_port, vid, false); + __mlxsw_sp_fid_port_vid_map(fid, mlxsw_sp_port->local_port, vid, false); return err; } @@ -655,8 +651,7 @@ mlxsw_sp_fid_8021d_port_vid_unmap(struct mlxsw_sp_fid *fid, mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port); mlxsw_sp->fid_core->port_fid_mappings[local_port]--; mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); - __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, - mlxsw_sp_port->local_port, vid, false); + __mlxsw_sp_fid_port_vid_map(fid, mlxsw_sp_port->local_port, vid, false); } static int mlxsw_sp_fid_8021d_vni_set(struct mlxsw_sp_fid *fid) From patchwork Thu Jun 23 07:17:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891861 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 880A3C43334 for ; Thu, 23 Jun 2022 07:20:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbiFWHUG (ORCPT ); Thu, 23 Jun 2022 03:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbiFWHT6 (ORCPT ); Thu, 23 Jun 2022 03:19:58 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2073.outbound.protection.outlook.com [40.107.96.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154A745AFD for ; Thu, 23 Jun 2022 00:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Utp7vVBXeDc1CV//IPete8jY4okSme2/zC3sp8hnTKtM694SwcBVqblS6CTI5CiNfmyjbzA8CYVl5laiDmc3TxixwvPMKwUxankKpG4OwS9yRPIX+TFtI83c7cpeCUSRBw3m1lzWYZEgrU3rmHXntlZrcZ2z8ZaW7o4hxHQy3PWJ0qeO+V8JilVyPCKL8Jqpb7RI+XU0813oMZgVLGlcYKYhgGGHRn8FaVqPJNMiTYCYpQMW/GC3jh7bAlPJSW9yHdwuXMgWehV6F9PSGWV8+AIcLn1sx/5N/FKlLuCW71UPsBabZfz0++kC1MXt5e+qF4CT511h22pHSqt1vPsCpg== 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=tozpYG+zfHiG72vgqSEVDvyzRVqxGY1HJux2jIvcqnw=; b=A+/+GFbXlEUbqYwd2zUgn0jRqJC/liD/pFYxsNb5AkKv5s6KSfGSEB8s5Dh229viovRi2cmLQhgAM2f0qa516Qfq7r+LAWn0chPFYbYqKgieu0V/44fgs+LmKByovpJgQyQ15N3lO9XqXt7UcWmQUleIXPyHoWvbK41ZiqWfKWSiPQ8c/hDMFM4qJyIpZuZ1GWGB8QHtI31LGJlT9IPmNfNThF5d6Y90VGrQ/T03pxNbtl9WYOoPl+otHO44zmiTt368dKhBNOBYhyRhJNhYjAm3GKULocq5PhkmQeTkfuD8qFUI90SfpIirOD6Jcr5OIxM4jNoO6Balz8R5eNY5+Q== 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=tozpYG+zfHiG72vgqSEVDvyzRVqxGY1HJux2jIvcqnw=; b=tGd8k38QVN3GO29Hc2dljIuxu8ulZ+w1Z5r7/ECfwLUPHofGSUTzEb+aJAlTSGDImVKNE7LzgBHwDPRAsGaYfj7xlYlTcj6M7iKXUcNNqSvLOdph0TPaGWBnEJkjiFiPYnnbt/YUNRQksuEQ5BKPLxr/AjGdd6qm0zJT3swHD5uA5dkz04SgavNy02q24ehP6+Wzhq3TU91LTAwFqW9RgZOJ85ecBVUd1klBuABrv7sioWduSAod19LozcfRwFmsrBw7ZsLuNVTMl2xY2X3x0aWA52pVmSth6hDk4G6awRsaqe3TLkDVJp9stzpETDFJMNPMq7hlG4AG/ulnfpF9pQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by SA0PR12MB4414.namprd12.prod.outlook.com (2603:10b6:806:9a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 07:19:51 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:51 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 6/8] mlxsw: spectrum: Use different arrays of FID families per-ASIC type Date: Thu, 23 Jun 2022 10:17:35 +0300 Message-Id: <20220623071737.318238-7-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0066.eurprd09.prod.outlook.com (2603:10a6:802:28::34) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44297622-4a46-4735-1b52-08da54e8c354 X-MS-TrafficTypeDiagnostic: SA0PR12MB4414:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f04aFkY8iJHx1ZA57A2FmXNAm7FoIpHweDRN9BGn3QNZfSTxerwDzaVPGN8d8wNg5BF7zGkXG05Ni5gH9xlVV3l1qzjqoyIoMOoWmkdNcSsuF/HvkQW85bqybdGzCJALstWIE6Win0h0XvFk0cRDoO89MrFK97kSnd8wb8YWgEo+DkNny2hZKaExR6EcFss7BtNHTRIXKgV/Ci/CV0Euo/HfJqVWIIth7Uy4ol2aQhJ6ZL4uQAqtSnPKwoesBnf4MMkZovso8sY3hK0WHsfZYDTKxzAjmRRNLJWpQ/HxmQ4x6dBDE0x2K5YghmfXGJJt0YtmafQ+/vkZVjp6T3dzWAkf0ThsTm34ORaef0r0xy7Bls65BkxHaANuUnqIBPOjE8sAR+HzX+c9HdW562uV0gqj45CfZ7cmrqzjHBl/O/zKkgcwWvfSHkQ07tBrjakRLN4HKXEDys9DM+ATzdKd4IjHA4/Norh/GnvlLPfoeDDn/EuvSmfm22BWn39kyc5xNEJmY5PSxgd/MyXuWWBPRE14MWmNgjPmYiD1p0iLuL7gUnlXylGyphGWGW2cFBOybLQZmX8gl6Fh/QDwdfLzgeUj0vrrbDFVptYzviavinj9/9o4YBwgsZXyBkcfODvkH5rvJqfgoed542OJFFr+8Dje9udt+qVlPd1q+lxAkScVOs6KlEoVMFngb/dQjdbFiKKvzaRUhn6peDZqvauVlA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(66574015)(86362001)(83380400001)(2616005)(107886003)(8676002)(66556008)(4326008)(66476007)(66946007)(8936002)(1076003)(38100700002)(186003)(5660300002)(2906002)(26005)(6506007)(6512007)(316002)(6486002)(6916009)(478600001)(36756003)(6666004)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OG/2uD7dAtmXfsLTVwt+lUYOAnoR/Je3u66Djcs4U6HLCN9LO2f9ngtUUuvqkAYIcuOba+qCx4TJKxAtA8wR1heutUC9aGMEEUPndMzGKXHYSSRq9Rbe4/HfGmbEFqh/3mItLWx6rZUZ82DzgPicRifZDuvg2Lj/aYffAnYCgRf0RC35iCVatHNRL23iyPwNZYlhDg58L5kIppQKQQwRuIlz26wvSc0+mh1B32KMiueSddADr7MdxIXRyKThqR05sfOJTEV0QnAltLTSAmeeNJAxFIbgvvf1BfMoabPFGXuZSjUH9G8EspLQUR5Lh0UW7pLSSfVlmx3L7Vbrpi1QkPR5SixDTO8QqqsJGLwhiDk9+tcBd9xnRbK+4/NqMV8eYYu2xjfw4CD4yFnPqjVsiWUIhWqKvcJ6oPDQz7JUihj7OZmujHayVNUX1yt7QT3iBtYizhUXebUW7P5weoFjT8WKlT5PP89W38L6dT6wOlWuZuxyx6qGeys8oc5y5zj0u3oaO2bcOiEReF0CSuNyxHK5SQlm9b5iqhumnhJy8e7NSg6uXM3O/U/X1PMl6YKxHzEk32+uMY1tiPqAMgcm3y/rzpedjUaOwtCLKk4DiPWcv7m5dSuKg1PL2Ztf+8DJtrlJAEDU/3bUvgoi9MJhjQeavEa0k1tg9P4jYLp7CeUrmV0TBYNJxZr/waEJun4cQPFSaLrtLbh2OMg6tzvcEbB4zXfFNE6bhzYA6nxQcij/HeQyRIBH5nPDkr1uZzuDOBqsJPf7nqvuIXgos79pO0w897AYS/lD+ZxroPrzbovxwNzYPMjwepbFPKRSxT93SGmXzB8eKiaOyzgzynX34hfPvKMcY2a23TEx9oT7v8sd16vTdlW5sgPI+iDi6RCuAvC1z4NyWLpbQ16KZi3XX0fC9J5vVz0OVSnX+CGaFlMyxuUnEgd64sZmoqkhZDozPj+Ukb95jMR7KdqMTGaqPD8UaTBvYJkEsOjBmZYdKov4oDK+eBvqsiMZIkXsWNm1q2O2PDtxhtkN46J+sQKtFE3XyYtGedT/Efuaw4/N1tL48q4Nomm3a8A/BvfUu2GXJKgc3R/szsO8v+Ih45w+qdXNjQ9W61Nc/LycEn2urWwc5hsA0vS2CsK2M8SI5egAq7hJg3IYh8K7L5K6MXRFC09hWMs8QkS4KArv/eJH+JuvvjXkPxHQMKMQMKGjfrrI1TWC20pGARLGs56IgeAYF7dLYVnZ92XsW8EZlZi7t8dWUHp4HFFJsd4rXxOybT+9QRm1bmpnSdOpYZumZXH8INEIrXqQIEgHJuYMopAD7Xth1S9DxSitt9lUzhn3n18qZS4xUJZHR0TscuqxTRPhzpw01FilncV27mnIsEHmLJ0Ad2PLaEw1JsiNd+yLDGRPXJsNrCeGPPsVlyE6LVa1G18NzVr9UaZkUyGmRgYBND1n8+EsQoNvzyBAouob8HxJmU6ytXMkoxJuWp2xx1tgo3izfFVdCR13I0TmPoW332zqZ+RjohNFF6DP2gVvTBtvobaXGo4fUjMUXkypB/gR2SqnXLI2/GOlZG1K0Pv9szTEg0sg5S30AH6GOjaXHwETzYXeBX3TkJjt2dDkShcT8gIAkBa2LAGzvXbbkYb9fuLemNk2xQteUsfdr18nB9k7262g1Hg7Bpb17V+5uLSwyZVPOJGM6Z1+d2uijcXXWh6zdz+hoyjbWrF1dm4MC348zdnElBmOIpOPDrotwSM1bQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44297622-4a46-4735-1b52-08da54e8c354 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:51.4436 (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: 090RvRUTtojkcY0p87f9Zn67UWjjsJtj0+3NuB7SoyXnypu1fjdOmDMr+YpxaayNYZWIb4o92/6X4w4KXTP0sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4414 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen Egress VID for layer 2 multicast is determined from two tables, the MPE and PGT tables. The MPE table is a two dimensional table indexed by local port and SMPE index, which should be thought of as a FID index. In Spectrum-1 the SMPE index is derived from the PGT entry, whereas in Spectrum-2 and newer ASICs the SMPE index is a FID attribute configured via the SFMR register. The validity of the SMPE index in SFMR is influenced from two factors: 1. FID family. SMPE index is reserved for rFIDs, as their flooding is handled by firmware. 2. ASIC generation. SMPE index is always reserved for Spectrum-1. As such, the validity of the SMPE index should be an attribute of the FID family and have different arrays of FID families per-ASIC type. As a preparation for SMPE index configuration, create separate arrays of FID families for different ASICs. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 4 ++++ drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c | 11 +++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index f21c28123ad1..e58acd397edf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3232,6 +3232,7 @@ static int mlxsw_sp1_init(struct mlxsw_core *mlxsw_core, mlxsw_sp->router_ops = &mlxsw_sp1_router_ops; mlxsw_sp->listeners = mlxsw_sp1_listener; mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp1_listener); + mlxsw_sp->fid_family_arr = mlxsw_sp1_fid_family_arr; mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP1; return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info, extack); @@ -3264,6 +3265,7 @@ static int mlxsw_sp2_init(struct mlxsw_core *mlxsw_core, mlxsw_sp->router_ops = &mlxsw_sp2_router_ops; mlxsw_sp->listeners = mlxsw_sp2_listener; mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp2_listener); + mlxsw_sp->fid_family_arr = mlxsw_sp2_fid_family_arr; mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP2; return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info, extack); @@ -3296,6 +3298,7 @@ static int mlxsw_sp3_init(struct mlxsw_core *mlxsw_core, mlxsw_sp->router_ops = &mlxsw_sp2_router_ops; mlxsw_sp->listeners = mlxsw_sp2_listener; mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp2_listener); + mlxsw_sp->fid_family_arr = mlxsw_sp2_fid_family_arr; mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3; return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info, extack); @@ -3328,6 +3331,7 @@ static int mlxsw_sp4_init(struct mlxsw_core *mlxsw_core, mlxsw_sp->router_ops = &mlxsw_sp2_router_ops; mlxsw_sp->listeners = mlxsw_sp2_listener; mlxsw_sp->listeners_count = ARRAY_SIZE(mlxsw_sp2_listener); + mlxsw_sp->fid_family_arr = mlxsw_sp2_fid_family_arr; mlxsw_sp->lowest_shaper_bs = MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP4; return mlxsw_sp_init(mlxsw_core, mlxsw_bus_info, extack); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 8c647ab0b218..acb52f6aa97d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -211,6 +211,7 @@ struct mlxsw_sp { const struct mlxsw_sp_mall_ops *mall_ops; const struct mlxsw_sp_router_ops *router_ops; const struct mlxsw_listener *listeners; + const struct mlxsw_sp_fid_family **fid_family_arr; size_t listeners_count; u32 lowest_shaper_bs; struct rhashtable ipv6_addr_ht; @@ -1286,6 +1287,9 @@ void mlxsw_sp_port_fids_fini(struct mlxsw_sp_port *mlxsw_sp_port); int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp); +extern const struct mlxsw_sp_fid_family *mlxsw_sp1_fid_family_arr[]; +extern const struct mlxsw_sp_fid_family *mlxsw_sp2_fid_family_arr[]; + /* spectrum_mr.c */ enum mlxsw_sp_mr_route_prio { MLXSW_SP_MR_ROUTE_PRIO_SG, diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index 27bd55efa94c..1f8832f86327 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -969,7 +969,14 @@ static const struct mlxsw_sp_fid_family mlxsw_sp_fid_dummy_family = { .ops = &mlxsw_sp_fid_dummy_ops, }; -static const struct mlxsw_sp_fid_family *mlxsw_sp_fid_family_arr[] = { +const struct mlxsw_sp_fid_family *mlxsw_sp1_fid_family_arr[] = { + [MLXSW_SP_FID_TYPE_8021Q] = &mlxsw_sp_fid_8021q_emu_family, + [MLXSW_SP_FID_TYPE_8021D] = &mlxsw_sp_fid_8021d_family, + [MLXSW_SP_FID_TYPE_RFID] = &mlxsw_sp_fid_rfid_family, + [MLXSW_SP_FID_TYPE_DUMMY] = &mlxsw_sp_fid_dummy_family, +}; + +const struct mlxsw_sp_fid_family *mlxsw_sp2_fid_family_arr[] = { [MLXSW_SP_FID_TYPE_8021Q] = &mlxsw_sp_fid_8021q_emu_family, [MLXSW_SP_FID_TYPE_8021D] = &mlxsw_sp_fid_8021d_family, [MLXSW_SP_FID_TYPE_RFID] = &mlxsw_sp_fid_rfid_family, @@ -1238,7 +1245,7 @@ int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp) for (i = 0; i < MLXSW_SP_FID_TYPE_MAX; i++) { err = mlxsw_sp_fid_family_register(mlxsw_sp, - mlxsw_sp_fid_family_arr[i]); + mlxsw_sp->fid_family_arr[i]); if (err) goto err_fid_ops_register; From patchwork Thu Jun 23 07:17:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891862 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 E515DC433EF for ; Thu, 23 Jun 2022 07:20:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbiFWHUQ (ORCPT ); Thu, 23 Jun 2022 03:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbiFWHUD (ORCPT ); Thu, 23 Jun 2022 03:20:03 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2073.outbound.protection.outlook.com [40.107.96.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 253A84615D for ; Thu, 23 Jun 2022 00:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mb2Cu2V5pscSgnxhZZ+sS1nEn7UfZVNSOdF6cB/wUyOGmtqqXHUWvDLI5wcY2dMtmxVj6BvQyOxWnx8jg2SraLAa5k/PTnMuC+Fyk8w0Ieatca4aHoYW6mFEdV20Iy6baPq5RL2ijeWXL3AQh9QQy7hvf5r8WWD3t6q/Kxvch4s1o7ZaztZTgprseDL45pj4qWB6QDTg3m1oaLFHmNbnHAU9Lk+H2I/uziRjaXx8bA9DUvvU5/+MaB5jnje50CVX4oWuD8sXJ0ktx3bNj//f2S04GdNmlimZrSXOuulhwgA0v9pql+L9ZKmjjHiktHLrKgRFxcUQYwNyTKTJFpd22g== 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=yJaT9uiAMSRNAK1htgwhU03+NK76TvrCgcMSAyQVapk=; b=h5YEfLmBRLR7T7Q1IrExyIPw+EbhsBeTqhH/ftt5UAbGO4W/vEUwD1pe1XqSl5dQ/AiAHaklBDMn3b11P3AknIKPulinHqsrZ4mZhH+kHkqCMtM8H3T3KQkJI+BlFFHyg4QicaAL1zekLDPAEzv0YST6azgRHHMpHz2mL1Uzp2rMt7ZssGvDPS2YeBrMR6c7850Q8Y3apuFcafhRvaX82JX0ne2AiCqZ/1W6B9UItPvAlFevJGzCKXW18V8f5Bg4pSqcLCmhhLMoimXXWbIub1vTt4hzvaC4O5pTHv0qdufl5w+jx76Vh72/+jJ5om+XOb/PmEl5G60aku/kWTTkhQ== 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=yJaT9uiAMSRNAK1htgwhU03+NK76TvrCgcMSAyQVapk=; b=ghIJe/DLIGGrFcN3U8ck21wlxe8MXBsp5InNfhk+ecmD1X2XJ17ItFNSHumGnIkLfKZgEn9JTKgMvokMtsb+C2r67cCIP5jz7IK3wXMR4Phq8fY8H0DuO9m6WUYSVQPasEssUEuFcDG/0d1xguZGh+cCrK8XwC7o98btLIcm9rkd/SvKMjmzkppE4O0sYJBCBwZgraBgOCE6ZPKTQ9h+AuTsGCT5pRsv0OvhaQRzWtdyPBvledjpFqxnlUa6t66kt0QMuIuECCocGb2xt0Zw96T/cTjbjHYDuOe01AAlmiGEKdCZs0GmbPy41lLeB03msXEGW/CvW6nfF9ZoJu/sHw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by SA0PR12MB4414.namprd12.prod.outlook.com (2603:10b6:806:9a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 07:19:56 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:19:56 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 7/8] mlxsw: spectrum: Rename MLXSW_SP_RIF_TYPE_VLAN Date: Thu, 23 Jun 2022 10:17:36 +0300 Message-Id: <20220623071737.318238-8-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0060.eurprd09.prod.outlook.com (2603:10a6:802:28::28) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08aa95c8-bd7f-4749-a8a4-08da54e8c662 X-MS-TrafficTypeDiagnostic: SA0PR12MB4414:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oB75JMZQG1aE7t3A9wZLlcRGD5f7zP3yCjVIW0grurRUr58T1CJoK1S5kPVeyWV0ApreRCV8oBeEGbl1zap9tVJaRclGQwi59IjJ6NFdhfwzXsS5Ne3MKfcQhi2niN3Gflm4ZUbnwTl/Ft9u590+8ZCRbgxMhmXvREYG2hJdXYmuvabQKdZ5b0d4/tUB0LNBNsLp06ukxn3dKvGdGkIMsAhDis2QgsaR0D1wZUUN4/QBdwk45xRwYlXGB5bbYOhG0Qxj6esAM2zRhqZuaxTiNhdOhzlgg2qy1aCKjEdHJHnXU0xVePpGNTM/0sYxvu7e0iu2PlVPGOnN8SU9gsR5IbGUrUTQsxIxcROF3ahG9sbBNVdu4aLyzLXRBL4mtNWAAxhnN9FTkwaWd8wGpxmoAAWAnnJgsmVm6+M9YbNBPOaVLODxxawggvzc34k4ja2HAhOxuWDPk4nZR6/2WMvgQP/mkkWeCGyv+FdtluuNDQsK/la82afbpoYTpWFsdvUhgDTTroSVC8lJ/zibFoTZEh7GSr8Kan82UhfnzdZJd0+Is+divb9HxebRcUBnhI3T+ITG2qcSgqPCJZd72vIgvaJyVDm9+4/8CuTwymNTkxCRKraDb3kE3k9HVJaCcpiMwkej/1ajJb09eRdq+/3TdsoaNa8rPW5d41vUAazCXIIxwWVWa1h9+/K1ycgh0mt/T2weqjxpKwSxhKisX5QiSA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(66574015)(86362001)(83380400001)(2616005)(107886003)(8676002)(66556008)(4326008)(66476007)(66946007)(8936002)(1076003)(38100700002)(186003)(5660300002)(2906002)(26005)(6506007)(6512007)(316002)(6486002)(6916009)(478600001)(36756003)(6666004)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dfRxegT8oJ//KUftkl8/9fs29zWOCELjf81VKns+CGLEaw7I+nAIlM0YhRbhqdM0S1RTzLjtkj0tvdiRFnNUhn9ydR4nTL29g9Rl3gHY6ZST2+T0ZwpGfyBkU5veR/hxGhDjvz/XSJUKiQAqz2C/ZMPcbc/dKbh4T73iWhNTpAHN7R6BQ9Z30KpHNOt4M17e+RdjZf8wIUT98bWtmu3sbMDe0pw033Cj+guEDAkVEmbd/9H30P2Y093OFzykjp5SZdaR8kvgUJ1OGYAAZHCqrfz8EByODQo5wKgJtytPN5BOVfwoUIgnBxPcewo/y2QidfHWtibs8kLIref2696GkYMlqmhkDnAC7R+daVXmi2bHaomof8ROVwzLF+AsSDEI4SfhepjrSyu6wtI92cL0QY6UIJp5DRoyGUlO8PdbD9B2x3usnLCcED5w9yCX386tcHZqxh4fummuf5iwIpHatmsBpHijUeb4DZVZJSr9eG1Jfa9m/yf2v6LwUbce01HGDPXvsPXMeE+7cG/xCjjw61sOX49xEdLa23d7IT/xI7CS388jV45PmN1+4U8PtbVaB0N4LLy1zCMSHqWPGoGePQajh2oJY0wzLItSjquQNdSiUed7OXR9qWXISK38FVrhsIOn/ygl5jImDWGZCIJqJ4AAOWVuP/DdS7ByE7AVl7BSDa4fb4hBXMsclzowLGrideIrGkViicnGwvQnUxDj9wvrarZyTUWhahTK/HSuZL/DTQkOUS/FzlHW3Tdc60n1srSWrmycpPRWk9C3LS0x4UOXVKs+wdmfjjlj6iwSnwnniqJfN+BOdhRr0pKAC4MA7VvLKH675wYTUA17XGzjQUO/uXL7IjnD/m5C4XrJkAtLfQ8gfVvkCpboZreTQ85RKyWLuFbEfG7VoJJDHnJ8MV3kcbXjyB2/wFJDh4ss7JvZKSA3QXCi9Xsev5jm+L5s2ap0Z+/3Y7sP0hL2TLWtsxwIHA+ULakgihQ4x61MD4EagrxeffoK0AcXSQysqQCaKJFmn11d1A01vNHM+XjQGgiueRN4vDW4AiK4c4qdBlVnSOyGGgbbMi8HMkVkdPKUKy45SRC8HxUzeMosMFXltehp+RIv+SqbDF/SK3DNTzys0MKPmrwgRuNKZF7lWJ1p2aWRK3RDEu7jKrhJ0Mu7L2bNdwXz9UaSx7NZhmzUe2z+TcQ98fcSLcK+UvoDUXhW0qZlGXuRORWRYhhMgKfj4pTCLgGDAbsR1MxLtVsOVrATrYefV5gdOBlkctCQkapOsPkNoaB7IpXOqvteHaS4VK/3B8Dis2/5RikDNmrixpYhEev+Tr/33RiWHjFzEfQ6CMA/W2qEFEAnw73M5VqPYpnNRZcqyoftDH3JjrDjnZq8hWV3+eykDPvUabBgLRlMh8RTVY9X7xfb/WTOYC1DUIVJ40WzL+9lvi9gg0qDaFPgZ3Q+dI5CmApdd+oOS//HiJhfjK2x0VvUfEGprZCdBN3cYbhs9G8qWtSpwMKlXXnzhfo/fWRIFNctnVDkTQ/do5iEQ2X2JtxOG4JePIlOs6Z85Z/b+ftsJlwZItKzJsgTirNoYYl1D+QKSLYMkdg/znv1UOnPUr1G64ktJiSZpFctkG/7aN3FsvyeFzbGDgPc/svM+g8bg2h42QnSKEqJwPos6My8V3u7xwMptwlakRid+4PwjjRky4Opi7QWFqD6sRstVH+UNt9f5/QkwkNTP5543ts6x55QdaPgbwiz2Q== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08aa95c8-bd7f-4749-a8a4-08da54e8c662 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:19:56.5721 (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: kVgpUVX9b6Rmzoo7IsUJP8ttEWAuQL+KRlDUdw04DsaairkBuqRaatTTa6gvGgC4sojmZ/3UqXs8m4bPoad17A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4414 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen Currently, the driver emulates 802.1Q FIDs using 802.1D FIDs. As such, the RIFs configured on top of these FIDs are FID RIFs and not VLAN RIFs. As part of converting the driver to the unified bridge model, 802.1Q FIDs and VLAN RIFs will be used. As a preparation for this change, rename the emulated VLAN RIFs from 'MLXSW_SP_RIF_TYPE_VLAN' to 'MLXSW_SP_RIF_TYPE_VLAN_EMU'. After the conversion the emulated VLAN RIFs will be removed. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index acb52f6aa97d..80006a631333 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -84,7 +84,7 @@ struct mlxsw_sp_upper { enum mlxsw_sp_rif_type { MLXSW_SP_RIF_TYPE_SUBPORT, - MLXSW_SP_RIF_TYPE_VLAN, + MLXSW_SP_RIF_TYPE_VLAN_EMU, MLXSW_SP_RIF_TYPE_FID, MLXSW_SP_RIF_TYPE_IPIP_LB, /* IP-in-IP loopback. */ MLXSW_SP_RIF_TYPE_MAX, diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index 1f8832f86327..fb04fbec7c82 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -774,7 +774,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021q_emu_family = { .end_index = MLXSW_SP_FID_8021Q_EMU_END, .flood_tables = mlxsw_sp_fid_8021d_flood_tables, .nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables), - .rif_type = MLXSW_SP_RIF_TYPE_VLAN, + .rif_type = MLXSW_SP_RIF_TYPE_VLAN_EMU, .ops = &mlxsw_sp_fid_8021q_emu_ops, }; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index e12e0929c7f5..c6d39c553d64 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -7730,7 +7730,7 @@ u16 mlxsw_sp_rif_vid(struct mlxsw_sp *mlxsw_sp, const struct net_device *dev) /* We only return the VID for VLAN RIFs. Otherwise we return an * invalid value (0). */ - if (rif->ops->type != MLXSW_SP_RIF_TYPE_VLAN) + if (rif->ops->type != MLXSW_SP_RIF_TYPE_VLAN_EMU) goto out; vid = mlxsw_sp_fid_8021q_vid(rif->fid); @@ -9552,7 +9552,7 @@ static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac) } static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_vlan_emu_ops = { - .type = MLXSW_SP_RIF_TYPE_VLAN, + .type = MLXSW_SP_RIF_TYPE_VLAN_EMU, .rif_size = sizeof(struct mlxsw_sp_rif), .configure = mlxsw_sp_rif_fid_configure, .deconfigure = mlxsw_sp_rif_fid_deconfigure, @@ -9630,7 +9630,7 @@ static const struct mlxsw_sp_rif_ops mlxsw_sp1_rif_ipip_lb_ops = { static const struct mlxsw_sp_rif_ops *mlxsw_sp1_rif_ops_arr[] = { [MLXSW_SP_RIF_TYPE_SUBPORT] = &mlxsw_sp_rif_subport_ops, - [MLXSW_SP_RIF_TYPE_VLAN] = &mlxsw_sp_rif_vlan_emu_ops, + [MLXSW_SP_RIF_TYPE_VLAN_EMU] = &mlxsw_sp_rif_vlan_emu_ops, [MLXSW_SP_RIF_TYPE_FID] = &mlxsw_sp_rif_fid_ops, [MLXSW_SP_RIF_TYPE_IPIP_LB] = &mlxsw_sp1_rif_ipip_lb_ops, }; @@ -9818,7 +9818,7 @@ static const struct mlxsw_sp_rif_ops mlxsw_sp2_rif_ipip_lb_ops = { static const struct mlxsw_sp_rif_ops *mlxsw_sp2_rif_ops_arr[] = { [MLXSW_SP_RIF_TYPE_SUBPORT] = &mlxsw_sp_rif_subport_ops, - [MLXSW_SP_RIF_TYPE_VLAN] = &mlxsw_sp_rif_vlan_emu_ops, + [MLXSW_SP_RIF_TYPE_VLAN_EMU] = &mlxsw_sp_rif_vlan_emu_ops, [MLXSW_SP_RIF_TYPE_FID] = &mlxsw_sp_rif_fid_ops, [MLXSW_SP_RIF_TYPE_IPIP_LB] = &mlxsw_sp2_rif_ipip_lb_ops, }; From patchwork Thu Jun 23 07:17:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12891863 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 A166DC43334 for ; Thu, 23 Jun 2022 07:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbiFWHUQ (ORCPT ); Thu, 23 Jun 2022 03:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbiFWHUF (ORCPT ); Thu, 23 Jun 2022 03:20:05 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2067.outbound.protection.outlook.com [40.107.96.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC6545AFD for ; Thu, 23 Jun 2022 00:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l+DQDRdlWvDKuePmIQOAyUYenOFOCnNAbKlmc11Jm8R05Uu0iN0qyq1Kb6pTZeGin6E8XdXClc2ABzomBmaP6JUrXL4vQh5WORdXFzM8Oib64+WopMAci8TJLMQsvvYY7x3ti/KzHlAeyRZKHifwd9gbKI3zxYTRml5+pVT/VbqOGEp1sdbmpi9d0wn7EvVP2G+XQqoQ9mZSnzAFdPNi4V2iWTBvdMPPxq0oCwf7+Ak+6oJBl+NaqAx1oBEI3omJkpY+xn1u87kEIzE/t4x21RSR7//x6bflddYS1w6MJN9M1N8RqMdWtaU8CBTjd2HJCHsLeQqoMGDc98rkWs7HFQ== 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=dEF1NGyfkFmEYS1TR948i1BU3VKbhgk6Uwpzj9VmL/E=; b=kMhnelbWbdMt5Q17deBw3b+N7ihq7lSR7eXPpiPMH5gFtzss2v7bSRbeuuTBmPsDbG/CfbynPe0WsUGE+FNi27c+RXsYzlf22Q44EOZ/PN3jnrMeW7VqiTDsqvIarCg9g35sIZ3y6huMLDPpLk/Hk9PUYCvhCh2Fn/QzE1QbZUyZzTS4P8qfpY91I89kP5vwqRYYPZ2dVN1FNXodmTmBb6gs88KR+zWOt5vdetZDfxUxBz0y/DMlkfdcVop0UCyooYcxFHdMp6kQXr4CcHmLdgNhaYJWbemuU55RPxYlAK5cn9hOiszq4taZI4/smQPi+JHjDGb6ty0n7h/9fmFCgg== 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=dEF1NGyfkFmEYS1TR948i1BU3VKbhgk6Uwpzj9VmL/E=; b=cAlOsTJIt+cOsRz+GEfvaBzIQ/FL/JmIncXqh+KseIaRIBMhLgwL1zX/ckcxBEVNVpRwB7rq+wqjDLJJqz1bWlBf35Nefig9gRW2igflrWt/m9YyRQ3EZVx0khfftUMtqS0nm3vFhgYwY2uaXTXqXZ2bZ7jrr8kNzJzWqYJexDwktAe25Ms3zQxYEeL/4mF5MVQrqpFs2vBefni9KZ/Ahq49l0O5zB+pm1pEmKc3/uE8gpMj2zcq7gTiIg7vUiebittZmx/nAevxCQBf/Vc1uLZRHMWj+lSyx2mOoYITvSFeJH7Sb0LPXELv8ZzM3hAM4QWruI6Oy1lUgz6FiGKxFw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by SA0PR12MB4414.namprd12.prod.outlook.com (2603:10b6:806:9a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 07:20:03 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::6da4:ce53:39ae:8dbf%7]) with mapi id 15.20.5353.018; Thu, 23 Jun 2022 07:20:03 +0000 From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com, amcohen@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 8/8] mlxsw: spectrum: Change mlxsw_sp_rif_vlan_fid_op() to be dedicated for FID RIFs Date: Thu, 23 Jun 2022 10:17:37 +0300 Message-Id: <20220623071737.318238-9-idosch@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623071737.318238-1-idosch@nvidia.com> References: <20220623071737.318238-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0701CA0058.eurprd07.prod.outlook.com (2603:10a6:800:5f::20) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49b12690-3ca4-4c9f-ddc2-08da54e8ca68 X-MS-TrafficTypeDiagnostic: SA0PR12MB4414:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WSGsZB8zsF5mijnfLAc8c8LUrXKnrlPdttmeYEO6zwa5aPcKh5OIVcpwr5LROFqYfu71BqfDpMvcZIY5A51Ud8MMZPmf0/vy9eaZr4cNJXP+di7PQqDPUJSbjBHZDco2wxn3dYiycDSTM8G88VSbnJ1Rz4IrDluqJLc/k9u04madXCdSyy8IpnUDlKt1vqvohPBOUH5nSbKmIpeFvJBNkMOckXhnxrvv/Gs2O0OfuHOjiORLj8/R9AUWhbpIoBLxRUDN2k2Hujj/fGXDYNv+Fi8/xbN2su8RyCPRrg5dwLqQllyhpf6FrIGg4os6xOZ8a6HWQI+crN+SB7c8EoYRTVAAf4WPYz2+L1WEq6XvIsrL4qHN9mkRWUUrVV4e1e9eI0gZSIeFhXXn4rCl0HjHvIj/wJcMwsSAsNaMoCcbcXUBe5lXQiD06Lq5G/0jzTVnJZ2KSmT5KpeQ72PMRpxrDC5QYBB4ZA6CYGuIAagi/D14otsowStnIi5MNfFUv3IQWlppLM+Z6TrKRwo1O4Z3/Tug0rhiPSoGG1Zm7CPXBF0Nuz8704rH0WD/Kl1p1kh4kOH8kQHswzHQTNKiQoAI2fJ1GHFv5E11h38Xasw3HFTza/sT2WALis6Y2+A2hC7Sh/+Ax7pEpiK3dzwwdL0PP6xfKJrLffyOcKbvAmzaeNbr8mBtJ/1Zt7PiEHRrzuYUDhOkIIPv79XuL8LKMJjLbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(66574015)(86362001)(83380400001)(2616005)(107886003)(8676002)(66556008)(4326008)(66476007)(66946007)(8936002)(1076003)(38100700002)(186003)(5660300002)(2906002)(26005)(6506007)(6512007)(316002)(6486002)(6916009)(478600001)(36756003)(6666004)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lBcPgctWk5ZNOM9BodJRZrtf0QGPX3NunLeSm7D6uuqDeMZSkFrE9Krjly/SoqCjFnuykxicyAiDS6n63bmY0crCkXq18pl/y5LuTBVlljJuyy742j9mCY/HALJwTwzD+56o9lNI87urlo4goesTdVWydrtapVIIkU1d1Pv6iNhlGVpQvqR9A0zVGLPEdQa2IcV1m1TGGhDRBbmT4gT3JLyk0Ef7orX9gSVYJ1LbPt+JAQfpN4K4Tk8ui8V/V+3MHxmwZ4SlgYFebFEAjmsll9ZsqSnrlTuc2KCKEWvGmMlXHWj5qSIPvz7BW/UMEgkIQg0pUxevZvCgWoAM6BJZqBoHdiXwXNJH1RLs2vQHHJZTQwrJH3iLPVscO0HGiPoFBdQnbLsFb80U2Q+AJGpDFIQbeD/fAuAntnQr1ArQHmBjjffU7ivNgHDx12YkD1VCtFiZDAWwosrI3/xMF1G4b0ARRaVpiaRVP81jGbcnW+IfoFG0PrbjUtSuT7yX51cOICPuEYuoO+Vr3/BWEbW8V9Q1LFc9gO6ZYtUXXZTzBSW1ixFwzotEj5MehVN15NBcYOZFQlp4h8tV/boig6K+SbUaurJ3Im9cBlsgfb8NywWeQ+j23sknURAlE9vn08bYvRW654P39AAf2xV/8TIgM9E4P4gwyKilSuUSmD26keKjVOEXOIkNdKUydtoIaGSr54495hwq44iGbyQ4XF2vnOW8rhIw9n5PhsxnMv9D7ZyayzkGQ4q778A1fUi6GLJVFz7AN+p9TMkvFALLfOEHFVdhcAeqW3b01Qi6/pxHa40nTwPhrTIULW7GQg6AUa2KR4eBE/5a0hhaaVhA2GKctrATJ+Ydc0DaToZSbXNtcrtUPBPCoL/CfFG5GK3mkElpeXaTzcnxoHk+MtnvD8mwya5W3NvlKEYCjQzRQdYrSlm2tmLkZE1MjL5sg8+VrdH7YeKpLpL6VeVXSp6ge5Z3s9i43M4I+S2UWTdd3rL2JveP0uk5Dow9tE2tASVLh6GzmwtfZ1XOfeSO4hommzlqO5WAR0K4TxbDjiNtfotgbBtht/9Sws5JKQ1GGw1mI+FoN4y1WaoTFYY7sSgit4aB/DiJv4wwXv2xGJojzyL2bUAeFRkHfYtuG2QiEmhn5pEkqJ8vLTYcXfHJ/J2EON73ZTKeyXMiUwIVBtIMp/kwHsUnC/ke8EH5QX/FvpZnptRTZ+X8f5gRYAY+KZKkn0tcQY9s0GgBQzBQDYlm0mrzKSQkxvWZaT52rQiI4g0uh/SlNGPk7GkmJFptSNpBP6Y9oPi2vo0WmVNEX889ZJziE/3HkUIIt9VgcWsJ8f8+Q1xUFrCeIKI9uFElciLuzDCb067ZBLrBtp3E0TYj14+4xgqz/jEAsD0Nmh9F+7ZwW91qlycA7tHgy21azhx3sItLB7R8jp45RuuW4uXF4/muGTysOHF3DG6M6p0owI9s7RqCJRwGc9VRha7hUbguc9Z/0LQioX7ZXRrOGNHYADmW7Wr4gzCltnaFCOmLnjaIQOrX76EGI9+8SYwhtMR0kgxleTMHCVIEfsB1r/RbQG1FxNp3uLFl64bDKmD18ujKPfWDS5zHdCLUlzXvTlsJCvak0aeBrkNIV7FetGC+qUNKhAL1HlJshSaRyLxRPi/u3UZTa5SvgtIVufLzM8fokCEl1LokKpeIb0MHTuKN/sZN0NBaFrNuty0Z8x+QdLKffxL9iNxVyzZ98YwwUJ6rDRou9g== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49b12690-3ca4-4c9f-ddc2-08da54e8ca68 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 07:20:03.3393 (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: OSDYyQpznNEszCDa1nNFxxtdWY7PtMTFXGWQuIEYqIRbQqMJG1m24VKJRZD/O8gHvKwPe5L0trEBHzczImEK5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4414 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Amit Cohen The function was designed to configure both VLAN and FID RIFs, but currently the driver does not use VLAN RIFs. Instead, it emulates VLAN RIFs using FID RIFs. As part of the conversion to the unified bridge model, the driver will need to use VLAN RIFs, but they will be configured differently from FID RIFs. As a preparation for this change, rename the function to reflect the fact that it is specific to FID RIFs and do not pass the RIF type as an argument. This leaves mlxsw_reg_ritr_fid_set() unused, so remove it. Signed-off-by: Amit Cohen Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 10 ---------- .../ethernet/mellanox/mlxsw/spectrum_router.c | 18 ++++++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index c9070e2a9dc4..7961f0c55fa6 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -6937,16 +6937,6 @@ MLXSW_ITEM32(reg, ritr, vlan_if_efid, 0x0C, 0, 16); */ MLXSW_ITEM32(reg, ritr, fid_if_fid, 0x08, 0, 16); -static inline void mlxsw_reg_ritr_fid_set(char *payload, - enum mlxsw_reg_ritr_if_type rif_type, - u16 fid) -{ - if (rif_type == MLXSW_REG_RITR_FID_IF) - mlxsw_reg_ritr_fid_if_fid_set(payload, fid); - else - mlxsw_reg_ritr_vlan_if_vlan_id_set(payload, fid); -} - /* Sub-port Interface */ /* reg_ritr_sp_if_lag diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index c6d39c553d64..63652460c40d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -9389,10 +9389,9 @@ static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_subport_ops = { .fid_get = mlxsw_sp_rif_subport_fid_get, }; -static int mlxsw_sp_rif_vlan_fid_op(struct mlxsw_sp_rif *rif, - enum mlxsw_reg_ritr_if_type type, - u16 vid_fid, bool enable) +static int mlxsw_sp_rif_fid_op(struct mlxsw_sp_rif *rif, u16 fid, bool enable) { + enum mlxsw_reg_ritr_if_type type = MLXSW_REG_RITR_FID_IF; struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; char ritr_pl[MLXSW_REG_RITR_LEN]; @@ -9400,7 +9399,7 @@ static int mlxsw_sp_rif_vlan_fid_op(struct mlxsw_sp_rif *rif, rif->dev->mtu); mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr); mlxsw_reg_ritr_if_mac_profile_id_set(ritr_pl, rif->mac_profile_id); - mlxsw_reg_ritr_fid_set(ritr_pl, type, vid_fid); + mlxsw_reg_ritr_fid_if_fid_set(ritr_pl, fid); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl); } @@ -9424,10 +9423,9 @@ static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif, return err; rif->mac_profile_id = mac_profile; - err = mlxsw_sp_rif_vlan_fid_op(rif, MLXSW_REG_RITR_FID_IF, fid_index, - true); + err = mlxsw_sp_rif_fid_op(rif, fid_index, true); if (err) - goto err_rif_vlan_fid_op; + goto err_rif_fid_op; err = mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, mlxsw_sp_router_port(mlxsw_sp), true); @@ -9454,8 +9452,8 @@ static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif, mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, mlxsw_sp_router_port(mlxsw_sp), false); err_fid_mc_flood_set: - mlxsw_sp_rif_vlan_fid_op(rif, MLXSW_REG_RITR_FID_IF, fid_index, false); -err_rif_vlan_fid_op: + mlxsw_sp_rif_fid_op(rif, fid_index, false); +err_rif_fid_op: mlxsw_sp_rif_mac_profile_put(mlxsw_sp, mac_profile); return err; } @@ -9474,7 +9472,7 @@ static void mlxsw_sp_rif_fid_deconfigure(struct mlxsw_sp_rif *rif) mlxsw_sp_router_port(mlxsw_sp), false); mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, mlxsw_sp_router_port(mlxsw_sp), false); - mlxsw_sp_rif_vlan_fid_op(rif, MLXSW_REG_RITR_FID_IF, fid_index, false); + mlxsw_sp_rif_fid_op(rif, fid_index, false); mlxsw_sp_rif_mac_profile_put(rif->mlxsw_sp, rif->mac_profile_id); }