net/dpaa: fix jumbo buffer config
authorHemant Agrawal <hemant.agrawal@nxp.com>
Fri, 21 Sep 2018 11:05:51 +0000 (16:35 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 27 Sep 2018 23:41:02 +0000 (01:41 +0200)
Set the missing dev data mtu for the correct size.
Set the max supported size in hw, if user is asking for more.

Fixes: 9658ac3a4ef6 ("net/dpaa: set the correct frame size in device MTU")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/net/dpaa/dpaa_ethdev.c

index c1f1bf7..8c58515 100644 (file)
@@ -193,14 +193,24 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
        }
 
        if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
+               uint32_t max_len;
+
+               DPAA_PMD_DEBUG("enabling jumbo");
+
                if (dev->data->dev_conf.rxmode.max_rx_pkt_len <=
-                   DPAA_MAX_RX_PKT_LEN) {
-                       fman_if_set_maxfrm(dpaa_intf->fif,
-                               dev->data->dev_conf.rxmode.max_rx_pkt_len);
-                       return 0;
-               } else {
-                       return -1;
+                   DPAA_MAX_RX_PKT_LEN)
+                       max_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
+               else {
+                       DPAA_PMD_INFO("enabling jumbo override conf max len=%d "
+                               "supported is %d",
+                               dev->data->dev_conf.rxmode.max_rx_pkt_len,
+                               DPAA_MAX_RX_PKT_LEN);
+                       max_len = DPAA_MAX_RX_PKT_LEN;
                }
+
+               fman_if_set_maxfrm(dpaa_intf->fif, max_len);
+               dev->data->mtu = max_len
+                               - ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE;
        }
        return 0;
 }