[rdkb][common][bsp][Refactor and sync wifi from openwrt]

[Description]
1dacd97b [MAC80211][WiFi6][Misc][Fix patch fail]
7c02334a [MAC80211][WiFi7][Misc][Fix build fail because of mt76 version upgradation]
7a073097 [MAC80211][WiFi7][misc][ensure the first MLD bss is bss[0]]
27e2304c [MAC80211][WiFi6][mt76][Refactor due to atenl change]
1e1eb98e [MAC80211][WiFi6/7][app][Add single wiphy support for atenl & iwpriv wrapper]
d4101c33 [MAC80211][WiFi7][mt76][enable lftp for wifi7 r1 cert]
55f5732f [MAC80211][WiFi7][hostapd][set ctrl_interface for all bss]

[Release-log]

Change-Id: I9cad01561c310576a9e5bdc9f1b8eec3025e51d9
diff --git a/recipes-wifi/atenl/files/src/atenl.h b/recipes-wifi/atenl/files/src/atenl.h
index a5f9fbb..a6695c9 100644
--- a/recipes-wifi/atenl/files/src/atenl.h
+++ b/recipes-wifi/atenl/files/src/atenl.h
@@ -85,6 +85,7 @@
 	u16 adie_id;
 	u8 sub_chip_id;
 	u8 cur_band;
+	u8 main_phy_idx;
 
 	u8 mac_addr[ETH_ALEN];
 	char *bridge_name;
diff --git a/recipes-wifi/atenl/files/src/eeprom.c b/recipes-wifi/atenl/files/src/eeprom.c
index d112dc7..b3a652a 100644
--- a/recipes-wifi/atenl/files/src/eeprom.c
+++ b/recipes-wifi/atenl/files/src/eeprom.c
@@ -27,7 +27,7 @@
 
 	snprintf(fname, sizeof(fname),
 		 "/sys/kernel/debug/ieee80211/phy%d/mt76/eeprom",
-		 get_band_val(an, 0, phy_idx));
+		 an->main_phy_idx);
 	fd_ori = open(fname, O_RDONLY);
 	if (fd_ori < 0)
 		return -1;
@@ -344,17 +344,14 @@
 	bool flash_mode;
 	int eeprom_fd;
 	char buf[30];
-	u8 main_phy_idx = phy_idx;
 
 	set_band_val(an, 0, phy_idx, phy_idx);
 	atenl_nl_check_mtd(an);
 	flash_mode = an->mtd_part != NULL;
 
 	// Get the first main phy index for this chip
-	if (flash_mode)
-		main_phy_idx -= an->band_idx;
-
-	snprintf(buf, sizeof(buf), "/tmp/atenl-eeprom-phy%u", main_phy_idx);
+	an->main_phy_idx = phy_idx - an->band_idx;
+	snprintf(buf, sizeof(buf), "/tmp/atenl-eeprom-phy%u", an->main_phy_idx);
 	eeprom_file = strdup(buf);
 
 	eeprom_fd = atenl_eeprom_init_file(an, flash_mode);
@@ -461,7 +458,7 @@
 
 	snprintf(fname, sizeof(fname),
 		"/sys/kernel/debug/ieee80211/phy%d/mt76/eeprom",
-		get_band_val(an, 0, phy_idx));
+		an->main_phy_idx);
 	fd_ori = open(fname, O_RDONLY);
 	if (fd_ori < 0)
 		return -1;
diff --git a/recipes-wifi/atenl/files/src/nl.c b/recipes-wifi/atenl/files/src/nl.c
index 6850fc8..baf2944 100644
--- a/recipes-wifi/atenl/files/src/nl.c
+++ b/recipes-wifi/atenl/files/src/nl.c
@@ -1199,12 +1199,13 @@
 		return NL_SKIP;
 
 	nla_parse_nested(tb, MT76_TM_ATTR_MAX, attr, testdata_policy);
+	an->band_idx = nla_get_u32(tb[MT76_TM_ATTR_BAND_IDX]);
+
 	if (!tb[MT76_TM_ATTR_MTD_PART] || !tb[MT76_TM_ATTR_MTD_OFFSET])
 		return NL_SKIP;
 
 	an->mtd_part = strdup(nla_get_string(tb[MT76_TM_ATTR_MTD_PART]));
 	an->mtd_offset = nla_get_u32(tb[MT76_TM_ATTR_MTD_OFFSET]);
-	an->band_idx = nla_get_u32(tb[MT76_TM_ATTR_BAND_IDX]);
 
 	return NL_SKIP;
 }
diff --git a/recipes-wifi/atenl/files/src/util.c b/recipes-wifi/atenl/files/src/util.c
index b224040..109e7db 100644
--- a/recipes-wifi/atenl/files/src/util.c
+++ b/recipes-wifi/atenl/files/src/util.c
@@ -11,7 +11,7 @@
 	/* write offset into regidx */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/regidx",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -30,7 +30,7 @@
 	/* read value from regval */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/regval",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -63,7 +63,7 @@
 	/* write offset into regidx */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/regidx",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -82,7 +82,7 @@
 	/* write value into regval */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/regval",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -118,7 +118,7 @@
 	/* write regidx */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/regidx",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -137,7 +137,7 @@
 	/* read from rf_regval */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/rf_regval",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -175,7 +175,7 @@
 	/* write regidx */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/regidx",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;
 
@@ -194,7 +194,7 @@
 	/* write value into rf_val */
 	ret = snprintf(dir, sizeof(dir),
 		       "/sys/kernel/debug/ieee80211/phy%d/mt76/rf_regval",
-		       get_band_val(an, 0, phy_idx));
+		       an->main_phy_idx);
 	if (snprintf_error(sizeof(dir), ret))
 		return ret;