DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Conor Walsh <conor.walsh@intel.com>
Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	 "Iremonger, Bernard" <bernard.iremonger@intel.com>,
	 "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	 Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	 "Burakov, Anatoly" <anatoly.burakov@intel.com>,
	"Mcnamara, John" <john.mcnamara@intel.com>, dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v7 2/5] examples/l3fwd: move l3fwd routes to common header
Date: Thu, 15 Apr 2021 16:38:50 +0200	[thread overview]
Message-ID: <CAJFAV8znqkvfeTmH9=_NSbMA_qMbSPyTK5XuGcms21HDVdHoOA@mail.gmail.com> (raw)
In-Reply-To: <20210406111106.2020555-3-conor.walsh@intel.com>

On Tue, Apr 6, 2021 at 1:11 PM Conor Walsh <conor.walsh@intel.com> wrote:
>
> To prevent code duplication from the addition of lookup methods
> the routes specified in lpm should be moved to a common header.
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---
>  examples/l3fwd/l3fwd_common_route.h | 48 +++++++++++++++++++
>  examples/l3fwd/l3fwd_lpm.c          | 74 +++++++----------------------
>  2 files changed, 65 insertions(+), 57 deletions(-)
>  create mode 100644 examples/l3fwd/l3fwd_common_route.h
>
> diff --git a/examples/l3fwd/l3fwd_common_route.h b/examples/l3fwd/l3fwd_common_route.h
> new file mode 100644
> index 0000000000..7f0125a8a5
> --- /dev/null
> +++ b/examples/l3fwd/l3fwd_common_route.h
> @@ -0,0 +1,48 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2021 Intel Corporation
> + */
> +
> +#include <stdint.h>
> +#include <rte_ip.h>
> +
> +struct ipv4_l3fwd_common_route {

Why "common" ? ipv4_l3fwd_route is enough.
Plus, this is what we reference in the doc.

doc/guides/sample_app_ug/l3_forward.rst:            if ((1 <<
ipv4_l3fwd_route_array[i].if_out & enabled_port_mask) == 0)
doc/guides/sample_app_ug/l3_forward.rst:            ret =
rte_lpm_add(ipv4_l3fwd_lookup_struct[socketid],
ipv4_l3fwd_route_array[i].ip,
doc/guides/sample_app_ug/l3_forward.rst:
     ipv4_l3fwd_route_array[i].depth,
ipv4_l3fwd_route_array[i].if_out);
doc/guides/sample_app_ug/l3_forward.rst:
(unsigned)ipv4_l3fwd_route_array[i].ip,
ipv4_l3fwd_route_array[i].depth, ipv4_l3fwd_route_array[i].if_out);


> +       uint32_t ip;
> +       uint8_t  depth;
> +       uint8_t  if_out;
> +};



> +
> +struct ipv6_l3fwd_common_route {
> +       uint8_t ip[16];
> +       uint8_t  depth;

Unneeded double space.


> +       uint8_t  if_out;
> +};
> +
> +/*
> + * 198.18.0.0/16 are set aside for RFC2544 benchmarking (RFC5735).
> + * 198.18.{0-7}.0/24 = Port {0-7}
> + */
> +static const struct ipv4_l3fwd_common_route ipv4_l3fwd_common_route_array[] = {
> +       {RTE_IPV4(198, 18, 0, 0), 24, 0},
> +       {RTE_IPV4(198, 18, 1, 0), 24, 1},
> +       {RTE_IPV4(198, 18, 2, 0), 24, 2},
> +       {RTE_IPV4(198, 18, 3, 0), 24, 3},
> +       {RTE_IPV4(198, 18, 4, 0), 24, 4},
> +       {RTE_IPV4(198, 18, 5, 0), 24, 5},
> +       {RTE_IPV4(198, 18, 6, 0), 24, 6},
> +       {RTE_IPV4(198, 18, 7, 0), 24, 7},
> +};

With static symbols, we end up with duplicating info in lpm / fib.
$ nm build/examples/dpdk-l3fwd |grep ipv4_l3fwd_common_route_array
000000000100c260 r ipv4_l3fwd_common_route_array
000000000100c4c0 r ipv4_l3fwd_common_route_array

You can declare global symbols in a common header, and define them in main.c.


> +
> +/*
> + * 2001:200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180).
> + * 2001:200:0:{0-7}::/64 = Port {0-7}
> + */
> +static const struct ipv6_l3fwd_common_route ipv6_l3fwd_common_route_array[] = {
> +       {{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},
> +       {{32, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 1},
> +       {{32, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 2},
> +       {{32, 1, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 3},
> +       {{32, 1, 2, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 4},
> +       {{32, 1, 2, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 5},
> +       {{32, 1, 2, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 6},
> +       {{32, 1, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 7},
> +};


-- 
David Marchand


  reply	other threads:[~2021-04-15 14:39 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
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 [this message]
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='CAJFAV8znqkvfeTmH9=_NSbMA_qMbSPyTK5XuGcms21HDVdHoOA@mail.gmail.com' \
    --to=david.marchand@redhat.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=john.mcnamara@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=vladimir.medvedkin@intel.com \
    /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).