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 29E70A034F; Sun, 3 Oct 2021 22:58:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9FD4741267; Sun, 3 Oct 2021 22:58:36 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id B3E5341262 for ; Sun, 3 Oct 2021 22:58:35 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10126"; a="205363632" X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="205363632" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2021 13:58:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="542837442" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga004.fm.intel.com with ESMTP; 03 Oct 2021 13:58:34 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 3 Oct 2021 13:58:32 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sun, 3 Oct 2021 13:58:32 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Sun, 3 Oct 2021 13:58:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jgQFjr6aCz6xAc9c7Lr7fm4U11f6UYd0SXg0ViMklHWGNUGCvcVnzcguiN+jr0sdrzj4LtRZwN1hWElKfIqmvLUqQHRKgINNKT011XwpSWHAa8i2xIaQLo2Wl+F8UIPILwujjLB5nk7zbKhrSNuLm9LbPacHOp0GfSufME0M6nQSd1+zAbcDRgZ3ggCeU8UtzH0XSiwTgQISUOajsC74BQbTrs2x5gGzjqTRM2pRsqfcNWRcFI4aT5YwbpOUwhKbXe7CfgTrfnHE/2NEIPQ+vrpl1blsD8GuriFzoactWn8DnV48NMISAgbNnm/qRAWal58uls6wv+acDEIcMyeEAw== 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=8Vb9DQRnRnolNXxY5Kl/j842bSLGRx8zMa5UNEv5opI=; b=AK2Rjec069K6NTu2vs7x0mv+GkgFzycdGshnVpYvHWgu1ZhfWOPDem49yxxYU7w52vufqNc4bKpWyJ8MKd14ykWktSKcxMO20Drmk8muwxJpZvJEKNlhLuBjn36yUorLKBq1+og+9YcBBEiyMFGeG0bHueOo8raT/yuJYMvXTG663zSgUYsU2cwOaYBTfcpFFOcnStvXAYBsbZ9/SZ3WwNJ3ZjSA0PGdTVFB6s/j6UpQ3J8Sv91RBPmAtCCWTHTNMI25e9lv923j0xgbXm9kILSzNZL1Jq8R1dH+aXvlNz5zdX9Hql1vJ3DvvkowsFf9FrZD6jFZIDqk+E9Wm+Ll3g== 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=8Vb9DQRnRnolNXxY5Kl/j842bSLGRx8zMa5UNEv5opI=; b=fWUs5BlIPrrl7RbaxKuyLzbJL4IFnHvyVmog2r9+vjAPr9lYPAkbsJPHvQ0Rfe+i/XHaMY+l3Cpver3/OsTmlUsem8kvNI4DSfTJSaMVfYEOQWj5jfRa90NkgpQFQOarbzTO9VaS3xhz2bWwBB6OTLWdEF6MIywFV0MRqsCu1gg= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB3579.namprd11.prod.outlook.com (2603:10b6:5:13c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Sun, 3 Oct 2021 20:58:26 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4566.022; Sun, 3 Oct 2021 20:58:26 +0000 From: "Ananyev, Konstantin" To: Pavan Nikhilesh Bhagavatula , "dev@dpdk.org" CC: "Li, Xiaoyun" , 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" , "Wang, Haiyue" , "Daley, John" , "hyonkim@cisco.com" , "Zhang, Qi Z" , "Wang, Xiao W" , "humin29@huawei.com" , "yisen.zhuang@huawei.com" , "oulijun@huawei.com" , "Xing, Beilei" , "Wu, Jingjing" , "Yang, Qiming" , "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" , "Xia, Chenbo" , "thomas@monjalon.net" , "Yigit, Ferruh" , "mdr@ashroe.eu" , "Jayatheerthan, Jay" Thread-Topic: [dpdk-dev] [PATCH v3 3/7] ethdev: copy ethdev 'fast' API into separate structure Thread-Index: Ade3IOQzccFk59d2RbarrDJXwEjatgBdzsjA Date: Sun, 3 Oct 2021 20:58:25 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c4c89094-5d9e-4345-e271-08d986b08b7e x-ms-traffictypediagnostic: DM6PR11MB3579: 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:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 092bKFzzr/U++MYYJ0FCeVSBGhOBw8NttfKFThatu5INUFWC/q8pfu5ham5c/y7JLGC3tc5tVCZLdXPGGrsR615R7Z6Htezcf2qgyCT3wL7bIoeandAX8+qjqbg8VCGVc1XsS1sZ/VS+b480Yai0N7Yzrg5pnTotN3MOedFdWB7hNetdi7xdLjzxjRCs3l+dNA9SdVwZWaLivEMiZ/9Y9ChnUTPyi9vBTSvvKE/QXkMcCHwOrdrf8FioztbatbCCcEBk3LkL9EaygnZZQC7R8wddDAbYxyS9+S55wAzaHrQfaf8izgN3/CGHKT/oinza8pnchFw5MgDA9ExPSoXkn4mLWjJBidxluqkx/XcBMJxYVUIyRQMXuKPKKJPfojuM4RDdGjU79aDq6uFOHdOC4XpDXrGwYz+ubyMooCBr4oCuMgsK0BFubxa3hERdVhrkPlH3pYScMPS+sY6Mfu7Tgwa69c7Tj6ptqWXktWIcroHd6LLROwRz38udfr2uqDbZInc9j086putuEKmGeTwgDaVVox6H451BbOOudTUydtSmvMcCOMMrnkhf7l7l3U4vsQc/iqcWY3YWsu1uS37QrG+m+52ospmXb9Vc5XkgVdIXhHd3H2mXRvjBkgleDjKSlXFYYGKXVCnjBpzZ6SNrjxs7ErByDPxLexQ1tzYysDal3VZD+xoZFjNBeQTUmBLzif/SGgGwwava8u9RHz+MXg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66446008)(66946007)(316002)(66476007)(4326008)(66556008)(186003)(107886003)(64756008)(7406005)(7416002)(76116006)(5660300002)(86362001)(55236004)(508600001)(26005)(8676002)(38070700005)(6506007)(71200400001)(54906003)(110136005)(122000001)(7696005)(8936002)(55016002)(33656002)(52536014)(83380400001)(2906002)(9686003)(38100700002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jwG8rd4XuVbEGXnZnpeHWDDYnXkfeHAzOE4Ensa0IMTlRPK4TaVU9cy4Ujsl?= =?us-ascii?Q?wrry56FknpSdJLoaoIEOogO5kyB8JLq8So4q2eoonrbXx3ZWthmAQtSg1M2F?= =?us-ascii?Q?2CP2eSjNOvbklRjkCaYjCSmF133ZW+Xq7AQeVgSMuQFDEp7n2xG58ncvDX7H?=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PN8RoC3hNqUCIMMnygfEQV4J+?= =?us-ascii?Q?yJt/oDeLLHT+tKS4VL+eMNhNWMWAYj2IIq7K0TPoZXrIRPN/jmFD3o6TjMTM?= =?us-ascii?Q?I/DG/TW7sAYMpBTc1vFHAuCMV8rW6WYXoVSuKUcma4kvzOknSKqgxHO03OWC?= =?us-ascii?Q?FMFKPJUDn7PuectylhqzL7/Pm39ITbBTWJgdR769dMpikqiSHCAOxeOYALo2?= =?us-ascii?Q?l4L/+783iz+Kk+NyYRYc75z7Lj6mglvGap+3qHx+gbQTZpngWcGb72GCgrIB?= =?us-ascii?Q?bgtBPzEw5KP6CDynnYx/iqha?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4c89094-5d9e-4345-e271-08d986b08b7e X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2021 20:58:26.0381 (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: j25Ff6cjh9shc4RpJDNPBY6s0ATXvv/wlEK4MopaOIzHdpLYxX4GtjP1S1UrRfimx2GnzpPT73xlLLq58X/t4ayaQws199G3gGns9SvRA/k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3579 X-OriginatorOrg: intel.com 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(+) > > >=20 > >=20 > >+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); > >+ >=20 > 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. That's a very good point, have to admit - I missed that part. >=20 > One simple solution is to call ops_setup() around rte_eth_dev_attach_seco= ndary() > but if application doesn't invoke start() on Primary the ops will not be = set for it. I think rte_eth_dev_attach_secondary() wouldn't work, as majority of the PM= Ds setup fast ops function pointers after it. >From reading the code rte_eth_dev_probing_finish() seems like a good choice= - as it is always the final point in device initialization for secondary proc= ess. BTW, we also need something similar at de-init phase. rte_eth_dev_release_port() seems like a good candidate for it. =20 >=20 > > 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