DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ian Stokes <ian.stokes@intel.com>
To: dev@dpdk.org
Cc: stephen@networkplumber.org, Ian Stokes <ian.stokes@intel.com>
Subject: [dpdk-dev] [RFC 4/6] net/ixgbe: set min and max MTU for ixgbe devices
Date: Wed, 20 Feb 2019 15:57:53 +0000	[thread overview]
Message-ID: <1550678275-4959-5-git-send-email-ian.stokes@intel.com> (raw)
In-Reply-To: <1550678275-4959-1-git-send-email-ian.stokes@intel.com>

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>
---
 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 749311048..c4f6ff5bd 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3734,6 +3734,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) |
@@ -4925,7 +4927,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 565c69c9e..2217be30c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -100,6 +100,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.13.6

  parent reply	other threads:[~2019-02-20 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 15:57 [dpdk-dev] [RFC 0/6] ethdev: add min/max MTU to device info Ian Stokes
2019-02-20 15:57 ` [dpdk-dev] [RFC 1/6] " Ian Stokes
2019-02-25  7:40   ` Andrew Rybchenko
2019-02-27 21:48     ` Ian Stokes
2019-02-20 15:57 ` [dpdk-dev] [RFC 2/6] net/i40e: set min and max MTU for i40e devices Ian Stokes
2019-02-20 15:57 ` [dpdk-dev] [RFC 3/6] net/i40e: set min and max MTU for i40e VF devices Ian Stokes
2019-02-20 15:57 ` Ian Stokes [this message]
2019-02-20 15:57 ` [dpdk-dev] [RFC 5/6] net/ixgbe: set min and max MTU for ixgbe " Ian Stokes
2019-02-20 15:57 ` [dpdk-dev] [RFC 6/6] net/e1000: set min and max MTU for igb devices Ian Stokes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550678275-4959-5-git-send-email-ian.stokes@intel.com \
    --to=ian.stokes@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).