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

#ifndef _ICE_DCB_LIB_H_
#define _ICE_DCB_LIB_H_

#include "ice.h"
#include "ice_lib.h"

#ifdef CONFIG_DCB
11 12 13
#define ICE_TC_MAX_BW 100 /* Default Max BW percentage */

void ice_dcb_rebuild(struct ice_pf *pf);
14 15
u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);
u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);
16
void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi);
17
int ice_init_pf_dcb(struct ice_pf *pf);
18
void ice_update_dcb_stats(struct ice_pf *pf);
19 20 21
int
ice_tx_prepare_vlan_flags_dcb(struct ice_ring *tx_ring,
			      struct ice_tx_buf *first);
22 23 24
void
ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,
				    struct ice_rq_event_info *event);
25 26 27 28 29
static inline void
ice_set_cgd_num(struct ice_tlan_ctx *tlan_ctx, struct ice_ring *ring)
{
	tlan_ctx->cgd_num = ring->dcb_tc;
}
30
#else
31 32
#define ice_dcb_rebuild(pf) do {} while (0)

33 34 35 36 37 38 39 40 41 42
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;
}

43 44 45 46 47
static inline int ice_init_pf_dcb(struct ice_pf *pf)
{
	dev_dbg(&pf->pdev->dev, "DCB not supported\n");
	return -EOPNOTSUPP;
}
48

49 50 51 52 53 54 55
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;
}

56
#define ice_update_dcb_stats(pf) do {} while (0)
57
#define ice_vsi_cfg_dcb_rings(vsi) do {} while (0)
58
#define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0)
59
#define ice_set_cgd_num(tlan_ctx, ring) do {} while (0)
60 61
#endif /* CONFIG_DCB */
#endif /* _ICE_DCB_LIB_H_ */