From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id EBCBE325F for ; Thu, 1 Feb 2018 10:49:33 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6E03E20C6F; Thu, 1 Feb 2018 04:49:33 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 01 Feb 2018 04:49:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=ximGjnclrkN0i7wWa gtOLMfA4XqEKMztDi5hPtLPMpM=; b=pOuLHkBXM0gpIazv6LoCwFuSgWYqVYRw4 1bXjwaazMy+hwXpg6wSW3MGXMZ2aD1ydzkh3wqUeoftDKSXbZHgmIq/zk7UfhI5m ynWgSqzUrREe3uOGjxuChaSle79XbbAaQ0keF+D1qkbWRNeh2/5gXbc/CW3B9ENh bDCtqjVP3CjAAmy0clMlLMtMrpNE32c8MW5pVJCTDwyv8CFV8pcLxsJCHTH7TRK0 /VWUBOokpBz4pL32JNqMkNaHZsJ5vm3+7cAH7UJQXlLYNxLRAYbTrD2rMKUSKtk/ M+iBc6obbF0qxDm9ELpr8xOo5dlg8zCGlm2GIzMVi0fmBSQ7yZUaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ximGjnclrkN0i7wWagtOLMfA4XqEKMztDi5hPtLPMpM=; b=Fjqy/gpb 2Ik9Q8sdSoCMZbqF8pNTPApZ8mPFCOU3KFkiJ+Rvs7R/ed1PKxmHltQeMTNOwRN2 aoIJFWWrqNCKXFxVjEDFLBMoYu3Hjm9iGfy37AVSuFugVp2eBYddlDsrLUGWniYA oBsxF73NzBYDUAeYhFBSdWawi0Prmt4vbHdV1kALkeylIkojV/8sW0WkjgpDhj9c 7G8+KY7RI1lTHHDuBx9Y95t3GdXDcqETgfEiexoD/6aKk5AsvqgAQvarFwtY63ph 4awW9CMKrvBjK11sEjDy+8hddWI4VetsHs1dvzhZB5CExj+s/PVeSH2ruLsOdHa0 gYxmq4ZBUMj+Pg== X-ME-Sender: Received: from yliu-mob.mtl.com (unknown [115.150.27.200]) by mail.messagingengine.com (Postfix) with ESMTPA id E5FF224610; Thu, 1 Feb 2018 04:49:31 -0500 (EST) From: Yuanhan Liu To: Rasesh Mody Cc: dpdk stable Date: Thu, 1 Feb 2018 17:47:48 +0800 Message-Id: <1517478479-12417-34-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> References: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/qede: fix MTU set and max Rx length' has been queued to LTS release 17.11.1 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: Thu, 01 Feb 2018 09:49:34 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/03/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 40a6c11a287ef759464fdbe8061c7b7a3bb76498 Mon Sep 17 00:00:00 2001 From: Rasesh Mody Date: Sat, 27 Jan 2018 13:15:30 -0800 Subject: [PATCH] net/qede: fix MTU set and max Rx length [ upstream commit 9e334305178fd3715c17088632544bf58e5836a9 ] This patch fixes issues related to MTU set and max_rx_pkt_len usage. - Adjust MTU during device configuration when jumbo is enabled - In qede_set_mtu(): Return not supported for VF as currently we do not support it. Cache new mtu value in mtu_new for proper update. Add check for RXQ allocation before calculating RX buffer size if not allocated defer RX buffer size calculation till RXQ setup. Add check for before performing device start/stop. - Use max_rx_pkt_len appropriately - Change QEDE_ETH_OVERHEAD macro to adjust driver specifics Fixes: 4c4bdadfa9e7 ("net/qede: refactoring multi-queue implementation") Fixes: 9a6d30ae6d46 ("net/qede: refactoring vport handling code") Fixes: 1ef4c3a5c1f7 ("net/qede: prevent crash while changing MTU dynamically") Signed-off-by: Rasesh Mody --- drivers/net/qede/qede_ethdev.c | 63 ++++++++++++++++++++++++++++-------------- drivers/net/qede/qede_rxtx.c | 6 ++-- drivers/net/qede/qede_rxtx.h | 2 +- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index b0c0997..de6e9e1 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1347,18 +1347,24 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) return -ENOMEM; } + /* If jumbo enabled adjust MTU */ + if (eth_dev->data->dev_conf.rxmode.jumbo_frame) + eth_dev->data->mtu = + eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - + ETHER_HDR_LEN - ETHER_CRC_LEN; + /* VF's MTU has to be set using vport-start where as * PF's MTU can be updated via vport-update. */ if (IS_VF(edev)) { - if (qede_start_vport(qdev, rxmode->max_rx_pkt_len)) + if (qede_start_vport(qdev, eth_dev->data->mtu)) return -1; } else { - if (qede_update_mtu(eth_dev, rxmode->max_rx_pkt_len)) + if (qede_update_mtu(eth_dev, eth_dev->data->mtu)) return -1; } - qdev->mtu = rxmode->max_rx_pkt_len; + qdev->mtu = eth_dev->data->mtu; qdev->new_mtu = qdev->mtu; /* Enable VLAN offloads by default */ @@ -2237,16 +2243,23 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct rte_eth_dev_info dev_info = {0}; struct qede_fastpath *fp; + uint32_t max_rx_pkt_len; uint32_t frame_size; uint16_t rx_buf_size; uint16_t bufsz; + bool restart = false; int i; PMD_INIT_FUNC_TRACE(edev); + if (IS_VF(edev)) + return -ENOTSUP; qede_dev_info_get(dev, &dev_info); - frame_size = mtu + QEDE_ETH_OVERHEAD; + max_rx_pkt_len = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + frame_size = max_rx_pkt_len + QEDE_ETH_OVERHEAD; if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) { - DP_ERR(edev, "MTU %u out of range\n", mtu); + DP_ERR(edev, "MTU %u out of range, %u is maximum allowable\n", + mtu, dev_info.max_rx_pktlen - ETHER_HDR_LEN - + ETHER_CRC_LEN - QEDE_ETH_OVERHEAD); return -EINVAL; } if (!dev->data->scattered_rx && @@ -2260,29 +2273,39 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) */ dev->rx_pkt_burst = qede_rxtx_pkts_dummy; dev->tx_pkt_burst = qede_rxtx_pkts_dummy; - qede_dev_stop(dev); + if (dev->data->dev_started) { + dev->data->dev_started = 0; + qede_dev_stop(dev); + restart = true; + } rte_delay_ms(1000); - qdev->mtu = mtu; + qdev->new_mtu = mtu; /* Fix up RX buf size for all queues of the port */ for_each_rss(i) { fp = &qdev->fp_array[i]; - bufsz = (uint16_t)rte_pktmbuf_data_room_size( - fp->rxq->mb_pool) - RTE_PKTMBUF_HEADROOM; - if (dev->data->scattered_rx) - rx_buf_size = bufsz + QEDE_ETH_OVERHEAD; - else - rx_buf_size = mtu + QEDE_ETH_OVERHEAD; - rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rx_buf_size); - fp->rxq->rx_buf_size = rx_buf_size; - DP_INFO(edev, "buf_size adjusted to %u\n", rx_buf_size); - } - qede_dev_start(dev); - if (frame_size > ETHER_MAX_LEN) + if (fp->rxq != NULL) { + bufsz = (uint16_t)rte_pktmbuf_data_room_size( + fp->rxq->mb_pool) - RTE_PKTMBUF_HEADROOM; + if (dev->data->scattered_rx) + rx_buf_size = bufsz + ETHER_HDR_LEN + + ETHER_CRC_LEN + QEDE_ETH_OVERHEAD; + else + rx_buf_size = frame_size; + rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rx_buf_size); + fp->rxq->rx_buf_size = rx_buf_size; + DP_INFO(edev, "buf_size adjusted to %u\n", rx_buf_size); + } + } + if (max_rx_pkt_len > ETHER_MAX_LEN) dev->data->dev_conf.rxmode.jumbo_frame = 1; else dev->data->dev_conf.rxmode.jumbo_frame = 0; + if (!dev->data->dev_started && restart) { + qede_dev_start(dev); + dev->data->dev_started = 1; + } /* update max frame size */ - dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size; + dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len; /* Reassign back */ dev->rx_pkt_burst = qede_recv_pkts; dev->tx_pkt_burst = qede_xmit_pkts; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index a89d6c6..7efc19a 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -84,7 +84,6 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->port_id = dev->data->port_id; max_rx_pkt_len = (uint16_t)rxmode->max_rx_pkt_len; - qdev->mtu = max_rx_pkt_len; /* Fix up RX buffer size */ bufsz = (uint16_t)rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; @@ -97,9 +96,10 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } if (dev->data->scattered_rx) - rxq->rx_buf_size = bufsz + QEDE_ETH_OVERHEAD; + rxq->rx_buf_size = bufsz + ETHER_HDR_LEN + + ETHER_CRC_LEN + QEDE_ETH_OVERHEAD; else - rxq->rx_buf_size = qdev->mtu + QEDE_ETH_OVERHEAD; + rxq->rx_buf_size = max_rx_pkt_len + QEDE_ETH_OVERHEAD; /* Align to cache-line size if needed */ rxq->rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rxq->rx_buf_size); diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h index acf9e47..ae88206 100644 --- a/drivers/net/qede/qede_rxtx.h +++ b/drivers/net/qede/qede_rxtx.h @@ -64,7 +64,7 @@ #define QEDE_CEIL_TO_CACHE_LINE_SIZE(n) (((n) + (QEDE_FW_RX_ALIGN_END - 1)) & \ ~(QEDE_FW_RX_ALIGN_END - 1)) /* Note: QEDE_LLC_SNAP_HDR_LEN is optional */ -#define QEDE_ETH_OVERHEAD ((ETHER_HDR_LEN) + ((2 * QEDE_VLAN_TAG_SIZE)) \ +#define QEDE_ETH_OVERHEAD (((2 * QEDE_VLAN_TAG_SIZE)) - (ETHER_CRC_LEN) \ + (QEDE_LLC_SNAP_HDR_LEN)) #define QEDE_RSS_OFFLOAD_ALL (ETH_RSS_IPV4 |\ -- 2.7.4