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 91DC742B89; Wed, 24 May 2023 08:24:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C2CF40ED8; Wed, 24 May 2023 08:24:15 +0200 (CEST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id E791B4067E for ; Wed, 24 May 2023 08:24:13 +0200 (CEST) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1ae852a5330so4254775ad.3 for ; Tue, 23 May 2023 23:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684909453; x=1687501453; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eWFfD6yTXMXm5Ki1MvborECkeIPQ7+lILtYN7xKTJOw=; b=V9MUk5aGeelssF9qwPNTyyKmZCuJ29KnEwTOpkP9PCdY51gkfzcxP3BmkZzNoVN2F1 T5vs7aGZKB5RIGTyxHAGelj/SJqCpuMlfWrykSAXHQyF8biDP3y2aRPW6OuaV1RwdntE J1F/u3cK/iII7+T1BYjYqxgdxIVNzv52k/U6YJkjZfSxbAn8sv2xLQICvmdFWn7uTNsx gSqA7ZrA5vr3QW2OvNbEznm7qxDTdE3OBWPfTKqoSkJdp0KSbx2aqtBseIV9jyz+6I0z Pc8/ujEvidHFKPgtRiT8SlNFvR8SPWxF5kiirrVxopqxsCumlCeCQfQFRE7qTyIwY8PV IFww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684909453; x=1687501453; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eWFfD6yTXMXm5Ki1MvborECkeIPQ7+lILtYN7xKTJOw=; b=TLlx2lCnnqz+xnJ//Lb9gWr7VvuRRqUYLxdMkBFRIKD58sqbZHQ8IAuZx7z48wwqgV LOUJV1iBSOfGjt1shXCkxlK5q2ZfmWuJm26GISC3jsELBhGguL492Hr4OByoF5E94Tfh 1Thp3OxnQgeo7e9OFIEljqBveYvY3S+ib+E99mfnINlabNLtSlrJwJ6jxWSECtZA9Dx5 bsaqXzcb3z96AIdFTyeRRH/jRW4WYhWmj/9PQBWb46Y2hwp0BpoxRUNKcsI0Je2oczq5 q7Z83iDPzxqENK2+dIspsvEpH9CpOLXJQPk+Eifup3NNj7zo0umNZTthI7LmzG6+Gi4V WFZA== X-Gm-Message-State: AC+VfDx0Oq+uwDI5LNUaEe/ypYPyQFujbV5wGIKYw8L3JrPsfFZU/QnJ o9dI9SrGyOVD20NcygTzNAM16C4jNm4zpJ3bNh4= X-Google-Smtp-Source: ACHHUZ5S7XLwPMRRExjYSdlBnftXN69578CHj034DHdJcLxA1QOTlDufTU6g18mVD2iTLiLmEb960J5d9iE2DFBG07Q= X-Received: by 2002:a17:903:1212:b0:1ae:2013:4bc8 with SMTP id l18-20020a170903121200b001ae20134bc8mr22852371plh.18.1684909452845; Tue, 23 May 2023 23:24:12 -0700 (PDT) MIME-Version: 1.0 References: <20230331040306.3143693-1-zhirun.yan@intel.com> <20230509060347.1237884-1-zhirun.yan@intel.com> <20230509060347.1237884-7-zhirun.yan@intel.com> In-Reply-To: <20230509060347.1237884-7-zhirun.yan@intel.com> From: Jerin Jacob Date: Wed, 24 May 2023 11:53:46 +0530 Message-ID: Subject: Re: [PATCH v6 06/15] graph: introduce graph bind unbind API To: Zhirun Yan Cc: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, stephen@networkplumber.org, pbhagavatula@marvell.com, cunming.liang@intel.com, haiyue.wang@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Tue, May 9, 2023 at 11:34=E2=80=AFAM Zhirun Yan w= rote: > > Add lcore_id for graph to hold affinity core id where graph would run on. > Add bind/unbind API to set/unset graph affinity attribute. lcore_id will > be set as MAX by default, it means not enable this attribute. > > Signed-off-by: Haiyue Wang > Signed-off-by: Cunming Liang > Signed-off-by: Zhirun Yan > --- > lib/graph/graph.c | 59 +++++++++++++++++++++++++++++++++++++++ > lib/graph/graph_private.h | 2 ++ > lib/graph/rte_graph.h | 22 +++++++++++++++ > lib/graph/version.map | 2 ++ > + > +int > +rte_graph_model_dispatch_core_bind(rte_graph_t id, int lcore) > +{ > + struct graph *graph; > + > + GRAPH_ID_CHECK(id); > + if (!rte_lcore_is_enabled(lcore)) > + SET_ERR_JMP(ENOLINK, fail, > + "lcore %d not enabled\n", \n is already part of it from graph_err() so no need to add it. Also, DPDK coding standard now supports 100 column as max width, so below "lcore" can be moved to the same line if there is space. > + lcore); > + > + STAILQ_FOREACH(graph, &graph_list, next) > + if (graph->id =3D=3D id) > + break; > + > + graph->lcore_id =3D lcore; > + graph->socket =3D rte_lcore_to_socket_id(lcore); > + > + /* check the availability of source node */ > + if (!graph_src_node_avail(graph)) > + graph->graph->head =3D 0; > + > + return 0; > + > +fail: > + return -rte_errno; > +} > + > +void > +rte_graph_model_dispatch_core_unbind(rte_graph_t id) > +{ > + struct graph *graph; > + > + GRAPH_ID_CHECK(id); > + STAILQ_FOREACH(graph, &graph_list, next) > + if (graph->id =3D=3D id) > + break; > + > + graph->lcore_id =3D RTE_MAX_LCORE; > + > +fail: > + return; > +} > + > struct rte_graph * > rte_graph_lookup(const char *name) > { > @@ -346,6 +404,7 @@ rte_graph_create(const char *name, struct rte_graph_p= aram *prm) > graph->src_node_count =3D src_node_count; > graph->node_count =3D graph_nodes_count(graph); > graph->id =3D graph_id; > + graph->lcore_id =3D RTE_MAX_LCORE; > graph->num_pkt_to_capture =3D prm->num_pkt_to_capture; > if (prm->pcap_filename) > rte_strscpy(graph->pcap_filename, prm->pcap_filename, RTE= _GRAPH_PCAP_FILE_SZ); > diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h > index bd4c576324..f63b339d81 100644 > --- a/lib/graph/graph_private.h > +++ b/lib/graph/graph_private.h > @@ -99,6 +99,8 @@ struct graph { > /**< Circular buffer mask for wrap around. */ > rte_graph_t id; > /**< Graph identifier. */ > + unsigned int lcore_id; > + /**< Lcore identifier where the graph prefer to run on. */ Could you move to end of existing fast path variables. Also, please extend the comments for new variable introduced ONLY for dispatch model. Something like " Lcore identifier where the graph prefer to run on." to " Lcore identifier where the graph prefer to run on. Used with dispatch model" or so. > size_t mem_sz; > /**< Memory size of the graph. */ > int socket; > diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h > index c9a77297fc..c523809d1f 100644 > --- a/lib/graph/rte_graph.h > +++ b/lib/graph/rte_graph.h > @@ -285,6 +285,28 @@ char *rte_graph_id_to_name(rte_graph_t id); > __rte_experimental > int rte_graph_export(const char *name, FILE *f); > > +/** > + * Bind graph with specific lcore > + * > + * @param id > + * Graph id to get the pointer of graph object > + * @param lcore > + * The lcore where the graph will run on > + * @return > + * 0 on success, error otherwise. > + */ > +__rte_experimental > +int rte_graph_model_dispatch_core_bind(rte_graph_t id, int lcore); > + > +/** > + * Unbind graph with lcore > + * > + * @param id > + * Graph id to get the pointer of graph object > + */ > +__rte_experimental > +void rte_graph_model_dispatch_core_unbind(rte_graph_t id); > + > /** > * Get graph object from its name. > * > diff --git a/lib/graph/version.map b/lib/graph/version.map > index 1f090be74e..7de6f08f59 100644 > --- a/lib/graph/version.map > +++ b/lib/graph/version.map > @@ -18,6 +18,8 @@ EXPERIMENTAL { > rte_graph_node_get_by_name; > rte_graph_obj_dump; > rte_graph_walk; > + rte_graph_model_dispatch_core_bind; > + rte_graph_model_dispatch_core_unbind; > > rte_graph_cluster_stats_create; > rte_graph_cluster_stats_destroy; > -- > 2.37.2 >