From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 8CD8A1B5DB for ; Fri, 22 Mar 2019 14:01:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2019 06:01:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="284955648" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by orsmga004.jf.intel.com with ESMTP; 22 Mar 2019 06:01:35 -0700 From: Ian Stokes To: dev@dpdk.org Cc: stephen@networkplumber.org, Ian Stokes Date: Fri, 22 Mar 2019 13:01:17 +0000 Message-Id: <1553259678-4515-7-git-send-email-ian.stokes@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> Subject: [dpdk-dev] [PATCH v2 6/7] net/e1000: set min and max MTU for igb 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: , X-List-Received-Date: Fri, 22 Mar 2019 13:01:38 -0000 This commit sets the min and max supported MTU values for igb devices via the eth_igb_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 'E1000_ETH_OVERHEAD' has been introduced to consolidate overhead calculation and avoid duplication. Signed-off-by: Ian Stokes --- drivers/net/e1000/e1000_ethdev.h | 6 ++++++ drivers/net/e1000/igb_ethdev.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 94edff08e..3e74cd8fe 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -89,6 +89,12 @@ ETH_RSS_IPV6_UDP_EX) /* + * The overhead from MTU to max frame size. + * Considering VLAN so a tag needs to be counted. + */ +#define E1000_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE) + +/* * Maximum number of Ring Descriptors. * * Since RDLEN/TDLEN should be multiple of 128 bytes, the number of ring diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 87c9aedf2..b897e8ad4 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2283,6 +2283,10 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa = ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G; + + dev_info->max_mtu = dev_info->max_rx_pktlen - E1000_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; + } static const uint32_t * @@ -4466,8 +4470,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t rctl; struct e1000_hw *hw; struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + - VLAN_TAG_SIZE); + uint32_t frame_size = mtu + E1000_ETH_OVERHEAD; hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- 2.13.6 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 1045AA00E6 for ; Fri, 22 Mar 2019 14:02:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE7561B5F1; Fri, 22 Mar 2019 14:01:45 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 8CD8A1B5DB for ; Fri, 22 Mar 2019 14:01:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2019 06:01:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="284955648" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by orsmga004.jf.intel.com with ESMTP; 22 Mar 2019 06:01:35 -0700 From: Ian Stokes To: dev@dpdk.org Cc: stephen@networkplumber.org, Ian Stokes Date: Fri, 22 Mar 2019 13:01:17 +0000 Message-Id: <1553259678-4515-7-git-send-email-ian.stokes@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> References: <1553259678-4515-1-git-send-email-ian.stokes@intel.com> Subject: [dpdk-dev] [PATCH v2 6/7] net/e1000: set min and max MTU for igb 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: <20190322130117.fRQaaT6YpMOA-kjO7vxgGlIjVRrlFoSWafi3GuZVpIg@z> This commit sets the min and max supported MTU values for igb devices via the eth_igb_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 'E1000_ETH_OVERHEAD' has been introduced to consolidate overhead calculation and avoid duplication. Signed-off-by: Ian Stokes --- drivers/net/e1000/e1000_ethdev.h | 6 ++++++ drivers/net/e1000/igb_ethdev.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 94edff08e..3e74cd8fe 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -89,6 +89,12 @@ ETH_RSS_IPV6_UDP_EX) /* + * The overhead from MTU to max frame size. + * Considering VLAN so a tag needs to be counted. + */ +#define E1000_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE) + +/* * Maximum number of Ring Descriptors. * * Since RDLEN/TDLEN should be multiple of 128 bytes, the number of ring diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 87c9aedf2..b897e8ad4 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2283,6 +2283,10 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa = ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G; + + dev_info->max_mtu = dev_info->max_rx_pktlen - E1000_ETH_OVERHEAD; + dev_info->min_mtu = ETHER_MIN_MTU; + } static const uint32_t * @@ -4466,8 +4470,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t rctl; struct e1000_hw *hw; struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + - VLAN_TAG_SIZE); + uint32_t frame_size = mtu + E1000_ETH_OVERHEAD; hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- 2.13.6