From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30089.outbound.protection.outlook.com [40.107.3.89]) by dpdk.org (Postfix) with ESMTP id 612DC4C74; Thu, 15 Nov 2018 06:50:47 +0100 (CET) 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=f9mc32IoXbXHfNy9ox59QhIlrg92mGA3C5kE9AdQ70s=; b=hQr4Yx5nHz48WstPLVxBqKYqFaglwtU/AEiGcSeFXL7SaeMM4a4SRpPo66wZeHAjKfW65srmtlSTqjeLiHUYYh2EE96OEkalDECfTV4yMa8v3vFbOOrtsjnKareNxG4vUvsO8k2oS48ipQJUtbZEMcb/6d0hlITOdGTMOOfmAJQ= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3995.eurprd05.prod.outlook.com (52.134.72.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 15 Nov 2018 05:50:46 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::58e7:97d8:f9c1:4323]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::58e7:97d8:f9c1:4323%3]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 05:50:46 +0000 From: Yongseok Koh To: Shahaf Shuler CC: Ali Alnubani , "dev@dpdk.org" , Thomas Monjalon , "stable@dpdk.org" Thread-Topic: [PATCH 2/2] net/mlx5: fix initialization of struct members Thread-Index: AQHUfBJyzgW3CTvpL0m5btlQUICqBaVQVicA Date: Thu, 15 Nov 2018 05:50:46 +0000 Message-ID: References: <20181113191039.12720-1-alialnu@mellanox.com> <20181113191039.12720-2-alialnu@mellanox.com> In-Reply-To: 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=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3995; 6:MguEAd5EjSKq3xUoTIzS05BjWd/Co5lhO6WuuxwVg/Xv05qcKbrkCjkPGbSux37GKgu9denomJ867MEOPyYy/tP6JVm7GwEJoAmouHps1JdSjlwPHreIyq2HoZJf7gh0IiuoZgzOYgFzLYmr8s2k9jkcgz86g7FSutyebrDuBFENhwnQNLElugKlolQFH3OFsn0lr8wRxCXomP9BXQalVqF1f0T7tS7QDqPCELrc2sSCDJXheZL8MHalzbgpBTJawHEQek7qcM2a7iXsFIxHJcetJnUgoZe2ORalDqKqrn4p23iS7GbFgi/fpwwFFYzojb1WfJOLm5Fxxc41X7RSdCepwB8oESWOoQFXyUMTRhbmgzqwyRzdqplcNErYEVOyluojWmrQxzQTwG8K/25EdxVgVxRc9y3PEkfhHYcv5NZgq3s+sHhRWzBBW9jW02rpaVlwOKXuIxTroCHCWrGETg==; 5:a547AmK1n7cr8Xp5TJCxVzuS6dw9WezqSwnyBEvihPPcs1WzeVND6t55h2Lu3ACl9S2+gq1sUwEGDEiotVpWZcx0IUAdX21TYP2F48BOoebUxpO7ehKaggoMQ1zb8BloCMCaCKts6chP1aFHEqAJd6aFG2mQQRL+/ZGUOVqpFMc=; 7:oAyxv716rCIeP12zObybcFIqxyjwCPf0TIA9kmsFqiamVVX8Fy9xYlExgEvY/LUVDxmYlrsgPN6DPkWa+nYRbDUxIp6ZH/rcbarnIgJngc/wsDEqgANJNa/pASuyErWZ/txJgfsvJX41xY6ktv2xHg== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 75aca943-8126-4518-b671-08d64abe49cc x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3995; x-ms-traffictypediagnostic: DB3PR0502MB3995: 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)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231415)(944501410)(52105112)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:DB3PR0502MB3995; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3995; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(39860400002)(346002)(376002)(199004)(189003)(11346002)(4326008)(186003)(99286004)(26005)(76176011)(33656002)(25786009)(45080400002)(68736007)(229853002)(478600001)(6512007)(446003)(86362001)(36756003)(575784001)(8936002)(6862004)(102836004)(6506007)(5660300001)(316002)(81166006)(53546011)(37006003)(7736002)(97736004)(2906002)(8676002)(6246003)(83716004)(486006)(256004)(14454004)(106356001)(105586002)(53936002)(71190400001)(71200400001)(82746002)(6486002)(2616005)(3846002)(2900100001)(6116002)(305945005)(66066001)(54906003)(6436002)(6636002)(81156014)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3995; H:DB3PR0502MB3980.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-microsoft-antispam-message-info: C6vL4PLBfvKCAJCgcgl5KDZuN/LDuDLhxuUpplhvIWqC90u+kbY2REfVf/FgqKWLWUMAg/KF90xlcqpnybjEp9O9b4Y+6z8+p+wHVUn3DFf18cej/koKd32LtUMvK1VqDQh+jvMmi26GnCFpMSWn8ZnnJDwCzYxOJ9v93QZ81YwqIv+EUe7SRM4rumErhl4XPgz+cvraYlgQCC3GnMH9neHJ2Dgih3lRh/kH/SFNK7fYRzRHhDvE038IALx/BT+KKA47y00If0kgG7H1Idd2nA8rvPVz8X1uLsUmIoRU7Tgu+bHHONnrv5xc+yvzO5pc8J+qw1ngilpH3kYn9hlXkhJA//iPVeaiMB7G3Ak6l0A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <4265311A7B0B084DABC5800E2EC2F9BC@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75aca943-8126-4518-b671-08d64abe49cc X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 05:50:46.1117 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3995 Subject: Re: [dpdk-dev] [PATCH 2/2] net/mlx5: fix initialization of struct members 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: Thu, 15 Nov 2018 05:50:47 -0000 > On Nov 14, 2018, at 4:06 AM, Shahaf Shuler wrote: >=20 > Adding Koh, see below=20 >=20 > Tuesday, November 13, 2018 9:11 PM, Ali Alnubani: >> Subject: [PATCH 2/2] net/mlx5: fix initialization of struct members >>=20 >> This patch fixes compilation errors with meson and the clang compiler ca= used >> by some of the struct members not being initialized. >>=20 >> ``` >> ../drivers/net/mlx5/mlx5_mr.c:345:37: error: missing field 'end' >> initializer [-Werror,-Wmissing-field-initializers] >> struct mlx5_mr_cache entry =3D { 0, }; >> ^ >> ../drivers/net/mlx5/mlx5_mr.c:389:36: error: missing field 'end' >> initializer [-Werror,-Wmissing-field-initializers] >> struct mlx5_mr_cache ret =3D { 0, }; >> ^ >> ../drivers/net/mlx5/mlx5_mr.c:691:35: error: missing field 'end' >> initializer [-Werror,-Wmissing-field-initializers] >> struct mlx5_mr_cache ret =3D { 0, }; >> ^ ``` >>=20 >> The compilation errors reproduce with >> clang version 3.4.2 (tags/RELEASE_34/dot2-final) on RHEL. >>=20 >> Fixes: e1114ff6a5ab ("net/mlx5: support e-switch flow count action") >> Fixes: db48f9db5d9f ("net/mlx5: support new flow counter API") >> Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support") >> Fixes: 65c9d24170c9 ("net/mlx5: enable loopback by configured mode") >> Fixes: 87011737b715 ("mlx5: add software counters") >> Cc: stable@dpdk.org >>=20 >> Signed-off-by: Ali Alnubani >=20 > [...] >=20 >> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c ind= ex >> f4b15d3f6..435eaeee2 100644 >> --- a/drivers/net/mlx5/mlx5_mr.c >> +++ b/drivers/net/mlx5/mlx5_mr.c >> @@ -342,8 +342,9 @@ mr_insert_dev_cache(struct rte_eth_dev *dev, >> struct mlx5_mr *mr) >> DRV_LOG(DEBUG, "port %u inserting MR(%p) to global cache", >> dev->data->port_id, (void *)mr); >> for (n =3D 0; n < mr->ms_bmp_n; ) { >> - struct mlx5_mr_cache entry =3D { 0, }; >> + struct mlx5_mr_cache entry; >>=20 >> + memset(&entry, 0, sizeof(entry)); >> /* Find a contiguous chunk and advance the index. */ >> n =3D mr_find_next_chunk(mr, &entry, n); >> if (!entry.end) >> @@ -386,8 +387,9 @@ mr_lookup_dev_list(struct rte_eth_dev *dev, struct >> mlx5_mr_cache *entry, >> if (mr->ms_n =3D=3D 0) >> continue; >> for (n =3D 0; n < mr->ms_bmp_n; ) { >> - struct mlx5_mr_cache ret =3D { 0, }; >> + struct mlx5_mr_cache ret; >>=20 >> + memset(&ret, 0, sizeof(ret)); >=20 > do you have concerns about the performance w/ this extra memset? For the three funcs modified with memset here are all slow-paths for the MR= . It is safe for performance. Thanks, Yongseok >=20 >> n =3D mr_find_next_chunk(mr, &ret, n); >> if (addr >=3D ret.start && addr < ret.end) { >> /* Found. */ >> @@ -688,8 +690,9 @@ mlx5_mr_create(struct rte_eth_dev *dev, struct >> mlx5_mr_cache *entry, >> */ >> for (n =3D 0; n < ms_n; ++n) { >> uintptr_t start; >> - struct mlx5_mr_cache ret =3D { 0, }; >> + struct mlx5_mr_cache ret; >>=20 >> + memset(&ret, 0, sizeof(ret)); >> start =3D data_re.start + n * msl->page_sz; >> /* Exclude memsegs already registered by other MRs. */ >> if (mr_lookup_dev(dev, &ret, start) =3D=3D UINT32_MAX) { diff -- >> git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index >> eef485021..b27fc4798 100644 >> --- a/drivers/net/mlx5/mlx5_rxq.c >> +++ b/drivers/net/mlx5/mlx5_rxq.c >> @@ -1782,7 +1782,7 @@ mlx5_hrxq_new(struct rte_eth_dev *dev, >> struct mlx5_ind_table_ibv *ind_tbl; >> struct ibv_qp *qp; >> #ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT >> - struct mlx5dv_qp_init_attr qp_init_attr =3D {0}; >> + struct mlx5dv_qp_init_attr qp_init_attr; >> #endif >> int err; >>=20 >> @@ -1795,6 +1795,7 @@ mlx5_hrxq_new(struct rte_eth_dev *dev, >> return NULL; >> } >> #ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT >> + memset(&qp_init_attr, 0, sizeof(qp_init_attr)); >> if (tunnel) { >> qp_init_attr.comp_mask =3D >>=20 >> MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS; >> diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats= .c >> index a14d1e491..fccb9af0d 100644 >> --- a/drivers/net/mlx5/mlx5_stats.c >> +++ b/drivers/net/mlx5/mlx5_stats.c >> @@ -354,10 +354,11 @@ int >> mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { >> struct priv *priv =3D dev->data->dev_private; >> - struct rte_eth_stats tmp =3D {0}; >> + struct rte_eth_stats tmp; >> unsigned int i; >> unsigned int idx; >>=20 >> + memset(&tmp, 0, sizeof(tmp)); >> /* Add software counters. */ >> for (i =3D 0; (i !=3D priv->rxqs_n); ++i) { >> struct mlx5_rxq_data *rxq =3D (*priv->rxqs)[i]; >> -- >> 2.11.0 >=20