From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C78EA0032; Sat, 2 Oct 2021 02:14:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E00334067E; Sat, 2 Oct 2021 02:14:58 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 116FB4067B for ; Sat, 2 Oct 2021 02:14:56 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 191DsnpL032231; Fri, 1 Oct 2021 17:14:48 -0700 Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2042.outbound.protection.outlook.com [104.47.74.42]) by mx0a-0016f401.pphosted.com with ESMTP id 3be3mmt23p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Oct 2021 17:14:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dwqMuCzuSqnQNXUEiO7J3CobhDt0t9ibRqCSlsZX2VX4HUWkwhYAsnMg5dokx7NumcIKJ2u2yZqodFgfbmBrLM6hiDsY24AsBKmhdHa6qwEOliB3C4gICGSNzcTCb6mdRhdoZ2eKRzG46H7DWzoi3y0Rq7vYbBNmJwZiTzDkDRCy6Gu0Y2uMyJe/YQoTuxM6RCKiZJUCG4UTi2gZDvgHx4HGfVsriYIfYBvRhvObCBuUXtUK6uGjezbNShilxR3jZIcptcwUf8Acn0VwJZCve/IhRFF5oPkyIKndM5iMeovl/4z/TG84CvZIS/m2jdi8WT70BQMcB3cZCDcXkDOotQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cEliIXqrVZKJuBY2IoKA7bVSOfLmAfopourjfHS3zME=; b=nno7P62XA0b8xriO4fioJGxHal7sV7Kw1fu5qgadKDhxmwie66Juva2oACb1/mF1ljGZmqrgp823LrZVAbkNsbSpMqAyzqJ7kfJtmbln3/oz8hMFa/3/NrxbNXFG2fqIqGv1h0P0yy9k0JnBCoiFgb26Ip5iDt1I5Xr9kZ4Limv+fI35fBQl++RrLfFlzitW62eYR9M99UzoxAtYiuSLRa/BnQ1z41tEZuSOn9nMxK2A2fXCev4no4ngYaEofs2Yv5cu6ivLV3aHdg9oNHlgRDxuGAfPLpW67VR3l8NKB7lDK4fSo9naKZYIGOy4+PHjfNA4w6NQpXEw+k97trSo9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cEliIXqrVZKJuBY2IoKA7bVSOfLmAfopourjfHS3zME=; b=mdRic8RJsRFT1eNUD8SASgPv7kJMNJqMqt8zznlysncUgz+u5b7iTqMEtSEDzkW+cxalqinYWlvMhv+Ea7jejPZ+jU6t3yqfn8v0ie0Lfd4DRXXKvHOd/2i9piIvO307WFqIZ0+6ia0wPLKsWBK0EtqXx81+XFFqFhc2pE6lNFk= Received: from PH0PR18MB4086.namprd18.prod.outlook.com (2603:10b6:510:3::9) by PH0PR18MB3847.namprd18.prod.outlook.com (2603:10b6:510:28::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Sat, 2 Oct 2021 00:14:46 +0000 Received: from PH0PR18MB4086.namprd18.prod.outlook.com ([fe80::94d1:2b0c:115f:5a75]) by PH0PR18MB4086.namprd18.prod.outlook.com ([fe80::94d1:2b0c:115f:5a75%7]) with mapi id 15.20.4566.019; Sat, 2 Oct 2021 00:14:46 +0000 From: Pavan Nikhilesh Bhagavatula To: Konstantin Ananyev , "dev@dpdk.org" CC: "xiaoyun.li@intel.com" , Anoob Joseph , Jerin Jacob Kollanukkaran , Nithin Kumar Dabilpuram , Ankur Dwivedi , "shepard.siegel@atomicrules.com" , "ed.czeck@atomicrules.com" , "john.miller@atomicrules.com" , Igor Russkikh , "ajit.khaparde@broadcom.com" , "somnath.kotur@broadcom.com" , "rahul.lakkireddy@chelsio.com" , "hemant.agrawal@nxp.com" , "sachin.saxena@oss.nxp.com" , "haiyue.wang@intel.com" , "johndale@cisco.com" , "hyonkim@cisco.com" , "qi.z.zhang@intel.com" , "xiao.w.wang@intel.com" , "humin29@huawei.com" , "yisen.zhuang@huawei.com" , "oulijun@huawei.com" , "beilei.xing@intel.com" , "jingjing.wu@intel.com" , "qiming.yang@intel.com" , "matan@nvidia.com" , "viacheslavo@nvidia.com" , "sthemmin@microsoft.com" , "longli@microsoft.com" , "heinrich.kuhn@corigine.com" , Kiran Kumar Kokkilagadda , "andrew.rybchenko@oktetlabs.ru" , "Maciej Czekaj [C]" , "jiawenwu@trustnetic.com" , "jianwang@trustnetic.com" , "maxime.coquelin@redhat.com" , "chenbo.xia@intel.com" , "thomas@monjalon.net" , "ferruh.yigit@intel.com" , "mdr@ashroe.eu" , "jay.jayatheerthan@intel.com" Thread-Topic: [dpdk-dev] [PATCH v3 3/7] ethdev: copy ethdev 'fast' API into separate structure Thread-Index: Ade3IOQzccFk59d2RbarrDJXwEjatg== Date: Sat, 2 Oct 2021 00:14:45 +0000 Message-ID: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d7c20d8e-2f90-4d29-0d14-08d98539a3ff x-ms-traffictypediagnostic: PH0PR18MB3847: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8knPtoeRkOPdXcjvK9S36/JbvYAbIAV7kbZfjEsIB9sMR/dgqcz7NVcfLyJ2jR16Qq409qbMK6rNE/YRzIKCm5pCgRd+mThZ5pP4z6fJkW2VgwHxPAvPE92MP3ut/q1uKLPHZvRkaELIzTwwt4YjA6CQquRaY0HfEyu1xV8v6jNkvr59JICJufuwBEwLR3ARxgtvcNqnuijjdQXkT+kdP8qtY4zjkdEmjv0Lr1OuYP3Ej6CDAxNyxUnbByC7AwgIYZO/vAMMOpjoWGxSRsO8ONXfXnaOMfhvxpB/0jTRAXBmMKUXCnN9lhfRcAFguwvptKVr8eGrlM6erxrd5tPNbCajJSY2Ic3ENe9xEGKasiEBpbNOaDvV9llm4YuTFcBO+vNbSVC5P3ve2GrBX8ZnHzlIqkA/zkmWrRnGLOqkSU2Puxm23j2odvyxiyfh9oRbBVNDlJBPXDOhQsUVKVyxZGPZ2vgn7/F6E4riSYl6MUIebiiUiU0e1/q0RM6Cu/YRTUwbdrFl7AsiyMVGghb4qsUk8KL5e1HF7yH19ZUCOAO4AkxzoQT6OcLI1lrucFv51ynlKc8ZSSYDss+5ZyVVDoIgKuwnGPgBsJrC+H6TMtMIEUJd5KMzOcCjmd+AXsL2xDRIbZNFNTTgg0qALM4R/I9F4nz1/dQ5tK661W+faOCVlTojUbbvQNtFGPoHNOE8GuJvqpZONsTbmYZ1UQAL9g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR18MB4086.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(55016002)(33656002)(54906003)(4326008)(316002)(110136005)(122000001)(38070700005)(9686003)(7416002)(71200400001)(52536014)(5660300002)(508600001)(7696005)(6506007)(26005)(83380400001)(86362001)(8676002)(76116006)(64756008)(66446008)(66946007)(66556008)(7406005)(66476007)(2906002)(8936002)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QqaMiVq4lkIugT7/n0mBG/LbSp4mqLus28QrsVThmpdaAsgIe8cUKrpt8HjL?= =?us-ascii?Q?aUUR/CDpaRmP6xjecbeWPlRchabJS28WCgf67KsdjTofTdvsEpOJdJgWYnuc?= =?us-ascii?Q?8gsAH4I+T4yaZh3lG7Wt/3RBgF4pJV6vKzxKts6kf8Tgqg77nem+UhOHSOAz?= =?us-ascii?Q?vhsxDcnJA0DAT3iVCtXY00rmB98CbR70MWTzolF6SU7nVv1+TrAlCJKHTkMH?= =?us-ascii?Q?wv9cQaK69ib0m3d3AcYtrMlm2X6tbqNsoZPDRu/TSYAJzCWp8UbH1bXvVU3T?= =?us-ascii?Q?qUKyrDlMghE8/jzSmizuOD7bZQuN/pAnqiG7QXuh+D5zzJ24P7B33jEN6Vpu?= =?us-ascii?Q?E62GH2LGtz7Ua4N64G5jQRIOMvcG0jfPezjAYPmTxD/SLeqDP6ODb4ZObXD1?= =?us-ascii?Q?xgkDb87NTppO8U259tqY8K9yEgY7/EfP9ea1IHRysScEm3BK3FchUjSR/6bP?= =?us-ascii?Q?neMtLcK2ZNLW73hcZdjXnZ3CCeaxAnNiuebLPwqJ8/RFtoycbQ3Kzxg0F/1a?= =?us-ascii?Q?Ik4fjWgruIwxpIoUoRz+hjZzg6GUbscoC+DbdJvYYTkXLrBIkOfd3aBoUUtH?= =?us-ascii?Q?G5v98cwOXymMFoma2gDO8cFsCDwgwCDuw/iJ0u56M5S88KDhBFEA/mr6gXn6?= =?us-ascii?Q?4rWXfTrB46LHNk/5RDS+C+Do+/+WiEUqn13QGSVkaWLV2hwwZ5PMVwcEvbPI?= =?us-ascii?Q?PjUTM1CJSwPBrC7Z0tmWMaMZ32iYlE6ALctwHl9UDRmRyHz4EnkmWz7BO70c?= =?us-ascii?Q?An9b0S/D4K9mfpYB4qlUXkP19mbtzQXwPeYCTl/CBF+BM9GOZq9ZA5am/sAp?= =?us-ascii?Q?KkIPF9L4CvD+mTLZkQji5l4EWhiRkimQJqE2H98QiH6AZzf//50IPxihNUTQ?= =?us-ascii?Q?bN/PpNjVte3tAmTab7Jja4QmF32IOOW2d8ylciGyRfUzq2pktVJaVJhbexdy?= =?us-ascii?Q?wJG0uZviWIIORj44XztXKfpWQs6myZLBgMl720bqRFB4J21LLTGU3HBRmHFa?= =?us-ascii?Q?BLzcaqgbcKEzz9i+3lvcWpJTB53JujP4llU6Vbm+Q8d4IBA52Nw06XNXWmJq?= =?us-ascii?Q?MQLMO83bZnhrU5sZ7WF4b0cQ3ZXUmmW0E4kwaddiphCwgwCoVeaFuaIE9zFD?= =?us-ascii?Q?687H7JieHkS80p2qrSZ1NQ00LEDINSx1dca9srx8ANNLmczarQvsgflZ8kMG?= =?us-ascii?Q?0kfGhRxioVGGPitOXaB9kl+QO+EIGTH+qlfF2M/7L/xt3X4ItqUZ7Rs4xTdW?= =?us-ascii?Q?kWwL50VyPOlhIEIYlv4F8aML5rZ0Gl1vs4mhu/kbiMv1Iux1XHqcRXyxGPx0?= =?us-ascii?Q?x3eaYDDwNH7LGdi8uB3CFWmJ?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR18MB4086.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7c20d8e-2f90-4d29-0d14-08d98539a3ff X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Oct 2021 00:14:45.7292 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: k6YcCdOC+DYAYixWtpYIWWl5KTXlxJFfbC10OejDKNS8+Q62MHlmv3X3i+GadbS63wNombbqMiMauxX7R+csRrqqcV8sepNZJTXt1mFNKt4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB3847 X-Proofpoint-GUID: rACnEtKxVpOvxk7K0yomdQsnuc2SYv92 X-Proofpoint-ORIG-GUID: rACnEtKxVpOvxk7K0yomdQsnuc2SYv92 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-01_05,2021-10-01_02,2020-04-07_01 Subject: Re: [dpdk-dev] [PATCH v3 3/7] ethdev: copy ethdev 'fast' API into separate structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" >Copy public function pointers (rx_pkt_burst(), etc.) and related >pointers to internal data from rte_eth_dev structure into a >separate flat array. That array will remain in a public header. >The intention here is to make rte_eth_dev and related structures >internal. >That should allow future possible changes to core eth_dev structures >to be transparent to the user and help to avoid ABI/API breakages. >The plan is to keep minimal part of data from rte_eth_dev public, >so we still can use inline functions for 'fast' calls >(like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown. > >Signed-off-by: Konstantin Ananyev >--- > lib/ethdev/ethdev_private.c | 52 >++++++++++++++++++++++++++++++++++++ > lib/ethdev/ethdev_private.h | 7 +++++ > lib/ethdev/rte_ethdev.c | 17 ++++++++++++ > lib/ethdev/rte_ethdev_core.h | 45 >+++++++++++++++++++++++++++++++ > 4 files changed, 121 insertions(+) > >+void >+eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo) >+{ >+ static void *dummy_data[RTE_MAX_QUEUES_PER_PORT]; >+ static const struct rte_eth_fp_ops dummy_ops =3D { >+ .rx_pkt_burst =3D dummy_eth_rx_burst, >+ .tx_pkt_burst =3D dummy_eth_tx_burst, >+ .rxq =3D {.data =3D dummy_data, .clbk =3D dummy_data,}, >+ .txq =3D {.data =3D dummy_data, .clbk =3D dummy_data,}, >+ }; >+ >+ *fpo =3D dummy_ops; >+} >+ >+void >+eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo, >+ const struct rte_eth_dev *dev) >+{ >+ fpo->rx_pkt_burst =3D dev->rx_pkt_burst; >+ fpo->tx_pkt_burst =3D dev->tx_pkt_burst; >+ fpo->tx_pkt_prepare =3D dev->tx_pkt_prepare; >+ fpo->rx_queue_count =3D dev->rx_queue_count; >+ fpo->rx_descriptor_status =3D dev->rx_descriptor_status; >+ fpo->tx_descriptor_status =3D dev->tx_descriptor_status; >+ >+ fpo->rxq.data =3D dev->data->rx_queues; >+ fpo->rxq.clbk =3D (void **)(uintptr_t)dev->post_rx_burst_cbs; >+ >+ fpo->txq.data =3D dev->data->tx_queues; >+ fpo->txq.clbk =3D (void **)(uintptr_t)dev->pre_tx_burst_cbs; >+} >diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h >index 3724429577..40333e7651 100644 >--- a/lib/ethdev/ethdev_private.h >+++ b/lib/ethdev/ethdev_private.h >@@ -26,4 +26,11 @@ eth_find_device(const struct rte_eth_dev >*_start, rte_eth_cmp_t cmp, > /* Parse devargs value for representor parameter. */ > int rte_eth_devargs_parse_representor_ports(char *str, void *data); > >+/* reset eth 'fast' API to dummy values */ >+void eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo); >+ >+/* setup eth 'fast' API to ethdev values */ >+void eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo, >+ const struct rte_eth_dev *dev); >+ > #endif /* _ETH_PRIVATE_H_ */ >diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c >index 424bc260fa..9fbb1bc3db 100644 >--- a/lib/ethdev/rte_ethdev.c >+++ b/lib/ethdev/rte_ethdev.c >@@ -44,6 +44,9 @@ > static const char *MZ_RTE_ETH_DEV_DATA =3D "rte_eth_dev_data"; > struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; > >+/* public 'fast' API */ >+struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS]; >+ > /* spinlock for eth device callbacks */ > static rte_spinlock_t eth_dev_cb_lock =3D RTE_SPINLOCK_INITIALIZER; > >@@ -1788,6 +1791,9 @@ rte_eth_dev_start(uint16_t port_id) > (*dev->dev_ops->link_update)(dev, 0); > } > >+ /* expose selection of PMD rx/tx function */ >+ eth_dev_fp_ops_setup(rte_eth_fp_ops + port_id, dev); >+ Secondary process will not set these properly I believe as it might not call start() if it does primary process ops will not be set. One simple solution is to call ops_setup() around rte_eth_dev_attach_second= ary() but if application doesn't invoke start() on Primary the ops will not be se= t for it. > rte_ethdev_trace_start(port_id); > return 0; > } >@@ -1810,6 +1816,9 @@ rte_eth_dev_stop(uint16_t port_id) > return 0; > } > >+ /* point rx/tx functions to dummy ones */ >+ eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id); >+ > dev->data->dev_started =3D 0; > ret =3D (*dev->dev_ops->dev_stop)(dev); > rte_ethdev_trace_stop(port_id, ret); >2.26.3