From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leon Romanovsky Date: Wed, 29 Sep 2021 17:31:04 +0300 Subject: [Intel-wired-lan] [PATCH net-next v1 4/5] net/mlx5: Register separate reload devlink ops for multiport device In-Reply-To: <20210929072631.437ffad9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <20210929065549.43b13203@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20210929072631.437ffad9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: intel-wired-lan@osuosl.org List-ID: On Wed, Sep 29, 2021 at 07:26:31AM -0700, Jakub Kicinski wrote: > On Wed, 29 Sep 2021 17:16:28 +0300 Leon Romanovsky wrote: > > > > @@ -808,6 +812,9 @@ int mlx5_devlink_register(struct devlink *devlink) > > > > if (err) > > > > goto traps_reg_err; > > > > > > > > + if (!mlx5_core_is_mp_slave(dev)) > > > > + devlink_set_ops(devlink, &mlx5_devlink_reload); > > > > > > Does this work? Where do you make a copy of the ops? ? You can't modify > > > the driver-global ops, to state the obvious. > > > > devlink_ops pointer is not constant at this stage, so why can't I copy > > reload_* pointers to the "main" devlink ops? > > > > I wanted to avoid to copy all pointers. > > Hm. I must be missing a key piece here. IIUC you want to have different > ops based on some device property. But there is only one > > static struct devlink_ops mlx5_devlink_ops; > > so how can two devlink instances in the system use that and have > different ops without a copy? No, I have two: * Base ops - mlx5_devlink_ops * Extra reload commands - mlx5_devlink_reload Thanks