From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id EAF6C1DBA for ; Mon, 30 Apr 2018 16:54:26 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id i14-v6so5157774wre.2 for ; Mon, 30 Apr 2018 07:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2Oj3XJ572+MiZ+0LD5zEjOx5lIcFcigOj/oBYKPlgwo=; b=QAnMkXCQxM/uw6quNFayGYRe2sgBR8uYZi9dsAN2puisjpjeYM82YwEQhk1Fz6WTYS 9z8ptfuoWG0q8DDpNx72WPid0+gMUjR/Vi0maBX2MzPJUFTcteaye/imTzgnEWncQjk5 iTCWk2wBMysD3tKLeh85YmBkfEgM1rGHBaQU/dWEBNZN3duDqYPUEogl1fOMtuzojh1S hbejkndEfPf0VeNUeQUWJEB4G2uKipep6Pf6WM/rVywxtLx41A78hNWmO+BPhgiW76Ra Qyd+El4W+3kbczo3qECduOfpOOa0qofrr1Bpx8opX+DwQdupJjlQJwkF1s9vR4NRR20u TXxA== 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; bh=2Oj3XJ572+MiZ+0LD5zEjOx5lIcFcigOj/oBYKPlgwo=; b=gPYirkQM5NaAi6xNVVSql7bdMX3/DZV/TKBP6ysdEihbkqI0wPL/yBnFMbFm7Mdo1d DK0Il18vN2MLvcYyP0AgEWRCbK42n8k7zacM1hyHtMgv54sDkkOjWl8irRh6FedyQjAE Ou7gflfRJ7aKPkcpc02fd4ih1D0lAmrpk0LbSDvLiMphC9JhFhL2wFYwZ8o1B2/UoJzj 4DmoVNadPXamfPTXzuOWWdLMZImH3gYoABahfWXl+s5zoRGD+/jBruDNOkKIYszfAeUQ aqzxpO6J5+KU+HQ6/rrskXkaQFu9UkGBGuFp3rGhnnazsf8NnJc84BAQKdIR/F/KpdrF 6qDg== X-Gm-Message-State: ALQs6tDr2/+BFi/H5RHWYZ7piyqe0typ98NV769iPupUuitZChmkRy4P DiNmuzmzal2e4yi4Bh5g5A64LpOvmgE= X-Google-Smtp-Source: AB8JxZq6hhjt8LjV+xsknzXvivksa51yW25Sbaqh6DKXrDaFPxrfQY3NhPeBgT8SClWjlpXaD6pz9w== X-Received: by 2002:adf:c908:: with SMTP id m8-v6mr9784006wrh.6.1525100066594; Mon, 30 Apr 2018 07:54:26 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id u187sm6863984wmu.46.2018.04.30.07.54.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:54:25 -0700 (PDT) From: luca.boccassi@gmail.com To: Nitin Saxena Cc: Jerin Jacob , dpdk stable Date: Mon, 30 Apr 2018 15:53:33 +0100 Message-Id: <20180430145402.23057-14-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180430145402.23057-1-luca.boccassi@gmail.com> References: <20180430144223.18657-85-luca.boccassi@gmail.com> <20180430145402.23057-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/thunderx: fix MTU configuration for jumbo packets' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 14:54:27 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/02/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From b7fd74c24638458d0fce1c1627c98f40146a53a3 Mon Sep 17 00:00:00 2001 From: Nitin Saxena Date: Mon, 16 Apr 2018 10:44:47 +0000 Subject: [PATCH] net/thunderx: fix MTU configuration for jumbo packets [ upstream commit c77875fbb8004c22e9910338f93b7be3e29ab9f9 ] thunderx pmd driver passes dev_info.max_rx_pktlen as 9200 (via rte_eth_dev_info_get()) to application. But, when application tries to set MTU as (9200 - sizeof(ethernet_header_t)) the operation fails because of missing CRC and VLAN additions. This patch fixes the following for thunderx pmd driver: - Sets NIC_HW_MAX_FRS to 9216 (instead of 9200) - Sets NIC_HW_MAX_MTU to 9190 (NIC_HW_MAX_FRS - ETH_HLEN - ETHER_CRC_LEN - 2*VLAN_HLEN) - Sets dev_info->max_rx_pkt_len to NIC_HW_MAX_MTU + ETH_HLEN (instead of 9200) - Allows rte_eth_dev_set_mtu() to pass if application (like VPP) calls rte_eth_dev_set_mtu() before rte_eth_dev_start() by putting appropriate check for dev->data->dev_started Fixes: 65d9804edc05 ("net/thunderx: support MTU configuration") Signed-off-by: Nitin Saxena Acked-by: Jerin Jacob --- drivers/net/thunderx/base/nicvf_hw_defs.h | 5 ++++- drivers/net/thunderx/nicvf_ethdev.c | 15 +++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h index b13c21fff..b12c8ec50 100644 --- a/drivers/net/thunderx/base/nicvf_hw_defs.h +++ b/drivers/net/thunderx/base/nicvf_hw_defs.h @@ -171,7 +171,10 @@ /* Min/Max packet size */ #define NIC_HW_MIN_FRS (64) -#define NIC_HW_MAX_FRS (9200) /* 9216 max pkt including FCS */ +/* ETH_HLEN+ETH_FCS_LEN+2*VLAN_HLEN */ +#define NIC_HW_L2_OVERHEAD (26) +#define NIC_HW_MAX_MTU (9190) +#define NIC_HW_MAX_FRS (NIC_HW_MAX_MTU + NIC_HW_L2_OVERHEAD) #define NIC_HW_MAX_SEGS (12) /* Descriptor alignments */ diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index a65361fb4..ad8aa4145 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -170,7 +170,7 @@ static int nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct nicvf *nic = nicvf_pmd_priv(dev); - uint32_t buffsz, frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t buffsz, frame_size = mtu + NIC_HW_L2_OVERHEAD; size_t i; struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; @@ -188,7 +188,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) * Refuse mtu that requires the support of scattered packets * when this feature has not been enabled before. */ - if (!dev->data->scattered_rx && + if (dev->data->dev_started && !dev->data->scattered_rx && (frame_size + 2 * VLAN_TAG_SIZE > buffsz)) return -EINVAL; @@ -202,11 +202,11 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) else rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; - if (nicvf_mbox_update_hw_max_frs(nic, frame_size)) + if (nicvf_mbox_update_hw_max_frs(nic, mtu)) return -EINVAL; - /* Update max frame size */ - rxmode->max_rx_pkt_len = (uint32_t)frame_size; + /* Update max_rx_pkt_len */ + rxmode->max_rx_pkt_len = mtu + ETHER_HDR_LEN; nic->mtu = mtu; for (i = 0; i < nic->sqs_count; i++) @@ -1418,7 +1418,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa |= ETH_LINK_SPEED_40G; dev_info->min_rx_bufsize = ETHER_MIN_MTU; - dev_info->max_rx_pktlen = NIC_HW_MAX_FRS; + dev_info->max_rx_pktlen = NIC_HW_MAX_MTU + ETHER_HDR_LEN; dev_info->max_rx_queues = (uint16_t)MAX_RCV_QUEUES_PER_QS * (MAX_SQS_PER_VF + 1); dev_info->max_tx_queues = @@ -1751,8 +1751,7 @@ nicvf_dev_start(struct rte_eth_dev *dev) /* Setup MTU based on max_rx_pkt_len or default */ mtu = dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME ? dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN - ETHER_CRC_LEN - : ETHER_MTU; + - ETHER_HDR_LEN : ETHER_MTU; if (nicvf_dev_set_mtu(dev, mtu)) { PMD_INIT_LOG(ERR, "Failed to set default mtu size"); -- 2.14.2