Skip to content

Commit

Permalink
Compatibility with DPDK 21.11
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbette committed Nov 28, 2021
1 parent 6566ce5 commit d1233fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/dpdkdevice.cc
Expand Up @@ -779,14 +779,22 @@ also ETH_TXQ_FLAGS_NOMULTMEMP
i, port_id, numa_node);

if (info.init_mtu != 0) {
#if RTE_VERSION >= RTE_VERSION_NUM(21,11,0,0)
if (dev_conf.rxmode.mtu < info.init_mtu) {
dev_conf.rxmode.mtu = info.init_mtu;
}
#else
if (dev_conf.rxmode.max_rx_pkt_len < info.init_mtu) {
dev_conf.rxmode.max_rx_pkt_len = info.init_mtu;
}
#endif
if (rte_eth_dev_set_mtu(port_id, info.init_mtu) != 0) {
return errh->error("Could not set MTU %d",info.init_mtu);
}
} else {
#if RTE_VERSION >= RTE_VERSION_NUM(19,8,0,0)
#if RTE_VERSION >= RTE_VERSION_NUM(21,11,0,0)
dev_conf.rxmode.mtu = RTE_ETHER_MTU;
#elif RTE_VERSION >= RTE_VERSION_NUM(19,8,0,0)
dev_conf.rxmode.max_rx_pkt_len = RTE_ETHER_MAX_LEN;
#else
dev_conf.rxmode.max_rx_pkt_len = ETHER_MAX_LEN;
Expand Down Expand Up @@ -936,13 +944,20 @@ also ETH_TXQ_FLAGS_NOMULTMEMP
}
#endif

#if RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0)
#if RTE_VERSION >= RTE_VERSION_NUM(21,11,0,0)
if (info.jumbo) {
if (dev_conf.rxmode.mtu < dev_info.max_rx_pktlen) {
return errh->error("Rx jumbo frame offload is not supported by this device!");
}
}
#elif RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0)
if (info.jumbo) {
#if RTE_VERSION >= RTE_VERSION_NUM(19,8,0,0)
unsigned int min_rx_pktlen = (unsigned int) RTE_ETHER_MIN_LEN;
#else
unsigned int min_rx_pktlen = (unsigned int) ETHER_MIN_LEN;
#endif

if (!(dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME)) {
return errh->error("Rx jumbo frame offload is not supported by this device!");
} else {
Expand All @@ -953,7 +968,6 @@ also ETH_TXQ_FLAGS_NOMULTMEMP
}
dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
}
errh->message("Rx jumbo frames offloading enabled on port_id=%u with max_rx_pkt_len %u in [%u, %u]\n", port_id, dev_conf.rxmode.max_rx_pkt_len, min_rx_pktlen, dev_info.max_rx_pktlen);
} else {
dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
}
Expand Down
5 changes: 5 additions & 0 deletions userlevel/rte_parse.mk
Expand Up @@ -19,6 +19,7 @@ ${PARSE_PATH}.sentinel:
cp -u $(RTE_SDK)/app/test-pmd/config.c $(PARSE_PATH)
# Strip the main function off to prevent complilation errors, while linking with Click
sed -i '/main(int/Q' $(PARSE_PATH)/testpmd.c
sed -i 's/rte_os_shim/rte_os/' $(PARSE_PATH)/testpmd.c
head -n -1 $(PARSE_PATH)/testpmd.c > $(PARSE_PATH)/testpmd_t.c;
mv $(PARSE_PATH)/testpmd_t.c $(PARSE_PATH)/testpmd.c
# Strip off testpmd report messages as our library prints its own report messages
Expand Down Expand Up @@ -49,6 +50,10 @@ PARSE_OBJS += test-pmd/noisy_vnf.o test-pmd/util.o
ifeq ($(shell [ -n "$(RTE_VER_YEAR)" ] && ( ( [ "$(RTE_VER_YEAR)" -ge 20 ] && [ "$(RTE_VER_MONTH)" -ge 08 ] ) || [ $(RTE_VER_YEAR) -ge 21 ] ) && echo true),true)
PARSE_OBJS += test-pmd/5tswap.o
endif
ifeq ($(shell [ -n "$(RTE_VER_YEAR)" ] && ( ( [ "$(RTE_VER_YEAR)" -ge 21 ] && [ "$(RTE_VER_MONTH)" -ge 11 ] ) || [ $(RTE_VER_YEAR) -ge 22 ] ) && echo true),true)
PARSE_OBJS += test-pmd/shared_rxq_fwd.o test-pmd/cmd_flex_item.o
endif


CFLAGS += -I../lib/librte_parse_$(RTE_VERSION)
CXXFLAGS += -I../lib/librte_parse_$(RTE_VERSION)
Expand Down

0 comments on commit d1233fd

Please sign in to comment.