1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2024, Intel Corporation. */
4 #ifndef _DEVLINK_PORT_H_
5 #define _DEVLINK_PORT_H_
8 #include "../ice_sf_eth.h"
11 * struct ice_dynamic_port - Track dynamically added devlink port instance
12 * @hw_addr: the HW address for this port
13 * @active: true if the port has been activated
14 * @attached: true it the prot is attached
15 * @devlink_port: the associated devlink port structure
16 * @pf: pointer to the PF private structure
17 * @vsi: the VSI associated with this port
18 * @repr_id: the representor ID
19 * @sfnum: the subfunction ID
20 * @sf_dev: pointer to the subfunction device
22 * An instance of a dynamically added devlink port. Each port flavour
24 struct ice_dynamic_port {
28 struct devlink_port devlink_port;
31 unsigned long repr_id;
33 /* Flavour-specific implementation data */
35 struct ice_sf_dev *sf_dev;
39 void ice_dealloc_all_dynamic_ports(struct ice_pf *pf);
41 int ice_devlink_create_pf_port(struct ice_pf *pf);
42 void ice_devlink_destroy_pf_port(struct ice_pf *pf);
43 int ice_devlink_create_vf_port(struct ice_vf *vf);
44 void ice_devlink_destroy_vf_port(struct ice_vf *vf);
45 int ice_devlink_create_sf_port(struct ice_dynamic_port *dyn_port);
46 void ice_devlink_destroy_sf_port(struct ice_dynamic_port *dyn_port);
47 int ice_devlink_create_sf_dev_port(struct ice_sf_dev *sf_dev);
48 void ice_devlink_destroy_sf_dev_port(struct ice_sf_dev *sf_dev);
50 #define ice_devlink_port_to_dyn(port) \
51 container_of(port, struct ice_dynamic_port, devlink_port)
54 ice_devlink_port_new(struct devlink *devlink,
55 const struct devlink_port_new_attrs *new_attr,
56 struct netlink_ext_ack *extack,
57 struct devlink_port **devlink_port);
58 #endif /* _DEVLINK_PORT_H_ */