ethdev: allow maximum packet length to less than 1518
authorHelin Zhang <helin.zhang@intel.com>
Thu, 5 Jun 2014 05:08:51 +0000 (13:08 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 17 Jun 2014 16:21:36 +0000 (18:21 +0200)
In ethdev, it ignores setting maximum packet length to less than
1518. The changes is to remove this limitation and let less than
1518 can be set for 'maximum packet length'.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Jing Chen <jing.d.chen@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Heqing Zhu <heqing.zhu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
lib/librte_ether/rte_ethdev.c

index 42333ee..3d5d64c 100644 (file)
@@ -661,9 +661,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
                                (unsigned)ETHER_MIN_LEN);
                        return (-EINVAL);
                }
-       } else
-               /* Use default value */
-               dev->data->dev_conf.rxmode.max_rx_pkt_len = ETHER_MAX_LEN;
+       } else {
+               if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN ||
+                       dev_conf->rxmode.max_rx_pkt_len > ETHER_MAX_LEN)
+                       /* Use default value */
+                       dev->data->dev_conf.rxmode.max_rx_pkt_len =
+                                                       ETHER_MAX_LEN;
+       }
 
        /* multipe queue mode checking */
        diag = rte_eth_dev_check_mq_mode(port_id, nb_rx_q, nb_tx_q, dev_conf);