summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQi Zhang <qi.z.zhang@intel.com>2019-03-27 19:38:50 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2019-04-12 11:02:02 +0200
commit50cc9d2a6e9de991e1fdcd639693a9d068ad91a6 (patch)
tree558ad566ada6461a5dcc43884d61956bba0d058e
parentb27669d691b15042333d472e2edc883046cd8c89 (diff)
downloaddpdk-50cc9d2a6e9de991e1fdcd639693a9d068ad91a6.zip
dpdk-50cc9d2a6e9de991e1fdcd639693a9d068ad91a6.tar.gz
dpdk-50cc9d2a6e9de991e1fdcd639693a9d068ad91a6.tar.xz
net/ice: fix max frame size
Max frame size setup should consider double VLAN case. Fixes: ae2bdd0219cb ("net/ice: support MTU setting") Cc: stable@dpdk.org Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
-rw-r--r--drivers/net/ice/ice_ethdev.c3
-rw-r--r--drivers/net/ice/ice_ethdev.h7
-rw-r--r--drivers/net/ice/ice_rxtx.c2
3 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9d01018..ff2f7b1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2206,8 +2206,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
{
struct ice_pf *pf = ICE_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 + ICE_VLAN_TAG_SIZE;
+ uint32_t frame_size = mtu + ICE_ETH_OVERHEAD;
/* check if mtu is within the allowed range */
if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX)
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 9c29f22..f3ed02e 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -117,6 +117,13 @@
ETH_RSS_NONFRAG_IPV6_OTHER | \
ETH_RSS_L2_PAYLOAD)
+/**
+ * The overhead from MTU to max frame size.
+ * Considering QinQ packet, the VLAN tag needs to be counted twice.
+ */
+#define ICE_ETH_OVERHEAD \
+ (ETHER_HDR_LEN + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
+
struct ice_adapter;
/**
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index f45b824..8ef6a2f 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -111,7 +111,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
RTE_PKTMBUF_HEADROOM);
/* Check if scattered RX needs to be used. */
- if ((rxq->max_pkt_len + 2 * ICE_VLAN_TAG_SIZE) > buf_size)
+ if (rxq->max_pkt_len > buf_size)
dev->data->scattered_rx = 1;
rxq->qrx_tail = hw->hw_addr + QRX_TAIL(rxq->reg_idx);