// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024, Intel Corporation. */ #include "ice.h" #include "ice_lib.h" #include "ice_txrx.h" #include "ice_fltr.h" #include "ice_sf_eth.h" #include "devlink/devlink_port.h" #include "devlink/devlink.h" static const struct net_device_ops ice_sf_netdev_ops = …; /** * ice_sf_cfg_netdev - Allocate, configure and register a netdev * @dyn_port: subfunction associated with configured netdev * @devlink_port: subfunction devlink port to be linked with netdev * * Return: 0 on success, negative value on failure */ static int ice_sf_cfg_netdev(struct ice_dynamic_port *dyn_port, struct devlink_port *devlink_port) { … } static void ice_sf_decfg_netdev(struct ice_vsi *vsi) { … } /** * ice_sf_dev_probe - subfunction driver probe function * @adev: pointer to the auxiliary device * @id: pointer to the auxiliary_device id * * Configure VSI and netdev resources for the subfunction device. * * Return: zero on success or an error code on failure. */ static int ice_sf_dev_probe(struct auxiliary_device *adev, const struct auxiliary_device_id *id) { … } /** * ice_sf_dev_remove - subfunction driver remove function * @adev: pointer to the auxiliary device * * Deinitalize VSI and netdev resources for the subfunction device. */ static void ice_sf_dev_remove(struct auxiliary_device *adev) { … } static const struct auxiliary_device_id ice_sf_dev_id_table[] = …; MODULE_DEVICE_TABLE(auxiliary, ice_sf_dev_id_table); static struct auxiliary_driver ice_sf_driver = …; static DEFINE_XARRAY_ALLOC1(ice_sf_aux_id); /** * ice_sf_driver_register - Register new auxiliary subfunction driver * * Return: zero on success or an error code on failure. */ int ice_sf_driver_register(void) { … } /** * ice_sf_driver_unregister - Unregister new auxiliary subfunction driver * */ void ice_sf_driver_unregister(void) { … } /** * ice_sf_dev_release - Release device associated with auxiliary device * @device: pointer to the device * * Since most of the code for subfunction deactivation is handled in * the remove handler, here just free tracking resources. */ static void ice_sf_dev_release(struct device *device) { … } /** * ice_sf_eth_activate - Activate Ethernet subfunction port * @dyn_port: the dynamic port instance for this subfunction * @extack: extack for reporting error messages * * Activate the dynamic port as an Ethernet subfunction. Setup the netdev * resources associated and initialize the auxiliary device. * * Return: zero on success or an error code on failure. */ int ice_sf_eth_activate(struct ice_dynamic_port *dyn_port, struct netlink_ext_ack *extack) { … } /** * ice_sf_eth_deactivate - Deactivate Ethernet subfunction port * @dyn_port: the dynamic port instance for this subfunction * * Deactivate the Ethernet subfunction, removing its auxiliary device and the * associated resources. */ void ice_sf_eth_deactivate(struct ice_dynamic_port *dyn_port) { … }