Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b176d20 authored by Amar Singhal's avatar Amar Singhal Committed by Akash Patel
Browse files

qcacld-3.0: Remove FEATURE_STATICALLY_ADD_11P_CHANNELS

FEATURE_STATICALLY_ADD_11P_CHANNELS was a temporary solution for
builds that were not defining DSRC channels in db.txt. That
restriction no more holds true. Also correct the list of DSRC
channels in function cds_is_dsrc_channel.

Change-Id: I1146ec9702a8eec801b635a276e981962dd42817
CRs-Fixed: 856727
parent e10e82a3
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -253,10 +253,6 @@ CONFIG_FEATURE_SECURE_FIRMWARE := 0
#Flag to enable Stats Ext implementation
CONFIG_FEATURE_STATS_EXT := 1

#Flag to force the inclusion of the 802.11p channels because support
#for these channels has not yet been added to the kernel.
CONFIG_STATICALLY_ADD_11P_CHANNELS := n

ifeq ($(CONFIG_CFG80211),y)
HAVE_CFG80211 := 1
else
@@ -1329,10 +1325,6 @@ ifeq ($(CONFIG_WLAN_FEATURE_MEMDUMP),y)
CDEFINES += -DWLAN_FEATURE_MEMDUMP
endif

ifeq ($(CONFIG_STATICALLY_ADD_11P_CHANNELS),y)
CDEFINES += -DFEATURE_STATICALLY_ADD_11P_CHANNELS
endif

ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y)
CDEFINES += -DFEATURE_LFR_SUBNET_DETECTION
endif
+3 −25
Original line number Diff line number Diff line
@@ -754,26 +754,13 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
 */
bool cds_is_dsrc_channel(uint16_t center_freq)
{
	switch (center_freq) {
	case 5852:
	case 5860:
	case 5870:
	case 5880:
	case 5890:
	case 5900:
	case 5910:
	case 5920:
	case 5875:
	case 5905:
	if (center_freq >= 5852 &&
	    center_freq <= 5920)
		return 1;
	}

	return 0;
}

#ifdef FEATURE_STATICALLY_ADD_11P_CHANNELS
#define DEFAULT_11P_POWER (30)
#endif

/**
 * cds_process_regulatory_data() - process regulatory data
 * @wiphy: wiphy
@@ -886,15 +873,6 @@ static int cds_process_regulatory_data(struct wiphy *wiphy,
				}
			}

#ifdef FEATURE_STATICALLY_ADD_11P_CHANNELS
			if (is_dsrc_channel(chan->center_freq)) {
				temp_chan_k->enabled =
					CHANNEL_STATE_ENABLE;
				temp_chan_k->pwrLimit =
					DEFAULT_11P_POWER;
				temp_chan_k->flags = chan->flags;
			} else
#endif
			if (chan->flags & IEEE80211_CHAN_DISABLED) {
				temp_chan_k->enabled =
					CHANNEL_STATE_DISABLE;
+0 −2
Original line number Diff line number Diff line
@@ -217,7 +217,6 @@ static struct ieee80211_channel hdd_channels_5_ghz[] = {
	HDD5GHZCHAN(5785, 157, 0),
	HDD5GHZCHAN(5805, 161, 0),
	HDD5GHZCHAN(5825, 165, 0),
#ifndef FEATURE_STATICALLY_ADD_11P_CHANNELS
	HDD5GHZCHAN(5852, 170, 0),
	HDD5GHZCHAN(5855, 171, 0),
	HDD5GHZCHAN(5860, 172, 0),
@@ -233,7 +232,6 @@ static struct ieee80211_channel hdd_channels_5_ghz[] = {
	HDD5GHZCHAN(5910, 182, 0),
	HDD5GHZCHAN(5915, 183, 0),
	HDD5GHZCHAN(5920, 184, 0),
#endif
};

static struct ieee80211_rate g_mode_rates[] = {
+2 −110
Original line number Diff line number Diff line
/*
 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
 * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -121,113 +121,6 @@ static int dot11p_validate_qos_params(struct sir_qos_params qos_params[])
	return 0;
}

#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) || \
				 defined(FEATURE_STATICALLY_ADD_11P_CHANNELS)
/*
 * If FEATURE_STATICALLY_ADD_11P_CHANNELS
 * is defined, IEEE80211_CHAN_NO_10MHZ,
 * and IEEE80211_CHAN_NO_20MHZ won't
 * be defined.
 */
#define IEEE80211_CHAN_NO_20MHZ	(1<<11)
#define IEEE80211_CHAN_NO_10MHZ	(1<<12)
#endif

#ifdef FEATURE_STATICALLY_ADD_11P_CHANNELS

#define DOT11P_TX_PWR_MAX	30
#define DOT11P_TX_ANTENNA_MAX	6
#define NUM_DOT11P_CHANNELS	10
/**
 * struct chan_info - information for the channel
 * @center_freq: center frequency
 * @max_bandwidth: maximum bandwidth of the channel in MHz
 */
struct chan_info {
	uint32_t center_freq;
	uint32_t max_bandwidth;
};

struct chan_info valid_dot11p_channels[NUM_DOT11P_CHANNELS] = {
	{5860, 10},
	{5870, 10},
	{5880, 10},
	{5890, 10},
	{5900, 10},
	{5910, 10},
	{5920, 10},
	{5875, 20},
	{5905, 20},
	{5852, 5}
};

/**
 * dot11p_validate_channel_static_channels() - validate a DSRC channel
 * @center_freq: the channel's center frequency
 * @bandwidth: the channel's bandwidth
 * @tx_power: transmit power
 * @reg_power: (output) the max tx power from the regulatory domain
 * @antenna_max: (output) the max antenna gain from the regulatory domain
 *
 * This function of the function checks the channel parameters against a
 * hardcoded list of valid channels based on the FCC rules.
 *
 * Return: 0 if the channel is valid, error code otherwise.
 */
static int dot11p_validate_channel_static_channels(struct wiphy *wiphy,
	uint32_t channel_freq, uint32_t bandwidth, uint32_t tx_power,
	uint8_t *reg_power, uint8_t *antenna_max)
{
	int i;

	for (i = 0; i < NUM_DOT11P_CHANNELS; i++) {
		if (channel_freq == valid_dot11p_channels[i].center_freq) {
			if (reg_power)
				*reg_power = DOT11P_TX_PWR_MAX;
			if (antenna_max)
				*antenna_max = DOT11P_TX_ANTENNA_MAX;

			if (bandwidth == 0)
				bandwidth =
					valid_dot11p_channels[i].max_bandwidth;
			else if (bandwidth >
				 valid_dot11p_channels[i].max_bandwidth)
				return -EINVAL;

			if (bandwidth != 5 && bandwidth != 10 &&
			    bandwidth != 20)
				return -EINVAL;
			if (tx_power > DOT11P_TX_PWR_MAX)
				return -EINVAL;

			return 0;
		}
	}

	return -EINVAL;
}
#else
/**
 * dot11p_validate_channel_static_channels() - validate a DSRC channel
 * @center_freq: the channel's center frequency
 * @bandwidth: the channel's bandwidth
 * @tx_power: transmit power
 * @reg_power: (output) the max tx power from the regulatory domain
 * @antenna_max: (output) the max antenna gain from the regulatory domain
 *
 * This function of the function checks the channel parameters against a
 * hardcoded list of valid channels based on the FCC rules.
 *
 * Return: 0 if the channel is valid, error code otherwise.
 */
static int dot11p_validate_channel_static_channels(struct wiphy *wiphy,
	uint32_t channel_freq, uint32_t bandwidth, uint32_t tx_power,
	uint8_t *reg_power, uint8_t *antenna_max)
{
	return -EINVAL;
}
#endif /* FEATURE_STATICALLY_ADD_11P_CHANNELS */

/**
 * dot11p_validate_channel() - validates a DSRC channel
 * @center_freq: the channel's center frequency
@@ -304,8 +197,7 @@ static int dot11p_validate_channel(struct wiphy *wiphy,
		}
	}

	return dot11p_validate_channel_static_channels(wiphy, channel_freq,
		bandwidth, tx_power, reg_power, antenna_max);
	return -EINVAL;
}

/**