From patchwork Tue Jul 17 15:36:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10529863 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 EAC7C603ED for ; Tue, 17 Jul 2018 15:41:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E98252972B for ; Tue, 17 Jul 2018 15:41:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E60A529736; Tue, 17 Jul 2018 15:41:11 +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 0863129686 for ; Tue, 17 Jul 2018 15:41:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41VPdK21w8zF3J7 for ; Wed, 18 Jul 2018 01:41:09 +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="onVQysVo"; 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="onVQysVo"; 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 41VPYS5hpqzF3Hj for ; Wed, 18 Jul 2018 01:37:48 +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=vM7QQv/UsPIWTCcB8I2ol0i61lRVg3c2+BY3WNuRdkI=; b=onVQysVo2OIuRYepfOZQc9ngR0IsgZyDCvup3E+I8vKibreGGUkNEcPZBL9lruJlK38e9r2n2ityjXiHK0bRo7GN3SvuAuFiD/V3vdiDSKbdvbCGSabH1Ti+w+DX9KaNbYqRSvRxtaFJ8rMc51UFL48KG11a3zkGSuNv9ysXzbo= 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:35 +0000 From: Ido Schimmel To: linux-internal@mellanox.com Subject: [PATCH RESEND net-next mlxsw 10/18] mlxsw: spectrum_acl: Allow encoding a partial key Date: Tue, 17 Jul 2018 18:36:49 +0300 Message-Id: <20180717153657.16324-11-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: 9771bfd1-7729-44c9-28f9-08d5ebfb38b4 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:tphGFQwADE+aSVMwEbzf8KdTNN3ZUFJqPecquE4Hbwe7rz3KOSU754GF7TzOtfCFaPiWqD/PlFkwMUa/RfzOhN4Oysma/fWtIZXKYwuYGxFfWkpErRBAJyeEx+h23o3bikT1Tz8f/RvRTF7k1pdp1o4CrCq6ZkOSlvJO2gJYe6v3lh41+H0frUfKosx267v9ETVMPxXD5kTrxBy7nlpSks1cYyYLqqhb/IkUeLc+AKEla/5bVUHMMeYnAPG5FzVe; 25:xFJ5zHMN+JLdh1Pm3nVSgvB018SbkjlgtuZaz/c7skQlSTPQUSq0u9JXEdZbEhz28zSwcbuMorvnyr6gDLK/rMTEjvGPrB7aH2XbJ+FZ8mKQ1Q3C1IsbGYqP9RUO5qpdKRcpCkbxiktEEdos+Tb64HGS08NW4BL/8tKac/u/wnz4csZ9K3sc5ajOOqyy9VrUfssE1AdAnYdPTxCx/npi4GZTgVaVmZQP5a9OL9RqUnCPA02c1VmUN4VO/IBD77KS++8jrUmvcMqGOndojfClbO3LjwWCaeIvBYwnU9eJ6GlY5lj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IrKjQAXy3oCVAekoiKZ/GyjId6cXbN4G/1Bj0166xtz4MYjZlCJS5cAserIkB9w9ussVQ== 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)(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:ZprIGCx8N4PYyRFbNy5aIvidAMj3r7p85M+Du3k?= =?us-ascii?Q?2aH7kC1hergi9SaPLf4t85+RbQYea4L93fR0kGkx90uTAmg2B31wJVFG+o9o?= =?us-ascii?Q?882DAD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wLZdtt6CYDqPMNWf4o2z4wIWd2VZDAhxxFkAa7KyEvdptMQZisy+/dzQnhCZdE3SC37jFsNdz7aQ00IYZxVpf1QfpK5nKynYUCmrsEKV/NLOmVlwDyIaBkG06RVQ/W72sTAAU2vW0K+x+VLin0O+AkW7amXUFuEodrw4znS1vnCQIx3wZhS9P9KsyB1qt6TEa+YsgZ8bnYjm5RBzAwGC+I0JzE+00Iq/yOsKC54r02x2Q+MrPxbSdkMSY2bKGwQcH28iU6LkVKdBLmaGAD1ksVFhF47/6Jc0t+z1CEw==; 5:noVAnt7FRqBXyTrAFGiM0dunu/iDrxv7wc5+KGMm//bumvQbLlcJkeFvc63s0fLhZqW0fvf8oxyuSU9Jo4Qm+tT5vakvE/aQaiJzw6t7BWNnSFOBR+4FCTafjbXNV+aH+r/RH97K4mpwa68WgJ/QaHfh/XvXdutgqFZisjwwn+Q=; 24:AcwBb49gKqhkKnvtHXi53vrDfy0ZILcOIqRgKhjaDe3/uXGQF+d0G+rH92xN5w6rWregvoG8CoX+koVncv/lXCbBo6hB5xIM5QZRfhyCMbE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2330; 7:3tih/fVJ0X2AO522K/opgp0cPZHF5Lj78PczIrzTkt5m3PJB53P8sWLOfcBMAJFtlO+8zO5KUC+81aWXyRouFcYGXfuFjqJg0I5JSqeM9sYovU3QnIQOrTs14+aY53qCEwLOIBSOU8zgembd/IRXgGCK2luC+oapVOnuJwyfH8+lGJX8cdk1YwrVu5MhQoDCK0xGwYEBSZwS6vIS/nvXhTjPSKarzgR8CnFqQIaClbPQvSK9GalVctxirvNxIWph X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2018 15:37:35.7661 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9771bfd1-7729-44c9-28f9-08d5ebfb38b4 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 When working with 12 key blocks in the A-TCAM, rules are split into two records, which constitute two lookups. The two records are linked using a "large entry key ID". The ID is assigned to key blocks 6 to 11 and resolved during the first lookup. The second lookup is performed using the ID and the remaining key blocks. Allow encoding a partial key so that it can be later used to check if an ID can be reused. Signed-off-by: Jiri Pirko Signed-off-by: Ido Schimmel --- .../ethernet/mellanox/mlxsw/core_acl_flex_keys.c | 32 ++++++++++++++++++++++ .../ethernet/mellanox/mlxsw/core_acl_flex_keys.h | 4 +++ 2 files changed, 36 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c index 5f8485c7640e..9b1b9a733f78 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c @@ -487,3 +487,35 @@ void mlxsw_afk_encode(struct mlxsw_afk *mlxsw_afk, } } EXPORT_SYMBOL(mlxsw_afk_encode); + +void mlxsw_afk_encode_range(struct mlxsw_afk *mlxsw_afk, + struct mlxsw_afk_key_info *key_info, + struct mlxsw_afk_element_values *values, + char *key, int block_start, int block_end) +{ + char block_key[MLXSW_SP_AFK_KEY_BLOCK_MAX_SIZE]; + const struct mlxsw_afk_element_inst *elinst; + enum mlxsw_afk_element element; + int block_index, i; + + for (i = 0; i < key_info->blocks_count; i++) { + if (i < block_start || i > block_end) + continue; + + memset(block_key, 0, MLXSW_SP_AFK_KEY_BLOCK_MAX_SIZE); + + mlxsw_afk_element_usage_for_each(element, &values->elusage) { + elinst = mlxsw_afk_key_info_elinst_get(key_info, + element, + &block_index); + if (!elinst || block_index != i) + continue; + + mlxsw_sp_afk_encode_one(elinst, block_key, + values->storage.key); + } + + mlxsw_afk->ops->encode_block(block_key, i, key); + } +} +EXPORT_SYMBOL(mlxsw_afk_encode_range); diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h index 2ffde915349b..369555a647e0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h @@ -260,5 +260,9 @@ void mlxsw_afk_encode(struct mlxsw_afk *mlxsw_afk, struct mlxsw_afk_key_info *key_info, struct mlxsw_afk_element_values *values, char *key, char *mask); +void mlxsw_afk_encode_range(struct mlxsw_afk *mlxsw_afk, + struct mlxsw_afk_key_info *key_info, + struct mlxsw_afk_element_values *values, + char *key, int block_start, int block_end); #endif