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 78F6BA0597; Wed, 8 Apr 2020 10:29:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0ECA71C00D; Wed, 8 Apr 2020 10:29:29 +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 1297F1BF68 for ; Wed, 8 Apr 2020 10:29:26 +0200 (CEST) Received: by mail-lj1-f194.google.com with SMTP id v16so6698398ljg.5 for ; Wed, 08 Apr 2020 01:29:26 -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=86wXBRPm8TU8y9mD6AOAEKe29tXVds0P2s6XymU/LlE=; b=1lu9poK7jVxZTtbBEzT34jFm7qCEl8Sxb0DRqV6YnxKB84pTaL5ynntyzZxojPm46k bBnuNYmh0oCWvpDtSaUpLq3MbGyRwyWyNmFzLyqKaIMxNqE+UZM70Wa7iuKRJqbGy/Ju b36v1HO31sH4vpPjyuNg3ARQamLJIXmqTAXJ82mxbvlfSySdCpzlMMOF4bF7eiuEEQKt 9u9nBLY8l82YGRoF93ETjteHVzCtRDqYzWvmasO/MagJ0OzcKa8pHGMIxyg9KCiuxfm6 76+zXpiylLhBpM7aOmfkEkzjeijGhQOSvdUFQRFQyAVdGCddHyDEhn3ctwGpY8hPaZdt 3QGA== 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=86wXBRPm8TU8y9mD6AOAEKe29tXVds0P2s6XymU/LlE=; b=VjeS6/5tpDzlPf8bOw5MSQ4al31Ig2DXK/LZz47v346f2J6YeWjsj8LCueb0TZ90fh S4qzVf3LuIAQATMSSEljwVGs+BuxmaTMb6x27mOdssxuuE6bDN7nkzzsg8d8aCOYwVvM CDVo44IHFbPh1Kzyp4gDM+M3G2fOG5YpI+r6p4sfpkUZ/rg2G57wgviP+KXE8x/thRir j4R0ClYv1wH5QNYZc93eeKk1Rc6JJm/YIEcurUmS8THQP4MVEIC6OhiTjhiZZXBiiCEJ pAIxuaMZYF5sw+M1wF0r8IWXwOfnzltldGLldQy7RQRlsQr0An7zT6Le6bqwLM7+p0y6 rrHA== X-Gm-Message-State: AGi0Puah8Xlfi1q6XRT/faSEdoWXTOxmY9Ygn95w7RjETkLmf0uj/5X4 dQ9qqV3otI/EzbYqLzzxmRtzK6QrrNs= X-Google-Smtp-Source: APiQypLrVLx8pyyAAC0iUTO/ERdLKTP3IoNQvvKA7vNxVZDh4I5hNEh4YuW5DIfauNLEBtpEujCGFw== X-Received: by 2002:a2e:3c08:: with SMTP id j8mr4376385lja.243.1586334565405; Wed, 08 Apr 2020 01:29:25 -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 e8sm765685lja.3.2020.04.08.01.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2020 01:29:24 -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, ferruh.yigit@intel.com, arybchenko@solarflare.com, Michal Krawczyk Date: Wed, 8 Apr 2020 10:28:52 +0200 Message-Id: <20200408082921.31000-2-mk@semihalf.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200408082921.31000-1-mk@semihalf.com> References: <20200408082921.31000-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 01/30] 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 v3: * Update the copyright date in modified files drivers/net/ena/ena_ethdev.c | 12 +++++++++++- drivers/net/ena/ena_ethdev.h | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 665afee4f0..64aabbbb19 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates. + * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates. * All rights reserved. */ @@ -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..e9b55dc029 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates. + * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates. * All rights reserved. */ @@ -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