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 5D40E42C5E; Thu, 8 Jun 2023 15:39:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C18F410D3; Thu, 8 Jun 2023 15:39:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7C6A0410D3 for ; Thu, 8 Jun 2023 15:39:09 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3587rmKb023830; Thu, 8 Jun 2023 06:39:08 -0700 Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2043.outbound.protection.outlook.com [104.47.73.43]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r329c2xxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jun 2023 06:39:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nuH+8YdIGTk9Te9gl97HXRpWCHc8UKZcMKrfAQtqrQR49YpxHbYOF2utx5bPE3YuJbz4SAQ4iLgm8rBMVDWEH0mAJZN1ZfyFwmJBugLGk0etQTuLa6IA345sspic31UempqV4mWpfZJaWWir/JZ94sijfPDQftnMj5F7AR4Zgu48/akY7sAYu/1YQQ8vjd3DsouNFlaJ6f/xp3BmcwQuAi0kMs/uSGkx4tpah4/oJ+zgYdA9YUlyl8X12Gm22/gdONbTx4OeIw7Ha32eCh6XCUH98S0BjLpeWlwhci3ucTV3bK6DKa4Ny09tVlCq0VnSDosMaQLByprjZKbSjHmRrA== 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=VnMkhPE74U//ynmhvePdFoppGKv30qEcvizr5GuOgT0=; b=IrYvVzfXLVFabO1X7qCahpp9QgILzRVFxy8IVBKiAIiUNCyN5d5yPLXqVY6MVbITjZ2V0onyscDlgszXgFobXiIzmvbb0eMfELaDQmtbMCK6YTb67tL460Seo6W0SJ2q1pA3bcHO4chcR/5B8z3hij7Eq+oOr2j/YFiExQqxYxseteHeMEZAk5rp6JS+Uoi+dGvG5WK/cx2uCj1lMaqdPK7j/FB5dLZ3SjFjyI20OjiKztqKnkOZvlSJ4fJ637LZk911V8c1XT2WQ5QtR0uUJyg6i2PvBcWOuOXuZubmlfIydgkYC4/nUrZAHnHQNbfXqSXP8FSCo9rR6eoRSIWPrg== 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=VnMkhPE74U//ynmhvePdFoppGKv30qEcvizr5GuOgT0=; b=UtSp/dokGyfjs+HyfmiFyqsuUTYH8enl8PVwLCnLa8i126jr7ez9SGuO7SJ77Xq8jFHOvFGvJMjS/+6qSZwDEW2jvo0QhQTYZm4SokhRFi8EDWP+yaeLTHyyzQzzdwlTtclJ+ihcYaDL9t0nQw5lm7wU4+ltms5AcoxMcisrEjc= Received: from PH0PR18MB4086.namprd18.prod.outlook.com (2603:10b6:510:3::9) by PH0PR18MB5002.namprd18.prod.outlook.com (2603:10b6:510:11d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Thu, 8 Jun 2023 13:39:03 +0000 Received: from PH0PR18MB4086.namprd18.prod.outlook.com ([fe80::600f:e50f:8159:d89]) by PH0PR18MB4086.namprd18.prod.outlook.com ([fe80::600f:e50f:8159:d89%6]) with mapi id 15.20.6455.030; Thu, 8 Jun 2023 13:39:03 +0000 From: Pavan Nikhilesh Bhagavatula To: Zhirun Yan , "dev@dpdk.org" , Jerin Jacob Kollanukkaran , Kiran Kumar Kokkilagadda , Nithin Kumar Dabilpuram , "stephen@networkplumber.org" , "jerinjacobk@gmail.com" CC: "cunming.liang@intel.com" , "haiyue.wang@intel.com" , "mattias.ronnblom@ericsson.com" Subject: RE: [EXT] [PATCH v10 10/16] graph: introduce stream moving cross cores Thread-Topic: [EXT] [PATCH v10 10/16] graph: introduce stream moving cross cores Thread-Index: AQHZmfDHRPGo9Y24wkK9zg6/j5WFCa+A6T4Q Date: Thu, 8 Jun 2023 13:39:03 +0000 Message-ID: References: <20230607035144.1214492-1-zhirun.yan@intel.com> <20230608095759.1800617-1-zhirun.yan@intel.com> <20230608095759.1800617-11-zhirun.yan@intel.com> In-Reply-To: <20230608095759.1800617-11-zhirun.yan@intel.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNccGJoYWdhdmF0dWxhXGFwcGRhdGFccm9hbWluZ1wwOWQ4NDliNi0zMmQzLTRhNDAtODVlZS02Yjg0YmEyOWUzNWJcbXNnc1xtc2ctZDM3YzZmMzgtMDYwMS0xMWVlLWI2Y2UtNGMwMzRmNWZhYTMyXGFtZS10ZXN0XGQzN2M2ZjNhLTA2MDEtMTFlZS1iNmNlLTRjMDM0ZjVmYWEzMmJvZHkudHh0IiBzej0iMTI2MTciIHQ9IjEzMzMwNzA1MTQxODE2MjExNCIgaD0iVnFVOG5pUUFyU29MSVdlV1I0YmxGN3pkaklrPSIgaWQ9IiIgYmw9IjAiIGJvPSIxIiBjaT0iY0FBQUFFUkhVMVJTUlVGTkNnVUFBSEFBQUFEQ2s5V1ZEcHJaQWQvb3Q1RDE3aFhnMytpM2tQWHVGZUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUVBQUFFQkFBQUFSL3hYaGdDQUFRQUFBQUFBQUFBQUFBPT0iLz48L21ldGE+ x-dg-rorf: true x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR18MB4086:EE_|PH0PR18MB5002:EE_ x-ms-office365-filtering-correlation-id: a71f7a39-e3d6-4a34-8069-08db6825b956 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8nRPXIBjsL5/rs66PVZrRC/5L8zzrV6u2s7edz52pabOABrfR2JSjuffK44P+xThNBlvNye7DqcEAYmRXA1njMPDMJekVHAFD/i44uz8BvROjDAhCo+7D1ivMn3Sp9P+vFXQH5f9bUTvOmOVQjiGf6F9KdIJOdN2tFqSdaPs8H4F/UufPbEoa4OBywVJDR+bKVZjLguVwtQ5qVHw4g1TQRQ/vuEyZZRqjuimojRE2MGOKOdCw4xmXjxY2ejFpzTkxoXRz9zE8v5RtGPRe4FOCpjRxwYIjEzdVg8iJeIy89EcbfNFQ6KArcU5xvekI2TzYrlrsamtwFszIgDDk8QaLN6qXmwPf+oK6C4e2/pArVXhrvYdFoGOv23Gbe4HWgCE4oX4HVHX1C8QFELaDx4hM+3mxDsujTRfO7py5t9ekYuF+s+bzZkUVrNi37F5SXxale7gIy4zPhf8ZZEtbdf+q/YWEn+7nISSMe2v3B2M/UvRku6uOvgAlbWeyAb1h8bvVu7z2NChjk/QJdkQgCcXee/cuoFLyYXcL2NdIU56J0jQXe07X+T8sJmadImv+2d99diL5HCVNFBIP1PDGZhvJj5eUWBzAK63pKFN/srxvpLBlAe8D+j22WNyffS0PQn7 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:(13230028)(4636009)(396003)(346002)(376002)(366004)(39860400002)(136003)(451199021)(8676002)(8936002)(66556008)(66476007)(66446008)(64756008)(76116006)(4326008)(66946007)(110136005)(316002)(5660300002)(41300700001)(54906003)(52536014)(55016003)(2906002)(30864003)(478600001)(38100700002)(122000001)(9686003)(6506007)(86362001)(26005)(186003)(71200400001)(7696005)(83380400001)(38070700005)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?sCUJZhdPZxC+oxTpDULZPiLq131wIDecIHGZlGVO6xnU8Zn9eIOo06pk4moJ?= =?us-ascii?Q?B5yb37RSxl9liwF8sj+5OzTofZAAnjFtPcNieNWFJ1+SqZNHZ+Ulgy6h8HHl?= =?us-ascii?Q?xRTb62yPBM+swn/GHch1vR5l68QXnIf6s7wHwQ5CizJfUp8onJP2DSa6nVNo?= =?us-ascii?Q?o3urE+0H5HHS6JuuIdDvlnvsNrfocGLraRhC4FdPEgIEF4zzHZsloW8fYDdW?= =?us-ascii?Q?lGzbSrKysMv+gS2SzSjJLjoqlFP3a2eL+8zhBnOS1g6oOyOnloBQr1kKeq1W?= =?us-ascii?Q?hzOhkAYzdoPmT9IGdJwPQd1kEvxsd441H6Icw0rSUAmwnOt16tZVgthngwHt?= =?us-ascii?Q?iNgEnmH1EKzpFVYiGhqGVTUVO9L8AIiT3S8PWw0dXTnk1nGy5u8eFqFIiZyL?= =?us-ascii?Q?O/MQVGu9F+masxPTAvp5ZHzMrb01xwxzTHUi/EKatSVYsokJxSctVT9avbWT?= =?us-ascii?Q?1RfUjpfjbaEZ0cCnTWByVFg5s8qjhwoMsQcPgjr+QJzkdN4TYf3X/nkhYCam?= =?us-ascii?Q?1BV1olQjql4anXO7tHZMInHBjSOkNoqMcTNtXSaoIZx4WzVSCkpQpzs1nbbW?= =?us-ascii?Q?DFLtWxk2Qxc5Z0fSi3J0gSXkiaynExk5K7jF2WX1kbeBZv78doW9j3btQXc3?= =?us-ascii?Q?yE2hUCS3OuVlDC8ewOSNcdPhkRsU4G+U1JcNx4sizejlEI+zmCrZ4ZM6Ewvp?= =?us-ascii?Q?thy5m0KJu6kVVYO5w52xy3wAr34AAGmCB2e/ohTVkJ6YV6LP4xak4AfirJjn?= =?us-ascii?Q?Z/f5OulAjDD5kHxRags1LVp1B/rr2aZDjo4jQlI49+pvStiahz/h/tHgj5rP?= =?us-ascii?Q?Fi9Rudlx8HcbIvu9/0EhkdTRWG2rKhEmTv8GaEsnxvorSyx0jkvRB8R/Yifn?= =?us-ascii?Q?odWdHD/QZkz7IVcSYmV4vxGwjBF/lImlu50x/SSlKeDYBfWSNnsx1eHVMWBX?= =?us-ascii?Q?8kd038YhtzoZ4DGemwUAYvpVoffBXrt4Ao+4da1ZAvDa67tvrFfrODqAZyXE?= =?us-ascii?Q?fcMZJCLRsNNkB2J6/YzsBiKW+zLjEQT7nqAkS9gy7WeUuR/fN1FkVN12PQ6n?= =?us-ascii?Q?y8nQw9hv8Mi+BKFYkNlIUKMC0tMiNju+Xtf9muXv80SxTIFMAtF3zq+vjeNN?= =?us-ascii?Q?zWckTmzrkQGQY1HYpN/EsxPSPKzuKLLeZyPLiVYoNvtTGhQny5kkxB7fOc0I?= =?us-ascii?Q?mh7cFDtJXtvIxjrycgioEp8HOe9V8/bSGWCL+fnOnOAXpdFLOuDA7rzuYJOw?= =?us-ascii?Q?VaI4HB+IUlKhaapohA3F8E9zbiRm4iDB4w3LViXnWo2buuNQQWfYzjbg2YeK?= =?us-ascii?Q?ClvTh7ulI1QAeESpn38IxlzSlGpES5Itd/Pw2Fp9UiS/MK39OTEi4QIuj4ng?= =?us-ascii?Q?HH9VKNGyvKQZQqVFvo1l8chUxk2is5irgmYxzelBg12ZFH5i4VdKISok5LJ5?= =?us-ascii?Q?QsAXJuTO8/NBTTX6VNc7lFbinib5x0fL8deJqUe8soqMQqbV0pl9fNGKWDzr?= =?us-ascii?Q?rwhNZxPWKfG3DV68JrMStDRjwl0W2rxxR7TccWhr7Bx/3QuT6ROUJUSjEcco?= =?us-ascii?Q?eMIzvINHufE4WkVrMYttw6/dDM2nMSZg2lnZ4IsC?= 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: a71f7a39-e3d6-4a34-8069-08db6825b956 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2023 13:39:03.5590 (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: auuJwyrSei+C720FoyhsGFkZC1Piy0ENkTO1CPwk1Q4ab9k4MaE30d7o79En1iynMjqTwuuGstRhLzsrtiY20+YJ6ngEzVz58ccjBgq9uD4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB5002 X-Proofpoint-GUID: Zw94-_FVr9RHvNYoH4xjdr1genJcqY6f X-Proofpoint-ORIG-GUID: Zw94-_FVr9RHvNYoH4xjdr1genJcqY6f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-08_10,2023-06-08_01,2023-05-22_02 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 > This patch introduces key functions to allow a worker thread to > enable enqueue and move streams of objects to the next nodes over > different cores for mcore dispatch model. >=20 > Signed-off-by: Haiyue Wang > Signed-off-by: Cunming Liang > Signed-off-by: Zhirun Yan Acked-by: Pavan Nikhilesh > --- > lib/graph/graph.c | 6 +- > lib/graph/graph_private.h | 31 ++++ > lib/graph/meson.build | 2 +- > lib/graph/rte_graph.h | 15 +- > lib/graph/rte_graph_model_mcore_dispatch.c | 158 > +++++++++++++++++++++ > lib/graph/rte_graph_model_mcore_dispatch.h | 45 ++++++ > lib/graph/version.map | 2 + > 7 files changed, 254 insertions(+), 5 deletions(-) >=20 > diff --git a/lib/graph/graph.c b/lib/graph/graph.c > index 968cbbf86c..41251e3435 100644 > --- a/lib/graph/graph.c > +++ b/lib/graph/graph.c > @@ -473,7 +473,7 @@ rte_graph_destroy(rte_graph_t id) > } >=20 > static rte_graph_t > -graph_clone(struct graph *parent_graph, const char *name) > +graph_clone(struct graph *parent_graph, const char *name, struct > rte_graph_param *prm) > { > struct graph_node *graph_node; > struct graph *graph; > @@ -547,14 +547,14 @@ graph_clone(struct graph *parent_graph, const > char *name) > } >=20 > rte_graph_t > -rte_graph_clone(rte_graph_t id, const char *name) > +rte_graph_clone(rte_graph_t id, const char *name, struct > rte_graph_param *prm) > { > struct graph *graph; >=20 > GRAPH_ID_CHECK(id); > STAILQ_FOREACH(graph, &graph_list, next) > if (graph->id =3D=3D id) > - return graph_clone(graph, name); > + return graph_clone(graph, name, prm); >=20 > fail: > return RTE_GRAPH_ID_INVALID; > diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h > index d84174b667..d0ef13b205 100644 > --- a/lib/graph/graph_private.h > +++ b/lib/graph/graph_private.h > @@ -414,4 +414,35 @@ void graph_dump(FILE *f, struct graph *g); > */ > void node_dump(FILE *f, struct node *n); >=20 > +/** > + * @internal > + * > + * Create the graph schedule work queue for mcore dispatch model. > + * All cloned graphs attached to the parent graph MUST be destroyed > together > + * for fast schedule design limitation. > + * > + * @param _graph > + * The graph object > + * @param _parent_graph > + * The parent graph object which holds the run-queue head. > + * @param prm > + * Graph parameter, includes model-specific parameters in this graph. > + * > + * @return > + * - 0: Success. > + * - <0: Graph schedule work queue related error. > + */ > +int graph_sched_wq_create(struct graph *_graph, struct graph > *_parent_graph, > + struct rte_graph_param *prm); > + > +/** > + * @internal > + * > + * Destroy the graph schedule work queue for mcore dispatch model. > + * > + * @param _graph > + * The graph object > + */ > +void graph_sched_wq_destroy(struct graph *_graph); > + > #endif /* _RTE_GRAPH_PRIVATE_H_ */ > diff --git a/lib/graph/meson.build b/lib/graph/meson.build > index 0685cf9e72..9d51eabe33 100644 > --- a/lib/graph/meson.build > +++ b/lib/graph/meson.build > @@ -20,4 +20,4 @@ sources =3D files( > ) > headers =3D files('rte_graph.h', 'rte_graph_worker.h') >=20 > -deps +=3D ['eal', 'pcapng'] > +deps +=3D ['eal', 'pcapng', 'mempool', 'ring'] > diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h > index 998cade200..2ffee520b1 100644 > --- a/lib/graph/rte_graph.h > +++ b/lib/graph/rte_graph.h > @@ -169,6 +169,17 @@ struct rte_graph_param { > bool pcap_enable; /**< Pcap enable. */ > uint64_t num_pkt_to_capture; /**< Number of packets to capture. > */ > char *pcap_filename; /**< Filename in which packets to be > captured.*/ > + > + RTE_STD_C11 > + union { > + struct { > + uint64_t rsvd; /**< Reserved for rtc model. */ > + } rtc; > + struct { > + uint32_t wq_size_max; /**< Maximum size of > workqueue for dispatch model. */ > + uint32_t mp_capacity; /**< Capacity of memory pool > for dispatch model. */ > + } dispatch; > + }; > }; >=20 > /** > @@ -260,12 +271,14 @@ int rte_graph_destroy(rte_graph_t id); > * Name of the new graph. The library prepends the parent graph name t= o > the > * user-specified name. The final graph name will be, > * "parent graph name" + "-" + name. > + * @param prm > + * Graph parameter, includes model-specific parameters in this graph. > * > * @return > * Valid graph id on success, RTE_GRAPH_ID_INVALID otherwise. > */ > __rte_experimental > -rte_graph_t rte_graph_clone(rte_graph_t id, const char *name); > +rte_graph_t rte_graph_clone(rte_graph_t id, const char *name, struct > rte_graph_param *prm); >=20 > /** > * Get graph id from graph name. > diff --git a/lib/graph/rte_graph_model_mcore_dispatch.c > b/lib/graph/rte_graph_model_mcore_dispatch.c > index 9df2479a10..8f4bc860ab 100644 > --- a/lib/graph/rte_graph_model_mcore_dispatch.c > +++ b/lib/graph/rte_graph_model_mcore_dispatch.c > @@ -5,6 +5,164 @@ > #include "graph_private.h" > #include "rte_graph_model_mcore_dispatch.h" >=20 > +int > +graph_sched_wq_create(struct graph *_graph, struct graph > *_parent_graph, > + struct rte_graph_param *prm) > +{ > + struct rte_graph *parent_graph =3D _parent_graph->graph; > + struct rte_graph *graph =3D _graph->graph; > + unsigned int wq_size; > + unsigned int flags =3D RING_F_SC_DEQ; > + > + wq_size =3D GRAPH_SCHED_WQ_SIZE(graph->nb_nodes); > + wq_size =3D rte_align32pow2(wq_size + 1); > + > + if (prm->dispatch.wq_size_max > 0) > + wq_size =3D wq_size <=3D (prm->dispatch.wq_size_max) ? > wq_size : > + prm->dispatch.wq_size_max; > + > + if (!rte_is_power_of_2(wq_size)) > + flags |=3D RING_F_EXACT_SZ; > + > + graph->dispatch.wq =3D rte_ring_create(graph->name, wq_size, > graph->socket, > + flags); > + if (graph->dispatch.wq =3D=3D NULL) > + SET_ERR_JMP(EIO, fail, "Failed to allocate graph WQ"); > + > + if (prm->dispatch.mp_capacity > 0) > + wq_size =3D (wq_size <=3D prm->dispatch.mp_capacity) ? > wq_size : > + prm->dispatch.mp_capacity; > + > + graph->dispatch.mp =3D rte_mempool_create(graph->name, wq_size, > + sizeof(struct > graph_mcore_dispatch_wq_node), > + 0, 0, NULL, NULL, NULL, NULL, > + graph->socket, > MEMPOOL_F_SP_PUT); > + if (graph->dispatch.mp =3D=3D NULL) > + SET_ERR_JMP(EIO, fail_mp, > + "Failed to allocate graph WQ schedule entry"); > + > + graph->dispatch.lcore_id =3D _graph->lcore_id; > + > + if (parent_graph->dispatch.rq =3D=3D NULL) { > + parent_graph->dispatch.rq =3D &parent_graph- > >dispatch.rq_head; > + SLIST_INIT(parent_graph->dispatch.rq); > + } > + > + graph->dispatch.rq =3D parent_graph->dispatch.rq; > + SLIST_INSERT_HEAD(graph->dispatch.rq, graph, next); > + > + return 0; > + > +fail_mp: > + rte_ring_free(graph->dispatch.wq); > + graph->dispatch.wq =3D NULL; > +fail: > + return -rte_errno; > +} > + > +void > +graph_sched_wq_destroy(struct graph *_graph) > +{ > + struct rte_graph *graph =3D _graph->graph; > + > + if (graph =3D=3D NULL) > + return; > + > + rte_ring_free(graph->dispatch.wq); > + graph->dispatch.wq =3D NULL; > + > + rte_mempool_free(graph->dispatch.mp); > + graph->dispatch.mp =3D NULL; > +} > + > +static __rte_always_inline bool > +__graph_sched_node_enqueue(struct rte_node *node, struct rte_graph > *graph) > +{ > + struct graph_mcore_dispatch_wq_node *wq_node; > + uint16_t off =3D 0; > + uint16_t size; > + > +submit_again: > + if (rte_mempool_get(graph->dispatch.mp, (void **)&wq_node) < 0) > + goto fallback; > + > + size =3D RTE_MIN(node->idx, RTE_DIM(wq_node->objs)); > + wq_node->node_off =3D node->off; > + wq_node->nb_objs =3D size; > + rte_memcpy(wq_node->objs, &node->objs[off], size * sizeof(void > *)); > + > + while (rte_ring_mp_enqueue_bulk_elem(graph->dispatch.wq, (void > *)&wq_node, > + sizeof(wq_node), 1, NULL) =3D=3D 0) > + rte_pause(); > + > + off +=3D size; > + node->idx -=3D size; > + if (node->idx > 0) > + goto submit_again; > + > + return true; > + > +fallback: > + if (off !=3D 0) > + memmove(&node->objs[0], &node->objs[off], > + node->idx * sizeof(void *)); > + > + return false; > +} > + > +bool __rte_noinline > +__rte_graph_mcore_dispatch_sched_node_enqueue(struct rte_node > *node, > + struct rte_graph_rq_head *rq) > +{ > + const unsigned int lcore_id =3D node->dispatch.lcore_id; > + struct rte_graph *graph; > + > + SLIST_FOREACH(graph, rq, next) > + if (graph->dispatch.lcore_id =3D=3D lcore_id) > + break; > + > + return graph !=3D NULL ? __graph_sched_node_enqueue(node, > graph) : false; > +} > + > +void > +__rte_graph_mcore_dispatch_sched_wq_process(struct rte_graph > *graph) > +{ > +#define WQ_SZ 32 > + struct graph_mcore_dispatch_wq_node *wq_node; > + struct rte_mempool *mp =3D graph->dispatch.mp; > + struct rte_ring *wq =3D graph->dispatch.wq; > + uint16_t idx, free_space; > + struct rte_node *node; > + unsigned int i, n; > + struct graph_mcore_dispatch_wq_node *wq_nodes[WQ_SZ]; > + > + n =3D rte_ring_sc_dequeue_burst_elem(wq, wq_nodes, > sizeof(wq_nodes[0]), > + RTE_DIM(wq_nodes), NULL); > + if (n =3D=3D 0) > + return; > + > + for (i =3D 0; i < n; i++) { > + wq_node =3D wq_nodes[i]; > + node =3D RTE_PTR_ADD(graph, wq_node->node_off); > + RTE_ASSERT(node->fence =3D=3D RTE_GRAPH_FENCE); > + idx =3D node->idx; > + free_space =3D node->size - idx; > + > + if (unlikely(free_space < wq_node->nb_objs)) > + __rte_node_stream_alloc_size(graph, node, node- > >size + wq_node->nb_objs); > + > + memmove(&node->objs[idx], wq_node->objs, wq_node- > >nb_objs * sizeof(void *)); > + node->idx =3D idx + wq_node->nb_objs; > + > + __rte_node_process(graph, node); > + > + wq_node->nb_objs =3D 0; > + node->idx =3D 0; > + } > + > + rte_mempool_put_bulk(mp, (void **)wq_nodes, n); > +} > + > int > rte_graph_model_mcore_dispatch_node_lcore_affinity_set(const char > *name, unsigned int lcore_id) > { > diff --git a/lib/graph/rte_graph_model_mcore_dispatch.h > b/lib/graph/rte_graph_model_mcore_dispatch.h > index 7da0483d13..6163f96c37 100644 > --- a/lib/graph/rte_graph_model_mcore_dispatch.h > +++ b/lib/graph/rte_graph_model_mcore_dispatch.h > @@ -20,8 +20,53 @@ > extern "C" { > #endif >=20 > +#include > +#include > +#include > +#include > + > #include "rte_graph_worker_common.h" >=20 > +#define GRAPH_SCHED_WQ_SIZE_MULTIPLIER 8 > +#define GRAPH_SCHED_WQ_SIZE(nb_nodes) \ > + ((typeof(nb_nodes))((nb_nodes) * > GRAPH_SCHED_WQ_SIZE_MULTIPLIER)) > + > +/** > + * @internal > + * > + * Schedule the node to the right graph's work queue for mcore dispatch > model. > + * > + * @param node > + * Pointer to the scheduled node object. > + * @param rq > + * Pointer to the scheduled run-queue for all graphs. > + * > + * @return > + * True on success, false otherwise. > + * > + * @note > + * This implementation is used by mcore dispatch model only and user > application > + * should not call it directly. > + */ > +__rte_experimental > +bool __rte_noinline > __rte_graph_mcore_dispatch_sched_node_enqueue(struct rte_node > *node, > + struct > rte_graph_rq_head *rq); > + > +/** > + * @internal > + * > + * Process all nodes (streams) in the graph's work queue for mcore dispa= tch > model. > + * > + * @param graph > + * Pointer to the graph object. > + * > + * @note > + * This implementation is used by mcore dispatch model only and user > application > + * should not call it directly. > + */ > +__rte_experimental > +void __rte_graph_mcore_dispatch_sched_wq_process(struct rte_graph > *graph); > + > /** > * Set lcore affinity with the node used for mcore dispatch model. > * > diff --git a/lib/graph/version.map b/lib/graph/version.map > index dbb3507687..f95a6b0fb5 100644 > --- a/lib/graph/version.map > +++ b/lib/graph/version.map > @@ -50,6 +50,8 @@ EXPERIMENTAL { > rte_graph_worker_model_set; > rte_graph_worker_model_get; > rte_graph_worker_model_no_check_get; > + __rte_graph_mcore_dispatch_sched_wq_process; > + __rte_graph_mcore_dispatch_sched_node_enqueue; >=20 > rte_graph_model_mcore_dispatch_node_lcore_affinity_set; >=20 > -- > 2.37.2