// SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2019-2021, Intel Corporation. */ #include "ice.h" #include "ice_eswitch.h" #include "devlink/devlink.h" #include "devlink/devlink_port.h" #include "ice_sriov.h" #include "ice_tc_lib.h" #include "ice_dcb_lib.h" /** * ice_repr_inc_tx_stats - increment Tx statistic by one packet * @repr: repr to increment stats on * @len: length of the packet * @xmit_status: value returned by xmit function */ void ice_repr_inc_tx_stats(struct ice_repr *repr, unsigned int len, int xmit_status) { … } /** * ice_repr_inc_rx_stats - increment Rx statistic by one packet * @netdev: repr netdev to increment stats on * @len: length of the packet */ void ice_repr_inc_rx_stats(struct net_device *netdev, unsigned int len) { … } /** * ice_repr_get_stats64 - get VF stats for VFPR use * @netdev: pointer to port representor netdev * @stats: pointer to struct where stats can be stored */ static void ice_repr_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) { … } /** * ice_netdev_to_repr - Get port representor for given netdevice * @netdev: pointer to port representor netdev */ struct ice_repr *ice_netdev_to_repr(const struct net_device *netdev) { … } /** * ice_repr_vf_open - Enable port representor's network interface * @netdev: network interface device structure * * The open entry point is called when a port representor's network * interface is made active by the system (IFF_UP). Corresponding * VF is notified about link status change. * * Returns 0 on success */ static int ice_repr_vf_open(struct net_device *netdev) { … } static int ice_repr_sf_open(struct net_device *netdev) { … } /** * ice_repr_vf_stop - Disable port representor's network interface * @netdev: network interface device structure * * The stop entry point is called when a port representor's network * interface is de-activated by the system. Corresponding * VF is notified about link status change. * * Returns 0 on success */ static int ice_repr_vf_stop(struct net_device *netdev) { … } static int ice_repr_sf_stop(struct net_device *netdev) { … } /** * ice_repr_sp_stats64 - get slow path stats for port representor * @dev: network interface device structure * @stats: netlink stats structure */ static int ice_repr_sp_stats64(const struct net_device *dev, struct rtnl_link_stats64 *stats) { … } static bool ice_repr_ndo_has_offload_stats(const struct net_device *dev, int attr_id) { … } static int ice_repr_ndo_get_offload_stats(int attr_id, const struct net_device *dev, void *sp) { … } static int ice_repr_setup_tc_cls_flower(struct ice_repr *repr, struct flow_cls_offload *flower) { … } static int ice_repr_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv) { … } static LIST_HEAD(ice_repr_block_cb_list); static int ice_repr_setup_tc(struct net_device *netdev, enum tc_setup_type type, void *type_data) { … } static const struct net_device_ops ice_repr_vf_netdev_ops = …; static const struct net_device_ops ice_repr_sf_netdev_ops = …; /** * ice_is_port_repr_netdev - Check if a given netdevice is a port representor netdev * @netdev: pointer to netdev */ bool ice_is_port_repr_netdev(const struct net_device *netdev) { … } /** * ice_repr_reg_netdev - register port representor netdev * @netdev: pointer to port representor netdev * @ops: new ops for netdev */ static int ice_repr_reg_netdev(struct net_device *netdev, const struct net_device_ops *ops) { … } static int ice_repr_ready_vf(struct ice_repr *repr) { … } static int ice_repr_ready_sf(struct ice_repr *repr) { … } /** * ice_repr_destroy - remove representor from VF * @repr: pointer to representor structure */ void ice_repr_destroy(struct ice_repr *repr) { … } static void ice_repr_rem_vf(struct ice_repr *repr) { … } static void ice_repr_rem_sf(struct ice_repr *repr) { … } static void ice_repr_set_tx_topology(struct ice_pf *pf, struct devlink *devlink) { … } /** * ice_repr_create - add representor for generic VSI * @src_vsi: pointer to VSI structure of device to represent */ static struct ice_repr *ice_repr_create(struct ice_vsi *src_vsi) { … } static int ice_repr_add_vf(struct ice_repr *repr) { … } /** * ice_repr_create_vf - add representor for VF VSI * @vf: VF to create port representor on * * Set correct representor type for VF and functions pointer. * * Return: created port representor on success, error otherwise */ struct ice_repr *ice_repr_create_vf(struct ice_vf *vf) { … } static int ice_repr_add_sf(struct ice_repr *repr) { … } /** * ice_repr_create_sf - add representor for SF VSI * @sf: SF to create port representor on * * Set correct representor type for SF and functions pointer. * * Return: created port representor on success, error otherwise */ struct ice_repr *ice_repr_create_sf(struct ice_dynamic_port *sf) { … } struct ice_repr *ice_repr_get(struct ice_pf *pf, u32 id) { … } /** * ice_repr_start_tx_queues - start Tx queues of port representor * @repr: pointer to repr structure */ void ice_repr_start_tx_queues(struct ice_repr *repr) { … } /** * ice_repr_stop_tx_queues - stop Tx queues of port representor * @repr: pointer to repr structure */ void ice_repr_stop_tx_queues(struct ice_repr *repr) { … }