Closes gracefully if IPV4 checksum offload is not available. Gives warning if UDP or TCP checksum offloads are not available.
Signed-off-by: usamanadeem321 <usama.nad...@emumba.com> --- examples/l3fwd/main.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 00ac267af1..81e605700e 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -123,7 +123,7 @@ static struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, - .offloads = DEV_RX_OFFLOAD_CHECKSUM, + }, .rx_adv_conf = { .rss_conf = { @@ -1039,6 +1039,30 @@ l3fwd_poll_resource_setup(void) local_port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) + local_port_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_IPV4_CKSUM; + else { + rte_exit(EXIT_FAILURE, + "IPV4 Checksum offload not available. (port %u) ", + portid); + } + + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) + local_port_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_UDP_CKSUM; + + else + printf("WARNING: UDP Checksum offload not available.\n"); + + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) + local_port_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_TCP_CKSUM; + + else + printf("WARNING: TCP Checksum offload not available.\n"); + + local_port_conf.rx_adv_conf.rss_conf.rss_hf &= dev_info.flow_type_rss_offloads; -- 2.25.1