From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93DB9C43381 for ; Thu, 28 Feb 2019 06:59:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 507DD218AE for ; Thu, 28 Feb 2019 06:59:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="DfJ4i5te" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731255AbfB1G7h (ORCPT ); Thu, 28 Feb 2019 01:59:37 -0500 Received: from mail-eopbgr130081.outbound.protection.outlook.com ([40.107.13.81]:53176 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731230AbfB1G7d (ORCPT ); Thu, 28 Feb 2019 01:59:33 -0500 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=PoMmIuYNIpIRIvuBvSzk6dieOUhJJwix23CpYRor248=; b=DfJ4i5teavry8Ui4JU26Ehwp67TocpksRhxDDgICcj2sSKHeeoRFWvEOsMHh5D94R1OuW2VzVDnEInpDgYZyKo/S05Eu/W0cq9yxSNZ+i/05lZHfd50fEdqlfDu0sbFmbXukCcykcjbwyY3F1N2OwFCp1h6em1rbnuuxd21EHPw= Received: from AM6PR05MB5240.eurprd05.prod.outlook.com (20.177.196.214) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.16; Thu, 28 Feb 2019 06:59:24 +0000 Received: from AM6PR05MB5240.eurprd05.prod.outlook.com ([fe80::458c:8deb:ca54:1327]) by AM6PR05MB5240.eurprd05.prod.outlook.com ([fe80::458c:8deb:ca54:1327%2]) with mapi id 15.20.1665.015; Thu, 28 Feb 2019 06:59:24 +0000 From: Ido Schimmel To: "netdev@vger.kernel.org" CC: "davem@davemloft.net" , Jiri Pirko , mlxsw , Ido Schimmel Subject: [PATCH net-next 10/14] mlxsw: spectrum_acl: Put vchunk migrate start/end code into separate functions Thread-Topic: [PATCH net-next 10/14] mlxsw: spectrum_acl: Put vchunk migrate start/end code into separate functions Thread-Index: AQHUzzMjTCY+ygHmY0iaMXSNxtt+Sg== Date: Thu, 28 Feb 2019 06:59:24 +0000 Message-ID: <20190228065850.7471-11-idosch@mellanox.com> References: <20190228065850.7471-1-idosch@mellanox.com> In-Reply-To: <20190228065850.7471-1-idosch@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR08CA0025.eurprd08.prod.outlook.com (2603:10a6:20b:c0::13) To AM6PR05MB5240.eurprd05.prod.outlook.com (2603:10a6:20b:64::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5f0ae035-5868-4dcc-b3dc-08d69d4a4575 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM6PR05MB5411; x-ms-traffictypediagnostic: AM6PR05MB5411: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1;AM6PR05MB5411;23:6lHNe7xllBeWAnZ05r9jn88O0rhM42QBheWrLUv?= =?iso-8859-1?Q?TxgFUCEL3ChpbgKJUndUtb9BomDI8kSn+BMOcfpjbaTaYqkv+437JDU7er?= =?iso-8859-1?Q?UFNqHuvMaMgTNu4n/0ksLIOBaNItpsAgnnv7vdNt5Vr3l0ZpoM8EHdh6yv?= =?iso-8859-1?Q?nbWITnv7dVWI68s0BOxhWMJNRGrUNr8/GVx9L9F/c0p78VjV1dw0vdag7u?= =?iso-8859-1?Q?4DINvOCBNtm1/Xi+BXTduddhLodSBBnE9JIIzOIwKwPto6ZZcD2dBHRsgv?= =?iso-8859-1?Q?4OWZC3NrHg1SQc5TaLfpP5QZpJ9z51snWEPN1x4ldPUDjdjYNTM0pIWsJo?= =?iso-8859-1?Q?8+ZgD32DYwZIEO92BTlVTCqRBHRjUAphzym534nu49EgmkTTetaGTnFG64?= =?iso-8859-1?Q?aRN/tq+kz91QY9eTnausweNzjyoBfpgEW/MToCl0fiQmPaNt29xAIJ4KSs?= =?iso-8859-1?Q?22qCXq6UBHKjFPMSXPHFAE1kXO5zVV7sKSf0uH9y4sZuQ/UO+MG/S/+bWI?= =?iso-8859-1?Q?UGY++4fDZ5Zuco0BQr99ramXHv5wlP/DApj2VKP4suenUwh9jk56lGrGbc?= =?iso-8859-1?Q?kB1o+K2n/6+HoZ4549r2e2ivT99/+pBJ8/zXCPQKgbJkDMutK2BgTEaoGl?= =?iso-8859-1?Q?yzKonsTj4q+jA6W2mTl9RCGNpbq5oD1vDMLMpojvCCjLuVyGLE29BzvmXk?= =?iso-8859-1?Q?3OvMguO9ILO0MHJBlQYJiakOwrGsxQJiDn+GJcFGGvtx16tbFaNgQJqINe?= =?iso-8859-1?Q?QdcBMG+kKc1tzqcFIGdXmNZWcMBf0sdRrO+/Z3c63rjIHGDVomaro3hKOV?= =?iso-8859-1?Q?Fh1RBvDHy5unZ9avO0jLFbfXCFhdewPwMqvJpBLFKFVH4EDR69xZzFUatL?= =?iso-8859-1?Q?ta5HSf+w6qnBmlvVzdkkF/UZntqxxWC95t01gm4MzBykwLtCPhYWD77Q+R?= =?iso-8859-1?Q?EGW/gq2/YFecqRYHv15+LUaXj8mDaAFXUHhwBoFMVUEX2IlBpvGZCfB2ux?= =?iso-8859-1?Q?qzcf+E/GC9DYxNKFwkP/AToyh4xsxpznDU3oJ3bgdbKBe1njoRk90v+vLi?= =?iso-8859-1?Q?8pCSJiW1HmeISAW/QnLnGxZ4d5PW4AR/n9+vM1xxwox9Px5Z5CPk9iZmWb?= =?iso-8859-1?Q?ECxsjMcYqzvBSAaqAq+2fRLx0scGDnVa1SrQ2XcGNVf5IoW8bMdNUCu3X+?= =?iso-8859-1?Q?gAXEbzw1tjTD70BSYa4F1jxZVFiuyS3cK0IkFCUAaszNY7qy+ZOTwEHgKS?= =?iso-8859-1?Q?sQVH0DKXIfeRRkMBM7Gbo+sVJfSSTfaLRh4s8IU+e2K4TAqGEEYVE12pTV?= =?iso-8859-1?Q?kFO8PZZsON0fwmQQg2AWo5WuDX19/xmtpVXYvCSj8FdiR6A3zJNqhWZn/3?= =?iso-8859-1?Q?0sTS1RIc=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0962D394D2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(366004)(39860400002)(136003)(396003)(346002)(199004)(189003)(5640700003)(6486002)(6436002)(14454004)(478600001)(2351001)(107886003)(4326008)(68736007)(25786009)(97736004)(386003)(6506007)(11346002)(446003)(2616005)(26005)(102836004)(486006)(476003)(186003)(2501003)(256004)(5660300002)(1076003)(71190400001)(71200400001)(76176011)(52116002)(8936002)(1730700003)(8676002)(81156014)(81166006)(50226002)(6916009)(99286004)(36756003)(6512007)(86362001)(6116002)(3846002)(105586002)(106356001)(54906003)(53936002)(66066001)(7736002)(316002)(305945005)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR05MB5411;H:AM6PR05MB5240.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: I5SIuLRpiqLCMAEcRDATZHnNdPlSG7TY0efkxyIvm8XygMQxIIlLpr9ma+Lc4hrK54aGxdSuFiGv//+TxyBVjkpGnHHyFRUPvkryIjhjDfUTopJRuOCqAU2BiVGsblTM2ote6+EZQBxpv02Mu1NyXGUfho485EkEAV31XD7FcMV+gu2Tw5KduZcIsqv1Bkdl3GHhLj5OAHKnYL+eYj1KTt8vNDlEjTZ/b2r0ImcgqwtSY3JjB75m8jEOEGqepGMVyDE/ML0IxQOXqIJR0UZrSL2utT1hmbPQZLlwA9MFLIoZqf8ZJGbERQ3fuwKSLVy6EesnW6hCz3pquWts0292KYfyohb2h5npCyu90/lYmNNO/MV4d2IwEzPvcwLtwPmI2DHOMWFGHQfn0yJyiwDRlkkjroS1GKZHX4qtKI8FF08= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f0ae035-5868-4dcc-b3dc-08d69d4a4575 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2019 06:59:24.1068 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko In preparations of interrupt/continue of rehash work, put the code that is done at the beginning/end of vchunk migrate function into separate functions. Signed-off-by: Jiri Pirko Signed-off-by: Ido Schimmel --- .../mellanox/mlxsw/spectrum_acl_tcam.c | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/driv= ers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c index db80b20e4a13..1f308ad4b635 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c @@ -1193,15 +1193,12 @@ mlxsw_sp_acl_tcam_ventry_migrate(struct mlxsw_sp *m= lxsw_sp, } =20 static int -mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp, - struct mlxsw_sp_acl_tcam_vchunk *vchunk, - struct mlxsw_sp_acl_tcam_region *region, - struct mlxsw_sp_acl_tcam_rehash_ctx *ctx) +mlxsw_sp_acl_tcam_vchunk_migrate_start(struct mlxsw_sp *mlxsw_sp, + struct mlxsw_sp_acl_tcam_vchunk *vchunk, + struct mlxsw_sp_acl_tcam_region *region, + struct mlxsw_sp_acl_tcam_rehash_ctx *ctx) { struct mlxsw_sp_acl_tcam_chunk *new_chunk; - struct mlxsw_sp_acl_tcam_ventry *ventry; - int err; - int err2; =20 new_chunk =3D mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, region); if (IS_ERR(new_chunk)) { @@ -1211,6 +1208,31 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp= *mlxsw_sp, } vchunk->chunk2 =3D vchunk->chunk; vchunk->chunk =3D new_chunk; + return 0; +} + +static void +mlxsw_sp_acl_tcam_vchunk_migrate_end(struct mlxsw_sp *mlxsw_sp, + struct mlxsw_sp_acl_tcam_vchunk *vchunk) +{ + mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2); + vchunk->chunk2 =3D NULL; +} + +static int +mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp, + struct mlxsw_sp_acl_tcam_vchunk *vchunk, + struct mlxsw_sp_acl_tcam_region *region, + struct mlxsw_sp_acl_tcam_rehash_ctx *ctx) +{ + struct mlxsw_sp_acl_tcam_ventry *ventry; + int err; + int err2; + + err =3D mlxsw_sp_acl_tcam_vchunk_migrate_start(mlxsw_sp, vchunk, + region, ctx); + if (err) + return err; =20 list_for_each_entry(ventry, &vchunk->ventry_list, list) { err =3D mlxsw_sp_acl_tcam_ventry_migrate(mlxsw_sp, ventry, @@ -1223,8 +1245,8 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp = *mlxsw_sp, goto rollback; } } - mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2); - vchunk->chunk2 =3D NULL; + + mlxsw_sp_acl_tcam_vchunk_migrate_end(mlxsw_sp, vchunk); return 0; =20 rollback: @@ -1243,8 +1265,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp = *mlxsw_sp, } } =20 - mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2); - vchunk->chunk2 =3D NULL; + mlxsw_sp_acl_tcam_vchunk_migrate_end(mlxsw_sp, vchunk); =20 err_rollback: return err; --=20 2.20.1