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 74537A0543; Fri, 12 Aug 2022 14:25:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1172642C06; Fri, 12 Aug 2022 14:25:01 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 6A56440A7F for ; Fri, 12 Aug 2022 14:24:57 +0200 (CEST) Received: from bree.oktetlabs.ru (bree.oktetlabs.ru [192.168.34.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPS id 1ACC8B5; Fri, 12 Aug 2022 15:24:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 1ACC8B5 Authentication-Results: shelob.oktetlabs.ru/1ACC8B5; dkim=none; dkim-atps=neutral From: Ivan Malov To: dev@dpdk.org Cc: Andy Moreton , Andrew Rybchenko Subject: [PATCH 3/3] net/sfc: clarify Rx buffer size calculation Date: Fri, 12 Aug 2022 15:24:54 +0300 Message-Id: <20220812122454.1947322-3-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220812122454.1947322-1-ivan.malov@oktetlabs.ru> References: <20220812122454.1947322-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The user has the right to supply pools with excessively large buffers, regardless of the maximum supported Rx packet length reported by the adapter. However, in this PMD, on EF10 boards, a Rx descriptor has only 14 bits to specify the buffer length. To avoid potential problems, use this information accordingly. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc_rx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 128aa9753a..5ea98187c3 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1081,7 +1081,11 @@ sfc_rx_mb_pool_buf_size(struct sfc_adapter *sa, struct rte_mempool *mb_pool) buf_size = EFX_P2ALIGN(uint32_t, buf_size, nic_align_end); } - return buf_size; + /* + * Buffer length field of a Rx descriptor may not be wide + * enough to store a 16-bit data count taken from an mbuf. + */ + return MIN(buf_size, encp->enc_rx_dma_desc_size_max); } int -- 2.30.2