From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by dpdk.org (Postfix) with ESMTP id C8AA9325A for ; Tue, 20 Jun 2017 13:38:01 +0200 (CEST) Received: by mail-it0-f65.google.com with SMTP id 185so15114934itv.3 for ; Tue, 20 Jun 2017 04:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jT+fEBYN6hVxuXVr0mBAsFe9+DFD0w+6tFPDamVQ9lE=; b=iFIcN4OlURWJNtL09TLFxiY0DgNVHgJ/N8YgPONdYzzWb2Cs0WB1eA2Eb5CcD26686 wkPe+nXLqTIs2gQzdgtZ52l6M4FOEj9F1hIlKvP72Jln88rz0Qg5N/TuIf7TLCVp6yUx n/PmWq/Xm5vIucFphNTJBZgFZ6dZgEnP2xcHGjIgMI4+mosd/A6qUU767nCgr4XY59lC dGFlm6+NDPDIYbEISUG00YclZwoRraa82pftGhDQL5arEa+zYLzFVqhYF76R6S6ysLUS Mwh9jzJj3dCal0548QFxBXUf+FloaA49i+ZRrs0s5CjHWn5Nk3SIA2RQxZGuw6zzu7WT fUJw== 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=jT+fEBYN6hVxuXVr0mBAsFe9+DFD0w+6tFPDamVQ9lE=; b=KPaBdLGlLWmeV/p3kJiUS4DJZrxTXEZ9jpKmXrvAXRFl4F7XHqmbwMTP6R6mSk1VpZ 0H9d5hIEjbkcAjoPf6xitm6hZkPaLfOZMTGERxPld4QrQbnRMNDUxyQu0ycmb/dczq3u ZGhPIfl0N7Lq0jOijz/KwcSUDiD2pyXHFI5U3ZGx2Dw1U9HsRd6AzunPfvwmlKKlJPLm XkLYrVms1fIfVgd8JbdLqTteT2kBFhVoaU+VYIwNlVrgrGv4bq26PmYw4MCsejnt5Ix9 4w35bN+6Y3xMM7K9gPs109PyLEY4nW60ZpzZErmMiD+tbvOl3c9Lmn3tTYtqgxnZ3Cui 5KZA== X-Gm-Message-State: AKS2vOwUf48bkDPPFmcgqVMUSguqrgIrx4K67t+sMHMP7ObM5kUHRx0Y H4q5hE3Zlspn32HuYofefg== X-Received: by 10.84.211.103 with SMTP id b94mr22247061pli.230.1497958681237; Tue, 20 Jun 2017 04:38:01 -0700 (PDT) Received: from yliu-home.localdomain ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id 25sm6104783pfj.59.2017.06.20.04.37.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 04:38:00 -0700 (PDT) From: Yuanhan Liu To: Shijith Thotton Cc: dpdk stable Date: Tue, 20 Jun 2017 19:35:41 +0800 Message-Id: <1497958550-13600-29-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497958550-13600-1-git-send-email-yliu@fridaylinux.org> References: <1497958550-13600-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/liquidio: fix MTU calculation from port configuration' has been queued to stable release 17.05.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: Tue, 20 Jun 2017 11:38:02 -0000 Hi, FYI, your patch has been queued to stable release 17.05.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 06/22/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 4cc4cd67f6cf6863d2bfa646eb9aa2f9dce711fa Mon Sep 17 00:00:00 2001 From: Shijith Thotton Date: Tue, 6 Jun 2017 16:34:34 +0530 Subject: [PATCH] net/liquidio: fix MTU calculation from port configuration [ upstream commit dc7037ba73f84c8bc5923813e0398f3c1c28de9d ] max_rx_pkt_len member of port RX configuration indicates max frame length. Ethernet header and CRC length should be subtracted from it to find MTU. Fixes: 605164c8e79d ("net/liquidio: add API to validate VF MTU") Signed-off-by: Shijith Thotton --- drivers/net/liquidio/lio_ethdev.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 269a5f2..c7f1fb6 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "lio_logs.h" #include "lio_23xx_vf.h" @@ -1348,7 +1349,8 @@ lio_sync_link_state_check(void *eth_dev) static int lio_dev_start(struct rte_eth_dev *eth_dev) { - uint16_t mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + uint16_t mtu; + uint32_t frame_len = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; struct lio_device *lio_dev = LIO_DEV(eth_dev); uint16_t timeout = LIO_MAX_CMD_TIMEOUT; int ret = 0; @@ -1386,12 +1388,29 @@ lio_dev_start(struct rte_eth_dev *eth_dev) goto dev_mtu_check_error; } + if (eth_dev->data->dev_conf.rxmode.jumbo_frame == 1) { + if (frame_len <= ETHER_MAX_LEN || + frame_len > LIO_MAX_RX_PKTLEN) { + lio_dev_err(lio_dev, "max packet length should be >= %d and < %d when jumbo frame is enabled\n", + ETHER_MAX_LEN, LIO_MAX_RX_PKTLEN); + ret = -EINVAL; + goto dev_mtu_check_error; + } + mtu = (uint16_t)(frame_len - ETHER_HDR_LEN - ETHER_CRC_LEN); + } else { + /* default MTU */ + mtu = ETHER_MTU; + eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = ETHER_MAX_LEN; + } + if (lio_dev->linfo.link.s.mtu != mtu) { ret = lio_dev_validate_vf_mtu(eth_dev, mtu); if (ret) goto dev_mtu_check_error; } + eth_dev->data->mtu = mtu; + return 0; dev_mtu_check_error: -- 2.7.4