software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief set Qos map
 *
 * @param wiphy         A pointer to wiphy structure
 * @param dev           A pointer to net_device structure
 * @param qos_map       A pointer to cfg80211_qos_map structure
 *
 *
 * @return              0 -- success, otherwise fail
 */
@brief set Qos map
@param wiphy         A pointer to wiphy structure
@param dev           A pointer to net_device structure
@param qos_map       A pointer to cfg80211_qos_map structure

@return              0 -- success, otherwise fail
@brief set Qos map @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @param qos_map A pointer to cfg80211_qos_map structure @return 0 -- success otherwise fail
int
woal_cfg80211_set_qos_map(struct wiphy *wiphy,
			  struct net_device *dev,
			  struct cfg80211_qos_map *qos_map)
{
	moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
	int i, j, ret = 0;
	ENTER();
	if (!qos_map) {
		memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map));
		goto done;
	}
	for (i = 0; i < MAX_NUM_TID; i++) {
		PRINTM(MINFO, "TID %d: dscp_low=%d, dscp_high=%d\n", i,
		       qos_map->up[i].low, qos_map->up[i].high);
		if (qos_map->up[i].low != 0xff && qos_map->up[i].high != 0xff
		    && qos_map->up[i].high <= 63) {
			for (j = qos_map->up[i].low; j <= qos_map->up[i].high;
			     j++)
				priv->dscp_map[j] = i;
		}
	}
	for (i = 0; i < qos_map->num_des; i++) {
		if ((qos_map->dscp_exception[i].dscp <= 63) &&
		    (qos_map->dscp_exception[i].up <= 7)) {
			PRINTM(MINFO, "dscp excpt: value=%d priority=%d\n",
			       qos_map->dscp_exception[i].dscp,
			       qos_map->dscp_exception[i].up);
			priv->dscp_map[qos_map->dscp_exception[i].dscp] =
				qos_map->dscp_exception[i].up;
		}
	}
	if (priv->bss_type == MLAN_BSS_TYPE_UAP) {
		IEEEtypes_Generic_t qos_map_ie;
		t_u16 qos_map_ies_len;
		qos_map_ie.ieee_hdr.element_id = QOS_MAPPING;
		qos_map_ie.ieee_hdr.len =
			2 * qos_map->num_des + sizeof(qos_map->up);
		qos_map_ies_len =
			qos_map_ie.ieee_hdr.len + sizeof(qos_map_ie.ieee_hdr);
		if (qos_map_ies_len > sizeof(qos_map_ie.data)) {
			PRINTM(MERROR,
			       "QoS MAP IE size exceeds the buffer len\n");
			goto done;
		}
		memcpy(qos_map_ie.data, (t_u8 *)qos_map->dscp_exception,
		       2 * qos_map->num_des);
		memcpy(&qos_map_ie.data[2 * qos_map->num_des],
		       (t_u8 *)qos_map->up, sizeof(qos_map->up));
		ret = woal_cfg80211_mgmt_frame_ie(priv,
						  NULL, 0, NULL, 0,
						  (t_u8 *)&qos_map_ie,
						  qos_map_ies_len, NULL, 0,
						  MGMT_MASK_ASSOC_RESP_QOS_MAP,
						  MOAL_IOCTL_WAIT);
		if (ret) {
			PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n");
			goto done;
		}
	}
done:
	LEAVE();
	return ret;
}
int woal_cfg80211_set_qos_map ( struct wiphy * wiphy , struct net_device * dev , struct cfg80211_qos_map * qos_map ) { moal_private * priv = ( moal_private * ) woal_get_netdev_priv ( dev ) ; int i , j , ret = 0 ; ENTER ( ) ; if ( ! qos_map ) { memset ( priv -> dscp_map , 0xFF , sizeof ( priv -> dscp_map ) ) ; goto done ; } for ( i = 0 ; i < MAX_NUM_TID ; i ++ ) { PRINTM ( MINFO , " \n " , i , qos_map -> up [ i ] . low , qos_map -> up [ i ] . high ) ; if ( qos_map -> up [ i ] . low != 0xff && qos_map -> up [ i ] . high != 0xff && qos_map -> up [ i ] . high <= 63 ) { for ( j = qos_map -> up [ i ] . low ; j <= qos_map -> up [ i ] . high ; j ++ ) priv -> dscp_map [ j ] = i ; } } for ( i = 0 ; i < qos_map -> num_des ; i ++ ) { if ( ( qos_map -> dscp_exception [ i ] . dscp <= 63 ) && ( qos_map -> dscp_exception [ i ] . up <= 7 ) ) { PRINTM ( MINFO , " \n " , qos_map -> dscp_exception [ i ] . dscp , qos_map -> dscp_exception [ i ] . up ) ; priv -> dscp_map [ qos_map -> dscp_exception [ i ] . dscp ] = qos_map -> dscp_exception [ i ] . up ; } } if ( priv -> bss_type == MLAN_BSS_TYPE_UAP ) { IEEEtypes_Generic_t qos_map_ie ; t_u16 qos_map_ies_len ; qos_map_ie . ieee_hdr . element_id = QOS_MAPPING ; qos_map_ie . ieee_hdr . len = 2 * qos_map -> num_des + sizeof ( qos_map -> up ) ; qos_map_ies_len = qos_map_ie . ieee_hdr . len + sizeof ( qos_map_ie . ieee_hdr ) ; if ( qos_map_ies_len > sizeof ( qos_map_ie . data ) ) { PRINTM ( MERROR , " \n " ) ; goto done ; } memcpy ( qos_map_ie . data , ( t_u8 * ) qos_map -> dscp_exception , 2 * qos_map -> num_des ) ; memcpy ( & qos_map_ie . data [ 2 * qos_map -> num_des ] , ( t_u8 * ) qos_map -> up , sizeof ( qos_map -> up ) ) ; ret = woal_cfg80211_mgmt_frame_ie ( priv , NULL , 0 , NULL , 0 , ( t_u8 * ) & qos_map_ie , qos_map_ies_len , NULL , 0 , MGMT_MASK_ASSOC_RESP_QOS_MAP , MOAL_IOCTL_WAIT ) ; if ( ret ) { PRINTM ( MERROR , " \n " ) ; goto done ; } } done : LEAVE ( ) ; return ret ; }
@brief set Qos map
 @param wiphy         A pointer to wiphy structure
 @param dev           A pointer to net_device structure
 @param qos_map       A pointer to cfg80211_qos_map structure
@brief set Qos map @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @param qos_map A pointer to cfg80211_qos_map structure
/**clear dscp map*/ /**update dscp map*/ /**UAP update (re)associate response*/ /* set the assoc response ies */