net/dpaa2: align the frame size in MTU set
authorAshish Jain <ashish.jain@nxp.com>
Fri, 8 Dec 2017 05:21:22 +0000 (10:51 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
Setting correct frame size in dpaa2_dev_mtu_set
api call. Also correcting the correct max frame size
setting in hardware while dev_configure for jumbo frames

Signed-off-by: Ashish Jain <ashish.jain@nxp.com>
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
drivers/net/dpaa2/dpaa2_ethdev.c

index e5d3095..6649dac 100644 (file)
@@ -27,8 +27,8 @@
 #define SVR_LS2088A             0x87090000
 #define SVR_LX2160A             0x87360000
 
-#ifndef ETH_VLAN_HLEN
-#define ETH_VLAN_HLEN   4 /** < Vlan Header Length */
+#ifndef VLAN_TAG_SIZE
+#define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
 
 #define MAX_TX_RING_SLOTS      8
index 92e680f..25f1a45 100644 (file)
@@ -321,8 +321,8 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 
        if (eth_conf->rxmode.jumbo_frame == 1) {
                if (eth_conf->rxmode.max_rx_pkt_len <= DPAA2_MAX_RX_PKT_LEN) {
-                       ret = dpaa2_dev_mtu_set(dev,
-                                       eth_conf->rxmode.max_rx_pkt_len);
+                       ret = dpni_set_max_frame_length(dpni, CMD_PRI_LOW,
+                               priv->token, eth_conf->rxmode.max_rx_pkt_len);
                        if (ret) {
                                PMD_INIT_LOG(ERR,
                                             "unable to set mtu. check config\n");
@@ -974,7 +974,8 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        int ret;
        struct dpaa2_dev_priv *priv = dev->data->dev_private;
        struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw;
-       uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+       uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN
+                               + VLAN_TAG_SIZE;
 
        PMD_INIT_FUNC_TRACE();
 
@@ -992,11 +993,13 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        else
                dev->data->dev_conf.rxmode.jumbo_frame = 0;
 
+       dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
        /* Set the Max Rx frame length as 'mtu' +
         * Maximum Ethernet header length
         */
        ret = dpni_set_max_frame_length(dpni, CMD_PRI_LOW, priv->token,
-                                       mtu + ETH_VLAN_HLEN);
+                                       frame_size);
        if (ret) {
                PMD_DRV_LOG(ERR, "setting the max frame length failed");
                return -1;