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 4249141C61; Fri, 10 Feb 2023 15:06:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20D9E40EE6; Fri, 10 Feb 2023 15:06:01 +0100 (CET) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) by mails.dpdk.org (Postfix) with ESMTP id C904E40687 for ; Fri, 10 Feb 2023 15:05:59 +0100 (CET) Received: by mail-ua1-f49.google.com with SMTP id u3so969779uae.0 for ; Fri, 10 Feb 2023 06:05:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=c7XL3hJtw4U7GT0y/5fBRJPGEQSm4Go1OszJ+MwsO6I=; b=hc6XPAanFSKc+kdfDtcbGWcvX0gkTi9v0SvakEuwMqTDj0+Y5SDIIw27BbROqqirwa 09haGp7ApCwnvRNkKa9btcou7wrGNfjby+4BLzXEB+FbODRkf4XnYnGrfOYHPu+8rIVI VxWDoAXLy5zwrCHZIDcsY9RhWeZSZ0kiJWLux4Ci5a60anB1mJV468gFC7n5pBMqc7dj p32H0O2mcGprX/LQGYKRHr7tx4/Jmnq21iFiG0ESaxz2A3dge3f20XmXqywsRVrJaSHm Ut5CE+GAujznhiDakRxnGfn7arsTU47dMk+9CNpl/DXRv2kWj9BltRbtbjVL2SupSRfE rtLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=c7XL3hJtw4U7GT0y/5fBRJPGEQSm4Go1OszJ+MwsO6I=; b=Gqnk4BNlXAH1rWc0PYShyWyiZjoltlD1VmUY2xqXc1W2hVaw43LHOjssYIBTUyVcKu 1x2iKYpYDPyrI1Vl55io7a+ft6LpVH6S8wbT0zQnb3/ewV9kt/uqsDM75ydEHcmHTe5g 4xo0p0sYX35PU4YIld1c7VxgaD6gQuMMuPdAs5xdck9GChWAEEYVx7GxDaeN5OzDqQsV Ozhrth9uGIQV8HdHjBTYFdqXAjPsatcoZSXxJAVurbG1FB/NmCaKZXG/Ak7wt3ji2n80 jQWAYBIWn9zSZ60Er4UEoBeCjLHzhxAKbXHkaUvNNRKdFSPYGzNO8y+WKuX1M2GTMGTB zypw== X-Gm-Message-State: AO0yUKVf3fHtEfZeDrGHv00sQF57jrNzosvqMB8wGUmZJGstQatwrpom 7W3X7GDzCGCcPjAkKNGN6v5N9KZmzyl6ZK/6QxA= X-Google-Smtp-Source: AK7set9VWIOG58V556PwVLMxbaSOMjdFtD5fUQf8vJv494s6kiM75byE1OUWbhBGZX7wbqcATt2j2lBuG+PDKxFBbR8= X-Received: by 2002:ab0:2401:0:b0:683:8d8f:2671 with SMTP id f1-20020ab02401000000b006838d8f2671mr3478111uan.24.1676037959032; Fri, 10 Feb 2023 06:05:59 -0800 (PST) MIME-Version: 1.0 References: <20230210045816.3039312-1-s.v.naga.harish.k@intel.com> <20230210134646.3407253-1-s.v.naga.harish.k@intel.com> <20230210134646.3407253-2-s.v.naga.harish.k@intel.com> In-Reply-To: <20230210134646.3407253-2-s.v.naga.harish.k@intel.com> From: Jerin Jacob Date: Fri, 10 Feb 2023 19:35:32 +0530 Message-ID: Subject: Re: [PATCH v5 2/3] eventdev/eth_tx: add params set/get APIs To: Naga Harish K S V Cc: jerinj@marvell.com, erik.g.carrillo@intel.com, abhinandan.gujjar@intel.com, dev@dpdk.org, jay.jayatheerthan@intel.com Content-Type: text/plain; charset="UTF-8" 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 Fri, Feb 10, 2023 at 7:17 PM Naga Harish K S V wrote: > > The adapter runtime configuration parameters defined in the > struct rte_event_eth_tx_adapter_runtime_params can be > configured and retrieved using > rte_event_eth_tx_adapter_runtime_params_set and rte_event_eth_tx_adapter_runtime_params_set() > rte_event_eth_tx_adapter_runtime_params_get respectively. rte_event_eth_tx_adapter_runtime_params_get() > > Signed-off-by: Naga Harish K S V > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst > @@ -225,3 +225,12 @@ Stop function stops the adapter runtime function from enqueueing any > packets to the associated Tx queue. This API also frees any packets that > may have been buffered for this queue. All inflight packets destined to the > queue are freed by the adapter runtime until the queue is started again. > + > +Set/Get adapter runtime configuration parameters > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +The runtime configuration parameters of adapter can be set/get using > +``rte_event_eth_tx_adapter_runtime_params_set()`` and > +``rte_event_eth_tx_adapter_runtime_params_get()`` respectively. The parameters > +that can be set/get are defined in > +``struct rte_event_eth_tx_adapter_runtime_params``. > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c > index cce50c3c18..131e11e01d 100644 > --- a/lib/eventdev/rte_event_eth_tx_adapter.c > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c > @@ -124,6 +124,8 @@ struct txa_service_data { > uint16_t dev_count; > /* Loop count to flush Tx buffers */ > int loop_cnt; > + /* Loop count threshold to flush Tx buffers */ > + uint16_t flush_threshold; > /* Per ethernet device structure */ > struct txa_service_ethdev *txa_ethdev; > /* Statistics */ > @@ -665,13 +667,14 @@ txa_service_func(void *args) > ret = 0; > } > > - if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { > + if (txa->loop_cnt++ == txa->flush_threshold) { > > struct txa_service_ethdev *tdi; > struct txa_service_queue_info *tqi; > struct rte_eth_dev *dev; > uint16_t i; > > + txa->loop_cnt = 0; > tdi = txa->txa_ethdev; > nb_tx = 0; > > @@ -769,6 +772,7 @@ txa_service_adapter_create_ext(uint8_t id, struct rte_eventdev *dev, > txa->service_id = TXA_INVALID_SERVICE_ID; > rte_spinlock_init(&txa->tx_lock); > txa_service_data_array[id] = txa; > + txa->flush_threshold = TXA_FLUSH_THRESHOLD; > > return 0; > } > @@ -1291,6 +1295,115 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id) > return ret; > } > > +int > +rte_event_eth_tx_adapter_runtime_params_init( > + struct rte_event_eth_tx_adapter_runtime_params *txa_params) > +{ > + if (txa_params == NULL) > + return -EINVAL; > + > + memset(txa_params, 0, sizeof(*txa_params)); > + txa_params->max_nb_tx = TXA_MAX_NB_TX; > + txa_params->flush_threshold = TXA_FLUSH_THRESHOLD; > + > + return 0; > +} > + > +static int > +txa_caps_check(uint8_t id, struct txa_service_data *txa) > +{ > + uint32_t caps = 0; > + struct rte_eth_dev *eth_dev = NULL; > + struct txa_service_ethdev *tdi; > + int i; > + > + if (!txa->dev_count) > + return -EINVAL; > + > + /* The eth_dev used is always the same type. > + * Hence first valid eth_dev is taken. > + */ > + for (i = 0; i < txa->dev_count; i++) { > + tdi = &txa->txa_ethdev[i]; > + if (tdi->nb_queues) { > + eth_dev = tdi->dev; > + break; > + } > + } > + if (eth_dev == NULL) > + return -EINVAL; > + > + if (txa_dev_caps_get(id)) > + txa_dev_caps_get(id)(txa_evdev(id), eth_dev, &caps); > + > + if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) > + return -ENOTSUP; > + > + return 0; > +} > + > +int > +rte_event_eth_tx_adapter_runtime_params_set(uint8_t id, > + struct rte_event_eth_tx_adapter_runtime_params *txa_params) > +{ > + struct txa_service_data *txa; > + int ret; > + > + if (txa_lookup()) > + return -ENOMEM; > + > + TXA_CHECK_OR_ERR_RET(id); > + > + if (txa_params == NULL) > + return -EINVAL; > + > + txa = txa_service_id_to_data(id); > + if (txa == NULL) > + return -EINVAL; > + > + ret = txa_caps_check(id, txa); > + if (ret) > + return ret; > + > + rte_spinlock_lock(&txa->tx_lock); > + txa->flush_threshold = txa_params->flush_threshold; > + txa->max_nb_tx = txa_params->max_nb_tx; > + rte_spinlock_unlock(&txa->tx_lock); > + > + return 0; > +} > + > +int > +rte_event_eth_tx_adapter_runtime_params_get(uint8_t id, > + struct rte_event_eth_tx_adapter_runtime_params *txa_params) > +{ > + struct txa_service_data *txa; > + int ret; > + > + if (txa_lookup()) > + return -ENOMEM; > + > + TXA_CHECK_OR_ERR_RET(id); > + > + if (txa_params == NULL) > + return -EINVAL; > + > + txa = txa_service_id_to_data(id); > + if (txa == NULL) > + return -EINVAL; > + > + ret = txa_caps_check(id, txa); > + if (ret) > + return ret; > + > + rte_spinlock_lock(&txa->tx_lock); > + txa_params->flush_threshold = txa->flush_threshold; > + txa_params->max_nb_tx = txa->max_nb_tx; > + rte_spinlock_unlock(&txa->tx_lock); > + > + return 0; > +} > + > int > rte_event_eth_tx_adapter_stop(uint8_t id) > { > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h > index cd539af7ef..9b1ac2055e 100644 > --- a/lib/eventdev/rte_event_eth_tx_adapter.h > +++ b/lib/eventdev/rte_event_eth_tx_adapter.h > @@ -37,6 +37,9 @@ > * - rte_event_eth_tx_adapter_instance_get() > * - rte_event_eth_tx_adapter_queue_start() > * - rte_event_eth_tx_adapter_queue_stop() > + * - rte_event_eth_tx_adapter_runtime_params_get() > + * - rte_event_eth_tx_adapter_runtime_params_init() > + * - rte_event_eth_tx_adapter_runtime_params_set() > * > * The application creates the adapter using > * rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext(). > @@ -103,6 +106,25 @@ struct rte_event_eth_tx_adapter_conf { > */ > }; > > +/** > + * Adapter runtime configuration parameters > + */ > +struct rte_event_eth_tx_adapter_runtime_params { > + uint32_t max_nb_tx; > + /**< The adapter can return early if it has processed at least > + * max_nb_tx mbufs. This isn't treated as a requirement; batching may > + * cause the adapter to process more than max_nb_tx mbufs. > + * This is valid for service based SW adapter only. express with RTE_EVENT_*CAP_INTERNAL_PORT > + */ > + uint16_t flush_threshold; > + /**< the number of service function iteration count to > + * flush buffered packets. > + * This is valid for service based SW adapter only. express with RTE_EVENT_*CAP_INTERNAL_PORT > + */ > + uint16_t rsvd[29]; > + /**< Reserved fields for future expansion */ > +}; > + > /** > * Function type used for adapter configuration callback. The callback is > * used to fill in members of the struct rte_event_eth_tx_adapter_conf, this > @@ -516,6 +538,72 @@ __rte_experimental > int > rte_event_eth_tx_adapter_queue_stop(uint16_t eth_dev_id, uint16_t tx_queue_id); > > +/** > + * Initialize the adapter runtime configuration parameters with default values > + * > + * @param txa_params > + * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_eth_tx_adapter_runtime_params_init( > + struct rte_event_eth_tx_adapter_runtime_params *txa_params); > + > +/** > + * Set the runtime configuration parameters for adapter. > + * > + * In case not all fields are to be updated, the suggested way to use this > + * api is read the current values using rte_event_eth_tx_adapter_get_params(), api -> API Not relevent any more. Use rte_event_eth_tx_adapter_runtime_params_init(). i.e This sentence can be removed. > + * modify the required parameters and then call > + * rte_event_eth_tx_adapter_runtime_params_set(). > + * > + * This API is to be used after adding at least one queue to the adapter > + * and is supported only for service based adapter. This paragraph we can removed here as it is not generic API description. > + * > + * @param id > + * Adapter identifier > + * @param params > + * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params > + * with configuration parameter values. The reserved fields of this structure > + * must be initialized to zero and the valid fields need to be set appropriately. > + * This structure can be initialized using > + * rte_event_eth_tx_adapter_runtime_params_init() API to default values or > + * application may reset this structure and update required fields. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_eth_tx_adapter_runtime_params_set(uint8_t id, > + struct rte_event_eth_tx_adapter_runtime_params *params); > + > +/** > + * Get the runtime configuration parameters of adapter. > + * > + * This API is to be used after adding at least one queue to the adapter > + * and is supported only for service based adapter. This paragraph we can removed here as it is not generic API description. Similar comment to 3/3 patch. Also add chnagelog when sending next version to know what is changed. > + * > + * @param id > + * Adapter identifier > + * @param[out] params > + * A pointer to structure of type struct rte_event_eth_tx_adapter_runtime_params > + * containing valid Tx adapter parameters when return value is 0. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_eth_tx_adapter_runtime_params_get(uint8_t id, > + struct rte_event_eth_tx_adapter_runtime_params *params); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map > index ef9c3b86b2..7b93736dff 100644 > --- a/lib/eventdev/version.map > +++ b/lib/eventdev/version.map > @@ -124,6 +124,9 @@ EXPERIMENTAL { > rte_event_eth_rx_adapter_runtime_params_get; > rte_event_eth_rx_adapter_runtime_params_init; > rte_event_eth_rx_adapter_runtime_params_set; > + rte_event_eth_tx_adapter_runtime_params_get; > + rte_event_eth_tx_adapter_runtime_params_init; > + rte_event_eth_tx_adapter_runtime_params_set; > rte_event_timer_remaining_ticks_get; > }; > > -- > 2.25.1 >