On 2/12/25 16:47, Jagielski, Jedrzej wrote:
From: Jiri Pirko <j...@resnulli.us>
Sent: Wednesday, February 12, 2025 4:09 PM
Wed, Feb 12, 2025 at 02:14:01PM +0100, jedrzej.jagiel...@intel.com wrote:
Add an initial support for devlink interface to ixgbe driver.

Similarly to i40e driver the implementation doesn't enable
devlink to manage device-wide configuration. Devlink instance
is created for each physical function of PCIe device.

Create separate directory for devlink related ixgbe files
and use naming scheme similar to the one used in the ice driver.

Add a stub for Documentation, to be extended by further patches.

Reviewed-by: Mateusz Polchlopek <mateusz.polchlo...@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagiel...@intel.com>


+int ixgbe_allocate_devlink(struct ixgbe_adapter *adapter)
+{
+       struct ixgbe_devlink_priv *devlink_private;
+       struct device *dev = &adapter->pdev->dev;
+       struct devlink *devlink;
+
+       devlink = devlink_alloc(&ixgbe_devlink_ops,
+                               sizeof(*devlink_private), dev);
+       if (!devlink)
+               return -ENOMEM;
+
+       devlink_private = devlink_priv(devlink);
+       devlink_private->adapter = adapter;

struct ixgbe_adapter * should be returned by devlink_priv(), that is the
idea, to let devlink allocate the driver private for you.

Using ixgbe_devlink_priv here is a workaround which i decided to introduce
to mitigate the fact that ixgbe_adapter is used to alloc netdev with
alloc_etherdev_mq().
This would require general ixgbe refactoring.
We will try to do that, pending a retest before for new submission ;)

Reply via email to