summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stokes <ian.stokes@intel.com>2019-03-29 17:52:18 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 19:00:35 +0100
commitae35fd61fce131989a5441eb7fc7272a15762be1 (patch)
tree324f17a192809e0b704d4174c2a3c68648be5de4
parent29350891c34f9d45bc27a9313079af71a4a40a40 (diff)
downloaddpdk-next-eventdev-ae35fd61fce131989a5441eb7fc7272a15762be1.zip
dpdk-next-eventdev-ae35fd61fce131989a5441eb7fc7272a15762be1.tar.gz
dpdk-next-eventdev-ae35fd61fce131989a5441eb7fc7272a15762be1.tar.xz
net/e1000: set min and max MTU
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 <ian.stokes@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--drivers/net/e1000/e1000_ethdev.h6
-rw-r--r--drivers/net/e1000/igb_ethdev.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 94edff0..3e74cd8 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 87c9aed..b897e8a 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);