[OpenWrt-Devel] [PATCH 1/2] kernel: bump 4.9 to 4.9.106 for 18.06

2018-06-05 Thread Stijn Segers
Refreshed patches. The following patches were upstreamed and have been deleted:

* 
target/linux/ar71xx/patches-4.9/106-01-MIPS-ath79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch
* 
target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch
* 
target/linux/generic/pending-4.9/181-net-usb-add-lte-modem-wistron-neweb-d18q1.patch
* 
target/linux/generic/pending-4.9/182-net-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch

Signed-off-by: Stijn Segers 
---
 include/kernel-version.mk  |   4 +-
 ...h79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch |  29 --
 .../902-at803x-add-reset-gpio-pdata.patch  |   8 +-
 ...oid-suspending-if-we-re-in-gadget-mode-18.patch |   2 +-
 .../linux/brcm47xx/patches-4.9/159-cpu_fixes.patch |   8 +-
 ...tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch |   2 +-
 .../050-usb-dwc2-Remove-unnecessary-kfree.patch|   2 +-
 ...llocate-struct-bgmac-just-once-don-t-copy.patch |   6 +-
 .../090-net-generalize-napi_complete_done.patch|  18 +-
 ...er.h-prevent-redefinition-of-struct-ethhd.patch |   2 +-
 .../hack-4.9/773-bgmac-add-srab-switch.patch   |   6 +-
 .../generic/hack-4.9/901-debloat_sock_diag.patch   |   2 +-
 ...-.rename2-and-add-RENAME_WHITEOUT-support.patch |   6 +-
 .../141-jffs2-add-RENAME_EXCHANGE-support.patch|   8 +-
 ...180-net-phy-at803x-add-support-for-AT8032.patch |  70 ---
 ...net-usb-add-lte-modem-wistron-neweb-d18q1.patch |  61 ---
 ...t-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch |  28 --
 .../pending-4.9/630-packet_socket_type.patch   |   6 +-
 .../666-Add-support-for-MAP-E-FMRs-mesh-mode.patch |  10 +-
 ...t-phy-at803x-allow-to-configure-via-pdata.patch |  12 +-
 .../735-net-phy-at803x-fix-at8033-sgmii-mode.patch |   2 +-
 .../generic/pending-4.9/834-ledtrig-libata.patch   |   8 +-
 .../ixp4xx/patches-4.9/160-delayed_uart_io.patch   |   4 +-
 .../202-core-linux-support-layerscape.patch|   2 +-
 .../patches-4.9/702-pci-support-layerscape.patch   |   2 +-
 .../704-fsl-mc-layerscape-support.patch|   2 +-
 .../patches-4.9/810-iommu-support-layerscape.patch |   8 +-
 .../816-tty-serial-support-layerscape.patch|  10 +-
 .../patches-4.9/817-usb-support-layerscape.patch   |  32 +-
 .../100-powerpc-85xx-tl-wdr4900-v1-support.patch   |   4 +-
 .../sunxi/patches-4.9/0050-stmmac-form-4-10.patch  | 120 +++---
 .../sunxi/patches-4.9/0051-stmmac-form-4-11.patch  |  36 +-
 .../sunxi/patches-4.9/0052-stmmac-form-4-12.patch  | 468 ++---
 .../sunxi/patches-4.9/0053-stmmac-form-4-13.patch  |  16 +-
 .../patches-4.9/200-pcengines-apu2-reboot.patch|   2 +-
 35 files changed, 400 insertions(+), 606 deletions(-)
 delete mode 100644 
target/linux/ar71xx/patches-4.9/106-01-MIPS-ath79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch
 delete mode 100644 
target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch
 delete mode 100644 
target/linux/generic/pending-4.9/181-net-usb-add-lte-modem-wistron-neweb-d18q1.patch
 delete mode 100644 
target/linux/generic/pending-4.9/182-net-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 12d96e7b8c..52bc1ee69d 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -4,12 +4,12 @@ LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .71
 LINUX_VERSION-4.4 = .121
-LINUX_VERSION-4.9 = .102
+LINUX_VERSION-4.9 = .106
 LINUX_VERSION-4.14 = .43
 
 LINUX_KERNEL_HASH-3.18.71 = 
5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
 LINUX_KERNEL_HASH-4.4.121 = 
44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729
-LINUX_KERNEL_HASH-4.9.102 = 
d155a36ba52d5809805cd370902582ac373c5b23a958c6424325684447119dc5
+LINUX_KERNEL_HASH-4.9.106 = 
2d409bb29588ea9a61bae006255ee97a675ded364c87a9ff43f687c5271bbe3c
 LINUX_KERNEL_HASH-4.14.43 = 
133fc0f8f9ea04006c255a052704e8eb95a021fc799dd27f98fcfcace59e714a
 
 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1
diff --git 
a/target/linux/ar71xx/patches-4.9/106-01-MIPS-ath79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch
 
b/target/linux/ar71xx/patches-4.9/106-01-MIPS-ath79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch
deleted file mode 100644
index e785b30eff..00
--- 
a/target/linux/ar71xx/patches-4.9/106-01-MIPS-ath79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 0f15814bcdf59f10b708a3fba636acb089e9a4f1 Mon Sep 17 00:00:00 2001
-From: Mathias Kresin 
-Date: Thu, 30 Mar 2017 15:34:39 +0200
-Subject: [PATCH] MIPS: ath79: fix AR724X_PLL_REG_PCIE_CONFIG offset
-
-According to the QCA u-boot source the "PCIE Phase Lock Loop
-Configuration (PCIE_PLL_CONFIG)" register is for all SoCs except the
-QCA955X and QCA956X at offset 0x10.
-
-Since the PCIE PLL config register is only defined for the AR724x fix
-only this value. The value is wrong since the day it was added and isn't
-yet used by any driver.
-
-Signed-off-by: Mathias Kresin 

- arch/mip

[OpenWrt-Devel] [PATCH 0/2] 18.06: bump 4.9 and 4.14 kernel to .106 and .48

2018-06-05 Thread Stijn Segers
Bump kernels on the 18.06 branch and refresh patches.

Stijn Segers (2):
  kernel: bump 4.9 to 4.9.106 for 18.06
  kernel: bump 4.14 to 4.14.48 for 18.06

 include/kernel-version.mk  |   8 +-
 ...d-firmware-loader-for-uPD720201-and-uPD72.patch |   6 +-
 .../802-usb-xhci-force-msi-renesas-xhci.patch  |   2 +-
 ...h79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch |  29 --
 .../902-at803x-add-reset-gpio-pdata.patch  |   8 +-
 ...-add-support-for-performing-fake-doorbell.patch |   2 +-
 ...oid-suspending-if-we-re-in-gadget-mode-18.patch |   2 +-
 .../linux/brcm47xx/patches-4.9/159-cpu_fixes.patch |   8 +-
 .../backport-4.14/011-kbuild-export-SUBARCH.patch  |   2 +-
 ...er.h-prevent-redefinition-of-struct-ethhd.patch |   2 +-
 ...15-netfilter-exit_net-cleanup-check-added.patch |   2 +-
 ...tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch |   2 +-
 .../050-usb-dwc2-Remove-unnecessary-kfree.patch|   2 +-
 ...llocate-struct-bgmac-just-once-don-t-copy.patch |   6 +-
 .../090-net-generalize-napi_complete_done.patch|  18 +-
 ...er.h-prevent-redefinition-of-struct-ethhd.patch |   2 +-
 .../generic/hack-4.14/202-reduce_module_size.patch |   2 +-
 .../generic/hack-4.14/207-disable-modorder.patch   |   4 +-
 .../linux/generic/hack-4.14/220-gc_sections.patch  |   2 +-
 .../hack-4.14/773-bgmac-add-srab-switch.patch  |   6 +-
 .../generic/hack-4.14/901-debloat_sock_diag.patch  |   2 +-
 .../linux/generic/hack-4.14/902-debloat_proc.patch |   2 +-
 .../hack-4.9/773-bgmac-add-srab-switch.patch   |   6 +-
 .../generic/hack-4.9/901-debloat_sock_diag.patch   |   2 +-
 ...-mips-gic-timer-fix-clocksource-counter-w.patch |  23 -
 ...ata-corruption-related-to-cache-coherence.patch |  90 
 ...-.rename2-and-add-RENAME_WHITEOUT-support.patch |   6 +-
 .../141-jffs2-add-RENAME_EXCHANGE-support.patch|   8 +-
 ...net-usb-add-lte-modem-wistron-neweb-d18q1.patch |  61 ---
 ...t-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch |  28 --
 .../pending-4.14/201-extra_optimization.patch  |   2 +-
 .../pending-4.14/630-packet_socket_type.patch  |   6 +-
 .../666-Add-support-for-MAP-E-FMRs-mesh-mode.patch |  10 +-
 .../811-pci_disable_usb_common_quirks.patch|  22 +-
 .../generic/pending-4.14/834-ledtrig-libata.patch  |   8 +-
 ...-.rename2-and-add-RENAME_WHITEOUT-support.patch |   6 +-
 .../141-jffs2-add-RENAME_EXCHANGE-support.patch|   8 +-
 ...180-net-phy-at803x-add-support-for-AT8032.patch |  70 ---
 ...net-usb-add-lte-modem-wistron-neweb-d18q1.patch |  61 ---
 ...t-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch |  28 --
 .../pending-4.9/630-packet_socket_type.patch   |   6 +-
 .../666-Add-support-for-MAP-E-FMRs-mesh-mode.patch |  10 +-
 ...t-phy-at803x-allow-to-configure-via-pdata.patch |  12 +-
 .../735-net-phy-at803x-fix-at8033-sgmii-mode.patch |   2 +-
 .../generic/pending-4.9/834-ledtrig-libata.patch   |   8 +-
 ...com-bam-Process-multiple-pending-descript.patch |  22 +-
 ...tbindings-qcom_adm-Fix-channel-specifiers.patch |  34 +-
 .../0002-dmaengine-Add-ADM-driver.patch|   6 +-
 .../0030-clk-Disable-i2c-device-on-gsbi4.patch |  30 +-
 ...31-mtd-add-SMEM-parser-for-QCOM-platforms.patch |  10 +-
 .../patches-4.14/0032-phy-add-qcom-dwc3-phy.patch  |  10 +-
 ...tomatically-select-PCI_DOMAINS-if-PCI-is-.patch |  11 +-
 ...-Add-Krait-L2-register-accessor-functions.patch |  12 +-
 ...ux-Split-out-register-accessors-for-reuse.patch | 100 ++---
 ...dd-support-for-High-Frequency-PLLs-HFPLLs.patch |   2 +-
 .../0039-clk-qcom-Add-HFPLL-driver.patch   |   6 +-
 .../0040-clk-qcom-Add-IPQ806X-s-HFPLLs.patch   |  18 +-
 ...041-clk-qcom-Add-support-for-Krait-clocks.patch |   6 +-
 .../0042-clk-qcom-Add-KPSS-ACC-GCC-driver.patch|  28 +-
 ...lk-qcom-Add-Krait-clock-controller-driver.patch |  10 +-
 .../0044-clk-Add-safe-switch-hook.patch|  86 ++--
 ...-module-to-register-cpufreq-on-Krait-CPUs.patch |  12 +-
 ...0046-cpufreq-qcom-independent-core-clocks.patch |  29 +-
 ...eate-a-BBT-flag-to-access-bad-block-marke.patch |  26 +-
 ...K-Allow-to-set-regulator-without-opp_list.patch |  24 +-
 ...Support-adjusting-OPP-voltages-at-runtime.patch |  20 +-
 ...a-helper-to-get-an-opp-regulator-for-devi.patch |   9 +-
 ...te-the-voltage-tolerance-when-adjusting-t.patch |  24 +-
 .../0053-regulator-add-smb208-support.patch|  32 +-
 ...ufreq-dt-Handle-OPP-voltage-adjust-events.patch |  64 +--
 ...ufreq-dt-Add-L2-frequency-scaling-support.patch |  56 +--
 .../0056-cpufreq-dt-Add-missing-rcu-locks.patch|  16 +-
 ...cpuidle-Add-cpuidle-support-for-QCOM-cpus.patch |   6 +-
 ...HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch |  16 +-
 ...otfs-conflicts-with-OpenWrt-auto-mounting.patch |  12 +-
 ...c-Added-the-enable-regs-and-mask-for-PRNG.patch |  12 +-
 .../patches-4.14/0063-1-ipq806x-tsens-driver.patch |  16 +-
 ...3-2-tsens-support-configurable-interrupts.patch | 312 +++---
 .../patches-4.14/0064-clk-clk-rpm-fixes.patch  |  32 +-
 .

Re: [OpenWrt-Devel] Sysupgrade failure (unable to kill all processes).

2018-06-05 Thread Stijn Segers



Op za, 2 jun 2018 om 8:34 , schreef A. Benz via openwrt-devel 
:

The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel


I don't know how this DMARC mitigation thing works, but I am 
experiencing the same issue on an mt7621 device (DIR-860L rev B1). Took 
me four tries to coax sysupgrade until stintel pointed me to this 
report.


Cheers

Stijn Segers


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ath79: add WLAN, Ethernet-Switch with LAN/WAN and Status LED to Dorin

2018-06-05 Thread Catrinel Catrinescu
Signed-off-by: Catrinel Catrinescu 
---
 target/linux/ath79/base-files/etc/board.d/02_network |  5 +
 target/linux/ath79/base-files/etc/diag.sh|  3 +++
 target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts | 13 +++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network 
b/target/linux/ath79/base-files/etc/board.d/02_network
index a9eeb5b455..e6ef47240f 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -14,6 +14,11 @@ ath79_setup_interfaces()
ucidef_set_interface_lan "eth0"
;;
 
+   "embeddedwireless,dorin")
+   ucidef_add_switch "switch0" \
+   "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
+   ;;
+
"glinet,ar150")
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
diff --git a/target/linux/ath79/base-files/etc/diag.sh 
b/target/linux/ath79/base-files/etc/diag.sh
index b18463413a..0a5011a7ae 100644
--- a/target/linux/ath79/base-files/etc/diag.sh
+++ b/target/linux/ath79/base-files/etc/diag.sh
@@ -12,6 +12,9 @@ get_status_led() {
"avm,fritz300e")
status_led="${boardname}:green:power"
;;
+   "embeddedwireless,dorin")
+   status_led="dorin:green:status"
+   ;;
"glinet,ar150")
status_led="gl-ar150:orange:wlan"
;;
diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts 
b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
index 4b204b7561..4c2e0ac8cb 100644
--- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
+++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
@@ -111,20 +111,21 @@
status = "okay";
 
mtd-mac-address = <&art 0x1002>;
+   mtd-mac-address-increment = <(0x40)>;   /* ToDo: mac[3] instead of 
mac[5] */
 
fixed-link {
speed = <1000>;
full-duplex;
};
 
-   gmac-config {
-   device = <&gmac>;
-
-   switch-phy-addr-swap = <1>;
-   switch-phy-swap = <1>;
-   };
 };
 
 &mdio1 {
status = "okay";
 };
+
+&wmac {
+   status = "okay";
+   mtd-cal-data = <&art 0x1000>;
+   mtd-mac-address = <&art 0x1002>;
+};
-- 
2.14.3 (Apple Git-98)


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] iwinfo: add channel survey

2018-06-05 Thread Nick


From 9cd22ed941e4c75b4c3622c50ca995fcb0d413ea Mon Sep 17 00:00:00 2001
From: PolynomialDivision 
Date: Tue, 29 May 2018 00:10:01 +0200
Subject: [PATCH] iwinfo: add channel survey

Add channel survey data.

Signed-off-by: Nick Hainke 
---
 include/iwinfo.h | 11 +++
 iwinfo_cli.c | 37 +-
 iwinfo_nl80211.c | 60
+++-
 3 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 929f697..c5db9b6 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -157,6 +157,16 @@ struct iwinfo_scanlist_entry {
 struct iwinfo_crypto_entry crypto;
 };
 
+struct iwinfo_survey_entry {
+    uint32_t frequency;
+    int8_t noise;
+    uint64_t channel_time;
+    uint64_t channel_time_busy;
+    uint64_t channel_time_ext_busy;
+    uint64_t channel_time_rx;
+    uint64_t channel_time_tx;
+};
+
 struct iwinfo_country_entry {
 uint16_t iso3166;
 char ccode[4];
@@ -203,6 +213,7 @@ struct iwinfo_ops {
 int (*bitrate)(const char *, int *);
 int (*signal)(const char *, int *);
 int (*noise)(const char *, int *);
+    int (*survey)(const char *, struct iwinfo_survey_entry *);
 int (*quality)(const char *, int *);
 int (*quality_max)(const char *, int *);
 int (*mbssid_support)(const char *, int *);
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 49c9035..2d30fdd 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -116,6 +116,18 @@ static char * format_signal(int sig)
 return buf;
 }
 
+static char * format_channel_time(uint64_t time)
+{
+    static char buf[30];
+
+    if (!time)
+        snprintf(buf, sizeof(buf), "unknown");
+    else
+        snprintf(buf, sizeof(buf), "%llu ms", time);
+
+    return buf;
+}
+
 static char * format_noise(int noise)
 {
 static char buf[10];
@@ -531,6 +543,25 @@ static char * print_phyname(const struct iwinfo_ops
*iw, const char *ifname)
 return "?";
 }
 
+static void print_survey(const struct iwinfo_ops *iw, const char *ifname)
+{
+    struct iwinfo_survey_entry entry;
+    iw->survey(ifname, &entry);
+
+    if(iw->survey == NULL){
+        printf("No survey information available\n");
+        return;
+    }
+
+    printf("%s\tESSID:\t\t\t\t%s\n", ifname, print_ssid(iw, ifname));
+    printf("\tChannel:\t\t\t%s (%s)\n", print_channel(iw, ifname),
format_frequency(entry.frequency));
+    printf("\tNoise:\t\t\t\t%s\n", format_noise(entry.noise));
+    printf("\tchannel Active Time:\t\t%s\n",
format_channel_time(entry.channel_time));
+    printf("\tChannel Busy
Time:\t\t%s\n",format_channel_time(entry.channel_time_busy));
+    printf("\tExtension Channel Busy
Time:\t%s\n",format_channel_time(entry.channel_time_ext_busy));
+    printf("\tChannel Receive
Time:\t\t%s\n",format_channel_time(entry.channel_time_rx));
+    printf("\tChannel Transmit
Time:\t\t%s\n",format_channel_time(entry.channel_time_tx));
+}
 
 static void print_info(const struct iwinfo_ops *iw, const char *ifname)
 {
@@ -805,6 +836,7 @@ int main(int argc, char **argv)
         "Usage:\n"
         "    iwinfo  info\n"
         "    iwinfo  scan\n"
+            "    iwinfo  survey\n"
         "    iwinfo  txpowerlist\n"
         "    iwinfo  freqlist\n"
         "    iwinfo  assoclist\n"
@@ -883,7 +915,10 @@ int main(int argc, char **argv)
                 break;
 
             case 's':
-                    print_scanlist(iw, argv[1]);
+                    if(argv[i][1] == 'c')
+                        print_scanlist(iw, argv[1]);
+                    else
+                        print_survey(iw, argv[1]);
                 break;
 
             case 't':
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index ecd2d6a..c58ff1b 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1357,6 +1357,64 @@ static int nl80211_get_signal(const char *ifname,
int *buf)
 return -1;
 }
 
+static int nl80211_get_channel_survey_cb(struct nl_msg *msg, void *arg)
+{
+    struct iwinfo_survey_entry *entry = arg;
+    struct nlattr *tb[NL80211_ATTR_MAX + 1];
+    struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+    struct nlattr *si[NL80211_SURVEY_INFO_MAX + 1];
+
+    static struct nla_policy sp[NL80211_SURVEY_INFO_MAX + 1] = {
+            [NL80211_SURVEY_INFO_FREQUENCY] = { .type = NLA_U32 },
+            [NL80211_SURVEY_INFO_NOISE] = { .type = NLA_U8  },
+    };
+
+    nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+              genlmsg_attrlen(gnlh, 0), NULL);
+
+    if (!tb[NL80211_ATTR_SURVEY_INFO])
+        return NL_SKIP;
+
+    if (nla_parse_nested(si, NL80211_SURVEY_INFO_MAX,
+                         tb[NL80211_ATTR_SURVEY_INFO], sp))
+        return NL_SKIP;
+
+    if (si[NL80211_SURVEY_INFO_IN_USE])
+    {
+        if(si[NL80211_SURVEY_INFO_FREQUENCY])
+            entry->frequency =
nla_get_u32(si[NL80211_SURVEY_INFO_FREQUENCY]);
+
+        if(si[NL80211_SURVEY_INFO_NOISE])
+            entry->n

Re: [OpenWrt-Devel] [PATCH] iwinfo: add channel survey

2018-06-05 Thread Jo-Philipp Wich
Hi,

please find code comments inline below.

Do you plan to extend the Lua binding as well?

Also I wonder what the intended use case of this change is...
(lib)iwinfo was once meant to provide a common uniform subset of
wireless information across different driver backends such as
proprietary wl, madwifi, wext and nl80211.

Since the survey info here is only implemented for nl80211 and only
exposed in the C library interface (and the iwinfo cli) whats the
advantage compared to just using "iw" and native netlink?

Do you have some program depending on the libiwinfo C library?

Regards,
Jo

> Signed-off-by: Nick Hainke 
> ---
>  include/iwinfo.h | 11 +++
>  iwinfo_cli.c | 31 -
>  iwinfo_nl80211.c | 59 
> +++-
>  3 files changed, 99 insertions(+), 2 deletions(-)
> 
> diff --git a/include/iwinfo.h b/include/iwinfo.h
> index 929f697..004896e 100644
> --- a/include/iwinfo.h
> +++ b/include/iwinfo.h
> @@ -157,6 +157,16 @@ struct iwinfo_scanlist_entry {
>   struct iwinfo_crypto_entry crypto;
>  };
>  
> +struct iwinfo_survey_entry {
> + uint32_t frequency;
> + int8_t noise;
> + uint64_t channel_time;
> + uint64_t channel_time_busy;
> + uint64_t channel_time_ext_busy;
> + uint64_t channel_time_rx;
> + uint64_t channel_time_tx;
> +};
> +
>  struct iwinfo_country_entry {
>   uint16_t iso3166;
>   char ccode[4];
> @@ -203,6 +213,7 @@ struct iwinfo_ops {
>   int (*bitrate)(const char *, int *);
>   int (*signal)(const char *, int *);
>   int (*noise)(const char *, int *);
> + int (*survey)(const char *ifname, struct iwinfo_survey_entry *entry);

Please remove the parameter names from the function prototype.

>   int (*quality)(const char *, int *);
>   int (*quality_max)(const char *, int *);
>   int (*mbssid_support)(const char *, int *);
> diff --git a/iwinfo_cli.c b/iwinfo_cli.c
> index 49c9035..3d8b82c 100644
> --- a/iwinfo_cli.c
> +++ b/iwinfo_cli.c
> @@ -116,6 +116,18 @@ static char * format_signal(int sig)
>   return buf;
>  }
>  
> +static char * format_channel_time(uint64_t time)
> +{
> + static char buf[30];
> +
> + if (!time)
> + snprintf(buf, sizeof(buf), "unknown");
> + else
> + snprintf(buf, sizeof(buf), "%llu ms", time);
> +
> + return buf;
> +}
> +
>  static char * format_noise(int noise)
>  {
>   static char buf[10];
> @@ -531,6 +543,19 @@ static char * print_phyname(const struct iwinfo_ops *iw, 
> const char *ifname)
>   return "?";
>  }
>  
> +static void print_survey(const struct iwinfo_ops *iw, const char *ifname)
> +{
> + struct iwinfo_survey_entry entry;
> + iw->survey(ifname, &entry);

You need to check iw->survey != NULL, otherwise iwinfo will segfault
with non-nl80211 driver backends.

> + printf("%s\tESSID:\t\t\t\t%s\n", ifname, print_ssid(iw, ifname));
> + printf("\tChannel:\t\t\t%s (%s)\n", print_channel(iw, ifname), 
> format_frequency(entry.frequency));
> + printf("\tNoise:\t\t\t\t%s\n", format_noise(entry.noise));
> + printf("\tchannel Active Time:\t\t%s\n", 
> format_channel_time(entry.channel_time));
> + printf("\tChannel Busy 
> Time:\t\t%s\n",format_channel_time(entry.channel_time_busy));
> + printf("\tExtension Channel Busy 
> Time:\t%s\n",format_channel_time(entry.channel_time_ext_busy));
> + printf("\tChannel Receive 
> Time:\t\t%s\n",format_channel_time(entry.channel_time_rx));
> + printf("\tChannel Transmit 
> Time:\t\t%s\n",format_channel_time(entry.channel_time_tx));
> +}
>  
>  static void print_info(const struct iwinfo_ops *iw, const char *ifname)
>  {
> @@ -805,6 +830,7 @@ int main(int argc, char **argv)
>   "Usage:\n"
>   "   iwinfo  info\n"
>   "   iwinfo  scan\n"
> + "   iwinfo  survey\n"
>   "   iwinfo  txpowerlist\n"
>   "   iwinfo  freqlist\n"
>   "   iwinfo  assoclist\n"
> @@ -883,7 +909,10 @@ int main(int argc, char **argv)
>   break;
>  
>   case 's':
> - print_scanlist(iw, argv[1]);
> + if(argv[i][1] == 'c')
> + print_scanlist(iw, argv[1]);
> + else
> + print_survey(iw, argv[1]);
>   break;
>  
>   case 't':
> diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
> index ecd2d6a..2c741a3 100644
> --- a/iwinfo_nl80211.c
> +++ b/iwinfo_nl80211.c
> @@ -1357,6 +1357,63 @@ static int nl80211_get_signal(const char *ifname, int 
> *buf)
>   return -1;
>  }
>  
> +static int nl80211_get_channel_survey_cb(struct nl_msg *msg, void *arg)
> +{
> +   

Re: [OpenWrt-Devel] [PATCH] iwinfo: add channel survey

2018-06-05 Thread Nick
Why is this patch not reviewed?


On 31.05.2018 13:11, PolynomialDivision wrote:
> Add channel survey data.
>
> Signed-off-by: Nick Hainke 
> ---
>  include/iwinfo.h | 11 +++
>  iwinfo_cli.c | 31 -
>  iwinfo_nl80211.c | 59 
> +++-
>  3 files changed, 99 insertions(+), 2 deletions(-)
>
> diff --git a/include/iwinfo.h b/include/iwinfo.h
> index 929f697..004896e 100644
> --- a/include/iwinfo.h
> +++ b/include/iwinfo.h
> @@ -157,6 +157,16 @@ struct iwinfo_scanlist_entry {
>   struct iwinfo_crypto_entry crypto;
>  };
>  
> +struct iwinfo_survey_entry {
> + uint32_t frequency;
> + int8_t noise;
> + uint64_t channel_time;
> + uint64_t channel_time_busy;
> + uint64_t channel_time_ext_busy;
> + uint64_t channel_time_rx;
> + uint64_t channel_time_tx;
> +};
> +
>  struct iwinfo_country_entry {
>   uint16_t iso3166;
>   char ccode[4];
> @@ -203,6 +213,7 @@ struct iwinfo_ops {
>   int (*bitrate)(const char *, int *);
>   int (*signal)(const char *, int *);
>   int (*noise)(const char *, int *);
> + int (*survey)(const char *ifname, struct iwinfo_survey_entry *entry);
>   int (*quality)(const char *, int *);
>   int (*quality_max)(const char *, int *);
>   int (*mbssid_support)(const char *, int *);
> diff --git a/iwinfo_cli.c b/iwinfo_cli.c
> index 49c9035..3d8b82c 100644
> --- a/iwinfo_cli.c
> +++ b/iwinfo_cli.c
> @@ -116,6 +116,18 @@ static char * format_signal(int sig)
>   return buf;
>  }
>  
> +static char * format_channel_time(uint64_t time)
> +{
> + static char buf[30];
> +
> + if (!time)
> + snprintf(buf, sizeof(buf), "unknown");
> + else
> + snprintf(buf, sizeof(buf), "%llu ms", time);
> +
> + return buf;
> +}
> +
>  static char * format_noise(int noise)
>  {
>   static char buf[10];
> @@ -531,6 +543,19 @@ static char * print_phyname(const struct iwinfo_ops *iw, 
> const char *ifname)
>   return "?";
>  }
>  
> +static void print_survey(const struct iwinfo_ops *iw, const char *ifname)
> +{
> + struct iwinfo_survey_entry entry;
> + iw->survey(ifname, &entry);
> + printf("%s\tESSID:\t\t\t\t%s\n", ifname, print_ssid(iw, ifname));
> + printf("\tChannel:\t\t\t%s (%s)\n", print_channel(iw, ifname), 
> format_frequency(entry.frequency));
> + printf("\tNoise:\t\t\t\t%s\n", format_noise(entry.noise));
> + printf("\tchannel Active Time:\t\t%s\n", 
> format_channel_time(entry.channel_time));
> + printf("\tChannel Busy 
> Time:\t\t%s\n",format_channel_time(entry.channel_time_busy));
> + printf("\tExtension Channel Busy 
> Time:\t%s\n",format_channel_time(entry.channel_time_ext_busy));
> + printf("\tChannel Receive 
> Time:\t\t%s\n",format_channel_time(entry.channel_time_rx));
> + printf("\tChannel Transmit 
> Time:\t\t%s\n",format_channel_time(entry.channel_time_tx));
> +}
>  
>  static void print_info(const struct iwinfo_ops *iw, const char *ifname)
>  {
> @@ -805,6 +830,7 @@ int main(int argc, char **argv)
>   "Usage:\n"
>   "   iwinfo  info\n"
>   "   iwinfo  scan\n"
> + "   iwinfo  survey\n"
>   "   iwinfo  txpowerlist\n"
>   "   iwinfo  freqlist\n"
>   "   iwinfo  assoclist\n"
> @@ -883,7 +909,10 @@ int main(int argc, char **argv)
>   break;
>  
>   case 's':
> - print_scanlist(iw, argv[1]);
> + if(argv[i][1] == 'c')
> + print_scanlist(iw, argv[1]);
> + else
> + print_survey(iw, argv[1]);
>   break;
>  
>   case 't':
> diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
> index ecd2d6a..2c741a3 100644
> --- a/iwinfo_nl80211.c
> +++ b/iwinfo_nl80211.c
> @@ -1357,6 +1357,63 @@ static int nl80211_get_signal(const char *ifname, int 
> *buf)
>   return -1;
>  }
>  
> +static int nl80211_get_channel_survey_cb(struct nl_msg *msg, void *arg)
> +{
> + struct iwinfo_survey_entry *entry = arg;
> + struct nlattr *tb[NL80211_ATTR_MAX + 1];
> + struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
> + struct nlattr *si[NL80211_SURVEY_INFO_MAX + 1];
> +
> + static struct nla_policy sp[NL80211_SURVEY_INFO_MAX + 1] = {
> + [NL80211_SURVEY_INFO_FREQUENCY] = { .type = NLA_U32 },
> + [NL80211_SURVEY_INFO_NOISE] = { .type = NLA_U8  },
> + };
> +
> + nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
> +   genlmsg_attrlen(gnlh, 0), NULL);
> +
> + if (!tb[NL80211_ATTR_SURVEY_INFO])
> + return NL_SKI