From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 000BAA053A; Sun, 12 Jul 2020 16:13:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4AB7C1BFBC; Sun, 12 Jul 2020 16:13:21 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id B419F1BFBA for ; Sun, 12 Jul 2020 16:13:19 +0200 (CEST) IronPort-SDR: 1WpuScQ+eu1gJHHksgQxns86JEv8dBVmLxCfXtGrTxOxI2cFssu+RR+ldy3CFF4phYJ1paqLjV tGqWZV4zpF3Q== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="128559045" X-IronPort-AV: E=Sophos;i="5.75,343,1589266800"; d="scan'208";a="128559045" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 07:13:18 -0700 IronPort-SDR: 9Hk88158aaY7aEl5TDcQifLL43/Bfayc6Lm9p218ICXwubxVtLOOXC4a1h728/kXZxg0rW7vRv mQ80HRRn7b6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,343,1589266800"; d="scan'208";a="429105286" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 12 Jul 2020 07:13:17 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jul 2020 07:13:13 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jul 2020 07:13:13 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.102) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jul 2020 07:13:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e82EJB5KkK/UmXeUrKzk0NvnZnMhC7mWDAaTNoHebbmAutckkktcrsnAlcZgxnwQl768DDsEokcp4yxu8ELtB4zrQQc62TxuDTD6bt/v3fEivQPjU20tl/hKPp+5FIX+15uqhtQ0D872pRisgG/T91MXBB90hjGwUhBxgacVWB9QCZ7uSw8EGTapaeLBKVvO03TZYgdHjcnn9jvZLUcpuSz4+Ry5cQbE8QSuTkxR6jsvEBdVl73Zb07d9N9DeBp3Hwb9PhZ/bfitbG3ZOPzT2zrOSwLsgFuNAvB7sZUBTptgPu/4d2z6IVtZ9UjsyPwhil6eObAx7Y9sknkGF+d0YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gJNvIT2xN3DU8Ot3vPp5u4xHr+OJeJTbql1hGeISx3s=; b=mv2OjhXK2UNvUPvOyttfQcHT45BgH5KfkgkkltNhoIRCQ4fvFI4/VfgC6Av3PCQ/VreyFaLNi9pcm4kwGPKxOcrsESGLk5fS4Heo1odTTWq3kleWtFp56vix+eSjrK53jOMtAT6G9e1b02cPqe5VdXhPYriVnWkFQ3q8Msb8QWGW6pUlqpdrG9qj4HyGhkf6E0Td+xrRTPnTkKVKjMmj9/OMk45XtVeQFws0yA+QRgX1qcjQgiFtTbj+ON6CShdBLKi2MOuXTN6zd8/gW5bd5KWGMfsupVPTWLkIDxBN4d6LG8MLwkTdD+j0t/MVchHitcgqsCT2Mi+Dllb0vpnEwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gJNvIT2xN3DU8Ot3vPp5u4xHr+OJeJTbql1hGeISx3s=; b=cazwOrJhNwHvtrTp/JmfyS8TkVWJAPqBDrE5iqWEzSX0tq74RBqTg6zfnPF35Nz8Wxy2xGiN/n++z021LGdMDNLuzFp1v8n/zICSVxDZd5Owq8u9tSh4nPOCCDiOXb1kkAxxIPN+kj3QFC58dUWJgj7b0/I3rkehsdCZVOKUlzM= Received: from BYAPR11MB2901.namprd11.prod.outlook.com (2603:10b6:a03:91::23) by BYAPR11MB3814.namprd11.prod.outlook.com (2603:10b6:a03:fb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Sun, 12 Jul 2020 14:13:10 +0000 Received: from BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::6552:92f9:74a5:412]) by BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::6552:92f9:74a5:412%4]) with mapi id 15.20.3174.025; Sun, 12 Jul 2020 14:13:10 +0000 From: "Xu, Rosen" To: "Richardson, Bruce" , Nipun Gupta , Hemant Agrawal CC: "dev@dpdk.org" , "Zhang, Tianfei" , "Li, Xiaoyun" , "Wu, Jingjing" , Satha Rao , Mahipal Challa , Jerin Jacob Thread-Topic: [PATCH 20.11 1/5] rawdev: add private data length parameter to info fn Thread-Index: AQHWVgSWx4jLFHDKHka2sBBGvXB4A6kEAP4A Date: Sun, 12 Jul 2020 14:13:10 +0000 Message-ID: References: <20200709152047.167730-1-bruce.richardson@intel.com> <20200709152047.167730-2-bruce.richardson@intel.com> In-Reply-To: <20200709152047.167730-2-bruce.richardson@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWFlMmI1MGQtMjk5ZC00MmQ5LTgzYjgtOWY4ZmI3YzE3YTU5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidXM1RzBsd0ZFbnh6Y0ZUR2RWSEhTcUMwbzNjSHR3K2Y3bzBKSlROaWJEQ3p5MjVrUTNONFJxR2dmTzJOMHI3MSJ9 x-ctpclassification: CTP_NT authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.202] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bb715c89-bfef-4ca1-1c87-08d8266db519 x-ms-traffictypediagnostic: BYAPR11MB3814: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2043; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xENlBtpU4atI7haUr+OJQ2kkW/Hb+v4tOoUQF4YOFsJ8M2TeqxEWZr0I98kE0BN0b9WG5OwH8LhO4qpKiGppQaweu4hp9cyAEbelso/ryPucuDPY2QEazO0+5vlNpz1zmmo533J0dSk7YSkNNkeZjWGRBYc0y/+iGkmDB4D5jSNuhuLNMs/cs5uCwSSIWwfG3iTdPjh93G8K6Xr8jR0LQDjZp7shTxme3BD5RRAt6+RKMUkqBe9L/TFnSE6n6R128I9yTboc4/VGxG6Eh/j+UuIYxa9MuXntZlJCbggYnVF/hGDobshphGO7fYRd6I1QByr2vputoiGFGQv1F+lIPg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB2901.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(376002)(396003)(39860400002)(136003)(9686003)(26005)(66946007)(478600001)(54906003)(86362001)(76116006)(30864003)(2906002)(53546011)(66476007)(6506007)(66556008)(66446008)(186003)(64756008)(110136005)(52536014)(5660300002)(71200400001)(7696005)(4326008)(8676002)(55016002)(33656002)(316002)(83380400001)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: dlMdj6jIbl0m5p9q+1nUi4kceh8Bqs+k3HBDFmteD3flZYW0M0LVtBgRnfbGW0lMYOFmRWlRXl+Wgzuw+8pac/2lzAOaU0q/uN89lnqoI/kvwopVdJohNem6ki1GFgfptOqPX/Fwr+6+Sz5flkcQLUypz3SIwpOlA08sW7z8JNnvIfYJGELAQr5hAYk8S8b+Yo5tL248CWh3CIpGVrU15zPg1q4ev3NijZqwe16LJQhkUag+x9I35RULuUbwa6UqKpruyNSlLzgNJhqo4m70bR2aPDRF2bqNhBJojrdnkZ/elCScsekwBAh2ia4EZ1HqQIieZXJLBKc0sXosRHocwQiVKci5xMO+FGdOFwJkpvWHgP3EQQ7E3oifvTDI46ZJsj7SFxSvCcBn9MNotkP7MztJvJz3/R5rnDNSUc4Mf/swjPZ7AhXpTCGAJEr9j6+ViQt5CFHSKv7S3TZGib3+ufFwWh7qMEYuxyT+PlQ0EwEUBr9ZiFu02pojUpTOE/Cy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB2901.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb715c89-bfef-4ca1-1c87-08d8266db519 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2020 14:13:10.0579 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AQvdTDh0rGRCepx7lF5jXPZH/lQQ2b3GPj5J3BZLpsOpMg0cRSCTnOc88XNUmkpFzmNMibR1sljIvxksMNUYTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3814 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 20.11 1/5] rawdev: add private data length parameter to info fn 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, Reviewed-by: Rosen Xu > -----Original Message----- > From: Richardson, Bruce > Sent: Thursday, July 09, 2020 23:21 > To: Nipun Gupta ; Hemant Agrawal > > Cc: dev@dpdk.org; Xu, Rosen ; Zhang, Tianfei > ; Li, Xiaoyun ; Wu, Jingji= ng > ; Satha Rao ; Mahipal > Challa ; Jerin Jacob ; > Richardson, Bruce > Subject: [PATCH 20.11 1/5] rawdev: add private data length parameter to i= nfo > fn >=20 > Currently with the rawdev API there is no way to check that the structure > passed in via the dev_private pointer in the dev_info structure is of the > correct type - it's just checked that it is non-NULL. Adding in the lengt= h of the > expected structure provides a measure of typechecking, and can also be > used for ABI compatibility in future, since ABI changes involving structs > almost always involve a change in size. >=20 > Signed-off-by: Bruce Richardson > --- > drivers/bus/ifpga/ifpga_bus.c | 2 +- > drivers/raw/ifpga/ifpga_rawdev.c | 5 +++-- > drivers/raw/ioat/ioat_rawdev.c | 5 +++-- > drivers/raw/ioat/ioat_rawdev_test.c | 4 ++-- > drivers/raw/ntb/ntb.c | 8 +++++++- > drivers/raw/skeleton/skeleton_rawdev.c | 5 +++-- > drivers/raw/skeleton/skeleton_rawdev_test.c | 19 ++++++++++++------- > examples/ioat/ioatfwd.c | 2 +- > examples/ntb/ntb_fwd.c | 2 +- > lib/librte_rawdev/rte_rawdev.c | 6 ++++-- > lib/librte_rawdev/rte_rawdev.h | 9 ++++++++- > lib/librte_rawdev/rte_rawdev_pmd.h | 5 ++++- > 12 files changed, 49 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.= c > index 6b16a20bb..bb8b3dcfb 100644 > --- a/drivers/bus/ifpga/ifpga_bus.c > +++ b/drivers/bus/ifpga/ifpga_bus.c > @@ -162,7 +162,7 @@ ifpga_scan_one(struct rte_rawdev *rawdev, > afu_dev->id.port =3D afu_pr_conf.afu_id.port; >=20 > if (rawdev->dev_ops && rawdev->dev_ops->dev_info_get) > - rawdev->dev_ops->dev_info_get(rawdev, afu_dev); > + rawdev->dev_ops->dev_info_get(rawdev, afu_dev, > sizeof(*afu_dev)); >=20 > if (rawdev->dev_ops && > rawdev->dev_ops->dev_start && > diff --git a/drivers/raw/ifpga/ifpga_rawdev.c > b/drivers/raw/ifpga/ifpga_rawdev.c > index cc25c662b..47cfa3877 100644 > --- a/drivers/raw/ifpga/ifpga_rawdev.c > +++ b/drivers/raw/ifpga/ifpga_rawdev.c > @@ -605,7 +605,8 @@ ifpga_fill_afu_dev(struct opae_accelerator *acc, >=20 > static void > ifpga_rawdev_info_get(struct rte_rawdev *dev, > - rte_rawdev_obj_t dev_info) > + rte_rawdev_obj_t dev_info, > + size_t dev_info_size) > { > struct opae_adapter *adapter; > struct opae_accelerator *acc; > @@ -617,7 +618,7 @@ ifpga_rawdev_info_get(struct rte_rawdev *dev, >=20 > IFPGA_RAWDEV_PMD_FUNC_TRACE(); >=20 > - if (!dev_info) { > + if (!dev_info || dev_info_size !=3D sizeof(*afu_dev)) { > IFPGA_RAWDEV_PMD_ERR("Invalid request"); > return; > } > diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawde= v.c > index f876ffc3f..8dd856c55 100644 > --- a/drivers/raw/ioat/ioat_rawdev.c > +++ b/drivers/raw/ioat/ioat_rawdev.c > @@ -113,12 +113,13 @@ ioat_dev_stop(struct rte_rawdev *dev) } >=20 > static void > -ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) > +ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info, > + size_t dev_info_size) > { > struct rte_ioat_rawdev_config *cfg =3D dev_info; > struct rte_ioat_rawdev *ioat =3D dev->dev_private; >=20 > - if (cfg !=3D NULL) > + if (cfg !=3D NULL && dev_info_size =3D=3D sizeof(*cfg)) > cfg->ring_size =3D ioat->ring_size; > } >=20 > diff --git a/drivers/raw/ioat/ioat_rawdev_test.c > b/drivers/raw/ioat/ioat_rawdev_test.c > index d99f1bd6b..90f5974cd 100644 > --- a/drivers/raw/ioat/ioat_rawdev_test.c > +++ b/drivers/raw/ioat/ioat_rawdev_test.c > @@ -157,7 +157,7 @@ ioat_rawdev_test(uint16_t dev_id) > return TEST_SKIPPED; > } >=20 > - rte_rawdev_info_get(dev_id, &info); > + rte_rawdev_info_get(dev_id, &info, sizeof(p)); > if (p.ring_size !=3D expected_ring_size[dev_id]) { > printf("Error, initial ring size is not as expected (Actual: %d, > Expected: %d)\n", > (int)p.ring_size, expected_ring_size[dev_id]); > @@ -169,7 +169,7 @@ ioat_rawdev_test(uint16_t dev_id) > printf("Error with rte_rawdev_configure()\n"); > return -1; > } > - rte_rawdev_info_get(dev_id, &info); > + rte_rawdev_info_get(dev_id, &info, sizeof(p)); > if (p.ring_size !=3D IOAT_TEST_RINGSIZE) { > printf("Error, ring size is not %d (%d)\n", > IOAT_TEST_RINGSIZE, (int)p.ring_size); diff -- > git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index > e40412bb7..4676c6f8f 100644 > --- a/drivers/raw/ntb/ntb.c > +++ b/drivers/raw/ntb/ntb.c > @@ -801,11 +801,17 @@ ntb_dequeue_bufs(struct rte_rawdev *dev, } >=20 > static void > -ntb_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) > +ntb_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info, > + size_t dev_info_size) > { > struct ntb_hw *hw =3D dev->dev_private; > struct ntb_dev_info *info =3D dev_info; >=20 > + if (dev_info_size !=3D sizeof(*info)){ > + NTB_LOG(ERR, "Invalid size parameter to %s", __func__); > + return; > + } > + > info->mw_cnt =3D hw->mw_cnt; > info->mw_size =3D hw->mw_size; >=20 > diff --git a/drivers/raw/skeleton/skeleton_rawdev.c > b/drivers/raw/skeleton/skeleton_rawdev.c > index 72ece887a..dc05f3ecf 100644 > --- a/drivers/raw/skeleton/skeleton_rawdev.c > +++ b/drivers/raw/skeleton/skeleton_rawdev.c > @@ -42,14 +42,15 @@ static struct queue_buffers > queue_buf[SKELETON_MAX_QUEUES] =3D {}; static void clear_queue_bufs(int > queue_id); >=20 > static void skeleton_rawdev_info_get(struct rte_rawdev *dev, > - rte_rawdev_obj_t dev_info) > + rte_rawdev_obj_t dev_info, > + size_t dev_info_size) > { > struct skeleton_rawdev *skeldev; > struct skeleton_rawdev_conf *skeldev_conf; >=20 > SKELETON_PMD_FUNC_TRACE(); >=20 > - if (!dev_info) { > + if (!dev_info || dev_info_size !=3D sizeof(*skeldev_conf)) { > SKELETON_PMD_ERR("Invalid request"); > return; > } > diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c > b/drivers/raw/skeleton/skeleton_rawdev_test.c > index 9ecfdee81..9b8390dfb 100644 > --- a/drivers/raw/skeleton/skeleton_rawdev_test.c > +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c > @@ -106,12 +106,12 @@ test_rawdev_info_get(void) > struct rte_rawdev_info rdev_info =3D {0}; > struct skeleton_rawdev_conf skel_conf =3D {0}; >=20 > - ret =3D rte_rawdev_info_get(test_dev_id, NULL); > + ret =3D rte_rawdev_info_get(test_dev_id, NULL, 0); > RTE_TEST_ASSERT(ret =3D=3D -EINVAL, "Expected -EINVAL, %d", ret); >=20 > rdev_info.dev_private =3D &skel_conf; >=20 > - ret =3D rte_rawdev_info_get(test_dev_id, &rdev_info); > + ret =3D rte_rawdev_info_get(test_dev_id, &rdev_info, > sizeof(skel_conf)); > RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get raw dev info"); >=20 > return TEST_SUCCESS; > @@ -142,7 +142,8 @@ test_rawdev_configure(void) >=20 > rdev_info.dev_private =3D &rdev_conf_get; > ret =3D rte_rawdev_info_get(test_dev_id, > - (rte_rawdev_obj_t)&rdev_info); > + (rte_rawdev_obj_t)&rdev_info, > + sizeof(rdev_conf_get)); > RTE_TEST_ASSERT_SUCCESS(ret, > "Failed to obtain rawdev configuration (%d)", > ret); > @@ -170,7 +171,8 @@ test_rawdev_queue_default_conf_get(void) > /* Get the current configuration */ > rdev_info.dev_private =3D &rdev_conf_get; > ret =3D rte_rawdev_info_get(test_dev_id, > - (rte_rawdev_obj_t)&rdev_info); > + (rte_rawdev_obj_t)&rdev_info, > + sizeof(rdev_conf_get)); > RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain rawdev > configuration (%d)", > ret); >=20 > @@ -218,7 +220,8 @@ test_rawdev_queue_setup(void) > /* Get the current configuration */ > rdev_info.dev_private =3D &rdev_conf_get; > ret =3D rte_rawdev_info_get(test_dev_id, > - (rte_rawdev_obj_t)&rdev_info); > + (rte_rawdev_obj_t)&rdev_info, > + sizeof(rdev_conf_get)); > RTE_TEST_ASSERT_SUCCESS(ret, > "Failed to obtain rawdev configuration (%d)", > ret); > @@ -327,7 +330,8 @@ test_rawdev_start_stop(void) > dummy_firmware =3D NULL; >=20 > rte_rawdev_start(test_dev_id); > - ret =3D rte_rawdev_info_get(test_dev_id, > (rte_rawdev_obj_t)&rdev_info); > + ret =3D rte_rawdev_info_get(test_dev_id, > (rte_rawdev_obj_t)&rdev_info, > + sizeof(rdev_conf_get)); > RTE_TEST_ASSERT_SUCCESS(ret, > "Failed to obtain rawdev configuration (%d)", > ret); > @@ -336,7 +340,8 @@ test_rawdev_start_stop(void) > rdev_conf_get.device_state); >=20 > rte_rawdev_stop(test_dev_id); > - ret =3D rte_rawdev_info_get(test_dev_id, > (rte_rawdev_obj_t)&rdev_info); > + ret =3D rte_rawdev_info_get(test_dev_id, > (rte_rawdev_obj_t)&rdev_info, > + sizeof(rdev_conf_get)); > RTE_TEST_ASSERT_SUCCESS(ret, > "Failed to obtain rawdev configuration (%d)", > ret); > diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c index > b66ee73bc..5c631da1b 100644 > --- a/examples/ioat/ioatfwd.c > +++ b/examples/ioat/ioatfwd.c > @@ -757,7 +757,7 @@ assign_rawdevs(void) > do { > if (rdev_id =3D=3D rte_rawdev_count()) > goto end; > - rte_rawdev_info_get(rdev_id++, > &rdev_info); > + rte_rawdev_info_get(rdev_id++, &rdev_info, > 0); > } while (rdev_info.driver_name =3D=3D NULL || > strcmp(rdev_info.driver_name, >=20 > IOAT_PMD_RAWDEV_NAME_STR) !=3D 0); > diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index > eba8ebf9f..11e224451 100644 > --- a/examples/ntb/ntb_fwd.c > +++ b/examples/ntb/ntb_fwd.c > @@ -1389,7 +1389,7 @@ main(int argc, char **argv) > rte_rawdev_set_attr(dev_id, NTB_QUEUE_NUM_NAME, > num_queues); > printf("Set queue number as %u.\n", num_queues); > ntb_rawdev_info.dev_private =3D (rte_rawdev_obj_t)(&ntb_info); > - rte_rawdev_info_get(dev_id, &ntb_rawdev_info); > + rte_rawdev_info_get(dev_id, &ntb_rawdev_info, sizeof(ntb_info)); >=20 > nb_mbuf =3D nb_desc * num_queues * 2 * 2 + rte_lcore_count() * > MEMPOOL_CACHE_SIZE; > diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawde= v.c > index 8f84d0b22..a57689035 100644 > --- a/lib/librte_rawdev/rte_rawdev.c > +++ b/lib/librte_rawdev/rte_rawdev.c > @@ -78,7 +78,8 @@ rte_rawdev_socket_id(uint16_t dev_id) } >=20 > int > -rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info) > +rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info, > + size_t dev_private_size) > { > struct rte_rawdev *rawdev; >=20 > @@ -89,7 +90,8 @@ rte_rawdev_info_get(uint16_t dev_id, struct > rte_rawdev_info *dev_info) >=20 > if (dev_info->dev_private !=3D NULL) { > RTE_FUNC_PTR_OR_ERR_RET(*rawdev->dev_ops- > >dev_info_get, -ENOTSUP); > - (*rawdev->dev_ops->dev_info_get)(rawdev, dev_info- > >dev_private); > + (*rawdev->dev_ops->dev_info_get)(rawdev, dev_info- > >dev_private, > + dev_private_size); > } >=20 > dev_info->driver_name =3D rawdev->driver_name; diff --git > a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index > 32f6b8bb0..cf6acfd26 100644 > --- a/lib/librte_rawdev/rte_rawdev.h > +++ b/lib/librte_rawdev/rte_rawdev.h > @@ -82,13 +82,20 @@ struct rte_rawdev_info; > * will be returned. This can be used to safely query the type of a ra= wdev > * instance without needing to know the size of the private data to re= turn. > * > + * @param dev_private_size > + * The length of the memory space pointed to by dev_private in dev_inf= o. > + * This should be set to the size of the expected private structure to= be > + * returned, and may be checked by drivers to ensure the expected stru= ct > + * type is provided. > + * > * @return > * - 0: Success, driver updates the contextual information of the raw = device > * - <0: Error code returned by the driver info get function. > * > */ > int > -rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info); > +rte_rawdev_info_get(uint16_t dev_id, struct rte_rawdev_info *dev_info, > + size_t dev_private_size); >=20 > /** > * Configure a raw device. > diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h > b/lib/librte_rawdev/rte_rawdev_pmd.h > index 4395a2182..0e72a9205 100644 > --- a/lib/librte_rawdev/rte_rawdev_pmd.h > +++ b/lib/librte_rawdev/rte_rawdev_pmd.h > @@ -138,12 +138,15 @@ rte_rawdev_pmd_is_valid_dev(uint8_t dev_id) > * Raw device pointer > * @param dev_info > * Raw device information structure > + * @param dev_private_size > + * The size of the structure pointed to by dev_info->dev_private > * > * @return > * Returns 0 on success > */ > typedef void (*rawdev_info_get_t)(struct rte_rawdev *dev, > - rte_rawdev_obj_t dev_info); > + rte_rawdev_obj_t dev_info, > + size_t dev_private_size); >=20 > /** > * Configure a device. > -- > 2.25.1