src/dpdk/drivers/net/qede/base/ecore_dcbx.c
static enum _ecore_status_t
ecore_dcbx_process_tlv(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
		       struct ecore_dcbx_results *p_data,
		       struct dcbx_app_priority_entry *p_tbl, u32 pri_tc_tbl,
		       int count, u8 dcbx_version)
{
	enum dcbx_protocol_type type;
	bool enable, ieee, eth_tlv;
	u8 tc, priority_map;
	u16 protocol_id;
	u8 priority;
	enum _ecore_status_t rc = ECORE_SUCCESS;
	int i;

	DP_VERBOSE(p_hwfn, ECORE_MSG_DCB,
		   "Num APP entries = %d pri_tc_tbl = 0x%x dcbx_version = %u\n",
		   count, pri_tc_tbl, dcbx_version);

	ieee = (dcbx_version == DCBX_CONFIG_VERSION_IEEE);
	eth_tlv = false;
	/* Parse APP TLV */
	for (i = 0; i < count; i++) {
		protocol_id = GET_MFW_FIELD(p_tbl[i].entry,
					    DCBX_APP_PROTOCOL_ID);
		priority_map = GET_MFW_FIELD(p_tbl[i].entry, DCBX_APP_PRI_MAP);
		DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "Id = 0x%x pri_map = %u\n",
			   protocol_id, priority_map);
		rc = ecore_dcbx_get_app_priority(priority_map, &priority);
		if (rc == ECORE_INVAL) {
			DP_ERR(p_hwfn, "Invalid priority\n");
			return ECORE_INVAL;
		}

		tc = ECORE_DCBX_PRIO2TC(pri_tc_tbl, priority);
		if (ecore_dcbx_get_app_protocol_type(p_hwfn, p_tbl[i].entry,
						     protocol_id, &type,
						     ieee)) {
			/* ETH always have the enable bit reset, as it gets
			 * vlan information per packet. For other protocols,
			 * should be set according to the dcbx_enabled
			 * indication, but we only got here if there was an
			 * app tlv for the protocol, so dcbx must be enabled.
			 */
			if (type == DCBX_PROTOCOL_ETH) {
				enable = false;
				eth_tlv = true;
			} else {
				enable = true;
			}

			ecore_dcbx_update_app_info(p_data, p_hwfn, p_ptt,
						   enable, priority, tc, type);
		}
	}

	/* If Eth TLV is not detected, use UFP TC as default TC */
	if (OSAL_GET_BIT(ECORE_MF_UFP_SPECIFIC,
			  &p_hwfn->p_dev->mf_bits) && !eth_tlv)
		p_data->arr[DCBX_PROTOCOL_ETH].tc = p_hwfn->ufp_info.tc;

	/* Update ramrod protocol data and hw_info fields
	 * with default info when corresponding APP TLV's are not detected.
	 * The enabled field has a different logic for ethernet as only for
	 * ethernet dcb should disabled by default, as the information arrives
	 * from the OS (unless an explicit app tlv was present).
	 */
	tc = p_data->arr[DCBX_PROTOCOL_ETH].tc;
	priority = p_data->arr[DCBX_PROTOCOL_ETH].priority;
	for (type = 0; type < DCBX_MAX_PROTOCOL_TYPE; type++) {
		if (p_data->arr[type].update)
			continue;

		/* if no app tlv was present, don't override in FW */
		ecore_dcbx_update_app_info(p_data, p_hwfn, p_ptt,
					  p_data->arr[DCBX_PROTOCOL_ETH].enable,
					  priority, tc, type);
	}

	return ECORE_SUCCESS;
}
/* Parse app TLV's to update TC information in hw_info structure for
 * reconfiguring QM. Get protocol specific data for PF update ramrod command.
 */
Parse app TLV's to update TC information in hw_info structure for
reconfiguring QM. Get protocol specific data for PF update ramrod command.
Parse app TLV ' s to update TC information in hw_info structure for reconfiguring QM . Get protocol specific data for PF update ramrod command .
static enum _ecore_status_t
ecore_dcbx_process_tlv(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
		       struct ecore_dcbx_results *p_data,
		       struct dcbx_app_priority_entry *p_tbl, u32 pri_tc_tbl,
		       int count, u8 dcbx_version)
{
	enum dcbx_protocol_type type;
	bool enable, ieee, eth_tlv;
	u8 tc, priority_map;
	u16 protocol_id;
	u8 priority;
	enum _ecore_status_t rc = ECORE_SUCCESS;
	int i;
	DP_VERBOSE(p_hwfn, ECORE_MSG_DCB,
		   "Num APP entries = %d pri_tc_tbl = 0x%x dcbx_version = %u\n",
		   count, pri_tc_tbl, dcbx_version);
	ieee = (dcbx_version == DCBX_CONFIG_VERSION_IEEE);
	eth_tlv = false;
	for (i = 0; i < count; i++) {
		protocol_id = GET_MFW_FIELD(p_tbl[i].entry,
					    DCBX_APP_PROTOCOL_ID);
		priority_map = GET_MFW_FIELD(p_tbl[i].entry, DCBX_APP_PRI_MAP);
		DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "Id = 0x%x pri_map = %u\n",
			   protocol_id, priority_map);
		rc = ecore_dcbx_get_app_priority(priority_map, &priority);
		if (rc == ECORE_INVAL) {
			DP_ERR(p_hwfn, "Invalid priority\n");
			return ECORE_INVAL;
		}
		tc = ECORE_DCBX_PRIO2TC(pri_tc_tbl, priority);
		if (ecore_dcbx_get_app_protocol_type(p_hwfn, p_tbl[i].entry,
						     protocol_id, &type,
						     ieee)) {
			if (type == DCBX_PROTOCOL_ETH) {
				enable = false;
				eth_tlv = true;
			} else {
				enable = true;
			}
			ecore_dcbx_update_app_info(p_data, p_hwfn, p_ptt,
						   enable, priority, tc, type);
		}
	}
	if (OSAL_GET_BIT(ECORE_MF_UFP_SPECIFIC,
			  &p_hwfn->p_dev->mf_bits) && !eth_tlv)
		p_data->arr[DCBX_PROTOCOL_ETH].tc = p_hwfn->ufp_info.tc;
	tc = p_data->arr[DCBX_PROTOCOL_ETH].tc;
	priority = p_data->arr[DCBX_PROTOCOL_ETH].priority;
	for (type = 0; type < DCBX_MAX_PROTOCOL_TYPE; type++) {
		if (p_data->arr[type].update)
			continue;
		ecore_dcbx_update_app_info(p_data, p_hwfn, p_ptt,
					  p_data->arr[DCBX_PROTOCOL_ETH].enable,
					  priority, tc, type);
	}
	return ECORE_SUCCESS;
}
static enum _ecore_status_t ecore_dcbx_process_tlv ( struct ecore_hwfn * p_hwfn , struct ecore_ptt * p_ptt , struct ecore_dcbx_results * p_data , struct dcbx_app_priority_entry * p_tbl , u32 pri_tc_tbl , int count , u8 dcbx_version ) { enum dcbx_protocol_type type ; bool enable , ieee , eth_tlv ; u8 tc , priority_map ; u16 protocol_id ; u8 priority ; enum _ecore_status_t rc = ECORE_SUCCESS ; int i ; DP_VERBOSE ( p_hwfn , ECORE_MSG_DCB , " \n " , count , pri_tc_tbl , dcbx_version ) ; ieee = ( dcbx_version == DCBX_CONFIG_VERSION_IEEE ) ; eth_tlv = false ; for ( i = 0 ; i < count ; i ++ ) { protocol_id = GET_MFW_FIELD ( p_tbl [ i ] . entry , DCBX_APP_PROTOCOL_ID ) ; priority_map = GET_MFW_FIELD ( p_tbl [ i ] . entry , DCBX_APP_PRI_MAP ) ; DP_VERBOSE ( p_hwfn , ECORE_MSG_DCB , " \n " , protocol_id , priority_map ) ; rc = ecore_dcbx_get_app_priority ( priority_map , & priority ) ; if ( rc == ECORE_INVAL ) { DP_ERR ( p_hwfn , " \n " ) ; return ECORE_INVAL ; } tc = ECORE_DCBX_PRIO2TC ( pri_tc_tbl , priority ) ; if ( ecore_dcbx_get_app_protocol_type ( p_hwfn , p_tbl [ i ] . entry , protocol_id , & type , ieee ) ) { if ( type == DCBX_PROTOCOL_ETH ) { enable = false ; eth_tlv = true ; } else { enable = true ; } ecore_dcbx_update_app_info ( p_data , p_hwfn , p_ptt , enable , priority , tc , type ) ; } } if ( OSAL_GET_BIT ( ECORE_MF_UFP_SPECIFIC , & p_hwfn -> p_dev -> mf_bits ) && ! eth_tlv ) p_data -> arr [ DCBX_PROTOCOL_ETH ] . tc = p_hwfn -> ufp_info . tc ; tc = p_data -> arr [ DCBX_PROTOCOL_ETH ] . tc ; priority = p_data -> arr [ DCBX_PROTOCOL_ETH ] . priority ; for ( type = 0 ; type < DCBX_MAX_PROTOCOL_TYPE ; type ++ ) { if ( p_data -> arr [ type ] . update ) continue ; ecore_dcbx_update_app_info ( p_data , p_hwfn , p_ptt , p_data -> arr [ DCBX_PROTOCOL_ETH ] . enable , priority , tc , type ) ; } return ECORE_SUCCESS ; }
Parse app TLV's to update TC information in hw_info structure for
 reconfiguring QM.
Parse app TLV ' s to update TC information in hw_info structure for reconfiguring QM .
/* Parse APP TLV */ /* ETH always have the enable bit reset, as it gets
			 * vlan information per packet. For other protocols,
			 * should be set according to the dcbx_enabled
			 * indication, but we only got here if there was an
			 * app tlv for the protocol, so dcbx must be enabled.
			 */ /* If Eth TLV is not detected, use UFP TC as default TC */ /* Update ramrod protocol data and hw_info fields
	 * with default info when corresponding APP TLV's are not detected.
	 * The enabled field has a different logic for ethernet as only for
	 * ethernet dcb should disabled by default, as the information arrives
	 * from the OS (unless an explicit app tlv was present).
	 */ /* if no app tlv was present, don't override in FW */