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 BCB3FA04BB; Wed, 2 Sep 2020 13:53:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BEB4F1C07B; Wed, 2 Sep 2020 13:53:02 +0200 (CEST) Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by dpdk.org (Postfix) with ESMTP id 499FB1C066 for ; Wed, 2 Sep 2020 13:53:01 +0200 (CEST) Received: by mail-ej1-f65.google.com with SMTP id z23so1805857ejr.13 for ; Wed, 02 Sep 2020 04:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SnggrHuhBMdgEUf6cR5p849qCRnc+y4eGjrM2fu+22o=; b=2JSj+MNLh8yHn1Glfj7yeyjaMXdL1qvqSMpfYkLoZ7x0GQOZx5ej6q2AmOowEx4ZJB WHACNMtW/icCNiDKiBEk/NznuFp16ZZU0nFMg+LDoZSHkVil6f79fF6XYepGpnFJamtL pcdDPF/UmZBOg6cbAztdwjiykAXI3NwXkIU7BoBoyp0RWBZqTY6UMYPIuSEbOVVb0l8A Sb5Qf3cQFHajz9BzMSBS4Z1OpnI2ZBlJyoLzE3PNjuJZj39v7YnkRBUJwSfIKjvfFPUV C3wHD5DUSqLWCI88P5Ga9UtPtkKfqyO+s9NPaJIMhzL5lLy1hsu6r3/hQ60awPyjmzWc pcww== 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:mime-version :content-transfer-encoding; bh=SnggrHuhBMdgEUf6cR5p849qCRnc+y4eGjrM2fu+22o=; b=rePdyb9f8y9HySXrps8s3yhxYHWFsX01IcppGvc9+XcNSwej5xRvKNR0odD2TJwM8/ 8W+3lDQogokp03Lsxg4E6aGSzew7tYkuU1RFVradlpTJeIMxTGF/CKKbAALr0Cpoownw i1iN2CoiEBX5t19XhPSTANjbftJGpIJPnidK9S0qIFbSRP2/COl4osQqGUzVBI91eHgu 6SGiQFGfWb62s+i8RrtanEDujhGCDG4wpUU3ByvdOQF3zLR8WZViLbxfYE46/jyONVI1 uDTPJZreRMsO3vhyR63fv6aaa3bobWzvTYrY9dPftZlgQW1JztIh2UtVS8owe1TAbwgB RZdA== X-Gm-Message-State: AOAM532aaU5FD4dYs06P9926zHLxWoyFZ4h5JvxNncFIclkoK7BZcSot MpiUFwX9FMoVdXrbzhL1OaBItk1QZdhCQmGVFFOpwvQpR4JXSzrRSF9YMqqNgDQHXmWpTUewziE Kd66Z5DgJOSFJTDV2W7CWU6CtCQcMT946hG5lxS0OJHg6B/3JKho/6kPm7LOhB+eZ1Tk= X-Google-Smtp-Source: ABdhPJwdV6mzJr+rtQ02P+lsVvKYVBHXkZ8v2ka0WMuuiykaLzoNC+76M6cr/H+ZJoUz2cgAI15b9w== X-Received: by 2002:a17:906:d9d9:: with SMTP id qk25mr5808326ejb.51.1599047580808; Wed, 02 Sep 2020 04:53:00 -0700 (PDT) Received: from localhost.localdomain ([102.132.233.103]) by smtp.gmail.com with ESMTPSA id b1sm1413155eja.43.2020.09.02.04.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 04:52:59 -0700 (PDT) From: Heinrich Kuhn To: dev@dpdk.org Cc: Heinrich Kuhn , stable@dpdk.org, Simon Horman Date: Wed, 2 Sep 2020 13:52:27 +0200 Message-Id: <20200902115227.15802-1-heinrich.kuhn@netronome.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/nfp: expand dev_infos_get callback function 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" Report Rx and Tx descriptor related limitations in the nfp dev_info_get callback function. This commit also adds NFP_ALIGN_RING_DESC to replace a static integer value used during rx/tx queue setups to validate descriptor alignment. Cc: stable@dpdk.org Signed-off-by: Heinrich Kuhn Signed-off-by: Simon Horman --- drivers/net/nfp/nfp_net.c | 30 ++++++++++++++++++++++++------ drivers/net/nfp/nfp_net_pmd.h | 6 ++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 99946279d..0dd594992 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1250,6 +1250,20 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .tx_rs_thresh = DEFAULT_TX_RSBIT_THRESH, }; + dev_info->rx_desc_lim = (struct rte_eth_desc_lim) { + .nb_max = NFP_NET_MAX_RX_DESC, + .nb_min = NFP_NET_MIN_RX_DESC, + .nb_align = NFP_ALIGN_RING_DESC, + }; + + dev_info->tx_desc_lim = (struct rte_eth_desc_lim) { + .nb_max = NFP_NET_MAX_TX_DESC, + .nb_min = NFP_NET_MIN_TX_DESC, + .nb_align = NFP_ALIGN_RING_DESC, + .nb_seg_max = NFP_TX_MAX_SEG, + .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG, + }; + dev_info->flow_type_rss_offloads = ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV4_UDP | @@ -1513,15 +1527,17 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, const struct rte_memzone *tz; struct nfp_net_rxq *rxq; struct nfp_net_hw *hw; + uint32_t rx_desc_sz; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); PMD_INIT_FUNC_TRACE(); /* Validating number of descriptors */ - if (((nb_desc * sizeof(struct nfp_net_rx_desc)) % 128) != 0 || - (nb_desc > NFP_NET_MAX_RX_DESC) || - (nb_desc < NFP_NET_MIN_RX_DESC)) { + rx_desc_sz = nb_desc * sizeof(struct nfp_net_rx_desc); + if (rx_desc_sz % NFP_ALIGN_RING_DESC != 0 || + nb_desc > NFP_NET_MAX_RX_DESC || + nb_desc < NFP_NET_MIN_RX_DESC) { PMD_DRV_LOG(ERR, "Wrong nb_desc value"); return -EINVAL; } @@ -1660,15 +1676,17 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct nfp_net_txq *txq; uint16_t tx_free_thresh; struct nfp_net_hw *hw; + uint32_t tx_desc_sz; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); PMD_INIT_FUNC_TRACE(); /* Validating number of descriptors */ - if (((nb_desc * sizeof(struct nfp_net_tx_desc)) % 128) != 0 || - (nb_desc > NFP_NET_MAX_TX_DESC) || - (nb_desc < NFP_NET_MIN_TX_DESC)) { + tx_desc_sz = nb_desc * sizeof(struct nfp_net_tx_desc); + if (tx_desc_sz % NFP_ALIGN_RING_DESC != 0 || + nb_desc > NFP_NET_MAX_TX_DESC || + nb_desc < NFP_NET_MIN_TX_DESC) { PMD_DRV_LOG(ERR, "Wrong nb_desc value"); return -EINVAL; } diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h index cb2d19afe..1295c5959 100644 --- a/drivers/net/nfp/nfp_net_pmd.h +++ b/drivers/net/nfp/nfp_net_pmd.h @@ -33,6 +33,12 @@ struct nfp_net_adapter; #define NFP_NET_MAX_RX_DESC (32 * 1024) #define NFP_NET_MIN_RX_DESC 64 +/* Descriptor alignment */ +#define NFP_ALIGN_RING_DESC 128 + +#define NFP_TX_MAX_SEG UINT8_MAX +#define NFP_TX_MAX_MTU_SEG 8 + /* Bar allocation */ #define NFP_NET_CRTL_BAR 0 #define NFP_NET_TX_BAR 2 -- 2.26.2