summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stokes <ian.stokes@intel.com>2019-03-29 17:52:16 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 18:59:50 +0100
commit11e5f7a2b57fcd6763c1e3e77dda7886248e3b68 (patch)
treed6e77b1d28258f95584be8cd22edc35f97fc1b0f
parent92645b2ffd842a14c461376c1dca199121396cc5 (diff)
downloaddpdk-next-eventdev-11e5f7a2b57fcd6763c1e3e77dda7886248e3b68.zip
dpdk-next-eventdev-11e5f7a2b57fcd6763c1e3e77dda7886248e3b68.tar.gz
dpdk-next-eventdev-11e5f7a2b57fcd6763c1e3e77dda7886248e3b68.tar.xz
net/ixgbe: set min and max MTU
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 <ian.stokes@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--drivers/net/ixgbe/ixgbe_ethdev.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_ethdev.h3
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 97e1021..60da350 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 3fec613..d1f61e8 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*/