All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Daniel Machon <daniel.machon@microchip.com>
Cc: <netdev@vger.kernel.org>, <dsahern@kernel.org>,
	<stephen@networkplumber.org>, <petrm@nvidia.com>,
	<UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH iproute2-next v2 5/8] dcb: rewr: add new dcb-rewr subcommand
Date: Tue, 30 May 2023 21:58:33 +0200	[thread overview]
Message-ID: <87sfbd4kfb.fsf@nvidia.com> (raw)
In-Reply-To: <20230510-dcb-rewr-v2-5-9f38e688117e@microchip.com>


Daniel Machon <daniel.machon@microchip.com> writes:

> Add a new subcommand 'rewr' for configuring the in-kernel DCB rewrite
> table. The rewr-table of the kernel is similar to the APP-table, and so
> is this new subcommand. Therefore, much of the existing bookkeeping code
> from dcb-app, can be reused in the dcb-rewr implementation.
>
> Initially, only support for configuring PCP and DSCP-based rewrite has
> been added.
>
> Signed-off-by: Daniel Machon <daniel.machon@microchip.com>

Looks good overall, barring the comment about dcb_app_parse_mapping_cb()
that I made in the other patch, and a handful of nits below.

> ---
>  dcb/Makefile   |   3 +-
>  dcb/dcb.c      |   4 +-
>  dcb/dcb.h      |  32 ++++++
>  dcb/dcb_app.c  |  49 ++++----
>  dcb/dcb_rewr.c | 355 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 416 insertions(+), 27 deletions(-)

> diff --git a/dcb/dcb.h b/dcb/dcb.h
> index b3bc30cd02c5..092dc90e8358 100644
> --- a/dcb/dcb.h
> +++ b/dcb/dcb.h
> @@ -54,6 +54,10 @@ void dcb_print_array_on_off(const __u8 *array, size_t size);
>  void dcb_print_array_kw(const __u8 *array, size_t array_size,
>  			const char *const kw[], size_t kw_size);
>  
> +/* dcp_rewr.c */
> +
> +int dcb_cmd_rewr(struct dcb *dcb, int argc, char **argv);
> +
>  /* dcb_app.c */
>  
>  struct dcb_app_table {
> @@ -70,8 +74,29 @@ struct dcb_app_parse_mapping {
>  	int err;
>  };
>  
> +#define DCB_APP_PCP_MAX 15

This should be removed from dcb_app.c as well.

> +#define DCB_APP_DSCP_MAX 63

DCB_APP_DSCP_MAX should be introduced in a separate patch together with
the s/63/DCB_APP_DSCP_MAX/ of the existing code, instead of including it
all here. It's a concern separate from the main topic of the patch.

> +
>  int dcb_cmd_app(struct dcb *dcb, int argc, char **argv);
>  
> +int dcb_app_get(struct dcb *dcb, const char *dev, struct dcb_app_table *tab);
> +int dcb_app_add_del(struct dcb *dcb, const char *dev, int command,
> +		    const struct dcb_app_table *tab,
> +		    bool (*filter)(const struct dcb_app *));
> +
> +bool dcb_app_is_dscp(const struct dcb_app *app);
> +bool dcb_app_is_pcp(const struct dcb_app *app);
> +
> +int dcb_app_print_pid_dscp(__u16 protocol);
> +int dcb_app_print_pid_pcp(__u16 protocol);
> +int dcb_app_print_pid_dec(__u16 protocol);
> +void dcb_app_print_filtered(const struct dcb_app_table *tab,
> +			    bool (*filter)(const struct dcb_app *),
> +			    void (*print_pid_prio)(int (*print_pid)(__u16),
> +						   const struct dcb_app *),
> +			    int (*print_pid)(__u16 protocol),
> +			    const char *json_name, const char *fp_name);
> +
>  enum ieee_attrs_app dcb_app_attr_type_get(__u8 selector);
>  bool dcb_app_attr_type_validate(enum ieee_attrs_app type);
>  bool dcb_app_selector_validate(enum ieee_attrs_app type, __u8 selector);
> @@ -80,11 +105,18 @@ bool dcb_app_pid_eq(const struct dcb_app *aa, const struct dcb_app *ab);
>  bool dcb_app_prio_eq(const struct dcb_app *aa, const struct dcb_app *ab);
>  
>  int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app);
> +int dcb_app_table_copy(struct dcb_app_table *a, const struct dcb_app_table *b);
> +void dcb_app_table_sort(struct dcb_app_table *tab);
> +void dcb_app_table_fini(struct dcb_app_table *tab);
> +void dcb_app_table_remove_existing(struct dcb_app_table *a,
> +				   const struct dcb_app_table *b);
>  void dcb_app_table_remove_replaced(struct dcb_app_table *a,
>  				   const struct dcb_app_table *b,
>  				   bool (*key_eq)(const struct dcb_app *aa,
>  						  const struct dcb_app *ab));
>  
> +int dcb_app_parse_pcp(__u32 *key, const char *arg);
> +int dcb_app_parse_dscp(__u32 *key, const char *arg);
>  void dcb_app_parse_mapping_cb(__u32 key, __u64 value, void *data);
>  
>  /* dcb_apptrust.c */
> diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
> index 97cba658aa6b..3cb1bb302ed6 100644
> --- a/dcb/dcb_app.c
> +++ b/dcb/dcb_app.c

> @@ -643,9 +642,9 @@ static int dcb_app_add_del_cb(struct dcb *dcb, struct nlmsghdr *nlh, void *data)

> +static int dcb_cmd_rewr_replace(struct dcb *dcb, const char *dev, int argc,
> +				char **argv)
> +{

[...]

> +}
> +
> +

Two blank lines.

> +static int dcb_cmd_rewr_show(struct dcb *dcb, const char *dev, int argc,
> +			     char **argv)
> +{

  reply	other threads:[~2023-05-30 20:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 18:10 [PATCH iproute2-next v2 0/8] Introduce new dcb-rewr subcommand Daniel Machon
2023-05-25 18:10 ` [PATCH iproute2-next v2 1/8] dcb: app: add new dcbnl attribute field Daniel Machon
2023-05-25 18:10 ` [PATCH iproute2-next v2 2/8] dcb: app: modify dcb-app print functions for dcb-rewr reuse Daniel Machon
2023-05-29 17:09   ` Petr Machata
2023-05-30  8:01     ` Daniel Machon
2023-05-31  8:31     ` Daniel Machon
2023-05-31 11:26       ` Petr Machata
2023-05-31 14:28         ` David Ahern
2023-05-25 18:10 ` [PATCH iproute2-next v2 3/8] dcb: app: modify dcb_app_table_remove_replaced() " Daniel Machon
2023-05-29 17:00   ` Petr Machata
2023-05-30  8:03     ` Daniel Machon
2023-05-30 20:29     ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 4/8] dcb: app: modify dcb_app_parse_mapping_cb " Daniel Machon
2023-05-30 19:50   ` Petr Machata
2023-05-31  8:12     ` Daniel Machon
2023-05-31 11:05       ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 5/8] dcb: rewr: add new dcb-rewr subcommand Daniel Machon
2023-05-30 19:58   ` Petr Machata [this message]
2023-05-31  8:14     ` Daniel Machon
2023-05-25 18:10 ` [PATCH iproute2-next v2 6/8] man: dcb-rewr: add new manpage for dcb-rewr Daniel Machon
2023-05-30 19:47   ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 7/8] man: dcb: add additional references under 'SEE ALSO' Daniel Machon
2023-05-30 19:39   ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 8/8] man: dcb-app: clean up a few mistakes Daniel Machon
2023-05-30 19:37   ` Petr Machata

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=87sfbd4kfb.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=daniel.machon@microchip.com \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.