DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: Conor Walsh <conor.walsh@intel.com>,
	jerinj@marvell.com, stephen@networkplumber.org,
	bernard.iremonger@intel.com, konstantin.ananyev@intel.com,
	anatoly.burakov@intel.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v4 4/5] examples/l3fwd: implement FIB lookup method
Date: Fri, 12 Mar 2021 18:56:45 +0000	[thread overview]
Message-ID: <3a9b25b8-6053-c236-bc61-1870f09adfd3@intel.com> (raw)
In-Reply-To: <20210311120153.186213-5-conor.walsh@intel.com>

Hi Conor,

see comment inlined

On 11/03/2021 12:01, Conor Walsh wrote:
> This patch implements the Forwarding Information Base (FIB) library
> in l3fwd using the function calls and infrastructure introduced in
> the previous patch.
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
>   examples/l3fwd/l3fwd_fib.c | 482 ++++++++++++++++++++++++++++++++++++-
>   1 file changed, 476 insertions(+), 6 deletions(-)
> 

<snip>

> +/* Bulk parse, fib lookup and send. */
> +static inline void
> +fib_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
> +		uint16_t portid, struct lcore_conf *qconf)
> +{
> +	uint32_t ipv4_arr[nb_rx];
> +	uint8_t ipv6_arr[nb_rx][RTE_FIB6_IPV6_ADDR_SIZE];
> +	uint16_t hops[nb_rx];
> +	uint64_t hopsv4[nb_rx], hopsv6[nb_rx];
> +	uint8_t type_arr[nb_rx];
> +	uint32_t ipv4_cnt = 0, ipv6_cnt = 0;
> +	uint32_t ipv4_arr_assem = 0, ipv6_arr_assem = 0;
> +	uint16_t nh;
> +	int32_t i;
> +
> +	/* Prefetch first packets. */
> +	for (i = 0; i < FIB_PREFETCH_OFFSET && i < nb_rx; i++)
> +		rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], void *));
> +
> +	/* Parse packet info and prefetch. */
> +	for (i = 0; i < (nb_rx - FIB_PREFETCH_OFFSET); i++) {
> +		/* Prefetch packet. */
> +		rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[
> +				i + FIB_PREFETCH_OFFSET], void *));
> +		fib_parse_packet(pkts_burst[i],
> +				&ipv4_arr[ipv4_cnt], &ipv4_cnt,
> +				ipv6_arr[ipv6_cnt], &ipv6_cnt,
> +				&type_arr[i]);
> +	}
> +
> +	/* Parse remaining packet info. */
> +	for (; i < nb_rx; i++)
> +		fib_parse_packet(pkts_burst[i],
> +				&ipv4_arr[ipv4_cnt], &ipv4_cnt,
> +				ipv6_arr[ipv6_cnt], &ipv6_cnt,
> +				&type_arr[i]);
> +
> +	/* Lookup IPv4 hops if IPv4 packets are present. */
> +	if (likely(ipv4_cnt > 0))
> +		rte_fib_lookup_bulk(qconf->ipv4_lookup_struct,
> +				ipv4_arr, hopsv4, ipv4_cnt);
> +
> +	/* Lookup IPv6 hops if IPv6 packets are present. */
> +	if (ipv6_cnt > 0)
> +		rte_fib6_lookup_bulk(qconf->ipv6_lookup_struct,
> +				ipv6_arr, hopsv6, ipv6_cnt);
> +
> +	/* Add IPv4 and IPv6 hops to one array depending on type. */
> +	for (i = 0; i < nb_rx; i++) {
> +		if (type_arr[i])
> +			nh = (uint16_t)hopsv4[ipv4_arr_assem++];
> +		else
> +			nh = (uint16_t)hopsv6[ipv6_arr_assem++];
> +		hops[i] = (nh != FIB_DEFAULT_HOP && nh <= RTE_MAX_ETHPORTS &&
> +			(enabled_port_mask & 1 << nh) != 0) ? nh : portid;

I think you can get rid of
"nh <= RTE_MAX_ETHPORTS && (enabled_port_mask & 1 << nh) != 0"
because it can be controlled during initialization when installing 
routes to the table. So you can check it just before rte_fib_add() and 
install FIB_DEFAULT_HOP if needed.

Apart from that LGTM.


> +	}
> +
> +#if defined FIB_SEND_MULTI
> +	send_packets_multi(qconf, pkts_burst, hops, nb_rx);
> +#else
> +	fib_send_single(nb_rx, qconf, pkts_burst, hops);
> +#endif
> +}
> +

<snip>

> 

-- 
Regards,
Vladimir

  reply	other threads:[~2021-03-12 18:56 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 12:15 [dpdk-dev] [PATCH 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-02-18 12:15 ` [dpdk-dev] [PATCH 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-02-18 12:15 ` [dpdk-dev] [PATCH 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-02-18 12:15 ` [dpdk-dev] [PATCH 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-02-18 12:15 ` [dpdk-dev] [PATCH 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-02-18 12:15 ` [dpdk-dev] [PATCH 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-02-18 15:20 ` [dpdk-dev] [PATCH v2 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-02-18 15:20   ` [dpdk-dev] [PATCH v2 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-02-18 15:20   ` [dpdk-dev] [PATCH v2 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-02-18 15:20   ` [dpdk-dev] [PATCH v2 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-02-18 15:20   ` [dpdk-dev] [PATCH v2 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-02-18 15:20   ` [dpdk-dev] [PATCH v2 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-02-19 15:09   ` [dpdk-dev] [PATCH v3 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-02-19 15:09     ` [dpdk-dev] [PATCH v3 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-03-08 10:41       ` Medvedkin, Vladimir
2021-02-19 15:09     ` [dpdk-dev] [PATCH v3 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-03-02 16:20       ` Ananyev, Konstantin
2021-03-08 10:42       ` Medvedkin, Vladimir
2021-02-19 15:09     ` [dpdk-dev] [PATCH v3 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-03-02 16:22       ` Ananyev, Konstantin
2021-03-03 11:36       ` Burakov, Anatoly
2021-03-08 15:13         ` Walsh, Conor
2021-03-08 10:42       ` Medvedkin, Vladimir
2021-02-19 15:09     ` [dpdk-dev] [PATCH v3 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-03-02 16:21       ` Ananyev, Konstantin
2021-03-03 11:52       ` Burakov, Anatoly
2021-03-08 15:35         ` Walsh, Conor
2021-03-08 10:43       ` Medvedkin, Vladimir
2021-03-08 17:20         ` Walsh, Conor
2021-02-19 15:09     ` [dpdk-dev] [PATCH v3 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-03-11 12:01     ` [dpdk-dev] [PATCH v4 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-03-11 12:01       ` [dpdk-dev] [PATCH v4 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-03-11 12:01       ` [dpdk-dev] [PATCH v4 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-03-11 12:01       ` [dpdk-dev] [PATCH v4 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-03-11 12:01       ` [dpdk-dev] [PATCH v4 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-03-12 18:56         ` Medvedkin, Vladimir [this message]
2021-03-15 10:21           ` Walsh, Conor
2021-03-11 12:01       ` [dpdk-dev] [PATCH v4 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-03-15 11:34       ` [dpdk-dev] [PATCH v5 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-03-15 11:34         ` [dpdk-dev] [PATCH v5 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-03-15 11:34         ` [dpdk-dev] [PATCH v5 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-03-15 11:34         ` [dpdk-dev] [PATCH v5 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-04-01 11:20           ` Burakov, Anatoly
2021-04-01 12:59             ` Walsh, Conor
2021-03-15 11:34         ` [dpdk-dev] [PATCH v5 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-03-16 18:46           ` Medvedkin, Vladimir
2021-03-15 11:34         ` [dpdk-dev] [PATCH v5 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-03-18 19:45           ` Mcnamara, John
2021-04-02 10:52         ` [dpdk-dev] [PATCH v6 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-04-02 10:52           ` [dpdk-dev] [PATCH v6 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-04-02 10:52           ` [dpdk-dev] [PATCH v6 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-04-02 10:52           ` [dpdk-dev] [PATCH v6 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-04-02 16:34             ` Burakov, Anatoly
2021-04-06 11:05               ` Walsh, Conor
2021-04-02 10:52           ` [dpdk-dev] [PATCH v6 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-04-02 10:52           ` [dpdk-dev] [PATCH v6 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-04-06 11:11           ` [dpdk-dev] [PATCH v7 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-04-06 11:11             ` [dpdk-dev] [PATCH v7 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-04-14 20:59               ` David Marchand
2021-04-15  8:44                 ` Walsh, Conor
2021-04-15 14:31                   ` David Marchand
2021-04-15 15:18                     ` Walsh, Conor
2021-04-06 11:11             ` [dpdk-dev] [PATCH v7 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-04-15 14:38               ` David Marchand
2021-04-06 11:11             ` [dpdk-dev] [PATCH v7 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-04-06 11:11             ` [dpdk-dev] [PATCH v7 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-04-15 14:42               ` David Marchand
2021-04-06 11:11             ` [dpdk-dev] [PATCH v7 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-04-15 14:43               ` David Marchand
2021-04-15 14:59               ` David Marchand
2021-04-16 17:19             ` [dpdk-dev] [PATCH v8 0/5] examples/l3fwd: add FIB lookup method to l3fwd Conor Walsh
2021-04-16 17:19               ` [dpdk-dev] [PATCH v8 1/5] examples/l3fwd: fix LPM IPv6 subnets Conor Walsh
2021-04-16 17:19               ` [dpdk-dev] [PATCH v8 2/5] examples/l3fwd: move l3fwd routes to common header Conor Walsh
2021-04-16 17:19               ` [dpdk-dev] [PATCH v8 3/5] examples/l3fwd: add FIB infrastructure Conor Walsh
2021-04-16 17:19               ` [dpdk-dev] [PATCH v8 4/5] examples/l3fwd: implement FIB lookup method Conor Walsh
2021-04-16 17:19               ` [dpdk-dev] [PATCH v8 5/5] doc/guides/l3_forward: update documentation for FIB Conor Walsh
2021-04-20 18:28               ` [dpdk-dev] [PATCH v8 0/5] examples/l3fwd: add FIB lookup method to l3fwd Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a9b25b8-6053-c236-bc61-1870f09adfd3@intel.com \
    --to=vladimir.medvedkin@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).