From: usamanadeem321 <usama.nad...@emumba.com>

Checks if IPV4, UDP and TCP Checksum offloads are available.
If not available, prints a warning message.

Bugzilla ID: 545
Signed-off-by: usamanadeem321 <usama.nad...@emumba.com>
---
 examples/l3fwd/main.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 00ac267af1..ae62bc570d 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -123,7 +123,6 @@ 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 +1038,27 @@ 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 {
+                       printf("WARNING: IPV4 Checksum offload not 
available.\n");
+               }
+
+               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

Reply via email to