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 74C4CA0C43; Tue, 16 Nov 2021 06:21:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F43D4068C; Tue, 16 Nov 2021 06:21:23 +0100 (CET) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by mails.dpdk.org (Postfix) with ESMTP id E907040040 for ; Tue, 16 Nov 2021 06:21:21 +0100 (CET) Received: by mail-ed1-f50.google.com with SMTP id z10so55757911edc.11 for ; Mon, 15 Nov 2021 21:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6rfzfjREdkDmlc8kp/E3CZCqVxTfzLeaqpr/TZ3qmJo=; b=m9/vF+37PwMXx5IYTUkS/2SK6xTQQVz6sJqJeCoCXGsNXTko7AnGR+HJys2NoQJLPz dr201YMNK85p9ZpD+LfcchEIcxh1V+2cSFcUI5DityqdeZAMtua9KLz/7wvpyLT/LOo7 cAidUVdMPw2PVkTV+ozKTaUZMOwhCKEuFuIME1BPXLirNGV/TS45G2CXGq0CrxFOnB7J GFL0A58dv7khaPRPh5GfHVK2H8YxjGWLPUpbHfvRjfTQgHzGr8nNGMBLhskrf5ZEy89I Xekv3L02e+WhzplC4IOPSUk0ukiJ7ipD4ozjuBVAbm1NCEkF0nfJygBU6UF6NDs81l+9 b4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6rfzfjREdkDmlc8kp/E3CZCqVxTfzLeaqpr/TZ3qmJo=; b=gJ4L4nTbvzCuyjWYf+aZF8D1hOxi3S0rF324ifVhIpFlPnNn4KWBPuNacrBmsp7Y/k d04/aaLzN2wBrRFpwMSZCUCRAZnpSdOm1lubHXD7POPokqhOafzlOMjnBxVL0GFxSGFc N46oDvauVOaM6MV61KgNj7nBM/g72LV+fu8szVaT9fRmAusuYic/qYysRTWJZ2RiRKQ1 uSwBDnNWc4fe92EVwglBEL9sW54ukm/mvjSfQggOC23kpGzqYxLuLbleHi0EsWZS6X46 9KG7bGagNDwvE17W8CC9VBFWDdhHxJpVI4Fdmnsrn2XvyOTKbe/L4mRRs0vgyOYvl1dS M9vg== X-Gm-Message-State: AOAM532keobujef2Np+e6FnJJYfh8hvdBpNbK/5tl/FdMb8v12Fb6Zye Bnd3f2+GUrtN4d5FAygVLy+yFEKzJ11vLH+devRnFQLDfyzr X-Google-Smtp-Source: ABdhPJwh7FQIZgx49oPuY9/msnuZPAXTFDHiQWkpEGxHRbRQuitFsQzziTdn5BPDnlWBoo8vQsNm1nhHBFCcestafkc= X-Received: by 2002:a17:907:9152:: with SMTP id l18mr6185360ejs.382.1637040081697; Mon, 15 Nov 2021 21:21:21 -0800 (PST) MIME-Version: 1.0 References: <20211008155111.125786-1-usama.nadeem@emumba.com> <20211014184322.5148-1-usama.nadeem@emumba.com> In-Reply-To: From: Usama Nadeem Date: Tue, 16 Nov 2021 10:21:10 +0500 Message-ID: Subject: Re: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum verification through software To: "Walsh, Conor" Cc: "thomas@monjalon.net" , "dev@dpdk.org" , "Medvedkin, Vladimir" Content-Type: multipart/alternative; boundary="0000000000008d925605d0e118b9" 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 --0000000000008d925605d0e118b9 Content-Type: text/plain; charset="UTF-8" Hi Walsh, Conor , This, I agree, should be done for LPM, FIB, and EM. Only LPM is completed in this patch. For the time being, you can think about this one. I will look into FIB and EM in separate patches. Thanks -usama On Thu, Nov 4, 2021 at 4:11 PM Walsh, Conor wrote: > > From: dev On Behalf Of Usama Nadeem > > Sent: Thursday 14 October 2021 19:43 > > To: thomas@monjalon.net > > Cc: dev@dpdk.org; Usama Nadeem > > Subject: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum > > verification through software > > > > checks if ipv4 and udptcp cksum offload capability available > > If not available, cksum is verified through software > > If cksum is corrupt, packet is dropped, rest of the packets > > are forwarded back. > > > > Bugzilla ID:545 > > Signed-off-by: Usama Nadeem > > --- > > Hi Usama, > > This should be done in a generic way that allows all the lookup methods to > support it not just LPM. > check_software_cksum should go in a common file and be called from LPM, > FIB and possibly EM. > > Thanks, > Conor. > > > examples/l3fwd/l3fwd.h | 6 ++++ > > examples/l3fwd/l3fwd_lpm.c | 72 > > ++++++++++++++++++++++++++++++++++++-- > > examples/l3fwd/main.c | 33 +++++++++++++++-- > > 3 files changed, 105 insertions(+), 6 deletions(-) > > > > diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h > > index a808d60247..c2c21a91fb 100644 > > --- a/examples/l3fwd/l3fwd.h > > +++ b/examples/l3fwd/l3fwd.h > > @@ -55,6 +55,8 @@ > > #define L3FWD_HASH_ENTRIES (1024*1024*1) > > #endif > > #define HASH_ENTRY_NUMBER_DEFAULT 4 > > +extern bool l3_sft_cksum; > > +extern bool l4_sft_cksum; > > > > struct mbuf_table { > > uint16_t len; > > @@ -210,6 +212,10 @@ em_main_loop(__rte_unused void *dummy); > > int > > lpm_main_loop(__rte_unused void *dummy); > > > > +int > > +check_software_cksum(struct rte_mbuf **pkts_burst, > > +struct rte_mbuf **pkts_burst_to_send, int nb_rx); > > + > > int > > fib_main_loop(__rte_unused void *dummy); > > > > diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > > index 232b606b54..ecaf323943 100644 > > --- a/examples/l3fwd/l3fwd_lpm.c > > +++ b/examples/l3fwd/l3fwd_lpm.c > > @@ -26,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "l3fwd.h" > > #include "l3fwd_event.h" > > @@ -139,16 +140,65 @@ lpm_get_dst_port_with_ipv4(const struct > > lcore_conf *qconf, struct rte_mbuf *pkt, > > #include "l3fwd_lpm.h" > > #endif > > > > + > > +int check_software_cksum(struct rte_mbuf **pkts_burst, > > +struct rte_mbuf **pkts_burst_to_send, int nb_rx) > > +{ > > + int j; > > + int i = 0; > > + struct rte_net_hdr_lens hdr_lens; > > + struct rte_ipv4_hdr *ipv4_hdr; > > + void *l3_hdr; > > + void *l4_hdr; > > + rte_be16_t prev_cksum; > > + int dropped_pkts_udp_tcp = 0; > > + int dropped_pkts_ipv4 = 0; > > + bool dropped; > > + for (j = 0; j < nb_rx; j++) { > > + dropped = false; > > + rte_net_get_ptype(pkts_burst[j], &hdr_lens, > > RTE_PTYPE_ALL_MASK); > > + l3_hdr = rte_pktmbuf_mtod_offset(pkts_burst[j], > > + void *, hdr_lens.l2_len); > > + l4_hdr = rte_pktmbuf_mtod_offset(pkts_burst[j], > > + void *, hdr_lens.l2_len + hdr_lens.l3_len); > > + ipv4_hdr = l3_hdr; > > + prev_cksum = ipv4_hdr->hdr_checksum; > > + ipv4_hdr->hdr_checksum = 0; > > + ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); > > + > > + if (l3_sft_cksum && prev_cksum != ipv4_hdr- > > >hdr_checksum) { > > + rte_pktmbuf_free(pkts_burst[j]); > > + dropped_pkts_ipv4++; > > + dropped = true; > > + } else if (l4_sft_cksum && > > + rte_ipv4_udptcp_cksum_verify > > + (l3_hdr, l4_hdr) != 0) { > > + > > + rte_pktmbuf_free(pkts_burst[j]); > > + dropped_pkts_udp_tcp++; > > + dropped = true; > > + } > > + if (dropped == false) { > > + pkts_burst_to_send[i] = pkts_burst[j]; > > + i++; > > + } > > + > > + } > > + return dropped_pkts_udp_tcp+dropped_pkts_ipv4; > > +} > > + > > /* main processing loop */ > > int > > lpm_main_loop(__rte_unused void *dummy) > > { > > struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; > > + struct rte_mbuf *pkts_burst_to_send[MAX_PKT_BURST]; > > unsigned lcore_id; > > uint64_t prev_tsc, diff_tsc, cur_tsc; > > int i, nb_rx; > > uint16_t portid; > > uint8_t queueid; > > + int dropped; > > struct lcore_conf *qconf; > > const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / > > US_PER_S * BURST_TX_DRAIN_US; > > @@ -209,19 +259,35 @@ lpm_main_loop(__rte_unused void *dummy) > > if (nb_rx == 0) > > continue; > > > > + if (l3_sft_cksum || l4_sft_cksum) { > > + dropped = > > check_software_cksum(pkts_burst, > > + pkts_burst_to_send, nb_rx); > > + > > + nb_rx = nb_rx-dropped; > > + } > > + > > + > > #if defined RTE_ARCH_X86 || defined __ARM_NEON \ > > || defined RTE_ARCH_PPC_64 > > + if (l3_sft_cksum == false && l4_sft_cksum == false) > > l3fwd_lpm_send_packets(nb_rx, pkts_burst, > > portid, qconf); > > + else > > + l3fwd_lpm_send_packets(nb_rx, > > pkts_burst_to_send, > > + portid, qconf); > > + > > #else > > - l3fwd_lpm_no_opt_send_packets(nb_rx, > > pkts_burst, > > + if (l3_sft_cksum == false && l4_sft_cksum == false) > > + l3fwd_lpm_no_opt_send_packets(nb_rx, > > pkts_burst, > > portid, qconf); > > + else > > + l3fwd_lpm_no_opt_send_packets(nb_rx, > > + pkts_burst_to_send, portid, qconf); > > + > > #endif /* X86 */ > > } > > - > > cur_tsc = rte_rdtsc(); > > } > > - > > return 0; > > } > > > > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c > > index 00ac267af1..a54aca070d 100644 > > --- a/examples/l3fwd/main.c > > +++ b/examples/l3fwd/main.c > > @@ -61,6 +61,9 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; > > /**< Ports set in promiscuous mode off by default. */ > > static int promiscuous_on; > > > > +bool l3_sft_cksum; > > +bool l4_sft_cksum; > > + > > /* Select Longest-Prefix, Exact match or Forwarding Information Base. */ > > enum L3FWD_LOOKUP_MODE { > > L3FWD_LOOKUP_DEFAULT, > > @@ -123,7 +126,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 = { > > @@ -981,6 +983,7 @@ prepare_ptype_parser(uint16_t portid, uint16_t > > queueid) > > return 0; > > } > > > > + > > static void > > l3fwd_poll_resource_setup(void) > > { > > @@ -993,7 +996,8 @@ l3fwd_poll_resource_setup(void) > > unsigned int nb_ports; > > unsigned int lcore_id; > > int ret; > > - > > + l3_sft_cksum = false; > > + l4_sft_cksum = false; > > if (check_lcore_params() < 0) > > rte_exit(EXIT_FAILURE, "check_lcore_params failed\n"); > > > > @@ -1034,11 +1038,34 @@ l3fwd_poll_resource_setup(void) > > rte_exit(EXIT_FAILURE, > > "Error during getting device (port %u) > info: > > %s\n", > > portid, strerror(-ret)); > > - > > if (dev_info.tx_offload_capa & > > DEV_TX_OFFLOAD_MBUF_FAST_FREE) > > 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 { > > + l3_sft_cksum = true; > > + 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 { > > + l4_sft_cksum = true; > > + 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 { > > + l4_sft_cksum = true; > > + 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 > > -- -Usama --0000000000008d925605d0e118b9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Walsh, Conor= ,

This, I agree, should be done for LPM, F= IB, and EM. Only LPM is completed in this patch. For the time being, you ca= n think about this one. I will look into FIB and EM in separate patches.


Thanks
-usama

On Thu, Nov 4, 2021 = at 4:11 PM Walsh, Conor <conor.= walsh@intel.com> wrote:
> From: dev <dev-bounces@dpdk.org> On Behalf Of Usama Nadeem
> Sent: Thursday 14 October 2021 19:43
> To: thomas@mo= njalon.net
> Cc: dev@dpdk.org= ; Usama Nadeem <usama.nadeem@emumba.com>
> Subject: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum<= br> > verification through software
>
> checks if ipv4 and udptcp cksum offload capability available
> If not available, cksum is verified through software
> If cksum is corrupt, packet is dropped, rest of the packets
> are forwarded back.
>
> Bugzilla ID:545
> Signed-off-by: Usama Nadeem <usama.nadeem@emumba.com>
> ---

Hi Usama,

This should be done in a generic way that allows all the lookup methods to = support it not just LPM.
check_software_cksum should go in a common file and be called from LPM, FIB= and possibly EM.

Thanks,
Conor.

>=C2=A0 examples/l3fwd/l3fwd.h=C2=A0 =C2=A0 =C2=A0|=C2=A0 6 ++++
>=C2=A0 examples/l3fwd/l3fwd_lpm.c | 72
> ++++++++++++++++++++++++++++++++++++--
>=C2=A0 examples/l3fwd/main.c=C2=A0 =C2=A0 =C2=A0 | 33 +++++++++++++++--=
>=C2=A0 3 files changed, 105 insertions(+), 6 deletions(-)
>
> diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
> index a808d60247..c2c21a91fb 100644
> --- a/examples/l3fwd/l3fwd.h
> +++ b/examples/l3fwd/l3fwd.h
> @@ -55,6 +55,8 @@
>=C2=A0 #define L3FWD_HASH_ENTRIES=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(1024*1024*1)
>=C2=A0 #endif
>=C2=A0 #define HASH_ENTRY_NUMBER_DEFAULT=C2=A0 =C2=A0 4
> +extern bool l3_sft_cksum;
> +extern bool l4_sft_cksum;
>
>=C2=A0 struct mbuf_table {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t len;
> @@ -210,6 +212,10 @@ em_main_loop(__rte_unused void *dummy);
>=C2=A0 int
>=C2=A0 lpm_main_loop(__rte_unused void *dummy);
>
> +int
> +check_software_cksum(struct rte_mbuf **pkts_burst,
> +struct rte_mbuf **pkts_burst_to_send, int nb_rx);
> +
>=C2=A0 int
>=C2=A0 fib_main_loop(__rte_unused void *dummy);
>
> diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > index 232b606b54..ecaf323943 100644
> --- a/examples/l3fwd/l3fwd_lpm.c
> +++ b/examples/l3fwd/l3fwd_lpm.c
> @@ -26,6 +26,7 @@
>=C2=A0 #include <rte_udp.h>
>=C2=A0 #include <rte_lpm.h>
>=C2=A0 #include <rte_lpm6.h>
> +#include <rte_net.h>
>
>=C2=A0 #include "l3fwd.h"
>=C2=A0 #include "l3fwd_event.h"
> @@ -139,16 +140,65 @@ lpm_get_dst_port_with_ipv4(const struct
> lcore_conf *qconf, struct rte_mbuf *pkt,
>=C2=A0 #include "l3fwd_lpm.h"
>=C2=A0 #endif
>
> +
> +int check_software_cksum(struct rte_mbuf **pkts_burst,
> +struct rte_mbuf **pkts_burst_to_send, int nb_rx)
> +{
> +=C2=A0 =C2=A0 =C2=A0int j;
> +=C2=A0 =C2=A0 =C2=A0int i =3D 0;
> +=C2=A0 =C2=A0 =C2=A0struct rte_net_hdr_lens hdr_lens;
> +=C2=A0 =C2=A0 =C2=A0struct rte_ipv4_hdr *ipv4_hdr;
> +=C2=A0 =C2=A0 =C2=A0void *l3_hdr;
> +=C2=A0 =C2=A0 =C2=A0void *l4_hdr;
> +=C2=A0 =C2=A0 =C2=A0rte_be16_t prev_cksum;
> +=C2=A0 =C2=A0 =C2=A0int dropped_pkts_udp_tcp =3D 0;
> +=C2=A0 =C2=A0 =C2=A0int dropped_pkts_ipv4 =3D 0;
> +=C2=A0 =C2=A0 =C2=A0bool dropped;
> +=C2=A0 =C2=A0 =C2=A0for (j =3D 0; j < nb_rx; j++) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dropped =3D false; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_net_get_ptype(pkt= s_burst[j], &hdr_lens,
> RTE_PTYPE_ALL_MASK);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0l3_hdr =3D rte_pktmbu= f_mtod_offset(pkts_burst[j],
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void *, hdr_lens.l2_l= en);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0l4_hdr =3D rte_pktmbu= f_mtod_offset(pkts_burst[j],
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void *, hdr_lens.l2_l= en + hdr_lens.l3_len);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ipv4_hdr =3D l3_hdr;<= br> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0prev_cksum =3D ipv4_h= dr->hdr_checksum;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ipv4_hdr->hdr_chec= ksum =3D 0;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ipv4_hdr->hdr_chec= ksum =3D rte_ipv4_cksum(ipv4_hdr);
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (l3_sft_cksum &= ;& prev_cksum !=3D ipv4_hdr-
> >hdr_checksum) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0rte_pktmbuf_free(pkts_burst[j]);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0dropped_pkts_ipv4++;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0dropped =3D true;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (l4_sft_cks= um &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_ipv4_udptcp_cksum_verify
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(l3_hdr, l4_hdr) !=3D 0) {
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0rte_pktmbuf_free(pkts_burst[j]);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0dropped_pkts_udp_tcp++;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0dropped =3D true;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (dropped =3D=3D fa= lse) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0pkts_burst_to_send[i] =3D pkts_burst[j];
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0i++;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> +
> +=C2=A0 =C2=A0 =C2=A0}
> +=C2=A0 =C2=A0 =C2=A0return dropped_pkts_udp_tcp+dropped_pkts_ipv4; > +}
> +
>=C2=A0 /* main processing loop */
>=C2=A0 int
>=C2=A0 lpm_main_loop(__rte_unused void *dummy)
>=C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0struct rte_mbuf *pkts_burst[MAX_PKT_BURST];<= br> > +=C2=A0 =C2=A0 =C2=A0struct rte_mbuf *pkts_burst_to_send[MAX_PKT_BURST= ];
>=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned lcore_id;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t prev_tsc, diff_tsc, cur_tsc;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int i, nb_rx;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t portid;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint8_t queueid;
> +=C2=A0 =C2=A0 =C2=A0int dropped;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0struct lcore_conf *qconf;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0const uint64_t drain_tsc =3D (rte_get_tsc_hz= () + US_PER_S - 1) /
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0US_PER_S * BURST= _TX_DRAIN_US;
> @@ -209,19 +259,35 @@ lpm_main_loop(__rte_unused void *dummy)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0if (nb_rx =3D=3D 0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue;
>
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0if (l3_sft_cksum || l4_sft_cksum) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dropped =3D
> check_software_cksum(pkts_burst,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pkts_burst_to_send,=C2=A0 =C2=A0 =C2=A0n= b_rx);
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0nb_rx =3D nb_rx-dropped;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0}
> +
> +
>=C2=A0 #if defined RTE_ARCH_X86 || defined __ARM_NEON \
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 || defined RTE_ARCH_PPC_64
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (l3_sft_cksum =3D= =3D false && l4_sft_cksum =3D=3D false)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0l3fwd_lpm_send_packets(nb_rx, pkts_burst,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0portid, qconf);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0l3fwd_lpm_send_packets(nb_rx,
> pkts_burst_to_send,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0portid, qconf);
> +
>=C2=A0 #else
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0l3fwd_lpm_no_opt_send_packets(nb_rx,
> pkts_burst,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0if (l3_sft_cksum =3D=3D false && l4_sft_cksum =3D=3D false)<= br> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0l3fwd_lpm_no_opt_send_packets(nb_rx,
> pkts_burst,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0portid, qconf);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0else
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0l3fwd_lpm_no_opt_send_packets(nb_rx,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pkts_burst_to_send, portid, qconf);
> +
>=C2=A0 #endif /* X86 */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cur_tsc =3D rte_= rdtsc();
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -
>=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
>=C2=A0 }
>
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 00ac267af1..a54aca070d 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -61,6 +61,9 @@ static uint16_t nb_txd =3D RTE_TEST_TX_DESC_DEFAULT;=
>=C2=A0 /**< Ports set in promiscuous mode off by default. */
>=C2=A0 static int promiscuous_on;
>
> +bool l3_sft_cksum;
> +bool l4_sft_cksum;
> +
>=C2=A0 /* Select Longest-Prefix, Exact match or Forwarding Information = Base. */
>=C2=A0 enum L3FWD_LOOKUP_MODE {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0L3FWD_LOOKUP_DEFAULT,
> @@ -123,7 +126,6 @@ static struct rte_eth_conf port_conf =3D {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.mq_mode =3D ETH= _MQ_RX_RSS,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.max_rx_pkt_len = =3D RTE_ETHER_MAX_LEN,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.split_hdr_size = =3D 0,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.offloads =3D DEV_RX_= OFFLOAD_CHECKSUM,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0},
>=C2=A0 =C2=A0 =C2=A0 =C2=A0.rx_adv_conf =3D {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.rss_conf =3D {<= br> > @@ -981,6 +983,7 @@ prepare_ptype_parser(uint16_t portid, uint16_t
> queueid)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
>=C2=A0 }
>
> +
>=C2=A0 static void
>=C2=A0 l3fwd_poll_resource_setup(void)
>=C2=A0 {
> @@ -993,7 +996,8 @@ l3fwd_poll_resource_setup(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int nb_ports;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int lcore_id;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0int ret;
> -
> +=C2=A0 =C2=A0 =C2=A0l3_sft_cksum =3D false;
> +=C2=A0 =C2=A0 =C2=A0l4_sft_cksum =3D false;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (check_lcore_params() < 0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_exit(EXIT_FA= ILURE, "check_lcore_params failed\n");
>
> @@ -1034,11 +1038,34 @@ l3fwd_poll_resource_setup(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0rte_exit(EXIT_FAILURE,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"Error during getting device = (port %u) info:
> %s\n",
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0portid, strerror(-ret));
> -
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (dev_info.tx_= offload_capa &
> DEV_TX_OFFLOAD_MBUF_FAST_FREE)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0local_port_conf.txmode.offloads |=3D
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DEV_TX_OFFLOAD_MBUF_FAST_FREE;
>
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (dev_info.rx_offlo= ad_capa &
> DEV_RX_OFFLOAD_IPV4_CKSUM)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0local_port_conf.rxmode.offloads |=3D
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0DEV_RX_OFFLOAD_IPV4_CKSUM;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0l3_sft_cksum =3D true;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0printf("WARNING: IPV4 checksum offload not
> available.\n");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0}
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (dev_info.rx_offlo= ad_capa &
> DEV_RX_OFFLOAD_UDP_CKSUM)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0local_port_conf.rxmode.offloads |=3D
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DEV_RX_OFFLOAD_UDP_CKSUM;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0l4_sft_cksum =3D true;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0printf("WARNING: UDP checksum offload not
> available.\n");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (dev_info.rx_offlo= ad_capa &
> DEV_RX_OFFLOAD_TCP_CKSUM)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0local_port_conf.rxmode.offloads |=3D
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DEV_RX_OFFLOAD_TCP_CKSUM;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0l4_sft_cksum =3D true;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0printf("WARNING: TCP checksum offload not
> available.\n");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> +
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local_port_conf.= rx_adv_conf.rss_conf.rss_hf &=3D
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0dev_info.flow_type_rss_offloads;
>
> --
> 2.25.1



--
-Usama
--0000000000008d925605d0e118b9--