From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D5750A05D3 for ; Fri, 29 Mar 2019 18:52:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1E1A74CB5; Fri, 29 Mar 2019 18:52:42 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 541164C8D for ; Fri, 29 Mar 2019 18:52:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 10:52:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="138397012" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:52:29 -0700 From: Ferruh Yigit To: Wenzhuo Lu , Konstantin Ananyev Cc: dev@dpdk.org, Ian Stokes Date: Fri, 29 Mar 2019 17:52:16 +0000 Message-Id: <20190329175219.23831-4-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329175219.23831-1-ferruh.yigit@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> <20190329175219.23831-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 4/7] net/ixgbe: set min and max MTU for ixgbe devices 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190329175216.Fcuden6tFIV8poH3y6mphYcRznDs6CqX6-d3eGQDwwE@z> From: Ian Stokes This commit sets the min and max supported MTU values for ixgbe devices via the ixgbe_dev_info_get() function. Min MTU supported is set to ETHER_MIN_MTU and max mtu is calculated as the max packet length supported minus the transport overhead. To aid in these calculations a new MACRO 'IXGBE_ETH_OVERHEAD' has been introduced to consolidate overhead calculation and avoid duplication. Signed-off-by: Ian Stokes --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++- drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 97e10217d..60da3508c 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3748,6 +3748,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vmdq_pools = ETH_16_POOLS; else dev_info->max_vmdq_pools = ETH_64_POOLS; + dev_info->max_mtu = dev_info->max_rx_pktlen - IXGBE_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; dev_info->vmdq_queue_num = dev_info->max_rx_queues; dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | @@ -4939,7 +4941,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t maxfrs; struct ixgbe_hw *hw; struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t frame_size = mtu + IXGBE_ETH_OVERHEAD; struct rte_eth_dev_data *dev_data = dev->data; ixgbe_dev_info_get(dev, &dev_info); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 3fec61352..d1f61e85e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -101,6 +101,9 @@ #define IXGBE_5TUPLE_MAX_PRI 7 #define IXGBE_5TUPLE_MIN_PRI 1 +/* The overhead from MTU to max frame size. */ +#define IXGBE_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN) + /* bit of VXLAN tunnel type | 7 bits of zeros | 8 bits of zeros*/ #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE 0x8000 /* bit of NVGRE tunnel type | 7 bits of zeros | 8 bits of zeros*/ -- 2.20.1