// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019, Intel Corporation. */ #include "ice.h" #include "ice_dcb.h" #include "ice_dcb_lib.h" #include "ice_dcb_nl.h" #include <net/dcbnl.h> /** * ice_dcbnl_devreset - perform enough of a ifdown/ifup to sync DCBNL info * @netdev: device associated with interface that needs reset */ static void ice_dcbnl_devreset(struct net_device *netdev) { … } /** * ice_dcbnl_getets - retrieve local ETS configuration * @netdev: the relevant netdev * @ets: struct to hold ETS configuration */ static int ice_dcbnl_getets(struct net_device *netdev, struct ieee_ets *ets) { … } /** * ice_dcbnl_setets - set IEEE ETS configuration * @netdev: pointer to relevant netdev * @ets: struct to hold ETS configuration */ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets) { … } /** * ice_dcbnl_getnumtcs - Get max number of traffic classes supported * @dev: pointer to netdev struct * @tcid: TC ID * @num: total number of TCs supported by the adapter * * Return the total number of TCs supported */ static int ice_dcbnl_getnumtcs(struct net_device *dev, int __always_unused tcid, u8 *num) { … } /** * ice_dcbnl_getdcbx - retrieve current DCBX capability * @netdev: pointer to the netdev struct */ static u8 ice_dcbnl_getdcbx(struct net_device *netdev) { … } /** * ice_dcbnl_setdcbx - set required DCBX capability * @netdev: the corresponding netdev * @mode: required mode */ static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) { … } /** * ice_dcbnl_get_perm_hw_addr - MAC address used by DCBX * @netdev: pointer to netdev struct * @perm_addr: buffer to return permanent MAC address */ static void ice_dcbnl_get_perm_hw_addr(struct net_device *netdev, u8 *perm_addr) { … } /** * ice_get_pfc_delay - Retrieve PFC Link Delay * @hw: pointer to HW struct * @delay: holds the PFC Link Delay value */ static void ice_get_pfc_delay(struct ice_hw *hw, u16 *delay) { … } /** * ice_dcbnl_getpfc - retrieve local IEEE PFC config * @netdev: pointer to netdev struct * @pfc: struct to hold PFC info */ static int ice_dcbnl_getpfc(struct net_device *netdev, struct ieee_pfc *pfc) { … } /** * ice_dcbnl_setpfc - set local IEEE PFC config * @netdev: pointer to relevant netdev * @pfc: pointer to struct holding PFC config */ static int ice_dcbnl_setpfc(struct net_device *netdev, struct ieee_pfc *pfc) { … } /** * ice_dcbnl_get_pfc_cfg - Get CEE PFC config * @netdev: pointer to netdev struct * @prio: corresponding user priority * @setting: the PFC setting for given priority */ static void ice_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio, u8 *setting) { … } /** * ice_dcbnl_set_pfc_cfg - Set CEE PFC config * @netdev: the corresponding netdev * @prio: User Priority * @set: PFC setting to apply */ static void ice_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio, u8 set) { … } /** * ice_dcbnl_getpfcstate - get CEE PFC mode * @netdev: pointer to netdev struct */ static u8 ice_dcbnl_getpfcstate(struct net_device *netdev) { … } /** * ice_dcbnl_getstate - get DCB enabled state * @netdev: pointer to netdev struct */ static u8 ice_dcbnl_getstate(struct net_device *netdev) { … } /** * ice_dcbnl_setstate - Set CEE DCB state * @netdev: pointer to relevant netdev * @state: state value to set */ static u8 ice_dcbnl_setstate(struct net_device *netdev, u8 state) { … } /** * ice_dcbnl_get_pg_tc_cfg_tx - get CEE PG Tx config * @netdev: pointer to netdev struct * @prio: the corresponding user priority * @prio_type: traffic priority type * @pgid: the BW group ID the traffic class belongs to * @bw_pct: BW percentage for the corresponding BWG * @up_map: prio mapped to corresponding TC */ static void ice_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int prio, u8 __always_unused *prio_type, u8 *pgid, u8 __always_unused *bw_pct, u8 __always_unused *up_map) { … } /** * ice_dcbnl_set_pg_tc_cfg_tx - set CEE PG Tx config * @netdev: pointer to relevant netdev * @tc: the corresponding traffic class * @prio_type: the traffic priority type * @bwg_id: the BW group ID the TC belongs to * @bw_pct: the BW perventage for the BWG * @up_map: prio mapped to corresponding TC */ static void ice_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, u8 __always_unused prio_type, u8 __always_unused bwg_id, u8 __always_unused bw_pct, u8 up_map) { … } /** * ice_dcbnl_get_pg_bwg_cfg_tx - Get CEE PGBW config * @netdev: pointer to the netdev struct * @pgid: corresponding traffic class * @bw_pct: the BW percentage for the corresponding TC */ static void ice_dcbnl_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 *bw_pct) { … } /** * ice_dcbnl_set_pg_bwg_cfg_tx - set CEE PG Tx BW config * @netdev: the corresponding netdev * @pgid: Correspongind traffic class * @bw_pct: the BW percentage for the specified TC */ static void ice_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 bw_pct) { … } /** * ice_dcbnl_get_pg_tc_cfg_rx - Get CEE PG Rx config * @netdev: pointer to netdev struct * @prio: the corresponding user priority * @prio_type: the traffic priority type * @pgid: the PG ID * @bw_pct: the BW percentage for the corresponding BWG * @up_map: prio mapped to corresponding TC */ static void ice_dcbnl_get_pg_tc_cfg_rx(struct net_device *netdev, int prio, u8 __always_unused *prio_type, u8 *pgid, u8 __always_unused *bw_pct, u8 __always_unused *up_map) { … } /** * ice_dcbnl_set_pg_tc_cfg_rx * @netdev: relevant netdev struct * @prio: corresponding user priority * @prio_type: the traffic priority type * @pgid: the PG ID * @bw_pct: BW percentage for corresponding BWG * @up_map: prio mapped to corresponding TC * * lldpad requires this function pointer to be non-NULL to complete CEE config. */ static void ice_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int __always_unused prio, u8 __always_unused prio_type, u8 __always_unused pgid, u8 __always_unused bw_pct, u8 __always_unused up_map) { … } /** * ice_dcbnl_get_pg_bwg_cfg_rx - Get CEE PG BW Rx config * @netdev: pointer to netdev struct * @pgid: the corresponding traffic class * @bw_pct: the BW percentage for the corresponding TC */ static void ice_dcbnl_get_pg_bwg_cfg_rx(struct net_device *netdev, int __always_unused pgid, u8 *bw_pct) { … } /** * ice_dcbnl_set_pg_bwg_cfg_rx * @netdev: the corresponding netdev * @pgid: corresponding TC * @bw_pct: BW percentage for given TC * * lldpad requires this function pointer to be non-NULL to complete CEE config. */ static void ice_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int __always_unused pgid, u8 __always_unused bw_pct) { … } /** * ice_dcbnl_get_cap - Get DCBX capabilities of adapter * @netdev: pointer to netdev struct * @capid: the capability type * @cap: the capability value */ static u8 ice_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap) { … } /** * ice_dcbnl_getapp - get CEE APP * @netdev: pointer to netdev struct * @idtype: the App selector * @id: the App ethtype or port number */ static int ice_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) { … } /** * ice_dcbnl_find_app - Search for APP in given DCB config * @cfg: struct to hold DCBX config * @app: struct to hold app data to look for */ static bool ice_dcbnl_find_app(struct ice_dcbx_cfg *cfg, struct ice_dcb_app_priority_table *app) { … } #define ICE_BYTES_PER_DSCP_VAL … /** * ice_dcbnl_setapp - set local IEEE App config * @netdev: relevant netdev struct * @app: struct to hold app config info */ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app) { … } /** * ice_dcbnl_delapp - Delete local IEEE App config * @netdev: relevant netdev * @app: struct to hold app too delete * * Will not delete first application required by the FW */ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) { … } /** * ice_dcbnl_cee_set_all - Commit CEE DCB settings to HW * @netdev: the corresponding netdev */ static u8 ice_dcbnl_cee_set_all(struct net_device *netdev) { … } static const struct dcbnl_rtnl_ops dcbnl_ops = …; /** * ice_dcbnl_set_all - set all the apps and ieee data from DCBX config * @vsi: pointer to VSI struct */ void ice_dcbnl_set_all(struct ice_vsi *vsi) { … } /** * ice_dcbnl_vsi_del_app - Delete APP on all VSIs * @vsi: pointer to the main VSI * @app: APP to delete * * Delete given APP from all the VSIs for given PF */ static void ice_dcbnl_vsi_del_app(struct ice_vsi *vsi, struct ice_dcb_app_priority_table *app) { … } /** * ice_dcbnl_flush_apps - Delete all removed APPs * @pf: the corresponding PF * @old_cfg: old DCBX configuration data * @new_cfg: new DCBX configuration data * * Find and delete all APPS that are not present in the passed * DCB configuration */ void ice_dcbnl_flush_apps(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, struct ice_dcbx_cfg *new_cfg) { … } /** * ice_dcbnl_setup - setup DCBNL * @vsi: VSI to get associated netdev from */ void ice_dcbnl_setup(struct ice_vsi *vsi) { … }