Subject: Re: [PATCH net-next v2 1/3] netdevsim: Introduce support for L3 offload xstats

From: Petr Machata <[email-masked]>
Date: Mon, 14 Mar 2022 10:47:12 +0100

Jakub Kicinski <[email-masked]> writes:

> On Fri, 11 Mar 2022 15:41:22 +0100 Petr Machata wrote:
>> +static const struct file_operations nsim_dev_hwstats_generic_fops = {
>> +	.open = simple_open,
>> +	.write = nsim_dev_hwstats_do_write,
>> +	.llseek = generic_file_llseek,
>> +	.owner = THIS_MODULE,
>> +};
>> +
>> +static const struct nsim_dev_hwstats_fops nsim_dev_hwstats_l3_disable_fops = {
>> +	.fops = nsim_dev_hwstats_generic_fops,
>> +	.action = NSIM_DEV_HWSTATS_DO_DISABLE,
>> +	.type = NETDEV_OFFLOAD_XSTATS_TYPE_L3,
>> +};
>> +
>> +static const struct nsim_dev_hwstats_fops nsim_dev_hwstats_l3_enable_fops = {
>> +	.fops = nsim_dev_hwstats_generic_fops,
>> +	.action = NSIM_DEV_HWSTATS_DO_ENABLE,
>> +	.type = NETDEV_OFFLOAD_XSTATS_TYPE_L3,
>> +};
>> +
>> +static const struct nsim_dev_hwstats_fops nsim_dev_hwstats_l3_fail_fops = {
>> +	.fops = nsim_dev_hwstats_generic_fops,
>> +	.action = NSIM_DEV_HWSTATS_DO_FAIL,
>> +	.type = NETDEV_OFFLOAD_XSTATS_TYPE_L3,
>> +};
>
> clang is not on board :(
>
> drivers/net/netdevsim/hwstats.c:404:10: error: initializer element is not a compile-time constant
>         .fops = nsim_dev_hwstats_generic_fops,

OK, I'll figure out another way to do away with the redundancy. Or else
inline the definitions.