From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1BCEA0C45; Mon, 13 Sep 2021 14:10:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2920540151; Mon, 13 Sep 2021 14:10:14 +0200 (CEST) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 0389E4014F for ; Mon, 13 Sep 2021 14:10:12 +0200 (CEST) Received: by mail-wm1-f45.google.com with SMTP id u19-20020a7bc053000000b002f8d045b2caso6436407wmc.1 for ; Mon, 13 Sep 2021 05:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LRRYsTYfup2AvYu3+uSnL39OOzrMyqdQ/MvR7JF9Csk=; b=kgKmF2FWvr/B/6KcSrTJ52G0oQj/bgj56RDXjhA6dYBa6prCERsMESsNiXDG2QwyCb lt7A5jQmcjXuO7YVU8gc0GC5zKVx1P1EsUs5bXaPbYFLZsYgaHUbuwjPuR/OuMw0unqV F9vCx+dMa15riJhIeao5YnFw2Yri74h6n7sg/ehaKx3Zv6ZrAdjrRKMzAW15NizB2Oqd SUJ3a2cealI0uIByQ34lLQ9HCIQjXSRVFUhCPTAPIG6kOFd13Su7xs3d4lmXaasG+ngs h7dmzRYeZyimS9QNRY6XrP+NJnLYRV8CN5tQCnv9LdaMdWH/YBiZh6JzitUb92Rj39Gj lkvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LRRYsTYfup2AvYu3+uSnL39OOzrMyqdQ/MvR7JF9Csk=; b=yHjHfw/CGx1/HwIQKXB6fMk5UejxVcxif1gZC1Dw1veFklAgtkFYZ7W05kAj2NZ7R5 E3lpPbpRU8dUvGBPBMVaNkWTukG/0TtTWbQ2FARrD74t+B1g8zurxHtNH9SxOzVIiFvj GyFiRrT8pkMryUmzL2wMP2KAb+NNy/c2kY5+dbw7pmPpXm1IFro1kUGm1d0DOlCQZco4 kBvbrUHir9FqR+LBdzPRqu9QfJlNJQP6QNe6cvVi45MJ3a6QIlVMEQ1JUIXcq+SPobak v4zskUrf7HyEG6gVyk/wDlSu1ru3Dn5EUQCkxs2fWwr+UXIvg0AJg6gW0DPaw80igDgn tl7Q== X-Gm-Message-State: AOAM530ouvRgv0wHIrBRbPce5ajEHaMfLe4Qvth84coZYVgR5KmGL0mG Hmes+pFOER/hxKh6h943OfSZ X-Google-Smtp-Source: ABdhPJwXHpzy51Cc31WNpxwoApy/jBSMoQ5Cb4pubxeHjiva4CUGvHAaTCSiXfOyPFWd1bBGQeeqmA== X-Received: by 2002:a7b:cbc6:: with SMTP id n6mr3422359wmi.118.1631535012646; Mon, 13 Sep 2021 05:10:12 -0700 (PDT) Received: from localhost.localdomain ([182.191.83.208]) by smtp.gmail.com with ESMTPSA id d17sm3700155wrp.57.2021.09.13.05.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 05:10:12 -0700 (PDT) From: usamanadeem321 To: thomas@monjalon.net Cc: dev@dpdk.org, usamanadeem321 Date: Mon, 13 Sep 2021 17:09:51 +0500 Message-Id: <20210913120951.103968-1-usama.nadeem@emumba.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] examples: ipv4, udp and tcp checksum offload warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Closes gracefully if IPV4 checksum offload is not available. Gives warning if UDP or TCP checksum offloads are not available. Signed-off-by: usamanadeem321 --- 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