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 C21C1A053A; Sun, 12 Jul 2020 16:13:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 84F5B1C128; Sun, 12 Jul 2020 16:13:43 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 824BB1BED3 for ; Sun, 12 Jul 2020 16:13:41 +0200 (CEST) IronPort-SDR: CDT46P1dMJIp/CEs+9s2hY6DwCeQN/O9/4NIOJmSNLcqlsOk1pCdvINCFTt7g+X8pBN5xWF81O 47EmdFLQQy1g== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="147620905" X-IronPort-AV: E=Sophos;i="5.75,343,1589266800"; d="scan'208";a="147620905" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 07:13:40 -0700 IronPort-SDR: rmYhdGTEbph7adjgIdV5t3CeVzcaIQv7Nf3BdkN3fwHf0xancLNmZWQDhDDbRVbwmD0GjO20ha Yte3ARq7YKYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,343,1589266800"; d="scan'208";a="285122104" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 12 Jul 2020 07:13:39 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 12 Jul 2020 07:13:39 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 12 Jul 2020 07:13:39 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jul 2020 07:13:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZzdnnh2spz0yQHE77T9pS8k3DTOubLKgnzKatwgF5uZ+7qnmBNfjOwrg6bQmOfhRKfh6o+7lOhnNuq9zP7weH03zibuc4R/9bvCSWok+XeqSKx8C2SgGgAVQ3oWFUqEiT5F7IrUT7PHUQgEec1NQ/TLM1wXJaw1J1D/FmIzk9pQTt4d6dIeTTA24cLuES63VbgKp3/qU5yJivORLmqwqCpsBABRn3ozimAFrnBT1zc0n0OK8o5lD93TuIgK660r1EhULhlcXgwKPQZJY5hDHoeWmRnyiLNigeLKP4N0cz6I3vgwwulwEyesiRxd/3tg1TIlN8lxxyLJ6CZLT3kzjA== 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=6kIejeckMq8eugDNPfHpbXOG1fMYmOSTvJynizHE42g=; b=JjfM6d3FaJKE9GjDBClTO2PDMgT9g7Lhv/tFk251RR99+9b3V2uHpw8GyyC0vHZdXdHqsyWUW2rvo4QtejsGE7Qfl83ZaSpww1+paS+oCFO054K7tHtwJt3t0SSyvAHVos26upjlmcBlBHgYLa2LV3/2QdctalEdVZNz6IE0v657TSvCoxzeNQbJOFCfXv9+zS8poE6V+dSXYSbXNpiF+m84kXue6feRO7vBV7uDKWbbnTN9cXtd78mxm5M732PoItHqImtzeY3BYPpMqMchJCBdWiMPIT2UE2+Xf8V4XnsFYkYV0YURHTKHgwX2yHZ171UZkz5LgbQ06tNMuB94Bw== 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=6kIejeckMq8eugDNPfHpbXOG1fMYmOSTvJynizHE42g=; b=qNXEvOVijhmXSqbcg3zGsmmnC81dHKQ9N7MCGsbw2gwI97Sxt4dYMkP9jGmZbdGJQRAVPVlO+SHW2J4/MzRguOqsaV3BCQ0DwC2/E5FTWGr5IU4rR2PavLB9nC7jOhNINTz8chRx9lDW29cSZPzLAn7/X5vazAOGXIoMLZcf+zU= 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:37 +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:37 +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 3/5] rawdev: add private data length parameter to config fn Thread-Index: AQHWVgSc29ST0P8SOEa5crtus5NPD6kEATJg Date: Sun, 12 Jul 2020 14:13:37 +0000 Message-ID: References: <20200709152047.167730-1-bruce.richardson@intel.com> <20200709152047.167730-4-bruce.richardson@intel.com> In-Reply-To: <20200709152047.167730-4-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGI2ZmVhMzYtYWYwNC00MTQ4LWEwYjgtYzhmNDkwNmFiOGNlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiT2lxZURBMDZadXlpcVZxZUxQbFpnU0VyRVpEamVuTFZGa2F6XC9lTm9mM2E1ZjRsdE9FbDhRUFQ4UEZ1MlU1Q1UifQ== 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: c1caf039-ee4c-4d5a-a2f9-08d8266dc549 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:2150; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vTTuT4rqoBe8sdkVQX95O/1CDi6OJRY/UFmPR2je36GyHF4ilUX0XNwGJHX6J7fzKWfGtyiZ/LcndJ3U28kWM7+xi5UzQhYId+bFrILmnoYOmaqI7zBfdd9rFv/75uZfLUDziQCnIcOfAG6aG4js3PCebfB9Mmn6siXVXtsnBykHjfWO5/JQA+fe+Gt4uTrcOjPErD2fnEftoQslpijkW/w10+q+yhNa6bOPzUFtj6QoYgIkO33PMN954v1aRE1vOCgdS/ykdDGWyD2BeGdBY4+V1uX/dmplvjt/wUDO5Kv4xDZjptmxwOpmFjXOYPXzTatsKFu8FyYLfKJ4nlCNiQ== 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: 3ZDNDQ6yJQ8wmbKrMvDwQzUEKEvQJ2uniB3bLYGjpscaa5m6uYlfgMXAegz18SVROzxoHJzNpwweskEb1HyONZHfuko3tZO+d319y7Zj6dwVN2XjWoOutX+9t4WHoFnywwwtoa6m/K+N0s8FffiMeHt3cQmvFjWz4snULa3M0iNGz8tGi7vcT/Tl7vaLr+uZ7szV1ycufHbcKwPncp0Rb9ocY1PG854zZCoqdRAHWMjwdZyoedYsRfjW4AOOvz/VxJ5xl8rKRKE2PVOjEZ5wpRlcD9ZwzLW9gat3ngF7lhyp/z5BiolCVfRLQDdCbExqfsULavj9l5agtVicNmuHI8o8fHry9w34Fc64E1Bq7IOLLgYrfVqBzVrOeRjV28g0CXavzJ5Jt4uw5kCkXzgcMPBn/3faog1fmE8GVPDjYIIR15mWHES9A+JkcSfSfj7nynOx+jVxvfUyX+vIhaOffO+vdO25jRScj9oGUOKZEtPNwTk269dVQmhtlp3bMfAE 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: c1caf039-ee4c-4d5a-a2f9-08d8266dc549 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2020 14:13:37.4034 (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: dUV8O2G3eyvv/wyzwyrTFNR+Wlvbn63yZNuWtpBk/mEB3kpXV0Qg9YFn6J2VQxn0mHpJssBLekpL2AyHULeFiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3814 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 20.11 3/5] rawdev: add private data length parameter to config 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 3/5] rawdev: add private data length parameter to > config 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 structure passed to configur= e API > is of the correct type - it's just checked that it is non-NULL. Adding in= the > length of the expected structure provides a measure of typechecking, and > can also be used for ABI compatibility in future, since ABI changes invol= ving > structs almost always involve a change in size. >=20 > Signed-off-by: Bruce Richardson > --- > drivers/raw/ifpga/ifpga_rawdev.c | 3 ++- > drivers/raw/ioat/ioat_rawdev.c | 5 +++-- > drivers/raw/ioat/ioat_rawdev_test.c | 2 +- > drivers/raw/ntb/ntb.c | 6 +++++- > drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c | 7 ++++--- > drivers/raw/octeontx2_dma/otx2_dpi_test.c | 3 ++- > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 7 ++++--- > drivers/raw/octeontx2_ep/otx2_ep_test.c | 2 +- > drivers/raw/skeleton/skeleton_rawdev.c | 5 +++-- > drivers/raw/skeleton/skeleton_rawdev_test.c | 5 +++-- > examples/ioat/ioatfwd.c | 2 +- > examples/ntb/ntb_fwd.c | 2 +- > lib/librte_rawdev/rte_rawdev.c | 6 ++++-- > lib/librte_rawdev/rte_rawdev.h | 8 +++++++- > lib/librte_rawdev/rte_rawdev_pmd.h | 3 ++- > 15 files changed, 43 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/raw/ifpga/ifpga_rawdev.c > b/drivers/raw/ifpga/ifpga_rawdev.c > index 32a2b96c9..a50173264 100644 > --- a/drivers/raw/ifpga/ifpga_rawdev.c > +++ b/drivers/raw/ifpga/ifpga_rawdev.c > @@ -684,7 +684,8 @@ ifpga_rawdev_info_get(struct rte_rawdev *dev, >=20 > static int > ifpga_rawdev_configure(const struct rte_rawdev *dev, > - rte_rawdev_obj_t config) > + rte_rawdev_obj_t config, > + size_t config_size __rte_unused) > { > IFPGA_RAWDEV_PMD_FUNC_TRACE(); >=20 > diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawde= v.c > index 6a336795d..b29ff983f 100644 > --- a/drivers/raw/ioat/ioat_rawdev.c > +++ b/drivers/raw/ioat/ioat_rawdev.c > @@ -41,7 +41,8 @@ RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, > INFO); #define COMPLETION_SZ sizeof(__m128i) >=20 > static int > -ioat_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t config= ) > +ioat_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t > config, > + size_t config_size) > { > struct rte_ioat_rawdev_config *params =3D config; > struct rte_ioat_rawdev *ioat =3D dev->dev_private; @@ -51,7 +52,7 > @@ ioat_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t > config) > if (dev->started) > return -EBUSY; >=20 > - if (params =3D=3D NULL) > + if (params =3D=3D NULL || config_size !=3D sizeof(*params)) > return -EINVAL; >=20 > if (params->ring_size > 4096 || params->ring_size < 64 || diff --git > a/drivers/raw/ioat/ioat_rawdev_test.c > b/drivers/raw/ioat/ioat_rawdev_test.c > index 90f5974cd..e5b50ae9f 100644 > --- a/drivers/raw/ioat/ioat_rawdev_test.c > +++ b/drivers/raw/ioat/ioat_rawdev_test.c > @@ -165,7 +165,7 @@ ioat_rawdev_test(uint16_t dev_id) > } >=20 > p.ring_size =3D IOAT_TEST_RINGSIZE; > - if (rte_rawdev_configure(dev_id, &info) !=3D 0) { > + if (rte_rawdev_configure(dev_id, &info, sizeof(p)) !=3D 0) { > printf("Error with rte_rawdev_configure()\n"); > return -1; > } > diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index > eaeb67b74..c181094d5 100644 > --- a/drivers/raw/ntb/ntb.c > +++ b/drivers/raw/ntb/ntb.c > @@ -837,13 +837,17 @@ ntb_dev_info_get(struct rte_rawdev *dev, > rte_rawdev_obj_t dev_info, } >=20 > static int > -ntb_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t config) > +ntb_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t > config, > + size_t config_size) > { > struct ntb_dev_config *conf =3D config; > struct ntb_hw *hw =3D dev->dev_private; > uint32_t xstats_num; > int ret; >=20 > + if (conf =3D=3D NULL || config_size !=3D sizeof(*conf)) > + return -EINVAL; > + > hw->queue_pairs =3D conf->num_queues; > hw->queue_size =3D conf->queue_size; > hw->used_mw_num =3D conf->mz_num; > diff --git a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c > b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c > index e398abb75..5b496446c 100644 > --- a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c > +++ b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c > @@ -294,7 +294,8 @@ otx2_dpi_rawdev_reset(struct rte_rawdev *dev) } >=20 > static int > -otx2_dpi_rawdev_configure(const struct rte_rawdev *dev, > rte_rawdev_obj_t config) > +otx2_dpi_rawdev_configure(const struct rte_rawdev *dev, > rte_rawdev_obj_t config, > + size_t config_size) > { > struct dpi_rawdev_conf_s *conf =3D config; > struct dpi_vf_s *dpivf =3D NULL; > @@ -302,8 +303,8 @@ otx2_dpi_rawdev_configure(const struct rte_rawdev > *dev, rte_rawdev_obj_t config) > uintptr_t pool; > uint32_t gaura; >=20 > - if (conf =3D=3D NULL) { > - otx2_dpi_dbg("NULL configuration"); > + if (conf =3D=3D NULL || config_size !=3D sizeof(*conf)) { > + otx2_dpi_dbg("NULL or invalid configuration"); > return -EINVAL; > } > dpivf =3D (struct dpi_vf_s *)dev->dev_private; diff --git > a/drivers/raw/octeontx2_dma/otx2_dpi_test.c > b/drivers/raw/octeontx2_dma/otx2_dpi_test.c > index 276658af0..cec6ca91b 100644 > --- a/drivers/raw/octeontx2_dma/otx2_dpi_test.c > +++ b/drivers/raw/octeontx2_dma/otx2_dpi_test.c > @@ -182,7 +182,8 @@ test_otx2_dma_rawdev(uint16_t val) > /* Configure rawdev ports */ > conf.chunk_pool =3D dpi_create_mempool(); > rdev_info.dev_private =3D &conf; > - ret =3D rte_rawdev_configure(i, (rte_rawdev_obj_t)&rdev_info); > + ret =3D rte_rawdev_configure(i, (rte_rawdev_obj_t)&rdev_info, > + sizeof(conf)); > if (ret) { > otx2_dpi_dbg("Unable to configure DPIVF %d", i); > return -ENODEV; > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > index 0778603d5..2b78a7941 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > @@ -224,13 +224,14 @@ sdp_rawdev_close(struct rte_rawdev *dev) } >=20 > static int > -sdp_rawdev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t > config) > +sdp_rawdev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t > config, > + size_t config_size) > { > struct sdp_rawdev_info *app_info =3D (struct sdp_rawdev_info > *)config; > struct sdp_device *sdpvf; >=20 > - if (app_info =3D=3D NULL) { > - otx2_err("Application config info [NULL]"); > + if (app_info =3D=3D NULL || config_size !=3D sizeof(*app_info)) { > + otx2_err("Application config info [NULL] or incorrect size"); > return -EINVAL; > } >=20 > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c > b/drivers/raw/octeontx2_ep/otx2_ep_test.c > index 091f1827c..b876275f7 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_test.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c > @@ -108,7 +108,7 @@ sdp_rawdev_selftest(uint16_t dev_id) >=20 > dev_info.dev_private =3D &app_info; >=20 > - ret =3D rte_rawdev_configure(dev_id, &dev_info); > + ret =3D rte_rawdev_configure(dev_id, &dev_info, sizeof(app_info)); > if (ret) { > otx2_err("Unable to configure SDP_VF %d", dev_id); > rte_mempool_free(ioq_mpool); > diff --git a/drivers/raw/skeleton/skeleton_rawdev.c > b/drivers/raw/skeleton/skeleton_rawdev.c > index dce300c35..531d0450c 100644 > --- a/drivers/raw/skeleton/skeleton_rawdev.c > +++ b/drivers/raw/skeleton/skeleton_rawdev.c > @@ -68,7 +68,8 @@ static int skeleton_rawdev_info_get(struct rte_rawdev > *dev, } >=20 > static int skeleton_rawdev_configure(const struct rte_rawdev *dev, > - rte_rawdev_obj_t config) > + rte_rawdev_obj_t config, > + size_t config_size) > { > struct skeleton_rawdev *skeldev; > struct skeleton_rawdev_conf *skeldev_conf; @@ -77,7 +78,7 @@ > static int skeleton_rawdev_configure(const struct rte_rawdev *dev, >=20 > RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL); >=20 > - if (!config) { > + if (config =3D=3D NULL || config_size !=3D sizeof(*skeldev_conf)) { > SKELETON_PMD_ERR("Invalid configuration"); > return -EINVAL; > } > diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c > b/drivers/raw/skeleton/skeleton_rawdev_test.c > index 9b8390dfb..7dc7c7684 100644 > --- a/drivers/raw/skeleton/skeleton_rawdev_test.c > +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c > @@ -126,7 +126,7 @@ test_rawdev_configure(void) > struct skeleton_rawdev_conf rdev_conf_get =3D {0}; >=20 > /* Check invalid configuration */ > - ret =3D rte_rawdev_configure(test_dev_id, NULL); > + ret =3D rte_rawdev_configure(test_dev_id, NULL, 0); > RTE_TEST_ASSERT(ret =3D=3D -EINVAL, > "Null configure; Expected -EINVAL, got %d", ret); >=20 > @@ -137,7 +137,8 @@ test_rawdev_configure(void) >=20 > rdev_info.dev_private =3D &rdev_conf_set; > ret =3D rte_rawdev_configure(test_dev_id, > - (rte_rawdev_obj_t)&rdev_info); > + (rte_rawdev_obj_t)&rdev_info, > + sizeof(rdev_conf_set)); > RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure rawdev (%d)", > ret); >=20 > rdev_info.dev_private =3D &rdev_conf_get; diff --git > a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c index > 5c631da1b..8e9513e44 100644 > --- a/examples/ioat/ioatfwd.c > +++ b/examples/ioat/ioatfwd.c > @@ -734,7 +734,7 @@ configure_rawdev_queue(uint32_t dev_id) > struct rte_ioat_rawdev_config dev_config =3D { .ring_size =3D ring_size= }; > struct rte_rawdev_info info =3D { .dev_private =3D &dev_config }; >=20 > - if (rte_rawdev_configure(dev_id, &info) !=3D 0) { > + if (rte_rawdev_configure(dev_id, &info, sizeof(dev_config)) !=3D 0) { > rte_exit(EXIT_FAILURE, > "Error with rte_rawdev_configure()\n"); > } > diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index > 11e224451..656f73659 100644 > --- a/examples/ntb/ntb_fwd.c > +++ b/examples/ntb/ntb_fwd.c > @@ -1401,7 +1401,7 @@ main(int argc, char **argv) > ntb_conf.num_queues =3D num_queues; > ntb_conf.queue_size =3D nb_desc; > ntb_rawdev_conf.dev_private =3D (rte_rawdev_obj_t)(&ntb_conf); > - ret =3D rte_rawdev_configure(dev_id, &ntb_rawdev_conf); > + ret =3D rte_rawdev_configure(dev_id, &ntb_rawdev_conf, > +sizeof(ntb_conf)); > if (ret) > rte_exit(EXIT_FAILURE, "Can't config ntb dev: err=3D%d, " > "port=3D%u\n", ret, dev_id); > diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawde= v.c > index bde33763e..6c4d783cc 100644 > --- a/lib/librte_rawdev/rte_rawdev.c > +++ b/lib/librte_rawdev/rte_rawdev.c > @@ -104,7 +104,8 @@ rte_rawdev_info_get(uint16_t dev_id, struct > rte_rawdev_info *dev_info, } >=20 > int > -rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf) > +rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf, > + size_t dev_private_size) > { > struct rte_rawdev *dev; > int diag; > @@ -123,7 +124,8 @@ rte_rawdev_configure(uint16_t dev_id, struct > rte_rawdev_info *dev_conf) > } >=20 > /* Configure the device */ > - diag =3D (*dev->dev_ops->dev_configure)(dev, dev_conf- > >dev_private); > + diag =3D (*dev->dev_ops->dev_configure)(dev, dev_conf- > >dev_private, > + dev_private_size); > if (diag !=3D 0) > RTE_RDEV_ERR("dev%d dev_configure =3D %d", dev_id, diag); > else > diff --git a/lib/librte_rawdev/rte_rawdev.h > b/lib/librte_rawdev/rte_rawdev.h index cf6acfd26..73e3bd5ae 100644 > --- a/lib/librte_rawdev/rte_rawdev.h > +++ b/lib/librte_rawdev/rte_rawdev.h > @@ -116,13 +116,19 @@ rte_rawdev_info_get(uint16_t dev_id, struct > rte_rawdev_info *dev_info, > * driver/implementation can use to configure the device. It is also a= ssumed > * that once the configuration is done, a `queue_id` type field can be= used > * to refer to some arbitrary internal representation of a queue. > + * @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 > + * used by the driver, and may be checked by drivers to ensure the > expected > + * struct type is provided. > * > * @return > * - 0: Success, device configured. > * - <0: Error code returned by the driver configuration function. > */ > int > -rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf); > +rte_rawdev_configure(uint16_t dev_id, struct rte_rawdev_info *dev_conf, > + size_t dev_private_size); >=20 >=20 > /** > diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h > b/lib/librte_rawdev/rte_rawdev_pmd.h > index 89e46412a..050f8b029 100644 > --- a/lib/librte_rawdev/rte_rawdev_pmd.h > +++ b/lib/librte_rawdev/rte_rawdev_pmd.h > @@ -160,7 +160,8 @@ typedef int (*rawdev_info_get_t)(struct rte_rawdev > *dev, > * Returns 0 on success > */ > typedef int (*rawdev_configure_t)(const struct rte_rawdev *dev, > - rte_rawdev_obj_t config); > + rte_rawdev_obj_t config, > + size_t config_size); >=20 > /** > * Start a configured device. > -- > 2.25.1