From patchwork Tue Jul 17 15:36:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10529875 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72CA5603ED for ; Tue, 17 Jul 2018 15:41:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CD1229775 for ; Tue, 17 Jul 2018 15:41:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A24729453; Tue, 17 Jul 2018 15:41:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E80742972C for ; Tue, 17 Jul 2018 15:41:22 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41VPdY0Yz1zF3K7 for ; Wed, 18 Jul 2018 01:41:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="o8ie9uuP"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.0.59; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=idosch@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="o8ie9uuP"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00059.outbound.protection.outlook.com [40.107.0.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41VPYW3sxMzF3Hg for ; Wed, 18 Jul 2018 01:37:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kcSakijbiNsxUfRNh6k3BmTLUmVtb3Zjqj0Ezk3gb0I=; b=o8ie9uuPi3dx1FW3Pz9vGmjpFsPSssSUf8FvRit5o3nPMmXm7H3Mid+Pv2e4MKdPShfCUT7EjEpi3JUrG54qdKcGvd7X5KtVeM73c9IWgbv9XqUJJRKQHdDBE63p40Yhki/I6Ggz22vfJJ3XC6kG/aCyJ9UYJxIdwDaQBd/mOkc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; Received: from splinter.mtl.com (193.47.165.251) by HE1PR0501MB2330.eurprd05.prod.outlook.com (2603:10a6:3:27::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.21; Tue, 17 Jul 2018 15:37:39 +0000 From: Ido Schimmel To: linux-internal@mellanox.com Subject: [PATCH RESEND net-next mlxsw 14/18] mlxsw: spectrum_acl: Add A-TCAM region initialization Date: Tue, 17 Jul 2018 18:36:53 +0300 Message-Id: <20180717153657.16324-15-idosch@mellanox.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180717153657.16324-1-idosch@mellanox.com> References: <20180717153657.16324-1-idosch@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: AM0PR02CA0020.eurprd02.prod.outlook.com (2603:10a6:208:3e::33) To HE1PR0501MB2330.eurprd05.prod.outlook.com (2603:10a6:3:27::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5cf6a15c-f040-4e6e-856a-08d5ebfb3af7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2330; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2330; 3:GcpAIXFkZWNfB/tViJP7xIrSbRayMUt3qlnuPxEaIKkwWkeInEj23KyNS+HoAbkVVbRc29+wRgITxiDjmrmVkqGiE82wv2eKasgWqmEQp18hDoNe/ggM1JV7XJMSrvTgzVtP+jsLw3V9Kgb9pp9Vv85HZOJ7p9carj6C7kyW9T5kGF5cEqIFa4ezZ76YPyBpfPrkzAFvYf0qChR6Bjeobjj8VGnuIUnOnOerHdZmQB1n4YWJxe+tVCESQFqyCLg2; 25:w5fWAEUJ07obxKi119YPvUs/ERA1541yXH6wdOyu8ktwkW8VJmsvZGKkuBu1xH6yBnjasumLE3PWfRnMnRIqA4UypHXqPcDG8zap5Dzs9irrS/La76zDmJcCsn+yBE6BLupv9kkIpFNVSwYZLOw5KjqUE0wTTHAKwEetTttBXfUJCEaIuBh0HTEBRZlF0Lwr6Qq8z1EwHMBuJCaU6e3wxNFikGsqg8Rgv5nbqjkYLpP8CzAWh7kisEyvGr4WDllNJATJXRhIq5V8dC65ZitnB5JybB5eBT2+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P5SWOdug+OX/zT7raMRVC4kNBqpNd2y0CvViClJVUmXfdowfkIrpkSuvX3cC9tAcDqFIfutxeOU85Ad362iw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:HE1PR0501MB2330; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2330; X-Forefront-PRVS: 073631BD3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(396003)(39860400002)(346002)(136003)(376002)(366004)(189003)(199004)(51416003)(2906002)(8676002)(476003)(8936002)(6506007)(956004)(81156014)(2616005)(6486002)(2351001)(26005)(386003)(81166006)(16526019)(107886003)(53416004)(486006)(105586002)(446003)(4326008)(11346002)(34206002)(106356001)(66066001)(53936002)(47776003)(76176011)(68736007)(478600001)(6512007)(316002)(50226002)(50466002)(52116002)(7736002)(2361001)(3846002)(14444005)(16586007)(305945005)(37006003)(97736004)(86362001)(6116002)(36756003)(217873002)(575784001)(1076002)(48376002)(6636002)(5660300001)(6666003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2330; H:splinter.mtl.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2330; 23:al91khKvsAM/kC4qAx13OUPJm90LxtQNgVH3eX1?= =?us-ascii?Q?JoaUg7WuUMAzeuFujsDLA0QK03ceM40ELVEYC9oTFwDvaSHKIQHJqgcpUIa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KfB8ZBPMa9Qc6tIm18y/tI7yVR14i?= =?us-ascii?Q?y2VQ4WDGoXFnijUGD1dlmbYYVQLVCeqI2XG/ohQa8Arpcs7dKNk8MBwMivEj?= =?us-ascii?Q?IBfaRTK8M2mNeg+CNEZgaENi2S79rR6RKUG1ficrS7Tau/MXnblyIff2csPA?= =?us-ascii?Q?da6mZww93PDu4M7+zhJO6TvHJwXtMyb2xfzZQXFcheOZ5NkFepE4TbokR28x?= =?us-ascii?Q?zcmI6/VeQqvPGacDWSX2t5wtxPkgc8cu1vweifK1ajlDAlWw2JJBgj5hIB5h?= =?us-ascii?Q?ho3LdyVsKRQr2Sm308QXV36xDLBOWSkSi6tUJfUIl4cOnxcshxtI/5q24Yw3?= =?us-ascii?Q?o0YeDo11Cj9CxboLYJrcWSW6d1Sog9/+hWjM1pxQJV/vJ38TJUH1odCXNlCm?= =?us-ascii?Q?E7uX8pq2S5WBFCcy5qevJyDambmA=3D?= X-Microsoft-Antispam-Message-Info: YdntPDIAooabje7jtoqtwnEaKuwFHj3RBbMgx594YQ6ewUxEruyZ62FkWMZxJP/YyVJHWORGUERtadrdmBzMFosJ2QeYrOj1u4TSVe+UufRPfI5ozj6pJOXOYnEo3YlN7mrtGASRll1Nh+5Qk2vPgnHZTYczoWmj11GL/3vlfWomWEqyAVB2BZh9xvSREeL51bzwwYoXeU9d5KpCWkZVtGS8kFZabq5skTeuTYYoOKi1LJwY02K16QXywc9AWmksrJ+h6ngT1ur/JgHLN/pkkqT1r8BcxQyIQvk9mWay+gcF15Ka3IXlgEzKAn6e6uZ+hbhSiFGsYNuh8Hl69PokNPSAWZ0kY1RnGfqFx8UCGAg= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2330; 6:zhYg9tegQw+elkA+z7czdLFT8ef5DJxQPBC8iCw5faHI67GVJgopWFTDD19vSEH9K75Tml7JdC3Ek5SoYxwW3dj4tBQt5QOI5/n8aYic0epifOSl5YVSI+GM624FNLzgPFfSVyFfthUJFQTMIc41kY+iOCnhIj+bvyTmUfdihAfNF+B0AcP56fzise7dKFPf2sb9J+VlCLCQeLg2hCgjkRYpPRZdtdj74TI/yqPQokBwwyst5GwGIghqgKLMnJzBARac2rJrLxKjN6mAF6LAD1zgv4Itb5vIcwLZzPa3C9UDXnLxtOLEG0LUZv0rX55Y4wp1IXboPHGZem2DZGaXkdTZXNA67WrgKaUwIfP4VPbsVeW9W5WDk/4ILwBr4t+1TXIs4GW3e88mDb1I3hYC7pspW4ZcHKzyLtdi3BlSIE0NxdeWN8v5FZS52GQ8mxFR0b7Qcnkd1bZ+A0YDQAoMLA==; 5:MziaChKRp8TfZBmCrEdDMjAJDNDFK87kkm9k8ESkwPPjfxX4a28gcdAyVAI45oBVbfBg7y08YumrBJyy+Z586RgchWUbYKqoM1Tfrl6IjInwUeIFyZ4nM4NqH13Ou8OCdN74pl9xubC0okHEw4Le7CbH+BIUw7dlC9wEn6MoMfU=; 24:e2q05vJiz9vZXeKLgka74NWtq/wFAK/n0uB0nPpkbCMhGWhIOq5piYtlE028HZh2tkr2FJvK5N4Wv+1GLaC9hgC1qfktaXAitE631z3ESJ8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2330; 7:iNL7wjP9cDmtASh3JYcLIc8kP9tU6nl8rDmcOUet5of0+sY27wB1/BUZiAD0Fyed6U7OWWogaZ5TV6kYXMVJF7rfMZ0CZldpRCNAY0mDsNllOa3rc70a9oPvBJodf0+9ngjETzalJxf30jMLuuMK2F2Y2tvIVSJiXQTrzWBI4yNRRhu6OegeCb7VyhTzP/LtwA5KbYwitc5OcKSFKH4MEVTchO3pF/wEICoVecq0r3QLTUbuGhO2nf0w+YLw6gNq X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2018 15:37:39.5630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cf6a15c-f040-4e6e-856a-08d5ebfb3af7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2330 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP Before we start using the A-TCAM we need to make sure the region is properly initialized. This includes the setting of its type (which affects the size of its eRP table, for example) and its registration with the eRP core. Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c | 18 ++++++-- .../ethernet/mellanox/mlxsw/spectrum_acl_atcam.c | 52 +++++++++++----------- .../ethernet/mellanox/mlxsw/spectrum_acl_tcam.h | 2 + 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c index 1aa80a4f37e2..c2d52d6fe312 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c @@ -139,12 +139,21 @@ mlxsw_sp2_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv, region->region = _region; - err = mlxsw_sp_acl_atcam_region_init(mlxsw_sp, &tcam->atcam, _region); + err = mlxsw_sp_acl_atcam_region_init(mlxsw_sp, &tcam->atcam, + ®ion->aregion, _region); if (err) return err; - return mlxsw_sp_acl_ctcam_region_init(mlxsw_sp, - ®ion->aregion.cregion, - _region); + + err = mlxsw_sp_acl_ctcam_region_init(mlxsw_sp, ®ion->aregion.cregion, + _region); + if (err) + goto err_ctcam_region_init; + + return 0; + +err_ctcam_region_init: + mlxsw_sp_acl_atcam_region_fini(®ion->aregion); + return err; } static void @@ -153,6 +162,7 @@ mlxsw_sp2_acl_tcam_region_fini(struct mlxsw_sp *mlxsw_sp, void *region_priv) struct mlxsw_sp2_acl_tcam_region *region = region_priv; mlxsw_sp_acl_ctcam_region_fini(®ion->aregion.cregion); + mlxsw_sp_acl_atcam_region_fini(®ion->aregion); } static int diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c index 03f0ac646a21..037f1af1c72d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c @@ -57,42 +57,44 @@ int mlxsw_sp_acl_atcam_region_associate(struct mlxsw_sp *mlxsw_sp, return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(perar), perar_pl); } -static int mlxsw_sp_acl_atcam_region_param_init(struct mlxsw_sp *mlxsw_sp, - u16 region_id) +static void +mlxsw_sp_acl_atcam_region_type_init(struct mlxsw_sp_acl_atcam_region *aregion) { - char percr_pl[MLXSW_REG_PERCR_LEN]; + struct mlxsw_sp_acl_tcam_region *region = aregion->region; + enum mlxsw_sp_acl_atcam_region_type region_type; + unsigned int blocks_count; - mlxsw_reg_percr_pack(percr_pl, region_id); - return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(percr), percr_pl); -} - -static int -mlxsw_sp_acl_atcam_region_erp_init(struct mlxsw_sp *mlxsw_sp, - u16 region_id) -{ - char pererp_pl[MLXSW_REG_PERERP_LEN]; + /* We already know the blocks count can not exceed the maximum + * blocks count. + */ + blocks_count = mlxsw_afk_key_info_blocks_count_get(region->key_info); + if (blocks_count <= 2) + region_type = MLXSW_SP_ACL_ATCAM_REGION_TYPE_2KB; + else if (blocks_count <= 4) + region_type = MLXSW_SP_ACL_ATCAM_REGION_TYPE_4KB; + else if (blocks_count <= 8) + region_type = MLXSW_SP_ACL_ATCAM_REGION_TYPE_8KB; + else + region_type = MLXSW_SP_ACL_ATCAM_REGION_TYPE_12KB; - mlxsw_reg_pererp_pack(pererp_pl, region_id, true, true, 0, 0, 0); - return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pererp), pererp_pl); + aregion->type = region_type; } int mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_acl_atcam *atcam, + struct mlxsw_sp_acl_atcam_region *aregion, struct mlxsw_sp_acl_tcam_region *region) { - int err; + aregion->region = region; + aregion->atcam = atcam; + mlxsw_sp_acl_atcam_region_type_init(aregion); - err = mlxsw_sp_acl_atcam_region_associate(mlxsw_sp, region->id); - if (err) - return err; - err = mlxsw_sp_acl_atcam_region_param_init(mlxsw_sp, region->id); - if (err) - return err; - err = mlxsw_sp_acl_atcam_region_erp_init(mlxsw_sp, region->id); - if (err) - return err; + return mlxsw_sp_acl_erp_region_init(aregion); +} - return 0; +void mlxsw_sp_acl_atcam_region_fini(struct mlxsw_sp_acl_atcam_region *aregion) +{ + mlxsw_sp_acl_erp_region_fini(aregion); } int mlxsw_sp_acl_atcam_init(struct mlxsw_sp *mlxsw_sp, diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h index 99d44ac3acd2..51f7e2327603 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h @@ -173,7 +173,9 @@ int mlxsw_sp_acl_atcam_region_associate(struct mlxsw_sp *mlxsw_sp, u16 region_id); int mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_acl_atcam *atcam, + struct mlxsw_sp_acl_atcam_region *aregion, struct mlxsw_sp_acl_tcam_region *region); +void mlxsw_sp_acl_atcam_region_fini(struct mlxsw_sp_acl_atcam_region *aregion); int mlxsw_sp_acl_atcam_init(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_acl_atcam *atcam); void mlxsw_sp_acl_atcam_fini(struct mlxsw_sp *mlxsw_sp,