mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 01:52:51 +00:00
WIFI-4924-Report-Channel-Bandwidth
Current survey sample report doesn't include channel bandwidth parameter, hence cloud won't be having channel bandwidth information. This patch will add support to add channel bandwidth attribute to survey sample report and will report available channel bandwidth on respective channel to the cloud. Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
Index: opensync-2.0.5.0/src/lib/datapipeline/inc/dpp_survey.h
|
||||
===================================================================
|
||||
--- opensync-2.0.5.0.orig/src/lib/datapipeline/inc/dpp_survey.h
|
||||
+++ opensync-2.0.5.0/src/lib/datapipeline/inc/dpp_survey.h
|
||||
@@ -70,6 +70,7 @@ typedef struct
|
||||
uint32_t chan_tx;
|
||||
uint32_t chan_noise;
|
||||
uint32_t duration_ms;
|
||||
+ uint32_t chan_width;
|
||||
|
||||
/* Linked list survey data */
|
||||
ds_dlist_node_t node;
|
||||
Index: opensync-2.0.5.0/src/sm/src/sm_survey_report.c
|
||||
===================================================================
|
||||
--- opensync-2.0.5.0.orig/src/sm/src/sm_survey_report.c
|
||||
+++ opensync-2.0.5.0/src/sm/src/sm_survey_report.c
|
||||
@@ -526,7 +526,7 @@ bool sm_survey_report_calculate_raw (
|
||||
memcpy(report_entry, record_entry, sizeof(*report_entry));
|
||||
|
||||
LOGD("Sending %s %s %u survey report "
|
||||
- "{busy=%u tx=%u self=%u rx=%u ext=%u noise=%u duration=%u}",
|
||||
+ "{busy=%u tx=%u self=%u rx=%u ext=%u noise=%u duration=%u chan_width=%u}",
|
||||
radio_get_name_from_cfg(radio_cfg_ctx),
|
||||
radio_get_scan_name_from_type(scan_type),
|
||||
report_entry->info.chan,
|
||||
@@ -536,7 +536,8 @@ bool sm_survey_report_calculate_raw (
|
||||
report_entry->chan_rx,
|
||||
report_entry->chan_busy_ext,
|
||||
report_entry->chan_noise,
|
||||
- report_entry->duration_ms);
|
||||
+ report_entry->duration_ms,
|
||||
+ report_entry->chan_width);
|
||||
|
||||
ds_dlist_insert_tail(report_list, report_entry);
|
||||
}
|
||||
@@ -732,7 +733,7 @@ bool sm_survey_update_list_cb (
|
||||
result_entry);
|
||||
|
||||
LOGD("Processed %s %s %u survey percent "
|
||||
- "{busy=%u tx=%u self=%u rx=%u ext=%u noise=%u duration=%u}",
|
||||
+ "{busy=%u tx=%u self=%u rx=%u ext=%u noise=%u duration=%u channel_bandwidth:%u}",
|
||||
radio_get_name_from_cfg(radio_cfg_ctx),
|
||||
radio_get_scan_name_from_type(scan_type),
|
||||
result_entry->info.chan,
|
||||
@@ -742,7 +743,8 @@ bool sm_survey_update_list_cb (
|
||||
result_entry->chan_rx,
|
||||
result_entry->chan_busy_ext,
|
||||
result_entry->chan_noise,
|
||||
- result_entry->duration_ms);
|
||||
+ result_entry->duration_ms,
|
||||
+ result_entry->chan_width);
|
||||
|
||||
result_entry->info.timestamp_ms =
|
||||
request_ctx->reporting_timestamp - survey_ctx->report_ts +
|
||||
Index: opensync-2.0.5.0/interfaces/opensync_stats.proto
|
||||
===================================================================
|
||||
--- opensync-2.0.5.0.orig/interfaces/opensync_stats.proto
|
||||
+++ opensync-2.0.5.0/interfaces/opensync_stats.proto
|
||||
@@ -308,6 +308,7 @@ message Survey {
|
||||
optional uint32 offset_ms = 9;
|
||||
optional uint32 busy_ext = 10; /* 40MHz extention channel busy */
|
||||
optional uint32 noise = 11;
|
||||
+ optional uint32 chan_width = 12;
|
||||
}
|
||||
message SurveyAvg {
|
||||
required uint32 channel = 1;
|
||||
@@ -53,6 +53,7 @@ typedef struct
|
||||
uint64_t chan_tx;
|
||||
uint32_t chan_noise;
|
||||
uint64_t duration_ms;
|
||||
uint64_t chan_width;
|
||||
} target_survey_record_t;
|
||||
|
||||
typedef void target_capacity_data_t;
|
||||
|
||||
@@ -42,6 +42,7 @@ extern int net_get_mtu(char *iface);
|
||||
extern int net_get_mac(char *iface, char *mac);
|
||||
extern int net_is_bridge(char *iface);
|
||||
extern char* get_max_channel_bw_channel(int channel_freq, const char* htmode);
|
||||
extern void get_on_channel_bandwidth(radio_entry_t *radio_cfg, int *channel_bandwidth);
|
||||
int phy_find_hwmon_helper(char *dir, char *file, char *hwmon);
|
||||
extern double dBm_to_mwatts(double dBm);
|
||||
extern double mWatts_to_dBm(double mW);
|
||||
|
||||
@@ -204,6 +204,7 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
|
||||
char ifName[10];
|
||||
int val=0;
|
||||
int radio=0;
|
||||
int channel_bandwidth=0;
|
||||
sscanf(radio_cfg->if_name,"wlan%d_%d",&radio,&val);
|
||||
sprintf(ifName,"wlan%d",radio);
|
||||
ds_dlist_t raw_survey_list = DS_DLIST_INIT(target_survey_record_t, node);
|
||||
@@ -230,6 +231,8 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
|
||||
while (!ds_dlist_is_empty(onchan_list)) {
|
||||
survey = ds_dlist_head(onchan_list);
|
||||
ds_dlist_remove(onchan_list, survey);
|
||||
get_on_channel_bandwidth(radio_cfg, &channel_bandwidth);
|
||||
survey->chan_width = channel_bandwidth;
|
||||
ds_dlist_insert_tail(survey_list, survey);
|
||||
}
|
||||
} else {
|
||||
@@ -247,6 +250,8 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
|
||||
survey->chan_self, survey->info.chan, scan_type);
|
||||
if ((scan_type == RADIO_SCAN_TYPE_ONCHAN) && (survey->duration_ms != 0)) {
|
||||
if (survey->info.chan == chan_list[0]) {
|
||||
get_on_channel_bandwidth(radio_cfg, &channel_bandwidth);
|
||||
survey->chan_width = channel_bandwidth;
|
||||
ds_dlist_insert_tail(survey_list, survey);
|
||||
} else {
|
||||
ds_dlist_insert_tail(offchan_list, survey);
|
||||
@@ -255,6 +260,8 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
|
||||
if (!survey->chan_in_use) {
|
||||
ds_dlist_insert_tail(survey_list, survey);
|
||||
} else {
|
||||
get_on_channel_bandwidth(radio_cfg, &channel_bandwidth);
|
||||
survey->chan_width = channel_bandwidth;
|
||||
ds_dlist_insert_tail(onchan_list, survey);
|
||||
}
|
||||
} else {
|
||||
@@ -290,12 +297,13 @@ bool target_stats_survey_convert(radio_entry_t *radio_cfg, radio_scan_type_t sca
|
||||
data_new->chan_busy += data_old->chan_busy;
|
||||
}
|
||||
|
||||
|
||||
LOGD("Survey convert scan_type %d chan %d duration_new:%llu duration_old:%llu "
|
||||
"busy_new %llu busy_old:%llu tx_new %llu tx_old:%llu rx_new %llu rx_old:%llu "
|
||||
"rx_self_new %llu rx_self_old:%llu",
|
||||
"rx_self_new %llu rx_self_old:%llu channel_bandwidth:%llu",
|
||||
scan_type, data_new->info.chan, data_new->duration_ms, data_old->duration_ms,
|
||||
data_new->chan_busy, data_old->chan_busy, data_new->chan_tx, data_old->chan_tx,
|
||||
data_new->chan_rx, data_old->chan_rx, data_new->chan_self, data_old->chan_self);
|
||||
data_new->chan_rx, data_old->chan_rx, data_new->chan_self, data_old->chan_self, data_new->chan_width);
|
||||
|
||||
memset(&delta, 0, sizeof(delta));
|
||||
|
||||
@@ -306,6 +314,7 @@ bool target_stats_survey_convert(radio_entry_t *radio_cfg, radio_scan_type_t sca
|
||||
delta.chan_rx = DELTA(data_new->chan_rx, data_old->chan_rx);
|
||||
delta.chan_self = DELTA(data_new->chan_self, data_old->chan_self);
|
||||
|
||||
survey_record->chan_width = data_new->chan_width;
|
||||
survey_record->info.chan = data_new->info.chan;
|
||||
survey_record->chan_tx = PERCENT(delta.chan_tx, delta.duration_ms);
|
||||
survey_record->chan_self = PERCENT(delta.chan_self, delta.duration_ms);
|
||||
|
||||
@@ -97,6 +97,23 @@ char * get_max_channel_bw_channel(int channel_freq, const char* htmode)
|
||||
}
|
||||
return "HT20";
|
||||
}
|
||||
|
||||
void get_on_channel_bandwidth(radio_entry_t *radio_cfg, int *channel_bandwidth)
|
||||
{
|
||||
if (radio_cfg->chanwidth == 1) {
|
||||
*channel_bandwidth = 20;
|
||||
return;
|
||||
} else if (radio_cfg->chanwidth == 2) {
|
||||
*channel_bandwidth = 40;
|
||||
return;
|
||||
} else if (radio_cfg->chanwidth == 5) {
|
||||
*channel_bandwidth = 80;
|
||||
return;
|
||||
} else
|
||||
*channel_bandwidth = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
struct mode_map *mode_map_get_uci(const char *band, const char *htmode, const char *hwmode)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef struct
|
||||
uint32_t chan_noise;
|
||||
uint64_t duration_ms;
|
||||
uint32_t chan_in_use;
|
||||
uint64_t chan_width;
|
||||
} target_survey_record_t;
|
||||
|
||||
typedef void target_capacity_data_t;
|
||||
|
||||
Reference in New Issue
Block a user