aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device/common.c')
-rw-r--r--src/plugins/dpdk/device/common.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index f77e377e14c..c32382a55c6 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -48,6 +48,7 @@ dpdk_device_setup (dpdk_device_t * xd)
vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, xd->hw_if_index);
struct rte_eth_dev_info dev_info;
u64 bitmap;
+ u16 mtu;
int rv;
int j;
@@ -89,6 +90,12 @@ dpdk_device_setup (dpdk_device_t * xd)
xd->port_conf.rxmode.offloads ^= bitmap;
}
+ if (xd->port_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
+ xd->port_conf.rxmode.max_rx_pkt_len =
+ clib_min (ETHERNET_MAX_PACKET_BYTES, dev_info.max_rx_pktlen);
+ else
+ xd->port_conf.rxmode.max_rx_pkt_len = 0;
+
rv = rte_eth_dev_configure (xd->port_id, xd->conf.n_rx_queues,
xd->conf.n_tx_queues, &xd->port_conf);
@@ -98,6 +105,21 @@ dpdk_device_setup (dpdk_device_t * xd)
goto error;
}
+ rte_eth_dev_get_mtu (xd->port_id, &mtu);
+ dpdk_log_debug ("[%u] device default mtu %u", xd->port_id, mtu);
+
+ hi->max_supported_packet_bytes = mtu;
+ if (hi->max_packet_bytes > mtu)
+ {
+ vnet_hw_interface_set_mtu (vnm, xd->hw_if_index, mtu);
+ }
+ else
+ {
+ rte_eth_dev_set_mtu (xd->port_id, hi->max_packet_bytes);
+ dpdk_log_debug ("[%u] port mtu set to %u", xd->port_id,
+ hi->max_packet_bytes);
+ }
+
vec_validate_aligned (xd->tx_queues, xd->conf.n_tx_queues - 1,
CLIB_CACHE_LINE_BYTES);
for (j = 0; j < xd->conf.n_tx_queues; j++)
@@ -144,7 +166,6 @@ dpdk_device_setup (dpdk_device_t * xd)
if (vec_len (xd->errors))
goto error;
- rte_eth_dev_set_mtu (xd->port_id, hi->max_packet_bytes);
xd->buffer_flags =
(VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_EXT_HDR_VALID);