From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6D4FD41C5B;
	Fri, 10 Feb 2023 07:31:11 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 5BC7F410D0;
	Fri, 10 Feb 2023 07:31:11 +0100 (CET)
Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com
 [209.85.217.54]) by mails.dpdk.org (Postfix) with ESMTP id 2422840EE3
 for <dev@dpdk.org>; Fri, 10 Feb 2023 07:31:10 +0100 (CET)
Received: by mail-vs1-f54.google.com with SMTP id d66so4625548vsd.9
 for <dev@dpdk.org>; Thu, 09 Feb 2023 22:31:10 -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=bDhA/gAJVJ336EWZr4iPlx6pWpXO50at5dh1YUzlSHs=;
 b=Ls+yKWaQMdQ14Ba4su3BVp4Z2vRMz1UGP/4KMg3lgQcGNtTNcOaYeMgJEvolOBO/wR
 pxCz+FhMqeWnUxSKRiDdOH/nta5p+/beDd+DSjfh05nChDpofmXgIcODvqZ5H/+voi/m
 OWv2fvz7NUk6QTC+h2FNP2pDyhbqwSutXpsUB1Ovcef2s931opBe/sYoMPmUBRcpk1w/
 ua7mGz4nO4QIDyeiIVXO6Vu7D4/OHygzTfXLbawjbjmPFUy9ODGkzwkE5mOT+SdtHcoc
 WZFiKdxCnmodGGATJUILbB6Kfso+iEqO3QfLkv5sZejRCNGsBZ+TEP+fOtFco0GN8E/h
 0Njg==
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=bDhA/gAJVJ336EWZr4iPlx6pWpXO50at5dh1YUzlSHs=;
 b=cg1epnM/FoLmsxzLV0R7V78COJkjhFFPGVGvHzYvgcJ35cMioao/FaGukf44qd0i8H
 +0f1zACKmLUfyj0hEz4St9X7BaOfy1gTsk+G/ygW8aHJbdQ9t6nxbOCfDiL/g1Noq4VB
 KHgALVdZa4QtiXu+fGmJLRBpxO6I5CRlWpzEPwM0mhhO9A9rV3VDq77s/59v1NrVCaiv
 zNwgiyEublOJK2Y0s2zeN6JnqXo1MnBXhagF1VagolhNiCvwMIULz+VuKLUQiVi29Ydv
 RnqSv5N2D7AaxQ3XV2wh+OQfuaR1W1TZcP/qFaHpGdB7PzEpw2AtvvfrT10HwdG1XAxT
 cOow==
X-Gm-Message-State: AO0yUKXhNjYaUVKuRHYg5XTlSxug8msy33aceyl5GJrxYQ/QZ8knkR1S
 xPE5iPKpmWocGlpC1JQZTmtcMOZz0jZNuCBdz8M=
X-Google-Smtp-Source: AK7set9cY77TREHyVbFOqfXaUbn3U/fVyfWPqOWn+wAcCfpCaJiA8r/jgR8SgL4SMcAWCOk0QVOeRRaojWzPco9aVgU=
X-Received: by 2002:a05:6102:5c1a:b0:3fe:3011:1976 with SMTP id
 ds26-20020a0561025c1a00b003fe30111976mr3063491vsb.52.1676010669443; Thu, 09
 Feb 2023 22:31:09 -0800 (PST)
MIME-Version: 1.0
References: <20230123180458.486189-1-s.v.naga.harish.k@intel.com>
 <20230210045816.3039312-1-s.v.naga.harish.k@intel.com>
In-Reply-To: <20230210045816.3039312-1-s.v.naga.harish.k@intel.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Fri, 10 Feb 2023 12:00:43 +0530
Message-ID: <CALBAE1MF-LAgnQELukWPevgtu=-gzAq+aax9kb63PZzKvOg4hQ@mail.gmail.com>
Subject: Re: [PATCH v4 1/3] eventdev/eth_rx: add params set/get APIs
To: Naga Harish K S V <s.v.naga.harish.k@intel.com>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Fri, Feb 10, 2023 at 10:28 AM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> The adapter configuration parameters defined in the
> ``struct rte_event_eth_rx_adapter_runtime_params`` can be configured

`` character you can remove in git commit.

> and retrieved using ``rte_event_eth_rx_adapter_runtime_params_set`` and
> ``rte_event_eth_tx_adapter_runtime_params_get`` respectively.
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
>
> +Set/Get adapter runtime configuration parameters
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The runtime configuration parameters of adapter can be set/read using

read->get

> +``rte_event_eth_rx_adapter_runtime_params_set()`` and
> +``rte_event_eth_rx_adapter_runtime_params_get()`` respectively. The parameters that
> +can be set/read are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.

read->get

> +
> +``rte_event_eth_rx_adapter_runtime_parmas_get()`` function retrieves the configuration
> +parameters that are defined in ``struct rte_event_eth_rx_adapter_runtime_params``.

This is duplicate. Please remove.

>
>  static int
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h
> index f4652f40e8..9f781a5f69 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.h
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.h
> @@ -39,10 +39,21 @@
>   *  - rte_event_eth_rx_adapter_queue_stats_reset()
>   *  - rte_event_eth_rx_adapter_event_port_get()
>   *  - rte_event_eth_rx_adapter_instance_get()
> + *  - rte_event_eth_rx_adapter_runtime_params_get()
> + *  - rte_event_eth_rx_adapter_runtime_params_set()
>   *
>   * The application creates an ethernet to event adapter using
>   * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
>   * or rte_event_eth_rx_adapter_create_with_params() functions.
> + *
> + * rte_event_eth_rx_adapter_create() or rte_event_eth_adapter_create_with_params()
> + * configures the adapter with default value of maximum packets processed per
> + * iteration to RXA_NB_RX_WORK_DEFAULT(128).
> + * rte_event_eth_rx_adapter_runtime_params_set() allows to re-configure maximum
> + * packets processed per iteration. This is alternative to using
> + * rte_event_eth_rx_adapter_create_ext() with parameter
> + * rte_event_eth_rx_adapter_conf::max_nb_rx

This session is only valid for SW driver. Let's move this as Doxgen comment
struct rte_event_eth_rx_adapter_runtime_params::max_nb_rx

> + *
>   * The adapter needs to know which ethernet rx queues to poll for mbufs as well
>   * as event device parameters such as the event queue identifier, event
>   * priority and scheduling type that the adapter should use when constructing
> @@ -121,6 +132,11 @@ struct rte_event_eth_rx_adapter_conf {
>          */
>  };
>
> +#define RXA_NB_RX_WORK_DEFAULT 128
> +/**< The default value for maximum number of packets processed by service
> + * based adapter per each call.

Don't expose internal symbols to public header file. Fix it by moving
rte_event_eth_rx_adapter_runtime_params_init() implementation .c file.
Since it is slow path function, there is no reason to be kept as
inline funciton.


> + */
> +
>  /**
>   * Function type used for adapter configuration callback. The callback is
>   * used to fill in members of the struct rte_event_eth_rx_adapter_conf, this
> @@ -299,6 +315,19 @@ struct rte_event_eth_rx_adapter_params {
>         /**< flag to indicate that event buffer is separate for each queue */
>  };
>
> +/**
> + * Adapter configuration parameters
> + */
> +struct rte_event_eth_rx_adapter_runtime_params {
> +       uint32_t max_nb_rx;
> +       /**< The adapter can return early if it has processed at least
> +        * max_nb_rx mbufs. This isn't treated as a requirement; batching may
> +        * cause the adapter to process more than max_nb_rx mbufs.

Also mention, valid only when !INTERNAL_PORT

> +        */
> +       uint32_t rsvd[15];
> +       /**< Reserved fields for future use */
> +};
> +
>  /**
>   *
>   * Callback function invoked by the SW adapter before it continues
> @@ -377,7 +406,7 @@ int rte_event_eth_rx_adapter_create_ext(uint8_t id, uint8_t dev_id,
>   * Create a new ethernet Rx event adapter with the specified identifier.
>   * This function uses an internal configuration function that creates an event
>   * port. This default function reconfigures the event device with an
> - * additional event port and setups up the event port using the port_config
> + * additional event port and setup the event port using the port_config
>   * parameter passed into this function. In case the application needs more
>   * control in configuration of the service, it should use the
>   * rte_event_eth_rx_adapter_create_ext() version.
> @@ -743,6 +772,76 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
>                                       uint16_t rx_queue_id,
>                                       uint8_t *rxa_inst_id);
>
> +/**
> + * Initialize the adapter runtime configuration parameters with default values
> + *
> + * @param params
> + *  A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
> + *
> + * @return
> + *  -  0: Success
> + *  - <0: Error code on failure
> + */
> +__rte_experimental
> +static inline int

Slowpath function, move to .c file.

> +rte_event_eth_rx_adapter_runtime_params_init(
> +               struct rte_event_eth_rx_adapter_runtime_params *params)
> +{
> +       if (params == NULL)
> +               return -EINVAL;
> +
> +       memset(params, 0, sizeof(struct rte_event_eth_rx_adapter_runtime_params));
> +       params->max_nb_rx = RXA_NB_RX_WORK_DEFAULT;
> +
> +       return 0;
> +}
> +
> +/**
> + * Set the adapter runtime configuration parameters
> + *
> + * This API is to be used after adding at least one queue to the adapter
> + * and is supported only for service based adapter.
> + *
> + * @param id
> + *  Adapter identifier
> + *
> + * @param params
> + *  A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
> + *  with configuration parameter values. This structure can be initialized using
> + *  rte_event_eth_rx_adapter_runtime_params_init() to default values or
> + *  application may reset this structure and update the required fields.

I would suggest:

The structure must be initialized to default values.
rte_event_eth_rx_adapter_runtime_params_init() can be used to
initialize the default values
or application must reset this structure and update the required fields.


> + *
> + * @return
> + *  -  0: Success
> + *  - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_rx_adapter_runtime_params_set(uint8_t id,
> +               struct rte_event_eth_rx_adapter_runtime_params *params);
> +
> +/**
> + * Get the adapter runtime configuration parameters
> + *
> + * This API is to be used after adding at least one queue to the adapter
> + * and is supported only for service based adapter.
> + *
> + * @param id
> + *  Adapter identifier
> + *
> + * @param[out] params
> + *  A pointer to structure of type struct rte_event_eth_rx_adapter_runtime_params
> + *  containing valid adapter parameters when return value is 0.
> + *
> + * @return
> + *  -  0: Success
> + *  - <0: Error code on failure
> + */
> +__rte_experimental
> +int
> +rte_event_eth_rx_adapter_runtime_params_get(uint8_t id,
> +               struct rte_event_eth_rx_adapter_runtime_params *params);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map
> index 3add5e3088..da97db794f 100644
> --- a/lib/eventdev/version.map
> +++ b/lib/eventdev/version.map
> @@ -121,6 +121,8 @@ EXPERIMENTAL {
>         rte_event_eth_tx_adapter_queue_stop;
>
>         # added in 23.03

Add rte_event_eth_rx_adapter_runtime_params_init() to version.map

Not reviewed other patches. Similar comments apply in other patches.

> +       rte_event_eth_rx_adapter_runtime_params_get;
> +       rte_event_eth_rx_adapter_runtime_params_set;
>         rte_event_timer_remaining_ticks_get;
>  };
>
> --
> 2.25.1
>