[][MAC80211][app][atenl: update ated wrapper and drop tx length patch]

[Description]
Fix ated wrapper for correctly writing back results to flash. Also drop
tx length modification patch which was intended to fix EVM problem. It has
already been fixed by using random payload.

[Release-log]
N/A

Change-Id: I5372fd0c18039683e612eeb8429da29fb3fafb92
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6241173
diff --git a/feed/atenl/files/ated.sh b/feed/atenl/files/ated.sh
index 0fa8950..671b6fd 100755
--- a/feed/atenl/files/ated.sh
+++ b/feed/atenl/files/ated.sh
@@ -17,12 +17,9 @@
         cmd="${cmd} \"${i}\""
         add_quote="0"
     else
-        if [ ${i} = "ra0" ]; then
+        if [ ${i} = "ra0" ] || [ ${i} = "rax0" ]; then
             ori_inf=${i}
             i="phy0"
-        elif [ ${i} = "rax0" ]; then
-            ori_inf=${i}
-            i="phy1"
         fi
         cmd="${cmd} ${i}"
     fi
diff --git a/feed/atenl/src/atenl.h b/feed/atenl/src/atenl.h
index 22d867a..4078825 100644
--- a/feed/atenl/src/atenl.h
+++ b/feed/atenl/src/atenl.h
@@ -90,7 +90,6 @@
 
 	bool cmd_mode;
 
-	bool ibf_cal;
 	/* intermediate data */
 	u8 ibf_mcs;
 	u8 ibf_ant;
diff --git a/feed/atenl/src/nl.c b/feed/atenl/src/nl.c
index 16137f6..368ffbd 100644
--- a/feed/atenl/src/nl.c
+++ b/feed/atenl/src/nl.c
@@ -118,25 +118,6 @@
 }
 
 static void
-atenl_set_attr_tx_length(struct atenl *an, struct nl_msg *msg,
-			 u32 tx_length, bool is_mu)
-{
-#define IEEE80211_MAX_FRAME_LEN		2352
-	int hdr_len = 24;
-
-	if (tx_length > IEEE80211_MAX_FRAME_LEN || is_mu)
-		hdr_len += 2;
-
-	if (an->ibf_cal)
-		hdr_len = 0;
-
-	/* The definition of MT76_TM_ATTR_TX_LENGTH is MPDU length,
-	 * so add ieee80211_hdr length.
-	 */
-	nla_put_u32(msg, MT76_TM_ATTR_TX_LENGTH, tx_length + hdr_len);
-}
-
-static void
 atenl_set_attr_antenna(struct atenl *an, struct nl_msg *msg, u8 tx_antenna)
 {
 	if (!tx_antenna)
@@ -308,9 +289,8 @@
 			nla_put_u32(msg, MT76_TM_ATTR_TX_TIME,
 				    get_band_val(an, band, tx_time));
 		else
-			atenl_set_attr_tx_length(an, msg,
-					get_band_val(an, band, tx_mpdu_len),
-					tx_rate_mode == MT76_TM_TX_MODE_HE_MU);
+			nla_put_u32(msg, MT76_TM_ATTR_TX_LENGTH,
+				    get_band_val(an, band, tx_mpdu_len));
 
 		/* for chips after 7915, tx need to use at least wcid = 1 */
 		if (!is_mt7915(an) && !aid)
@@ -735,7 +715,7 @@
 		nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_IDX, mcs);
 		nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_LDPC, ldpc);
 		nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_NSS, nss);
-		atenl_set_attr_tx_length(an, msg, tx_length, true);
+		nla_put_u32(msg, MT76_TM_ATTR_TX_LENGTH, tx_length);
 
 		ret = snprintf(buf, sizeof(buf), "%x", ru_alloc);
 		if (snprintf_error(sizeof(buf), ret))
@@ -899,8 +879,6 @@
 			return -ENOMEM;
 		nla_put_u16(msg, 0, 0);
 		nla_nest_end(msg, a);
-
-		an->ibf_cal = true;
 		break;
 	case TXBF_ACT_MCS:
 		tmp_ant = (1 << DIV_ROUND_UP(val[0], 8)) - 1 ?: 1;
@@ -925,7 +903,7 @@
 		nla_put_u8(msg, MT76_TM_ATTR_AID, val[1]);
 		nla_put_u8(msg, MT76_TM_ATTR_TXBF_ACT, MT76_TM_TXBF_ACT_TX_PREP);
 		nla_put_u32(msg, MT76_TM_ATTR_TX_COUNT, 10000000);
-		atenl_set_attr_tx_length(an, msg, 1024, false);
+		nla_put_u32(msg, MT76_TM_ATTR_TX_LENGTH, 1024);
 		a = nla_nest_start(msg, MT76_TM_ATTR_TXBF_PARAM);
 		if (!a)
 			return -ENOMEM;
@@ -962,8 +940,6 @@
 			return -ENOMEM;
 		nla_put_u16(msg, 0, 0);
 		nla_nest_end(msg, a);
-
-		an->ibf_cal = false;
 		break;
 	case TXBF_ACT_INIT:
 	case TXBF_ACT_POWER: