[][MAC80211][mt76][Implement iBF command mode support in testmode]
[Description]
Add mt76-test iBF commands and update iwpriv wrapper for iBF commands.
[Release-log]
N/A
Change-Id: Ic9dac7cfa2f60ee232efde677156bf1241b4c6e8
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6502057
diff --git a/feed/atenl/files/iwpriv.sh b/feed/atenl/files/iwpriv.sh
index 4e7eee9..910e314 100755
--- a/feed/atenl/files/iwpriv.sh
+++ b/feed/atenl/files/iwpriv.sh
@@ -616,6 +616,70 @@
do_cmd "mt76-test phy${phy_idx} set mac_addrs=${addr1},${addr2},${addr3}"
}
+function convert_ibf {
+ local cmd=$1
+ local param=$2
+ local new_cmd=""
+ local new_param=$(echo ${param} | sed s/":"/","/g)
+
+ case ${cmd} in
+ "ATETxBfInit")
+ new_cmd="init"
+ new_param=1
+ do_cmd "mt76-test phy${phy_idx} set state=idle"
+ ;;
+ "ATEIBFPhaseComp")
+ new_cmd="phase_comp"
+ new_param="${new_param} aid=1"
+ ;;
+ "ATEEBfProfileConfig")
+ new_cmd="ebf_prof_update"
+ ;;
+ "ATEIBfProfileConfig")
+ new_cmd="ibf_prof_update"
+ ;;
+ "ATEIBfInstCal")
+ new_cmd="phase_cal"
+ ;;
+ "ATEIBfGdCal")
+ new_cmd="phase_cal"
+ new_param="${new_param},00"
+ ;;
+ "TxBfTxApply")
+ new_cmd="apply_tx"
+ ;;
+ "ATETxPacketWithBf")
+ local bf_on=${new_param:0:2}
+ local aid="01"
+ local wlan_idx=${new_param:3:2}
+ local update="00"
+ local tx_len=${new_param:6}
+
+ new_cmd="tx_prep"
+ new_param="${bf_on},${aid},${wlan_idx},${update}"
+ if [ "${tx_len}" = "00" ]; then
+ new_param="${new_param} aid=1 tx_count=10000000 tx_length=1024"
+ else
+ new_param="${new_param} aid=1 tx_count=${tx_len} tx_length=1024"
+ fi
+ do_cmd "mt76-test phy${phy_idx} set state=idle"
+ ;;
+ "TxBfProfileData20MAllWrite")
+ new_cmd="prof_update_all"
+ ;;
+ "ATEIBFPhaseE2pUpdate")
+ new_cmd="e2p_update"
+ ;;
+ *)
+ esac
+
+ do_cmd "mt76-test phy${phy_idx} set txbf_act=${new_cmd} txbf_param=${new_param}"
+
+ if [ "${cmd}" = "ATETxPacketWithBf" ]; then
+ do_cmd "mt76-test phy${phy_idx} set state=tx_frames"
+ fi
+}
+
function do_ate_work() {
local ate_cmd=$1
@@ -780,6 +844,12 @@
set_mac_addr ${cmd} ${param}
skip=1
;;
+ "ATETxBfInit"|"ATEIBFPhaseComp"|"ATEEBfProfileConfig"|"ATEIBfProfileConfig"| \
+ "TxBfTxApply"|"ATETxPacketWithBf"|"TxBfProfileData20MAllWrite"|"ATEIBfInstCal"|\
+ "ATEIBfGdCal"|"ATEIBFPhaseE2pUpdate")
+ convert_ibf ${cmd} ${param}
+ skip=1
+ ;;
"bufferMode")
if [ "${param}" = "2" ]; then
do_cmd "atenl -i ${interface} -c \"eeprom update buffermode\""
diff --git a/feed/atenl/src/nl.c b/feed/atenl/src/nl.c
index 85af9dc..b919356 100644
--- a/feed/atenl/src/nl.c
+++ b/feed/atenl/src/nl.c
@@ -849,7 +849,7 @@
struct nl_msg *msg = nl_priv->msg;
u32 *v = (u32 *)(hdr->data + 4);
u32 action = ntohl(v[0]);
- u16 val[8];
+ u16 val[8], is_atenl = 1;
u8 tmp_ant;
void *ptr, *a;
char cmd[64];
@@ -925,9 +925,13 @@
a = nla_nest_start(msg, MT76_TM_ATTR_TXBF_PARAM);
if (!a)
return -ENOMEM;
-
+ /* Note: litepoint may send random number for lna_gain_level, reset to 0 */
+ if (action == TXBF_ACT_IBF_PHASE_CAL)
+ val[4] = 0;
for (i = 0; i < 5; i++)
nla_put_u16(msg, i, val[i]);
+ /* Used to distinguish between command mode and HQADLL mode */
+ nla_put_u16(msg, 5, is_atenl);
nla_nest_end(msg, a);
break;
case TXBF_ACT_IBF_PHASE_E2P_UPDATE:
diff --git a/feed/atenl/src/nl.h b/feed/atenl/src/nl.h
index eaf082f..27336bd 100644
--- a/feed/atenl/src/nl.h
+++ b/feed/atenl/src/nl.h
@@ -240,8 +240,10 @@
MT76_TM_TXBF_ACT_TX_PREP,
MT76_TM_TXBF_ACT_IBF_PROF_UPDATE,
MT76_TM_TXBF_ACT_EBF_PROF_UPDATE,
+ MT76_TM_TXBF_ACT_APPLY_TX,
MT76_TM_TXBF_ACT_PHASE_CAL,
MT76_TM_TXBF_ACT_PROF_UPDATE_ALL,
+ MT76_TM_TXBF_ACT_PROF_UPDATE_ALL_CMD,
MT76_TM_TXBF_ACT_E2P_UPDATE,
/* keep last */