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 0E99342C4A; Wed, 7 Jun 2023 09:43:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD6C040A84; Wed, 7 Jun 2023 09:43:28 +0200 (CEST) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by mails.dpdk.org (Postfix) with ESMTP id BD80140695 for ; Wed, 7 Jun 2023 09:43:26 +0200 (CEST) Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-78a1e095508so869728241.0 for ; Wed, 07 Jun 2023 00:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686123806; x=1688715806; 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=agAKFD6P2NADKbqmgPj9A4AfbfVr/MdfO1q43hdHhIs=; b=KkWRD6od6JWmELyHP3nNmB4zye+1PqHgsnNFyPWohgX8p5H21LD6RM4JlL8KM1YQIf xI3mrQLhEH7OOuQcestUdE0Ay9+2shCmXVtoGJDz5hfbFXRUPeoPywI3NgI81DEPVDO/ NS8ys7p0gUpfgeaZb2cinS9CpgXN2jyVPK1wyBaekZGYyR4Ibiz4S5Jd+qK7GP1LShLc szOUXGXP4htj+THG1k6iKXrMmTEd41nP1MAhznZoYRyah3atyTUV9BQksrt9eRIefwh6 DldJ97PYtH4d/nsU6imf8JK6X+j/Xe2O2yinm5GBpZNmoPtFhHTpfYYu4hlwVhRPHX7x V1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686123806; x=1688715806; 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=agAKFD6P2NADKbqmgPj9A4AfbfVr/MdfO1q43hdHhIs=; b=aIkJssRY3dEm23luRv2u221vqyr5kk+TAi3n4Dn06jWqCUAY5JsOO9CqZ/VELegpVx jR7W0jiOl0fNDsRgpiRcnXIjOXWjwyU/t93U6EK5KM+kZNNn5NfEUg4in241B4SkmGKf nkxzSu5OsliOiApY9TvEnO/LmgTMcd0jn8S9MX8uCpIh0QCIgxRH1sDC0uCR395zwWZq AcebXCUK2SDp8SiHqdTBdaYlTVxyA0RBGN24BP0LmMPRT+diIGJTvgnsy/YPvlw4Nvn/ 6xX/VhoEwyOamjmNeh5qHIOqLJj9ikt93AQQbm1/SsoVNKve8P/0j+fMCDITHU6QytGj c4Jg== X-Gm-Message-State: AC+VfDzfw/J1nppaceTnFZKsQuNcZ7vovEaHNh/az7LAhlJhyvvlKU1j sm1Pkvoesaj+lMavMlwBVc/REQ/GJhFVBHCXDQ8= X-Google-Smtp-Source: ACHHUZ7BpsW0dMsQcOmQ35FlNRBD+RuudTMLqPxPrkwimFWsxg+kyJexIaz5A9WvPacb7SonVCTKC49z3DoI9rWX+zY= X-Received: by 2002:a05:6102:256:b0:43b:1893:e41d with SMTP id a22-20020a056102025600b0043b1893e41dmr672395vsq.25.1686123805950; Wed, 07 Jun 2023 00:43:25 -0700 (PDT) MIME-Version: 1.0 References: <20230606144746.708388-1-zhirun.yan@intel.com> <20230607035144.1214492-1-zhirun.yan@intel.com> <20230607035144.1214492-5-zhirun.yan@intel.com> In-Reply-To: <20230607035144.1214492-5-zhirun.yan@intel.com> From: Jerin Jacob Date: Wed, 7 Jun 2023 13:12:59 +0530 Message-ID: Subject: Re: [PATCH v9 04/17] graph: add get/set graph worker model APIs 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, mattias.ronnblom@ericsson.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 Wed, Jun 7, 2023 at 9:30=E2=80=AFAM Zhirun Yan wr= ote: > > Add new get/set APIs to configure graph worker model which is used to > determine which model will be chosen. > > Signed-off-by: Haiyue Wang > Signed-off-by: Cunming Liang > Signed-off-by: Zhirun Yan > > +/** Graph worker models */ > +/* If adding new entry, then update graph_model_is_valid API. */ When adding new model entry, update rte_graph_model_is_valid API logic > +#define RTE_GRAPH_MODEL_RTC 0 /**< Run-To-Completion model. It is the de= fault model. */ > +#define RTE_GRAPH_MODEL_DEFAULT RTE_GRAPH_MODEL_RTC /**< Default graph m= odel. */ This line can come after RTE_GRAPH_MODEL_MCORE_DISPATCH > +#define RTE_GRAPH_MODEL_MCORE_DISPATCH 1 > +/**< Dispatch model to support cross-core dispatching within core affini= ty. */ > + > /** > * @internal > * > @@ -41,6 +48,7 @@ struct rte_graph { > rte_node_t nb_nodes; /**< Number of nodes in the graph. *= / > rte_graph_off_t *cir_start; /**< Pointer to circular buffer. */ > rte_graph_off_t nodes_start; /**< Offset at which node memory sta= rts. */ > + uint32_t model; /**< graph model */ uin8_t is enough and add uint8_t and uint16_t reserved. So that this fastpath area can be used in future as needed. > rte_graph_t id; /**< Graph identifier. */ > int socket; /**< Socket ID where memory is allocated. */ > char name[RTE_GRAPH_NAMESIZE]; /**< Name of the graph. */ > @@ -490,6 +498,59 @@ rte_node_next_stream_move(struct rte_graph *graph, s= truct rte_node *src, > } > } > > +/** > + * Test the validity of model. > + * > + * @param id > + * Node id to check. It is not node id > + * > + * @return > + * true if graph model is valid, false otherwise. > + */ > +static __rte_always_inline > +bool > +graph_model_is_valid(uint32_t model) Public API in header file, use rte_graph_... Also, implementation can go to .c file. See below comment for no_check vers= ion. > +{ > + if (model > RTE_GRAPH_MODEL_MCORE_DISPATCH) > + return false; > + > + return true; > +} > + > +/** > + * @note This function does not perform any locking, and is only safe to= call > + * before graph running. It will set all graphs the same model. > + * > + * @param model > + * Name of the graph worker model. > + * > + * @return > + * 0 on success, -1 otherwise. > + */ > +__rte_experimental > +int rte_graph_worker_model_set(uint32_t model); > + > +/** > + * Get the graph worker model > + * > + * @note All graph will use the same model and this function will get mo= del from the first one > + * > + * @param graph > + * Graph pointer. > + * > + * @return > + * Graph worker model on success. > + */ > +__rte_experimental > +static inline uint32_t > +rte_graph_worker_model_get(struct rte_graph *graph) > +{ > + if (!graph_model_is_valid(graph->model)) > + return -EINVAL; Introduce rte_graph_worker_model_no_check_get() to skip this check to use with fastpath. rte_graph_worker_model_get can move to .c file. > + > + return graph->model; > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/graph/version.map b/lib/graph/version.map > index 13b838752d..eea73ec9ca 100644 > --- a/lib/graph/version.map > +++ b/lib/graph/version.map > @@ -43,5 +43,8 @@ EXPERIMENTAL { > rte_node_next_stream_put; > rte_node_next_stream_move; > > + rte_graph_worker_model_set; > + rte_graph_worker_model_get; Add rte_graph_model_is_valid() in next verion. > + > local: *; > }; > -- > 2.37.2 >