From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00063.outbound.protection.outlook.com [40.107.0.63]) by dpdk.org (Postfix) with ESMTP id 729C11CF8F for ; Sun, 13 May 2018 08:05:41 +0200 (CEST) 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; bh=C0KT8if3nvXrjKHp+zuYwkKa83J754shlQCRzbG5TQU=; b=XbFiaD6fBpCMWC5po4cz49yv8T0q1x+P5qsVirhK6KOGcm+3h/VibKEX5+0J2ypx2Hpld6ssa3KkMhPUGK+rj6GNtNk2cinc+OqZK8l1OPCYbOQ1EB8yaQwfBbvE2VjDwr5V7FicuDOHtg2jKKBMVrgN9/U5r4WgKAJwmJRWxYU= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4379.eurprd05.prod.outlook.com (52.134.108.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Sun, 13 May 2018 06:05:40 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8%13]) with mapi id 15.20.0755.018; Sun, 13 May 2018 06:05:40 +0000 From: Shahaf Shuler To: Ophir Munk , "dev@dpdk.org" , "Adrien Mazarguil" CC: Thomas Monjalon , Olga Shern Thread-Topic: [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions Thread-Index: AQHT6GpHZ0jqFatHD0uphQBlrKYLvqQtLo3A Date: Sun, 13 May 2018 06:05:40 +0000 Message-ID: References: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> <1525962108-15215-2-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1525962108-15215-2-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4379; 7:V7cldh7z6Xfd41xv54lW9OKgyW62+K1futn16WCG6KQNf74HOf52P5wjvNV8a+27sX3Tt7b8fI1Hq8nhPgZvuQF6J1gkosGBczHIf/L0g2xOxWPyqZfTMamdOVrs+IJmL8C8M0tCxto9cRHWcJPaHsMJ8BqFVfxd41J2i9VX8tWnmT1Vf6SXVy2IAZetQEVQS1vOdzna7CeFuI0jFj3hWd79J/LoT8h0anfug6E7G+EzqSnKhntX8DZcnq4mdMmT x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4379; x-ms-traffictypediagnostic: DB7PR05MB4379: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr 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)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB7PR05MB4379; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4379; x-forefront-prvs: 0671F32598 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(39380400002)(39860400002)(396003)(189003)(199004)(107886003)(478600001)(229853002)(5250100002)(3280700002)(2501003)(14454004)(25786009)(8936002)(102836004)(99286004)(6246003)(7696005)(76176011)(55016002)(86362001)(486006)(66066001)(2900100001)(2906002)(3660700001)(6436002)(105586002)(9686003)(53936002)(54906003)(4326008)(3846002)(6116002)(7736002)(81166006)(81156014)(5660300001)(74316002)(110136005)(476003)(106356001)(305945005)(33656002)(446003)(11346002)(6506007)(68736007)(316002)(26005)(8676002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4379; H:DB7PR05MB4426.eurprd05.prod.outlook.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-antispam-message-info: MW418O0dD9vFGdmr8KM2PAkq2spWS8dXYgHHPD9lsZonUbrMSLBK7BHNe6ljw1tf07/JFZhsnWaNaOrGGk1pwWmCW0kEB+7KZTy6/hrdCnQ5f6XZvu9jPckN4vN2HJsekWWaHq3v8IuRjtNPmFFMAQUjhhMvEk5ewpBiaRiBSzs5PiPdnD9MEBFdDeghhnPg spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f5b622df-4475-4e5d-8272-08d5b8978e09 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5b622df-4475-4e5d-8272-08d5b8978e09 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2018 06:05:40.4259 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4379 Subject: Re: [dpdk-dev] [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 May 2018 06:05:41 -0000 Thursday, May 10, 2018 5:22 PM, Ophir Munk: > Subject: [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions >=20 > Functions mlx4_ibv_to_rss_types() and mlx4_conv_rss_types() contain > constant arrays variables which are recreated with every call to the func= tions. > By changing the arrays definitions from "const" to "static const" > these recreations can be saved. >=20 > Signed-off-by: Ophir Munk > --- > drivers/net/mlx4/mlx4_flow.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c > index baad299..6e9b81e 100644 > --- a/drivers/net/mlx4/mlx4_flow.c > +++ b/drivers/net/mlx4/mlx4_flow.c > @@ -91,7 +91,7 @@ uint64_t > mlx4_conv_rss_types(struct priv *priv, uint64_t types) { > enum { IPV4, IPV6, TCP, UDP, }; > - const uint64_t in[] =3D { > + static const uint64_t in[] =3D { > [IPV4] =3D (ETH_RSS_IPV4 | > ETH_RSS_FRAG_IPV4 | > ETH_RSS_NONFRAG_IPV4_TCP | > @@ -112,7 +112,7 @@ mlx4_conv_rss_types(struct priv *priv, uint64_t > types) > ETH_RSS_NONFRAG_IPV6_UDP | > ETH_RSS_IPV6_UDP_EX), > }; > - const uint64_t out[RTE_DIM(in)] =3D { > + static const uint64_t out[RTE_DIM(in)] =3D { Since there is another version, it is better to have this patch first with = the above fixes. > [IPV4] =3D IBV_RX_HASH_SRC_IPV4 | > IBV_RX_HASH_DST_IPV4, > [IPV6] =3D IBV_RX_HASH_SRC_IPV6 | > IBV_RX_HASH_DST_IPV6, > [TCP] =3D IBV_RX_HASH_SRC_PORT_TCP | > IBV_RX_HASH_DST_PORT_TCP, @@ -153,7 +153,7 @@ > mlx4_ibv_to_rss_types(uint64_t types) { > enum { IPV4, IPV6, IPV4_TCP, IPV6_TCP, IPV4_UDP, IPV6_UDP}; >=20 > - const uint64_t in[] =3D { > + static const uint64_t in[] =3D { And this one can be done as part of the "advertise supported RSS ..." commi= t.=20 It is better to have the fix/clean patch first, and then to introduce the n= ew code.=20 > [IPV4] =3D IPV4_IBV_HF, > [IPV6] =3D IPV6_IBV_HF, > [IPV4_TCP] =3D IPV4_IBV_HF | TCP_IBV_HF, @@ -161,7 +161,7 > @@ mlx4_ibv_to_rss_types(uint64_t types) > [IPV4_UDP] =3D IPV4_IBV_HF | UDP_IBV_HF, > [IPV6_UDP] =3D IPV6_IBV_HF | UDP_IBV_HF, > }; > - const uint64_t out[RTE_DIM(in)] =3D { > + static const uint64_t out[RTE_DIM(in)] =3D { > [IPV4] =3D IPV4_RSS_HF, > [IPV6] =3D IPV6_RSS_HF, > [IPV4_TCP] =3D IPV4_RSS_HF | IPV4_TCP_RSS_HF, > -- > 2.7.4