summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJurek Matuszewski <jurekm@cisco.com>2016-03-28 15:15:15 -0400
committerGerrit Code Review <gerrit@fd.io>2016-03-29 08:59:46 +0000
commita69318b7f72cf32df32f2744e4a386a8274094de (patch)
treee0a0a7af563278dbe3eeacc981844e24e6850e94
parentad8b4728cbe40057f9a5809cdb0cd5adc629ad67 (diff)
Increment MRU if hardware supports CRC stripping
Change-Id: I46bd007c3c75e5fb872c1beba557e6140fa8d715 Signed-off-by: Todd Foggoa (tfoggoa) <tfoggoa@cisco.com>
-rw-r--r--vnet/vnet/devices/dpdk/init.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 8bb253a3a66..d57f6c1a594 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -472,9 +472,33 @@ dpdk_lib_init (dpdk_main_t * dm)
* Otherwise rte_eth_dev_configure() will fail and the port will
* not be available.
*/
- xd->port_conf.rxmode.max_rx_pkt_len =
- (ETHERNET_MAX_PACKET_BYTES > dev_info.max_rx_pktlen) ?
- dev_info.max_rx_pktlen : ETHERNET_MAX_PACKET_BYTES;
+ if (ETHERNET_MAX_PACKET_BYTES > dev_info.max_rx_pktlen)
+ {
+ /*
+ * This device does not support the platforms's max frame
+ * size. Use it's advertised mru instead.
+ */
+ xd->port_conf.rxmode.max_rx_pkt_len = dev_info.max_rx_pktlen;
+ }
+ else
+ {
+ xd->port_conf.rxmode.max_rx_pkt_len = ETHERNET_MAX_PACKET_BYTES;
+
+ /*
+ * Some platforms do not account for Ethernet FCS (4 bytes) in
+ * MTU calculations. To interop with them increase mru but only
+ * if the device's settings can support it.
+ */
+ if ((dev_info.max_rx_pktlen >= (ETHERNET_MAX_PACKET_BYTES + 4)) &&
+ xd->port_conf.rxmode.hw_strip_crc)
+ {
+ /*
+ * Allow additional 4 bytes (for Ethernet FCS). These bytes are
+ * stripped by h/w and so will not consume any buffer memory.
+ */
+ xd->port_conf.rxmode.max_rx_pkt_len += 4;
+ }
+ }
/*
* DAW-FIXME: VMXNET3 driver doesn't support jumbo / multi-buffer pkts