ice_dcb_lib.h 2.6 KB
Newer Older
1 2 3 4 5 6 7
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2019, Intel Corporation. */

#ifndef _ICE_DCB_LIB_H_
#define _ICE_DCB_LIB_H_

#include "ice.h"
A
Anirudh Venkataramanan 已提交
8
#include "ice_base.h"
9 10 11
#include "ice_lib.h"

#ifdef CONFIG_DCB
D
Dave Ertman 已提交
12 13 14 15
#define ICE_TC_MAX_BW		100 /* Default Max BW percentage */
#define ICE_DCB_HW_CHG_RST	0 /* DCB configuration changed with reset */
#define ICE_DCB_NO_HW_CHG	1 /* DCB configuration did not change */
#define ICE_DCB_HW_CHG		2 /* DCB configuration changed, no reset */
16 17

void ice_dcb_rebuild(struct ice_pf *pf);
18 19
u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);
u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);
20
u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index);
D
Dave Ertman 已提交
21 22
int
ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked);
23
void ice_pf_dcb_recfg(struct ice_pf *pf);
24
void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi);
25
int ice_init_pf_dcb(struct ice_pf *pf, bool locked);
26
void ice_update_dcb_stats(struct ice_pf *pf);
27 28 29
int
ice_tx_prepare_vlan_flags_dcb(struct ice_ring *tx_ring,
			      struct ice_tx_buf *first);
30 31 32
void
ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,
				    struct ice_rq_event_info *event);
T
Tony Nguyen 已提交
33
void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc);
34 35 36 37 38
static inline void
ice_set_cgd_num(struct ice_tlan_ctx *tlan_ctx, struct ice_ring *ring)
{
	tlan_ctx->cgd_num = ring->dcb_tc;
}
39
#else
40 41
#define ice_dcb_rebuild(pf) do {} while (0)

42 43 44 45 46 47 48 49 50 51
static inline u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg __always_unused *dcbcfg)
{
	return ICE_DFLT_TRAFFIC_CLASS;
}

static inline u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg __always_unused *dcbcfg)
{
	return 1;
}

52 53 54 55 56 57 58
static inline u8
ice_dcb_get_tc(struct ice_vsi __always_unused *vsi,
	       int __always_unused queue_index)
{
	return 0;
}

59 60
static inline int
ice_init_pf_dcb(struct ice_pf *pf, bool __always_unused locked)
61
{
B
Brett Creeley 已提交
62
	dev_dbg(ice_pf_to_dev(pf), "DCB not supported\n");
63 64
	return -EOPNOTSUPP;
}
65

D
Dave Ertman 已提交
66 67 68 69 70 71 72 73
static inline int
ice_pf_dcb_cfg(struct ice_pf __always_unused *pf,
	       struct ice_dcbx_cfg __always_unused *new_cfg,
	       bool __always_unused locked)
{
	return -EOPNOTSUPP;
}

74 75 76 77 78 79 80
static inline int
ice_tx_prepare_vlan_flags_dcb(struct ice_ring __always_unused *tx_ring,
			      struct ice_tx_buf __always_unused *first)
{
	return 0;
}

81
#define ice_update_dcb_stats(pf) do {} while (0)
82
#define ice_pf_dcb_recfg(pf) do {} while (0)
83
#define ice_vsi_cfg_dcb_rings(vsi) do {} while (0)
84
#define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0)
85
#define ice_set_cgd_num(tlan_ctx, ring) do {} while (0)
T
Tony Nguyen 已提交
86
#define ice_vsi_cfg_netdev_tc(vsi, ena_tc) do {} while (0)
87 88
#endif /* CONFIG_DCB */
#endif /* _ICE_DCB_LIB_H_ */