Skip to content

Commit 3a7a546

Browse files
authored
Merge pull request #207 from CESNET/dpdk-mtu-fix
Dpdk mtu fix
2 parents a4ab695 + 5f83fe4 commit 3a7a546

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

input/dpdk/dpdkDevice.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ void DpdkDevice::configurePort()
127127
if (rte_eth_dev_configure(m_portID, m_rxQueueCount, m_txQueueCount, &portConfig)) {
128128
throw PluginError("DpdkDevice::configurePort() has failed. Unable to configure interface");
129129
}
130+
if (rte_eth_dev_set_mtu(m_portID, m_mtuSize)) {
131+
throw PluginError("DpdkDevice::configurePort() has failed. Unable to set MTU (rte_eth_dev_set_mtu)");
132+
}
130133
}
131134

132135
rte_eth_conf DpdkDevice::createPortConfig()
@@ -163,6 +166,8 @@ rte_eth_conf DpdkDevice::createPortConfig()
163166
void DpdkDevice::initMemPools(uint16_t memPoolSize)
164167
{
165168
constexpr int MEMPOOL_CACHE_SIZE = 256;
169+
constexpr int VLAN_HDR_LEN = 4;
170+
const int max_packet_size = m_mtuSize + RTE_ETHER_HDR_LEN + VLAN_HDR_LEN;
166171

167172
m_memPools.reserve(m_rxQueueCount);
168173

@@ -174,7 +179,7 @@ void DpdkDevice::initMemPools(uint16_t memPoolSize)
174179
memPoolSize,
175180
MEMPOOL_CACHE_SIZE,
176181
0,
177-
std::max(m_mtuSize, (uint16_t)RTE_MBUF_DEFAULT_DATAROOM) + RTE_PKTMBUF_HEADROOM,
182+
std::max(max_packet_size, RTE_MBUF_DEFAULT_DATAROOM) + RTE_PKTMBUF_HEADROOM,
178183
rte_eth_dev_socket_id(m_portID));
179184
if (!memPool) {
180185
throw PluginError(

0 commit comments

Comments
 (0)