Re: [PATCH v3 03/12] net-shapers: implement NL get operation
From: Jakub Kicinski <kuba@kernel.org>
Date: 2024-08-27 14:54:08
On Tue, 27 Aug 2024 16:37:38 +0200 Paolo Abeni wrote:
quoted
What's stopping anyone from diverging these 2-n sets? I mean, the whole purpose it unification and finding common ground. Once you have ops duplicated, sooner then later someone does change in A but ignore B. Having the "preamble" in every callback seems like very good tradeoff to prevent this scenario.The main fact is that we do not agree on the above point - unify the shaper_ops between struct net_device and struct devlink. I think a 3rd party opinion could help moving forward. @Jakub could you please share your view here?
I don't mind Jiri's suggestion. Driver can declare its own helper:
static struct drv_port *
drv_shaper_binding_to_prot(const struct net_shaper_binding *binding)
{
if (binding->type == NET_SHAPER_BINDING_TYPE_NETDEV)
return /* netdev_priv() ? */;
if (binding->type == NET_SHAPER_BINDING_TYPE_DEVLINK_PORT)
return /* container_of() ? */;
WARN_ONCE();
return NULL;
}
And call that instead of netdev_priv()?