From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C396CA057B; Wed, 1 Apr 2020 16:21:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 25BEF1BE9B; Wed, 1 Apr 2020 16:21:41 +0200 (CEST) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 25CBF3B5 for ; Wed, 1 Apr 2020 16:21:39 +0200 (CEST) Received: by mail-lj1-f194.google.com with SMTP id n17so25945640lji.8 for ; Wed, 01 Apr 2020 07:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m6OL7pgoqyLwVGSBretiCVE6yK1LNicxN0enE1mBvwY=; b=jZgHJo7n1gUTw+uY21VOmQrK+DPZXr8lhgP6i2EZjRM51/x05jQHxEeI5SkmtcAk3t Z5xuSqAWig2j7IUubmbm25VmyEFJVsUw/2lT1QVvG5kDxH0W9ruxF6NepKqjixmCBv6H r3rncJ2za6D6cENMKmRcHXCHfG2EeGaeu4XoCzPS3Jh8ol/VRx5y2KStayVmRd8WIAIY hpWc1PtU3LELqVSf1oGBRZonYIyzmErV17gi9hPqJ7GmOCcToXcf4xOk5YIVFQ93P3lX 0ORxpzFhmIX1nk8RBAx1u5YFg2JmZvDRwVVrATdVekzaYzVAatWIVReGiMenBmzUPsZh 6rEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m6OL7pgoqyLwVGSBretiCVE6yK1LNicxN0enE1mBvwY=; b=O25WHuVcuTkiGbyQ4eEJ3WEKkTWntHMlj5BOnh6TssrS7tGiSwslizadEEDNoHgEZz oqtFhqSBcAcCk7ODTOfGbU6K3VMeAp+n8qhcEb0qMVvovo185ZosxWDcPusrskI4gW1b PZGO6WNn+WnO95U9tnhGg7ha/E+g4y9PCL1espEpqmT4LrXlDAVxxhj3FKDPYv+R3JVt 5gNET1Xd7pVjOMjU+uzrzUE8dRh8txnPD6n5ILL03dlODd9js1tM4IWosfOJaBwGLJOs hEMYIkkKb77yoOnO9wrZhTqnN710T4iD16e+ILT8jg9ARsC8WeWL6PrydA1yii9QtFSE 86bg== X-Gm-Message-State: AGi0PuY0HrMmOA4j3lyLDTYe65srB2wlcKhWGRqir3XP5g+pp+fzoS4G KaZk7h3t1tP5YiQdK0Jt0ct4uF1TTBc= X-Google-Smtp-Source: APiQypK6xCHa4FsbLJ6TGeiXYmQBt67MHOHEySp4QLwuFQvwS2f3RJzC2hh7eEsDlePgZ9TNlDawnw== X-Received: by 2002:a2e:a16d:: with SMTP id u13mr12957548ljl.140.1585750898503; Wed, 01 Apr 2020 07:21:38 -0700 (PDT) Received: from mkPC.semihalf.local (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id r21sm1435961ljp.29.2020.04.01.07.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 07:21:37 -0700 (PDT) From: Michal Krawczyk To: dev@dpdk.org Cc: mw@semihalf.com, mba@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, igorch@amazon.com, Michal Krawczyk Date: Wed, 1 Apr 2020 16:20:59 +0200 Message-Id: <20200401142127.13715-2-mk@semihalf.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200401142127.13715-1-mk@semihalf.com> References: <20200401142127.13715-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 01/29] net/ena: check if size of buffer is at least 1400B X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Some of the ENA devices can't handle buffers which are smaller than a 1400B. Because of this limitation, size of the buffer is being checked and limited during the Rx queue setup. If it's below the allowed value, PMD won't finish it's configuration successfully.. Signed-off-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Guy Tzalik --- v2: * Remove debug printout * Change the way of acquiring mempool size drivers/net/ena/ena_ethdev.c | 10 ++++++++++ drivers/net/ena/ena_ethdev.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 665afee4f0..292526466c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1282,6 +1282,7 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev, { struct ena_adapter *adapter = dev->data->dev_private; struct ena_ring *rxq = NULL; + size_t buffer_size; int i; rxq = &adapter->rx_ring[queue_idx]; @@ -1309,6 +1310,15 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev, return -EINVAL; } + /* ENA isn't supporting buffers smaller than 1400 bytes */ + buffer_size = rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; + if (buffer_size < ENA_RX_BUF_MIN_SIZE) { + PMD_DRV_LOG(ERR, + "Unsupported size of RX buffer: %zu (min size: %d)\n", + buffer_size, ENA_RX_BUF_MIN_SIZE); + return -EINVAL; + } + rxq->port_id = dev->data->port_id; rxq->next_to_clean = 0; rxq->next_to_use = 0; diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index af5eeea280..c1457defeb 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -20,6 +20,7 @@ #define ENA_MIN_FRAME_LEN 64 #define ENA_NAME_MAX_LEN 20 #define ENA_PKT_MAX_BUFS 17 +#define ENA_RX_BUF_MIN_SIZE 1400 #define ENA_MIN_MTU 128 -- 2.20.1