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 31013A0C43; Thu, 26 Aug 2021 08:01:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAC5F40140; Thu, 26 Aug 2021 08:01:14 +0200 (CEST) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mails.dpdk.org (Postfix) with ESMTP id BB4034013F for ; Thu, 26 Aug 2021 08:01:13 +0200 (CEST) Received: by mail-qk1-f179.google.com with SMTP id 14so2183341qkc.4 for ; Wed, 25 Aug 2021 23:01:13 -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=0xepVJSp9dQxzl9oEC5Bpm8Sff7oBIi6GE8l9dBsDuY=; b=KKHk8XzUqY7iC7wVbuxAE4wIw0ujJnKbVqmtcLHH+9RYcmT3rkw9fK9rmjsmsLhKA3 ehdKGA4tXYl3tKCZ7VNdFio82w3ooAsri5Rei/u5jFYyf/e24IV+VEBNgNr1CzRJiRjn 34fGq7pd81w9okq50EV7KXVQXZfcFWsau3Jao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0xepVJSp9dQxzl9oEC5Bpm8Sff7oBIi6GE8l9dBsDuY=; b=Gv/PuFVFm6CJe1vQseuccacuwunTFMWpyHvXtm36f7XLj+lxNXxsU5gOkb0oyBhPp6 vyFZHhIJHC77yQ73B0WFONV+QWXR8WMMXmpyLOwEs6OJpg8EKRv5yQZ9z3sYH7pN7E+H 5FHs6gWhDyQGnLDt17AF5s//Q+QM8FkmMRb1/UgweiuTH/2cbmgBZn9DVIRiV5Myw72O q2sVDVBEF5jr3vi9vDQwEUa9Fmzg61eElaWXPwXT1PcZFDdZLoTAQ5qEXoYaari9/Zba Ub29S9NitF791m8OoiAlu/BbPlcj6lujVS5QTkrA9t4bnjtC8U/QWL4kRJOsKEKC7P53 1iFg== X-Gm-Message-State: AOAM532ehj4iFVcgmArnPqWwrwen0hHeVezoPGrOyOhm1zc/OnddXzBl zE+ADDbl2xHumggRDV3P1fUzeyBw/v07aXlCnm2Umw== X-Google-Smtp-Source: ABdhPJxcM44trjSmDHIDV0dUnBGUQkAI0vfep/VbFJ0jOxmXLVXm1G0hYAakqeb0qCZ9oUDNv8Ju5PKbXEeffcKRdiU= X-Received: by 2002:ae9:ef01:: with SMTP id d1mr2140021qkg.423.1629957673095; Wed, 25 Aug 2021 23:01:13 -0700 (PDT) MIME-Version: 1.0 References: <20210817173832.54228-1-jie1x.wang@intel.com> <20210824181929.142691-1-jie1x.wang@intel.com> <20210824181929.142691-2-jie1x.wang@intel.com> In-Reply-To: From: Ajit Khaparde Date: Wed, 25 Aug 2021 23:00:57 -0700 Message-ID: To: Ferruh Yigit Cc: Jie Wang , dpdk-dev , Xiaoyun Li , Andrew Rybchenko , Thomas Monjalon Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000001f582c05ca7018b3" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH v6 1/2] ethdev: add an API to get device configuration info 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" --0000000000001f582c05ca7018b3 Content-Type: text/plain; charset="UTF-8" On Wed, Aug 25, 2021 at 1:08 PM Ferruh Yigit wrote: > > On 8/24/2021 7:19 PM, Jie Wang wrote: > > This patch adds a new API "rte_eth_dev_conf_info_get()" to help testpmd get > > device configuration info. > > > > Signed-off-by: Jie Wang > > --- > > lib/ethdev/rte_ethdev.c | 27 +++++++++++++++++++++++++++ > > lib/ethdev/rte_ethdev.h | 26 ++++++++++++++++++++++++++ > > lib/ethdev/version.map | 3 +++ > > 3 files changed, 56 insertions(+) > > > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > > index 9d95cd11e1..74184099a1 100644 > > --- a/lib/ethdev/rte_ethdev.c > > +++ b/lib/ethdev/rte_ethdev.c > > @@ -3458,6 +3458,33 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) > > return 0; > > } > > > > +int > > +rte_eth_dev_conf_info_get(uint16_t port_id, > > + struct rte_eth_dev_conf_info *dev_conf_info) > > +{ > > + struct rte_eth_dev *dev; > > + > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > + dev = &rte_eth_devices[port_id]; > > + > > + if (dev_conf_info == NULL) { > > + RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u config info to NULL\n", > > + port_id); > > + return -EINVAL; > > + } > > + > > + /* > > + * Init dev_conf_info before port_id check since caller does not have > > + * return status and does not know if get is successful or not. > > + */ > > + memset(dev_conf_info, 0, sizeof(struct rte_eth_dev_conf_info)); > > + > > + dev_conf_info->rx_offloads = dev->data->dev_conf.rxmode.offloads; > > + dev_conf_info->tx_offloads = dev->data->dev_conf.txmode.offloads; > > + > > + 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 d2b27c351f..70a2db550f 100644 > > --- a/lib/ethdev/rte_ethdev.h > > +++ b/lib/ethdev/rte_ethdev.h > > @@ -1587,6 +1587,15 @@ struct rte_eth_dev_info { > > void *reserved_ptrs[2]; /**< Reserved for future fields */ > > }; > > > > +/** > > + * Ethernet device configuration information structure. > > + * Used to retrieve information about configured device. > > + */ > > +struct rte_eth_dev_conf_info { > > + uint64_t rx_offloads; /**rxmode offloads */ > > + uint64_t tx_offloads; /**txmode offloads */ > > +}; > > My concern is if we need to extend this struct later, when application wants to > get more current config from the dpdk layer, it will cause ABI break and will > need to wait next LTS. > > And as this struct grow, it will be kind of duplication of the 'struct > rte_eth_conf'. > > What do you think to reuse 'struct rte_eth_conf' in this API, to cover future needs? +1 rte_eth_conf gives all the information needed and more for future enhancements! > > > + > > /** > > * RX/TX queue states > > */ > > @@ -3058,6 +3067,23 @@ 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); > > > > +/** > > + * Retrieve the contextual information of an Ethernet device. > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * @param dev_conf_info > > + * A pointer to a structure of type *rte_eth_dev_conf_info* to be filled with > > + * the contextual information of the Ethernet device. > > + * @return > > + * - (0) if successful. > > + * - (-ENOTSUP) if support for dev_infos_get() does not exist for the device. > > + * - (-ENODEV) if *port_id* invalid. > > + * - (-EINVAL) if bad parameter. > > + */ > > +int rte_eth_dev_conf_info_get(uint16_t port_id, > > + struct rte_eth_dev_conf_info *dev_conf_info); > > + > > /** > > * Retrieve the firmware version of a device. > > * > > diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map > > index 44d30b05ae..40539f99f9 100644 > > --- a/lib/ethdev/version.map > > +++ b/lib/ethdev/version.map > > @@ -249,6 +249,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_info_get; > > }; > > > > INTERNAL { > > > --0000000000001f582c05ca7018b3--