Re: [RFC PATCH net-next v3 14/21] ethtool: provide link mode names as a string set

From: Florian Fainelli
Date: Wed Feb 20 2019 - 22:22:07 EST




On 2/18/2019 10:22 AM, Michal Kubecek wrote:
> Add table of ethernet link mode names and make it available as a string set
> to userspace GET_STRSET requests.
>
> Signed-off-by: Michal Kubecek <mkubecek@xxxxxxx>
> ---

[snip]

>
> +const char *const link_mode_names[] = {

Maybe you can define a macro (totally untested) to build the table an
avoid some of the repetition, something like:

#define ETHTOOL_LINK_NAME(speed, duplex) \
[ETHTOOL_LINK_MODE_##speed_##duplex_BIT] = stringify(speed ## "/" ##
duplex)

--
Florian