linux/drivers/net/ethernet/intel/ice/ice_dcb.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2019, Intel Corporation. */

#ifndef _ICE_DCB_H_
#define _ICE_DCB_H_

#include "ice_type.h"
#include <scsi/iscsi_proto.h>

#define ICE_DCBX_STATUS_NOT_STARTED
#define ICE_DCBX_STATUS_IN_PROGRESS
#define ICE_DCBX_STATUS_DONE
#define ICE_DCBX_STATUS_DIS

#define ICE_TLV_TYPE_END
#define ICE_TLV_TYPE_ORG

#define ICE_IEEE_8021QAZ_OUI
#define ICE_IEEE_SUBTYPE_ETS_CFG
#define ICE_IEEE_SUBTYPE_ETS_REC
#define ICE_IEEE_SUBTYPE_PFC_CFG
#define ICE_IEEE_SUBTYPE_APP_PRI

#define ICE_CEE_DCBX_OUI
#define ICE_CEE_DCBX_TYPE

#define ICE_DSCP_OUI
#define ICE_DSCP_SUBTYPE_DSCP2UP
#define ICE_DSCP_SUBTYPE_ENFORCE
#define ICE_DSCP_SUBTYPE_TCBW
#define ICE_DSCP_SUBTYPE_PFC
#define ICE_DSCP_IPV6_OFFSET

#define ICE_CEE_SUBTYPE_PG_CFG
#define ICE_CEE_SUBTYPE_PFC_CFG
#define ICE_CEE_SUBTYPE_APP_PRI
#define ICE_CEE_MAX_FEAT_TYPE
/* Defines for LLDP TLV header */
#define ICE_LLDP_TLV_LEN_S
#define ICE_LLDP_TLV_LEN_M
#define ICE_LLDP_TLV_TYPE_S
#define ICE_LLDP_TLV_TYPE_M
#define ICE_LLDP_TLV_SUBTYPE_S
#define ICE_LLDP_TLV_SUBTYPE_M
#define ICE_LLDP_TLV_OUI_S
#define ICE_LLDP_TLV_OUI_M

/* Defines for IEEE ETS TLV */
#define ICE_IEEE_ETS_MAXTC_S
#define ICE_IEEE_ETS_MAXTC_M
#define ICE_IEEE_ETS_CBS_S
#define ICE_IEEE_ETS_CBS_M
#define ICE_IEEE_ETS_WILLING_S
#define ICE_IEEE_ETS_WILLING_M
#define ICE_IEEE_ETS_PRIO_0_S
#define ICE_IEEE_ETS_PRIO_0_M
#define ICE_IEEE_ETS_PRIO_1_S
#define ICE_IEEE_ETS_PRIO_1_M
#define ICE_CEE_PGID_PRIO_0_S
#define ICE_CEE_PGID_PRIO_0_M
#define ICE_CEE_PGID_PRIO_1_S
#define ICE_CEE_PGID_PRIO_1_M
#define ICE_CEE_PGID_STRICT

/* Defines for IEEE TSA types */
#define ICE_IEEE_TSA_STRICT
#define ICE_IEEE_TSA_ETS

/* Defines for IEEE PFC TLV */
#define ICE_IEEE_PFC_CAP_S
#define ICE_IEEE_PFC_CAP_M
#define ICE_IEEE_PFC_MBC_S
#define ICE_IEEE_PFC_MBC_M
#define ICE_IEEE_PFC_WILLING_S
#define ICE_IEEE_PFC_WILLING_M

/* Defines for IEEE APP TLV */
#define ICE_IEEE_APP_SEL_S
#define ICE_IEEE_APP_SEL_M
#define ICE_IEEE_APP_PRIO_S
#define ICE_IEEE_APP_PRIO_M

/* TLV definitions for preparing MIB */
#define ICE_IEEE_TLV_ID_ETS_CFG
#define ICE_IEEE_TLV_ID_ETS_REC
#define ICE_IEEE_TLV_ID_PFC_CFG
#define ICE_IEEE_TLV_ID_APP_PRI
#define ICE_TLV_ID_END_OF_LLDPPDU
#define ICE_TLV_ID_START
#define ICE_TLV_ID_DSCP_UP
#define ICE_TLV_ID_DSCP_ENF
#define ICE_TLV_ID_DSCP_TC_BW
#define ICE_TLV_ID_DSCP_TO_PFC

#define ICE_IEEE_ETS_TLV_LEN
#define ICE_IEEE_PFC_TLV_LEN
#define ICE_IEEE_APP_TLV_LEN

#define ICE_DSCP_UP_TLV_LEN
#define ICE_DSCP_ENF_TLV_LEN
#define ICE_DSCP_TC_BW_TLV_LEN
#define ICE_DSCP_PFC_TLV_LEN

/* IEEE 802.1AB LLDP Organization specific TLV */
struct ice_lldp_org_tlv {} __packed;

struct ice_cee_tlv_hdr {};

struct ice_cee_ctrl_tlv {};

struct ice_cee_feat_tlv {};

struct ice_cee_app_prio {} __packed;

int ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd);
int
ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
		   struct ice_dcbx_cfg *dcbcfg);
int ice_get_dcb_cfg(struct ice_port_info *pi);
int ice_set_dcb_cfg(struct ice_port_info *pi);
void ice_get_dcb_cfg_from_mib_change(struct ice_port_info *pi,
				     struct ice_rq_event_info *event);
int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
int
ice_query_port_ets(struct ice_port_info *pi,
		   struct ice_aqc_port_ets_elem *buf, u16 buf_size,
		   struct ice_sq_cd *cmd_details);
#ifdef CONFIG_DCB
int
ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
		 struct ice_sq_cd *cd);
int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
int
ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
		       bool *dcbx_agent_status, struct ice_sq_cd *cd);
int ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
#else /* CONFIG_DCB */
static inline int
ice_aq_stop_lldp(struct ice_hw __always_unused *hw,
		 bool __always_unused shutdown_lldp_agent,
		 bool __always_unused persist,
		 struct ice_sq_cd __always_unused *cd)
{
	return 0;
}

static inline int
ice_aq_start_lldp(struct ice_hw __always_unused *hw,
		  bool __always_unused persist,
		  struct ice_sq_cd __always_unused *cd)
{
	return 0;
}

static inline int
ice_aq_start_stop_dcbx(struct ice_hw __always_unused *hw,
		       bool __always_unused start_dcbx_agent,
		       bool *dcbx_agent_status,
		       struct ice_sq_cd __always_unused *cd)
{
	*dcbx_agent_status = false;

	return 0;
}

static inline int
ice_cfg_lldp_mib_change(struct ice_hw __always_unused *hw,
			bool __always_unused ena_mib)
{
	return 0;
}

#endif /* CONFIG_DCB */
#endif /* _ICE_DCB_H_ */