Skip to content

Commit 6db0429

Browse files
DTMESH-580:- Bring up Wifi 7 to DT OneWifi (#416)
* DTMESH-580:- Bring up Wifi 7 to DT OneWifi Reason for Change:- - Disable MLO on both fronthaul and backhaul using CONFIG_MLO flag. - Bring up the AP and STA interfaces in non-mlo BE mode. - Bring up the backhaul association in BE mode Signed-off-by: MG-kildon <[email protected]> Signed-off-by: Bijeesha VS <[email protected]> * Fix for ovsm crash --------- Signed-off-by: MG-kildon <[email protected]> Signed-off-by: Bijeesha VS <[email protected]> Co-authored-by: Sathish Kumar Gnanasekaran <[email protected]>
1 parent 044b39b commit 6db0429

File tree

6 files changed

+194
-109
lines changed

6 files changed

+194
-109
lines changed

platform/qualcomm/platform_ext.c

Lines changed: 136 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#define CONFIG_FILE "getConfigFile.sh"
5252
#define STATICCPGCFG_1 "/tmp/.staticCpgCfg_1"
5353
#define STA_PWD_LEN STATICCPGCFG_LEN
54+
#define QCA_MAX_CMD_SZ 128
5455

5556
extern INT wifi_setMLDaddr(INT apIndex, CHAR *mldMacAddress);
5657

@@ -329,55 +330,9 @@ int platform_post_init(wifi_vap_info_map_t *vap_map)
329330
return 0;
330331
}
331332

332-
void getprivatevap2G(unsigned int *index)
333+
void qca_getRadioMode(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam,
334+
char *cmd)
333335
{
334-
unsigned int idx = 0;
335-
wifi_interface_name_idex_map_t interface_map[(MAX_NUM_RADIOS * MAX_NUM_VAP_PER_RADIO)];
336-
if (index == NULL) {
337-
wifi_hal_error_print("%s: NULL param error\n", __FUNCTION__);
338-
return;
339-
}
340-
341-
get_wifi_interface_info_map(interface_map);
342-
343-
for (idx = 0; idx < ARRAY_SZ(interface_map); idx++) {
344-
345-
if (strncmp(interface_map[idx].vap_name, "private_ssid_2g", strlen("private_ssid_2g")) == 0) {
346-
*index = interface_map[idx].index;
347-
348-
}
349-
}
350-
}
351-
352-
void getprivatevap5G(unsigned int *index)
353-
{
354-
unsigned int idx = 0;
355-
wifi_interface_name_idex_map_t interface_map[(MAX_NUM_RADIOS * MAX_NUM_VAP_PER_RADIO)];
356-
if (index == NULL) {
357-
wifi_hal_error_print("%s: NULL param error\n", __FUNCTION__);
358-
return;
359-
}
360-
361-
get_wifi_interface_info_map(interface_map);
362-
363-
for (idx = 0; idx < ARRAY_SZ(interface_map); idx++) {
364-
365-
if (strncmp(interface_map[idx].vap_name, "private_ssid_5g", strlen("private_ssid_5g")) == 0) {
366-
*index = interface_map[idx].index;
367-
}
368-
}
369-
}
370-
371-
void qca_setRadioMode(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam)
372-
{
373-
unsigned int apindex = 0, i = 0; int band = -1;
374-
size_t len = 0;
375-
char cmd[DEFAULT_CMD_SIZE] = {0};
376-
char tmp[DEFAULT_CMD_SIZE] = {0};
377-
char command[DEFAULT_CMD_SIZE] = {0};
378-
char buffer[DEFAULT_CMD_SIZE] = {0};
379-
char output[DEFAULT_CMD_SIZE]={0};
380-
381336
wifi_ieee80211Variant_t variant = WIFI_80211_VARIANT_AX;
382337
wifi_channelBandwidth_t channelWidth = WIFI_CHANNELBANDWIDTH_80MHZ;
383338

@@ -386,7 +341,6 @@ void qca_setRadioMode(wifi_radio_index_t index, wifi_radio_operationParam_t *ope
386341
switch (operationParam->band) {
387342

388343
case WIFI_FREQUENCY_2_4_BAND:
389-
getprivatevap2G(&apindex);
390344
if (variant == WIFI_80211_VARIANT_B) {
391345
strncpy(cmd, phymode_strings[QCA_HAL_IEEE80211_PHYMODE_11B], DEFAULT_CMD_SIZE);
392346

@@ -426,7 +380,6 @@ void qca_setRadioMode(wifi_radio_index_t index, wifi_radio_operationParam_t *ope
426380
case WIFI_FREQUENCY_5_BAND:
427381
case WIFI_FREQUENCY_5L_BAND:
428382
case WIFI_FREQUENCY_5H_BAND:
429-
getprivatevap5G(&apindex);
430383
if ((variant & WIFI_80211_VARIANT_A) && !(variant & ~WIFI_80211_VARIANT_A)) {
431384
strncpy(cmd, phymode_strings[QCA_HAL_IEEE80211_PHYMODE_11A], DEFAULT_CMD_SIZE);
432385
}
@@ -491,24 +444,6 @@ void qca_setRadioMode(wifi_radio_index_t index, wifi_radio_operationParam_t *ope
491444
default:
492445
break;
493446
}
494-
snprintf(command, DEFAULT_CMD_SIZE, "cfg80211tool %s get_mode | cut -d':' -f2",getInterface(apindex));
495-
FILE *fp = popen(command, "r");
496-
if (fp == NULL) {
497-
wifi_hal_error_print("%s:%d Failed to run command \n",__func__,__LINE__);
498-
return;
499-
}
500-
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
501-
strncpy(output, buffer, DEFAULT_CMD_SIZE);
502-
output[strcspn(output, "\n")] = '\0';
503-
}
504-
pclose(fp);
505-
506-
len = strlen(output) > strlen(cmd) ? strlen(output) : strlen(cmd);
507-
if (strncmp(output, cmd, len) != 0 ) {
508-
snprintf(tmp, DEFAULT_CMD_SIZE, "cfg80211tool %s mode %s",getInterface(apindex),cmd);
509-
system(tmp);
510-
}
511-
512447
return;
513448
}
514449

@@ -524,6 +459,8 @@ int platform_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map)
524459
int vap_itr;
525460
char interface_name[32];
526461
char cmd[DEFAULT_CMD_SIZE];
462+
char mode[16];
463+
wifi_radio_info_t *radio;
527464

528465
for (vap_itr=0; vap_itr < map->num_vaps; vap_itr++) {
529466
vap = &map->vap_array[vap_itr];
@@ -535,6 +472,14 @@ int platform_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map)
535472
system(cmd);
536473
snprintf(cmd, sizeof(cmd), "cfg80211tool %s athnewind 1", interface_name);
537474
system(cmd);
475+
} else {
476+
radio = get_radio_by_rdk_index(index);
477+
if (radio) {
478+
qca_getRadioMode(index, &radio->oper_param, mode);
479+
snprintf(cmd, sizeof(cmd), "cfg80211tool %s mode %s", interface_name, mode);
480+
system(cmd);
481+
wifi_hal_dbg_print("%s:%d Executing %s\n", __func__, __LINE__, cmd);
482+
}
538483
}
539484
}
540485
wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
@@ -769,7 +714,7 @@ int nvram_get_current_ssid(char *l_ssid, int vap_index)
769714
return 0;
770715
}
771716

772-
717+
#if defined(CONFIG_MLO)
773718
static int qca_get_vap_mld_addr(wifi_vap_info_t* vap_info, char* mld_mac_buf)
774719
{
775720
if (vap_info == NULL) {
@@ -787,7 +732,32 @@ static int qca_get_vap_mld_addr(wifi_vap_info_t* vap_info, char* mld_mac_buf)
787732
__func__, __LINE__, vap_info->vap_index, MAC2STR(mld_mac_buf));
788733
return RETURN_OK;
789734
}
735+
#endif
736+
737+
int platform_create_interface_attributes(struct nl_msg **msg_ptr, wifi_radio_info_t *radio,
738+
wifi_vap_info_t *vap)
739+
{
740+
char mld_mac_addr[ETH_ALEN];
741+
(void)radio;
742+
743+
if (msg_ptr == NULL || *msg_ptr == NULL || vap == NULL) {
744+
wifi_hal_dbg_print("%s:%d Invalid arguments\n", __func__, __LINE__);
745+
return RETURN_ERR;
746+
}
747+
#if defined(CONFIG_MLO)
748+
if (qca_get_vap_mld_addr(vap, mld_mac_addr) == RETURN_ERR) {
749+
return RETURN_ERR;
750+
}
751+
wifi_hal_info_print("%s:%d:Adding MLD addr " MACSTR " for vap index:%d\n", __func__, __LINE__,
752+
MAC2STR(mld_mac_addr), vap->vap_index);
753+
if (nla_put(*msg_ptr, NL80211_ATTR_MLD_MAC, ETH_ALEN, mld_mac_addr) < 0) {
754+
return RETURN_ERR;
755+
}
756+
#endif
757+
return RETURN_OK;
758+
}
790759

760+
#if defined(CONFIG_MLO)
791761
static int qca_create_mld_interfaces(wifi_vap_info_map_t *map)
792762
{
793763
char cmd[DEFAULT_CMD_SIZE];
@@ -812,6 +782,7 @@ static int qca_create_mld_interfaces(wifi_vap_info_map_t *map)
812782
}
813783
return RETURN_OK;
814784
}
785+
#endif
815786

816787
int platform_pre_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map)
817788
{
@@ -827,7 +798,9 @@ int platform_pre_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map)
827798
get_interface_name_from_vap_index(vap->vap_index, interface_name);
828799
snprintf(param, sizeof(param), "ath%d.vap_enabled", vap->vap_index);
829800
}
801+
#ifdef CONFIG_MLO
830802
qca_create_mld_interfaces(map);
803+
#endif
831804
wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
832805
return 0;
833806
}
@@ -1059,8 +1032,6 @@ int nl80211_drv_mlo_msg(struct nl_msg *msg, struct nl_msg **msg_mlo, void *priv,
10591032
}
10601033
wifi_hal_dbg_print("%s:%d: EXIT\n", __func__, __LINE__);
10611034
return res;
1062-
#else
1063-
#error "The wifi_drv_set_ap_mlo is not implemented"
10641035
#endif /* CONFIG_MLO */
10651036
}
10661037

@@ -1126,8 +1097,6 @@ int update_hostap_mlo(wifi_interface_info_t *interface) {
11261097
wifi_hal_dbg_print("%s:%d: EXIT\n", __func__, __LINE__);
11271098

11281099
return RETURN_OK;
1129-
#else
1130-
#error "The update_hostap_mlo is not implemented"
11311100
#endif /* CONFIG_MLO */
11321101
}
11331102

@@ -1183,6 +1152,98 @@ static int qca_add_intf_to_bridge(wifi_interface_info_t *interface, bool is_mld)
11831152
return RETURN_OK;
11841153
}
11851154

1155+
#if defined(CONFIG_MLO)
1156+
static bool is_bonding_slave(const char *mld_name, const char *ifname)
1157+
{
1158+
char linebuf[512];
1159+
char slave_list[128];
1160+
char *slave;
1161+
char *rest;
1162+
FILE *fp;
1163+
bool ret = false;
1164+
1165+
snprintf(slave_list, sizeof(slave_list), "/sys/class/net/%s/bonding/slaves", mld_name);
1166+
fp = fopen(slave_list, "r");
1167+
if (NULL == fp) {
1168+
wifi_hal_error_print("%s:%d Failed to open file %s\n", __func__, __LINE__, slave_list);
1169+
return ret;
1170+
}
1171+
1172+
if (access(slave_list, F_OK) == 0) {
1173+
linebuf[0] = '\0';
1174+
fgets(linebuf, sizeof(linebuf), fp);
1175+
if (strlen(linebuf) && linebuf[strlen(linebuf) - 1] == '\n') {
1176+
linebuf[strlen(linebuf) - 1] = '\0'; // remove trailing newline character (\n)
1177+
}
1178+
wifi_hal_dbg_print("%s:%d slaves=%s\n", __func__, __LINE__, linebuf);
1179+
rest = linebuf;
1180+
while ((slave = strtok_r(rest, " ", &rest))) {
1181+
printf("%s ", slave);
1182+
if (strcmp(slave, ifname) == 0) {
1183+
wifi_hal_dbg_print("%s:%d %s is bonding slave of %s\n", __func__, __LINE__, ifname,
1184+
mld_name);
1185+
ret = true;
1186+
break;
1187+
}
1188+
}
1189+
}
1190+
fclose(fp);
1191+
if (!ret) {
1192+
wifi_hal_dbg_print("%s:%d %s is not a bonding slave of %s\n", __func__, __LINE__, ifname,
1193+
mld_name);
1194+
}
1195+
return ret;
1196+
}
1197+
1198+
INT platform_set_intf_mld_bonding(wifi_radio_info_t *radio, wifi_interface_info_t *interface)
1199+
{
1200+
char cmd[QCA_MAX_CMD_SZ];
1201+
char mld_ifname[32];
1202+
char ifname[32];
1203+
char mld_mac_addr[ETH_ALEN];
1204+
char mld_mac_str[18];
1205+
1206+
if (interface == NULL || radio == NULL) {
1207+
wifi_hal_error_print("%s:%d: Invalid arguments\n", __func__, __LINE__);
1208+
return RETURN_ERR;
1209+
}
1210+
if ((int)interface->vap_info.vap_index >= 0) {
1211+
if (get_interface_name_from_vap_index(interface->vap_info.vap_index, ifname) != RETURN_OK) {
1212+
wifi_hal_error_print(
1213+
"%s:%d: vap index:%d failed to get interface name from vap index\n", __func__,
1214+
__LINE__, interface->vap_info.vap_index);
1215+
return RETURN_ERR;
1216+
}
1217+
if (qca_get_vap_mld_addr(&interface->vap_info, mld_mac_addr) == RETURN_ERR) {
1218+
wifi_hal_error_print("%s:%d: vap index:%d failed to get mld address\n", __func__,
1219+
__LINE__, interface->vap_info.vap_index);
1220+
return RETURN_ERR;
1221+
}
1222+
1223+
snprintf(mld_mac_str, sizeof(mld_mac_str), MACSTR, MAC2STR(mld_mac_addr));
1224+
snprintf(mld_ifname, sizeof(mld_ifname), "mld%d", interface->vap_info.vap_index);
1225+
1226+
if ((!(radio->oper_param.variant & WIFI_80211_VARIANT_BE)) &&
1227+
is_bonding_slave(mld_ifname, ifname)) {
1228+
snprintf(cmd, sizeof(cmd), "cfg80211tool %s mode %s",
1229+
getInterface(interface->vap_info.vap_index),
1230+
(radio->oper_param.band == WIFI_FREQUENCY_2_4_BAND) ? "11GHE20" : "11AHE80");
1231+
wifi_hal_info_print("%s:%d Executing: %s\n", __func__, __LINE__, cmd);
1232+
system(cmd);
1233+
wifi_hal_info_print("%s:%d Delete bonding between ifname:%s and mld:%s\n", __func__,
1234+
__LINE__, ifname, mld_ifname);
1235+
// ToDo :- Check and enable if required
1236+
// wifi_setMLDaddr(interface->vap_info.vap_index, "00:00:00:00:00:00");
1237+
wifi_setMLDaddr(interface->vap_info.vap_index, mld_mac_str);
1238+
} else {
1239+
wifi_hal_dbg_print("%s:%d No need to changing bonding state for %s\n", __func__,
1240+
__LINE__, ifname);
1241+
}
1242+
}
1243+
return RETURN_OK;
1244+
}
1245+
#endif
1246+
11861247
int platform_set_radio_pre_init(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam)
11871248
{
11881249
#define MAX_INTERFACE_IDX 30
@@ -1217,7 +1278,7 @@ int platform_set_radio_pre_init(wifi_radio_index_t index, wifi_radio_operationPa
12171278
}
12181279
interface = hash_map_get_next(radio->interface_map, interface);
12191280
}
1220-
1281+
#if defined(CONFIG_MLO)
12211282
for(i=0; i < MAX_INTERFACE_IDX; i++)
12221283
{
12231284
if(!(existing_vap_indices & 1<<i))
@@ -1253,6 +1314,7 @@ int platform_set_radio_pre_init(wifi_radio_index_t index, wifi_radio_operationPa
12531314
return 0;
12541315
}
12551316
}
1317+
#endif
12561318
wifi_hal_dbg_print("%s:%d Exit\n",__func__,__LINE__);
12571319
return 0;
12581320
}

0 commit comments

Comments
 (0)