Skip to content

Commit

Permalink
wireless: Support WiFi kind in radio telemetry (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatchimata authored Jul 15, 2021
1 parent 9f87a21 commit 664d6c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/unum/util/util_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ enum INTERFACE_KIND {
UNUM_INTERFACE_KIND_MAX, // For max size
};

// Radio kind sent in wireless radio telemetry
enum RADIO_KIND {
// We are starting the unum with 5Ghz instead of 2.4Ghz
// to be in sync with the values defined on the server
UNUM_RADIO_KIND_5 = 0, // 5Ghz Radio
UNUM_RADIO_KIND_2 = 1, // 2.4Ghz Radio
UNUM_RADIO_KIND_6 = 2, // 6Ghz Radio
};

// Makes a hex digit from a 4-bit value
#define UTIL_MAKE_HEX_DIGIT(a) ((((a)&0xf) > 9) ? (((a)&0xf)+87) : (((a)&0xf)+'0'))

Expand Down Expand Up @@ -368,4 +377,8 @@ int util_match_str(char *ptr, int ptr_len, char *str, int str_len);
// Parameters:
// ifname - The name of the interface
int __attribute__((weak)) util_get_interface_kind(char *ifname);
// Get Radio kind
// Returns Radio kind
// -1 if the Radio name is not found
int __attribute__((weak)) util_get_radio_kind(char *ifname);
#endif // _UTIL_COMMON_H
8 changes: 8 additions & 0 deletions src/unum/wireless/brcm_platform/radios_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int wt_tpl_fill_radio_info(WT_JSON_TPL_RADIO_STATE_t *rinfo)
int ret, intval, ii;
char *ifname = rinfo->name;
static int width;
static int kind;
static int noise;
static char country[4];
static char band_str[8];
Expand All @@ -57,6 +58,7 @@ int wt_tpl_fill_radio_info(WT_JSON_TPL_RADIO_STATE_t *rinfo)
{ "stats", { .type = JSON_VAL_STR, {.s = NULL }}},
{ "band", { .type = JSON_VAL_STR, {.s = band_str}}},
{ "width", { .type = JSON_VAL_PINT, {.pi = &width }}},
{ "kind", { .type = JSON_VAL_PINT, {.pi = &kind }}},
{ "cspec", { .type = JSON_VAL_STR, {.s = spec_str}}},
{ "noise", { .type = JSON_VAL_PINT, {.pi = &noise }}},
{ "country", { .type = JSON_VAL_STR, {.s = country }}},
Expand Down Expand Up @@ -122,6 +124,12 @@ int wt_tpl_fill_radio_info(WT_JSON_TPL_RADIO_STATE_t *rinfo)
// width and spec info in Broadcom's format
width = wl_get_specstr_and_width(chspec, spec_str);

if(util_get_radio_kind != NULL) {
kind = util_get_radio_kind(ifname);
} else {
kind = -1; // Not supported yet on this platform
}

// Get noise level
noise = bi->phy_noise;

Expand Down

0 comments on commit 664d6c7

Please sign in to comment.