[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c197fd9c-c6a8-0ad1-1dce-c439d891354c@gmail.com>
Date: Sun, 31 Jan 2021 10:30:39 -0700
From: David Ahern <dsahern@...il.com>
To: Parav Pandit <parav@...dia.com>, stephen@...workplumber.org,
netdev@...r.kernel.org
Cc: Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH iproute2-next 5/5] devlink: Support set of port function
state
On 1/29/21 9:56 AM, Parav Pandit wrote:
> @@ -1420,6 +1423,22 @@ static int port_flavour_parse(const char *flavour, uint16_t *value)
> }
> }
>
> +static int port_function_state_parse(const char *statestr, uint8_t *state)
> +{
> + if (!statestr)
> + return -EINVAL;
> +
> + if (strcmp(statestr, "inactive") == 0) {
> + *state = DEVLINK_PORT_FN_STATE_INACTIVE;
> + return 0;
> + } else if (strcmp(statestr, "active") == 0) {
> + *state = DEVLINK_PORT_FN_STATE_ACTIVE;
> + return 0;
> + } else {
> + return -EINVAL;
> + }
> +}
> +
if another state gets added this too should be table driven - string to
type here and the inverse in the previous patch.
> struct dl_args_metadata {
> uint64_t o_flag;
> char err_msg[DL_ARGS_REQUIRED_MAX_ERR_LEN];
> @@ -3897,7 +3934,6 @@ static void pr_out_port_function(struct dl *dl, struct nlattr **tb_port)
>
> print_string(PRINT_ANY, "opstate", " opstate %s", port_function_opstate(state));
> }
> -
> if (!dl->json_output)
> __pr_out_indent_dec();
> pr_out_object_end(dl);
Removing the newline intentional?
Powered by blists - more mailing lists