src/dpdk/drivers/net/ice/base/ice_dcb.c
static void
ice_parse_cee_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)
{
	struct ice_cee_feat_tlv *sub_tlv;
	u8 subtype, feat_tlv_count = 0;
	u16 len, tlvlen, typelen;
	u32 ouisubtype;

	ouisubtype = NTOHL(tlv->ouisubtype);
	subtype = (u8)((ouisubtype & ICE_LLDP_TLV_SUBTYPE_M) >>
		       ICE_LLDP_TLV_SUBTYPE_S);
	/* Return if not CEE DCBX */
	if (subtype != ICE_CEE_DCBX_TYPE)
		return;

	typelen = NTOHS(tlv->typelen);
	tlvlen = ((typelen & ICE_LLDP_TLV_LEN_M) >> ICE_LLDP_TLV_LEN_S);
	len = sizeof(tlv->typelen) + sizeof(ouisubtype) +
		sizeof(struct ice_cee_ctrl_tlv);
	/* Return if no CEE DCBX Feature TLVs */
	if (tlvlen <= len)
		return;

	sub_tlv = (struct ice_cee_feat_tlv *)((char *)tlv + len);
	while (feat_tlv_count < ICE_CEE_MAX_FEAT_TYPE) {
		u16 sublen;

		typelen = NTOHS(sub_tlv->hdr.typelen);
		sublen = ((typelen & ICE_LLDP_TLV_LEN_M) >> ICE_LLDP_TLV_LEN_S);
		subtype = (u8)((typelen & ICE_LLDP_TLV_TYPE_M) >>
			       ICE_LLDP_TLV_TYPE_S);
		switch (subtype) {
		case ICE_CEE_SUBTYPE_PG_CFG:
			ice_parse_cee_pgcfg_tlv(sub_tlv, dcbcfg);
			break;
		case ICE_CEE_SUBTYPE_PFC_CFG:
			ice_parse_cee_pfccfg_tlv(sub_tlv, dcbcfg);
			break;
		case ICE_CEE_SUBTYPE_APP_PRI:
			ice_parse_cee_app_tlv(sub_tlv, dcbcfg);
			break;
		default:
			return;	/* Invalid Sub-type return */
		}
		feat_tlv_count++;
		/* Move to next sub TLV */
		sub_tlv = (struct ice_cee_feat_tlv *)
			  ((char *)sub_tlv + sizeof(sub_tlv->hdr.typelen) +
			   sublen);
	}
}
/**
 * ice_parse_cee_tlv
 * @tlv: CEE DCBX TLV
 * @dcbcfg: Local store to update DCBX config data
 *
 * Get the TLV subtype and send it to parsing function
 * based on the subtype value
 */


Get the TLV subtype and send it to parsing function
based on the subtype value
Get the TLV subtype and send it to parsing function based on the subtype value
static void
ice_parse_cee_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)
{
	struct ice_cee_feat_tlv *sub_tlv;
	u8 subtype, feat_tlv_count = 0;
	u16 len, tlvlen, typelen;
	u32 ouisubtype;
	ouisubtype = NTOHL(tlv->ouisubtype);
	subtype = (u8)((ouisubtype & ICE_LLDP_TLV_SUBTYPE_M) >>
		       ICE_LLDP_TLV_SUBTYPE_S);
	if (subtype != ICE_CEE_DCBX_TYPE)
		return;
	typelen = NTOHS(tlv->typelen);
	tlvlen = ((typelen & ICE_LLDP_TLV_LEN_M) >> ICE_LLDP_TLV_LEN_S);
	len = sizeof(tlv->typelen) + sizeof(ouisubtype) +
		sizeof(struct ice_cee_ctrl_tlv);
	if (tlvlen <= len)
		return;
	sub_tlv = (struct ice_cee_feat_tlv *)((char *)tlv + len);
	while (feat_tlv_count < ICE_CEE_MAX_FEAT_TYPE) {
		u16 sublen;
		typelen = NTOHS(sub_tlv->hdr.typelen);
		sublen = ((typelen & ICE_LLDP_TLV_LEN_M) >> ICE_LLDP_TLV_LEN_S);
		subtype = (u8)((typelen & ICE_LLDP_TLV_TYPE_M) >>
			       ICE_LLDP_TLV_TYPE_S);
		switch (subtype) {
		case ICE_CEE_SUBTYPE_PG_CFG:
			ice_parse_cee_pgcfg_tlv(sub_tlv, dcbcfg);
			break;
		case ICE_CEE_SUBTYPE_PFC_CFG:
			ice_parse_cee_pfccfg_tlv(sub_tlv, dcbcfg);
			break;
		case ICE_CEE_SUBTYPE_APP_PRI:
			ice_parse_cee_app_tlv(sub_tlv, dcbcfg);
			break;
		default:
			return;	
		}
		feat_tlv_count++;
		sub_tlv = (struct ice_cee_feat_tlv *)
			  ((char *)sub_tlv + sizeof(sub_tlv->hdr.typelen) +
			   sublen);
	}
}
static void ice_parse_cee_tlv ( struct ice_lldp_org_tlv * tlv , struct ice_dcbx_cfg * dcbcfg ) { struct ice_cee_feat_tlv * sub_tlv ; u8 subtype , feat_tlv_count = 0 ; u16 len , tlvlen , typelen ; u32 ouisubtype ; ouisubtype = NTOHL ( tlv -> ouisubtype ) ; subtype = ( u8 ) ( ( ouisubtype & ICE_LLDP_TLV_SUBTYPE_M ) >> ICE_LLDP_TLV_SUBTYPE_S ) ; if ( subtype != ICE_CEE_DCBX_TYPE ) return ; typelen = NTOHS ( tlv -> typelen ) ; tlvlen = ( ( typelen & ICE_LLDP_TLV_LEN_M ) >> ICE_LLDP_TLV_LEN_S ) ; len = sizeof ( tlv -> typelen ) + sizeof ( ouisubtype ) + sizeof ( struct ice_cee_ctrl_tlv ) ; if ( tlvlen <= len ) return ; sub_tlv = ( struct ice_cee_feat_tlv * ) ( ( char * ) tlv + len ) ; while ( feat_tlv_count < ICE_CEE_MAX_FEAT_TYPE ) { u16 sublen ; typelen = NTOHS ( sub_tlv -> hdr . typelen ) ; sublen = ( ( typelen & ICE_LLDP_TLV_LEN_M ) >> ICE_LLDP_TLV_LEN_S ) ; subtype = ( u8 ) ( ( typelen & ICE_LLDP_TLV_TYPE_M ) >> ICE_LLDP_TLV_TYPE_S ) ; switch ( subtype ) { case ICE_CEE_SUBTYPE_PG_CFG : ice_parse_cee_pgcfg_tlv ( sub_tlv , dcbcfg ) ; break ; case ICE_CEE_SUBTYPE_PFC_CFG : ice_parse_cee_pfccfg_tlv ( sub_tlv , dcbcfg ) ; break ; case ICE_CEE_SUBTYPE_APP_PRI : ice_parse_cee_app_tlv ( sub_tlv , dcbcfg ) ; break ; default : return ; } feat_tlv_count ++ ; sub_tlv = ( struct ice_cee_feat_tlv * ) ( ( char * ) sub_tlv + sizeof ( sub_tlv -> hdr . typelen ) + sublen ) ; } }
ice_parse_cee_tlv
 @tlv: CEE DCBX TLV
 @dcbcfg: Local store to update DCBX config data
ice_parse_cee_tlv @tlv : CEE DCBX TLV @dcbcfg : Local store to update DCBX config data
/* Return if not CEE DCBX */ /* Return if no CEE DCBX Feature TLVs */ /* Invalid Sub-type return */ /* Move to next sub TLV */