p54: improve site survey
The firmware keeps track of channel usage. This data can be used by the automatic channel selection to find the best channel.
Survey data from wlan4
frequency: 5200 MHz [in use]
noise: -91 dBm
channel active time: 811909 ms
channel busy time: 63395 ms
channel transmit time: 59636 ms
Survey data from wlan4
frequency: 5210 MHz
noise: -91 dBm
channel active time: 121 ms
channel busy time: 119 ms
channel transmit time: 0 ms---
drivers/net/wireless/p54/eeprom.c +20 -2
@@ -145,6 +145,7 @@ static int p54_fill_band_bitrates(struct ieee80211_hw *dev,static int p54_generate_band (struct ieee80211_hw *dev,struct p54_channel_list *list, +unsigned int *chan_num,enum ieee80211_band band) {struct p54_common *priv = dev->priv;
@@ -190,7 +191,10 @@ static int p54_generate_band(struct ieee80211_hw *dev, tmp->channels[j].band = chan->band; tmp->channels[j].center_freq = chan->freq; + priv->survey[*chan_num].channel = &tmp->channels[j]; + tmp->channels[j].hw_value = (*chan_num); j++; + (*chan_num)++; }if (j ==0 ) {
@@ -263,7 +267,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) {struct p54_common *priv = dev->priv;struct p54_channel_list *list; -unsigned int i, j, max_channel_num; +unsigned int i, j, k, max_channel_num;int ret =0 ;u16 freq;
@@ -283,6 +287,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) ret = -ENOMEM ; goto free; } + priv->chan_num = max_channel_num; + priv->survey =kzalloc (sizeof (struct survey_info ) * max_channel_num, +GFP_KERNEL ); +if (!priv->survey) { + ret = -ENOMEM ; + goto free; + } list->max_entries = max_channel_num; list->channels = kzalloc(sizeof(struct p54_channel_entry) *
@@ -321,8 +332,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)sort (list->channels, list->entries,sizeof (struct p54_channel_entry ), p54_compare_channels,NULL ); + k =0 ;for (i =0 , j =0 ; i <IEEE80211_NUM_BANDS ; i++) { -if (p54_generate_band (dev, list, i) ==0 ) +if (p54_generate_band (dev, list, &k, i) ==0 ) j++; }if (j ==0 ) {
@@ -335,6 +347,10 @@ free:kfree (list->channels);kfree (list); } +if (ret) { +kfree (priv->survey); + priv->survey =NULL ; + }return ret; }
@@ -853,10 +869,12 @@ err:kfree (priv->output_limit);kfree (priv->curve_data);kfree (priv->rssi_db); +kfree (priv->survey); priv->iq_autocal =NULL ; priv->output_limit =NULL ; priv->curve_data =NULL ; priv->rssi_db =NULL ; + priv->survey =NULL ;wiphy_err (dev->wiphy,"eeprom parse failed!\n" );return err;
drivers/net/wireless/p54/main.c +52 -5
98 lines not on this page · raw message
drivers/net/wireless/p54/p54.h +17 -0
@@ -199,6 +199,23 @@ struct p54_common {u8 tx_diversity_mask;unsigned int output_power;struct p54_rssi_db_entry *cur_rssi; +struct survey_info *survey; +unsigned int chan_num; +struct completion stat_comp; +bool update_stats; +struct { +unsigned int timestamp; + +unsigned int cached_cca; +unsigned int cached_tx; +unsigned int cached_rssi; + +u64 active; +u64 cca; +u64 tx; +u64 rssi; + } survey_raw; +int noise;/* calibration, output power limit and rssi<->dBm conversation data */ struct pda_iq_autocal_entry *iq_autocal;
drivers/net/wireless/p54/txrx.c +64 -1
81 lines not on this page · raw message
PATCH v2 1/1 p54: improve site survey
The firmware keeps track of channel usage. This data can be used by the automatic channel selection to find the best channel.
Survey data from wlan4
frequency: 5200 MHz [in use] noise: -91 dBm channel active time: 811909 ms channel busy time: 63395 ms channel transmit time: 59636 ms Survey data from wlan4 frequency: 5210 MHz noise: -91 dBm channel active time: 121 ms channel busy time: 119 ms channel transmit time: 0 ms
---
drivers/net/wireless/p54/eeprom.c +24 -2
@@ -145,6 +145,7 @@ static int p54_fill_band_bitrates(struct ieee80211_hw *dev,static int p54_generate_band (struct ieee80211_hw *dev,struct p54_channel_list *list, +unsigned int *chan_num,enum ieee80211_band band) {struct p54_common *priv = dev->priv;
@@ -190,7 +191,14 @@ static int p54_generate_band(struct ieee80211_hw *dev, tmp->channels[j].band = chan->band; tmp->channels[j].center_freq = chan->freq; + priv->survey[*chan_num].channel = &tmp->channels[j]; + priv->survey[*chan_num].filled =SURVEY_INFO_NOISE_DBM | +SURVEY_INFO_CHANNEL_TIME | +SURVEY_INFO_CHANNEL_TIME_BUSY | +SURVEY_INFO_CHANNEL_TIME_TX ; + tmp->channels[j].hw_value = (*chan_num); j++; + (*chan_num)++; }if (j ==0 ) {
@@ -263,7 +271,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) {struct p54_common *priv = dev->priv;struct p54_channel_list *list; -unsigned int i, j, max_channel_num; +unsigned int i, j, k, max_channel_num;int ret =0 ;u16 freq;
@@ -283,6 +291,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) ret = -ENOMEM ; goto free; } + priv->chan_num = max_channel_num; + priv->survey =kzalloc (sizeof (struct survey_info ) * max_channel_num, +GFP_KERNEL ); +if (!priv->survey) { + ret = -ENOMEM ; + goto free; + } list->max_entries = max_channel_num; list->channels = kzalloc(sizeof(struct p54_channel_entry) *
@@ -321,8 +336,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)sort (list->channels, list->entries,sizeof (struct p54_channel_entry ), p54_compare_channels,NULL ); + k =0 ;for (i =0 , j =0 ; i <IEEE80211_NUM_BANDS ; i++) { -if (p54_generate_band (dev, list, i) ==0 ) +if (p54_generate_band (dev, list, &k, i) ==0 ) j++; }if (j ==0 ) {
@@ -335,6 +351,10 @@ free:kfree (list->channels);kfree (list); } +if (ret) { +kfree (priv->survey); + priv->survey =NULL ; + }return ret; }
@@ -853,10 +873,12 @@ err:kfree (priv->output_limit);kfree (priv->curve_data);kfree (priv->rssi_db); +kfree (priv->survey); priv->iq_autocal =NULL ; priv->output_limit =NULL ; priv->curve_data =NULL ; priv->rssi_db =NULL ; + priv->survey =NULL ;wiphy_err (dev->wiphy,"eeprom parse failed!\n" );return err;
drivers/net/wireless/p54/fwio.c +2 -0
@@ -385,6 +385,7 @@ int p54_setup_mac(struct p54_common *priv) setup->v2.osc_start_delay =cpu_to_le16 (65535 ); }p54_tx (priv, skb); + priv->phy_idle = mode !=P54_FILTER_TYPE_HIBERNATE ;return 0 ; }
@@ -626,6 +627,7 @@ int p54_set_ps(struct p54_common *priv) psm->exclude[0 ] =WLAN_EID_TIM ;p54_tx (priv, skb); + priv->phy_ps = mode !=P54_PSM_CAM ;return 0 ; }
drivers/net/wireless/p54/main.c +67 -5
125 lines not on this page · raw message
drivers/net/wireless/p54/p54.h +20 -0
@@ -199,6 +199,24 @@ struct p54_common {u8 tx_diversity_mask;unsigned int output_power;struct p54_rssi_db_entry *cur_rssi; +struct ieee80211_channel *curchan; +struct survey_info *survey; +unsigned int chan_num; +struct completion stat_comp; +bool update_stats; +struct { +unsigned int timestamp; + +unsigned int cached_cca; +unsigned int cached_tx; +unsigned int cached_rssi; + +u64 active; +u64 cca; +u64 tx; +u64 rssi; + } survey_raw; +int noise;/* calibration, output power limit and rssi<->dBm conversation data */ struct pda_iq_autocal_entry *iq_autocal;
@@ -220,6 +238,8 @@ struct p54_common {u32 basic_rate_mask;u16 aid;u8 coverage_class; +bool phy_idle; +bool phy_ps;bool powersave_override;__le32 beacon_req_id;struct completion beacon_comp;
drivers/net/wireless/p54/txrx.c +72 -0
87 lines not on this page · raw message