Re: [PATCH net-next v7 02/11] rtnetlink: Pack newlink() params into struct

Jakub Kicinski <[email protected]>
Newsgroups gmane.org.freifunk.batman,gmane.linux.network,gmane.linux.drivers.rdma,gmane.linux.can,gmane.linux.kernel.bpf,gmane.linux.ppp,gmane.network.wireguard,gmane.linux.kernel.wireless.general,gmane.linux.kernel
Message-ID <[email protected]>
On Wed, 8 Jan 2025 16:36:26 +0800 Xiao Liang wrote:
> On Wed, Jan 8, 2025 at 4:38 AM Jakub Kicinski <[email protected]> wrote:
> >
> > On Sat,  4 Jan 2025 20:57:23 +0800 Xiao Liang wrote:  
> > > -static int amt_newlink(struct net *net, struct net_device *dev,
> > > -                    struct nlattr *tb[], struct nlattr *data[],
> > > -                    struct netlink_ext_ack *extack)
> > > +static int amt_newlink(struct rtnl_newlink_params *params)
> > >  {
> > > -     struct amt_dev *amt = netdev_priv(dev);
> > > +     struct netlink_ext_ack *extack = params->extack;
> > > +     struct net_device *dev = params->dev;
> > > +     struct nlattr **data = params->data;
> > > +     struct nlattr **tb = params->tb;
> > > +     struct net *net = params->net;
> > > +     struct amt_dev *amt;  
> >
> > IMHO you packed a little too much into the struct.
> > Could you take the dev and the extack back out?  
> 
> Sure. I thought you were suggesting packing them all
> in review of v3...

Sorry about that, I wasn't very clear :(

What I had in mind was similar to how we define ethtool ops,
(especially the more recent ones which have extack)
for example:

	int	(*set_mm)(struct net_device *dev, struct ethtool_mm_cfg *cfg,
			  struct netlink_ext_ack *extack);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.