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 BE9A143033; Fri, 11 Aug 2023 14:07:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5180540F16; Fri, 11 Aug 2023 14:07:37 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 0751140E03 for ; Fri, 11 Aug 2023 14:07:36 +0200 (CEST) Received: from [192.168.1.39] (unknown [188.170.85.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id EDC9650; Fri, 11 Aug 2023 15:07:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru EDC9650 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1691755655; bh=NLAZbVzfaK6ekFfggmCbXDzcXSz8dgtKoRVKo+vbfr4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=nzVkR7gW48zWzPXeRU9pLwM7rKQmVVByVp6ElnMOWEVMzvYRFO03oD0ByiqPapKvi Kf4hdc980j0g6UlYpkdnosMfIIEpjflPCVfdTu3j/HNxMm6IEZcfxAp3DxOCJ4HWOF QqId52fp1Rfp5uOZhuq6MB3JU7riZgDjY1nvNdIw= Message-ID: <38ba7f44-675f-a668-2233-5f089795fa53@oktetlabs.ru> Date: Fri, 11 Aug 2023 15:07:34 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC] ethdev: introduce maximum Rx buffer size To: Huisong Li , dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, liuyonglong@huawei.com References: <20230808040234.12947-1-lihuisong@huawei.com> Content-Language: en-US From: Andrew Rybchenko In-Reply-To: <20230808040234.12947-1-lihuisong@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 8/8/23 07:02, Huisong Li wrote: > The Rx buffer size stands for the size hardware supported to receive > packets in one mbuf. The "min_rx_bufsize" is the minimum buffer hardware > supported in Rx. Actually, some engines also have the maximum buffer > specification, like, hns3. For these engines, the available data size > of one mbuf in Rx also depends on the maximum buffer hardware supported. > So introduce maximum Rx buffer size in struct rte_eth_dev_info to report > user to avoid memory waste. I think that the field should be defined as for informational purposes only (highlighted in comments). I.e. if application specifies larger Rx buffer, driver should accept it and just pass smaller value value to HW. Also I think it would be useful to log warning from Rx queue setup if provided Rx buffer is larger than maximum reported by the driver. > > Signed-off-by: Huisong Li > --- > lib/ethdev/rte_ethdev.c | 1 + > lib/ethdev/rte_ethdev.h | 4 ++-- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 0840d2b594..6d1b92e607 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -3689,6 +3689,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) > dev_info->min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN - > RTE_ETHER_CRC_LEN; > dev_info->max_mtu = UINT16_MAX; > + dev_info->max_rx_bufsize = UINT32_MAX; > > if (*dev->dev_ops->dev_infos_get == NULL) > return -ENOTSUP; > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index 04a2564f22..1f0ab9c5d8 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -1779,8 +1779,8 @@ struct rte_eth_dev_info { > struct rte_eth_switch_info switch_info; > /** Supported error handling mode. */ > enum rte_eth_err_handle_mode err_handle_mode; > - > - uint64_t reserved_64s[2]; /**< Reserved for future fields */ > + uint32_t max_rx_bufsize; /**< Maximum size of Rx buffer. */ IMHO, comment should be aligned similar to comments below. Since the next release is ABI breaking, I think it should be put nearby min_rx_bufsize to make it easier to notice it. > + uint32_t reserved_32s[3]; /**< Reserved for future fields */ > void *reserved_ptrs[2]; /**< Reserved for future fields */ > }; >