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 652FBA034F; Sun, 3 Oct 2021 23:11:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4570641286; Sun, 3 Oct 2021 23:11:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5EF1A4125B for ; Sun, 3 Oct 2021 23:11:13 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 193KZYd2027139; Sun, 3 Oct 2021 14:10:52 -0700 Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by mx0b-0016f401.pphosted.com with ESMTP id 3bfc9y8uwv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 03 Oct 2021 14:10:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KoVmcxk44gKrZx5mYKonuFIVKyrkrHKFshJZZwESEj+zeCqukItZUlbj7LVdVwO6HiLefwzr1WIe2yO78JUiyepFfkIh96tOVukzN+mmHRpmnalSaJ1pt3DOP91/l2n6s/s7JJXySiipRneITIN8gqbFJaUIJB9fAJIjW02tmoAr6rofN7UukubNZM9YMlhoQoDueLUaKHfSLO38owhJ7OT7BGRnY90yiT3VghIaJyy9Hbn+wl4jYH53R6ZukF6G4v2pOi0JQATmzHViFRi4wW0SsS5hV4IAmbeo6Y4IF2xPSHA5ZTlEp50gvbf4zfInXdtVJNthKZ4PVUEh8cgw8g== 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=W22u0sEhKqxrV/Qy2gG/9uC+ZJQEZL88NAFdcUrGttg=; b=DkVZLhMmvCBBl8rvnSlekD/VgYu5OGWcTh+Sd29CsYwUOu77Pp7JGYyNXniacbbwYY74gAxR5k5amE6LXU82OK2i1VyR7epD3dT+/JRYQiRlKLU8utDWABYyIRBY1c402euU6vaIZkR3gA8UTmBblveRJfvSWpdXat8hhJNNdWtXW0gLtLTArMSsaMG52L8nxhp7tHh1JD+QNLyCevButVAaiNjwXWIS4oXOFPjXKPl/ElPdNEiq+uyyrtrloGfFYk8TTQwqoIAa1CRBFwsUDClXnwhSmlGYTP89rphZEn8FTXMeIzLXiwl/n/+sBQVI01G9yBqvopy7s1KbKJAIYg== 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=W22u0sEhKqxrV/Qy2gG/9uC+ZJQEZL88NAFdcUrGttg=; b=j04YR9Cylc8e+5DCaXG0qJCGBf3/AIj5FzhAntDvmsUImAT8noZzlfXJ1isB5bZDloX+Of6q4KDXiF5XJm7ReFCXkxayloVNG0e7PIHKUJotX+fArnRgyB0APyeHE8h0auqZ9uOFWq5Oz6ZdILjHUtKvUsltzP8y4FaRzoiptbc= Received: from PH0PR18MB4086.namprd18.prod.outlook.com (2603:10b6:510:3::9) by PH0PR18MB3960.namprd18.prod.outlook.com (2603:10b6:510:28::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Sun, 3 Oct 2021 21:10:50 +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.022; Sun, 3 Oct 2021 21:10:50 +0000 From: Pavan Nikhilesh Bhagavatula To: "Ananyev, Konstantin" , "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: Ade3IOQzccFk59d2RbarrDJXwEjatgBdzsjAAACk+eA= Date: Sun, 3 Oct 2021 21:10:49 +0000 Message-ID: References: In-Reply-To: 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: 8fd8ca87-5bca-4c25-7e43-08d986b2470d x-ms-traffictypediagnostic: PH0PR18MB3960: 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: dGh+eT7h8loaq5tH/YF1gglO9q/BEfqPACk+DL03K1W6cvNoi6qOJCYcy1DWZPTXptaxeGtxmEyzfE1UJ8J2E9AgS++XI9ZfhWfNkoxm8T3eSPjIoyYO8mZlNVzgxLD6mXtXZbCie+kWauiWNU/kZcibW7gRTMgoN0mIzdHyU8dU152eI7jF9OUH2ACWCsR7qivTIzR5FGGGWLq4Geh9qnL7vsuwqknl8aPCM4Ppr5CZrLTXA3Ntp7tFCp+rvwH4RrDpveGR85OVeFjr+Vc5tLIZg1gShgT9TF8u9XgHqzW9nb4ufUb7vwTpqLKvTT8TVE1fYx9bYzeyj3SMC20jbP4URGarKQe7zATC4nsOnvqag9BjmAkvLf1TVEUEzJRRm6SGhfOjo5dimxaNPOD9zImpKHweIt+ZVNl541JSCRKaC2rE/wz5b/6dP6ef78SPPml+2yif7lAkrVZw2Rpj+XkFmRAMmf3FZOV0adCcwKwuPV9UzxQ/cvYjcPOWiJ7hx8d/9M56B8sXoETblwEhu5SwxYmlfg43h3LHCqkxPSLF8y8mDub4LW2uK/59vqLT2qOCPnnC5LTwh0rZVv6dzLksdVdo5PsPn1v8S/eCSLYr441+B7UGZBiFVmE/RwJczS1etPGi0PI/W8ADaKDYQKeUhnqchEmXsRIJES+n1OnX4roA6nOPO6z6fVXAmIN16jBhQlqeV3VpcweFNfvPC2bXugVTRLku7SWGdr+4M12Rrp0EekUNlHoHRRPdfOqLP5wROeqanElXyqDqUvQ5luMvlhjtK1sVVw1em/c2iV0= 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)(86362001)(316002)(7406005)(966005)(66946007)(76116006)(2906002)(9686003)(508600001)(5660300002)(52536014)(54906003)(66446008)(110136005)(7696005)(64756008)(55016002)(66476007)(66556008)(33656002)(186003)(8936002)(6506007)(7416002)(83380400001)(8676002)(122000001)(38100700002)(38070700005)(26005)(71200400001)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CbA/1ebULYrU+uKrTLS8p9mKjo0OqWESMiCxfQLlWs9hxmka9RJUxR2wrNqr?= =?us-ascii?Q?kVMf/rFUGaZRRdFnVDOcinlOh77jjsklYy0C3zOeB74VpQVWeiZ4/isrYyd9?= =?us-ascii?Q?v/JEucinCykK4gKR34zjOO8scQ3UPmu6pkgSj9SMb5HyV2Gdi6vX+4gRJk6j?= =?us-ascii?Q?okxV6vzD8UTI1EYvOEaW2kSizlSld7RbdJgXN4bJ3HFBZQcXyzzaM6LOxzfe?= =?us-ascii?Q?o/4iVyBxcrkYK7Wk+60KZnzItilIg/KIiX3mmRqgk0EaKQEOz1SrOtSslfwe?= =?us-ascii?Q?ltrNi054+N++ZS4nmaoQHLfkzKEo1HvQN+UiAlBhauoDmW93JoWGQkPsVanA?= =?us-ascii?Q?Gfv4TArYXl4b2TDkQFeqx7+OODPdXvXDPKx81ngE1aSmH97ML9/4PLzyU3oF?= =?us-ascii?Q?EbNob6mumPr2xDa5hXiJXSI0ccLG/9M5at40coqJ//91HtqM0mx5U7NOzkgW?= =?us-ascii?Q?FX+FkdtZfBzBcmJoPG09NNZ1aujFm23u2pX7S0B5rFQV15JXnFHWrZBvmqo7?= =?us-ascii?Q?i/EpNOaLv6YpTbCAq0k3dN0a73Nqih8ebK03j0qYtVcsBEzqXYtOMDXHp11/?= =?us-ascii?Q?PeFcOcQKlCFqJ3QILi81romqnV2i1jX3JDgiL3MykRU2pTTsDpvRHK5rQCYb?= =?us-ascii?Q?Kb7BW1ggmJ1fENEx0zC9J9EB6CZap8t6dWbGVDhCtp1hO7j+gx8eiCpWQgFA?= =?us-ascii?Q?eBBlZh1orgd80+x2e5dXD1QdQ7rcqJt4l1lwimk82MezkX70LGRNwXoAp/br?= =?us-ascii?Q?0CnGtHyOhRJ90kY3LWO+mC9PnrzkAVARAKg7iTlEx/JyZwGXCE4Gvoy8K+Cl?= =?us-ascii?Q?VWMUUv8GyHcKG/4z4oGX8JG1KsPRRznbxbyVgsybLB2GPdCezOpsK19fTqxG?= =?us-ascii?Q?j0zN3oCD6JrgKKUfBEOvf37byoWRCgN4HzYt+AXpTN5oMBtXMjibckHwJ/al?= =?us-ascii?Q?r+M+fsczjDp5eHEvMJQJ2f/qjL4eXSIbk/StKb6x+/XmEUMBJABwwhsQOc0G?= =?us-ascii?Q?t2xlOD2YsmyVVOXknrJYA2FjvOnHSqdEO/PBH22mw08ahBAtNHPsZwo7C3py?= =?us-ascii?Q?jiVDd1MxcH+URDVHMwZa9sLCgHY5SGNdCcCj+uXt+DK8HsGDgYNXRT29KYrQ?= =?us-ascii?Q?xybQ5i8DAE389XXchX4KFolF061MFI+p5SR6cBX2NMpAxo3LPeaGGrzyXj+E?= =?us-ascii?Q?ZNAYmOo30XvWKdq4CjwGb92axTCa9DmYYbEZya6tHu83so4BoawBtF24OpKR?= =?us-ascii?Q?VnRY3PcjNnb5j3/O828Zle0YE5zpD7I05yImUE9Ue7htKn55/OZ8ZzjyJJDB?= =?us-ascii?Q?iuucmzRjw566RCYPnmhg/iBS?= 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: 8fd8ca87-5bca-4c25-7e43-08d986b2470d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2021 21:10:49.9662 (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: t0r3NwXrKhW/p0Bgnc011v6yxcTTqOCc63ugYgNSteqHhlazD0HNRyCsJAjWwvUeLaO9kPq21Z03d1Hs8vnFDvldXUKmaxztlcO422B69sE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB3960 X-Proofpoint-GUID: hMBalV-mPbsNUH0vwVsDfRMAJdtqk6-7 X-Proofpoint-ORIG-GUID: hMBalV-mPbsNUH0vwVsDfRMAJdtqk6-7 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-03_10,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. > >That's a very good point, have to admit - I missed that part. > >> >> One simple solution is to call ops_setup() around >rte_eth_dev_attach_secondary() >> 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 PMDs 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 >process. Ack, make sense to me, I did a similar thing for event device in http://patches.dpdk.org/project/dpdk/patch/20211003082710.8398-4-pbhagavatu= la@marvell.com/ > >BTW, we also need something similar at de-init phase. >rte_eth_dev_release_port() seems like a good candidate for it. > Hindsight I should have added reset to rte_event_pmd_pci_remove(), I will a= dd it in next version. > >> >> > 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