Re: OpenWrt Summit 2024 & Battlemesh v16 Announcement

2024-04-11 Thread David Bauer 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.--- Begin Message ---

Hi John,

can you share which identifier was assigned for OpenWrt? I don't see it in the 
list of the
IEEE yet.

Best
David

On 4/10/24 21:10, John Crispin wrote:

Hi


We will auction off one or two OpenWrt One.


The first 15 EVT samples have been tested, and a new production run of 100 DVT 
samples will start shortly. these 100 samples will have OpenWrt OUI macs and 
calibration data. the winners of the auction will receive samples via express 
courier ;) @Arınç: thanks for organizing this.

     John


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


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


Re: [VOTE] New member proposal: Robimarko (Robert Marko)

2024-02-05 Thread David Bauer

Yes please.

 - David

On 1/30/24 19:15, Christian Marangi (Ansuel) wrote:

Robert is active in OpenWrt since 2017 and with some recent stats, he
has more than 310 commits merged in OpenWrt.
He also have uncounted Reviewed-by tag on various PR and merged commits
and generally helps in everything related to IPQ (ipq806x, ipq40xx and
ipq807x) and some mvebu targets.

He did the conversion of ipq40xx target to DSA and made possible the
introduction of the ipq807x target by sorting all the QSDK downstream
patch and pushing them upstream.

With his help, also the ipq60xx is very close on getting merged and
actually used permitting support of even more device for OpenWrt.

Also he is almost always reachable on IRC openwrt-devel and never had
a problem in coordinating and collaborating with him.

I think Robert is a good addition to our team and would massively help
me (Ansuel) in maintaining each IPQ target and review all the related
PR on github and patchwork.
I would like to add Robert to the OpenWrt committers team.

The vote shall be concluded within 14 days. (13/02/2024)

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


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


Re: Future of the broadcom-wl package?

2024-01-26 Thread David Bauer

Hi Felix,

On 1/26/24 18:45, Felix Fietkau wrote:

Hi,

does anybody still care about the broadcom-wl package in OpenWrt?
I think it would be nice if we could get rid of it, along with the code support 
and abstraction for different wireless drivers.
It would also allow us to rewrite iwinfo in ucode with nl80211 as the only 
supported API, which helps keep things simple.

Would anybody be opposed to declaring 23.05 to be the last release to support 
broadcom-wl?


+1 - Fine with me

Best
David



- Felix

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


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


Re: OpenWrt One - celebrating 20 years of OpenWrt

2024-01-17 Thread David Bauer

Hi John,

On 1/9/24 11:49, John Crispin wrote:

FAQ

* Why are there are 2 different flash chips?
- the idea is to make the device (almost!) unbrickable and very easy to recover
- NAND will hold the main loader (U-Boot) and the Linux image and will be the 
default boot device
- NOR will be write-protected by default (with WP jumper available on the 
board) and will hold a recovery bootloader (and other essential data, like 
Wi-Fi calibration)
- a dedicated boot select switch will allow changing between NOR and NAND


No Idea how MTK factory calibration data is individual per-device.

If it's possible, I'd like to propose a archive of the radio-calibration / 
MAC-Address partition.

So this would be used to enable people download their calibration data for 
their serial-number and
make it "unbrickable" with an SPI clamp.

What do you think?

Best
David

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


Re: Adding a new x86 image or related packages to the default x86 image

2023-11-14 Thread David Bauer

Hi Daniel,
Hi Petr,

On 11/13/23 21:49, Daniel Golle wrote:

On Mon, Nov 13, 2023 at 07:54:34PM +, Petr Štetiar wrote:

Paul Spooren  [2023-11-13 13:30:10]:

Hi,


How about we follow the approach of Alpine Linux[1] and offer a standard, an 
extended and a virtual firmware for the x86/64 target?


FYI that pull request added 27 firmware ASIC blobs, thus increased x86/64
image from 10 MiB to 41 MiB, but actually just 1 firmware ASIC blob
mlxsw_spectrum-13.2010.1006.mfa2 (1.6MiB) is needed, so I would instead 
recommend to
fix that mlx firmware package and call it a day?


Thanks for pointing this out, increasing the default image by 1.6MiB is
bearable on x86 and that alone does not justify the introduction of
device specific images imho.


Sounds reasonable to me, regardless of how we want to
proceed with the x64 target in general.

Is there already a patch series / PR in the works?
Otherwise, I'd look into that.

Best
David



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


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


Re: [PATCH uqmi 3/3] wds: allow profile reconfiguration

2023-10-11 Thread David Bauer

Hi Henrik,

On 10/11/23 09:52, Henrik Ginstmark wrote:

Hi

I have a similar patch for APN profile commands,
https://patchwork.ozlabs.org/project/openwrt/patch/20220905200751.998416-1-hen...@ginstmark.se/

I included commands for
--get-default-profile-number
--get-profile-settings
--create-profile
--modify-profile


Your patch looks better, I'll strip patch 3 from my series and instead
apply yours.

Best
David



/Henrik


Den tis 10 okt. 2023 kl 16:07 skrev David Bauer :


Extend uqmi so it can modify connection profiles stored on the modem.

This is required in case the operator disallows connections using the
dual-stacked PDP type. In case of either the home or visited network
disallowing dual-stacked connections, the PDP context establishment
fails with the default settings.

This can be worked around by configuring the APN and PDP type to profile
slot 1 and subsequently enabling the data connection.

Signed-off-by: David Bauer 
---
  commands-wds.c | 96 ++
  commands-wds.h |  9 +
  2 files changed, 105 insertions(+)

diff --git a/commands-wds.c b/commands-wds.c
index 3aecefd..b72dcc7 100644
--- a/commands-wds.c
+++ b/commands-wds.c
@@ -30,11 +30,30 @@ static struct qmi_wds_start_network_request wds_sn_req = {
  };
  static struct qmi_wds_stop_network_request wds_stn_req;

+struct uqmi_profile_modify_req {
+   int idx;
+
+   char *apn_name;
+   char *username;
+   char *password;
+
+   struct {
+   QmiWdsPdpType val;
+   bool set;
+   } pdp_type;
+
+   struct {
+   QmiWdsAuthentication val;
+   bool set;
+   } auth;
+} prf_mdf_req;
+
  #define cmd_wds_set_apn_cb no_cb
  static enum qmi_cmd_result
  cmd_wds_set_apn_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg, char *arg)
  {
 qmi_set_ptr(_sn_req, apn, arg);
+   prf_mdf_req.apn_name = arg;
 return QMI_CMD_DONE;
  }

@@ -58,6 +77,9 @@ cmd_wds_set_auth_prepare(struct qmi_dev *qmi, struct 
qmi_request *req, struct qm
 continue;

 qmi_set(_sn_req, authentication_preference, modes[i].auth);
+
+   prf_mdf_req.auth.set = true;
+   prf_mdf_req.auth.val = modes[i].auth;
 return QMI_CMD_DONE;
 }

@@ -70,6 +92,7 @@ static enum qmi_cmd_result
  cmd_wds_set_username_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
  {
 qmi_set_ptr(_sn_req, username, arg);
+   prf_mdf_req.username = arg;
 return QMI_CMD_DONE;
  }

@@ -78,9 +101,37 @@ static enum qmi_cmd_result
  cmd_wds_set_password_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
  {
 qmi_set_ptr(_sn_req, password, arg);
+   prf_mdf_req.password = arg;
 return QMI_CMD_DONE;
  }

+#define cmd_wds_set_pdp_type_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_pdp_type_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
+{
+   static const struct {
+   const char *name;
+   const QmiWdsPdpType mode;
+   } modes[] = {
+   { "ipv4", QMI_WDS_PDP_TYPE_IPV4 },
+   { "ipv6", QMI_WDS_PDP_TYPE_IPV6 },
+   { "ipv4v6", QMI_WDS_PDP_TYPE_IPV4_OR_IPV6 },
+   };
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(modes); i++) {
+   if (strcasecmp(modes[i].name, arg) != 0)
+   continue;
+
+   prf_mdf_req.pdp_type.val = modes[i].mode;
+   prf_mdf_req.pdp_type.set = true;
+   return QMI_CMD_DONE;
+   }
+
+   uqmi_add_error("Invalid value (valid: ipv4, ipv6, ipv4v6)");
+   return QMI_CMD_EXIT;
+}
+
  #define cmd_wds_set_autoconnect_cb no_cb
  static enum qmi_cmd_result
  cmd_wds_set_autoconnect_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
@@ -123,9 +174,54 @@ cmd_wds_set_profile_prepare(struct qmi_dev *qmi, struct 
qmi_request *req, struct
 uint32_t idx = strtoul(arg, NULL, 10);

 qmi_set(_sn_req, profile_index_3gpp, idx);
+   prf_mdf_req.idx = idx;
 return QMI_CMD_DONE;
  }

+static void
+cmd_wds_modify_profile_cb(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg)
+{
+   struct qmi_wds_modify_profile_response res;
+
+   qmi_parse_wds_modify_profile_response(msg, );
+   if (res.set.extended_error_code)
+   blobmsg_add_u32(, NULL, res.data.extended_error_code);
+}
+
+static enum qmi_cmd_result
+cmd_wds_modify_profile_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
+{
+   struct qmi_wds_modify_profile_request wds_mdf_prf_req = {
+   QMI_INIT_SEQUENCE(profile_identifier,
+   .profile_type = QMI_WDS_PROFILE_TYPE_3GPP,
+

[PATCH uqmi 3/3] wds: allow profile reconfiguration

2023-10-10 Thread David Bauer
Extend uqmi so it can modify connection profiles stored on the modem.

This is required in case the operator disallows connections using the
dual-stacked PDP type. In case of either the home or visited network
disallowing dual-stacked connections, the PDP context establishment
fails with the default settings.

This can be worked around by configuring the APN and PDP type to profile
slot 1 and subsequently enabling the data connection.

Signed-off-by: David Bauer 
---
 commands-wds.c | 96 ++
 commands-wds.h |  9 +
 2 files changed, 105 insertions(+)

diff --git a/commands-wds.c b/commands-wds.c
index 3aecefd..b72dcc7 100644
--- a/commands-wds.c
+++ b/commands-wds.c
@@ -30,11 +30,30 @@ static struct qmi_wds_start_network_request wds_sn_req = {
 };
 static struct qmi_wds_stop_network_request wds_stn_req;
 
+struct uqmi_profile_modify_req {
+   int idx;
+
+   char *apn_name;
+   char *username;
+   char *password;
+
+   struct {
+   QmiWdsPdpType val;
+   bool set;
+   } pdp_type;
+
+   struct {
+   QmiWdsAuthentication val;
+   bool set;
+   } auth;
+} prf_mdf_req;
+
 #define cmd_wds_set_apn_cb no_cb
 static enum qmi_cmd_result
 cmd_wds_set_apn_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg, char *arg)
 {
qmi_set_ptr(_sn_req, apn, arg);
+   prf_mdf_req.apn_name = arg;
return QMI_CMD_DONE;
 }
 
@@ -58,6 +77,9 @@ cmd_wds_set_auth_prepare(struct qmi_dev *qmi, struct 
qmi_request *req, struct qm
continue;
 
qmi_set(_sn_req, authentication_preference, modes[i].auth);
+
+   prf_mdf_req.auth.set = true;
+   prf_mdf_req.auth.val = modes[i].auth;
return QMI_CMD_DONE;
}
 
@@ -70,6 +92,7 @@ static enum qmi_cmd_result
 cmd_wds_set_username_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
 {
qmi_set_ptr(_sn_req, username, arg);
+   prf_mdf_req.username = arg;
return QMI_CMD_DONE;
 }
 
@@ -78,9 +101,37 @@ static enum qmi_cmd_result
 cmd_wds_set_password_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
 {
qmi_set_ptr(_sn_req, password, arg);
+   prf_mdf_req.password = arg;
return QMI_CMD_DONE;
 }
 
+#define cmd_wds_set_pdp_type_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_pdp_type_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
+{
+   static const struct {
+   const char *name;
+   const QmiWdsPdpType mode;
+   } modes[] = {
+   { "ipv4", QMI_WDS_PDP_TYPE_IPV4 },
+   { "ipv6", QMI_WDS_PDP_TYPE_IPV6 },
+   { "ipv4v6", QMI_WDS_PDP_TYPE_IPV4_OR_IPV6 },
+   };
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(modes); i++) {
+   if (strcasecmp(modes[i].name, arg) != 0)
+   continue;
+
+   prf_mdf_req.pdp_type.val = modes[i].mode;
+   prf_mdf_req.pdp_type.set = true;
+   return QMI_CMD_DONE;
+   }
+
+   uqmi_add_error("Invalid value (valid: ipv4, ipv6, ipv4v6)");
+   return QMI_CMD_EXIT;
+}
+
 #define cmd_wds_set_autoconnect_cb no_cb
 static enum qmi_cmd_result
 cmd_wds_set_autoconnect_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
@@ -123,9 +174,54 @@ cmd_wds_set_profile_prepare(struct qmi_dev *qmi, struct 
qmi_request *req, struct
uint32_t idx = strtoul(arg, NULL, 10);
 
qmi_set(_sn_req, profile_index_3gpp, idx);
+   prf_mdf_req.idx = idx;
return QMI_CMD_DONE;
 }
 
+static void
+cmd_wds_modify_profile_cb(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg)
+{
+   struct qmi_wds_modify_profile_response res;
+
+   qmi_parse_wds_modify_profile_response(msg, );
+   if (res.set.extended_error_code)
+   blobmsg_add_u32(, NULL, res.data.extended_error_code);
+}
+
+static enum qmi_cmd_result
+cmd_wds_modify_profile_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
+{
+   struct qmi_wds_modify_profile_request wds_mdf_prf_req = {
+   QMI_INIT_SEQUENCE(profile_identifier,
+   .profile_type = QMI_WDS_PROFILE_TYPE_3GPP,
+   .profile_index = prf_mdf_req.idx,
+   ),
+   };
+
+   if (!prf_mdf_req.idx) {
+   uqmi_add_error("Profile needs to be specified");
+   return QMI_CMD_EXIT;
+   }
+
+   if (prf_mdf_req.apn_name)
+   qmi_set_ptr(_mdf_prf_req, apn_name, prf_mdf_req.apn_name);
+
+   if (prf_mdf_req.username)
+   qmi_set_ptr(_mdf_prf_req, username, prf_mdf_req.username);
+
+   if (prf_mdf_req.password)
+   qmi

[PATCH uqmi 2/3] uim: support SIM card power-up/down

2023-10-10 Thread David Bauer
Support the power-up and power-down commands for the modem's SIM card.
This allows to reset the SIM card and recover it from an illegal card
application state.

Signed-off-by: David Bauer 
---
 commands-uim.c | 52 ++
 commands-uim.h |  9 -
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/commands-uim.c b/commands-uim.c
index 68803b4..ff01d7b 100644
--- a/commands-uim.c
+++ b/commands-uim.c
@@ -19,6 +19,8 @@
  * Boston, MA 02110-1301 USA.
  */
 
+static int uim_slot = 0;
+
 #define cmd_uim_verify_pin1_cb no_cb
 static enum qmi_cmd_result
 cmd_uim_verify_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, 
struct qmi_msg *msg, char *arg)
@@ -130,3 +132,53 @@ cmd_uim_get_sim_state_prepare(struct qmi_dev *qmi, struct 
qmi_request *req, stru
qmi_set_uim_get_card_status_request(msg);
return QMI_CMD_REQUEST;
 }
+
+#define cmd_uim_slot_cb no_cb
+static enum qmi_cmd_result
+cmd_uim_slot_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg, char *arg)
+{
+   char *err;
+   int value = strtoul(arg, , 10);
+   if ((err && *err) || value < 1 || value > 2) {
+   uqmi_add_error("Invalid UIM-Slot value. Allowed: [1,2]");
+   return QMI_CMD_EXIT;
+   }
+
+   uim_slot = value;
+
+   return QMI_CMD_DONE;
+}
+
+#define cmd_uim_power_off_cb no_cb
+static enum qmi_cmd_result
+cmd_uim_power_off_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg, char *arg)
+{
+   struct qmi_uim_power_off_sim_request data = {
+   QMI_INIT(slot, uim_slot)
+   };
+
+   if (!uim_slot) {
+   uqmi_add_error("UIM-Slot not set. Use --uim-slot  to set 
it.");
+   return QMI_CMD_EXIT;
+   }
+
+   qmi_set_uim_power_off_sim_request(msg, );
+   return QMI_CMD_REQUEST;
+}
+
+#define cmd_uim_power_on_cb no_cb
+static enum qmi_cmd_result
+cmd_uim_power_on_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct 
qmi_msg *msg, char *arg)
+{
+   struct qmi_uim_power_on_sim_request data = {
+   QMI_INIT(slot, uim_slot)
+   };
+
+   if (!uim_slot) {
+   uqmi_add_error("UIM-Slot not set. Use --uim-slot  to set 
it.");
+   return QMI_CMD_EXIT;
+   }
+
+   qmi_set_uim_power_on_sim_request(msg, );
+   return QMI_CMD_REQUEST;
+}
diff --git a/commands-uim.h b/commands-uim.h
index 02a49b1..191f09c 100644
--- a/commands-uim.h
+++ b/commands-uim.h
@@ -20,13 +20,20 @@
  */
 
 #define __uqmi_uim_commands
\
+   __uqmi_command(uim_slot, uim-slot, required, CMD_TYPE_OPTION), \
__uqmi_command(uim_verify_pin1, uim-verify-pin1, required, 
QMI_SERVICE_UIM), \
__uqmi_command(uim_verify_pin2, uim-verify-pin2, required, 
QMI_SERVICE_UIM), \
-   __uqmi_command(uim_get_sim_state, uim-get-sim-state, no, 
QMI_SERVICE_UIM) \
+   __uqmi_command(uim_get_sim_state, uim-get-sim-state, no, 
QMI_SERVICE_UIM), \
+   __uqmi_command(uim_power_off, uim-power-off, no, QMI_SERVICE_UIM), \
+   __uqmi_command(uim_power_on, uim-power-on, no, QMI_SERVICE_UIM) \
 
 
 #define uim_helptext \
"  --uim-verify-pin1 :  Verify PIN1 (new 
devices)\n" \
"  --uim-verify-pin2 :  Verify PIN2 (new 
devices)\n" \
"  --uim-get-sim-state:  Get current SIM 
state\n" \
+   "  --uim-power-off:  Power off SIM card\n" \
+   "--uim-slot: SIM slot [1-2]\n" \
+   "  --uim-power-on:   Power on SIM card\n" \
+   "--uim-slot: SIM slot [1-2]\n" \
 
-- 
2.42.0


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


[PATCH uqmi 1/3] uim: add application state to SIM status

2023-10-10 Thread David Bauer
Parse the card application state and report it to the SIM card status
output object.

This is required to detect a card application which is in the failed
(illegal) state.

Signed-off-by: David Bauer 
---
 commands-uim.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/commands-uim.c b/commands-uim.c
index 3bd8a74..68803b4 100644
--- a/commands-uim.c
+++ b/commands-uim.c
@@ -59,6 +59,16 @@ static void cmd_uim_get_sim_state_cb(struct qmi_dev *qmi, 
struct qmi_request *re
 {
struct qmi_uim_get_card_status_response res;
void * const card_table = blobmsg_open_table(, NULL);
+   static const char *card_application_states[] = {
+   [QMI_UIM_CARD_APPLICATION_STATE_UNKNOWN] = "unknown",
+   [QMI_UIM_CARD_APPLICATION_STATE_DETECTED] = "detected",
+   [QMI_UIM_CARD_APPLICATION_STATE_PIN1_OR_UPIN_PIN_REQUIRED] = 
"pin-required",
+   [QMI_UIM_CARD_APPLICATION_STATE_PUK1_OR_UPIN_PUK_REQUIRED] = 
"puk-required",
+   [QMI_UIM_CARD_APPLICATION_STATE_CHECK_PERSONALIZATION_STATE] = 
"check-personalization-state",
+   [QMI_UIM_CARD_APPLICATION_STATE_PIN1_BLOCKED] = "pin1-blocked",
+   [QMI_UIM_CARD_APPLICATION_STATE_ILLEGAL] = "illegal",
+   [QMI_UIM_CARD_APPLICATION_STATE_READY] = "ready",
+   };
 
qmi_parse_uim_get_card_status_response(msg, );
 
@@ -66,6 +76,7 @@ static void cmd_uim_get_sim_state_cb(struct qmi_dev *qmi, 
struct qmi_request *re
if (res.data.card_status.cards[i].card_state != 
QMI_UIM_CARD_STATE_PRESENT)
continue;
 
+   uint8_t card_application_state;
uint8_t pin1_state = res.data.card_status.cards[i].upin_state;
uint8_t pin1_retries = 
res.data.card_status.cards[i].upin_retries;
uint8_t puk1_retries = 
res.data.card_status.cards[i].upuk_retries;
@@ -78,6 +89,8 @@ static void cmd_uim_get_sim_state_cb(struct qmi_dev *qmi, 
struct qmi_request *re
if (res.data.card_status.cards[i].applications[j].type 
== QMI_UIM_CARD_APPLICATION_TYPE_UNKNOWN)
continue;
 
+   card_application_state = pin1_state = 
res.data.card_status.cards[i].applications[j].state;
+
if 
(!res.data.card_status.cards[i].applications[j].upin_replaces_pin1) {
pin1_state = 
res.data.card_status.cards[i].applications[j].pin1_state;
pin1_retries = 
res.data.card_status.cards[i].applications[j].pin1_retries;
@@ -92,6 +105,10 @@ static void cmd_uim_get_sim_state_cb(struct qmi_dev *qmi, 
struct qmi_request *re
break; /* handle first application only for now */
}
 
+   if (card_application_state > 
QMI_UIM_CARD_APPLICATION_STATE_READY)
+   card_application_state = 
QMI_UIM_CARD_APPLICATION_STATE_UNKNOWN;
+
+   blobmsg_add_string(, "card_application_state", 
card_application_states[card_application_state]);
blobmsg_add_string(, "pin1_status", 
get_pin_status(pin1_state));
blobmsg_add_u32(, "pin1_verify_tries", pin1_retries);
blobmsg_add_u32(, "pin1_unlock_tries", puk1_retries);
-- 
2.42.0


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


Re: [PATCH] mac80211: always use mac80211 loss detection

2023-06-23 Thread David Bauer

Hi Felix,

On 6/23/23 12:47, Felix Fietkau wrote:

On 23.06.23 12:29, David Bauer wrote:

Hi Felix,

On 6/23/23 08:55, Felix Fietkau wrote:

On 18.05.23 11:19, David Bauer wrote:

ath10k does not report excessive loss in case of broken block-ack
sessions. The loss is communicated to the host-os, but ath10k does not
trigger a low-ack events by itself.

The mac80211 framework for loss detection however detects this
circumstance well in case of ath10k. So use it regardless of ath10k's
own loss detection mechanism.

Signed-off-by: David Bauer 


Please make a patch for ath10k instead of turning the flag into a no-op in 
mac80211.


The rationale for removal was in fact to avoid patching ath1xk separately, 
given these
are the only drivers using this flag.

I'm aware this is not the nicest approach, do you have any insight if there's a 
downside
to always keeping mac80211 loss detection active?

I however still respect the preferation of keeping this limited to specific 
drivers, I'm
just interested if there's a deeper rationale / problem i did not spot :)

Just to outline the issue this is trying to avoid - Intel clients started 
dropping their
BA sessions sometimes in late 2020 without notifying the AP. The ath10k 
firmware keeps
retransmitting exclusive to the device at the lowest rate while not indicating 
a low-ack
situation to the host-os, avoiding station kickout. This results in very low 
throughput
for all connected stations (aql enabled) up to DoS of the AP (aql disabled).


My rationale is this: changes to the driver dropping that flag can be 
upstreamed, because your description implies that it fixes a real bug.
A mac80211 patch turning the flag into an no-op will be rejected, since it 
doesn't make any sense to keep the flag around.


Thanks, I haven't looked at it this way. I will update the patch to account for 
this.


If it turns out that all ath drivers can't use this flag because of the issue 
you're describing, we can remove it upstream from mac80211 entirely instead of 
turning it into a dummy no-op.


I was not at the point of upstreaming, as from reading the code the root-cause 
is within
the firmware not reporting low-ack situation. So this requires to be evaluated 
with all
existing platform-firmware in mind.

As a sidenote - the issue I'm describing also exists with QCAs own driver, 
however the
ramifications there greatly differ from vendor to vendor.

Best
David



- Felix

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


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


Re: [PATCH] mac80211: always use mac80211 loss detection

2023-06-23 Thread David Bauer

Hi Felix,

On 6/23/23 08:55, Felix Fietkau wrote:

On 18.05.23 11:19, David Bauer wrote:

ath10k does not report excessive loss in case of broken block-ack
sessions. The loss is communicated to the host-os, but ath10k does not
trigger a low-ack events by itself.

The mac80211 framework for loss detection however detects this
circumstance well in case of ath10k. So use it regardless of ath10k's
own loss detection mechanism.

Signed-off-by: David Bauer 


Please make a patch for ath10k instead of turning the flag into a no-op in 
mac80211.


The rationale for removal was in fact to avoid patching ath1xk separately, 
given these
are the only drivers using this flag.

I'm aware this is not the nicest approach, do you have any insight if there's a 
downside
to always keeping mac80211 loss detection active?

I however still respect the preferation of keeping this limited to specific 
drivers, I'm
just interested if there's a deeper rationale / problem i did not spot :)

Just to outline the issue this is trying to avoid - Intel clients started 
dropping their
BA sessions sometimes in late 2020 without notifying the AP. The ath10k 
firmware keeps
retransmitting exclusive to the device at the lowest rate while not indicating 
a low-ack
situation to the host-os, avoiding station kickout. This results in very low 
throughput
for all connected stations (aql enabled) up to DoS of the AP (aql disabled).

Best
David



- Felix


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


[PATCH] mac80211: always use mac80211 loss detection

2023-05-18 Thread David Bauer
ath10k does not report excessive loss in case of broken block-ack
sessions. The loss is communicated to the host-os, but ath10k does not
trigger a low-ack events by itself.

The mac80211 framework for loss detection however detects this
circumstance well in case of ath10k. So use it regardless of ath10k's
own loss detection mechanism.

Signed-off-by: David Bauer 
---
 ...1-always-use-mac80211-loss-detection.patch | 33 +++
 1 file changed, 33 insertions(+)
 create mode 100644 
package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch

diff --git 
a/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch
 
b/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch
new file mode 100644
index 00..1e3a41c302
--- /dev/null
+++ 
b/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch
@@ -0,0 +1,33 @@
+From cdf461888f900c3a149b10a04d72b4a590ecdec3 Mon Sep 17 00:00:00 2001
+From: David Bauer 
+Date: Tue, 16 May 2023 23:11:32 +0200
+Subject: [PATCH] mac80211: always use mac80211 loss detection
+
+ath10k does not report excessive loss in case of broken block-ack
+sessions. The loss is communicated to the host-os, but ath10k does not
+trigger a low-ack events by itself.
+
+The mac80211 framework for loss detection however detects this
+circumstance well in case of ath10k. So use it regardless of ath10k's
+own loss detection mechanism.
+
+Signed-off-by: David Bauer 
+---
+ net/mac80211/status.c | 6 --
+ 1 file changed, 6 deletions(-)
+
+--- a/net/mac80211/status.c
 b/net/mac80211/status.c
+@@ -794,12 +794,6 @@ static void ieee80211_lost_packet(struct
+   unsigned long pkt_time = STA_LOST_PKT_TIME;
+   unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD;
+ 
+-  /* If driver relies on its own algorithm for station kickout, skip
+-   * mac80211 packet loss mechanism.
+-   */
+-  if (ieee80211_hw_check(>local->hw, REPORTS_LOW_ACK))
+-  return;
+-
+   /* This packet was aggregated but doesn't carry status info */
+   if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
+   !(info->flags & IEEE80211_TX_STAT_AMPDU))
-- 
2.39.2


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


Re: [PATCH] ipq40xx: convert Extreme AP3915i to DSA

2023-01-17 Thread David Bauer

Hi James,

thanks for the patch. I will apply it to my staging tree and test it on my unit.

One small remark (I will change when applying to the tree)

On 1/17/23 08:02, tr...@ucc.asn.au wrote:

+ {
+   status = "okay";
+
+   label = "lan1";
+};
+


Should be lan without the index.

Best
David

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


Re: [PATCH v2] ramips: add support for D-Link DAP-X1860 A1

2023-01-07 Thread David Bauer

Hi Sebastian,

On 1/7/23 12:56, Sebastian Schaper wrote:
[...]

+_default {
+   gpio {
+   groups = "uart2";
+   function = "gpio";
+   };
+};
diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index dd49583bf4..6492748aed 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -479,6 +479,27 @@ define Device/cudy_x6
  endef
  TARGET_DEVICES += cudy_x6
  
+define Device/dlink_dap-x1860-a1

+  $(Device/dsa-migration)
+  IMAGE_SIZE := 53248k
+  DEVICE_VENDOR := D-Link
+  DEVICE_MODEL := DAP-X1860
+  DEVICE_VARIANT := A1
+  UBINIZE_OPTS := -E 5
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  KERNEL_SIZE := 4096k


Considering we have 50 MB of firmware space available, enlarging the
space allocated for the kernel to 8M has the potential of avoiding pain
down the line if the kernel exceeds 4M in size.

Best
David

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


[PATCH 2/3] ramips: combine USW-Flex dual firmware-partitions

2022-12-26 Thread David Bauer
In order to maximize the available space on USW-Flex boards using a
dual-image partition layout, combine the two OS partitions into a single
partition.

This allows users to access more usable space for additional packages.

Don't limit the usable image size to the size of a single OS partition.
The initial installation has to be done with an older version of OpenWrt
in case the generated image exceeds the space of a single kernel
partition in the future.

Signed-off-by: David Bauer 
---
 target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts | 8 ++--
 target/linux/ramips/image/mt7621.mk  | 2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts 
b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts
index e148242387..ff328bd858 100644
--- a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts
+++ b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts
@@ -164,14 +164,10 @@
};
 
partition@1a {
+   /* Combine kernel0 / kernel1 */
compatible = "denx,fit";
label = "firmware";
-   reg = <0x1a 0x73>;
-   };
-
-   partition@8d {
-   label = "kernel1";
-   reg = <0x8d 0x73>;
+   reg = <0x1a 0xe6>;
};
};
};
diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index 75022f9708..36f39ece0a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -2101,7 +2101,7 @@ define Device/ubnt_usw-flex
   DEVICE_DTS_CONFIG := config@1
   DEVICE_DTS_LOADADDR := 0x8700
   KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword 
$$(DEVICE_DTS)).dtb
-  IMAGE_SIZE := 7360k
+  IMAGE_SIZE := 14720k
 endef
 TARGET_DEVICES += ubnt_usw-flex
 
-- 
2.35.1


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


[PATCH 3/3] ath79: combine UniFi AC dual firmware-partitions

2022-12-26 Thread David Bauer
In order to maximize the available space on UniFi AC boards using a
dual-image partition layout, combine the two OS partitions into a single
partition.

This allows users to access more usable space for additional packages.

Don't limit the usable image size to the size of a single OS partition.
The initial installation has to be done with an older version of OpenWrt
in case the generated image exceeds the space of a single kernel
partition in the future.

Signed-off-by: David Bauer 
---
 target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi | 9 ++---
 target/linux/ath79/image/generic-ubnt.mk | 2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi 
b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi
index 2e407c3486..6704ec983b 100644
--- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi
+++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi
@@ -69,17 +69,12 @@
};
 
partition@7 {
+   /* Combine kernel0 & kernel1 */
label = "firmware";
-   reg = <0x07 0x79>;
+   reg = <0x07 0xf2>;
compatible = "denx,uimage";
};
 
-   partition@80 {
-   label = "kernel1";
-   reg = <0x80 0x79>;
-   read-only;
-   };
-
partition@f9 {
label = "bs";
reg = <0xf9 0x02>;
diff --git a/target/linux/ath79/image/generic-ubnt.mk 
b/target/linux/ath79/image/generic-ubnt.mk
index bed043c3a7..8eeaa8de3e 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -229,7 +229,7 @@ TARGET_DEVICES += ubnt_unifi-ap-lr
 define Device/ubnt_unifiac
   DEVICE_VENDOR := Ubiquiti
   SOC := qca9563
-  IMAGE_SIZE := 7744k
+  IMAGE_SIZE := 15488k
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
 endef
 
-- 
2.35.1


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


[PATCH 1/3] ath79: combine OCEDO dual firmware-partitions

2022-12-26 Thread David Bauer
In order to maximize the available space on OCEDO boards using a
dual-image partition layout, combine the two OS partitions into a single
partition.

This allows users to access more usable space for additional packages.

Don't limit the usable image size to the size of a single OS partition.
The initial installation has to be done with an older version of OpenWrt
in case the generated image exceeds the space of a single OS
partition in the future.

Signed-off-by: David Bauer 
---
 target/linux/ath79/dts/ar9344_ocedo_raccoon.dts | 9 ++---
 target/linux/ath79/dts/qca9558_ocedo_koala.dts  | 9 ++---
 target/linux/ath79/dts/qca9558_ocedo_ursus.dts  | 9 ++---
 target/linux/ath79/image/generic.mk | 6 +++---
 4 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts 
b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
index 8678315a44..11205413f4 100644
--- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
+++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
@@ -91,15 +91,10 @@
};
 
partition@5 {
+   /* Dual-Flash layout combined */
compatible = "denx,uimage";
label = "firmware";
-   reg = <0x05 0x74>;
-   };
-
-   partition@79 {
-   label = "vendor";
-   reg = <0x79 0x74>;
-   read-only;
+   reg = <0x05 0xe8>;
};
 
partition@ed {
diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts 
b/target/linux/ath79/dts/qca9558_ocedo_koala.dts
index 8441e5c9a3..85fd43699e 100644
--- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts
+++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts
@@ -84,15 +84,10 @@
};
 
partition@5 {
+   /* Dual-Flash layout combined */
compatible = "denx,uimage";
label = "firmware";
-   reg = <0x05 0x74>;
-   };
-
-   partition@79 {
-   label = "vendor";
-   reg = <0x79 0x74>;
-   read-only;
+   reg = <0x05 0xe8>;
};
 
partition@ed {
diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts 
b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
index e99059df04..be958d19a0 100644
--- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
+++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
@@ -55,15 +55,10 @@
};
 
partition@5 {
+   /* Dual-Flash layout combined */
compatible = "denx,uimage";
label = "firmware";
-   reg = <0x05 0x74>;
-   };
-
-   partition@79 {
-   label = "vendor";
-   reg = <0x79 0x74>;
-   read-only;
+   reg = <0x05 0xe8>;
};
 
partition@ed {
diff --git a/target/linux/ath79/image/generic.mk 
b/target/linux/ath79/image/generic.mk
index b2e1d70403..7b237b0b6c 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1884,7 +1884,7 @@ define Device/ocedo_koala
   DEVICE_MODEL := Koala
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
   SUPPORTED_DEVICES += koala
-  IMAGE_SIZE := 7424k
+  IMAGE_SIZE := 14848k
 endef
 TARGET_DEVICES += ocedo_koala
 
@@ -1892,7 +1892,7 @@ define Device/ocedo_raccoon
   SOC := ar9344
   DEVICE_VENDOR := Ocedo
   DEVICE_MODEL := Raccoon
-  IMAGE_SIZE := 7424k
+  IMAGE_SIZE := 14848k
 endef
 TARGET_DEVICES += ocedo_raccoon
 
@@ -1901,7 +1901,7 @@ define Device/ocedo_ursus
   DEVICE_VENDOR := Ocedo
   DEVICE_MODEL := Ursus
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
-  IMAGE_SIZE := 7424k
+  IMAGE_SIZE := 14848k
 endef
 TARGET_DEVICES += ocedo_ursus
 
-- 
2.35.1


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


Re: [PATCH] sunxi: ensure NanoPi R1 has unique MAC address

2022-12-22 Thread David Bauer

Hi Jan-Niklas,

On 12/22/22 21:12, Jan-Niklas Burfeind wrote:

+generate_mac_from_mmc_cid()
+{
+   local mmc_dev=$1
+
+   local sd_hash=$(sha256sum/sys/class/block/$mmc_dev/device/cid)
+   local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 
2>/dev/null)")
+   echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
+}
+


rename this function to macaddr_generate_from_mmc_cid and add it to the 
base-files package.

Also change the other consumer from using its implementation to the shared one.

Best
David

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


Re: [PATCH] ramips: fix Unifi 6 Lite boot failure with v5.15 kernels

2022-11-07 Thread David Bauer

Hi Bjorn,

On 11/7/22 13:57, Bjørn Mork wrote:

Jonas Gorski  writes:

On Sun, 6 Nov 2022 at 12:50, Bjørn Mork  wrote:

Jonas Gorski  writes:


An option is also to set a load address for the dtb in the FIT image,
then U-Boot will relocate it before passing it to the kernel.


Yes, that is worth trying.  I thought this would be part of the fdt
relocation step, but I see that the "load" property is used before the
final relocation.

I'll test this when I have console again.  Or earlier if someone can
tell me how to calculate a semi-safe load address.  Will the kernel
$loadaddr + aligned(8, 32, 512. 4096?) kernelsize be ok?


You'll probably then have the chance to land in the .bss section,
which gets zeroed on boot.

Safest might be a static address like RAMSTART + 16MiB. This is what
e.g. DentOS does.

Not sure if 16 MiB is enough for ramdisk kernels.


Thanks.  Will try that, but considering the big question marks I think it
will have to wait until the next time I can use the console.


I have a patch for that prepared in my staging tree, I will re-test it on
my unit. My proposed "append DTB to kernel" worked, so we have a fallback
in case the DTB load-addr does not solve the issue.

David



It also doesn't relly sound like a much more robust solution in the end,
than simply forcing the fdt's to be aligned.  Still working on that.
Injecting some FDT_NOPs in mkimage looks promising.


And how do I figure out where in memory the fdt ended up, without seeing
the console output from u-boot?  Can't see anything obvious in dmesg or
in sysfs.  Do I need to enable a memory debug device, or is this address
directly available somewhere?


I don't think so, at least I don't see anything obvious.

So I guess you'll need to sprinkle some debug printks there (e.g.
fw_arg0 or argument passed to __dt_setup_arch()).


Ok, I guess I can do that.


Bjørn

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


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


Re: [PATCH] ramips: fix Unifi 6 Lite boot failure with v5.15 kernels

2022-11-05 Thread David Bauer

Hi Bjorn,

On 11/4/22 09:29, Bjørn Mork wrote:

You are right that the bootloader must be fixed.  But the vendor isn't
likely to do that as long as they run older kernels. I believe the
OpenWrt policy in such cases is to try to work around the issue.
Replacing the vendor bootloader is a last resort.  Please correct me if
I'm wrong.


I haven't tried this yet, but I think we should be able to boot a FIT
image configuration which only contains a kernel image. We could then simply
use the legacy append-DT like we do for legacy uImage ramips.

Not the nicest way, but considering we need it for the target anyways, i 
consider
this the simpler solution.

Note however, that this has to be at least also applied to the ZyXEL NWAxxx and 
(i assume)
all other FIT ramips boards.

Best
David




Bjørn

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


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


Re: [PATCH 2/4] hostapd: enable MBO if 802.11ax is enabled

2022-06-24 Thread David Bauer

Hi Stijn,

On 6/24/22 15:05, Stijn Tintel wrote:

On 23/06/2022 00:47, David Bauer wrote:

Hi Stijn,

On 6/21/22 15:36, Stijn Tintel wrote:

Multi Band Operation is required for 802.11ax certification, so let's
enable it if 802.11ax support is enabled.


I'd suggest we enable it for the -full build variants unconditionally.


Exclusively or on top of enabling it for 802.11ax devices?


On top.

Best
David



Thanks,
Stijn

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


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


Re: [PATCH 2/4] hostapd: enable MBO if 802.11ax is enabled

2022-06-22 Thread David Bauer

Hi Stijn,

On 6/21/22 15:36, Stijn Tintel wrote:

Multi Band Operation is required for 802.11ax certification, so let's
enable it if 802.11ax support is enabled.


I'd suggest we enable it for the -full build variants unconditionally.

Best
David



Signed-off-by: Stijn Tintel 
---
  package/network/services/hostapd/Config.in | 1 +
  1 file changed, 1 insertion(+)

diff --git a/package/network/services/hostapd/Config.in 
b/package/network/services/hostapd/Config.in
index 68a78359f6..3d3e578379 100644
--- a/package/network/services/hostapd/Config.in
+++ b/package/network/services/hostapd/Config.in
@@ -78,6 +78,7 @@ config DRIVER_11AC_SUPPORT
  config DRIVER_11AX_SUPPORT
bool
default n
+   select WPA_MBO_SUPPORT
  
  config WPA_ENABLE_WEP

bool "Enable support for unsecure and obsolete WEP"


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


[PATCH 3/3] hostapd: ubus: add bss-color to get_status

2022-06-06 Thread David Bauer
Add the current BSS color to hostapd get_status method. This field is
set to -1 in case BSS color is not active for the BSS.

Signed-off-by: David Bauer 
---
 package/network/services/hostapd/src/src/ap/ubus.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 8a963647cd..751b9f5588 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -445,6 +445,12 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_u32(, "channel", channel);
blobmsg_add_u32(, "op_class", op_class);
blobmsg_add_u32(, "beacon_interval", hapd->iconf->beacon_int);
+#ifdef CONFIG_IEEE80211AX
+   blobmsg_add_u32(, "bss-color", 
hapd->iface->conf->he_op.he_bss_color_disabled ? -1 :
+hapd->iface->conf->he_op.he_bss_color);
+#else
+   blobmsg_add_u32(, "bss-color", -1);
+#endif
 
snprintf(phy_name, 17, "%s", hapd->iface->phy);
blobmsg_add_string(, "phy", phy_name);
-- 
2.35.1


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


[PATCH 1/3] hostapd: update to 2022-05-08

2022-06-06 Thread David Bauer
Update hostapd to Git HEAD from 2022-05-08. This allows us to take
advantage of background radar-detection ad well as BSS color collision.

Suggested-by: Lorenzo Bianconi 
Signed-off-by: David Bauer 
---
 package/network/services/hostapd/Makefile |  6 +-
 .../hostapd/files/wpa_supplicant-p2p.config   |  2 +-
 .../patches/340-reload_freq_change.patch  |  3 +-
 .../patches/350-nl80211_del_beacon_bss.patch  | 32 ++
 .../patches/420-indicate-features.patch   | 33 +-
 ...750-qos_map_set_without_interworking.patch | 63 +++
 ..._AP-functions-dependant-on-CONFIG_AP.patch | 38 +++
 .../services/hostapd/src/src/ap/ubus.c|  3 +
 8 files changed, 94 insertions(+), 86 deletions(-)
 create mode 100644 
package/network/services/hostapd/patches/990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch

diff --git a/package/network/services/hostapd/Makefile 
b/package/network/services/hostapd/Makefile
index 584695786f..a4640f1197 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE)
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2022-01-16
-PKG_SOURCE_VERSION:=cff80b4f7d3c0a47c052e8187d671710f48939e4
-PKG_MIRROR_HASH:=712965bfa11a2e601d3e1c9a51a2cf3cffc6db89abafb3df3eb0cfd83c64705b
+PKG_SOURCE_DATE:=2022-05-08
+PKG_SOURCE_VERSION:=b859b9bceadccd882252ff0aa2fdba0d3b91764e
+PKG_MIRROR_HASH:=4655a747c197d7622b41865203d6601a080b9750fcd68073688cbb6076d13894
 
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_LICENSE:=BSD-3-Clause
diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config 
b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
index 48302bb4c3..0dcc88e648 100644
--- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config
+++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
@@ -622,4 +622,4 @@ CONFIG_UBUS=y
 # OpenWrt patch 380-disable-ctrl-iface-mib.patch
 # leads to the MIB only being compiled in if
 # CONFIG_CTRL_IFACE_MIB is enabled.
-#CONFIG_CTRL_IFACE_MIB=y
+CONFIG_CTRL_IFACE_MIB=y
diff --git 
a/package/network/services/hostapd/patches/340-reload_freq_change.patch 
b/package/network/services/hostapd/patches/340-reload_freq_change.patch
index 3d51a47a1e..89259f2f44 100644
--- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
+++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
@@ -1,6 +1,6 @@
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
-@@ -115,6 +115,28 @@ static void hostapd_reload_bss(struct ho
+@@ -115,6 +115,29 @@ static void hostapd_reload_bss(struct ho
  #endif /* CONFIG_NO_RADIUS */
  
ssid = >conf->ssid;
@@ -12,6 +12,7 @@
 +   hapd->iconf->ieee80211n,
 +   hapd->iconf->ieee80211ac,
 +   hapd->iconf->ieee80211ax,
++   hapd->iconf->ieee80211be,
 +   hapd->iconf->secondary_channel,
 +   hostapd_get_oper_chwidth(hapd->iconf),
 +   hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf),
diff --git 
a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch 
b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
index 35567838f5..8a2beb312f 100644
--- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
+++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
@@ -1,24 +1,20 @@
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -2931,10 +2931,15 @@ static int wpa_driver_nl80211_del_beacon
-   struct nl_msg *msg;
+@@ -2932,11 +2932,11 @@ static int wpa_driver_nl80211_del_beacon
struct wpa_driver_nl80211_data *drv = bss->drv;
  
-+  if (!bss->beacon_set)
-+  return 0;
-+
-+  bss->beacon_set = 0;
-+
wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)",
 - drv->ifindex);
 + bss->ifindex);
+   bss->beacon_set = 0;
+   bss->freq = 0;
nl80211_put_wiphy_data_ap(bss);
 -  msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON);
-+  msg = nl80211_bss_msg(bss, 0, NL80211_CMD_DEL_BEACON);
++  msg = nl80211_bss_msg(drv, 0, NL80211_CMD_DEL_BEACON);
return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
  }
  
-@@ -5617,7 +5622,7 @@ static void nl80211_teardown_ap(struct i
+@@ -5650,7 +5650,7 @@ static void nl80211_teardown_ap(struct i
nl80211_mgmt_unsubscribe(bss, "AP teardown");
  
nl80211_put_wiphy_data_ap(bss);
@@ -27,7 +23,7 @@
  }
  
  
-@@ -8071,8 +8076,6 @@ static int wpa_driver_nl80211_if_remove(
+@@ -8104,8 +8104,6 @@ static int wpa_driver_nl80211_if_remove(
} else {
wpa_printf(MSG_DEBUG, "nl80211: F

[PATCH 2/3] hostapd: randomize default BSS color

2022-06-06 Thread David Bauer
In case no specific BSS color is configured, set it to a random value.

Signed-off-by: David Bauer 
---
 .../files/lib/netifd/wireless/mac80211.sh |  4 +++-
 ...tapd-config-support-random-BSS-color.patch | 24 +++
 ...750-qos_map_set_without_interworking.patch |  2 +-
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 
package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 27eecf3a7f..3d0afb261f 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -419,12 +419,14 @@ mac80211_hostapd_setup_base() {
he_mac_cap=${he_mac_cap:2}
 
append base_cfg "ieee80211ax=1" "$N"
-   [ -n "$he_bss_color" ] && append base_cfg 
"he_bss_color=$he_bss_color" "$N"
[ "$hwmode" = "a" ] && {
append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N"
append base_cfg 
"he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
}
 
+   set_default he_bss_color 128
+   append base_cfg "he_bss_color=$he_bss_color" "$N"
+
mac80211_add_he_capabilities \

he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \

he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
diff --git 
a/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch
 
b/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch
new file mode 100644
index 00..c0b01196c4
--- /dev/null
+++ 
b/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch
@@ -0,0 +1,24 @@
+From c9304d3303d563ad6d2619f4e07864ed12f96889 Mon Sep 17 00:00:00 2001
+From: David Bauer 
+Date: Sat, 14 May 2022 21:41:03 +0200
+Subject: [PATCH] hostapd: config: support random BSS color
+
+Configure the HE BSS color to a random value in case the config defines
+a BSS color which exceeds the max BSS color (63).
+
+Signed-off-by: David Bauer 
+---
+ hostapd/config_file.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/hostapd/config_file.c
 b/hostapd/config_file.c
+@@ -3485,6 +3485,8 @@ static int hostapd_config_fill(struct ho
+   } else if (os_strcmp(buf, "he_bss_color") == 0) {
+   conf->he_op.he_bss_color = atoi(pos) & 0x3f;
+   conf->he_op.he_bss_color_disabled = 0;
++  if (atoi(pos) > 63)
++  conf->he_op.he_bss_color = os_random() % 63 + 1;
+   } else if (os_strcmp(buf, "he_bss_color_partial") == 0) {
+   conf->he_op.he_bss_color_partial = atoi(pos);
+   } else if (os_strcmp(buf, "he_default_pe_duration") == 0) {
diff --git 
a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
 
b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
index 43360fb2e7..ff1d076b37 100644
--- 
a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
+++ 
b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
@@ -18,7 +18,7 @@
  
  #ifdef CONFIG_HS20
  static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf,
-@@ -4040,10 +4040,10 @@ static int hostapd_config_fill(struct ho
+@@ -4042,10 +4042,10 @@ static int hostapd_config_fill(struct ho
bss->gas_frag_limit = val;
} else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
bss->gas_comeback_delay = atoi(pos);
-- 
2.35.1


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


Re: [PATCH] usteer: Fix better candidate not being set in policy

2022-05-17 Thread David Bauer

Hi,

On 5/17/22 14:12, Wojciech Dubowik wrote:

The candidate is never set in this loop. Fix it by setting it
to the first valid entry.


Applied to master. Thanks!

Best
David



Signed-off-by: Wojciech Dubowik 
---
  policy.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/policy.c b/policy.c
index a7efc06..8155e24 100644
--- a/policy.c
+++ b/policy.c
@@ -143,7 +143,7 @@ find_better_candidate(struct sta_info *si_ref, struct 
uevent *ev, uint32_t requi
ev->select_reasons = reasons;
}
  
-		if (candidate && si->signal > candidate->signal)

+   if (!candidate || si->signal > candidate->signal)
candidate = si;
}
  


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


Re: [PATCH] hostapd: fallback to psk when generating r0kh/r1kh

2022-02-18 Thread David Bauer

Hi Eneas,

On 1/7/22 21:19, Eneas U de Queiroz wrote:

The 80211r r0kh and r1kh defaults are generated from the md5sum of
"$mobility_domain/$auth_secret".  auth_secret is only set when using EAP
authentication, but the default key is used for SAE/PSK as well.  In
this case,  auth_secret is empty, and the default value of the key can
be computed from the SSID alone.

Fallback to using $key when auth_secret is empty.  While at it, rename
the variable holding the generated key from 'key' to 'ft_key', to avoid
clobbering the PSK.


Just so i get this right - This means the same configuration is 
incompatible between firmware containing this commit and firmware that 
does not? In this case i would not pick it it 21.02.


Otherwise LGTM.

Best
David



Signed-off-by: Eneas U de Queiroz 
---

This should be cherry-picked to 21.02 as well.

  package/network/services/hostapd/files/hostapd.sh | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh
index d9d5f34877..e00fc21cd9 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -876,10 +876,10 @@ hostapd_set_bss_options() {
set_default pmk_r1_push 0
  
  [ -n "$r0kh" -a -n "$r1kh" ] || {

-   key=`echo -n 
"$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
+   ft_key=`echo -n 
"$mobility_domain/${auth_secret:-${key}}" | md5sum | awk '{print $1}'`
  
-	set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"

-   set_default r1kh 
"00:00:00:00:00:00,00:00:00:00:00:00,$key"
+   set_default r0kh 
"ff:ff:ff:ff:ff:ff,*,$ft_key"
+   set_default r1kh 
"00:00:00:00:00:00,00:00:00:00:00:00,$ft_key"
}
  
  [ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N"


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


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


Re: [PATCH 2/2] hostapd: refresh patches

2022-02-07 Thread David Bauer

Hi Stijn,

On 2/7/22 20:48, Stijn Tintel wrote:

On 17/01/2022 21:57, David Bauer wrote:

Refresh patches after updating to hostapd v2.10.


We usually combine bump and patch refresh in the same commit.


I don't like doing it in this case, as it makes the delta of patches / 
their content harder to grasp. hostapd compiles even without the refresh

commit applied.

Best
David



Thanks,
Stijn



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


[PATCH 2/2] hostapd: refresh patches

2022-01-17 Thread David Bauer
Refresh patches after updating to hostapd v2.10.

Signed-off-by: David Bauer 
---
 .../001-wolfssl-init-RNG-with-ECC-key.patch   |  6 ++--
 ...erministic-channel-on-channel-switch.patch |  6 ++--
 ...ix-sta-add-after-previous-connection.patch |  4 +--
 ...ewrite-neigh-code-to-not-depend-on-l.patch | 14 
 .../hostapd/patches/050-build_fix.patch   |  2 +-
 .../hostapd/patches/200-multicall.patch   | 36 +--
 .../services/hostapd/patches/300-noscan.patch |  4 +--
 .../hostapd/patches/301-mesh-noscan.patch |  4 +--
 .../patches/310-rescan_immediately.patch  |  2 +-
 .../patches/330-nl80211_fix_set_freq.patch|  2 +-
 .../341-mesh-ctrl-iface-channel-switch.patch  |  2 +-
 .../patches/350-nl80211_del_beacon_bss.patch  | 10 +++---
 .../patches/360-ctrl_iface_reload.patch   |  4 +--
 .../hostapd/patches/370-ap_sta_support.patch  | 26 +++---
 .../patches/380-disable_ctrl_iface_mib.patch  | 26 +++---
 .../400-wps_single_auth_enc_type.patch|  2 +-
 ...dd-new-config-params-to-be-used-with.patch |  6 ++--
 ...-use-new-parameters-during-ibss-join.patch |  4 +--
 .../patches/463-add-mcast_rate-to-11s.patch   |  8 ++---
 .../patches/464-fix-mesh-obss-check.patch |  2 +-
 .../patches/500-lto-jobserver-support.patch   |  6 ++--
 .../patches/590-rrm-wnm-statistics.patch  |  6 ++--
 .../hostapd/patches/600-ubus_support.patch| 34 +-
 .../hostapd/patches/700-wifi-reload.patch | 16 -
 .../hostapd/patches/710-vlan_no_bridge.patch  |  2 +-
 .../patches/711-wds_bridge_force.patch|  2 +-
 .../patches/720-iface_max_num_sta.patch   |  8 ++---
 .../hostapd/patches/730-ft_iface.patch|  4 +--
 .../hostapd/patches/740-snoop_iface.patch |  2 +-
 ...750-qos_map_set_without_interworking.patch | 14 
 30 files changed, 132 insertions(+), 132 deletions(-)

diff --git 
a/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch
 
b/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch
index 84fc1c9351..994aa30626 100644
--- 
a/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch
+++ 
b/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch
@@ -16,7 +16,7 @@ Signed-off-by: David Bauer 
 
 --- a/src/crypto/crypto_wolfssl.c
 +++ b/src/crypto/crypto_wolfssl.c
-@@ -1303,6 +1303,7 @@ int ecc_projective_add_point(ecc_point *
+@@ -1307,6 +1307,7 @@ int ecc_projective_add_point(ecc_point *
  
  struct crypto_ec {
ecc_key key;
@@ -24,7 +24,7 @@ Signed-off-by: David Bauer 
mp_int a;
mp_int prime;
mp_int order;
-@@ -1357,6 +1358,8 @@ struct crypto_ec * crypto_ec_init(int gr
+@@ -1361,6 +1362,8 @@ struct crypto_ec * crypto_ec_init(int gr
return NULL;
  
if (wc_ecc_init(>key) != 0 ||
@@ -33,7 +33,7 @@ Signed-off-by: David Bauer 
wc_ecc_set_curve(>key, 0, curve_id) != 0 ||
mp_init(>a) != MP_OKAY ||
mp_init(>prime) != MP_OKAY ||
-@@ -1388,6 +1391,7 @@ void crypto_ec_deinit(struct crypto_ec*
+@@ -1392,6 +1395,7 @@ void crypto_ec_deinit(struct crypto_ec*
mp_clear(>order);
mp_clear(>prime);
mp_clear(>a);
diff --git 
a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch
 
b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch
index 03a1e339a9..1faeacf766 100644
--- 
a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch
+++ 
b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch
@@ -29,7 +29,7 @@ Signed-off-by: Markus Theil 
  
  
  static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
-@@ -480,9 +481,14 @@ dfs_get_valid_channel(struct hostapd_ifa
+@@ -483,9 +484,14 @@ dfs_get_valid_channel(struct hostapd_ifa
int num_available_chandefs;
int chan_idx, chan_idx2;
int sec_chan_idx_80p80 = -1;
@@ -44,7 +44,7 @@ Signed-off-by: Markus Theil 
wpa_printf(MSG_DEBUG, "DFS: Selecting random channel");
*secondary_channel = 0;
*oper_centr_freq_seg0_idx = 0;
-@@ -502,8 +508,20 @@ dfs_get_valid_channel(struct hostapd_ifa
+@@ -505,8 +511,20 @@ dfs_get_valid_channel(struct hostapd_ifa
if (num_available_chandefs == 0)
return NULL;
  
@@ -68,7 +68,7 @@ Signed-off-by: Markus Theil 
if (!chan) {
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -9872,6 +9872,10 @@ static int nl80211_switch_channel(void *
+@@ -9895,6 +9895,10 @@ static int nl80211_switch_channel(void *
if (ret)
goto error;
  
diff --git 
a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch
 
b/package/network/services/hostapd/patches/021-fix-sta-add-after-

[PATCH 1/2] hostapd: update to v2.10

2022-01-17 Thread David Bauer
Upstreamed patches:
020-mesh-make-forwarding-configurable.patch
e6db1bc5da3fd7d5f4dba24aa102543b4749912f
550-WNM-allow-specifying-dialog-token.patch
979f19716539362f8ce60a77bf1b88fdcf5ba8e5
720-ACS-fix-channel-100-frequency.patch
2341585c349231af00cdef8d51458df01bc6965f
741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch
08bdf4f90de61a84ed8f4dd918272dd9d36e2e1f

Compile-tested: wpad-wolfssl hostapd-openssl
Run-tested: ath79-generic

Signed-off-by: David Bauer 
---
 package/network/services/hostapd/Makefile |   6 +-
 ...hannels-to-be-selected-if-dfs-is-ena.patch |  60 +++--
 ...20-mesh-make-forwarding-configurable.patch | 219 --
 .../hostapd/patches/301-mesh-noscan.patch |  15 +-
 .../patches/470-survey_data_fallback.patch|  22 +-
 ...50-WNM-allow-specifying-dialog-token.patch |  99 
 .../720-ACS-fix-channel-100-frequency.patch   |  30 ---
 ...ompilation-with-Hotspot-2.0-disabled.patch |  51 
 .../services/hostapd/src/src/ap/ubus.c|   2 +-
 9 files changed, 57 insertions(+), 447 deletions(-)
 delete mode 100644 
package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch
 delete mode 100644 
package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch
 delete mode 100644 
package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch
 delete mode 100644 
package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch

diff --git a/package/network/services/hostapd/Makefile 
b/package/network/services/hostapd/Makefile
index 7e4056bb18..584695786f 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE)
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2021-05-22
-PKG_SOURCE_VERSION:=b102f19bcc53c7f7db3951424d4d46709b4f1986
-PKG_MIRROR_HASH:=cb3cb968883042fc582752be1607586696c18e6ecf9808c9a8ac50e204584367
+PKG_SOURCE_DATE:=2022-01-16
+PKG_SOURCE_VERSION:=cff80b4f7d3c0a47c052e8187d671710f48939e4
+PKG_MIRROR_HASH:=712965bfa11a2e601d3e1c9a51a2cf3cffc6db89abafb3df3eb0cfd83c64705b
 
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_LICENSE:=BSD-3-Clause
diff --git 
a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch
 
b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch
index d948c41b30..16d24d1000 100644
--- 
a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch
+++ 
b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch
@@ -14,16 +14,37 @@ Signed-off-by: Peter Oh 
 
 --- a/wpa_supplicant/wpa_supplicant.c
 +++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2395,6 +2395,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2409,7 +2409,7 @@ static int drv_supports_vht(struct wpa_s
+ }
+ 
+ 
+-static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes 
*mode)
++static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes 
*mode, bool dfs_enabled)
+ {
+   int i;
+ 
+@@ -2418,7 +2418,10 @@ static bool ibss_mesh_is_80mhz_avail(int
+ 
+   chan = hw_get_channel_chan(mode, i, NULL);
+   if (!chan ||
+-  chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
++  chan->flag & HOSTAPD_CHAN_DISABLED)
++  return false;
++  
++  if (!dfs_enabled && chan->flag & (HOSTAPD_CHAN_RADAR | 
HOSTAPD_CHAN_NO_IR))
+   return false;
+   }
+ 
+@@ -2447,6 +2450,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
int chwidth, seg0, seg1;
u32 vht_caps = 0;
-   int is_24ghz;
-+  int dfs_enabled = wpa_s->conf->country[0] &&
-+   (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
+   bool is_24ghz, is_6ghz;
++  bool dfs_enabled = wpa_s->conf->country[0] &&
++ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
  
freq->freq = ssid->frequency;
  
-@@ -2484,8 +2486,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2543,8 +2548,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
return;
  
/* Check primary channel flags */
@@ -36,7 +57,7 @@ Signed-off-by: Peter Oh 
  
freq->channel = pri_chan->chan;
  
-@@ -2518,8 +2523,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2577,8 +2585,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
return;
  
/* Check secondary channel flags */
@@ -49,20 +70,25 @@ Signed-off-by: Peter Oh 
  
if (ht40 == -1) {
if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
-@@ -2612,8 +2620,11 @@ skip_ht40:
-   return;
+@@ -2667,7 +2678,7 @@ skip_to_6ghz:
+ 

Re: Switch issues and CI to GitHub

2022-01-09 Thread David Bauer

Hi Hauke,

On 1/9/22 17:55, Hauke Mehrtens wrote:

The criteria from gnu.org are irrelevant to me and I agree with Rosen and Bjørn 
on that topic.

I would prefer a vote like this, this is just an example not the official vote:
-
Migrate bug reporting from bugs.openwrt.org to github. Make bugs.openwrt.org 
read only like dev.openwrt.org. Do not migrate the bug reports, people can 
create new bugs on github, like copy the content to manually.
Do you agree to this plan?
Yes
No
-


In addition to that: There is (at least in my opinion) no downside to
using GitHub actions as an additional CI for PRs (Think of SoB, checkpatch).

This would reduce feedback cycles while being not controversial (packages uses 
the
same model, nobody loses anything over that).

Best
David




Hauke

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


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


Re: Macronix Flash-Chip Block Protection Clearing 5.10er

2021-12-25 Thread David Bauer

Hi Nick,

On 12/25/21 16:49, Nick wrote:
The flash-chip mx25l6405d that is contained in the Ubiquity Nanostation 
M5 (XM) is not able to write to the flash with kernel 5.10. Probably, 
caused by invalid block protection clearing. For example the logread 
contains a lot of those messages:


     jffs2: Newly-erased block contained word 0x19852003 at offset 
0x0025


Can you try to modify "spi_nor_get_sr_tb_mask" to always return 0?

Having a quick look at the code, there is no check if TB and BP3 bit 
conflict. Furthermore, the MXIC chip does not seem to have a TB bit at all.


I could imagine this either writes the wrong value to the register or 
does not unlock at all, as it interprets the range of the lock incorrectly.


Just a assumption, did not have a closer look.

Best
David



I added a patch with the help of blocktrron for the 5.4er kernel [0]. 
This patch is not applied in the 5.10er since a lot of rewrites happened 
upstream. However, the underlying issue is the missing 4th block 
protection bit that was not cleared. In upstream Linux you typically set 
SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_B for that kind of flash chips in 
drivers/mtd/spi-nor/macronix.c [1]. I added this for the mx25l6405d, but 
it did not help. I also tried to backport the ("mtd: spi-nor: keep lock 
bits if they are non-volatile") fix and setting 
"CONFIG_MTD_SPI_NOR_SWP_DISABLE", but it also did not help. Did I miss 
something?


[0] - 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=c9e9b8c342d918cedfc4d2e1c2f7fd1fcaf0b56b 

[1] - 
https://github.com/torvalds/linux/commit/7ea40b54e83baed17d85567cfae56175def39a55#diff-f749d5111926f3afbd8d869c577cb314fb690186ba42a2538a87e5ea7725929e 

[2] - 
https://gist.github.com/PolynomialDivision/0c420c6bfcfd681cffa7aac9f346d262
[3] - 
https://github.com/PolynomialDivision/openwrt/blob/984f1c84e8d087a9fa0117d5502b8e19a2a35b98/target/linux/generic/backport-5.10/409-v5.11-mtd-spi-nor-keep-lock-bits-if-they-are-non-volatile.patch 




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


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


Re: P2812HNUF3

2021-12-09 Thread David Bauer

Hi Ivar,
Hi Daniel,

On 12/9/21 23:12, Daniel Golle wrote:

Hi Ivar,

On Thu, Dec 09, 2021 at 10:14:22PM +0100, Ivar Orskaug wrote:

Hi,
P2812HNUF3 is currently broken in main because of the kernel 5.10
increase in size. This patch increases the kernel flash partition to
3072k, aligning with P2812HNUF1. Would it be possible to apply it to
main?


The patch looks good and all missing is a Signed-off-by: line.
As sysupgrade also won't be possible when having an older version
with 2MiB kernel limit running we should bump set DEVICE_COMPAT_VERSION
see below.


I'd suggest to increase the kernel partition to 4 or 5 MiB to avoid
increasing the kernel partition size a second time.

Best
David




Regards Ivar

diff --git 
a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts
index 376cdaeb61..86520247d0 100644
--- 
a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts
+++ 
b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f3.dts
@@ -55,11 +55,11 @@

 partition@0 {
 label = "kernel";
-   reg = <0x0 0x20>;
+   reg = <0x0 0x30>;
 };
-   partition@20 {
+   partition@30 {
 label = "ubi";
-   reg = <0x20 0x7e0>;
+   reg = <0x30 0x7d0>;
 };
 };
  };
diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk
index 909479587c..9e9818bdbf 100644
--- a/target/linux/lantiq/image/vr9.mk
+++ b/target/linux/lantiq/image/vr9.mk
@@ -282,7 +282,7 @@ define Device/zyxel_p-2812hnu-f3
DEVICE_VARIANT := F3
BOARD_NAME := P2812HNUF3
DEVICE_PACKAGES := kmod-rt2800-pci wpad-basic-wolfssl kmod-usb-dwc2
-  KERNEL_SIZE := 2048k
+  KERNEL_SIZE := 3072k
SUPPORTED_DEVICES += P2812HNUF3

DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Flash layout changed


DEFAULT := n
  endef

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


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



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


Re: [PATCH] FritzBox-4040-UBOOT: Allow for easier devices recovery

2021-11-23 Thread David Bauer

Hello Enrico,

On 11/22/21 11:55, Enrico Mioso wrote:

When flashing a broken kernel, or an image where failsafe mode is no more 
accessible, recoverying these devices can become needlessly painful.
Allow for easier recovery by unconditionally trying to get an initramfs image 
over TFTP once before booting, thereby giving the user a chance to sysupgrade 
to a working image.


As I've already explained, I don't like increasing the time necessary for the 
device to boot.
Also, introducig such a method on a 4040 does not make sense, as its NOR flash 
can be rewritten
from EVA.

That being said, unconditionally requesting a bootable image over the network 
is a security
risk in itself. NAND based ipq40xx boards from AVM also only allow connections 
to their
bootloader on cold-boots for exactly this reason.

For example, if an attacker is able to create a kernel-panic, your patch would 
enable him
to modify the router in case he is on the same network. A Pushbutton TFTP 
procedure mitigates
this problem, as it depends on the attacker having physical access to the 
device.

Recovery is - for all boards - possible using the AVM recovery tool or manually 
patching the
U-Boot and sideloading via EVA. So a network request for a boot image raises 
more problems than
it tries to solve.

Best
David



Signed-off-by: Enrico Mioso 
CC: Christian Lamparter 
CC: David Bauer 
---

Reasons for this patch:
1 - There are situations where it can be nice to recover a device without the 
AVM Recovery tool. In some cases the tool won't even be an option (as far as I 
know, it exists only for Windows, or am I wrong?).
2 - Since the effort of creating a second-stage bootloader for these devices 
has been carried out (thanks a lot for this!), I think it makes sense to allow 
for things to be more friendly to developers and users.

Side effects:
When nandboot fails, there will be TWO tftp requests with no delay between 
them, then the sleep will kick in.

Possible "improvements":
Implementing a push-button method may be preferred. Still, I have no easy way 
to attach an UART to the device right now.
Moreover, being able to do this "more" remotely would be a vaulable feature to 
me.

Enrico

  include/configs/fritz1200.h | 2 +-
  include/configs/fritz3000.h | 2 +-
  include/configs/fritz4040.h | 2 +-
  include/configs/fritz7530.h | 2 +-
  4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/fritz1200.h b/include/configs/fritz1200.h
index 90d5186..16152a3 100644
--- a/include/configs/fritz1200.h
+++ b/include/configs/fritz1200.h
@@ -23,7 +23,7 @@
"mtdparts=" MTDPARTS_DEFAULT "\0"   \
"nandboot=ubi part ubi && ubi read 0x8500 kernel && bootm\0"  \
"tftpboot=tftpboot && bootm; sleep 5; run tftpboot\0" \
-   "fritzboot=run nandboot || run tftpboot;\0"   \
+   "fritzboot=tftpboot && bootm; run nandboot || run tftpboot;\0"  
  \
  
  #undef V_PROMPT

  #define V_PROMPT  "(" CONFIG_MODEL ") # "
diff --git a/include/configs/fritz3000.h b/include/configs/fritz3000.h
index e383ffb..3440550 100644
--- a/include/configs/fritz3000.h
+++ b/include/configs/fritz3000.h
@@ -23,7 +23,7 @@
"mtdparts=" MTDPARTS_DEFAULT "\0"   \
"nandboot=ubi part ubi && ubi read 0x8500 kernel && bootm\0"  \
"tftpboot=tftpboot && bootm; sleep 5; run tftpboot\0" \
-   "fritzboot=run nandboot || run tftpboot;\0"   \
+   "fritzboot=tftpboot && bootm; run nandboot || run tftpboot;\0"  
  \
  
  #undef V_PROMPT

  #define V_PROMPT  "(" CONFIG_MODEL ") # "
diff --git a/include/configs/fritz4040.h b/include/configs/fritz4040.h
index 060afb0..582edfd 100644
--- a/include/configs/fritz4040.h
+++ b/include/configs/fritz4040.h
@@ -23,7 +23,7 @@
"mtdparts=" MTDPARTS_DEFAULT "\0"   \
"nandboot=nboot firmware && bootm\0"  \
"tftpboot=tftpsrv && bootm; sleep 5; run tftpboot\0"  \
-   "fritzboot=run nandboot || run tftpboot;\0"   \
+   "fritzboot=tftpboot && bootm; run nandboot || run tftpboot;\0"  
  \
  
  #undef V_PROMPT

  #define V_PROMPT  "(" CONFIG_MODEL ") # "
diff --git a/include/configs/fritz7530.h b/include/configs/fritz7530.h
index b07ecfc..caecd5d 100644
--- a/include/configs/fritz7530.h
+++ b/include/configs/fritz7530.h
@@ -23,7 +23,7 @@
"mtdparts=" MTDPARTS_DEFAULT "\0"   \
"nandboot=ubi part ubi && ubi read 0x8500 kernel && bootm\0"  \
"tf

Re: hostapd: ubus inteface crashes hostapd?

2021-10-21 Thread David Bauer

Hi Nick,

On 10/21/21 11:31, Nick wrote:

Is someone massively utilizing the ubus interface from hostapd? I'm doing this 
with dawn and I saw that blocktrron already fixed some infinity loop. However, 
currently DAWN is crashing the hostapd. I make extensive use of the 
get_clients, all subscriptions, disassoc_immidient calls.


This is most likely caused by my transition-report patch some days ago.

Please check out the latest master. It should be resolved.

Best
David



Of course I don't want to exclude that the error is on my side. I just wanted 
to ask if someone is doing something similar. It is just weird for me that dawn 
can crash hostapd since it is only connecting via ubus and uses iwinfo library 
to get signal strength and channel utilization from wifi interfaces.

See:
https://github.com/berlin-open-wireless-lab/DAWN/issues/151#issuecomment-948192240

Bests
Nick

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


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


[PATCH] hostapd: ubus: add BSS transtiton request method

2021-10-06 Thread David Bauer
The existing wnm_disassoc_imminent ubus method only supports issuing a
bss transition request with the disassoc imminent flag set.
For use-cases, where the client is requested to roam to another BSS
without a pending disassoc, this existing method is not suitable.

Add a new bss_transition_request ubus method, which provides a more
universal way to dispatch a transition request. It takes the following
arguments:

Required:
addr: String - MAC-address of the STA to send the request to (colon-seperated)

Optional:
abridged - Bool - Indicates if the abridged flag is set
disassociation_imminent: Bool - Whether or not the disassoc_imminent
 flag is set
disassociation_timer: I32 - number of TBTTs after which the client will
  be disassociated
validity_period: I32 - number of TBTTs after which the beacon
 candidate list (if included) will be invalid
neighbors: blob-array - Array of strings containing neighbor reports as
   hex-string

Signed-off-by: David Bauer 
---
 .../services/hostapd/src/src/ap/ubus.c| 152 +-
 1 file changed, 112 insertions(+), 40 deletions(-)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 367e1b652b..1b5c60416f 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -1275,60 +1275,30 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct 
ubus_object *obj,
 
 
 #ifdef CONFIG_WNM_AP
-enum {
-   WNM_DISASSOC_ADDR,
-   WNM_DISASSOC_DURATION,
-   WNM_DISASSOC_NEIGHBORS,
-   WNM_DISASSOC_ABRIDGED,
-   __WNM_DISASSOC_MAX,
-};
-
-static const struct blobmsg_policy wnm_disassoc_policy[__WNM_DISASSOC_MAX] = {
-   [WNM_DISASSOC_ADDR] = { "addr", BLOBMSG_TYPE_STRING },
-   [WNM_DISASSOC_DURATION] { "duration", BLOBMSG_TYPE_INT32 },
-   [WNM_DISASSOC_NEIGHBORS] { "neighbors", BLOBMSG_TYPE_ARRAY },
-   [WNM_DISASSOC_ABRIDGED] { "abridged", BLOBMSG_TYPE_BOOL },
-};
 
 static int
-hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object 
*obj,
- struct ubus_request_data *ureq, const char 
*method,
- struct blob_attr *msg)
+hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool 
disassoc_imminent, bool abridged,
+   u16 disassoc_timer, u8 validity_period, struct blob_attr 
*neighbors)
 {
-   struct hostapd_data *hapd = container_of(obj, struct hostapd_data, 
ubus.obj);
-   struct blob_attr *tb[__WNM_DISASSOC_MAX];
struct blob_attr *cur;
struct sta_info *sta;
-   int duration = 10;
-   int rem;
int nr_len = 0;
+   int rem;
u8 *nr = NULL;
-   u8 req_mode = WNM_BSS_TM_REQ_DISASSOC_IMMINENT;
-   u8 addr[ETH_ALEN];
-
-   blobmsg_parse(wnm_disassoc_policy, __WNM_DISASSOC_MAX, tb, 
blob_data(msg), blob_len(msg));
-
-   if (!tb[WNM_DISASSOC_ADDR])
-   return UBUS_STATUS_INVALID_ARGUMENT;
-
-   if (hwaddr_aton(blobmsg_data(tb[WNM_DISASSOC_ADDR]), addr))
-   return UBUS_STATUS_INVALID_ARGUMENT;
-
-   if ((cur = tb[WNM_DISASSOC_DURATION]) != NULL)
-   duration = blobmsg_get_u32(cur);
+   u8 req_mode = 0;
 
sta = ap_get_sta(hapd, addr);
if (!sta)
return UBUS_STATUS_NOT_FOUND;
 
-   if (tb[WNM_DISASSOC_NEIGHBORS]) {
+   if (neighbors) {
u8 *nr_cur;
 
-   if (blobmsg_check_array(tb[WNM_DISASSOC_NEIGHBORS],
+   if (blobmsg_check_array(neighbors,
BLOBMSG_TYPE_STRING) < 0)
return UBUS_STATUS_INVALID_ARGUMENT;
 
-   blobmsg_for_each_attr(cur, tb[WNM_DISASSOC_NEIGHBORS], rem) {
+   blobmsg_for_each_attr(cur, neighbors, rem) {
int len = strlen(blobmsg_get_string(cur));
 
if (len % 2)
@@ -1344,7 +1314,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, 
struct ubus_object *obj,
}
 
nr_cur = nr;
-   blobmsg_for_each_attr(cur, tb[WNM_DISASSOC_NEIGHBORS], rem) {
+   blobmsg_for_each_attr(cur, neighbors, rem) {
int len = strlen(blobmsg_get_string(cur)) / 2;
 
*nr_cur++ = WLAN_EID_NEIGHBOR_REPORT;
@@ -1361,15 +1331,116 @@ hostapd_wnm_disassoc_imminent(struct ubus_context 
*ctx, struct ubus_object *obj,
if (nr)
req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED;
 
-   if (tb[WNM_DISASSOC_ABRIDGED] && 
blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED]))
+   if (abridged)
req_mode |= WNM_BSS_TM_REQ_ABRIDGED;
 
-   if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, duration, NULL,
+   if (disassoc_imminent)
+

[PATCH] hostapd: ubus: add notification for BSS transition response

2021-10-06 Thread David Bauer
To allow steering daemons to be aware of the STA-decided transition
target, publish WNM transition responses to ubus. This way, steerings
daemons can learn about STA-chosen targets and send a better selection
of transition candidates.

Signed-off-by: David Bauer 
---
 .../hostapd/patches/600-ubus_support.patch| 30 +
 .../services/hostapd/src/src/ap/ubus.c| 33 +++
 .../services/hostapd/src/src/ap/ubus.h| 11 +++
 3 files changed, 74 insertions(+)

diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch 
b/package/network/services/hostapd/patches/600-ubus_support.patch
index 005ed54e0c..d77d245243 100644
--- a/package/network/services/hostapd/patches/600-ubus_support.patch
+++ b/package/network/services/hostapd/patches/600-ubus_support.patch
@@ -514,3 +514,33 @@
struct os_reltime backlogged_until;
  #endif /* CONFIG_AIRTIME_POLICY */
  
+--- a/src/ap/wnm_ap.c
 b/src/ap/wnm_ap.c
+@@ -463,7 +463,7 @@ static void ieee802_11_rx_bss_trans_mgmt
+ size_t len)
+ {
+   u8 dialog_token, status_code, bss_termination_delay;
+-  const u8 *pos, *end;
++  const u8 *pos, *end, *target_bssid;
+   int enabled = hapd->conf->bss_transition;
+   struct sta_info *sta;
+ 
+@@ -510,6 +510,7 @@ static void ieee802_11_rx_bss_trans_mgmt
+   wpa_printf(MSG_DEBUG, "WNM: not enough room for Target 
BSSID field");
+   return;
+   }
++  target_bssid = pos;
+   sta->agreed_to_steer = 1;
+   eloop_cancel_timeout(ap_sta_reset_steer_flag_timer, hapd, sta);
+   eloop_register_timeout(2, 0, ap_sta_reset_steer_flag_timer,
+@@ -529,6 +530,10 @@ static void ieee802_11_rx_bss_trans_mgmt
+   MAC2STR(addr), status_code, bss_termination_delay);
+   }
+ 
++  hostapd_ubus_notify_bss_transition_response(hapd, sta->addr, 
dialog_token,
++  status_code, 
bss_termination_delay,
++  target_bssid, pos, end - 
pos);
++
+   wpa_hexdump(MSG_DEBUG, "WNM: BSS Transition Candidate List Entries",
+   pos, end - pos);
+ }
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 367e1b652b..30bb353953 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -1757,3 +1757,36 @@ void hostapd_ubus_notify_radar_detected(struct 
hostapd_iface *iface, int frequen
ubus_notify(ctx, >ubus.obj, "radar-detected", b.head, -1);
}
 }
+
+void hostapd_ubus_notify_bss_transition_response(
+   struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 
status_code,
+   u8 bss_termination_delay, const u8 *target_bssid,
+   const u8 *candidate_list, u16 candidate_list_len)
+{
+#ifdef CONFIG_WNM_AP
+   char *cl_str;
+   u16 i;
+
+   if (!hapd->ubus.obj.has_subscribers)
+   return;
+
+   if (!addr)
+   return;
+
+   blob_buf_init(, 0);
+   blobmsg_add_macaddr(, "address", addr);
+   blobmsg_add_u8(, "dialog-token", dialog_token);
+   blobmsg_add_u8(, "status-code", status_code);
+   blobmsg_add_u8(, "bss-termination-delay", bss_termination_delay);
+   if (target_bssid)
+   blobmsg_add_macaddr(, "target-bssid", target_bssid);
+   if (candidate_list_len > 0) {
+   cl_str = blobmsg_alloc_string_buffer(, "candidate-list", 
candidate_list_len * 2 + 1);
+   for (i = 0; i < candidate_list_len; i++)
+   snprintf(_str[i*2], 3, "%02X", candidate_list[i]);
+   blobmsg_add_string_buffer();
+   }
+
+   ubus_notify(ctx, >ubus.obj, "bss-transition-response", b.head, 
-1);
+#endif
+}
diff --git a/package/network/services/hostapd/src/src/ap/ubus.h 
b/package/network/services/hostapd/src/src/ap/ubus.h
index acdac74360..899b001dd5 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.h
+++ b/package/network/services/hostapd/src/src/ap/ubus.h
@@ -55,6 +55,10 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data 
*hapd,
 void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int 
frequency,
int chan_width, int cf1, int cf2);
 
+void hostapd_ubus_notify_bss_transition_response(
+   struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 
status_code,
+   u8 bss_termination_delay, const u8 *target_bssid,
+   const u8 *candidate_list, u16 candidate_list_len);
 void hostapd_ubus_add(struct hapd_interfaces *interfaces);
 void hostapd_ubus_free(struct hapd_interfaces *interfac

[PATCH usteer] policy: avoid creating kick loop for client

2021-10-04 Thread David Bauer
When checking whether a client is allowed to associate to a node, the
lower ceiling for kicking clients was not taken into account when
assoc-steering is disabled.

The problem behind this is, that a configured lower barrier for
disassociating clients (kicking) would kick the client immediatly after
association. In the worst scenario the client immediatly associates
again to the station and ends up in a kick loop.

Don't allow associating when a min_snr is configured and the client
signal is below this value.

Signed-off-by: David Bauer 
---
 policy.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/policy.c b/policy.c
index c1a992f..91ff613 100644
--- a/policy.c
+++ b/policy.c
@@ -155,8 +155,22 @@ usteer_check_request(struct sta_info *si, enum 
usteer_event_type type)
if (type == EVENT_TYPE_AUTH)
goto out;
 
-   if (type == EVENT_TYPE_ASSOC && !config.assoc_steering)
-   goto out;
+   if (type == EVENT_TYPE_ASSOC) {
+   /* Check if assoc request has lower signal than min_signal.
+* If this is the case, block assoc even when assoc steering is 
enabled.
+*
+* Otherwise, the client potentially ends up in a assoc - kick 
loop.
+*/
+   if (config.min_snr && si->signal < snr_to_signal(si->node, 
config.min_snr)) {
+   ev.reason = UEV_REASON_LOW_SIGNAL;
+   ev.threshold.cur = si->signal;
+   ev.threshold.ref = min_signal;
+   ret = false;
+   goto out;
+   } else if (!config.assoc_steering) {
+   goto out;
+   }
+   }
 
min_signal = snr_to_signal(si->node, config.min_connect_snr);
if (si->signal < min_signal) {
-- 
2.33.0


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


Re: [PATCH] realtek-poe: add support for PoE on Realtek switches

2021-09-26 Thread David Bauer

Hi John,

On 9/26/21 14:31, John Crispin wrote:


On 26.09.21 13:34, David Bauer wrote:
That being set, the goal of poemgr is not to replace the other efforts. I'm sorry if I caused this impression. 


it did not replace anything. I am fully with you on this one, realtek-poe took 
the same approach but merging it was NAK'ed with the argument, that we can only 
merge the ultimate solution. which is why till this day there is no upstream 
support for realtek.


From my perspective, providing both for the time being via the packages feed 
(not preinstalled)
is a good-enough solution. Otherwise, iterating over the project with multiple 
people starts to become
difficult, as multiple forks (each fixing one issue / adding one feature) start 
to come up and
bringing them together becomes harder and harder.

Having it not in the core repository should indicate enough that it is not a 
definitive solution.

Maybe I'm bringing up points which are already off the list, but at least i can 
try :)

Best
David



     John


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


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


Re: [PATCH] ath79/ag71xx: rearrange ag71xx structs to remove holes

2021-09-26 Thread David Bauer

Hi Rui,
Hi Rosen,

On 9/19/21 12:38, Rui Salvaterra wrote:

The ag71xx_ring changes are already part of the upstream driver. However, since
we're not using it at all yet, let's apply this to our driver for the time
being, as David explicitly requests performance numbers before applying it
upstream [1] (and rightly so, in my opinion).


Does this mean parts of this patch are already applied upstream?

Also are there already performance numbers available?

Best
David

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


Re: [PATCH] realtek-poe: add support for PoE on Realtek switches

2021-09-26 Thread David Bauer

Hi Bjorn,
Hi John,

On 9/26/21 10:43, Bjørn Mork wrote:

John Crispin  writes:


poemgr does not use the APIs provided by libubox so I doubt that this
will land in the tree.


It's going through the packages repo according to
https://github.com/openwrt/openwrt/commit/a9839697896c4fdf8c44a06bbce466ce52493069

The distinction is of little imprtance to the outside world.  You will
have poemgr in OpenWrt.


poemgr is set to land in the packages feed. I don't have stakes in the realtek 
PoE business
and poemgr is more or less the result of a weekend hacking around the specific 
device (USW-Lite).

I didn't fully catch up what the ultimate goal around PoE support is, but 
having the ability to
control the ports in the first place being it with a non-preinstalled tool from 
the packages repo
is a good start where we can iterate upon and either integrate support for an 
additional PSE controller
with it's quirks or aim for an extension of a kernel subsystem.

That being set, the goal of poemgr is not to replace the other efforts. I'm 
sorry if I caused this impression.

Best
David





Bjørn



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


[PATCH usteer] usteer: add support for IPv6 remote exchange

2021-09-07 Thread David Bauer
From: Jan Braun 

This adds optional support for message exchange using IPv6 multicast
messaging. This has the ability for routers and switches between nodes
to route traffic between usteer nodes multicast-aware.

By default, IPv4 is used. IPv6 can be enabled by configuring the ipv6
option to 1.

Signed-off-by: Jan Braun 
[squash commits - adapt usock usage]
Signed-off-by: David Bauer 
---
 main.c |   1 -
 openwrt/usteer/files/etc/config/usteer |   3 +
 openwrt/usteer/files/etc/init.d/usteer |   1 +
 remote.c   | 172 ++---
 ubus.c |   3 +
 usteer.h   |   5 +
 6 files changed, 166 insertions(+), 19 deletions(-)

diff --git a/main.c b/main.c
index ad53af8..9d01419 100644
--- a/main.c
+++ b/main.c
@@ -204,7 +204,6 @@ int main(int argc, char **argv)
}
 
ubus_add_uloop(ubus_ctx);
-   usteer_interface_init();
if (dump_time) {
dump_timer.cb = usteer_dump_timeout;
uloop_timeout_set(_timer, dump_time * 1000);
diff --git a/openwrt/usteer/files/etc/config/usteer 
b/openwrt/usteer/files/etc/config/usteer
index 5e30ccf..3ba1c6d 100644
--- a/openwrt/usteer/files/etc/config/usteer
+++ b/openwrt/usteer/files/etc/config/usteer
@@ -5,6 +5,9 @@ config usteer
# Log messages to syslog (0/1)
option 'syslog' '1'
 
+   # Use IPv6 for remote exchange
+   option 'ipv6' '0'
+
# Minimum level of logged messages
# 0 = fatal
# 1 = info
diff --git a/openwrt/usteer/files/etc/init.d/usteer 
b/openwrt/usteer/files/etc/init.d/usteer
index 9289557..15add88 100755
--- a/openwrt/usteer/files/etc/init.d/usteer
+++ b/openwrt/usteer/files/etc/init.d/usteer
@@ -65,6 +65,7 @@ uci_usteer() {
local cfg="$1"
 
uci_option_to_json_bool "$cfg" syslog
+   uci_option_to_json_bool "$cfg" ipv6
uci_option_to_json_bool "$cfg" load_kick_enabled
uci_option_to_json_bool "$cfg" assoc_steering
uci_option_to_json_string "$cfg" node_up_script
diff --git a/remote.c b/remote.c
index 16ecb0f..dd95ece 100644
--- a/remote.c
+++ b/remote.c
@@ -277,10 +277,9 @@ interface_add_node(struct usteer_remote_host *host, struct 
blob_attr *data)
 }
 
 static void
-interface_recv_msg(struct interface *iface, struct in_addr *addr, void *buf, 
int len)
+interface_recv_msg(struct interface *iface, char *addr_str, void *buf, int len)
 {
struct usteer_remote_host *host;
-   char addr_str[INET_ADDRSTRLEN];
struct blob_attr *data = buf;
struct apmsg msg;
struct blob_attr *cur;
@@ -302,8 +301,6 @@ interface_recv_msg(struct interface *iface, struct in_addr 
*addr, void *buf, int
MSG(NETWORK, "Received message on %s (id=%08x->%08x seq=%d len=%d)\n",
interface_name(iface), msg.id, local_id, msg.seq, len);
 
-   inet_ntop(AF_INET, addr, addr_str, sizeof(addr_str));
-
host = interface_get_host(addr_str, msg.id);
usteer_node_set_blob(>host_info, msg.host_info);
 
@@ -325,11 +322,12 @@ interface_find_by_ifindex(int index)
 }
 
 static void
-interface_recv(struct uloop_fd *u, unsigned int events)
+interface_recv_v4(struct uloop_fd *u, unsigned int events)
 {
static char buf[APMGR_BUFLEN];
static char cmsg_buf[( CMSG_SPACE(sizeof(struct in_pktinfo)) + 
sizeof(int)) + 1];
static struct sockaddr_in sin;
+   char addr_str[INET_ADDRSTRLEN];
static struct iovec iov = {
.iov_base = buf,
.iov_len = sizeof(buf)
@@ -381,11 +379,80 @@ interface_recv(struct uloop_fd *u, unsigned int events)
continue;
}
 
-   interface_recv_msg(iface, _addr, buf, len);
+   inet_ntop(AF_INET, _addr, addr_str, sizeof(addr_str));
+
+   interface_recv_msg(iface, addr_str, buf, len);
} while (1);
 }
 
-static void interface_send_msg(struct interface *iface, struct blob_attr *data)
+
+static void interface_recv_v6(struct uloop_fd *u, unsigned int events){
+   static char buf[APMGR_BUFLEN];
+   static char cmsg_buf[( CMSG_SPACE(sizeof(struct in6_pktinfo)) + 
sizeof(int)) + 1];
+   static struct sockaddr_in6 sin;
+   static struct iovec iov = {
+   .iov_base = buf,
+   .iov_len = sizeof(buf)
+   };
+   static struct msghdr msg = {
+   .msg_name = ,
+   .msg_namelen = sizeof(sin),
+   .msg_iov = ,
+   .msg_iovlen = 1,
+   .msg_control = cmsg_buf,
+   .msg_controllen = sizeof(cmsg_buf),
+   };
+   struct cmsghdr *cmsg;
+   char addr_str[INET6_ADDRSTRLEN];
+   int len;
+
+   do {
+   struct in6_pktinfo *pkti = NULL;
+   struct interface *iface;
+
+   len = recvmsg(u->

Re: Broken ARP broadcast on master (commit 0f688797)

2021-09-06 Thread David Bauer
Hi Felix,

On 9/6/21 2:18 PM, Felix Fietkau wrote:
> 
>> On 6. Sep 2021, at 02:03, David Bauer  wrote:
>>
>> Hi Felix,
>>
>> updating my Wireless APs (ath9k+ath10k / mt7603+mt7915) broke ARP broadcast 
>> delivery to clients
>> connected to the radios with SW rate control.
>>
>> Bisecting this problem revealed commit 0f688797 ("mac80211: add missing 
>> change for encap offload
>> on devices with sw rate control") introduces this problem, reverting it 
>> restored the desired
>> functionality.
>>
>> Can you have a look what is going wrong here?
> 
> 
> Hi David,
> 
> Please try the latest version, it should resolve the issue

Thanks, your patch fixes this issue.

And also thanks for submitting a fix upstream.

Best
David

> 
> Thanks,
> - Felix
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

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


Broken ARP broadcast on master (commit 0f688797)

2021-09-05 Thread David Bauer
Hi Felix,

updating my Wireless APs (ath9k+ath10k / mt7603+mt7915) broke ARP broadcast 
delivery to clients
connected to the radios with SW rate control.

Bisecting this problem revealed commit 0f688797 ("mac80211: add missing change 
for encap offload
on devices with sw rate control") introduces this problem, reverting it 
restored the desired
functionality.

Can you have a look what is going wrong here?

Best
David

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


Re: [PATCH v2] ath79: add support for onion omega

2021-08-14 Thread David Bauer
Hi Jan,

looks pretty solid to me.

On 8/14/21 2:33 PM, Jan-Niklas Burfeind wrote:

 ...

> +define Device/onion_omega
> +  $(Device/tplink-16mlzma)
> +  SOC := ar9331
> +  DEVICE_VENDOR := Onion
> +  DEVICE_MODEL := Omega
> +  DEVICE_PACKAGES := kmod-usb-core kmod-usb2

AR9331 uses a different USB2 host controller. It requires the
kmod-usb-chipidea2 package instead of kmod-usb2.

Also kmod-usb-core can be removed from the package set, as it is a
dependency for both.

Can you change the package set and verify USB works by plugging in
a device?

Best
David

> +  SUPPORTED_DEVICES += onion-omega
> +  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
> +  IMAGE_SIZE := 16192k
> +  TPLINK_HWID := 0x0471
> +endef
> +TARGET_DEVICES += onion_omega
> +
>  define Device/openmesh_common_64k
>DEVICE_VENDOR := OpenMesh
>DEVICE_PACKAGES := uboot-envtools
> 

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


Re: [PATCH] ath79: add support for onion omega

2021-08-12 Thread David Bauer
Hi Jan-Niklas,

On 8/11/21 6:54 PM, Jan-Niklas Burfeind wrote:
> The Onion Omega is a hardware development platform with built-in WiFi.
> 
> https://onioniot.github.io/wiki/
> 
> Specifications:
>  - QCA9331 @ 400 MHz (MIPS 24Kc Big-Endian Processor)
>  - 64MB of DDR2 RAM running at 400 MHz
>  - 16MB of on-board flash storage
>  - Support for USB 2.0
>  - Support for Ethernet at 100 Mbps
>  - 802.11b/g/n WiFi at 150 Mbps
>  - 18 digital GPIOs
>  - A single Serial UART
>  - Support for SPI
>  - Support for I2S
> 
> Flash instructions:
> The device is running OpenWrt upon release using the ar71xx target.
> Both a sysupgrade
> and uploading the factory image using u-boots web-UI do work fine.
> 
> Depending on the ssh client, it might be necessary to enable outdated
> KeyExchange methods e.g. in the clients ssh-config:
> 
> Host 192.168.1.1
> KexAlgorithms +diffie-hellman-group1-sha1
> 
> The stock credentials are: root onioneer
> 
> For u-boots web-UI manually configure `192.168.1.2/24` on your computer,
> connect to `192.168.1.1`.
> 
> MAC addresses as verified by OEM firmware:
> 2G   phy0  label
> LAN  eth0  label - 1
> 
> LAN is only available in combination with an optional expansion dock.
> 
> Based on vendor acked commit:
> commit 5cd49bb067ca ("ar71xx: add support for Onion Omega")
> 
> Partly reverts:
> commit fc553c7e4c8e ("ath79: drop unused/incomplete dts")
> 
> Signed-off-by: Jan-Niklas Burfeind 
> ---
>  target/linux/ath79/dts/ar9331_onion_omega.dts | 138 ++
>  .../generic/base-files/etc/board.d/02_network |   1 +
>  target/linux/ath79/image/generic.mk   |  14 ++
>  3 files changed, 153 insertions(+)
>  create mode 100644 target/linux/ath79/dts/ar9331_onion_omega.dts
> 
> diff --git a/target/linux/ath79/dts/ar9331_onion_omega.dts 
> b/target/linux/ath79/dts/ar9331_onion_omega.dts
> new file mode 100644
> index 00..3b72a293b4
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9331_onion_omega.dts
> @@ -0,0 +1,138 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include 
> +#include 
> +
> +#include "ar9331.dtsi"
> +
> +/ {
> + model = "Onion Omega";
> + compatible = "onion,omega", "qca,ar9331";
> +
> + aliases {
> + serial0 = 
> + led-boot = _system;
> + led-failsafe = _system;
> + led-running = _system;
> + led-upgrade = _system;
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> +
> + led_system: system {
> + label = "onion:amber:system";

Remove the model name from the LED name.

> + gpios = < 27 GPIO_ACTIVE_LOW>;
> + };
> + };
> +
> + keys {
> + compatible = "gpio-keys-polled";
> + poll-interval = <100>;
> +
> + button0 {
> + label = "reset";
> + linux,code = ;
> + gpios = < 11 GPIO_ACTIVE_HIGH>;
> + };
> + };
> +};
> +
> + {
> + clock-frequency = <2500>;
> +};
> +
> + {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +
> + dr_mode = "host";
> +};
> +
> +_phy {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +
> + compatible = "syscon", "simple-mfd";
> +};
> +
> + {
> + status = "okay";
> +
> + nvmem-cells = <_uboot_1fc00>;
> + nvmem-cell-names = "mac-address";
> + mac-address-increment = <(-1)>;
> +
> + gmac-config {
> + device = <>;
> + switch-phy-addr-swap = <4>;
> + switch-phy-swap = <4>;
> + };
> +};
> +
> +
> + {
> + status = "okay";
> +
> + num-chipselects = <1>;
> +
> + /* Winbond 25Q128FVSG SPI flash */
> + flash@0 {
> + compatible = "winbond,w25q128", "jedec,spi-nor";

Drop the winbond compatible - defining model-specific compatible is considered 
legacy
in case it is not required for Flash-ID duplicates.

> + spi-max-frequency = <2500>;
> + reg = <0>;
> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + uboot: partition@0 {
> + label = "u-boot";
> + reg = <0x00 0x02>;
> + read-only;
> + };
> +
> + partition@2 {
> + compatible = "tplink,firmware";
> + label = "firmware";
> + reg = <0x02 0xfd>;
> + };
> +
> + art: partition@ff {
> + label = "art";
> + reg = <0xff 0x01>;
> + read-only;
> + 

[PATCH] generic: Kconfig: exit on unset symbol

2021-08-04 Thread David Bauer
When a target configuration has unser Kconfig symbols, the build will
fail when OpenWrt is compiled with V=s and stdin is connected to a tty.

In case OpenWrt is compiled without either of these preconditions, the
build will uscceed with the symbols in question being unset.

Modify the kernel configuration in a way it fails on unset symbols
regardless of the aformentioned preconditions.

Signed-off-by: David Bauer 
---
 include/kernel-build.mk   |  1 +
 target/linux/generic/hack-5.10/205-kconfig-exit.patch | 11 +++
 target/linux/generic/hack-5.4/205-kconfig-exit.patch  | 11 +++
 3 files changed, 23 insertions(+)
 create mode 100644 target/linux/generic/hack-5.10/205-kconfig-exit.patch
 create mode 100644 target/linux/generic/hack-5.4/205-kconfig-exit.patch

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 66a9f64c80..80da4455bc 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -132,6 +132,7 @@ define BuildKernel
   $(LINUX_DIR)/.modules: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
   $(LINUX_DIR)/.modules: export 
PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
   $(LINUX_DIR)/.modules: export 
PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(LINUX_DIR)/.modules: export FAIL_ON_UNCONFIGURED=1
   $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
$(Kernel/CompileModules)
touch $$@
diff --git a/target/linux/generic/hack-5.10/205-kconfig-exit.patch 
b/target/linux/generic/hack-5.10/205-kconfig-exit.patch
new file mode 100644
index 00..8931ad3270
--- /dev/null
+++ b/target/linux/generic/hack-5.10/205-kconfig-exit.patch
@@ -0,0 +1,11 @@
+--- a/scripts/kconfig/conf.c
 b/scripts/kconfig/conf.c
+@@ -212,6 +212,8 @@ static int conf_sym(struct menu *menu)
+   break;
+   continue;
+   case 0:
++  if (!sym_has_value(sym) && !tty_stdio && 
getenv("FAIL_ON_UNCONFIGURED"))
++  exit(1);
+   newval = oldval;
+   break;
+   case '?':
diff --git a/target/linux/generic/hack-5.4/205-kconfig-exit.patch 
b/target/linux/generic/hack-5.4/205-kconfig-exit.patch
new file mode 100644
index 00..8931ad3270
--- /dev/null
+++ b/target/linux/generic/hack-5.4/205-kconfig-exit.patch
@@ -0,0 +1,11 @@
+--- a/scripts/kconfig/conf.c
 b/scripts/kconfig/conf.c
+@@ -212,6 +212,8 @@ static int conf_sym(struct menu *menu)
+   break;
+   continue;
+   case 0:
++  if (!sym_has_value(sym) && !tty_stdio && 
getenv("FAIL_ON_UNCONFIGURED"))
++  exit(1);
+   newval = oldval;
+   break;
+   case '?':
-- 
2.32.0


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


Re: [PATCH] uqmi: Move to community packages repo

2021-07-01 Thread David Bauer

[resend, as I've missed to keep the list CC'ed]

Hi Arjun

On 7/1/21 9:50 PM, Arjun AK wrote:

Signed-off-by: Arjun AK 


Describing the rationale of this change would've been nice. This package 
is used on most boards with a cellular modem to provide ootb internet 
capability, so please explain how you intend to deal with that.


And just my personal opinion: While I think it makes sense to move 
optional packages to the packages feed, this is clearly a core 
functional dependency for multiple targets. We win absolutely nothing by 
moving it to packages, but lose the ability to build images providing 
seamless ootb internet connectivity without pulling in packages feed.


Just because a lot of packages were moved in the not-so-distant past 
means this has to be done to each and every packages in core.


Best
David


---
  package/network/utils/uqmi/Makefile   |  48 --
  .../utils/uqmi/files/lib/netifd/proto/qmi.sh  | 471 --
  2 files changed, 519 deletions(-)
  delete mode 100644 package/network/utils/uqmi/Makefile
  delete mode 100755 package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh

diff --git a/package/network/utils/uqmi/Makefile 
b/package/network/utils/uqmi/Makefile
deleted file mode 100644
index 53ca67230b..00
--- a/package/network/utils/uqmi/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=uqmi
-PKG_RELEASE:=3
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git
-PKG_SOURCE_DATE:=2020-11-22
-PKG_SOURCE_VERSION:=0a19b5b77140465c29e2afa7d611fe93abc9672f
-PKG_MIRROR_HASH:=0a6641f8e167efd21d464b0b2aeb1fec5f974dddcdb8822fbd5d7190d0b741b4
-PKG_MAINTAINER:=Matti Laakso 
-
-PKG_LICENSE:=GPL-2.0
-PKG_LICENSE_FILES:=
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
-
-define Package/uqmi
-  SECTION:=net
-  CATEGORY:=Network
-  SUBMENU:=WWAN
-  DEPENDS:=+libubox +libblobmsg-json +kmod-usb-net +kmod-usb-net-qmi-wwan +wwan
-  TITLE:=Control utility for mobile broadband modems
-endef
-
-define Package/uqmi/description
-  uqmi is a command line tool for controlling mobile broadband modems using
-  the QMI-protocol.
-endef
-
-TARGET_CFLAGS += \
-   -I$(STAGING_DIR)/usr/include -ffunction-sections -fdata-sections
-
-TARGET_LDFLAGS += -Wl,--gc-sections
-
-CMAKE_OPTIONS += \
-   -DDEBUG=1
-
-define Package/uqmi/install
-   $(INSTALL_DIR) $(1)/sbin
-   $(INSTALL_BIN) $(PKG_BUILD_DIR)/uqmi $(1)/sbin/
-   $(CP) ./files/* $(1)/
-endef
-
-$(eval $(call BuildPackage,uqmi))
diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh 
b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
deleted file mode 100755
index c0134f44dd..00
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ /dev/null
@@ -1,471 +0,0 @@
-#!/bin/sh
-
-[ -n "$INCLUDE_ONLY" ] || {
-   . /lib/functions.sh
-   . ../netifd-proto.sh
-   init_proto "$@"
-}
-
-proto_qmi_init_config() {
-   available=1
-   no_device=1
-   proto_config_add_string "device:device"
-   proto_config_add_string apn
-   proto_config_add_string auth
-   proto_config_add_string username
-   proto_config_add_string password
-   proto_config_add_string pincode
-   proto_config_add_int delay
-   proto_config_add_string modes
-   proto_config_add_string pdptype
-   proto_config_add_int profile
-   proto_config_add_boolean dhcp
-   proto_config_add_boolean dhcpv6
-   proto_config_add_boolean autoconnect
-   proto_config_add_int plmn
-   proto_config_add_int timeout
-   proto_config_add_int mtu
-   proto_config_add_defaults
-}
-
-proto_qmi_setup() {
-   local interface="$1"
-   local dataformat connstat plmn_mode mcc mnc
-   local device apn auth username password pincode delay modes pdptype
-   local profile dhcp dhcpv6 autoconnect plmn timeout mtu 
$PROTO_DEFAULT_OPTIONS
-   local ip4table ip6table
-   local cid_4 pdh_4 cid_6 pdh_6
-   local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6
-
-   json_get_vars device apn auth username password pincode delay modes
-   json_get_vars pdptype profile dhcp dhcpv6 autoconnect plmn ip4table
-   json_get_vars ip6table timeout mtu $PROTO_DEFAULT_OPTIONS
-
-   [ "$timeout" = "" ] && timeout="10"
-
-   [ "$metric" = "" ] && metric="0"
-
-   [ -n "$ctl_device" ] && device=$ctl_device
-
-   [ -n "$device" ] || {
-   echo "No control device specified"
-   proto_notify_error "$interface" NO_DEVICE
-   proto_set_available "$interface" 0
-   return 1
-   }
-
-   [ -n "$delay" ] && sleep "$delay"
-
-   device="$(readlink -f $device)"
-   [ -c "$device" ] || {
-   echo "The specified control device does not exist"
-   proto_notify_error "$interface" NO_DEVICE
-   proto_set_available "$interface" 0
-   return 1
-   

[PATCH] ath79: resolve GPIO address conflicts

2021-06-30 Thread David Bauer
The ar71xx GPIO driver only uses 0x24 registers, all following GPIO
registers are using to control pinmux functions, which are not handles
by the GPIO driver but the generic Linux pinctrl driver.

For some SoC conflicting address ranges were defined for these (AR7240 &
AR9330).

Resolve these cases and align the address space of the GPIO controller
between all SoCs, as the used address space of the driver is identical
for all these.

Signed-off-by: David Bauer 
---
 target/linux/ath79/dts/ar7100.dtsi | 2 +-
 target/linux/ath79/dts/ar724x.dtsi | 2 +-
 target/linux/ath79/dts/ar9132.dtsi | 2 +-
 target/linux/ath79/dts/ar9330.dtsi | 2 +-
 target/linux/ath79/dts/ar934x.dtsi | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/linux/ath79/dts/ar7100.dtsi 
b/target/linux/ath79/dts/ar7100.dtsi
index ec6ff30ab6..86673cb5da 100644
--- a/target/linux/ath79/dts/ar7100.dtsi
+++ b/target/linux/ath79/dts/ar7100.dtsi
@@ -57,7 +57,7 @@
 
gpio: gpio@1804 {
compatible = "qca,ar7100-gpio";
-   reg = <0x1804 0x30>;
+   reg = <0x1804 0x28>;
interrupts = <2>;
 
ngpios = <16>;
diff --git a/target/linux/ath79/dts/ar724x.dtsi 
b/target/linux/ath79/dts/ar724x.dtsi
index 25d72a786c..882b0bc51a 100644
--- a/target/linux/ath79/dts/ar724x.dtsi
+++ b/target/linux/ath79/dts/ar724x.dtsi
@@ -50,7 +50,7 @@
gpio: gpio@1804 {
compatible = "qca,ar7240-gpio",
"qca,ar7100-gpio";
-   reg = <0x1804 0x30>;
+   reg = <0x1804 0x28>;
interrupts = <2>;
 
ngpios = <18>;
diff --git a/target/linux/ath79/dts/ar9132.dtsi 
b/target/linux/ath79/dts/ar9132.dtsi
index 37fc32e6d6..44a5870ad7 100644
--- a/target/linux/ath79/dts/ar9132.dtsi
+++ b/target/linux/ath79/dts/ar9132.dtsi
@@ -77,7 +77,7 @@
gpio: gpio@1804 {
compatible = "qca,ar9132-gpio",
"qca,ar7100-gpio";
-   reg = <0x1804 0x30>;
+   reg = <0x1804 0x28>;
interrupts = <2>;
 
ngpios = <22>;
diff --git a/target/linux/ath79/dts/ar9330.dtsi 
b/target/linux/ath79/dts/ar9330.dtsi
index 7607fede49..06e1cf4601 100644
--- a/target/linux/ath79/dts/ar9330.dtsi
+++ b/target/linux/ath79/dts/ar9330.dtsi
@@ -49,7 +49,7 @@
 
gpio: gpio@1804 {
compatible = "qca,ar7100-gpio";
-   reg = <0x1804 0x34>;
+   reg = <0x1804 0x28>;
interrupts = <2>;
 
ngpios = <30>;
diff --git a/target/linux/ath79/dts/ar934x.dtsi 
b/target/linux/ath79/dts/ar934x.dtsi
index 42fbab4b60..84dbe65f85 100644
--- a/target/linux/ath79/dts/ar934x.dtsi
+++ b/target/linux/ath79/dts/ar934x.dtsi
@@ -78,7 +78,7 @@
 
gpio: gpio@1804 {
compatible = "qca,ar9340-gpio";
-   reg = <0x1804 0x2c>;
+   reg = <0x1804 0x28>;
 
interrupts = <2>;
ngpios = <23>;
-- 
2.32.0


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


Re: [OpenWrt-Devel] mt76x8: Onion Omega2+ reboot problem [Was: mt76x8: Strange GPIO numbering on Onion Omega2+]

2021-06-13 Thread David Bauer
Hi Lukas,

On 6/13/21 11:43 AM, Lukas Zeller wrote:
> But I was curious to learn what the feature does, and had a look at spi-nor.c 
> (spi_nor/core.c). If I haven't misread the code, it restores the addressing 
> mode to 3 byte at shutdown. This means an orderly reboot will work, but a 
> unexpected SoC reset w/o power cycle will still hang. So if the use case is 
> something that *must* reboot after any kind of reset (e.g. HW watchdog) this 
> flag cannot fix the (HW) problem.

Note that in case of OpenWrt, there if 
481-mtd-spi-nor-rework-broken-flash-reset-support.patch,
which causes the flash to restore to 3 byte addressing after each operation.

> This implementation makes it only break when a kernel panic happens during 
> flash operation on 16M+
areas.

So it should be "good-enough" for most use-cases.

Best
David

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


Re: [PATCH v2] ramips: fix at803x patch again

2021-06-12 Thread David Bauer

Hi John,

On 6/12/21 12:51 AM, John Thomson wrote:

On Fri, 11 Jun 2021, at 08:10, David Bauer wrote:

Can you be more precise in terms of which issues are you facing? The
PHY capabilities on
the AR8333 now read 1000B-X as a supported link mode, so fiber
operation should be possible.

Can you share the capabilities advertised with current master and your
path (ethtool).

Reverting these patches would divert from upcoming kernel versions
(mind both are backports,
not downstream hacks), thus this is not a solution. Ideally, the fiber
operation should be
integrated into the upstream driver.


I agree that this should be corrected atop the backports.
It would be great to see this SFP support upstreamed.
I have not tested SFP on OpenWrt master for some time, so I cannot blame a 
change yet.

This is what I am seeing on ramips 760igs:

SFP (module, and driver LOS) has link detected, but this is not reflected by 
the interface
(which is configured in OpenWrt as part of a bridge)


I suppose what is happening here is the bootloader switched the PHY to 
the fiber page while linux now switches it to the copper page 
unconditionally.


Technically, this is correct from upstream perspective, as the PHY 
upstream only supports copper opmode. But it breaks the hacked fiber 
support downstream.


DENGs initial patch fixed this with the old downstream hacks, where the 
page was only switched when the PHY operated in SGMII mode, as the whole 
assumption this patch was based upon was wrong but lead to the correct 
result.


However, while we now get the correct link modes, we now switch to the 
fiber page upon probe.


Note that I haven't verified this, as i do not own this board. I'll 
prepare a patch and send it to this thread this weekend. Would be great 
if someone with this board could test it :)


Best
David



sfp:  mtu 1500 qdisc fq_codel master br-wan 
state DOWN qlen 1000

r16925+6-b721579842 master, plus my
SPI-NOR changes: https://github.com/openwrt/openwrt/pull/3271/commits

I do not remember these being looped in dmesg when I had working SFP:
sfp sfp1: SM: enter present:up:link_up event dev_up
sfp sfp1: SM: exit present:up:link_up

ethtool sfp
Settings for sfp:
Supported ports: [ TP MII ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
1000baseX/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
1000baseX/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Port: MII
PHYAD: 7
Transceiver: external
Auto-negotiation: on
Current message level: 0x00ff (255)
   drv probe link timer ifdown ifup rx_err tx_err
Link detected: no

Pieces missing from a very old (r14885+1-fe302d472a) working SFP build: link 
partner advertisement and link speed / duplex
 Link partner advertised link modes:  1000baseX/Full
 Link partner advertised pause frame use: Symmetric Receive-only
 Link partner advertised auto-negotiation: Yes
 Link partner advertised FEC modes: Not reported
 Speed: 1000Mb/s
 Duplex: Full
 Port: MII
 PHYAD: 7
 Transceiver: external
 Auto-negotiation: on
 Current message level: 0x00ff (255)
drv probe link timer ifdown ifup rx_err tx_err
 Link detected: yes

these cannot be forced on my current build:
ethtool -s sfp speed 1000 duplex full
[  182.182182] at803x_config_aneg: fiber


Attached:
version=$(cat /etc/openwrt_version)
mkdir -p "/tmp/sfp/$version"
dmesg > "/tmp/sfp/$version/dmesg"
logread > "/tmp/sfp/$version/logread"
ethtool sfp > "/tmp/sfp/$version/ethtool_sfp"
ethtool -m sfp > "/tmp/sfp/$version/ethtool_m_sfp"
echo -n 'file sfp.c +p' > /sys/kernel/debug/dynamic_debug/control
/etc/init.d/network restart
dmesg > "/tmp/sfp/$version/dmesg_reup"
logread > "/tmp/sfp/$version/logread_reup"
# remove, and reinsert SFP module
dmesg > "/tmp/sfp/$version/dmesg_reinsert"
logread > "/tmp/sfp/$version/logread_reinsert"

diffconfig:
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_mikrotik_routerboard-760igs=y
CONFIG_KERNEL_DYNAMIC_DEBUG=y
CONFIG_KERNEL_MTD_PARTITIONED_MASTER=y
CONFIG_PACKAGE_ethtool=y
CONFIG_ETHTOOL_PRETTY_DUMP=y

Cheers,



Re: [PATCH v2] ramips: fix at803x patch again

2021-06-11 Thread David Bauer
Hi,

On 6/11/21 8:08 AM, DENG Qingfang wrote:
> Hi David,
> 
> Unfortunately, the issue is still not resolved, according to Minqiang.
> Reverting your 2 commits and applying my patch fixes the issue.

Can you be more precise in terms of which issues are you facing? The PHY 
capabilities on
the AR8333 now read 1000B-X as a supported link mode, so fiber operation should 
be possible.

Can you share the capabilities advertised with current master and your path 
(ethtool).

Reverting these patches would divert from upcoming kernel versions (mind both 
are backports,
not downstream hacks), thus this is not a solution. Ideally, the fiber 
operation should be
integrated into the upstream driver.

Best
David

> 

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


Re: [PATCH v2] ramips: fix at803x patch again

2021-06-04 Thread David Bauer
Hi,

On 6/4/21 10:57 AM, DENG Qingfang wrote:
> Hi,
> 
> On Fri, Jun 4, 2021 at 3:37 PM David Bauer  wrote:
>> As the original patch still has to be backported to 21.02, I'd propose
>> to remove my hacks and instead properly backport c329e5af and 8f7e8762
>> from upstream.
>>
>> This would remove the need to hack around the first hack and hopefully
>> less surprises when switching to the next LTS kernel.
>>
>> What do your think?
> 
> That's okay. The SFP part still needs to be tested by Minqiang and René 
> though.

See the commit "generic: backport at803x fixes" in my staging tree [0].

I'll test this later this weekend on my AC Lite.

[0] https://git.openwrt.org/?p=openwrt/staging/blocktrron.git;a=summary

Best
David

> 
>>
>> Best
>> David
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

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


Re: [PATCH v2] ramips: fix at803x patch again

2021-06-04 Thread David Bauer
Hi,

On 6/4/21 7:12 AM, DENG Qingfang wrote:
> Commit 8222f8e1b9be overrides AR8031's PHY features, making its SFP
> link status detection unavailable. To fix that, do not override it in
> ramips patch.

As the original patch still has to be backported to 21.02, I'd propose
to remove my hacks and instead properly backport c329e5af and 8f7e8762
from upstream.

This would remove the need to hack around the first hack and hopefully
less surprises when switching to the next LTS kernel.

What do your think?

Best
David

> 
> Commit 6d4ef6792612 also moves .config_aneg to AR8035 by mistake, fix
> that as well.
> 
> Reported-by: CHEN Minqiang 
> Fixes: 8222f8e1b9be ("ath79: fix link mode support list on UniFi AC")
> Fixes: 6d4ef6792612 ("kernel: bump 5.4 to 5.4.113")
> Signed-off-by: DENG Qingfang 
> ---
> v1 -> v2: do not override .features
> 
>  .../ramips/patches-5.10/710-at803x.patch  | 13 ++--
>  .../linux/ramips/patches-5.4/991-at803x.patch | 21 ---
>  2 files changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/target/linux/ramips/patches-5.10/710-at803x.patch 
> b/target/linux/ramips/patches-5.10/710-at803x.patch
> index dab62b7607..1afc266740 100644
> --- a/target/linux/ramips/patches-5.10/710-at803x.patch
> +++ b/target/linux/ramips/patches-5.10/710-at803x.patch
> @@ -9,8 +9,8 @@ Content-Transfer-Encoding: 8bit
>  
>  Signed-off-by: René van Dorst 
>  ---
> - drivers/net/phy/at803x.c | 91 
> - 1 file changed, 91 insertions(+)
> + drivers/net/phy/at803x.c | 86 +++-
> + 1 file changed, 85 insertions(+), 1 deletion(-)
>  
>  --- a/drivers/net/phy/at803x.c
>  +++ b/drivers/net/phy/at803x.c
> @@ -147,3 +147,12 @@ Signed-off-by: René van Dorst 
>   .flags  = PHY_POLL_CABLE_TEST,
>   .probe  = at803x_probe,
>   .remove = at803x_remove,
> +@@ -1119,7 +1203,7 @@ static struct phy_driver at803x_driver[]
> + .get_wol= at803x_get_wol,
> + .suspend= at803x_suspend,
> + .resume = at803x_resume,
> +-.features   = PHY_GBIT_FEATURES,
> ++/* PHY_GBIT_FEATURES */
> + .read_status= at803x_read_status,
> + .aneg_done  = at803x_aneg_done,
> + .ack_interrupt  = _ack_interrupt,
> diff --git a/target/linux/ramips/patches-5.4/991-at803x.patch 
> b/target/linux/ramips/patches-5.4/991-at803x.patch
> index 95411211b2..9148687113 100644
> --- a/target/linux/ramips/patches-5.4/991-at803x.patch
> +++ b/target/linux/ramips/patches-5.4/991-at803x.patch
> @@ -9,8 +9,8 @@ Content-Transfer-Encoding: 8bit
>  
>  Signed-off-by: René van Dorst 
>  ---
> - drivers/net/phy/at803x.c | 91 
> - 1 file changed, 91 insertions(+)
> + drivers/net/phy/at803x.c | 93 +++-
> + 1 file changed, 92 insertions(+), 1 deletion(-)
>  
>  --- a/drivers/net/phy/at803x.c
>  +++ b/drivers/net/phy/at803x.c
> @@ -146,11 +146,18 @@ Signed-off-by: René van Dorst 
>   static struct phy_driver at803x_driver[] = {
>   {
>   /* ATHEROS 8035 */
> -@@ -461,6 +551,7 @@ static struct phy_driver at803x_driver[]
> +@@ -485,12 +575,13 @@ static struct phy_driver at803x_driver[]
> + .name   = "Atheros 8031 ethernet",
> + .phy_id_mask= AT803X_PHY_ID_MASK,
> + .probe  = at803x_probe,
> ++.config_aneg= at803x_config_aneg,
> + .config_init= at803x_config_init,
> + .set_wol= at803x_set_wol,
> + .get_wol= at803x_get_wol,
>   .suspend= at803x_suspend,
>   .resume = at803x_resume,
> - /* PHY_GBIT_FEATURES */
> -+.config_aneg= at803x_config_aneg,
> +-.features   = PHY_GBIT_FEATURES,
> ++/* PHY_GBIT_FEATURES */
>   .read_status= at803x_read_status,
> - .ack_interrupt  = at803x_ack_interrupt,
> - .config_intr= at803x_config_intr,
> + .aneg_done  = at803x_aneg_done,
> + .ack_interrupt  = _ack_interrupt,
> 

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


Re: [PATCH] ipq806x: fix LAN and WAN port assignments on TP-Link AD7200

2021-06-03 Thread David Bauer
Hi Alex,

On 6/3/21 8:18 AM, Alex Henrie wrote:
> LAN port 4 was swapped with the WAN port and the remaining three LAN
> ports were numbered in reverse order from their labels on the case.
> 
> Fixes: 1a775a4fd033 ("ipq806x: add support for TP-Link Talon AD7200")
> Signed-off-by: Alex Henrie 
> ---
>  target/linux/ipq806x/base-files/etc/board.d/02_network | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
> b/target/linux/ipq806x/base-files/etc/board.d/02_network
> index abdab89857..f0a852ece8 100644
> --- a/target/linux/ipq806x/base-files/etc/board.d/02_network
> +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
> @@ -56,7 +56,6 @@ nec,wg2600hp3)
>   "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
>   ;;
>  netgear,r7800 |\
> -tplink,ad7200 |\
>  tplink,c2600)
>   ucidef_add_switch "switch0" \
>   "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" 
> "0@eth0"
> @@ -71,6 +70,10 @@ qcom,ipq8064-db149)
>   ucidef_add_switch "switch0" \
>   "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
>   ;;
> +tplink,ad7200)
> + ucidef_add_switch "switch0" \
> + "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"

I'd suggest

"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"

so the case port numbering is explicitly added to the definition here.

Looks good otherwise.

Best
David
> + ;;
>  ubnt,unifi-ac-hd)
>   ucidef_set_interface_lan "eth0 eth1"
>   ;;
> 

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


Re: [PATCH 2/2] ethtool: add optional netlink support

2021-05-26 Thread David Bauer
Hi Robert,

On 5/16/21 6:01 PM, Robert Marko wrote:
> Netlink support is required for stuff like cable testing,
> so offer it as an option.
> 
> Signed-off-by: Robert Marko 
> ---
>  package/network/utils/ethtool/Makefile | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/package/network/utils/ethtool/Makefile 
> b/package/network/utils/ethtool/Makefile
> index d645cf9bbb..8cccf838a0 100644
> --- a/package/network/utils/ethtool/Makefile
> +++ b/package/network/utils/ethtool/Makefile
> @@ -23,7 +23,7 @@ PKG_FIXUP:=autoreconf
>  PKG_INSTALL:=1
>  PKG_BUILD_PARALLEL:=1
>  
> -PKG_CONFIG_DEPENDS:=CONFIG_ETHTOOL_PRETTY_DUMP
> +PKG_CONFIG_DEPENDS:=CONFIG_ETHTOOL_PRETTY_DUMP CONFIG_ETHTOOL_NETLINK
>  
>  include $(INCLUDE_DIR)/package.mk
>  
> @@ -32,6 +32,7 @@ define Package/ethtool
>CATEGORY:=Network
>TITLE:=Display or change ethernet card settings
>URL:=http://www.kernel.org/pub/software/network/ethtool/
> +  DEPENDS:=+ETHTOOL_NETLINK:libmnl
>  endef
>  
>  define Package/ethtool/description
> @@ -43,9 +44,17 @@ define Package/ethtool/config
>   config ETHTOOL_PRETTY_DUMP
>   depends on PACKAGE_ethtool
>   bool "Enable pretty printing"
> +
> + config ETHTOOL_NETLINK
> + depends on PACKAGE_ethtool
> + bool "Enable netlink interface"

I did submit a similar patch a while ago which i didn't yet came across to 
apply to master.

IMHO, adding netlink support as an additional build variant is superior, as it 
allows users
to obtain the virtual cable tester via OPKG, which they can not with this 
approach.

I'm aware this complicates the configuration in menuconfig. FWIW, I'd like to 
redo the config
options and provide a ethtool-full package in the future, dropping the pretty 
print build option.

Apart from that, ETHTOOL_NETLINK needs to be enabled for kernel 5.10 in order 
to actually work.

What do you think?

Best
David

>  endef
>  
> +ifeq ($(CONFIG_ETHTOOL_NETLINK),y)
> +CONFIGURE_ARGS += --enable-netlink
> +else
>  CONFIGURE_ARGS += --disable-netlink
> +endif
>  
>  ifeq ($(CONFIG_ETHTOOL_PRETTY_DUMP),y)
>  CONFIGURE_ARGS += --enable-pretty-dump
> 

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


[PATCH 2/2] hostapd: wolfssl: add RNG to EC key

2021-05-18 Thread David Bauer
Since upstream commit 6467de5a8840 ("Randomize z ordinates in
scalar mult when timing resistant") WolfSSL requires a RNG for
the EC key when built hardened which is the default.

Set the RNG for the EC key to fix connections for OWE clients.

Signed-off-by: David Bauer 
---
 package/network/services/hostapd/Makefile |  2 +-
 .../0001-wolfssl-init-RNG-with-ECC-key.patch  | 48 +++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 
package/network/services/hostapd/patches/0001-wolfssl-init-RNG-with-ECC-key.patch

diff --git a/package/network/services/hostapd/Makefile 
b/package/network/services/hostapd/Makefile
index bd2a7c96ad..0779421b8d 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=32
+PKG_RELEASE:=33
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
diff --git 
a/package/network/services/hostapd/patches/0001-wolfssl-init-RNG-with-ECC-key.patch
 
b/package/network/services/hostapd/patches/0001-wolfssl-init-RNG-with-ECC-key.patch
new file mode 100644
index 00..89d111e991
--- /dev/null
+++ 
b/package/network/services/hostapd/patches/0001-wolfssl-init-RNG-with-ECC-key.patch
@@ -0,0 +1,48 @@
+From 21ce83b4ae2b9563175fdb4fc4312096cc399cf8 Mon Sep 17 00:00:00 2001
+From: David Bauer 
+Date: Wed, 5 May 2021 00:44:34 +0200
+Subject: [PATCH] wolfssl: add RNG to EC key
+
+Since upstream commit 6467de5a8840 ("Randomize z ordinates in
+scalar mult when timing resistant") WolfSSL requires a RNG for
+the EC key when built hardened which is the default.
+
+Set the RNG for the EC key to fix connections for OWE clients.
+
+Signed-off-by: David Bauer 
+---
+ src/crypto/crypto_wolfssl.c | 4 
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c
+index 2e4bf8962..ed2528159 100644
+--- a/src/crypto/crypto_wolfssl.c
 b/src/crypto/crypto_wolfssl.c
+@@ -1303,6 +1303,7 @@ int ecc_projective_add_point(ecc_point *P, ecc_point *Q, 
ecc_point *R,
+ 
+ struct crypto_ec {
+   ecc_key key;
++  WC_RNG rng;
+   mp_int a;
+   mp_int prime;
+   mp_int order;
+@@ -1357,6 +1358,8 @@ struct crypto_ec * crypto_ec_init(int group)
+   return NULL;
+ 
+   if (wc_ecc_init(>key) != 0 ||
++  wc_InitRng(>rng) != 0 ||
++  wc_ecc_set_rng(>key, >rng) != 0 ||
+   wc_ecc_set_curve(>key, 0, curve_id) != 0 ||
+   mp_init(>a) != MP_OKAY ||
+   mp_init(>prime) != MP_OKAY ||
+@@ -1388,6 +1391,7 @@ void crypto_ec_deinit(struct crypto_ec* e)
+   mp_clear(>order);
+   mp_clear(>prime);
+   mp_clear(>a);
++  wc_FreeRng(>rng);
+   wc_ecc_free(>key);
+   os_free(e);
+ }
+-- 
+2.31.1
+
-- 
2.31.1


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


[PATCH 0/2] Fix OWE mode with hostapd-wolfssl

2021-05-18 Thread David Bauer
OWE operation of WolfSSL hostapd and wpad daemons has been broken since
WolfSSL was updated to 4.5.0.

This is due to the fact WolfSSL now requires a RNG for EC keys, however
there is no stable interface available for hardened as well as
non-hardened builds.

Patch hostapd to add the RNG to the EC key and WolfSSL to export the
interface regardless of the build settings.

David Bauer (2):
  wolfssl: always export wc_ecc_set_rng
  hostapd: wolfssl: add RNG to EC key

 package/libs/wolfssl/Makefile |  2 +-
 .../libs/wolfssl/patches/200-ecc-rng.patch| 50 +++
 package/network/services/hostapd/Makefile |  2 +-
 .../0001-wolfssl-init-RNG-with-ECC-key.patch  | 48 ++
 4 files changed, 100 insertions(+), 2 deletions(-)
 create mode 100644 package/libs/wolfssl/patches/200-ecc-rng.patch
 create mode 100644 
package/network/services/hostapd/patches/0001-wolfssl-init-RNG-with-ECC-key.patch

-- 
2.31.1


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


[PATCH 1/2] wolfssl: always export wc_ecc_set_rng

2021-05-18 Thread David Bauer
Since commit 6467de5a8840 ("Randomize z ordinates in scalar
mult when timing resistant") wolfssl requires a RNG for an EC
key when the hardened built option is selected.

wc_ecc_set_rng is only available when built hardened, so there
is no safe way to install the RNG to the key regardless whether
or not wolfssl is compiled hardened.

Always export wc_ecc_set_rng so tools such as hostapd can install
RNG regardless of the built settings for wolfssl.

Signed-off-by: David Bauer 
---
 package/libs/wolfssl/Makefile |  2 +-
 .../libs/wolfssl/patches/200-ecc-rng.patch| 50 +++
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 package/libs/wolfssl/patches/200-ecc-rng.patch

diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile
index 53cd932d1f..030a0224f5 100644
--- a/package/libs/wolfssl/Makefile
+++ b/package/libs/wolfssl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wolfssl
 PKG_VERSION:=4.7.0-stable
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION)
diff --git a/package/libs/wolfssl/patches/200-ecc-rng.patch 
b/package/libs/wolfssl/patches/200-ecc-rng.patch
new file mode 100644
index 00..2d33c06209
--- /dev/null
+++ b/package/libs/wolfssl/patches/200-ecc-rng.patch
@@ -0,0 +1,50 @@
+Since commit 6467de5a8840 ("Randomize z ordinates in scalar
+mult when timing resistant") wolfssl requires a RNG for an EC
+key when the hardened built option is selected.
+
+wc_ecc_set_rng is only available when built hardened, so there
+is no safe way to install the RNG to the key regardless whether
+or not wolfssl is compiled hardened.
+
+Always export wc_ecc_set_rng so tools such as hostapd can install
+RNG regardless of the built settings for wolfssl.
+
+--- a/wolfcrypt/src/ecc.c
 b/wolfcrypt/src/ecc.c
+@@ -10293,21 +10293,21 @@ void wc_ecc_fp_free(void)
+ 
+ #endif /* FP_ECC */
+ 
+-#ifdef ECC_TIMING_RESISTANT
+ int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng)
+ {
+ int err = 0;
+ 
++#ifdef ECC_TIMING_RESISTANT
+ if (key == NULL) {
+ err = BAD_FUNC_ARG;
+ }
+ else {
+ key->rng = rng;
+ }
++#endif
+ 
+ return err;
+ }
+-#endif
+ 
+ #ifdef HAVE_ECC_ENCRYPT
+ 
+--- a/wolfssl/wolfcrypt/ecc.h
 b/wolfssl/wolfcrypt/ecc.h
+@@ -584,10 +584,8 @@ WOLFSSL_API
+ void wc_ecc_fp_free(void);
+ WOLFSSL_LOCAL
+ void wc_ecc_fp_init(void);
+-#ifdef ECC_TIMING_RESISTANT
+ WOLFSSL_API
+ int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng);
+-#endif
+ 
+ WOLFSSL_API
+ int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id);
-- 
2.31.1


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


Re: [RFC PATCH] mac80211: use auto channel list by default

2021-05-02 Thread David Bauer
Hi Hauke,

On 5/3/21 12:23 AM, Hauke Mehrtens wrote:
> This change removes setting the channels property by default to the
> channel property if nothing else is specified.
> 
> When hostapd detects a DFS alarm and it has to switch channels allow
> hostapd to switch to any channel in the frequency band if channels
> property is not specified.

This was exactly the behavior I've tried to fix. My expectation when
configuring a specific channel would be, that the radio does not switch to
an arbitrary channel when it is forced to do DFS. Especially as DFS channels
are required to be used when the AP is used Outdoors (At least in Germany /
ETSI).

When dynamic channel usage is desired, I'd expect the user to provide a chanlist
or use the "auto" channel.

Maybe this is something which is is flexible in how it can be interpreted, so 
I'm
open to find an alternative solution for that. ;)

> When we set channels to the same channel as the channel variable it will
> not switch channel, the interface will be deactivated and hostapd writes
> this error message:
> 
> Wed Feb 10 17:24:48 2021 daemon.notice hostapd: wlan1: DFS-NOP-FINISHED 
> freq=5640 ht_enabled=0 chan_offset=0 chan_width=0 cf1=5640 cf2=0
> Wed Feb 10 17:24:48 2021 daemon.notice hostapd: wlan1: interface state 
> DFS->DFS
> Wed Feb 10 17:24:48 2021 daemon.notice hostapd: wlan1: DFS-CAC-START 
> freq=5580 chan=116 sec_chan=1, width=0, seg0=122, seg1=0, cac_time=60s
> Wed Feb 10 17:24:48 2021 daemon.err hostapd: 20/40 MHz: center segment 0 
> (=122) and center freq 1 (=5590) not in sync
> Wed Feb 10 17:24:48 2021 daemon.err hostapd: Can't set freq params
> Wed Feb 10 17:24:48 2021 daemon.err hostapd: DFS start_dfs_cac() failed, -1

Can you share your radio settings? I've tested this back when the patch was 
applied
and the radio reappeared after the NOP period.

Best
David

> 
> With this patch hostapd will switch to any other channel and continue
> operating there when it received a DFS event. When the channels property
> was set nothing changes.
> 
> Revert "mac80211: create channel list for fixed channel operation"
> 
> This reverts commit cfd2f3bf6f4825b66e9a4ca9cba7c65b93eb89c7.
> 
> Signed-off-by: Hauke Mehrtens 
> ---
>  package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
> b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> index 92c56afd24fd..d6be2ed76c36 100644
> --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> @@ -111,9 +111,6 @@ mac80211_hostapd_setup_base() {
>   json_get_values ht_capab_list ht_capab tx_burst
>   json_get_values channel_list channels
>  
> - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
> - channel_list="$channel"
> -
>   set_default noscan 0
>  
>   [ "$noscan" -gt 0 ] && hostapd_noscan=1
> 

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


Re: [PATCH rpcd] iwinfo: add 802.11ax HE support

2021-04-28 Thread David Bauer
Hi,

On 4/28/21 1:18 PM, Etienne Champetier wrote:
> Hi David,
> 
> Le mer. 28 avr. 2021 à 07:07, David Bauer  a écrit :
>>
>> Expose 802.11ax HE rate as well as HW / HT mode information. This is
>> required to add 802.11ax support to LuCI.
>>
>> Signed-off-by: David Bauer 
>> ---
>>  iwinfo.c | 45 +
>>  1 file changed, 45 insertions(+)
>>
>> diff --git a/iwinfo.c b/iwinfo.c
>> index 63ff2a1..6b376c4 100644
>> --- a/iwinfo.c
>> +++ b/iwinfo.c
> 
> ...
> 
>> }
>>  }
>> @@ -280,6 +295,9 @@ rpc_iwinfo_call_hwmodes(const char *name)
>> if (modes & IWINFO_80211_AC)
>> blobmsg_add_string(, NULL, "ac");
>>
>> +   if (modes & IWINFO_80211_AX)
>> +   blobmsg_add_string(, NULL, "ac");
> 
> I think you meant "ax" no ?

You're right. I'll fix that.

Best
David

> 
>> +
>> if (modes & IWINFO_80211_A)
>> blobmsg_add_string(, NULL, "a");
>>
> 
> ...
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

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


[PATCH rpcd] iwinfo: add 802.11ax HE support

2021-04-28 Thread David Bauer
Expose 802.11ax HE rate as well as HW / HT mode information. This is
required to add 802.11ax support to LuCI.

Signed-off-by: David Bauer 
---
 iwinfo.c | 45 +
 1 file changed, 45 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index 63ff2a1..6b376c4 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -260,6 +260,21 @@ rpc_iwinfo_call_htmodes(const char *name)
if (modes & IWINFO_HTMODE_VHT160)
blobmsg_add_string(, NULL, "VHT160");
 
+   if (modes & IWINFO_HTMODE_HE20)
+   blobmsg_add_string(, NULL, "HE20");
+
+   if (modes & IWINFO_HTMODE_HE40)
+   blobmsg_add_string(, NULL, "HE40");
+
+   if (modes & IWINFO_HTMODE_HE80)
+   blobmsg_add_string(, NULL, "HE80");
+
+   if (modes & IWINFO_HTMODE_HE80_80)
+   blobmsg_add_string(, NULL, "HE80+80");
+
+   if (modes & IWINFO_HTMODE_HE160)
+   blobmsg_add_string(, NULL, "HE160");
+
blobmsg_close_array(, c);
}
 }
@@ -280,6 +295,9 @@ rpc_iwinfo_call_hwmodes(const char *name)
if (modes & IWINFO_80211_AC)
blobmsg_add_string(, NULL, "ac");
 
+   if (modes & IWINFO_80211_AX)
+   blobmsg_add_string(, NULL, "ac");
+
if (modes & IWINFO_80211_A)
blobmsg_add_string(, NULL, "a");
 
@@ -332,6 +350,26 @@ static void rpc_iwinfo_call_hw_ht_mode()
htmode_str = "VHT160";
hwmode_str = "ac";
break;
+   case IWINFO_HTMODE_HE20:
+   htmode_str = "HE20";
+   hwmode_str = "ax";
+   break;
+   case IWINFO_HTMODE_HE40:
+   htmode_str = "HE40";
+   hwmode_str = "ax";
+   break;
+   case IWINFO_HTMODE_HE80:
+   htmode_str = "HE80";
+   hwmode_str = "ax";
+   break;
+   case IWINFO_HTMODE_HE80_80:
+   htmode_str = "HE80+80";
+   hwmode_str = "ax";
+   break;
+   case IWINFO_HTMODE_HE160:
+   htmode_str = "HE160";
+   hwmode_str = "ax";
+   break;
case IWINFO_HTMODE_NOHT:
htmode_str = "20";
hwmode_str = "a/g";
@@ -491,6 +529,7 @@ rpc_iwinfo_add_rateinfo(struct iwinfo_rate_entry *r)
 {
blobmsg_add_u8(, "ht", r->is_ht);
blobmsg_add_u8(, "vht", r->is_vht);
+   blobmsg_add_u8(, "he", r->is_he);
blobmsg_add_u32(, "mhz", r->mhz);
blobmsg_add_u32(, "rate", r->rate);
 
@@ -504,6 +543,12 @@ rpc_iwinfo_add_rateinfo(struct iwinfo_rate_entry *r)
blobmsg_add_u32(, "nss", r->nss);
blobmsg_add_u8(, "short_gi", r->is_short_gi);
}
+   else if (r->is_he) {
+   blobmsg_add_u32(, "mcs", r->mcs);
+   blobmsg_add_u32(, "nss", r->nss);
+   blobmsg_add_u32(, "he_gi", r->he_gi);
+   blobmsg_add_u32(, "he_dcm", r->he_dcm);
+   }
 }
 
 static int
-- 
2.31.1


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


[PATCH] iwinfo: add 802.11ax HE rate information

2021-04-27 Thread David Bauer
This adds 802.11ax HE specific rate information to iwinfo.

Add fields for HE status of a STA as well as DCM and guard interval
fields specific to HE operation.

Signed-off-by: David Bauer 
---
 api/nl80211.h| 12 
 include/iwinfo.h |  3 +++
 iwinfo_cli.c | 14 ++
 iwinfo_lua.c | 19 ---
 iwinfo_nl80211.c | 14 +-
 5 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/api/nl80211.h b/api/nl80211.h
index 3d252e4..22a709e 100644
--- a/api/nl80211.h
+++ b/api/nl80211.h
@@ -2353,6 +2353,13 @@ struct nl80211_sta_flag_update {
  * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is
  * a legacy rate and will be reported as the actual bitrate, i.e.
  * a quarter of the base (20 MHz) rate
+ * @NL80211_RATE_INFO_HE_MCS: HE MCS index (u8, 0-11)
+ * @NL80211_RATE_INFO_HE_NSS: HE NSS value (u8, 1-8)
+ * @NL80211_RATE_INFO_HE_GI: HE guard interval identifier
+ * (u8, see  nl80211_he_gi)
+ * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1)
+ * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then
+ * non-OFDMA was used (u8, see  nl80211_he_ru_alloc)
  * @__NL80211_RATE_INFO_AFTER_LAST: internal use
  */
 enum nl80211_rate_info {
@@ -2369,6 +2376,11 @@ enum nl80211_rate_info {
NL80211_RATE_INFO_160_MHZ_WIDTH,
NL80211_RATE_INFO_10_MHZ_WIDTH,
NL80211_RATE_INFO_5_MHZ_WIDTH,
+   NL80211_RATE_INFO_HE_MCS,
+   NL80211_RATE_INFO_HE_NSS,
+   NL80211_RATE_INFO_HE_GI,
+   NL80211_RATE_INFO_HE_DCM,
+   NL80211_RATE_INFO_HE_RU_ALLOC,
 
/* keep last */
__NL80211_RATE_INFO_AFTER_LAST,
diff --git a/include/iwinfo.h b/include/iwinfo.h
index 1956abe..3fc414b 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -110,6 +110,9 @@ struct iwinfo_rate_entry {
uint8_t is_short_gi:1;
uint8_t is_ht:1;
uint8_t is_vht:1;
+   uint8_t is_he:1;
+   uint8_t he_gi;
+   uint8_t he_dcm;
uint8_t mhz;
uint8_t nss;
 };
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 82b409c..8691f31 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -322,6 +322,20 @@ static char * format_assocrate(struct iwinfo_rate_entry *r)
l = sizeof(buf) - (p - buf);
}
}
+   else if (r->is_he)
+   {
+   p += snprintf(p, l, ", HE-MCS %d, %dMHz", r->mcs, 
r->mhz);
+   l = sizeof(buf) - (p - buf);
+
+   p += snprintf(p, l, ", HE-NSS %d", r->nss);
+   l = sizeof(buf) - (p - buf);
+
+   p += snprintf(p, l, ", HE-GI %d", r->he_gi);
+   l = sizeof(buf) - (p - buf);
+
+   p += snprintf(p, l, ", HE-DCM %d", r->he_dcm);
+   l = sizeof(buf) - (p - buf);
+   }
}
 
return buf;
diff --git a/iwinfo_lua.c b/iwinfo_lua.c
index 9935a8d..e49e454 100644
--- a/iwinfo_lua.c
+++ b/iwinfo_lua.c
@@ -268,6 +268,9 @@ static void set_rateinfo(lua_State *L, struct 
iwinfo_rate_entry *r, bool rx)
lua_pushboolean(L, r->is_vht);
lua_setfield(L, -2, rx ? "rx_vht" : "tx_vht");
 
+   lua_pushboolean(L, r->is_he);
+   lua_setfield(L, -2, rx ? "rx_he" : "tx_he");
+
lua_pushnumber(L, r->mhz);
lua_setfield(L, -2, rx ? "rx_mhz" : "tx_mhz");
 
@@ -282,7 +285,7 @@ static void set_rateinfo(lua_State *L, struct 
iwinfo_rate_entry *r, bool rx)
lua_pushboolean(L, r->is_short_gi);
lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
}
-   else if (r->is_vht)
+   else if (r->is_vht || r->is_he)
{
lua_pushnumber(L, r->mcs);
lua_setfield(L, -2, rx ? "rx_mcs" : "tx_mcs");
@@ -290,8 +293,18 @@ static void set_rateinfo(lua_State *L, struct 
iwinfo_rate_entry *r, bool rx)
lua_pushnumber(L, r->nss);
lua_setfield(L, -2, rx ? "rx_nss" : "tx_nss");
 
-   lua_pushboolean(L, r->is_short_gi);
-   lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
+   if (r->is_he) {
+   lua_pushnumber(L, r->he_gi);
+   lua_setfield(L, -2, rx ? "rx_he_gi" : "tx_he_gi");
+
+   lua_pushnumber(L, r->he_dcm);
+   lua_setfield(L, -2, rx ? "rx_he_dcm" : "tx_he_dcm");
+   }
+
+   if (r->is_vht) {
+   lua_pushboolean(L, r->is_short_gi);
+   lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
+   }

[PATCH 1/2] iwinfo: nl80211: perform split wiphy dump

2021-04-20 Thread David Bauer
Perform a split wiphy dump when acquiring the hw modelist of a mac80211
device. Otherwise HE capabilities are missing from the message.

This is necessary since upstream commit f8d504caa ("nl80211: reduce
non-split wiphy dump size")  (Kernel 5.9).

Signed-off-by: David Bauer 
---
 iwinfo_nl80211.c | 188 +++
 1 file changed, 110 insertions(+), 78 deletions(-)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 6e79ec8..aeff778 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2941,8 +2941,73 @@ struct nl80211_modes
bool ok;
uint32_t hw;
uint32_t ht;
+
+   uint32_t nl_freq;
+   uint16_t nl_ht;
+   uint32_t nl_vht;
+   uint16_t he_phy_cap[6];
 };
 
+static int nl80211_eval_modelist(struct nl80211_modes *m)
+{
+   /* Treat any nonzero capability as 11n */
+   if (m->nl_ht > 0)
+   {
+   m->hw |= IWINFO_80211_N;
+   m->ht |= IWINFO_HTMODE_HT20;
+
+   if (m->nl_ht & (1 << 1))
+   m->ht |= IWINFO_HTMODE_HT40;
+   }
+
+   if (m->he_phy_cap[0] != 0) {
+   m->hw |= IWINFO_80211_AX;
+   m->ht |= IWINFO_HTMODE_HE20;
+
+   if (m->he_phy_cap[0] & BIT(9))
+   m->ht |= IWINFO_HTMODE_HE40;
+   if (m->he_phy_cap[0] & BIT(10))
+   m->ht |= IWINFO_HTMODE_HE40 | IWINFO_HTMODE_HE80;
+   if (m->he_phy_cap[0] & BIT(11))
+   m->ht |= IWINFO_HTMODE_HE160;
+   if (m->he_phy_cap[0] & BIT(12))
+   m->ht |= IWINFO_HTMODE_HE160 | IWINFO_HTMODE_HE80_80;
+   }
+
+   if (m->nl_freq < 2485)
+   {
+   m->hw |= IWINFO_80211_B;
+   m->hw |= IWINFO_80211_G;
+   }
+   else if (m->nl_vht)
+   {
+   /* Treat any nonzero capability as 11ac */
+   if (m->nl_vht > 0)
+   {
+   m->hw |= IWINFO_80211_AC;
+   m->ht |= IWINFO_HTMODE_VHT20 | IWINFO_HTMODE_VHT40 | 
IWINFO_HTMODE_VHT80;
+
+   switch ((m->nl_vht >> 2) & 3)
+   {
+   case 2:
+   m->ht |= IWINFO_HTMODE_VHT80_80;
+   /* fall through */
+
+   case 1:
+   m->ht |= IWINFO_HTMODE_VHT160;
+   }
+   }
+   }
+   else if (m->nl_freq >= 56160)
+   {
+   m->hw |= IWINFO_80211_AD;
+   }
+   else if (!(m->hw & IWINFO_80211_AC))
+   {
+   m->hw |= IWINFO_80211_A;
+   }
+}
+
 static int nl80211_get_modelist_cb(struct nl_msg *msg, void *arg)
 {
struct nl80211_modes *m = arg;
@@ -2962,94 +3027,43 @@ static int nl80211_get_modelist_cb(struct nl_msg *msg, 
void *arg)
  nla_data(band), nla_len(band), NULL);
 
if (bands[NL80211_BAND_ATTR_HT_CAPA])
-   caps = 
nla_get_u16(bands[NL80211_BAND_ATTR_HT_CAPA]);
+   m->nl_ht = 
nla_get_u16(bands[NL80211_BAND_ATTR_HT_CAPA]);
 
-   /* Treat any nonzero capability as 11n */
-   if (caps > 0)
-   {
-   m->hw |= IWINFO_80211_N;
-   m->ht |= IWINFO_HTMODE_HT20;
-
-   if (caps & (1 << 1))
-   m->ht |= IWINFO_HTMODE_HT40;
-   }
+   if (bands[NL80211_BAND_ATTR_VHT_CAPA])
+   m->nl_vht = 
nla_get_u32(bands[NL80211_BAND_ATTR_VHT_CAPA]);
 
if (bands[NL80211_BAND_ATTR_IFTYPE_DATA]) {
struct nlattr *tb[NL80211_BAND_IFTYPE_ATTR_MAX 
+ 1];
-   uint16_t phy_cap[6] = { 0 };
struct nlattr *nl_iftype;
int rem_band;
int len;
 
-   m->hw |= IWINFO_80211_AX;
-   m->ht |= IWINFO_HTMODE_HE20;
-
nla_for_each_nested(nl_iftype, 
bands[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band) {
nla_parse(tb, 
NL80211_BAND_IFTYPE_ATTR_MAX,
  nla_data(nl_iftype), 
nla_len(nl_iftype), NULL);
if 
(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]) {
len = 
nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]);
 
-   if (

[PATCH 2/2] iwinfo: cli: fix hwmode formatting

2021-04-20 Thread David Bauer
The placeholder for the 802.11ax hwmode was missing.

Signed-off-by: David Bauer 
---
 iwinfo_cli.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index ee5a0e2..82b409c 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -274,12 +274,12 @@ static char * format_encryption(struct 
iwinfo_crypto_entry *c)
 
 static char * format_hwmodes(int modes)
 {
-   static char buf[15];
+   static char buf[17];
 
if (modes <= 0)
snprintf(buf, sizeof(buf), "unknown");
else
-   snprintf(buf, sizeof(buf), "802.11%s%s%s%s%s%s",
+   snprintf(buf, sizeof(buf), "802.11%s%s%s%s%s%s%s",
(modes & IWINFO_80211_A) ? "a" : "",
(modes & IWINFO_80211_B) ? "b" : "",
(modes & IWINFO_80211_G) ? "g" : "",
-- 
2.31.1


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


Re: [PATCH] ath79: drop cs-gpios property

2021-04-16 Thread David Bauer
Hi,

On 4/16/21 4:12 AM, Chuanhong Guo wrote:
> Hi!
> 
> On Fri, Apr 16, 2021 at 4:43 AM David Bauer  wrote:
>>
>> The spi-ath79 driver performs the chipselect by writing to dedicated
>> register in the SPI register block. So the GPIO numbers were not used.
> 
> This is cs-gpios is a hack to override incorrect num_chipselects in spi-ath79
> driver (which is set to fixed 1). spi-ath79 should be patched to fix
> this problem
> before cs-gpios for ar7161/ar7242 devices can be dropped.

Thanks for the hint, i missed ar93xx uses the newer SPI driver.

Looking at spi-ath79, the number of CS lines can be modified using platform
data, however all datasheets from ar71xx up to qca956x i could get my hand on
list 3 chipselect lines available - so a patch which sets the CS count to 3
should be sufficient?

I have some other SPI patches waiting to be sent upstream, so I can take care
of that.

Best wishes
David

> It's not needed on ar9344 because the new spi-ar934x driver doesn't have
> this problem.
> 

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


[PATCH] ath79: drop cs-gpios property

2021-04-15 Thread David Bauer
The spi-ath79 driver performs the chipselect by writing to dedicated
register in the SPI register block. So the GPIO numbers were not used.

Tested-on: Enterasys WS-AP3705i

Signed-off-by: David Bauer 
---
 target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi| 1 -
 target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi  | 2 --
 target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts | 2 --
 target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts  | 2 --
 4 files changed, 7 deletions(-)

diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi 
b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi
index 109ed0caf3..b8176dc059 100644
--- a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi
+++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi
@@ -219,7 +219,6 @@
  {
status = "okay";
 
-   cs-gpios = <0>, <0>;
 
flash0: flash@0 {
compatible = "jedec,spi-nor";
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi 
b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
index 98f6759eac..df28111598 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
@@ -107,8 +107,6 @@
  {
status = "okay";
 
-   cs-gpios = <0>, <0>;
-
flash0: flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts 
b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
index 7cb051a475..111d06491e 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
@@ -163,8 +163,6 @@
  {
status = "okay";
 
-   cs-gpios = <0>, <0>;
-
flash0: flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
diff --git a/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts 
b/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
index 52becec18b..8f8276255a 100644
--- a/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
+++ b/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
@@ -114,8 +114,6 @@
  {
status = "okay";
 
-   cs-gpios = <0>, <0>;
-
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
-- 
2.31.1


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


Re: [PATCH 2/2] generic: enable netlink ethtool interface

2021-03-05 Thread David Bauer



On 3/5/21 12:57 AM, Paul Spooren wrote:
> What's the size change?

48 kiB

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


[PATCH 1/2] ethtool: add netlink build variant

2021-03-04 Thread David Bauer
Netlink support is required for using the virtual cable tester
functionality. Thus, add a build variant with enabled netlink
support.

Signed-off-by: David Bauer 
---
 package/network/utils/ethtool/Makefile | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/package/network/utils/ethtool/Makefile 
b/package/network/utils/ethtool/Makefile
index 3efc90490b..ab068b9c20 100644
--- a/package/network/utils/ethtool/Makefile
+++ b/package/network/utils/ethtool/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ethtool
 PKG_VERSION:=5.10
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@@ -34,28 +34,46 @@ define Package/ethtool
   URL:=http://www.kernel.org/pub/software/network/ethtool/
 endef
 
+define Package/ethtool-netlink
+  $(Package/ethtool)
+  TITLE += (netlink support)
+  VARIANT:=netlink
+  PROVIDES:=ethtool
+  CONFLICTS:=ethtool
+  DEPENDS:=+libmnl
+endef
+
 define Package/ethtool/description
  ethtool is a small utility for examining and tuning your ethernet-based
  network interface
 endef
 
+Package/ethtool-netlink/description:=$(Package/ethtool/description)
+
 define Package/ethtool/config
config ETHTOOL_PRETTY_DUMP
-   depends on PACKAGE_ethtool
+   depends on PACKAGE_ethtool || PACKAGE_ethtool-netlink
bool "Enable pretty printing"
 endef
 
-CONFIGURE_ARGS += --disable-netlink
-
 ifeq ($(CONFIG_ETHTOOL_PRETTY_DUMP),y)
 CONFIGURE_ARGS += --enable-pretty-dump
 else
 CONFIGURE_ARGS += --disable-pretty-dump
 endif
 
+ifeq ($(BUILD_VARIANT),netlink)
+CONFIGURE_ARGS += --enable-netlink
+else
+CONFIGURE_ARGS += --disable-netlink
+endif
+
 define Package/ethtool/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin
 endef
 
+Package/ethtool-netlink/install=$(Package/ethtool/install)
+
 $(eval $(call BuildPackage,ethtool))
+$(eval $(call BuildPackage,ethtool-netlink))
-- 
2.30.1


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


[PATCH 2/2] generic: enable netlink ethtool interface

2021-03-04 Thread David Bauer
The virtual cable tester depends on the netlink interface for ethtool.
Thus, enable it in the generic kernel configuration.

Signed-off-by: David Bauer 
---
 target/linux/generic/config-5.10 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index 0fd3e0f5a8..a51605592d 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -1715,7 +1715,7 @@ CONFIG_EPOLL=y
 # CONFIG_ET131X is not set
 CONFIG_ETHERNET=y
 # CONFIG_ETHOC is not set
-# CONFIG_ETHTOOL_NETLINK is not set
+CONFIG_ETHTOOL_NETLINK=y
 CONFIG_EVENTFD=y
 # CONFIG_EVM is not set
 # CONFIG_EXFAT_FS is not set
-- 
2.30.1


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


[PATCH 1/2] tools: add cpio

2021-02-27 Thread David Bauer
meditak-mt7622 as well as mediatek-mt7623 require CPIO to create their
initramfs images. So build CPIO as part of the host toolchain.

Signed-off-by: David Bauer 
---
 tools/Makefile|  2 +-
 tools/cpio/Makefile   | 14 +
 .../patches/001-duplicate-program-name.patch  | 20 +++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 tools/cpio/Makefile
 create mode 100644 tools/cpio/patches/001-duplicate-program-name.patch

diff --git a/tools/Makefile b/tools/Makefile
index a2665dbc9a..65e0493e14 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -21,7 +21,7 @@ ifneq 
($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
   BUILD_B43_TOOLS = y
 endif
 
-tools-y += autoconf autoconf-archive automake bc bison cmake dosfstools
+tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
 tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
 tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
 tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image
diff --git a/tools/cpio/Makefile b/tools/cpio/Makefile
new file mode 100644
index 00..2852209847
--- /dev/null
+++ b/tools/cpio/Makefile
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cpio
+PKG_CPE_ID:=cpe:/a:gnu:cpio
+PKG_VERSION:=2.13
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNU/cpio
+PKG_HASH:=eab5bdc5ae1df285c59f2a4f140a98fc33678a0bf61bdba67d9436ae26b46f6d
+
+include $(INCLUDE_DIR)/host-build.mk
+
+$(eval $(call HostBuild))
diff --git a/tools/cpio/patches/001-duplicate-program-name.patch 
b/tools/cpio/patches/001-duplicate-program-name.patch
new file mode 100644
index 00..57ff4c3cad
--- /dev/null
+++ b/tools/cpio/patches/001-duplicate-program-name.patch
@@ -0,0 +1,20 @@
+author Sergey Poznyakoff 
+
+https://git.savannah.gnu.org/cgit/cpio.git/commit/?id=641d3f489cf6238bb916368d4ba0d9325a235afb
+
+* src/global.c: Remove superfluous declaration of program_name
+
+diff --git a/src/global.c b/src/global.c
+index fb3abe9..acf92bc 100644
+--- a/src/global.c
 b/src/global.c
+@@ -184,9 +184,6 @@ unsigned int warn_option = 0;
+ /* Extract to standard output? */
+ bool to_stdout_option = false;
+ 
+-/* The name this program was run with.  */
+-char *program_name;
+-
+ /* A pointer to either lstat or stat, depending on whether
+dereferencing of symlinks is done for input files.  */
+ int (*xstat) ();
-- 
2.30.1


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


[PATCH 2/2] include: use cpio from staging dir

2021-02-27 Thread David Bauer
As we built our own CPIO now, use this version instead of whatever the
host may or may not provide.

Signed-off-by: David Bauer 
---
 include/image.mk   | 2 +-
 include/kernel-defaults.mk | 2 +-
 include/unpack.mk  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 48911e4057..7f0d27b746 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -301,7 +301,7 @@ endif
 
 ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
   define Image/Build/cpiogz
-   ( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root | gzip -9n 
>$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
+   ( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 
root:root | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
   endef
 endif
 
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 4b39296f8c..c246857cd3 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -163,7 +163,7 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPERATE),y)
 ifeq ($(CONFIG_EXTERNAL_CPIO),y)
$(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio
 else
-   ( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root > 
$(KERNEL_BUILD_DIR)/initrd.cpio )
+   ( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 
root:root > $(KERNEL_BUILD_DIR)/initrd.cpio )
 endif
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < 
$(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -f -S .gzip -9n 
$(KERNEL_BUILD_DIR)/initrd.cpio)
diff --git a/include/unpack.mk b/include/unpack.mk
index 6a56b8e742..ebece69978 100644
--- a/include/unpack.mk
+++ b/include/unpack.mk
@@ -40,7 +40,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
   UNPACK_CMD=$(DECOMPRESS_CMD) $(TAR_CMD)
 endif
 ifeq ($(EXT),cpio)
-  UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; cpio -i -d)
+  UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; $(STAGING_DIR_HOST)/bin/cpio 
-i -d)
 endif
 ifeq ($(EXT),zip)
   UNPACK_CMD=$(UNZIP_CMD)
-- 
2.30.1


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


[PATCH] openssl: update package sources

2021-02-18 Thread David Bauer
OpenSSL downloads itself are distributed using Akamai CDN, so use these
sources as the highest priority.

Remove a stale mirror which seems to be offline for a longer time
already.

Add fallbacks to the old release path also for the mirrors.

Signed-off-by: David Bauer 
---
 package/libs/openssl/Makefile | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 4fb4cb2784..7dbbd65026 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -19,11 +19,13 @@ PKG_BUILD_PARALLEL:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:= \
+   http://www.openssl.org/source/ \
+   http://www.openssl.org/source/old/$(PKG_BASE)/ \
http://ftp.fi.muni.cz/pub/openssl/source/ \
-   http://ftp.linux.hr/pub/openssl/source/ \
+   http://ftp.fi.muni.cz/pub/openssl/source/old/$(PKG_BASE)/ \
ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \
-   http://www.openssl.org/source/ \
-   http://www.openssl.org/source/old/$(PKG_BASE)/
+   ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/
+
 PKG_HASH:=aaf2fcb575cdf6491b98ab4829abf78a3dec8402b8b81efc8f23c00d443981bf
 
 PKG_LICENSE:=OpenSSL
-- 
2.30.1


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


Re: [PATCH] mpc85xx-p1010: add Kernel 5.10 support

2021-02-18 Thread David Bauer
Hi,

On 2/18/21 6:16 PM, Adrian Schmutzler wrote:
> Hi,
> 
>> -Original Message-
>> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
>> On Behalf Of David Bauer
>> Sent: Dienstag, 16. Februar 2021 23:48
>> To: openwrt-devel@lists.openwrt.org
>> Subject: [PATCH] mpc85xx-p1010: add Kernel 5.10 support
> 
> no offense, but I wonder whether bumping by subtargets is really the way to 
> go here?

I'd rater bump a subtarget for which i at least know a board boots with the 
patches
than bump the complete target and break 2/3 subtargets in the process.

Best wishes
David

> 
> Best
> 
> Adrian
> 
>>
>> Tested on: Sophos RED 15W
>>
>> The TP-Link WL-WDR4900 needs to be disabled when 5.10 becomes the
>> default kernel.
>>
>> When building with all kmods enabled, the resulting kernel image exceeds
>> the maximum size the bootloader reads from the flash.
>>
>> For more information, see GitHub issue #1773
>>
>> Signed-off-by: David Bauer 
>> ---
>>  target/linux/mpc85xx/config-5.10  | 280 ++
>>  target/linux/mpc85xx/p1010/target.mk  |   2 +
>>  ...85xx-add-gpio-keys-to-of-match-table.patch |  10 +  ...0-powerpc-85xx-tl-
>> wdr4900-v1-support.patch |  83 ++  .../101-powerpc-85xx-hiveap-330-
>> support.patch |  30 ++
>>  .../102-powerpc-add-cmdline-override.patch|  37 +++
>>  .../103-powerpc-85xx-red-15w-rev1.patch   |  29 ++
>>  ...change-P2020RDB-dts-file-for-OpenWRT.patch | 162 ++
>>  .../105-powerpc-85xx-panda-support.patch  |  30 ++
>>  .../106-powerpc-85xx-ws-ap3710i-support.patch |  30 ++  ...ootwrapper-
>> disable-uImage-generation.patch |  42 +++
>>  11 files changed, 735 insertions(+)
>>  create mode 100644 target/linux/mpc85xx/config-5.10  create mode 100644
>> target/linux/mpc85xx/patches-5.10/001-powerpc-85xx-add-gpio-keys-to-of-
>> match-table.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/100-powerpc-85xx-
>> tl-wdr4900-v1-support.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/101-powerpc-85xx-
>> hiveap-330-support.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/102-powerpc-add-
>> cmdline-override.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/103-powerpc-85xx-
>> red-15w-rev1.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/104-powerpc-
>> mpc85xx-change-P2020RDB-dts-file-for-OpenWRT.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/105-powerpc-85xx-
>> panda-support.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/106-powerpc-85xx-
>> ws-ap3710i-support.patch
>>  create mode 100644 target/linux/mpc85xx/patches-5.10/900-powerpc-
>> bootwrapper-disable-uImage-generation.patch
>>
>> diff --git a/target/linux/mpc85xx/config-5.10 b/target/linux/mpc85xx/config-
>> 5.10
>> new file mode 100644
>> index 00..cb0d08ba91
>> --- /dev/null
>> +++ b/target/linux/mpc85xx/config-5.10
>> @@ -0,0 +1,280 @@
>> +# CONFIG_40x is not set
>> +# CONFIG_44x is not set
>> +# CONFIG_ADVANCED_OPTIONS is not set
>> +CONFIG_AR8216_PHY=y
>> +CONFIG_AR8216_PHY_LEDS=y
>> +CONFIG_ARCH_32BIT_OFF_T=y
>> +CONFIG_ARCH_HIBERNATION_POSSIBLE=y
>> +CONFIG_ARCH_KEEP_MEMBLOCK=y
>> +CONFIG_ARCH_MAY_HAVE_PC_FDC=y
>> +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
>> +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
>> +CONFIG_ARCH_MMAP_RND_BITS=11
>> +CONFIG_ARCH_MMAP_RND_BITS_MAX=17
>> +CONFIG_ARCH_MMAP_RND_BITS_MIN=11
>> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17
>> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
>> +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
>> +CONFIG_ARCH_SUSPEND_POSSIBLE=y
>> +CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
>> +CONFIG_ASN1=y
>> +CONFIG_AUDIT_ARCH=y
>> +CONFIG_BLK_MQ_PCI=y
>> +CONFIG_BOOKE=y
>> +CONFIG_BOOKE_WDT=y
>> +# CONFIG_BSC9131_RDB is not set
>> +# CONFIG_BSC9132_QDS is not set
>> +# CONFIG_C293_PCIE is not set
>> +CONFIG_CLONE_BACKWARDS=y
>> +CONFIG_CLZ_TAB=y
>> +CONFIG_CMDLINE="console=ttyS0,115200"
>> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>> +# CONFIG_CMDLINE_OVERRIDE is not set
>> +# CONFIG_COMMON_CLK is not set
>> +CONFIG_COMPAT_32BIT_TIME=y
>> +# CONFIG_CORENET_GENERIC is not set
>> +# CONFIG_CPM2 is not set
>> +CONFIG_CPU_BIG_ENDIAN=y
>> +CONFIG_CRYPTO_AEAD=y
>> +CONFIG_CRYPTO_AEAD2=y
>> +# CONFIG_CRYPTO_AES_PPC_SPE is not set
>> +CONFIG_CRYPTO_AKCIPHER=y
>> +CONFIG_CRYPTO_AKCIPHER2=y
>> +CONFIG_CRYPTO_AUT

Re: [PATCH] mpc85xx-p1010: add Kernel 5.10 support

2021-02-17 Thread David Bauer
Hi,

On 2/17/21 9:20 AM, Perry wrote:
> Hello,
> 
> I thought the kernel size issue was resolved by 
> 1e41de2f48e284c9d6658f9403365651178f6826
> 
> Also, the linked PR #1773 has a happy ending.
> 
> Is the simpleImage no longer a viable solution? Could you explain why not?

the issue was resolved for v5.4 with using a different PPC bootwrapper. However,
as the kernel grew again with v5.10, this was already back then set to break 
again in
the future, as the bootwrapper only enables a more efficient compression but 
does not by
itself read from the flash.

Best wishes
David

> 
> Greetings
> Perry 
> 
> On February 17, 2021 5:59:28 AM GMT+01:00, David Bauer  
> wrote:
>> Hi Daniel,
>>
>> On 2/17/21 4:21 AM, Daniel Golle wrote:
>>> On Tue, Feb 16, 2021 at 11:48:04PM +0100, David Bauer wrote:
>>>> Tested on: Sophos RED 15W
>>>>
>>>> The TP-Link WL-WDR4900 needs to be disabled when 5.10 becomes the
>>>> default kernel.
>>>
>>> That's sad. Why?
>>
>> See the next sentence ;) as well as this GitHub issue:
>> https://github.com/openwrt/openwrt/pull/1773
>>
>> Best
>> David
>>>
>>> ___
>>> openwrt-devel mailing list
>>> openwrt-devel@lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>
>>
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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


Re: [PATCH] mpc85xx-p1010: add Kernel 5.10 support

2021-02-16 Thread David Bauer
Hi Daniel,

On 2/17/21 4:21 AM, Daniel Golle wrote:
> On Tue, Feb 16, 2021 at 11:48:04PM +0100, David Bauer wrote:
>> Tested on: Sophos RED 15W
>>
>> The TP-Link WL-WDR4900 needs to be disabled when 5.10 becomes the
>> default kernel.
> 
> That's sad. Why?

See the next sentence ;) as well as this GitHub issue:
https://github.com/openwrt/openwrt/pull/1773

Best
David
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

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


[PATCH] generic: don't lock when recursively deleting partitions

2021-02-16 Thread David Bauer
When recursively deleting partitions, don't acquire the masters
partition lock twice. Otherwise the process endy up in a deadlocked
state.

Signed-off-by: David Bauer 
---
 ...when-recursively-deleting-partitions.patch | 24 +++
 1 file changed, 24 insertions(+)
 create mode 100644 
target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch

diff --git 
a/target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch
 
b/target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch
new file mode 100644
index 00..505131b684
--- /dev/null
+++ 
b/target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch
@@ -0,0 +1,24 @@
+From: David Bauer 
+Date: Wed, 17 Feb 2021 03:21:39 +0100
+Subject: [PATCH] mtd: don't lock when recursively deleting partitions
+
+When recursively deleting partitions, don't acquire the masters
+partition lock twice. Otherwise the process endy up in a deadlocked
+state.
+
+Signed-off-by: David Bauer 
+---
+ drivers/mtd/mtdpart.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/mtdpart.c
 b/drivers/mtd/mtdpart.c
+@@ -474,7 +474,7 @@ static int __del_mtd_partitions(struct m
+ 
+   list_for_each_entry_safe(child, next, >partitions, part.node) {
+   if (mtd_has_partitions(child))
+-  del_mtd_partitions(child);
++  __del_mtd_partitions(child);
+ 
+   pr_info("Deleting %s MTD partition\n", child->name);
+   ret = del_mtd_device(child);
-- 
2.30.1


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


[PATCH] rockchip: add Kernel 5.10 support

2021-02-16 Thread David Bauer
Remove all upstreamed patches and add the kernel configuration for
version 5.10.

The Rock Pi 4 was split in multiple versions. Add a DTS with the old
name in order to keep compatibility while having kernel 5.4 and 5.10 in
parallel. Switch to the Rock Pi 4A DTS once Kernel 5.4 support is
removed.

Tested-on: Nanoi R2S

Signed-off-by: David Bauer 
---
 target/linux/rockchip/Makefile|   1 +
 target/linux/rockchip/armv8/config-5.10   | 673 ++
 target/linux/rockchip/armv8/config-5.4| 165 -
 target/linux/rockchip/config-default  | 297 
 .../boot/dts/rockchip/rk3399-rock-pi-4.dts|  19 +
 ...-r8152-add-LED-configuration-from-OF.patch |  74 ++
 ...et-add-RTL8152-binding-documentation.patch |  54 ++
 ...-rockchip-use-system-LED-for-OpenWrt.patch |  31 +
 ...usb3-controller-node-for-RK3328-SoCs.patch |  62 ++
 ...ckchip-enable-LAN-port-on-NanoPi-R2S.patch |  60 ++
 ...dd-OF-node-for-USB-eth-on-NanoPi-R2S.patch |  28 +
 ...-host-by-default-on-rk3399-rock-pi-4.patch |  32 +
 12 files changed, 1178 insertions(+), 318 deletions(-)
 create mode 100644 target/linux/rockchip/armv8/config-5.10
 delete mode 100644 target/linux/rockchip/config-default
 create mode 100644 
target/linux/rockchip/files-5.10/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts
 create mode 100644 
target/linux/rockchip/patches-5.10/002-net-usb-r8152-add-LED-configuration-from-OF.patch
 create mode 100644 
target/linux/rockchip/patches-5.10/003-dt-bindings-net-add-RTL8152-binding-documentation.patch
 create mode 100644 
target/linux/rockchip/patches-5.10/100-rockchip-use-system-LED-for-OpenWrt.patch
 create mode 100644 
target/linux/rockchip/patches-5.10/101-dts-rockchip-add-usb3-controller-node-for-RK3328-SoCs.patch
 create mode 100644 
target/linux/rockchip/patches-5.10/102-rockchip-enable-LAN-port-on-NanoPi-R2S.patch
 create mode 100644 
target/linux/rockchip/patches-5.10/103-arm64-rockchip-add-OF-node-for-USB-eth-on-NanoPi-R2S.patch
 create mode 100644 
target/linux/rockchip/patches-5.10/104-rockchip-use-USB-host-by-default-on-rk3399-rock-pi-4.patch

diff --git a/target/linux/rockchip/Makefile b/target/linux/rockchip/Makefile
index bcc0cc3f8f..7aeb0a3d55 100644
--- a/target/linux/rockchip/Makefile
+++ b/target/linux/rockchip/Makefile
@@ -8,6 +8,7 @@ FEATURES:=ext4 audio usb usbgadget display gpio fpu rootfs-part 
boot-part squash
 SUBTARGETS:=armv8
 
 KERNEL_PATCHVER=5.4
+KERNEL_TESTING_PATCHVER=5.10
 
 define Target/Description
Build firmware image for Rockchip SoC devices.
diff --git a/target/linux/rockchip/armv8/config-5.10 
b/target/linux/rockchip/armv8/config-5.10
new file mode 100644
index 00..80230a722b
--- /dev/null
+++ b/target/linux/rockchip/armv8/config-5.10
@@ -0,0 +1,673 @@
+CONFIG_64BIT=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=33
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_PROC_KCORE_TEXT=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_STACKWALK=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARC_EMAC_CORE=y
+CONFIG_ARM64=y
+CONFIG_ARM64_4K_PAGES=y
+CONFIG_ARM64_CNP=y
+# CONFIG_ARM64_ERRATUM_1165522 is not set
+# CONFIG_ARM64_ERRATUM_1286807 is not set
+# CONFIG_ARM64_ERRATUM_1418040 is not set
+CONFIG_ARM64_ERRATUM_819472=y
+CONFIG_ARM64_ERRATUM_824069=y
+CONFIG_ARM64_ERRATUM_826319=y
+CONFIG_ARM64_ERRATUM_827319=y
+CONFIG_ARM64_ERRATUM_832075=y
+CONFIG_ARM64_ERRATUM_843419=y
+CONFIG_ARM64_ERRATUM_845719=y
+CONFIG_ARM64_ERRATUM_858921=y
+CONFIG_ARM64_HW_AFDBM=y
+CONFIG_ARM64_MODULE_PLTS=y
+CONFIG_ARM64_PAGE_SHIFT=12
+CONFIG_ARM64_PAN=y
+CONFIG_ARM64_PA_BITS=48
+CONFIG_ARM64_PA_BITS_48=y
+CONFIG_ARM64_PTR_AUTH=y
+CONFIG_ARM64_RAS_EXTN=y
+CONFIG_ARM64_SVE=y
+# CONFIG_ARM64_SW_TTBR0_PAN is not set
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_ARM64_UAO=y
+CONFIG_ARM64_VA_BITS=48
+# CONFIG_ARM64_VA_BITS_39 is not set
+CONFIG_ARM64_VA_BITS_48=y
+CONFIG_ARM64_VHE=y
+CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
+# CONFIG_ARMV8_DEPRECATED is not set
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y
+CONFIG_ARM_CPUIDLE=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V2M=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_MHU=y
+CONFIG_ARM_PSCI_CPUIDLE=y
+CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y
+CONFIG_ARM_PSCI_FW=y
+# CONFIG_ARM_RK3399_DMC_DEVFREQ is not set
+# CONFIG_ARM_SCMI_PROTOCOL is not set
+CONFIG_ARM_SCPI_CPUFREQ=y
+CONFIG_ARM_SCPI_POWER_DOMAIN=y
+CONFIG_ARM_SCPI_PROTOCOL=y
+CONFIG_ARM_SMMU=y
+CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT=y
+# CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS is not set
+CONFIG_ARM_SMMU_V3=y
+# CONFIG_ARM_SMMU_V3_SVA is not set
+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y

[PATCH] mpc85xx-p1010: add Kernel 5.10 support

2021-02-16 Thread David Bauer
Tested on: Sophos RED 15W

The TP-Link WL-WDR4900 needs to be disabled when 5.10 becomes the
default kernel.

When building with all kmods enabled, the resulting kernel image
exceeds the maximum size the bootloader reads from the flash.

For more information, see GitHub issue #1773

Signed-off-by: David Bauer 
---
 target/linux/mpc85xx/config-5.10  | 280 ++
 target/linux/mpc85xx/p1010/target.mk  |   2 +
 ...85xx-add-gpio-keys-to-of-match-table.patch |  10 +
 ...0-powerpc-85xx-tl-wdr4900-v1-support.patch |  83 ++
 .../101-powerpc-85xx-hiveap-330-support.patch |  30 ++
 .../102-powerpc-add-cmdline-override.patch|  37 +++
 .../103-powerpc-85xx-red-15w-rev1.patch   |  29 ++
 ...change-P2020RDB-dts-file-for-OpenWRT.patch | 162 ++
 .../105-powerpc-85xx-panda-support.patch  |  30 ++
 .../106-powerpc-85xx-ws-ap3710i-support.patch |  30 ++
 ...ootwrapper-disable-uImage-generation.patch |  42 +++
 11 files changed, 735 insertions(+)
 create mode 100644 target/linux/mpc85xx/config-5.10
 create mode 100644 
target/linux/mpc85xx/patches-5.10/001-powerpc-85xx-add-gpio-keys-to-of-match-table.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/100-powerpc-85xx-tl-wdr4900-v1-support.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/101-powerpc-85xx-hiveap-330-support.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/103-powerpc-85xx-red-15w-rev1.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/104-powerpc-mpc85xx-change-P2020RDB-dts-file-for-OpenWRT.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/105-powerpc-85xx-panda-support.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/106-powerpc-85xx-ws-ap3710i-support.patch
 create mode 100644 
target/linux/mpc85xx/patches-5.10/900-powerpc-bootwrapper-disable-uImage-generation.patch

diff --git a/target/linux/mpc85xx/config-5.10 b/target/linux/mpc85xx/config-5.10
new file mode 100644
index 00..cb0d08ba91
--- /dev/null
+++ b/target/linux/mpc85xx/config-5.10
@@ -0,0 +1,280 @@
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_ADVANCED_OPTIONS is not set
+CONFIG_AR8216_PHY=y
+CONFIG_AR8216_PHY_LEDS=y
+CONFIG_ARCH_32BIT_OFF_T=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_BITS=11
+CONFIG_ARCH_MMAP_RND_BITS_MAX=17
+CONFIG_ARCH_MMAP_RND_BITS_MIN=11
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
+CONFIG_ASN1=y
+CONFIG_AUDIT_ARCH=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BOOKE=y
+CONFIG_BOOKE_WDT=y
+# CONFIG_BSC9131_RDB is not set
+# CONFIG_BSC9132_QDS is not set
+# CONFIG_C293_PCIE is not set
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CLZ_TAB=y
+CONFIG_CMDLINE="console=ttyS0,115200"
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
+# CONFIG_CMDLINE_OVERRIDE is not set
+# CONFIG_COMMON_CLK is not set
+CONFIG_COMPAT_32BIT_TIME=y
+# CONFIG_CORENET_GENERIC is not set
+# CONFIG_CPM2 is not set
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+# CONFIG_CRYPTO_AES_PPC_SPE is not set
+CONFIG_CRYPTO_AKCIPHER=y
+CONFIG_CRYPTO_AKCIPHER2=y
+CONFIG_CRYPTO_AUTHENC=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_MD5_PPC is not set
+CONFIG_CRYPTO_NULL=y
+CONFIG_CRYPTO_NULL2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_RSA=y
+# CONFIG_CRYPTO_SHA1_PPC is not set
+# CONFIG_CRYPTO_SHA1_PPC_SPE is not set
+# CONFIG_CRYPTO_SHA256_PPC_SPE is not set
+CONFIG_DATA_SHIFT=12
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DNOTIFY=y
+CONFIG_DTC=y
+# CONFIG_E200 is not set
+CONFIG_E500=y
+# CONFIG_E5500_CPU is not set
+# CONFIG_E6500_CPU is not set
+CONFIG_EARLY_PRINTK=y
+CONFIG_EDAC_ATOMIC_SCRUB=y
+CONFIG_EDAC_SUPPORT=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FIXED_PHY=y
+CONFIG_FSL_BOOKE=y
+CONFIG_FSL_EMB_PERFMON=y
+# CONFIG_FSL_ENETC_MDIO is not set
+# CONFIG_FSL_FMAN is not set
+CONFIG_FSL_LBC=y
+CONFIG_FSL_PCI=y
+CONFIG_FSL_PQ_MDIO=y
+CONFIG_FSL_SOC=y
+CONFIG_FSL_SOC_BOOKE=y
+CONFIG_FW_LOADER_PAGED_BUF=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_CPU=y
+CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_CPU_VULNERABILITIES=y
+CONFIG_GENERIC_EARLY_IOREMAP=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GEN_RTC=y
+# CONFIG_GE_IMP3A is not set
+CONFIG_GIANFAR=y
+CONFIG

[PATCH 2/2] mediatek: add support for Ubiquiti UniFi 6 LR

2021-02-15 Thread David Bauer
Hardware


MediaTek MT7622
512MB DDR3 RAM
64M SPI-NOR Flash (Winbond W25Q512JV)
MediaTek MT7622 802.11bgn 4T4R WMAC
MediaTek MT7915 802.11ax 4T4R
Marvell AQR1112 100/1000/2500 NBase-T PHY
Holtek HT32F52241 LED controller
Reset Switch

UART


CPU UART0 at the pinout next to the Holtek MCU.

Pinout (first pin next to SoC / MCU)

0 3V3
1 RX
2 TX
3 GND

Settings are 115200 8N1.

Opening the case


Opening the case is not a nice task, as itis glued together. Insert a
flat knife between the front and back casing below the ethernet port.
Open up a gap this way and insert a flat scredriver, remove the knife.

Work your way around the casing by applying force to seperate the front
and back casing. This losens the glue and opens the plastic clips. Be
gentle, as these clips are very cheap and break quickly.

Installation


1. Connect to the booted device at 192.168.1.20 using username/password
   "ubnt".

2. Transfer the OpenWrt sysupgrade image to the device using SCP.

3. Check the mtd partition number for bs / kernel0 / kernel1

   $ cat /proc/mtd

4. Set the bootselect flag to boot from kernel0

   $ dd if=/dev/zero bs=1 count=1 of=/dev/mtdblock6

5. Write the OpenWrt sysupgrade image to both kernel0 as well as kernel1

   $ dd if=openwrt.bin of=/dev/mtdblock8
   $ dd if=openwrt.bin of=/dev/mtdblock9

6. Reboot the device. It should boot into OpenWrt.

Signed-off-by: David Bauer 
---
 .../lib/preinit/05_set_preinit_iface  |  10 +-
 .../dts/mediatek/mt7622-ubnt-unifi-6-lr.dts   | 327 ++
 target/linux/mediatek/image/mt7622.mk |   9 +
 .../mt7622/base-files/etc/board.d/02_network  |   3 +
 target/linux/mediatek/mt7622/config-5.4   |   6 +-
 .../patches-5.4/1020-spi-nor-w25q512jv.patch  |  25 ++
 6 files changed, 378 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts
 create mode 100644 
target/linux/mediatek/patches-5.4/1020-spi-nor-w25q512jv.patch

diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface 
b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface
index f39e8aee8d..3ac856d1c4 100644
--- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface
+++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface
@@ -1,6 +1,14 @@
 set_preinit_iface() {
ip link set eth0 up
-   ifname=lan1
+
+   case $(board_name) in
+   ubnt,unifi-6-lr)
+   ifname=eth0
+   ;;
+   *)
+   ifname=lan1
+   ;;
+   esac
 }
 
 boot_hook_add preinit_main set_preinit_iface
diff --git 
a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts
 
b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts
new file mode 100644
index 00..1f410b1d47
--- /dev/null
+++ 
b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts
@@ -0,0 +1,327 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include 
+#include 
+#include 
+
+#include "mt7622.dtsi"
+#include "mt6380.dtsi"
+
+/ {
+   model = "Ubiquiti UniFi 6 LR";
+   compatible = "ubnt,unifi-6-lr", "mediatek,mt7622";
+
+   aliases {
+   led-boot = _blue;
+   led-failsafe = _blue;
+   led-running = _blue;
+   led-upgrade = _blue;
+   label-mac-device = 
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 
console=ttyS0,115200n8";
+   };
+
+   cpus {
+   cpu@0 {
+   proc-supply = <_vcpu_reg>;
+   sram-supply = <_vm_reg>;
+   };
+
+   cpu@1 {
+   proc-supply = <_vcpu_reg>;
+   sram-supply = <_vm_reg>;
+   };
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+
+   reset {
+   label = "reset";
+   linux,code = ;
+   gpios = < 62 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   memory {
+   reg = <0 0x4000 0 0x3f00>;
+   };
+
+   reg_1p8v: regulator-1p8v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator-3p3v {
+   compatible = "regulator-fixed";
+   regulator-name = "fix

[PATCH 1/2] mediatek: add Ubiquiti LED driver

2021-02-15 Thread David Bauer
Add a driver for controlling the RGB LED via Ubiquitis own "LEDBAR" LED
controller based on the Holtek HT32F52241 MCU.

This driver is initially used by the Ubiquiti UniFi 6 LR, however
judging from FCC pictures the MCU is also found on the U6-Mesh as well
as the U6-Extender.

Signed-off-by: David Bauer 
---
 .../files-5.4/drivers/leds/leds-ubnt-ledbar.c | 210 ++
 target/linux/mediatek/mt7622/config-5.4   |   1 +
 target/linux/mediatek/mt7623/config-5.4   |   1 +
 target/linux/mediatek/mt7629/config-5.4   |   1 +
 .../patches-5.4/1021-ubnt-ledbar-driver.patch |  29 +++
 5 files changed, 242 insertions(+)
 create mode 100644 
target/linux/mediatek/files-5.4/drivers/leds/leds-ubnt-ledbar.c
 create mode 100644 
target/linux/mediatek/patches-5.4/1021-ubnt-ledbar-driver.patch

diff --git a/target/linux/mediatek/files-5.4/drivers/leds/leds-ubnt-ledbar.c 
b/target/linux/mediatek/files-5.4/drivers/leds/leds-ubnt-ledbar.c
new file mode 100644
index 00..1f50038b8c
--- /dev/null
+++ b/target/linux/mediatek/files-5.4/drivers/leds/leds-ubnt-ledbar.c
@@ -0,0 +1,210 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * Driver for the Ubiquiti RGB LED controller (LEDBAR).
+ * This Controller is based on a Holtek HT32F52241 and connected
+ * via I2C.
+ *
+ *  - The Controller needs an enable signal set to high when
+ *performing a transaction. On the U6-LR, this is located
+ *at Pin 18 (R6902)
+ *
+ *  - The Pin is also printed when calling the "usetled" function
+ *contained in the ubntapp bootloader application.
+ */
+
+#define UBNT_LEDBAR_MAX_BRIGHTNESS 0xff
+
+#define UBNT_LEDBAR_TRANSACTION_LENGTH 8
+#define UBNT_LEDBAR_TRANSACTION_SUCCESS0xaa
+
+#define UBNT_LEDBAR_TRANSACTION_BLUE_IDX   2
+#define UBNT_LEDBAR_TRANSACTION_GREEN_IDX  3
+#define UBNT_LEDBAR_TRANSACTION_RED_IDX4
+
+struct ubnt_ledbar {
+   struct mutex lock;
+   struct i2c_client *client;
+   struct led_classdev led_red;
+   struct led_classdev led_green;
+   struct led_classdev led_blue;
+   struct gpio_desc *enable_gpio;
+};
+
+static int ubnt_ledbar_perform_transaction(struct ubnt_ledbar *ledbar,
+  char *transaction)
+{
+   int ret;
+   int i;
+
+   for (i = 0; i < UBNT_LEDBAR_TRANSACTION_LENGTH; i++)
+   i2c_smbus_write_byte(ledbar->client, transaction[i]);
+
+   return i2c_smbus_read_byte(ledbar->client);
+}
+
+static int ubnt_ledbar_apply_state(struct ubnt_ledbar *ledbar)
+{
+   char setup_msg[UBNT_LEDBAR_TRANSACTION_LENGTH] = {0x40, 0x10, 0x00, 
0x00,
+ 0x00, 0x00, 0x00, 
0x11};
+   char led_msg[UBNT_LEDBAR_TRANSACTION_LENGTH] = {0x40, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x01, 0x00};
+   char i2c_response;
+   int ret = 0;
+
+   mutex_lock(>lock);
+
+   led_msg[UBNT_LEDBAR_TRANSACTION_BLUE_IDX] = ledbar->led_blue.brightness;
+   led_msg[UBNT_LEDBAR_TRANSACTION_GREEN_IDX] = 
ledbar->led_green.brightness;
+   led_msg[UBNT_LEDBAR_TRANSACTION_RED_IDX] = ledbar->led_red.brightness;
+
+   gpiod_set_raw_value(ledbar->enable_gpio, 1);
+
+   msleep(10);
+
+   i2c_response = ubnt_ledbar_perform_transaction(ledbar, setup_msg);
+   if (i2c_response != UBNT_LEDBAR_TRANSACTION_SUCCESS) {
+   dev_err(>client->dev, "Error initializing LED 
transaction: %02x\n", ret);
+   ret = -EINVAL;
+   goto out_gpio;
+   }
+
+   i2c_response = ubnt_ledbar_perform_transaction(ledbar, led_msg);
+   if (i2c_response != UBNT_LEDBAR_TRANSACTION_SUCCESS) {
+   dev_err(>client->dev, "Failed LED transaction: %02x\n", 
ret);
+   ret = -EINVAL;
+   goto out_gpio;
+   }
+
+   msleep(10);
+out_gpio:
+   gpiod_set_raw_value(ledbar->enable_gpio, 0);
+
+   mutex_unlock(>lock);
+
+   return ret;
+}
+
+#define UBNT_LEDBAR_CONTROL_RGBS(name) \
+static int ubnt_ledbar_set_##name##_brightness(struct led_classdev *led_cdev,\
+   enum led_brightness value)  \
+{  \
+   struct ubnt_ledbar *ledbar = \
+   container_of(led_cdev, struct ubnt_ledbar, led_##name); 
\
+   int ret; \
+   led_cdev->brightness = value; \
+   ret = ubnt_ledbar_apply_state(ledbar); \
+   return ret; \
+}
+
+UBNT_LEDBAR_CONTROL_RGBS(red);
+UBNT_LEDBAR_CONTROL_RGBS(green);
+UBNT_LEDBAR_CONTROL_RGBS(blue);
+
+
+static int ubnt_ledbar_init_led(struct device_node *np, struct ubnt_ledbar 
*ledbar,
+   struct le

[PATCH] sdk: expose binary strip settings

2021-02-07 Thread David Bauer
Expose the SDK options for binary stripping to the menuconfig. This
way, packages can easily be built with debug symbols using the SDK.

Signed-off-by: David Bauer 
---
 target/sdk/files/Config.in | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in
index 4393daab5b..f687992497 100644
--- a/target/sdk/files/Config.in
+++ b/target/sdk/files/Config.in
@@ -18,6 +18,52 @@ menu "Global build settings"
bool "Cryptographically sign package lists"
default y
 
+   comment "Package build options"
+
+   config DEBUG
+   bool
+   prompt "Compile packages with debugging info"
+   default n
+   help
+ Adds -g3 to the CFLAGS.
+
+   comment "Stripping options"
+
+   choice
+   prompt "Binary stripping method"
+   default USE_STRIP   if EXTERNAL_TOOLCHAIN
+   default USE_STRIP   if USE_GLIBC
+   default USE_SSTRIP
+   help
+ Select the binary stripping method you wish to use.
+
+   config NO_STRIP
+   bool "none"
+   help
+ This will install unstripped binaries (useful for 
native
+ compiling/debugging).
+
+   config USE_STRIP
+   bool "strip"
+   help
+ This will install binaries stripped using strip from 
binutils.
+
+   config USE_SSTRIP
+   bool "sstrip"
+   depends on !USE_GLIBC
+   help
+ This will install binaries stripped using sstrip.
+   endchoice
+
+   config STRIP_ARGS
+   string
+   prompt "Strip arguments"
+   depends on USE_STRIP
+   default "--strip-unneeded --remove-section=.comment 
--remove-section=.note" if DEBUG
+   default "--strip-all"
+   help
+ Specifies arguments passed to the strip command when 
stripping binaries.
+
 endmenu
 
 menu "Advanced configuration options (for developers)"
-- 
2.30.0


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


[PATCH iwinfo] iwinfo: add basic IEEE 802.11ax support

2021-02-03 Thread David Bauer
This adds basic support for IEEE 802.11ax when requesting HW or HT
Modelist for a PHY from iwinfo. This way, applications using iwinfo can
detect HE phys.

Signed-off-by: David Bauer 
---
 api/nl80211.h| 38 ++
 include/iwinfo.h |  8 +++-
 iwinfo_cli.c |  3 ++-
 iwinfo_lib.c |  7 ++-
 iwinfo_lua.c |  3 +++
 iwinfo_nl80211.c | 34 ++
 6 files changed, 90 insertions(+), 3 deletions(-)

diff --git a/api/nl80211.h b/api/nl80211.h
index 5b7b5eb..3d252e4 100644
--- a/api/nl80211.h
+++ b/api/nl80211.h
@@ -2582,6 +2582,41 @@ enum nl80211_mpath_info {
NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1
 };
 
+/**
+ * enum nl80211_band_iftype_attr - Interface type data attributes
+ *
+ * @__NL80211_BAND_IFTYPE_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_BAND_IFTYPE_ATTR_IFTYPES: nested attribute containing a flag 
attribute
+ * for each interface type that supports the band data
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC: HE MAC capabilities as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: HE PHY capabilities as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: HE supported NSS/MCS as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as
+ * defined in HE capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute 
currently
+ * defined
+ * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16),
+ * given for all 6 GHz band channels
+ * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_band_iftype_attr {
+   __NL80211_BAND_IFTYPE_ATTR_INVALID,
+
+   NL80211_BAND_IFTYPE_ATTR_IFTYPES,
+   NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC,
+   NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
+   NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
+   NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
+   NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA,
+
+   /* keep last */
+   __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
+   NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1
+};
+
 /**
  * enum nl80211_band_attr - band attributes
  * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
@@ -2597,6 +2632,8 @@ enum nl80211_mpath_info {
  * @NL80211_BAND_ATTR_VHT_MCS_SET: 32-byte attribute containing the MCS set as
  * defined in 802.11ac
  * @NL80211_BAND_ATTR_VHT_CAPA: VHT capabilities, as in the HT information IE
+ * @NL80211_BAND_ATTR_IFTYPE_DATA: nested array attribute, with each entry 
using
+ * attributes from  nl80211_band_iftype_attr
  * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined
  * @__NL80211_BAND_ATTR_AFTER_LAST: internal use
  */
@@ -2612,6 +2649,7 @@ enum nl80211_band_attr {
 
NL80211_BAND_ATTR_VHT_MCS_SET,
NL80211_BAND_ATTR_VHT_CAPA,
+   NL80211_BAND_ATTR_IFTYPE_DATA,
 
/* keep last */
__NL80211_BAND_ATTR_AFTER_LAST,
diff --git a/include/iwinfo.h b/include/iwinfo.h
index 5e64294..d1753ef 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -29,6 +29,7 @@
 #define IWINFO_80211_N   (1 << 3)
 #define IWINFO_80211_AC  (1 << 4)
 #define IWINFO_80211_AD  (1 << 5)
+#define IWINFO_80211_AX  (1 << 6)
 
 #define IWINFO_CIPHER_NONE   (1 << 0)
 #define IWINFO_CIPHER_WEP40  (1 << 1)
@@ -89,8 +90,13 @@ enum iwinfo_htmode {
IWINFO_HTMODE_VHT80_80   = (1 << 5),
IWINFO_HTMODE_VHT160 = (1 << 6),
IWINFO_HTMODE_NOHT   = (1 << 7),
+   IWINFO_HTMODE_HE20   = (1 << 8),
+   IWINFO_HTMODE_HE40   = (1 << 9),
+   IWINFO_HTMODE_HE80   = (1 << 10),
+   IWINFO_HTMODE_HE80_80= (1 << 11),
+   IWINFO_HTMODE_HE160  = (1 << 12),
 
-   IWINFO_HTMODE_COUNT  = 8
+   IWINFO_HTMODE_COUNT  = 13
 };
 
 extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 0332bc2..c18ea49 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -282,7 +282,8 @@ static char * format_hwmodes(int modes)
(modes & IWINFO_80211_G) ? "g" : "",
(modes & IWINFO_80211_N) ? "n" : "",
(modes & IWINFO_80211_AC) ? "ac" : "",
-   (modes & IWINFO_80211_AD) ? "ad" : "");
+   (modes & IWINFO_80211_AD) ? "ad" : "",
+   (modes & IWINFO_80211_AX) ? "ax" : "");
 
return buf;
 }
diff --git a/iwinfo_lib.c b/iwinfo_lib.c
index 7a33a35..70b080c 100644
--- a/iwinfo_lib.c
+++ b/iwinfo_lib.c
@@ -65,7 +65,12 @@ const char *IWINFO_HTMODE_NAMES[] = {
"VHT80",
"VHT80+80",

[PATCH 2/2] ath79: add support for Ubiquiti UniFi AP Outdoor+

2021-01-22 Thread David Bauer
Hardware

Atheros AR7241
16M SPI-NOR
64M DDR2
Atheros AR9283 2T2R b/g/n
2x Fast Ethernet (built-in)

Installation


Transfer the Firmware update to the device using SCP.

Install using fwupdate.real -m  -d

Signed-off-by: David Bauer 
---
 .../dts/ar7241_ubnt_unifi-ap-outdoor-plus.dts | 102 ++
 target/linux/ath79/dts/ar7241_ubnt_unifi.dts  |  45 +---
 target/linux/ath79/dts/ar7241_ubnt_unifi.dtsi |  52 +
 .../generic/base-files/etc/board.d/02_network |   3 +-
 .../etc/hotplug.d/firmware/10-ath9k-eeprom|   3 +-
 target/linux/ath79/image/generic-ubnt.mk  |  30 --
 6 files changed, 180 insertions(+), 55 deletions(-)
 create mode 100644 target/linux/ath79/dts/ar7241_ubnt_unifi-ap-outdoor-plus.dts
 create mode 100644 target/linux/ath79/dts/ar7241_ubnt_unifi.dtsi

diff --git a/target/linux/ath79/dts/ar7241_ubnt_unifi-ap-outdoor-plus.dts 
b/target/linux/ath79/dts/ar7241_ubnt_unifi-ap-outdoor-plus.dts
new file mode 100644
index 00..936850b7df
--- /dev/null
+++ b/target/linux/ath79/dts/ar7241_ubnt_unifi-ap-outdoor-plus.dts
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar7241_ubnt_unifi.dtsi"
+
+/ {
+   compatible = "ubnt,unifi-ap-outdoor-plus", "qca,ar7241";
+   model = "Ubiquiti UniFi AP Outdoor+";
+
+   aliases {
+   led-boot = _white;
+   led-failsafe = _white;
+   led-running = _white;
+   led-upgrade = _white;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_white: white {
+   label = "blue";
+   gpios = < 0 GPIO_ACTIVE_HIGH>;
+   };
+
+   blue {
+   label = "white";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <5000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   uboot: partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x4>;
+   read-only;
+   };
+
+   partition@4 {
+   label = "u-boot-env";
+   reg = <0x4 0x1>;
+   read-only;
+   };
+
+   partition@5 {
+   label = "firmware";
+   reg = <0x5 0xf6>;
+
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "kernel";
+   reg = <0x0 0x30>;
+   /* Can be resized w/o issues.
+* U-Boot can load kernel from the
+* entirety of the "firmware" partition 
space.
+*/
+   };
+
+   partition@30 {
+   label = "rootfs";
+   reg = <0x30 0xc6>;
+   };
+   };
+
+   partition@fb {
+   label = "cfg";
+   reg = <0xfb 0x4>;
+   read-only;
+   };
+
+   art: partition@ff {
+   label = "art";
+   reg = <0xff 0x1>;
+   read-only;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+
+   mtd-mac-address = < 0x6>;
+};
+
+ {
+   ath9k,ubnt-hsr;
+};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts 
b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts
index bdb4c61a48..287e8cc7db 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts
@@ -1,9 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar7241.dtsi"
-
-#include 
-#include 
+#include "ar7241_ubnt_uni

[PATCH 1/2] mac80211: convert UniFi Outdoor+ HSR support to OF

2021-01-22 Thread David Bauer
Enable support for the Ubiquiti UniFi Outdoor+ RF filter via
device-tree. The old way of using platform data is not required anymore,
as it was only used on the now removed ar71xx target.

Signed-off-by: David Bauer 
---
 .../ath/551-ath9k_ubnt_uap_plus_hsr.patch | 35 ++-
 .../files/include/linux/ath9k_platform.h  |  2 --
 2 files changed, 10 insertions(+), 27 deletions(-)

diff --git 
a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch 
b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
index 4454baeef1..24cffb0e0e 100644
--- a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
+++ b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
@@ -1,27 +1,26 @@
 --- a/drivers/net/wireless/ath/ath9k/channel.c
 +++ b/drivers/net/wireless/ath/ath9k/channel.c
-@@ -15,6 +15,8 @@
+@@ -15,6 +15,7 @@
   */
  
  #include "ath9k.h"
-+#include 
 +#include "hsr.h"
  
  /* Set/change channels.  If the channel is really being changed, it's done
   * by reseting the chip.  To accomplish this we must first cleanup any pending
-@@ -22,6 +24,7 @@
+@@ -22,6 +23,7 @@
   */
  static int ath_set_channel(struct ath_softc *sc)
  {
-+  struct ath9k_platform_data *pdata = sc->dev->platform_data;
++  struct device_node *np = sc->dev->of_node;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_hw *hw = sc->hw;
-@@ -42,6 +45,11 @@ static int ath_set_channel(struct ath_so
+@@ -42,6 +44,11 @@ static int ath_set_channel(struct ath_so
ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
chan->center_freq, chandef->width);
  
-+  if (pdata && pdata->ubnt_hsr) {
++  if (of_property_read_bool(np, "ath9k,ubnt-hsr")) {
 +  ath9k_hsr_enable(ah, chandef->width, chan->center_freq);
 +  ath9k_hsr_status(ah);
 +  }
@@ -332,30 +331,27 @@
 +#endif /* HSR_H */
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -16,8 +16,10 @@
- 
- #include 
+@@ -18,6 +18,7 @@
  #include 
-+#include 
  #include "ath9k.h"
  #include "btcoex.h"
 +#include "hsr.h"
  
  u8 ath9k_parse_mpdudensity(u8 mpdudensity)
  {
-@@ -649,6 +651,7 @@ void ath_reset_work(struct work_struct *
+@@ -649,6 +650,7 @@ void ath_reset_work(struct work_struct *
  static int ath9k_start(struct ieee80211_hw *hw)
  {
struct ath_softc *sc = hw->priv;
-+  struct ath9k_platform_data *pdata = sc->dev->platform_data;
++  struct device_node *np = sc->dev->of_node;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan;
-@@ -727,6 +730,11 @@ static int ath9k_start(struct ieee80211_
+@@ -727,6 +729,11 @@ static int ath9k_start(struct ieee80211_
  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
}
  
-+  if (pdata && pdata->ubnt_hsr) {
++  if (of_property_read_bool(np, "ath9k,ubnt-hsr")) {
 +  ath9k_hsr_init(ah);
 +  ath9k_hsr_disable(ah);
 +  }
@@ -373,17 +369,6 @@
  
  ath9k-$(CPTCFG_ATH9K_DEBUGFS) += debug.o
  
 a/include/linux/ath9k_platform.h
-+++ b/include/linux/ath9k_platform.h
-@@ -53,6 +53,8 @@ struct ath9k_platform_data {
-   unsigned num_btns;
-   const struct gpio_keys_button *btns;
-   unsigned btn_poll_interval;
-+
-+  bool ubnt_hsr;
- };
- 
- #endif /* _LINUX_ATH9K_PLATFORM_H */
 --- a/local-symbols
 +++ b/local-symbols
 @@ -112,6 +112,7 @@ ATH9K_WOW=
diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h 
b/target/linux/generic/files/include/linux/ath9k_platform.h
index f1f2ad419c..e210108568 100644
--- a/target/linux/generic/files/include/linux/ath9k_platform.h
+++ b/target/linux/generic/files/include/linux/ath9k_platform.h
@@ -53,8 +53,6 @@ struct ath9k_platform_data {
unsigned num_btns;
const struct gpio_keys_button *btns;
unsigned btn_poll_interval;
-
-   bool ubnt_hsr;
 };
 
 #endif /* _LINUX_ATH9K_PLATFORM_H */
-- 
2.30.0


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


Re: [PATCH] ramips: replace obsolete mx25l25635f hack

2021-01-21 Thread David Bauer
Hi,

On 1/21/21 5:21 AM, DENG Qingfang wrote:
> The kernel bump to 5.4 removed the mx25l25635f hack, and the upstream
> property "broken-flash-reset" should be used instead.

Is this dependent on board design? The need for the old hack should be fixed by
this upstream commit [0]. Given that commit adds SNOR_F_4B_OPCODES for the
mx25l25635f, it should in turn disable the hack enabled by broken-flash-reset, 
as
this is dependend on 4B opcodes not being supported. [1]

Or am i missing something here?

[0] 
https://github.com/torvalds/linux/commit/2bffa65da43e399079dad5947c6aa9ab3cfa4ad4
[1] 
https://github.com/torvalds/linux/blob/master/drivers/mtd/spi-nor/core.c#L3270

Best wishes
David

> 
> Signed-off-by: DENG Qingfang 
> ---
>  target/linux/ramips/dts/mt7620a_youku_yk1.dts| 3 ++-
>  target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts  | 3 ++-
>  target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts | 3 ++-
>  target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts | 3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/target/linux/ramips/dts/mt7620a_youku_yk1.dts 
> b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> index 86e2031aa6..a3e73e52a7 100644
> --- a/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> +++ b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> @@ -67,10 +67,11 @@
>   status = "okay";
>  
>   flash@0 {
> - compatible = "mx25l25635f", "jedec,spi-nor";
> + compatible = "jedec,spi-nor";
>   reg = <0>;
>   spi-max-frequency = <2500>;
>   m25p,fast-read;
> + broken-flash-reset;
>  
>   partitions {
>   compatible = "fixed-partitions";
> diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts 
> b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
> index 49eeb46d5f..e805454bf6 100644
> --- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
> +++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
> @@ -65,10 +65,11 @@
>   status = "okay";
>  
>   flash@0 {
> - compatible = "mx25l25635f", "jedec,spi-nor";
> + compatible = "jedec,spi-nor";
>   reg = <0>;
>   spi-max-frequency = <8000>;
>   m25p,fast-read;
> + broken-flash-reset;
>  
>   partitions {
>   compatible = "fixed-partitions";
> diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts 
> b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
> index f5425ccfee..2454e640a9 100644
> --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
> +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
> @@ -15,9 +15,10 @@
>   status = "okay";
>  
>   flash@0 {
> - compatible = "mx25l25635f", "jedec,spi-nor";
> + compatible = "jedec,spi-nor";
>   reg = <0>;
>   spi-max-frequency = <5000>;
> + broken-flash-reset;
>  
>   partitions {
>   compatible = "fixed-partitions";
> diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts 
> b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
> index 401868362e..d5ed78d03f 100644
> --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
> +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
> @@ -11,9 +11,10 @@
>   status = "okay";
>  
>   flash@0 {
> - compatible = "mx25l25635f", "jedec,spi-nor";
> + compatible = "jedec,spi-nor";
>   reg = <0>;
>   spi-max-frequency = <5000>;
> + broken-flash-reset;
>  
>   partitions {
>   compatible = "fixed-partitions";
> 

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


[PATCH] rockchip: use stable MAC-address for NanoPi R2S

2021-01-16 Thread David Bauer
The NanoPi R2S does not have a board specific MAC address written inside
e.g. an EEPROM, hence why it is randomly generated on first boot.

The issue with that however is the lack of a driver for the PRNG.
It often results to the same MAC address used on multiple boards by
default, as urngd is not active at this early stage resulting in low
available entropy.

There is however a semi-unique identifier available to us, which is the
CID of the used SD card. It is unique to each SD card, hence we can use
it to generate the MAC address used for LAN and WAN.

Signed-off-by: David Bauer 
---
 .../rockchip/armv8/base-files/etc/board.d/02_network | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network 
b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
index e129fd6a67..48133c81a1 100755
--- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
+++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
@@ -17,6 +17,13 @@ rockchip_setup_interfaces()
esac
 }
 
+nanopi_r2s_generate_mac()
+{
+   local sd_hash=$(sha256sum 
/sys/devices/platform/ff50.dwmmc/mmc_host/mmc0/mmc0:*/cid)
+   local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 
count=12 2>/dev/null)")
+   echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
+}
+
 rockchip_setup_macs()
 {
local board="$1"
@@ -26,7 +33,7 @@ rockchip_setup_macs()
 
case "$board" in
friendlyarm,nanopi-r2s)
-   wan_mac=$(macaddr_random)
+   wan_mac=$(nanopi_r2s_generate_mac)
lan_mac=$(macaddr_add "$wan_mac" +1)
;;
esac
-- 
2.30.0


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


Re: ath10k-ct all hash values are different?

2021-01-15 Thread David Bauer

Hi Ben,

On 1/14/21 7:14 PM, Ben Greear wrote:

On 1/14/21 10:05 AM, Ben Greear wrote:

On 1/13/21 4:58 PM, Sven Roederer wrote:

Ben,

seems to me, that at least 
"firmware-5-ct-full-community-12.bin-lede.013" is

still not recovered. File is there, but contains only 0x00.
This seems to cause my fresh build of 19.07.5 to fail.


Yes, I verified that 9980 firmware is not recovered.  I'm not sure we 
have any local copy of
that old file.  Maybe someone else that has compiled this in the past 
has a working

copy they could send me to repopulate my web server?


If my grep is correct, these files are also corrupted, so if someone has 
these
cached somewhere, please send these to me I'll get them re-populated as 
well.


They should all be cached on the sources mirror. [0] Sadly downloads 
from their fail for older releases, so fixing them on your 
download-server would be great.


[0] http://sources.openwrt.org/

Best wishes
David



[greearb@ww2 downloads]$ find . -name "firmware-*lede*" -print|xargs 
grep -L ATH10

./firmware-2-ct-full-htt-mgt-community-22.bin.lede.020
./firmware-2-ct-full-community-22.bin.lede.003
./ath10k-9984-10-4b/firmware-5-ct-full-community-12.bin-lede.016
./ath10k-9984-10-4b/firmware-5-ct-full-community-12.bin-lede.020
./ath10k-9984-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.020
./ath10k-9984-10-4b/firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.020
./ath10k-9984-10-4b/firmware-5-ct-htt-mgt-community-12.bin-lede.020
./ath10k-9984-10-4b/firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.021
./ath10k-9984-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.016
./ath10k-9984-10-4/firmware-5-ct-full-community-7.bin-lede.001
./ath10k-9984-10-4/firmware-5-ct-full-community-8.bin-lede.006
./ath10k-9984-10-4/firmware-5-ct-full-community-7.bin-lede.004
./ath10k-9984-10-4/firmware-5-ct-full-community-9.bin-lede.003
./firmware-2-ct-full-htt-mgt-community-22.bin.lede.003
./firmware-2-ct-full-community-22.bin.lede.016
./ath10k-9887/firmware-2-ct-full-htt-mgt-community-22.bin.lede.020
./ath10k-9887/firmware-2-ct-full-community-22.bin.lede.020
./ath10k-9887/firmware-2-ct-full-htt-mgt-community-22.bin.lede.004
./ath10k-9887/firmware-2-ct-full-community-22.bin.lede.004
./firmware-2-ct-full-community-22.bin.lede.020
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.006
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.012
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.007
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.016
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.020
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.008
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.001
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.020
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.003
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.018
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.002
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.005
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.003
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.013
./ath10k-10-4b/firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.020
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.009
./ath10k-10-4b/firmware-5-ct-htt-mgt-community-12.bin-lede.020
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.010
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.015
./ath10k-10-4b/firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.021
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.017
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.016
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.014
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.007
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.004
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
./ath10k-10-4b/firmware-5-ct-htt-mgt-community-12.bin-lede.018
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.005
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.002
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.004
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.011
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.011
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.012
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.013
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.006
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.001
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.010
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.008
./ath10k-10-4b/firmware-5-ct-full-community-12.bin-lede.009
./ath10k-10-4b/firmware-5-ct-full-htt-mgt-community-12.bin-lede.015

[PATCH] iw: enable HE PHY information for iw-tiny

2021-01-07 Thread David Bauer
Currently PHY information obtained from "iw phy" lacks information about
a PHYs HE capabilities when using the by default installed iw-tiny.

As there are already 802.11ax supported devices, enabled printing this
information for the by-default installed iw variant.

Signed-off-by: David Bauer 
---
 package/network/utils/iw/Makefile |  2 +-
 .../utils/iw/patches/200-reduce_size.patch| 38 ++-
 2 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/package/network/utils/iw/Makefile 
b/package/network/utils/iw/Makefile
index 90e6782911..6eb10c837f 100644
--- a/package/network/utils/iw/Makefile
+++ b/package/network/utils/iw/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iw
 PKG_VERSION:=5.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/iw
diff --git a/package/network/utils/iw/patches/200-reduce_size.patch 
b/package/network/utils/iw/patches/200-reduce_size.patch
index 24eb96537b..1e8286300b 100644
--- a/package/network/utils/iw/patches/200-reduce_size.patch
+++ b/package/network/utils/iw/patches/200-reduce_size.patch
@@ -38,23 +38,7 @@
  
 --- a/info.c
 +++ b/info.c
-@@ -167,6 +167,7 @@ static int print_phy_handler(struct nl_m
-   tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
-   
print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
-  
nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
-+#ifdef IW_FULL
-   if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) {
-   struct nlattr *nl_iftype;
-   int rem_band;
-@@ -174,6 +175,7 @@ static int print_phy_handler(struct nl_m
-   nla_for_each_nested(nl_iftype, 
tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band)
-   print_he_info(nl_iftype);
-   }
-+#endif
-   if (tb_band[NL80211_BAND_ATTR_FREQS]) {
-   if (!band_had_freq) {
-   printf("\t\tFrequencies:\n");
-@@ -216,6 +218,7 @@ next:
+@@ -216,6 +216,7 @@ next:
}
}
  
@@ -62,7 +46,7 @@
if (tb_band[NL80211_BAND_ATTR_RATES]) {
printf("\t\tBitrates (non-HT):\n");
nla_for_each_nested(nl_rate, 
tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
-@@ -232,6 +235,7 @@ next:
+@@ -232,6 +233,7 @@ next:
printf("\n");
}
}
@@ -70,7 +54,7 @@
}
}
  
-@@ -297,6 +301,7 @@ next:
+@@ -297,6 +299,7 @@ next:
printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * 
coverage);
}
  
@@ -78,7 +62,7 @@
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / 
sizeof(__u32);
int i;
-@@ -308,6 +313,7 @@ next:
+@@ -308,6 +311,7 @@ next:
cipher_name(ciphers[i]));
}
}
@@ -86,7 +70,7 @@
  
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
-@@ -327,11 +333,13 @@ next:
+@@ -327,11 +331,13 @@ next:
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
}
  
@@ -100,7 +84,7 @@
  
if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
struct nlattr *nl_combi;
-@@ -428,6 +436,7 @@ broken_combination:
+@@ -428,6 +434,7 @@ broken_combination:
printf("\tinterface combinations are not supported\n");
}
  
@@ -108,7 +92,7 @@
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
printf("\tSupported commands:\n");
nla_for_each_nested(nl_cmd, 
tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
-@@ -525,6 +534,7 @@ broken_combination:
+@@ -525,6 +532,7 @@ broken_combination:
printf("\t\t * wake up on TCP connection\n");
}
}
@@ -116,7 +100,7 @@
  
if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
printf("\tDevice supports roaming.\n");
-@@ -563,6 +573,7 @@ broken_combination:
+@@ -563,6 +571,7 @@ broken_combination:
}
}
  
@@ -124,7 +108,7 @@
if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
unsigned int features = 
nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
  
-@@ -627,6 +638,7 @@ broken_combination:
+@@ -627,6 +636,7 @@ broken_combination:
if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
printf("\tDevice supports randomizing MAC-addr in 
net-detect scans.\

[PATCH] ramips: add support for Ubiquiti UniFi 6 Lite

2021-01-02 Thread David Bauer
 device. Also install the
   kmod-mtd-rw package using opkg and load it.

   $ insmod mtd-rw.ko i_want_a_brick=1

   Write the patched bootloader to mtd0

   $ mtd write patched_uboot.bin u-boot

10. Erase the kernel1 partition, as the bootloader might otherwise
decide to boot from there.

$ mtd erase kernel1

11. Transfer the OpenWrt sysupgrade image to the device and install
using sysupgrade.

FIT configurations
--

In the future, the MT7621 UniFi6 family can be supported by a single
OpenWrt image.

config@1: U6 Lite
config@2: U6 IW
config@3: U6 Mesh
config@4: U6 Extender
config@5: U6 LR-EA (Early Access - GA is MT7622)

Signed-off-by: David Bauer 
---
 .../ramips/dts/mt7621_ubnt_unifi-6-lite.dts   |  83 
 .../ramips/dts/mt7621_ubnt_unifi-nanohd.dts   |  79 +--
 .../linux/ramips/dts/mt7621_ubnt_unifi.dtsi   |  81 
 target/linux/ramips/image/mt7621.mk   |  10 +
 .../mt7621/base-files/etc/board.d/02_network  |   3 +-
 target/linux/ramips/mt7621/config-5.4 |   1 +
 ...an-up-boot_command_line-initializati.patch | 192 ++
 ...2-MIPS-Always-define-builtin_cmdline.patch |  44 
 ...-MIPS-add-bootargs-override-property.patch |  63 ++
 9 files changed, 479 insertions(+), 77 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
 create mode 100644 target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi
 create mode 100644 
target/linux/ramips/patches-5.4/0001-MIPS-cmdline-Clean-up-boot_command_line-initializati.patch
 create mode 100644 
target/linux/ramips/patches-5.4/0002-MIPS-Always-define-builtin_cmdline.patch
 create mode 100644 
target/linux/ramips/patches-5.4/0010-MIPS-add-bootargs-override-property.patch

diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts 
b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
new file mode 100644
index 00..1e40a13079
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621_ubnt_unifi.dtsi"
+
+/ {
+   compatible = "ubnt,unifi-6-lite", "mediatek,mt7621-soc";
+   model = "Ubiquiti UniFi 6 Lite";
+
+   chosen {
+   bootargs-override = "console=ttyS0,115200";
+   };
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "mx25l25635f", "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <5000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x6>;
+   read-only;
+   };
+
+   partition@6 {
+   label = "u-boot-env";
+   reg = <0x6 0x1>;
+   read-only;
+   };
+
+   factory: partition@7 {
+   label = "factory";
+   reg = <0x7 0x4>;
+   read-only;
+   };
+
+   eeprom: partition@8 {
+   label = "eeprom";
+   reg = <0xb 0x1>;
+   read-only;
+   };
+
+   partition@9 {
+   label = "bs";
+   reg = <0xc 0x1>;
+   };
+
+   partition@a {
+   label = "cfg";
+   reg = <0xd 0x10>;
+   read-only;
+   };
+
+   partition@1a {
+   compatible = "denx,fit";
+   label = "firmware";
+   reg = <0x1d 0xf1>;
+   };
+
+   partition@10d {
+   label = "kernel1";
+   reg = <0x10e 0xf1>;
+   };
+   };
+   };
+};
+
+_2g {
+   mtd-mac-address = < 0x0>;
+};
+
+_5g {
+   mediatek,mtd-eeprom = < 0x2>;
+   mtd-mac-address = < 0x6>;
+};
diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts 
b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
index 4ba5f6a428..401868362e 100644
--- a/target/linux/

Re: ath79: sysupgrade format policy for ar71xx migrations

2021-01-02 Thread David Bauer
Hi Sven,

sorry for the late reply.

Firs to fall, there is no real policy on that one, as OpenWrt itself does not
advertise support for cross-target upgrades. It might work, or it might not.

On 11/25/20 8:53 AM, Sven Eckelmann wrote:
> On Tuesday, 24 November 2020 08:58:04 CET Sven Eckelmann wrote:
> [...]
>> Now to the actual question:
> 
> I will just add some extra info to the options shown below. Maybe it makes 
> then more sense why I've added two gluon developers to the Cc.
> 
>> What should the OpenMesh devices use as images for ath79:
>>
>> 1. CE01 factory + sysupgrade-tar (like the OpenMesh IPQ40xx devices)
> 
> This would say this makes definitely sense for new devices. But in freifunk-
> gluon's context, this would mean that the autoupdater cannot automatically 
> upgrade from ar71xx to ath79.

I don't have a great overview over the current situation, but as much as i would
like to avoid having to push a pre-ath79 upgrade firmware with integrated 
per-device
upgrade paths, i think we can hardly avoid having to do such a thing, the 
alternative
being to EOL said boards.

In this specific case, adding a second sysupgrade image (be it 
gluon-downstream) and using
this as a transition image for the older releases might work or would it? We 
might also
modify the autoupdater to first try fetching an image specific to the target 
the device is
currently running to provide an upgrade paths for both targets. What do you 
think?

Best wishes
David

> 
> So if this is preferred, then there is at least a manual way to upgrade a 
> freifunk-gluon node to ath79. And this would be a "good" opportunity to get 
> rid of the CE01 upgrade code.
> 
> But maybe there is also a solution for this in gluon's context. David and 
> Matthias might know more about this.
> 
>> 2. CE01 factory + CE01 sysupgrade (like ar71xx)
> 
> At the moment, I would rather drop the factory image and not use this option. 
> This would (in my eyes) only be necessary when some tools are not able to 
> deal 
> with the metadata at the end of the sysupgrade image.
> 
>> 3. CE01 sysupgrade (like ar71xx but avoid having two files with the same 
>>content)
> 
> With this option, we would (hopefully) have a clean upgrade path with 
> freifunk-gluon's autoupdater. The dualboot_datachk sysupgrade code can be 
> adjusted to just work with CE01 images by creating some kind of hybrid 
> between 
> the old upgrade/openmesh.sh and the new upgrade/dualboot_datachk.sh. Or the 
> old upgrade/openmesh.sh (minus some unnecessary steps) can just be reused.
> 
> Kind regards,
>   Sven
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

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


[PATCH] scripts: download.pl: retry download using filename

2020-11-18 Thread David Bauer
With this commit, the download script will try downloading source files
using the filename instead of the url-filename in case the previous
download attempt using the url-filename failed.

This is required, as the OpenWrt sources mirrors serve files using the
filename files might be renamed to after downloading. If the original
mirror for a file where url-filename and filename do not match goes
down, the download failed prior to this patch.

Further improvement can be done by performing this only for the
OpenWrt sources mirrors.

Signed-off-by: David Bauer 
---
 scripts/download.pl | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/download.pl b/scripts/download.pl
index cdccae133f..351b06a08b 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -93,6 +93,7 @@ $hash_cmd or ($file_hash eq "skip") or die "Cannot find 
appropriate hash command
 sub download
 {
my $mirror = shift;
+   my $download_filename = shift;
 
$mirror =~ s!/$!!;
 
@@ -139,7 +140,7 @@ sub download
}
};
} else {
-   my @cmd = download_cmd("$mirror/$url_filename");
+   my @cmd = download_cmd("$mirror/$download_filename");
print STDERR "+ ".join(" ",@cmd)."\n";
open(FETCH_FD, '-|', @cmd) or die "Cannot launch curl or 
wget.\n";
$hash_cmd and do {
@@ -265,7 +266,10 @@ while (!-f "$target/$filename") {
my $mirror = shift @mirrors;
$mirror or die "No more mirrors to try - giving up.\n";
 
-   download($mirror);
+   download($mirror, $url_filename);
+   if (!-f "$target/$filename" && $url_filename ne $filename) {
+   download($mirror, $filename);
+   }
 }
 
 $SIG{INT} = \
-- 
2.29.2


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


[PATCH 3/3] hostapd: ubus: add get_status method

2020-11-04 Thread David Bauer
This adds a new get_status method to a hostapd interface, which
provides information about the current interface status.

Signed-off-by: David Bauer 
---
 .../services/hostapd/src/src/ap/ubus.c| 40 +++
 1 file changed, 40 insertions(+)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 3e5598b3cd..92fe06bb44 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -375,6 +375,45 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct 
ubus_object *obj,
return 0;
 }
 
+static int
+hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
+  struct ubus_request_data *req, const char *method,
+  struct blob_attr *msg)
+{
+   struct hostapd_data *hapd = container_of(obj, struct hostapd_data, 
ubus.obj);
+   void *airtime_table, *dfs_table;
+   struct os_reltime now;
+   char phy_name[17];
+   char mac_buf[20];
+
+   blob_buf_init(, 0);
+   blobmsg_add_string(, "status", 
hostapd_state_text(hapd->iface->state));
+   blobmsg_add_u32(, "freq", hapd->iface->freq);
+
+   snprintf(phy_name, 17, "%s", hapd->iface->phy);
+   blobmsg_add_string(, "phy", phy_name);
+
+   /* Airtime */
+   airtime_table = blobmsg_open_table(, "airtime");
+   blobmsg_add_u64(, "time", hapd->iface->last_channel_time);
+   blobmsg_add_u64(, "time_busy", hapd->iface->last_channel_time_busy);
+   blobmsg_add_u16(, "utilization", hapd->iface->channel_utilization);
+   blobmsg_close_table(, airtime_table);
+
+   /* DFS */
+   dfs_table = blobmsg_open_table(, "dfs");
+   blobmsg_add_u32(, "cac_seconds", hapd->iface->dfs_cac_ms / 1000);
+   blobmsg_add_u8(, "cac_active", !!(hapd->iface->cac_started));
+   os_reltime_age(>iface->dfs_cac_start, );
+   blobmsg_add_u32(, "cac_seconds_left",
+   hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 
1000 - now.sec : 0);
+   blobmsg_close_table(, dfs_table);
+
+   ubus_send_reply(ctx, req, b.head);
+
+   return 0;
+}
+
 enum {
NOTIFY_RESPONSE,
__NOTIFY_MAX
@@ -1334,6 +1373,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, 
struct ubus_object *obj,
 static const struct ubus_method bss_methods[] = {
UBUS_METHOD_NOARG("reload", hostapd_bss_reload),
UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients),
+   UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status),
UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy),
UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans),
 #ifdef CONFIG_WPS
-- 
2.29.2


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


[PATCH 1/3] hostapd: ubus: add driver information to client list

2020-11-04 Thread David Bauer
This adds information from mac80211 to hostapd get_client ubus function.
This way, TX as well as RX status information as well as the signal can
be determined.

Signed-off-by: David Bauer 
---
 .../services/hostapd/src/src/ap/ubus.c| 24 +++
 1 file changed, 24 insertions(+)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 33b9995e06..3bad4d2e0f 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -215,6 +215,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct 
ubus_object *obj,
struct blob_attr *msg)
 {
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, 
ubus.obj);
+   struct hostap_sta_driver_data sta_driver_data;
struct sta_info *sta;
void *list, *c;
char mac_buf[20];
@@ -257,6 +258,29 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct 
ubus_object *obj,
if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0)
blobmsg_add_string_buffer();
 #endif
+
+   /* Driver information */
+   if (hostapd_drv_read_sta_data(hapd, _driver_data, 
sta->addr) >= 0) {
+   r = blobmsg_open_table(, "bytes");
+   blobmsg_add_u64(, "rx", sta_driver_data.rx_bytes);
+   blobmsg_add_u64(, "tx", sta_driver_data.tx_bytes);
+   blobmsg_close_table(, r);
+   r = blobmsg_open_table(, "airtime");
+   blobmsg_add_u64(, "rx", sta_driver_data.rx_airtime);
+   blobmsg_add_u64(, "tx", sta_driver_data.tx_airtime);
+   blobmsg_close_table(, r);
+   r = blobmsg_open_table(, "packets");
+   blobmsg_add_u32(, "rx", sta_driver_data.rx_packets);
+   blobmsg_add_u32(, "tx", sta_driver_data.tx_packets);
+   blobmsg_close_table(, r);
+   r = blobmsg_open_table(, "rate");
+   /* Rate in kbits */
+   blobmsg_add_u32(, "rx", 
sta_driver_data.current_rx_rate * 100);
+   blobmsg_add_u32(, "tx", 
sta_driver_data.current_tx_rate * 100);
+   blobmsg_close_table(, r);
+   blobmsg_add_u32(, "signal", sta_driver_data.signal);
+   }
+
blobmsg_close_table(, c);
}
blobmsg_close_array(, list);
-- 
2.29.2


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


[PATCH 2/3] hostapd: ubus: add VHT capabilities to client list

2020-11-04 Thread David Bauer
This adds parsed VHT capability information to the hostapd
get_clients method.

Signed-off-by: David Bauer 
---
 .../services/hostapd/src/src/ap/ubus.c| 71 +++
 1 file changed, 71 insertions(+)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 3bad4d2e0f..3e5598b3cd 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -209,6 +209,75 @@ hostapd_bss_reload(struct ubus_context *ctx, struct 
ubus_object *obj,
return ret;
 }
 
+
+static void
+hostapd_parse_vht_map_blobmsg(uint16_t map)
+{
+   char label[4];
+   int16_t val;
+   int i;
+
+   for (i = 0; i < 8; i++) {
+   snprintf(label, 4, "%dss", i + 1);
+
+   val = (map & (BIT(1) | BIT(0))) + 7;
+   blobmsg_add_u16(, label, val == 10 ? -1 : val);
+   map = map >> 2;
+   }
+}
+
+static void
+hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc)
+{
+   void *supported_mcs;
+   void *map;
+   int i;
+
+   static const struct {
+   const char *name;
+   uint32_t flag;
+   } vht_capas[] = {
+   { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE },
+   { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE },
+   };
+
+   for (i = 0; i < ARRAY_SIZE(vht_capas); i++)
+   blobmsg_add_u8(, vht_capas[i].name,
+   !!(vhtc->vht_capabilities_info & 
vht_capas[i].flag));
+
+   supported_mcs = blobmsg_open_table(, "mcs_map");
+
+   /* RX map */
+   map = blobmsg_open_table(, "rx");
+   
hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map));
+   blobmsg_close_table(, map);
+
+   /* TX map */
+   map = blobmsg_open_table(, "tx");
+   
hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map));
+   blobmsg_close_table(, map);
+
+   blobmsg_close_table(, supported_mcs);
+}
+
+static void
+hostapd_parse_capab_blobmsg(struct sta_info *sta)
+{
+   void *r, *v;
+
+   v = blobmsg_open_table(, "capabilities");
+
+   if (sta->vht_capabilities) {
+   r = blobmsg_open_table(, "vht");
+   hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities);
+   blobmsg_close_table(, r);
+   }
+
+   /* ToDo: Add HT / HE capability parsing */
+
+   blobmsg_close_table(, v);
+}
+
 static int
 hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -281,6 +350,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_u32(, "signal", sta_driver_data.signal);
}
 
+   hostapd_parse_capab_blobmsg(sta);
+
blobmsg_close_table(, c);
}
blobmsg_close_array(, list);
-- 
2.29.2


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


[PATCH] ipq40xx: enable RX hash / CTAG TX offloading for single-phy

2020-10-27 Thread David Bauer
This re-enables offloading features disabled by
commit 9da2b567605b ("ipq40xx: fix ethernet vlan double tagging").

Single-PHY devices use port-based VLANs on the switch, therefore no
S-TAG magic is involved here. Re-enabling these features restores
throughput back to 950 Mbit/s.

Reported-by: Jannis Pinter 
Signed-off-by: David Bauer 
---
 .../drivers/net/ethernet/qualcomm/essedma/edma_axi.c | 9 +
 1 file changed, 9 insertions(+)

diff --git 
a/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_axi.c 
b/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
index 50335b0d14..49ee31a1bd 100644
--- 
a/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
+++ 
b/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
@@ -978,11 +978,20 @@ static int edma_axi_probe(struct platform_device *pdev)
edma_netdev[i]->wanted_features = NETIF_F_HW_CSUM | NETIF_F_SG |
 NETIF_F_TSO | NETIF_F_GRO;
 
+   if (of_property_read_bool(np, "qcom,single-phy") && 
edma_cinfo->num_gmac == 1)
+   edma_netdev[i]->features |= NETIF_F_HW_VLAN_CTAG_TX;
+
 #ifdef CONFIG_RFS_ACCEL
edma_netdev[i]->features |=  NETIF_F_NTUPLE;
edma_netdev[i]->hw_features |=  NETIF_F_NTUPLE;
edma_netdev[i]->vlan_features |= NETIF_F_NTUPLE;
edma_netdev[i]->wanted_features |= NETIF_F_NTUPLE;
+   if (of_property_read_bool(np, "qcom,single-phy") && 
edma_cinfo->num_gmac == 1) {
+   edma_netdev[i]->features |= NETIF_F_RXHASH;
+   edma_netdev[i]->hw_features |= NETIF_F_RXHASH;
+   edma_netdev[i]->vlan_features |= NETIF_F_RXHASH;
+   edma_netdev[i]->wanted_features |= NETIF_F_RXHASH;
+   }
 #endif
edma_set_ethtool_ops(edma_netdev[i]);
 
-- 
2.29.1


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


Re: [PATCH] hostapd: Add cell_density data rates option

2020-10-25 Thread David Bauer
Hi Nick,

see my inline comment

On 10/19/20 1:56 AM, Nick Lowe wrote:
>  .../network/services/hostapd/files/hostapd.sh | 70 +++
>  1 file changed, 57 insertions(+), 13 deletions(-)
> 
> diff --git a/package/network/services/hostapd/files/hostapd.sh 
> b/package/network/services/hostapd/files/hostapd.sh
> index b33e8e1edc..2bf67601c5 100644
> --- a/package/network/services/hostapd/files/hostapd.sh
> +++ b/package/network/services/hostapd/files/hostapd.sh
> @@ -98,6 +98,7 @@ hostapd_common_add_device_config() {
>   config_add_int local_pwr_constraint
>   config_add_string require_mode
>   config_add_boolean legacy_rates
> + config_add_int cell_density
>  
>   config_add_string acs_chan_bias
>   config_add_array hostapd_options
> @@ -113,7 +114,7 @@ hostapd_prepare_device_config() {
>   local base_cfg=
>  
>   json_get_vars country country_ie beacon_int:100 dtim_period:2 doth 
> require_mode legacy_rates \
> - acs_chan_bias local_pwr_constraint spectrum_mgmt_required 
> airtime_mode
> + acs_chan_bias local_pwr_constraint spectrum_mgmt_required 
> airtime_mode cell_density
>  
>   hostapd_set_log_options base_cfg
>  
> @@ -122,8 +123,7 @@ hostapd_prepare_device_config() {
>   set_default doth 1
>   set_default legacy_rates 1
>   set_default airtime_mode 0
> -
> - [ "$hwmode" = "b" ] && legacy_rates=1
> + set_default cell_density 0
>  
>   [ -n "$country" ] && {
>   append base_cfg "country_code=$country" "$N"
> @@ -144,16 +144,60 @@ hostapd_prepare_device_config() {
>   json_get_values rate_list supported_rates
>  
>   [ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N"
> - [ "$legacy_rates" -eq 0 ] && set_default require_mode g
> -
> - [ "$hwmode" = "g" ] && {
> - [ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 
> 12000 18000 24000 36000 48000 54000"
> - [ -n "$require_mode" ] && set_default basic_rate_list "6000 
> 12000 24000"
> - }
> -
> - case "$require_mode" in
> - n) append base_cfg "require_ht=1" "$N";;
> - ac) append base_cfg "require_vht=1" "$N";;
> + if [ "$hwmode" = "g" ] || [ "$hwmode" = "a" ]; then
> + [ -n "$require_mode" ] && legacy_rates=0
> + case "$require_mode" in
> + n) append base_cfg "require_ht=1" "$N";;
> + ac) append base_cfg "require_vht=1" "$N";;
> + esac
> + fi
> + case "$hwmode" in
> + b)
> + if [ "$cell_density" -eq 1 ]; then
> + set_default rate_list "5500 11000"
> + set_default basic_rate_list "5500 11000"
> + elif [ "$cell_density" -ge 2 ]; then
> + set_default rate_list "11000"
> + set_default basic_rate_list "11000"
> + fi
> + ;;
> + g)
> + if [ "$cell_density" -eq 0 ] && [ "$legacy_rates" -eq 0 
> ]; then
> + set_default rate_list "6000 9000 12000 18000 
> 24000 36000 48000 54000"
> + set_default basic_rate_list "6000 12000 24000"
> + elif [ "$cell_density" -eq 1 ]; then
> + if [ "$legacy_rates" -eq 0 ]; then
> + set_default rate_list "6000 9000 12000 
> 18000 24000 36000 48000 54000"
> + set_default basic_rate_list "6000 12000 
> 24000"
> + else
> + set_default rate_list "5500 6000 9000 
> 11000 12000 18000 24000 36000 48000 54000"
> + set_default basic_rate_list "5500 11000"
> + fi
> + elif [ "$cell_density" -eq 2 ] || [ "$legacy_rates" -ne 
> 0 ]; then

This branch will be taken if cell_density is set to 0 and legacy_rates is set 
to 1. This looks wrong to me,
as the condition below will never evaluate to true.

Best wishes
David

> + if [ "$legacy_rates" -eq 0 ]; then
> + set_default rate_list "12000 18000 
> 24000 36000 48000 54000"
> + set_default basic_rate_list "12000 
> 24000"
> + else
> + set_default rate_list "11000 12000 
> 18000 24000 36000 48000 54000"
> + set_default basic_rate_list "11000"
> + fi
> + elif [ "$cell_density" -ge 3 ]; then
> + set_default rate_list "24000 36000 48000 54000"
> + set_default basic_rate_list "24000"
> + fi
> + ;;
> + a)
> + if [ 

[PATCH 2/2] hostapd: remove ieee80211v option

2020-10-20 Thread David Bauer
Remove the ieee80211v option. It previously was required to be enabled
in order to use time_advertisement, time_zone, wnm_sleep_mode and
bss_transition, however it didn't enable any of these options by default.

Remove it, as configuring these options independently is enough.

This change does not influence the behavior of any already configured
setting.

Signed-off-by: David Bauer 
---
 .../network/services/hostapd/files/hostapd.sh | 20 ++-
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh
index 39a175fdb1..ffdbdd9831 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -619,20 +619,12 @@ hostapd_set_bss_options() {
append bss_conf "iapp_interface=$ifname" "$N"
}
 
-   json_get_vars ieee80211v
-   set_default ieee80211v 0
-   if [ "$ieee80211v" -eq "1" ]; then
-   json_get_vars time_advertisement time_zone wnm_sleep_mode 
bss_transition
-
-   set_default time_advertisement 0
-   set_default wnm_sleep_mode 0
-   set_default bss_transition 0
-
-   append bss_conf "time_advertisement=$time_advertisement" "$N"
-   [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" 
"$N"
-   append bss_conf "wnm_sleep_mode=$wnm_sleep_mode" "$N"
-   append bss_conf "bss_transition=$bss_transition" "$N"
-   fi
+   json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition
+
+   [ -n "$time_advertisement" ] && append bss_conf 
"time_advertisement=$time_advertisement" "$N"
+   [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
+   [ -n "$wnm_sleep_mode" ] && append bss_conf 
"wnm_sleep_mode=$wnm_sleep_mode" "$N"
+   [ -n "$bss_transition" ] && append bss_conf 
"bss_transition=$bss_transition" "$N"
 
json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report
set_default ieee80211k 0
-- 
2.28.0


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


[PATCH 1/2] hostapd: make rrm report independent of ieee80211k setting

2020-10-20 Thread David Bauer
Allow to configure both RRM beacon as well as neighbor reports
independently and only enable them by default in case the ieee80211k
config option is set.

Signed-off-by: David Bauer 
---
 package/network/services/hostapd/files/hostapd.sh | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh
index 4d06e8afa2..39a175fdb1 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -634,17 +634,16 @@ hostapd_set_bss_options() {
append bss_conf "bss_transition=$bss_transition" "$N"
fi
 
-   json_get_vars ieee80211k
+   json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report
set_default ieee80211k 0
if [ "$ieee80211k" -eq "1" ]; then
-   json_get_vars rrm_neighbor_report rrm_beacon_report
-
set_default rrm_neighbor_report 1
set_default rrm_beacon_report 1
-   append bss_conf "rrm_neighbor_report=$rrm_neighbor_report" "$N"
-   append bss_conf "rrm_beacon_report=$rrm_beacon_report" "$N"
fi
 
+   [ "$rrm_neighbor_report" -eq "1" ] && append bss_conf 
"rrm_neighbor_report=$rrm_neighbor_report" "$N"
+   [ "$rrm_beacon_report" -eq "1" ] && append bss_conf 
"rrm_beacon_report=$rrm_beacon_report" "$N"
+
if [ "$wpa" -ge "1" ]; then
json_get_vars ieee80211r
set_default ieee80211r 0
-- 
2.28.0


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


[PATCH] hostapd: add interworking support

2020-10-20 Thread David Bauer
This adds configuration options to enable interworking for hostapd.
All options require iw_enabled to be set to 1 for a given VAP.

All IEEE802.11u related settings are supported with exception of the
venue information which will be added as separate UCI sections at a
later point.

The options use the same name as the ones from the hostapd.conf file
with a "iw_" prefix added.

All UCI configuration options are passed without further modifications
to hostapd with exceptions of the following options, whose elements can
be provided using UCI lis elements:

 - iw_roaming_consortium
 - iw_anqp_elem
 - iw_nai_realm
 - iw_domain_name
 - iw_anqp_3gpp_cell_net

Signed-off-by: David Bauer 
---
 .../hostapd/files/hostapd-full.config |  2 +-
 .../network/services/hostapd/files/hostapd.sh | 78 +++
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/files/hostapd-full.config 
b/package/network/services/hostapd/files/hostapd-full.config
index ab9d13aae7..fee4479dfa 100644
--- a/package/network/services/hostapd/files/hostapd-full.config
+++ b/package/network/services/hostapd/files/hostapd-full.config
@@ -313,7 +313,7 @@ CONFIG_INTERNAL_LIBTOMMATH=y
 # Interworking (IEEE 802.11u)
 # This can be used to enable functionality to improve interworking with
 # external networks.
-#CONFIG_INTERWORKING=y
+CONFIG_INTERWORKING=y
 
 # Hotspot 2.0
 #CONFIG_HS20=y
diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh
index e5457cc9b7..89353227c7 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -269,6 +269,13 @@ hostapd_common_add_bss_config() {
 
config_add_string 'owe_transition_bssid:macaddr' 
'owe_transition_ssid:string'
 
+   config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
+   config_add_int iw_access_network_type iw_venue_group iw_venue_type
+   config_add_int iw_ipaddr_type_availability iw_gas_address3
+   config_add_string iw_hessid iw_network_auth_type iw_qos_map_set
+   config_add_array iw_roaming_consortium iw_domain_name 
iw_anqp_3gpp_cell_net iw_nai_realm
+   config_add_array iw_anqp_elem
+
config_add_boolean hs20 disable_dgaf osen
config_add_int anqp_domain_id
config_add_int hs20_deauth_req_timeout
@@ -317,6 +324,34 @@ hostapd_set_psk() {
for_each_station hostapd_set_psk_file ${ifname}
 }
 
+append_iw_roaming_consortium() {
+   [ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N"
+}
+
+append_iw_domain_name() {
+   if [ -z "$iw_domain_name_conf" ]; then
+   iw_domain_name_conf="$1"
+   else
+   iw_domain_name_conf="$iw_domain_name_conf,$1"
+   fi
+}
+
+append_iw_anqp_3gpp_cell_net() {
+   if [ -z "$iw_anqp_3gpp_cell_net_conf" ]; then
+   iw_anqp_3gpp_cell_net_conf="$1"
+   else
+   iw_anqp_3gpp_cell_net_conf="$iw_anqp_3gpp_cell_net_conf:$1"
+   fi
+}
+
+append_iw_anqp_elem() {
+   [ -n "$1" ] && append bss_conf "anqp_elem=$1" "$N"
+}
+
+append_iw_nai_realm() {
+   [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
+}
+
 append_hs20_oper_friendly_name() {
append bss_conf "hs20_oper_friendly_name=$1" "$N"
 }
@@ -783,6 +818,49 @@ hostapd_set_bss_options() {
}
}
 
+   json_get_vars iw_enabled iw_internet iw_asra iw_esr iw_uesa 
iw_access_network_type
+   json_get_vars iw_hessid iw_venue_group iw_venue_type 
iw_network_auth_type
+   json_get_vars iw_roaming_consortium iw_domain_name 
iw_anqp_3gpp_cell_net iw_nai_realm
+   json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability 
iw_gas_address3
+
+   set_default iw_enabled 0
+   if [ "$iw_enabled" = "1" ]; then
+   append bss_conf "interworking=1" "$N"
+   set_default iw_internet 1
+   set_default iw_asra 0
+   set_default iw_esr 0
+   set_default iw_uesa 0
+
+   append bss_conf "internet=$iw_internet" "$N"
+   append bss_conf "asra=$iw_asra" "$N"
+   append bss_conf "esr=$iw_esr" "$N"
+   append bss_conf "uesa=$iw_uesa" "$N"
+
+   [ -n "$iw_access_network_type" ] && \
+   append bss_conf 
"access_network_type=$iw_access_network_type" "$N"
+   [ -n "$iw_hessid" ] && append bss_conf "hessid=$iw_hessid" "$N"
+   [ -n "$iw_venue_group" ] && \
+   ap

  1   2   3   4   >