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 9F451A034F; Mon, 11 Oct 2021 12:08:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10F0840E01; Mon, 11 Oct 2021 12:08:21 +0200 (CEST) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by mails.dpdk.org (Postfix) with ESMTP id 130E440142 for ; Mon, 11 Oct 2021 12:08:19 +0200 (CEST) Received: by mail-yb1-f177.google.com with SMTP id i84so37628272ybc.12 for ; Mon, 11 Oct 2021 03:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4fh0GbmWz65FYmERbUX/DiQfVDQakCuLIGsO+uDzRdk=; b=MGNtBTLafyNJaAZ7luQ98JSxL7+RUNMp2Exopx0qorImoW15T3VtI7WqIxEyNP7UQs rTkVIuyVC6cssWvcEpDppMxCdKsGsyNX5f3A6t0EjMz+V8KEi/a9RhTiRI+oii1vfbfT nQ9RC565focwnjeBAXd1Vhd8+tndFqntPvFew= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4fh0GbmWz65FYmERbUX/DiQfVDQakCuLIGsO+uDzRdk=; b=kctzkKLfa1euIyYui3KSICNfzErq7a3/9bFb8uaGfyohm2DtQTJF70OOrbRPWGsac1 AEgZckaU/RCEapbUVJXjyzRegPDtYFT26RHw4wDiMIvXtztQeFIm0NOiSevJtPYAewFe lzVLCaaNIi1yzwhL+g7Ir/oH9y+1ytA2sMs3wC4CjtS84zwBbrHDtU9SL2vzKAnVFQv8 8IT4zndfeD07gSAftzhhx4qMZ4Yaoo2zwY+NS1DXkBu7fKc5orTofG6iBUSkz3c+jTHx 7FpL80kwY3H7pTKFs7PHzYfRJ48IcU5mDr1szRetmPjv8SGKDPUNWRX4pOpc+RnRI7fu ZSbA== X-Gm-Message-State: AOAM531A0733AIiVMXdGqiKZK8sG+0j/jLZrdNE6BLxGyVdasYUF1Odj s4CX6/WtIoCx1/xuFwiD2DY4HOAIv9ukHYxaIOvEYA== X-Google-Smtp-Source: ABdhPJwMvD6yEt5HmXRSUFelCgIX0cEurbxaRvh8rikh1WCgwonVVt3pfgmh+HJE9h5GZJDdiBvN+2hV6WmWI5bOVHg= X-Received: by 2002:a05:6902:1204:: with SMTP id s4mr20850829ybu.307.1633946899220; Mon, 11 Oct 2021 03:08:19 -0700 (PDT) MIME-Version: 1.0 References: <20211008034111.14121-1-jie1x.wang@intel.com> <20211011180111.99281-1-jie1x.wang@intel.com> <20211011180111.99281-2-jie1x.wang@intel.com> In-Reply-To: <20211011180111.99281-2-jie1x.wang@intel.com> From: Somnath Kotur Date: Mon, 11 Oct 2021 15:38:08 +0530 Message-ID: To: Jie Wang Cc: dev , Ferruh Yigit , Thomas Monjalon , Andrew Rybchenko , Xiaoyun Li , Steve Yang Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000008753a305ce10e85a" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH v11 1/2] ethdev: add an API to get device configuration 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 Sender: "dev" --0000000000008753a305ce10e85a Content-Type: text/plain; charset="UTF-8" On Mon, Oct 11, 2021 at 3:34 PM Jie Wang wrote: > > The driver may change offloads info into dev->data->dev_conf > in dev_configure which may cause port->dev_conf and port->rx_conf > contain outdated values. > > This patch adds a new API "rte_eth_dev_conf_get()" to help users > get device configuration. > > Add information about the new API in release notes. > > Signed-off-by: Jie Wang > --- > doc/guides/rel_notes/release_21_11.rst | 5 +++++ > lib/ethdev/rte_ethdev.c | 20 ++++++++++++++++++++ > lib/ethdev/rte_ethdev.h | 20 ++++++++++++++++++++ > lib/ethdev/version.map | 3 +++ > 4 files changed, 48 insertions(+) > > diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst > index 93082723cf..789fc2d4ba 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -67,6 +67,11 @@ New Features > Added macros ETH_RSS_IPV4_CHKSUM and ETH_RSS_L4_CHKSUM, now IPv4 and > TCP/UDP/SCTP header checksum field can be used as input set for RSS. > > +* **Added support for users get device configuration in ethdev.** > + > + Added an ethdev API which can help users get device configuration. > + The declarations for the API's can be found in ``rte_ethdev.h``. `declaration for the API ` right? > + > * **Updated Broadcom bnxt PMD.** > > * Added flow offload support for Thor. > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 028907bc4b..be3ceb8131 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -3437,6 +3437,26 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) > return 0; > } > > +int > +rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + dev = &rte_eth_devices[port_id]; > + > + if (dev_conf == NULL) { > + RTE_ETHDEV_LOG(ERR, > + "Cannot get ethdev port %u configuration to NULL\n", > + port_id); > + return -EINVAL; > + } > + > + memcpy(dev_conf, &dev->data->dev_conf, sizeof(struct rte_eth_conf)); > + > + return 0; > +} > + > int > rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, > uint32_t *ptypes, int num) > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index 6d80514ba7..f42f950fea 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -3052,6 +3052,26 @@ int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); > */ > int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info); > > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Retrieve the configuration of an Ethernet device. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param dev_conf > + * A pointer to a structure of type *rte_eth_conf* to be filled with > + * the configuration of the Ethernet device. > + * And the memory of the structure should be allocated by the caller. > + * @return > + * - (0) if successful. > + * - (-ENODEV) if *port_id* invalid. > + * - (-EINVAL) if bad parameter. > + */ > +__rte_experimental > +int rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf); > + > /** > * Retrieve the firmware version of a device. > * > diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map > index efd729c0f2..c516837723 100644 > --- a/lib/ethdev/version.map > +++ b/lib/ethdev/version.map > @@ -245,6 +245,9 @@ EXPERIMENTAL { > rte_mtr_meter_policy_delete; > rte_mtr_meter_policy_update; > rte_mtr_meter_policy_validate; > + > + # added in 21.11 > + rte_eth_dev_conf_get; > }; > > INTERNAL { > -- Acked-by: Somnath kotur > 2.25.1 > --0000000000008753a305ce10e85a--