[][[Panther] iwconfig dispaly error]
[Description]
Fix wireless tool and kernel rate variable range
[Release-log]
N/A
Change-Id: I2fc8736e22fa304e3027c62ccc83fd58a2cab51a
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5153769
diff --git a/openwrt_patches-21.02/401-mt7986-iwconfig.patch b/openwrt_patches-21.02/401-mt7986-iwconfig.patch
new file mode 100644
index 0000000..55077c9
--- /dev/null
+++ b/openwrt_patches-21.02/401-mt7986-iwconfig.patch
@@ -0,0 +1,51 @@
+diff --git a/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch b/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch
+new file mode 100644
+index 0000000..62057bf
+--- a/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch
++++ b/package/network/utils/wireless-tools/patches/006-fix-iwconfig-rate-print-format.patch
+@@ -0,0 +1,45 @@
++Index: wireless_tools.29/iwlib.c
++===================================================================
++--- wireless_tools.29.orig/iwlib.c 2007-06-30 07:43:31.000000000 +0800
+++++ wireless_tools.29/iwlib.c 2020-09-25 15:35:01.105434143 +0800
++@@ -1129,7 +1129,7 @@ iw_channel_to_freq(int channel,
++ void
++ iw_print_bitrate(char * buffer,
++ int buflen,
++- int bitrate)
+++ unsigned long long bitrate)
++ {
++ double rate = bitrate;
++ char scale;
++--- wireless_tools.29.orig/iwlib.h
+++++ wireless_tools.29.orig/iwlib.h
++@@ -346,7 +346,7 @@ int
++ void
++ iw_print_bitrate(char * buffer,
++ int buflen,
++- int bitrate);
+++ unsigned long long bitrate);
++ /* ---------------------- POWER SUBROUTINES ----------------------- */
++ int
++ iw_dbm2mwatt(int in);
++--- wireless_tools.29.orig/wireless.21.h
+++++ wireless_tools.29.orig/wireless.21.h
++@@ -669,7 +669,7 @@
++ */
++ struct iw_param
++ {
++- __s32 value; /* The value of the parameter itself */
+++ __u64 value; /* The value of the parameter itself */
++ __u8 fixed; /* Hardware should not use auto select */
++ __u8 disabled; /* Disable the feature */
++ __u16 flags; /* Various specifc flags (if any) */
++@@ -1005,7 +1005,7 @@ struct iw_range
++
++ /* Rates */
++ __u8 num_bitrates; /* Number of entries in the list */
++- __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
+++ __u64 bitrate[IW_MAX_BITRATES]; /* list, in bps */
++
++ /* RTS threshold */
++ __s32 min_rts; /* Minimal RTS threshold */
++
diff --git a/target/linux/mediatek/patches-5.4/9010-iwconfig-wireless-rate-fix.patch b/target/linux/mediatek/patches-5.4/9010-iwconfig-wireless-rate-fix.patch
new file mode 100644
index 0000000..b29e4cc
--- /dev/null
+++ b/target/linux/mediatek/patches-5.4/9010-iwconfig-wireless-rate-fix.patch
@@ -0,0 +1,20 @@
+--- a/include/uapi/linux/wireless.h
++++ b/include/uapi/linux/wireless.h
+@@ -678,7 +678,7 @@
+ * Generic format for most parameters that fit in an int
+ */
+ struct iw_param {
+- __s32 value; /* The value of the parameter itself */
++ __u64 value; /* The value of the parameter itself */
+ __u8 fixed; /* Hardware should not use auto select */
+ __u8 disabled; /* Disable the feature */
+ __u16 flags; /* Various specifc flags (if any) */
+@@ -1002,7 +1002,7 @@ struct iw_range {
+
+ /* Rates */
+ __u8 num_bitrates; /* Number of entries in the list */
+- __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
++ __u64 bitrate[IW_MAX_BITRATES]; /* list, in bps */
+
+ /* RTS threshold */
+ __s32 min_rts; /* Minimal RTS threshold */