software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief Notify cfg80211 supplicant channel changed
 *
 * @param priv          A pointer moal_private structure
 * @param pchan_info    A pointer to chan_band structure
 *
 * @return          N/A
 */
@brief Notify cfg80211 supplicant channel changed
@param priv          A pointer moal_private structure
@param pchan_info    A pointer to chan_band structure

@return          N/A
@brief Notify cfg80211 supplicant channel changed @param priv A pointer moal_private structure @param pchan_info A pointer to chan_band structure @return N / A
void
woal_cfg80211_notify_channel(moal_private *priv, chan_band_info * pchan_info)
{
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
	struct cfg80211_chan_def chandef;
#else
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
	enum nl80211_channel_type type;
	enum ieee80211_band band;
	int freq = 0;
#endif
#endif
	ENTER();
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
	if (MLAN_STATUS_SUCCESS ==
	    woal_chandef_create(priv, &chandef, pchan_info)) {
		cfg80211_ch_switch_notify(priv->netdev, &chandef);
		priv->channel = pchan_info->channel;
#ifdef UAP_CFG80211
		memcpy(&priv->chan, &chandef, sizeof(struct cfg80211_chan_def));
#endif
	}
#else
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
	if (pchan_info->bandcfg.chanBand == BAND_2GHZ)
		band = IEEE80211_BAND_2GHZ;
	else if (pchan_info->bandcfg.chanBand == BAND_5GHZ)
		band = IEEE80211_BAND_5GHZ;
	else {
		LEAVE();
		return;
	}
	priv->channel = pchan_info->channel;
	freq = ieee80211_channel_to_frequency(pchan_info->channel, band);
	switch (pchan_info->bandcfg.chanWidth) {
	case CHAN_BW_20MHZ:
		if (pchan_info->is_11n_enabled)
			type = NL80211_CHAN_HT20;
		else
			type = NL80211_CHAN_NO_HT;
		break;
	default:
		if (pchan_info->bandcfg.chan2Offset == SEC_CHAN_ABOVE)
			type = NL80211_CHAN_HT40PLUS;
		else if (pchan_info->bandcfg.chan2Offset == SEC_CHAN_BELOW)
			type = NL80211_CHAN_HT40MINUS;
		else
			type = NL80211_CHAN_HT20;
		break;
	}
	cfg80211_ch_switch_notify(priv->netdev, freq, type);
#endif
#endif
	LEAVE();
}
void woal_cfg80211_notify_channel ( moal_private * priv , chan_band_info * pchan_info ) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 8 , 0 ) struct cfg80211_chan_def chandef ; #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 5 , 0 ) enum nl80211_channel_type type ; enum ieee80211_band band ; int freq = 0 ; #endif #endif ENTER ( ) ; #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 8 , 0 ) if ( MLAN_STATUS_SUCCESS == woal_chandef_create ( priv , & chandef , pchan_info ) ) { cfg80211_ch_switch_notify ( priv -> netdev , & chandef ) ; priv -> channel = pchan_info -> channel ; #ifdef UAP_CFG80211 memcpy ( & priv -> chan , & chandef , sizeof ( struct cfg80211_chan_def ) ) ; #endif } #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 5 , 0 ) if ( pchan_info -> bandcfg . chanBand == BAND_2GHZ ) band = IEEE80211_BAND_2GHZ ; else if ( pchan_info -> bandcfg . chanBand == BAND_5GHZ ) band = IEEE80211_BAND_5GHZ ; else { LEAVE ( ) ; return ; } priv -> channel = pchan_info -> channel ; freq = ieee80211_channel_to_frequency ( pchan_info -> channel , band ) ; switch ( pchan_info -> bandcfg . chanWidth ) { case CHAN_BW_20MHZ : if ( pchan_info -> is_11n_enabled ) type = NL80211_CHAN_HT20 ; else type = NL80211_CHAN_NO_HT ; break ; default : if ( pchan_info -> bandcfg . chan2Offset == SEC_CHAN_ABOVE ) type = NL80211_CHAN_HT40PLUS ; else if ( pchan_info -> bandcfg . chan2Offset == SEC_CHAN_BELOW ) type = NL80211_CHAN_HT40MINUS ; else type = NL80211_CHAN_HT20 ; break ; } cfg80211_ch_switch_notify ( priv -> netdev , freq , type ) ; #endif #endif LEAVE ( ) ; }
@brief Notify cfg80211 supplicant channel changed
 @param priv          A pointer moal_private structure
 @param pchan_info    A pointer to chan_band structure
@brief Notify cfg80211 supplicant channel changed @param priv A pointer moal_private structure @param pchan_info A pointer to chan_band structure