[dpdk-dev,v2] net/i40e: consider QinQ when setting MTU
Checks
Commit Message
When counting max packet length from MTU, count
VLAN tag length twice for QinQ packets.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 3 +--
drivers/net/i40e/i40e_ethdev.h | 7 +++++++
drivers/net/i40e/i40e_ethdev_vf.c | 3 +--
3 files changed, 9 insertions(+), 4 deletions(-)
Comments
02/05/2017 03:51, Wenzhuo Lu:
> When counting max packet length from MTU, count
> VLAN tag length twice for QinQ packets.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Applied, thanks
@@ -10592,8 +10592,7 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct rte_eth_dev_data *dev_data = pf->dev_data;
- uint32_t frame_size = mtu + ETHER_HDR_LEN
- + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE;
+ uint32_t frame_size = mtu + I40E_ETH_OVERHEAD;
int ret = 0;
/* check if mtu is within the allowed range */
@@ -251,6 +251,13 @@ enum i40e_flxpld_layer_idx {
I40E_INSET_FLEX_PAYLOAD_W5 | I40E_INSET_FLEX_PAYLOAD_W6 | \
I40E_INSET_FLEX_PAYLOAD_W7 | I40E_INSET_FLEX_PAYLOAD_W8)
+/**
+ * The overhead from MTU to max frame size.
+ * Considering QinQ packet, the VLAN tag needs to be counted twice.
+ */
+#define I40E_ETH_OVERHEAD \
+ (ETHER_HDR_LEN + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
+
struct i40e_adapter;
/**
@@ -2687,8 +2687,7 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev)
{
struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct rte_eth_dev_data *dev_data = vf->dev_data;
- uint32_t frame_size = mtu + ETHER_HDR_LEN
- + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE;
+ uint32_t frame_size = mtu + I40E_ETH_OVERHEAD;
int ret = 0;
/* check if mtu is within the allowed range */